1
0
forked from metin2/client

Solution refactoring and restructuring, removed Boost dependency, removed unused tools

This commit is contained in:
2022-11-21 23:42:01 +02:00
parent 33f19f9ff6
commit 9ef9f39e88
817 changed files with 326 additions and 59698 deletions

View File

@ -0,0 +1,374 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Distribute|Win32">
<Configuration>Distribute</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="MfcDebug|Win32">
<Configuration>MfcDebug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="MfcRelease|Win32">
<Configuration>MfcRelease</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="VTune|Win32">
<Configuration>VTune</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>17.0</VCProjectVersion>
<ProjectName>PRTerrainLib</ProjectName>
<ProjectGuid>{8B1D0DDE-A521-4EB2-9544-F606376278CC}</ProjectGuid>
<RootNamespace>PRTerrainLib</RootNamespace>
<SccProjectName>SAK</SccProjectName>
<SccAuxPath>SAK</SccAuxPath>
<SccLocalPath>SAK</SccLocalPath>
<SccProvider>SAK</SccProvider>
<Keyword>MFCProj</Keyword>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<PlatformToolset>v143</PlatformToolset>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v143</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='VTune|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<PlatformToolset>v143</PlatformToolset>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='MfcRelease|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<PlatformToolset>v143</PlatformToolset>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Distribute|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<PlatformToolset>v143</PlatformToolset>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='MfcDebug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<PlatformToolset>v143</PlatformToolset>
<UseOfMfc>Static</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='VTune|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='MfcRelease|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Distribute|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='MfcDebug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>17.0.32203.90</_ProjectFileVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='MfcDebug|Win32'">
<OutDir>$(SolutionDir)build\$(Configuration)\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Distribute|Win32'">
<OutDir>$(SolutionDir)build\$(Configuration)\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='MfcRelease|Win32'">
<OutDir>$(SolutionDir)build\$(Configuration)\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='VTune|Win32'">
<OutDir>$(SolutionDir)build\$(Configuration)\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>$(SolutionDir)build\$(Configuration)\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>$(SolutionDir)build\$(Configuration)\</OutDir>
</PropertyGroup>
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<VcpkgUseStatic>true</VcpkgUseStatic>
<VcpkgConfiguration>$(Configuration)</VcpkgConfiguration>
</PropertyGroup>
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Distribute|Win32'">
<VcpkgUseStatic>true</VcpkgUseStatic>
<VcpkgConfiguration>$(Configuration)</VcpkgConfiguration>
</PropertyGroup>
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<VcpkgUseStatic>true</VcpkgUseStatic>
<VcpkgConfiguration>$(Configuration)</VcpkgConfiguration>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='MfcDebug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>.;../../extern/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>.\PRTerrainLib___Win32_MfcDebug/PRTerrainLib.pch</PrecompiledHeaderOutputFile>
<AssemblerListingLocation>.\PRTerrainLib___Win32_MfcDebug/</AssemblerListingLocation>
<ObjectFileName>.\PRTerrainLib___Win32_MfcDebug/</ObjectFileName>
<ProgramDataBaseFileName>.\PRTerrainLib___Win32_MfcDebug/</ProgramDataBaseFileName>
<BrowseInformation />
<WarningLevel>Level3</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0412</Culture>
</ResourceCompile>
<Lib>
<OutputFile>.\PRTerrainLib___Win32_MfcDebug\PRTerrainLib.lib</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Distribute|Win32'">
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<AdditionalIncludeDirectories>$(SolutionDir)extern\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>.\Distribute/PRTerrainLib.pch</PrecompiledHeaderOutputFile>
<AssemblerOutput>All</AssemblerOutput>
<AssemblerListingLocation>.\Distribute/</AssemblerListingLocation>
<ObjectFileName>.\Distribute/</ObjectFileName>
<ProgramDataBaseFileName>.\Distribute/</ProgramDataBaseFileName>
<BrowseInformation />
<WarningLevel>Level3</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<CompileAs>Default</CompileAs>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0412</Culture>
</ResourceCompile>
<Lib>
<SuppressStartupBanner>true</SuppressStartupBanner>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='MfcRelease|Win32'">
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<AdditionalIncludeDirectories>.;../../extern/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>.\PRTerrainLib___Win32_MfcRelease/PRTerrainLib.pch</PrecompiledHeaderOutputFile>
<AssemblerOutput>All</AssemblerOutput>
<AssemblerListingLocation>.\PRTerrainLib___Win32_MfcRelease/</AssemblerListingLocation>
<ObjectFileName>.\PRTerrainLib___Win32_MfcRelease/</ObjectFileName>
<ProgramDataBaseFileName>.\PRTerrainLib___Win32_MfcRelease/</ProgramDataBaseFileName>
<BrowseInformation />
<WarningLevel>Level3</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0412</Culture>
</ResourceCompile>
<Lib>
<OutputFile>.\PRTerrainLib___Win32_MfcRelease\PRTerrainLib.lib</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='VTune|Win32'">
<ClCompile>
<AdditionalOptions>/Gs %(AdditionalOptions)</AdditionalOptions>
<Optimization>Disabled</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<AdditionalIncludeDirectories>.;../../extern/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>.\VTune/PRTerrainLib.pch</PrecompiledHeaderOutputFile>
<AssemblerOutput>All</AssemblerOutput>
<AssemblerListingLocation>.\VTune/</AssemblerListingLocation>
<ObjectFileName>.\VTune/</ObjectFileName>
<ProgramDataBaseFileName>.\VTune/</ProgramDataBaseFileName>
<BrowseInformation />
<WarningLevel>Level3</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<CompileAs>Default</CompileAs>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0412</Culture>
</ResourceCompile>
<Lib>
<OutputFile>.\VTune\PRTerrainLib.lib</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<AdditionalIncludeDirectories>$(SolutionDir)extern\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>.\Release/PRTerrainLib.pch</PrecompiledHeaderOutputFile>
<AssemblerListingLocation>.\Release/</AssemblerListingLocation>
<ObjectFileName>.\Release/</ObjectFileName>
<ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName>
<BrowseInformation />
<WarningLevel>Level3</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<CompileAs>Default</CompileAs>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0412</Culture>
</ResourceCompile>
<Lib>
<SuppressStartupBanner>true</SuppressStartupBanner>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>$(SolutionDir)extern\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>.\Debug/PRTerrainLib.pch</PrecompiledHeaderOutputFile>
<AssemblerListingLocation>.\Debug/</AssemblerListingLocation>
<ObjectFileName>.\Debug/</ObjectFileName>
<ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName>
<BrowseInformation />
<WarningLevel>Level3</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<CompileAs>Default</CompileAs>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0412</Culture>
</ResourceCompile>
<Lib>
<SuppressStartupBanner>true</SuppressStartupBanner>
</Lib>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="StdAfx.cpp">
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<BrowseInformation Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</BrowseInformation>
<Optimization Condition="'$(Configuration)|$(Platform)'=='Distribute|Win32'">MaxSpeed</Optimization>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Distribute|Win32'">Create</PrecompiledHeader>
<Optimization Condition="'$(Configuration)|$(Platform)'=='MfcDebug|Win32'">Disabled</Optimization>
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='MfcDebug|Win32'">EnableFastChecks</BasicRuntimeChecks>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='MfcDebug|Win32'">Create</PrecompiledHeader>
<BrowseInformation Condition="'$(Configuration)|$(Platform)'=='MfcDebug|Win32'">true</BrowseInformation>
<Optimization Condition="'$(Configuration)|$(Platform)'=='MfcRelease|Win32'">MaxSpeed</Optimization>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='MfcRelease|Win32'">Create</PrecompiledHeader>
<Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
<FavorSizeOrSpeed Condition="'$(Configuration)|$(Platform)'=='VTune|Win32'">Size</FavorSizeOrSpeed>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='VTune|Win32'">Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="Terrain.cpp">
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
<BrowseInformation Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</BrowseInformation>
<Optimization Condition="'$(Configuration)|$(Platform)'=='Distribute|Win32'">MaxSpeed</Optimization>
<Optimization Condition="'$(Configuration)|$(Platform)'=='MfcDebug|Win32'">Disabled</Optimization>
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='MfcDebug|Win32'">EnableFastChecks</BasicRuntimeChecks>
<BrowseInformation Condition="'$(Configuration)|$(Platform)'=='MfcDebug|Win32'">true</BrowseInformation>
<Optimization Condition="'$(Configuration)|$(Platform)'=='MfcRelease|Win32'">MaxSpeed</Optimization>
<Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
<FavorSizeOrSpeed Condition="'$(Configuration)|$(Platform)'=='VTune|Win32'">Size</FavorSizeOrSpeed>
</ClCompile>
<ClCompile Include="TextureSet.cpp">
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
<BrowseInformation Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</BrowseInformation>
<Optimization Condition="'$(Configuration)|$(Platform)'=='Distribute|Win32'">MaxSpeed</Optimization>
<Optimization Condition="'$(Configuration)|$(Platform)'=='MfcDebug|Win32'">Disabled</Optimization>
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='MfcDebug|Win32'">EnableFastChecks</BasicRuntimeChecks>
<BrowseInformation Condition="'$(Configuration)|$(Platform)'=='MfcDebug|Win32'">true</BrowseInformation>
<Optimization Condition="'$(Configuration)|$(Platform)'=='MfcRelease|Win32'">MaxSpeed</Optimization>
<Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
<FavorSizeOrSpeed Condition="'$(Configuration)|$(Platform)'=='VTune|Win32'">Size</FavorSizeOrSpeed>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="StdAfx.h" />
<ClInclude Include="Terrain.h" />
<ClInclude Include="TerrainType.h" />
<ClInclude Include="TextureSet.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{e4ddedef-00a9-4fe1-adfe-d26a523ce885}</UniqueIdentifier>
<Extensions>cpp;c;cxx;rc;def;r;odl;idl;hpj;bat</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{24feacf7-627a-4ab2-b5b9-acedeb4ce742}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="StdAfx.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Terrain.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="TextureSet.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="StdAfx.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Terrain.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="TerrainType.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="TextureSet.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>

