diff --git a/proj/SkyXEngine/vs2013/SkyXEngine.sln b/proj/SkyXEngine/vs2013/SkyXEngine.sln index aba3852280399ceef602aebdb31999193b2d8f67..6f0809bc6ce13b432f157abb51a3e53953857311 100644 --- a/proj/SkyXEngine/vs2013/SkyXEngine.sln +++ b/proj/SkyXEngine/vs2013/SkyXEngine.sln @@ -17,6 +17,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SkyXEngine", "SkyXEngine.vc {0C7E3DB7-005F-41E9-A570-868BCF959E91} = {0C7E3DB7-005F-41E9-A570-868BCF959E91} {120D29B8-D2D9-4B4E-8AC6-D951973B7398} = {120D29B8-D2D9-4B4E-8AC6-D951973B7398} {BA779DCC-93C8-4FB7-BBB9-A7D2F76C35DE} = {BA779DCC-93C8-4FB7-BBB9-A7D2F76C35DE} + {7F0ACED1-6E16-4DD3-800E-0C50150897C2} = {7F0ACED1-6E16-4DD3-800E-0C50150897C2} {AEECC2DB-C7C7-4089-9262-A69794DF834D} = {AEECC2DB-C7C7-4089-9262-A69794DF834D} {56A8D7F7-B73C-4206-8038-83D8A169AA2F} = {56A8D7F7-B73C-4206-8038-83D8A169AA2F} EndProjectSection @@ -93,7 +94,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Bullet3OpenCL_clew", "..\.. EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sxphysics", "..\..\sxphysics\vs2013\sxphysics.vcxproj", "{7C0C8205-BDD3-44A3-AA3A-7855C7EFC88E}" ProjectSection(ProjectDependencies) = postProject - {C1C1F046-C839-4602-AF70-923CDD237C1B} = {C1C1F046-C839-4602-AF70-923CDD237C1B} {46A17C83-2972-4C41-B67F-224640089085} = {46A17C83-2972-4C41-B67F-224640089085} {2B3BA583-D5EC-4DC2-91CF-42B1C7ADFD9D} = {2B3BA583-D5EC-4DC2-91CF-42B1C7ADFD9D} {F2DD3789-7BC9-D241-8C8D-2179933B30DD} = {F2DD3789-7BC9-D241-8C8D-2179933B30DD} @@ -110,6 +110,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LinearMath", "..\..\..\sdks EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sxparticles", "..\..\sxparticles\vs2013\sxparticles.vcxproj", "{56A8D7F7-B73C-4206-8038-83D8A169AA2F}" ProjectSection(ProjectDependencies) = postProject + {2B3BA583-D5EC-4DC2-91CF-42B1C7ADFD9D} = {2B3BA583-D5EC-4DC2-91CF-42B1C7ADFD9D} {AEECC2DB-C7C7-4089-9262-A69794DF834D} = {AEECC2DB-C7C7-4089-9262-A69794DF834D} EndProjectSection EndProject @@ -133,9 +134,11 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sxgame", "..\..\sxgame\vs20 ProjectSection(ProjectDependencies) = postProject {7C0C8205-BDD3-44A3-AA3A-7855C7EFC88E} = {7C0C8205-BDD3-44A3-AA3A-7855C7EFC88E} {B9656841-7734-4D0B-8619-1BED5E2ED7AE} = {B9656841-7734-4D0B-8619-1BED5E2ED7AE} - {C1C1F046-C839-4602-AF70-923CDD237C1B} = {C1C1F046-C839-4602-AF70-923CDD237C1B} {709D8A7A-D3E0-4070-A493-EFDF7A8E9D73} = {709D8A7A-D3E0-4070-A493-EFDF7A8E9D73} - {AEECC2DB-C7C7-4089-9262-A69794DF834D} = {AEECC2DB-C7C7-4089-9262-A69794DF834D} + {6A402480-C09B-4CBF-A6BD-115CE4BFF2D8} = {6A402480-C09B-4CBF-A6BD-115CE4BFF2D8} + {2B3BA583-D5EC-4DC2-91CF-42B1C7ADFD9D} = {2B3BA583-D5EC-4DC2-91CF-42B1C7ADFD9D} + {3A5449A3-DCE7-4557-9C9F-DEEAFBAAC763} = {3A5449A3-DCE7-4557-9C9F-DEEAFBAAC763} + {120D29B8-D2D9-4B4E-8AC6-D951973B7398} = {120D29B8-D2D9-4B4E-8AC6-D951973B7398} {56A8D7F7-B73C-4206-8038-83D8A169AA2F} = {56A8D7F7-B73C-4206-8038-83D8A169AA2F} EndProjectSection EndProject @@ -167,6 +170,13 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sxlevel", "..\..\sxlevel\vs EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sxrender", "..\..\sxrender\vs2013\sxrender.vcxproj", "{7F0ACED1-6E16-4DD3-800E-0C50150897C2}" + ProjectSection(ProjectDependencies) = postProject + {B9656841-7734-4D0B-8619-1BED5E2ED7AE} = {B9656841-7734-4D0B-8619-1BED5E2ED7AE} + {2B3BA583-D5EC-4DC2-91CF-42B1C7ADFD9D} = {2B3BA583-D5EC-4DC2-91CF-42B1C7ADFD9D} + {0C7E3DB7-005F-41E9-A570-868BCF959E91} = {0C7E3DB7-005F-41E9-A570-868BCF959E91} + {BA779DCC-93C8-4FB7-BBB9-A7D2F76C35DE} = {BA779DCC-93C8-4FB7-BBB9-A7D2F76C35DE} + {56A8D7F7-B73C-4206-8038-83D8A169AA2F} = {56A8D7F7-B73C-4206-8038-83D8A169AA2F} + EndProjectSection EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/proj/SkyXEngine/vs2013/SkyXEngine.vcxproj b/proj/SkyXEngine/vs2013/SkyXEngine.vcxproj index 4c2971439c2f119cb12a55ca1245301fab3340ce..ef9a54c1b3c7fc98c7dc10a596d1cdd865315ac0 100644 --- a/proj/SkyXEngine/vs2013/SkyXEngine.vcxproj +++ b/proj/SkyXEngine/vs2013/SkyXEngine.vcxproj @@ -40,7 +40,7 @@ </ImportGroup> <PropertyGroup Label="UserMacros" /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <LinkIncremental>false</LinkIncremental> + <LinkIncremental>true</LinkIncremental> <OutDir>../../../build/</OutDir> <TargetName>$(ProjectName)_d</TargetName> <IncludePath>../../../source;../../../sdks/bullet3/src;$(VC_IncludePath);$(WindowsSDK_IncludePath);../../../sdks/dx9sdk/Include;../../../sdks/ogg/libvorbis/include/;../../../sdks/ogg/libogg/include/;</IncludePath> @@ -60,7 +60,7 @@ </PrecompiledHeader> <WarningLevel>Level3</WarningLevel> <Optimization>Disabled</Optimization> - <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;SX_GAME;SX_EXE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;SX_GAME;SX_EXE;%(PreprocessorDefinitions);SX_LIB_NAME="ENGINE"</PreprocessorDefinitions> <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> </ClCompile> @@ -81,7 +81,7 @@ <Optimization>MaxSpeed</Optimization> <FunctionLevelLinking>true</FunctionLevelLinking> <IntrinsicFunctions>true</IntrinsicFunctions> - <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;SX_GAME;SX_EXE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;SX_GAME;SX_EXE;%(PreprocessorDefinitions);SX_LIB_NAME="ENGINE"</PreprocessorDefinitions> <RuntimeLibrary>MultiThreaded</RuntimeLibrary> </ClCompile> <Link> diff --git a/proj/sxae/vs2013/sxae.vcxproj b/proj/sxae/vs2013/sxae.vcxproj index 07e39ec9c77d6f2f6eee7f2959543c2411c13eb9..b2c4dab6124f4f1d378a28b504981381797cac44 100644 --- a/proj/sxae/vs2013/sxae.vcxproj +++ b/proj/sxae/vs2013/sxae.vcxproj @@ -57,7 +57,7 @@ </PrecompiledHeader> <WarningLevel>Level3</WarningLevel> <Optimization>Disabled</Optimization> - <PreprocessorDefinitions>WIN32;SX_EXE;_CRT_SECURE_NO_WARNINGS;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>WIN32;SX_EXE;_CRT_SECURE_NO_WARNINGS;_DEBUG;_WINDOWS;%(PreprocessorDefinitions);SX_LIB_NAME="AEd"</PreprocessorDefinitions> <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> </ClCompile> @@ -78,17 +78,18 @@ <Optimization>MaxSpeed</Optimization> <FunctionLevelLinking>true</FunctionLevelLinking> <IntrinsicFunctions>true</IntrinsicFunctions> - <PreprocessorDefinitions>WIN32;SX_EXE;_CRT_SECURE_NO_WARNINGS;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>WIN32;SX_EXE;_CRT_SECURE_NO_WARNINGS;NDEBUG;_WINDOWS;%(PreprocessorDefinitions);SX_LIB_NAME="AEd"</PreprocessorDefinitions> <RuntimeLibrary>MultiThreaded</RuntimeLibrary> </ClCompile> <Link> <SubSystem>Windows</SubSystem> - <GenerateDebugInformation>true</GenerateDebugInformation> + <GenerateDebugInformation>false</GenerateDebugInformation> <EnableCOMDATFolding>true</EnableCOMDATFolding> <OptimizeReferences>true</OptimizeReferences> <AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies> <IgnoreSpecificDefaultLibraries> </IgnoreSpecificDefaultLibraries> + <ProgramDatabaseFile>$(ProjectDir)$(TargetName).pdb</ProgramDatabaseFile> </Link> </ItemDefinitionGroup> <ItemGroup> diff --git a/proj/sxaigrid/vs2013/sxaigrid.vcxproj b/proj/sxaigrid/vs2013/sxaigrid.vcxproj index 35254926e284f4e323bf84fc05eb31a48f05e63e..5ef8eddc7002ba1fca7f8cdd37629e1b0448a806 100644 --- a/proj/sxaigrid/vs2013/sxaigrid.vcxproj +++ b/proj/sxaigrid/vs2013/sxaigrid.vcxproj @@ -40,7 +40,7 @@ </ImportGroup> <PropertyGroup Label="UserMacros" /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <LinkIncremental>false</LinkIncremental> + <LinkIncremental>true</LinkIncremental> <OutDir>../../../build/</OutDir> <TargetName>$(ProjectName)_d</TargetName> <IncludePath>../../../source;$(VC_IncludePath);$(WindowsSDK_IncludePath);../../../sdks/dx9sdk/Include</IncludePath> @@ -60,7 +60,7 @@ </PrecompiledHeader> <WarningLevel>Level3</WarningLevel> <Optimization>Disabled</Optimization> - <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;SXAIGRID_EXPORTS;SX_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;SXAIGRID_EXPORTS;SX_DLL;SX_LIB_NAME="AIGRID";%(PreprocessorDefinitions)</PreprocessorDefinitions> <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> </ClCompile> @@ -80,7 +80,7 @@ <Optimization>MaxSpeed</Optimization> <FunctionLevelLinking>true</FunctionLevelLinking> <IntrinsicFunctions>true</IntrinsicFunctions> - <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;SXAIGRID_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;SXAIGRID_EXPORTS;SX_LIB_NAME="AIGRID";%(PreprocessorDefinitions)</PreprocessorDefinitions> <RuntimeLibrary>MultiThreaded</RuntimeLibrary> </ClCompile> <Link> diff --git a/proj/sxanim/vs2013/sxanim.vcxproj b/proj/sxanim/vs2013/sxanim.vcxproj index b9c5cf2a62942e72ba3e9a5c71a9521c173e543c..87d4e7a17be66df92733d8050f79988ac884a674 100644 --- a/proj/sxanim/vs2013/sxanim.vcxproj +++ b/proj/sxanim/vs2013/sxanim.vcxproj @@ -41,7 +41,7 @@ </ImportGroup> <PropertyGroup Label="UserMacros" /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <LinkIncremental>false</LinkIncremental> + <LinkIncremental>true</LinkIncremental> <OutDir>../../../build/</OutDir> <TargetName>$(ProjectName)_d</TargetName> <IncludePath>$(IncludePath);$(WindowsSdk_71A_IncludePath);../../../source;../../../sdks/dx9sdk/Include;</IncludePath> @@ -61,7 +61,7 @@ </PrecompiledHeader> <WarningLevel>Level3</WarningLevel> <Optimization>Disabled</Optimization> - <PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_WARNINGS;_DEBUG;_WINDOWS;_USRDLL;SXANIM_EXPORTS;SX_DLL%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_WARNINGS;_DEBUG;_WINDOWS;_USRDLL;SXANIM_EXPORTS;SX_LIB_NAME="ANIM";%(PreprocessorDefinitions)</PreprocessorDefinitions> <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> </ClCompile> @@ -81,7 +81,7 @@ <Optimization>MaxSpeed</Optimization> <FunctionLevelLinking>true</FunctionLevelLinking> <IntrinsicFunctions>true</IntrinsicFunctions> - <PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_WARNINGS;NDEBUG;_WINDOWS;_USRDLL;SXANIM_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_WARNINGS;NDEBUG;_WINDOWS;_USRDLL;SXANIM_EXPORTS;SX_LIB_NAME="ANIM";%(PreprocessorDefinitions)</PreprocessorDefinitions> <RuntimeLibrary>MultiThreaded</RuntimeLibrary> </ClCompile> <Link> diff --git a/proj/sxconsole/vs2013/sxconsole.vcxproj b/proj/sxconsole/vs2013/sxconsole.vcxproj index 6ca9ed4456a9a1347ccd16a05af68ad7999dc202..48221012063604ca4b8895a3545244a88cde6cec 100644 --- a/proj/sxconsole/vs2013/sxconsole.vcxproj +++ b/proj/sxconsole/vs2013/sxconsole.vcxproj @@ -79,9 +79,10 @@ </ClCompile> <Link> <SubSystem>Console</SubSystem> - <GenerateDebugInformation>true</GenerateDebugInformation> + <GenerateDebugInformation>false</GenerateDebugInformation> <EnableCOMDATFolding>true</EnableCOMDATFolding> <OptimizeReferences>true</OptimizeReferences> + <ProgramDatabaseFile>$(ProjectDir)$(TargetName).pdb</ProgramDatabaseFile> </Link> </ItemDefinitionGroup> <ItemGroup> diff --git a/proj/sxcore/vs2013/sxcore.vcxproj b/proj/sxcore/vs2013/sxcore.vcxproj index fd026699568272f0536674de69fa96bfec2e2688..34244c1dc769405f733ab304ca9a22384eb4f74f 100644 --- a/proj/sxcore/vs2013/sxcore.vcxproj +++ b/proj/sxcore/vs2013/sxcore.vcxproj @@ -75,7 +75,7 @@ </ImportGroup> <PropertyGroup Label="UserMacros" /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <LinkIncremental>false</LinkIncremental> + <LinkIncremental>true</LinkIncremental> <TargetName>$(ProjectName)_d</TargetName> <IncludePath>../../../source;$(VC_IncludePath);$(WindowsSDK_IncludePath);../../../sdks/dx9sdk/Include</IncludePath> <LibraryPath>../../../libs;$(LibraryPath);$(WindowsSDK_LibraryPath_x86);../../../sdks/dx9sdk/Lib</LibraryPath> @@ -95,7 +95,7 @@ </PrecompiledHeader> <WarningLevel>Level3</WarningLevel> <Optimization>Disabled</Optimization> - <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_WINDOWS;_USRDLL;SXCORE_EXPORTS;SX_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_WINDOWS;_USRDLL;SXCORE_EXPORTS;SX_DLL;SX_LIB_NAME="CORE";%(PreprocessorDefinitions)</PreprocessorDefinitions> <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> </ClCompile> @@ -115,7 +115,7 @@ <Optimization>MaxSpeed</Optimization> <FunctionLevelLinking>true</FunctionLevelLinking> <IntrinsicFunctions>true</IntrinsicFunctions> - <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;SXCORE_EXPORTS;SX_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;SXCORE_EXPORTS;SX_DLL;SX_LIB_NAME="CORE";%(PreprocessorDefinitions)</PreprocessorDefinitions> <RuntimeLibrary>MultiThreaded</RuntimeLibrary> </ClCompile> <Link> diff --git a/proj/sxdecals/vs2013/sxdecals.vcxproj b/proj/sxdecals/vs2013/sxdecals.vcxproj index b1a1789598c2844aba4769604dae7c9f64e0a000..b4bd6708bec3d682e3807bfa235b6adfae4c0c97 100644 --- a/proj/sxdecals/vs2013/sxdecals.vcxproj +++ b/proj/sxdecals/vs2013/sxdecals.vcxproj @@ -48,7 +48,7 @@ </ImportGroup> <PropertyGroup Label="UserMacros" /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <LinkIncremental>false</LinkIncremental> + <LinkIncremental>true</LinkIncremental> <OutDir>../../../build/</OutDir> <IncludePath>../../../source;../../../sdks/bullet3/src;$(VC_IncludePath);$(WindowsSdk_71A_IncludePath);../../../sdks/dx9sdk/Include;</IncludePath> <LibraryPath>../../../sdks/dx9sdk/Lib;../../../sdks/bullet3/bin;../../../libs;$(VC_LibraryPath_x86);$(WindowsSdk_71A_LibraryPath_x86);</LibraryPath> @@ -66,7 +66,7 @@ </PrecompiledHeader> <WarningLevel>Level3</WarningLevel> <Optimization>Disabled</Optimization> - <PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_WARNINGS;_DEBUG;_WINDOWS;_USRDLL;SXDECALS_EXPORTS;SX_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_WARNINGS;_DEBUG;_WINDOWS;_USRDLL;SXDECALS_EXPORTS;SX_DLL;SX_LIB_NAME="DECALS";%(PreprocessorDefinitions)</PreprocessorDefinitions> <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> </ClCompile> @@ -86,15 +86,16 @@ <Optimization>MaxSpeed</Optimization> <FunctionLevelLinking>true</FunctionLevelLinking> <IntrinsicFunctions>true</IntrinsicFunctions> - <PreprocessorDefinitions>SX_DLL;WIN32;_CRT_SECURE_NO_WARNINGS;NDEBUG;_WINDOWS;_USRDLL;SXDECALS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>SX_DLL;WIN32;_CRT_SECURE_NO_WARNINGS;NDEBUG;_WINDOWS;_USRDLL;SXDECALS_EXPORTS;SX_LIB_NAME="DECALS";%(PreprocessorDefinitions)</PreprocessorDefinitions> <RuntimeLibrary>MultiThreaded</RuntimeLibrary> </ClCompile> <Link> <SubSystem>Windows</SubSystem> - <GenerateDebugInformation>true</GenerateDebugInformation> + <GenerateDebugInformation>false</GenerateDebugInformation> <EnableCOMDATFolding>true</EnableCOMDATFolding> <OptimizeReferences>true</OptimizeReferences> <ImportLibrary>../../../libs/$(TargetName).lib</ImportLibrary> + <ProgramDatabaseFile>$(ProjectDir)$(TargetName).pdb</ProgramDatabaseFile> </Link> </ItemDefinitionGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> diff --git a/proj/sxgame/vs2013/sxgame.vcxproj b/proj/sxgame/vs2013/sxgame.vcxproj index 49968e5526ed205c8010da021f8bb518cb1fdeec..5d98a16f4db4e7b97ccead6149b647bd551eb86f 100644 --- a/proj/sxgame/vs2013/sxgame.vcxproj +++ b/proj/sxgame/vs2013/sxgame.vcxproj @@ -40,7 +40,7 @@ </ImportGroup> <PropertyGroup Label="UserMacros" /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <LinkIncremental>false</LinkIncremental> + <LinkIncremental>true</LinkIncremental> <OutDir>../../../build/</OutDir> <IncludePath>../../../source;../../../sdks/bullet3/src;$(VC_IncludePath);$(WindowsSdk_71A_IncludePath);;../../../sdks/dx9sdk/Include;</IncludePath> <LibraryPath>../../../libs;$(VC_LibraryPath_x86);$(WindowsSdk_71A_LibraryPath_x86);;../../../sdks/dx9sdk/Lib;</LibraryPath> @@ -58,7 +58,7 @@ </PrecompiledHeader> <WarningLevel>Level3</WarningLevel> <Optimization>Disabled</Optimization> - <PreprocessorDefinitions>SXGAME_EXPORT=_declspec(dllexport);SX_DLL;WIN32;_CRT_SECURE_NO_WARNINGS;_DEBUG;_WINDOWS;_USRDLL;SXGAME_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>SXGAME_EXPORT=_declspec(dllexport);SX_DLL;WIN32;_CRT_SECURE_NO_WARNINGS;_DEBUG;_WINDOWS;_USRDLL;SXGAME_EXPORTS;SX_LIB_NAME="GAME";%(PreprocessorDefinitions)</PreprocessorDefinitions> <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> </ClCompile> @@ -78,15 +78,16 @@ <Optimization>MaxSpeed</Optimization> <FunctionLevelLinking>true</FunctionLevelLinking> <IntrinsicFunctions>true</IntrinsicFunctions> - <PreprocessorDefinitions>SXGAME_EXPORT=_declspec(dllexport);SX_DLL;WIN32;_CRT_SECURE_NO_WARNINGS;NDEBUG;_WINDOWS;_USRDLL;SXGAME_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>SXGAME_EXPORT=_declspec(dllexport);SX_DLL;WIN32;_CRT_SECURE_NO_WARNINGS;NDEBUG;_WINDOWS;_USRDLL;SXGAME_EXPORTS;SX_LIB_NAME="GAME";%(PreprocessorDefinitions)</PreprocessorDefinitions> <RuntimeLibrary>MultiThreaded</RuntimeLibrary> </ClCompile> <Link> <SubSystem>Windows</SubSystem> - <GenerateDebugInformation>true</GenerateDebugInformation> + <GenerateDebugInformation>false</GenerateDebugInformation> <EnableCOMDATFolding>true</EnableCOMDATFolding> <OptimizeReferences>true</OptimizeReferences> <ImportLibrary>../../../libs/$(TargetName).lib</ImportLibrary> + <ProgramDatabaseFile>$(ProjectDir)$(TargetName).pdb</ProgramDatabaseFile> </Link> </ItemDefinitionGroup> <ItemGroup> diff --git a/proj/sxgcore/vs2013/sxgcore.vcxproj b/proj/sxgcore/vs2013/sxgcore.vcxproj index 3fc121baeeab359a396399e1b661806f10962dbb..d5e0ae7036c498d59901a48f773670dce42cd4f4 100644 --- a/proj/sxgcore/vs2013/sxgcore.vcxproj +++ b/proj/sxgcore/vs2013/sxgcore.vcxproj @@ -41,7 +41,7 @@ </ImportGroup> <PropertyGroup Label="UserMacros" /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <LinkIncremental>false</LinkIncremental> + <LinkIncremental>true</LinkIncremental> <OutDir>../../../build/</OutDir> <TargetName>$(ProjectName)_d</TargetName> <IncludePath>$(IncludePath);$(WindowsSdk_71A_IncludePath);../../../source;../../../sdks/dx9sdk/Include;</IncludePath> @@ -61,7 +61,7 @@ </PrecompiledHeader> <WarningLevel>Level1</WarningLevel> <Optimization>Disabled</Optimization> - <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;SGCORE_EXPORTS;SX_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;SGCORE_EXPORTS;SX_DLL;SX_LIB_NAME="GCORE";%(PreprocessorDefinitions)</PreprocessorDefinitions> <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> </ClCompile> @@ -81,7 +81,7 @@ <Optimization>MaxSpeed</Optimization> <FunctionLevelLinking>true</FunctionLevelLinking> <IntrinsicFunctions>true</IntrinsicFunctions> - <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;SGCORE_EXPORTS;SX_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;SGCORE_EXPORTS;SX_DLL;SX_LIB_NAME="GCORE";%(PreprocessorDefinitions)</PreprocessorDefinitions> <RuntimeLibrary>MultiThreaded</RuntimeLibrary> </ClCompile> <Link> diff --git a/proj/sxgeom/vs2013/sxgeom.vcxproj b/proj/sxgeom/vs2013/sxgeom.vcxproj index c49173779347b2d238677e83b26f2541d3764d63..95af52972b97dfcd3d82683cc78d0abf64fac914 100644 --- a/proj/sxgeom/vs2013/sxgeom.vcxproj +++ b/proj/sxgeom/vs2013/sxgeom.vcxproj @@ -62,7 +62,7 @@ </ImportGroup> <PropertyGroup Label="UserMacros" /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <LinkIncremental>false</LinkIncremental> + <LinkIncremental>true</LinkIncremental> <OutDir>../../../build/</OutDir> <TargetName>$(ProjectName)_d</TargetName> <IncludePath>../../../source;$(VC_IncludePath);$(WindowsSDK_IncludePath);../../../sdks/dx9sdk/Include</IncludePath> @@ -82,7 +82,7 @@ </PrecompiledHeader> <WarningLevel>Level3</WarningLevel> <Optimization>Disabled</Optimization> - <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;SXGEOM_EXPORTS;SX_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;SXGEOM_EXPORTS;SX_DLL;SX_LIB_NAME="GEOM";%(PreprocessorDefinitions)</PreprocessorDefinitions> <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> </ClCompile> @@ -102,7 +102,7 @@ <Optimization>MaxSpeed</Optimization> <FunctionLevelLinking>true</FunctionLevelLinking> <IntrinsicFunctions>true</IntrinsicFunctions> - <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;SXGEOM_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;SXGEOM_EXPORTS;SX_LIB_NAME="GEOM";%(PreprocessorDefinitions)</PreprocessorDefinitions> <RuntimeLibrary>MultiThreaded</RuntimeLibrary> </ClCompile> <Link> diff --git a/proj/sxguiwinapi/vs2013/sxguiwinapi.vcxproj b/proj/sxguiwinapi/vs2013/sxguiwinapi.vcxproj index 8561c371f3cbd96277f2ca1a4f9d208ba0c2d9f6..81dba1f1671597ca11958a0cd90f84a40ddabf05 100644 --- a/proj/sxguiwinapi/vs2013/sxguiwinapi.vcxproj +++ b/proj/sxguiwinapi/vs2013/sxguiwinapi.vcxproj @@ -145,7 +145,7 @@ </ImportGroup> <PropertyGroup Label="UserMacros" /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <LinkIncremental>false</LinkIncremental> + <LinkIncremental>true</LinkIncremental> <OutDir>../../../build/</OutDir> <TargetName>$(ProjectName)_d</TargetName> <IncludePath>../../../source;$(IncludePath)</IncludePath> @@ -195,6 +195,7 @@ <EnableCOMDATFolding>true</EnableCOMDATFolding> <OptimizeReferences>true</OptimizeReferences> <ImportLibrary>../../../libs/$(TargetName).lib</ImportLibrary> + <ProgramDatabaseFile>$(ProjectDir)$(TargetName).pdb</ProgramDatabaseFile> </Link> </ItemDefinitionGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> diff --git a/proj/sxinput/vs2013/sxinput.vcxproj b/proj/sxinput/vs2013/sxinput.vcxproj index 900a09aab2675fd410daae1821a7308dbf74bb6e..e6adf7499ee116cd794641b2ae3fc91e33862d08 100644 --- a/proj/sxinput/vs2013/sxinput.vcxproj +++ b/proj/sxinput/vs2013/sxinput.vcxproj @@ -40,7 +40,7 @@ </ImportGroup> <PropertyGroup Label="UserMacros" /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <LinkIncremental>false</LinkIncremental> + <LinkIncremental>true</LinkIncremental> <OutDir>../../../build/</OutDir> <TargetName>$(ProjectName)_d</TargetName> <IncludePath>../../../source;$(VC_IncludePath);$(WindowsSDK_IncludePath);../../../sdks/dx9sdk/Include</IncludePath> @@ -60,7 +60,7 @@ </PrecompiledHeader> <WarningLevel>Level3</WarningLevel> <Optimization>Disabled</Optimization> - <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;SXINPUT_EXPORTS;SX_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;SXINPUT_EXPORTS;SX_DLL;SX_LIB_NAME="INPUT";%(PreprocessorDefinitions)</PreprocessorDefinitions> <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> </ClCompile> @@ -80,7 +80,7 @@ <Optimization>MaxSpeed</Optimization> <FunctionLevelLinking>true</FunctionLevelLinking> <IntrinsicFunctions>true</IntrinsicFunctions> - <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;SXINPUT_EXPORTS;SX_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;SXINPUT_EXPORTS;SX_DLL;SX_LIB_NAME="INPUT";%(PreprocessorDefinitions)</PreprocessorDefinitions> <RuntimeLibrary>MultiThreaded</RuntimeLibrary> </ClCompile> <Link> diff --git a/proj/sxlevel/vs2013/sxlevel.vcxproj b/proj/sxlevel/vs2013/sxlevel.vcxproj index dbf9e8d078385196d74432e6a920f6fa7cd4577d..334d962fe99444b5dabb829044ebc89ec583baf2 100644 --- a/proj/sxlevel/vs2013/sxlevel.vcxproj +++ b/proj/sxlevel/vs2013/sxlevel.vcxproj @@ -60,7 +60,7 @@ </PrecompiledHeader> <WarningLevel>Level3</WarningLevel> <Optimization>Disabled</Optimization> - <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;SXLEVEL_EXPORTS;SX_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;SXLEVEL_EXPORTS;SX_DLL;%(PreprocessorDefinitions);SX_LIB_NAME="LEVEL"</PreprocessorDefinitions> <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> </ClCompile> @@ -79,7 +79,7 @@ <Optimization>MaxSpeed</Optimization> <FunctionLevelLinking>true</FunctionLevelLinking> <IntrinsicFunctions>true</IntrinsicFunctions> - <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;SXLEVEL_EXPORTS;SX_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;SXLEVEL_EXPORTS;SX_DLL;%(PreprocessorDefinitions);SX_LIB_NAME="LEVEL"</PreprocessorDefinitions> <RuntimeLibrary>MultiThreaded</RuntimeLibrary> </ClCompile> <Link> diff --git a/proj/sxleveleditor/vs2013/sxleveleditor.vcxproj b/proj/sxleveleditor/vs2013/sxleveleditor.vcxproj index 41fedee70e42865b7a4eb5b8aaee201145d6cedf..e5d12dfd4da83be290f2e850322cc1accd068ac5 100644 --- a/proj/sxleveleditor/vs2013/sxleveleditor.vcxproj +++ b/proj/sxleveleditor/vs2013/sxleveleditor.vcxproj @@ -40,7 +40,7 @@ </ImportGroup> <PropertyGroup Label="UserMacros" /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <LinkIncremental>false</LinkIncremental> + <LinkIncremental>true</LinkIncremental> <TargetName>$(ProjectName)_d</TargetName> <IncludePath>../../../sdks/bullet3/src;$(VC_IncludePath);$(WindowsSDK_IncludePath);../../../source;../../../sdks/dx9sdk/Include;</IncludePath> <LibraryPath>$(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86);../../../libs;../../../sdks/dx9sdk/lib;</LibraryPath> @@ -60,7 +60,7 @@ </PrecompiledHeader> <WarningLevel>TurnOffAllWarnings</WarningLevel> <Optimization>Disabled</Optimization> - <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;SX_LEVEL_EDITOR;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;SX_LEVEL_EDITOR;%(PreprocessorDefinitions);SX_LIB_NAME="LEd"</PreprocessorDefinitions> <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> </ClCompile> <Link> @@ -78,7 +78,7 @@ <Optimization>MaxSpeed</Optimization> <FunctionLevelLinking>true</FunctionLevelLinking> <IntrinsicFunctions>true</IntrinsicFunctions> - <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;SX_LEVEL_EDITOR;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;SX_LEVEL_EDITOR;%(PreprocessorDefinitions);SX_LIB_NAME="LEd"</PreprocessorDefinitions> <RuntimeLibrary>MultiThreaded</RuntimeLibrary> </ClCompile> <Link> diff --git a/proj/sxmaterialeditor/vs2013/sxmaterialeditor.vcxproj b/proj/sxmaterialeditor/vs2013/sxmaterialeditor.vcxproj index bbf500d70c5192f18fd1bbb045e1ddadaf544c9b..90a9a462f75bbeb3dbd7658e1e868c8e712225b3 100644 --- a/proj/sxmaterialeditor/vs2013/sxmaterialeditor.vcxproj +++ b/proj/sxmaterialeditor/vs2013/sxmaterialeditor.vcxproj @@ -60,7 +60,7 @@ </PrecompiledHeader> <WarningLevel>TurnOffAllWarnings</WarningLevel> <Optimization>Disabled</Optimization> - <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;SX_MATERIAL_EDITOR;SX_EXE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;SX_MATERIAL_EDITOR;SX_EXE;%(PreprocessorDefinitions);SX_LIB_NAME="MEd"</PreprocessorDefinitions> <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> </ClCompile> <Link> @@ -78,7 +78,7 @@ <Optimization>MaxSpeed</Optimization> <FunctionLevelLinking>true</FunctionLevelLinking> <IntrinsicFunctions>true</IntrinsicFunctions> - <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;SX_MATERIAL_EDITOR;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;SX_MATERIAL_EDITOR;%(PreprocessorDefinitions);SX_LIB_NAME="MEd"</PreprocessorDefinitions> <RuntimeLibrary>MultiThreaded</RuntimeLibrary> </ClCompile> <Link> diff --git a/proj/sxmtllight/vs2013/sxmtllight.vcxproj b/proj/sxmtllight/vs2013/sxmtllight.vcxproj index 862a03a0d357f25f926f4ddf0da786b6f988cc2f..f32c0d568160b553684ee7c5f9039891a376b30e 100644 --- a/proj/sxmtllight/vs2013/sxmtllight.vcxproj +++ b/proj/sxmtllight/vs2013/sxmtllight.vcxproj @@ -40,7 +40,7 @@ </ImportGroup> <PropertyGroup Label="UserMacros" /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <LinkIncremental>false</LinkIncremental> + <LinkIncremental>true</LinkIncremental> <OutDir>../../../build/</OutDir> <TargetName>$(ProjectName)_d</TargetName> <IncludePath>../../../source;$(VC_IncludePath);$(WindowsSDK_IncludePath);../../../sdks/dx9sdk/Include</IncludePath> @@ -60,7 +60,7 @@ </PrecompiledHeader> <WarningLevel>Level3</WarningLevel> <Optimization>Disabled</Optimization> - <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;SXMTLLIGHT_EXPORTS;SX_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;SXMTLLIGHT_EXPORTS;SX_DLL;%(PreprocessorDefinitions);SX_LIB_NAME="MTLLIGHT"</PreprocessorDefinitions> <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> </ClCompile> @@ -80,7 +80,7 @@ <Optimization>MaxSpeed</Optimization> <FunctionLevelLinking>true</FunctionLevelLinking> <IntrinsicFunctions>true</IntrinsicFunctions> - <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;SXMTLLIGHT_EXPORTS;SX_EXE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;SXMTLLIGHT_EXPORTS;SX_EXE;%(PreprocessorDefinitions);SX_LIB_NAME="MTLLIGHT"</PreprocessorDefinitions> <RuntimeLibrary>MultiThreaded</RuntimeLibrary> </ClCompile> <Link> diff --git a/proj/sxparticles/vs2013/sxparticles.vcxproj b/proj/sxparticles/vs2013/sxparticles.vcxproj index 83896542320f06e7a10573d87be6fecf4859979c..08adde773b47738fa7fc7a54516f51f6c7356aa0 100644 --- a/proj/sxparticles/vs2013/sxparticles.vcxproj +++ b/proj/sxparticles/vs2013/sxparticles.vcxproj @@ -40,7 +40,7 @@ </ImportGroup> <PropertyGroup Label="UserMacros" /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <LinkIncremental>false</LinkIncremental> + <LinkIncremental>true</LinkIncremental> <IncludePath>../../../source;$(VC_IncludePath);$(WindowsSDK_IncludePath);../../../sdks/dx9sdk/Include</IncludePath> <LibraryPath>../../../libs;$(LibraryPath);$(WindowsSDK_LibraryPath_x86);../../../sdks/dx9sdk/Lib</LibraryPath> <SourcePath>../../../source;$(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86);../../../sdks/dx9sdk/Include</SourcePath> @@ -60,7 +60,7 @@ </PrecompiledHeader> <WarningLevel>Level3</WarningLevel> <Optimization>Disabled</Optimization> - <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;SXPARTICLES_EXPORTS;SX_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;SXPARTICLES_EXPORTS;SX_DLL;%(PreprocessorDefinitions);SX_LIB_NAME="PARTICLES"</PreprocessorDefinitions> <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> </ClCompile> @@ -80,7 +80,7 @@ <Optimization>MaxSpeed</Optimization> <FunctionLevelLinking>true</FunctionLevelLinking> <IntrinsicFunctions>true</IntrinsicFunctions> - <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;SXPARTICLES_EXPORTS;SX_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;SXPARTICLES_EXPORTS;SX_DLL;%(PreprocessorDefinitions);SX_LIB_NAME="PARTICLES"</PreprocessorDefinitions> <RuntimeLibrary>MultiThreaded</RuntimeLibrary> </ClCompile> <Link> diff --git a/proj/sxparticleseditor/vs2013/sxparticleseditor.vcxproj b/proj/sxparticleseditor/vs2013/sxparticleseditor.vcxproj index 40e92ff7a6bbd1ee7971e6d4eb0509e07425a904..4061dcb57db03465415fc14d172ba81cc1204e99 100644 --- a/proj/sxparticleseditor/vs2013/sxparticleseditor.vcxproj +++ b/proj/sxparticleseditor/vs2013/sxparticleseditor.vcxproj @@ -60,7 +60,7 @@ </PrecompiledHeader> <WarningLevel>Level1</WarningLevel> <Optimization>Disabled</Optimization> - <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;SX_PARTICLES_EDITOR;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;SX_PARTICLES_EDITOR;%(PreprocessorDefinitions);SX_LIB_NAME="PEd"</PreprocessorDefinitions> <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> </ClCompile> <Link> @@ -78,7 +78,7 @@ <Optimization>MaxSpeed</Optimization> <FunctionLevelLinking>true</FunctionLevelLinking> <IntrinsicFunctions>true</IntrinsicFunctions> - <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;SX_PARTICLES_EDITOR;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;SX_PARTICLES_EDITOR;%(PreprocessorDefinitions);SX_LIB_NAME="PEd"</PreprocessorDefinitions> <RuntimeLibrary>MultiThreaded</RuntimeLibrary> </ClCompile> <Link> diff --git a/proj/sxphysics/vs2013/sxphysics.vcxproj b/proj/sxphysics/vs2013/sxphysics.vcxproj index 3abf267a1a4506497466c19687883cd07f6cdc4d..334ac37c21a03c935b8a5b3d26c79cca23aa0acf 100644 --- a/proj/sxphysics/vs2013/sxphysics.vcxproj +++ b/proj/sxphysics/vs2013/sxphysics.vcxproj @@ -40,7 +40,7 @@ </ImportGroup> <PropertyGroup Label="UserMacros" /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <LinkIncremental>false</LinkIncremental> + <LinkIncremental>true</LinkIncremental> <OutDir>../../../build/</OutDir> <IncludePath>../../../source;../../../sdks/bullet3/src;$(VC_IncludePath);$(WindowsSdk_71A_IncludePath);../../../sdks/dx9sdk/Include;</IncludePath> <LibraryPath>../../../sdks/dx9sdk/Lib;../../../sdks/bullet3/bin;../../../libs;$(VC_LibraryPath_x86);$(WindowsSdk_71A_LibraryPath_x86);</LibraryPath> @@ -58,7 +58,7 @@ </PrecompiledHeader> <WarningLevel>Level3</WarningLevel> <Optimization>Disabled</Optimization> - <PreprocessorDefinitions>BULLET_EXPORTS=_declspec(dllexport);SX_DLL;WIN32;_CRT_SECURE_NO_WARNINGS;_DEBUG;_WINDOWS;_USRDLL;SXPHYSICS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>BULLET_EXPORTS=_declspec(dllexport);SX_DLL;WIN32;_CRT_SECURE_NO_WARNINGS;_DEBUG;_WINDOWS;_USRDLL;SXPHYSICS_EXPORTS;%(PreprocessorDefinitions);SX_LIB_NAME="PHYSICS"</PreprocessorDefinitions> <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> </ClCompile> @@ -78,7 +78,7 @@ <Optimization>MaxSpeed</Optimization> <FunctionLevelLinking>true</FunctionLevelLinking> <IntrinsicFunctions>true</IntrinsicFunctions> - <PreprocessorDefinitions>BULLET_EXPORTS=_declspec(dllexport);SX_DLL;WIN32;_CRT_SECURE_NO_WARNINGS;NDEBUG;_WINDOWS;_USRDLL;SXPHYSICS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>BULLET_EXPORTS=_declspec(dllexport);SX_DLL;WIN32;_CRT_SECURE_NO_WARNINGS;NDEBUG;_WINDOWS;_USRDLL;SXPHYSICS_EXPORTS;%(PreprocessorDefinitions);SX_LIB_NAME="PHYSICS"</PreprocessorDefinitions> <RuntimeLibrary>MultiThreaded</RuntimeLibrary> </ClCompile> <Link> @@ -87,6 +87,7 @@ <EnableCOMDATFolding>true</EnableCOMDATFolding> <OptimizeReferences>true</OptimizeReferences> <ImportLibrary>../../../libs/$(TargetName).lib</ImportLibrary> + <ProgramDatabaseFile>$(ProjectDir)$(TargetName).pdb</ProgramDatabaseFile> </Link> </ItemDefinitionGroup> <ItemGroup> diff --git a/proj/sxpp/vs2013/sxpp.vcxproj b/proj/sxpp/vs2013/sxpp.vcxproj index 77c5ed4e235f38b92c21ce5cfac77e0af370eccc..2279d7f2ccf80d8b5292500bf75c2617860a3cb4 100644 --- a/proj/sxpp/vs2013/sxpp.vcxproj +++ b/proj/sxpp/vs2013/sxpp.vcxproj @@ -40,7 +40,7 @@ </ImportGroup> <PropertyGroup Label="UserMacros" /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <LinkIncremental>false</LinkIncremental> + <LinkIncremental>true</LinkIncremental> <IncludePath>../../../source;$(VC_IncludePath);$(WindowsSDK_IncludePath);../../../sdks/dx9sdk/Include</IncludePath> <LibraryPath>../../../libs;$(LibraryPath);$(WindowsSDK_LibraryPath_x86);../../../sdks/dx9sdk/Lib</LibraryPath> <SourcePath>../../../source;$(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86);../../../sdks/dx9sdk/Include</SourcePath> @@ -61,7 +61,7 @@ </PrecompiledHeader> <WarningLevel>Level3</WarningLevel> <Optimization>Disabled</Optimization> - <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;SXPP_EXPORTS;SX_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;SXPP_EXPORTS;SX_DLL;%(PreprocessorDefinitions);SX_LIB_NAME="PP"</PreprocessorDefinitions> <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> </ClCompile> @@ -81,7 +81,7 @@ <Optimization>MaxSpeed</Optimization> <FunctionLevelLinking>true</FunctionLevelLinking> <IntrinsicFunctions>true</IntrinsicFunctions> - <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;SXPP_EXPORTS;SX_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;SXPP_EXPORTS;SX_DLL;%(PreprocessorDefinitions);SX_LIB_NAME="PP"</PreprocessorDefinitions> <RuntimeLibrary>MultiThreaded</RuntimeLibrary> </ClCompile> <Link> diff --git a/proj/sxrender/vs2013/sxrender.vcxproj b/proj/sxrender/vs2013/sxrender.vcxproj index 2d6dd9190e9155d0c57e8b10977556b154f7d640..04f059f164f4b855517746a2ca1f9c1021092d16 100644 --- a/proj/sxrender/vs2013/sxrender.vcxproj +++ b/proj/sxrender/vs2013/sxrender.vcxproj @@ -60,7 +60,7 @@ </PrecompiledHeader> <WarningLevel>Level3</WarningLevel> <Optimization>Disabled</Optimization> - <PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_WARNINGS;_DEBUG;_WINDOWS;_USRDLL;SXRENDER_EXPORTS;SX_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_WARNINGS;_DEBUG;_WINDOWS;_USRDLL;SXRENDER_EXPORTS;SX_DLL;%(PreprocessorDefinitions);SX_LIB_NAME="RENDER"</PreprocessorDefinitions> <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> </ClCompile> @@ -69,6 +69,7 @@ <GenerateDebugInformation>true</GenerateDebugInformation> <ImportLibrary>../../../libs/$(TargetName).lib</ImportLibrary> <ProgramDatabaseFile>$(ProjectDir)$(TargetName).pdb</ProgramDatabaseFile> + <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile> </Link> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> @@ -79,7 +80,7 @@ <Optimization>MaxSpeed</Optimization> <FunctionLevelLinking>true</FunctionLevelLinking> <IntrinsicFunctions>true</IntrinsicFunctions> - <PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_WARNINGS;NDEBUG;_WINDOWS;_USRDLL;SXRENDER_EXPORTS;SX_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_WARNINGS;NDEBUG;_WINDOWS;_USRDLL;SXRENDER_EXPORTS;SX_DLL;%(PreprocessorDefinitions);SX_LIB_NAME="RENDER"</PreprocessorDefinitions> <RuntimeLibrary>MultiThreaded</RuntimeLibrary> </ClCompile> <Link> diff --git a/proj/sxrender/vs2013/sxrender_d.dll b/proj/sxrender/vs2013/sxrender_d.dll new file mode 100644 index 0000000000000000000000000000000000000000..ab76cdcbadac486d17b0ff8b14a292ac44fa3f46 Binary files /dev/null and b/proj/sxrender/vs2013/sxrender_d.dll differ diff --git a/proj/sxscore/vs2013/sxscore.vcxproj b/proj/sxscore/vs2013/sxscore.vcxproj index 2bc613f0af0ecf37de936905e287c745ab3cf00b..fdc0b888f7270c2ff394451b01c24e8bf2cfb49d 100644 --- a/proj/sxscore/vs2013/sxscore.vcxproj +++ b/proj/sxscore/vs2013/sxscore.vcxproj @@ -50,7 +50,7 @@ </ImportGroup> <PropertyGroup Label="UserMacros" /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <LinkIncremental>false</LinkIncremental> + <LinkIncremental>true</LinkIncremental> <OutDir>../../../build/</OutDir> <TargetName>$(ProjectName)_d</TargetName> <IncludePath>../../../sdks/ogg/libogg/include/;../../../sdks/ogg/libvorbis/include/;../../../source;$(VC_IncludePath);$(WindowsSDK_IncludePath);../../../sdks/dx9sdk/Include</IncludePath> @@ -70,7 +70,7 @@ </PrecompiledHeader> <WarningLevel>Level3</WarningLevel> <Optimization>Disabled</Optimization> - <PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_WARNINGS;_DEBUG;_WINDOWS;_USRDLL;SXSCORE_EXPORTS;SX_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_WARNINGS;_DEBUG;_WINDOWS;_USRDLL;SXSCORE_EXPORTS;SX_DLL;%(PreprocessorDefinitions);SX_LIB_NAME="SCORE"</PreprocessorDefinitions> <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> </ClCompile> @@ -90,7 +90,7 @@ <Optimization>MaxSpeed</Optimization> <FunctionLevelLinking>true</FunctionLevelLinking> <IntrinsicFunctions>true</IntrinsicFunctions> - <PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_WARNINGS;NDEBUG;_WINDOWS;_USRDLL;SXSCORE_EXPORTS;SX_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_WARNINGS;NDEBUG;_WINDOWS;_USRDLL;SXSCORE_EXPORTS;SX_DLL;%(PreprocessorDefinitions);SX_LIB_NAME="SCORE"</PreprocessorDefinitions> <RuntimeLibrary>MultiThreaded</RuntimeLibrary> </ClCompile> <Link> diff --git a/source/GRegisterIndex.h b/source/GRegisterIndex.h index 48d69639f6433ddbc1fe257ed028801fd4e45e30..2f6cff81b9478e9ccd2f4351362f3fe0b59fed06 100644 --- a/source/GRegisterIndex.h +++ b/source/GRegisterIndex.h @@ -1,16 +1,16 @@ -/****************************************************** -Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017 +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 See the license in LICENSE -******************************************************/ +***********************************************************/ /*! \file Зарезервированные (именованые) номера регистров */ -#ifndef __G_RI -#define __G_RI +#ifndef __G_RI_H +#define __G_RI_H /*! \name float4x4 register @{*/ diff --git a/source/SkyXEngine.h b/source/SkyXEngine.h index 0aea0610056aa2df4d83db84120ffa539e3b62ae..36810e6f94fdb1402609b062236c2e34dfa30b4f 100644 --- a/source/SkyXEngine.h +++ b/source/SkyXEngine.h @@ -1,8 +1,8 @@ -/****************************************************** -Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017 +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 See the license in LICENSE -******************************************************/ +***********************************************************/ /*! \file diff --git a/source/SkyXEngine_Build/SkyXEngine_Build.cpp b/source/SkyXEngine_Build/SkyXEngine_Build.cpp index 50232fab65535afaa7c7ee20db16c7caded02074..af579d6be24a02613cd8ef75fb351fda860d0dc2 100644 --- a/source/SkyXEngine_Build/SkyXEngine_Build.cpp +++ b/source/SkyXEngine_Build/SkyXEngine_Build.cpp @@ -1,8 +1,8 @@ -/****************************************************** -Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017 +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 See the license in LICENSE -******************************************************/ +***********************************************************/ #define _CRT_SECURE_NO_WARNINGS diff --git a/source/aigrid/aigrid.cpp b/source/aigrid/aigrid.cpp index 16acec3c174c8d83393ff489375e3541cadcb87e..afc23a97b8e12d67d08f3a318b42ac9c4b4b1deb 100644 --- a/source/aigrid/aigrid.cpp +++ b/source/aigrid/aigrid.cpp @@ -1,4 +1,9 @@ +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include "aigrid.h" void AIGrid::CorrectPosXZ(float3* pos) @@ -61,13 +66,13 @@ void AIGrid::GridSave(const char* path) { if (ArrQuads.size() <= 0) { - g_fnReportf(REPORT_MSG_LEVEL_WARNING, "sxaigrid: AI grid not found\n"); + LibReport(REPORT_MSG_LEVEL_WARNING, "AI grid not found\n"); return; } if (CountSplits <= 0) { - g_fnReportf(REPORT_MSG_LEVEL_WARNING, "sxaigrid: can not find path, because AI grid is not validate splits\n"); + LibReport(REPORT_MSG_LEVEL_WARNING, "can not find path, because AI grid is not validate splits\n"); return; } @@ -189,7 +194,7 @@ void AIGrid::GridLoad(const char* path) fclose(file); ReCreateBuffs(); - g_fnReportf(REPORT_MSG_LEVEL_NOTICE, "sxaigrid: AI grid is loaded, count quads %d, count graph points %d\n", ArrQuads.size(), ArrGraphPointsIDs.size()); + LibReport(REPORT_MSG_LEVEL_NOTICE, "AI grid is loaded, count quads %d, count graph points %d\n", ArrQuads.size(), ArrGraphPointsIDs.size()); GridTestValidation(); } @@ -273,7 +278,7 @@ void AIGrid::BBCreate(const float3* center, const float3* param) { if (ArrBound.size() > 1) { - g_fnReportf(REPORT_MSG_LEVEL_WARNING, "sxaigrid: bound box already splitting, unresolved create"); + LibReport(REPORT_MSG_LEVEL_WARNING, "bound box already splitting, unresolved create"); return; } @@ -305,13 +310,13 @@ void AIGrid::BBSetDimensions(const float3* dim) { if (ArrBound.size() <= 0) { - g_fnReportf(REPORT_MSG_LEVEL_WARNING, "sxaigrid: bound box is not created"); + LibReport(REPORT_MSG_LEVEL_WARNING, "bound box is not created"); return; } if (ArrBound.size() > 1) { - g_fnReportf(REPORT_MSG_LEVEL_WARNING, "sxaigrid: bound box already splitting, unresolved set dimensions"); + LibReport(REPORT_MSG_LEVEL_WARNING, "bound box already splitting, unresolved set dimensions"); return; } @@ -347,7 +352,7 @@ void AIGrid::BBGetDimensions(float3* dim) const { if (ArrBound.size() <= 0) { - g_fnReportf(REPORT_MSG_LEVEL_WARNING, "sxaigrid: bound box is not created"); + LibReport(REPORT_MSG_LEVEL_WARNING, "bound box is not created"); return; } @@ -363,13 +368,13 @@ void AIGrid::BBSetPos(const float3* pos) { if (ArrBound.size() <= 0) { - g_fnReportf(REPORT_MSG_LEVEL_WARNING, "sxaigrid: bound box is not created"); + LibReport(REPORT_MSG_LEVEL_WARNING, "bound box is not created"); return; } if(ArrBound.size() > 1) { - g_fnReportf(REPORT_MSG_LEVEL_WARNING, "sxaigrid: bound box already splitting, unresolved set position"); + LibReport(REPORT_MSG_LEVEL_WARNING, "bound box already splitting, unresolved set position"); return; } @@ -399,7 +404,7 @@ void AIGrid::BBGetPos(float3* pos) const { if (ArrBound.size() <= 0) { - g_fnReportf(REPORT_MSG_LEVEL_WARNING, "sxaigrid: bound box is not created"); + LibReport(REPORT_MSG_LEVEL_WARNING, "bound box is not created"); return; } @@ -932,7 +937,7 @@ void AIGrid::GraphicsInit() if (!DXDevice) { - g_fnReportf(REPORT_MSG_LEVEL_ERROR, "sxaigrid: %s - dx device is not init", GEN_MSG_LOCATION); + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - dx device is not init", GEN_MSG_LOCATION); } D3DVERTEXELEMENT9 InstanceAIQuad[] = @@ -949,7 +954,7 @@ void AIGrid::GraphicsInit() DXDevice->CreateVertexDeclaration(InstanceAIQuad, &AIQuadDecl); - Tex_AIGrid = SGCore_LoadTexAddName("decal_aigrid1.dds", LoadTexType::ltt_const); + Tex_AIGrid = SGCore_LoadTexAddName("decal_aigrid1.dds", LOAD_TEXTURE_TYPE_CONST); IDVS = SGCore_ShaderLoad(SHADER_TYPE_VERTEX, "aigrid_quad.vs", "aigrid_quad.vs", SHADER_CHECKDOUBLE_PATH); IDPS = SGCore_ShaderLoad(SHADER_TYPE_PIXEL, "aigrid_quad.ps", "aigrid_quad.ps", SHADER_CHECKDOUBLE_PATH); @@ -1106,7 +1111,7 @@ void AIGrid::GridGenerate() { if (ArrQuads.size() <= 0) { - g_fnReportf(REPORT_MSG_LEVEL_WARNING, "sxaigrid: it is necessary one quad in AI grid"); + LibReport(REPORT_MSG_LEVEL_WARNING, "it is necessary one quad in AI grid"); return; } @@ -1147,7 +1152,7 @@ void AIGrid::GridGenerate() ArrQuadsCheck.clear(); } - g_fnReportf(REPORT_MSG_LEVEL_NOTICE, "sxaigrid: AI grid generated, all count = %d, gen count = %d, count time = %d mlsec\n", ArrQuads.size(), ArrQuads.size() - oldsizegrid, GetTickCount() - ttime); + LibReport(REPORT_MSG_LEVEL_NOTICE, "AI grid generated, all count = %d, gen count = %d, count time = %d mlsec\n", ArrQuads.size(), ArrQuads.size() - oldsizegrid, GetTickCount() - ttime); CountSplits = 0; ReCreateBuffs(); @@ -1157,7 +1162,7 @@ void AIGrid::GraphPointGenerate() { if (ArrQuads.size() <= 1) { - g_fnReportf(REPORT_MSG_LEVEL_WARNING, "sxaigrid: AI grid not found\n"); + LibReport(REPORT_MSG_LEVEL_WARNING, "AI grid not found\n"); return; } @@ -1189,7 +1194,7 @@ void AIGrid::GraphPointGenerate() if (ArrGraphPointsIDs.size() > 0) { memset(&(ArrCostGPIDs[0]), -1, ArrCostGPIDs.size() * sizeof(int32_t)); - g_fnReportf(REPORT_MSG_LEVEL_NOTICE, "sxaigrid: graph points is generated, count %d\n", ArrGraphPointsIDs.size()); + LibReport(REPORT_MSG_LEVEL_NOTICE, "graph points is generated, count %d\n", ArrGraphPointsIDs.size()); } } @@ -2104,7 +2109,7 @@ void AIGrid::GridTestValidation() { if (ArrQuads.size() <= 1 || ArrBound.size() <= 1) { - g_fnReportf(REPORT_MSG_LEVEL_WARNING, "sxaigrid: AI grid is not created, unresolved validation\n"); + LibReport(REPORT_MSG_LEVEL_WARNING, "AI grid is not created, unresolved validation\n"); return; } @@ -2173,7 +2178,7 @@ void AIGrid::GridTestValidation() } //} - g_fnReportf(REPORT_MSG_LEVEL_NOTICE, "sxaigrid: AI grid is validation, deleted quads %d, count splits %d\n", oldcountquads - ArrQuads.size(), CountSplits); + LibReport(REPORT_MSG_LEVEL_NOTICE, "AI grid is validation, deleted quads %d, count splits %d\n", oldcountquads - ArrQuads.size(), CountSplits); } UINT AIGrid::GridGetCountSplits() @@ -2224,7 +2229,7 @@ void AIGrid::RenderQuads(const ISXFrustum * frustum, const float3 * viewpos, flo bound = ArrBound[i]; center = (bound->min + bound->max) * 0.5f; radius = SMVector3Length(center - bound->max); - if (frustum->SphereInFrustum(¢er, radius)) + if (frustum->sphereInFrustum(¢er, radius)) { for (int k = 0, kl = bound->ArrIdsQuads.size(); k < kl; ++k) { @@ -2637,7 +2642,7 @@ ID AIGrid::GraphPointGetNear(ID beginq, ID endq) { if (ArrQuads.size() <= 1) { - g_fnReportf(REPORT_MSG_LEVEL_WARNING, "sxaigrid: AI grid not found\n"); + LibReport(REPORT_MSG_LEVEL_WARNING, "AI grid not found\n"); return -1; } @@ -2646,25 +2651,25 @@ ID AIGrid::GraphPointGetNear(ID beginq, ID endq) if (CountSplits == 0) { - g_fnReportf(REPORT_MSG_LEVEL_WARNING, "sxaigrid: can not find path, because AI grid is not validate splits\n"); + LibReport(REPORT_MSG_LEVEL_WARNING, "can not find path, because AI grid is not validate splits\n"); return -1; } if (ArrQuads[beginq]->IdSplit != ArrQuads[endq]->IdSplit) { - g_fnReportf(REPORT_MSG_LEVEL_WARNING, "sxaigrid: quads in different splits, path not found\n"); + LibReport(REPORT_MSG_LEVEL_WARNING, "quads in different splits, path not found\n"); return -1; } if (beginq == endq) { - g_fnReportf(REPORT_MSG_LEVEL_WARNING, "sxaigrid: beginq == endq, path not found\n"); + LibReport(REPORT_MSG_LEVEL_WARNING, "beginq == endq, path not found\n"); return -1; } if (ArrGraphPointsIDs.size() == 0) { - g_fnReportf(REPORT_MSG_LEVEL_WARNING, "sxaigrid: graph points not found\n"); + LibReport(REPORT_MSG_LEVEL_WARNING, "graph points not found\n"); return -1; } @@ -2717,7 +2722,7 @@ bool AIGrid::GridFindPath(ID beginq, ID endq) { if (ArrQuads.size() <= 1) { - g_fnReportf(REPORT_MSG_LEVEL_WARNING, "sxaigrid: AI grid not found\n"); + LibReport(REPORT_MSG_LEVEL_WARNING, "AI grid not found\n"); return false; } @@ -2726,19 +2731,19 @@ bool AIGrid::GridFindPath(ID beginq, ID endq) if (CountSplits == 0) { - g_fnReportf(REPORT_MSG_LEVEL_WARNING, "sxaigrid: can not find path, because AI grid is not validate splits\n"); + LibReport(REPORT_MSG_LEVEL_WARNING, "can not find path, because AI grid is not validate splits\n"); return false; } if (ArrQuads[beginq]->IdSplit != ArrQuads[endq]->IdSplit) { - g_fnReportf(REPORT_MSG_LEVEL_WARNING, "sxaigrid: quads in different splits, path not found\n"); + LibReport(REPORT_MSG_LEVEL_WARNING, "quads in different splits, path not found\n"); return false; } if (beginq == endq) { - g_fnReportf(REPORT_MSG_LEVEL_WARNING, "sxaigrid: beginq == endq, path not found\n"); + LibReport(REPORT_MSG_LEVEL_WARNING, "beginq == endq, path not found\n"); return false; } diff --git a/source/aigrid/aigrid.h b/source/aigrid/aigrid.h index d9d92275e94983d92229fbe6619ac9cb86111d0e..9193ec82fe280bdf6e727dda0c20317b5999b2f7 100644 --- a/source/aigrid/aigrid.h +++ b/source/aigrid/aigrid.h @@ -1,4 +1,9 @@ +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #ifndef __AIGRID_H #define __AIGRID_H @@ -7,13 +12,12 @@ #include <common/memalloc.h> #define SM_D3D_CONVERSIONS -#include <common\SXMath.h> +#include <common/SXMath.h> #include "sxaigrid.h" -extern report_func g_fnReportf; extern g_aiquad_phy_navigate AIQuadPhyNavigate; -#define AIGRID_QUAD_PRECOND(id,retval) if (id < 0 || ArrQuads.size() <= id) {g_fnReportf(REPORT_MSG_LEVEL_ERROR, " %s - unresolved index '%d' of quad, sxaigrid", GEN_MSG_LOCATION, id); return retval;} +#define AIGRID_QUAD_PRECOND(id,retval) if (id < 0 || ArrQuads.size() <= id) {LibReport(REPORT_MSG_LEVEL_ERROR, " %s - unresolved index '%d' of quad, sxaigrid", GEN_MSG_LOCATION, id); return retval;} #define toint100(fnum) (int32_t)((fnum + 0.0001f) * 100) diff --git a/source/aigrid/sxaigrid.cpp b/source/aigrid/sxaigrid.cpp index 9d262c9e5461cb1d8fed559cf3c6a4e6965cb1dc..ae2e1834e22f91c5838ac4dd9b154b2b76048621 100644 --- a/source/aigrid/sxaigrid.cpp +++ b/source/aigrid/sxaigrid.cpp @@ -1,4 +1,9 @@ +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include "sxaigrid.h" #include "aigrid.h" @@ -18,7 +23,7 @@ g_aiquad_phy_navigate AIQuadPhyNavigate = QuadPhyNavigate; AIGrid* ObjAIGrid = 0; -#define AIG_PRECOND(retval) if(!ObjAIGrid){g_fnReportf(REPORT_MSG_LEVEL_ERROR, "%s - sxaigrid is not init", GEN_MSG_LOCATION); return retval;} +#define AIG_PRECOND(retval) if(!ObjAIGrid){LibReport(REPORT_MSG_LEVEL_ERROR, "%s - sxaigrid is not init", GEN_MSG_LOCATION); return retval;} //########################################################################## @@ -42,7 +47,7 @@ SX_LIB_API void SAIG_0Create(const char* name, bool use_graphics, bool is_unic) if (GetLastError() == ERROR_ALREADY_EXISTS) { CloseHandle(hMutex); - g_fnReportf(-1, "%s - none unic name, sxaigrid", GEN_MSG_LOCATION); + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - none unic name", GEN_MSG_LOCATION); } else { @@ -59,7 +64,7 @@ SX_LIB_API void SAIG_0Create(const char* name, bool use_graphics, bool is_unic) } } else - g_fnReportf(-1, "%s - not init argument [name], sxaigrid", GEN_MSG_LOCATION); + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - not init argument [name]", GEN_MSG_LOCATION); } SX_LIB_API void SAIG_AKill() diff --git a/source/aigrid/sxaigrid.h b/source/aigrid/sxaigrid.h index 7a8bf662e657c752c00635bd2d2829666a3877cd..f1c2dec5e8aa3b56cc05d36370ba7948721ad635 100644 --- a/source/aigrid/sxaigrid.h +++ b/source/aigrid/sxaigrid.h @@ -1,8 +1,8 @@ -/****************************************************** -Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017 +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 See the license in LICENSE -******************************************************/ +***********************************************************/ /*! \file diff --git a/source/aigrid/sxaigrid_dll.cpp b/source/aigrid/sxaigrid_dll.cpp index 40901c2f92ac2b50d40832d6b83247e81e889fce..a34ff74f606bdc80ad683796dbf5ca09502303a5 100644 --- a/source/aigrid/sxaigrid_dll.cpp +++ b/source/aigrid/sxaigrid_dll.cpp @@ -1,10 +1,9 @@ -/****************************************************** -Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017 +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 See the license in LICENSE -******************************************************/ +***********************************************************/ -#pragma once #include <windows.h> BOOL APIENTRY DllMain(HMODULE hModule, diff --git a/source/anim/ModelFile.h b/source/anim/ModelFile.h index 9d87deb4040ee3701a2b0a62fb548f258e0921bf..20f6645a731127b8ceb39fb010c12b3a72e9579e 100644 --- a/source/anim/ModelFile.h +++ b/source/anim/ModelFile.h @@ -1,8 +1,8 @@ -/****************************************************** -Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017 +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 See the license in LICENSE -******************************************************/ +***********************************************************/ /*! \file @@ -14,8 +14,8 @@ See the license in LICENSE @{ */ -#ifndef _ModelFileAnim_H_ -#define _ModelFileAnim_H_ +#ifndef __MODELFILE_H +#define __MODELFILE_H #include <common/sxtypes.h> #include <common/SXMath.h> diff --git a/source/anim/animated.cpp b/source/anim/animated.cpp index c7de1b11a86160292e266477b55808fab4fcc66a..47b08aa5b6ec90bd0e11e5f3168412d6f498f7e0 100644 --- a/source/anim/animated.cpp +++ b/source/anim/animated.cpp @@ -1,4 +1,9 @@ +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include "animated.h" #include <cstdlib> #include <cstdio> @@ -49,14 +54,14 @@ void ModelFile::Load(const char * name) FILE * fp = fopen(name, "rb"); if(!fp) { - reportf(REPORT_MSG_LEVEL_ERROR, "Unable to open \"%s\"\n", name); + LibReport(REPORT_MSG_LEVEL_ERROR, "Unable to open \"%s\"\n", name); } fread(&m_hdr, sizeof(ModelHeader), 1, fp); if(m_hdr.Magick != SX_MODEL_MAGICK) { - reportf(REPORT_MSG_LEVEL_ERROR, "Corrupt model \"%s\"\n", name); + LibReport(REPORT_MSG_LEVEL_ERROR, "Corrupt model \"%s\"\n", name); fclose(fp); return; } @@ -69,7 +74,7 @@ void ModelFile::Load(const char * name) fclose(fp); return; } - reportf(REPORT_MSG_LEVEL_ERROR, "Invalid version %d file \"%s\"\n", m_hdr.iVersion, name); + LibReport(REPORT_MSG_LEVEL_ERROR, "Invalid version %d file \"%s\"\n", m_hdr.iVersion, name); fclose(fp); return; } @@ -225,21 +230,21 @@ void ModelFile::Load6(const char * name) FILE * fp = fopen(name, "rb"); if(!fp) { - reportf(REPORT_MSG_LEVEL_ERROR, "Unable to open \"%s\"\n", name); + LibReport(REPORT_MSG_LEVEL_ERROR, "Unable to open \"%s\"\n", name); } fread(&m_hdr, sizeof(ModelHeader), 1, fp); if(m_hdr.Magick != SX_MODEL_MAGICK) { - reportf(REPORT_MSG_LEVEL_ERROR, "Corrupt model \"%s\"\n", name); + LibReport(REPORT_MSG_LEVEL_ERROR, "Corrupt model \"%s\"\n", name); fclose(fp); return; } if(m_hdr.iVersion != SX_MODEL_VERSION_OLD) { - reportf(REPORT_MSG_LEVEL_ERROR, "Invalid version %d file \"%s\"\n", m_hdr.iVersion, name); + LibReport(REPORT_MSG_LEVEL_ERROR, "Invalid version %d file \"%s\"\n", m_hdr.iVersion, name); fclose(fp); return; } @@ -821,7 +826,7 @@ void ModelFile::BuildMeshBuffers() if(j == 0) { - m_pBoundBox->CalcBound(m_ppVertexBuffer[0], iStartVertex, vsize); + m_pBoundBox->calcBound(m_ppVertexBuffer[0], iStartVertex, vsize); } } @@ -1647,12 +1652,12 @@ void Animation::play(const char * name, UINT iFadeTime, UINT slot, bool bReplace } if(slot >= BLEND_MAX) { - reportf(REPORT_MSG_LEVEL_WARNING, "Unable to play animation \"%s\" Invalid slot %d, max valid slot is %d\n", name, slot, BLEND_MAX - 1); + LibReport(REPORT_MSG_LEVEL_WARNING, "Unable to play animation \"%s\" Invalid slot %d, max valid slot is %d\n", name, slot, BLEND_MAX - 1); return; } if(!m_mSeqIds.KeyExists(name)) { - reportf(REPORT_MSG_LEVEL_WARNING, "Unable to play animation \"%s\"\n", name); + LibReport(REPORT_MSG_LEVEL_WARNING, "Unable to play animation \"%s\"\n", name); return; } UINT sid = m_mSeqIds[name]; @@ -1999,7 +2004,7 @@ void Animation::assembly() ++sCur; --i; //report error - reportf(REPORT_MSG_LEVEL_WARNING, "Skeleton hierarchy incompatible"); + LibReport(REPORT_MSG_LEVEL_WARNING, "Skeleton hierarchy incompatible"); break; } } @@ -2440,7 +2445,7 @@ void AnimationManager::setVertexDeclaration(MODEL_VERTEX_TYPE nDecl) { if(nDecl >= MVT_SIZE) { - reportf(REPORT_MSG_LEVEL_ERROR, "Unknown vertex declaration %d in AnimationManager::setVertexDeclaration()\n", nDecl); + LibReport(REPORT_MSG_LEVEL_ERROR, "Unknown vertex declaration %d in AnimationManager::setVertexDeclaration()\n", nDecl); return; } m_pd3dDevice->SetVertexDeclaration(pVertexDeclaration[nDecl]); @@ -2473,7 +2478,7 @@ void AnimationManager::update(int thread) { if(thread >= m_iThreadNum) { - reportf(REPORT_MSG_LEVEL_WARNING, "Requested thread %d but only %d threads allowed\n", thread, m_iThreadNum); + LibReport(REPORT_MSG_LEVEL_WARNING, "Requested thread %d but only %d threads allowed\n", thread, m_iThreadNum); return; } for(uint32_t i = thread, l = m_pAnimatedList.size(); i < l; i += m_iThreadNum) @@ -2508,7 +2513,7 @@ void AnimationManager::computeVis(const ISXFrustum * frustum, const float3 * vie for(uint32_t i = 0, l = m_pAnimatedList.size(); i < l; ++i) { pAnim = m_pAnimatedList[i]; - pAnim->getBound()->GetSphere(&jcenter, &jradius.x); + pAnim->getBound()->getSphere(&jcenter, &jradius.x); m = pAnim->getWorldTM(); m._11 = SMVector3Length(float3(m._11, m._21, m._31)); @@ -2519,7 +2524,7 @@ void AnimationManager::computeVis(const ISXFrustum * frustum, const float3 * vie m._41 = m._42 = m._43 = 0.0f; jradius = SMVector3Transform(jradius, m); - pAnim->m_vIsVisibleFor[id_arr] = frustum->SphereInFrustum(&jcenter, jradius.x); + pAnim->m_vIsVisibleFor[id_arr] = frustum->sphereInFrustum(&jcenter, jradius.x); } } diff --git a/source/anim/animated.h b/source/anim/animated.h index 16c0f3b787c456bd25ef5bf92b9a27971d9dd4e8..22a50c8cf8af3366edc69277aabb8f378d00a797 100644 --- a/source/anim/animated.h +++ b/source/anim/animated.h @@ -1,5 +1,11 @@ -#ifndef _ANIMATED_H_ -#define _ANIMATED_H_ + +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + +#ifndef __ANIMATED_H +#define __ANIMATED_H #include "ModelFile.h" @@ -20,8 +26,6 @@ #include "sxanim.h" -extern report_func reportf; - class Animation; class AnimationManager; class ISXBound; diff --git a/source/anim/sxanim.h b/source/anim/sxanim.h index 69a0422abecb6950fa9adf5b4240e6809ca25c25..ee094dae397e37982a80ea9f716056ec340e3e36 100644 --- a/source/anim/sxanim.h +++ b/source/anim/sxanim.h @@ -1,8 +1,8 @@ -/****************************************************** -Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017 +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 See the license in LICENSE -******************************************************/ +***********************************************************/ /*! \file diff --git a/source/anim/sxanim_dll.cpp b/source/anim/sxanim_dll.cpp index b519ba7ce514f4f2845faa7b5c80e8d5074ff3dc..442acbabbfa418463c77b9ec9ad19ff30a5655d7 100644 --- a/source/anim/sxanim_dll.cpp +++ b/source/anim/sxanim_dll.cpp @@ -1,8 +1,8 @@ -/****************************************************** -Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017 +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 See the license in LICENSE -******************************************************/ +***********************************************************/ #define WIN32_LEAN_AND_MEAN #include <windows.h> @@ -13,10 +13,10 @@ See the license in LICENSE #if !defined(DEF_STD_REPORT) #define DEF_STD_REPORT -report_func reportf = DefReport; +report_func g_fnReportf = DefReport; #endif -#define SA_PRECOND(ret) if(!g_mgr){reportf(REPORT_MSG_LEVEL_ERROR, "%s - sxanim is not init", GEN_MSG_LOCATION);return ret;} +#define SA_PRECOND(ret) if(!g_mgr){LibReport(REPORT_MSG_LEVEL_ERROR, "%s - sxanim is not init", GEN_MSG_LOCATION);return ret;} BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, @@ -40,7 +40,7 @@ SX_LIB_API void SXAnim_0Create() { if(g_mgr) { - reportf(-1, "%s - sxanim double init", GEN_MSG_LOCATION); + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - sxanim double init", GEN_MSG_LOCATION); return; } g_mgr = new AnimationManager(SGCore_GetDXDevice()); @@ -102,5 +102,5 @@ SX_LIB_API void SXAnim_ModelsDelArrForCom(ID id_arr) SX_LIB_API void SXAnim_Dbg_Set(report_func rf) { - reportf = rf; + g_fnReportf = rf; } diff --git a/source/core/Config.cpp b/source/core/Config.cpp index 8760167988eb469a18636543ca0fbd848e46a863..be2502a13cd320c324865befa4881fa7c472e3c1 100644 --- a/source/core/Config.cpp +++ b/source/core/Config.cpp @@ -1,6 +1,11 @@ -#include <common\\AssotiativeArray.h> -#include <common\\String.cpp> +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + +#include <common/AssotiativeArray.h> +#include <common/String.cpp> #include "Config.h" /* diff --git a/source/core/Config.h b/source/core/Config.h index ad830a91de79fc9613c24a15ad5713ca2a1b3c66..c9af4da1cbe5ee2be67d5c8c6c2cd7b992c63780 100644 --- a/source/core/Config.h +++ b/source/core/Config.h @@ -1,6 +1,12 @@ -#ifndef LOADER_CONFIG_H -#define LOADER_CONFIG_H + +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + +#ifndef __LOADER_CONFIG_H +#define __LOADER_CONFIG_H #include "sxcore.h" #include <gdefines.h> diff --git a/source/core/File.h b/source/core/File.h index 5fcc73d9894e56294bc0f942b9908be6d5ea5476..40adcd7b9a380f28c5cf8ac38a9876eef2599f6e 100644 --- a/source/core/File.h +++ b/source/core/File.h @@ -1,4 +1,9 @@ +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #ifndef __FILE_H #define __FILE_H diff --git a/source/core/Task.cpp b/source/core/Task.cpp index f61b8437d12e75e74e4a57305595b66804dac255..3ae6527364ba442951bda0e811ce5370ddc692e1 100644 --- a/source/core/Task.cpp +++ b/source/core/Task.cpp @@ -1,4 +1,9 @@ +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include "task.h" CTask::CTask(THREAD_UPDATE_FUNCTION func,unsigned int flags) :m_iTaskFlags(flags) diff --git a/source/core/Task.h b/source/core/Task.h index 180ce2ab80a33c0f0e8e0711cf7223f46da6bb15..d9d8c2dc446a5e17e1f4b6e39922a22dc54aa7aa 100644 --- a/source/core/Task.h +++ b/source/core/Task.h @@ -1,5 +1,11 @@ -#ifndef _CTask_H_ -#define _CTask_H_ + +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + +#ifndef __TASK_H +#define __TASK_H #include "sxcore.h" #include <memory> diff --git a/source/core/TaskManager.cpp b/source/core/TaskManager.cpp index 24bfcbefc2bc19f8112281416be7b917bb6009b9..a47b67198a273ae58b64fc58074971753043a597 100644 --- a/source/core/TaskManager.cpp +++ b/source/core/TaskManager.cpp @@ -1,4 +1,10 @@ -#include <core\taskManager.h> + +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + +#include <core/taskManager.h> #if defined(_WINDOWS) void SetThreadName(DWORD dwThreadID, const char* threadName) diff --git a/source/core/TaskManager.h b/source/core/TaskManager.h index e573e618ffda1f0c62edf1fb29acd669c3c7ecee..7b27a37b8cd1fb0f15bcf0757b97a932f191d179 100644 --- a/source/core/TaskManager.h +++ b/source/core/TaskManager.h @@ -1,5 +1,11 @@ -#ifndef _SXTaskManager_H_ -#define _SXTaskManager_H_ + +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + +#ifndef __TASK_MANAGER_H +#define __TASK_MANAGER_H #include <memory> #include <thread> diff --git a/source/core/concmd.cpp b/source/core/concmd.cpp index 0615669994a0ffbd77f0041b09d967131456ac8d..0505613bf05d6a442cb54b9127811566f4acd00e 100644 --- a/source/core/concmd.cpp +++ b/source/core/concmd.cpp @@ -1,4 +1,9 @@ +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include "concmd.h" //#define WIN32_LEAN_AND_MEAN diff --git a/source/core/concmd.h b/source/core/concmd.h index 845eaa90d69900ee0996c5ddba07a990b791357a..5d972ff6448b9a695513643b8c8b24c680c5e37f 100644 --- a/source/core/concmd.h +++ b/source/core/concmd.h @@ -1,6 +1,11 @@ -#ifndef SXCONCMD_H -#define SXCONCMD_H +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + +#ifndef __CONCMD_H +#define __CONCMD_H #include "sxcore.h" #include <common/AssotiativeArray.h> diff --git a/source/core/cvars.cpp b/source/core/cvars.cpp index 0a46bac5e775badbf7d970f0098fd2488d02fdea..90f5185c1b4e2392380a152d1c7d1fa95f08f4a3 100644 --- a/source/core/cvars.cpp +++ b/source/core/cvars.cpp @@ -1,16 +1,19 @@ +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include "cvars.h" AssotiativeArray<String, CVar> g_mCVars; AssotiativeArray<String, CVarPtr> g_mCVarPtrs; -extern report_func g_fnReportf; - SX_LIB_API void Core_0RegisterCVarString(const char * name, const char * value, const char * desc, int flags) { if(g_mCVars.KeyExists(name)) { - g_fnReportf(REPORT_MSG_LEVEL_WARNING, "CVar '%s' already registered. Skipping.\n", name); + LibReport(REPORT_MSG_LEVEL_WARNING, "CVar '%s' already registered. Skipping.\n", name); return; } @@ -39,7 +42,7 @@ SX_LIB_API void Core_0RegisterCVarInt(const char * name, int value, const char * { if(g_mCVars.KeyExists(name)) { - g_fnReportf(REPORT_MSG_LEVEL_WARNING, "CVar '%s' already registered. Skipping.\n", name); + LibReport(REPORT_MSG_LEVEL_WARNING, "CVar '%s' already registered. Skipping.\n", name); return; } @@ -65,7 +68,7 @@ SX_LIB_API void Core_0RegisterCVarFloat(const char * name, float value, const ch { if(g_mCVars.KeyExists(name)) { - g_fnReportf(REPORT_MSG_LEVEL_WARNING, "CVar '%s' already registered. Skipping.\n", name); + LibReport(REPORT_MSG_LEVEL_WARNING, "CVar '%s' already registered. Skipping.\n", name); return; } @@ -90,7 +93,7 @@ SX_LIB_API void Core_0RegisterCVarBool(const char * name, bool value, const char { if(g_mCVars.KeyExists(name)) { - g_fnReportf(REPORT_MSG_LEVEL_WARNING, "CVar '%s' already registered. Skipping.\n", name); + LibReport(REPORT_MSG_LEVEL_WARNING, "CVar '%s' already registered. Skipping.\n", name); return; } @@ -116,7 +119,7 @@ SX_LIB_API void Core_0RegisterCVarPointer(const char * name, UINT_PTR value) { if(g_mCVarPtrs.KeyExists(name)) { - g_fnReportf(REPORT_MSG_LEVEL_WARNING, "CVar '%s' already registered. Skipping.\n", name); + LibReport(REPORT_MSG_LEVEL_WARNING, "CVar '%s' already registered. Skipping.\n", name); return; } diff --git a/source/core/cvars.h b/source/core/cvars.h index 6e61d75764ad09ecc2c28ceeac78d4f9b290b423..4249d5d9c7ea1c68ac15579e9c5b2bb5128e4b3a 100644 --- a/source/core/cvars.h +++ b/source/core/cvars.h @@ -1,6 +1,11 @@ -#ifndef SXCVARS_H -#define SXCVARS_H +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + +#ifndef __CVARS_H +#define __CVARS_H #include "sxcore.h" #include <common/AssotiativeArray.h> diff --git a/source/core/file.cpp b/source/core/file.cpp index 0d18ac4b4f0075ea2d8708f5dba3436909f5af8d..6f17f64e60393df174a2bc4691c006b812e73b5f 100644 --- a/source/core/file.cpp +++ b/source/core/file.cpp @@ -1,4 +1,9 @@ +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include "File.h" CFile::CFile() diff --git a/source/core/sxcore.cpp b/source/core/sxcore.cpp index 06b81a61491dc0eebb544da01506d115c42e74fa..81c9cdb7c3cb01445f1c5424923428938e3f81bd 100644 --- a/source/core/sxcore.cpp +++ b/source/core/sxcore.cpp @@ -1,8 +1,8 @@ -/****************************************************** -Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017 +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 See the license in LICENSE -******************************************************/ +***********************************************************/ #define CORE_VERSION 1 @@ -33,7 +33,7 @@ report_func g_fnReportf = DefReport; CTaskManager* g_pTaskManager = 0; -#define SXCORE_PRECOND(retval) if(!g_pTaskManager){g_fnReportf(REPORT_MSG_LEVEL_ERROR, "[SCORE]: %s - sxcore is not init", GEN_MSG_LOCATION); return retval;} +#define SXCORE_PRECOND(retval) if(!g_pTaskManager){LibReport(REPORT_MSG_LEVEL_ERROR, "%s - sxcore is not init", GEN_MSG_LOCATION); return retval;} //************************************************************************** @@ -47,12 +47,12 @@ String g_aGRegistersString[CORE_REGISTRY_SIZE]; #define CORE_REGUSTRY_PRE_COND_ID(id,stdval) \ if (!(id >= 0 && id < CORE_REGISTRY_SIZE))\ -{g_fnReportf(REPORT_MSG_LEVEL_ERROR, "%s: %s - unresolved index '%d' of access for registry", SX_LIB_NAME, GEN_MSG_LOCATION, id); return stdval; } +{LibReport(REPORT_MSG_LEVEL_ERROR, "%s: %s - unresolved index '%d' of access for registry", SX_LIB_NAME, GEN_MSG_LOCATION, id); return stdval; } //************************************************************************** CTimeManager* g_pTimers = 0; -#define CORE_TIME_PRECOND(retval) if(!g_pTimers){g_fnReportf(REPORT_MSG_LEVEL_ERROR, "%s: %s - sxcore is not init", SX_LIB_NAME, GEN_MSG_LOCATION); return retval;} +#define CORE_TIME_PRECOND(retval) if(!g_pTimers){LibReport(REPORT_MSG_LEVEL_ERROR, "%s - sxcore is not init", GEN_MSG_LOCATION); return retval;} //########################################################################## @@ -154,7 +154,7 @@ void Core_0Create(const char* name, bool is_unic) if(GetLastError() == ERROR_ALREADY_EXISTS) { CloseHandle(hMutex); - g_fnReportf(REPORT_MSG_LEVEL_ERROR, "[SCORE]: %s - none unic name, score", GEN_MSG_LOCATION); + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - none unic name", GEN_MSG_LOCATION); return; } } @@ -164,10 +164,10 @@ void Core_0Create(const char* name, bool is_unic) g_pTaskManager = new CTaskManager(); g_pTimers = new CTimeManager(); - //g_fnReportf(REPORT_MSG_LEVEL_NOTICE, "[SCORE]: is init\n"); + //LibReport(REPORT_MSG_LEVEL_NOTICE, "is init\n"); } else - g_fnReportf(REPORT_MSG_LEVEL_ERROR, "[SCORE]: %s - not init argument [name], score", GEN_MSG_LOCATION); + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - not init argument [name]", GEN_MSG_LOCATION); } void Core_AKill() @@ -186,7 +186,7 @@ void Core_AGetName(char* name) if(name) strcpy(name, g_szCoreName); else - g_fnReportf(REPORT_MSG_LEVEL_ERROR, "[SCORE]: %s - invalid argument", GEN_MSG_LOCATION); + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - invalid argument", GEN_MSG_LOCATION); } //########################################################################## diff --git a/source/core/sxcore.h b/source/core/sxcore.h index 05863208426ee0b9190d6693730c6429e6b6329b..07400a220434908a592eacfc4ce5a7028e319c89 100644 --- a/source/core/sxcore.h +++ b/source/core/sxcore.h @@ -1,8 +1,8 @@ -/****************************************************** -Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017 +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 See the license in LICENSE -******************************************************/ +***********************************************************/ /*! \file @@ -19,9 +19,6 @@ See the license in LICENSE #include <fstream> #include <gdefines.h> -//! имя библиотеки -#define SX_LIB_NAME COLOR_BG_WHITE COLOR_GREEN "CORE" COLOR_RESET - #undef SX_LIB_API #define SX_LIB_API extern "C" __declspec (dllexport) @@ -30,7 +27,7 @@ See the license in LICENSE #include <tlhelp32.h> #define SM_D3D_CONVERSIONS -#include <common\sxmath.h> +#include <common/sxmath.h> //! тип функции для обработки в менеджере задач typedef void(*THREAD_UPDATE_FUNCTION)(); diff --git a/source/core/sxcore_dll.cpp b/source/core/sxcore_dll.cpp index 3083cfd697aec8a162b88cf7a1af1f5333f76cfa..5a6ed8653edb5b2a74cc931be9df537123124295 100644 --- a/source/core/sxcore_dll.cpp +++ b/source/core/sxcore_dll.cpp @@ -1,8 +1,8 @@ -/****************************************************** -Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017 +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 See the license in LICENSE -******************************************************/ +***********************************************************/ #define WIN32_LEAN_AND_MEAN #include <windows.h> diff --git a/source/core/time.cpp b/source/core/time.cpp index e9662a7a760d9ddb6a36cec858855d988f20b913..46ab60e2a5f446ca2b0cf2cbba17dac3ac2bb505 100644 --- a/source/core/time.cpp +++ b/source/core/time.cpp @@ -1,4 +1,9 @@ +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include "Time.h" CTimeManager::CTimeManager() diff --git a/source/core/time.h b/source/core/time.h index 613bb4ee1e33cfac2d075bb16a839b7e8924af43..f91bc1fd26f7421b0f4cac43341e699727d92a46 100644 --- a/source/core/time.h +++ b/source/core/time.h @@ -1,9 +1,13 @@ +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #ifndef __TIME_H #define __TIME_H #include <gdefines.h> -extern report_func g_fnReportf; #include <common/Array.h> @@ -14,7 +18,7 @@ typedef std::chrono::system_clock::time_point time_point; #define TIMEMANAGER_PRECOND_ID(id,stdval) \ if (!(id >= 0 && id < m_aTimes.size()))\ -{g_fnReportf(REPORT_MSG_LEVEL_ERROR, "%s: %s - time manager: unresolved index of access '%d'", SX_LIB_NAME, GEN_MSG_LOCATION, id); return stdval; } +{LibReport(REPORT_MSG_LEVEL_ERROR, "%s - time manager: unresolved index of access '%d'", GEN_MSG_LOCATION, id); return stdval; } class CTimeManager { diff --git a/source/decals/DecalManager.cpp b/source/decals/DecalManager.cpp index 6d9c91b04fcdb04db6ded0424c92ad665bd1bb83..d5e3833bc4d7ba383c259a2340a56401881a36c0 100644 --- a/source/decals/DecalManager.cpp +++ b/source/decals/DecalManager.cpp @@ -1,11 +1,15 @@ + +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include <core/sxcore.h> #include <gcore/sxgcore.h> #include <physics/sxphysics.h> #include "DecalManager.h" -extern report_func reportf; - // Array<float3_t> g_dbgDraw; // float4 spherePos; @@ -35,12 +39,12 @@ DecalManager::DecalManager(): { if(id < 0 || id >= DECAL_TYPE_LAST) { - reportf(REPORT_MSG_LEVEL_WARNING, "Incorrect decal type id '%s'\n", sect); + LibReport(REPORT_MSG_LEVEL_WARNING, "Incorrect decal type id '%s'\n", sect); } } else { - reportf(REPORT_MSG_LEVEL_WARNING, "Unable to read decal id '%s'\n", sect); + LibReport(REPORT_MSG_LEVEL_WARNING, "Unable to read decal id '%s'\n", sect); continue; } const char * tex; @@ -50,14 +54,14 @@ DecalManager::DecalManager(): } else { - reportf(REPORT_MSG_LEVEL_WARNING, "Unable to read decal tex '%s'\n", sect); + LibReport(REPORT_MSG_LEVEL_WARNING, "Unable to read decal tex '%s'\n", sect); continue; } if(config->keyExists(sect, "base_scale")) { if(!sscanf(config->getKey(sect, "base_scale"), "%f", &m_DecalTypes[id].m_fBaseScale)) { - reportf(REPORT_MSG_LEVEL_WARNING, "Unable to read decal base_scale '%s'\n", sect); + LibReport(REPORT_MSG_LEVEL_WARNING, "Unable to read decal base_scale '%s'\n", sect); m_DecalTypes[id].m_fBaseScale = 1.0f; } } diff --git a/source/decals/DecalManager.h b/source/decals/DecalManager.h index 3944f24be931de1f7293e802e515bf4d115f1be0..f150cc1da3652d6728d06555a68321b71714a390 100644 --- a/source/decals/DecalManager.h +++ b/source/decals/DecalManager.h @@ -1,5 +1,11 @@ -#ifndef _DecalManager_H_ -#define _DecalManager_H_ + +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + +#ifndef __DECAL_MANAGER_H +#define __DECAL_MANAGER_H #include <gdefines.h> #include <common/SXMath.h> diff --git a/source/decals/sxdecals.h b/source/decals/sxdecals.h index bd7529ebab9aa783cbf7b084c1c05b9ea9ad38f6..a2690ff35d416c257847a3c809899d0fa6750109 100644 --- a/source/decals/sxdecals.h +++ b/source/decals/sxdecals.h @@ -1,8 +1,8 @@ -/****************************************************** -Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017 +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 See the license in LICENSE -******************************************************/ +***********************************************************/ /*! \file @@ -28,7 +28,7 @@ See the license in LICENSE #undef SX_LIB_API #define SX_LIB_API extern "C" __declspec (dllimport) -#include <mtllight\\sxmtllight.h> +#include <mtllight/sxmtllight.h> #ifdef SX_DLL #undef SX_LIB_API diff --git a/source/decals/sxdecals_dll.cpp b/source/decals/sxdecals_dll.cpp index 2b077d2f2abf6b0c3e73244e2ad8581ad7878906..e5df4a4087dace7bd929e4e83b21addcb753a4b2 100644 --- a/source/decals/sxdecals_dll.cpp +++ b/source/decals/sxdecals_dll.cpp @@ -1,8 +1,8 @@ -/****************************************************** -Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017 +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 See the license in LICENSE -******************************************************/ +***********************************************************/ #define WIN32_LEAN_AND_MEAN #include <windows.h> @@ -24,12 +24,12 @@ See the license in LICENSE #if !defined(DEF_STD_REPORT) #define DEF_STD_REPORT -report_func reportf = DefReport; +report_func g_fnReportf = DefReport; #endif DecalManager * g_pMgr = NULL; -#define SP_PRECOND(ret) if(!g_pMgr){reportf(-1, "%s - sxdecals is not init", GEN_MSG_LOCATION);return ret;} +#define SP_PRECOND(ret) if(!g_pMgr){LibReport(REPORT_MSG_LEVEL_ERROR, "%s - sxdecals is not init", GEN_MSG_LOCATION);return ret;} BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, @@ -51,7 +51,7 @@ SX_LIB_API void SXDecals_0Create() { if(g_pMgr) { - reportf(-1, "%s - sxdecals double init", GEN_MSG_LOCATION); + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - sxdecals double init", GEN_MSG_LOCATION); return; } Core_SetOutPtr(); @@ -78,7 +78,7 @@ SX_LIB_API void SXDecals_Sync() SX_LIB_API void SXDecals_Dbg_Set(report_func rf) { - reportf = rf; + g_fnReportf = rf; } SX_LIB_API void SXDecals_Render() @@ -92,7 +92,7 @@ SX_LIB_API void SXDecals_ShootDecal(DECAL_TYPE type, const float3 & fWorldPos, c SP_PRECOND(_VOID); if(type == DECAL_TYPE_CUSTOM) { - reportf(REPORT_MSG_LEVEL_WARNING, "Unable to use DECAL_TYPE_CUSTOM with SXDecals_ShootDecal\n"); + LibReport(REPORT_MSG_LEVEL_WARNING, "Unable to use DECAL_TYPE_CUSTOM with SXDecals_ShootDecal\n"); return; } g_pMgr->shootDecal(type, fWorldPos, 0, 0, 0, 1.0f, 0, &normal); diff --git a/source/editors_utils/axes_helper.cpp b/source/editors_utils/axes_helper.cpp index 6618e603524b4e5ef19fc038ae50592afb324251..30b3f1069fd33fc8de255d8c9fb22715f84727a1 100644 --- a/source/editors_utils/axes_helper.cpp +++ b/source/editors_utils/axes_helper.cpp @@ -1,4 +1,9 @@ +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include "axes_helper.h" AxesHelper::AxesHelper() diff --git a/source/editors_utils/axes_helper.h b/source/editors_utils/axes_helper.h index 7521b323b6b1d315e0cf6c894a114d1537d544a6..561d46735c4a5692f7510857416e339ef12c282a 100644 --- a/source/editors_utils/axes_helper.h +++ b/source/editors_utils/axes_helper.h @@ -1,6 +1,11 @@ -#ifndef axes_helper_h -#define axes_helper_h +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + +#ifndef __AXES_HELPER_H +#define __AXES_HELPER_H #include <windows.h> #include <common/sxtypes.h> diff --git a/source/game/BaseAmmo.cpp b/source/game/BaseAmmo.cpp index 49de3f3b78639c53e75dd4c8980d29409150df54..aaa93334c029531f19c84bc3ed45fd396b022c4e 100644 --- a/source/game/BaseAmmo.cpp +++ b/source/game/BaseAmmo.cpp @@ -1,3 +1,9 @@ + +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include "BaseAmmo.h" /*! \skydocent base_ammo diff --git a/source/game/BaseAmmo.h b/source/game/BaseAmmo.h index 1ffa8be98fec833c66d0bef39a6bfc17a53f2bf3..cb706c3bb1c59d4cb26f5e6384d5ce17d92a26d7 100644 --- a/source/game/BaseAmmo.h +++ b/source/game/BaseAmmo.h @@ -1,15 +1,16 @@ -/****************************************************** -Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017 + +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 See the license in LICENSE -******************************************************/ +***********************************************************/ /*! \file Патроны */ -#ifndef _CBaseAmmo_H_ -#define _CBaseAmmo_H_ +#ifndef __BASE_AMMO_H +#define __BASE_AMMO_H #include "BaseSupply.h" diff --git a/source/game/BaseAmmoBox.cpp b/source/game/BaseAmmoBox.cpp index 5be0609c3dd4835a34facc832c6e9cf28d6a0627..fd883bf2d88409f74b4eb96c3068e8fb56e139d7 100644 --- a/source/game/BaseAmmoBox.cpp +++ b/source/game/BaseAmmoBox.cpp @@ -1,3 +1,9 @@ + +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include "BaseAmmoBox.h" /*! \skydocent base_ammobox diff --git a/source/game/BaseAmmoBox.h b/source/game/BaseAmmoBox.h index db3f28fd63a7536c12ed1c0ee6e3a3fedc52bd5f..c0420d8832aab4435bd2cfafb7d0ddd2a2ae062f 100644 --- a/source/game/BaseAmmoBox.h +++ b/source/game/BaseAmmoBox.h @@ -1,15 +1,16 @@ -/****************************************************** -Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017 + +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 See the license in LICENSE -******************************************************/ +***********************************************************/ /*! \file Аммобокс */ -#ifndef _CBaseAmmoBox_H_ -#define _CBaseAmmoBox_H_ +#ifndef __BASE_AMMO_BOX_H +#define __BASE_AMMO_BOX_H #include "BaseItem.h" diff --git a/source/game/BaseAnimating.cpp b/source/game/BaseAnimating.cpp index 84c15d366bd16de4f1a894a44b6ce9f69a55046a..2b4c0ec1ea71f11ed418ed363193e4673f37303f 100644 --- a/source/game/BaseAnimating.cpp +++ b/source/game/BaseAnimating.cpp @@ -1,3 +1,9 @@ + +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include "BaseAnimating.h" #include "gcore/sxgcore.h" @@ -37,7 +43,7 @@ void CBaseAnimating::getMinMax(float3 * min, float3 * max) if (m_pAnimPlayer) { const ISXBound * bound = m_pAnimPlayer->getBound(); - bound->GetMinMax(min, max); + bound->getMinMax(min, max); } } @@ -46,7 +52,7 @@ void CBaseAnimating::getSphere(float3 * center, float * radius) if(m_pAnimPlayer) { const ISXBound * bound = m_pAnimPlayer->getBound(); - bound->GetSphere(center, radius); + bound->getSphere(center, radius); } } diff --git a/source/game/BaseAnimating.h b/source/game/BaseAnimating.h index 58f339125f67d325776cf89135bae727b30eb8a9..289d4e76eff114ffeed167a1d598b6b97882408e 100644 --- a/source/game/BaseAnimating.h +++ b/source/game/BaseAnimating.h @@ -1,8 +1,8 @@ -/****************************************************** -Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017 +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 See the license in LICENSE -******************************************************/ +***********************************************************/ /*! \file @@ -14,8 +14,8 @@ See the license in LICENSE @{ */ -#ifndef _CBaseAnimating_H_ -#define _CBaseAnimating_H_ +#ifndef __BASE_ANIMATING_H +#define __BASE_ANIMATING_H #include "BaseEntity.h" #include <anim/sxanim.h> diff --git a/source/game/BaseCharacter.cpp b/source/game/BaseCharacter.cpp index 0ee51d3d0a981f9678a68c26a05190ffeb4a6465..3508cbb84212df7d928f9a919aa00fc9cd26cbc8 100644 --- a/source/game/BaseCharacter.cpp +++ b/source/game/BaseCharacter.cpp @@ -1,4 +1,9 @@ +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include "BaseCharacter.h" #include "GameData.h" #include "BaseTool.h" diff --git a/source/game/BaseCharacter.h b/source/game/BaseCharacter.h index 51609b515df0268e192de731d013c46e81a78925..75009b2227652466018bbaa3c3905d605def8565 100644 --- a/source/game/BaseCharacter.h +++ b/source/game/BaseCharacter.h @@ -1,8 +1,8 @@ -/****************************************************** -Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017 +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 See the license in LICENSE -******************************************************/ +***********************************************************/ /*! \file @@ -13,8 +13,8 @@ See the license in LICENSE @{ */ -#ifndef _CBaseCharacter_H_ -#define _CBaseCharacter_H_ +#ifndef __BASE_CHARACTER_H +#define __BASE_CHARACTER_H #include "BaseAnimating.h" #include "LightDirectional.h" diff --git a/source/game/BaseEntity.cpp b/source/game/BaseEntity.cpp index a8f3613c12a964329050d09a49e8bf961f613742..40ddce8f216415e8caaa7aeece3d4b7ada2bf672 100644 --- a/source/game/BaseEntity.cpp +++ b/source/game/BaseEntity.cpp @@ -1,3 +1,9 @@ + +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include <stdio.h> #include "BaseEntity.h" diff --git a/source/game/BaseEntity.h b/source/game/BaseEntity.h index d926c8b9e50375c58b5a71461467f75fd9474d9a..30a24e916c72538c7d2d53f39b0721f08426bc2e 100644 --- a/source/game/BaseEntity.h +++ b/source/game/BaseEntity.h @@ -1,8 +1,8 @@ -/****************************************************** -Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017 +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 See the license in LICENSE -******************************************************/ +***********************************************************/ /*! \file @@ -15,8 +15,8 @@ See the license in LICENSE @{ */ -#ifndef _CBaseEntity_H_ -#define _CBaseEntity_H_ +#ifndef __BASE_ENTITY_H +#define __BASE_ENTITY_H #include <gdefines.h> #include <common/SXMath.h> diff --git a/source/game/BaseHandle.cpp b/source/game/BaseHandle.cpp index efb909328be71f41b62d6dc11e672e46608e7734..ab4abe1a7b9c3e13ff6036e83f9c809c5351cfa4 100644 --- a/source/game/BaseHandle.cpp +++ b/source/game/BaseHandle.cpp @@ -1,3 +1,9 @@ + +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include "BaseHandle.h" /*! \skydocent base_handle diff --git a/source/game/BaseHandle.h b/source/game/BaseHandle.h index c9a074a568c6f391130246a161ea4f2a38495ac6..398a5ebb34c482fbfa52fbbc014b00c342a785d2 100644 --- a/source/game/BaseHandle.h +++ b/source/game/BaseHandle.h @@ -1,15 +1,16 @@ -/****************************************************** -Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017 + +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 See the license in LICENSE -******************************************************/ +***********************************************************/ /*! \file Ручки */ -#ifndef _BaseHandle_H_ -#define _BaseHandle_H_ +#ifndef __BASE_HANDLE_H +#define __BASE_HANDLE_H #include "BaseWeaponAddon.h" diff --git a/source/game/BaseItem.cpp b/source/game/BaseItem.cpp index 513e651f96da41e41ec5145c9f901e908682c21d..572fc841474494a7f40c0ea2a6eac822fc168126 100644 --- a/source/game/BaseItem.cpp +++ b/source/game/BaseItem.cpp @@ -1,3 +1,9 @@ + +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include "BaseItem.h" /*! \skydocent base_item diff --git a/source/game/BaseItem.h b/source/game/BaseItem.h index dbe03a4d18a3730ce0dfc305faf3464a637625dc..41578c679ee3d9084b932adbd30964d9aad2576c 100644 --- a/source/game/BaseItem.h +++ b/source/game/BaseItem.h @@ -1,7 +1,8 @@ -/****************************************************** -Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017 + +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 See the license in LICENSE -******************************************************/ +***********************************************************/ /*! \file @@ -13,8 +14,8 @@ See the license in LICENSE @{ */ -#ifndef _CBaseItem_H_ -#define _CBaseItem_H_ +#ifndef __BASE_ITEM_H +#define __BASE_ITEM_H #include "BaseAnimating.h" diff --git a/source/game/BaseMag.cpp b/source/game/BaseMag.cpp index b39261340bd5262e29bb1d172b69d9ae086f6cf2..89a969c8f2762df00c9fb997fab3042e891a9096 100644 --- a/source/game/BaseMag.cpp +++ b/source/game/BaseMag.cpp @@ -1,3 +1,9 @@ + +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include "BaseMag.h" /*! \skydocent base_mag diff --git a/source/game/BaseMag.h b/source/game/BaseMag.h index b252f743db9fe82c6f6528ee265451a3c66633f3..aae2f46e12b3deac565ddf9620dc0cb8f6f41dc9 100644 --- a/source/game/BaseMag.h +++ b/source/game/BaseMag.h @@ -1,15 +1,16 @@ -/****************************************************** -Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017 + +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 See the license in LICENSE -******************************************************/ +***********************************************************/ /*! \file Магазины */ -#ifndef _BaseMag_H_ -#define _BaseMag_H_ +#ifndef __BASE_MAG_H +#define __BASE_MAG_H #include "BaseWeaponAddon.h" diff --git a/source/game/BasePistol.h b/source/game/BasePistol.h index 4cb5683d626435f88c556bcf196dc9cb604e2ac3..e8f0c76ca4d84a26e30ded4667cd534ee56ce2ac 100644 --- a/source/game/BasePistol.h +++ b/source/game/BasePistol.h @@ -1,15 +1,16 @@ -/****************************************************** -Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017 + +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 See the license in LICENSE -******************************************************/ +***********************************************************/ /*! \file Пистолеты */ -#ifndef _CBasePistol_H_ -#define _CBasePistol_H_ +#ifndef __BASE_PISTOL_H +#define __BASE_PISTOL_H /*! Пистолеты \ingroup cbaseitem diff --git a/source/game/BaseRiffle.cpp b/source/game/BaseRiffle.cpp index 7a60a011dc32c57cdeb17f24078a59959a987ce9..5ed27da464e031d7314b27c643591b28f7013416 100644 --- a/source/game/BaseRiffle.cpp +++ b/source/game/BaseRiffle.cpp @@ -1,3 +1,9 @@ + +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include "BaseRiffle.h" /*! \skydocent base_riffle diff --git a/source/game/BaseRiffle.h b/source/game/BaseRiffle.h index 8be69ac536b64429b888cb52422fa69a867c9543..dc9d1bbcb638c198cb6c9e810aeaa9d12b3d9b13 100644 --- a/source/game/BaseRiffle.h +++ b/source/game/BaseRiffle.h @@ -1,15 +1,16 @@ -/****************************************************** -Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017 + +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 See the license in LICENSE -******************************************************/ +***********************************************************/ /*! \file Винтовки */ -#ifndef _CBaseRiffle_H_ -#define _CBaseRiffle_H_ +#ifndef __BASE_RIFFLE_H +#define __BASE_RIFFLE_H #include "BaseWeapon.h" diff --git a/source/game/BaseScope.cpp b/source/game/BaseScope.cpp index 26e8b012e2b3f274e9a6d51782b06c9224d994a1..05539b6b22da50ea9022562db0583022f8436cd5 100644 --- a/source/game/BaseScope.cpp +++ b/source/game/BaseScope.cpp @@ -1,3 +1,9 @@ + +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include "BaseScope.h" /*! \skydocent base_scope diff --git a/source/game/BaseScope.h b/source/game/BaseScope.h index f581e5da953629a51f1bdd572d390a06aa0371a8..5981a58cb85acf2f23e30e7308af1c112117defb 100644 --- a/source/game/BaseScope.h +++ b/source/game/BaseScope.h @@ -1,15 +1,16 @@ -/****************************************************** -Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017 + +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 See the license in LICENSE -******************************************************/ +***********************************************************/ /*! \file Прицелы */ -#ifndef _BaseScope_H_ -#define _BaseScope_H_ +#ifndef __BASE_SCOPE_H +#define __BASE_SCOPE_H #include "BaseWeaponAddon.h" diff --git a/source/game/BaseSilencer.cpp b/source/game/BaseSilencer.cpp index e73175deffea836e4897eda91ec32c2b26cf25fc..946fb65908ae930c425ced7a31ca8a4f486fc4e3 100644 --- a/source/game/BaseSilencer.cpp +++ b/source/game/BaseSilencer.cpp @@ -1,3 +1,9 @@ + +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include "BaseSilencer.h" /*! \skydocent base_silencer diff --git a/source/game/BaseSilencer.h b/source/game/BaseSilencer.h index 3eeb73e447d13daf341ec53b125c6f15ff1d6387..a57cb8ac2f7315c90dc96a5206ac9adf62b487b8 100644 --- a/source/game/BaseSilencer.h +++ b/source/game/BaseSilencer.h @@ -1,15 +1,16 @@ -/****************************************************** -Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017 + +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 See the license in LICENSE -******************************************************/ +***********************************************************/ /*! \file Глушители */ -#ifndef _BaseSilencer_H_ -#define _BaseSilencer_H_ +#ifndef __BASE_SILENCER_H +#define __BASE_SILENCER_H #include "BaseWeaponAddon.h" diff --git a/source/game/BaseSupply.cpp b/source/game/BaseSupply.cpp index e205da0e0e3bd0cf16b4f79a35fc51dfaf56f825..9583ea598bbeadfc6d76d81e0b75023de9b2dbb7 100644 --- a/source/game/BaseSupply.cpp +++ b/source/game/BaseSupply.cpp @@ -1,3 +1,9 @@ + +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include "BaseSupply.h" /*! \skydocent base_supply diff --git a/source/game/BaseSupply.h b/source/game/BaseSupply.h index 7b25b940b86952eb5d089c08dd97f2fda53f3495..e95af1a0a51010261e3da8ccf5525fabb69e4427 100644 --- a/source/game/BaseSupply.h +++ b/source/game/BaseSupply.h @@ -1,15 +1,16 @@ -/****************************************************** -Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017 + +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 See the license in LICENSE -******************************************************/ +***********************************************************/ /*! \file Базовый класс припаса */ -#ifndef _CBaseSupply_H_ -#define _CBaseSupply_H_ +#ifndef __BASE_SUPPLY_H +#define __BASE_SUPPLY_H #include "BaseItem.h" diff --git a/source/game/BaseTool.cpp b/source/game/BaseTool.cpp index f319ab17618f460c2d8e052eb5d9977ae0c32f60..13eab5f9249adb5262a1ed6708675f98b3f88349 100644 --- a/source/game/BaseTool.cpp +++ b/source/game/BaseTool.cpp @@ -1,3 +1,9 @@ + +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include "BaseTool.h" #include <particles/sxparticles.h> @@ -265,7 +271,7 @@ void CBaseTool::_rezoom() m_qSlotRotResult = SMquaternionSlerp(m_qSlotRot, m_qSlotRotAim, m_fZoomProgress); if(m_pOwner) { - ((CPlayer*)m_pOwner)->getCamera()->getCamera()->SetFOV(SMToRadian(vlerp(*r_default_fov, *r_default_fov - 10.0f, m_fZoomProgress))); + ((CPlayer*)m_pOwner)->getCamera()->getCamera()->setFOV(SMToRadian(vlerp(*r_default_fov, *r_default_fov - 10.0f, m_fZoomProgress))); } } diff --git a/source/game/BaseTool.h b/source/game/BaseTool.h index b443fe1a82ae7c9039f81341b1836299365041d6..18b2e0cf65f76d6d8caa87f2e23bdc398b53163d 100644 --- a/source/game/BaseTool.h +++ b/source/game/BaseTool.h @@ -1,15 +1,16 @@ -/****************************************************** -Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017 + +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 See the license in LICENSE -******************************************************/ +***********************************************************/ /*! \file Базовый класс инструмента */ -#ifndef _CBaseTool_H_ -#define _CBaseTool_H_ +#ifndef __BASE_TOOL_H +#define __BASE_TOOL_H #include "BaseItem.h" #include <score/sxscore.h> diff --git a/source/game/BaseTrigger.cpp b/source/game/BaseTrigger.cpp index 7b7d8a89420492ee13242a90609743fc153257cf..b73b78ddb0f085e2e52ee76c45f74db94c5452f4 100644 --- a/source/game/BaseTrigger.cpp +++ b/source/game/BaseTrigger.cpp @@ -1,3 +1,9 @@ + +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include <gcore/sxgcore.h> #include "BaseTrigger.h" diff --git a/source/game/BaseTrigger.h b/source/game/BaseTrigger.h index be7e9c5d568d50ab12616bf50eacbd0aeffb4d1c..722df46cf3b55c4739fd4b4a05df275d7ec618ae 100644 --- a/source/game/BaseTrigger.h +++ b/source/game/BaseTrigger.h @@ -1,8 +1,8 @@ -/****************************************************** -Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017 +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 See the license in LICENSE -******************************************************/ +***********************************************************/ /*! \file @@ -14,8 +14,8 @@ See the license in LICENSE @{ */ -#ifndef _BaseTrigger_H_ -#define _BaseTrigger_H_ +#ifndef __BASE_TRIGGER_H +#define __BASE_TRIGGER_H #include "BaseAnimating.h" diff --git a/source/game/BaseWeapon.cpp b/source/game/BaseWeapon.cpp index c69fa94b80cd653c60bc589250392915f8ceca6e..9dc7dd01ef53a8ad03e6b1d9b8b7ef170ba8cb74 100644 --- a/source/game/BaseWeapon.cpp +++ b/source/game/BaseWeapon.cpp @@ -1,4 +1,9 @@ +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include <particles/sxparticles.h> #include "BaseWeapon.h" #include "Player.h" diff --git a/source/game/BaseWeapon.h b/source/game/BaseWeapon.h index 91ae59b8b1633d22c062f748d032372c49868257..0092c51a2ae0441c0f6f8ccdaf99fafe18d57a17 100644 --- a/source/game/BaseWeapon.h +++ b/source/game/BaseWeapon.h @@ -1,15 +1,16 @@ -/****************************************************** -Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017 + +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 See the license in LICENSE -******************************************************/ +***********************************************************/ /*! \file Базовый класс оружия */ -#ifndef _CBaseWeapon_H_ -#define _CBaseWeapon_H_ +#ifndef __BASE_WEAPON_H +#define __BASE_WEAPON_H #include "BaseTool.h" diff --git a/source/game/BaseWeaponAddon.cpp b/source/game/BaseWeaponAddon.cpp index 26fe086f971fc15067a52fd317129d73586b2b26..03e94db9ff4e3bceecacd595ab4ec7e9b2e8971c 100644 --- a/source/game/BaseWeaponAddon.cpp +++ b/source/game/BaseWeaponAddon.cpp @@ -1,3 +1,9 @@ + +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include "BaseWeaponAddon.h" /*! \skydocent base_wpn_addon diff --git a/source/game/BaseWeaponAddon.h b/source/game/BaseWeaponAddon.h index 6521d8abcf9b5c0dbfb4aeeea5a310274908edee..5d3922b21c39facd9410ee4523ca34d322d5a7c9 100644 --- a/source/game/BaseWeaponAddon.h +++ b/source/game/BaseWeaponAddon.h @@ -1,15 +1,16 @@ -/****************************************************** -Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017 + +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 See the license in LICENSE -******************************************************/ +***********************************************************/ /*! \file Навесы */ -#ifndef _BaseWeaponAddon_H_ -#define _BaseWeaponAddon_H_ +#ifndef __BASE_WEAPON_ADDON_H +#define __BASE_WEAPON_ADDON_H #include "BaseItem.h" diff --git a/source/game/CrosshairManager.cpp b/source/game/CrosshairManager.cpp index 3275b81a1082952ff507950ad908789e651544a6..8f7c5d774fd237dc51162de7f67bbc93411d4933 100644 --- a/source/game/CrosshairManager.cpp +++ b/source/game/CrosshairManager.cpp @@ -1,11 +1,14 @@ +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include "CrosshairManager.h" AssotiativeArray<AAString, ID> CCrosshairManager::m_mIndex; Array<CCrosshairManager::CrosshairDesc> CCrosshairManager::m_vCrosshairList; -extern report_func reportf; - void CCrosshairManager::loadCrosshair(ID id, CCrosshair * pCCrosshair) { if(id < 0 || id >= (ID)m_vCrosshairList.size()) @@ -79,7 +82,7 @@ void CCrosshairManager::loadConfig(const char * szFile) } else { - reportf(REPORT_MSG_LEVEL_WARNING, "Unknown CCrosshair style '%s' for '%s'\n", str, sect); + LibReport(REPORT_MSG_LEVEL_WARNING, "Unknown CCrosshair style '%s' for '%s'\n", str, sect); continue; } @@ -87,11 +90,11 @@ void CCrosshairManager::loadConfig(const char * szFile) if(config->keyExists(sect, "tex")) { tex = config->getKey(sect, "tex"); - cd.idTexture = SGCore_LoadTexAddName(tex, ltt_const); + cd.idTexture = SGCore_LoadTexAddName(tex, LOAD_TEXTURE_TYPE_CONST); } else { - reportf(REPORT_MSG_LEVEL_WARNING, "Unable to read CCrosshair tex '%s'\n", sect); + LibReport(REPORT_MSG_LEVEL_WARNING, "Unable to read CCrosshair tex '%s'\n", sect); continue; } int x, y; @@ -101,7 +104,7 @@ void CCrosshairManager::loadConfig(const char * szFile) } else { - reportf(REPORT_MSG_LEVEL_WARNING, "Unable to read CCrosshair tex_offset '%s'. Expected format: '[x,y]'\n", sect); + LibReport(REPORT_MSG_LEVEL_WARNING, "Unable to read CCrosshair tex_offset '%s'. Expected format: '[x,y]'\n", sect); continue; } if(config->keyExists(sect, "tex_size") && sscanf(config->getKey(sect, "tex_size"), "[%d,%d]", &x, &y) == 2) @@ -110,7 +113,7 @@ void CCrosshairManager::loadConfig(const char * szFile) } else { - reportf(REPORT_MSG_LEVEL_WARNING, "Unable to read CCrosshair tex_size '%s'. Expected format: '[x,y]'\n", sect); + LibReport(REPORT_MSG_LEVEL_WARNING, "Unable to read CCrosshair tex_size '%s'. Expected format: '[x,y]'\n", sect); continue; } AAString aas; diff --git a/source/game/CrosshairManager.h b/source/game/CrosshairManager.h index 62a775e0c131874ec0efc7b7882b5c39a856c63b..dfa6f6a54a88571f8e9303bd8fe939b860aa4b5c 100644 --- a/source/game/CrosshairManager.h +++ b/source/game/CrosshairManager.h @@ -1,5 +1,11 @@ -#ifndef _CROSSHAIRMANAGER_H -#define _CROSSHAIRMANAGER_H + +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + +#ifndef __CROSSHAIRMANAGER_H +#define __CROSSHAIRMANAGER_H #include "sxgame.h" #include <common/AssotiativeArray.h> diff --git a/source/game/EntityFactory.cpp b/source/game/EntityFactory.cpp index c0be706e360f81b950fd5875b7b982d6be2903a5..c0310ad3bbde27bf34cda930f47ed9cb87c6a4b4 100644 --- a/source/game/EntityFactory.cpp +++ b/source/game/EntityFactory.cpp @@ -1,3 +1,9 @@ + +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include "EntityFactory.h" #include "BaseEntity.h" diff --git a/source/game/EntityFactory.h b/source/game/EntityFactory.h index 2ba5cd2282a395eb59a0002e8acaee67c8544140..b0b4352cfbf90cf41ed8dfc2f86746699607959e 100644 --- a/source/game/EntityFactory.h +++ b/source/game/EntityFactory.h @@ -1,5 +1,11 @@ -#ifndef _CEntityFactory_H_ -#define _CEntityFactory_H_ + +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + +#ifndef __ENTITY_FACTORY_H +#define __ENTITY_FACTORY_H #include <gdefines.h> #include <common/AssotiativeArray.h> diff --git a/source/game/EntityManager.cpp b/source/game/EntityManager.cpp index dd55b14b9b27d9c2ce40352a4f5a7699e3a711b3..a697746239057bca56a24eaf442cc4bd4690e035 100644 --- a/source/game/EntityManager.cpp +++ b/source/game/EntityManager.cpp @@ -1,3 +1,9 @@ + +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include "EntityManager.h" #include "BaseEntity.h" diff --git a/source/game/EntityManager.h b/source/game/EntityManager.h index 34671f774f1c35e6984e379f71bb29d26050e9fd..5cf8ef14709ef88c6bd098e7ee73abd6be7885ba 100644 --- a/source/game/EntityManager.h +++ b/source/game/EntityManager.h @@ -1,5 +1,11 @@ -#ifndef _ENTITY_MANAGER_H_ -#define _ENTITY_MANAGER_H_ + +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + +#ifndef __ENTITY_MANAGER_H +#define __ENTITY_MANAGER_H /*! \file */ diff --git a/source/game/FuncTrain.cpp b/source/game/FuncTrain.cpp index 4b238b01628615fcde604b9caad9fc3438a42e4a..3672ead800612badcbea3b249b77883f0ade1e13 100644 --- a/source/game/FuncTrain.cpp +++ b/source/game/FuncTrain.cpp @@ -1,3 +1,9 @@ + +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include "FuncTrain.h" #include "PathCorner.h" diff --git a/source/game/FuncTrain.h b/source/game/FuncTrain.h index 57d1b32ceb11b4a4a622d35962e2964c26cd6345..da64b30dc7f9411cb51431cddfcd71443a7f20b9 100644 --- a/source/game/FuncTrain.h +++ b/source/game/FuncTrain.h @@ -1,14 +1,15 @@ -/****************************************************** -Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017 + +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 See the license in LICENSE -******************************************************/ +***********************************************************/ /*! \file Поезда класс */ -#ifndef _CFuncTrain_H_ -#define _CFuncTrain_H_ +#ifndef __FUNC_TRAIN_H +#define __FUNC_TRAIN_H #include "PointEntity.h" diff --git a/source/game/GameData.cpp b/source/game/GameData.cpp index 14237499e62e8a5dc48a05d76ab818006af16862..7e8544891f1d71cbbf23a70cba63e1f960c444fd 100644 --- a/source/game/GameData.cpp +++ b/source/game/GameData.cpp @@ -1,3 +1,9 @@ + +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include "GameData.h" #include "CrosshairManager.h" diff --git a/source/game/GameData.h b/source/game/GameData.h index 4f557c62427944ca0b79c5fff7ae756c2e3575e8..49c6f46a4075b70f7f81b7ac128928308ee91e50 100644 --- a/source/game/GameData.h +++ b/source/game/GameData.h @@ -1,5 +1,11 @@ -#ifndef _GameData_H_ -#define _GameData_H_ + +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + +#ifndef __GAME_DATA_H +#define __GAME_DATA_H #include "Player.h" diff --git a/source/game/LightDirectional.cpp b/source/game/LightDirectional.cpp index 3bc2bfe14f1ead249392ddb28bb29818dfe714a9..4905d416a7bf092e0ac7c2c9d930c814292371f6 100644 --- a/source/game/LightDirectional.cpp +++ b/source/game/LightDirectional.cpp @@ -1,4 +1,9 @@ +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include "LightDirectional.h" #include <mtllight/sxmtllight.h> diff --git a/source/game/LightDirectional.h b/source/game/LightDirectional.h index a40201e112b0dd82f8505817b5e6ea59a00ec454..67be6233488c6bb54c8966bb3af5e1d00b840f7b 100644 --- a/source/game/LightDirectional.h +++ b/source/game/LightDirectional.h @@ -1,8 +1,8 @@ -/****************************************************** -Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017 +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 See the license in LICENSE -******************************************************/ +***********************************************************/ /*! \file diff --git a/source/game/LightPoint.cpp b/source/game/LightPoint.cpp index 6bd55bbaaad228dcbced069163a78f3fcd2385f5..28af8acca3f00a0bb0c9a47cd3c3c2c8a25f27a6 100644 --- a/source/game/LightPoint.cpp +++ b/source/game/LightPoint.cpp @@ -1,4 +1,9 @@ +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include "LightPoint.h" #include <mtllight/sxmtllight.h> diff --git a/source/game/LightPoint.h b/source/game/LightPoint.h index ed7ecd223a62b9972cb8a4ee7c57455bb1f0478e..c740e151b820b13bb5310fb4d1a082771538f6b0 100644 --- a/source/game/LightPoint.h +++ b/source/game/LightPoint.h @@ -1,8 +1,8 @@ -/****************************************************** -Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017 +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 See the license in LICENSE -******************************************************/ +***********************************************************/ /*! \file diff --git a/source/game/NPCBase.cpp b/source/game/NPCBase.cpp index c2c35a64cc6effb3828f410d4f18d816af0c85d8..52090fdbe07926f478d0ccbb81c286dab4ca3862 100644 --- a/source/game/NPCBase.cpp +++ b/source/game/NPCBase.cpp @@ -1,4 +1,9 @@ +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include "NPCBase.h" /*! \skydocent npc_base diff --git a/source/game/NPCBase.h b/source/game/NPCBase.h index 5697f8d509e66d0aaf191a7f745bf2d442fdac5f..965376810053a1b15d7aaea456b2fbb87268fc7c 100644 --- a/source/game/NPCBase.h +++ b/source/game/NPCBase.h @@ -1,7 +1,8 @@ -/****************************************************** -Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017 + +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 See the license in LICENSE -******************************************************/ +***********************************************************/ /*! \file @@ -12,8 +13,8 @@ See the license in LICENSE @{ */ -#ifndef __NPCBASE_H_ -#define __NPCBASE_H_ +#ifndef __NPCBASE_H +#define __NPCBASE_H #include "BaseAnimating.h" #include <aigrid/sxaigrid.h> diff --git a/source/game/NPCZombie.cpp b/source/game/NPCZombie.cpp index 8cbd269b712af541fa30843f205fb83f2ef6531d..d4ccd413c81c8caca46baf5b58b87017f1089302 100644 --- a/source/game/NPCZombie.cpp +++ b/source/game/NPCZombie.cpp @@ -1,4 +1,9 @@ +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include "NPCZombie.h" #include "score/sxscore.h" diff --git a/source/game/NPCZombie.h b/source/game/NPCZombie.h index 6e2fda4a6240a79b1a845300445a3449726ff73f..853f9d758b6455a0f8744cb7bcdda43f6f9c6d7a 100644 --- a/source/game/NPCZombie.h +++ b/source/game/NPCZombie.h @@ -1,7 +1,8 @@ -/****************************************************** -Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017 + +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 See the license in LICENSE -******************************************************/ +***********************************************************/ /*! \file @@ -12,8 +13,8 @@ See the license in LICENSE @{ */ -#ifndef _NPCZombie_H_ -#define _NPCZombie_H_ +#ifndef __NPCZOMBIE_H +#define __NPCZOMBIE_H #include "NPCBase.h" diff --git a/source/game/PathCorner.cpp b/source/game/PathCorner.cpp index 04127ad6c146cf24fa95bcc47111ed5b1268b7ed..6330ef102c3f5ca4dfb6167960f660d272100860 100644 --- a/source/game/PathCorner.cpp +++ b/source/game/PathCorner.cpp @@ -1,3 +1,9 @@ + +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include "PathCorner.h" /*! \skydocent path_corner diff --git a/source/game/PathCorner.h b/source/game/PathCorner.h index 4841a8624d33421d3f4aefc4835155f3533f1dc1..12339fac944ed62404ce7a23378b239758cac185 100644 --- a/source/game/PathCorner.h +++ b/source/game/PathCorner.h @@ -1,8 +1,8 @@ -/****************************************************** -Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017 +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 See the license in LICENSE -******************************************************/ +***********************************************************/ /*! \file @@ -13,8 +13,8 @@ See the license in LICENSE @{ */ -#ifndef _CPathCorner_H_ -#define _CPathCorner_H_ +#ifndef __PATH_CORNER_H +#define __PATH_CORNER_H #include "PointEntity.h" diff --git a/source/game/Player.cpp b/source/game/Player.cpp index 295d999ff881f7fda6224cb767b37aaef72520ba..f34cf7be3c482c7c6d9a336a26d8a36f8a5abc52 100644 --- a/source/game/Player.cpp +++ b/source/game/Player.cpp @@ -1,3 +1,9 @@ + +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include <input/sxinput.h> #include <mtllight/sxmtllight.h> #include "Player.h" diff --git a/source/game/Player.h b/source/game/Player.h index 4491cb904368ef20dc46dedd7aed1659edb08cf8..cdb7b07894de79d7a4f6b63ed1b08a8469cce968 100644 --- a/source/game/Player.h +++ b/source/game/Player.h @@ -1,8 +1,8 @@ -/****************************************************** -Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017 +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 See the license in LICENSE -******************************************************/ +***********************************************************/ /*! \file @@ -13,8 +13,8 @@ See the license in LICENSE @{ */ -#ifndef _CPlayer_H_ -#define _CPlayer_H_ +#ifndef __PLAYER_H +#define __PLAYER_H #include "BaseCharacter.h" #include "PointCamera.h" diff --git a/source/game/PlayerSpawn.cpp b/source/game/PlayerSpawn.cpp index 088b72a8a5eddc98cfa4b93161706d42a74fc7d4..fccc1d26d4703d6deb8199659948ec1c694d6661 100644 --- a/source/game/PlayerSpawn.cpp +++ b/source/game/PlayerSpawn.cpp @@ -1,3 +1,9 @@ + +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include "PlayerSpawn.h" /*! \skydocent info_player_spawn diff --git a/source/game/PlayerSpawn.h b/source/game/PlayerSpawn.h index 1f8c484385aca3f5e1efdeecf9d6495872b12abe..987fe93d5d3f1d2cbd025dea587759965ba5d6c7 100644 --- a/source/game/PlayerSpawn.h +++ b/source/game/PlayerSpawn.h @@ -1,8 +1,8 @@ -/****************************************************** -Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017 +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 See the license in LICENSE -******************************************************/ +***********************************************************/ /*! \file @@ -13,8 +13,8 @@ See the license in LICENSE @{ */ -#ifndef _CPlayerSpawn_H_ -#define _CPlayerSpawn_H_ +#ifndef __PLAYER_SPAWN_H +#define __PLAYER_SPAWN_H #include "PointEntity.h" diff --git a/source/game/PointCamera.cpp b/source/game/PointCamera.cpp index 46a5c84181bba97a9a8381d4297ed6b0c6641ea9..8aa714eae512aefdbcda523901fb426146d58b56 100644 --- a/source/game/PointCamera.cpp +++ b/source/game/PointCamera.cpp @@ -1,3 +1,9 @@ + +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include "PointCamera.h" /*! \skydocent point_camera @@ -15,7 +21,7 @@ CPointCamera::CPointCamera(CEntityManager * pMgr): { const float * r_default_fov = GET_PCVAR_FLOAT("r_default_fov"); m_pSXC = SGCore_CrCamera(); - m_pSXC->SetFOV(SMToRadian(*r_default_fov)); + m_pSXC->setFOV(SMToRadian(*r_default_fov)); } CPointCamera::~CPointCamera() @@ -32,6 +38,6 @@ void CPointCamera::onSync() { BaseClass::onSync(); - m_pSXC->SetPosition(&(float3)m_vPosition); - m_pSXC->SetOrientation(m_vOrientation); + m_pSXC->setPosition(&(float3)m_vPosition); + m_pSXC->setOrientation(&m_vOrientation); } diff --git a/source/game/PointCamera.h b/source/game/PointCamera.h index c699dcf13e6ee3e7067a2924f96c3b4d95b71e25..f8682e810cf3bc679e69a17dd573c0320c1a82b5 100644 --- a/source/game/PointCamera.h +++ b/source/game/PointCamera.h @@ -1,8 +1,8 @@ -/****************************************************** -Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017 +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 See the license in LICENSE -******************************************************/ +***********************************************************/ /*! \file @@ -13,8 +13,8 @@ See the license in LICENSE @{ */ -#ifndef _CPointCamera_H_ -#define _CPointCamera_H_ +#ifndef __POINT_CAMERA_H +#define __POINT_CAMERA_H #include <gcore/sxgcore.h> diff --git a/source/game/PointEntity.cpp b/source/game/PointEntity.cpp index 59b384966d13e8b799c450a8fe618acde38928d9..91583ea83f1afbe300ed7b01e5a9c27c360c28f4 100644 --- a/source/game/PointEntity.cpp +++ b/source/game/PointEntity.cpp @@ -1,3 +1,9 @@ + +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include "PointEntity.h" /*! \skydocent base_point diff --git a/source/game/PointEntity.h b/source/game/PointEntity.h index 685e375bdedc8092dabdae557051c64500def7ab..34829fe79b088628d3195d76a1ad687798451c6b 100644 --- a/source/game/PointEntity.h +++ b/source/game/PointEntity.h @@ -1,8 +1,8 @@ -/****************************************************** -Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017 +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 See the license in LICENSE -******************************************************/ +***********************************************************/ /*! \file @@ -16,8 +16,8 @@ See the license in LICENSE //! \defgroup clight Свет -#ifndef _CPointEntity_H_ -#define _CPointEntity_H_ +#ifndef __POINT_ENTITY_H +#define __POINT_ENTITY_H #include "BaseEntity.h" diff --git a/source/game/Ragdoll.cpp b/source/game/Ragdoll.cpp index e192f0280f1f49b0713cfe9f37577d472e7bd3b6..a93eff94559024b6a7df998269cddeec9ce62149 100644 --- a/source/game/Ragdoll.cpp +++ b/source/game/Ragdoll.cpp @@ -1,3 +1,9 @@ + +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include "Ragdoll.h" CRagdoll::CRagdoll(IAnimPlayer *pAnimPlayer) diff --git a/source/game/Ragdoll.h b/source/game/Ragdoll.h index ccccae7e13b5cfd2bcb65a72d65524611062960a..ee9893df621c4cb74b563d84242b0a673e3ab015 100644 --- a/source/game/Ragdoll.h +++ b/source/game/Ragdoll.h @@ -1,5 +1,11 @@ -#ifndef _Ragdoll_H_ -#define _Ragdoll_H_ + +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + +#ifndef __RAGDOLL_H +#define __RAGDOLL_H #include "sxgame.h" #include <anim/sxanim.h> diff --git a/source/game/SXbaseSnipe.h b/source/game/SXbaseSnipe.h index e7c983d51b44b29fe25896851369b7ced11e0efb..2a766ce6875cdd77fd26197474f40a0713d1ab5c 100644 --- a/source/game/SXbaseSnipe.h +++ b/source/game/SXbaseSnipe.h @@ -1,15 +1,16 @@ -/****************************************************** -Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017 + +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 See the license in LICENSE -******************************************************/ +***********************************************************/ /*! \file Снайперские */ -#ifndef _SXbaseSnipe_H_ -#define _SXbaseSnipe_H_ +#ifndef __BASE_SNIPE_H +#define __BASE_SNIPE_H #include "BaseWeapon.h" diff --git a/source/game/crosshair.cpp b/source/game/crosshair.cpp index 645773dfc3d64a74f82399335e847089ebf2090e..1d1308c987aa421bf9b6ecf470325f72f6d2ac0e 100644 --- a/source/game/crosshair.cpp +++ b/source/game/crosshair.cpp @@ -1,4 +1,8 @@ +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ #include "crosshair.h" #include <common/SXMath.h> diff --git a/source/game/crosshair.h b/source/game/crosshair.h index baf95f3371b6cf11622ef625ae049bfe7f7f7a2e..60a7ba3dde14393f42fd90d931f353c221384d2d 100644 --- a/source/game/crosshair.h +++ b/source/game/crosshair.h @@ -1,5 +1,11 @@ -#ifndef _crosshair_H_ -#define _crosshair_H_ + +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + +#ifndef __CROSSHAIR_H +#define __CROSSHAIR_H //#include <gdefines.h> #include "sxgame.h" diff --git a/source/game/proptable.cpp b/source/game/proptable.cpp index 72461ca83fb281030e314c726860671907937496..f7dae97f8805914e043c9699fc76bda5b1e8b3e9 100644 --- a/source/game/proptable.cpp +++ b/source/game/proptable.cpp @@ -1,3 +1,9 @@ + +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include <cstdarg> #include <memory> diff --git a/source/game/proptable.h b/source/game/proptable.h index d1d409e584caec7c0134e9f40a63c53627921f36..d6f01592045e17d3e691f3ed8322188234ad8f04 100644 --- a/source/game/proptable.h +++ b/source/game/proptable.h @@ -1,5 +1,11 @@ -#ifndef _PROPTABLE_H_ -#define _PROPTABLE_H_ + +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + +#ifndef __PROPTABLE_H +#define __PROPTABLE_H #include <common/SXmath.h> diff --git a/source/game/sxgame.h b/source/game/sxgame.h index 78270cb209934150e09abb1c0794863cce571e83..e8104bdb4781b242fe0b612a3f754e1a8bc842b1 100644 --- a/source/game/sxgame.h +++ b/source/game/sxgame.h @@ -1,8 +1,8 @@ -/****************************************************** -Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017 +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 See the license in LICENSE -******************************************************/ +***********************************************************/ /*! \file @@ -149,8 +149,8 @@ See the license in LICENSE @{ */ -#ifndef _SXGAME_H_ -#define _SXGAME_H_ +#ifndef __SXGAME_H +#define __SXGAME_H #ifndef SXGAME_EXPORT #define SXGAME_EXPORT _declspec(dllimport) diff --git a/source/game/sxgame_dll.cpp b/source/game/sxgame_dll.cpp index e71fa4d6ba93c10f5e4779e81b48d8c3e8d4795e..637fd1bc5228b5facdec3a85cdbe923baf626348 100644 --- a/source/game/sxgame_dll.cpp +++ b/source/game/sxgame_dll.cpp @@ -1,8 +1,8 @@ -/****************************************************** -Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017 +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 See the license in LICENSE -******************************************************/ +***********************************************************/ #define WIN32_LEAN_AND_MEAN #include <windows.h> @@ -27,7 +27,7 @@ See the license in LICENSE # pragma comment(lib, "sxanim_d.lib") # pragma comment(lib, "sxparticles_d.lib") # pragma comment(lib, "sxscore_d.lib") -# pragma comment(lib, "sxpp_d.lib") +//# pragma comment(lib, "sxpp_d.lib") # pragma comment(lib, "sxaigrid_d.lib") #else # pragma comment(lib, "sxcore.lib") @@ -38,20 +38,20 @@ See the license in LICENSE # pragma comment(lib, "sxanim.lib") # pragma comment(lib, "sxparticles.lib") # pragma comment(lib, "sxscore.lib") -# pragma comment(lib, "sxpp.lib") +//# pragma comment(lib, "sxpp.lib") # pragma comment(lib, "sxaigrid.lib") #endif #if !defined(DEF_STD_REPORT) #define DEF_STD_REPORT -report_func reportf = DefReport; +report_func g_fnReportf = DefReport; #endif GameData * g_pGameData = NULL; ID3DXMesh* g_pFigureBox = 0; -#define SG_PRECOND(ret) if(!g_pGameData){reportf(-1, "%s - sxgame is not init", GEN_MSG_LOCATION);return ret;} +#define SG_PRECOND(ret) if(!g_pGameData){LibReport(REPORT_MSG_LEVEL_ERROR, "%s - sxgame is not init", GEN_MSG_LOCATION);return ret;} BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, @@ -106,7 +106,7 @@ SX_LIB_API void SXGame_0Create() { if(g_pGameData) { - reportf(-1, "%s - sxgame double init", GEN_MSG_LOCATION); + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - sxgame double init", GEN_MSG_LOCATION); return; } Core_SetOutPtr(); @@ -160,7 +160,7 @@ SX_LIB_API void SXGame_RenderHUD() SX_LIB_API void SXGame_Dbg_Set(report_func rf) { - reportf = rf; + g_fnReportf = rf; } SX_LIB_API void SXGame_LoadEnts(const char * file) diff --git a/source/gcore/CreatorTextures.cpp b/source/gcore/CreatorTextures.cpp index 392236f6af48af2e3b03b85469d7e15da2a81b6c..ca354ad8885e03954c121641b4ca729c6b33af21 100644 --- a/source/gcore/CreatorTextures.cpp +++ b/source/gcore/CreatorTextures.cpp @@ -1,4 +1,9 @@ +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include "creatortextures.h" CreatorTextures::CreatorTextures() @@ -54,89 +59,89 @@ ID CreatorTextures::Add(UINT width, UINT height, UINT levels, DWORD usage, D3DFO } /*if(!isadd) - g_fnReportf(REPORT_MSG_LEVEL_NOTICE, "sgcore: render target[%s] is created, id = %d\n", name, id);*/ + LibReport(REPORT_MSG_LEVEL_NOTICE, "render target[%s] is created, id = %d\n", name, id);*/ if (isadd) - g_fnReportf(REPORT_MSG_LEVEL_NOTICE, "[SGCORE]: render target[%s] is not created\n", name); + LibReport(REPORT_MSG_LEVEL_NOTICE, "render target[%s] is not created\n", name); return id; } void CreatorTextures::Delete(const char* text) { - for(int i=0;i<Arr.size();i++) + for (int i = 0; i<Arr.size(); i++) + { + if (strcmp(text, Arr[i]->Name) == 0) { - if(strcmp(text,Arr[i]->Name) == 0) - { - Arr[i]->Texture->Release(); - Arr[i]->Texture = 0; - sprintf(Arr[i]->Name,"%s",""); - } + Arr[i]->Texture->Release(); + Arr[i]->Texture = 0; + sprintf(Arr[i]->Name, "%s", ""); } + } } void CreatorTextures::Delete(ID num) { - if(num < Arr.size()) - { - Arr[num]->Texture->Release(); - Arr[num]->Texture = 0; - sprintf(Arr[num]->Name,"%s",""); - } + if (num < Arr.size()) + { + Arr[num]->Texture->Release(); + Arr[num]->Texture = 0; + sprintf(Arr[num]->Name, "%s", ""); + } } ID CreatorTextures::GetNum(const char* text) { - for(DWORD i=0;i<Arr.size();i++) + for (DWORD i = 0; i<Arr.size(); i++) + { + if (strcmp(text, Arr[i]->Name) == 0) { - if(strcmp(text,Arr[i]->Name) == 0) - { - return i; - } + return i; } - return(-1); + } + return(-1); } void CreatorTextures::OnLostDevice() { - g_fnReportf(REPORT_MSG_LEVEL_WARNING, "sgcore: release render targets ...\n"); - for(DWORD i=0;i<Arr.size();i++) + LibReport(REPORT_MSG_LEVEL_WARNING, "release render targets ...\n"); + for(DWORD i=0;i<Arr.size();i++) + { + CreatedTexture* tmpct = Arr[i]; + if(Arr[i] /*&& Arr[i]->Name[0] != 0*/) { - CreatedTexture* tmpct = Arr[i]; - if(Arr[i] /*&& Arr[i]->Name[0] != 0*/) - { - mem_release_del(Arr[i]->Texture); - } + mem_release_del(Arr[i]->Texture); } - g_fnReportf(REPORT_MSG_LEVEL_NOTICE, "sgcore: release render targets success\n"); + } + LibReport(REPORT_MSG_LEVEL_NOTICE, "release render targets success\n"); } void CreatorTextures::OnResetDevice() { - g_fnReportf(REPORT_MSG_LEVEL_WARNING, "sgcore: reset render targets ...\n"); - for(int i=0;i<Arr.size();i++) + LibReport(REPORT_MSG_LEVEL_WARNING, "reset render targets ...\n"); + for(int i=0;i<Arr.size();i++) + { + if(Arr[i]/*->Name[0] != 0*/) { - if(Arr[i]/*->Name[0] != 0*/) - { - if(Arr[i]->CoefFullScreen > 0.001f) - g_pDXDevice->CreateTexture(g_oD3DAPP.BackBufferWidth * Arr[i]->CoefFullScreen, g_oD3DAPP.BackBufferHeight * Arr[i]->CoefFullScreen, Arr[i]->Level, Arr[i]->Desc.Usage, Arr[i]->Desc.Format, Arr[i]->Desc.Pool, &(Arr[i]->Texture), NULL); - else - g_pDXDevice->CreateTexture(Arr[i]->Desc.Width, Arr[i]->Desc.Height, Arr[i]->Level, Arr[i]->Desc.Usage, Arr[i]->Desc.Format, Arr[i]->Desc.Pool, &(Arr[i]->Texture), NULL); - } + if(Arr[i]->CoefFullScreen > 0.001f) + g_pDXDevice->CreateTexture(g_oD3DAPP.BackBufferWidth * Arr[i]->CoefFullScreen, g_oD3DAPP.BackBufferHeight * Arr[i]->CoefFullScreen, Arr[i]->Level, Arr[i]->Desc.Usage, Arr[i]->Desc.Format, Arr[i]->Desc.Pool, &(Arr[i]->Texture), NULL); + else + g_pDXDevice->CreateTexture(Arr[i]->Desc.Width, Arr[i]->Desc.Height, Arr[i]->Level, Arr[i]->Desc.Usage, Arr[i]->Desc.Format, Arr[i]->Desc.Pool, &(Arr[i]->Texture), NULL); } - g_fnReportf(REPORT_MSG_LEVEL_NOTICE, "sgcore: reset render targets success\n"); + } + LibReport(REPORT_MSG_LEVEL_NOTICE, "reset render targets success\n"); } IDirect3DTexture9* CreatorTextures::GetTexture(const char* text) { - for(int i=0;i<Arr.size();i++) + for(int i=0;i<Arr.size();i++) + { + if(strcmp(text,Arr[i]->Name) == 0) { - if(strcmp(text,Arr[i]->Name) == 0) - { - return Arr[i]->Texture; - } + return Arr[i]->Texture; } - return(NULL); + } + return(NULL); } IDirect3DTexture9* CreatorTextures::GetTexture(ID num) diff --git a/source/gcore/GeomOptimize.cpp b/source/gcore/GeomOptimize.cpp index 489fbba95d152c833af4bfd5f79a4f165e708143..799844a3bb8b838b8c55815c0faf2de69f8e0164 100644 --- a/source/gcore/GeomOptimize.cpp +++ b/source/gcore/GeomOptimize.cpp @@ -1,4 +1,9 @@ +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include "GeomOptimize.h" void OptimizeIndecesInSubsetUint16(uint16_t* ib, uint16_t numFaces, uint16_t numVerts) diff --git a/source/gcore/GeomOptimize.h b/source/gcore/GeomOptimize.h index 231783707d660c6605b291669fd5b11d55d39038..6f00153b4ccb285a34cf28943a6ba07f2210e454 100644 --- a/source/gcore/GeomOptimize.h +++ b/source/gcore/GeomOptimize.h @@ -1,4 +1,9 @@ +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #ifndef __GEOM_OPTIMIZE_H #define __GEOM_OPTIMIZE_H diff --git a/source/gcore/LoaderTextures.cpp b/source/gcore/LoaderTextures.cpp index e725a720a754c64322466bc68996d37681c6a79c..9af887772e2cb26994bf10cdb9685e8e4c2ca847 100644 --- a/source/gcore/LoaderTextures.cpp +++ b/source/gcore/LoaderTextures.cpp @@ -1,4 +1,9 @@ +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include "LoaderTextures.h" LoaderTextures::LoaderTextures() @@ -43,7 +48,7 @@ bool LoaderTextures::FileExists(const char* name) if (!IsTruePath) { - g_fnReportf(REPORT_MSG_LEVEL_ERROR, "%s: %s - wrong texture name [%s]!!!", SX_LIB_NAME, GEN_MSG_LOCATION, name); + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - wrong texture name [%s]!!!", GEN_MSG_LOCATION, name); return false; } @@ -58,7 +63,7 @@ void LoaderTextures::ClearLoaded() { for (int k = 0; k < Arr[i]->ArrTex.size(); ++k) { - if (Arr[i]->ArrTex[k]->type == LoadTexType::ltt_load) + if (Arr[i]->ArrTex[k]->type == LOAD_TEXTURE_TYPE_LOAD) { mem_release_del(ArrTextures[Arr[i]->ArrTex[k]->id]->tex); ++tmpcountdel; @@ -101,7 +106,7 @@ void LoaderTextures::Delete(ID id) } } -ID LoaderTextures::AddName(const char* name, LoadTexType type, ID* iddir, ID* idname) +ID LoaderTextures::AddName(const char* name, LOAD_TEXTURE_TYPE type, ID* iddir, ID* idname) { char tmp_path[SXGC_LOADTEX_MAX_SIZE_DIR];//����� char tmp_name[SXGC_LOADTEX_MAX_SIZE_NAME];//���� ��� ������� � ����������� @@ -122,7 +127,7 @@ ID LoaderTextures::AddName(const char* name, LoadTexType type, ID* iddir, ID* id if(!IsTruePath) { - g_fnReportf(REPORT_MSG_LEVEL_ERROR, "%s: %s - wrong texture name [%s]!!!", SX_LIB_NAME, GEN_MSG_LOCATION, name); + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - wrong texture name [%s]!!!", GEN_MSG_LOCATION, name); } int tmpkey = -1; //���������� � ������� ������ ���� �� ������� � ������� ���������� @@ -192,8 +197,8 @@ ID LoaderTextures::AddName(const char* name, LoadTexType type, ID* iddir, ID* id } //���� ��� �������� ��������������� - if (type == LoadTexType::ltt_self) - type = LoadTexType::ltt_load; + if (type == LOAD_TEXTURE_TYPE_SELF) + type = LOAD_TEXTURE_TYPE_LOAD; Arr[tmpkey]->ArrTex.push_back(new TLPath::TLTex(id, tmp_name, type)); @@ -203,7 +208,7 @@ ID LoaderTextures::AddName(const char* name, LoadTexType type, ID* iddir, ID* id ArrTextures[id]->name = name; ArrTextures[id]->IDDir = tmpkey; - if (type != LoadTexType::ltt_custom) + if (type != LOAD_TEXTURE_TYPE_CUSTOM) ArrIDsLoad.push_back(id); } @@ -257,7 +262,7 @@ void LoaderTextures::GetName(ID id, char* name) ID LoaderTextures::Create(const char* name, IDirect3DTexture9* tex) { ID tmpkey, tmpKeyName; - ID id = this->AddName(name, LoadTexType::ltt_custom, &tmpkey, &tmpKeyName); + ID id = this->AddName(name, LOAD_TEXTURE_TYPE_CUSTOM, &tmpkey, &tmpKeyName); ArrTextures[id]->tex = tex; return id; } @@ -266,16 +271,16 @@ void LoaderTextures::Update(ID id) { if(id < ArrTextures.size()) { - Update(ArrTextures[id]->name.c_str(), LoadTexType::ltt_self); + Update(ArrTextures[id]->name.c_str(), LOAD_TEXTURE_TYPE_SELF); } } -ID LoaderTextures::Update(const char* name, LoadTexType type) +ID LoaderTextures::Update(const char* name, LOAD_TEXTURE_TYPE type) { ID tmpkey, tmpKeyName; ID id = AddName(name, type, &tmpkey, &tmpKeyName); - //g_fnReportf(0,"update texture [%s] ...",name); + //LibReport(0,"update texture [%s] ...",name); char tmpPath[SXGC_LOADTEX_MAX_SIZE_FULLPATH]; sprintf(tmpPath, "%s%s%s%s%s%s", Core_RStringGet(G_RI_STRING_PATH_GS_TEXTURES), Arr[tmpkey]->Path.c_str(), "\\", Arr[tmpkey]->Path.c_str(), "_", Arr[tmpkey]->ArrTex[tmpKeyName]->name.c_str()); @@ -295,12 +300,12 @@ ID LoaderTextures::Update(const char* name, LoadTexType type) ) ) { - g_fnReportf(REPORT_MSG_LEVEL_ERROR, "%s: %s - not found texture [%s]", SX_LIB_NAME, GEN_MSG_LOCATION, tmpPath); + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - not found texture [%s]", GEN_MSG_LOCATION, tmpPath); } else { ArrTextures[Arr[tmpkey]->ArrTex[tmpKeyName]->id]->tex = tex; - //g_fnReportf(0, "is ok\n"); + //LibReport(0, "is ok\n"); } return id; @@ -310,7 +315,7 @@ void LoaderTextures::LoadTextures() { if (ArrIDsLoad.size() <= 0) return; - g_fnReportf(REPORT_MSG_LEVEL_NOTICE, "%s: load textures ...\n", SX_LIB_NAME); + LibReport(REPORT_MSG_LEVEL_NOTICE, "load textures ...\n"); char tmpPath[SXGC_LOADTEX_MAX_SIZE_FULLPATH]; ID tmpiddir; @@ -336,18 +341,18 @@ void LoaderTextures::LoadTextures() ))) { ArrTextures[ArrIDsLoad[i]]->tex = 0; - g_fnReportf(REPORT_MSG_LEVEL_WARNING, "%s: - not found [%s]\n", SX_LIB_NAME, ArrTextures[ArrIDsLoad[i]]->name.c_str()); + LibReport(REPORT_MSG_LEVEL_WARNING, " not found [%s]\n", ArrTextures[ArrIDsLoad[i]]->name.c_str()); } else { ArrTextures[ArrIDsLoad[i]]->tex = tex; - g_fnReportf(REPORT_MSG_LEVEL_NOTICE, " texture id [%d], [%s]\n", ArrIDsLoad[i], ArrTextures[ArrIDsLoad[i]]->name.c_str()); + LibReport(REPORT_MSG_LEVEL_NOTICE, " texture id [%d], [%s]\n", ArrIDsLoad[i], ArrTextures[ArrIDsLoad[i]]->name.c_str()); ++iCountLoaded; } } ArrIDsLoad.clear(); - g_fnReportf(REPORT_MSG_LEVEL_NOTICE, "%s: all loaded textures [%d]\n", SX_LIB_NAME, ArrTextures.size()); + LibReport(REPORT_MSG_LEVEL_NOTICE, "all loaded textures [%d]\n", ArrTextures.size()); } IDirect3DTexture9* LoaderTextures::GetTexture(ID id) diff --git a/source/gcore/LoaderTextures.h b/source/gcore/LoaderTextures.h index 63f6050d511a1c23e6355731d93d7a7709c965c3..a33cef978fb39bcccf1174873ebfac043465a107 100644 --- a/source/gcore/LoaderTextures.h +++ b/source/gcore/LoaderTextures.h @@ -1,4 +1,9 @@ +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #ifndef __LOADERTEXTURES_H #define __LOADERTEXTURES_H @@ -8,7 +13,7 @@ #include <common/String.h> #include "sxgcore.h" -extern report_func g_fnReportf; +void LibReport(int iLevel, const char *szFormat, ...); extern IDirect3DDevice9 *g_pDXDevice; extern D3DPRESENT_PARAMETERS g_oD3DAPP; @@ -24,12 +29,12 @@ public: void Delete(ID id); //������� �������� id - ID AddName(const char* name, LoadTexType type, ID* iddir = 0, ID* idname = 0); //��������� ��� ��������, ������ �������� �� ��� ID (��������� � �������) + ID AddName(const char* name, LOAD_TEXTURE_TYPE type, ID* iddir = 0, ID* idname = 0); //��������� ��� ��������, ������ �������� �� ��� ID (��������� � �������) ID GetID(const char* name); //�������� id �� ����� void GetName(ID id, char* name);//�������� ��� �� id ID Create(const char* name, IDirect3DTexture9* tex); //������� ����� ��� �������� tex - ID Update(const char* name, LoadTexType type); //������������� �������� name + ID Update(const char* name, LOAD_TEXTURE_TYPE type); //������������� �������� name void Update(ID id); void LoadTextures(); //�������� ���� ������� ������������ � ������� @@ -54,12 +59,12 @@ private: struct TLTex { - TLTex(){ id = -1; type = LoadTexType::ltt_load; } - TLTex(ID _id, const char* _name, LoadTexType _type){ id = _id; name = _name; type = _type; } + TLTex(){ id = -1; type = LOAD_TEXTURE_TYPE_LOAD; } + TLTex(ID _id, const char* _name, LOAD_TEXTURE_TYPE _type){ id = _id; name = _name; type = _type; } ID id; String name; - LoadTexType type; + LOAD_TEXTURE_TYPE type; }; Array<TLTex*> ArrTex; diff --git a/source/gcore/ModelFile.h b/source/gcore/ModelFile.h index b9540a03c8dbb8c38eb28a87dc585b62287f5939..c0f6b5afde4ae7894650670c515f4b8ef6caddbc 100644 --- a/source/gcore/ModelFile.h +++ b/source/gcore/ModelFile.h @@ -1,8 +1,8 @@ -/****************************************************** -Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017 +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 See the license in LICENSE -******************************************************/ +***********************************************************/ /*! \file @@ -14,8 +14,8 @@ See the license in LICENSE @{ */ -#ifndef _ModelFile_H_ -#define _ModelFile_H_ +#ifndef __MODEL_FILE_H +#define __MODEL_FILE_H #define SX_MODEL_VERSION_OLD 6 /*!< Старая версия файла модели (для совместимости) */ #define SX_MODEL_VERSION 7 /*!< Актуальная версия файла модели */ diff --git a/source/gcore/bound.cpp b/source/gcore/bound.cpp index 409839ae997f350f08ca23b927390c5840f2f71d..751bf1c43e20061996a191eaff4e7dd2943af76f 100644 --- a/source/gcore/bound.cpp +++ b/source/gcore/bound.cpp @@ -1,4 +1,9 @@ +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include "Bound.h" void CreateCone(float fTopRadius, float fBottomRadius, float fHeight, ID3DXMesh ** ppMesh, IDirect3DDevice9 * pDevice,UINT iSideCount) @@ -80,6 +85,8 @@ void CreateCone(float fTopRadius, float fBottomRadius, float fHeight, ID3DXMesh mem_delete(pVertices); } +//########################################################################## + void ComputeBoundingBox(IDirect3DVertexBuffer9* vertex_buffer,ISXBound** bound,DWORD count_vert,DWORD bytepervert) { float3_t *V = 0; @@ -119,7 +126,7 @@ void ComputeBoundingBox(IDirect3DVertexBuffer9* vertex_buffer,ISXBound** bound,D vertex_buffer->Unlock(); } - (*bound)->SetMinMax(&float3(Min),&float3(Max)); + (*bound)->setMinMax(&float3(Min),&float3(Max)); } void ComputeBoundingBox2(IDirect3DVertexBuffer9* vertex_buffer,ISXBound* bound,DWORD count_vert,DWORD bytepervert) @@ -169,148 +176,15 @@ void ComputeBoundingBox2(IDirect3DVertexBuffer9* vertex_buffer,ISXBound* bound,D Max.y /= 100.f; Max.z /= 100.f; - bound->SetMinMax(&float3(Min),&float3(Max)); -} - - -////////////////////////////////// - -bool InPosition2D(float3* min,float3* max,float3* pos) -{ - if((max->x >= pos->x && min->x <= pos->x) && (max->z >= pos->z && min->z <= pos->z)) - return true; - else if( - (long(max->x * 1000) >= long(pos->x * 1000) && long(min->x * 1000) <= long(pos->x * 1000)) - && - (long(max->z * 1000) >= long(pos->z * 1000) && long(min->z * 1000) <= long(pos->z * 1000)) - ) - return true; - else - return false; -} - -bool InPositionAbs2D(float3* min,float3* max,float3* pos) -{ - if((max->x > pos->x && min->x < pos->x) && (max->z > pos->z && min->z < pos->z)) - return true; - else - return false; -} - - -int CountPositionPoints2D(float3* min,float3* max,float3* p1,float3* p2,float3* p3) -{ - int Count = 0; - - if(InPosition2D(min,max,p1)) - Count++; - if(InPosition2D(min,max,p2)) - Count++; - if(InPosition2D(min,max,p3)) - Count++; - - return Count; -} - -int CountPositionPointsAbs2D(float3* min,float3* max,float3* p1,float3* p2,float3* p3) -{ - int Count = 0; - - if(InPositionAbs2D(min,max,p1)) - Count++; - if(InPositionAbs2D(min,max,p2)) - Count++; - if(InPositionAbs2D(min,max,p3)) - Count++; - - return Count; + bound->setMinMax(&float3(Min),&float3(Max)); } - -bool InPositionPoints2D(float3* min,float3* max,float3* p1,float3* p2,float3* p3) +void ComputeBoundingBoxArr8(ISXBound* bound, ISXBound** bound_arr) { - if(CountPositionPointsAbs2D(min,max,p1,p2,p3) >= 1) - return true; - else if(CountPositionPoints2D(min,max,p1,p2,p3) >= 2) - return true; - else - return false; -} - -/////////////////////////////////// - -bool InPosition3D(float3* min,float3* max,float3* pos) -{ - if((max->x >= pos->x && min->x <= pos->x) && (max->y >= pos->y && min->y <= pos->y) && (max->z >= pos->z && min->z <= pos->z)) - return true; - else if( - (long(max->x * 1000) >= long(pos->x * 1000) && long(min->x * 1000) <= long(pos->x * 1000)) - && - (long(max->y * 1000) >= long(pos->y * 1000) && long(min->y * 1000) <= long(pos->y * 1000)) - && - (long(max->z * 1000) >= long(pos->z * 1000) && long(min->z * 1000) <= long(pos->z * 1000)) - ) - return true; - else - return false; -} - -bool InPositionAbs3D(float3* min,float3* max,float3* pos) -{ - if((max->x > pos->x && min->x < pos->x) && (max->y > pos->y && min->y < pos->y) && (max->z > pos->z && min->z < pos->z)) - return true; - else - return false; -} - - -int CountPositionPoints3D(float3* min,float3* max,float3* p1,float3* p2,float3* p3) -{ - int Count = 0; - - if(InPosition3D(min,max,p1)) - Count++; - if(InPosition3D(min,max,p2)) - Count++; - if(InPosition3D(min,max,p3)) - Count++; - - return Count; -} - -int CountPositionPointsAbs3D(float3* min,float3* max,float3* p1,float3* p2,float3* p3) -{ - int Count = 0; - - if(InPositionAbs3D(min,max,p1)) - Count++; - if(InPositionAbs3D(min,max,p2)) - Count++; - if(InPositionAbs3D(min,max,p3)) - Count++; - - return Count; -} - - -bool InPositionPoints3D(float3* min,float3* max,float3* p1,float3* p2,float3* p3) -{ - if(CountPositionPointsAbs3D(min,max,p1,p2,p3) >= 1) - return true; - else if(CountPositionPoints3D(min,max,p1,p2,p3) >= 2) - return true; - else - return false; -} - -//////////////////// - -void ComputeBoundingBoxArr8(ISXBound* bound,ISXBound** bound_arr) -{ - float3 tmpMin2,tmpMax2; - float3 tmpMin,tmpMax; - bound->GetMinMax(&tmpMin2,&tmpMax2); - bound->GetMinMax(&tmpMin,&tmpMax); + float3 tmpMin2, tmpMax2; + float3 tmpMin, tmpMax; + bound->getMinMax(&tmpMin2, &tmpMax2); + bound->getMinMax(&tmpMin, &tmpMax); float x = (tmpMax.x + tmpMin.x) * 0.5; float y = (tmpMax.y + tmpMin.y) * 0.5; @@ -329,13 +203,13 @@ void ComputeBoundingBoxArr8(ISXBound* bound,ISXBound** bound_arr) tmpMax2.y = dist_y; tmpMax2.z = dist_z; - tmpMin2 += float3(x,y,z); - tmpMin2 += float3(dist_x,dist_y,dist_z); + tmpMin2 += float3(x, y, z); + tmpMin2 += float3(dist_x, dist_y, dist_z); - tmpMax2 += float3(x,y,z); - tmpMax2 += float3(dist_x,dist_y,dist_z); + tmpMax2 += float3(x, y, z); + tmpMax2 += float3(dist_x, dist_y, dist_z); - (bound_arr[0])->SetMinMax(&tmpMin2,&tmpMax2); + (bound_arr[0])->setMinMax(&tmpMin2, &tmpMax2); tmpMin2.x = -dist_x; @@ -346,13 +220,13 @@ void ComputeBoundingBoxArr8(ISXBound* bound,ISXBound** bound_arr) tmpMax2.y = dist_y; tmpMax2.z = dist_z; - tmpMin2 += float3(x,y,z); - tmpMin2 += float3(-dist_x,dist_y,dist_z); + tmpMin2 += float3(x, y, z); + tmpMin2 += float3(-dist_x, dist_y, dist_z); - tmpMax2 += float3(x,y,z); - tmpMax2 += float3(-dist_x,dist_y,dist_z); + tmpMax2 += float3(x, y, z); + tmpMax2 += float3(-dist_x, dist_y, dist_z); - (bound_arr[1])->SetMinMax(&tmpMin2, &tmpMax2); + (bound_arr[1])->setMinMax(&tmpMin2, &tmpMax2); tmpMin2.x = -dist_x; @@ -364,13 +238,13 @@ void ComputeBoundingBoxArr8(ISXBound* bound,ISXBound** bound_arr) tmpMax2.z = dist_z; //bound->GetMinMax(&tmpMin2,&tmpMax2); - tmpMin2 += float3(x,y,z); - tmpMin2 += float3(dist_x,dist_y,-dist_z); + tmpMin2 += float3(x, y, z); + tmpMin2 += float3(dist_x, dist_y, -dist_z); - tmpMax2 += float3(x,y,z); - tmpMax2 += float3(dist_x,dist_y,-dist_z); + tmpMax2 += float3(x, y, z); + tmpMax2 += float3(dist_x, dist_y, -dist_z); - (bound_arr[2])->SetMinMax(&tmpMin2, &tmpMax2); + (bound_arr[2])->setMinMax(&tmpMin2, &tmpMax2); tmpMin2.x = -dist_x; @@ -382,16 +256,16 @@ void ComputeBoundingBoxArr8(ISXBound* bound,ISXBound** bound_arr) tmpMax2.z = dist_z; //bound->GetMinMax(&tmpMin2,&tmpMax2); - tmpMin2 += float3(x,y,z); - tmpMin2 += float3(-dist_x,dist_y,-dist_z); + tmpMin2 += float3(x, y, z); + tmpMin2 += float3(-dist_x, dist_y, -dist_z); - tmpMax2 += float3(x,y,z); - tmpMax2 += float3(-dist_x,dist_y,-dist_z); + tmpMax2 += float3(x, y, z); + tmpMax2 += float3(-dist_x, dist_y, -dist_z); + + (bound_arr[3])->setMinMax(&tmpMin2, &tmpMax2); - (bound_arr[3])->SetMinMax(&tmpMin2, &tmpMax2); - tmpMin2.x = -dist_x; tmpMin2.y = -dist_y; tmpMin2.z = -dist_z; @@ -400,13 +274,13 @@ void ComputeBoundingBoxArr8(ISXBound* bound,ISXBound** bound_arr) tmpMax2.y = dist_y; tmpMax2.z = dist_z; - tmpMin2 += float3(x,y,z); - tmpMin2 += float3(dist_x,-dist_y,dist_z); + tmpMin2 += float3(x, y, z); + tmpMin2 += float3(dist_x, -dist_y, dist_z); - tmpMax2 += float3(x,y,z); - tmpMax2 += float3(dist_x,-dist_y,dist_z); + tmpMax2 += float3(x, y, z); + tmpMax2 += float3(dist_x, -dist_y, dist_z); - (bound_arr[4])->SetMinMax(&tmpMin2, &tmpMax2); + (bound_arr[4])->setMinMax(&tmpMin2, &tmpMax2); tmpMin2.x = -dist_x; @@ -417,13 +291,13 @@ void ComputeBoundingBoxArr8(ISXBound* bound,ISXBound** bound_arr) tmpMax2.y = dist_y; tmpMax2.z = dist_z; - tmpMin2 += float3(x,y,z); - tmpMin2 += float3(-dist_x,-dist_y,dist_z); + tmpMin2 += float3(x, y, z); + tmpMin2 += float3(-dist_x, -dist_y, dist_z); - tmpMax2 += float3(x,y,z); - tmpMax2 += float3(-dist_x,-dist_y,dist_z); + tmpMax2 += float3(x, y, z); + tmpMax2 += float3(-dist_x, -dist_y, dist_z); - (bound_arr[5])->SetMinMax(&tmpMin2, &tmpMax2); + (bound_arr[5])->setMinMax(&tmpMin2, &tmpMax2); tmpMin2.x = -dist_x; @@ -435,13 +309,13 @@ void ComputeBoundingBoxArr8(ISXBound* bound,ISXBound** bound_arr) tmpMax2.z = dist_z; //bound->GetMinMax(&tmpMin2,&tmpMax2); - tmpMin2 += float3(x,y,z); - tmpMin2 += float3(dist_x,-dist_y,-dist_z); + tmpMin2 += float3(x, y, z); + tmpMin2 += float3(dist_x, -dist_y, -dist_z); - tmpMax2 += float3(x,y,z); - tmpMax2 += float3(dist_x,-dist_y,-dist_z); + tmpMax2 += float3(x, y, z); + tmpMax2 += float3(dist_x, -dist_y, -dist_z); - (bound_arr[6])->SetMinMax(&tmpMin2, &tmpMax2); + (bound_arr[6])->setMinMax(&tmpMin2, &tmpMax2); tmpMin2.x = -dist_x; @@ -453,21 +327,21 @@ void ComputeBoundingBoxArr8(ISXBound* bound,ISXBound** bound_arr) tmpMax2.z = dist_z; //bound->GetMinMax(&tmpMin2,&tmpMax2); - tmpMin2 += float3(x,y,z); - tmpMin2 += float3(-dist_x,-dist_y,-dist_z); + tmpMin2 += float3(x, y, z); + tmpMin2 += float3(-dist_x, -dist_y, -dist_z); - tmpMax2 += float3(x,y,z); - tmpMax2 += float3(-dist_x,-dist_y,-dist_z); + tmpMax2 += float3(x, y, z); + tmpMax2 += float3(-dist_x, -dist_y, -dist_z); - (bound_arr[7])->SetMinMax(&tmpMin2, &tmpMax2); + (bound_arr[7])->setMinMax(&tmpMin2, &tmpMax2); } -void ComputeBoundingBoxArr4(ISXBound* bound,ISXBound** bound_arr) +void ComputeBoundingBoxArr4(ISXBound* bound, ISXBound** bound_arr) { - float3 tmpMin2,tmpMax2; - float3 tmpMin,tmpMax; - bound->GetMinMax(&tmpMin2,&tmpMax2); - bound->GetMinMax(&tmpMin,&tmpMax); + float3 tmpMin2, tmpMax2; + float3 tmpMin, tmpMax; + bound->getMinMax(&tmpMin2, &tmpMax2); + bound->getMinMax(&tmpMin, &tmpMax); float x = (tmpMax.x + tmpMin.x) * 0.5; float y = (tmpMax.y + tmpMin.y) * 0.5; @@ -486,13 +360,13 @@ void ComputeBoundingBoxArr4(ISXBound* bound,ISXBound** bound_arr) tmpMax2.y = dist_y; tmpMax2.z = dist_z; - tmpMin2 += float3(x,y,z); - tmpMin2 += float3(dist_x,0,dist_z); + tmpMin2 += float3(x, y, z); + tmpMin2 += float3(dist_x, 0, dist_z); - tmpMax2 += float3(x,y,z); - tmpMax2 += float3(dist_x,0,dist_z); + tmpMax2 += float3(x, y, z); + tmpMax2 += float3(dist_x, 0, dist_z); - (bound_arr[0])->SetMinMax(&tmpMin2,&tmpMax2); + (bound_arr[0])->setMinMax(&tmpMin2, &tmpMax2); tmpMin2.x = -dist_x; @@ -503,13 +377,13 @@ void ComputeBoundingBoxArr4(ISXBound* bound,ISXBound** bound_arr) tmpMax2.y = dist_y; tmpMax2.z = dist_z; - tmpMin2 += float3(x,y,z); - tmpMin2 += float3(-dist_x,0,dist_z); + tmpMin2 += float3(x, y, z); + tmpMin2 += float3(-dist_x, 0, dist_z); - tmpMax2 += float3(x,y,z); - tmpMax2 += float3(-dist_x,0,dist_z); + tmpMax2 += float3(x, y, z); + tmpMax2 += float3(-dist_x, 0, dist_z); - (bound_arr[1])->SetMinMax(&tmpMin2, &tmpMax2); + (bound_arr[1])->setMinMax(&tmpMin2, &tmpMax2); tmpMin2.x = -dist_x; @@ -521,13 +395,13 @@ void ComputeBoundingBoxArr4(ISXBound* bound,ISXBound** bound_arr) tmpMax2.z = dist_z; //bound->GetMinMax(&tmpMin2,&tmpMax2); - tmpMin2 += float3(x,y,z); - tmpMin2 += float3(dist_x,0,-dist_z); + tmpMin2 += float3(x, y, z); + tmpMin2 += float3(dist_x, 0, -dist_z); - tmpMax2 += float3(x,y,z); - tmpMax2 += float3(dist_x,0,-dist_z); + tmpMax2 += float3(x, y, z); + tmpMax2 += float3(dist_x, 0, -dist_z); - (bound_arr[2])->SetMinMax(&tmpMin2, &tmpMax2); + (bound_arr[2])->setMinMax(&tmpMin2, &tmpMax2); tmpMin2.x = -dist_x; @@ -539,17 +413,146 @@ void ComputeBoundingBoxArr4(ISXBound* bound,ISXBound** bound_arr) tmpMax2.z = dist_z; //bound->GetMinMax(&tmpMin2,&tmpMax2); - tmpMin2 += float3(x,y,z); - tmpMin2 += float3(-dist_x,0,-dist_z); + tmpMin2 += float3(x, y, z); + tmpMin2 += float3(-dist_x, 0, -dist_z); + + tmpMax2 += float3(x, y, z); + tmpMax2 += float3(-dist_x, 0, -dist_z); + + (bound_arr[3])->setMinMax(&tmpMin2, &tmpMax2); +} + +//########################################################################## + +bool InPosition2D(float3* min,float3* max,float3* pos) +{ + if((max->x >= pos->x && min->x <= pos->x) && (max->z >= pos->z && min->z <= pos->z)) + return true; + else if( + (long(max->x * 1000) >= long(pos->x * 1000) && long(min->x * 1000) <= long(pos->x * 1000)) + && + (long(max->z * 1000) >= long(pos->z * 1000) && long(min->z * 1000) <= long(pos->z * 1000)) + ) + return true; + else + return false; +} + +bool InPositionAbs2D(float3* min,float3* max,float3* pos) +{ + if((max->x > pos->x && min->x < pos->x) && (max->z > pos->z && min->z < pos->z)) + return true; + else + return false; +} + + +int CountPositionPoints2D(float3* min,float3* max,float3* p1,float3* p2,float3* p3) +{ + int Count = 0; + + if(InPosition2D(min,max,p1)) + Count++; + if(InPosition2D(min,max,p2)) + Count++; + if(InPosition2D(min,max,p3)) + Count++; + + return Count; +} + +int CountPositionPointsAbs2D(float3* min,float3* max,float3* p1,float3* p2,float3* p3) +{ + int Count = 0; + + if(InPositionAbs2D(min,max,p1)) + Count++; + if(InPositionAbs2D(min,max,p2)) + Count++; + if(InPositionAbs2D(min,max,p3)) + Count++; + + return Count; +} - tmpMax2 += float3(x,y,z); - tmpMax2 += float3(-dist_x,0,-dist_z); - (bound_arr[3])->SetMinMax(&tmpMin2, &tmpMax2); +bool InPositionPoints2D(float3* min,float3* max,float3* p1,float3* p2,float3* p3) +{ + if(CountPositionPointsAbs2D(min,max,p1,p2,p3) >= 1) + return true; + else if(CountPositionPoints2D(min,max,p1,p2,p3) >= 2) + return true; + else + return false; } -//////////////////// +//************************************************************************** +bool InPosition3D(float3* min,float3* max,float3* pos) +{ + if((max->x >= pos->x && min->x <= pos->x) && (max->y >= pos->y && min->y <= pos->y) && (max->z >= pos->z && min->z <= pos->z)) + return true; + else if( + (long(max->x * 1000) >= long(pos->x * 1000) && long(min->x * 1000) <= long(pos->x * 1000)) + && + (long(max->y * 1000) >= long(pos->y * 1000) && long(min->y * 1000) <= long(pos->y * 1000)) + && + (long(max->z * 1000) >= long(pos->z * 1000) && long(min->z * 1000) <= long(pos->z * 1000)) + ) + return true; + else + return false; +} + +bool InPositionAbs3D(float3* min,float3* max,float3* pos) +{ + if((max->x > pos->x && min->x < pos->x) && (max->y > pos->y && min->y < pos->y) && (max->z > pos->z && min->z < pos->z)) + return true; + else + return false; +} + + +int CountPositionPoints3D(float3* min,float3* max,float3* p1,float3* p2,float3* p3) +{ + int Count = 0; + + if(InPosition3D(min,max,p1)) + Count++; + if(InPosition3D(min,max,p2)) + Count++; + if(InPosition3D(min,max,p3)) + Count++; + + return Count; +} + +int CountPositionPointsAbs3D(float3* min,float3* max,float3* p1,float3* p2,float3* p3) +{ + int Count = 0; + + if(InPositionAbs3D(min,max,p1)) + Count++; + if(InPositionAbs3D(min,max,p2)) + Count++; + if(InPositionAbs3D(min,max,p3)) + Count++; + + return Count; +} + + +bool InPositionPoints3D(float3* min,float3* max,float3* p1,float3* p2,float3* p3) +{ + if(CountPositionPointsAbs3D(min,max,p1,p2,p3) >= 1) + return true; + else if(CountPositionPoints3D(min,max,p1,p2,p3) >= 2) + return true; + else + return false; +} + +//########################################################################## void CreateBoundingBoxMesh(float3* min, float3* max, ID3DXMesh** bbmesh, IDirect3DDevice9* device) { @@ -581,76 +584,75 @@ void CreateBoundingBoxMesh(float3* min, float3* max, ID3DXMesh** bbmesh, IDirect (*bbmesh)->UnlockVertexBuffer(); } +//########################################################################## - - -float4x4* SXTransObject::CalcWorld() +float4x4* CSXTransObject::calcWorld() { - World = SMMatrixScaling(Scale) * /*Rotation.GetMatrix()*/SMMatrixRotationX(Rotation.x) * SMMatrixRotationY(Rotation.y) * SMMatrixRotationZ(Rotation.z) * SMMatrixTranslation(Position); - return &World; + m_mWorld = SMMatrixScaling(m_vScale) * /*Rotation.GetMatrix()*/SMMatrixRotationX(m_vRotation.x) * SMMatrixRotationY(m_vRotation.y) * SMMatrixRotationZ(m_vRotation.z) * SMMatrixTranslation(m_vPosition); + return &m_mWorld; } -//// +//########################################################################## -void SXBound::CalcBound(IDirect3DVertexBuffer9* vertex_buffer, DWORD count_vert, DWORD bytepervert) +void CSXBound::calcBound(IDirect3DVertexBuffer9* vertex_buffer, DWORD count_vert, DWORD bytepervert) { BYTE *V = 0; HRESULT hr = 0; - if (vertex_buffer && SUCCEEDED(vertex_buffer->Lock(0, 0, (void **)&V, 0))) - { - float3_t tmppos = *(float3_t*)((char*)(V) + bytepervert * 0); - Max = tmppos; - Min = tmppos; + if (vertex_buffer && SUCCEEDED(vertex_buffer->Lock(0, 0, (void **)&V, 0))) + { + float3_t tmppos = *(float3_t*)((char*)(V)+bytepervert * 0); + m_vMax = tmppos; + m_vMin = tmppos; - for(DWORD i=0;i<count_vert;i++) - { - float3_t pos = *(float3_t*)((char*)(V) + bytepervert * i); + for (DWORD i = 0; i<count_vert; i++) + { + float3_t pos = *(float3_t*)((char*)(V)+bytepervert * i); - if(pos.x > Max.x) - Max.x = pos.x; + if (pos.x > m_vMax.x) + m_vMax.x = pos.x; - if(pos.y > Max.y) - Max.y = pos.y; + if (pos.y > m_vMax.y) + m_vMax.y = pos.y; - if(pos.z > Max.z) - Max.z = pos.z; + if (pos.z > m_vMax.z) + m_vMax.z = pos.z; - if(pos.x < Min.x) - Min.x = pos.x; + if (pos.x < m_vMin.x) + m_vMin.x = pos.x; - if(pos.y < Min.y) - Min.y = pos.y; + if (pos.y < m_vMin.y) + m_vMin.y = pos.y; - if(pos.z < Min.z) - Min.z = pos.z; - } - vertex_buffer->Unlock(); + if (pos.z < m_vMin.z) + m_vMin.z = pos.z; } + vertex_buffer->Unlock(); + } - Center = (Min + Max) * 0.5f; - Radius = SMVector3Length(Center-Max); + m_vCenter = (m_vMin + m_vMax) * 0.5f; + m_fRadius = SMVector3Length(m_vCenter - m_vMax); } -float4x4* SXBound::CalcWorldAndTrans() +float4x4* CSXBound::calcWorldAndTrans() { - CalcWorld(); + calcWorld(); - Max = SMVector3Transform(Max, World); - Min = SMVector3Transform(Min, World); + m_vMax = SMVector3Transform(m_vMax, m_mWorld); + m_vMin = SMVector3Transform(m_vMin, m_mWorld); - Center = (Min + Max) * 0.5f; + m_vCenter = (m_vMin + m_vMax) * 0.5f; - Radius = SMVector3Length(Center - Max); - return &World; + m_fRadius = SMVector3Length(m_vCenter - m_vMax); + return &m_mWorld; } -void SXBound::GetPosBBScreen(SXPosBBScreen *res, float3* campos, float3* sizemapdepth, float4x4* mat) +void CSXBound::getPosBBScreen(SXPosBBScreen *res, float3* campos, float3* sizemapdepth, float4x4* mat) { float3 max,min; - max = Max; - min = Min; + max = m_vMax; + min = m_vMin; float2 mins,maxs,minmaxdepth; @@ -827,50 +829,50 @@ void SXBound::GetPosBBScreen(SXPosBBScreen *res, float3* campos, float3* sizemap res->IsIn = true;*/ } -void SXBound::SetMinMax(float3* min, float3* max) +void CSXBound::setMinMax(const float3* min, const float3* max) { - Min = *min; - Max = *max; + m_vMin = *min; + m_vMax = *max; /*float3 vec = (Max - Min) * 0.5f; Radius = sqrt(vec.x * vec.x + vec.y * vec.y + vec.x * vec.z);*/ - Center = (Min + Max) * 0.5f; - Radius = SMVector3Length(Center - Max); + m_vCenter = (m_vMin + m_vMax) * 0.5f; + m_fRadius = SMVector3Length(m_vCenter - m_vMax); }; -void SXBound::GetMinMax(float3* min, float3* max) const +void CSXBound::getMinMax(float3* min, float3* max) const { - *min = Min; *max = Max; + *min = m_vMin; *max = m_vMax; }; -void SXBound::SetSphere(float3* center, float* radius) +void CSXBound::setSphere(const float3* center, float radius) { - Center = *center; - Radius = *radius; + m_vCenter = *center; + m_fRadius = radius; - Min = Center - float3(Radius, Radius, Radius); - Max = Center + float3(Radius, Radius, Radius); + m_vMin = m_vCenter - float3(m_fRadius, m_fRadius, m_fRadius); + m_vMax = m_vCenter + float3(m_fRadius, m_fRadius, m_fRadius); }; -void SXBound::GetSphere(float3* center, float* radius) const +void CSXBound::getSphere(float3* center, float* radius) const { - *center = Center; - *radius = Radius; + *center = m_vCenter; + *radius = m_fRadius; }; -bool SXBound::IsPointInSphere(float3* point) const +bool CSXBound::isPointInSphere(const float3* point) const { - float distsqr = SMVector3Dot(Center - *point); - if (distsqr <= Radius*Radius) + float distsqr = SMVector3Dot(m_vCenter - *point); + if (distsqr <= m_fRadius*m_fRadius) return true; else return false; } -bool SXBound::IsPointInBox(float3* point) const +bool CSXBound::isPointInBox(const float3* point) const { - if (point->x >= Min.x && point->y >= Min.y && point->z >= Min.z && point->x <= Max.x && point->y <= Max.y && point->z <= Max.z) + if (point->x >= m_vMin.x && point->y >= m_vMin.y && point->z >= m_vMin.z && point->x <= m_vMax.x && point->y <= m_vMax.y && point->z <= m_vMax.z) return true; else return false; diff --git a/source/gcore/bound.h b/source/gcore/bound.h index 527ae1aedacf59bf29ecc7d9ab11b88392b4d540..7cd66b7d17ecbfd62215310c9de0ae508c5a744c 100644 --- a/source/gcore/bound.h +++ b/source/gcore/bound.h @@ -1,4 +1,9 @@ +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #ifndef __BOUND_H #define __BOUND_H @@ -32,16 +37,16 @@ void CreateBoundingBoxMesh(float3* min, float3* max, ID3DXMesh** bbmesh, IDirect //������� ������ � ����������� ��������� //��� ����������� ������������� ���������� ������� ���������� �������/�������/������� ����� ���� CalculateWorld -struct SXTransObject : public virtual ISXTransObject +struct CSXTransObject : public virtual ISXTransObject { - SXTransObject(){}; - ~SXTransObject(){}; + CSXTransObject(){}; + ~CSXTransObject(){}; void Release(){ mem_del(this); }; SX_ALIGNED_OP_MEM - float4x4* CalcWorld(); + float4x4* calcWorld(); }; #define TRANSFORM_COORD_SCREEN2(point,sizemapdepth)\ @@ -57,31 +62,38 @@ struct SXTransObject : public virtual ISXTransObject //��� �������� �������� � ��������� ���������� ������� CalculateBound //SetMinMax, GetMinMax �� ������ CalculateWorldAndTrans ���������� �������������������� ������ //�������� ������ ���������� Bound � Object �������� CalculateWorldAndTrans -class SXBound : public SXTransObject, public virtual ISXBound +class CSXBound : public CSXTransObject, public virtual ISXBound { public: - SXBound(){}; - ~SXBound(){}; + CSXBound(){}; + ~CSXBound(){}; void Release(){ mem_del(this); }; SX_ALIGNED_OP_MEM - void CalcBound(IDirect3DVertexBuffer9* vertex_buffer, DWORD count_vert, DWORD bytepervert); + void calcBound(IDirect3DVertexBuffer9* vertex_buffer, DWORD count_vert, DWORD bytepervert); //������� �������� ������� ������� � ������������� �������� � ��������� - float4x4* CalcWorldAndTrans(); + float4x4* calcWorldAndTrans(); + + void getPosBBScreen(SXPosBBScreen *res, float3* campos, float3* sizemapdepth, float4x4* mat); + + void setMinMax(const float3* min, const float3* max); + void getMinMax(float3* min, float3* max) const; - void GetPosBBScreen(SXPosBBScreen *res, float3* campos, float3* sizemapdepth, float4x4* mat); + void setSphere(const float3* center, float radius); + void getSphere(float3* center, float* radius) const; - void SetMinMax(float3* min, float3* max); - void GetMinMax(float3* min, float3* max) const; + bool isPointInSphere(const float3* point) const; + bool isPointInBox(const float3* point) const; - void SetSphere(float3* center, float* radius); - void GetSphere(float3* center, float* radius) const; +protected: + float3 m_vMin; + float3 m_vMax; - bool IsPointInSphere(float3* point) const; - bool IsPointInBox(float3* point) const; + float3 m_vCenter; + float m_fRadius; }; #endif \ No newline at end of file diff --git a/source/gcore/camera.cpp b/source/gcore/camera.cpp index 02a921ebb7a5433be42c0db4965f67f99b4e9ef5..e2e4fc50c75a5feeb91975eb49534e457b18c528 100644 --- a/source/gcore/camera.cpp +++ b/source/gcore/camera.cpp @@ -1,60 +1,74 @@ +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include "camera.h" -Frustum::Frustum() +CFrustum::CFrustum() { - + m_aPoints[0] = float3(0, 0, 0); + m_aPoints[1] = float3(0, 0, 0); + m_aPoints[2] = float3(0, 0, 0); + m_aPoints[3] = float3(0, 0, 0); + m_aPoints[4] = float3(0, 0, 0); + m_aPoints[5] = float3(0, 0, 0); + m_aPoints[6] = float3(0, 0, 0); + m_aPoints[7] = float3(0, 0, 0); + + m_vCenter = float3(0, 0, 0); } -Frustum::~Frustum() +CFrustum::~CFrustum() { } -void Frustum::Update(const float4x4* view,const float4x4* proj) +void CFrustum::update(const float4x4* view,const float4x4* proj) { float4x4 matComb = SMMatrixMultiply(*view, *proj); - ArrFrustumPlane[0].Normal.x = matComb._14 - matComb._11; - ArrFrustumPlane[0].Normal.y = matComb._24 - matComb._21; - ArrFrustumPlane[0].Normal.z = matComb._34 - matComb._31; - ArrFrustumPlane[0].Distance = matComb._44 - matComb._41; + m_aFrustumPlanes[0].m_vNormal.x = matComb._14 - matComb._11; + m_aFrustumPlanes[0].m_vNormal.y = matComb._24 - matComb._21; + m_aFrustumPlanes[0].m_vNormal.z = matComb._34 - matComb._31; + m_aFrustumPlanes[0].m_fDistance = matComb._44 - matComb._41; - ArrFrustumPlane[1].Normal.x = matComb._14 + matComb._11; - ArrFrustumPlane[1].Normal.y = matComb._24 + matComb._21; - ArrFrustumPlane[1].Normal.z = matComb._34 + matComb._31; - ArrFrustumPlane[1].Distance = matComb._44 + matComb._41; - - ArrFrustumPlane[2].Normal.x = matComb._14 + matComb._12; - ArrFrustumPlane[2].Normal.y = matComb._24 + matComb._22; - ArrFrustumPlane[2].Normal.z = matComb._34 + matComb._32; - ArrFrustumPlane[2].Distance = matComb._44 + matComb._42; - - ArrFrustumPlane[3].Normal.x = matComb._14 - matComb._12; - ArrFrustumPlane[3].Normal.y = matComb._24 - matComb._22; - ArrFrustumPlane[3].Normal.z = matComb._34 - matComb._32; - ArrFrustumPlane[3].Distance = matComb._44 - matComb._42; - - ArrFrustumPlane[4].Normal.x = matComb._14 - matComb._13; - ArrFrustumPlane[4].Normal.y = matComb._24 - matComb._23; - ArrFrustumPlane[4].Normal.z = matComb._34 - matComb._33; - ArrFrustumPlane[4].Distance = matComb._44 - matComb._43; - - ArrFrustumPlane[5].Normal.x = matComb._14 + matComb._13; - ArrFrustumPlane[5].Normal.y = matComb._24 + matComb._23; - ArrFrustumPlane[5].Normal.z = matComb._34 + matComb._33; - ArrFrustumPlane[5].Distance = matComb._44 + matComb._43; + m_aFrustumPlanes[1].m_vNormal.x = matComb._14 + matComb._11; + m_aFrustumPlanes[1].m_vNormal.y = matComb._24 + matComb._21; + m_aFrustumPlanes[1].m_vNormal.z = matComb._34 + matComb._31; + m_aFrustumPlanes[1].m_fDistance = matComb._44 + matComb._41; + + m_aFrustumPlanes[2].m_vNormal.x = matComb._14 + matComb._12; + m_aFrustumPlanes[2].m_vNormal.y = matComb._24 + matComb._22; + m_aFrustumPlanes[2].m_vNormal.z = matComb._34 + matComb._32; + m_aFrustumPlanes[2].m_fDistance = matComb._44 + matComb._42; + + m_aFrustumPlanes[3].m_vNormal.x = matComb._14 - matComb._12; + m_aFrustumPlanes[3].m_vNormal.y = matComb._24 - matComb._22; + m_aFrustumPlanes[3].m_vNormal.z = matComb._34 - matComb._32; + m_aFrustumPlanes[3].m_fDistance = matComb._44 - matComb._42; + + m_aFrustumPlanes[4].m_vNormal.x = matComb._14 - matComb._13; + m_aFrustumPlanes[4].m_vNormal.y = matComb._24 - matComb._23; + m_aFrustumPlanes[4].m_vNormal.z = matComb._34 - matComb._33; + m_aFrustumPlanes[4].m_fDistance = matComb._44 - matComb._43; + + m_aFrustumPlanes[5].m_vNormal.x = matComb._14 + matComb._13; + m_aFrustumPlanes[5].m_vNormal.y = matComb._24 + matComb._23; + m_aFrustumPlanes[5].m_vNormal.z = matComb._34 + matComb._33; + m_aFrustumPlanes[5].m_fDistance = matComb._44 + matComb._43; //������������ ���������� for (int i = 0; i < 6; ++i) - ArrFrustumPlane[i].Normalize(); + m_aFrustumPlanes[i].normalize(); } -bool Frustum::PointInFrustum(const float3 *point) +bool CFrustum::pointInFrustum(const float3 *point) const { for (int i=0; i<6; i++) { - float tmp = ArrFrustumPlane[i].Normal.x*(point->x) + ArrFrustumPlane[i].Normal.y*(point->y) + ArrFrustumPlane[i].Normal.z*(point->z) + ArrFrustumPlane[i].Distance; + float tmp = m_aFrustumPlanes[i].m_vNormal.x*(point->x) + m_aFrustumPlanes[i].m_vNormal.y*(point->y) + m_aFrustumPlanes[i].m_vNormal.z*(point->z) + m_aFrustumPlanes[i].m_fDistance; if(long(tmp * 1000.0f) <= long(0 * 1000.0f)) { return false; @@ -63,99 +77,124 @@ bool Frustum::PointInFrustum(const float3 *point) return true; } -bool Frustum::PolyInFrustum(const float3* p1,const float3* p2,const float3* p3) +bool CFrustum::polyInFrustum(const float3* p1, const float3* p2, const float3* p3) const { - if(PointInFrustum(p1) || PointInFrustum(p2) || PointInFrustum(p3)) + if(pointInFrustum(p1) || pointInFrustum(p2) || pointInFrustum(p3)) return true; return false; } -bool Frustum::PolyInFrustumAbs(const float3* p1,const float3* p2,const float3* p3) +bool CFrustum::polyInFrustumAbs(const float3* p1, const float3* p2, const float3* p3) const { - if(PointInFrustum(p1) && PointInFrustum(p2) && PointInFrustum(p3)) + if(pointInFrustum(p1) && pointInFrustum(p2) && pointInFrustum(p3)) return true; return false; } -bool Frustum::SphereInFrustum(const float3 *point, float radius) const +bool CFrustum::sphereInFrustum(const float3 *point, float radius) const { for (int i=0; i<6; ++i) { - if (ArrFrustumPlane[i].Normal.x*point->x + ArrFrustumPlane[i].Normal.y*point->y + ArrFrustumPlane[i].Normal.z*point->z + ArrFrustumPlane[i].Distance <= -radius) + if (m_aFrustumPlanes[i].m_vNormal.x*point->x + m_aFrustumPlanes[i].m_vNormal.y*point->y + m_aFrustumPlanes[i].m_vNormal.z*point->z + m_aFrustumPlanes[i].m_fDistance <= -radius) return false; } return true; } -bool Frustum::SphereInFrustumAbs(const float3 *point, float radius) +bool CFrustum::sphereInFrustumAbs(const float3 *point, float radius) const { for (int i=0; i<6; i++) { - if (ArrFrustumPlane[i].Normal.x*point->x + ArrFrustumPlane[i].Normal.y*point->y + ArrFrustumPlane[i].Normal.z*point->z + ArrFrustumPlane[i].Distance > -radius) + if (m_aFrustumPlanes[i].m_vNormal.x*point->x + m_aFrustumPlanes[i].m_vNormal.y*point->y + m_aFrustumPlanes[i].m_vNormal.z*point->z + m_aFrustumPlanes[i].m_fDistance > -radius) return false; } return true; } -bool Frustum::BoxInFrustum(float3* min,float3* max) +bool CFrustum::boxInFrustum(float3* min, float3* max) const { for ( register int p = 0; p < 6; p++ ) { - if( ArrFrustumPlane[p].Normal.x * (min->x) + ArrFrustumPlane[p].Normal.y * (min->y) + ArrFrustumPlane[p].Normal.z * (min->z) + ArrFrustumPlane[p].Distance > 0 ) continue; - - if( ArrFrustumPlane[p].Normal.x * (min->x) + ArrFrustumPlane[p].Normal.y * (min->y) + ArrFrustumPlane[p].Normal.z * (max->z) + ArrFrustumPlane[p].Distance > 0 ) continue; - if( ArrFrustumPlane[p].Normal.x * (min->x) + ArrFrustumPlane[p].Normal.y * (max->y) + ArrFrustumPlane[p].Normal.z * (max->z) + ArrFrustumPlane[p].Distance > 0 ) continue; - if( ArrFrustumPlane[p].Normal.x * (max->x) + ArrFrustumPlane[p].Normal.y * (max->y) + ArrFrustumPlane[p].Normal.z * (max->z) + ArrFrustumPlane[p].Distance > 0 ) continue; - if( ArrFrustumPlane[p].Normal.x * (max->x) + ArrFrustumPlane[p].Normal.y * (min->y) + ArrFrustumPlane[p].Normal.z * (min->z) + ArrFrustumPlane[p].Distance > 0 ) continue; - if( ArrFrustumPlane[p].Normal.x * (max->x) + ArrFrustumPlane[p].Normal.y * (max->y) + ArrFrustumPlane[p].Normal.z * (min->z) + ArrFrustumPlane[p].Distance > 0 ) continue; - if( ArrFrustumPlane[p].Normal.x * (max->x) + ArrFrustumPlane[p].Normal.y * (min->y) + ArrFrustumPlane[p].Normal.z * (max->z) + ArrFrustumPlane[p].Distance > 0 ) continue; - if( ArrFrustumPlane[p].Normal.x * (min->x) + ArrFrustumPlane[p].Normal.y * (max->y) + ArrFrustumPlane[p].Normal.z * (min->z) + ArrFrustumPlane[p].Distance > 0 ) continue; + if( m_aFrustumPlanes[p].m_vNormal.x * (min->x) + m_aFrustumPlanes[p].m_vNormal.y * (min->y) + m_aFrustumPlanes[p].m_vNormal.z * (min->z) + m_aFrustumPlanes[p].m_fDistance > 0 ) continue; + + if( m_aFrustumPlanes[p].m_vNormal.x * (min->x) + m_aFrustumPlanes[p].m_vNormal.y * (min->y) + m_aFrustumPlanes[p].m_vNormal.z * (max->z) + m_aFrustumPlanes[p].m_fDistance > 0 ) continue; + if( m_aFrustumPlanes[p].m_vNormal.x * (min->x) + m_aFrustumPlanes[p].m_vNormal.y * (max->y) + m_aFrustumPlanes[p].m_vNormal.z * (max->z) + m_aFrustumPlanes[p].m_fDistance > 0 ) continue; + if( m_aFrustumPlanes[p].m_vNormal.x * (max->x) + m_aFrustumPlanes[p].m_vNormal.y * (max->y) + m_aFrustumPlanes[p].m_vNormal.z * (max->z) + m_aFrustumPlanes[p].m_fDistance > 0 ) continue; + if( m_aFrustumPlanes[p].m_vNormal.x * (max->x) + m_aFrustumPlanes[p].m_vNormal.y * (min->y) + m_aFrustumPlanes[p].m_vNormal.z * (min->z) + m_aFrustumPlanes[p].m_fDistance > 0 ) continue; + if( m_aFrustumPlanes[p].m_vNormal.x * (max->x) + m_aFrustumPlanes[p].m_vNormal.y * (max->y) + m_aFrustumPlanes[p].m_vNormal.z * (min->z) + m_aFrustumPlanes[p].m_fDistance > 0 ) continue; + if( m_aFrustumPlanes[p].m_vNormal.x * (max->x) + m_aFrustumPlanes[p].m_vNormal.y * (min->y) + m_aFrustumPlanes[p].m_vNormal.z * (max->z) + m_aFrustumPlanes[p].m_fDistance > 0 ) continue; + if( m_aFrustumPlanes[p].m_vNormal.x * (min->x) + m_aFrustumPlanes[p].m_vNormal.y * (max->y) + m_aFrustumPlanes[p].m_vNormal.z * (min->z) + m_aFrustumPlanes[p].m_fDistance > 0 ) continue; return false; } return true; } -///////////////////////// -Camera::Camera() +float3 CFrustum::getPoint(int iNumPoint) const +{ + if (iNumPoint >= 0 && iNumPoint < 8) + return m_aPoints[iNumPoint]; + + return float3(0, 0, 0); +} + +float3 CFrustum::getCenter() const +{ + return m_vCenter; +} + +void CFrustum::setPoint(int iNumPoint, const float3 *pPoint) +{ + if (iNumPoint >= 0 && iNumPoint < 8) + m_aPoints[iNumPoint] = *pPoint; +} + +void CFrustum::setCenter(const float3 *pCenter) +{ + m_vCenter = *pCenter; +} + +//########################################################################## + +CCamera::CCamera() { - Position = float3(0.0f, 0.0f, 0.0f); - Right = float3(1.0f, 0.0f, 0.0f); - Up = float3(0.0f, 1.0f, 0.0f); - Look = float3(0.0f, 0.0f, 1.0f); + m_vPosition = float3(0.0f, 0.0f, 0.0f); + m_vRight = float3(1.0f, 0.0f, 0.0f); + m_vUp = float3(0.0f, 1.0f, 0.0f); + m_vLook = float3(0.0f, 0.0f, 1.0f); - ObjFrustum = new Frustum(); + m_oFrustum = CFrustum(); m_vPitchYawRoll = float3_t(0, 0, 0); } -Camera::~Camera () +CCamera::~CCamera () { - mem_delete(ObjFrustum); + } -inline void Camera::PosLeftRight(float units) +void CCamera::posLeftRight(float units) { - Position += float3(Right.x, 0.0f, Right.z) * units; - LastVal.x = units; + m_vPosition += float3(m_vRight.x, 0.0f, m_vRight.z) * units; + //LastVal.x = units; } -inline void Camera::PosUpDown(float units) +void CCamera::posUpDown(float units) { - Position.y += Up.y * units; + m_vPosition.y += m_vUp.y * units; } -inline void Camera::PosFrontBack(float units) +void CCamera::posFrontBack(float units) { - Position += float3(Look.x, 0.0f, Look.z) * units; - LastVal.z = units; + m_vPosition += float3(m_vLook.x, 0.0f, m_vLook.z) * units; + //LastVal.z = units; } -inline void Camera::RotUpDown(float angle) +void CCamera::rotUpDown(float angle) { m_vPitchYawRoll.x -= angle; if(m_vPitchYawRoll.x > SM_PIDIV2) @@ -167,10 +206,10 @@ inline void Camera::RotUpDown(float angle) m_vPitchYawRoll.x = -SM_PIDIV2; } - UpdateView(); + updateView(); } -inline void Camera::RotRightLeft(float angle) +void CCamera::rotRightLeft(float angle) { m_vPitchYawRoll.y -= angle; while(m_vPitchYawRoll.y < 0.0f) @@ -182,105 +221,116 @@ inline void Camera::RotRightLeft(float angle) m_vPitchYawRoll.y -= SM_2PI; } - UpdateView(); + updateView(); } -inline void Camera::Roll(float angle) +void CCamera::roll(float angle) { m_vPitchYawRoll.z -= angle; - UpdateView(); + updateView(); } -inline void Camera::UpdateView() +void CCamera::updateView() { SMQuaternion q = SMQuaternion(m_vPitchYawRoll.x, 'x') * SMQuaternion(m_vPitchYawRoll.y, 'y') * SMQuaternion(m_vPitchYawRoll.z, 'z'); - Right = q * float3(1.0f, 0.0f, 0.0f); - Up = q * float3(0.0f, 1.0f, 0.0f); - Look = q * float3(0.0f, 0.0f, 1.0f); + m_vRight = q * float3(1.0f, 0.0f, 0.0f); + m_vUp = q * float3(0.0f, 1.0f, 0.0f); + m_vLook = q * float3(0.0f, 0.0f, 1.0f); } -inline void Camera::SetOrientation(const SMQuaternion & q) +void CCamera::setOrientation(const SMQuaternion *q) { - m_vPitchYawRoll = SMMatrixToEuler(q.GetMatrix()); + m_vPitchYawRoll = SMMatrixToEuler(q->GetMatrix()); - Right = q * float3(1.0f, 0.0f, 0.0f); - Up = q * float3(0.0f, 1.0f, 0.0f); - Look = q * float3(0.0f, 0.0f, 1.0f); + m_vRight = (*q) * float3(1.0f, 0.0f, 0.0f); + m_vUp = (*q) * float3(0.0f, 1.0f, 0.0f); + m_vLook = (*q) * float3(0.0f, 0.0f, 1.0f); } -inline void Camera::GetViewMatrix(float4x4* view_matrix) +void CCamera::getViewMatrix(float4x4* view_matrix) { - *view_matrix = SMMatrixLookToLH(Position, Look, Up); + m_mView = SMMatrixLookToLH(m_vPosition, m_vLook, m_vUp); + *view_matrix = m_mView;// SMMatrixLookToLH(m_vPosition, m_vLook, m_vUp); } -inline void Camera::GetPosition(float3* pos) +void CCamera::getPosition(float3* pos) const { - *pos = Position; + *pos = m_vPosition; } -inline void Camera::SetPosition(float3* pos) +void CCamera::setPosition(const float3* pos) { - Position = *pos; + m_vPosition = *pos; } -inline void Camera::GetDirection(float3* dir) +void CCamera::getDirection(float3* dir) const { - + *dir = m_vLook; } -inline void Camera::SetDirection(float3* dir) +/*void CCamera::setDirection(const float3* dir) { - -} + m_vLook = *dir; +}*/ -inline void Camera::GetRight(float3* right) +void CCamera::getRight(float3* right) const { - *right = Right; + *right = m_vRight; } -inline void Camera::GetUp(float3* up) +void CCamera::getUp(float3* up) const { - *up = Up; + *up = m_vUp; } -inline void Camera::GetLook(float3* look) +void CCamera::getLook(float3* look) const { - *look = Look; + *look = m_vLook; } -inline void Camera::GetRotation(float3* rot) +void CCamera::getRotation(float3* rot) const { *rot = m_vPitchYawRoll; } -inline float Camera::GetRotationX() +float CCamera::getRotationX() const { return m_vPitchYawRoll.x; } -inline float Camera::GetRotationY() +float CCamera::getRotationY() const { return m_vPitchYawRoll.y; } -inline float Camera::GetRotationZ() +float CCamera::getRotationZ() const { return m_vPitchYawRoll.z; } -inline void Camera::SetFOV(float fov) +void CCamera::setFOV(float fov) { m_fFOV = fov; } -inline float Camera::GetFOV() +float CCamera::getFOV() const { return(m_fFOV); } + +void CCamera::updateFrustum(const float4x4 *pProjection) +{ + m_oFrustum.update(&m_mView, pProjection); +} + +const ISXFrustum* CCamera::getFrustum() +{ + return &m_oFrustum; +} \ No newline at end of file diff --git a/source/gcore/camera.h b/source/gcore/camera.h index 173ae37c51a6b08b78868f77b8369efc47eddf32..be7842ec5a1e3cf9a5c7ef6e51cc127363b090a7 100644 --- a/source/gcore/camera.h +++ b/source/gcore/camera.h @@ -1,69 +1,107 @@ -#ifndef _CAMERA_H_ -#define _CAMERA_H_ + +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + +#ifndef __CAMERA_H +#define __CAMERA_H #include "sxgcore.h" //����� ����������� ������� -class Frustum : public virtual ISXFrustum +class CFrustum : public virtual ISXFrustum { public: - Frustum(); - ~Frustum(); + CFrustum(); + ~CFrustum(); void Release(){ mem_del(this); } SX_ALIGNED_OP_MEM - void Update(const float4x4* view,const float4x4* proj); + void update(const float4x4 *pView,const float4x4 *pProj); - bool PointInFrustum(const float3 *point); - bool PolyInFrustum(const float3* p1,const float3* p2,const float3* p3); - bool PolyInFrustumAbs(const float3* p1,const float3* p2,const float3* p3); + bool pointInFrustum(const float3 *pPoint) const; + bool polyInFrustum(const float3 *pPount1, const float3 *pPount2, const float3 *pPount3) const; + bool polyInFrustumAbs(const float3 *pPount1, const float3 *pPount2, const float3 *pPount3) const; - bool SphereInFrustum(const float3 *point, float radius) const; + bool sphereInFrustum(const float3 *pPount, float fRadius) const; + + bool sphereInFrustumAbs(const float3 *pPount, float fRadius) const; + bool boxInFrustum(float3 *pMin, float3 *pMax) const; + - bool SphereInFrustumAbs(const float3 *point, float radius); - bool BoxInFrustum(float3* min,float3* max); + float3 getPoint(int iNumPoint) const; + float3 getCenter() const; + void setPoint(int iNumPoint, const float3 *pPoint); + void setCenter(const float3 *pCenter); + +private: + + CSXFrustumPlane m_aFrustumPlanes[6]; + + float3 m_aPoints[8]; + float3 m_vCenter; }; -///////////////////// -class Camera : public virtual ISXCamera +//************************************************************************** + +class CCamera : public virtual ISXCamera { public: - Camera (); - ~Camera (); + CCamera (); + ~CCamera (); void Release(){ mem_del(this); } SX_ALIGNED_OP_MEM - void PosLeftRight(float units); //�����/������ - void PosUpDown(float units); //�����/���� - void PosFrontBack(float units); //������/����� + void posLeftRight(float fUnits);//�����/������ + void posUpDown(float fUnits); //�����/���� + void posFrontBack(float fUnits);//������/����� - void RotUpDown(float angle); //�������� �����/���� - void RotRightLeft(float angle); //�������� ������/����� - void Roll(float angle); //���� - void SetOrientation(const SMQuaternion & q); + void rotUpDown(float fAngle); //�������� �����/���� + void rotRightLeft(float fAngle);//�������� ������/����� + void roll(float fAngle); //���� + void setOrientation(const SMQuaternion *pQuaternion); - void GetViewMatrix(float4x4* view_matrix);//�������� ������� ���� + void getViewMatrix(float4x4 *pMatrix);//�������� ������� ���� - void GetPosition(float3* pos); - void SetPosition(float3* pos); + void getPosition(float3 *pPos) const; + void setPosition(const float3 *pPos); - void GetDirection(float3* dir); - void SetDirection(float3* dir); + void getDirection(float3 *pDir) const; + //void setDirection(const float3 *pDir); - void GetRight(float3* right); - void GetUp(float3* up); - void GetLook(float3* look); - void GetRotation(float3* rot); + void getRight(float3 *pRight) const; + void getUp(float3 *pUp) const; + void getLook(float3 *pLook) const; + void getRotation(float3 *pRot) const; + + float getRotationX() const; + float getRotationY() const; + float getRotationZ() const; + + void setFOV(float fFOV); + float getFOV() const; + + void updateView(); + + void updateFrustum(const float4x4 *pmProjection); + const ISXFrustum* getFrustum(); + +protected: + CFrustum m_oFrustum; //!< ������� ���� ������ + + float3 m_vRight; + float3 m_vUp; + float3 m_vLook; + + float3 m_vPosition; - float GetRotationX(); - float GetRotationY(); - float GetRotationZ(); + float3_t m_vPitchYawRoll; - void SetFOV(float fov); - float GetFOV(); + float4x4 m_mView; - void UpdateView(); + float m_fFOV; }; #endif diff --git a/source/gcore/creatortextures.h b/source/gcore/creatortextures.h index 0a6e947eb2c3848d7a7016d3f2ddb64ea8c7f6da..9a3934639c018d68fe71629ea2811ea0859815e2 100644 --- a/source/gcore/creatortextures.h +++ b/source/gcore/creatortextures.h @@ -1,4 +1,9 @@ +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #ifndef __CREATORTEXTURES_H #define __CREATORTEXTURES_H @@ -7,7 +12,6 @@ #include <d3d9.h> #include <common/array.h> -extern report_func g_fnReportf; extern IDirect3DDevice9 *g_pDXDevice; extern D3DPRESENT_PARAMETERS g_oD3DAPP; diff --git a/source/gcore/loader_static.cpp b/source/gcore/loader_static.cpp index ad5ea9521d4e24db0ea1197994cd4381304f42bb..7764729b0fb0432a0473979b0bea17bfa58343ea 100644 --- a/source/gcore/loader_static.cpp +++ b/source/gcore/loader_static.cpp @@ -1,4 +1,9 @@ +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include "loader_static.h" ISXDataStaticModel* SGCore_StaticModelCr() @@ -15,7 +20,7 @@ void SGCore_StaticModelLoad(const char * file, ISXDataStaticModel** data) { if (!data) { - g_fnReportf(REPORT_MSG_LEVEL_ERROR, "%s: %s - �an not initialize a null pointer 'data', load model '%s'\n", SX_LIB_NAME, GEN_MSG_LOCATION, file); + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - �an not initialize a null pointer 'data', load model '%s'\n", GEN_MSG_LOCATION, file); return; } @@ -23,7 +28,7 @@ void SGCore_StaticModelLoad(const char * file, ISXDataStaticModel** data) FILE * pf = fopen(file, "rb"); if (!pf) { - g_fnReportf(REPORT_MSG_LEVEL_ERROR, "%s: %s - unable to open model file '%s'\n", SX_LIB_NAME, GEN_MSG_LOCATION, file); + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - unable to open model file '%s'\n", GEN_MSG_LOCATION, file); return; } @@ -33,26 +38,26 @@ void SGCore_StaticModelLoad(const char * file, ISXDataStaticModel** data) if (header.Magick != SX_MODEL_MAGICK) { - g_fnReportf(REPORT_MSG_LEVEL_ERROR, "%s: %s - unsupported file type '%s'\n", SX_LIB_NAME, GEN_MSG_LOCATION, file); + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - unsupported file type '%s'\n", GEN_MSG_LOCATION, file); fclose(pf); return; } if (!(header.iVersion == SX_MODEL_VERSION_OLD || header.iVersion == SX_MODEL_VERSION)) { - g_fnReportf(REPORT_MSG_LEVEL_ERROR, "%s: %s - unsupported file '%s' version %d'\n", SX_LIB_NAME, GEN_MSG_LOCATION, header.iVersion, file); + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - unsupported file '%s' version %d'\n", GEN_MSG_LOCATION, header.iVersion, file); fclose(pf); return; } if (header.iVersion == SX_MODEL_VERSION_OLD) { - (*data)->ArrTextures = NULL; + (*data)->m_ppTextures = NULL; Array<String> tex; if (header.iMaterialsOffset) { fseek(pf, header.iMaterialsOffset, SEEK_SET); - (*data)->ArrTextures = new char*[header.iMaterialCount]; + (*data)->m_ppTextures = new char*[header.iMaterialCount]; for (int i = 0; i < header.iMaterialCount; i++) { char c; @@ -72,11 +77,11 @@ void SGCore_StaticModelLoad(const char * file, ISXDataStaticModel** data) fread(&lh.iSubMeshCount, sizeof(int), 1, pf); lh.pSubLODmeshes = new ModelLoDSubset[lh.iSubMeshCount]; - (*data)->SubsetCount = lh.iSubMeshCount; - (*data)->StartIndex = new UINT[lh.iSubMeshCount]; - (*data)->IndexCount = new UINT[lh.iSubMeshCount]; - (*data)->StartVertex = new UINT[lh.iSubMeshCount]; - (*data)->VertexCount = new UINT[lh.iSubMeshCount]; + (*data)->m_uiSubsetCount = lh.iSubMeshCount; + (*data)->m_pStartIndex = new UINT[lh.iSubMeshCount]; + (*data)->m_pIndexCount = new UINT[lh.iSubMeshCount]; + (*data)->m_pStartVertex = new UINT[lh.iSubMeshCount]; + (*data)->m_pVertexCount = new UINT[lh.iSubMeshCount]; int iVC = 0; for (int i = 0; i < lh.iSubMeshCount; i++) { @@ -90,8 +95,8 @@ void SGCore_StaticModelLoad(const char * file, ISXDataStaticModel** data) iVC += lh.pSubLODmeshes[i].iVectexCount; - (*data)->ArrTextures[i] = new char[tex[lh.pSubLODmeshes[i].iMaterialID].length() + 1]; - memcpy((*data)->ArrTextures[i], tex[lh.pSubLODmeshes[i].iMaterialID].c_str(), (tex[lh.pSubLODmeshes[i].iMaterialID].length() + 1) * sizeof(char)); + (*data)->m_ppTextures[i] = new char[tex[lh.pSubLODmeshes[i].iMaterialID].length() + 1]; + memcpy((*data)->m_ppTextures[i], tex[lh.pSubLODmeshes[i].iMaterialID].c_str(), (tex[lh.pSubLODmeshes[i].iMaterialID].length() + 1) * sizeof(char)); } UINT iStartIndex = 0; @@ -99,10 +104,10 @@ void SGCore_StaticModelLoad(const char * file, ISXDataStaticModel** data) for (int i = 0; i < lh.iSubMeshCount; i++) { - (*data)->StartIndex[i] = iStartIndex; - (*data)->StartVertex[i] = iStartVertex; - (*data)->IndexCount[i] = lh.pSubLODmeshes[i].iIndexCount; - (*data)->VertexCount[i] = lh.pSubLODmeshes[i].iVectexCount; + (*data)->m_pStartIndex[i] = iStartIndex; + (*data)->m_pStartVertex[i] = iStartVertex; + (*data)->m_pIndexCount[i] = lh.pSubLODmeshes[i].iIndexCount; + (*data)->m_pVertexCount[i] = lh.pSubLODmeshes[i].iVectexCount; lh.pSubLODmeshes[i].iStartIndex = iStartIndex; lh.pSubLODmeshes[i].iStartVertex = iStartVertex; @@ -126,11 +131,11 @@ void SGCore_StaticModelLoad(const char * file, ISXDataStaticModel** data) memcpy(pVertices + lh.pSubLODmeshes[i].iStartVertex, lh.pSubLODmeshes[i].pVertices, sizeof(vertex_animated_ex)* lh.pSubLODmeshes[i].iVectexCount); } - (*data)->AllVertexCount = iStartVertex; - g_pDXDevice->CreateVertexBuffer(sizeof(vertex_static)* iStartVertex, NULL, NULL, D3DPOOL_MANAGED, &(*data)->VertexBuffer, 0); + (*data)->m_uiAllVertexCount = iStartVertex; + g_pDXDevice->CreateVertexBuffer(sizeof(vertex_static)* iStartVertex, NULL, NULL, D3DPOOL_MANAGED, &(*data)->m_pVertexBuffer, 0); //(*data)->ArrVertBuf = new vertex_static[iStartVertex]; vertex_static * pData; - if (!FAILED((*data)->VertexBuffer->Lock(0, sizeof(vertex_static)* iStartVertex, (void**)&pData, 0))) + if (!FAILED((*data)->m_pVertexBuffer->Lock(0, sizeof(vertex_static)* iStartVertex, (void**)&pData, 0))) { for (DWORD i = 0; i < lh.iSubMeshCount; i++) { @@ -140,18 +145,18 @@ void SGCore_StaticModelLoad(const char * file, ISXDataStaticModel** data) //memcpy((*data)->ArrVertBuf + lh.pSubLODmeshes[i].iStartVertex + k, pVertices + lh.pSubLODmeshes[i].iStartVertex + k, sizeof(vertex_static)); } } - (*data)->VertexBuffer->Unlock(); + (*data)->m_pVertexBuffer->Unlock(); } - (*data)->AllIndexCount = iStartIndex; + (*data)->m_uiAllIndexCount = iStartIndex; DWORD tmpCountIndecex = 0; - g_pDXDevice->CreateIndexBuffer(sizeof(UINT)* iStartIndex, NULL, D3DFMT_INDEX32, D3DPOOL_MANAGED, &(*data)->IndexBuffer, 0); + g_pDXDevice->CreateIndexBuffer(sizeof(UINT)* iStartIndex, NULL, D3DFMT_INDEX32, D3DPOOL_MANAGED, &(*data)->m_pIndexBuffer, 0); //(*data)->ArrIndBuf = new UINT[iStartIndex]; - if (!FAILED((*data)->IndexBuffer->Lock(0, sizeof(UINT)* iStartIndex, (void**)&pData, 0))) + if (!FAILED((*data)->m_pIndexBuffer->Lock(0, sizeof(UINT)* iStartIndex, (void**)&pData, 0))) { memcpy(pData, pIndices, sizeof(UINT)* iStartIndex); //memcpy((*data)->ArrIndBuf, pIndices, sizeof(UINT)* iStartIndex); - (*data)->IndexBuffer->Unlock(); + (*data)->m_pIndexBuffer->Unlock(); } for (int i = 0; i < lh.iSubMeshCount; i++) @@ -167,12 +172,12 @@ void SGCore_StaticModelLoad(const char * file, ISXDataStaticModel** data) } else if (header.iVersion == SX_MODEL_VERSION) { - (*data)->ArrTextures = NULL; + (*data)->m_ppTextures = NULL; Array<String> tex; if (header.iMaterialsOffset) { fseek(pf, header.iMaterialsOffset, SEEK_SET); - (*data)->ArrTextures = new char*[header.iMaterialCount]; + (*data)->m_ppTextures = new char*[header.iMaterialCount]; for (int i = 0; i < header.iMaterialCount; i++) { char c[MODEL_MAX_NAME]; @@ -212,11 +217,11 @@ void SGCore_StaticModelLoad(const char * file, ISXDataStaticModel** data) } } - (*data)->SubsetCount = m_pLods[0].iSubMeshCount; - (*data)->StartIndex = new UINT[m_pLods[0].iSubMeshCount]; - (*data)->IndexCount = new UINT[m_pLods[0].iSubMeshCount]; - (*data)->StartVertex = new UINT[m_pLods[0].iSubMeshCount]; - (*data)->VertexCount = new UINT[m_pLods[0].iSubMeshCount]; + (*data)->m_uiSubsetCount = m_pLods[0].iSubMeshCount; + (*data)->m_pStartIndex = new UINT[m_pLods[0].iSubMeshCount]; + (*data)->m_pIndexCount = new UINT[m_pLods[0].iSubMeshCount]; + (*data)->m_pStartVertex = new UINT[m_pLods[0].iSubMeshCount]; + (*data)->m_pVertexCount = new UINT[m_pLods[0].iSubMeshCount]; UINT iStartIndex = 0; UINT iStartVertex = 0; @@ -224,10 +229,10 @@ void SGCore_StaticModelLoad(const char * file, ISXDataStaticModel** data) for (int i = 0; i < lh.iSubMeshCount; i++) { - (*data)->StartIndex[i] = iStartIndex; - (*data)->StartVertex[i] = iStartVertex; - (*data)->IndexCount[i] = lh.pSubLODmeshes[i].iIndexCount; - (*data)->VertexCount[i] = lh.pSubLODmeshes[i].iVectexCount; + (*data)->m_pStartIndex[i] = iStartIndex; + (*data)->m_pStartVertex[i] = iStartVertex; + (*data)->m_pIndexCount[i] = lh.pSubLODmeshes[i].iIndexCount; + (*data)->m_pVertexCount[i] = lh.pSubLODmeshes[i].iVectexCount; lh.pSubLODmeshes[i].iStartIndex = iStartIndex; lh.pSubLODmeshes[i].iStartVertex = iStartVertex; @@ -239,8 +244,8 @@ void SGCore_StaticModelLoad(const char * file, ISXDataStaticModel** data) iStartIndex += lh.pSubLODmeshes[i].iIndexCount; iStartVertex += lh.pSubLODmeshes[i].iVectexCount; - (*data)->ArrTextures[i] = new char[tex[lh.pSubLODmeshes[i].iMaterialID].length() + 1]; - memcpy((*data)->ArrTextures[i], tex[lh.pSubLODmeshes[i].iMaterialID].c_str(), (tex[lh.pSubLODmeshes[i].iMaterialID].length() + 1) * sizeof(char)); + (*data)->m_ppTextures[i] = new char[tex[lh.pSubLODmeshes[i].iMaterialID].length() + 1]; + memcpy((*data)->m_ppTextures[i], tex[lh.pSubLODmeshes[i].iMaterialID].c_str(), (tex[lh.pSubLODmeshes[i].iMaterialID].length() + 1) * sizeof(char)); } UINT * pIndices = new UINT[iStartIndex]; @@ -252,26 +257,26 @@ void SGCore_StaticModelLoad(const char * file, ISXDataStaticModel** data) memcpy(pVertices + lh.pSubLODmeshes[i].iStartVertex, lh.pSubLODmeshes[i].pVertices, sizeof(vertex_static)* lh.pSubLODmeshes[i].iVectexCount); } - (*data)->AllVertexCount = iStartVertex; - g_pDXDevice->CreateVertexBuffer(sizeof(vertex_static)* iStartVertex, NULL, NULL, D3DPOOL_MANAGED, &(*data)->VertexBuffer, 0); + (*data)->m_uiAllVertexCount = iStartVertex; + g_pDXDevice->CreateVertexBuffer(sizeof(vertex_static)* iStartVertex, NULL, NULL, D3DPOOL_MANAGED, &(*data)->m_pVertexBuffer, 0); //(*data)->ArrVertBuf = new vertex_static[iStartVertex]; vertex_static * pData; - if (!FAILED((*data)->VertexBuffer->Lock(0, sizeof(vertex_static)* iStartVertex, (void**)&pData, 0))) + if (!FAILED((*data)->m_pVertexBuffer->Lock(0, sizeof(vertex_static)* iStartVertex, (void**)&pData, 0))) { memcpy(pData, pVertices, sizeof(vertex_static)* iStartVertex); //memcpy((*data)->ArrVertBuf, pVertices, sizeof(vertex_static)* iStartVertex); - (*data)->VertexBuffer->Unlock(); + (*data)->m_pVertexBuffer->Unlock(); } - (*data)->AllIndexCount = iStartIndex; - g_pDXDevice->CreateIndexBuffer(sizeof(UINT)* iStartIndex, NULL, D3DFMT_INDEX32, D3DPOOL_MANAGED, &(*data)->IndexBuffer, 0); + (*data)->m_uiAllIndexCount = iStartIndex; + g_pDXDevice->CreateIndexBuffer(sizeof(UINT)* iStartIndex, NULL, D3DFMT_INDEX32, D3DPOOL_MANAGED, &(*data)->m_pIndexBuffer, 0); //(*data)->ArrIndBuf = new UINT[iStartIndex]; - if (!FAILED((*data)->IndexBuffer->Lock(0, sizeof(UINT)* iStartIndex, (void**)&pData, 0))) + if (!FAILED((*data)->m_pIndexBuffer->Lock(0, sizeof(UINT)* iStartIndex, (void**)&pData, 0))) { memcpy(pData, pIndices, sizeof(UINT)* iStartIndex); //memcpy((*data)->ArrIndBuf, pIndices, sizeof(UINT)* iStartIndex); - (*data)->IndexBuffer->Unlock(); + (*data)->m_pIndexBuffer->Unlock(); } @@ -295,17 +300,17 @@ void SGCore_StaticModelLoad(const char * file, ISXDataStaticModel** data) //���������� �������� //{{ DataStaticModel* tmpmodel = new DataStaticModel(); - tmpmodel->SubsetCount = 0; - tmpmodel->ArrTextures = new char*[(*data)->SubsetCount]; - memset(tmpmodel->ArrTextures, 0, (*data)->SubsetCount * sizeof(char)); + tmpmodel->m_uiSubsetCount = 0; + tmpmodel->m_ppTextures = new char*[(*data)->m_uiSubsetCount]; + memset(tmpmodel->m_ppTextures, 0, (*data)->m_uiSubsetCount * sizeof(char)); - vertex_static* ArrVertBuf = new vertex_static[(*data)->AllVertexCount]; - UINT* ArrIndBuf = new UINT[(*data)->AllIndexCount]; + vertex_static* ArrVertBuf = new vertex_static[(*data)->m_uiAllVertexCount]; + UINT* ArrIndBuf = new UINT[(*data)->m_uiAllIndexCount]; - tmpmodel->StartIndex = new UINT[(*data)->SubsetCount]; - tmpmodel->StartVertex = new UINT[(*data)->SubsetCount]; - tmpmodel->IndexCount = new UINT[(*data)->SubsetCount]; - tmpmodel->VertexCount = new UINT[(*data)->SubsetCount]; + tmpmodel->m_pStartIndex = new UINT[(*data)->m_uiSubsetCount]; + tmpmodel->m_pStartVertex = new UINT[(*data)->m_uiSubsetCount]; + tmpmodel->m_pIndexCount = new UINT[(*data)->m_uiSubsetCount]; + tmpmodel->m_pVertexCount = new UINT[(*data)->m_uiSubsetCount]; long startindex = 0; long startvertex = 0; @@ -316,117 +321,117 @@ void SGCore_StaticModelLoad(const char * file, ISXDataStaticModel** data) vertex_static* pVert; UINT* pInd; - (*data)->VertexBuffer->Lock(0, 0, (void**)&pVert, 0); + (*data)->m_pVertexBuffer->Lock(0, 0, (void**)&pVert, 0); - (*data)->IndexBuffer->Lock(0, 0, (void**)&pInd, 0); + (*data)->m_pIndexBuffer->Lock(0, 0, (void**)&pInd, 0); - for (long i = 0; i < (*data)->SubsetCount; ++i) + for (long i = 0; i < (*data)->m_uiSubsetCount; ++i) { - if ((*data)->ArrTextures[i][0] == 0) + if ((*data)->m_ppTextures[i][0] == 0) continue; - tmpmodel->ArrTextures[tmpmodel->SubsetCount] = new char[strlen((*data)->ArrTextures[i]) + 1]; - strcpy(tmpmodel->ArrTextures[tmpmodel->SubsetCount], (*data)->ArrTextures[i]); + tmpmodel->m_ppTextures[tmpmodel->m_uiSubsetCount] = new char[strlen((*data)->m_ppTextures[i]) + 1]; + strcpy(tmpmodel->m_ppTextures[tmpmodel->m_uiSubsetCount], (*data)->m_ppTextures[i]); startvertex = countvertex; startindex = countindex; - tmpmodel->StartIndex[tmpmodel->SubsetCount] = startindex; - tmpmodel->StartVertex[tmpmodel->SubsetCount] = startvertex; + tmpmodel->m_pStartIndex[tmpmodel->m_uiSubsetCount] = startindex; + tmpmodel->m_pStartVertex[tmpmodel->m_uiSubsetCount] = startvertex; - memcpy(ArrVertBuf + startvertex, pVert + (*data)->StartVertex[i], sizeof(vertex_static)* (*data)->VertexCount[i]); - memcpy(ArrIndBuf + startindex, pInd + (*data)->StartIndex[i], sizeof(UINT)* (*data)->IndexCount[i]); + memcpy(ArrVertBuf + startvertex, pVert + (*data)->m_pStartVertex[i], sizeof(vertex_static)* (*data)->m_pVertexCount[i]); + memcpy(ArrIndBuf + startindex, pInd + (*data)->m_pStartIndex[i], sizeof(UINT)* (*data)->m_pIndexCount[i]); - for (long j = 0; j < (*data)->IndexCount[i]; ++j) + for (long j = 0; j < (*data)->m_pIndexCount[i]; ++j) { - ArrIndBuf[countindex + j] = countvertex + (pInd[(*data)->StartIndex[i] + j] - (*data)->StartVertex[i]); + ArrIndBuf[countindex + j] = countvertex + (pInd[(*data)->m_pStartIndex[i] + j] - (*data)->m_pStartVertex[i]); } - countvertex += (*data)->VertexCount[i]; - countindex += (*data)->IndexCount[i]; + countvertex += (*data)->m_pVertexCount[i]; + countindex += (*data)->m_pIndexCount[i]; - for (long k = i + 1; k < (*data)->SubsetCount; ++k) + for (long k = i + 1; k < (*data)->m_uiSubsetCount; ++k) { - if (strcmp((*data)->ArrTextures[i], (*data)->ArrTextures[k]) == 0) + if (strcmp((*data)->m_ppTextures[i], (*data)->m_ppTextures[k]) == 0) { - (*data)->ArrTextures[k][0] = 0; - memcpy(ArrVertBuf + countvertex, pVert + (*data)->StartVertex[k], sizeof(vertex_static)* (*data)->VertexCount[k]); + (*data)->m_ppTextures[k][0] = 0; + memcpy(ArrVertBuf + countvertex, pVert + (*data)->m_pStartVertex[k], sizeof(vertex_static)* (*data)->m_pVertexCount[k]); - memcpy(ArrIndBuf + countindex, pInd + (*data)->StartIndex[k], sizeof(UINT)* (*data)->IndexCount[k]); + memcpy(ArrIndBuf + countindex, pInd + (*data)->m_pStartIndex[k], sizeof(UINT)* (*data)->m_pIndexCount[k]); - for (long j = 0; j < (*data)->IndexCount[k]; ++j) + for (long j = 0; j < (*data)->m_pIndexCount[k]; ++j) { - ArrIndBuf[countindex + j] = countvertex + (pInd[(*data)->StartIndex[k] + j] - (*data)->StartVertex[k]); + ArrIndBuf[countindex + j] = countvertex + (pInd[(*data)->m_pStartIndex[k] + j] - (*data)->m_pStartVertex[k]); } - countvertex += (*data)->VertexCount[k]; - countindex += (*data)->IndexCount[k]; + countvertex += (*data)->m_pVertexCount[k]; + countindex += (*data)->m_pIndexCount[k]; } } - tmpmodel->VertexCount[tmpmodel->SubsetCount] = countvertex - startvertex; - tmpmodel->IndexCount[tmpmodel->SubsetCount] = countindex - startindex; + tmpmodel->m_pVertexCount[tmpmodel->m_uiSubsetCount] = countvertex - startvertex; + tmpmodel->m_pIndexCount[tmpmodel->m_uiSubsetCount] = countindex - startindex; - ++tmpmodel->SubsetCount; + ++tmpmodel->m_uiSubsetCount; } - (*data)->VertexBuffer->Unlock(); - (*data)->IndexBuffer->Unlock(); + (*data)->m_pVertexBuffer->Unlock(); + (*data)->m_pIndexBuffer->Unlock(); - tmpmodel->AllIndexCount = countindex; - tmpmodel->AllVertexCount = countvertex; + tmpmodel->m_uiAllIndexCount = countindex; + tmpmodel->m_uiAllVertexCount = countvertex; - g_pDXDevice->CreateVertexBuffer(sizeof(vertex_static)* countvertex, NULL, NULL, D3DPOOL_MANAGED, &tmpmodel->VertexBuffer, 0); + g_pDXDevice->CreateVertexBuffer(sizeof(vertex_static)* countvertex, NULL, NULL, D3DPOOL_MANAGED, &tmpmodel->m_pVertexBuffer, 0); vertex_static * pData; - if (!FAILED(tmpmodel->VertexBuffer->Lock(0, sizeof(vertex_static)* countvertex, (void**)&pData, 0))) + if (!FAILED(tmpmodel->m_pVertexBuffer->Lock(0, sizeof(vertex_static)* countvertex, (void**)&pData, 0))) { memcpy(pData, ArrVertBuf, sizeof(vertex_static)* countvertex); float3_t tmppos = pData[0].Pos; - tmpmodel->BBMax = tmppos; - tmpmodel->BBMin = tmppos; + tmpmodel->m_vBBMax = tmppos; + tmpmodel->m_vBBMin = tmppos; float3_t pos; for (long i = 0; i<countvertex; i++) { pos = pData[i].Pos; - if (pos.x > tmpmodel->BBMax.x) - tmpmodel->BBMax.x = pos.x; + if (pos.x > tmpmodel->m_vBBMax.x) + tmpmodel->m_vBBMax.x = pos.x; - if (pos.y > tmpmodel->BBMax.y) - tmpmodel->BBMax.y = pos.y; + if (pos.y > tmpmodel->m_vBBMax.y) + tmpmodel->m_vBBMax.y = pos.y; - if (pos.z > tmpmodel->BBMax.z) - tmpmodel->BBMax.z = pos.z; + if (pos.z > tmpmodel->m_vBBMax.z) + tmpmodel->m_vBBMax.z = pos.z; - if (pos.x < tmpmodel->BBMin.x) - tmpmodel->BBMin.x = pos.x; + if (pos.x < tmpmodel->m_vBBMin.x) + tmpmodel->m_vBBMin.x = pos.x; - if (pos.y < tmpmodel->BBMin.y) - tmpmodel->BBMin.y = pos.y; + if (pos.y < tmpmodel->m_vBBMin.y) + tmpmodel->m_vBBMin.y = pos.y; - if (pos.z < tmpmodel->BBMin.z) - tmpmodel->BBMin.z = pos.z; + if (pos.z < tmpmodel->m_vBBMin.z) + tmpmodel->m_vBBMin.z = pos.z; } - float3 Center = (tmpmodel->BBMin + tmpmodel->BBMax) * 0.5f; - tmpmodel->BSphere.x = Center.x; - tmpmodel->BSphere.y = Center.y; - tmpmodel->BSphere.z = Center.z; - tmpmodel->BSphere.w = SMVector3Length(Center - tmpmodel->BBMax); + float3 Center = (tmpmodel->m_vBBMin + tmpmodel->m_vBBMax) * 0.5f; + tmpmodel->m_vBSphere.x = Center.x; + tmpmodel->m_vBSphere.y = Center.y; + tmpmodel->m_vBSphere.z = Center.z; + tmpmodel->m_vBSphere.w = SMVector3Length(Center - tmpmodel->m_vBBMax); - tmpmodel->VertexBuffer->Unlock(); + tmpmodel->m_pVertexBuffer->Unlock(); } - g_pDXDevice->CreateIndexBuffer(sizeof(UINT)* countindex, NULL, D3DFMT_INDEX32, D3DPOOL_MANAGED, &tmpmodel->IndexBuffer, 0); + g_pDXDevice->CreateIndexBuffer(sizeof(UINT)* countindex, NULL, D3DFMT_INDEX32, D3DPOOL_MANAGED, &tmpmodel->m_pIndexBuffer, 0); - if (!FAILED(tmpmodel->IndexBuffer->Lock(0, sizeof(UINT)* countindex, (void**)&pData, 0))) + if (!FAILED(tmpmodel->m_pIndexBuffer->Lock(0, sizeof(UINT)* countindex, (void**)&pData, 0))) { memcpy(pData, ArrIndBuf, sizeof(UINT)* countindex); - tmpmodel->IndexBuffer->Unlock(); + tmpmodel->m_pIndexBuffer->Unlock(); } mem_release_del((*data)); @@ -448,7 +453,7 @@ void SGCore_StaticModelSave(const char * file, DataStaticModel** data) if (!pF) { - g_fnReportf(REPORT_MSG_LEVEL_ERROR, "unable to open model file '%s'\n", file); + LibReport(REPORT_MSG_LEVEL_ERROR, "unable to open model file '%s'\n", file); return; } @@ -456,7 +461,7 @@ void SGCore_StaticModelSave(const char * file, DataStaticModel** data) hdr.iBoneCount = 1; hdr.iFlags = MODEL_FLAG_COMPILED | MODEL_FLAG_STATIC; - hdr.iMaterialCount = (*data)->SubsetCount; + hdr.iMaterialCount = (*data)->m_uiSubsetCount; hdr.iSkinCount = 1; hdr.iVersion = SX_MODEL_VERSION_OLD; @@ -465,7 +470,7 @@ void SGCore_StaticModelSave(const char * file, DataStaticModel** data) UINT iMaterialsSize = 0; for (UINT i = 0; i < hdr.iMaterialCount; i++) { - iMaterialsSize += strlen((*data)->ArrTextures[i]) + 1; + iMaterialsSize += strlen((*data)->m_ppTextures[i]) + 1; } hdr.iBonesOffset = 0; @@ -476,8 +481,8 @@ void SGCore_StaticModelSave(const char * file, DataStaticModel** data) iLodSize += sizeof(int); for (int i = 0; i < hdr.iMaterialCount; i++) { - iLodSize += sizeof(vertex_animated_ex)* (*data)->VertexCount[i]; - iLodSize += sizeof(UINT)* (*data)->IndexCount[i]; + iLodSize += sizeof(vertex_animated_ex)* (*data)->m_pVertexCount[i]; + iLodSize += sizeof(UINT)* (*data)->m_pIndexCount[i]; iLodSize += sizeof(int)* 3; } @@ -487,29 +492,29 @@ void SGCore_StaticModelSave(const char * file, DataStaticModel** data) fwrite(&hdr, sizeof(hdr), 1, pF); for (UINT i = 0; i < hdr.iMaterialCount; i++) { - fwrite((*data)->ArrTextures[i], 1, strlen((*data)->ArrTextures[i]) + 1, pF); + fwrite((*data)->m_ppTextures[i], 1, strlen((*data)->m_ppTextures[i]) + 1, pF); } int smc = hdr.iMaterialCount; fwrite(&smc, sizeof(int), 1, pF); vertex_animated_ex * pVB; UINT * pIB; - (*data)->VertexBuffer->Lock(0, 0, (void**)&pVB, 0); - (*data)->IndexBuffer->Lock(0, 0, (void**)&pIB, 0); + (*data)->m_pVertexBuffer->Lock(0, 0, (void**)&pVB, 0); + (*data)->m_pIndexBuffer->Lock(0, 0, (void**)&pIB, 0); UINT iVC = 0; UINT iIC = 0; for (int i = 0; i < hdr.iMaterialCount; i++) { fwrite(&i, sizeof(int), 1, pF); - fwrite(&(*data)->VertexCount[i], sizeof(int), 1, pF); - fwrite(&(*data)->IndexCount[i], sizeof(int), 1, pF); + fwrite(&(*data)->m_pVertexCount[i], sizeof(int), 1, pF); + fwrite(&(*data)->m_pIndexCount[i], sizeof(int), 1, pF); - fwrite(pVB + iVC, sizeof(vertex_animated_ex), (*data)->VertexCount[i], pF); - fwrite(pIB + iIC, sizeof(UINT), (*data)->IndexCount[i], pF); - iVC += (*data)->VertexCount[i]; - iIC += (*data)->IndexCount[i]; + fwrite(pVB + iVC, sizeof(vertex_animated_ex), (*data)->m_pVertexCount[i], pF); + fwrite(pIB + iIC, sizeof(UINT), (*data)->m_pIndexCount[i], pF); + iVC += (*data)->m_pVertexCount[i]; + iIC += (*data)->m_pIndexCount[i]; } - (*data)->VertexBuffer->Unlock(); - (*data)->IndexBuffer->Unlock(); + (*data)->m_pVertexBuffer->Unlock(); + (*data)->m_pIndexBuffer->Unlock(); fclose(pF); } @@ -530,7 +535,7 @@ void SGCore_StaticModelSave(const char * file, DataStaticModel** data) &Mesh)) ) { - g_fnReportf(REPORT_MSG_LEVEL_ERROR, "failed loaded X mesh '%s'\n", pathx); + LibReport(REPORT_MSG_LEVEL_ERROR, "failed loaded X mesh '%s'\n", pathx); return; } diff --git a/source/gcore/loader_static.h b/source/gcore/loader_static.h index a38f155b3ae4e3dfbe8be83d50e966234f55ad57..3bbbeecdf46648b1f13a1adc488edf76de39af94 100644 --- a/source/gcore/loader_static.h +++ b/source/gcore/loader_static.h @@ -1,4 +1,9 @@ +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #ifndef __LOADER_STATIC_H #define __LOADER_STATIC_H @@ -9,7 +14,6 @@ #include <common/Array.h> #include "sxgcore.h" -extern report_func g_fnReportf; extern IDirect3DDevice9 *g_pDXDevice; extern D3DPRESENT_PARAMETERS D3DAPP; extern IDirect3DVertexDeclaration9 *g_pStaticVertexDecl; @@ -18,101 +22,96 @@ struct DataStaticModel : public ISXDataStaticModel { DataStaticModel() { - VertexBuffer = 0; - IndexBuffer = 0; + m_pVertexBuffer = 0; + m_pIndexBuffer = 0; //ArrVertBuf = 0; //ArrIndBuf = 0; - SubsetCount = 0; - ArrTextures = 0; - StartIndex = 0; - IndexCount = 0; - StartVertex = 0; - VertexCount = 0; - AllIndexCount = 0; - AllVertexCount = 0; + m_uiSubsetCount = 0; + m_ppTextures = 0; + m_pStartIndex = 0; + m_pIndexCount = 0; + m_pStartVertex = 0; + m_pVertexCount = 0; + m_uiAllIndexCount = 0; + m_uiAllVertexCount = 0; } void Release(){ mem_del(this); } - ISXDataStaticModel* GetCopy() + ISXDataStaticModel* getCopy() { ISXDataStaticModel* nm = new DataStaticModel(); - nm->ArrTextures = new char*[SubsetCount]; - for (DWORD i = 0; i < SubsetCount; i++) + nm->m_ppTextures = new char*[m_uiSubsetCount]; + for (DWORD i = 0; i < m_uiSubsetCount; i++) { - nm->ArrTextures[i] = new char[strlen(ArrTextures[i]) + 1]; - sprintf(nm->ArrTextures[i], "%s", ArrTextures[i]); + nm->m_ppTextures[i] = new char[strlen(m_ppTextures[i]) + 1]; + sprintf(nm->m_ppTextures[i], "%s", m_ppTextures[i]); } - nm->SubsetCount = SubsetCount; - nm->StartIndex = new UINT[SubsetCount]; - memcpy(nm->StartIndex, StartIndex, sizeof(UINT)*SubsetCount); - nm->IndexCount = new UINT[SubsetCount]; - memcpy(nm->IndexCount, IndexCount, sizeof(UINT)*SubsetCount); - nm->StartVertex = new UINT[SubsetCount]; - memcpy(nm->StartVertex, StartVertex, sizeof(UINT)*SubsetCount); - nm->VertexCount = new UINT[SubsetCount]; - memcpy(nm->VertexCount, VertexCount, sizeof(UINT)*SubsetCount); + nm->m_uiSubsetCount = m_uiSubsetCount; + nm->m_pStartIndex = new UINT[m_uiSubsetCount]; + memcpy(nm->m_pStartIndex, m_pStartIndex, sizeof(UINT)*m_uiSubsetCount); + nm->m_pIndexCount = new UINT[m_uiSubsetCount]; + memcpy(nm->m_pIndexCount, m_pIndexCount, sizeof(UINT)*m_uiSubsetCount); + nm->m_pStartVertex = new UINT[m_uiSubsetCount]; + memcpy(nm->m_pStartVertex, m_pStartVertex, sizeof(UINT)*m_uiSubsetCount); + nm->m_pVertexCount = new UINT[m_uiSubsetCount]; + memcpy(nm->m_pVertexCount, m_pVertexCount, sizeof(UINT)*m_uiSubsetCount); DWORD tmpvert = 0; DWORD tmpind = 0; - for (DWORD i = 0; i < SubsetCount; i++) + for (DWORD i = 0; i < m_uiSubsetCount; i++) { - tmpvert += nm->VertexCount[i]; - tmpind += nm->IndexCount[i]; + tmpvert += nm->m_pVertexCount[i]; + tmpind += nm->m_pIndexCount[i]; } - g_pDXDevice->CreateVertexBuffer(sizeof(vertex_static)* tmpvert, NULL, NULL, D3DPOOL_MANAGED, &nm->VertexBuffer, 0); + g_pDXDevice->CreateVertexBuffer(sizeof(vertex_static)* tmpvert, NULL, NULL, D3DPOOL_MANAGED, &nm->m_pVertexBuffer, 0); //nm->ArrVertBuf = new vertex_static[tmpvert]; vertex_static * dstData, *srcData; - nm->VertexBuffer->Lock(0, 0, (void**)&dstData, 0); - VertexBuffer->Lock(0, 0, (void**)&srcData, 0); + nm->m_pVertexBuffer->Lock(0, 0, (void**)&dstData, 0); + m_pVertexBuffer->Lock(0, 0, (void**)&srcData, 0); memcpy(dstData, srcData, sizeof(vertex_static)* tmpvert); //memcpy(nm->ArrVertBuf, srcData, sizeof(vertex_static)* tmpvert); - nm->VertexBuffer->Unlock(); - VertexBuffer->Unlock(); + nm->m_pVertexBuffer->Unlock(); + m_pVertexBuffer->Unlock(); - g_pDXDevice->CreateIndexBuffer(sizeof(UINT)* tmpind, NULL, D3DFMT_INDEX32, D3DPOOL_MANAGED, &nm->IndexBuffer, 0); + g_pDXDevice->CreateIndexBuffer(sizeof(UINT)* tmpind, NULL, D3DFMT_INDEX32, D3DPOOL_MANAGED, &nm->m_pIndexBuffer, 0); //nm->ArrIndBuf = new UINT[tmpind]; - nm->IndexBuffer->Lock(0, 0, (void**)&dstData, 0); - IndexBuffer->Lock(0, 0, (void**)&srcData, 0); + nm->m_pIndexBuffer->Lock(0, 0, (void**)&dstData, 0); + m_pIndexBuffer->Lock(0, 0, (void**)&srcData, 0); memcpy(dstData, srcData, sizeof(UINT)* tmpind); //memcpy(nm->ArrIndBuf, srcData, sizeof(UINT)* tmpind); - nm->IndexBuffer->Unlock(); - IndexBuffer->Unlock(); + nm->m_pIndexBuffer->Unlock(); + m_pIndexBuffer->Unlock(); return nm; } DataStaticModel::~DataStaticModel() { - mem_release_del(VertexBuffer); - mem_release_del(IndexBuffer); + mem_release_del(m_pVertexBuffer); + mem_release_del(m_pIndexBuffer); - for (DWORD i = 0; i < SubsetCount; ++i) + for (DWORD i = 0; i < m_uiSubsetCount; ++i) { - mem_delete_a(ArrTextures[i]); + mem_delete_a(m_ppTextures[i]); } //mem_delete_a(ArrVertBuf); //mem_delete_a(ArrIndBuf); - mem_delete_a(ArrTextures); - mem_delete_a(StartIndex); - mem_delete_a(IndexCount); - mem_delete_a(StartVertex); - mem_delete_a(VertexCount); + mem_delete_a(m_ppTextures); + mem_delete_a(m_pStartIndex); + mem_delete_a(m_pIndexCount); + mem_delete_a(m_pStartVertex); + mem_delete_a(m_pVertexCount); } }; - -/////////// - - - #endif \ No newline at end of file diff --git a/source/gcore/shader.cpp b/source/gcore/shader.cpp index 945f0c85a14e48d88c4acf5b388af643645de7c2..e81b4e176584bb24b3b2a0db013b266ad4c7c9ab 100644 --- a/source/gcore/shader.cpp +++ b/source/gcore/shader.cpp @@ -1,4 +1,9 @@ +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include "shader.h" CShaderFileCache* CreateShaderFileCacheFormShader(CShader *pShader) @@ -219,7 +224,7 @@ void LoadVertexShader(const char *szPath, CShaderVS *pShader, D3DXMACRO *aMacro) ); if (FAILED(hr)) { - g_fnReportf(REPORT_MSG_LEVEL_ERROR, "%s: %s - error creating vertex shader [%s]\n", SX_LIB_NAME, GEN_MSG_LOCATION, szPath); + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - error creating vertex shader [%s]\n", GEN_MSG_LOCATION, szPath); return; } @@ -248,14 +253,14 @@ void LoadVertexShader(const char *szPath, CShaderVS *pShader, D3DXMACRO *aMacro) if (pBufError && pBufShader == 0) { - g_fnReportf(REPORT_MSG_LEVEL_ERROR, "%s: %s - failed to load vertex shader [%s], msg: %s\n", SX_LIB_NAME, GEN_MSG_LOCATION, szPath, (char*)pBufError->GetBufferPointer()); + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - failed to load vertex shader [%s], msg: %s\n", GEN_MSG_LOCATION, szPath, (char*)pBufError->GetBufferPointer()); return; } //!!!���������������� if (FAILED(hr)) { - g_fnReportf(REPORT_MSG_LEVEL_ERROR, "%s: %s - download function vertex shader fails, path [%s]\n", SX_LIB_NAME, GEN_MSG_LOCATION, szPath); + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - download function vertex shader fails, path [%s]\n", GEN_MSG_LOCATION, szPath); return; } @@ -266,7 +271,7 @@ void LoadVertexShader(const char *szPath, CShaderVS *pShader, D3DXMACRO *aMacro) if (FAILED(hr)) { - g_fnReportf(REPORT_MSG_LEVEL_ERROR, "%s: %s - error creating vertex shader [%s]\n", SX_LIB_NAME, GEN_MSG_LOCATION, szPath); + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - error creating vertex shader [%s]\n", GEN_MSG_LOCATION, szPath); return; } @@ -275,7 +280,7 @@ void LoadVertexShader(const char *szPath, CShaderVS *pShader, D3DXMACRO *aMacro) if (desc.Constants > SXGC_SHADER_VAR_MAX_COUNT) { - g_fnReportf(REPORT_MSG_LEVEL_ERROR, "%s: %s - error, count variable in vertex shader [%s] more standart [%d]\n", SX_LIB_NAME, GEN_MSG_LOCATION, szPath, SXGC_SHADER_VAR_MAX_COUNT); + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - error, count variable in vertex shader [%s] more standart [%d]\n", GEN_MSG_LOCATION, szPath, SXGC_SHADER_VAR_MAX_COUNT); return; } @@ -336,7 +341,7 @@ void LoadPixelShader(const char *szPath, CShaderPS *pShader,D3DXMACRO *aMacro) ); if (FAILED(hr)) { - g_fnReportf(REPORT_MSG_LEVEL_ERROR, "%s: %s - error creating pixel shader [%s]", SX_LIB_NAME, GEN_MSG_LOCATION, szPath); + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - error creating pixel shader [%s]", GEN_MSG_LOCATION, szPath); return; } @@ -365,14 +370,14 @@ void LoadPixelShader(const char *szPath, CShaderPS *pShader,D3DXMACRO *aMacro) if (pBufError && pBufShader == 0) { - g_fnReportf(REPORT_MSG_LEVEL_ERROR, "%s: %s - failed to load pixel shader [%s], msg: %s\n", SX_LIB_NAME, GEN_MSG_LOCATION, szPath, (char*)pBufError->GetBufferPointer()); + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - failed to load pixel shader [%s], msg: %s\n", GEN_MSG_LOCATION, szPath, (char*)pBufError->GetBufferPointer()); return; } //!!!���������������� if (FAILED(hr)) { - g_fnReportf(REPORT_MSG_LEVEL_ERROR, "%s: %s - download function pixel shader fails, path [%s]\n", SX_LIB_NAME, GEN_MSG_LOCATION, szPath); + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - download function pixel shader fails, path [%s]\n", GEN_MSG_LOCATION, szPath); return; } @@ -383,7 +388,7 @@ void LoadPixelShader(const char *szPath, CShaderPS *pShader,D3DXMACRO *aMacro) if (FAILED(hr)) { - g_fnReportf(REPORT_MSG_LEVEL_ERROR, "%s: %s - error creating pixel shader [%s]\n", SX_LIB_NAME, GEN_MSG_LOCATION, szPath); + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - error creating pixel shader [%s]\n", GEN_MSG_LOCATION, szPath); return; } @@ -392,7 +397,7 @@ void LoadPixelShader(const char *szPath, CShaderPS *pShader,D3DXMACRO *aMacro) if (desc.Constants > SXGC_SHADER_VAR_MAX_COUNT) { - g_fnReportf(REPORT_MSG_LEVEL_ERROR, "%s: %s - error, count variable in pixel shader [%s] more standart [%d]\n", SX_LIB_NAME, GEN_MSG_LOCATION, szPath, SXGC_SHADER_VAR_MAX_COUNT); + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - error, count variable in pixel shader [%s] more standart [%d]\n", GEN_MSG_LOCATION, szPath, SXGC_SHADER_VAR_MAX_COUNT); return; } @@ -444,25 +449,25 @@ CShaderManager::~CShaderManager() void CShaderManager::reloadAll() { - g_fnReportf(REPORT_MSG_LEVEL_NOTICE, "%s: reload shaders ...\n", SX_LIB_NAME); + LibReport(REPORT_MSG_LEVEL_NOTICE, "reload shaders ...\n"); for (int i = 0; i<m_aVS.size(); i++) { CShaderVS *pShader = m_aVS[i]; LoadVertexShader(pShader->m_szPath, pShader, pShader->m_aMacros); - g_fnReportf(REPORT_MSG_LEVEL_NOTICE, " VS id [%d], file [%s], name [%s], \n", i, pShader->m_szPath, pShader->m_szName); + LibReport(REPORT_MSG_LEVEL_NOTICE, " VS id [%d], file [%s], name [%s], \n", i, pShader->m_szPath, pShader->m_szName); } - g_fnReportf(REPORT_MSG_LEVEL_NOTICE, " -------\n"); + LibReport(REPORT_MSG_LEVEL_NOTICE, " -------\n"); for (int i = 0; i<m_aPS.size(); i++) { CShaderPS *pShader = m_aPS[i]; LoadPixelShader(m_aPS[i]->m_szPath, m_aPS[i], m_aPS[i]->m_aMacros); - g_fnReportf(REPORT_MSG_LEVEL_NOTICE, " PS id [%d], file[%s], name[%s], \n", i, pShader->m_szPath, pShader->m_szName); + LibReport(REPORT_MSG_LEVEL_NOTICE, " PS id [%d], file[%s], name[%s], \n", i, pShader->m_szPath, pShader->m_szName); } - g_fnReportf(REPORT_MSG_LEVEL_NOTICE, "%s: all reloaded shaders\n", SX_LIB_NAME); + LibReport(REPORT_MSG_LEVEL_NOTICE, "all reloaded shaders\n"); } ID CShaderManager::existsPath(SHADER_TYPE type, const char *szPath) @@ -490,7 +495,7 @@ ID CShaderManager::existsName(SHADER_TYPE type_shader, const char *szName) { if (!isValidateTypeName(type_shader, szName)) { - g_fnReportf(REPORT_MSG_LEVEL_ERROR, "%s: %s - name of shader [%s] is invalid", SX_LIB_NAME, GEN_MSG_LOCATION, szName); + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - name of shader [%s] is invalid", GEN_MSG_LOCATION, szName); return -1; } @@ -542,7 +547,7 @@ ID CShaderManager::preLoad(SHADER_TYPE type, const char *szPath, const char *szN { if (!isValidateTypeName(type, szName)) { - g_fnReportf(REPORT_MSG_LEVEL_ERROR, "%s: %s - name of shader [%s] is invalid", SX_LIB_NAME, GEN_MSG_LOCATION, szName); + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - name of shader [%s] is invalid", GEN_MSG_LOCATION, szName); return -1; } @@ -611,37 +616,37 @@ void CShaderManager::allLoad() if (m_aVS.size() == m_iLastAllLoadVS || m_aPS.size() == m_iLastAllLoadPS) return; - g_fnReportf(REPORT_MSG_LEVEL_NOTICE, "%s: load shaders ...\n", SX_LIB_NAME); + LibReport(REPORT_MSG_LEVEL_NOTICE, "load shaders ...\n"); for (int i = 0, il = m_aVS.size(); i < il; ++i) { CShaderVS *pShader = m_aVS[i]; LoadVertexShader(pShader->m_szPath, pShader, pShader->m_aMacros); - g_fnReportf(REPORT_MSG_LEVEL_NOTICE, " VS id [%d], file [%s], name [%s], \n", i, pShader->m_szPath, pShader->m_szName); + LibReport(REPORT_MSG_LEVEL_NOTICE, " VS id [%d], file [%s], name [%s], \n", i, pShader->m_szPath, pShader->m_szName); } - g_fnReportf(REPORT_MSG_LEVEL_NOTICE, " -------\n"); + LibReport(REPORT_MSG_LEVEL_NOTICE, " -------\n"); for (int i = 0, il = m_aPS.size(); i < il; ++i) { CShaderPS *pShader = m_aPS[i]; LoadPixelShader(pShader->m_szPath, pShader, pShader->m_aMacros); - g_fnReportf(REPORT_MSG_LEVEL_NOTICE, " PS id [%d], file[%s], name[%s], \n", i, pShader->m_szPath, pShader->m_szName); + LibReport(REPORT_MSG_LEVEL_NOTICE, " PS id [%d], file[%s], name[%s], \n", i, pShader->m_szPath, pShader->m_szName); } m_iLastAllLoadVS = m_aVS.size(); m_iLastAllLoadPS = m_aPS.size(); - g_fnReportf(REPORT_MSG_LEVEL_NOTICE, "%s: all loaded shaders\n", SX_LIB_NAME); + LibReport(REPORT_MSG_LEVEL_NOTICE, "all loaded shaders\n"); } void CShaderManager::update(SHADER_TYPE type_shader, const char *szName) { if (!isValidateTypeName(type_shader, szName)) { - g_fnReportf(REPORT_MSG_LEVEL_ERROR, "%s: %s - name of shader [%s] is invalid", SX_LIB_NAME, GEN_MSG_LOCATION, szName); + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - name of shader [%s] is invalid", GEN_MSG_LOCATION, szName); return; } @@ -674,9 +679,9 @@ void CShaderManager::update(SHADER_TYPE type_shader, const char *szName) } if (!isUpdate) - g_fnReportf(REPORT_MSG_LEVEL_ERROR, "%s: %s - shader [%s] is not detected", SX_LIB_NAME, GEN_MSG_LOCATION, szName); + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - shader [%s] is not detected", GEN_MSG_LOCATION, szName); /*else - g_fnReportf(REPORT_MSG_LEVEL_NOTICE, "%s: shader [%s] is update", SX_LIB_NAME, name);*/ + LibReport(REPORT_MSG_LEVEL_NOTICE, "shader [%s] is update", name);*/ } void CShaderManager::update(SHADER_TYPE type_shader, ID id) @@ -704,16 +709,16 @@ void CShaderManager::update(SHADER_TYPE type_shader, ID id) } if (!isUpdate) - g_fnReportf(REPORT_MSG_LEVEL_ERROR, "%s: %s - shader_id [%s] is not detected", SX_LIB_NAME, GEN_MSG_LOCATION, id); + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - shader_id [%s] is not detected", GEN_MSG_LOCATION, id); /*else - g_fnReportf(REPORT_MSG_LEVEL_NOTICE, "%s: shader [%s] is update", SX_LIB_NAME, m_aPS[id]->m_szName);*/ + LibReport(REPORT_MSG_LEVEL_NOTICE, "shader [%s] is update", m_aPS[id]->m_szName);*/ } ID CShaderManager::getID(SHADER_TYPE type_shader, const char *szName) { if (!isValidateTypeName(type_shader, szName)) { - g_fnReportf(REPORT_MSG_LEVEL_ERROR, "%s: %s - name of shader [%s] is invalid", SX_LIB_NAME, GEN_MSG_LOCATION, szName); + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - name of shader [%s] is invalid", GEN_MSG_LOCATION, szName); return -1; } @@ -744,7 +749,7 @@ void CShaderManager::bind(SHADER_TYPE type_shader, const char *szName) { if (!isValidateTypeName(type_shader, szName)) { - g_fnReportf(REPORT_MSG_LEVEL_ERROR, "%s: %s - name of shader [%s] is invalid", SX_LIB_NAME, GEN_MSG_LOCATION, szName); + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - name of shader [%s] is invalid", GEN_MSG_LOCATION, szName); return; } @@ -775,7 +780,7 @@ void CShaderManager::bind(SHADER_TYPE type_shader, const char *szName) } if (!isbind) - g_fnReportf(REPORT_MSG_LEVEL_WARNING, "%s: shader not bind, type [%d], name [%s]\n", SX_LIB_NAME, type_shader, szName); + LibReport(REPORT_MSG_LEVEL_WARNING, "shader not bind, type [%d], name [%s]\n", type_shader, szName); } void CShaderManager::bind(SHADER_TYPE type_shader, ID idShader) @@ -799,7 +804,7 @@ void CShaderManager::bind(SHADER_TYPE type_shader, ID idShader) } if (!isBind) - g_fnReportf(REPORT_MSG_LEVEL_WARNING, "%s: shader not bind, type [%d], id [%d]\n", SX_LIB_NAME, type_shader, idShader); + LibReport(REPORT_MSG_LEVEL_WARNING, "shader not bind, type [%d], id [%d]\n", type_shader, idShader); } void CShaderManager::unbind() @@ -813,7 +818,7 @@ void CShaderManager::setValueRegisterF(SHADER_TYPE type_shader, const char *szNa { if (!isValidateTypeName(type_shader, szNameShader)) { - g_fnReportf(REPORT_MSG_LEVEL_ERROR, "%s: %s - name of shader [%s] is invalid", SX_LIB_NAME, GEN_MSG_LOCATION, szNameShader); + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - name of shader [%s] is invalid", GEN_MSG_LOCATION, szNameShader); return; } @@ -844,9 +849,9 @@ void CShaderManager::setValueRegisterF(SHADER_TYPE type_shader, const char *szNa else { if (num_shader == -1) - g_fnReportf(REPORT_MSG_LEVEL_WARNING, "%s: set vertex shader constant [%s] is failed, shader not found, type [%d], id [%d]\n", SX_LIB_NAME, szNameVar, type_shader, szNameShader); + LibReport(REPORT_MSG_LEVEL_WARNING, "set vertex shader constant [%s] is failed, shader not found, type [%d], id [%d]\n", szNameVar, type_shader, szNameShader); else if (num_var == -1) - g_fnReportf(REPORT_MSG_LEVEL_WARNING, "%s: set vertex shader constant [%s] is failed, constant not found, shader info: type [%d], id [%d], name [%s]\n", SX_LIB_NAME, szNameVar, type_shader, szNameShader); + LibReport(REPORT_MSG_LEVEL_WARNING, "set vertex shader constant [%s] is failed, constant not found, shader info: type [%d], id [%d], name [%s]\n", szNameVar, type_shader, szNameShader); } } else if (type_shader == SHADER_TYPE_PIXEL) @@ -876,9 +881,9 @@ void CShaderManager::setValueRegisterF(SHADER_TYPE type_shader, const char *szNa else { if (num_shader == -1) - g_fnReportf(REPORT_MSG_LEVEL_WARNING, "%s: set pixel shader constant [%s] is failed, shader not found, type [%d], id [%d]\n", SX_LIB_NAME, szNameVar, type_shader, szNameShader); + LibReport(REPORT_MSG_LEVEL_WARNING, "set pixel shader constant [%s] is failed, shader not found, type [%d], id [%d]\n", szNameVar, type_shader, szNameShader); else if (num_var == -1) - g_fnReportf(REPORT_MSG_LEVEL_WARNING, "%s: set pixel shader constant [%s] is failed, constant not found, shader info: type [%d], id [%d], name [%s]\n", SX_LIB_NAME, szNameVar, type_shader, szNameShader); + LibReport(REPORT_MSG_LEVEL_WARNING, "set pixel shader constant [%s] is failed, constant not found, shader info: type [%d], id [%d], name [%s]\n", szNameVar, type_shader, szNameShader); } } } @@ -903,7 +908,7 @@ void CShaderManager::setValueRegisterF(SHADER_TYPE type_shader, ID idShader, con if (idShader != -1 && num_var != -1) g_pDXDevice->SetVertexShaderConstantF(m_aVS[idShader]->m_aVarDesc[num_var].RegisterIndex, (float*)pData, (iCountFloat4 == 0 ? m_aVS[idShader]->m_aVarDesc[num_var].RegisterCount : iCountFloat4)); else if (num_var == -1) - g_fnReportf(REPORT_MSG_LEVEL_WARNING, "%s: set vertex shader constant [%s] is failed, constant not found, type [%d], id [%d]\n", SX_LIB_NAME, szNameVar, type_shader, idShader); + LibReport(REPORT_MSG_LEVEL_WARNING, "set vertex shader constant [%s] is failed, constant not found, type [%d], id [%d]\n", szNameVar, type_shader, idShader); } else if (type_shader == SHADER_TYPE_PIXEL) { @@ -921,18 +926,18 @@ void CShaderManager::setValueRegisterF(SHADER_TYPE type_shader, ID idShader, con if (idShader != -1 && num_var != -1) g_pDXDevice->SetPixelShaderConstantF(m_aPS[idShader]->m_aVarDesc[num_var].RegisterIndex, (float*)pData, (iCountFloat4 == 0 ? m_aPS[idShader]->m_aVarDesc[num_var].RegisterCount : iCountFloat4)); else if (num_var == -1) - g_fnReportf(REPORT_MSG_LEVEL_WARNING, "%s: set pixel shader constant [%s] is failed, constant not found, type [%d], name [%s]\n", SX_LIB_NAME, szNameVar, type_shader, m_aPS[idShader]->m_szPath); + LibReport(REPORT_MSG_LEVEL_WARNING, "set pixel shader constant [%s] is failed, constant not found, type [%d], name [%s]\n", szNameVar, type_shader, m_aPS[idShader]->m_szPath); } } else - g_fnReportf(REPORT_MSG_LEVEL_WARNING, "%s: set shader constant [%s] is failed, shader not validate, type [%d], id [%d]\n", SX_LIB_NAME, szNameVar, type_shader, idShader); + LibReport(REPORT_MSG_LEVEL_WARNING, "set shader constant [%s] is failed, shader not validate, type [%d], id [%d]\n", szNameVar, type_shader, idShader); } void CShaderManager::setValueRegisterI(SHADER_TYPE type_shader, const char *szNameShader, const char *szNameVar, void *pData, int iCountInt4) { if (!isValidateTypeName(type_shader, szNameShader)) { - g_fnReportf(REPORT_MSG_LEVEL_ERROR, "%s: %s - name of shader [%s] is invalid", SX_LIB_NAME, GEN_MSG_LOCATION, szNameShader); + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - name of shader [%s] is invalid", GEN_MSG_LOCATION, szNameShader); return; } @@ -963,9 +968,9 @@ void CShaderManager::setValueRegisterI(SHADER_TYPE type_shader, const char *szNa else { if (num_shader == -1) - g_fnReportf(REPORT_MSG_LEVEL_WARNING, "%s: set vertex shader constant [%s] is failed, shader not found, type [%d], id [%d]\n", SX_LIB_NAME, szNameVar, type_shader, szNameShader); + LibReport(REPORT_MSG_LEVEL_WARNING, "set vertex shader constant [%s] is failed, shader not found, type [%d], id [%d]\n", szNameVar, type_shader, szNameShader); else if (num_var == -1) - g_fnReportf(REPORT_MSG_LEVEL_WARNING, "%s: set vertex shader constant [%s] is failed, constant not found, shader info: type [%d], id [%d], name [%s]\n", SX_LIB_NAME, szNameVar, type_shader, szNameShader); + LibReport(REPORT_MSG_LEVEL_WARNING, "set vertex shader constant [%s] is failed, constant not found, shader info: type [%d], id [%d], name [%s]\n", szNameVar, type_shader, szNameShader); } } else if (type_shader == SHADER_TYPE_PIXEL) @@ -995,9 +1000,9 @@ void CShaderManager::setValueRegisterI(SHADER_TYPE type_shader, const char *szNa else { if (num_shader == -1) - g_fnReportf(REPORT_MSG_LEVEL_WARNING, "%s: set pixel shader constant [%s] is failed, shader not found, type [%d], id [%d]\n", SX_LIB_NAME, szNameVar, type_shader, szNameShader); + LibReport(REPORT_MSG_LEVEL_WARNING, "set pixel shader constant [%s] is failed, shader not found, type [%d], id [%d]\n", szNameVar, type_shader, szNameShader); else if (num_var == -1) - g_fnReportf(REPORT_MSG_LEVEL_WARNING, "%s: set pixel shader constant [%s] is failed, constant not found, shader info: type [%d], id [%d], name [%s]\n", SX_LIB_NAME, szNameVar, type_shader, szNameShader); + LibReport(REPORT_MSG_LEVEL_WARNING, "set pixel shader constant [%s] is failed, constant not found, shader info: type [%d], id [%d], name [%s]\n", szNameVar, type_shader, szNameShader); } } } @@ -1022,7 +1027,7 @@ void CShaderManager::setValueRegisterI(SHADER_TYPE type_shader, ID idShader, con if (idShader != -1 && num_var != -1) g_pDXDevice->SetVertexShaderConstantI(m_aVS[idShader]->m_aVarDesc[num_var].RegisterIndex, (int*)pData, (iCountInt4 == 0 ? m_aVS[idShader]->m_aVarDesc[num_var].RegisterCount : iCountInt4)); else if (num_var == -1) - g_fnReportf(REPORT_MSG_LEVEL_WARNING, "%s: set vertex shader constant [%s] is failed, constant not found, type [%d], id [%d]\n", SX_LIB_NAME, szNameVar, type_shader, idShader); + LibReport(REPORT_MSG_LEVEL_WARNING, "set vertex shader constant [%s] is failed, constant not found, type [%d], id [%d]\n", szNameVar, type_shader, idShader); } else if (type_shader == SHADER_TYPE_PIXEL) { @@ -1040,11 +1045,11 @@ void CShaderManager::setValueRegisterI(SHADER_TYPE type_shader, ID idShader, con if (idShader != -1 && num_var != -1) g_pDXDevice->SetPixelShaderConstantI(m_aPS[idShader]->m_aVarDesc[num_var].RegisterIndex, (int*)pData, (iCountInt4 == 0 ? m_aPS[idShader]->m_aVarDesc[num_var].RegisterCount : iCountInt4)); else if (num_var == -1) - g_fnReportf(REPORT_MSG_LEVEL_WARNING, "%s: set pixel shader constant [%s] is failed, constant not found, type [%d], name [%s]\n", SX_LIB_NAME, szNameVar, type_shader, m_aPS[idShader]->m_szPath); + LibReport(REPORT_MSG_LEVEL_WARNING, "set pixel shader constant [%s] is failed, constant not found, type [%d], name [%s]\n", szNameVar, type_shader, m_aPS[idShader]->m_szPath); } } else - g_fnReportf(REPORT_MSG_LEVEL_WARNING, "%s: set shader constant [%s] is failed, shader not validate, type [%d], id [%d]\n", SX_LIB_NAME, szNameVar, type_shader, idShader); + LibReport(REPORT_MSG_LEVEL_WARNING, "set shader constant [%s] is failed, shader not validate, type [%d], id [%d]\n", szNameVar, type_shader, idShader); } diff --git a/source/gcore/shader.h b/source/gcore/shader.h index bcc5c739065f1623f548a28e19ffb2a1183be433..b3f10bfe2ad056c9e14c46950b0fcb9499752361 100644 --- a/source/gcore/shader.h +++ b/source/gcore/shader.h @@ -1,4 +1,9 @@ +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #ifndef __SHADER_H #define __SHADER_H @@ -13,7 +18,6 @@ #include <common/String.h> #include "sxgcore.h" -extern report_func g_fnReportf; extern IDirect3DDevice9 *g_pDXDevice; extern D3DPRESENT_PARAMETERS g_oD3DAPP; @@ -208,11 +212,12 @@ public: void getName(SHADER_TYPE type, ID idShader, char *szName); protected: - Array<CShaderVS*> m_aVS; - Array<CShaderPS*> m_aPS; - int m_iLastAllLoadVS; - int m_iLastAllLoadPS; + Array<CShaderVS*> m_aVS; //!< ������� vs �������� + Array<CShaderPS*> m_aPS; //!< ������� ps �������� + + int m_iLastAllLoadVS; //! ����� ���������� ����������� vs ��������, � �������� ���� + int m_iLastAllLoadPS; //! ����� ���������� ����������� ps ��������, � �������� ���� }; #endif \ No newline at end of file diff --git a/source/gcore/sky.cpp b/source/gcore/sky.cpp index 22a1205649a638e9b40343ca32a4fd11fefe4f91..bf211490c4004eec8b1abb5bba082b2f4197cddf 100644 --- a/source/gcore/sky.cpp +++ b/source/gcore/sky.cpp @@ -1,10 +1,15 @@ +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include "sky.h" -SkyBox::SkyBox() +CSkyBox::CSkyBox() { - TexActive[0] = 0; - TexSecond[0] = 0; + m_szTexActive[0] = 0; + m_szTexSecond[0] = 0; D3DVERTEXELEMENT9 layoutskybox[] = { @@ -13,20 +18,20 @@ SkyBox::SkyBox() D3DDECL_END() }; - g_pDXDevice->CreateVertexDeclaration(layoutskybox, &VertexDeclarationSkyBox); + g_pDXDevice->CreateVertexDeclaration(layoutskybox, &m_pVertexDeclarationSkyBox); - VS_RenderSkyBox = SGCore_ShaderLoad(SHADER_TYPE_VERTEX, "sky_box.vs", "sky_box.vs", SHADER_CHECKDOUBLE_NAME); - PS_RenderSkyBox = SGCore_ShaderLoad(SHADER_TYPE_PIXEL, "sky_box.ps", "sky_box.ps", SHADER_CHECKDOUBLE_NAME); + m_idVS = SGCore_ShaderLoad(SHADER_TYPE_VERTEX, "sky_box.vs", "sky_box.vs", SHADER_CHECKDOUBLE_NAME); + m_idPS = SGCore_ShaderLoad(SHADER_TYPE_PIXEL, "sky_box.ps", "sky_box.ps", SHADER_CHECKDOUBLE_NAME); - Color = float4(0,0,0,0); - RotaionY = 0.f; - MatRotation = SMMatrixIdentity(); + m_vColor = float4(0, 0, 0, 0); + m_fRotaionY = 0.f; + m_mMatRotation = SMMatrixIdentity(); g_pDXDevice->CreateVertexBuffer( - 8 * sizeof(SkyBoxVertex), + 8 * sizeof(CSkyBoxVertex), 0, 0, D3DPOOL_MANAGED, - &Vertices, + &m_pVertices, 0 ); @@ -35,7 +40,7 @@ SkyBox::SkyBox() 0, D3DFMT_INDEX16, D3DPOOL_MANAGED, - &Indeces, + &m_pIndeces, 0); float X = 1.0f * 200; @@ -43,21 +48,21 @@ SkyBox::SkyBox() float Z = 1.0f * 200; float tmpy = 45; - SkyBoxVertex* tmpVertices; - Vertices->Lock(0, 0, (void**)&tmpVertices, 0); + CSkyBoxVertex* tmpVertices; + m_pVertices->Lock(0, 0, (void**)&tmpVertices, 0); - tmpVertices[0] = SkyBoxVertex( X, Y-tmpy, Z, 1.0f, 1.0f, 1.0f); - tmpVertices[1] = SkyBoxVertex(-X, Y-tmpy, Z,-1.0f, 1.0f, 1.0f); - tmpVertices[2] = SkyBoxVertex( X, -tmpy, Z, 1.0f,-1.0f, 1.0f); + tmpVertices[0] = CSkyBoxVertex( X, Y-tmpy, Z, 1.0f, 1.0f, 1.0f); + tmpVertices[1] = CSkyBoxVertex(-X, Y-tmpy, Z,-1.0f, 1.0f, 1.0f); + tmpVertices[2] = CSkyBoxVertex( X, -tmpy, Z, 1.0f,-1.0f, 1.0f); - tmpVertices[3] = SkyBoxVertex( X, Y-tmpy,-Z, 1.0f, 1.0f,-1.0f); - tmpVertices[4] = SkyBoxVertex(-X, -tmpy, Z,-1.0f,-1.0f, 1.0f); - tmpVertices[5] = SkyBoxVertex( X, -tmpy,-Z, 1.0f,-1.0f,-1.0f); + tmpVertices[3] = CSkyBoxVertex( X, Y-tmpy,-Z, 1.0f, 1.0f,-1.0f); + tmpVertices[4] = CSkyBoxVertex(-X, -tmpy, Z,-1.0f,-1.0f, 1.0f); + tmpVertices[5] = CSkyBoxVertex( X, -tmpy,-Z, 1.0f,-1.0f,-1.0f); - tmpVertices[6] = SkyBoxVertex(-X, Y-tmpy,-Z,-1.0f, 1.0f,-1.0f); - tmpVertices[7] = SkyBoxVertex(-X, -tmpy,-Z,-1.0f,-1.0f,-1.0f); + tmpVertices[6] = CSkyBoxVertex(-X, Y-tmpy,-Z,-1.0f, 1.0f,-1.0f); + tmpVertices[7] = CSkyBoxVertex(-X, -tmpy,-Z,-1.0f,-1.0f,-1.0f); - Vertices->Unlock(); + m_pVertices->Unlock(); WORD indices_tmp[] = @@ -82,110 +87,110 @@ SkyBox::SkyBox() }; WORD* indices = 0; - Indeces->Lock(0, 0, (void**)&indices, 0); + m_pIndeces->Lock(0, 0, (void**)&indices, 0); memcpy(indices,indices_tmp,36 * sizeof(WORD)); - Indeces->Unlock(); + m_pIndeces->Unlock(); - Tex = 0; - Tex2 = 0; + m_pTexture = 0; + m_pTexture2 = 0; - BFChange = false; - BFChangeMainTex = false; - FactorBlend = 0.0f; + m_isChange = false; + m_isChangeMainTex = false; + m_fFactorBlend = 0.0f; }; -SkyBox::~SkyBox() +CSkyBox::~CSkyBox() { - mem_release_del(Vertices); - mem_release_del(Indeces); + mem_release_del(m_pVertices); + mem_release_del(m_pIndeces); - mem_release_del(Tex); - mem_release_del(Tex2); + mem_release_del(m_pTexture); + mem_release_del(m_pTexture2); - mem_release_del(VertexDeclarationSkyBox); + mem_release_del(m_pVertexDeclarationSkyBox); } -void SkyBox::LoadTextures(const char *texture) +void CSkyBox::loadTextures(const char *texture) { - mem_release_del(Tex); + mem_release_del(m_pTexture); if (!texture) { - mem_release_del(Tex2); + mem_release_del(m_pTexture2); - BFChange = false; - BFChangeMainTex = false; - FactorBlend = 0.0f; + m_isChange = false; + m_isChangeMainTex = false; + m_fFactorBlend = 0.0f; return; } char tmppath[1024]; sprintf(tmppath, "%s%s", Core_RStringGet(G_RI_STRING_PATH_GS_TEXTURES), texture); - if (FAILED(D3DXCreateCubeTextureFromFile(g_pDXDevice, tmppath, &Tex))) + if (FAILED(D3DXCreateCubeTextureFromFile(g_pDXDevice, tmppath, &m_pTexture))) { - g_fnReportf(REPORT_MSG_LEVEL_ERROR, "%s: %s - failed load cube texture '%s'", SX_LIB_NAME, GEN_MSG_LOCATION, tmppath); + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - failed load cube texture '%s'", GEN_MSG_LOCATION, tmppath); } } -bool SkyBox::IsLoadTex() +bool CSkyBox::isLoadTex() { - return (Tex != 0 || Tex2 != 0); + return (m_pTexture != 0 || m_pTexture2 != 0); } -void SkyBox::ChangeTexture(const char *texture) +void CSkyBox::changeTexture(const char *texture) { - mem_release_del((BFChangeMainTex ? Tex : Tex2)); + mem_release_del((m_isChangeMainTex ? m_pTexture : m_pTexture2)); char tmpsb1[1024]; sprintf(tmpsb1, "%s%s", Core_RStringGet(G_RI_STRING_PATH_GS_TEXTURES), texture); - if(!FAILED(D3DXCreateCubeTextureFromFile(g_pDXDevice,tmpsb1,(BFChangeMainTex ? &Tex : &Tex2)))) - BFChange = true; + if (!FAILED(D3DXCreateCubeTextureFromFile(g_pDXDevice, tmpsb1, (m_isChangeMainTex ? &m_pTexture : &m_pTexture2)))) + m_isChange = true; else { - g_fnReportf(REPORT_MSG_LEVEL_ERROR, "%s: %s - failed load cube texture '%s'", SX_LIB_NAME, GEN_MSG_LOCATION, tmpsb1); + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - failed load cube texture '%s'", GEN_MSG_LOCATION, tmpsb1); } } -void SkyBox::GetActiveTexture(char *texture) +void CSkyBox::getActiveTexture(char *texture) { if (texture) - strcpy(texture, TexActive); + strcpy(texture, m_szTexActive); } -void SkyBox::GetSecondTexture(char *texture) +void CSkyBox::getSecondTexture(char *texture) { if (texture) - strcpy(texture, TexSecond); + strcpy(texture, m_szTexSecond); } -void SkyBox::SetRotation(float angle) +void CSkyBox::setRotation(float angle) { - RotaionY = angle; - MatRotation = SMMatrixRotationY(RotaionY); + m_fRotaionY = angle; + m_mMatRotation = SMMatrixRotationY(m_fRotaionY); } -float SkyBox::GetRotation() +float CSkyBox::getRotation() { - return RotaionY; + return m_fRotaionY; } -void SkyBox::SetColor(float4_t* color) +void CSkyBox::setColor(const float4_t* color) { - Color = *color; + m_vColor = *color; } -void SkyBox::GetColor(float4_t* color) +void CSkyBox::getColor(float4_t* color) { - *color = Color; + *color = m_vColor; } -void SkyBox::Render(float timeDelta,float3* pos,bool is_shadow) +void CSkyBox::render(float timeDelta, const float3* pos,bool is_shadow) { - if(BFChange) - FactorBlend += timeDelta * 0.001f * 0.2f; + if (m_isChange) + m_fFactorBlend += timeDelta * 0.001f * 0.2f; - float4x4 World = MatRotation * SMMatrixTranslation(pos->x, pos->y, pos->z); + float4x4 World = m_mMatRotation * SMMatrixTranslation(pos->x, pos->y, pos->z); //D3DXMATRIX tmpdxView, tmpdxProjection; //g_pDXDevice->GetTransform(D3DTS_PROJECTION, &tmpdxProjection); @@ -200,41 +205,41 @@ void SkyBox::Render(float timeDelta,float3* pos,bool is_shadow) WVP = SMMatrixTranspose(WVP); - if(BFChange && FactorBlend >= 1.0) - { - FactorBlend = 0.0; - BFChangeMainTex = !BFChangeMainTex; - BFChange = false; - } + if (m_isChange && m_fFactorBlend >= 1.0) + { + m_fFactorBlend = 0.0; + m_isChangeMainTex = !m_isChangeMainTex; + m_isChange = false; + } - if(BFChangeMainTex) - { - g_pDXDevice->SetTexture(0,Tex2); - g_pDXDevice->SetTexture(1,Tex); - } - else - { - g_pDXDevice->SetTexture(0,Tex); - g_pDXDevice->SetTexture(1,Tex2); - } + if (m_isChangeMainTex) + { + g_pDXDevice->SetTexture(0, m_pTexture2); + g_pDXDevice->SetTexture(1, m_pTexture); + } + else + { + g_pDXDevice->SetTexture(0, m_pTexture); + g_pDXDevice->SetTexture(1, m_pTexture2); + } - SGCore_ShaderSetVRF(SHADER_TYPE_VERTEX, VS_RenderSkyBox, "WorldViewProjection", &WVP); - SGCore_ShaderSetVRF(SHADER_TYPE_PIXEL, PS_RenderSkyBox, "Color", &Color); - SGCore_ShaderSetVRF(SHADER_TYPE_PIXEL, PS_RenderSkyBox, "BlendFactor", &FactorBlend); - SGCore_ShaderBind(SHADER_TYPE_VERTEX, VS_RenderSkyBox); - SGCore_ShaderBind(SHADER_TYPE_PIXEL, PS_RenderSkyBox); + SGCore_ShaderSetVRF(SHADER_TYPE_VERTEX, m_idVS, "WorldViewProjection", &WVP); + SGCore_ShaderSetVRF(SHADER_TYPE_PIXEL, m_idPS, "Color", &m_vColor); + SGCore_ShaderSetVRF(SHADER_TYPE_PIXEL, m_idPS, "BlendFactor", &m_fFactorBlend); + SGCore_ShaderBind(SHADER_TYPE_VERTEX, m_idVS); + SGCore_ShaderBind(SHADER_TYPE_PIXEL, m_idPS); - g_pDXDevice->SetStreamSource(0, Vertices, 0, sizeof(SkyBoxVertex)); - g_pDXDevice->SetIndices(Indeces); - g_pDXDevice->SetVertexDeclaration(VertexDeclarationSkyBox); + g_pDXDevice->SetStreamSource(0, m_pVertices, 0, sizeof(CSkyBoxVertex)); + g_pDXDevice->SetIndices(m_pIndeces); + g_pDXDevice->SetVertexDeclaration(m_pVertexDeclarationSkyBox); g_pDXDevice->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, 0, 0, 8, 0, 12); SGCore_ShaderUnBind(); }; -///// +//########################################################################## -SkyClouds::SkyClouds() +CSkyClouds::CSkyClouds() { D3DVERTEXELEMENT9 layoutclouds[] = { @@ -243,24 +248,24 @@ SkyClouds::SkyClouds() D3DDECL_END() }; - g_pDXDevice->CreateVertexDeclaration(layoutclouds, &VertexDeclarationClouds); + g_pDXDevice->CreateVertexDeclaration(layoutclouds, &m_pVertexDeclarationClouds); - VS_RenderSkyClouds = SGCore_ShaderLoad(SHADER_TYPE_VERTEX, "sky_clouds.vs", "sky_clouds.vs", SHADER_CHECKDOUBLE_NAME); - PS_RenderSkyClouds = SGCore_ShaderLoad(SHADER_TYPE_PIXEL, "sky_clouds.ps", "sky_clouds.ps", SHADER_CHECKDOUBLE_NAME); + m_idVS = SGCore_ShaderLoad(SHADER_TYPE_VERTEX, "sky_clouds.vs", "sky_clouds.vs", SHADER_CHECKDOUBLE_NAME); + m_idPS = SGCore_ShaderLoad(SHADER_TYPE_PIXEL, "sky_clouds.ps", "sky_clouds.ps", SHADER_CHECKDOUBLE_NAME); D3DXMACRO Defines_SHADOW[] = { { "SHADOW", "" }, { 0, 0 } }; - PS_RenderSkyCloudsShadow = SGCore_ShaderLoad(SHADER_TYPE_PIXEL, "sky_clouds.ps", "sky_clouds_shadow.ps", SHADER_CHECKDOUBLE_NAME, Defines_SHADOW); + m_idPS_Shadow = SGCore_ShaderLoad(SHADER_TYPE_PIXEL, "sky_clouds.ps", "sky_clouds_shadow.ps", SHADER_CHECKDOUBLE_NAME, Defines_SHADOW); - RotaionY = 0; - Alpha = 1.f; - Color = float4_t(0,0,0,0); - MatRotation = SMMatrixIdentity(); + m_fRotaionY = 0; + m_fAlpha = 1.f; + m_vColor = float4_t(0, 0, 0, 0); + m_mMatRotation = SMMatrixIdentity(); g_pDXDevice->CreateVertexBuffer( - 4 * sizeof(SkyCloudsVertex), + 4 * sizeof(CSkyCloudsVertex), 0, 0, D3DPOOL_MANAGED, - &SkyCloudsVertices, + &m_pSkyCloudsVertices, 0 ); @@ -269,21 +274,21 @@ SkyClouds::SkyClouds() 0, D3DFMT_INDEX16, D3DPOOL_MANAGED, - &SkyCloudsIndeces, + &m_pSkyCloudsIndeces, 0); float X = 800; float Y = 0; float Z = 800; - SkyCloudsVertices->Lock(0, 0, (void**)&Vertices, 0); + m_pSkyCloudsVertices->Lock(0, 0, (void**)&m_pVertices, 0); - Vertices[3] = SkyCloudsVertex(-X, Y, -Z, 0.0f, 2.0f); - Vertices[2] = SkyCloudsVertex(-X, Y, Z, 0.0f, 0.0f); - Vertices[1] = SkyCloudsVertex( X, Y, Z, 2.0f,0.0f); - Vertices[0] = SkyCloudsVertex( X, Y, -Z, 2.0f, 2.0f); + m_pVertices[3] = CSkyCloudsVertex(-X, Y, -Z, 0.0f, 2.0f); + m_pVertices[2] = CSkyCloudsVertex(-X, Y, Z, 0.0f, 0.0f); + m_pVertices[1] = CSkyCloudsVertex(X, Y, Z, 2.0f, 0.0f); + m_pVertices[0] = CSkyCloudsVertex(X, Y, -Z, 2.0f, 2.0f); - SkyCloudsVertices->Unlock(); + m_pSkyCloudsVertices->Unlock(); WORD indices_tmp[] = @@ -294,211 +299,206 @@ SkyClouds::SkyClouds() WORD* indices = 0; - SkyCloudsIndeces->Lock(0, 0, (void**)&indices, 0); + m_pSkyCloudsIndeces->Lock(0, 0, (void**)&indices, 0); memcpy(indices,indices_tmp,6 * sizeof(WORD)); - SkyCloudsIndeces->Unlock(); + m_pSkyCloudsIndeces->Unlock(); - Bias = 0.f; - Speed = 0.01f; + m_fBias = 0.f; + m_fSpeed = 0.01f; - SkyCloudsTex = 0; - SkyCloudsTex2 = 0; + m_pSkyCloudsTex = 0; + m_pSkyCloudsTex2 = 0; - BFChange = false; - BFChangeMainTex = false; - FactorBlend = 0.0f; + m_isChange = false; + m_isChangeMainTex = false; + m_fFactorBlend = 0.0f; } -SkyClouds::~SkyClouds() +CSkyClouds::~CSkyClouds() { - mem_release_del(SkyCloudsTex); - mem_release_del(SkyCloudsTex2); + mem_release_del(m_pSkyCloudsTex); + mem_release_del(m_pSkyCloudsTex2); - mem_release_del(SkyCloudsVertices); - mem_release_del(SkyCloudsIndeces); + mem_release_del(m_pSkyCloudsVertices); + mem_release_del(m_pSkyCloudsIndeces); - mem_release_del(VertexDeclarationClouds); + mem_release_del(m_pVertexDeclarationClouds); } -void SkyClouds::ChangeTexture(const char *texture) +void CSkyClouds::changeTexture(const char *texture) { - mem_release_del((BFChangeMainTex ? SkyCloudsTex : SkyCloudsTex2)); + mem_release_del((m_isChangeMainTex ? m_pSkyCloudsTex : m_pSkyCloudsTex2)); char tmpsb1[1024]; sprintf(tmpsb1, "%s%s", Core_RStringGet(G_RI_STRING_PATH_GS_TEXTURES), texture); - if(!FAILED(D3DXCreateTextureFromFile(g_pDXDevice,tmpsb1,(BFChangeMainTex ? &SkyCloudsTex : &SkyCloudsTex2)))) - BFChange = true; + if (!FAILED(D3DXCreateTextureFromFile(g_pDXDevice, tmpsb1, (m_isChangeMainTex ? &m_pSkyCloudsTex : &m_pSkyCloudsTex2)))) + m_isChange = true; else { - g_fnReportf(REPORT_MSG_LEVEL_ERROR, "%s: %s - failed load texture '%s'", SX_LIB_NAME, GEN_MSG_LOCATION, tmpsb1); + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - failed load texture '%s'", GEN_MSG_LOCATION, tmpsb1); } } -void SkyClouds::SetWidthHeightPos(float width,float height,float3* pos) +void CSkyClouds::setWidthHeightPos(float width,float height, const float3* pos) { - SkyCloudsVertices->Lock(0, 0, (void**)&Vertices, 0); + m_pSkyCloudsVertices->Lock(0, 0, (void**)&m_pVertices, 0); float X = pos->x + (width*0.5f); float Y = pos->y; float Z = pos->z + (height*0.5f); - WidthHeight.x = width; - WidthHeight.y = height; + m_vWidthHeight.x = width; + m_vWidthHeight.y = height; //float2_t tmpwh = float2_t(width*0.5f,height*0.5f); - Vertices[3] = SkyCloudsVertex(-X, Y, -Z, 0.0f, 2.0f); - Vertices[2] = SkyCloudsVertex(-X, Y, Z, 0.0f, 0.0f); - Vertices[1] = SkyCloudsVertex( X, Y, Z, 2.0f,0.0f); - Vertices[0] = SkyCloudsVertex( X, Y, -Z, 2.0f, 2.0f); + m_pVertices[3] = CSkyCloudsVertex(-X, Y, -Z, 0.0f, 2.0f); + m_pVertices[2] = CSkyCloudsVertex(-X, Y, Z, 0.0f, 0.0f); + m_pVertices[1] = CSkyCloudsVertex(X, Y, Z, 2.0f, 0.0f); + m_pVertices[0] = CSkyCloudsVertex(X, Y, -Z, 2.0f, 2.0f); - SkyCloudsVertices->Unlock(); + m_pSkyCloudsVertices->Unlock(); } -void SkyClouds::SetRotation(float angle) +void CSkyClouds::setRotation(float angle) { - RotaionY = angle; - MatRotation = SMMatrixRotationY(RotaionY); + m_fRotaionY = angle; + m_mMatRotation = SMMatrixRotationY(m_fRotaionY); } -float SkyClouds::GetRotation() +float CSkyClouds::getRotation() { - return RotaionY; + return m_fRotaionY; } -void SkyClouds::SetAlpha(float alpha) +void CSkyClouds::setAlpha(float alpha) { - Alpha = alpha; + m_fAlpha = alpha; } -float SkyClouds::GetAlpha() +float CSkyClouds::getAlpha() { - return Alpha; + return m_fAlpha; } -void SkyClouds::SetColor(float4_t* color) +void CSkyClouds::setColor(const float4_t* color) { - Color = *color; + m_vColor = *color; } -void SkyClouds::GetColor(float4_t* color) +void CSkyClouds::getColor(float4_t* color) { - *color = Color; + *color = m_vColor; } -void SkyClouds::SetSpeed(float speed) +void CSkyClouds::setSpeed(float speed) { - Speed = speed; + m_fSpeed = speed; } -float SkyClouds::GetSpeed() +float CSkyClouds::getSpeed() { - return Speed; + return m_fSpeed; } -void SkyClouds::LoadTextures(const char *texture) +void CSkyClouds::loadTextures(const char *texture) { - mem_release_del(SkyCloudsTex); + mem_release_del(m_pSkyCloudsTex); if (!texture) { - mem_release_del(SkyCloudsTex2); + mem_release_del(m_pSkyCloudsTex2); - BFChange = false; - BFChangeMainTex = false; - FactorBlend = 0.0f; + m_isChange = false; + m_isChangeMainTex = false; + m_fFactorBlend = 0.0f; return; } char tmppath[1024]; sprintf(tmppath, "%s%s", Core_RStringGet(G_RI_STRING_PATH_GS_TEXTURES), texture); - if (FAILED(D3DXCreateTextureFromFile(g_pDXDevice, tmppath, &SkyCloudsTex))) + if (FAILED(D3DXCreateTextureFromFile(g_pDXDevice, tmppath, &m_pSkyCloudsTex))) { - g_fnReportf(REPORT_MSG_LEVEL_ERROR, "%s: %s - failed load texture '%s'", SX_LIB_NAME, GEN_MSG_LOCATION, tmppath); + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - failed load texture '%s'", GEN_MSG_LOCATION, tmppath); } } -bool SkyClouds::IsLoadTex() +bool CSkyClouds::isLoadTex() { - return (SkyCloudsTex != 0 || SkyCloudsTex2 != 0); + return (m_pSkyCloudsTex != 0 || m_pSkyCloudsTex2 != 0); } -void SkyClouds::Render(DWORD timeDelta,float3* pos,bool is_shadow) +void CSkyClouds::render(DWORD timeDelta, const float3* pos,bool is_shadow) { - if(BFChange) - FactorBlend += timeDelta * 0.001f * 0.2f; + if (m_isChange) + m_fFactorBlend += timeDelta * 0.001f * 0.2f; - Bias += timeDelta * 0.001f * Speed; + m_fBias += timeDelta * 0.001f * m_fSpeed; - if(Bias >= 2.f) - Bias = 0.f; + if (m_fBias >= 2.f) + m_fBias = 0.f; //float4x4 World = SMMatrixTranslation(Core::Data::ConstCurrentCameraPosition.x, Core::Data::ConstCurrentCameraPosition.y+50, Core::Data::ConstCurrentCameraPosition.z); //float4x4 World = SMMatrixTranslation(pos->x, pos->y+50, pos->z); float4x4 World = SMMatrixTranslation(0, pos->y, 0); - if(BFChange && FactorBlend >= 1.0) + if (m_isChange && m_fFactorBlend >= 1.0) { - FactorBlend = 0.0; - BFChangeMainTex = !BFChangeMainTex; - BFChange = false; + m_fFactorBlend = 0.0; + m_isChangeMainTex = !m_isChangeMainTex; + m_isChange = false; } - if(BFChangeMainTex) - { - g_pDXDevice->SetTexture(0,SkyCloudsTex2); - g_pDXDevice->SetTexture(1,SkyCloudsTex); - } - else - { - g_pDXDevice->SetTexture(0,SkyCloudsTex); - g_pDXDevice->SetTexture(1,SkyCloudsTex2); - } + if (m_isChangeMainTex) + { + g_pDXDevice->SetTexture(0, m_pSkyCloudsTex2); + g_pDXDevice->SetTexture(1, m_pSkyCloudsTex); + } + else + { + g_pDXDevice->SetTexture(0, m_pSkyCloudsTex); + g_pDXDevice->SetTexture(1, m_pSkyCloudsTex2); + } - if(!is_shadow) - { - /*D3DXMATRIX tmpdxView, tmpdxProjection; - g_pDXDevice->GetTransform(D3DTS_PROJECTION, &tmpdxProjection); - g_pDXDevice->GetTransform(D3DTS_VIEW, &tmpdxView);*/ - float4x4 View;// = float4x4(tmpdxView); - float4x4 Proj;// = float4x4(tmpdxProjection); + if(!is_shadow) + { + float4x4 View;// = float4x4(tmpdxView); + float4x4 Proj;// = float4x4(tmpdxProjection); - Core_RMatrixGet(G_RI_MATRIX_VIEW, &View); - Core_RMatrixGet(G_RI_MATRIX_PROJECTION, &Proj); + Core_RMatrixGet(G_RI_MATRIX_VIEW, &View); + Core_RMatrixGet(G_RI_MATRIX_PROJECTION, &Proj); - float4x4 WVP = (MatRotation * World) * View * Proj; + float4x4 WVP = (m_mMatRotation * World) * View * Proj; - WVP = SMMatrixTranspose(WVP); + WVP = SMMatrixTranspose(WVP); - SGCore_ShaderSetVRF(SHADER_TYPE_VERTEX, VS_RenderSkyClouds, "WorldViewProjection", &WVP); - SGCore_ShaderSetVRF(SHADER_TYPE_PIXEL, PS_RenderSkyClouds, "BlendFactorBias", &float2(FactorBlend, Bias)); - SGCore_ShaderSetVRF(SHADER_TYPE_PIXEL, PS_RenderSkyClouds, "Color", &Color); - SGCore_ShaderSetVRF(SHADER_TYPE_PIXEL, PS_RenderSkyClouds, "Alpha", &Alpha); - SGCore_ShaderBind(SHADER_TYPE_VERTEX, VS_RenderSkyClouds); - SGCore_ShaderBind(SHADER_TYPE_PIXEL, PS_RenderSkyClouds); - } - else - { - //D3DXMATRIX tmpdxViewProj; - //g_pDXDevice->GetTransform(D3DTS_WORLD1, &tmpdxViewProj); - float4x4 ViewProj;// = float4x4(tmpdxViewProj); - Core_RMatrixGet(G_RI_MATRIX_VIEWPROJ, &ViewProj); - float4x4 WVP = (MatRotation * World) * ViewProj; - - WVP = SMMatrixTranspose(WVP); - - SGCore_ShaderSetVRF(SHADER_TYPE_VERTEX, VS_RenderSkyClouds, "WorldViewProjection", &WVP); - SGCore_ShaderSetVRF(SHADER_TYPE_PIXEL, PS_RenderSkyCloudsShadow, "BlendFactorBias", &float2(FactorBlend, Bias)); - //SGCore_ShaderSetVRF(1, PS_RenderSkyCloudsShadow, "Color", &Color); - SGCore_ShaderSetVRF(SHADER_TYPE_PIXEL, PS_RenderSkyCloudsShadow, "Alpha", &Alpha); - SGCore_ShaderBind(SHADER_TYPE_VERTEX, VS_RenderSkyClouds); - SGCore_ShaderBind(SHADER_TYPE_PIXEL, PS_RenderSkyCloudsShadow); - } + SGCore_ShaderSetVRF(SHADER_TYPE_VERTEX, m_idVS, "WorldViewProjection", &WVP); + SGCore_ShaderSetVRF(SHADER_TYPE_PIXEL, m_idPS, "BlendFactorBias", &float2(m_fFactorBlend, m_fBias)); + SGCore_ShaderSetVRF(SHADER_TYPE_PIXEL, m_idPS, "Color", &m_vColor); + SGCore_ShaderSetVRF(SHADER_TYPE_PIXEL, m_idPS, "Alpha", &m_fAlpha); + SGCore_ShaderBind(SHADER_TYPE_VERTEX, m_idVS); + SGCore_ShaderBind(SHADER_TYPE_PIXEL, m_idPS); + } + else + { + float4x4 ViewProj;// = float4x4(tmpdxViewProj); + Core_RMatrixGet(G_RI_MATRIX_VIEWPROJ, &ViewProj); + float4x4 WVP = (m_mMatRotation * World) * ViewProj; + + WVP = SMMatrixTranspose(WVP); + + SGCore_ShaderSetVRF(SHADER_TYPE_VERTEX, m_idVS, "WorldViewProjection", &WVP); + SGCore_ShaderSetVRF(SHADER_TYPE_PIXEL, m_idPS_Shadow, "BlendFactorBias", &float2(m_fFactorBlend, m_fBias)); + //SGCore_ShaderSetVRF(1, PS_RenderSkyCloudsShadow, "Color", &Color); + SGCore_ShaderSetVRF(SHADER_TYPE_PIXEL, m_idPS_Shadow, "Alpha", &m_fAlpha); + SGCore_ShaderBind(SHADER_TYPE_VERTEX, m_idVS); + SGCore_ShaderBind(SHADER_TYPE_PIXEL, m_idPS_Shadow); + } - g_pDXDevice->SetStreamSource(0, SkyCloudsVertices, 0, sizeof(SkyCloudsVertex)); - g_pDXDevice->SetIndices(this->SkyCloudsIndeces); - g_pDXDevice->SetVertexDeclaration(VertexDeclarationClouds); + g_pDXDevice->SetStreamSource(0, m_pSkyCloudsVertices, 0, sizeof(CSkyCloudsVertex)); + g_pDXDevice->SetIndices(m_pSkyCloudsIndeces); + g_pDXDevice->SetVertexDeclaration(m_pVertexDeclarationClouds); g_pDXDevice->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, 0, 0, 4, 0, 2); diff --git a/source/gcore/sky.h b/source/gcore/sky.h index a2805c8a17ac9bb6abe0e0aa3215e40f5cc6edf6..0f273680bb8b69121aa28ff2dafdad96d7744c5a 100644 --- a/source/gcore/sky.h +++ b/source/gcore/sky.h @@ -1,4 +1,9 @@ +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #ifndef __SKY_H #define __SKY_H @@ -8,13 +13,14 @@ #include <common/String.h> #include "sxgcore.h" -extern report_func g_fnReportf; extern IDirect3DDevice9 *g_pDXDevice; extern D3DPRESENT_PARAMETERS g_oD3DAPP; -struct SkyBoxVertex +//########################################################################## + +struct CSkyBoxVertex { - SkyBoxVertex(float x,float y,float z,float u,float v,float w) + CSkyBoxVertex(float x,float y,float z,float u,float v,float w) { _x = x; _y = y; _z = z; _u = u; _v = v; _w = w; } @@ -22,52 +28,55 @@ struct SkyBoxVertex float _u, _v, _w; }; -class SkyBox +//************************************************************************** + +class CSkyBox { public: - SkyBox(); - ~SkyBox(); - void LoadTextures(const char *texture); - bool IsLoadTex(); - void ChangeTexture(const char *texture); - void GetActiveTexture(char *texture); - void GetSecondTexture(char *texture); - void SetRotation(float angle); - float GetRotation(); - void SetColor(float4_t* color); - void GetColor(float4_t* color); - void Render(float timeDelta,float3* pos,bool is_shadow); + CSkyBox(); + ~CSkyBox(); + void loadTextures(const char *szTexture); + bool isLoadTex(); + void changeTexture(const char *szTexture); + void getActiveTexture(char *szTexture); + void getSecondTexture(char *szTexture); + void setRotation(float fAngle); + float getRotation(); + void setColor(const float4_t *pColor); + void getColor(float4_t *pColor); + void render(float timeDelta, const float3 *pPos,bool isShadow); SX_ALIGNED_OP_MEM protected: - IDirect3DVertexDeclaration9* VertexDeclarationSkyBox; + IDirect3DVertexDeclaration9* m_pVertexDeclarationSkyBox; - char TexActive[SXGC_LOADTEX_MAX_SIZE_DIRNAME]; - char TexSecond[SXGC_LOADTEX_MAX_SIZE_DIRNAME]; - float RotaionY; - float4x4 MatRotation; - float4_t Color; - float FactorBlend; - - bool BFChange; - bool BFChangeMainTex; - - IDirect3DCubeTexture9* Tex; - IDirect3DCubeTexture9* Tex2; - IDirect3DVertexBuffer9* Vertices; - IDirect3DIndexBuffer9* Indeces; - - ID VS_RenderSkyBox; - ID PS_RenderSkyBox; + char m_szTexActive[SXGC_LOADTEX_MAX_SIZE_DIRNAME]; + char m_szTexSecond[SXGC_LOADTEX_MAX_SIZE_DIRNAME]; + float m_fRotaionY; + float4x4 m_mMatRotation; + float4_t m_vColor; + float m_fFactorBlend; + + bool m_isChange; + bool m_isChangeMainTex; + + IDirect3DCubeTexture9 *m_pTexture; + IDirect3DCubeTexture9 *m_pTexture2; + IDirect3DVertexBuffer9 *m_pVertices; + IDirect3DIndexBuffer9 *m_pIndeces; + + ID m_idVS; + ID m_idPS; }; +//########################################################################## -struct SkyCloudsVertex +struct CSkyCloudsVertex { - SkyCloudsVertex(float x,float y,float z,float u,float v) + CSkyCloudsVertex(float x,float y,float z,float u,float v) { _x = x; _y = y; _z = z; _u = u; _v = v; } @@ -75,59 +84,60 @@ struct SkyCloudsVertex float _u, _v; }; +//************************************************************************** -class SkyClouds +class CSkyClouds { public: - SkyClouds(); - ~SkyClouds(); + CSkyClouds(); + ~CSkyClouds(); //���������� ��������� ������� //���� ������ ����������� ����, �� ���� ���� ������ ��������� ����� ���� ������� - void SetWidthHeightPos(float width,float height,float3* pos); - void LoadTextures(const char *texture); - bool IsLoadTex(); - void ChangeTexture(const char *texture); + void setWidthHeightPos(float iWidth,float iHeight, const float3 *pPos); + void loadTextures(const char *szTexture); + bool isLoadTex(); + void changeTexture(const char *szTexture); - void SetRotation(float angle); - float GetRotation(); - void SetAlpha(float alpha); - float GetAlpha(); - void SetColor(float4_t* color); - void GetColor(float4_t* color); + void setRotation(float fAngle); + float getRotation(); + void setAlpha(float fAngle); + float getAlpha(); + void setColor(const float4_t *pColor); + void getColor(float4_t *pColor); - void SetSpeed(float speed); - float GetSpeed(); + void setSpeed(float fSpeed); + float getSpeed(); - void Render(DWORD timeDetlta,float3* pos,bool is_shadow); + void render(DWORD timeDetlta, const float3 *pPos,bool isShadow); SX_ALIGNED_OP_MEM private: - IDirect3DVertexDeclaration9* VertexDeclarationClouds; - float Alpha; - float RotaionY; - float4x4 MatRotation; - float4_t Color; + IDirect3DVertexDeclaration9 *m_pVertexDeclarationClouds; + float m_fAlpha; + float m_fRotaionY; + float4x4 m_mMatRotation; + float4_t m_vColor; - float FactorBlend; - float2_t WidthHeight; - bool BFChange; - bool BFChangeMainTex; + float m_fFactorBlend; + float2_t m_vWidthHeight; + bool m_isChange; + bool m_isChangeMainTex; - float Speed; - float Bias; - SkyCloudsVertex* Vertices; - IDirect3DVertexBuffer9* SkyCloudsVertices; - IDirect3DIndexBuffer9* SkyCloudsIndeces; + float m_fSpeed; + float m_fBias; + CSkyCloudsVertex *m_pVertices; + IDirect3DVertexBuffer9 *m_pSkyCloudsVertices; + IDirect3DIndexBuffer9 *m_pSkyCloudsIndeces; - IDirect3DTexture9* SkyCloudsTex; - IDirect3DTexture9* SkyCloudsTex2; + IDirect3DTexture9 *m_pSkyCloudsTex; + IDirect3DTexture9 *m_pSkyCloudsTex2; - ID VS_RenderSkyClouds; - ID PS_RenderSkyClouds; + ID m_idVS; + ID m_idPS; - ID PS_RenderSkyCloudsShadow; + ID m_idPS_Shadow; }; #endif diff --git a/source/gcore/sxgcore.cpp b/source/gcore/sxgcore.cpp index 6a7b66c7d8dd7bbb8e27dc10c0e3c91a3ce648b9..6905957b693718b6a79b03aa8f86a5afef227317 100644 --- a/source/gcore/sxgcore.cpp +++ b/source/gcore/sxgcore.cpp @@ -1,8 +1,8 @@ -/****************************************************** -Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017 +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 See the license in LICENSE -******************************************************/ +***********************************************************/ #include "sxgcore.h" @@ -21,6 +21,16 @@ See the license in LICENSE report_func g_fnReportf = DefReport; #endif +/*inline void LibReport(int iLevel, const char *szFormat, ...) +{ + static char szStr[REPORT_MSG_MAX_LEN]; + szStr[0] = 0; + int iStrLen = sizeof(szStr); + format_str(szStr, szFormat); + + g_fnReportf(iLevel, SX_LIB_NAME, szStr); +}*/ + IDirect3DDevice9 *g_pDXDevice = 0; D3DPRESENT_PARAMETERS g_oD3DAPP; IDirect3D9 *g_pD3D9 = 0; @@ -43,7 +53,7 @@ void StdMtlSet(ID id, float4x4* world) ID StdMtlLoad(const char* name, int mtl_type) { - return SGCore_LoadTexAddName(name, LoadTexType::ltt_load); + return SGCore_LoadTexAddName(name, LOAD_TEXTURE_TYPE_LOAD); } int StdMtlGetSort(ID id) @@ -79,23 +89,23 @@ CShaderManager *g_pManagerShaders = 0; CreatorTextures *g_pManagerRenderTargets = 0; LoaderTextures *g_pManagerTextures = 0; ID3DXMesh *g_pScreenTexture = 0; -SkyBox *g_pSkyBox = 0; -SkyClouds *g_pSkyClouds = 0; +CSkyBox *g_pSkyBox = 0; +CSkyClouds *g_pSkyClouds = 0; -#define SG_PRECOND(retval) if(!g_pDXDevice){ g_fnReportf(REPORT_MSG_LEVEL_ERROR, "%s: %s - sxgcore is not init", SX_LIB_NAME, GEN_MSG_LOCATION); return retval;} -#define SG_PRECOND_SKY_BOX(retval) SG_PRECOND(retval _VOID); if(!g_pSkyBox){ g_fnReportf(REPORT_MSG_LEVEL_ERROR, "%s: %s - sky_box is not init", SX_LIB_NAME, GEN_MSG_LOCATION); return retval;} -#define SG_PRECOND_SKY_CLOUDS(retval) SG_PRECOND(retval _VOID); if(!g_pSkyClouds){ g_fnReportf(REPORT_MSG_LEVEL_ERROR, "%s: %s - sky_clouds is not init", SX_LIB_NAME, GEN_MSG_LOCATION); return retval;} +#define SG_PRECOND(retval) if(!g_pDXDevice){ LibReport(REPORT_MSG_LEVEL_ERROR, "%s - sxgcore is not init", GEN_MSG_LOCATION); return retval;} +#define SG_PRECOND_SKY_BOX(retval) SG_PRECOND(retval _VOID); if(!g_pSkyBox){ LibReport(REPORT_MSG_LEVEL_ERROR, "%s - sky_box is not init", GEN_MSG_LOCATION); return retval;} +#define SG_PRECOND_SKY_CLOUDS(retval) SG_PRECOND(retval _VOID); if(!g_pSkyClouds){ LibReport(REPORT_MSG_LEVEL_ERROR, "%s - sky_clouds is not init", GEN_MSG_LOCATION); return retval;} //########################################################################## -void GCoreInit(HWND hwnd, int width, int heigth, bool windowed, DWORD create_device_flags) +void GCoreInit(HWND hWnd, int iWidth, int iHeigth, bool isWindowed, DWORD dwFlags) { g_pD3D9 = Direct3DCreate9(D3D_SDK_VERSION); if (!g_pD3D9) { - g_fnReportf(-1, "%s: %s - none detected d3d, sxgcore", SX_LIB_NAME, GEN_MSG_LOCATION); + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - none detected d3d", GEN_MSG_LOCATION); return; } @@ -103,24 +113,24 @@ void GCoreInit(HWND hwnd, int width, int heigth, bool windowed, DWORD create_dev g_pD3D9->GetDeviceCaps(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, &caps); memset(&g_oD3DAPP, 0, sizeof(g_oD3DAPP)); - g_oD3DAPP.BackBufferWidth = width; - g_oD3DAPP.BackBufferHeight = heigth; + g_oD3DAPP.BackBufferWidth = iWidth; + g_oD3DAPP.BackBufferHeight = iHeigth; g_oD3DAPP.BackBufferFormat = D3DFMT_A8R8G8B8; g_oD3DAPP.BackBufferCount = 1; g_oD3DAPP.MultiSampleType = D3DMULTISAMPLE_NONE; g_oD3DAPP.MultiSampleQuality = 0; g_oD3DAPP.SwapEffect = D3DSWAPEFFECT_DISCARD; - g_oD3DAPP.hDeviceWindow = hwnd; - g_oD3DAPP.Windowed = windowed; + g_oD3DAPP.hDeviceWindow = hWnd; + g_oD3DAPP.Windowed = isWindowed; g_oD3DAPP.EnableAutoDepthStencil = true; g_oD3DAPP.AutoDepthStencilFormat = D3DFMT_D24S8; - g_oD3DAPP.Flags = D3DPRESENTFLAG_DISCARD_DEPTHSTENCIL | create_device_flags | D3DCREATE_MULTITHREADED; + g_oD3DAPP.Flags = D3DPRESENTFLAG_DISCARD_DEPTHSTENCIL | dwFlags | D3DCREATE_MULTITHREADED; g_oD3DAPP.FullScreen_RefreshRateInHz = D3DPRESENT_RATE_DEFAULT; g_oD3DAPP.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE; - if (FAILED(g_pD3D9->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hwnd, D3DCREATE_HARDWARE_VERTEXPROCESSING | create_device_flags | D3DCREATE_MULTITHREADED, &g_oD3DAPP, &g_pDXDevice))) + if (FAILED(g_pD3D9->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd, D3DCREATE_HARDWARE_VERTEXPROCESSING | dwFlags | D3DCREATE_MULTITHREADED, &g_oD3DAPP, &g_pDXDevice))) { - g_fnReportf(-1, "%s: %s - failed initialized d3d, sxgcore", SX_LIB_NAME, GEN_MSG_LOCATION); + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - failed initialized d3d", GEN_MSG_LOCATION); return; } @@ -232,24 +242,24 @@ SX_LIB_API void SGCore_Dbg_Set(report_func rf) g_fnReportf = rf; } -SX_LIB_API void SGCore_0Create(const char* name, HWND hwnd, int width, int heigth, bool windowed, DWORD create_device_flags, bool is_unic) +SX_LIB_API void SGCore_0Create(const char *szName, HWND hWnd, int iWidth, int iHeigth, bool isWindowed, DWORD dwFlags, bool isUnic) { - if (name && strlen(name) > 1) + if (szName && strlen(szName) > 1) { - if (is_unic) + if (isUnic) { - HANDLE hMutex = CreateMutex(NULL, FALSE, name); + HANDLE hMutex = CreateMutex(NULL, FALSE, szName); if (GetLastError() == ERROR_ALREADY_EXISTS) { CloseHandle(hMutex); - g_fnReportf(REPORT_MSG_LEVEL_ERROR, "%s: %s - none unic name, sxgcore", SX_LIB_NAME, GEN_MSG_LOCATION); + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - none unic name", GEN_MSG_LOCATION); return; } } - GCoreInit(hwnd, width, heigth, windowed, create_device_flags); + GCoreInit(hWnd, iWidth, iHeigth, isWindowed, dwFlags); } else - g_fnReportf(REPORT_MSG_LEVEL_ERROR, "%s: %s - not init argument [name], sxgcore", SX_LIB_NAME, GEN_MSG_LOCATION); + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - not init argument [name], sxgcore", GEN_MSG_LOCATION); } SX_LIB_API const DEVMODE* SGCore_GetModes(int *iCount) @@ -284,14 +294,14 @@ SX_LIB_API IDirect3DDevice9* SGCore_GetDXDevice() return g_pDXDevice; } -SX_LIB_API void SGCore_DbgMsg(const char* format, ...) +SX_LIB_API void SGCore_DbgMsg(const char *szFormat, ...) { SG_PRECOND(_VOID); va_list va; char buf[SXGC_STR_SIZE_DBG_MSG]; - va_start(va, format); - vsprintf_s(buf, SXGC_STR_SIZE_DBG_MSG, format, va); + va_start(va, szFormat); + vsprintf_s(buf, SXGC_STR_SIZE_DBG_MSG, szFormat, va); va_end(va); RECT rect; @@ -363,22 +373,22 @@ SX_LIB_API void SGCore_ScreenQuadDraw() //########################################################################## -SX_LIB_API void SGCore_DIP(UINT type_primitive, long base_vertexIndex, UINT min_vertex_index, UINT num_vertices, UINT start_index, UINT prim_count) +SX_LIB_API void SGCore_DIP(UINT uiTypePrimitive, long lBaseVertexIndex, UINT uiMinVertexIndex, UINT uiNumVertices, UINT uiStartIndex, UINT uiPrimitiveCount) { SG_PRECOND(_VOID); - FuncDIP(type_primitive, base_vertexIndex, min_vertex_index, num_vertices, start_index, prim_count); + FuncDIP(uiTypePrimitive, lBaseVertexIndex, uiMinVertexIndex, uiNumVertices, uiStartIndex, uiPrimitiveCount); } -SX_LIB_API void SGCore_MtlSet(ID id, float4x4* world) +SX_LIB_API void SGCore_MtlSet(ID id, float4x4 *pWorld) { SG_PRECOND(_VOID); - FuncMtlSet(id, world); + FuncMtlSet(id, pWorld); } -SX_LIB_API ID SGCore_MtlLoad(const char* name, int mtl_type) +SX_LIB_API ID SGCore_MtlLoad(const char *szName, int iMtlType) { SG_PRECOND(-1); - return FuncMtlLoad(name, mtl_type); + return FuncMtlLoad(szName, iMtlType); } SX_LIB_API int SGCore_MtlGetSort(ID id) @@ -400,49 +410,49 @@ SX_LIB_API bool SGCore_MtlGroupRenderIsSingly(ID id) } -SX_LIB_API void SGCore_SetFunc_DIP(g_func_dip func) +SX_LIB_API void SGCore_SetFunc_DIP(g_func_dip fnFunc) { SG_PRECOND(_VOID); - FuncDIP = func; + FuncDIP = fnFunc; } -SX_LIB_API void SGCore_SetFunc_MtlSet(g_func_mtl_set func) +SX_LIB_API void SGCore_SetFunc_MtlSet(g_func_mtl_set fnFunc) { SG_PRECOND(_VOID); - FuncMtlSet = func; + FuncMtlSet = fnFunc; } -SX_LIB_API void SGCore_SetFunc_MtlLoad(g_func_mtl_load func) +SX_LIB_API void SGCore_SetFunc_MtlLoad(g_func_mtl_load fnFunc) { SG_PRECOND(_VOID); - FuncMtlLoad = func; + FuncMtlLoad = fnFunc; } -SX_LIB_API void SGCore_SetFunc_MtlGetSort(g_func_mtl_get_sort func) +SX_LIB_API void SGCore_SetFunc_MtlGetSort(g_func_mtl_get_sort fnFunc) { SG_PRECOND(_VOID); - FuncMtlGetSort = func; + FuncMtlGetSort = fnFunc; } -SX_LIB_API void SGCore_SetFunc_MtlGetPhysicType(g_func_mtl_get_physic_type func) +SX_LIB_API void SGCore_SetFunc_MtlGetPhysicType(g_func_mtl_get_physic_type fnFunc) { SG_PRECOND(_VOID); - FuncMtlGetPhysicType = func; + FuncMtlGetPhysicType = fnFunc; } -SX_LIB_API void SGCore_SetFunc_MtlGroupRenderIsSingly(g_func_mtl_group_render_is_singly func) +SX_LIB_API void SGCore_SetFunc_MtlGroupRenderIsSingly(g_func_mtl_group_render_is_singly fnFunc) { SG_PRECOND(_VOID); - FuncMtlGroupRenderIsSingly = func; + FuncMtlGroupRenderIsSingly = fnFunc; } //########################################################################## -SX_LIB_API ID SGCore_ShaderLoad(SHADER_TYPE type_shader, const char* path, const char* name, SHADER_CHECKDOUBLE is_check_double, D3DXMACRO* macro) +SX_LIB_API ID SGCore_ShaderLoad(SHADER_TYPE type_shader, const char *szPath, const char *szName, SHADER_CHECKDOUBLE check_double, D3DXMACRO *pMacro) { SG_PRECOND(-1); - return g_pManagerShaders->preLoad(type_shader, path, name, is_check_double, macro); + return g_pManagerShaders->preLoad(type_shader, szPath, szName, check_double, pMacro); } SX_LIB_API void SGCore_ShaderAllLoad() @@ -452,11 +462,11 @@ SX_LIB_API void SGCore_ShaderAllLoad() return g_pManagerShaders->allLoad(); } -SX_LIB_API void SGCore_ShaderUpdateN(SHADER_TYPE type_shader, const char* name) +SX_LIB_API void SGCore_ShaderUpdateN(SHADER_TYPE type_shader, const char *szName) { SG_PRECOND(_VOID); - g_pManagerShaders->update(type_shader, name); + g_pManagerShaders->update(type_shader, szName); } SX_LIB_API void SGCore_ShaderUpdate(SHADER_TYPE type_shader, ID id) @@ -473,25 +483,25 @@ SX_LIB_API void SGCore_ShaderReloadAll() g_pManagerShaders->reloadAll(); } -SX_LIB_API ID SGCore_ShaderGetID(SHADER_TYPE type_shader, const char* shader) +SX_LIB_API ID SGCore_ShaderGetID(SHADER_TYPE type_shader, const char *szNameShader) { SG_PRECOND(-1); - return g_pManagerShaders->getID(type_shader, shader); + return g_pManagerShaders->getID(type_shader, szNameShader); } -SX_LIB_API void SGCore_ShaderBindN(SHADER_TYPE type_shader, const char* shader) +SX_LIB_API void SGCore_ShaderBindN(SHADER_TYPE type_shader, const char *szNameShader) { SG_PRECOND(_VOID); - return g_pManagerShaders->bind(type_shader, shader); + return g_pManagerShaders->bind(type_shader, szNameShader); } -SX_LIB_API void SGCore_ShaderBind(SHADER_TYPE type_shader, ID shader) +SX_LIB_API void SGCore_ShaderBind(SHADER_TYPE type_shader, ID idShader) { SG_PRECOND(_VOID); - return g_pManagerShaders->bind(type_shader, shader); + return g_pManagerShaders->bind(type_shader, idShader); } @@ -596,7 +606,7 @@ SX_LIB_API void SGCore_LoadTexDelete(ID id) g_pManagerTextures->Delete(id); } -SX_LIB_API ID SGCore_LoadTexAddName(const char* name, LoadTexType type) +SX_LIB_API ID SGCore_LoadTexAddName(const char* name, LOAD_TEXTURE_TYPE type) { SG_PRECOND(-1); @@ -624,7 +634,7 @@ SX_LIB_API ID SGCore_LoadTexCreate(const char* name, IDirect3DTexture9* tex) return g_pManagerTextures->Create(name, tex); } -SX_LIB_API ID SGCore_LoadTexUpdateN(const char* name, LoadTexType type) +SX_LIB_API ID SGCore_LoadTexUpdateN(const char* name, LOAD_TEXTURE_TYPE type) { SG_PRECOND(-1); @@ -829,22 +839,22 @@ SX_LIB_API bool SGCore_0InretsectBox(const float3 * min1, const float3 * max1, c SX_LIB_API ISXFrustum* SGCore_CrFrustum() { - return new Frustum(); + return new CFrustum(); } SX_LIB_API ISXCamera* SGCore_CrCamera() { - return new Camera(); + return new CCamera(); } SX_LIB_API ISXTransObject* SGCore_CrTransObject() { - return new SXTransObject(); + return new CSXTransObject(); } SX_LIB_API ISXBound* SGCore_CrBound() { - return new SXBound(); + return new CSXBound(); } //########################################################################## @@ -896,9 +906,9 @@ SX_LIB_API void SGCore_SkyBoxCr() SG_PRECOND(_VOID); if (g_pSkyBox) - g_fnReportf(REPORT_MSG_LEVEL_WARNING, "%s: sky_box is already init", SX_LIB_NAME); + LibReport(REPORT_MSG_LEVEL_WARNING, "sky_box is already init"); else - g_pSkyBox = new SkyBox(); + g_pSkyBox = new CSkyBox(); } SX_LIB_API bool SGCore_SkyBoxIsCr() @@ -910,61 +920,61 @@ SX_LIB_API bool SGCore_SkyBoxIsCr() SX_LIB_API bool SGCore_SkyBoxIsLoadTex() { SG_PRECOND_SKY_BOX(false); - return g_pSkyBox->IsLoadTex(); + return g_pSkyBox->isLoadTex(); } SX_LIB_API void SGCore_SkyBoxLoadTex(const char *texture) { SG_PRECOND_SKY_BOX(_VOID); - g_pSkyBox->LoadTextures(texture); + g_pSkyBox->loadTextures(texture); } SX_LIB_API void SGCore_SkyBoxChangeTex(const char *texture) { SG_PRECOND_SKY_BOX(_VOID); - g_pSkyBox->ChangeTexture(texture); + g_pSkyBox->changeTexture(texture); } SX_LIB_API void SGCore_SkyBoxGetActiveTex(char *texture) { SG_PRECOND_SKY_BOX(_VOID); - g_pSkyBox->GetActiveTexture(texture); + g_pSkyBox->getActiveTexture(texture); } SX_LIB_API void SGCore_SkyBoxGetSecondTex(char *texture) { SG_PRECOND_SKY_BOX(_VOID); - g_pSkyBox->GetSecondTexture(texture); + g_pSkyBox->getSecondTexture(texture); } SX_LIB_API void SGCore_SkyBoxSetRot(float angle) { SG_PRECOND_SKY_BOX(_VOID); - g_pSkyBox->SetRotation(angle); + g_pSkyBox->setRotation(angle); } SX_LIB_API float SGCore_SkyBoxGetRot() { SG_PRECOND_SKY_BOX(0); - return g_pSkyBox->GetRotation(); + return g_pSkyBox->getRotation(); } -SX_LIB_API void SGCore_SkyBoxSetColor(float4_t* color) +SX_LIB_API void SGCore_SkyBoxSetColor(const float4_t* color) { SG_PRECOND_SKY_BOX(_VOID); - g_pSkyBox->SetColor(color); + g_pSkyBox->setColor(color); } SX_LIB_API void SGCore_SkyBoxGetColor(float4_t* color) { SG_PRECOND_SKY_BOX(_VOID); - g_pSkyBox->GetColor(color); + g_pSkyBox->getColor(color); } -SX_LIB_API void SGCore_SkyBoxRender(float timeDelta, float3* pos) +SX_LIB_API void SGCore_SkyBoxRender(float timeDelta, const float3* pos) { SG_PRECOND_SKY_BOX(_VOID); - g_pSkyBox->Render(timeDelta, pos, false); + g_pSkyBox->render(timeDelta, pos, false); } //************************************************************************** @@ -974,9 +984,9 @@ SX_LIB_API void SGCore_SkyCloudsCr() SG_PRECOND(_VOID); if (g_pSkyClouds) - g_fnReportf(REPORT_MSG_LEVEL_WARNING, "%s: sky_clouds is already init", SX_LIB_NAME); + LibReport(REPORT_MSG_LEVEL_WARNING, "sky_clouds is already init"); else - g_pSkyClouds = new SkyClouds(); + g_pSkyClouds = new CSkyClouds(); } SX_LIB_API bool SGCore_SkyCloudsIsCr() @@ -990,77 +1000,77 @@ SX_LIB_API bool SGCore_SkyCloudsIsLoadTex() { SG_PRECOND_SKY_CLOUDS(false); - return g_pSkyClouds->IsLoadTex(); + return g_pSkyClouds->isLoadTex(); } -SX_LIB_API void SGCore_SkyCloudsSetWidthHeightPos(float width, float height, float3* pos) +SX_LIB_API void SGCore_SkyCloudsSetWidthHeightPos(float width, float height, const float3* pos) { SG_PRECOND_SKY_CLOUDS(_VOID); - g_pSkyClouds->SetWidthHeightPos(width, height, pos); + g_pSkyClouds->setWidthHeightPos(width, height, pos); } SX_LIB_API void SGCore_SkyCloudsLoadTex(const char *texture) { SG_PRECOND_SKY_CLOUDS(_VOID); - g_pSkyClouds->LoadTextures(texture); + g_pSkyClouds->loadTextures(texture); } SX_LIB_API void SGCore_SkyCloudsChangeTex(const char *texture) { SG_PRECOND_SKY_CLOUDS(_VOID); - g_pSkyClouds->ChangeTexture(texture); + g_pSkyClouds->changeTexture(texture); } SX_LIB_API void SGCore_SkyCloudsSetRot(float angle) { SG_PRECOND_SKY_CLOUDS(_VOID); - g_pSkyClouds->SetRotation(angle); + g_pSkyClouds->setRotation(angle); } SX_LIB_API float SGCore_SkyCloudsGetRot() { SG_PRECOND_SKY_CLOUDS(0); - return g_pSkyClouds->GetRotation(); + return g_pSkyClouds->getRotation(); } SX_LIB_API void SGCore_SkyCloudsSetAlpha(float alpha) { SG_PRECOND_SKY_CLOUDS(_VOID); - g_pSkyClouds->SetAlpha(alpha); + g_pSkyClouds->setAlpha(alpha); } SX_LIB_API float SGCore_SkyCloudsGetAlpha() { SG_PRECOND_SKY_CLOUDS(0); - return g_pSkyClouds->GetAlpha(); + return g_pSkyClouds->getAlpha(); } SX_LIB_API void SGCore_SkyCloudsSetSpeed(float speed) { SG_PRECOND_SKY_CLOUDS(_VOID); - g_pSkyClouds->SetSpeed(speed); + g_pSkyClouds->setSpeed(speed); } SX_LIB_API float SGCore_SkyCloudsGetSpeed() { SG_PRECOND_SKY_CLOUDS(0); - return g_pSkyClouds->GetSpeed(); + return g_pSkyClouds->getSpeed(); } -SX_LIB_API void SGCore_SkyCloudsSetColor(float4_t* color) +SX_LIB_API void SGCore_SkyCloudsSetColor(const float4_t* color) { SG_PRECOND_SKY_CLOUDS(_VOID); - g_pSkyClouds->SetColor(color); + g_pSkyClouds->setColor(color); } SX_LIB_API void SGCore_SkyCloudsGetColor(float4_t* color) { SG_PRECOND_SKY_CLOUDS(_VOID); - g_pSkyClouds->GetColor(color); + g_pSkyClouds->getColor(color); } -SX_LIB_API void SGCore_SkyCloudsRender(DWORD timeDetlta, float3* pos, bool is_shadow) +SX_LIB_API void SGCore_SkyCloudsRender(DWORD timeDetlta, const float3* pos, bool is_shadow) { SG_PRECOND_SKY_CLOUDS(_VOID); - g_pSkyClouds->Render(timeDetlta, pos, is_shadow); + g_pSkyClouds->render(timeDetlta, pos, is_shadow); } diff --git a/source/gcore/sxgcore.h b/source/gcore/sxgcore.h index bc8a394710fae4b1e3becb5f8b1716876978f30f..882e36ed389e8fcadcf646a29efd033a00cbf4f7 100644 --- a/source/gcore/sxgcore.h +++ b/source/gcore/sxgcore.h @@ -1,8 +1,8 @@ -/****************************************************** -Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017 +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 See the license in LICENSE -******************************************************/ +***********************************************************/ /*! \file @@ -31,9 +31,6 @@ See the license in LICENSE #define SX_LIB_API extern "C" __declspec (dllimport) #include <core/sxcore.h> -//! имя библиотеки -#define SX_LIB_NAME COLOR_GREEN "CORE" COLOR_RESET - #ifdef SX_DLL #undef SX_LIB_API #define SX_LIB_API extern "C" __declspec (dllexport) @@ -69,7 +66,7 @@ See the license in LICENSE SX_LIB_API long SGCore_0GetVersion(); //! установка функции вывода сообщений -SX_LIB_API void SGCore_Dbg_Set(report_func rf); +SX_LIB_API void SGCore_Dbg_Set(report_func fnReport); //! инициализация подсистемы SX_LIB_API void SGCore_0Create( @@ -88,7 +85,7 @@ SX_LIB_API void SGCore_AKill(); //! возвращает dx устройство SX_LIB_API IDirect3DDevice9* SGCore_GetDXDevice(); -//! возвращает массив всех доступных разрешений монитора +//! возвращает массив всех доступных разрешений монитора, в iCount записывает размер массива SX_LIB_API const DEVMODE* SGCore_GetModes(int *iCount); //!@} @@ -120,9 +117,9 @@ SX_LIB_API void SGCore_OnLostDevice(); //! вызывать при попытке сброса устройства SX_LIB_API bool SGCore_OnDeviceReset( - int width, //!< новая ширина окна - int heigth, //!< новая выоста окна - bool windewed //!< true - оконный режим, false - полноэкранный + int iWwidth, //!< новая ширина окна + int iHeigth, //!< новая выоста окна + bool isWindewed //!< true - оконный режим, false - полноэкранный ); //! вызывать при сбросе устроства @@ -141,17 +138,17 @@ value - для Filter D3DTEXTUREFILTERTYPE, для Address D3DTEXTUREADDRESS @{*/ //! установка фильтрации для конкретного слота -SX_LIB_API void SGCore_SetSamplerFilter(DWORD id, DWORD value); +SX_LIB_API void SGCore_SetSamplerFilter(DWORD dwNum, DWORD dwValue); //! установка фильтрации для набора слотов от begin_id до end_id -SX_LIB_API void SGCore_SetSamplerFilter2(DWORD begin_id, DWORD end_id, DWORD value); +SX_LIB_API void SGCore_SetSamplerFilter2(DWORD dwNumStart, DWORD dwCount, DWORD dwValue); //! установка адресации для конкретного слота -SX_LIB_API void SGCore_SetSamplerAddress(DWORD id, DWORD value); +SX_LIB_API void SGCore_SetSamplerAddress(DWORD dwNum, DWORD dwValue); //! установка адресации для набора слотов от begin_id до end_id -SX_LIB_API void SGCore_SetSamplerAddress2(DWORD begin_id, DWORD end_id, DWORD value); +SX_LIB_API void SGCore_SetSamplerAddress2(DWORD dwNumStart, DWORD dwCount, DWORD dwValue); //!@} @@ -171,19 +168,19 @@ SX_LIB_API void SGCore_SetSamplerAddress2(DWORD begin_id, DWORD end_id, DWORD va /*! draw indexed primitive, команда отрисовки. Аналогична DrawIndexedPrimitive, в дополнение к DIP инкрементирует счетчик DIPов в int регистрах по индексу #G_RI_INT_COUNT_DIP, обнуление данных только на стороне приложения */ -typedef void(*g_func_dip) (UINT type_primitive, long base_vertexIndex, UINT min_vertex_index, UINT num_vertices, UINT start_index, UINT prim_count); +typedef void(*g_func_dip) (UINT uiTypePrimitive, long lBaseVertexIndex, UINT uiMinVertexIndex, UINT uiNumVertices, UINT uiStartIndex, UINT uiPrimitiveCount); /*! установка материала id, world - мировая матрица. По умолчанию установка текстуры в нулевой текстурный слот, id – идентификатор материала (по умолчанию - текстуры), world – матрица трансформации модели */ -typedef void(*g_func_mtl_set) (ID id, float4x4* world); +typedef void(*g_func_mtl_set) (ID id, float4x4 *pWorld); -/*! загрузка материала, name - имя текстуры с расширением, mtl_type - тип материала на случай провала загрузки. -Загрузка материала (по умолчанию – текстуры) с именем name, mtl_type – типа материала, +/*! загрузка материала, szName - имя текстуры с расширением, iMtlType - тип материала на случай провала загрузки. +Загрузка материала (по умолчанию – текстуры) с именем name, iMtlType – типа материала, будет задействован только в случае провала определения типа материала (по умолчанию не используется) - -тип стандартного материала будет определен на основании mtl_type, может принимать одно из значений MTL_TYPE_ +тип стандартного материала будет определен на основании iMtlType, может принимать одно из значений MTL_TYPE_ */ -typedef ID(*g_func_mtl_load) (const char* name, int mtl_type); +typedef ID(*g_func_mtl_load) (const char *szName, int iMtlType); //! получить сорт материала, по дефолту 0 typedef int(*g_func_mtl_get_sort) (ID id); @@ -200,13 +197,13 @@ typedef bool(*g_func_mtl_group_render_is_singly) (ID id); !@{*/ //! \copydoc g_func_dip -SX_LIB_API void SGCore_DIP(UINT type_primitive, long base_vertexIndex, UINT min_vertex_index, UINT num_vertices, UINT start_index, UINT prim_count); +SX_LIB_API void SGCore_DIP(UINT uiTypePrimitive, long lBaseVertexIndex, UINT uiMinVertexIndex, UINT uiNumVertices, UINT uiStartIndex, UINT uiPrimitiveCount); //! \copydoc g_func_mtl_set -SX_LIB_API void SGCore_MtlSet(ID id, float4x4* world); +SX_LIB_API void SGCore_MtlSet(ID id, float4x4 *pWorld); //! \copydoc g_func_mtl_load -SX_LIB_API ID SGCore_MtlLoad(const char* name, int mtl_type); +SX_LIB_API ID SGCore_MtlLoad(const char *szName, int iMtlType); //! \copydoc g_func_mtl_get_sort SX_LIB_API int SGCore_MtlGetSort(ID id); @@ -225,22 +222,22 @@ SX_LIB_API bool SGCore_MtlGroupRenderIsSingly(ID id); !@{*/ //! переназначение g_func_dip -SX_LIB_API void SGCore_SetFunc_DIP(g_func_dip func); +SX_LIB_API void SGCore_SetFunc_DIP(g_func_dip fnFunc); //! переназначение g_func_mtl_set -SX_LIB_API void SGCore_SetFunc_MtlSet(g_func_mtl_set func); +SX_LIB_API void SGCore_SetFunc_MtlSet(g_func_mtl_set fnFunc); //! переназначение g_func_mtl_load -SX_LIB_API void SGCore_SetFunc_MtlLoad(g_func_mtl_load func); +SX_LIB_API void SGCore_SetFunc_MtlLoad(g_func_mtl_load fnFunc); //! переназначение g_func_mtl_get_sort -SX_LIB_API void SGCore_SetFunc_MtlGetSort(g_func_mtl_get_sort func); +SX_LIB_API void SGCore_SetFunc_MtlGetSort(g_func_mtl_get_sort fnFunc); //! переназначение g_func_mtl_get_physic_type -SX_LIB_API void SGCore_SetFunc_MtlGetPhysicType(g_func_mtl_get_physic_type func); +SX_LIB_API void SGCore_SetFunc_MtlGetPhysicType(g_func_mtl_get_physic_type fnFunc); //! переназначение g_func_mtl_group_render_is_singly -SX_LIB_API void SGCore_SetFunc_MtlGroupRenderIsSingly(g_func_mtl_group_render_is_singly func); +SX_LIB_API void SGCore_SetFunc_MtlGroupRenderIsSingly(g_func_mtl_group_render_is_singly fnFunc); //!@} @@ -312,50 +309,50 @@ SX_LIB_API void SGCore_ShaderAllLoad(); //! поставить шейдер в очередь загрузки SX_LIB_API ID SGCore_ShaderLoad( - SHADER_TYPE type_shader, //!< тип шейдера - const char* path, //!< имя файла шейдера с расширением - const char* name, //!< имя шейдера которое присвоится при загрузке - SHADER_CHECKDOUBLE is_check_double, //!< проверять ли на уникальность - D3DXMACRO* macro = 0 //!< макросы + SHADER_TYPE type_shader, //!< тип шейдера + const char *szPath, //!< имя файла шейдера с расширением + const char *szName, //!< имя шейдера которое присвоится при загрузке + SHADER_CHECKDOUBLE check_double,//!< проверять ли на уникальность + D3DXMACRO *pMacro = 0 //!< макросы ); //! существует ли файл name в папке с шейдерами -SX_LIB_API bool SGCore_ShaderFileExists(const char* name); +SX_LIB_API bool SGCore_ShaderFileExists(const char *szName); //! записывает пользовательское имя шейдера в name -SX_LIB_API void SGCore_ShaderGetName(SHADER_TYPE type_shader, ID id, char* name); +SX_LIB_API void SGCore_ShaderGetName(SHADER_TYPE type_shader, ID idShader, char *szName); //! записывает имя шейдер с расширением в path -SX_LIB_API void SGCore_ShaderGetPath(SHADER_TYPE type_shader, ID id, char* path); +SX_LIB_API void SGCore_ShaderGetPath(SHADER_TYPE type_shader, ID idShader, char *szPath); //! существует ли шейдер с пользовательским именем name, если да то возвращает id -SX_LIB_API ID SGCore_ShaderExistsName(SHADER_TYPE type_shader, const char* name); +SX_LIB_API ID SGCore_ShaderExistsName(SHADER_TYPE type_shader, const char *szName); //! существует ли шейдер с именем файла и расширением name, если да то возвращает id -SX_LIB_API ID SGCore_ShaderExistsPath(SHADER_TYPE type_shader, const char* path); +SX_LIB_API ID SGCore_ShaderExistsPath(SHADER_TYPE type_shader, const char *szPath); //! загружен ли шейдер с данным id -SX_LIB_API bool SGCore_ShaderIsValidated(SHADER_TYPE type_shader, ID id); +SX_LIB_API bool SGCore_ShaderIsValidated(SHADER_TYPE type_shader, ID idShader); //! обновление шейдера по имени -SX_LIB_API void SGCore_ShaderUpdateN(SHADER_TYPE type_shader, const char* name); +SX_LIB_API void SGCore_ShaderUpdateN(SHADER_TYPE type_shader, const char *szName); //! обновление шейдера по id -SX_LIB_API void SGCore_ShaderUpdate(SHADER_TYPE type_shader, ID id); +SX_LIB_API void SGCore_ShaderUpdate(SHADER_TYPE type_shader, ID idShader); //! перезагрузить все шейдеры, с учетом макросов SX_LIB_API void SGCore_ShaderReloadAll(); //! получить идентификатор шейдера по имени -SX_LIB_API ID SGCore_ShaderGetID(SHADER_TYPE type_shader, const char* name); +SX_LIB_API ID SGCore_ShaderGetID(SHADER_TYPE type_shader, const char *szName); //! бинд шейдера по имени -SX_LIB_API void SGCore_ShaderBindN(SHADER_TYPE type_shader, const char* name); +SX_LIB_API void SGCore_ShaderBindN(SHADER_TYPE type_shader, const char *szName); //! бинд шейдера по id -SX_LIB_API void SGCore_ShaderBind(SHADER_TYPE type_shader, ID id); +SX_LIB_API void SGCore_ShaderBind(SHADER_TYPE type_shader, ID idShader); //! обнуление биндов шейдеров @@ -369,37 +366,37 @@ SX_LIB_API void SGCore_ShaderUnBind(); //! передача float значений в шейдер по имени SX_LIB_API void SGCore_ShaderSetVRFN( SHADER_TYPE type_shader, //!< тип шейдера из #SHADER_TYPE - const char* name_shader,//!< пользовательское имя шейдера - const char* name_var, //!< имя переменной которой присваивается значение - void* data, //!< указатель на массив данных - int count_float4 = 0 //!< количество float4 значений в передаваемом массиве, если меньше одного значит количество будет взято из шейдера + const char *szNameShader, //!< пользовательское имя шейдера + const char *szNameVar, //!< имя переменной которой присваивается значение + void *pData, //!< указатель на массив данных + int iCountFloat4 = 0 //!< количество float4 значений в передаваемом массиве, если меньше одного значит количество будет взято из шейдера ); //! передача float значений в шейдер по ID SX_LIB_API void SGCore_ShaderSetVRF( - SHADER_TYPE type_shader, //!< тип шейдера из #SHADER_TYPE - ID id, //!< идентификатор шейдера - const char* name_var, //!< имя переменной которой присваивается значение - void* data, //!< указатель на массив данных - int count_float4 = 0 //!< количество float4 значений в передаваемом массиве, если меньше одного значит количество будет взято из шейдера + SHADER_TYPE type_shader, //!< тип шейдера из #SHADER_TYPE + ID idShader, //!< идентификатор шейдера + const char *szNameVar, //!< имя переменной которой присваивается значение + void *pData, //!< указатель на массив данных + int iCountFloat4 = 0 //!< количество float4 значений в передаваемом массиве, если меньше одного значит количество будет взято из шейдера ); //! передача int значений в шейдер по имени SX_LIB_API void SGCore_ShaderSetVRIN( SHADER_TYPE type_shader, //!< тип шейдера из #SHADER_TYPE - const char* name_shader,//!< пользовательское имя шейдера - const char* name_var, //!< имя переменной которой присваивается значение - void* data, //!< указатель на массив данных - int count_int4 = 0 //!< количество int4 значений в передаваемом массиве, если меньше одного значит количество будет взято из шейдера + const char *szNameShader, //!< пользовательское имя шейдера + const char *szNameVar, //!< имя переменной которой присваивается значение + void *pData, //!< указатель на массив данных + int iCountInt4 = 0 //!< количество int4 значений в передаваемом массиве, если меньше одного значит количество будет взято из шейдера ); //! передача int значений в шейдер по ID SX_LIB_API void SGCore_ShaderSetVRI( - SHADER_TYPE type_shader, //!< тип шейдера из #SHADER_TYPE - ID id, //!< идентификатор шейдера - const char* name_var, //!< имя переменной которой присваивается значение - void* data, //!< указатель на массив данных - int count_int4 = 0 //!< количество int4 значений в передаваемом массиве, если меньше одного значит количество будет взято из шейдера + SHADER_TYPE type_shader, //!< тип шейдера из #SHADER_TYPE + ID idShader, //!< идентификатор шейдера + const char *szNameVar, //!< имя переменной которой присваивается значение + void *pData, //!< указатель на массив данных + int iCountInt4 = 0 //!< количество int4 значений в передаваемом массиве, если меньше одного значит количество будет взято из шейдера ); //!@} @@ -457,56 +454,56 @@ SX_LIB_API void SGCore_ShaderSetVRI( //!@} //! типы текстур -enum LoadTexType +enum LOAD_TEXTURE_TYPE { - ltt_load, //!< загружаемая - ltt_const, //!< неудаляемая загружаемая - ltt_custom, //!< созданная пользователем + LOAD_TEXTURE_TYPE_LOAD, //!< загружаемая + LOAD_TEXTURE_TYPE_CONST, //!< неудаляемая загружаемая + LOAD_TEXTURE_TYPE_CUSTOM, //!< созданная пользователем /*! самоопределение типа, на тот случай когда обновляем текстуру которая точно есть. Если определить этот тип, а внутри у текстуры на самом деле нет типа (скорее всего нет текстуры) - то будет определен ltt_load + то будет определен LOAD_TEXTURE_TYPE_LOAD */ - ltt_self, + LOAD_TEXTURE_TYPE_SELF, }; //************************************************************************** //! существует ил файл name в папке с текстурами -SX_LIB_API bool SGCore_LoadTexFileExists(const char* name); +SX_LIB_API bool SGCore_LoadTexFileExists(const char *szName); //! очистить список загружаемых текстур SX_LIB_API void SGCore_LoadTexClearLoaded(); //! удалить тектуру по id (независимо от типа) -SX_LIB_API void SGCore_LoadTexDelete(ID id); +SX_LIB_API void SGCore_LoadTexDelete(ID idTexture); //! добавляем имя текстуры, взамен получаем на нее ID (поставить в очередь) -SX_LIB_API ID SGCore_LoadTexAddName(const char* name, LoadTexType type); +SX_LIB_API ID SGCore_LoadTexAddName(const char *szName, LOAD_TEXTURE_TYPE type); //! получить id по имени -SX_LIB_API ID SGCore_LoadTexGetID(const char* name); +SX_LIB_API ID SGCore_LoadTexGetID(const char *szName); //! получить имя по id -SX_LIB_API void SGCore_LoadTexGetName(ID id, char* name); +SX_LIB_API void SGCore_LoadTexGetName(ID idTexture, char *szName); /*! создать место для текстуры tex и присвоить ей имя name, возвращает id \warning создавать текстур необходимо в managed pool (D3DPOOL_MANAGED) ибо обработка потери и восстановления устройства сюда не приходит */ -SX_LIB_API ID SGCore_LoadTexCreate(const char* name, IDirect3DTexture9* tex); +SX_LIB_API ID SGCore_LoadTexCreate(const char *szName, IDirect3DTexture9 *pTexture); /*! обновить/перезагрузить текстуру name, если текстуры не было в списке то добавляет. Если текстуру надо обновить, но тип у нее заранее не известен, но она точно уже загружена -то можно использовать тип самоопределения ltt_self, тогда тип текстуры не изменится +то можно использовать тип самоопределения LOAD_TEXTURE_TYPE_SELF, тогда тип текстуры не изменится */ -SX_LIB_API ID SGCore_LoadTexUpdateN(const char* name, LoadTexType type); +SX_LIB_API ID SGCore_LoadTexUpdateN(const char *szName, LOAD_TEXTURE_TYPE type); //! обновить/перезагрузить текстуру -SX_LIB_API void SGCore_LoadTexUpdate(ID id); +SX_LIB_API void SGCore_LoadTexUpdate(ID idTexture); //! возвращает текстуру по id -SX_LIB_API IDirect3DTexture9* SGCore_LoadTexGetTex(ID id); +SX_LIB_API IDirect3DTexture9* SGCore_LoadTexGetTex(ID idTexture); //! загрузка всех текстур поставленных в очередь, если есть очередь SX_LIB_API void SGCore_LoadTexAllLoad(); @@ -522,31 +519,31 @@ SX_LIB_API void SGCore_LoadTexAllLoad(); //! добавить новый render target SX_LIB_API ID SGCore_RTAdd( - UINT width, //!< ширина - UINT height, //!< высота - UINT levels, //!< количество mip-map уровней - DWORD usage, //!< признак применения, возможные значения из D3DUSAGE_ + UINT iWidth, //!< ширина + UINT iHeight, //!< высота + UINT iLevels, //!< количество mip-map уровней + DWORD dwUsage, //!< признак применения, возможные значения из D3DUSAGE_ D3DFORMAT format, //!< формат из D3DFORMAT D3DPOOL pool, //!< где будет размещена текстура, из D3DPOOL - const char* name, //!< имя rt + const char *szName, //!< имя rt /*! коэфициент размеров rt относительно области рендера (если rt и размер области одинаковы то 1, если rt меньша на 0.5 то 0.5) если указаны фиксированные значения то ставить 0, это нужно для устновления размеров при восстановлении устройства */ - float coeffullscreen + float fCoefFullScreen ); //! удалить rt по имени -SX_LIB_API void SGCore_RTDeleteN(const char* name); +SX_LIB_API void SGCore_RTDeleteN(const char *szName); //! удалить rt по id SX_LIB_API void SGCore_RTDelete(ID id); //! возвращает id по имени -SX_LIB_API ID SGCore_RTGetNum(const char* name); +SX_LIB_API ID SGCore_RTGetNum(const char *szName); //! возвращает текстуру по имени -SX_LIB_API IDirect3DTexture9* SGCore_RTGetTextureN(const char* name); +SX_LIB_API IDirect3DTexture9* SGCore_RTGetTextureN(const char *szName); //! возвращает текстуру по id SX_LIB_API IDirect3DTexture9* SGCore_RTGetTexture(ID id); @@ -566,32 +563,32 @@ struct ISXDataStaticModel : public IBaseObject { virtual ~ISXDataStaticModel(){}; - virtual ISXDataStaticModel* GetCopy()=0; //!< получить абсолютную копию модели + virtual ISXDataStaticModel* getCopy()=0;//!< получить абсолютную копию модели - IDirect3DVertexBuffer9* VertexBuffer; //!< вершиный буфер - IDirect3DIndexBuffer9* IndexBuffer; //!< индексный буфер - - UINT SubsetCount; //!< количество подгрупп - char** ArrTextures; //!< массив имен текстур без расширения - UINT* StartIndex; //!< массив стартовых позиций индексов для каждой подгруппы - UINT* IndexCount; //!< массив количества индексов для каждой подгруппы - UINT* StartVertex; //!< массив стартовых позиций вершин для каждой подгруппы - UINT* VertexCount; //!< массив количества вершин для каждой подгруппы - UINT AllIndexCount; //!< общее количество индексов - UINT AllVertexCount;//!< общее количество вершин - - float4_t BSphere; - float3_t BBMax, BBMin; + IDirect3DVertexBuffer9 *m_pVertexBuffer;//!< вершиный буфер + IDirect3DIndexBuffer9 *m_pIndexBuffer; //!< индексный буфер + + UINT m_uiSubsetCount; //!< количество подгрупп + char **m_ppTextures; //!< массив имен текстур без расширения + UINT *m_pStartIndex; //!< массив стартовых позиций индексов для каждой подгруппы + UINT *m_pIndexCount; //!< массив количества индексов для каждой подгруппы + UINT *m_pStartVertex; //!< массив стартовых позиций вершин для каждой подгруппы + UINT *m_pVertexCount; //!< массив количества вершин для каждой подгруппы + UINT m_uiAllIndexCount; //!< общее количество индексов + UINT m_uiAllVertexCount; //!< общее количество вершин + + float4_t m_vBSphere; + float3_t m_vBBMax, m_vBBMin; }; //! создать статическую модель SX_LIB_API ISXDataStaticModel* SGCore_StaticModelCr(); //! загрузить статическую модель, data инициализируется внутри -SX_LIB_API void SGCore_StaticModelLoad(const char* file, ISXDataStaticModel** data); +SX_LIB_API void SGCore_StaticModelLoad(const char *szFile, ISXDataStaticModel **ppData); //! сохранить статическую модель -SX_LIB_API void SGCore_StaticModelSave(const char* file, ISXDataStaticModel** data); +SX_LIB_API void SGCore_StaticModelSave(const char *szFile, ISXDataStaticModel **pData); //! возвращает декларацию вершин статической модели SX_LIB_API IDirect3DVertexDeclaration9* SGCore_StaticModelGetDecl(); @@ -613,12 +610,13 @@ struct ISXTransObject : public IBaseObject SX_ALIGNED_OP_MEM - virtual inline float4x4* CalcWorld() = 0; //!< просчет мировой матрицы трансформации на основе поворотов масштабирования и позиции + //! просчет мировой матрицы трансформации на основе поворотов масштабирования и позиции + virtual inline float4x4* calcWorld() = 0; - float3 Position; //!< позиция - float3 Rotation; //!< повороты - float3 Scale; //!< масштабирование - float4x4 World; //!< мировая матрица на основе поворотов масштабирования и позиции + float3 m_vPosition; //!< позиция + float3 m_vRotation; //!< повороты + float3 m_vScale; //!< масштабирование + float4x4 m_mWorld; //!< мировая матрица на основе поворотов масштабирования и позиции }; //! создать ISXTransObject @@ -648,38 +646,42 @@ public: SX_ALIGNED_OP_MEM /*! Просчет ограничивающего объема по вершинному буферу*/ - virtual void CalcBound( - IDirect3DVertexBuffer9* vertex_buffer, //!< вершинный буфер (незаблокированный), в вершинах которого первым элементом идет позиция float3_t вектор - DWORD count_vert, //!< количество вершин - DWORD bytepervert //!< количество байт в вершине + virtual void calcBound( + IDirect3DVertexBuffer9 *pVertexBuffer, //!< вершинный буфер (незаблокированный), в вершинах которого первым элементом идет позиция float3_t вектор + DWORD dwCountVertex, //!< количество вершин + DWORD dwBytePerVertex //!< количество байт в вершине ) = 0; //! функция просчета мировой матрицы и трансформации минимума и максимума - virtual float4x4* CalcWorldAndTrans() = 0; + virtual float4x4* calcWorldAndTrans() = 0; //! просчет структуры SXPosBBScreen - virtual void GetPosBBScreen( + virtual void getPosBBScreen( SXPosBBScreen *res, //!< инициализированная стркутура #SXPosBBScreen для записи float3* campos, //!< позиция наблюдателя float3* sizemapdepth, //!< размер карты глубины глябины для просчета float3(ширина, высота, максильная глубина) float4x4* mat //!< произведение видовой и проекционной матриц ) = 0; - virtual void SetMinMax(float3* min, float3* max) = 0; //!< установить экстремум, также просчитает и сферу - virtual void GetMinMax(float3* min, float3* max) const = 0; //!< запишет в min и max точки экстремума + //! установить экстремум, также просчитает и сферу + virtual void setMinMax(const float3 *pMin, const float3 *pMax) = 0; + + //! запишет в min и max точки экстремума + virtual void getMinMax(float3 *pMin, float3 *pMax) const = 0; + - virtual void SetSphere(float3* center, float* radius) = 0; //!< установить сферу, просчитает также и параллелепипед - virtual void GetSphere(float3* center, float* radius) const = 0; //!< запишет в center центр сферы, в radius радиус сферы + //! установить сферу, просчитает также и параллелепипед + virtual void setSphere(const float3 *pCenter, float fRadius) = 0; - virtual bool IsPointInSphere(float3* point) const = 0; //!< находится ли точка point в пределах сферы - virtual bool IsPointInBox(float3* point) const = 0; //!< находится ли точка point в пределах параллелепипеда + //! запишет в center центр сферы, в radius радиус сферы + virtual void getSphere(float3 *pCenter, float *pRadius) const = 0; -protected: - float3 Min; - float3 Max; - float3 Center; - float Radius; + //! находится ли точка point в пределах сферы + virtual bool isPointInSphere(const float3 *pPoint) const = 0; + + //! находится ли точка point в пределах параллелепипеда + virtual bool isPointInBox(const float3 *pPoint) const = 0; }; //! создать ISXBound @@ -833,20 +835,20 @@ struct SXTriangle */ //! структура описание плоскости -struct SXFrustumPlane +struct CSXFrustumPlane { - float3_t Normal; - float Distance; + float3_t m_vNormal; + float m_fDistance; SX_ALIGNED_OP_MEM - void Normalize() + void normalize() { - float denom = sqrt((Normal.x*Normal.x) + (Normal.y*Normal.y) + (Normal.z*Normal.z)); - Normal.x = Normal.x / denom; - Normal.y = Normal.y / denom; - Normal.z = Normal.z / denom; - Distance = Distance / denom; + float fDenom = sqrt((m_vNormal.x*m_vNormal.x) + (m_vNormal.y*m_vNormal.y) + (m_vNormal.z*m_vNormal.z)); + m_vNormal.x = m_vNormal.x / fDenom; + m_vNormal.y = m_vNormal.y / fDenom; + m_vNormal.z = m_vNormal.z / fDenom; + m_fDistance = m_fDistance / fDenom; } }; @@ -859,25 +861,42 @@ public: SX_ALIGNED_OP_MEM //! обновление фрустума, на вход матрицы по которым необходимо построить фрустум - virtual void Update( - const float4x4* view, //<! видовая матрица - const float4x4* proj //<! проекционная матрица + virtual void update( + const float4x4 *pView, //<! видовая матрица + const float4x4 *pProj //<! проекционная матрица ) = 0; - virtual bool PointInFrustum(const float3 *point) = 0; //!< находится ли точка во фрустуме - virtual bool PolyInFrustum(const float3* p1, const float3* p2, const float3* p3) = 0; //!< находится ли треугольник во фрутстуме - virtual bool PolyInFrustumAbs(const float3* p1, const float3* p2, const float3* p3) = 0; //!< находится ли полигон во фрустуме полностью + //! находится ли точка во фрустуме + virtual bool pointInFrustum(const float3 *pPoint) const = 0; + + //! находится ли треугольник во фрутстуме + virtual bool polyInFrustum(const float3 *pPoint1, const float3 *pPoint2, const float3 *pPoint3) const = 0; + + //! находится ли полигон во фрустуме полностью + virtual bool polyInFrustumAbs(const float3 *pPoint1, const float3 *pPoint2, const float3 *pPoint3) const = 0; + - virtual bool SphereInFrustum(const float3 *point, float radius) const = 0; //!< находится ли полигон во фрустуме + //! находится ли полигон во фрустуме + virtual bool sphereInFrustum(const float3 *pPoint, float fRadius) const = 0; - virtual bool SphereInFrustumAbs(const float3 *point, float radius) = 0; //!< находится ли сфера во фрустуме полностью - virtual bool BoxInFrustum(float3* min, float3* max) = 0; //!< находится ли параллелепипед (описанный точками экстремума) во фрустуме + //! находится ли сфера во фрустуме полностью + virtual bool sphereInFrustumAbs(const float3 *pPoint, float fRadius) const = 0; -//protected: - SXFrustumPlane ArrFrustumPlane[6]; + //! находится ли параллелепипед (описанный точками экстремума) во фрустуме + virtual bool boxInFrustum(float3 *pMin, float3 *pMax) const = 0; - float3 Point[8]; - float3 Center; + + //! возвращает координаты точки фрустума, iNumPoint = [0,7] + virtual float3 getPoint(int iNumPoint) const = 0; + + //! возвращает координаты центра фрустума + virtual float3 getCenter() const = 0; + + //! устанавливает координаты точки фрустума, iNumPoint = [0,7] + virtual void setPoint(int iNumPoint, const float3 *pPoint) = 0; + + //! устанавливает координаты центра фрустума + virtual void setCenter(const float3 *pCenter) = 0; }; //! создать ISXFrustum @@ -895,65 +914,88 @@ public: /*! \name Движение \note В метрах - @{ - */ - virtual inline void PosLeftRight(float units) = 0; //!< влево/вправо - virtual inline void PosUpDown(float units) = 0; //!< вверх/вниз - virtual inline void PosFrontBack(float units) = 0; //!< вперед/назад + @{*/ + + //! влево/вправо + virtual void posLeftRight(float fUnits) = 0; + + //! вверх/вниз + virtual void posUpDown(float fUnits) = 0; + + //! вперед/назад + virtual void posFrontBack(float fUnits) = 0; + //!@} /*! \name Вращение \note В радианах - @{ - */ - virtual inline void RotUpDown(float angle) = 0; //!< вращение вверх/вниз - virtual inline void RotRightLeft(float angle) = 0; //!< вращение вправо/влево - virtual inline void Roll(float angle) = 0; //!< крен - virtual inline void SetOrientation(const SMQuaternion & q) = 0; //!< установить полное вращение + @{*/ + + //! вращение вверх/вниз + virtual void rotUpDown(float fAngle) = 0; + + //! вращение вправо/влево + virtual void rotRightLeft(float fAngle) = 0; + + //! крен + virtual void roll(float fAngle) = 0; + + //! установить полное вращение + virtual void setOrientation(const SMQuaternion *pOrientation) = 0; + //!@} - virtual inline void GetViewMatrix(float4x4* view_matrix) = 0;//!< получаем матрицу вида в view_matrix + //! получаем матрицу вида в pMatrix + virtual void getViewMatrix(float4x4 *pMatrix) = 0; /*! \name Базис @{ */ - virtual inline void GetPosition(float3* pos) = 0; //!< в pos записывает текущую позицию в мире - virtual inline void SetPosition(float3* pos) = 0; //!< устанавливает позицию в мире + //! в pos записывает текущую позицию в мире + virtual void getPosition(float3 *pPos) const = 0; + + //! устанавливает позицию в мире + virtual void setPosition(const float3 *pPos) = 0; - virtual inline void GetRight(float3* right) = 0; //!< в right записывает парвый вектор - virtual inline void GetUp(float3* up) = 0; //!< в up записывает верхний вектор - virtual inline void GetLook(float3* look) = 0; //!< в look записывает вектор направление взгляда - virtual inline void GetRotation(float3* rot) = 0; //!< в rot записывает углы поворотов по осям, в радианах + //! в right записывает парвый вектор + virtual void getRight(float3 *pRight) const = 0; + + //! в up записывает верхний вектор + virtual void getUp(float3 *vUp) const = 0; + + //! в look записывает вектор направление взгляда + virtual void getLook(float3 *vLook) const = 0; + + + //! в rot записывает углы поворотов по осям, в радианах + virtual void getRotation(float3 *vRot) const = 0; //повроты по осям - virtual inline float GetRotationX() = 0; //!< возвращает поворот по оси X, в радианах - virtual inline float GetRotationY() = 0; //!< возвращает поворот по оси Y, в радианах - virtual inline float GetRotationZ() = 0; //!< возвращает поворот по оси Z, в радианах - //!@} + //! возвращает поворот по оси X, в радианах + virtual float getRotationX() const = 0; - virtual inline void SetFOV(float fov) = 0; //!< Устанавливает FOV камеры - virtual inline float GetFOV() = 0; //!< возвращает FOV камеры + //! возвращает поворот по оси Y, в радианах + virtual float getRotationY() const = 0; - ISXFrustum* ObjFrustum; //!< фрустум этой камеры + //! возвращает поворот по оси Z, в радианах + virtual float getRotationZ() const = 0; - float3 LastVal; //?? - bool IsAccel; //?? + //!@} -protected: - float3 Right; - float3 Up; - float3 Look; + //! устанавливает FOV камеры + virtual void setFOV(float fFOV) = 0; - float3 Position; + //! возвращает FOV камеры + virtual float getFOV() const = 0; - //float AngleUpDown, AngleRightLeft, AngleRoll; - - float3_t m_vPitchYawRoll; + //! обновление фрустума камеры + virtual void updateFrustum(const float4x4 *mProjection) = 0; - float m_fFOV; + //! возвращает константный указатель фрустума + virtual const ISXFrustum* getFrustum() = 0; }; //! создать ISXCamera @@ -982,35 +1024,35 @@ SX_LIB_API bool SGCore_SkyBoxIsLoadTex(); //! загрузка текстуры, texture - имя текстуры с расширением -SX_LIB_API void SGCore_SkyBoxLoadTex(const char *texture); +SX_LIB_API void SGCore_SkyBoxLoadTex(const char *szTexture); //! смена текстуры, texture - имя текстуры с расширением -SX_LIB_API void SGCore_SkyBoxChangeTex(const char *texture); +SX_LIB_API void SGCore_SkyBoxChangeTex(const char *szTexture); //! в аргумент записывает путь до текущей активной текстуры -SX_LIB_API void SGCore_SkyBoxGetActiveTex(char *texture); +SX_LIB_API void SGCore_SkyBoxGetActiveTex(char *szTexture); //! в аргумент записывает путь до следующей текстуры 9если включена смена) -SX_LIB_API void SGCore_SkyBoxGetSecondTex(char *texture); +SX_LIB_API void SGCore_SkyBoxGetSecondTex(char *szTexture); //! установка угла поворота angle по оси y, в радианах -SX_LIB_API void SGCore_SkyBoxSetRot(float angle); +SX_LIB_API void SGCore_SkyBoxSetRot(float fAngle); //! возвращает угол поворота по оси y, в радианах SX_LIB_API float SGCore_SkyBoxGetRot(); //! установка цвета окраски в пределах 0-1, альфа компонента (w) - на сколько будет окрашен -SX_LIB_API void SGCore_SkyBoxSetColor(float4_t* color); +SX_LIB_API void SGCore_SkyBoxSetColor(const float4_t *pColor); //! в color записывает текущий цвет окраски -SX_LIB_API void SGCore_SkyBoxGetColor(float4_t* color); +SX_LIB_API void SGCore_SkyBoxGetColor(float4_t *pColor); //! рендер скайбокса SX_LIB_API void SGCore_SkyBoxRender( float timeDelta, //!< время рендера кадра в млсек - float3* pos //!< позиция набладателя, эта же позиция будет центром skybox + const float3 *pPos //!< позиция набладателя, эта же позиция будет центром skybox ); //!@} @@ -1038,50 +1080,50 @@ SX_LIB_API bool SGCore_SkyCloudsIsLoadTex(); Так как позиция облаков константна то чтобы была илюзия полного покрытия уровня, необходимо облакам указывать размер в несколько раз больше чем весь доступный уровень, к примеру x2 */ SX_LIB_API void SGCore_SkyCloudsSetWidthHeightPos( - float width, //!< ширина в метрах - float height, //!< высота в метрах - float3* center //!< позиция центра + float fWidth, //!< ширина в метрах + float fHeight, //!< высота в метрах + const float3 *pCenter //!< позиция центра ); //! загрузка текстуры, texture - имя текстуры с расширением -SX_LIB_API void SGCore_SkyCloudsLoadTex(const char *texture); +SX_LIB_API void SGCore_SkyCloudsLoadTex(const char *szNameTexture); -//! загрузка текстуры, texture - имя текстуры с расширением -SX_LIB_API void SGCore_SkyCloudsChangeTex(const char *texture); +//! плавная смена текстуры, texture - имя текстуры с расширением +SX_LIB_API void SGCore_SkyCloudsChangeTex(const char *szNameTexture); //! установка угла поворота angle по оси y, в радианах -SX_LIB_API void SGCore_SkyCloudsSetRot(float angle); +SX_LIB_API void SGCore_SkyCloudsSetRot(float fAngle); //! возвращает текущий угол поворота по оси y, в радианах SX_LIB_API float SGCore_SkyCloudsGetRot(); //! устанавливает коэфициент прозрачности, в пределах 0-1 -SX_LIB_API void SGCore_SkyCloudsSetAlpha(float alpha); +SX_LIB_API void SGCore_SkyCloudsSetAlpha(float fAlpha); //! возвращает текущий коэфициент прозрачности SX_LIB_API float SGCore_SkyCloudsGetAlpha(); //! устанавливает коэфициент скорости движения -SX_LIB_API void SGCore_SkyCloudsSetSpeed(float speed); +SX_LIB_API void SGCore_SkyCloudsSetSpeed(float fSpeed); //! возвращает текущий коэфициент скорости движения SX_LIB_API float SGCore_SkyCloudsGetSpeed(); //! установка цвета окраски в пределах 0-1, альфа компонента (w) - на сколько будет окрашен -SX_LIB_API void SGCore_SkyCloudsSetColor(float4_t* color); +SX_LIB_API void SGCore_SkyCloudsSetColor(const float4_t *pColor); //! в color записывает текущий цвет окраски -SX_LIB_API void SGCore_SkyCloudsGetColor(float4_t* color); +SX_LIB_API void SGCore_SkyCloudsGetColor(float4_t *pColor); //! рендер облаков SX_LIB_API void SGCore_SkyCloudsRender( - DWORD timeDetlta, //!< время рендера кадра в млсек - float3* pos, //!< позиция набладателя - bool is_shadow //!< для теней ли рендерим? + DWORD timeDetlta, //!< время рендера кадра в млсек + const float3* pos, //!< позиция набладателя + bool isShadow //!< для теней ли рендерим? ); //!@} diff --git a/source/gcore/sxgcore_dll.cpp b/source/gcore/sxgcore_dll.cpp index 4030f098dc11f4148f9560ae3dab3262d8a90e3f..88b1ec58eac1f5e48ba53b6f764552b3f797850d 100644 --- a/source/gcore/sxgcore_dll.cpp +++ b/source/gcore/sxgcore_dll.cpp @@ -1,10 +1,9 @@ -/****************************************************** -Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017 +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 See the license in LICENSE -******************************************************/ +***********************************************************/ -#pragma once #include <windows.h> BOOL APIENTRY DllMain(HMODULE hModule, diff --git a/source/gdefines.h b/source/gdefines.h index 3c8b8311dcc39928227721cdb7d7a6f214cbd48e..f5c235178c384eaa4b6c2845eea9adffeec854a8 100644 --- a/source/gdefines.h +++ b/source/gdefines.h @@ -1,8 +1,8 @@ -/****************************************************** -Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017 +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 See the license in LICENSE -******************************************************/ +***********************************************************/ /*! \page general_info_libs Общая информация о библиотеках \tableofcontents @@ -159,7 +159,7 @@ struct IBaseObject #define ASSERT(expr) if(!expr) ASSERT_S(#expr) //! Тип функции вывода отладочной информации -typedef void(*report_func) (int level, const char* format, ...); +typedef void(*report_func) (int iLevel, const char *szLibName, const char *szFormat, ...); #include <cstdio> #if defined(_WINDOWS) @@ -222,7 +222,7 @@ typedef void(*report_func) (int level, const char* format, ...); #define DEFAULT_FUNCTION_REPORT /*! Дефолтовая функция вывода отладочной информации ВМЕСТО НЕЕ В ЯДРО/ПОДСИСТЕМУ НУЖНО ОТПРАВЛЯТЬ СВОЮ */ -inline void DefReport(int level, const char* format, ...) +inline void DefReport(int iLevel, const char *szLibName, const char *szFormat, ...) { #if defined(_WINDOWS) AllocConsole(); @@ -230,8 +230,8 @@ inline void DefReport(int level, const char* format, ...) #endif char buf[REPORT_MSG_MAX_LEN]; int strl = sizeof(buf); - format_str(buf, format); - fprintf(stdout, "!!! report function is not init !!! %s\n", buf); + format_str(buf, szFormat); + fprintf(stdout, "!!! report function is not init !!!\n LibName: %s\n message: %s\n", szLibName, buf); fprintf(stdout, "work program will be stopped within 5 seconds ..."); Sleep(5000); exit(1); @@ -239,4 +239,22 @@ inline void DefReport(int level, const char* format, ...) #endif + +#ifndef SX_LIB_NAME +#define SX_LIB_NAME "User" +#endif + +inline void LibReport(int iLevel, const char *szFormat, ...) +{ + extern report_func g_fnReportf; + + static char szStr[REPORT_MSG_MAX_LEN]; + szStr[0] = 0; + int iStrLen = sizeof(szStr); + format_str(szStr, szFormat); + + g_fnReportf(iLevel, SX_LIB_NAME, szStr); +} + + #endif diff --git a/source/geom/green.cpp b/source/geom/green.cpp index b8f1a3b7359d7b9959dd39b3f9c4b6a09da1e43e..295f38180d7d608e13ff8e0081b9a68ea11016e1 100644 --- a/source/geom/green.cpp +++ b/source/geom/green.cpp @@ -1,5 +1,10 @@ -#include <geom\\green.h> +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + +#include "green.h" Green::Green() { @@ -179,9 +184,9 @@ void Green::PreSegmentation(Model* model, float3* min_level, float3* max_level) float3 tmpMin, tmpMax; float3 tmpMin2, tmpMax2; model->SplitsTree->BoundVolumeSys = SGCore_CrBound(); - SGCore_FCompBoundBox(model->ArrLod[0]->model->VertexBuffer, &(model->SplitsTree->BoundVolumeSys), model->ArrLod[0]->model->AllVertexCount, sizeof(vertex_static)); + SGCore_FCompBoundBox(model->ArrLod[0]->model->m_pVertexBuffer, &(model->SplitsTree->BoundVolumeSys), model->ArrLod[0]->model->m_uiAllVertexCount, sizeof(vertex_static)); - model->SplitsTree->BoundVolumeSys->GetMinMax(&tmpMin2, &tmpMax2); + model->SplitsTree->BoundVolumeSys->getMinMax(&tmpMin2, &tmpMax2); model->BBMax = tmpMax2 * (1.f + GREEN_GEN_RAND_SCALE); model->BBMin = tmpMin2 * (1.f + GREEN_GEN_RAND_SCALE); tmpMin = *min_level; @@ -200,7 +205,7 @@ void Green::PreSegmentation(Model* model, float3* min_level, float3* max_level) float tmpZ = tmpMax.z - tmpMin.z; model->SplitsTree->BoundVolumeP = SGCore_CrBound(); - model->SplitsTree->BoundVolumeP->SetMinMax(&tmpMin, &tmpMax); + model->SplitsTree->BoundVolumeP->setMinMax(&tmpMin, &tmpMax); //выравниваем по квадрату if (tmpX > tmpZ) @@ -218,7 +223,7 @@ void Green::PreSegmentation(Model* model, float3* min_level, float3* max_level) tmpMin.x -= tmpX; } - model->SplitsTree->BoundVolumeSys->SetMinMax(&tmpMin, &tmpMax); + model->SplitsTree->BoundVolumeSys->setMinMax(&tmpMin, &tmpMax); model->SplitsTree->CountAllGreen = model->AllCountGreen; if (model->AllCountGreen > 0) @@ -246,7 +251,7 @@ void Green::CycleSegmentation(Segment* Split, Model* mesh) while (queue.size()) { - queue[0]->BoundVolumeSys->GetMinMax(&min, &max); + queue[0]->BoundVolumeSys->getMinMax(&min, &max); if ((max.x - min.x)*0.5f > GREEN_BB_MIN_X && (max.z - min.z)*0.5f > GREEN_BB_MIN_Z) { Segmentation(queue[0], mesh); @@ -281,9 +286,9 @@ void Green::Segmentation(Segment* Split, Model* mesh) for (int i = 0; i<4; ++i) { Split->Splits[i]->BoundVolumeSys = ArrBound[i]; - Split->Splits[i]->BoundVolumeSys->GetMinMax(&tmpmin, &tmpmax); + Split->Splits[i]->BoundVolumeSys->getMinMax(&tmpmin, &tmpmax); Split->Splits[i]->BoundVolumeP = SGCore_CrBound(); - Split->Splits[i]->BoundVolumeP->SetMinMax(&tmpmin, &tmpmax); + Split->Splits[i]->BoundVolumeP->setMinMax(&tmpmin, &tmpmax); } bool *tmp_arr_mesh_poly = 0; @@ -298,7 +303,7 @@ void Green::Segmentation(Segment* Split, Model* mesh) float3 tmpMin, tmpMax; for (WORD i = 0; i<4; ++i) { - Split->Splits[i]->BoundVolumeSys->GetMinMax(&tmpMin, &tmpMax); + Split->Splits[i]->BoundVolumeSys->getMinMax(&tmpMin, &tmpMax); //SGCore_FCreateBoundingBoxMesh(&tmpMin, &tmpMax, &(Split->Splits[i]->BoundBox)); for (DWORD j = 0; j<Split->CountAllGreen; ++j) @@ -383,11 +388,11 @@ void Green::AlignBound(Model* model, Segment* split) float3 tmpMin, tmpMax; float scalecoef = 1.f + GREEN_GEN_RAND_SCALE; - split->BoundVolumeSys->GetMinMax(&tmpMin, &tmpMax); + split->BoundVolumeSys->getMinMax(&tmpMin, &tmpMax); tmpMax.y = comMax.y + model->BBMax.y * scalecoef; tmpMin.y = comMin.y + model->BBMin.y * scalecoef; - split->BoundVolumeSys->SetMinMax(&tmpMin, &tmpMax); + split->BoundVolumeSys->setMinMax(&tmpMin, &tmpMax); tmpMax.x = comMax.x + model->BBMax.x * scalecoef; tmpMax.y = comMax.y + model->BBMax.y * scalecoef; @@ -397,7 +402,7 @@ void Green::AlignBound(Model* model, Segment* split) tmpMin.y = comMin.y + model->BBMin.y * scalecoef; tmpMin.z = comMin.z + model->BBMin.z * scalecoef; - split->BoundVolumeP->SetMinMax(&tmpMin, &tmpMax); + split->BoundVolumeP->setMinMax(&tmpMin, &tmpMax); } } @@ -431,7 +436,7 @@ void Green::SetSplitID2(Model* model, Segment* Split, Array<Segment*, GREEN_DEFA } } -void Green::CPUFillingArrIndeces(ISXFrustum* frustum, float3* viewpos, ID id_arr) +void Green::CPUFillingArrIndeces(const ISXFrustum* frustum, float3* viewpos, ID id_arr) { GREEN_PRECOND_ARRCOMFOR_ERR_ID(id_arr); @@ -461,14 +466,14 @@ void Green::CPUFillingArrIndeces(ISXFrustum* frustum, float3* viewpos, ID id_arr int qwert = 0; } -void Green::ComRecArrIndeces(ISXFrustum* frustum, Segment** arrsplits, DWORD *count, Segment* comsegment, float3* viewpos, Array<Segment*, GREEN_DEFAULT_RESERVE_COM>* queue, ID curr_splits_ids_render) +void Green::ComRecArrIndeces(const ISXFrustum* frustum, Segment** arrsplits, DWORD *count, Segment* comsegment, float3* viewpos, Array<Segment*, GREEN_DEFAULT_RESERVE_COM>* queue, ID curr_splits_ids_render) { float3 jcenter; float jradius; ID SortId[GREEN_COUNT_TYPE_SEGMENTATION]; - comsegment->BoundVolumeP->GetSphere(&jcenter, &jradius); + comsegment->BoundVolumeP->getSphere(&jcenter, &jradius); - if (comsegment->CountAllGreen > 0 && frustum->SphereInFrustum(&jcenter, jradius)) + if (comsegment->CountAllGreen > 0 && frustum->sphereInFrustum(&jcenter, jradius)) { if (comsegment->BFNonEnd) { @@ -479,7 +484,7 @@ void Green::ComRecArrIndeces(ISXFrustum* frustum, Segment** arrsplits, DWORD *co SortId[q] = -1; if (comsegment->Splits[q]) { - comsegment->Splits[q]->BoundVolumeP->GetSphere(&jcenter, &jradius); + comsegment->Splits[q]->BoundVolumeP->getSphere(&jcenter, &jradius); comsegment->Splits[q]->DistForCamera = SMVector3Length2((jcenter - (*viewpos))) - jradius*jradius; } } @@ -555,12 +560,12 @@ void Green::GPURender2(DWORD timeDelta, float3* viewpos, ID nm, int lod, ID id_t Green::DXDevice->SetStreamSourceFreq(1, (D3DSTREAMSOURCE_INSTANCEDATA | 1)); Green::DXDevice->SetStreamSource(1, TransVertBuf, 0, sizeof(GreenDataVertex)); - Green::DXDevice->SetStreamSource(0, ArrModels[nm]->ArrLod[lod]->model->VertexBuffer, 0, sizeof(vertex_static)); - Green::DXDevice->SetIndices(ArrModels[nm]->ArrLod[lod]->model->IndexBuffer); + Green::DXDevice->SetStreamSource(0, ArrModels[nm]->ArrLod[lod]->model->m_pVertexBuffer, 0, sizeof(vertex_static)); + Green::DXDevice->SetIndices(ArrModels[nm]->ArrLod[lod]->model->m_pIndexBuffer); Green::DXDevice->SetVertexDeclaration(VertexDeclarationGreen); jCountIndex = 0; - for (DWORD i = 0; i < ArrModels[nm]->ArrLod[lod]->model->SubsetCount; i++) + for (DWORD i = 0; i < ArrModels[nm]->ArrLod[lod]->model->m_uiSubsetCount; i++) { SGCore_MtlSet((id_tex > 0 ? id_tex : ArrModels[nm]->ArrLod[lod]->idstex[i]), 0); @@ -570,13 +575,13 @@ void Green::GPURender2(DWORD timeDelta, float3* viewpos, ID nm, int lod, ID id_t Green::DXDevice->SetVertexShaderConstantF(59, (float*)&float2_t(0,0), 1); Green::DXDevice->SetVertexShaderConstantF(60, (float*)viewpos, 1); - Green::DXDevice->SetVertexShaderConstantF(61, (float*)&(ArrModels[nm]->ArrLod[lod]->model->BSphere), 1); - Green::DXDevice->SetVertexShaderConstantF(62, (float*)&(ArrModels[nm]->ArrLod[lod]->model->BBMax), 1); - Green::DXDevice->SetVertexShaderConstantF(63, (float*)&(ArrModels[nm]->ArrLod[lod]->model->BBMin), 1); + Green::DXDevice->SetVertexShaderConstantF(61, (float*)&(ArrModels[nm]->ArrLod[lod]->model->m_vBSphere), 1); + Green::DXDevice->SetVertexShaderConstantF(62, (float*)&(ArrModels[nm]->ArrLod[lod]->model->m_vBBMax), 1); + Green::DXDevice->SetVertexShaderConstantF(63, (float*)&(ArrModels[nm]->ArrLod[lod]->model->m_vBBMin), 1); - SGCore_DIP(D3DPT_TRIANGLELIST, 0, 0, ArrModels[nm]->ArrLod[lod]->model->VertexCount[i], jCountIndex, ArrModels[nm]->ArrLod[lod]->model->IndexCount[i] / 3); - Core_RIntSet(G_RI_INT_COUNT_POLY, Core_RIntGet(G_RI_INT_COUNT_POLY) + ((ArrModels[nm]->ArrLod[lod]->model->IndexCount[i] / 3) * RTCountDrawObj)); - jCountIndex += ArrModels[nm]->ArrLod[lod]->model->IndexCount[i]; + SGCore_DIP(D3DPT_TRIANGLELIST, 0, 0, ArrModels[nm]->ArrLod[lod]->model->m_pVertexCount[i], jCountIndex, ArrModels[nm]->ArrLod[lod]->model->m_pIndexCount[i] / 3); + Core_RIntSet(G_RI_INT_COUNT_POLY, Core_RIntGet(G_RI_INT_COUNT_POLY) + ((ArrModels[nm]->ArrLod[lod]->model->m_pIndexCount[i] / 3) * RTCountDrawObj)); + jCountIndex += ArrModels[nm]->ArrLod[lod]->model->m_pIndexCount[i]; } Green::DXDevice->SetStreamSourceFreq(0, 1); @@ -618,7 +623,7 @@ void Green::GPURender(DWORD timeDelta, float3* viewpos, GREEN_TYPE type, ID id_a RTCountDrawObj = 0; } - jarrsplits[i]->BoundVolumeP->GetSphere(&jcenter, &jradius); + jarrsplits[i]->BoundVolumeP->getSphere(&jcenter, &jradius); jarrsplits[i]->DistForCamera = SMVector3Length((jcenter - (*viewpos))) - jradius; if ( @@ -709,7 +714,7 @@ void Green::GPURenderSingly(DWORD timeDelta, float3* viewpos, ID id, ID id_tex) RTCountDrawObj = 0; } - jarrsplits[i]->BoundVolumeP->GetSphere(&jcenter, &jradius); + jarrsplits[i]->BoundVolumeP->getSphere(&jcenter, &jradius); jarrsplits[i]->DistForCamera = SMVector3Length((jcenter - (*viewpos))) - jradius; if ( @@ -796,9 +801,9 @@ ID Green::Init(StaticGeom* geom, const char* name, SGCore_StaticModelLoad(tmppath, &tmpnewmpdel->ArrLod[0]->model); tmpnewmpdel->ArrLod[0]->path = path; char tmppathtex[1024]; - for (int i = 0; i < tmpnewmpdel->ArrLod[0]->model->SubsetCount; ++i) + for (int i = 0; i < tmpnewmpdel->ArrLod[0]->model->m_uiSubsetCount; ++i) { - sprintf(tmppathtex, "%s.dds", tmpnewmpdel->ArrLod[0]->model->ArrTextures[i]); + sprintf(tmppathtex, "%s.dds", tmpnewmpdel->ArrLod[0]->model->m_ppTextures[i]); tmpnewmpdel->ArrLod[0]->idstex[i] = SGCore_MtlLoad(tmppathtex, (tmpnewmpdel->TypeGreen == GREEN_TYPE_TREE ? MTL_TYPE_TREE : MTL_TYPE_GRASS)); } @@ -813,9 +818,9 @@ ID Green::Init(StaticGeom* geom, const char* name, tmpnewmpdel->ArrLod[1]->path = lod1; SGCore_StaticModelLoad(tmppath, &tmpnewmpdel->ArrLod[1]->model); - for (int i = 0; i < tmpnewmpdel->ArrLod[1]->model->SubsetCount; ++i) + for (int i = 0; i < tmpnewmpdel->ArrLod[1]->model->m_uiSubsetCount; ++i) { - sprintf(tmppathtex, "%s.dds", tmpnewmpdel->ArrLod[1]->model->ArrTextures[i]); + sprintf(tmppathtex, "%s.dds", tmpnewmpdel->ArrLod[1]->model->m_ppTextures[i]); tmpnewmpdel->ArrLod[1]->idstex[i] = SGCore_MtlLoad(tmppathtex, (tmpnewmpdel->TypeGreen == GREEN_TYPE_TREE ? MTL_TYPE_TREE : MTL_TYPE_GRASS)); } } @@ -834,19 +839,19 @@ ID Green::Init(StaticGeom* geom, const char* name, tmpnewmpdel->ArrLod[2]->path = lod2; SGCore_StaticModelLoad(tmppath, &tmpnewmpdel->ArrLod[2]->model); - for (int i = 0; i < tmpnewmpdel->ArrLod[2]->model->SubsetCount; ++i) + for (int i = 0; i < tmpnewmpdel->ArrLod[2]->model->m_uiSubsetCount; ++i) { - sprintf(tmppathtex, "%s.dds", tmpnewmpdel->ArrLod[1]->model->ArrTextures[i]); + sprintf(tmppathtex, "%s.dds", tmpnewmpdel->ArrLod[1]->model->m_ppTextures[i]); tmpnewmpdel->ArrLod[2]->idstex[i] = SGCore_MtlLoad(tmppathtex, (tmpnewmpdel->TypeGreen == GREEN_TYPE_TREE ? MTL_TYPE_TREE : MTL_TYPE_GRASS)); } } } ISXBound* tmpbb = SGCore_CrBound(); - SGCore_FCompBoundBox(tmpnewmpdel->ArrLod[0]->model->VertexBuffer, &tmpbb, tmpnewmpdel->ArrLod[0]->model->AllVertexCount, sizeof(vertex_static)); + SGCore_FCompBoundBox(tmpnewmpdel->ArrLod[0]->model->m_pVertexBuffer, &tmpbb, tmpnewmpdel->ArrLod[0]->model->m_uiAllVertexCount, sizeof(vertex_static)); float3 mmax, mmin; - tmpbb->GetMinMax(&mmin, &mmax); + tmpbb->getMinMax(&mmin, &mmax); mem_release(tmpbb); float3 tmpmin, tmpmax; @@ -854,7 +859,7 @@ ID Green::Init(StaticGeom* geom, const char* name, if (def_str_validate(path_mask)) { - ID IDTexMask = SGCore_LoadTexAddName(path_mask, LoadTexType::ltt_load); + ID IDTexMask = SGCore_LoadTexAddName(path_mask, LOAD_TEXTURE_TYPE_LOAD); SGCore_LoadTexAllLoad(); GenByTex(geom, tmpnewmpdel, IDTexMask, &mmin, &mmax, count_max); @@ -875,7 +880,7 @@ ID Green::Init(StaticGeom* geom, const char* name, } else { - g_fnReportf(REPORT_MSG_LEVEL_WARNING,"not found static geometry in level!!!"); + LibReport(REPORT_MSG_LEVEL_WARNING,"not found static geometry in level!!!"); } return -1; @@ -1019,7 +1024,7 @@ ID Green::GetIDSplit(ID id, float3* pos) while (queue.size()) { - queue[0]->BoundVolumeSys->GetMinMax(&min, &max); + queue[0]->BoundVolumeSys->getMinMax(&min, &max); if (max.x >= pos->x && max.z >= pos->z && min.x <= pos->x && min.z <= pos->z) { if (!(queue[0]->Splits[0])) @@ -1032,14 +1037,14 @@ ID Green::GetIDSplit(ID id, float3* pos) float3 tmpMin, tmpMax; float scalecoef = 1.f + GREEN_GEN_RAND_SCALE; - queue[0]->BoundVolumeSys->GetMinMax(&tmpMin, &tmpMax); + queue[0]->BoundVolumeSys->getMinMax(&tmpMin, &tmpMax); if (tmpMax.y < (pos->y + ArrModels[id]->BBMax.y * scalecoef)) tmpMax.y = tmpMax.y + ArrModels[id]->BBMax.y * scalecoef; if (tmpMin.y >(pos->y + ArrModels[id]->BBMin.y * scalecoef)) tmpMin.y = tmpMin.y + ArrModels[id]->BBMin.y * scalecoef; - queue[0]->BoundVolumeSys->SetMinMax(&tmpMin, &tmpMax); + queue[0]->BoundVolumeSys->setMinMax(&tmpMin, &tmpMax); if (tmpMax.x < (pos->x + ArrModels[id]->BBMax.x * scalecoef)) tmpMax.x = tmpMax.x + ArrModels[id]->BBMax.x * scalecoef; @@ -1053,7 +1058,7 @@ ID Green::GetIDSplit(ID id, float3* pos) if (tmpMin.z >(pos->z + ArrModels[id]->BBMin.z * scalecoef)) tmpMin.z = tmpMin.z + ArrModels[id]->BBMin.z * scalecoef; - queue[0]->BoundVolumeP->SetMinMax(&tmpMin, &tmpMax); + queue[0]->BoundVolumeP->setMinMax(&tmpMin, &tmpMax); } for (int i = 0; i < GREEN_COUNT_TYPE_SEGMENTATION; i++) @@ -1230,7 +1235,7 @@ void Green::Save(const char* path) void Green::SaveSplit(Segment* Split, FILE* file, Array<Segment*> * queue) { float3 jmin, jmax; - Split->BoundVolumeSys->GetMinMax(&jmin, &jmax); + Split->BoundVolumeSys->getMinMax(&jmin, &jmax); fwrite(&jmin.x, sizeof(float), 1, file); fwrite(&jmin.y, sizeof(float), 1, file); fwrite(&jmin.z, sizeof(float), 1, file); @@ -1239,7 +1244,7 @@ void Green::SaveSplit(Segment* Split, FILE* file, Array<Segment*> * queue) fwrite(&jmax.y, sizeof(float), 1, file); fwrite(&jmax.z, sizeof(float), 1, file); - Split->BoundVolumeP->GetMinMax(&jmin, &jmax); + Split->BoundVolumeP->getMinMax(&jmin, &jmax); fwrite(&jmin.x, sizeof(float), 1, file); fwrite(&jmin.y, sizeof(float), 1, file); fwrite(&jmin.z, sizeof(float), 1, file); @@ -1341,9 +1346,9 @@ void Green::Load(const char* path) SGCore_StaticModelLoad(tmppath, &tmpmodel->ArrLod[0]->model); tmpmodel->ArrLod[0]->path = tmpstr[0]; char tmppathtex[1024]; - for (int k = 0; k < tmpmodel->ArrLod[0]->model->SubsetCount; ++k) + for (int k = 0; k < tmpmodel->ArrLod[0]->model->m_uiSubsetCount; ++k) { - sprintf(tmppathtex, "%s.dds", tmpmodel->ArrLod[0]->model->ArrTextures[k]); + sprintf(tmppathtex, "%s.dds", tmpmodel->ArrLod[0]->model->m_ppTextures[k]); tmpmodel->ArrLod[0]->idstex[k] = SGCore_MtlLoad(tmppathtex, (tmpmodel->TypeGreen == GREEN_TYPE_TREE ? MTL_TYPE_TREE : MTL_TYPE_GRASS)); } @@ -1358,9 +1363,9 @@ void Green::Load(const char* path) sprintf(tmppath, "%s%s", Core_RStringGet(G_RI_STRING_PATH_GS_MESHES), tmpstr[1]); SGCore_StaticModelLoad(tmppath, &tmpmodel->ArrLod[1]->model); - for (int k = 0; k < tmpmodel->ArrLod[1]->model->SubsetCount; ++k) + for (int k = 0; k < tmpmodel->ArrLod[1]->model->m_uiSubsetCount; ++k) { - sprintf(tmppathtex, "%s.dds", tmpmodel->ArrLod[1]->model->ArrTextures[k]); + sprintf(tmppathtex, "%s.dds", tmpmodel->ArrLod[1]->model->m_ppTextures[k]); tmpmodel->ArrLod[1]->idstex[k] = SGCore_MtlLoad(tmppathtex, (tmpmodel->TypeGreen == GREEN_TYPE_TREE ? MTL_TYPE_TREE : MTL_TYPE_GRASS)); } } @@ -1379,9 +1384,9 @@ void Green::Load(const char* path) sprintf(tmppath, "%s%s", Core_RStringGet(G_RI_STRING_PATH_GS_MESHES), tmpstr[2]); SGCore_StaticModelLoad(tmppath, &tmpmodel->ArrLod[2]->model); - for (int k = 0; k < tmpmodel->ArrLod[2]->model->SubsetCount; ++k) + for (int k = 0; k < tmpmodel->ArrLod[2]->model->m_uiSubsetCount; ++k) { - sprintf(tmppathtex, "%s.dds", tmpmodel->ArrLod[1]->model->ArrTextures[k]); + sprintf(tmppathtex, "%s.dds", tmpmodel->ArrLod[1]->model->m_ppTextures[k]); tmpmodel->ArrLod[2]->idstex[k] = SGCore_MtlLoad(tmppathtex, (tmpmodel->TypeGreen == GREEN_TYPE_TREE ? MTL_TYPE_TREE : MTL_TYPE_GRASS)); } } @@ -1436,7 +1441,7 @@ void Green::LoadSplit(Segment** Split, FILE* file, Array<Segment**> * queue) fread(&jmax.z, sizeof(float), 1, file); (*Split)->BoundVolumeSys = SGCore_CrBound(); - (*Split)->BoundVolumeSys->SetMinMax(&jmin, &jmax); + (*Split)->BoundVolumeSys->setMinMax(&jmin, &jmax); fread(&jmin.x, sizeof(float), 1, file); @@ -1448,7 +1453,7 @@ void Green::LoadSplit(Segment** Split, FILE* file, Array<Segment**> * queue) fread(&jmax.z, sizeof(float), 1, file); (*Split)->BoundVolumeP = SGCore_CrBound(); - (*Split)->BoundVolumeP->SetMinMax(&jmin, &jmax); + (*Split)->BoundVolumeP->setMinMax(&jmin, &jmax); fread(&(*Split)->CountAllGreen, sizeof(uint32_t), 1, file); @@ -1571,7 +1576,7 @@ long Green::GetGreenCountGen(ID id) long Green::GetGreenCountPoly(ID id) { if (id < ArrModels.size() && ArrModels[id]->ArrLod[0]) - return ArrModels[id]->ArrLod[0]->model->AllIndexCount / 3; + return ArrModels[id]->ArrLod[0]->model->m_uiAllIndexCount / 3; return -1; } @@ -1672,9 +1677,9 @@ void Green::SetGreenLod(ID id, int lod, const char* pathname) sprintf(tmppath, "%s%s", Core_RStringGet(G_RI_STRING_PATH_GS_MESHES), pathname); SGCore_StaticModelLoad(tmppath, &ArrModels[id]->ArrLod[lod]->model); - for (int k = 0; k < ArrModels[id]->ArrLod[lod]->model->SubsetCount; ++k) + for (int k = 0; k < ArrModels[id]->ArrLod[lod]->model->m_uiSubsetCount; ++k) { - sprintf(tmppath, "%s.dds", ArrModels[id]->ArrLod[lod]->model->ArrTextures[k]); + sprintf(tmppath, "%s.dds", ArrModels[id]->ArrLod[lod]->model->m_ppTextures[k]); ArrModels[id]->ArrLod[lod]->idstex[k] = SGCore_MtlLoad(tmppath, (ArrModels[id]->TypeGreen == GREEN_TYPE_TREE ? MTL_TYPE_TREE : MTL_TYPE_GRASS)); } } @@ -1696,37 +1701,37 @@ void Green::SetGreenNav(ID id, const char* pathname) ISXDataStaticModel* nmesh; SGCore_StaticModelLoad(tmppath, &nmesh); - ArrModels[id]->NavigateMesh->count_vertex = nmesh->AllVertexCount; - ArrModels[id]->NavigateMesh->count_index = nmesh->AllIndexCount; - ArrModels[id]->NavigateMesh->arr_vertex = new float3_t[nmesh->AllVertexCount]; + ArrModels[id]->NavigateMesh->count_vertex = nmesh->m_uiAllVertexCount; + ArrModels[id]->NavigateMesh->count_index = nmesh->m_uiAllIndexCount; + ArrModels[id]->NavigateMesh->arr_vertex = new float3_t[nmesh->m_uiAllVertexCount]; vertex_static *pVert; - nmesh->VertexBuffer->Lock(0, 0, (void **)&pVert, 0); - for (long i = 0; i < nmesh->AllVertexCount; ++i) + nmesh->m_pVertexBuffer->Lock(0, 0, (void **)&pVert, 0); + for (long i = 0; i < nmesh->m_uiAllVertexCount; ++i) { ArrModels[id]->NavigateMesh->arr_vertex[i] = pVert[i].Pos; } - nmesh->VertexBuffer->Unlock(); + nmesh->m_pVertexBuffer->Unlock(); - ArrModels[id]->NavigateMesh->arr_index = new uint32_t[nmesh->AllIndexCount]; - ArrModels[id]->NavigateMesh->arr_mtl = new ID[nmesh->AllIndexCount]; + ArrModels[id]->NavigateMesh->arr_index = new uint32_t[nmesh->m_uiAllIndexCount]; + ArrModels[id]->NavigateMesh->arr_mtl = new ID[nmesh->m_uiAllIndexCount]; UINT* pInd; - nmesh->IndexBuffer->Lock(0, 0, (void **)&pInd, 0); + nmesh->m_pIndexBuffer->Lock(0, 0, (void **)&pInd, 0); DWORD prebias = 0; long tmp_countindex = 0; char tmpnametex[SXGC_LOADTEX_MAX_SIZE_DIRNAME]; - for (int i = 0; i < nmesh->SubsetCount; ++i) + for (int i = 0; i < nmesh->m_uiSubsetCount; ++i) { - sprintf(tmpnametex, "%s.dds", nmesh->ArrTextures[i]); + sprintf(tmpnametex, "%s.dds", nmesh->m_ppTextures[i]); ID tmpidmtl = SGCore_MtlLoad(tmpnametex, MTL_TYPE_TREE); - for (int k = 0; k < nmesh->IndexCount[i]; ++k) + for (int k = 0; k < nmesh->m_pIndexCount[i]; ++k) { - ArrModels[id]->NavigateMesh->arr_index[tmp_countindex] = pInd[nmesh->StartIndex[i] + k] /*+ prebias*/; + ArrModels[id]->NavigateMesh->arr_index[tmp_countindex] = pInd[nmesh->m_pStartIndex[i] + k] /*+ prebias*/; ArrModels[id]->NavigateMesh->arr_mtl[tmp_countindex] = tmpidmtl; ++tmp_countindex; } - prebias += nmesh->IndexCount[i]; + prebias += nmesh->m_pIndexCount[i]; } - nmesh->IndexBuffer->Unlock(); + nmesh->m_pIndexBuffer->Unlock(); mem_release_del(nmesh); } @@ -1829,7 +1834,7 @@ void Green::GetPartBeam(float3* pos, float3 * dir, Segment** arrsplits, DWORD *c { float3 center; float radius; - comsegment->BoundVolumeP->GetSphere(¢er, &radius); + comsegment->BoundVolumeP->getSphere(¢er, &radius); float distsqr = SGCore_0DistancePointBeam2(center, *pos, *dir); if (comsegment->CountAllGreen > 0 && distsqr <= radius*radius) @@ -1881,11 +1886,11 @@ bool Green::TraceBeam(float3* start, float3* dir, float3* _res, ID* idgreen, ID* GetPartBeam(start, dir, irs->Arr, &(irs->CountCom), model->SplitsTree, irs->Count); vertex_static* pVertData = 0; - if (FAILED(model->ArrLod[0]->model->VertexBuffer->Lock(0, 0, (void**)&pVertData, 0))) + if (FAILED(model->ArrLod[0]->model->m_pVertexBuffer->Lock(0, 0, (void**)&pVertData, 0))) continue; DWORD* pIndData = 0; - if (FAILED(model->ArrLod[0]->model->IndexBuffer->Lock(0, 0, (void**)&pIndData, 0))) + if (FAILED(model->ArrLod[0]->model->m_pIndexBuffer->Lock(0, 0, (void**)&pIndData, 0))) continue; for (int k = 0; k < irs->CountCom; ++k) @@ -1893,9 +1898,9 @@ bool Green::TraceBeam(float3* start, float3* dir, float3* _res, ID* idgreen, ID* for (int key = 0; key < irs->Arr[k]->CountAllGreen; ++key) { UINT tmpcountind = 0; - for (int g = 0; g < model->ArrLod[0]->model->SubsetCount; ++g) + for (int g = 0; g < model->ArrLod[0]->model->m_uiSubsetCount; ++g) { - for (int poly = 0; poly < model->ArrLod[0]->model->IndexCount[g] / 3; ++poly) + for (int poly = 0; poly < model->ArrLod[0]->model->m_pIndexCount[g] / 3; ++poly) { float tmpscale = irs->Arr[k]->Data[key].m_vTexCoord.x; mat = SMMatrixScaling(tmpscale, tmpscale, tmpscale) * SMMatrixRotationY(irs->Arr[k]->Data[key].m_vTexCoord.y) * SMMatrixTranslation(irs->Arr[k]->Data[key].m_vPosition); @@ -1926,13 +1931,13 @@ bool Green::TraceBeam(float3* start, float3* dir, float3* _res, ID* idgreen, ID* } } - tmpcountind += model->ArrLod[0]->model->SubsetCount; + tmpcountind += model->ArrLod[0]->model->m_uiSubsetCount; } } } - model->ArrLod[0]->model->VertexBuffer->Unlock(); - model->ArrLod[0]->model->IndexBuffer->Unlock(); + model->ArrLod[0]->model->m_pVertexBuffer->Unlock(); + model->ArrLod[0]->model->m_pIndexBuffer->Unlock(); } if (found && _res) @@ -1945,7 +1950,7 @@ void Green::GetPartBB(float3* bbmin, float3 * bbmax, Segment** arrsplits, DWORD { float3 min,max; float radius; - comsegment->BoundVolumeP->GetMinMax(&min, &max); + comsegment->BoundVolumeP->getMinMax(&min, &max); if (comsegment->CountAllGreen > 0 && SGCore_0InretsectBox(bbmin, bbmax, &min, &max)) { @@ -1989,14 +1994,14 @@ bool Green::GetOccurencessLeafGrass(float3* bbmin, float3* bbmax, int physic_mtl GetPartBB(bbmin, bbmax, irs->Arr, &(irs->CountCom), model->SplitsTree, irs->Count); vertex_static* pVertData = 0; - if (FAILED(model->ArrLod[0]->model->VertexBuffer->Lock(0, 0, (void**)&pVertData, 0))) + if (FAILED(model->ArrLod[0]->model->m_pVertexBuffer->Lock(0, 0, (void**)&pVertData, 0))) continue; DWORD* pIndData = 0; - if (FAILED(model->ArrLod[0]->model->IndexBuffer->Lock(0, 0, (void**)&pIndData, 0))) + if (FAILED(model->ArrLod[0]->model->m_pIndexBuffer->Lock(0, 0, (void**)&pIndData, 0))) continue; - for (int g = 0; g < model->ArrLod[0]->model->SubsetCount && !isfound; ++g) + for (int g = 0; g < model->ArrLod[0]->model->m_uiSubsetCount && !isfound; ++g) { int pt = SGCore_MtlGetPhysicType(model->ArrLod[0]->idstex[g]); if (SGCore_MtlGetPhysicType(model->ArrLod[0]->idstex[g]) != physic_mtl) @@ -2008,7 +2013,7 @@ bool Green::GetOccurencessLeafGrass(float3* bbmin, float3* bbmax, int physic_mtl { - for (int poly = 0; poly < model->ArrLod[0]->model->IndexCount[g] / 3 && !isfound; ++poly) + for (int poly = 0; poly < model->ArrLod[0]->model->m_pIndexCount[g] / 3 && !isfound; ++poly) { float tmpscale = irs->Arr[k]->Data[key].m_vTexCoord.x; mat = SMMatrixScaling(tmpscale, tmpscale, tmpscale) * SMMatrixRotationY(irs->Arr[k]->Data[key].m_vTexCoord.y) * SMMatrixTranslation(irs->Arr[k]->Data[key].m_vPosition); @@ -2058,8 +2063,8 @@ bool Green::GetOccurencessLeafGrass(float3* bbmin, float3* bbmax, int physic_mtl } } - model->ArrLod[0]->model->VertexBuffer->Unlock(); - model->ArrLod[0]->model->IndexBuffer->Unlock(); + model->ArrLod[0]->model->m_pVertexBuffer->Unlock(); + model->ArrLod[0]->model->m_pIndexBuffer->Unlock(); } return isfound; diff --git a/source/geom/green.h b/source/geom/green.h index 87085bbd8a1fa194027aec869227ddcd31d46e86..5bc914a6b6b18ebb061833261f4bdc5798126bed 100644 --- a/source/geom/green.h +++ b/source/geom/green.h @@ -1,19 +1,22 @@ -#ifndef __green -#define __green +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + +#ifndef __GREEN_H +#define __GREEN_H #include <gdefines.h> -#include <common\\string.h> -#include <common\array.h> -#include <common\SXMath.h> +#include <common/string.h> +#include <common/array.h> +#include <common/SXMath.h> #include <d3d9.h> -#include <gcore\\sxgcore.h> +#include <gcore/sxgcore.h> #include "static_geom.h" #include "sxgeom.h" -extern report_func g_fnReportf; - #define GREEN_COUNT_TYPE_SEGMENTATION 4 #define GREEN_COUNT_LOD 3 @@ -23,13 +26,13 @@ extern report_func g_fnReportf; #define GREEN_PRECOND_ARRCOMFOR_ERR_ID(id_arr) \ if (!(id_arr < ArrComFor.size()))\ {\ - g_fnReportf(REPORT_MSG_LEVEL_ERROR, "%s - green: unresolved id '%d' for array of compute visible", GEN_MSG_LOCATION, id_arr); \ + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - green: unresolved id '%d' for array of compute visible", GEN_MSG_LOCATION, id_arr); \ } #define GREEN_PRECOND_ARRCOMFOR_ERR_ID_MODEL(id_model) \ if (!(id_model < ArrModels.size() && ArrModels[id_model]))\ {\ - g_fnReportf(REPORT_MSG_LEVEL_ERROR, "%s - green: unresolved id '%d' for array of models", GEN_MSG_LOCATION, id_model); \ + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - green: unresolved id '%d' for array of models", GEN_MSG_LOCATION, id_model); \ } class Green @@ -71,7 +74,7 @@ public: void Save(const char* path); void Load(const char* path); void Clear(); - void CPUFillingArrIndeces(ISXFrustum* frustum, float3* viewpos, ID id_arr = 0); + void CPUFillingArrIndeces(const ISXFrustum* frustum, float3* viewpos, ID id_arr = 0); void GPURender(DWORD timeDelta, float3* viewpos, GREEN_TYPE type, ID id_arr = 0); void GPURenderSingly(DWORD timeDelta, float3* viewpos, ID id, ID id_tex); void GPURenderObject(DWORD timeDelta, float3* viewpos, ID id, ID split, ID idobj, ID id_tex); @@ -189,7 +192,7 @@ protected: void GetPartBeam(float3* pos, float3 * dir, Segment** arrsplits, DWORD *count, Segment* comsegment, ID curr_splits_ids_render); void GetPartBB(float3* bbmin, float3 * bbmax, Segment** arrsplits, DWORD *count, Segment* comsegment, ID curr_splits_ids_render); - void ComRecArrIndeces(ISXFrustum* frustum, Segment** arrsplits, DWORD *count, Segment* comsegment, float3* viewpos, Array<Segment*, GREEN_DEFAULT_RESERVE_COM>* queue, ID curr_splits_ids_render); + void ComRecArrIndeces(const ISXFrustum* frustum, Segment** arrsplits, DWORD *count, Segment* comsegment, float3* viewpos, Array<Segment*, GREEN_DEFAULT_RESERVE_COM>* queue, ID curr_splits_ids_render); void AddModelInArrCom(ID id_model); void DelModelInArrCom(ID id_model); diff --git a/source/geom/static_geom.cpp b/source/geom/static_geom.cpp index d31c69838b7aeaf2d7e72f6ab34b2d28aaaad822..a29726b9ca7d1e90046ac09317f7aaf6c918f3f1 100644 --- a/source/geom/static_geom.cpp +++ b/source/geom/static_geom.cpp @@ -1,4 +1,9 @@ +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include "static_geom.h" StaticGeom::Segment::Segment() @@ -220,7 +225,7 @@ long StaticGeom::GetCountModel() ID StaticGeom::AddModel(const char* path, const char* lod1, const char* name) { - g_fnReportf(0, "load geometry: '%s'.. ", path); + LibReport(0, "load geometry: '%s'.. ", path); DelArrIndexPtr(); ISXDataStaticModel* model = 0; @@ -243,26 +248,26 @@ ID StaticGeom::AddModel(const char* path, const char* lod1, const char* name) vertex_static* pVert; UINT* pInd; - if (FAILED(model->VertexBuffer->Lock(0, 0, (void**)&pVert, 0))) + if (FAILED(model->m_pVertexBuffer->Lock(0, 0, (void**)&pVert, 0))) return -1; - if (FAILED(model->IndexBuffer->Lock(0, 0, (void**)&pInd, 0))) + if (FAILED(model->m_pIndexBuffer->Lock(0, 0, (void**)&pInd, 0))) return -1; - for (int i = 0; i < model->SubsetCount; ++i) + for (int i = 0; i < model->m_uiSubsetCount; ++i) { - tmpmodel->CountPoly += model->IndexCount[i] / 3; + tmpmodel->CountPoly += model->m_pIndexCount[i] / 3; char tmptex[1024]; - sprintf(tmptex, "%s.dds", model->ArrTextures[i]); + sprintf(tmptex, "%s.dds", model->m_ppTextures[i]); tmpmodel->IDTex[i] = SGCore_MtlLoad(tmptex, MTL_TYPE_GEOM); //если количество полигонов в подгруппе модели больше разрешенного - if (model->IndexCount[i] / 3 > GEOM_MAX_POLY_IN_GROUP) + if (model->m_pIndexCount[i] / 3 > GEOM_MAX_POLY_IN_GROUP) { - g_fnReportf(-1, "[GEOM] %s count polygons %d in group over default '%d'", GEN_MSG_LOCATION, model->IndexCount[i] / 3, GEOM_MAX_POLY_IN_GROUP); + LibReport(REPORT_MSG_LEVEL_ERROR, "%s count polygons %d in group over default '%d'", GEN_MSG_LOCATION, model->m_pIndexCount[i] / 3, GEOM_MAX_POLY_IN_GROUP); return -1; } @@ -271,7 +276,7 @@ ID StaticGeom::AddModel(const char* path, const char* lod1, const char* name) for (int k = 0; k < AllGroups.size(); ++k) { //сравниваем подгруппы только по имени, если имена одинаковые значит это одна и та же подгруппа - if (stricmp(AllGroups[k]->name.c_str(), model->ArrTextures[i]) == 0) + if (stricmp(AllGroups[k]->name.c_str(), model->m_ppTextures[i]) == 0) { isunictex = false; @@ -285,13 +290,13 @@ ID StaticGeom::AddModel(const char* path, const char* lod1, const char* name) vertex_static * pData2; //если последний незаполненный буфер не вмещает в себ¤ - if (AllGroups[k]->CountIndex[AllGroups[k]->CountIndex.size() - 1] / 3 + model->IndexCount[i] / 3 > GEOM_MAX_POLY_IN_GROUP) + if (AllGroups[k]->CountIndex[AllGroups[k]->CountIndex.size() - 1] / 3 + model->m_pIndexCount[i] / 3 > GEOM_MAX_POLY_IN_GROUP) { //создаем новый gdb.VertexStart = 0; - gdb.VertexCount = model->VertexCount[i]; + gdb.VertexCount = model->m_pVertexCount[i]; - StaticGeom::DXDevice->CreateVertexBuffer(sizeof(vertex_static)* model->VertexCount[i], NULL, NULL, D3DPOOL_MANAGED, &vb, 0); + StaticGeom::DXDevice->CreateVertexBuffer(sizeof(vertex_static)* model->m_pVertexCount[i], NULL, NULL, D3DPOOL_MANAGED, &vb, 0); /*Group::VertexBuff* vborigin = new Group::VertexBuff(); vborigin->count = model->VertexCount[i]; @@ -302,12 +307,12 @@ ID StaticGeom::AddModel(const char* path, const char* lod1, const char* name) } AllGroups[k]->VertexBufferOrigin.push_back(vborigin);*/ - AllGroups[k]->AllCountVertex += model->VertexCount[i]; - AllGroups[k]->CountVertex.push_back(model->VertexCount[i]); + AllGroups[k]->AllCountVertex += model->m_pVertexCount[i]; + AllGroups[k]->CountVertex.push_back(model->m_pVertexCount[i]); //копируем данные в новый вершинный буфер if (!FAILED(vb->Lock(0, 0, (void**)&pData, 0))) { - memcpy(pData, pVert + model->StartVertex[i], sizeof(vertex_static)* model->VertexCount[i]); + memcpy(pData, pVert + model->m_pStartVertex[i], sizeof(vertex_static)* model->m_pVertexCount[i]); vb->Unlock(); } @@ -315,18 +320,18 @@ ID StaticGeom::AddModel(const char* path, const char* lod1, const char* name) gdb.IndexStart = 0; - gdb.IndexCount = model->IndexCount[i]; - AllGroups[k]->AllCountIndex += model->IndexCount[i]; - AllGroups[k]->CountIndex.push_back(model->IndexCount[i]); + gdb.IndexCount = model->m_pIndexCount[i]; + AllGroups[k]->AllCountIndex += model->m_pIndexCount[i]; + AllGroups[k]->CountIndex.push_back(model->m_pIndexCount[i]); gdb.idbuff = AllGroups[k]->VertexBuffer.size()-1; AllGroups[k]->ArrModels[gdb.idbuff].push_back(tmpmodel); - if (SizeRenderIndexBuffer < model->IndexCount[i]) + if (SizeRenderIndexBuffer < model->m_pIndexCount[i]) { mem_release(RenderIndexBuffer); - SizeRenderIndexBuffer = model->IndexCount[i]; + SizeRenderIndexBuffer = model->m_pIndexCount[i]; StaticGeom::DXDevice->CreateIndexBuffer(sizeof(uint32_t)* SizeRenderIndexBuffer, D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY, D3DFMT_INDEX32, D3DPOOL_DEFAULT/*D3DPOOL_MANAGED*/, &RenderIndexBuffer, 0); } } @@ -339,7 +344,7 @@ ID StaticGeom::AddModel(const char* path, const char* lod1, const char* name) AllGroups[k]->ArrModels[gdb.idbuff].push_back(tmpmodel); long lastvbnum = AllGroups[k]->VertexBuffer.size() - 1; - StaticGeom::DXDevice->CreateVertexBuffer(sizeof(vertex_static)* (AllGroups[k]->CountVertex[lastvbnum] + model->VertexCount[i]), NULL, NULL, D3DPOOL_MANAGED, &vb, 0); + StaticGeom::DXDevice->CreateVertexBuffer(sizeof(vertex_static)* (AllGroups[k]->CountVertex[lastvbnum] + model->m_pVertexCount[i]), NULL, NULL, D3DPOOL_MANAGED, &vb, 0); /*Group::VertexBuff* vborigin = new Group::VertexBuff(); vborigin->count = (AllGroups[k]->CountVertex[lastvbnum] + model->VertexCount[i]); @@ -353,7 +358,7 @@ ID StaticGeom::AddModel(const char* path, const char* lod1, const char* name) AllGroups[k]->VertexBufferOrigin[lastvbnum] = vborigin;*/ gdb.VertexStart = AllGroups[k]->CountVertex[lastvbnum]; - gdb.VertexCount = model->VertexCount[i]; + gdb.VertexCount = model->m_pVertexCount[i]; if (!FAILED(vb->Lock(0, 0, (void**)&pData, 0))) { @@ -363,25 +368,25 @@ ID StaticGeom::AddModel(const char* path, const char* lod1, const char* name) AllGroups[k]->VertexBuffer[lastvbnum]->Unlock(); } - memcpy(pData + AllGroups[k]->CountVertex[lastvbnum], pVert + model->StartVertex[i], sizeof(vertex_static)* (model->VertexCount[i])); + memcpy(pData + AllGroups[k]->CountVertex[lastvbnum], pVert + model->m_pStartVertex[i], sizeof(vertex_static)* (model->m_pVertexCount[i])); vb->Unlock(); } - AllGroups[k]->AllCountVertex += model->VertexCount[i]; - AllGroups[k]->CountVertex[lastvbnum] += model->VertexCount[i]; + AllGroups[k]->AllCountVertex += model->m_pVertexCount[i]; + AllGroups[k]->CountVertex[lastvbnum] += model->m_pVertexCount[i]; mem_release(AllGroups[k]->VertexBuffer[lastvbnum]); AllGroups[k]->VertexBuffer[lastvbnum] = vb; gdb.IndexStart = AllGroups[k]->CountIndex[lastvbnum]; - gdb.IndexCount = model->IndexCount[i]; + gdb.IndexCount = model->m_pIndexCount[i]; - AllGroups[k]->AllCountIndex += model->IndexCount[i]; - AllGroups[k]->CountIndex[lastvbnum] += model->IndexCount[i]; + AllGroups[k]->AllCountIndex += model->m_pIndexCount[i]; + AllGroups[k]->CountIndex[lastvbnum] += model->m_pIndexCount[i]; - if (SizeRenderIndexBuffer < (AllGroups[k]->CountIndex[lastvbnum] + model->IndexCount[i])) + if (SizeRenderIndexBuffer < (AllGroups[k]->CountIndex[lastvbnum] + model->m_pIndexCount[i])) { mem_release(RenderIndexBuffer); - SizeRenderIndexBuffer = (AllGroups[k]->CountIndex[lastvbnum] + model->IndexCount[i]); + SizeRenderIndexBuffer = (AllGroups[k]->CountIndex[lastvbnum] + model->m_pIndexCount[i]); StaticGeom::DXDevice->CreateIndexBuffer(sizeof(uint32_t)* SizeRenderIndexBuffer, D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY, D3DFMT_INDEX32, D3DPOOL_DEFAULT/*D3DPOOL_MANAGED*/, &RenderIndexBuffer, 0); } } @@ -400,14 +405,14 @@ ID StaticGeom::AddModel(const char* path, const char* lod1, const char* name) gdb.idbuff = 0; gdb.idgroup = AllGroups.size(); gdb.VertexStart = 0; - gdb.VertexCount = model->VertexCount[i]; + gdb.VertexCount = model->m_pVertexCount[i]; gdb.IndexStart = 0; - gdb.IndexCount = model->IndexCount[i]; + gdb.IndexCount = model->m_pIndexCount[i]; tmpmodel->SubSet.push_back(gdb); IDirect3DVertexBuffer9* vb; - StaticGeom::DXDevice->CreateVertexBuffer(sizeof(vertex_static)* model->VertexCount[i], NULL, NULL, D3DPOOL_MANAGED, &vb, 0); + StaticGeom::DXDevice->CreateVertexBuffer(sizeof(vertex_static)* model->m_pVertexCount[i], NULL, NULL, D3DPOOL_MANAGED, &vb, 0); /*Group::VertexBuff* vborigin = new Group::VertexBuff(); vborigin->count = model->VertexCount[i]; @@ -418,25 +423,25 @@ ID StaticGeom::AddModel(const char* path, const char* lod1, const char* name) vborigin->arr[k] = (model->ArrVertBuf + model->StartVertex[i] + k)->Pos; }*/ - ngroup->AllCountVertex = model->VertexCount[i]; - ngroup->CountVertex.push_back(model->VertexCount[i]); + ngroup->AllCountVertex = model->m_pVertexCount[i]; + ngroup->CountVertex.push_back(model->m_pVertexCount[i]); vertex_static * pData; if (!FAILED(vb->Lock(0, 0, (void**)&pData, 0))) { - memcpy(pData, pVert + model->StartVertex[i], sizeof(vertex_static)* model->VertexCount[i]); + memcpy(pData, pVert + model->m_pStartVertex[i], sizeof(vertex_static)* model->m_pVertexCount[i]); vb->Unlock(); } - ngroup->AllCountIndex = model->IndexCount[i]; - ngroup->CountIndex.push_back(model->IndexCount[i]); + ngroup->AllCountIndex = model->m_pIndexCount[i]; + ngroup->CountIndex.push_back(model->m_pIndexCount[i]); ngroup->VertexBuffer.push_back(vb); //ngroup->VertexBufferOrigin.push_back(vborigin); - if (SizeRenderIndexBuffer < model->IndexCount[i]) + if (SizeRenderIndexBuffer < model->m_pIndexCount[i]) { mem_release(RenderIndexBuffer); - SizeRenderIndexBuffer = model->IndexCount[i]; + SizeRenderIndexBuffer = model->m_pIndexCount[i]; StaticGeom::DXDevice->CreateIndexBuffer(sizeof(uint32_t)* SizeRenderIndexBuffer, D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY, D3DFMT_INDEX32, D3DPOOL_DEFAULT/*D3DPOOL_MANAGED*/, &RenderIndexBuffer, 0); } @@ -446,20 +451,20 @@ ID StaticGeom::AddModel(const char* path, const char* lod1, const char* name) ngroup->idtex = tmpmodel->IDTex[i];// SGCore_LoadMtl(tmptex, MTL_GEOM); ngroup->SortGroup = SGCore_MtlGetSort(ngroup->idtex); ngroup->IsRenderSingly = SGCore_MtlGroupRenderIsSingly(ngroup->idtex); - ngroup->name = model->ArrTextures[i]; + ngroup->name = model->m_ppTextures[i]; AllGroups.push_back(ngroup); } vertex_static* pData; - model->VertexBuffer->Lock(0, 0, (void**)&pData, 0); + model->m_pVertexBuffer->Lock(0, 0, (void**)&pData, 0); - float3_t tmppos = pData[model->StartVertex[i]].Pos; + float3_t tmppos = pData[model->m_pStartVertex[i]].Pos; float3 tmpMax = tmppos; float3 tmpMin = tmppos; - for (DWORD k = 0; k<model->VertexCount[i]; k++) + for (DWORD k = 0; k<model->m_pVertexCount[i]; k++) { - tmppos = pData[model->StartVertex[i] + k].Pos; + tmppos = pData[model->m_pStartVertex[i] + k].Pos; if (tmppos.x > tmpMax.x) tmpMax.x = tmppos.x; @@ -482,24 +487,24 @@ ID StaticGeom::AddModel(const char* path, const char* lod1, const char* name) } DWORD* indeces; - model->IndexBuffer->Lock(0, 0, (void **)&indeces, 0); + model->m_pIndexBuffer->Lock(0, 0, (void **)&indeces, 0); float3 tmpMM = SMVectorLerp(tmpMax, tmpMin, 0.5f); D3DXPlaneFromPoints(&tmpmodel->SubSet[i].Plane, - &D3DXVECTOR3(pData[indeces[model->StartIndex[i] + 0]].Pos.x, pData[indeces[model->StartIndex[i] + 0]].Pos.y, pData[indeces[model->StartIndex[i] + 0]].Pos.z), - &D3DXVECTOR3(pData[indeces[model->StartIndex[i] + 1]].Pos.x, pData[indeces[model->StartIndex[i] + 1]].Pos.y, pData[indeces[model->StartIndex[i] + 1]].Pos.z), - &D3DXVECTOR3(pData[indeces[model->StartIndex[i] + 2]].Pos.x, pData[indeces[model->StartIndex[i] + 2]].Pos.y, pData[indeces[model->StartIndex[i] + 2]].Pos.z)); - model->VertexBuffer->Unlock(); - model->IndexBuffer->Unlock(); + &D3DXVECTOR3(pData[indeces[model->m_pStartIndex[i] + 0]].Pos.x, pData[indeces[model->m_pStartIndex[i] + 0]].Pos.y, pData[indeces[model->m_pStartIndex[i] + 0]].Pos.z), + &D3DXVECTOR3(pData[indeces[model->m_pStartIndex[i] + 1]].Pos.x, pData[indeces[model->m_pStartIndex[i] + 1]].Pos.y, pData[indeces[model->m_pStartIndex[i] + 1]].Pos.z), + &D3DXVECTOR3(pData[indeces[model->m_pStartIndex[i] + 2]].Pos.x, pData[indeces[model->m_pStartIndex[i] + 2]].Pos.y, pData[indeces[model->m_pStartIndex[i] + 2]].Pos.z)); + model->m_pVertexBuffer->Unlock(); + model->m_pIndexBuffer->Unlock(); tmpmodel->SubSet[i].Center = (float3_t)((tmpMax + tmpMin) * 0.5); tmpmodel->SubSet[i].Min = tmpMin; tmpmodel->SubSet[i].Max = tmpMax; } - model->VertexBuffer->Unlock(); - model->IndexBuffer->Unlock(); + model->m_pVertexBuffer->Unlock(); + model->m_pIndexBuffer->Unlock(); AllModels.push_back(tmpmodel); @@ -515,8 +520,8 @@ ID StaticGeom::AddModel(const char* path, const char* lod1, const char* name) float3 jmin, jmax, jmin2, jmax2; - AllModels[AllModels.size()-1]->ArrSplits->BoundVolumeP->GetMinMax(&jmin, &jmax); - BoundVolume->GetMinMax(&jmin2, &jmax2); + AllModels[AllModels.size()-1]->ArrSplits->BoundVolumeP->getMinMax(&jmin, &jmax); + BoundVolume->getMinMax(&jmin2, &jmax2); if (jmin2.x > jmin.x) jmin2.x = jmin.x; @@ -532,14 +537,14 @@ ID StaticGeom::AddModel(const char* path, const char* lod1, const char* name) if (jmax2.z < jmax.z) jmax2.z = jmax.z; - BoundVolume->SetMinMax(&jmin2, &jmax2); + BoundVolume->setMinMax(&jmin2, &jmax2); mem_release_del(model); mem_delete_a(ArrMeshVertex); mem_delete_a(ArrMeshIndex); - g_fnReportf(0, " completed\n", path); + LibReport(0, " completed\n", path); return AllModels.size() - 1; } @@ -625,7 +630,7 @@ void StaticGeom::DelModel(ID id) if (tmpidingroup == -1) { //то это очень плохо - g_fnReportf(REPORT_MSG_LEVEL_ERROR, "[GEOM] %s - when deleting the model, it was found in an array of patterns in subgroups of the buffer, it is very bad", GEN_MSG_LOCATION); + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - when deleting the model, it was found in an array of patterns in subgroups of the buffer, it is very bad", GEN_MSG_LOCATION); } //обновляем данные в подгруппе модели о стартовых позициях @@ -977,7 +982,7 @@ void StaticGeom::InitArrIndexPtr() } -void StaticGeom::CPUFillingArrIndeces(ISXFrustum* frustum, float3* viewpos, ID id_arr) +void StaticGeom::CPUFillingArrIndeces(const ISXFrustum* frustum, float3* viewpos, ID id_arr) { STATIC_PRECOND_ARRCOMFOR_ERR_ID(id_arr); @@ -991,7 +996,7 @@ void StaticGeom::CPUFillingArrIndeces(ISXFrustum* frustum, float3* viewpos, ID i { if (id_arr == 0) { - AllModels[i]->ArrSplits->BoundVolumeP->GetSphere(&jcenter, &jradius); + AllModels[i]->ArrSplits->BoundVolumeP->getSphere(&jcenter, &jradius); AllModels[i]->ArrSplits->DistForCamera = SMVector3Length((jcenter - (*viewpos))) - jradius; } @@ -1020,13 +1025,13 @@ void StaticGeom::CPUFillingArrIndeces(ISXFrustum* frustum, float3* viewpos, ID i } } -void StaticGeom::ComRecArrIndeces(ISXFrustum* frustum, Segment** arrsplits, DWORD *count, Segment* comsegment, float3* viewpos, Array<Segment*, GEOM_DEFAULT_RESERVE_COM>* queue, ID curr_splits_ids_render) +void StaticGeom::ComRecArrIndeces(const ISXFrustum* frustum, Segment** arrsplits, DWORD *count, Segment* comsegment, float3* viewpos, Array<Segment*, GEOM_DEFAULT_RESERVE_COM>* queue, ID curr_splits_ids_render) { float jradius; float3 jcenter; - comsegment->BoundVolumeP->GetSphere(&jcenter, &jradius); + comsegment->BoundVolumeP->getSphere(&jcenter, &jradius); - if (comsegment->CountAllPoly > 0 && (frustum->SphereInFrustum(&jcenter, jradius))) + if (comsegment->CountAllPoly > 0 && (frustum->sphereInFrustum(&jcenter, jradius))) { if (comsegment->BFNonEnd ) { @@ -1040,7 +1045,7 @@ void StaticGeom::ComRecArrIndeces(ISXFrustum* frustum, Segment** arrsplits, DWOR SortId[q] = -1; if (comsegment->Splits[q]) { - comsegment->Splits[q]->BoundVolumeP->GetSphere(&jcenter, &jradius); + comsegment->Splits[q]->BoundVolumeP->getSphere(&jcenter, &jradius); DistFor[q] = SMVector3Length2((jcenter - (*viewpos))) - jradius*jradius; } } @@ -1177,16 +1182,16 @@ void StaticGeom::GPURender(DWORD timeDelta, int sort_mtl, ID id_arr, ID exclude_ if (AllModels[i]->IsRenderLod) { - StaticGeom::DXDevice->SetStreamSource(0, AllModels[i]->Lod0.model->VertexBuffer, 0, sizeof(vertex_static)); - StaticGeom::DXDevice->SetIndices(AllModels[i]->Lod0.model->IndexBuffer); + StaticGeom::DXDevice->SetStreamSource(0, AllModels[i]->Lod0.model->m_pVertexBuffer, 0, sizeof(vertex_static)); + StaticGeom::DXDevice->SetIndices(AllModels[i]->Lod0.model->m_pIndexBuffer); StaticGeom::DXDevice->SetVertexDeclaration(SGCore_StaticModelGetDecl()); - for(int k = 0, kl = AllModels[i]->Lod0.model->SubsetCount; k < kl; ++k) + for (int k = 0, kl = AllModels[i]->Lod0.model->m_uiSubsetCount; k < kl; ++k) { if (AllModels[i]->Lod0.SortGroup == sort_mtl || sort_mtl == -1) { SGCore_MtlSet(AllModels[i]->Lod0.IDsTexs[k], 0); - SGCore_DIP(D3DPT_TRIANGLELIST, 0, 0, AllModels[i]->Lod0.model->VertexCount[k], AllModels[i]->Lod0.model->StartIndex[k], AllModels[i]->Lod0.model->IndexCount[k] / 3); - Core_RIntSet(G_RI_INT_COUNT_POLY, Core_RIntGet(G_RI_INT_COUNT_POLY) + AllModels[i]->Lod0.model->IndexCount[k] / 3); + SGCore_DIP(D3DPT_TRIANGLELIST, 0, 0, AllModels[i]->Lod0.model->m_pVertexCount[k], AllModels[i]->Lod0.model->m_pStartIndex[k], AllModels[i]->Lod0.model->m_pIndexCount[k] / 3); + Core_RIntSet(G_RI_INT_COUNT_POLY, Core_RIntGet(G_RI_INT_COUNT_POLY) + AllModels[i]->Lod0.model->m_pIndexCount[k] / 3); } } } @@ -1398,14 +1403,14 @@ void StaticGeom::GPURenderSingly(DWORD timeDelta, ID id, ID id_tex) if (AllModels[id]->IsRenderLod) { - StaticGeom::DXDevice->SetStreamSource(0, AllModels[id]->Lod0.model->VertexBuffer, 0, sizeof(vertex_static)); - StaticGeom::DXDevice->SetIndices(AllModels[id]->Lod0.model->IndexBuffer); + StaticGeom::DXDevice->SetStreamSource(0, AllModels[id]->Lod0.model->m_pVertexBuffer, 0, sizeof(vertex_static)); + StaticGeom::DXDevice->SetIndices(AllModels[id]->Lod0.model->m_pIndexBuffer); StaticGeom::DXDevice->SetVertexDeclaration(SGCore_StaticModelGetDecl()); - for (int k = 0, kl = AllModels[id]->Lod0.model->SubsetCount; k < kl; ++k) + for (int k = 0, kl = AllModels[id]->Lod0.model->m_uiSubsetCount; k < kl; ++k) { SGCore_MtlSet((id_tex > 0 ? id_tex : AllModels[id]->Lod0.IDsTexs[k]), 0); - SGCore_DIP(D3DPT_TRIANGLELIST, 0, 0, AllModels[id]->Lod0.model->VertexCount[k], AllModels[id]->Lod0.model->StartIndex[k], AllModels[id]->Lod0.model->IndexCount[k] / 3); - Core_RIntSet(G_RI_INT_COUNT_POLY, Core_RIntGet(G_RI_INT_COUNT_POLY) + AllModels[id]->Lod0.model->IndexCount[k] / 3); + SGCore_DIP(D3DPT_TRIANGLELIST, 0, 0, AllModels[id]->Lod0.model->m_pVertexCount[k], AllModels[id]->Lod0.model->m_pStartIndex[k], AllModels[id]->Lod0.model->m_pIndexCount[k] / 3); + Core_RIntSet(G_RI_INT_COUNT_POLY, Core_RIntGet(G_RI_INT_COUNT_POLY) + AllModels[id]->Lod0.model->m_pIndexCount[k] / 3); } } else if (ArrComFor[0]->arr[id]->CountCom > 0) @@ -1492,34 +1497,34 @@ void StaticGeom::PreSegmentation(Model* mesh, ISXDataStaticModel* model) vertex_static *CreateV; mem_delete_a(ArrMeshVertex); mem_delete_a(ArrMeshIndex); - CountVertex = model->AllVertexCount; + CountVertex = model->m_uiAllVertexCount; //копируем все вершины для текущих расчетов - ArrMeshVertex = new float3[model->AllVertexCount]; + ArrMeshVertex = new float3[model->m_uiAllVertexCount]; - model->VertexBuffer->Lock(0, 0, (void **)&CreateV, 0); - for (DWORD i = 0; i<model->AllVertexCount; i++) + model->m_pVertexBuffer->Lock(0, 0, (void **)&CreateV, 0); + for (DWORD i = 0; i<model->m_uiAllVertexCount; i++) { ArrMeshVertex[i] = (CreateV[i].Pos.operator float3()); } - model->VertexBuffer->Unlock(); + model->m_pVertexBuffer->Unlock(); - ArrMeshIndex = new UINT[model->AllIndexCount]; + ArrMeshIndex = new UINT[model->m_uiAllIndexCount]; UINT* pInd; - model->IndexBuffer->Lock(0, 0, (void **)&pInd, 0); - memcpy(ArrMeshIndex, pInd, sizeof(UINT)* model->AllIndexCount); - model->IndexBuffer->Unlock(); + model->m_pIndexBuffer->Lock(0, 0, (void **)&pInd, 0); + memcpy(ArrMeshIndex, pInd, sizeof(UINT)* model->m_uiAllIndexCount); + model->m_pIndexBuffer->Unlock(); /////// mesh->ArrSplits = new Segment(); - mesh->ArrSplits->CountAllPoly = model->AllIndexCount/3; - g_fnReportf(REPORT_MSG_LEVEL_NOTICE, "poly: %d, ", mesh->ArrSplits->CountAllPoly); + mesh->ArrSplits->CountAllPoly = model->m_uiAllIndexCount / 3; + LibReport(REPORT_MSG_LEVEL_NOTICE, "poly: %d, ", mesh->ArrSplits->CountAllPoly); mesh->ArrSplits->BoundVolumeP = SGCore_CrBound(); - mesh->ArrSplits->BoundVolumeP->CalcBound(model->VertexBuffer, model->AllVertexCount, sizeof(vertex_static)); + mesh->ArrSplits->BoundVolumeP->calcBound(model->m_pVertexBuffer, model->m_uiAllVertexCount, sizeof(vertex_static)); float3 tmpMin, tmpMax; - mesh->ArrSplits->BoundVolumeP->GetMinMax(&tmpMin, &tmpMax); + mesh->ArrSplits->BoundVolumeP->getMinMax(&tmpMin, &tmpMax); int CountSplitsSys = 0; int CountPolyInSegment = GEOM_MIN_COUNT_POLY; @@ -1530,24 +1535,24 @@ void StaticGeom::PreSegmentation(Model* mesh, ISXDataStaticModel* model) const float minVol = GEOM_MIN_ALLVOLUME_FOR_SEGMENTATION; const float minLen = GEOM_MIN_LENGTH_FOR_SEGMENTATION; const float minOctoHeight = GEOM_MIN_HEIGHT_FOR_SEGMENTATION; - if ((allvolume >= minVol || dimensions.x >= minLen || dimensions.y >= minOctoHeight || dimensions.z >= minLen) && (model->AllIndexCount >= GEOM_MIN_POLYGONS_FOR_SEGMENTATION * 3 || allvolume >= GEOM_FORCE_ALLVOLUME_FOR_SEGMENTATION)) + if ((allvolume >= minVol || dimensions.x >= minLen || dimensions.y >= minOctoHeight || dimensions.z >= minLen) && (model->m_uiAllIndexCount >= GEOM_MIN_POLYGONS_FOR_SEGMENTATION * 3 || allvolume >= GEOM_FORCE_ALLVOLUME_FOR_SEGMENTATION)) { if(dimensions.y >= minOctoHeight) { CountSplitsSys = GEOM_COUNT_TYPE_SEGMENTATION_OCTO; - g_fnReportf(REPORT_MSG_LEVEL_NOTICE, " div: octo, "); + LibReport(REPORT_MSG_LEVEL_NOTICE, " div: octo, "); } else { CountSplitsSys = GEOM_COUNT_TYPE_SEGMENTATION_QUAD; - g_fnReportf(REPORT_MSG_LEVEL_NOTICE, " div: quad, "); + LibReport(REPORT_MSG_LEVEL_NOTICE, " div: quad, "); } - float4_t tmpmin(dimensions.x / minLen, dimensions.y / minOctoHeight, dimensions.z / minLen, (float)model->AllIndexCount / (float)GEOM_MIN_POLYGONS_FOR_SEGMENTATION / 3.0f); + float4_t tmpmin(dimensions.x / minLen, dimensions.y / minOctoHeight, dimensions.z / minLen, (float)model->m_uiAllIndexCount / (float)GEOM_MIN_POLYGONS_FOR_SEGMENTATION / 3.0f); tmpmin.x = min(min(min(tmpmin.x, tmpmin.y), min(tmpmin.z, tmpmin.w)), (allvolume / minVol)) * 10.0; - CountPolyInSegment = (float)model->AllIndexCount / 3.0 / tmpmin.x / CountSplitsSys; + CountPolyInSegment = (float)model->m_uiAllIndexCount / 3.0 / tmpmin.x / CountSplitsSys; if (CountPolyInSegment < GEOM_MIN_COUNT_POLY) { @@ -1559,7 +1564,7 @@ void StaticGeom::PreSegmentation(Model* mesh, ISXDataStaticModel* model) CountPolyInSegment = GEOM_MAX_COUNT_POLY; } - g_fnReportf(REPORT_MSG_LEVEL_NOTICE, "poly in split: %d, ", CountPolyInSegment); + LibReport(REPORT_MSG_LEVEL_NOTICE, "poly in split: %d, ", CountPolyInSegment); } #else @@ -1576,12 +1581,12 @@ void StaticGeom::PreSegmentation(Model* mesh, ISXDataStaticModel* model) { //делим как octo дерево CountSplitsSys = GEOM_COUNT_TYPE_SEGMENTATION_OCTO; - g_fnReportf(REPORT_MSG_LEVEL_NOTICE, " div: octo, "); + LibReport(REPORT_MSG_LEVEL_NOTICE, " div: octo, "); } else { CountSplitsSys = STATIC_COUNT_TYPE_SEGMENTATION_QUAD; - g_fnReportf(REPORT_MSG_LEVEL_NOTICE, " div: quad, "); + LibReport(REPORT_MSG_LEVEL_NOTICE, " div: quad, "); } //определяем коэфициент интерполяции для определния минимального количества полигонов в сплите @@ -1591,7 +1596,7 @@ void StaticGeom::PreSegmentation(Model* mesh, ISXDataStaticModel* model) else if(tmpcoef < 0.f) tmpcoef = 0; CountPolyInSegment = lerpf(STATIC_MIN_COUNT_POLY, STATIC_MAX_COUNT_POLY, tmpcoef); - g_fnReportf(REPORT_MSG_LEVEL_NOTICE, "poly in split: %d, ", CountPolyInSegment); + LibReport(REPORT_MSG_LEVEL_NOTICE, "poly in split: %d, ", CountPolyInSegment); } #endif @@ -1659,22 +1664,22 @@ void StaticGeom::PreSegmentation(Model* mesh, ISXDataStaticModel* model) } mesh->ArrSplits->BoundVolumeSys = SGCore_CrBound(); - mesh->ArrSplits->BoundVolumeSys->SetMinMax(&tmpMin, &tmpMax); + mesh->ArrSplits->BoundVolumeSys->setMinMax(&tmpMin, &tmpMax); //}} - mesh->ArrSplits->CountSubSet = model->SubsetCount; - mesh->ArrSplits->NumberGroup = new uint32_t[model->SubsetCount]; - mesh->ArrSplits->NumberGroupModel = new uint32_t[model->SubsetCount]; - mesh->ArrSplits->CountPoly = new uint32_t[model->SubsetCount]; + mesh->ArrSplits->CountSubSet = model->m_uiSubsetCount; + mesh->ArrSplits->NumberGroup = new uint32_t[model->m_uiSubsetCount]; + mesh->ArrSplits->NumberGroupModel = new uint32_t[model->m_uiSubsetCount]; + mesh->ArrSplits->CountPoly = new uint32_t[model->m_uiSubsetCount]; ///// //заполняем массив с номаерами подгрупп и массив с количествами полигонов - for (DWORD i = 0; i<model->SubsetCount; i++) + for (DWORD i = 0; i<model->m_uiSubsetCount; i++) { mesh->ArrSplits->NumberGroupModel[i] = i; mesh->ArrSplits->NumberGroup[i] = i; - mesh->ArrSplits->CountPoly[i] = model->IndexCount[i] / 3; + mesh->ArrSplits->CountPoly[i] = model->m_pIndexCount[i] / 3; } //создаем массивы с полигонами, каждый полигон принадлежит своей подгруппе @@ -1685,9 +1690,9 @@ void StaticGeom::PreSegmentation(Model* mesh, ISXDataStaticModel* model) } //заполняем массивы с полигонами - for (DWORD i = 0; i<model->SubsetCount; i++) + for (DWORD i = 0; i<model->m_uiSubsetCount; i++) { - memcpy(mesh->ArrSplits->ArrPoly[i], ArrMeshIndex + model->StartIndex[i], model->IndexCount[i] * sizeof(uint32_t)); + memcpy(mesh->ArrSplits->ArrPoly[i], ArrMeshIndex + model->m_pStartIndex[i], model->m_pIndexCount[i] * sizeof(uint32_t)); } //если количество полигонов и текущая установка деления позволяют делить дальше @@ -1731,7 +1736,7 @@ void StaticGeom::PreSegmentation(Model* mesh, ISXDataStaticModel* model) { for (DWORD k = 0; k<mesh->ArrSplits->CountPoly[i] * 3; k++) { - mesh->ArrSplits->ArrPoly[i][k] -= model->StartVertex[mesh->ArrSplits->NumberGroup[i]]; + mesh->ArrSplits->ArrPoly[i][k] -= model->m_pStartVertex[mesh->ArrSplits->NumberGroup[i]]; mesh->ArrSplits->ArrPoly[i][k] += mesh->SubSet[mesh->ArrSplits->NumberGroup[i]].VertexStart; } mesh->ArrSplits->NumberGroup[i] = mesh->SubSet[mesh->ArrSplits->NumberGroup[i]].idgroup; @@ -1791,9 +1796,9 @@ void StaticGeom::Segmentation(Segment* Split, Model* mesh, ISXDataStaticModel* m for (int i = 0; i<CountSplitsSys; i++) { Split->Splits[i]->BoundVolumeSys = ArrBound[i]; - Split->Splits[i]->BoundVolumeSys->GetMinMax(&tmpmin, &tmpmax); + Split->Splits[i]->BoundVolumeSys->getMinMax(&tmpmin, &tmpmax); Split->Splits[i]->BoundVolumeP = SGCore_CrBound(); - Split->Splits[i]->BoundVolumeP->SetMinMax(&tmpmin, &tmpmax); + Split->Splits[i]->BoundVolumeP->setMinMax(&tmpmin, &tmpmax); } } else if (CountSplitsSys == GEOM_COUNT_TYPE_SEGMENTATION_OCTO) @@ -1808,9 +1813,9 @@ void StaticGeom::Segmentation(Segment* Split, Model* mesh, ISXDataStaticModel* m for (int i = 0; i<CountSplitsSys; i++) { Split->Splits[i]->BoundVolumeSys = ArrBound[i]; - Split->Splits[i]->BoundVolumeSys->GetMinMax(&tmpmin, &tmpmax); + Split->Splits[i]->BoundVolumeSys->getMinMax(&tmpmin, &tmpmax); Split->Splits[i]->BoundVolumeP = SGCore_CrBound(); - Split->Splits[i]->BoundVolumeP->SetMinMax(&tmpmin, &tmpmax); + Split->Splits[i]->BoundVolumeP->setMinMax(&tmpmin, &tmpmax); } } //}} @@ -1823,7 +1828,7 @@ void StaticGeom::Segmentation(Segment* Split, Model* mesh, ISXDataStaticModel* m float3 tmpMin, tmpMax; for (int i = 0; i<CountSplitsSys; i++) { - Split->Splits[i]->BoundVolumeSys->GetMinMax(&tmpMin, &tmpMax); + Split->Splits[i]->BoundVolumeSys->getMinMax(&tmpMin, &tmpMax); //SGCore_FCreateBoundingBoxMesh(&tmpMin, &tmpMax, &(Split->Splits[i]->BoundBox)); DWORD tmpNumCurrentPoly = 0; for (DWORD j = 0; j<Split->CountSubSet; j++) @@ -1881,7 +1886,7 @@ void StaticGeom::Segmentation(Segment* Split, Model* mesh, ISXDataStaticModel* m for (int q = 0; q<CountSplitsSys; q++) { - Split->Splits[q]->BoundVolumeSys->GetSphere(&SphereCenter, &ShereRadius); + Split->Splits[q]->BoundVolumeSys->getSphere(&SphereCenter, &ShereRadius); Length = -SphereCenter + CenterPoly; ArrLength[q] = SMVector3Length(Length); } @@ -2060,7 +2065,7 @@ void StaticGeom::Segmentation(Segment* Split, Model* mesh, ISXDataStaticModel* m { for (DWORD k = 0; k<Split->Splits[i]->CountPoly[q] * 3; k++) { - Split->Splits[i]->ArrPoly[q][k] -= model->StartVertex[Split->Splits[i]->NumberGroup[q]]; + Split->Splits[i]->ArrPoly[q][k] -= model->m_pStartVertex[Split->Splits[i]->NumberGroup[q]]; Split->Splits[i]->ArrPoly[q][k] += mesh->SubSet[Split->Splits[i]->NumberGroup[q]].VertexStart; } @@ -2097,7 +2102,7 @@ void StaticGeom::EditVolume(Model* mesh, Segment* Split) Min = ArrMeshVertex[(Split->ArrPoly[0][0])]; float3 Max2, Min2; - Split->BoundVolumeSys->GetMinMax(&Min2, &Max2); + Split->BoundVolumeSys->getMinMax(&Min2, &Max2); float3 tmpf; for (DWORD i = 0; i<Split->CountSubSet; i++) @@ -2125,7 +2130,7 @@ void StaticGeom::EditVolume(Model* mesh, Segment* Split) //float Radius = SMVector3Length(Center - Max); //Split->BoundVolumeP->SetSphere(&Center, &Radius); - Split->BoundVolumeP->SetMinMax(&Min, &Max); + Split->BoundVolumeP->setMinMax(&Min, &Max); } void StaticGeom::Save(const char* path) @@ -2248,7 +2253,7 @@ void StaticGeom::Save(const char* path) void StaticGeom::SaveSplit(Segment* Split, FILE* file, Array<Segment*> * queue) { float3 jmin, jmax; - Split->BoundVolumeSys->GetMinMax(&jmin, &jmax); + Split->BoundVolumeSys->getMinMax(&jmin, &jmax); fwrite(&jmin.x, sizeof(float), 1, file); fwrite(&jmin.y, sizeof(float), 1, file); fwrite(&jmin.z, sizeof(float), 1, file); @@ -2257,7 +2262,7 @@ void StaticGeom::SaveSplit(Segment* Split, FILE* file, Array<Segment*> * queue) fwrite(&jmax.y, sizeof(float), 1, file); fwrite(&jmax.z, sizeof(float), 1, file); - Split->BoundVolumeP->GetMinMax(&jmin, &jmax); + Split->BoundVolumeP->getMinMax(&jmin, &jmax); fwrite(&jmin.x, sizeof(float), 1, file); fwrite(&jmin.y, sizeof(float), 1, file); fwrite(&jmin.z, sizeof(float), 1, file); @@ -2478,8 +2483,8 @@ void StaticGeom::Load(const char* path) float3 jmin, jmax, jmin2, jmax2; - AllModels[i]->ArrSplits->BoundVolumeP->GetMinMax(&jmin, &jmax); - BoundVolume->GetMinMax(&jmin2, &jmax2); + AllModels[i]->ArrSplits->BoundVolumeP->getMinMax(&jmin, &jmax); + BoundVolume->getMinMax(&jmin2, &jmax2); if (jmin2.x > jmin.x) jmin2.x = jmin.x; @@ -2495,7 +2500,7 @@ void StaticGeom::Load(const char* path) if (jmax2.z < jmax.z) jmax2.z = jmax.z; - BoundVolume->SetMinMax(&jmin2, &jmax2); + BoundVolume->setMinMax(&jmin2, &jmax2); } for (long i = 0; i < AllGroups.size(); ++i) @@ -2528,7 +2533,7 @@ void StaticGeom::LoadSplit(Segment** Split, FILE* file, Array<Segment**> * queue fread(&jmax.z, sizeof(float), 1, file); (*Split)->BoundVolumeSys = SGCore_CrBound(); - (*Split)->BoundVolumeSys->SetMinMax(&jmin, &jmax); + (*Split)->BoundVolumeSys->setMinMax(&jmin, &jmax); fread(&jmin.x, sizeof(float), 1, file); @@ -2540,7 +2545,7 @@ void StaticGeom::LoadSplit(Segment** Split, FILE* file, Array<Segment**> * queue fread(&jmax.z, sizeof(float), 1, file); (*Split)->BoundVolumeP = SGCore_CrBound(); - (*Split)->BoundVolumeP->SetMinMax(&jmin, &jmax); + (*Split)->BoundVolumeP->setMinMax(&jmin, &jmax); fread(&(*Split)->CountAllPoly, sizeof(uint32_t), 1, file); @@ -2647,7 +2652,7 @@ void StaticGeom::SortGroup(float3* viewpos, int sort_mtl) void StaticGeom::GetIntersectedRayY2(float3* pos, Segment** arrsplits, DWORD *count, Segment* comsegment, ID curr_splits_ids_render) { float3 jmin, jmax; - comsegment->BoundVolumeP->GetMinMax(&jmin, &jmax); + comsegment->BoundVolumeP->getMinMax(&jmin, &jmax); if (comsegment->CountAllPoly > 0 && pos->x >= jmin.x && pos->z >= jmin.z && pos->x <= jmax.x && pos->z <= jmax.z) { @@ -2754,7 +2759,7 @@ bool StaticGeom::GetIntersectedRayY(float3* pos) void StaticGeom::GetMinMax(float3* min, float3* max) { - BoundVolume->GetMinMax(min, max); + BoundVolume->getMinMax(min, max); } ID StaticGeom::AddArrForCom() @@ -2861,7 +2866,7 @@ void StaticGeom::GetModelMinMax(ID id, float3* min, float3* max) if (id >= AllModels.size()) return; - AllModels[id]->ArrSplits->BoundVolumeP->GetMinMax(min, max); + AllModels[id]->ArrSplits->BoundVolumeP->getMinMax(min, max); } @@ -2910,9 +2915,9 @@ void StaticGeom::SetModelLodPath(ID id, const char* path) char tmptex[1024]; ID tmpidmat; - for (int i = 0; i < AllModels[id]->Lod0.model->SubsetCount; ++i) + for (int i = 0; i < AllModels[id]->Lod0.model->m_uiSubsetCount; ++i) { - sprintf(tmptex, "%s.dds", AllModels[id]->Lod0.model->ArrTextures[i]); + sprintf(tmptex, "%s.dds", AllModels[id]->Lod0.model->m_ppTextures[i]); tmpidmat = SGCore_MtlLoad(tmptex, MTL_TYPE_GEOM); AllModels[id]->Lod0.IDsTexs.push_back(tmpidmat); AllModels[id]->Lod0.SortGroup = SGCore_MtlGetSort(tmpidmat); @@ -2920,7 +2925,7 @@ void StaticGeom::SetModelLodPath(ID id, const char* path) sprintf(AllModels[id]->Lod0.PathName,"%s",path); - AllModels[id]->Lod0.BoundVolume->CalcBound(AllModels[id]->Lod0.model->VertexBuffer, AllModels[id]->Lod0.model->AllVertexCount, sizeof(vertex_static)); + AllModels[id]->Lod0.BoundVolume->calcBound(AllModels[id]->Lod0.model->m_pVertexBuffer, AllModels[id]->Lod0.model->m_uiAllVertexCount, sizeof(vertex_static)); ApplyTransformLod(id); } @@ -2937,7 +2942,7 @@ void StaticGeom::ApplyTransform(ID id) float3 tmpscale = tmpmodel->Scale / tmpmodel->OldScale; float3 jmin, jmax; - tmpmodel->ArrSplits->BoundVolumeP->GetMinMax(&jmin, &jmax); + tmpmodel->ArrSplits->BoundVolumeP->getMinMax(&jmin, &jmax); float3 jcentererpos = (jmax + jmin)*0.5f; RotationMat = SMMatrixRotationX(tmprot.x) * SMMatrixRotationY(tmprot.y) * SMMatrixRotationZ(tmprot.z); @@ -3015,7 +3020,7 @@ void StaticGeom::ApplyTransform(ID id) while (queue.size()) { - queue[0]->BoundVolumeSys->GetMinMax(&tmpmin, &tmpmax); + queue[0]->BoundVolumeSys->getMinMax(&tmpmin, &tmpmax); tmpmin -= jcentererpos; tmpmax -= jcentererpos; @@ -3024,9 +3029,9 @@ void StaticGeom::ApplyTransform(ID id) tmpmin += jcentererpos; tmpmax += jcentererpos; - queue[0]->BoundVolumeSys->SetMinMax(&tmpmin, &tmpmax); + queue[0]->BoundVolumeSys->setMinMax(&tmpmin, &tmpmax); - queue[0]->BoundVolumeP->GetMinMax(&tmpmin, &tmpmax); + queue[0]->BoundVolumeP->getMinMax(&tmpmin, &tmpmax); tmpmin -= jcentererpos; tmpmax -= jcentererpos; @@ -3035,7 +3040,7 @@ void StaticGeom::ApplyTransform(ID id) tmpmin += jcentererpos; tmpmax += jcentererpos; - queue[0]->BoundVolumeP->SetMinMax(&tmpmin, &tmpmax); + queue[0]->BoundVolumeP->setMinMax(&tmpmin, &tmpmax); if (queue[0]->BFNonEnd) { @@ -3064,12 +3069,12 @@ void StaticGeom::ApplyTransformLod(ID id) vertex_static* pData; float3 jmin, jmax; - AllModels[id]->Lod0.BoundVolume->GetMinMax(&jmin, &jmax); + AllModels[id]->Lod0.BoundVolume->getMinMax(&jmin, &jmax); float3 jcentererpos = (jmax + jmin)*0.5f; - tmpmodel->Lod0.model->VertexBuffer->Lock(0, 0, (void**)&pData, 0); + tmpmodel->Lod0.model->m_pVertexBuffer->Lock(0, 0, (void**)&pData, 0); - for (long i = 0; i < tmpmodel->Lod0.model->AllVertexCount; ++i) + for (long i = 0; i < tmpmodel->Lod0.model->m_uiAllVertexCount; ++i) { pData[i].Pos.x -= jcentererpos.x; pData[i].Pos.y -= jcentererpos.y; @@ -3080,7 +3085,7 @@ void StaticGeom::ApplyTransformLod(ID id) pData[i].Pos.z += jcentererpos.z; } - tmpmodel->Lod0.model->VertexBuffer->Unlock(); + tmpmodel->Lod0.model->m_pVertexBuffer->Unlock(); jmin -= jcentererpos; @@ -3091,7 +3096,7 @@ void StaticGeom::ApplyTransformLod(ID id) jmin += jcentererpos; jmax += jcentererpos; - tmpmodel->Lod0.BoundVolume->SetMinMax(&jmin, &jmax); + tmpmodel->Lod0.BoundVolume->setMinMax(&jmin, &jmax); } void StaticGeom::Clear() @@ -3123,7 +3128,7 @@ void StaticGeom::Clear() CountVertex = 0; float3 jmin(0, 0, 0), jmax(0, 0, 0); - BoundVolume->SetMinMax(&jmin,&jmax); + BoundVolume->setMinMax(&jmin,&jmax); } void StaticGeom::GetArrBuffsGeom(float3_t*** arr_vertex, int32_t** arr_count_vertex, uint32_t*** arr_index, ID*** arr_mtl, int32_t** arr_count_index, int32_t* count_models) @@ -3255,7 +3260,7 @@ void StaticGeom::GetPartBeam(float3* pos, float3 * dir, Segment** arrsplits, DWO { float3 center; float radius; - comsegment->BoundVolumeP->GetSphere(¢er, &radius); + comsegment->BoundVolumeP->getSphere(¢er, &radius); float distsqr = SGCore_0DistancePointBeam2(center, *pos, *dir); if (comsegment->CountAllPoly > 0 && distsqr <= radius*radius) diff --git a/source/geom/static_geom.h b/source/geom/static_geom.h index f8b90a08fbbb33fffce54d619dcd6986d9d5fcf5..a4c1acbc3c3ea4380a4498e794d841210b9f43ca 100644 --- a/source/geom/static_geom.h +++ b/source/geom/static_geom.h @@ -1,31 +1,34 @@ -#ifndef __static_geom -#define __static_geom +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ -#include <common\\string.h> -#include <common\array.h> -#include <gcore\\sxgcore.h> -#include "sxgeom.h" +#ifndef __STATIC_GEOM_H +#define __STATIC_GEOM_H -extern report_func g_fnReportf; +#include <common/string.h> +#include <common/array.h> +#include <gcore/sxgcore.h> +#include "sxgeom.h" #define STATIC_PRECOND_ARRCOMFOR_ERR_ID(id_arr) \ if (!(id_arr < ArrComFor.size()))\ {\ - g_fnReportf(REPORT_MSG_LEVEL_ERROR, "%s - static: unresolved id '%d' for array of compute visible", GEN_MSG_LOCATION, id_arr); \ + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - static: unresolved id '%d' for array of compute visible", GEN_MSG_LOCATION, id_arr); \ } #define STATIC_PRECOND_ARRCOMFOR_ERR_ID_MODEL(id_model, retval) \ if (!(id_model < AllModels.size() && AllModels[id_model]))\ {\ - g_fnReportf(REPORT_MSG_LEVEL_ERROR, "%s - static: unresolved id '%d' for array of models", GEN_MSG_LOCATION, id_model); \ + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - static: unresolved id '%d' for array of models", GEN_MSG_LOCATION, id_model); \ return retval;\ } #define STATIC_PRECOND_ERR_ID_GROUP(id_model,id_group, ret_val) \ if (!(id_model < AllModels.size() && AllModels[id_model] && id_group < AllModels[id_model]->SubSet.size()))\ {\ - g_fnReportf(REPORT_MSG_LEVEL_ERROR, "%s - static: unresolved id '%d' for array of group in model '%d'", GEN_MSG_LOCATION, id_group, id_model); \ + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - static: unresolved id '%d' for array of group in model '%d'", GEN_MSG_LOCATION, id_group, id_model); \ return ret_val; \ } @@ -196,7 +199,7 @@ public: long GetCountModel(); - void CPUFillingArrIndeces(ISXFrustum* frustum, float3* viewpos, ID id_arr = 0); + void CPUFillingArrIndeces(const ISXFrustum* frustum, float3* viewpos, ID id_arr = 0); bool GetIntersectedRayY(float3* pos); bool SortExistsForRender(int sort, ID id_arr = 0); @@ -280,7 +283,7 @@ protected: void EditVolume(Model* mesh, Segment* Split); void SetSplitID(Segment* Split, ID* SplitsIDs, ID* SplitsIDsRender); //установка каждому куску идентификатора, удаление пустых кусков void SetSplitID2(Segment* Split, ID* SplitsIDs, ID* SplitsIDsRender, Array<Segment*>* queue); - void ComRecArrIndeces(ISXFrustum* frustum, Segment** arrsplits, DWORD *count, Segment* comsegment, float3* viewpos, Array<Segment*, GEOM_DEFAULT_RESERVE_COM>* queue, ID curr_splits_ids_render); + void ComRecArrIndeces(const ISXFrustum* frustum, Segment** arrsplits, DWORD *count, Segment* comsegment, float3* viewpos, Array<Segment*, GEOM_DEFAULT_RESERVE_COM>* queue, ID curr_splits_ids_render); //рабочие данные, используются внутри в методах //{{ diff --git a/source/geom/sxgeom.cpp b/source/geom/sxgeom.cpp index 374643837a0d0fd27faf8c0f1b15f44fb8f7c92b..72a2facd12ad736617d1913646a448a7a79ff267 100644 --- a/source/geom/sxgeom.cpp +++ b/source/geom/sxgeom.cpp @@ -1,8 +1,8 @@ -/****************************************************** -Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017 +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 See the license in LICENSE -******************************************************/ +***********************************************************/ #define SXGEOM_VERSION 1 @@ -30,7 +30,7 @@ report_func g_fnReportf = DefReport; StaticGeom* GeometryObj = 0; Green* GreenObj = 0; -#define GEOM_PRECOND(retval) if(!GeometryObj || !GreenObj){g_fnReportf(-1, "%s - sxgeom is not init", GEN_MSG_LOCATION); return retval;} +#define GEOM_PRECOND(retval) if(!GeometryObj || !GreenObj){LibReport(REPORT_MSG_LEVEL_ERROR, "%s - sxgeom is not init", GEN_MSG_LOCATION); return retval;} //########################################################################## @@ -54,7 +54,7 @@ SX_LIB_API void SGeom_0Create(const char *szName, bool isUnic) if (GetLastError() == ERROR_ALREADY_EXISTS) { CloseHandle(hMutex); - g_fnReportf(-1, "%s - none unic name, sxgeom", GEN_MSG_LOCATION); + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - none unic name", GEN_MSG_LOCATION); } else { @@ -73,7 +73,7 @@ SX_LIB_API void SGeom_0Create(const char *szName, bool isUnic) } } else - g_fnReportf(-1, "%s - not init argument [name], sxgeom", GEN_MSG_LOCATION); + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - not init argument [name]", GEN_MSG_LOCATION); } SX_LIB_API void SGeom_AKill() @@ -199,7 +199,7 @@ SX_LIB_API long SGeom_ModelsGetCount() return GeometryObj->GetCountModel(); } -SX_LIB_API void SGeom_ModelsComVisible(ISXFrustum* frustum, float3* viewpos, ID id_arr) +SX_LIB_API void SGeom_ModelsComVisible(const ISXFrustum* frustum, float3* viewpos, ID id_arr) { GEOM_PRECOND(_VOID); GeometryObj->CPUFillingArrIndeces(frustum, viewpos, id_arr); @@ -474,7 +474,7 @@ SX_LIB_API void SGeom_GreenClear() GreenObj->Clear(); } -SX_LIB_API void SGeom_GreenComVisible(ISXFrustum* frustum, float3* viewpos, ID id_arr) +SX_LIB_API void SGeom_GreenComVisible(const ISXFrustum* frustum, float3* viewpos, ID id_arr) { GEOM_PRECOND(_VOID); GreenObj->CPUFillingArrIndeces(frustum, viewpos, id_arr); diff --git a/source/geom/sxgeom.h b/source/geom/sxgeom.h index 9051a914c4eb3916dca57d52229a663dca0dfe32..9da30798cc20fcf6481ef33aa2a78a521687363f 100644 --- a/source/geom/sxgeom.h +++ b/source/geom/sxgeom.h @@ -1,8 +1,8 @@ -/****************************************************** -Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017 +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 See the license in LICENSE -******************************************************/ +***********************************************************/ /*! \file @@ -186,7 +186,7 @@ SX_LIB_API long SGeom_ModelsGetCount(); //! просчитать видимость всех моделей для фрустума SX_LIB_API void SGeom_ModelsComVisible( - ISXFrustum *pFrustum, //!< фрустум для которого считаем видимость моделей + const ISXFrustum *pFrustum, //!< фрустум для которого считаем видимость моделей float3 *vViewPos, //!< позиция источника фрустума чтобы просчитать дистанцию ID idArr = 0 //!< идентификатор массива информации о видимости для фрустума, создается через #SGeom_ModelsAddArrForCom, если 0 то считаем в дефолтный ); @@ -526,7 +526,7 @@ SX_LIB_API void SGeom_GreenClear(); //! просчитать видимость всей растительности для фрустума SX_LIB_API void SGeom_GreenComVisible( - ISXFrustum *pFrustum, //!< фрустум для которого считаем видимость моделей + const ISXFrustum *pFrustum, //!< фрустум для которого считаем видимость моделей float3 *pViewPos, //!< позиция источника фрустума чтобы просчитать дистанцию ID idArr = 0 //!< идентификатор массива информации о видимости для фрустума, создается через #SGeom_ModelsAddArrForCom, если 0 то считаем в дефолтный ); diff --git a/source/geom/sxgeom_dll.cpp b/source/geom/sxgeom_dll.cpp index 4030f098dc11f4148f9560ae3dab3262d8a90e3f..88b1ec58eac1f5e48ba53b6f764552b3f797850d 100644 --- a/source/geom/sxgeom_dll.cpp +++ b/source/geom/sxgeom_dll.cpp @@ -1,10 +1,9 @@ -/****************************************************** -Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017 +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 See the license in LICENSE -******************************************************/ +***********************************************************/ -#pragma once #include <windows.h> BOOL APIENTRY DllMain(HMODULE hModule, diff --git a/source/input/input.cpp b/source/input/input.cpp index 6632d46a4d1161c84c79d13bcba3608a6a8edb4d..cadca3fa0f0bcd82193cced3446c9d06a6579cb6 100644 --- a/source/input/input.cpp +++ b/source/input/input.cpp @@ -1,4 +1,9 @@ +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include "sxinput.h" #include "input.h" @@ -10,10 +15,6 @@ # pragma comment(lib, "sxcore.lib") #endif -#pragma once - -extern report_func g_fnReportf; - SXInput::SXInput(const char* name): mdelta({0, 0}), mdeltaOld({0, 0}) @@ -35,7 +36,7 @@ long SXInput::Init(HWND hwnd) if(RegisterRawInputDevices(Rid, sizeof(Rid) / sizeof(RAWINPUTDEVICE), sizeof(Rid[0])) == FALSE) { - g_fnReportf(REPORT_MSG_LEVEL_ERROR, "Registering RAW Input failed"); + LibReport(REPORT_MSG_LEVEL_ERROR, "Registering RAW Input failed"); return(-1); } #endif diff --git a/source/input/input.h b/source/input/input.h index aa1256f3f32ab7730fdaa7bdbe4e47c11c9ee84b..54b13bafeb430efb8f0c74b882716fba5f697782 100644 --- a/source/input/input.h +++ b/source/input/input.h @@ -1,6 +1,11 @@ -#ifndef SX_INPUT_CLASS_H -#define SX_INPUT_CLASS_H +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + +#ifndef __INPUT_H +#define __INPUT_H #include <queue> diff --git a/source/input/sxinput.cpp b/source/input/sxinput.cpp index 58c643aea4fe296d1d3d17c1210394ba149e31c2..b5477ce9e08c8c2d2b64469a50b4c8a1bffb6a5b 100644 --- a/source/input/sxinput.cpp +++ b/source/input/sxinput.cpp @@ -1,8 +1,8 @@ -/****************************************************** -Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017 +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 See the license in LICENSE -******************************************************/ +***********************************************************/ #include "sxinput.h" #include "input.h" @@ -19,7 +19,7 @@ SXInput* ObjectInput = 0; report_func g_fnReportf = DefReport; #endif -#define SI_PRECOND(retval) if(!ObjectInput){g_fnReportf(-1, "%s - sxinput is not init", GEN_MSG_LOCATION); return retval;} +#define SI_PRECOND(retval) if(!ObjectInput){LibReport(REPORT_MSG_LEVEL_ERROR, "%s - sxinput is not init", GEN_MSG_LOCATION); return retval;} //########################################################################## @@ -64,14 +64,14 @@ SX_LIB_API void SSInput_0Create(const char* name, HWND hwnd, bool is_unic) if(GetLastError() == ERROR_ALREADY_EXISTS) { CloseHandle(hMutex); - g_fnReportf(-1, "%s - none unic name for system input", GEN_MSG_LOCATION); + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - none unic name for system input", GEN_MSG_LOCATION); return; } } InitIntup(name, hwnd); } else - g_fnReportf(-1, "%s - not init argument [name] for system sound", GEN_MSG_LOCATION); + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - not init argument [name] for system input", GEN_MSG_LOCATION); } SX_LIB_API void SSInput_Update() diff --git a/source/input/sxinput.h b/source/input/sxinput.h index 9f86b26b356a7ed90d9f3e3608d645599d179bff..67e7d5c135701d5cf328d5335938dbaff6d23b36 100644 --- a/source/input/sxinput.h +++ b/source/input/sxinput.h @@ -1,8 +1,8 @@ -/****************************************************** -Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017 +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 See the license in LICENSE -******************************************************/ +***********************************************************/ /*! \file diff --git a/source/input/sxinput_dll.cpp b/source/input/sxinput_dll.cpp index 6bd158387722b85c5b9afe649b389ced8f304f3f..88b1ec58eac1f5e48ba53b6f764552b3f797850d 100644 --- a/source/input/sxinput_dll.cpp +++ b/source/input/sxinput_dll.cpp @@ -1,8 +1,8 @@ -/****************************************************** -Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017 +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 See the license in LICENSE -******************************************************/ +***********************************************************/ #include <windows.h> diff --git a/source/level/AmbientSounds.cpp b/source/level/AmbientSounds.cpp index 23660b1bdae1ca2f6f625cbe60787cf495d61412..3932a81b637e77bec9283218279e6d921a5acabe 100644 --- a/source/level/AmbientSounds.cpp +++ b/source/level/AmbientSounds.cpp @@ -1,4 +1,9 @@ +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include "AmbientSounds.h" CAmbientSounds::CAmbientSounds() diff --git a/source/level/AmbientSounds.h b/source/level/AmbientSounds.h index 3180378f394cf838a5edae7776c23ea36699ccc6..eca3ee5da1783381a5b4003b3e74ba30f0fbe211 100644 --- a/source/level/AmbientSounds.h +++ b/source/level/AmbientSounds.h @@ -1,4 +1,9 @@ +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #ifndef __AMBIENTSOUNDS_H #define __AMBIENTSOUNDS_H diff --git a/source/level/Weather.h b/source/level/Weather.h index 419fb5d03457a4053b938fe6d62e5bce7ce8d981..21b67b23f5198daeb384cf064a4a9ddc09648a4e 100644 --- a/source/level/Weather.h +++ b/source/level/Weather.h @@ -1,4 +1,9 @@ +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #ifndef __WEATHER_H #define __WEATHER_H @@ -20,8 +25,6 @@ #define WEATHER_THUNDERBOLT_LENGTH 10.f /*!< длина возможного пространства для молнии */ #define WEATHER_THUNDERBOLT_HEIGHT 100.f /*!< высота возможного пространства для молнии */ -extern report_func g_fnReportf; - //рандомные звуки с class CWeatherRndSnd { @@ -69,10 +72,10 @@ protected: #define WEATHER_CONFIG_SECTION_KEY(name_key, key, file, section) \ { \ if (!name_key || strlen(name_key) != 2 || !isdigit(name_key[0]) || !isdigit(name_key[1])) \ - g_fnReportf(REPORT_MSG_LEVEL_ERROR, "%s - unresolved name of key '%s' \nfile '%s' \nsection '%s'", GEN_MSG_LOCATION, key, file, section); \ + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - unresolved name of key '%s' \nfile '%s' \nsection '%s'", GEN_MSG_LOCATION, key, file, section); \ } -#define WEATHER_CONFIG_LACKS_COMPONENT(component, file, section, key) if(!component) {g_fnReportf(REPORT_MSG_LEVEL_ERROR,"%s - lacks component in key '%s' \nfile '%s' \nsection '%s'",GEN_MSG_LOCATION, key, file, section);} -#define WEATHER_CONFIG_LACKS_KEY(key, file, section) {g_fnReportf(REPORT_MSG_LEVEL_ERROR,"%s - lacks key '%s' \nfile '%s' \nsection '%s'",GEN_MSG_LOCATION, key, file, section);} +#define WEATHER_CONFIG_LACKS_COMPONENT(component, file, section, key) if(!component) {LibReport(REPORT_MSG_LEVEL_ERROR,"%s - lacks component in key '%s' \nfile '%s' \nsection '%s'",GEN_MSG_LOCATION, key, file, section);} +#define WEATHER_CONFIG_LACKS_KEY(key, file, section) {LibReport(REPORT_MSG_LEVEL_ERROR,"%s - lacks key '%s' \nfile '%s' \nsection '%s'",GEN_MSG_LOCATION, key, file, section);} class CWeather { diff --git a/source/level/level.cpp b/source/level/level.cpp index 63a8d8d7b92b48bc4f197e85bfe6ffb9b4f58b02..c124f1a32d9e4fb95b6872c295812a6a0c44ae5f 100644 --- a/source/level/level.cpp +++ b/source/level/level.cpp @@ -1,4 +1,9 @@ +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include "level.h" CLevel::CLevel() @@ -43,7 +48,7 @@ void CLevel::load(const char *szName, bool isGame) sprintf(tmppathlevel, "%s%s/%s.lvl", Core_RStringGet(G_RI_STRING_PATH_GS_LEVELS), szName, szName); if (!Core_0FileExists(tmppathlevel)) { - g_fnReportf(REPORT_MSG_LEVEL_WARNING, "not found file of level '%s'", tmppathlevel); + LibReport(REPORT_MSG_LEVEL_WARNING, "not found file of level '%s'", tmppathlevel); return; } @@ -56,7 +61,7 @@ void CLevel::load(const char *szName, bool isGame) SGeom_ModelsLoad(tmppath); else { - g_fnReportf(REPORT_MSG_LEVEL_WARNING, "not found file of geometry '%s'", tmppath); + LibReport(REPORT_MSG_LEVEL_WARNING, "not found file of geometry '%s'", tmppath); } } @@ -68,7 +73,7 @@ void CLevel::load(const char *szName, bool isGame) SGeom_GreenLoad(tmppath); else { - g_fnReportf(REPORT_MSG_LEVEL_WARNING, "not found file of green '%s'", tmppath); + LibReport(REPORT_MSG_LEVEL_WARNING, "not found file of green '%s'", tmppath); } } @@ -80,7 +85,7 @@ void CLevel::load(const char *szName, bool isGame) SXGame_LoadEnts(tmppath); else { - g_fnReportf(REPORT_MSG_LEVEL_WARNING, "not found file of entity '%s'", tmppath); + LibReport(REPORT_MSG_LEVEL_WARNING, "not found file of entity '%s'", tmppath); } } @@ -115,7 +120,7 @@ void CLevel::load(const char *szName, bool isGame) SAIG_GridLoad(tmppath); else { - g_fnReportf(REPORT_MSG_LEVEL_WARNING, "not found file of aigrid '%s'", tmppath); + LibReport(REPORT_MSG_LEVEL_WARNING, "not found file of aigrid '%s'", tmppath); } } @@ -155,7 +160,7 @@ void CLevel::load(const char *szName, bool isGame) m_pWeather->load(tmppath); else { - g_fnReportf(REPORT_MSG_LEVEL_WARNING, "not found file of weather '%s'", tmppath); + LibReport(REPORT_MSG_LEVEL_WARNING, "not found file of weather '%s'", tmppath); } } } diff --git a/source/level/level.h b/source/level/level.h index d453fd5e75b77531d4572cb710dbf4aeac21036b..f17c3205896df7f2c9bbc460a565fef9303a392f 100644 --- a/source/level/level.h +++ b/source/level/level.h @@ -1,8 +1,8 @@ -/****************************************************** -Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017 +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 See the license in LICENSE -******************************************************/ +***********************************************************/ /*! \file diff --git a/source/level/sxlevel.cpp b/source/level/sxlevel.cpp index b275fc23720428b80a4611d8fc84752b2c8c02ad..cf33f8559b69336b1441b7c0291029fa5bc388df 100644 --- a/source/level/sxlevel.cpp +++ b/source/level/sxlevel.cpp @@ -1,4 +1,9 @@ +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #define SXLEVEL_VERSION 1 #include "sxlevel.h" @@ -14,7 +19,7 @@ report_func g_fnReportf = DefReport; CLevel* g_pLevel = 0; -#define SL_PRECOND(ret) if(!g_pLevel){g_fnReportf(-1, "%s - sxlevel is not init", GEN_MSG_LOCATION);return ret;} +#define SL_PRECOND(ret) if(!g_pLevel){LibReport(REPORT_MSG_LEVEL_ERROR, "%s - sxlevel is not init", GEN_MSG_LOCATION);return ret;} //########################################################################## @@ -38,7 +43,7 @@ SX_LIB_API void SLevel_0Create(const char *szName, bool isUnic) if (GetLastError() == ERROR_ALREADY_EXISTS) { CloseHandle(hMutex); - g_fnReportf(-1, "%s - none unic name, sxlevel", GEN_MSG_LOCATION); + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - none unic name", GEN_MSG_LOCATION); } else { @@ -51,7 +56,7 @@ SX_LIB_API void SLevel_0Create(const char *szName, bool isUnic) } } else - g_fnReportf(-1, "%s - not init argument [name], sxlevel", GEN_MSG_LOCATION); + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - not init argument [name]", GEN_MSG_LOCATION); } SX_LIB_API void SLevel_AKill() diff --git a/source/level/sxlevel.h b/source/level/sxlevel.h index e0f5baeb6d906f3d7a49d4912d5fb7c5ae7b4a8f..82918d98b1470f76ac8bac074fdfec6deb4473e1 100644 --- a/source/level/sxlevel.h +++ b/source/level/sxlevel.h @@ -1,8 +1,8 @@ -/****************************************************** -Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017 +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 See the license in LICENSE -******************************************************/ +***********************************************************/ /*! \file diff --git a/source/level/sxlevel_dll.cpp b/source/level/sxlevel_dll.cpp index ddaaf5bd40e128dad244fe2d2b45078b0beaf675..a34ff74f606bdc80ad683796dbf5ca09502303a5 100644 --- a/source/level/sxlevel_dll.cpp +++ b/source/level/sxlevel_dll.cpp @@ -1,8 +1,8 @@ -/****************************************************** -Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017 +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 See the license in LICENSE -******************************************************/ +***********************************************************/ #include <windows.h> diff --git a/source/level/weather.cpp b/source/level/weather.cpp index 79a888466b140742cfd8a126fc1137b2cf3000ac..85bd30871b6469a51c7b4ec7aa06a8dec843e92a 100644 --- a/source/level/weather.cpp +++ b/source/level/weather.cpp @@ -1,4 +1,9 @@ +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include "Weather.h" CWeatherRndSnd::CWeatherRndSnd() @@ -159,13 +164,13 @@ CWeather::CWeather() } else { - g_fnReportf(REPORT_MSG_LEVEL_ERROR, "%s - not found effect 'rain'", GEN_MSG_LOCATION); + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - not found effect 'rain'", GEN_MSG_LOCATION); } m_idEffThunderbolt = SPE_EffectGetByName("thunderbolt"); if (m_idEffThunderbolt < 0) { - g_fnReportf(REPORT_MSG_LEVEL_ERROR, "%s - not found effect 'thunderbolt'", GEN_MSG_LOCATION); + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - not found effect 'thunderbolt'", GEN_MSG_LOCATION); } m_ulTimeBoltNext = m_ulTimeBoltLast = 0; @@ -225,7 +230,7 @@ void CWeather::load(const char *szPath) if (!config->sectionExists("sections")) { - g_fnReportf(REPORT_MSG_LEVEL_ERROR, "%s - not found section 'sections' \nfile '%s'", GEN_MSG_LOCATION, szPath); + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - not found section 'sections' \nfile '%s'", GEN_MSG_LOCATION, szPath); mem_release_del(config); return; } @@ -239,7 +244,7 @@ void CWeather::load(const char *szPath) if (strlen(str) != 8) { - g_fnReportf(REPORT_MSG_LEVEL_ERROR, "%s - unresolved name of key '%s' \nfile '%s' \nsection '%s'", GEN_MSG_LOCATION, str, szPath, "sections"); + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - unresolved name of key '%s' \nfile '%s' \nsection '%s'", GEN_MSG_LOCATION, str, szPath, "sections"); mem_release_del(config); return; } @@ -282,7 +287,7 @@ void CWeather::load(const char *szPath) for (int i = 0, il = m_aTimeSections.size(); i < il; ++i) { - //g_fnReportf(0, "%d\n", m_aTimeSections[i].time); + //LibReport(0, "%d\n", m_aTimeSections[i].time); if (config->keyExists(m_aTimeSections[i].m_szSection, "sky_texture")) sprintf(m_aTimeSections[i].m_DataSection.m_szSkyTex, "%s", config->getKey(m_aTimeSections[i].m_szSection, "sky_texture")); @@ -487,7 +492,7 @@ void CWeather::load(const char *szPath) if (!config->sectionExists(text_env)) { - g_fnReportf(REPORT_MSG_LEVEL_ERROR, "%s - lacks env_ambient section '%s' \nszPath '%s' \nsection '%s'", GEN_MSG_LOCATION, text_env, szPath, m_aTimeSections[i].m_szSection); + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - lacks env_ambient section '%s' \nszPath '%s' \nsection '%s'", GEN_MSG_LOCATION, text_env, szPath, m_aTimeSections[i].m_szSection); return; } @@ -744,7 +749,7 @@ void CWeather::update() tmp_fog_color2->z = lerpf(m_aTimeSections[m_iSectionOld].m_DataSection.m_vFogColor.z, m_aTimeSections[m_iSectionCurr].m_DataSection.m_vFogColor.z, lerp_factor); } else - g_fnReportf(REPORT_MSG_LEVEL_WARNING, "cvar pp_fog_color is not init"); + LibReport(REPORT_MSG_LEVEL_WARNING, "cvar pp_fog_color is not init"); } //если в текущей секции есть частота молнии diff --git a/source/mtllight/light.cpp b/source/mtllight/light.cpp index 6d338cd88ec7250c6f936cbdd1ff63853feef9de..74b59a158471d51923b2e5c3caab522410921c91 100644 --- a/source/mtllight/light.cpp +++ b/source/mtllight/light.cpp @@ -1,4 +1,9 @@ +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include "light.h" Lights::Lights() @@ -39,7 +44,7 @@ ID Lights::CreateCopy(ID id) tmplight2->BoundVolume = SGCore_CrBound(); IDirect3DVertexBuffer9* vertexbuf; tmplight->Mesh->GetVertexBuffer(&vertexbuf); - tmplight->BoundVolume->CalcBound(vertexbuf, tmplight->Mesh->GetNumVertices(), tmplight->Mesh->GetNumBytesPerVertex()); + tmplight->BoundVolume->calcBound(vertexbuf, tmplight->Mesh->GetNumVertices(), tmplight->Mesh->GetNumBytesPerVertex()); mem_release(vertexbuf); tmplight2->Power = tmplight->Power; tmplight2->Dist = tmplight->Dist; @@ -288,7 +293,7 @@ ID Lights::CreatePoint(ID id, const float3* center, float dist, const float3* co { if (GlobalLight != -1 && isglobal) { - g_fnReportf(REPORT_MSG_LEVEL_ERROR, "%s - light: global light exists, you can not create 2 global light sources", GEN_MSG_LOCATION); + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - light: global light exists, you can not create 2 global light sources", GEN_MSG_LOCATION); return -1; } @@ -357,7 +362,7 @@ ID Lights::CreatePoint(ID id, const float3* center, float dist, const float3* co tmplight->BoundVolume = SGCore_CrBound(); IDirect3DVertexBuffer9* vertexbuf; tmplight->Mesh->GetVertexBuffer(&vertexbuf); - tmplight->BoundVolume->CalcBound(vertexbuf, tmplight->Mesh->GetNumVertices(), tmplight->Mesh->GetNumBytesPerVertex()); + tmplight->BoundVolume->calcBound(vertexbuf, tmplight->Mesh->GetNumVertices(), tmplight->Mesh->GetNumBytesPerVertex()); mem_release(vertexbuf); if (tmplight->IsGlobal) @@ -425,7 +430,7 @@ ID Lights::CreateDirection(ID id, const float3* pos, float dist, const float3* c tmplight->BoundVolume = SGCore_CrBound(); IDirect3DVertexBuffer9* vertexbuf; tmplight->Mesh->GetVertexBuffer(&vertexbuf); - tmplight->BoundVolume->CalcBound(vertexbuf, tmplight->Mesh->GetNumVertices(), tmplight->Mesh->GetNumBytesPerVertex()); + tmplight->BoundVolume->calcBound(vertexbuf, tmplight->Mesh->GetNumVertices(), tmplight->Mesh->GetNumBytesPerVertex()); mem_release(vertexbuf); ID tmpid = id; @@ -548,7 +553,7 @@ void Lights::SetLightDist(ID id, float radius_height, bool is_create) { IDirect3DVertexBuffer9* vertexbuf; ArrLights[id]->Mesh->GetVertexBuffer(&vertexbuf); - ArrLights[id]->BoundVolume->CalcBound(vertexbuf, ArrLights[id]->Mesh->GetNumVertices(), ArrLights[id]->Mesh->GetNumBytesPerVertex()); + ArrLights[id]->BoundVolume->calcBound(vertexbuf, ArrLights[id]->Mesh->GetNumVertices(), ArrLights[id]->Mesh->GetNumBytesPerVertex()); mem_release_del(vertexbuf); } @@ -675,10 +680,10 @@ bool Lights::ComVisibleForFrustum(ID id, const ISXFrustum* frustum) float3 tmpcenter; float tmpradius; - ArrLights[id]->BoundVolume->GetSphere(&tmpcenter, &tmpradius); + ArrLights[id]->BoundVolume->getSphere(&tmpcenter, &tmpradius); tmpcenter = SMVector3Transform(tmpcenter, ArrLights[id]->WorldMat); - return frustum->SphereInFrustum(&tmpcenter, tmpradius); + return frustum->sphereInFrustum(&tmpcenter, tmpradius); } bool Lights::GetVisibleForFrustum(ID id) @@ -955,7 +960,7 @@ void Lights::SetLightAngle(ID id, float angle, bool is_create) { IDirect3DVertexBuffer9* vertexbuf; ArrLights[id]->Mesh->GetVertexBuffer(&vertexbuf); - ArrLights[id]->BoundVolume->CalcBound(vertexbuf, ArrLights[id]->Mesh->GetNumVertices(), ArrLights[id]->Mesh->GetNumBytesPerVertex()); + ArrLights[id]->BoundVolume->calcBound(vertexbuf, ArrLights[id]->Mesh->GetNumVertices(), ArrLights[id]->Mesh->GetNumBytesPerVertex()); mem_release(vertexbuf); } @@ -980,7 +985,7 @@ void Lights::SetLightTopRadius(ID id, float top_radius) { IDirect3DVertexBuffer9* vertexbuf; ArrLights[id]->Mesh->GetVertexBuffer(&vertexbuf); - ArrLights[id]->BoundVolume->CalcBound(vertexbuf, ArrLights[id]->Mesh->GetNumVertices(), ArrLights[id]->Mesh->GetNumBytesPerVertex()); + ArrLights[id]->BoundVolume->calcBound(vertexbuf, ArrLights[id]->Mesh->GetNumVertices(), ArrLights[id]->Mesh->GetNumBytesPerVertex()); mem_release_del(vertexbuf); } @@ -1227,7 +1232,7 @@ bool Lights::LightCountUpdateUpdate(ID id, const float3* viewpos, int ghow) float3 tmpcenter; float tmpradius; - tmpl->BoundVolume->GetSphere(&tmpcenter, &tmpradius); + tmpl->BoundVolume->getSphere(&tmpcenter, &tmpradius); float dist = SMVector3Distance(tmpl->Position, (*viewpos)) - tmpradius; if (dist < LIGHTS_UPDATE_L0_DIST) tmpl->CountUpdate = -1; diff --git a/source/mtllight/light.h b/source/mtllight/light.h index e09a8f1fe6cf485e661fc7c046cd0043a94924a2..406ad080b3d8cd1f1e027d75838cbf496474ce38 100644 --- a/source/mtllight/light.h +++ b/source/mtllight/light.h @@ -1,6 +1,11 @@ -#ifndef __light_h -#define __light_h +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + +#ifndef __LIGHT_H +#define __LIGHT_H #include <gdefines.h> @@ -12,17 +17,16 @@ #include "sxmtllight.h" #include "ml_data.h" -extern report_func g_fnReportf; #define LIGHTS_PRE_COND_ID(id,stdval) \ if (!(id >= 0 && id < ArrLights.size()))\ -{g_fnReportf(REPORT_MSG_LEVEL_ERROR, "%s - light: unresolved index of access '%d'", GEN_MSG_LOCATION, id); return stdval; }\ +{LibReport(REPORT_MSG_LEVEL_ERROR, "%s - light: unresolved index of access '%d'", GEN_MSG_LOCATION, id); return stdval; }\ else if (!ArrLights[id]) \ -{g_fnReportf(REPORT_MSG_LEVEL_ERROR, "%s - light: light is deleted '%d'", GEN_MSG_LOCATION, id); return stdval; } +{LibReport(REPORT_MSG_LEVEL_ERROR, "%s - light: light is deleted '%d'", GEN_MSG_LOCATION, id); return stdval; } #define LIGHTS_PRE_COND_KEY_DEL(key,stdval) \ if (!(key >= 0 && key < ArrDelLights.size()))\ -{g_fnReportf(REPORT_MSG_LEVEL_ERROR, "%s - light: unresolved key of access '%d'", GEN_MSG_LOCATION, key); return stdval; } +{LibReport(REPORT_MSG_LEVEL_ERROR, "%s - light: unresolved key of access '%d'", GEN_MSG_LOCATION, key); return stdval; } #include "shadow.h" //#include <common\\string.cpp> diff --git a/source/mtllight/material.cpp b/source/mtllight/material.cpp index b034400935d121dde89106fcde1afae9596632f1..22b28f6daadf2065374ce70b9eb31fe033ae46cf 100644 --- a/source/mtllight/material.cpp +++ b/source/mtllight/material.cpp @@ -1,4 +1,9 @@ +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include "material.h" Materials::Materials() @@ -546,7 +551,7 @@ MTLTYPE_PHYSIC Materials::MtlGetPhysicMaterial(ID id) void Materials::MtlSetTexture(ID id, const char* path_tex) { MTL_PRE_COND_ID(id); - ArrMaterials[id]->mtl->MainTexture = SGCore_LoadTexAddName(path_tex, LoadTexType::ltt_load); + ArrMaterials[id]->mtl->MainTexture = SGCore_LoadTexAddName(path_tex, LOAD_TEXTURE_TYPE_LOAD); } void Materials::MtlGetTexture(ID id, char* name) @@ -620,7 +625,7 @@ bool Materials::MtlGetIsTextureLighting(ID id) void Materials::MtlSetTextureLighting(ID id, const char* path_tex) { MTL_PRE_COND_ID(id); - ArrMaterials[id]->mtl->LightParam.ParamTex = SGCore_LoadTexAddName(path_tex, LoadTexType::ltt_load); + ArrMaterials[id]->mtl->LightParam.ParamTex = SGCore_LoadTexAddName(path_tex, LOAD_TEXTURE_TYPE_LOAD); } void Materials::MtlGetTextureLighting(ID id, char* path_tex) @@ -753,7 +758,7 @@ MTLTYPE_REFLECT Materials::MtlGetTypeReflection(ID id) void Materials::MtlSetMaskTex(ID id, const char* path_tex) { MTL_PRE_COND_ID(id); - ArrMaterials[id]->mtl->MicroDetail.Mask = SGCore_LoadTexAddName(path_tex, LoadTexType::ltt_load); + ArrMaterials[id]->mtl->MicroDetail.Mask = SGCore_LoadTexAddName(path_tex, LOAD_TEXTURE_TYPE_LOAD); } void Materials::MtlGetMaskTex(ID id, char* path_tex) @@ -768,7 +773,7 @@ void Materials::MtlGetMaskTex(ID id, char* path_tex) void Materials::MtlSetMRTex(ID id, int channel, const char* path_tex) { MTL_PRE_COND_ID(id); - ArrMaterials[id]->mtl->MicroDetail.ArrMicroDiffuse[channel] = SGCore_LoadTexAddName(path_tex, LoadTexType::ltt_load); + ArrMaterials[id]->mtl->MicroDetail.ArrMicroDiffuse[channel] = SGCore_LoadTexAddName(path_tex, LOAD_TEXTURE_TYPE_LOAD); } void Materials::MtlGetMRTex(ID id, int channel, char* path_tex) @@ -784,7 +789,7 @@ void Materials::MtlGetMRTex(ID id, int channel, char* path_tex) void Materials::MtlSetDTex(ID id, int channel, const char* path_tex) { MTL_PRE_COND_ID(id); - ArrMaterials[id]->mtl->MicroDetail.ArrDeatail[channel] = SGCore_LoadTexAddName(path_tex, LoadTexType::ltt_load); + ArrMaterials[id]->mtl->MicroDetail.ArrDeatail[channel] = SGCore_LoadTexAddName(path_tex, LOAD_TEXTURE_TYPE_LOAD); } void Materials::MtlGetDTex(ID id, int channel, char* path_tex) @@ -980,7 +985,7 @@ ID Materials::IsExists(const char* name) if (!IsTruePath) { return -2; - //reportf(-1, "%s - wrong texture name [%s]!!!", gen_msg_location, name); + //LibReport(REPORT_MSG_LEVEL_ERROR, "%s - wrong texture name [%s]!!!", gen_msg_location, name); } long tmpkey = -1; //переменная в которой храним ключ от массива в который записываем @@ -1148,9 +1153,9 @@ bool Materials::LoadMtl(const char* name, Material** mtl) //если в конфиге указана текстура то берем ее if (config->keyExists(tmp_name, "texture")) - tmpMtl->MainTexture = SGCore_LoadTexAddName(config->getKey(tmp_name, "texture"), LoadTexType::ltt_load); + tmpMtl->MainTexture = SGCore_LoadTexAddName(config->getKey(tmp_name, "texture"), LOAD_TEXTURE_TYPE_LOAD); else //если нет то тогда берем имя материала, может быть он имя текстуры, иначе будет -1 - tmpMtl->MainTexture = SGCore_LoadTexAddName(name, LoadTexType::ltt_load); + tmpMtl->MainTexture = SGCore_LoadTexAddName(name, LOAD_TEXTURE_TYPE_LOAD); sprintf(tmpMtl->Name, "%s", tmp_name); @@ -1194,7 +1199,7 @@ bool Materials::LoadMtl(const char* name, Material** mtl) sprintf(tmpMicroDiff[0], "%s", config->getKey(tmp_name, "mirco_diff_r")); if (tmpMicroDiff[0][0] != '0' && tmpMicroDiff[0][0] != 0) - tmpMtl->MicroDetail.ArrMicroDiffuse[0] = SGCore_LoadTexAddName(tmpMicroDiff[0], LoadTexType::ltt_load); + tmpMtl->MicroDetail.ArrMicroDiffuse[0] = SGCore_LoadTexAddName(tmpMicroDiff[0], LOAD_TEXTURE_TYPE_LOAD); else tmpMtl->MicroDetail.ArrMicroDiffuse[0] = -1; @@ -1202,7 +1207,7 @@ bool Materials::LoadMtl(const char* name, Material** mtl) if (config->keyExists(tmp_name, "mirco_diff_g")) sprintf(tmpMicroDiff[1], "%s", config->getKey(tmp_name, "mirco_diff_g")); if (tmpMicroDiff[1][0] != '0' && tmpMicroDiff[1][0] != 0) - tmpMtl->MicroDetail.ArrMicroDiffuse[1] = SGCore_LoadTexAddName(tmpMicroDiff[1], LoadTexType::ltt_load); + tmpMtl->MicroDetail.ArrMicroDiffuse[1] = SGCore_LoadTexAddName(tmpMicroDiff[1], LOAD_TEXTURE_TYPE_LOAD); else tmpMtl->MicroDetail.ArrMicroDiffuse[1] = -1; @@ -1210,7 +1215,7 @@ bool Materials::LoadMtl(const char* name, Material** mtl) if (config->keyExists(tmp_name, "mirco_diff_b")) sprintf(tmpMicroDiff[2], "%s", config->getKey(tmp_name, "mirco_diff_b")); if (tmpMicroDiff[2][0] != '0' && tmpMicroDiff[2][0] != 0) - tmpMtl->MicroDetail.ArrMicroDiffuse[2] = SGCore_LoadTexAddName(tmpMicroDiff[2], LoadTexType::ltt_load); + tmpMtl->MicroDetail.ArrMicroDiffuse[2] = SGCore_LoadTexAddName(tmpMicroDiff[2], LOAD_TEXTURE_TYPE_LOAD); else tmpMtl->MicroDetail.ArrMicroDiffuse[2] = -1; @@ -1218,7 +1223,7 @@ bool Materials::LoadMtl(const char* name, Material** mtl) if (config->keyExists(tmp_name, "mirco_diff_a")) sprintf(tmpMicroDiff[3], "%s", config->getKey(tmp_name, "mirco_diff_a")); if (tmpMicroDiff[3][0] != '0' && tmpMicroDiff[3][0] != 0) - tmpMtl->MicroDetail.ArrMicroDiffuse[3] = SGCore_LoadTexAddName(tmpMicroDiff[3], LoadTexType::ltt_load); + tmpMtl->MicroDetail.ArrMicroDiffuse[3] = SGCore_LoadTexAddName(tmpMicroDiff[3], LOAD_TEXTURE_TYPE_LOAD); else tmpMtl->MicroDetail.ArrMicroDiffuse[3] = -1; @@ -1227,7 +1232,7 @@ bool Materials::LoadMtl(const char* name, Material** mtl) if (config->keyExists(tmp_name, "detail_r")) sprintf(tmpDetail[0], "%s", config->getKey(tmp_name, "detail_r")); if (tmpDetail[0][0] != '0' && tmpMicroDiff[0][0] != 0) - tmpMtl->MicroDetail.ArrDeatail[0] = SGCore_LoadTexAddName(tmpDetail[0], LoadTexType::ltt_load); + tmpMtl->MicroDetail.ArrDeatail[0] = SGCore_LoadTexAddName(tmpDetail[0], LOAD_TEXTURE_TYPE_LOAD); else tmpMtl->MicroDetail.ArrDeatail[0] = -1; @@ -1235,7 +1240,7 @@ bool Materials::LoadMtl(const char* name, Material** mtl) if (config->keyExists(tmp_name, "detail_g")) sprintf(tmpDetail[1], "%s", config->getKey(tmp_name, "detail_g")); if (tmpDetail[1][0] != '0' && tmpMicroDiff[1][0] != 0) - tmpMtl->MicroDetail.ArrDeatail[1] = SGCore_LoadTexAddName(tmpDetail[1], LoadTexType::ltt_load); + tmpMtl->MicroDetail.ArrDeatail[1] = SGCore_LoadTexAddName(tmpDetail[1], LOAD_TEXTURE_TYPE_LOAD); else tmpMtl->MicroDetail.ArrDeatail[1] = -1; @@ -1243,7 +1248,7 @@ bool Materials::LoadMtl(const char* name, Material** mtl) if (config->keyExists(tmp_name, "detail_b")) sprintf(tmpDetail[2], "%s", config->getKey(tmp_name, "detail_b")); if (tmpDetail[2][0] != '0' && tmpMicroDiff[2][0] != 0) - tmpMtl->MicroDetail.ArrDeatail[2] = SGCore_LoadTexAddName(tmpDetail[2], LoadTexType::ltt_load); + tmpMtl->MicroDetail.ArrDeatail[2] = SGCore_LoadTexAddName(tmpDetail[2], LOAD_TEXTURE_TYPE_LOAD); else tmpMtl->MicroDetail.ArrDeatail[2] = -1; @@ -1251,7 +1256,7 @@ bool Materials::LoadMtl(const char* name, Material** mtl) if (config->keyExists(tmp_name, "detail_a")) sprintf(tmpDetail[3], "%s", config->getKey(tmp_name, "detail_a")); if (tmpDetail[3][0] != '0' && tmpMicroDiff[3][0] != 0) - tmpMtl->MicroDetail.ArrDeatail[3] = SGCore_LoadTexAddName(tmpDetail[3], LoadTexType::ltt_load); + tmpMtl->MicroDetail.ArrDeatail[3] = SGCore_LoadTexAddName(tmpDetail[3], LOAD_TEXTURE_TYPE_LOAD); else tmpMtl->MicroDetail.ArrDeatail[3] = -1; @@ -1259,7 +1264,7 @@ bool Materials::LoadMtl(const char* name, Material** mtl) if (config->keyExists(tmp_name, "mask")) sprintf(tmpMask, "%s", config->getKey(tmp_name, "mask")); if (tmpMask[0] != '0' && tmpMask[0] != 0) - tmpMtl->MicroDetail.Mask = SGCore_LoadTexAddName(tmpMask, LoadTexType::ltt_load); + tmpMtl->MicroDetail.Mask = SGCore_LoadTexAddName(tmpMask, LOAD_TEXTURE_TYPE_LOAD); else tmpMtl->MicroDetail.Mask = -1; @@ -1302,7 +1307,7 @@ bool Materials::LoadMtl(const char* name, Material** mtl) //если текстура с параметрами освещения была определена if (tmpParamLigth[0] != '0' && tmpParamLigth[0] != 0) { - tmpMtl->LightParam.ParamTex = SGCore_LoadTexAddName(tmpParamLigth, LoadTexType::ltt_load); + tmpMtl->LightParam.ParamTex = SGCore_LoadTexAddName(tmpParamLigth, LOAD_TEXTURE_TYPE_LOAD); //если использование параметров освещения из текстуры не было определено if (istexparam == -1) tmpMtl->LightParam.IsTextureParam = true; @@ -1501,7 +1506,7 @@ void Materials::CreateMtl(const char* name, Material** mtl, MTLTYPE_MODEL type) tmpMtl->PS.Param = float4(0, 0, 0, 0); }*/ - tmpMtl->MainTexture = SGCore_LoadTexAddName(name, LoadTexType::ltt_load); + tmpMtl->MainTexture = SGCore_LoadTexAddName(name, LOAD_TEXTURE_TYPE_LOAD); tmpMtl->VS.IsTransWorldViewProjection = true; tmpMtl->LightParam.RoughnessValue = MTL_LIGHTING_DEFAULT_ROUGHNESS; diff --git a/source/mtllight/material.h b/source/mtllight/material.h index fc7181cb1ed8b3e16aea31fc10efa35cc27b796b..87003dc48f5cba168848d1e8a1111be239336114 100644 --- a/source/mtllight/material.h +++ b/source/mtllight/material.h @@ -1,24 +1,27 @@ -#ifndef __sxmaterial -#define __sxmaterial +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + +#ifndef __MATERIAL_H +#define __MATERIAL_H #include <common/String.h> #include <common/Array.h> #include "reflection.h" #include <direct.h> -extern report_func g_fnReportf; - #define MTL_PRE_COND_ID(id,stdval) \ if (!(id >= 0 && id < ArrMaterials.size()))\ -{g_fnReportf(REPORT_MSG_LEVEL_ERROR, "%s - material: unresolved index of access '%d'", GEN_MSG_LOCATION, id); return stdval; }\ +{LibReport(REPORT_MSG_LEVEL_ERROR, "%s - material: unresolved index of access '%d'", GEN_MSG_LOCATION, id); return stdval; }\ else if (!ArrMaterials[id])\ -{g_fnReportf(REPORT_MSG_LEVEL_ERROR, "%s - material: material '%d' is not init", GEN_MSG_LOCATION, id); return stdval; } +{LibReport(REPORT_MSG_LEVEL_ERROR, "%s - material: material '%d' is not init", GEN_MSG_LOCATION, id); return stdval; } #define MTL_REF_PRE_COND_ID(id,stdval) \ MTL_PRE_COND_ID(id, stdval)\ if (!(ArrMaterials[id]->Reflect))\ -{g_fnReportf(REPORT_MSG_LEVEL_ERROR, "%s - material: material id = '%d', name = '%s' unsupported reflection", GEN_MSG_LOCATION, id, ArrMaterials[id]->mtl->Name); return stdval; } +{LibReport(REPORT_MSG_LEVEL_ERROR, "%s - material: material id = '%d', name = '%s' unsupported reflection", GEN_MSG_LOCATION, id, ArrMaterials[id]->mtl->Name); return stdval; } class Materials { diff --git a/source/mtllight/ml_data.cpp b/source/mtllight/ml_data.cpp index d43d061909ab522f22db49e1876b30d56e9d4551..30a84ae6bf864f5b60e41bfa1398b4a642debc38 100644 --- a/source/mtllight/ml_data.cpp +++ b/source/mtllight/ml_data.cpp @@ -1,4 +1,9 @@ +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include "ml_data.h" namespace MLSet @@ -181,7 +186,7 @@ void MLSet::MLInit() MLSet::WinSize = *winsize; MLSet::ProjFov = projfov;*/ - MLSet::IDsTexs::Tex_NoiseTex = SGCore_LoadTexAddName("noise_rottex.dds", LoadTexType::ltt_const); + MLSet::IDsTexs::Tex_NoiseTex = SGCore_LoadTexAddName("noise_rottex.dds", LOAD_TEXTURE_TYPE_CONST); diff --git a/source/mtllight/ml_data.h b/source/mtllight/ml_data.h index dff658de2884d938df2e84882f47c8f89a2fab43..162c173b7aeb1f9f25407df8a679fc214d013c6c 100644 --- a/source/mtllight/ml_data.h +++ b/source/mtllight/ml_data.h @@ -1,4 +1,9 @@ +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #ifndef __ML_DATA_H #define __ML_DATA_H @@ -6,7 +11,7 @@ #define SM_D3D_CONVERSIONS #include <common/SXMath.h> -#include <common\array.h> +#include <common/array.h> #include <GRegisterIndex.h> diff --git a/source/mtllight/reflection.cpp b/source/mtllight/reflection.cpp index 90697afb7371b2b710497fd9d36ea2ed77f3952b..71bbbec2f67d6185fd0ac2f4ee5a0f8e30d2c0a4 100644 --- a/source/mtllight/reflection.cpp +++ b/source/mtllight/reflection.cpp @@ -1,4 +1,9 @@ +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include "reflection.h" Reflection::Reflection() @@ -162,7 +167,7 @@ void Reflection::PreRenderRefPlane(D3DXPLANE* plane) { if (!plane) { - g_fnReportf(REPORT_MSG_LEVEL_WARNING, "%s - sxmtllight [reflection]: plane is NULL", GEN_MSG_LOCATION); + LibReport(REPORT_MSG_LEVEL_WARNING, "%s - sxmtllight [reflection]: plane is NULL", GEN_MSG_LOCATION); return; } @@ -180,7 +185,7 @@ void Reflection::PreRenderRefPlane(D3DXPLANE* plane) viewmat._32 = -viewmat._32; viewmat._42 = -viewmat._42; - ReflectFrustum[0]->Update(&viewmat, &(MLSet::RefMProjPlane)); + ReflectFrustum[0]->update(&viewmat, &(MLSet::RefMProjPlane)); Core_RMatrixGet(G_RI_MATRIX_VIEW, &OldMatView); Core_RMatrixGet(G_RI_MATRIX_PROJECTION, &OldMatProj); @@ -242,7 +247,7 @@ void Reflection::BeginRenderRefCube(float3_t* center) { if (!center) { - g_fnReportf(REPORT_MSG_LEVEL_WARNING, "%s - sxmtllight [reflection]: position center is NULL", GEN_MSG_LOCATION); + LibReport(REPORT_MSG_LEVEL_WARNING, "%s - sxmtllight [reflection]: position center is NULL", GEN_MSG_LOCATION); return; } @@ -275,7 +280,7 @@ void Reflection::PreRenderRefCube(int cube, float4x4* world) Core_RMatrixSet(G_RI_MATRIX_PROJECTION, &MLSet::RefMProjCube); Core_RMatrixSet(G_RI_MATRIX_VIEWPROJ, &(MatrixView * MLSet::RefMProjCube)); - ReflectFrustum[cube]->Update(&float4x4(MatrixView), &MLSet::RefMProjCube); + ReflectFrustum[cube]->update(&float4x4(MatrixView), &MLSet::RefMProjCube); mem_release_del(SurfaceReflect); TextureReflect->GetSurfaceLevel(0, &SurfaceReflect); diff --git a/source/mtllight/reflection.h b/source/mtllight/reflection.h index e1405cbed53538089253770cf17e666a67c4369e..019b26e56c3f2594ba4d7594b68d928a6a40ac70 100644 --- a/source/mtllight/reflection.h +++ b/source/mtllight/reflection.h @@ -1,6 +1,11 @@ -#ifndef __reflection -#define __reflection +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + +#ifndef __REFLECTION_H +#define __REFLECTION_H #include <gdefines.h> @@ -12,8 +17,6 @@ #include "sxmtllight.h" #include "ml_data.h" -extern report_func g_fnReportf; - class Reflection { public: diff --git a/source/mtllight/shadow.cpp b/source/mtllight/shadow.cpp index 20c69f5ee6a3fb3248ea1eeab6b279d011208460..e097c24c343a4e2117ddba046e8a1d6d32f5f9d3 100644 --- a/source/mtllight/shadow.cpp +++ b/source/mtllight/shadow.cpp @@ -1,4 +1,9 @@ +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include "shadow.h" PSSM::PSSM() @@ -127,7 +132,7 @@ void PSSM::OnResetDevice() HRESULT hr = MLSet::DXDevice->CreateTexture(MLSet::SizeTexDepthGlobal.x, MLSet::SizeTexDepthGlobal.y, 1, D3DUSAGE_RENDERTARGET, D3DFMT_R32F,D3DPOOL_DEFAULT, &(DepthMaps[i]), NULL); /*if(FAILED(hr)) - reportf(-1,"Ќе удалось создать текстуру глубины PSSM");*/ + LibReport(REPORT_MSG_LEVEL_ERROR,"Ќе удалось создать текстуру глубины PSSM");*/ DepthSurfaces[i] = 0; } @@ -208,7 +213,7 @@ void PSSM::UpdateFrustums(int split, const float3* poscam, const float3* dircam) FovRatio.x = *r_default_fov; FovRatio.y = float(*r_win_width) / float(*r_win_height); - Frustums[split]->Update(&(Views[split]), &(Projs[split])); + Frustums[split]->update(&(Views[split]), &(Projs[split])); float3 up(0.0f, 1.0f, 0.0f); float3 right = SMVector3Normalize(SMVector3Cross((*dircam), up)); @@ -223,26 +228,25 @@ void PSSM::UpdateFrustums(int split, const float3* poscam, const float3* dircam) float far_height = tan(FovRatio.x / 2.f) * NearFar[split].y; float far_width = far_height * FovRatio.y; - Frustums[split]->Point[0] = nc - up*near_height - right*near_width; - Frustums[split]->Point[1] = nc + up*near_height - right*near_width; - Frustums[split]->Point[2] = nc + up*near_height + right*near_width; - Frustums[split]->Point[3] = nc - up*near_height + right*near_width; + Frustums[split]->setPoint(0, &float3(nc - up*near_height - right*near_width)); + Frustums[split]->setPoint(1, &float3(nc + up*near_height - right*near_width)); + Frustums[split]->setPoint(2, &float3(nc + up*near_height + right*near_width)); + Frustums[split]->setPoint(3, &float3(nc - up*near_height + right*near_width)); - Frustums[split]->Point[4] = fc - up*far_height - right*far_width; - Frustums[split]->Point[5] = fc + up*far_height - right*far_width; - Frustums[split]->Point[6] = fc + up*far_height + right*far_width; - Frustums[split]->Point[7] = fc - up*far_height + right*far_width; + Frustums[split]->setPoint(4, &float3(fc - up*far_height - right*far_width)); + Frustums[split]->setPoint(5, &float3(fc + up*far_height - right*far_width)); + Frustums[split]->setPoint(6, &float3(fc + up*far_height + right*far_width)); + Frustums[split]->setPoint(7, &float3(fc - up*far_height + right*far_width)); float3 vCenter(0, 0, 0); for (int i = 0; i < 8; i++) - vCenter += Frustums[split]->Point[i]; + vCenter += Frustums[split]->getPoint(i); vCenter /= 8; - Frustums[split]->Center = vCenter; - + Frustums[split]->setCenter(&vCenter); float dist = 1; float3 DirL = Position; - float3 TarG = float3(Frustums[split]->Center.x, Frustums[split]->Center.y, Frustums[split]->Center.z); + float3 TarG = float3(Frustums[split]->getCenter()); float3 LightPos = TarG + DirL*dist; float3 LightPos2 = DirL; @@ -258,7 +262,7 @@ void PSSM::UpdateFrustums(int split, const float3* poscam, const float3* dircam) float maxZ = 0; float4 trans0; - float4 transform0(Frustums[split]->Point[0].x, Frustums[split]->Point[0].y, Frustums[split]->Point[0].z, 1); + float4 transform0(Frustums[split]->getPoint(0), 1); trans0 = SMVector4Transform(transform0, Views[split]); minX = trans0.x; maxX = trans0.x; @@ -268,7 +272,7 @@ void PSSM::UpdateFrustums(int split, const float3* poscam, const float3* dircam) for (int i = 0; i<8; i++) { float4 trans; - float4 transform(Frustums[split]->Point[i].x, Frustums[split]->Point[i].y, Frustums[split]->Point[i].z, 1); + float4 transform(Frustums[split]->getPoint(i), 1); trans = SMVector4Transform(transform, Views[split]); @@ -290,7 +294,7 @@ void PSSM::UpdateFrustums(int split, const float3* poscam, const float3* dircam) float2 OrtMax = float2(maxX, maxY); float2 OrtMin = float2(minX, minY); - float3 Diagonal = Frustums[split]->Point[0] - Frustums[split]->Point[6]; + float3 Diagonal = Frustums[split]->getPoint(0) - Frustums[split]->getPoint(6); float LengthDiagonal = SMVector3Length(Diagonal); float2 BoarderOffset = (float2(LengthDiagonal, LengthDiagonal) - (OrtMax - OrtMin)) * 0.5; @@ -709,7 +713,7 @@ void ShadowMapTech::Begin() Core_RMatrixSet(G_RI_MATRIX_PROJECTION, &Proj); Core_RMatrixSet(G_RI_MATRIX_VIEWPROJ, &(View * Proj)); - Frustum->Update(&(View),&(Proj)); + Frustum->update(&(View),&(Proj)); SGCore_ShaderSetVRF(SHADER_TYPE_VERTEX, MLSet::IDsShaders::VS::SMDepthGeomPSSMDirect, "WorldViewProjection", &SMMatrixTranspose(View * Proj)); SGCore_ShaderBind(SHADER_TYPE_VERTEX, MLSet::IDsShaders::VS::SMDepthGeomPSSMDirect); @@ -1027,7 +1031,7 @@ void ShadowMapCubeTech::Pre(int cube) //MLSet::DXDevice->SetTransform(D3DTS_VIEW,&(View[cube].operator D3DXMATRIX())); //MLSet::DXDevice->SetTransform(D3DTS_PROJECTION,&(Proj[cube].operator D3DXMATRIX())); - Frustums[cube]->Update(&(View[cube]), &(Proj[cube])); + Frustums[cube]->update(&(View[cube]), &(Proj[cube])); float4x4 vp = View[cube] * Proj[cube]; diff --git a/source/mtllight/shadow.h b/source/mtllight/shadow.h index 9af154b107e31dfecc355ff3b83f1ae3350981cc..d9dead086777e8756838c33810e4ae9e50bf7130 100644 --- a/source/mtllight/shadow.h +++ b/source/mtllight/shadow.h @@ -1,4 +1,9 @@ +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #ifndef __SHADOW_H #define __SHADOW_H diff --git a/source/mtllight/sxmtllight.cpp b/source/mtllight/sxmtllight.cpp index 817681b77a0c0ce96c7c9fa053e4edc0a60673e1..bc37f158c948b37b4f2eebdda5f0b15f3d9430c3 100644 --- a/source/mtllight/sxmtllight.cpp +++ b/source/mtllight/sxmtllight.cpp @@ -1,8 +1,8 @@ -/****************************************************** -Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017 +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 See the license in LICENSE -******************************************************/ +***********************************************************/ #define SXMATERIAL_LIGTH_VERSION 1 @@ -20,7 +20,7 @@ report_func g_fnReportf = DefReport; Lights* ArrLights = 0; Materials* ArrMaterials = 0; -#define ML_PRECOND(retval) if(!ArrLights){g_fnReportf(-1, "%s - sxmtlligth is not init", GEN_MSG_LOCATION); return retval;} +#define ML_PRECOND(retval) if(!ArrLights){LibReport(-1, "%s - sxmtlligth is not init", GEN_MSG_LOCATION); return retval;} //########################################################################## @@ -44,7 +44,7 @@ SX_LIB_API void SML_0Create(const char* name, bool is_unic) if (GetLastError() == ERROR_ALREADY_EXISTS) { CloseHandle(hMutex); - g_fnReportf(-1, "%s - none unic name, sxmaterial_ligth", GEN_MSG_LOCATION); + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - none unic name", GEN_MSG_LOCATION); } else { @@ -63,7 +63,7 @@ SX_LIB_API void SML_0Create(const char* name, bool is_unic) } } else - g_fnReportf(-1, "%s - not init argument [name], sxmaterial_ligth", GEN_MSG_LOCATION); + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - not init argument [name]", GEN_MSG_LOCATION); } SX_LIB_API void SML_AKill() diff --git a/source/mtllight/sxmtllight.h b/source/mtllight/sxmtllight.h index 1f475ca2c9c71c3f6e7846850d4708ace428805d..ce66190873de830055105e2b184db3e4c1d535cb 100644 --- a/source/mtllight/sxmtllight.h +++ b/source/mtllight/sxmtllight.h @@ -1,8 +1,8 @@ -/****************************************************** -Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017 +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 See the license in LICENSE -******************************************************/ +***********************************************************/ /*! \file @@ -230,7 +230,7 @@ SX_LIB_API void SML_LigthsSetCastGlobalShadow(bool isShadowed); \note Предварительный просчет - просчет для всего света (к примеру в другом потоке) @{*/ -SX_LIB_API bool SML_LigthsComVisibleForFrustum(ID id, const ISXFrustum *pFrustum); //!< виден ли свет в данном фрустуме frustum (отдельный просчет) +SX_LIB_API bool SML_LigthsComVisibleForFrustum(ID id, const const ISXFrustum *pFrustum); //!< виден ли свет в данном фрустуме frustum (отдельный просчет) SX_LIB_API float SML_LigthsComDistFor(ID id, const float3 *pViewPos); //!< дистанция от viewpos до начала света (отдельный просчет) //! просчет видимости и расстояния от наблюдателя viewpos до начала света, для каждого света (предварительный просчет) diff --git a/source/mtllight/sxmtllight_dll.cpp b/source/mtllight/sxmtllight_dll.cpp index 6bd158387722b85c5b9afe649b389ced8f304f3f..88b1ec58eac1f5e48ba53b6f764552b3f797850d 100644 --- a/source/mtllight/sxmtllight_dll.cpp +++ b/source/mtllight/sxmtllight_dll.cpp @@ -1,8 +1,8 @@ -/****************************************************** -Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017 +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 See the license in LICENSE -******************************************************/ +***********************************************************/ #include <windows.h> diff --git a/source/particles/PESet.cpp b/source/particles/PESet.cpp index ea6dbf5380b8a41f55adb54f9f565f0b3e70973e..2eac90d08f70425c33c64c57fda2cedfc462f395 100644 --- a/source/particles/PESet.cpp +++ b/source/particles/PESet.cpp @@ -1,4 +1,9 @@ +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include "PESet.h" namespace PESet diff --git a/source/particles/PESet.h b/source/particles/PESet.h index 3de967ea4cba6a2a0170a11380bf965902146303..99882a1f62910299fad6ca56527ad7b566c81c55 100644 --- a/source/particles/PESet.h +++ b/source/particles/PESet.h @@ -1,6 +1,11 @@ -#ifndef __PESET_H -#define __PESET_H +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + +#ifndef __PE_SET_H +#define __PE_SET_H #include <gdefines.h> #include <d3d9.h> diff --git a/source/particles/effect.cpp b/source/particles/effect.cpp index 78f0868f996e60ed0cdf59c6a705a4e6f2ba455c..3a150f35773f57ee84137677dcac008d46a8d93c 100644 --- a/source/particles/effect.cpp +++ b/source/particles/effect.cpp @@ -1,4 +1,9 @@ +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include "effect.h" Effects::Effects() @@ -123,7 +128,7 @@ void Effects::Save(const char* path) if (!file) { - g_fnReportf(REPORT_MSG_LEVEL_WARNING, "%s - failed to save %s", GEN_MSG_LOCATION, path); + LibReport(REPORT_MSG_LEVEL_WARNING, "%s - failed to save %s", GEN_MSG_LOCATION, path); return; } @@ -301,7 +306,7 @@ void Effects::Load(const char* path) { if (!Core_0FileExists(path)) { - g_fnReportf(REPORT_MSG_LEVEL_ERROR, "%s - failed to save, %s", GEN_MSG_LOCATION, path); + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - failed to save, %s", GEN_MSG_LOCATION, path); return; } @@ -309,13 +314,13 @@ void Effects::Load(const char* path) if (!config->sectionExists("effects")) { - g_fnReportf(REPORT_MSG_LEVEL_ERROR, "%s - main section 'effects' not found, %s", GEN_MSG_LOCATION, path); + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - main section 'effects' not found, %s", GEN_MSG_LOCATION, path); return; } if (!config->keyExists("effects", "count")) { - g_fnReportf(REPORT_MSG_LEVEL_ERROR, "%s - main key 'count' in section 'effects' not found, %s", GEN_MSG_LOCATION, path); + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - main key 'count' in section 'effects' not found, %s", GEN_MSG_LOCATION, path); return; } @@ -328,7 +333,7 @@ void Effects::Load(const char* path) sprintf(eff_section_name, "effect_%d", i); if (!config->sectionExists(eff_section_name)) { - g_fnReportf(REPORT_MSG_LEVEL_ERROR, "%s - not found effect [%s], %s", GEN_MSG_LOCATION, eff_section_name, path); + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - not found effect [%s], %s", GEN_MSG_LOCATION, eff_section_name, path); return; } @@ -347,7 +352,7 @@ void Effects::Load(const char* path) sprintf(part_section_name, "effect_%d_emitter_%d", i, k); if (!config->sectionExists(eff_section_name)) { - g_fnReportf(REPORT_MSG_LEVEL_ERROR, "%s - not found particles [%s], %s", GEN_MSG_LOCATION, part_section_name, path); + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - not found particles [%s], %s", GEN_MSG_LOCATION, part_section_name, path); return; } @@ -1122,7 +1127,7 @@ void Effects::EffectRenderAll(DWORD timeDelta) } } -bool Effects::EffectVisibleCom(ID id, ISXFrustum* frustum, float3* view) +bool Effects::EffectVisibleCom(ID id, const ISXFrustum* frustum, float3* view) { EFFECTS_EFFECT_PRECOND(id, false); @@ -1136,14 +1141,14 @@ bool Effects::EffectVisibleCom(ID id, ISXFrustum* frustum, float3* view) scenter = (eff->CurrMin2 + eff->CurrMax2) * 0.5f; sradius = SMVector3Length(scenter - eff->CurrMax2); - eff->ViewRender = frustum->SphereInFrustum(&scenter, sradius); + eff->ViewRender = frustum->sphereInFrustum(&scenter, sradius); eff->ViewDist = SMVector3Length((scenter - (*view))) - sradius; return eff->ViewRender; } -void Effects::EffectVisibleComAll(ISXFrustum* frustum, float3* view) +void Effects::EffectVisibleComAll(const ISXFrustum* frustum, float3* view) { for(int i = 0, l = ArrID.size(); i < l; ++i) { @@ -1183,12 +1188,12 @@ void Effects::EffectVisibleComAll(ISXFrustum* frustum, float3* view) { for (int i = 0; i < ArrSortSizeCurr; ++i) { - //g_fnReportf(0, "ArrSort[%d] = %d\n", i, ArrSort[i]); + //LibReport(0, "ArrSort[%d] = %d\n", i, ArrSort[i]); if (ArrSort[i] >= 0) - g_fnReportf(0, "ViewDist = %f\n", ArrID[ArrSort[i]]->ViewDist); + LibReport(0, "ViewDist = %f\n", ArrID[ArrSort[i]]->ViewDist); } - g_fnReportf(0, "%d---------\n", ArrSortSizeCurr); + LibReport(0, "%d---------\n", ArrSortSizeCurr); }*/ } diff --git a/source/particles/effect.h b/source/particles/effect.h index 22e5c6a9921bd68d0b5b1f2a6aaaad40a2df77d2..4c008947643fa3d27f2f65ca3de0a5f20d66656c 100644 --- a/source/particles/effect.h +++ b/source/particles/effect.h @@ -1,37 +1,40 @@ -#ifndef __effect_h -#define __effect_h +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + +#ifndef __EFFECT_H +#define __EFFECT_H #include <gdefines.h> #define SM_D3D_CONVERSIONS -#include <common\SXMath.h> +#include <common/SXMath.h> #include "PESet.h" -extern report_func g_fnReportf; - #include "emitter.h" #include <common/array.h> #include <common/string.h> #define EFFECTS_EFFECT_PRECOND_KEY(key,retval) \ if (!(key >= 0 && key < ArrKey.size()))\ -{g_fnReportf(REPORT_MSG_LEVEL_ERROR, "%s - sxparticles: unresolved key of access '%d'", GEN_MSG_LOCATION, key); return retval; } +{LibReport(REPORT_MSG_LEVEL_ERROR, "%s - sxparticles: unresolved key of access '%d'", GEN_MSG_LOCATION, key); return retval; } #define EFFECTS_EFFECT_PRECOND(id, retval) \ if (id < 0 || id >= ArrID.size() || !(ArrID[id]))\ -{g_fnReportf(REPORT_MSG_LEVEL_ERROR, "%s - sxparticles - unresolved address to effect %d", GEN_MSG_LOCATION, id); return retval; } +{LibReport(REPORT_MSG_LEVEL_ERROR, "%s - sxparticles - unresolved address to effect %d", GEN_MSG_LOCATION, id); return retval; } #define EFFECTS_POOL_PRECOND(id, retval) \ if (id < 0 || id >= Pools.size())\ -{g_fnReportf(REPORT_MSG_LEVEL_ERROR, "%s - sxparticles - unresolved address to pool %d", GEN_MSG_LOCATION, id); return retval; } \ +{LibReport(REPORT_MSG_LEVEL_ERROR, "%s - sxparticles - unresolved address to pool %d", GEN_MSG_LOCATION, id); return retval; } \ if (Pools[id]->ideff < 0) \ -{g_fnReportf(REPORT_MSG_LEVEL_ERROR, "%s - sxparticles - uninitialized pool %d", GEN_MSG_LOCATION, id); return retval; } +{LibReport(REPORT_MSG_LEVEL_ERROR, "%s - sxparticles - uninitialized pool %d", GEN_MSG_LOCATION, id); return retval; } #define EFFECTS_PARTICLES_PRECOND(id, id_part, retval) \ if (id_part < 0 || id_part >= ArrID[id]->Arr.size() || !(ArrID[id]->Arr[id_part]))\ -{g_fnReportf(REPORT_MSG_LEVEL_ERROR, "%s - sxparticles - unresolved address to particles %d in effect %d", GEN_MSG_LOCATION, id_part, id); return retval; } +{LibReport(REPORT_MSG_LEVEL_ERROR, "%s - sxparticles - unresolved address to particles %d in effect %d", GEN_MSG_LOCATION, id_part, id); return retval; } #define EFFECTS_PRECOND(id, id_part, retval) \ EFFECTS_EFFECT_PRECOND(id, retval); \ @@ -155,8 +158,8 @@ public: void EffectDirGet(ID id, float3* dir); void EffectRotGet(ID id, float3* rot); - bool EffectVisibleCom(ID id, ISXFrustum* frustum, float3* view); - void EffectVisibleComAll(ISXFrustum* frustum, float3* view); + bool EffectVisibleCom(ID id, const ISXFrustum* frustum, float3* view); + void EffectVisibleComAll(const ISXFrustum* frustum, float3* view); bool EffectVisibleGet(ID id); float EffectDistToViewGet(ID id); diff --git a/source/particles/emitter.cpp b/source/particles/emitter.cpp index 2eef7f58f47a2580b755c1497b6cbeb1bbb33066..6b7bf9e6e51e21fa94021185238b8233a60a615d 100644 --- a/source/particles/emitter.cpp +++ b/source/particles/emitter.cpp @@ -1,4 +1,9 @@ +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include "Emitter.h" void Emitter::NullingInit() @@ -114,7 +119,7 @@ void Emitter::TextureSetID(ID tex) void Emitter::TextureSet(const char* tex) { - IDTex = SGCore_LoadTexAddName(tex, LoadTexType::ltt_load); + IDTex = SGCore_LoadTexAddName(tex, LOAD_TEXTURE_TYPE_LOAD); //SGCore_LoadTexLoadTextures(); isTexInit = false; if (SGCore_LoadTexGetTex(IDTex)) @@ -144,7 +149,7 @@ void Emitter::TextureTrackSetID(ID tex) void Emitter::TextureTrackSet(const char* tex) { - IDTexTrack = SGCore_LoadTexAddName(tex, LoadTexType::ltt_load); + IDTexTrack = SGCore_LoadTexAddName(tex, LOAD_TEXTURE_TYPE_LOAD); //SGCore_LoadTexLoadTextures(); } @@ -251,7 +256,7 @@ void Emitter::CountSet(int count) if (Count <= 0) { - g_fnReportf(REPORT_MSG_LEVEL_ERROR, "%s - buffer null size", GEN_MSG_LOCATION); + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - buffer null size", GEN_MSG_LOCATION); return; } @@ -1306,7 +1311,7 @@ void Emitter::Render(DWORD timeDelta, float4x4* matrot, float4x4* matpos) if (PESet::IDsRenderTargets::DepthScene >= 0) PESet::DXDevice->SetTexture(1, SGCore_RTGetTexture(PESet::IDsRenderTargets::DepthScene)); else - g_fnReportf(REPORT_MSG_LEVEL_WARNING, "sxparticles - not init depth map\n"); + LibReport(REPORT_MSG_LEVEL_WARNING, "sxparticles - not init depth map\n"); } SGCore_ShaderBind(SHADER_TYPE_VERTEX, PESet::IDsShaders::VS::Particles); diff --git a/source/particles/emitter.h b/source/particles/emitter.h index 2e9640c4e94228fb9e123045224e6e118f968a31..62a2f30aa3899745b3a12b046d2103018bce3984 100644 --- a/source/particles/emitter.h +++ b/source/particles/emitter.h @@ -1,16 +1,20 @@ -#ifndef __particles_h -#define __particles_h +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + +#ifndef __EMITTER_H +#define __EMITTER_H #include <gdefines.h> #define SM_D3D_CONVERSIONS -#include <common\SXMath.h> +#include <common/SXMath.h> #include "sxparticles.h" #include "PESet.h" -extern report_func g_fnReportf; extern g_particles_phy_collision GParticlesPhyCollision; //структура описывающая партикл diff --git a/source/particles/sxparticles.cpp b/source/particles/sxparticles.cpp index 6b3a53003ce1bc3c42b1b62949e0c0de9b07b03a..f9d62c87b39af23599fc7c09a64d91eedabae6cb 100644 --- a/source/particles/sxparticles.cpp +++ b/source/particles/sxparticles.cpp @@ -1,4 +1,9 @@ +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include "sxparticles.h" #include "emitter.h" #include "effect.h" @@ -21,7 +26,7 @@ g_particles_phy_collision GParticlesPhyCollision = ParticlesPhyCollision; Effects* ArrEffects = 0; -#define PE_PRECOND(retval) if(!ArrEffects){g_fnReportf(REPORT_MSG_LEVEL_ERROR, "%s - sxparticles is not init", GEN_MSG_LOCATION); return retval;} +#define PE_PRECOND(retval) if(!ArrEffects){LibReport(REPORT_MSG_LEVEL_ERROR, "%s - sxparticles is not init", GEN_MSG_LOCATION); return retval;} //########################################################################## @@ -50,7 +55,7 @@ SX_LIB_API void SPE_0Create(const char* name, bool is_unic) if (GetLastError() == ERROR_ALREADY_EXISTS) { CloseHandle(hMutex); - g_fnReportf(-1, "%s - none unic name, sxparticles", GEN_MSG_LOCATION); + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - none unic name", GEN_MSG_LOCATION); } else { @@ -65,7 +70,7 @@ SX_LIB_API void SPE_0Create(const char* name, bool is_unic) } } else - g_fnReportf(-1, "%s - not init argument [name], sxparticles", GEN_MSG_LOCATION); + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - not init argument [name]", GEN_MSG_LOCATION); } SX_LIB_API void SPE_RTDepthSet(ID id) @@ -321,14 +326,14 @@ SX_LIB_API void SPE_EffectRotGet(ID id, float3* rot) } -SX_LIB_API bool SPE_EffectVisibleCom(ID id, ISXFrustum* frustum, float3* view) +SX_LIB_API bool SPE_EffectVisibleCom(ID id, const ISXFrustum* frustum, float3* view) { PE_PRECOND(false); return ArrEffects->EffectVisibleCom(id, frustum, view); } -SX_LIB_API void SPE_EffectVisibleComAll(ISXFrustum* frustum, float3* view) +SX_LIB_API void SPE_EffectVisibleComAll(const ISXFrustum* frustum, float3* view) { PE_PRECOND(_VOID); diff --git a/source/particles/sxparticles.h b/source/particles/sxparticles.h index 9398568464a5602d53089d9d9191f3834ffa24ba..dfc0eeb06847ae3256c6e9140a99d8c51a6171d3 100644 --- a/source/particles/sxparticles.h +++ b/source/particles/sxparticles.h @@ -1,8 +1,8 @@ -/****************************************************** -Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017 +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 See the license in LICENSE -******************************************************/ +***********************************************************/ /*! \file @@ -498,10 +498,10 @@ SX_LIB_API void SPE_EffectRotGet(ID id, float3* rot); //! просчет видимости эффекта для фрустума frustum, и расчет расстояния от позиции наблюдателя view до эффекта, возвращает виден ли фруустуму эффект -SX_LIB_API bool SPE_EffectVisibleCom(ID id, ISXFrustum* frustum, float3* view); +SX_LIB_API bool SPE_EffectVisibleCom(ID id, const ISXFrustum* frustum, float3* view); //! просчет видимости всех эффектов для фрустума frustum, и расчет расстояний от позиции наблюдателя view до всех эффектов -SX_LIB_API void SPE_EffectVisibleComAll(ISXFrustum* frustum, float3* view); +SX_LIB_API void SPE_EffectVisibleComAll(const ISXFrustum* frustum, float3* view); //! виден ли эффект? по результатам просчетов #SPE_EffectVisibleComAll diff --git a/source/particles/sxparticles_dll.cpp b/source/particles/sxparticles_dll.cpp index 6bd158387722b85c5b9afe649b389ced8f304f3f..88b1ec58eac1f5e48ba53b6f764552b3f797850d 100644 --- a/source/particles/sxparticles_dll.cpp +++ b/source/particles/sxparticles_dll.cpp @@ -1,8 +1,8 @@ -/****************************************************** -Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017 +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 See the license in LICENSE -******************************************************/ +***********************************************************/ #include <windows.h> diff --git a/source/physics/PhyWorld.cpp b/source/physics/PhyWorld.cpp index b0a1966881f2a738e29a7f08ce19fd2dd0cecd51..c58e7a5f889da2addf227d8936bee5f796267645 100644 --- a/source/physics/PhyWorld.cpp +++ b/source/physics/PhyWorld.cpp @@ -1,3 +1,9 @@ + +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include "PhyWorld.h" #include <core/sxcore.h> #include <geom/sxgeom.h> @@ -605,7 +611,7 @@ void PhyWorld::DebugDrawer::drawContactPoint(const btVector3 & PointOnB, const b void PhyWorld::DebugDrawer::reportErrorWarning(const char * warningString) { - reportf(REPORT_MSG_LEVEL_WARNING, "%s\n", warningString); + LibReport(REPORT_MSG_LEVEL_WARNING, "%s\n", warningString); } void PhyWorld::DebugDrawer::draw3dText(const btVector3& location, const char* textString) diff --git a/source/physics/PhyWorld.h b/source/physics/PhyWorld.h index 103a8637ccab0cb659ebd1c3fb8b4ed1c30a9397..435608ca7261667e1b89e84a35ac7ed0afae3b0b 100644 --- a/source/physics/PhyWorld.h +++ b/source/physics/PhyWorld.h @@ -1,5 +1,11 @@ -#ifndef SXPHYWORLD_H -#define SXPHYWORLD_H + +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + +#ifndef __PHY_WORLD_H +#define __PHY_WORLD_H #include <btBulletDynamicsCommon.h> @@ -30,8 +36,6 @@ struct PhyMatFile }; #pragma pack(pop) -extern report_func reportf; - class PhyWorld { public: diff --git a/source/physics/sxphysics.h b/source/physics/sxphysics.h index 8f69cc3fdee904b277b955cda2f0fc535dbd064e..4c2ee3e85ef1a180104220452e93d34981820546 100644 --- a/source/physics/sxphysics.h +++ b/source/physics/sxphysics.h @@ -1,8 +1,8 @@ -/****************************************************** -Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017 +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 See the license in LICENSE -******************************************************/ +***********************************************************/ /*! \file diff --git a/source/physics/sxphysics_dll.cpp b/source/physics/sxphysics_dll.cpp index 99a5920d4d6cf4ef14269edc537a55b346ec55a5..3ec2b29dc0928e52fc28dbbe05158fcd21018297 100644 --- a/source/physics/sxphysics_dll.cpp +++ b/source/physics/sxphysics_dll.cpp @@ -1,8 +1,8 @@ -/****************************************************** -Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017 +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 See the license in LICENSE -******************************************************/ +***********************************************************/ #define WIN32_LEAN_AND_MEAN #include <windows.h> @@ -32,12 +32,12 @@ See the license in LICENSE #if !defined(DEF_STD_REPORT) #define DEF_STD_REPORT -report_func reportf = DefReport; +report_func g_fnReportf = DefReport; #endif PhyWorld * g_pWorld = NULL; -#define SP_PRECOND(ret) if(!g_pWorld){reportf(-1, "%s - sxphysics is not init", GEN_MSG_LOCATION);return ret;} +#define SP_PRECOND(ret) if(!g_pWorld){LibReport(REPORT_MSG_LEVEL_ERROR, "%s - sxphysics is not init", GEN_MSG_LOCATION);return ret;} BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, @@ -59,7 +59,7 @@ SX_LIB_API void SXPhysics_0Create() { if(g_pWorld) { - reportf(-1, "%s - sxphysics double init", GEN_MSG_LOCATION); + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - sxphysics double init", GEN_MSG_LOCATION); return; } Core_SetOutPtr(); @@ -90,7 +90,7 @@ SX_LIB_API void SXPhysics_Sync() SX_LIB_API void SXPhysics_Dbg_Set(report_func rf) { - reportf = rf; + g_fnReportf = rf; } SX_LIB_API void SXPhysics_LoadGeom(const char * file) diff --git a/source/pp/sxpp.cpp b/source/pp/sxpp.cpp index 59e1e00fbb2715f3b2d5a8fa81baf4e29f020711..54a490a6785c84d87ca42248120b783d9c0c8d2d 100644 --- a/source/pp/sxpp.cpp +++ b/source/pp/sxpp.cpp @@ -1,8 +1,8 @@ -/****************************************************** -Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017 +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 See the license in LICENSE -******************************************************/ +***********************************************************/ #define SXPP_VERSION 1 @@ -167,7 +167,7 @@ void PPSet::Init() PPSet::IDsShaders::PS::DLAA_Small = SGCore_ShaderLoad(SHADER_TYPE_PIXEL, "ppe_dlaa_small.ps", "ppe_dlaa_small.ps", SHADER_CHECKDOUBLE_PATH); PPSet::IDsShaders::PS::DLAA_Long = SGCore_ShaderLoad(SHADER_TYPE_PIXEL, "ppe_dlaa_long.ps", "ppe_dlaa_long.ps", SHADER_CHECKDOUBLE_PATH); - PPSet::IDsTexs::Noise = SGCore_LoadTexAddName("noise_rottex.dds", LoadTexType::ltt_const); + PPSet::IDsTexs::Noise = SGCore_LoadTexAddName("noise_rottex.dds", LOAD_TEXTURE_TYPE_CONST); PPSet::IDsTexs::Sun = -1; @@ -195,8 +195,8 @@ void PPSet::Init() PPSet::IDsRenderTargets::Bright2 = SGCore_RTAdd(PPSet::WinSize.x, PPSet::WinSize.y, 0, D3DUSAGE_RENDERTARGET | D3DUSAGE_AUTOGENMIPMAP, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, "pp_bright2", 1); } -#define PP_PRECOND(retval) if(!PPSet::DXDevice){g_fnReportf(-1, "%s - post process is not init", GEN_MSG_LOCATION); return retval;} -#define PP_PRECOND_SECOND(retval) if(PPSet::IDsRenderTargets::Input < 0 || PPSet::IDsRenderTargets::Output < 0){g_fnReportf(-1, "%s - post process is not init output textures", GEN_MSG_LOCATION); return retval;} +#define PP_PRECOND(retval) if(!PPSet::DXDevice){LibReport(REPORT_MSG_LEVEL_ERROR, "%s - post process is not init", GEN_MSG_LOCATION); return retval;} +#define PP_PRECOND_SECOND(retval) if(PPSet::IDsRenderTargets::Input < 0 || PPSet::IDsRenderTargets::Output < 0){LibReport(REPORT_MSG_LEVEL_ERROR, "%s - post process is not init output textures", GEN_MSG_LOCATION); return retval;} //########################################################################## @@ -221,7 +221,7 @@ SX_LIB_API void SPP_0Create(const char* name, bool is_unic) if (GetLastError() == ERROR_ALREADY_EXISTS) { CloseHandle(hMutex); - g_fnReportf(-1, "%s - none unic name, post process", GEN_MSG_LOCATION); + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - none unic name", GEN_MSG_LOCATION); } else { @@ -234,7 +234,7 @@ SX_LIB_API void SPP_0Create(const char* name, bool is_unic) } } else - g_fnReportf(-1, "%s - not init argument [name], post process", GEN_MSG_LOCATION); + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - not init argument [name]", GEN_MSG_LOCATION); } SX_LIB_API void SPP_0Kill() @@ -721,7 +721,7 @@ SX_LIB_API void SPP_UpdateSun(float3* sunpos) SX_LIB_API void SPP_ChangeTexSun(const char* str) { - PPSet::IDsTexs::Sun = SGCore_LoadTexAddName(str, LoadTexType::ltt_const); + PPSet::IDsTexs::Sun = SGCore_LoadTexAddName(str, LOAD_TEXTURE_TYPE_CONST); } SX_LIB_API void SPP_RenderSun(float4_t* sun_color) @@ -734,7 +734,7 @@ SX_LIB_API void SPP_RenderSun(float4_t* sun_color) if (PPSet::IDsTexs::Sun < 0 || !SGCore_LoadTexGetTex(PPSet::IDsTexs::Sun)) { - g_fnReportf(REPORT_MSG_LEVEL_WARNING, "sxpp: %s - sun texture is not init, process can not be started\n", GEN_MSG_LOCATION); + LibReport(REPORT_MSG_LEVEL_WARNING, "%s - sun texture is not init, process can not be started\n", GEN_MSG_LOCATION); return; } diff --git a/source/pp/sxpp.h b/source/pp/sxpp.h index 400e0513b15b4ff72d8a1576479280ed0d6f3bae..7ad0eacf916aed8cfd9974750aefe5f1102da3e2 100644 --- a/source/pp/sxpp.h +++ b/source/pp/sxpp.h @@ -1,8 +1,8 @@ -/****************************************************** -Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017 +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 See the license in LICENSE -******************************************************/ +***********************************************************/ /*! \file @@ -25,7 +25,7 @@ See the license in LICENSE #undef SX_LIB_API #define SX_LIB_API extern "C" __declspec (dllimport) -#include <gcore\\sxgcore.h> +#include <gcore/sxgcore.h> #ifdef SX_DLL #undef SX_LIB_API diff --git a/source/pp/sxpp_dll.cpp b/source/pp/sxpp_dll.cpp index 4030f098dc11f4148f9560ae3dab3262d8a90e3f..88b1ec58eac1f5e48ba53b6f764552b3f797850d 100644 --- a/source/pp/sxpp_dll.cpp +++ b/source/pp/sxpp_dll.cpp @@ -1,10 +1,9 @@ -/****************************************************** -Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017 +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 See the license in LICENSE -******************************************************/ +***********************************************************/ -#pragma once #include <windows.h> BOOL APIENTRY DllMain(HMODULE hModule, diff --git a/source/render/camera_update.cpp b/source/render/camera_update.cpp index 40fcf3e1b66c2571567d768dc92ede162132c7ac..13465dd5bf62be07fc5b066346b4780b92c0d069 100644 --- a/source/render/camera_update.cpp +++ b/source/render/camera_update.cpp @@ -1,4 +1,9 @@ +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include "camera_update.h" //обработка вводы информации с клавиатуры @@ -6,28 +11,28 @@ void CameraUpdate::UpdateInputKeyBoard(DWORD timeDelta) { //обработка ходьбы if(SSInput_GetKeyState(SIK_W)) - GData::ObjCamera->PosFrontBack( + GData::ObjCamera->posFrontBack( GData::CamWalkParamEditor.x * (SSInput_GetKeyState(SIK_LSHIFT) ? GData::CamWalkParamEditor.y : 1) * float(timeDelta) * 0.001f ); if(SSInput_GetKeyState(SIK_S)) - GData::ObjCamera->PosFrontBack( + GData::ObjCamera->posFrontBack( -GData::CamWalkParamEditor.x * (SSInput_GetKeyState(SIK_LSHIFT) ? GData::CamWalkParamEditor.y : 1) * GData::CamWalkParamEditor.w * float(timeDelta) * 0.001f ); if(SSInput_GetKeyState(SIK_A)) - GData::ObjCamera->PosLeftRight( + GData::ObjCamera->posLeftRight( -GData::CamWalkParamEditor.x * (SSInput_GetKeyState(SIK_LSHIFT) ? GData::CamWalkParamEditor.y : 1) * GData::CamWalkParamEditor.z * float(timeDelta) * 0.001f ); if(SSInput_GetKeyState(SIK_D)) - GData::ObjCamera->PosLeftRight( + GData::ObjCamera->posLeftRight( GData::CamWalkParamEditor.x * (SSInput_GetKeyState(SIK_LSHIFT) ? GData::CamWalkParamEditor.y : 1) * GData::CamWalkParamEditor.z * float(timeDelta) * 0.001f @@ -45,13 +50,13 @@ void CameraUpdate::UpdateInputMouseRotate(DWORD timeDelta) if(dx) { - GData::ObjCamera->RotRightLeft(float(timeDelta) * *sense * float(dx)); + GData::ObjCamera->rotRightLeft(float(timeDelta) * *sense * float(dx)); //SetCursorPos(centr.x,cy); } if(dy) { - GData::ObjCamera->RotUpDown(float(timeDelta) * *sense * float(dy)); + GData::ObjCamera->rotUpDown(float(timeDelta) * *sense * float(dy)); //SetCursorPos(cx,centr.y); } } @@ -67,7 +72,7 @@ void CameraUpdate::UpdateInputMouseUpDown(DWORD timeDelta) if(dy) { - GData::ObjCamera->PosUpDown(5 * float(timeDelta) * *sense * float(-dy)); + GData::ObjCamera->posUpDown(5 * float(timeDelta) * *sense * float(-dy)); } } diff --git a/source/render/camera_update.h b/source/render/camera_update.h index 9d44263651e0204d2d10d8210d6703b7d1f28c56..5ffa347707052b212c62a7e93dc4e5392ad39f32 100644 --- a/source/render/camera_update.h +++ b/source/render/camera_update.h @@ -1,8 +1,8 @@ -/****************************************************** -Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017 +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 See the license in LICENSE -******************************************************/ +***********************************************************/ /*! \file @@ -13,8 +13,8 @@ See the license in LICENSE \ingroup render @{*/ -#ifndef __CAMERA_UPDATE -#define __CAMERA_UPDATE +#ifndef __CAMERA_UPDATE_H +#define __CAMERA_UPDATE_H #include <windows.h> #include <input/sxinput.h> diff --git a/source/render/editor/axes_static.cpp b/source/render/editor/axes_static.cpp index 844bfeaea254d40794c12945ce6de5856b723228..1a84aedca9743b01295710a17dd1fe66e15a1cb1 100644 --- a/source/render/editor/axes_static.cpp +++ b/source/render/editor/axes_static.cpp @@ -1,4 +1,9 @@ +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include "grid.h" CAxesStatic::CAxesStatic() diff --git a/source/render/editor/axes_static.h b/source/render/editor/axes_static.h index b3fd3d26718b6cb3cadb5184258b996cdab5cb4c..a974a8b829f440da946600ce44e697f9348301b0 100644 --- a/source/render/editor/axes_static.h +++ b/source/render/editor/axes_static.h @@ -1,4 +1,9 @@ +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #ifndef __AXES_STATIC_H #define __AXES_STATIC_H diff --git a/source/render/editor/grid.cpp b/source/render/editor/grid.cpp index dbfcdd8e8e357284d215619a4e49e602556c0f77..34c438a8871491a6bca5efbf79befc4545400a12 100644 --- a/source/render/editor/grid.cpp +++ b/source/render/editor/grid.cpp @@ -1,4 +1,9 @@ +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include "grid.h" CGrid::CGrid() diff --git a/source/render/editor/grid.h b/source/render/editor/grid.h index 359fcdf45a5688d8a4e9a10ed66eadefc903a2a1..6c2e7e8ed59e4fb8676eb56f1dc4913cad35f612 100644 --- a/source/render/editor/grid.h +++ b/source/render/editor/grid.h @@ -1,4 +1,9 @@ +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #ifndef __GRID_H #define __GRID_H diff --git a/source/render/gdata.cpp b/source/render/gdata.cpp index dfc8ee2f5ac9876cd3197e26aac3dae17e0bb4dd..0591d76b0542589663e2e9548ccfa3bda5927e2b 100644 --- a/source/render/gdata.cpp +++ b/source/render/gdata.cpp @@ -1,4 +1,9 @@ +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include "gdata.h" namespace GData diff --git a/source/render/gdata.h b/source/render/gdata.h index 982349713437b53ac8e8ad5e1ace9fd185333ae7..02125fe56524158ab2c30ba6dedc4f10ae37506b 100644 --- a/source/render/gdata.h +++ b/source/render/gdata.h @@ -1,8 +1,8 @@ -/****************************************************** -Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017 +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 See the license in LICENSE -******************************************************/ +***********************************************************/ /*! \file diff --git a/source/render/model_sim.cpp b/source/render/model_sim.cpp index e03e721ca7569c9c4f39076acd41f314735a53dc..bc59a307cdea2a3fbc84a885a04debe878c0056d 100644 --- a/source/render/model_sim.cpp +++ b/source/render/model_sim.cpp @@ -1,4 +1,9 @@ +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include "model_sim.h" ModelSim::ModelSim() @@ -85,24 +90,24 @@ void ModelSim::Add(const char* path) sprintf(tmppath, "%s%s", Core_RStringGet(G_RI_STRING_PATH_GS_MESHES), path); SGCore_StaticModelLoad(tmppath, &StaticModel); - if (StaticModel->SubsetCount > 1) + if (StaticModel->m_uiSubsetCount > 1) { //error } - sprintf(tmppath, "%s.dds", StaticModel->ArrTextures[0]); + sprintf(tmppath, "%s.dds", StaticModel->m_ppTextures[0]); IDsMat = SGCore_MtlLoad(tmppath, MTL_TYPE_GEOM); vertex_static* pData; - StaticModel->VertexBuffer->Lock(0, 0, (void**)&pData, 0); + StaticModel->m_pVertexBuffer->Lock(0, 0, (void**)&pData, 0); - float3_t tmppos = pData[StaticModel->StartVertex[0]].Pos; + float3_t tmppos = pData[StaticModel->m_pStartVertex[0]].Pos; float3 tmpMax = tmppos; float3 tmpMin = tmppos; - for (DWORD k = 0; k<StaticModel->VertexCount[0]; k++) + for (DWORD k = 0; k<StaticModel->m_pVertexCount[0]; k++) { - tmppos = pData[StaticModel->StartVertex[0] + k].Pos; + tmppos = pData[StaticModel->m_pStartVertex[0] + k].Pos; if (tmppos.x > tmpMax.x) tmpMax.x = tmppos.x; @@ -125,16 +130,16 @@ void ModelSim::Add(const char* path) } DWORD* indeces; - StaticModel->IndexBuffer->Lock(0, 0, (void **)&indeces, 0); + StaticModel->m_pIndexBuffer->Lock(0, 0, (void **)&indeces, 0); float3 tmpMM = SMVectorLerp(tmpMax, tmpMin, 0.5f); D3DXPLANE Plane; D3DXPlaneFromPoints(&Plane, - &D3DXVECTOR3(pData[indeces[StaticModel->StartIndex[0] + 0]].Pos.x, pData[indeces[StaticModel->StartIndex[0] + 0]].Pos.y, pData[indeces[StaticModel->StartIndex[0] + 0]].Pos.z), - &D3DXVECTOR3(pData[indeces[StaticModel->StartIndex[0] + 1]].Pos.x, pData[indeces[StaticModel->StartIndex[0] + 1]].Pos.y, pData[indeces[StaticModel->StartIndex[0] + 1]].Pos.z), - &D3DXVECTOR3(pData[indeces[StaticModel->StartIndex[0] + 2]].Pos.x, pData[indeces[StaticModel->StartIndex[0] + 2]].Pos.y, pData[indeces[StaticModel->StartIndex[0] + 2]].Pos.z)); - StaticModel->VertexBuffer->Unlock(); - StaticModel->IndexBuffer->Unlock(); + &D3DXVECTOR3(pData[indeces[StaticModel->m_pStartIndex[0] + 0]].Pos.x, pData[indeces[StaticModel->m_pStartIndex[0] + 0]].Pos.y, pData[indeces[StaticModel->m_pStartIndex[0] + 0]].Pos.z), + &D3DXVECTOR3(pData[indeces[StaticModel->m_pStartIndex[0] + 1]].Pos.x, pData[indeces[StaticModel->m_pStartIndex[0] + 1]].Pos.y, pData[indeces[StaticModel->m_pStartIndex[0] + 1]].Pos.z), + &D3DXVECTOR3(pData[indeces[StaticModel->m_pStartIndex[0] + 2]].Pos.x, pData[indeces[StaticModel->m_pStartIndex[0] + 2]].Pos.y, pData[indeces[StaticModel->m_pStartIndex[0] + 2]].Pos.z)); + StaticModel->m_pVertexBuffer->Unlock(); + StaticModel->m_pIndexBuffer->Unlock(); float3_t Center = (float3_t)((tmpMax + tmpMin) * 0.5); float3_t Min = tmpMin; @@ -144,7 +149,7 @@ void ModelSim::Add(const char* path) IDirect3DVertexBuffer9* Anim; GData::DXDevice->CreateVertexBuffer( - StaticModel->AllVertexCount * sizeof(vertex_animated), + StaticModel->m_uiAllVertexCount * sizeof(vertex_animated), D3DUSAGE_WRITEONLY, 0, D3DPOOL_MANAGED, @@ -153,9 +158,9 @@ void ModelSim::Add(const char* path) vertex_animated* pDataAnim; Anim->Lock(0, 0, (void**)&pDataAnim, 0); - StaticModel->VertexBuffer->Lock(0, 0, (void**)&pData, 0); + StaticModel->m_pVertexBuffer->Lock(0, 0, (void**)&pData, 0); - for (UINT i = 0; i < StaticModel->AllVertexCount; ++i) + for (UINT i = 0; i < StaticModel->m_uiAllVertexCount; ++i) { pDataAnim[i].Pos = pData[i].Pos; pDataAnim[i].Norm = pData[i].Norm; @@ -166,7 +171,7 @@ void ModelSim::Add(const char* path) } Anim->Unlock(); - StaticModel->VertexBuffer->Unlock(); + StaticModel->m_pVertexBuffer->Unlock(); ArrStaticModel[ArrStaticModel.size() - 1]->Anim = Anim; } @@ -221,16 +226,16 @@ void ModelSim::RenderStatic(DWORD timeDelta) { // uint32_t* RTGPUArrIndicesPtrs2; - GData::DXDevice->SetStreamSource(0, ArrStaticModel[CurrRenderModel]->Model->VertexBuffer, 0, sizeof(vertex_static)); - GData::DXDevice->SetIndices(ArrStaticModel[CurrRenderModel]->Model->IndexBuffer); + GData::DXDevice->SetStreamSource(0, ArrStaticModel[CurrRenderModel]->Model->m_pVertexBuffer, 0, sizeof(vertex_static)); + GData::DXDevice->SetIndices(ArrStaticModel[CurrRenderModel]->Model->m_pIndexBuffer); GData::DXDevice->SetVertexDeclaration(VertexDeclarationStatic); long jCountIndex = 0; SGCore_MtlSet(IDsMat, &WorldMat); - SGCore_DIP(D3DPT_TRIANGLELIST, 0, 0, ArrStaticModel[CurrRenderModel]->Model->VertexCount[0], jCountIndex, ArrStaticModel[CurrRenderModel]->Model->IndexCount[0] / 3); - Core_RIntSet(G_RI_INT_COUNT_POLY, Core_RIntGet(G_RI_INT_COUNT_POLY) + ArrStaticModel[CurrRenderModel]->Model->IndexCount[0] / 3); - jCountIndex += ArrStaticModel[CurrRenderModel]->Model->IndexCount[0]; + SGCore_DIP(D3DPT_TRIANGLELIST, 0, 0, ArrStaticModel[CurrRenderModel]->Model->m_pVertexCount[0], jCountIndex, ArrStaticModel[CurrRenderModel]->Model->m_pIndexCount[0] / 3); + Core_RIntSet(G_RI_INT_COUNT_POLY, Core_RIntGet(G_RI_INT_COUNT_POLY) + ArrStaticModel[CurrRenderModel]->Model->m_pIndexCount[0] / 3); + jCountIndex += ArrStaticModel[CurrRenderModel]->Model->m_pIndexCount[0]; } void ModelSim::RenderGreen(DWORD timeDelta) @@ -240,17 +245,17 @@ void ModelSim::RenderGreen(DWORD timeDelta) GData::DXDevice->SetStreamSourceFreq(1, (D3DSTREAMSOURCE_INSTANCEDATA | 1)); GData::DXDevice->SetStreamSource(1, TransVertBufGreen, 0, sizeof(DataVertex)); - GData::DXDevice->SetStreamSource(0, ArrStaticModel[CurrRenderModel]->Model->VertexBuffer, 0, sizeof(vertex_static)); - GData::DXDevice->SetIndices(ArrStaticModel[CurrRenderModel]->Model->IndexBuffer); + GData::DXDevice->SetStreamSource(0, ArrStaticModel[CurrRenderModel]->Model->m_pVertexBuffer, 0, sizeof(vertex_static)); + GData::DXDevice->SetIndices(ArrStaticModel[CurrRenderModel]->Model->m_pIndexBuffer); GData::DXDevice->SetVertexDeclaration(VertexDeclarationGreen); long jCountIndex = 0; SGCore_MtlSet(IDsMat, &SMMatrixIdentity()); - SGCore_DIP(D3DPT_TRIANGLELIST, 0, 0, ArrStaticModel[CurrRenderModel]->Model->VertexCount[0], jCountIndex, ArrStaticModel[CurrRenderModel]->Model->IndexCount[0] / 3); - Core_RIntSet(G_RI_INT_COUNT_POLY, Core_RIntGet(G_RI_INT_COUNT_POLY) + ((ArrStaticModel[CurrRenderModel]->Model->IndexCount[0] / 3) * 1)); - jCountIndex += ArrStaticModel[CurrRenderModel]->Model->IndexCount[0]; + SGCore_DIP(D3DPT_TRIANGLELIST, 0, 0, ArrStaticModel[CurrRenderModel]->Model->m_pVertexCount[0], jCountIndex, ArrStaticModel[CurrRenderModel]->Model->m_pIndexCount[0] / 3); + Core_RIntSet(G_RI_INT_COUNT_POLY, Core_RIntGet(G_RI_INT_COUNT_POLY) + ((ArrStaticModel[CurrRenderModel]->Model->m_pIndexCount[0] / 3) * 1)); + jCountIndex += ArrStaticModel[CurrRenderModel]->Model->m_pIndexCount[0]; GData::DXDevice->SetStreamSourceFreq(0, 1); GData::DXDevice->SetStreamSourceFreq(1, 1); @@ -263,11 +268,11 @@ void ModelSim::RenderSkin(DWORD timeDelta) mbs.orient = SMQuaternion(); GData::DXDevice->SetStreamSource(0, ArrStaticModel[CurrRenderModel]->Anim, 0, sizeof(vertex_animated)); - GData::DXDevice->SetIndices(ArrStaticModel[CurrRenderModel]->Model->IndexBuffer); + GData::DXDevice->SetIndices(ArrStaticModel[CurrRenderModel]->Model->m_pIndexBuffer); GData::DXDevice->SetVertexDeclaration(VertexDeclarationSkin); SGCore_MtlSet(IDsMat, &WorldMat); GData::DXDevice->SetVertexShaderConstantF(16, (float*)&mbs, 2); - SGCore_DIP(D3DPT_TRIANGLELIST, 0, 0, ArrStaticModel[CurrRenderModel]->Model->VertexCount[0], 0, ArrStaticModel[CurrRenderModel]->Model->IndexCount[0] / 3); - Core_RIntSet(G_RI_INT_COUNT_POLY, Core_RIntGet(G_RI_INT_COUNT_POLY) + ArrStaticModel[CurrRenderModel]->Model->IndexCount[0] / 3); + SGCore_DIP(D3DPT_TRIANGLELIST, 0, 0, ArrStaticModel[CurrRenderModel]->Model->m_pVertexCount[0], 0, ArrStaticModel[CurrRenderModel]->Model->m_pIndexCount[0] / 3); + Core_RIntSet(G_RI_INT_COUNT_POLY, Core_RIntGet(G_RI_INT_COUNT_POLY) + ArrStaticModel[CurrRenderModel]->Model->m_pIndexCount[0] / 3); } \ No newline at end of file diff --git a/source/render/model_sim.h b/source/render/model_sim.h index 9945e9671cde1fda6ab4c2d1c30e677e0fc3c5e1..d5a4eb8f45602c6f54beeb5a919dadb788fb6874 100644 --- a/source/render/model_sim.h +++ b/source/render/model_sim.h @@ -1,8 +1,8 @@ -/****************************************************** -Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017 +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 See the license in LICENSE -******************************************************/ +***********************************************************/ /*! \file diff --git a/source/render/render_func.cpp b/source/render/render_func.cpp index 9265f0e297a4020fb649aa603f9f372348076ae4..f0c3e7936e1afaa861d92e54fc59d8cf4491d9b0 100644 --- a/source/render/render_func.cpp +++ b/source/render/render_func.cpp @@ -1,4 +1,9 @@ +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include "render_func.h" /* @@ -134,12 +139,12 @@ void SXRenderFunc::ComDeviceLost() SXRenderFunc::InitModeWindow(); bool bf = SGCore_OnDeviceReset(*r_win_width, *r_win_height, *r_win_windowed); - g_fnReportf(REPORT_MSG_LEVEL_WARNING, "r_win_width %d, r_win_height %d, r_win_windowed %d \n", *r_win_width, *r_win_height, *r_win_windowed); + LibReport(REPORT_MSG_LEVEL_WARNING, "r_win_width %d, r_win_height %d, r_win_windowed %d \n", *r_win_width, *r_win_height, *r_win_windowed); if (bf) { //если все-таки функция зашла сюда значит что-то было неосвобождено - g_fnReportf(REPORT_MSG_LEVEL_ERROR, "reset device is failed ... \n"); + LibReport(REPORT_MSG_LEVEL_ERROR, "reset device is failed ... \n"); } else { @@ -163,7 +168,7 @@ void SXRenderFunc::ComVisibleForLight() if (!SML_LigthsGetExists(i)) continue; - if (SML_LigthsGetShadowed(i) && (SML_LigthsComVisibleForFrustum(i, GData::ObjCamera->ObjFrustum) && SML_LigthsGetEnable(i)) /*|| (Data::Level::LightManager->Arr[i]->ShadowCube && Data::Level::LightManager->Arr[i]->ShadowCube->GetStatic() && !Data::Level::LightManager->Arr[i]->ShadowCube->GetUpdate())*/) + if (SML_LigthsGetShadowed(i) && (SML_LigthsComVisibleForFrustum(i, GData::ObjCamera->getFrustum()) && SML_LigthsGetEnable(i)) /*|| (Data::Level::LightManager->Arr[i]->ShadowCube && Data::Level::LightManager->Arr[i]->ShadowCube->GetStatic() && !Data::Level::LightManager->Arr[i]->ShadowCube->GetUpdate())*/) { if (SML_LigthsGetType(i) == LTYPE_LIGHT_GLOBAL) { @@ -286,12 +291,12 @@ void SXRenderFunc::ComVisibleForLight() void SXRenderFunc::ComVisibleForCamera() { if (SGeom_ModelsGetCount() > 0) - SGeom_ModelsComVisible(GData::ObjCamera->ObjFrustum, &GData::ConstCurrCamPos); + SGeom_ModelsComVisible(GData::ObjCamera->getFrustum(), &GData::ConstCurrCamPos); if (SGeom_GreenGetCount() > 0) - SGeom_GreenComVisible(GData::ObjCamera->ObjFrustum, &GData::ConstCurrCamPos); + SGeom_GreenComVisible(GData::ObjCamera->getFrustum(), &GData::ConstCurrCamPos); - SXAnim_ModelsComVisible(GData::ObjCamera->ObjFrustum, &GData::ConstCurrCamPos); + SXAnim_ModelsComVisible(GData::ObjCamera->getFrustum(), &GData::ConstCurrCamPos); } void SXRenderFunc::ComVisibleReflection() @@ -492,7 +497,7 @@ void SXRenderFunc::FullScreenChangeSizeAbs() *r_win_width = iFullScreenWidth; *r_win_height = iFullScreenHeight; - //g_fnReportf(REPORT_MSG_LEVEL_WARNING, "iFullScreenWidth %d, iFullScreenHeight %d \n", iFullScreenWidth, iFullScreenHeight); + //LibReport(REPORT_MSG_LEVEL_WARNING, "iFullScreenWidth %d, iFullScreenHeight %d \n", iFullScreenWidth, iFullScreenHeight); } static int *r_resize = (int*)GET_PCVAR_INT("r_resize"); @@ -505,7 +510,7 @@ void SXRenderFunc::UpdateView() { GData::InitAllMatrix(); - GData::ObjCamera->GetViewMatrix(&GData::MCamView); + GData::ObjCamera->getViewMatrix(&GData::MCamView); Core_RMatrixSet(G_RI_MATRIX_WORLD, &SMMatrixIdentity()); Core_RMatrixSet(G_RI_MATRIX_VIEW, &GData::MCamView); @@ -513,8 +518,8 @@ void SXRenderFunc::UpdateView() Core_RMatrixSet(G_RI_MATRIX_VIEWPROJ, &(GData::MCamView * GData::MLightProj)); Core_RMatrixSet(G_RI_MATRIX_TRANSP_VIEWPROJ, &SMMatrixTranspose(GData::MCamView * GData::MLightProj)); - GData::ObjCamera->GetPosition(&GData::ConstCurrCamPos); - GData::ObjCamera->GetLook(&GData::ConstCurrCamDir); + GData::ObjCamera->getPosition(&GData::ConstCurrCamPos); + GData::ObjCamera->getLook(&GData::ConstCurrCamDir); Core_RFloat3Set(G_RI_FLOAT3_OBSERVER_POSITION, &GData::ConstCurrCamPos); Core_RFloat3Set(G_RI_FLOAT3_OBSERVER_DIRECTION, &GData::ConstCurrCamDir); @@ -527,7 +532,7 @@ void SXRenderFunc::UpdateView() Core_RFloatSet(G_RI_FLOAT_OBSERVER_FAR, GData::NearFar.y); Core_RFloatSet(G_RI_FLOAT_OBSERVER_FOV, GData::ProjFov);*/ - GData::ObjCamera->ObjFrustum->Update(&(GData::MCamView), &(GData::MCamProj)); + GData::ObjCamera->updateFrustum(&GData::MCamProj); if (GData::DefaultGeomIDArr < 0) GData::DefaultGeomIDArr = SGeom_ModelsAddArrForCom(); @@ -823,7 +828,7 @@ void SXRenderFunc::BuildMRT(DWORD timeDelta, bool isRenderSimulation) void SXRenderFunc::UpdateShadow(DWORD timeDelta) { Core_RIntSet(G_RI_INT_RENDERSTATE, RENDER_STATE_SHADOW); - SML_LigthsComVisibleFrustumDistFor(GData::ObjCamera->ObjFrustum, &GData::ConstCurrCamPos); + SML_LigthsComVisibleFrustumDistFor(GData::ObjCamera->getFrustum(), &GData::ConstCurrCamPos); GData::DXDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_TRUE); GData::DXDevice->SetRenderState(D3DRS_ZWRITEENABLE, D3DZB_TRUE); GData::DXDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE); @@ -842,7 +847,7 @@ void SXRenderFunc::UpdateShadow(DWORD timeDelta) continue; Core_RIntSet(G_RI_INT_CURRIDLIGHT, i); - if (SML_LigthsGetShadowed(i) && (SML_LigthsComVisibleForFrustum(i, GData::ObjCamera->ObjFrustum) && SML_LigthsGetEnable(i)) /*|| (Data::Level::LightManager->Arr[i]->ShadowCube && Data::Level::LightManager->Arr[i]->ShadowCube->GetStatic() && !Data::Level::LightManager->Arr[i]->ShadowCube->GetUpdate())*/) + if (SML_LigthsGetShadowed(i) && (SML_LigthsComVisibleForFrustum(i, GData::ObjCamera->getFrustum()) && SML_LigthsGetEnable(i)) /*|| (Data::Level::LightManager->Arr[i]->ShadowCube && Data::Level::LightManager->Arr[i]->ShadowCube->GetStatic() && !Data::Level::LightManager->Arr[i]->ShadowCube->GetUpdate())*/) { if (SML_LigthsGetType(i) == LTYPE_LIGHT_GLOBAL) { diff --git a/source/render/render_func.h b/source/render/render_func.h index 7031319773ff488a91899380bf511f7e67d1259b..8e6859f6f2feb7282fdeb761a543c172242d46e7 100644 --- a/source/render/render_func.h +++ b/source/render/render_func.h @@ -1,8 +1,8 @@ -/****************************************************** -Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017 +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 See the license in LICENSE -******************************************************/ +***********************************************************/ /*! \file @@ -34,8 +34,6 @@ See the license in LICENSE #include <pp/sxpp.h> #include <decals/sxdecals.h> -extern report_func g_fnReportf; - //! пространство имен с орагнизацией рендера namespace SXRenderFunc { diff --git a/source/render/sxrender.cpp b/source/render/sxrender.cpp index c85721b49c73f71589afb5e02ddc18530c97775e..6b43a923800893b3cc71c7b4af1861eb7212e3c3 100644 --- a/source/render/sxrender.cpp +++ b/source/render/sxrender.cpp @@ -1,4 +1,9 @@ +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include "sxrender.h" #include <render/camera_update.h> @@ -13,7 +18,7 @@ report_func g_fnReportf = DefReport; #endif -#define SR_PRECOND(retval) if(!GData::DXDevice){g_fnReportf(REPORT_MSG_LEVEL_ERROR, "%s - sxrender is not init", GEN_MSG_LOCATION); return retval;} +#define SR_PRECOND(retval) if(!GData::DXDevice){LibReport(REPORT_MSG_LEVEL_ERROR, "%s - sxrender is not init", GEN_MSG_LOCATION); return retval;} //########################################################################## @@ -37,7 +42,7 @@ SX_LIB_API void SRender_0Create(const char *szName, HWND hWnd3D, HWND hWndParent if (GetLastError() == ERROR_ALREADY_EXISTS) { CloseHandle(hMutex); - g_fnReportf(-1, "%s - none unic name, sxparticles", GEN_MSG_LOCATION); + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - none unic name", GEN_MSG_LOCATION); return; } } @@ -48,7 +53,7 @@ SX_LIB_API void SRender_0Create(const char *szName, HWND hWnd3D, HWND hWndParent GData::DXDevice = SGCore_GetDXDevice(); GData::ObjCamera = SGCore_CrCamera(); - GData::ObjCamera->SetFOV(GData::ProjFov); + GData::ObjCamera->setFOV(GData::ProjFov); GData::InitAllMatrix(); @@ -97,7 +102,7 @@ SX_LIB_API void SRender_0Create(const char *szName, HWND hWnd3D, HWND hWndParent //SGCore_LoadTexLoadTextures(); } else - g_fnReportf(-1, "%s - not init argument [name], sxparticles", GEN_MSG_LOCATION); + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - not init argument [name]", GEN_MSG_LOCATION); } SX_LIB_API void SRender_AKill() diff --git a/source/render/sxrender.h b/source/render/sxrender.h index fe75890a80f967bf43b77f38029e15a9c17581a3..0954ff53f061fe9b0f5de9b1211a7f9b85fdff5f 100644 --- a/source/render/sxrender.h +++ b/source/render/sxrender.h @@ -1,8 +1,8 @@ -/****************************************************** -Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017 +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 See the license in LICENSE -******************************************************/ +***********************************************************/ /*! \file diff --git a/source/score/CallBackOgg.cpp b/source/score/CallBackOgg.cpp index d4b6630c6ef0baa27fcc855d120a9bfa97ef6a3d..da236f7fa2429d17f6139803183c795ca12b8b19 100644 --- a/source/score/CallBackOgg.cpp +++ b/source/score/CallBackOgg.cpp @@ -1,4 +1,9 @@ +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #pragma once //чтение файла diff --git a/source/score/sound.cpp b/source/score/sound.cpp index 718701bdeffee2a965f1e232378d9a9a4a01c83f..41b5ce6b54326376347326c1455e16374fc424fd 100644 --- a/source/score/sound.cpp +++ b/source/score/sound.cpp @@ -1,4 +1,9 @@ +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include "sound.h" size_t ogg_read(void *ptr, size_t size, size_t nmemb, void *datasource) @@ -81,13 +86,13 @@ void MainSound::Init(HWND hwnd) { if (FAILED(DirectSoundCreate8(NULL, &DeviceSound, NULL))) { - g_fnReportf(REPORT_MSG_LEVEL_ERROR, "%s - could not create sound device", GEN_MSG_LOCATION); + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - could not create sound device", GEN_MSG_LOCATION); return;// SOUND_INIT_ERR_INIT; } if (FAILED(DeviceSound->SetCooperativeLevel(hwnd, DSSCL_EXCLUSIVE))) { - g_fnReportf(REPORT_MSG_LEVEL_ERROR, "%s - could not create cooperative level", GEN_MSG_LOCATION); + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - could not create cooperative level", GEN_MSG_LOCATION); return;// SOUND_INIT_ERR_CL; } @@ -101,7 +106,7 @@ void MainSound::Init(HWND hwnd) if (FAILED(DeviceSound->CreateSoundBuffer(&dsbd, &DSPrimary, NULL))) { - g_fnReportf(REPORT_MSG_LEVEL_ERROR, "%s - could not create primary buffer", GEN_MSG_LOCATION); + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - could not create primary buffer", GEN_MSG_LOCATION); return;// SOUND_INIT_ERR_PRIM_BUF; } @@ -117,7 +122,7 @@ void MainSound::Init(HWND hwnd) if (FAILED(DSPrimary->SetFormat(&wfex))) { - g_fnReportf(REPORT_MSG_LEVEL_ERROR, "%s - could not init format", GEN_MSG_LOCATION); + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - could not init format", GEN_MSG_LOCATION); return;// SOUND_INIT_ERR_SET_FORMAT; } @@ -182,7 +187,7 @@ void MainSound::LoadWAV(Sound* snd, const char* fpath) if (!(snd->DSBuffer = SoundBufferCreate(&Hdr))) { - g_fnReportf(REPORT_MSG_LEVEL_ERROR, "%s - could not create sound buffer [%s]", GEN_MSG_LOCATION, snd->RPath); + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - could not create sound buffer [%s]", GEN_MSG_LOCATION, snd->RPath); return; } @@ -299,7 +304,7 @@ void MainSound::LoadOGG(Sound* snd, const char* fpath) if (ov_fopen(fpath, &ogg)) { - g_fnReportf(REPORT_MSG_LEVEL_ERROR, "%s - error reading [%s]", GEN_MSG_LOCATION, snd->RPath); + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - error reading [%s]", GEN_MSG_LOCATION, snd->RPath); return; } @@ -317,7 +322,7 @@ void MainSound::LoadOGG(Sound* snd, const char* fpath) if (!vi) { - g_fnReportf(REPORT_MSG_LEVEL_ERROR, "%s - error reading (info) [%s]", GEN_MSG_LOCATION, snd->RPath); + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - error reading (info) [%s]", GEN_MSG_LOCATION, snd->RPath); return; } @@ -342,7 +347,7 @@ void MainSound::LoadOGG(Sound* snd, const char* fpath) if (!snd->DSBuffer) { - g_fnReportf(REPORT_MSG_LEVEL_ERROR, "%s - could not create sound buffer [%s]", GEN_MSG_LOCATION, snd->RPath); + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - could not create sound buffer [%s]", GEN_MSG_LOCATION, snd->RPath); return; } @@ -421,7 +426,7 @@ void MainSound::SoundDataOGGLoad(OggVorbis_File* VorbisFile, IDirectSoundBuffer8 else if (bites_read == OV_EINVAL) { //ошибка при декодировании, нужно поставить заглушку - g_fnReportf(REPORT_MSG_LEVEL_WARNING,"OV_EINVAL"); + LibReport(REPORT_MSG_LEVEL_WARNING,"OV_EINVAL"); } else break; @@ -445,7 +450,7 @@ void MainSound::SoundDataOGGLoad(OggVorbis_File* VorbisFile, IDirectSoundBuffer8 else if (bites_read == OV_EINVAL) { //ошибка при декодировании, нужно поставить заглушку - g_fnReportf(REPORT_MSG_LEVEL_WARNING, "OV_EINVAL"); + LibReport(REPORT_MSG_LEVEL_WARNING, "OV_EINVAL"); } else break; @@ -467,7 +472,7 @@ ID MainSound::SoundCreate2d(const char *file, bool looping, DWORD size_stream) if (!Core_0FileExists(fullpath)) { - g_fnReportf(REPORT_MSG_LEVEL_ERROR, "%s - file not found [%s]", GEN_MSG_LOCATION, fullpath); + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - file not found [%s]", GEN_MSG_LOCATION, fullpath); return -1; } @@ -475,7 +480,7 @@ ID MainSound::SoundCreate2d(const char *file, bool looping, DWORD size_stream) if (fmt == SOUND_FILEFORMAT_UNKNOWN) { - g_fnReportf(REPORT_MSG_LEVEL_ERROR, "%s - unknown format [%s]", GEN_MSG_LOCATION, file); + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - unknown format [%s]", GEN_MSG_LOCATION, file); return -1; } @@ -566,13 +571,13 @@ void MainSound::SoundInstancePlay2d(ID id, int volume, int pan) if (snd->StreamSize > 0) { - g_fnReportf(REPORT_MSG_LEVEL_WARNING, "%s - can not create sound instance for streaming [%s]", GEN_MSG_LOCATION, snd->RPath); + LibReport(REPORT_MSG_LEVEL_WARNING, "%s - can not create sound instance for streaming [%s]", GEN_MSG_LOCATION, snd->RPath); return; } if (snd->Is3d) { - g_fnReportf(REPORT_MSG_LEVEL_WARNING, "%s - can not create 2d sound instance by 3d [%s]", GEN_MSG_LOCATION, snd->RPath); + LibReport(REPORT_MSG_LEVEL_WARNING, "%s - can not create 2d sound instance by 3d [%s]", GEN_MSG_LOCATION, snd->RPath); return; } @@ -593,7 +598,7 @@ void MainSound::SoundInstancePlay2d(ID id, int volume, int pan) DeviceSound->DuplicateSoundBuffer(snd->DSBuffer, &tsb); if (!tsb) { - g_fnReportf(REPORT_MSG_LEVEL_WARNING, "%s - can not create sound instance [%s], this is big problem", GEN_MSG_LOCATION, snd->RPath); + LibReport(REPORT_MSG_LEVEL_WARNING, "%s - can not create sound instance [%s], this is big problem", GEN_MSG_LOCATION, snd->RPath); return; } tsb->QueryInterface(IID_IDirectSoundBuffer8, (void**)&tsb8); @@ -626,13 +631,13 @@ void MainSound::SoundInstancePlay3d(ID id, const float3* pos) if (snd->StreamSize > 0) { - g_fnReportf(REPORT_MSG_LEVEL_WARNING, "%s - can not create sound instance for streaming [%s]", GEN_MSG_LOCATION, snd->RPath); + LibReport(REPORT_MSG_LEVEL_WARNING, "%s - can not create sound instance for streaming [%s]", GEN_MSG_LOCATION, snd->RPath); return; } if (!snd->Is3d) { - g_fnReportf(REPORT_MSG_LEVEL_WARNING, "%s - can not create 3d sound instance by 2d[%s]", GEN_MSG_LOCATION, snd->RPath); + LibReport(REPORT_MSG_LEVEL_WARNING, "%s - can not create 3d sound instance by 2d[%s]", GEN_MSG_LOCATION, snd->RPath); return; } @@ -653,7 +658,7 @@ void MainSound::SoundInstancePlay3d(ID id, const float3* pos) DeviceSound->DuplicateSoundBuffer(snd->DSBuffer, &tsb); if (!tsb) { - g_fnReportf(REPORT_MSG_LEVEL_WARNING, "%s - can not create sound instance [%s], this is big problem", GEN_MSG_LOCATION, snd->RPath); + LibReport(REPORT_MSG_LEVEL_WARNING, "%s - can not create sound instance [%s], this is big problem", GEN_MSG_LOCATION, snd->RPath); return; } tsb->QueryInterface(IID_IDirectSoundBuffer8, (void**)&tsb8); diff --git a/source/score/sound.h b/source/score/sound.h index d365d60e4d045cdbbc11bb3ea12deb807dd3fab8..a5fe99dde8c8e2cb64cce4c565091fc602ec71fb 100644 --- a/source/score/sound.h +++ b/source/score/sound.h @@ -1,4 +1,9 @@ +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #ifndef __SOUND_H #define __SOUND_H @@ -19,8 +24,6 @@ #include <common/assotiativearray.h> #include "sxscore.h" -extern report_func g_fnReportf; - struct AAStringNR : public AAString { __forceinline AAStringNR(const char * str) @@ -44,7 +47,7 @@ struct AAStringNR : public AAString #define SOUND_PRECOND(id, retval) \ if((UINT)id >= ArrSounds.size() || !(ArrSounds[id]))\ -{g_fnReportf(REPORT_MSG_LEVEL_ERROR, "%s - sxsound - unresolved address to sound %d", GEN_MSG_LOCATION, id); return retval; } +{LibReport(REPORT_MSG_LEVEL_ERROR, "%s - unresolved address to sound %d", GEN_MSG_LOCATION, id); return retval; } inline long SOUND_3D_COM_VOLUME(const float3 & snd_pos, const float3 & view_pos, const float snd_distaudible) { diff --git a/source/score/sxscore.cpp b/source/score/sxscore.cpp index 5baa139a2bfc84f9fcbe57fe0b23e5f4de38abcc..a4dc51178cb68bc1a3566a3bca666538b10f8ab7 100644 --- a/source/score/sxscore.cpp +++ b/source/score/sxscore.cpp @@ -1,8 +1,8 @@ -/****************************************************** -Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017 +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 See the license in LICENSE -******************************************************/ +***********************************************************/ #define SXSCORE_VERSION 1 @@ -16,7 +16,7 @@ report_func g_fnReportf = DefReport; MainSound* MSound = 0; -#define SCORE_PRECOND(retval) if(!MSound){g_fnReportf(-1, "%s - sxsound is not init", GEN_MSG_LOCATION); return retval;} +#define SCORE_PRECOND(retval) if(!MSound){LibReport(-1, "%s - sxsound is not init", GEN_MSG_LOCATION); return retval;} //########################################################################## @@ -40,7 +40,7 @@ SX_LIB_API void SSCore_0Create(const char* name, HWND hwnd, bool is_unic) if (GetLastError() == ERROR_ALREADY_EXISTS) { CloseHandle(hMutex); - g_fnReportf(-1, "%s - none unic name, sxsound", GEN_MSG_LOCATION); + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - none unic name", GEN_MSG_LOCATION); } else { @@ -55,7 +55,7 @@ SX_LIB_API void SSCore_0Create(const char* name, HWND hwnd, bool is_unic) } } else - g_fnReportf(-1, "%s - not init argument [name], sxsound", GEN_MSG_LOCATION); + LibReport(REPORT_MSG_LEVEL_ERROR, "%s - not init argument [name]", GEN_MSG_LOCATION); } SX_LIB_API void SSCore_AKill() diff --git a/source/score/sxscore.h b/source/score/sxscore.h index 18c2650f59151fce499c702fe4f8bba0578a8359..60bb521832c017a0e3248c2cafca5a11e28f3512 100644 --- a/source/score/sxscore.h +++ b/source/score/sxscore.h @@ -1,8 +1,8 @@ -/****************************************************** -Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017 +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 See the license in LICENSE -******************************************************/ +***********************************************************/ /*! \file diff --git a/source/score/sxscore_dll.cpp b/source/score/sxscore_dll.cpp index 40901c2f92ac2b50d40832d6b83247e81e889fce..a34ff74f606bdc80ad683796dbf5ca09502303a5 100644 --- a/source/score/sxscore_dll.cpp +++ b/source/score/sxscore_dll.cpp @@ -1,10 +1,9 @@ -/****************************************************** -Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017 +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 See the license in LICENSE -******************************************************/ +***********************************************************/ -#pragma once #include <windows.h> BOOL APIENTRY DllMain(HMODULE hModule, diff --git a/source/skyxengine.cpp b/source/skyxengine.cpp index 97bf1bf4b201e91f4e40e12a127b3186431248e0..b2e1b62e1d1a92d3e7a12049744b221aa6b6f3c4 100644 --- a/source/skyxengine.cpp +++ b/source/skyxengine.cpp @@ -1,4 +1,9 @@ +/*********************************************************** +Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include "SkyXEngine.h" //########################################################################## @@ -61,39 +66,71 @@ void SkyXEngine_InitOutLog() } } -void SkyXEngine_PrintfLog(int level, const char *szFormat, ...) +void SkyXEngine_PrintfLog(int iLevel, const char *szLibName, const char *szFormat, ...) { - va_list va; + /*va_list va; char buf[REPORT_MSG_MAX_LEN]; va_start(va, szFormat); vsprintf_s(buf, REPORT_MSG_MAX_LEN, szFormat, va); + va_end(va);*/ + + static char szStr[REPORT_MSG_MAX_LEN]; + szStr[0] = 0; + static char szStr2[REPORT_MSG_MAX_LEN]; + szStr2[0] = 0; + int iStrLen = sizeof(szStr); + + va_list va; + va_start(va, szFormat); + vsprintf_s(szStr, REPORT_MSG_MAX_LEN, szFormat, va); va_end(va); if (g_pFileOutLog) { - if (level == REPORT_MSG_LEVEL_ERROR) + if (szStr[0] != ' ' && szStr[0] != '\t') + sprintf(szStr2, "%s%s%s: ", COLOR_GREEN, szLibName, COLOR_RESET); + + /*if (iLevel == REPORT_MSG_LEVEL_ERROR) { printf(COLOR_LRED "! "); fwrite("! ", 1, 2, g_pFileOutLog); } - else if (level == REPORT_MSG_LEVEL_WARNING) + else if (iLevel == REPORT_MSG_LEVEL_WARNING) { printf(COLOR_YELLOW "* "); fwrite("* ", 1, 2, g_pFileOutLog); } printf(buf); - if (level == REPORT_MSG_LEVEL_ERROR || level == REPORT_MSG_LEVEL_WARNING) + if (iLevel == REPORT_MSG_LEVEL_ERROR || iLevel == REPORT_MSG_LEVEL_WARNING) { printf(COLOR_RESET); + }*/ + + if (iLevel == REPORT_MSG_LEVEL_ERROR) + { + sprintf(szStr2 + strlen(szStr2), "%s", COLOR_LRED); + } + else if (iLevel == REPORT_MSG_LEVEL_WARNING) + { + sprintf(szStr2 + strlen(szStr2), "%s", COLOR_YELLOW); + } + + sprintf(szStr2 + strlen(szStr2), "%s", szStr); + + if (iLevel == REPORT_MSG_LEVEL_ERROR || iLevel == REPORT_MSG_LEVEL_WARNING) + { + sprintf(szStr2 + strlen(szStr2), "%s", COLOR_RESET); } - fwrite(buf, 1, strlen(buf), g_pFileOutLog); + + printf(szStr2); + fwrite(szStr2, 1, strlen(szStr2), g_pFileOutLog); //fprintf(FileOutLog, "\n"); fflush(g_pFileOutLog); - if (level == REPORT_MSG_LEVEL_ERROR) + if (iLevel == REPORT_MSG_LEVEL_ERROR) { - SkyXEngine_HandlerError(buf); + SkyXEngine_HandlerError(szStr2); } } } @@ -513,7 +550,7 @@ void SkyXEngine_Frame(DWORD timeDelta) if (!pDXDevice) { - SkyXEngine_PrintfLog(REPORT_MSG_LEVEL_ERROR, "dxdevice not found ..."); + SkyXEngine_PrintfLog(REPORT_MSG_LEVEL_ERROR, "SkyXEngine_Frame", "dxdevice not found ..."); return; } @@ -762,7 +799,7 @@ void SkyXEngine_Frame(DWORD timeDelta) DelayUpdateVisibleForLight += TimeGetMcsU(Core_RIntGet(G_RI_INT_TIMER_RENDER)) - ttime; ttime = TimeGetMcsU(Core_RIntGet(G_RI_INT_TIMER_RENDER)); - SPE_EffectVisibleComAll(SRender_GetCamera()->ObjFrustum, &vCamPos); + SPE_EffectVisibleComAll(SRender_GetCamera()->getFrustum(), &vCamPos); SPE_EffectComputeAll(); SPE_EffectComputeLightingAll(); DelayUpdateParticles += TimeGetMcsU(Core_RIntGet(G_RI_INT_TIMER_RENDER)) - ttime; diff --git a/source/sxae/Camera.cpp b/source/sxae/Camera.cpp index ab62d2f12c75a7da07b5b23611bbfa50ce7951dd..bda3832d53df7dcc143bdc3a24dbd8de8d9852c2 100644 --- a/source/sxae/Camera.cpp +++ b/source/sxae/Camera.cpp @@ -1,3 +1,9 @@ + +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include "Camera.h" Camera::Camera(): diff --git a/source/sxae/Camera.h b/source/sxae/Camera.h index 197ea65dddef1403b8c3b984b1edd4120f646099..89517779537ad74e368a157bc8e20eb1bbf1ea76 100644 --- a/source/sxae/Camera.h +++ b/source/sxae/Camera.h @@ -1,5 +1,11 @@ -#ifndef CAMERA_H -#define CAMERA_H + +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + +#ifndef __CAMERA_H +#define __CAMERA_H #include <common/SXMath.h> diff --git a/source/sxae/EMessages.h b/source/sxae/EMessages.h index e98294649fdfb0dec0dce71edeff556ec9a05086..35514c25b73b6ce325499662b076c2c999a9756f 100644 --- a/source/sxae/EMessages.h +++ b/source/sxae/EMessages.h @@ -1,5 +1,11 @@ -#ifndef EMessages_H -#define EMessages_H + +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + +#ifndef __EMESSAGES_H +#define __EMESSAGES_H #include <Windows.h> diff --git a/source/sxae/Editor.cpp b/source/sxae/Editor.cpp index 02288683667b55d5a77322e0b6d25174ee365983..b624fc6ac13491e916e15fae77433ce322c2a9c9 100644 --- a/source/sxae/Editor.cpp +++ b/source/sxae/Editor.cpp @@ -1,3 +1,9 @@ + +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include "Editor.h" #include <Commdlg.h> diff --git a/source/sxae/Editor.h b/source/sxae/Editor.h index 0d35632bab9d7ddcbd3568c30763e2ead11baa66..af22a898929d0c30b121a35155315d5b5f0e8abc 100644 --- a/source/sxae/Editor.h +++ b/source/sxae/Editor.h @@ -1,5 +1,11 @@ -#ifndef Editor_H -#define Editor_H + +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + +#ifndef __EDITOR_H +#define __EDITOR_H #define MAINWIN_SIZE_X 1320 #define MAINWIN_SIZE_Y 730 diff --git a/source/sxae/EditorTab.cpp b/source/sxae/EditorTab.cpp index 3108af6ed1b8fe6ce4c8b70e90d4c7a86745ebff..f06f57d9533b5aeec3cee1c2812dc3ff4b4619f5 100644 --- a/source/sxae/EditorTab.cpp +++ b/source/sxae/EditorTab.cpp @@ -1,4 +1,9 @@ +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include "EditorTab.h" EditorTab::EditorTab(TabManager * tm): diff --git a/source/sxae/EditorTab.h b/source/sxae/EditorTab.h index 099d2609763cbb04a5ccf151b0093e44b1ad2c9c..7a0867d13c0502c8bcc10744faa6786b488235ff 100644 --- a/source/sxae/EditorTab.h +++ b/source/sxae/EditorTab.h @@ -1,5 +1,11 @@ -#ifndef EditorTab_H -#define EditorTab_H + +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + +#ifndef __EDITOR_TAB_H +#define __EDITOR_TAB_H #include "TabManager.h" #include <SXGUIWinApi/sxgui.h> diff --git a/source/sxae/TabActivities.cpp b/source/sxae/TabActivities.cpp index 14f35dad151d1636dee1a43e90b24fe3232aa3d2..2c14f5173870aabd4c5c2045243338a3fa6f4564 100644 --- a/source/sxae/TabActivities.cpp +++ b/source/sxae/TabActivities.cpp @@ -1,3 +1,9 @@ + +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include "TabActivities.h" #include "Tools.h" diff --git a/source/sxae/TabActivities.h b/source/sxae/TabActivities.h index 5a5e8a0345b28145479b93937be4fec48b952704..533cf4931752232d3031fa7b4d30f750ea8c9550 100644 --- a/source/sxae/TabActivities.h +++ b/source/sxae/TabActivities.h @@ -1,5 +1,11 @@ -#ifndef TabActivities_H -#define TabActivities_H + +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + +#ifndef __TAB_ACTIVITIES_H +#define __TAB_ACTIVITIES_H #include "EditorTab.h" #include <anim/animated.h> diff --git a/source/sxae/TabAnimation.cpp b/source/sxae/TabAnimation.cpp index 1fdfacf2e19a60bebd5b71f112235b36d582f912..6e81dbe420d02ff69392bd226405aedccdd15544 100644 --- a/source/sxae/TabAnimation.cpp +++ b/source/sxae/TabAnimation.cpp @@ -1,3 +1,9 @@ + +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include "TabAnimation.h" TabAnimation::TabAnimation(TabManager * tm):EditorTab(tm) diff --git a/source/sxae/TabAnimation.h b/source/sxae/TabAnimation.h index c586570d7c3ca92ab21083c1f7019215b7f6c335..4c8bf8b9f9019a20d02dea4438bb1c03abe522c1 100644 --- a/source/sxae/TabAnimation.h +++ b/source/sxae/TabAnimation.h @@ -1,5 +1,11 @@ -#ifndef TabAnimation_H -#define TabAnimation_H + +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + +#ifndef __TAB_ANIMATION_H +#define __TAB_ANIMATION_H #include "EditorTab.h" diff --git a/source/sxae/TabAttachments.cpp b/source/sxae/TabAttachments.cpp index e80cd0315196c37a0abfcb7af68e5acc5a6e6885..dea3e7e8a6ad34c91764cb7c51b32c025ce96924 100644 --- a/source/sxae/TabAttachments.cpp +++ b/source/sxae/TabAttachments.cpp @@ -1,3 +1,9 @@ + +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include "TabAttachments.h" TabAttachments::TabAttachments(TabManager * tm):EditorTab(tm) diff --git a/source/sxae/TabAttachments.h b/source/sxae/TabAttachments.h index 8c6893829747bfb2d8fbde22b42c3f17df843f11..4b38e0e892bff777ae41f0301eb75b0e31609687 100644 --- a/source/sxae/TabAttachments.h +++ b/source/sxae/TabAttachments.h @@ -1,5 +1,11 @@ -#ifndef TabAttachments_H -#define TabAttachments_H + +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + +#ifndef __TAB_ATTACHMENTS_H +#define __TAB_ATTACHMENTS_H #include "EditorTab.h" diff --git a/source/sxae/TabControllers.cpp b/source/sxae/TabControllers.cpp index 7e231b403f0de1060e8cadc990aa78d514b7367c..9b9db41cb779ce664a43761a53eeed71c870e86d 100644 --- a/source/sxae/TabControllers.cpp +++ b/source/sxae/TabControllers.cpp @@ -1,3 +1,9 @@ + +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include "TabControllers.h" TabControllers::TabControllers(TabManager * tm):EditorTab(tm) diff --git a/source/sxae/TabControllers.h b/source/sxae/TabControllers.h index 87c9ec49f246dff74fb511c24c367618dc05b231..c39e20361948c2eb22f6eca8c3cf68f079871e3a 100644 --- a/source/sxae/TabControllers.h +++ b/source/sxae/TabControllers.h @@ -1,5 +1,11 @@ -#ifndef TabControllers_H -#define TabControllers_H + +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + +#ifndef __TAB_CONTROLLERS_H +#define __TAB_CONTROLLERS_H #include "EditorTab.h" diff --git a/source/sxae/TabFiles.cpp b/source/sxae/TabFiles.cpp index 3eec45e5ea1c1ca7969ecc868b22731c35c3113f..c7d81059f0500f994dc7508d6a910fc7852e1cf2 100644 --- a/source/sxae/TabFiles.cpp +++ b/source/sxae/TabFiles.cpp @@ -1,3 +1,9 @@ + +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include "TabFiles.h" TabFiles::TabFiles(TabManager * tm):EditorTab(tm) diff --git a/source/sxae/TabFiles.h b/source/sxae/TabFiles.h index 11b06cc045adb779c2f4aa6913d567d97fbfa599..7f91b8aa603dc836705abc7bf62f10e255873bfc 100644 --- a/source/sxae/TabFiles.h +++ b/source/sxae/TabFiles.h @@ -1,5 +1,11 @@ -#ifndef TabFiles_H -#define TabFiles_H + +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + +#ifndef __TAB_FILES_H +#define __TAB_FILES_H #include "EditorTab.h" diff --git a/source/sxae/TabHitboxes.cpp b/source/sxae/TabHitboxes.cpp index 483952f5e1a99028a8b13c3437f0033d1c143c2d..36742fba67485430fcc093748147e1b3d25e42d5 100644 --- a/source/sxae/TabHitboxes.cpp +++ b/source/sxae/TabHitboxes.cpp @@ -1,3 +1,9 @@ + +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include "TabHitboxes.h" #include <anim/ModelFile.h> diff --git a/source/sxae/TabHitboxes.h b/source/sxae/TabHitboxes.h index edb55fd70c1ce30a51265438a9674303b3a9c604..e62bc84060e88d2c55c8756f47ee46304afe0141 100644 --- a/source/sxae/TabHitboxes.h +++ b/source/sxae/TabHitboxes.h @@ -1,5 +1,11 @@ -#ifndef TabHitboxes_H -#define TabHitboxes_H + +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + +#ifndef __TAB_HITBOXES_H +#define __TAB_HITBOXES_H #include "EditorTab.h" diff --git a/source/sxae/TabManager.cpp b/source/sxae/TabManager.cpp index 854b0486fc5a9a1c921328cfee0f60ad75eb5ee7..f4fb71bd50348ff1b5d858366d06870c6f14983b 100644 --- a/source/sxae/TabManager.cpp +++ b/source/sxae/TabManager.cpp @@ -1,3 +1,9 @@ + +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include "TabManager.h" #include "TabAttachments.h" diff --git a/source/sxae/TabManager.h b/source/sxae/TabManager.h index ad081be7be748c1c0c8a72b3606f45f1034da88e..aa2a181ec381e68974ea9c583ee5db72063c2897 100644 --- a/source/sxae/TabManager.h +++ b/source/sxae/TabManager.h @@ -1,5 +1,11 @@ -#ifndef TabManager_H -#define TabManager_H + +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + +#ifndef __TAB_MANAGER_H +#define __TAB_MANAGER_H class EditorTab; struct ISXGUIBaseWnd; diff --git a/source/sxae/TabSkins.cpp b/source/sxae/TabSkins.cpp index 909ac472e8a34de15666f1fa530b859ff83e4892..adce7dc6231e9bae3a410cf52cfa71309447adfa 100644 --- a/source/sxae/TabSkins.cpp +++ b/source/sxae/TabSkins.cpp @@ -1,3 +1,9 @@ + +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include "TabSkins.h" TabSkins::TabSkins(TabManager * tm):EditorTab(tm) diff --git a/source/sxae/TabSkins.h b/source/sxae/TabSkins.h index 525ab50227a42e40ccf2cc83b4bd8e3b3218aadd..d014dab211aa9a4a15a6115b72f4dff6dda3d224 100644 --- a/source/sxae/TabSkins.h +++ b/source/sxae/TabSkins.h @@ -1,5 +1,11 @@ -#ifndef TabSkins_H -#define TabSkins_H + +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + +#ifndef __TAB_SKINS_H +#define __TAB_SKINS_H #include "EditorTab.h" diff --git a/source/sxae/Tools.cpp b/source/sxae/Tools.cpp index f77748f400b548ec196a4b9e2e4b66886afa593b..a8f2b91a08afcc8875b644b028f0b591a5d6e58a 100644 --- a/source/sxae/Tools.cpp +++ b/source/sxae/Tools.cpp @@ -1,3 +1,9 @@ + +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include "Tools.h" #include <windows.h> diff --git a/source/sxae/Tools.h b/source/sxae/Tools.h index 532ec9f6e82feb2bf991cf39ee21921fb08bea29..4bcd416a91a96759924812fac46787e23b368626 100644 --- a/source/sxae/Tools.h +++ b/source/sxae/Tools.h @@ -1,5 +1,11 @@ -#ifndef Tools_H -#define Tools_H + +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + +#ifndef __TOOLS_H +#define __TOOLS_H #include <Windows.h> diff --git a/source/sxae/main.cpp b/source/sxae/main.cpp index 787d074c7b82e9fa16b506b63870c481175ba744..b66a0be942f9373bc50e1ac34425df44537b78f3 100644 --- a/source/sxae/main.cpp +++ b/source/sxae/main.cpp @@ -1,4 +1,9 @@ +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + //#define WIN32_LEAN_AND_MEAN #include <Windows.h> diff --git a/source/sxae/ui.cpp b/source/sxae/ui.cpp index 1bb57846b1f5bd4a6dec3f7b40dafc4cc0f13ed6..5a9ced1aafb43f4ce6a7f1c847bdd84eef785bbf 100644 --- a/source/sxae/ui.cpp +++ b/source/sxae/ui.cpp @@ -1,3 +1,9 @@ + +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + //include the header file and the lib file #include <SXGUIWinApi/sxguielements.h> diff --git a/source/sxconsole/ColorPrint.cpp b/source/sxconsole/ColorPrint.cpp index b1c775c7aeab0d4df99313a77fe13afe7c8b18a1..c0cf5073481dea5dc43940c565bd7687f396dfde 100644 --- a/source/sxconsole/ColorPrint.cpp +++ b/source/sxconsole/ColorPrint.cpp @@ -1,3 +1,9 @@ + +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include "ColorPrint.h" diff --git a/source/sxconsole/ColorPrint.h b/source/sxconsole/ColorPrint.h index bc5e0f7dc36d86fa171d3b3318a5b17978ab3ac3..32864f68e6c4ed61a2ff8596fd5649b68fdc80e3 100644 --- a/source/sxconsole/ColorPrint.h +++ b/source/sxconsole/ColorPrint.h @@ -1,5 +1,11 @@ -#ifndef _ColorPrint_H_ -#define _ColorPrint_H_ + +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + +#ifndef __COLOR_PRINT_H +#define __COLOR_PRINT_H #include <windows.h> diff --git a/source/sxconsole/sxconsole.cpp b/source/sxconsole/sxconsole.cpp index 7f49561984126196da7636cf4f9ba333e30c130e..61c8b6670b0ea8a422f2fe257436f59c7dcc5450 100644 --- a/source/sxconsole/sxconsole.cpp +++ b/source/sxconsole/sxconsole.cpp @@ -1,3 +1,9 @@ + +/*********************************************************** +Copyright � Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018 +See the license in LICENSE +***********************************************************/ + #include <stdio.h> #include <stdlib.h>