mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-06-20 11:47:55 -05:00
Reformat code with clang format
This commit is contained in:
@ -1,14 +1,13 @@
|
||||
#include "DdsWriter.h"
|
||||
|
||||
#include "Image/DdsTypes.h"
|
||||
#include "Image/TextureConverter.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
|
||||
#include "Image/DdsTypes.h"
|
||||
#include "Image/TextureConverter.h"
|
||||
|
||||
const std::map<ImageFormatId, ImageFormatId> DDS_CONVERSION_TABLE
|
||||
{
|
||||
const std::map<ImageFormatId, ImageFormatId> DDS_CONVERSION_TABLE{
|
||||
{ImageFormatId::R8_G8_B8, ImageFormatId::B8_G8_R8_X8},
|
||||
};
|
||||
|
||||
@ -130,11 +129,8 @@ class DdsWriterInternal
|
||||
|
||||
if (m_texture->GetTextureType() == TextureType::T_CUBE)
|
||||
{
|
||||
header.dwCaps2 |=
|
||||
DDSCAPS2_CUBEMAP
|
||||
| DDSCAPS2_CUBEMAP_POSITIVEX | DDSCAPS2_CUBEMAP_NEGATIVEX
|
||||
| DDSCAPS2_CUBEMAP_POSITIVEY | DDSCAPS2_CUBEMAP_NEGATIVEY
|
||||
| DDSCAPS2_CUBEMAP_POSITIVEZ | DDSCAPS2_CUBEMAP_NEGATIVEZ;
|
||||
header.dwCaps2 |= DDSCAPS2_CUBEMAP | DDSCAPS2_CUBEMAP_POSITIVEX | DDSCAPS2_CUBEMAP_NEGATIVEX | DDSCAPS2_CUBEMAP_POSITIVEY
|
||||
| DDSCAPS2_CUBEMAP_NEGATIVEY | DDSCAPS2_CUBEMAP_POSITIVEZ | DDSCAPS2_CUBEMAP_NEGATIVEZ;
|
||||
}
|
||||
|
||||
header.dwCaps3 = 0;
|
||||
@ -170,7 +166,7 @@ class DdsWriterInternal
|
||||
{
|
||||
auto entry = DDS_CONVERSION_TABLE.find(m_texture->GetFormat()->GetId());
|
||||
|
||||
if(entry != DDS_CONVERSION_TABLE.end())
|
||||
if (entry != DDS_CONVERSION_TABLE.end())
|
||||
{
|
||||
TextureConverter converter(m_texture, ImageFormat::ALL_FORMATS[static_cast<unsigned>(entry->second)]);
|
||||
m_converted_texture = std::unique_ptr<Texture>(converter.Convert());
|
||||
@ -225,8 +221,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
DdsWriter::~DdsWriter()
|
||||
= default;
|
||||
DdsWriter::~DdsWriter() = default;
|
||||
|
||||
bool DdsWriter::SupportsImageFormat(const ImageFormat* imageFormat)
|
||||
{
|
||||
|
@ -6,7 +6,7 @@ class DdsWriter final : public IImageWriter
|
||||
public:
|
||||
~DdsWriter() override;
|
||||
|
||||
bool SupportsImageFormat(const ImageFormat * imageFormat) override;
|
||||
bool SupportsImageFormat(const ImageFormat* imageFormat) override;
|
||||
std::string GetFileExtension() override;
|
||||
void DumpImage(std::ostream& stream, Texture* texture) override;
|
||||
};
|
||||
|
@ -1,10 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
#include "Image/Texture.h"
|
||||
|
||||
#include <ostream>
|
||||
#include <string>
|
||||
|
||||
#include "Image/Texture.h"
|
||||
|
||||
class IImageWriter
|
||||
{
|
||||
public:
|
||||
@ -13,4 +13,4 @@ public:
|
||||
virtual bool SupportsImageFormat(const ImageFormat* imageFormat) = 0;
|
||||
virtual std::string GetFileExtension() = 0;
|
||||
virtual void DumpImage(std::ostream& stream, Texture* texture) = 0;
|
||||
};
|
||||
};
|
||||
|
@ -1,14 +1,13 @@
|
||||
#include "IwiWriter27.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <ostream>
|
||||
|
||||
using namespace iwi27;
|
||||
|
||||
IwiWriter::IwiWriter()
|
||||
= default;
|
||||
IwiWriter::IwiWriter() = default;
|
||||
|
||||
IwiWriter::~IwiWriter()
|
||||
= default;
|
||||
IwiWriter::~IwiWriter() = default;
|
||||
|
||||
IwiFormat IwiWriter::GetIwiFormatForImageFormat(const ImageFormat* imageFormat)
|
||||
{
|
||||
|
@ -27,4 +27,4 @@ namespace iwi27
|
||||
std::string GetFileExtension() override;
|
||||
void DumpImage(std::ostream& stream, Texture* texture) override;
|
||||
};
|
||||
}
|
||||
} // namespace iwi27
|
||||
|
@ -4,13 +4,11 @@
|
||||
|
||||
using namespace iwi6;
|
||||
|
||||
IwiWriter::IwiWriter()
|
||||
= default;
|
||||
IwiWriter::IwiWriter() = default;
|
||||
|
||||
IwiWriter::~IwiWriter()
|
||||
= default;
|
||||
IwiWriter::~IwiWriter() = default;
|
||||
|
||||
IwiFormat IwiWriter::GetIwiFormatForImageFormat(const ImageFormat * imageFormat)
|
||||
IwiFormat IwiWriter::GetIwiFormatForImageFormat(const ImageFormat* imageFormat)
|
||||
{
|
||||
switch (imageFormat->GetId())
|
||||
{
|
||||
@ -40,7 +38,7 @@ IwiFormat IwiWriter::GetIwiFormatForImageFormat(const ImageFormat * imageFormat)
|
||||
}
|
||||
}
|
||||
|
||||
void IwiWriter::WriteVersion(std::ostream & stream)
|
||||
void IwiWriter::WriteVersion(std::ostream& stream)
|
||||
{
|
||||
IwiVersion version{};
|
||||
version.tag[0] = 'I';
|
||||
@ -51,14 +49,14 @@ void IwiWriter::WriteVersion(std::ostream & stream)
|
||||
stream.write(reinterpret_cast<char*>(&version), sizeof(IwiVersion));
|
||||
}
|
||||
|
||||
void IwiWriter::FillHeader2D(IwiHeader * header, Texture2D * texture)
|
||||
void IwiWriter::FillHeader2D(IwiHeader* header, Texture2D* texture)
|
||||
{
|
||||
header->dimensions[0] = static_cast<uint16_t>(texture->GetWidth());
|
||||
header->dimensions[1] = static_cast<uint16_t>(texture->GetHeight());
|
||||
header->dimensions[2] = 1u;
|
||||
}
|
||||
|
||||
void IwiWriter::FillHeaderCube(IwiHeader * header, TextureCube * texture)
|
||||
void IwiWriter::FillHeaderCube(IwiHeader* header, TextureCube* texture)
|
||||
{
|
||||
header->dimensions[0] = static_cast<uint16_t>(texture->GetWidth());
|
||||
header->dimensions[1] = static_cast<uint16_t>(texture->GetHeight());
|
||||
@ -66,7 +64,7 @@ void IwiWriter::FillHeaderCube(IwiHeader * header, TextureCube * texture)
|
||||
header->flags |= IMG_FLAG_CUBEMAP;
|
||||
}
|
||||
|
||||
void IwiWriter::FillHeader3D(IwiHeader * header, Texture3D * texture)
|
||||
void IwiWriter::FillHeader3D(IwiHeader* header, Texture3D* texture)
|
||||
{
|
||||
header->dimensions[0] = static_cast<uint16_t>(texture->GetWidth());
|
||||
header->dimensions[1] = static_cast<uint16_t>(texture->GetHeight());
|
||||
@ -74,7 +72,7 @@ void IwiWriter::FillHeader3D(IwiHeader * header, Texture3D * texture)
|
||||
header->flags |= IMG_FLAG_VOLMAP;
|
||||
}
|
||||
|
||||
bool IwiWriter::SupportsImageFormat(const ImageFormat * imageFormat)
|
||||
bool IwiWriter::SupportsImageFormat(const ImageFormat* imageFormat)
|
||||
{
|
||||
return GetIwiFormatForImageFormat(imageFormat) != IwiFormat::IMG_FORMAT_INVALID;
|
||||
}
|
||||
@ -84,7 +82,7 @@ std::string IwiWriter::GetFileExtension()
|
||||
return ".iwi";
|
||||
}
|
||||
|
||||
void IwiWriter::DumpImage(std::ostream & stream, Texture * texture)
|
||||
void IwiWriter::DumpImage(std::ostream& stream, Texture* texture)
|
||||
{
|
||||
assert(texture != nullptr);
|
||||
|
||||
|
@ -27,4 +27,4 @@ namespace iwi6
|
||||
std::string GetFileExtension() override;
|
||||
void DumpImage(std::ostream& stream, Texture* texture) override;
|
||||
};
|
||||
}
|
||||
} // namespace iwi6
|
||||
|
@ -4,11 +4,9 @@
|
||||
|
||||
using namespace iwi8;
|
||||
|
||||
IwiWriter::IwiWriter()
|
||||
= default;
|
||||
IwiWriter::IwiWriter() = default;
|
||||
|
||||
IwiWriter::~IwiWriter()
|
||||
= default;
|
||||
IwiWriter::~IwiWriter() = default;
|
||||
|
||||
IwiFormat IwiWriter::GetIwiFormatForImageFormat(const ImageFormat* imageFormat)
|
||||
{
|
||||
|
@ -27,4 +27,4 @@ namespace iwi8
|
||||
std::string GetFileExtension() override;
|
||||
void DumpImage(std::ostream& stream, Texture* texture) override;
|
||||
};
|
||||
}
|
||||
} // namespace iwi8
|
||||
|
Reference in New Issue
Block a user