View File

@ -0,0 +1,10 @@
// stdafx.cpp : source file that includes just the standard includes
// PRTerrainLib.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
/* Fast Float<->Integer conversion */
float PR_FCNV;
long PR_ICNV;

31
src/PRTerrainLib/StdAfx.h Normal file
View File

@ -0,0 +1,31 @@
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#if !defined(AFX_STDAFX_H__EECC0C4D_07A5_4D9E_B40F_767A80FD6DE6__INCLUDED_)
#define AFX_STDAFX_H__EECC0C4D_07A5_4D9E_B40F_767A80FD6DE6__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
// TODO: reference additional headers your program requires here
#pragma warning(disable:4702)
//#include <crtdbg.h>
#include "../EterLib/StdAfx.h"
#include "../EterGrnLib/StdAfx.h"
#include "../scriptLib/StdAfx.h"
/* Fast Float<->Integer conversion */
extern float PR_FCNV;
extern long PR_ICNV;
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_STDAFX_H__EECC0C4D_07A5_4D9E_B40F_767A80FD6DE6__INCLUDED_)

View File

@ -0,0 +1,324 @@
#include "Stdafx.h"
#include "../eterPack/EterPackManager.h"
#include "terrain.h"
#include <math.h>
//////////////////////////////////////////////////////////////////////////
// Texture Set
//////////////////////////////////////////////////////////////////////////
CTextureSet * CTerrainImpl::ms_pTextureSet = NULL;
void CTerrainImpl::SetTextureSet(CTextureSet * pTextureSet)
{
static CTextureSet s_EmptyTextureSet;
if (!pTextureSet)
ms_pTextureSet = &s_EmptyTextureSet;
else
ms_pTextureSet = pTextureSet;
}
CTextureSet * CTerrainImpl::GetTextureSet()
{
if (!ms_pTextureSet)
SetTextureSet(NULL);
return ms_pTextureSet;
}
CTerrainImpl::CTerrainImpl()
{
Initialize();
}
CTerrainImpl::~CTerrainImpl()
{
Clear();
}
void CTerrainImpl::Initialize()
{
memset(m_lWaterHeight, -1, sizeof(m_lWaterHeight));
m_byNumWater = 0;
memset(&m_HeightMapHeader, 0, sizeof(TGA_HEADER));
memset(&m_awShadowMap, 0xFFFF, sizeof(m_awShadowMap));
memset(&m_lpAlphaTexture, NULL, sizeof(m_lpAlphaTexture));
m_lViewRadius = 0;
m_wTileMapVersion = 8976;
m_fHeightScale = 0.0f;
m_lpShadowTexture = NULL;
m_lSplatTilesX = 0;
m_lSplatTilesY = 0;
}
void CTerrainImpl::Clear()
{
for (DWORD i = 0; i < GetTextureSet()->GetTextureCount(); ++i)
{
if (m_lpAlphaTexture[i])
{
m_lpAlphaTexture[i]->Release();
m_lpAlphaTexture[i] = NULL;
}
}
Initialize();
}
bool CTerrainImpl::LoadHeightMap(const char*c_szFileName)
{
Tracef("LoadRawHeightMapFile %s ", c_szFileName);
CMappedFile kMappedFile;
LPCVOID lpcvFileData;
if (!CEterPackManager::Instance().Get(kMappedFile, c_szFileName, &lpcvFileData))
{
Tracen("Error");
TraceError("CTerrainImpl::LoadHeightMap - %s OPEN ERROR", c_szFileName);
return false;
}
memcpy(m_awRawHeightMap, lpcvFileData, sizeof(WORD)*HEIGHTMAP_RAW_XSIZE*HEIGHTMAP_RAW_YSIZE);
return true;
}
bool CTerrainImpl::LoadAttrMap(const char *c_szFileName)
{
DWORD dwStart = ELTimer_GetMSec();
Tracef("LoadAttrMapFile %s ", c_szFileName);
CMappedFile kMappedFile;
LPCVOID lpcvFileData;
if (!CEterPackManager::Instance().Get(kMappedFile, c_szFileName, &lpcvFileData))
{
TraceError("CTerrainImpl::LoadAttrMap - %s OPEN ERROR", c_szFileName);
return false;
}
DWORD dwFileSize = kMappedFile.Size();
BYTE * abFileData = (BYTE *) lpcvFileData;
// LoadAttrMap
{
#pragma pack(push)
#pragma pack(1)
struct SAttrMapHeader
{
WORD m_wMagic;
WORD m_wWidth;
WORD m_wHeight;
};
#pragma pack(pop)
if (dwFileSize < sizeof(SAttrMapHeader))
{
TraceError(" CTerrainImpl::LoadAttrMap - %s FILE SIZE ERROR", c_szFileName);
return false;
}
SAttrMapHeader kAttrMapHeader;
memcpy(&kAttrMapHeader, abFileData, sizeof(kAttrMapHeader));
const WORD c_wAttrMapMagic = 2634;
if (c_wAttrMapMagic != kAttrMapHeader.m_wMagic)
{
TraceError("CTerrainImpl::LoadAttrMap - %s MAGIC NUMBER(%d!=MAGIC[%d]) ERROR", c_szFileName, kAttrMapHeader.m_wMagic, kAttrMapHeader.m_wMagic);
return false;
}
if (ATTRMAP_XSIZE != kAttrMapHeader.m_wWidth)
{
TraceError("CTerrainImpl::LoadAttrMap - kAttrMapHeader(%s).m_width(%d)!=ATTRMAP_XSIZE(%d)", c_szFileName, kAttrMapHeader.m_wWidth, ATTRMAP_XSIZE);
return false;
}
if (ATTRMAP_YSIZE != kAttrMapHeader.m_wHeight)
{
TraceError("CTerrainImpl::LoadAttrMap - kAttrMapHeader(%s).m_height(%d)!=ATTRMAP_YSIZE(%d)", c_szFileName, kAttrMapHeader.m_wHeight, ATTRMAP_YSIZE);
return false;
}
DWORD dwFileRestSize=dwFileSize-sizeof(kAttrMapHeader);
DWORD dwFileNeedSize=sizeof(m_abyAttrMap);
if (dwFileRestSize != dwFileNeedSize)
{
TraceError("CTerrainImpl::LoadAttrMap - %s FILE DATA SIZE(rest %d != need %d) ERROR", c_szFileName, dwFileRestSize, dwFileNeedSize);
return false;
}
BYTE* abSrcAttrData= abFileData+sizeof(kAttrMapHeader);
memcpy(m_abyAttrMap, abSrcAttrData, sizeof(m_abyAttrMap));
}
Tracef("%d\n", ELTimer_GetMSec() - dwStart);
return true;
}
bool CTerrainImpl::RAW_LoadTileMap(const char * c_szFileName)
{
Tracef("LoadSplatFile %s ", c_szFileName);
CMappedFile kMappedFile;
LPCVOID lpcvFileData;
if (!CEterPackManager::Instance().Get(kMappedFile, c_szFileName, &lpcvFileData))
{
Tracen("Error");
TraceError("CTerrainImpl::RAW_LoadTileMap - %s OPEN ERROR", c_szFileName);
return false;
}
memcpy(m_abyTileMap, lpcvFileData, sizeof(BYTE)*(TILEMAP_RAW_XSIZE)*(TILEMAP_RAW_YSIZE));
return true;
}
bool CTerrainImpl::LoadWaterMap(const char * c_szFileName)
{
DWORD dwStart = ELTimer_GetMSec();
if (!LoadWaterMapFile(c_szFileName))
{
memset(m_abyWaterMap, 0xFF, sizeof(m_abyWaterMap));
m_byNumWater = 0;
memset(m_lWaterHeight, -1, sizeof(m_lWaterHeight));
TraceError("CMapOutdoor::LoadWaterMap LoadWaterMapFile(%s) Failed", c_szFileName);
return false;
}
Tracef("LoadWaterMapFile %s %d\n", c_szFileName, ELTimer_GetMSec() - dwStart);
return true;
}
bool CTerrainImpl::LoadWaterMapFile(const char * c_szFileName)
{
CMappedFile kMappedFile;
LPCVOID lpcvFileData;
if (!CEterPackManager::Instance().Get(kMappedFile, c_szFileName, &lpcvFileData))
{
Tracen("Error");
TraceError("CTerrainImpl::LoadWaterMap - %s OPEN ERROR", c_szFileName);
return false;
}
DWORD dwFileSize = kMappedFile.Size();
BYTE* abFileData = (BYTE*)lpcvFileData;
{
#pragma pack(push)
#pragma pack(1)
struct SWaterMapHeader
{
WORD m_wMagic;
WORD m_wWidth;
WORD m_wHeight;
BYTE m_byLayerCount;
};
#pragma pack(pop)
if (dwFileSize < sizeof(SWaterMapHeader))
{
TraceError("CTerrainImpl::LoadWaterMap - %s FILE SIZE ERROR", c_szFileName);
return false;
}
SWaterMapHeader kWaterMapHeader;
memcpy(&kWaterMapHeader, abFileData, sizeof(kWaterMapHeader));
const WORD c_wWaterMapMagic = 5426;
if (c_wWaterMapMagic != kWaterMapHeader.m_wMagic)
{
TraceError("CTerrainImpl::LoadWaterMap - %s MAGIC NUMBER(%d!=MAGIC[%d]) ERROR", c_szFileName, kWaterMapHeader.m_wMagic, c_wWaterMapMagic);
return false;
}
if (WATERMAP_XSIZE != kWaterMapHeader.m_wWidth)
{
TraceError("CTerrainImpl::LoadWaterMap - kWaterMapHeader(%s).m_width(%d)!=WATERMAP_XSIZE(%d)", c_szFileName, kWaterMapHeader.m_wWidth, WATERMAP_XSIZE);
return false;
}
if (WATERMAP_YSIZE != kWaterMapHeader.m_wHeight)
{
TraceError("CTerrainImpl::LoadWaterMap - kWaterMapHeader(%s).m_height(%d)!=WATERMAP_YSIZE(%d)", c_szFileName, kWaterMapHeader.m_wHeight, WATERMAP_YSIZE);
return false;
}
m_byNumWater = kWaterMapHeader.m_byLayerCount;
DWORD dwFileRestSize = dwFileSize - sizeof(kWaterMapHeader);
DWORD dwFileNeedSize = sizeof(m_abyWaterMap) + sizeof(long) * m_byNumWater;
DWORD dwFileNeedSize2 = sizeof(m_abyWaterMap) + sizeof(WORD) * m_byNumWater;
if (dwFileRestSize == dwFileNeedSize2)
{
WORD wWaterHeight[MAX_WATER_NUM + 1];
BYTE * abSrcWaterData = abFileData + sizeof(kWaterMapHeader);
memcpy(m_abyWaterMap, abSrcWaterData, sizeof(m_abyWaterMap));
BYTE * abSrcWaterHeight = abSrcWaterData + sizeof(m_abyWaterMap);
m_byNumWater = MIN(MAX_WATER_NUM, m_byNumWater);
if (m_byNumWater)
{
memcpy(wWaterHeight, abSrcWaterHeight, sizeof(WORD) * m_byNumWater);
for (int i = 0; i < m_byNumWater; ++i)
m_lWaterHeight[i] = wWaterHeight[i];
}
}
else if (dwFileRestSize != dwFileNeedSize)
{
TraceError("CTerrainImpl::LoadWaterMap - %s FILE DATA SIZE(rest %d != need %d) ERROR", c_szFileName, dwFileRestSize, dwFileNeedSize);
return false;
}
BYTE * abSrcWaterData = abFileData + sizeof(kWaterMapHeader);
memcpy(m_abyWaterMap, abSrcWaterData, sizeof(m_abyWaterMap));
BYTE * abSrcWaterHeight = abSrcWaterData + sizeof(m_abyWaterMap);
if (m_byNumWater)
memcpy(m_lWaterHeight, abSrcWaterHeight, sizeof(long) * m_byNumWater);
}
return true;
}
DWORD CTerrainImpl::GetShadowMapColor(float fx, float fy)
{
float fMapSize = (float)(TERRAIN_XSIZE);
float fooMapSize = 1.0f / fMapSize;
if (fx < 0 || fy < 0 || fx >= fMapSize || fy >= fMapSize)
return 0xFFFFFFFF;
fx = fx * fooMapSize * (float)(SHADOWMAP_XSIZE - 1);
fy = fy * fooMapSize * (float)(SHADOWMAP_YSIZE - 1);
int ix, iy;
PR_FLOAT_TO_INT(fx, ix);
PR_FLOAT_TO_INT(fy, iy);
WORD w = *(m_awShadowMap + (iy * SHADOWMAP_XSIZE) + ix);
int b = w & 0x1f; w >>= 5; b <<= 3;
int g = w & 0x1f; w >>= 5; g <<= 3;
int r = w & 0x1f; r <<= 3;
return (DWORD) (0xff << 24) | (g << 16) | (g << 8) | r;
}

