diff --git a/Source/Engine/Content/Utilities/IESLoader.cpp b/Source/Engine/ContentImporters/ImportIES.cpp similarity index 96% rename from Source/Engine/Content/Utilities/IESLoader.cpp rename to Source/Engine/ContentImporters/ImportIES.cpp index 271ab3d5e..b4c9ea433 100644 --- a/Source/Engine/Content/Utilities/IESLoader.cpp +++ b/Source/Engine/ContentImporters/ImportIES.cpp @@ -1,9 +1,11 @@ // Copyright (c) 2012-2021 Wojciech Figat. All rights reserved. +#if COMPILE_WITH_ASSETS_IMPORTER + +#include "ImportIES.h" #include "Engine/Core/Log.h" #include "Engine/Core/RandomStream.h" #include "Engine/Core/Math/Packed.h" -#include "IESLoader.h" #define MAX_LINE 200 @@ -84,7 +86,7 @@ static bool ReadLine(const uint8*& bufferPos, int32& ret) #define PARSE_FLOAT(x) float x; if (!ReadFloat(bufferPos, x)) { return true; } #define PARSE_INT(x) int32 x; if (!ReadLine(bufferPos, x)) { return true; } -bool IESLoader::Load(const byte* buffer) +bool ImportIES::Load(const byte* buffer) { // Referenced IES file format: // http://www.ltblight.com/English.lproj/LTBLhelp/pages/iesformat.html @@ -214,7 +216,7 @@ bool IESLoader::Load(const byte* buffer) #undef PARSE_FLOAT #undef PARSE_INT -float IESLoader::ExtractInR16(Array& output) +float ImportIES::ExtractInR16(Array& output) { const uint32 width = GetWidth(); const uint32 height = GetHeight(); @@ -263,14 +265,14 @@ float IESLoader::ExtractInR16(Array& output) return maxValue / integral; } -float IESLoader::InterpolatePoint(int32 x, int32 y) const +float ImportIES::InterpolatePoint(int32 x, int32 y) const { x %= _hAngles.Count(); y %= _vAngles.Count(); return _candalaValues[y + _vAngles.Count() * x]; } -float IESLoader::InterpolateBilinear(float x, float y) const +float ImportIES::InterpolateBilinear(float x, float y) const { const int32 xInt = static_cast(x); const int32 yInt = static_cast(y); @@ -289,7 +291,7 @@ float IESLoader::InterpolateBilinear(float x, float y) const return Math::Lerp(p0, p1, xFrac); } -float IESLoader::ComputeFilterPos(float value, const Array& sortedValues) +float ImportIES::ComputeFilterPos(float value, const Array& sortedValues) { ASSERT(sortedValues.HasItems()); @@ -336,3 +338,5 @@ float IESLoader::ComputeFilterPos(float value, const Array& sortedValues) return startPos + fraction; } + +#endif diff --git a/Source/Engine/Content/Utilities/IESLoader.h b/Source/Engine/ContentImporters/ImportIES.h similarity index 95% rename from Source/Engine/Content/Utilities/IESLoader.h rename to Source/Engine/ContentImporters/ImportIES.h index f25a9d7ff..158613958 100644 --- a/Source/Engine/Content/Utilities/IESLoader.h +++ b/Source/Engine/ContentImporters/ImportIES.h @@ -2,13 +2,15 @@ #pragma once +#if COMPILE_WITH_ASSETS_IMPORTER + #include "Engine/Core/Types/BaseTypes.h" #include "Engine/Core/Collections/Array.h" /// /// Utility for loading IES files and extract light emission information. /// -class IESLoader +class ImportIES { private: @@ -56,3 +58,5 @@ private: float InterpolateBilinear(float x, float y) const; static float ComputeFilterPos(float value, const Array& sortedValues); }; + +#endif diff --git a/Source/Engine/ContentImporters/ImportTexture.cpp b/Source/Engine/ContentImporters/ImportTexture.cpp index 4537d496f..7daa62d9d 100644 --- a/Source/Engine/ContentImporters/ImportTexture.cpp +++ b/Source/Engine/ContentImporters/ImportTexture.cpp @@ -13,7 +13,7 @@ #include "Engine/Graphics/Textures/TextureUtils.h" #include "Engine/Graphics/PixelFormatExtensions.h" #include "Engine/Content/Storage/ContentStorageManager.h" -#include "Engine/Content/Utilities/IESLoader.h" +#include "Engine/ContentImporters/ImportIES.h" #include "Engine/Content/Assets/CubeTexture.h" #include "Engine/Content/Assets/IESProfile.h" #include "Engine/Content/Assets/Texture.h" @@ -527,7 +527,7 @@ CreateAssetResult ImportTexture::ImportIES(class CreateAssetContext& context) fileData.Add('\0'); // Load IES profile data - IESLoader loader; + ::ImportIES loader; if (loader.Load(fileData.Get())) { return CreateAssetResult::Error;