From 632abc2793bf74e060e9a3520e4060759851e104 Mon Sep 17 00:00:00 2001 From: D-AIRY <admin@ds-servers.com> Date: Sun, 25 Aug 2019 19:37:24 +0300 Subject: [PATCH] dds plugin (begin) --- proj/SkyXEngine/vs2013/SkyXEngine.sln | 11 + proj/ddsplugin/vs2013/ddsplugin.vcxproj | 192 +++++++++++ .../vs2013/ddsplugin.vcxproj.filters | 34 ++ source/core/Core.cpp | 13 + source/ddsplugin/DDSFile.h | 307 ++++++++++++++++++ source/ddsplugin/TextureLoader.cpp | 144 ++++++++ source/ddsplugin/TextureLoader.h | 38 +++ source/ddsplugin/dllmain.cpp | 24 ++ source/ddsplugin/plugin_main.cpp | 47 +++ source/xcommon/IXTextureLoader.h | 12 +- 10 files changed, 817 insertions(+), 5 deletions(-) create mode 100644 proj/ddsplugin/vs2013/ddsplugin.vcxproj create mode 100644 proj/ddsplugin/vs2013/ddsplugin.vcxproj.filters create mode 100644 source/ddsplugin/DDSFile.h create mode 100644 source/ddsplugin/TextureLoader.cpp create mode 100644 source/ddsplugin/TextureLoader.h create mode 100644 source/ddsplugin/dllmain.cpp create mode 100644 source/ddsplugin/plugin_main.cpp diff --git a/proj/SkyXEngine/vs2013/SkyXEngine.sln b/proj/SkyXEngine/vs2013/SkyXEngine.sln index 99a913d48..807022ca1 100644 --- a/proj/SkyXEngine/vs2013/SkyXEngine.sln +++ b/proj/SkyXEngine/vs2013/SkyXEngine.sln @@ -351,6 +351,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "xCore", "xCore", "{74D74409 EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sxambient", "..\..\sxambient\vs2013\sxambient.vcxproj", "{6FE14C5C-6052-4D96-A89F-0843D91F89AD}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ddsplugin", "..\..\ddsplugin\vs2013\ddsplugin.vcxproj", "{FE640066-C8E8-41FB-AD13-89BC03BFFBFB}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 @@ -659,6 +661,14 @@ Global {6FE14C5C-6052-4D96-A89F-0843D91F89AD}.Release|Win32.Build.0 = Release|Win32 {6FE14C5C-6052-4D96-A89F-0843D91F89AD}.Release|x64.ActiveCfg = Release|x64 {6FE14C5C-6052-4D96-A89F-0843D91F89AD}.Release|x64.Build.0 = Release|x64 + {FE640066-C8E8-41FB-AD13-89BC03BFFBFB}.Debug|Win32.ActiveCfg = Debug|Win32 + {FE640066-C8E8-41FB-AD13-89BC03BFFBFB}.Debug|Win32.Build.0 = Debug|Win32 + {FE640066-C8E8-41FB-AD13-89BC03BFFBFB}.Debug|x64.ActiveCfg = Debug|x64 + {FE640066-C8E8-41FB-AD13-89BC03BFFBFB}.Debug|x64.Build.0 = Debug|x64 + {FE640066-C8E8-41FB-AD13-89BC03BFFBFB}.Release|Win32.ActiveCfg = Release|Win32 + {FE640066-C8E8-41FB-AD13-89BC03BFFBFB}.Release|Win32.Build.0 = Release|Win32 + {FE640066-C8E8-41FB-AD13-89BC03BFFBFB}.Release|x64.ActiveCfg = Release|x64 + {FE640066-C8E8-41FB-AD13-89BC03BFFBFB}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -720,6 +730,7 @@ Global {D2386C4E-7032-487B-8EAD-951778AD6EBC} = {74D74409-BAC7-4DD0-8C74-117516B4A01C} {74D74409-BAC7-4DD0-8C74-117516B4A01C} = {13D5622C-8643-4BD8-A730-B5C919DAFDDC} {6FE14C5C-6052-4D96-A89F-0843D91F89AD} = {E6B16854-D4A4-4B56-8E1C-482DD523F205} + {FE640066-C8E8-41FB-AD13-89BC03BFFBFB} = {7C1F0E50-7A19-4AB4-B559-11EF078F4787} EndGlobalSection GlobalSection(Performance) = preSolution HasPerformanceSessions = true diff --git a/proj/ddsplugin/vs2013/ddsplugin.vcxproj b/proj/ddsplugin/vs2013/ddsplugin.vcxproj new file mode 100644 index 000000000..ea339c22f --- /dev/null +++ b/proj/ddsplugin/vs2013/ddsplugin.vcxproj @@ -0,0 +1,192 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\..\source\ddsplugin\dllmain.cpp" /> + <ClCompile Include="..\..\..\source\ddsplugin\TextureLoader.cpp" /> + <ClCompile Include="..\..\..\source\ddsplugin\plugin_main.cpp" /> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\..\source\ddsplugin\DDSFile.h" /> + <ClInclude Include="..\..\..\source\ddsplugin\TextureLoader.h" /> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{FE640066-C8E8-41FB-AD13-89BC03BFFBFB}</ProjectGuid> + <Keyword>Win32Proj</Keyword> + <RootNamespace>ddsplugin</RootNamespace> + <ProjectName>ddsplugin</ProjectName> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <PlatformToolset>v120_xp</PlatformToolset> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <PlatformToolset>v120_xp</PlatformToolset> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <PlatformToolset>v120_xp</PlatformToolset> + <WholeProgramOptimization>true</WholeProgramOptimization> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <PlatformToolset>v120_xp</PlatformToolset> + <WholeProgramOptimization>true</WholeProgramOptimization> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <LinkIncremental>false</LinkIncremental> + <OutDir>../../../build/bin/plugins/</OutDir> + <TargetName>$(ProjectName)_d</TargetName> + <IncludePath>$(IncludePath);../../../sdks/;$(WindowsSdk_71A_IncludePath);../../../source;</IncludePath> + <LibraryPath>;../../../libs;$(LibraryPath)</LibraryPath> + <SourcePath>../../../source;$(SourcePath)</SourcePath> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <TargetName>$(ProjectName)_d</TargetName> + <IncludePath>$(IncludePath);../../../sdks/;$(WindowsSdk_71A_IncludePath);../../../source;</IncludePath> + <LibraryPath>;../../../libs64;$(LibraryPath)</LibraryPath> + <SourcePath>../../../source;$(SourcePath)</SourcePath> + <LinkIncremental>false</LinkIncremental> + <OutDir>../../../build/bin64/plugins/</OutDir> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <LinkIncremental>false</LinkIncremental> + <OutDir>../../../build/bin/plugins/</OutDir> + <IncludePath>$(IncludePath);../../../sdks/;$(WindowsSdk_71A_IncludePath);../../../source;</IncludePath> + <LibraryPath>;../../../libs;$(LibraryPath)</LibraryPath> + <SourcePath>../../../source;$(SourcePath)</SourcePath> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <IncludePath>$(IncludePath);../../../sdks/;$(WindowsSdk_71A_IncludePath);../../../source;</IncludePath> + <LibraryPath>;../../../libs64;$(LibraryPath)</LibraryPath> + <SourcePath>../../../source;$(SourcePath)</SourcePath> + <LinkIncremental>false</LinkIncremental> + <OutDir>../../../build/bin64/plugins/</OutDir> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_WARNINGS;_DEBUG;_WINDOWS;SX_LIB_NAME="DDS";%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <TreatSpecificWarningsAsErrors>4316</TreatSpecificWarningsAsErrors> + </ClCompile> + <Link> + <SubSystem>Windows</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ImportLibrary>../../../libs/$(TargetName).lib</ImportLibrary> + <ProgramDatabaseFile>$(ProjectDir)$(TargetName).pdb</ProgramDatabaseFile> + <Profile>true</Profile> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <ClCompile> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN64;_CRT_SECURE_NO_WARNINGS;_DEBUG;_WINDOWS;SX_LIB_NAME="DDS";%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <TreatSpecificWarningsAsErrors>4316</TreatSpecificWarningsAsErrors> + </ClCompile> + <Link> + <SubSystem>Windows</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ImportLibrary>../../../libs/$(TargetName).lib</ImportLibrary> + <ProgramDatabaseFile>$(ProjectDir)$(TargetName).pdb</ProgramDatabaseFile> + <Profile>true</Profile> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <WarningLevel>Level1</WarningLevel> + <PrecompiledHeader> + </PrecompiledHeader> + <Optimization>MaxSpeed</Optimization> + <FunctionLevelLinking>true</FunctionLevelLinking> + <IntrinsicFunctions>true</IntrinsicFunctions> + <PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_WARNINGS;NDEBUG;_WINDOWS;SX_LIB_NAME="DDS";%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <TreatSpecificWarningsAsErrors>4316</TreatSpecificWarningsAsErrors> + </ClCompile> + <Link> + <SubSystem>Windows</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + <ProgramDatabaseFile>$(ProjectDir)$(TargetName).pdb</ProgramDatabaseFile> + <ImportLibrary>../../../libs/$(TargetName).lib</ImportLibrary> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <ClCompile> + <WarningLevel>Level1</WarningLevel> + <PrecompiledHeader> + </PrecompiledHeader> + <Optimization>MaxSpeed</Optimization> + <FunctionLevelLinking>true</FunctionLevelLinking> + <IntrinsicFunctions>true</IntrinsicFunctions> + <PreprocessorDefinitions>WIN64;_CRT_SECURE_NO_WARNINGS;NDEBUG;_WINDOWS;SX_LIB_NAME="DDS";%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <TreatSpecificWarningsAsErrors>4316</TreatSpecificWarningsAsErrors> + </ClCompile> + <Link> + <SubSystem>Windows</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + <ProgramDatabaseFile>$(ProjectDir)$(TargetName).pdb</ProgramDatabaseFile> + <ImportLibrary>../../../libs/$(TargetName).lib</ImportLibrary> + </Link> + </ItemDefinitionGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project> \ No newline at end of file diff --git a/proj/ddsplugin/vs2013/ddsplugin.vcxproj.filters b/proj/ddsplugin/vs2013/ddsplugin.vcxproj.filters new file mode 100644 index 000000000..7fa266a72 --- /dev/null +++ b/proj/ddsplugin/vs2013/ddsplugin.vcxproj.filters @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <UniqueIdentifier>{A449BBF6-87B9-4A5C-ADF0-2EBF183111CA}</UniqueIdentifier> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + <Filter Include="Header Files"> + <UniqueIdentifier>{53F9B2A7-D46D-438A-9854-263F22AFCF5C}</UniqueIdentifier> + <Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions> + </Filter> + <Filter Include="Resource Files"> + <UniqueIdentifier>{E8C70B41-9EA3-4F97-84C0-4CCFC5D0A117}</UniqueIdentifier> + <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\..\source\ddsplugin\dllmain.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\source\ddsplugin\plugin_main.cpp" /> + <ClCompile Include="..\..\..\source\ddsplugin\TextureLoader.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\..\source\ddsplugin\TextureLoader.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\..\source\ddsplugin\DDSFile.h"> + <Filter>Header Files</Filter> + </ClInclude> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/source/core/Core.cpp b/source/core/Core.cpp index c08447896..0202ebc84 100644 --- a/source/core/Core.cpp +++ b/source/core/Core.cpp @@ -13,6 +13,8 @@ #include <GRegisterIndex.h> +#include <xcommon/IXTextureLoader.h> + extern CTimeManager *g_pTimers; extern CPerfMon *g_pPerfMon; extern CCore *g_pCore; @@ -80,6 +82,17 @@ CCore::CCore(const char *szName) } loadPlugins(); +#if 1 + IXTextureLoader *pLoader = (IXTextureLoader*)m_pPluginManager->getInterface(IXTEXTURELOADER_GUID); + if(pLoader->open("textures/tp/tp_sga_window_center_up.dds", "")) + { + XTextureInfo texInfo; + pLoader->getInfo(&texInfo); + pLoader->close(); + } + + +#endif } CCore::~CCore() { diff --git a/source/ddsplugin/DDSFile.h b/source/ddsplugin/DDSFile.h new file mode 100644 index 000000000..a98020390 --- /dev/null +++ b/source/ddsplugin/DDSFile.h @@ -0,0 +1,307 @@ +#ifndef __DDSFILE_H +#define __DDSFILE_H + +#include <gdefines.h> + +#pragma pack(push,1) + + +typedef enum DXGI_FORMAT +{ + DXGI_FORMAT_UNKNOWN = 0, + DXGI_FORMAT_R32G32B32A32_TYPELESS = 1, + DXGI_FORMAT_R32G32B32A32_FLOAT = 2, + DXGI_FORMAT_R32G32B32A32_UINT = 3, + DXGI_FORMAT_R32G32B32A32_SINT = 4, + DXGI_FORMAT_R32G32B32_TYPELESS = 5, + DXGI_FORMAT_R32G32B32_FLOAT = 6, + DXGI_FORMAT_R32G32B32_UINT = 7, + DXGI_FORMAT_R32G32B32_SINT = 8, + DXGI_FORMAT_R16G16B16A16_TYPELESS = 9, + DXGI_FORMAT_R16G16B16A16_FLOAT = 10, + DXGI_FORMAT_R16G16B16A16_UNORM = 11, + DXGI_FORMAT_R16G16B16A16_UINT = 12, + DXGI_FORMAT_R16G16B16A16_SNORM = 13, + DXGI_FORMAT_R16G16B16A16_SINT = 14, + DXGI_FORMAT_R32G32_TYPELESS = 15, + DXGI_FORMAT_R32G32_FLOAT = 16, + DXGI_FORMAT_R32G32_UINT = 17, + DXGI_FORMAT_R32G32_SINT = 18, + DXGI_FORMAT_R32G8X24_TYPELESS = 19, + DXGI_FORMAT_D32_FLOAT_S8X24_UINT = 20, + DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS = 21, + DXGI_FORMAT_X32_TYPELESS_G8X24_UINT = 22, + DXGI_FORMAT_R10G10B10A2_TYPELESS = 23, + DXGI_FORMAT_R10G10B10A2_UNORM = 24, + DXGI_FORMAT_R10G10B10A2_UINT = 25, + DXGI_FORMAT_R11G11B10_FLOAT = 26, + DXGI_FORMAT_R8G8B8A8_TYPELESS = 27, + DXGI_FORMAT_R8G8B8A8_UNORM = 28, + DXGI_FORMAT_R8G8B8A8_UNORM_SRGB = 29, + DXGI_FORMAT_R8G8B8A8_UINT = 30, + DXGI_FORMAT_R8G8B8A8_SNORM = 31, + DXGI_FORMAT_R8G8B8A8_SINT = 32, + DXGI_FORMAT_R16G16_TYPELESS = 33, + DXGI_FORMAT_R16G16_FLOAT = 34, + DXGI_FORMAT_R16G16_UNORM = 35, + DXGI_FORMAT_R16G16_UINT = 36, + DXGI_FORMAT_R16G16_SNORM = 37, + DXGI_FORMAT_R16G16_SINT = 38, + DXGI_FORMAT_R32_TYPELESS = 39, + DXGI_FORMAT_D32_FLOAT = 40, + DXGI_FORMAT_R32_FLOAT = 41, + DXGI_FORMAT_R32_UINT = 42, + DXGI_FORMAT_R32_SINT = 43, + DXGI_FORMAT_R24G8_TYPELESS = 44, + DXGI_FORMAT_D24_UNORM_S8_UINT = 45, + DXGI_FORMAT_R24_UNORM_X8_TYPELESS = 46, + DXGI_FORMAT_X24_TYPELESS_G8_UINT = 47, + DXGI_FORMAT_R8G8_TYPELESS = 48, + DXGI_FORMAT_R8G8_UNORM = 49, + DXGI_FORMAT_R8G8_UINT = 50, + DXGI_FORMAT_R8G8_SNORM = 51, + DXGI_FORMAT_R8G8_SINT = 52, + DXGI_FORMAT_R16_TYPELESS = 53, + DXGI_FORMAT_R16_FLOAT = 54, + DXGI_FORMAT_D16_UNORM = 55, + DXGI_FORMAT_R16_UNORM = 56, + DXGI_FORMAT_R16_UINT = 57, + DXGI_FORMAT_R16_SNORM = 58, + DXGI_FORMAT_R16_SINT = 59, + DXGI_FORMAT_R8_TYPELESS = 60, + DXGI_FORMAT_R8_UNORM = 61, + DXGI_FORMAT_R8_UINT = 62, + DXGI_FORMAT_R8_SNORM = 63, + DXGI_FORMAT_R8_SINT = 64, + DXGI_FORMAT_A8_UNORM = 65, + DXGI_FORMAT_R1_UNORM = 66, + DXGI_FORMAT_R9G9B9E5_SHAREDEXP = 67, + DXGI_FORMAT_R8G8_B8G8_UNORM = 68, + DXGI_FORMAT_G8R8_G8B8_UNORM = 69, + DXGI_FORMAT_BC1_TYPELESS = 70, + DXGI_FORMAT_BC1_UNORM = 71, + DXGI_FORMAT_BC1_UNORM_SRGB = 72, + DXGI_FORMAT_BC2_TYPELESS = 73, + DXGI_FORMAT_BC2_UNORM = 74, + DXGI_FORMAT_BC2_UNORM_SRGB = 75, + DXGI_FORMAT_BC3_TYPELESS = 76, + DXGI_FORMAT_BC3_UNORM = 77, + DXGI_FORMAT_BC3_UNORM_SRGB = 78, + DXGI_FORMAT_BC4_TYPELESS = 79, + DXGI_FORMAT_BC4_UNORM = 80, + DXGI_FORMAT_BC4_SNORM = 81, + DXGI_FORMAT_BC5_TYPELESS = 82, + DXGI_FORMAT_BC5_UNORM = 83, + DXGI_FORMAT_BC5_SNORM = 84, + DXGI_FORMAT_B5G6R5_UNORM = 85, + DXGI_FORMAT_B5G5R5A1_UNORM = 86, + DXGI_FORMAT_B8G8R8A8_UNORM = 87, + DXGI_FORMAT_B8G8R8X8_UNORM = 88, + DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM = 89, + DXGI_FORMAT_B8G8R8A8_TYPELESS = 90, + DXGI_FORMAT_B8G8R8A8_UNORM_SRGB = 91, + DXGI_FORMAT_B8G8R8X8_TYPELESS = 92, + DXGI_FORMAT_B8G8R8X8_UNORM_SRGB = 93, + DXGI_FORMAT_BC6H_TYPELESS = 94, + DXGI_FORMAT_BC6H_UF16 = 95, + DXGI_FORMAT_BC6H_SF16 = 96, + DXGI_FORMAT_BC7_TYPELESS = 97, + DXGI_FORMAT_BC7_UNORM = 98, + DXGI_FORMAT_BC7_UNORM_SRGB = 99, + DXGI_FORMAT_FORCE_UINT = 0xffffffff +} DXGI_FORMAT; + + +const uint32_t DDS_MAGIC = 0x20534444; // "DDS " + +struct DDS_PIXELFORMAT +{ + uint32_t size; + uint32_t flags; + uint32_t fourCC; + uint32_t RGBBitCount; + uint32_t RBitMask; + uint32_t GBitMask; + uint32_t BBitMask; + uint32_t ABitMask; +}; + +#define DDS_FOURCC 0x00000004 // DDPF_FOURCC +#define DDS_RGB 0x00000040 // DDPF_RGB +#define DDS_RGBA 0x00000041 // DDPF_RGB | DDPF_ALPHAPIXELS +#define DDS_LUMINANCE 0x00020000 // DDPF_LUMINANCE +#define DDS_LUMINANCEA 0x00020001 // DDPF_LUMINANCE | DDPF_ALPHAPIXELS +#define DDS_ALPHA 0x00000002 // DDPF_ALPHA +#define DDS_PAL8 0x00000020 // DDPF_PALETTEINDEXED8 + +#ifndef MAKEFOURCC +#define MAKEFOURCC(ch0, ch1, ch2, ch3) \ + ((uint32_t)(uint8_t)(ch0) | ((uint32_t)(uint8_t)(ch1) << 8) | \ + ((uint32_t)(uint8_t)(ch2) << 16) | ((uint32_t)(uint8_t)(ch3) << 24 )) +#endif /* defined(MAKEFOURCC) */ + +extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_DXT1 = +{sizeof(DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('D', 'X', 'T', '1'), 0, 0, 0, 0, 0}; + +extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_DXT2 = +{sizeof(DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('D', 'X', 'T', '2'), 0, 0, 0, 0, 0}; + +extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_DXT3 = +{sizeof(DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('D', 'X', 'T', '3'), 0, 0, 0, 0, 0}; + +extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_DXT4 = +{sizeof(DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('D', 'X', 'T', '4'), 0, 0, 0, 0, 0}; + +extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_DXT5 = +{sizeof(DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('D', 'X', 'T', '5'), 0, 0, 0, 0, 0}; + +extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_BC4_UNORM = +{sizeof(DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('B', 'C', '4', 'U'), 0, 0, 0, 0, 0}; + +extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_BC4_SNORM = +{sizeof(DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('B', 'C', '4', 'S'), 0, 0, 0, 0, 0}; + +extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_BC5_UNORM = +{sizeof(DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('B', 'C', '5', 'U'), 0, 0, 0, 0, 0}; + +extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_BC5_SNORM = +{sizeof(DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('B', 'C', '5', 'S'), 0, 0, 0, 0, 0}; + +extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_R8G8_B8G8 = +{sizeof(DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('R', 'G', 'B', 'G'), 0, 0, 0, 0, 0}; + +extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_G8R8_G8B8 = +{sizeof(DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('G', 'R', 'G', 'B'), 0, 0, 0, 0, 0}; + +extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_A8R8G8B8 = +{sizeof(DDS_PIXELFORMAT), DDS_RGBA, 0, 32, 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000}; + +extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_X8R8G8B8 = +{sizeof(DDS_PIXELFORMAT), DDS_RGB, 0, 32, 0x00ff0000, 0x0000ff00, 0x000000ff, 0x00000000}; + +extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_A8B8G8R8 = +{sizeof(DDS_PIXELFORMAT), DDS_RGBA, 0, 32, 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000}; + +extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_X8B8G8R8 = +{sizeof(DDS_PIXELFORMAT), DDS_RGB, 0, 32, 0x000000ff, 0x0000ff00, 0x00ff0000, 0x00000000}; + +extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_G16R16 = +{sizeof(DDS_PIXELFORMAT), DDS_RGB, 0, 32, 0x0000ffff, 0xffff0000, 0x00000000, 0x00000000}; + +extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_R5G6B5 = +{sizeof(DDS_PIXELFORMAT), DDS_RGB, 0, 16, 0x0000f800, 0x000007e0, 0x0000001f, 0x00000000}; + +extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_A1R5G5B5 = +{sizeof(DDS_PIXELFORMAT), DDS_RGBA, 0, 16, 0x00007c00, 0x000003e0, 0x0000001f, 0x00008000}; + +extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_A4R4G4B4 = +{sizeof(DDS_PIXELFORMAT), DDS_RGBA, 0, 16, 0x00000f00, 0x000000f0, 0x0000000f, 0x0000f000}; + +extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_R8G8B8 = +{sizeof(DDS_PIXELFORMAT), DDS_RGB, 0, 24, 0x00ff0000, 0x0000ff00, 0x000000ff, 0x00000000}; + +extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_L8 = +{sizeof(DDS_PIXELFORMAT), DDS_LUMINANCE, 0, 8, 0xff, 0x00, 0x00, 0x00}; + +extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_L16 = +{sizeof(DDS_PIXELFORMAT), DDS_LUMINANCE, 0, 16, 0xffff, 0x0000, 0x0000, 0x0000}; + +extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_A8L8 = +{sizeof(DDS_PIXELFORMAT), DDS_LUMINANCEA, 0, 16, 0x00ff, 0x0000, 0x0000, 0xff00}; + +extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_A8 = +{sizeof(DDS_PIXELFORMAT), DDS_ALPHA, 0, 8, 0x00, 0x00, 0x00, 0xff}; + +// D3DFMT_A2R10G10B10/D3DFMT_A2B10G10R10 should be written using DX10 extension to avoid D3DX 10:10:10:2 reversal issue + +// This indicates the DDS_HEADER_DXT10 extension is present (the format is in dxgiFormat) +extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_DX10 = +{sizeof(DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('D', 'X', '1', '0'), 0, 0, 0, 0, 0}; + +#define DDS_HEADER_FLAGS_TEXTURE 0x00001007 // DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH | DDSD_PIXELFORMAT +#define DDS_HEADER_FLAGS_MIPMAP 0x00020000 // DDSD_MIPMAPCOUNT +#define DDS_HEADER_FLAGS_VOLUME 0x00800000 // DDSD_DEPTH +#define DDS_HEADER_FLAGS_PITCH 0x00000008 // DDSD_PITCH +#define DDS_HEADER_FLAGS_LINEARSIZE 0x00080000 // DDSD_LINEARSIZE + +#define DDS_HEIGHT 0x00000002 // DDSD_HEIGHT +#define DDS_WIDTH 0x00000004 // DDSD_WIDTH + +#define DDS_SURFACE_FLAGS_TEXTURE 0x00001000 // DDSCAPS_TEXTURE +#define DDS_SURFACE_FLAGS_MIPMAP 0x00400008 // DDSCAPS_COMPLEX | DDSCAPS_MIPMAP +#define DDS_SURFACE_FLAGS_CUBEMAP 0x00000008 // DDSCAPS_COMPLEX + +#define DDS_CUBEMAP_POSITIVEX 0x00000600 // DDSCAPS2_CUBEMAP | DDSCAPS2_CUBEMAP_POSITIVEX +#define DDS_CUBEMAP_NEGATIVEX 0x00000a00 // DDSCAPS2_CUBEMAP | DDSCAPS2_CUBEMAP_NEGATIVEX +#define DDS_CUBEMAP_POSITIVEY 0x00001200 // DDSCAPS2_CUBEMAP | DDSCAPS2_CUBEMAP_POSITIVEY +#define DDS_CUBEMAP_NEGATIVEY 0x00002200 // DDSCAPS2_CUBEMAP | DDSCAPS2_CUBEMAP_NEGATIVEY +#define DDS_CUBEMAP_POSITIVEZ 0x00004200 // DDSCAPS2_CUBEMAP | DDSCAPS2_CUBEMAP_POSITIVEZ +#define DDS_CUBEMAP_NEGATIVEZ 0x00008200 // DDSCAPS2_CUBEMAP | DDSCAPS2_CUBEMAP_NEGATIVEZ + +#define DDS_CUBEMAP_ALLFACES ( DDS_CUBEMAP_POSITIVEX | DDS_CUBEMAP_NEGATIVEX |\ + DDS_CUBEMAP_POSITIVEY | DDS_CUBEMAP_NEGATIVEY |\ + DDS_CUBEMAP_POSITIVEZ | DDS_CUBEMAP_NEGATIVEZ ) + +#define DDS_CUBEMAP 0x00000200 // DDSCAPS2_CUBEMAP + +#define DDS_FLAGS_VOLUME 0x00200000 // DDSCAPS2_VOLUME + +// Subset here matches D3D10_RESOURCE_DIMENSION and D3D11_RESOURCE_DIMENSION +enum DDS_RESOURCE_DIMENSION +{ + DDS_DIMENSION_TEXTURE1D = 2, + DDS_DIMENSION_TEXTURE2D = 3, + DDS_DIMENSION_TEXTURE3D = 4, +}; + +// Subset here matches D3D10_RESOURCE_MISC_FLAG and D3D11_RESOURCE_MISC_FLAG +enum DDS_RESOURCE_MISC_FLAG +{ + DDS_RESOURCE_MISC_TEXTURECUBE = 0x4L, +}; + +enum DDS_MISC_FLAGS2 +{ + DDS_MISC_FLAGS2_ALPHA_MODE_MASK = 0x7L, +}; + +struct DDS_HEADER +{ + uint32_t size; + uint32_t flags; + uint32_t height; + uint32_t width; + uint32_t pitchOrLinearSize; + uint32_t depth; // only if DDS_HEADER_FLAGS_VOLUME is set in flags + uint32_t mipMapCount; + uint32_t reserved1[11]; + DDS_PIXELFORMAT ddspf; + uint32_t caps; + uint32_t caps2; + uint32_t caps3; + uint32_t caps4; + uint32_t reserved2; +}; + +struct DDS_HEADER_DXT10 +{ + DXGI_FORMAT dxgiFormat; + uint32_t resourceDimension; + uint32_t miscFlag; // see D3D11_RESOURCE_MISC_FLAG + uint32_t arraySize; + uint32_t miscFlags2; // see DDS_MISC_FLAGS2 +}; + +#pragma pack(pop) + +static_assert(sizeof(DDS_HEADER) == 124, "DDS Header size mismatch"); +static_assert(sizeof(DDS_HEADER_DXT10) == 20, "DDS DX10 Extended Header size mismatch"); + + + + + + + + +#endif diff --git a/source/ddsplugin/TextureLoader.cpp b/source/ddsplugin/TextureLoader.cpp new file mode 100644 index 000000000..dfb5a59ba --- /dev/null +++ b/source/ddsplugin/TextureLoader.cpp @@ -0,0 +1,144 @@ +#include "TextureLoader.h" +#include "DDSFile.h" + +CTextureLoader::CTextureLoader(IFileSystem* pFileSystem): + m_pFileSystem(pFileSystem) +{ +} + +UINT XMETHODCALLTYPE CTextureLoader::getVersion() +{ + return(IXTEXTURELOADER_VERSION); +} + +UINT XMETHODCALLTYPE CTextureLoader::getExtCount() const +{ + return(1); +} +const char* XMETHODCALLTYPE CTextureLoader::getExt(UINT uIndex) const +{ + assert(uIndex < getExtCount()); + switch(uIndex) + { + case 0: + return("dds"); + } + return(NULL); +} +const char* XMETHODCALLTYPE CTextureLoader::getExtText(UINT uIndex) const +{ + assert(uIndex < getExtCount()); + switch(uIndex) + { + case 0: + return("DirectDraw Surface"); + } + return(NULL); +} +const char* XMETHODCALLTYPE CTextureLoader::getAuthor() const +{ + return("D-AIRY @ DogmaNet"); +} +const char* XMETHODCALLTYPE CTextureLoader::getCopyright() const +{ + return("Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2019"); +} +const char* XMETHODCALLTYPE CTextureLoader::getDescription() const +{ + return("DDS texture loader"); +} + +void XMETHODCALLTYPE CTextureLoader::getInfo(XTextureInfo *pTextureInfo) +{ + pTextureInfo->type = getType(); + + pTextureInfo->uWidth = m_ddsHeader.width; + pTextureInfo->uHeight = m_ddsHeader.height; + pTextureInfo->uDepth = m_ddsHeader.depth; + + pTextureInfo->uMipCount = 1; + if(m_ddsHeader.flags & DDS_HEADER_FLAGS_MIPMAP) + { + pTextureInfo->uMipCount = m_ddsHeader.mipMapCount; + } +} + +bool XMETHODCALLTYPE CTextureLoader::open(const char *szFileName, const char *szArg) +{ + assert(!m_pCurrentFile && "File already opened!"); + if(m_pCurrentFile) + { + return(false); + } + + m_pCurrentFile = m_pFileSystem->openFile(szFileName); + if(!m_pCurrentFile) + { + return(false); + } + + IFile *pFile = m_pCurrentFile; + + uint32_t uMagick = 0; + memset(&m_ddsHeader, 0, sizeof(m_ddsHeader)); + memset(&m_dxt10Header, 0, sizeof(m_dxt10Header)); + + pFile->readBin(&uMagick, sizeof(uMagick)); + if(uMagick != DDS_MAGIC) + { + return(false); + } + + if(pFile->readBin(&m_ddsHeader, sizeof(m_ddsHeader)) != sizeof(m_ddsHeader)) + { + return(false); + } + m_hasDXT10Header = (m_ddsHeader.ddspf.flags & DDS_FOURCC) && m_ddsHeader.ddspf.fourCC == MAKEFOURCC('D', 'X', '1', '0'); + + if(m_hasDXT10Header && pFile->readBin(&m_dxt10Header, sizeof(m_dxt10Header)) != sizeof(m_dxt10Header)) + { + return(false); + } + + return(true); +} +GXTEXTURE_TYPE XMETHODCALLTYPE CTextureLoader::getType() const +{ + if(m_ddsHeader.caps2 & DDS_FLAGS_VOLUME) + { + return(GXTEXTURE_TYPE_3D); + } + if(m_ddsHeader.caps & DDS_SURFACE_FLAGS_CUBEMAP) + { + return(GXTEXTURE_TYPE_CUBE); + } + if(m_ddsHeader.caps & DDS_SURFACE_FLAGS_TEXTURE) + { + return(GXTEXTURE_TYPE_2D); + } + return(GXTEXTURE_TYPE_UNKNOWN); +} +bool XMETHODCALLTYPE CTextureLoader::loadAs2D(IXResourceTexture2D *pResource) +{ + if(getType() != GXTEXTURE_TYPE_2D) + { + return(false); + } + + return(true); +} +bool XMETHODCALLTYPE CTextureLoader::loadAsCube(IXResourceTextureCube *pResource) +{ + if(getType() != GXTEXTURE_TYPE_CUBE) + { + return(false); + } + + + return(true); +} + +void XMETHODCALLTYPE CTextureLoader::close() +{ + mem_release(m_pCurrentFile); +} diff --git a/source/ddsplugin/TextureLoader.h b/source/ddsplugin/TextureLoader.h new file mode 100644 index 000000000..ec2516b36 --- /dev/null +++ b/source/ddsplugin/TextureLoader.h @@ -0,0 +1,38 @@ +#ifndef __TEXTURELOADER_H +#define __TEXTURELOADER_H + +#include <xcommon/IXTextureLoader.h> +#include <xcommon/IFileSystem.h> +#include "DDSFile.h" + +class CTextureLoader: public IXTextureLoader +{ +public: + CTextureLoader(IFileSystem* pFileSystem); + + UINT XMETHODCALLTYPE getVersion() override; + + UINT XMETHODCALLTYPE getExtCount() const override; + const char* XMETHODCALLTYPE getExt(UINT uIndex) const override; + const char* XMETHODCALLTYPE getExtText(UINT uIndex) const override; + const char* XMETHODCALLTYPE getAuthor() const override; + const char* XMETHODCALLTYPE getCopyright() const override; + const char* XMETHODCALLTYPE getDescription() const override; + + bool XMETHODCALLTYPE open(const char *szFileName, const char *szArg) override; + GXTEXTURE_TYPE XMETHODCALLTYPE getType() const override; + bool XMETHODCALLTYPE loadAs2D(IXResourceTexture2D *pResource) override; + bool XMETHODCALLTYPE loadAsCube(IXResourceTextureCube *pResource) override; + void XMETHODCALLTYPE getInfo(XTextureInfo *pTextureInfo) override; + void XMETHODCALLTYPE close() override; + +protected: + IFileSystem *m_pFileSystem; + + IFile *m_pCurrentFile = NULL; + DDS_HEADER m_ddsHeader; + bool m_hasDXT10Header = false; + DDS_HEADER_DXT10 m_dxt10Header; +}; + +#endif diff --git a/source/ddsplugin/dllmain.cpp b/source/ddsplugin/dllmain.cpp new file mode 100644 index 000000000..fdece5b07 --- /dev/null +++ b/source/ddsplugin/dllmain.cpp @@ -0,0 +1,24 @@ + +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + +#define WIN32_LEAN_AND_MEAN +#include <windows.h> + +BOOL APIENTRY DllMain(HMODULE hModule, + DWORD ul_reason_for_call, + LPVOID lpReserved + ) +{ + switch(ul_reason_for_call) + { + case DLL_PROCESS_ATTACH: + case DLL_THREAD_ATTACH: + case DLL_THREAD_DETACH: + case DLL_PROCESS_DETACH: + break; + } + return TRUE; +} diff --git a/source/ddsplugin/plugin_main.cpp b/source/ddsplugin/plugin_main.cpp new file mode 100644 index 000000000..d3fa15ec9 --- /dev/null +++ b/source/ddsplugin/plugin_main.cpp @@ -0,0 +1,47 @@ +#include <xcommon/IXPlugin.h> +#include "TextureLoader.h" + + +class CDDSPlugin: public IXPlugin +{ +public: + void XMETHODCALLTYPE startup(IXCore *pCore) override + { + m_pCore = pCore; + } + + void XMETHODCALLTYPE shutdown() override + { + } + + UINT XMETHODCALLTYPE getInterfaceCount() override + { + return(1); + } + const XGUID* XMETHODCALLTYPE getInterfaceGUID(UINT id) override + { + static XGUID s_guid; + switch(id) + { + case 0: + s_guid = IXTEXTURELOADER_GUID; + break; + default: + return(NULL); + } + return(&s_guid); + } + IXUnknown* XMETHODCALLTYPE getInterface(const XGUID &guid) override + { + if(guid == IXTEXTURELOADER_GUID) + { + return(new CTextureLoader(m_pCore->getFileSystem())); + } + return(NULL); + } + +protected: + IXCore *m_pCore; +}; + +DECLARE_XPLUGIN(CDDSPlugin); diff --git a/source/xcommon/IXTextureLoader.h b/source/xcommon/IXTextureLoader.h index 6fedaaaf4..7f81c2dee 100644 --- a/source/xcommon/IXTextureLoader.h +++ b/source/xcommon/IXTextureLoader.h @@ -3,11 +3,11 @@ #include <gdefines.h> #include <core/IFile.h> -#include <graphix/graphix.h> +#include <xcommon/resource/IXResourceTexture.h> // {95FBCCB6-D40F-4FC6-AFF4-8A52BD75DB3C} -#define IXTEXTURELOADER_GUID DEFINE_GUID(0x95fbccb6, 0xd40f, 0x4fc6, 0xaf, 0xf4, 0x8a, 0x52, 0xbd, 0x75, 0xdb, 0x3c) - +#define IXTEXTURELOADER_GUID DEFINE_XGUID(0x95fbccb6, 0xd40f, 0x4fc6, 0xaf, 0xf4, 0x8a, 0x52, 0xbd, 0x75, 0xdb, 0x3c) +#define IXTEXTURELOADER_VERSION 1 //! возможная информация о текстуре struct XTextureInfo @@ -41,8 +41,10 @@ public: virtual const char* XMETHODCALLTYPE getCopyright() const = 0; virtual const char* XMETHODCALLTYPE getDescription() const = 0; - virtual bool XMETHODCALLTYPE open(IFile *pFile) = 0; - virtual bool XMETHODCALLTYPE load(IXResourceTexture *pResource) = 0; + virtual bool XMETHODCALLTYPE open(const char *szFileName, const char *szArg) = 0; + virtual GXTEXTURE_TYPE XMETHODCALLTYPE getType() const = 0; + virtual bool XMETHODCALLTYPE loadAs2D(IXResourceTexture2D *pResource) = 0; + virtual bool XMETHODCALLTYPE loadAsCube(IXResourceTextureCube *pResource) = 0; virtual void XMETHODCALLTYPE getInfo(XTextureInfo *pTextureInfo) = 0; virtual void XMETHODCALLTYPE close() = 0; }; -- GitLab