156
src/PRTerrainLib/Terrain.h Normal file
View File

@ -0,0 +1,156 @@
// Terrain.h: interface for the CTerrainImpl class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_TERRAIN_H__1C9108E1_69A7_4392_9B68_0E6CD4E1BFBA__INCLUDED_)
#define AFX_TERRAIN_H__1C9108E1_69A7_4392_9B68_0E6CD4E1BFBA__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "../eterImageLib/TGAImage.h"
#include "TextureSet.h"
#include "TerrainType.h"
class CTerrainImpl
{
public:
enum
{
XSIZE = TERRAIN_SIZE,
YSIZE = TERRAIN_SIZE,
HEIGHTMAP_XSIZE = XSIZE+1,
HEIGHTMAP_YSIZE = YSIZE+1,
HEIGHTMAP_RAW_XSIZE = XSIZE+3,
HEIGHTMAP_RAW_YSIZE = YSIZE+3,
ATTRMAP_XSIZE = XSIZE*2,
ATTRMAP_YSIZE = YSIZE*2,
ATTRMAP_ZCOUNT = 8,
TILEMAP_XSIZE = XSIZE*2,
TILEMAP_YSIZE = YSIZE*2,
TILEMAP_RAW_XSIZE = XSIZE*2+2,
TILEMAP_RAW_YSIZE = YSIZE*2+2,
WATERMAP_XSIZE = XSIZE,
WATERMAP_YSIZE = YSIZE,
NORMALMAP_XSIZE = XSIZE+1,
NORMALMAP_YSIZE = YSIZE+1,
SHADOWMAP_XSIZE = XSIZE*2,
SHADOWMAP_YSIZE = YSIZE*2,
SPLATALPHA_RAW_XSIZE = XSIZE*2+2,
SPLATALPHA_RAW_YSIZE = YSIZE*2+2,
SPLATALPHA_ZCOUNT = 7,
HEIGHT_TILE_XRATIO = TILEMAP_XSIZE / XSIZE,
HEIGHT_TILE_YRATIO = TILEMAP_XSIZE / XSIZE,
PATCH_XSIZE = TERRAIN_PATCHSIZE,
PATCH_YSIZE = TERRAIN_PATCHSIZE,
PATCH_TILE_XSIZE = PATCH_XSIZE * HEIGHT_TILE_XRATIO,
PATCH_TILE_YSIZE = PATCH_YSIZE * HEIGHT_TILE_YRATIO,
PATCH_XCOUNT = TERRAIN_PATCHCOUNT,
PATCH_YCOUNT = TERRAIN_PATCHCOUNT,
CELLSCALE = 200,
CELLSCALE_IN_METER = CELLSCALE / 100,
HALF_CELLSCALE = CELLSCALE / 2,
HALF_CELLSCALE_IN_METER = HALF_CELLSCALE / 100,
TERRAIN_XSIZE = XSIZE * CELLSCALE,
TERRAIN_YSIZE = YSIZE * CELLSCALE,
};
enum
{
MAX_ATTRIBUTE_NUM = 8,
MAX_WATER_NUM = 255,
};
enum
{
ATTRIBUTE_BLOCK = (1 << 0),
ATTRIBUTE_WATER = (1 << 1),
ATTRIBUTE_BANPK = (1 << 2),
};
public:
static void SetTextureSet(CTextureSet * pTextureSet);
static CTextureSet * GetTextureSet(); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ؾ<EFBFBD> <20><>
protected:
static CTextureSet * ms_pTextureSet;
public:
CTerrainImpl();
virtual ~CTerrainImpl();
TTerrainSplatPatch & GetTerrainSplatPatch() {return m_TerrainSplatPatch;}
DWORD GetNumTextures() { return ms_pTextureSet->GetTextureCount(); }
TTerrainTexture & GetTexture(const long & c_rlTextureNum) { return ms_pTextureSet->GetTexture(c_rlTextureNum); }
// int GetHeightTileMapRatio() { return m_iHeightTileRatio; }
bool LoadWaterMap(const char * c_szWaterMapName);
bool LoadWaterMapFile(const char * c_szWaterMapName);
LPDIRECT3DTEXTURE8 GetShadowTexture() { return m_lpShadowTexture; }
DWORD GetShadowMapColor(float fx, float fy);
protected:
void Initialize();
virtual void Clear();
void LoadTextures();
bool LoadHeightMap(const char *c_szFileName);
bool RAW_LoadTileMap(const char * c_szFileName);
bool LoadAttrMap(const char *c_pszFileName);
#ifdef WORLD_EDITOR
public:
#endif
__forceinline WORD GetHeightMapValue(short sx, short sy);
protected:
LPDIRECT3DTEXTURE8 m_lpAlphaTexture[MAXTERRAINTEXTURES];
WORD m_awRawHeightMap[HEIGHTMAP_RAW_YSIZE*HEIGHTMAP_RAW_XSIZE];
BYTE m_abyTileMap[TILEMAP_RAW_YSIZE*TILEMAP_RAW_XSIZE];
BYTE m_abyAttrMap[ATTRMAP_YSIZE*ATTRMAP_XSIZE];
BYTE m_abyWaterMap[WATERMAP_YSIZE*WATERMAP_XSIZE];
CHAR m_acNormalMap[NORMALMAP_YSIZE*NORMALMAP_XSIZE*3];
TGA_HEADER m_HeightMapHeader;
WORD m_wTileMapVersion;
long m_lViewRadius;
float m_fHeightScale;
TTerrainSplatPatch m_TerrainSplatPatch;
//////////////////////////////////////////////////////////////////////////
//Water Map
BYTE m_byNumWater;
long m_lWaterHeight[MAX_WATER_NUM + 1];
//Water Map
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
// TileMap<61><70> HeightMap <20><><EFBFBD><EFBFBD>
// int m_iHeightTileRatio;
//////////////////////////////////////////////////////////////////////////
// Shadow Map
LPDIRECT3DTEXTURE8 m_lpShadowTexture;
WORD m_awShadowMap[SHADOWMAP_YSIZE*SHADOWMAP_XSIZE]; // 16bit R5 G6 B5
protected:
long m_lSplatTilesX;
long m_lSplatTilesY;
};
__forceinline WORD CTerrainImpl::GetHeightMapValue(short sx, short sy)
{
return m_awRawHeightMap[(sy+1) * HEIGHTMAP_RAW_XSIZE + sx+1];
}
#endif // !defined(AFX_TERRAIN_H__1C9108E1_69A7_4392_9B68_0E6CD4E1BFBA__INCLUDED_)

