aboutsummaryrefslogtreecommitdiff
path: root/APEX_1.4/shared/general/RenderDebug
diff options
context:
space:
mode:
authorgit perforce import user <a@b>2016-10-25 12:29:14 -0600
committerSheikh Dawood Abdul Ajees <Sheikh Dawood Abdul Ajees>2016-10-25 18:56:37 -0500
commit3dfe2108cfab31ba3ee5527e217d0d8e99a51162 (patch)
treefa6485c169e50d7415a651bf838f5bcd0fd3bfbd /APEX_1.4/shared/general/RenderDebug
downloadphysx-3.4-3dfe2108cfab31ba3ee5527e217d0d8e99a51162.tar.xz
physx-3.4-3dfe2108cfab31ba3ee5527e217d0d8e99a51162.zip
Initial commit:
PhysX 3.4.0 Update @ 21294896 APEX 1.4.0 Update @ 21275617 [CL 21300167]
Diffstat (limited to 'APEX_1.4/shared/general/RenderDebug')
-rw-r--r--APEX_1.4/shared/general/RenderDebug/compiler/vc11win32-PhysX_3.4/RenderDebug.sln30
-rw-r--r--APEX_1.4/shared/general/RenderDebug/compiler/vc11win32-PhysX_3.4/RenderDebug.vcxproj288
-rw-r--r--APEX_1.4/shared/general/RenderDebug/compiler/vc11win32-PhysX_3.4/RenderDebug.vcxproj.filters96
-rw-r--r--APEX_1.4/shared/general/RenderDebug/compiler/vc11win64-PhysX_3.4/RenderDebug.sln30
-rw-r--r--APEX_1.4/shared/general/RenderDebug/compiler/vc11win64-PhysX_3.4/RenderDebug.vcxproj284
-rw-r--r--APEX_1.4/shared/general/RenderDebug/compiler/vc11win64-PhysX_3.4/RenderDebug.vcxproj.filters96
-rw-r--r--APEX_1.4/shared/general/RenderDebug/compiler/vc12win32-PhysX_3.4/RenderDebug.sln30
-rw-r--r--APEX_1.4/shared/general/RenderDebug/compiler/vc12win32-PhysX_3.4/RenderDebug.vcxproj288
-rw-r--r--APEX_1.4/shared/general/RenderDebug/compiler/vc12win32-PhysX_3.4/RenderDebug.vcxproj.filters96
-rw-r--r--APEX_1.4/shared/general/RenderDebug/compiler/vc12win64-PhysX_3.4/RenderDebug.sln30
-rw-r--r--APEX_1.4/shared/general/RenderDebug/compiler/vc12win64-PhysX_3.4/RenderDebug.vcxproj284
-rw-r--r--APEX_1.4/shared/general/RenderDebug/compiler/vc12win64-PhysX_3.4/RenderDebug.vcxproj.filters96
-rw-r--r--APEX_1.4/shared/general/RenderDebug/compiler/vc14win32-PhysX_3.4/RenderDebug.sln30
-rw-r--r--APEX_1.4/shared/general/RenderDebug/compiler/vc14win32-PhysX_3.4/RenderDebug.vcxproj271
-rw-r--r--APEX_1.4/shared/general/RenderDebug/compiler/vc14win32-PhysX_3.4/RenderDebug.vcxproj.filters96
-rw-r--r--APEX_1.4/shared/general/RenderDebug/compiler/vc14win64-PhysX_3.4/RenderDebug.sln30
-rw-r--r--APEX_1.4/shared/general/RenderDebug/compiler/vc14win64-PhysX_3.4/RenderDebug.vcxproj271
-rw-r--r--APEX_1.4/shared/general/RenderDebug/compiler/vc14win64-PhysX_3.4/RenderDebug.vcxproj.filters96
-rw-r--r--APEX_1.4/shared/general/RenderDebug/include/ClientServer.h102
-rw-r--r--APEX_1.4/shared/general/RenderDebug/include/FileRenderDebug.h66
-rw-r--r--APEX_1.4/shared/general/RenderDebug/include/GetArgs.h88
-rw-r--r--APEX_1.4/shared/general/RenderDebug/include/Hull2MeshEdges.h46
-rw-r--r--APEX_1.4/shared/general/RenderDebug/include/InternalRenderDebug.h51
-rw-r--r--APEX_1.4/shared/general/RenderDebug/include/ProcessRenderDebug.h92
-rw-r--r--APEX_1.4/shared/general/RenderDebug/include/PsCommLayer.h41
-rw-r--r--APEX_1.4/shared/general/RenderDebug/include/PsCommStream.h24
-rw-r--r--APEX_1.4/shared/general/RenderDebug/include/RenderDebugData.h2289
-rw-r--r--APEX_1.4/shared/general/RenderDebug/include/RenderDebugImpl.h233
-rw-r--r--APEX_1.4/shared/general/RenderDebug/include/StreamIO.h126
-rw-r--r--APEX_1.4/shared/general/RenderDebug/include/StreamIO.inl320
-rw-r--r--APEX_1.4/shared/general/RenderDebug/public/RenderDebug.h2184
-rw-r--r--APEX_1.4/shared/general/RenderDebug/public/RenderDebugTyped.h443
-rw-r--r--APEX_1.4/shared/general/RenderDebug/src/ClientServer.cpp1133
-rw-r--r--APEX_1.4/shared/general/RenderDebug/src/FileRenderDebug.cpp621
-rw-r--r--APEX_1.4/shared/general/RenderDebug/src/Hull2MeshEdges.cpp459
-rw-r--r--APEX_1.4/shared/general/RenderDebug/src/InternalRenderDebug.cpp2708
-rw-r--r--APEX_1.4/shared/general/RenderDebug/src/ProcessRenderDebug.cpp3342
-rw-r--r--APEX_1.4/shared/general/RenderDebug/src/PsCommLayer.cpp567
-rw-r--r--APEX_1.4/shared/general/RenderDebug/src/PsCommStream.cpp291
-rw-r--r--APEX_1.4/shared/general/RenderDebug/src/RenderDebug.cpp817
-rw-r--r--APEX_1.4/shared/general/RenderDebug/src/RenderDebugDLLMain.cpp37
41 files changed, 18522 insertions, 0 deletions
diff --git a/APEX_1.4/shared/general/RenderDebug/compiler/vc11win32-PhysX_3.4/RenderDebug.sln b/APEX_1.4/shared/general/RenderDebug/compiler/vc11win32-PhysX_3.4/RenderDebug.sln
new file mode 100644
index 00000000..7b35fe97
--- /dev/null
+++ b/APEX_1.4/shared/general/RenderDebug/compiler/vc11win32-PhysX_3.4/RenderDebug.sln
@@ -0,0 +1,30 @@
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 2012
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RenderDebug", "./RenderDebug.vcxproj", "{473AD218-8370-A35E-CAB1-F030F86A6449}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ checked|Win32 = checked|Win32
+ debug|Win32 = debug|Win32
+ profile|Win32 = profile|Win32
+ release|Win32 = release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {473AD218-8370-A35E-CAB1-F030F86A6449}.checked|Win32.ActiveCfg = checked|Win32
+ {473AD218-8370-A35E-CAB1-F030F86A6449}.checked|Win32.Build.0 = checked|Win32
+ {473AD218-8370-A35E-CAB1-F030F86A6449}.debug|Win32.ActiveCfg = debug|Win32
+ {473AD218-8370-A35E-CAB1-F030F86A6449}.debug|Win32.Build.0 = debug|Win32
+ {473AD218-8370-A35E-CAB1-F030F86A6449}.profile|Win32.ActiveCfg = profile|Win32
+ {473AD218-8370-A35E-CAB1-F030F86A6449}.profile|Win32.Build.0 = profile|Win32
+ {473AD218-8370-A35E-CAB1-F030F86A6449}.release|Win32.ActiveCfg = release|Win32
+ {473AD218-8370-A35E-CAB1-F030F86A6449}.release|Win32.Build.0 = release|Win32
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddins) = postSolution
+ EndGlobalSection
+ GlobalSection(NestedProjects) = preSolution
+ EndGlobalSection
+EndGlobal
diff --git a/APEX_1.4/shared/general/RenderDebug/compiler/vc11win32-PhysX_3.4/RenderDebug.vcxproj b/APEX_1.4/shared/general/RenderDebug/compiler/vc11win32-PhysX_3.4/RenderDebug.vcxproj
new file mode 100644
index 00000000..e0579d90
--- /dev/null
+++ b/APEX_1.4/shared/general/RenderDebug/compiler/vc11win32-PhysX_3.4/RenderDebug.vcxproj
@@ -0,0 +1,288 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project
+ DefaultTargets="Build"
+ ToolsVersion="4.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="release|Win32">
+ <Configuration>release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="profile|Win32">
+ <Configuration>profile</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="checked|Win32">
+ <Configuration>checked</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{473AD218-8370-A35E-CAB1-F030F86A6449}</ProjectGuid>
+ <RootNamespace>RenderDebug</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup
+ Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"
+ Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <PlatformToolset>v110</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup
+ Condition="'$(Configuration)|$(Platform)'=='release|Win32'"
+ Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <PlatformToolset>v110</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup
+ Condition="'$(Configuration)|$(Platform)'=='profile|Win32'"
+ Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <PlatformToolset>v110</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup
+ Condition="'$(Configuration)|$(Platform)'=='checked|Win32'"
+ Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <PlatformToolset>v110</PlatformToolset>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings"></ImportGroup>
+ <ImportGroup
+ Label="PropertySheets"
+ Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">
+ <Import
+ Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"
+ Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')"
+ Label="LocalAppDataPlatform"
+ />
+ <Import Project="../../../../../compiler/paths.vsprops" />
+ </ImportGroup>
+ <ImportGroup
+ Label="PropertySheets"
+ Condition="'$(Configuration)|$(Platform)'=='release|Win32'">
+ <Import
+ Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"
+ Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')"
+ Label="LocalAppDataPlatform"
+ />
+ <Import Project="../../../../../compiler/paths.vsprops" />
+ </ImportGroup>
+ <ImportGroup
+ Label="PropertySheets"
+ Condition="'$(Configuration)|$(Platform)'=='profile|Win32'">
+ <Import
+ Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"
+ Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')"
+ Label="LocalAppDataPlatform"
+ />
+ <Import Project="../../../../../compiler/paths.vsprops" />
+ </ImportGroup>
+ <ImportGroup
+ Label="PropertySheets"
+ Condition="'$(Configuration)|$(Platform)'=='checked|Win32'">
+ <Import
+ Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"
+ Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')"
+ Label="LocalAppDataPlatform"
+ />
+ <Import Project="../../../../../compiler/paths.vsprops" />
+ </ImportGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">
+ <OutDir>./../../lib/vc11win32\</OutDir>
+ <IntDir>./build/Win32/RenderDebug/debug\</IntDir>
+ <TargetExt>.lib</TargetExt>
+ <TargetName>$(ProjectName)DEBUG</TargetName>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules/>
+ <CodeAnalysisRuleAssemblies/>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">
+ <ClCompile>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <StringPooling>true</StringPooling>
+ <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
+ <RuntimeTypeInfo>false</RuntimeTypeInfo>
+ <FloatingPointModel>Fast</FloatingPointModel>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <AdditionalOptions>/wd4201 /wd4324 /Wall /wd4514 /wd4820 /wd4127 /wd4710 /wd4711 /wd4061 /wd4668 /wd4626 /wd4266 /wd4263 /wd4264 /wd4640 /wd4625 /wd4574 /wd4191 /wd4987 /wd4986 /wd4946 /wd4836 /wd4571 /wd4826 /wd4577 /wd4458 /MP /d2Zi+</AdditionalOptions>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>./../../include;./../../public;../../../../../../PxShared/include;../../../../../../PxShared/include/filebuf;../../../../../../PxShared/include/foundation;../../../../../../PxShared/include/task;../../../../../../PxShared/include/cudamanager;../../../../../../PxShared/include/pvd;../../../../../../PxShared/src/foundation/include;../../../../../../PxShared/src/filebuf/include;../../../../../../PxShared/src/fastxml/include;../../../../../../PxShared/src/pvd/include;./../../../shared;./../../../../../public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>PX_FOUNDATION_DLL=0;WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_DEBUG;PX_DEBUG;PX_CHECKED;PHYSX_PROFILE_SDK;PX_SUPPORT_VISUAL_DEBUGGER;PX_PROFILE;PX_NVTX=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <ExceptionHandling>false</ExceptionHandling>
+ <WarningLevel>Level4</WarningLevel>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <PrecompiledHeaderFile></PrecompiledHeaderFile>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <Lib>
+ <AdditionalOptions>/INCREMENTAL:NO</AdditionalOptions>
+ <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>$(OutDir)$(ProjectName)DEBUG.lib</OutputFile>
+ <AdditionalLibraryDirectories>../../../../../../PxShared/lib/vc11win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <ProgramDatabaseFile>$(OutDir)/$(ProjectName)DEBUG.lib.pdb</ProgramDatabaseFile>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Lib>
+ <ResourceCompile></ResourceCompile>
+ <ProjectReference>
+ <LinkLibraryDependencies>true</LinkLibraryDependencies>
+ </ProjectReference>
+ </ItemDefinitionGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release|Win32'">
+ <OutDir>./../../lib/vc11win32\</OutDir>
+ <IntDir>./build/Win32/RenderDebug/release\</IntDir>
+ <TargetExt>.lib</TargetExt>
+ <TargetName>$(ProjectName)</TargetName>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules/>
+ <CodeAnalysisRuleAssemblies/>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='release|Win32'">
+ <ClCompile>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <StringPooling>true</StringPooling>
+ <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
+ <RuntimeTypeInfo>false</RuntimeTypeInfo>
+ <FloatingPointModel>Fast</FloatingPointModel>
+ <AdditionalOptions>/wd4201 /wd4324 /Wall /wd4514 /wd4820 /wd4127 /wd4710 /wd4711 /wd4061 /wd4668 /wd4626 /wd4266 /wd4263 /wd4264 /wd4640 /wd4625 /wd4574 /wd4191 /wd4987 /wd4986 /wd4946 /wd4836 /wd4571 /wd4826 /wd4577 /wd4458 /MP /d2Zi+</AdditionalOptions>
+ <Optimization>Full</Optimization>
+ <AdditionalIncludeDirectories>./../../include;./../../public;../../../../../../PxShared/include;../../../../../../PxShared/include/filebuf;../../../../../../PxShared/include/foundation;../../../../../../PxShared/include/task;../../../../../../PxShared/include/cudamanager;../../../../../../PxShared/include/pvd;../../../../../../PxShared/src/foundation/include;../../../../../../PxShared/src/filebuf/include;../../../../../../PxShared/src/fastxml/include;../../../../../../PxShared/src/pvd/include;./../../../shared;./../../../../../public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>PX_FOUNDATION_DLL=0;WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;NDEBUG;APEX_SHIPPING;_SECURE_SCL=0;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <ExceptionHandling>false</ExceptionHandling>
+ <WarningLevel>Level4</WarningLevel>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <PrecompiledHeaderFile></PrecompiledHeaderFile>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <Lib>
+ <AdditionalOptions>/INCREMENTAL:NO</AdditionalOptions>
+ <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>$(OutDir)$(ProjectName).lib</OutputFile>
+ <AdditionalLibraryDirectories>../../../../../../PxShared/lib/vc11win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <ProgramDatabaseFile>$(OutDir)/$(ProjectName).lib.pdb</ProgramDatabaseFile>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Lib>
+ <ResourceCompile></ResourceCompile>
+ <ProjectReference>
+ <LinkLibraryDependencies>true</LinkLibraryDependencies>
+ </ProjectReference>
+ </ItemDefinitionGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='profile|Win32'">
+ <OutDir>./../../lib/vc11win32\</OutDir>
+ <IntDir>./build/Win32/RenderDebug/profile\</IntDir>
+ <TargetExt>.lib</TargetExt>
+ <TargetName>$(ProjectName)PROFILE</TargetName>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules/>
+ <CodeAnalysisRuleAssemblies/>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='profile|Win32'">
+ <ClCompile>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <StringPooling>true</StringPooling>
+ <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
+ <RuntimeTypeInfo>false</RuntimeTypeInfo>
+ <FloatingPointModel>Fast</FloatingPointModel>
+ <AdditionalOptions>/wd4201 /wd4324 /Wall /wd4514 /wd4820 /wd4127 /wd4710 /wd4711 /wd4061 /wd4668 /wd4626 /wd4266 /wd4263 /wd4264 /wd4640 /wd4625 /wd4574 /wd4191 /wd4987 /wd4986 /wd4946 /wd4836 /wd4571 /wd4826 /wd4577 /wd4458 /MP /d2Zi+</AdditionalOptions>
+ <Optimization>Full</Optimization>
+ <AdditionalIncludeDirectories>./../../include;./../../public;../../../../../../PxShared/include;../../../../../../PxShared/include/filebuf;../../../../../../PxShared/include/foundation;../../../../../../PxShared/include/task;../../../../../../PxShared/include/cudamanager;../../../../../../PxShared/include/pvd;../../../../../../PxShared/src/foundation/include;../../../../../../PxShared/src/filebuf/include;../../../../../../PxShared/src/fastxml/include;../../../../../../PxShared/src/pvd/include;./../../../shared;./../../../../../public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>PX_FOUNDATION_DLL=0;WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;NDEBUG;PHYSX_PROFILE_SDK;PX_SUPPORT_VISUAL_DEBUGGER;PX_PROFILE;PX_NVTX=1;_SECURE_SCL=0;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <ExceptionHandling>false</ExceptionHandling>
+ <WarningLevel>Level4</WarningLevel>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <PrecompiledHeaderFile></PrecompiledHeaderFile>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <Lib>
+ <AdditionalOptions>/INCREMENTAL:NO</AdditionalOptions>
+ <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>$(OutDir)$(ProjectName)PROFILE.lib</OutputFile>
+ <AdditionalLibraryDirectories>../../../../../../PxShared/lib/vc11win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <ProgramDatabaseFile>$(OutDir)/$(ProjectName)PROFILE.lib.pdb</ProgramDatabaseFile>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Lib>
+ <ResourceCompile></ResourceCompile>
+ <ProjectReference>
+ <LinkLibraryDependencies>true</LinkLibraryDependencies>
+ </ProjectReference>
+ </ItemDefinitionGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='checked|Win32'">
+ <OutDir>./../../lib/vc11win32\</OutDir>
+ <IntDir>./build/Win32/RenderDebug/checked\</IntDir>
+ <TargetExt>.lib</TargetExt>
+ <TargetName>$(ProjectName)CHECKED</TargetName>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules/>
+ <CodeAnalysisRuleAssemblies/>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='checked|Win32'">
+ <ClCompile>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <StringPooling>true</StringPooling>
+ <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
+ <RuntimeTypeInfo>false</RuntimeTypeInfo>
+ <FloatingPointModel>Fast</FloatingPointModel>
+ <AdditionalOptions>/wd4201 /wd4324 /Wall /wd4514 /wd4820 /wd4127 /wd4710 /wd4711 /wd4061 /wd4668 /wd4626 /wd4266 /wd4263 /wd4264 /wd4640 /wd4625 /wd4574 /wd4191 /wd4987 /wd4986 /wd4946 /wd4836 /wd4571 /wd4826 /wd4577 /wd4458 /MP /d2Zi+</AdditionalOptions>
+ <Optimization>Full</Optimization>
+ <AdditionalIncludeDirectories>./../../include;./../../public;../../../../../../PxShared/include;../../../../../../PxShared/include/filebuf;../../../../../../PxShared/include/foundation;../../../../../../PxShared/include/task;../../../../../../PxShared/include/cudamanager;../../../../../../PxShared/include/pvd;../../../../../../PxShared/src/foundation/include;../../../../../../PxShared/src/filebuf/include;../../../../../../PxShared/src/fastxml/include;../../../../../../PxShared/src/pvd/include;./../../../shared;./../../../../../public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>PX_FOUNDATION_DLL=0;WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;NDEBUG;PX_CHECKED;PHYSX_PROFILE_SDK;PX_SUPPORT_VISUAL_DEBUGGER;PX_ENABLE_CHECKED_ASSERTS;PX_NVTX=1;_SECURE_SCL=0;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <ExceptionHandling>false</ExceptionHandling>
+ <WarningLevel>Level4</WarningLevel>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <PrecompiledHeaderFile></PrecompiledHeaderFile>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <Lib>
+ <AdditionalOptions>/INCREMENTAL:NO</AdditionalOptions>
+ <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>$(OutDir)$(ProjectName)CHECKED.lib</OutputFile>
+ <AdditionalLibraryDirectories>../../../../../../PxShared/lib/vc11win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <ProgramDatabaseFile>$(OutDir)/$(ProjectName)CHECKED.lib.pdb</ProgramDatabaseFile>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Lib>
+ <ResourceCompile></ResourceCompile>
+ <ProjectReference>
+ <LinkLibraryDependencies>true</LinkLibraryDependencies>
+ </ProjectReference>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\public\RenderDebug.h"></ClInclude>
+ <ClInclude Include="..\..\public\RenderDebugTyped.h"></ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\include\ClientServer.h"></ClInclude>
+ <ClInclude Include="..\..\include\FileRenderDebug.h"></ClInclude>
+ <ClInclude Include="..\..\include\GetArgs.h"></ClInclude>
+ <ClInclude Include="..\..\include\Hull2MeshEdges.h"></ClInclude>
+ <ClInclude Include="..\..\include\InternalRenderDebug.h"></ClInclude>
+ <ClInclude Include="..\..\include\ProcessRenderDebug.h"></ClInclude>
+ <ClInclude Include="..\..\include\PsCommLayer.h"></ClInclude>
+ <ClInclude Include="..\..\include\PsCommStream.h"></ClInclude>
+ <ClInclude Include="..\..\include\RenderDebugData.h"></ClInclude>
+ <ClInclude Include="..\..\include\RenderDebugImpl.h"></ClInclude>
+ <ClInclude Include="..\..\include\StreamIO.h"></ClInclude>
+ <ClInclude Include="..\..\include\StreamIO.inl"></ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\src\ClientServer.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\FileRenderDebug.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\Hull2MeshEdges.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\InternalRenderDebug.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\ProcessRenderDebug.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\PsCommLayer.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\PsCommStream.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\RenderDebug.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\RenderDebugDLLMain.cpp"></ClCompile>
+ </ItemGroup>
+ <ItemGroup></ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets"></ImportGroup>
+</Project>
diff --git a/APEX_1.4/shared/general/RenderDebug/compiler/vc11win32-PhysX_3.4/RenderDebug.vcxproj.filters b/APEX_1.4/shared/general/RenderDebug/compiler/vc11win32-PhysX_3.4/RenderDebug.vcxproj.filters
new file mode 100644
index 00000000..d866c884
--- /dev/null
+++ b/APEX_1.4/shared/general/RenderDebug/compiler/vc11win32-PhysX_3.4/RenderDebug.vcxproj.filters
@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="RenderDebug">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <Filter Include="RenderDebug\public">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\public\RenderDebug.h">
+ <Filter>RenderDebug\public</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\public\RenderDebugTyped.h">
+ <Filter>RenderDebug\public</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <Filter Include="RenderDebug\include">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\include\ClientServer.h">
+ <Filter>RenderDebug\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\FileRenderDebug.h">
+ <Filter>RenderDebug\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\GetArgs.h">
+ <Filter>RenderDebug\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\Hull2MeshEdges.h">
+ <Filter>RenderDebug\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\InternalRenderDebug.h">
+ <Filter>RenderDebug\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\ProcessRenderDebug.h">
+ <Filter>RenderDebug\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\PsCommLayer.h">
+ <Filter>RenderDebug\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\PsCommStream.h">
+ <Filter>RenderDebug\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\RenderDebugData.h">
+ <Filter>RenderDebug\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\RenderDebugImpl.h">
+ <Filter>RenderDebug\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\StreamIO.h">
+ <Filter>RenderDebug\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\StreamIO.inl">
+ <Filter>RenderDebug\include</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <Filter Include="RenderDebug\src">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\src\ClientServer.cpp">
+ <Filter>RenderDebug\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\FileRenderDebug.cpp">
+ <Filter>RenderDebug\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\Hull2MeshEdges.cpp">
+ <Filter>RenderDebug\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\InternalRenderDebug.cpp">
+ <Filter>RenderDebug\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\ProcessRenderDebug.cpp">
+ <Filter>RenderDebug\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\PsCommLayer.cpp">
+ <Filter>RenderDebug\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\PsCommStream.cpp">
+ <Filter>RenderDebug\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\RenderDebug.cpp">
+ <Filter>RenderDebug\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\RenderDebugDLLMain.cpp">
+ <Filter>RenderDebug\src</Filter>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/APEX_1.4/shared/general/RenderDebug/compiler/vc11win64-PhysX_3.4/RenderDebug.sln b/APEX_1.4/shared/general/RenderDebug/compiler/vc11win64-PhysX_3.4/RenderDebug.sln
new file mode 100644
index 00000000..7f33e527
--- /dev/null
+++ b/APEX_1.4/shared/general/RenderDebug/compiler/vc11win64-PhysX_3.4/RenderDebug.sln
@@ -0,0 +1,30 @@
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 2012
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RenderDebug", "./RenderDebug.vcxproj", "{473AD218-8370-A35E-CAB1-F030F86A6449}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ checked|x64 = checked|x64
+ debug|x64 = debug|x64
+ profile|x64 = profile|x64
+ release|x64 = release|x64
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {473AD218-8370-A35E-CAB1-F030F86A6449}.checked|x64.ActiveCfg = checked|x64
+ {473AD218-8370-A35E-CAB1-F030F86A6449}.checked|x64.Build.0 = checked|x64
+ {473AD218-8370-A35E-CAB1-F030F86A6449}.debug|x64.ActiveCfg = debug|x64
+ {473AD218-8370-A35E-CAB1-F030F86A6449}.debug|x64.Build.0 = debug|x64
+ {473AD218-8370-A35E-CAB1-F030F86A6449}.profile|x64.ActiveCfg = profile|x64
+ {473AD218-8370-A35E-CAB1-F030F86A6449}.profile|x64.Build.0 = profile|x64
+ {473AD218-8370-A35E-CAB1-F030F86A6449}.release|x64.ActiveCfg = release|x64
+ {473AD218-8370-A35E-CAB1-F030F86A6449}.release|x64.Build.0 = release|x64
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddins) = postSolution
+ EndGlobalSection
+ GlobalSection(NestedProjects) = preSolution
+ EndGlobalSection
+EndGlobal
diff --git a/APEX_1.4/shared/general/RenderDebug/compiler/vc11win64-PhysX_3.4/RenderDebug.vcxproj b/APEX_1.4/shared/general/RenderDebug/compiler/vc11win64-PhysX_3.4/RenderDebug.vcxproj
new file mode 100644
index 00000000..3f8bac6f
--- /dev/null
+++ b/APEX_1.4/shared/general/RenderDebug/compiler/vc11win64-PhysX_3.4/RenderDebug.vcxproj
@@ -0,0 +1,284 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project
+ DefaultTargets="Build"
+ ToolsVersion="4.0"
+ xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="debug|x64">
+ <Configuration>debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="release|x64">
+ <Configuration>release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="profile|x64">
+ <Configuration>profile</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="checked|x64">
+ <Configuration>checked</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{473AD218-8370-A35E-CAB1-F030F86A6449}</ProjectGuid>
+ <RootNamespace>RenderDebug</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup
+ Condition="'$(Configuration)|$(Platform)'=='debug|x64'"
+ Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <PlatformToolset>v110</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup
+ Condition="'$(Configuration)|$(Platform)'=='release|x64'"
+ Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <PlatformToolset>v110</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup
+ Condition="'$(Configuration)|$(Platform)'=='profile|x64'"
+ Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <PlatformToolset>v110</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup
+ Condition="'$(Configuration)|$(Platform)'=='checked|x64'"
+ Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <PlatformToolset>v110</PlatformToolset>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings"></ImportGroup>
+ <ImportGroup
+ Label="PropertySheets"
+ Condition="'$(Configuration)|$(Platform)'=='debug|x64'">
+ <Import
+ Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"
+ Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')"
+ Label="LocalAppDataPlatform"
+ />
+ <Import Project="../../../../../compiler/paths.vsprops" />
+ </ImportGroup>
+ <ImportGroup
+ Label="PropertySheets"
+ Condition="'$(Configuration)|$(Platform)'=='release|x64'">
+ <Import
+ Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"
+ Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')"
+ Label="LocalAppDataPlatform"
+ />
+ <Import Project="../../../../../compiler/paths.vsprops" />
+ </ImportGroup>
+ <ImportGroup
+ Label="PropertySheets"
+ Condition="'$(Configuration)|$(Platform)'=='profile|x64'">
+ <Import
+ Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"
+ Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')"
+ Label="LocalAppDataPlatform"
+ />
+ <Import Project="../../../../../compiler/paths.vsprops" />
+ </ImportGroup>
+ <ImportGroup
+ Label="PropertySheets"
+ Condition="'$(Configuration)|$(Platform)'=='checked|x64'">
+ <Import
+ Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"
+ Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')"
+ Label="LocalAppDataPlatform"
+ />
+ <Import Project="../../../../../compiler/paths.vsprops" />
+ </ImportGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|x64'">
+ <OutDir>./../../lib/vc11win64\</OutDir>
+ <IntDir>./build/x64/RenderDebug/debug\</IntDir>
+ <TargetExt>.lib</TargetExt>
+ <TargetName>$(ProjectName)DEBUG</TargetName>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules/>
+ <CodeAnalysisRuleAssemblies/>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='debug|x64'">
+ <ClCompile>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <StringPooling>true</StringPooling>
+ <RuntimeTypeInfo>false</RuntimeTypeInfo>
+ <FloatingPointModel>Fast</FloatingPointModel>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <AdditionalOptions>/wd4201 /wd4324 /Wall /wd4514 /wd4820 /wd4127 /wd4710 /wd4711 /wd4061 /wd4668 /wd4626 /wd4266 /wd4263 /wd4264 /wd4640 /wd4625 /wd4574 /wd4191 /wd4987 /wd4986 /wd4946 /wd4836 /wd4571 /wd4826 /wd4577 /wd4458 /MP /d2Zi+</AdditionalOptions>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>./../../include;./../../public;../../../../../../PxShared/include;../../../../../../PxShared/include/filebuf;../../../../../../PxShared/include/foundation;../../../../../../PxShared/include/task;../../../../../../PxShared/include/cudamanager;../../../../../../PxShared/include/pvd;../../../../../../PxShared/src/foundation/include;../../../../../../PxShared/src/filebuf/include;../../../../../../PxShared/src/fastxml/include;../../../../../../PxShared/src/pvd/include;./../../../shared;./../../../../../public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>PX_FOUNDATION_DLL=0;WIN32;WIN64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_DEBUG;PX_DEBUG;PX_CHECKED;PHYSX_PROFILE_SDK;PX_SUPPORT_VISUAL_DEBUGGER;PX_PROFILE;PX_NVTX=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <ExceptionHandling>false</ExceptionHandling>
+ <WarningLevel>Level4</WarningLevel>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <PrecompiledHeaderFile></PrecompiledHeaderFile>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <Lib>
+ <AdditionalOptions>/INCREMENTAL:NO</AdditionalOptions>
+ <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>$(OutDir)$(ProjectName)DEBUG.lib</OutputFile>
+ <AdditionalLibraryDirectories>../../../../../../PxShared/lib/vc11win64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <ProgramDatabaseFile>$(OutDir)/$(ProjectName)DEBUG.lib.pdb</ProgramDatabaseFile>
+ <TargetMachine>MachineX64</TargetMachine>
+ </Lib>
+ <ResourceCompile></ResourceCompile>
+ <ProjectReference>
+ <LinkLibraryDependencies>true</LinkLibraryDependencies>
+ </ProjectReference>
+ </ItemDefinitionGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release|x64'">
+ <OutDir>./../../lib/vc11win64\</OutDir>
+ <IntDir>./build/x64/RenderDebug/release\</IntDir>
+ <TargetExt>.lib</TargetExt>
+ <TargetName>$(ProjectName)</TargetName>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules/>
+ <CodeAnalysisRuleAssemblies/>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='release|x64'">
+ <ClCompile>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <StringPooling>true</StringPooling>
+ <RuntimeTypeInfo>false</RuntimeTypeInfo>
+ <FloatingPointModel>Fast</FloatingPointModel>
+ <AdditionalOptions>/wd4201 /wd4324 /Wall /wd4514 /wd4820 /wd4127 /wd4710 /wd4711 /wd4061 /wd4668 /wd4626 /wd4266 /wd4263 /wd4264 /wd4640 /wd4625 /wd4574 /wd4191 /wd4987 /wd4986 /wd4946 /wd4836 /wd4571 /wd4826 /wd4577 /wd4458 /MP /d2Zi+</AdditionalOptions>
+ <Optimization>Full</Optimization>
+ <AdditionalIncludeDirectories>./../../include;./../../public;../../../../../../PxShared/include;../../../../../../PxShared/include/filebuf;../../../../../../PxShared/include/foundation;../../../../../../PxShared/include/task;../../../../../../PxShared/include/cudamanager;../../../../../../PxShared/include/pvd;../../../../../../PxShared/src/foundation/include;../../../../../../PxShared/src/filebuf/include;../../../../../../PxShared/src/fastxml/include;../../../../../../PxShared/src/pvd/include;./../../../shared;./../../../../../public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>PX_FOUNDATION_DLL=0;WIN32;WIN64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;NDEBUG;APEX_SHIPPING;_SECURE_SCL=0;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <ExceptionHandling>false</ExceptionHandling>
+ <WarningLevel>Level4</WarningLevel>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <PrecompiledHeaderFile></PrecompiledHeaderFile>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <Lib>
+ <AdditionalOptions>/INCREMENTAL:NO</AdditionalOptions>
+ <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>$(OutDir)$(ProjectName).lib</OutputFile>
+ <AdditionalLibraryDirectories>../../../../../../PxShared/lib/vc11win64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <ProgramDatabaseFile>$(OutDir)/$(ProjectName).lib.pdb</ProgramDatabaseFile>
+ <TargetMachine>MachineX64</TargetMachine>
+ </Lib>
+ <ResourceCompile></ResourceCompile>
+ <ProjectReference>
+ <LinkLibraryDependencies>true</LinkLibraryDependencies>
+ </ProjectReference>
+ </ItemDefinitionGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='profile|x64'">
+ <OutDir>./../../lib/vc11win64\</OutDir>
+ <IntDir>./build/x64/RenderDebug/profile\</IntDir>
+ <TargetExt>.lib</TargetExt>
+ <TargetName>$(ProjectName)PROFILE</TargetName>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules/>
+ <CodeAnalysisRuleAssemblies/>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='profile|x64'">
+ <ClCompile>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <StringPooling>true</StringPooling>
+ <RuntimeTypeInfo>false</RuntimeTypeInfo>
+ <FloatingPointModel>Fast</FloatingPointModel>
+ <AdditionalOptions>/wd4201 /wd4324 /Wall /wd4514 /wd4820 /wd4127 /wd4710 /wd4711 /wd4061 /wd4668 /wd4626 /wd4266 /wd4263 /wd4264 /wd4640 /wd4625 /wd4574 /wd4191 /wd4987 /wd4986 /wd4946 /wd4836 /wd4571 /wd4826 /wd4577 /wd4458 /MP /d2Zi+</AdditionalOptions>
+ <Optimization>Full</Optimization>
+ <AdditionalIncludeDirectories>./../../include;./../../public;../../../../../../PxShared/include;../../../../../../PxShared/include/filebuf;../../../../../../PxShared/include/foundation;../../../../../../PxShared/include/task;../../../../../../PxShared/include/cudamanager;../../../../../../PxShared/include/pvd;../../../../../../PxShared/src/foundation/include;../../../../../../PxShared/src/filebuf/include;../../../../../../PxShared/src/fastxml/include;../../../../../../PxShared/src/pvd/include;./../../../shared;./../../../../../public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>PX_FOUNDATION_DLL=0;WIN32;WIN64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;NDEBUG;PHYSX_PROFILE_SDK;PX_SUPPORT_VISUAL_DEBUGGER;PX_PROFILE;PX_NVTX=1;_SECURE_SCL=0;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <ExceptionHandling>false</ExceptionHandling>
+ <WarningLevel>Level4</WarningLevel>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <PrecompiledHeaderFile></PrecompiledHeaderFile>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <Lib>
+ <AdditionalOptions>/INCREMENTAL:NO</AdditionalOptions>
+ <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>$(OutDir)$(ProjectName)PROFILE.lib</OutputFile>
+ <AdditionalLibraryDirectories>../../../../../../PxShared/lib/vc11win64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <ProgramDatabaseFile>$(OutDir)/$(ProjectName)PROFILE.lib.pdb</ProgramDatabaseFile>
+ <TargetMachine>MachineX64</TargetMachine>
+ </Lib>
+ <ResourceCompile></ResourceCompile>
+ <ProjectReference>
+ <LinkLibraryDependencies>true</LinkLibraryDependencies>
+ </ProjectReference>
+ </ItemDefinitionGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='checked|x64'">
+ <OutDir>./../../lib/vc11win64\</OutDir>
+ <IntDir>./build/x64/RenderDebug/checked\</IntDir>
+ <TargetExt>.lib</TargetExt>
+ <TargetName>$(ProjectName)CHECKED</TargetName>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules/>
+ <CodeAnalysisRuleAssemblies/>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='checked|x64'">
+ <ClCompile>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <StringPooling>true</StringPooling>
+ <RuntimeTypeInfo>false</RuntimeTypeInfo>
+ <FloatingPointModel>Fast</FloatingPointModel>
+ <AdditionalOptions>/wd4201 /wd4324 /Wall /wd4514 /wd4820 /wd4127 /wd4710 /wd4711 /wd4061 /wd4668 /wd4626 /wd4266 /wd4263 /wd4264 /wd4640 /wd4625 /wd4574 /wd4191 /wd4987 /wd4986 /wd4946 /wd4836 /wd4571 /wd4826 /wd4577 /wd4458 /MP /d2Zi+</AdditionalOptions>
+ <Optimization>Full</Optimization>
+ <AdditionalIncludeDirectories>./../../include;./../../public;../../../../../../PxShared/include;../../../../../../PxShared/include/filebuf;../../../../../../PxShared/include/foundation;../../../../../../PxShared/include/task;../../../../../../PxShared/include/cudamanager;../../../../../../PxShared/include/pvd;../../../../../../PxShared/src/foundation/include;../../../../../../PxShared/src/filebuf/include;../../../../../../PxShared/src/fastxml/include;../../../../../../PxShared/src/pvd/include;./../../../shared;./../../../../../public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>PX_FOUNDATION_DLL=0;WIN32;WIN64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;NDEBUG;PX_CHECKED;PHYSX_PROFILE_SDK;PX_SUPPORT_VISUAL_DEBUGGER;PX_ENABLE_CHECKED_ASSERTS;PX_NVTX=1;_SECURE_SCL=0;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <ExceptionHandling>false</ExceptionHandling>
+ <WarningLevel>Level4</WarningLevel>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <PrecompiledHeaderFile></PrecompiledHeaderFile>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <Lib>
+ <AdditionalOptions>/INCREMENTAL:NO</AdditionalOptions>
+ <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>$(OutDir)$(ProjectName)CHECKED.lib</OutputFile>
+ <AdditionalLibraryDirectories>../../../../../../PxShared/lib/vc11win64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <ProgramDatabaseFile>$(OutDir)/$(ProjectName)CHECKED.lib.pdb</ProgramDatabaseFile>
+ <TargetMachine>MachineX64</TargetMachine>
+ </Lib>
+ <ResourceCompile></ResourceCompile>
+ <ProjectReference>
+ <LinkLibraryDependencies>true</LinkLibraryDependencies>
+ </ProjectReference>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\public\RenderDebug.h"></ClInclude>
+ <ClInclude Include="..\..\public\RenderDebugTyped.h"></ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\include\ClientServer.h"></ClInclude>
+ <ClInclude Include="..\..\include\FileRenderDebug.h"></ClInclude>
+ <ClInclude Include="..\..\include\GetArgs.h"></ClInclude>
+ <ClInclude Include="..\..\include\Hull2MeshEdges.h"></ClInclude>
+ <ClInclude Include="..\..\include\InternalRenderDebug.h"></ClInclude>
+ <ClInclude Include="..\..\include\ProcessRenderDebug.h"></ClInclude>
+ <ClInclude Include="..\..\include\PsCommLayer.h"></ClInclude>
+ <ClInclude Include="..\..\include\PsCommStream.h"></ClInclude>
+ <ClInclude Include="..\..\include\RenderDebugData.h"></ClInclude>
+ <ClInclude Include="..\..\include\RenderDebugImpl.h"></ClInclude>
+ <ClInclude Include="..\..\include\StreamIO.h"></ClInclude>
+ <ClInclude Include="..\..\include\StreamIO.inl"></ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\src\ClientServer.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\FileRenderDebug.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\Hull2MeshEdges.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\InternalRenderDebug.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\ProcessRenderDebug.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\PsCommLayer.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\PsCommStream.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\RenderDebug.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\RenderDebugDLLMain.cpp"></ClCompile>
+ </ItemGroup>
+ <ItemGroup></ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets"></ImportGroup>
+</Project>
diff --git a/APEX_1.4/shared/general/RenderDebug/compiler/vc11win64-PhysX_3.4/RenderDebug.vcxproj.filters b/APEX_1.4/shared/general/RenderDebug/compiler/vc11win64-PhysX_3.4/RenderDebug.vcxproj.filters
new file mode 100644
index 00000000..d866c884
--- /dev/null
+++ b/APEX_1.4/shared/general/RenderDebug/compiler/vc11win64-PhysX_3.4/RenderDebug.vcxproj.filters
@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="RenderDebug">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <Filter Include="RenderDebug\public">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\public\RenderDebug.h">
+ <Filter>RenderDebug\public</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\public\RenderDebugTyped.h">
+ <Filter>RenderDebug\public</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <Filter Include="RenderDebug\include">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\include\ClientServer.h">
+ <Filter>RenderDebug\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\FileRenderDebug.h">
+ <Filter>RenderDebug\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\GetArgs.h">
+ <Filter>RenderDebug\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\Hull2MeshEdges.h">
+ <Filter>RenderDebug\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\InternalRenderDebug.h">
+ <Filter>RenderDebug\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\ProcessRenderDebug.h">
+ <Filter>RenderDebug\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\PsCommLayer.h">
+ <Filter>RenderDebug\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\PsCommStream.h">
+ <Filter>RenderDebug\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\RenderDebugData.h">
+ <Filter>RenderDebug\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\RenderDebugImpl.h">
+ <Filter>RenderDebug\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\StreamIO.h">
+ <Filter>RenderDebug\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\StreamIO.inl">
+ <Filter>RenderDebug\include</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <Filter Include="RenderDebug\src">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\src\ClientServer.cpp">
+ <Filter>RenderDebug\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\FileRenderDebug.cpp">
+ <Filter>RenderDebug\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\Hull2MeshEdges.cpp">
+ <Filter>RenderDebug\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\InternalRenderDebug.cpp">
+ <Filter>RenderDebug\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\ProcessRenderDebug.cpp">
+ <Filter>RenderDebug\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\PsCommLayer.cpp">
+ <Filter>RenderDebug\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\PsCommStream.cpp">
+ <Filter>RenderDebug\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\RenderDebug.cpp">
+ <Filter>RenderDebug\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\RenderDebugDLLMain.cpp">
+ <Filter>RenderDebug\src</Filter>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/APEX_1.4/shared/general/RenderDebug/compiler/vc12win32-PhysX_3.4/RenderDebug.sln b/APEX_1.4/shared/general/RenderDebug/compiler/vc12win32-PhysX_3.4/RenderDebug.sln
new file mode 100644
index 00000000..4ea90621
--- /dev/null
+++ b/APEX_1.4/shared/general/RenderDebug/compiler/vc12win32-PhysX_3.4/RenderDebug.sln
@@ -0,0 +1,30 @@
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 2013
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RenderDebug", "./RenderDebug.vcxproj", "{473AD218-8370-A35E-CAB1-F030F86A6449}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ checked|Win32 = checked|Win32
+ debug|Win32 = debug|Win32
+ profile|Win32 = profile|Win32
+ release|Win32 = release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {473AD218-8370-A35E-CAB1-F030F86A6449}.checked|Win32.ActiveCfg = checked|Win32
+ {473AD218-8370-A35E-CAB1-F030F86A6449}.checked|Win32.Build.0 = checked|Win32
+ {473AD218-8370-A35E-CAB1-F030F86A6449}.debug|Win32.ActiveCfg = debug|Win32
+ {473AD218-8370-A35E-CAB1-F030F86A6449}.debug|Win32.Build.0 = debug|Win32
+ {473AD218-8370-A35E-CAB1-F030F86A6449}.profile|Win32.ActiveCfg = profile|Win32
+ {473AD218-8370-A35E-CAB1-F030F86A6449}.profile|Win32.Build.0 = profile|Win32
+ {473AD218-8370-A35E-CAB1-F030F86A6449}.release|Win32.ActiveCfg = release|Win32
+ {473AD218-8370-A35E-CAB1-F030F86A6449}.release|Win32.Build.0 = release|Win32
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddins) = postSolution
+ EndGlobalSection
+ GlobalSection(NestedProjects) = preSolution
+ EndGlobalSection
+EndGlobal
diff --git a/APEX_1.4/shared/general/RenderDebug/compiler/vc12win32-PhysX_3.4/RenderDebug.vcxproj b/APEX_1.4/shared/general/RenderDebug/compiler/vc12win32-PhysX_3.4/RenderDebug.vcxproj
new file mode 100644
index 00000000..38ccdad9
--- /dev/null
+++ b/APEX_1.4/shared/general/RenderDebug/compiler/vc12win32-PhysX_3.4/RenderDebug.vcxproj
@@ -0,0 +1,288 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project
+ DefaultTargets="Build"
+ ToolsVersion="12.0"
+ xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="debug|Win32">
+ <Configuration>debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="release|Win32">
+ <Configuration>release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="profile|Win32">
+ <Configuration>profile</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="checked|Win32">
+ <Configuration>checked</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{473AD218-8370-A35E-CAB1-F030F86A6449}</ProjectGuid>
+ <RootNamespace>RenderDebug</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup
+ Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"
+ Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <PlatformToolset>v120</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup
+ Condition="'$(Configuration)|$(Platform)'=='release|Win32'"
+ Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <PlatformToolset>v120</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup
+ Condition="'$(Configuration)|$(Platform)'=='profile|Win32'"
+ Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <PlatformToolset>v120</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup
+ Condition="'$(Configuration)|$(Platform)'=='checked|Win32'"
+ Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <PlatformToolset>v120</PlatformToolset>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings"></ImportGroup>
+ <ImportGroup
+ Label="PropertySheets"
+ Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">
+ <Import
+ Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"
+ Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')"
+ Label="LocalAppDataPlatform"
+ />
+ <Import Project="../../../../../compiler/paths.vsprops" />
+ </ImportGroup>
+ <ImportGroup
+ Label="PropertySheets"
+ Condition="'$(Configuration)|$(Platform)'=='release|Win32'">
+ <Import
+ Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"
+ Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')"
+ Label="LocalAppDataPlatform"
+ />
+ <Import Project="../../../../../compiler/paths.vsprops" />
+ </ImportGroup>
+ <ImportGroup
+ Label="PropertySheets"
+ Condition="'$(Configuration)|$(Platform)'=='profile|Win32'">
+ <Import
+ Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"
+ Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')"
+ Label="LocalAppDataPlatform"
+ />
+ <Import Project="../../../../../compiler/paths.vsprops" />
+ </ImportGroup>
+ <ImportGroup
+ Label="PropertySheets"
+ Condition="'$(Configuration)|$(Platform)'=='checked|Win32'">
+ <Import
+ Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"
+ Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')"
+ Label="LocalAppDataPlatform"
+ />
+ <Import Project="../../../../../compiler/paths.vsprops" />
+ </ImportGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">
+ <OutDir>./../../lib/vc12win32\</OutDir>
+ <IntDir>./build/Win32/RenderDebug/debug\</IntDir>
+ <TargetExt>.lib</TargetExt>
+ <TargetName>$(ProjectName)DEBUG</TargetName>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules/>
+ <CodeAnalysisRuleAssemblies/>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">
+ <ClCompile>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <StringPooling>true</StringPooling>
+ <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
+ <RuntimeTypeInfo>false</RuntimeTypeInfo>
+ <FloatingPointModel>Fast</FloatingPointModel>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <AdditionalOptions>/wd4201 /wd4324 /Wall /wd4514 /wd4820 /wd4127 /wd4710 /wd4711 /wd4061 /wd4668 /wd4626 /wd4266 /wd4263 /wd4264 /wd4640 /wd4625 /wd4574 /wd4191 /wd4987 /wd4986 /wd4946 /wd4836 /wd4571 /wd4826 /wd4577 /wd4458 /MP /d2Zi+</AdditionalOptions>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>./../../include;./../../public;../../../../../../PxShared/include;../../../../../../PxShared/include/filebuf;../../../../../../PxShared/include/foundation;../../../../../../PxShared/include/task;../../../../../../PxShared/include/cudamanager;../../../../../../PxShared/include/pvd;../../../../../../PxShared/src/foundation/include;../../../../../../PxShared/src/filebuf/include;../../../../../../PxShared/src/fastxml/include;../../../../../../PxShared/src/pvd/include;./../../../shared;./../../../../../public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>PX_FOUNDATION_DLL=0;WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_DEBUG;PX_DEBUG;PX_CHECKED;PHYSX_PROFILE_SDK;PX_SUPPORT_VISUAL_DEBUGGER;PX_PROFILE;PX_NVTX=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <ExceptionHandling>false</ExceptionHandling>
+ <WarningLevel>Level4</WarningLevel>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <PrecompiledHeaderFile></PrecompiledHeaderFile>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <Lib>
+ <AdditionalOptions>/INCREMENTAL:NO</AdditionalOptions>
+ <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>$(OutDir)$(ProjectName)DEBUG.lib</OutputFile>
+ <AdditionalLibraryDirectories>../../../../../../PxShared/lib/vc12win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <ProgramDatabaseFile>$(OutDir)/$(ProjectName)DEBUG.lib.pdb</ProgramDatabaseFile>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Lib>
+ <ResourceCompile></ResourceCompile>
+ <ProjectReference>
+ <LinkLibraryDependencies>true</LinkLibraryDependencies>
+ </ProjectReference>
+ </ItemDefinitionGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release|Win32'">
+ <OutDir>./../../lib/vc12win32\</OutDir>
+ <IntDir>./build/Win32/RenderDebug/release\</IntDir>
+ <TargetExt>.lib</TargetExt>
+ <TargetName>$(ProjectName)</TargetName>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules/>
+ <CodeAnalysisRuleAssemblies/>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='release|Win32'">
+ <ClCompile>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <StringPooling>true</StringPooling>
+ <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
+ <RuntimeTypeInfo>false</RuntimeTypeInfo>
+ <FloatingPointModel>Fast</FloatingPointModel>
+ <AdditionalOptions>/wd4201 /wd4324 /Wall /wd4514 /wd4820 /wd4127 /wd4710 /wd4711 /wd4061 /wd4668 /wd4626 /wd4266 /wd4263 /wd4264 /wd4640 /wd4625 /wd4574 /wd4191 /wd4987 /wd4986 /wd4946 /wd4836 /wd4571 /wd4826 /wd4577 /wd4458 /MP /d2Zi+</AdditionalOptions>
+ <Optimization>Full</Optimization>
+ <AdditionalIncludeDirectories>./../../include;./../../public;../../../../../../PxShared/include;../../../../../../PxShared/include/filebuf;../../../../../../PxShared/include/foundation;../../../../../../PxShared/include/task;../../../../../../PxShared/include/cudamanager;../../../../../../PxShared/include/pvd;../../../../../../PxShared/src/foundation/include;../../../../../../PxShared/src/filebuf/include;../../../../../../PxShared/src/fastxml/include;../../../../../../PxShared/src/pvd/include;./../../../shared;./../../../../../public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>PX_FOUNDATION_DLL=0;WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;NDEBUG;APEX_SHIPPING;_SECURE_SCL=0;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <ExceptionHandling>false</ExceptionHandling>
+ <WarningLevel>Level4</WarningLevel>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <PrecompiledHeaderFile></PrecompiledHeaderFile>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <Lib>
+ <AdditionalOptions>/INCREMENTAL:NO</AdditionalOptions>
+ <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>$(OutDir)$(ProjectName).lib</OutputFile>
+ <AdditionalLibraryDirectories>../../../../../../PxShared/lib/vc12win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <ProgramDatabaseFile>$(OutDir)/$(ProjectName).lib.pdb</ProgramDatabaseFile>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Lib>
+ <ResourceCompile></ResourceCompile>
+ <ProjectReference>
+ <LinkLibraryDependencies>true</LinkLibraryDependencies>
+ </ProjectReference>
+ </ItemDefinitionGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='profile|Win32'">
+ <OutDir>./../../lib/vc12win32\</OutDir>
+ <IntDir>./build/Win32/RenderDebug/profile\</IntDir>
+ <TargetExt>.lib</TargetExt>
+ <TargetName>$(ProjectName)PROFILE</TargetName>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules/>
+ <CodeAnalysisRuleAssemblies/>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='profile|Win32'">
+ <ClCompile>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <StringPooling>true</StringPooling>
+ <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
+ <RuntimeTypeInfo>false</RuntimeTypeInfo>
+ <FloatingPointModel>Fast</FloatingPointModel>
+ <AdditionalOptions>/wd4201 /wd4324 /Wall /wd4514 /wd4820 /wd4127 /wd4710 /wd4711 /wd4061 /wd4668 /wd4626 /wd4266 /wd4263 /wd4264 /wd4640 /wd4625 /wd4574 /wd4191 /wd4987 /wd4986 /wd4946 /wd4836 /wd4571 /wd4826 /wd4577 /wd4458 /MP /d2Zi+</AdditionalOptions>
+ <Optimization>Full</Optimization>
+ <AdditionalIncludeDirectories>./../../include;./../../public;../../../../../../PxShared/include;../../../../../../PxShared/include/filebuf;../../../../../../PxShared/include/foundation;../../../../../../PxShared/include/task;../../../../../../PxShared/include/cudamanager;../../../../../../PxShared/include/pvd;../../../../../../PxShared/src/foundation/include;../../../../../../PxShared/src/filebuf/include;../../../../../../PxShared/src/fastxml/include;../../../../../../PxShared/src/pvd/include;./../../../shared;./../../../../../public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>PX_FOUNDATION_DLL=0;WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;NDEBUG;PHYSX_PROFILE_SDK;PX_SUPPORT_VISUAL_DEBUGGER;PX_PROFILE;PX_NVTX=1;_SECURE_SCL=0;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <ExceptionHandling>false</ExceptionHandling>
+ <WarningLevel>Level4</WarningLevel>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <PrecompiledHeaderFile></PrecompiledHeaderFile>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <Lib>
+ <AdditionalOptions>/INCREMENTAL:NO</AdditionalOptions>
+ <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>$(OutDir)$(ProjectName)PROFILE.lib</OutputFile>
+ <AdditionalLibraryDirectories>../../../../../../PxShared/lib/vc12win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <ProgramDatabaseFile>$(OutDir)/$(ProjectName)PROFILE.lib.pdb</ProgramDatabaseFile>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Lib>
+ <ResourceCompile></ResourceCompile>
+ <ProjectReference>
+ <LinkLibraryDependencies>true</LinkLibraryDependencies>
+ </ProjectReference>
+ </ItemDefinitionGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='checked|Win32'">
+ <OutDir>./../../lib/vc12win32\</OutDir>
+ <IntDir>./build/Win32/RenderDebug/checked\</IntDir>
+ <TargetExt>.lib</TargetExt>
+ <TargetName>$(ProjectName)CHECKED</TargetName>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules/>
+ <CodeAnalysisRuleAssemblies/>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='checked|Win32'">
+ <ClCompile>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <StringPooling>true</StringPooling>
+ <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
+ <RuntimeTypeInfo>false</RuntimeTypeInfo>
+ <FloatingPointModel>Fast</FloatingPointModel>
+ <AdditionalOptions>/wd4201 /wd4324 /Wall /wd4514 /wd4820 /wd4127 /wd4710 /wd4711 /wd4061 /wd4668 /wd4626 /wd4266 /wd4263 /wd4264 /wd4640 /wd4625 /wd4574 /wd4191 /wd4987 /wd4986 /wd4946 /wd4836 /wd4571 /wd4826 /wd4577 /wd4458 /MP /d2Zi+</AdditionalOptions>
+ <Optimization>Full</Optimization>
+ <AdditionalIncludeDirectories>./../../include;./../../public;../../../../../../PxShared/include;../../../../../../PxShared/include/filebuf;../../../../../../PxShared/include/foundation;../../../../../../PxShared/include/task;../../../../../../PxShared/include/cudamanager;../../../../../../PxShared/include/pvd;../../../../../../PxShared/src/foundation/include;../../../../../../PxShared/src/filebuf/include;../../../../../../PxShared/src/fastxml/include;../../../../../../PxShared/src/pvd/include;./../../../shared;./../../../../../public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>PX_FOUNDATION_DLL=0;WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;NDEBUG;PX_CHECKED;PHYSX_PROFILE_SDK;PX_SUPPORT_VISUAL_DEBUGGER;PX_ENABLE_CHECKED_ASSERTS;PX_NVTX=1;_SECURE_SCL=0;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <ExceptionHandling>false</ExceptionHandling>
+ <WarningLevel>Level4</WarningLevel>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <PrecompiledHeaderFile></PrecompiledHeaderFile>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <Lib>
+ <AdditionalOptions>/INCREMENTAL:NO</AdditionalOptions>
+ <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>$(OutDir)$(ProjectName)CHECKED.lib</OutputFile>
+ <AdditionalLibraryDirectories>../../../../../../PxShared/lib/vc12win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <ProgramDatabaseFile>$(OutDir)/$(ProjectName)CHECKED.lib.pdb</ProgramDatabaseFile>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Lib>
+ <ResourceCompile></ResourceCompile>
+ <ProjectReference>
+ <LinkLibraryDependencies>true</LinkLibraryDependencies>
+ </ProjectReference>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\public\RenderDebug.h"></ClInclude>
+ <ClInclude Include="..\..\public\RenderDebugTyped.h"></ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\include\ClientServer.h"></ClInclude>
+ <ClInclude Include="..\..\include\FileRenderDebug.h"></ClInclude>
+ <ClInclude Include="..\..\include\GetArgs.h"></ClInclude>
+ <ClInclude Include="..\..\include\Hull2MeshEdges.h"></ClInclude>
+ <ClInclude Include="..\..\include\InternalRenderDebug.h"></ClInclude>
+ <ClInclude Include="..\..\include\ProcessRenderDebug.h"></ClInclude>
+ <ClInclude Include="..\..\include\PsCommLayer.h"></ClInclude>
+ <ClInclude Include="..\..\include\PsCommStream.h"></ClInclude>
+ <ClInclude Include="..\..\include\RenderDebugData.h"></ClInclude>
+ <ClInclude Include="..\..\include\RenderDebugImpl.h"></ClInclude>
+ <ClInclude Include="..\..\include\StreamIO.h"></ClInclude>
+ <ClInclude Include="..\..\include\StreamIO.inl"></ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\src\ClientServer.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\FileRenderDebug.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\Hull2MeshEdges.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\InternalRenderDebug.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\ProcessRenderDebug.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\PsCommLayer.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\PsCommStream.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\RenderDebug.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\RenderDebugDLLMain.cpp"></ClCompile>
+ </ItemGroup>
+ <ItemGroup></ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets"></ImportGroup>
+</Project>
diff --git a/APEX_1.4/shared/general/RenderDebug/compiler/vc12win32-PhysX_3.4/RenderDebug.vcxproj.filters b/APEX_1.4/shared/general/RenderDebug/compiler/vc12win32-PhysX_3.4/RenderDebug.vcxproj.filters
new file mode 100644
index 00000000..d866c884
--- /dev/null
+++ b/APEX_1.4/shared/general/RenderDebug/compiler/vc12win32-PhysX_3.4/RenderDebug.vcxproj.filters
@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="RenderDebug">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <Filter Include="RenderDebug\public">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\public\RenderDebug.h">
+ <Filter>RenderDebug\public</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\public\RenderDebugTyped.h">
+ <Filter>RenderDebug\public</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <Filter Include="RenderDebug\include">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\include\ClientServer.h">
+ <Filter>RenderDebug\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\FileRenderDebug.h">
+ <Filter>RenderDebug\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\GetArgs.h">
+ <Filter>RenderDebug\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\Hull2MeshEdges.h">
+ <Filter>RenderDebug\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\InternalRenderDebug.h">
+ <Filter>RenderDebug\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\ProcessRenderDebug.h">
+ <Filter>RenderDebug\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\PsCommLayer.h">
+ <Filter>RenderDebug\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\PsCommStream.h">
+ <Filter>RenderDebug\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\RenderDebugData.h">
+ <Filter>RenderDebug\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\RenderDebugImpl.h">
+ <Filter>RenderDebug\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\StreamIO.h">
+ <Filter>RenderDebug\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\StreamIO.inl">
+ <Filter>RenderDebug\include</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <Filter Include="RenderDebug\src">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\src\ClientServer.cpp">
+ <Filter>RenderDebug\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\FileRenderDebug.cpp">
+ <Filter>RenderDebug\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\Hull2MeshEdges.cpp">
+ <Filter>RenderDebug\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\InternalRenderDebug.cpp">
+ <Filter>RenderDebug\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\ProcessRenderDebug.cpp">
+ <Filter>RenderDebug\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\PsCommLayer.cpp">
+ <Filter>RenderDebug\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\PsCommStream.cpp">
+ <Filter>RenderDebug\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\RenderDebug.cpp">
+ <Filter>RenderDebug\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\RenderDebugDLLMain.cpp">
+ <Filter>RenderDebug\src</Filter>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/APEX_1.4/shared/general/RenderDebug/compiler/vc12win64-PhysX_3.4/RenderDebug.sln b/APEX_1.4/shared/general/RenderDebug/compiler/vc12win64-PhysX_3.4/RenderDebug.sln
new file mode 100644
index 00000000..20963080
--- /dev/null
+++ b/APEX_1.4/shared/general/RenderDebug/compiler/vc12win64-PhysX_3.4/RenderDebug.sln
@@ -0,0 +1,30 @@
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 2013
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RenderDebug", "./RenderDebug.vcxproj", "{473AD218-8370-A35E-CAB1-F030F86A6449}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ checked|x64 = checked|x64
+ debug|x64 = debug|x64
+ profile|x64 = profile|x64
+ release|x64 = release|x64
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {473AD218-8370-A35E-CAB1-F030F86A6449}.checked|x64.ActiveCfg = checked|x64
+ {473AD218-8370-A35E-CAB1-F030F86A6449}.checked|x64.Build.0 = checked|x64
+ {473AD218-8370-A35E-CAB1-F030F86A6449}.debug|x64.ActiveCfg = debug|x64
+ {473AD218-8370-A35E-CAB1-F030F86A6449}.debug|x64.Build.0 = debug|x64
+ {473AD218-8370-A35E-CAB1-F030F86A6449}.profile|x64.ActiveCfg = profile|x64
+ {473AD218-8370-A35E-CAB1-F030F86A6449}.profile|x64.Build.0 = profile|x64
+ {473AD218-8370-A35E-CAB1-F030F86A6449}.release|x64.ActiveCfg = release|x64
+ {473AD218-8370-A35E-CAB1-F030F86A6449}.release|x64.Build.0 = release|x64
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddins) = postSolution
+ EndGlobalSection
+ GlobalSection(NestedProjects) = preSolution
+ EndGlobalSection
+EndGlobal
diff --git a/APEX_1.4/shared/general/RenderDebug/compiler/vc12win64-PhysX_3.4/RenderDebug.vcxproj b/APEX_1.4/shared/general/RenderDebug/compiler/vc12win64-PhysX_3.4/RenderDebug.vcxproj
new file mode 100644
index 00000000..116ccebb
--- /dev/null
+++ b/APEX_1.4/shared/general/RenderDebug/compiler/vc12win64-PhysX_3.4/RenderDebug.vcxproj
@@ -0,0 +1,284 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project
+ DefaultTargets="Build"
+ ToolsVersion="12.0"
+ xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="debug|x64">
+ <Configuration>debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="release|x64">
+ <Configuration>release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="profile|x64">
+ <Configuration>profile</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="checked|x64">
+ <Configuration>checked</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{473AD218-8370-A35E-CAB1-F030F86A6449}</ProjectGuid>
+ <RootNamespace>RenderDebug</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup
+ Condition="'$(Configuration)|$(Platform)'=='debug|x64'"
+ Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <PlatformToolset>v120</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup
+ Condition="'$(Configuration)|$(Platform)'=='release|x64'"
+ Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <PlatformToolset>v120</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup
+ Condition="'$(Configuration)|$(Platform)'=='profile|x64'"
+ Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <PlatformToolset>v120</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup
+ Condition="'$(Configuration)|$(Platform)'=='checked|x64'"
+ Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <PlatformToolset>v120</PlatformToolset>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings"></ImportGroup>
+ <ImportGroup
+ Label="PropertySheets"
+ Condition="'$(Configuration)|$(Platform)'=='debug|x64'">
+ <Import
+ Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"
+ Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')"
+ Label="LocalAppDataPlatform"
+ />
+ <Import Project="../../../../../compiler/paths.vsprops" />
+ </ImportGroup>
+ <ImportGroup
+ Label="PropertySheets"
+ Condition="'$(Configuration)|$(Platform)'=='release|x64'">
+ <Import
+ Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"
+ Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')"
+ Label="LocalAppDataPlatform"
+ />
+ <Import Project="../../../../../compiler/paths.vsprops" />
+ </ImportGroup>
+ <ImportGroup
+ Label="PropertySheets"
+ Condition="'$(Configuration)|$(Platform)'=='profile|x64'">
+ <Import
+ Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"
+ Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')"
+ Label="LocalAppDataPlatform"
+ />
+ <Import Project="../../../../../compiler/paths.vsprops" />
+ </ImportGroup>
+ <ImportGroup
+ Label="PropertySheets"
+ Condition="'$(Configuration)|$(Platform)'=='checked|x64'">
+ <Import
+ Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"
+ Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')"
+ Label="LocalAppDataPlatform"
+ />
+ <Import Project="../../../../../compiler/paths.vsprops" />
+ </ImportGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|x64'">
+ <OutDir>./../../lib/vc12win64\</OutDir>
+ <IntDir>./build/x64/RenderDebug/debug\</IntDir>
+ <TargetExt>.lib</TargetExt>
+ <TargetName>$(ProjectName)DEBUG</TargetName>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules/>
+ <CodeAnalysisRuleAssemblies/>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='debug|x64'">
+ <ClCompile>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <StringPooling>true</StringPooling>
+ <RuntimeTypeInfo>false</RuntimeTypeInfo>
+ <FloatingPointModel>Fast</FloatingPointModel>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <AdditionalOptions>/wd4201 /wd4324 /Wall /wd4514 /wd4820 /wd4127 /wd4710 /wd4711 /wd4061 /wd4668 /wd4626 /wd4266 /wd4263 /wd4264 /wd4640 /wd4625 /wd4574 /wd4191 /wd4987 /wd4986 /wd4946 /wd4836 /wd4571 /wd4826 /wd4577 /wd4458 /MP /d2Zi+</AdditionalOptions>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>./../../include;./../../public;../../../../../../PxShared/include;../../../../../../PxShared/include/filebuf;../../../../../../PxShared/include/foundation;../../../../../../PxShared/include/task;../../../../../../PxShared/include/cudamanager;../../../../../../PxShared/include/pvd;../../../../../../PxShared/src/foundation/include;../../../../../../PxShared/src/filebuf/include;../../../../../../PxShared/src/fastxml/include;../../../../../../PxShared/src/pvd/include;./../../../shared;./../../../../../public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>PX_FOUNDATION_DLL=0;WIN32;WIN64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_DEBUG;PX_DEBUG;PX_CHECKED;PHYSX_PROFILE_SDK;PX_SUPPORT_VISUAL_DEBUGGER;PX_PROFILE;PX_NVTX=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <ExceptionHandling>false</ExceptionHandling>
+ <WarningLevel>Level4</WarningLevel>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <PrecompiledHeaderFile></PrecompiledHeaderFile>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <Lib>
+ <AdditionalOptions>/INCREMENTAL:NO</AdditionalOptions>
+ <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>$(OutDir)$(ProjectName)DEBUG.lib</OutputFile>
+ <AdditionalLibraryDirectories>../../../../../../PxShared/lib/vc12win64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <ProgramDatabaseFile>$(OutDir)/$(ProjectName)DEBUG.lib.pdb</ProgramDatabaseFile>
+ <TargetMachine>MachineX64</TargetMachine>
+ </Lib>
+ <ResourceCompile></ResourceCompile>
+ <ProjectReference>
+ <LinkLibraryDependencies>true</LinkLibraryDependencies>
+ </ProjectReference>
+ </ItemDefinitionGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release|x64'">
+ <OutDir>./../../lib/vc12win64\</OutDir>
+ <IntDir>./build/x64/RenderDebug/release\</IntDir>
+ <TargetExt>.lib</TargetExt>
+ <TargetName>$(ProjectName)</TargetName>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules/>
+ <CodeAnalysisRuleAssemblies/>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='release|x64'">
+ <ClCompile>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <StringPooling>true</StringPooling>
+ <RuntimeTypeInfo>false</RuntimeTypeInfo>
+ <FloatingPointModel>Fast</FloatingPointModel>
+ <AdditionalOptions>/wd4201 /wd4324 /Wall /wd4514 /wd4820 /wd4127 /wd4710 /wd4711 /wd4061 /wd4668 /wd4626 /wd4266 /wd4263 /wd4264 /wd4640 /wd4625 /wd4574 /wd4191 /wd4987 /wd4986 /wd4946 /wd4836 /wd4571 /wd4826 /wd4577 /wd4458 /MP /d2Zi+</AdditionalOptions>
+ <Optimization>Full</Optimization>
+ <AdditionalIncludeDirectories>./../../include;./../../public;../../../../../../PxShared/include;../../../../../../PxShared/include/filebuf;../../../../../../PxShared/include/foundation;../../../../../../PxShared/include/task;../../../../../../PxShared/include/cudamanager;../../../../../../PxShared/include/pvd;../../../../../../PxShared/src/foundation/include;../../../../../../PxShared/src/filebuf/include;../../../../../../PxShared/src/fastxml/include;../../../../../../PxShared/src/pvd/include;./../../../shared;./../../../../../public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>PX_FOUNDATION_DLL=0;WIN32;WIN64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;NDEBUG;APEX_SHIPPING;_SECURE_SCL=0;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <ExceptionHandling>false</ExceptionHandling>
+ <WarningLevel>Level4</WarningLevel>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <PrecompiledHeaderFile></PrecompiledHeaderFile>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <Lib>
+ <AdditionalOptions>/INCREMENTAL:NO</AdditionalOptions>
+ <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>$(OutDir)$(ProjectName).lib</OutputFile>
+ <AdditionalLibraryDirectories>../../../../../../PxShared/lib/vc12win64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <ProgramDatabaseFile>$(OutDir)/$(ProjectName).lib.pdb</ProgramDatabaseFile>
+ <TargetMachine>MachineX64</TargetMachine>
+ </Lib>
+ <ResourceCompile></ResourceCompile>
+ <ProjectReference>
+ <LinkLibraryDependencies>true</LinkLibraryDependencies>
+ </ProjectReference>
+ </ItemDefinitionGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='profile|x64'">
+ <OutDir>./../../lib/vc12win64\</OutDir>
+ <IntDir>./build/x64/RenderDebug/profile\</IntDir>
+ <TargetExt>.lib</TargetExt>
+ <TargetName>$(ProjectName)PROFILE</TargetName>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules/>
+ <CodeAnalysisRuleAssemblies/>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='profile|x64'">
+ <ClCompile>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <StringPooling>true</StringPooling>
+ <RuntimeTypeInfo>false</RuntimeTypeInfo>
+ <FloatingPointModel>Fast</FloatingPointModel>
+ <AdditionalOptions>/wd4201 /wd4324 /Wall /wd4514 /wd4820 /wd4127 /wd4710 /wd4711 /wd4061 /wd4668 /wd4626 /wd4266 /wd4263 /wd4264 /wd4640 /wd4625 /wd4574 /wd4191 /wd4987 /wd4986 /wd4946 /wd4836 /wd4571 /wd4826 /wd4577 /wd4458 /MP /d2Zi+</AdditionalOptions>
+ <Optimization>Full</Optimization>
+ <AdditionalIncludeDirectories>./../../include;./../../public;../../../../../../PxShared/include;../../../../../../PxShared/include/filebuf;../../../../../../PxShared/include/foundation;../../../../../../PxShared/include/task;../../../../../../PxShared/include/cudamanager;../../../../../../PxShared/include/pvd;../../../../../../PxShared/src/foundation/include;../../../../../../PxShared/src/filebuf/include;../../../../../../PxShared/src/fastxml/include;../../../../../../PxShared/src/pvd/include;./../../../shared;./../../../../../public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>PX_FOUNDATION_DLL=0;WIN32;WIN64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;NDEBUG;PHYSX_PROFILE_SDK;PX_SUPPORT_VISUAL_DEBUGGER;PX_PROFILE;PX_NVTX=1;_SECURE_SCL=0;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <ExceptionHandling>false</ExceptionHandling>
+ <WarningLevel>Level4</WarningLevel>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <PrecompiledHeaderFile></PrecompiledHeaderFile>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <Lib>
+ <AdditionalOptions>/INCREMENTAL:NO</AdditionalOptions>
+ <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>$(OutDir)$(ProjectName)PROFILE.lib</OutputFile>
+ <AdditionalLibraryDirectories>../../../../../../PxShared/lib/vc12win64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <ProgramDatabaseFile>$(OutDir)/$(ProjectName)PROFILE.lib.pdb</ProgramDatabaseFile>
+ <TargetMachine>MachineX64</TargetMachine>
+ </Lib>
+ <ResourceCompile></ResourceCompile>
+ <ProjectReference>
+ <LinkLibraryDependencies>true</LinkLibraryDependencies>
+ </ProjectReference>
+ </ItemDefinitionGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='checked|x64'">
+ <OutDir>./../../lib/vc12win64\</OutDir>
+ <IntDir>./build/x64/RenderDebug/checked\</IntDir>
+ <TargetExt>.lib</TargetExt>
+ <TargetName>$(ProjectName)CHECKED</TargetName>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules/>
+ <CodeAnalysisRuleAssemblies/>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='checked|x64'">
+ <ClCompile>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <StringPooling>true</StringPooling>
+ <RuntimeTypeInfo>false</RuntimeTypeInfo>
+ <FloatingPointModel>Fast</FloatingPointModel>
+ <AdditionalOptions>/wd4201 /wd4324 /Wall /wd4514 /wd4820 /wd4127 /wd4710 /wd4711 /wd4061 /wd4668 /wd4626 /wd4266 /wd4263 /wd4264 /wd4640 /wd4625 /wd4574 /wd4191 /wd4987 /wd4986 /wd4946 /wd4836 /wd4571 /wd4826 /wd4577 /wd4458 /MP /d2Zi+</AdditionalOptions>
+ <Optimization>Full</Optimization>
+ <AdditionalIncludeDirectories>./../../include;./../../public;../../../../../../PxShared/include;../../../../../../PxShared/include/filebuf;../../../../../../PxShared/include/foundation;../../../../../../PxShared/include/task;../../../../../../PxShared/include/cudamanager;../../../../../../PxShared/include/pvd;../../../../../../PxShared/src/foundation/include;../../../../../../PxShared/src/filebuf/include;../../../../../../PxShared/src/fastxml/include;../../../../../../PxShared/src/pvd/include;./../../../shared;./../../../../../public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>PX_FOUNDATION_DLL=0;WIN32;WIN64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;NDEBUG;PX_CHECKED;PHYSX_PROFILE_SDK;PX_SUPPORT_VISUAL_DEBUGGER;PX_ENABLE_CHECKED_ASSERTS;PX_NVTX=1;_SECURE_SCL=0;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <ExceptionHandling>false</ExceptionHandling>
+ <WarningLevel>Level4</WarningLevel>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <PrecompiledHeaderFile></PrecompiledHeaderFile>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <Lib>
+ <AdditionalOptions>/INCREMENTAL:NO</AdditionalOptions>
+ <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>$(OutDir)$(ProjectName)CHECKED.lib</OutputFile>
+ <AdditionalLibraryDirectories>../../../../../../PxShared/lib/vc12win64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <ProgramDatabaseFile>$(OutDir)/$(ProjectName)CHECKED.lib.pdb</ProgramDatabaseFile>
+ <TargetMachine>MachineX64</TargetMachine>
+ </Lib>
+ <ResourceCompile></ResourceCompile>
+ <ProjectReference>
+ <LinkLibraryDependencies>true</LinkLibraryDependencies>
+ </ProjectReference>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\public\RenderDebug.h"></ClInclude>
+ <ClInclude Include="..\..\public\RenderDebugTyped.h"></ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\include\ClientServer.h"></ClInclude>
+ <ClInclude Include="..\..\include\FileRenderDebug.h"></ClInclude>
+ <ClInclude Include="..\..\include\GetArgs.h"></ClInclude>
+ <ClInclude Include="..\..\include\Hull2MeshEdges.h"></ClInclude>
+ <ClInclude Include="..\..\include\InternalRenderDebug.h"></ClInclude>
+ <ClInclude Include="..\..\include\ProcessRenderDebug.h"></ClInclude>
+ <ClInclude Include="..\..\include\PsCommLayer.h"></ClInclude>
+ <ClInclude Include="..\..\include\PsCommStream.h"></ClInclude>
+ <ClInclude Include="..\..\include\RenderDebugData.h"></ClInclude>
+ <ClInclude Include="..\..\include\RenderDebugImpl.h"></ClInclude>
+ <ClInclude Include="..\..\include\StreamIO.h"></ClInclude>
+ <ClInclude Include="..\..\include\StreamIO.inl"></ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\src\ClientServer.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\FileRenderDebug.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\Hull2MeshEdges.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\InternalRenderDebug.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\ProcessRenderDebug.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\PsCommLayer.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\PsCommStream.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\RenderDebug.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\RenderDebugDLLMain.cpp"></ClCompile>
+ </ItemGroup>
+ <ItemGroup></ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets"></ImportGroup>
+</Project>
diff --git a/APEX_1.4/shared/general/RenderDebug/compiler/vc12win64-PhysX_3.4/RenderDebug.vcxproj.filters b/APEX_1.4/shared/general/RenderDebug/compiler/vc12win64-PhysX_3.4/RenderDebug.vcxproj.filters
new file mode 100644
index 00000000..d866c884
--- /dev/null
+++ b/APEX_1.4/shared/general/RenderDebug/compiler/vc12win64-PhysX_3.4/RenderDebug.vcxproj.filters
@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="RenderDebug">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <Filter Include="RenderDebug\public">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\public\RenderDebug.h">
+ <Filter>RenderDebug\public</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\public\RenderDebugTyped.h">
+ <Filter>RenderDebug\public</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <Filter Include="RenderDebug\include">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\include\ClientServer.h">
+ <Filter>RenderDebug\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\FileRenderDebug.h">
+ <Filter>RenderDebug\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\GetArgs.h">
+ <Filter>RenderDebug\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\Hull2MeshEdges.h">
+ <Filter>RenderDebug\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\InternalRenderDebug.h">
+ <Filter>RenderDebug\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\ProcessRenderDebug.h">
+ <Filter>RenderDebug\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\PsCommLayer.h">
+ <Filter>RenderDebug\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\PsCommStream.h">
+ <Filter>RenderDebug\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\RenderDebugData.h">
+ <Filter>RenderDebug\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\RenderDebugImpl.h">
+ <Filter>RenderDebug\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\StreamIO.h">
+ <Filter>RenderDebug\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\StreamIO.inl">
+ <Filter>RenderDebug\include</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <Filter Include="RenderDebug\src">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\src\ClientServer.cpp">
+ <Filter>RenderDebug\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\FileRenderDebug.cpp">
+ <Filter>RenderDebug\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\Hull2MeshEdges.cpp">
+ <Filter>RenderDebug\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\InternalRenderDebug.cpp">
+ <Filter>RenderDebug\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\ProcessRenderDebug.cpp">
+ <Filter>RenderDebug\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\PsCommLayer.cpp">
+ <Filter>RenderDebug\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\PsCommStream.cpp">
+ <Filter>RenderDebug\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\RenderDebug.cpp">
+ <Filter>RenderDebug\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\RenderDebugDLLMain.cpp">
+ <Filter>RenderDebug\src</Filter>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/APEX_1.4/shared/general/RenderDebug/compiler/vc14win32-PhysX_3.4/RenderDebug.sln b/APEX_1.4/shared/general/RenderDebug/compiler/vc14win32-PhysX_3.4/RenderDebug.sln
new file mode 100644
index 00000000..8f65c969
--- /dev/null
+++ b/APEX_1.4/shared/general/RenderDebug/compiler/vc14win32-PhysX_3.4/RenderDebug.sln
@@ -0,0 +1,30 @@
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 14
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RenderDebug", "./RenderDebug.vcxproj", "{473AD218-8370-A35E-CAB1-F030F86A6449}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ checked|Win32 = checked|Win32
+ debug|Win32 = debug|Win32
+ profile|Win32 = profile|Win32
+ release|Win32 = release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {473AD218-8370-A35E-CAB1-F030F86A6449}.checked|Win32.ActiveCfg = checked|Win32
+ {473AD218-8370-A35E-CAB1-F030F86A6449}.checked|Win32.Build.0 = checked|Win32
+ {473AD218-8370-A35E-CAB1-F030F86A6449}.debug|Win32.ActiveCfg = debug|Win32
+ {473AD218-8370-A35E-CAB1-F030F86A6449}.debug|Win32.Build.0 = debug|Win32
+ {473AD218-8370-A35E-CAB1-F030F86A6449}.profile|Win32.ActiveCfg = profile|Win32
+ {473AD218-8370-A35E-CAB1-F030F86A6449}.profile|Win32.Build.0 = profile|Win32
+ {473AD218-8370-A35E-CAB1-F030F86A6449}.release|Win32.ActiveCfg = release|Win32
+ {473AD218-8370-A35E-CAB1-F030F86A6449}.release|Win32.Build.0 = release|Win32
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddins) = postSolution
+ EndGlobalSection
+ GlobalSection(NestedProjects) = preSolution
+ EndGlobalSection
+EndGlobal
diff --git a/APEX_1.4/shared/general/RenderDebug/compiler/vc14win32-PhysX_3.4/RenderDebug.vcxproj b/APEX_1.4/shared/general/RenderDebug/compiler/vc14win32-PhysX_3.4/RenderDebug.vcxproj
new file mode 100644
index 00000000..2e22d615
--- /dev/null
+++ b/APEX_1.4/shared/general/RenderDebug/compiler/vc14win32-PhysX_3.4/RenderDebug.vcxproj
@@ -0,0 +1,271 @@
+<?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="debug|Win32">
+ <Configuration>debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="release|Win32">
+ <Configuration>release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="profile|Win32">
+ <Configuration>profile</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="checked|Win32">
+ <Configuration>checked</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{473AD218-8370-A35E-CAB1-F030F86A6449}</ProjectGuid>
+ <RootNamespace>RenderDebug</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup
+ Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"
+ Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <PlatformToolset>v140</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup
+ Condition="'$(Configuration)|$(Platform)'=='release|Win32'"
+ Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <PlatformToolset>v140</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup
+ Condition="'$(Configuration)|$(Platform)'=='profile|Win32'"
+ Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <PlatformToolset>v140</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup
+ Condition="'$(Configuration)|$(Platform)'=='checked|Win32'"
+ Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <PlatformToolset>v140</PlatformToolset>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings"></ImportGroup>
+ <ImportGroup
+ Label="PropertySheets"
+ Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">
+ <Import
+ Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"
+ Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')"
+ Label="LocalAppDataPlatform"
+ />
+ <Import Project="../../../../../compiler/paths.vsprops" />
+ </ImportGroup>
+ <ImportGroup
+ Label="PropertySheets"
+ Condition="'$(Configuration)|$(Platform)'=='release|Win32'">
+ <Import
+ Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"
+ Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')"
+ Label="LocalAppDataPlatform"
+ />
+ <Import Project="../../../../../compiler/paths.vsprops" />
+ </ImportGroup>
+ <ImportGroup
+ Label="PropertySheets"
+ Condition="'$(Configuration)|$(Platform)'=='profile|Win32'">
+ <Import
+ Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"
+ Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')"
+ Label="LocalAppDataPlatform"
+ />
+ <Import Project="../../../../../compiler/paths.vsprops" />
+ </ImportGroup>
+ <ImportGroup
+ Label="PropertySheets"
+ Condition="'$(Configuration)|$(Platform)'=='checked|Win32'">
+ <Import
+ Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"
+ Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')"
+ Label="LocalAppDataPlatform"
+ />
+ <Import Project="../../../../../compiler/paths.vsprops" />
+ </ImportGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">
+ <OutDir>./../../lib/vc14win32\</OutDir>
+ <IntDir>./build/Win32/RenderDebug/debug\</IntDir>
+ <TargetExt>.lib</TargetExt>
+ <TargetName>$(ProjectName)DEBUG</TargetName>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules/>
+ <CodeAnalysisRuleAssemblies/>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">
+ <ClCompile>
+ <FloatingPointModel>Precise</FloatingPointModel>
+ <AdditionalOptions>/wd4201 /wd4324 /Wall /wd4514 /wd4820 /wd4127 /wd4710 /wd4711 /wd4061 /wd4668 /wd4626 /wd4266 /wd4263 /wd4264 /wd4640 /wd4625 /wd4574 /wd4191 /wd4987 /wd4986 /wd4946 /wd4836 /wd4571 /wd4826 /wd4577 /wd4458 /wd4456 /wd4457 /wd4548 /wd5026 /wd5027 /wd4464 /GR- /GF /WX /fp:fast /arch:SSE2 /MP /Od /RTCsu /d2Zi+</AdditionalOptions>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>./../../include;./../../public;../../../../../../PxShared/include;../../../../../../PxShared/include/filebuf;../../../../../../PxShared/include/foundation;../../../../../../PxShared/include/task;../../../../../../PxShared/include/cudamanager;../../../../../../PxShared/include/pvd;../../../../../../PxShared/src/foundation/include;../../../../../../PxShared/src/filebuf/include;../../../../../../PxShared/src/fastxml/include;../../../../../../PxShared/src/pvd/include;./../../../shared;./../../../../../public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>PX_FOUNDATION_DLL=0;WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_DEBUG;PX_DEBUG;PX_CHECKED;PHYSX_PROFILE_SDK;PX_SUPPORT_VISUAL_DEBUGGER;PX_PROFILE;PX_NVTX=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <ExceptionHandling>false</ExceptionHandling>
+ <WarningLevel>Level4</WarningLevel>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <PrecompiledHeaderFile></PrecompiledHeaderFile>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <Lib>
+ <AdditionalOptions>/INCREMENTAL:NO</AdditionalOptions>
+ <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>$(OutDir)$(ProjectName)DEBUG.lib</OutputFile>
+ <AdditionalLibraryDirectories>../../../../../../PxShared/lib/vc14win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <ProgramDatabaseFile>$(OutDir)/$(ProjectName)DEBUG.lib.pdb</ProgramDatabaseFile>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Lib>
+ <ResourceCompile></ResourceCompile>
+ <ProjectReference>
+ <LinkLibraryDependencies>true</LinkLibraryDependencies>
+ </ProjectReference>
+ </ItemDefinitionGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release|Win32'">
+ <OutDir>./../../lib/vc14win32\</OutDir>
+ <IntDir>./build/Win32/RenderDebug/release\</IntDir>
+ <TargetExt>.lib</TargetExt>
+ <TargetName>$(ProjectName)</TargetName>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules/>
+ <CodeAnalysisRuleAssemblies/>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='release|Win32'">
+ <ClCompile>
+ <FloatingPointModel>Precise</FloatingPointModel>
+ <AdditionalOptions>/wd4201 /wd4324 /Wall /wd4514 /wd4820 /wd4127 /wd4710 /wd4711 /wd4061 /wd4668 /wd4626 /wd4266 /wd4263 /wd4264 /wd4640 /wd4625 /wd4574 /wd4191 /wd4987 /wd4986 /wd4946 /wd4836 /wd4571 /wd4826 /wd4577 /wd4458 /wd4456 /wd4457 /wd4548 /wd5026 /wd5027 /wd4464 /GR- /GF /WX /fp:fast /arch:SSE2 /MP /Ox /d2Zi+</AdditionalOptions>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>./../../include;./../../public;../../../../../../PxShared/include;../../../../../../PxShared/include/filebuf;../../../../../../PxShared/include/foundation;../../../../../../PxShared/include/task;../../../../../../PxShared/include/cudamanager;../../../../../../PxShared/include/pvd;../../../../../../PxShared/src/foundation/include;../../../../../../PxShared/src/filebuf/include;../../../../../../PxShared/src/fastxml/include;../../../../../../PxShared/src/pvd/include;./../../../shared;./../../../../../public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>PX_FOUNDATION_DLL=0;WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;NDEBUG;APEX_SHIPPING;_SECURE_SCL=0;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <ExceptionHandling>false</ExceptionHandling>
+ <WarningLevel>Level4</WarningLevel>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <PrecompiledHeaderFile></PrecompiledHeaderFile>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <Lib>
+ <AdditionalOptions>/INCREMENTAL:NO</AdditionalOptions>
+ <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>$(OutDir)$(ProjectName).lib</OutputFile>
+ <AdditionalLibraryDirectories>../../../../../../PxShared/lib/vc14win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <ProgramDatabaseFile>$(OutDir)/$(ProjectName).lib.pdb</ProgramDatabaseFile>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Lib>
+ <ResourceCompile></ResourceCompile>
+ <ProjectReference>
+ <LinkLibraryDependencies>true</LinkLibraryDependencies>
+ </ProjectReference>
+ </ItemDefinitionGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='profile|Win32'">
+ <OutDir>./../../lib/vc14win32\</OutDir>
+ <IntDir>./build/Win32/RenderDebug/profile\</IntDir>
+ <TargetExt>.lib</TargetExt>
+ <TargetName>$(ProjectName)PROFILE</TargetName>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules/>
+ <CodeAnalysisRuleAssemblies/>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='profile|Win32'">
+ <ClCompile>
+ <FloatingPointModel>Precise</FloatingPointModel>
+ <AdditionalOptions>/wd4201 /wd4324 /Wall /wd4514 /wd4820 /wd4127 /wd4710 /wd4711 /wd4061 /wd4668 /wd4626 /wd4266 /wd4263 /wd4264 /wd4640 /wd4625 /wd4574 /wd4191 /wd4987 /wd4986 /wd4946 /wd4836 /wd4571 /wd4826 /wd4577 /wd4458 /wd4456 /wd4457 /wd4548 /wd5026 /wd5027 /wd4464 /GR- /GF /WX /fp:fast /arch:SSE2 /MP /Ox /d2Zi+</AdditionalOptions>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>./../../include;./../../public;../../../../../../PxShared/include;../../../../../../PxShared/include/filebuf;../../../../../../PxShared/include/foundation;../../../../../../PxShared/include/task;../../../../../../PxShared/include/cudamanager;../../../../../../PxShared/include/pvd;../../../../../../PxShared/src/foundation/include;../../../../../../PxShared/src/filebuf/include;../../../../../../PxShared/src/fastxml/include;../../../../../../PxShared/src/pvd/include;./../../../shared;./../../../../../public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>PX_FOUNDATION_DLL=0;WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;NDEBUG;PHYSX_PROFILE_SDK;PX_SUPPORT_VISUAL_DEBUGGER;PX_PROFILE;PX_NVTX=1;_SECURE_SCL=0;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <ExceptionHandling>false</ExceptionHandling>
+ <WarningLevel>Level4</WarningLevel>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <PrecompiledHeaderFile></PrecompiledHeaderFile>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <Lib>
+ <AdditionalOptions>/INCREMENTAL:NO</AdditionalOptions>
+ <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>$(OutDir)$(ProjectName)PROFILE.lib</OutputFile>
+ <AdditionalLibraryDirectories>../../../../../../PxShared/lib/vc14win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <ProgramDatabaseFile>$(OutDir)/$(ProjectName)PROFILE.lib.pdb</ProgramDatabaseFile>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Lib>
+ <ResourceCompile></ResourceCompile>
+ <ProjectReference>
+ <LinkLibraryDependencies>true</LinkLibraryDependencies>
+ </ProjectReference>
+ </ItemDefinitionGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='checked|Win32'">
+ <OutDir>./../../lib/vc14win32\</OutDir>
+ <IntDir>./build/Win32/RenderDebug/checked\</IntDir>
+ <TargetExt>.lib</TargetExt>
+ <TargetName>$(ProjectName)CHECKED</TargetName>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules/>
+ <CodeAnalysisRuleAssemblies/>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='checked|Win32'">
+ <ClCompile>
+ <FloatingPointModel>Precise</FloatingPointModel>
+ <AdditionalOptions>/wd4201 /wd4324 /Wall /wd4514 /wd4820 /wd4127 /wd4710 /wd4711 /wd4061 /wd4668 /wd4626 /wd4266 /wd4263 /wd4264 /wd4640 /wd4625 /wd4574 /wd4191 /wd4987 /wd4986 /wd4946 /wd4836 /wd4571 /wd4826 /wd4577 /wd4458 /wd4456 /wd4457 /wd4548 /wd5026 /wd5027 /wd4464 /GR- /GF /WX /fp:fast /arch:SSE2 /MP /Ox /d2Zi+</AdditionalOptions>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>./../../include;./../../public;../../../../../../PxShared/include;../../../../../../PxShared/include/filebuf;../../../../../../PxShared/include/foundation;../../../../../../PxShared/include/task;../../../../../../PxShared/include/cudamanager;../../../../../../PxShared/include/pvd;../../../../../../PxShared/src/foundation/include;../../../../../../PxShared/src/filebuf/include;../../../../../../PxShared/src/fastxml/include;../../../../../../PxShared/src/pvd/include;./../../../shared;./../../../../../public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>PX_FOUNDATION_DLL=0;WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;NDEBUG;PX_CHECKED;PHYSX_PROFILE_SDK;PX_SUPPORT_VISUAL_DEBUGGER;PX_ENABLE_CHECKED_ASSERTS;PX_NVTX=1;_SECURE_SCL=0;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <ExceptionHandling>false</ExceptionHandling>
+ <WarningLevel>Level4</WarningLevel>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <PrecompiledHeaderFile></PrecompiledHeaderFile>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <Lib>
+ <AdditionalOptions>/INCREMENTAL:NO</AdditionalOptions>
+ <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>$(OutDir)$(ProjectName)CHECKED.lib</OutputFile>
+ <AdditionalLibraryDirectories>../../../../../../PxShared/lib/vc14win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <ProgramDatabaseFile>$(OutDir)/$(ProjectName)CHECKED.lib.pdb</ProgramDatabaseFile>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Lib>
+ <ResourceCompile></ResourceCompile>
+ <ProjectReference>
+ <LinkLibraryDependencies>true</LinkLibraryDependencies>
+ </ProjectReference>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\public\RenderDebug.h"></ClInclude>
+ <ClInclude Include="..\..\public\RenderDebugTyped.h"></ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\include\ClientServer.h"></ClInclude>
+ <ClInclude Include="..\..\include\FileRenderDebug.h"></ClInclude>
+ <ClInclude Include="..\..\include\GetArgs.h"></ClInclude>
+ <ClInclude Include="..\..\include\Hull2MeshEdges.h"></ClInclude>
+ <ClInclude Include="..\..\include\InternalRenderDebug.h"></ClInclude>
+ <ClInclude Include="..\..\include\ProcessRenderDebug.h"></ClInclude>
+ <ClInclude Include="..\..\include\PsCommLayer.h"></ClInclude>
+ <ClInclude Include="..\..\include\PsCommStream.h"></ClInclude>
+ <ClInclude Include="..\..\include\RenderDebugData.h"></ClInclude>
+ <ClInclude Include="..\..\include\RenderDebugImpl.h"></ClInclude>
+ <ClInclude Include="..\..\include\StreamIO.h"></ClInclude>
+ <ClInclude Include="..\..\include\StreamIO.inl"></ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\src\ClientServer.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\FileRenderDebug.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\Hull2MeshEdges.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\InternalRenderDebug.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\ProcessRenderDebug.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\PsCommLayer.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\PsCommStream.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\RenderDebug.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\RenderDebugDLLMain.cpp"></ClCompile>
+ </ItemGroup>
+ <ItemGroup></ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets"></ImportGroup>
+</Project>
diff --git a/APEX_1.4/shared/general/RenderDebug/compiler/vc14win32-PhysX_3.4/RenderDebug.vcxproj.filters b/APEX_1.4/shared/general/RenderDebug/compiler/vc14win32-PhysX_3.4/RenderDebug.vcxproj.filters
new file mode 100644
index 00000000..d866c884
--- /dev/null
+++ b/APEX_1.4/shared/general/RenderDebug/compiler/vc14win32-PhysX_3.4/RenderDebug.vcxproj.filters
@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="RenderDebug">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <Filter Include="RenderDebug\public">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\public\RenderDebug.h">
+ <Filter>RenderDebug\public</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\public\RenderDebugTyped.h">
+ <Filter>RenderDebug\public</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <Filter Include="RenderDebug\include">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\include\ClientServer.h">
+ <Filter>RenderDebug\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\FileRenderDebug.h">
+ <Filter>RenderDebug\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\GetArgs.h">
+ <Filter>RenderDebug\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\Hull2MeshEdges.h">
+ <Filter>RenderDebug\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\InternalRenderDebug.h">
+ <Filter>RenderDebug\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\ProcessRenderDebug.h">
+ <Filter>RenderDebug\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\PsCommLayer.h">
+ <Filter>RenderDebug\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\PsCommStream.h">
+ <Filter>RenderDebug\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\RenderDebugData.h">
+ <Filter>RenderDebug\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\RenderDebugImpl.h">
+ <Filter>RenderDebug\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\StreamIO.h">
+ <Filter>RenderDebug\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\StreamIO.inl">
+ <Filter>RenderDebug\include</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <Filter Include="RenderDebug\src">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\src\ClientServer.cpp">
+ <Filter>RenderDebug\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\FileRenderDebug.cpp">
+ <Filter>RenderDebug\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\Hull2MeshEdges.cpp">
+ <Filter>RenderDebug\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\InternalRenderDebug.cpp">
+ <Filter>RenderDebug\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\ProcessRenderDebug.cpp">
+ <Filter>RenderDebug\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\PsCommLayer.cpp">
+ <Filter>RenderDebug\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\PsCommStream.cpp">
+ <Filter>RenderDebug\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\RenderDebug.cpp">
+ <Filter>RenderDebug\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\RenderDebugDLLMain.cpp">
+ <Filter>RenderDebug\src</Filter>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/APEX_1.4/shared/general/RenderDebug/compiler/vc14win64-PhysX_3.4/RenderDebug.sln b/APEX_1.4/shared/general/RenderDebug/compiler/vc14win64-PhysX_3.4/RenderDebug.sln
new file mode 100644
index 00000000..845b35ff
--- /dev/null
+++ b/APEX_1.4/shared/general/RenderDebug/compiler/vc14win64-PhysX_3.4/RenderDebug.sln
@@ -0,0 +1,30 @@
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 14
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RenderDebug", "./RenderDebug.vcxproj", "{473AD218-8370-A35E-CAB1-F030F86A6449}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ checked|x64 = checked|x64
+ debug|x64 = debug|x64
+ profile|x64 = profile|x64
+ release|x64 = release|x64
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {473AD218-8370-A35E-CAB1-F030F86A6449}.checked|x64.ActiveCfg = checked|x64
+ {473AD218-8370-A35E-CAB1-F030F86A6449}.checked|x64.Build.0 = checked|x64
+ {473AD218-8370-A35E-CAB1-F030F86A6449}.debug|x64.ActiveCfg = debug|x64
+ {473AD218-8370-A35E-CAB1-F030F86A6449}.debug|x64.Build.0 = debug|x64
+ {473AD218-8370-A35E-CAB1-F030F86A6449}.profile|x64.ActiveCfg = profile|x64
+ {473AD218-8370-A35E-CAB1-F030F86A6449}.profile|x64.Build.0 = profile|x64
+ {473AD218-8370-A35E-CAB1-F030F86A6449}.release|x64.ActiveCfg = release|x64
+ {473AD218-8370-A35E-CAB1-F030F86A6449}.release|x64.Build.0 = release|x64
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddins) = postSolution
+ EndGlobalSection
+ GlobalSection(NestedProjects) = preSolution
+ EndGlobalSection
+EndGlobal
diff --git a/APEX_1.4/shared/general/RenderDebug/compiler/vc14win64-PhysX_3.4/RenderDebug.vcxproj b/APEX_1.4/shared/general/RenderDebug/compiler/vc14win64-PhysX_3.4/RenderDebug.vcxproj
new file mode 100644
index 00000000..b3287f51
--- /dev/null
+++ b/APEX_1.4/shared/general/RenderDebug/compiler/vc14win64-PhysX_3.4/RenderDebug.vcxproj
@@ -0,0 +1,271 @@
+<?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="debug|x64">
+ <Configuration>debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="release|x64">
+ <Configuration>release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="profile|x64">
+ <Configuration>profile</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="checked|x64">
+ <Configuration>checked</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{473AD218-8370-A35E-CAB1-F030F86A6449}</ProjectGuid>
+ <RootNamespace>RenderDebug</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup
+ Condition="'$(Configuration)|$(Platform)'=='debug|x64'"
+ Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <PlatformToolset>v140</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup
+ Condition="'$(Configuration)|$(Platform)'=='release|x64'"
+ Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <PlatformToolset>v140</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup
+ Condition="'$(Configuration)|$(Platform)'=='profile|x64'"
+ Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <PlatformToolset>v140</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup
+ Condition="'$(Configuration)|$(Platform)'=='checked|x64'"
+ Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <PlatformToolset>v140</PlatformToolset>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings"></ImportGroup>
+ <ImportGroup
+ Label="PropertySheets"
+ Condition="'$(Configuration)|$(Platform)'=='debug|x64'">
+ <Import
+ Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"
+ Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')"
+ Label="LocalAppDataPlatform"
+ />
+ <Import Project="../../../../../compiler/paths.vsprops" />
+ </ImportGroup>
+ <ImportGroup
+ Label="PropertySheets"
+ Condition="'$(Configuration)|$(Platform)'=='release|x64'">
+ <Import
+ Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"
+ Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')"
+ Label="LocalAppDataPlatform"
+ />
+ <Import Project="../../../../../compiler/paths.vsprops" />
+ </ImportGroup>
+ <ImportGroup
+ Label="PropertySheets"
+ Condition="'$(Configuration)|$(Platform)'=='profile|x64'">
+ <Import
+ Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"
+ Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')"
+ Label="LocalAppDataPlatform"
+ />
+ <Import Project="../../../../../compiler/paths.vsprops" />
+ </ImportGroup>
+ <ImportGroup
+ Label="PropertySheets"
+ Condition="'$(Configuration)|$(Platform)'=='checked|x64'">
+ <Import
+ Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"
+ Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')"
+ Label="LocalAppDataPlatform"
+ />
+ <Import Project="../../../../../compiler/paths.vsprops" />
+ </ImportGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|x64'">
+ <OutDir>./../../lib/vc14win64\</OutDir>
+ <IntDir>./build/x64/RenderDebug/debug\</IntDir>
+ <TargetExt>.lib</TargetExt>
+ <TargetName>$(ProjectName)DEBUG</TargetName>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules/>
+ <CodeAnalysisRuleAssemblies/>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='debug|x64'">
+ <ClCompile>
+ <FloatingPointModel>Precise</FloatingPointModel>
+ <AdditionalOptions>/wd4201 /wd4324 /Wall /wd4514 /wd4820 /wd4127 /wd4710 /wd4711 /wd4061 /wd4668 /wd4626 /wd4266 /wd4263 /wd4264 /wd4640 /wd4625 /wd4574 /wd4191 /wd4987 /wd4986 /wd4946 /wd4836 /wd4571 /wd4826 /wd4577 /wd4458 /wd4456 /wd4457 /wd4548 /wd5026 /wd5027 /wd4464 /GR- /GF /WX /fp:fast /MP /Od /RTCsu /d2Zi+</AdditionalOptions>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>./../../include;./../../public;../../../../../../PxShared/include;../../../../../../PxShared/include/filebuf;../../../../../../PxShared/include/foundation;../../../../../../PxShared/include/task;../../../../../../PxShared/include/cudamanager;../../../../../../PxShared/include/pvd;../../../../../../PxShared/src/foundation/include;../../../../../../PxShared/src/filebuf/include;../../../../../../PxShared/src/fastxml/include;../../../../../../PxShared/src/pvd/include;./../../../shared;./../../../../../public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>PX_FOUNDATION_DLL=0;WIN32;WIN64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_DEBUG;PX_DEBUG;PX_CHECKED;PHYSX_PROFILE_SDK;PX_SUPPORT_VISUAL_DEBUGGER;PX_PROFILE;PX_NVTX=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <ExceptionHandling>false</ExceptionHandling>
+ <WarningLevel>Level4</WarningLevel>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <PrecompiledHeaderFile></PrecompiledHeaderFile>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <Lib>
+ <AdditionalOptions>/INCREMENTAL:NO</AdditionalOptions>
+ <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>$(OutDir)$(ProjectName)DEBUG.lib</OutputFile>
+ <AdditionalLibraryDirectories>../../../../../../PxShared/lib/vc14win64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <ProgramDatabaseFile>$(OutDir)/$(ProjectName)DEBUG.lib.pdb</ProgramDatabaseFile>
+ <TargetMachine>MachineX64</TargetMachine>
+ </Lib>
+ <ResourceCompile></ResourceCompile>
+ <ProjectReference>
+ <LinkLibraryDependencies>true</LinkLibraryDependencies>
+ </ProjectReference>
+ </ItemDefinitionGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release|x64'">
+ <OutDir>./../../lib/vc14win64\</OutDir>
+ <IntDir>./build/x64/RenderDebug/release\</IntDir>
+ <TargetExt>.lib</TargetExt>
+ <TargetName>$(ProjectName)</TargetName>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules/>
+ <CodeAnalysisRuleAssemblies/>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='release|x64'">
+ <ClCompile>
+ <FloatingPointModel>Precise</FloatingPointModel>
+ <AdditionalOptions>/wd4201 /wd4324 /Wall /wd4514 /wd4820 /wd4127 /wd4710 /wd4711 /wd4061 /wd4668 /wd4626 /wd4266 /wd4263 /wd4264 /wd4640 /wd4625 /wd4574 /wd4191 /wd4987 /wd4986 /wd4946 /wd4836 /wd4571 /wd4826 /wd4577 /wd4458 /wd4456 /wd4457 /wd4548 /wd5026 /wd5027 /wd4464 /GR- /GF /WX /fp:fast /MP /Ox /d2Zi+</AdditionalOptions>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>./../../include;./../../public;../../../../../../PxShared/include;../../../../../../PxShared/include/filebuf;../../../../../../PxShared/include/foundation;../../../../../../PxShared/include/task;../../../../../../PxShared/include/cudamanager;../../../../../../PxShared/include/pvd;../../../../../../PxShared/src/foundation/include;../../../../../../PxShared/src/filebuf/include;../../../../../../PxShared/src/fastxml/include;../../../../../../PxShared/src/pvd/include;./../../../shared;./../../../../../public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>PX_FOUNDATION_DLL=0;WIN32;WIN64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;NDEBUG;APEX_SHIPPING;_SECURE_SCL=0;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <ExceptionHandling>false</ExceptionHandling>
+ <WarningLevel>Level4</WarningLevel>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <PrecompiledHeaderFile></PrecompiledHeaderFile>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <Lib>
+ <AdditionalOptions>/INCREMENTAL:NO</AdditionalOptions>
+ <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>$(OutDir)$(ProjectName).lib</OutputFile>
+ <AdditionalLibraryDirectories>../../../../../../PxShared/lib/vc14win64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <ProgramDatabaseFile>$(OutDir)/$(ProjectName).lib.pdb</ProgramDatabaseFile>
+ <TargetMachine>MachineX64</TargetMachine>
+ </Lib>
+ <ResourceCompile></ResourceCompile>
+ <ProjectReference>
+ <LinkLibraryDependencies>true</LinkLibraryDependencies>
+ </ProjectReference>
+ </ItemDefinitionGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='profile|x64'">
+ <OutDir>./../../lib/vc14win64\</OutDir>
+ <IntDir>./build/x64/RenderDebug/profile\</IntDir>
+ <TargetExt>.lib</TargetExt>
+ <TargetName>$(ProjectName)PROFILE</TargetName>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules/>
+ <CodeAnalysisRuleAssemblies/>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='profile|x64'">
+ <ClCompile>
+ <FloatingPointModel>Precise</FloatingPointModel>
+ <AdditionalOptions>/wd4201 /wd4324 /Wall /wd4514 /wd4820 /wd4127 /wd4710 /wd4711 /wd4061 /wd4668 /wd4626 /wd4266 /wd4263 /wd4264 /wd4640 /wd4625 /wd4574 /wd4191 /wd4987 /wd4986 /wd4946 /wd4836 /wd4571 /wd4826 /wd4577 /wd4458 /wd4456 /wd4457 /wd4548 /wd5026 /wd5027 /wd4464 /GR- /GF /WX /fp:fast /MP /Ox /d2Zi+</AdditionalOptions>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>./../../include;./../../public;../../../../../../PxShared/include;../../../../../../PxShared/include/filebuf;../../../../../../PxShared/include/foundation;../../../../../../PxShared/include/task;../../../../../../PxShared/include/cudamanager;../../../../../../PxShared/include/pvd;../../../../../../PxShared/src/foundation/include;../../../../../../PxShared/src/filebuf/include;../../../../../../PxShared/src/fastxml/include;../../../../../../PxShared/src/pvd/include;./../../../shared;./../../../../../public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>PX_FOUNDATION_DLL=0;WIN32;WIN64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;NDEBUG;PHYSX_PROFILE_SDK;PX_SUPPORT_VISUAL_DEBUGGER;PX_PROFILE;PX_NVTX=1;_SECURE_SCL=0;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <ExceptionHandling>false</ExceptionHandling>
+ <WarningLevel>Level4</WarningLevel>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <PrecompiledHeaderFile></PrecompiledHeaderFile>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <Lib>
+ <AdditionalOptions>/INCREMENTAL:NO</AdditionalOptions>
+ <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>$(OutDir)$(ProjectName)PROFILE.lib</OutputFile>
+ <AdditionalLibraryDirectories>../../../../../../PxShared/lib/vc14win64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <ProgramDatabaseFile>$(OutDir)/$(ProjectName)PROFILE.lib.pdb</ProgramDatabaseFile>
+ <TargetMachine>MachineX64</TargetMachine>
+ </Lib>
+ <ResourceCompile></ResourceCompile>
+ <ProjectReference>
+ <LinkLibraryDependencies>true</LinkLibraryDependencies>
+ </ProjectReference>
+ </ItemDefinitionGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='checked|x64'">
+ <OutDir>./../../lib/vc14win64\</OutDir>
+ <IntDir>./build/x64/RenderDebug/checked\</IntDir>
+ <TargetExt>.lib</TargetExt>
+ <TargetName>$(ProjectName)CHECKED</TargetName>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules/>
+ <CodeAnalysisRuleAssemblies/>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='checked|x64'">
+ <ClCompile>
+ <FloatingPointModel>Precise</FloatingPointModel>
+ <AdditionalOptions>/wd4201 /wd4324 /Wall /wd4514 /wd4820 /wd4127 /wd4710 /wd4711 /wd4061 /wd4668 /wd4626 /wd4266 /wd4263 /wd4264 /wd4640 /wd4625 /wd4574 /wd4191 /wd4987 /wd4986 /wd4946 /wd4836 /wd4571 /wd4826 /wd4577 /wd4458 /wd4456 /wd4457 /wd4548 /wd5026 /wd5027 /wd4464 /GR- /GF /WX /fp:fast /MP /Ox /d2Zi+</AdditionalOptions>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>./../../include;./../../public;../../../../../../PxShared/include;../../../../../../PxShared/include/filebuf;../../../../../../PxShared/include/foundation;../../../../../../PxShared/include/task;../../../../../../PxShared/include/cudamanager;../../../../../../PxShared/include/pvd;../../../../../../PxShared/src/foundation/include;../../../../../../PxShared/src/filebuf/include;../../../../../../PxShared/src/fastxml/include;../../../../../../PxShared/src/pvd/include;./../../../shared;./../../../../../public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>PX_FOUNDATION_DLL=0;WIN32;WIN64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;NDEBUG;PX_CHECKED;PHYSX_PROFILE_SDK;PX_SUPPORT_VISUAL_DEBUGGER;PX_ENABLE_CHECKED_ASSERTS;PX_NVTX=1;_SECURE_SCL=0;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <ExceptionHandling>false</ExceptionHandling>
+ <WarningLevel>Level4</WarningLevel>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <PrecompiledHeaderFile></PrecompiledHeaderFile>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <Lib>
+ <AdditionalOptions>/INCREMENTAL:NO</AdditionalOptions>
+ <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>$(OutDir)$(ProjectName)CHECKED.lib</OutputFile>
+ <AdditionalLibraryDirectories>../../../../../../PxShared/lib/vc14win64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <ProgramDatabaseFile>$(OutDir)/$(ProjectName)CHECKED.lib.pdb</ProgramDatabaseFile>
+ <TargetMachine>MachineX64</TargetMachine>
+ </Lib>
+ <ResourceCompile></ResourceCompile>
+ <ProjectReference>
+ <LinkLibraryDependencies>true</LinkLibraryDependencies>
+ </ProjectReference>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\public\RenderDebug.h"></ClInclude>
+ <ClInclude Include="..\..\public\RenderDebugTyped.h"></ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\include\ClientServer.h"></ClInclude>
+ <ClInclude Include="..\..\include\FileRenderDebug.h"></ClInclude>
+ <ClInclude Include="..\..\include\GetArgs.h"></ClInclude>
+ <ClInclude Include="..\..\include\Hull2MeshEdges.h"></ClInclude>
+ <ClInclude Include="..\..\include\InternalRenderDebug.h"></ClInclude>
+ <ClInclude Include="..\..\include\ProcessRenderDebug.h"></ClInclude>
+ <ClInclude Include="..\..\include\PsCommLayer.h"></ClInclude>
+ <ClInclude Include="..\..\include\PsCommStream.h"></ClInclude>
+ <ClInclude Include="..\..\include\RenderDebugData.h"></ClInclude>
+ <ClInclude Include="..\..\include\RenderDebugImpl.h"></ClInclude>
+ <ClInclude Include="..\..\include\StreamIO.h"></ClInclude>
+ <ClInclude Include="..\..\include\StreamIO.inl"></ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\src\ClientServer.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\FileRenderDebug.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\Hull2MeshEdges.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\InternalRenderDebug.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\ProcessRenderDebug.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\PsCommLayer.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\PsCommStream.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\RenderDebug.cpp"></ClCompile>
+ <ClCompile Include="..\..\src\RenderDebugDLLMain.cpp"></ClCompile>
+ </ItemGroup>
+ <ItemGroup></ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets"></ImportGroup>
+</Project>
diff --git a/APEX_1.4/shared/general/RenderDebug/compiler/vc14win64-PhysX_3.4/RenderDebug.vcxproj.filters b/APEX_1.4/shared/general/RenderDebug/compiler/vc14win64-PhysX_3.4/RenderDebug.vcxproj.filters
new file mode 100644
index 00000000..d866c884
--- /dev/null
+++ b/APEX_1.4/shared/general/RenderDebug/compiler/vc14win64-PhysX_3.4/RenderDebug.vcxproj.filters
@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="RenderDebug">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <Filter Include="RenderDebug\public">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\public\RenderDebug.h">
+ <Filter>RenderDebug\public</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\public\RenderDebugTyped.h">
+ <Filter>RenderDebug\public</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <Filter Include="RenderDebug\include">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\include\ClientServer.h">
+ <Filter>RenderDebug\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\FileRenderDebug.h">
+ <Filter>RenderDebug\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\GetArgs.h">
+ <Filter>RenderDebug\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\Hull2MeshEdges.h">
+ <Filter>RenderDebug\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\InternalRenderDebug.h">
+ <Filter>RenderDebug\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\ProcessRenderDebug.h">
+ <Filter>RenderDebug\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\PsCommLayer.h">
+ <Filter>RenderDebug\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\PsCommStream.h">
+ <Filter>RenderDebug\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\RenderDebugData.h">
+ <Filter>RenderDebug\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\RenderDebugImpl.h">
+ <Filter>RenderDebug\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\StreamIO.h">
+ <Filter>RenderDebug\include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\StreamIO.inl">
+ <Filter>RenderDebug\include</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <Filter Include="RenderDebug\src">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\src\ClientServer.cpp">
+ <Filter>RenderDebug\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\FileRenderDebug.cpp">
+ <Filter>RenderDebug\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\Hull2MeshEdges.cpp">
+ <Filter>RenderDebug\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\InternalRenderDebug.cpp">
+ <Filter>RenderDebug\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\ProcessRenderDebug.cpp">
+ <Filter>RenderDebug\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\PsCommLayer.cpp">
+ <Filter>RenderDebug\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\PsCommStream.cpp">
+ <Filter>RenderDebug\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\RenderDebug.cpp">
+ <Filter>RenderDebug\src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\RenderDebugDLLMain.cpp">
+ <Filter>RenderDebug\src</Filter>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/APEX_1.4/shared/general/RenderDebug/include/ClientServer.h b/APEX_1.4/shared/general/RenderDebug/include/ClientServer.h
new file mode 100644
index 00000000..3e210fd2
--- /dev/null
+++ b/APEX_1.4/shared/general/RenderDebug/include/ClientServer.h
@@ -0,0 +1,102 @@
+#ifndef EXT_CLIENT_SERVER_H
+
+#define EXT_CLIENT_SERVER_H
+
+// This class is used to handle inter-process communication between a render debug client and the render debug server.
+// The server must be already running for a client to 'connect'.
+//
+
+#include "RenderDebug.h"
+#include "RenderDebugImpl.h"
+#include "ProcessRenderDebug.h"
+
+class ClientServer
+{
+public:
+ virtual uint32_t getCommunicationsFrame(void) const = 0;
+ virtual bool isConnected(void) = 0;
+ virtual bool sendCommand(const char *cmd) = 0;
+ virtual const char **getCommand(uint32_t &argc) = 0;
+
+ virtual void sendInputEvent(const RENDER_DEBUG::InputEvent &ev) = 0;
+ virtual const RENDER_DEBUG::InputEvent *getInputEvent(bool flush) = 0;
+
+ // Wait this many milliseconds for the server to catch up..
+ virtual bool serverWait(void) = 0;
+ virtual void processFrame(RENDER_DEBUG::ProcessRenderDebug *processRenderDebug,RENDER_DEBUG::RenderDebugInterface *iface) = 0;
+ virtual void recordPrimitives(uint32_t frameCount,uint32_t primType,uint32_t primCount,uint32_t dataLength,const void *data) = 0;
+ virtual bool isServer(void) const = 0;
+ virtual void finalizeFrame(uint32_t frameCount) = 0;
+ virtual const char * getRemoteApplicationName(void) = 0;
+
+
+ /**
+ \brief Transmits an arbitrary block of binary data to the remote machine. The block of data can have a command and id associated with it.
+
+ It is important to note that due to the fact the RenderDebug system is synchronized every single frame, it is strongly recommended
+ that you only use this feature for relatively small data items; probably on the order of a few megabytes at most. If you try to do
+ a very large transfer, in theory it would work, but it might take a very long time to complete and look like a hang since it will
+ essentially be blocking.
+
+ \param command An arbitrary command associated with this data transfer, for example this could indicate a remote file request.
+ \param id An arbitrary id associated with this data transfer, for example the id could be the file name of a file transfer request.
+ \param data The block of binary data to transmit, you are responsible for maintaining endian correctness of the internal data if necessary.
+ \param dlen The length of the lock of data to transmit.
+
+ \return Returns true if the data was queued to be transmitted, false if it failed.
+ */
+ virtual bool sendRemoteResource(const char *command,
+ const char *id,
+ const void *data,
+ uint32_t dlen) = 0;
+
+ /**
+ \brief This function allows you to request a file from the remote machine by name. If successful it will be returned via 'getRemoteData'
+
+ \param command The command field associated with this request which will be returned by 'getRemoteData'
+ \param fileName The filename being requested from the remote machine.
+
+ \return Returns true if the request was queued to be transmitted, false if it failed.
+ */
+ virtual bool requestRemoteResource(const char *command,
+ const char *fileName) = 0;
+
+ /**
+ \brief Retrieves a block of remotely transmitted binary data.
+
+ \param command A a reference to a pointer which will store the arbitrary command associated with this data transfer, for example this could indicate a remote file request.
+ \param id A reference to a pointer which will store an arbitrary id associated with this data transfer, for example the id could be the file name of a file transfer request.
+ \param dlen A reference that will contain length of the lock of data received.
+ \param remoteIsBigEndian A reference to a boolean which will be set to true if the remote machine that sent this data is big endian format.
+
+ \retrun A pointer to the block of data received.
+ */
+ virtual const void * getRemoteResource(const char *&command,
+ const char *&id,
+ uint32_t &dlen,
+ bool &remoteIsBigEndian) = 0;
+
+ /**
+ \brief Set the base file name to record communications tream; or NULL to disable it.
+
+ \param fileName The base name of the file to record the communications channel stream to, or NULL to disable it.
+ */
+ virtual bool setStreamFilename(const char *fileName) = 0;
+
+ /**
+ \brief Begin playing back a communications stream recording
+
+ \param fileName The name of the previously captured communications stream file
+ */
+ virtual bool setStreamPlayback(const char *fileName) = 0;
+
+ virtual void release(void) = 0;
+protected:
+ virtual ~ClientServer(void)
+ {
+ }
+};
+
+ClientServer *createClientServer(RENDER_DEBUG::RenderDebug::Desc &desc);
+
+#endif
diff --git a/APEX_1.4/shared/general/RenderDebug/include/FileRenderDebug.h b/APEX_1.4/shared/general/RenderDebug/include/FileRenderDebug.h
new file mode 100644
index 00000000..d162c7b1
--- /dev/null
+++ b/APEX_1.4/shared/general/RenderDebug/include/FileRenderDebug.h
@@ -0,0 +1,66 @@
+/*
+ * Copyright 2009-2011 NVIDIA Corporation. All rights reserved.
+ *
+ * NOTICE TO USER:
+ *
+ * This source code is subject to NVIDIA ownership rights under U.S. and
+ * international Copyright laws. Users and possessors of this source code
+ * are hereby granted a nonexclusive, royalty-free license to use this code
+ * in individual and commercial software.
+ *
+ * NVIDIA MAKES NO REPRESENTATION ABOUT THE SUITABILITY OF THIS SOURCE
+ * CODE FOR ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR
+ * IMPLIED WARRANTY OF ANY KIND. NVIDIA DISCLAIMS ALL WARRANTIES WITH
+ * REGARD TO THIS SOURCE CODE, INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
+ * IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL,
+ * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
+ * OR PERFORMANCE OF THIS SOURCE CODE.
+ *
+ * U.S. Government End Users. This source code is a "commercial item" as
+ * that term is defined at 48 C.F.R. 2.101 (OCT 1995), consisting of
+ * "commercial computer software" and "commercial computer software
+ * documentation" as such terms are used in 48 C.F.R. 12.212 (SEPT 1995)
+ * and is provided to the U.S. Government only as a commercial end item.
+ * Consistent with 48 C.F.R.12.212 and 48 C.F.R. 227.7202-1 through
+ * 227.7202-4 (JUNE 1995), all U.S. Government End Users acquire the
+ * source code with only those rights set forth herein.
+ *
+ * Any use of this source code in individual and commercial software must
+ * include, in the user documentation and internal comments to the code,
+ * the above Disclaimer and U.S. Government End Users Notice.
+ */
+
+#ifndef FILE_RENDER_DEBUG_H
+#define FILE_RENDER_DEBUG_H
+
+#include "ProcessRenderDebug.h"
+
+class ClientServer;
+
+namespace RENDER_DEBUG
+{
+
+class FileRenderDebug : public ProcessRenderDebug
+{
+public:
+ virtual ProcessRenderDebug * getEchoLocal(void) const = 0;
+ virtual uint32_t getFrameCount(void) const = 0;
+ virtual void setFrame(uint32_t frameNo) = 0;
+ virtual void processReadFrame(RENDER_DEBUG::RenderDebugInterface *iface) = 0;
+protected:
+ virtual ~FileRenderDebug(void) { }
+};
+
+
+FileRenderDebug * createFileRenderDebug(const char *fileName,
+ bool readAccess,
+ ProcessRenderDebug *echoLocally,
+ ClientServer *clientServer);
+
+
+}
+
+#endif
diff --git a/APEX_1.4/shared/general/RenderDebug/include/GetArgs.h b/APEX_1.4/shared/general/RenderDebug/include/GetArgs.h
new file mode 100644
index 00000000..e177314b
--- /dev/null
+++ b/APEX_1.4/shared/general/RenderDebug/include/GetArgs.h
@@ -0,0 +1,88 @@
+#ifndef GET_ARGS_H
+
+#define GET_ARGS_H
+
+#define MAX_ARGS 4096
+#define MAX_ARG_STRING 16384
+
+class GetArgs
+{
+public:
+
+ const char **getArgs(const char *str,uint32_t &argc)
+ {
+ argc = 0;
+
+ str = skipSpaces(str); // skip any leading spaces
+ char *dest = mArgString;
+ char *stop = &mArgString[MAX_ARG_STRING-1];
+
+ while ( str && *str && dest < stop ) // if we have a valid string then we have at least one argument..
+ {
+ if ( *str == 34 ) // if it is a quoted string...
+ {
+ str++; // Skip the opening quote
+ if ( *str == 34 ) // double quotes I guess we treat as an empty string
+ {
+ mArgv[argc] = "";
+ argc++;
+ }
+ else
+ {
+ mArgv[argc] = dest; // store the beginning of the argument
+ argc++;
+ while ( *str && *str != 34 && dest < stop )
+ {
+ *dest++ = *str++;
+ }
+ *dest = 0; // null terminate the quoted argument.
+ dest++;
+ }
+ if ( *str == 34 ) // skip closing quote
+ {
+ str++;
+ }
+ str = skipSpaces(str);
+ }
+ else
+ {
+ mArgv[argc] = dest;
+ argc++;
+ while ( *str && !isWhiteSpace(*str) && dest < stop )
+ {
+ *dest++ = *str++;
+ }
+ *dest = 0;
+ dest++;
+ str = skipSpaces(str);
+ }
+ }
+
+ return mArgv;
+ }
+
+private:
+ PX_INLINE bool isWhiteSpace(char c) const
+ {
+ if ( c == 32 || c == 9 ) return true;
+ return false;
+ }
+
+ PX_INLINE const char *skipSpaces(const char *str) const
+ {
+ if ( str )
+ {
+ while ( *str == 32 || *str == 9 )
+ {
+ str++;
+ }
+ }
+ return str;
+ }
+
+ const char *mArgv[MAX_ARGS];
+ char mArgString[MAX_ARG_STRING];
+
+};
+
+#endif
diff --git a/APEX_1.4/shared/general/RenderDebug/include/Hull2MeshEdges.h b/APEX_1.4/shared/general/RenderDebug/include/Hull2MeshEdges.h
new file mode 100644
index 00000000..90b1954e
--- /dev/null
+++ b/APEX_1.4/shared/general/RenderDebug/include/Hull2MeshEdges.h
@@ -0,0 +1,46 @@
+#ifndef Hull2MESHEDGES_H
+
+#define Hull2MESHEDGES_H
+
+// This is a small code snippet which will take a convex hull described as an array of plane equations and, from that,
+// produce either an edge list (for wireframe debug visualization) or a triangle mesh.
+
+#include "PxVec3.h"
+#include "PxPlane.h"
+
+struct HullEdge
+{
+ physx::PxVec3 e0,e1;
+};
+
+struct HullMesh
+{
+ uint32_t mVertexCount;
+ uint32_t mTriCount;
+ const physx::PxVec3 *mVertices;
+ const uint16_t *mIndices;
+};
+
+class Hull2MeshEdges
+{
+public:
+ // Convert convex hull into a list of edges.
+ virtual const HullEdge *getHullEdges(uint32_t planeCount, // Number of source planes
+ const physx::PxPlane *planes, // The array of plane equations
+ uint32_t &edgeCount) = 0; // Contains the number of edges built
+
+ virtual bool getHullMesh(uint32_t planeCount, // Number of source planes
+ const physx::PxPlane *planes, // The array of plane equations
+ HullMesh &m) = 0; // The triangle mesh produced
+
+ virtual void release(void) = 0;
+protected:
+ virtual ~Hull2MeshEdges(void)
+ {
+
+ }
+};
+
+Hull2MeshEdges *createHull2MeshEdges(void);
+
+#endif
diff --git a/APEX_1.4/shared/general/RenderDebug/include/InternalRenderDebug.h b/APEX_1.4/shared/general/RenderDebug/include/InternalRenderDebug.h
new file mode 100644
index 00000000..b2690abd
--- /dev/null
+++ b/APEX_1.4/shared/general/RenderDebug/include/InternalRenderDebug.h
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2009-2011 NVIDIA Corporation. All rights reserved.
+ *
+ * NOTICE TO USER:
+ *
+ * This source code is subject to NVIDIA ownership rights under U.S. and
+ * international Copyright laws. Users and possessors of this source code
+ * are hereby granted a nonexclusive, royalty-free license to use this code
+ * in individual and commercial software.
+ *
+ * NVIDIA MAKES NO REPRESENTATION ABOUT THE SUITABILITY OF THIS SOURCE
+ * CODE FOR ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR
+ * IMPLIED WARRANTY OF ANY KIND. NVIDIA DISCLAIMS ALL WARRANTIES WITH
+ * REGARD TO THIS SOURCE CODE, INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
+ * IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL,
+ * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
+ * OR PERFORMANCE OF THIS SOURCE CODE.
+ *
+ * U.S. Government End Users. This source code is a "commercial item" as
+ * that term is defined at 48 C.F.R. 2.101 (OCT 1995), consisting of
+ * "commercial computer software" and "commercial computer software
+ * documentation" as such terms are used in 48 C.F.R. 12.212 (SEPT 1995)
+ * and is provided to the U.S. Government only as a commercial end item.
+ * Consistent with 48 C.F.R.12.212 and 48 C.F.R. 227.7202-1 through
+ * 227.7202-4 (JUNE 1995), all U.S. Government End Users acquire the
+ * source code with only those rights set forth herein.
+ *
+ * Any use of this source code in individual and commercial software must
+ * include, in the user documentation and internal comments to the code,
+ * the above Disclaimer and U.S. Government End Users Notice.
+ */
+
+#ifndef INTERNAL_RENDER_DEBUG_H
+#define INTERNAL_RENDER_DEBUG_H
+
+
+namespace RENDER_DEBUG
+{
+
+class RenderDebugImpl;
+class ProcessRenderDebug;
+class RenderDebugHook;
+
+RenderDebugImpl * createInternalRenderDebug(ProcessRenderDebug *process,RenderDebugHook *renderDebugHook);
+
+}
+
+#endif // INTERNAL_RENDER_DEBUG_H
diff --git a/APEX_1.4/shared/general/RenderDebug/include/ProcessRenderDebug.h b/APEX_1.4/shared/general/RenderDebug/include/ProcessRenderDebug.h
new file mode 100644
index 00000000..079ce4be
--- /dev/null
+++ b/APEX_1.4/shared/general/RenderDebug/include/ProcessRenderDebug.h
@@ -0,0 +1,92 @@
+/*
+ * Copyright 2009-2011 NVIDIA Corporation. All rights reserved.
+ *
+ * NOTICE TO USER:
+ *
+ * This source code is subject to NVIDIA ownership rights under U.S. and
+ * international Copyright laws. Users and possessors of this source code
+ * are hereby granted a nonexclusive, royalty-free license to use this code
+ * in individual and commercial software.
+ *
+ * NVIDIA MAKES NO REPRESENTATION ABOUT THE SUITABILITY OF THIS SOURCE
+ * CODE FOR ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR
+ * IMPLIED WARRANTY OF ANY KIND. NVIDIA DISCLAIMS ALL WARRANTIES WITH
+ * REGARD TO THIS SOURCE CODE, INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
+ * IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL,
+ * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
+ * OR PERFORMANCE OF THIS SOURCE CODE.
+ *
+ * U.S. Government End Users. This source code is a "commercial item" as
+ * that term is defined at 48 C.F.R. 2.101 (OCT 1995), consisting of
+ * "commercial computer software" and "commercial computer software
+ * documentation" as such terms are used in 48 C.F.R. 12.212 (SEPT 1995)
+ * and is provided to the U.S. Government only as a commercial end item.
+ * Consistent with 48 C.F.R.12.212 and 48 C.F.R. 227.7202-1 through
+ * 227.7202-4 (JUNE 1995), all U.S. Government End Users acquire the
+ * source code with only those rights set forth herein.
+ *
+ * Any use of this source code in individual and commercial software must
+ * include, in the user documentation and internal comments to the code,
+ * the above Disclaimer and U.S. Government End Users Notice.
+ */
+
+#ifndef PROCESS_RENDER_DEBUG_H
+#define PROCESS_RENDER_DEBUG_H
+
+#include "RenderDebugImpl.h"
+
+namespace RENDER_DEBUG
+{
+
+#define MAX_LINE_VERTEX 16384
+#define MAX_SOLID_VERTEX 16384
+
+PX_PUSH_PACK_DEFAULT
+
+
+class ProcessRenderDebug
+{
+public:
+ enum DisplayType
+ {
+ SCREEN_SPACE,
+ WORLD_SPACE,
+ WORLD_SPACE_NOZ,
+ DT_LAST
+ };
+
+ virtual void processRenderDebug(const DebugPrimitive **dplist,
+ uint32_t pcount,
+ RENDER_DEBUG::RenderDebugInterface *iface,
+ DisplayType type) = 0;
+
+ virtual void flush(RENDER_DEBUG::RenderDebugInterface *iface,DisplayType type) = 0;
+
+ virtual void flushFrame(RENDER_DEBUG::RenderDebugInterface *iface) = 0;
+
+ virtual void finalizeFrame(void) = 0;
+
+ virtual void release(void) = 0;
+
+ virtual void setViewMatrix(const physx::PxMat44 &view)
+ {
+ PX_UNUSED(view);
+ }
+
+protected:
+ virtual ~ProcessRenderDebug(void) { }
+
+};
+
+
+ProcessRenderDebug * createProcessRenderDebug(void);
+
+
+PX_POP_PACK
+
+} // end of namespace
+
+#endif
diff --git a/APEX_1.4/shared/general/RenderDebug/include/PsCommLayer.h b/APEX_1.4/shared/general/RenderDebug/include/PsCommLayer.h
new file mode 100644
index 00000000..99d5ec73
--- /dev/null
+++ b/APEX_1.4/shared/general/RenderDebug/include/PsCommLayer.h
@@ -0,0 +1,41 @@
+#ifndef PS_COMM_LAYER_H
+
+#define PS_COMM_LAYER_H
+
+// Simple class to create a client/server connection and pass messages back and forth over TCP/IP
+// Supports compression
+
+#include <stdint.h>
+
+#define COMM_LAYER_DEFAULT_HOST "localhost"
+#define COMM_LAYER_DEFAULT_PORT 5525
+
+class CommLayer
+{
+public:
+
+ virtual bool isServer(void) const = 0; // return true if we are in server mode.
+ virtual bool hasClient(void) const = 0; // return true if a client connection is currently established
+ virtual bool isConnected(void) const = 0; // return true if we are still connected to the server. The server is always in a 'connected' state.
+ virtual int32_t getPendingReadSize(void) const = 0; // returns the number of bytes of data which is pending to be read.
+ virtual int32_t getPendingSendSize(void) const = 0; // return the number of bytes of data pending to be sent. This can be used for flow control
+
+ virtual bool sendMessage(const void *msg,uint32_t len) = 0;
+
+ virtual uint32_t peekMessage(bool &isBigEndianPacket) = 0; // return the length of the next pending message
+
+ virtual uint32_t getMessage(void *msg,uint32_t maxLength,bool &isBigEndianPacket) = 0; // receives a pending message
+
+ virtual void release(void) = 0;
+
+protected:
+ virtual ~CommLayer(void)
+ {
+ }
+};
+
+CommLayer *createCommLayer(const char *ipaddress,
+ uint16_t portNumber,
+ bool isServer);
+
+#endif
diff --git a/APEX_1.4/shared/general/RenderDebug/include/PsCommStream.h b/APEX_1.4/shared/general/RenderDebug/include/PsCommStream.h
new file mode 100644
index 00000000..cfad1881
--- /dev/null
+++ b/APEX_1.4/shared/general/RenderDebug/include/PsCommStream.h
@@ -0,0 +1,24 @@
+#ifndef PS_COMM_STREAM_H
+
+#define PS_COMM_STREAM_H
+
+#include "PsCommLayer.h"
+
+class CommStream : public CommLayer
+{
+public:
+ virtual bool isValid(void) const = 0;
+ virtual CommLayer *getCommLayer(void) = 0;
+
+protected:
+ virtual ~CommStream(void)
+ {
+
+ }
+};
+
+CommStream *createCommStream(const char *streamFile,
+ bool recordFile,
+ CommLayer *c);
+
+#endif
diff --git a/APEX_1.4/shared/general/RenderDebug/include/RenderDebugData.h b/APEX_1.4/shared/general/RenderDebug/include/RenderDebugData.h
new file mode 100644
index 00000000..aca786ea
--- /dev/null
+++ b/APEX_1.4/shared/general/RenderDebug/include/RenderDebugData.h
@@ -0,0 +1,2289 @@
+/*
+ * Copyright 2009-2011 NVIDIA Corporation. All rights reserved.
+ *
+ * NOTICE TO USER:
+ *
+ * This source code is subject to NVIDIA ownership rights under U.S. and
+ * international Copyright laws. Users and possessors of this source code
+ * are hereby granted a nonexclusive, royalty-free license to use this code
+ * in individual and commercial software.
+ *
+ * NVIDIA MAKES NO REPRESENTATION ABOUT THE SUITABILITY OF THIS SOURCE
+ * CODE FOR ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR
+ * IMPLIED WARRANTY OF ANY KIND. NVIDIA DISCLAIMS ALL WARRANTIES WITH
+ * REGARD TO THIS SOURCE CODE, INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
+ * IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL,
+ * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
+ * OR PERFORMANCE OF THIS SOURCE CODE.
+ *
+ * U.S. Government End Users. This source code is a "commercial item" as
+ * that term is defined at 48 C.F.R. 2.101 (OCT 1995), consisting of
+ * "commercial computer software" and "commercial computer software
+ * documentation" as such terms are used in 48 C.F.R. 12.212 (SEPT 1995)
+ * and is provided to the U.S. Government only as a commercial end item.
+ * Consistent with 48 C.F.R.12.212 and 48 C.F.R. 227.7202-1 through
+ * 227.7202-4 (JUNE 1995), all U.S. Government End Users acquire the
+ * source code with only those rights set forth herein.
+ *
+ * Any use of this source code in individual and commercial software must
+ * include, in the user documentation and internal comments to the code,
+ * the above Disclaimer and U.S. Government End Users Notice.
+ */
+
+#ifndef RENDER_DEBUG_DATA_H
+#define RENDER_DEBUG_DATA_H
+
+/*!
+\file
+\brief debug rendering classes and structures
+*/
+#include "PxVec2.h"
+#include "PxVec3.h"
+#include "PxVec4.h"
+#include "PxQuat.h"
+#include "PxMat33.h"
+#include "PxMat44.h"
+#include "PsIntrinsics.h"
+#include "RenderDebugImpl.h"
+#include "RenderDebug.h"
+#include <new>
+
+#define MAX_SEND_BUFFER 16384 // send up to 16384 at a time.
+
+namespace RENDER_DEBUG
+{
+
+PX_PUSH_PACK_DEFAULT
+
+struct DebugPrimitive;
+struct DebugGraphDesc;
+
+//********************************************************************
+//********************************************************************
+
+
+// This enumeration defines the list of graphics primitives that can be generated by the debug renderer.
+struct DebugCommand
+{
+ enum Enum
+ {
+ SET_CURRENT_RENDER_STATE, // set the current render state bit flags
+ SET_CURRENT_TEXT_SCALE, // set the floating point scale for 3d text printing.
+ SET_CURRENT_COLOR, // set the current pen color
+ SET_CURRENT_ARROW_COLOR, // set the current arrow (secondary) color
+ SET_CURRENT_TEXTURE1, // set the current texture id
+ SET_CURRENT_TEXTURE2, // set the current texture id
+ SET_CURRENT_TILE1,
+ SET_CURRENT_TILE2,
+ SET_CURRENT_TRANSFORM, // set the current matrix transform for graphics primitives
+ SET_CURRENT_RENDER_SCALE, // set the current overall render scale.
+ SET_CURRENT_ARROW_SIZE, // set the current size of arrow heads
+ SET_CURRENT_USER_ID, // sets the current user id.
+ DEBUG_LINE, // render a single line segment
+ DRAW_GRID, // render a 3d studio max style grid.
+ DEBUG_TEXT, // display 3d text
+ DEBUG_MESSAGE, // A debug message or a command
+ DEBUG_BOUND, // display a bounding box
+ DEBUG_FRUSTUM, // debug display a view frustum
+ DEBUG_POINT, // highlight a point
+ DEBUG_POINT_SCALE, // Debug a point with different scale on x/y/z
+ DEBUG_QUAD, // Debug a scaled and oriented screen facing quad
+ DEBUG_RECT2D, // display a 2d rectangle
+ DEBUG_GRADIENT_LINE, // draw a line segment with a unique color for each point.
+ DEBUG_RAY, // draw a ray (line with arrow on the end)
+ DEBUG_CYLINDER, // draw a cylinder assuming the default orientation of the PhysX SDK
+ DEBUG_POINT_CYLINDER, // draw a cylinder between two points
+ DEBUG_THICK_RAY, // draw a thick ray, full 3d arrow head.
+ DEBUG_PLANE, // debug visualization of a plane equation (drawn as concentric circles)
+ DEBUG_TRI, // debug visualize a triangle solid/wireframe determined by the current render state.
+ DEBUG_TRI_NORMALS, // debug visualize a triangle using the provided vertex normals
+ DEBUG_GRADIENT_TRI, // debug visualize a solid shaded triangle with unique vertex colors
+ DEBUG_GRADIENT_TRI_NORMALS, // debug visualize a solid shaded triangle with unique vertex normals and vertex colors
+ DEBUG_SPHERE, // debug visualize a coarse sphere
+ DEBUG_SQUASHED_SPHERE, // debug visualize a sphere that has been squashed
+ DEBUG_CAPSULE, // debug visualize a capsule (assumed PhysX SDK orientation) i.e. Y up is 'height'
+ DEBUG_AXES, // debug visualize a set of axes using thick-rays.
+ DEBUG_ARC, // debug visualize an arc.
+ DEBUG_THICK_ARC, // debug visualize a thick arc
+ DEBUG_DETAILED_SPHERE, // debug visualize a highly detailed sphere
+ DEBUG_BLOCK_INFO, // used internally only.
+ DEBUG_GRAPH, // display a graph
+ DEBUG_CAPSULE_TAPERED, // debug visualize a capsule with y-up as height
+ DEBUG_CIRCLE, // debug visualize an oriented circle
+ DEBUG_CREATE_TRIANGLE_MESH, // Create a triangle mesh to render
+ DEBUG_RENDER_TRIANGLE_MESH_INSTANCES, // render a sequence of triangle mesh instances
+ DEBUG_RELEASE_TRIANGLE_MESH,
+ DEBUG_CONE,
+ DEBUG_REFRESH_TRIANGLE_MESH_VERTICES,
+ DEBUG_TEXT2D,
+ DEBUG_CREATE_CUSTOM_TEXTURE,
+ DEBUG_RENDER_POINTS,
+ DEBUG_RENDER_LINES,
+ DEBUG_RENDER_TRIANGLES,
+ DEBUG_REGISTER_INPUT_EVENT,
+ DEBUG_RESET_INPUT_EVENTS,
+ DEBUG_UNREGISTER_INPUT_EVENT,
+ DEBUG_SKIP_FRAME,
+ DEBUG_CONVEX_HULL,
+ DEBUG_LAST
+ };
+ static PX_INLINE uint32_t getPrimtiveSize(const DebugPrimitive &p); // returns the size of the data associated with a particular primitive type.
+};
+
+PX_INLINE void swap4Bytes(void* _data)
+{
+ char *data = static_cast<char*>(_data);
+ char one_byte;
+ one_byte = data[0]; data[0] = data[3]; data[3] = one_byte;
+ one_byte = data[1]; data[1] = data[2]; data[2] = one_byte;
+}
+
+PX_INLINE void endianSwap(float &v)
+{
+ swap4Bytes(&v);
+}
+
+PX_INLINE void endianSwap(uint32_t &v)
+{
+ swap4Bytes(&v);
+}
+
+PX_INLINE void endianSwap(int32_t &v)
+{
+ swap4Bytes(&v);
+}
+
+PX_INLINE void endianSwap(physx::PxVec2 &v)
+{
+ swap4Bytes(&v.x);
+ swap4Bytes(&v.y);
+}
+
+PX_INLINE void endianSwap(physx::PxVec3 &v)
+{
+ swap4Bytes(&v.x);
+ swap4Bytes(&v.y);
+ swap4Bytes(&v.z);
+}
+
+PX_INLINE void endianSwap(physx::PxVec4 &v)
+{
+ swap4Bytes(&v.x);
+ swap4Bytes(&v.y);
+ swap4Bytes(&v.z);
+ swap4Bytes(&v.w);
+}
+
+PX_INLINE void endianSwap(physx::PxQuat &v)
+{
+ swap4Bytes(&v.x);
+ swap4Bytes(&v.y);
+ swap4Bytes(&v.z);
+ swap4Bytes(&v.w);
+}
+
+PX_INLINE void endianSwap(physx::PxTransform &v)
+{
+ endianSwap(v.p);
+ endianSwap(v.q);
+}
+
+PX_INLINE void endianSwap(physx::PxMat33 &v)
+{
+ uint32_t count = sizeof(v)/4;
+ uint32_t *s = reinterpret_cast<uint32_t *>(&v);
+ for (uint32_t i=0; i<count; i++)
+ {
+ swap4Bytes(s);
+ s++;
+ }
+}
+
+PX_INLINE void endianSwap(physx::PxMat44 &v)
+{
+ uint32_t count = sizeof(v)/4;
+ uint32_t *s = reinterpret_cast<uint32_t *>(&v);
+ for (uint32_t i=0; i<count; i++)
+ {
+ swap4Bytes(s);
+ s++;
+ }
+}
+
+
+// The base class for all debug primitives
+struct DebugPrimitive
+{
+ DebugPrimitive(void) { }
+ DebugPrimitive(DebugCommand::Enum c) : mCommand(c)
+ {
+ }
+
+ void endianFixup(void)
+ {
+ swap4Bytes(&mCommand);
+ }
+
+ uint32_t mCommand;
+};
+
+// used to transmit render state, current color or other single unsigned int primitives.
+struct DebugPrimitiveU32 : public DebugPrimitive
+{
+ DebugPrimitiveU32(void) { }
+ DebugPrimitiveU32(DebugCommand::Enum cmd,uint32_t v) :
+ DebugPrimitive(cmd),
+ mValue(v)
+ {
+ }
+
+ void adjustEndian(void)
+ {
+ endianSwap(mValue);
+ }
+
+ uint32_t mValue;
+};
+
+// used to transmit render scale, text scale, or other single float primitives.
+struct DebugPrimitiveF32 : public DebugPrimitive
+{
+ DebugPrimitiveF32(void) { }
+ DebugPrimitiveF32(DebugCommand::Enum cmd,float v) :
+ DebugPrimitive(cmd),
+ mValue(v)
+ {
+ }
+ void adjustEndian(void)
+ {
+ endianSwap(mValue);
+ }
+
+ float mValue;
+};
+
+// Defines a primitive for a line segment
+struct DebugLine : public DebugPrimitive
+{
+ DebugLine(void) { }
+ DebugLine(const physx::PxVec3 &p1,const physx::PxVec3 &p2) :
+ DebugPrimitive(DebugCommand::DEBUG_LINE),
+ mP1(p1),
+ mP2(p2)
+ {
+ }
+ void adjustEndian(void)
+ {
+ endianSwap(mP1);
+ endianSwap(mP2);
+ }
+
+ physx::PxVec3 mP1;
+ physx::PxVec3 mP2;
+};
+
+// Defines a primitive to draw a grid visualization
+struct DrawGrid : public DebugPrimitive
+{
+ DrawGrid(void) { }
+ DrawGrid(bool zup,uint32_t gridSize) :
+ DebugPrimitive(DebugCommand::DRAW_GRID),
+ mZup(uint32_t(zup)),
+ mGridSize(gridSize)
+ {
+ }
+ void adjustEndian(void)
+ {
+ endianSwap(mZup);
+ endianSwap(mGridSize);
+ }
+
+
+ uint32_t mZup;
+ uint32_t mGridSize;
+};
+
+// Defines a primitive to transmit a piece of 3d ASCII text.
+#define MAX_DEBUG_MESSAGE_STRING 128
+struct DebugMessage : public DebugPrimitive
+{
+ DebugMessage(void) { }
+ DebugMessage(const char *text) :
+ DebugPrimitive(DebugCommand::DEBUG_MESSAGE)
+ {
+ const char *source = text;
+ char *dest = mText;
+ char *stop = &mText[MAX_DEBUG_MESSAGE_STRING-1];
+ while ( *source && dest < stop )
+ {
+ *dest++ = *source++;
+ }
+ *dest = 0;
+ }
+ void adjustEndian(void)
+ {
+ }
+
+ char mText[MAX_DEBUG_MESSAGE_STRING];
+};
+
+
+
+// Defines a primitive to transmit a piece of 3d ASCII text.
+#define MAX_DEBUG_TEXT_STRING 256
+struct DebugText : public DebugPrimitive
+{
+ DebugText(void) { }
+ DebugText(const physx::PxVec3 &position,const physx::PxMat44 &pose,const char *text) :
+ DebugPrimitive(DebugCommand::DEBUG_TEXT),
+ mPosition(position),
+ mPose(pose)
+ {
+ const char *source = text;
+ char *dest = mText;
+ char *stop = &mText[MAX_DEBUG_TEXT_STRING-1];
+ while ( *source && dest < stop )
+ {
+ *dest++ = *source++;
+ }
+ *dest = 0;
+ }
+ void adjustEndian(void)
+ {
+ endianSwap(mPosition);
+ endianSwap(mPose);
+ }
+
+ physx::PxVec3 mPosition; // relative offset from the pose
+ physx::PxMat44 mPose;
+ char mText[MAX_DEBUG_TEXT_STRING];
+};
+
+struct DebugText2D : public DebugPrimitive
+{
+ DebugText2D(void) { }
+ DebugText2D(const physx::PxVec2 &position,float scale,float shadowOffset,bool forceFixedWidthNumbers,uint32_t textColor,const char *text) :
+ DebugPrimitive(DebugCommand::DEBUG_TEXT2D),
+ mPosition(position),
+ mScale(scale),
+ mShadowOffset(shadowOffset),
+ mForceFixWidthNumbers( forceFixedWidthNumbers ? uint32_t(1) : uint32_t(0)),
+ mTextColor(textColor)
+ {
+ const char *source = text;
+ char *dest = mText;
+ char *stop = &mText[MAX_DEBUG_TEXT_STRING-1];
+ while ( *source && dest < stop )
+ {
+ *dest++ = *source++;
+ }
+ *dest = 0;
+ }
+
+ void adjustEndian(void)
+ {
+ endianSwap(mPosition);
+ endianSwap(mScale);
+ endianSwap(mShadowOffset);
+ endianSwap(mForceFixWidthNumbers);
+ endianSwap(mTextColor);
+ }
+
+ physx::PxVec2 mPosition;
+ float mScale;
+ float mShadowOffset;
+ uint32_t mForceFixWidthNumbers;
+ uint32_t mTextColor;
+ char mText[MAX_DEBUG_TEXT_STRING];
+};
+
+
+
+struct DebugFrustum : public DebugPrimitive
+{
+ DebugFrustum(void) { }
+ DebugFrustum(const physx::PxMat44 &view,const physx::PxMat44 &proj) :
+ DebugPrimitive(DebugCommand::DEBUG_FRUSTUM),mView(view),mProj(proj)
+ {
+
+ }
+ void adjustEndian(void)
+ {
+ endianSwap(mView);
+ endianSwap(mProj);
+ }
+
+
+ physx::PxMat44 mView;
+ physx::PxMat44 mProj;
+};
+
+struct DebugCone : public DebugPrimitive
+{
+ DebugCone(void) { }
+ DebugCone(float length,float innerAngle,float outerAngle,uint32_t subDivision,bool closeEnd) :
+ DebugPrimitive(DebugCommand::DEBUG_CONE),mLength(length),mInnerAngle(innerAngle),mOuterAngle(outerAngle),mSubdivision(subDivision),mCloseEnd(uint32_t(closeEnd))
+ {
+
+ }
+ void adjustEndian(void)
+ {
+ endianSwap(mLength);
+ endianSwap(mInnerAngle);
+ endianSwap(mOuterAngle);
+ endianSwap(mSubdivision);
+ endianSwap(mCloseEnd);
+ }
+
+
+ float mLength;
+ float mInnerAngle;
+ float mOuterAngle;
+ uint32_t mSubdivision;
+ uint32_t mCloseEnd;
+};
+
+struct DebugRegisterInputEvent : public DebugPrimitive
+{
+ DebugRegisterInputEvent(void) { }
+ DebugRegisterInputEvent(bool isDigital,InputEventIds::Enum eventId,float sensitivity,InputIds::Enum inputId) :
+ DebugPrimitive(DebugCommand::DEBUG_REGISTER_INPUT_EVENT),
+ mDigital( isDigital ? 1U : 0U),
+ mEventId( uint32_t(eventId)),
+ mSensitivity( sensitivity),
+ mInputId( uint32_t(inputId))
+ {
+
+ }
+ void adjustEndian(void)
+ {
+ endianSwap(mDigital);
+ endianSwap(mEventId);
+ endianSwap(mSensitivity);
+ endianSwap(mInputId);
+ }
+
+ uint32_t mDigital;
+ uint32_t mEventId;
+ float mSensitivity;
+ uint32_t mInputId;
+};
+
+struct DebugUnregisterInputEvent : public DebugPrimitive
+{
+ DebugUnregisterInputEvent(void) { }
+ DebugUnregisterInputEvent(InputEventIds::Enum eventId) :
+ DebugPrimitive(DebugCommand::DEBUG_UNREGISTER_INPUT_EVENT),
+ mEventId( uint32_t( eventId))
+ {
+
+ }
+ void adjustEndian(void)
+ {
+ endianSwap(mEventId);
+ }
+
+ uint32_t mEventId;
+};
+
+// Defines a primitive to draw a bounding box
+struct DebugBound : public DebugPrimitive
+{
+ DebugBound(void) { }
+ DebugBound(const physx::PxVec3 &bmin,const physx::PxVec3 &bmax) :
+ DebugPrimitive(DebugCommand::DEBUG_BOUND),mBmin(bmin),mBmax(bmax)
+ {
+
+ }
+ void adjustEndian(void)
+ {
+ endianSwap(mBmin);
+ endianSwap(mBmax);
+ }
+
+ physx::PxVec3 mBmin;
+ physx::PxVec3 mBmax;
+};
+
+// Defines a primitive which display a debug point visualization.
+struct DebugPoint : public DebugPrimitive
+{
+ DebugPoint(void) {}
+ DebugPoint(const physx::PxVec3 &point,float size) :
+ DebugPrimitive(DebugCommand::DEBUG_POINT),
+ mPos(point),
+ mSize(size)
+ {
+ }
+ void adjustEndian(void)
+ {
+ endianSwap(mPos);
+ endianSwap(mSize);
+ }
+
+
+ physx::PxVec3 mPos;
+ float mSize;
+};
+
+
+struct DebugQuad : public DebugPrimitive
+{
+ DebugQuad(void) {}
+ DebugQuad(const physx::PxVec3 &point,const physx::PxVec2 &scale,float rotation) :
+ DebugPrimitive(DebugCommand::DEBUG_QUAD),
+ mPos(point),
+ mScale(scale),
+ mRotation(rotation)
+ {
+ }
+ void adjustEndian(void)
+ {
+ endianSwap(mPos);
+ endianSwap(mScale);
+ endianSwap(mRotation);
+ }
+
+
+ physx::PxVec3 mPos;
+ physx::PxVec2 mScale;
+ float mRotation;
+};
+
+
+struct DebugPointScale : public DebugPrimitive
+{
+ DebugPointScale(void) {}
+ DebugPointScale(const physx::PxVec3 &point,physx::PxVec3 size) :
+ DebugPrimitive(DebugCommand::DEBUG_POINT_SCALE),
+ mPos(point),
+ mSize(size)
+ {
+ }
+ void adjustEndian(void)
+ {
+ endianSwap(mPos);
+ endianSwap(mSize);
+ }
+
+
+ physx::PxVec3 mPos;
+ physx::PxVec3 mSize;
+};
+
+
+// Defines a primitive to display 2d rectangle in screenspace.
+struct DebugRect2d : public DebugPrimitive
+{
+ DebugRect2d(void) { }
+ DebugRect2d(float x1,float y1,float x2,float y2) :
+ DebugPrimitive(DebugCommand::DEBUG_RECT2D),
+ mX1(x1),
+ mY1(y1),
+ mX2(x2),
+ mY2(y2)
+ {
+ }
+ void adjustEndian(void)
+ {
+ endianSwap(mX1);
+ endianSwap(mY1);
+ endianSwap(mX2);
+ endianSwap(mY2);
+ }
+
+
+ float mX1;
+ float mY1;
+ float mX2;
+ float mY2;
+};
+
+// Defines a primitive for a gradient colored line segment
+struct DebugGradientLine : public DebugPrimitive
+{
+ DebugGradientLine(void) { }
+ DebugGradientLine(const physx::PxVec3 &p1,const physx::PxVec3 &p2,uint32_t c1,uint32_t c2) :
+ DebugPrimitive(DebugCommand::DEBUG_GRADIENT_LINE),
+ mP1(p1),
+ mP2(p2),
+ mC1(c1),
+ mC2(c2)
+ {
+ }
+ void adjustEndian(void)
+ {
+ endianSwap(mP1);
+ endianSwap(mP2);
+ endianSwap(mC1);
+ endianSwap(mC2);
+ }
+
+
+ physx::PxVec3 mP1;
+ physx::PxVec3 mP2;
+ uint32_t mC1;
+ uint32_t mC2;
+};
+
+// Defines a primitive to draw a ray indicator (line segment with arrow-head)
+struct DebugRay : public DebugPrimitive
+{
+ DebugRay(void) { }
+ DebugRay(const physx::PxVec3 &p1,const physx::PxVec3 &p2) :
+ DebugPrimitive(DebugCommand::DEBUG_RAY),
+ mP1(p1),
+ mP2(p2)
+ {
+ }
+ void adjustEndian(void)
+ {
+ endianSwap(mP1);
+ endianSwap(mP2);
+ }
+
+
+ physx::PxVec3 mP1;
+ physx::PxVec3 mP2;
+};
+
+// Defines a primitive to draw a thick ray (solid shaded arrow head)
+struct DebugThickRay : public DebugPrimitive
+{
+ DebugThickRay(void) { }
+ DebugThickRay(const physx::PxVec3 &p1,const physx::PxVec3 &p2,float raySize, bool arrowTip) :
+ DebugPrimitive(DebugCommand::DEBUG_THICK_RAY),
+ mP1(p1),
+ mP2(p2),
+ mRaySize(raySize),
+ mArrowTip(uint32_t(arrowTip))
+ {
+ }
+ void adjustEndian(void)
+ {
+ endianSwap(mP1);
+ endianSwap(mP2);
+ }
+
+
+ physx::PxVec3 mP1;
+ physx::PxVec3 mP2;
+ float mRaySize;
+ uint32_t mArrowTip;
+};
+
+// Defines a primitive to visualize a plane equation
+struct DebugPlane : public DebugPrimitive
+{
+ DebugPlane(void) { }
+ DebugPlane(const physx::PxVec3 &normal,float dCoff,float radius1,float radius2) :
+ DebugPrimitive(DebugCommand::DEBUG_PLANE),
+ mNormal(normal),
+ mD(dCoff),
+ mRadius1(radius1),
+ mRadius2(radius2)
+ {
+ }
+ void adjustEndian(void)
+ {
+ endianSwap(mNormal);
+ endianSwap(mD);
+ endianSwap(mRadius1);
+ endianSwap(mRadius2);
+ }
+
+
+ physx::PxVec3 mNormal;
+ float mD;
+ float mRadius1;
+ float mRadius2;
+};
+
+// Defines a primitive to visualize a single triangle, either wireframe, or solid, or both based on the current render state bit flags
+struct DebugTri : public DebugPrimitive
+{
+ DebugTri(void) { }
+ DebugTri(const physx::PxVec3 &p1,const physx::PxVec3 &p2,const physx::PxVec3 &p3) :
+ DebugPrimitive(DebugCommand::DEBUG_TRI),
+ mP1(p1),
+ mP2(p2),
+ mP3(p3)
+ {
+ }
+ void adjustEndian(void)
+ {
+ endianSwap(mP1);
+ endianSwap(mP2);
+ endianSwap(mP3);
+ }
+
+
+ physx::PxVec3 mP1;
+ physx::PxVec3 mP2;
+ physx::PxVec3 mP3;
+};
+
+struct DebugTriNormals : public DebugPrimitive
+{
+ DebugTriNormals(void) { }
+ DebugTriNormals(const physx::PxVec3 &p1,const physx::PxVec3 &p2,const physx::PxVec3 &p3,const physx::PxVec3 &n1,const physx::PxVec3 &n2,const physx::PxVec3 &n3) :
+ DebugPrimitive(DebugCommand::DEBUG_TRI_NORMALS),
+ mP1(p1),mP2(p2),mP3(p3),
+ mN1(n1),mN2(n2),mN3(n3)
+ {
+ }
+ void adjustEndian(void)
+ {
+ endianSwap(mP1);
+ endianSwap(mP2);
+ endianSwap(mP3);
+ endianSwap(mN1);
+ endianSwap(mN2);
+ endianSwap(mN3);
+ }
+
+
+ physx::PxVec3 mP1;
+ physx::PxVec3 mP2;
+ physx::PxVec3 mP3;
+ physx::PxVec3 mN1;
+ physx::PxVec3 mN2;
+ physx::PxVec3 mN3;
+};
+
+struct DebugGradientTri : public DebugPrimitive
+{
+ DebugGradientTri(void) { }
+ DebugGradientTri(const physx::PxVec3 &p1,const physx::PxVec3 &p2,const physx::PxVec3 &p3,const uint32_t &c1,const uint32_t &c2,const uint32_t &c3) :
+ DebugPrimitive(DebugCommand::DEBUG_GRADIENT_TRI),
+ mP1(p1),mP2(p2),mP3(p3),
+ mC1(c1),mC2(c2),mC3(c3)
+ {
+ }
+ void adjustEndian(void)
+ {
+ endianSwap(mP1);
+ endianSwap(mP2);
+ endianSwap(mP3);
+ endianSwap(mC1);
+ endianSwap(mC2);
+ endianSwap(mC3);
+ }
+
+ physx::PxVec3 mP1;
+ physx::PxVec3 mP2;
+ physx::PxVec3 mP3;
+ uint32_t mC1;
+ uint32_t mC2;
+ uint32_t mC3;
+};
+
+struct DebugGradientTriNormals : public DebugPrimitive
+{
+ DebugGradientTriNormals(void) { }
+ DebugGradientTriNormals(const physx::PxVec3 &p1,const physx::PxVec3 &p2,const physx::PxVec3 &p3,const physx::PxVec3 &n1,const physx::PxVec3 &n2,const physx::PxVec3 &n3,const uint32_t &c1,const uint32_t &c2,const uint32_t &c3) :
+ DebugPrimitive(DebugCommand::DEBUG_GRADIENT_TRI_NORMALS),
+ mP1(p1),mP2(p2),mP3(p3),
+ mN1(n1),mN2(n2),mN3(n3),
+ mC1(c1),mC2(c2),mC3(c3)
+ {
+ }
+ void adjustEndian(void)
+ {
+ endianSwap(mP1);
+ endianSwap(mP2);
+ endianSwap(mP3);
+ endianSwap(mN1);
+ endianSwap(mN2);
+ endianSwap(mN3);
+ endianSwap(mC1);
+ endianSwap(mC2);
+ endianSwap(mC3);
+ }
+
+
+ physx::PxVec3 mP1;
+ physx::PxVec3 mP2;
+ physx::PxVec3 mP3;
+ physx::PxVec3 mN1;
+ physx::PxVec3 mN2;
+ physx::PxVec3 mN3;
+ uint32_t mC1;
+ uint32_t mC2;
+ uint32_t mC3;
+};
+
+struct DebugSphere : public DebugPrimitive
+{
+ DebugSphere(void) { }
+ DebugSphere(float radius, uint32_t subdivision) :
+ DebugPrimitive(DebugCommand::DEBUG_SPHERE),
+ mRadius(radius),
+ mSubdivision(subdivision)
+ {
+ }
+ void adjustEndian(void)
+ {
+ endianSwap(mRadius);
+ endianSwap(mSubdivision);
+ }
+
+
+ float mRadius;
+ uint32_t mSubdivision;
+};
+
+struct DebugSquashedSphere : public DebugPrimitive
+{
+ DebugSquashedSphere(void) { }
+ DebugSquashedSphere(const physx::PxVec3 &radius, uint32_t subdivision) :
+ DebugPrimitive(DebugCommand::DEBUG_SQUASHED_SPHERE),
+ mRadius(radius),
+ mSubdivision(subdivision)
+ {
+ }
+ void adjustEndian(void)
+ {
+ endianSwap(mRadius);
+ endianSwap(mSubdivision);
+ }
+
+
+ physx::PxVec3 mRadius;
+ uint32_t mSubdivision;
+};
+
+
+struct DebugCapsule : public DebugPrimitive
+{
+ DebugCapsule(void) { }
+ DebugCapsule(float radius,float height,uint32_t subdivision) :
+ DebugPrimitive(DebugCommand::DEBUG_CAPSULE),
+ mRadius(radius),
+ mHeight(height),
+ mSubdivision(subdivision)
+ {
+ }
+ void adjustEndian(void)
+ {
+ endianSwap(mRadius);
+ endianSwap(mHeight);
+ endianSwap(mSubdivision);
+ }
+
+
+ float mRadius;
+ float mHeight;
+ uint32_t mSubdivision;
+};
+
+struct DebugTaperedCapsule : public DebugPrimitive
+{
+ DebugTaperedCapsule() { }
+ DebugTaperedCapsule(float radius1, float radius2, float height, uint32_t subdivision) :
+ DebugPrimitive(DebugCommand::DEBUG_CAPSULE_TAPERED),
+ mRadius1(radius1),
+ mRadius2(radius2),
+ mHeight(height),
+ mSubdivision(subdivision)
+ {
+ }
+ void adjustEndian(void)
+ {
+ endianSwap(mRadius1);
+ endianSwap(mRadius2);
+ endianSwap(mHeight);
+ endianSwap(mSubdivision);
+ }
+
+
+ float mRadius1;
+ float mRadius2;
+ float mHeight;
+ uint32_t mSubdivision;
+};
+
+struct DebugPointCylinder : public DebugPrimitive
+{
+ DebugPointCylinder(void) { }
+ DebugPointCylinder(const physx::PxVec3 &p1,const physx::PxVec3 &p2,float radius) :
+ DebugPrimitive(DebugCommand::DEBUG_POINT_CYLINDER),
+ mP1(p1),
+ mP2(p2),
+ mRadius(radius)
+ {
+ }
+ void adjustEndian(void)
+ {
+ endianSwap(mP1);
+ endianSwap(mP2);
+ endianSwap(mRadius);
+ }
+
+
+ physx::PxVec3 mP1;
+ physx::PxVec3 mP2;
+ float mRadius;
+};
+
+
+struct DebugCylinder : public DebugPrimitive
+{
+ DebugCylinder(void) { }
+ DebugCylinder(float radius,float height,uint32_t subdivision,bool closeSides) :
+ DebugPrimitive(DebugCommand::DEBUG_CYLINDER),
+ mRadius1(radius),
+ mRadius2(radius),
+ mHeight(height),
+ mSubdivision(subdivision),
+ mCloseSides(uint32_t(closeSides))
+ {
+ }
+
+ DebugCylinder(float radius1, float radius2, float height, uint32_t subdivision, bool closeSides) :
+ DebugPrimitive(DebugCommand::DEBUG_CYLINDER),
+ mRadius1(radius1),
+ mRadius2(radius2),
+ mHeight(height),
+ mSubdivision(subdivision),
+ mCloseSides(uint32_t(closeSides))
+ {
+ }
+ void adjustEndian(void)
+ {
+ endianSwap(mRadius1);
+ endianSwap(mRadius2);
+ endianSwap(mHeight);
+ endianSwap(mSubdivision);
+ endianSwap(mCloseSides);
+ }
+
+
+ float mRadius1;
+ float mRadius2;
+ float mHeight;
+ uint32_t mSubdivision;
+ uint32_t mCloseSides;
+};
+
+struct DebugCircle : public DebugPrimitive
+{
+ DebugCircle(void) { }
+ DebugCircle(float radius,
+ uint32_t subdivision,
+ bool solid) :
+ DebugPrimitive(DebugCommand::DEBUG_CIRCLE),
+ mTransform(physx::PxIdentity),
+ mRadius(radius),
+ mSubdivision(subdivision),
+ mDrawSolidCircle(solid)
+ {
+ }
+
+ void adjustEndian(void)
+ {
+ endianSwap(mRadius);
+ endianSwap(mTransform);
+ endianSwap(mSubdivision);
+ endianSwap(mDrawSolidCircle);
+ }
+
+ physx::PxMat44 mTransform;
+ float mRadius;
+ uint32_t mSubdivision;
+ int32_t mDrawSolidCircle;
+};
+
+struct DebugAxes : public DebugPrimitive
+{
+ DebugAxes(void) { }
+ DebugAxes(const physx::PxMat44 &transform,float distance,float brightness,bool showXYZ,bool showRotation, uint32_t axisSwitch, DebugAxesRenderMode::Enum renderMode) :
+ DebugPrimitive(DebugCommand::DEBUG_AXES),
+ mTransform(transform),
+ mDistance(distance),
+ mBrightness(brightness),
+ mShowXYZ(uint32_t(showXYZ)),
+ mShowRotation(uint32_t(showRotation)),
+ mAxisSwitch(axisSwitch),
+ mRenderMode(renderMode)
+ {
+ }
+
+ void adjustEndian(void)
+ {
+ endianSwap(mTransform);
+ endianSwap(mDistance);
+ endianSwap(mBrightness);
+ endianSwap(mShowXYZ);
+ endianSwap(mShowRotation);
+ endianSwap(mAxisSwitch);
+ }
+
+
+ physx::PxMat44 mTransform;
+ float mDistance;
+ float mBrightness;
+ uint32_t mShowXYZ;
+ uint32_t mShowRotation;
+ uint32_t mAxisSwitch;
+ uint32_t mRenderMode;
+};
+
+struct DebugArc : public DebugPrimitive
+{
+ DebugArc(void) { }
+ DebugArc(const physx::PxVec3 &center,const physx::PxVec3 &p1,const physx::PxVec3 &p2,float arrowSize,bool showRoot) :
+ DebugPrimitive(DebugCommand::DEBUG_ARC),
+ mCenter(center),
+ mP1(p1),
+ mP2(p2),
+ mArrowSize(arrowSize),
+ mShowRoot(uint32_t(showRoot))
+ {
+ }
+ void adjustEndian(void)
+ {
+ endianSwap(mCenter);
+ endianSwap(mP1);
+ endianSwap(mP2);
+ endianSwap(mArrowSize);
+ endianSwap(mShowRoot);
+ }
+
+
+ physx::PxVec3 mCenter;
+ physx::PxVec3 mP1;
+ physx::PxVec3 mP2;
+ float mArrowSize;
+ uint32_t mShowRoot;
+};
+
+struct DebugThickArc : public DebugPrimitive
+{
+ DebugThickArc(void) { }
+ DebugThickArc(const physx::PxVec3 &center,const physx::PxVec3 &p1,const physx::PxVec3 &p2,float thickness=0.02f,bool showRoot=false) :
+ DebugPrimitive(DebugCommand::DEBUG_THICK_ARC),
+ mCenter(center),
+ mP1(p1),
+ mP2(p2),
+ mThickness(thickness),
+ mShowRoot(uint32_t(showRoot))
+ {
+ }
+ void adjustEndian(void)
+ {
+ endianSwap(mCenter);
+ endianSwap(mP1);
+ endianSwap(mP2);
+ endianSwap(mThickness);
+ endianSwap(mShowRoot);
+ }
+
+
+ physx::PxVec3 mCenter;
+ physx::PxVec3 mP1;
+ physx::PxVec3 mP2;
+ float mThickness;
+ uint32_t mShowRoot;
+};
+
+struct DebugDetailedSphere : public DebugPrimitive
+{
+ DebugDetailedSphere(void) { }
+ DebugDetailedSphere(const physx::PxVec3 &pos,float radius,uint32_t stepCount) :
+ DebugPrimitive(DebugCommand::DEBUG_DETAILED_SPHERE),
+ mPos(pos),
+ mRadius(radius),
+ mStepCount(stepCount)
+ {
+ }
+
+ void adjustEndian(void)
+ {
+ endianSwap(mPos);
+ endianSwap(mRadius);
+ endianSwap(mStepCount);
+ }
+
+
+ physx::PxVec3 mPos;
+ float mRadius;
+ uint32_t mStepCount;
+};
+
+struct DebugCreateCustomTexture : public DebugPrimitive
+{
+ DebugCreateCustomTexture(void) { }
+ DebugCreateCustomTexture(uint32_t id,const char *textureName) :
+ DebugPrimitive(DebugCommand::DEBUG_CREATE_CUSTOM_TEXTURE),
+ mId(id)
+ {
+ const char *source = textureName;
+ char *dest = mTextureName;
+ char *stop = &mTextureName[MAX_DEBUG_MESSAGE_STRING-1];
+ while ( *source && dest < stop )
+ {
+ *dest++ = *source++;
+ }
+ *dest = 0;
+ }
+
+ void adjustEndian(void)
+ {
+ endianSwap(mId);
+ }
+
+
+ uint32_t mId;
+ char mTextureName[MAX_DEBUG_MESSAGE_STRING];
+};
+
+
+struct DebugSetCurrentTransform : public DebugPrimitive
+{
+ DebugSetCurrentTransform(void) { }
+ DebugSetCurrentTransform(const physx::PxMat44 &m) :
+ DebugPrimitive(DebugCommand::SET_CURRENT_TRANSFORM),
+ mTransform(m)
+ {
+ }
+ void adjustEndian(void)
+ {
+ endianSwap(mTransform);
+ }
+
+ physx::PxMat44 mTransform;
+};
+
+struct DebugGraphStream : public DebugPrimitive
+{
+ DebugGraphStream(void) { mAllocated = false; mBuffer = NULL;}
+ DebugGraphStream(const DebugGraphDesc &d);
+ ~DebugGraphStream(void);
+
+ void adjustEndian(void)
+ {
+ //TODO TODO!
+ }
+
+
+ uint32_t getSize(void) const { return mSize; }
+ uint32_t mSize;
+ uint8_t *mBuffer;
+private:
+ uint32_t mAllocated;
+};
+
+struct DebugCreateTriangleMesh : public DebugPrimitive
+{
+ DebugCreateTriangleMesh(void) { mAllocated = false; mBuffer = NULL;}
+ DebugCreateTriangleMesh(uint32_t meshId,
+ uint32_t vcount, // The number of vertices in the triangle mesh
+ const RENDER_DEBUG::RenderDebugMeshVertex *meshVertices, // The array of vertices
+ uint32_t tcount, // The number of triangles (indices must contain tcount*3 values)
+ const uint32_t *indices); // The array of triangle mesh indices
+
+ ~DebugCreateTriangleMesh(void);
+
+ void adjustEndian(void)
+ {
+ uint32_t *s = &mSize;
+ swap4Bytes(s); // The Size.
+ s++;
+ swap4Bytes(s);
+ uint32_t meshId = *s++;
+ PX_UNUSED(meshId);
+ swap4Bytes(s);
+ uint32_t vcount = *s++;
+ swap4Bytes(s);
+ uint32_t tcount = *s++;
+ uint32_t vSwapCount = (sizeof(RenderDebugMeshVertex)/4)*vcount;
+ for (uint32_t i=0; i<vSwapCount; i++)
+ {
+ swap4Bytes(s);
+ s++;
+ }
+ uint32_t iSwapCount = tcount*3;
+ for (uint32_t i=0; i<iSwapCount; i++)
+ {
+ swap4Bytes(s);
+ s++;
+ }
+ }
+
+
+ uint32_t getSize(void) const { return mSize; }
+ uint32_t mSize;
+ uint8_t *mBuffer;
+private:
+ uint32_t mAllocated;
+};
+
+struct DebugRenderTriangleMeshInstances : public DebugPrimitive
+{
+ DebugRenderTriangleMeshInstances(void) { mAllocated = false; mBuffer = NULL;}
+ DebugRenderTriangleMeshInstances(uint32_t meshId,
+ uint32_t instanceCount,
+ const RENDER_DEBUG::RenderDebugInstance *instances);
+
+
+ ~DebugRenderTriangleMeshInstances(void);
+
+ void adjustEndian(void)
+ {
+ uint32_t *s = &mSize;
+ swap4Bytes(s);
+ s++;
+ swap4Bytes(s);
+ uint32_t meshId = *s++;
+ PX_UNUSED(meshId);
+ swap4Bytes(s);
+ uint32_t instanceCount = *s++;
+ uint32_t swapCount = (sizeof(RenderDebugInstance)/4)*instanceCount;
+ for (uint32_t i=0; i<swapCount; i++)
+ {
+ swap4Bytes(s);
+ s++;
+ }
+ }
+
+
+ uint32_t getSize(void) const { return mSize; }
+ uint32_t mSize;
+ uint8_t *mBuffer;
+private:
+ uint32_t mAllocated;
+};
+
+struct DebugConvexHull : public DebugPrimitive
+{
+ DebugConvexHull(void) { mAllocated = false; mBuffer = NULL;}
+ DebugConvexHull(uint32_t planeCount,const float *planes);
+
+
+ ~DebugConvexHull(void);
+
+ void adjustEndian(void)
+ {
+ uint32_t *s = &mSize;
+ swap4Bytes(s);
+ s++;
+ swap4Bytes(s); // count
+ uint32_t planeCount = *s++;
+ uint32_t swapCount = 4*planeCount;
+ for (uint32_t i=0; i<swapCount; i++)
+ {
+ swap4Bytes(s);
+ s++;
+ }
+ }
+
+
+ uint32_t getSize(void) const { return mSize; }
+ uint32_t mSize;
+ uint8_t *mBuffer;
+private:
+ uint32_t mAllocated;
+};
+
+struct DebugRenderPoints : public DebugPrimitive
+{
+ DebugRenderPoints(void) { mAllocated = false; mBuffer = NULL;}
+ DebugRenderPoints(uint32_t meshId,
+ PointRenderMode mode,
+ uint32_t textureId1,
+ float textureTile1,
+ uint32_t textureId2,
+ float textureTile2,
+ uint32_t pointCount,
+ const float *points);
+
+
+ ~DebugRenderPoints(void);
+
+ void adjustEndian(void)
+ {
+ uint32_t *s = &mSize;
+ swap4Bytes(s);
+ s++;
+ swap4Bytes(s); // meshId
+ s++;
+ swap4Bytes(s); // mode
+ s++;
+ swap4Bytes(s); // textureId1
+ s++;
+ swap4Bytes(s); // textureTile1;
+ s++;
+ swap4Bytes(s); // textureId2
+ s++;
+ swap4Bytes(s); // textureTile2;
+ s++;
+ swap4Bytes(s); // pointCount
+ uint32_t pointCount = *s++;
+ uint32_t swapCount = 3*pointCount;
+ for (uint32_t i=0; i<swapCount; i++)
+ {
+ swap4Bytes(s);
+ s++;
+ }
+ }
+
+
+ uint32_t getSize(void) const { return mSize; }
+ uint32_t mSize;
+ uint8_t *mBuffer;
+private:
+ uint32_t mAllocated;
+};
+
+
+struct DebugRenderLines : public DebugPrimitive
+{
+ DebugRenderLines(void) { mAllocated = false; mBuffer = NULL;}
+ DebugRenderLines(uint32_t lcount,
+ const RenderDebugVertex *vertices,
+ uint32_t useZ,
+ uint32_t isScreenSpace);
+
+
+ ~DebugRenderLines(void);
+
+ void adjustEndian(void)
+ {
+ uint32_t *s = &mSize;
+ swap4Bytes(s); // size
+ s++;
+ swap4Bytes(s); // lcount
+ uint32_t lcount = *s++;
+ swap4Bytes(s); // useZ
+ s++;
+ swap4Bytes(s); // isScreenSpace
+ s++;
+ uint32_t swapCount = (sizeof(RenderDebugVertex)/4)*lcount*2;
+ for (uint32_t i=0; i<swapCount; i++)
+ {
+ swap4Bytes(s);
+ s++;
+ }
+ }
+
+
+ uint32_t getSize(void) const { return mSize; }
+ uint32_t mSize;
+ uint8_t *mBuffer;
+private:
+ uint32_t mAllocated;
+};
+
+struct DebugRenderTriangles : public DebugPrimitive
+{
+ DebugRenderTriangles(void) { mAllocated = false; mBuffer = NULL;}
+ DebugRenderTriangles(uint32_t tcount,
+ const RenderDebugSolidVertex *vertices,
+ uint32_t useZ,
+ uint32_t isScreenSpace);
+
+
+ ~DebugRenderTriangles(void);
+
+ void adjustEndian(void)
+ {
+ uint32_t *s = &mSize;
+ swap4Bytes(s); //size
+ s++;
+ swap4Bytes(s); // tcount
+ uint32_t tcount = *s++;
+ swap4Bytes(s); // useZ
+ s++;
+ swap4Bytes(s); // isScreenSpace
+ s++;
+ uint32_t swapCount = (sizeof(RenderDebugSolidVertex)/4)*tcount*3;
+ for (uint32_t i=0; i<swapCount; i++)
+ {
+ swap4Bytes(s);
+ s++;
+ }
+ }
+
+
+ uint32_t getSize(void) const { return mSize; }
+ uint32_t mSize;
+ uint8_t *mBuffer;
+private:
+ uint32_t mAllocated;
+};
+
+
+struct DebugReleaseTriangleMesh : public DebugPrimitive
+{
+ DebugReleaseTriangleMesh(void) { }
+ DebugReleaseTriangleMesh(uint32_t meshId) :
+ DebugPrimitive(DebugCommand::DEBUG_RELEASE_TRIANGLE_MESH),
+ mMeshId(meshId)
+ {
+ }
+ void adjustEndian(void)
+ {
+ endianSwap(mMeshId);
+ }
+
+ uint32_t mMeshId;
+};
+
+struct DebugRefreshTriangleMeshVertices : public DebugPrimitive
+{
+ DebugRefreshTriangleMeshVertices(void) { mAllocated = false; mBuffer = NULL;}
+ DebugRefreshTriangleMeshVertices(uint32_t meshID,
+ uint32_t vcount,
+ const RenderDebugMeshVertex *refreshVertices,
+ const uint32_t *refreshIndices); // The array of triangle mesh indices
+
+ ~DebugRefreshTriangleMeshVertices(void);
+
+ void adjustEndian(void)
+ {
+ uint32_t *s = &mSize;
+ swap4Bytes(s); // The Size.
+ s++;
+ swap4Bytes(s);
+ uint32_t meshId = *s++;
+ PX_UNUSED(meshId);
+ swap4Bytes(s);
+ uint32_t vcount = *s++;
+ uint32_t vSwapCount = (sizeof(RenderDebugMeshVertex)/4)*vcount;
+ for (uint32_t i=0; i<vSwapCount; i++)
+ {
+ swap4Bytes(s);
+ s++;
+ }
+ uint32_t iSwapCount = vcount;
+ for (uint32_t i=0; i<iSwapCount; i++)
+ {
+ swap4Bytes(s);
+ s++;
+ }
+ }
+
+
+ uint32_t getSize(void) const { return mSize; }
+ uint32_t mSize;
+ uint8_t *mBuffer;
+private:
+ uint32_t mAllocated;
+};
+
+
+PX_COMPILE_TIME_ASSERT(sizeof(DebugPrimitive)==4);
+PX_COMPILE_TIME_ASSERT(sizeof(DebugPrimitiveU32)==8);
+PX_COMPILE_TIME_ASSERT(sizeof(DebugPrimitiveF32)==8);
+PX_COMPILE_TIME_ASSERT(sizeof(DebugLine)==28);
+PX_COMPILE_TIME_ASSERT(sizeof(DrawGrid)==12);
+PX_COMPILE_TIME_ASSERT(sizeof(DebugMessage)==132);
+PX_COMPILE_TIME_ASSERT(sizeof(DebugText)==336);
+PX_COMPILE_TIME_ASSERT(sizeof(DebugText2D)==284);
+PX_COMPILE_TIME_ASSERT(sizeof(DebugFrustum)==132);
+PX_COMPILE_TIME_ASSERT(sizeof(DebugCone)==24);
+PX_COMPILE_TIME_ASSERT(sizeof(DebugBound)==28);
+PX_COMPILE_TIME_ASSERT(sizeof(DebugPoint)==20);
+PX_COMPILE_TIME_ASSERT(sizeof(DebugQuad)==28);
+PX_COMPILE_TIME_ASSERT(sizeof(DebugPointScale)==28);
+PX_COMPILE_TIME_ASSERT(sizeof(DebugRect2d)==20);
+PX_COMPILE_TIME_ASSERT(sizeof(DebugGradientLine)==36);
+PX_COMPILE_TIME_ASSERT(sizeof(DebugRay)==28);
+PX_COMPILE_TIME_ASSERT(sizeof(DebugThickRay)==36);
+PX_COMPILE_TIME_ASSERT(sizeof(DebugPlane)==28);
+PX_COMPILE_TIME_ASSERT(sizeof(DebugTri)==40);
+PX_COMPILE_TIME_ASSERT(sizeof(DebugTriNormals)==76);
+PX_COMPILE_TIME_ASSERT(sizeof(DebugGradientTri)==52);
+PX_COMPILE_TIME_ASSERT(sizeof(DebugGradientTriNormals)==88);
+PX_COMPILE_TIME_ASSERT(sizeof(DebugSphere)==12);
+PX_COMPILE_TIME_ASSERT(sizeof(DebugSquashedSphere)==20);
+PX_COMPILE_TIME_ASSERT(sizeof(DebugCapsule)==16);
+PX_COMPILE_TIME_ASSERT(sizeof(DebugTaperedCapsule)==20);
+PX_COMPILE_TIME_ASSERT(sizeof(DebugPointCylinder)==32);
+PX_COMPILE_TIME_ASSERT(sizeof(DebugCylinder)==24);
+PX_COMPILE_TIME_ASSERT(sizeof(DebugCircle)==80);
+PX_COMPILE_TIME_ASSERT(sizeof(DebugAxes)==92);
+PX_COMPILE_TIME_ASSERT(sizeof(DebugArc)==48);
+PX_COMPILE_TIME_ASSERT(sizeof(DebugThickArc)==48);
+PX_COMPILE_TIME_ASSERT(sizeof(DebugDetailedSphere)==24);
+PX_COMPILE_TIME_ASSERT(sizeof(DebugSetCurrentTransform)==68);
+#if PX_P64_FAMILY
+PX_COMPILE_TIME_ASSERT(sizeof(DebugGraphStream)==24);
+PX_COMPILE_TIME_ASSERT(sizeof(DebugCreateTriangleMesh)==24);
+PX_COMPILE_TIME_ASSERT(sizeof(DebugRefreshTriangleMeshVertices)==24);
+PX_COMPILE_TIME_ASSERT(sizeof(DebugRenderTriangleMeshInstances)==24);
+#else
+PX_COMPILE_TIME_ASSERT(sizeof(DebugGraphStream)==16);
+PX_COMPILE_TIME_ASSERT(sizeof(DebugCreateTriangleMesh)==16);
+PX_COMPILE_TIME_ASSERT(sizeof(DebugRefreshTriangleMeshVertices)==16);
+PX_COMPILE_TIME_ASSERT(sizeof(DebugRenderTriangleMeshInstances)==16);
+#endif
+
+PX_COMPILE_TIME_ASSERT(sizeof(DebugReleaseTriangleMesh)==8);
+PX_INLINE void endianSwap(DebugPrimitive *prim)
+{
+ prim->endianFixup();
+ switch ( prim->mCommand )
+ {
+ case DebugCommand::SET_CURRENT_TRANSFORM:
+ {
+ DebugSetCurrentTransform *d = static_cast< DebugSetCurrentTransform *>(prim);
+ d->adjustEndian();
+ }
+ break;
+ case DebugCommand::DEBUG_SKIP_FRAME:
+ case DebugCommand::DEBUG_RESET_INPUT_EVENTS:
+ case DebugCommand::SET_CURRENT_COLOR:
+ case DebugCommand::SET_CURRENT_RENDER_STATE:
+ case DebugCommand::SET_CURRENT_ARROW_COLOR:
+ case DebugCommand::SET_CURRENT_TEXTURE1:
+ case DebugCommand::SET_CURRENT_TEXTURE2:
+ case DebugCommand::SET_CURRENT_USER_ID:
+ {
+ DebugPrimitiveU32 *d = static_cast< DebugPrimitiveU32 *>(prim);
+ d->adjustEndian();
+ }
+ break;
+ case DebugCommand::DEBUG_BOUND:
+ {
+ DebugBound *d = static_cast< DebugBound *>(prim);
+ d->adjustEndian();
+ }
+ break;
+ case DebugCommand::SET_CURRENT_TEXT_SCALE:
+ case DebugCommand::SET_CURRENT_RENDER_SCALE:
+ case DebugCommand::SET_CURRENT_ARROW_SIZE:
+ case DebugCommand::SET_CURRENT_TILE1:
+ case DebugCommand::SET_CURRENT_TILE2:
+ {
+ DebugPrimitiveF32 *d = static_cast< DebugPrimitiveF32 *>(prim);
+ d->adjustEndian();
+ }
+ break;
+ case DebugCommand::DEBUG_LINE:
+ {
+ DebugLine *d = static_cast< DebugLine *>(prim);
+ d->adjustEndian();
+ }
+ break;
+ case DebugCommand::DRAW_GRID:
+ {
+ DrawGrid *d = static_cast< DrawGrid *>(prim);
+ d->adjustEndian();
+ }
+ break;
+ case DebugCommand::DEBUG_TEXT:
+ {
+ DebugText *d = static_cast< DebugText *>(prim);
+ d->adjustEndian();
+ }
+ break;
+ case DebugCommand::DEBUG_TEXT2D:
+ {
+ DebugText2D *d = static_cast< DebugText2D *>(prim);
+ d->adjustEndian();
+ }
+ break;
+ case DebugCommand::DEBUG_QUAD:
+ {
+ DebugQuad *d = static_cast< DebugQuad *>(prim);
+ d->adjustEndian();
+ }
+ break;
+ case DebugCommand::DEBUG_POINT:
+ {
+ DebugPoint *d = static_cast< DebugPoint *>(prim);
+ d->adjustEndian();
+ }
+ break;
+ case DebugCommand::DEBUG_RECT2D:
+ {
+ DebugRect2d *d = static_cast< DebugRect2d *>(prim);
+ d->adjustEndian();
+ }
+ break;
+ case DebugCommand::DEBUG_GRADIENT_LINE:
+ {
+ DebugGradientLine *d = static_cast< DebugGradientLine *>(prim);
+ d->adjustEndian();
+ }
+ break;
+ case DebugCommand::DEBUG_RAY:
+ {
+ DebugRay *d = static_cast< DebugRay *>(prim);
+ d->adjustEndian();
+ }
+ break;
+ case DebugCommand::DEBUG_CYLINDER:
+ {
+ DebugCylinder *d = static_cast< DebugCylinder *>(prim);
+ d->adjustEndian();
+ }
+ break;
+ case DebugCommand::DEBUG_CIRCLE:
+ {
+ DebugCircle *d = static_cast< DebugCircle *>(prim);
+ d->adjustEndian();
+ }
+ break;
+ case DebugCommand::DEBUG_POINT_CYLINDER:
+ {
+ DebugPointCylinder *d = static_cast< DebugPointCylinder *>(prim);
+ d->adjustEndian();
+ }
+ break;
+ case DebugCommand::DEBUG_THICK_RAY:
+ {
+ DebugThickRay *d = static_cast< DebugThickRay *>(prim);
+ d->adjustEndian();
+ }
+ break;
+ case DebugCommand::DEBUG_PLANE:
+ {
+ DebugPlane *d = static_cast< DebugPlane *>(prim);
+ d->adjustEndian();
+ }
+ break;
+ case DebugCommand::DEBUG_TRI:
+ {
+ DebugTri *d = static_cast< DebugTri *>(prim);
+ d->adjustEndian();
+ }
+ break;
+ case DebugCommand::DEBUG_TRI_NORMALS:
+ {
+ DebugTriNormals *d = static_cast< DebugTriNormals *>(prim);
+ d->adjustEndian();
+ }
+ break;
+ case DebugCommand::DEBUG_GRADIENT_TRI:
+ {
+ DebugGradientTri *d = static_cast< DebugGradientTri *>(prim);
+ d->adjustEndian();
+ }
+ break;
+ case DebugCommand::DEBUG_GRADIENT_TRI_NORMALS:
+ {
+ DebugGradientTriNormals *d = static_cast< DebugGradientTriNormals *>(prim);
+ d->adjustEndian();
+ }
+ break;
+ case DebugCommand::DEBUG_SPHERE:
+ {
+ DebugSphere *d = static_cast< DebugSphere *>(prim);
+ d->adjustEndian();
+ }
+ break;
+ case DebugCommand::DEBUG_SQUASHED_SPHERE:
+ {
+ DebugSquashedSphere *d = static_cast< DebugSquashedSphere *>(prim);
+ d->adjustEndian();
+ }
+ break;
+ case DebugCommand::DEBUG_CAPSULE:
+ {
+ DebugCapsule *d = static_cast< DebugCapsule *>(prim);
+ d->adjustEndian();
+ }
+ break;
+ case DebugCommand::DEBUG_AXES:
+ {
+ DebugAxes *d = static_cast< DebugAxes *>(prim);
+ d->adjustEndian();
+ }
+ break;
+ case DebugCommand::DEBUG_ARC:
+ {
+ DebugArc *d = static_cast< DebugArc *>(prim);
+ d->adjustEndian();
+ }
+ break;
+ case DebugCommand::DEBUG_THICK_ARC:
+ {
+ DebugThickArc *d = static_cast< DebugThickArc *>(prim);
+ d->adjustEndian();
+ }
+ break;
+ case DebugCommand::DEBUG_DETAILED_SPHERE:
+ {
+ DebugDetailedSphere *d = static_cast< DebugDetailedSphere *>(prim);
+ d->adjustEndian();
+ }
+ break;
+ case DebugCommand::DEBUG_BLOCK_INFO:
+ {
+ PX_ALWAYS_ASSERT();
+ }
+ break;
+ case DebugCommand::DEBUG_GRAPH:
+ {
+ DebugGraphStream *d = static_cast< DebugGraphStream *>(prim);
+ d->adjustEndian();
+ PX_ALWAYS_ASSERT();
+ }
+ break;
+ case DebugCommand::DEBUG_CAPSULE_TAPERED:
+ {
+ DebugTaperedCapsule *d = static_cast< DebugTaperedCapsule *>(prim);
+ d->adjustEndian();
+ }
+ break;
+ case DebugCommand::DEBUG_POINT_SCALE:
+ {
+ DebugPointScale *d = static_cast< DebugPointScale *>(prim);
+ d->adjustEndian();
+ }
+ break;
+ case DebugCommand::DEBUG_MESSAGE:
+ {
+ DebugMessage *d = static_cast< DebugMessage *>(prim);
+ d->adjustEndian();
+ }
+ break;
+ case DebugCommand::DEBUG_CREATE_CUSTOM_TEXTURE:
+ {
+ DebugCreateCustomTexture *d = static_cast< DebugCreateCustomTexture *>(prim);
+ d->adjustEndian();
+ }
+ break;
+ case DebugCommand::DEBUG_FRUSTUM:
+ {
+ DebugFrustum *d = static_cast< DebugFrustum *>(prim);
+ d->adjustEndian();
+ }
+ break;
+ case DebugCommand::DEBUG_CONE:
+ {
+ DebugCone *d = static_cast< DebugCone *>(prim);
+ d->adjustEndian();
+ }
+ break;
+ case DebugCommand::DEBUG_REGISTER_INPUT_EVENT:
+ {
+ DebugRegisterInputEvent *d = static_cast< DebugRegisterInputEvent *>(prim);
+ d->adjustEndian();
+ }
+ break;
+ case DebugCommand::DEBUG_UNREGISTER_INPUT_EVENT:
+ {
+ DebugUnregisterInputEvent *d = static_cast< DebugUnregisterInputEvent *>(prim);
+ d->adjustEndian();
+ }
+ break;
+ case DebugCommand::DEBUG_CREATE_TRIANGLE_MESH:
+ {
+ DebugCreateTriangleMesh *d = static_cast< DebugCreateTriangleMesh *>(prim);
+ d->adjustEndian();
+ }
+ break;
+ case DebugCommand::DEBUG_RENDER_TRIANGLE_MESH_INSTANCES:
+ {
+ DebugRenderTriangleMeshInstances *d = static_cast< DebugRenderTriangleMeshInstances *>(prim);
+ d->adjustEndian();
+ }
+ break;
+ case DebugCommand::DEBUG_RENDER_POINTS:
+ {
+ DebugRenderPoints *d = static_cast< DebugRenderPoints *>(prim);
+ d->adjustEndian();
+ }
+ break;
+ case DebugCommand::DEBUG_CONVEX_HULL:
+ {
+ DebugConvexHull *d = static_cast< DebugConvexHull *>(prim);
+ d->adjustEndian();
+ }
+ break;
+ case DebugCommand::DEBUG_RENDER_LINES:
+ {
+ DebugRenderLines *d = static_cast< DebugRenderLines *>(prim);
+ d->adjustEndian();
+ }
+ break;
+ case DebugCommand::DEBUG_RENDER_TRIANGLES:
+ {
+ DebugRenderTriangles *d = static_cast< DebugRenderTriangles *>(prim);
+ d->adjustEndian();
+ }
+ break;
+ case DebugCommand::DEBUG_RELEASE_TRIANGLE_MESH:
+ {
+ DebugReleaseTriangleMesh *d = static_cast< DebugReleaseTriangleMesh *>(prim);
+ d->adjustEndian();
+ }
+ break;
+ case DebugCommand::DEBUG_REFRESH_TRIANGLE_MESH_VERTICES:
+ {
+ DebugRefreshTriangleMeshVertices *d = static_cast< DebugRefreshTriangleMeshVertices *>(prim);
+ d->adjustEndian();
+ }
+ break;
+ }
+}
+
+//********************************************************************
+//********************************************************************
+
+// data structure used to track draw groups. Used internally only.
+struct BlockInfo
+{
+public:
+
+ BlockInfo(void)
+ {
+ mHashValue = 0;
+ mVisibleState = true;
+ mChanged = false;
+ }
+
+ uint32_t getHashValue(void) const
+ {
+ return mHashValue;
+ }
+
+ physx::PxMat44 mPose; // transform for block of data
+ uint32_t mHashValue;
+ bool mVisibleState;
+ bool mChanged; // a semaphore indicating that the state has changed for this block
+};
+
+
+
+// The current render state data block.
+class RenderState
+{
+public:
+
+ RenderState()
+ {
+ mStates = 0;
+ mColor = 0xcfcfcfcf; // needs to be symmetric to be platform independent.
+ mDisplayTime = 0.0001f;
+ mArrowColor = 0x5f5f5f5f; // needs to be symmetric to be platform independent.
+ mOutlineColor = 0xFFFFFFFF;
+ mArrowSize = 0.1f;
+ mRenderScale = 1.0f;
+ mTextScale = 1.0f;
+ mUserId = 0;
+ mPose = NULL;
+ mBlockInfo = NULL;
+ mChangeCount = 0;
+ mCurrentPose = physx::PxMat44(physx::PxIdentity);
+ mTexture1 = 0;
+ mTexture2 = 0;
+ mTileRate1 = 1.0f;
+ mTileRate2 = 1.0f;
+ }
+
+ RenderState(uint32_t s,uint32_t c,float d,uint32_t a,float as,float rs,float ts)
+ {
+ mStates = s;
+ mOutlineColor = 0xFFFFFFFF;
+ mColor = c;
+ mDisplayTime = d;
+ mArrowColor = a;
+ mArrowSize = as;
+ mRenderScale = rs;
+ mTextScale = ts;
+ mUserId = 0;
+ mPose = NULL;
+ mCurrentPose = physx::PxMat44(physx::PxIdentity);
+ mBlockInfo = NULL;
+ mChangeCount = 0;
+ mTexture1 = 0;
+ mTexture2 = 0;
+ mTileRate1 = 1.0f;
+ mTileRate2 = 1.0f;
+ }
+
+ PX_INLINE bool isScreen(void) const { return (mStates & RENDER_DEBUG::DebugRenderState::ScreenSpace); }
+ PX_INLINE bool isUseZ(void) const { return !(mStates & RENDER_DEBUG::DebugRenderState::NoZbuffer); }
+ PX_INLINE bool isSolid(void) const { return (mStates & (RENDER_DEBUG::DebugRenderState::SolidShaded | RENDER_DEBUG::DebugRenderState::SolidWireShaded)) ? true : false; }
+ PX_INLINE bool isClockwise(void) const { return !(mStates & RENDER_DEBUG::DebugRenderState::CounterClockwise); }
+ PX_INLINE bool isWireframeOverlay(void) const { return (mStates & RENDER_DEBUG::DebugRenderState::SolidWireShaded) ? true : false; }
+ PX_INLINE bool isWireframe(void) const
+ {
+ bool ret = true;
+ if ( isSolid() && !isWireframeOverlay() )
+ {
+ ret = false;
+ }
+ return ret;
+ }
+
+ PX_INLINE float getDisplayTime(void) const
+ {
+ return (mStates & RENDER_DEBUG::DebugRenderState::InfiniteLifeSpan) ? PX_MAX_F32 : mDisplayTime;
+ }
+
+ PX_INLINE bool isCentered(void) const { return (mStates & RENDER_DEBUG::DebugRenderState::CenterText) ? true : false; }
+ PX_INLINE bool isCameraFacing(void) const { return (mStates & RENDER_DEBUG::DebugRenderState::CameraFacing) ? true : false; }
+ PX_INLINE bool isCounterClockwise(void) const { return (mStates & RENDER_DEBUG::DebugRenderState::CounterClockwise) ? true : false; }
+ PX_INLINE int32_t getUserId(void) const { return mUserId; }
+
+ PX_INLINE void incrementChangeCount(void) { mChangeCount++; }
+ PX_INLINE uint32_t getChangeCount(void) const { return mChangeCount; }
+
+ PX_INLINE uint32_t setRenderState(RENDER_DEBUG::DebugRenderState::Enum state)
+ {
+ mStates|=state;
+ return mStates;
+ }
+
+ PX_INLINE uint32_t clearRenderState(RENDER_DEBUG::DebugRenderState::Enum state)
+ {
+ mStates&=~state;
+ return mStates;
+ }
+
+ PX_INLINE bool hasRenderState(RENDER_DEBUG::DebugRenderState::Enum state) const
+ {
+ return (state&mStates) ? true : false;
+ }
+
+ PX_INLINE void setCurrentColor(uint32_t c1,uint32_t c2)
+ {
+ mColor = c1;
+ mArrowColor = c2;
+ }
+
+
+ uint32_t mStates;
+ uint32_t mColor;
+ uint32_t mTexture1;
+ float mTileRate1;
+ uint32_t mTexture2;
+ float mTileRate2;
+ float mDisplayTime;
+ uint32_t mArrowColor;
+ uint32_t mOutlineColor;
+ float mArrowSize;
+ float mRenderScale;
+ float mTextScale;
+ uint32_t mChangeCount;
+ int32_t mUserId;
+ BlockInfo *mBlockInfo;
+ physx::PxMat44 *mPose;
+ physx::PxMat44 mCurrentPose;
+};
+
+struct DebugBlockInfo : public DebugPrimitive
+{
+ DebugBlockInfo(void) { }
+ DebugBlockInfo(BlockInfo *info) :
+ DebugPrimitive(DebugCommand::DEBUG_BLOCK_INFO),
+ mInfo(info)
+ {
+ if ( info )
+ {
+ new ( &mCurrentTransform ) DebugSetCurrentTransform(info->mPose);
+ }
+ }
+ BlockInfo *mInfo;
+ DebugSetCurrentTransform mCurrentTransform; // contains the transform for this block; updated each time it changes.
+};
+
+/**
+\brief The maximum number of graphs that can be displayed at one time. (0-5)
+*/
+#define MAX_GRAPHS 6
+/**
+\brief The width of the graphs (x axis) when created automatically
+*/
+#define GRAPH_WIDTH_DEFAULT 0.8f
+/**
+\brief The height of the graphs (y axis) when created automatically
+*/
+#define GRAPH_HEIGHT_DEFAULT 0.4f
+
+/**
+\brief definition of the debugGraph descriptor used to create graphs
+*/
+struct DebugGraphDesc
+{
+ DebugGraphDesc(void)
+ {
+ mPoints = NULL;
+ mGraphXLabel = NULL;
+ mGraphYLabel = NULL;
+ }
+
+
+ /**
+ \brief The number of float data points to graph
+ */
+ uint32_t mNumPoints;
+ /**
+ \brief Pointer to the float data points to graph
+ */
+ const float* mPoints;
+ /**
+ \brief optional cutoff line drawn horizontally on the graph. It should be between 0 and mGraphMax.
+ 0.0f indicates not to draw the cutoff line.
+ */
+ float mCutOffLevel;
+ /**
+ \brief The maximum value that the graph should be be able to display.
+ Noramlly this is slightly larger than the greatest value in the mPoints array to make room for
+ future samples that are higher then the current set.
+ */
+ float mGraphMax;
+ /**
+ \brief The bottom left x coordinate of the graph.
+ This is set automatically by the constructor that takes graphNum as an argument.
+ NOTE: display coordinates range from -1.0f - + 1.0f
+ */
+ float mGraphXPos;
+ /**
+ \brief bottom left y coordinate of the graph.
+ This is set automatically by the constructor that takes graphNum as an argument.
+ NOTE: display coordinates range from -1.0f - + 1.0f
+ */
+ float mGraphYPos;
+ /**
+ \brief The width of the graph.
+ This is set automatically by the constructor that takes graphNum as an argument.
+ NOTE: display coordinates range from -1.0f - + 1.0f
+ */
+ float mGraphWidth;
+ /**
+ \brief The height of the graph.
+ This is set automatically by the constructor that takes graphNum as an argument.
+ NOTE: display coordinates range from -1.0f - + 1.0f
+ */
+ float mGraphHeight;
+ /**
+ \brief The color of the data.
+ This is set automatically by the constructor that takes graphNum as an argument.
+ NOTE: display coordinates range from -1.0f - + 1.0f
+ This is set automatically by the constructor that takes graphNum as an argument.
+ */
+ uint32_t mGraphColor;
+ /**
+ \brief The alternate color of the data if mColorSwitchIndex is set to a value that is a valid
+ index to the mPoints array. The points after mColorSwitchIndex are drawn in this color.
+ This is set automatically by the constructor that takes graphNum as an argument.
+ */
+ uint32_t mArrowColor;
+ /**
+ \brief A pointer to the label for the X axis.
+ */
+ const char* mGraphXLabel;
+ /**
+ \brief A pointer to the label for the Y axis.
+ */
+ const char* mGraphYLabel;
+ /**
+ \brief The (optional!) index in the data set at which to switch the color to the color specified by
+ mArrorColor. By default this is set to -1 indicating that no color switch should be performed.
+ */
+ uint32_t mColorSwitchIndex;
+
+};
+
+
+
+
+
+PX_INLINE uint32_t DebugCommand::getPrimtiveSize(const DebugPrimitive &p)
+{
+ uint32_t ret=0;
+
+ RENDER_DEBUG::DebugCommand::Enum c = static_cast<RENDER_DEBUG::DebugCommand::Enum>(p.mCommand);
+ switch ( c )
+ {
+ case SET_CURRENT_TRANSFORM:
+ ret = sizeof(DebugSetCurrentTransform);
+ break;
+ case DEBUG_SKIP_FRAME:
+ case DEBUG_RESET_INPUT_EVENTS:
+ case SET_CURRENT_COLOR:
+ case SET_CURRENT_RENDER_STATE:
+ case SET_CURRENT_ARROW_COLOR:
+ case SET_CURRENT_USER_ID:
+ case SET_CURRENT_TEXTURE1:
+ case SET_CURRENT_TEXTURE2:
+ ret = sizeof(DebugPrimitiveU32);
+ break;
+ case DEBUG_BOUND:
+ ret = sizeof(DebugBound);
+ break;
+ case SET_CURRENT_TEXT_SCALE:
+ case SET_CURRENT_RENDER_SCALE:
+ case SET_CURRENT_ARROW_SIZE:
+ case SET_CURRENT_TILE1:
+ case SET_CURRENT_TILE2:
+ ret = sizeof(DebugPrimitiveF32);
+ break;
+ case DEBUG_LINE:
+ ret = sizeof(DebugLine);
+ break;
+ case DRAW_GRID:
+ ret = sizeof(DrawGrid);
+ break;
+ case DEBUG_TEXT:
+ ret = sizeof(DebugText);
+ break;
+ case DEBUG_TEXT2D:
+ ret = sizeof(DebugText2D);
+ break;
+ case DEBUG_QUAD:
+ ret = sizeof(DebugQuad);
+ break;
+ case DEBUG_POINT:
+ ret = sizeof(DebugPoint);
+ break;
+ case DEBUG_RECT2D:
+ ret = sizeof(DebugRect2d);
+ break;
+ case DEBUG_GRADIENT_LINE:
+ ret = sizeof(DebugGradientLine);
+ break;
+ case DEBUG_RAY:
+ ret = sizeof(DebugRay);
+ break;
+ case DEBUG_CYLINDER:
+ ret = sizeof(DebugCylinder);
+ break;
+ case DEBUG_CIRCLE:
+ ret = sizeof(DebugCircle);
+ break;
+ case DEBUG_POINT_CYLINDER:
+ ret = sizeof(DebugPointCylinder);
+ break;
+ case DEBUG_THICK_RAY:
+ ret = sizeof(DebugThickRay);
+ break;
+ case DEBUG_PLANE:
+ ret = sizeof(DebugPlane);
+ break;
+ case DEBUG_TRI:
+ ret = sizeof(DebugTri);
+ break;
+ case DEBUG_TRI_NORMALS:
+ ret = sizeof(DebugTriNormals);
+ break;
+ case DEBUG_GRADIENT_TRI:
+ ret = sizeof(DebugGradientTri);
+ break;
+ case DEBUG_GRADIENT_TRI_NORMALS:
+ ret = sizeof(DebugGradientTriNormals);
+ break;
+ case DEBUG_SPHERE:
+ ret = sizeof(DebugSphere);
+ break;
+ case DEBUG_SQUASHED_SPHERE:
+ ret = sizeof(DebugSquashedSphere);
+ break;
+ case DEBUG_CAPSULE:
+ ret = sizeof(DebugCapsule);
+ break;
+ case DEBUG_AXES:
+ ret = sizeof(DebugAxes);
+ break;
+ case DEBUG_ARC:
+ ret = sizeof(DebugArc);
+ break;
+ case DEBUG_THICK_ARC:
+ ret = sizeof(DebugThickArc);
+ break;
+ case DEBUG_DETAILED_SPHERE:
+ ret = sizeof(DebugDetailedSphere);
+ break;
+ case DEBUG_BLOCK_INFO:
+ ret = sizeof(DebugBlockInfo);
+ break;
+ case DEBUG_GRAPH:
+ {
+ const DebugGraphStream *d = static_cast< const DebugGraphStream *>(&p);
+ ret = d->getSize();
+ }
+ break;
+ case DEBUG_CAPSULE_TAPERED:
+ ret = sizeof(DebugTaperedCapsule);
+ break;
+ case DEBUG_POINT_SCALE:
+ ret = sizeof(DebugPointScale);
+ break;
+ case DEBUG_MESSAGE:
+ ret = sizeof(DebugMessage);
+ break;
+ case DEBUG_CREATE_CUSTOM_TEXTURE:
+ ret = sizeof(DebugCreateCustomTexture);
+ break;
+ case DEBUG_FRUSTUM:
+ ret = sizeof(DebugFrustum);
+ break;
+ case DEBUG_CONE:
+ ret = sizeof(DebugCone);
+ break;
+ case DEBUG_REGISTER_INPUT_EVENT:
+ ret = sizeof(DebugRegisterInputEvent);
+ break;
+ case DEBUG_UNREGISTER_INPUT_EVENT:
+ ret = sizeof(DebugUnregisterInputEvent);
+ break;
+ case DEBUG_CREATE_TRIANGLE_MESH:
+ {
+ const DebugCreateTriangleMesh *d = static_cast< const DebugCreateTriangleMesh *>(&p);
+ ret = d->getSize();
+ }
+ break;
+ case DEBUG_RENDER_TRIANGLE_MESH_INSTANCES:
+ {
+ const DebugRenderTriangleMeshInstances *d = static_cast< const DebugRenderTriangleMeshInstances *>(&p);
+ ret = d->getSize();
+ }
+ break;
+ case DEBUG_RENDER_POINTS:
+ {
+ const DebugRenderPoints *d = static_cast< const DebugRenderPoints *>(&p);
+ ret = d->getSize();
+ }
+ break;
+ case DEBUG_CONVEX_HULL:
+ {
+ const DebugConvexHull *d = static_cast< const DebugConvexHull *>(&p);
+ ret = d->getSize();
+ }
+ break;
+ case DEBUG_RENDER_LINES:
+ {
+ const DebugRenderLines *d = static_cast< const DebugRenderLines *>(&p);
+ ret = d->getSize();
+ }
+ break;
+ case DEBUG_RENDER_TRIANGLES:
+ {
+ const DebugRenderTriangles *d = static_cast< const DebugRenderTriangles *>(&p);
+ ret = d->getSize();
+ }
+ break;
+ case DEBUG_RELEASE_TRIANGLE_MESH:
+ ret = sizeof(DebugReleaseTriangleMesh);
+ break;
+ case DEBUG_REFRESH_TRIANGLE_MESH_VERTICES:
+ {
+ const DebugRefreshTriangleMeshVertices *d = static_cast< const DebugRefreshTriangleMeshVertices *>(&p);
+ ret = d->getSize();
+ }
+ break;
+ case DEBUG_LAST:
+ break;
+ default:
+ PX_ALWAYS_ASSERT();
+ ret = 0;
+ break;
+ }
+ return ret;
+}
+
+PX_POP_PACK
+
+} // end of namespace
+
+#endif // RENDER_DEBUG_DATA_H
diff --git a/APEX_1.4/shared/general/RenderDebug/include/RenderDebugImpl.h b/APEX_1.4/shared/general/RenderDebug/include/RenderDebugImpl.h
new file mode 100644
index 00000000..c0f9edb6
--- /dev/null
+++ b/APEX_1.4/shared/general/RenderDebug/include/RenderDebugImpl.h
@@ -0,0 +1,233 @@
+/*
+ * Copyright 2009-2011 NVIDIA Corporation. All rights reserved.
+ *
+ * NOTICE TO USER:
+ *
+ * This source code is subject to NVIDIA ownership rights under U.S. and
+ * international Copyright laws. Users and possessors of this source code
+ * are hereby granted a nonexclusive, royalty-free license to use this code
+ * in individual and commercial software.
+ *
+ * NVIDIA MAKES NO REPRESENTATION ABOUT THE SUITABILITY OF THIS SOURCE
+ * CODE FOR ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR
+ * IMPLIED WARRANTY OF ANY KIND. NVIDIA DISCLAIMS ALL WARRANTIES WITH
+ * REGARD TO THIS SOURCE CODE, INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
+ * IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL,
+ * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
+ * OR PERFORMANCE OF THIS SOURCE CODE.
+ *
+ * U.S. Government End Users. This source code is a "commercial item" as
+ * that term is defined at 48 C.F.R. 2.101 (OCT 1995), consisting of
+ * "commercial computer software" and "commercial computer software
+ * documentation" as such terms are used in 48 C.F.R. 12.212 (SEPT 1995)
+ * and is provided to the U.S. Government only as a commercial end item.
+ * Consistent with 48 C.F.R.12.212 and 48 C.F.R. 227.7202-1 through
+ * 227.7202-4 (JUNE 1995), all U.S. Government End Users acquire the
+ * source code with only those rights set forth herein.
+ *
+ * Any use of this source code in individual and commercial software must
+ * include, in the user documentation and internal comments to the code,
+ * the above Disclaimer and U.S. Government End Users Notice.
+ */
+
+#ifndef RENDER_DEBUG_IMPL_H
+#define RENDER_DEBUG_IMPL_H
+
+/*!
+\file
+\brief debug rendering classes and structures
+*/
+#include "RenderDebugData.h"
+#include "RenderDebugImpl.h"
+#include "RenderDebugTyped.h"
+
+
+namespace RENDER_DEBUG
+{
+
+PX_PUSH_PACK_DEFAULT
+
+
+class RenderDebugHook
+{
+public:
+
+ virtual bool render(float dtime,RENDER_DEBUG::RenderDebugInterface *iface) = 0;
+
+ /**
+ \brief Begins a file-playback session. Returns the number of recorded frames in the recording file. Zero if the file was not valid.
+ */
+ virtual uint32_t setFilePlayback(const char *fileName) = 0;
+
+ /**
+ \brief Set's the file playback to a specific frame. Returns true if successful.
+ */
+ virtual bool setPlaybackFrame(uint32_t playbackFrame) = 0;
+
+ /**
+ \brief Returns the number of recorded frames in the debug render recording file.
+ */
+ virtual uint32_t getPlaybackFrameCount(void) const = 0;
+
+ /**
+ \brief Stops the current recording playback.
+ */
+ virtual void stopPlayback(void) = 0;
+
+ /**
+ \brief Do a 'try' lock on the global render debug mutex. This is simply provided as an optional convenience if you are accessing RenderDebug from multiple threads and want to prevent contention.
+ */
+ virtual bool trylock(void) = 0;
+
+ /**
+ \brief Lock the global render-debug mutex to avoid thread contention.
+ */
+ virtual void lock(void) = 0;
+
+ /**
+ \brief Unlock the global render-debug mutex
+ */
+ virtual void unlock(void) = 0;
+
+ /**
+ \brief Convenience method to return a unique mesh id number (simply a global counter to avoid clashing with other ids
+ */
+ virtual uint32_t getMeshId(void) = 0;
+
+ /**
+ \brief Send a command from the server to the client. This could be any arbitrary console command, it can also be mouse drag events, debug visualization events, etc.
+ * the client receives this command in argc/argv format.
+ */
+ virtual bool sendRemoteCommand(const char *fmt,...) = 0;
+
+ /**
+ \brief If running in client mode, poll this method to retrieve any pending commands from the server. If it returns NULL then there are no more commands.
+ */
+ virtual const char ** getRemoteCommand(uint32_t &argc) = 0;
+
+ /**
+ \brief Transmit an actual input event to the remote client
+
+ \param ev The input event data to transmit
+ */
+ virtual void sendInputEvent(const InputEvent &ev) = 0;
+
+ /**
+ \brief Returns any incoming input event for processing purposes
+ */
+ virtual const InputEvent *getInputEvent(bool flush) = 0;
+
+ /**
+ \brief Report what 'Run' mode we are operation gin.
+ */
+ virtual RenderDebug::RunMode getRunMode(void) = 0;
+
+ /**
+ \brief Returns true if we still have a valid connection to the server.
+ */
+ virtual bool isConnected(void) const = 0;
+
+ /**
+ \brief Returns the current synchronized frame between client/server communications. Returns zero if no active connection exists.
+ */
+ virtual uint32_t getCommunicationsFrame(void) const = 0;
+
+ virtual const char *getRemoteApplicationName(void) = 0;
+
+ /**
+ \brief Returns the optional typed methods for various render debug routines.
+ */
+ virtual RenderDebugTyped *getRenderDebugTyped(void) = 0;
+
+ /**
+ \brief Transmits an arbitrary block of binary data to the remote machine. The block of data can have a command and id associated with it.
+
+ It is important to note that due to the fact the RenderDebug system is synchronized every single frame, it is strongly recommended
+ that you only use this feature for relatively small data items; probably on the order of a few megabytes at most. If you try to do
+ a very large transfer, in theory it would work, but it might take a very long time to complete and look like a hang since it will
+ essentially be blocking.
+
+ \param nameSpace An arbitrary command associated with this data transfer, for example this could indicate a remote file request.
+ \param resourceName An arbitrary id associated with this data transfer, for example the id could be the file name of a file transfer request.
+ \param data The block of binary data to transmit, you are responsible for maintaining endian correctness of the internal data if necessary.
+ \param dlen The length of the lock of data to transmit.
+
+ \return Returns true if the data was queued to be transmitted, false if it failed.
+ */
+ virtual bool sendRemoteResource(const char *nameSpace,
+ const char *resourceName,
+ const void *data,
+ uint32_t dlen) = 0;
+
+
+ /**
+ \brief This function allows you to request a file from the remote machine by name. If successful it will be returned via 'getRemoteData'
+
+ \param nameSpace The command field associated with this request which will be returned by 'getRemoteData'
+ \param resourceName The filename being requested from the remote machine.
+
+ \return Returns true if the request was queued to be transmitted, false if it failed.
+ */
+ virtual bool requestRemoteResource(const char *nameSpace,
+ const char *resourceName) = 0;
+
+
+
+ /**
+ \brief Retrieves a block of remotely transmitted binary data.
+
+ \param nameSpace A a reference to a pointer which will store the namespace (type) associated with this data transfer, for example this could indicate a remote file request.
+ \param resourceName A reference to a pointer which will store the resource name associated with this data transfer, for example the resource name could be the file name of a file transfer request.
+ \param dlen A reference that will contain length of the lock of data received.
+ \param remoteIsBigEndian A reference to a boolean which will be set to true if the remote machine that sent this data is big endian format.
+
+ \retrun A pointer to the block of data received.
+ */
+ virtual const void * getRemoteResource(const char *&nameSpace,
+ const char *&resourceName,
+ uint32_t &dlen,
+ bool &remoteIsBigEndian) = 0;
+
+ /**
+ \brief Set the base file name to record communications tream; or NULL to disable it.
+
+ \param fileName The base name of the file to record the communications channel stream to, or NULL to disable it.
+ */
+ virtual bool setStreamFilename(const char *fileName) = 0;
+
+ /**
+ \brief Begin playing back a communications stream recording
+
+ \param fileName The name of the previously captured communications stream file
+ */
+ virtual bool setStreamPlayback(const char *fileName) = 0;
+
+ /**
+ \brief Release the render debug class
+ */
+ virtual void release(void) = 0;
+protected:
+ virtual ~RenderDebugHook(void) {}
+};
+
+/**
+\brief class that draws debug rendering primitives
+ */
+class RenderDebugImpl : public RenderDebugTyped
+{
+public:
+ virtual bool renderImpl(float dtime,RENDER_DEBUG::RenderDebugInterface *iface) = 0;
+ virtual void releaseRenderDebug(void) = 0;
+protected:
+ virtual ~RenderDebugImpl(void) { }
+};
+
+
+PX_POP_PACK
+
+} // end of namespace
+
+#endif // RENDER_DEBUG_IMPL_H
diff --git a/APEX_1.4/shared/general/RenderDebug/include/StreamIO.h b/APEX_1.4/shared/general/RenderDebug/include/StreamIO.h
new file mode 100644
index 00000000..f2886067
--- /dev/null
+++ b/APEX_1.4/shared/general/RenderDebug/include/StreamIO.h
@@ -0,0 +1,126 @@
+/*
+ * Copyright 2009-2011 NVIDIA Corporation. All rights reserved.
+ *
+ * NOTICE TO USER:
+ *
+ * This source code is subject to NVIDIA ownership rights under U.S. and
+ * international Copyright laws. Users and possessors of this source code
+ * are hereby granted a nonexclusive, royalty-free license to use this code
+ * in individual and commercial software.
+ *
+ * NVIDIA MAKES NO REPRESENTATION ABOUT THE SUITABILITY OF THIS SOURCE
+ * CODE FOR ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR
+ * IMPLIED WARRANTY OF ANY KIND. NVIDIA DISCLAIMS ALL WARRANTIES WITH
+ * REGARD TO THIS SOURCE CODE, INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
+ * IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL,
+ * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
+ * OR PERFORMANCE OF THIS SOURCE CODE.
+ *
+ * U.S. Government End Users. This source code is a "commercial item" as
+ * that term is defined at 48 C.F.R. 2.101 (OCT 1995), consisting of
+ * "commercial computer software" and "commercial computer software
+ * documentation" as such terms are used in 48 C.F.R. 12.212 (SEPT 1995)
+ * and is provided to the U.S. Government only as a commercial end item.
+ * Consistent with 48 C.F.R.12.212 and 48 C.F.R. 227.7202-1 through
+ * 227.7202-4 (JUNE 1995), all U.S. Government End Users acquire the
+ * source code with only those rights set forth herein.
+ *
+ * Any use of this source code in individual and commercial software must
+ * include, in the user documentation and internal comments to the code,
+ * the above Disclaimer and U.S. Government End Users Notice.
+ */
+
+#ifndef STREAM_IO_H
+#define STREAM_IO_H
+
+/*!
+\file
+\brief NsIOStream class
+*/
+#include "Ps.h"
+#include "PsString.h"
+#include "PxFileBuf.h"
+#include <string.h>
+#include <stdlib.h>
+
+#define safePrintf nvidia::string::sprintf_s
+
+PX_PUSH_PACK_DEFAULT
+
+namespace nvidia
+{
+
+/**
+\brief A wrapper class for physx::PxFileBuf that provides both binary and ASCII streaming capabilities
+*/
+class StreamIO
+{
+ static const uint32_t MAX_STREAM_STRING = 1024;
+public:
+ /**
+ \param [in] stream the physx::PxFileBuf through which all reads and writes will be performed
+ \param [in] streamLen the length of the input data stream when de-serializing
+ */
+ StreamIO(physx::PxFileBuf &stream,uint32_t streamLen) : mStreamLen(streamLen), mStream(stream) { }
+ ~StreamIO(void) { }
+
+ PX_INLINE StreamIO& operator<<(bool v);
+ PX_INLINE StreamIO& operator<<(char c);
+ PX_INLINE StreamIO& operator<<(uint8_t v);
+ PX_INLINE StreamIO& operator<<(int8_t v);
+
+ PX_INLINE StreamIO& operator<<(const char *c);
+ PX_INLINE StreamIO& operator<<(int64_t v);
+ PX_INLINE StreamIO& operator<<(uint64_t v);
+ PX_INLINE StreamIO& operator<<(double v);
+ PX_INLINE StreamIO& operator<<(float v);
+ PX_INLINE StreamIO& operator<<(uint32_t v);
+ PX_INLINE StreamIO& operator<<(int32_t v);
+ PX_INLINE StreamIO& operator<<(uint16_t v);
+ PX_INLINE StreamIO& operator<<(int16_t v);
+ PX_INLINE StreamIO& operator<<(const physx::PxVec3 &v);
+ PX_INLINE StreamIO& operator<<(const physx::PxQuat &v);
+ PX_INLINE StreamIO& operator<<(const physx::PxBounds3 &v);
+
+ PX_INLINE StreamIO& operator>>(const char *&c);
+ PX_INLINE StreamIO& operator>>(bool &v);
+ PX_INLINE StreamIO& operator>>(char &c);
+ PX_INLINE StreamIO& operator>>(uint8_t &v);
+ PX_INLINE StreamIO& operator>>(int8_t &v);
+ PX_INLINE StreamIO& operator>>(int64_t &v);
+ PX_INLINE StreamIO& operator>>(uint64_t &v);
+ PX_INLINE StreamIO& operator>>(double &v);
+ PX_INLINE StreamIO& operator>>(float &v);
+ PX_INLINE StreamIO& operator>>(uint32_t &v);
+ PX_INLINE StreamIO& operator>>(int32_t &v);
+ PX_INLINE StreamIO& operator>>(uint16_t &v);
+ PX_INLINE StreamIO& operator>>(int16_t &v);
+ PX_INLINE StreamIO& operator>>(physx::PxVec3 &v);
+ PX_INLINE StreamIO& operator>>(physx::PxQuat &v);
+ PX_INLINE StreamIO& operator>>(physx::PxBounds3 &v);
+
+ uint32_t getStreamLen(void) const { return mStreamLen; }
+
+ physx::PxFileBuf& getStream(void) { return mStream; }
+
+ PX_INLINE void storeString(const char *c,bool zeroTerminate=false);
+
+private:
+ StreamIO& operator=( const StreamIO& );
+
+
+ uint32_t mStreamLen; // the length of the input data stream when de-serializing.
+ physx::PxFileBuf &mStream;
+ char mReadString[MAX_STREAM_STRING]; // a temp buffer for streaming strings on input.
+};
+
+#include "StreamIO.inl" // inline methods...
+
+} // end of nvidia namespace
+
+PX_POP_PACK
+
+#endif // STREAM_IO_H
diff --git a/APEX_1.4/shared/general/RenderDebug/include/StreamIO.inl b/APEX_1.4/shared/general/RenderDebug/include/StreamIO.inl
new file mode 100644
index 00000000..23807b23
--- /dev/null
+++ b/APEX_1.4/shared/general/RenderDebug/include/StreamIO.inl
@@ -0,0 +1,320 @@
+// This code contains NVIDIA Confidential Information and is disclosed to you
+// under a form of NVIDIA software license agreement provided separately to you.
+//
+// Notice
+// NVIDIA Corporation and its licensors retain all intellectual property and
+// proprietary rights in and to this software and related documentation and
+// any modifications thereto. Any use, reproduction, disclosure, or
+// distribution of this software and related documentation without an express
+// license agreement from NVIDIA Corporation is strictly prohibited.
+//
+// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
+// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
+// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
+// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// Information and code furnished is believed to be accurate and reliable.
+// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
+// information or for any infringement of patents or other rights of third parties that may
+// result from its use. No license is granted by implication or otherwise under any patent
+// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
+// This code supersedes and replaces all information previously supplied.
+// NVIDIA Corporation products are not authorized for use as critical
+// components in life support devices or systems without express written approval of
+// NVIDIA Corporation.
+//
+// Copyright (c) 2008-2013 NVIDIA Corporation. All rights reserved.
+
+
+/*
+ * Copyright 2009-2011 NVIDIA Corporation. All rights reserved.
+ *
+ * NOTICE TO USER:
+ *
+ * This source code is subject to NVIDIA ownership rights under U.S. and
+ * international Copyright laws. Users and possessors of this source code
+ * are hereby granted a nonexclusive, royalty-free license to use this code
+ * in individual and commercial software.
+ *
+ * NVIDIA MAKES NO REPRESENTATION ABOUT THE SUITABILITY OF THIS SOURCE
+ * CODE FOR ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR
+ * IMPLIED WARRANTY OF ANY KIND. NVIDIA DISCLAIMS ALL WARRANTIES WITH
+ * REGARD TO THIS SOURCE CODE, INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
+ * IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL,
+ * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
+ * OR PERFORMANCE OF THIS SOURCE CODE.
+ *
+ * U.S. Government End Users. This source code is a "commercial item" as
+ * that term is defined at 48 C.F.R. 2.101 (OCT 1995), consisting of
+ * "commercial computer software" and "commercial computer software
+ * documentation" as such terms are used in 48 C.F.R. 12.212 (SEPT 1995)
+ * and is provided to the U.S. Government only as a commercial end item.
+ * Consistent with 48 C.F.R.12.212 and 48 C.F.R. 227.7202-1 through
+ * 227.7202-4 (JUNE 1995), all U.S. Government End Users acquire the
+ * source code with only those rights set forth herein.
+ *
+ * Any use of this source code in individual and commercial software must
+ * include, in the user documentation and internal comments to the code,
+ * the above Disclaimer and U.S. Government End Users Notice.
+ */
+
+/*!
+\file
+\brief StreamIO inline implementation
+*/
+
+PX_INLINE StreamIO& StreamIO::operator<<(bool v)
+{
+ mStream.storeByte(uint8_t(v));
+ return *this;
+}
+
+
+PX_INLINE StreamIO& StreamIO::operator<<(char c)
+{
+ mStream.storeByte(uint8_t(c));
+ return *this;
+}
+
+PX_INLINE StreamIO& StreamIO::operator<<(uint8_t c)
+{
+ mStream.storeByte(uint8_t(c));
+ return *this;
+}
+
+PX_INLINE StreamIO& StreamIO::operator<<(int8_t c)
+{
+ mStream.storeByte(uint8_t(c));
+ return *this;
+}
+
+PX_INLINE StreamIO& StreamIO::operator<<(const char *c)
+{
+ c = c ? c : ""; // it it is a null pointer, assign it to an empty string.
+ uint32_t len = uint32_t(strlen(c));
+ PX_ASSERT( len < (MAX_STREAM_STRING-1));
+ if ( len > (MAX_STREAM_STRING-1) )
+ {
+ len = MAX_STREAM_STRING-1;
+ }
+ mStream.storeDword(len);
+ if ( len )
+ {
+ mStream.write(c,len);
+ }
+ return *this;
+}
+
+PX_INLINE StreamIO& StreamIO::operator<<(uint64_t v)
+{
+ mStream.storeDouble(static_cast<double>(v));
+ return *this;
+}
+
+PX_INLINE StreamIO& StreamIO::operator<<(int64_t v)
+{
+ mStream.storeDouble(static_cast<double>(v));
+ return *this;
+}
+
+PX_INLINE StreamIO& StreamIO::operator<<(double v)
+{
+ mStream.storeDouble(static_cast<double>(v));
+ return *this;
+}
+
+PX_INLINE StreamIO& StreamIO::operator<<(float v)
+{
+ mStream.storeFloat(v);
+ return *this;
+}
+
+PX_INLINE StreamIO& StreamIO::operator<<(uint32_t v)
+{
+ mStream.storeDword(v);
+ return *this;
+}
+
+PX_INLINE StreamIO& StreamIO::operator<<(int32_t v)
+{
+ mStream.storeDword( uint32_t(v) );
+ return *this;
+}
+
+PX_INLINE StreamIO& StreamIO::operator<<(uint16_t v)
+{
+ mStream.storeWord(v);
+ return *this;
+}
+
+PX_INLINE StreamIO& StreamIO::operator<<(int16_t v)
+{
+ mStream.storeWord( uint16_t(v) );
+ return *this;
+}
+
+
+PX_INLINE StreamIO& StreamIO::operator>>(uint32_t &v)
+{
+ v = mStream.readDword();
+ return *this;
+}
+
+PX_INLINE StreamIO& StreamIO::operator>>(char &v)
+{
+ v = char(mStream.readByte());
+ return *this;
+}
+
+PX_INLINE StreamIO& StreamIO::operator>>(uint8_t &v)
+{
+ v = mStream.readByte();
+ return *this;
+}
+
+PX_INLINE StreamIO& StreamIO::operator>>(int8_t &v)
+{
+ v = int8_t(mStream.readByte());
+ return *this;
+}
+
+PX_INLINE StreamIO& StreamIO::operator>>(int64_t &v)
+{
+ v = mStream.readDword();
+ return *this;
+}
+
+PX_INLINE StreamIO& StreamIO::operator>>(uint64_t &v)
+{
+ v = uint64_t(mStream.readDouble());
+ return *this;
+}
+
+PX_INLINE StreamIO& StreamIO::operator>>(double &v)
+{
+ v = mStream.readDouble();
+ return *this;
+}
+
+PX_INLINE StreamIO& StreamIO::operator>>(float &v)
+{
+ v = mStream.readFloat();
+ return *this;
+}
+
+PX_INLINE StreamIO& StreamIO::operator>>(int32_t &v)
+{
+ v = int32_t(mStream.readDword());
+ return *this;
+}
+
+PX_INLINE StreamIO& StreamIO::operator>>(uint16_t &v)
+{
+ v = mStream.readWord();
+ return *this;
+}
+
+PX_INLINE StreamIO& StreamIO::operator>>(int16_t &v)
+{
+ v = int16_t(mStream.readWord());
+ return *this;
+}
+
+PX_INLINE StreamIO& StreamIO::operator>>(bool &v)
+{
+ int8_t iv;
+ iv = int8_t(mStream.readByte());
+ v = iv ? true : false;
+ return *this;
+}
+
+#define IOSTREAM_COMMA_SEPARATOR
+
+PX_INLINE StreamIO& StreamIO::operator<<(const physx::PxVec3 &v)
+{
+ *this << v.x;
+ IOSTREAM_COMMA_SEPARATOR;
+ *this << v.y;
+ IOSTREAM_COMMA_SEPARATOR;
+ *this << v.z;
+ return *this;
+}
+
+PX_INLINE StreamIO& StreamIO::operator<<(const physx::PxQuat &v)
+{
+ *this << v.x;
+ IOSTREAM_COMMA_SEPARATOR;
+ *this << v.y;
+ IOSTREAM_COMMA_SEPARATOR;
+ *this << v.z;
+ IOSTREAM_COMMA_SEPARATOR;
+ *this << v.w;
+ return *this;
+}
+
+
+PX_INLINE StreamIO& StreamIO::operator<<(const physx::PxBounds3 &v)
+{
+ *this << v.minimum;
+ IOSTREAM_COMMA_SEPARATOR;
+ *this << v.maximum;
+ return *this;
+}
+
+
+
+PX_INLINE StreamIO& StreamIO::operator>>(physx::PxVec3 &v)
+{
+ *this >> v.x;
+ *this >> v.y;
+ *this >> v.z;
+ return *this;
+}
+
+PX_INLINE StreamIO& StreamIO::operator>>(physx::PxQuat &v)
+{
+ *this>>v.x;
+ *this>>v.y;
+ *this>>v.z;
+ *this>>v.w;
+ return *this;
+}
+
+PX_INLINE StreamIO& StreamIO::operator>>(physx::PxBounds3 &v)
+{
+ *this >> v.minimum;
+ *this >> v.maximum;
+ return *this;
+}
+
+PX_INLINE StreamIO& StreamIO::operator>>(const char *&str)
+{
+ str = NULL; // by default no string streamed...
+ uint32_t len=0;
+ *this >> len;
+ PX_ASSERT( len < (MAX_STREAM_STRING-1) );
+ if ( len < (MAX_STREAM_STRING-1) )
+ {
+ mStream.read(mReadString,len);
+ mReadString[len] = 0;
+ str = mReadString;
+ }
+ return *this;
+}
+
+
+PX_INLINE void StreamIO::storeString(const char *c,bool zeroTerminate)
+{
+ while ( *c )
+ {
+ mStream.storeByte(uint8_t(*c));
+ c++;
+ }
+ if ( zeroTerminate )
+ {
+ mStream.storeByte(0);
+ }
+}
diff --git a/APEX_1.4/shared/general/RenderDebug/public/RenderDebug.h b/APEX_1.4/shared/general/RenderDebug/public/RenderDebug.h
new file mode 100644
index 00000000..fcc11e91
--- /dev/null
+++ b/APEX_1.4/shared/general/RenderDebug/public/RenderDebug.h
@@ -0,0 +1,2184 @@
+#ifndef RENDER_DEBUG_H
+#define RENDER_DEBUG_H
+
+#ifdef _MSC_VER
+#ifndef _INTPTR
+#define _INTPTR 0
+#endif
+#endif
+#include <foundation/PxSimpleTypes.h>
+#include <foundation/PxPreprocessor.h>
+
+
+/*!
+\file
+\brief debug rendering classes and structures
+*/
+
+/**
+\brief This defines the version number of the API. If the API changes in anyway, this version number needs to be bumped.
+*/
+#define RENDER_DEBUG_VERSION 1009
+/**
+\brief This defines the version number for the communications layer. If the format or layout of any packets change in a way that will not be backwards compatible, this needs to be bumped
+*/
+#define RENDER_DEBUG_COMM_VERSION 1009
+/**
+\brief The default port number for RenderDebug client/server connections. You can change this if you wish, but you must make sure both your client and server code uses the new port number.
+*/
+#define RENDER_DEBUG_PORT 5525
+
+namespace physx
+{
+ class PxFoundation;
+}
+
+namespace RENDER_DEBUG
+{
+
+/**
+\brief Optional interface which provides typed methods for various routines rather than simply using const float pointers
+*/
+class RenderDebugTyped;
+
+/**
+\brief Enums for debug colors
+ */
+struct DebugColors
+{
+ /**
+ \brief An enumerated list of default color values
+ */
+ enum Enum
+ {
+ Default = 0,
+ PoseArrows,
+ MeshStatic,
+ MeshDynamic,
+ Shape,
+ Text0,
+ Text1,
+ ForceArrowsLow,
+ ForceArrowsNorm,
+ ForceArrowsHigh,
+ Color0,
+ Color1,
+ Color2,
+ Color3,
+ Color4,
+ Color5,
+ Red,
+ Green,
+ Blue,
+ DarkRed,
+ DarkGreen,
+ DarkBlue,
+ LightRed,
+ LightGreen,
+ LightBlue,
+ Purple,
+ DarkPurple,
+ Yellow,
+ Orange,
+ Gold,
+ Emerald,
+ White,
+ Black,
+ Gray,
+ LightGray,
+ DarkGray,
+ NUM_COLORS
+ };
+};
+
+/**
+\brief Enums for pre-defined tiled textures
+ */
+struct DebugTextures
+{
+ /**
+ \brief An enumerated list of default tiled textures
+ */
+ enum Enum
+ {
+ TNULL,
+ IDETAIL01,
+ IDETAIL02,
+ IDETAIL03,
+ IDETAIL04,
+ IDETAIL05,
+ IDETAIL06,
+ IDETAIL07,
+ IDETAIL08,
+ IDETAIL09,
+ IDETAIL10,
+ IDETAIL11,
+ IDETAIL12,
+ IDETAIL13,
+ IDETAIL14,
+ IDETAIL15,
+ IDETAIL16,
+ IDETAIL17,
+ IDETAIL18,
+ WHITE,
+ BLUE_GRAY,
+ BROWN,
+ DARK_RED,
+ GOLD,
+ GRAY,
+ GREEN,
+ INDIGO,
+ LAVENDER,
+ LIGHT_TORQUISE,
+ LIGHT_YELLOW,
+ LIME,
+ ORANGE,
+ PURPLE,
+ RED,
+ ROSE,
+ TORQUISE,
+ YELLOW,
+ WOOD1,
+ WOOD2,
+ SPHERE1,
+ SPHERE2,
+ SPHERE3,
+ SPHERE4,
+ NUM_TEXTURES
+ };
+};
+
+/**
+\brief Predefined InputEventIds; custom ids must be greater than NUM_SAMPLE_FRAMWORK_EVENT_IDS
+ */
+struct InputEventIds
+{
+ enum Enum
+ {
+ // InputEvents used by SampleApplication
+ CAMERA_SHIFT_SPEED = 0,
+ CAMERA_MOVE_LEFT ,
+ CAMERA_MOVE_RIGHT ,
+ CAMERA_MOVE_UP ,
+ CAMERA_MOVE_DOWN ,
+ CAMERA_MOVE_FORWARD ,
+ CAMERA_MOVE_BACKWARD ,
+ CAMERA_SPEED_INCREASE ,
+ CAMERA_SPEED_DECREASE ,
+
+ CAMERA_MOUSE_LOOK ,
+ CAMERA_MOVE_BUTTON ,
+
+ CAMERA_GAMEPAD_ROTATE_LEFT_RIGHT ,
+ CAMERA_GAMEPAD_ROTATE_UP_DOWN ,
+ CAMERA_GAMEPAD_MOVE_LEFT_RIGHT ,
+ CAMERA_GAMEPAD_MOVE_FORWARD_BACK ,
+
+ CAMERA_JUMP ,
+ CAMERA_CROUCH ,
+ CAMERA_CONTROLLER_INCREASE ,
+ CAMERA_CONTROLLER_DECREASE ,
+
+ CAMERA_HOME,
+ NUM_SAMPLE_FRAMEWORK_INPUT_EVENT_IDS
+ };
+};
+
+/**
+\brief Predefined InputIds that you can designate
+ */
+struct InputIds
+{
+ enum Enum
+ {
+ WKEY_UNKNOWN = 0,
+
+ WKEY_DEFINITION_START ,
+
+ WKEY_A ,
+ WKEY_B ,
+ WKEY_C ,
+ WKEY_D ,
+ WKEY_E ,
+ WKEY_F ,
+ WKEY_G ,
+ WKEY_H ,
+ WKEY_I ,
+ WKEY_J ,
+ WKEY_K ,
+ WKEY_L ,
+ WKEY_M ,
+ WKEY_N ,
+ WKEY_O ,
+ WKEY_P ,
+ WKEY_Q ,
+ WKEY_R ,
+ WKEY_S ,
+ WKEY_T ,
+ WKEY_U ,
+ WKEY_V ,
+ WKEY_W ,
+ WKEY_X ,
+ WKEY_Y ,
+ WKEY_Z ,
+
+ WKEY_0 ,
+ WKEY_1 ,
+ WKEY_2 ,
+ WKEY_3 ,
+ WKEY_4 ,
+ WKEY_5 ,
+ WKEY_6 ,
+ WKEY_7 ,
+ WKEY_8 ,
+ WKEY_9 ,
+
+ WKEY_SPACE ,
+ WKEY_RETURN ,
+ WKEY_SHIFT ,
+ WKEY_CONTROL ,
+ WKEY_ESCAPE ,
+ WKEY_COMMA ,
+ WKEY_NUMPAD0 ,
+ WKEY_NUMPAD1 ,
+ WKEY_NUMPAD2 ,
+ WKEY_NUMPAD3 ,
+ WKEY_NUMPAD4 ,
+ WKEY_NUMPAD5 ,
+ WKEY_NUMPAD6 ,
+ WKEY_NUMPAD7 ,
+ WKEY_NUMPAD8 ,
+ WKEY_NUMPAD9 ,
+ WKEY_MULTIPLY ,
+ WKEY_ADD ,
+ WKEY_SEPARATOR ,
+ WKEY_SUBTRACT ,
+ WKEY_DECIMAL ,
+ WKEY_DIVIDE ,
+
+ WKEY_F1 ,
+ WKEY_F2 ,
+ WKEY_F3 ,
+ WKEY_F4 ,
+ WKEY_F5 ,
+ WKEY_F6 ,
+ WKEY_F7 ,
+ WKEY_F8 ,
+ WKEY_F9 ,
+ WKEY_F10 ,
+ WKEY_F11 ,
+ WKEY_F12 ,
+
+ WKEY_TAB ,
+ WKEY_BACKSPACE ,
+ WKEY_PRIOR ,
+ WKEY_NEXT ,
+ WKEY_UP ,
+ WKEY_DOWN ,
+ WKEY_LEFT ,
+ WKEY_RIGHT ,
+ WKEY_HOME,
+
+
+ SCAN_CODE_UP ,
+ SCAN_CODE_DOWN ,
+ SCAN_CODE_LEFT ,
+ SCAN_CODE_RIGHT ,
+ SCAN_CODE_FORWARD ,
+ SCAN_CODE_BACKWARD ,
+ SCAN_CODE_LEFT_SHIFT ,
+ SCAN_CODE_SPACE ,
+ SCAN_CODE_L ,
+ SCAN_CODE_9 ,
+ SCAN_CODE_0 ,
+
+ WKEY_DEFINITION_END ,
+
+ MOUSE_DEFINITION_START ,
+
+ MOUSE_BUTTON_LEFT ,
+ MOUSE_BUTTON_RIGHT ,
+ MOUSE_BUTTON_CENTER ,
+
+ MOUSE_MOVE ,
+
+ MOUSE_DEFINITION_END ,
+
+ GAMEPAD_DEFINITION_START ,
+
+ GAMEPAD_DIGI_UP ,
+ GAMEPAD_DIGI_DOWN ,
+ GAMEPAD_DIGI_LEFT ,
+ GAMEPAD_DIGI_RIGHT ,
+ GAMEPAD_START ,
+ GAMEPAD_SELECT ,
+ GAMEPAD_LEFT_STICK ,
+ GAMEPAD_RIGHT_STICK ,
+ GAMEPAD_NORTH ,
+ GAMEPAD_SOUTH ,
+ GAMEPAD_WEST ,
+ GAMEPAD_EAST ,
+ GAMEPAD_LEFT_SHOULDER_TOP ,
+ GAMEPAD_RIGHT_SHOULDER_TOP ,
+ GAMEPAD_LEFT_SHOULDER_BOT ,
+ GAMEPAD_RIGHT_SHOULDER_BOT ,
+
+ GAMEPAD_RIGHT_STICK_X ,
+ GAMEPAD_RIGHT_STICK_Y ,
+ GAMEPAD_LEFT_STICK_X ,
+ GAMEPAD_LEFT_STICK_Y ,
+
+ GAMEPAD_DEFINITION_END ,
+
+ NUM_KEY_CODES
+
+ };
+};
+
+/**
+\brief State flags for debug renderable
+ */
+struct DebugRenderState
+{
+ /**
+ \brief The enumerated list of debug render state bit flags.
+ */
+ enum Enum
+ {
+ ScreenSpace = (1<<0), //!< true if rendering in screenspace
+ NoZbuffer = (1<<1), //!< true if zbuffering is disabled.
+ SolidShaded = (1<<2), //!< true if rendering solid shaded.
+ SolidWireShaded = (1<<3), //!< Render both as a solid shaded triangle and as a wireframe overlay.
+ CounterClockwise= (1<<4), //!< true if winding order is counter clockwise.
+ CameraFacing = (1<<5), //!< True if text should be displayed camera facing
+ InfiniteLifeSpan = (1<<6), //!< True if the lifespan is infinite (overrides current display time value)
+ CenterText = (1<<7), //!< True if the text should be centered.
+ DoubleSided = (1<<8) //! If true, then triangles should be rendered double sided, back-side uses secondary color
+ };
+};
+
+/**
+\brief Enums for pre-defined render modes for draw axes
+*/
+struct DebugAxesRenderMode
+{
+ /**
+ \brief An enumerated list of render modes for draw axes
+ */
+ enum Enum
+ {
+ DEBUG_AXES_RENDER_SOLID, //!< Render debug axes with huge solid conus as arrows and cylinders as axes
+ DEBUG_AXES_RENDER_LINES, //!< Render debug axes with plane triangles as arrows and lines as axes
+ NUM_DEBUG_AXES_RENDER_MODES
+ };
+};
+/**
+\brief This defines a class which represents a single 3x3 rotation matrix and a float 3 offset position for rendering instanced meshes.
+
+You most follow this exact layout where the first 3 floats represent the position of the instance and the remaining 9 represent
+the 3x3 rotation matrix for a total of 12 floats.
+
+The default constructor initializes the instance to identity
+*/
+class RenderDebugInstance
+{
+public:
+ /**
+ \brief The default constructor for RenderDebugInstance will initialize the class to an identity transform
+ */
+ RenderDebugInstance(void)
+ {
+ mTransform[0] = 0; // The X position
+ mTransform[1] = 0; // The Y position
+ mTransform[2] = 0; // The Z position
+
+ mTransform[3] = 1.0f; // ColumnX of the 3x3
+ mTransform[4] = 0;
+ mTransform[5] = 0;
+
+ mTransform[6] = 0; // ColumnY of the 3x3
+ mTransform[7] = 1.0f;
+ mTransform[8] = 0;
+
+ mTransform[9] = 0; // Column Z of the 3x3
+ mTransform[10] = 0;
+ mTransform[11] = 1.0f;
+
+ }
+ /**
+ \brief a 3x4 matrix (translation + scale/rotation)
+ */
+ float mTransform[12];
+};
+
+/**
+\brief This class defines an extremely simply mesh vertex.
+
+Since the RenderDebug library is limited in scope, the basic mesh vertex is simply a
+position, normal, and a single texture co-ordinate. You cannot choose a texture at
+this time. Currently each mesh is drawn with a default generic noise texture which
+is simply lit.
+*/
+class RenderDebugMeshVertex
+{
+public:
+ /**
+ \brief The world-space position
+ */
+ float mPosition[3];
+ /**
+ \brief The normal vector to use for lighting
+ */
+ float mNormal[3];
+ /**
+ \brief Texture co-ordinates
+ */
+ float mTexel[2];
+};
+
+/**
+\brief This class defines a simply solid shaded vertex without any texture source. This is used for solid shaded debug visualization.
+ */
+class RenderDebugSolidVertex
+{
+public:
+ /**
+ \brief The world-space position
+ */
+ float mPos[3];
+
+ /**
+ \brief The diffuse color as 32 bit ARGB
+ */
+ uint32_t mColor;
+
+ /**
+ \brief The normal vector to use for lighting
+ */
+ float mNormal[3];
+};
+
+/**
+\brief A simple unlit vertex with color but no normal.
+
+These vertices are used for line drawing.
+ */
+class RenderDebugVertex
+{
+public:
+ /**
+ \brief The world-space position
+ */
+ float mPos[3];
+ /**
+ \brief The diffuse color as 32 bit ARGB
+ */
+ uint32_t mColor;
+};
+
+/**
+\brief This enumeration determines how point rendering should be rendered.
+*/
+enum PointRenderMode
+{
+ PRM_WIREFRAME_CROSS, // Render as a small wireframe cross
+ PRM_BILLBOARD, // Render as a small billboard
+ PRM_MESH // Render points as a small low-poly count mesh
+};
+
+
+/**
+The InputEvent class provides a way to retrieve IO status remotely; for keyboard, mouse, and game controller
+*/
+class InputEvent
+{
+public:
+ enum EvenType
+ {
+ ET_DIGITAL,
+ ET_ANALOG,
+ ET_POINTER
+ };
+ InputEvent(void)
+ {
+ mReserved = 0;
+ mId = 0;
+ mEventType = ET_DIGITAL;
+ mSensitivity = 0;
+ mDigitalValue = 0;
+ mAnalogValue = 0;
+ mMouseX = 0;
+ mMouseY = 0;
+ mMouseDX = 0;
+ mMouseDY = 0;
+ mWindowSizeX = 0;
+ mWindowSizeY = 0;
+ mEyePosition[0] = 0;
+ mEyePosition[1] = 0;
+ mEyePosition[2] = 0;
+ mEyeDirection[0] = 0;
+ mEyeDirection[1] = 0;
+ mEyeDirection[2] = 0;
+ mCommunicationsFrame = 0;
+ mRenderFrame = 0;
+ }
+ /**
+ \brief A reserved word use for packet transmission.
+ */
+ uint32_t mReserved;
+ /**
+ \brief The ID associated with this event
+ */
+ uint32_t mId;
+ /**
+ \brief The communications frame number this event was issued
+ */
+ uint32_t mCommunicationsFrame;
+
+ /**
+ \brief The renderframe frame number this event was issued
+ */
+ uint32_t mRenderFrame;
+ /**
+ \brief whether or not this is an analog and digital event, 0 if digital 1 if analog
+ */
+ uint32_t mEventType;
+ /**
+ \brief The sensitivity of this of this input event
+ */
+ float mSensitivity;
+ /**
+ \brief The digital value if this input has a specific value.
+ */
+ int32_t mDigitalValue;
+ /**
+ \brief The analog value if this input has a specific value.
+ */
+ float mAnalogValue;
+ /**
+ \brief The x mouse position
+ */
+ uint32_t mMouseX;
+ /**
+ \brief The y mouse position
+ */
+ uint32_t mMouseY;
+ /**
+ \brief The delta x mouse position (normalized screen space 0-1)
+ */
+ float mMouseDX;
+ /**
+ \brief The delta y mouse position (normalized screen space 0-1)
+ */
+ float mMouseDY;
+ /**
+ \brief The window size X
+ */
+ uint32_t mWindowSizeX;
+ /**
+ \brief The window size Y
+ */
+ uint32_t mWindowSizeY;
+ /**
+ \brief The eye position of the camera
+ */
+ float mEyePosition[3];
+ /**
+ \brief The eye direction of the camera
+ */
+ float mEyeDirection[3];
+};
+
+/**
+\brief This class defines user provided callback interface to actually display the debug rendering output.
+
+If your application is running in client mode, then you do not need to implement this interface as the
+remote DebugView application will render everything for you. However, if you wish to use the RenderDebug interface
+in either local or server mode, you should implement these routines to get the lines and triangles to render.
+ */
+class RenderDebugInterface
+{
+public:
+ /**
+ \brief Implement this method to display lines output from the RenderDebug library
+
+ \param lcount The number of lines to draw (vertex count=lines*2)
+ \param vertices The pairs of vertices for each line segment
+ \param useZ Whether or not these should be zbuffered
+ \param isScreenSpace Whether or not these are in homogeneous screen-space co-ordinates
+ */
+ virtual void debugRenderLines(uint32_t lcount,
+ const RenderDebugVertex *vertices,
+ bool useZ,
+ bool isScreenSpace) = 0;
+
+ /**
+ \brief Implement this method to display solid shaded triangles without any texture surce.
+
+ \param tcount The number of triangles to render. (vertex count=tcount*2)
+ \param vertices The vertices for each triangle
+ \param useZ Whether or not these should be zbuffered
+ \param isScreenSpace Whether or not these are in homogeneous screen-space co-ordinates
+ */
+ virtual void debugRenderTriangles(uint32_t tcount,
+ const RenderDebugSolidVertex *vertices,
+ bool useZ,
+ bool isScreenSpace) = 0;
+ /**
+ \brief Implement this method to display messages which were queued either locally or remotely.
+
+ \param msg A generic informational log message
+ */
+ virtual void debugMessage(const char *msg) = 0;
+
+ /**
+ \brief Render a set of instanced triangle meshes.
+
+ This is an optional callback to implement if your renderer can handle instanced
+ triangle meshes. If you don't implement it, then it will default to doing nothing.
+
+ \param meshId The ID of the previously created triangle mesh
+ \param textureId1 The ID of the primary texture
+ \param textureTile1 The UV tiling rate of the primary texture
+ \param textureId2 The ID of the secondary texture
+ \param textureTile2 The UV tiling rate of the secondary texture
+ \param instanceCount The number of instances to render
+ \param instances The array of poses for each instance
+ */
+ virtual void renderTriangleMeshInstances(uint32_t meshId,
+ uint32_t textureId1,
+ float textureTile1,
+ uint32_t textureId2,
+ float textureTile2,
+ uint32_t instanceCount,
+ const RenderDebugInstance * instances) = 0;
+
+ /**
+ \brief Create a triangle mesh that we can render. Assumes an indexed triangle mesh. User provides a *unique* id. If it is not unique, this will fail.
+
+ This is an method for you to implement if your renderer can handle drawing instanced triangle meshes.
+ If it can, then you take the source mesh provided (which may or may not contain indices) and convert it to whatever you internal mesh format is.
+ Once you have converted into your own internal mesh format, you should use the meshId provided for future reference to it.
+
+ \param meshId The unique mesh ID
+ \param vcount The number of vertices in the triangle mesh
+ \param meshVertices The array of vertices
+ \param tcount The number of triangles (indices must contain tcount*3 values) If zero, assumed to just be a triangle list (3 vertices per triangle, no indices)
+ \param indices The array of triangle mesh indices
+ */
+ virtual void createTriangleMesh(uint32_t meshId,
+ uint32_t vcount,
+ const RenderDebugMeshVertex * meshVertices,
+ uint32_t tcount,
+ const uint32_t * indices) = 0;
+
+ /**
+ \brief Refreshes a subset of the vertices in the previously created triangle mesh; this is primarily designed to be used for real-time updates of heightfield or similar data.
+
+ This is an method for you to implement if your renderer can handle refreshing the vertices in a previously created triangle mesh
+
+ \param meshId The mesh id of the triangle mesh we are refreshing
+ \param vcount The number of vertices to refresh
+ \param refreshVertices The array of vertices to update
+ \param refreshIndices The array of indicices corresponding to which vertices are to be revised.
+ */
+ virtual void refreshTriangleMeshVertices(uint32_t meshId,
+ uint32_t vcount,
+ const RenderDebugMeshVertex * refreshVertices,
+ const uint32_t * refreshIndices) = 0;
+
+
+ /**
+ \brief Release a previously created triangle mesh
+
+ \param meshId The meshId of the previously created triangle mesh.
+ */
+ virtual void releaseTriangleMesh(uint32_t meshId) = 0;
+
+ /**
+ \brief Debug visualize a text string rendered using a simple 2d font.
+
+ \param x The X position of the text in normalized screen space 0 is the left of the screen and 1 is the right of the screen.
+ \param y The Y position of the text in normalized screen space 0 is the top of the screen and 1 is the bottom of the screen.
+ \param scale The scale of the font; these are not true-type fonts, so this is simple sprite scales. A scale of 0.5 is a nice default value.
+ \param shadowOffset The font is displayed with a drop shadow to make it easier to distinguish against the background; a value between 1 to 6 looks ok.
+ \param forceFixWidthNumbers This bool controls whether numeric values are printed as fixed width or not.
+ \param textColor the 32 bit ARGB value color to use for this piece of text.
+ \param textString The string to print on the screen
+ */
+ virtual void debugText2D(float x,
+ float y,
+ float scale,
+ float shadowOffset,
+ bool forceFixWidthNumbers,
+ uint32_t textColor,
+ const char *textString) = 0;
+
+ /**
+ \brief Create a custom texture associated with this name and id number
+
+ \param id The id number to associated with this texture, id must be greater than 28
+ \param textureName The name of the texture associated with this creation call
+ */
+ virtual void createCustomTexture(uint32_t id,const char *textureName) = 0;
+
+ /**
+ \brief Render a set of data points, either as wire-frame cross hairs or as a small solid instanced mesh.
+
+ This callback provides the ability to (as rapidly as possible) render a large number of
+
+ \param mode Determines what mode to render the point data
+ \param meshId The ID of the previously created triangle mesh if rendering in mesh mode
+ \param pointColor The color to render the points with, based on the current arrow color in the render state.
+ \param pointScale The scale of the points, based on the arrow size in the current render state.
+ \param textureId1 The ID of the primary texture
+ \param textureTile1 The UV tiling rate of the primary texture
+ \param textureId2 The ID of the secondary texture
+ \param textureTile2 The UV tiling rate of the secondary texture
+ \param pointCount The number of points to render
+ \param points The array of points to render
+ */
+ virtual void debugPoints(PointRenderMode mode,
+ uint32_t meshId,
+ uint32_t pointColor,
+ float pointScale,
+ uint32_t textureId1,
+ float textureTile1,
+ uint32_t textureId2,
+ float textureTile2,
+ uint32_t pointCount,
+ const float *points) = 0;
+
+ /**
+ \brief register a digital input event (maps to windows keyboard commands)
+
+ \param eventId The eventId for this input event; if it is a custom event it must be greater than NUM_SAMPLE_FRAMEWORK_INPUT_EVENT_IDS
+ \param inputId This the pre-defined keyboard code for this input event.
+ */
+ virtual void registerDigitalInputEvent(InputEventIds::Enum eventId,InputIds::Enum inputId) = 0;
+
+ /**
+ \brief register a digital input event (maps to windows keyboard commands)
+
+ \param eventId The eventId for this input event; if it is a custom event it must be greater than NUM_SAMPLE_FRAMEWORK_INPUT_EVENT_IDS
+ \param sensitivity The sensitivity value associated with this anaglog devent; default value is 1.0
+ \param inputId This the pre-defined analog code for this input event.
+ */
+ virtual void registerAnalogInputEvent(InputEventIds::Enum eventId,float sensitivity,InputIds::Enum inputId) = 0;
+
+ /**
+ \brief unregister a previously registered input event.
+
+ \param eventId The id of the previously registered input event.
+ */
+ virtual void unregisterInputEvent(InputEventIds::Enum eventId) = 0;
+
+ /**
+ \brief Reset all input events to an empty state
+ */
+ virtual void resetInputEvents(void) = 0;
+
+protected:
+ virtual ~RenderDebugInterface(void)
+ {
+
+ }
+};
+
+/**
+\brief optional default value for a namespace representing a file request
+*/
+#define PX_FILE_REQUEST_NAMESPACE "PxFileRequest"
+
+/**
+\brief This is an optional pure virtual interface if you wish to provide the ability to retrieve remote resource requests. Typically only implemented for servers.
+*/
+class RenderDebugResource
+{
+public:
+ /**
+ \brief Optional callback to allow the application to load a named resource.
+
+ You do not have to implement this if you do not wish. It is required for the ability to request a resource remotely.
+
+ \param nameSpace The namespace (type) of resource being requested.
+ \param resourceName The name of the source begin requested
+ \param len The length of the requested resource returned.
+
+ \return Returns the pointer to the resource.
+ */
+ virtual const void *requestResource(const char * nameSpace,const char * resourceName,uint32_t &len) = 0;
+
+ /**
+ \brief This method is called when the resource is no longer needed and the application can free up any memory associated with it.
+
+ \param data The resource data that was returned by a previous call to 'requestResource'
+ \param len The length of the resource data
+ \param nameSpace The namespace (type) of data
+ \param resourceName The name of the source
+
+ \return Returns false if this was an unexpected release call.
+ */
+ virtual bool releaseResource(const void *data,uint32_t len,const char *nameSpace,const char *resourceName) = 0;
+protected:
+ /**
+ \brief Default destructor declaration
+ */
+ virtual ~RenderDebugResource(void)
+ {
+
+ }
+};
+
+/**
+\brief This is the main RenderDebug base class which provides all debug visualization services.
+
+This interface uses standard C99 data types (uint32_t, float, etc.) so that it has no other
+dependencies on any specific math library type.
+
+There is an optional 'type safe' interface which accepts the NVIDIA foundation math types such as
+PxVec3, PxMat44, PxQuat, etc.
+
+If you are using the NVIDIA foundation math types you can avoid having to cast inputs to const float pointers
+by retrieving the RenderDebugTyped interface, declared in RenderDebugTyped.h, and using the method 'getRenderDebugTyped' on the base class.
+ */
+class RenderDebug
+{
+public:
+ /**
+ \brief This enumeration defines the mode and behavior for how the RenderDebug library is to be created.
+ */
+ enum RunMode
+ {
+ RM_SERVER, // running as a server; there can only be one server active at a time
+ RM_CLIENT, // This is a client which intends to get rendering services from a server; if the server is not found then no connection is created.
+ RM_LOCAL, // Just uses the render-debug library for rendering only; disables all client/server communications; just lets an app use it as a debug renderer.
+ RM_CLIENT_OR_FILE, // Runs as a client which connects to a server (if found) or, if no server found, then writes the output to a file that the server can later load and replay
+ RM_FILE // Runs *only* as a file; never tries to connect to a server.
+ };
+
+
+ /**
+ \brief This is an optional, but highly recommended, callback when connection to the remote DebugView application.
+
+ The client application can (and probably should) provide this callback to deal with long waits from the server.
+ For remote connections there can be long stalls waiting for the server to have received the debug visualization data and send back the acknowledge.
+ To prevent the application from looking like it us hung, this callback gives it a chance to abort the connection.
+ This callback will pass in the number of milliseconds that you have been waiting for the sever to respond. If you return true, then it will keep waiting.
+ If you return false, it will disconnect from the server and stop trying.
+
+ */
+ class ServerStallCallback
+ {
+ public:
+ /**
+ \brief A callback to the client application to indicate that the client is stalled waiting for an acknowledge from the server.
+
+ \param ms This is the number of milliseconds that the client has been waiting for a response from the server.
+ \return If you return true, then the client will contain to wait for a response from the server. If you return false it will close the connection.
+ */
+ virtual bool continueWaitingForServer(uint32_t ms) = 0;
+ protected:
+ /**
+ \brief The default protected virtual destructor
+ */
+ virtual ~ServerStallCallback(void)
+ {
+
+ }
+ };
+
+ /**
+ \brief A class to use when loading the DLL and initializing the RenderDebug library initial state.
+ */
+ class Desc
+ {
+ public:
+ Desc(void)
+ {
+ // default name; you should assign this based on your build configuration x86 or x64
+ // and use debug if you want to debug at the source level. Also, if your DLL isn't
+ // in the current working directory; you can use a fully qualified path name here.
+ dllName = "RenderDebug_x86.dll";
+ versionNumber = RENDER_DEBUG_VERSION;
+ runMode = RM_LOCAL;
+ recordFileName = NULL; //"RenderDebug.rec";
+ errorCode = 0;
+ foundation = 0;
+ echoFileLocally = false;
+ hostName = "localhost";
+ portNumber = RENDER_DEBUG_PORT;
+ maxServerWait = 1000*60; // If we don't get an ack from the server for 60 seconds, then we disconnect.
+ serverStallCallback = 0; // This is an optional, but highly recommended, callback to the application notifying it that it is stalled waiting for the server. The user can provide a way to escape cleanly so the application doesn't look like it is in a hung state.
+ applicationName = "GenericApplication";
+ streamFileName = 0;
+ renderDebugResource = 0;
+ recordRemoteCommands = 0;
+ playbackRemoteCommands = 0;
+ }
+ /**
+ \brief Name of the render-debug DLL to load. (only valid for windows, other platforms simply link in the library)
+ */
+ const char *dllName;
+
+ /**
+ \brief used to give feedback regarding connection status and registry settings for user-interface values.
+ */
+ const char *applicationName;
+
+ /**
+ \brief expected version number; if not equal then the DLL won't load.
+ */
+ uint32_t versionNumber;
+ /**
+ \brief startup mode indicating if we are running as a client or a server and with what connection options.
+ */
+ RunMode runMode;
+
+ /**
+ \brief If running in 'file' mode, this is the name of the file on disk the data will be rendering data will be recorded to.
+ */
+ const char *recordFileName;
+
+ /**
+ \brief If it failed to create the render-debug system; this will contain a string explaining why.
+ */
+ const char *errorCode;
+
+ /**
+ \brief If recording to a file, do we also want to echo the debugging commands locally (for both local render *and* record file at the same time).
+ */
+ bool echoFileLocally;
+
+ /**
+ \brief Name of the host to use for TCP/IP connections.
+ */
+ const char *hostName;
+
+ /**
+ \brief The port number to connect to, the default port is 5525
+ */
+ uint16_t portNumber;
+
+ /**
+ \brief The maximum number of milliseconds to wait for the server to respond for giving up and closing the connection.
+ */
+ uint32_t maxServerWait;
+ /**
+ \brief This is an optional, but highly recommended, callback to the application notifying it that it is stalled waiting for the server. The user can provide a way to escape cleanly so the application doesn't look like it is in a hung state.
+ */
+
+ ServerStallCallback *serverStallCallback;
+ /**
+ \brief This is an optional callback interface to request named resources from the application. Should be implemented if you want to request by name resources remotely.
+ */
+ RenderDebugResource *renderDebugResource;
+
+ /**
+ \brief This is a pointer to foundation which should be created before RenderDebug creation
+ */
+ physx::PxFoundation *foundation;
+
+ /**
+ \brief This is an optional filename to record all commands received from the remote connection. This is a debugging feature only.
+ */
+ const char *recordRemoteCommands;
+
+ /**
+ \brief This is an optional filename to play back previously recorded remote commands; if this file is found then these commands will be streamed back in the same order they were recorded
+ */
+ const char *playbackRemoteCommands;
+
+ /**
+ \brief This is an optional filename to record all communications from the client to a stream file on disk which can later be played back. Will be appended with a connection # and postfix of .nvcs
+ */
+ const char *streamFileName;
+ };
+
+ //***********************************************************************************
+ //** State Management
+ //***********************************************************************************
+
+ /**
+ \brief Push the current render state on the stack
+
+ For speed and efficiency, the RenderDebug library uses a state-stack which can easily be pushed and popped on and off a stack.
+ This prevents the user from having to pass in a huge amount of state with every single primitive call. For example, rather than having
+ to pass the color of a triangle each time you call 'debugTri', instead you set the current render state color and from that point forward
+ all 'drawTri' calls will use the currently selected color. You can push and pop the renderstate to make sure that you leave the state unchanged
+ when making recursive calls to routines. Pushing and popping the render state is very fast and inexpensive to peform.
+
+ The render-state includes a variety of flags which control not only the current color but whether things should be drawn in wireframe, or solid, or solid with wireframe outline
+
+ */
+ virtual void pushRenderState(void) = 0;
+
+ /**
+ \brief Pops the last render state off the stack.
+ */
+ virtual void popRenderState(void) = 0;
+
+ /**
+ \brief Set the current primary and secondary draw colors
+
+ \param color This is the main draw color as a 32 bit ARGB value
+ \param arrowColor This is the secondary color, used for primitives which have two colors, like a ray with an arrow head, or a double sided triangle, or a solid shaded triangle with a wireframe outline.
+ */
+ virtual void setCurrentColor(uint32_t color=0xFFFFFF,uint32_t arrowColor=0xFF0000) = 0;
+
+ /**
+ \brief Gets the current primary draw color
+
+ \return Returns the current primary color
+ */
+ virtual uint32_t getCurrentColor(void) const = 0;
+
+ /**
+ \brief Set the current debug texture
+
+ \param textureEnum1 Which predefined texture to use as the primary texture
+ \param tileRate1 The tiling rate to use for the primary texture
+ \param textureEnum2 Which (optional) predefined texture to use as the primary texture
+ \param tileRate2 The tiling rate to use for the secondary texture
+ */
+ virtual void setCurrentTexture(DebugTextures::Enum textureEnum1,
+ float tileRate1,
+ DebugTextures::Enum textureEnum2,
+ float tileRate2) = 0;
+
+ /**
+ \brief Gets the current debug primary texture
+
+ \return The current texture id of the primary texture
+ */
+ virtual DebugTextures::Enum getCurrentTexture1(void) const = 0;
+
+ /**
+ \brief Gets the current debug secondary texture
+
+ \return The current texture id of the secondary texture
+ */
+ virtual DebugTextures::Enum getCurrentTexture2(void) const = 0;
+
+ /**
+ \brief Gets the current tiling rate of the primary texture
+
+ \return The current tiling rate of the primary texture
+ */
+ virtual float getCurrentTile1(void) const = 0;
+
+ /**
+ \brief Gets the current tiling rate of the secondary texture
+
+ \return The current tiling rate of the secondary texture
+ */
+ virtual float getCurrentTile2(void) const = 0;
+ /**
+ \brief Create a debug texture based on a filename
+
+ \param id The id associated with this custom texture, must be greater than 28; the reserved ids for detail textures
+ \param fname The name of the DDS file associated with this texture.
+ */
+ virtual void createCustomTexture(uint32_t id,const char *fname) = 0;
+
+ /**
+ \brief Get the current secondary draw color (typically used for the color of arrow head, or the color for wire-frame outlines.
+
+ \return Returns the current secondary color
+ */
+ virtual uint32_t getCurrentArrowColor(void) const = 0;
+
+ /**
+ \brief Sets a general purpose user id which is preserved by the renderstate stack
+
+ \param userId Sets a current arbitrary userId which is preserved on the state stack
+ */
+ virtual void setCurrentUserId(int32_t userId) = 0;
+
+ /**
+ \brief Gets the current user id
+
+ \return Returns the current user id
+ */
+ virtual int32_t getCurrentUserId(void) = 0;
+
+ /**
+ \brief Set the current display time, this is the duration/lifetime of any draw primitives
+
+ One important feature of the RenderDebug library is that you can specify how long you want a debug visualization primitive to display.
+ This is particularly useful for transient events like contacts or raycast results which typically only happen on one frame. If you draw these
+ contacts they will show up and disappear so quickly they can be impossible to see. Using this feature if you specify a current display time of
+ say, for example, two seconds, then the contact will stay on the screen long enough for you to see. Of course you should be careful with this feature
+ as it can cause huge quantities of draw calls to get stacked up over long periods of time. It should be reserved for discrete transient events.
+
+ \param displayTime This is the current duration/lifetime of any draw primitive.
+ */
+ virtual void setCurrentDisplayTime(float displayTime=0.0001f) = 0;
+
+ /**
+ \brief Get the current global debug rendering scale
+
+ \return Returns the global rendering scale
+ */
+ virtual float getRenderScale(void) = 0;
+
+ /**
+ \brief Set the current global debug rendering scale.
+
+ /param scale The global rendering scale to apply to all outputs from the render debug library before it shows up on screen.
+ */
+ virtual void setRenderScale(float scale) = 0;
+
+ /**
+ \brief Set the complete current set of RENDER_DEBUG::DebugRenderState bits explicitly.
+
+ /param states Rather than setting and clearing individual DebugRenderState flags, this method can just set them all to a specific set of values ored together.
+ */
+ virtual void setCurrentState(uint32_t states=0) = 0;
+
+ /**
+ \brief Add a bit to the current render state.
+
+ /param state Enables a particular DebugRenderState flag
+ */
+ virtual void addToCurrentState(RENDER_DEBUG::DebugRenderState::Enum state) = 0; // OR this state flag into the current state.
+
+ /**
+ \brief Clear a bit from the current render state.
+
+ /param state Disables a particular DebugRenderState flag
+ */
+ virtual void removeFromCurrentState(RENDER_DEBUG::DebugRenderState::Enum state) = 0; // Remove this bit flat from the current state
+
+ /**
+ \brief Set the current scale for 3d text
+
+ /param testScale Sets the current scale to apply to 3d printed text
+ */
+ virtual void setCurrentTextScale(float textScale) = 0;
+
+ /**
+ \brief Set the current arrow head size for rays and other pointer style primitives
+
+ /param arrowSize Set's the current default size for arrow heads.
+ */
+ virtual void setCurrentArrowSize(float arrowSize) = 0;
+
+ /**
+ \brief Get the current RENDER_DEBUG::DebugRenderState bit fields.
+
+ \return Returns the compute set of render state bites.
+ */
+ virtual uint32_t getCurrentState(void) const = 0;
+
+ /**
+ \brief Set the entire render state in one call rather than doing discrete calls one a time.
+
+ \param states combination of render state flags
+ \param color base color duration of display items.
+ \param displayTime secondary color, usually used for arrow head
+ \param arrowColor The size of arrow heads
+ \param arrowSize The global render scale
+ \param renderScale The global scale for debug visualization output
+ \param textScale The current scale for 3d text
+ */
+ virtual void setRenderState(uint32_t states=0,
+ uint32_t color=0xFFFFFF,
+ float displayTime=0.0001f,
+ uint32_t arrowColor=0xFF0000,
+ float arrowSize=0.1f,
+ float renderScale=1.0f,
+ float textScale=1.0f) = 0;
+
+
+ /**
+ \brief Get the entire current render state. Return the RENDER_DEBUG::DebugRenderState
+
+ \param color Primary color
+ \param displayTime display time
+ \param arrowColor Secondary color
+ \param arrowSize Arrow size
+ \param renderScale Global render scale
+ \param textScale Global text scale
+ */
+ virtual uint32_t getRenderState(uint32_t &color,
+ float &displayTime,
+ uint32_t &arrowColor,
+ float &arrowSize,
+ float &renderScale,
+ float &textScale) const = 0;
+
+
+ /**
+ \brief Sets the global pose for the current debug-rendering context. This is preserved on the state stack.
+
+ \param pose Sets the current global pose for the RenderDebug context, all draw commands will be transformed by this root pose. Default is identity.
+ */
+ virtual void setPose(const float pose[16]) = 0;
+
+ /**
+ \brief Sets the global pose for the current debug-rendering context. This is preserved on the state stack.
+
+ \param pos Sets the translation component
+ \param quat Sets the rotation component as a quat
+ */
+ virtual void setPose(const float pos[3],const float quat[4]) = 0;
+
+ /**
+ \brief Sets the global pose position only, does not change the rotation.
+
+ \param pos Sets the translation component
+ */
+ virtual void setPosition(const float pos[3]) = 0;
+
+ /**
+ \brief Sets the global pose orientation only, does not change the position
+
+ \param quat Sets the orientation of the global pose
+ */
+ virtual void setOrientation(const float quat[3]) = 0;
+
+ /**
+ \brief Sets the global pose back to identity
+ */
+ virtual void setIdentityPose(void) = 0;
+
+ /**
+ \brief Gets the global pose for the current debug rendering context as a 4x4 transform
+
+ \return Returns the current global pose for the RenderDebug
+ */
+ virtual const float * getPose(void) const = 0;
+
+
+ //***********************************************************************************
+ //** Lines and Triangles
+ //***********************************************************************************
+
+ /**
+ \brief Draw a grid visualization.
+ \param zup Whether the grid is drawn relative to a z-up axis or y-up axis, y-up axis is the default.
+ \param gridSize This is the size of the grid.
+ */
+ virtual void drawGrid(bool zup=false,
+ uint32_t gridSize=40) = 0; // draw a grid.
+
+
+ /**
+ \brief Draw a 2d rectangle in homogeneous screen-space coordinates.
+
+ /param x1 Upper left of 2d rectangle
+ /param y1 Top of 2d rectangle
+ /param x2 Lower right of 2d rectangle
+ /param y2 Bottom of 2d rectangle
+ */
+ virtual void debugRect2d(float x1,
+ float y1,
+ float x2,
+ float y2) = 0;
+
+ /**
+ \brief Draw a polygon; 'points' is an array of 3d vectors.
+
+ \param pcount The number of data points in the polygon.
+ \param points The array of Vec3 points comprising the polygon boundary
+ */
+ virtual void debugPolygon(uint32_t pcount,
+ const float *points) = 0;
+
+ /**
+ \brief Draw a single line using the current color state
+
+ \param p1 Starting position
+ \param p2 Line end position
+ */
+ virtual void debugLine(const float p1[3],
+ const float p2[3]) = 0;
+
+ /**
+ \brief Draw a gradient line (different start color from end color)
+
+ \param p1 The starting location of the line in 3d
+ \param p2 The ending location of the line in 3d
+ \param c1 The starting color as a 32 bit ARGB format
+ \param c2 The ending color as a 32 bit ARGB format
+ */
+ virtual void debugGradientLine(const float p1[3],
+ const float p2[3],
+ const uint32_t &c1,
+ const uint32_t &c2) = 0;
+
+ /**
+ \brief Draws a wireframe line with a small arrow head pointing along the direction vector ending at P2
+
+ \param p1 The start of the ray
+ \param p2 The end of the ray, where the arrow head will appear
+ */
+ virtual void debugRay(const float p1[3],
+ const float p2[3]) = 0;
+
+
+ /**
+ \brief Creates a debug visualization of a 'thick' ray. Extrudes a cylinder visualization with a nice arrow head.
+
+ \param p1 Starting point of the ray
+ \param p2 Ending point of the ray
+ \param raySize The thickness of the ray, the arrow head size is used for the arrow head.
+ \param arrowTip Whether or not the arrow tip should appear, by default this is true.
+ */
+ virtual void debugThickRay(const float p1[3],
+ const float p2[3],
+ float raySize=0.02f,
+ bool arrowTip=true) = 0;
+
+
+ /**
+ \brief Debug visualize a 3d triangle using the current render state flags
+
+ \param p1 First point in the triangle
+ \param p2 Second point in the triangle
+ \param p3 The third point in the triangle
+ */
+ virtual void debugTri(const float p1[3],
+ const float p2[3],
+ const float p3[3]) = 0;
+
+ /**
+ \brief Debug visualize a 3d triangle with provided vertex lighting normals.
+
+ \param p1 First point in the triangle
+ \param p2 Second point in the triangle
+ \param p3 The third point in the triangle
+ \param n1 First normal in the triangle
+ \param n2 Second normal in the triangle
+ \param n3 The third normal in the triangle
+ */
+ virtual void debugTriNormals(const float p1[3],
+ const float p2[3],
+ const float p3[3],
+ const float n1[3],
+ const float n2[3],
+ const float n3[3]) = 0;
+
+ /**
+ \brief Debug visualize a 3d triangle with a unique color at each vertex.
+
+ \param p1 First point in the triangle
+ \param p2 Second point in the triangle
+ \param p3 The third point in the triangle
+ \param c1 The color of the first vertex
+ \param c2 The color of the second vertex
+ \param c3 The color of the third vertex
+ */
+ virtual void debugGradientTri(const float p1[3],
+ const float p2[3],
+ const float p3[3],
+ const uint32_t &c1,
+ const uint32_t &c2,
+ const uint32_t &c3) = 0;
+
+ /**
+ \brief Debug visualize a 3d triangle with provided vertex normals and colors
+
+ \param p1 First point in the triangle
+ \param p2 Second point in the triangle
+ \param p3 The third point in the triangle
+ \param n1 First normal in the triangle
+ \param n2 Second normal in the triangle
+ \param n3 The third normal in the triangle
+ \param c1 The color of the first vertex
+ \param c2 The color of the second vertex
+ \param c3 The color of the third vertex
+ */
+ virtual void debugGradientTriNormals(const float p1[3],
+ const float p2[3],
+ const float p3[3],
+ const float n1[3],
+ const float n2[3],
+ const float n3[3],
+ const uint32_t &c1,
+ const uint32_t &c2,
+ const uint32_t &c3) = 0;
+
+ /**
+ \brief Debug visualize a simple point as a small cross
+
+ \param pos The position of the point
+ \param radius The size of the point visualization.
+ */
+ virtual void debugPoint(const float pos[3],
+ float radius) = 0;
+
+ /**
+ \brief Debug visualize a simple point with provided independent scale on the X, Y, and Z axis
+
+ \param pos The position of the point
+ \param scale The X/Y/Z scale of the crosshairs.
+ */
+ virtual void debugPoint(const float pos[3],
+ const float scale[3]) = 0;
+
+ /**
+ \brief Debug visualize an arc as a line with an arrow head at the end.
+
+ \param center The center of the arc
+ \param p1 The starting position of the arc
+ \param p2 The ending position of the arc
+ \param arrowSize The size of the arrow head for the arc.
+ \param showRoot Whether or not to debug visualize the center of the arc
+ */
+ virtual void debugArc(const float center[3],
+ const float p1[3],
+ const float p2[3],
+ float arrowSize=0.1f,
+ bool showRoot=false) = 0;
+
+ /**
+ \brief Debug visualize a thick arc
+
+ \param center The center of the arc
+ \param p1 The starting position of the arc
+ \param p2 The ending position of the arc
+ \param thickness The thickness of the cylinder drawn along the arc
+ \param showRoot Whether or not to debug visualize the center of the arc
+ */
+ virtual void debugThickArc(const float center[3],
+ const float p1[3],
+ const float p2[3],
+ float thickness=0.02f,
+ bool showRoot=false) = 0;
+
+
+ //***********************************************************************************
+ //** Shapes
+ //***********************************************************************************
+
+ /**
+ \brief Create a debug visualization of a cylinder from P1 to P2 with radius provided.
+
+ \param p1 The starting point of the cylinder
+ \param p2 The ending point of the cylinder
+ \param radius The radius of the cylinder
+ */
+ virtual void debugCylinder(const float p1[3],
+ const float p2[3],
+ float radius) = 0;
+
+ /**
+ \brief Creates a debug visualization of a plane equation as a couple of concentric circles
+
+ \param normal The normal of the plane equation
+ \param dCoff The d plane co-efficient of the plane equation
+ \param radius1 The inner radius of the plane visualization
+ \param radius2 The outer radius of the plane visualization
+ */
+ virtual void debugPlane(const float normal[3],
+ float dCoff,
+ float radius1,
+ float radius2) = 0;
+
+ /**
+ \brief Debug visualize a 3d bounding box using the current render state.
+
+ \param bmin The minimum X,Y,Z of the AABB
+ \param bmax the maximum extent of the AABB
+ */
+ virtual void debugBound(const float bmin[3],const float bmax[3]) = 0;
+
+ /**
+ \brief Debug visualize a crude sphere using the current render state settings.
+
+ \param pos The center of the sphere
+ \param radius The radius of the sphere.
+ \param subdivision The detail level of the sphere, should not be less than 1 or more than 4
+ */
+ virtual void debugSphere(const float pos[3],
+ float radius,
+ uint32_t subdivision=2) = 0;
+
+ /**
+ \brief Debug visualize a capsule relative to the currently set pose
+
+ \param radius The radius of the capsule
+ \param height The height of the capsule
+ \param subdivision The number of subdivisions for the approximation, keep this very small. Like 2 or 3.
+ */
+ virtual void debugCapsule(float radius,
+ float height,
+ uint32_t subdivision=2) = 0;
+
+ /**
+ \brief Debug visualize a tapered capsule relative to the currently set pose
+
+ \param radius1 The start radius
+ \param radius2 The end radius
+ \param height The height
+ \param subdivision The number of subdivisions, keep it small; 2 or 3
+ */
+ virtual void debugCapsuleTapered(float radius1,
+ float radius2,
+ float height,
+ uint32_t subdivision=2) = 0;
+
+ /**
+ \brief Debug visualize a cylinder relative to the currently set pose
+
+ \param radius The radius of the cylinder
+ \param height The height
+ \param closeSides Whether or not the ends of the cylinder should be capped.
+ \param subdivision The approximation subdivision (keep it small)
+
+ */
+ virtual void debugCylinder(float radius,
+ float height,
+ bool closeSides,
+ uint32_t subdivision=2) = 0;
+
+ /**
+ \brief Debug visualize a circle relative to the currently set pose
+
+ \param center The center of the circle
+ \param radius The radius of the circle
+ \param subdivision The number of subdivisions
+ */
+ virtual void debugCircle(const float center[3],
+ float radius,
+ uint32_t subdivision=2) = 0;
+
+ /**
+ \brief Debug visualize a cone relative to the currently set pose
+
+ \param length The length of the cone
+ \param innerAngle The inner angle of the cone (in radians)
+ \param outerAngle The outer angle of the cone (in radians)
+ \param stepCount The number of sub-steps when drawing the cone
+ \param closeEnd Whether or not to close up the bottom of the cone
+
+ */
+ virtual void debugCone(float length,float innerAngle,float outerAngle,uint32_t stepCount,bool closeEnd) = 0;
+
+
+ //***********************************************************************************
+ //** Matrix visualization
+ //***********************************************************************************
+
+ /**
+ \brief Debug visualize a view*projection matrix frustum.
+
+ \param viewMatrix The view matrix of the frustm
+ \param projMatrix The projection matrix of the frustm
+ */
+ virtual void debugFrustum(const float viewMatrix[16],const float projMatrix[16]) = 0;
+
+ /**
+ \brief Debug visualize a 4x4 transform.
+
+ \param transform The matrix we are trying to visualize
+ \param distance The size of the visualization
+ \param brightness The brightness of the axes
+ \param showXYZ Whether or not to print 3d text XYZ labels
+ \param showRotation Whether or not to visualize rotation or translation axes
+ \param axisSwitch Which axis is currently selected/highlighted.
+ \param renderMode How render axes of 4x4 transform
+ */
+ virtual void debugAxes(const float transform[16],
+ float distance=0.1f,
+ float brightness=1.0f,
+ bool showXYZ=false,
+ bool showRotation=false,
+ uint32_t axisSwitch=0,
+ DebugAxesRenderMode::Enum renderMode = DebugAxesRenderMode::DEBUG_AXES_RENDER_SOLID
+ ) = 0;
+
+ //***********************************************************************************
+ //** 3D Text, 2D Text, Messages, and Commands
+ //***********************************************************************************
+
+ /**
+ \brief Debug visualize a text string rendered a 3d wireframe lines. Uses a printf style format. Not all special symbols available, basic upper/lower case an simple punctuation.
+
+ \param pos The position of the text
+ \param fmt The printf style format string
+ */
+ virtual void debugText(const float pos[3],
+ const char *fmt,...) = 0;
+
+ /**
+ \brief Debug visualize a text string rendered using a simple 2d font.
+
+ \param x The X position of the text in normalized screen space 0 is the left of the screen and 1 is the right of the screen.
+ \param y The Y position of the text in normalized screen space 0 is the top of the screen and 1 is the bottom of the screen.
+ \param scale The scale of the font; these are not true-type fonts, so this is simple sprite scales. A scale of 0.5 is a nice default value.
+ \param shadowOffset The font is displayed with a drop shadow to make it easier to distinguish against the background; a value between 1 to 6 looks ok.
+ \param forceFixWidthNumbers This bool controls whether numeric values are printed as fixed width or not.
+ \param textColor the 32 bit ARGB value color to use for this piece of text.
+ \param fmt The printf style format string
+ */
+ virtual void debugText2D(float x,
+ float y,
+ float scale,
+ float shadowOffset,
+ bool forceFixWidthNumbers,
+ uint32_t textColor,
+ const char *fmt,...) = 0;
+
+ /**
+ \brief Sends a debug log message to the remote client/server or recorded to a log file.
+
+ \param fmt The printf style format string for the message
+ */
+ virtual void debugMessage(const char *fmt,...) = 0;
+
+ /**
+ \brief Send a command from the server to the client. This could be any arbitrary console command, it can also be mouse drag events, debug visualization events, etc.
+ * the client receives this command in argc/argv format.
+
+ \param fmt The printf style format string for the message
+ */
+ virtual bool sendRemoteCommand(const char *fmt,...) = 0;
+
+ /**
+ \brief Transmits an arbitrary block of binary data to the remote machine. The block of data can have a command and id associated with it.
+
+ It is important to note that due to the fact the RenderDebug system is synchronized every single frame, it is strongly recommended
+ that you only use this feature for relatively small data items; probably on the order of a few megabytes at most. If you try to do
+ a very large transfer, in theory it would work, but it might take a very long time to complete and look like a hang since it will
+ essentially be blocking.
+
+ \param nameSpace The namespace/type associated with this data transfer, for example this could indicate a remote file request.
+ \param resourceName The name of the resource associated with this data transfer, for example the id could be the file name of a file transfer request.
+ \param data The block of binary data to transmit, you are responsible for maintaining endian correctness of the internal data if necessary.
+ \param dlen The length of the lock of data to transmit.
+
+ \return Returns true if the data was queued to be transmitted, false if it failed.
+ */
+ virtual bool sendRemoteResource(const char *nameSpace,
+ const char *resourceName,
+ const void *data,
+ uint32_t dlen) = 0;
+
+ /**
+ \brief This function allows you to request a file from the remote machine by name. If successful it will be returned via 'getRemoteData'
+
+ \param nameSpace The namespace/type associated with this data transfer, for example this could indicate a remote file request.
+ \param resourceName The name of the resource associated with this data transfer, for example the id could be the file name of a file transfer request.
+
+ \return Returns true if the request was queued to be transmitted, false if it failed.
+ */
+ virtual bool requestRemoteResource(const char *nameSpace,
+ const char *resourceName) = 0;
+
+
+ /**
+ \brief If running in client mode, poll this method to retrieve any pending commands from the server. If it returns NULL then there are no more commands.
+ */
+ virtual const char ** getRemoteCommand(uint32_t &argc) = 0;
+
+ /**
+ \brief Retrieves a block of remotely transmitted binary data.
+
+ \param nameSpace A a reference to a pointer which will store the namespace (type) associated with this data transfer, for example this could indicate a remote file request.
+ \param resourceName A reference to a pointer which will store the resource name associated with this data transfer, for example the resource name could be the file name of a file transfer request.
+ \param dlen A reference that will contain length of the lock of data received.
+ \param remoteIsBigEndian A reference to a boolean which will be set to true if the remote machine that sent this data is big endian format.
+
+ \return A pointer to the block of data received.
+ */
+ virtual const void * getRemoteResource(const char *&nameSpace,
+ const char *&resourceName,
+ uint32_t &dlen,
+ bool &remoteIsBigEndian) = 0;
+
+
+ //***********************************************************************************
+ //** Draw Groups
+ //***********************************************************************************
+
+ /**
+ \brief Resets either a specific block of debug data or all blocks.
+
+ A series of of draw commands can be batched up into blocks, kind of like macros, however nested blocks are not supported.
+ For example, if you had a particular collection of draw calls which were repeated every frame, instead of passing them each time, instead
+ you could use the beginBlock/endBlock methods to cache them. Then, on future frames, you could simply render that batch of commands with
+ a single draw call. Each logical block of commands can be issued relative to a pose, so this way you can implement a form of instancing
+ as well.
+
+ \param blockIndex -1 reset *everything*, 0 = reset everything except stuff inside blocks, > 0 reset a specific block of data.
+ */
+ virtual void reset(int32_t blockIndex=-1) = 0;
+
+ /**
+ \brief Begins a draw group relative to this 4x4 matrix. Returns the draw group id. A draw group is like a macro set of drawing commands.
+
+ \param pose The base pose of this draw group.
+ */
+ virtual int32_t beginDrawGroup(const float pose[16]) = 0;
+
+ /**
+ \brief Mark the end of a draw group.
+ */
+ virtual void endDrawGroup(void) = 0;
+
+ /**
+ \brief Indicate whether a particular draw group is currently visible or not
+
+ \param groupId The draw group ID
+ \param state Whether it should be visible or not.
+ */
+ virtual void setDrawGroupVisible(int32_t groupId,
+ bool state) = 0;
+
+
+ /**
+ \brief Revises the transform for a previously defined draw group.
+
+ \param blockId The id number of the block we are referencing
+ \param pose The pose of that block id
+ */
+ virtual void setDrawGroupPose(int32_t blockId,const float pose[16]) = 0;
+
+
+ //***********************************************************************************
+ //** Screenspace Support
+ //***********************************************************************************
+
+ /**
+ \brief Create a 2d screen-space graph
+ \param numPoints The number of points in the graph
+ \param points The set of data points.
+ \param graphMax The maximum Y axis
+ \param graphXPos The x screen space position for this graph
+ \param graphYPos The y screen space position for this graph.
+ \param graphWidth The width of the graph
+ \param graphHeight The height of the graph
+ \param colorSwitchIndex Undocumented
+ */
+ virtual void debugGraph(uint32_t numPoints,
+ float * points,
+ float graphMax,
+ float graphXPos,
+ float graphYPos,
+ float graphWidth,
+ float graphHeight,
+ uint32_t colorSwitchIndex = 0xFFFFFFFF) = 0;
+
+
+ /**
+ \brief Debug visualize a quad in screenspace (always screen facing)
+
+ \param pos The position of the quad
+ \param scale The 2d scale
+ \param orientation The 2d orientation in radians
+ */
+ virtual void debugQuad(const float pos[3],
+ const float scale[2],
+ float orientation) = 0;
+
+ /**
+ \brief Sets the view matrix as a full 4x4 matrix. Required for screen-space aligned debug rendering. If you are not trying to do screen-facing or 2d screenspace rendering this is not required.
+
+ \param view The 4x4 view matrix This is not transmitted remotely to the server, this is only for local rendering.
+ */
+ virtual void setViewMatrix(const float view[16]) = 0;
+
+ /**
+ \brief Sets the projection matrix as a full 4x4 matrix. Required for screen-space aligned debug rendering.
+
+ \param projection This current projection matrix, note this is not transmitted to the server, it is only used locally.
+ */
+ virtual void setProjectionMatrix(const float projection[16]) = 0;
+
+
+ //***********************************************************************************
+ //** Instanced Triangle Methods
+ //***********************************************************************************
+
+ /**
+ \brief A convenience method to return a unique mesh id number (simply a global counter to avoid clashing with other ids
+ */
+ virtual uint32_t getMeshId(void) = 0;
+
+ /**
+ \brief Render a set of instanced triangle meshes.
+
+ \param meshId This id of the instanced mesh to render
+ \param instanceCount The number of instances of this mesh to render
+ \param instances The array of 3x4 instance transforms
+
+ */
+ virtual void renderTriangleMeshInstances(uint32_t meshId,
+ uint32_t instanceCount,
+ const RenderDebugInstance *instances) = 0;
+
+ /**
+ \brief Render a set of data points, either as wire-frame cross hairs or as a small solid instanced mesh.
+
+ This callback provides the ability to (as rapidly as possible) render a large number of
+
+ \param mode Determines what mode to render the point data
+ \param meshId The ID of the previously created triangle mesh if rendering in mesh mode
+ \param textureId1 The ID of the primary texture
+ \param textureTile1 The UV tiling rate of the primary texture
+ \param textureId2 The ID of the secondary texture
+ \param textureTile2 The UV tiling rate of the secondary texture
+ \param pointCount The number of points to render
+ \param points The array of points to render
+ */
+ virtual void debugPoints(PointRenderMode mode,
+ uint32_t meshId,
+ uint32_t textureId1,
+ float textureTile1,
+ uint32_t textureId2,
+ float textureTile2,
+ uint32_t pointCount,
+ const float *points) = 0;
+
+ /**
+ \brief This method will produce a debug visualization of a convex hull; either as lines or solid triang;es depending on the current debug render state
+
+ \param planeCount The number of planes in the convex hull
+ \param planes The array of plane equations in the convex hull
+ */
+ virtual void debugConvexHull(uint32_t planeCount,
+ const float *planes) = 0;
+
+ /**
+ \brief This is the fast path to render a large batch of lines instead of drawing them one at at time with debugLine
+
+ \param lcount The number of lines to draw (vertex count=lines*2)
+ \param vertices The pairs of vertices for each line segment
+ \param useZ Whether or not these should be zbuffered
+ \param isScreenSpace Whether or not these are in homogeneous screen-space co-ordinates
+ */
+ virtual void debugRenderLines(uint32_t lcount,
+ const RenderDebugVertex *vertices,
+ bool useZ,
+ bool isScreenSpace) = 0;
+
+ /**
+ \brief This is the fast path to render a large batch of solid shaded triangles instead of drawing them one at a time with debugTri
+
+ \param tcount The number of triangles to render. (vertex count=tcount*2)
+ \param vertices The vertices for each triangle
+ \param useZ Whether or not these should be zbuffered
+ \param isScreenSpace Whether or not these are in homogeneous screen-space co-ordinates
+ */
+ virtual void debugRenderTriangles(uint32_t tcount,
+ const RenderDebugSolidVertex *vertices,
+ bool useZ,
+ bool isScreenSpace) = 0;
+
+ /**
+ \brief Create a triangle mesh that we can render. Assumes an indexed triangle mesh. User provides a *unique* id. If it is not unique, this will fail.
+
+ \param meshId The unique mesh id to associate with this triangle mesh
+ \param vcount The number of vertices in the triangle mesh
+ \param meshVertices The array of vertices
+ \param tcount The number of triangles (indices must contain tcount*3 values if non-null)
+ \param indices The optional array of triangle mesh indices. If this is null then the mesh is assumed to be a triangle list with 3 vertices per triangle.
+
+ */
+ virtual void createTriangleMesh(uint32_t meshId,
+ uint32_t vcount,
+ const RenderDebugMeshVertex *meshVertices,
+ uint32_t tcount,
+ const uint32_t *indices) = 0;
+
+ /**
+ \brief Refresh a sub-section of the vertices in a previously created triangle mesh.
+
+ \param meshId The mesh ID of the triangle mesh we are refreshing
+ \param vcount This is the number of vertices to refresh.
+ \param refreshVertices This is an array of revised vertex data.
+ \param refreshIndices This is an array of indices which correspond to the original triangle mesh submitted. There should be one index for each vertex.
+ */
+ virtual void refreshTriangleMeshVertices(uint32_t meshId,
+ uint32_t vcount,
+ const RenderDebugMeshVertex *refreshVertices,
+ const uint32_t *refreshIndices) = 0;
+
+ /**
+ \brief Release a previously created triangle mesh
+ */
+ virtual void releaseTriangleMesh(uint32_t meshId) = 0;
+
+
+ //***********************************************************************************
+ //** Utility and Support
+ //***********************************************************************************
+
+ /**
+ \brief Special case command that affects how the server processes the previous frame of data.
+
+ \return Returns true if it is safe to skip this frame of data, false if there are required commands that must be executed.
+ */
+ virtual bool trySkipFrame(void) = 0;
+
+ /**
+ \brief Returns the number of times that the 'render' method has been called, this is local.
+ */
+ virtual uint32_t getUpdateCount(void) const = 0;
+
+ /**
+ \brief Called once per frame to flush all debug visualization commands queued.
+ \param dtime The amount of time which has passed for this frame
+ \param iface The optional callback interface to process the raw lines and triangles, NULL for applications connected to a file or server.
+ */
+ virtual bool render(float dtime,
+ RenderDebugInterface *iface) = 0;
+
+ /**
+ \brief Returns the current view*projection matrix
+
+ \return A convenience method to return the current view*projection matrix (local only)
+ */
+ virtual const float* getViewProjectionMatrix(void) const = 0;
+
+ /**
+ \brief Returns the current view matrix we are using
+
+ \return A convenience method which returns the currently set view matrix (local only)
+ */
+ virtual const float *getViewMatrix(void) const = 0;
+
+ /**
+ \brief Gets the current projection matrix.
+
+ \return A convenience method to return the current projection matrix (local only)
+ */
+ virtual const float *getProjectionMatrix(void) const = 0;
+
+ /**
+ \brief A convenience helper method to convert euler angles (in degrees) into a standard XYZW quaternion.
+
+ \param angles The X,Y,Z angles in degrees
+ \param q The output quaternion
+ */
+ virtual void eulerToQuat(const float angles[3],float q[4]) = 0; // angles are in degrees.
+
+ /**
+ \brief A convenience method to convert two positions into a 4x4 transform
+
+ \param p0 The origin
+ \param p1 The point we want to create a rotation arc towards
+ \param xform The 4x4 output matrix transform
+
+ */
+ virtual void rotationArc(const float p0[3],const float p1[3],float xform[16]) = 0;
+
+ /**
+ \brief Set a debug color value by name.
+
+ \param colorEnum Which of the predefined color choices
+ \param value The 32 bit ARGB value to associate with this enumerated type
+ */
+ virtual void setDebugColor(DebugColors::Enum colorEnum, uint32_t value) = 0;
+
+ /**
+ \brief Return a debug color value by type
+
+ \param colorEnum Which of the predefined enumerated color types
+ \return Returns the 32 bit ARGB color value assigned to this enumeration
+ */
+ virtual uint32_t getDebugColor(DebugColors::Enum colorEnum) const = 0;
+
+ /**
+ \brief Return a debug color value by RGB inputs
+
+ \param red The red component 0-1
+ \param green The green component 0-1
+ \param blue the blue component 0-1
+ \return Returns floating point RGB values as 32 bit RGB format.
+ */
+ virtual uint32_t getDebugColor(float red, float green, float blue) const = 0;
+
+ /**
+ \brief Set the base file name to record communications stream; or NULL to disable it.
+
+ \param fileName The base name of the file to record the communications channel stream to, or NULL to disable it.
+ */
+ virtual bool setStreamFilename(const char *fileName) = 0;
+
+ /**
+ \brief Begins a file-playback session. Returns the number of recorded frames in the recording file. Zero if the file was not valid.
+ */
+ virtual uint32_t setFilePlayback(const char *fileName) = 0;
+
+ /**
+ \brief Begin playing back a communications stream recording
+
+ \param fileName The name of the previously captured communications stream file
+ */
+ virtual bool setStreamPlayback(const char *fileName) = 0;
+
+ /**
+ \brief Sets the file playback to a specific frame. Returns true if successful.
+ */
+ virtual bool setPlaybackFrame(uint32_t playbackFrame) = 0;
+
+ /**
+ \brief Returns the number of recorded frames in the debug render recording file.
+ */
+ virtual uint32_t getPlaybackFrameCount(void) const = 0;
+
+ /**
+ \brief Stops the current recording playback.
+ */
+ virtual void stopPlayback(void) = 0;
+
+ /**
+ \brief Do a 'try' lock on the global render debug mutex. This is simply provided as an optional convenience if you are accessing RenderDebug from multiple threads and want to prevent contention.
+ */
+ virtual bool trylock(void) = 0;
+
+ /**
+ \brief Lock the global render-debug mutex to avoid thread contention.
+ */
+ virtual void lock(void) = 0;
+
+ /**
+ \brief Unlock the global render-debug mutex
+ */
+ virtual void unlock(void) = 0;
+
+ /**
+ \brief Report what 'Run' mode we are operating in.
+ */
+ virtual RunMode getRunMode(void) = 0;
+
+ /**
+ \brief Returns true if we still have a valid connection to the server.
+ */
+ virtual bool isConnected(void) const = 0;
+
+ /**
+ \brief Returns the current synchronized frame between client/server communications. Returns zero if no active connection exists.
+ */
+ virtual uint32_t getCommunicationsFrame(void) const = 0;
+
+ /**
+ \brief Returns the name of the currently connected application
+ */
+ virtual const char *getRemoteApplicationName(void) = 0;
+
+ /**
+ \brief Returns the optional typed methods for various render debug routines.
+ */
+ virtual RenderDebugTyped *getRenderDebugTyped(void) = 0;
+
+ /**
+ \brief Release the render debug class
+ */
+ virtual void release(void) = 0;
+
+ //***********************************************************************************
+ //** Digital and Analog input support
+ //***********************************************************************************
+
+ /**
+ \brief register a digital input event (maps to windows keyboard commands)
+
+ \param eventId The eventId for this input event; if it is a custom event it must be greater than NUM_SAMPLE_FRAMEWORK_INPUT_EVENT_IDS
+ \param inputId This the pre-defined keyboard code for this input event.
+ */
+ virtual void registerDigitalInputEvent(InputEventIds::Enum eventId,InputIds::Enum inputId) = 0;
+
+ /**
+ \brief register a digital input event (maps to windows keyboard commands)
+
+ \param eventId The eventId for this input event; if it is a custom event it must be greater than NUM_SAMPLE_FRAMEWORK_INPUT_EVENT_IDS
+ \param sensitivity The sensitivity value associated with this anaglog devent; default value is 1.0
+ \param inputId This the pre-defined analog code for this input event.
+ */
+ virtual void registerAnalogInputEvent(InputEventIds::Enum eventId,float sensitivity,InputIds::Enum inputId) = 0;
+
+ /**
+ \brief unregister a previously registered input event.
+
+ \param eventId The id of the previously registered input event.
+ */
+ virtual void unregisterInputEvent(InputEventIds::Enum eventId) = 0;
+
+ /**
+ \brief Reset all input events to an empty state
+ */
+ virtual void resetInputEvents(void) = 0;
+
+ /**
+ \brief Transmit an actual input event to the remote client
+
+ \param ev The input event data to transmit
+ */
+ virtual void sendInputEvent(const InputEvent &ev) = 0;
+
+ /**
+ \brief Returns any incoming input event for processing purposes
+
+ \param flush If this is true, the event will be flushed and no longer reported, if false this acts as a 'peek' operation for the next input event
+ */
+ virtual const InputEvent *getInputEvent(bool flush) = 0;
+
+protected:
+
+ virtual ~RenderDebug(void) { }
+};
+
+/**
+\brief A convenience helper-class to create a scoped mutex-lock around calls into the debug render library, if you might potentially be calling it from multiple threads.
+*/
+class ScopedRenderDebug
+{
+public:
+ /**
+ \brief This constructor for ScopedRenderDebug initiates a global mutex lock to prevent other threads from accessing this instance of RenderDebug at the same time
+ */
+ ScopedRenderDebug(RenderDebug *rd)
+ {
+ mRenderDebug = rd;
+ if ( mRenderDebug )
+ {
+ mRenderDebug->lock();
+ }
+ }
+
+ /**
+ \brief This is the destructor for ScopedRenderDebug which releases the previously acquired lock when this helper class goes out of scope
+ */
+ ~ScopedRenderDebug(void)
+ {
+ if ( mRenderDebug )
+ {
+ mRenderDebug->unlock();
+ }
+ }
+
+ /**
+ \brief The instance of RenderDebug that is to be locked
+ */
+ RenderDebug *mRenderDebug;
+};
+
+/**
+\brief This is the single method to create an instance of the RenderDebug class using the properties supplied in the descriptor.
+
+\param desc This contains the information about how to construct the RenderDebug interface; either as local, client, or server, and other options.
+
+\return Returns a pointer to the RenderDebug interface if successfull. It it returns null, then check the desc.errorCode value
+*/
+RENDER_DEBUG::RenderDebug *createRenderDebug(RENDER_DEBUG::RenderDebug::Desc &desc);
+
+
+} // end of RENDER_DEBUG namespace
+
+extern "C"
+#if PX_WINDOWS_FAMILY != 0
+__declspec(dllexport)
+#endif
+RENDER_DEBUG::RenderDebug* createRenderDebugExport(RENDER_DEBUG::RenderDebug::Desc &desc);
+
+/**
+\brief A helper macro to create an instanced of the ScopedRenderDebug class to apply a global mutex lock on access to the RenderDebug API
+*/
+#define SCOPED_RENDER_DEBUG_LOCK(x) RENDER_DEBUG::ScopedRenderDebug _lockRenderDebug(x)
+
+#endif // RENDER_DEBUG_H
diff --git a/APEX_1.4/shared/general/RenderDebug/public/RenderDebugTyped.h b/APEX_1.4/shared/general/RenderDebug/public/RenderDebugTyped.h
new file mode 100644
index 00000000..ec9eea75
--- /dev/null
+++ b/APEX_1.4/shared/general/RenderDebug/public/RenderDebugTyped.h
@@ -0,0 +1,443 @@
+#ifndef RENDER_DEBUG_TYPED_H
+#define RENDER_DEBUG_TYPED_H
+
+#include "RenderDebug.h"
+
+
+namespace physx
+{
+ class PxVec2;
+ class PxVec3;
+ class PxVec4;
+ class PxMat33;
+ class PxMat44;
+ class PxTransform;
+ class PxQuat;
+ class PxBounds3;
+ class PxPlane;
+}
+
+namespace RENDER_DEBUG
+{
+
+/**
+\brief This is an optional interface class which provides typed definition variants which accept the NVIDIA standard foundation math data types.
+
+Call 'getRenderDebugTyped' on the RenderDebug base class to retrieve this interface.
+The default interface does not have any additional dependencies on any other header files beyond simply <stdint.h>
+*/
+class RenderDebugTyped : public RenderDebug
+{
+public:
+ /**
+ \brief Draw a polygon; 'points' is an array of 3d vectors.
+
+ \param pcount The number of data points in the polygon.
+ \param points The array of Vec3 points comprising the polygon boundary
+ */
+ virtual void debugPolygon(uint32_t pcount,
+ const physx::PxVec3 *points) = 0;
+
+ /**
+ \brief Draw a single line using the current color state
+
+ \param p1 Starting position
+ \param p2 Line end position
+ */
+ virtual void debugLine(const physx::PxVec3 &p1,
+ const physx::PxVec3 &p2) = 0;
+
+ /**
+ \brief Draw a gradient line (different start color from end color)
+
+ \param p1 The starting location of the line in 3d
+ \param p2 The ending location of the line in 3d
+ \param c1 The starting color as a 32 bit ARGB format
+ \param c2 The ending color as a 32 bit ARGB format
+ */
+ virtual void debugGradientLine(const physx::PxVec3 &p1,
+ const physx::PxVec3 &p2,
+ const uint32_t &c1,
+ const uint32_t &c2) = 0;
+
+ /**
+ \brief Draws a wireframe line with a small arrow head pointing along the direction vector ending at P2
+
+ \param p1 The start of the ray
+ \param p2 The end of the ray, where the arrow head will appear
+ */
+ virtual void debugRay(const physx::PxVec3 &p1,
+ const physx::PxVec3 &p2) = 0;
+
+ /**
+ \brief Create a debug visualization of a cylinder from P1 to P2 with radius provided.
+
+ \param p1 The starting point of the cylinder
+ \param p2 The ending point of the cylinder
+ \param radius The radius of the cylinder
+ */
+ virtual void debugCylinder(const physx::PxVec3 &p1,
+ const physx::PxVec3 &p2,
+ float radius) = 0;
+
+ /**
+ \brief Creates a debug visualization of a 'thick' ray. Extrudes a cylinder visualization with a nice arrow head.
+
+ \param p1 Starting point of the ray
+ \param p2 Ending point of the ray
+ \param raySize The thickness of the ray, the arrow head size is used for the arrow head.
+ \param arrowTip Whether or not the arrow tip should appear, by default this is true.
+ */
+ virtual void debugThickRay(const physx::PxVec3 &p1,
+ const physx::PxVec3 &p2,
+ float raySize=0.02f,
+ bool arrowTip=true) = 0;
+
+ /**
+ \brief Creates a debug visualization of a plane equation as a couple of concentric circles
+
+ \param plane The plane equation
+ \param radius1 The inner radius of the plane visualization
+ \param radius2 The outer radius of the plane visualization
+ */
+ virtual void debugPlane(const physx::PxPlane &plane,
+ float radius1,
+ float radius2) = 0;
+
+ /**
+ \brief Debug visualize a 3d triangle using the current render state flags
+
+ \param p1 First point in the triangle
+ \param p2 Second point in the triangle
+ \param p3 The third point in the triangle
+ */
+ virtual void debugTri(const physx::PxVec3 &p1,
+ const physx::PxVec3 &p2,
+ const physx::PxVec3 &p3) = 0;
+
+ /**
+ \brief Debug visualize a 3d triangle with provided vertex lighting normals.
+
+ \param p1 First point in the triangle
+ \param p2 Second point in the triangle
+ \param p3 The third point in the triangle
+ \param n1 First normal in the triangle
+ \param n2 Second normal in the triangle
+ \param n3 The third normal in the triangle
+ */
+ virtual void debugTriNormals(const physx::PxVec3 &p1,
+ const physx::PxVec3 &p2,
+ const physx::PxVec3 &p3,
+ const physx::PxVec3 &n1,
+ const physx::PxVec3 &n2,
+ const physx::PxVec3 &n3) = 0;
+
+ /**
+ \brief Debug visualize a 3d triangle with a unique color at each vertex.
+
+ \param p1 First point in the triangle
+ \param p2 Second point in the triangle
+ \param p3 The third point in the triangle
+ \param c1 The color of the first vertex
+ \param c2 The color of the second vertex
+ \param c3 The color of the third vertex
+ */
+ virtual void debugGradientTri(const physx::PxVec3 &p1,
+ const physx::PxVec3 &p2,
+ const physx::PxVec3 &p3,
+ const uint32_t &c1,
+ const uint32_t &c2,
+ const uint32_t &c3) = 0;
+
+ /**
+ \brief Debug visualize a 3d triangle with provided vertex normals and colors
+
+ \param p1 First point in the triangle
+ \param p2 Second point in the triangle
+ \param p3 The third point in the triangle
+ \param n1 First normal in the triangle
+ \param n2 Second normal in the triangle
+ \param n3 The third normal in the triangle
+ \param c1 The color of the first vertex
+ \param c2 The color of the second vertex
+ \param c3 The color of the third vertex
+ */
+ virtual void debugGradientTriNormals(const physx::PxVec3 &p1,
+ const physx::PxVec3 &p2,
+ const physx::PxVec3 &p3,
+ const physx::PxVec3 &n1,
+ const physx::PxVec3 &n2,
+ const physx::PxVec3 &n3,
+ const uint32_t &c1,
+ const uint32_t &c2,
+ const uint32_t &c3) = 0;
+
+ /**
+ \brief Debug visualize a 3d bounding box using the current render state.
+
+ \param bounds The axis aligned bounding box to render.
+ */
+ virtual void debugBound(const physx::PxBounds3 &bounds) = 0;
+
+ /**
+ \brief Debug visualize a crude sphere using the current render state settings.
+
+ \param pos The center of the sphere
+ \param radius The radius of the sphere.
+ \param subdivision The number of subdivisions to use, controls how detailed the sphere is.
+ */
+ virtual void debugSphere(const physx::PxVec3 &pos,
+ float radius,
+ uint32_t subdivision=2) = 0;
+
+ /**
+ \brief Debug visualize an oriented circle.
+
+ \param center The center of the circle
+ \param radius The radius of the circle
+ \param subdivision The number of subdivisions
+ */
+ virtual void debugCircle(const physx::PxVec3 &center,
+ float radius,
+ uint32_t subdivision) = 0;
+
+ /**
+ \brief Debug visualize a simple point as a small cross
+
+ \param pos The position of the point
+ \param radius The size of the point visualization.
+ */
+ virtual void debugPoint(const physx::PxVec3 &pos,
+ float radius) = 0;
+
+ /**
+ \brief Debug visualize a simple point with provided independent scale on the X, Y, and Z axis
+
+ \param pos The position of the point
+ \param scale The X/Y/Z scale of the crosshairs.
+ */
+ virtual void debugPoint(const physx::PxVec3 &pos,
+ const physx::PxVec3 &scale) = 0;
+
+ /**
+ \brief Debug visualize a quad in screenspace (always screen facing)
+
+ \param pos The position of the quad
+ \param scale The 2d scale
+ \param orientation The 2d orientation in radians
+ */
+ virtual void debugQuad(const physx::PxVec3 &pos,
+ const physx::PxVec2 &scale,
+ float orientation) = 0;
+
+ /**
+ \brief Debug visualize a 4x4 transform.
+
+ \param transform The matrix we are trying to visualize
+ \param distance The size of the visualization
+ \param brightness The brightness of the axes
+ \param showXYZ Whether or not to print 3d text XYZ labels
+ \param showRotation Whether or not to visualize rotation or translation axes
+ \param axisSwitch Which axis is currently selected/highlighted.
+ */
+ virtual void debugAxes(const physx::PxMat44 &transform,
+ float distance=0.1f,
+ float brightness=1.0f,
+ bool showXYZ=false,
+ bool showRotation=false,
+ uint32_t axisSwitch=0,
+ DebugAxesRenderMode::Enum renderMode=DebugAxesRenderMode::DEBUG_AXES_RENDER_SOLID) = 0;
+ /**
+ \brief Debug visualize an arc as a line with an arrow head at the end.
+
+ \param center The center of the arc
+ \param p1 The starting position of the arc
+ \param p2 The ending position of the arc
+ \param arrowSize The size of the arrow head for the arc.
+ \param showRoot Whether or not to debug visualize the center of the arc
+ */
+ virtual void debugArc(const physx::PxVec3 &center,
+ const physx::PxVec3 &p1,
+ const physx::PxVec3 &p2,
+ float arrowSize=0.1f,
+ bool showRoot=false) = 0;
+
+ /**
+ \brief Debug visualize a thick arc
+
+ \param center The center of the arc
+ \param p1 The starting position of the arc
+ \param p2 The ending position of the arc
+ \param thickness The thickness of the cylinder drawn along the arc
+ \param showRoot Whether or not to debug visualize the center of the arc
+ */
+ virtual void debugThickArc(const physx::PxVec3 &center,// The center of the arc
+ const physx::PxVec3 &p1, // The starting position of the arc
+ const physx::PxVec3 &p2, // The ending position of the arc
+ float thickness=0.02f,// How thick the arc is.
+ bool showRoot=false) = 0;// Whether or not to debug visualize the center of the arc
+
+ /**
+ \brief Debug visualize a text string rendered a 3d wireframe lines. Uses a printf style format. Not all special symbols available, basic upper/lower case an simple punctuation.
+
+ \param pos The position of the text
+ \param fmt The printf style format string
+ */
+ virtual void debugText(const physx::PxVec3 &pos,
+ const char *fmt,...) = 0;
+
+ /**
+ \brief Set's the view matrix as a full 4x4 matrix. Required for screen-space aligned debug rendering. If you are not trying to do screen-facing or 2d screenspace rendering this is not required.
+
+ \param view The 4x4 view matrix This is not transmitted remotely to the server, this is only for local rendering.
+ */
+ virtual void setViewMatrix(const physx::PxMat44 &view) = 0;
+
+ /**
+ \brief Set's the projection matrix as a full 4x4 matrix. Required for screen-space aligned debug rendering.
+
+ \param projection This current projection matrix, note this is not transmitted to the server, it is only used locally.
+ */
+ virtual void setProjectionMatrix(const physx::PxMat44 &projection) = 0;
+
+ /**
+ \brief Returns the current view*projection matrix
+
+ \return A convenience method to return the current view*projection matrix (local only)
+ */
+ virtual const physx::PxMat44* getViewProjectionMatrixTyped(void) const = 0;
+
+ /**
+ \brief Returns the current view matrix we are using
+
+ \return A convenience method which returns the currently set view matrix (local only)
+ */
+ virtual const physx::PxMat44 *getViewMatrixTyped(void) const = 0;
+
+ /**
+ \brief Gets the current projection matrix.
+
+ \return A convenience method to return the current projection matrix (local only)
+ */
+ virtual const physx::PxMat44 *getProjectionMatrixTyped(void) const = 0;
+
+ /**
+ \brief A convenience helper method to convert euler angles (in degrees) into a standard XYZW quaternion.
+
+ \param angles The X,Y,Z angles in degrees
+ \param q The output quaternion
+ */
+ virtual void eulerToQuat(const physx::PxVec3 &angles,physx::PxQuat &q) = 0; // angles are in degrees.
+
+ /**
+ \brief A convenience method to convert a position and direction vector into a 4x4 transform
+
+ \param p0 The starting position
+ \param p1 The ending position
+ \param xform The translation and rotation transform
+
+ */
+ virtual void rotationArc(const physx::PxVec3 &p0,const physx::PxVec3 &p1,physx::PxMat44 &xform) = 0;
+
+ /**
+ \brief Begin's a draw group relative to this 4x4 matrix. Returns the draw group id. A draw group is like a macro set of drawing commands.
+
+ \param pose The base pose of this draw group.
+ */
+ virtual int32_t beginDrawGroup(const physx::PxMat44 &pose) = 0;
+
+ /**
+ \brief Revises the transform for a previously defined draw group.
+
+ \param blockId The id number of the block we are referencing
+ \param pose The pose of that block id
+ */
+ virtual void setDrawGroupPose(int32_t blockId,const physx::PxMat44 &pose) = 0;
+
+ /**
+ \brief Sets the global pose for the current debug-rendering context. This is preserved on the state stack.
+
+ \param pose Sets the current global pose for the RenderDebug context, all draw commands will be transformed by this root pose. Default is identity.
+ */
+ virtual void setPose(const physx::PxMat44 &pose) = 0;
+
+ /**
+ \brief Sets the global pose for the current debug-rendering context. This is preserved on the state stack.
+
+ \param pose Sets the pose from a position and quaternion rotation
+ */
+ virtual void setPose(const physx::PxTransform &pose) = 0;
+
+ /**
+ \brief Sets the global pose position only, does not change the rotation.
+
+ \param position Sets the translation component
+ */
+ virtual void setPosition(const physx::PxVec3 &position) = 0;
+
+ /**
+ \brief Sets the global pose orientation only, does not change the position
+
+ \param rot Sets the orientation of the global pose
+ */
+ virtual void setOrientation(const physx::PxQuat &rot) = 0;
+
+ /**
+ \brief Gets the global pose for the current debug rendering context
+
+ \return Returns the current global pose for the RenderDebug
+ */
+ virtual const physx::PxMat44 * getPoseTyped(void) const = 0;
+
+ /**
+ \brief Debug visualize a view*projection matrix frustum.
+
+ \param viewMatrix The view matrix of the frustm
+ \param projMatrix The projection matrix of the frustm
+ */
+ virtual void debugFrustum(const physx::PxMat44 &viewMatrix,const physx::PxMat44 &projMatrix) = 0;
+
+ // Due to the issue of 'name hiding' when we have two virtual interfaces which have pure virtual methods of the same name
+ // we must explicitly declare that we are intentionally providing access to both the typed as well as the base class
+ // non-typed versions here.
+ // @see: http://www.programmerinterview.com/index.php/c-cplusplus/c-name-hiding/
+ //
+ using RenderDebug::debugPolygon;
+ using RenderDebug::debugLine;
+ using RenderDebug::debugGradientLine;
+ using RenderDebug::debugRay;
+ using RenderDebug::debugCylinder;
+ using RenderDebug::debugThickRay;
+ using RenderDebug::debugPlane;
+ using RenderDebug::debugTri;
+ using RenderDebug::debugTriNormals;
+ using RenderDebug::debugGradientTri;
+ using RenderDebug::debugGradientTriNormals;
+ using RenderDebug::debugBound;
+ using RenderDebug::debugSphere;
+ using RenderDebug::debugCircle;
+ using RenderDebug::debugPoint;
+ using RenderDebug::debugQuad;
+ using RenderDebug::debugAxes;
+ using RenderDebug::debugArc;
+ using RenderDebug::debugThickArc;
+ using RenderDebug::debugText;
+ using RenderDebug::setViewMatrix;
+ using RenderDebug::setProjectionMatrix;
+ using RenderDebug::eulerToQuat;
+ using RenderDebug::rotationArc;
+ using RenderDebug::beginDrawGroup;
+ using RenderDebug::setDrawGroupPose;
+ using RenderDebug::setPose;
+ using RenderDebug::setPosition;
+ using RenderDebug::setOrientation;
+ using RenderDebug::debugFrustum;
+protected:
+
+ virtual ~RenderDebugTyped(void) { }
+};
+
+} // end of RENDER_DEBUG namespace
+
+
+#endif // RENDER_DEBUG_TYPED_H
diff --git a/APEX_1.4/shared/general/RenderDebug/src/ClientServer.cpp b/APEX_1.4/shared/general/RenderDebug/src/ClientServer.cpp
new file mode 100644
index 00000000..f48171b4
--- /dev/null
+++ b/APEX_1.4/shared/general/RenderDebug/src/ClientServer.cpp
@@ -0,0 +1,1133 @@
+#include "ClientServer.h"
+#include "GetArgs.h"
+#include "PsCommLayer.h"
+#include "PsCommStream.h"
+#include "PsArray.h"
+#include "PsUserAllocated.h"
+#include "PxIntrinsics.h"
+#include "PsMutex.h"
+#include "PsThread.h"
+#include "PsString.h"
+#include "PsTime.h"
+#include <stdio.h>
+
+#define MAX_SERVER_COMMAND_STRING 16384
+
+enum PacketType
+{
+ PT_PRIMITIVES = 100,
+ PT_COMMAND,
+ PT_ACK,
+ PT_COMM_VERSION,
+ PT_FINALIZE_FRAME,
+ PT_APPLICATION_NAME,
+ PT_REQUEST_REMOTE_RESOURCE,
+ PT_REMOTE_RESOURCE,
+ PT_INPUT_EVENT
+};
+
+struct NetworkCommmand
+{
+ NetworkCommmand(void)
+ {
+ mPacketType = PT_COMMAND;
+ mCommandLength = 0;
+ mCommand = NULL;
+ }
+ uint32_t mPacketType;
+ uint32_t mCommandLength;
+ char *mCommand;
+};
+
+struct NetworkFrame
+{
+ NetworkFrame(void)
+ {
+ mPacketType = PT_PRIMITIVES;
+ }
+
+ uint32_t getPrefixSize(void) const
+ {
+ return sizeof(NetworkFrame)-(sizeof(void *)*2);
+ }
+
+ uint32_t mPacketType;
+ uint32_t mFrameCount;
+ uint32_t mPrimType;
+ uint32_t mPrimCount;
+ uint32_t mDataLength;
+ void *mData;
+ void *mBaseData;
+};
+
+#define MAX_RESOURCE_STRING 256
+
+class RequestRemoteResource
+{
+public:
+ uint32_t mCommand;
+ char mNameSpace[MAX_RESOURCE_STRING];
+ char mResourceName[MAX_RESOURCE_STRING];
+};
+
+class RemoteResourcePacket
+{
+public:
+ uint32_t mCommand;
+ uint32_t mLength;
+ uint32_t mBigEndian;
+ char mNameSpace[MAX_RESOURCE_STRING];
+ char mResourceName[MAX_RESOURCE_STRING];
+};
+
+class RemoteResource : public RemoteResourcePacket
+{
+public:
+ RemoteResource(void)
+ {
+ mData = NULL;
+ }
+ void *mData;
+};
+
+typedef physx::shdfnd::Array< NetworkFrame > NetworkFrameArray;
+typedef physx::shdfnd::Array< NetworkCommmand > NetworkCommandArray;
+typedef physx::shdfnd::Array< RemoteResource > RemoteResourceArray;
+typedef physx::shdfnd::Array< RENDER_DEBUG::InputEvent > InputEventArray;
+
+
+static PX_INLINE void swap4Bytes(void* _data)
+{
+ char *data = static_cast<char *>(_data);
+ char one_byte;
+ one_byte = data[0]; data[0] = data[3]; data[3] = one_byte;
+ one_byte = data[1]; data[1] = data[2]; data[2] = one_byte;
+}
+
+static PX_INLINE bool isBigEndian()
+{
+ int32_t i = 1;
+ return *(reinterpret_cast<char*>(&i))==0;
+}
+
+
+struct ServerCommandString
+{
+ ServerCommandString(void)
+ {
+ mCommandString[0] = 0;
+ }
+ char mCommandString[MAX_SERVER_COMMAND_STRING];
+};
+
+class ClientServerImpl : public ClientServer, public physx::shdfnd::UserAllocated
+{
+ PX_NOCOPY(ClientServerImpl)
+public:
+ ClientServerImpl(void)
+ {
+
+ }
+
+ ClientServerImpl(RENDER_DEBUG::RenderDebug::Desc &desc) :
+ mIncomingNetworkFrames(PX_DEBUG_EXP("ClientServer::mIncomingNetworkFrames")),
+ mNetworkFrames(PX_DEBUG_EXP("ClientServer::mNetworkFrames")),
+ mNetworkCommands(PX_DEBUG_EXP("ClientServer::mNetworkCommands")),
+ mRemoteResources(PX_DEBUG_EXP("ClientServer::mRemoteResource"))
+ {
+ mSkipFrame = false;
+ physx::shdfnd::strlcpy(mApplicationName,512,desc.applicationName);
+ mStreamName[0] = 0;
+ mDataSent = false;
+ mServerStallCallback = desc.serverStallCallback;
+ mRenderDebugResource = desc.renderDebugResource;
+ mBadVersion = true; // the version number is presumed bad until we know otherwise
+ mMaxServerWait = desc.maxServerWait;
+ mReceivedAck = true;
+ mCurrentNetworkFrame = 0;
+ mLastProcessNetworkFrame = 0;
+ mCommStream = NULL;
+ mCommLayer = NULL;
+ mCurrentCommLayer = NULL;
+ mLastFrame = 0;
+ mHaveApplicationName = false;
+ mMeshId = 100000; // base mesh id
+ mUsedMeshId = false;
+ mIsServer = desc.runMode == RENDER_DEBUG::RenderDebug::RM_SERVER;
+ mStreamCount = 1;
+ mWasConnected = false;
+ mCommLayer = createCommLayer(desc.hostName,desc.portNumber,mIsServer);
+ setStreamFilename(desc.streamFileName);
+ if ( mCommLayer == NULL )
+ {
+ desc.errorCode = "Failed to create connection";
+ }
+ else if ( !mIsServer )
+ {
+ sendVersionPacket();
+ }
+
+ }
+
+ virtual ~ClientServerImpl(void)
+ {
+ if ( mCommLayer )
+ {
+ mCommLayer->release();
+ }
+ if ( mCommStream )
+ {
+ mCommStream->release();
+ }
+ releaseNetworkFrames();
+ releaseIncomingNetworkFrames();
+ releaseRemoteResources();
+ releaseNetworkCommands();
+ }
+
+ void sendVersionPacket(void)
+ {
+ if ( !mCurrentCommLayer ) return;
+ uint32_t packet[2];
+ packet[0] = PT_COMM_VERSION;
+ packet[1] = RENDER_DEBUG_COMM_VERSION;
+ mCurrentCommLayer->sendMessage(packet,sizeof(packet));
+ }
+
+ void sendApplicationNamePacket(void)
+ {
+ if ( !mCurrentCommLayer ) return;
+ uint32_t packet[(512/4)+1];
+ packet[0] = PT_APPLICATION_NAME;
+ physx::intrinsics::memCopy(&packet[1],mApplicationName,512);
+ mCurrentCommLayer->sendMessage(packet,sizeof(packet));
+ }
+
+ virtual void release(void)
+ {
+ delete this;
+ }
+
+ virtual bool isServer(void) const
+ {
+ return mIsServer;
+ }
+
+ virtual void recordPrimitives(uint32_t frameCount,
+ uint32_t primType,
+ uint32_t primCount,
+ uint32_t dataLength,
+ const void *data)
+ {
+ mLastFrame = frameCount;
+
+ if ( mCurrentCommLayer && !mIsServer )
+ {
+ if ( mCurrentCommLayer->isConnected() ) // if we still have a connection..
+ {
+ // If we haven't caught up in
+ uint32_t sendSize = sizeof(uint32_t)*5+dataLength;
+ void *sendData = PX_ALLOC(sendSize,"sendData");
+ uint32_t *sendDataHeader = static_cast<uint32_t *>(sendData);
+ sendDataHeader[0] = PT_PRIMITIVES;
+ sendDataHeader[1] = frameCount;
+ sendDataHeader[2] = primType;
+ sendDataHeader[3] = primCount;
+ sendDataHeader[4] = dataLength;
+ sendDataHeader+=5;
+ physx::intrinsics::memCopy(sendDataHeader,data,dataLength);
+ mCurrentCommLayer->sendMessage(sendData,sendSize);
+ PX_FREE(sendData);
+ mDataSent = true;
+ }
+ }
+
+ }
+
+ void processNetworkData(void)
+ {
+ bool isBigEndianPacket;
+ uint32_t newDataSize = mCurrentCommLayer->peekMessage(isBigEndianPacket);
+ bool endOfFrame = false;
+ while ( newDataSize && !endOfFrame )
+ {
+ void *readData = PX_ALLOC(newDataSize,"readData");
+ bool freeReadData = true;
+ uint32_t rlen = mCurrentCommLayer->getMessage(readData,newDataSize,isBigEndianPacket);
+
+ if ( rlen == newDataSize )
+ {
+ bool needEndianSwap = false;
+ uint32_t type = *static_cast<uint32_t *>(readData);
+ if ( isBigEndianPacket != isBigEndian() )
+ {
+ needEndianSwap = true;
+ }
+ if ( needEndianSwap )
+ {
+ swap4Bytes(&type);
+ }
+ switch ( type )
+ {
+ case PT_APPLICATION_NAME:
+ {
+ uint32_t *packet = static_cast<uint32_t *>(readData);
+ physx::intrinsics::memCopy(mApplicationName,packet+1,512);
+ mHaveApplicationName = true;
+ }
+ break;
+ case PT_COMM_VERSION:
+ {
+ if ( mIsServer ) // if we are the server, tell the client our version number
+ {
+ sendVersionPacket(); // inform the client that we are of the same version
+ }
+ else
+ {
+ sendApplicationNamePacket(); // if we are the client, tell the server the name of our application
+ }
+ uint32_t *packet = static_cast<uint32_t *>(readData);
+ if ( needEndianSwap )
+ {
+ swap4Bytes(&packet[1]);
+ }
+ if ( packet[1] == RENDER_DEBUG_COMM_VERSION ) // if it is the same version as us, no problems!
+ {
+ mBadVersion = false;
+ }
+ else
+ {
+ mBadVersion = true;
+ }
+ }
+ break;
+ case PT_PRIMITIVES:
+ if ( !mBadVersion ) // if we have agreed upon each other's version number then we can process the data stream, otherwise..not so much
+ {
+ // as expected..
+ NetworkFrame nframe;
+ uint32_t *header = static_cast<uint32_t *>(readData);
+
+ nframe.mFrameCount = header[1];
+ nframe.mPrimType = header[2];
+ nframe.mPrimCount = header[3];
+ nframe.mDataLength = header[4];
+ nframe.mData = &header[5];
+
+ if ( needEndianSwap )
+ {
+ swap4Bytes(&nframe.mFrameCount);
+ swap4Bytes(&nframe.mPrimType);
+ swap4Bytes(&nframe.mPrimCount);
+ swap4Bytes(&nframe.mDataLength);
+ }
+
+ nframe.mBaseData = readData;
+ freeReadData = false;
+
+ if ( nframe.mFrameCount != mCurrentNetworkFrame )
+ {
+ for (uint32_t j=0; j<mIncomingNetworkFrames.size(); j++)
+ {
+ NetworkFrame &nf = mIncomingNetworkFrames[j];
+ uint32_t pcount = nf.mPrimCount;
+ const uint8_t *scan = static_cast<const uint8_t *>(nf.mData);
+ for (uint32_t i=0; i<pcount; i++)
+ {
+ RENDER_DEBUG::DebugPrimitive *prim = const_cast<RENDER_DEBUG::DebugPrimitive *>(reinterpret_cast<const RENDER_DEBUG::DebugPrimitive *>(scan));
+ if ( needEndianSwap )
+ {
+ endianSwap(prim);
+ }
+
+ switch ( uint32_t(prim->mCommand) )
+ {
+ case RENDER_DEBUG::DebugCommand::DEBUG_CREATE_TRIANGLE_MESH:
+ {
+ RENDER_DEBUG::DebugCreateTriangleMesh *d = static_cast< RENDER_DEBUG::DebugCreateTriangleMesh *>(prim);
+ uint32_t *hackMeshId = reinterpret_cast<uint32_t *>(d);
+ hackMeshId[2]+=mMeshId;
+ mUsedMeshId = true;
+ }
+ break;
+ case RENDER_DEBUG::DebugCommand::DEBUG_REFRESH_TRIANGLE_MESH_VERTICES:
+ {
+ RENDER_DEBUG::DebugRefreshTriangleMeshVertices *d = static_cast< RENDER_DEBUG::DebugRefreshTriangleMeshVertices *>(prim);
+ uint32_t *hackMeshId = reinterpret_cast<uint32_t *>(d);
+ hackMeshId[2]+=mMeshId;
+ mUsedMeshId = true;
+ }
+ break;
+ case RENDER_DEBUG::DebugCommand::DEBUG_RENDER_TRIANGLE_MESH_INSTANCES:
+ {
+ RENDER_DEBUG::DebugRenderTriangleMeshInstances *d = static_cast<RENDER_DEBUG::DebugRenderTriangleMeshInstances *>(prim);
+ uint32_t *hackMeshId = reinterpret_cast<uint32_t *>(d);
+ hackMeshId[2]+=mMeshId;
+ mUsedMeshId = true;
+ }
+ break;
+ case RENDER_DEBUG::DebugCommand::DEBUG_RENDER_POINTS:
+ {
+ RENDER_DEBUG::DebugRenderPoints *d = static_cast<RENDER_DEBUG::DebugRenderPoints *>(prim);
+ uint32_t *hackMeshId = reinterpret_cast<uint32_t *>(d);
+ hackMeshId[2]+=mMeshId;
+ mUsedMeshId = true;
+ }
+ break;
+ case RENDER_DEBUG::DebugCommand::DEBUG_CONVEX_HULL:
+ printf("Debug me");
+ break;
+ case RENDER_DEBUG::DebugCommand::DEBUG_RELEASE_TRIANGLE_MESH:
+ {
+ RENDER_DEBUG::DebugReleaseTriangleMesh *d = static_cast<RENDER_DEBUG::DebugReleaseTriangleMesh *>(prim);
+ d->mMeshId+=mMeshId;
+ mUsedMeshId = true;
+ }
+ break;
+ case RENDER_DEBUG::DebugCommand::DEBUG_SKIP_FRAME:
+ mSkipFrame = true;
+ break;
+ }
+ uint32_t plen = RENDER_DEBUG::DebugCommand::getPrimtiveSize(*prim);
+ scan+=plen;
+ }
+ }
+ endOfFrame = true;
+ if ( mSkipFrame )
+ {
+ mSkipFrame = false;
+ releaseIncomingNetworkFrames();
+ }
+ else
+ {
+ releaseNetworkFrames(); // release previous network frames
+ mNetworkFrames = mIncomingNetworkFrames;
+ mIncomingNetworkFrames.clear();
+ }
+ mCurrentNetworkFrame = nframe.mFrameCount;
+ mIncomingNetworkFrames.pushBack(nframe);
+
+ if ( mIsServer )
+ {
+ // if we are the server, we should send an ACK to the client so that they know that we processed their frame of data.
+ uint32_t ack = PT_ACK;
+ mCurrentCommLayer->sendMessage(&ack,sizeof(ack));
+ }
+ }
+ else
+ {
+ mIncomingNetworkFrames.pushBack(nframe);
+ }
+ }
+ break;
+ case PT_COMMAND:
+ if ( !mBadVersion )
+ {
+ NetworkCommmand c;
+ uint32_t *header = static_cast<uint32_t *>(readData);
+ c.mCommandLength = header[1];
+ if ( needEndianSwap )
+ {
+ swap4Bytes(&c.mCommandLength);
+ }
+ c.mCommand = static_cast<char*>(PX_ALLOC(c.mCommandLength+1,"NetworkCommand"));
+ physx::intrinsics::memCopy(c.mCommand,&header[2],c.mCommandLength+1);
+ mNetworkCommandMutex.lock();
+ mNetworkCommands.pushBack(c);
+ mNetworkCommandMutex.unlock();
+ }
+ break;
+ case PT_REMOTE_RESOURCE:
+ if ( !mBadVersion )
+ {
+ RemoteResourcePacket *rr = static_cast<RemoteResourcePacket *>(readData);
+ if ( needEndianSwap )
+ {
+ swap4Bytes(&rr->mLength);
+ swap4Bytes(&rr->mBigEndian);
+ }
+ uint32_t bigEndianPacket = isBigEndianPacket ? uint32_t(1) : uint32_t(0);
+ PX_UNUSED(bigEndianPacket);
+ PX_ASSERT( bigEndianPacket == rr->mBigEndian );
+ RemoteResource sr;
+ RemoteResourcePacket *prr = static_cast< RemoteResource *>(&sr);
+ *prr = *rr;
+ sr.mData = PX_ALLOC(sr.mLength,"RemoteResource");
+ rr++;
+ physx::intrinsics::memCopy(sr.mData,rr,sr.mLength);
+ mRemoteResources.pushBack(sr);
+ }
+ break;
+ case PT_INPUT_EVENT:
+ {
+ RENDER_DEBUG::InputEvent e = *static_cast<const RENDER_DEBUG::InputEvent *>(readData);
+ if ( needEndianSwap )
+ {
+ swap4Bytes(&e.mId);
+ swap4Bytes(&e.mCommunicationsFrame);
+ swap4Bytes(&e.mRenderFrame);
+ swap4Bytes(&e.mEventType);
+ swap4Bytes(&e.mSensitivity);
+ swap4Bytes(&e.mDigitalValue);
+ swap4Bytes(&e.mAnalogValue);
+ swap4Bytes(&e.mMouseX);
+ swap4Bytes(&e.mMouseY);
+ swap4Bytes(&e.mMouseDX);
+ swap4Bytes(&e.mMouseDY);
+ swap4Bytes(&e.mWindowSizeX);
+ swap4Bytes(&e.mWindowSizeY);
+ swap4Bytes(&e.mEyePosition[0]);
+ swap4Bytes(&e.mEyePosition[1]);
+ swap4Bytes(&e.mEyePosition[2]);
+ swap4Bytes(&e.mEyeDirection[0]);
+ swap4Bytes(&e.mEyeDirection[1]);
+ swap4Bytes(&e.mEyeDirection[2]);
+ }
+ mInputEvents.pushBack(e);
+ }
+ break;
+ case PT_REQUEST_REMOTE_RESOURCE:
+ if ( !mBadVersion )
+ {
+ const RequestRemoteResource *rr = static_cast<const RequestRemoteResource *>(readData);
+ if ( mRenderDebugResource )
+ {
+ uint32_t len;
+ const void *data = mRenderDebugResource->requestResource(rr->mNameSpace,rr->mResourceName,len);
+ if ( data )
+ {
+ sendRemoteResource(rr->mNameSpace,rr->mResourceName,data,len);
+ mRenderDebugResource->releaseResource(data,len,rr->mNameSpace,rr->mResourceName);
+ }
+ }
+ }
+ break;
+ case PT_FINALIZE_FRAME:
+ {
+ uint32_t *header = static_cast<uint32_t *>(readData);
+ if ( needEndianSwap )
+ {
+ swap4Bytes(&header[1]);
+ }
+ mCurrentNetworkFrame = header[1];
+ if ( mIsServer )
+ {
+ // if we are the server, we should send an ACK to the client so that they know that we processed their frame of data.
+ uint32_t ack = PT_ACK;
+ mCurrentCommLayer->sendMessage(&ack,sizeof(ack));
+ }
+ }
+ break;
+ case PT_ACK:
+ mReceivedAck = true;
+ break;
+ }
+ }
+ if ( freeReadData )
+ {
+ PX_FREE(readData);
+ }
+ newDataSize = mCurrentCommLayer->peekMessage(isBigEndianPacket);
+ }
+
+ }
+
+ void processFrame(RENDER_DEBUG::ProcessRenderDebug *processRenderDebug,RENDER_DEBUG::RenderDebugInterface *iface)
+ {
+ if ( !mCurrentCommLayer ) return;
+
+ if ( mIsServer )
+ {
+ if ( mCommStream && !mCommStream->isValid() )
+ {
+ mCommStream->release();
+ mCommStream = NULL;
+ mCurrentCommLayer = mCommLayer;
+ }
+ if ( mCurrentCommLayer->hasClient() )
+ {
+ mWasConnected = true;
+ }
+ else if ( mWasConnected )
+ {
+ if ( mCommStream )
+ {
+ internalSetStreamFilename(mStreamName);
+ }
+ mWasConnected = false;
+ }
+ }
+
+
+ if ( !mCurrentCommLayer->isConnected() ) return;
+
+ processNetworkData();
+
+ if ( !mNetworkFrames.empty() )
+ {
+ uint32_t lastDisplayType = 0;
+
+ for (uint32_t j=0; j<mNetworkFrames.size(); j++)
+ {
+ NetworkFrame &nf = mNetworkFrames[j];
+
+ if ( j == 0 )
+ {
+ lastDisplayType = nf.mPrimType;
+ }
+
+ uint32_t ipcount = nf.mPrimCount;
+ if ( ipcount > MAX_SEND_BUFFER )
+ {
+ ipcount = MAX_SEND_BUFFER;
+ }
+ const uint8_t *scan = static_cast<const uint8_t *>(nf.mData);
+ uint32_t pcount = 0;
+ for (uint32_t i=0; i<ipcount; i++)
+ {
+ RENDER_DEBUG::DebugPrimitive *prim = const_cast<RENDER_DEBUG::DebugPrimitive *>(reinterpret_cast<const RENDER_DEBUG::DebugPrimitive *>(scan));
+ bool includePrimitive = true;
+ if ( mCurrentNetworkFrame == mLastProcessNetworkFrame )
+ {
+ switch ( uint32_t(prim->mCommand) )
+ {
+ case RENDER_DEBUG::DebugCommand::DEBUG_MESSAGE:
+ case RENDER_DEBUG::DebugCommand::DEBUG_CREATE_TRIANGLE_MESH:
+ case RENDER_DEBUG::DebugCommand::DEBUG_REFRESH_TRIANGLE_MESH_VERTICES:
+ case RENDER_DEBUG::DebugCommand::DEBUG_RELEASE_TRIANGLE_MESH:
+ case RENDER_DEBUG::DebugCommand::DEBUG_CREATE_CUSTOM_TEXTURE:
+ case RENDER_DEBUG::DebugCommand::DEBUG_REGISTER_INPUT_EVENT:
+ case RENDER_DEBUG::DebugCommand::DEBUG_RESET_INPUT_EVENTS:
+ case RENDER_DEBUG::DebugCommand::DEBUG_UNREGISTER_INPUT_EVENT:
+ case RENDER_DEBUG::DebugCommand::DEBUG_SKIP_FRAME:
+ includePrimitive = false;
+ break;
+ }
+ }
+ if ( includePrimitive )
+ {
+ mDebugPrimitives[pcount] = prim;
+ pcount++;
+ }
+ uint32_t plen = RENDER_DEBUG::DebugCommand::getPrimtiveSize(*prim);
+ scan+=plen;
+ }
+ if ( lastDisplayType != nf.mPrimType )
+ {
+ processRenderDebug->flush(iface,static_cast<RENDER_DEBUG::ProcessRenderDebug::DisplayType>(lastDisplayType));
+ lastDisplayType = nf.mPrimType;
+ }
+ processRenderDebug->processRenderDebug(const_cast<const RENDER_DEBUG::DebugPrimitive **>(reinterpret_cast<RENDER_DEBUG::DebugPrimitive **>(mDebugPrimitives)),
+ pcount,
+ iface,
+ static_cast<RENDER_DEBUG::ProcessRenderDebug::DisplayType>(nf.mPrimType));
+ }
+ processRenderDebug->flush(iface,static_cast<RENDER_DEBUG::ProcessRenderDebug::DisplayType>(lastDisplayType));
+ processRenderDebug->flushFrame(iface);
+ mLastProcessNetworkFrame = mCurrentNetworkFrame;
+ }
+ }
+
+ void releaseNetworkCommands(void)
+ {
+ for (uint32_t i=0; i<mNetworkCommands.size(); i++)
+ {
+ NetworkCommmand nc = mNetworkCommands[i];
+ PX_FREE(nc.mCommand);
+ }
+ mNetworkCommands.clear();
+ }
+
+ void releaseNetworkFrames(void)
+ {
+ for (uint32_t i=0; i<mNetworkFrames.size(); i++)
+ {
+ NetworkFrame &nf = mNetworkFrames[i];
+ PX_FREE(nf.mBaseData);
+ }
+ mNetworkFrames.clear();
+ }
+
+ void releaseIncomingNetworkFrames(void)
+ {
+ for (uint32_t i=0; i<mIncomingNetworkFrames.size(); i++)
+ {
+ NetworkFrame &nf = mIncomingNetworkFrames[i];
+ PX_FREE(nf.mBaseData);
+ }
+ mIncomingNetworkFrames.clear();
+ }
+
+
+ virtual bool serverWait(void)
+ {
+ bool ret = false;
+
+ // Here we wait up until the maximum wait count to receive an ack from the server.
+ if ( !mIsServer && mCurrentCommLayer && mCurrentCommLayer->isConnected() )
+ {
+ if ( mReceivedAck )
+ {
+ mReceivedAck = false;
+ }
+ else
+ {
+ bool ok = false;
+ for (uint32_t i=0; i<mMaxServerWait; i++)
+ {
+ if ( !isConnected() )
+ {
+ ok = false;
+ break;
+ }
+ processNetworkData();
+ if ( mReceivedAck )
+ {
+ mReceivedAck = false;
+ ok = true;
+ break;
+ }
+ else
+ {
+ mTime.getElapsedSeconds();
+ physx::shdfnd::Time::Second diff = mTime.peekElapsedSeconds();
+ while ( diff < 0.001 )
+ {
+ diff = mTime.peekElapsedSeconds();
+ processNetworkData();
+ if ( mReceivedAck )
+ {
+ mReceivedAck = false;
+ ok = true;
+ break;
+ }
+ physx::shdfnd::Thread::sleep(0); // we are low priority since we are in a wait loop, give up timeslice to other thread if necessary
+ }
+ if ( ok )
+ {
+ break;
+ }
+ if ( mServerStallCallback )
+ {
+ if ( !mServerStallCallback->continueWaitingForServer(i+1) )
+ {
+ ok = false;
+ break;
+ }
+ }
+ }
+ }
+ if ( !ok )
+ {
+ mCurrentCommLayer = NULL;
+ if ( mCommLayer )
+ {
+ mCommLayer->release();
+ mCommLayer = NULL;
+ }
+ if ( mCommStream )
+ {
+ mCommStream->release();
+ mCommStream = NULL;
+ }
+
+ releaseNetworkFrames();
+ }
+ }
+ }
+
+ return ret;
+ }
+
+ virtual const char **getCommand(uint32_t &argc)
+ {
+ const char **ret = NULL;
+ argc = 0;
+
+ mNetworkCommandMutex.lock();
+
+ if ( !mNetworkCommands.empty() )
+ {
+ NetworkCommmand nc = mNetworkCommands[0];
+ mNetworkCommands.remove(0);
+ physx::intrinsics::memCopy(mCurrentCommand,nc.mCommand,nc.mCommandLength+1);
+ PX_FREE(nc.mCommand);
+ ret = mParser.getArgs(mCurrentCommand,argc);
+ }
+
+ mNetworkCommandMutex.unlock();
+
+ return ret;
+ }
+
+ virtual bool sendCommand(const char *cmd)
+ {
+ bool ret = false;
+
+ if ( cmd && mCurrentCommLayer)
+ {
+ uint32_t slen = uint32_t(strlen(cmd));
+ if ( slen < MAX_SERVER_COMMAND_STRING )
+ {
+ uint32_t sendSize = sizeof(uint32_t)*2+slen+1;
+ uint32_t *sendData = static_cast<uint32_t *>(PX_ALLOC(sendSize,"SendCommand"));
+ sendData[0] = PT_COMMAND;
+ sendData[1] = slen;
+ physx::intrinsics::memCopy(&sendData[2],cmd,slen+1);
+ mCurrentCommLayer->sendMessage(sendData,sendSize);
+ PX_FREE(sendData);
+ ret = true;
+ }
+ }
+
+ return ret;
+ }
+
+ virtual bool isConnected(void)
+ {
+ if ( !mCurrentCommLayer ) return false;
+ if ( mIsServer )
+ {
+ bool hasClient = mCurrentCommLayer->hasClient();
+ if ( !hasClient && mUsedMeshId )
+ {
+ mUsedMeshId = false;
+ mMeshId+=10000; // increment the baseline mesh-id for the next time the client runs.
+ mHaveApplicationName = false;
+ }
+ return hasClient;
+ }
+ return mCurrentCommLayer->isConnected();
+ }
+
+ virtual uint32_t getCommunicationsFrame(void) const
+ {
+ if ( mIsServer )
+ {
+ return mCurrentNetworkFrame;
+ }
+ return mLastFrame;
+ }
+
+ virtual void finalizeFrame(uint32_t frameCount)
+ {
+ if ( mDataSent )
+ {
+ mDataSent = false;
+ return;
+ }
+ if ( !mCurrentCommLayer )
+ {
+ return;
+ }
+ if ( mIsServer )
+ {
+ return;
+ }
+
+ if ( !mCurrentCommLayer->isConnected() )
+ {
+ return;
+ }
+ uint32_t packet[2];
+ packet[0] = PT_FINALIZE_FRAME;
+ packet[1] = frameCount;
+ mCurrentCommLayer->sendMessage(packet,sizeof(packet));
+ }
+
+ virtual const char * getRemoteApplicationName(void)
+ {
+ const char *ret = NULL;
+
+ if ( mIsServer && mHaveApplicationName )
+ {
+ ret = mApplicationName;
+ }
+
+ return ret;
+ }
+
+ /**
+ \brief Transmits an arbitrary block of binary data to the remote machine. The block of data can have a command and id associated with it.
+
+ It is important to note that due to the fact the RenderDebug system is synchronized every single frame, it is strongly recommended
+ that you only use this feature for relatively small data items; probably on the order of a few megabytes at most. If you try to do
+ a very large transfer, in theory it would work, but it might take a very long time to complete and look like a hang since it will
+ essentially be blocking.
+
+ \param nameSpace The namespace associated with this data transfer, for example this could indicate a remote file request.
+ \param resourceName The name of the resource associated with this data transfer, for example the id could be the file name of a file transfer request.
+ \param data The block of binary data to transmit, you are responsible for maintaining endian correctness of the internal data if necessary.
+ \param dlen The length of the lock of data to transmit.
+
+ \return Returns true if the data was queued to be transmitted, false if it failed.
+ */
+ virtual bool sendRemoteResource(const char *nameSpace,
+ const char *resourceName,
+ const void *data,
+ uint32_t dlen)
+ {
+ bool ret = false;
+
+ if ( mCurrentCommLayer && mCurrentCommLayer->isConnected() && data && dlen )
+ {
+ uint32_t sendLen = sizeof(RemoteResourcePacket)+dlen;
+ RemoteResourcePacket *sendPacket = static_cast<RemoteResourcePacket*>(PX_ALLOC(sendLen,"RemoteResource"));
+ RemoteResourcePacket &rr = *sendPacket;
+
+ rr.mCommand = PT_REMOTE_RESOURCE;
+ rr.mLength = dlen;
+ rr.mBigEndian = isBigEndian() ? uint32_t( 1) : uint32_t( 0);
+ physx::shdfnd::strlcpy(rr.mNameSpace,MAX_RESOURCE_STRING,nameSpace);
+ physx::shdfnd::strlcpy(rr.mResourceName,MAX_RESOURCE_STRING,resourceName);
+ RemoteResourcePacket *dest = sendPacket;
+ dest++;
+ physx::intrinsics::memCopy(dest,data,dlen);
+ ret = mCurrentCommLayer->sendMessage(sendPacket,sendLen);
+ PX_FREE(sendPacket);
+
+ }
+
+
+ return ret;
+ }
+
+ /**
+ \brief This function allows you to request a file from the remote machine by name. If successful it will be returned via 'getRemoteData'
+
+ \param nameSpace The namespace field associated with this request which will be returned by 'getRemoteData'
+ \param resourceName The resource name being requested from the remote machine.
+
+ \return Returns true if the request was queued to be transmitted, false if it failed.
+ */
+ virtual bool requestRemoteResource(const char *nameSpace,
+ const char *resourceName)
+ {
+ bool ret = false;
+
+ if ( mCurrentCommLayer && mCurrentCommLayer->isConnected() )
+ {
+ RequestRemoteResource rr;
+ rr.mCommand = PT_REQUEST_REMOTE_RESOURCE;
+ physx::shdfnd::strlcpy(rr.mNameSpace,MAX_RESOURCE_STRING,nameSpace);
+ physx::shdfnd::strlcpy(rr.mResourceName,MAX_RESOURCE_STRING,resourceName);
+ ret = mCurrentCommLayer->sendMessage(&rr,sizeof(rr));
+ }
+
+ return ret;
+ }
+
+ /**
+ \brief Retrieves a block of remotely transmitted binary data.
+
+ \param nameSpace A a reference to a pointer which will store the namespace associated with this data transfer, for example this could indicate a remote file request.
+ \param resourceName A reference to a pointer which will store the resource name associated with this data transfer, for example the id could be the file name of a file transfer request.
+ \param dlen A reference that will contain length of the lock of data received.
+ \param remoteIsBigEndian A reference to a boolean which will be set to true if the remote machine that sent this data is big endian format.
+
+ \retrun A pointer to the block of data received.
+ */
+ virtual const void * getRemoteResource(const char *&nameSpace,
+ const char *&resourceName,
+ uint32_t &dlen,
+ bool &remoteIsBigEndian)
+ {
+ const void *ret = NULL;
+
+ nameSpace = NULL;
+ resourceName = NULL;
+ dlen = 0;
+ remoteIsBigEndian = 0;
+ if ( !mRemoteResources.empty() )
+ {
+ if ( mCurrentRemoteResource.mData )
+ {
+ PX_FREE(mCurrentRemoteResource.mData);
+ mCurrentRemoteResource.mData = NULL;
+ }
+ mCurrentRemoteResource = mRemoteResources[0];
+ mRemoteResources.remove(0);
+
+ ret = mCurrentRemoteResource.mData;
+ nameSpace = mCurrentRemoteResource.mNameSpace;
+ resourceName = mCurrentRemoteResource.mResourceName;
+ dlen = mCurrentRemoteResource.mLength;
+ remoteIsBigEndian = mCurrentRemoteResource.mBigEndian ? true : false;
+
+ }
+
+ return ret;
+ }
+
+ void releaseRemoteResources(void)
+ {
+ if ( mCurrentRemoteResource.mData )
+ {
+ PX_FREE(mCurrentRemoteResource.mData);
+ mCurrentRemoteResource.mData = NULL;
+ }
+ for (uint32_t i=0; i<mRemoteResources.size(); i++)
+ {
+ RemoteResource &rr = mRemoteResources[i];
+ PX_FREE(rr.mData);
+ }
+ mRemoteResources.clear();
+ }
+
+ virtual void sendInputEvent(const RENDER_DEBUG::InputEvent &ev)
+ {
+ if ( mCurrentCommLayer )
+ {
+ RENDER_DEBUG::InputEvent e = ev;
+ e.mReserved = PT_INPUT_EVENT;
+ mCurrentCommLayer->sendMessage(&e,sizeof(RENDER_DEBUG::InputEvent));
+ }
+ }
+
+ virtual const RENDER_DEBUG::InputEvent *getInputEvent(bool flush)
+ {
+ const RENDER_DEBUG::InputEvent *ret = NULL;
+
+ if ( !mInputEvents.empty() )
+ {
+ mCurrentInputEvent = mInputEvents[0];
+ ret = &mCurrentInputEvent;
+ if ( flush )
+ {
+ mInputEvents.remove(0);
+ }
+ }
+
+ return ret;
+ }
+
+ /**
+ \brief Set the base file name to record communications stream; or NULL to disable it.
+
+ \param fileName The base name of the file to record the communications channel stream to, or NULL to disable it.
+ */
+ virtual bool setStreamFilename(const char *fileName)
+ {
+ if ( fileName )
+ {
+ physx::shdfnd::strlcpy(mStreamName,256,fileName);
+ }
+ else
+ {
+ mStreamName[0] = 0;
+ if ( mCommStream )
+ {
+ mCommStream->release();
+ mCommStream = NULL;
+ }
+ }
+ return internalSetStreamFilename(mStreamName);
+ }
+
+ bool internalSetStreamFilename(const char *fileName)
+ {
+ bool ret = true;
+
+ mCurrentCommLayer = mCommLayer;
+
+ if ( mIsServer && fileName[0] )
+ {
+ if ( mCommStream )
+ {
+ mCommStream->release();
+ mCommStream = NULL;
+ }
+ if ( fileName )
+ {
+ char scratch[512];
+ sprintf(scratch,"%s%02d.nvcs", fileName, mStreamCount );
+ mCommStream = createCommStream(scratch,true,mCommLayer);
+ if ( mCommStream )
+ {
+ mStreamCount++;
+ mCurrentCommLayer = static_cast< CommLayer *>(mCommStream);
+ }
+ else
+ {
+ ret = false;
+ }
+ }
+ }
+ return ret;
+ }
+
+ /**
+ \brief Begin playing back a communications stream recording
+
+ \param fileName The name of the previously captured communications stream file
+ */
+ virtual bool setStreamPlayback(const char *fileName)
+ {
+ if ( !mIsServer ) return false;
+ if ( mCommLayer->hasClient() ) return false;
+ if ( mCommStream )
+ {
+ mCommStream->release();
+ mCommStream = NULL;
+ }
+ bool ret = false;
+ mCurrentCommLayer = mCommLayer;
+ mCommStream = createCommStream(fileName,false,mCommLayer);
+ if ( mCommStream )
+ {
+ ret = true;
+ mCurrentCommLayer = mCommStream;
+ }
+ return ret;
+ }
+
+ bool mSkipFrame;
+ char mStreamName[256];
+ uint32_t mStreamCount;
+ bool mWasConnected;
+ bool mDataSent; // whether or not any data was sent this frame
+ bool mBadVersion;
+ bool mReceivedAck;
+ uint32_t mMeshId;
+ bool mUsedMeshId;
+ uint32_t mLastFrame;
+ bool mIsServer;
+ RENDER_DEBUG::DebugPrimitive *mDebugPrimitives[MAX_SEND_BUFFER];
+ char mCurrentCommand[MAX_SERVER_COMMAND_STRING];
+ CommLayer *mCommLayer;
+ CommStream *mCommStream;
+ CommLayer *mCurrentCommLayer;
+ uint32_t mLastProcessNetworkFrame;
+ uint32_t mCurrentNetworkFrame;
+ NetworkFrameArray mIncomingNetworkFrames;
+ NetworkFrameArray mNetworkFrames;
+ NetworkCommandArray mNetworkCommands;
+ physx::shdfnd::Mutex mNetworkCommandMutex;
+ uint32_t mMaxServerWait;
+ RENDER_DEBUG::RenderDebug::ServerStallCallback *mServerStallCallback;
+ bool mHaveApplicationName;
+ char mApplicationName[512];
+ GetArgs mParser;
+ RENDER_DEBUG::RenderDebugResource *mRenderDebugResource;
+ RemoteResource mCurrentRemoteResource;
+ RemoteResourceArray mRemoteResources;
+ RENDER_DEBUG::InputEvent mCurrentInputEvent;
+ InputEventArray mInputEvents;
+ physx::shdfnd::Time mTime;
+};
+
+ClientServer *createClientServer(RENDER_DEBUG::RenderDebug::Desc &desc)
+{
+ ClientServer *ret = NULL;
+ desc.errorCode = NULL;
+ ClientServerImpl *c = PX_NEW(ClientServerImpl)(desc);
+ if ( desc.errorCode )
+ {
+ c->release();
+ }
+ else
+ {
+ ret = static_cast< ClientServer *>(c);
+ }
+ return ret;
+}
diff --git a/APEX_1.4/shared/general/RenderDebug/src/FileRenderDebug.cpp b/APEX_1.4/shared/general/RenderDebug/src/FileRenderDebug.cpp
new file mode 100644
index 00000000..52355e90
--- /dev/null
+++ b/APEX_1.4/shared/general/RenderDebug/src/FileRenderDebug.cpp
@@ -0,0 +1,621 @@
+// This code contains NVIDIA Confidential Information and is disclosed to you
+// under a form of NVIDIA software license agreement provided separately to you.
+//
+// Notice
+// NVIDIA Corporation and its licensors retain all intellectual property and
+// proprietary rights in and to this software and related documentation and
+// any modifications thereto. Any use, reproduction, disclosure, or
+// distribution of this software and related documentation without an express
+// license agreement from NVIDIA Corporation is strictly prohibited.
+//
+// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
+// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
+// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
+// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// Information and code furnished is believed to be accurate and reliable.
+// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
+// information or for any infringement of patents or other rights of third parties that may
+// result from its use. No license is granted by implication or otherwise under any patent
+// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
+// This code supersedes and replaces all information previously supplied.
+// NVIDIA Corporation products are not authorized for use as critical
+// components in life support devices or systems without express written approval of
+// NVIDIA Corporation.
+//
+// Copyright (c) 2008-2013 NVIDIA Corporation. All rights reserved.
+#include "FileRenderDebug.h"
+#include "PsFileBuffer.h"
+#include "ProcessRenderDebug.h"
+#include "ClientServer.h"
+#include "PsArray.h"
+#include "PsUserAllocated.h"
+
+namespace RENDER_DEBUG
+{
+
+static char magic[4] = { 'D', 'E', 'B', 'G' };
+
+#define DEFAULT_FRAME_BUFFER_SIZE (1024*1024)*128 // default size is 16mb per frame.
+
+static uint32_t isBigEndian(void)
+{
+ int32_t i = 1;
+ bool b = *(reinterpret_cast<char*>(&i))==0;
+ return b ? uint32_t(1) : uint32_t(0);
+}
+
+class DataStream
+{
+public:
+ DataStream(void)
+ {
+ mWriteBufferLoc = 0;
+ mWriteBufferEnd = NULL;
+ mReadBuffer = NULL;
+ mReadBufferLoc = 0;
+ }
+
+ void initWriteBuffer(void *_writeBuffer,uint32_t writeBufferLen)
+ {
+ uint8_t *writeBuffer = reinterpret_cast<uint8_t*>(_writeBuffer);
+ mWriteBufferLoc = mWriteBuffer = writeBuffer;
+ mWriteBufferEnd = writeBuffer+writeBufferLen;
+ mReadBuffer = NULL;
+ }
+
+ void initReadBuffer(const void *readBuffer)
+ {
+ mReadBufferLoc = mReadBuffer = reinterpret_cast<const uint8_t *>(readBuffer);
+ mWriteBufferLoc = NULL;
+ mWriteBufferEnd = NULL;
+ mWriteBuffer = NULL;
+ }
+
+ // store data of this type to the output stream
+ template <class Type > PX_INLINE void operator<<(Type v)
+ {
+ PX_ASSERT(mWriteBuffer);
+ PX_ASSERT(mWriteBufferLoc);
+ if ( (mWriteBufferLoc+sizeof(Type)) < mWriteBufferEnd )
+ {
+ *reinterpret_cast<Type*>(mWriteBufferLoc) = v;
+ mWriteBufferLoc+=sizeof(Type);
+ }
+ else
+ {
+ PX_ASSERT(0);
+ }
+ }
+
+ template <class Type> PX_INLINE void operator>>(Type &v)
+ {
+ v = *reinterpret_cast<const Type*>(mReadBufferLoc);
+ mReadBufferLoc+=sizeof(Type);
+ }
+
+ void readData(void *dest,uint32_t len)
+ {
+ memcpy(dest,mReadBufferLoc,len);
+ mReadBufferLoc+=len;
+ }
+
+ PX_INLINE void writeString(const char *c)
+ {
+ uint32_t len = c ? uint32_t(strlen(c)) : 0;
+ PX_ASSERT(mWriteBuffer);
+ PX_ASSERT(mWriteBufferLoc);
+ if ( (mWriteBufferLoc+len+sizeof(uint32_t) ) < mWriteBufferEnd )
+ {
+ *reinterpret_cast<uint32_t*>(mWriteBufferLoc) = len;
+ mWriteBufferLoc+=sizeof(uint32_t);
+ if ( len )
+ {
+ memcpy(mWriteBufferLoc,c,len);
+ }
+ mWriteBufferLoc+=len;
+ }
+ else
+ {
+ PX_ASSERT(0);
+ }
+ }
+
+ PX_INLINE void readString(char *str,uint32_t maxLen)
+ {
+ uint32_t slen;
+ (*this) >> slen;
+ PX_UNUSED(maxLen);
+ PX_ASSERT( slen < maxLen );
+ memcpy(str,mReadBufferLoc,slen);
+ str[slen] = 0;
+ mReadBufferLoc+=slen;
+ }
+
+ PX_INLINE void writeBuffer(const void *buffer,uint32_t len)
+ {
+ PX_ASSERT(mWriteBufferLoc);
+ if ( (mWriteBufferLoc+len ) < mWriteBufferEnd )
+ {
+ if ( len )
+ {
+ memcpy(mWriteBufferLoc,buffer,len);
+ }
+ mWriteBufferLoc+=len;
+ }
+ else
+ {
+ PX_ASSERT(0);
+ }
+ }
+
+ PX_INLINE uint32_t getWriteBufferLength(void) const
+ {
+ return uint32_t(mWriteBufferLoc-mWriteBuffer);
+ }
+
+ PX_INLINE void * getWriteBufferLoc(void) const
+ {
+ return mWriteBufferLoc;
+ }
+
+ PX_INLINE void * getWriteBuffer(void) const
+ {
+ return mWriteBuffer;
+ }
+
+ PX_INLINE uint32_t getReadBufferLength(void) const
+ {
+ return uint32_t(mReadBufferLoc-mReadBuffer);
+ }
+
+ PX_INLINE const void *getReadBuffer(void) const
+ {
+ return mReadBuffer;
+ }
+
+ PX_INLINE void reset(void)
+ {
+ mWriteBufferLoc = mWriteBuffer;
+ mReadBufferLoc = mReadBuffer;
+ }
+
+ // returns the current read buffer address and advances the read pointer past the length we are consuming.
+ // avoids a memory copy
+ PX_INLINE const void * getAdvanceReadLoc(uint32_t len)
+ {
+ const void *ret = mReadBufferLoc;
+ mReadBufferLoc+=len;
+ return ret;
+ }
+
+private:
+ uint8_t *mWriteBuffer;
+ uint8_t *mWriteBufferLoc;
+ uint8_t *mWriteBufferEnd;
+ const uint8_t *mReadBuffer;
+ const uint8_t *mReadBufferLoc;
+};
+
+
+struct FrameHeader
+{
+ void init(void)
+ {
+ mSeekLocation = 0;
+ mItemCount = 0;
+ mItemSize = 0;
+ }
+ uint32_t mSeekLocation;
+ uint32_t mItemCount;
+ uint32_t mItemSize;
+};
+
+struct PrimitiveBatch
+{
+ uint32_t mPrimitiveType;
+ uint32_t mPrimitiveCount;
+ uint32_t mPrimitiveIndex;
+};
+
+struct TypeHeader
+{
+ TypeHeader(void)
+ {
+ mSeekLocation = 0;
+ mDisplayType = ProcessRenderDebug::DT_LAST;
+ mPrimitiveCount = 0;
+ }
+
+ void init(ProcessRenderDebug::DisplayType type)
+ {
+ mSeekLocation = 0;
+ mDisplayType = type;
+ mPrimitiveCount = 0;
+ }
+
+ uint32_t mSeekLocation;
+ uint32_t mDisplayType;
+ uint32_t mPrimitiveCount;
+};
+
+
+class FileRenderDebugImpl : public FileRenderDebug, public physx::shdfnd::UserAllocated
+{
+public:
+ FileRenderDebugImpl(const char *fileName,bool readAccess,ProcessRenderDebug *echoLocally,ClientServer *cs) :
+ mPrimitiveBatch(PX_DEBUG_EXP("FileRenderDebugImpl::mPrimitiveBatch")),
+ mFrameHeaders(PX_DEBUG_EXP("FileRenderDebugImpl::mFrameHeaders"))
+ {
+ mEndianSwap = false;
+ mClientServer = cs;
+ mLastDisplayType = ProcessRenderDebug::DT_LAST;
+ mData = NULL;
+ mPrimitives = NULL;
+ mPrimitiveCount = 0;
+ mCurrentFrame = 0xFFFFFFFF;
+ mFrameItemCount = 0;
+ mFrameStart = 0;
+ mFrameCount = 1;
+ mReadAccess = readAccess;
+ mEchoLocally = echoLocally;
+ mMaxFrameBufferSize = DEFAULT_FRAME_BUFFER_SIZE;
+ mWriteBufferData = PX_ALLOC(mMaxFrameBufferSize,"FileRenderDebugFrameBuffer");
+ mWriteBuffer.initWriteBuffer(mWriteBufferData,mMaxFrameBufferSize);
+ mFileBuffer = NULL;
+
+ if ( mClientServer == NULL && fileName )
+ {
+ mFileBuffer = PX_NEW(physx::PsFileBuffer)(fileName, readAccess ? physx::PsFileBuffer::OPEN_READ_ONLY : physx::PsFileBuffer::OPEN_WRITE_ONLY);
+ if ( mFileBuffer->isOpen() )
+ {
+ if ( mReadAccess )
+ {
+ char temp[4];
+ uint32_t r = mFileBuffer->read(temp,4);
+ uint32_t version = mFileBuffer->readDword();
+ uint32_t bigEndian = mFileBuffer->readDword();
+
+ if ( r == 4 && magic[0] == temp[0] && magic[1] == temp[1] && magic[2] == temp[2] && magic[3] == temp[3] && version == RENDER_DEBUG_COMM_VERSION )
+ {
+ if ( bigEndian != isBigEndian() )
+ {
+ mEndianSwap = true;
+ }
+ // it's valid!
+ FrameHeader h;
+ while ( readFrameHeader(h,*mFileBuffer ) )
+ {
+ mFrameHeaders.pushBack(h);
+ }
+ mFrameCount = mFrameHeaders.size();
+ }
+ else
+ {
+ delete mFileBuffer;
+ mFileBuffer = NULL;
+ }
+ }
+ else
+ {
+ mFileBuffer->write(magic, 4 );
+ mFileBuffer->storeDword(RENDER_DEBUG_COMM_VERSION);
+ uint32_t bigEndian = isBigEndian();
+ mFileBuffer->storeDword(bigEndian);
+ mFileBuffer->flush();
+ }
+
+ }
+ else
+ {
+ delete mFileBuffer;
+ mFileBuffer = NULL;
+ }
+ }
+ }
+
+ bool readFrameHeader(FrameHeader &h,physx::PsFileBuffer &fph)
+ {
+ bool ret = false;
+
+ h.init();
+ h.mItemCount = fph.readDword();
+ h.mItemSize = fph.readDword();
+ h.mSeekLocation = fph.tellRead();
+ if ( h.mItemCount > 0 && h.mItemSize > 0 )
+ {
+ fph.seekRead(h.mSeekLocation+h.mItemSize);
+ ret = true;
+ }
+ return ret;
+ }
+
+ virtual ~FileRenderDebugImpl(void)
+ {
+ reset();
+ PX_FREE(mWriteBufferData);
+ if(mFileBuffer)
+ {
+ mFileBuffer->close();
+ delete mFileBuffer;
+ }
+ }
+
+ virtual ProcessRenderDebug * getEchoLocal(void) const
+ {
+ return mEchoLocally;
+ }
+
+ bool isOk(void) const
+ {
+ if ( mClientServer ) return true;
+ if ( mReadAccess && getFrameCount() == 0 ) return false;
+ return mFileBuffer ? true : false;
+ }
+
+ virtual void processRenderDebug(const DebugPrimitive **dplist,
+ uint32_t pcount,
+ RENDER_DEBUG::RenderDebugInterface *iface,
+ ProcessRenderDebug::DisplayType type)
+ {
+ if ( !mReadAccess )
+ {
+ PX_ASSERT(pcount);
+ if ( mFrameStart == 0 )
+ {
+ uint32_t pv = 0;
+ if ( mFileBuffer )
+ {
+ mFrameStart = mFileBuffer->tellWrite();
+ mFileBuffer->storeDword(pv);
+ mFileBuffer->storeDword(pv);
+ }
+ }
+ if ( type != mLastDisplayType )
+ {
+ flushDisplayType(mLastDisplayType);
+ beginDisplayType(type);
+ }
+ mTypeHeaders[type].mPrimitiveCount+=pcount;
+ for (uint32_t i=0; i<pcount; i++)
+ {
+ const DebugPrimitive *dp = dplist[i];
+ uint32_t plen = DebugCommand::getPrimtiveSize(*dp);
+ mWriteBuffer.writeBuffer(dp,plen);
+ }
+
+ if ( mFileBuffer )
+ {
+ mFileBuffer->write(mWriteBuffer.getWriteBuffer(),mWriteBuffer.getWriteBufferLength());
+ }
+ else if ( mClientServer )
+ {
+ mClientServer->recordPrimitives(mFrameCount,type,pcount,mWriteBuffer.getWriteBufferLength(),mWriteBuffer.getWriteBuffer());
+ }
+
+ mWriteBuffer.initWriteBuffer(mWriteBufferData,mMaxFrameBufferSize);
+ mFrameItemCount+=pcount;
+ }
+
+ if ( mEchoLocally )
+ {
+ mEchoLocally->processRenderDebug(dplist,pcount,iface,type);
+ }
+ }
+
+ void flushDisplayType(DisplayType type)
+ {
+ if ( type != ProcessRenderDebug::DT_LAST && mTypeHeaders[type].mDisplayType != ProcessRenderDebug::DT_LAST )
+ {
+ if ( mFileBuffer )
+ {
+ uint32_t loc = mFileBuffer->tellWrite();
+ mFileBuffer->seekWrite( mTypeHeaders[type].mSeekLocation );
+ mFileBuffer->storeDword( mTypeHeaders[type].mDisplayType );
+ mFileBuffer->storeDword( mTypeHeaders[type].mPrimitiveCount );
+ mFileBuffer->seekWrite( loc );
+ }
+ mTypeHeaders[type].init(ProcessRenderDebug::DT_LAST);
+ mLastDisplayType = ProcessRenderDebug::DT_LAST;
+ }
+ }
+
+ void beginDisplayType(DisplayType type)
+ {
+ mTypeHeaders[type].init(type);
+ if ( mFileBuffer )
+ {
+ mTypeHeaders[type].mSeekLocation = mFileBuffer->tellWrite();
+ mFileBuffer->storeDword( mTypeHeaders[type].mDisplayType );
+ mFileBuffer->storeDword( mTypeHeaders[type].mPrimitiveCount );
+ }
+ mLastDisplayType = type;
+ }
+
+ virtual void flush(RENDER_DEBUG::RenderDebugInterface *iface,ProcessRenderDebug::DisplayType type)
+ {
+ if ( !mReadAccess )
+ {
+ flushDisplayType(type);
+ }
+ if ( mEchoLocally )
+ {
+ mEchoLocally->flush(iface,type);
+ }
+ }
+
+ virtual void release(void)
+ {
+ delete this;
+ }
+
+ virtual void processReadFrame(RENDER_DEBUG::RenderDebugInterface *iface)
+ {
+ if ( mReadAccess && mEchoLocally )
+ {
+ for (uint32_t i=0; i<mPrimitiveBatch.size(); i++)
+ {
+ PrimitiveBatch &b = mPrimitiveBatch[i];
+ mEchoLocally->processRenderDebug(&mPrimitives[b.mPrimitiveIndex],b.mPrimitiveCount,iface,static_cast<ProcessRenderDebug::DisplayType>(b.mPrimitiveType));
+ mEchoLocally->flush(iface,static_cast<ProcessRenderDebug::DisplayType>(b.mPrimitiveType));
+ }
+ }
+
+ }
+
+ virtual void flushFrame(RENDER_DEBUG::RenderDebugInterface *iface)
+ {
+ PX_UNUSED(iface);
+ }
+
+ virtual void finalizeFrame(void)
+ {
+ if ( mFileBuffer )
+ {
+ if ( mFrameItemCount )
+ {
+ if ( mFileBuffer )
+ {
+ uint32_t current = mFileBuffer->tellWrite();
+ uint32_t frameLength = (current-mFrameStart)-( sizeof(uint32_t)*2 );
+ mFileBuffer->seekWrite(mFrameStart);
+ mFileBuffer->storeDword(mFrameItemCount);
+ mFileBuffer->storeDword(frameLength);
+ mFileBuffer->seekWrite(current);
+ mFileBuffer->flush();
+ }
+ }
+ }
+ if ( mClientServer )
+ {
+ mClientServer->finalizeFrame(mFrameCount);
+ mClientServer->serverWait(); // wait up to 1 millisecond for the server to catch up with us...
+ }
+ mFrameStart = 0;
+ mFrameItemCount = 0;
+ mFrameCount++;
+ }
+
+ virtual uint32_t getFrameCount(void) const
+ {
+ return mFrameCount;
+ }
+
+ void reset(void)
+ {
+ PX_FREE(mPrimitives);
+ PX_FREE(mData);
+ mData = NULL;
+ mPrimitives = NULL;
+ }
+
+ virtual void setFrame(uint32_t frameNo)
+ {
+ if ( !mFileBuffer )
+ return;
+
+ if ( mReadAccess && frameNo < mFrameCount && frameNo != mCurrentFrame )
+ {
+ mPrimitiveBatch.resize(0);
+
+ FrameHeader &h = mFrameHeaders[frameNo];
+ mCurrentFrame = frameNo;
+ reset();
+ mPrimitiveCount = h.mItemCount;
+ mPrimitives = const_cast<const DebugPrimitive **>(reinterpret_cast<DebugPrimitive **>(PX_ALLOC( sizeof(DebugPrimitive *)*mPrimitiveCount, PX_DEBUG_EXP("DebugPrimitive"))));
+ mData = reinterpret_cast<uint8_t*>(PX_ALLOC(h.mItemSize, PX_DEBUG_EXP("FrameItemSize")));
+ mFileBuffer->seekRead(h.mSeekLocation);
+ uint32_t bcount = mFileBuffer->read(mData,h.mItemSize);
+ if ( bcount == h.mItemSize )
+ {
+
+ uint32_t index = 0;
+
+ const uint8_t *scan = mData;
+
+ while ( index < h.mItemCount )
+ {
+ PrimitiveBatch b;
+
+ uint32_t *uscan = const_cast<uint32_t*>(reinterpret_cast<const uint32_t*>(scan));
+ b.mPrimitiveType = uscan[0];
+ b.mPrimitiveCount = uscan[1];
+ b.mPrimitiveIndex = index;
+
+ mPrimitiveBatch.pushBack(b);
+
+ uscan+=2;
+ scan = reinterpret_cast<uint8_t *>(uscan);
+
+ for (uint32_t i=0; i<b.mPrimitiveCount; i++)
+ {
+ DebugPrimitive *prim = const_cast<DebugPrimitive*>(reinterpret_cast<const DebugPrimitive *>(scan));
+
+ if ( mEndianSwap )
+ {
+ endianSwap(prim);
+ }
+
+ PX_ASSERT( prim->mCommand < DebugCommand::DEBUG_LAST );
+ mPrimitives[i+index] = prim;
+ uint32_t plen = DebugCommand::getPrimtiveSize(*prim);
+ scan+=plen;
+ }
+ index+=b.mPrimitiveCount;
+ }
+ }
+ else
+ {
+ reset();
+ }
+
+
+
+ }
+
+ }
+
+private:
+
+ physx::PsFileBuffer *mFileBuffer;
+
+ bool mReadAccess;
+ ProcessRenderDebug *mEchoLocally;
+ uint32_t mFrameStart;
+ uint32_t mFrameItemCount;
+ uint32_t mFrameCount;
+ uint32_t mCurrentFrame;
+
+ uint32_t mPrimitiveCount;
+ const DebugPrimitive **mPrimitives;
+ uint8_t *mData;
+ physx::shdfnd::Array< PrimitiveBatch > mPrimitiveBatch;
+ physx::shdfnd::Array< FrameHeader > mFrameHeaders;
+
+ ProcessRenderDebug::DisplayType mLastDisplayType;
+ TypeHeader mTypeHeaders[ProcessRenderDebug::DT_LAST];
+
+ uint32_t mMaxFrameBufferSize;
+ void *mWriteBufferData;
+ DataStream mWriteBuffer;
+ ClientServer *mClientServer;
+ bool mEndianSwap;
+};
+
+FileRenderDebug * createFileRenderDebug(const char *fileName,
+ bool readAccess,
+ ProcessRenderDebug *echoLocally,
+ ClientServer *cs)
+{
+ FileRenderDebugImpl *f = PX_NEW(FileRenderDebugImpl)(fileName, readAccess, echoLocally, cs);
+ if (!f->isOk() )
+ {
+ delete f;
+ f = NULL;
+ }
+ return static_cast< FileRenderDebug *>(f);
+}
+
+
+
+} // end of namespace
diff --git a/APEX_1.4/shared/general/RenderDebug/src/Hull2MeshEdges.cpp b/APEX_1.4/shared/general/RenderDebug/src/Hull2MeshEdges.cpp
new file mode 100644
index 00000000..94f60f4e
--- /dev/null
+++ b/APEX_1.4/shared/general/RenderDebug/src/Hull2MeshEdges.cpp
@@ -0,0 +1,459 @@
+#include "Hull2MeshEdges.h"
+#include "PsUserAllocated.h"
+#include "PxVec4.h"
+#include "PxVec3.h"
+#include "PxPlane.h"
+#include "PxMath.h"
+#include "PxTransform.h"
+#include "PsArray.h"
+
+
+#define FLT_EPS 0.000000001f
+
+PX_INLINE bool intersectPlanes(physx::PxVec3& pos, physx::PxVec3& dir, const physx::PxPlane& plane0, const physx::PxPlane& plane1)
+{
+ const physx::PxVec3 n0 = plane0.n;
+ const physx::PxVec3 n1 = plane1.n;
+
+ dir = n0.cross(n1);
+
+ if(dir.normalize() < FLT_EPS)
+ {
+ return false;
+ }
+
+ pos = physx::PxVec3(0.0f);
+
+ for (int iter = 3; iter--;)
+ {
+ // Project onto plane0:
+ pos = plane0.project(pos);
+
+ // Raycast to plane1:
+ const physx::PxVec3 b = dir.cross(n0);
+ //pos = pos - (pos.dot(plane1.n)/b.dot(plane1.n))*b;
+
+ pos = pos - (plane1.distance(pos) / b.dot(plane1.n))*b;
+
+ }
+
+ return true;
+}
+
+void calculatePolygonEdges(physx::shdfnd::Array<HullEdge>& edges,uint32_t planeCount,const physx::PxPlane *planes)
+{
+ for (uint32_t i = 0; i <planeCount; ++i)
+ {
+ const physx::PxPlane& plane_i = planes[i];
+ for (uint32_t j = i+1; j <planeCount; ++j)
+ {
+ const physx::PxPlane& plane_j = planes[j];
+ // Find potential edge from intersection if plane_i and plane_j
+ physx::PxVec3 orig;
+ physx::PxVec3 edgeDir;
+ if (intersectPlanes(orig, edgeDir, plane_i, plane_j))
+ {
+ float minS = -FLT_MAX;
+ float maxS = FLT_MAX;
+ bool intersectionFound = true;
+ for (uint32_t k = 0; k < planeCount; ++k)
+ {
+ if (k == i || k == j)
+ {
+ continue;
+ }
+ const physx::PxPlane& plane_k = planes[k];
+ const float num = -plane_k.distance(orig);
+ const float den = plane_k.n.dot(edgeDir);
+ if (physx::PxAbs(den) > FLT_EPS)
+ {
+ const float s = num/den;
+ if (den > 0.0f)
+ {
+ maxS = physx::PxMin(maxS, s);
+ }
+ else
+ {
+ minS = physx::PxMax(minS, s);
+ }
+ if (maxS <= minS)
+ {
+ intersectionFound = false;
+ break;
+ }
+ }
+ else
+ if (num < -10*FLT_EPS)
+ {
+ intersectionFound = false;
+ break;
+ }
+ }
+ if (intersectionFound && minS != -FLT_MAX && maxS != FLT_MIN)
+ {
+ HullEdge& s = edges.insert();
+ s.e0 = orig + minS * edgeDir;
+ s.e1 = orig + maxS * edgeDir;
+ }
+ }
+ }
+ }
+}
+
+struct ConvexMeshBuilder
+{
+ ConvexMeshBuilder(void) : mVertices("ConvexMeshBuilder::mVertice"), mIndices("ConvexMeshBuilder::mIndices") {}
+ void buildMesh(uint16_t numPlanes,const physx::PxVec4 *planes);
+ physx::shdfnd::Array<physx::PxVec3> mVertices;
+ physx::shdfnd::Array<uint16_t> mIndices;
+};
+
+static float det(physx::PxVec4 v0, physx::PxVec4 v1, physx::PxVec4 v2, physx::PxVec4 v3)
+{
+ const physx::PxVec3& d0 = reinterpret_cast<const physx::PxVec3&>(v0);
+ const physx::PxVec3& d1 = reinterpret_cast<const physx::PxVec3&>(v1);
+ const physx::PxVec3& d2 = reinterpret_cast<const physx::PxVec3&>(v2);
+ const physx::PxVec3& d3 = reinterpret_cast<const physx::PxVec3&>(v3);
+
+ return v0.w * d1.cross(d2).dot(d3)
+ - v1.w * d0.cross(d2).dot(d3)
+ + v2.w * d0.cross(d1).dot(d3)
+ - v3.w * d0.cross(d1).dot(d2);
+}
+
+static physx::PxVec3 intersect(physx::PxVec4 p0, physx::PxVec4 p1, physx::PxVec4 p2)
+{
+ const physx::PxVec3& d0 = reinterpret_cast<const physx::PxVec3&>(p0);
+ const physx::PxVec3& d1 = reinterpret_cast<const physx::PxVec3&>(p1);
+ const physx::PxVec3& d2 = reinterpret_cast<const physx::PxVec3&>(p2);
+
+ return (p0.w * d1.cross(d2)
+ + p1.w * d2.cross(d0)
+ + p2.w * d0.cross(d1))
+ / d0.dot(d2.cross(d1));
+}
+
+static const uint16_t sInvalid = uint16_t(-1);
+
+// restriction: only supports a single patch per vertex.
+struct HalfedgeMesh
+{
+ struct Halfedge
+ {
+ Halfedge(uint16_t vertex = sInvalid, uint16_t face = sInvalid,
+ uint16_t next = sInvalid, uint16_t prev = sInvalid)
+ : mVertex(vertex), mFace(face), mNext(next), mPrev(prev)
+ {}
+
+ uint16_t mVertex; // to
+ uint16_t mFace; // left
+ uint16_t mNext; // ccw
+ uint16_t mPrev; // cw
+ };
+
+ HalfedgeMesh() : mNumTriangles(0), mHalfedges("mHalfedges"),mVertices("mVertices"),mFaces("mFaces"),mPoints("mPoints") {}
+
+ uint16_t findHalfedge(uint16_t v0, uint16_t v1)
+ {
+ uint16_t h = mVertices[v0], start = h;
+ while(h != sInvalid && mHalfedges[h].mVertex != v1)
+ {
+ h = mHalfedges[h ^ 1u].mNext;
+ if(h == start)
+ return sInvalid;
+ }
+ return h;
+ }
+
+ void connect(uint16_t h0, uint16_t h1)
+ {
+ mHalfedges[h0].mNext = h1;
+ mHalfedges[h1].mPrev = h0;
+ }
+
+ void addTriangle(uint16_t v0, uint16_t v1, uint16_t v2)
+ {
+ // add new vertices
+ uint16_t n = physx::PxMax(v0, physx::PxMax(v1, v2))+1u;
+ if(mVertices.size() < n)
+ mVertices.resize(n, sInvalid);
+
+ // collect halfedges, prev and next of triangle
+ uint16_t verts[] = { v0, v1, v2 };
+ uint16_t handles[3], prev[3], next[3];
+ for(uint16_t i=0; i<3; ++i)
+ {
+ uint16_t j = (i+1u)%3;
+ uint16_t h = findHalfedge(verts[i], verts[j]);
+ if(h == sInvalid)
+ {
+ // add new edge
+ h = uint16_t(mHalfedges.size());
+ mHalfedges.pushBack(Halfedge(verts[j]));
+ mHalfedges.pushBack(Halfedge(verts[i]));
+ }
+ handles[i] = h;
+ prev[i] = mHalfedges[h].mPrev;
+ next[i] = mHalfedges[h].mNext;
+ }
+
+ // patch connectivity
+ for(uint16_t i=0; i<3; ++i)
+ {
+ uint16_t j = (i+1u)%3;
+
+ mHalfedges[handles[i]].mFace = uint16_t(mFaces.size());
+
+ // connect prev and next
+ connect(handles[i], handles[j]);
+
+ if(next[j] == sInvalid) // new next edge, connect opposite
+ connect(handles[j]^1u, next[i]!=sInvalid ? next[i] : handles[i]^1u);
+
+ if(prev[i] == sInvalid) // new prev edge, connect opposite
+ connect(prev[j]!=sInvalid ? prev[j] : handles[j]^1u, handles[i]^1u);
+
+ // prev is boundary, update middle vertex
+ if(mHalfedges[handles[i]^1u].mFace == sInvalid)
+ mVertices[verts[j]] = handles[i]^1u;
+ }
+
+ PX_ASSERT(mNumTriangles < 0xffff);
+ mFaces.pushBack(handles[2]);
+ ++mNumTriangles;
+ }
+
+ uint16_t removeTriangle(uint16_t f)
+ {
+ uint16_t result = sInvalid;
+
+ for(uint16_t i=0, h = mFaces[f]; i<3; ++i)
+ {
+ uint16_t v0 = mHalfedges[h^1u].mVertex;
+ uint16_t v1 = mHalfedges[h].mVertex;
+
+ mHalfedges[h].mFace = sInvalid;
+
+ if(mHalfedges[h^1u].mFace == sInvalid) // was boundary edge, remove
+ {
+ uint16_t v0Prev = mHalfedges[h ].mPrev;
+ uint16_t v0Next = mHalfedges[h^1u].mNext;
+ uint16_t v1Prev = mHalfedges[h^1u].mPrev;
+ uint16_t v1Next = mHalfedges[h ].mNext;
+
+ // update halfedge connectivity
+ connect(v0Prev, v0Next);
+ connect(v1Prev, v1Next);
+
+ // update vertex boundary or delete
+ mVertices[v0] = (v0Prev^1) == v0Next ? sInvalid : v0Next;
+ mVertices[v1] = (v1Prev^1) == v1Next ? sInvalid : v1Next;
+ }
+ else
+ {
+ mVertices[v0] = h; // update vertex boundary
+ result = v1;
+ }
+
+ h = mHalfedges[h].mNext;
+ }
+
+ mFaces[f] = sInvalid;
+ --mNumTriangles;
+
+ return result;
+ }
+
+ // true if vertex v is in front of face f
+ bool visible(uint16_t v, uint16_t f)
+ {
+ uint16_t h = mFaces[f];
+ if(h == sInvalid)
+ return false;
+
+ uint16_t v0 = mHalfedges[h].mVertex;
+ h = mHalfedges[h].mNext;
+ uint16_t v1 = mHalfedges[h].mVertex;
+ h = mHalfedges[h].mNext;
+ uint16_t v2 = mHalfedges[h].mVertex;
+ h = mHalfedges[h].mNext;
+
+ return det(mPoints[v], mPoints[v0], mPoints[v1], mPoints[v2]) < -1e-5f;
+ }
+
+ uint16_t mNumTriangles;
+ physx::shdfnd::Array<Halfedge> mHalfedges;
+ physx::shdfnd::Array<uint16_t> mVertices; // vertex -> (boundary) halfedge
+ physx::shdfnd::Array<uint16_t> mFaces; // face -> halfedge
+ physx::shdfnd::Array<physx::PxVec4> mPoints;
+};
+
+void ConvexMeshBuilder::buildMesh(uint16_t numPlanes,const physx::PxVec4 *planes)
+{
+ if(numPlanes < 4)
+ return; // todo: handle degenerate cases
+
+ HalfedgeMesh mesh;
+
+ // gather points (planes, that is)
+ mesh.mPoints.reserve(numPlanes);
+ for (uint32_t i=0; i<numPlanes; i++)
+ {
+ mesh.mPoints.pushBack(planes[i]);
+ }
+
+ // initialize to tetrahedron
+ mesh.addTriangle(0, 1, 2);
+ mesh.addTriangle(0, 3, 1);
+ mesh.addTriangle(1, 3, 2);
+ mesh.addTriangle(2, 3, 0);
+
+ // flip if inside-out
+ if(mesh.visible(3, 0))
+ physx::shdfnd::swap(mesh.mPoints[0], mesh.mPoints[1]);
+
+ // iterate through remaining points
+ for(uint16_t i=4; i<mesh.mPoints.size(); ++i)
+ {
+ // remove any visible triangle
+ uint16_t v0 = sInvalid;
+ for(uint16_t j=0; j<mesh.mFaces.size(); ++j)
+ {
+ if(mesh.visible(i, j))
+ v0 = physx::PxMin(v0, mesh.removeTriangle(j));
+ }
+
+ if(v0 == sInvalid)
+ continue; // no triangle removed
+
+ if(!mesh.mNumTriangles)
+ return; // empty mesh
+
+ // find non-deleted boundary vertex
+ for(uint16_t h=0; mesh.mVertices[v0] == sInvalid; h+=2)
+ {
+ if ((mesh.mHalfedges[h ].mFace == sInvalid) ^
+ (mesh.mHalfedges[h+1u].mFace == sInvalid))
+ {
+ v0 = mesh.mHalfedges[h].mVertex;
+ }
+ }
+
+ // tesselate hole
+ uint16_t start = v0;
+ do {
+ uint16_t h = mesh.mVertices[v0];
+ uint16_t v1 = mesh.mHalfedges[h].mVertex;
+ mesh.addTriangle(v0, v1, i);
+ v0 = v1;
+ } while(v0 != start);
+ }
+
+ // convert triangles to vertices (intersection of 3 planes)
+ physx::shdfnd::Array<uint32_t> face2Vertex(mesh.mFaces.size(), sInvalid);
+ for(uint32_t i=0; i<mesh.mFaces.size(); ++i)
+ {
+ uint16_t h = mesh.mFaces[i];
+ if(h == sInvalid)
+ continue;
+
+ uint16_t v0 = mesh.mHalfedges[h].mVertex;
+ h = mesh.mHalfedges[h].mNext;
+ uint16_t v1 = mesh.mHalfedges[h].mVertex;
+ h = mesh.mHalfedges[h].mNext;
+ uint16_t v2 = mesh.mHalfedges[h].mVertex;
+
+ face2Vertex[i] = mVertices.size();
+ mVertices.pushBack(intersect(mesh.mPoints[v0], mesh.mPoints[v1], mesh.mPoints[v2]));
+ }
+
+ // convert vertices to polygons (face one-ring)
+ for(uint32_t i=0; i<mesh.mVertices.size(); ++i)
+ {
+ uint16_t h = mesh.mVertices[i];
+ if(h == sInvalid)
+ continue;
+
+ uint16_t v0 = uint16_t(face2Vertex[mesh.mHalfedges[h].mFace]);
+ h = mesh.mHalfedges[h].mPrev^1u;
+ uint16_t v1 = uint16_t(face2Vertex[mesh.mHalfedges[h].mFace]);
+ bool state = true;
+ while( state )
+ {
+ h = mesh.mHalfedges[h].mPrev^1u;
+ uint16_t v2 = uint16_t(face2Vertex[mesh.mHalfedges[h].mFace]);
+
+ if(v0 == v2)
+ break;
+
+ physx::PxVec3 e0 = mVertices[v0] - mVertices[v2];
+ physx::PxVec3 e1 = mVertices[v1] - mVertices[v2];
+ if(e0.cross(e1).magnitudeSquared() < 1e-10f)
+ continue;
+
+ mIndices.pushBack(v0);
+ mIndices.pushBack(v2);
+ mIndices.pushBack(v1);
+
+ v1 = v2;
+ }
+
+ }
+}
+
+class Hull2MeshEdgesImpl : public Hull2MeshEdges, public physx::shdfnd::UserAllocated
+{
+public:
+ Hull2MeshEdgesImpl(void) : mEdges("HullEdges")
+ {
+
+ }
+ virtual ~Hull2MeshEdgesImpl(void)
+ {
+ }
+
+ virtual bool getHullMesh(uint32_t planeCount,const physx::PxPlane *planes,HullMesh &m)
+ {
+ bool ret = false;
+
+ mConvexMeshBuilder.buildMesh(uint16_t(planeCount),reinterpret_cast<const physx::PxVec4 *>(planes));
+
+ m.mVertexCount = mConvexMeshBuilder.mVertices.size();
+ if ( m.mVertexCount )
+ {
+ ret = true;
+ m.mTriCount = mConvexMeshBuilder.mIndices.size()/3;
+ m.mVertices = &mConvexMeshBuilder.mVertices[0];
+ m.mIndices = &mConvexMeshBuilder.mIndices[0];
+ }
+ return ret;
+ }
+
+ virtual const HullEdge *getHullEdges(uint32_t planeCount,const physx::PxPlane *planes,uint32_t &edgeCount)
+ {
+ const HullEdge *ret = NULL;
+
+ mEdges.clear();
+ calculatePolygonEdges(mEdges,planeCount,planes);
+ if ( !mEdges.empty() )
+ {
+ ret = &mEdges[0];
+ edgeCount = mEdges.size();
+ }
+
+ return ret;
+ }
+
+ virtual void release(void)
+ {
+ delete this;
+ }
+ physx::shdfnd::Array<HullEdge> mEdges;
+ ConvexMeshBuilder mConvexMeshBuilder;
+};
+
+Hull2MeshEdges *createHull2MeshEdges(void)
+{
+ Hull2MeshEdgesImpl *ret = PX_NEW(Hull2MeshEdgesImpl);
+ return static_cast< Hull2MeshEdges *>(ret);
+}
diff --git a/APEX_1.4/shared/general/RenderDebug/src/InternalRenderDebug.cpp b/APEX_1.4/shared/general/RenderDebug/src/InternalRenderDebug.cpp
new file mode 100644
index 00000000..afe73340
--- /dev/null
+++ b/APEX_1.4/shared/general/RenderDebug/src/InternalRenderDebug.cpp
@@ -0,0 +1,2708 @@
+// This code contains NVIDIA Confidential Information and is disclosed to you
+// under a form of NVIDIA software license agreement provided separately to you.
+//
+// Notice
+// NVIDIA Corporation and its licensors retain all intellectual property and
+// proprietary rights in and to this software and related documentation and
+// any modifications thereto. Any use, reproduction, disclosure, or
+// distribution of this software and related documentation without an express
+// license agreement from NVIDIA Corporation is strictly prohibited.
+//
+// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
+// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
+// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
+// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// Information and code furnished is believed to be accurate and reliable.
+// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
+// information or for any infringement of patents or other rights of third parties that may
+// result from its use. No license is granted by implication or otherwise under any patent
+// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
+// This code supersedes and replaces all information previously supplied.
+// NVIDIA Corporation products are not authorized for use as critical
+// components in life support devices or systems without express written approval of
+// NVIDIA Corporation.
+//
+// Copyright (c) 2008-2013 NVIDIA Corporation. All rights reserved.
+
+#include "PsHashMap.h"
+#include "InternalRenderDebug.h"
+#include "RenderDebug.h"
+#include "RenderDebugImpl.h"
+#include "ProcessRenderDebug.h"
+#include "PsMemoryBuffer.h"
+
+#include "PsPool.h"
+#include "PsString.h"
+#include "PxBounds3.h"
+#include "StreamIO.h"
+
+namespace RENDER_DEBUG
+{
+
+#define RENDER_STATE_STACK_SIZE 16 // maximum size of the render state stack
+const float FM_PI = 3.1415926535897932384626433832795028841971693993751f;
+const float FM_DEG_TO_RAD = ((2.0f * FM_PI) / 360.0f);
+//const float FM_RAD_TO_DEG = (360.0f / (2.0f * FM_PI));
+
+
+class PostRenderDebug
+{
+ PX_NOCOPY(PostRenderDebug)
+public:
+
+ PostRenderDebug(void)
+ {
+ mSendBufferCount = 0;
+ // since all of these commands are processed internally, in memory buffers, we don't need to be endian specific.
+ mWorldSpace.setEndianMode(physx::PxFileBuf::ENDIAN_NONE);
+ mScreenSpace.setEndianMode(physx::PxFileBuf::ENDIAN_NONE);
+ mNoZ.setEndianMode(physx::PxFileBuf::ENDIAN_NONE);
+ }
+
+ ~PostRenderDebug(void)
+ {
+ }
+
+ PX_INLINE void postRenderDebug(DebugPrimitive *p,const RenderState &rs)
+ {
+// if ( p->mCommand == DebugCommand::DEBUG_GRAPH )
+// return;
+
+ uint32_t plen = DebugCommand::getPrimtiveSize(*p);
+ float dtime = rs.getDisplayTime();
+
+ switch ( p->mCommand )
+ {
+ case DebugCommand::DEBUG_GRAPH:
+ {
+ DebugGraphStream *dgs = static_cast< DebugGraphStream *>(p);
+ plen = dgs->mSize;
+ p = reinterpret_cast<DebugPrimitive *>(dgs->mBuffer);
+ dgs = static_cast< DebugGraphStream *>(p);
+ dgs->mSize = plen;
+ }
+ break;
+ case DebugCommand::DEBUG_CREATE_TRIANGLE_MESH:
+ {
+ DebugCreateTriangleMesh *dgs = static_cast< DebugCreateTriangleMesh *>(p);
+ plen = dgs->mSize;
+ p = reinterpret_cast<DebugPrimitive *>(dgs->mBuffer);
+ dgs = static_cast< DebugCreateTriangleMesh *>(p);
+ dgs->mSize = plen;
+ }
+ break;
+ case DebugCommand::DEBUG_RENDER_TRIANGLE_MESH_INSTANCES:
+ {
+ DebugRenderTriangleMeshInstances *dgs = static_cast< DebugRenderTriangleMeshInstances *>(p);
+ plen = dgs->mSize;
+ p = reinterpret_cast<DebugPrimitive *>(dgs->mBuffer);
+ dgs = static_cast< DebugRenderTriangleMeshInstances *>(p);
+ dgs->mSize = plen;
+ }
+ break;
+ case DebugCommand::DEBUG_CONVEX_HULL:
+ {
+ DebugConvexHull *dgs = static_cast< DebugConvexHull *>(p);
+ plen = dgs->mSize;
+ p = reinterpret_cast<DebugPrimitive *>(dgs->mBuffer);
+ dgs = static_cast< DebugConvexHull *>(p);
+ dgs->mSize = plen;
+ }
+
+ break;
+ case DebugCommand::DEBUG_RENDER_POINTS:
+ {
+ DebugRenderPoints *dgs = static_cast< DebugRenderPoints *>(p);
+ plen = dgs->mSize;
+ p = reinterpret_cast<DebugPrimitive *>(dgs->mBuffer);
+ dgs = static_cast< DebugRenderPoints *>(p);
+ dgs->mSize = plen;
+ }
+ break;
+ case DebugCommand::DEBUG_RENDER_LINES:
+ {
+ DebugRenderLines *dgs = static_cast< DebugRenderLines *>(p);
+ plen = dgs->mSize;
+ p = reinterpret_cast<DebugPrimitive *>(dgs->mBuffer);
+ dgs = static_cast< DebugRenderLines *>(p);
+ dgs->mSize = plen;
+ }
+ break;
+ case DebugCommand::DEBUG_RENDER_TRIANGLES:
+ {
+ DebugRenderTriangles *dgs = static_cast< DebugRenderTriangles *>(p);
+ plen = dgs->mSize;
+ p = reinterpret_cast<DebugPrimitive *>(dgs->mBuffer);
+ dgs = static_cast< DebugRenderTriangles *>(p);
+ dgs->mSize = plen;
+ }
+ break;
+ case DebugCommand::DEBUG_REFRESH_TRIANGLE_MESH_VERTICES:
+ {
+ DebugRefreshTriangleMeshVertices *dgs = static_cast< DebugRefreshTriangleMeshVertices *>(p);
+ plen = dgs->mSize;
+ p = reinterpret_cast<DebugPrimitive *>(dgs->mBuffer);
+ dgs = static_cast< DebugRefreshTriangleMeshVertices *>(p);
+ dgs->mSize = plen;
+ }
+ break;
+ }
+
+
+ if ( rs.isScreen() || p->mCommand == DebugCommand::DEBUG_GRAPH )
+ {
+ processState(rs,mScreenSpaceRenderState,mScreenSpace,dtime);
+ mScreenSpace.write(&dtime,sizeof(dtime));
+ mScreenSpace.write(p,plen);
+ }
+ else if ( rs.isUseZ() )
+ {
+ processState(rs,mWorldSpaceRenderState,mWorldSpace,dtime);
+ mWorldSpace.write(&dtime,sizeof(dtime));
+ mWorldSpace.write(p,plen);
+ }
+ else
+ {
+ processState(rs,mNoZRenderState,mNoZ,dtime);
+ mNoZ.write(&dtime,sizeof(dtime));
+ mNoZ.write(p,plen);
+ }
+ }
+
+ void release(void)
+ {
+ delete this;
+ }
+
+
+ bool processRenderDebug(ProcessRenderDebug *rd,float dtime,RENDER_DEBUG::RenderDebugInterface *iface)
+ {
+
+ PX_ASSERT(dtime>=0);
+ process(mWorldSpace,rd,dtime,iface,ProcessRenderDebug::WORLD_SPACE);
+ process(mNoZ,rd,dtime,iface,ProcessRenderDebug::WORLD_SPACE_NOZ);
+ process(mScreenSpace,rd,dtime,iface,ProcessRenderDebug::SCREEN_SPACE);
+ rd->flushFrame(iface);
+
+ new ( &mWorldSpaceRenderState ) RenderState;
+ new ( &mScreenSpaceRenderState ) RenderState;
+ new ( &mNoZRenderState ) RenderState;
+
+ return true;
+ }
+
+ PX_INLINE bool intersects(const uint8_t *a1,const uint8_t *a2,const uint8_t *b1,const uint8_t *b2)
+ {
+ bool ret = true;
+ if ( a1 >= b2 || b1 >= a2 ) ret = false;
+ return ret;
+ }
+
+ // This method processes the current stream of draw commands.
+ // Each draw command is preceded by its 'lifetime'.
+ // If the object is still alive after it is processed, it is retained in the buffer.
+ void process(physx::PsMemoryBuffer &stream,
+ ProcessRenderDebug *rd,
+ float dtime,
+ RENDER_DEBUG::RenderDebugInterface *iface,
+ ProcessRenderDebug::DisplayType type)
+ {
+ if ( stream.tellWrite() == 0 ) return;
+
+ uint8_t *dest = const_cast<uint8_t *>(stream.getWriteBuffer());
+
+ const uint8_t *sendStart = NULL;
+ const uint8_t *sendEnd = NULL;
+
+ float displayTime;
+ uint32_t r = stream.read(&displayTime,sizeof(displayTime));
+
+ BlockInfo *info = NULL;
+
+ while ( r == sizeof(displayTime) )
+ {
+ displayTime-=dtime;
+ bool alive = displayTime > 0.0f;
+ uint32_t cmd;
+ r = stream.peek(&cmd,sizeof(cmd));
+
+ PX_ASSERT( r == sizeof(cmd) );
+ PX_ASSERT( cmd < DebugCommand::DEBUG_LAST );
+
+ switch ( cmd )
+ {
+ case DebugCommand::DEBUG_MESSAGE:
+ case DebugCommand::DEBUG_CREATE_TRIANGLE_MESH:
+ case DebugCommand::DEBUG_RELEASE_TRIANGLE_MESH:
+ case DebugCommand::DEBUG_REFRESH_TRIANGLE_MESH_VERTICES:
+ case DebugCommand::DEBUG_CREATE_CUSTOM_TEXTURE:
+ case DebugCommand::DEBUG_REGISTER_INPUT_EVENT:
+ case DebugCommand::DEBUG_UNREGISTER_INPUT_EVENT:
+ case DebugCommand::DEBUG_RESET_INPUT_EVENTS:
+ case DebugCommand::DEBUG_SKIP_FRAME:
+ alive = false;
+ break;
+ }
+
+ const uint8_t *readLoc = stream.getReadLoc();
+ DebugPrimitive *dp = const_cast<DebugPrimitive*>(reinterpret_cast<const DebugPrimitive *>(readLoc));
+ uint32_t plen = DebugCommand::getPrimtiveSize(*dp);
+ stream.advanceReadLoc(plen);
+
+ if ( sendStart == NULL )
+ {
+ sendStart = readLoc;
+ }
+ sendEnd = readLoc+plen;
+
+ if ( dp->mCommand == DebugCommand::DEBUG_BLOCK_INFO )
+ {
+ DebugBlockInfo *db = static_cast< DebugBlockInfo *>(dp);
+ info = db->mInfo;
+
+ if ( info && info->mChanged )
+ {
+ db->mCurrentTransform = info->mPose;
+ info->mChanged = false;
+ }
+ if ( info && info->mVisibleState )
+ {
+ DebugPrimitive *setCurrentTransform = static_cast< DebugPrimitive *>(&db->mCurrentTransform);
+ mSendBuffer[mSendBufferCount] = setCurrentTransform;
+ mSendBufferCount++;
+ }
+ }
+ else if ( info )
+ {
+ if ( info->mVisibleState )
+ {
+ mSendBuffer[mSendBufferCount] = dp;
+ mSendBufferCount++;
+ }
+ else if (isRenderState(dp))
+ {
+ mSendBuffer[mSendBufferCount] = dp;
+ mSendBufferCount++;
+ }
+ }
+ else
+ {
+ mSendBuffer[mSendBufferCount] = dp;
+ mSendBufferCount++;
+ }
+
+ if ( mSendBufferCount == MAX_SEND_BUFFER )
+ {
+ rd->processRenderDebug(mSendBuffer,mSendBufferCount,iface,type);
+ mSendBufferCount = 0;
+ sendStart = sendEnd = NULL;
+ }
+
+ if ( alive )
+ {
+ if ( sendStart && intersects(sendStart,sendEnd,dest,dest+plen+sizeof(float)) )
+ {
+ if ( mSendBufferCount )
+ {
+ rd->processRenderDebug(mSendBuffer,mSendBufferCount,iface,type);
+ }
+ mSendBufferCount = 0;
+ sendStart = sendEnd = NULL;
+ }
+
+ // Store the new display time!
+ float *fdest = reinterpret_cast<float *>(dest);
+ *fdest = displayTime;
+ dest+=sizeof(float);
+
+ if ( dest != reinterpret_cast<uint8_t *>(dp) ) // if the source and dest are the same, we don't need to move memory
+ {
+ memcpy(dest,dp,plen);
+ }
+ dest+=plen;
+ }
+
+ r = stream.read(&displayTime,sizeof(displayTime));
+ }
+
+ if ( mSendBufferCount )
+ {
+ rd->processRenderDebug(mSendBuffer,mSendBufferCount,iface,type);
+ mSendBufferCount = 0;
+ }
+
+ if ( info )
+ {
+ info->mChanged = false;
+ }
+
+ stream.setWriteLoc(dest);
+ rd->flush(iface,type);
+ stream.seekRead(0);
+ }
+
+ void reset(BlockInfo *info)
+ {
+ reset(mWorldSpace,info);
+ reset(mNoZ,info);
+ reset(mScreenSpace,info);
+ }
+
+ // if resetInfo is NULL, then totally erase the persistent data stream.
+ // if resetInfo is non-NULL, then erease all parts of the stream which are associated with this data block.
+ void reset(physx::PsMemoryBuffer &stream,BlockInfo *resetInfo)
+ {
+ if ( stream.tellWrite() == 0 ) return;
+ // remove all data
+ if ( resetInfo )
+ {
+ uint8_t *dest = const_cast<uint8_t *>(stream.getWriteBuffer());
+ float displayTime;
+ uint32_t r = stream.read(&displayTime,sizeof(displayTime));
+ BlockInfo *info = NULL;
+ while ( r == sizeof(displayTime) )
+ {
+ char scratch[sizeof(DebugGraphStream)];
+ DebugGraphStream *dgs = reinterpret_cast<DebugGraphStream *>(scratch);
+ r = stream.peek(dgs,sizeof(DebugGraphStream));
+ PX_ASSERT( r >= 8);
+ PX_ASSERT( dgs->mCommand < DebugCommand::DEBUG_LAST );
+ uint32_t plen = DebugCommand::getPrimtiveSize(*dgs);
+ const uint8_t *readLoc = stream.getReadLoc();
+ DebugPrimitive *dp = reinterpret_cast<DebugPrimitive *>(const_cast<uint8_t*>(readLoc));
+ stream.advanceReadLoc(plen);
+ if ( dp->mCommand == DebugCommand::DEBUG_BLOCK_INFO )
+ {
+ DebugBlockInfo *db = static_cast< DebugBlockInfo *>(dp);
+ info = db->mInfo;
+ }
+ if ( info != resetInfo )
+ {
+ // Store the new display time!
+ float *fdest = reinterpret_cast<float *>(dest);
+ *fdest = displayTime;
+ dest+=sizeof(float);
+ if ( dest != reinterpret_cast<uint8_t *>(dp) ) // if the source and dest are the same, we don't need to move memory
+ {
+ memcpy(dest,dp,plen);
+ }
+ dest+=plen;
+
+ }
+ r = stream.read(&displayTime,sizeof(displayTime));
+ }
+ stream.setWriteLoc(dest);
+ stream.seekRead(0);
+ }
+ else
+ {
+ // kill all saved data!
+ uint8_t *dest = const_cast<uint8_t *>(stream.getWriteBuffer());
+ stream.setWriteLoc(dest);
+ stream.seekRead(0);
+ }
+ }
+
+ void updateBufferChangeCount(const RenderState &rs)
+ {
+ if ( rs.isScreen() /*|| p->mCommand == DebugCommand::DEBUG_GRAPH*/ )
+ mScreenSpaceRenderState.mChangeCount = rs.getChangeCount();
+ else if ( rs.isUseZ() )
+ mWorldSpaceRenderState.mChangeCount = rs.getChangeCount();
+ else
+ mNoZRenderState.mChangeCount = rs.getChangeCount();
+ }
+
+ void updatePostDrawGroupPose (const RenderState &rs)
+ {
+ float dtime = rs.getDisplayTime();
+
+ if ( rs.isScreen() /*|| p->mCommand == DebugCommand::DEBUG_GRAPH*/ )
+ setCurrentTransform(rs, mScreenSpaceRenderState, mScreenSpace, dtime);
+ else if ( rs.isUseZ() )
+ setCurrentTransform(rs, mWorldSpaceRenderState, mWorldSpace, dtime);
+ else
+ setCurrentTransform(rs, mNoZRenderState, mNoZ, dtime);
+ }
+
+private:
+
+ PX_INLINE void processState(const RenderState &source,
+ RenderState &dest,
+ physx::PsMemoryBuffer &stream,
+ float lifeTime)
+ {
+ if ( dest.getChangeCount() == 0 )
+ {
+ setColor(source,dest,stream,lifeTime);
+ setArrowColor(source,dest,stream,lifeTime);
+ setTexture(source,dest,stream,lifeTime);
+ setArrowSize(source,dest,stream,lifeTime);
+ setRenderScale(source,dest,stream,lifeTime);
+ setUserId(source,dest,stream,lifeTime);
+ setStates(source,dest,stream,lifeTime);
+ setTextScale(source,dest,stream,lifeTime);
+ setCurrentTransform(source,dest,stream,lifeTime);
+ setBlockInfo(source,dest,stream,lifeTime);
+ dest.incrementChangeCount();
+ }
+ else if ( source.getChangeCount() != dest.getChangeCount() )
+ {
+ applyStateChanges(source,dest,stream,lifeTime);
+ }
+ }
+
+ PX_INLINE void setColor(const RenderState &source,RenderState &dest,physx::PsMemoryBuffer &stream,float lifeTime)
+ {
+ DebugPrimitiveU32 d(DebugCommand::SET_CURRENT_COLOR,source.mColor);
+ stream.write(&lifeTime,sizeof(lifeTime));
+ stream.write(&d,sizeof(d));
+ dest.mColor = source.mColor;
+ }
+
+ PX_INLINE void setRenderScale(const RenderState &source,RenderState &dest,physx::PsMemoryBuffer &stream,float lifeTime)
+ {
+ DebugPrimitiveF32 d(DebugCommand::SET_CURRENT_RENDER_SCALE,source.mRenderScale);
+ stream.write(&lifeTime,sizeof(lifeTime));
+ stream.write(&d,sizeof(d));
+ dest.mRenderScale = source.mRenderScale;
+ }
+
+ PX_INLINE void setArrowSize(const RenderState &source,RenderState &dest,physx::PsMemoryBuffer &stream,float lifeTime)
+ {
+ DebugPrimitiveF32 d(DebugCommand::SET_CURRENT_ARROW_SIZE,source.mArrowSize);
+ stream.write(&lifeTime,sizeof(lifeTime));
+ stream.write(&d,sizeof(d));
+ dest.mArrowSize = source.mArrowSize;
+ }
+
+ PX_INLINE void setUserId(const RenderState &source,RenderState &dest,physx::PsMemoryBuffer &stream,float lifeTime)
+ {
+ DebugPrimitiveU32 d(DebugCommand::SET_CURRENT_USER_ID,uint32_t(source.mUserId));
+ stream.write(&lifeTime,sizeof(lifeTime));
+ stream.write(&d,sizeof(d));
+ dest.mUserId = source.mUserId;
+ }
+
+ PX_INLINE void setArrowColor(const RenderState &source,RenderState &dest,physx::PsMemoryBuffer &stream,float lifeTime)
+ {
+ DebugPrimitiveU32 d(DebugCommand::SET_CURRENT_ARROW_COLOR,source.mArrowColor);
+ stream.write(&lifeTime,sizeof(lifeTime));
+ stream.write(&d,sizeof(d));
+ dest.mArrowColor = source.mArrowColor;
+ }
+
+ PX_INLINE void setTexture(const RenderState &source,RenderState &dest,physx::PsMemoryBuffer &stream,float lifeTime)
+ {
+ if ( dest.mTexture1 != source.mTexture1 )
+ {
+ DebugPrimitiveU32 d(DebugCommand::SET_CURRENT_TEXTURE1,source.mTexture1);
+ stream.write(&lifeTime,sizeof(lifeTime));
+ stream.write(&d,sizeof(d));
+ dest.mTexture1 = source.mTexture1;
+ }
+ if ( dest.mTexture2 != source.mTexture2 )
+ {
+ DebugPrimitiveU32 d(DebugCommand::SET_CURRENT_TEXTURE2,source.mTexture2);
+ stream.write(&lifeTime,sizeof(lifeTime));
+ stream.write(&d,sizeof(d));
+ dest.mTexture2 = source.mTexture2;
+ }
+ if ( dest.mTileRate1 != source.mTileRate2 )
+ {
+ DebugPrimitiveF32 d(DebugCommand::SET_CURRENT_TILE1,source.mTileRate1);
+ stream.write(&lifeTime,sizeof(lifeTime));
+ stream.write(&d,sizeof(d));
+ dest.mTileRate1 = source.mTileRate1;
+ }
+ if ( dest.mTileRate2 != source.mTileRate2 )
+ {
+ DebugPrimitiveF32 d(DebugCommand::SET_CURRENT_TILE2,source.mTileRate2);
+ stream.write(&lifeTime,sizeof(lifeTime));
+ stream.write(&d,sizeof(d));
+ dest.mTileRate2 = source.mTileRate2;
+ }
+
+ }
+
+
+ PX_INLINE void setStates(const RenderState &source,RenderState &dest,physx::PsMemoryBuffer &stream,float lifeTime)
+ {
+ DebugPrimitiveU32 d(DebugCommand::SET_CURRENT_RENDER_STATE,source.mStates);
+ stream.write(&lifeTime,sizeof(lifeTime));
+ stream.write(&d,sizeof(d));
+ dest.mStates = source.mStates;
+ }
+
+ PX_INLINE void setTextScale(const RenderState &source,RenderState &dest,physx::PsMemoryBuffer &stream,float lifeTime)
+ {
+ DebugPrimitiveF32 d(DebugCommand::SET_CURRENT_TEXT_SCALE,source.mTextScale);
+ stream.write(&lifeTime,sizeof(lifeTime));
+ stream.write(&d,sizeof(d));
+ dest.mTextScale = source.mTextScale;
+ }
+
+ PX_INLINE void setCurrentTransform(const RenderState &source,
+ RenderState &dest,
+ physx::PsMemoryBuffer &stream,float lifeTime)
+ {
+ DebugSetCurrentTransform d(source.mPose ? *source.mPose : physx::PxMat44(physx::PxIdentity) );
+ stream.write(&lifeTime,sizeof(lifeTime));
+ stream.write(&d,sizeof(d));
+ if ( source.mPose )
+ {
+ dest.mCurrentPose = *source.mPose;
+ dest.mPose = &dest.mCurrentPose;
+ }
+ else
+ {
+ dest.mPose = NULL;
+ }
+ }
+
+ PX_INLINE void setBlockInfo(const RenderState &source,RenderState &dest,physx::PsMemoryBuffer &stream,float lifeTime)
+ {
+ DebugBlockInfo d(source.mBlockInfo);
+ stream.write(&lifeTime,sizeof(lifeTime));
+ stream.write(&d,sizeof(d));
+ dest.mBlockInfo = source.mBlockInfo;
+ }
+
+
+ void applyStateChanges(const RenderState &source,RenderState &dest,physx::PsMemoryBuffer &stream,float lifeTime)
+ {
+ if ( source.mColor != dest.mColor )
+ {
+ setColor(source,dest,stream,lifeTime);
+ }
+ if ( source.mArrowColor != dest.mArrowColor )
+ {
+ setArrowColor(source,dest,stream,lifeTime);
+ }
+ {
+ setTexture(source,dest,stream,lifeTime);
+ }
+ if ( source.mRenderScale != dest.mRenderScale )
+ {
+ setRenderScale(source,dest,stream,lifeTime);
+ }
+ if ( source.mArrowSize != dest.mArrowSize )
+ {
+ setArrowSize(source,dest,stream,lifeTime);
+ }
+ if ( source.mUserId != dest.mUserId )
+ {
+ setUserId(source,dest,stream,lifeTime);
+ }
+ if ( source.mStates != dest.mStates )
+ {
+ setStates(source,dest,stream,lifeTime);
+ }
+ if ( source.mTextScale != dest.mTextScale )
+ {
+ setTextScale(source,dest,stream,lifeTime);
+ }
+ if ( source.mPose != dest.mPose )
+ {
+ if ( !sameMat44(source.mPose,dest.mPose) )
+ {
+ setCurrentTransform(source,dest,stream,lifeTime);
+ }
+ }
+ if ( source.mBlockInfo != dest.mBlockInfo )
+ {
+ setBlockInfo(source,dest,stream,lifeTime);
+ }
+ dest.mChangeCount = source.mChangeCount;
+ }
+
+ bool sameMat44(const physx::PxMat44 *a,const physx::PxMat44 *b) const
+ {
+ if ( a == b ) return true;
+ if ( a == NULL || b == NULL ) return false;
+ const float *f1 = a->front();
+ const float *f2 = b->front();
+ for (uint32_t i=0; i<16; i++)
+ {
+ float diff = physx::PxAbs(f1[i]-f2[i]);
+ if ( diff > 0.000001f ) return false;
+ }
+ return true;
+ }
+
+ bool isRenderState(const DebugPrimitive * const dp) const
+ {
+ return( dp->mCommand == DebugCommand::SET_CURRENT_COLOR ||
+ dp->mCommand == DebugCommand::SET_CURRENT_TILE1 ||
+ dp->mCommand == DebugCommand::SET_CURRENT_TILE2 ||
+ dp->mCommand == DebugCommand::SET_CURRENT_TEXTURE1 ||
+ dp->mCommand == DebugCommand::SET_CURRENT_TEXTURE2 ||
+ dp->mCommand == DebugCommand::SET_CURRENT_ARROW_COLOR ||
+ dp->mCommand == DebugCommand::SET_CURRENT_ARROW_SIZE ||
+ dp->mCommand == DebugCommand::SET_CURRENT_RENDER_SCALE ||
+ dp->mCommand == DebugCommand::SET_CURRENT_USER_ID ||
+ dp->mCommand == DebugCommand::SET_CURRENT_RENDER_STATE ||
+ dp->mCommand == DebugCommand::SET_CURRENT_TEXT_SCALE ||
+ dp->mCommand == DebugCommand::SET_CURRENT_TRANSFORM );
+ }
+
+ physx::PsMemoryBuffer mWorldSpace;
+ physx::PsMemoryBuffer mScreenSpace;
+ physx::PsMemoryBuffer mNoZ;
+
+ RenderState mWorldSpaceRenderState;
+ RenderState mScreenSpaceRenderState;
+ RenderState mNoZRenderState;
+
+ uint32_t mSendBufferCount;
+ const DebugPrimitive *mSendBuffer[MAX_SEND_BUFFER];
+};
+
+
+
+
+class InternalRenderDebug : public RenderDebugImpl, public physx::shdfnd::UserAllocated, PostRenderDebug
+{
+public:
+
+ InternalRenderDebug(ProcessRenderDebug *process,RenderDebugHook *renderDebugHook)
+ {
+ mCanSkip = true;
+ mRenderDebugHook = renderDebugHook;
+ mFrameTime = 1.0f / 60.0f;
+ mBlockIndex = 0;
+ mStackIndex = 0;
+ mUpdateCount = 0;
+ mOwnProcess = false;
+ if ( process )
+ {
+ mProcessRenderDebug = process;
+ }
+ else
+ {
+ mProcessRenderDebug = createProcessRenderDebug();
+ mOwnProcess = true;
+ }
+ initColors();
+ }
+
+ ~InternalRenderDebug(void)
+ {
+ if ( mOwnProcess )
+ {
+ mProcessRenderDebug->release();
+ }
+ }
+
+ virtual uint32_t getUpdateCount(void) const
+ {
+ return mUpdateCount;
+ }
+
+ virtual bool renderImpl(float dtime,RENDER_DEBUG::RenderDebugInterface *iface)
+ {
+ bool ret = false;
+
+ ret = PostRenderDebug::processRenderDebug(mProcessRenderDebug,dtime,iface);
+ mUpdateCount++;
+
+ mProcessRenderDebug->finalizeFrame();
+ mCanSkip = true; // next frame state
+
+ return ret;
+ }
+
+ virtual void reset(int32_t blockIndex=-1) // -1 reset *everything*, 0 = reset everything except stuff inside blocks, > 0 reset a specific block of data.
+ {
+ if ( blockIndex == -1 )
+ {
+ PostRenderDebug::reset(NULL);
+ }
+ else
+ {
+ const physx::shdfnd::HashMap<uint32_t, BlockInfo *>::Entry *e = mBlocksHash.find(uint32_t(blockIndex));
+ if ( e )
+ {
+ BlockInfo *b = e->second;
+ PostRenderDebug::reset(b);
+ }
+ }
+ }
+
+
+ virtual void drawGrid(bool zup=false,uint32_t gridSize=40) // draw a grid.
+ {
+ DrawGrid d(zup,gridSize);
+ PostRenderDebug::postRenderDebug(&d,mCurrentState);
+ }
+
+ virtual void pushRenderState(void)
+ {
+ PX_ASSERT( mStackIndex < RENDER_STATE_STACK_SIZE );
+ if ( mStackIndex < RENDER_STATE_STACK_SIZE )
+ {
+ mRenderStateStack[mStackIndex] = mCurrentState;
+ if ( mCurrentState.mPose )
+ {
+ mRenderStateStack[mStackIndex].mPose = &mRenderStateStack[mStackIndex].mCurrentPose;
+ }
+ mStackIndex++;
+ }
+ }
+
+ virtual void popRenderState(void)
+ {
+ PX_ASSERT(mStackIndex);
+ if ( mStackIndex > 0 )
+ {
+ mStackIndex--;
+ mCurrentState = mRenderStateStack[mStackIndex];
+ if ( mRenderStateStack[mStackIndex].mPose )
+ {
+ mCurrentState.mPose = &mCurrentState.mCurrentPose;
+ }
+ PostRenderDebug::updateBufferChangeCount(mCurrentState);
+ mCurrentState.incrementChangeCount();
+ }
+ }
+
+
+ virtual void setCurrentColor(uint32_t color=0xFFFFFF,uint32_t arrowColor=0xFF0000)
+ {
+ mCurrentState.mColor = color;
+ mCurrentState.mArrowColor = arrowColor;
+ mCurrentState.incrementChangeCount();
+ }
+
+ virtual uint32_t getCurrentColor(void) const
+ {
+ return mCurrentState.mColor;
+ }
+
+ /**
+ \brief Set the current debug texture
+
+ \param textureEnum1 Which predefined texture to use as the primary texture
+ \param tileRate1 The tiling rate to use for the primary texture
+ \param textureEnum2 Which (optional) predefined texture to use as the primary texture
+ \param tileRate2 The tiling rate to use for the secondary texture
+ */
+ virtual void setCurrentTexture(DebugTextures::Enum textureEnum1,float tileRate1,DebugTextures::Enum textureEnum2,float tileRate2)
+ {
+ mCurrentState.mTexture1 = textureEnum1;
+ mCurrentState.mTexture2 = textureEnum2;
+ mCurrentState.mTileRate1 = tileRate1;
+ mCurrentState.mTileRate2 = tileRate2;
+ mCurrentState.incrementChangeCount();
+ }
+
+ /**
+ \brief Gets the current tiling rate of the primary texture
+
+ \return The current tiling rate of the primary texture
+ */
+ virtual float getCurrentTile1(void) const
+ {
+ return mCurrentState.mTileRate1;
+ }
+
+ /**
+ \brief Gets the current tiling rate of the secondary texture
+
+ \return The current tiling rate of the secondary texture
+ */
+ virtual float getCurrentTile2(void) const
+ {
+ return mCurrentState.mTileRate2;
+ }
+
+ /**
+ \brief Gets the current debug texture
+
+ \return The current texture id
+ */
+ virtual DebugTextures::Enum getCurrentTexture1(void) const
+ {
+ return static_cast<DebugTextures::Enum>(mCurrentState.mTexture1);
+ }
+
+ /**
+ \brief Gets the current debug texture
+
+ \return The current texture id
+ */
+ virtual DebugTextures::Enum getCurrentTexture2(void) const
+ {
+ return static_cast<DebugTextures::Enum>(mCurrentState.mTexture2);
+ }
+
+
+ virtual uint32_t getCurrentArrowColor(void) const
+ {
+ return mCurrentState.mArrowColor;
+ }
+
+
+ virtual void setCurrentUserId(int32_t userId)
+ {
+ mCurrentState.mUserId = userId;
+ mCurrentState.incrementChangeCount();
+ }
+
+ virtual int32_t getCurrentUserId(void)
+ {
+ return mCurrentState.mUserId;
+ }
+
+ virtual void setCurrentDisplayTime(float displayTime=0.0001f)
+ {
+ mCurrentState.mDisplayTime = displayTime;
+ mCurrentState.incrementChangeCount();
+ }
+
+ virtual float getRenderScale(void)
+ {
+ return mCurrentState.mRenderScale;
+ }
+
+ virtual void setRenderScale(float scale)
+ {
+ mCurrentState.mRenderScale = scale;
+ mCurrentState.incrementChangeCount();
+ }
+
+ virtual void setCurrentState(uint32_t states=0)
+ {
+ mCurrentState.mStates = states;
+ mCurrentState.incrementChangeCount();
+ }
+
+ virtual void addToCurrentState(RENDER_DEBUG::DebugRenderState::Enum state) // OR this state flag into the current state.
+ {
+ mCurrentState.mStates|=state;
+ mCurrentState.incrementChangeCount();
+ }
+
+ virtual void removeFromCurrentState(RENDER_DEBUG::DebugRenderState::Enum state) // Remove this bit flat from the current state
+ {
+ mCurrentState.mStates&=~state;
+ mCurrentState.incrementChangeCount();
+ }
+
+ virtual void setCurrentTextScale(float textScale)
+ {
+ mCurrentState.mTextScale = textScale;
+ mCurrentState.incrementChangeCount();
+ }
+
+ virtual void setCurrentArrowSize(float arrowSize)
+ {
+ mCurrentState.mArrowSize = arrowSize;
+ mCurrentState.incrementChangeCount();
+ }
+
+ virtual uint32_t getCurrentState(void) const
+ {
+ return mCurrentState.mStates;
+ }
+
+ virtual void setRenderState(uint32_t states=0, // combination of render state flags
+ uint32_t color=0xFFFFFF, // base color
+ float displayTime=0.0001f, // duration of display items.
+ uint32_t arrowColor=0xFF0000, // secondary color, usually used for arrow head
+ float arrowSize=0.1f,
+ float renderScale=1.0f,
+ float textScale=1.0f) // seconary size, usually used for arrow head size.
+ {
+ uint32_t saveChangeCount = mCurrentState.mChangeCount;
+ new ( &mCurrentState ) RenderState(states,color,displayTime,arrowColor,arrowSize,renderScale,textScale);
+ mCurrentState.mChangeCount = saveChangeCount;
+ mCurrentState.incrementChangeCount();
+ }
+
+
+ virtual uint32_t getRenderState(uint32_t &color,float &displayTime,uint32_t &arrowColor,float &arrowSize,float &renderScale,float & /*textScale*/) const
+ {
+ color = mCurrentState.mColor;
+ displayTime = mCurrentState.mDisplayTime;
+ arrowColor = mCurrentState.mArrowColor;
+ arrowSize = mCurrentState.mArrowSize;
+ renderScale = mCurrentState.mRenderScale;
+ return mCurrentState.mStates;
+ }
+
+
+ virtual void endDrawGroup(void)
+ {
+ popRenderState();
+ PostRenderDebug::updatePostDrawGroupPose(mCurrentState);
+ }
+
+ virtual void setDrawGroupVisible(int32_t blockId,bool state)
+ {
+ const physx::shdfnd::HashMap<uint32_t, BlockInfo *>::Entry *e = mBlocksHash.find(uint32_t(blockId));
+ if ( e )
+ {
+ BlockInfo *b = e->second;
+ if ( b->mVisibleState != state )
+ {
+ b->mVisibleState = state;
+ }
+ }
+ }
+
+ virtual void debugPolygon(uint32_t pcount,const physx::PxVec3 *points)
+ {
+ if ( mCurrentState.isSolid() )
+ {
+ PX_ASSERT( pcount >= 3 );
+ PX_ASSERT( pcount <= 256 );
+ bool wasOverlay = mCurrentState.hasRenderState(RENDER_DEBUG::DebugRenderState::SolidWireShaded);
+ if( wasOverlay )
+ {
+ mCurrentState.clearRenderState(RENDER_DEBUG::DebugRenderState::SolidWireShaded);
+ mCurrentState.incrementChangeCount();
+ }
+ const physx::PxVec3 *v1 = &points[0];
+ const physx::PxVec3 *v2 = &points[1];
+ const physx::PxVec3 *v3 = &points[2];
+ debugTri(*v1, *v2, *v3);
+ for (uint32_t i=3; i<pcount; i++)
+ {
+ v2 = v3;
+ v3 = &points[i];
+ debugTri(*v1, *v2, *v3);
+ }
+ if ( wasOverlay )
+ {
+ for (uint32_t i=0; i<(pcount-1); i++)
+ {
+ debugLine( points[i], points[i+1] );
+ }
+ debugLine(points[pcount-1],points[0]);
+ mCurrentState.setRenderState(RENDER_DEBUG::DebugRenderState::SolidWireShaded);
+ mCurrentState.incrementChangeCount();
+ }
+ }
+ else
+ {
+ for (uint32_t i=0; i<(pcount-1); i++)
+ {
+ debugLine( points[i], points[i+1] );
+ }
+ debugLine(points[pcount-1],points[0]);
+ }
+ }
+
+ virtual void debugLine(const physx::PxVec3 &p1,const physx::PxVec3 &p2)
+ {
+ DebugLine d(p1,p2);
+ PostRenderDebug::postRenderDebug(&d,mCurrentState);
+ }
+
+
+ virtual void debugFrustum(const physx::PxMat44 &view,const physx::PxMat44 &proj)
+ {
+ DebugFrustum f(view,proj);
+ PostRenderDebug::postRenderDebug(&f,mCurrentState);
+ }
+
+ virtual void debugCone(float length,float innerAngle,float outerAngle,uint32_t subDivision,bool closeEnd)
+ {
+ DebugCone c(length,innerAngle,outerAngle,subDivision,closeEnd);
+ PostRenderDebug::postRenderDebug(&c,mCurrentState);
+ }
+
+ virtual void debugBound(const physx::PxBounds3 &_b)
+ {
+ DebugBound b(_b.minimum,_b.maximum );
+ PostRenderDebug::postRenderDebug(&b,mCurrentState);
+ }
+
+ virtual void debugBound(const physx::PxVec3 &bmin,const physx::PxVec3 &bmax)
+ {
+ DebugBound b(bmin,bmax);
+ PostRenderDebug::postRenderDebug(&b,mCurrentState);
+ }
+
+ virtual void debugPoint(const physx::PxVec3 &pos,float radius)
+ {
+ DebugPoint d(pos,radius);
+ PostRenderDebug::postRenderDebug(&d,mCurrentState);
+ }
+
+ virtual void debugQuad(const physx::PxVec3 &pos,const physx::PxVec2 &scale,float rotation)
+ {
+ DebugQuad d(pos,scale,rotation);
+ PostRenderDebug::postRenderDebug(&d,mCurrentState);
+ }
+
+
+ virtual void debugPoint(const physx::PxVec3 &pos,const physx::PxVec3 &radius)
+ {
+ DebugPointScale d(pos,radius);
+ PostRenderDebug::postRenderDebug(&d,mCurrentState);
+ }
+
+
+ virtual void debugGraph(uint32_t /*numPoints*/, float * /*points*/, float /*graphMax*/, float /*graphXPos*/, float /*graphYPos*/, float /*graphWidth*/, float /*graphHeight*/, uint32_t /*colorSwitchIndex*/ = 0xFFFFFFFF)
+ {
+ PX_ALWAYS_ASSERT();
+ }
+
+
+ virtual void debugRect2d(float x1,float y1,float x2,float y2)
+ {
+ DebugRect2d d(x1,y1,x2,y2);
+ PostRenderDebug::postRenderDebug(&d,mCurrentState);
+ }
+
+ virtual void debugGradientLine(const physx::PxVec3 &p1,const physx::PxVec3 &p2,const uint32_t &c1,const uint32_t &c2)
+ {
+ DebugGradientLine d(p1,p2,c1,c2);
+ PostRenderDebug::postRenderDebug(&d,mCurrentState);
+ }
+
+ virtual void debugRay(const physx::PxVec3 &p1,const physx::PxVec3 &p2)
+ {
+ DebugRay d(p1,p2);
+ PostRenderDebug::postRenderDebug(&d,mCurrentState);
+ }
+
+ virtual void debugCylinder(const physx::PxVec3 &p1,const physx::PxVec3 &p2,float radius)
+ {
+ DebugPointCylinder d(p1,p2,radius);
+ PostRenderDebug::postRenderDebug(&d,mCurrentState);
+ }
+
+ virtual void debugThickRay(const physx::PxVec3 &p1,const physx::PxVec3 &p2,float raySize=0.02f, bool arrowTip=true)
+ {
+ DebugThickRay d(p1,p2,raySize,arrowTip);
+ PostRenderDebug::postRenderDebug(&d,mCurrentState);
+ }
+
+ virtual void debugPlane(const physx::PxPlane &p,float radius1,float radius2)
+ {
+ DebugPlane d(p.n,p.d,radius1,radius2);
+ PostRenderDebug::postRenderDebug(&d,mCurrentState);
+ }
+
+ virtual void debugTri(const physx::PxVec3 &p1,const physx::PxVec3 &p2,const physx::PxVec3 &p3)
+ {
+ DebugTri d(p1,p2,p3);
+ PostRenderDebug::postRenderDebug(&d,mCurrentState);
+ }
+
+ virtual void debugTriNormals(const physx::PxVec3 &p1,const physx::PxVec3 &p2,const physx::PxVec3 &p3,const physx::PxVec3 &n1,const physx::PxVec3 &n2,const physx::PxVec3 &n3)
+ {
+ DebugTriNormals d(p1,p2,p3,n1,n2,n3);
+ PostRenderDebug::postRenderDebug(&d,mCurrentState);
+ }
+
+ virtual void debugGradientTri(const physx::PxVec3 &p1,const physx::PxVec3 &p2,const physx::PxVec3 &p3,const uint32_t &c1,const uint32_t &c2,const uint32_t &c3)
+ {
+ DebugGradientTri d(p1,p2,p3,c1,c2,c3);
+ PostRenderDebug::postRenderDebug(&d,mCurrentState);
+ }
+
+ virtual void debugGradientTriNormals(const physx::PxVec3 &p1,const physx::PxVec3 &p2,const physx::PxVec3 &p3,const physx::PxVec3 &n1,const physx::PxVec3 &n2,const physx::PxVec3 &n3,const uint32_t &c1,const uint32_t &c2,const uint32_t &c3)
+ {
+ DebugGradientTriNormals d(p1,p2,p3,n1,n2,n3,c1,c2,c3);
+ PostRenderDebug::postRenderDebug(&d,mCurrentState);
+ }
+
+ virtual void debugSphere(const physx::PxVec3 &pos, float radius,uint32_t subdivision)
+ {
+ if ( subdivision < 1 )
+ {
+ subdivision = 1;
+ }
+ else if ( subdivision > 4 )
+ {
+ subdivision = 4;
+ }
+ physx::PxMat44 pose = physx::PxMat44(physx::PxIdentity);
+ pose.setPosition(pos);
+ debugOrientedSphere(radius, subdivision, pose);
+ }
+
+ void debugOrientedSphere(float radius, uint32_t subdivision,const physx::PxMat44 &transform)
+ {
+ pushRenderState();
+ if ( mCurrentState.mPose )
+ {
+ physx::PxMat44 xform = *mCurrentState.mPose*transform;
+ setPose(xform);
+ }
+ else
+ {
+ setPose(transform);
+ }
+
+ DebugSphere d(radius, subdivision);
+ PostRenderDebug::postRenderDebug(&d,mCurrentState);
+
+ popRenderState();
+ }
+
+ // a squashed sphere
+ virtual void debugOrientedSphere(const physx::PxVec3 &radius, uint32_t subdivision,const physx::PxMat44 &transform)
+ {
+ pushRenderState();
+ if ( mCurrentState.mPose )
+ {
+ physx::PxMat44 xform = *mCurrentState.mPose*transform;
+ setPose(xform);
+ }
+ else
+ {
+ setPose(transform);
+ }
+
+ DebugSquashedSphere d(radius, subdivision);
+ PostRenderDebug::postRenderDebug(&d,mCurrentState);
+
+ popRenderState();
+ }
+
+
+ virtual void debugCapsule(float radius,float height,uint32_t subdivision)
+ {
+ DebugCapsule d(radius,height,subdivision);
+ PostRenderDebug::postRenderDebug(&d,mCurrentState);
+ }
+
+ virtual void debugCapsuleTapered(float radius1, float radius2, float height, uint32_t subdivision)
+ {
+ DebugTaperedCapsule d(radius1, radius2, height, subdivision);
+ PostRenderDebug::postRenderDebug(&d, mCurrentState);
+ }
+
+ virtual void debugCylinder(float radius,float height,bool closeSides,uint32_t subdivision)
+ {
+ DebugCylinder d(radius,height,subdivision,closeSides);
+ PostRenderDebug::postRenderDebug(&d,mCurrentState);
+ }
+
+ virtual void debugCircle(const physx::PxVec3 &center,float radius,uint32_t subdivision)
+ {
+ pushRenderState();
+ physx::PxMat44 transform(physx::PxIdentity);
+ transform.setPosition(center);
+ if ( mCurrentState.mPose )
+ {
+ physx::PxMat44 xform = *mCurrentState.mPose*transform;
+ setPose(xform);
+ }
+ else
+ {
+ setPose(transform);
+ }
+ DebugCircle d(radius,subdivision,false);
+ PostRenderDebug::postRenderDebug(&d,mCurrentState);
+ popRenderState();
+ }
+
+ virtual void debugAxes(const physx::PxMat44 &transform,float distance=0.1f,float brightness=1.0f,bool showXYZ=false,bool showRotation=false, uint32_t axisSwitch=4, DebugAxesRenderMode::Enum renderMode = DebugAxesRenderMode::DEBUG_AXES_RENDER_SOLID)
+ {
+ DebugAxes d(transform,distance,brightness,showXYZ,showRotation,axisSwitch, renderMode);
+ PostRenderDebug::postRenderDebug(&d,mCurrentState);
+ }
+
+ virtual void debugArc(const physx::PxVec3 &center,const physx::PxVec3 &p1,const physx::PxVec3 &p2,float arrowSize=0.1f,bool showRoot=false)
+ {
+ DebugArc d(center,p1,p2,arrowSize,showRoot);
+ PostRenderDebug::postRenderDebug(&d,mCurrentState);
+ }
+
+ virtual void debugThickArc(const physx::PxVec3 &center,const physx::PxVec3 &p1,const physx::PxVec3 &p2,float thickness=0.02f,bool showRoot=false)
+ {
+ DebugThickArc d(center,p1,p2,thickness,showRoot);
+ PostRenderDebug::postRenderDebug(&d,mCurrentState);
+ }
+
+ virtual void debugDetailedSphere(const physx::PxVec3 &pos,float radius,uint32_t stepCount)
+ {
+ DebugDetailedSphere d(pos,radius,stepCount);
+ PostRenderDebug::postRenderDebug(&d,mCurrentState);
+ }
+
+ /**
+ \brief Debug visualize a text string rendered using a simple 2d font.
+
+ \param x The X position of the text in normalized screen space 0 is the left of the screen and 1 is the right of the screen.
+ \param y The Y position of the text in normalized screen space 0 is the top of the screen and 1 is the bottom of the screen.
+ \param scale The scale of the font; these are not true-type fonts, so this is simple sprite scales. A scale of 0.5 is a nice default value.
+ \param shadowOffset The font is displayed with a drop shadow to make it easier to distinguish against the background; a value between 1 to 6 looks ok.
+ \param forceFixWidthNumbers This bool controls whether numeric values are printed as fixed width or not.
+ \param textColor the 32 bit ARGB value color to use for this piece of text.
+ \param fmt A printf style format string followed by optional arguments
+ */
+ virtual void debugText2D(float x,
+ float y,
+ float scale,
+ float shadowOffset,
+ bool forceFixWidthNumbers,
+ uint32_t textColor,
+ const char *fmt,...)
+ {
+ char wbuff[16384];
+ wbuff[16383] = 0;
+ va_list arg;
+ va_start( arg, fmt );
+ physx::shdfnd::vsnprintf(wbuff,sizeof(wbuff)-1, fmt, arg);
+ va_end(arg);
+ DebugText2D dt(physx::PxVec2(x,y),scale,shadowOffset,forceFixWidthNumbers,textColor,wbuff);
+ PostRenderDebug::postRenderDebug(&dt,mCurrentState);
+ }
+
+
+ virtual void debugText(const physx::PxVec3 &pos,const char *fmt,...)
+ {
+ char wbuff[16384];
+ wbuff[16383] = 0;
+ va_list arg;
+ va_start( arg, fmt );
+ physx::shdfnd::vsnprintf(wbuff,sizeof(wbuff)-1, fmt, arg);
+ va_end(arg);
+ physx::PxMat44 pose = mCurrentState.mPose ? *mCurrentState.mPose : physx::PxMat44(physx::PxIdentity);
+ DebugText dt(pos,pose,wbuff);
+ PostRenderDebug::postRenderDebug(&dt,mCurrentState);
+ }
+
+ virtual void setViewMatrix(const physx::PxMat44 &view)
+ {
+ memcpy( mViewMatrix44, &view, 16*sizeof( float ) );
+ updateVP();
+ if ( mProcessRenderDebug )
+ {
+ const physx::PxMat44 *view44 = (reinterpret_cast<const physx::PxMat44 *>(mViewMatrix44));
+ mProcessRenderDebug->setViewMatrix(*view44);
+ }
+ }
+
+ virtual void setProjectionMatrix(const physx::PxMat44 &projection)
+ {
+ memcpy( mProjectionMatrix44, &projection, 16*sizeof( float ) );
+ updateVP();
+ }
+
+ void updateVP(void)
+ {
+ float* e = mViewProjectionMatrix44;
+ for( int c = 0; c < 4; ++c )
+ {
+ for( int r = 0; r < 4; ++r, ++e )
+ {
+ float sum = 0;
+ for( int k = 0; k < 4; ++k )
+ {
+ sum += mProjectionMatrix44[r+(k<<2)]*mViewMatrix44[k+(c<<2)];
+ }
+ *e = sum;
+ }
+ }
+ // grab the world-space eye position.
+ const physx::PxMat44 *view44 = (reinterpret_cast<const physx::PxMat44 *>(mViewMatrix44));
+ physx::PxMat44 viewInverse = view44->inverseRT();
+ mEyePos = viewInverse.transform( physx::PxVec3( 0.0f, 0.0f, 0.0f ));
+ }
+
+ virtual const float* getViewProjectionMatrix(void) const
+ {
+ return mViewProjectionMatrix44;
+ }
+
+ virtual const physx::PxMat44* getViewProjectionMatrixTyped(void) const
+ {
+ return (reinterpret_cast<const physx::PxMat44 *>(mViewProjectionMatrix44));
+ }
+
+
+ virtual const float *getViewMatrix(void) const
+ {
+ return mViewMatrix44; // returns column major array
+ }
+
+ virtual const physx::PxMat44 *getViewMatrixTyped(void) const
+ {
+ return (reinterpret_cast<const physx::PxMat44 *>(mViewMatrix44)); // returns column major array
+ }
+
+
+ virtual const float *getProjectionMatrix(void) const
+ {
+ return mProjectionMatrix44; // returns column major array
+ }
+
+ virtual const physx::PxMat44 *getProjectionMatrixTyped(void) const
+ {
+ return (reinterpret_cast<const physx::PxMat44 *>(mProjectionMatrix44)); // returns column major array
+ }
+
+
+ // quat to rotate v0 t0 v1
+ PX_INLINE physx::PxQuat rotationArc(const physx::PxVec3& v0, const physx::PxVec3& v1)
+ {
+ const physx::PxVec3 cross = v0.cross(v1);
+ const float d = v0.dot(v1);
+ if(d<=-0.99999f)
+ return (physx::PxAbs(v0.x)<0.1f ? physx::PxQuat(0.0f, v0.z, -v0.y, 0.0f) : physx::PxQuat(v0.y, -v0.x, 0.0, 0.0)).getNormalized();
+
+ const float s = physx::PxSqrt((1+d)*2), r = 1/s;
+
+ return physx::PxQuat(cross.x*r, cross.y*r, cross.z*r, s*0.5f).getNormalized();
+ }
+
+
+ /**
+ \brief A convenience method to convert a position and direction vector into a 4x4 transform
+
+ \param p0 Start position
+ \param p1 Rotate to position
+ \param xform Output transform
+
+ */
+ virtual void rotationArc(const physx::PxVec3 &p0,const physx::PxVec3 &p1,physx::PxMat44 &xform)
+ {
+ physx::PxVec3 dir = p1-p0;
+ dir.normalize();
+
+ physx::PxTransform t;
+ t.p = p0;
+ t.q = rotationArc(physx::PxVec3(0,1.0f,0),dir);
+ xform = physx::PxMat44(t);
+ }
+
+ /**
+ \brief A convenience method to convert a position and direction vector into a 4x4 transform
+
+ \param p0 The origin
+ \param p1 Rotate to position
+ \param xform Ouput transform
+
+ */
+ virtual void rotationArc(const float p0[3],const float p1[3],float xform[16])
+ {
+ rotationArc(*(reinterpret_cast<const physx::PxVec3 *>(p0)),*(reinterpret_cast<const physx::PxVec3 *>(p1)),*(reinterpret_cast<physx::PxMat44 *>(xform)));
+ }
+
+ virtual void eulerToQuat(const physx::PxVec3 &angles, physx::PxQuat &q) // angles are in degrees.
+ {
+ float roll = angles.x*0.5f*FM_DEG_TO_RAD;
+ float pitch = angles.y*0.5f*FM_DEG_TO_RAD;
+ float yaw = angles.z*0.5f*FM_DEG_TO_RAD;
+
+ float cr = cosf(roll);
+ float cp = cosf(pitch);
+ float cy = cosf(yaw);
+
+ float sr = sinf(roll);
+ float sp = sinf(pitch);
+ float sy = sinf(yaw);
+
+ float cpcy = cp * cy;
+ float spsy = sp * sy;
+ float spcy = sp * cy;
+ float cpsy = cp * sy;
+
+ float x = ( sr * cpcy - cr * spsy);
+ float y = ( cr * spcy + sr * cpsy);
+ float z = ( cr * cpsy - sr * spcy);
+ float w = cr * cpcy + sr * spsy;
+ q = physx::PxQuat(x,y,z,w);
+ }
+
+ virtual int32_t beginDrawGroup(const physx::PxMat44 &pose)
+ {
+ pushRenderState();
+
+ setRenderState(RENDER_DEBUG::DebugRenderState::InfiniteLifeSpan,0xFFFFFF,0.0001f,0xFF0000,0.1f,mCurrentState.mRenderScale,mCurrentState.mTextScale);
+
+ mBlockIndex++;
+ mCurrentState.mBlockInfo = mBlocks.construct();
+ mCurrentState.mBlockInfo->mHashValue = mBlockIndex;
+ mCurrentState.mBlockInfo->mPose = pose;
+ mBlocksHash[mBlockIndex] = mCurrentState.mBlockInfo;
+
+ return int32_t(mBlockIndex);
+ }
+
+ virtual void setDrawGroupPose(int32_t blockId,const physx::PxMat44 &pose)
+ {
+ const physx::shdfnd::HashMap<uint32_t, BlockInfo *>::Entry *e = mBlocksHash.find(uint32_t(blockId));
+ if ( e )
+ {
+ BlockInfo *b = e->second;
+ if ( memcmp(&pose,&b->mPose,sizeof(physx::PxMat44)) != 0 ) // if the pose has changed...
+ {
+ b->mPose = pose;
+ b->mChanged = true;
+ }
+ }
+ }
+
+ /**
+ \brief Sets the global pose for the current debug-rendering context. This is preserved on the state stack.
+
+ \param pos Sets the translation component
+ \param quat Sets the rotation component as a quat
+ */
+ virtual void setPose(const float pos[3],const float quat[4])
+ {
+ physx::PxTransform t(*(reinterpret_cast<const physx::PxVec3 *>(pos)),*(reinterpret_cast<const physx::PxQuat *>(quat)));
+ physx::PxMat44 xform(t);
+ setPose(xform.front());
+ }
+
+ /**
+ \brief Sets the global pose position only, does not change the rotation.
+
+ \param pos Sets the translation component
+ */
+ virtual void setPosition(const float pos[3])
+ {
+ setPosition( *(reinterpret_cast<const physx::PxVec3 *>(pos)));
+ }
+
+ /**
+ \brief Sets the global pose orientation only, does not change the position
+
+ \param quat Sets the orientation of the global pose
+ */
+ virtual void setOrientation(const float quat[3])
+ {
+ setOrientation( *(reinterpret_cast<const physx::PxQuat *>(quat)));
+ }
+
+ /**
+ \brief Sets the global pose back to identity
+ */
+ virtual void setIdentityPose(void)
+ {
+ mCurrentState.mPose = NULL;
+ mCurrentState.mCurrentPose = physx::PxMat44(physx::PxIdentity);
+ mCurrentState.incrementChangeCount();
+ }
+
+ /**
+ \brief Sets the global pose for the current debug-rendering context. This is preserved on the state stack.
+
+ \param pose Sets the pose from a position and quaternion rotation
+ */
+ virtual void setPose(const physx::PxTransform &pose)
+ {
+ physx::PxMat44 m(pose);
+ setPose(m);
+ }
+
+ /**
+ \brief Sets the global pose position only, does not change the rotation.
+
+ \param position Sets the translation component
+ */
+ virtual void setPosition(const physx::PxVec3 &position)
+ {
+ physx::PxMat44 m = mCurrentState.mCurrentPose;
+ m.setPosition(position);
+ setPose(m);
+ }
+
+ /**
+ \brief Sets the global pose orientation only, does not change the position
+
+ \param rot Sets the orientation of the global pose
+ */
+ virtual void setOrientation(const physx::PxQuat &rot)
+ {
+ physx::PxMat44 m(rot);
+ m.setPosition(mCurrentState.mCurrentPose.getPosition());
+ setPose(m);
+ }
+
+
+ virtual void setPose(const physx::PxMat44 &pose)
+ {
+ physx::PxMat44 id = physx::PxMat44(physx::PxIdentity);
+ if ( id.column0 != pose.column0 ||
+ id.column1 != pose.column1 ||
+ id.column2 != pose.column2 ||
+ id.column3 != pose.column3 )
+ {
+ mCurrentState.mCurrentPose = pose;
+ mCurrentState.mPose = &mCurrentState.mCurrentPose;
+ }
+ else
+ {
+ mCurrentState.mPose = NULL;
+ mCurrentState.mCurrentPose = physx::PxMat44(physx::PxIdentity);
+ }
+ mCurrentState.incrementChangeCount();
+ }
+
+ virtual const physx::PxMat44 * getPoseTyped(void) const
+ {
+ return &mCurrentState.mCurrentPose;
+ }
+
+ virtual const float *getPose(void) const
+ {
+ return reinterpret_cast<const float *>(&mCurrentState.mCurrentPose);
+ }
+
+
+ /* \brief Create an createDebugGraphDesc. This is the manual way of setting up a graph. Every parameter can
+ and must be customized when using this constructor.
+ */
+ virtual DebugGraphDesc* createDebugGraphDesc(void)
+ {
+ DebugGraphDesc* dGDPtr = static_cast<DebugGraphDesc *>(PX_ALLOC(sizeof(DebugGraphDesc), PX_DEBUG_EXP("DebugGraphDesc")));
+ new (dGDPtr ) DebugGraphDesc;
+
+ dGDPtr->mNumPoints = 0;
+ dGDPtr->mPoints = NULL;
+ dGDPtr->mGraphXLabel = NULL;
+ dGDPtr->mGraphYLabel = NULL;
+ dGDPtr->mGraphColor = 0x00FF0000;
+ dGDPtr->mArrowColor = 0x0000FF00;
+ dGDPtr->mColorSwitchIndex = uint32_t(-1);
+ dGDPtr->mGraphMax = 0.0f;
+ dGDPtr->mGraphXPos = 0.0f;
+ dGDPtr->mGraphYPos = 0.0f;
+ dGDPtr->mGraphWidth = 0.0f;
+ dGDPtr->mGraphHeight = 0.0f;
+ dGDPtr->mCutOffLevel = 0.0f;
+ return(dGDPtr);
+ }
+
+ virtual void releaseDebugGraphDesc(DebugGraphDesc *desc)
+ {
+ PX_FREE(desc);
+ }
+
+ /**
+ \brief Create an createDebugGraphDesc using the minimal amount of work. This constructor provides for six custom
+ graphs to be simultaneously drawn on the display at one time numbered 0 to 5. The position, color, and size
+ of the graphs are automatically set based on the graphNum argument.
+ */
+ #define LEFT_X (-0.9f)
+ #define RIGHT_X (+0.1f)
+ #define TOP_Y (+0.4f)
+ #define MID_Y (-0.2f)
+ #define BOTTOM_Y (-0.8f)
+ virtual DebugGraphDesc* createDebugGraphDesc(uint32_t graphNum,uint32_t dataCount,const float *dataArray, float maxY, char* xLabel, char* yLabel)
+ {
+ static struct
+ {
+ float xPos, yPos;
+ } graphData[MAX_GRAPHS] =
+ {
+ {LEFT_X, TOP_Y},
+ {LEFT_X, MID_Y},
+ {LEFT_X, BOTTOM_Y},
+ {RIGHT_X, TOP_Y},
+ {RIGHT_X, MID_Y},
+ {RIGHT_X, BOTTOM_Y}
+ };
+ PX_ASSERT(graphNum < MAX_GRAPHS);
+ DebugGraphDesc* dGDPtr = createDebugGraphDesc();
+
+ dGDPtr->mGraphColor = 0x00FF0000;
+ dGDPtr->mArrowColor = 0x0000FF00;
+ dGDPtr->mColorSwitchIndex = uint32_t(-1);
+
+ // no cut off line by default
+ dGDPtr->mCutOffLevel = 0.0f;
+ dGDPtr->mNumPoints = dataCount;
+ dGDPtr->mPoints = dataArray;
+ dGDPtr->mGraphMax = maxY;
+ dGDPtr->mGraphXLabel = xLabel;
+ dGDPtr->mGraphYLabel = yLabel;
+
+ dGDPtr->mGraphXPos = graphData[graphNum].xPos;
+ dGDPtr->mGraphYPos = graphData[graphNum].yPos;;
+ dGDPtr->mGraphWidth = GRAPH_WIDTH_DEFAULT;
+ dGDPtr->mGraphHeight = GRAPH_HEIGHT_DEFAULT;
+
+ return(dGDPtr);
+ }
+
+ virtual void debugGraph(const DebugGraphDesc& graphDesc)
+ {
+ DebugGraphStream d(graphDesc);
+ PostRenderDebug::postRenderDebug(&d,mCurrentState);
+ }
+
+ /**
+ \brief Set a debug color value by name.
+ */
+ virtual void setDebugColor(RENDER_DEBUG::DebugColors::Enum colorEnum, uint32_t value)
+ {
+ if( colorEnum < RENDER_DEBUG::DebugColors::NUM_COLORS )
+ {
+ colors[ colorEnum ] = value;
+ }
+ }
+
+ /**
+ \brief Return a debug color value by name.
+ */
+ virtual uint32_t getDebugColor(RENDER_DEBUG::DebugColors::Enum colorEnum) const
+ {
+ if( colorEnum < RENDER_DEBUG::DebugColors::NUM_COLORS )
+ {
+ return colors[ colorEnum ];
+ }
+ return 0;
+ }
+
+ /**
+ \brief Return a debug color value by RGB inputs
+ */
+ virtual uint32_t getDebugColor(float red, float green, float blue) const
+ {
+ union
+ {
+ uint8_t colorChars[4];
+ uint32_t color;
+ };
+
+ colorChars[3] = 0xff; // alpha
+ colorChars[2] = uint8_t(red * 255);
+ colorChars[1] = uint8_t(green * 255);
+ colorChars[0] = uint8_t(blue * 255);
+
+ return color;
+ }
+
+ virtual void debugMessage(const char *fmt,...)
+ {
+ mCanSkip = false;
+ char wbuff[16384];
+ wbuff[16383] = 0;
+ va_list arg;
+ va_start( arg, fmt );
+ physx::shdfnd::vsnprintf(wbuff,sizeof(wbuff)-1, fmt, arg);
+ va_end(arg);
+ DebugMessage dt(wbuff);
+ PostRenderDebug::postRenderDebug(&dt,mCurrentState);
+ }
+
+ /**
+ \brief Render a set of instanced triangle meshes.
+ */
+ virtual void renderTriangleMeshInstances(uint32_t meshId, // The ID of the previously created triangle mesh
+ uint32_t instanceCount, // The number of instances to render
+ const RENDER_DEBUG::RenderDebugInstance *instances) // The array of poses for each instance
+ {
+ DebugRenderTriangleMeshInstances dt(meshId,instanceCount,instances);
+ PostRenderDebug::postRenderDebug(&dt,mCurrentState);
+ }
+
+
+ /**
+ \brief Create a debug texture based on a filename
+
+ \param id The id associated with this custom texture, must be greater than 28; the reserved ids for detail textures
+ \param fname The name of the DDS file associated with this texture.
+ */
+ virtual void createCustomTexture(uint32_t id,const char *fname)
+ {
+ mCanSkip = false;
+ DebugCreateCustomTexture dt(id,fname);
+ PostRenderDebug::postRenderDebug(&dt,mCurrentState);
+ }
+
+
+ /**
+ \brief Create a triangle mesh that we can render. Assumes an indexed triangle mesh. User provides a *unique* id. If it is not unique, this will fail.
+ */
+ virtual void createTriangleMesh(uint32_t meshId, // The unique mesh ID
+ uint32_t vcount, // The number of vertices in the triangle mesh
+ const RENDER_DEBUG::RenderDebugMeshVertex *meshVertices, // The array of vertices
+ uint32_t tcount, // The number of triangles (indices must contain tcount*3 values)
+ const uint32_t *indices) // The array of triangle mesh indices
+ {
+ mCanSkip = false;
+ DebugCreateTriangleMesh dt(meshId,vcount,meshVertices,tcount,indices);
+ PostRenderDebug::postRenderDebug(&dt,mCurrentState);
+ }
+
+ /**
+ \brief Refresh a sub-section of the vertices in a previously created triangle mesh.
+
+ \param vcount This is the number of vertices to refresh.
+ \param refreshVertices This is an array of revised vertex data.
+ \param refreshIndices This is an array of indices which correspond to the original triangle mesh submitted. There should be one index for each vertex.
+ */
+ virtual void refreshTriangleMeshVertices(uint32_t meshId,
+ uint32_t vcount,
+ const RenderDebugMeshVertex *refreshVertices,
+ const uint32_t *refreshIndices)
+ {
+ if ( vcount && refreshVertices && refreshIndices )
+ {
+ DebugRefreshTriangleMeshVertices dt(meshId,vcount,refreshVertices,refreshIndices);
+ PostRenderDebug::postRenderDebug(&dt,mCurrentState);
+ }
+ }
+
+ /**
+ \brief Release a previously created triangle mesh
+ */
+ virtual void releaseTriangleMesh(uint32_t meshId)
+ {
+ mCanSkip = false;
+ DebugReleaseTriangleMesh d(meshId);
+ PostRenderDebug::postRenderDebug(&d,mCurrentState);
+ }
+
+ /**
+ \brief Render a set of data points, either as wire-frame cross hairs or as a small solid instanced mesh.
+
+ This callback provides the ability to (as rapidly as possible) render a large number of
+
+ \param mode Determines what mode to render the point data
+ \param meshId The ID of the previously created triangle mesh if rendering in mesh mode
+ \param textureId1 The ID of the primary texture
+ \param textureTile1 The UV tiling rate of the primary texture
+ \param textureId2 The ID of the secondary texture
+ \param textureTile2 The UV tiling rate of the secondary texture
+ \param pointCount The number of points to render
+ \param points The array of points to render
+ */
+ virtual void debugPoints(PointRenderMode mode,
+ uint32_t meshId,
+ uint32_t textureId1,
+ float textureTile1,
+ uint32_t textureId2,
+ float textureTile2,
+ uint32_t pointCount,
+ const float *points)
+ {
+ DebugRenderPoints dt(meshId,mode,textureId1,textureTile1,textureId2,textureTile2,pointCount,points);
+ PostRenderDebug::postRenderDebug(&dt,mCurrentState);
+ }
+
+ /**
+ \brief This method will produce a debug visualization of a convex hull; either as lines or solid triang;es depending on the current debug render state
+
+ \param planeCount The number of planes in the convex hull
+ \param planes The array of plane equations in the convex hull
+ */
+ virtual void debugConvexHull(uint32_t planeCount,
+ const float *planes)
+ {
+ DebugConvexHull dt(planeCount,planes);
+ PostRenderDebug::postRenderDebug(&dt,mCurrentState);
+ }
+
+ /**
+ \brief Implement this method to display lines output from the RenderDebug library
+
+ \param lcount The number of lines to draw (vertex count=lines*2)
+ \param vertices The pairs of vertices for each line segment
+ \param useZ Whether or not these should be zbuffered
+ \param isScreenSpace Whether or not these are in homogeneous screen-space co-ordinates
+ */
+ virtual void debugRenderLines(uint32_t lcount,
+ const RenderDebugVertex *vertices,
+ bool useZ,
+ bool isScreenSpace)
+ {
+ DebugRenderLines dt(lcount,vertices,useZ ? 1U : 0U,isScreenSpace ? 1U : 0U);
+ PostRenderDebug::postRenderDebug(&dt,mCurrentState);
+ }
+
+ /**
+ \brief Implement this method to display solid shaded triangles without any texture surce.
+
+ \param tcount The number of triangles to render. (vertex count=tcount*2)
+ \param vertices The vertices for each triangle
+ \param useZ Whether or not these should be zbuffered
+ \param isScreenSpace Whether or not these are in homogeneous screen-space co-ordinates
+ */
+ virtual void debugRenderTriangles(uint32_t tcount,
+ const RenderDebugSolidVertex *vertices,
+ bool useZ,
+ bool isScreenSpace)
+ {
+ DebugRenderTriangles dt(tcount,vertices,useZ ? 1U : 0U,isScreenSpace ? 1U : 0U);
+ PostRenderDebug::postRenderDebug(&dt,mCurrentState);
+ }
+
+private:
+
+ void initColors()
+ {
+#define INIT_COLOR( name, defVal, minVal, maxVal ) \
+ colorsDefValue[ name ] = uint32_t(defVal); \
+ colorsMinValue[ name ] = uint32_t(minVal); \
+ colorsMaxValue[ name ] = uint32_t(maxVal);
+
+ INIT_COLOR(RENDER_DEBUG::DebugColors::Default, 0x00000000, 0, UINT32_MAX);
+ INIT_COLOR(RENDER_DEBUG::DebugColors::PoseArrows, 0x00000000, 0, UINT32_MAX);
+ INIT_COLOR(RENDER_DEBUG::DebugColors::MeshStatic, 0x00000000, 0, UINT32_MAX);
+ INIT_COLOR(RENDER_DEBUG::DebugColors::MeshDynamic, 0x00000000, 0, UINT32_MAX);
+ INIT_COLOR(RENDER_DEBUG::DebugColors::Shape, 0x00000000, 0, UINT32_MAX);
+ INIT_COLOR(RENDER_DEBUG::DebugColors::Text0, 0x00000000, 0, UINT32_MAX);
+ INIT_COLOR(RENDER_DEBUG::DebugColors::Text1, 0x00000000, 0, UINT32_MAX);
+ INIT_COLOR(RENDER_DEBUG::DebugColors::ForceArrowsLow, 0xffffff00, 0, UINT32_MAX);
+ INIT_COLOR(RENDER_DEBUG::DebugColors::ForceArrowsNorm,0xff00ff00, 0, UINT32_MAX);
+ INIT_COLOR(RENDER_DEBUG::DebugColors::ForceArrowsHigh,0xffff0000, 0, UINT32_MAX);
+ INIT_COLOR(RENDER_DEBUG::DebugColors::Color0, 0x00000000, 0, UINT32_MAX);
+ INIT_COLOR(RENDER_DEBUG::DebugColors::Color1, 0x00000000, 0, UINT32_MAX);
+ INIT_COLOR(RENDER_DEBUG::DebugColors::Color2, 0x00000000, 0, UINT32_MAX);
+ INIT_COLOR(RENDER_DEBUG::DebugColors::Color3, 0x00000000, 0, UINT32_MAX);
+ INIT_COLOR(RENDER_DEBUG::DebugColors::Color4, 0x00000000, 0, UINT32_MAX);
+ INIT_COLOR(RENDER_DEBUG::DebugColors::Color5, 0x00000000, 0, UINT32_MAX);
+ INIT_COLOR(RENDER_DEBUG::DebugColors::Red, 0xffff0000, 0, UINT32_MAX);
+ INIT_COLOR(RENDER_DEBUG::DebugColors::Green, 0xff00ff00, 0, UINT32_MAX);
+ INIT_COLOR(RENDER_DEBUG::DebugColors::Blue, 0xff0000ff, 0, UINT32_MAX);
+ INIT_COLOR(RENDER_DEBUG::DebugColors::DarkRed, 0xff800000, 0, UINT32_MAX);
+ INIT_COLOR(RENDER_DEBUG::DebugColors::DarkGreen, 0xff008000, 0, UINT32_MAX);
+ INIT_COLOR(RENDER_DEBUG::DebugColors::DarkBlue, 0xff000080, 0, UINT32_MAX);
+ INIT_COLOR(RENDER_DEBUG::DebugColors::LightRed, 0xffff8080, 0, UINT32_MAX);
+ INIT_COLOR(RENDER_DEBUG::DebugColors::LightGreen, 0xff80ff00, 0, UINT32_MAX);
+ INIT_COLOR(RENDER_DEBUG::DebugColors::LightBlue, 0xff00ffff, 0, UINT32_MAX);
+ INIT_COLOR(RENDER_DEBUG::DebugColors::Purple, 0xffff00ff, 0, UINT32_MAX);
+ INIT_COLOR(RENDER_DEBUG::DebugColors::DarkPurple, 0xff800080, 0, UINT32_MAX);
+ INIT_COLOR(RENDER_DEBUG::DebugColors::Yellow, 0xffffff00, 0, UINT32_MAX);
+ INIT_COLOR(RENDER_DEBUG::DebugColors::Orange, 0xffff8000, 0, UINT32_MAX);
+ INIT_COLOR(RENDER_DEBUG::DebugColors::Gold, 0xff808000, 0, UINT32_MAX);
+ INIT_COLOR(RENDER_DEBUG::DebugColors::Emerald, 0xff008080, 0, UINT32_MAX);
+ INIT_COLOR(RENDER_DEBUG::DebugColors::White, 0xffffffff, 0, UINT32_MAX);
+ INIT_COLOR(RENDER_DEBUG::DebugColors::Black, 0xff000000, 0, UINT32_MAX);
+ INIT_COLOR(RENDER_DEBUG::DebugColors::Gray, 0xff808080, 0, UINT32_MAX);
+ INIT_COLOR(RENDER_DEBUG::DebugColors::LightGray, 0xffC0C0C0, 0, UINT32_MAX);
+ INIT_COLOR(RENDER_DEBUG::DebugColors::DarkGray, 0xff404040, 0, UINT32_MAX);
+#undef INIT_COLOR
+
+ memcpy( colors, colorsDefValue, sizeof(uint32_t) * RENDER_DEBUG::DebugColors::NUM_COLORS );
+ }
+
+ void releaseRenderDebug(void)
+ {
+ delete this;
+ }
+
+
+//*****************************************************
+//**** Non-typed version of methods
+//*****************************************************
+
+ virtual void debugPolygon(uint32_t pcount,const float *points)
+ {
+ debugPolygon(pcount,(reinterpret_cast<const physx::PxVec3 *>(points)));
+ }
+
+ virtual void debugLine(const float p1[3],const float p2[3])
+ {
+ debugLine( *(reinterpret_cast<const physx::PxVec3 *>(p1)),*(reinterpret_cast<const physx::PxVec3 *>(p2)));
+ }
+
+ virtual void debugGradientLine(const float p1[3],const float p2[3],const uint32_t &c1,const uint32_t &c2)
+ {
+ debugGradientLine(*(reinterpret_cast<const physx::PxVec3 *>(p1)),*(reinterpret_cast<const physx::PxVec3 *>(p2)),c1,c2);
+ }
+
+ virtual void debugRay(const float p1[3],const float p2[3])
+ {
+ debugRay(*(reinterpret_cast<const physx::PxVec3 *>(p1)),*(reinterpret_cast<const physx::PxVec3 *>(p2)));
+ }
+
+ virtual void debugCylinder(const float p1[3],const float p2[3],float radius)
+ {
+ debugCylinder(*(reinterpret_cast<const physx::PxVec3 *>(p1)),*(reinterpret_cast<const physx::PxVec3 *>(p2)),radius);
+ }
+
+ virtual void debugThickRay(const float p1[3],const float p2[3],float raySize=0.02f,bool includeArrow=true)
+ {
+ debugThickRay(*(reinterpret_cast<const physx::PxVec3 *>(p1)),*(reinterpret_cast<const physx::PxVec3 *>(p2)),raySize,includeArrow);
+ }
+
+ virtual void debugPlane(const float normal[3],float dCoff,float radius1,float radius2)
+ {
+ physx::PxPlane p(normal[0],normal[1],normal[2],dCoff);
+ debugPlane(p,radius1,radius2);
+ }
+
+ virtual void debugTri(const float p1[3],const float p2[3],const float p3[3])
+ {
+ debugTri(*(reinterpret_cast<const physx::PxVec3 *>(p1)),*(reinterpret_cast<const physx::PxVec3 *>(p2)),*(reinterpret_cast<const physx::PxVec3 *>(p3)));
+ }
+
+ virtual void debugTriNormals(const float p1[3],const float p2[3],const float p3[3],const float n1[3],const float n2[3],const float n3[3])
+ {
+ debugTriNormals(*(reinterpret_cast<const physx::PxVec3 *>(p1)),*(reinterpret_cast<const physx::PxVec3 *>(p2)),*(reinterpret_cast<const physx::PxVec3 *>(p3)),*(reinterpret_cast<const physx::PxVec3 *>(n1)),*(reinterpret_cast<const physx::PxVec3 *>(n2)),*(reinterpret_cast<const physx::PxVec3 *>(n3)));
+ }
+
+ virtual void debugGradientTri(const float p1[3],const float p2[3],const float p3[3],const uint32_t &c1,const uint32_t &c2,const uint32_t &c3)
+ {
+ debugGradientTri(*(reinterpret_cast<const physx::PxVec3 *>(p1)),*(reinterpret_cast<const physx::PxVec3 *>(p2)),*(reinterpret_cast<const physx::PxVec3 *>(p3)),c1,c2,c3);
+ }
+
+ virtual void debugGradientTriNormals(const float p1[3],const float p2[3],const float p3[3],const float n1[3],const float n2[3],const float n3[3],const uint32_t &c1,const uint32_t &c2,const uint32_t &c3)
+ {
+ debugGradientTriNormals(*(reinterpret_cast<const physx::PxVec3 *>(p1)),*(reinterpret_cast<const physx::PxVec3 *>(p2)),*(reinterpret_cast<const physx::PxVec3 *>(p3)),*(reinterpret_cast<const physx::PxVec3 *>(n1)),*(reinterpret_cast<const physx::PxVec3 *>(n2)),*(reinterpret_cast<const physx::PxVec3 *>(n3)),c1,c2,c3);
+ }
+
+ virtual void debugBound(const float bmin[3],const float bmax[3])
+ {
+ physx::PxBounds3 b(*(reinterpret_cast<const physx::PxVec3 *>(bmin)),*(reinterpret_cast<const physx::PxVec3 *>(bmax)));
+ debugBound(b);
+ }
+
+ virtual void debugSphere(const float pos[3],float radius,uint32_t subdivision)
+ {
+ debugSphere(*(reinterpret_cast<const physx::PxVec3 *>(pos)),radius,subdivision);
+ }
+
+
+ virtual void debugCircle(const float center[3],float radius,uint32_t subdivision)
+ {
+ debugCircle(*(reinterpret_cast<const physx::PxVec3 *>(center)),radius,subdivision);
+ }
+
+ virtual void debugPoint(const float pos[3],float radius)
+ {
+ debugPoint(*(reinterpret_cast<const physx::PxVec3 *>(pos)),radius);
+ }
+
+ virtual void debugPoint(const float pos[3],const float scale[3])
+ {
+ debugPoint(*(reinterpret_cast<const physx::PxVec3 *>(pos)),*(reinterpret_cast<const physx::PxVec3 *>(scale)));
+ }
+
+ virtual void debugQuad(const float pos[3],const float scale[2],float orientation)
+ {
+ debugQuad(*(reinterpret_cast<const physx::PxVec3 *>(pos)),*reinterpret_cast<const physx::PxVec2 *>(scale),orientation);
+ }
+
+ virtual void debugAxes(const float transform[16],float distance=0.1f,float brightness=1.0f,bool showXYZ=false,bool showRotation=false,uint32_t axisSwitch=4, DebugAxesRenderMode::Enum renderMode = DebugAxesRenderMode::DEBUG_AXES_RENDER_SOLID)
+ {
+ debugAxes(*(reinterpret_cast<const physx::PxMat44 *>(transform)),distance,brightness,showXYZ,showRotation,axisSwitch,renderMode);
+ }
+
+ virtual void debugArc(const float center[3],const float p1[3],const float p2[3],float arrowSize=0.1f,bool showRoot=false)
+ {
+ debugArc(*(reinterpret_cast<const physx::PxVec3 *>(center)),*(reinterpret_cast<const physx::PxVec3 *>(p1)),*(reinterpret_cast<const physx::PxVec3 *>(p2)),arrowSize,showRoot);
+ }
+
+ virtual void debugThickArc(const float center[3],const float p1[3],const float p2[3],float thickness=0.02f,bool showRoot=false)
+ {
+ debugThickArc(*(reinterpret_cast<const physx::PxVec3 *>(center)),*(reinterpret_cast<const physx::PxVec3 *>(p1)),*(reinterpret_cast<const physx::PxVec3 *>(p2)),thickness,showRoot);
+ }
+
+ virtual void debugText(const float pos[3],const char *fmt,...)
+ {
+ char wbuff[16384];
+ wbuff[16383] = 0;
+ va_list arg;
+ va_start( arg, fmt );
+ physx::shdfnd::vsnprintf(wbuff,sizeof(wbuff)-1, fmt, arg);
+ va_end(arg);
+ debugText(*(reinterpret_cast<const physx::PxVec3 *>(pos)),"%s",wbuff);
+ }
+
+ virtual void setViewMatrix(const float view[16])
+ {
+ setViewMatrix(*(reinterpret_cast<const physx::PxMat44 *>(view)));
+ }
+
+ virtual void setProjectionMatrix(const float projection[16])
+ {
+ setProjectionMatrix(*(reinterpret_cast<const physx::PxMat44 *>(projection)));
+ }
+
+ virtual void eulerToQuat(const float angles[3],float q[4]) // angles are in degrees.
+ {
+ eulerToQuat(*(reinterpret_cast<const physx::PxVec3 *>(angles)),*(reinterpret_cast<physx::PxQuat *>(q)));
+ }
+
+ virtual int32_t beginDrawGroup(const float pose[16])
+ {
+ return beginDrawGroup(*(reinterpret_cast<const physx::PxMat44 *>(pose)));
+ }
+
+ virtual void setDrawGroupPose(int32_t blockId,const float pose[16])
+ {
+ setDrawGroupPose(blockId,*(reinterpret_cast<const physx::PxMat44 *>(pose)));
+ }
+
+ virtual void debugDetailedSphere(const float pos[3],float radius,uint32_t stepCount)
+ {
+ debugDetailedSphere(*(reinterpret_cast<const physx::PxVec3 *>(pos)),radius,stepCount);
+ }
+
+ virtual void setPose(const float pose[16])
+ {
+ setPose(*(reinterpret_cast<const physx::PxMat44 *>(pose)));
+ }
+
+ virtual void debugFrustum(const float view[16],const float proj[16])
+ {
+ debugFrustum( *(reinterpret_cast<const physx::PxMat44 *>(view)),*(reinterpret_cast<const physx::PxMat44 *>(proj)));
+ }
+
+
+//*****************************************************
+// ** Methods which get hooked back through the main parent interface.
+ /**
+ \brief Begins a file-playback session. Returns the number of recorded frames in the recording file. Zero if the file was not valid.
+ */
+ virtual uint32_t setFilePlayback(const char *fileName)
+ {
+ return mRenderDebugHook->setFilePlayback(fileName);
+ }
+
+ /**
+ \brief Set's the file playback to a specific frame. Returns true if successful.
+ */
+ virtual bool setPlaybackFrame(uint32_t playbackFrame)
+ {
+ return mRenderDebugHook->setPlaybackFrame(playbackFrame);
+ }
+
+ /**
+ \brief Returns the number of recorded frames in the debug render recording file.
+ */
+ virtual uint32_t getPlaybackFrameCount(void) const
+ {
+ return mRenderDebugHook->getPlaybackFrameCount();
+ }
+
+ /**
+ \brief Stops the current recording playback.
+ */
+ virtual void stopPlayback(void)
+ {
+ mRenderDebugHook->stopPlayback();
+ }
+
+ /**
+ \brief Do a 'try' lock on the global render debug mutex. This is simply provided as an optional convenience if you are accessing RenderDebug from multiple threads and want to prevent contention.
+ */
+ virtual bool trylock(void)
+ {
+ return mRenderDebugHook->trylock();
+ }
+
+ /**
+ \brief Lock the global render-debug mutex to avoid thread contention.
+ */
+ virtual void lock(void)
+ {
+ mRenderDebugHook->lock();
+ }
+
+ /**
+ \brief Unlock the global render-debug mutex
+ */
+ virtual void unlock(void)
+ {
+ mRenderDebugHook->unlock();
+ }
+
+ /**
+ \brief Convenience method to return a unique mesh id number (simply a global counter to avoid clashing with other ids
+ */
+ virtual uint32_t getMeshId(void)
+ {
+ return mRenderDebugHook->getMeshId();
+ }
+
+ /**
+ \brief Send a command from the server to the client. This could be any arbitrary console command, it can also be mouse drag events, debug visualization events, etc.
+ * the client receives this command in argc/argv format.
+ */
+ virtual bool sendRemoteCommand(const char *fmt,...)
+ {
+ char buff[16384];
+ buff[16383] = 0;
+ va_list arg;
+ va_start( arg, fmt );
+ physx::shdfnd::vsnprintf(buff,sizeof(buff)-1, fmt, arg);
+ va_end(arg);
+ return mRenderDebugHook->sendRemoteCommand("%s",buff);
+ }
+
+ /**
+ \brief If running in client mode, poll this method to retrieve any pending commands from the server. If it returns NULL then there are no more commands.
+ */
+ virtual const char ** getRemoteCommand(uint32_t &argc)
+ {
+ return mRenderDebugHook->getRemoteCommand(argc);
+ }
+
+ /**
+ \brief Transmits an arbitrary block of binary data to the remote machine. The block of data can have a command and id associated with it.
+
+ It is important to note that due to the fact the RenderDebug system is synchronized every single frame, it is strongly recommended
+ that you only use this feature for relatively small data items; probably on the order of a few megabytes at most. If you try to do
+ a very large transfer, in theory it would work, but it might take a very long time to complete and look like a hang since it will
+ essentially be blocking.
+
+ \param nameSpace An arbitrary command associated with this data transfer, for example this could indicate a remote file request.
+ \param resourceName An arbitrary id associated with this data transfer, for example the id could be the file name of a file transfer request.
+ \param data The block of binary data to transmit, you are responsible for maintaining endian correctness of the internal data if necessary.
+ \param dlen The length of the lock of data to transmit.
+
+ \return Returns true if the data was queued to be transmitted, false if it failed.
+ */
+ virtual bool sendRemoteResource(const char *nameSpace,
+ const char *resourceName,
+ const void *data,
+ uint32_t dlen)
+ {
+ return mRenderDebugHook->sendRemoteResource(nameSpace,resourceName,data,dlen);
+ }
+
+
+ /**
+ \brief Retrieves a block of remotely transmitted binary data.
+
+ \param nameSpace A a reference to a pointer which will store the namespace (type) associated with this data transfer, for example this could indicate a remote file request.
+ \param resourceName A reference to a pointer which will store the resource name associated with this data transfer, for example the resource name could be the file name of a file transfer request.
+ \param dlen A reference that will contain length of the lock of data received.
+ \param remoteIsBigEndian A reference to a boolean which will be set to true if the remote machine that sent this data is big endian format.
+
+ \retrun A pointer to the block of data received.
+ */
+ virtual const void * getRemoteResource(const char *&nameSpace,
+ const char *&resourceName,
+ uint32_t &dlen,
+ bool &remoteIsBigEndian)
+ {
+ return mRenderDebugHook->getRemoteResource(nameSpace,resourceName,dlen,remoteIsBigEndian);
+ }
+
+ /**
+ \brief This function allows you to request a file from the remote machine by name. If successful it will be returned via 'getRemoteData'
+
+ \param command The command field associated with this request which will be returned by 'getRemoteData'
+ \param fileName The filename being requested from the remote machine.
+
+ \return Returns true if the request was queued to be transmitted, false if it failed.
+ */
+ virtual bool requestRemoteResource(const char *command,
+ const char *fileName)
+ {
+ return mRenderDebugHook->requestRemoteResource(command,fileName);
+ }
+
+ /**
+ \brief Report what 'Run' mode we are operation gin.
+ */
+ virtual RenderDebug::RunMode getRunMode(void)
+ {
+ return mRenderDebugHook->getRunMode();
+ }
+
+ /**
+ \brief Returns true if we still have a valid connection to the server.
+ */
+ virtual bool isConnected(void) const
+ {
+ return mRenderDebugHook->isConnected();
+ }
+
+ /**
+ \brief Returns the current synchronized frame between client/server communications. Returns zero if no active connection exists.
+ */
+ virtual uint32_t getCommunicationsFrame(void) const
+ {
+ return mRenderDebugHook->getCommunicationsFrame();
+ }
+
+ virtual const char *getRemoteApplicationName(void)
+ {
+ return mRenderDebugHook->getRemoteApplicationName();
+ }
+
+ /**
+ \brief Returns the optional typed methods for various render debug routines.
+ */
+ virtual RenderDebugTyped *getRenderDebugTyped(void)
+ {
+ return mRenderDebugHook->getRenderDebugTyped();
+ }
+
+ /**
+ \brief Release the render debug class
+ */
+ virtual void release(void)
+ {
+ mRenderDebugHook->release();
+ }
+
+ virtual bool render(float dtime,RENDER_DEBUG::RenderDebugInterface *iface)
+ {
+ return mRenderDebugHook->render(dtime,iface);
+ }
+
+ /**
+ \brief register a digital input event (maps to windows keyboard commands)
+
+ \param eventId The eventId for this input event; if it is a custom event it must be greater than NUM_SAMPLE_FRAMEWORK_INPUT_EVENT_IDS
+ \param inputId This the pre-defined keyboard code for this input event.
+ */
+ virtual void registerDigitalInputEvent(InputEventIds::Enum eventId,InputIds::Enum inputId)
+ {
+ mCanSkip = false;
+ DebugRegisterInputEvent dt(true,eventId,0.0f,inputId);
+ PostRenderDebug::postRenderDebug(&dt,mCurrentState);
+ }
+
+ virtual void unregisterInputEvent(InputEventIds::Enum eventId)
+ {
+ mCanSkip = false;
+ DebugUnregisterInputEvent dt(eventId);
+ PostRenderDebug::postRenderDebug(&dt,mCurrentState);
+ }
+
+
+ /**
+ \brief register a digital input event (maps to windows keyboard commands)
+
+ \param eventId The eventId for this input event; if it is a custom event it must be greater than NUM_SAMPLE_FRAMEWORK_INPUT_EVENT_IDS
+ \param sensitivity The sensitivity value associated with this anaglog devent; default value is 1.0
+ \param inputId This the pre-defined analog code for this input event.
+ */
+ virtual void registerAnalogInputEvent(InputEventIds::Enum eventId,float sensitivity,InputIds::Enum inputId)
+ {
+ mCanSkip = false;
+ DebugRegisterInputEvent dt(false,eventId,sensitivity,inputId);
+ PostRenderDebug::postRenderDebug(&dt,mCurrentState);
+ }
+
+ /**
+ \brief Reset all input events to an empty state
+ */
+ virtual void resetInputEvents(void)
+ {
+ mCanSkip = false;
+ DebugPrimitiveU32 dt(DebugCommand::DEBUG_RESET_INPUT_EVENTS,0);
+ PostRenderDebug::postRenderDebug(&dt,mCurrentState);
+ }
+
+ virtual void sendInputEvent(const InputEvent &ev)
+ {
+ if ( mRenderDebugHook )
+ {
+ mRenderDebugHook->sendInputEvent(ev);
+ }
+ }
+
+ /**
+ \brief Returns any incoming input event for processing purposes
+ */
+ virtual const InputEvent *getInputEvent(bool flush)
+ {
+ const InputEvent *e = NULL;
+
+ if ( mRenderDebugHook )
+ {
+ e = mRenderDebugHook->getInputEvent(flush);
+ }
+ return e;
+ }
+
+ /**
+ \brief Set the base file name to record communications tream; or NULL to disable it.
+
+ \param fileName The base name of the file to record the communications channel stream to, or NULL to disable it.
+ */
+ virtual bool setStreamFilename(const char *fileName)
+ {
+ bool ret = false;
+ if ( mRenderDebugHook )
+ {
+ ret = mRenderDebugHook->setStreamFilename(fileName);
+ }
+ return ret;
+ }
+
+ /**
+ \brief Begin playing back a communications stream recording
+
+ \param fileName The name of the previously captured communications stream file
+ */
+ virtual bool setStreamPlayback(const char *fileName)
+ {
+ bool ret = false;
+ if ( mRenderDebugHook )
+ {
+ ret = mRenderDebugHook->setStreamPlayback(fileName);
+ }
+ return ret;
+ }
+
+ /**
+ \brief Special case command that affects how the server processes the previous frame of data.
+
+ \return Returns true if it is safe to skip this frame of data, false if there are required commands that must be executed.
+ */
+ virtual bool trySkipFrame(void)
+ {
+ if ( mCanSkip )
+ {
+ DebugPrimitiveU32 dt(DebugCommand::DEBUG_SKIP_FRAME,0);
+ PostRenderDebug::postRenderDebug(&dt,mCurrentState);
+ }
+ return mCanSkip;
+ }
+
+ bool mCanSkip;
+ RenderDebugHook *mRenderDebugHook;
+ uint32_t mUpdateCount;
+ ProcessRenderDebug *mProcessRenderDebug;
+ RenderState mCurrentState;
+ uint32_t mStackIndex;
+ RenderState mRenderStateStack[RENDER_STATE_STACK_SIZE];
+ mutable float mViewMatrix44[16];
+ mutable float mProjectionMatrix44[16];
+ mutable float mViewProjectionMatrix44[16];
+ physx::PxVec3 mEyePos;
+ //Colors for debug rendering purposes
+ uint32_t colors[RENDER_DEBUG::DebugColors::NUM_COLORS];
+ uint32_t colorsMinValue[RENDER_DEBUG::DebugColors::NUM_COLORS];
+ uint32_t colorsMaxValue[RENDER_DEBUG::DebugColors::NUM_COLORS];
+ uint32_t colorsDefValue[RENDER_DEBUG::DebugColors::NUM_COLORS];
+
+ uint32_t mBlockIndex;
+ physx::shdfnd::HashMap<uint32_t, BlockInfo *> mBlocksHash;
+ physx::shdfnd::Pool< BlockInfo > mBlocks;
+ float mFrameTime;
+ bool mOwnProcess;
+
+};
+
+DebugGraphStream::DebugGraphStream(const DebugGraphDesc &d) : DebugPrimitive(DebugCommand::DEBUG_GRAPH)
+{
+ physx::PsMemoryBuffer mb;
+ mb.setEndianMode(physx::PxFileBuf::ENDIAN_NONE);
+ nvidia::StreamIO stream(mb,0);
+
+ mSize = 0;
+ stream << mCommand;
+ stream << mSize;
+ stream << d.mNumPoints;
+ stream.storeString(d.mGraphXLabel ? d.mGraphXLabel : "",true);
+ stream.storeString(d.mGraphYLabel ? d.mGraphYLabel : "",true);
+
+ mb.alignWrite(4);
+
+ for (uint32_t i=0; i<d.mNumPoints; i++)
+ {
+ stream << d.mPoints[i];
+ }
+ stream << d.mCutOffLevel;
+ stream << d.mGraphMax;
+ stream << d.mGraphXPos;
+ stream << d.mGraphYPos;
+ stream << d.mGraphWidth;
+ stream << d.mGraphHeight;
+ stream << d.mGraphColor;
+ stream << d.mArrowColor;
+ stream << d.mColorSwitchIndex;
+
+ mBuffer = mb.getWriteBufferOwnership(mSize);
+ mAllocated = true;
+}
+
+DebugGraphStream::~DebugGraphStream(void)
+{
+ if ( mAllocated )
+ {
+ PX_FREE(mBuffer);
+ }
+}
+
+
+DebugCreateTriangleMesh::DebugCreateTriangleMesh(uint32_t meshId,
+ uint32_t vcount, // The number of vertices in the triangle mesh
+ const RENDER_DEBUG::RenderDebugMeshVertex *meshVertices, // The array of vertices
+ uint32_t tcount, // The number of triangles (indices must contain tcount*3 values)
+ const uint32_t *indices) : DebugPrimitive(DebugCommand::DEBUG_CREATE_TRIANGLE_MESH)
+{
+ physx::PsMemoryBuffer mb;
+ mb.setEndianMode(physx::PxFileBuf::ENDIAN_NONE);
+ nvidia::StreamIO stream(mb,0);
+
+ mSize = 0;
+ stream << mCommand;
+ stream << mSize;
+ stream << meshId;
+ stream << vcount;
+ stream << tcount;
+
+ if ( vcount )
+ {
+ mb.write(meshVertices,sizeof(RENDER_DEBUG::RenderDebugMeshVertex)*vcount);
+ }
+
+ if ( tcount )
+ {
+ mb.write(indices,sizeof(uint32_t)*tcount*3);
+ }
+
+ mBuffer = mb.getWriteBufferOwnership(mSize);
+
+ uint32_t *dest = reinterpret_cast<uint32_t *>(mBuffer);
+ dest[1] = mSize;
+
+ mAllocated = true;
+}
+
+DebugCreateTriangleMesh::~DebugCreateTriangleMesh(void)
+{
+ if ( mAllocated )
+ {
+ PX_FREE(mBuffer);
+ }
+}
+
+
+DebugRefreshTriangleMeshVertices::DebugRefreshTriangleMeshVertices(uint32_t meshId,
+ uint32_t vcount, // The number of vertices in the triangle mesh
+ const RENDER_DEBUG::RenderDebugMeshVertex *meshVertices, // The array of vertices
+ const uint32_t *indices) : DebugPrimitive(DebugCommand::DEBUG_REFRESH_TRIANGLE_MESH_VERTICES)
+{
+ physx::PsMemoryBuffer mb;
+ mb.setEndianMode(physx::PxFileBuf::ENDIAN_NONE);
+ nvidia::StreamIO stream(mb,0);
+
+ mSize = 0;
+ stream << mCommand;
+ stream << mSize;
+ stream << meshId;
+ stream << vcount;
+
+ if ( vcount )
+ {
+ mb.write(meshVertices,sizeof(RENDER_DEBUG::RenderDebugMeshVertex)*vcount);
+ }
+
+ if ( vcount )
+ {
+ mb.write(indices,sizeof(uint32_t)*vcount);
+ }
+
+ mBuffer = mb.getWriteBufferOwnership(mSize);
+
+ uint32_t *dest = reinterpret_cast<uint32_t *>(mBuffer);
+ dest[1] = mSize;
+
+ mAllocated = true;
+}
+
+DebugRefreshTriangleMeshVertices::~DebugRefreshTriangleMeshVertices(void)
+{
+ if ( mAllocated )
+ {
+ PX_FREE(mBuffer);
+ }
+}
+
+
+DebugRenderTriangleMeshInstances::DebugRenderTriangleMeshInstances(uint32_t meshId,
+ uint32_t instanceCount,
+ const RENDER_DEBUG::RenderDebugInstance *instances) : DebugPrimitive(DebugCommand::DEBUG_RENDER_TRIANGLE_MESH_INSTANCES)
+{
+ physx::PsMemoryBuffer mb;
+ mb.setEndianMode(physx::PxFileBuf::ENDIAN_NONE);
+ nvidia::StreamIO stream(mb,0);
+
+ mSize = 0;
+ stream << mCommand;
+ stream << mSize;
+ stream << meshId;
+ stream << instanceCount;
+
+ if ( instanceCount )
+ {
+ mb.write(instances,sizeof(RENDER_DEBUG::RenderDebugInstance)*instanceCount);
+ }
+
+ mBuffer = mb.getWriteBufferOwnership(mSize);
+
+ uint32_t *dest = reinterpret_cast<uint32_t *>(mBuffer);
+ dest[1] = mSize;
+
+ mAllocated = true;
+}
+
+DebugRenderTriangleMeshInstances::~DebugRenderTriangleMeshInstances(void)
+{
+ if ( mAllocated )
+ {
+ PX_FREE(mBuffer);
+ }
+}
+
+DebugConvexHull::DebugConvexHull(uint32_t planeCount,const float *planes) : DebugPrimitive(DebugCommand::DEBUG_CONVEX_HULL)
+{
+ physx::PsMemoryBuffer mb;
+ mb.setEndianMode(physx::PxFileBuf::ENDIAN_NONE);
+ nvidia::StreamIO stream(mb,0);
+
+ mSize = 0;
+ stream << mCommand;
+ stream << mSize;
+ stream << planeCount;
+ if ( planeCount )
+ {
+ mb.write(planes,sizeof(float)*4*planeCount);
+ }
+ mBuffer = mb.getWriteBufferOwnership(mSize);
+
+ uint32_t *dest = reinterpret_cast<uint32_t *>(mBuffer);
+ dest[1] = mSize;
+
+ mAllocated = true;
+}
+
+DebugConvexHull::~DebugConvexHull(void)
+{
+ if ( mAllocated )
+ {
+ PX_FREE(mBuffer);
+ }
+}
+
+DebugRenderPoints::DebugRenderPoints(uint32_t meshId,
+ PointRenderMode mode,
+ uint32_t textureId1,
+ float textureTile1,
+ uint32_t textureId2,
+ float textureTile2,
+ uint32_t pointCount,
+ const float *points) : DebugPrimitive(DebugCommand::DEBUG_RENDER_POINTS)
+{
+ physx::PsMemoryBuffer mb;
+ mb.setEndianMode(physx::PxFileBuf::ENDIAN_NONE);
+ nvidia::StreamIO stream(mb,0);
+
+ mSize = 0;
+ stream << mCommand;
+ stream << mSize;
+ stream << meshId;
+ stream << uint32_t(mode);
+ stream << textureId1;
+ stream << textureTile1;
+ stream << textureId2;
+ stream << textureTile2;
+ stream << pointCount;
+
+ if ( pointCount )
+ {
+ mb.write(points,sizeof(float)*3*pointCount);
+ }
+
+ mBuffer = mb.getWriteBufferOwnership(mSize);
+
+ uint32_t *dest = reinterpret_cast<uint32_t *>(mBuffer);
+ dest[1] = mSize;
+
+ mAllocated = true;
+}
+
+DebugRenderPoints::~DebugRenderPoints(void)
+{
+ if ( mAllocated )
+ {
+ PX_FREE(mBuffer);
+ }
+}
+
+DebugRenderLines::DebugRenderLines(uint32_t lcount,
+ const RenderDebugVertex *vertices,
+ uint32_t useZ,
+ uint32_t isScreenSpace) : DebugPrimitive(DebugCommand::DEBUG_RENDER_LINES)
+{
+ physx::PsMemoryBuffer mb;
+ mb.setEndianMode(physx::PxFileBuf::ENDIAN_NONE);
+ nvidia::StreamIO stream(mb,0);
+
+ mSize = 0;
+ stream << mCommand;
+ stream << mSize;
+ stream << lcount;
+ stream << useZ;
+ stream << isScreenSpace;
+
+ if ( lcount )
+ {
+ mb.write(vertices,sizeof(RenderDebugVertex)*2*lcount);
+ }
+
+ mBuffer = mb.getWriteBufferOwnership(mSize);
+
+ uint32_t *dest = reinterpret_cast<uint32_t *>(mBuffer);
+ dest[1] = mSize;
+
+ mAllocated = true;
+}
+
+DebugRenderLines::~DebugRenderLines(void)
+{
+ if ( mAllocated )
+ {
+ PX_FREE(mBuffer);
+ }
+}
+
+
+DebugRenderTriangles::DebugRenderTriangles(uint32_t tcount,
+ const RenderDebugSolidVertex *vertices,
+ uint32_t useZ,
+ uint32_t isScreenSpace) : DebugPrimitive(DebugCommand::DEBUG_RENDER_TRIANGLES)
+{
+ physx::PsMemoryBuffer mb;
+ mb.setEndianMode(physx::PxFileBuf::ENDIAN_NONE);
+ nvidia::StreamIO stream(mb,0);
+
+ mSize = 0;
+ stream << mCommand;
+ stream << mSize;
+ stream << tcount;
+ stream << useZ;
+ stream << isScreenSpace;
+
+ if ( tcount )
+ {
+ mb.write(vertices,sizeof(RenderDebugSolidVertex)*3*tcount);
+ }
+
+ mBuffer = mb.getWriteBufferOwnership(mSize);
+
+ uint32_t *dest = reinterpret_cast<uint32_t*>(mBuffer);
+ dest[1] = mSize;
+
+ mAllocated = true;
+}
+
+DebugRenderTriangles::~DebugRenderTriangles(void)
+{
+ if ( mAllocated )
+ {
+ PX_FREE(mBuffer);
+ }
+}
+
+
+
+
+//
+
+RenderDebugImpl * createInternalRenderDebug(ProcessRenderDebug *process,RenderDebugHook *renderDebugHook)
+{
+ InternalRenderDebug *m = PX_NEW(InternalRenderDebug)(process,renderDebugHook);
+ return static_cast< RenderDebugImpl *>(m);
+}
+
+
+
+} // end of namespace
diff --git a/APEX_1.4/shared/general/RenderDebug/src/ProcessRenderDebug.cpp b/APEX_1.4/shared/general/RenderDebug/src/ProcessRenderDebug.cpp
new file mode 100644
index 00000000..41814a44
--- /dev/null
+++ b/APEX_1.4/shared/general/RenderDebug/src/ProcessRenderDebug.cpp
@@ -0,0 +1,3342 @@
+// This code contains NVIDIA Confidential Information and is disclosed to you
+// under a form of NVIDIA software license agreement provided separately to you.
+//
+// Notice
+// NVIDIA Corporation and its licensors retain all intellectual property and
+// proprietary rights in and to this software and related documentation and
+// any modifications thereto. Any use, reproduction, disclosure, or
+// distribution of this software and related documentation without an express
+// license agreement from NVIDIA Corporation is strictly prohibited.
+//
+// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
+// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
+// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
+// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// Information and code furnished is believed to be accurate and reliable.
+// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
+// information or for any infringement of patents or other rights of third parties that may
+// result from its use. No license is granted by implication or otherwise under any patent
+// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
+// This code supersedes and replaces all information previously supplied.
+// NVIDIA Corporation products are not authorized for use as critical
+// components in life support devices or systems without express written approval of
+// NVIDIA Corporation.
+//
+// Copyright (c) 2008-2013 NVIDIA Corporation. All rights reserved.
+
+#include "ProcessRenderDebug.h"
+#include "PsMemoryBuffer.h"
+#include "PxBounds3.h"
+#include "StreamIO.h"
+#include "Hull2MeshEdges.h"
+
+namespace RENDER_DEBUG
+{
+
+static float degToRad(const float a)
+{
+ return static_cast<float>(0.01745329251994329547) * a;
+}
+
+static physx::PxQuat slerp(const float t, const physx::PxQuat& left, const physx::PxQuat& right)
+{
+ const float quatEpsilon = (float(1.0e-8f));
+
+ float cosine = left.dot(right);
+ float sign = float(1);
+ if (cosine < 0)
+ {
+ cosine = -cosine;
+ sign = float(-1);
+ }
+
+ float sine = float(1) - cosine*cosine;
+
+ if(sine>=quatEpsilon*quatEpsilon)
+ {
+ sine = physx::PxSqrt(sine);
+ const float angle = physx::PxAtan2(sine, cosine);
+ const float i_sin_angle = float(1) / sine;
+
+ const float leftw = physx::PxSin(angle*(float(1)-t)) * i_sin_angle;
+ const float rightw = physx::PxSin(angle * t) * i_sin_angle * sign;
+
+ return left * leftw + right * rightw;
+ }
+
+ return left;
+}
+
+
+ physx::PxQuat NvShortestRotation(const physx::PxVec3& v0, const physx::PxVec3& v1)
+ {
+ const float d = v0.dot(v1);
+ const physx::PxVec3 cross = v0.cross(v1);
+
+ physx::PxQuat q = d>-1 ? physx::PxQuat(cross.x, cross.y, cross.z, 1+d)
+ : physx::PxAbs(v0.x)<0.1f ? physx::PxQuat(0.0f, v0.z, -v0.y, 0.0f) : physx::PxQuat(v0.y, -v0.x, 0.0f, 0.0f);
+
+ return q.getNormalized();
+ }
+
+
+
+ physx::PxMat44 invert(const physx::PxMat44 &m)
+ {
+ physx::PxMat44 inv;
+
+#define det3x3(a0, a1, a2, a3, a4, a5, a6, a7, a8) \
+ (a0 * (a4*a8 - a7*a5) - a1 * (a3*a8 - a6*a5) + a2 * (a3*a7 - a6*a4))
+
+ inv.column0.x = det3x3(m.column1.y, m.column1.z, m.column1.w, m.column2.y, m.column2.z, m.column2.w, m.column3.y, m.column3.z, m.column3.w);
+ inv.column0.y = -det3x3(m.column0.y, m.column0.z, m.column0.w, m.column2.y, m.column2.z, m.column2.w, m.column3.y, m.column3.z, m.column3.w);
+ inv.column0.z = det3x3(m.column0.y, m.column0.z, m.column0.w, m.column1.y, m.column1.z, m.column1.w, m.column3.y, m.column3.z, m.column3.w);
+ inv.column0.w = -det3x3(m.column0.y, m.column0.z, m.column0.w, m.column1.y, m.column1.z, m.column1.w, m.column2.y, m.column2.z, m.column2.w);
+
+ inv.column1.x = -det3x3(m.column1.x, m.column1.z, m.column1.w, m.column2.x, m.column2.z, m.column2.w, m.column3.x, m.column3.z, m.column3.w);
+ inv.column1.y = det3x3(m.column0.x, m.column0.z, m.column0.w, m.column2.x, m.column2.z, m.column2.w, m.column3.x, m.column3.z, m.column3.w);
+ inv.column1.z = -det3x3(m.column0.x, m.column0.z, m.column0.w, m.column1.x, m.column1.z, m.column1.w, m.column3.x, m.column3.z, m.column3.w);
+ inv.column1.w = det3x3(m.column0.x, m.column0.z, m.column0.w, m.column1.x, m.column1.z, m.column1.w, m.column2.x, m.column2.z, m.column2.w);
+
+ inv.column2.x = det3x3(m.column1.x, m.column1.y, m.column1.w, m.column2.x, m.column2.y, m.column2.w, m.column3.x, m.column3.y, m.column3.w);
+ inv.column2.y = -det3x3(m.column0.x, m.column0.y, m.column0.w, m.column2.x, m.column2.y, m.column2.w, m.column3.x, m.column3.y, m.column3.w);
+ inv.column2.z = det3x3(m.column0.x, m.column0.y, m.column0.w, m.column1.x, m.column1.y, m.column1.w, m.column3.x, m.column3.y, m.column3.w);
+ inv.column2.w = -det3x3(m.column0.x, m.column0.y, m.column0.w, m.column1.x, m.column1.y, m.column1.w, m.column2.x, m.column2.y, m.column2.w);
+
+ inv.column3.x = -det3x3(m.column1.x, m.column1.y, m.column1.z, m.column2.x, m.column2.y, m.column2.z, m.column3.x, m.column3.y, m.column3.z);
+ inv.column3.y = det3x3(m.column0.x, m.column0.y, m.column0.z, m.column2.x, m.column2.y, m.column2.z, m.column3.x, m.column3.y, m.column3.z);
+ inv.column3.z = -det3x3(m.column0.x, m.column0.y, m.column0.z, m.column1.x, m.column1.y, m.column1.z, m.column3.x, m.column3.y, m.column3.z);
+ inv.column3.w = det3x3(m.column0.x, m.column0.y, m.column0.z, m.column1.x, m.column1.y, m.column1.z, m.column2.x, m.column2.y, m.column2.z);
+
+#undef det3x3
+
+ float det = m.column0.x*inv.column0.x + m.column1.x*inv.column0.y + m.column2.x*inv.column0.z + m.column3.x*inv.column0.w;
+ PX_ASSERT(det!=0);
+ if(!det) det = 1.0f;
+ float invDet = 1.0f / det;
+
+ inv.column0 *= invDet;
+ inv.column1 *= invDet;
+ inv.column2 *= invDet;
+ inv.column3 *= invDet;
+
+ return inv;
+ }
+
+
+class ProcessRenderDebugHelper
+{
+public:
+ virtual void indirectDebugLine(const physx::PxVec3 &p1,const physx::PxVec3 &p2) = 0;
+protected:
+ virtual ~ProcessRenderDebugHelper(void) {}
+};
+
+const physx::PxVec3 debug_point[6] =
+{
+ physx::PxVec3(-1.0f, 0.0f, 0.0f), physx::PxVec3(1.0f, 0.0f, 0.0f),
+ physx::PxVec3(0.0f,-1.0f, 0.0f), physx::PxVec3(0.0f, 1.0f, 0.0f),
+ physx::PxVec3(0.0f, 0.0f,-1.0f), physx::PxVec3(0.0f, 0.0f, 1.0f)
+};
+
+// simple sphere, uses subdivision to enhance...
+static physx::PxVec3 simpleSpherePosition[6] =
+{
+ physx::PxVec3( 1.0f, 0.0f, 0.0f),
+ physx::PxVec3(-1.0f, 0.0f, 0.0f),
+ physx::PxVec3( 0.0f, 1.0f, 0.0f),
+ physx::PxVec3( 0.0f,-1.0f, 0.0f),
+ physx::PxVec3( 0.0f, 0.0f, 1.0f),
+ physx::PxVec3( 0.0f, 0.0f,-1.0f),
+};
+
+static uint32_t simpleSphereIndices[8*3] =
+{
+ 0, 2, 4,
+ 1, 4, 2,
+ 0, 5, 2,
+ 1, 2, 5,
+
+ 0, 4, 3,
+ 1, 3, 4,
+ 0, 3, 5,
+ 1, 5, 3,
+};
+
+
+const float FM_PI = 3.1415926535897932384626433832795028841971693993751f;
+const float FM_DEG_TO_RAD = ((2.0f * FM_PI) / 360.0f);
+//const float FM_RAD_TO_DEG = (360.0f / (2.0f * FM_PI));
+
+PX_INLINE void pxVec3FromArray(physx::PxVec3 &p,const float *pos)
+{
+ p.x = pos[0];
+ p.y = pos[1];
+ p.z = pos[2];
+}
+
+// quat to rotate v0 t0 v1
+static PX_INLINE physx::PxQuat rotationArc(const physx::PxVec3& v0, const physx::PxVec3& v1)
+{
+ const physx::PxVec3 cross = v0.cross(v1);
+ const float d = v0.dot(v1);
+ if(d<=-0.99999f)
+ return (physx::PxAbs(v0.x)<0.1f ? physx::PxQuat(0.0f, v0.z, -v0.y, 0.0f) : physx::PxQuat(v0.y, -v0.x, 0.0, 0.0)).getNormalized();
+
+ const float s = physx::PxSqrt((1+d)*2), r = 1/s;
+
+ return physx::PxQuat(cross.x*r, cross.y*r, cross.z*r, s*0.5f).getNormalized();
+}
+
+static PX_INLINE void rotationArc(const physx::PxVec3 &v0,const physx::PxVec3 &v1,physx::PxQuat &quat)
+{
+ quat = rotationArc(v0,v1);
+}
+
+/*const float debug_sphere[32*9] =
+{
+ 0.0000f, 0.0000f, 1.0000f, 0.7071f, 0.0000f, 0.7071f, 0.0000f, 0.7071f, 0.7071f,
+ 0.7071f, 0.0000f, 0.7071f, 1.0000f, 0.0000f, 0.0000f, 0.7071f, 0.7071f, 0.0000f,
+ 0.7071f, 0.0000f, 0.7071f, 0.7071f, 0.7071f, 0.0000f, 0.0000f, 0.7071f, 0.7071f,
+ 0.0000f, 0.7071f, 0.7071f, 0.7071f, 0.7071f, 0.0000f, 0.0000f, 1.0000f, 0.0000f,
+ 0.0000f, 0.0000f, 1.0000f, 0.0000f, 0.7071f, 0.7071f, -0.7071f, 0.0000f, 0.7071f,
+ 0.0000f, 0.7071f, 0.7071f, 0.0000f, 1.0000f, 0.0000f, -0.7071f, 0.7071f, 0.0000f,
+ 0.0000f, 0.7071f, 0.7071f, -0.7071f, 0.7071f, 0.0000f, -0.7071f, 0.0000f, 0.7071f,
+ -0.7071f, 0.0000f, 0.7071f, -0.7071f, 0.7071f, 0.0000f, -1.0000f, 0.0000f, 0.0000f,
+ 0.0000f, 0.0000f, 1.0000f, -0.7071f, 0.0000f, 0.7071f, 0.0000f, -0.7071f, 0.7071f,
+ -0.7071f, 0.0000f, 0.7071f, -1.0000f, 0.0000f, 0.0000f, -0.7071f, -0.7071f, 0.0000f,
+ -0.7071f, 0.0000f, 0.7071f, -0.7071f, -0.7071f, 0.0000f, 0.0000f, -0.7071f, 0.7071f,
+ 0.0000f, -0.7071f, 0.7071f, -0.7071f, -0.7071f, 0.0000f, 0.0000f, -1.0000f, 0.0000f,
+ 0.0000f, 0.0000f, 1.0000f, 0.0000f, -0.7071f, 0.7071f, 0.7071f, 0.0000f, 0.7071f,
+ 0.0000f, -0.7071f, 0.7071f, 0.0000f, -1.0000f, 0.0000f, 0.7071f, -0.7071f, 0.0000f,
+ 0.0000f, -0.7071f, 0.7071f, 0.7071f, -0.7071f, 0.0000f, 0.7071f, 0.0000f, 0.7071f,
+ 0.7071f, 0.0000f, 0.7071f, 0.7071f, -0.7071f, 0.0000f, 1.0000f, 0.0000f, 0.0000f,
+ 0.0000f, 0.0000f, -1.0000f, 0.0000f, 0.7071f, -0.7071f, 0.7071f, 0.0000f, -0.7071f,
+ 0.0000f, 0.7071f, -0.7071f, 0.0000f, 1.0000f, 0.0000f, 0.7071f, 0.7071f, 0.0000f,
+ 0.0000f, 0.7071f, -0.7071f, 0.7071f, 0.7071f, 0.0000f, 0.7071f, 0.0000f, -0.7071f,
+ 0.7071f, 0.0000f, -0.7071f, 0.7071f, 0.7071f, 0.0000f, 1.0000f, 0.0000f, 0.0000f,
+ 0.0000f, 0.0000f, -1.0000f, -0.7071f, 0.0000f, -0.7071f, 0.0000f, 0.7071f, -0.7071f,
+ -0.7071f, 0.0000f, -0.7071f, -1.0000f, 0.0000f, 0.0000f, -0.7071f, 0.7071f, 0.0000f,
+ -0.7071f, 0.0000f, -0.7071f, -0.7071f, 0.7071f, 0.0000f, 0.0000f, 0.7071f, -0.7071f,
+ 0.0000f, 0.7071f, -0.7071f, -0.7071f, 0.7071f, 0.0000f, 0.0000f, 1.0000f, 0.0000f,
+ 0.0000f, 0.0000f, -1.0000f, 0.0000f, -0.7071f, -0.7071f, -0.7071f, 0.0000f, -0.7071f,
+ 0.0000f, -0.7071f, -0.7071f, 0.0000f, -1.0000f, 0.0000f, -0.7071f, -0.7071f, 0.0000f,
+ 0.0000f, -0.7071f, -0.7071f, -0.7071f, -0.7071f, 0.0000f, -0.7071f, 0.0000f, -0.7071f,
+ -0.7071f, 0.0000f, -0.7071f, -0.7071f, -0.7071f, 0.0000f, -1.0000f, 0.0000f, 0.0000f,
+ 0.0000f, 0.0000f, -1.0000f, 0.7071f, 0.0000f, -0.7071f, 0.0000f, -0.7071f, -0.7071f,
+ 0.7071f, 0.0000f, -0.7071f, 1.0000f, 0.0000f, 0.0000f, 0.7071f, -0.7071f, 0.0000f,
+ 0.7071f, 0.0000f, -0.7071f, 0.7071f, -0.7071f, 0.0000f, 0.0000f, -0.7071f, -0.7071f,
+ 0.0000f, -0.7071f, -0.7071f, 0.7071f, -0.7071f, 0.0000f, 0.0000f, -1.0000f, 0.0000f,
+};*/
+
+
+
+// font info:
+//
+//Peter Holzmann, Octopus Enterprises
+//USPS: 19611 La Mar Court, Cupertino, CA 95014
+//UUCP: {hplabs!hpdsd,pyramid}!octopus!pete
+//Phone: 408/996-7746
+//
+//This distribution is made possible through the collective encouragement
+//of the Usenet Font Consortium, a mailing list that sprang to life to get
+//this accomplished and that will now most likely disappear into the mists
+//of time... Thanks are especially due to Jim Hurt, who provided the packed
+//font data for the distribution, along with a lot of other help.
+//
+//This file describes the Hershey Fonts in general, along with a description of
+//the other files in this distribution and a simple re-distribution restriction.
+//
+//USE RESTRICTION:
+// This distribution of the Hershey Fonts may be used by anyone for
+// any purpose, commercial or otherwise, providing that:
+// 1. The following acknowledgements must be distributed with
+// the font data:
+// - The Hershey Fonts were originally created by Dr.
+// A. V. Hershey while working at the U. S.
+// National Bureau of Standards.
+// - The format of the Font data in this distribution
+// was originally created by
+// James Hurt
+// Cognition, Inc.
+// 900 Technology Park Drive
+// Billerica, MA 01821
+// (mit-eddie!ci-dandelion!hurt)
+// 2. The font data in this distribution may be converted into
+// any other format *EXCEPT* the format distributed by
+// the U.S. NTIS (which organization holds the rights
+// to the distribution and use of the font data in that
+// particular format). Not that anybody would really
+// *want* to use their format... each point is described
+// in eight bytes as "xxx yyy:", where xxx and yyy are
+// the coordinate values as ASCII numbers.
+
+
+uint8_t g_font[6350] = {
+ 0x46,0x4F,0x4E,0x54,0x01,0x00,0x00,0x00,0x43,0x01,0x00,0x00,0x5E,0x00,0x00,0x00,0xC4,0x06,0x00,0x00,0x0A,0xD7,0x23,0x3C,0x3D,0x0A,0x57,0x3E,0x0A,0xD7,0x23,0x3C,
+ 0x28,0x5C,0x8F,0x3D,0x0A,0xD7,0x23,0x3C,0x08,0xD7,0xA3,0x3C,0x00,0x00,0x00,0x00,0x08,0xD7,0x23,0x3C,0x0A,0xD7,0x23,0x3C,0x00,0x00,0x00,0x00,0x0A,0xD7,0xA3,0x3C,
+ 0x08,0xD7,0x23,0x3C,0x00,0x00,0x00,0x00,0x3D,0x0A,0x57,0x3E,0x00,0x00,0x00,0x00,0x28,0x5C,0x0F,0x3E,0x0A,0xD7,0xA3,0x3D,0x3D,0x0A,0x57,0x3E,0x0A,0xD7,0xA3,0x3D,
+ 0x28,0x5C,0x0F,0x3E,0x0A,0xD7,0xA3,0x3D,0x00,0x00,0x80,0x3E,0x0C,0xD7,0x23,0x3C,0x29,0x5C,0x8F,0xBD,0x29,0x5C,0x0F,0x3E,0x00,0x00,0x80,0x3E,0x29,0x5C,0x8F,0x3D,
+ 0x29,0x5C,0x8F,0xBD,0x0C,0xD7,0x23,0x3C,0x8F,0xC2,0xF5,0x3D,0x9A,0x99,0x19,0x3E,0x8F,0xC2,0xF5,0x3D,0x00,0x00,0x00,0x00,0x8E,0xC2,0x75,0x3D,0x29,0x5C,0x0F,0x3E,
+ 0x8E,0xC2,0x75,0x3D,0xCD,0xCC,0x4C,0x3D,0x00,0x00,0x80,0x3E,0xCD,0xCC,0x4C,0x3D,0x0A,0xD7,0x23,0xBD,0xEC,0x51,0xB8,0x3D,0x00,0x00,0x80,0x3E,0xEC,0x51,0xB8,0x3D,
+ 0x0A,0xD7,0x23,0xBD,0x29,0x5C,0x0F,0x3E,0xEB,0x51,0x38,0x3E,0x8F,0xC2,0xF5,0x3D,0xCC,0xCC,0x4C,0x3E,0xEC,0x51,0xB8,0x3D,0x3D,0x0A,0x57,0x3E,0xCD,0xCC,0x4C,0x3D,
+ 0x3D,0x0A,0x57,0x3E,0x0C,0xD7,0xA3,0x3C,0xCC,0xCC,0x4C,0x3E,0x00,0x00,0x00,0x00,0xEB,0x51,0x38,0x3E,0x00,0x00,0x00,0x00,0x0A,0xD7,0x23,0x3E,0x0C,0xD7,0x23,0x3C,
+ 0x28,0x5C,0x0F,0x3E,0x0C,0xD7,0xA3,0x3C,0xB8,0x1E,0x05,0x3E,0x0A,0xD7,0x23,0x3D,0x8F,0xC2,0xF5,0x3D,0xCD,0xCC,0xCC,0x3D,0xCC,0xCC,0xCC,0x3D,0x8F,0xC2,0xF5,0x3D,
+ 0xEB,0x51,0xB8,0x3D,0xB8,0x1E,0x05,0x3E,0x0A,0xD7,0xA3,0x3D,0x29,0x5C,0x0F,0x3E,0x8E,0xC2,0xF5,0x3C,0x8F,0xC2,0xF5,0x3D,0x08,0xD7,0x23,0x3C,0xEC,0x51,0xB8,0x3D,
+ 0x00,0x00,0x00,0x00,0xCD,0xCC,0x4C,0x3D,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x8E,0xC2,0xF5,0x3C,0xEB,0x51,0x38,0x3E,0x3D,0x0A,0x57,0x3E,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x28,0x5C,0x8F,0x3D,0x5C,0x8F,0x42,0x3E,0x28,0x5C,0x8F,0x3D,0x7A,0x14,0x2E,0x3E,0x8E,0xC2,0x75,0x3D,0x99,0x99,0x19,0x3E,0x0A,0xD7,0x23,0x3D,
+ 0x28,0x5C,0x0F,0x3E,0x08,0xD7,0xA3,0x3C,0x28,0x5C,0x0F,0x3E,0x08,0xD7,0x23,0x3C,0xCC,0xCC,0x4C,0x3E,0x8E,0xC2,0xF5,0x3C,0x3D,0x0A,0x57,0x3E,0x28,0x5C,0x8F,0x3D,
+ 0xCC,0xCC,0x4C,0x3E,0xCC,0xCC,0xCC,0x3D,0x5C,0x8F,0x42,0x3E,0xB8,0x1E,0x05,0x3E,0x5C,0x8F,0x42,0x3E,0x0A,0xD7,0x23,0x3E,0xCC,0xCC,0x4C,0x3E,0x28,0x5C,0x0F,0x3E,
+ 0x28,0x5C,0x8F,0x3D,0x8F,0xC2,0xF5,0x3D,0x8E,0xC2,0x75,0x3D,0xAE,0x47,0xE1,0x3D,0x0A,0xD7,0x23,0x3D,0xAE,0x47,0xE1,0x3D,0x08,0xD7,0xA3,0x3C,0xB8,0x1E,0x05,0x3E,
+ 0x00,0x00,0x00,0x00,0x99,0x99,0x19,0x3E,0x00,0x00,0x00,0x00,0x7A,0x14,0x2E,0x3E,0x08,0xD7,0x23,0x3C,0xEB,0x51,0x38,0x3E,0x8E,0xC2,0xF5,0x3C,0xEB,0x51,0x38,0x3E,
+ 0xCC,0xCC,0x4C,0x3D,0x0A,0xD7,0x23,0x3E,0x28,0x5C,0x8F,0x3D,0xCC,0xCC,0x4C,0x3E,0x8F,0xC2,0xF5,0x3D,0xCC,0xCC,0x4C,0x3E,0xB8,0x1E,0x05,0x3E,0x5C,0x8F,0x42,0x3E,
+ 0x28,0x5C,0x0F,0x3E,0xEB,0x51,0x38,0x3E,0x28,0x5C,0x0F,0x3E,0x7A,0x14,0x2E,0x3E,0xB8,0x1E,0x05,0x3E,0x0A,0xD7,0x23,0x3E,0xAE,0x47,0xE1,0x3D,0x8E,0xC2,0xF5,0x3D,
+ 0x8E,0xC2,0xF5,0x3C,0xCC,0xCC,0xCC,0x3D,0x08,0xD7,0x23,0x3C,0x0A,0xD7,0xA3,0x3D,0x00,0x00,0x00,0x00,0x09,0xD7,0x23,0x3D,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x0A,0xD7,0x23,0x3D,0x08,0xD7,0x23,0x3C,0x0A,0xD7,0xA3,0x3D,0x08,0xD7,0xA3,0x3C,0xEB,0x51,0xB8,0x3D,0xEB,0x51,0xB8,0x3D,0xB8,0x1E,0x05,0x3E,0xCC,0xCC,0xCC,0x3D,
+ 0x28,0x5C,0x0F,0x3E,0xAD,0x47,0xE1,0x3D,0x0A,0xD7,0x23,0x3E,0xAD,0x47,0xE1,0x3D,0xEB,0x51,0x38,0x3E,0xCC,0xCC,0xCC,0x3D,0xCC,0xCC,0x4C,0x3E,0x8E,0xC2,0x75,0x3D,
+ 0xCC,0xCC,0x4C,0x3E,0xCC,0xCC,0x4C,0x3D,0xEB,0x51,0x38,0x3E,0xCC,0xCC,0x4C,0x3D,0x0A,0xD7,0x23,0x3E,0x8E,0xC2,0x75,0x3D,0xB8,0x1E,0x05,0x3E,0x0A,0xD7,0xA3,0x3D,
+ 0xCC,0xCC,0xCC,0x3D,0xB8,0x1E,0x05,0x3E,0x8E,0xC2,0xF5,0x3C,0x99,0x99,0x19,0x3E,0x08,0xD7,0x23,0x3C,0x7A,0x14,0x2E,0x3E,0x00,0x00,0x00,0x00,0x0A,0xD7,0x23,0x3C,
+ 0x5C,0x8F,0x42,0x3E,0x00,0x00,0x00,0x00,0xCC,0xCC,0x4C,0x3E,0x0A,0xD7,0xA3,0x3C,0xEB,0x51,0x38,0x3E,0x0A,0xD7,0x23,0x3C,0x0A,0xD7,0x23,0x3E,0x00,0x00,0x00,0x00,
+ 0x99,0x99,0x19,0x3E,0x29,0x5C,0x8F,0x3D,0x00,0x00,0x80,0x3E,0xCC,0xCC,0x4C,0x3D,0x1E,0x85,0x6B,0x3E,0x8F,0xC2,0xF5,0x3C,0xCC,0xCC,0x4C,0x3E,0x00,0x00,0x00,0x00,
+ 0xAE,0x47,0xE1,0x3D,0x00,0x00,0x00,0x00,0x28,0x5C,0x8F,0x3D,0x8F,0xC2,0xF5,0x3C,0x0C,0xD7,0xA3,0xBC,0xCC,0xCC,0x4C,0x3D,0xCE,0xCC,0x4C,0xBD,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x80,0x3E,0x0A,0xD7,0xA3,0x3C,0x1E,0x85,0x6B,0x3E,0x0A,0xD7,0x23,0x3D,0xCC,0xCC,0x4C,0x3E,0x8F,0xC2,0x75,0x3D,0x0A,0xD7,0x23,0x3E,0x29,0x5C,0x8F,0x3D,
+ 0xAE,0x47,0xE1,0x3D,0x29,0x5C,0x8F,0x3D,0x28,0x5C,0x8F,0x3D,0x8F,0xC2,0x75,0x3D,0x08,0xD7,0xA3,0x3C,0x0A,0xD7,0x23,0x3D,0x0C,0xD7,0xA3,0xBC,0x0A,0xD7,0xA3,0x3C,
+ 0xCE,0xCC,0x4C,0xBD,0x00,0x00,0x00,0x00,0x29,0x5C,0x8F,0xBD,0xCC,0xCC,0x4C,0x3D,0x99,0x99,0x19,0x3E,0xCC,0xCC,0x4C,0x3D,0x8E,0xC2,0xF5,0x3C,0x00,0x00,0x00,0x00,
+ 0x8F,0xC2,0xF5,0x3D,0xCC,0xCC,0xCC,0x3D,0x8E,0xC2,0x75,0x3D,0xCC,0xCC,0xCC,0x3D,0x8F,0xC2,0xF5,0x3D,0xEB,0x51,0xB8,0x3D,0xEB,0x51,0x38,0x3E,0x00,0x00,0x00,0x00,
+ 0xEB,0x51,0xB8,0x3D,0xEB,0x51,0x38,0x3E,0xEB,0x51,0xB8,0x3D,0x0A,0xD7,0xA3,0x3C,0x0A,0xD7,0x23,0x3D,0x0A,0xD7,0x23,0x3C,0x8E,0xC2,0xF5,0x3C,0x0A,0xD7,0x23,0x3C,
+ 0xCC,0xCC,0x4C,0x3D,0x0A,0xD7,0xA3,0x3C,0x08,0xD7,0xA3,0x3C,0xEB,0x51,0x38,0x3E,0x00,0x00,0x80,0x3E,0x90,0xC2,0x75,0x3D,0x3D,0x0A,0x57,0x3E,0x0C,0xD7,0x23,0x3C,
+ 0x7A,0x14,0x2E,0x3E,0x0C,0xD7,0x23,0x3C,0x0A,0xD7,0x23,0x3D,0x90,0xC2,0xF5,0x3C,0x08,0xD7,0x23,0x3C,0x90,0xC2,0x75,0x3D,0x00,0x00,0x00,0x00,0xAE,0x47,0xE1,0x3D,
+ 0x08,0xD7,0x23,0x3C,0xB8,0x1E,0x05,0x3E,0x0A,0xD7,0x23,0x3D,0x29,0x5C,0x0F,0x3E,0xEB,0x51,0xB8,0x3D,0x29,0x5C,0x0F,0x3E,0x8F,0xC2,0xF5,0x3D,0xB8,0x1E,0x05,0x3E,
+ 0x7A,0x14,0x2E,0x3E,0xAE,0x47,0xE1,0x3D,0xCC,0xCC,0x4C,0x3E,0x00,0x00,0x00,0x00,0x7A,0x14,0x2E,0x3E,0x0C,0xD7,0xA3,0x3C,0x5C,0x8F,0x42,0x3E,0x8F,0xC2,0xF5,0x3D,
+ 0x5C,0x8F,0x42,0x3E,0xB8,0x1E,0x05,0x3E,0x99,0x99,0x19,0x3E,0x8F,0xC2,0xF5,0x3D,0xB8,0x1E,0x05,0x3E,0x29,0x5C,0x0F,0x3E,0x00,0x00,0x00,0x00,0x0C,0xD7,0xA3,0x3C,
+ 0x3D,0x0A,0x57,0x3E,0xB8,0x1E,0x05,0x3E,0x3D,0x0A,0x57,0x3E,0x29,0x5C,0x8F,0x3D,0xB8,0x1E,0x05,0x3E,0xCD,0xCC,0xCC,0x3D,0xB8,0x1E,0x05,0x3E,0x8F,0xC2,0xF5,0x3D,
+ 0x8F,0xC2,0xF5,0x3D,0xB8,0x1E,0x05,0x3E,0xAE,0x47,0xE1,0x3D,0x29,0x5C,0x0F,0x3E,0x0A,0xD7,0xA3,0x3D,0xCD,0xCC,0xCC,0x3D,0x3D,0x0A,0x57,0x3E,0x9A,0x99,0x19,0x3E,
+ 0x28,0x5C,0x8F,0x3D,0xCD,0xCC,0xCC,0x3D,0x00,0x00,0x00,0x00,0x8F,0xC2,0xF5,0x3D,0x3D,0x0A,0x57,0x3E,0xCD,0xCC,0x4C,0x3D,0x28,0x5C,0x0F,0x3E,0xAE,0x47,0xE1,0x3D,
+ 0xB8,0x1E,0x05,0x3E,0x8F,0xC2,0xF5,0x3D,0xEB,0x51,0x38,0x3E,0x29,0x5C,0x8F,0x3D,0x00,0x00,0x00,0x00,0xB8,0x1E,0x05,0x3E,0x8E,0xC2,0x75,0x3D,0xB8,0x1E,0x05,0x3E,
+ 0x28,0x5C,0x8F,0x3D,0x8F,0xC2,0xF5,0x3D,0xCC,0xCC,0xCC,0x3D,0x8F,0xC2,0xF5,0x3C,0x8F,0xC2,0xF5,0x3D,0x0C,0xD7,0x23,0x3C,0xCC,0xCC,0xCC,0x3D,0x29,0x5C,0x0F,0x3E,
+ 0x3D,0x0A,0x57,0x3E,0x0C,0xD7,0x23,0x3C,0xEB,0x51,0x38,0x3E,0x0A,0xD7,0x23,0x3D,0xB8,0x1E,0x05,0x3E,0x0A,0xD7,0xA3,0x3D,0x8F,0xC2,0xF5,0x3D,0xAE,0x47,0xE1,0x3D,
+ 0xAE,0x47,0xE1,0x3D,0xB8,0x1E,0x05,0x3E,0xEB,0x51,0xB8,0x3D,0x29,0x5C,0x0F,0x3E,0x0A,0xD7,0x23,0x3D,0xB8,0x1E,0x05,0x3E,0x08,0xD7,0xA3,0x3C,0x0C,0xD7,0x23,0x3C,
+ 0xEB,0x51,0xB8,0x3D,0x90,0xC2,0xF5,0x3C,0xAE,0x47,0xE1,0x3D,0x90,0xC2,0x75,0x3D,0x8F,0xC2,0xF5,0x3D,0x8F,0xC2,0xF5,0x3D,0x28,0x5C,0x0F,0x3E,0xB8,0x1E,0x05,0x3E,
+ 0x0A,0xD7,0x23,0x3E,0xB8,0x1E,0x05,0x3E,0xEB,0x51,0x38,0x3E,0xB8,0x1E,0x05,0x3E,0x28,0x5C,0x0F,0x3E,0x8F,0xC2,0xF5,0x3D,0xAE,0x47,0xE1,0x3D,0xCD,0xCC,0xCC,0x3D,
+ 0xEB,0x51,0xB8,0x3D,0x29,0x5C,0x8F,0x3D,0x0A,0xD7,0xA3,0x3D,0x90,0xC2,0x75,0x3D,0x0A,0xD7,0xA3,0x3D,0x90,0xC2,0xF5,0x3C,0xEB,0x51,0xB8,0x3D,0x0C,0xD7,0x23,0x3C,
+ 0xAE,0x47,0xE1,0x3D,0x29,0x5C,0x8F,0x3D,0x3D,0x0A,0x57,0x3E,0x8F,0xC2,0xF5,0x3D,0x0A,0xD7,0x23,0x3D,0x0A,0xD7,0xA3,0x3C,0xAE,0x47,0xE1,0x3D,0x0A,0xD7,0x23,0x3E,
+ 0xEB,0x51,0x38,0x3E,0x0A,0xD7,0x23,0x3E,0x00,0x00,0x00,0x00,0xEB,0x51,0x38,0x3E,0x8F,0xC2,0xF5,0x3D,0xEB,0x51,0x38,0x3E,0x8E,0xC2,0x75,0x3D,0x0A,0xD7,0x23,0x3E,
+ 0xEB,0x51,0xB8,0x3D,0x0A,0xD7,0x23,0x3D,0x3D,0x0A,0x57,0x3E,0xAE,0x47,0xE1,0x3D,0x5C,0x8F,0x42,0x3E,0x8F,0xC2,0xF5,0x3D,0x7A,0x14,0x2E,0x3E,0x8F,0xC2,0xF5,0x3D,
+ 0x99,0x99,0x19,0x3E,0x8F,0xC2,0x75,0x3D,0xCC,0xCC,0xCC,0x3D,0x8F,0xC2,0x75,0x3D,0x28,0x5C,0x8F,0x3D,0xCC,0xCC,0x4C,0x3D,0x08,0xD7,0x23,0x3C,0x29,0x5C,0x8F,0x3D,
+ 0x08,0xD7,0x23,0x3C,0xEB,0x51,0xB8,0x3D,0x99,0x99,0x19,0x3E,0x28,0x5C,0x8F,0x3D,0x0A,0xD7,0x23,0x3E,0x0A,0xD7,0x23,0x3D,0x0A,0xD7,0x23,0x3E,0x09,0xD7,0xA3,0x3C,
+ 0x99,0x99,0x19,0x3E,0x00,0x00,0x00,0x00,0x0A,0xD7,0xA3,0x3D,0x08,0xD7,0x23,0x3C,0x8E,0xC2,0x75,0x3D,0x8E,0xC2,0xF5,0x3C,0xCC,0xCC,0x4C,0x3D,0x8E,0xC2,0x75,0x3D,
+ 0xCC,0xCC,0x4C,0x3D,0x0A,0xD7,0xA3,0x3D,0x8E,0xC2,0x75,0x3D,0xEB,0x51,0xB8,0x3D,0x0A,0xD7,0xA3,0x3D,0x09,0xD7,0xA3,0x3C,0x8E,0xC2,0x75,0x3D,0xCC,0xCC,0xCC,0x3D,
+ 0x0A,0xD7,0x23,0x3E,0xEB,0x51,0xB8,0x3D,0x8E,0xC2,0x75,0x3D,0xAE,0x47,0xE1,0x3D,0xCC,0xCC,0x4C,0x3D,0xB8,0x1E,0x05,0x3E,0xCC,0xCC,0x4C,0x3D,0x0A,0xD7,0x23,0x3E,
+ 0xCC,0xCC,0xCC,0x3D,0x0A,0xD7,0x23,0x3E,0x8F,0xC2,0xF5,0x3D,0x99,0x99,0x19,0x3E,0x99,0x99,0x19,0x3E,0x28,0x5C,0x0F,0x3E,0x7A,0x14,0x2E,0x3E,0x90,0xC2,0xF5,0x3C,
+ 0x28,0x5C,0x8F,0x3D,0x29,0x5C,0x0F,0x3E,0x99,0x99,0x19,0x3E,0xB8,0x1E,0x05,0x3E,0xB8,0x1E,0x05,0x3E,0xEC,0x51,0xB8,0x3D,0xAE,0x47,0xE1,0x3D,0x9A,0x99,0x19,0x3E,
+ 0x0A,0xD7,0x23,0x3E,0x00,0x00,0x00,0x00,0xB8,0x1E,0x05,0x3E,0x0C,0xD7,0xA3,0x3C,0x8E,0xC2,0xF5,0x3C,0x0A,0xD7,0x23,0x3D,0x08,0xD7,0x23,0x3C,0x9A,0x99,0x19,0x3E,
+ 0xCC,0xCC,0x4C,0x3D,0x29,0x5C,0x0F,0x3E,0xB8,0x1E,0x05,0x3E,0x0A,0xD7,0xA3,0x3D,0xAE,0x47,0xE1,0x3D,0x9A,0x99,0x19,0x3E,0x0A,0xD7,0xA3,0x3D,0xCD,0xCC,0xCC,0x3D,
+ 0x0A,0xD7,0xA3,0x3D,0x29,0x5C,0x0F,0x3E,0xAE,0x47,0xE1,0x3D,0xCC,0xCC,0xCC,0x3D,0xCC,0xCC,0x4C,0x3D,0xEB,0x51,0xB8,0x3D,0x08,0xD7,0xA3,0x3C,0x0A,0xD7,0xA3,0x3D,
+ 0x08,0xD7,0x23,0x3C,0x00,0x00,0x00,0x00,0xCC,0xCC,0x4C,0x3D,0xCD,0xCC,0x4C,0x3D,0x8F,0xC2,0xF5,0x3D,0x8F,0xC2,0xF5,0x3D,0x00,0x00,0x00,0x00,0x0A,0xD7,0x23,0x3E,
+ 0x3D,0x0A,0x57,0x3E,0x0A,0xD7,0x23,0x3E,0x0A,0xD7,0xA3,0x3D,0x0A,0xD7,0x23,0x3E,0xB8,0x1E,0x05,0x3E,0x29,0x5C,0x0F,0x3E,0x28,0x5C,0x0F,0x3E,0xB8,0x1E,0x05,0x3E,
+ 0x8F,0xC2,0xF5,0x3D,0xEC,0x51,0xB8,0x3D,0xCC,0xCC,0xCC,0x3D,0x00,0x00,0x00,0x00,0xCC,0xCC,0xCC,0x3D,0xEB,0x51,0xB8,0x3D,0x0A,0xD7,0x23,0x3D,0x9A,0x99,0x19,0x3E,
+ 0x0C,0xD7,0xA3,0xBC,0xCC,0xCC,0x4C,0x3E,0x3D,0x0A,0x57,0x3E,0x0A,0xD7,0x23,0x3C,0x00,0x00,0x80,0x3E,0x29,0x5C,0x0F,0x3E,0x90,0xC2,0xF5,0xBC,0x8F,0xC2,0x75,0x3D,
+ 0x00,0x00,0x80,0x3E,0x8F,0xC2,0x75,0x3D,0x29,0x5C,0x8F,0xBD,0x0A,0xD7,0xA3,0x3D,0x1E,0x85,0x6B,0x3E,0xEB,0x51,0x38,0x3E,0x29,0x5C,0x8F,0xBD,0x0A,0xD7,0xA3,0x3C,
+ 0x0A,0xD7,0x23,0x3E,0x0A,0xD7,0xA3,0x3C,0x8F,0xC2,0xF5,0x3D,0x0A,0xD7,0x23,0x3C,0xB8,0x1E,0x05,0x3E,0x8F,0xC2,0xF5,0x3C,0xB8,0x1E,0x05,0x3E,0x29,0x5C,0x8F,0x3D,
+ 0x28,0x5C,0x0F,0x3E,0x8F,0xC2,0xF5,0x3D,0x0A,0xD7,0xA3,0x3D,0xAE,0x47,0xE1,0x3D,0x8E,0xC2,0xF5,0x3C,0xEB,0x51,0xB8,0x3D,0x08,0xD7,0x23,0x3C,0xAE,0x47,0xE1,0x3D,
+ 0x8F,0xC2,0xF5,0x3D,0x8F,0xC2,0xF5,0x3C,0x7A,0x14,0x2E,0x3E,0x8F,0xC2,0xF5,0x3C,0x00,0x00,0x00,0x00,0x8F,0xC2,0xF5,0x3D,0x0C,0xD7,0xA3,0xBC,0xAE,0x47,0xE1,0x3D,
+ 0xCE,0xCC,0x4C,0xBD,0xCC,0xCC,0xCC,0x3D,0x8E,0xC2,0x75,0xBD,0x0A,0xD7,0xA3,0x3D,0x29,0x5C,0x8F,0xBD,0xCC,0xCC,0x4C,0x3D,0x29,0x5C,0x8F,0xBD,0x8F,0xC2,0xF5,0x3C,
+ 0x8E,0xC2,0x75,0xBD,0xAE,0x47,0xE1,0x3D,0xCC,0xCC,0xCC,0x3D,0xAE,0x47,0xE1,0x3D,0x00,0x00,0x00,0x00,0x0A,0xD7,0x23,0x3C,0xAE,0x47,0x61,0x3E,0xCC,0xCC,0x4C,0x3D,
+ 0xCC,0xCC,0x4C,0x3E,0xCC,0xCC,0x4C,0x3D,0xAE,0x47,0x61,0x3E,0xCC,0xCC,0x4C,0x3D,0x90,0xC2,0xF5,0xBC,0x0A,0xD7,0x23,0x3D,0x8E,0xC2,0x75,0xBD,0x0A,0xD7,0xA3,0x3C,
+ 0x29,0x5C,0x8F,0xBD,0x0A,0xD7,0x23,0x3D,0x0A,0xD7,0xA3,0x3D,0x0A,0xD7,0x23,0x3E,0x28,0x5C,0x0F,0x3E,0x3D,0x0A,0x57,0x3E,0xB8,0x1E,0x05,0x3E,0xAE,0x47,0x61,0x3E,
+ 0xCC,0xCC,0xCC,0x3D,0xAE,0x47,0x61,0x3E,0x00,0x00,0x00,0x00,0x8F,0xC2,0xF5,0x3D,0x29,0x5C,0x8F,0xBD,0x8E,0xC2,0xF5,0x3C,0x0A,0xD7,0xA3,0x3D,0x0A,0xD7,0xA3,0x3D,
+ 0x28,0x5C,0x8F,0x3D,0x08,0xD7,0x23,0x3C,0x08,0xD7,0x23,0x3C,0x8F,0xC2,0xF5,0x3C,0x0A,0xD7,0x23,0x3D,0xAE,0x47,0xE1,0x3D,0x28,0x5C,0x0F,0x3E,0x8F,0xC2,0xF5,0x3C,
+ 0x8E,0xC2,0x75,0x3E,0x0A,0xD7,0xA3,0x3C,0x7A,0x14,0x2E,0x3E,0x8F,0xC2,0xF5,0x3C,0x0A,0xD7,0x23,0x3E,0x0A,0xD7,0xA3,0x3C,0xCC,0xCC,0xCC,0x3D,0x0A,0xD7,0xA3,0x3C,
+ 0xAE,0x47,0x61,0x3E,0x8F,0xC2,0xF5,0x3C,0xEB,0x51,0x38,0x3E,0x0A,0xD7,0x23,0x3D,0x7A,0x14,0x2E,0x3E,0xCC,0xCC,0x4C,0x3D,0xB8,0x1E,0x05,0x3E,0x0A,0xD7,0x23,0x3D,
+ 0xAE,0x47,0xE1,0x3D,0x0A,0xD7,0x23,0x3D,0x28,0x5C,0x8F,0x3D,0xCC,0xCC,0x4C,0x3D,0xCC,0xCC,0x4C,0x3D,0x0A,0xD7,0xA3,0x3C,0x0C,0xD7,0xA3,0xBC,0x0A,0xD7,0xA3,0x3C,
+ 0x0A,0xD7,0x23,0xBD,0x0A,0xD7,0xA3,0x3C,0x0A,0xD7,0xA3,0x3D,0x0A,0xD7,0x23,0x3D,0x8E,0xC2,0x75,0x3D,0x0A,0xD7,0xA3,0x3C,0x8E,0xC2,0x75,0x3E,0x8F,0xC2,0xF5,0x3C,
+ 0x1E,0x85,0x6B,0x3E,0x0A,0xD7,0x23,0x3D,0x5C,0x8F,0x42,0x3E,0x8F,0xC2,0xF5,0x3C,0xCC,0xCC,0xCC,0x3D,0x8F,0xC2,0xF5,0x3C,0xAE,0x47,0x61,0x3E,0xCC,0xCC,0x4C,0x3D,
+ 0xEB,0x51,0xB8,0x3D,0x0A,0xD7,0xA3,0x3C,0x00,0x00,0x00,0x00,0x8F,0xC2,0xF5,0x3C,0x0A,0xD7,0x23,0xBD,0x0A,0xD7,0xA3,0x3C,0x8E,0xC2,0x75,0xBD,0xAE,0x47,0xE1,0x3D,
+ 0x0A,0xD7,0xA3,0x3D,0x7A,0x14,0x2E,0x3E,0x0A,0xD7,0xA3,0x3D,0xEB,0x51,0x38,0x3E,0xCC,0xCC,0xCC,0x3D,0xCC,0xCC,0x4C,0x3D,0xAE,0x47,0xE1,0x3D,0x28,0x5C,0x8F,0x3D,
+ 0xCC,0xCC,0xCC,0x3D,0xAE,0x47,0xE1,0x3D,0x28,0x5C,0x8F,0x3D,0x99,0x99,0x19,0x3E,0x8E,0xC2,0x75,0x3D,0x7A,0x14,0x2E,0x3E,0x28,0x5C,0x8F,0x3D,0xAE,0x47,0xE1,0x3D,
+ 0x3D,0x0A,0x57,0x3E,0x9A,0x99,0x19,0x3E,0x3D,0x0A,0x57,0x3E,0x21,0x0A,0x00,0x00,0x00,0x01,0x00,0x02,0x00,0x03,0x00,0x03,0x00,0x04,0x00,0x04,0x00,0x05,0x00,0x05,
+ 0x00,0x02,0x00,0x22,0x04,0x00,0x06,0x00,0x07,0x00,0x08,0x00,0x09,0x00,0x23,0x08,0x00,0x0A,0x00,0x0B,0x00,0x0C,0x00,0x0D,0x00,0x0E,0x00,0x0F,0x00,0x10,0x00,0x11,
+ 0x00,0x24,0x2A,0x00,0x12,0x00,0x13,0x00,0x14,0x00,0x15,0x00,0x16,0x00,0x17,0x00,0x17,0x00,0x18,0x00,0x18,0x00,0x19,0x00,0x19,0x00,0x1A,0x00,0x1A,0x00,0x1B,0x00,
+ 0x1B,0x00,0x1C,0x00,0x1C,0x00,0x1D,0x00,0x1D,0x00,0x1E,0x00,0x1E,0x00,0x1F,0x00,0x1F,0x00,0x20,0x00,0x20,0x00,0x21,0x00,0x21,0x00,0x22,0x00,0x22,0x00,0x11,0x00,
+ 0x11,0x00,0x23,0x00,0x23,0x00,0x24,0x00,0x24,0x00,0x25,0x00,0x25,0x00,0x26,0x00,0x26,0x00,0x05,0x00,0x05,0x00,0x27,0x00,0x25,0x34,0x00,0x28,0x00,0x29,0x00,0x19,
+ 0x00,0x2A,0x00,0x2A,0x00,0x2B,0x00,0x2B,0x00,0x2C,0x00,0x2C,0x00,0x2D,0x00,0x2D,0x00,0x2E,0x00,0x2E,0x00,0x1C,0x00,0x1C,0x00,0x1B,0x00,0x1B,0x00,0x2F,0x00,0x2F,
+ 0x00,0x30,0x00,0x30,0x00,0x19,0x00,0x19,0x00,0x31,0x00,0x31,0x00,0x32,0x00,0x32,0x00,0x33,0x00,0x33,0x00,0x34,0x00,0x34,0x00,0x28,0x00,0x35,0x00,0x36,0x00,0x36,
+ 0x00,0x37,0x00,0x37,0x00,0x38,0x00,0x38,0x00,0x39,0x00,0x39,0x00,0x3A,0x00,0x3A,0x00,0x3B,0x00,0x3B,0x00,0x3C,0x00,0x3C,0x00,0x3D,0x00,0x3D,0x00,0x3E,0x00,0x3E,
+ 0x00,0x35,0x00,0x26,0x3C,0x00,0x3F,0x00,0x40,0x00,0x40,0x00,0x41,0x00,0x41,0x00,0x42,0x00,0x42,0x00,0x43,0x00,0x43,0x00,0x44,0x00,0x44,0x00,0x11,0x00,0x11,0x00,
+ 0x45,0x00,0x45,0x00,0x46,0x00,0x46,0x00,0x47,0x00,0x47,0x00,0x48,0x00,0x48,0x00,0x05,0x00,0x05,0x00,0x02,0x00,0x02,0x00,0x49,0x00,0x49,0x00,0x10,0x00,0x10,0x00,
+ 0x4A,0x00,0x4A,0x00,0x4B,0x00,0x4B,0x00,0x4C,0x00,0x4C,0x00,0x4D,0x00,0x4D,0x00,0x4E,0x00,0x4E,0x00,0x4F,0x00,0x4F,0x00,0x50,0x00,0x50,0x00,0x08,0x00,0x08,0x00,
+ 0x51,0x00,0x51,0x00,0x52,0x00,0x52,0x00,0x53,0x00,0x53,0x00,0x54,0x00,0x54,0x00,0x55,0x00,0x55,0x00,0x56,0x00,0x56,0x00,0x57,0x00,0x57,0x00,0x58,0x00,0x27,0x0C,
+ 0x00,0x59,0x00,0x5A,0x00,0x5A,0x00,0x00,0x00,0x00,0x00,0x1A,0x00,0x1A,0x00,0x5B,0x00,0x5B,0x00,0x5C,0x00,0x5C,0x00,0x5D,0x00,0x28,0x12,0x00,0x5E,0x00,0x5F,0x00,
+ 0x5F,0x00,0x60,0x00,0x60,0x00,0x5C,0x00,0x5C,0x00,0x61,0x00,0x61,0x00,0x62,0x00,0x62,0x00,0x02,0x00,0x02,0x00,0x63,0x00,0x63,0x00,0x64,0x00,0x64,0x00,0x0D,0x00,
+ 0x29,0x12,0x00,0x65,0x00,0x66,0x00,0x66,0x00,0x67,0x00,0x67,0x00,0x68,0x00,0x68,0x00,0x69,0x00,0x69,0x00,0x6A,0x00,0x6A,0x00,0x6B,0x00,0x6B,0x00,0x6C,0x00,0x6C,
+ 0x00,0x6D,0x00,0x6D,0x00,0x6E,0x00,0x2A,0x06,0x00,0x6F,0x00,0x70,0x00,0x71,0x00,0x72,0x00,0x73,0x00,0x10,0x00,0x2B,0x04,0x00,0x74,0x00,0x25,0x00,0x75,0x00,0x76,
+ 0x00,0x2C,0x0C,0x00,0x77,0x00,0x78,0x00,0x78,0x00,0x49,0x00,0x49,0x00,0x79,0x00,0x79,0x00,0x77,0x00,0x77,0x00,0x7A,0x00,0x7A,0x00,0x29,0x00,0x2D,0x02,0x00,0x75,
+ 0x00,0x76,0x00,0x2E,0x08,0x00,0x79,0x00,0x49,0x00,0x49,0x00,0x78,0x00,0x78,0x00,0x77,0x00,0x77,0x00,0x79,0x00,0x2F,0x02,0x00,0x7B,0x00,0x6E,0x00,0x30,0x20,0x00,
+ 0x7C,0x00,0x60,0x00,0x60,0x00,0x7D,0x00,0x7D,0x00,0x71,0x00,0x71,0x00,0x75,0x00,0x75,0x00,0x7E,0x00,0x7E,0x00,0x7F,0x00,0x7F,0x00,0x80,0x00,0x80,0x00,0x47,0x00,
+ 0x47,0x00,0x81,0x00,0x81,0x00,0x82,0x00,0x82,0x00,0x83,0x00,0x83,0x00,0x84,0x00,0x84,0x00,0x85,0x00,0x85,0x00,0x86,0x00,0x86,0x00,0x08,0x00,0x08,0x00,0x7C,0x00,
+ 0x31,0x06,0x00,0x87,0x00,0x5B,0x00,0x5B,0x00,0x19,0x00,0x19,0x00,0x26,0x00,0x32,0x1A,0x00,0x5C,0x00,0x7D,0x00,0x7D,0x00,0x88,0x00,0x88,0x00,0x60,0x00,0x60,0x00,
+ 0x19,0x00,0x19,0x00,0x18,0x00,0x18,0x00,0x86,0x00,0x86,0x00,0x89,0x00,0x89,0x00,0x85,0x00,0x85,0x00,0x8A,0x00,0x8A,0x00,0x8B,0x00,0x8B,0x00,0x20,0x00,0x20,0x00,
+ 0x29,0x00,0x29,0x00,0x8C,0x00,0x33,0x1C,0x00,0x8D,0x00,0x8E,0x00,0x8E,0x00,0x8F,0x00,0x8F,0x00,0x90,0x00,0x90,0x00,0x91,0x00,0x91,0x00,0x92,0x00,0x92,0x00,0x93,
+ 0x00,0x93,0x00,0x11,0x00,0x11,0x00,0x56,0x00,0x56,0x00,0x81,0x00,0x81,0x00,0x47,0x00,0x47,0x00,0x26,0x00,0x26,0x00,0x05,0x00,0x05,0x00,0x02,0x00,0x02,0x00,0x49,
+ 0x00,0x34,0x06,0x00,0x94,0x00,0x62,0x00,0x62,0x00,0x95,0x00,0x94,0x00,0x96,0x00,0x35,0x20,0x00,0x97,0x00,0x8D,0x00,0x8D,0x00,0x0E,0x00,0x0E,0x00,0x1E,0x00,0x1E,
+ 0x00,0x98,0x00,0x98,0x00,0x09,0x00,0x09,0x00,0x99,0x00,0x99,0x00,0x92,0x00,0x92,0x00,0x93,0x00,0x93,0x00,0x11,0x00,0x11,0x00,0x56,0x00,0x56,0x00,0x81,0x00,0x81,
+ 0x00,0x47,0x00,0x47,0x00,0x26,0x00,0x26,0x00,0x05,0x00,0x05,0x00,0x02,0x00,0x02,0x00,0x49,0x00,0x36,0x2C,0x00,0x9A,0x00,0x86,0x00,0x86,0x00,0x08,0x00,0x08,0x00,
+ 0x7C,0x00,0x7C,0x00,0x60,0x00,0x60,0x00,0x7D,0x00,0x7D,0x00,0x71,0x00,0x71,0x00,0x62,0x00,0x62,0x00,0x78,0x00,0x78,0x00,0x7F,0x00,0x7F,0x00,0x80,0x00,0x80,0x00,
+ 0x9B,0x00,0x9B,0x00,0x46,0x00,0x46,0x00,0x45,0x00,0x45,0x00,0x9C,0x00,0x9C,0x00,0x9D,0x00,0x9D,0x00,0x9E,0x00,0x9E,0x00,0x73,0x00,0x73,0x00,0x8F,0x00,0x8F,0x00,
+ 0x54,0x00,0x54,0x00,0x9F,0x00,0x9F,0x00,0xA0,0x00,0xA0,0x00,0x62,0x00,0x37,0x04,0x00,0xA1,0x00,0x48,0x00,0x06,0x00,0xA1,0x00,0x38,0x38,0x00,0x19,0x00,0x1A,0x00,
+ 0x1A,0x00,0xA2,0x00,0xA2,0x00,0x5C,0x00,0x5C,0x00,0x2E,0x00,0x2E,0x00,0xA3,0x00,0xA3,0x00,0xA4,0x00,0xA4,0x00,0xA5,0x00,0xA5,0x00,0xA6,0x00,0xA6,0x00,0x35,0x00,
+ 0x35,0x00,0xA7,0x00,0xA7,0x00,0xA8,0x00,0xA8,0x00,0x24,0x00,0x24,0x00,0x25,0x00,0x25,0x00,0x26,0x00,0x26,0x00,0x05,0x00,0x05,0x00,0x02,0x00,0x02,0x00,0x49,0x00,
+ 0x49,0x00,0x62,0x00,0x62,0x00,0xA9,0x00,0xA9,0x00,0xAA,0x00,0xAA,0x00,0xAB,0x00,0xAB,0x00,0x90,0x00,0x90,0x00,0xAC,0x00,0xAC,0x00,0xAD,0x00,0xAD,0x00,0xAE,0x00,
+ 0xAE,0x00,0x17,0x00,0x17,0x00,0x18,0x00,0x18,0x00,0x19,0x00,0x39,0x2C,0x00,0xAF,0x00,0xB0,0x00,0xB0,0x00,0xB1,0x00,0xB1,0x00,0xB2,0x00,0xB2,0x00,0xB3,0x00,0xB3,
+ 0x00,0xB4,0x00,0xB4,0x00,0xB5,0x00,0xB5,0x00,0x07,0x00,0x07,0x00,0x5D,0x00,0x5D,0x00,0xA2,0x00,0xA2,0x00,0x60,0x00,0x60,0x00,0x7C,0x00,0x7C,0x00,0xB6,0x00,0xB6,
+ 0x00,0x50,0x00,0x50,0x00,0x9A,0x00,0x9A,0x00,0xAF,0x00,0xAF,0x00,0xA6,0x00,0xA6,0x00,0xB7,0x00,0xB7,0x00,0x46,0x00,0x46,0x00,0x9B,0x00,0x9B,0x00,0x26,0x00,0x26,
+ 0x00,0x05,0x00,0x05,0x00,0x78,0x00,0x3A,0x10,0x00,0x0E,0x00,0x61,0x00,0x61,0x00,0xA0,0x00,0xA0,0x00,0xB8,0x00,0xB8,0x00,0x0E,0x00,0x79,0x00,0x49,0x00,0x49,0x00,
+ 0x78,0x00,0x78,0x00,0x77,0x00,0x77,0x00,0x79,0x00,0x3B,0x14,0x00,0x0E,0x00,0x61,0x00,0x61,0x00,0xA0,0x00,0xA0,0x00,0xB8,0x00,0xB8,0x00,0x0E,0x00,0x77,0x00,0x78,
+ 0x00,0x78,0x00,0x49,0x00,0x49,0x00,0x79,0x00,0x79,0x00,0x77,0x00,0x77,0x00,0x7A,0x00,0x7A,0x00,0x29,0x00,0x3C,0x04,0x00,0xB9,0x00,0x75,0x00,0x75,0x00,0xBA,0x00,
+ 0x3D,0x04,0x00,0x71,0x00,0xBB,0x00,0x10,0x00,0xBC,0x00,0x3E,0x04,0x00,0x1B,0x00,0xBD,0x00,0xBD,0x00,0x29,0x00,0x3F,0x22,0x00,0x1C,0x00,0x87,0x00,0x87,0x00,0x59,
+ 0x00,0x59,0x00,0x1A,0x00,0x1A,0x00,0xBE,0x00,0xBE,0x00,0x08,0x00,0x08,0x00,0x50,0x00,0x50,0x00,0xBF,0x00,0xBF,0x00,0xC0,0x00,0xC0,0x00,0xC1,0x00,0xC1,0x00,0x99,
+ 0x00,0x99,0x00,0x73,0x00,0x73,0x00,0xC2,0x00,0xC2,0x00,0xC3,0x00,0x6B,0x00,0xC4,0x00,0xC4,0x00,0x80,0x00,0x80,0x00,0xC5,0x00,0xC5,0x00,0x6B,0x00,0x40,0x34,0x00,
+ 0x90,0x00,0xC6,0x00,0xC6,0x00,0xC7,0x00,0xC7,0x00,0xC8,0x00,0xC8,0x00,0xC9,0x00,0xC9,0x00,0x1D,0x00,0x1D,0x00,0x61,0x00,0x61,0x00,0xCA,0x00,0xCA,0x00,0xCB,0x00,
+ 0xCB,0x00,0xCC,0x00,0xCC,0x00,0xCD,0x00,0xCD,0x00,0xCE,0x00,0xCE,0x00,0xCF,0x00,0xC8,0x00,0x2E,0x00,0x2E,0x00,0xB5,0x00,0xB5,0x00,0x4A,0x00,0x4A,0x00,0xD0,0x00,
+ 0xD0,0x00,0xCC,0x00,0xD1,0x00,0xCF,0x00,0xCF,0x00,0xD2,0x00,0xD2,0x00,0xD3,0x00,0xD3,0x00,0xD4,0x00,0xD4,0x00,0x95,0x00,0x95,0x00,0xD5,0x00,0xD5,0x00,0xD6,0x00,
+ 0xD6,0x00,0xD7,0x00,0xD7,0x00,0xD8,0x00,0x41,0x06,0x00,0x08,0x00,0x29,0x00,0x08,0x00,0xBA,0x00,0xD9,0x00,0x9D,0x00,0x42,0x24,0x00,0x06,0x00,0x29,0x00,0x06,0x00,
+ 0x18,0x00,0x18,0x00,0x17,0x00,0x17,0x00,0x33,0x00,0x33,0x00,0xD8,0x00,0xD8,0x00,0xDA,0x00,0xDA,0x00,0xDB,0x00,0xDB,0x00,0x91,0x00,0x91,0x00,0xDC,0x00,0x61,0x00,
+ 0xDC,0x00,0xDC,0x00,0x9E,0x00,0x9E,0x00,0xA6,0x00,0xA6,0x00,0x35,0x00,0x35,0x00,0xA7,0x00,0xA7,0x00,0xA8,0x00,0xA8,0x00,0x24,0x00,0x24,0x00,0x25,0x00,0x25,0x00,
+ 0x29,0x00,0x43,0x22,0x00,0xDD,0x00,0x16,0x00,0x16,0x00,0x17,0x00,0x17,0x00,0x94,0x00,0x94,0x00,0x7C,0x00,0x7C,0x00,0x67,0x00,0x67,0x00,0x5B,0x00,0x5B,0x00,0x5C,
+ 0x00,0x5C,0x00,0xDE,0x00,0xDE,0x00,0xCA,0x00,0xCA,0x00,0x79,0x00,0x79,0x00,0xDF,0x00,0xDF,0x00,0xE0,0x00,0xE0,0x00,0x80,0x00,0x80,0x00,0x96,0x00,0x96,0x00,0x24,
+ 0x00,0x24,0x00,0x23,0x00,0x23,0x00,0xE1,0x00,0x44,0x18,0x00,0x06,0x00,0x29,0x00,0x06,0x00,0xB6,0x00,0xB6,0x00,0x50,0x00,0x50,0x00,0x9A,0x00,0x9A,0x00,0xAD,0x00,
+ 0xAD,0x00,0xE2,0x00,0xE2,0x00,0x93,0x00,0x93,0x00,0xD4,0x00,0xD4,0x00,0x45,0x00,0x45,0x00,0x46,0x00,0x46,0x00,0x9B,0x00,0x9B,0x00,0x29,0x00,0x45,0x08,0x00,0x06,
+ 0x00,0x29,0x00,0x06,0x00,0x8E,0x00,0x61,0x00,0xE3,0x00,0x29,0x00,0x39,0x00,0x46,0x06,0x00,0x06,0x00,0x29,0x00,0x06,0x00,0x8E,0x00,0x61,0x00,0xE3,0x00,0x47,0x26,
+ 0x00,0xDD,0x00,0x16,0x00,0x16,0x00,0x17,0x00,0x17,0x00,0x94,0x00,0x94,0x00,0x7C,0x00,0x7C,0x00,0x67,0x00,0x67,0x00,0x5B,0x00,0x5B,0x00,0x5C,0x00,0x5C,0x00,0xDE,
+ 0x00,0xDE,0x00,0xCA,0x00,0xCA,0x00,0x79,0x00,0x79,0x00,0xDF,0x00,0xDF,0x00,0xE0,0x00,0xE0,0x00,0x80,0x00,0x80,0x00,0x96,0x00,0x96,0x00,0x24,0x00,0x24,0x00,0x23,
+ 0x00,0x23,0x00,0xE1,0x00,0xE1,0x00,0xE4,0x00,0xE5,0x00,0xE4,0x00,0x48,0x06,0x00,0x06,0x00,0x29,0x00,0xA1,0x00,0x8C,0x00,0x61,0x00,0xE6,0x00,0x49,0x02,0x00,0x06,
+ 0x00,0x29,0x00,0x4A,0x12,0x00,0x94,0x00,0xE7,0x00,0xE7,0x00,0xE8,0x00,0xE8,0x00,0xE9,0x00,0xE9,0x00,0x80,0x00,0x80,0x00,0x48,0x00,0x48,0x00,0x05,0x00,0x05,0x00,
+ 0x02,0x00,0x02,0x00,0xEA,0x00,0xEA,0x00,0x62,0x00,0x4B,0x06,0x00,0x06,0x00,0x29,0x00,0xA1,0x00,0x62,0x00,0xEB,0x00,0x8C,0x00,0x4C,0x04,0x00,0x06,0x00,0x29,0x00,
+ 0x29,0x00,0xEC,0x00,0x4D,0x08,0x00,0x06,0x00,0x29,0x00,0x06,0x00,0x47,0x00,0xED,0x00,0x47,0x00,0xED,0x00,0xBA,0x00,0x4E,0x06,0x00,0x06,0x00,0x29,0x00,0x06,0x00,
+ 0x8C,0x00,0xA1,0x00,0x8C,0x00,0x4F,0x28,0x00,0x7C,0x00,0x67,0x00,0x67,0x00,0x5B,0x00,0x5B,0x00,0x5C,0x00,0x5C,0x00,0xDE,0x00,0xDE,0x00,0xCA,0x00,0xCA,0x00,0x79,
+ 0x00,0x79,0x00,0xDF,0x00,0xDF,0x00,0xE0,0x00,0xE0,0x00,0x80,0x00,0x80,0x00,0x96,0x00,0x96,0x00,0x24,0x00,0x24,0x00,0x23,0x00,0x23,0x00,0xE1,0x00,0xE1,0x00,0xEE,
+ 0x00,0xEE,0x00,0xEF,0x00,0xEF,0x00,0xDD,0x00,0xDD,0x00,0x16,0x00,0x16,0x00,0x17,0x00,0x17,0x00,0x94,0x00,0x94,0x00,0x7C,0x00,0x50,0x14,0x00,0x06,0x00,0x29,0x00,
+ 0x06,0x00,0x18,0x00,0x18,0x00,0x17,0x00,0x17,0x00,0x33,0x00,0x33,0x00,0xD8,0x00,0xD8,0x00,0xF0,0x00,0xF0,0x00,0xF1,0x00,0xF1,0x00,0xB0,0x00,0xB0,0x00,0xF2,0x00,
+ 0xF2,0x00,0xF3,0x00,0x51,0x2A,0x00,0x7C,0x00,0x67,0x00,0x67,0x00,0x5B,0x00,0x5B,0x00,0x5C,0x00,0x5C,0x00,0xDE,0x00,0xDE,0x00,0xCA,0x00,0xCA,0x00,0x79,0x00,0x79,
+ 0x00,0xDF,0x00,0xDF,0x00,0xE0,0x00,0xE0,0x00,0x80,0x00,0x80,0x00,0x96,0x00,0x96,0x00,0x24,0x00,0x24,0x00,0x23,0x00,0x23,0x00,0xE1,0x00,0xE1,0x00,0xEE,0x00,0xEE,
+ 0x00,0xEF,0x00,0xEF,0x00,0xDD,0x00,0xDD,0x00,0x16,0x00,0x16,0x00,0x17,0x00,0x17,0x00,0x94,0x00,0x94,0x00,0x7C,0x00,0xF4,0x00,0xF5,0x00,0x52,0x16,0x00,0x06,0x00,
+ 0x29,0x00,0x06,0x00,0x18,0x00,0x18,0x00,0x17,0x00,0x17,0x00,0x33,0x00,0x33,0x00,0xD8,0x00,0xD8,0x00,0xDA,0x00,0xDA,0x00,0xDB,0x00,0xDB,0x00,0x91,0x00,0x91,0x00,
+ 0xDC,0x00,0xDC,0x00,0x61,0x00,0x69,0x00,0x8C,0x00,0x53,0x26,0x00,0x16,0x00,0x17,0x00,0x17,0x00,0x18,0x00,0x18,0x00,0x19,0x00,0x19,0x00,0x1A,0x00,0x1A,0x00,0x1B,
+ 0x00,0x1B,0x00,0x1C,0x00,0x1C,0x00,0x1D,0x00,0x1D,0x00,0x1E,0x00,0x1E,0x00,0x1F,0x00,0x1F,0x00,0x20,0x00,0x20,0x00,0x21,0x00,0x21,0x00,0x22,0x00,0x22,0x00,0x11,
+ 0x00,0x11,0x00,0x23,0x00,0x23,0x00,0x24,0x00,0x24,0x00,0x25,0x00,0x25,0x00,0x26,0x00,0x26,0x00,0x05,0x00,0x05,0x00,0x27,0x00,0x54,0x04,0x00,0xB6,0x00,0x9B,0x00,
+ 0x06,0x00,0xA1,0x00,0x55,0x12,0x00,0x06,0x00,0x10,0x00,0x10,0x00,0x78,0x00,0x78,0x00,0x7F,0x00,0x7F,0x00,0x80,0x00,0x80,0x00,0x47,0x00,0x47,0x00,0x81,0x00,0x81,
+ 0x00,0x56,0x00,0x56,0x00,0x11,0x00,0x11,0x00,0xA1,0x00,0x56,0x04,0x00,0x06,0x00,0x47,0x00,0xED,0x00,0x47,0x00,0x57,0x08,0x00,0x06,0x00,0x26,0x00,0x94,0x00,0x26,
+ 0x00,0x94,0x00,0x3A,0x00,0xF6,0x00,0x3A,0x00,0x58,0x04,0x00,0x06,0x00,0x8C,0x00,0xA1,0x00,0x29,0x00,0x59,0x06,0x00,0x06,0x00,0xE3,0x00,0xE3,0x00,0x47,0x00,0xED,
+ 0x00,0xE3,0x00,0x5A,0x06,0x00,0xA1,0x00,0x29,0x00,0x06,0x00,0xA1,0x00,0x29,0x00,0x8C,0x00,0x5B,0x08,0x00,0x65,0x00,0x6E,0x00,0xF7,0x00,0x0B,0x00,0x65,0x00,0x5E,
+ 0x00,0x6E,0x00,0x0D,0x00,0x5C,0x02,0x00,0x06,0x00,0xF8,0x00,0x5D,0x08,0x00,0xF9,0x00,0xFA,0x00,0x5E,0x00,0x0D,0x00,0x65,0x00,0x5E,0x00,0x6E,0x00,0x0D,0x00,0x5E,
+ 0x04,0x00,0xFB,0x00,0x75,0x00,0xFB,0x00,0xBD,0x00,0x5F,0x02,0x00,0x6E,0x00,0xFC,0x00,0x60,0x0C,0x00,0xFD,0x00,0x07,0x00,0x07,0x00,0x71,0x00,0x71,0x00,0xB5,0x00,
+ 0xB5,0x00,0xFE,0x00,0xFE,0x00,0xFF,0x00,0xFF,0x00,0x71,0x00,0x61,0x1C,0x00,0xAC,0x00,0xEC,0x00,0xB0,0x00,0x90,0x00,0x90,0x00,0x09,0x00,0x09,0x00,0x98,0x00,0x98,
+ 0x00,0x00,0x01,0x00,0x01,0xB5,0x00,0xB5,0x00,0xCA,0x00,0xCA,0x00,0x10,0x00,0x10,0x00,0x78,0x00,0x78,0x00,0x7F,0x00,0x7F,0x00,0x26,0x00,0x26,0x00,0x47,0x00,0x47,
+ 0x00,0x46,0x00,0x46,0x00,0x45,0x00,0x62,0x1C,0x00,0x06,0x00,0x29,0x00,0x61,0x00,0x1E,0x00,0x1E,0x00,0x2D,0x00,0x2D,0x00,0x01,0x01,0x01,0x01,0x4C,0x00,0x4C,0x00,
+ 0xA5,0x00,0xA5,0x00,0x02,0x01,0x02,0x01,0x36,0x00,0x36,0x00,0x03,0x01,0x03,0x01,0x04,0x01,0x04,0x01,0x9B,0x00,0x9B,0x00,0x48,0x00,0x48,0x00,0x05,0x00,0x05,0x00,
+ 0x27,0x00,0x63,0x1A,0x00,0xB0,0x00,0x90,0x00,0x90,0x00,0x09,0x00,0x09,0x00,0x98,0x00,0x98,0x00,0x00,0x01,0x00,0x01,0xB5,0x00,0xB5,0x00,0xCA,0x00,0xCA,0x00,0x10,
+ 0x00,0x10,0x00,0x78,0x00,0x78,0x00,0x7F,0x00,0x7F,0x00,0x26,0x00,0x26,0x00,0x47,0x00,0x47,0x00,0x46,0x00,0x46,0x00,0x45,0x00,0x64,0x1C,0x00,0x97,0x00,0xEC,0x00,
+ 0xB0,0x00,0x90,0x00,0x90,0x00,0x09,0x00,0x09,0x00,0x98,0x00,0x98,0x00,0x00,0x01,0x00,0x01,0xB5,0x00,0xB5,0x00,0xCA,0x00,0xCA,0x00,0x10,0x00,0x10,0x00,0x78,0x00,
+ 0x78,0x00,0x7F,0x00,0x7F,0x00,0x26,0x00,0x26,0x00,0x47,0x00,0x47,0x00,0x46,0x00,0x46,0x00,0x45,0x00,0x65,0x20,0x00,0xCA,0x00,0x02,0x01,0x02,0x01,0x9E,0x00,0x9E,
+ 0x00,0x05,0x01,0x05,0x01,0x90,0x00,0x90,0x00,0x09,0x00,0x09,0x00,0x98,0x00,0x98,0x00,0x00,0x01,0x00,0x01,0xB5,0x00,0xB5,0x00,0xCA,0x00,0xCA,0x00,0x10,0x00,0x10,
+ 0x00,0x78,0x00,0x78,0x00,0x7F,0x00,0x7F,0x00,0x26,0x00,0x26,0x00,0x47,0x00,0x47,0x00,0x46,0x00,0x46,0x00,0x45,0x00,0x66,0x0A,0x00,0x08,0x00,0x7C,0x00,0x7C,0x00,
+ 0x67,0x00,0x67,0x00,0x06,0x01,0x06,0x01,0x07,0x01,0x07,0x00,0x01,0x01,0x67,0x26,0x00,0xAC,0x00,0x08,0x01,0x08,0x01,0x09,0x01,0x09,0x01,0x0A,0x01,0x0A,0x01,0x0B,
+ 0x01,0x0B,0x01,0x0C,0x01,0x0C,0x01,0x0D,0x01,0xB0,0x00,0x90,0x00,0x90,0x00,0x09,0x00,0x09,0x00,0x98,0x00,0x98,0x00,0x00,0x01,0x00,0x01,0xB5,0x00,0xB5,0x00,0xCA,
+ 0x00,0xCA,0x00,0x10,0x00,0x10,0x00,0x78,0x00,0x78,0x00,0x7F,0x00,0x7F,0x00,0x26,0x00,0x26,0x00,0x47,0x00,0x47,0x00,0x46,0x00,0x46,0x00,0x45,0x00,0x68,0x0E,0x00,
+ 0x06,0x00,0x29,0x00,0xF3,0x00,0x00,0x01,0x00,0x01,0x98,0x00,0x98,0x00,0x09,0x00,0x09,0x00,0x90,0x00,0x90,0x00,0x0E,0x01,0x0E,0x01,0x0F,0x01,0x69,0x0A,0x00,0x06,
+ 0x00,0x2F,0x00,0x2F,0x00,0x8D,0x00,0x8D,0x00,0x10,0x01,0x10,0x01,0x06,0x00,0x1D,0x00,0x04,0x00,0x6A,0x10,0x00,0xBE,0x00,0x11,0x01,0x11,0x01,0x7C,0x00,0x7C,0x00,
+ 0x12,0x01,0x12,0x01,0xBE,0x00,0x98,0x00,0x13,0x01,0x13,0x01,0x14,0x01,0x14,0x01,0x15,0x01,0x15,0x01,0x6E,0x00,0x6B,0x06,0x00,0x06,0x00,0x29,0x00,0x4D,0x00,0x49,
+ 0x00,0x16,0x01,0x0F,0x01,0x6C,0x02,0x00,0x06,0x00,0x29,0x00,0x6D,0x1A,0x00,0x07,0x00,0x29,0x00,0xF3,0x00,0x00,0x01,0x00,0x01,0x98,0x00,0x98,0x00,0x09,0x00,0x09,
+ 0x00,0x90,0x00,0x90,0x00,0x0E,0x01,0x0E,0x01,0x0F,0x01,0x0E,0x01,0xE2,0x00,0xE2,0x00,0x17,0x01,0x17,0x01,0x41,0x00,0x41,0x00,0x18,0x01,0x18,0x01,0x19,0x01,0x19,
+ 0x01,0x1A,0x01,0x6E,0x0E,0x00,0x07,0x00,0x29,0x00,0xF3,0x00,0x00,0x01,0x00,0x01,0x98,0x00,0x98,0x00,0x09,0x00,0x09,0x00,0x90,0x00,0x90,0x00,0x0E,0x01,0x0E,0x01,
+ 0x0F,0x01,0x6F,0x20,0x00,0x98,0x00,0x00,0x01,0x00,0x01,0xB5,0x00,0xB5,0x00,0xCA,0x00,0xCA,0x00,0x10,0x00,0x10,0x00,0x78,0x00,0x78,0x00,0x7F,0x00,0x7F,0x00,0x26,
+ 0x00,0x26,0x00,0x47,0x00,0x47,0x00,0x46,0x00,0x46,0x00,0x45,0x00,0x45,0x00,0x9C,0x00,0x9C,0x00,0x22,0x00,0x22,0x00,0xB0,0x00,0xB0,0x00,0x90,0x00,0x90,0x00,0x09,
+ 0x00,0x09,0x00,0x98,0x00,0x70,0x1C,0x00,0x07,0x00,0x6E,0x00,0x61,0x00,0x1E,0x00,0x1E,0x00,0x2D,0x00,0x2D,0x00,0x01,0x01,0x01,0x01,0x4C,0x00,0x4C,0x00,0xA5,0x00,
+ 0xA5,0x00,0x02,0x01,0x02,0x01,0x36,0x00,0x36,0x00,0x03,0x01,0x03,0x01,0x04,0x01,0x04,0x01,0x9B,0x00,0x9B,0x00,0x48,0x00,0x48,0x00,0x05,0x00,0x05,0x00,0x27,0x00,
+ 0x71,0x1C,0x00,0xAC,0x00,0x1B,0x01,0xB0,0x00,0x90,0x00,0x90,0x00,0x09,0x00,0x09,0x00,0x98,0x00,0x98,0x00,0x00,0x01,0x00,0x01,0xB5,0x00,0xB5,0x00,0xCA,0x00,0xCA,
+ 0x00,0x10,0x00,0x10,0x00,0x78,0x00,0x78,0x00,0x7F,0x00,0x7F,0x00,0x26,0x00,0x26,0x00,0x47,0x00,0x47,0x00,0x46,0x00,0x46,0x00,0x45,0x00,0x72,0x0A,0x00,0x07,0x00,
+ 0x29,0x00,0xCA,0x00,0xB5,0x00,0xB5,0x00,0x00,0x01,0x00,0x01,0x98,0x00,0x98,0x00,0x09,0x00,0x73,0x20,0x00,0xA5,0x00,0x90,0x00,0x90,0x00,0x01,0x01,0x01,0x01,0x2D,
+ 0x00,0x2D,0x00,0xFF,0x00,0xFF,0x00,0x61,0x00,0x61,0x00,0xA9,0x00,0xA9,0x00,0x1C,0x01,0x1C,0x01,0x1D,0x01,0x1D,0x01,0x72,0x00,0x72,0x00,0x37,0x00,0x37,0x00,0x03,
+ 0x01,0x03,0x01,0x46,0x00,0x46,0x00,0x9B,0x00,0x9B,0x00,0x48,0x00,0x48,0x00,0x1E,0x01,0x1E,0x01,0x27,0x00,0x74,0x0A,0x00,0x30,0x00,0x1F,0x01,0x1F,0x01,0xE0,0x00,
+ 0xE0,0x00,0x80,0x00,0x80,0x00,0x47,0x00,0x07,0x00,0x01,0x01,0x75,0x0E,0x00,0x07,0x00,0x49,0x00,0x49,0x00,0x1E,0x01,0x1E,0x01,0x07,0x01,0x07,0x01,0x80,0x00,0x80,
+ 0x00,0xE9,0x00,0xE9,0x00,0x37,0x00,0x20,0x01,0x0F,0x01,0x76,0x04,0x00,0x07,0x00,0x80,0x00,0xAC,0x00,0x80,0x00,0x77,0x08,0x00,0x07,0x00,0x48,0x00,0x09,0x00,0x48,
+ 0x00,0x09,0x00,0xEC,0x00,0x17,0x01,0xEC,0x00,0x78,0x04,0x00,0x07,0x00,0x0F,0x01,0x20,0x01,0x29,0x00,0x79,0x0C,0x00,0x1D,0x00,0x9B,0x00,0xAF,0x00,0x9B,0x00,0x9B,
+ 0x00,0x13,0x00,0x13,0x00,0x0D,0x01,0x0D,0x01,0x0B,0x00,0x0B,0x00,0x6E,0x00,0x7A,0x06,0x00,0x20,0x01,0x29,0x00,0x07,0x00,0x20,0x01,0x29,0x00,0x0F,0x01,0x7B,0x34,
+ 0x00,0x12,0x00,0x21,0x01,0x21,0x01,0x66,0x00,0x66,0x00,0x00,0x00,0x00,0x00,0x59,0x00,0x59,0x00,0x22,0x01,0x22,0x01,0x23,0x01,0x23,0x01,0x2D,0x00,0x2D,0x00,0x1F,
+ 0x00,0x1F,0x00,0x24,0x01,0x21,0x01,0x25,0x01,0x25,0x01,0x1A,0x00,0x1A,0x00,0x26,0x01,0x26,0x01,0x27,0x01,0x27,0x01,0x6F,0x00,0x6F,0x00,0x28,0x01,0x28,0x01,0x29,
+ 0x01,0x29,0x01,0x75,0x00,0x75,0x00,0x2A,0x01,0x2A,0x01,0x2B,0x01,0x2B,0x01,0x70,0x00,0x70,0x00,0xE0,0x00,0xE0,0x00,0x07,0x01,0x07,0x01,0x2C,0x01,0x2C,0x01,0x2D,
+ 0x01,0x2D,0x01,0x0D,0x01,0x2E,0x01,0x2F,0x01,0x7C,0x02,0x00,0x65,0x00,0x6E,0x00,0x7D,0x34,0x00,0x65,0x00,0x30,0x01,0x30,0x01,0x31,0x01,0x31,0x01,0xBE,0x00,0xBE,
+ 0x00,0x32,0x01,0x32,0x01,0x06,0x01,0x06,0x01,0xFD,0x00,0xFD,0x00,0x1D,0x00,0x1D,0x00,0x0E,0x00,0x0E,0x00,0x33,0x01,0x30,0x01,0x34,0x01,0x34,0x01,0x60,0x00,0x60,
+ 0x00,0x5B,0x00,0x5B,0x00,0x7D,0x00,0x7D,0x00,0x5D,0x00,0x5D,0x00,0xDE,0x00,0xDE,0x00,0xB5,0x00,0xB5,0x00,0x35,0x01,0x35,0x01,0x01,0x00,0x01,0x00,0xEA,0x00,0xEA,
+ 0x00,0x27,0x00,0x27,0x00,0x1E,0x01,0x1E,0x01,0x36,0x01,0x36,0x01,0x63,0x00,0x63,0x00,0x37,0x01,0x37,0x01,0x38,0x01,0x1C,0x01,0xCB,0x00,0x7E,0x28,0x00,0x10,0x00,
+ 0xCA,0x00,0xCA,0x00,0xB5,0x00,0xB5,0x00,0x9F,0x00,0x9F,0x00,0xEB,0x00,0xEB,0x00,0x69,0x00,0x69,0x00,0x39,0x01,0x39,0x01,0x9D,0x00,0x9D,0x00,0x95,0x00,0x95,0x00,
+ 0x3A,0x01,0x3A,0x01,0x3B,0x01,0xCA,0x00,0xA0,0x00,0xA0,0x00,0xAA,0x00,0xAA,0x00,0x3C,0x01,0x3C,0x01,0x3D,0x01,0x3D,0x01,0x3E,0x01,0x3E,0x01,0x9C,0x00,0x9C,0x00,
+ 0x3F,0x01,0x3F,0x01,0x40,0x01,0x40,0x01,0x3B,0x01,0x3B,0x01,0xBB,0x00
+};
+
+static bool isFirst=true;
+static bool isBigEndian() { int i = 1; return *(reinterpret_cast<char*>(&i))==0; }
+
+inline void Swap2Bytes(char* data)
+{
+ char one_byte;
+ one_byte = data[0]; data[0] = data[1]; data[1] = one_byte;
+}
+
+inline void Swap4Bytes(char* data)
+{
+ char one_byte;
+ one_byte = data[0]; data[0] = data[3]; data[3] = one_byte;
+ one_byte = data[1]; data[1] = data[2]; data[2] = one_byte;
+}
+
+inline void Swap8Bytes(char* data)
+{
+ char one_byte;
+ one_byte = data[0]; data[0] = data[7]; data[7] = one_byte;
+ one_byte = data[1]; data[1] = data[6]; data[6] = one_byte;
+ one_byte = data[2]; data[2] = data[5]; data[5] = one_byte;
+ one_byte = data[3]; data[3] = data[4]; data[4] = one_byte;
+}
+
+static inline uint8_t * getUShort(uint8_t *data,unsigned short &v)
+{
+ unsigned short *src = reinterpret_cast<unsigned short *>(data);
+ if ( isBigEndian() && isFirst )
+ {
+ Swap2Bytes(reinterpret_cast<char *>(data));
+ }
+ v = src[0];
+ data+=sizeof(unsigned short);
+ return data;
+}
+
+static inline uint8_t * getUint(uint8_t *data,uint32_t &v)
+{
+ uint32_t *src = reinterpret_cast<uint32_t *>(data);
+ if ( isBigEndian() && isFirst )
+ {
+ Swap4Bytes(reinterpret_cast<char *>(data));
+ }
+ v = src[0];
+ data+=sizeof(uint32_t);
+ return data;
+}
+
+class FontChar
+{
+public:
+ FontChar(void)
+ {
+ mIndexCount = 0;
+ mIndices = 0;
+ mX1 = mY1 = mX2 = mY2 = 0;
+ }
+
+ uint8_t * init(uint8_t *data,const float *vertices)
+ {
+ data = getUShort(data,mIndexCount);
+ mIndices = reinterpret_cast<unsigned short *>(data);
+
+ if ( isBigEndian() && isFirst )
+ {
+ for (uint16_t i=0; i<mIndexCount; i++)
+ {
+ Swap2Bytes(reinterpret_cast<char *>(&mIndices[i]));
+ }
+ }
+
+ data+=(mIndexCount*sizeof(unsigned short));
+ for (uint32_t i=0; i<mIndexCount; i++)
+ {
+ uint32_t index = mIndices[i];
+ const float *vertex = &vertices[index*2];
+
+ if ( i == 0 )
+ {
+ mX1 = mX2 = vertex[0];
+ mY1 = mY2 = vertex[1];
+ }
+ else
+ {
+ if ( vertex[0] < mX1 ) mX1 = vertex[0];
+ if ( vertex[1] < mY1 ) mY1 = vertex[1];
+
+ if ( vertex[0] > mX2 ) mX2 = vertex[0];
+ if ( vertex[1] > mY2 ) mY2 = vertex[1];
+
+ }
+ }
+
+ return data;
+ }
+
+ void vputc(const float *vertices,ProcessRenderDebugHelper *debug,float textScale,float &x,float &y)
+ {
+ if ( mIndices )
+ {
+ uint32_t lineCount = uint32_t(mIndexCount/2);
+ float spacing = (mX2-mX1)+0.05f;
+ for (uint32_t i=0; i<lineCount; i++)
+ {
+ unsigned short i1 = mIndices[i*2+0];
+ unsigned short i2 = mIndices[i*2+1];
+
+ const float *v1 = &vertices[i1*2];
+ const float *v2 = &vertices[i2*2];
+
+ physx::PxVec3 p1(v1[0]+x,v1[1]+y,0);
+ physx::PxVec3 p2(v2[0]+x,v2[1]+y,0);
+ p1*=textScale;
+ p2*=textScale;
+
+ debug->indirectDebugLine(p1,p2);
+
+ }
+ x+=spacing;
+ }
+ else
+ {
+ x+=0.1f;
+ }
+ }
+
+ float getWidth(void) const
+ {
+ float ret = 0.1f;
+ if ( mIndexCount > 0 )
+ {
+ ret = (mX2-mX1)+0.05f;
+ }
+ return ret;
+ }
+
+
+ float mX1;
+ float mX2;
+ float mY1;
+ float mY2;
+ unsigned short mIndexCount;
+ unsigned short *mIndices;
+};
+
+
+#define FONT_VERSION 1
+
+class MyVectorFont : public physx::shdfnd::UserAllocated
+{
+public:
+ MyVectorFont(void)
+ {
+ mVersion = 0;
+ mVcount = 0;
+ mCount = 0;
+ mVertices = 0;
+ initFont(g_font);
+ }
+
+ virtual ~MyVectorFont(void)
+ {
+ release();
+ }
+
+ void release(void)
+ {
+ mVersion = 0;
+ mVcount = 0;
+ mCount = 0;
+ mVertices = 0;
+ }
+
+ void initFont(uint8_t *font)
+ {
+ release();
+ if ( font[0] == 'F' && font[1] == 'O' && font[2] == 'N' && font[3] == 'T' )
+ {
+ font+=4;
+ font = getUint(font,mVersion);
+ if ( mVersion == FONT_VERSION )
+ {
+ font = getUint(font,mVcount);
+ font = getUint(font,mCount);
+ font = getUint(font,mIcount);
+ uint32_t vsize = sizeof(float)*mVcount*2;
+ mVertices = reinterpret_cast<float *>(font);
+ if ( isBigEndian() && isFirst )
+ {
+ for (uint32_t i=0; i<(mVcount*2); i++)
+ {
+ Swap4Bytes(reinterpret_cast<char *>(&mVertices[i]));
+ }
+ }
+ font+=vsize;
+ for (uint32_t i=0; i<mCount; i++)
+ {
+ uint8_t c = *font++;
+ font = mCharacters[c].init(font,mVertices);
+ }
+ }
+ isFirst = false;
+ }
+ }
+
+ void vprint(const char *buffer,ProcessRenderDebugHelper *debug,float textScale,bool centered)
+ {
+ const char *scan = buffer;
+ float x = 0;
+ float y = 0;
+ if ( centered )
+ {
+ float wid=0;
+ while ( *scan )
+ {
+ unsigned c = unsigned(*scan++);
+ wid+=mCharacters[c].getWidth();
+ }
+ x = -wid*0.5f;
+ scan = buffer;
+ }
+ while ( *scan )
+ {
+ unsigned c = unsigned(*scan++);
+ mCharacters[c].vputc(mVertices,debug,textScale,x,y);
+ }
+ }
+
+private:
+ uint32_t mVersion;
+ uint32_t mVcount;
+ uint32_t mCount;
+ float *mVertices;
+ uint32_t mIcount;
+ FontChar mCharacters[256];
+};
+
+
+
+
+class ProcessRenderDebugImpl : public ProcessRenderDebug, public physx::shdfnd::UserAllocated, public ProcessRenderDebugHelper
+{
+public:
+
+ ProcessRenderDebugImpl(void)
+ {
+ mViewMatrix = physx::PxMat44(physx::PxIdentity);
+ mLines = NULL;
+ mLineVertexCount = 0;
+ mMaxLineVertexCount = 0;
+ mTriangles = NULL;
+ mSolidVertexCount = 0;
+ mMaxSolidVertexCount = 0;
+ }
+
+ virtual ~ProcessRenderDebugImpl(void)
+ {
+ PX_FREE(mLines);
+ PX_FREE(mTriangles);
+ }
+
+ void flushLines(void)
+ {
+ if (mLines != NULL && mInterface != NULL && mLineVertexCount > 0)
+ {
+ mInterface->debugRenderLines(mLineVertexCount/2,mLines,mDisplayType!=WORLD_SPACE_NOZ,mDisplayType==SCREEN_SPACE);
+ }
+ if (mLines == NULL)
+ {
+ mLines = static_cast<RENDER_DEBUG::RenderDebugVertex *>(PX_ALLOC(sizeof(RENDER_DEBUG::RenderDebugVertex)*MAX_LINE_VERTEX, PX_DEBUG_EXP("RenderDebugVertex")));
+ mMaxLineVertexCount = MAX_LINE_VERTEX;
+ }
+ mLineVertexCount = 0;
+ }
+
+ void flushTriangles(void)
+ {
+ if (mTriangles != NULL && mInterface != NULL && mSolidVertexCount > 0)
+ {
+ mInterface->debugRenderTriangles(mSolidVertexCount/3,mTriangles,mDisplayType!=WORLD_SPACE_NOZ,mDisplayType==SCREEN_SPACE);
+ }
+ if (mTriangles == NULL)
+ {
+ mTriangles = static_cast<RENDER_DEBUG::RenderDebugSolidVertex *>(PX_ALLOC(sizeof(RENDER_DEBUG::RenderDebugSolidVertex)*MAX_SOLID_VERTEX, PX_DEBUG_EXP("RENDER_DEBUG::RenderDebugSolidVertex")));
+ mMaxSolidVertexCount = MAX_SOLID_VERTEX;
+ }
+ mSolidVertexCount = 0;
+ }
+
+ virtual void flush(RENDER_DEBUG::RenderDebugInterface *iface,DisplayType type)
+ {
+ mInterface = iface;
+ mDisplayType = type;
+ flushLines();
+ flushTriangles();
+ new ( &mCurrentState ) RenderState; // reset renderstate to inifial conditions.
+ }
+
+ bool isIdentity(const physx::PxMat44 &t) const
+ {
+ physx::PxMat44 id = physx::PxMat44(physx::PxIdentity);
+ const float *f1 = t.front();
+ const float *f2 = id.front();
+ for (uint32_t i=0; i<16; i++)
+ {
+ float diff = physx::PxAbs( f1[i] - f2[i] );
+ if ( diff > 0.000001f )
+ return false;
+ }
+ return true;
+ }
+
+ virtual void processRenderDebug(const DebugPrimitive **plist,uint32_t pcount,RENDER_DEBUG::RenderDebugInterface *iface,DisplayType type)
+ {
+ mInterface = iface;
+ mDisplayType = type;
+
+ for (uint32_t i=0; i<pcount; i++)
+ {
+ const DebugPrimitive &p = *plist[i];
+ switch ( p.mCommand )
+ {
+ case DebugCommand::DEBUG_RELEASE_TRIANGLE_MESH:
+ if ( iface )
+ {
+ const DebugReleaseTriangleMesh &d = static_cast< const DebugReleaseTriangleMesh &>(p);
+ iface->releaseTriangleMesh(d.mMeshId);
+ }
+ break;
+ case DebugCommand::DEBUG_RENDER_TRIANGLE_MESH_INSTANCES:
+ {
+ const DebugRenderTriangleMeshInstances &dgs = static_cast< const DebugRenderTriangleMeshInstances &>(p);
+ debugRenderTriangleMeshInstances(dgs,iface);
+ }
+ break;
+ case DebugCommand::DEBUG_CONVEX_HULL:
+ {
+ const DebugConvexHull &dgs = static_cast< const DebugConvexHull &>(p);
+ debugConvexHull(dgs);
+ }
+ break;
+ case DebugCommand::DEBUG_RENDER_POINTS:
+ {
+ const DebugRenderPoints &dgs = static_cast< const DebugRenderPoints &>(p);
+ debugRenderPoints(dgs,iface);
+ }
+ break;
+ case DebugCommand::DEBUG_RENDER_LINES:
+ {
+ const DebugRenderLines &dgs = static_cast< const DebugRenderLines &>(p);
+ debugRenderLines(dgs,iface);
+ }
+ break;
+ case DebugCommand::DEBUG_RENDER_TRIANGLES:
+ {
+ const DebugRenderTriangles &dgs = static_cast< const DebugRenderTriangles &>(p);
+ debugRenderTriangles(dgs,iface);
+ }
+ break;
+ case DebugCommand::DEBUG_UNREGISTER_INPUT_EVENT:
+ if ( iface )
+ {
+ const DebugUnregisterInputEvent &d = static_cast< const DebugUnregisterInputEvent &>(p);
+ iface->unregisterInputEvent(static_cast<InputEventIds::Enum>(d.mEventId));
+ }
+ break;
+ case DebugCommand::DEBUG_REGISTER_INPUT_EVENT:
+ if ( iface )
+ {
+ const DebugRegisterInputEvent &d = static_cast< const DebugRegisterInputEvent &>(p);
+ if ( d.mDigital )
+ {
+ iface->registerDigitalInputEvent(static_cast<InputEventIds::Enum>(d.mEventId), static_cast<InputIds::Enum>(d.mInputId));
+ }
+ else
+ {
+ iface->registerAnalogInputEvent(static_cast<InputEventIds::Enum>(d.mEventId), d.mSensitivity, static_cast<InputIds::Enum>(d.mInputId));
+ }
+ }
+ break;
+ case DebugCommand::DEBUG_SKIP_FRAME:
+ break;
+ case DebugCommand::DEBUG_RESET_INPUT_EVENTS:
+ if ( iface )
+ {
+ iface->resetInputEvents();
+ }
+ break;
+ case DebugCommand::DEBUG_CREATE_TRIANGLE_MESH:
+ {
+ const DebugCreateTriangleMesh &dgs = static_cast< const DebugCreateTriangleMesh &>(p);
+ debugCreateTriangleMesh(dgs,iface);
+ }
+ break;
+ case DebugCommand::DEBUG_REFRESH_TRIANGLE_MESH_VERTICES:
+ {
+ const DebugRefreshTriangleMeshVertices &dgs = static_cast< const DebugRefreshTriangleMeshVertices &>(p);
+ debugRefreshTriangleMeshVertices(dgs,iface);
+ }
+ break;
+ case DebugCommand::DEBUG_GRAPH:
+ {
+ const DebugGraphStream &dgs = static_cast< const DebugGraphStream &>(p);
+ debugGraph(dgs);
+ }
+ break;
+ case DebugCommand::DEBUG_GRADIENT_TRI:
+ {
+ const DebugGradientTri &dg = static_cast< const DebugGradientTri &>(p);
+ debugGradientTri(dg);
+ if ( iface )
+ {
+ RenderDebugSolidVertex verts[3];
+ verts[0].mPos[0] = dg.mP1.x; verts[0].mPos[1] = dg.mP1.y; verts[0].mPos[2] = dg.mP1.z;
+ verts[1].mPos[0] = dg.mP2.x; verts[1].mPos[1] = dg.mP2.y; verts[1].mPos[2] = dg.mP2.z;
+ verts[2].mPos[0] = dg.mP3.x; verts[2].mPos[1] = dg.mP3.y; verts[2].mPos[2] = dg.mP3.z;
+ const physx::PxVec3 v1(dg.mP1.x, dg.mP1.y, dg.mP1.z),
+ v2(dg.mP2.x, dg.mP2.y, dg.mP2.z),
+ v3(dg.mP3.x, dg.mP3.y, dg.mP3.z);
+
+ const physx::PxVec3 n = physx::PxVec3(v2-v1).cross(physx::PxVec3(v3-v1)).getNormalized();
+ verts[0].mNormal[0] = n.x;
+ verts[0].mNormal[1] = n.y;
+ verts[0].mNormal[2] = n.z;
+ verts[1].mNormal[0] = n.x;
+ verts[1].mNormal[1] = n.y;
+ verts[1].mNormal[2] = n.z;
+ verts[2].mNormal[0] = n.x;
+ verts[2].mNormal[1] = n.y;
+ verts[2].mNormal[2] = n.z;
+ iface->debugRenderTriangles(1, verts, false, false);
+ }
+ }
+ break;
+ case DebugCommand::SET_CURRENT_TRANSFORM:
+ {
+ const DebugSetCurrentTransform &dg = static_cast< const DebugSetCurrentTransform &>(p);
+ if ( isIdentity(dg.mTransform ))
+ {
+ mCurrentState.mPose = NULL;
+ }
+ else
+ {
+ mCurrentState.mCurrentPose = dg.mTransform;
+ mCurrentState.mPose = &mCurrentState.mCurrentPose;
+ }
+ }
+ break;
+ case DebugCommand::DEBUG_LINE:
+ {
+ const DebugLine &dg = static_cast< const DebugLine &>(p);
+ debugLine(dg.mP1,dg.mP2,mCurrentState.mColor,mCurrentState.mColor);
+ }
+ break;
+ case DebugCommand::DRAW_GRID:
+ {
+ const DrawGrid &dg = static_cast< const DrawGrid &>(p);
+ drawGrid(dg);
+ }
+ break;
+ case DebugCommand::SET_CURRENT_COLOR:
+ {
+ const DebugPrimitiveU32 &dg = static_cast< const DebugPrimitiveU32 &>(p);
+ mCurrentState.mColor = dg.mValue;
+ }
+ break;
+ case DebugCommand::SET_CURRENT_ARROW_COLOR:
+ {
+ const DebugPrimitiveU32 &dg = static_cast< const DebugPrimitiveU32 &>(p);
+ mCurrentState.mArrowColor = dg.mValue;
+ }
+ break;
+ case DebugCommand::SET_CURRENT_TILE1:
+ {
+ const DebugPrimitiveF32 &dg = static_cast< const DebugPrimitiveF32 &>(p);
+ mCurrentState.mTileRate1 = dg.mValue;
+ }
+ break;
+ case DebugCommand::SET_CURRENT_TILE2:
+ {
+ const DebugPrimitiveF32 &dg = static_cast< const DebugPrimitiveF32 &>(p);
+ mCurrentState.mTileRate2 = dg.mValue;
+ }
+ break;
+ case DebugCommand::SET_CURRENT_TEXTURE1:
+ {
+ const DebugPrimitiveU32 &dg = static_cast< const DebugPrimitiveU32 &>(p);
+ mCurrentState.mTexture1 = dg.mValue;
+ }
+ break;
+ case DebugCommand::SET_CURRENT_TEXTURE2:
+ {
+ const DebugPrimitiveU32 &dg = static_cast< const DebugPrimitiveU32 &>(p);
+ mCurrentState.mTexture2 = dg.mValue;
+ }
+ break;
+ case DebugCommand::SET_CURRENT_USER_ID:
+ {
+ const DebugPrimitiveU32 &dg = static_cast< const DebugPrimitiveU32 &>(p);
+ mCurrentState.mUserId = int32_t(dg.mValue);
+ }
+ break;
+ case DebugCommand::SET_CURRENT_RENDER_SCALE:
+ {
+ const DebugPrimitiveF32 &dg = static_cast< const DebugPrimitiveF32 &>(p);
+ mCurrentState.mRenderScale = dg.mValue;
+ }
+ break;
+ case DebugCommand::SET_CURRENT_ARROW_SIZE:
+ {
+ const DebugPrimitiveF32 &dg = static_cast< const DebugPrimitiveF32 &>(p);
+ mCurrentState.mArrowSize = dg.mValue;
+ }
+ break;
+ case DebugCommand::SET_CURRENT_RENDER_STATE:
+ {
+ const DebugPrimitiveU32 &dg = static_cast< const DebugPrimitiveU32 &>(p);
+ mCurrentState.mStates = dg.mValue;
+ }
+ break;
+ case DebugCommand::SET_CURRENT_TEXT_SCALE:
+ {
+ const DebugPrimitiveF32 &dg = static_cast< const DebugPrimitiveF32 &>(p);
+ mCurrentState.mTextScale = dg.mValue;
+ }
+ break;
+ case DebugCommand::DEBUG_TEXT:
+ {
+ const DebugText &dg = static_cast< const DebugText &>(p);
+ debugText(dg);
+ }
+ break;
+ case DebugCommand::DEBUG_TEXT2D:
+ if ( iface )
+ {
+ const DebugText2D &dg = static_cast< const DebugText2D &>(p);
+ iface->debugText2D(dg.mPosition.x,dg.mPosition.y,dg.mScale,dg.mShadowOffset,dg.mForceFixWidthNumbers ? true : false,dg.mTextColor, dg.mText );
+ }
+ break;
+ case DebugCommand::DEBUG_BOUND:
+ {
+ const DebugBound &db = static_cast< const DebugBound &>(p);
+ debugBound(db);
+ }
+ break;
+ case DebugCommand::DEBUG_QUAD:
+ {
+ const DebugQuad &b = static_cast< const DebugQuad &>(p);
+ debugQuad(b);
+ }
+ break;
+ case DebugCommand::DEBUG_POINT:
+ {
+ const DebugPoint &b = static_cast< const DebugPoint &>(p);
+ debugPoint(b);
+ }
+ break;
+ case DebugCommand::DEBUG_POINT_SCALE:
+ {
+ const DebugPointScale &b = static_cast< const DebugPointScale &>(p);
+ debugPoint(b);
+ }
+ break;
+ case DebugCommand::DEBUG_RECT2D:
+ {
+ const DebugRect2d &d = static_cast<const DebugRect2d &>(p);
+ debugRect2d(d);
+ }
+ break;
+ case DebugCommand::DEBUG_GRADIENT_LINE:
+ {
+ const DebugGradientLine &d = static_cast< const DebugGradientLine &>(p);
+ debugGradientLine(d);
+ }
+ break;
+ case DebugCommand::DEBUG_RAY:
+ {
+ const DebugRay &d = static_cast< const DebugRay &>(p);
+ debugRay(d);
+ }
+ break;
+ case DebugCommand::DEBUG_CYLINDER:
+ {
+ const DebugCylinder &d = static_cast< const DebugCylinder &>(p);
+ debugCylinder(d);
+ }
+ break;
+ case DebugCommand::DEBUG_CIRCLE:
+ {
+ const DebugCircle &d = static_cast< const DebugCircle &>(p);
+ debugCircle(d);
+ }
+ break;
+ case DebugCommand::DEBUG_POINT_CYLINDER:
+ {
+ const DebugPointCylinder &d = static_cast< const DebugPointCylinder &>(p);
+ debugPointCylinder(d);
+ }
+ break;
+ case DebugCommand::DEBUG_THICK_RAY:
+ {
+ const DebugThickRay &d = static_cast< const DebugThickRay &>(p);
+ debugThickRay(d);
+ }
+ break;
+ case DebugCommand::DEBUG_PLANE:
+ {
+ const DebugPlane &d = static_cast< const DebugPlane &>(p);
+ debugPlane(d);
+ }
+ break;
+ case DebugCommand::DEBUG_TRI:
+ {
+ const DebugTri &d = static_cast< const DebugTri &>(p);
+ debugTri(&d.mP1,&d.mP2,&d.mP3,NULL,NULL,NULL,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,false);
+ }
+ break;
+ case DebugCommand::DEBUG_TRI_NORMALS:
+ {
+ const DebugTriNormals &d = static_cast< const DebugTriNormals &>(p);
+ debugTriNormals(d);
+ }
+ break;
+ case DebugCommand::DEBUG_GRADIENT_TRI_NORMALS:
+ {
+ const DebugGradientTriNormals &d = static_cast< const DebugGradientTriNormals &>(p);
+ debugGradientTriNormals(d);
+ }
+ break;
+ case DebugCommand::DEBUG_SPHERE:
+ {
+ const DebugSphere &d = static_cast< const DebugSphere &>(p);
+ debugSphere(d);
+ }
+ break;
+ case DebugCommand::DEBUG_SQUASHED_SPHERE:
+ {
+ const DebugSquashedSphere &d = static_cast< const DebugSquashedSphere &>(p);
+ debugSphere(d);
+ }
+ break;
+ case DebugCommand::DEBUG_CAPSULE:
+ {
+ const DebugCapsule &d = static_cast<const DebugCapsule &>(p);
+ debugCapsule(d);
+ }
+ break;
+ case DebugCommand::DEBUG_CAPSULE_TAPERED:
+ {
+ const DebugTaperedCapsule&d = static_cast<const DebugTaperedCapsule&>(p);
+ debugTaperedCapsule(d);
+ }
+ break;
+ case DebugCommand::DEBUG_AXES:
+ {
+ const DebugAxes &d = static_cast< const DebugAxes &>(p);
+ debugAxes(d);
+ }
+ break;
+ case DebugCommand::DEBUG_ARC:
+ {
+ const DebugArc &d = static_cast< const DebugArc &>(p);
+ debugArc(d);
+ }
+ break;
+ case DebugCommand::DEBUG_THICK_ARC:
+ {
+ const DebugThickArc &d = static_cast< const DebugThickArc &>(p);
+ debugThickArc(d);
+ }
+ break;
+ case DebugCommand::DEBUG_DETAILED_SPHERE:
+ {
+ const DebugDetailedSphere &d = static_cast< const DebugDetailedSphere &>(p);
+ debugDetailedSphere(d);
+ }
+ break;
+ case DebugCommand::DEBUG_MESSAGE:
+ {
+ const DebugMessage &d = static_cast< const DebugMessage &>(p);
+ mInterface->debugMessage(d.mText);
+ }
+ break;
+ case DebugCommand::DEBUG_CREATE_CUSTOM_TEXTURE:
+ {
+ const DebugCreateCustomTexture &d = static_cast< const DebugCreateCustomTexture &>(p);
+ mInterface->createCustomTexture(d.mId,d.mTextureName);
+ }
+ break;
+ case DebugCommand::DEBUG_FRUSTUM:
+ {
+ const DebugFrustum &f = static_cast< const DebugFrustum &>(p);
+ debugFrustum(f.mView,f.mProj);
+ }
+ break;
+ case DebugCommand::DEBUG_CONE:
+ {
+ const DebugCone &c = static_cast< const DebugCone &>(p);
+ debugCone(c);
+ }
+ break;
+ case DebugCommand::DEBUG_BLOCK_INFO:
+ {
+ }
+ break;
+ case DebugCommand::DEBUG_LAST:
+ break;
+ default:
+ PX_ALWAYS_ASSERT();
+ break;
+ }
+ }
+ }
+
+ virtual void release(void)
+ {
+ delete this;
+ }
+
+ PX_INLINE int32_t clampColor(int32_t c)
+ {
+ if ( c < 0 )
+ {
+ c = 0;
+ }
+ else if ( c > 255 )
+ {
+ c = 255;
+ }
+ return c;
+ }
+
+ void debugText(const DebugText &dg)
+ {
+ physx::PxMat44 *savePose = mCurrentState.mPose;
+ mCurrentState.mPose = NULL;
+ physx::PxMat44 pose = dg.mPose;
+ pose.setPosition( pose.getPosition()+dg.mPosition );
+ if ( savePose )
+ {
+ pose = *savePose * pose;
+ }
+
+ if ( mCurrentState.isCameraFacing() )
+ {
+ float *cameraWorldPose = const_cast<float*>(pose.front());
+ const float *viewMatrix = mViewMatrix.front();
+ cameraWorldPose[0] = viewMatrix[0];
+ cameraWorldPose[1] = viewMatrix[4];
+ cameraWorldPose[2] = viewMatrix[8];
+ cameraWorldPose[3] = 0;
+
+ cameraWorldPose[4] = viewMatrix[1];
+ cameraWorldPose[5] = viewMatrix[5];
+ cameraWorldPose[6] = viewMatrix[9];
+ cameraWorldPose[7] = 0;
+
+ cameraWorldPose[8] = viewMatrix[2];
+ cameraWorldPose[9] = viewMatrix[6];
+ cameraWorldPose[10] = viewMatrix[10];
+ cameraWorldPose[11] = 0;
+ }
+ mCurrentState.mPose = &pose;
+ mVectorFont.vprint(dg.mText, this, mCurrentState.mTextScale, mCurrentState.isCentered() );
+ mCurrentState.mPose = savePose;
+ }
+
+ uint32_t getColor(uint32_t r,uint32_t g,uint32_t b,float percent = 0.0f)
+ {
+ uint32_t dr = uint32_t(static_cast<float>(r)*percent);
+ uint32_t dg = uint32_t(static_cast<float>(g)*percent);
+ uint32_t db = uint32_t(static_cast<float>(b)*percent);
+ r-=dr;
+ g-=dg;
+ b-=db;
+
+ const uint32_t c = 0xff000000 | (r<<16) | (g<<8) | b;
+ return c;
+ }
+
+
+ PX_INLINE void swapYZ(physx::PxVec3 &p)
+ {
+ float y = p.y;
+ p.y = p.z;
+ p.z = y;
+ }
+
+ void drawGrid(const DrawGrid &dg)
+ {
+ bool zup = dg.mZup ? true : false;
+ uint32_t gridSize = dg.mGridSize;
+ int32_t GRIDSIZE = int32_t(gridSize);
+
+ uint32_t c1 = getColor(133,153,181,0.1f);
+ uint32_t c2 = getColor(133,153,181,0.3f);
+ uint32_t c3 = getColor(133,153,181,0.5f);
+
+ const float TSCALE = 1.0f;
+
+ float BASELOC = 0-0.05f;
+
+ for (int32_t x=-GRIDSIZE; x<=GRIDSIZE; x++)
+ {
+ uint32_t c = c1;
+ if ( (x%10) == 0 ) c = c2;
+ if ( (x%GRIDSIZE) == 0 ) c = c3;
+
+ physx::PxVec3 p1( static_cast<float>(x), static_cast<float>(-GRIDSIZE), BASELOC );
+ physx::PxVec3 p2( static_cast<float>(x), static_cast<float>(+GRIDSIZE), BASELOC );
+
+ p1*=TSCALE;
+ p2*=TSCALE;
+
+ if ( !zup )
+ {
+ swapYZ(p1);
+ swapYZ(p2);
+ }
+ debugLine(p1,p2,c,c);
+
+
+ }
+
+ for (int32_t y=-GRIDSIZE; y<=GRIDSIZE; y++)
+ {
+ uint32_t c = c1;
+
+ if ( (y%10) == 0 ) c = c2;
+ if ( (y%GRIDSIZE) == 0 ) c = c3;
+
+ physx::PxVec3 p1(static_cast<float>(-GRIDSIZE), static_cast<float>(y), BASELOC);
+ physx::PxVec3 p2(static_cast<float>(+GRIDSIZE), static_cast<float>(y), BASELOC);
+
+ p1*=TSCALE;
+ p2*=TSCALE;
+
+ if ( !zup )
+ {
+ swapYZ(p1);
+ swapYZ(p2);
+ }
+
+ debugLine(p1,p2,c,c);
+ }
+ }
+
+ PX_INLINE void debugLine(const physx::PxVec3 &p1,const physx::PxVec3 &p2,uint32_t color1,uint32_t color2)
+ {
+ RENDER_DEBUG::RenderDebugVertex *v = getDebugVertex(2);
+
+ if ( mCurrentState.mPose )
+ {
+ physx::PxVec3 _p1 = mCurrentState.mPose->transform(p1);
+ physx::PxVec3 _p2 = mCurrentState.mPose->transform(p2);
+ v[0].mPos[0] = _p1.x*mCurrentState.mRenderScale;
+ v[0].mPos[1] = _p1.y*mCurrentState.mRenderScale;
+ v[0].mPos[2] = _p1.z*mCurrentState.mRenderScale;
+ v[0].mColor = color1;
+
+ v[1].mPos[0] = _p2.x*mCurrentState.mRenderScale;
+ v[1].mPos[1] = _p2.y*mCurrentState.mRenderScale;
+ v[1].mPos[2] = _p2.z*mCurrentState.mRenderScale;
+ v[1].mColor = color2;
+ }
+ else
+ {
+ v[0].mPos[0] = p1.x*mCurrentState.mRenderScale;
+ v[0].mPos[1] = p1.y*mCurrentState.mRenderScale;
+ v[0].mPos[2] = p1.z*mCurrentState.mRenderScale;
+ v[0].mColor = color1;
+
+ v[1].mPos[0] = p2.x*mCurrentState.mRenderScale;
+ v[1].mPos[1] = p2.y*mCurrentState.mRenderScale;
+ v[1].mPos[2] = p2.z*mCurrentState.mRenderScale;
+ v[1].mColor = color2;
+ }
+ }
+
+ PX_INLINE physx::PxVec3 rotate2d(const physx::PxVec3 &p,float r)
+ {
+ physx::PxVec3 ret;
+ ret.x = p.x*cosf(r) - p.y*sinf(r);
+ ret.y = p.x*sinf(r) + p.y*cosf(r);
+ ret.z = 0;
+ return ret;
+ }
+
+ PX_INLINE physx::PxVec3 facing(const physx::PxVec3 &p,const physx::PxMat44 &inverseViewMatrix)
+ {
+ return inverseViewMatrix.rotate(p);
+ }
+
+ PX_INLINE void debugQuad(const DebugQuad &p)
+ {
+ physx::PxVec3 points[4];
+
+ physx::PxMat44 inverseViewMatrix;
+
+ // get the inverse view matrix
+ float *cameraWorldPose = const_cast<float *>(inverseViewMatrix.front());
+ const float *viewMatrix = mViewMatrix.front();
+ cameraWorldPose[0] = viewMatrix[0];
+ cameraWorldPose[1] = viewMatrix[4];
+ cameraWorldPose[2] = viewMatrix[8];
+ cameraWorldPose[3] = 0;
+
+ cameraWorldPose[4] = viewMatrix[1];
+ cameraWorldPose[5] = viewMatrix[5];
+ cameraWorldPose[6] = viewMatrix[9];
+ cameraWorldPose[7] = 0;
+
+ cameraWorldPose[8] = viewMatrix[2];
+ cameraWorldPose[9] = viewMatrix[6];
+ cameraWorldPose[10] = viewMatrix[10];
+ cameraWorldPose[11] = 0;
+
+ // apply scale, rotation, and make the quad face the camera.
+ points[0] = facing(rotate2d(physx::PxVec3(-p.mScale.x*0.5f,-p.mScale.y*0.5f,0),p.mRotation),inverseViewMatrix)+p.mPos;
+ points[1] = facing(rotate2d(physx::PxVec3(p.mScale.x*0.5f,-p.mScale.y*0.5f,0),p.mRotation),inverseViewMatrix)+p.mPos;
+ points[2] = facing(rotate2d(physx::PxVec3(p.mScale.x*0.5f,p.mScale.y*0.5f,0),p.mRotation),inverseViewMatrix)+p.mPos;
+ points[3] = facing(rotate2d(physx::PxVec3(-p.mScale.x*0.5f,p.mScale.y*0.5f,0),p.mRotation),inverseViewMatrix)+p.mPos;
+
+
+ if ( mCurrentState.hasRenderState(RENDER_DEBUG::DebugRenderState::SolidWireShaded) || mCurrentState.hasRenderState(RENDER_DEBUG::DebugRenderState::SolidShaded) )
+ {
+ physx::PxVec3 normal(1.0f,1.0f,0);
+ uint32_t renderState = mCurrentState.mStates;
+ mCurrentState.clearRenderState(RENDER_DEBUG::DebugRenderState::SolidWireShaded);
+ mCurrentState.setRenderState(RENDER_DEBUG::DebugRenderState::SolidShaded);
+ debugTri(&points[0],&points[1],&points[2],&normal,&normal,&normal);
+ debugTri(&points[0],&points[2],&points[3],&normal,&normal,&normal);
+ mCurrentState.mStates = renderState;
+ }
+ if ( mCurrentState.hasRenderState(RENDER_DEBUG::DebugRenderState::SolidWireShaded) || !mCurrentState.hasRenderState(RENDER_DEBUG::DebugRenderState::SolidShaded) )
+ {
+ uint32_t currentColor = mCurrentState.mColor;
+ if ( mCurrentState.hasRenderState(RENDER_DEBUG::DebugRenderState::SolidWireShaded))
+ {
+ mCurrentState.mColor = mCurrentState.mArrowColor;
+ }
+ debugLine(points[0], points[1] );
+ debugLine(points[1], points[2] );
+ debugLine(points[2], points[3] );
+ debugLine(points[3], points[0] );
+ mCurrentState.mColor = currentColor;
+ }
+ }
+
+
+ PX_INLINE void debugPoint(const DebugPoint &p)
+ {
+ const physx::PxVec3 *source = debug_point;
+
+ for (int32_t i=0; i<3; i++)
+ {
+ physx::PxVec3 p1 = source[0]*p.mSize+p.mPos;
+ physx::PxVec3 p2 = source[1]*p.mSize+p.mPos;
+ source+=2;
+
+ debugLine(p1,p2);
+ }
+ }
+
+ PX_INLINE void debugPoint(const DebugPointScale &p)
+ {
+ const physx::PxVec3 *source = debug_point;
+
+ for (uint32_t i=0; i<3; i++)
+ {
+ physx::PxVec3 p1 = source[0]*p.mSize[i]+p.mPos;
+ physx::PxVec3 p2 = source[1]*p.mSize[i]+p.mPos;
+ source+=2;
+ debugLine(p1,p2);
+ }
+ }
+
+
+ PX_INLINE void debugGradientTri(const DebugGradientTri &tri)
+ {
+ debugTri(&tri.mP1,&tri.mP2,&tri.mP3,NULL,NULL,NULL,tri.mC1,tri.mC2,tri.mC3,true);
+ }
+
+ PX_INLINE void debugLine(const physx::PxVec3 &p1,const physx::PxVec3 &p2)
+ {
+ debugLine(p1,p2,mCurrentState.mColor,mCurrentState.mColor);
+ }
+
+ virtual void indirectDebugLine(const physx::PxVec3 &p1,const physx::PxVec3 &p2)
+ {
+ debugLine(p1,p2,mCurrentState.mColor,mCurrentState.mColor);
+ }
+
+ RENDER_DEBUG::RenderDebugVertex * getDebugVertex(uint32_t count)
+ {
+ if (( mLineVertexCount+count) > mMaxLineVertexCount )
+ {
+ flushLines();
+ }
+ PX_ASSERT( count < mMaxLineVertexCount );
+ RENDER_DEBUG::RenderDebugVertex *ret = &mLines[mLineVertexCount];
+ mLineVertexCount+=count;
+ return ret;
+ }
+
+ RENDER_DEBUG::RenderDebugSolidVertex * getDebugSolidVertex(uint32_t count)
+ {
+ if (( mSolidVertexCount+count) > mMaxSolidVertexCount )
+ {
+ flushTriangles();
+ }
+ PX_ASSERT( count < mMaxSolidVertexCount );
+ RENDER_DEBUG::RenderDebugSolidVertex *ret = &mTriangles[mSolidVertexCount];
+ mSolidVertexCount+=count;
+ return ret;
+ }
+
+ virtual void flushFrame(RENDER_DEBUG::RenderDebugInterface * /*iface*/)
+ {
+ }
+
+ PX_INLINE void debugBound(const DebugBound &b)
+ {
+ physx::PxVec3 box[8];
+ box[0] = physx::PxVec3( b.mBmin.x, b.mBmin.y, b.mBmin.z );
+ box[1] = physx::PxVec3( b.mBmax.x, b.mBmin.y, b.mBmin.z );
+ box[2] = physx::PxVec3( b.mBmax.x, b.mBmax.y, b.mBmin.z );
+ box[3] = physx::PxVec3( b.mBmin.x, b.mBmax.y, b.mBmin.z );
+ box[4] = physx::PxVec3( b.mBmin.x, b.mBmin.y, b.mBmax.z );
+ box[5] = physx::PxVec3( b.mBmax.x, b.mBmin.y, b.mBmax.z );
+ box[6] = physx::PxVec3( b.mBmax.x, b.mBmax.y, b.mBmax.z );
+ box[7] = physx::PxVec3( b.mBmin.x, b.mBmax.y, b.mBmax.z );
+ debugBound(box);
+ }
+
+ float computePlaneEquation(const physx::PxVec3 &A,const physx::PxVec3 &B,const physx::PxVec3 &C,physx::PxVec3 &normal)
+ {
+ physx::PxVec3 v = B - C;
+ physx::PxVec3 w = A - B;
+
+ physx::PxVec3 vw;
+
+ vw.x = v.y * w.z - v.z * w.y;
+ vw.y = v.z * w.x - v.x * w.z;
+ vw.z = v.x * w.y - v.y * w.x;
+
+ float mag = vw.magnitude();
+
+ if ( mag < 0.000001f )
+ {
+ mag = 0;
+ }
+ else
+ {
+ mag = 1.0f/mag;
+ }
+
+ normal = vw*mag;
+
+ float D = 0.0f - ((normal.x*A.x)+(normal.y*A.y)+(normal.z*A.z));
+
+ return D;
+ }
+
+ void debugTri(const physx::PxVec3 *_v1,const physx::PxVec3 *_v2,const physx::PxVec3 *_v3,const physx::PxVec3 *_n1=NULL,const physx::PxVec3 *_n2=NULL,const physx::PxVec3 *_n3=NULL,uint32_t c1=0xFFFFFFFF,uint32_t c2=0xFFFFFFFF,uint32_t c3=0xFFFFFFFF,bool useGradientColors=false)
+ {
+ if( mCurrentState.hasRenderState(RENDER_DEBUG::DebugRenderState::DoubleSided) )
+ {
+ debugTriOneSide(_v1, _v2, _v3, _n1, _n2, _n3, c1, c2, c3, useGradientColors, false);
+ debugTriOneSide(_v1, _v2, _v3, _n1, _n2, _n3, c1, c2, c3, useGradientColors, true);
+ }
+ else
+ {
+ debugTriOneSide(_v1, _v2, _v3, _n1, _n2, _n3, c1, c2, c3, useGradientColors, mCurrentState.hasRenderState(RENDER_DEBUG::DebugRenderState::CounterClockwise));
+ }
+ }
+
+ void debugTriOneSide(const physx::PxVec3 *_v1,
+ const physx::PxVec3 *_v2,
+ const physx::PxVec3 *_v3,
+ const physx::PxVec3 *_n1=NULL,
+ const physx::PxVec3 *_n2=NULL,
+ const physx::PxVec3 *_n3=NULL,
+ uint32_t c1=0xFFFFFFFF,
+ uint32_t c2=0xFFFFFFFF,
+ uint32_t c3=0xFFFFFFFF,
+ bool useGradientColors=false,
+ bool counterClockwise=false)
+ {
+ if (counterClockwise)
+ {
+ const physx::PxVec3 *temp = _v1;
+ _v1 = _v3;
+ _v3 = temp;
+ if ( _n1 )
+ {
+ temp = _n1;
+ _n1 = _n3;
+ _n3 = temp;
+ }
+ // switch colors too
+ {
+ uint32_t t = c1;
+ c1 = c3;
+ c3 = t;
+ }
+ }
+
+ if ( !useGradientColors )
+ {
+ c1 = mCurrentState.mColor;
+ c2 = mCurrentState.mColor;
+ c3 = mCurrentState.mColor;
+ }
+
+ physx::PxVec3 v1 = *_v1;
+ physx::PxVec3 v2 = *_v2;
+ physx::PxVec3 v3 = *_v3;
+
+ if (mCurrentState.mPose)
+ {
+ v1 = mCurrentState.mPose->transform(*_v1);
+ v2 = mCurrentState.mPose->transform(*_v2);
+ v3 = mCurrentState.mPose->transform(*_v3);
+ }
+
+ v1 *= mCurrentState.mRenderScale;
+ v2 *= mCurrentState.mRenderScale;
+ v3 *= mCurrentState.mRenderScale;
+
+ if (mCurrentState.isSolid())
+ {
+ RENDER_DEBUG::RenderDebugSolidVertex* verts = getDebugSolidVertex(3);
+
+ physx::PxVec3 n1, n2, n3;
+ if (_n1 == NULL)
+ {
+ computePlaneEquation(v3, v2, v1, n1);
+ if (counterClockwise)
+ {
+ n1 = -n1;
+ }
+ n2 = n1;
+ n3 = n1;
+ }
+ else
+ {
+ if (mCurrentState.mPose)
+ {
+ n1 = mCurrentState.mPose->rotate(*_n1);
+ n2 = mCurrentState.mPose->rotate(*_n2);
+ n3 = mCurrentState.mPose->rotate(*_n3);
+ }
+ else
+ {
+ n1 = *_n1;
+ n2 = *_n2;
+ n3 = *_n3;
+ }
+ }
+
+ verts[0].mPos[0] = v1.x;
+ verts[0].mPos[1] = v1.y;
+ verts[0].mPos[2] = v1.z;
+ verts[0].mColor = c1;
+ verts[0].mNormal[0] = n1.x;
+ verts[0].mNormal[1] = n1.y;
+ verts[0].mNormal[2] = n1.z;
+
+ verts[1].mPos[0] = v2.x;
+ verts[1].mPos[1] = v2.y;
+ verts[1].mPos[2] = v2.z;
+ verts[1].mColor = c2;
+ verts[1].mNormal[0] = n2.x;
+ verts[1].mNormal[1] = n2.y;
+ verts[1].mNormal[2] = n2.z;
+
+ verts[2].mPos[0] = v3.x;
+ verts[2].mPos[1] = v3.y;
+ verts[2].mPos[2] = v3.z;
+ verts[2].mColor = c3;
+ verts[2].mNormal[0] = n3.x;
+ verts[2].mNormal[1] = n3.y;
+ verts[2].mNormal[2] = n3.z;
+ }
+
+ if ( !mCurrentState.hasRenderState(RENDER_DEBUG::DebugRenderState::SolidShaded) || mCurrentState.hasRenderState(RENDER_DEBUG::DebugRenderState::SolidWireShaded) )
+ {
+ if ( mCurrentState.hasRenderState(RENDER_DEBUG::DebugRenderState::SolidWireShaded) )
+ {
+ c1 = c2 = c3 = mCurrentState.mArrowColor;
+ }
+ RENDER_DEBUG::RenderDebugVertex *lines = getDebugVertex(6);
+ // first vertex (start of first segment, end of third)
+ lines[0].mPos[0] = lines[5].mPos[0] = v1.x;
+ lines[0].mPos[1] = lines[5].mPos[1] = v1.y;
+ lines[0].mPos[2] = lines[5].mPos[2] = v1.z;
+ lines[0].mColor = lines[5].mColor = c1;
+
+ // second vertex (end of first segment, start of second)
+ lines[1].mPos[0] = lines[2].mPos[0] = v2.x;
+ lines[1].mPos[1] = lines[2].mPos[1] = v2.y;
+ lines[1].mPos[2] = lines[2].mPos[2] = v2.z;
+ lines[1].mColor = lines[2].mColor = c2;
+
+ // third vertex (end of second segment, start of third)
+ lines[3].mPos[0] = lines[4].mPos[0] = v3.x;
+ lines[3].mPos[1] = lines[4].mPos[1] = v3.y;
+ lines[3].mPos[2] = lines[4].mPos[2] = v3.z;
+ lines[3].mColor = lines[4].mColor = c3;
+ }
+ }
+
+
+ PX_INLINE void debugBound(const physx::PxVec3 *box)
+ {
+ if ( mCurrentState.isSolid() )
+ {
+ debugTri(&box[2],&box[1],&box[0]);
+ debugTri(&box[3],&box[2],&box[0]);
+
+ debugTri(&box[7],&box[2],&box[3]);
+ debugTri(&box[7],&box[6],&box[2]);
+
+ debugTri(&box[5],&box[1],&box[2]);
+ debugTri(&box[5],&box[2],&box[6]);
+
+ debugTri(&box[5],&box[4],&box[1]);
+ debugTri(&box[4],&box[0],&box[1]);
+
+ debugTri(&box[4],&box[6],&box[7]);
+ debugTri(&box[4],&box[5],&box[6]);
+
+ debugTri(&box[4],&box[7],&box[0]);
+ debugTri(&box[7],&box[3],&box[0]);
+ }
+ else
+ {
+ debugLine(box[0], box[1]);
+ debugLine(box[1], box[2]);
+ debugLine(box[2], box[3]);
+ debugLine(box[3], box[0]);
+
+ debugLine(box[4], box[5]);
+ debugLine(box[5], box[6]);
+ debugLine(box[6], box[7]);
+ debugLine(box[7], box[4]);
+
+ debugLine(box[0], box[4]);
+ debugLine(box[1], box[5]);
+ debugLine(box[2], box[6]);
+ debugLine(box[3], box[7]);
+ }
+ }
+
+
+ PX_INLINE void debugRect2d(const DebugRect2d &d)
+ {
+ physx::PxVec3 points[4];
+ points[0] = physx::PxVec3(d.mX1,d.mY1,0.0f);
+ points[1] = physx::PxVec3(d.mX2,d.mY1,0.0f);
+ points[2] = physx::PxVec3(d.mX2,d.mY2,0.0f);
+ points[3] = physx::PxVec3(d.mX1,d.mY2,0.0f);
+ debugPolygon(4,points);
+ }
+
+ PX_INLINE void debugGradientLine(const DebugGradientLine &d)
+ {
+ debugLine(d.mP1,d.mP2,d.mC1,d.mC2);
+ }
+
+ PX_INLINE void debugRay(const DebugRay &d)
+ {
+ debugLine(d.mP1,d.mP2);
+ physx::PxVec3 dir = d.mP2 - d.mP1;
+ float mag = dir.normalize();
+ float arrowSize = mCurrentState.mArrowSize;
+ if ( arrowSize > (mag*0.2f ))
+ {
+ arrowSize = mag*0.2f;
+ }
+ physx::PxVec3 ref(0,1.0f,0);
+ physx::PxQuat quat;
+ rotationArc(ref,dir,quat);
+ physx::PxMat44 matrix(quat);
+ matrix.setPosition(d.mP2);
+
+ uint32_t pcount = 0;
+ physx::PxVec3 points[24];
+ physx::PxVec3 *dest = points;
+
+ for (float a=30; a<=360; a+=30)
+ {
+ float r = a*FM_DEG_TO_RAD;
+ float x = physx::PxCos(r)*arrowSize;
+ float y = physx::PxSin(r)*arrowSize;
+
+ dest->x = x;
+ dest->y = -3*arrowSize;
+ dest->z = y;
+ dest++;
+ pcount++;
+ }
+
+ physx::PxVec3 *prev = &points[(pcount-1)];
+ physx::PxVec3 *p = points;
+ physx::PxVec3 center(0, -2.5f*arrowSize, 0);
+ physx::PxVec3 top(0, 0, 0 );
+
+ physx::PxVec3 _center = matrix.transform(center);
+ physx::PxVec3 _top = matrix.transform(top);
+
+
+ uint32_t saveState = mCurrentState.mStates;
+
+ mCurrentState.setRenderState(RENDER_DEBUG::DebugRenderState::SolidWireShaded);
+ mCurrentState.mArrowColor = 0xFFFFFFFF;
+
+ for (uint32_t i=0; i<pcount; i++)
+ {
+ physx::PxVec3 _p = matrix.transform( *p );
+ physx::PxVec3 _prev = matrix.transform( *prev );
+
+ debugTri(&_p,&_center,&_prev);
+ debugTri(&_prev,&_top,&_p);
+
+ prev = p;
+ p++;
+ }
+ mCurrentState.mStates = saveState;
+
+ }
+
+ PX_INLINE void debugCylinder(const DebugCylinder &d)
+ {
+ const uint32_t numOfSegments = uint32_t(4 << physx::PxMin(d.mSubdivision, 6u)); // this maxes out at 4^6 = 256 segments
+ const float segmentAngle = physx::PxTwoPi / numOfSegments;
+ const float c = physx::PxCos(segmentAngle);
+ const float s = physx::PxSin(segmentAngle);
+ const physx::PxMat33 rotY(physx::PxVec3(c, 0,-s), physx::PxVec3(0, 1.0f, 0), physx::PxVec3(s, 0, c));
+
+ const float radiusDiff = d.mRadius1 - d.mRadius2;
+ physx::PxVec3 heightVec(radiusDiff / 2.0f, d.mHeight / 2.0f, 0.0f);
+
+ const float avgRadius = (d.mRadius1 + d.mRadius2) / 2.0f;
+ physx::PxVec3 currentVec(avgRadius, 0.0f, 0.0f);
+ physx::PxVec3 currentTangent(0.0f, 0.0f, 1.0f);
+ physx::PxVec3 currentNormal = heightVec.cross(currentTangent).getNormalized();
+
+ const physx::PxVec3 upperCenter(0.0f, d.mHeight / 2.0f, 0.0f);
+ const physx::PxVec3 lowerCenter(-upperCenter);
+
+
+ if (mCurrentState.isSolid())
+ {
+ for( uint32_t i=0; i<numOfSegments; ++i )
+ {
+ const physx::PxVec3 e0 = currentVec + heightVec;
+ const physx::PxVec3 e2 = currentVec - heightVec;
+ const physx::PxVec3 nC = currentNormal;
+
+ currentVec = rotY.transform(currentVec);
+ heightVec = rotY.transform(heightVec);
+ currentTangent = rotY.transform(currentTangent);
+ const physx::PxVec3 e1 = currentVec + heightVec;
+ const physx::PxVec3 e3 = currentVec - heightVec;
+ const physx::PxVec3 nN = currentNormal = heightVec.cross(currentTangent).getNormalized();
+
+ debugTri(&e0, &e2, &e3, &nC, &nC, &nN);
+ debugTri(&e3, &e1, &e0, &nN, &nN, &nC);
+
+ if (d.mCloseSides)
+ {
+ debugTri(&e0, &e1, &upperCenter);
+ debugTri(&e2, &lowerCenter, &e3);
+ }
+ else
+ {
+ debugTri(&e3, &e2, &e0, &nN, &nC, &nC);
+ debugTri(&e0, &e1, &e3, &nC, &nN, &nN);
+ }
+ }
+ }
+ else
+ {
+ for( uint32_t i=0; i<numOfSegments; ++i )
+ {
+ const physx::PxVec3 e0 = currentVec + heightVec;
+ const physx::PxVec3 e2 = currentVec - heightVec;
+
+ const physx::PxVec3 nextVec = rotY.transform(currentVec);
+ heightVec = rotY.transform(heightVec);
+ const physx::PxVec3 e1 = nextVec + heightVec;
+ const physx::PxVec3 e3 = nextVec - heightVec;
+
+ //const physx::PxVec3 nC = (-currentVec).getNormalized();
+
+ debugLine(e0, e2);
+ debugLine(e0, e1);
+ debugLine(e2, e3);
+
+ if (d.mCloseSides)
+ {
+ debugLine(upperCenter, e0);
+ debugLine(lowerCenter, e2);
+ }
+ currentVec = nextVec;
+ }
+ }
+ }
+
+ PX_INLINE void debugCircle(const DebugCircle &d)
+ {
+ const uint32_t numOfSegments = uint32_t(4 << physx::PxMin(d.mSubdivision, 6u)); // this maxes out at 4^6 = 256 segments
+ const float segmentAngle = physx::PxTwoPi / numOfSegments;
+ const float c = physx::PxCos(segmentAngle);
+ const float s = physx::PxSin(segmentAngle);
+
+ // rotation in ZX plane
+ const physx::PxMat33 rotY(physx::PxVec3(c, 0,-s), physx::PxVec3(0, 1.0f, 0), physx::PxVec3(s, 0, c));
+ physx::PxVec3 currentVec(d.mRadius, 0.0f, 0.0f);
+ if (d.mDrawSolidCircle)
+ {
+ physx::PxVec3* points = new physx::PxVec3[numOfSegments];
+ for( uint32_t i=0; i<numOfSegments; ++i, currentVec = rotY.transform(currentVec))
+ {
+ points[i] = d.mTransform.transform(currentVec);
+ }
+ debugPolygon(numOfSegments, points);
+ delete[] points;
+ }
+ else
+ {
+ for( uint32_t i=0; i<numOfSegments; ++i )
+ {
+ physx::PxVec3 p0 = currentVec;
+ physx::PxVec3 p1 = rotY.transform(currentVec);
+ currentVec = p1;
+
+ p0 = d.mTransform.transform(p0);
+ p1 = d.mTransform.transform(p1);
+ debugLine(p0, p1);
+ }
+ }
+ }
+
+ PX_INLINE void debugPolygon(uint32_t pcount,const physx::PxVec3 *points)
+ {
+ if ( mCurrentState.isSolid() )
+ {
+ PX_ASSERT( pcount >= 3 );
+ PX_ASSERT( pcount <= 256 );
+ bool wasOverlay = mCurrentState.hasRenderState(RENDER_DEBUG::DebugRenderState::SolidWireShaded);
+ if( wasOverlay )
+ {
+ mCurrentState.clearRenderState(RENDER_DEBUG::DebugRenderState::SolidWireShaded);
+ mCurrentState.incrementChangeCount();
+ }
+ const physx::PxVec3 *v1 = &points[0];
+ const physx::PxVec3 *v2 = &points[1];
+ const physx::PxVec3 *v3 = &points[2];
+ debugTri(v1, v2, v3, NULL, NULL, NULL, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, false);
+ for (uint32_t i=3; i<pcount; i++)
+ {
+ v2 = v3;
+ v3 = &points[i];
+ debugTri(v1, v2, v3, NULL, NULL, NULL, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, false);
+ }
+ if ( wasOverlay )
+ {
+ for (uint32_t i=0; i<(pcount-1); i++)
+ {
+ debugLine( points[i], points[i+1], mCurrentState.mArrowColor, mCurrentState.mArrowColor );
+ }
+ debugLine(points[pcount-1],points[0]);
+ mCurrentState.setRenderState(RENDER_DEBUG::DebugRenderState::SolidWireShaded);
+ mCurrentState.incrementChangeCount();
+ }
+ }
+ else
+ {
+ for (uint32_t i=0; i<(pcount-1); i++)
+ {
+ debugLine( points[i], points[i+1] );
+ }
+ debugLine(points[pcount-1],points[0]);
+ }
+ }
+
+ PX_INLINE void debugPointCylinder(const DebugPointCylinder &d)
+ {
+ physx::PxVec3 dir = d.mP2 - d.mP1;
+ dir.normalize();
+
+ physx::PxVec3 ref(0, 1.0f, 0);
+
+ physx::PxQuat quat;
+
+ rotationArc(ref,dir,quat);
+
+ physx::PxMat44 matrix1(quat);
+ physx::PxMat44 matrix2(quat);
+
+ matrix1.setPosition(d.mP2);
+ matrix2.setPosition(d.mP1);
+
+
+ uint32_t pcount = 0;
+ physx::PxVec3 points1[24];
+ physx::PxVec3 points2[24];
+
+ physx::PxVec3 *dest1 = points1;
+ physx::PxVec3 *dest2 = points2;
+
+
+ for (float a=30; a<=360; a+=30)
+ {
+ float r = a*FM_DEG_TO_RAD;
+ float x = physx::PxCos(r)*d.mRadius;
+ float y = physx::PxSin(r)*d.mRadius;
+
+ physx::PxVec3 p(x, 0, y);
+
+ (*dest1) = matrix1.transform(p);
+ (*dest2) = matrix2.transform(p);
+
+ dest1++;
+ dest2++;
+ pcount++;
+
+ }
+
+ PX_ASSERT( pcount < 24 );
+
+ if ( mCurrentState.isSolid() )
+ {
+
+ uint32_t saveState = mCurrentState.mStates;
+ mCurrentState.clearRenderState(RENDER_DEBUG::DebugRenderState::SolidWireShaded);
+ mCurrentState.setRenderState(RENDER_DEBUG::DebugRenderState::SolidShaded);
+ mCurrentState.clearRenderState(RENDER_DEBUG::DebugRenderState::CounterClockwise);
+
+ physx::PxVec3 *prev1 = &points1[(pcount-1)];
+ physx::PxVec3 *prev2 = &points2[(pcount-1)];
+
+ physx::PxVec3 *scan1 = points1;
+ physx::PxVec3 *scan2 = points2;
+
+ for (uint32_t i=0; i<pcount; i++)
+ {
+
+ debugTri(scan1,prev2,prev1);
+ debugTri(scan2,prev2,scan1);
+
+ prev1 = scan1;
+ prev2 = scan2;
+ scan1++;
+ scan2++;
+ }
+
+ debugPolygon(pcount,points2);
+ mCurrentState.setRenderState(RENDER_DEBUG::DebugRenderState::CounterClockwise);
+ debugPolygon(pcount,points1);
+
+ mCurrentState.mStates = saveState;
+
+ }
+
+ if ( !mCurrentState.hasRenderState(RENDER_DEBUG::DebugRenderState::SolidShaded) || mCurrentState.hasRenderState(RENDER_DEBUG::DebugRenderState::SolidWireShaded) )
+ {
+
+ uint32_t color = mCurrentState.hasRenderState(RENDER_DEBUG::DebugRenderState::SolidWireShaded) ? mCurrentState.mArrowColor : mCurrentState.mColor;
+ physx::PxVec3 *prev1 = &points1[(pcount-1)];
+ physx::PxVec3 *prev2 = &points2[(pcount-1)];
+
+ physx::PxVec3 *scan1 = points1;
+ physx::PxVec3 *scan2 = points2;
+ for (uint32_t i=0; i<pcount; i++)
+ {
+ debugLine(*scan1,*scan2,color,color);
+
+ debugLine(d.mP2,*scan1,color,color);
+ debugLine(d.mP1,*scan2,color,color);
+
+ debugLine(*prev1,*scan1,color,color);
+ debugLine(*prev2,*scan2,color,color);
+
+ prev1 = scan1;
+ prev2 = scan2;
+
+ scan1++;
+ scan2++;
+ }
+ }
+ }
+
+ PX_INLINE void debugThickRay(const DebugThickRay &d)
+ {
+ RenderState save = mCurrentState;
+
+ mCurrentState.clearRenderState(RENDER_DEBUG::DebugRenderState::SolidWireShaded);
+ mCurrentState.setRenderState(RENDER_DEBUG::DebugRenderState::SolidShaded);
+
+ physx::PxVec3 dir = d.mP2 - d.mP1;
+ float mag = dir.normalize();
+ float arrowSize = physx::PxMin(physx::PxMax(mCurrentState.mArrowSize, d.mRaySize * 1.3f), mag * 0.2f);
+
+ physx::PxVec3 ref(0,1.0f,0);
+ physx::PxQuat quat;
+
+ rotationArc(ref,dir,quat);
+
+ physx::PxMat44 matrix(quat);
+ matrix.setPosition(d.mP2);
+
+
+ uint32_t pcount = 0;
+ physx::PxVec3 points[24];
+ physx::PxVec3 *dest = points;
+
+ for (float a=30; a<=360; a+=30)
+ {
+ float r = a*FM_DEG_TO_RAD;
+ float x = physx::PxCos(r)*arrowSize;
+ float y = physx::PxSin(r)*arrowSize;
+
+ dest->x = x;
+ dest->y = -3*arrowSize;
+ dest->z = y;
+
+ dest++;
+ pcount++;
+ }
+
+ physx::PxVec3 *prev = &points[(pcount-1)];
+ physx::PxVec3 *p = points;
+ physx::PxVec3 center(0, -2.5f*arrowSize, 0);
+ physx::PxVec3 top(0,0,0);
+
+ physx::PxVec3 _center;
+ physx::PxVec3 _top;
+
+ _center = matrix.transform(center);
+ _top = matrix.transform(top);
+
+ DebugPointCylinder dc(d.mP1,_center,d.mRaySize);
+ debugPointCylinder(dc);
+
+ //mCurrentState = save; - don't want triangles to be seen !
+ mCurrentState.setRenderState(RENDER_DEBUG::DebugRenderState::SolidShaded);
+ mCurrentState.mColor = mCurrentState.mArrowColor;
+ mCurrentState.mArrowColor = mCurrentState.mOutlineColor;
+
+ if(d.mArrowTip)
+ {
+ for (uint32_t i=0; i<pcount; i++)
+ {
+
+ physx::PxVec3 _p;
+ physx::PxVec3 _prev;
+
+ _p = matrix.transform(*p);
+ _prev = matrix.transform(*prev);
+
+ debugTri(&_p,&_center,&_prev);
+ debugTri(&_prev,&_top,&_p);
+
+ prev = p;
+ p++;
+ }
+ }
+ else
+ {
+ DebugDetailedSphere sphere(_center, 0.1f * mag, 2);
+ debugDetailedSphere(sphere);
+ }
+
+ mCurrentState = save;
+ }
+
+ void debugPlane(const physx::PxVec3 &normal,float dCoff,float radius1,float radius2)
+ {
+ physx::PxVec3 ref(0,1.0f,0);
+ physx::PxQuat quat;
+ rotationArc(ref,normal,quat);
+ physx::PxMat44 matrix(quat);
+
+ float stepsize = 360/20;
+
+ physx::PxVec3 prev(0,0,0);
+
+ physx::PxVec3 origin(0,-dCoff,0);
+ physx::PxVec3 pos(origin), first(origin), center(origin);
+
+ center = matrix.transform(origin);
+ matrix.setPosition(center);
+
+ for (float d=0; d<360; d+=stepsize)
+ {
+ float a = degToRad(d);
+ physx::PxVec3 _pos(physx::PxCos(a)*radius1,0,physx::PxSin(a)*radius2);
+ pos = matrix.transform(_pos);
+
+ debugLine(center,pos);
+
+ if ( d == 0 )
+ {
+ first = pos;
+ }
+ else
+ {
+ debugLine(prev,pos);
+ }
+ prev = pos;
+ }
+
+ debugLine(first,pos);
+ }
+
+
+
+ PX_INLINE void debugPlane(const DebugPlane &d)
+ {
+ debugPlane(d.mNormal,d.mD,d.mRadius1*0.25f, d.mRadius2*0.25f);
+ debugPlane(d.mNormal,d.mD,d.mRadius1*0.5f, d.mRadius2*0.5f);
+ debugPlane(d.mNormal,d.mD,d.mRadius1*0.75f, d.mRadius2*0.75f);
+ debugPlane(d.mNormal,d.mD,d.mRadius1*1.0f, d.mRadius2*1.0f);
+ }
+
+ PX_INLINE void debugTriNormals(const DebugTriNormals &d)
+ {
+ debugTri(&d.mP1,&d.mP2,&d.mP3,&d.mN1,&d.mN2,&d.mN3);
+ }
+
+ PX_INLINE void debugGradientTriNormals(const DebugGradientTriNormals &d)
+ {
+ debugTri(&d.mP1,&d.mP2,&d.mP3,&d.mN1,&d.mN2,&d.mN3,d.mC1,d.mC2,d.mC3,true);
+ }
+
+ PX_INLINE void debugSphere(const DebugSquashedSphere &d)
+ {
+ for (uint32_t i = 0; i < 8; i++)
+ {
+ const physx::PxVec3 p0 = simpleSpherePosition[simpleSphereIndices[i*3+0]];
+ const physx::PxVec3 p1 = simpleSpherePosition[simpleSphereIndices[i*3+1]];
+ const physx::PxVec3 p2 = simpleSpherePosition[simpleSphereIndices[i*3+2]];
+ subdivideOnSphere(int(d.mSubdivision), p0, p1, p2, d.mRadius, 0.0f, 0.0f);
+ }
+ }
+
+
+ PX_INLINE void debugSphere(const DebugSphere &d)
+ {
+ for (uint32_t i = 0; i < 8; i++)
+ {
+ const physx::PxVec3 p0 = simpleSpherePosition[simpleSphereIndices[i*3+0]];
+ const physx::PxVec3 p1 = simpleSpherePosition[simpleSphereIndices[i*3+1]];
+ const physx::PxVec3 p2 = simpleSpherePosition[simpleSphereIndices[i*3+2]];
+ subdivideOnSphere(int(d.mSubdivision), p0, p1, p2, d.mRadius, 0.0f, 0.0f);
+ }
+ }
+
+ void subdivideOnSphere(int subdivision, const physx::PxVec3& p0, const physx::PxVec3& p1, const physx::PxVec3& p2, float radius, float height, float skew)
+ {
+ //physx::PxMat44 transform = physx::PxMat44(physx::PxIdentity);
+ if (subdivision <= 0)
+ {
+ physx::PxVec3 t[3];
+ physx::PxVec3 n[3] = { p0, p1, p2 };
+
+ if (height > 0.0f || skew != 0.0f)
+ {
+ const float upper = physx::PxSign(p0.y + p1.y + p2.y);
+
+ const physx::PxVec3 offset(0.0f, upper * height, 0.0f);
+ if (skew != 0.0f)
+ {
+ const float scale = upper - skew;
+ for (uint32_t i = 0; i < 3; i++)
+ {
+ const float ny = n[i].y;
+ //const float sny =((ny - 1.0f) * scale) + upper;
+ const float sny = upper > 0.0f ? (1.0f - (1.0f - ny) * scale) : (-1.0f + (1.0f + ny) * -scale);
+ PX_ASSERT(physx::PxAbs(sny) <= 1.0f);
+ n[i].y = 0.0f;
+ n[i].normalize();
+ n[i] *= physx::PxSqrt(1.0f - (sny * sny));
+ n[i].y = sny;
+ t[i] = n[i] * radius + offset;
+ }
+ }
+ else
+ {
+ t[0] = p0 * radius + offset;
+ t[1] = p1 * radius + offset;
+ t[2] = p2 * radius + offset;
+ }
+ }
+ else
+ {
+ t[0] = p0 * radius;
+ t[1] = p1 * radius;
+ t[2] = p2 * radius;
+ }
+
+ debugTri(t+0, t+1, t+2, n+0, n+1, n+2);
+ }
+ else
+ {
+ physx::PxVec3 p01 = p0 + p1; p01.normalize();
+ physx::PxVec3 p12 = p1 + p2; p12.normalize();
+ physx::PxVec3 p20 = p2 + p0; p20.normalize();
+
+ subdivideOnSphere(subdivision-1, p0, p01, p20, radius, height, skew);
+ subdivideOnSphere(subdivision-1, p1, p12, p01, radius, height, skew);
+ subdivideOnSphere(subdivision-1, p2, p20, p12, radius, height, skew);
+ subdivideOnSphere(subdivision-1, p01, p12, p20, radius, height, skew);
+ }
+ }
+
+
+ void subdivideOnSphere(int subdivision, const physx::PxVec3& p0, const physx::PxVec3& p1, const physx::PxVec3& p2, const physx::PxVec3 &radius, float height, float skew)
+ {
+ //physx::PxMat44 transform = physx::PxMat44(physx::PxIdentity);
+ if (subdivision <= 0)
+ {
+ physx::PxVec3 t[3];
+ physx::PxVec3 n[3] = { p0, p1, p2 };
+
+ if (height > 0.0f || skew != 0.0f)
+ {
+ const float upper = physx::PxSign(p0.y + p1.y + p2.y);
+
+ const physx::PxVec3 offset(0.0f, upper * height, 0.0f);
+ if (skew != 0.0f)
+ {
+ const float scale = upper - skew;
+ for (uint32_t i = 0; i < 3; i++)
+ {
+ const float ny = n[i].y;
+ //const float sny =((ny - 1.0f) * scale) + upper;
+ const float sny = upper > 0.0f ? (1.0f - (1.0f - ny) * scale) : (-1.0f + (1.0f + ny) * -scale);
+ PX_ASSERT(physx::PxAbs(sny) <= 1.0f);
+ n[i].y = 0.0f;
+ n[i].normalize();
+ n[i] *= physx::PxSqrt(1.0f - (sny * sny));
+ n[i].y = sny;
+ t[i] = n[i].multiply(radius) + offset;
+ }
+ }
+ else
+ {
+ t[0] = p0.multiply(radius) + offset;
+ t[1] = p1.multiply(radius) + offset;
+ t[2] = p2.multiply(radius) + offset;
+ }
+ }
+ else
+ {
+ t[0] = p0.multiply(radius);
+ t[1] = p1.multiply(radius);
+ t[2] = p2.multiply(radius);
+ }
+
+ debugTri(t+0, t+1, t+2, n+0, n+1, n+2);
+ }
+ else
+ {
+ physx::PxVec3 p01 = p0 + p1; p01.normalize();
+ physx::PxVec3 p12 = p1 + p2; p12.normalize();
+ physx::PxVec3 p20 = p2 + p0; p20.normalize();
+
+ subdivideOnSphere(subdivision-1, p0, p01, p20, radius, height, skew);
+ subdivideOnSphere(subdivision-1, p1, p12, p01, radius, height, skew);
+ subdivideOnSphere(subdivision-1, p2, p20, p12, radius, height, skew);
+ subdivideOnSphere(subdivision-1, p01, p12, p20, radius, height, skew);
+ }
+ }
+
+
+
+ PX_INLINE void debugCapsule(const DebugCapsule &d)
+ {
+ DebugCylinder c(d.mRadius,d.mHeight,d.mSubdivision,false);
+ debugCylinder(c);
+
+ const float height = d.mHeight * 0.5f;
+ for (uint32_t i = 0; i < 8; i++)
+ {
+ const physx::PxVec3 p0 = simpleSpherePosition[simpleSphereIndices[i*3+0]];
+ const physx::PxVec3 p1 = simpleSpherePosition[simpleSphereIndices[i*3+1]];
+ const physx::PxVec3 p2 = simpleSpherePosition[simpleSphereIndices[i*3+2]];
+ subdivideOnSphere(int(d.mSubdivision), p0, p1, p2, d.mRadius, height, 0.0f);
+ }
+ }
+
+ void debugCone(const DebugCone &d)
+ {
+ physx::PxVec3 prev;
+ physx::PxVec3 orig(0,0,0); // = xform.getPosition();
+
+ physx::PxVec3 center(0,d.mLength,0);
+
+ float s1 = tanf(d.mInnerAngle)*d.mLength;
+ float s2 = tanf(d.mOuterAngle)*d.mLength;
+
+ float stepSize = 360.0f / static_cast<float>(d.mSubdivision);
+
+ for (uint32_t i=0; i<=d.mSubdivision; i++)
+ {
+ float fv = static_cast<float>(i)*stepSize;
+ if ( i == d.mSubdivision )
+ {
+ fv = 0;
+ }
+ float r = fv*FM_DEG_TO_RAD;
+
+ float dx = s2*cosf(r);
+ float dy = s1*sinf(r);
+
+ physx::PxVec3 v(dx,d.mLength,dy);
+ if ( i != 0 )
+ {
+ debugTri(&orig,&prev,&v);
+ if ( d.mCloseEnd )
+ {
+ debugTri(&center,&v,&prev);
+ }
+ else
+ {
+ debugTri(&orig,&v,&prev);
+ }
+ }
+ prev = v;
+ }
+
+ }
+
+ void debugTaperedCapsule(const DebugTaperedCapsule& d)
+ {
+ physx::PxMat44* oldPose = mCurrentState.mPose;
+ physx::PxMat44 newPose = physx::PxMat44(physx::PxIdentity);
+
+ uint32_t subdivision = d.mSubdivision;
+
+ float radDiff = d.mRadius2 - d.mRadius1;
+ const float sinAlpha = radDiff / physx::PxSqrt(radDiff * radDiff + d.mHeight * d.mHeight);
+
+ float sphereSeparation = 0;
+ float skew = 0;
+ float radius[] = { d.mRadius1, d.mRadius2 };
+
+ const uint32_t oldColor = mCurrentState.mColor;
+
+ if (physx::PxAbs(sinAlpha) < 1.0f)
+ {
+ const float cosAlpha = physx::PxSqrt(1.0f - sinAlpha * sinAlpha);
+
+ const uint32_t minSubdivision = uint32_t(sinAlpha * sinAlpha * 4.0f) + 1;
+ const uint32_t maxSubdivision = 6;
+ subdivision = physx::PxMin(physx::PxMax(minSubdivision, d.mSubdivision), maxSubdivision);
+
+ const float heightOffset = sinAlpha * (d.mRadius1 + d.mRadius2) / 2.0f;
+ newPose.setPosition(newPose.getPosition() + physx::PxVec3(0.0f, heightOffset, 0.0f));
+ if (oldPose != NULL)
+ {
+ newPose = *oldPose * newPose;
+ }
+
+ // move the cylinder
+ mCurrentState.mPose = &newPose;
+
+ // shrink the cylinder
+ const float height = d.mHeight - physx::PxAbs(sinAlpha * (d.mRadius1 - d.mRadius2));
+
+ DebugCylinder c(d.mRadius1 * cosAlpha, d.mRadius2 * cosAlpha, height, subdivision, false);
+ debugCylinder(c);
+
+ // reset current pose
+ mCurrentState.mPose = oldPose;
+
+ sphereSeparation = d.mHeight * 0.5f;
+ skew = sinAlpha;
+ }
+ else
+ {
+ mCurrentState.mColor = 0x7f7fff; // light blue
+ radius[0] = radius[1] = physx::PxMax(d.mRadius1, d.mRadius2);
+ }
+
+
+ for (uint32_t i = 0; i < 8; i++)
+ {
+ physx::PxVec3 p[] =
+ {
+ simpleSpherePosition[simpleSphereIndices[i*3+0]],
+ simpleSpherePosition[simpleSphereIndices[i*3+1]],
+ simpleSpherePosition[simpleSphereIndices[i*3+2]]
+ };
+
+ subdivideOnSphere(int(subdivision), p[0], p[1], p[2], radius[i >> 2], sphereSeparation, skew);
+ }
+
+ mCurrentState.mColor = oldColor;
+ }
+
+ void quickSphere(const physx::PxVec3 &p,float radius,uint32_t color)
+ {
+ mCurrentState.mColor = color;
+ mCurrentState.mArrowColor = color;
+ mCurrentState.mStates = (mCurrentState.mStates & ~RENDER_DEBUG::DebugRenderState::SolidWireShaded) | RENDER_DEBUG::DebugRenderState::SolidShaded;
+ DebugDetailedSphere ds(p,radius,2);
+ debugDetailedSphere(ds);
+ mCurrentState.mStates = (mCurrentState.mStates & ~RENDER_DEBUG::DebugRenderState::SolidShaded) | RENDER_DEBUG::DebugRenderState::SolidWireShaded;
+ }
+
+ PX_INLINE void debugAxes(const DebugAxes &d)
+ {
+ physx::PxMat44 pose = d.mTransform;
+ float brightness = 1.0f - d.mBrightness;
+
+ uint32_t red = getColor(255, 0, 0, brightness);
+ uint32_t green = getColor( 0,255, 0, brightness);
+ uint32_t blue = getColor( 0, 0,255, brightness);
+ uint32_t yellow = getColor(255,255, 0, brightness);
+ uint32_t white = getColor(255, 255, 255, brightness);
+
+ uint32_t colorX = red, colorY = green, colorZ = blue;
+ if (d.mAxisSwitch & 4) //x
+ {
+ colorX = yellow;
+ }
+ if (d.mAxisSwitch & 2) //y
+ {
+ colorY = yellow;
+ }
+ if (d.mAxisSwitch & 1) //z
+ {
+ colorZ = yellow;
+ }
+
+ physx::PxVec3 px(d.mDistance,0,0);
+ physx::PxVec3 py(0,d.mDistance,0);
+ physx::PxVec3 pz(0,0,d.mDistance);
+
+ px = d.mTransform.transform(px);
+ py = d.mTransform.transform(py);
+ pz = d.mTransform.transform(pz);
+
+ physx::PxVec3 t = d.mTransform.getPosition();
+
+ RenderState save = mCurrentState;
+
+ mCurrentState.mArrowSize = d.mDistance*0.1f;
+ switch (d.mRenderMode)
+ {
+ case DebugAxesRenderMode::DEBUG_AXES_RENDER_SOLID:
+ {
+ quickSphere(t,d.mDistance*0.1f,yellow);
+ }
+ break;
+ case DebugAxesRenderMode::DEBUG_AXES_RENDER_LINES:
+ {
+ ;
+ }
+ break;
+ }
+ mCurrentState.mStates|=RENDER_DEBUG::DebugRenderState::CameraFacing;
+ mCurrentState.mStates|=RENDER_DEBUG::DebugRenderState::CenterText;
+ mCurrentState.mOutlineColor = white;
+
+ float axisSwitchScaleStart = 1.0f;
+ float axisSwitchScaleEnd = 1.0f;
+ switch (d.mRenderMode)
+ {
+ case DebugAxesRenderMode::DEBUG_AXES_RENDER_SOLID:
+ {
+ axisSwitchScaleStart = 1.0f;
+ axisSwitchScaleEnd = 4.0f;
+ }
+ break;
+ case DebugAxesRenderMode::DEBUG_AXES_RENDER_LINES:
+ {
+ axisSwitchScaleStart = 0.0f;
+ axisSwitchScaleEnd = 1.0f;
+ }
+ break;
+ }
+
+ if (d.mRenderMode == DebugAxesRenderMode::DEBUG_AXES_RENDER_LINES)
+ {
+ float triSizeFactor = 0.2f;
+ float circleSizeFactor = 0.1f;
+
+ physx::PxMat44 inverseViewMatrix = mViewMatrix.inverseRT();
+ mCurrentState.setRenderState(RENDER_DEBUG::DebugRenderState::DoubleSided);
+ mCurrentState.setRenderState(RENDER_DEBUG::DebugRenderState::SolidShaded);
+
+ DebugCircle circleCfg(0.0f, 10, true);
+ circleCfg.mTransform.column0 = inverseViewMatrix.column1;
+ circleCfg.mTransform.column1 = inverseViewMatrix.column2;
+ circleCfg.mTransform.column2 = inverseViewMatrix.column0;
+
+ physx::PxVec3 triNormal = physx::PxVec3(0,0,1);
+ {
+ mCurrentState.mColor = colorX;
+ mCurrentState.mArrowColor = colorX;
+ if (!d.mShowRotation)
+ {
+ physx::PxVec3 usedOrthoAxe = inverseViewMatrix.column2.getXYZ().cross(t - px);
+ usedOrthoAxe.normalize();
+ usedOrthoAxe *= d.mDistance;
+ physx::PxVec3 arrowVertices[] = {
+ px + (t - px) * triSizeFactor + usedOrthoAxe * triSizeFactor,
+ px,
+ px + (t - px) * triSizeFactor - usedOrthoAxe * triSizeFactor,
+ };
+ debugTri(arrowVertices+0, arrowVertices+1, arrowVertices+2, &triNormal, &triNormal, &triNormal, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, false);
+ debugLine(t, px + (t - px) * triSizeFactor);
+ }
+ else if (d.mShowRotation)
+ {
+ circleCfg.mRadius = ((t - px) * circleSizeFactor).magnitude();
+ circleCfg.mTransform.setPosition(px + (t - px) * circleSizeFactor);
+ debugCircle(circleCfg);
+ debugLine(t, px + (t - px) * circleSizeFactor);
+ }
+ if ( d.mShowXYZ )
+ {
+ mCurrentState.mTextScale = d.mDistance;
+ mCurrentState.mColor = white;
+ DebugText dt(px,physx::PxMat44(physx::PxIdentity),"X");
+ debugText(dt);
+ }
+ }
+
+ {
+ mCurrentState.mColor = colorY;
+ mCurrentState.mArrowColor = colorY;
+ if (!d.mShowRotation)
+ {
+ physx::PxVec3 usedOrthoAxe = inverseViewMatrix.column2.getXYZ().cross(t - py);
+ usedOrthoAxe.normalize();
+ usedOrthoAxe *= d.mDistance;
+ physx::PxVec3 arrowVertices[] = {
+ py + (t - py) * triSizeFactor + usedOrthoAxe * triSizeFactor,
+ py,
+ py + (t - py) * triSizeFactor - usedOrthoAxe * triSizeFactor,
+ };
+ debugTri(arrowVertices+0, arrowVertices+1, arrowVertices+2, &triNormal, &triNormal, &triNormal, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, false);
+ debugLine(t, py + (t - py) * triSizeFactor);
+ }
+ else if (d.mShowRotation)
+ {
+ circleCfg.mRadius = ((t - py) * circleSizeFactor).magnitude();
+ circleCfg.mTransform.setPosition(py + (t - py) * circleSizeFactor);
+ debugCircle(circleCfg);
+ debugLine(t, py + (t - py) * circleSizeFactor);
+ }
+ if ( d.mShowXYZ )
+ {
+ mCurrentState.mTextScale = d.mDistance;
+ mCurrentState.mColor = white;
+ DebugText dt(py,physx::PxMat44(physx::PxIdentity),"Y");
+ debugText(dt);
+ }
+ }
+
+ {
+ mCurrentState.mColor = colorZ;
+ mCurrentState.mArrowColor = colorZ;
+ if (!d.mShowRotation)
+ {
+ physx::PxVec3 usedOrthoAxe = inverseViewMatrix.column2.getXYZ().cross(t - pz);
+ usedOrthoAxe.normalize();
+ usedOrthoAxe *= d.mDistance;
+
+ physx::PxVec3 arrowVertices[] = {
+ pz + (t - pz) * triSizeFactor + usedOrthoAxe * triSizeFactor,
+ pz,
+ pz + (t - pz) * triSizeFactor - usedOrthoAxe * triSizeFactor,
+ };
+ debugTri(arrowVertices+0, arrowVertices+1, arrowVertices+2, &triNormal, &triNormal, &triNormal, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, false);
+ debugLine(t, pz + (t - pz) * triSizeFactor);
+ }
+ else if (d.mShowRotation)
+ {
+ circleCfg.mRadius = ((t - pz) * circleSizeFactor).magnitude();
+ circleCfg.mTransform.setPosition(pz + (t - pz) * circleSizeFactor);
+ debugCircle(circleCfg);
+ debugLine(t, pz + (t - pz) * circleSizeFactor);
+ }
+ if ( d.mShowXYZ )
+ {
+ mCurrentState.mTextScale = d.mDistance;
+ mCurrentState.mColor = white;
+ DebugText dt(pz,physx::PxMat44(physx::PxIdentity),"Z");
+ debugText(dt);
+ }
+ }
+ }
+ else if (d.mRenderMode == DebugAxesRenderMode::DEBUG_AXES_RENDER_SOLID)
+ {
+ {
+ mCurrentState.mColor = colorX;
+ mCurrentState.mArrowColor = colorX;
+
+ DebugThickRay dr(t, px, d.mDistance * 0.02f, !d.mShowRotation);
+ debugThickRay(dr);
+
+ if ( d.mShowXYZ )
+ {
+ mCurrentState.mTextScale = d.mDistance;
+ mCurrentState.mColor = white;
+ DebugText dt(px,physx::PxMat44(physx::PxIdentity),"X");
+ debugText(dt);
+ }
+ }
+
+ {
+ mCurrentState.mColor = colorY;
+ mCurrentState.mArrowColor = colorY;
+ DebugThickRay dr(t, py, d.mDistance*0.02f, !d.mShowRotation);
+ debugThickRay(dr);
+ if ( d.mShowXYZ )
+ {
+ mCurrentState.mTextScale = d.mDistance;
+ mCurrentState.mColor = white;
+ DebugText dt(py,physx::PxMat44(physx::PxIdentity),"Y");
+ debugText(dt);
+ }
+ }
+ {
+ mCurrentState.mColor = colorZ;
+ mCurrentState.mArrowColor = colorZ;
+ DebugThickRay dr(t, pz, d.mDistance * 0.02f, !d.mShowRotation);
+ debugThickRay(dr);
+ if ( d.mShowXYZ )
+ {
+ mCurrentState.mTextScale = d.mDistance;
+ mCurrentState.mColor = white;
+ DebugText dt(pz,physx::PxMat44(physx::PxIdentity),"Z");
+ debugText(dt);
+ }
+ }
+ }
+
+ if ( d.mAxisSwitch )
+ {
+ physx::PxVec3 p1, p2;
+ uint32_t brightYellow = getColor(255, 255, 0, 0.0f);
+ mCurrentState.mColor = brightYellow;
+
+ if (d.mAxisSwitch & 4) //x
+ {
+ p1 = physx::PxVec3(-1.0f * axisSwitchScaleStart, 0.0f, 0.0f);
+ p2 = physx::PxVec3(1.0f * axisSwitchScaleEnd, 0.0f, 0.0f);
+ p1 = pose.transform(p1);
+ p2 = pose.transform(p2);
+
+ debugLine(p1, p2);
+ }
+ if(d.mAxisSwitch & 2) //y
+ {
+ p1 = physx::PxVec3(0.0f, -1.0f * axisSwitchScaleStart, 0.0f);
+ p2 = physx::PxVec3(0.0f, 1.0f * axisSwitchScaleEnd, 0.0f);
+ p1 = pose.transform(p1);
+ p2 = pose.transform(p2);
+
+ debugLine(p1, p2);
+ }
+ if(d.mAxisSwitch & 1) //z
+ {
+ p1 = physx::PxVec3(0.0f, 0.0f, -1.0f * axisSwitchScaleStart);
+ p2 = physx::PxVec3(0.0f, 0.0f, 1.0f * axisSwitchScaleEnd);
+ p1 = pose.transform(p1);
+ p2 = pose.transform(p2);
+
+ debugLine(p1, p2);
+ }
+ }
+
+ mCurrentState = save;
+ }
+
+ PX_INLINE void debugArc(const DebugArc &d)
+ {
+ if ( d.mShowRoot )
+ {
+ debugLine(d.mCenter,d.mP1,0xFFFFFFFF,0xFFFFFFFF);
+ debugLine(d.mCenter,d.mP2,0xFFFFFFFF,0xFFFFFFFF);
+ }
+
+ physx::PxVec3 v1 = d.mP1-d.mCenter;
+ float d1 = v1.normalize();
+ physx::PxVec3 v2 = d.mP2-d.mCenter;
+ float d2 = v2.normalize();
+
+ physx::PxQuat quat;
+ rotationArc(v1,v2,quat);
+
+ physx::PxQuat q1 = physx::PxQuat(physx::PxIdentity);
+ physx::PxQuat q2 = quat;
+
+ physx::PxVec3 prev(0.0f);
+
+ int32_t count = 0;
+ for (float st=0; st<=(1.01f); st+=0.05f)
+ {
+ float dst = ((d2-d1)*st)+d1;
+ physx::PxQuat q;
+ q = slerp(st,q1,q2);
+ physx::PxMat44 m(q);
+ m.setPosition(d.mCenter);
+ physx::PxVec3 t = v1*dst;
+ t = m.transform(t);
+ if ( st != 0 )
+ {
+ if ( count == 20 )
+ {
+ DebugRay dr(prev,t);
+ debugRay(dr);
+ }
+ else
+ debugLine(prev,t);
+ }
+ prev = t;
+ count++;
+ }
+
+ }
+
+ PX_INLINE void debugThickArc(const DebugThickArc &d)
+ {
+ if ( d.mShowRoot )
+ {
+ debugLine(d.mCenter,d.mP1,0xFFFFFFFF,0xFFFFFFFF);
+ debugLine(d.mCenter,d.mP2,0xFFFFFFFF,0xFFFFFFFF);
+ }
+
+ physx::PxVec3 v1 = d.mP1-d.mCenter;
+ float d1 = v1.normalize();
+ physx::PxVec3 v2 = d.mP2-d.mCenter;
+ float d2 = v2.normalize();
+
+ physx::PxQuat quat;
+ rotationArc(v1,v2,quat);
+
+ physx::PxQuat q1 = physx::PxQuat(physx::PxIdentity);
+ physx::PxQuat q2 = quat;
+
+ physx::PxVec3 prev(0.0f);
+
+ int32_t count = 0;
+
+ for (float st=0; st<=(1.01f); st+=0.05f)
+ {
+ float dst = ((d2-d1)*st)+d1;
+ physx::PxQuat q;
+ q = slerp(st,q1,q2);
+ physx::PxMat44 m(q);
+ m.setPosition(d.mCenter);
+ physx::PxVec3 t = v1*dst;
+ t = m.transform(t);
+ if ( st != 0 )
+ {
+#if 0
+ if ( count == 20 )
+ {
+ float asave = mCurrentState.mArrowSize;
+ mCurrentState.mArrowSize = d.mThickness*4;
+ DebugThickRay dr(prev,t,d.mThickness);
+ debugThickRay(dr);
+ mCurrentState.mArrowSize = asave;
+ }
+ else
+#endif
+ {
+ uint32_t save = mCurrentState.mStates;
+
+ mCurrentState.clearRenderState(RENDER_DEBUG::DebugRenderState::SolidWireShaded);
+ mCurrentState.setRenderState(RENDER_DEBUG::DebugRenderState::SolidShaded);
+
+ DebugPointCylinder dc(prev,t,d.mThickness);
+ debugPointCylinder(dc);
+
+ mCurrentState.mStates = save;
+ }
+ }
+ prev = t;
+ count++;
+ }
+ }
+
+ void debugFrustumPlane(const physx::PxVec4 &_p1,const physx::PxVec4 &_p2,const physx::PxVec4 &_p3,const physx::PxVec4 &_p4,uint32_t color)
+ {
+ physx::PxVec3 p1(_p1.x,_p1.y,_p1.z);
+ physx::PxVec3 p2(_p2.x,_p2.y,_p2.z);
+ physx::PxVec3 p3(_p3.x,_p3.y,_p3.z);
+ physx::PxVec3 p4(_p4.x,_p4.y,_p4.z);
+
+ uint32_t save = mCurrentState.mStates;
+ uint32_t saveColor = mCurrentState.mColor;
+ mCurrentState.mColor = color;
+
+// mCurrentState.clearRenderState(RENDER_DEBUG::DebugRenderState::SolidWireShaded);
+// mCurrentState.setRenderState(RENDER_DEBUG::DebugRenderState::SolidShaded);
+
+ DebugTri t1(p1,p2,p3);
+ DebugTri t2(p1,p3,p4);
+
+ debugTri(&p1,&p2,&p3);
+ debugTri(&p1,&p3,&p4);
+
+ debugTri(&p3,&p2,&p1);
+ debugTri(&p4,&p3,&p1);
+
+ debugLine(p1,p2,0xFFFFFF,0xFFFFFF);
+ debugLine(p2,p3,0xFFFFFF,0xFFFFFF);
+ debugLine(p3,p4,0xFFFFFF,0xFFFFFF);
+ debugLine(p4,p1,0xFFFFFF,0xFFFFFF);
+
+ mCurrentState.mStates = save;
+ mCurrentState.mColor = saveColor;
+
+ }
+
+ PX_INLINE void debugFrustum(const physx::PxMat44 &iview,const physx::PxMat44 &proj)
+ {
+ // actually debug it here!
+ physx::PxMat44 viewProj = proj*iview;
+ physx::PxMat44 iviewProj = invert(viewProj);
+
+ physx::PxMat44 view = invert(iview);
+ DebugAxes d(view,0.3f,1.0f,false,false,4, DebugAxesRenderMode::DEBUG_AXES_RENDER_SOLID);
+ debugAxes(d); // debug visualize the view matrix
+
+ physx::PxVec4 v[8];
+
+
+ v[0] = physx::PxVec4(-1.0f,-1.0f,0,1.0f);
+ v[1] = physx::PxVec4(1.0f,-1.0f,0,1.0f);
+ v[2] = physx::PxVec4(1.0f,1.0f,0,1.0f);
+ v[3] = physx::PxVec4(-1.0f,1.0f,0,1.0f);
+
+ v[4] = physx::PxVec4(-1.0f,-1.0f,0.99999f,1.0f);
+ v[5] = physx::PxVec4(1.0f,-1.0f,0.99999f,1.0f);
+ v[6] = physx::PxVec4(1.0f,1.0f,0.99999f,1.0f);
+ v[7] = physx::PxVec4(-1.0f,1.0f,0.99999f,1.0f);
+
+
+
+ for (uint32_t i=0; i<8; i++)
+ {
+ v[i] = iviewProj.transform(v[i]);
+ v[i]*=1.0f/v[i].w; // unproject the point.
+ }
+
+ debugFrustumPlane(v[0],v[1],v[2],v[3],0xFF0000);
+ debugFrustumPlane(v[4],v[5],v[6],v[7],0xFF0000);
+
+ debugFrustumPlane(v[0],v[3],v[7],v[4],0x00FF00);
+ debugFrustumPlane(v[1],v[2],v[6],v[5],0x00FF00);
+
+ debugFrustumPlane(v[1],v[0],v[4],v[5],0x0000FF);
+ debugFrustumPlane(v[2],v[3],v[7],v[6],0x0000FF);
+
+
+ }
+
+ PX_INLINE void debugDetailedSphere(const DebugDetailedSphere &d)
+ {
+ physx::PxMat44* save = mCurrentState.mPose;
+ //physx::PxVec3 origTranslation = save != NULL ? save->getPosition() : physx::PxVec3(0.0f);
+ physx::PxMat44 myPose = physx::PxMat44(physx::PxIdentity);
+ myPose.setPosition(d.mPos);
+ if (save != NULL)
+ {
+ myPose = *save * myPose;
+ }
+ mCurrentState.mPose = &myPose;
+
+ DebugSphere d2(d.mRadius, d.mStepCount);
+ debugSphere(d2);
+
+ mCurrentState.mPose = save;
+ }
+
+ void skipString(physx::PsMemoryBuffer &mb)
+ {
+ char c;
+ uint32_t r = mb.read(&c,1);
+ while ( r && c )
+ {
+ r = mb.read(&c,1);
+ }
+ }
+
+ void debugCreateTriangleMesh(const DebugCreateTriangleMesh &dgs,RENDER_DEBUG::RenderDebugInterface *iface)
+ {
+ const void *data = static_cast<const void *>(&dgs);
+ physx::PsMemoryBuffer mb(data,dgs.mSize);
+ mb.setEndianMode(physx::PxFileBuf::ENDIAN_NONE);
+ nvidia::StreamIO stream(mb,dgs.mSize);
+ uint32_t cmd,size;
+ stream >> cmd;
+ stream >> size;
+ PX_ASSERT(cmd==DebugCommand::DEBUG_CREATE_TRIANGLE_MESH);
+ PX_ASSERT(size==dgs.mSize);
+ uint32_t vcount=0;
+ uint32_t tcount=0;
+ uint32_t meshId=0;
+ stream >> meshId;
+ stream >> vcount;
+ stream >> tcount;
+ const uint8_t *scan = mb.getReadLoc();
+ const RENDER_DEBUG::RenderDebugMeshVertex *vertices = reinterpret_cast<const RENDER_DEBUG::RenderDebugMeshVertex *>(scan);
+ const uint32_t *indices = NULL;
+ if ( tcount )
+ {
+ scan+=(vcount*sizeof(RENDER_DEBUG::RenderDebugMeshVertex));
+ indices = reinterpret_cast<const uint32_t *>(scan);
+ }
+ if ( iface )
+ {
+ iface->createTriangleMesh(meshId,vcount,vertices,tcount,indices);
+ }
+ }
+
+ void debugRefreshTriangleMeshVertices(const DebugRefreshTriangleMeshVertices &dgs,RENDER_DEBUG::RenderDebugInterface *iface)
+ {
+ const void *data = static_cast<const void *>(&dgs);
+ physx::PsMemoryBuffer mb(data,dgs.mSize);
+ mb.setEndianMode(physx::PxFileBuf::ENDIAN_NONE);
+ nvidia::StreamIO stream(mb,dgs.mSize);
+ uint32_t cmd,size;
+ stream >> cmd;
+ stream >> size;
+ PX_ASSERT(cmd==DebugCommand::DEBUG_REFRESH_TRIANGLE_MESH_VERTICES);
+ PX_ASSERT(size==dgs.mSize);
+ uint32_t vcount=0;
+ uint32_t meshId=0;
+ stream >> meshId;
+ stream >> vcount;
+ const uint8_t *scan = mb.getReadLoc();
+ const RENDER_DEBUG::RenderDebugMeshVertex *vertices = reinterpret_cast<const RENDER_DEBUG::RenderDebugMeshVertex *>(scan);
+ const uint32_t *indices = NULL;
+ scan+=(vcount*sizeof(RENDER_DEBUG::RenderDebugMeshVertex));
+ indices = reinterpret_cast<const uint32_t *>(scan);
+ if ( iface )
+ {
+ iface->refreshTriangleMeshVertices(meshId,vcount,vertices,indices);
+ }
+ }
+
+
+ void debugRenderTriangleMeshInstances(const DebugRenderTriangleMeshInstances &dgs,RENDER_DEBUG::RenderDebugInterface *iface)
+ {
+ const void *data = static_cast<const void *>(&dgs);
+ physx::PsMemoryBuffer mb(data,dgs.mSize);
+ mb.setEndianMode(physx::PxFileBuf::ENDIAN_NONE);
+ nvidia::StreamIO stream(mb,dgs.mSize);
+ uint32_t cmd,size;
+ stream >> cmd;
+ stream >> size;
+ PX_ASSERT(cmd==DebugCommand::DEBUG_RENDER_TRIANGLE_MESH_INSTANCES);
+ PX_ASSERT(size==dgs.mSize);
+ uint32_t instanceCount=0;
+ uint32_t meshId=0;
+ stream >> meshId;
+ stream >> instanceCount;
+ if ( instanceCount && iface )
+ {
+ const uint8_t *scan = mb.getReadLoc();
+ const RENDER_DEBUG::RenderDebugInstance *instances = reinterpret_cast<const RENDER_DEBUG::RenderDebugInstance *>(scan);
+ iface->renderTriangleMeshInstances(meshId,mCurrentState.mTexture1,mCurrentState.mTileRate1,mCurrentState.mTexture2,mCurrentState.mTileRate2,instanceCount,instances);
+ }
+ }
+
+ void debugConvexHull(const DebugConvexHull &dgs)
+ {
+ const void *data = static_cast<const void *>(&dgs);
+ physx::PsMemoryBuffer mb(data,dgs.mSize);
+ mb.setEndianMode(physx::PxFileBuf::ENDIAN_NONE);
+ nvidia::StreamIO stream(mb,dgs.mSize);
+ uint32_t cmd,size;
+ stream >> cmd;
+ stream >> size;
+ PX_ASSERT(cmd==DebugCommand::DEBUG_CONVEX_HULL);
+ PX_ASSERT(size==dgs.mSize);
+ uint32_t planeCount=0;
+ stream >> planeCount;
+ if ( planeCount )
+ {
+ const uint8_t *scan = mb.getReadLoc();
+ const float *planes = reinterpret_cast<const float *>(scan);
+
+ Hull2MeshEdges *h = createHull2MeshEdges();
+ if ( !mCurrentState.hasRenderState(RENDER_DEBUG::DebugRenderState::SolidShaded))
+ {
+ uint32_t edgeCount;
+ const HullEdge *edges = h->getHullEdges(planeCount, reinterpret_cast<const physx::PxPlane *>(planes), edgeCount);
+ if ( edges )
+ {
+ uint32_t saveColor = mCurrentState.mColor;
+ mCurrentState.mColor = mCurrentState.mArrowColor;
+ for (uint32_t i=0; i<edgeCount; i++)
+ {
+ const HullEdge &e = edges[i];
+ debugLine(e.e0,e.e1);
+ }
+ mCurrentState.mColor = saveColor;
+ }
+ }
+ if ( mCurrentState.hasRenderState(RENDER_DEBUG::DebugRenderState::SolidShaded) || mCurrentState.hasRenderState(RENDER_DEBUG::DebugRenderState::SolidWireShaded) )
+ {
+ HullMesh m;
+ if ( h->getHullMesh(planeCount, reinterpret_cast<const physx::PxPlane *>(planes), m) )
+ {
+ uint32_t saveState = mCurrentState.mStates;
+ mCurrentState.mStates&=~RENDER_DEBUG::DebugRenderState::SolidWireShaded;
+ mCurrentState.mStates|=RENDER_DEBUG::DebugRenderState::SolidShaded;
+ for (uint32_t i=0; i<m.mTriCount; i++)
+ {
+ uint16_t i1 = m.mIndices[i*3+0];
+ uint16_t i2 = m.mIndices[i*3+1];
+ uint16_t i3 = m.mIndices[i*3+2];
+ const physx::PxVec3 &p1 = m.mVertices[i1];
+ const physx::PxVec3 &p2 = m.mVertices[i2];
+ const physx::PxVec3 &p3 = m.mVertices[i3];
+ debugTri(&p1,&p2,&p3);
+ }
+ mCurrentState.mStates = saveState;
+ }
+ }
+ h->release();
+ }
+
+ }
+
+ void debugRenderPoints(const DebugRenderPoints &dgs,RENDER_DEBUG::RenderDebugInterface *iface)
+ {
+ const void *data = static_cast<const void *>(&dgs);
+ physx::PsMemoryBuffer mb(data,dgs.mSize);
+ mb.setEndianMode(physx::PxFileBuf::ENDIAN_NONE);
+ nvidia::StreamIO stream(mb,dgs.mSize);
+ uint32_t cmd,size;
+ stream >> cmd;
+ stream >> size;
+ PX_ASSERT(cmd==DebugCommand::DEBUG_RENDER_POINTS);
+ PX_ASSERT(size==dgs.mSize);
+ uint32_t pointCount=0;
+ uint32_t meshId=0;
+ uint32_t mode=0;
+ uint32_t textureId1;
+ float textureTile1;
+ uint32_t textureId2;
+ float textureTile2;
+ stream >> meshId;
+ stream >> mode;
+ stream >> textureId1;
+ stream >> textureTile1;
+ stream >> textureId2;
+ stream >> textureTile2;
+ stream >> pointCount;
+ if ( pointCount && iface )
+ {
+ const uint8_t *scan = mb.getReadLoc();
+ const float *points = reinterpret_cast<const float *>(scan);
+ iface->debugPoints(static_cast<RENDER_DEBUG::PointRenderMode>(mode),meshId,mCurrentState.mArrowColor,mCurrentState.mArrowSize,textureId1,textureTile1,textureId2,textureTile2,pointCount,points);
+ }
+ }
+
+ void debugRenderTriangles(const DebugRenderTriangles &dgs,RENDER_DEBUG::RenderDebugInterface *iface)
+ {
+ const void *data = static_cast<const void *>(&dgs);
+ physx::PsMemoryBuffer mb(data,dgs.mSize);
+ mb.setEndianMode(physx::PxFileBuf::ENDIAN_NONE);
+ nvidia::StreamIO stream(mb,dgs.mSize);
+ uint32_t cmd,size;
+ stream >> cmd;
+ stream >> size;
+ PX_ASSERT(cmd==DebugCommand::DEBUG_RENDER_TRIANGLES);
+ PX_ASSERT(size==dgs.mSize);
+ uint32_t tcount;
+ uint32_t useZ;
+ uint32_t isScreenSpace;
+ stream >> tcount;
+ stream >> useZ;
+ stream >> isScreenSpace;
+ if ( tcount && iface )
+ {
+ const uint8_t *scan = mb.getReadLoc();
+ const RenderDebugSolidVertex *points = reinterpret_cast<const RenderDebugSolidVertex *>(scan);
+ iface->debugRenderTriangles(tcount,points,useZ ? true : false,isScreenSpace ? true : false);
+ }
+ }
+
+ void debugRenderLines(const DebugRenderLines &dgs,RENDER_DEBUG::RenderDebugInterface *iface)
+ {
+ const void *data = static_cast<const void *>(&dgs);
+ physx::PsMemoryBuffer mb(data,dgs.mSize);
+ mb.setEndianMode(physx::PxFileBuf::ENDIAN_NONE);
+ nvidia::StreamIO stream(mb,dgs.mSize);
+ uint32_t cmd,size;
+ stream >> cmd;
+ stream >> size;
+ PX_ASSERT(cmd==DebugCommand::DEBUG_RENDER_LINES);
+ PX_ASSERT(size==dgs.mSize);
+ uint32_t lcount;
+ uint32_t useZ;
+ uint32_t isScreenSpace;
+ stream >> lcount;
+ stream >> useZ;
+ stream >> isScreenSpace;
+ if ( lcount && iface )
+ {
+ const uint8_t *scan = mb.getReadLoc();
+ const RenderDebugVertex *lines = reinterpret_cast<const RenderDebugVertex *>(scan);
+ iface->debugRenderLines(lcount,lines,useZ ? true : false, isScreenSpace ? true : false );
+ }
+ }
+
+
+
+ void debugGraph(const DebugGraphStream &dgs)
+ {
+ const void *data = static_cast<const void *>(&dgs);
+ physx::PsMemoryBuffer mb(data,dgs.mSize);
+ mb.setEndianMode(physx::PxFileBuf::ENDIAN_NONE);
+ nvidia::StreamIO stream(mb,dgs.mSize);
+ uint32_t cmd,size;
+ stream >> cmd;
+ stream >> size;
+ PX_ASSERT(cmd==DebugCommand::DEBUG_GRAPH);
+ PX_ASSERT(size==dgs.mSize);
+
+ DebugGraphDesc d;
+
+ stream >> d.mNumPoints;
+ d.mGraphXLabel = reinterpret_cast<const char *>(mb.getReadLoc());
+ skipString(mb);
+ d.mGraphYLabel = reinterpret_cast<const char *>(mb.getReadLoc());
+ skipString(mb);
+
+ mb.alignRead(4);
+
+ d.mPoints = reinterpret_cast<const float *>(mb.getReadLoc());
+ mb.advanceReadLoc(sizeof(uint32_t)*d.mNumPoints);
+ stream >> d.mCutOffLevel;
+ stream >> d.mGraphMax;
+ stream >> d.mGraphXPos;
+ stream >> d.mGraphYPos;
+ stream >> d.mGraphWidth;
+ stream >> d.mGraphHeight;
+ stream >> d.mGraphColor;
+ stream >> d.mArrowColor;
+ stream >> d.mColorSwitchIndex;
+ debugGraph(d);
+ }
+
+ void debugGraph(const DebugGraphDesc& graphDesc)
+ {
+ // todo where should colors go???
+ const uint32_t black = getColor(0, 0, 0);
+ const uint32_t blue = getColor(0, 0, 255);
+ const uint32_t green = getColor(0, 255, 0);
+
+ RenderState saveState = mCurrentState;
+
+ mCurrentState.setRenderState(RENDER_DEBUG::DebugRenderState::ScreenSpace);
+ mCurrentState.setRenderState(RENDER_DEBUG::DebugRenderState::NoZbuffer);
+ mCurrentState.clearRenderState(RENDER_DEBUG::DebugRenderState::SolidShaded);
+
+ mCurrentState.mTextScale = 0.1f;
+ float textHeight = 0.04f; //in screen space -- would be nice to know this!
+
+ if(graphDesc.mCutOffLevel != 0.0f)
+ {
+ mCurrentState.setCurrentColor(blue, black);
+ debugLine(
+ physx::PxVec3(graphDesc.mGraphXPos, graphDesc.mGraphYPos + graphDesc.mCutOffLevel, 0.0f),
+ physx::PxVec3(graphDesc.mGraphXPos + graphDesc.mGraphWidth, graphDesc.mGraphYPos + graphDesc.mCutOffLevel, 0.0f));
+ }
+
+ mCurrentState.setCurrentColor(graphDesc.mGraphColor, graphDesc.mArrowColor); //set the draw colors
+ if( strlen(graphDesc.mGraphXLabel) > 0 )
+ {
+ DebugText txt( physx::PxVec3(graphDesc.mGraphXPos, graphDesc.mGraphYPos - textHeight,0),physx::PxMat44(physx::PxIdentity),graphDesc.mGraphXLabel);
+ debugText(txt);
+ }
+ if( graphDesc.mGraphYLabel[0] )
+ {
+ DebugText txt(physx::PxVec3(graphDesc.mGraphXPos, graphDesc.mGraphYPos + graphDesc.mGraphHeight, 0), physx::PxMat44(physx::PxIdentity), graphDesc.mGraphYLabel);
+ debugText(txt);
+ }
+
+ float lastX = graphDesc.mGraphXPos;
+ float lastY = graphDesc.mGraphYPos;
+ for (uint32_t i = 0; i < graphDesc.mNumPoints; i++)
+ {
+ float pointY = graphDesc.mPoints[i];
+ pointY = graphDesc.mGraphYPos + pointY * graphDesc.mGraphHeight / graphDesc.mGraphMax; //scale to screen
+ float x = graphDesc.mGraphXPos + graphDesc.mGraphWidth * i / graphDesc.mNumPoints;
+
+ if (graphDesc.mColorSwitchIndex == i)
+ mCurrentState.setCurrentColor( graphDesc.mArrowColor,
+ graphDesc.mGraphColor); //swap the colors
+
+ debugLine(physx::PxVec3(lastX,lastY,0), physx::PxVec3(x,pointY,0));
+ lastY = pointY;
+ lastX = x;
+ }
+
+ //graph axes
+ mCurrentState.setCurrentColor(green, green);
+ //screen space test line
+ debugLine( physx::PxVec3(graphDesc.mGraphXPos, graphDesc.mGraphYPos,0),
+ physx::PxVec3(graphDesc.mGraphXPos, graphDesc.mGraphYPos + graphDesc.mGraphHeight,0));
+ debugLine( physx::PxVec3(graphDesc.mGraphXPos, graphDesc.mGraphYPos,0),
+ physx::PxVec3(graphDesc.mGraphXPos + graphDesc.mGraphWidth, graphDesc.mGraphYPos,0));
+
+ mCurrentState = saveState;
+ }
+
+
+ virtual void setViewMatrix(const physx::PxMat44 &view)
+ {
+ mViewMatrix = view;
+ }
+
+ virtual void finalizeFrame(void)
+ {
+
+ }
+
+private:
+
+uint32_t mLineVertexCount;
+uint32_t mMaxLineVertexCount;
+RENDER_DEBUG::RenderDebugVertex *mLines;
+
+uint32_t mSolidVertexCount;
+uint32_t mMaxSolidVertexCount;
+RENDER_DEBUG::RenderDebugSolidVertex *mTriangles;
+
+RENDER_DEBUG::RenderDebugInterface *mInterface;
+DisplayType mDisplayType;
+RenderState mCurrentState;
+MyVectorFont mVectorFont;
+physx::PxMat44 mViewMatrix;
+
+};
+
+//
+
+ProcessRenderDebug * createProcessRenderDebug(void)
+{
+ ProcessRenderDebugImpl *m = PX_NEW(ProcessRenderDebugImpl);
+ return static_cast< ProcessRenderDebug *>(m);
+}
+
+
+} // end of namespace
diff --git a/APEX_1.4/shared/general/RenderDebug/src/PsCommLayer.cpp b/APEX_1.4/shared/general/RenderDebug/src/PsCommLayer.cpp
new file mode 100644
index 00000000..c82f17a7
--- /dev/null
+++ b/APEX_1.4/shared/general/RenderDebug/src/PsCommLayer.cpp
@@ -0,0 +1,567 @@
+#include "PsCommLayer.h"
+
+#include "PsArray.h"
+#include "PsUserAllocated.h"
+#include "PsSocket.h"
+#include "PsThread.h"
+#include "PsAtomic.h"
+#include "PsMutex.h"
+#include "PxIntrinsics.h"
+
+namespace COMM_LAYER
+{
+
+// a simple hashing function
+static uint32_t simpleHash(const void *data,uint32_t dlen)
+{
+ uint32_t h = 5381;
+ const uint8_t *string = static_cast<const uint8_t *>(data);
+ for(const uint8_t *ptr = string; dlen; ptr++)
+ {
+ h = ((h<<5)+h)^(uint32_t(*ptr));
+ dlen--;
+ }
+ return h;
+}
+
+
+static PX_INLINE void swap4Bytes(void* _data)
+{
+ char *data = static_cast<char *>(_data);
+ char one_byte;
+ one_byte = data[0]; data[0] = data[3]; data[3] = one_byte;
+ one_byte = data[1]; data[1] = data[2]; data[2] = one_byte;
+}
+
+static PX_INLINE bool isBigEndian()
+{
+ int32_t i = 1;
+ return *(reinterpret_cast<char*>(&i))==0;
+}
+
+// This is a little helper class that contains the packets waiting to be sent.
+class CommPacket
+{
+public:
+ CommPacket(void)
+ {
+ if ( isBigEndian() )
+ {
+ mHeader[0] = 'B';
+ mBigEndianPacket = true;
+ }
+ else
+ {
+ mHeader[0] = 'C';
+ mBigEndianPacket = false;
+ }
+ mHeader[1] = 'P';
+ mHeader[2] = 'A';
+ mHeader[3] = 'C';
+ mHeader[4] = 'K';
+ mHeader[5] = 'E';
+ mHeader[6] = 'T';
+ mHeader[7] = 0;
+
+ mLength = 0;
+ mHash = 0;
+ mData = NULL;
+ }
+
+ void computeHash(void)
+ {
+ mHash = simpleHash(mHeader,sizeof(mHeader)+sizeof(mLength)); // compute the hash of the header + the hash of the length
+ }
+
+ bool isHeaderPacket(void)
+ {
+ bool ret = false;
+
+ if ( mHeader[0] == 'C' &&
+ mHeader[1] == 'P' &&
+ mHeader[2] == 'A' &&
+ mHeader[3] == 'C' &&
+ mHeader[4] == 'K' &&
+ mHeader[5] == 'E' &&
+ mHeader[6] == 'T' &&
+ mHeader[7] == 0 )
+ {
+ uint32_t hash = simpleHash(mHeader,sizeof(mHeader)+sizeof(mLength)); // compute the hash of the header + the hash of the length
+ uint32_t bhash = mHash;
+ if ( isBigEndian() )
+ {
+ swap4Bytes(&bhash);
+ }
+ if ( hash == bhash )
+ {
+ mBigEndianPacket = false;
+ ret = true;
+ }
+ }
+ else if ( mHeader[0] == 'B' &&
+ mHeader[1] == 'P' &&
+ mHeader[2] == 'A' &&
+ mHeader[3] == 'C' &&
+ mHeader[4] == 'K' &&
+ mHeader[5] == 'E' &&
+ mHeader[6] == 'T' &&
+ mHeader[7] == 0 )
+ {
+ uint32_t hash = simpleHash(mHeader,sizeof(mHeader)+sizeof(mLength)); // compute the hash of the header + the hash of the length
+ uint32_t bhash = mHash;
+ if ( !isBigEndian() )
+ {
+ swap4Bytes(&bhash);
+ }
+ if ( hash == bhash )
+ {
+ mBigEndianPacket = true;
+ ret = true;
+ }
+ }
+
+ return ret;
+ }
+
+ uint32_t getSize(void) const
+ {
+ return sizeof(mHeader)+sizeof(mLength)+sizeof(mHash);
+ }
+
+ uint32_t getLength(void) const
+ {
+ uint32_t l = mLength;
+ if ( isBigEndian() )
+ {
+ swap4Bytes(&l);
+ }
+ return l;
+ }
+
+ void setLength(uint32_t l)
+ {
+ mLength = l;
+ if ( isBigEndian() )
+ {
+ swap4Bytes(&mLength);
+ }
+ }
+
+ bool isBigEndianPacket(void) const
+ {
+ return mBigEndianPacket;
+ }
+
+private:
+ uint8_t mHeader[8];
+ uint32_t mLength;
+ uint32_t mHash;
+public:
+ uint8_t *mData;
+ bool mBigEndianPacket;
+};
+
+typedef physx::shdfnd::Array< CommPacket > CommPacketArray;
+
+class CommLayerImp : public CommLayer, public physx::shdfnd::Thread
+{
+ PX_NOCOPY(CommLayerImp)
+public:
+ CommLayerImp(const char *ipaddress,uint16_t portNumber,bool isServer) :
+ mReadPackets(PX_DEBUG_EXP("PsCommLayer::CommLayerImpl::mReadPackets"))
+ {
+ mListenPending = false;
+ mSendData = NULL;
+ mSendDataLength = 0;
+ mSendLoc = 0;
+ mTotalPendingSize = 0; // number of bytes of data pending to be sent
+ mTotalPendingCount = 0; // number of packets of data pending to be sent; count not size
+ mReadSize = 0;
+ mReadPacketHeaderLoc = 0;
+ mReadPacketLoc = 0;
+ mIsServer = isServer;
+ mPortNumber = portNumber;
+ mSocket = PX_NEW(physx::shdfnd::Socket)(false);
+ mClientConnected = false;
+ if ( isServer )
+ {
+ mConnected = mSocket->listen(portNumber);
+ mListenPending = true;
+ }
+ else
+ {
+ mConnected = mSocket->connect(ipaddress,portNumber);
+ }
+ if ( mConnected )
+ {
+ mSocket->setBlocking(false);
+ physx::shdfnd::Thread::start(0x4000);
+ }
+ }
+
+ virtual ~CommLayerImp(void)
+ {
+ physx::shdfnd::Thread::signalQuit();
+ physx::shdfnd::Thread::waitForQuit();
+ if ( mSocket )
+ {
+ mSocket->disconnect();
+ delete mSocket;
+ }
+ releaseAllReadData();
+ releaseAllSendData();
+ }
+
+ void releaseAllReadData(void)
+ {
+ PX_FREE(mReadPacketHeader.mData);
+ mReadPacketHeader.mData = NULL;
+ for (uint32_t i=0; i<mReadPackets.size(); i++)
+ {
+ PX_FREE(mReadPackets[i].mData);
+ }
+ mReadPackets.clear();
+ mReadSize = 0;
+ }
+
+ void releaseAllSendData(void)
+ {
+ // Free up memory allocated for pending sends not yet sent...
+ for (uint32_t i=0; i<mPendingSends.size(); i++)
+ {
+ CommPacket &sp = mPendingSends[i];
+ PX_FREE(sp.mData);
+ }
+ mPendingSends.clear();
+ PX_FREE(mSendData);
+ mSendData = NULL;
+ mTotalPendingCount = 0;
+ mTotalPendingSize = 0;
+ }
+
+ virtual bool sendMessage(const void *data,uint32_t len)
+ {
+ bool ret = false;
+ CommPacket sp;
+ sp.setLength(len);
+ sp.mData = static_cast<uint8_t *>(PX_ALLOC(len+sp.getSize(),"CommPacket"));
+ if ( sp.mData )
+ {
+ physx::intrinsics::memCopy(sp.mData+sp.getSize(),data,len);
+ mSendMutex.lock();
+ mPendingSends.pushBack(sp);
+ physx::shdfnd::atomicAdd(&mTotalPendingSize,int32_t(len));
+ physx::shdfnd::atomicAdd(&mTotalPendingCount,1);
+ mSendMutex.unlock();
+ ret = true;
+ }
+ return ret;
+ }
+
+ virtual uint32_t peekMessage(bool &isBigEndianPacket) // return the length of the next pending message
+ {
+ uint32_t ret = 0;
+
+ int32_t readSize = physx::shdfnd::atomicAdd(&mReadSize,0);
+ if ( readSize != 0 )
+ {
+ mReadPacketMutex.lock();
+ if ( !mReadPackets.empty() )
+ {
+ ret = mReadPackets[0].getLength();
+ isBigEndianPacket = mReadPackets[0].isBigEndianPacket();
+ }
+ mReadPacketMutex.unlock();
+ }
+
+ return ret;
+ }
+
+ virtual uint32_t getMessage(void *msg,uint32_t maxLength,bool &isBigEndianPacket) // receives a pending message
+ {
+ uint32_t ret = 0;
+
+ int32_t readSize = physx::shdfnd::atomicAdd(&mReadSize,0); // And data in the read queue?
+ if ( readSize != 0 ) // Yes..
+ {
+ mReadPacketMutex.lock(); // Lock the read packets mutex
+ CommPacket cp = mReadPackets[0]; // get the packet
+ if ( cp.getLength() <= maxLength ) // make sure it is shorter than the read buffer provided
+ {
+ physx::shdfnd::atomicAdd(&mReadSize,-int32_t(cp.getLength())); // subtract the read size semaphore to indicate the amount of data we snarfed from the read buffer.
+ mReadPackets.remove(0); // Remove the packet from the queue
+ mReadPacketMutex.unlock(); // Once we have pulled this off of the read queue it is save to release the mutex and add more.
+ physx::intrinsics::memCopy(msg,cp.mData,cp.getLength()); // Copy the packet to the callers buffer
+ ret = cp.getLength(); // set the return length
+ isBigEndianPacket = cp.isBigEndianPacket();
+ PX_FREE(cp.mData); // Free the read-data now that it has been copied into the users buffer.
+ }
+ else
+ {
+ mReadPacketMutex.unlock(); // Unlock the mutex
+ }
+ }
+ return ret;
+ }
+
+ virtual void release(void)
+ {
+ delete this;
+ }
+
+ bool isConnected(void) const
+ {
+ return mConnected;
+ }
+
+ virtual bool notifySocketConnection(physx::shdfnd::Socket *newConnection) // notify the caller that a new connection has been established.
+ {
+ PX_UNUSED(newConnection);
+ return true;
+ }
+
+ bool processSocketWrite(void)
+ {
+ while ( mSendData ) // if we are sending data..
+ {
+ uint32_t sendCount = mSendDataLength-mSendLoc;
+ if ( sendCount > 32768 )
+ {
+ sendCount = 32768;
+ }
+ const uint8_t *data = &mSendData[mSendLoc];
+ uint32_t sendAmount = mSocket->write(data,sendCount);
+ if ( sendAmount )
+ {
+ mSendLoc+=sendAmount;
+ if ( mSendLoc == mSendDataLength )
+ {
+ PX_FREE(mSendData);
+ mSendData = NULL;
+ mSendDataLength = 0;
+ mSendLoc = 0;
+ }
+ }
+ else
+ {
+ break;
+ }
+ }
+ return mSendData ? true : false;
+ }
+
+ void processPendingSends(void)
+ {
+ int32_t pendingCount = physx::shdfnd::atomicAdd(&mTotalPendingCount,0);
+ while ( !processSocketWrite() && pendingCount != 0 )
+ {
+ mSendMutex.lock(); // Lock the send mutex before we check if there is data to send.
+ CommPacket sp = mPendingSends[0]; // Get the first packet to be sent.
+ physx::shdfnd::atomicAdd(&mTotalPendingSize,-int32_t(sp.getLength()));
+ physx::shdfnd::atomicAdd(&mTotalPendingCount,-1);
+ mPendingSends.remove(0); // Remove this packet from the pending send list.
+ mSendMutex.unlock(); // Unlock the mutex because at this point it is safe to post new send packets.
+ sp.computeHash();
+ physx::intrinsics::memCopy(sp.mData,&sp,sp.getSize());
+ mSendData = sp.mData;
+ mSendDataLength = sp.getLength()+sp.getSize();
+ mSendLoc = 0;
+ pendingCount = physx::shdfnd::atomicAdd(&mTotalPendingCount,0);
+ }
+ }
+
+ void resetServerSocket(void)
+ {
+ mSocket->disconnect(); // close the previous connection..
+ delete mSocket;
+ releaseAllReadData();
+ releaseAllSendData();
+ mSocket = PX_NEW(physx::shdfnd::Socket)(false);
+ mSocket->setBlocking(false);
+ mConnected = mSocket->listen(mPortNumber);
+ if ( !mConnected )
+ {
+ physx::shdfnd::Thread::signalQuit();
+ }
+ else
+ {
+ mListenPending = true;
+ }
+ }
+
+ //The thread execute function
+ virtual void execute()
+ {
+ setName("CommLayer"); // Set the name of the read
+
+ if ( mIsServer )
+ {
+ while( !quitIsSignalled() )
+ {
+ if ( mSocket->isConnected() )
+ {
+ mClientConnected = true;
+ processPendingSends();
+ bool haveData = processRead();
+ while ( haveData )
+ {
+ haveData = processRead();
+ }
+ if ( !mSocket->isConnected() ) // if we lost the client connection, then we need to fire up a new listen.
+ {
+ resetServerSocket();
+ }
+ }
+ else
+ {
+ mClientConnected = false;
+ if ( !mListenPending )
+ {
+ resetServerSocket();
+ }
+ bool connected = mSocket->accept(false);
+ if ( connected )
+ {
+ mSocket->setBlocking(false);
+ mListenPending = false;
+ }
+ }
+ physx::shdfnd::Thread::sleep(0);
+ }
+ }
+ else
+ {
+ while( !quitIsSignalled() && mSocket->isConnected() )
+ {
+ processPendingSends();
+ bool haveData = processRead();
+ while ( haveData )
+ {
+ haveData = processRead();
+ }
+ physx::shdfnd::Thread::sleep(0);
+ }
+ }
+ mClientConnected = false;
+ mConnected = false;
+ quit();
+ }
+
+ bool processRead(void)
+ {
+ bool ret = false;
+
+ if ( mReadPacketHeader.mData ) // if we are currently in the process of reading in a packet...
+ {
+ uint32_t remaining = mReadPacketHeader.getLength() - mReadPacketLoc;
+ uint8_t *readData = &mReadPacketHeader.mData[mReadPacketLoc];
+ uint32_t readCount = mSocket->read(readData,remaining);
+ if ( readCount )
+ {
+ ret = true;
+ mReadPacketLoc+=readCount;
+ if ( mReadPacketLoc == mReadPacketHeader.getLength() )
+ {
+ // The packet has been read!!
+ mReadPacketMutex.lock();
+ mReadPackets.pushBack(mReadPacketHeader);
+ physx::shdfnd::atomicAdd(&mReadSize,int32_t(mReadPacketHeader.getLength()));
+ mReadPacketMutex.unlock();
+ mReadPacketHeader.mData = NULL;
+ }
+ }
+ }
+ else
+ {
+ uint32_t remaining = mReadPacketHeader.getSize() - mReadPacketHeaderLoc; // the amount of the header we have still yet to read...
+ uint8_t *header = reinterpret_cast<uint8_t *>(&mReadPacketHeader);
+ uint8_t *readData = &header[mReadPacketHeaderLoc];
+ uint32_t readCount = mSocket->read(readData,remaining);
+ if ( readCount )
+ {
+ ret = true;
+ mReadPacketHeaderLoc+=readCount;
+ if ( mReadPacketHeaderLoc == mReadPacketHeader.getSize() )
+ {
+ if ( mReadPacketHeader.isHeaderPacket() ) // if it is a valid header packet..
+ {
+ PX_FREE(mReadPacketHeader.mData);
+ mReadPacketHeader.mData = static_cast<uint8_t *>(PX_ALLOC(mReadPacketHeader.getLength(),"ReadPacket"));
+ mReadPacketLoc = 0;
+ mReadPacketHeaderLoc = 0;
+ }
+ else
+ {
+ // We could be connecting somehow 'mid-stream' so we need to scan forward a byte at a time until we get a valid packet header.
+ // We do this by copying all of the old packet header + 1 byte, and set the next read location to read just one more byte at the end.
+ // This will cause the stream to 'resync' back to the head of the next packet.
+ CommPacket cp = mReadPacketHeader;
+ const uint8_t *source = reinterpret_cast<const uint8_t *>(&cp);
+ uint8_t *dest = reinterpret_cast<uint8_t *>(&mReadPacketHeader);
+ physx::intrinsics::memCopy(dest,source+1,cp.getSize()-1);
+ mReadPacketHeaderLoc = cp.getSize()-1;
+ }
+
+ }
+ }
+ }
+ return ret;
+ }
+
+ virtual int32_t getPendingReadSize(void) const // returns the number of bytes of data which is pending to be read.
+ {
+ return physx::shdfnd::atomicAdd(&mReadSize,0);
+ }
+
+ virtual bool isServer(void) const // return true if we are in server mode.
+ {
+ return mIsServer;
+ }
+
+ virtual bool hasClient(void) const // return true if a client connection is currently established
+ {
+ return mClientConnected;
+ }
+
+ int32_t getPendingSendSize(void) const
+ {
+ return physx::shdfnd::atomicAdd(&mTotalPendingSize,0);
+ }
+
+ physx::shdfnd::Socket *mSocket;
+ uint16_t mPortNumber;
+ bool mIsServer;
+ bool mConnected;
+ mutable int32_t mReadSize;
+ uint32_t mReadPacketHeaderLoc; // The current read location from the input stream for the current packet
+ uint32_t mReadPacketLoc;
+ CommPacket mReadPacketHeader; // The current packet we are reading header
+ CommPacketArray mReadPackets;
+ mutable int32_t mTotalPendingSize;
+ mutable int32_t mTotalPendingCount;
+ CommPacketArray mPendingSends;
+ bool mClientConnected;
+ physx::shdfnd::Mutex mReadPacketMutex; // Mutex to have thread safety on reads
+ physx::shdfnd::Mutex mSendMutex; // Mutex to have thread safety on sends
+ uint8_t *mSendData; // data being sent over the socket connection
+ uint32_t mSendDataLength; // The length of the data to send over the socket connection
+ uint32_t mSendLoc; // The current location of the data which has been sent so far.
+ bool mListenPending;
+ uint32_t mReadTimeOut;
+};
+
+} // end of namespace
+
+using namespace COMM_LAYER;
+
+
+CommLayer *createCommLayer(const char *ipaddress,uint16_t portNumber,bool isServer)
+{
+ CommLayerImp *c = PX_NEW(CommLayerImp)(ipaddress,portNumber,isServer);
+ if ( !c->isConnected() )
+ {
+ c->release();
+ c = NULL;
+ }
+ return static_cast< CommLayer *>(c);
+}
diff --git a/APEX_1.4/shared/general/RenderDebug/src/PsCommStream.cpp b/APEX_1.4/shared/general/RenderDebug/src/PsCommStream.cpp
new file mode 100644
index 00000000..491e62df
--- /dev/null
+++ b/APEX_1.4/shared/general/RenderDebug/src/PsCommStream.cpp
@@ -0,0 +1,291 @@
+#include "PsCommStream.h"
+#include "PsUserAllocated.h"
+#include "RenderDebug.h"
+#include "PsString.h"
+#include "PxIntrinsics.h"
+#include "PsIntrinsics.h"
+#include <stdio.h>
+
+#define MAX_STREAM_RECORD (1024*1024*2047) // no more than one gig
+#define STREAM_VERSION_NUMBER 100
+static char magic[4] = { 'N', 'V', 'C', 'S' };
+
+class CommStreamImpl : public CommStream, public physx::shdfnd::UserAllocated
+{
+public:
+ CommStreamImpl(const char *streamFile,bool recordFile,CommLayer *c)
+ {
+ mCommLayer = c;
+ mIsRecord = recordFile;
+ mFirstFrame = true;
+ mIsValid = true;
+ mMaxPacketLength = (1024*1024)*16;
+ mPacketLength = 0;
+ mPacketLoc = 0;
+ mPacketData = static_cast<uint8_t *>(PX_ALLOC(mMaxPacketLength,"PacketData"));
+ mPacketBigEndian = false;
+ physx::shdfnd::strlcpy(mFilename,256,streamFile);
+ if ( mIsRecord )
+ {
+ mFph = NULL;
+ }
+ else
+ {
+ mFph = fopen(streamFile,"rb");
+ mIsValid = false;
+ if ( mFph )
+ {
+ char id[4] = { 0, 0, 0, 0};
+ uint32_t v1=0;
+ uint32_t v2=0;
+ uint32_t v3=0;
+ size_t res = fread(id,sizeof(id),1,mFph);
+ res = fread(&v1,sizeof(v1),1,mFph);
+ res = fread(&v2,sizeof(v2),1,mFph);
+ res = fread(&v3,sizeof(v3),1,mFph);
+ PX_UNUSED(res);
+ if ( id[0] == magic[0] &&
+ id[1] == magic[1] &&
+ id[2] == magic[2] &&
+ id[3] == magic[3] &&
+ v1 == STREAM_VERSION_NUMBER &&
+ v2 == RENDER_DEBUG_VERSION &&
+ v3 == RENDER_DEBUG_COMM_VERSION )
+ {
+ mIsValid = true;
+ readNextPacket();
+ }
+ }
+ }
+ }
+
+ virtual ~CommStreamImpl(void)
+ {
+ close();
+ }
+
+ void close(void)
+ {
+ PX_FREE(mPacketData);
+ mPacketData = NULL;
+ if ( mFph )
+ {
+ fclose(mFph);
+ mFph = NULL;
+ }
+ mPacketLength = 0;
+ mPacketLoc = 0;
+ mIsValid = false;
+ }
+
+ FILE *getFile(void)
+ {
+ if ( mFirstFrame )
+ {
+ mFph = fopen(mFilename,"wb");
+ if ( mFph )
+ {
+ uint32_t version = STREAM_VERSION_NUMBER;
+ fwrite(magic,sizeof(magic),1,mFph);
+ fwrite(&version,sizeof(version),1,mFph);
+ version = RENDER_DEBUG_VERSION;
+ fwrite(&version,sizeof(version),1,mFph);
+ version = RENDER_DEBUG_COMM_VERSION;
+ fwrite(&version,sizeof(version),1,mFph);
+ fflush(mFph);
+ }
+ mFirstFrame = false;
+ }
+ return mFph;
+ }
+
+ virtual void release(void)
+ {
+ delete this;
+ }
+
+ virtual CommLayer *getCommLayer(void)
+ {
+ return mCommLayer;
+ }
+
+ bool isValid(void) const
+ {
+ return mIsValid;
+ }
+
+ virtual bool isServer(void) const // return true if we are in server mode.
+ {
+ return mCommLayer->isServer();
+ }
+
+ virtual bool hasClient(void) const // return true if a client connection is currently established
+ {
+ bool ret = false;
+ if ( mIsRecord )
+ {
+ ret = mCommLayer->hasClient();
+ }
+ else
+ {
+ ret = mIsValid;
+ }
+ return ret;
+ }
+
+ virtual bool isConnected(void) const // return true if we are still connected to the server. The server is always in a 'connected' state.
+ {
+ return mCommLayer->isConnected();
+ }
+
+ virtual int32_t getPendingReadSize(void) const // returns the number of bytes of data which is pending to be read.
+ {
+ int32_t ret = 0;
+ if ( mIsRecord )
+ {
+ ret = mCommLayer->getPendingReadSize();
+ }
+ else
+ {
+ ret = int32_t(mPacketLength-mPacketLoc);
+ }
+ return ret;
+ }
+
+ virtual int32_t getPendingSendSize(void) const // return the number of bytes of data pending to be sent. This can be used for flow control
+ {
+ return mCommLayer->getPendingSendSize();
+ }
+
+ virtual bool sendMessage(const void *msg,uint32_t len)
+ {
+ bool ret = true;
+ if ( mIsRecord )
+ {
+ ret = mCommLayer->sendMessage(msg,len);
+ }
+ return ret;
+ }
+
+ virtual uint32_t peekMessage(bool &isBigEndianPacket) // return the length of the next pending message
+ {
+ uint32_t ret = 0;
+ if ( mIsRecord )
+ {
+ ret = mCommLayer->peekMessage(isBigEndianPacket);
+ }
+ else
+ {
+ ret = mPacketLength - mPacketLoc;
+ isBigEndianPacket = mPacketBigEndian;
+ }
+ return ret;
+ }
+
+ virtual uint32_t getMessage(void *msg,uint32_t maxLength,bool &isBigEndianPacket) // receives a pending message
+ {
+ uint32_t ret = 0;
+ if ( mIsRecord )
+ {
+ ret = mCommLayer->getMessage(msg,maxLength,isBigEndianPacket);
+ if ( ret && mIsRecord )
+ {
+ getFile();
+ if ( mFph )
+ {
+ uint32_t be = isBigEndianPacket ? 1U : 0U;
+ fwrite(&ret,sizeof(ret),1,mFph);
+ fwrite(&be,sizeof(be),1,mFph);
+ fwrite(msg,ret,1,mFph);
+ fflush(mFph);
+ size_t len = size_t(ftell(mFph));
+ if ( len > MAX_STREAM_RECORD )
+ {
+ fclose(mFph);
+ mFph = NULL;
+ }
+ }
+ }
+ }
+ else if ( mIsValid )
+ {
+ ret = mPacketLength - mPacketLoc;
+ if ( ret <= maxLength )
+ {
+ physx::intrinsics::memCopy(msg,&mPacketData[mPacketLoc],ret);
+ readNextPacket();
+ }
+ else
+ {
+ ret = maxLength;
+ physx::intrinsics::memCopy(msg,&mPacketData[mPacketLoc],ret);
+ mPacketLoc+=ret;
+ }
+ }
+ return ret;
+ }
+
+ void readNextPacket(void)
+ {
+ if ( mFph && !mIsRecord )
+ {
+ mPacketLoc = 0;
+ uint32_t be;
+ size_t r1 = fread(&mPacketLength,sizeof(mPacketLength),1,mFph);
+ size_t r2 = fread(&be,sizeof(be),1,mFph);
+ if ( r1 == 1 && r2 == 1 )
+ {
+ if ( mPacketLength > mMaxPacketLength )
+ {
+ mMaxPacketLength = mPacketLength + (1024*1024*10);
+ PX_FREE(mPacketData);
+ mPacketData = static_cast<uint8_t *>(PX_ALLOC(mMaxPacketLength,"PacketData"));
+ }
+ if ( mPacketData )
+ {
+ size_t r3 = fread(mPacketData,mPacketLength,1,mFph);
+ if ( r3 == 1 )
+ {
+ mPacketBigEndian = be ? true : false;
+ }
+ else
+ {
+ close();
+ }
+ }
+ else
+ {
+ close();
+ }
+ }
+ else
+ {
+ close();
+ }
+ }
+ }
+
+ uint32_t mMaxPacketLength;
+ uint32_t mPacketLoc;
+ uint32_t mPacketLength;
+ uint8_t *mPacketData;
+ bool mPacketBigEndian;
+
+ char mFilename[256];
+ FILE *mFph;
+ bool mFirstFrame;
+ bool mIsValid;
+ bool mIsRecord;
+ CommLayer *mCommLayer;
+};
+
+CommStream *createCommStream(const char *streamFile,bool recordFile,CommLayer *cl)
+{
+ CommStreamImpl *c = PX_NEW(CommStreamImpl)(streamFile,recordFile,cl);
+ if ( !c->isValid() )
+ {
+ c->release();
+ c = NULL;
+ }
+ return static_cast< CommStream *>(c);
+}
diff --git a/APEX_1.4/shared/general/RenderDebug/src/RenderDebug.cpp b/APEX_1.4/shared/general/RenderDebug/src/RenderDebug.cpp
new file mode 100644
index 00000000..03554c43
--- /dev/null
+++ b/APEX_1.4/shared/general/RenderDebug/src/RenderDebug.cpp
@@ -0,0 +1,817 @@
+#include "RenderDebugTyped.h"
+
+
+#include "RenderDebugImpl.h"
+#include "ClientServer.h"
+#include "ProcessRenderDebug.h"
+#include "InternalRenderDebug.h"
+#include "FileRenderDebug.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <stdarg.h>
+
+#include "PsUserAllocated.h"
+#include "PsMutex.h"
+#include "PsString.h"
+#include "PxErrorCallback.h"
+#include "PxAllocatorCallback.h"
+#include "PsArray.h"
+#include "PsFoundation.h"
+
+namespace RENDER_DEBUG
+{
+class RenderDebugIImpl;
+void finalRelease(RenderDebugIImpl *nv);
+}
+
+#include "GetArgs.h"
+#include "PsFileBuffer.h"
+
+#if PX_WINDOWS_FAMILY
+#pragma warning(disable:4986)
+#endif
+
+#define SERVER_FILE_SIZE sizeof(ServerHeader)+(1024*1024)
+
+class EchoRemoteCommand
+{
+public:
+ char mCommand[16384];
+};
+
+typedef physx::shdfnd::Array< EchoRemoteCommand > EchoRemoteCommandVector;
+
+#ifdef USE_PX_FOUNDATION
+#else
+class DefaultErrorCallback : public physx::PxErrorCallback
+{
+public:
+ DefaultErrorCallback(void)
+ {
+ }
+
+ virtual void reportError(physx::PxErrorCode::Enum code, const char* message, const char* file, int line)
+ {
+ PX_UNUSED(code);
+ PX_UNUSED(file);
+ PX_UNUSED(line);
+ printf("PhysX: %s\r\n", message );
+ }
+private:
+};
+
+#if PX_WINDOWS_FAMILY
+// on win32 we only have 8-byte alignment guaranteed, but the CRT provides special aligned allocation
+// fns
+#include <malloc.h>
+#include <crtdbg.h>
+
+static void* platformAlignedAlloc(size_t size)
+{
+ return _aligned_malloc(size, 16);
+}
+
+static void platformAlignedFree(void* ptr)
+{
+ _aligned_free(ptr);
+}
+#elif PX_LINUX || PX_ANDROID
+static void* platformAlignedAlloc(size_t size)
+{
+ return ::memalign(16, size);
+}
+
+static void platformAlignedFree(void* ptr)
+{
+ ::free(ptr);
+}
+#elif PX_WIIU
+static void* platformAlignedAlloc(size_t size)
+{
+ size_t pad = 15 + sizeof(size_t); // store offset for delete.
+ uint8_t* base = (uint8_t*)::malloc(size+pad);
+ if(!base)
+ return NULL;
+
+ uint8_t* ptr = (uint8_t*)(size_t(base + pad) & ~(15)); // aligned pointer
+ ((size_t*)ptr)[-1] = ptr - base; // store offset
+
+ return ptr;
+}
+
+static void platformAlignedFree(void* ptr)
+{
+ if(ptr == NULL)
+ return;
+
+ uint8_t* base = ((uint8_t*)ptr) - ((size_t*)ptr)[-1];
+ ::free(base);
+}
+#else
+
+// on PS3, XBox and Win64 we get 16-byte alignment by default
+static void* platformAlignedAlloc(size_t size)
+{
+ void *ptr = ::malloc(size);
+ PX_ASSERT((reinterpret_cast<size_t>(ptr) & 15)==0);
+ return ptr;
+}
+
+static void platformAlignedFree(void* ptr)
+{
+ ::free(ptr);
+}
+#endif
+
+
+class DefaultAllocator : public physx::PxAllocatorCallback
+{
+public:
+ DefaultAllocator(void)
+ {
+ }
+
+ ~DefaultAllocator(void)
+ {
+ }
+
+
+ virtual void* allocate(size_t size, const char* typeName, const char* filename, int line)
+ {
+ PX_UNUSED(typeName);
+ PX_UNUSED(filename);
+ PX_UNUSED(line);
+ void *ret = platformAlignedAlloc(size);
+ return ret;
+ }
+
+ virtual void deallocate(void* ptr)
+ {
+ platformAlignedFree(ptr);
+ }
+private:
+};
+
+
+DefaultAllocator gDefaultAllocator;
+DefaultErrorCallback gDefaultErrorCallback;
+#endif
+
+#define RECORD_REMOTE_COMMANDS_VERSION 100
+
+static char magic[4] = { 'R', 'R', 'C', 'V' };
+
+static uint32_t isBigEndian(void)
+{
+ int32_t i = 1;
+ bool b = *(reinterpret_cast<char*>(&i))==0;
+ return b ? uint32_t(1) : uint32_t(0);
+}
+
+
+namespace RENDER_DEBUG
+{
+
+class PlaybackRemoteCommand
+{
+public:
+ PlaybackRemoteCommand(void)
+ {
+ mFrameNumber = 0;
+ mArgc = 0;
+ for (uint32_t i=0; i<256; i++)
+ {
+ mArgv[i] = NULL;
+ }
+ }
+ void release(void)
+ {
+ mFrameNumber = 0;
+ for (uint32_t i=0; i<mArgc; i++)
+ {
+ PX_FREE(static_cast<void *>(const_cast<char *>(mArgv[i])));
+ mArgv[i] = NULL;
+ }
+ mArgc = 0;
+ }
+ uint32_t mFrameNumber;
+ uint32_t mArgc;
+ const char *mArgv[256];
+};
+
+class RenderDebugIImpl : public physx::shdfnd::UserAllocated, public RenderDebugHook
+{
+ PX_NOCOPY(RenderDebugIImpl)
+public:
+ RenderDebugIImpl(RENDER_DEBUG::RenderDebug::Desc &desc) :
+ mEchoRemoteCommandBuffer(PX_DEBUG_EXP("PxRenderDebug::mEchoRemoteCommandBuffer"))
+ {
+ mEndianSwap = false;
+ mRecordRemoteCommands = NULL;
+ mPlaybackRemoteCommands = NULL;
+ mCurrentFrame = 0;
+ mMeshId = 0;
+ mFileRenderDebug = NULL;
+ mIsValid = true;
+ mApexRenderDebug = NULL;
+ mInternalProcessRenderDebug = NULL;
+ mRenderDebug = NULL;
+ mClientServer = NULL;
+ mReadNext = false;
+ switch ( desc.runMode )
+ {
+ case RenderDebug::RM_CLIENT:
+ case RenderDebug::RM_CLIENT_OR_FILE:
+ case RenderDebug::RM_SERVER:
+ {
+ if ( desc.runMode == RenderDebug::RM_SERVER ) // if running in server mode.
+ {
+ mClientServer = createClientServer(desc);
+ }
+ else
+ {
+ mClientServer = createClientServer(desc);
+ if ( mClientServer == NULL )
+ {
+ if ( desc.runMode != RenderDebug::RM_CLIENT_OR_FILE )
+ {
+ desc.errorCode = "Unable to locate server";
+ }
+ else
+ {
+ desc.errorCode = NULL;
+ }
+ }
+ }
+ }
+ break;
+ case RenderDebug::RM_LOCAL:
+ break;
+ case RenderDebug::RM_FILE:
+ break;
+ }
+
+ if ( desc.runMode == RenderDebug::RM_FILE || desc.runMode == RenderDebug::RM_CLIENT_OR_FILE || desc.runMode == RENDER_DEBUG::RenderDebug::RM_CLIENT )
+ {
+ if ( desc.echoFileLocally )
+ {
+ mInternalProcessRenderDebug = RENDER_DEBUG::createProcessRenderDebug();
+ }
+ mFileRenderDebug = RENDER_DEBUG::createFileRenderDebug(desc.recordFileName,false,desc.echoFileLocally ? mInternalProcessRenderDebug : NULL, mClientServer);
+ if ( mFileRenderDebug == NULL )
+ {
+ mIsValid = false;
+ desc.errorCode = "Failed to open recording file";
+ }
+ }
+ if ( mIsValid )
+ {
+ if ( mFileRenderDebug )
+ {
+ mMeshId = 1000000; //
+ mRenderDebug = RENDER_DEBUG::createInternalRenderDebug(mFileRenderDebug,this);
+ }
+ else
+ {
+ if ( mInternalProcessRenderDebug == NULL )
+ {
+ mInternalProcessRenderDebug = RENDER_DEBUG::createProcessRenderDebug();
+ }
+ mRenderDebug = RENDER_DEBUG::createInternalRenderDebug(mInternalProcessRenderDebug,this);
+ }
+ }
+ if ( desc.errorCode )
+ {
+ mIsValid = false;
+ }
+ if ( mIsValid && desc.recordRemoteCommands )
+ {
+ mRecordRemoteCommands = PX_NEW(physx::PsFileBuffer)(desc.recordRemoteCommands, physx::PsFileBuffer::OPEN_WRITE_ONLY);
+ if ( mRecordRemoteCommands->isOpen() )
+ {
+ mRecordRemoteCommands->write(magic, 4 );
+ mRecordRemoteCommands->storeDword(RECORD_REMOTE_COMMANDS_VERSION);
+ uint32_t bigEndian = isBigEndian();
+ mRecordRemoteCommands->storeDword(bigEndian);
+ mRecordRemoteCommands->flush();
+ }
+ else
+ {
+ delete mRecordRemoteCommands;
+ mRecordRemoteCommands = NULL;
+ }
+ }
+ if ( mIsValid && desc.playbackRemoteCommands )
+ {
+ mPlaybackRemoteCommands = PX_NEW(physx::PsFileBuffer)(desc.playbackRemoteCommands, physx::PsFileBuffer::OPEN_READ_ONLY);
+ if ( mPlaybackRemoteCommands->isOpen() )
+ {
+ char temp[4];
+ uint32_t r = mPlaybackRemoteCommands->read(temp,4);
+ uint32_t version = mPlaybackRemoteCommands->readDword();
+ uint32_t bigEndian = mPlaybackRemoteCommands->readDword();
+
+ if ( r == 4 && magic[0] == temp[0] && magic[1] == temp[1] && magic[2] == temp[2] && magic[3] == temp[3] && version == RECORD_REMOTE_COMMANDS_VERSION )
+ {
+ if ( bigEndian != isBigEndian() )
+ {
+ mEndianSwap = true;
+ }
+ mReadNext = true;
+ }
+ else
+ {
+ delete mPlaybackRemoteCommands;
+ mPlaybackRemoteCommands = NULL;
+ }
+ }
+ else
+ {
+ delete mPlaybackRemoteCommands;
+ mPlaybackRemoteCommands = NULL;
+ }
+ }
+ mDesc = desc;
+ }
+
+ virtual ~RenderDebugIImpl(void)
+ {
+ delete mRecordRemoteCommands;
+ delete mPlaybackRemoteCommands;
+ mPlaybackRemoteCommand.release();
+ if ( mFileRenderDebug )
+ {
+ mFileRenderDebug->release();
+ }
+ if ( mClientServer )
+ {
+ mClientServer->release();
+ }
+ if ( mRenderDebug )
+ {
+ mRenderDebug->releaseRenderDebug();
+ }
+ if ( mInternalProcessRenderDebug )
+ {
+ mInternalProcessRenderDebug->release();
+ }
+ }
+
+ virtual bool render(float dtime,RENDER_DEBUG::RenderDebugInterface *iface)
+ {
+ bool ret = true;
+
+ mCurrentFrame++;
+
+ mApexRenderDebug = iface;
+
+ if ( mFileRenderDebug && mFileRenderDebug->getFrameCount() )
+ {
+ mFileRenderDebug->processReadFrame(iface);
+ }
+
+ if ( mClientServer && mDesc.runMode == RENDER_DEBUG::RenderDebug::RM_SERVER )
+ {
+ mClientServer->processFrame(mInternalProcessRenderDebug,iface);
+ }
+
+ ret = mRenderDebug->renderImpl(dtime,iface);
+
+ return ret;
+ }
+
+
+ virtual void release(void)
+ {
+ finalRelease(this);
+ }
+
+ bool isValid(void) const
+ {
+ return mIsValid;
+ }
+
+ virtual uint32_t setFilePlayback(const char *fileName)
+ {
+ uint32_t ret = 0;
+
+ if ( mFileRenderDebug )
+ {
+ mFileRenderDebug->release();
+ mFileRenderDebug = NULL;
+ }
+
+ mFileRenderDebug = RENDER_DEBUG::createFileRenderDebug(fileName,true,mInternalProcessRenderDebug, NULL);
+
+ if ( mFileRenderDebug )
+ {
+ mFileRenderDebug->setFrame(0);
+ ret = mFileRenderDebug->getFrameCount();
+ }
+
+ return ret;
+ }
+
+ virtual bool setPlaybackFrame(uint32_t playbackFrame)
+ {
+ bool ret = false;
+
+ if ( mFileRenderDebug && playbackFrame < mFileRenderDebug->getFrameCount() )
+ {
+ ret = true;
+ mFileRenderDebug->setFrame(playbackFrame);
+ }
+
+ return ret;
+ }
+
+ virtual uint32_t getPlaybackFrameCount(void) const
+ {
+ uint32_t ret = 0;
+ if ( mFileRenderDebug )
+ {
+ ret = mFileRenderDebug->getFrameCount();
+ }
+ return ret;
+ }
+
+ virtual void stopPlayback(void)
+ {
+ if ( mFileRenderDebug )
+ {
+ mFileRenderDebug->release();
+ mFileRenderDebug = NULL;
+ }
+ }
+
+ virtual bool trylock(void)
+ {
+ return mMutex.trylock();
+ }
+
+ virtual void lock(void)
+ {
+ mMutex.lock();
+ }
+
+ virtual void unlock(void)
+ {
+ mMutex.unlock();
+ }
+
+ /**
+ \brief Convenience method to return a unique mesh id number (simply a global counter to avoid clashing with other ids
+ */
+ virtual uint32_t getMeshId(void)
+ {
+ mMeshId++;
+ return mMeshId;
+ }
+
+ /**
+ \brief Transmit an actual input event to the remote client
+
+ \param ev The input event data to transmit
+ */
+ virtual void sendInputEvent(const InputEvent &ev)
+ {
+ if ( mClientServer )
+ {
+ mClientServer->sendInputEvent(ev);
+ }
+ }
+
+
+ virtual bool sendRemoteCommand(const char *fmt,...)
+ {
+ bool ret = false;
+
+ EchoRemoteCommand c;
+ va_list arg;
+ va_start( arg, fmt );
+ physx::shdfnd::vsnprintf(c.mCommand,sizeof(c.mCommand)-1, fmt, arg);
+ va_end(arg);
+
+ if ( mClientServer )
+ {
+ ret = mClientServer->sendCommand(c.mCommand);
+ }
+ else
+ {
+ mEchoRemoteCommandBuffer.pushBack(c);
+ }
+ return ret;
+ }
+
+ virtual const char ** getRemoteCommand(uint32_t &argc)
+ {
+ const char **ret = NULL;
+ argc = 0;
+
+ if ( mClientServer )
+ {
+ ret = mClientServer->getCommand(argc);
+ }
+ else if ( !mEchoRemoteCommandBuffer.empty() )
+ {
+ mCurrentCommand = mEchoRemoteCommandBuffer[0];
+ mEchoRemoteCommandBuffer.remove(0);
+ ret = mParser.getArgs(mCurrentCommand.mCommand,argc);
+ }
+
+ if ( mReadNext )
+ {
+ readNextRemoteCommand();
+ mReadNext = false;
+ }
+
+ if ( mPlaybackRemoteCommands )
+ {
+ ret = NULL;
+ argc = 0;
+ if ( mPlaybackRemoteCommand.mFrameNumber == mCurrentFrame )
+ {
+ argc = mPlaybackRemoteCommand.mArgc;
+ ret = mPlaybackRemoteCommand.mArgv;
+ mReadNext = true;
+ }
+ }
+
+ if ( mRecordRemoteCommands && ret && argc < 256 )
+ {
+ mRecordRemoteCommands->storeDword(mCurrentFrame);
+ mRecordRemoteCommands->storeDword(argc);
+ for (uint32_t i=0; i<argc; i++)
+ {
+ const char *str = ret[i];
+ uint32_t len = uint32_t(strlen(str))+1;
+ mRecordRemoteCommands->storeDword(len);
+ mRecordRemoteCommands->write(str,len);
+ }
+ mRecordRemoteCommands->flush();
+ }
+
+ return ret;
+ }
+
+
+ /**
+ \brief Transmits an arbitrary block of binary data to the remote machine. The block of data can have a command and id associated with it.
+
+ It is important to note that due to the fact the RenderDebug system is synchronized every single frame, it is strongly recommended
+ that you only use this feature for relatively small data items; probably on the order of a few megabytes at most. If you try to do
+ a very large transfer, in theory it would work, but it might take a very long time to complete and look like a hang since it will
+ essentially be blocking.
+
+ \param command An arbitrary command associated with this data transfer, for example this could indicate a remote file request.
+ \param id An arbitrary id associated with this data transfer, for example the id could be the file name of a file transfer request.
+ \param data The block of binary data to transmit, you are responsible for maintaining endian correctness of the internal data if necessary.
+ \param dlen The length of the lock of data to transmit.
+
+ \return Returns true if the data was queued to be transmitted, false if it failed.
+ */
+ virtual bool sendRemoteResource(const char *command,
+ const char *id,
+ const void *data,
+ uint32_t dlen)
+ {
+ bool ret = false;
+
+ if ( mClientServer )
+ {
+ ret = mClientServer->sendRemoteResource(command,id,data,dlen);
+ }
+
+ return ret;
+ }
+
+ /**
+ \brief This function allows you to request a file from the remote machine by name. If successful it will be returned via 'getRemoteData'
+
+ \param command The command field associated with this request which will be returned by 'getRemoteData'
+ \param fileName The filename being requested from the remote machine.
+
+ \return Returns true if the request was queued to be transmitted, false if it failed.
+ */
+ virtual bool requestRemoteResource(const char *command,
+ const char *fileName)
+ {
+ bool ret = false;
+
+ if ( mClientServer )
+ {
+ ret = mClientServer->requestRemoteResource(command,fileName);
+ }
+
+ return ret;
+ }
+
+ /**
+ \brief Retrieves a block of remotely transmitted binary data.
+
+ \param command A a reference to a pointer which will store the arbitrary command associated with this data transfer, for example this could indicate a remote file request.
+ \param id A reference to a pointer which will store an arbitrary id associated with this data transfer, for example the id could be the file name of a file transfer request.
+ \param dlen A reference that will contain length of the lock of data received.
+ \param remoteIsBigEndian A reference to a boolean which will be set to true if the remote machine that sent this data is big endian format.
+
+ \retrun A pointer to the block of data received.
+ */
+ virtual const void * getRemoteResource(const char *&command,
+ const char *&id,
+ uint32_t &dlen,
+ bool &remoteIsBigEndian)
+ {
+ const void *ret = NULL;
+
+ if ( mClientServer )
+ {
+ ret = mClientServer->getRemoteResource(command,id,dlen,remoteIsBigEndian);
+ }
+
+ return ret;
+ }
+
+
+ virtual RENDER_DEBUG::RenderDebug::RunMode getRunMode(void)
+ {
+ RENDER_DEBUG::RenderDebug::RunMode ret = RENDER_DEBUG::RenderDebug::RM_LOCAL;
+ if ( mClientServer )
+ {
+ if ( mClientServer->isServer() )
+ {
+ ret = RENDER_DEBUG::RenderDebug::RM_SERVER;
+ }
+ else
+ {
+ ret = RENDER_DEBUG::RenderDebug::RM_CLIENT;
+ }
+ }
+ else if ( mFileRenderDebug )
+ {
+ ret = RENDER_DEBUG::RenderDebug::RM_FILE;
+ }
+ return ret;
+ }
+
+ virtual bool isConnected(void) const
+ {
+ bool ret = false;
+
+ if ( mClientServer )
+ {
+ ret = mClientServer->isConnected();
+ }
+
+ return ret;
+ }
+
+ virtual uint32_t getCommunicationsFrame(void) const
+ {
+ return mClientServer ? mClientServer->getCommunicationsFrame() : 0;
+ }
+
+ virtual const char *getRemoteApplicationName(void)
+ {
+ const char *ret = NULL;
+
+ if ( mClientServer )
+ {
+ ret = mClientServer->getRemoteApplicationName();
+ }
+
+ return ret;
+ }
+
+ virtual RenderDebugTyped *getRenderDebugTyped(void)
+ {
+ return static_cast< RenderDebugTyped *>(mRenderDebug);
+ }
+
+ void readNextRemoteCommand(void)
+ {
+ if ( mPlaybackRemoteCommands == NULL ) return;
+ mPlaybackRemoteCommand.release(); // release previous command
+ mPlaybackRemoteCommand.mFrameNumber = mPlaybackRemoteCommands->readDword();
+ if ( mPlaybackRemoteCommand.mFrameNumber == 0 )
+ {
+ mPlaybackRemoteCommand.release();
+ delete mPlaybackRemoteCommands;
+ mPlaybackRemoteCommands = NULL;
+ }
+ else
+ {
+ mPlaybackRemoteCommand.mArgc = mPlaybackRemoteCommands->readDword();
+ for (uint32_t i=0; i<mPlaybackRemoteCommand.mArgc; i++)
+ {
+ uint32_t len = mPlaybackRemoteCommands->readDword();
+ mPlaybackRemoteCommand.mArgv[i] = static_cast<const char *>(PX_ALLOC(len,"PlaybackRemoteCommand"));
+ uint32_t rbytes = mPlaybackRemoteCommands->read(reinterpret_cast<void *>(const_cast<char*>(mPlaybackRemoteCommand.mArgv[i])),len);
+ if ( rbytes != len )
+ {
+ mPlaybackRemoteCommand.release();
+ delete mPlaybackRemoteCommands;
+ mPlaybackRemoteCommands = NULL;
+ }
+ }
+ }
+ }
+
+
+ /**
+ \brief Returns any incoming input event for processing purposes
+ */
+ virtual const InputEvent *getInputEvent(bool flush)
+ {
+ const InputEvent *ret = NULL;
+
+ if ( mClientServer )
+ {
+ ret = mClientServer->getInputEvent(flush);
+ }
+
+ return ret;
+ }
+
+ /**
+ \brief Set the base file name to record communications stream; or NULL to disable it.
+
+ \param fileName The base name of the file to record the communications channel stream to, or NULL to disable it.
+ */
+ virtual bool setStreamFilename(const char *fileName)
+ {
+ bool ret = false;
+ if ( mClientServer )
+ {
+ ret = mClientServer->setStreamFilename(fileName);
+ }
+ return ret;
+ }
+
+ /**
+ \brief Begin playing back a communications stream recording
+
+ \param fileName The name of the previously captured communications stream file
+ */
+ virtual bool setStreamPlayback(const char *fileName)
+ {
+ bool ret = false;
+ if ( mClientServer )
+ {
+ ret = mClientServer->setStreamPlayback(fileName);
+ }
+ return ret;
+ }
+
+ uint32_t mCurrentFrame;
+ uint32_t mMeshId;
+ physx::shdfnd::Mutex mMutex;
+ ClientServer *mClientServer;
+ RenderDebug::Desc mDesc;
+ bool mIsValid;
+ RENDER_DEBUG::RenderDebugInterface *mApexRenderDebug;
+ RENDER_DEBUG::RenderDebugImpl *mRenderDebug;
+ RENDER_DEBUG::FileRenderDebug *mFileRenderDebug;
+ RENDER_DEBUG::ProcessRenderDebug *mInternalProcessRenderDebug;
+ EchoRemoteCommand mCurrentCommand;
+ EchoRemoteCommandVector mEchoRemoteCommandBuffer;
+ GetArgs mParser;
+ physx::PsFileBuffer *mRecordRemoteCommands;
+ bool mEndianSwap;
+ physx::PsFileBuffer *mPlaybackRemoteCommands;
+ bool mReadNext;
+ PlaybackRemoteCommand mPlaybackRemoteCommand;
+};
+
+RENDER_DEBUG::RenderDebug *createRenderDebug(RENDER_DEBUG::RenderDebug::Desc &desc)
+{
+ RENDER_DEBUG::RenderDebug *ret = NULL;
+
+ if ( desc.versionNumber != RENDER_DEBUG_VERSION || desc.foundation == NULL)
+ {
+ return NULL;
+ }
+
+ RENDER_DEBUG::RenderDebugIImpl *c = PX_NEW(RENDER_DEBUG::RenderDebugIImpl)(desc);
+
+ if ( !c->isValid() )
+ {
+ c->release();
+ c = NULL;
+ }
+ else
+ {
+ ret = static_cast< RENDER_DEBUG::RenderDebug *>(c->getRenderDebugTyped());
+ }
+
+ return ret;
+}
+
+void finalRelease(RENDER_DEBUG::RenderDebugIImpl *nv)
+{
+ delete nv;
+}
+
+} // end of namespace
+
+
diff --git a/APEX_1.4/shared/general/RenderDebug/src/RenderDebugDLLMain.cpp b/APEX_1.4/shared/general/RenderDebug/src/RenderDebugDLLMain.cpp
new file mode 100644
index 00000000..ea60c43c
--- /dev/null
+++ b/APEX_1.4/shared/general/RenderDebug/src/RenderDebugDLLMain.cpp
@@ -0,0 +1,37 @@
+#include "RenderDebug.h"
+
+
+extern "C"
+#if PX_WINDOWS_FAMILY != 0
+__declspec(dllexport)
+#endif
+RENDER_DEBUG::RenderDebug* createRenderDebugExport(RENDER_DEBUG::RenderDebug::Desc &desc)
+{
+ return createRenderDebug(desc);
+}
+
+#if PX_WIN32 || PX_WIN64
+
+#include "windows/PsWindowsInclude.h"
+#pragma warning(disable:4100 4127)
+
+
+BOOL APIENTRY DllMain( HANDLE ,
+ DWORD ul_reason_for_call,
+ LPVOID )
+{
+ switch (ul_reason_for_call)
+ {
+ case DLL_PROCESS_ATTACH:
+ break;
+ case DLL_THREAD_ATTACH:
+ break;
+ case DLL_THREAD_DETACH:
+ break;
+ case DLL_PROCESS_DETACH:
+ break;
+ }
+ return TRUE;
+}
+#endif
+