Holy fucking shit I don't want to work on this. Sibly, you son of a ...
This commit is contained in:
+43
-131
@@ -1,14 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Blitz2DRelease|Win32">
|
||||
<Configuration>Blitz2DRelease</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Blitz3DRelease|Win32">
|
||||
<Configuration>Blitz3DRelease</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
@@ -17,40 +9,20 @@
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Template|Win32">
|
||||
<Configuration>Template</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<SccProjectName />
|
||||
<SccLocalPath />
|
||||
<ProjectGuid>{BE0BA538-6215-4836-9227-1D3627E40D61}</ProjectGuid>
|
||||
<WindowsTargetPlatformVersion>10.0.10586.0</WindowsTargetPlatformVersion>
|
||||
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Template|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Blitz3DRelease|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Blitz2DRelease|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
@@ -60,62 +32,53 @@
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Template|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|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.UpgradeFromVC60.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Blitz3DRelease|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.UpgradeFromVC60.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Blitz2DRelease|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.UpgradeFromVC60.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.UpgradeFromVC60.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<OutDir>.\Release\</OutDir>
|
||||
<IntDir>.\Release\</IntDir>
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Blitz2DRelease|Win32'">
|
||||
<OutDir>.\blitz3d___Win32_Blitz2DRelease\</OutDir>
|
||||
<IntDir>.\blitz3d___Win32_Blitz2DRelease\</IntDir>
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Blitz3DRelease|Win32'">
|
||||
<OutDir>.\blitz3d___Win32_Blitz3DRelease\</OutDir>
|
||||
<IntDir>.\blitz3d___Win32_Blitz3DRelease\</IntDir>
|
||||
<OutDir>..\#Build\$(ProjectName)\$(ConfigurationName)\</OutDir>
|
||||
<IntDir>..\#Intermediate\$(ProjectName)\$(ConfigurationName)\</IntDir>
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<IncludePath>$(DXSDK_DIR)Include\;$(VC_IncludePath);$(WindowsSDK_IncludePath);</IncludePath>
|
||||
<LibraryPath>$(DXSDK_DIR)Lib\x86\;$(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86);$(NETFXKitsDir)Lib\um\x86</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<OutDir>..\#Build\$(ProjectName)\$(ConfigurationName)\</OutDir>
|
||||
<IntDir>..\#Intermediate\$(ProjectName)\$(ConfigurationName)\</IntDir>
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<IncludePath>$(DXSDK_DIR)Include\;$(VC_IncludePath);$(WindowsSDK_IncludePath);</IncludePath>
|
||||
<LibraryPath>$(DXSDK_DIR)Lib\x86\;$(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86);$(NETFXKitsDir)Lib\um\x86</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
|
||||
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
|
||||
<StringPooling>true</StringPooling>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AssemblerListingLocation>.\Release\</AssemblerListingLocation>
|
||||
<PrecompiledHeaderOutputFile>.\Release\blitz3d.pch</PrecompiledHeaderOutputFile>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>std.h</PrecompiledHeaderFile>
|
||||
<ObjectFileName>.\Release\</ObjectFileName>
|
||||
<ProgramDataBaseFileName>.\Release\</ProgramDataBaseFileName>
|
||||
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<FloatingPointExceptions>true</FloatingPointExceptions>
|
||||
<CreateHotpatchableImage>true</CreateHotpatchableImage>
|
||||
<CompileAsManaged>false</CompileAsManaged>
|
||||
<CompileAsWinRT>false</CompileAsWinRT>
|
||||
<SDLCheck>false</SDLCheck>
|
||||
<ControlFlowGuard>Guard</ControlFlowGuard>
|
||||
<ProgramDataBaseFileName>$(IntDir)vc$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
<EnforceTypeConversionRules>false</EnforceTypeConversionRules>
|
||||
<RuntimeTypeInfo>false</RuntimeTypeInfo>
|
||||
<OpenMPSupport>false</OpenMPSupport>
|
||||
<CallingConvention>StdCall</CallingConvention>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<Culture>0x0409</Culture>
|
||||
@@ -128,83 +91,35 @@
|
||||
<Lib>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<OutputFile>.\Release\blitz3d.lib</OutputFile>
|
||||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Blitz2DRelease|Win32'">
|
||||
<ClCompile>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
|
||||
<StringPooling>true</StringPooling>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AssemblerListingLocation>.\blitz3d___Win32_Blitz2DRelease\</AssemblerListingLocation>
|
||||
<PrecompiledHeaderOutputFile>.\blitz3d___Win32_Blitz2DRelease\blitz3d.pch</PrecompiledHeaderOutputFile>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>std.h</PrecompiledHeaderFile>
|
||||
<ObjectFileName>.\blitz3d___Win32_Blitz2DRelease\</ObjectFileName>
|
||||
<ProgramDataBaseFileName>.\blitz3d___Win32_Blitz2DRelease\</ProgramDataBaseFileName>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<Culture>0x0409</Culture>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
<Bscmake>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<OutputFile>.\blitz3d___Win32_Blitz2DRelease\blitz3d.bsc</OutputFile>
|
||||
</Bscmake>
|
||||
<Lib>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<OutputFile>.\blitz3d___Win32_Blitz2DRelease\blitz3d.lib</OutputFile>
|
||||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Blitz3DRelease|Win32'">
|
||||
<ClCompile>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
|
||||
<StringPooling>true</StringPooling>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PreprocessorDefinitions>_LIB;WIN32;NDEBUG;PRO;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AssemblerListingLocation>.\blitz3d___Win32_Blitz3DRelease\</AssemblerListingLocation>
|
||||
<PrecompiledHeaderOutputFile>.\blitz3d___Win32_Blitz3DRelease\blitz3d.pch</PrecompiledHeaderOutputFile>
|
||||
<PrecompiledHeader />
|
||||
<ObjectFileName>.\blitz3d___Win32_Blitz3DRelease\</ObjectFileName>
|
||||
<ProgramDataBaseFileName>.\blitz3d___Win32_Blitz3DRelease\</ProgramDataBaseFileName>
|
||||
<CallingConvention>StdCall</CallingConvention>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<Culture>0x0409</Culture>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
<Bscmake>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<OutputFile>.\blitz3d___Win32_Blitz3DRelease\blitz3d.bsc</OutputFile>
|
||||
</Bscmake>
|
||||
<Lib>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<OutputFile>.\blitz3d___Win32_Blitz3DRelease\blitz3d.lib</OutputFile>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<InlineFunctionExpansion>Default</InlineFunctionExpansion>
|
||||
<FunctionLevelLinking>false</FunctionLevelLinking>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AssemblerListingLocation>.\Debug\</AssemblerListingLocation>
|
||||
<PrecompiledHeaderOutputFile>.\Debug\blitz3d.pch</PrecompiledHeaderOutputFile>
|
||||
<ObjectFileName>.\Debug\</ObjectFileName>
|
||||
<ProgramDataBaseFileName>.\Debug\</ProgramDataBaseFileName>
|
||||
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;WIN32;DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<AdditionalIncludeDirectories>$(DXSDK_INCLUDE);$(DIRECTXSDK_INCLUDE);</AdditionalIncludeDirectories>
|
||||
<StringPooling>true</StringPooling>
|
||||
<FloatingPointExceptions>true</FloatingPointExceptions>
|
||||
<CreateHotpatchableImage>true</CreateHotpatchableImage>
|
||||
<CompileAsManaged>false</CompileAsManaged>
|
||||
<CompileAsWinRT>false</CompileAsWinRT>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<ControlFlowGuard>Guard</ControlFlowGuard>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<ProgramDataBaseFileName>$(IntDir)vc$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
<EnforceTypeConversionRules>true</EnforceTypeConversionRules>
|
||||
<RuntimeTypeInfo>true</RuntimeTypeInfo>
|
||||
<OpenMPSupport>false</OpenMPSupport>
|
||||
<CallingConvention>StdCall</CallingConvention>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<Culture>0x0409</Culture>
|
||||
@@ -217,6 +132,7 @@
|
||||
<Lib>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<OutputFile>.\Debug\blitz3d.lib</OutputFile>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
@@ -252,10 +168,6 @@
|
||||
<ClCompile Include="std.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">std.h</PrecompiledHeaderFile>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Blitz2DRelease|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Blitz2DRelease|Win32'">std.h</PrecompiledHeaderFile>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Blitz3DRelease|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Blitz3DRelease|Win32'">std.h</PrecompiledHeaderFile>
|
||||
</ClCompile>
|
||||
<ClCompile Include="surface.cpp" />
|
||||
<ClCompile Include="terrain.cpp" />
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
#include "std.h"
|
||||
#include "entity.h"
|
||||
|
||||
#include "stats.h"
|
||||
//#include "stats.h"
|
||||
|
||||
Entity *Entity::_orphans,*Entity::_last_orphan;
|
||||
|
||||
|
||||
+7
-7
@@ -77,15 +77,15 @@ public:
|
||||
x -= q.x; y -= q.y; z -= q.z; return *this;
|
||||
}
|
||||
bool operator<(const Vector &q)const {
|
||||
if (fabs(x - q.x) > FLT_FLT_EPSILON) return x < q.x ? true : false;
|
||||
if (fabs(y - q.y) > FLT_FLT_EPSILON) return y < q.y ? true : false;
|
||||
return fabs(z - q.z) > FLT_FLT_EPSILON && z < q.z;
|
||||
if (fabs(x - q.x) > FLT_EPSILON) return x < q.x ? true : false;
|
||||
if (fabs(y - q.y) > FLT_EPSILON) return y < q.y ? true : false;
|
||||
return fabs(z - q.z) > FLT_EPSILON && z < q.z;
|
||||
}
|
||||
bool operator==(const Vector &q)const {
|
||||
return fabs(x - q.x) <= FLT_FLT_EPSILON && fabs(y - q.y) <= FLT_FLT_EPSILON && fabs(z - q.z) <= FLT_FLT_EPSILON;
|
||||
return fabs(x - q.x) <= FLT_EPSILON && fabs(y - q.y) <= FLT_EPSILON && fabs(z - q.z) <= FLT_EPSILON;
|
||||
}
|
||||
bool operator!=(const Vector &q)const {
|
||||
return fabs(x - q.x) > FLT_FLT_EPSILON || fabs(y - q.y) > FLT_FLT_EPSILON || fabs(z - q.z) > FLT_FLT_EPSILON;
|
||||
return fabs(x - q.x) > FLT_EPSILON || fabs(y - q.y) > FLT_EPSILON || fabs(z - q.z) > FLT_EPSILON;
|
||||
}
|
||||
float dot(const Vector &q)const {
|
||||
return x*q.x + y*q.y + z*q.z;
|
||||
@@ -222,7 +222,7 @@ struct Quat {
|
||||
Quat t = q;
|
||||
float d = dot(q), b = 1 - a;
|
||||
if (d < 0) { t.w = -t.w; t.v = -t.v; d = -d; }
|
||||
if (d < 1 - FLT_FLT_EPSILON) {
|
||||
if (d < 1 - FLT_EPSILON) {
|
||||
float om = acosf(d);
|
||||
float si = sinf(om);
|
||||
a = sinf(a*om) / si;
|
||||
@@ -527,7 +527,7 @@ inline Quat matrixQuat(const Matrix &p) {
|
||||
Matrix m = p;
|
||||
m.orthogonalize();
|
||||
float t = m.i.x + m.j.y + m.k.z, w, x, y, z;
|
||||
if (t > FLT_FLT_EPSILON) {
|
||||
if (t > FLT_EPSILON) {
|
||||
t = sqrtf(t + 1) * 2;
|
||||
x = (m.k.y - m.j.z) / t;
|
||||
y = (m.i.z - m.k.x) / t;
|
||||
|
||||
@@ -12,6 +12,8 @@ extern gxRuntime *gx_runtime;
|
||||
#define _log( X )
|
||||
#endif
|
||||
|
||||
class Box;
|
||||
|
||||
static filebuf in;
|
||||
static int chunk_end;
|
||||
static vector<int> parent_end;
|
||||
@@ -369,7 +371,7 @@ static void parseMeshInfo( MeshModel *root,float curr_time ){
|
||||
Vector pivot;
|
||||
Animation anim;
|
||||
unsigned short id=65535,parent=65535,flags1,flags2;
|
||||
Box box( Vector(),Vector() );
|
||||
Box box = Box( Vector(),Vector() );
|
||||
Vector box_centre;
|
||||
while( int chunk_id=nextChunk() ){
|
||||
switch( chunk_id ){
|
||||
|
||||
+382
-382
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -69,7 +69,7 @@ void Surface::updateNormals(){
|
||||
const Vector &v1=vertices[t.verts[1]].coords;
|
||||
const Vector &v2=vertices[t.verts[2]].coords;
|
||||
Vector n=(v1-v0).cross(v2-v0);
|
||||
if( n.length()<= FLT_FLT_EPSILON ) continue;
|
||||
if( n.length()<= FLT_EPSILON ) continue;
|
||||
n.normalize();
|
||||
norm_map[v0]+=n;
|
||||
norm_map[v1]+=n;
|
||||
|
||||
@@ -15,7 +15,7 @@ static const TerrainRep *curr;
|
||||
static Frustum frustum;
|
||||
static int out_cnt,proc_cnt,clip_cnt;
|
||||
|
||||
static float proj_epsilon= FLT_FLT_EPSILON; //.01f;
|
||||
static float proj_epsilon= FLT_EPSILON; //.01f;
|
||||
|
||||
struct TerrainRep::Cell{
|
||||
unsigned char height;
|
||||
@@ -259,7 +259,7 @@ void TerrainRep::insert( Tri *t ){
|
||||
Vector v=Vector( verts[t->v1].v+verts[t->v2].v )/2;
|
||||
// float d=eye_plane.distance( v );
|
||||
float d=eye_vec.distance( v );
|
||||
if( d<FLT_FLT_EPSILON ) d= FLT_FLT_EPSILON;
|
||||
if( d<FLT_EPSILON ) d= FLT_EPSILON;
|
||||
t->proj_err=errors[t->id].error/d;
|
||||
if( t->proj_err>proj_epsilon ){
|
||||
tri_que.push( t );
|
||||
@@ -344,7 +344,7 @@ TerrainRep::Error TerrainRep::calcErr( int id,const Vert &v0,const Vert &v1,cons
|
||||
|
||||
Vert tv( (v1.x+v2.x)/2,(v1.z+v2.z)/2 );
|
||||
float e=fabs(tv.v.y-(v1.v.y+v2.v.y)/2);
|
||||
et.error= e>=1 ? 255 : ceil( (e- FLT_FLT_EPSILON)*255.0f );
|
||||
et.error= e>=1 ? 255 : ceil( (e- FLT_EPSILON)*255.0f );
|
||||
|
||||
Error el=calcErr( id*2,tv,v2,v0 );
|
||||
Error er=calcErr( id*2+1,tv,v0,v1 );
|
||||
@@ -382,7 +382,7 @@ TerrainRep::Error TerrainRep::calcErr( int id,int x,int z,const Vert &v0,const V
|
||||
|
||||
Vert tv( (v1.x+v2.x)/2,(v1.z+v2.z)/2 );
|
||||
float e=fabs(tv.v.y-(v1.v.y+v2.v.y)/2);
|
||||
et.error= e>=1 ? 255 : ceil( (e- FLT_FLT_EPSILON)*255.0f );
|
||||
et.error= e>=1 ? 255 : ceil( (e- FLT_EPSILON)*255.0f );
|
||||
|
||||
Error el=calcErr( id*2,x,z,tv,v2,v0 );
|
||||
Error er=calcErr( id*2+1,x,z,tv,v0,v1 );
|
||||
|
||||
+99
-99
@@ -9,187 +9,187 @@
|
||||
extern gxScene *gx_scene;
|
||||
extern gxGraphics *gx_graphics;
|
||||
|
||||
struct Filter{
|
||||
struct Filter {
|
||||
string t;
|
||||
int flags;
|
||||
Filter( const string &t,int flags ):t(t),flags(flags){
|
||||
Filter(const string &t, int flags) :t(t), flags(flags) {
|
||||
}
|
||||
};
|
||||
|
||||
static vector<Filter> filters;
|
||||
|
||||
static int filterFile( const string &t,int flags ){
|
||||
static int filterFile(const string &t, int flags) {
|
||||
//check filters...
|
||||
string l=tolower(t);
|
||||
for( int k=0;k<filters.size();++k ){
|
||||
if( l.find( filters[k].t )!=string::npos ){
|
||||
flags|=filters[k].flags;
|
||||
string l = tolower(t);
|
||||
for (int k = 0; k < filters.size(); ++k) {
|
||||
if (l.find(filters[k].t) != string::npos) {
|
||||
flags |= filters[k].flags;
|
||||
}
|
||||
}
|
||||
return flags;
|
||||
}
|
||||
|
||||
struct Texture::Rep{
|
||||
struct Texture::Rep {
|
||||
|
||||
int ref_cnt;
|
||||
CachedTexture cached_tex;
|
||||
vector<gxCanvas*> tex_frames;
|
||||
|
||||
int tex_blend,tex_flags;
|
||||
int tex_blend, tex_flags;
|
||||
bool transparent;
|
||||
|
||||
float sx,sy,tx,ty,rot;
|
||||
bool mat_used,mat_valid;
|
||||
float sx, sy, tx, ty, rot;
|
||||
bool mat_used, mat_valid;
|
||||
gxScene::Matrix matrix;
|
||||
|
||||
Rep( int w,int h,int flags,int cnt ):
|
||||
ref_cnt(1),cached_tex( w,h,flags,cnt ),
|
||||
tex_blend(gxScene::BLEND_MULTIPLY),tex_flags(0),
|
||||
sx(1),sy(1),tx(0),ty(0),rot(0),mat_used(false){
|
||||
tex_frames=cached_tex.getFrames();
|
||||
transparent=
|
||||
Rep(int w, int h, int flags, int cnt) :
|
||||
ref_cnt(1), cached_tex(w, h, flags, cnt),
|
||||
tex_blend(gxScene::BLEND_MULTIPLY), tex_flags(0),
|
||||
sx(1), sy(1), tx(0), ty(0), rot(0), mat_used(false) {
|
||||
tex_frames = cached_tex.getFrames();
|
||||
transparent =
|
||||
(flags & gxCanvas::CANVAS_TEX_ALPHA) &&
|
||||
!(flags & gxCanvas::CANVAS_TEX_MASK);
|
||||
memset( &matrix,0,sizeof( matrix ) );
|
||||
memset(&matrix, 0, sizeof(matrix));
|
||||
}
|
||||
|
||||
Rep( const string &f,int flags,int w,int h,int first,int cnt ):
|
||||
ref_cnt(1),cached_tex( f,flags,w,h,first,cnt ),
|
||||
tex_blend(gxScene::BLEND_MULTIPLY),tex_flags(0),
|
||||
sx(1),sy(1),tx(0),ty(0),rot(0),mat_used(false){
|
||||
tex_frames=cached_tex.getFrames();
|
||||
transparent=
|
||||
Rep(const string &f, int flags, int w, int h, int first, int cnt) :
|
||||
ref_cnt(1), cached_tex(f, flags, w, h, first, cnt),
|
||||
tex_blend(gxScene::BLEND_MULTIPLY), tex_flags(0),
|
||||
sx(1), sy(1), tx(0), ty(0), rot(0), mat_used(false) {
|
||||
tex_frames = cached_tex.getFrames();
|
||||
transparent =
|
||||
(flags & gxCanvas::CANVAS_TEX_ALPHA) &&
|
||||
!(flags & gxCanvas::CANVAS_TEX_MASK);
|
||||
memset( &matrix,0,sizeof( matrix ) );
|
||||
memset(&matrix, 0, sizeof(matrix));
|
||||
}
|
||||
|
||||
Rep( const Rep &t ):
|
||||
ref_cnt(1),cached_tex(t.cached_tex),tex_frames(t.tex_frames),
|
||||
tex_blend(t.tex_blend),tex_flags(t.tex_flags),
|
||||
sx(t.sx),sy(t.sy),tx(t.tx),ty(t.ty),rot(t.rot),
|
||||
mat_used(t.mat_used),mat_valid(t.mat_valid),matrix(t.matrix),
|
||||
transparent(t.transparent){
|
||||
Rep(const Rep &t) :
|
||||
ref_cnt(1), cached_tex(t.cached_tex), tex_frames(t.tex_frames),
|
||||
tex_blend(t.tex_blend), tex_flags(t.tex_flags),
|
||||
sx(t.sx), sy(t.sy), tx(t.tx), ty(t.ty), rot(t.rot),
|
||||
mat_used(t.mat_used), mat_valid(t.mat_valid), matrix(t.matrix),
|
||||
transparent(t.transparent) {
|
||||
}
|
||||
};
|
||||
|
||||
Texture::Texture():rep(0){
|
||||
Texture::Texture() :rep(0) {
|
||||
}
|
||||
|
||||
Texture::Texture( const string &f,int flags ){
|
||||
flags=filterFile( f,flags )|gxCanvas::CANVAS_TEXTURE;
|
||||
if( flags & gxCanvas::CANVAS_TEX_MASK ) flags|=gxCanvas::CANVAS_TEX_RGB|gxCanvas::CANVAS_TEX_ALPHA;
|
||||
rep=d_new Rep( f,flags,0,0,0,1 );
|
||||
Texture::Texture(const string &f, int flags) {
|
||||
flags = filterFile(f, flags) | gxCanvas::CANVAS_TEXTURE;
|
||||
if (flags & gxCanvas::CANVAS_TEX_MASK) flags |= gxCanvas::CANVAS_TEX_RGB | gxCanvas::CANVAS_TEX_ALPHA;
|
||||
rep = d_new Rep(f, flags, 0, 0, 0, 1);
|
||||
}
|
||||
|
||||
Texture::Texture( const string &f,int flags,int w,int h,int first,int cnt ){
|
||||
flags=filterFile( f,flags )|gxCanvas::CANVAS_TEXTURE;
|
||||
if( flags & gxCanvas::CANVAS_TEX_MASK ) flags|=gxCanvas::CANVAS_TEX_RGB|gxCanvas::CANVAS_TEX_ALPHA;
|
||||
rep=d_new Rep( f,flags,w,h,first,cnt );
|
||||
Texture::Texture(const string &f, int flags, int w, int h, int first, int cnt) {
|
||||
flags = filterFile(f, flags) | gxCanvas::CANVAS_TEXTURE;
|
||||
if (flags & gxCanvas::CANVAS_TEX_MASK) flags |= gxCanvas::CANVAS_TEX_RGB | gxCanvas::CANVAS_TEX_ALPHA;
|
||||
rep = d_new Rep(f, flags, w, h, first, cnt);
|
||||
}
|
||||
|
||||
Texture::Texture( int w,int h,int flags,int cnt ){
|
||||
flags|=gxCanvas::CANVAS_TEXTURE;
|
||||
if( flags & gxCanvas::CANVAS_TEX_MASK ) flags|=gxCanvas::CANVAS_TEX_RGB|gxCanvas::CANVAS_TEX_ALPHA;
|
||||
rep=d_new Rep( w,h,flags,cnt );
|
||||
Texture::Texture(int w, int h, int flags, int cnt) {
|
||||
flags |= gxCanvas::CANVAS_TEXTURE;
|
||||
if (flags & gxCanvas::CANVAS_TEX_MASK) flags |= gxCanvas::CANVAS_TEX_RGB | gxCanvas::CANVAS_TEX_ALPHA;
|
||||
rep = d_new Rep(w, h, flags, cnt);
|
||||
}
|
||||
|
||||
Texture::Texture( const Texture &t ):
|
||||
rep(t.rep){
|
||||
if( rep ) ++rep->ref_cnt;
|
||||
Texture::Texture(const Texture &t) :
|
||||
rep(t.rep) {
|
||||
if (rep) ++rep->ref_cnt;
|
||||
}
|
||||
|
||||
Texture::~Texture(){
|
||||
if( rep && !--rep->ref_cnt ) delete rep;
|
||||
Texture::~Texture() {
|
||||
if (rep && !--rep->ref_cnt) delete rep;
|
||||
}
|
||||
|
||||
Texture &Texture::operator=( const Texture &t ){
|
||||
if( t.rep ) ++t.rep->ref_cnt;
|
||||
if( rep && !--rep->ref_cnt ) delete rep;
|
||||
rep=t.rep;
|
||||
Texture &Texture::operator=(const Texture &t) {
|
||||
if (t.rep) ++t.rep->ref_cnt;
|
||||
if (rep && !--rep->ref_cnt) delete rep;
|
||||
rep = t.rep;
|
||||
return *this;
|
||||
}
|
||||
|
||||
void Texture::setScale( float u_scale,float v_scale ){
|
||||
if( !rep ) return;
|
||||
rep->sx=u_scale;rep->sy=v_scale;
|
||||
rep->mat_valid=false;
|
||||
rep->mat_used=true;
|
||||
void Texture::setScale(float u_scale, float v_scale) {
|
||||
if (!rep) return;
|
||||
rep->sx = u_scale; rep->sy = v_scale;
|
||||
rep->mat_valid = false;
|
||||
rep->mat_used = true;
|
||||
}
|
||||
|
||||
void Texture::setRotation( float angle ){
|
||||
if( !rep ) return;
|
||||
rep->rot=angle;
|
||||
rep->mat_valid=false;
|
||||
rep->mat_used=true;
|
||||
void Texture::setRotation(float angle) {
|
||||
if (!rep) return;
|
||||
rep->rot = angle;
|
||||
rep->mat_valid = false;
|
||||
rep->mat_used = true;
|
||||
}
|
||||
|
||||
void Texture::setPosition( float u_pos,float v_pos ){
|
||||
if( !rep ) return;
|
||||
rep->tx=u_pos;
|
||||
rep->ty=v_pos;
|
||||
rep->mat_valid=false;
|
||||
rep->mat_used=true;
|
||||
void Texture::setPosition(float u_pos, float v_pos) {
|
||||
if (!rep) return;
|
||||
rep->tx = u_pos;
|
||||
rep->ty = v_pos;
|
||||
rep->mat_valid = false;
|
||||
rep->mat_used = true;
|
||||
}
|
||||
|
||||
void Texture::setBlend( int blend ){
|
||||
if( !rep ) return;
|
||||
rep->tex_blend=blend;
|
||||
void Texture::setBlend(int blend) {
|
||||
if (!rep) return;
|
||||
rep->tex_blend = blend;
|
||||
}
|
||||
|
||||
void Texture::setFlags( int flags ){
|
||||
if( !rep ) return;
|
||||
rep->tex_flags=flags;
|
||||
void Texture::setFlags(int flags) {
|
||||
if (!rep) return;
|
||||
rep->tex_flags = flags;
|
||||
}
|
||||
|
||||
bool Texture::isTransparent()const{
|
||||
bool Texture::isTransparent()const {
|
||||
return rep ? rep->transparent : false;
|
||||
}
|
||||
|
||||
gxCanvas *Texture::getCanvas( int n )const{
|
||||
return rep && n>=0 && n<rep->tex_frames.size() ? rep->tex_frames[n] : 0;
|
||||
gxCanvas *Texture::getCanvas(int n)const {
|
||||
return rep && n >= 0 && n < rep->tex_frames.size() ? rep->tex_frames[n] : 0;
|
||||
}
|
||||
|
||||
int Texture::getCanvasFlags()const{
|
||||
int Texture::getCanvasFlags()const {
|
||||
return rep && rep->tex_frames.size() ? rep->tex_frames[0]->getFlags() : 0;
|
||||
}
|
||||
|
||||
CachedTexture *Texture::getCachedTexture()const{
|
||||
CachedTexture *Texture::getCachedTexture()const {
|
||||
return rep ? &rep->cached_tex : 0;
|
||||
}
|
||||
|
||||
int Texture::getBlend()const{
|
||||
int Texture::getBlend()const {
|
||||
return rep ? rep->tex_blend : 0;
|
||||
}
|
||||
|
||||
int Texture::getFlags()const{
|
||||
int Texture::getFlags()const {
|
||||
return rep ? rep->tex_flags : 0;
|
||||
}
|
||||
|
||||
const gxScene::Matrix *Texture::getMatrix()const{
|
||||
if( !rep || !rep->mat_used ) return 0;
|
||||
if( !rep->mat_valid ){
|
||||
float c=cos(rep->rot),s=sin(rep->rot);
|
||||
rep->matrix.elements[0][0]=c*rep->sx;
|
||||
rep->matrix.elements[1][0]=s*rep->sx;
|
||||
rep->matrix.elements[0][1]=-s*rep->sy;
|
||||
rep->matrix.elements[1][1]=c*rep->sy;
|
||||
rep->matrix.elements[2][0]=rep->tx;
|
||||
rep->matrix.elements[2][1]=rep->ty;
|
||||
rep->mat_valid=true;
|
||||
const gxScene::Matrix *Texture::getMatrix()const {
|
||||
if (!rep || !rep->mat_used) return 0;
|
||||
if (!rep->mat_valid) {
|
||||
float c = cos(rep->rot), s = sin(rep->rot);
|
||||
rep->matrix.elements[0][0] = c*rep->sx;
|
||||
rep->matrix.elements[1][0] = s*rep->sx;
|
||||
rep->matrix.elements[0][1] = -s*rep->sy;
|
||||
rep->matrix.elements[1][1] = c*rep->sy;
|
||||
rep->matrix.elements[2][0] = rep->tx;
|
||||
rep->matrix.elements[2][1] = rep->ty;
|
||||
rep->mat_valid = true;
|
||||
}
|
||||
return &rep->matrix;
|
||||
}
|
||||
|
||||
bool Texture::operator<( const Texture &t )const{
|
||||
if( rep && t.rep ) return rep->cached_tex<t.rep->cached_tex;
|
||||
return rep<t.rep;
|
||||
bool Texture::operator<(const Texture &t)const {
|
||||
if (rep && t.rep) return rep->cached_tex < t.rep->cached_tex;
|
||||
return rep < t.rep;
|
||||
}
|
||||
|
||||
void Texture::clearFilters(){
|
||||
void Texture::clearFilters() {
|
||||
filters.clear();
|
||||
}
|
||||
|
||||
void Texture::addFilter( const string &t,int flags ){
|
||||
filters.push_back( Filter( tolower(t),flags ) );
|
||||
void Texture::addFilter(const string &t, int flags) {
|
||||
filters.push_back(Filter(tolower(t), flags));
|
||||
}
|
||||
|
||||
+3
-3
@@ -257,7 +257,7 @@ void World::collide( Object *src ){
|
||||
}else if( n_hit==1 ){
|
||||
if( planes[0].distance(nv)>=0 ){
|
||||
dv=nv;n_hit=0;
|
||||
}else if( fabs( planes[0].n.dot( coll_plane.n ) )<1-FLT_FLT_EPSILON ){
|
||||
}else if( fabs( planes[0].n.dot( coll_plane.n ) )<1-FLT_EPSILON ){
|
||||
dv=coll_plane.intersect( planes[0] ).nearest( dv );
|
||||
}else{
|
||||
//SQUISHED!
|
||||
@@ -277,11 +277,11 @@ void World::collide( Object *src ){
|
||||
|
||||
if( coll_info->response==COLLISION_RESPONSE_SLIDE ){
|
||||
float d=dd.length();
|
||||
if( d<= FLT_FLT_EPSILON ){ dv=sv;break; }
|
||||
if( d<= FLT_EPSILON ){ dv=sv;break; }
|
||||
if( d>td ) dd*=td/d;
|
||||
}else if( coll_info->response==COLLISION_RESPONSE_SLIDEXZ ){
|
||||
float d=Vector( dd.x,0,dd.z ).length();
|
||||
if( d<= FLT_FLT_EPSILON ){ dv=sv;break; }
|
||||
if( d<= FLT_EPSILON ){ dv=sv;break; }
|
||||
if( d>td_xz ) dd*=td_xz/d;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user