View File

@ -0,0 +1,95 @@
#ifndef __TERRAIn_TYPES__
#define __TERRAIn_TYPES__
#include "../eterlib/GrpVertexBuffer.h"
#include "../eterlib/GrpIndexBuffer.h"
#define TERRAIN_PATCHSIZE 16
#define TERRAIN_SIZE 128
#define TERRAIN_PATCHCOUNT TERRAIN_SIZE/TERRAIN_PATCHSIZE
#define MAXTERRAINTEXTURES 256
typedef struct
{
long Active;
long NeedsUpdate;
LPDIRECT3DTEXTURE8 pd3dTexture;
} TTerainSplat;
typedef struct
{
DWORD TileCount[MAXTERRAINTEXTURES];
DWORD PatchTileCount[TERRAIN_PATCHCOUNT*TERRAIN_PATCHCOUNT][MAXTERRAINTEXTURES];
TTerainSplat Splats[MAXTERRAINTEXTURES];
bool m_bNeedsUpdate;
} TTerrainSplatPatch;
typedef struct
{
char used;
short mat;
CGraphicVertexBuffer vb;
CGraphicIndexBuffer ib;
long VertexSize;
short NumIndices;
float minx, maxx;
float miny, maxy;
float minz, maxz;
} TERRAIN_VBUFFER;
typedef struct
{
char name[19];
float ambi_r, ambi_g, ambi_b, ambi_a; /* Ambient Color */
float diff_r, diff_g, diff_b, diff_a; /* Diffuse Color */
float spec_r, spec_g, spec_b, spec_a; /* Specular Color */
float spec_power; /* Specular power */
} PR_MATERIAL;
typedef struct
{
/* Public Settings */
float PageUVLength;
long SquaresPerTexture; /* Heightfield squares per texture (128 texels) */
long SplatTilesX; /* Number of splat textures across map */
long SplatTilesY; /* Number of splat textures down map */
long DisableWrapping;
long DisableShadow;
long ShadowMode;
long OutsideVisible;
D3DXVECTOR3 SunLocation;
} TTerrainGlobals;
/* Converts a floating point number to an integer by truncation, using
the FISTP instruction */
#define PR_FLOAT_TO_INTASM __asm \
{ \
__asm fld PR_FCNV \
__asm fistp PR_ICNV \
}
#define PR_FLOAT_TO_FIXED(inreal, outint) \
{ \
PR_FCNV = (inreal) * 65536.0f; \
PR_FLOAT_TO_INTASM; \
(outint) = PR_ICNV; \
}
#define PR_FLOAT_TO_INT(inreal, outint) \
{ \
PR_FCNV = (inreal); \
PR_FLOAT_TO_INTASM; \
(outint) = PR_ICNV > PR_FCNV ? PR_ICNV - 1 : PR_ICNV; \
}
#define PR_FLOAT_ADD_TO_INT(inreal, outint) \
{ \
PR_FCNV = (inreal); \
PR_FLOAT_TO_INTASM; \
(outint) += PR_ICNV; \
}
#endif //__TERRAIn_TYPES__

View File

@ -0,0 +1,275 @@
#include "StdAfx.h"
#include "TextureSet.h"
CTextureSet::CTextureSet()
{
Initialize();
}
CTextureSet::~CTextureSet()
{
Clear();
}
void CTextureSet::Initialize()
{
}
void CTextureSet::Create()
{
CResource * pResource = CResourceManager::Instance().GetResourcePointer("d:/ymir work/special/error.tga");
m_ErrorTexture.ImageInstance.SetImagePointer(static_cast<CGraphicImage *> (pResource));
AddEmptyTexture(); // <20><><EFBFBD><20>ؽ<EFBFBD><D8BD>縦 ó<><C3B3><EFBFBD><EFBFBD> <20>߰<EFBFBD> <20>ؾ<EFBFBD> <20><>
}
bool CTextureSet::Load(const char * c_szTextureSetFileName, float fTerrainTexCoordBase)
{
NANOBEGIN
Clear();
CTokenVectorMap stTokenVectorMap;
if (!LoadMultipleTextData(c_szTextureSetFileName, stTokenVectorMap))
{
TraceError("TextureSet::Load : cannot load %s", c_szTextureSetFileName);
return false;
}
if (stTokenVectorMap.end() == stTokenVectorMap.find("textureset"))
{
TraceError("TextureSet::Load : syntax error, TextureSet (filename: %s)", c_szTextureSetFileName);
return false;
}
if (stTokenVectorMap.end() == stTokenVectorMap.find("texturecount"))
{
TraceError("TextureSet::Load : syntax error, TextureCount (filename: %s)", c_szTextureSetFileName);
return false;
}
Create();
const std::string & c_rstrCount = stTokenVectorMap["texturecount"][0];
long lCount = atol(c_rstrCount.c_str());
char szTextureName[32 + 1];
m_Textures.resize(lCount + 1);
for (long i = 0; i < lCount; ++i)
{
_snprintf(szTextureName, sizeof(szTextureName), "texture%03d", i + 1);
if (stTokenVectorMap.end() == stTokenVectorMap.find(szTextureName))
continue;
const CTokenVector & rVector = stTokenVectorMap[szTextureName];
const std::string & c_rstrFileName = rVector[0].c_str();
const std::string & c_rstrUScale = rVector[1].c_str();
const std::string & c_rstrVScale = rVector[2].c_str();
const std::string & c_rstrUOffset = rVector[3].c_str();
const std::string & c_rstrVOffset = rVector[4].c_str();
const std::string & c_rstrbSplat = rVector[5].c_str();
const std::string & c_rstrBegin = rVector[6].c_str();
const std::string & c_rstrEnd = rVector[7].c_str();
float fuScale, fvScale, fuOffset, fvOffset;
bool bSplat;
unsigned short usBegin, usEnd;
fuScale = atof(c_rstrUScale.c_str());
fvScale = atof(c_rstrVScale.c_str());
fuOffset = atof(c_rstrUOffset.c_str());
fvOffset = atof(c_rstrVOffset.c_str());
bSplat = 0 != atoi(c_rstrbSplat.c_str());
usBegin = static_cast<unsigned short>(atoi(c_rstrBegin.c_str()));
usEnd = static_cast<unsigned short>(atoi(c_rstrEnd.c_str()));
if (!SetTexture(i + 1, c_rstrFileName.c_str(), fuScale, fvScale, fuOffset, fvOffset, bSplat, usBegin, usEnd, fTerrainTexCoordBase))
TraceError("CTextureSet::Load : SetTexture failed : Filename: %s", c_rstrFileName.c_str());
}
m_stFileName.assign(c_szTextureSetFileName);
NANOEND
return true;
}
void CTextureSet::Clear()
{
m_ErrorTexture.ImageInstance.Destroy();
m_Textures.clear();
Initialize();
}
void CTextureSet::AddEmptyTexture()
{
TTerrainTexture eraser;
m_Textures.push_back(eraser);
}
unsigned long CTextureSet::GetTextureCount()
{
return m_Textures.size();
}
TTerrainTexture & CTextureSet::GetTexture(unsigned long ulIndex)
{
if (GetTextureCount() <= ulIndex)
return m_ErrorTexture;
return m_Textures[ulIndex];
}
bool CTextureSet::SetTexture(unsigned long ulIndex,
const char * c_szFileName,
float fuScale,
float fvScale,
float fuOffset,
float fvOffset,
bool bSplat,
unsigned short usBegin,
unsigned short usEnd,
float fTerrainTexCoordBase)
{
if (ulIndex >= m_Textures.size())
{
TraceError("CTextureSet::SetTexture : Index Error : Index(%d) is Larger than TextureSet Size(%d)", ulIndex, m_Textures.size());
return false;
}
CResource * pResource = CResourceManager::Instance().GetResourcePointer(c_szFileName);
if (!pResource->IsType(CGraphicImage::Type()))
{
TraceError("CTerrainImpl::GenerateTexture : %s is NOT Image File", pResource->GetFileName());
return false;
}
TTerrainTexture & tex = m_Textures[ulIndex];
tex.stFilename = c_szFileName;
tex.UScale = fuScale;
tex.VScale = fvScale;
tex.UOffset = fuOffset;
tex.VOffset = fvOffset;
tex.bSplat = bSplat;
tex.Begin = usBegin;
tex.End = usEnd;
tex.ImageInstance.SetImagePointer(static_cast<CGraphicImage *>(pResource));
tex.pd3dTexture = tex.ImageInstance.GetTexturePointer()->GetD3DTexture();
D3DXMatrixScaling(&tex.m_matTransform, fTerrainTexCoordBase * tex.UScale, -fTerrainTexCoordBase * tex.VScale, 0.0f);
tex.m_matTransform._41 = tex.UOffset;
tex.m_matTransform._42 = -tex.VOffset;
return true;
}
void CTextureSet::Reload(float fTerrainTexCoordBase)
{
for (DWORD dwIndex = 1; dwIndex < GetTextureCount(); ++dwIndex)
{
TTerrainTexture & tex = m_Textures[dwIndex];
tex.ImageInstance.ReloadImagePointer((CGraphicImage *) CResourceManager::Instance().GetResourcePointer(tex.stFilename.c_str()));
tex.pd3dTexture = tex.ImageInstance.GetTexturePointer()->GetD3DTexture();
D3DXMatrixScaling(&tex.m_matTransform, fTerrainTexCoordBase * tex.UScale, -fTerrainTexCoordBase * tex.VScale, 0.0f);
tex.m_matTransform._41 = tex.UOffset;
tex.m_matTransform._42 = -tex.VOffset;
}
}
bool CTextureSet::AddTexture(const char * c_szFileName,
float fuScale,
float fvScale,
float fuOffset,
float fvOffset,
bool bSplat,
unsigned short usBegin,
unsigned short usEnd,
float fTerrainTexCoordBase)
{
if (GetTextureCount() >= 256)
{
LogBox("<EFBFBD>ؽ<EFBFBD>ó<EFBFBD><EFBFBD> <20><> <20>̻<EFBFBD> <20>߰<EFBFBD><DFB0><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>.", "<EFBFBD>ִ<EFBFBD> <20>ؽ<EFBFBD>ó <20><><EFBFBD><EFBFBD> 255<35><35>");
return false;
}
for (unsigned long i = 1; i < GetTextureCount(); ++i)
{
if (0 == m_Textures[i].stFilename.compare(c_szFileName))
{
LogBox("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20≯<EFBFBD><CCB8><EFBFBD> <20>ؽ<EFBFBD>ó<EFBFBD><C3B3> <20>̹<EFBFBD> <20>ֽ<EFBFBD><D6BD>ϴ<EFBFBD>.", "<EFBFBD>ߺ<EFBFBD>");
return false;
}
}
CResource * pResource = CResourceManager::Instance().GetResourcePointer(c_szFileName);
if (!pResource->IsType(CGraphicImage::Type()))
{
LogBox("CTerrainImpl::GenerateTexture : <20>̹<EFBFBD><CCB9><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ƴմϴ<D5B4>. %s", pResource->GetFileName());
return false;
}
m_Textures.reserve(m_Textures.size() + 1);
SetTexture(m_Textures.size() - 1,
c_szFileName,
fuScale,
fvScale,
fuOffset,
fvOffset,
bSplat,
usBegin,
usEnd,
fTerrainTexCoordBase);
return true;
}
bool CTextureSet::RemoveTexture(unsigned long ulIndex)
{
if (GetTextureCount() <= ulIndex)
return false;
TTextureVector::iterator itor = m_Textures.begin() + ulIndex;
m_Textures.erase(itor);
return true;
}
bool CTextureSet::Save(const char * c_pszFileName)
{
FILE * pFile = fopen(c_pszFileName, "w");
if (!pFile)
return false;
fprintf(pFile, "TextureSet\n");
fprintf(pFile, "\n");
fprintf(pFile, "TextureCount %ld\n", GetTextureCount() - 1); // -1 <20><> <20>ϴ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
fprintf(pFile, "\n");
for (DWORD i = 1; i < GetTextureCount(); ++i)
{
TTerrainTexture & rTex = m_Textures[i];
fprintf(pFile, "Start Texture%03d\n", i);
fprintf(pFile, " \"%s\"\n", rTex.stFilename.c_str());
fprintf(pFile, " %f\n", rTex.UScale);
fprintf(pFile, " %f\n", rTex.VScale);
fprintf(pFile, " %f\n", rTex.UOffset);
fprintf(pFile, " %f\n", rTex.VOffset);
fprintf(pFile, " %d\n", rTex.bSplat);
fprintf(pFile, " %hu\n", rTex.Begin);
fprintf(pFile, " %hu\n", rTex.End);
fprintf(pFile, "End Texture%03d\n", i);
}
fclose(pFile);
return true;
}

View File

@ -0,0 +1,90 @@
#ifndef __INC_TERRAINLIB_TEXTURESET_H__
#define __INC_TERRAINLIB_TEXTURESET_H__
#include "../eterLib/GrpImageInstance.h"
typedef struct STerrainTexture
{
STerrainTexture() : pd3dTexture(NULL),
UScale(4.0f),
VScale(4.0f),
UOffset(0.0f),
VOffset(0.0f),
bSplat(true),
Begin(0),
End(0)
{
}
~STerrainTexture()
{
}
std::string stFilename;
LPDIRECT3DTEXTURE8 pd3dTexture;
CGraphicImageInstance ImageInstance;
float UScale;
float VScale;
float UOffset;
float VOffset;
bool bSplat;
unsigned short Begin, End; // 0 ~ 65535 <20><> 16bit heightfield <20><><EFBFBD>̰<EFBFBD>.
D3DXMATRIX m_matTransform;
} TTerrainTexture;
class CTextureSet
{
public:
typedef std::vector<TTerrainTexture> TTextureVector;
CTextureSet();
virtual ~CTextureSet();
void Initialize();
void Clear();
void Create();
bool Load(const char * c_pszFileName, float fTerrainTexCoordBase);
bool Save(const char * c_pszFileName);
unsigned long GetTextureCount();
TTerrainTexture & GetTexture(unsigned long ulIndex);
bool RemoveTexture(unsigned long ulIndex);
bool SetTexture(unsigned long ulIndex,
const char * c_szFileName,
float fuScale,
float fvScale,
float fuOffset,
float fvOffset,
bool bSplat,
unsigned short usBegin,
unsigned short usEnd,
float fTerrainTexCoordBase);
void Reload(float fTerrainTexCoordBase);
bool AddTexture(const char * c_szFileName,
float fuScale,
float fvScale,
float fuOffset,
float fvOffset,
bool bSplat,
unsigned short usBegin,
unsigned short usEnd,
float fTerrainTexCoordBase);
const char * GetFileName() { return m_stFileName.c_str(); }
protected:
void AddEmptyTexture();
protected:
TTextureVector m_Textures;
TTerrainTexture m_ErrorTexture;
std::string m_stFileName;
};
#endif