diff options
| author | git perforce import user <a@b> | 2016-10-25 12:29:14 -0600 |
|---|---|---|
| committer | Sheikh Dawood Abdul Ajees <Sheikh Dawood Abdul Ajees> | 2016-10-25 18:56:37 -0500 |
| commit | 3dfe2108cfab31ba3ee5527e217d0d8e99a51162 (patch) | |
| tree | fa6485c169e50d7415a651bf838f5bcd0fd3bfbd /PhysX_3.4/Samples/SampleFramework | |
| download | physx-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 'PhysX_3.4/Samples/SampleFramework')
258 files changed, 52846 insertions, 0 deletions
diff --git a/PhysX_3.4/Samples/SampleFramework/framework/compiler/vc11win32/SampleFramework-MT.vcxproj b/PhysX_3.4/Samples/SampleFramework/framework/compiler/vc11win32/SampleFramework-MT.vcxproj new file mode 100644 index 00000000..55e4d7dd --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/framework/compiler/vc11win32/SampleFramework-MT.vcxproj @@ -0,0 +1,312 @@ +<?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="checked|Win32"> + <Configuration>checked</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="profile|Win32"> + <Configuration>profile</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{DEB7F8C6-4512-D660-4816-212EF0806A58}</ProjectGuid> + <RootNamespace>SampleFramework-MT</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)'=='checked|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> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup 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" /> + </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" /> + </ImportGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> + <OutDir>./../../lib/vc11win32\</OutDir> + <IntDir>./Win32/SampleFramework-MT/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> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FloatingPointModel>Fast</FloatingPointModel> + <BasicRuntimeChecks>UninitializedLocalUsageCheck</BasicRuntimeChecks> + <AdditionalOptions>/EHsc /D MEDIA_FROM_BIN=C:/b/b01118d57dac3ee2/distros/workPhysX-3.4.0_WINDOWS_SDK_Source/PhysX_3.4/../media /MP /Wall /wd4514 /wd4820 /wd4062 /wd4100 /wd4130 /wd4201 /wd4242 /wd4244 /wd4245 /wd4265 /wd4266 /wd4324 /wd4389 /wd4365 /wd4371 /wd4447 /wd4189 /wd4191 /wd4350 /wd4505 /wd4512 /wd4548 /wd4571 /wd4625 /wd4626 /wd4668 /wd4619 /wd4701 /wd4702 /wd4706 /wd4710 /wd4711 /wd4640 /wd4061 /wd4826 /wd4946 /wd4917 /wd4986 /wd4987 /d2Zi+</AdditionalOptions> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>./../../include;./../../../renderer/include;./../../../platform/include;./../../../../PxToolkit/include;./../../../../../../Externals/targa/1;./../../../../../../Externals/OpenAutomate/inc;./../../../../../Include;./../../../../../Source/Common/include;./../../../../../../PxShared/include;./../../../../../../PxShared/src/foundation/include;./../../../../../../PxShared/src/fastxml/include;./../../../../../../PxShared/src/pvd/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>PHYSX_PROFILE_SDK;WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;_DEBUG;PX_DEBUG=1;PX_CHECKED=1;PX_NVTX=1;PX_SUPPORT_PVD=1;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ExceptionHandling>false</ExceptionHandling> + <WarningLevel>Level4</WarningLevel> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeader>NotUsing</PrecompiledHeader> + <PrecompiledHeaderFile></PrecompiledHeaderFile> + <ProgramDataBaseFileName>$(TargetDir)\$(TargetName).pdb</ProgramDataBaseFileName> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Lib> + <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)$(ProjectName)DEBUG.lib</OutputFile> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <ProgramDatabaseFile>$(TargetDir)\$(TargetName).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>./Win32/SampleFramework-MT/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> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FloatingPointModel>Fast</FloatingPointModel> + <AdditionalOptions>/EHsc /D MEDIA_FROM_BIN=C:/b/b01118d57dac3ee2/distros/workPhysX-3.4.0_WINDOWS_SDK_Source/PhysX_3.4/../media /MP /Wall /wd4514 /wd4820 /wd4062 /wd4100 /wd4130 /wd4201 /wd4242 /wd4244 /wd4245 /wd4265 /wd4266 /wd4324 /wd4389 /wd4365 /wd4371 /wd4447 /wd4189 /wd4191 /wd4350 /wd4505 /wd4512 /wd4548 /wd4571 /wd4625 /wd4626 /wd4668 /wd4619 /wd4701 /wd4702 /wd4706 /wd4710 /wd4711 /wd4640 /wd4061 /wd4826 /wd4946 /wd4917 /wd4986 /wd4987 /d2Zi+</AdditionalOptions> + <Optimization>Full</Optimization> + <AdditionalIncludeDirectories>./../../include;./../../../renderer/include;./../../../platform/include;./../../../../PxToolkit/include;./../../../../../../Externals/targa/1;./../../../../../../Externals/OpenAutomate/inc;./../../../../../Include;./../../../../../Source/Common/include;./../../../../../../PxShared/include;./../../../../../../PxShared/src/foundation/include;./../../../../../../PxShared/src/fastxml/include;./../../../../../../PxShared/src/pvd/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>PHYSX_PROFILE_SDK;WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;NDEBUG;PX_SUPPORT_PVD=0;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ExceptionHandling>false</ExceptionHandling> + <WarningLevel>Level4</WarningLevel> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <PrecompiledHeader>NotUsing</PrecompiledHeader> + <PrecompiledHeaderFile></PrecompiledHeaderFile> + <ProgramDataBaseFileName>$(TargetDir)\$(TargetName).pdb</ProgramDataBaseFileName> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Lib> + <AdditionalOptions>/INCREMENTAL:NO</AdditionalOptions> + <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)$(ProjectName).lib</OutputFile> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <ProgramDatabaseFile>$(TargetDir)\$(TargetName).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>./Win32/SampleFramework-MT/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> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FloatingPointModel>Fast</FloatingPointModel> + <AdditionalOptions>/EHsc /D MEDIA_FROM_BIN=C:/b/b01118d57dac3ee2/distros/workPhysX-3.4.0_WINDOWS_SDK_Source/PhysX_3.4/../media /MP /Wall /wd4514 /wd4820 /wd4062 /wd4100 /wd4130 /wd4201 /wd4242 /wd4244 /wd4245 /wd4265 /wd4266 /wd4324 /wd4389 /wd4365 /wd4371 /wd4447 /wd4189 /wd4191 /wd4350 /wd4505 /wd4512 /wd4548 /wd4571 /wd4625 /wd4626 /wd4668 /wd4619 /wd4701 /wd4702 /wd4706 /wd4710 /wd4711 /wd4640 /wd4061 /wd4826 /wd4946 /wd4917 /wd4986 /wd4987 /d2Zi+</AdditionalOptions> + <Optimization>Full</Optimization> + <AdditionalIncludeDirectories>./../../include;./../../../renderer/include;./../../../platform/include;./../../../../PxToolkit/include;./../../../../../../Externals/targa/1;./../../../../../../Externals/OpenAutomate/inc;./../../../../../Include;./../../../../../Source/Common/include;./../../../../../../PxShared/include;./../../../../../../PxShared/src/foundation/include;./../../../../../../PxShared/src/fastxml/include;./../../../../../../PxShared/src/pvd/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>PHYSX_PROFILE_SDK;WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;NDEBUG;PX_CHECKED=1;PX_NVTX=1;PX_SUPPORT_PVD=1;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ExceptionHandling>false</ExceptionHandling> + <WarningLevel>Level4</WarningLevel> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <PrecompiledHeader>NotUsing</PrecompiledHeader> + <PrecompiledHeaderFile></PrecompiledHeaderFile> + <ProgramDataBaseFileName>$(TargetDir)\$(TargetName).pdb</ProgramDataBaseFileName> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Lib> + <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)$(ProjectName)CHECKED.lib</OutputFile> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <ProgramDatabaseFile>$(TargetDir)\$(TargetName).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>./Win32/SampleFramework-MT/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> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FloatingPointModel>Fast</FloatingPointModel> + <AdditionalOptions>/EHsc /D MEDIA_FROM_BIN=C:/b/b01118d57dac3ee2/distros/workPhysX-3.4.0_WINDOWS_SDK_Source/PhysX_3.4/../media /MP /Wall /wd4514 /wd4820 /wd4062 /wd4100 /wd4130 /wd4201 /wd4242 /wd4244 /wd4245 /wd4265 /wd4266 /wd4324 /wd4389 /wd4365 /wd4371 /wd4447 /wd4189 /wd4191 /wd4350 /wd4505 /wd4512 /wd4548 /wd4571 /wd4625 /wd4626 /wd4668 /wd4619 /wd4701 /wd4702 /wd4706 /wd4710 /wd4711 /wd4640 /wd4061 /wd4826 /wd4946 /wd4917 /wd4986 /wd4987 /d2Zi+</AdditionalOptions> + <Optimization>Full</Optimization> + <AdditionalIncludeDirectories>./../../include;./../../../renderer/include;./../../../platform/include;./../../../../PxToolkit/include;./../../../../../../Externals/targa/1;./../../../../../../Externals/OpenAutomate/inc;./../../../../../Include;./../../../../../Source/Common/include;./../../../../../../PxShared/include;./../../../../../../PxShared/src/foundation/include;./../../../../../../PxShared/src/fastxml/include;./../../../../../../PxShared/src/pvd/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>PHYSX_PROFILE_SDK;WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;NDEBUG;PX_PROFILE=1;PX_NVTX=1;PX_SUPPORT_PVD=1;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ExceptionHandling>false</ExceptionHandling> + <WarningLevel>Level4</WarningLevel> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <PrecompiledHeader>NotUsing</PrecompiledHeader> + <PrecompiledHeaderFile></PrecompiledHeaderFile> + <ProgramDataBaseFileName>$(TargetDir)\$(TargetName).pdb</ProgramDataBaseFileName> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Lib> + <AdditionalOptions>/INCREMENTAL:NO</AdditionalOptions> + <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)$(ProjectName)PROFILE.lib</OutputFile> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <ProgramDatabaseFile>$(TargetDir)\$(TargetName).pdb</ProgramDatabaseFile> + <TargetMachine>MachineX86</TargetMachine> + </Lib> + <ResourceCompile> + </ResourceCompile> + <ProjectReference> + <LinkLibraryDependencies>true</LinkLibraryDependencies> + </ProjectReference> + </ItemDefinitionGroup> + <ItemGroup> + <ClInclude Include="..\..\include\AgPerfMonEventDefs.h"> + </ClInclude> + <ClInclude Include="..\..\include\FrameworkFoundation.h"> + </ClInclude> + <ClInclude Include="..\..\include\ODBlock.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleActor.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleApplication.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleArray.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleAsset.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleAssetManager.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleCommandLine.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleDirManager.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleFilesystem.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleFrameworkInputEventIds.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleInputAsset.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleLineDebugRender.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleMaterialAsset.h"> + </ClInclude> + <ClInclude Include="..\..\include\SamplePointDebugRender.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleTextureAsset.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleTree.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleTriangleDebugRender.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleXml.h"> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\src\windows\WindowsSampleAssetManager.cpp"> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\src\nv_dds.h"> + </ClInclude> + <ClCompile Include="..\..\src\nv_dds.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\ODBlock.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\SampleApplication.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\SampleAsset.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\SampleAssetManager.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\SampleCommandLine.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\SampleDirManager.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\SampleInputAsset.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\SampleLineDebugRender.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\SampleMaterialAsset.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\SamplePointDebugRender.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\SampleTextureAsset.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\SampleTree.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\SampleTriangleDebugRender.cpp"> + </ClCompile> + <ClInclude Include="..\..\..\..\..\..\Externals\targa\1\targa.h"> + </ClInclude> + <ClCompile Include="..\..\..\..\..\..\Externals\targa\1\targa.cpp"> + </ClCompile> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"></ImportGroup> +</Project> diff --git a/PhysX_3.4/Samples/SampleFramework/framework/compiler/vc11win64/SampleFramework-MT.vcxproj b/PhysX_3.4/Samples/SampleFramework/framework/compiler/vc11win64/SampleFramework-MT.vcxproj new file mode 100644 index 00000000..9fb9f6e2 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/framework/compiler/vc11win64/SampleFramework-MT.vcxproj @@ -0,0 +1,308 @@ +<?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="checked|x64"> + <Configuration>checked</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="profile|x64"> + <Configuration>profile</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{DEB7F8C6-4512-D660-4816-212EF0806A58}</ProjectGuid> + <RootNamespace>SampleFramework-MT</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)'=='checked|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> + <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" /> + </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" /> + </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" /> + </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" /> + </ImportGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> + <OutDir>./../../lib/vc11win64\</OutDir> + <IntDir>./x64/SampleFramework-MT/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> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FloatingPointModel>Fast</FloatingPointModel> + <BasicRuntimeChecks>UninitializedLocalUsageCheck</BasicRuntimeChecks> + <AdditionalOptions>/EHsc /D MEDIA_FROM_BIN=C:/b/b01118d57dac3ee2/distros/workPhysX-3.4.0_WINDOWS_SDK_Source/PhysX_3.4/../media /MP /Wall /wd4514 /wd4820 /wd4062 /wd4100 /wd4130 /wd4201 /wd4242 /wd4244 /wd4245 /wd4265 /wd4266 /wd4324 /wd4389 /wd4365 /wd4371 /wd4447 /wd4189 /wd4191 /wd4350 /wd4505 /wd4512 /wd4548 /wd4571 /wd4625 /wd4626 /wd4668 /wd4619 /wd4701 /wd4702 /wd4706 /wd4710 /wd4711 /wd4640 /wd4061 /wd4826 /wd4946 /wd4917 /wd4986 /wd4987 /d2Zi+</AdditionalOptions> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>./../../include;./../../../renderer/include;./../../../platform/include;./../../../../PxToolkit/include;./../../../../../../Externals/targa/1;./../../../../../../Externals/OpenAutomate/inc;./../../../../../Include;./../../../../../Source/Common/include;./../../../../../../PxShared/include;./../../../../../../PxShared/src/foundation/include;./../../../../../../PxShared/src/fastxml/include;./../../../../../../PxShared/src/pvd/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>PHYSX_PROFILE_SDK;WIN32;WIN64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;_DEBUG;PX_DEBUG=1;PX_CHECKED=1;PX_NVTX=1;PX_SUPPORT_PVD=1;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ExceptionHandling>false</ExceptionHandling> + <WarningLevel>Level4</WarningLevel> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeader>NotUsing</PrecompiledHeader> + <PrecompiledHeaderFile></PrecompiledHeaderFile> + <ProgramDataBaseFileName>$(TargetDir)\$(TargetName).pdb</ProgramDataBaseFileName> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Lib> + <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)$(ProjectName)DEBUG.lib</OutputFile> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <ProgramDatabaseFile>$(TargetDir)\$(TargetName).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>./x64/SampleFramework-MT/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> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FloatingPointModel>Fast</FloatingPointModel> + <AdditionalOptions>/EHsc /D MEDIA_FROM_BIN=C:/b/b01118d57dac3ee2/distros/workPhysX-3.4.0_WINDOWS_SDK_Source/PhysX_3.4/../media /MP /Wall /wd4514 /wd4820 /wd4062 /wd4100 /wd4130 /wd4201 /wd4242 /wd4244 /wd4245 /wd4265 /wd4266 /wd4324 /wd4389 /wd4365 /wd4371 /wd4447 /wd4189 /wd4191 /wd4350 /wd4505 /wd4512 /wd4548 /wd4571 /wd4625 /wd4626 /wd4668 /wd4619 /wd4701 /wd4702 /wd4706 /wd4710 /wd4711 /wd4640 /wd4061 /wd4826 /wd4946 /wd4917 /wd4986 /wd4987 /d2Zi+</AdditionalOptions> + <Optimization>Full</Optimization> + <AdditionalIncludeDirectories>./../../include;./../../../renderer/include;./../../../platform/include;./../../../../PxToolkit/include;./../../../../../../Externals/targa/1;./../../../../../../Externals/OpenAutomate/inc;./../../../../../Include;./../../../../../Source/Common/include;./../../../../../../PxShared/include;./../../../../../../PxShared/src/foundation/include;./../../../../../../PxShared/src/fastxml/include;./../../../../../../PxShared/src/pvd/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>PHYSX_PROFILE_SDK;WIN32;WIN64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;NDEBUG;PX_SUPPORT_PVD=0;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ExceptionHandling>false</ExceptionHandling> + <WarningLevel>Level4</WarningLevel> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <PrecompiledHeader>NotUsing</PrecompiledHeader> + <PrecompiledHeaderFile></PrecompiledHeaderFile> + <ProgramDataBaseFileName>$(TargetDir)\$(TargetName).pdb</ProgramDataBaseFileName> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Lib> + <AdditionalOptions>/INCREMENTAL:NO</AdditionalOptions> + <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)$(ProjectName).lib</OutputFile> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <ProgramDatabaseFile>$(TargetDir)\$(TargetName).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>./x64/SampleFramework-MT/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> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FloatingPointModel>Fast</FloatingPointModel> + <AdditionalOptions>/EHsc /D MEDIA_FROM_BIN=C:/b/b01118d57dac3ee2/distros/workPhysX-3.4.0_WINDOWS_SDK_Source/PhysX_3.4/../media /MP /Wall /wd4514 /wd4820 /wd4062 /wd4100 /wd4130 /wd4201 /wd4242 /wd4244 /wd4245 /wd4265 /wd4266 /wd4324 /wd4389 /wd4365 /wd4371 /wd4447 /wd4189 /wd4191 /wd4350 /wd4505 /wd4512 /wd4548 /wd4571 /wd4625 /wd4626 /wd4668 /wd4619 /wd4701 /wd4702 /wd4706 /wd4710 /wd4711 /wd4640 /wd4061 /wd4826 /wd4946 /wd4917 /wd4986 /wd4987 /d2Zi+</AdditionalOptions> + <Optimization>Full</Optimization> + <AdditionalIncludeDirectories>./../../include;./../../../renderer/include;./../../../platform/include;./../../../../PxToolkit/include;./../../../../../../Externals/targa/1;./../../../../../../Externals/OpenAutomate/inc;./../../../../../Include;./../../../../../Source/Common/include;./../../../../../../PxShared/include;./../../../../../../PxShared/src/foundation/include;./../../../../../../PxShared/src/fastxml/include;./../../../../../../PxShared/src/pvd/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>PHYSX_PROFILE_SDK;WIN32;WIN64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;NDEBUG;PX_CHECKED=1;PX_NVTX=1;PX_SUPPORT_PVD=1;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ExceptionHandling>false</ExceptionHandling> + <WarningLevel>Level4</WarningLevel> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <PrecompiledHeader>NotUsing</PrecompiledHeader> + <PrecompiledHeaderFile></PrecompiledHeaderFile> + <ProgramDataBaseFileName>$(TargetDir)\$(TargetName).pdb</ProgramDataBaseFileName> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Lib> + <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)$(ProjectName)CHECKED.lib</OutputFile> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <ProgramDatabaseFile>$(TargetDir)\$(TargetName).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>./x64/SampleFramework-MT/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> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FloatingPointModel>Fast</FloatingPointModel> + <AdditionalOptions>/EHsc /D MEDIA_FROM_BIN=C:/b/b01118d57dac3ee2/distros/workPhysX-3.4.0_WINDOWS_SDK_Source/PhysX_3.4/../media /MP /Wall /wd4514 /wd4820 /wd4062 /wd4100 /wd4130 /wd4201 /wd4242 /wd4244 /wd4245 /wd4265 /wd4266 /wd4324 /wd4389 /wd4365 /wd4371 /wd4447 /wd4189 /wd4191 /wd4350 /wd4505 /wd4512 /wd4548 /wd4571 /wd4625 /wd4626 /wd4668 /wd4619 /wd4701 /wd4702 /wd4706 /wd4710 /wd4711 /wd4640 /wd4061 /wd4826 /wd4946 /wd4917 /wd4986 /wd4987 /d2Zi+</AdditionalOptions> + <Optimization>Full</Optimization> + <AdditionalIncludeDirectories>./../../include;./../../../renderer/include;./../../../platform/include;./../../../../PxToolkit/include;./../../../../../../Externals/targa/1;./../../../../../../Externals/OpenAutomate/inc;./../../../../../Include;./../../../../../Source/Common/include;./../../../../../../PxShared/include;./../../../../../../PxShared/src/foundation/include;./../../../../../../PxShared/src/fastxml/include;./../../../../../../PxShared/src/pvd/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>PHYSX_PROFILE_SDK;WIN32;WIN64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;NDEBUG;PX_PROFILE=1;PX_NVTX=1;PX_SUPPORT_PVD=1;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ExceptionHandling>false</ExceptionHandling> + <WarningLevel>Level4</WarningLevel> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <PrecompiledHeader>NotUsing</PrecompiledHeader> + <PrecompiledHeaderFile></PrecompiledHeaderFile> + <ProgramDataBaseFileName>$(TargetDir)\$(TargetName).pdb</ProgramDataBaseFileName> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Lib> + <AdditionalOptions>/INCREMENTAL:NO</AdditionalOptions> + <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)$(ProjectName)PROFILE.lib</OutputFile> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <ProgramDatabaseFile>$(TargetDir)\$(TargetName).pdb</ProgramDatabaseFile> + <TargetMachine>MachineX64</TargetMachine> + </Lib> + <ResourceCompile> + </ResourceCompile> + <ProjectReference> + <LinkLibraryDependencies>true</LinkLibraryDependencies> + </ProjectReference> + </ItemDefinitionGroup> + <ItemGroup> + <ClInclude Include="..\..\include\AgPerfMonEventDefs.h"> + </ClInclude> + <ClInclude Include="..\..\include\FrameworkFoundation.h"> + </ClInclude> + <ClInclude Include="..\..\include\ODBlock.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleActor.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleApplication.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleArray.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleAsset.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleAssetManager.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleCommandLine.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleDirManager.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleFilesystem.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleFrameworkInputEventIds.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleInputAsset.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleLineDebugRender.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleMaterialAsset.h"> + </ClInclude> + <ClInclude Include="..\..\include\SamplePointDebugRender.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleTextureAsset.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleTree.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleTriangleDebugRender.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleXml.h"> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\src\windows\WindowsSampleAssetManager.cpp"> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\src\nv_dds.h"> + </ClInclude> + <ClCompile Include="..\..\src\nv_dds.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\ODBlock.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\SampleApplication.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\SampleAsset.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\SampleAssetManager.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\SampleCommandLine.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\SampleDirManager.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\SampleInputAsset.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\SampleLineDebugRender.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\SampleMaterialAsset.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\SamplePointDebugRender.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\SampleTextureAsset.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\SampleTree.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\SampleTriangleDebugRender.cpp"> + </ClCompile> + <ClInclude Include="..\..\..\..\..\..\Externals\targa\1\targa.h"> + </ClInclude> + <ClCompile Include="..\..\..\..\..\..\Externals\targa\1\targa.cpp"> + </ClCompile> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"></ImportGroup> +</Project> diff --git a/PhysX_3.4/Samples/SampleFramework/framework/compiler/vc12win32/SampleFramework-MT.vcxproj b/PhysX_3.4/Samples/SampleFramework/framework/compiler/vc12win32/SampleFramework-MT.vcxproj new file mode 100644 index 00000000..90e523b0 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/framework/compiler/vc12win32/SampleFramework-MT.vcxproj @@ -0,0 +1,312 @@ +<?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="checked|Win32"> + <Configuration>checked</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="profile|Win32"> + <Configuration>profile</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{DEB7F8C6-4512-D660-4816-212EF0806A58}</ProjectGuid> + <RootNamespace>SampleFramework-MT</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)'=='checked|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> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup 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" /> + </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" /> + </ImportGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> + <OutDir>./../../lib/vc12win32\</OutDir> + <IntDir>./Win32/SampleFramework-MT/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> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FloatingPointModel>Fast</FloatingPointModel> + <BasicRuntimeChecks>UninitializedLocalUsageCheck</BasicRuntimeChecks> + <AdditionalOptions>/EHsc /D MEDIA_FROM_BIN=C:/b/b01118d57dac3ee2/distros/workPhysX-3.4.0_WINDOWS_SDK_Source/PhysX_3.4/../media /MP /Wall /wd4514 /wd4820 /wd4062 /wd4100 /wd4130 /wd4201 /wd4242 /wd4244 /wd4245 /wd4265 /wd4266 /wd4324 /wd4389 /wd4365 /wd4371 /wd4447 /wd4189 /wd4191 /wd4350 /wd4505 /wd4512 /wd4548 /wd4571 /wd4625 /wd4626 /wd4668 /wd4619 /wd4701 /wd4702 /wd4706 /wd4710 /wd4711 /wd4640 /wd4061 /wd4826 /wd4946 /wd4917 /wd4986 /wd4987 /d2Zi+</AdditionalOptions> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>./../../include;./../../../renderer/include;./../../../platform/include;./../../../../PxToolkit/include;./../../../../../../Externals/targa/1;./../../../../../../Externals/OpenAutomate/inc;./../../../../../Include;./../../../../../Source/Common/include;./../../../../../../PxShared/include;./../../../../../../PxShared/src/foundation/include;./../../../../../../PxShared/src/fastxml/include;./../../../../../../PxShared/src/pvd/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>PHYSX_PROFILE_SDK;WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;_DEBUG;PX_DEBUG=1;PX_CHECKED=1;PX_NVTX=1;PX_SUPPORT_PVD=1;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ExceptionHandling>false</ExceptionHandling> + <WarningLevel>Level4</WarningLevel> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeader>NotUsing</PrecompiledHeader> + <PrecompiledHeaderFile></PrecompiledHeaderFile> + <ProgramDataBaseFileName>$(TargetDir)\$(TargetName).pdb</ProgramDataBaseFileName> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Lib> + <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)$(ProjectName)DEBUG.lib</OutputFile> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <ProgramDatabaseFile>$(TargetDir)\$(TargetName).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>./Win32/SampleFramework-MT/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> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FloatingPointModel>Fast</FloatingPointModel> + <AdditionalOptions>/EHsc /D MEDIA_FROM_BIN=C:/b/b01118d57dac3ee2/distros/workPhysX-3.4.0_WINDOWS_SDK_Source/PhysX_3.4/../media /MP /Wall /wd4514 /wd4820 /wd4062 /wd4100 /wd4130 /wd4201 /wd4242 /wd4244 /wd4245 /wd4265 /wd4266 /wd4324 /wd4389 /wd4365 /wd4371 /wd4447 /wd4189 /wd4191 /wd4350 /wd4505 /wd4512 /wd4548 /wd4571 /wd4625 /wd4626 /wd4668 /wd4619 /wd4701 /wd4702 /wd4706 /wd4710 /wd4711 /wd4640 /wd4061 /wd4826 /wd4946 /wd4917 /wd4986 /wd4987 /d2Zi+</AdditionalOptions> + <Optimization>Full</Optimization> + <AdditionalIncludeDirectories>./../../include;./../../../renderer/include;./../../../platform/include;./../../../../PxToolkit/include;./../../../../../../Externals/targa/1;./../../../../../../Externals/OpenAutomate/inc;./../../../../../Include;./../../../../../Source/Common/include;./../../../../../../PxShared/include;./../../../../../../PxShared/src/foundation/include;./../../../../../../PxShared/src/fastxml/include;./../../../../../../PxShared/src/pvd/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>PHYSX_PROFILE_SDK;WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;NDEBUG;PX_SUPPORT_PVD=0;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ExceptionHandling>false</ExceptionHandling> + <WarningLevel>Level4</WarningLevel> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <PrecompiledHeader>NotUsing</PrecompiledHeader> + <PrecompiledHeaderFile></PrecompiledHeaderFile> + <ProgramDataBaseFileName>$(TargetDir)\$(TargetName).pdb</ProgramDataBaseFileName> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Lib> + <AdditionalOptions>/INCREMENTAL:NO</AdditionalOptions> + <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)$(ProjectName).lib</OutputFile> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <ProgramDatabaseFile>$(TargetDir)\$(TargetName).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>./Win32/SampleFramework-MT/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> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FloatingPointModel>Fast</FloatingPointModel> + <AdditionalOptions>/EHsc /D MEDIA_FROM_BIN=C:/b/b01118d57dac3ee2/distros/workPhysX-3.4.0_WINDOWS_SDK_Source/PhysX_3.4/../media /MP /Wall /wd4514 /wd4820 /wd4062 /wd4100 /wd4130 /wd4201 /wd4242 /wd4244 /wd4245 /wd4265 /wd4266 /wd4324 /wd4389 /wd4365 /wd4371 /wd4447 /wd4189 /wd4191 /wd4350 /wd4505 /wd4512 /wd4548 /wd4571 /wd4625 /wd4626 /wd4668 /wd4619 /wd4701 /wd4702 /wd4706 /wd4710 /wd4711 /wd4640 /wd4061 /wd4826 /wd4946 /wd4917 /wd4986 /wd4987 /d2Zi+</AdditionalOptions> + <Optimization>Full</Optimization> + <AdditionalIncludeDirectories>./../../include;./../../../renderer/include;./../../../platform/include;./../../../../PxToolkit/include;./../../../../../../Externals/targa/1;./../../../../../../Externals/OpenAutomate/inc;./../../../../../Include;./../../../../../Source/Common/include;./../../../../../../PxShared/include;./../../../../../../PxShared/src/foundation/include;./../../../../../../PxShared/src/fastxml/include;./../../../../../../PxShared/src/pvd/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>PHYSX_PROFILE_SDK;WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;NDEBUG;PX_CHECKED=1;PX_NVTX=1;PX_SUPPORT_PVD=1;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ExceptionHandling>false</ExceptionHandling> + <WarningLevel>Level4</WarningLevel> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <PrecompiledHeader>NotUsing</PrecompiledHeader> + <PrecompiledHeaderFile></PrecompiledHeaderFile> + <ProgramDataBaseFileName>$(TargetDir)\$(TargetName).pdb</ProgramDataBaseFileName> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Lib> + <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)$(ProjectName)CHECKED.lib</OutputFile> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <ProgramDatabaseFile>$(TargetDir)\$(TargetName).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>./Win32/SampleFramework-MT/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> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FloatingPointModel>Fast</FloatingPointModel> + <AdditionalOptions>/EHsc /D MEDIA_FROM_BIN=C:/b/b01118d57dac3ee2/distros/workPhysX-3.4.0_WINDOWS_SDK_Source/PhysX_3.4/../media /MP /Wall /wd4514 /wd4820 /wd4062 /wd4100 /wd4130 /wd4201 /wd4242 /wd4244 /wd4245 /wd4265 /wd4266 /wd4324 /wd4389 /wd4365 /wd4371 /wd4447 /wd4189 /wd4191 /wd4350 /wd4505 /wd4512 /wd4548 /wd4571 /wd4625 /wd4626 /wd4668 /wd4619 /wd4701 /wd4702 /wd4706 /wd4710 /wd4711 /wd4640 /wd4061 /wd4826 /wd4946 /wd4917 /wd4986 /wd4987 /d2Zi+</AdditionalOptions> + <Optimization>Full</Optimization> + <AdditionalIncludeDirectories>./../../include;./../../../renderer/include;./../../../platform/include;./../../../../PxToolkit/include;./../../../../../../Externals/targa/1;./../../../../../../Externals/OpenAutomate/inc;./../../../../../Include;./../../../../../Source/Common/include;./../../../../../../PxShared/include;./../../../../../../PxShared/src/foundation/include;./../../../../../../PxShared/src/fastxml/include;./../../../../../../PxShared/src/pvd/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>PHYSX_PROFILE_SDK;WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;NDEBUG;PX_PROFILE=1;PX_NVTX=1;PX_SUPPORT_PVD=1;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ExceptionHandling>false</ExceptionHandling> + <WarningLevel>Level4</WarningLevel> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <PrecompiledHeader>NotUsing</PrecompiledHeader> + <PrecompiledHeaderFile></PrecompiledHeaderFile> + <ProgramDataBaseFileName>$(TargetDir)\$(TargetName).pdb</ProgramDataBaseFileName> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Lib> + <AdditionalOptions>/INCREMENTAL:NO</AdditionalOptions> + <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)$(ProjectName)PROFILE.lib</OutputFile> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <ProgramDatabaseFile>$(TargetDir)\$(TargetName).pdb</ProgramDatabaseFile> + <TargetMachine>MachineX86</TargetMachine> + </Lib> + <ResourceCompile> + </ResourceCompile> + <ProjectReference> + <LinkLibraryDependencies>true</LinkLibraryDependencies> + </ProjectReference> + </ItemDefinitionGroup> + <ItemGroup> + <ClInclude Include="..\..\include\AgPerfMonEventDefs.h"> + </ClInclude> + <ClInclude Include="..\..\include\FrameworkFoundation.h"> + </ClInclude> + <ClInclude Include="..\..\include\ODBlock.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleActor.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleApplication.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleArray.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleAsset.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleAssetManager.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleCommandLine.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleDirManager.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleFilesystem.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleFrameworkInputEventIds.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleInputAsset.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleLineDebugRender.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleMaterialAsset.h"> + </ClInclude> + <ClInclude Include="..\..\include\SamplePointDebugRender.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleTextureAsset.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleTree.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleTriangleDebugRender.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleXml.h"> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\src\windows\WindowsSampleAssetManager.cpp"> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\src\nv_dds.h"> + </ClInclude> + <ClCompile Include="..\..\src\nv_dds.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\ODBlock.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\SampleApplication.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\SampleAsset.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\SampleAssetManager.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\SampleCommandLine.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\SampleDirManager.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\SampleInputAsset.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\SampleLineDebugRender.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\SampleMaterialAsset.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\SamplePointDebugRender.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\SampleTextureAsset.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\SampleTree.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\SampleTriangleDebugRender.cpp"> + </ClCompile> + <ClInclude Include="..\..\..\..\..\..\Externals\targa\1\targa.h"> + </ClInclude> + <ClCompile Include="..\..\..\..\..\..\Externals\targa\1\targa.cpp"> + </ClCompile> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"></ImportGroup> +</Project> diff --git a/PhysX_3.4/Samples/SampleFramework/framework/compiler/vc12win64/SampleFramework-MT.vcxproj b/PhysX_3.4/Samples/SampleFramework/framework/compiler/vc12win64/SampleFramework-MT.vcxproj new file mode 100644 index 00000000..80159fd1 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/framework/compiler/vc12win64/SampleFramework-MT.vcxproj @@ -0,0 +1,308 @@ +<?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="checked|x64"> + <Configuration>checked</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="profile|x64"> + <Configuration>profile</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{DEB7F8C6-4512-D660-4816-212EF0806A58}</ProjectGuid> + <RootNamespace>SampleFramework-MT</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)'=='checked|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> + <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" /> + </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" /> + </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" /> + </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" /> + </ImportGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> + <OutDir>./../../lib/vc12win64\</OutDir> + <IntDir>./x64/SampleFramework-MT/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> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FloatingPointModel>Fast</FloatingPointModel> + <BasicRuntimeChecks>UninitializedLocalUsageCheck</BasicRuntimeChecks> + <AdditionalOptions>/EHsc /D MEDIA_FROM_BIN=C:/b/b01118d57dac3ee2/distros/workPhysX-3.4.0_WINDOWS_SDK_Source/PhysX_3.4/../media /MP /Wall /wd4514 /wd4820 /wd4062 /wd4100 /wd4130 /wd4201 /wd4242 /wd4244 /wd4245 /wd4265 /wd4266 /wd4324 /wd4389 /wd4365 /wd4371 /wd4447 /wd4189 /wd4191 /wd4350 /wd4505 /wd4512 /wd4548 /wd4571 /wd4625 /wd4626 /wd4668 /wd4619 /wd4701 /wd4702 /wd4706 /wd4710 /wd4711 /wd4640 /wd4061 /wd4826 /wd4946 /wd4917 /wd4986 /wd4987 /d2Zi+</AdditionalOptions> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>./../../include;./../../../renderer/include;./../../../platform/include;./../../../../PxToolkit/include;./../../../../../../Externals/targa/1;./../../../../../../Externals/OpenAutomate/inc;./../../../../../Include;./../../../../../Source/Common/include;./../../../../../../PxShared/include;./../../../../../../PxShared/src/foundation/include;./../../../../../../PxShared/src/fastxml/include;./../../../../../../PxShared/src/pvd/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>PHYSX_PROFILE_SDK;WIN32;WIN64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;_DEBUG;PX_DEBUG=1;PX_CHECKED=1;PX_NVTX=1;PX_SUPPORT_PVD=1;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ExceptionHandling>false</ExceptionHandling> + <WarningLevel>Level4</WarningLevel> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeader>NotUsing</PrecompiledHeader> + <PrecompiledHeaderFile></PrecompiledHeaderFile> + <ProgramDataBaseFileName>$(TargetDir)\$(TargetName).pdb</ProgramDataBaseFileName> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Lib> + <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)$(ProjectName)DEBUG.lib</OutputFile> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <ProgramDatabaseFile>$(TargetDir)\$(TargetName).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>./x64/SampleFramework-MT/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> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FloatingPointModel>Fast</FloatingPointModel> + <AdditionalOptions>/EHsc /D MEDIA_FROM_BIN=C:/b/b01118d57dac3ee2/distros/workPhysX-3.4.0_WINDOWS_SDK_Source/PhysX_3.4/../media /MP /Wall /wd4514 /wd4820 /wd4062 /wd4100 /wd4130 /wd4201 /wd4242 /wd4244 /wd4245 /wd4265 /wd4266 /wd4324 /wd4389 /wd4365 /wd4371 /wd4447 /wd4189 /wd4191 /wd4350 /wd4505 /wd4512 /wd4548 /wd4571 /wd4625 /wd4626 /wd4668 /wd4619 /wd4701 /wd4702 /wd4706 /wd4710 /wd4711 /wd4640 /wd4061 /wd4826 /wd4946 /wd4917 /wd4986 /wd4987 /d2Zi+</AdditionalOptions> + <Optimization>Full</Optimization> + <AdditionalIncludeDirectories>./../../include;./../../../renderer/include;./../../../platform/include;./../../../../PxToolkit/include;./../../../../../../Externals/targa/1;./../../../../../../Externals/OpenAutomate/inc;./../../../../../Include;./../../../../../Source/Common/include;./../../../../../../PxShared/include;./../../../../../../PxShared/src/foundation/include;./../../../../../../PxShared/src/fastxml/include;./../../../../../../PxShared/src/pvd/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>PHYSX_PROFILE_SDK;WIN32;WIN64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;NDEBUG;PX_SUPPORT_PVD=0;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ExceptionHandling>false</ExceptionHandling> + <WarningLevel>Level4</WarningLevel> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <PrecompiledHeader>NotUsing</PrecompiledHeader> + <PrecompiledHeaderFile></PrecompiledHeaderFile> + <ProgramDataBaseFileName>$(TargetDir)\$(TargetName).pdb</ProgramDataBaseFileName> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Lib> + <AdditionalOptions>/INCREMENTAL:NO</AdditionalOptions> + <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)$(ProjectName).lib</OutputFile> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <ProgramDatabaseFile>$(TargetDir)\$(TargetName).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>./x64/SampleFramework-MT/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> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FloatingPointModel>Fast</FloatingPointModel> + <AdditionalOptions>/EHsc /D MEDIA_FROM_BIN=C:/b/b01118d57dac3ee2/distros/workPhysX-3.4.0_WINDOWS_SDK_Source/PhysX_3.4/../media /MP /Wall /wd4514 /wd4820 /wd4062 /wd4100 /wd4130 /wd4201 /wd4242 /wd4244 /wd4245 /wd4265 /wd4266 /wd4324 /wd4389 /wd4365 /wd4371 /wd4447 /wd4189 /wd4191 /wd4350 /wd4505 /wd4512 /wd4548 /wd4571 /wd4625 /wd4626 /wd4668 /wd4619 /wd4701 /wd4702 /wd4706 /wd4710 /wd4711 /wd4640 /wd4061 /wd4826 /wd4946 /wd4917 /wd4986 /wd4987 /d2Zi+</AdditionalOptions> + <Optimization>Full</Optimization> + <AdditionalIncludeDirectories>./../../include;./../../../renderer/include;./../../../platform/include;./../../../../PxToolkit/include;./../../../../../../Externals/targa/1;./../../../../../../Externals/OpenAutomate/inc;./../../../../../Include;./../../../../../Source/Common/include;./../../../../../../PxShared/include;./../../../../../../PxShared/src/foundation/include;./../../../../../../PxShared/src/fastxml/include;./../../../../../../PxShared/src/pvd/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>PHYSX_PROFILE_SDK;WIN32;WIN64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;NDEBUG;PX_CHECKED=1;PX_NVTX=1;PX_SUPPORT_PVD=1;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ExceptionHandling>false</ExceptionHandling> + <WarningLevel>Level4</WarningLevel> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <PrecompiledHeader>NotUsing</PrecompiledHeader> + <PrecompiledHeaderFile></PrecompiledHeaderFile> + <ProgramDataBaseFileName>$(TargetDir)\$(TargetName).pdb</ProgramDataBaseFileName> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Lib> + <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)$(ProjectName)CHECKED.lib</OutputFile> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <ProgramDatabaseFile>$(TargetDir)\$(TargetName).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>./x64/SampleFramework-MT/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> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FloatingPointModel>Fast</FloatingPointModel> + <AdditionalOptions>/EHsc /D MEDIA_FROM_BIN=C:/b/b01118d57dac3ee2/distros/workPhysX-3.4.0_WINDOWS_SDK_Source/PhysX_3.4/../media /MP /Wall /wd4514 /wd4820 /wd4062 /wd4100 /wd4130 /wd4201 /wd4242 /wd4244 /wd4245 /wd4265 /wd4266 /wd4324 /wd4389 /wd4365 /wd4371 /wd4447 /wd4189 /wd4191 /wd4350 /wd4505 /wd4512 /wd4548 /wd4571 /wd4625 /wd4626 /wd4668 /wd4619 /wd4701 /wd4702 /wd4706 /wd4710 /wd4711 /wd4640 /wd4061 /wd4826 /wd4946 /wd4917 /wd4986 /wd4987 /d2Zi+</AdditionalOptions> + <Optimization>Full</Optimization> + <AdditionalIncludeDirectories>./../../include;./../../../renderer/include;./../../../platform/include;./../../../../PxToolkit/include;./../../../../../../Externals/targa/1;./../../../../../../Externals/OpenAutomate/inc;./../../../../../Include;./../../../../../Source/Common/include;./../../../../../../PxShared/include;./../../../../../../PxShared/src/foundation/include;./../../../../../../PxShared/src/fastxml/include;./../../../../../../PxShared/src/pvd/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>PHYSX_PROFILE_SDK;WIN32;WIN64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;NDEBUG;PX_PROFILE=1;PX_NVTX=1;PX_SUPPORT_PVD=1;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ExceptionHandling>false</ExceptionHandling> + <WarningLevel>Level4</WarningLevel> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <PrecompiledHeader>NotUsing</PrecompiledHeader> + <PrecompiledHeaderFile></PrecompiledHeaderFile> + <ProgramDataBaseFileName>$(TargetDir)\$(TargetName).pdb</ProgramDataBaseFileName> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Lib> + <AdditionalOptions>/INCREMENTAL:NO</AdditionalOptions> + <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)$(ProjectName)PROFILE.lib</OutputFile> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <ProgramDatabaseFile>$(TargetDir)\$(TargetName).pdb</ProgramDatabaseFile> + <TargetMachine>MachineX64</TargetMachine> + </Lib> + <ResourceCompile> + </ResourceCompile> + <ProjectReference> + <LinkLibraryDependencies>true</LinkLibraryDependencies> + </ProjectReference> + </ItemDefinitionGroup> + <ItemGroup> + <ClInclude Include="..\..\include\AgPerfMonEventDefs.h"> + </ClInclude> + <ClInclude Include="..\..\include\FrameworkFoundation.h"> + </ClInclude> + <ClInclude Include="..\..\include\ODBlock.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleActor.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleApplication.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleArray.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleAsset.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleAssetManager.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleCommandLine.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleDirManager.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleFilesystem.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleFrameworkInputEventIds.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleInputAsset.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleLineDebugRender.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleMaterialAsset.h"> + </ClInclude> + <ClInclude Include="..\..\include\SamplePointDebugRender.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleTextureAsset.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleTree.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleTriangleDebugRender.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleXml.h"> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\src\windows\WindowsSampleAssetManager.cpp"> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\src\nv_dds.h"> + </ClInclude> + <ClCompile Include="..\..\src\nv_dds.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\ODBlock.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\SampleApplication.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\SampleAsset.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\SampleAssetManager.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\SampleCommandLine.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\SampleDirManager.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\SampleInputAsset.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\SampleLineDebugRender.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\SampleMaterialAsset.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\SamplePointDebugRender.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\SampleTextureAsset.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\SampleTree.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\SampleTriangleDebugRender.cpp"> + </ClCompile> + <ClInclude Include="..\..\..\..\..\..\Externals\targa\1\targa.h"> + </ClInclude> + <ClCompile Include="..\..\..\..\..\..\Externals\targa\1\targa.cpp"> + </ClCompile> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"></ImportGroup> +</Project> diff --git a/PhysX_3.4/Samples/SampleFramework/framework/compiler/vc14win32/SampleFramework-MT.vcxproj b/PhysX_3.4/Samples/SampleFramework/framework/compiler/vc14win32/SampleFramework-MT.vcxproj new file mode 100644 index 00000000..9ab08e68 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/framework/compiler/vc14win32/SampleFramework-MT.vcxproj @@ -0,0 +1,300 @@ +<?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="checked|Win32"> + <Configuration>checked</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="profile|Win32"> + <Configuration>profile</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{DEB7F8C6-4512-D660-4816-212EF0806A58}</ProjectGuid> + <RootNamespace>SampleFramework-MT</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)'=='checked|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> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup 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" /> + </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" /> + </ImportGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> + <OutDir>./../../lib/vc14win32\</OutDir> + <IntDir>./Win32/SampleFramework-MT/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> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FloatingPointModel>Fast</FloatingPointModel> + <BasicRuntimeChecks>UninitializedLocalUsageCheck</BasicRuntimeChecks> + <AdditionalOptions>/EHsc /D MEDIA_FROM_BIN=C:/b/b01118d57dac3ee2/distros/workPhysX-3.4.0_WINDOWS_SDK_Source/PhysX_3.4/../media /GR- /GF /arch:SSE2 /MP /Wall /wd4514 /wd4820 /wd4062 /wd4100 /wd4130 /wd4201 /wd4242 /wd4244 /wd4245 /wd4265 /wd4266 /wd4324 /wd4389 /wd4365 /wd4371 /wd4447 /wd4189 /wd4191 /wd4350 /wd4505 /wd4512 /wd4548 /wd4571 /wd4625 /wd4626 /wd4668 /wd4619 /wd4701 /wd4702 /wd4706 /wd4710 /wd4711 /wd4640 /wd4061 /wd4826 /wd4946 /wd4917 /wd4986 /wd4987 /wd4456 /wd4457 /wd4458 /wd4459 /wd4774 /wd4777 /wd5027 /wd5029 /wd4464 /Zi /d2Zi+</AdditionalOptions> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>./../../include;./../../../renderer/include;./../../../platform/include;./../../../../PxToolkit/include;./../../../../../../Externals/targa/1;./../../../../../../Externals/OpenAutomate/inc;./../../../../../Include;./../../../../../Source/Common/include;./../../../../../../PxShared/include;./../../../../../../PxShared/src/foundation/include;./../../../../../../PxShared/src/fastxml/include;./../../../../../../PxShared/src/pvd/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>PHYSX_PROFILE_SDK;WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;_DEBUG;PX_DEBUG=1;PX_CHECKED=1;PX_NVTX=1;PX_SUPPORT_PVD=1;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ExceptionHandling>false</ExceptionHandling> + <WarningLevel>Level4</WarningLevel> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeader>NotUsing</PrecompiledHeader> + <PrecompiledHeaderFile></PrecompiledHeaderFile> + <ProgramDataBaseFileName>$(TargetDir)\$(TargetName).pdb</ProgramDataBaseFileName> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Lib> + <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)$(ProjectName)DEBUG.lib</OutputFile> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <ProgramDatabaseFile>$(TargetDir)\$(TargetName).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>./Win32/SampleFramework-MT/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> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FloatingPointModel>Fast</FloatingPointModel> + <AdditionalOptions>/EHsc /D MEDIA_FROM_BIN=C:/b/b01118d57dac3ee2/distros/workPhysX-3.4.0_WINDOWS_SDK_Source/PhysX_3.4/../media /GR- /GF /arch:SSE2 /MP /Wall /wd4514 /wd4820 /wd4062 /wd4100 /wd4130 /wd4201 /wd4242 /wd4244 /wd4245 /wd4265 /wd4266 /wd4324 /wd4389 /wd4365 /wd4371 /wd4447 /wd4189 /wd4191 /wd4350 /wd4505 /wd4512 /wd4548 /wd4571 /wd4625 /wd4626 /wd4668 /wd4619 /wd4701 /wd4702 /wd4706 /wd4710 /wd4711 /wd4640 /wd4061 /wd4826 /wd4946 /wd4917 /wd4986 /wd4987 /wd4456 /wd4457 /wd4458 /wd4459 /wd4774 /wd4777 /wd5027 /wd5029 /wd4464 /d2Zi+</AdditionalOptions> + <Optimization>Full</Optimization> + <AdditionalIncludeDirectories>./../../include;./../../../renderer/include;./../../../platform/include;./../../../../PxToolkit/include;./../../../../../../Externals/targa/1;./../../../../../../Externals/OpenAutomate/inc;./../../../../../Include;./../../../../../Source/Common/include;./../../../../../../PxShared/include;./../../../../../../PxShared/src/foundation/include;./../../../../../../PxShared/src/fastxml/include;./../../../../../../PxShared/src/pvd/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>PHYSX_PROFILE_SDK;WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;NDEBUG;PX_SUPPORT_PVD=0;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ExceptionHandling>false</ExceptionHandling> + <WarningLevel>Level4</WarningLevel> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <PrecompiledHeader>NotUsing</PrecompiledHeader> + <PrecompiledHeaderFile></PrecompiledHeaderFile> + <ProgramDataBaseFileName>$(TargetDir)\$(TargetName).pdb</ProgramDataBaseFileName> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Lib> + <AdditionalOptions>/INCREMENTAL:NO</AdditionalOptions> + <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)$(ProjectName).lib</OutputFile> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <ProgramDatabaseFile>$(TargetDir)\$(TargetName).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>./Win32/SampleFramework-MT/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> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FloatingPointModel>Fast</FloatingPointModel> + <AdditionalOptions>/EHsc /D MEDIA_FROM_BIN=C:/b/b01118d57dac3ee2/distros/workPhysX-3.4.0_WINDOWS_SDK_Source/PhysX_3.4/../media /GR- /GF /arch:SSE2 /MP /Wall /wd4514 /wd4820 /wd4062 /wd4100 /wd4130 /wd4201 /wd4242 /wd4244 /wd4245 /wd4265 /wd4266 /wd4324 /wd4389 /wd4365 /wd4371 /wd4447 /wd4189 /wd4191 /wd4350 /wd4505 /wd4512 /wd4548 /wd4571 /wd4625 /wd4626 /wd4668 /wd4619 /wd4701 /wd4702 /wd4706 /wd4710 /wd4711 /wd4640 /wd4061 /wd4826 /wd4946 /wd4917 /wd4986 /wd4987 /wd4456 /wd4457 /wd4458 /wd4459 /wd4774 /wd4777 /wd5027 /wd5029 /wd4464 /d2Zi+</AdditionalOptions> + <Optimization>Full</Optimization> + <AdditionalIncludeDirectories>./../../include;./../../../renderer/include;./../../../platform/include;./../../../../PxToolkit/include;./../../../../../../Externals/targa/1;./../../../../../../Externals/OpenAutomate/inc;./../../../../../Include;./../../../../../Source/Common/include;./../../../../../../PxShared/include;./../../../../../../PxShared/src/foundation/include;./../../../../../../PxShared/src/fastxml/include;./../../../../../../PxShared/src/pvd/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>PHYSX_PROFILE_SDK;WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;NDEBUG;PX_CHECKED=1;PX_NVTX=1;PX_SUPPORT_PVD=1;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ExceptionHandling>false</ExceptionHandling> + <WarningLevel>Level4</WarningLevel> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <PrecompiledHeader>NotUsing</PrecompiledHeader> + <PrecompiledHeaderFile></PrecompiledHeaderFile> + <ProgramDataBaseFileName>$(TargetDir)\$(TargetName).pdb</ProgramDataBaseFileName> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Lib> + <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)$(ProjectName)CHECKED.lib</OutputFile> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <ProgramDatabaseFile>$(TargetDir)\$(TargetName).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>./Win32/SampleFramework-MT/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> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FloatingPointModel>Fast</FloatingPointModel> + <AdditionalOptions>/EHsc /D MEDIA_FROM_BIN=C:/b/b01118d57dac3ee2/distros/workPhysX-3.4.0_WINDOWS_SDK_Source/PhysX_3.4/../media /GR- /GF /arch:SSE2 /MP /Wall /wd4514 /wd4820 /wd4062 /wd4100 /wd4130 /wd4201 /wd4242 /wd4244 /wd4245 /wd4265 /wd4266 /wd4324 /wd4389 /wd4365 /wd4371 /wd4447 /wd4189 /wd4191 /wd4350 /wd4505 /wd4512 /wd4548 /wd4571 /wd4625 /wd4626 /wd4668 /wd4619 /wd4701 /wd4702 /wd4706 /wd4710 /wd4711 /wd4640 /wd4061 /wd4826 /wd4946 /wd4917 /wd4986 /wd4987 /wd4456 /wd4457 /wd4458 /wd4459 /wd4774 /wd4777 /wd5027 /wd5029 /wd4464 /d2Zi+</AdditionalOptions> + <Optimization>Full</Optimization> + <AdditionalIncludeDirectories>./../../include;./../../../renderer/include;./../../../platform/include;./../../../../PxToolkit/include;./../../../../../../Externals/targa/1;./../../../../../../Externals/OpenAutomate/inc;./../../../../../Include;./../../../../../Source/Common/include;./../../../../../../PxShared/include;./../../../../../../PxShared/src/foundation/include;./../../../../../../PxShared/src/fastxml/include;./../../../../../../PxShared/src/pvd/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>PHYSX_PROFILE_SDK;WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;NDEBUG;PX_PROFILE=1;PX_NVTX=1;PX_SUPPORT_PVD=1;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ExceptionHandling>false</ExceptionHandling> + <WarningLevel>Level4</WarningLevel> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <PrecompiledHeader>NotUsing</PrecompiledHeader> + <PrecompiledHeaderFile></PrecompiledHeaderFile> + <ProgramDataBaseFileName>$(TargetDir)\$(TargetName).pdb</ProgramDataBaseFileName> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Lib> + <AdditionalOptions>/INCREMENTAL:NO</AdditionalOptions> + <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)$(ProjectName)PROFILE.lib</OutputFile> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <ProgramDatabaseFile>$(TargetDir)\$(TargetName).pdb</ProgramDatabaseFile> + <TargetMachine>MachineX86</TargetMachine> + </Lib> + <ResourceCompile> + </ResourceCompile> + <ProjectReference> + <LinkLibraryDependencies>true</LinkLibraryDependencies> + </ProjectReference> + </ItemDefinitionGroup> + <ItemGroup> + <ClInclude Include="..\..\include\AgPerfMonEventDefs.h"> + </ClInclude> + <ClInclude Include="..\..\include\FrameworkFoundation.h"> + </ClInclude> + <ClInclude Include="..\..\include\ODBlock.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleActor.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleApplication.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleArray.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleAsset.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleAssetManager.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleCommandLine.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleDirManager.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleFilesystem.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleFrameworkInputEventIds.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleInputAsset.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleLineDebugRender.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleMaterialAsset.h"> + </ClInclude> + <ClInclude Include="..\..\include\SamplePointDebugRender.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleTextureAsset.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleTree.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleTriangleDebugRender.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleXml.h"> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\src\windows\WindowsSampleAssetManager.cpp"> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\src\nv_dds.h"> + </ClInclude> + <ClCompile Include="..\..\src\nv_dds.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\ODBlock.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\SampleApplication.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\SampleAsset.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\SampleAssetManager.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\SampleCommandLine.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\SampleDirManager.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\SampleInputAsset.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\SampleLineDebugRender.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\SampleMaterialAsset.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\SamplePointDebugRender.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\SampleTextureAsset.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\SampleTree.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\SampleTriangleDebugRender.cpp"> + </ClCompile> + <ClInclude Include="..\..\..\..\..\..\Externals\targa\1\targa.h"> + </ClInclude> + <ClCompile Include="..\..\..\..\..\..\Externals\targa\1\targa.cpp"> + </ClCompile> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"></ImportGroup> +</Project> diff --git a/PhysX_3.4/Samples/SampleFramework/framework/compiler/vc14win64/SampleFramework-MT.vcxproj b/PhysX_3.4/Samples/SampleFramework/framework/compiler/vc14win64/SampleFramework-MT.vcxproj new file mode 100644 index 00000000..f51431a6 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/framework/compiler/vc14win64/SampleFramework-MT.vcxproj @@ -0,0 +1,300 @@ +<?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="checked|x64"> + <Configuration>checked</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="profile|x64"> + <Configuration>profile</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{DEB7F8C6-4512-D660-4816-212EF0806A58}</ProjectGuid> + <RootNamespace>SampleFramework-MT</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)'=='checked|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> + <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" /> + </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" /> + </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" /> + </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" /> + </ImportGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> + <OutDir>./../../lib/vc14win64\</OutDir> + <IntDir>./x64/SampleFramework-MT/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> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FloatingPointModel>Fast</FloatingPointModel> + <BasicRuntimeChecks>UninitializedLocalUsageCheck</BasicRuntimeChecks> + <AdditionalOptions>/EHsc /D MEDIA_FROM_BIN=C:/b/b01118d57dac3ee2/distros/workPhysX-3.4.0_WINDOWS_SDK_Source/PhysX_3.4/../media /GR- /GF /MP /Wall /wd4514 /wd4820 /wd4062 /wd4100 /wd4130 /wd4201 /wd4242 /wd4244 /wd4245 /wd4265 /wd4266 /wd4324 /wd4389 /wd4365 /wd4371 /wd4447 /wd4189 /wd4191 /wd4350 /wd4505 /wd4512 /wd4548 /wd4571 /wd4625 /wd4626 /wd4668 /wd4619 /wd4701 /wd4702 /wd4706 /wd4710 /wd4711 /wd4640 /wd4061 /wd4826 /wd4946 /wd4917 /wd4986 /wd4987 /wd4456 /wd4457 /wd4458 /wd4459 /wd4774 /wd4777 /wd5027 /wd5029 /wd4464 /Zi /d2Zi+</AdditionalOptions> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>./../../include;./../../../renderer/include;./../../../platform/include;./../../../../PxToolkit/include;./../../../../../../Externals/targa/1;./../../../../../../Externals/OpenAutomate/inc;./../../../../../Include;./../../../../../Source/Common/include;./../../../../../../PxShared/include;./../../../../../../PxShared/src/foundation/include;./../../../../../../PxShared/src/fastxml/include;./../../../../../../PxShared/src/pvd/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>PHYSX_PROFILE_SDK;WIN32;WIN64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;_DEBUG;PX_DEBUG=1;PX_CHECKED=1;PX_NVTX=1;PX_SUPPORT_PVD=1;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ExceptionHandling>false</ExceptionHandling> + <WarningLevel>Level4</WarningLevel> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeader>NotUsing</PrecompiledHeader> + <PrecompiledHeaderFile></PrecompiledHeaderFile> + <ProgramDataBaseFileName>$(TargetDir)\$(TargetName).pdb</ProgramDataBaseFileName> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Lib> + <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)$(ProjectName)DEBUG.lib</OutputFile> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <ProgramDatabaseFile>$(TargetDir)\$(TargetName).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>./x64/SampleFramework-MT/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> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FloatingPointModel>Fast</FloatingPointModel> + <AdditionalOptions>/EHsc /D MEDIA_FROM_BIN=C:/b/b01118d57dac3ee2/distros/workPhysX-3.4.0_WINDOWS_SDK_Source/PhysX_3.4/../media /GR- /GF /MP /Wall /wd4514 /wd4820 /wd4062 /wd4100 /wd4130 /wd4201 /wd4242 /wd4244 /wd4245 /wd4265 /wd4266 /wd4324 /wd4389 /wd4365 /wd4371 /wd4447 /wd4189 /wd4191 /wd4350 /wd4505 /wd4512 /wd4548 /wd4571 /wd4625 /wd4626 /wd4668 /wd4619 /wd4701 /wd4702 /wd4706 /wd4710 /wd4711 /wd4640 /wd4061 /wd4826 /wd4946 /wd4917 /wd4986 /wd4987 /wd4456 /wd4457 /wd4458 /wd4459 /wd4774 /wd4777 /wd5027 /wd5029 /wd4464 /d2Zi+</AdditionalOptions> + <Optimization>Full</Optimization> + <AdditionalIncludeDirectories>./../../include;./../../../renderer/include;./../../../platform/include;./../../../../PxToolkit/include;./../../../../../../Externals/targa/1;./../../../../../../Externals/OpenAutomate/inc;./../../../../../Include;./../../../../../Source/Common/include;./../../../../../../PxShared/include;./../../../../../../PxShared/src/foundation/include;./../../../../../../PxShared/src/fastxml/include;./../../../../../../PxShared/src/pvd/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>PHYSX_PROFILE_SDK;WIN32;WIN64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;NDEBUG;PX_SUPPORT_PVD=0;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ExceptionHandling>false</ExceptionHandling> + <WarningLevel>Level4</WarningLevel> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <PrecompiledHeader>NotUsing</PrecompiledHeader> + <PrecompiledHeaderFile></PrecompiledHeaderFile> + <ProgramDataBaseFileName>$(TargetDir)\$(TargetName).pdb</ProgramDataBaseFileName> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Lib> + <AdditionalOptions>/INCREMENTAL:NO</AdditionalOptions> + <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)$(ProjectName).lib</OutputFile> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <ProgramDatabaseFile>$(TargetDir)\$(TargetName).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>./x64/SampleFramework-MT/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> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FloatingPointModel>Fast</FloatingPointModel> + <AdditionalOptions>/EHsc /D MEDIA_FROM_BIN=C:/b/b01118d57dac3ee2/distros/workPhysX-3.4.0_WINDOWS_SDK_Source/PhysX_3.4/../media /GR- /GF /MP /Wall /wd4514 /wd4820 /wd4062 /wd4100 /wd4130 /wd4201 /wd4242 /wd4244 /wd4245 /wd4265 /wd4266 /wd4324 /wd4389 /wd4365 /wd4371 /wd4447 /wd4189 /wd4191 /wd4350 /wd4505 /wd4512 /wd4548 /wd4571 /wd4625 /wd4626 /wd4668 /wd4619 /wd4701 /wd4702 /wd4706 /wd4710 /wd4711 /wd4640 /wd4061 /wd4826 /wd4946 /wd4917 /wd4986 /wd4987 /wd4456 /wd4457 /wd4458 /wd4459 /wd4774 /wd4777 /wd5027 /wd5029 /wd4464 /d2Zi+</AdditionalOptions> + <Optimization>Full</Optimization> + <AdditionalIncludeDirectories>./../../include;./../../../renderer/include;./../../../platform/include;./../../../../PxToolkit/include;./../../../../../../Externals/targa/1;./../../../../../../Externals/OpenAutomate/inc;./../../../../../Include;./../../../../../Source/Common/include;./../../../../../../PxShared/include;./../../../../../../PxShared/src/foundation/include;./../../../../../../PxShared/src/fastxml/include;./../../../../../../PxShared/src/pvd/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>PHYSX_PROFILE_SDK;WIN32;WIN64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;NDEBUG;PX_CHECKED=1;PX_NVTX=1;PX_SUPPORT_PVD=1;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ExceptionHandling>false</ExceptionHandling> + <WarningLevel>Level4</WarningLevel> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <PrecompiledHeader>NotUsing</PrecompiledHeader> + <PrecompiledHeaderFile></PrecompiledHeaderFile> + <ProgramDataBaseFileName>$(TargetDir)\$(TargetName).pdb</ProgramDataBaseFileName> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Lib> + <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)$(ProjectName)CHECKED.lib</OutputFile> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <ProgramDatabaseFile>$(TargetDir)\$(TargetName).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>./x64/SampleFramework-MT/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> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FloatingPointModel>Fast</FloatingPointModel> + <AdditionalOptions>/EHsc /D MEDIA_FROM_BIN=C:/b/b01118d57dac3ee2/distros/workPhysX-3.4.0_WINDOWS_SDK_Source/PhysX_3.4/../media /GR- /GF /MP /Wall /wd4514 /wd4820 /wd4062 /wd4100 /wd4130 /wd4201 /wd4242 /wd4244 /wd4245 /wd4265 /wd4266 /wd4324 /wd4389 /wd4365 /wd4371 /wd4447 /wd4189 /wd4191 /wd4350 /wd4505 /wd4512 /wd4548 /wd4571 /wd4625 /wd4626 /wd4668 /wd4619 /wd4701 /wd4702 /wd4706 /wd4710 /wd4711 /wd4640 /wd4061 /wd4826 /wd4946 /wd4917 /wd4986 /wd4987 /wd4456 /wd4457 /wd4458 /wd4459 /wd4774 /wd4777 /wd5027 /wd5029 /wd4464 /d2Zi+</AdditionalOptions> + <Optimization>Full</Optimization> + <AdditionalIncludeDirectories>./../../include;./../../../renderer/include;./../../../platform/include;./../../../../PxToolkit/include;./../../../../../../Externals/targa/1;./../../../../../../Externals/OpenAutomate/inc;./../../../../../Include;./../../../../../Source/Common/include;./../../../../../../PxShared/include;./../../../../../../PxShared/src/foundation/include;./../../../../../../PxShared/src/fastxml/include;./../../../../../../PxShared/src/pvd/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>PHYSX_PROFILE_SDK;WIN32;WIN64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;NDEBUG;PX_PROFILE=1;PX_NVTX=1;PX_SUPPORT_PVD=1;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ExceptionHandling>false</ExceptionHandling> + <WarningLevel>Level4</WarningLevel> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <PrecompiledHeader>NotUsing</PrecompiledHeader> + <PrecompiledHeaderFile></PrecompiledHeaderFile> + <ProgramDataBaseFileName>$(TargetDir)\$(TargetName).pdb</ProgramDataBaseFileName> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Lib> + <AdditionalOptions>/INCREMENTAL:NO</AdditionalOptions> + <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)$(ProjectName)PROFILE.lib</OutputFile> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <ProgramDatabaseFile>$(TargetDir)\$(TargetName).pdb</ProgramDatabaseFile> + <TargetMachine>MachineX64</TargetMachine> + </Lib> + <ResourceCompile> + </ResourceCompile> + <ProjectReference> + <LinkLibraryDependencies>true</LinkLibraryDependencies> + </ProjectReference> + </ItemDefinitionGroup> + <ItemGroup> + <ClInclude Include="..\..\include\AgPerfMonEventDefs.h"> + </ClInclude> + <ClInclude Include="..\..\include\FrameworkFoundation.h"> + </ClInclude> + <ClInclude Include="..\..\include\ODBlock.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleActor.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleApplication.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleArray.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleAsset.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleAssetManager.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleCommandLine.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleDirManager.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleFilesystem.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleFrameworkInputEventIds.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleInputAsset.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleLineDebugRender.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleMaterialAsset.h"> + </ClInclude> + <ClInclude Include="..\..\include\SamplePointDebugRender.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleTextureAsset.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleTree.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleTriangleDebugRender.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleXml.h"> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\src\windows\WindowsSampleAssetManager.cpp"> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\src\nv_dds.h"> + </ClInclude> + <ClCompile Include="..\..\src\nv_dds.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\ODBlock.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\SampleApplication.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\SampleAsset.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\SampleAssetManager.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\SampleCommandLine.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\SampleDirManager.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\SampleInputAsset.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\SampleLineDebugRender.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\SampleMaterialAsset.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\SamplePointDebugRender.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\SampleTextureAsset.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\SampleTree.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\SampleTriangleDebugRender.cpp"> + </ClCompile> + <ClInclude Include="..\..\..\..\..\..\Externals\targa\1\targa.h"> + </ClInclude> + <ClCompile Include="..\..\..\..\..\..\Externals\targa\1\targa.cpp"> + </ClCompile> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"></ImportGroup> +</Project> diff --git a/PhysX_3.4/Samples/SampleFramework/framework/include/AgPerfMonEventDefs.h b/PhysX_3.4/Samples/SampleFramework/framework/include/AgPerfMonEventDefs.h new file mode 100644 index 00000000..d5e3bfc7 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/framework/include/AgPerfMonEventDefs.h @@ -0,0 +1,103 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + + +// This file is used to define a list of AgPerfMon events. +// +// This file is included exclusively by AgPerfMonEventSrcAPI.h +// and by AgPerfMonEventSrcAPI.cpp, for the purpose of building +// an enumeration (enum xx) and an array of strings () +// that contain the list of events. +// +// This file should only contain event definitions, using the +// DEFINE_EVENT macro. E.g.: +// +// DEFINE_EVENT(sample_name_1) +// DEFINE_EVENT(sample_name_2) +// DEFINE_EVENT(sample_name_3) + + +// Statistics from the fluid mesh packet cooker +DEFINE_EVENT(renderFunction) +DEFINE_EVENT(SampleRendererVBwriteBuffer) +DEFINE_EVENT(SampleOnTickPreRender) +DEFINE_EVENT(SampleOnTickPostRender) +DEFINE_EVENT(SampleOnRender) +DEFINE_EVENT(SampleOnDraw) +DEFINE_EVENT(D3D9Renderer_createVertexBuffer) +DEFINE_EVENT(Renderer_render) +DEFINE_EVENT(Renderer_render_depthOnly) +DEFINE_EVENT(Renderer_render_deferred) +DEFINE_EVENT(Renderer_render_lit) +DEFINE_EVENT(Renderer_render_unlit) +DEFINE_EVENT(Renderer_renderMeshes) +DEFINE_EVENT(Renderer_renderDeferredLights) +DEFINE_EVENT(D3D9RendererMesh_renderIndices) +DEFINE_EVENT(D3D9RendererMesh_renderVertices) +DEFINE_EVENT(D3D9Renderer_createIndexBuffer) +DEFINE_EVENT(D3D9RendererMesh_renderVerticesInstanced) +DEFINE_EVENT(D3D9Renderer_createInstanceBuffer) +DEFINE_EVENT(D3D9Renderer_createTexture2D) +DEFINE_EVENT(D3D9Renderer_createTarget) +DEFINE_EVENT(D3D9Renderer_createMaterial) +DEFINE_EVENT(D3D9Renderer_createMesh) +DEFINE_EVENT(D3D9Renderer_createLight) +DEFINE_EVENT(D3D9RendererMesh_renderIndicesInstanced) +DEFINE_EVENT(OGLRenderer_createVertexBuffer) +DEFINE_EVENT(OGLRenderer_createIndexBuffer) +DEFINE_EVENT(OGLRenderer_createInstanceBuffer) +DEFINE_EVENT(OGLRenderer_createTexture2D) +DEFINE_EVENT(OGLRenderer_createTarget) +DEFINE_EVENT(OGLRenderer_createMaterial) +DEFINE_EVENT(OGLRenderer_createMesh) +DEFINE_EVENT(OGLRenderer_createLight) +DEFINE_EVENT(OGLRendererMaterial_compile_vertexProgram) +DEFINE_EVENT(OGLRendererMaterial_load_vertexProgram) +DEFINE_EVENT(OGLRendererMaterial_compile_fragmentProgram) +DEFINE_EVENT(OGLRendererMaterial_load_fragmentProgram) +DEFINE_EVENT(OGLRendererVertexBufferBind) +DEFINE_EVENT(OGLRendererSwapBuffers) +DEFINE_EVENT(writeBufferSemanticStride) +DEFINE_EVENT(writeBufferfixUV) +DEFINE_EVENT(writeBufferConvertFromApex) +DEFINE_EVENT(writeBufferGetFormatSemantic) +DEFINE_EVENT(writeBufferlockSemantic) +DEFINE_EVENT(OGLRendererVertexBufferLock) +DEFINE_EVENT(Renderer_meshRenderLast) +DEFINE_EVENT(Renderer_atEnd) +DEFINE_EVENT(renderMeshesBindMeshContext) +DEFINE_EVENT(renderMeshesFirstIf) +DEFINE_EVENT(renderMeshesSecondIf) +DEFINE_EVENT(renderMeshesThirdIf) +DEFINE_EVENT(renderMeshesForthIf) +DEFINE_EVENT(OGLRendererBindMeshContext) +DEFINE_EVENT(OGLRendererBindMeshcg) +DEFINE_EVENT(cgGLSetMatrixParameter) +DEFINE_EVENT(D3D9RenderVBlock) +DEFINE_EVENT(D3D9RenderVBunlock) +DEFINE_EVENT(D3D9RenderIBlock) +DEFINE_EVENT(D3D9RenderIBunlock) diff --git a/PhysX_3.4/Samples/SampleFramework/framework/include/FrameworkFoundation.h b/PhysX_3.4/Samples/SampleFramework/framework/include/FrameworkFoundation.h new file mode 100644 index 00000000..1a38a213 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/framework/include/FrameworkFoundation.h @@ -0,0 +1,56 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#ifndef FRAMEWORK_FOUNDATION_H +#define FRAMEWORK_FOUNDATION_H + +#include <stdio.h> +#include "foundation/PxPreprocessor.h" + +namespace physx +{ + namespace shdfnd{} +} + +namespace SampleFramework +{ + + using namespace physx; + namespace Fnd = physx::shdfnd; + typedef ::FILE File; + +} // namespace Renderer + +#include <foundation/PxSimpleTypes.h> +#include <foundation/PxVec3.h> +#include <foundation/PxMat33.h> +#include <foundation/PxMat44.h> +#include <foundation/PxTransform.h> +#include <foundation/PxBounds3.h> +#include <foundation/PxErrorCallback.h> + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/framework/include/ODBlock.h b/PhysX_3.4/Samples/SampleFramework/framework/include/ODBlock.h new file mode 100644 index 00000000..57191076 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/framework/include/ODBlock.h @@ -0,0 +1,168 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. +#ifndef ODBLOCK_H +#define ODBLOCK_H +/*----------------------------------------------------------------------------*\ +| +| Ageia PhysX Technology +| +| www.ageia.com +| +\*----------------------------------------------------------------------------*/ + +/* +ObjectDescription Scripts +-------------------------- +ODScript = Block +Statement = Block | Terminal +Block = indent '{' {Statement} '}' +Terminal = ident ';' + +Comments: + # = line comment + / * * / = multiline comment. The / character cannot be used in identifiers. + +idents may be enclosed in quotes, and should be unique to facilitate searching. + +In a typical application, program would look for known Blocks, and read out its user set terminal(s). +Particular users define semantics: + +SHIPFILE + { + Shipname + { + Client + { + ShipModel + { + MeshFile + { + Filename; + lodlevels; + } + Texturefile + { + Filename; + } + } + CockpitModel + { + ... + } + } + Server + { + ... + } + } + } +*/ +#include <stdio.h> +#include "FrameworkFoundation.h" +#include "SampleArray.h" + +#define OD_MAXID 30 //max identifier length +class ODBlock; +typedef SampleFramework::Array<ODBlock *> ODBlockList; + + +class ODBlock +/*-------------------------\ +| Block = indent '{' {Statement} '}' +| Terminals are simply empty blocks +| +| +\-------------------------*/ + { + class ODSyntaxError + { + public: + enum Error { ODSE_UNEX_QUOTE, ODSE_UNEX_OBRACE, ODSE_UNEX_CBRACE, ODSE_UNEX_LITERAL,ODSE_UNEX_EOF,ODSE_ENC_UNKNOWN }; + private: + Error err; + public: + ODSyntaxError(Error e) {err = e;} + const char * asString(); + }; + enum State {WAIT_IDENT,IDENT,WAIT_BLOCK,BLOCK}; + char identifier[128]; + unsigned identSize; //size of above array. + bool bTerminal; + ODBlockList subBlocks; + ODBlockList::Iterator termiter; //iterator for reading terminals + + + public: + ODBlock(); //create a new one + ~ODBlock(); + bool loadScript(SampleFramework::File* fp); + bool saveScript(SampleFramework::File* writeP, bool bQuote);//saves this block to scipt file. set bQuote == true if you want to machine parse output. + + //reading: + const char * ident(); + inline unsigned numSubBlocks() {return subBlocks.size(); }//returns number of sub blocks + bool isTerminal(); //resets to first statement returns false if its a terminal == no contained Blocks + + //writing: + void ident(const char *); //identifier of the block + void addStatement(ODBlock &); + + //queries: return true in success + ODBlock * getBlock(const char * identifier,bool bRecursiveSearch=false); //returns block with given identifier, or NULL. + + void reset(); //prepares to get first terminal or sub block of current block + + //getting terminals: + bool moreTerminals(); //returns true if more terminals are available + char * nextTerminal(); //returns a pointer to the next immediate terminal child of current block's identifier string. + + //getting terminals: + bool moreSubBlocks(); //returns true if more sub blocks (including terminals) are available + ODBlock * nextSubBlock(); //returns a pointer to the next sub block. + + // hig level macro functs, return true on success: (call for obj containing:) + bool getBlockInt(const char * ident, int* p = 0, unsigned count = 1); //reads blocks of form: ident{ 123;} + bool getBlockU32(const char * ident, physx::PxU32* p = 0, unsigned count = 1); //reads blocks of form: ident{ 123;} + + bool getBlockString(const char * ident, const char **); //of form: ident{abcdef;} + bool getBlockStrings(const char * ident, const char **, unsigned count); //of form: ident{abcdef; abcdef; ...} + + bool getBlockFloat(const char * ident, float * p = 0); //of form: ident{123.456;} + bool getBlockFloats(const char * ident, float *, unsigned count);//form: ident{12.3; 12.3; 12.3; ... }; + + bool addBlockFloats(const char * ident, float *, unsigned count); + bool addBlockInts(const char * ident, int *, unsigned count); + + //errors + static const char * lastError; + }; + + +#endif //ODBLOCK_H + diff --git a/PhysX_3.4/Samples/SampleFramework/framework/include/SampleActor.h b/PhysX_3.4/Samples/SampleFramework/framework/include/SampleActor.h new file mode 100644 index 00000000..9e909591 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/framework/include/SampleActor.h @@ -0,0 +1,54 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + + +#ifndef SAMPLE_ACTOR_H +#define SAMPLE_ACTOR_H + +#include "FrameworkFoundation.h" + +namespace SampleFramework +{ + + class SampleActor + { + public: + SampleActor(void) {} + virtual ~SampleActor(void) {} + + void release(void) { delete this; } + + public: + virtual void tick(float /*dtime*/, bool /*rewriteBuffers*/ = false) {} + virtual void render(bool /*rewriteBuffers*/ = false) {} + //virtual void render(const PxMat44 &eyeT) { render(); } // TODO: provide a version of render() with some info about the current scene like camera pose... + virtual int getType() { return -1; } + }; + +} // namespace SampleFramework + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/framework/include/SampleApplication.h b/PhysX_3.4/Samples/SampleFramework/framework/include/SampleApplication.h new file mode 100644 index 00000000..2d8cd1f1 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/framework/include/SampleApplication.h @@ -0,0 +1,183 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#ifndef SAMPLE_APPLICATION_H +#define SAMPLE_APPLICATION_H + +#include <Renderer.h> +#include <RendererWindow.h> +#include <RendererDesc.h> + +#include <FrameworkFoundation.h> + +#include <SampleAssetManager.h> +#include <PsTime.h> +#include <PsString.h> +#include "foundation/PxMat44.h" +#include <SampleUserInput.h> + +namespace physx { + class PxFoundation; +} + +#define SMOOTH_CAM + +namespace SampleFramework +{ + + class SampleCommandLine; + + template <typename T> + class Transform + { + public: + Transform() : m_dirty(true) {} + + void setForwardTransform( const T& t ) + { + m_fwd = t; + m_dirty = true; + } + + void setInverseTransform( const T& t ) + { + m_inv = t; + m_fwd = t.inverseRT(); + m_dirty = false; + } + + const T& getForwardTransform() const + { + return m_fwd; + } + + const T& getInverseTransform() const + { + if(m_dirty) + { + m_inv = m_fwd.inverseRT(); + m_dirty = false; + } + return m_inv; + } + + private: + T m_fwd; + mutable T m_inv; + mutable bool m_dirty; + }; + + class SampleApplication : public SampleRenderer::RendererWindow + { + public: + SampleApplication(const SampleCommandLine& cmdline, const char* assetPathPrefix="media", PxI32 camMoveButton = -1); + virtual ~SampleApplication(void); + SampleRenderer::Renderer* getRenderer(void) { return m_renderer; } + SampleAssetManager* getAssetManager(void) { return m_assetManager; } + inline const char* getAssetPathPrefix(void) const { return m_assetPathPrefix; } + + const PxMat44& getEyeTransform(void) const { return m_worldToView.getInverseTransform(); } + void setEyeTransform(const PxMat44& eyeTransform); + void setEyeTransform(const PxVec3& pos, const PxVec3& rot); + void setViewTransform(const PxMat44& viewTransform); + const PxMat44& getViewTransform(void) const; + + const SampleCommandLine& getCommandLine(void) const { return m_cmdline; } + + virtual void onInit(void) = 0; + virtual void onShutdown(void) = 0; + + virtual float tweakElapsedTime(float dtime) { return dtime; } + virtual void onTickPreRender(float dtime) = 0; + virtual void onRender(void) = 0; + virtual void onTickPostRender(float dtime) = 0; + + virtual void onOpen(void); + virtual bool onClose(void); + + virtual void onDraw(void); + + virtual void onAnalogInputEvent(const InputEvent& , float val); + virtual void onDigitalInputEvent(const InputEvent& , bool val); + virtual void onPointerInputEvent(const InputEvent&, physx::PxU32 x, physx::PxU32 y, physx::PxReal dx, physx::PxReal dy, bool val); + + virtual void rotateCamera(PxF32 dx, PxF32 dy); + virtual void moveCamera(PxF32 dx, PxF32 dy); + + virtual void doInput(void); + virtual void fatalError(const char * msg); + + virtual PxF32 getRotationSpeedScale(void) const { return m_rotationSpeedScale; } + virtual void setRotationSpeedScale(PxF32 scale) { m_rotationSpeedScale = scale; } + virtual PxF32 getMoveSpeedScale(void) const { return m_moveSpeedScale; } + virtual void setMoveSpeedScale(PxF32 scale) { m_moveSpeedScale = scale; } + + virtual bool getRightStickRotate(void) const { return m_rightStickRotate; } + virtual void setRightStickRotate(bool rsr) { m_rightStickRotate = rsr; } + + protected: + + virtual void setupRendererDescription(SampleRenderer::RendererDesc& renDesc); + + const SampleCommandLine& m_cmdline; + + PxF32 m_sceneSize; + + SampleRenderer::Renderer* m_renderer; + + char m_assetPathPrefix[256]; + SampleAssetManager* m_assetManager; + + PxVec3 m_eyeRot; + Transform<PxMat44> m_worldToView; + + PxI32 m_camMoveButton; + +#if defined(SMOOTH_CAM) + PxVec3 m_targetEyeRot; + PxVec3 m_targetEyePos; +#endif + physx::PxU64 m_timeCounter; + physx::shdfnd::Time m_time; + PxF32 m_lastDTime; + bool m_disableRendering; + + void* android_window_ptr; + PxF32 m_rotationSpeedScale; + PxF32 m_moveSpeedScale; + + bool m_rightStickRotate; + bool m_rewriteBuffers; + + private: + // get rid of C4512 + void operator=(const SampleApplication&); + }; + +} //namespace SampleFramework + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/framework/include/SampleArray.h b/PhysX_3.4/Samples/SampleFramework/framework/include/SampleArray.h new file mode 100644 index 00000000..e1c7a103 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/framework/include/SampleArray.h @@ -0,0 +1,48 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#ifndef SAMPLEFRAMEWORK_ARRAY +#define SAMPLEFRAMEWORK_ARRAY + +#include "PsArray.h" +#include "PsInlineArray.h" +#include "PsHashMap.h" +#include "PsAllocator.h" + +namespace SampleFramework +{ + template<typename T> + class Array : public physx::shdfnd::Array<T, physx::shdfnd::RawAllocator> + { + public: + PX_INLINE explicit Array() : physx::shdfnd::Array<T, physx::shdfnd::RawAllocator>() {} + PX_INLINE explicit Array(physx::PxU32 size, const T& a = T()) : physx::shdfnd::Array<T, physx::shdfnd::RawAllocator>(size, a) {} + }; +} + + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/framework/include/SampleAsset.h b/PhysX_3.4/Samples/SampleFramework/framework/include/SampleAsset.h new file mode 100644 index 00000000..597831a1 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/framework/include/SampleAsset.h @@ -0,0 +1,70 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#ifndef SAMPLE_ASSET_H +#define SAMPLE_ASSET_H + +#include "FrameworkFoundation.h" + +namespace SampleFramework +{ + + class SampleAsset + { + friend class SampleAssetManager; + public: + enum Type + { + ASSET_MATERIAL = 0, + ASSET_TEXTURE, + ASSET_INPUT, + + NUM_TYPES + }_Type; + + virtual bool isOk(void) const = 0; + + Type getType(void) const { return m_type; } + const char *getPath(void) const { return m_path; } + + protected: + SampleAsset(Type type, const char *path); + virtual ~SampleAsset(void); + + virtual void release(void) { delete this; } + + private: + SampleAsset &operator=(const SampleAsset&) { return *this; } + + const Type m_type; + char *m_path; + PxU32 m_numUsers; + }; + +} // namespace SampleFramework + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/framework/include/SampleAssetManager.h b/PhysX_3.4/Samples/SampleFramework/framework/include/SampleAssetManager.h new file mode 100644 index 00000000..167ad9b6 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/framework/include/SampleAssetManager.h @@ -0,0 +1,114 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + + +#ifndef SAMPLE_ASSET_MANAGER_H +#define SAMPLE_ASSET_MANAGER_H + +#include <stdio.h> +#include <vector> + +#include <SampleAsset.h> +#include <SampleTextureAsset.h> + +#include <RendererConfig.h> + + + +namespace SampleRenderer +{ + class Renderer; +} + +namespace SampleFramework +{ + class SampleAsset; + + class SampleAssetManager + { + public: + + class SampleAssetCreator { + public: + virtual ~SampleAssetCreator() {} + virtual SampleAsset* create(const char*, SampleAsset::Type) = 0; + }; + + public: + SampleAssetManager(SampleRenderer::Renderer &renderer, + SampleAssetCreator* fallbackAssetCreator = NULL); + ~SampleAssetManager(); + + SampleRenderer::Renderer& getRenderer() { return m_renderer; } + + SampleAsset* getAsset(const char* path, SampleAsset::Type type); + void returnAsset(SampleAsset& asset); + + protected: + SampleAsset* findAsset(const char* path); + SampleAsset* loadAsset(const char* path, SampleAsset::Type type); + void releaseAsset(SampleAsset& asset); + + void addAssetUser(SampleAsset& asset); + void addAsset(SampleAsset* asset); + void deleteAsset(SampleAsset* asset); + + SampleAsset* loadXMLAsset(File& file, const char* path); + SampleAsset* loadTextureAsset(File& file, const char* path, SampleTextureAsset::Type texType); + SampleAsset* loadODSAsset(File& file, const char* path); + + private: + SampleAssetManager& operator=(const SampleAssetManager&) { return *this; } + + protected: + SampleRenderer::Renderer& m_renderer; + SampleAssetCreator* m_fallbackAssetCreator; + std::vector<SampleAsset*> m_assets; + }; + + void addSearchPath(const char* path); + void clearSearchPaths(); + File* findFile(const char* path, bool binary = true); + const char* findPath(const char* path); + + /** + Search for the speficied path in the current directory. If not found, move up in the folder hierarchy + until the path can be found or until the specified maximum number of steps is reached. + + \note On consoles no recursive search will be done + + \param [in] path The path to look for + \param [out] buffer Buffer to store the (potentially) adjusted path + \param [in] bufferSize Size of buffer + \param [in] maxRecursion Maximum number steps to move up in the folder hierarchy + return true if path was found + */ + bool searchForPath(const char* path, char* buffer, int bufferSize, bool isReadOnly, int maxRecursion); + +} // namespace SampleFramework + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/framework/include/SampleCommandLine.h b/PhysX_3.4/Samples/SampleFramework/framework/include/SampleCommandLine.h new file mode 100644 index 00000000..3f65bace --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/framework/include/SampleCommandLine.h @@ -0,0 +1,98 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#ifndef SAMPLE_COMMANDLINE_H +#define SAMPLE_COMMANDLINE_H + +#include <assert.h> + +namespace SampleFramework +{ + + // Container for command-line arguments. + // This class assumes argument 0 is always the executable path! + class SampleCommandLine + { + public: + //! commandLineFilePathFallback is an optional fall-back to a configuration file containing command line arguments. + // Its contents are only processed and used if the other constructor arguments yield only an executable path. + // This is especially useful in the case of an Andriod platform, which does not support command line options. + // e.g. commandLineFilePathFallback = "commandline.txt" + // e.g. contents of commandline.txt = --argument1 --argument2 + + SampleCommandLine(unsigned int argc, const char *const* argv, const char * commandLineFilePathFallback = 0); + SampleCommandLine(const char *args, const char * commandLineFilePathFallback = 0); + ~SampleCommandLine(void); + + //! has a given command-line switch? + // e.g. s=="foo" checks for -foo + bool hasSwitch(const char *s, const unsigned int argNum = invalidArgNum) const; + + //! gets the value of a switch... + // e.g. s="foo" returns "bar" if '-foo=bar' is in the commandline. + const char* getValue(const char *s, unsigned int argNum = invalidArgNum) const; + + // return how many command line arguments there are + unsigned int getNumArgs(void) const; + + // what is the program name + const char* getProgramName(void) const; + + // get the string that contains the unsued args + unsigned int unusedArgsBufSize(void) const; + + // get the string that contains the unsued args + const char* getUnusedArgs(char *buf, unsigned int bufSize) const; + + //! if the first argument is the given command. + bool isCommand(const char *s) const; + + //! get the first argument assuming it isn't a switch. + // e.g. for the command-line "myapp.exe editor -foo" it will return "editor". + const char *getCommand(void) const; + + //! get the raw command-line argument list... + unsigned int getArgC(void) const { return m_argc; } + const char *const*getArgV(void) const { return m_argv; } + + //! whether or not an argument has been read already + bool isUsed(unsigned int argNum) const; + + private: + SampleCommandLine(const SampleCommandLine&); + SampleCommandLine(void); + SampleCommandLine operator=(const SampleCommandLine&); + void initCommon(const char * commandLineFilePathFallback); + unsigned int m_argc; + const char *const *m_argv; + void *m_freeme; + static const unsigned int invalidArgNum = 0xFFFFFFFFU; + bool* m_argUsed; + }; + +} // namespace SampleFramework + +#endif // SAMPLE_COMMANDLINE_H diff --git a/PhysX_3.4/Samples/SampleFramework/framework/include/SampleDirManager.h b/PhysX_3.4/Samples/SampleFramework/framework/include/SampleDirManager.h new file mode 100644 index 00000000..c1ad3804 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/framework/include/SampleDirManager.h @@ -0,0 +1,48 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#ifndef SAMPLE_DIR_MANAGER_H +#define SAMPLE_DIR_MANAGER_H + +namespace SampleFramework +{ + class SampleDirManager + { + public: + SampleDirManager(const char* relativePathRoot, bool isReadOnly = true, int maxRecursion = 20); + + public: + const char* getPathRoot() const { return mPathRoot; } + const char* getFilePath(const char* relativeFilePath, char* pathBuffer, bool testFileValidity = true); + + private: + char mPathRoot[256]; + bool mIsReadOnly; + }; +} + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/framework/include/SampleFilesystem.h b/PhysX_3.4/Samples/SampleFramework/framework/include/SampleFilesystem.h new file mode 100644 index 00000000..85d8d788 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/framework/include/SampleFilesystem.h @@ -0,0 +1,59 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + + +#ifndef SAMPLE_FILESYSTEM_H +#define SAMPLE_FILESYSTEM_H + +#include "FrameworkFoundation.h" + +#error "Is this file ever used?" + +namespace SampleFramework +{ + + /*class SampleStream : public PxFileBuf + { + + }; + + class SampleFilesystem + { + public: + SampleFilesystem(const char *pathPrefix = "../../../../../externals/"); + ~SampleFilesystem(void); + + SampleStream *openStream(const char *path); + void closeStream(SampleStream &stream); + + private: + char *m_pathPrefix; + }; + */ +} + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/framework/include/SampleFrameworkInputEventIds.h b/PhysX_3.4/Samples/SampleFramework/framework/include/SampleFrameworkInputEventIds.h new file mode 100644 index 00000000..b087f991 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/framework/include/SampleFrameworkInputEventIds.h @@ -0,0 +1,92 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#ifndef SAMPLE_FRAMEWORK_INPUT_EVENT_IDS_H +#define SAMPLE_FRAMEWORK_INPUT_EVENT_IDS_H + +static const float GAMEPAD_ROTATE_SENSITIVITY = 0.7f; +static const float GAMEPAD_DEFAULT_SENSITIVITY = 1.0f; + +// InputEvents used by SampleApplication +enum SampleFrameworkInputEventIds +{ + 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, + + NUM_SAMPLE_FRAMEWORK_INPUT_EVENT_IDS, +}; + +// InputEvent descriptions used by SampleApplication +const char* const SampleFrameworkInputEventDescriptions[] = +{ + "change the camera speed", + "move the camera left", + "move the camera right", + "move the camera up", + "move the camera down", + "move the camera forward", + "move the camera backward", + "increase the camera move speed", + "decrease the camera move speed", + + "look around with the camera", + "enable looking around with the camera", + + "look left and right with the camera", + "look up and down look with the camera", + "move the camera left and right", + "move the camera forward and backward", + + "jump", + "crouch", + "next controller", + "previous controller", +}; + +PX_COMPILE_TIME_ASSERT(PX_ARRAY_SIZE(SampleFrameworkInputEventDescriptions) == NUM_SAMPLE_FRAMEWORK_INPUT_EVENT_IDS); + +#endif + diff --git a/PhysX_3.4/Samples/SampleFramework/framework/include/SampleInputAsset.h b/PhysX_3.4/Samples/SampleFramework/framework/include/SampleInputAsset.h new file mode 100644 index 00000000..cf43aa0e --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/framework/include/SampleInputAsset.h @@ -0,0 +1,67 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + + +#ifndef SAMPLE_INPUT_ASSET_H +#define SAMPLE_INPUT_ASSET_H + + +#include <SampleAssetManager.h> +#include <SampleAsset.h> +#include <SampleUserInput.h> +#include <ODBlock.h> + +namespace SampleFramework +{ + + class SampleInputAsset : public SampleAsset + { + friend class SampleAssetManager; + protected: + SampleInputAsset(File* file, const char *path); + virtual ~SampleInputAsset(void); + + public: + virtual bool isOk(void) const; + + const T_SampleInputData& GetSampleInputData() const { return m_SampleInputData; } + + private: + void LoadData(ODBlock* odsSettings); + + private: + T_SampleInputData m_SampleInputData; + ODBlock* m_SettingsBlock; + ODBlock m_Mapping; + File* m_File; + }; + +} // namespace SampleFramework + + + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/framework/include/SampleLineDebugRender.h b/PhysX_3.4/Samples/SampleFramework/framework/include/SampleLineDebugRender.h new file mode 100644 index 00000000..e69f2fa1 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/framework/include/SampleLineDebugRender.h @@ -0,0 +1,89 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + + +#ifndef SAMPLE_LINE_DEBUG_RENDER_H +#define SAMPLE_LINE_DEBUG_RENDER_H + +#include <RendererMeshContext.h> + +#include <FrameworkFoundation.h> + +namespace SampleRenderer +{ + class Renderer; + class RendererColor; + class RendererVertexBuffer; +} + +namespace SampleFramework +{ + + class SampleAssetManager; + class SampleMaterialAsset; + + class SampleLineDebugRender + { + public: + void addLine(const PxVec3 &p0, const PxVec3 &p1, const SampleRenderer::RendererColor &color); + void checkResizeLine(PxU32 maxVerts); + void queueForRenderLine(void); + void clearLine(void); + protected: + SampleLineDebugRender(SampleRenderer::Renderer &renderer, SampleAssetManager &assetmanager); + virtual ~SampleLineDebugRender(void); + + private: + void checkLock(void); + void checkUnlock(void); + void addVert(const PxVec3 &p, const SampleRenderer::RendererColor &color); + + private: + SampleLineDebugRender &operator=(const SampleLineDebugRender&) { return *this; } + + private: + SampleRenderer::Renderer &m_renderer; + SampleAssetManager &m_assetmanager; + + SampleMaterialAsset *m_material; + + PxU32 m_maxVerts; + PxU32 m_numVerts; + SampleRenderer::RendererVertexBuffer *m_vertexbuffer; + SampleRenderer::RendererMesh *m_mesh; + SampleRenderer::RendererMeshContext m_meshContext; + + void *m_lockedPositions; + PxU32 m_positionStride; + + void *m_lockedColors; + PxU32 m_colorStride; + }; + +} // namespace SampleFramework + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/framework/include/SampleMaterialAsset.h b/PhysX_3.4/Samples/SampleFramework/framework/include/SampleMaterialAsset.h new file mode 100644 index 00000000..bcce930d --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/framework/include/SampleMaterialAsset.h @@ -0,0 +1,81 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + + +#ifndef SAMPLE_MATERIAL_ASSET_H +#define SAMPLE_MATERIAL_ASSET_H + +#include <SampleAsset.h> +#include <vector> + +namespace FAST_XML +{ + class xml_node; +} + +namespace SampleRenderer +{ + class RendererMaterial; + class RendererMaterialInstance; +} + +namespace SampleFramework +{ + class SampleAssetManager; + + class SampleMaterialAsset : public SampleAsset + { + friend class SampleAssetManager; + protected: + SampleMaterialAsset(SampleAssetManager &assetManager, FAST_XML::xml_node &xmlroot, const char *path); + SampleMaterialAsset(SampleAssetManager &assetManager, Type type, const char *path); + virtual ~SampleMaterialAsset(void); + + public: + size_t getNumVertexShaders() const; + SampleRenderer::RendererMaterial *getMaterial(size_t vertexShaderIndex = 0); + SampleRenderer::RendererMaterialInstance *getMaterialInstance(size_t vertexShaderIndex = 0); + unsigned int getMaxBones(size_t vertexShaderIndex) const; + + public: + virtual bool isOk(void) const; + + protected: + SampleAssetManager &m_assetManager; + struct MaterialStruct + { + SampleRenderer::RendererMaterial *m_material; + SampleRenderer::RendererMaterialInstance *m_materialInstance; + unsigned int m_maxBones; + }; + std::vector<MaterialStruct> m_vertexShaders; + std::vector<SampleAsset*> m_assets; + }; + +} // namespace SampleFramework + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/framework/include/SamplePointDebugRender.h b/PhysX_3.4/Samples/SampleFramework/framework/include/SamplePointDebugRender.h new file mode 100644 index 00000000..46cba14a --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/framework/include/SamplePointDebugRender.h @@ -0,0 +1,88 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + + +#ifndef SAMPLE_POINT_DEBUG_RENDER_H +#define SAMPLE_POINT_DEBUG_RENDER_H + +#include <RendererMeshContext.h> +#include <FrameworkFoundation.h> + +namespace SampleRenderer +{ + class Renderer; + class RendererColor; + class RendererVertexBuffer; +} + +namespace SampleFramework +{ + class SampleAssetManager; + class SampleMaterialAsset; + + class SamplePointDebugRender + { + public: + void addPoint(const PxVec3 &p0, const SampleRenderer::RendererColor &color); + + void queueForRenderPoint(void); + + protected: + SamplePointDebugRender(SampleRenderer::Renderer &renderer, SampleAssetManager &assetmanager); + virtual ~SamplePointDebugRender(void); + + void checkResizePoint(PxU32 maxVerts); + void clearPoint(void); + + private: + void checkLock(void); + void checkUnlock(void); + void addVert(const PxVec3 &p, const SampleRenderer::RendererColor &color); + + SamplePointDebugRender &operator=(const SamplePointDebugRender&) { return *this; } + + SampleRenderer::Renderer &m_renderer; + SampleAssetManager &m_assetmanager; + + SampleMaterialAsset *m_material; + + PxU32 m_maxVerts; + PxU32 m_numVerts; + SampleRenderer::RendererVertexBuffer *m_vertexbuffer; + SampleRenderer::RendererMesh *m_mesh; + SampleRenderer::RendererMeshContext m_meshContext; + + void *m_lockedPositions; + PxU32 m_positionStride; + + void *m_lockedColors; + PxU32 m_colorStride; + }; + +} // namespace SampleFramework + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/framework/include/SampleTextureAsset.h b/PhysX_3.4/Samples/SampleFramework/framework/include/SampleTextureAsset.h new file mode 100644 index 00000000..78efeb62 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/framework/include/SampleTextureAsset.h @@ -0,0 +1,81 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + + +#ifndef SAMPLE_TEXTURE_ASSET_H +#define SAMPLE_TEXTURE_ASSET_H + +#include <stdio.h> + +#include <SampleAsset.h> + +namespace SampleRenderer +{ + class Renderer; + class RendererTexture; +} + +namespace SampleFramework +{ + + class SampleTextureAsset : public SampleAsset + { + friend class SampleAssetManager; + + public: + enum Type + { + DDS, + TGA, + BMP, + PVR, + TEXTURE_FILE_TYPE_COUNT, + }; + + public: + SampleTextureAsset(SampleRenderer::Renderer &renderer, File &file, const char *path, Type texType); + virtual ~SampleTextureAsset(void); + + public: + SampleRenderer::RendererTexture *getTexture(void); + const SampleRenderer::RendererTexture *getTexture(void) const; + + public: + virtual bool isOk(void) const; + + private: + void loadDDS(SampleRenderer::Renderer &renderer, File &file); + void loadTGA(SampleRenderer::Renderer &renderer, File &file); + void loadPVR(SampleRenderer::Renderer &renderer, File &file); + void loadBMP(SampleRenderer::Renderer &renderer, File &file); + + SampleRenderer::RendererTexture *m_texture; + }; + +} // namespace SampleFramework + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/framework/include/SampleTree.h b/PhysX_3.4/Samples/SampleFramework/framework/include/SampleTree.h new file mode 100644 index 00000000..0e6aca5a --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/framework/include/SampleTree.h @@ -0,0 +1,83 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#ifndef SAMPLE_TREE_H +#define SAMPLE_TREE_H + +#include "foundation/Px.h" + +namespace SampleFramework +{ + +class Tree +{ +public: + class Node + { + public: + Node() : mParent(NULL), mHead(NULL), mTail(NULL), mPrev(NULL), mNext(NULL) + { + } + + private: + Node(const Node& node); + Node& operator=(const Node& node); + + public: + PX_FORCE_INLINE bool isRoot() const { return NULL == mParent; } + PX_FORCE_INLINE bool isLeaf() const { return NULL == mHead; } + + PX_FORCE_INLINE Node* getParent() const { return mParent; } + PX_FORCE_INLINE Node* getFirstChild() const { return mHead; } + PX_FORCE_INLINE Node* getLastChild() const { return mTail; } + PX_FORCE_INLINE Node* getPrevSibling() const { return mPrev; } + PX_FORCE_INLINE Node* getNextSibling() const { return mNext; } + + PX_FORCE_INLINE Node* getFirstLeaf() const { return NULL == mHead ? const_cast<Node*>(this) : mHead->getFirstLeaf(); } + PX_FORCE_INLINE Node* getLastLeaf() const { return NULL == mTail ? const_cast<Node*>(this) : mTail->getLastLeaf(); } + + bool isOffspringOf(const Node& node) const + { + return (this == &node) || (NULL != mParent && mParent->isOffspringOf(node)); + } + + public: + bool appendChild(Node& node); + bool removeChild(Node& node); + + private: + Node* mParent; + Node* mHead; + Node* mTail; + Node* mPrev; + Node* mNext; + }; +}; + +} // namespace SampleFramework + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/framework/include/SampleTriangleDebugRender.h b/PhysX_3.4/Samples/SampleFramework/framework/include/SampleTriangleDebugRender.h new file mode 100644 index 00000000..e65710dd --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/framework/include/SampleTriangleDebugRender.h @@ -0,0 +1,95 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + + +#ifndef SAMPLE_TRIANGLE_DEBUG_RENDER_H +#define SAMPLE_TRIANGLE_DEBUG_RENDER_H + +#include <RendererMeshContext.h> +#include <FrameworkFoundation.h> + +namespace SampleRenderer +{ + class Renderer; + class RendererColor; + class RendererVertexBuffer; +} + +namespace SampleFramework +{ + + class SampleAssetManager; + class SampleMaterialAsset; + + class SampleTriangleDebugRender + { + public: + void addTriangle(const PxVec3 &p0, const PxVec3 &p1, const PxVec3 &p2, const SampleRenderer::RendererColor &color); + void addTriangle(const PxVec3 &p0, const PxVec3 &p1, const PxVec3 &p2, const PxVec3& n0, const PxVec3& n1, const PxVec3& n2, const SampleRenderer::RendererColor &color); + + void queueForRenderTriangle(void); + + protected: + SampleTriangleDebugRender(SampleRenderer::Renderer &renderer, SampleAssetManager &assetmanager); + virtual ~SampleTriangleDebugRender(void); + + void checkResizeTriangle(PxU32 maxVerts); + void clearTriangle(void); + + private: + void checkLock(void); + void checkUnlock(void); + void addVert(const PxVec3 &p, const PxVec3 &n, const SampleRenderer::RendererColor &color); + + private: + SampleTriangleDebugRender &operator=(const SampleTriangleDebugRender&) { return *this; } + + private: + SampleRenderer::Renderer &m_renderer; + SampleAssetManager &m_assetmanager; + + SampleMaterialAsset *m_material; + + PxU32 m_maxVerts; + PxU32 m_numVerts; + SampleRenderer::RendererVertexBuffer *m_vertexbuffer; + SampleRenderer::RendererMesh *m_mesh; + SampleRenderer::RendererMeshContext m_meshContext; + + void *m_lockedPositions; + PxU32 m_positionStride; + + void *m_lockedNormals; + PxU32 m_normalStride; + + void *m_lockedColors; + PxU32 m_colorStride; + }; + +} // namespace SampleFramework + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/framework/include/SampleXml.h b/PhysX_3.4/Samples/SampleFramework/framework/include/SampleXml.h new file mode 100644 index 00000000..f9cdecb8 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/framework/include/SampleXml.h @@ -0,0 +1,163 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#ifndef SAMPLE_XML_H +#define SAMPLE_XML_H + +#include "PsFastXml.h" +#include "PsString.h" +#include "SampleTree.h" + +namespace FAST_XML +{ + +class xml_node : private SampleFramework::Tree::Node +{ +public: + xml_node(const char* name, const char* data, const physx::shdfnd::FastXml::AttributePairs& attr) + : mName(name), mData(data) + { + PX_ASSERT( (attr.getNbAttr()*2+1) < MAX_ARGS); + for(physx::PxI32 i=0; i<attr.getNbAttr(); i++) + { + mArgv[i*2] = attr.getKey(i); + mArgv[i*2+1] = attr.getValue(i); + } + physx::shdfnd::FastXml::AttributePairs tmp(attr.getNbAttr()*2, mArgv); + mAttr = tmp; + } + + ~xml_node() + { + xml_node* node = first_node(); + while (node != NULL) + { + xml_node* child = node; + node = node->next_sibling(); + delete child; + } + } + +public: + xml_node* parent() const { return static_cast<xml_node*>(getParent()); } + xml_node* first_node() const { return static_cast<xml_node*>(getFirstChild()); } + xml_node* next_sibling() const { return static_cast<xml_node*>(getNextSibling()); } + bool append_node(xml_node& node) { return appendChild(node); } + + xml_node* first_node(const char* name) const + { + for (xml_node* node = first_node(); node != NULL; node = node->next_sibling()) + { + if (0 == strcmp(node->name(), name)) + { + return node; + } + } + + return NULL; + } + +public: + const char* name() const { return mName; } + const char* value() const { return mData; } + const char *getXMLAttribute(const char *attr) const + { + return mAttr.get(attr); + } + +private: + static const physx::PxI32 MAX_ARGS = 50; + + const char* mName; + const char* mData; + const char* mArgv[MAX_ARGS]; + physx::shdfnd::FastXml::AttributePairs mAttr; +}; + +class XmlBuilder : public physx::shdfnd::FastXml::Callback +{ +public: + XmlBuilder() : mRoot(NULL), mThis(NULL) {} + virtual ~XmlBuilder() + { + delete mRoot; + } + +public: + xml_node* rootnode() const { return mRoot; } + + virtual bool processComment(const char *comment) + { + return true; + } + + virtual bool processClose(const char *element, physx::PxU32 depth, bool &isError) + { + mThis = mThis->parent(); + return true; + } + + virtual bool processElement( + const char *elementName, // name of the element + const char *elementData, // element data, null if none + const physx::shdfnd::FastXml::AttributePairs& attr, // attributes + physx::PxI32 lineno) + { + xml_node* node = new xml_node(elementName, elementData, attr); + + if (NULL != mThis) + mThis->append_node(*node); + else if (NULL == mRoot) + mRoot = node; + else + { + physx::shdfnd::printFormatted("error: more than 1 root node in xml file\n"); + return false; + } + + mThis = node; + return true; + } + + virtual void* allocate(physx::PxU32 size) + { + return malloc(size); + } + + virtual void deallocate(void *mem) + { + free(mem); + } + +private: + xml_node* mRoot; + xml_node* mThis; +}; + +} + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/framework/src/ODBlock.cpp b/PhysX_3.4/Samples/SampleFramework/framework/src/ODBlock.cpp new file mode 100644 index 00000000..2e3bd040 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/framework/src/ODBlock.cpp @@ -0,0 +1,530 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +/*-------------------------------------------------------------*\ +| | +| ODBlock class - object description script | +| | +| Copyright (C) 1999 Adam Moravanszky | +| | +| | +\*-------------------------------------------------------------*/ +/*-Revision----------------------\ +| At: 10/3/99 5:51:37 PM +| +| Changed vector container from +| storing val to refernce. +\-------------------------------*/ +/*-Revision----------------------\ +| At: 5/18/00 9:29:43 PM +| changed static sized indentifiers +| to arbitrary dynamic identifiers. +| +\-------------------------------*/ +/*-Revision----------------------\ +| At: 6/19/02 +| added multiline comments. +| +| +\-------------------------------*/ +/*-Revision----------------------\ +| At: 5/19/03 +| fixed commend bug with +| file > 0xffff chars. +| +\-------------------------------*/ +/*-Revision----------------------\ +| At: 19/10/09 +| removed encryption +| converted to FILE * usage. +| +\-------------------------------*/ +#include "ODBlock.h" +#include "PxTkFile.h" + +const char * ODBlock::lastError = NULL; + + +const char * ODBlock::ODSyntaxError::asString() +{ + static const char unex1[] = "Quote unexpected."; + static const char unex2[] = "Opening brace unexpected."; + static const char unex3[] = "Closing brace unexpected."; + static const char unex4[] = "Literal or semicolon unexpected."; + static const char unex5[] = "Unexpected end of file found."; + static const char encun[] = "Unknown encryption algo code."; + switch (err) + { + case ODSE_UNEX_QUOTE: + return unex1; + case ODSE_UNEX_OBRACE: + return unex2; + case ODSE_UNEX_CBRACE: + return unex3; + case ODSE_UNEX_LITERAL: + return unex4; + case ODSE_UNEX_EOF: + return unex5; + case ODSE_ENC_UNKNOWN: + return encun; + default: + return NULL; + } +} + +static inline bool isNewLine(char c) +{ + return c == '\n' || c == '\r'; +} + +bool ODBlock::loadScript(SampleFramework::File * fp) //loads block from script, including subbocks +{ + int c; + unsigned currindex = 0; + bool bQuote = false; //if we're inside a pair of quotes + identifier[0] = '\0'; + identSize = 0; + bTerminal = true; + termiter = NULL; + bool ignoreWhiteSpace = true; + + State state; + + state = WAIT_IDENT; + + + //0) read possible comments starting with # to end of line + //1) read our identifier. -->forget quotes for now. + + while(!feof(fp)) + { + do + { + c = fgetc(fp); + } + while (ignoreWhiteSpace && ((c == ' ') || (c == '\t') || isNewLine((char)c)) && !feof(fp)); + + if (c == '"') + { + if (state == BLOCK) + { + bTerminal = false; + ungetc(c, fp); + ODBlock * child = new ODBlock(); + addStatement(*child); + if (!child->loadScript(fp)) + return false; + } + else + { + if (state != WAIT_IDENT && state != IDENT) + { + lastError = ODSyntaxError(ODSyntaxError::ODSE_UNEX_QUOTE).asString(); + return false; + } + ignoreWhiteSpace = bQuote; + bQuote = !bQuote; + state = IDENT; + } + } + else + { + if (bQuote) + { + PX_ASSERT(state == IDENT); + //if (currindex >= identSize) + // { + // identSize = 2*currindex + 4; + // char * newi = new char [identSize+1]; + // if (identifier) + // strcpy(newi,identifier); + // delete [] identifier; + // identifier = newi; + // } + identifier[currindex] = (char) c; + identifier[currindex+1] = 0; + currindex++; + } + else + { + switch (c) + { + case '#': + while(!isNewLine((char)fgetc(fp))) ; //read and discard line + break; + case '/': + while(fgetc(fp) != '/') ; //read and discard comment + break; + case '{': + if (state != WAIT_BLOCK && state != IDENT) + { + lastError = ODSyntaxError(ODSyntaxError::ODSE_UNEX_OBRACE).asString();//identifier can be followed by block w/o whitespace inbetween + return false; + } + state = BLOCK; + break; + case '}': + if (state != BLOCK) + { + lastError = ODSyntaxError(ODSyntaxError::ODSE_UNEX_CBRACE).asString(); + return false; + } + return true; + default: + //text + //our identifier? + if (state == BLOCK) + { + bTerminal = false; + ungetc(c, fp); + ODBlock * child = new ODBlock(); + addStatement(*child); + if (!child->loadScript(fp)) + return false; + } + else + { + if (state != WAIT_IDENT && state != IDENT) + { + lastError = ODSyntaxError(ODSyntaxError::ODSE_UNEX_LITERAL).asString(); + return false; + } + if (state == IDENT && c == ';') //terminal ended + return true; + state = IDENT; + //if (currindex >= identSize) + // { + // identSize = 2*currindex + 4; + // char * newi = new char [identSize+1]; + // if (identifier) + // strcpy(newi,identifier); + // delete [] identifier; + // identifier = newi; + // } + identifier[currindex] = (char)c; + identifier[currindex+1] = 0; + currindex++; + } + } + } + } + } + //eof and block didn't close + lastError = ODSyntaxError(ODSyntaxError::ODSE_UNEX_EOF).asString(); + return false; +} + +ODBlock::ODBlock() +{ + //create empty block + identifier[0] = '\0'; + identSize = 0; + bTerminal = true; + termiter = NULL; + subBlocks.reserve(32); +} + +ODBlock::~ODBlock() +{ + //free the contents + ODBlockList::Iterator i; + for (i = subBlocks.begin(); i != subBlocks.end(); ++i) + delete (*i); + //free the pointers + subBlocks.clear(); + + //delete [] identifier; + identifier[0] = '\0'; + identSize = 0; +} + + +bool ODBlock::saveScript(SampleFramework::File * fp,bool bQuote) +{ + static int tablevel = 1; + static int retVal = 0; + int j; + //save the script in said file should be stream!! + for (j=0; j<tablevel-1; j++) + retVal = fprintf(fp,"\t"); + if (bQuote) + retVal = fprintf(fp,"\""); + if (identifier) + retVal = fprintf(fp, "%s", identifier); + else + retVal = fprintf(fp,"_noname"); + if (bQuote) + retVal = fprintf(fp,"\""); + if (!bTerminal) + { + retVal =fprintf(fp,"\n"); + for (j=0; j<tablevel; j++) + retVal = fprintf(fp,"\t"); + retVal = fprintf(fp,"{\n"); + tablevel ++; + for (physx::PxU32 i = 0; i < subBlocks.size(); ++i) + (subBlocks[i])->saveScript(fp,bQuote); + tablevel --; + for (j=0; j<tablevel; j++) + retVal = fprintf(fp,"\t"); + retVal = fprintf(fp,"}\n"); + } + else + retVal = fprintf(fp,";\n"); + + PX_ASSERT( retVal >= 0 ); + // added this return to make this compile on snc & release + return retVal >= 0; +} + + +const char * ODBlock::ident() +{ + static char noname[] = "_noname"; + if (identifier) + return identifier; + else + return noname; +} + + +bool ODBlock::isTerminal() +{ + return bTerminal; +} + + +void ODBlock::ident(const char * i) +{ + if (!i) return; + strcpy(identifier,i); +} + + +void ODBlock::addStatement(ODBlock &b) +{ + bTerminal = false; + subBlocks.pushBack(&b); +} + +void ODBlock::reset() //prepares to get first immediate terminal child of current block +{ + termiter = subBlocks.begin(); +} + +bool ODBlock::moreTerminals() //returns true if more terminals are available +{ + //skip any nonterminals + while ( (termiter != subBlocks.end()) && !(*termiter)->bTerminal) + ++termiter; + return termiter != subBlocks.end(); //return true if not the end yet +} + +char * ODBlock::nextTerminal() //returns a pointer to the next terminal string. +{ + char * s = (*termiter)->identifier; + ++termiter; + + static char noname[] = "_noname"; + if (s) + return s; + else + return noname; +} + +bool ODBlock::moreSubBlocks() //returns true if more sub blocks are available +{ + return termiter != subBlocks.end(); //return true if not the end yet +} +ODBlock * ODBlock::nextSubBlock() //returns a pointer to the next sub block. +{ + ODBlock * b = (*termiter); + ++termiter; + return b; +} + + +ODBlock * ODBlock::getBlock(const char * ident,bool bRecursiveSearch) //returns block with given identifier, or NULL. +{ + ODBlock * b; + if (identifier && ident && strncmp(identifier,ident,OD_MAXID) == 0) + return this; + else + { + if (bTerminal) + return NULL; + else + { + ODBlockList::Iterator i; + for (i = subBlocks.begin(); i != subBlocks.end(); ++i) + if (bRecursiveSearch) + { + b = (*i)->getBlock(ident,true); + if (b) + return b; + } + else + { + if ((*i)->identifier && ident && strncmp((*i)->identifier,ident,OD_MAXID) == 0) + return (*i); + } + return NULL; + } + } + +} + +// hig level macro functs, return true on success: +bool ODBlock::getBlockInt(const char * ident, int* p, unsigned count) //reads blocks of form: ident{ 123; 123; ... } +{ + ODBlock* temp = getBlock(ident); + if (temp) + { + temp->reset(); + for(; count && temp->moreTerminals(); --count) + if(p) + sscanf(temp->nextTerminal(),"%d", p++); + + return !count; + } + return false; +} + +// hig level macro functs, return true on success: +bool ODBlock::getBlockU32(const char * ident, physx::PxU32* p, unsigned count) //reads blocks of form: ident{ 123;} +{ + ODBlock* temp = getBlock(ident); + if (temp) + { + temp->reset(); + for(; count && temp->moreTerminals(); --count) + if(p) + sscanf(temp->nextTerminal(),"%u", p++); + + return !count; + } + return false; +} + +bool ODBlock::getBlockString(const char * ident, const char ** p) //of form: ident{abcdef;} +{ + ODBlock * temp = getBlock(ident); + if (temp) + { + temp->reset(); + if (temp->moreTerminals()) + { + *p = temp->nextTerminal(); + return true; + } + } + return false; +} +bool ODBlock::getBlockStrings(const char * ident, const char ** p, unsigned numStrings) //of form: ident{abcdef; abcdef;...} +{ + ODBlock * temp= getBlock(ident); + if (temp) + { + temp->reset(); + for (unsigned int n=0; n<numStrings; n++) + { + if (temp->moreTerminals()) + { + p[n] = temp->nextTerminal(); + } + } + } + return false; +} +bool ODBlock::getBlockFloat(const char * ident, float *p) //of form: ident{123.456;} +{ + ODBlock * temp = getBlock(ident); + if (temp) + { + temp->reset(); + if (temp->moreTerminals()) + { + if(p) sscanf(temp->nextTerminal(),"%f",p); + return true; + } + } + return false; +} +bool ODBlock::getBlockFloats(const char * ident, float *p, unsigned numfloats)//form: ident{12.3; 12.3; 12.3; ... }; +{ + ODBlock * temp = getBlock(ident); + if (temp) + { + temp->reset(); + for (unsigned int n=0; n<numfloats; n++) + if (temp->moreTerminals()) sscanf(temp->nextTerminal(),"%f",&(p[n])); + + return true; + } + return false; +} + +bool ODBlock::addBlockFloats(const char * ident, float *f, unsigned numfloats) +{ + char buf[32]; + ODBlock & newBlock = *new ODBlock(); + + addStatement(newBlock); + newBlock.ident(ident); + + for (unsigned i = 0; i < numfloats; i++) + { + ODBlock & floatBlock = *new ODBlock(); + newBlock.addStatement(floatBlock); + + //_gcvt_s(buf, 32, f[i],5); //gcc doesn't support this + sprintf(buf, "%.5f", f[i]); + + floatBlock.ident(buf); + } + return true; +} + +bool ODBlock::addBlockInts(const char * ident, int *f, unsigned numInts) +{ + char buf[32]; + ODBlock & newBlock = *new ODBlock(); + + addStatement(newBlock); + newBlock.ident(ident); + + for (unsigned i = 0; i < numInts; i++) + { + ODBlock & floatBlock = *new ODBlock(); + newBlock.addStatement(floatBlock); + //_itoa_s(f[i], buf, 32, 10); //gcc doesn't support this + sprintf(buf, "%d", f[i]); + floatBlock.ident(buf); + } + return true; +} + diff --git a/PhysX_3.4/Samples/SampleFramework/framework/src/SampleApplication.cpp b/PhysX_3.4/Samples/SampleFramework/framework/src/SampleApplication.cpp new file mode 100644 index 00000000..bb188f4b --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/framework/src/SampleApplication.cpp @@ -0,0 +1,487 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#include <PsUtilities.h> +#include <SampleApplication.h> +#include <SampleCommandLine.h> +#include <SampleAssetManager.h> +#include <Renderer.h> +#include <RendererMemoryMacros.h> +#include <SamplePlatform.h> +#include "SampleFrameworkInputEventIds.h" + +#include "PsString.h" +#include "PsFoundation.h" +#include "PsUtilities.h" + +namespace Ps = physx::shdfnd; + +//#define RENDERER_USE_OPENGL_ON_WINDONWS 1 + +#if defined(SMOOTH_CAM) +const float g_smoothCamBaseVel = 6.0f; +const float g_smoothCamFastMul = 4.0f; +const float g_smoothCamPosLerp = 0.4f; + +const float g_smoothCamRotSpeed = 0.005f; +const float g_smoothCamRotLerp = 0.4f; +#endif + +#include "FrameworkFoundation.h" + +using namespace SampleFramework; + +static PxMat44 EulerToMat33(const PxVec3& e) +{ + const float c1 = cosf(e.z); + const float s1 = sinf(e.z); + const float c2 = cosf(e.y); + const float s2 = sinf(e.y); + const float c3 = cosf(e.x); + const float s3 = sinf(e.x); + PxMat44 m; + m.column0 = PxVec4(c1*c2, -s1*c2, s2, 0.0f); + m.column1 = PxVec4((s1*c3)+(c1*s2*s3), (c1*c3)-(s1*s2*s3),-c2*s3, 0.0f); + m.column2 = PxVec4((s1*s3)-(c1*s2*c3), (c1*s3)+(s1*s2*c3), c2*c3, 0.0f); + m.column3 = PxVec4(0,0,0,1); + return m; +} + +static PxVec3 Mat33ToEuler(const PxMat44& m) +{ + const PxF32 epsilon = 0.99999f; + PxVec3 e, x, y, z; + + x = PxVec3(m.column0.x, m.column1.x, m.column2.x); + y = PxVec3(m.column0.y, m.column1.y, m.column2.y); + z = PxVec3(m.column0.z, m.column1.z, m.column2.z); + + if(x.z > epsilon) + { + e.x = PxAtan2(z.y, y.y); + e.y = PxPi * 0.5f; + e.z = 0; + } + else if(x.z < -epsilon) + { + e.x = PxAtan2(z.y, y.y); + e.y = -PxPi * 0.5f; + e.z = 0; + } + else + { + e.x = PxAtan2(-y.z, z.z); + e.y = PxAsin(x.z); + e.z = PxAtan2(-x.y, x.x); + } + return e; +} + +SampleApplication::SampleApplication(const SampleCommandLine &cmdline, const char *assetPathPrefix, PxI32 camMoveButton) : + m_cmdline(cmdline) +, m_disableRendering(false) +, m_rotationSpeedScale(200.0f) +, m_moveSpeedScale(40.0f) +, m_rightStickRotate(false) +, m_rewriteBuffers(false) +{ + m_platform->setCWDToEXE(); + + if (assetPathPrefix) + { + if (!searchForPath(assetPathPrefix, m_assetPathPrefix, PX_ARRAY_SIZE(m_assetPathPrefix), true, 20)) + { + RENDERER_ASSERT(false, "assetPathPrefix could not be found in any of the parent directories!"); + m_assetPathPrefix[0] = 0; + } + } + else + { + RENDERER_ASSERT(assetPathPrefix, "assetPathPrefix must not be NULL (try \"media\" instead)"); + m_assetPathPrefix[0] = 0; + } + + m_renderer = 0; + m_sceneSize = 1.0f; + m_assetManager = 0; + m_timeCounter = 0; + m_camMoveButton = camMoveButton; + +} + +SampleApplication::~SampleApplication(void) +{ + RENDERER_ASSERT(!m_renderer, "Renderer was not released prior to window closure."); + RENDERER_ASSERT(!m_assetManager, "Asset Manager was not released prior to window closure."); + + DELETESINGLE(m_platform); + + clearSearchPaths(); +} + +void SampleApplication::setEyeTransform(const PxMat44& eyeTransform) +{ + m_worldToView.setInverseTransform(eyeTransform); + m_eyeRot = Mat33ToEuler(eyeTransform); +#if defined(SMOOTH_CAM) + m_targetEyePos = m_worldToView.getInverseTransform().getPosition(); + m_targetEyeRot = m_eyeRot; +#endif +} + +void SampleApplication::setEyeTransform(const PxVec3& pos, const PxVec3& rot) +{ + PxMat44 eye; + m_eyeRot = rot; + eye = EulerToMat33(m_eyeRot); + eye.setPosition(pos); +#if defined(SMOOTH_CAM) + m_targetEyePos = pos; + m_targetEyeRot = m_eyeRot; +#endif + + m_worldToView.setInverseTransform(eye); +} + +void SampleApplication::setViewTransform(const PxMat44 &viewTransform) +{ + m_worldToView.setForwardTransform(viewTransform); + m_eyeRot = Mat33ToEuler( m_worldToView.getInverseTransform() ); +#if defined(SMOOTH_CAM) + m_targetEyePos = m_worldToView.getInverseTransform().getPosition(); + m_targetEyeRot = m_eyeRot; +#endif +} + +const PxMat44& SampleApplication::getViewTransform() const +{ + return m_worldToView.getForwardTransform(); +} + +void SampleApplication::onOpen(void) +{ + m_platform->preRendererSetup(); + + char assetDir[1024]; + Ps::strlcpy(assetDir, sizeof(assetDir), m_assetPathPrefix); + Ps::strlcat(assetDir, sizeof(assetDir), "/SampleRenderer/4/"); + + m_eyeRot = PxVec3(0,0,0); + PxMat44 eye = PxMat44(PxIdentity); + const PxVec3 pos = PxVec3(0.0f, 2.0f, 16.0f); + eye.setPosition(pos); + m_worldToView.setInverseTransform(eye); +#if defined(SMOOTH_CAM) + m_targetEyePos = pos; + m_targetEyeRot = m_eyeRot; +#endif + + // default renderer drivers for various platforms... + SampleRenderer::RendererDesc renDesc; + setupRendererDescription(renDesc); +#if defined RENDERER_USE_OPENGL_ON_WINDONWS + renDesc.driver = SampleRenderer::Renderer::DRIVER_OPENGL; +#endif + + // check to see if the user wants to override the renderer driver... + if(m_cmdline.hasSwitch("ogl")) renDesc.driver = SampleRenderer::Renderer::DRIVER_OPENGL; + else if(m_cmdline.hasSwitch("gles2")) renDesc.driver = SampleRenderer::Renderer::DRIVER_GLES2; + else if(m_cmdline.hasSwitch("d3d9")) renDesc.driver = SampleRenderer::Renderer::DRIVER_DIRECT3D9; + else if(m_cmdline.hasSwitch("d3d11")) renDesc.driver = SampleRenderer::Renderer::DRIVER_DIRECT3D11; + else if(m_cmdline.hasSwitch("gcm")) renDesc.driver = SampleRenderer::Renderer::DRIVER_LIBGCM; + else if(m_cmdline.hasSwitch("null")) renDesc.driver = SampleRenderer::Renderer::DRIVER_NULL; + +#if defined(RENDERER_ANDROID) + renDesc.windowHandle = (physx::PxU64)android_window_ptr; +#endif + + m_renderer = SampleRenderer::Renderer::createRenderer(renDesc, assetDir); + m_platform->postRendererSetup(m_renderer); + + m_timeCounter = m_time.getCurrentCounterValue(); + + m_assetManager = new SampleAssetManager(*m_renderer); + addSearchPath(m_assetPathPrefix); + addSearchPath(assetDir); + onInit(); + + // make sure the resize method is called once + if (m_renderer) + { + PxU32 width,height; + m_renderer->getWindowSize(width, height); + onResize(width, height); + } +} + +bool SampleApplication::onClose(void) +{ + onShutdown(); + DELETESINGLE(m_assetManager); + + SAFE_RELEASE(m_renderer); + m_platform->postRendererRelease(); + + return true; +} + +inline float SmoothStepPolynomial( float s ) +{ + if( s <= 0 ) return 0; + if( s >= 1 ) return 1; + return s*s*(3-2*s); +} + +template <typename T> +T SmoothStep( const T& start, const T& end, float s ) +{ + float ss = SmoothStepPolynomial( s ); + return ss * (end - start) + start; +} + +void SampleApplication::onDraw(void) +{ + + if (!getRenderer()) + { + return; + } + + PX_PROFILE_ZONE("OnDraw", 0); + + physx::PxU64 qpc = m_time.getCurrentCounterValue(); + static float sToSeconds = float(m_time.getBootCounterFrequency().mNumerator) / float(m_time.getBootCounterFrequency().mDenominator * m_time.sNumTensOfNanoSecondsInASecond); + float dtime = float(qpc - m_timeCounter) * sToSeconds; + m_lastDTime = dtime; + m_timeCounter = qpc; + PX_ASSERT(dtime > 0); + if(dtime > 0) + { + dtime = tweakElapsedTime(dtime); + + { + PX_PROFILE_ZONE("PreRender", 0); + onTickPreRender(dtime); + } + if(m_renderer) + { + PX_PROFILE_ZONE("onRender", 0); + if(!m_disableRendering) + { + onRender(); + } + } + { + PX_PROFILE_ZONE("onPostRender", 0); + onTickPostRender(dtime); + } + + if(m_renderer && !m_disableRendering) + { + m_rewriteBuffers = m_renderer->swapBuffers(); + } + + // update scene... + + PxMat44 tmp = m_worldToView.getInverseTransform(); + PxMat44 eye = EulerToMat33(m_eyeRot); + eye.column3 = tmp.column3; + + PxVec3* targetParam; +#if defined(SMOOTH_CAM) + const float eyeSpeed = m_sceneSize * g_smoothCamBaseVel * dtime * (getPlatform()->getSampleUserInput()->getDigitalInputEventState(CAMERA_SHIFT_SPEED) ? g_smoothCamFastMul : 1.0f); + targetParam = &m_targetEyePos; +#else + const float eyeSpeed = m_sceneSize * 4.0f * dtime * (getPlatform()->getSampleUserInput()->getDigitalInputEventState(CAMERA_SHIFT_SPEED) ? 4.0f : 1.0f); + targetParam = &eye.t; +#endif + + const PxVec3 column2 = eye.getBasis(2); + const PxVec3 column0 = eye.getBasis(0); + const PxVec3 column1 = eye.getBasis(1); + + if(getPlatform()->getSampleUserInput()->getDigitalInputEventState(CAMERA_MOVE_FORWARD)) + *targetParam -= column2 * eyeSpeed; + if(getPlatform()->getSampleUserInput()->getDigitalInputEventState(CAMERA_MOVE_LEFT)) + *targetParam -= column0 * eyeSpeed; + if(getPlatform()->getSampleUserInput()->getDigitalInputEventState(CAMERA_MOVE_BACKWARD)) + *targetParam += column2 * eyeSpeed; + if(getPlatform()->getSampleUserInput()->getDigitalInputEventState(CAMERA_MOVE_RIGHT)) + *targetParam += column0 * eyeSpeed; + if(getPlatform()->getSampleUserInput()->getDigitalInputEventState(CAMERA_MOVE_UP)) + *targetParam += column1 * eyeSpeed; + if(getPlatform()->getSampleUserInput()->getDigitalInputEventState(CAMERA_MOVE_DOWN)) + *targetParam -= column1 * eyeSpeed; + + // move forward from gamepad + *targetParam -= column2 * eyeSpeed * getPlatform()->getSampleUserInput()->getAnalogInputEventState(CAMERA_GAMEPAD_MOVE_FORWARD_BACK) * m_moveSpeedScale * dtime; + // strafe from gamepad + *targetParam += column0 * eyeSpeed * getPlatform()->getSampleUserInput()->getAnalogInputEventState(CAMERA_GAMEPAD_MOVE_LEFT_RIGHT) * m_moveSpeedScale* dtime; + +#if defined(SMOOTH_CAM) + PxVec3 eye_t = eye.getPosition(); + eye_t = eye_t + (m_targetEyePos - eye_t) * g_smoothCamPosLerp; + eye.setPosition(eye_t); +#endif + + // rotate from gamepad + { + const PxF32 rotationSpeed = m_rotationSpeedScale * dtime; + PxF32 dx = getPlatform()->getSampleUserInput()->getAnalogInputEventState(CAMERA_GAMEPAD_ROTATE_LEFT_RIGHT) * rotationSpeed; + PxF32 dy = getPlatform()->getSampleUserInput()->getAnalogInputEventState(CAMERA_GAMEPAD_ROTATE_UP_DOWN) * rotationSpeed; + rotateCamera(dx, dy); + } + + m_worldToView.setInverseTransform(eye); + } +} + +// When holding down the mouse button and dragging across the edge of the window, +// the input provider will spit out nonsensical delta values... so threshold appropriately +void thresholdCameraRotate(physx::PxReal& dx, physx::PxReal& dy) +{ + static const physx::PxReal invalidDelta = 1000.f; + if ( physx::PxAbs(dx) > invalidDelta ) + dx = physx::PxSign(dx); + if ( physx::PxAbs(dy) > invalidDelta ) + dy = physx::PxSign(dy); +} + +void SampleApplication::onPointerInputEvent(const InputEvent& ie, physx::PxU32 x, physx::PxU32 y, physx::PxReal dx, physx::PxReal dy, bool val) +{ + switch (ie.m_Id) + { + case CAMERA_MOUSE_LOOK: + { + if(getPlatform()->getSampleUserInput()->getDigitalInputEventState(CAMERA_MOVE_BUTTON)) + { + thresholdCameraRotate(dx, dy); + rotateCamera(dx, dy); + } + } + break; + } +} + +void SampleApplication::onDigitalInputEvent(const InputEvent& , bool val) +{ +} + +void SampleApplication::moveCamera(PxF32 dx, PxF32 dy) +{ + PxMat44 tmp = m_worldToView.getInverseTransform(); + PxMat44 eye = EulerToMat33(m_eyeRot); + eye.column3 = tmp.column3; + + PxVec3* targetParam; +#if defined(SMOOTH_CAM) + const float eyeSpeed = m_sceneSize * g_smoothCamBaseVel * m_lastDTime * (getPlatform()->getSampleUserInput()->getDigitalInputEventState(CAMERA_SHIFT_SPEED) ? g_smoothCamFastMul : 1.0f); + targetParam = &m_targetEyePos; +#else + const float eyeSpeed = m_sceneSize * 4.0f * m_lastDTime * (getPlatform()->getSampleUserInput()->getDigitalInputEventState(CAMERA_SHIFT_SPEED) ? 4.0f : 1.0f); + targetParam = &eye.t; +#endif + + const PxVec3 column2 = eye.getBasis(2); + const PxVec3 column0 = eye.getBasis(0); + + // strafe from gamepad + *targetParam += column0 * eyeSpeed * dx * m_moveSpeedScale* m_lastDTime; + // move forward from gamepad + *targetParam -= column2 * eyeSpeed * dy * m_moveSpeedScale * m_lastDTime; + +#if defined(SMOOTH_CAM) + PxVec3 eye_t = eye.getPosition(); + eye_t = eye_t + (m_targetEyePos - eye_t) * g_smoothCamPosLerp; + eye.setPosition(eye_t); +#endif + + m_worldToView.setInverseTransform(eye); +} + +void SampleApplication::onAnalogInputEvent(const InputEvent& ie, float val) +{ + switch (ie.m_Id) + { + case CAMERA_GAMEPAD_ROTATE_LEFT_RIGHT: + { + rotateCamera((PxF32)val, (PxF32)0.0); + } + break; + case CAMERA_GAMEPAD_ROTATE_UP_DOWN: + { + rotateCamera((PxF32)0.0, (PxF32)val); + } + break; + case CAMERA_GAMEPAD_MOVE_LEFT_RIGHT: + { + moveCamera((PxF32)val, (PxF32)0.0); + } + break; + case CAMERA_GAMEPAD_MOVE_FORWARD_BACK: + { + moveCamera((PxF32)0.0, (PxF32)val); + } + break; + } +} + +void SampleApplication::rotateCamera(PxF32 dx, PxF32 dy) +{ + const float eyeCap = 1.5f; +#if defined(SMOOTH_CAM) + m_targetEyeRot.x -= dy * g_smoothCamRotSpeed; + m_targetEyeRot.y += dx * g_smoothCamRotSpeed; + if(m_targetEyeRot.x > eyeCap) m_targetEyeRot.x = eyeCap; + if(m_targetEyeRot.x < -eyeCap) m_targetEyeRot.x = -eyeCap; + + m_eyeRot= m_eyeRot + (m_targetEyeRot - m_eyeRot) * g_smoothCamRotLerp; +#else + const float eyeRotSpeed = 0.005f; + m_eyeRot.x -= dy * eyeRotSpeed; + m_eyeRot.y += dx * eyeRotSpeed; + if(m_eyeRot.x > eyeCap) m_eyeRot.x = eyeCap; + if(m_eyeRot.x < -eyeCap) m_eyeRot.x = -eyeCap; +#endif +} + +void SampleApplication::fatalError(const char * msg) +{ +shdfnd::printFormatted("Fatal Error in SampleApplication: %s\n", msg); +close(); +exit(1); +} + +void SampleApplication::doInput() +{ + m_platform->doInput(); +} + +void SampleApplication::setupRendererDescription(SampleRenderer::RendererDesc& renDesc) +{ + m_platform->setupRendererDescription(renDesc); +} + diff --git a/PhysX_3.4/Samples/SampleFramework/framework/src/SampleAsset.cpp b/PhysX_3.4/Samples/SampleFramework/framework/src/SampleAsset.cpp new file mode 100644 index 00000000..dd7db24b --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/framework/src/SampleAsset.cpp @@ -0,0 +1,44 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#include <SampleAsset.h> +#include "PsString.h" + +using namespace SampleFramework; + +SampleAsset::SampleAsset(Type type, const char *path) : + m_type(type) +{ + size_t len = strlen(path)+1; + m_path = new char[len]; + physx::shdfnd::strlcpy(m_path, len, path); + m_numUsers = 0; +} + +SampleAsset::~SampleAsset(void) +{ + if(m_path) delete [] m_path; +} diff --git a/PhysX_3.4/Samples/SampleFramework/framework/src/SampleAssetManager.cpp b/PhysX_3.4/Samples/SampleFramework/framework/src/SampleAssetManager.cpp new file mode 100644 index 00000000..c1e19c4d --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/framework/src/SampleAssetManager.cpp @@ -0,0 +1,436 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#include <SampleAssetManager.h> +#include <SampleAsset.h> +#include <SampleMaterialAsset.h> +#include <SampleTextureAsset.h> +#include <SampleInputAsset.h> + +#include <Renderer.h> + +#include <stdio.h> +#include "SamplePlatform.h" +#include "ODBlock.h" + +// for PsString.h +#include <PsString.h> +#include <PxTkFile.h> + +namespace Ps = physx::shdfnd; + +#include "SampleXml.h" +#include "extensions/PxDefaultStreams.h" + +using namespace SampleFramework; + +/////////////////////////////////////////////////////////////////////////////// + +static std::vector<char*>* gSearchPaths = NULL; + +void SampleFramework::addSearchPath(const char* path) +{ + if(!path) + return; + + const PxU32 len = *path ? (PxU32)strlen(path) : 0; + if(!len) + return; + + const PxU32 len2 = len+2; + char* searchPath = new char[len2]; + Ps::strlcpy(searchPath, len2, path); + if(path[len-1] != '/' && path[len-1] != '\\') + { + Ps::strlcat(searchPath, len2, "/"); + } + if(!gSearchPaths) + gSearchPaths = new std::vector<char*>; + gSearchPaths->push_back(searchPath); +} + +void SampleFramework::clearSearchPaths() +{ + if(!gSearchPaths) + return; + const PxU32 numSearchPaths = (PxU32)gSearchPaths->size(); + for(PxU32 i=0; i<numSearchPaths; i++) + { + delete [] (*gSearchPaths)[i]; + } + delete gSearchPaths; + gSearchPaths = NULL; +} + +static void FixSeparators(char* path) +{ + for (unsigned i = 0; i < strlen(path); ++i) + if (path[i] == '\\' || path[i] == '/') + path[i] = SampleFramework::SamplePlatform::platform()->getPathSeparator()[0]; +} + +File* SampleFramework::findFile(const char* path, bool binary) +{ + if(!gSearchPaths) + return NULL; + + File* file = NULL; + const PxU32 numSearchPaths = (PxU32)gSearchPaths->size(); + for(PxU32 i=0; i<numSearchPaths; i++) + { + const char* prefix = (*gSearchPaths)[i]; + + char fullPath[512]; + Ps::strlcpy(fullPath, 512, prefix); + Ps::strlcat(fullPath, 512, path); + FixSeparators(fullPath); + if(binary) + PxToolkit::fopen_s(&file, fullPath, "rb"); + else + { + // text files open also for write + PxToolkit::fopen_s(&file, fullPath, "r+"); + } + if(file) break; + } + return file; +} + +const char* SampleFramework::findPath(const char* path) +{ + if(!gSearchPaths) + return path; + + static char fullPath[512]; + + File* file = NULL; + const PxU32 numSearchPaths = (PxU32)gSearchPaths->size(); + for(PxU32 i=0; i<numSearchPaths; i++) + { + const char* prefix = (*gSearchPaths)[i]; + Ps::strlcpy(fullPath, 512, prefix); + Ps::strlcat(fullPath, 512, path); + FixSeparators(fullPath); + PxToolkit::fopen_s(&file, fullPath, "rb"); + if(file) break; + } + if(file) + { + fclose(file); + return fullPath; + } + else + return path; +} + + +/////////////////////////////////////////////////////////////////////////////// + +SampleAssetManager::SampleAssetManager(SampleRenderer::Renderer& renderer, + SampleAssetCreator* fallbackAssetCreator) : + m_renderer(renderer), + m_fallbackAssetCreator(fallbackAssetCreator) +{ +} + +SampleAssetManager::~SampleAssetManager(void) +{ + PX_ASSERT(m_assets.size() == 0); +} + +SampleAsset* SampleAssetManager::getAsset(const char* path, SampleAsset::Type type) +{ + SampleAsset* asset = findAsset(path); + if(!asset) + { + asset = loadAsset(path, type); + } + if(asset && asset->getType() != type) + { + releaseAsset(*asset); + asset = 0; + } + if(asset) + { + addAssetUser(*asset); + } + return asset; +} + +void SampleAssetManager::returnAsset(SampleAsset& asset) +{ + PX_ASSERT(asset.m_numUsers > 0); + if(asset.m_numUsers > 0) + { + asset.m_numUsers--; + } + if(asset.m_numUsers == 0) + { + releaseAsset(asset); + } +} + +SampleAsset* SampleAssetManager::findAsset(const char* path) +{ + SampleAsset* asset = NULL; + PxU32 numAssets = (PxU32)m_assets.size(); + for(PxU32 i=0; i<numAssets; i++) + { + if(!strcmp(m_assets[i]->getPath(), path)) + { + asset = m_assets[i]; + break; + } + } + return asset; +} + +static const char* strext(const char* str) +{ + const char* ext = str; + while(str) + { + str = strchr(str, '.'); + if(str) + { + str++; + ext = str; + } + } + return ext; +} + +class FileExtensions +{ +public: + explicit FileExtensions(const char** extensions, PxU32 numExtensions) + : mExtensions(extensions), mNumExtensions(numExtensions) { } + + template<typename EnumType> + EnumType typeOf(const char* extension) + { + PxU32 type = 0; + while (type < mNumExtensions && (Ps::stricmp(extension, mExtensions[type]) != 0)) ++type; + return static_cast<EnumType>(type); + } + +protected: + const char** mExtensions; + PxU32 mNumExtensions; +}; + +enum FileType { TYPE_XML = 0, TYPE_DDS, TYPE_TGA, TYPE_ODS, TYPE_PVR, TYPE_BMP, NUM_TYPES, TYPE_NOT_SUPPORTED = NUM_TYPES }; +static const char* sSupportedExtensions[NUM_TYPES] = {"xml", "dds", "tga", "ods", "pvr", "bmp"}; +static FileExtensions sFileExtensions(sSupportedExtensions, NUM_TYPES); + +#if defined(RENDERER_ENABLE_PVR_SUPPORT) +static FILE* findFileExchangeExtension(const char* path, bool binary, const char* origEnding, const char* newEnding) +{ + char pathPVR[512]; + strcpy(pathPVR, path); + char* endStr = strstr(pathPVR, origEnding); + strcpy(endStr, newEnding); + return findFile(pathPVR, binary); +} +#endif + +SampleAsset* SampleAssetManager::loadAsset(const char* path, SampleAsset::Type type) +{ + SampleAsset* asset = NULL; + const char* extension = strext(path); + if(extension && *extension) + { + FileType fileType = sFileExtensions.typeOf<FileType>(extension); + if (TYPE_NOT_SUPPORTED != fileType ) + { + File* file = NULL; +#if defined(RENDERER_ENABLE_PVR_SUPPORT) + if(fileType == TYPE_DDS) + { + file = findFileExchangeExtension(path, true, ".dds", ".pvr"); + fileType = TYPE_PVR; + } +#endif + if(!file) + file = findFile(path, fileType != TYPE_ODS); + + if(!file) + PxToolkit::fopen_s(&file, path, fileType != TYPE_ODS ? "rb" : "r+"); + + if(file) + { + switch(fileType) + { + case TYPE_XML: + asset = loadXMLAsset(*file, path); + break; + case TYPE_DDS: + asset = loadTextureAsset(*file, path, SampleTextureAsset::DDS); + break; + case TYPE_PVR: + asset = loadTextureAsset(*file, path, SampleTextureAsset::PVR); + break; + case TYPE_BMP: + asset = loadTextureAsset(*file, path, SampleTextureAsset::BMP); + break; + case TYPE_TGA: + asset = loadTextureAsset(*file, path, SampleTextureAsset::TGA); + break; + case TYPE_ODS: + asset = loadODSAsset(*file, path); + break; + case TYPE_NOT_SUPPORTED: + default: + PX_ALWAYS_ASSERT(); + }; + fclose(file); + } + } + + if (NULL == asset) + { + if (m_fallbackAssetCreator) + { + asset = m_fallbackAssetCreator->create(path, type); + } + if (NULL == asset) + { + +#define SAM_DEFAULT_MATERIAL "materials/simple_lit.xml" + +#if defined(RENDERER_ENABLE_PVR_SUPPORT) +# define SAM_DEFAULT_TEXTURE "textures/test.pvr" +#else +# define SAM_DEFAULT_TEXTURE "textures/test.dds" +#endif + + // report the missing asset + char msg[1024]; + + if (type == SampleAsset::ASSET_MATERIAL && strcmp(path, SAM_DEFAULT_MATERIAL) ) // Avoid infinite recursion + { + Ps::snprintf(msg, sizeof(msg), "Could not find material: %s, loading default material: %s", + path, SAM_DEFAULT_MATERIAL); + RENDERER_OUTPUT_MESSAGE(&m_renderer, msg); + + return loadAsset(SAM_DEFAULT_MATERIAL, type); // Try to use the default asset + } + else if (type == SampleAsset::ASSET_TEXTURE) + { + Ps::snprintf(msg, sizeof(msg), "Could not find texture: %s, loading default texture: %s", + path, SAM_DEFAULT_TEXTURE); + RENDERER_OUTPUT_MESSAGE(&m_renderer, msg); + + return loadAsset(SAM_DEFAULT_TEXTURE, type); // Try to use the default asset + } + else if (fileType == TYPE_ODS) + { + Ps::snprintf(msg, sizeof(msg), "Could not find input definition: %s", path); + RENDERER_OUTPUT_MESSAGE(&m_renderer, msg); + } + } + } + } + //PX_ASSERT(asset && asset->isOk()); + if(asset && !asset->isOk()) + { + deleteAsset(asset); + asset = 0; + } + if(asset) + { + addAsset(asset); + } + return asset; +} + +void SampleAssetManager::releaseAsset(SampleAsset& asset) +{ + PxU32 numAssets = (PxU32)m_assets.size(); + PxU32 found = numAssets; + for(PxU32 i=0; i<numAssets; i++) + { + if(&asset == m_assets[i]) + { + found = i; + break; + } + } + PX_ASSERT(found < numAssets); + if(found < numAssets) + { + m_assets[found] = m_assets.back(); + m_assets.pop_back(); + deleteAsset(&asset); + } +} + +void SampleAssetManager::addAssetUser(SampleAsset& asset) +{ + asset.m_numUsers++; +} + +void SampleAssetManager::addAsset(SampleAsset* asset) +{ + if (asset) + m_assets.push_back(asset); +} + +void SampleAssetManager::deleteAsset(SampleAsset* asset) +{ + if (asset) + asset->release(); +} + +SampleAsset* SampleAssetManager::loadXMLAsset(File& file, const char* path) +{ + SampleAsset* asset = NULL; + + PxDefaultFileInputData theBuffer(findPath(path)); + FAST_XML::XmlBuilder builder; + physx::shdfnd::FastXml *xml = createFastXml(&builder); + xml->processXml(theBuffer, false); + FAST_XML::xml_node* rootnode = builder.rootnode(); + if(!strcmp(rootnode->name(), "material")) + { + asset = new SampleMaterialAsset(*this, *rootnode, path); + } + xml->release(); + + return asset; +} + +SampleAsset* SampleAssetManager::loadTextureAsset(File& file, const char* path, SampleTextureAsset::Type texType) +{ + SampleTextureAsset* asset = new SampleTextureAsset(getRenderer(), file, path, texType); + return asset; +} + +SampleAsset* SampleAssetManager::loadODSAsset(File& file, const char* path) +{ + SampleAsset* asset = new SampleInputAsset(&file, path); + return asset; +} diff --git a/PhysX_3.4/Samples/SampleFramework/framework/src/SampleCommandLine.cpp b/PhysX_3.4/Samples/SampleFramework/framework/src/SampleCommandLine.cpp new file mode 100644 index 00000000..91d21840 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/framework/src/SampleCommandLine.cpp @@ -0,0 +1,426 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#include "FrameworkFoundation.h" +#include <SampleCommandLine.h> +#include <string.h> +#include <stdio.h> +#include <stdlib.h> +#include <ctype.h> +#include "PxTkFile.h" +#include "foundation/PxAssert.h" + +#ifdef WIN32 +#include <windows.h> +#elif defined(ANDROID) +typedef int errno_t; +#endif + +#include "PsString.h" + +using namespace SampleFramework; +namespace Ps = physx::shdfnd; + +static char **CommandLineToArgvA(const char *cmdLine, unsigned int &_argc) +{ + char **argv = 0; + char *_argv = 0; + unsigned int len = 0; + unsigned int argc = 0; + char a = 0; + unsigned int i = 0; + unsigned int j = 0; + bool in_QM = false; + bool in_TEXT = false; + bool in_SPACE = true; + + len = (unsigned int)strlen(cmdLine); + i = ((len+2)/2)*sizeof(char*) + sizeof(char*); + argv = (char **)malloc(i + (len+2)*sizeof(char)); + _argv = (char *)(((char *)argv)+i); + argv[0] = _argv; + + i = 0; + + a = cmdLine[i]; + while(a) + { + if(in_QM) + { + if(a == '\"') + { + in_QM = false; + } + else + { + _argv[j] = a; + j++; + } + } + else + { + switch(a) + { + case '\"': + in_QM = true; + in_TEXT = true; + if(in_SPACE) + { + argv[argc] = _argv+j; + argc++; + } + in_SPACE = false; + break; + case ' ': + case '\t': + case '\n': + case '\r': + if(in_TEXT) + { + _argv[j] = '\0'; + j++; + } + in_TEXT = false; + in_SPACE = true; + break; + default: + in_TEXT = true; + if(in_SPACE) + { + argv[argc] = _argv+j; + argc++; + } + _argv[j] = a; + j++; + in_SPACE = false; + break; + } + } + i++; + a = cmdLine[i]; + } + _argv[j] = '\0'; + argv[argc] = 0; + _argc = argc; + return argv; +} + +static bool isSwitchChar(char c) +{ + return (c == '-' || c == '/'); +} + +namespace +{ +void operationOK(int e) +{ + PX_UNUSED(e); + PX_ASSERT(0 == e); +} + +const char * const * getCommandLineArgumentsFromFile(unsigned int & argc, const char * programName, const char * commandLineFilePath) +{ + const char * const * argv = NULL; + argc = 0; + PX_ASSERT(NULL != programName); + PX_ASSERT(NULL != commandLineFilePath); + if(NULL != programName && NULL != commandLineFilePath) + { + File* commandLineFile = NULL; + operationOK(PxToolkit::fopen_s(&commandLineFile, commandLineFilePath, "r")); + if(NULL != commandLineFile) + { + operationOK(fseek(commandLineFile, 0, SEEK_END)); + const unsigned int commandLineFileCount = static_cast<unsigned int>(ftell(commandLineFile)); + rewind(commandLineFile); + const unsigned int bufferCount = static_cast<unsigned int>(::strlen(programName)) + 1 + commandLineFileCount + 1; + if(bufferCount > 0) + { + char * argsOwn = static_cast<char*>(::malloc(bufferCount)); + Ps::strlcpy(argsOwn, bufferCount, programName); + Ps::strlcat(argsOwn, bufferCount, " "); + const unsigned int offset = static_cast<unsigned int>(::strlen(argsOwn)); + PX_ASSERT((bufferCount - offset - 1) == commandLineFileCount); + if(NULL != fgets(argsOwn + offset, bufferCount - offset, commandLineFile)) + { + argv = CommandLineToArgvA(argsOwn, argc); + } + ::free(argsOwn); + argsOwn = NULL; + } + operationOK(fclose(commandLineFile)); + commandLineFile = NULL; + } + } + return argv; +} +} //namespace nameless + +SampleCommandLine::SampleCommandLine(unsigned int argc, const char * const * argv, const char * commandLineFilePathFallback) + :m_argc(0) + ,m_argv(NULL) + ,m_freeme(NULL) + ,m_argUsed(NULL) +{ + //initially, set to use inherent command line arguments + PX_ASSERT((0 != argc) && (NULL != argv) && "This class assumes argument 0 is always the executable path!"); + m_argc = argc; + m_argv = argv; + + //finalize init + initCommon(commandLineFilePathFallback); +} + +SampleCommandLine::SampleCommandLine(const char * args, const char * commandLineFilePathFallback) + :m_argc(0) + ,m_argv(NULL) + ,m_freeme(NULL) + ,m_argUsed(NULL) +{ + //initially, set to use inherent command line arguments + unsigned int argc = 0; + const char * const * argvOwning = NULL; + argvOwning = CommandLineToArgvA(args, argc); + PX_ASSERT((0 != argc) && (NULL != argvOwning) && "This class assumes argument 0 is always the executable path!"); + m_argc = argc; + m_argv = argvOwning; + m_freeme = const_cast<void *>(static_cast<const void *>(argvOwning)); + argvOwning = NULL; + + //finalize init + initCommon(commandLineFilePathFallback); +} + +SampleCommandLine::~SampleCommandLine(void) +{ + if(m_freeme) + { + free(m_freeme); + m_freeme = NULL; + } + if(m_argUsed) + { + delete[] m_argUsed; + m_argUsed = NULL; + } +} + +void SampleCommandLine::initCommon(const char * commandLineFilePathFallback) +{ + //if available, set to use command line arguments from file + const bool tryUseCommandLineArgumentsFromFile = ((1 == m_argc) && (NULL != commandLineFilePathFallback)); + if(tryUseCommandLineArgumentsFromFile) + { + unsigned int argcFile = 0; + const char * const * argvFileOwn = NULL; + argvFileOwn = getCommandLineArgumentsFromFile(argcFile, m_argv[0], commandLineFilePathFallback); + if((0 != argcFile) && (NULL != argvFileOwn)) + { + if(NULL != m_freeme) + { + ::free(m_freeme); + m_freeme = NULL; + } + m_argc = argcFile; + m_argv = argvFileOwn; + m_freeme = const_cast<void *>(static_cast<const void *>(argvFileOwn)); + argvFileOwn = NULL; + } + } + + //for tracking use-status of arguments + if((0 != m_argc) && (NULL != m_argv)) + { + m_argUsed = new bool[m_argc]; + for(unsigned int i = 0; i < m_argc; i++) + { + m_argUsed[i] = false; + } + } +} + +unsigned int SampleCommandLine::getNumArgs(void) const +{ + return(m_argc); +} + +const char * SampleCommandLine::getProgramName(void) const +{ + return(m_argv[0]); +} + +unsigned int SampleCommandLine::unusedArgsBufSize(void) const +{ + unsigned int bufLen = 0; + for(unsigned int i = 1; i < m_argc; i++) + { + if((!m_argUsed[i]) && isSwitchChar(m_argv[i][0])) + { + bufLen += (unsigned int) strlen(m_argv[i]) + 1; // + 1 is for the space between unused args + } + } + if(bufLen != 0) + { + bufLen++; // if there are unused args add a space for the '\0' char. + } + return(bufLen); +} + +const char* SampleCommandLine::getUnusedArgs(char *buf, unsigned int bufSize) const +{ + if(bufSize != 0) + { + buf[0] = '\0'; + for(unsigned int i = 1; i < m_argc; i++) + { + if((!m_argUsed[i]) && isSwitchChar(m_argv[i][0])) + { + Ps::strlcat(buf, bufSize, m_argv[i]); + Ps::strlcat(buf, bufSize, " "); + } + } + } + return(buf); +} + +//! has a given command-line switch? +// e.g. s=="foo" checks for -foo +bool SampleCommandLine::hasSwitch(const char *s, unsigned int argNum) const +{ + bool has = false; + PX_ASSERT(*s); + if(*s) + { + unsigned int n = (unsigned int) strlen(s); + unsigned int firstArg; + unsigned int lastArg; + if(argNum != invalidArgNum) + { + firstArg = argNum; + lastArg = argNum; + } + else + { + firstArg = 1; + lastArg = (m_argc > 1) ? (m_argc - 1) : 0; + } + for(unsigned int i=firstArg; i<=lastArg; i++) + { + const char *arg = m_argv[i]; + // allow switches of '/', '-', and double character versions of both. + if( (isSwitchChar(*arg) && !Ps::strnicmp(arg+1, s, n) && ((arg[n+1]=='\0')||(arg[n+1]=='='))) || + (isSwitchChar(*(arg+1)) && !Ps::strnicmp(arg+2, s, n) && ((arg[n+2]=='\0')||(arg[n+2]=='='))) ) + { + m_argUsed[i] = true; + has = true; + break; + } + } + } + return has; +} + +//! gets the value of a switch... +// e.g. s="foo" returns "bar" if '-foo=bar' is in the commandline. +const char *SampleCommandLine::getValue(const char *s, unsigned int argNum) const +{ + const char *value = 0; + PX_ASSERT(*s); + if(*s) + { + unsigned int firstArg; + unsigned int lastArg; + if(argNum != invalidArgNum) + { + firstArg = argNum; + lastArg = argNum; + } + else + { + firstArg = 1; + lastArg = m_argc - 1; + } + for(unsigned int i=firstArg; i<=lastArg; i++) + { + const char *arg = m_argv[i]; + if(isSwitchChar(*arg)) + { + arg++; + if(isSwitchChar(*arg)) // is it a double dash arg? '--' + { + arg++; + } + const char *st=s; + for(; *st && *arg && toupper(*st)==toupper(*arg) && *arg!='='; st++,arg++) + { + } + if(!*st && *arg=='=') + { + m_argUsed[i] = true; + value = arg+1; + break; + } + if(!*st && !*arg && ((i+1)<m_argc) && (!isSwitchChar(*m_argv[i+1]))) + { + m_argUsed[i] = true; + value = m_argv[i+1]; + break; + } + } + } + } + return value; +} + +//! if the first argument is the given command. +bool SampleCommandLine::isCommand(const char *s) const +{ + bool has = false; + const char *command = getCommand(); + if(command && !Ps::stricmp(command, s)) + { + has = true; + } + return has; +} + +//! get the first argument assuming it isn't a switch. +// e.g. for the command-line "myapp.exe editor -foo" it will return "editor". +const char *SampleCommandLine::getCommand(void) const +{ + const char *command = 0; + if(m_argc > 1 && !isSwitchChar(*m_argv[1])) + { + command = m_argv[1]; + } + return command; +} + +//! whether or not an argument has been read already +bool SampleCommandLine::isUsed(unsigned int argNum) const +{ + return argNum < m_argc ? m_argUsed[argNum] : false; +} diff --git a/PhysX_3.4/Samples/SampleFramework/framework/src/SampleDirManager.cpp b/PhysX_3.4/Samples/SampleFramework/framework/src/SampleDirManager.cpp new file mode 100644 index 00000000..12bd98d7 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/framework/src/SampleDirManager.cpp @@ -0,0 +1,121 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#include "SampleDirManager.h" +#include "SampleAssetManager.h" +#include "SamplePlatform.h" +#include "PsUtilities.h" +#include "PxTkFile.h" +#include "PsString.h" + +using namespace SampleFramework; + +static void FixPathSeparator(char* pathBuffer) +{ + char separator = SampleFramework::SamplePlatform::platform()->getPathSeparator()[0]; + + const size_t length = strlen(pathBuffer); + for(size_t i=0; i<length ; ++i) + { + if ('/' == pathBuffer[i] || '\\' == pathBuffer[i]) + pathBuffer[i] = separator; + } +} + +SampleDirManager::SampleDirManager(const char* relativePathRoot, bool isReadOnly, int maxRecursion) : mIsReadOnly(isReadOnly) +{ + if(!relativePathRoot || !SampleFramework::searchForPath(relativePathRoot, mPathRoot, PX_ARRAY_SIZE(mPathRoot), isReadOnly, maxRecursion)) + { + shdfnd::printFormatted("path \"%s\" not found\n", relativePathRoot); + mPathRoot[0] = '\0'; + } +} + +#define MAX_PATH_LENGTH 256 + +const char* SampleDirManager::getFilePath(const char* relativeFilePath, char* pathBuffer, bool testFileValidity) +{ + PX_ASSERT(pathBuffer); + + bool flattenRelativeFilePaths = false; +#if defined (RENDERER_IOS) + //iOS doesn't allow to share files in folders... + flattenRelativeFilePaths = !mIsReadOnly; +#endif + + strcpy(pathBuffer, getPathRoot()); + strcat(pathBuffer, "/"); + + if (flattenRelativeFilePaths) + { + char flattendPath[MAX_PATH_LENGTH]; + strcpy(flattendPath, relativeFilePath); + for (size_t i = 0; i < strlen(flattendPath); ++i) + { + if ('/' == flattendPath[i] || '\\' == flattendPath[i]) + flattendPath[i] = '_'; + } + strcat(pathBuffer, flattendPath); + } + else + { + strcat(pathBuffer, relativeFilePath); + if (!mIsReadOnly) + { + FixPathSeparator(pathBuffer); + //strip file from path and make sure the output directory exists + const char* ptr = strrchr(pathBuffer, '/'); + if (!ptr) + ptr = strrchr(pathBuffer, '\\'); + + if (ptr) + { + char dir[MAX_PATH_LENGTH]; + assert(MAX_PATH_LENGTH >= strlen(pathBuffer)); + strcpy(dir, pathBuffer); + dir[ptr - pathBuffer] = '\0'; + FixPathSeparator(dir); + SampleFramework::SamplePlatform::platform()->makeSureDirectoryPathExists(dir); + } + } + } + + FixPathSeparator(pathBuffer); + + if(testFileValidity) + { + File* fp = NULL; + PxToolkit::fopen_s(&fp, pathBuffer, "rb"); + if(!fp) + { + // Kai: user can still get full path in the path buffer (side effect) + return NULL; + } + fclose(fp); + } + + return pathBuffer; +} diff --git a/PhysX_3.4/Samples/SampleFramework/framework/src/SampleInputAsset.cpp b/PhysX_3.4/Samples/SampleFramework/framework/src/SampleInputAsset.cpp new file mode 100644 index 00000000..2de45556 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/framework/src/SampleInputAsset.cpp @@ -0,0 +1,100 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#include "SampleInputAsset.h" +#include "ODBlock.h" +#include <PxTkFile.h> +#include <PsString.h> + +using namespace SampleFramework; + +SampleInputAsset::SampleInputAsset(File* file, const char *path) +: SampleAsset(SampleAsset::ASSET_INPUT, path) +, m_SettingsBlock(NULL) +, m_File(file) +{ + m_SampleInputData.reserve(128); + + PX_ASSERT(file); + + if (!m_Mapping.loadScript(file)) + { + shdfnd::printFormatted("ODS parse error: %s in file: %s\n", m_Mapping.lastError, path); + PX_ASSERT(0); + } + + m_SettingsBlock = m_Mapping.getBlock("InputMapping"); + if (!m_SettingsBlock) + { + shdfnd::printFormatted("No \"InputEventSettings\" block found!\n"); + PX_ASSERT(0); + } + else + { + LoadData(m_SettingsBlock); + } +} + +SampleInputAsset::~SampleInputAsset() +{ + if(m_File) + { + fclose(m_File); + } +} + +void SampleInputAsset::LoadData(ODBlock* odsSettings) +{ + odsSettings->reset(); + while (odsSettings->moreSubBlocks()) + { + ODBlock* subBlock = odsSettings->nextSubBlock(); + subBlock->reset(); + + SampleInputData inputData; + if (!strcmp(subBlock->ident(), "map")) + { + if (subBlock->moreTerminals()) + { + const char* p = subBlock->nextTerminal(); + strcpy(inputData.m_UserInputName, p); + } + if (subBlock->moreTerminals()) + { + const char* p = subBlock->nextTerminal(); + strcpy(inputData.m_InputEventName, p); + } + + m_SampleInputData.push_back(inputData); + } + } +} + +bool SampleInputAsset::isOk(void) const +{ + return true; +} diff --git a/PhysX_3.4/Samples/SampleFramework/framework/src/SampleLineDebugRender.cpp b/PhysX_3.4/Samples/SampleFramework/framework/src/SampleLineDebugRender.cpp new file mode 100644 index 00000000..243d1671 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/framework/src/SampleLineDebugRender.cpp @@ -0,0 +1,215 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#include <SampleLineDebugRender.h> +#include <Renderer.h> +#include <RendererVertexBuffer.h> +#include <RendererVertexBufferDesc.h> +#include <RendererMesh.h> +#include <RendererMeshDesc.h> +#include <SampleAssetManager.h> +#include <SampleMaterialAsset.h> +#include <RendererMemoryMacros.h> + +using namespace SampleFramework; + +SampleLineDebugRender::SampleLineDebugRender(SampleRenderer::Renderer &renderer, SampleAssetManager &assetmanager) : + m_renderer(renderer), + m_assetmanager(assetmanager) +{ + m_material = static_cast<SampleMaterialAsset*>(m_assetmanager.getAsset("materials/simple_unlit.xml", SampleAsset::ASSET_MATERIAL)); + PX_ASSERT(m_material); + PX_ASSERT(m_material->getNumVertexShaders() == 1); + m_meshContext.material = m_material ? m_material->getMaterial(0) : 0; + + m_maxVerts = 0; + m_numVerts = 0; + m_vertexbuffer = 0; + m_mesh = 0; + m_lockedPositions = 0; + m_positionStride = 0; + m_lockedColors = 0; + m_colorStride = 0; + + checkResizeLine(2048); +} + +SampleLineDebugRender::~SampleLineDebugRender(void) +{ + checkUnlock(); + SAFE_RELEASE(m_vertexbuffer); + SAFE_RELEASE(m_mesh); + if(m_material) + { + m_assetmanager.returnAsset(*m_material); + } +} + +void SampleLineDebugRender::addLine(const PxVec3 &p0, const PxVec3 &p1, const SampleRenderer::RendererColor &color) +{ + checkResizeLine(m_numVerts+2); + addVert(p0, color); + addVert(p1, color); +} + +void SampleLineDebugRender::queueForRenderLine(void) +{ + if(m_meshContext.mesh) + { + checkUnlock(); + m_mesh->setVertexBufferRange(0, m_numVerts); + m_renderer.queueMeshForRender(m_meshContext); + } +} + +void SampleLineDebugRender::clearLine(void) +{ + m_numVerts = 0; +} + +void SampleLineDebugRender::checkResizeLine(PxU32 maxVerts) +{ + if(maxVerts > m_maxVerts) + { + m_maxVerts = maxVerts + (PxU32)(maxVerts*0.2f); + + SampleRenderer::RendererVertexBufferDesc vbdesc; + vbdesc.hint = SampleRenderer::RendererVertexBuffer::HINT_DYNAMIC; + vbdesc.semanticFormats[SampleRenderer::RendererVertexBuffer::SEMANTIC_POSITION] = SampleRenderer::RendererVertexBuffer::FORMAT_FLOAT3; + vbdesc.semanticFormats[SampleRenderer::RendererVertexBuffer::SEMANTIC_COLOR] = SampleRenderer::RendererVertexBuffer::FORMAT_COLOR_NATIVE; // same as RendererColor + vbdesc.maxVertices = m_maxVerts; + SampleRenderer::RendererVertexBuffer *vertexbuffer = m_renderer.createVertexBuffer(vbdesc); + PX_ASSERT(vertexbuffer); + + if(vertexbuffer) + { + PxU32 positionStride = 0; + void *positions = vertexbuffer->lockSemantic(SampleRenderer::RendererVertexBuffer::SEMANTIC_POSITION, positionStride); + + PxU32 colorStride = 0; + void *colors = vertexbuffer->lockSemantic(SampleRenderer::RendererVertexBuffer::SEMANTIC_COLOR, colorStride); + + PX_ASSERT(positions && colors); + if(positions && colors) + { + if(m_numVerts > 0) + { + // if we have existing verts, copy them to the new VB... + PX_ASSERT(m_lockedPositions); + PX_ASSERT(m_lockedColors); + if(m_lockedPositions && m_lockedColors) + { + for(PxU32 i=0; i<m_numVerts; i++) + { + memcpy(((PxU8*)positions) + (positionStride*i), ((PxU8*)m_lockedPositions) + (m_positionStride*i), sizeof(PxVec3)); + memcpy(((PxU8*)colors) + (colorStride*i), ((PxU8*)m_lockedColors) + (m_colorStride*i), sizeof(SampleRenderer::RendererColor)); + } + } + m_vertexbuffer->unlockSemantic(SampleRenderer::RendererVertexBuffer::SEMANTIC_COLOR); + m_vertexbuffer->unlockSemantic(SampleRenderer::RendererVertexBuffer::SEMANTIC_POSITION); + } + } + vertexbuffer->unlockSemantic(SampleRenderer::RendererVertexBuffer::SEMANTIC_COLOR); + vertexbuffer->unlockSemantic(SampleRenderer::RendererVertexBuffer::SEMANTIC_POSITION); + } + if(m_vertexbuffer) + { + m_vertexbuffer->release(); + m_vertexbuffer = 0; + m_lockedPositions = 0; + m_positionStride = 0; + m_lockedColors = 0; + m_colorStride = 0; + } + SAFE_RELEASE(m_mesh); + if(vertexbuffer) + { + m_vertexbuffer = vertexbuffer; + SampleRenderer::RendererMeshDesc meshdesc; + meshdesc.primitives = SampleRenderer::RendererMesh::PRIMITIVE_LINES; + meshdesc.vertexBuffers = &m_vertexbuffer; + meshdesc.numVertexBuffers = 1; + meshdesc.firstVertex = 0; + meshdesc.numVertices = m_numVerts; + m_mesh = m_renderer.createMesh(meshdesc); + PX_ASSERT(m_mesh); + } + m_meshContext.mesh = m_mesh; + } +} + +void SampleLineDebugRender::checkLock(void) +{ + if(m_vertexbuffer) + { + if(!m_lockedPositions) + { + m_lockedPositions = m_vertexbuffer->lockSemantic(SampleRenderer::RendererVertexBuffer::SEMANTIC_POSITION, m_positionStride); + PX_ASSERT(m_lockedPositions); + } + if(!m_lockedColors) + { + m_lockedColors = m_vertexbuffer->lockSemantic(SampleRenderer::RendererVertexBuffer::SEMANTIC_COLOR, m_colorStride); + PX_ASSERT(m_lockedColors); + } + } +} + +void SampleLineDebugRender::checkUnlock(void) +{ + if(m_vertexbuffer) + { + if(m_lockedPositions) + { + m_vertexbuffer->unlockSemantic(SampleRenderer::RendererVertexBuffer::SEMANTIC_POSITION); + m_lockedPositions = 0; + } + if(m_lockedColors) + { + m_vertexbuffer->unlockSemantic(SampleRenderer::RendererVertexBuffer::SEMANTIC_COLOR); + m_lockedColors = 0; + } + } +} + +void SampleLineDebugRender::addVert(const PxVec3 &p, const SampleRenderer::RendererColor &color) +{ + PX_ASSERT(m_maxVerts > m_numVerts); + { + checkLock(); + if(m_lockedPositions && m_lockedColors) + { + memcpy(((PxU8*)m_lockedPositions) + (m_positionStride*m_numVerts), &p, sizeof(PxVec3)); +#if defined(RENDERER_XBOX360) + PxU8 colors[4] = {color.a, color.r, color.g, color.b}; + memcpy(((PxU8*)m_lockedColors) + (m_colorStride*m_numVerts), colors, sizeof(PxU8) * 4); +#else + memcpy(((PxU8*)m_lockedColors) + (m_colorStride*m_numVerts), &color, sizeof(SampleRenderer::RendererColor)); +#endif + m_numVerts++; + } + } +} diff --git a/PhysX_3.4/Samples/SampleFramework/framework/src/SampleMaterialAsset.cpp b/PhysX_3.4/Samples/SampleFramework/framework/src/SampleMaterialAsset.cpp new file mode 100644 index 00000000..238217ee --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/framework/src/SampleMaterialAsset.cpp @@ -0,0 +1,308 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#include <SampleMaterialAsset.h> + +#include <Renderer.h> +#include <RendererMaterial.h> +#include <RendererMaterialDesc.h> +#include <RendererMaterialInstance.h> + +#include <SampleAssetManager.h> +#include <SampleTextureAsset.h> + +#include "SampleXml.h" +#include <ctype.h> + +using namespace SampleFramework; + +static SampleRenderer::RendererMaterial::BlendFunc +getBlendFunc(const char* nodeValue, + SampleRenderer::RendererMaterial::BlendFunc defaultBlendFunc = SampleRenderer::RendererMaterial::BLEND_ONE) +{ + using SampleRenderer::RendererMaterial; + RendererMaterial::BlendFunc blendFunc = defaultBlendFunc; + if( !strcmp(nodeValue, "ZERO")) blendFunc = RendererMaterial::BLEND_ZERO; + else if(!strcmp(nodeValue, "ONE")) blendFunc = RendererMaterial::BLEND_ONE; + else if(!strcmp(nodeValue, "SRC_COLOR")) blendFunc = RendererMaterial::BLEND_SRC_COLOR; + else if(!strcmp(nodeValue, "ONE_MINUS_SRC_COLOR")) blendFunc = RendererMaterial::BLEND_ONE_MINUS_SRC_COLOR; + else if(!strcmp(nodeValue, "SRC_ALPHA")) blendFunc = RendererMaterial::BLEND_SRC_ALPHA; + else if(!strcmp(nodeValue, "ONE_MINUS_SRC_ALPHA")) blendFunc = RendererMaterial::BLEND_ONE_MINUS_SRC_ALPHA; + else if(!strcmp(nodeValue, "DST_COLOR")) blendFunc = RendererMaterial::BLEND_DST_COLOR; + else if(!strcmp(nodeValue, "ONE_MINUS_DST_COLOR")) blendFunc = RendererMaterial::BLEND_ONE_MINUS_DST_COLOR; + else if(!strcmp(nodeValue, "DST_ALPHA")) blendFunc = RendererMaterial::BLEND_DST_ALPHA; + else if(!strcmp(nodeValue, "ONE_MINUS_DST_ALPHA")) blendFunc = RendererMaterial::BLEND_ONE_MINUS_DST_ALPHA; + else if(!strcmp(nodeValue, "SRC_ALPHA_SATURATE")) blendFunc = RendererMaterial::BLEND_SRC_ALPHA_SATURATE; + else PX_ASSERT(0); // Unknown blend func! + + return blendFunc; +} + +static void readFloats(const char *str, float *floats, unsigned int numFloats) +{ + PxU32 fcount = 0; + while(*str && !((*str>='0'&&*str<='9') || *str=='.')) str++; + for(PxU32 i=0; i<numFloats; i++) + { + if(*str) + { + floats[i] = (float)atof(str); + while(*str && ((*str>='0'&&*str<='9') || *str=='.')) str++; + while(*str && !((*str>='0'&&*str<='9') || *str=='.')) str++; + fcount++; + } + } + PX_ASSERT(fcount==numFloats); +} + +SampleMaterialAsset::SampleMaterialAsset(SampleAssetManager &assetManager, FAST_XML::xml_node &xmlroot, const char *path) : +SampleAsset(ASSET_MATERIAL, path), + m_assetManager(assetManager) +{ + + std::vector<const char*> mVertexShaderPaths; + //m_material = 0; + //m_materialInstance = 0; + + SampleRenderer::Renderer &renderer = assetManager.getRenderer(); + + SampleRenderer::RendererMaterialDesc matdesc; + const char *materialTypeName = xmlroot.getXMLAttribute("type"); + if(materialTypeName && !strcmp(materialTypeName, "lit")) + { + matdesc.type = SampleRenderer::RendererMaterial::TYPE_LIT; + } + else if(materialTypeName && !strcmp(materialTypeName, "unlit")) + { + matdesc.type = SampleRenderer::RendererMaterial::TYPE_UNLIT; + } + for(FAST_XML::xml_node *child=xmlroot.first_node(); child; child=child->next_sibling()) + { + const char *nodeName = child->name(); + const char *nodeValue = child->value(); + const char *name = child->getXMLAttribute("name"); + if(nodeName && nodeValue) + { + while(isspace(*nodeValue)) nodeValue++; // skip leading spaces. + if(!strcmp(nodeName, "shader")) + { + if(name && !strcmp(name, "vertex")) + { + //matdesc.vertexShaderPath = nodeValue; + mVertexShaderPaths.push_back(nodeValue); + } + else if(name && !strcmp(name, "fragment")) + { + matdesc.fragmentShaderPath = nodeValue; + } + else if(name && !strcmp(name, "geometry")) + { + matdesc.geometryShaderPath = nodeValue; + } + else if(name && !strcmp(name, "hull")) + { + matdesc.hullShaderPath = nodeValue; + } + else if(name && !strcmp(name, "domain")) + { + matdesc.domainShaderPath = nodeValue; + } + } + else if(!strcmp(nodeName, "alphaTestFunc")) + { + if( !strcmp(nodeValue, "EQUAL")) matdesc.alphaTestFunc = SampleRenderer::RendererMaterial::ALPHA_TEST_EQUAL; + else if(!strcmp(nodeValue, "NOT_EQUAL")) matdesc.alphaTestFunc = SampleRenderer::RendererMaterial::ALPHA_TEST_NOT_EQUAL; + else if(!strcmp(nodeValue, "LESS")) matdesc.alphaTestFunc = SampleRenderer::RendererMaterial::ALPHA_TEST_LESS; + else if(!strcmp(nodeValue, "LESS_EQUAL")) matdesc.alphaTestFunc = SampleRenderer::RendererMaterial::ALPHA_TEST_LESS_EQUAL; + else if(!strcmp(nodeValue, "GREATER")) matdesc.alphaTestFunc = SampleRenderer::RendererMaterial::ALPHA_TEST_GREATER; + else if(!strcmp(nodeValue, "GREATER_EQUAL")) matdesc.alphaTestFunc = SampleRenderer::RendererMaterial::ALPHA_TEST_GREATER_EQUAL; + else PX_ASSERT(0); // Unknown alpha test func! + } + else if(!strcmp(nodeName, "alphaTestRef")) + { + matdesc.alphaTestRef = PxClamp((float)atof(nodeValue), 0.0f, 1.0f); + } + else if(!strcmp(nodeName, "blending") && strstr(nodeValue, "true")) + { + matdesc.blending = true; + + static const PxU32 numBlendFuncs = 2; + static const char* blendFuncNames[numBlendFuncs] = + { + "srcBlendFunc", + "dstBlendFunc" + }; + static const SampleRenderer::RendererMaterial::BlendFunc blendFuncDefaults[numBlendFuncs] = + { + SampleRenderer::RendererMaterial::BLEND_SRC_ALPHA, + SampleRenderer::RendererMaterial::BLEND_ONE_MINUS_SRC_ALPHA + }; + SampleRenderer::RendererMaterial::BlendFunc* blendFuncs[numBlendFuncs] = + { + &matdesc.srcBlendFunc, + &matdesc.dstBlendFunc + }; + + // Parse optional src/dst blend funcs + for (PxU32 i = 0; i < numBlendFuncs; ++i) + { + FAST_XML::xml_node *blendNode = child->first_node(blendFuncNames[i]); + if (blendNode && blendNode->value()) + *blendFuncs[i] = getBlendFunc(blendNode->value(), blendFuncDefaults[i]); + else + *blendFuncs[i] = blendFuncDefaults[i]; + } + } + } + } + + for (size_t materialIndex = 0; materialIndex < mVertexShaderPaths.size(); materialIndex++) + { + MaterialStruct materialStruct; + + matdesc.vertexShaderPath = mVertexShaderPaths[materialIndex]; + materialStruct.m_material = NULL; + materialStruct.m_materialInstance = NULL; + materialStruct.m_maxBones = 0; + if (strstr(mVertexShaderPaths[materialIndex], "skeletalmesh") != NULL) + materialStruct.m_maxBones = RENDERER_MAX_BONES; + + materialStruct.m_material = renderer.createMaterial(matdesc); + PX_ASSERT(materialStruct.m_material); + if(materialStruct.m_material) + { + FAST_XML::xml_node *varsnode = xmlroot.first_node("variables"); + if(varsnode) + { + materialStruct.m_materialInstance = new SampleRenderer::RendererMaterialInstance(*materialStruct.m_material); + for(FAST_XML::xml_node *child=varsnode->first_node(); child; child=child->next_sibling()) + { + const char *nodename = child->name(); + const char *varname = child->getXMLAttribute("name"); + const char *value = child->value(); + + if(!strcmp(nodename, "float")) + { + float f = (float)atof(value); + const SampleRenderer::RendererMaterial::Variable *var = materialStruct.m_materialInstance->findVariable(varname, SampleRenderer::RendererMaterial::VARIABLE_FLOAT); + //PX_ASSERT(var); + if(var) materialStruct.m_materialInstance->writeData(*var, &f); + } + else if(!strcmp(nodename, "float2")) + { + float f[2]; + readFloats(value, f, 2); + const SampleRenderer::RendererMaterial::Variable *var = materialStruct.m_materialInstance->findVariable(varname, SampleRenderer::RendererMaterial::VARIABLE_FLOAT2); + //PX_ASSERT(var); + if(var) materialStruct.m_materialInstance->writeData(*var, f); + } + else if(!strcmp(nodename, "float3")) + { + float f[3]; + readFloats(value, f, 3); + const SampleRenderer::RendererMaterial::Variable *var = materialStruct.m_materialInstance->findVariable(varname, SampleRenderer::RendererMaterial::VARIABLE_FLOAT3); + //PX_ASSERT(var); + if(var) materialStruct.m_materialInstance->writeData(*var, f); + } + else if(!strcmp(nodename, "float4")) + { + float f[4]; + readFloats(value, f, 4); + const SampleRenderer::RendererMaterial::Variable *var = materialStruct.m_materialInstance->findVariable(varname, SampleRenderer::RendererMaterial::VARIABLE_FLOAT4); + //PX_ASSERT(var); + if(var) materialStruct.m_materialInstance->writeData(*var, f); + } + else if(!strcmp(nodename, "sampler2D") || !strcmp(nodename, "sampler3D")) + { + SampleTextureAsset *textureAsset = static_cast<SampleTextureAsset*>(assetManager.getAsset(value, ASSET_TEXTURE)); + PX_ASSERT(textureAsset); + if(textureAsset) + { + m_assets.push_back(textureAsset); + SampleRenderer::RendererMaterial::VariableType vartype = (0 == strcmp(nodename, "sampler2D")) ? SampleRenderer::RendererMaterial::VARIABLE_SAMPLER2D : SampleRenderer::RendererMaterial::VARIABLE_SAMPLER3D; + const SampleRenderer::RendererMaterial::Variable *var = materialStruct.m_materialInstance->findVariable(varname, vartype); + //PX_ASSERT(var); + if(var) + { + SampleRenderer::RendererTexture *texture = textureAsset->getTexture(); + materialStruct.m_materialInstance->writeData(*var, &texture); + } + } + } + + } + } + + m_vertexShaders.push_back(materialStruct); + } + } +} + +SampleFramework::SampleMaterialAsset::SampleMaterialAsset(SampleAssetManager &assetManager, Type type, const char *path) +: SampleAsset(type, path), + m_assetManager(assetManager) +{ + +} + +SampleMaterialAsset::~SampleMaterialAsset(void) +{ + PxU32 numAssets = (PxU32)m_assets.size(); + for(PxU32 i=0; i<numAssets; i++) + { + m_assetManager.returnAsset(*m_assets[i]); + } + for (size_t index = 0; index < m_vertexShaders.size(); index++) + { + if(m_vertexShaders[index].m_materialInstance) delete m_vertexShaders[index].m_materialInstance; + if(m_vertexShaders[index].m_material) m_vertexShaders[index].m_material->release(); + } +} + +size_t SampleMaterialAsset::getNumVertexShaders() const +{ + return m_vertexShaders.size(); +} + +SampleRenderer::RendererMaterial *SampleMaterialAsset::getMaterial(size_t vertexShaderIndex) +{ + return m_vertexShaders[vertexShaderIndex].m_material; +} + +SampleRenderer::RendererMaterialInstance *SampleMaterialAsset::getMaterialInstance(size_t vertexShaderIndex) +{ + return m_vertexShaders[vertexShaderIndex].m_materialInstance; +} + +bool SampleMaterialAsset::isOk(void) const +{ + return !m_vertexShaders.empty(); +} + +unsigned int SampleMaterialAsset::getMaxBones(size_t vertexShaderIndex) const +{ + return m_vertexShaders[vertexShaderIndex].m_maxBones; +} diff --git a/PhysX_3.4/Samples/SampleFramework/framework/src/SamplePointDebugRender.cpp b/PhysX_3.4/Samples/SampleFramework/framework/src/SamplePointDebugRender.cpp new file mode 100644 index 00000000..65a6e5a4 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/framework/src/SamplePointDebugRender.cpp @@ -0,0 +1,207 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#include <SamplePointDebugRender.h> +#include <Renderer.h> +#include <RendererVertexBuffer.h> +#include <RendererVertexBufferDesc.h> +#include <RendererMesh.h> +#include <RendererMeshDesc.h> +#include <SampleAssetManager.h> +#include <SampleMaterialAsset.h> +#include <RendererMemoryMacros.h> + +using namespace SampleFramework; + +SamplePointDebugRender::SamplePointDebugRender(SampleRenderer::Renderer &renderer, SampleAssetManager &assetmanager) : + m_renderer(renderer), + m_assetmanager(assetmanager) +{ + m_material = static_cast<SampleMaterialAsset*>(m_assetmanager.getAsset("materials/simple_unlit.xml", SampleAsset::ASSET_MATERIAL)); + PX_ASSERT(m_material); + PX_ASSERT(m_material->getNumVertexShaders() == 1); + m_meshContext.material = m_material ? m_material->getMaterial(0) : 0; + + m_maxVerts = 0; + m_numVerts = 0; + m_vertexbuffer = 0; + m_mesh = 0; + m_lockedPositions = 0; + m_positionStride = 0; + m_lockedColors = 0; + m_colorStride = 0; +} + +SamplePointDebugRender::~SamplePointDebugRender(void) +{ + checkUnlock(); + SAFE_RELEASE(m_vertexbuffer); + SAFE_RELEASE(m_mesh); + if(m_material) + { + m_assetmanager.returnAsset(*m_material); + } +} + +void SamplePointDebugRender::addPoint(const PxVec3 &p0, const SampleRenderer::RendererColor &color) +{ + checkResizePoint(m_numVerts+1); + addVert(p0, color); +} + +void SamplePointDebugRender::queueForRenderPoint(void) +{ + if(m_meshContext.mesh) + { + checkUnlock(); + m_mesh->setVertexBufferRange(0, m_numVerts); + m_renderer.queueMeshForRender(m_meshContext); + } +} + +void SamplePointDebugRender::clearPoint(void) +{ + m_numVerts = 0; +} + +void SamplePointDebugRender::checkResizePoint(PxU32 maxVerts) +{ + if(maxVerts > m_maxVerts) + { + m_maxVerts = maxVerts + (PxU32)(maxVerts*0.2f); + + SampleRenderer::RendererVertexBufferDesc vbdesc; + vbdesc.hint = SampleRenderer::RendererVertexBuffer::HINT_DYNAMIC; + vbdesc.semanticFormats[SampleRenderer::RendererVertexBuffer::SEMANTIC_POSITION] = SampleRenderer::RendererVertexBuffer::FORMAT_FLOAT3; + vbdesc.semanticFormats[SampleRenderer::RendererVertexBuffer::SEMANTIC_COLOR] = SampleRenderer::RendererVertexBuffer::FORMAT_COLOR_NATIVE; // same as RendererColor + vbdesc.maxVertices = m_maxVerts; + SampleRenderer::RendererVertexBuffer *vertexbuffer = m_renderer.createVertexBuffer(vbdesc); + PX_ASSERT(vertexbuffer); + + if(vertexbuffer) + { + PxU32 positionStride = 0; + void *positions = vertexbuffer->lockSemantic(SampleRenderer::RendererVertexBuffer::SEMANTIC_POSITION, positionStride); + + PxU32 colorStride = 0; + void *colors = vertexbuffer->lockSemantic(SampleRenderer::RendererVertexBuffer::SEMANTIC_COLOR, colorStride); + + PX_ASSERT(positions && colors); + if(positions && colors) + { + if(m_numVerts > 0) + { + // if we have existing verts, copy them to the new VB... + PX_ASSERT(m_lockedPositions); + PX_ASSERT(m_lockedColors); + if(m_lockedPositions && m_lockedColors) + { + for(PxU32 i=0; i<m_numVerts; i++) + { + memcpy(((PxU8*)positions) + (positionStride*i), ((PxU8*)m_lockedPositions) + (m_positionStride*i), sizeof(PxVec3)); + memcpy(((PxU8*)colors) + (colorStride*i), ((PxU8*)m_lockedColors) + (m_colorStride*i), sizeof(SampleRenderer::RendererColor)); + } + } + m_vertexbuffer->unlockSemantic(SampleRenderer::RendererVertexBuffer::SEMANTIC_COLOR); + m_vertexbuffer->unlockSemantic(SampleRenderer::RendererVertexBuffer::SEMANTIC_POSITION); + } + } + vertexbuffer->unlockSemantic(SampleRenderer::RendererVertexBuffer::SEMANTIC_COLOR); + vertexbuffer->unlockSemantic(SampleRenderer::RendererVertexBuffer::SEMANTIC_POSITION); + } + if(m_vertexbuffer) + { + m_vertexbuffer->release(); + m_vertexbuffer = 0; + m_lockedPositions = 0; + m_positionStride = 0; + m_lockedColors = 0; + m_colorStride = 0; + } + SAFE_RELEASE(m_mesh); + if(vertexbuffer) + { + m_vertexbuffer = vertexbuffer; + SampleRenderer::RendererMeshDesc meshdesc; + meshdesc.primitives = SampleRenderer::RendererMesh::PRIMITIVE_POINTS; + meshdesc.vertexBuffers = &m_vertexbuffer; + meshdesc.numVertexBuffers = 1; + meshdesc.firstVertex = 0; + meshdesc.numVertices = m_numVerts; + m_mesh = m_renderer.createMesh(meshdesc); + PX_ASSERT(m_mesh); + } + m_meshContext.mesh = m_mesh; + } +} + +void SamplePointDebugRender::checkLock(void) +{ + if(m_vertexbuffer) + { + if(!m_lockedPositions) + { + m_lockedPositions = m_vertexbuffer->lockSemantic(SampleRenderer::RendererVertexBuffer::SEMANTIC_POSITION, m_positionStride); + PX_ASSERT(m_lockedPositions); + } + if(!m_lockedColors) + { + m_lockedColors = m_vertexbuffer->lockSemantic(SampleRenderer::RendererVertexBuffer::SEMANTIC_COLOR, m_colorStride); + PX_ASSERT(m_lockedColors); + } + } +} + +void SamplePointDebugRender::checkUnlock(void) +{ + if(m_vertexbuffer) + { + if(m_lockedPositions) + { + m_vertexbuffer->unlockSemantic(SampleRenderer::RendererVertexBuffer::SEMANTIC_POSITION); + m_lockedPositions = 0; + } + if(m_lockedColors) + { + m_vertexbuffer->unlockSemantic(SampleRenderer::RendererVertexBuffer::SEMANTIC_COLOR); + m_lockedColors = 0; + } + } +} + +void SamplePointDebugRender::addVert(const PxVec3 &p, const SampleRenderer::RendererColor &color) +{ + PX_ASSERT(m_maxVerts > m_numVerts); + { + checkLock(); + if(m_lockedPositions && m_lockedColors) + { + memcpy(((PxU8*)m_lockedPositions) + (m_positionStride*m_numVerts), &p, sizeof(PxVec3)); + memcpy(((PxU8*)m_lockedColors) + (m_colorStride*m_numVerts), &color, sizeof(SampleRenderer::RendererColor)); + m_numVerts++; + } + } +} diff --git a/PhysX_3.4/Samples/SampleFramework/framework/src/SampleTextureAsset.cpp b/PhysX_3.4/Samples/SampleFramework/framework/src/SampleTextureAsset.cpp new file mode 100644 index 00000000..c6302895 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/framework/src/SampleTextureAsset.cpp @@ -0,0 +1,342 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#include <SampleTextureAsset.h> + +#include <Renderer.h> +#include <RendererTexture2D.h> +#include <RendererTexture2DDesc.h> +#include <RendererMemoryMacros.h> +#include "PxTkBmpLoader.h" + +#include "nv_dds.h" +#include "PxTkFile.h" + +#ifdef RENDERER_ENABLE_TGA_SUPPORT +# include <targa.h> +#endif + +#ifdef RENDERER_ENABLE_PVR_SUPPORT +#include "pvrt.h" +#endif + +using namespace SampleFramework; + +SampleTextureAsset::SampleTextureAsset(SampleRenderer::Renderer &renderer, File &file, const char *path, Type texType) : + SampleAsset(ASSET_TEXTURE, path) +{ + m_texture = 0; + + switch(texType) + { + case DDS: loadDDS(renderer, file); break; + case TGA: loadTGA(renderer, file); break; + case PVR: loadPVR(renderer, file); break; + case BMP: loadBMP(renderer, file); break; + default: PX_ASSERT(0 && "Invalid texture type requested"); break; + } +} + +SampleTextureAsset::~SampleTextureAsset(void) +{ + SAFE_RELEASE(m_texture); +} + +void SampleTextureAsset::loadDDS(SampleRenderer::Renderer &renderer, File &file) +{ + nv_dds::CDDSImage ddsimage; + bool ok = ddsimage.load(&file, false); + PX_ASSERT(ok); + if(ok) + { + SampleRenderer::RendererTexture2DDesc tdesc; + nv_dds::TextureFormat ddsformat = ddsimage.get_format(); + switch(ddsformat) + { + case nv_dds::TextureBGRA: tdesc.format = SampleRenderer::RendererTexture2D::FORMAT_B8G8R8A8; break; + case nv_dds::TextureDXT1: tdesc.format = SampleRenderer::RendererTexture2D::FORMAT_DXT1; break; + case nv_dds::TextureDXT3: tdesc.format = SampleRenderer::RendererTexture2D::FORMAT_DXT3; break; + case nv_dds::TextureDXT5: tdesc.format = SampleRenderer::RendererTexture2D::FORMAT_DXT5; break; + default: break; + } + tdesc.width = ddsimage.get_width(); + tdesc.height = ddsimage.get_height(); + // if there is 1 mipmap, nv_dds reports 0 + tdesc.numLevels = ddsimage.get_num_mipmaps()+1; + PX_ASSERT(tdesc.isValid()); + m_texture = renderer.createTexture2D(tdesc); + PX_ASSERT(m_texture); + if(m_texture) + { + PxU32 pitch = 0; + void *buffer = m_texture->lockLevel(0, pitch); + PX_ASSERT(buffer); + if(buffer) + { + //PxU32 size = ddsimage.get_size(); + + PxU8 *levelDst = (PxU8*)buffer; + const PxU8 *levelSrc = (PxU8*)(unsigned char*)ddsimage; + const PxU32 levelWidth = m_texture->getWidthInBlocks(); + const PxU32 levelHeight = m_texture->getHeightInBlocks(); + const PxU32 rowSrcSize = levelWidth * m_texture->getBlockSize(); + PX_ASSERT(rowSrcSize <= pitch); // the pitch can't be less than the source row size. + for(PxU32 row=0; row<levelHeight; row++) + { + memcpy(levelDst, levelSrc, rowSrcSize); + levelDst += pitch; + levelSrc += rowSrcSize; + } + } + m_texture->unlockLevel(0); + + for(PxU32 i=1; i<tdesc.numLevels; i++) + { + void *buffer = m_texture->lockLevel(i, pitch); + PX_ASSERT(buffer); + if(buffer && pitch ) + { + const nv_dds::CSurface &surface = ddsimage.get_mipmap(i-1); + //PxU32 size = surface.get_size(); + + PxU8 *levelDst = (PxU8*)buffer; + const PxU8 *levelSrc = (PxU8*)(unsigned char*)surface; + const PxU32 levelWidth = SampleRenderer::RendererTexture2D::getFormatNumBlocks(surface.get_width(), m_texture->getFormat()); + const PxU32 levelHeight = SampleRenderer::RendererTexture2D::getFormatNumBlocks(surface.get_height(), m_texture->getFormat()); + const PxU32 rowSrcSize = levelWidth * m_texture->getBlockSize(); + PX_ASSERT(rowSrcSize <= pitch); // the pitch can't be less than the source row size. + for(PxU32 row=0; row<levelHeight; row++) + { + memcpy(levelDst, levelSrc, rowSrcSize); + levelDst += pitch; + levelSrc += rowSrcSize; + } + } + m_texture->unlockLevel(i); + } + } + } +} + +void SampleTextureAsset::loadPVR(SampleRenderer::Renderer& renderer, File& file) +{ +#ifdef RENDERER_ENABLE_PVR_SUPPORT + fseek(&file, 0, SEEK_END); + size_t size = ftell(&file); + fseek(&file, 0, SEEK_SET); + char* fileBuffer = new char[size+1]; + fread(fileBuffer, 1, size, &file); + fclose(&file); + fileBuffer[size] = '\0'; + + const PVRTextureInfo info(fileBuffer); + PX_ASSERT(info.data); + + SampleRenderer::RendererTexture2DDesc tdesc; + if (info.glFormat == GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG) + { + tdesc.format = SampleRenderer::RendererTexture2D::FORMAT_PVR_4BPP; + } + else + { + tdesc.format = SampleRenderer::RendererTexture2D::FORMAT_PVR_2BPP; + } + + tdesc.width = info.width; + tdesc.height = info.height; + tdesc.numLevels = info.mipCount + 1; + tdesc.data = NULL; + + PX_ASSERT(tdesc.isValid()); + m_texture = renderer.createTexture2D(tdesc); + PX_ASSERT(m_texture); + if (!info.data) + { + delete[] fileBuffer; + return; + } + + PxU32 pitch = 0; + PxU8* levelDst = (PxU8*)m_texture->lockLevel(0, pitch); + const PxU8* levelSrc = (PxU8*)info.data; + + PX_ASSERT(levelDst && levelSrc); + { + PxU32 levelWidth = tdesc.width; + PxU32 levelHeight = tdesc.height; + const PxU32 levelSize = m_texture->computeImageByteSize(levelWidth, levelHeight, 1, tdesc.format); + memcpy(levelDst, levelSrc, levelSize); + levelSrc += levelSize; + } + m_texture->unlockLevel(0); + + for(PxU32 i=1; i<tdesc.numLevels; i++) + { + PxU8* levelDst = (PxU8*)m_texture->lockLevel(i, pitch); + PX_ASSERT(levelDst); + { + const PxU32 levelWidth = m_texture->getLevelDimension(tdesc.width, i); + const PxU32 levelHeight = m_texture->getLevelDimension(tdesc.height, i); + const PxU32 levelSize = m_texture->computeImageByteSize(levelWidth, levelHeight, 1, tdesc.format); + memcpy(levelDst, levelSrc, levelSize); + levelSrc += levelSize; + } + m_texture->unlockLevel(i); + } + + delete[] fileBuffer; + +#endif +} + +void SampleTextureAsset::loadTGA(SampleRenderer::Renderer &renderer, File &file) +{ +#ifdef RENDERER_ENABLE_TGA_SUPPORT + tga_image* image = new tga_image(); + bool ok = (TGA_NOERR == tga_read_from_FILE( image, &file )); + + // flip it to make it look correct in the SampleFramework's renderer + tga_flip_vert( image ); + + PX_ASSERT(ok); + if( ok ) + { + SampleRenderer::RendererTexture2DDesc tdesc; + int componentCount = image->pixel_depth/8; + if( componentCount == 3 || componentCount == 4 ) + { + tdesc.format = SampleRenderer::RendererTexture2D::FORMAT_B8G8R8A8; + + tdesc.width = image->width; + tdesc.height = image->height; + + tdesc.numLevels = 1; + PX_ASSERT(tdesc.isValid()); + m_texture = renderer.createTexture2D(tdesc); + PX_ASSERT(m_texture); + + if(m_texture) + { + PxU32 pitch = 0; + void *buffer = m_texture->lockLevel(0, pitch); + PX_ASSERT(buffer); + if(buffer) + { + PxU8 *levelDst = (PxU8*)buffer; + const PxU8 *levelSrc = (PxU8*)image->image_data; + const PxU32 levelWidth = m_texture->getWidthInBlocks(); + const PxU32 levelHeight = m_texture->getHeightInBlocks(); + const PxU32 rowSrcSize = levelWidth * m_texture->getBlockSize(); + PX_ASSERT(rowSrcSize <= pitch); // the pitch can't be less than the source row size. + for(PxU32 row=0; row<levelHeight; row++) + { + if( componentCount == 3 ) + { + // copy per pixel to handle RBG case, based on component count + for(PxU32 col=0; col<levelWidth; col++) + { + *levelDst++ = levelSrc[0]; + *levelDst++ = levelSrc[1]; + *levelDst++ = levelSrc[2]; + *levelDst++ = 0xFF; //alpha + levelSrc += componentCount; + } + } + else + { + memcpy(levelDst, levelSrc, rowSrcSize); + levelDst += pitch == 0xFFFFFFFF ? rowSrcSize : pitch; + levelSrc += rowSrcSize; + } + } + } + m_texture->unlockLevel(0); + } + } + } + tga_free_buffers(image); + delete image; + +#endif /* RENDERER_ENABLE_TGA_SUPPORT */ +} + +void SampleTextureAsset::loadBMP(SampleRenderer::Renderer &renderer, File &file) +{ + PxToolkit::BmpLoader loader; + bool ok = loader.loadBmp(&file); + PX_ASSERT(ok); + if(ok) + { + SampleRenderer::RendererTexture2DDesc tdesc; +#if !defined(RENDERER_PS3) + tdesc.format = SampleRenderer::RendererTexture2D::FORMAT_B8G8R8A8; +#else + tdesc.format = SampleRenderer::RendererTexture2D::FORMAT_R8G8B8A8; +#endif + tdesc.width = loader.mWidth; + tdesc.height = loader.mHeight; + tdesc.numLevels = 1; + PX_ASSERT(tdesc.isValid()); + m_texture = renderer.createTexture2D(tdesc); + PX_ASSERT(m_texture); + if(m_texture) + { + PxU32 pitch = 0; + void *buffer = m_texture->lockLevel(0, pitch); + PX_ASSERT(buffer); + if(buffer) + { + const PxU32 levelWidth = m_texture->getWidthInBlocks(); + const PxU32 levelHeight = m_texture->getHeightInBlocks(); + SampleRenderer::RendererColor* levelDst = (SampleRenderer::RendererColor*)buffer + levelWidth * levelHeight; + const PxU8* levelSrc = (PxU8*)loader.mRGB; + for(PxU32 row=0; row<levelHeight; row++) + { + levelDst -= levelWidth; + // copy per pixel to handle RBG case + for(PxU32 col=0; col<levelWidth; col++) + { + levelDst[col].r = *levelSrc++; + levelDst[col].g = *levelSrc++; + levelDst[col].b = *levelSrc++; + levelDst[col].a = loader.mHasAlpha ? *levelSrc++ : 0xff; + } + } + } + m_texture->unlockLevel(0); + } + } +} + +SampleRenderer::RendererTexture2D *SampleTextureAsset::getTexture(void) +{ + return m_texture; +} + +bool SampleTextureAsset::isOk(void) const +{ + return m_texture ? true : false; +} diff --git a/PhysX_3.4/Samples/SampleFramework/framework/src/SampleTree.cpp b/PhysX_3.4/Samples/SampleFramework/framework/src/SampleTree.cpp new file mode 100644 index 00000000..8d24e364 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/framework/src/SampleTree.cpp @@ -0,0 +1,70 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#include "SampleTree.h" + +using namespace SampleFramework; + +bool Tree::Node::appendChild(Node& node) +{ + if (!node.isRoot() || isOffspringOf(node)) + return false; + + node.mParent = this; + node.mPrev = mTail; + + if (NULL == mTail) + mHead = &node; + else + mTail->mNext = &node; + + mTail = &node; + + return true; +} + +bool Tree::Node::removeChild(Node& node) +{ + if (this != node.mParent) + return false; + + Node* prev = node.mPrev; + Node* next = node.mNext; + + if (NULL == prev) + mHead = next; + else + prev->mNext = next; + + if (NULL == next) + mTail = prev; + else + next->mPrev = prev; + + node.mParent = NULL; + return true; +} diff --git a/PhysX_3.4/Samples/SampleFramework/framework/src/SampleTriangleDebugRender.cpp b/PhysX_3.4/Samples/SampleFramework/framework/src/SampleTriangleDebugRender.cpp new file mode 100644 index 00000000..c596d6ab --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/framework/src/SampleTriangleDebugRender.cpp @@ -0,0 +1,244 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#include <SampleTriangleDebugRender.h> +#include <Renderer.h> +#include <RendererVertexBuffer.h> +#include <RendererVertexBufferDesc.h> +#include <RendererMesh.h> +#include <RendererMeshDesc.h> +#include <SampleAssetManager.h> +#include <SampleMaterialAsset.h> +#include <RendererMemoryMacros.h> + +using namespace SampleFramework; + +SampleTriangleDebugRender::SampleTriangleDebugRender(SampleRenderer::Renderer &renderer, SampleAssetManager &assetmanager) : + m_renderer(renderer), + m_assetmanager(assetmanager) +{ + m_material = static_cast<SampleMaterialAsset*>(m_assetmanager.getAsset("materials/simple_lit_color.xml", SampleAsset::ASSET_MATERIAL)); + PX_ASSERT(m_material); + PX_ASSERT(m_material->getNumVertexShaders() == 1); + m_meshContext.material = m_material ? m_material->getMaterial(0) : 0; + + m_maxVerts = 0; + m_numVerts = 0; + m_vertexbuffer = 0; + m_mesh = 0; + m_lockedPositions = 0; + m_positionStride = 0; + m_lockedNormals = 0; + m_normalStride = 0; + m_lockedColors = 0; + m_colorStride = 0; +} + +SampleTriangleDebugRender::~SampleTriangleDebugRender(void) +{ + checkUnlock(); + SAFE_RELEASE(m_vertexbuffer); + SAFE_RELEASE(m_mesh); + if(m_material) + { + m_assetmanager.returnAsset(*m_material); + } +} + +void SampleTriangleDebugRender::addTriangle(const PxVec3 &p0, const PxVec3 &p1, const PxVec3 &p2, const SampleRenderer::RendererColor &color) +{ + checkResizeTriangle(m_numVerts+3); + PxVec3 normal = (p1-p0).cross(p2-p0); + normal.normalize(); + addVert(p0, normal, color); + addVert(p1, normal, color); + addVert(p2, normal, color); +} + +void SampleTriangleDebugRender::addTriangle(const PxVec3 &p0, const PxVec3 &p1, const PxVec3 &p2, const PxVec3& n0, const PxVec3& n1, const PxVec3& n2, const SampleRenderer::RendererColor &color) +{ + checkResizeTriangle(m_numVerts+3); + addVert(p0, n0, color); + addVert(p1, n1, color); + addVert(p2, n2, color); +} + +void SampleTriangleDebugRender::queueForRenderTriangle(void) +{ + if(m_meshContext.mesh) + { + checkUnlock(); + m_mesh->setVertexBufferRange(0, m_numVerts); + m_renderer.queueMeshForRender(m_meshContext); + } +} + +void SampleTriangleDebugRender::clearTriangle(void) +{ + m_numVerts = 0; +} + +void SampleTriangleDebugRender::checkResizeTriangle(PxU32 maxVerts) +{ + if(maxVerts > m_maxVerts) + { + m_maxVerts = maxVerts + (PxU32)(maxVerts*0.2f); + + SampleRenderer::RendererVertexBufferDesc vbdesc; + vbdesc.hint = SampleRenderer::RendererVertexBuffer::HINT_DYNAMIC; + vbdesc.semanticFormats[SampleRenderer::RendererVertexBuffer::SEMANTIC_POSITION] = SampleRenderer::RendererVertexBuffer::FORMAT_FLOAT3; + vbdesc.semanticFormats[SampleRenderer::RendererVertexBuffer::SEMANTIC_NORMAL] = SampleRenderer::RendererVertexBuffer::FORMAT_FLOAT3; + vbdesc.semanticFormats[SampleRenderer::RendererVertexBuffer::SEMANTIC_COLOR] = SampleRenderer::RendererVertexBuffer::FORMAT_COLOR_NATIVE; // Same format as RendererColor + vbdesc.maxVertices = m_maxVerts; + SampleRenderer::RendererVertexBuffer *vertexbuffer = m_renderer.createVertexBuffer(vbdesc); + PX_ASSERT(vertexbuffer); + + if(vertexbuffer) + { + PxU32 positionStride = 0; + void *positions = vertexbuffer->lockSemantic(SampleRenderer::RendererVertexBuffer::SEMANTIC_POSITION, positionStride); + + PxU32 normalStride = 0; + void *normals = vertexbuffer->lockSemantic(SampleRenderer::RendererVertexBuffer::SEMANTIC_NORMAL, normalStride); + + PxU32 colorStride = 0; + void *colors = vertexbuffer->lockSemantic(SampleRenderer::RendererVertexBuffer::SEMANTIC_COLOR, colorStride); + + PX_ASSERT(positions && colors); + if(positions && colors) + { + if(m_numVerts > 0) + { + // if we have existing verts, copy them to the new VB... + PX_ASSERT(m_lockedPositions); + PX_ASSERT(m_lockedNormals); + PX_ASSERT(m_lockedColors); + if(m_lockedPositions && m_lockedNormals && m_lockedColors) + { + for(PxU32 i=0; i<m_numVerts; i++) + { + memcpy(((PxU8*)positions) + (positionStride*i), ((PxU8*)m_lockedPositions) + (m_positionStride*i), sizeof(PxVec3)); + memcpy(((PxU8*)normals) + (normalStride*i), ((PxU8*)m_lockedNormals) + (m_normalStride*i), sizeof(PxVec3)); + memcpy(((PxU8*)colors) + (colorStride*i), ((PxU8*)m_lockedColors) + (m_colorStride*i), sizeof(SampleRenderer::RendererColor)); + } + } + m_vertexbuffer->unlockSemantic(SampleRenderer::RendererVertexBuffer::SEMANTIC_COLOR); + m_vertexbuffer->unlockSemantic(SampleRenderer::RendererVertexBuffer::SEMANTIC_NORMAL); + m_vertexbuffer->unlockSemantic(SampleRenderer::RendererVertexBuffer::SEMANTIC_POSITION); + } + } + vertexbuffer->unlockSemantic(SampleRenderer::RendererVertexBuffer::SEMANTIC_COLOR); + vertexbuffer->unlockSemantic(SampleRenderer::RendererVertexBuffer::SEMANTIC_NORMAL); + vertexbuffer->unlockSemantic(SampleRenderer::RendererVertexBuffer::SEMANTIC_POSITION); + } + if(m_vertexbuffer) + { + m_vertexbuffer->release(); + m_vertexbuffer = 0; + m_lockedPositions = 0; + m_positionStride = 0; + m_lockedNormals = 0; + m_normalStride = 0; + m_lockedColors = 0; + m_colorStride = 0; + } + SAFE_RELEASE(m_mesh); + if(vertexbuffer) + { + m_vertexbuffer = vertexbuffer; + SampleRenderer::RendererMeshDesc meshdesc; + meshdesc.primitives = SampleRenderer::RendererMesh::PRIMITIVE_TRIANGLES; + meshdesc.vertexBuffers = &m_vertexbuffer; + meshdesc.numVertexBuffers = 1; + meshdesc.firstVertex = 0; + meshdesc.numVertices = m_numVerts; + m_mesh = m_renderer.createMesh(meshdesc); + PX_ASSERT(m_mesh); + } + m_meshContext.mesh = m_mesh; + m_meshContext.cullMode = SampleRenderer::RendererMeshContext::NONE; + } +} + +void SampleTriangleDebugRender::checkLock(void) +{ + if(m_vertexbuffer) + { + if(!m_lockedPositions) + { + m_lockedPositions = m_vertexbuffer->lockSemantic(SampleRenderer::RendererVertexBuffer::SEMANTIC_POSITION, m_positionStride); + PX_ASSERT(m_lockedPositions); + } + if(!m_lockedNormals) + { + m_lockedNormals = m_vertexbuffer->lockSemantic(SampleRenderer::RendererVertexBuffer::SEMANTIC_NORMAL, m_normalStride); + PX_ASSERT(m_lockedNormals); + } + if(!m_lockedColors) + { + m_lockedColors = m_vertexbuffer->lockSemantic(SampleRenderer::RendererVertexBuffer::SEMANTIC_COLOR, m_colorStride); + PX_ASSERT(m_lockedColors); + } + } +} + +void SampleTriangleDebugRender::checkUnlock(void) +{ + if(m_vertexbuffer) + { + if(m_lockedPositions) + { + m_vertexbuffer->unlockSemantic(SampleRenderer::RendererVertexBuffer::SEMANTIC_POSITION); + m_lockedPositions = 0; + } + if (m_lockedNormals) + { + m_vertexbuffer->unlockSemantic(SampleRenderer::RendererVertexBuffer::SEMANTIC_NORMAL); + m_lockedNormals = 0; + } + if(m_lockedColors) + { + m_vertexbuffer->unlockSemantic(SampleRenderer::RendererVertexBuffer::SEMANTIC_COLOR); + m_lockedColors = 0; + } + } +} + +void SampleTriangleDebugRender::addVert(const PxVec3 &p, const PxVec3 &n, const SampleRenderer::RendererColor &color) +{ + PX_ASSERT(m_maxVerts > m_numVerts); + { + checkLock(); + if(m_lockedPositions && m_lockedNormals && m_lockedColors) + { + *(PxVec3*)(((PxU8*)m_lockedPositions) + (m_positionStride*m_numVerts)) = p; + *(PxVec3*)(((PxU8*)m_lockedNormals) + (m_normalStride*m_numVerts)) = n; + *(SampleRenderer::RendererColor*)(((PxU8*)m_lockedColors) + (m_colorStride*m_numVerts)) = color; + + m_numVerts++; + } + } +} diff --git a/PhysX_3.4/Samples/SampleFramework/framework/src/nv_dds.cpp b/PhysX_3.4/Samples/SampleFramework/framework/src/nv_dds.cpp new file mode 100644 index 00000000..9bd9628a --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/framework/src/nv_dds.cpp @@ -0,0 +1,1115 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +// PHYSX-CHANGES: +// - Removed dependency on OpenGL. -jdolan +// - MACOS does not always equate to BIG_ENDIAN... fixed it for all platforms. -jdolan + +/////////////////////////////////////////////////////////////////////////////// +// +// Description: +// +// Loads DDS images (DXTC1, DXTC3, DXTC5, RGB (888, 888X), and RGBA (8888) are +// supported) for use in OpenGL. Image is flipped when its loaded as DX images +// are stored with different coordinate system. If file has mipmaps and/or +// cubemaps then these are loaded as well. Volume textures can be loaded as +// well but they must be uncompressed. +// +// When multiple textures are loaded (i.e a volume or cubemap texture), +// additional faces can be accessed using the array operator. +// +// The mipmaps for each face are also stored in a list and can be accessed like +// so: image.get_mipmap() (which accesses the first mipmap of the first +// image). To get the number of mipmaps call the get_num_mipmaps function for +// a given texture. +// +// Call the is_volume() or is_cubemap() function to check that a loaded image +// is a volume or cubemap texture respectively. If a volume texture is loaded +// then the get_depth() function should return a number greater than 1. +// Mipmapped volume textures and DXTC compressed volume textures are supported. +// +/////////////////////////////////////////////////////////////////////////////// +// +// Update: 9/15/2003 +// +// Added functions to create new image from a buffer of pixels. Added function +// to save current image to disk. +// +// Update: 6/11/2002 +// +// Added some convenience functions to handle uploading textures to OpenGL. The +// following functions have been added: +// +// bool upload_texture1D(); +// bool upload_texture2D(unsigned int imageIndex = 0, GLenum target = GL_TEXTURE_2D); +// bool upload_textureRectangle(); +// bool upload_texture3D(); +// bool upload_textureCubemap(); +// +// See function implementation below for instructions/comments on using each +// function. +// +// The open function has also been updated to take an optional second parameter +// specifying whether the image should be flipped on load. This defaults to +// true. +// +/////////////////////////////////////////////////////////////////////////////// +// Sample usage +/////////////////////////////////////////////////////////////////////////////// +// +// Loading a compressed texture: +// +// CDDSImage image; +// GLuint texobj; +// +// image.load("compressed.dds"); +// +// glGenTextures(1, &texobj); +// glEnable(GL_TEXTURE_2D); +// glBindTexture(GL_TEXTURE_2D, texobj); +// +// glCompressedTexImage2DARB(GL_TEXTURE_2D, 0, image.get_format(), +// image.get_width(), image.get_height(), 0, image.get_size(), +// image); +// +// for (int i = 0; i < image.get_num_mipmaps(); i++) +// { +// CSurface mipmap = image.get_mipmap(i); +// +// glCompressedTexImage2DARB(GL_TEXTURE_2D, i+1, image.get_format(), +// mipmap.get_width(), mipmap.get_height(), 0, mipmap.get_size(), +// mipmap); +// } +/////////////////////////////////////////////////////////////////////////////// +// +// Loading an uncompressed texture: +// +// CDDSImage image; +// GLuint texobj; +// +// image.load("uncompressed.dds"); +// +// glGenTextures(1, &texobj); +// glEnable(GL_TEXTURE_2D); +// glBindTexture(GL_TEXTURE_2D, texobj); +// +// glTexImage2D(GL_TEXTURE_2D, 0, image.get_components(), image.get_width(), +// image.get_height(), 0, image.get_format(), GL_UNSIGNED_BYTE, image); +// +// for (int i = 0; i < image.get_num_mipmaps(); i++) +// { +// glTexImage2D(GL_TEXTURE_2D, i+1, image.get_components(), +// image.get_mipmap(i).get_width(), image.get_mipmap(i).get_height(), +// 0, image.get_format(), GL_UNSIGNED_BYTE, image.get_mipmap(i)); +// } +// +/////////////////////////////////////////////////////////////////////////////// +// +// Loading an uncompressed cubemap texture: +// +// CDDSImage image; +// GLuint texobj; +// GLenum target; +// +// image.load("cubemap.dds"); +// +// glGenTextures(1, &texobj); +// glEnable(GL_TEXTURE_CUBE_MAP_ARB); +// glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, texobj); +// +// for (int n = 0; n < 6; n++) +// { +// target = GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB+n; +// +// glTexImage2D(target, 0, image.get_components(), image[n].get_width(), +// image[n].get_height(), 0, image.get_format(), GL_UNSIGNED_BYTE, +// image[n]); +// +// for (int i = 0; i < image[n].get_num_mipmaps(); i++) +// { +// glTexImage2D(target, i+1, image.get_components(), +// image[n].get_mipmap(i).get_width(), +// image[n].get_mipmap(i).get_height(), 0, +// image.get_format(), GL_UNSIGNED_BYTE, image[n].get_mipmap(i)); +// } +// } +// +/////////////////////////////////////////////////////////////////////////////// +// +// Loading a volume texture: +// +// CDDSImage image; +// GLuint texobj; +// +// image.load("volume.dds"); +// +// glGenTextures(1, &texobj); +// glEnable(GL_TEXTURE_3D); +// glBindTexture(GL_TEXTURE_3D, texobj); +// +// PFNGLTEXIMAGE3DPROC glTexImage3D; +// glTexImage3D(GL_TEXTURE_3D, 0, image.get_components(), image.get_width(), +// image.get_height(), image.get_depth(), 0, image.get_format(), +// GL_UNSIGNED_BYTE, image); +// +// for (int i = 0; i < image.get_num_mipmaps(); i++) +// { +// glTexImage3D(GL_TEXTURE_3D, i+1, image.get_components(), +// image[0].get_mipmap(i).get_width(), +// image[0].get_mipmap(i).get_height(), +// image[0].get_mipmap(i).get_depth(), 0, image.get_format(), +// GL_UNSIGNED_BYTE, image[0].get_mipmap(i)); +// } + +#include <stdio.h> +#include <assert.h> +#include "PxTkFile.h" +#include "nv_dds.h" + +using namespace std; +using namespace nv_dds; + +/////////////////////////////////////////////////////////////////////////////// +// CDDSImage public functions + +/////////////////////////////////////////////////////////////////////////////// +// default constructor +CDDSImage::CDDSImage() + : m_format(TextureUnknown), + m_components(0), + m_type(TextureNone), + m_valid(false) +{ +} + +CDDSImage::~CDDSImage() +{ +} + +void CDDSImage::create_textureFlat(TextureFormat format, unsigned int components, const CTexture &baseImage) +{ + assert(format != 0); + assert(components != 0); + assert(baseImage.get_depth() == 1); + + // remove any existing images + clear(); + + m_format = format; + m_components = components; + m_type = TextureFlat; + + m_images.push_back(baseImage); + + m_valid = true; +} + +void CDDSImage::create_texture3D(TextureFormat format, unsigned int components, const CTexture &baseImage) +{ + assert(format != 0); + assert(components != 0); + assert(baseImage.get_depth() > 1); + + // remove any existing images + clear(); + + m_format = format; + m_components = components; + m_type = Texture3D; + + m_images.push_back(baseImage); + + m_valid = true; +} + +inline bool same_size(const CTexture &a, const CTexture &b) +{ + if (a.get_width() != b.get_width()) + return false; + if (a.get_height() != b.get_height()) + return false; + if (a.get_depth() != b.get_depth()) + return false; + + return true; +} + +void CDDSImage::create_textureCubemap(TextureFormat format, unsigned int components, + const CTexture &positiveX, const CTexture &negativeX, + const CTexture &positiveY, const CTexture &negativeY, + const CTexture &positiveZ, const CTexture &negativeZ) +{ + assert(format != 0); + assert(components != 0); + assert(positiveX.get_depth() == 1); + + // verify that all dimensions are the same + assert(same_size(positiveX, negativeX)); + assert(same_size(positiveX, positiveY)); + assert(same_size(positiveX, negativeY)); + assert(same_size(positiveX, positiveZ)); + assert(same_size(positiveX, negativeZ)); + + // remove any existing images + clear(); + + m_format = format; + m_components = components; + m_type = TextureCubemap; + + m_images.push_back(positiveX); + m_images.push_back(negativeX); + m_images.push_back(positiveY); + m_images.push_back(negativeY); + m_images.push_back(positiveZ); + m_images.push_back(negativeZ); + + m_valid = true; +} + +/////////////////////////////////////////////////////////////////////////////// +// loads DDS image +// +// filename - fully qualified name of DDS image +// flipImage - specifies whether image is flipped on load, default is true +bool CDDSImage::load(string filename, bool flipImage) +{ + assert(filename.length() != 0); + + // clear any previously loaded images + clear(); + + // open file + SampleRenderer::File *fp = 0; + PxToolkit::fopen_s(&fp, filename.c_str(), "rb"); + if (fp == NULL) + return false; + + bool success = load(fp, flipImage); + + fclose(fp); + + return success; +} + +/////////////////////////////////////////////////////////////////////////////// +// loads DDS image from FILE stream +// +// filename - fully qualified name of DDS image +// flipImage - specifies whether image is flipped on load, default is true +bool CDDSImage::load(SampleRenderer::File* fp, bool flipImage) +{ + assert(fp != 0); + + // clear any previously loaded images + clear(); + + // read in file marker, make sure its a DDS file + char filecode[4]; + size_t numRead = fread(filecode, 1, 4, fp); + if(numRead != 4) { return false; } + + if (strncmp(filecode, "DDS ", 4) != 0) + { + return false; + } + + // read in DDS header + DDS_HEADER ddsh; + numRead = fread(&ddsh, 1, sizeof(DDS_HEADER), fp); + if(numRead != sizeof(DDS_HEADER)) { return false; } + + swap_endian(&ddsh.dwSize); + swap_endian(&ddsh.dwFlags); + swap_endian(&ddsh.dwHeight); + swap_endian(&ddsh.dwWidth); + swap_endian(&ddsh.dwPitchOrLinearSize); + swap_endian(&ddsh.dwMipMapCount); + swap_endian(&ddsh.ddspf.dwSize); + swap_endian(&ddsh.ddspf.dwFlags); + swap_endian(&ddsh.ddspf.dwFourCC); + swap_endian(&ddsh.ddspf.dwRGBBitCount); + swap_endian(&ddsh.dwCaps1); + swap_endian(&ddsh.dwCaps2); + + // default to flat texture type (1D, 2D, or rectangle) + m_type = TextureFlat; + + // check if image is a cubemap + if (ddsh.dwCaps2 & DDSF_CUBEMAP) + m_type = TextureCubemap; + + // check if image is a volume texture + if ((ddsh.dwCaps2 & DDSF_VOLUME) && (ddsh.dwDepth > 0)) + m_type = Texture3D; + + // figure out what the image format is + if (ddsh.ddspf.dwFlags & DDSF_FOURCC) + { + switch(ddsh.ddspf.dwFourCC) + { + case FOURCC_DXT1: + m_format = TextureDXT1; + m_components = 3; + break; + case FOURCC_DXT3: + m_format = TextureDXT3; + m_components = 4; + break; + case FOURCC_DXT5: + m_format = TextureDXT5; + m_components = 4; + break; + default: + return false; + } + } + else if (ddsh.ddspf.dwFlags == DDSF_RGBA && ddsh.ddspf.dwRGBBitCount == 32) + { + m_format = TextureBGRA; + m_components = 4; + } + else if (ddsh.ddspf.dwFlags == DDSF_RGB && ddsh.ddspf.dwRGBBitCount == 32) + { + m_format = TextureBGRA; + m_components = 4; + } + else if (ddsh.ddspf.dwFlags == DDSF_RGB && ddsh.ddspf.dwRGBBitCount == 24) + { + m_format = TextureBGR; + m_components = 3; + } + else if (ddsh.ddspf.dwRGBBitCount == 8) + { + m_format = TextureLuminance; + m_components = 1; + } + else + { + return false; + } + + // store primary surface width/height/depth + unsigned int width, height, depth; + width = ddsh.dwWidth; + height = ddsh.dwHeight; + depth = clamp_size(ddsh.dwDepth); // set to 1 if 0 + + // use correct size calculation function depending on whether image is + // compressed + unsigned int (CDDSImage::*sizefunc)(unsigned int, unsigned int); + sizefunc = (is_compressed() ? &CDDSImage::size_dxtc : &CDDSImage::size_rgb); + + // load all surfaces for the image (6 surfaces for cubemaps) + for (unsigned int n = 0; n < (unsigned int)(m_type == TextureCubemap ? 6 : 1); n++) + { + // add empty texture object + m_images.push_back(CTexture()); + + // get reference to newly added texture object + CTexture &img = m_images[n]; + + // calculate surface size + unsigned int size = (this->*sizefunc)(width, height)*depth; + + // load surface + unsigned char *pixels = new unsigned char[size]; + numRead = fread(pixels, 1, size, fp); + if(numRead != size) { delete [] pixels; return false; } + + img.create(width, height, depth, size, pixels); + + delete [] pixels; + + if (flipImage) flip(img); + + unsigned int w = clamp_size(width >> 1); + unsigned int h = clamp_size(height >> 1); + unsigned int d = clamp_size(depth >> 1); + + // store number of mipmaps + unsigned int numMipmaps = ddsh.dwMipMapCount; + + // number of mipmaps in file includes main surface so decrease count + // by one + if (numMipmaps != 0) + numMipmaps--; + + // load all mipmaps for current surface + for (unsigned int i = 0; i < numMipmaps && (w || h); i++) + { + // add empty surface + img.add_mipmap(CSurface()); + + // get reference to newly added mipmap + CSurface &mipmap = img.get_mipmap(i); + + // calculate mipmap size + size = (this->*sizefunc)(w, h)*d; + + unsigned char *pixels = new unsigned char[size]; + numRead = fread(pixels, 1, size, fp); + if(numRead != size) { delete [] pixels; return false; } + + mipmap.create(w, h, d, size, pixels); + + delete [] pixels; + + if (flipImage) flip(mipmap); + + // shrink to next power of 2 + w = clamp_size(w >> 1); + h = clamp_size(h >> 1); + d = clamp_size(d >> 1); + } + } + + // swap cubemaps on y axis (since image is flipped in OGL) + if (m_type == TextureCubemap && flipImage) + { + CTexture tmp; + tmp = m_images[3]; + m_images[3] = m_images[2]; + m_images[2] = tmp; + } + + m_valid = true; + + return true; +} + +void CDDSImage::write_texture(const CTexture &texture, SampleRenderer::File *fp) +{ + assert(get_num_mipmaps() == texture.get_num_mipmaps()); + + fwrite(texture, 1, texture.get_size(), fp); + + for (unsigned int i = 0; i < texture.get_num_mipmaps(); i++) + { + const CSurface &mipmap = texture.get_mipmap(i); + fwrite(mipmap, 1, mipmap.get_size(), fp); + } +} + +bool CDDSImage::save(std::string filename, bool flipImage) +{ + assert(m_valid); + assert(m_type != TextureNone); + + // open file + SampleRenderer::File* fp = 0; + PxToolkit::fopen_s(&fp, filename.c_str(), "wb"); + if (fp == NULL) + return false; + + bool result = save(fp, flipImage); + + fclose(fp); + + return result; +} + +bool CDDSImage::save(SampleRenderer::File* fp, bool flipImage) +{ + assert(m_valid); + assert(m_type != TextureNone); + assert(fp != 0); + + DDS_HEADER ddsh; + unsigned int headerSize = sizeof(DDS_HEADER); + memset(&ddsh, 0, headerSize); + ddsh.dwSize = headerSize; + ddsh.dwFlags = DDSF_CAPS | DDSF_WIDTH | DDSF_HEIGHT | DDSF_PIXELFORMAT; + ddsh.dwHeight = get_height(); + ddsh.dwWidth = get_width(); + + if (is_compressed()) + { + ddsh.dwFlags |= DDSF_LINEARSIZE; + ddsh.dwPitchOrLinearSize = get_size(); + } + else + { + ddsh.dwFlags |= DDSF_PITCH; + ddsh.dwPitchOrLinearSize = get_dword_aligned_linesize(get_width(), m_components * 8); + } + + if (m_type == Texture3D) + { + ddsh.dwFlags |= DDSF_DEPTH; + ddsh.dwDepth = get_depth(); + } + + if (get_num_mipmaps() > 0) + { + ddsh.dwFlags |= DDSF_MIPMAPCOUNT; + ddsh.dwMipMapCount = get_num_mipmaps() + 1; + } + + ddsh.ddspf.dwSize = sizeof(DDS_PIXELFORMAT); + + if (is_compressed()) + { + ddsh.ddspf.dwFlags = DDSF_FOURCC; + + if (m_format == TextureDXT1) + ddsh.ddspf.dwFourCC = FOURCC_DXT1; + if (m_format == TextureDXT3) + ddsh.ddspf.dwFourCC = FOURCC_DXT3; + if (m_format == TextureDXT5) + ddsh.ddspf.dwFourCC = FOURCC_DXT5; + } + else + { + ddsh.ddspf.dwFlags = (m_components == 4) ? DDSF_RGBA : DDSF_RGB; + ddsh.ddspf.dwRGBBitCount = m_components * 8; + ddsh.ddspf.dwRBitMask = 0x00ff0000; + ddsh.ddspf.dwGBitMask = 0x0000ff00; + ddsh.ddspf.dwBBitMask = 0x000000ff; + + if (m_components == 4) + { + ddsh.ddspf.dwFlags |= DDSF_ALPHAPIXELS; + ddsh.ddspf.dwABitMask = 0xff000000; + } + } + + ddsh.dwCaps1 = DDSF_TEXTURE; + + if (m_type == TextureCubemap) + { + ddsh.dwCaps1 |= DDSF_COMPLEX; + ddsh.dwCaps2 = DDSF_CUBEMAP | DDSF_CUBEMAP_ALL_FACES; + } + + if (m_type == Texture3D) + { + ddsh.dwCaps1 |= DDSF_COMPLEX; + ddsh.dwCaps2 = DDSF_VOLUME; + } + + if (get_num_mipmaps() > 0) + ddsh.dwCaps1 |= DDSF_COMPLEX | DDSF_MIPMAP; + + // write file header + fwrite("DDS ", 1, 4, fp); + + // write dds header + fwrite(&ddsh, 1, sizeof(DDS_HEADER), fp); + + if (m_type != TextureCubemap) + { + CTexture tex = m_images[0]; + if (flipImage) flip_texture(tex); + write_texture(tex, fp); + } + else + { + assert(m_images.size() == 6); + + for (unsigned int i = 0; i < m_images.size(); i++) + { + CTexture cubeFace; + + if (i == 2) + cubeFace = m_images[3]; + else if (i == 3) + cubeFace = m_images[2]; + else + cubeFace = m_images[i]; + + if (flipImage) flip_texture(cubeFace); + write_texture(cubeFace, fp); + } + } + + return true; +} + +/////////////////////////////////////////////////////////////////////////////// +// free image memory +void CDDSImage::clear() +{ + m_components = 0; + m_format = TextureUnknown; + m_type = TextureNone; + m_valid = false; + + m_images.clear(); +} + +/////////////////////////////////////////////////////////////////////////////// +// clamps input size to [1-size] +inline unsigned int CDDSImage::clamp_size(unsigned int size) +{ + if (size <= 0) + size = 1; + + return size; +} + +/////////////////////////////////////////////////////////////////////////////// +// CDDSImage private functions +/////////////////////////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////////////////////////// +// calculates size of DXTC texture in bytes +inline unsigned int CDDSImage::size_dxtc(unsigned int width, unsigned int height) +{ + return ((width+3)/4)*((height+3)/4)* + (m_format == TextureDXT1 ? 8 : 16); +} + +/////////////////////////////////////////////////////////////////////////////// +// calculates size of uncompressed RGB texture in bytes +inline unsigned int CDDSImage::size_rgb(unsigned int width, unsigned int height) +{ + return width*height*m_components; +} + +/////////////////////////////////////////////////////////////////////////////// +// Swap the bytes in a 32 bit value +inline void CDDSImage::swap_endian(void *val) +{ +#if defined(NV_DDS_BIG_ENDIAN) + unsigned int *ival = (unsigned int *)val; + + *ival = ((*ival >> 24) & 0x000000ff) | + ((*ival >> 8) & 0x0000ff00) | + ((*ival << 8) & 0x00ff0000) | + ((*ival << 24) & 0xff000000); +#else + (void)val; +#endif +} + +/////////////////////////////////////////////////////////////////////////////// +// flip image around X axis +void CDDSImage::flip(CSurface &surface) +{ + unsigned int linesize; + unsigned int offset; + + if (!is_compressed()) + { + assert(surface.get_depth() > 0); + + unsigned int imagesize = surface.get_size()/surface.get_depth(); + linesize = imagesize / surface.get_height(); + + for (unsigned int n = 0; n < surface.get_depth(); n++) + { + offset = imagesize*n; + unsigned char *top = (unsigned char*)surface + offset; + unsigned char *bottom = top + (imagesize-linesize); + + for (unsigned int i = 0; i < (surface.get_height() >> 1); i++) + { + swap(bottom, top, linesize); + + top += linesize; + bottom -= linesize; + } + } + } + else + { + void (CDDSImage::*flipblocks)(DXTColBlock*, unsigned int); + unsigned int xblocks = surface.get_width() / 4; + unsigned int yblocks = surface.get_height() / 4; + unsigned int blocksize; + + switch (m_format) + { + case TextureDXT1: + blocksize = 8; + flipblocks = &CDDSImage::flip_blocks_dxtc1; + break; + case TextureDXT3: + blocksize = 16; + flipblocks = &CDDSImage::flip_blocks_dxtc3; + break; + case TextureDXT5: + blocksize = 16; + flipblocks = &CDDSImage::flip_blocks_dxtc5; + break; + default: + return; + } + + linesize = xblocks * blocksize; + + DXTColBlock *top; + DXTColBlock *bottom; + + for (unsigned int j = 0; j < (yblocks >> 1); j++) + { + top = (DXTColBlock*)((unsigned char*)surface+ j * linesize); + bottom = (DXTColBlock*)((unsigned char*)surface + (((yblocks-j)-1) * linesize)); + + (this->*flipblocks)(top, xblocks); + (this->*flipblocks)(bottom, xblocks); + + swap(bottom, top, linesize); + } + } +} + +void CDDSImage::flip_texture(CTexture &texture) +{ + flip(texture); + + for (unsigned int i = 0; i < texture.get_num_mipmaps(); i++) + { + flip(texture.get_mipmap(i)); + } +} + +/////////////////////////////////////////////////////////////////////////////// +// swap to sections of memory +void CDDSImage::swap(void *byte1, void *byte2, unsigned int size) +{ + unsigned char *tmp = new unsigned char[size]; + + memcpy(tmp, byte1, size); + memcpy(byte1, byte2, size); + memcpy(byte2, tmp, size); + + delete [] tmp; +} + +/////////////////////////////////////////////////////////////////////////////// +// flip a DXT1 color block +void CDDSImage::flip_blocks_dxtc1(DXTColBlock *line, unsigned int numBlocks) +{ + DXTColBlock *curblock = line; + + for (unsigned int i = 0; i < numBlocks; i++) + { + swap(&curblock->row[0], &curblock->row[3], sizeof(unsigned char)); + swap(&curblock->row[1], &curblock->row[2], sizeof(unsigned char)); + + curblock++; + } +} + +/////////////////////////////////////////////////////////////////////////////// +// flip a DXT3 color block +void CDDSImage::flip_blocks_dxtc3(DXTColBlock *line, unsigned int numBlocks) +{ + DXTColBlock *curblock = line; + DXT3AlphaBlock *alphablock; + + for (unsigned int i = 0; i < numBlocks; i++) + { + alphablock = (DXT3AlphaBlock*)curblock; + + swap(&alphablock->row[0], &alphablock->row[3], sizeof(unsigned short)); + swap(&alphablock->row[1], &alphablock->row[2], sizeof(unsigned short)); + + curblock++; + + swap(&curblock->row[0], &curblock->row[3], sizeof(unsigned char)); + swap(&curblock->row[1], &curblock->row[2], sizeof(unsigned char)); + + curblock++; + } +} + +/////////////////////////////////////////////////////////////////////////////// +// flip a DXT5 alpha block +void CDDSImage::flip_dxt5_alpha(DXT5AlphaBlock *block) +{ + unsigned char gBits[4][4]; + + const unsigned int mask = 0x00000007; // bits = 00 00 01 11 + unsigned int bits = 0; + memcpy(&bits, &block->row[0], sizeof(unsigned char) * 3); + + gBits[0][0] = (unsigned char)(bits & mask); + bits >>= 3; + gBits[0][1] = (unsigned char)(bits & mask); + bits >>= 3; + gBits[0][2] = (unsigned char)(bits & mask); + bits >>= 3; + gBits[0][3] = (unsigned char)(bits & mask); + bits >>= 3; + gBits[1][0] = (unsigned char)(bits & mask); + bits >>= 3; + gBits[1][1] = (unsigned char)(bits & mask); + bits >>= 3; + gBits[1][2] = (unsigned char)(bits & mask); + bits >>= 3; + gBits[1][3] = (unsigned char)(bits & mask); + + bits = 0; + memcpy(&bits, &block->row[3], sizeof(unsigned char) * 3); + + gBits[2][0] = (unsigned char)(bits & mask); + bits >>= 3; + gBits[2][1] = (unsigned char)(bits & mask); + bits >>= 3; + gBits[2][2] = (unsigned char)(bits & mask); + bits >>= 3; + gBits[2][3] = (unsigned char)(bits & mask); + bits >>= 3; + gBits[3][0] = (unsigned char)(bits & mask); + bits >>= 3; + gBits[3][1] = (unsigned char)(bits & mask); + bits >>= 3; + gBits[3][2] = (unsigned char)(bits & mask); + bits >>= 3; + gBits[3][3] = (unsigned char)(bits & mask); + + unsigned int *pBits = ((unsigned int*) &(block->row[0])); + + *pBits = *pBits | (gBits[3][0] << 0); + *pBits = *pBits | (gBits[3][1] << 3); + *pBits = *pBits | (gBits[3][2] << 6); + *pBits = *pBits | (gBits[3][3] << 9); + + *pBits = *pBits | (gBits[2][0] << 12); + *pBits = *pBits | (gBits[2][1] << 15); + *pBits = *pBits | (gBits[2][2] << 18); + *pBits = *pBits | (gBits[2][3] << 21); + + pBits = ((unsigned int*) &(block->row[3])); + +#if defined(NV_DDS_BIG_ENDIAN) + *pBits &= 0x000000ff; +#else + *pBits &= 0xff000000; +#endif + + *pBits = *pBits | (gBits[1][0] << 0); + *pBits = *pBits | (gBits[1][1] << 3); + *pBits = *pBits | (gBits[1][2] << 6); + *pBits = *pBits | (gBits[1][3] << 9); + + *pBits = *pBits | (gBits[0][0] << 12); + *pBits = *pBits | (gBits[0][1] << 15); + *pBits = *pBits | (gBits[0][2] << 18); + *pBits = *pBits | (gBits[0][3] << 21); +} + +/////////////////////////////////////////////////////////////////////////////// +// flip a DXT5 color block +void CDDSImage::flip_blocks_dxtc5(DXTColBlock *line, unsigned int numBlocks) +{ + DXTColBlock *curblock = line; + DXT5AlphaBlock *alphablock; + + for (unsigned int i = 0; i < numBlocks; i++) + { + alphablock = (DXT5AlphaBlock*)curblock; + + flip_dxt5_alpha(alphablock); + + curblock++; + + swap(&curblock->row[0], &curblock->row[3], sizeof(unsigned char)); + swap(&curblock->row[1], &curblock->row[2], sizeof(unsigned char)); + + curblock++; + } +} + +/////////////////////////////////////////////////////////////////////////////// +// CTexture implementation +/////////////////////////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////////////////////////// +// default constructor +CTexture::CTexture() + : CSurface() // initialize base class part +{ +} + +/////////////////////////////////////////////////////////////////////////////// +// creates an empty texture +CTexture::CTexture(unsigned int w, unsigned int h, unsigned int d, unsigned int imgsize, const unsigned char *pixels) + : CSurface(w, h, d, imgsize, pixels) // initialize base class part +{ +} + +CTexture::~CTexture() +{ +} + +/////////////////////////////////////////////////////////////////////////////// +// copy constructor +CTexture::CTexture(const CTexture ©) + : CSurface(copy) +{ + for (unsigned int i = 0; i < copy.get_num_mipmaps(); i++) + m_mipmaps.push_back(copy.get_mipmap(i)); +} + +/////////////////////////////////////////////////////////////////////////////// +// assignment operator +CTexture &CTexture::operator= (const CTexture &rhs) +{ + if (this != &rhs) + { + CSurface::operator = (rhs); + + m_mipmaps.clear(); + for (unsigned int i = 0; i < rhs.get_num_mipmaps(); i++) + m_mipmaps.push_back(rhs.get_mipmap(i)); + } + + return *this; +} + +void CTexture::create(unsigned int w, unsigned int h, unsigned int d, unsigned int imgsize, const unsigned char *pixels) +{ + CSurface::create(w, h, d, imgsize, pixels); + + m_mipmaps.clear(); +} + +void CTexture::clear() +{ + CSurface::clear(); + + m_mipmaps.clear(); +} + +/////////////////////////////////////////////////////////////////////////////// +// CSurface implementation +/////////////////////////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////////////////////////// +// default constructor +CSurface::CSurface() + : m_width(0), + m_height(0), + m_depth(0), + m_size(0), + m_pixels(NULL) +{ +} + +/////////////////////////////////////////////////////////////////////////////// +// creates an empty image +CSurface::CSurface(unsigned int w, unsigned int h, unsigned int d, unsigned int imgsize, const unsigned char *pixels) + : m_width(0), + m_height(0), + m_depth(0), + m_size(0), + m_pixels(NULL) +{ + create(w, h, d, imgsize, pixels); +} + +/////////////////////////////////////////////////////////////////////////////// +// copy constructor +CSurface::CSurface(const CSurface ©) + : m_width(0), + m_height(0), + m_depth(0), + m_size(0), + m_pixels(NULL) +{ + if (copy.get_size() != 0) + { + m_size = copy.get_size(); + m_width = copy.get_width(); + m_height = copy.get_height(); + m_depth = copy.get_depth(); + + m_pixels = new unsigned char[m_size]; + memcpy(m_pixels, copy, m_size); + } +} + +/////////////////////////////////////////////////////////////////////////////// +// assignment operator +CSurface &CSurface::operator= (const CSurface &rhs) +{ + if (this != &rhs) + { + clear(); + + if (rhs.get_size()) + { + m_size = rhs.get_size(); + m_width = rhs.get_width(); + m_height = rhs.get_height(); + m_depth = rhs.get_depth(); + + m_pixels = new unsigned char[m_size]; + memcpy(m_pixels, rhs, m_size); + } + } + + return *this; +} + +/////////////////////////////////////////////////////////////////////////////// +// clean up image memory +CSurface::~CSurface() +{ + clear(); +} + +/////////////////////////////////////////////////////////////////////////////// +// returns a pointer to image +CSurface::operator unsigned char*() const +{ + return m_pixels; +} + +/////////////////////////////////////////////////////////////////////////////// +// creates an empty image +void CSurface::create(unsigned int w, unsigned int h, unsigned int d, unsigned int imgsize, const unsigned char *pixels) +{ + assert(w != 0); + assert(h != 0); + assert(d != 0); + assert(imgsize != 0); + assert(pixels); + + clear(); + + m_width = w; + m_height = h; + m_depth = d; + m_size = imgsize; + m_pixels = new unsigned char[imgsize]; + memcpy(m_pixels, pixels, imgsize); +} + +/////////////////////////////////////////////////////////////////////////////// +// free surface memory +void CSurface::clear() +{ + if (m_pixels != NULL) + { + delete [] m_pixels; + m_pixels = NULL; + } +} diff --git a/PhysX_3.4/Samples/SampleFramework/framework/src/nv_dds.h b/PhysX_3.4/Samples/SampleFramework/framework/src/nv_dds.h new file mode 100644 index 00000000..cafe65bc --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/framework/src/nv_dds.h @@ -0,0 +1,378 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +// PHYSX-CHANGES: +// - Removed dependency on OpenGL. -jdolan +// - MACOS does not always equate to BIG_ENDIAN... fixed it for all platforms. -jdolan +// - 64 bit fix for unix based platforms (replaced unsigned long with unsigned int) -sschirm + +#ifndef NV_DDS_H +#define NV_DDS_H + +#include <string> +#include <deque> +#include <assert.h> +#include <stdio.h> + +#include <RendererConfig.h> + +#if defined(__APPLE__) + #if BYTE_ORDER == BIG_ENDIAN + #define NV_DDS_BIG_ENDIAN + #endif +#elif defined(RENDERER_XBOX360) && _XBOX_VER == 200 + #define NV_DDS_BIG_ENDIAN +#elif defined(RENDERER_PS3) + #define NV_DDS_BIG_ENDIAN +#elif defined(RENDERER_WIIU) + #define NV_DDS_BIG_ENDIAN +#endif + +namespace nv_dds +{ + // surface description flags + const unsigned int DDSF_CAPS = 0x00000001l; + const unsigned int DDSF_HEIGHT = 0x00000002l; + const unsigned int DDSF_WIDTH = 0x00000004l; + const unsigned int DDSF_PITCH = 0x00000008l; + const unsigned int DDSF_PIXELFORMAT = 0x00001000l; + const unsigned int DDSF_MIPMAPCOUNT = 0x00020000l; + const unsigned int DDSF_LINEARSIZE = 0x00080000l; + const unsigned int DDSF_DEPTH = 0x00800000l; + + // pixel format flags + const unsigned int DDSF_ALPHAPIXELS = 0x00000001l; + const unsigned int DDSF_FOURCC = 0x00000004l; + const unsigned int DDSF_RGB = 0x00000040l; + const unsigned int DDSF_RGBA = 0x00000041l; + + // dwCaps1 flags + const unsigned int DDSF_COMPLEX = 0x00000008l; + const unsigned int DDSF_TEXTURE = 0x00001000l; + const unsigned int DDSF_MIPMAP = 0x00400000l; + + // dwCaps2 flags + const unsigned int DDSF_CUBEMAP = 0x00000200l; + const unsigned int DDSF_CUBEMAP_POSITIVEX = 0x00000400l; + const unsigned int DDSF_CUBEMAP_NEGATIVEX = 0x00000800l; + const unsigned int DDSF_CUBEMAP_POSITIVEY = 0x00001000l; + const unsigned int DDSF_CUBEMAP_NEGATIVEY = 0x00002000l; + const unsigned int DDSF_CUBEMAP_POSITIVEZ = 0x00004000l; + const unsigned int DDSF_CUBEMAP_NEGATIVEZ = 0x00008000l; + const unsigned int DDSF_CUBEMAP_ALL_FACES = 0x0000FC00l; + const unsigned int DDSF_VOLUME = 0x00200000l; + + // compressed texture types + const unsigned int FOURCC_DXT1 = 0x31545844l; //(MAKEFOURCC('D','X','T','1')) + const unsigned int FOURCC_DXT3 = 0x33545844l; //(MAKEFOURCC('D','X','T','3')) + const unsigned int FOURCC_DXT5 = 0x35545844l; //(MAKEFOURCC('D','X','T','5')) + + struct DXTColBlock + { + unsigned short col0; + unsigned short col1; + + unsigned char row[4]; + }; + + struct DXT3AlphaBlock + { + unsigned short row[4]; + }; + + struct DXT5AlphaBlock + { + unsigned char alpha0; + unsigned char alpha1; + + unsigned char row[6]; + }; + + struct DDS_PIXELFORMAT + { + unsigned int dwSize; + unsigned int dwFlags; + unsigned int dwFourCC; + unsigned int dwRGBBitCount; + unsigned int dwRBitMask; + unsigned int dwGBitMask; + unsigned int dwBBitMask; + unsigned int dwABitMask; + }; + + struct DDS_HEADER + { + unsigned int dwSize; + unsigned int dwFlags; + unsigned int dwHeight; + unsigned int dwWidth; + unsigned int dwPitchOrLinearSize; + unsigned int dwDepth; + unsigned int dwMipMapCount; + unsigned int dwReserved1[11]; + DDS_PIXELFORMAT ddspf; + unsigned int dwCaps1; + unsigned int dwCaps2; + unsigned int dwReserved2[3]; + }; + + enum TextureType + { + TextureNone, + TextureFlat, // 1D, 2D, and rectangle textures + Texture3D, + TextureCubemap + }; + + enum TextureFormat + { + TextureUnknown=0, + TextureBGRA, + TextureBGR, + TextureLuminance, + TextureDXT1, + TextureDXT3, + TextureDXT5, + }; + + class CSurface + { + public: + CSurface(); + CSurface(unsigned int w, unsigned int h, unsigned int d, unsigned int imgsize, const unsigned char *pixels); + CSurface(const CSurface ©); + CSurface &operator= (const CSurface &rhs); + virtual ~CSurface(); + + operator unsigned char*() const; + + virtual void create(unsigned int w, unsigned int h, unsigned int d, unsigned int imgsize, const unsigned char *pixels); + virtual void clear(); + + inline unsigned int get_width() const { return m_width; } + inline unsigned int get_height() const { return m_height; } + inline unsigned int get_depth() const { return m_depth; } + inline unsigned int get_size() const { return m_size; } + + private: + unsigned int m_width; + unsigned int m_height; + unsigned int m_depth; + unsigned int m_size; + + unsigned char *m_pixels; + }; + + class CTexture : public CSurface + { + friend class CDDSImage; + + public: + CTexture(); + CTexture(unsigned int w, unsigned int h, unsigned int d, unsigned int imgsize, const unsigned char *pixels); + CTexture(const CTexture ©); + CTexture &operator= (const CTexture &rhs); + ~CTexture(); + + void create(unsigned int w, unsigned int h, unsigned int d, unsigned int imgsize, const unsigned char *pixels); + void clear(); + + inline const CSurface &get_mipmap(unsigned int index) const + { + assert(!m_mipmaps.empty()); + assert(index < m_mipmaps.size()); + + return m_mipmaps[index]; + } + + inline void add_mipmap(const CSurface &mipmap) + { + m_mipmaps.push_back(mipmap); + } + + inline unsigned int get_num_mipmaps() const { return (unsigned int)m_mipmaps.size(); } + + protected: + inline CSurface &get_mipmap(unsigned int index) + { + assert(!m_mipmaps.empty()); + assert(index < m_mipmaps.size()); + + return m_mipmaps[index]; + } + + private: + std::deque<CSurface> m_mipmaps; + }; + + class CDDSImage + { + public: + CDDSImage(); + ~CDDSImage(); + + void create_textureFlat(TextureFormat format, unsigned int components, const CTexture &baseImage); + void create_texture3D(TextureFormat format, unsigned int components, const CTexture &baseImage); + void create_textureCubemap(TextureFormat format, unsigned int components, + const CTexture &positiveX, const CTexture &negativeX, + const CTexture &positiveY, const CTexture &negativeY, + const CTexture &positiveZ, const CTexture &negativeZ); + + void clear(); + bool load(std::string filename, bool flipImage = true); + bool load(SampleRenderer::File* fp, bool flipImage = true); + bool save(std::string filename, bool flipImage = true); + bool save(SampleRenderer::File* fp, bool flipImage = true); + + inline operator unsigned char*() + { + assert(m_valid); + assert(!m_images.empty()); + + return m_images[0]; + } + + inline unsigned int get_width() + { + assert(m_valid); + assert(!m_images.empty()); + + return m_images[0].get_width(); + } + + inline unsigned int get_height() + { + assert(m_valid); + assert(!m_images.empty()); + + return m_images[0].get_height(); + } + + inline unsigned int get_depth() + { + assert(m_valid); + assert(!m_images.empty()); + + return m_images[0].get_depth(); + } + + inline unsigned int get_size() + { + assert(m_valid); + assert(!m_images.empty()); + + return m_images[0].get_size(); + } + + inline unsigned int get_num_mipmaps() + { + assert(m_valid); + assert(!m_images.empty()); + + return m_images[0].get_num_mipmaps(); + } + + inline const CSurface &get_mipmap(unsigned int index) const + { + assert(m_valid); + assert(!m_images.empty()); + assert(index < m_images[0].get_num_mipmaps()); + + return m_images[0].get_mipmap(index); + } + + inline const CTexture &get_cubemap_face(unsigned int face) const + { + assert(m_valid); + assert(!m_images.empty()); + assert(m_images.size() == 6); + assert(m_type == TextureCubemap); + assert(face < 6); + + return m_images[face]; + } + + inline unsigned int get_components() { return m_components; } + inline TextureFormat get_format() { return m_format; } + inline TextureType get_type() { return m_type; } + + inline bool is_compressed() + { + if ((m_format == TextureDXT1) || + (m_format == TextureDXT3) || + (m_format == TextureDXT5)) + return true; + else + return false; + } + + inline bool is_cubemap() { return (m_type == TextureCubemap); } + inline bool is_volume() { return (m_type == Texture3D); } + inline bool is_valid() { return m_valid; } + + inline bool is_dword_aligned() + { + assert(m_valid); + + int dwordLineSize = get_dword_aligned_linesize(get_width(), m_components*8); + int curLineSize = get_width() * m_components; + + return (dwordLineSize == curLineSize); + } + + private: + unsigned int clamp_size(unsigned int size); + unsigned int size_dxtc(unsigned int width, unsigned int height); + unsigned int size_rgb(unsigned int width, unsigned int height); + inline void swap_endian(void *val); + + // calculates 4-byte aligned width of image + inline unsigned int get_dword_aligned_linesize(unsigned int width, unsigned int bpp) + { + return ((width * bpp + 31) & (unsigned int)(-32)) >> 3; + } + + void flip(CSurface &surface); + void flip_texture(CTexture &texture); + + void swap(void *byte1, void *byte2, unsigned int size); + void flip_blocks_dxtc1(DXTColBlock *line, unsigned int numBlocks); + void flip_blocks_dxtc3(DXTColBlock *line, unsigned int numBlocks); + void flip_blocks_dxtc5(DXTColBlock *line, unsigned int numBlocks); + void flip_dxt5_alpha(DXT5AlphaBlock *block); + + void write_texture(const CTexture &texture, SampleRenderer::File *fp); + + TextureFormat m_format; + unsigned int m_components; + TextureType m_type; + bool m_valid; + + std::deque<CTexture> m_images; + }; +} +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/framework/src/windows/WindowsSampleAssetManager.cpp b/PhysX_3.4/Samples/SampleFramework/framework/src/windows/WindowsSampleAssetManager.cpp new file mode 100644 index 00000000..a2bfaa82 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/framework/src/windows/WindowsSampleAssetManager.cpp @@ -0,0 +1,48 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#include <SampleAssetManager.h> + +#define NOMINMAX +#include <windows.h> + + +bool SampleFramework::searchForPath(const char* path, char* buffer, int bufferSize, bool isReadOnly, int maxRecursion) +{ + char* tmpBuffer = (char*)alloca(bufferSize); + strcpy_s(buffer, bufferSize, path); + for(int i = 0; i < maxRecursion; i++) + { + if(GetFileAttributes(buffer) == INVALID_FILE_ATTRIBUTES) + { + sprintf_s(tmpBuffer, bufferSize, "../%s", buffer); + strcpy_s(buffer, bufferSize, tmpBuffer); + } + else + return true; + } + return false; +} diff --git a/PhysX_3.4/Samples/SampleFramework/platform/compiler/vc11win32/SamplePlatform-MT.vcxproj b/PhysX_3.4/Samples/SampleFramework/platform/compiler/vc11win32/SamplePlatform-MT.vcxproj new file mode 100644 index 00000000..70ba19c8 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/platform/compiler/vc11win32/SamplePlatform-MT.vcxproj @@ -0,0 +1,258 @@ +<?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="checked|Win32"> + <Configuration>checked</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="profile|Win32"> + <Configuration>profile</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{75A6206D-F123-AEE0-FF3D-386A62604731}</ProjectGuid> + <RootNamespace>SamplePlatform-MT</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)'=='checked|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> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup 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" /> + </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" /> + </ImportGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> + <OutDir>./../../lib/vc11win32\</OutDir> + <IntDir>./Win32/SamplePlatform-MT/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> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FloatingPointModel>Fast</FloatingPointModel> + <BasicRuntimeChecks>UninitializedLocalUsageCheck</BasicRuntimeChecks> + <AdditionalOptions>/EHsc /MP /Wall /wd4514 /wd4820 /wd4062 /wd4100 /wd4130 /wd4201 /wd4242 /wd4244 /wd4245 /wd4265 /wd4266 /wd4324 /wd4389 /wd4365 /wd4371 /wd4447 /wd4189 /wd4191 /wd4350 /wd4505 /wd4512 /wd4548 /wd4571 /wd4625 /wd4626 /wd4668 /wd4619 /wd4701 /wd4702 /wd4706 /wd4710 /wd4711 /wd4640 /wd4061 /wd4826 /wd4946 /wd4917 /wd4986 /wd4987 /d2Zi+</AdditionalOptions> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>./../../include;./../../../renderer/include;./../../../framework/include;./../../../../PxToolkit/include;./../../../../../Include;./../../../../../Source/Common/include;./../../../../../Source/Common/include/windows;./../../../../../../Externals/targa/1;./../../../../../../PxShared/include;./../../../../../../PxShared/src/foundation/include;$(DXSDK_DIR)/Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>PHYSX_PROFILE_SDK;WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;_DEBUG;PX_DEBUG=1;PX_CHECKED=1;PX_NVTX=1;PX_SUPPORT_PVD=1;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ExceptionHandling>false</ExceptionHandling> + <WarningLevel>Level4</WarningLevel> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeader>NotUsing</PrecompiledHeader> + <PrecompiledHeaderFile></PrecompiledHeaderFile> + <ProgramDataBaseFileName>$(TargetDir)\$(TargetName).pdb</ProgramDataBaseFileName> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Lib> + <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)$(ProjectName)DEBUG.lib</OutputFile> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <ProgramDatabaseFile>$(TargetDir)\$(TargetName).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>./Win32/SamplePlatform-MT/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> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FloatingPointModel>Fast</FloatingPointModel> + <AdditionalOptions>/EHsc /MP /Wall /wd4514 /wd4820 /wd4062 /wd4100 /wd4130 /wd4201 /wd4242 /wd4244 /wd4245 /wd4265 /wd4266 /wd4324 /wd4389 /wd4365 /wd4371 /wd4447 /wd4189 /wd4191 /wd4350 /wd4505 /wd4512 /wd4548 /wd4571 /wd4625 /wd4626 /wd4668 /wd4619 /wd4701 /wd4702 /wd4706 /wd4710 /wd4711 /wd4640 /wd4061 /wd4826 /wd4946 /wd4917 /wd4986 /wd4987 /d2Zi+</AdditionalOptions> + <Optimization>Full</Optimization> + <AdditionalIncludeDirectories>./../../include;./../../../renderer/include;./../../../framework/include;./../../../../PxToolkit/include;./../../../../../Include;./../../../../../Source/Common/include;./../../../../../Source/Common/include/windows;./../../../../../../Externals/targa/1;./../../../../../../PxShared/include;./../../../../../../PxShared/src/foundation/include;$(DXSDK_DIR)/Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>PHYSX_PROFILE_SDK;WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;NDEBUG;PX_SUPPORT_PVD=0;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ExceptionHandling>false</ExceptionHandling> + <WarningLevel>Level4</WarningLevel> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <PrecompiledHeader>NotUsing</PrecompiledHeader> + <PrecompiledHeaderFile></PrecompiledHeaderFile> + <ProgramDataBaseFileName>$(TargetDir)\$(TargetName).pdb</ProgramDataBaseFileName> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Lib> + <AdditionalOptions>/INCREMENTAL:NO</AdditionalOptions> + <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)$(ProjectName).lib</OutputFile> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <ProgramDatabaseFile>$(TargetDir)\$(TargetName).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>./Win32/SamplePlatform-MT/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> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FloatingPointModel>Fast</FloatingPointModel> + <AdditionalOptions>/EHsc /MP /Wall /wd4514 /wd4820 /wd4062 /wd4100 /wd4130 /wd4201 /wd4242 /wd4244 /wd4245 /wd4265 /wd4266 /wd4324 /wd4389 /wd4365 /wd4371 /wd4447 /wd4189 /wd4191 /wd4350 /wd4505 /wd4512 /wd4548 /wd4571 /wd4625 /wd4626 /wd4668 /wd4619 /wd4701 /wd4702 /wd4706 /wd4710 /wd4711 /wd4640 /wd4061 /wd4826 /wd4946 /wd4917 /wd4986 /wd4987 /d2Zi+</AdditionalOptions> + <Optimization>Full</Optimization> + <AdditionalIncludeDirectories>./../../include;./../../../renderer/include;./../../../framework/include;./../../../../PxToolkit/include;./../../../../../Include;./../../../../../Source/Common/include;./../../../../../Source/Common/include/windows;./../../../../../../Externals/targa/1;./../../../../../../PxShared/include;./../../../../../../PxShared/src/foundation/include;$(DXSDK_DIR)/Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>PHYSX_PROFILE_SDK;WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;NDEBUG;PX_CHECKED=1;PX_NVTX=1;PX_SUPPORT_PVD=1;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ExceptionHandling>false</ExceptionHandling> + <WarningLevel>Level4</WarningLevel> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <PrecompiledHeader>NotUsing</PrecompiledHeader> + <PrecompiledHeaderFile></PrecompiledHeaderFile> + <ProgramDataBaseFileName>$(TargetDir)\$(TargetName).pdb</ProgramDataBaseFileName> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Lib> + <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)$(ProjectName)CHECKED.lib</OutputFile> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <ProgramDatabaseFile>$(TargetDir)\$(TargetName).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>./Win32/SamplePlatform-MT/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> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FloatingPointModel>Fast</FloatingPointModel> + <AdditionalOptions>/EHsc /MP /Wall /wd4514 /wd4820 /wd4062 /wd4100 /wd4130 /wd4201 /wd4242 /wd4244 /wd4245 /wd4265 /wd4266 /wd4324 /wd4389 /wd4365 /wd4371 /wd4447 /wd4189 /wd4191 /wd4350 /wd4505 /wd4512 /wd4548 /wd4571 /wd4625 /wd4626 /wd4668 /wd4619 /wd4701 /wd4702 /wd4706 /wd4710 /wd4711 /wd4640 /wd4061 /wd4826 /wd4946 /wd4917 /wd4986 /wd4987 /d2Zi+</AdditionalOptions> + <Optimization>Full</Optimization> + <AdditionalIncludeDirectories>./../../include;./../../../renderer/include;./../../../framework/include;./../../../../PxToolkit/include;./../../../../../Include;./../../../../../Source/Common/include;./../../../../../Source/Common/include/windows;./../../../../../../Externals/targa/1;./../../../../../../PxShared/include;./../../../../../../PxShared/src/foundation/include;$(DXSDK_DIR)/Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>PHYSX_PROFILE_SDK;WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;NDEBUG;PX_PROFILE=1;PX_NVTX=1;PX_SUPPORT_PVD=1;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ExceptionHandling>false</ExceptionHandling> + <WarningLevel>Level4</WarningLevel> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <PrecompiledHeader>NotUsing</PrecompiledHeader> + <PrecompiledHeaderFile></PrecompiledHeaderFile> + <ProgramDataBaseFileName>$(TargetDir)\$(TargetName).pdb</ProgramDataBaseFileName> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Lib> + <AdditionalOptions>/INCREMENTAL:NO</AdditionalOptions> + <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)$(ProjectName)PROFILE.lib</OutputFile> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <ProgramDatabaseFile>$(TargetDir)\$(TargetName).pdb</ProgramDatabaseFile> + <TargetMachine>MachineX86</TargetMachine> + </Lib> + <ResourceCompile> + </ResourceCompile> + <ProjectReference> + <LinkLibraryDependencies>true</LinkLibraryDependencies> + </ProjectReference> + </ItemDefinitionGroup> + <ItemGroup> + <ClInclude Include="..\..\include\windows\WindowsSamplePlatform.h"> + </ClInclude> + <ClInclude Include="..\..\include\windows\WindowsSampleUserInput.h"> + </ClInclude> + <ClInclude Include="..\..\include\windows\WindowsSampleUserInputIds.h"> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\include\SamplePlatform.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleUserInput.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleUserInputIds.h"> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\src\windows\WindowsSamplePlatform.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\windows\WindowsSampleUserInput.cpp"> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\src\SamplePlatform.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\SampleUserInput.cpp"> + </ClCompile> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"></ImportGroup> +</Project> diff --git a/PhysX_3.4/Samples/SampleFramework/platform/compiler/vc11win64/SamplePlatform-MT.vcxproj b/PhysX_3.4/Samples/SampleFramework/platform/compiler/vc11win64/SamplePlatform-MT.vcxproj new file mode 100644 index 00000000..d82a5e00 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/platform/compiler/vc11win64/SamplePlatform-MT.vcxproj @@ -0,0 +1,254 @@ +<?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="checked|x64"> + <Configuration>checked</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="profile|x64"> + <Configuration>profile</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{75A6206D-F123-AEE0-FF3D-386A62604731}</ProjectGuid> + <RootNamespace>SamplePlatform-MT</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)'=='checked|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> + <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" /> + </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" /> + </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" /> + </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" /> + </ImportGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> + <OutDir>./../../lib/vc11win64\</OutDir> + <IntDir>./x64/SamplePlatform-MT/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> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FloatingPointModel>Fast</FloatingPointModel> + <BasicRuntimeChecks>UninitializedLocalUsageCheck</BasicRuntimeChecks> + <AdditionalOptions>/EHsc /MP /Wall /wd4514 /wd4820 /wd4062 /wd4100 /wd4130 /wd4201 /wd4242 /wd4244 /wd4245 /wd4265 /wd4266 /wd4324 /wd4389 /wd4365 /wd4371 /wd4447 /wd4189 /wd4191 /wd4350 /wd4505 /wd4512 /wd4548 /wd4571 /wd4625 /wd4626 /wd4668 /wd4619 /wd4701 /wd4702 /wd4706 /wd4710 /wd4711 /wd4640 /wd4061 /wd4826 /wd4946 /wd4917 /wd4986 /wd4987 /d2Zi+</AdditionalOptions> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>./../../include;./../../../renderer/include;./../../../framework/include;./../../../../PxToolkit/include;./../../../../../Include;./../../../../../Source/Common/include;./../../../../../Source/Common/include/windows;./../../../../../../Externals/targa/1;./../../../../../../PxShared/include;./../../../../../../PxShared/src/foundation/include;$(DXSDK_DIR)/Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>PHYSX_PROFILE_SDK;WIN32;WIN64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;_DEBUG;PX_DEBUG=1;PX_CHECKED=1;PX_NVTX=1;PX_SUPPORT_PVD=1;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ExceptionHandling>false</ExceptionHandling> + <WarningLevel>Level4</WarningLevel> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeader>NotUsing</PrecompiledHeader> + <PrecompiledHeaderFile></PrecompiledHeaderFile> + <ProgramDataBaseFileName>$(TargetDir)\$(TargetName).pdb</ProgramDataBaseFileName> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Lib> + <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)$(ProjectName)DEBUG.lib</OutputFile> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <ProgramDatabaseFile>$(TargetDir)\$(TargetName).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>./x64/SamplePlatform-MT/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> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FloatingPointModel>Fast</FloatingPointModel> + <AdditionalOptions>/EHsc /MP /Wall /wd4514 /wd4820 /wd4062 /wd4100 /wd4130 /wd4201 /wd4242 /wd4244 /wd4245 /wd4265 /wd4266 /wd4324 /wd4389 /wd4365 /wd4371 /wd4447 /wd4189 /wd4191 /wd4350 /wd4505 /wd4512 /wd4548 /wd4571 /wd4625 /wd4626 /wd4668 /wd4619 /wd4701 /wd4702 /wd4706 /wd4710 /wd4711 /wd4640 /wd4061 /wd4826 /wd4946 /wd4917 /wd4986 /wd4987 /d2Zi+</AdditionalOptions> + <Optimization>Full</Optimization> + <AdditionalIncludeDirectories>./../../include;./../../../renderer/include;./../../../framework/include;./../../../../PxToolkit/include;./../../../../../Include;./../../../../../Source/Common/include;./../../../../../Source/Common/include/windows;./../../../../../../Externals/targa/1;./../../../../../../PxShared/include;./../../../../../../PxShared/src/foundation/include;$(DXSDK_DIR)/Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>PHYSX_PROFILE_SDK;WIN32;WIN64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;NDEBUG;PX_SUPPORT_PVD=0;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ExceptionHandling>false</ExceptionHandling> + <WarningLevel>Level4</WarningLevel> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <PrecompiledHeader>NotUsing</PrecompiledHeader> + <PrecompiledHeaderFile></PrecompiledHeaderFile> + <ProgramDataBaseFileName>$(TargetDir)\$(TargetName).pdb</ProgramDataBaseFileName> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Lib> + <AdditionalOptions>/INCREMENTAL:NO</AdditionalOptions> + <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)$(ProjectName).lib</OutputFile> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <ProgramDatabaseFile>$(TargetDir)\$(TargetName).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>./x64/SamplePlatform-MT/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> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FloatingPointModel>Fast</FloatingPointModel> + <AdditionalOptions>/EHsc /MP /Wall /wd4514 /wd4820 /wd4062 /wd4100 /wd4130 /wd4201 /wd4242 /wd4244 /wd4245 /wd4265 /wd4266 /wd4324 /wd4389 /wd4365 /wd4371 /wd4447 /wd4189 /wd4191 /wd4350 /wd4505 /wd4512 /wd4548 /wd4571 /wd4625 /wd4626 /wd4668 /wd4619 /wd4701 /wd4702 /wd4706 /wd4710 /wd4711 /wd4640 /wd4061 /wd4826 /wd4946 /wd4917 /wd4986 /wd4987 /d2Zi+</AdditionalOptions> + <Optimization>Full</Optimization> + <AdditionalIncludeDirectories>./../../include;./../../../renderer/include;./../../../framework/include;./../../../../PxToolkit/include;./../../../../../Include;./../../../../../Source/Common/include;./../../../../../Source/Common/include/windows;./../../../../../../Externals/targa/1;./../../../../../../PxShared/include;./../../../../../../PxShared/src/foundation/include;$(DXSDK_DIR)/Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>PHYSX_PROFILE_SDK;WIN32;WIN64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;NDEBUG;PX_CHECKED=1;PX_NVTX=1;PX_SUPPORT_PVD=1;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ExceptionHandling>false</ExceptionHandling> + <WarningLevel>Level4</WarningLevel> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <PrecompiledHeader>NotUsing</PrecompiledHeader> + <PrecompiledHeaderFile></PrecompiledHeaderFile> + <ProgramDataBaseFileName>$(TargetDir)\$(TargetName).pdb</ProgramDataBaseFileName> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Lib> + <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)$(ProjectName)CHECKED.lib</OutputFile> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <ProgramDatabaseFile>$(TargetDir)\$(TargetName).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>./x64/SamplePlatform-MT/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> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FloatingPointModel>Fast</FloatingPointModel> + <AdditionalOptions>/EHsc /MP /Wall /wd4514 /wd4820 /wd4062 /wd4100 /wd4130 /wd4201 /wd4242 /wd4244 /wd4245 /wd4265 /wd4266 /wd4324 /wd4389 /wd4365 /wd4371 /wd4447 /wd4189 /wd4191 /wd4350 /wd4505 /wd4512 /wd4548 /wd4571 /wd4625 /wd4626 /wd4668 /wd4619 /wd4701 /wd4702 /wd4706 /wd4710 /wd4711 /wd4640 /wd4061 /wd4826 /wd4946 /wd4917 /wd4986 /wd4987 /d2Zi+</AdditionalOptions> + <Optimization>Full</Optimization> + <AdditionalIncludeDirectories>./../../include;./../../../renderer/include;./../../../framework/include;./../../../../PxToolkit/include;./../../../../../Include;./../../../../../Source/Common/include;./../../../../../Source/Common/include/windows;./../../../../../../Externals/targa/1;./../../../../../../PxShared/include;./../../../../../../PxShared/src/foundation/include;$(DXSDK_DIR)/Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>PHYSX_PROFILE_SDK;WIN32;WIN64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;NDEBUG;PX_PROFILE=1;PX_NVTX=1;PX_SUPPORT_PVD=1;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ExceptionHandling>false</ExceptionHandling> + <WarningLevel>Level4</WarningLevel> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <PrecompiledHeader>NotUsing</PrecompiledHeader> + <PrecompiledHeaderFile></PrecompiledHeaderFile> + <ProgramDataBaseFileName>$(TargetDir)\$(TargetName).pdb</ProgramDataBaseFileName> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Lib> + <AdditionalOptions>/INCREMENTAL:NO</AdditionalOptions> + <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)$(ProjectName)PROFILE.lib</OutputFile> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <ProgramDatabaseFile>$(TargetDir)\$(TargetName).pdb</ProgramDatabaseFile> + <TargetMachine>MachineX64</TargetMachine> + </Lib> + <ResourceCompile> + </ResourceCompile> + <ProjectReference> + <LinkLibraryDependencies>true</LinkLibraryDependencies> + </ProjectReference> + </ItemDefinitionGroup> + <ItemGroup> + <ClInclude Include="..\..\include\windows\WindowsSamplePlatform.h"> + </ClInclude> + <ClInclude Include="..\..\include\windows\WindowsSampleUserInput.h"> + </ClInclude> + <ClInclude Include="..\..\include\windows\WindowsSampleUserInputIds.h"> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\include\SamplePlatform.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleUserInput.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleUserInputIds.h"> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\src\windows\WindowsSamplePlatform.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\windows\WindowsSampleUserInput.cpp"> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\src\SamplePlatform.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\SampleUserInput.cpp"> + </ClCompile> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"></ImportGroup> +</Project> diff --git a/PhysX_3.4/Samples/SampleFramework/platform/compiler/vc12win32/SamplePlatform-MT.vcxproj b/PhysX_3.4/Samples/SampleFramework/platform/compiler/vc12win32/SamplePlatform-MT.vcxproj new file mode 100644 index 00000000..e297cbee --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/platform/compiler/vc12win32/SamplePlatform-MT.vcxproj @@ -0,0 +1,258 @@ +<?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="checked|Win32"> + <Configuration>checked</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="profile|Win32"> + <Configuration>profile</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{75A6206D-F123-AEE0-FF3D-386A62604731}</ProjectGuid> + <RootNamespace>SamplePlatform-MT</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)'=='checked|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> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup 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" /> + </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" /> + </ImportGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> + <OutDir>./../../lib/vc12win32\</OutDir> + <IntDir>./Win32/SamplePlatform-MT/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> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FloatingPointModel>Fast</FloatingPointModel> + <BasicRuntimeChecks>UninitializedLocalUsageCheck</BasicRuntimeChecks> + <AdditionalOptions>/EHsc /MP /Wall /wd4514 /wd4820 /wd4062 /wd4100 /wd4130 /wd4201 /wd4242 /wd4244 /wd4245 /wd4265 /wd4266 /wd4324 /wd4389 /wd4365 /wd4371 /wd4447 /wd4189 /wd4191 /wd4350 /wd4505 /wd4512 /wd4548 /wd4571 /wd4625 /wd4626 /wd4668 /wd4619 /wd4701 /wd4702 /wd4706 /wd4710 /wd4711 /wd4640 /wd4061 /wd4826 /wd4946 /wd4917 /wd4986 /wd4987 /d2Zi+</AdditionalOptions> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>./../../include;./../../../renderer/include;./../../../framework/include;./../../../../PxToolkit/include;./../../../../../Include;./../../../../../Source/Common/include;./../../../../../Source/Common/include/windows;./../../../../../../Externals/targa/1;./../../../../../../PxShared/include;./../../../../../../PxShared/src/foundation/include;$(DXSDK_DIR)/Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>PHYSX_PROFILE_SDK;WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;_DEBUG;PX_DEBUG=1;PX_CHECKED=1;PX_NVTX=1;PX_SUPPORT_PVD=1;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ExceptionHandling>false</ExceptionHandling> + <WarningLevel>Level4</WarningLevel> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeader>NotUsing</PrecompiledHeader> + <PrecompiledHeaderFile></PrecompiledHeaderFile> + <ProgramDataBaseFileName>$(TargetDir)\$(TargetName).pdb</ProgramDataBaseFileName> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Lib> + <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)$(ProjectName)DEBUG.lib</OutputFile> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <ProgramDatabaseFile>$(TargetDir)\$(TargetName).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>./Win32/SamplePlatform-MT/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> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FloatingPointModel>Fast</FloatingPointModel> + <AdditionalOptions>/EHsc /MP /Wall /wd4514 /wd4820 /wd4062 /wd4100 /wd4130 /wd4201 /wd4242 /wd4244 /wd4245 /wd4265 /wd4266 /wd4324 /wd4389 /wd4365 /wd4371 /wd4447 /wd4189 /wd4191 /wd4350 /wd4505 /wd4512 /wd4548 /wd4571 /wd4625 /wd4626 /wd4668 /wd4619 /wd4701 /wd4702 /wd4706 /wd4710 /wd4711 /wd4640 /wd4061 /wd4826 /wd4946 /wd4917 /wd4986 /wd4987 /d2Zi+</AdditionalOptions> + <Optimization>Full</Optimization> + <AdditionalIncludeDirectories>./../../include;./../../../renderer/include;./../../../framework/include;./../../../../PxToolkit/include;./../../../../../Include;./../../../../../Source/Common/include;./../../../../../Source/Common/include/windows;./../../../../../../Externals/targa/1;./../../../../../../PxShared/include;./../../../../../../PxShared/src/foundation/include;$(DXSDK_DIR)/Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>PHYSX_PROFILE_SDK;WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;NDEBUG;PX_SUPPORT_PVD=0;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ExceptionHandling>false</ExceptionHandling> + <WarningLevel>Level4</WarningLevel> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <PrecompiledHeader>NotUsing</PrecompiledHeader> + <PrecompiledHeaderFile></PrecompiledHeaderFile> + <ProgramDataBaseFileName>$(TargetDir)\$(TargetName).pdb</ProgramDataBaseFileName> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Lib> + <AdditionalOptions>/INCREMENTAL:NO</AdditionalOptions> + <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)$(ProjectName).lib</OutputFile> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <ProgramDatabaseFile>$(TargetDir)\$(TargetName).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>./Win32/SamplePlatform-MT/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> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FloatingPointModel>Fast</FloatingPointModel> + <AdditionalOptions>/EHsc /MP /Wall /wd4514 /wd4820 /wd4062 /wd4100 /wd4130 /wd4201 /wd4242 /wd4244 /wd4245 /wd4265 /wd4266 /wd4324 /wd4389 /wd4365 /wd4371 /wd4447 /wd4189 /wd4191 /wd4350 /wd4505 /wd4512 /wd4548 /wd4571 /wd4625 /wd4626 /wd4668 /wd4619 /wd4701 /wd4702 /wd4706 /wd4710 /wd4711 /wd4640 /wd4061 /wd4826 /wd4946 /wd4917 /wd4986 /wd4987 /d2Zi+</AdditionalOptions> + <Optimization>Full</Optimization> + <AdditionalIncludeDirectories>./../../include;./../../../renderer/include;./../../../framework/include;./../../../../PxToolkit/include;./../../../../../Include;./../../../../../Source/Common/include;./../../../../../Source/Common/include/windows;./../../../../../../Externals/targa/1;./../../../../../../PxShared/include;./../../../../../../PxShared/src/foundation/include;$(DXSDK_DIR)/Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>PHYSX_PROFILE_SDK;WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;NDEBUG;PX_CHECKED=1;PX_NVTX=1;PX_SUPPORT_PVD=1;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ExceptionHandling>false</ExceptionHandling> + <WarningLevel>Level4</WarningLevel> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <PrecompiledHeader>NotUsing</PrecompiledHeader> + <PrecompiledHeaderFile></PrecompiledHeaderFile> + <ProgramDataBaseFileName>$(TargetDir)\$(TargetName).pdb</ProgramDataBaseFileName> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Lib> + <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)$(ProjectName)CHECKED.lib</OutputFile> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <ProgramDatabaseFile>$(TargetDir)\$(TargetName).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>./Win32/SamplePlatform-MT/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> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FloatingPointModel>Fast</FloatingPointModel> + <AdditionalOptions>/EHsc /MP /Wall /wd4514 /wd4820 /wd4062 /wd4100 /wd4130 /wd4201 /wd4242 /wd4244 /wd4245 /wd4265 /wd4266 /wd4324 /wd4389 /wd4365 /wd4371 /wd4447 /wd4189 /wd4191 /wd4350 /wd4505 /wd4512 /wd4548 /wd4571 /wd4625 /wd4626 /wd4668 /wd4619 /wd4701 /wd4702 /wd4706 /wd4710 /wd4711 /wd4640 /wd4061 /wd4826 /wd4946 /wd4917 /wd4986 /wd4987 /d2Zi+</AdditionalOptions> + <Optimization>Full</Optimization> + <AdditionalIncludeDirectories>./../../include;./../../../renderer/include;./../../../framework/include;./../../../../PxToolkit/include;./../../../../../Include;./../../../../../Source/Common/include;./../../../../../Source/Common/include/windows;./../../../../../../Externals/targa/1;./../../../../../../PxShared/include;./../../../../../../PxShared/src/foundation/include;$(DXSDK_DIR)/Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>PHYSX_PROFILE_SDK;WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;NDEBUG;PX_PROFILE=1;PX_NVTX=1;PX_SUPPORT_PVD=1;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ExceptionHandling>false</ExceptionHandling> + <WarningLevel>Level4</WarningLevel> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <PrecompiledHeader>NotUsing</PrecompiledHeader> + <PrecompiledHeaderFile></PrecompiledHeaderFile> + <ProgramDataBaseFileName>$(TargetDir)\$(TargetName).pdb</ProgramDataBaseFileName> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Lib> + <AdditionalOptions>/INCREMENTAL:NO</AdditionalOptions> + <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)$(ProjectName)PROFILE.lib</OutputFile> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <ProgramDatabaseFile>$(TargetDir)\$(TargetName).pdb</ProgramDatabaseFile> + <TargetMachine>MachineX86</TargetMachine> + </Lib> + <ResourceCompile> + </ResourceCompile> + <ProjectReference> + <LinkLibraryDependencies>true</LinkLibraryDependencies> + </ProjectReference> + </ItemDefinitionGroup> + <ItemGroup> + <ClInclude Include="..\..\include\windows\WindowsSamplePlatform.h"> + </ClInclude> + <ClInclude Include="..\..\include\windows\WindowsSampleUserInput.h"> + </ClInclude> + <ClInclude Include="..\..\include\windows\WindowsSampleUserInputIds.h"> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\include\SamplePlatform.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleUserInput.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleUserInputIds.h"> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\src\windows\WindowsSamplePlatform.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\windows\WindowsSampleUserInput.cpp"> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\src\SamplePlatform.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\SampleUserInput.cpp"> + </ClCompile> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"></ImportGroup> +</Project> diff --git a/PhysX_3.4/Samples/SampleFramework/platform/compiler/vc12win64/SamplePlatform-MT.vcxproj b/PhysX_3.4/Samples/SampleFramework/platform/compiler/vc12win64/SamplePlatform-MT.vcxproj new file mode 100644 index 00000000..61350029 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/platform/compiler/vc12win64/SamplePlatform-MT.vcxproj @@ -0,0 +1,254 @@ +<?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="checked|x64"> + <Configuration>checked</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="profile|x64"> + <Configuration>profile</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{75A6206D-F123-AEE0-FF3D-386A62604731}</ProjectGuid> + <RootNamespace>SamplePlatform-MT</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)'=='checked|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> + <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" /> + </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" /> + </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" /> + </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" /> + </ImportGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> + <OutDir>./../../lib/vc12win64\</OutDir> + <IntDir>./x64/SamplePlatform-MT/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> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FloatingPointModel>Fast</FloatingPointModel> + <BasicRuntimeChecks>UninitializedLocalUsageCheck</BasicRuntimeChecks> + <AdditionalOptions>/EHsc /MP /Wall /wd4514 /wd4820 /wd4062 /wd4100 /wd4130 /wd4201 /wd4242 /wd4244 /wd4245 /wd4265 /wd4266 /wd4324 /wd4389 /wd4365 /wd4371 /wd4447 /wd4189 /wd4191 /wd4350 /wd4505 /wd4512 /wd4548 /wd4571 /wd4625 /wd4626 /wd4668 /wd4619 /wd4701 /wd4702 /wd4706 /wd4710 /wd4711 /wd4640 /wd4061 /wd4826 /wd4946 /wd4917 /wd4986 /wd4987 /d2Zi+</AdditionalOptions> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>./../../include;./../../../renderer/include;./../../../framework/include;./../../../../PxToolkit/include;./../../../../../Include;./../../../../../Source/Common/include;./../../../../../Source/Common/include/windows;./../../../../../../Externals/targa/1;./../../../../../../PxShared/include;./../../../../../../PxShared/src/foundation/include;$(DXSDK_DIR)/Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>PHYSX_PROFILE_SDK;WIN32;WIN64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;_DEBUG;PX_DEBUG=1;PX_CHECKED=1;PX_NVTX=1;PX_SUPPORT_PVD=1;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ExceptionHandling>false</ExceptionHandling> + <WarningLevel>Level4</WarningLevel> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeader>NotUsing</PrecompiledHeader> + <PrecompiledHeaderFile></PrecompiledHeaderFile> + <ProgramDataBaseFileName>$(TargetDir)\$(TargetName).pdb</ProgramDataBaseFileName> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Lib> + <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)$(ProjectName)DEBUG.lib</OutputFile> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <ProgramDatabaseFile>$(TargetDir)\$(TargetName).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>./x64/SamplePlatform-MT/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> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FloatingPointModel>Fast</FloatingPointModel> + <AdditionalOptions>/EHsc /MP /Wall /wd4514 /wd4820 /wd4062 /wd4100 /wd4130 /wd4201 /wd4242 /wd4244 /wd4245 /wd4265 /wd4266 /wd4324 /wd4389 /wd4365 /wd4371 /wd4447 /wd4189 /wd4191 /wd4350 /wd4505 /wd4512 /wd4548 /wd4571 /wd4625 /wd4626 /wd4668 /wd4619 /wd4701 /wd4702 /wd4706 /wd4710 /wd4711 /wd4640 /wd4061 /wd4826 /wd4946 /wd4917 /wd4986 /wd4987 /d2Zi+</AdditionalOptions> + <Optimization>Full</Optimization> + <AdditionalIncludeDirectories>./../../include;./../../../renderer/include;./../../../framework/include;./../../../../PxToolkit/include;./../../../../../Include;./../../../../../Source/Common/include;./../../../../../Source/Common/include/windows;./../../../../../../Externals/targa/1;./../../../../../../PxShared/include;./../../../../../../PxShared/src/foundation/include;$(DXSDK_DIR)/Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>PHYSX_PROFILE_SDK;WIN32;WIN64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;NDEBUG;PX_SUPPORT_PVD=0;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ExceptionHandling>false</ExceptionHandling> + <WarningLevel>Level4</WarningLevel> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <PrecompiledHeader>NotUsing</PrecompiledHeader> + <PrecompiledHeaderFile></PrecompiledHeaderFile> + <ProgramDataBaseFileName>$(TargetDir)\$(TargetName).pdb</ProgramDataBaseFileName> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Lib> + <AdditionalOptions>/INCREMENTAL:NO</AdditionalOptions> + <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)$(ProjectName).lib</OutputFile> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <ProgramDatabaseFile>$(TargetDir)\$(TargetName).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>./x64/SamplePlatform-MT/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> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FloatingPointModel>Fast</FloatingPointModel> + <AdditionalOptions>/EHsc /MP /Wall /wd4514 /wd4820 /wd4062 /wd4100 /wd4130 /wd4201 /wd4242 /wd4244 /wd4245 /wd4265 /wd4266 /wd4324 /wd4389 /wd4365 /wd4371 /wd4447 /wd4189 /wd4191 /wd4350 /wd4505 /wd4512 /wd4548 /wd4571 /wd4625 /wd4626 /wd4668 /wd4619 /wd4701 /wd4702 /wd4706 /wd4710 /wd4711 /wd4640 /wd4061 /wd4826 /wd4946 /wd4917 /wd4986 /wd4987 /d2Zi+</AdditionalOptions> + <Optimization>Full</Optimization> + <AdditionalIncludeDirectories>./../../include;./../../../renderer/include;./../../../framework/include;./../../../../PxToolkit/include;./../../../../../Include;./../../../../../Source/Common/include;./../../../../../Source/Common/include/windows;./../../../../../../Externals/targa/1;./../../../../../../PxShared/include;./../../../../../../PxShared/src/foundation/include;$(DXSDK_DIR)/Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>PHYSX_PROFILE_SDK;WIN32;WIN64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;NDEBUG;PX_CHECKED=1;PX_NVTX=1;PX_SUPPORT_PVD=1;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ExceptionHandling>false</ExceptionHandling> + <WarningLevel>Level4</WarningLevel> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <PrecompiledHeader>NotUsing</PrecompiledHeader> + <PrecompiledHeaderFile></PrecompiledHeaderFile> + <ProgramDataBaseFileName>$(TargetDir)\$(TargetName).pdb</ProgramDataBaseFileName> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Lib> + <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)$(ProjectName)CHECKED.lib</OutputFile> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <ProgramDatabaseFile>$(TargetDir)\$(TargetName).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>./x64/SamplePlatform-MT/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> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FloatingPointModel>Fast</FloatingPointModel> + <AdditionalOptions>/EHsc /MP /Wall /wd4514 /wd4820 /wd4062 /wd4100 /wd4130 /wd4201 /wd4242 /wd4244 /wd4245 /wd4265 /wd4266 /wd4324 /wd4389 /wd4365 /wd4371 /wd4447 /wd4189 /wd4191 /wd4350 /wd4505 /wd4512 /wd4548 /wd4571 /wd4625 /wd4626 /wd4668 /wd4619 /wd4701 /wd4702 /wd4706 /wd4710 /wd4711 /wd4640 /wd4061 /wd4826 /wd4946 /wd4917 /wd4986 /wd4987 /d2Zi+</AdditionalOptions> + <Optimization>Full</Optimization> + <AdditionalIncludeDirectories>./../../include;./../../../renderer/include;./../../../framework/include;./../../../../PxToolkit/include;./../../../../../Include;./../../../../../Source/Common/include;./../../../../../Source/Common/include/windows;./../../../../../../Externals/targa/1;./../../../../../../PxShared/include;./../../../../../../PxShared/src/foundation/include;$(DXSDK_DIR)/Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>PHYSX_PROFILE_SDK;WIN32;WIN64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;NDEBUG;PX_PROFILE=1;PX_NVTX=1;PX_SUPPORT_PVD=1;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ExceptionHandling>false</ExceptionHandling> + <WarningLevel>Level4</WarningLevel> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <PrecompiledHeader>NotUsing</PrecompiledHeader> + <PrecompiledHeaderFile></PrecompiledHeaderFile> + <ProgramDataBaseFileName>$(TargetDir)\$(TargetName).pdb</ProgramDataBaseFileName> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Lib> + <AdditionalOptions>/INCREMENTAL:NO</AdditionalOptions> + <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)$(ProjectName)PROFILE.lib</OutputFile> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <ProgramDatabaseFile>$(TargetDir)\$(TargetName).pdb</ProgramDatabaseFile> + <TargetMachine>MachineX64</TargetMachine> + </Lib> + <ResourceCompile> + </ResourceCompile> + <ProjectReference> + <LinkLibraryDependencies>true</LinkLibraryDependencies> + </ProjectReference> + </ItemDefinitionGroup> + <ItemGroup> + <ClInclude Include="..\..\include\windows\WindowsSamplePlatform.h"> + </ClInclude> + <ClInclude Include="..\..\include\windows\WindowsSampleUserInput.h"> + </ClInclude> + <ClInclude Include="..\..\include\windows\WindowsSampleUserInputIds.h"> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\include\SamplePlatform.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleUserInput.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleUserInputIds.h"> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\src\windows\WindowsSamplePlatform.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\windows\WindowsSampleUserInput.cpp"> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\src\SamplePlatform.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\SampleUserInput.cpp"> + </ClCompile> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"></ImportGroup> +</Project> diff --git a/PhysX_3.4/Samples/SampleFramework/platform/compiler/vc14win32/SamplePlatform-MT.vcxproj b/PhysX_3.4/Samples/SampleFramework/platform/compiler/vc14win32/SamplePlatform-MT.vcxproj new file mode 100644 index 00000000..fd530fff --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/platform/compiler/vc14win32/SamplePlatform-MT.vcxproj @@ -0,0 +1,246 @@ +<?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="checked|Win32"> + <Configuration>checked</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="profile|Win32"> + <Configuration>profile</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{75A6206D-F123-AEE0-FF3D-386A62604731}</ProjectGuid> + <RootNamespace>SamplePlatform-MT</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)'=='checked|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> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup 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" /> + </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" /> + </ImportGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> + <OutDir>./../../lib/vc14win32\</OutDir> + <IntDir>./Win32/SamplePlatform-MT/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> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FloatingPointModel>Fast</FloatingPointModel> + <BasicRuntimeChecks>UninitializedLocalUsageCheck</BasicRuntimeChecks> + <AdditionalOptions>/EHsc /GR- /GF /arch:SSE2 /MP /Wall /wd4514 /wd4820 /wd4062 /wd4100 /wd4130 /wd4201 /wd4242 /wd4244 /wd4245 /wd4265 /wd4266 /wd4324 /wd4389 /wd4365 /wd4371 /wd4447 /wd4189 /wd4191 /wd4350 /wd4505 /wd4512 /wd4548 /wd4571 /wd4625 /wd4626 /wd4668 /wd4619 /wd4701 /wd4702 /wd4706 /wd4710 /wd4711 /wd4640 /wd4061 /wd4826 /wd4946 /wd4917 /wd4986 /wd4987 /wd4456 /wd4457 /wd4458 /wd4459 /wd4774 /wd4777 /wd5027 /wd5029 /wd4464 /Zi /d2Zi+</AdditionalOptions> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>./../../include;./../../../renderer/include;./../../../framework/include;./../../../../PxToolkit/include;./../../../../../Include;./../../../../../Source/Common/include;./../../../../../Source/Common/include/windows;./../../../../../../Externals/targa/1;./../../../../../../PxShared/include;./../../../../../../PxShared/src/foundation/include;$(DXSDK_DIR)/Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>PHYSX_PROFILE_SDK;WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;_DEBUG;PX_DEBUG=1;PX_CHECKED=1;PX_NVTX=1;PX_SUPPORT_PVD=1;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ExceptionHandling>false</ExceptionHandling> + <WarningLevel>Level4</WarningLevel> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeader>NotUsing</PrecompiledHeader> + <PrecompiledHeaderFile></PrecompiledHeaderFile> + <ProgramDataBaseFileName>$(TargetDir)\$(TargetName).pdb</ProgramDataBaseFileName> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Lib> + <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)$(ProjectName)DEBUG.lib</OutputFile> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <ProgramDatabaseFile>$(TargetDir)\$(TargetName).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>./Win32/SamplePlatform-MT/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> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FloatingPointModel>Fast</FloatingPointModel> + <AdditionalOptions>/EHsc /GR- /GF /arch:SSE2 /MP /Wall /wd4514 /wd4820 /wd4062 /wd4100 /wd4130 /wd4201 /wd4242 /wd4244 /wd4245 /wd4265 /wd4266 /wd4324 /wd4389 /wd4365 /wd4371 /wd4447 /wd4189 /wd4191 /wd4350 /wd4505 /wd4512 /wd4548 /wd4571 /wd4625 /wd4626 /wd4668 /wd4619 /wd4701 /wd4702 /wd4706 /wd4710 /wd4711 /wd4640 /wd4061 /wd4826 /wd4946 /wd4917 /wd4986 /wd4987 /wd4456 /wd4457 /wd4458 /wd4459 /wd4774 /wd4777 /wd5027 /wd5029 /wd4464 /d2Zi+</AdditionalOptions> + <Optimization>Full</Optimization> + <AdditionalIncludeDirectories>./../../include;./../../../renderer/include;./../../../framework/include;./../../../../PxToolkit/include;./../../../../../Include;./../../../../../Source/Common/include;./../../../../../Source/Common/include/windows;./../../../../../../Externals/targa/1;./../../../../../../PxShared/include;./../../../../../../PxShared/src/foundation/include;$(DXSDK_DIR)/Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>PHYSX_PROFILE_SDK;WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;NDEBUG;PX_SUPPORT_PVD=0;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ExceptionHandling>false</ExceptionHandling> + <WarningLevel>Level4</WarningLevel> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <PrecompiledHeader>NotUsing</PrecompiledHeader> + <PrecompiledHeaderFile></PrecompiledHeaderFile> + <ProgramDataBaseFileName>$(TargetDir)\$(TargetName).pdb</ProgramDataBaseFileName> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Lib> + <AdditionalOptions>/INCREMENTAL:NO</AdditionalOptions> + <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)$(ProjectName).lib</OutputFile> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <ProgramDatabaseFile>$(TargetDir)\$(TargetName).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>./Win32/SamplePlatform-MT/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> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FloatingPointModel>Fast</FloatingPointModel> + <AdditionalOptions>/EHsc /GR- /GF /arch:SSE2 /MP /Wall /wd4514 /wd4820 /wd4062 /wd4100 /wd4130 /wd4201 /wd4242 /wd4244 /wd4245 /wd4265 /wd4266 /wd4324 /wd4389 /wd4365 /wd4371 /wd4447 /wd4189 /wd4191 /wd4350 /wd4505 /wd4512 /wd4548 /wd4571 /wd4625 /wd4626 /wd4668 /wd4619 /wd4701 /wd4702 /wd4706 /wd4710 /wd4711 /wd4640 /wd4061 /wd4826 /wd4946 /wd4917 /wd4986 /wd4987 /wd4456 /wd4457 /wd4458 /wd4459 /wd4774 /wd4777 /wd5027 /wd5029 /wd4464 /d2Zi+</AdditionalOptions> + <Optimization>Full</Optimization> + <AdditionalIncludeDirectories>./../../include;./../../../renderer/include;./../../../framework/include;./../../../../PxToolkit/include;./../../../../../Include;./../../../../../Source/Common/include;./../../../../../Source/Common/include/windows;./../../../../../../Externals/targa/1;./../../../../../../PxShared/include;./../../../../../../PxShared/src/foundation/include;$(DXSDK_DIR)/Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>PHYSX_PROFILE_SDK;WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;NDEBUG;PX_CHECKED=1;PX_NVTX=1;PX_SUPPORT_PVD=1;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ExceptionHandling>false</ExceptionHandling> + <WarningLevel>Level4</WarningLevel> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <PrecompiledHeader>NotUsing</PrecompiledHeader> + <PrecompiledHeaderFile></PrecompiledHeaderFile> + <ProgramDataBaseFileName>$(TargetDir)\$(TargetName).pdb</ProgramDataBaseFileName> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Lib> + <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)$(ProjectName)CHECKED.lib</OutputFile> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <ProgramDatabaseFile>$(TargetDir)\$(TargetName).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>./Win32/SamplePlatform-MT/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> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FloatingPointModel>Fast</FloatingPointModel> + <AdditionalOptions>/EHsc /GR- /GF /arch:SSE2 /MP /Wall /wd4514 /wd4820 /wd4062 /wd4100 /wd4130 /wd4201 /wd4242 /wd4244 /wd4245 /wd4265 /wd4266 /wd4324 /wd4389 /wd4365 /wd4371 /wd4447 /wd4189 /wd4191 /wd4350 /wd4505 /wd4512 /wd4548 /wd4571 /wd4625 /wd4626 /wd4668 /wd4619 /wd4701 /wd4702 /wd4706 /wd4710 /wd4711 /wd4640 /wd4061 /wd4826 /wd4946 /wd4917 /wd4986 /wd4987 /wd4456 /wd4457 /wd4458 /wd4459 /wd4774 /wd4777 /wd5027 /wd5029 /wd4464 /d2Zi+</AdditionalOptions> + <Optimization>Full</Optimization> + <AdditionalIncludeDirectories>./../../include;./../../../renderer/include;./../../../framework/include;./../../../../PxToolkit/include;./../../../../../Include;./../../../../../Source/Common/include;./../../../../../Source/Common/include/windows;./../../../../../../Externals/targa/1;./../../../../../../PxShared/include;./../../../../../../PxShared/src/foundation/include;$(DXSDK_DIR)/Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>PHYSX_PROFILE_SDK;WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;NDEBUG;PX_PROFILE=1;PX_NVTX=1;PX_SUPPORT_PVD=1;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ExceptionHandling>false</ExceptionHandling> + <WarningLevel>Level4</WarningLevel> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <PrecompiledHeader>NotUsing</PrecompiledHeader> + <PrecompiledHeaderFile></PrecompiledHeaderFile> + <ProgramDataBaseFileName>$(TargetDir)\$(TargetName).pdb</ProgramDataBaseFileName> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Lib> + <AdditionalOptions>/INCREMENTAL:NO</AdditionalOptions> + <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)$(ProjectName)PROFILE.lib</OutputFile> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <ProgramDatabaseFile>$(TargetDir)\$(TargetName).pdb</ProgramDatabaseFile> + <TargetMachine>MachineX86</TargetMachine> + </Lib> + <ResourceCompile> + </ResourceCompile> + <ProjectReference> + <LinkLibraryDependencies>true</LinkLibraryDependencies> + </ProjectReference> + </ItemDefinitionGroup> + <ItemGroup> + <ClInclude Include="..\..\include\windows\WindowsSamplePlatform.h"> + </ClInclude> + <ClInclude Include="..\..\include\windows\WindowsSampleUserInput.h"> + </ClInclude> + <ClInclude Include="..\..\include\windows\WindowsSampleUserInputIds.h"> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\include\SamplePlatform.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleUserInput.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleUserInputIds.h"> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\src\windows\WindowsSamplePlatform.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\windows\WindowsSampleUserInput.cpp"> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\src\SamplePlatform.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\SampleUserInput.cpp"> + </ClCompile> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"></ImportGroup> +</Project> diff --git a/PhysX_3.4/Samples/SampleFramework/platform/compiler/vc14win64/SamplePlatform-MT.vcxproj b/PhysX_3.4/Samples/SampleFramework/platform/compiler/vc14win64/SamplePlatform-MT.vcxproj new file mode 100644 index 00000000..98392e0c --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/platform/compiler/vc14win64/SamplePlatform-MT.vcxproj @@ -0,0 +1,246 @@ +<?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="checked|x64"> + <Configuration>checked</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="profile|x64"> + <Configuration>profile</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{75A6206D-F123-AEE0-FF3D-386A62604731}</ProjectGuid> + <RootNamespace>SamplePlatform-MT</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)'=='checked|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> + <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" /> + </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" /> + </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" /> + </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" /> + </ImportGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> + <OutDir>./../../lib/vc14win64\</OutDir> + <IntDir>./x64/SamplePlatform-MT/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> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FloatingPointModel>Fast</FloatingPointModel> + <BasicRuntimeChecks>UninitializedLocalUsageCheck</BasicRuntimeChecks> + <AdditionalOptions>/EHsc /GR- /GF /MP /Wall /wd4514 /wd4820 /wd4062 /wd4100 /wd4130 /wd4201 /wd4242 /wd4244 /wd4245 /wd4265 /wd4266 /wd4324 /wd4389 /wd4365 /wd4371 /wd4447 /wd4189 /wd4191 /wd4350 /wd4505 /wd4512 /wd4548 /wd4571 /wd4625 /wd4626 /wd4668 /wd4619 /wd4701 /wd4702 /wd4706 /wd4710 /wd4711 /wd4640 /wd4061 /wd4826 /wd4946 /wd4917 /wd4986 /wd4987 /wd4456 /wd4457 /wd4458 /wd4459 /wd4774 /wd4777 /wd5027 /wd5029 /wd4464 /Zi /d2Zi+</AdditionalOptions> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>./../../include;./../../../renderer/include;./../../../framework/include;./../../../../PxToolkit/include;./../../../../../Include;./../../../../../Source/Common/include;./../../../../../Source/Common/include/windows;./../../../../../../Externals/targa/1;./../../../../../../PxShared/include;./../../../../../../PxShared/src/foundation/include;$(DXSDK_DIR)/Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>PHYSX_PROFILE_SDK;WIN32;WIN64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;_DEBUG;PX_DEBUG=1;PX_CHECKED=1;PX_NVTX=1;PX_SUPPORT_PVD=1;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ExceptionHandling>false</ExceptionHandling> + <WarningLevel>Level4</WarningLevel> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeader>NotUsing</PrecompiledHeader> + <PrecompiledHeaderFile></PrecompiledHeaderFile> + <ProgramDataBaseFileName>$(TargetDir)\$(TargetName).pdb</ProgramDataBaseFileName> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Lib> + <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)$(ProjectName)DEBUG.lib</OutputFile> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <ProgramDatabaseFile>$(TargetDir)\$(TargetName).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>./x64/SamplePlatform-MT/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> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FloatingPointModel>Fast</FloatingPointModel> + <AdditionalOptions>/EHsc /GR- /GF /MP /Wall /wd4514 /wd4820 /wd4062 /wd4100 /wd4130 /wd4201 /wd4242 /wd4244 /wd4245 /wd4265 /wd4266 /wd4324 /wd4389 /wd4365 /wd4371 /wd4447 /wd4189 /wd4191 /wd4350 /wd4505 /wd4512 /wd4548 /wd4571 /wd4625 /wd4626 /wd4668 /wd4619 /wd4701 /wd4702 /wd4706 /wd4710 /wd4711 /wd4640 /wd4061 /wd4826 /wd4946 /wd4917 /wd4986 /wd4987 /wd4456 /wd4457 /wd4458 /wd4459 /wd4774 /wd4777 /wd5027 /wd5029 /wd4464 /d2Zi+</AdditionalOptions> + <Optimization>Full</Optimization> + <AdditionalIncludeDirectories>./../../include;./../../../renderer/include;./../../../framework/include;./../../../../PxToolkit/include;./../../../../../Include;./../../../../../Source/Common/include;./../../../../../Source/Common/include/windows;./../../../../../../Externals/targa/1;./../../../../../../PxShared/include;./../../../../../../PxShared/src/foundation/include;$(DXSDK_DIR)/Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>PHYSX_PROFILE_SDK;WIN32;WIN64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;NDEBUG;PX_SUPPORT_PVD=0;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ExceptionHandling>false</ExceptionHandling> + <WarningLevel>Level4</WarningLevel> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <PrecompiledHeader>NotUsing</PrecompiledHeader> + <PrecompiledHeaderFile></PrecompiledHeaderFile> + <ProgramDataBaseFileName>$(TargetDir)\$(TargetName).pdb</ProgramDataBaseFileName> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Lib> + <AdditionalOptions>/INCREMENTAL:NO</AdditionalOptions> + <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)$(ProjectName).lib</OutputFile> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <ProgramDatabaseFile>$(TargetDir)\$(TargetName).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>./x64/SamplePlatform-MT/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> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FloatingPointModel>Fast</FloatingPointModel> + <AdditionalOptions>/EHsc /GR- /GF /MP /Wall /wd4514 /wd4820 /wd4062 /wd4100 /wd4130 /wd4201 /wd4242 /wd4244 /wd4245 /wd4265 /wd4266 /wd4324 /wd4389 /wd4365 /wd4371 /wd4447 /wd4189 /wd4191 /wd4350 /wd4505 /wd4512 /wd4548 /wd4571 /wd4625 /wd4626 /wd4668 /wd4619 /wd4701 /wd4702 /wd4706 /wd4710 /wd4711 /wd4640 /wd4061 /wd4826 /wd4946 /wd4917 /wd4986 /wd4987 /wd4456 /wd4457 /wd4458 /wd4459 /wd4774 /wd4777 /wd5027 /wd5029 /wd4464 /d2Zi+</AdditionalOptions> + <Optimization>Full</Optimization> + <AdditionalIncludeDirectories>./../../include;./../../../renderer/include;./../../../framework/include;./../../../../PxToolkit/include;./../../../../../Include;./../../../../../Source/Common/include;./../../../../../Source/Common/include/windows;./../../../../../../Externals/targa/1;./../../../../../../PxShared/include;./../../../../../../PxShared/src/foundation/include;$(DXSDK_DIR)/Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>PHYSX_PROFILE_SDK;WIN32;WIN64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;NDEBUG;PX_CHECKED=1;PX_NVTX=1;PX_SUPPORT_PVD=1;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ExceptionHandling>false</ExceptionHandling> + <WarningLevel>Level4</WarningLevel> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <PrecompiledHeader>NotUsing</PrecompiledHeader> + <PrecompiledHeaderFile></PrecompiledHeaderFile> + <ProgramDataBaseFileName>$(TargetDir)\$(TargetName).pdb</ProgramDataBaseFileName> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Lib> + <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)$(ProjectName)CHECKED.lib</OutputFile> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <ProgramDatabaseFile>$(TargetDir)\$(TargetName).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>./x64/SamplePlatform-MT/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> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FloatingPointModel>Fast</FloatingPointModel> + <AdditionalOptions>/EHsc /GR- /GF /MP /Wall /wd4514 /wd4820 /wd4062 /wd4100 /wd4130 /wd4201 /wd4242 /wd4244 /wd4245 /wd4265 /wd4266 /wd4324 /wd4389 /wd4365 /wd4371 /wd4447 /wd4189 /wd4191 /wd4350 /wd4505 /wd4512 /wd4548 /wd4571 /wd4625 /wd4626 /wd4668 /wd4619 /wd4701 /wd4702 /wd4706 /wd4710 /wd4711 /wd4640 /wd4061 /wd4826 /wd4946 /wd4917 /wd4986 /wd4987 /wd4456 /wd4457 /wd4458 /wd4459 /wd4774 /wd4777 /wd5027 /wd5029 /wd4464 /d2Zi+</AdditionalOptions> + <Optimization>Full</Optimization> + <AdditionalIncludeDirectories>./../../include;./../../../renderer/include;./../../../framework/include;./../../../../PxToolkit/include;./../../../../../Include;./../../../../../Source/Common/include;./../../../../../Source/Common/include/windows;./../../../../../../Externals/targa/1;./../../../../../../PxShared/include;./../../../../../../PxShared/src/foundation/include;$(DXSDK_DIR)/Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>PHYSX_PROFILE_SDK;WIN32;WIN64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;NDEBUG;PX_PROFILE=1;PX_NVTX=1;PX_SUPPORT_PVD=1;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ExceptionHandling>false</ExceptionHandling> + <WarningLevel>Level4</WarningLevel> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <PrecompiledHeader>NotUsing</PrecompiledHeader> + <PrecompiledHeaderFile></PrecompiledHeaderFile> + <ProgramDataBaseFileName>$(TargetDir)\$(TargetName).pdb</ProgramDataBaseFileName> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Lib> + <AdditionalOptions>/INCREMENTAL:NO</AdditionalOptions> + <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)$(ProjectName)PROFILE.lib</OutputFile> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <ProgramDatabaseFile>$(TargetDir)\$(TargetName).pdb</ProgramDatabaseFile> + <TargetMachine>MachineX64</TargetMachine> + </Lib> + <ResourceCompile> + </ResourceCompile> + <ProjectReference> + <LinkLibraryDependencies>true</LinkLibraryDependencies> + </ProjectReference> + </ItemDefinitionGroup> + <ItemGroup> + <ClInclude Include="..\..\include\windows\WindowsSamplePlatform.h"> + </ClInclude> + <ClInclude Include="..\..\include\windows\WindowsSampleUserInput.h"> + </ClInclude> + <ClInclude Include="..\..\include\windows\WindowsSampleUserInputIds.h"> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\include\SamplePlatform.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleUserInput.h"> + </ClInclude> + <ClInclude Include="..\..\include\SampleUserInputIds.h"> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\src\windows\WindowsSamplePlatform.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\windows\WindowsSampleUserInput.cpp"> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\src\SamplePlatform.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\SampleUserInput.cpp"> + </ClCompile> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"></ImportGroup> +</Project> diff --git a/PhysX_3.4/Samples/SampleFramework/platform/include/SamplePlatform.h b/PhysX_3.4/Samples/SampleFramework/platform/include/SamplePlatform.h new file mode 100644 index 00000000..2b88fdda --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/platform/include/SamplePlatform.h @@ -0,0 +1,152 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#ifndef SAMPLE_PLATFORM_H +#define SAMPLE_PLATFORM_H + +#include <RendererDesc.h> +#include <RendererWindow.h> +#include <RendererTexture2D.h> + +namespace SampleFramework +{ + class SampleApplication; + class SampleUserInput; + + /* This class declares and partly implements platform-abstraction level. + Do not use platform-specific types and functions here. + */ + class SamplePlatform + { + protected: + SampleRenderer::RendererWindow* m_app; + SampleApplication* m_sf_app; + static SamplePlatform* m_platform; + + public: + // access + static SamplePlatform* platform(); + static void setPlatform(SamplePlatform*); + SampleApplication* application(); + + // creation + explicit SamplePlatform(SampleRenderer::RendererWindow* _app); + virtual ~SamplePlatform() = 0; + // System + virtual void showCursor(bool); + + virtual size_t getCWD(char* path, size_t len); + virtual void setCWDToEXE(void); + virtual void popPathSpec(char *path); + virtual bool preOpenWindow(void * ptr); + virtual bool openWindow(physx::PxU32& width, + physx::PxU32& height, + const char* title, + bool fullscreen); + virtual bool useWindow(physx::PxU64 hwnd); + virtual void update(); + virtual bool closeWindow(); + virtual bool updateWindow(); + virtual bool hasFocus() const; + virtual void setFocus(bool b); + virtual bool isOpen(); + virtual physx::PxU64 getWindowHandle(); + virtual void setWindowSize(physx::PxU32 width, + physx::PxU32 height); + virtual void getWindowSize(physx::PxU32& width, physx::PxU32& height); + virtual void getTitle(char *title, physx::PxU32 maxLength) const; + virtual void setTitle(const char *title); + + virtual void setMouseCursorRecentering(bool val) {} + virtual bool getMouseCursorRecentering() const { return false; } + + virtual void showMessage(const char* title, const char* message); + virtual bool saveBitmap(const char* fileName, + physx::PxU32 width, + physx::PxU32 height, + physx::PxU32 sizeInBytes, + const void* data); + virtual void* compileProgram(void * context, + const char* assetDir, + const char *programPath, + physx::PxU64 profile, + const char* passString, + const char *entry, + const char **args); + virtual void* initializeD3D9(); + virtual void* initializeD3D11(); + virtual bool isD3D9ok(); + virtual const char* getPathSeparator(); + virtual bool isD3D11ok(); + // Rendering + virtual void initializeCGRuntimeCompiler(); + virtual void initializeOGLDisplay(const SampleRenderer::RendererDesc& desc, + physx::PxU32& width, + physx::PxU32& height); + virtual physx::PxU32 initializeD3D9Display(void * presentParameters, + char* m_deviceName, + physx::PxU32& width, + physx::PxU32& height, + void * m_d3dDevice_out); + virtual physx::PxU32 initializeD3D11Display(void *dxgiSwapChainDesc, + char *m_deviceName, + physx::PxU32& width, + physx::PxU32& height, + void *m_d3dDevice_out, + void *m_d3dDeviceContext_out, + void *m_dxgiSwap_out); + virtual physx::PxU32 D3D9Present(); + virtual void D3D9BlockUntilNotBusy(void * resource); + virtual void D3D9DeviceBlockUntilIdle(); + virtual physx::PxU64 getD3D9TextureFormat(SampleRenderer::RendererTexture2D::Format format); + virtual physx::PxU32 D3D11Present(bool vsync); + virtual physx::PxU64 getD3D11TextureFormat(SampleRenderer::RendererTexture2D::Format format); + virtual void postInitializeOGLDisplay(); + virtual void setOGLVsync(bool on); + virtual bool makeContextCurrent(); + virtual bool isContextValid(); + virtual void freeDisplay(); + virtual void swapBuffers(); + virtual void postRendererRelease(); + virtual void preRendererSetup(); + virtual void postRendererSetup(SampleRenderer::Renderer* renderer); + virtual void setupRendererDescription(SampleRenderer::RendererDesc& renDesc); + // Input + virtual void doInput(); + + virtual const SampleUserInput* getSampleUserInput() const = 0; + virtual SampleUserInput* getSampleUserInput() = 0; + + virtual const char* getPlatformName() const { return NULL; } + // File System + virtual bool makeSureDirectoryPathExists(const char* dirPath); + }; + + SamplePlatform* createPlatform(SampleRenderer::RendererWindow* _app); +} + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/platform/include/SampleUserInput.h b/PhysX_3.4/Samples/SampleFramework/platform/include/SampleUserInput.h new file mode 100644 index 00000000..32c60242 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/platform/include/SampleUserInput.h @@ -0,0 +1,229 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#ifndef SAMPLE_USER_INPUT_H +#define SAMPLE_USER_INPUT_H + +#include <foundation/PxSimpleTypes.h> +#include <vector> +#include "PsString.h" + +#if PX_VC +#pragma warning(push) +#pragma warning(disable:4702) +#include <map> +#pragma warning(pop) +#else +#include <map> +#endif + +namespace SampleRenderer +{ + class Renderer; +} + +namespace SampleFramework +{ + class InputEventListener; + + struct UserInput + { + physx::PxU16 m_Id; + char m_IdName[256]; // this name is used for mapping (enum name) + char m_Name[256]; // this name is used for help + }; + + struct InputEvent + { + InputEvent(physx::PxU16 id, bool analog = false, float sens = 1.0f) + :m_Id(id), m_Analog(analog), m_Sensitivity(sens) + { + } + + InputEvent(const InputEvent& e) + :m_Id(e.m_Id), m_Analog(e.m_Analog), m_Sensitivity(e.m_Sensitivity) + { + } + + InputEvent() + : m_Analog(false), m_Sensitivity(1.0f) + { + } + + physx::PxU16 m_Id; + bool m_Analog; + float m_Sensitivity; + }; + + struct InputEventName + { + char m_Name[256]; + }; + + struct SampleInputData + { + char m_InputEventName[256]; + char m_UserInputName[256]; + }; + + struct SampleInputMapping + { + physx::PxU16 m_InputEventId; + size_t m_InputEventIndex; + physx::PxU16 m_UserInputId; + size_t m_UserInputIndex; + }; + + typedef std::vector<SampleInputData> T_SampleInputData; + + enum InputType + { + UNDEFINED_INPUT = 0, + KEYBOARD_INPUT = (1 << 0), + GAMEPAD_INPUT = (1 << 1), + TOUCH_BUTTON_INPUT = (1 << 2), + TOUCH_PAD_INPUT = (1 << 3), + MOUSE_INPUT = (1 << 4), + }; + + enum InputDataReadState + { + STATE_INPUT_EVENT_ID, + STATE_USER_INPUT_ID, + STATE_DIGITAL, + STATE_INPUT_EVENT_NAME, + }; + + class SampleUserInput + { + public: + // key codes for console and raw key info + enum KeyCode + { + KEY_UNKNOWN = 0, + + KEY_A, KEY_B, KEY_C, KEY_D, KEY_E, KEY_F, KEY_G, + KEY_H, KEY_I, KEY_J, KEY_K, KEY_L, KEY_M, KEY_N, + KEY_O, KEY_P, KEY_Q, KEY_R, KEY_S, KEY_T, KEY_U, + KEY_V, KEY_W, KEY_X, KEY_Y, KEY_Z, + + KEY_0, KEY_1, KEY_2, KEY_3, KEY_4, KEY_5, KEY_6, + KEY_7, KEY_8, KEY_9, + + KEY_SPACE, KEY_RETURN, KEY_SHIFT, KEY_CONTROL, KEY_ESCAPE, KEY_COMMA, + KEY_NUMPAD0, KEY_NUMPAD1, KEY_NUMPAD2, KEY_NUMPAD3, KEY_NUMPAD4, KEY_NUMPAD5, KEY_NUMPAD6, KEY_NUMPAD7, KEY_NUMPAD8, KEY_NUMPAD9, + KEY_MULTIPLY, KEY_ADD, KEY_SEPARATOR, KEY_SUBTRACT, KEY_DECIMAL, KEY_DIVIDE, + + KEY_F1, KEY_F2, KEY_F3, KEY_F4, KEY_F5, KEY_F6, + KEY_F7, KEY_F8, KEY_F9, KEY_F10, KEY_F11, KEY_F12, + + KEY_TAB, KEY_PRIOR, KEY_NEXT, + KEY_UP, KEY_DOWN, KEY_LEFT, KEY_RIGHT, + + NUM_KEY_CODES, + }; + + SampleUserInput(); + + virtual ~SampleUserInput(); + + void registerUserInput(physx::PxU16 id, const char* idName, const char* name); + virtual const InputEvent* registerInputEvent(const InputEvent& inputEvent, physx::PxU16 userInputId, const char* name); + virtual const InputEvent* registerTouchInputEvent(const InputEvent& inputEvent, physx::PxU16 userInputId, const char* caption, const char* name) + { + PX_UNUSED(inputEvent); + PX_UNUSED(userInputId); + PX_UNUSED(caption); + return NULL; + } + virtual void unregisterInputEvent(physx::PxU16 inputEventId); + virtual void registerInputEvent(const SampleInputMapping& mapping); + + virtual bool keyboardSupported() const { return false; } + virtual bool gamepadSupported() const { return false; } + virtual bool mouseSupported() const { return false; } + + virtual InputType getInputType(const UserInput& ) const { return UNDEFINED_INPUT; } + + void registerInputEventListerner(InputEventListener* listener) { mListener = listener; } + InputEventListener* getInputEventListener() const { return mListener; } + + virtual void updateInput(); + virtual void shutdown(); + + virtual void setRenderer(SampleRenderer::Renderer* ) {} + + virtual bool getDigitalInputEventState(physx::PxU16 inputEventId ) const = 0; + virtual float getAnalogInputEventState(physx::PxU16 inputEventId ) const = 0; + + const std::vector<size_t>* getUserInputs(physx::PxI32 inputEventId) const; + const std::vector<size_t>* getInputEvents(physx::PxU16 userInputId) const; + + const std::vector<InputEvent>& getInputEventList() const { return mInputEvents; } + const std::vector<InputEventName>& getInputEventNameList() const { return mInputEventNames; } + const std::vector<UserInput>& getUserInputList() const { return mUserInputs; } + const std::map<physx::PxU16, std::vector<size_t> >& getInputEventUserInputMap() const { return mInputEventUserInputMap; } + + physx::PxU16 getUserInputKeys(physx::PxU16 inputEventId, const char* names[], physx::PxU16 maxNames, physx::PxU32 inputTypeMask) const; + + physx::PxI32 translateUserInputNameToId(const char* name, size_t& index) const; + physx::PxI32 translateInputEventNameToId(const char* name, size_t& index) const; + const char* translateInputEventIdToName(physx::PxI32 id) const; + + const InputEvent* getInputEventSlow(physx::PxU16 inputEventId) const; + + protected: + virtual void processGamepads(); + + std::vector<UserInput> mUserInputs; + std::vector<InputEvent> mInputEvents; + std::vector<InputEventName> mInputEventNames; + + private: + + InputEventListener* mListener; + std::map<physx::PxU16, std::vector<size_t> > mInputEventUserInputMap; + std::map<physx::PxU16, std::vector<size_t> > mUserInputInputEventMap; + }; + + class InputEventListener + { + public: + InputEventListener() {} + + virtual ~InputEventListener() {} + + // special case for text console + virtual void onKeyDownEx(SampleUserInput::KeyCode, physx::PxU32) {} + + virtual void onPointerInputEvent(const InputEvent&, physx::PxU32, physx::PxU32, physx::PxReal, physx::PxReal, bool val) {} + virtual void onAnalogInputEvent(const InputEvent& , float val) = 0; + virtual void onDigitalInputEvent(const InputEvent& , bool val) = 0; + }; +} + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/platform/include/SampleUserInputIds.h b/PhysX_3.4/Samples/SampleFramework/platform/include/SampleUserInputIds.h new file mode 100644 index 00000000..6a2e2fb9 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/platform/include/SampleUserInputIds.h @@ -0,0 +1,58 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#ifndef SAMPLE_USER_INPUT_IDS_H +#define SAMPLE_USER_INPUT_IDS_H + + +#if defined RENDERER_WINDOWS +#if PX_XBOXONE + #include <xboxone/XboxOneSampleUserInputIds.h> +#else + #include <windows/WindowsSampleUserInputIds.h> +#endif +#elif defined (RENDERER_XBOX360) + #include <xbox360/Xbox360SampleUserInputIds.h> +#elif defined (RENDERER_PS3) + #include <ps3/PS3SampleUserInputIds.h> +#elif defined (RENDERER_PS4) + #include <ps4/PS4SampleUserInputIds.h> +#elif defined (RENDERER_LINUX) + #include <linux/LinuxSampleUserInputIds.h> +#elif defined (RENDERER_ANDROID) + #include <android/AndroidSampleUserInputIds.h> +#elif defined (RENDERER_MACOSX) + #include <osx/OSXSampleUserInputIds.h> +#elif defined (RENDERER_IOS) + #include <ios/IosSampleUserInputIds.h> +#elif defined (RENDERER_WIIU) + #include <wiiu/WiiUSampleUserInputIds.h> +#else + #error Unknown platform! +#endif + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/platform/include/windows/WindowsSamplePlatform.h b/PhysX_3.4/Samples/SampleFramework/platform/include/windows/WindowsSamplePlatform.h new file mode 100644 index 00000000..2d300712 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/platform/include/windows/WindowsSamplePlatform.h @@ -0,0 +1,162 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#ifndef WINDOWS_SAMPLE_PLATFORM_H +#define WINDOWS_SAMPLE_PLATFORM_H + +#include <SamplePlatform.h> +#include <windows/WindowsSampleUserInput.h> + +struct IDirect3D9; +struct IDirect3DDevice9; + +struct ID3D11Device; +struct ID3D11DeviceContext; +struct IDXGIFactory1; +struct IDXGISwapChain; + +namespace SampleFramework +{ + class WindowsPlatform : public SamplePlatform + { + public: + explicit WindowsPlatform(SampleRenderer::RendererWindow* _app); + virtual ~WindowsPlatform(); + // System + virtual void showCursor(bool); + virtual void postRendererSetup(SampleRenderer::Renderer* renderer); + virtual size_t getCWD(char* path, size_t len); + virtual void setCWDToEXE(void); + virtual bool openWindow(physx::PxU32& width, + physx::PxU32& height, + const char* title, + bool fullscreen); + virtual bool useWindow(physx::PxU64 hwnd); + virtual void update(); + virtual bool isOpen(); + virtual bool closeWindow(); + virtual bool hasFocus() const; + virtual void getTitle(char *title, physx::PxU32 maxLength) const; + virtual void setTitle(const char *title); + virtual void setFocus(bool b); + virtual physx::PxU64 getWindowHandle(); + virtual void setWindowSize(physx::PxU32 width, + physx::PxU32 height); + virtual void getWindowSize(physx::PxU32& width, physx::PxU32& height); + virtual void showMessage(const char* title, const char* message); + virtual bool saveBitmap(const char* fileName, + physx::PxU32 width, + physx::PxU32 height, + physx::PxU32 sizeInBytes, + const void* data); + virtual void* compileProgram(void * context, + const char* assetDir, + const char *programPath, + physx::PxU64 profile, + const char* passString, + const char *entry, + const char **args); + virtual void* initializeD3D9(); + virtual bool isD3D9ok(); + virtual void* initializeD3D11(); + virtual bool isD3D11ok(); + // Rendering + virtual void initializeOGLDisplay(const SampleRenderer::RendererDesc& desc, + physx::PxU32& width, + physx::PxU32& height); + virtual void postInitializeOGLDisplay(); + virtual void setOGLVsync(bool on); + virtual physx::PxU32 initializeD3D9Display(void * presentParameters, + char* m_deviceName, + physx::PxU32& width, + physx::PxU32& height, + void * m_d3dDevice_out); + virtual physx::PxU32 initializeD3D11Display(void *dxgiSwapChainDesc, + char *m_deviceName, + physx::PxU32& width, + physx::PxU32& height, + void *m_d3dDevice_out, + void *m_d3dDeviceContext_out, + void *m_dxgiSwap_out); + + virtual physx::PxU32 D3D9Present(); + virtual physx::PxU64 getD3D9TextureFormat(SampleRenderer::RendererTexture2D::Format format); + virtual physx::PxU32 D3D11Present(bool vsync); + virtual physx::PxU64 getD3D11TextureFormat(SampleRenderer::RendererTexture2D::Format format); + virtual bool makeContextCurrent(); + virtual void freeDisplay(); + virtual bool isContextValid(); + virtual void swapBuffers(); + virtual void setupRendererDescription(SampleRenderer::RendererDesc& renDesc); + // Input + virtual void doInput(); + // File System + virtual bool makeSureDirectoryPathExists(const char* dirPath); + + virtual const SampleUserInput* getSampleUserInput() const { return &m_windowsSampleUserInput; } + virtual SampleUserInput* getSampleUserInput() { return &m_windowsSampleUserInput; } + + WindowsSampleUserInput& getWindowsSampleUserInput() { return m_windowsSampleUserInput; } + const WindowsSampleUserInput& getWindowsSampleUserInput() const { return m_windowsSampleUserInput; } + + virtual const char* getPlatformName() const { return m_platformName; } + + virtual void setMouseCursorRecentering(bool val); + virtual bool getMouseCursorRecentering() const; + + + physx::PxVec2 getMouseCursorPos() const { return m_mouseCursorPos; } + void setMouseCursorPos(const physx::PxVec2& pos) { m_mouseCursorPos = pos; } + void recenterMouseCursor(bool generateEvent); + + protected: + IDirect3D9* m_d3d; + IDirect3DDevice9* m_d3dDevice; + IDXGIFactory1* m_dxgiFactory; + IDXGISwapChain* m_dxgiSwap; + ID3D11Device* m_d3d11Device; + ID3D11DeviceContext* m_d3d11DeviceContext; + HWND m_hwnd; + HDC m_hdc; + HGLRC m_hrc; + HMODULE m_library; + HMODULE m_dxgiLibrary; + HMODULE m_d3d11Library; + bool m_ownsWindow; + bool m_isHandlingMessages; + bool m_destroyWindow; + bool m_hasFocus; + bool m_showCursor; + char m_platformName[256]; + WindowsSampleUserInput m_windowsSampleUserInput; + physx::PxVec2 m_mouseCursorPos; + bool m_recenterMouseCursor; + bool m_vsync; + }; +} + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/platform/include/windows/WindowsSampleUserInput.h b/PhysX_3.4/Samples/SampleFramework/platform/include/windows/WindowsSampleUserInput.h new file mode 100644 index 00000000..2e8245e8 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/platform/include/windows/WindowsSampleUserInput.h @@ -0,0 +1,158 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#ifndef WINDOWS_SAMPLE_USER_INPUT_H +#define WINDOWS_SAMPLE_USER_INPUT_H + + +#include <SampleUserInput.h> +#include <windows/WindowsSampleUserInputIds.h> +#include <WTypes.h> +#include <XInput.h> + +namespace SampleFramework +{ + class WindowsSampleUserInput: public SampleUserInput + { + public: + enum KeyEventFlag + { + KEY_EVENT_NONE = 0, + KEY_EVENT_UP, + KEY_EVENT_DOWN, + }; + + enum MouseButtons + { + LEFT_MOUSE_BUTTON, + RIGHT_MOUSE_BUTTON, + CENTER_MOUSE_BUTTON, + }; + + struct KeyEvent + { + WPARAM m_Param; + USHORT m_ScanCode; + KeyEventFlag m_Flags; + }; + + struct InputState + { + InputState() + { + }; + + InputState(bool val) + { + m_State = val; + }; + + InputState(float val) + { + m_Value = val; + }; + + union + { + bool m_State; + float m_Value; + }; + }; + + WindowsSampleUserInput(); + ~WindowsSampleUserInput(); + + bool keyCodeToASCII( WindowsSampleUserInputIds code, char& c ) + { + if( code >= KEY_A && code <= KEY_Z ) + { + c = (char)code + 'A' - 1; + } + else if( code >= KEY_0 && code <= KEY_9 ) + { + c = (char)code + '0' - 1; + } + else if( code == KEY_SPACE ) + { + c = ' '; + } + else + { + return false; + } + return true; + } + + void doOnMouseMove(physx::PxU32 x, physx::PxU32 y, physx::PxReal dx, physx::PxReal dy, WindowsSampleUserInputIds button); + void doOnMouseButton(physx::PxU32 x, physx::PxU32 y, MouseButtons button, bool down); + void onKeyDownEx(WPARAM wParam); + void onKeyDown(WPARAM wParam, LPARAM lParam); + void onKeyUp(WPARAM wParam, LPARAM lParam); + void onKeyEvent(const KeyEvent& keyEvent); + + void onGamepadButton(physx::PxU32 buttonIndex, bool buttonDown); + void onGamepadAnalogButton(physx::PxU32 buttonIndex,const BYTE oldValue,const BYTE newValue); + void onGamepadAxis(physx::PxU32 axis, physx::PxReal val); + + virtual void updateInput(); + virtual void processGamepads(); + + virtual void shutdown(); + + virtual bool keyboardSupported() const { return true; } + virtual bool gamepadSupported() const; + virtual bool mouseSupported() const { return true; } + virtual InputType getInputType(const UserInput&) const; + + virtual bool getDigitalInputEventState(physx::PxU16 inputEventId ) const; + virtual float getAnalogInputEventState(physx::PxU16 inputEventId ) const; + + protected: + WindowsSampleUserInputIds getKeyCode(WPARAM wParam) const; + SampleUserInput::KeyCode getSampleUserInputKeyCode(WPARAM wParam) const; + + const UserInput* getUserInputFromId(WindowsSampleUserInputIds id) const; + + bool hasXInput() const { return mpXInputGetState && mpXInputGetCapabilities; } + + std::map<physx::PxU16, physx::PxU16> mScanCodesMap; + std::map<physx::PxU16,float> mAnalogStates; + std::map<physx::PxU16,bool> mDigitalStates; + + bool mGamePadConnected; + physx::PxU32 mConnectedPad; + + typedef DWORD (WINAPI *LPXINPUTGETSTATE)(DWORD, XINPUT_STATE*); + typedef DWORD (WINAPI *LPXINPUTGETCAPABILITIES)(DWORD,DWORD,XINPUT_CAPABILITIES*); + + HMODULE mXInputLibrary; + LPXINPUTGETSTATE mpXInputGetState; + LPXINPUTGETCAPABILITIES mpXInputGetCapabilities; + }; +} + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/platform/include/windows/WindowsSampleUserInputIds.h b/PhysX_3.4/Samples/SampleFramework/platform/include/windows/WindowsSampleUserInputIds.h new file mode 100644 index 00000000..a2ec823f --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/platform/include/windows/WindowsSampleUserInputIds.h @@ -0,0 +1,178 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#ifndef WINDOWS_SAMPLE_USER_INPUT_IDS_H +#define WINDOWS_SAMPLE_USER_INPUT_IDS_H + + +namespace SampleFramework +{ + enum WindowsSampleUserInputIds + { + 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, + + 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, + }; + +} + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/platform/src/SamplePlatform.cpp b/PhysX_3.4/Samples/SampleFramework/platform/src/SamplePlatform.cpp new file mode 100644 index 00000000..982bedb3 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/platform/src/SamplePlatform.cpp @@ -0,0 +1,316 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#include <PsString.h> +#include <SamplePlatform.h> + +using namespace SampleFramework; +using namespace physx; + +SamplePlatform* SamplePlatform::m_platform = NULL; + +SamplePlatform* SamplePlatform::platform() +{ + RENDERER_ASSERT(SamplePlatform::m_platform, "SamplePlatform was not initialized!"); + if(SamplePlatform::m_platform) + { + return SamplePlatform::m_platform; + } + return NULL; +} + +SampleApplication* SamplePlatform::application() +{ + return m_sf_app; +} + +bool SamplePlatform::preOpenWindow(void * ptr) +{ + return true; +} + +void SamplePlatform::showCursor(bool) +{ +} + +void SamplePlatform::setPlatform(SamplePlatform* ptr) +{ + SamplePlatform::m_platform = ptr; +} + +void* SamplePlatform::initializeD3D9() +{ + return NULL; +} + +bool SamplePlatform::isD3D9ok() +{ + return true; +} + +void* SamplePlatform::initializeD3D11() +{ + return NULL; +} + +bool SamplePlatform::isD3D11ok() +{ + return true; +} + +void* SamplePlatform::compileProgram(void * context, + const char* assetDir, + const char *programPath, + physx::PxU64 profile, + const char* passString, + const char *entry, + const char **args) + +{ + return NULL; +} + +SamplePlatform::SamplePlatform(SampleRenderer::RendererWindow* _app) : m_app(_app) +{ +} + +SamplePlatform::~SamplePlatform() +{ +} + +bool SamplePlatform::hasFocus() const +{ + return true; +} + +void SamplePlatform::setFocus(bool b) +{ +} + +void SamplePlatform::update() +{ +} + +void SamplePlatform::setWindowSize(physx::PxU32 width, + physx::PxU32 height) +{ +} + +void SamplePlatform::getTitle(char *title, PxU32 maxLength) const +{ +} + +void SamplePlatform::setTitle(const char *title) +{ +} + +bool SamplePlatform::openWindow(physx::PxU32& width, + physx::PxU32& height, + const char* title, + bool fullscreen) +{ + return true; +} + + +bool SamplePlatform::useWindow(physx::PxU64 hwnd) +{ + return false; +} + + +bool SamplePlatform::isOpen() +{ + return true; +} + +bool SamplePlatform::closeWindow() +{ + return true; +} + +bool SamplePlatform::updateWindow() +{ + return true; +} + +size_t SamplePlatform::getCWD(char* path, size_t len) +{ + RENDERER_ASSERT(path && len, "buffer should not be empty!"); + *path = '\0'; + return 0; +} +void SamplePlatform::setCWDToEXE(void) +{ +} + +void SamplePlatform::popPathSpec(char *path) +{ + char *ls = 0; + while(*path) + { + if(*path == '\\' || *path == '/') ls = path; + path++; + } + if(ls) *ls = 0; +} + +void SamplePlatform::preRendererSetup() +{ +} + +void SamplePlatform::postRendererSetup(SampleRenderer::Renderer* renderer) +{ + getSampleUserInput()->setRenderer(renderer); +} + +void SamplePlatform::setupRendererDescription(SampleRenderer::RendererDesc& renDesc) +{ + renDesc.driver = SampleRenderer::Renderer::DRIVER_OPENGL; +} + +void SamplePlatform::doInput() +{ +} + +void SamplePlatform::postRendererRelease() +{ +} + +void SamplePlatform::initializeOGLDisplay(const SampleRenderer::RendererDesc& desc, + physx::PxU32& width, + physx::PxU32& height) +{ +} + +void SamplePlatform::showMessage(const char* title, const char* message) +{ + shdfnd::printFormatted("%s: %s\n", title, message); +} + +bool SamplePlatform::saveBitmap(const char*, physx::PxU32, physx::PxU32, physx::PxU32, const void*) +{ + return false; +} + +void SamplePlatform::initializeCGRuntimeCompiler() +{ +} + +void SamplePlatform::getWindowSize(PxU32& width, PxU32& height) +{ +} + +void SamplePlatform::freeDisplay() +{ +} + +bool SamplePlatform::makeContextCurrent() +{ + return true; +} + +void SamplePlatform::swapBuffers() +{ +} + +bool SamplePlatform::isContextValid() +{ + return true; +} + +void SamplePlatform::postInitializeOGLDisplay() +{ +} + +void SamplePlatform::setOGLVsync(bool on) +{ +} + +physx::PxU32 SamplePlatform::initializeD3D9Display(void * presentParameters, + char* m_deviceName, + physx::PxU32& width, + physx::PxU32& height, + void * m_d3dDevice_out) +{ + return 0; +} + +physx::PxU32 SamplePlatform::initializeD3D11Display(void *dxgiSwapChainDesc, + char *m_deviceName, + physx::PxU32& width, + physx::PxU32& height, + void *m_d3dDevice_out, + void *m_d3dDeviceContext_out, + void *m_dxgiSwap_out) +{ + return 0; +} + +physx::PxU64 SamplePlatform::getWindowHandle() +{ + return 0; +} + +physx::PxU32 SamplePlatform::D3D9Present() +{ + return 0; +} + + +physx::PxU32 SamplePlatform::D3D11Present(bool vsync) +{ + return 0; +} + +void SamplePlatform::D3D9BlockUntilNotBusy(void * resource) +{ +} + +void SamplePlatform::D3D9DeviceBlockUntilIdle() +{ +} + +physx::PxU64 SamplePlatform::getD3D9TextureFormat(SampleRenderer::RendererTexture2D::Format format) +{ + return 0; +} + +const char* SamplePlatform::getPathSeparator() +{ + return "\\"; +} + +bool SamplePlatform::makeSureDirectoryPathExists(const char*) +{ + return false; +} +physx::PxU64 SamplePlatform::getD3D11TextureFormat(SampleRenderer::RendererTexture2D::Format format) +{ + return 0; +} + diff --git a/PhysX_3.4/Samples/SampleFramework/platform/src/SampleUserInput.cpp b/PhysX_3.4/Samples/SampleFramework/platform/src/SampleUserInput.cpp new file mode 100644 index 00000000..4c47b1ec --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/platform/src/SampleUserInput.cpp @@ -0,0 +1,344 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#include <SampleUserInput.h> +#include <SamplePlatform.h> + +#if defined(RENDERER_LINUX) || defined(RENDERER_PS4) +#include <stdio.h> +#endif + +using namespace SampleFramework; +namespace Ps = physx::shdfnd; + +// this will prepare the input events vector, its not resize-able +static const size_t NUM_INPUT_EVENTS = 256; + +SampleUserInput::SampleUserInput() + : mListener(NULL) +{ + + mUserInputs.reserve(128); + mInputEvents.reserve(NUM_INPUT_EVENTS); + mInputEventNames.reserve(NUM_INPUT_EVENTS); +} + +SampleUserInput::~SampleUserInput() +{ + + mUserInputs.clear(); +} + +void SampleUserInput::registerUserInput(physx::PxU16 id,const char* idName ,const char* name) +{ + UserInput ui; + ui.m_Id = id; + strcpy(ui.m_Name , name); + strcpy(ui.m_IdName, idName); + + mUserInputs.push_back(ui); +} + +const InputEvent* SampleUserInput::registerInputEvent(const InputEvent& inputEvent, physx::PxU16 userInputId, const char* name) +{ + size_t ieId = 0; + const InputEvent* retIe = NULL; + std::map<physx::PxU16, std::vector<size_t> >::iterator fit = mInputEventUserInputMap.find(inputEvent.m_Id); + if(fit != mInputEventUserInputMap.end()) + { + for (size_t i = mInputEvents.size(); i--;) + { + if(mInputEvents[i].m_Id == inputEvent.m_Id) + { + // the analog has a priority + if(inputEvent.m_Analog == true) + { + mInputEvents[i].m_Analog = true; + } + ieId = i; + break; + } + } + } + else + { + ieId = mInputEvents.size(); + if(ieId == NUM_INPUT_EVENTS - 1) + { + // increase the num input events please + PX_ASSERT(0); + return NULL; + } + else + { + mInputEvents.push_back(inputEvent); + mInputEventNames.resize(mInputEventNames.size()+1); + Ps::strlcpy(mInputEventNames.back().m_Name, sizeof(mInputEventNames.back().m_Name), name); + retIe = &mInputEvents[ieId]; + PX_ASSERT(mInputEventNames.size() == mInputEvents.size()); + } + } + + bool found = false; + size_t uiId = 0; + for (size_t i = mUserInputs.size(); i--; ) + { + const UserInput& ui = mUserInputs[i]; + if(ui.m_Id == userInputId) + { + uiId = i; + found = true; + break; + } + } + + if(found) + { + mInputEventUserInputMap[inputEvent.m_Id].push_back(uiId); + mUserInputInputEventMap[userInputId].push_back(ieId); + //if(mUserInputInputEventMap[userInputId].size() > 1) + //{ + // char msg[256]; + // sprintf(msg,"Key %s used multiple times",mUserInputs[uiId].m_Name); + // SampleFramework::SamplePlatform::platform()->showMessage("SampleUserInput warning: ",msg); + //} + } + + return retIe; +} + +void SampleUserInput::registerInputEvent(const SampleInputMapping& mapping) +{ + std::map<physx::PxU16, std::vector<size_t> >::iterator fit = mInputEventUserInputMap.find(mapping.m_InputEventId); + if(fit != mInputEventUserInputMap.end()) + { + std::vector<size_t>& userInputVector = fit->second; + bool found = false; + + for (size_t i = userInputVector.size(); i--;) + { + if(userInputVector[i] == mapping.m_UserInputIndex) + { + found = true; + } + } + + if(!found) + { + userInputVector.push_back(mapping.m_UserInputIndex); + } + } + else + { + mInputEventUserInputMap[mapping.m_InputEventId].push_back(mapping.m_UserInputIndex); + } + + fit = mUserInputInputEventMap.find(mapping.m_UserInputId); + if(fit != mUserInputInputEventMap.end()) + { + std::vector<size_t>& inputEventVector = fit->second; + bool found = false; + + for (size_t i = inputEventVector.size(); i--;) + { + if(inputEventVector[i] == mapping.m_InputEventIndex) + { + found = true; + } + } + + if(!found) + { + inputEventVector.push_back(mapping.m_InputEventIndex); + } + } + else + { + mUserInputInputEventMap[mapping.m_UserInputId].push_back(mapping.m_InputEventIndex); + } +} + +void SampleUserInput::unregisterInputEvent(physx::PxU16 inputEventId) +{ + std::map<physx::PxU16, std::vector<size_t> >::iterator fit = mInputEventUserInputMap.find(inputEventId); + if(fit != mInputEventUserInputMap.end()) + { + const std::vector<size_t>& userInputs = fit->second; + for (size_t j = userInputs.size(); j--;) + { + const UserInput& ui = mUserInputs[userInputs[j]]; + std::map<physx::PxU16, std::vector<size_t> >::iterator uifit = mUserInputInputEventMap.find(ui.m_Id); + if(uifit != mUserInputInputEventMap.end()) + { + std::vector<size_t>& inputEvents = uifit->second; + for (size_t u = inputEvents.size(); u--;) + { + if(mInputEvents[inputEvents[u]].m_Id == inputEventId) + { + inputEvents[u] = inputEvents.back(); + inputEvents.pop_back(); + } + } + } + } + + mInputEventUserInputMap.erase(fit); + } +} + +void SampleUserInput::updateInput() +{ + +} + +void SampleUserInput::processGamepads() +{ +} + +const InputEvent* SampleUserInput::getInputEventSlow(physx::PxU16 inputEventId) const +{ + for (size_t i = mInputEvents.size(); i--;) + { + if(mInputEvents[i].m_Id == inputEventId) + { + return &mInputEvents[i]; + } + } + + return NULL; +} + +const std::vector<size_t>* SampleUserInput::getUserInputs(physx::PxI32 inputEventId) const +{ + if(inputEventId < 0) + return NULL; + + std::map<physx::PxU16, std::vector<size_t> >::const_iterator fit = mInputEventUserInputMap.find((physx::PxU16)inputEventId); + if(fit != mInputEventUserInputMap.end()) + { + return &fit->second; + } + else + { + return NULL; + } +} + +const std::vector<size_t>* SampleUserInput::getInputEvents(physx::PxU16 userInputId) const +{ + std::map<physx::PxU16, std::vector<size_t> >::const_iterator fit = mUserInputInputEventMap.find(userInputId); + if(fit != mUserInputInputEventMap.end()) + { + return &fit->second; + } + else + { + return NULL; + } +} + +physx::PxI32 SampleUserInput::translateInputEventNameToId(const char* name, size_t& index) const +{ + PX_ASSERT(mInputEvents.size() == mInputEventNames.size()); + for (size_t i = mInputEventNames.size(); i--;) + { + if(!strcmp(mInputEventNames[i].m_Name, name)) + { + index = i; + return mInputEvents[i].m_Id; + } + } + return -1; +} + +const char* SampleUserInput::translateInputEventIdToName(physx::PxI32 id) const +{ + PX_ASSERT(mInputEvents.size() == mInputEventNames.size()); + for (size_t i = mInputEvents.size(); i--;) + { + if(mInputEvents[i].m_Id == id) + { + return mInputEventNames[i].m_Name; + } + } + return NULL; +} + +physx::PxI32 SampleUserInput::translateUserInputNameToId(const char* name, size_t& index) const +{ + for (size_t i = mUserInputs.size(); i--;) + { + if(!strcmp(mUserInputs[i].m_IdName, name)) + { + index = i; + return mUserInputs[i].m_Id; + } + } + return -1; +} + +void SampleUserInput::shutdown() +{ + mInputEvents.clear(); + mInputEventNames.clear(); + + mUserInputInputEventMap.clear(); + mInputEventUserInputMap.clear(); +} + +physx::PxU16 SampleUserInput::getUserInputKeys(physx::PxU16 inputEventId, const char* names[], physx::PxU16 maxNames, physx::PxU32 inputTypeMask) const +{ + physx::PxU16 retVal = 0; + + const std::vector<size_t>* uis = getUserInputs(inputEventId); + if(uis) + { + for (size_t i = uis->size(); i--;) + { + if(retVal < maxNames) + { + const UserInput& ie = mUserInputs[(*uis)[i]]; + InputType it = getInputType(ie); + if(it) + { + if(it & inputTypeMask) + { + names[retVal] = ie.m_Name; + retVal++; + } + } + else + { + names[retVal] = ie.m_Name; + retVal++; + } + } + } + } + + return retVal; +} diff --git a/PhysX_3.4/Samples/SampleFramework/platform/src/windows/WindowsSamplePlatform.cpp b/PhysX_3.4/Samples/SampleFramework/platform/src/windows/WindowsSamplePlatform.cpp new file mode 100644 index 00000000..7140be2b --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/platform/src/windows/WindowsSamplePlatform.cpp @@ -0,0 +1,1180 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#include <RendererMemoryMacros.h> +#include <windows/WindowsSamplePlatform.h> + +#if defined(RENDERER_ENABLE_CG) +#include <cg/cg.h> +#endif + +#include <direct.h> +#include <stdio.h> + +#include <PsString.h> +#include <PxTkFile.h> +#include <PsUtilities.h> + +#if defined(RENDERER_ENABLE_DIRECT3D9) + #include <d3d9.h> + #include <d3dx9.h> + #include <XInput.h> +#endif + +#if defined(RENDERER_ENABLE_DIRECT3D11) +#pragma warning(push) +// Disable macro redefinition warnings +#pragma warning(disable: 4005) + #include <d3d11.h> +#pragma warning(pop) +#endif + +#if defined(RENDERER_ENABLE_OPENGL) + #define GLEW_STATIC + #include <GL/glew.h> + #include <GL/wglew.h> + + #pragma comment(lib, "OpenGL32.lib") + #pragma comment(lib, "GLU32.lib") +#endif + +using std::min; +using std::max; +#pragma warning(push) +#pragma warning(disable : 4244) +#include <atlimage.h> +#include <Gdiplusimaging.h> +#pragma warning(pop) + +using namespace SampleFramework; +using SampleRenderer::RendererWindow; +using namespace physx; + +static void setDCPixelFormat(HDC &dc) +{ + const PIXELFORMATDESCRIPTOR pfd = + { + sizeof(PIXELFORMATDESCRIPTOR), + 1, + PFD_DRAW_TO_WINDOW | + PFD_SUPPORT_OPENGL | + PFD_DOUBLEBUFFER, + PFD_TYPE_RGBA, + 32, + 8, 0, 8, 0, 8, 0, + 8, + 0, + 0, + 0, 0, 0, 0, + 24, + 8, + 0, + PFD_MAIN_PLANE, + 0, + 0, 0, 0 + }; + int pfindex = ChoosePixelFormat(dc, &pfd); + SetPixelFormat(dc, pfindex, &pfd); +} + +static const char *g_windowClassName = "RendererWindow"; +static const DWORD g_windowStyle = WS_OVERLAPPEDWINDOW; +static const DWORD g_fullscreenStyle = WS_POPUP; + +static void handleMouseEvent(UINT msg, LPARAM lParam, HWND hwnd, RendererWindow* window) +{ + if (!window || !window->getPlatform()) + return; + + RECT rect; + GetClientRect(hwnd, &rect); + PxU32 height = (PxU32)(rect.bottom-rect.top); + PxU32 x = (PxU32)LOWORD(lParam); + PxU32 y = height-(PxU32)HIWORD(lParam); + PxVec2 current(static_cast<PxReal>(x), static_cast<PxReal>(y)); + + WindowsPlatform& platform = *((WindowsPlatform*)window->getPlatform()); + PxVec2 diff = current - platform.getMouseCursorPos(); + platform.setMouseCursorPos(current); + + switch (msg) + { + case WM_MOUSEMOVE: + if (!SamplePlatform::platform()->getMouseCursorRecentering()) + { + platform.getWindowsSampleUserInput().doOnMouseMove(x, y, diff.x, diff.y, MOUSE_MOVE); + } + break; + case WM_LBUTTONDOWN: + SetCapture(hwnd); + platform.getWindowsSampleUserInput().doOnMouseButton(x, y, WindowsSampleUserInput::LEFT_MOUSE_BUTTON, true); + break; + case WM_LBUTTONUP: + ReleaseCapture(); + platform.getWindowsSampleUserInput().doOnMouseButton(x, y, WindowsSampleUserInput::LEFT_MOUSE_BUTTON, false); + break; + case WM_RBUTTONDOWN: + SetCapture(hwnd); + platform.getWindowsSampleUserInput().doOnMouseButton(x, y, WindowsSampleUserInput::RIGHT_MOUSE_BUTTON, true); + break; + case WM_RBUTTONUP: + ReleaseCapture(); + platform.getWindowsSampleUserInput().doOnMouseButton(x, y, WindowsSampleUserInput::RIGHT_MOUSE_BUTTON, false); + break; + case WM_MBUTTONDOWN: + SetCapture(hwnd); + platform.getWindowsSampleUserInput().doOnMouseButton(x, y, WindowsSampleUserInput::CENTER_MOUSE_BUTTON, true); + break; + case WM_MBUTTONUP: + ReleaseCapture(); + platform.getWindowsSampleUserInput().doOnMouseButton(x, y, WindowsSampleUserInput::CENTER_MOUSE_BUTTON, false); + break; + } +} + +static INT_PTR CALLBACK windowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ +#if defined(RENDERER_64BIT) + RendererWindow* window = (RendererWindow*)GetWindowLongPtr(hwnd, GWLP_USERDATA); +#else + RendererWindow* window = (RendererWindow*)LongToPtr(GetWindowLongPtr(hwnd, GWLP_USERDATA)); +#endif + + bool customHandle = false; + + if(!customHandle) + { + switch(msg) + { + case WM_SETFOCUS: + if(window) + window->setFocus(true); + break; + + case WM_KILLFOCUS: + if(window) + window->setFocus(false); + break; + + case WM_EXITSIZEMOVE: + if (window) + { + ((WindowsPlatform*)window->getPlatform())->recenterMouseCursor(false); + } + break; + + case WM_CREATE: + ::UpdateWindow(hwnd); + break; + + case WM_CLOSE: + if(window) + { + window->close(); + } + break; + + case WM_SIZE: + if(window) + { + RECT rect; + GetClientRect(hwnd, &rect); + PxU32 width = (PxU32)(rect.right-rect.left); + PxU32 height = (PxU32)(rect.bottom-rect.top); + window->onResize(width, height); + } + break; + + case WM_MOUSEMOVE: + handleMouseEvent(WM_MOUSEMOVE, lParam, hwnd, window); + break; + + case WM_LBUTTONDOWN: + ((WindowsPlatform*)window->getPlatform())->recenterMouseCursor(false); + handleMouseEvent(WM_LBUTTONDOWN, lParam, hwnd, window); + break; + + case WM_LBUTTONUP: + handleMouseEvent(WM_LBUTTONUP, lParam, hwnd, window); + break; + + case WM_RBUTTONDOWN: + handleMouseEvent(WM_RBUTTONDOWN, lParam, hwnd, window); + break; + + case WM_RBUTTONUP: + handleMouseEvent(WM_RBUTTONUP, lParam, hwnd, window); + break; + + case WM_MBUTTONDOWN: + handleMouseEvent(WM_MBUTTONDOWN, lParam, hwnd, window); + break; + + case WM_MBUTTONUP: + handleMouseEvent(WM_MBUTTONUP, lParam, hwnd, window); + break; + + case WM_CHAR: + // PT: we need to catch this message to make a difference between lower & upper case characters + if(window) + { + ((WindowsPlatform*)window->getPlatform())->getWindowsSampleUserInput().onKeyDownEx(wParam); + } + break; + + case WM_SYSKEYDOWN: // For F10 or ALT + if (VK_F4 == wParam && (KF_ALTDOWN & HIWORD(lParam))) + { + if(window) + { + window->close(); + break; + } + } + // no break, fall through + case WM_KEYDOWN: + if(window) + { + ((WindowsPlatform*)window->getPlatform())->getWindowsSampleUserInput().onKeyDown(wParam, lParam); + } + break; + + case WM_SYSKEYUP: + case WM_KEYUP: + if(window) + { + ((WindowsPlatform*)window->getPlatform())->getWindowsSampleUserInput().onKeyUp(wParam, lParam); + } + break; + + case WM_PAINT: + ValidateRect(hwnd, 0); + break; + default: + return ::DefWindowProc(hwnd, msg, wParam, lParam); + } + } + return 0; +} + +static ATOM registerWindowClass(HINSTANCE hInstance) +{ + static ATOM atom = 0; + if(!atom) + { + WNDCLASSEX wcex; + wcex.cbSize = sizeof(WNDCLASSEX); + wcex.style = CS_HREDRAW | CS_VREDRAW; + wcex.lpfnWndProc = (WNDPROC)windowProc; + wcex.cbClsExtra = 0; + wcex.cbWndExtra = sizeof(void*); + wcex.hInstance = hInstance; + wcex.hIcon = ::LoadIcon(hInstance, "SampleApplicationIcon"); + wcex.hCursor = ::LoadCursor(NULL, IDC_ARROW); + wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); + wcex.lpszMenuName = 0; + wcex.lpszClassName = g_windowClassName; + wcex.hIconSm = ::LoadIcon(wcex.hInstance, "SampleApplicationIcon"); + atom = ::RegisterClassEx(&wcex); + } + return atom; +} + +SamplePlatform* SampleFramework::createPlatform(SampleRenderer::RendererWindow* _app) +{ + printf("Creating Windows platform abstraction.\n"); + SamplePlatform::setPlatform(new WindowsPlatform(_app)); + return SamplePlatform::platform(); +} + +void* WindowsPlatform::initializeD3D9() +{ + m_library = 0; + if(m_hwnd) + { +#if defined(D3D_DEBUG_INFO) +#define D3D9_DLL "d3d9d.dll" +#else +#define D3D9_DLL "d3d9.dll" +#endif + m_library = LoadLibraryA(D3D9_DLL); + RENDERER_ASSERT(m_library, "Could not load " D3D9_DLL "."); + if(!m_library) + { + MessageBoxA(0, "Could not load " D3D9_DLL ". Please install the latest DirectX End User Runtime available at www.microsoft.com/directx.", "Renderer Error.", MB_OK); + } +#undef D3D9_DLL + if(m_library) + { + typedef IDirect3D9* (WINAPI* LPDIRECT3DCREATE9)(UINT SDKVersion); + LPDIRECT3DCREATE9 pDirect3DCreate9 = (LPDIRECT3DCREATE9)GetProcAddress(m_library, "Direct3DCreate9"); + RENDERER_ASSERT(pDirect3DCreate9, "Could not find Direct3DCreate9 function."); + if(pDirect3DCreate9) + { + m_d3d = pDirect3DCreate9(D3D_SDK_VERSION); + } + } + } + return m_d3d; +} + +void WindowsPlatform::showCursor(bool show) +{ + if(show != m_showCursor) + { + m_showCursor = show; + PxI32 count = ShowCursor(show); + PX_ASSERT((m_showCursor && (count == 0)) || (!m_showCursor && (count == -1))); + PX_UNUSED(count); + } +} + +void* WindowsPlatform::compileProgram(void * context, + const char* assetDir, + const char *programPath, + physx::PxU64 profile, + const char* passString, + const char *entry, + const char **args) + +{ +#if defined(RENDERER_ENABLE_CG) + char fullpath[1024]; + Ps::strlcpy(fullpath, 1024, assetDir); + Ps::strlcat(fullpath, 1024, "shaders/"); + Ps::strlcat(fullpath, 1024, programPath); + CGprogram program = cgCreateProgramFromFile(static_cast<CGcontext>(context), CG_SOURCE, fullpath, static_cast<CGprofile>(profile), entry, args); + + if (!program) + { + static bool ignoreErrors = false; + if (!ignoreErrors) + { + const char* compileError = cgGetLastListing(static_cast<CGcontext>(context)); + int ret = MessageBoxA(0, compileError, "CG cgCreateProgramFromFile Error", MB_ABORTRETRYIGNORE); + + if (ret == IDABORT) + { + exit(0); + } + else if (ret == IDIGNORE) + { + ignoreErrors = true; + } + else + { + DebugBreak(); + } + } + } + + return program; +#else + return NULL; +#endif +} + +WindowsPlatform::WindowsPlatform(SampleRenderer::RendererWindow* _app) : +SamplePlatform(_app), +m_d3d(NULL), +m_d3dDevice(NULL), +m_dxgiFactory(NULL), +m_dxgiSwap(NULL), +m_d3d11Device(NULL), +m_d3d11DeviceContext(NULL), +m_hwnd(0), +m_hdc(0), +m_hrc(0), +m_library(NULL), +m_dxgiLibrary(NULL), +m_d3d11Library(NULL), +m_ownsWindow(false), +m_isHandlingMessages(false), +m_destroyWindow(false), +m_hasFocus(true), +m_vsync(false) +{ + m_library = 0; + + // adjust ShowCursor display counter to be 0 or -1 + m_showCursor = true; + PxI32 count = ShowCursor(true); + while(count != 0) + count = ShowCursor(count < 0); + strcpy(m_platformName, "windows"); + + m_mouseCursorPos = PxVec2(0); + m_recenterMouseCursor = false; +} + +WindowsPlatform::~WindowsPlatform() +{ + RENDERER_ASSERT(!m_ownsWindow || m_hwnd==0, "RendererWindow was not closed before being destroyed."); + if(m_d3d) + { + m_d3d->Release(); + } + if(m_library) + { + FreeLibrary(m_library); + m_library = 0; + } + if(m_dxgiLibrary) + { + FreeLibrary(m_dxgiLibrary); + m_dxgiLibrary = 0; + } + if(m_d3d11Library) + { + FreeLibrary(m_d3d11Library); + m_d3d11Library = 0; + } +} + +bool WindowsPlatform::isD3D9ok() +{ + if(m_library) + { + return true; + } + return false; +} + +bool WindowsPlatform::hasFocus() const +{ + return m_hasFocus; +} + +void WindowsPlatform::setFocus(bool b) +{ + m_hasFocus = b; +} + +bool WindowsPlatform::isOpen() +{ + if(m_hwnd && !m_destroyWindow) return true; + return false; +} + +void WindowsPlatform::getTitle(char *title, physx::PxU32 maxLength) const +{ + RENDERER_ASSERT(m_hwnd, "Tried to get the title of a window that was not opened."); + if(m_hwnd) + { + GetWindowTextA(m_hwnd, title, maxLength); + } +} + +void WindowsPlatform::setTitle(const char *title) +{ + RENDERER_ASSERT(m_hwnd, "Tried to set the title of a window that was not opened."); + if(m_hwnd) + { + ::SetWindowTextA(m_hwnd, title); + } +} + +void WindowsPlatform::showMessage(const char* title, const char* message) +{ + printf("%s: %s\n", title, message); +} + +bool WindowsPlatform::saveBitmap(const char* pFileName, physx::PxU32 width, physx::PxU32 height, physx::PxU32 sizeInBytes, const void* pData) +{ + bool bSuccess = false; + HBITMAP bitmap = CreateBitmap(width, height, 1, 32, pData); + if (bitmap) + { + CImage image; + image.Attach(bitmap, CImage::DIBOR_TOPDOWN); + bSuccess = SUCCEEDED(image.Save(pFileName, Gdiplus::ImageFormatBMP)); + DeleteObject(bitmap); + } + return bSuccess; +} + +void WindowsPlatform::setMouseCursorRecentering(bool val) +{ + if (m_recenterMouseCursor != val) + { + m_recenterMouseCursor = val; + if (m_recenterMouseCursor) + recenterMouseCursor(false); + } +} + +bool WindowsPlatform::getMouseCursorRecentering() const +{ + return m_recenterMouseCursor; +} + +void WindowsPlatform::recenterMouseCursor(bool generateEvent) +{ + if (m_recenterMouseCursor && m_app->hasFocus()) + { + RECT rect; + GetWindowRect(m_hwnd, (LPRECT)&rect); + PxU32 winHeight = (PxU32)(rect.bottom-rect.top); + PxU32 winWidth = (PxU32)(rect.right - rect.left); + + POINT winPos; + GetCursorPos(&winPos); + PxVec2 current(static_cast<PxReal>(winPos.x), winHeight - static_cast<PxReal>(winPos.y)); + + PxI32 winCenterX = 0; + PxI32 winCenterY = 0; + { + winCenterX = rect.left + PxI32(winWidth>>1); + winCenterY = rect.top + PxI32(winHeight>>1); + } + SetCursorPos(winCenterX, winCenterY); + + if (generateEvent) + { + PxVec2 diff = current - PxVec2(static_cast<PxReal>(winCenterX), winHeight - static_cast<PxReal>(winCenterY)); + getWindowsSampleUserInput().doOnMouseMove(winCenterX, winHeight - winCenterY, diff.x, diff.y, MOUSE_MOVE); + } + + m_mouseCursorPos = current; + } +} + +void WindowsPlatform::setWindowSize(physx::PxU32 width, + physx::PxU32 height) +{ + bool fullscreen = false; + RENDERER_ASSERT(m_hwnd, "Tried to resize a window that was not opened."); + if(m_hwnd) + { + RECT rect; + ::GetWindowRect(m_hwnd, &rect); + rect.right = (LONG)(rect.left + width); + rect.bottom = (LONG)(rect.top + height); + RECT oldrect = rect; + DWORD dwstyle = (fullscreen ? g_fullscreenStyle : g_windowStyle); + ::AdjustWindowRect(&rect, dwstyle, 0); + ::MoveWindow(m_hwnd, (int)oldrect.left, (int)oldrect.top, (int)(rect.right-rect.left), (int)(rect.bottom-rect.top), 1); + } +} + +void WindowsPlatform::update() +{ + RENDERER_ASSERT(m_hwnd, "Tried to update a window that was not opened."); + if(m_app->isOpen()) + { + m_isHandlingMessages = true; + MSG msg; + + while(m_app->isOpen() && ::PeekMessage(&msg, 0, 0, 0, PM_REMOVE)) + { + ::TranslateMessage(&msg); + ::DispatchMessage(&msg); + } + m_isHandlingMessages = false; + if(m_hwnd && m_destroyWindow) + { + if(m_app->onClose()) + { + ::DestroyWindow(m_hwnd); + m_hwnd = 0; + } + m_destroyWindow = false; + } + recenterMouseCursor(true); + } +} + +bool WindowsPlatform::openWindow(physx::PxU32& width, + physx::PxU32& height, + const char* title, + bool fullscreen) +{ + bool ok = false; + RENDERER_ASSERT(m_hwnd==0, "Attempting to open a window that is already opened"); + if(m_hwnd==0) + { + int offset = fullscreen ? 0 : 50; + + registerWindowClass((HINSTANCE)::GetModuleHandle(0)); + RECT winRect; + winRect.left = offset; + winRect.top = offset; + winRect.right = width + offset; + winRect.bottom = height + offset; + DWORD dwstyle = (fullscreen ? g_fullscreenStyle : g_windowStyle); + + ::AdjustWindowRect(&winRect, dwstyle, 0); + + // make sure the window fits in the main screen + if (!fullscreen) + { + // check the work area of the primary display + RECT screen; + SystemParametersInfo(SPI_GETWORKAREA, 0, &screen, 0); + + if (winRect.right > screen.right) + { + int diff = winRect.right - screen.right; + winRect.right -= diff; + winRect.left = std::max<int>(0, winRect.left - diff); + } + + if (winRect.bottom > screen.bottom) + { + int diff = winRect.bottom - screen.bottom; + winRect.bottom -= diff; + winRect.top = std::max<int>(0, winRect.top - diff); + } + } + + m_hwnd = ::CreateWindowA(g_windowClassName, title, dwstyle, + winRect.left, winRect.top, + winRect.right - winRect.left, winRect.bottom - winRect.top, + 0, 0, 0, 0); + RENDERER_ASSERT(m_hwnd, "CreateWindow failed"); + if(m_hwnd) + { + ok = true; + m_ownsWindow = true; + ShowWindow(m_hwnd, SW_SHOWNORMAL); + SetFocus(m_hwnd); + SetWindowLongPtr(m_hwnd, GWLP_USERDATA, LONG_PTR(m_app)); + } + } + + { + RAWINPUTDEVICE rawInputDevice; + rawInputDevice.usUsagePage = 1; + rawInputDevice.usUsage = 6; + rawInputDevice.dwFlags = 0; + rawInputDevice.hwndTarget = NULL; + + BOOL status = RegisterRawInputDevices(&rawInputDevice, 1, sizeof(rawInputDevice)); + if(status!=TRUE) + { + DWORD err = GetLastError(); + printf("%d\n", err); + } + } + + return ok; +} + +bool WindowsPlatform::useWindow(physx::PxU64 hwnd) +{ + m_hwnd = reinterpret_cast<HWND>(hwnd); + return true; +} + +bool WindowsPlatform::closeWindow() +{ + if(m_hwnd) + { + if(m_isHandlingMessages) + { + m_destroyWindow = true; + } + else if(m_app->onClose()) + { + ::DestroyWindow(m_hwnd); + m_hwnd = 0; + } + } + + return true; +} + +size_t WindowsPlatform::getCWD(char* path, size_t len) +{ + return ::GetCurrentDirectory((DWORD)len, path); +} +void WindowsPlatform::setCWDToEXE(void) +{ + char exepath[1024] = {0}; + GetModuleFileNameA(0, exepath, sizeof(exepath)); + + if(exepath[0]) + { + popPathSpec(exepath); + (void)_chdir(exepath); + } +} + +void WindowsPlatform::setupRendererDescription(SampleRenderer::RendererDesc& renDesc) +{ + renDesc.driver = SampleRenderer::Renderer::DRIVER_DIRECT3D11; + renDesc.windowHandle = reinterpret_cast<physx::PxU64>(m_hwnd); +} + +void WindowsPlatform::postRendererSetup(SampleRenderer::Renderer* renderer) +{ + if(!renderer) + { + // quit if no renderer was created. Nothing else to do. + // error was output in createRenderer. + exit(1); + } + char windowTitle[1024] = {0}; + m_app->getTitle(windowTitle, 1024); + strcat_s(windowTitle, 1024, " : "); + strcat_s(windowTitle, 1024, SampleRenderer::Renderer::getDriverTypeName( + renderer->getDriverType())); + m_app->setTitle(windowTitle); +} + +void WindowsPlatform::doInput() +{ + m_windowsSampleUserInput.updateInput(); +} + +void WindowsPlatform::initializeOGLDisplay(const SampleRenderer::RendererDesc& desc, + physx::PxU32& width, + physx::PxU32& height) +{ +#if defined(RENDERER_ENABLE_OPENGL) + m_hwnd = reinterpret_cast<HWND>(desc.windowHandle); + + RENDERER_ASSERT(m_hwnd, "Invalid window handle!"); + // Get the device context. + m_hdc = GetDC(m_hwnd); + + RENDERER_ASSERT(m_hdc, "Invalid device context!"); + if(m_hdc) + { + setDCPixelFormat(m_hdc); + m_hrc = wglCreateContext(m_hdc); + } + + RENDERER_ASSERT(m_hrc, "Invalid render context!"); + if(m_hrc) + { + BOOL makeCurrentRet = wglMakeCurrent(m_hdc, m_hrc); + RENDERER_ASSERT(m_hrc, "Unable to set current context!"); + if(!makeCurrentRet) + { + wglDeleteContext(m_hrc); + m_hrc = 0; + } + } +#endif + + m_vsync = desc.vsync; +} + +physx::PxU64 WindowsPlatform::getWindowHandle() +{ + return reinterpret_cast<physx::PxU64>(m_hwnd); +} + +void WindowsPlatform::getWindowSize(PxU32& width, PxU32& height) +{ + if(m_hwnd) + { + RECT rect; + GetClientRect(m_hwnd, &rect); + width = (PxU32)(rect.right - rect.left); + height = (PxU32)(rect.bottom - rect.top); + } +} + +void WindowsPlatform::freeDisplay() +{ +#if defined(RENDERER_ENABLE_OPENGL) + if(m_hrc) + { + wglMakeCurrent(m_hdc, 0); + wglDeleteContext(m_hrc); + m_hrc = 0; + } +#endif +} + +bool WindowsPlatform::makeContextCurrent() +{ + bool ok = false; + +#if defined(RENDERER_ENABLE_OPENGL) + if(m_hdc && m_hrc) + { + if(wglGetCurrentContext()==m_hrc) + { + ok = true; + } + else + { + ok = wglMakeCurrent(m_hdc, m_hrc) ? true : false; + } + } +#endif + + return ok; +} + +void WindowsPlatform::swapBuffers() +{ + SwapBuffers(m_hdc); +} + +bool WindowsPlatform::isContextValid() +{ + if(!m_hdc) return false; + if(!m_hrc) return false; + return true; +} + +void WindowsPlatform::postInitializeOGLDisplay() +{ +#if defined(RENDERER_ENABLE_OPENGL) + glewInit(); + +#if defined(GLEW_MX) + wglewInit(); +#endif + + if(WGLEW_EXT_swap_control) + { + wglSwapIntervalEXT(m_vsync ? -1 : 0); + } +#endif +} + +void WindowsPlatform::setOGLVsync(bool on) +{ +#if defined(RENDERER_ENABLE_OPENGL) + m_vsync = on; + if(WGLEW_EXT_swap_control) + { + wglSwapIntervalEXT(m_vsync ? 1 : 0); + } +#endif +} + +physx::PxU32 WindowsPlatform::initializeD3D9Display(void * d3dPresentParameters, + char* m_deviceName, + physx::PxU32& width, + physx::PxU32& height, + void * m_d3dDevice_out) +{ + D3DPRESENT_PARAMETERS* m_d3dPresentParams = static_cast<D3DPRESENT_PARAMETERS*>(d3dPresentParameters); + + UINT adapter = D3DADAPTER_DEFAULT; + D3DDEVTYPE deviceType = D3DDEVTYPE_HAL; + + // check to see if fullscreen is requested... + bool fullscreen = false; + WINDOWINFO wininfo = {0}; + if(GetWindowInfo(m_hwnd, &wininfo)) + { + if(wininfo.dwStyle & WS_POPUP) + { + fullscreen = true; + } + } + + // search for supported adapter mode. + if(fullscreen) + { + RECT rect = {0}; + GetWindowRect(m_hwnd, &rect); + m_d3dPresentParams->BackBufferFormat = D3DFMT_X8R8G8B8; + width = (m_d3dPresentParams->BackBufferWidth = rect.right-rect.left); + height = (m_d3dPresentParams->BackBufferHeight = rect.bottom-rect.top); + + bool foundAdapterMode = false; + const UINT numAdapterModes = m_d3d->GetAdapterModeCount(0, m_d3dPresentParams->BackBufferFormat); + for(UINT i=0; i<numAdapterModes; i++) + { + D3DDISPLAYMODE mode = {0}; + m_d3d->EnumAdapterModes(0, m_d3dPresentParams->BackBufferFormat, i, &mode); + if(mode.Width == m_d3dPresentParams->BackBufferWidth && + mode.Height == m_d3dPresentParams->BackBufferHeight && + mode.RefreshRate > m_d3dPresentParams->FullScreen_RefreshRateInHz) + { + m_d3dPresentParams->FullScreen_RefreshRateInHz = mode.RefreshRate; + foundAdapterMode = true; + } + } + RENDERER_ASSERT(foundAdapterMode, "Unable to find supported fullscreen Adapter Mode."); + if(!foundAdapterMode) fullscreen = false; + } + + // enable fullscreen mode. + if(fullscreen) + { + m_d3dPresentParams->Windowed = 0; + } + +#if defined(RENDERER_ENABLE_NVPERFHUD) + // NvPerfHud Support. + UINT numAdapters = m_d3d->GetAdapterCount(); + for(UINT i=0; i<numAdapters; i++) + { + D3DADAPTER_IDENTIFIER9 identifier; + m_d3d->GetAdapterIdentifier(i, 0, &identifier); + if(strstr(identifier.Description, "PerfHUD")) + { + adapter = i; + deviceType = D3DDEVTYPE_REF; + break; + } + } +#endif + + D3DADAPTER_IDENTIFIER9 adapterIdentifier; + m_d3d->GetAdapterIdentifier(adapter, 0, &adapterIdentifier); + strncpy_s(m_deviceName, 256, adapterIdentifier.Description, 256); + + HRESULT res = m_d3d->CreateDevice( adapter, deviceType, + m_hwnd, + D3DCREATE_HARDWARE_VERTEXPROCESSING|D3DCREATE_MULTITHREADED, + m_d3dPresentParams, &m_d3dDevice); + *(static_cast<IDirect3DDevice9**>(m_d3dDevice_out)) = m_d3dDevice; + return res; +} + +physx::PxU32 WindowsPlatform::D3D9Present() +{ + return m_d3dDevice->Present(0, 0, m_hwnd, 0); +} +physx::PxU64 WindowsPlatform::getD3D9TextureFormat(SampleRenderer::RendererTexture2D::Format format) +{ + D3DFORMAT d3dFormat = D3DFMT_UNKNOWN; + switch(format) + { + case SampleRenderer::RendererTexture2D::FORMAT_B8G8R8A8: d3dFormat = D3DFMT_A8R8G8B8; break; + case SampleRenderer::RendererTexture2D::FORMAT_A8: d3dFormat = D3DFMT_A8; break; + case SampleRenderer::RendererTexture2D::FORMAT_R32F: d3dFormat = D3DFMT_R32F; break; + case SampleRenderer::RendererTexture2D::FORMAT_DXT1: d3dFormat = D3DFMT_DXT1; break; + case SampleRenderer::RendererTexture2D::FORMAT_DXT3: d3dFormat = D3DFMT_DXT3; break; + case SampleRenderer::RendererTexture2D::FORMAT_DXT5: d3dFormat = D3DFMT_DXT5; break; + case SampleRenderer::RendererTexture2D::FORMAT_D16: d3dFormat = D3DFMT_D16; break; + case SampleRenderer::RendererTexture2D::FORMAT_D24S8: d3dFormat = D3DFMT_D24S8; break; + } + return static_cast<physx::PxU64>(d3dFormat); +} + +physx::PxU64 WindowsPlatform::getD3D11TextureFormat(SampleRenderer::RendererTexture2D::Format format) +{ +#if defined(RENDERER_ENABLE_DIRECT3D11) + DXGI_FORMAT dxgiFormat = DXGI_FORMAT_UNKNOWN; + switch(format) + { + case SampleRenderer::RendererTexture2D::FORMAT_B8G8R8A8: dxgiFormat = DXGI_FORMAT_B8G8R8A8_UNORM; break; + case SampleRenderer::RendererTexture2D::FORMAT_A8: dxgiFormat = DXGI_FORMAT_A8_UNORM; break; + case SampleRenderer::RendererTexture2D::FORMAT_R32F: dxgiFormat = DXGI_FORMAT_R32_FLOAT; break; + case SampleRenderer::RendererTexture2D::FORMAT_DXT1: dxgiFormat = DXGI_FORMAT_BC1_UNORM; break; + case SampleRenderer::RendererTexture2D::FORMAT_DXT3: dxgiFormat = DXGI_FORMAT_BC2_UNORM; break; + case SampleRenderer::RendererTexture2D::FORMAT_DXT5: dxgiFormat = DXGI_FORMAT_BC3_UNORM; break; + case SampleRenderer::RendererTexture2D::FORMAT_D16: dxgiFormat = DXGI_FORMAT_R16_TYPELESS; break; + } +#else + PxU64 dxgiFormat = 0; +#endif + return static_cast<physx::PxU64>(dxgiFormat); +} + +void* WindowsPlatform::initializeD3D11() +{ + m_dxgiLibrary = 0; + m_d3d11Library = 0; +#if defined(RENDERER_ENABLE_DIRECT3D11) + if(m_hwnd) + { +#if defined(D3D_DEBUG_INFO) +#define D3D11_DLL "d3d11d.dll" +#define DXGI_DLL "dxgid.dll" +#else +#define D3D11_DLL "d3d11.dll" +#define DXGI_DLL "dxgi.dll" +#endif + m_dxgiLibrary = LoadLibraryA(DXGI_DLL); + m_d3d11Library = LoadLibraryA(D3D11_DLL); + RENDERER_ASSERT(m_dxgiLibrary, "Could not load " DXGI_DLL "."); + RENDERER_ASSERT(m_d3d11Library, "Could not load " D3D11_DLL "."); + if(!m_dxgiLibrary) + { + MessageBoxA(0, "Could not load " DXGI_DLL ". Please install the latest DirectX End User Runtime available at www.microsoft.com/directx.", "Renderer Error.", MB_OK); + } + if(!m_d3d11Library) + { + MessageBoxA(0, "Could not load " D3D11_DLL ". Please install the latest DirectX End User Runtime available at www.microsoft.com/directx.", "Renderer Error.", MB_OK); + } +#undef D3D11_DLL +#undef DXGI_DLL + if(m_dxgiLibrary) + { + typedef HRESULT (WINAPI * LPCREATEDXGIFACTORY)(REFIID, void ** ); + LPCREATEDXGIFACTORY pCreateDXGIFactory = (LPCREATEDXGIFACTORY)GetProcAddress(m_dxgiLibrary, "CreateDXGIFactory1"); + RENDERER_ASSERT(pCreateDXGIFactory, "Could not find CreateDXGIFactory1 function."); + if(pCreateDXGIFactory) + { + pCreateDXGIFactory(__uuidof(IDXGIFactory1), (void**)(&m_dxgiFactory)); + } + } + } +#endif + return m_dxgiFactory; +} + + +bool WindowsPlatform::isD3D11ok() +{ + if(m_dxgiLibrary && m_d3d11Library) + { + return true; + } + return false; +} + +physx::PxU32 WindowsPlatform::initializeD3D11Display(void *dxgiSwapChainDesc, + char *m_deviceName, + physx::PxU32& width, + physx::PxU32& height, + void *m_d3dDevice_out, + void *m_d3dDeviceContext_out, + void *m_dxgiSwap_out) +{ + HRESULT hr = S_OK; + +#if defined(RENDERER_ENABLE_DIRECT3D11) + ID3D11Device* pD3D11Device = NULL; + ID3D11DeviceContext* pD3D11DeviceContext = NULL; + IDXGISwapChain* pSwapChain = NULL; + IDXGIFactory1* pDXGIFactory = m_dxgiFactory; + DXGI_SWAP_CHAIN_DESC* pSwapChainDesc = static_cast<DXGI_SWAP_CHAIN_DESC*>(dxgiSwapChainDesc); + + hr = pDXGIFactory->MakeWindowAssociation(m_hwnd, 0); + pSwapChainDesc->OutputWindow = m_hwnd; + + bool fullscreen = false; + WINDOWINFO wininfo = {0}; + if(GetWindowInfo(m_hwnd, &wininfo)) + { + if(wininfo.dwStyle & WS_POPUP) + { + fullscreen = true; + pSwapChainDesc->Windowed = 0; + } + } + + PFN_D3D11_CREATE_DEVICE pD3D11CreateDevice = (PFN_D3D11_CREATE_DEVICE)GetProcAddress(m_d3d11Library, "D3D11CreateDevice"); + RENDERER_ASSERT(pD3D11CreateDevice, "Could not find D3D11CreateDeviceAndSwapChain."); + if (pD3D11CreateDevice) + { + UINT i = 0; + IDXGIAdapter1* pAdapter = NULL; + std::vector<IDXGIAdapter1*> vAdapters; + while(pDXGIFactory->EnumAdapters1(i++, &pAdapter) != DXGI_ERROR_NOT_FOUND) + { + vAdapters.push_back(pAdapter); + } + + const D3D_FEATURE_LEVEL supportedFeatureLevels[] = + { + D3D_FEATURE_LEVEL_11_0, + D3D_FEATURE_LEVEL_10_1, + D3D_FEATURE_LEVEL_10_0, + //D3D_FEATURE_LEVEL_9_3, + //D3D_FEATURE_LEVEL_9_2, + //D3D_FEATURE_LEVEL_9_1, + }; + + D3D11_CREATE_DEVICE_FLAG deviceFlags = (D3D11_CREATE_DEVICE_FLAG)(D3D11_CREATE_DEVICE_SINGLETHREADED | D3D11_CREATE_DEVICE_BGRA_SUPPORT); +#if PX_DEBUG + deviceFlags = (D3D11_CREATE_DEVICE_FLAG)(deviceFlags | D3D11_CREATE_DEVICE_DEBUG); +#endif + D3D_FEATURE_LEVEL deviceFeatureLevel = D3D_FEATURE_LEVEL_11_0; + for (i = 0; i < vAdapters.size(); ++i) + { + hr = pD3D11CreateDevice( + vAdapters[i], + D3D_DRIVER_TYPE_UNKNOWN, + NULL, + deviceFlags, + supportedFeatureLevels, + PX_ARRAY_SIZE(supportedFeatureLevels), + D3D11_SDK_VERSION, + &pD3D11Device, + &deviceFeatureLevel, + &pD3D11DeviceContext); + + if (SUCCEEDED(hr)) + { + // Disable MSAA on sub DX10.1 devices + if (deviceFeatureLevel <= D3D_FEATURE_LEVEL_10_0) + { + pSwapChainDesc->SampleDesc.Count = 1; + pSwapChainDesc->SampleDesc.Quality = 0; + } + hr = pDXGIFactory->CreateSwapChain(pD3D11Device, pSwapChainDesc, &pSwapChain); + } + + if (SUCCEEDED(hr)) + { + m_dxgiSwap = pSwapChain; + m_d3d11Device = pD3D11Device; + m_d3d11DeviceContext = pD3D11DeviceContext; + *(static_cast<IDXGISwapChain**>(m_dxgiSwap_out)) = m_dxgiSwap; + *(static_cast<ID3D11Device**>(m_d3dDevice_out)) = m_d3d11Device; + *(static_cast<ID3D11DeviceContext**>(m_d3dDeviceContext_out)) = m_d3d11DeviceContext; + break; + } + + // If DXGI creation failed but device creation succeeded, we need to release both device and context + if (pD3D11Device) pD3D11Device->Release(); + if (pD3D11DeviceContext) pD3D11DeviceContext->Release(); + } + + for (i = 0; i < vAdapters.size(); ++i) + { + vAdapters[i]->Release(); + } + } + RENDERER_ASSERT(m_dxgiSwap && m_d3d11Device && m_d3d11DeviceContext, "Unable to create D3D device and swap chain"); +#endif + + return hr; +} + +bool WindowsPlatform::makeSureDirectoryPathExists(const char* dirPath) +{ + // [Kai] Currently create the final folder only if the dirPath doesn't exist. + // To create all the directories in the specified dirPath, use API + // MakeSureDirectoryPathExists() declared in dbghelp.h + bool ok = GetFileAttributes(dirPath) != -1; + if (!ok) + ok = CreateDirectory(dirPath, NULL) != 0; + return ok; +} + +physx::PxU32 WindowsPlatform::D3D11Present(bool vsync) +{ +#if defined(RENDERER_ENABLE_DIRECT3D11) + return m_dxgiSwap->Present(vsync ? 1 : 0, 0); +#else + return 0; +#endif +} diff --git a/PhysX_3.4/Samples/SampleFramework/platform/src/windows/WindowsSampleUserInput.cpp b/PhysX_3.4/Samples/SampleFramework/platform/src/windows/WindowsSampleUserInput.cpp new file mode 100644 index 00000000..9e6c14a9 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/platform/src/windows/WindowsSampleUserInput.cpp @@ -0,0 +1,825 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#include <windows/WindowsSampleUserInput.h> + +#include <foundation/PxAssert.h> + +#include <stdio.h> +#include <direct.h> + +static bool gTimeInit=false; + +// PT: TODO: share this with PxApplication +static const unsigned int MAX_GAMEPADS = 4; +static const unsigned int MAX_GAMEPAD_AXES = 4; +static XINPUT_STATE m_lastInputState[MAX_GAMEPADS]; +static int m_lastAxisData[MAX_GAMEPADS][MAX_GAMEPAD_AXES]; + +using namespace SampleFramework; +using namespace physx; + +WindowsSampleUserInput::WindowsSampleUserInput() +{ + mXInputLibrary = 0; + mpXInputGetState = 0; + mpXInputGetCapabilities = 0; + + static const unsigned int xInputLibCount = 4; + static const char* xInputLibs[xInputLibCount] = { "xinput1_4.dll" , + "xinput1_3.dll", + "xinput1_2.dll", + "xinput1_1.dll" }; + for (unsigned int i = 0; i < xInputLibCount; ++i) + { + mXInputLibrary = LoadLibraryA(xInputLibs[i]); + if(mXInputLibrary) + break; + } + PX_ASSERT(mXInputLibrary && "Could not load XInput library."); + if (mXInputLibrary) + { + mpXInputGetState = (LPXINPUTGETSTATE)GetProcAddress(mXInputLibrary, "XInputGetState"); + mpXInputGetCapabilities = (LPXINPUTGETCAPABILITIES)GetProcAddress(mXInputLibrary, "XInputGetCapabilities"); + PX_ASSERT(mpXInputGetState && "Error loading XInputGetState function."); + PX_ASSERT(mpXInputGetCapabilities && "Error loading XInputGetCapabilities function."); + } + + mGamePadConnected = false; + mConnectedPad = 0; + + // register all user inputs for windows platform + registerUserInput(WKEY_1,"KEY_1", "1"); + registerUserInput(WKEY_2,"KEY_2", "2"); + registerUserInput(WKEY_3,"KEY_3", "3"); + registerUserInput(WKEY_4,"KEY_4", "4"); + registerUserInput(WKEY_5,"KEY_5", "5"); + registerUserInput(WKEY_6,"KEY_6", "6"); + registerUserInput(WKEY_7,"KEY_7", "7"); + registerUserInput(WKEY_8,"KEY_8", "8"); + registerUserInput(WKEY_9,"KEY_9", "9"); + registerUserInput(WKEY_0,"KEY_0", "0"); + + registerUserInput(WKEY_A,"KEY_A", "A"); + registerUserInput(WKEY_B,"KEY_B", "B"); + registerUserInput(WKEY_C,"KEY_C", "C"); + registerUserInput(WKEY_D,"KEY_D", "D"); + registerUserInput(WKEY_E,"KEY_E", "E"); + registerUserInput(WKEY_F,"KEY_F", "F"); + registerUserInput(WKEY_G,"KEY_G", "G"); + registerUserInput(WKEY_H,"KEY_H", "H"); + registerUserInput(WKEY_I,"KEY_I", "I"); + registerUserInput(WKEY_J,"KEY_J", "J"); + registerUserInput(WKEY_K,"KEY_K", "K"); + registerUserInput(WKEY_L,"KEY_L", "L"); + registerUserInput(WKEY_M,"KEY_M", "M"); + registerUserInput(WKEY_N,"KEY_N", "N"); + registerUserInput(WKEY_O,"KEY_O", "O"); + registerUserInput(WKEY_P,"KEY_P", "P"); + registerUserInput(WKEY_Q,"KEY_Q", "Q"); + registerUserInput(WKEY_R,"KEY_R", "R"); + registerUserInput(WKEY_S,"KEY_S", "S"); + registerUserInput(WKEY_T,"KEY_T", "T"); + registerUserInput(WKEY_U,"KEY_U", "U"); + registerUserInput(WKEY_V,"KEY_V", "V"); + registerUserInput(WKEY_W,"KEY_W", "W"); + registerUserInput(WKEY_X,"KEY_X", "X"); + registerUserInput(WKEY_Y,"KEY_Y", "Y"); + registerUserInput(WKEY_Z,"KEY_Z", "Z"); + + registerUserInput(WKEY_SPACE ,"KEY_SPACE","Space"); + registerUserInput(WKEY_RETURN ,"KEY_RETURN","Enter"); + registerUserInput(WKEY_SHIFT ,"KEY_SHIFT","Shift"); + registerUserInput(WKEY_CONTROL ,"KEY_CONTROL","Control"); + registerUserInput(WKEY_ESCAPE ,"KEY_ESCAPE","Escape"); + registerUserInput(WKEY_COMMA ,"KEY_COMMA",","); + registerUserInput(WKEY_NUMPAD0 ,"KEY_NUMPAD0","Numpad 0"); + registerUserInput(WKEY_NUMPAD1 ,"KEY_NUMPAD1","Numpad 1"); + registerUserInput(WKEY_NUMPAD2 ,"KEY_NUMPAD2","Numpad 2"); + registerUserInput(WKEY_NUMPAD3 ,"KEY_NUMPAD3","Numpad 3"); + registerUserInput(WKEY_NUMPAD4 ,"KEY_NUMPAD4","Numpad 4"); + registerUserInput(WKEY_NUMPAD5 ,"KEY_NUMPAD5","Numpad 5"); + registerUserInput(WKEY_NUMPAD6 ,"KEY_NUMPAD6","Numpad 6"); + registerUserInput(WKEY_NUMPAD7 ,"KEY_NUMPAD7","Numpad 7"); + registerUserInput(WKEY_NUMPAD8 ,"KEY_NUMPAD8","Numpad 8"); + registerUserInput(WKEY_NUMPAD9 ,"KEY_NUMPAD9","Numpad 9"); + registerUserInput(WKEY_MULTIPLY ,"KEY_MULTIPLY","*"); + registerUserInput(WKEY_ADD ,"KEY_ADD","+"); + registerUserInput(WKEY_SEPARATOR ,"KEY_SEPARATOR","Separator"); + registerUserInput(WKEY_SUBTRACT ,"KEY_SUBTRACT","-"); + registerUserInput(WKEY_DECIMAL ,"KEY_DECIMAL","."); + registerUserInput(WKEY_DIVIDE ,"KEY_DIVIDE","/"); + + registerUserInput(WKEY_F1 ,"KEY_F1","F1"); + registerUserInput(WKEY_F2 ,"KEY_F2","F2"); + registerUserInput(WKEY_F3 ,"KEY_F3","F3"); + registerUserInput(WKEY_F4 ,"KEY_F4","F4"); + registerUserInput(WKEY_F5 ,"KEY_F5","F5"); + registerUserInput(WKEY_F6 ,"KEY_F6","F6"); + registerUserInput(WKEY_F7 ,"KEY_F7","F7"); + registerUserInput(WKEY_F8 ,"KEY_F8","F8"); + registerUserInput(WKEY_F9 ,"KEY_F9","F9"); + registerUserInput(WKEY_F10 ,"KEY_F10","F10"); + registerUserInput(WKEY_F11 ,"KEY_F11","F11"); + registerUserInput(WKEY_F12 ,"KEY_F12","F12"); + + registerUserInput(WKEY_TAB ,"KEY_TAB","Tab"); + registerUserInput(WKEY_BACKSPACE,"KEY_BACKSPACE","Backspace"); + registerUserInput(WKEY_PRIOR ,"KEY_PRIOR","PgUp"); + registerUserInput(WKEY_NEXT ,"KEY_NEXT","PgDn"); + registerUserInput(WKEY_UP ,"KEY_UP","Up Arrow"); + registerUserInput(WKEY_DOWN ,"KEY_DOWN","Down Arrow"); + registerUserInput(WKEY_LEFT ,"KEY_LEFT","Left Arrow"); + registerUserInput(WKEY_RIGHT ,"KEY_RIGHT","Right Arrow"); + + // mouse + registerUserInput(MOUSE_BUTTON_LEFT ,"MOUSE_BUTTON_LEFT","Left Mouse Button"); + registerUserInput(MOUSE_BUTTON_RIGHT ,"MOUSE_BUTTON_RIGHT","Right Mouse Button"); + registerUserInput(MOUSE_BUTTON_CENTER ,"MOUSE_BUTTON_CENTER","Middle Mouse Button"); + + registerUserInput(MOUSE_MOVE,"MOUSE_MOVE", "Mouse Move"); + + //assumes the pad naming conventions of xbox + registerUserInput(GAMEPAD_DIGI_UP,"GAMEPAD_DIGI_UP", "gpad UP"); + registerUserInput(GAMEPAD_DIGI_DOWN,"GAMEPAD_DIGI_DOWN", "gpad DOWN"); + registerUserInput(GAMEPAD_DIGI_LEFT,"GAMEPAD_DIGI_LEFT", "gpad LEFT"); + registerUserInput(GAMEPAD_DIGI_RIGHT,"GAMEPAD_DIGI_RIGHT", "gpad RIGHT"); + registerUserInput(GAMEPAD_START ,"GAMEPAD_START", "gpad START"); + registerUserInput(GAMEPAD_SELECT ,"GAMEPAD_SELECT", "gpad BACK"); + registerUserInput(GAMEPAD_LEFT_STICK ,"GAMEPAD_LEFT_STICK", "gpad LSTICK"); + registerUserInput(GAMEPAD_RIGHT_STICK ,"GAMEPAD_RIGHT_STICK", "gpad RSTICK"); + registerUserInput(GAMEPAD_NORTH ,"GAMEPAD_NORTH", "gpad Y"); + registerUserInput(GAMEPAD_SOUTH ,"GAMEPAD_SOUTH", "gpad A"); + registerUserInput(GAMEPAD_WEST ,"GAMEPAD_WEST", "gpad X"); + registerUserInput(GAMEPAD_EAST ,"GAMEPAD_EAST", "gpad B"); + registerUserInput(GAMEPAD_LEFT_SHOULDER_TOP ,"GAMEPAD_LEFT_SHOULDER_TOP", "gpad LB"); + registerUserInput(GAMEPAD_RIGHT_SHOULDER_TOP ,"GAMEPAD_RIGHT_SHOULDER_TOP", "gpad RB"); + registerUserInput(GAMEPAD_LEFT_SHOULDER_BOT ,"GAMEPAD_LEFT_SHOULDER_BOT", "gpad LT"); + registerUserInput(GAMEPAD_RIGHT_SHOULDER_BOT ,"GAMEPAD_RIGHT_SHOULDER_BOT", "gpad RT"); + + registerUserInput(GAMEPAD_RIGHT_STICK_X,"GAMEPAD_RIGHT_STICK_X", "gpad RSTICK"); + registerUserInput(GAMEPAD_RIGHT_STICK_Y,"GAMEPAD_RIGHT_STICK_Y", "gpad RSTICK"); + registerUserInput(GAMEPAD_LEFT_STICK_X,"GAMEPAD_LEFT_STICK_X", "gpad LSTICK"); + registerUserInput(GAMEPAD_LEFT_STICK_Y,"GAMEPAD_LEFT_STICK_Y", "gpad LSTICK"); + + // use scan codes for movement + PxU16 vkey = (PxU16) MapVirtualKey(18, MAPVK_VSC_TO_VK); + WindowsSampleUserInputIds getId = getKeyCode(vkey); + const UserInput* ui = getUserInputFromId(getId); + if(ui) + { + registerUserInput(SCAN_CODE_UP,"SCAN_CODE_E", ui->m_Name); + mScanCodesMap[18] = SCAN_CODE_UP; + } + + vkey = (PxU16)MapVirtualKey(46, MAPVK_VSC_TO_VK); + getId = getKeyCode(vkey); + ui = getUserInputFromId(getId); + if(ui) + { + registerUserInput(SCAN_CODE_DOWN,"SCAN_CODE_C", ui->m_Name); + mScanCodesMap[46] = SCAN_CODE_DOWN; + } + + vkey = (PxU16) MapVirtualKey(30, MAPVK_VSC_TO_VK); + getId = getKeyCode(vkey); + ui = getUserInputFromId(getId); + if(ui) + { + registerUserInput(SCAN_CODE_LEFT,"SCAN_CODE_A", ui->m_Name); + mScanCodesMap[30] = SCAN_CODE_LEFT; + } + + vkey = (PxU16) MapVirtualKey(32, MAPVK_VSC_TO_VK); + getId = getKeyCode(vkey); + ui = getUserInputFromId(getId); + if(ui) + { + registerUserInput(SCAN_CODE_RIGHT,"SCAN_CODE_D", ui->m_Name); + mScanCodesMap[32] = SCAN_CODE_RIGHT; + } + + + vkey = (PxU16) MapVirtualKey(17, MAPVK_VSC_TO_VK); + getId = getKeyCode(vkey); + ui = getUserInputFromId(getId); + if(ui) + { + registerUserInput(SCAN_CODE_FORWARD,"SCAN_CODE_W", ui->m_Name); + mScanCodesMap[17] = SCAN_CODE_FORWARD; + } + + vkey = (PxU16) MapVirtualKey(31, MAPVK_VSC_TO_VK); + getId = getKeyCode(vkey); + ui = getUserInputFromId(getId); + if(ui) + { + registerUserInput(SCAN_CODE_BACKWARD,"SCAN_CODE_S", ui->m_Name); + mScanCodesMap[31] = SCAN_CODE_BACKWARD; + } + + vkey = (PxU16) MapVirtualKey(42, MAPVK_VSC_TO_VK); + getId = getKeyCode(vkey); + ui = getUserInputFromId(getId); + if(ui) + { + registerUserInput(SCAN_CODE_LEFT_SHIFT,"SCAN_CODE_LEFT_SHIFT", ui->m_Name); + mScanCodesMap[42] = SCAN_CODE_LEFT_SHIFT; + } + + vkey = (PxU16) MapVirtualKey(57, MAPVK_VSC_TO_VK); + getId = getKeyCode(vkey); + ui = getUserInputFromId(getId); + if(ui) + { + registerUserInput(SCAN_CODE_SPACE,"SCAN_CODE_SPACE", ui->m_Name); + mScanCodesMap[57] = SCAN_CODE_SPACE; + } + + vkey =(PxU16) MapVirtualKey(38, MAPVK_VSC_TO_VK); + getId = getKeyCode(vkey); + ui = getUserInputFromId(getId); + if(ui) + { + registerUserInput(SCAN_CODE_L,"SCAN_CODE_L", ui->m_Name); + mScanCodesMap[38] = SCAN_CODE_L; + } + + vkey = (PxU16)MapVirtualKey(10, MAPVK_VSC_TO_VK); + getId = getKeyCode(vkey); + ui = getUserInputFromId(getId); + if(ui) + { + registerUserInput(SCAN_CODE_9,"SCAN_CODE_9", ui->m_Name); + mScanCodesMap[10] = SCAN_CODE_9; + } + + vkey = (PxU16)MapVirtualKey(11, MAPVK_VSC_TO_VK); + getId = getKeyCode(vkey); + ui = getUserInputFromId(getId); + if(ui) + { + registerUserInput(SCAN_CODE_0,"SCAN_CODE_0", ui->m_Name); + mScanCodesMap[11] = SCAN_CODE_0; + } + +} + +const UserInput* WindowsSampleUserInput::getUserInputFromId(WindowsSampleUserInputIds id) const +{ + for (size_t i = mUserInputs.size(); i--;) + { + if(mUserInputs[i].m_Id == id) + { + return &mUserInputs[i]; + } + } + + return NULL; +} + +WindowsSampleUserInput::~WindowsSampleUserInput() +{ + mScanCodesMap.clear(); + mAnalogStates.clear(); + mDigitalStates.clear(); + if (mXInputLibrary) + { + FreeLibrary(mXInputLibrary); + mXInputLibrary = 0; + } +} + +WindowsSampleUserInputIds WindowsSampleUserInput::getKeyCode(WPARAM wParam) const +{ + WindowsSampleUserInputIds keyCode = WKEY_UNKNOWN; + const int keyparam = (int)wParam; + + if(keyparam >= 'A' && keyparam <= 'Z') keyCode = (WindowsSampleUserInputIds)((keyparam - 'A')+WKEY_A); + else if(keyparam >= '0' && keyparam <= '9') keyCode = (WindowsSampleUserInputIds)((keyparam - '0')+WKEY_0); + else if(keyparam >= VK_NUMPAD0 && keyparam <= VK_DIVIDE) keyCode = (WindowsSampleUserInputIds)((keyparam - VK_NUMPAD0)+WKEY_NUMPAD0); + else if(keyparam == VK_SHIFT) keyCode = WKEY_SHIFT; + else if(keyparam == VK_CONTROL) keyCode = WKEY_CONTROL; + else if(keyparam == VK_SPACE) keyCode = WKEY_SPACE; + else if(keyparam == VK_RETURN) keyCode = WKEY_RETURN; + else if(keyparam == VK_ESCAPE) keyCode = WKEY_ESCAPE; + else if(keyparam == VK_OEM_COMMA) keyCode = WKEY_COMMA; + else if(keyparam == VK_OEM_2) keyCode = WKEY_DIVIDE; + else if(keyparam == VK_OEM_MINUS) keyCode = WKEY_SUBTRACT; + else if(keyparam == VK_OEM_PLUS) keyCode = WKEY_ADD; + // + else if(keyparam == VK_F1) keyCode = WKEY_F1; + else if(keyparam == VK_F2) keyCode = WKEY_F2; + else if(keyparam == VK_F3) keyCode = WKEY_F3; + else if(keyparam == VK_F4) keyCode = WKEY_F4; + else if(keyparam == VK_F5) keyCode = WKEY_F5; + else if(keyparam == VK_F6) keyCode = WKEY_F6; + else if(keyparam == VK_F7) keyCode = WKEY_F7; + else if(keyparam == VK_F8) keyCode = WKEY_F8; + else if(keyparam == VK_F9) keyCode = WKEY_F9; + else if(keyparam == VK_F10) keyCode = WKEY_F10; + else if(keyparam == VK_F11) keyCode = WKEY_F11; + else if(keyparam == VK_F12) keyCode = WKEY_F12; + // + else if(keyparam == VK_TAB) keyCode = WKEY_TAB; + else if(keyparam == VK_BACK) keyCode = WKEY_BACKSPACE; + // + else if(keyparam == VK_PRIOR) keyCode = WKEY_PRIOR; + else if(keyparam == VK_NEXT) keyCode = WKEY_NEXT; + // + else if(keyparam == VK_UP) keyCode = WKEY_UP; + else if(keyparam == VK_DOWN) keyCode = WKEY_DOWN; + else if(keyparam == VK_LEFT) keyCode = WKEY_LEFT; + else if(keyparam == VK_RIGHT) keyCode = WKEY_RIGHT; + + return keyCode; +} + +SampleUserInput::KeyCode WindowsSampleUserInput::getSampleUserInputKeyCode(WPARAM wParam) const +{ + SampleUserInput::KeyCode keyCode = KEY_UNKNOWN; + const int keyparam = (int)wParam; + // PT: TODO: the comment below is of course wrong. You just need to use the proper event code (WM_CHAR) + //there are no lowercase virtual key codes!! + //if( keyparam >= 'a' && keyparam <= 'z') keyCode = (RendererWindow::KeyCode)((keyparam - 'a')+KEY_A); else + + if(keyparam >= 'A' && keyparam <= 'Z') keyCode = (SampleUserInput::KeyCode)((keyparam - 'A')+KEY_A); + else if(keyparam >= '0' && keyparam <= '9') keyCode = (SampleUserInput::KeyCode)((keyparam - '0')+KEY_0); + else if(keyparam >= VK_NUMPAD0 && keyparam <= VK_DIVIDE) keyCode = (SampleUserInput::KeyCode)((keyparam - VK_NUMPAD0)+KEY_NUMPAD0); + else if(keyparam == VK_SHIFT) keyCode = KEY_SHIFT; + else if(keyparam == VK_CONTROL) keyCode = KEY_CONTROL; + else if(keyparam == VK_SPACE) keyCode = KEY_SPACE; + else if(keyparam == VK_RETURN) keyCode = KEY_RETURN; + else if(keyparam == VK_ESCAPE) keyCode = KEY_ESCAPE; + else if(keyparam == VK_OEM_COMMA) keyCode = KEY_COMMA; + else if(keyparam == VK_OEM_2) keyCode = KEY_DIVIDE; + else if(keyparam == VK_OEM_MINUS) keyCode = KEY_SUBTRACT; + else if(keyparam == VK_OEM_PLUS) keyCode = KEY_ADD; + // + else if(keyparam == VK_F1) keyCode = KEY_F1; + else if(keyparam == VK_F2) keyCode = KEY_F2; + else if(keyparam == VK_F3) keyCode = KEY_F3; + else if(keyparam == VK_F4) keyCode = KEY_F4; + else if(keyparam == VK_F5) keyCode = KEY_F5; + else if(keyparam == VK_F6) keyCode = KEY_F6; + else if(keyparam == VK_F7) keyCode = KEY_F7; + else if(keyparam == VK_F8) keyCode = KEY_F8; + else if(keyparam == VK_F9) keyCode = KEY_F9; + else if(keyparam == VK_F10) keyCode = KEY_F10; + else if(keyparam == VK_F11) keyCode = KEY_F11; + else if(keyparam == VK_F12) keyCode = KEY_F12; + // + else if(keyparam == VK_TAB) keyCode = KEY_TAB; + // + else if(keyparam == VK_PRIOR) keyCode = KEY_PRIOR; + else if(keyparam == VK_NEXT) keyCode = KEY_NEXT; + // + else if(keyparam == VK_UP) keyCode = KEY_UP; + else if(keyparam == VK_DOWN) keyCode = KEY_DOWN; + else if(keyparam == VK_LEFT) keyCode = KEY_LEFT; + else if(keyparam == VK_RIGHT) keyCode = KEY_RIGHT; + + return keyCode; +} + +void WindowsSampleUserInput::doOnMouseMove(physx::PxU32 x, physx::PxU32 y, physx::PxReal dx, physx::PxReal dy, WindowsSampleUserInputIds button) +{ + const std::vector<size_t>* events = getInputEvents((PxU16)button); + + if(events) + { + for (size_t i = events->size(); i--;) + { + const InputEvent& ie = mInputEvents[(*events)[i]]; + if(getInputEventListener()) + { + getInputEventListener()->onPointerInputEvent(ie, x, y, dx, dy, false); + } + } + } + +} + +void WindowsSampleUserInput::doOnMouseButton(physx::PxU32 x, physx::PxU32 y , MouseButtons button, bool down) +{ + WindowsSampleUserInputIds buttonId = WKEY_UNKNOWN; + WindowsSampleUserInputIds buttonIdOpposite = WKEY_UNKNOWN; + switch (button) + { + case LEFT_MOUSE_BUTTON: + buttonId = MOUSE_BUTTON_LEFT; + break; + case RIGHT_MOUSE_BUTTON: + buttonId = MOUSE_BUTTON_RIGHT; + break; + case CENTER_MOUSE_BUTTON: + buttonId = MOUSE_BUTTON_CENTER; + break; + } + + const std::vector<size_t>* events = getInputEvents((PxU16)buttonId); + if(events) + { + for (size_t i = events->size(); i--;) + { + const InputEvent& ie = mInputEvents[(*events)[i]]; + mDigitalStates[ie.m_Id] = down; + + if(getInputEventListener()) + { + getInputEventListener()->onPointerInputEvent(ie, x, y, 0, 0, down); + } + } + } +} + +void WindowsSampleUserInput::onKeyDownEx(WPARAM wParam) +{ + if(getInputEventListener()) + { + KeyCode keyCode = getSampleUserInputKeyCode(wParam); + + getInputEventListener()->onKeyDownEx(keyCode, (PxU32)wParam); + } +} + +void WindowsSampleUserInput::onKeyDown(WPARAM wParam, LPARAM lParam) +{ + PxU16 scanCode = (lParam >> 16) & 0xFF; + const std::vector<size_t>* events = NULL; + std::map<physx::PxU16, physx::PxU16>::iterator fit = mScanCodesMap.find(scanCode); + if(fit != mScanCodesMap.end()) + { + events = getInputEvents(fit->second); + } + + if(!events) + { + WindowsSampleUserInputIds keyCode = getKeyCode(wParam); + events = getInputEvents((PxU16)keyCode); + } + + if(!events || !getInputEventListener()) + return; + + for (size_t i = events->size(); i--;) + { + const InputEvent& ie = mInputEvents[(*events)[i]]; + mDigitalStates[ie.m_Id] = true; + getInputEventListener()->onDigitalInputEvent(ie, true); + } +} + +void WindowsSampleUserInput::onKeyUp(WPARAM wParam, LPARAM lParam) +{ + PxU16 scanCode = (lParam >> 16) & 0xFF; + const std::vector<size_t>* events = NULL; + std::map<physx::PxU16, physx::PxU16>::iterator fit = mScanCodesMap.find(scanCode); + if(fit != mScanCodesMap.end()) + { + events = getInputEvents(fit->second); + } + if(!events) + { + WindowsSampleUserInputIds keyCode = getKeyCode(wParam); + events = getInputEvents((PxU16)keyCode); + } + + if(!events || !getInputEventListener()) + return; + + for (size_t i = events->size(); i--;) + { + const InputEvent& ie = mInputEvents[(*events)[i]]; + mDigitalStates[ie.m_Id] = false; + getInputEventListener()->onDigitalInputEvent(ie, false); + } +} + +void WindowsSampleUserInput::onKeyEvent(const KeyEvent& keyEvent) +{ + WindowsSampleUserInputIds keyCode = getKeyCode(keyEvent.m_Param); + const std::vector<size_t>* events = getInputEvents((PxU16)keyCode); + + if(!events || !getInputEventListener()) + return; + + for (size_t i = events->size(); i--;) + { + const InputEvent& ie = mInputEvents[(*events)[i]]; + + if(keyEvent.m_Flags == KEY_EVENT_UP) + { + mDigitalStates[ie.m_Id] = false; + getInputEventListener()->onDigitalInputEvent(ie, false); + } + + if(keyEvent.m_Flags == KEY_EVENT_DOWN) + { + mDigitalStates[ie.m_Id] = true; + getInputEventListener()->onDigitalInputEvent(ie, true); + } + } +} + +bool WindowsSampleUserInput::getDigitalInputEventState(physx::PxU16 inputEventId ) const +{ + std::map<physx::PxU16,bool>::const_iterator fit = mDigitalStates.find(inputEventId); + if(fit != mDigitalStates.end()) + { + return fit->second; + } + else + { + return false; + } +} +float WindowsSampleUserInput::getAnalogInputEventState(physx::PxU16 inputEventId ) const +{ + std::map<physx::PxU16,float>::const_iterator fit = mAnalogStates.find(inputEventId); + if(fit != mAnalogStates.end()) + { + return fit->second; + } + else + { + return 0.0f; + } +} + +void WindowsSampleUserInput::onGamepadAnalogButton(physx::PxU32 buttonIndex,const BYTE oldValue,const BYTE newValue) +{ + const std::vector<size_t>* events = getInputEvents((PxU16)buttonIndex); + + if(!events || !getInputEventListener()) + return; + + bool newUp = false; + bool newDown = false; + if( !oldValue && newValue ) + { + newUp = true; + } + else if( oldValue && !newValue ) + { + newDown = true; + } + + for (size_t i = events->size(); i--;) + { + const InputEvent& ie = mInputEvents[(*events)[i]]; + if(ie.m_Analog) + { + mAnalogStates[ie.m_Id] = newValue/255.0f; + getInputEventListener()->onAnalogInputEvent(ie, newValue/255.0f); + } + else + { + if(newUp) + { + mDigitalStates[ie.m_Id] = true; + getInputEventListener()->onDigitalInputEvent(ie, true); + } + if(newDown) + { + mDigitalStates[ie.m_Id] = false; + getInputEventListener()->onDigitalInputEvent(ie, false); + } + } + } + + + +} + +void WindowsSampleUserInput::onGamepadButton(physx::PxU32 buttonIndex, bool buttonDown) +{ + PxU16 userInput = (PxU16) (GAMEPAD_DIGI_UP + buttonIndex); + + const std::vector<size_t>* events = getInputEvents(userInput); + + if(!events || !getInputEventListener()) + return; + + for (size_t i = 0; i < events->size(); i++) + { + const InputEvent& ie = mInputEvents[(*events)[i]]; + mDigitalStates[ie.m_Id] = buttonDown; + getInputEventListener()->onDigitalInputEvent(ie, buttonDown); + } +} + +void WindowsSampleUserInput::onGamepadAxis(physx::PxU32 axis, physx::PxReal val) +{ + PxU16 userInput = (PxU16)(GAMEPAD_RIGHT_STICK_X + axis); + + const std::vector<size_t>* events = getInputEvents(userInput); + + if(!events || !getInputEventListener()) + return; + + for (size_t i = events->size(); i--;) + { + const InputEvent& ie = mInputEvents[(*events)[i]]; + mAnalogStates[ie.m_Id] = val; + getInputEventListener()->onAnalogInputEvent(ie, val); + } + +} + +void WindowsSampleUserInput::shutdown() +{ + mAnalogStates.clear(); + mDigitalStates.clear(); + + SampleUserInput::shutdown(); +} + +void WindowsSampleUserInput::updateInput() +{ + SampleUserInput::updateInput(); + + processGamepads(); +} + +void WindowsSampleUserInput::processGamepads() +{ + SampleUserInput::processGamepads(); + + if(!gTimeInit) + { + gTimeInit=true; + + for(PxU32 p=0;p<MAX_GAMEPADS;p++) + { + memset(&m_lastInputState[p], 0, sizeof(XINPUT_STATE)); + for(PxU32 i=0;i<MAX_GAMEPAD_AXES;i++) + { + m_lastAxisData[p][i]=0; + } + } + } + + static PxI32 disConnected[4] = {1, 2, 3, 4}; + + if (!hasXInput()) + return; + + // PT: TODO: share this with PxApplication + for(PxU32 p=0;p<MAX_GAMEPADS;p++) + { + if((--disConnected[p]) == 0) + { + XINPUT_STATE inputState; + DWORD state = mpXInputGetState(p, &inputState); + if(state == ERROR_DEVICE_NOT_CONNECTED) + { + disConnected[p] = 4; + if(mGamePadConnected && (mConnectedPad == p)) + { + mGamePadConnected = false; + mConnectedPad = 0; + for (PxU32 k=0;k<MAX_GAMEPADS;k++) + { + XINPUT_STATE inputStateDisc; + DWORD stateDisc = mpXInputGetState(k, &inputStateDisc); + if(stateDisc == ERROR_SUCCESS) + { + mConnectedPad = k; + mGamePadConnected = true; + break; + } + } + } + } + else if(state == ERROR_SUCCESS) + { + if(!mGamePadConnected) + { + mGamePadConnected = true; + mConnectedPad = p; + } + + disConnected[p] = 1; //force to test next time + XINPUT_CAPABILITIES caps; + mpXInputGetCapabilities(p, XINPUT_FLAG_GAMEPAD, &caps); + + //gamepad + { + // Process buttons + const WORD lastWButtons = m_lastInputState[p].Gamepad.wButtons; + const WORD currWButtons = inputState.Gamepad.wButtons; + + const WORD buttonsDown = currWButtons & ~lastWButtons; + const WORD buttonsUp = ~currWButtons & lastWButtons; + // const WORD buttonsHeld = currWButtons & lastWButtons; + + for(int i=0;i<14;i++) + { + // order has to match struct GamepadControls + static const WORD buttonMasks[]={ + XINPUT_GAMEPAD_DPAD_UP, + XINPUT_GAMEPAD_DPAD_DOWN, + XINPUT_GAMEPAD_DPAD_LEFT, + XINPUT_GAMEPAD_DPAD_RIGHT, + XINPUT_GAMEPAD_START, + XINPUT_GAMEPAD_BACK, + XINPUT_GAMEPAD_LEFT_THUMB, + XINPUT_GAMEPAD_RIGHT_THUMB, + XINPUT_GAMEPAD_Y, + XINPUT_GAMEPAD_A, + XINPUT_GAMEPAD_X, + XINPUT_GAMEPAD_B, + XINPUT_GAMEPAD_LEFT_SHOULDER, + XINPUT_GAMEPAD_RIGHT_SHOULDER, + }; + + if (buttonsDown & buttonMasks[i]) + onGamepadButton(i, true); + else if(buttonsUp & buttonMasks[i]) + onGamepadButton(i, false); + } + + // PT: I think we do the 2 last ones separately because they're listed in GamepadControls but not in buttonMasks... + { + const BYTE oldTriggerVal = m_lastInputState[p].Gamepad.bRightTrigger; + const BYTE newTriggerVal = inputState.Gamepad.bRightTrigger; + onGamepadAnalogButton(GAMEPAD_RIGHT_SHOULDER_BOT, oldTriggerVal, newTriggerVal); + } + { + const BYTE oldTriggerVal = m_lastInputState[p].Gamepad.bLeftTrigger; + const BYTE newTriggerVal = inputState.Gamepad.bLeftTrigger; + onGamepadAnalogButton(GAMEPAD_LEFT_SHOULDER_BOT, oldTriggerVal, newTriggerVal); + } + } + + // Gamepad + const int axisData[] = {inputState.Gamepad.sThumbRX, inputState.Gamepad.sThumbRY, inputState.Gamepad.sThumbLX, inputState.Gamepad.sThumbLY }; + for(PxU32 i=0;i<MAX_GAMEPAD_AXES;i++) + { + if(axisData[i] != m_lastAxisData[p][i]) + { + int data = axisData[i]; + if(abs(data) < XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE) + { + data = 0; + } + onGamepadAxis( i, ((float)data)/SHRT_MAX); + } + m_lastAxisData[p][i] = axisData[i]; + } + m_lastInputState[p] = inputState; + } + } + } +} + +bool WindowsSampleUserInput::gamepadSupported() const +{ + return mGamePadConnected; +} + +InputType WindowsSampleUserInput::getInputType(const UserInput& ui) const +{ + if(ui.m_Id > WKEY_DEFINITION_START && ui.m_Id < WKEY_DEFINITION_END) + { + return KEYBOARD_INPUT; + } + + if(ui.m_Id > GAMEPAD_DEFINITION_START && ui.m_Id < GAMEPAD_DEFINITION_END) + { + return GAMEPAD_INPUT; + } + + if(ui.m_Id > MOUSE_DEFINITION_START && ui.m_Id < MOUSE_DEFINITION_END) + { + return MOUSE_INPUT; + } + + return UNDEFINED_INPUT; +} + diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/compiler/vc11win32/SampleRenderer-MT.vcxproj b/PhysX_3.4/Samples/SampleFramework/renderer/compiler/vc11win32/SampleRenderer-MT.vcxproj new file mode 100644 index 00000000..ebe9a259 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/compiler/vc11win32/SampleRenderer-MT.vcxproj @@ -0,0 +1,586 @@ +<?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="checked|Win32"> + <Configuration>checked</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="profile|Win32"> + <Configuration>profile</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{67A61354-2C14-B851-8530-DDD43BDC1D9C}</ProjectGuid> + <RootNamespace>SampleRenderer-MT</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)'=='checked|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> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup 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" /> + </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" /> + </ImportGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> + <OutDir>./../../lib/vc11win32\</OutDir> + <IntDir>./Win32/SampleRenderer-MT/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> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FloatingPointModel>Fast</FloatingPointModel> + <BasicRuntimeChecks>UninitializedLocalUsageCheck</BasicRuntimeChecks> + <AdditionalOptions>/EHsc /MP /Wall /wd4514 /wd4820 /wd4062 /wd4100 /wd4130 /wd4201 /wd4242 /wd4244 /wd4245 /wd4265 /wd4266 /wd4324 /wd4389 /wd4365 /wd4371 /wd4447 /wd4189 /wd4191 /wd4350 /wd4505 /wd4512 /wd4548 /wd4571 /wd4625 /wd4626 /wd4668 /wd4619 /wd4701 /wd4702 /wd4706 /wd4710 /wd4711 /wd4640 /wd4061 /wd4826 /wd4946 /wd4917 /wd4986 /wd4987 /d2Zi+</AdditionalOptions> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>./../../include;./../../../platform/include;./../../../framework/include;./../../../../PxToolkit/include;./../../../../../Source/Common/include;./../../../../../Source/Common/include/windows;./../../../../../Include;./../../../../../../PxShared/include;./../../../../../../PxShared/src/foundation/include;$(DXSDK_DIR)/Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>PHYSX_PROFILE_SDK;WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;_DEBUG;PX_DEBUG=1;PX_CHECKED=1;PX_NVTX=1;PX_SUPPORT_PVD=1;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ExceptionHandling>false</ExceptionHandling> + <WarningLevel>Level4</WarningLevel> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeader>NotUsing</PrecompiledHeader> + <PrecompiledHeaderFile></PrecompiledHeaderFile> + <ProgramDataBaseFileName>$(TargetDir)\$(TargetName).pdb</ProgramDataBaseFileName> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Lib> + <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)$(ProjectName)DEBUG.lib</OutputFile> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <ProgramDatabaseFile>$(TargetDir)\$(TargetName).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>./Win32/SampleRenderer-MT/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> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FloatingPointModel>Fast</FloatingPointModel> + <AdditionalOptions>/EHsc /MP /Wall /wd4514 /wd4820 /wd4062 /wd4100 /wd4130 /wd4201 /wd4242 /wd4244 /wd4245 /wd4265 /wd4266 /wd4324 /wd4389 /wd4365 /wd4371 /wd4447 /wd4189 /wd4191 /wd4350 /wd4505 /wd4512 /wd4548 /wd4571 /wd4625 /wd4626 /wd4668 /wd4619 /wd4701 /wd4702 /wd4706 /wd4710 /wd4711 /wd4640 /wd4061 /wd4826 /wd4946 /wd4917 /wd4986 /wd4987 /d2Zi+</AdditionalOptions> + <Optimization>Full</Optimization> + <AdditionalIncludeDirectories>./../../include;./../../../platform/include;./../../../framework/include;./../../../../PxToolkit/include;./../../../../../Source/Common/include;./../../../../../Source/Common/include/windows;./../../../../../Include;./../../../../../../PxShared/include;./../../../../../../PxShared/src/foundation/include;$(DXSDK_DIR)/Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>PHYSX_PROFILE_SDK;WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;NDEBUG;PX_SUPPORT_PVD=0;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ExceptionHandling>false</ExceptionHandling> + <WarningLevel>Level4</WarningLevel> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <PrecompiledHeader>NotUsing</PrecompiledHeader> + <PrecompiledHeaderFile></PrecompiledHeaderFile> + <ProgramDataBaseFileName>$(TargetDir)\$(TargetName).pdb</ProgramDataBaseFileName> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Lib> + <AdditionalOptions>/INCREMENTAL:NO</AdditionalOptions> + <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)$(ProjectName).lib</OutputFile> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <ProgramDatabaseFile>$(TargetDir)\$(TargetName).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>./Win32/SampleRenderer-MT/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> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FloatingPointModel>Fast</FloatingPointModel> + <AdditionalOptions>/EHsc /MP /Wall /wd4514 /wd4820 /wd4062 /wd4100 /wd4130 /wd4201 /wd4242 /wd4244 /wd4245 /wd4265 /wd4266 /wd4324 /wd4389 /wd4365 /wd4371 /wd4447 /wd4189 /wd4191 /wd4350 /wd4505 /wd4512 /wd4548 /wd4571 /wd4625 /wd4626 /wd4668 /wd4619 /wd4701 /wd4702 /wd4706 /wd4710 /wd4711 /wd4640 /wd4061 /wd4826 /wd4946 /wd4917 /wd4986 /wd4987 /d2Zi+</AdditionalOptions> + <Optimization>Full</Optimization> + <AdditionalIncludeDirectories>./../../include;./../../../platform/include;./../../../framework/include;./../../../../PxToolkit/include;./../../../../../Source/Common/include;./../../../../../Source/Common/include/windows;./../../../../../Include;./../../../../../../PxShared/include;./../../../../../../PxShared/src/foundation/include;$(DXSDK_DIR)/Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>PHYSX_PROFILE_SDK;WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;NDEBUG;PX_CHECKED=1;PX_NVTX=1;PX_SUPPORT_PVD=1;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ExceptionHandling>false</ExceptionHandling> + <WarningLevel>Level4</WarningLevel> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <PrecompiledHeader>NotUsing</PrecompiledHeader> + <PrecompiledHeaderFile></PrecompiledHeaderFile> + <ProgramDataBaseFileName>$(TargetDir)\$(TargetName).pdb</ProgramDataBaseFileName> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Lib> + <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)$(ProjectName)CHECKED.lib</OutputFile> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <ProgramDatabaseFile>$(TargetDir)\$(TargetName).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>./Win32/SampleRenderer-MT/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> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FloatingPointModel>Fast</FloatingPointModel> + <AdditionalOptions>/EHsc /MP /Wall /wd4514 /wd4820 /wd4062 /wd4100 /wd4130 /wd4201 /wd4242 /wd4244 /wd4245 /wd4265 /wd4266 /wd4324 /wd4389 /wd4365 /wd4371 /wd4447 /wd4189 /wd4191 /wd4350 /wd4505 /wd4512 /wd4548 /wd4571 /wd4625 /wd4626 /wd4668 /wd4619 /wd4701 /wd4702 /wd4706 /wd4710 /wd4711 /wd4640 /wd4061 /wd4826 /wd4946 /wd4917 /wd4986 /wd4987 /d2Zi+</AdditionalOptions> + <Optimization>Full</Optimization> + <AdditionalIncludeDirectories>./../../include;./../../../platform/include;./../../../framework/include;./../../../../PxToolkit/include;./../../../../../Source/Common/include;./../../../../../Source/Common/include/windows;./../../../../../Include;./../../../../../../PxShared/include;./../../../../../../PxShared/src/foundation/include;$(DXSDK_DIR)/Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>PHYSX_PROFILE_SDK;WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;NDEBUG;PX_PROFILE=1;PX_NVTX=1;PX_SUPPORT_PVD=1;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ExceptionHandling>false</ExceptionHandling> + <WarningLevel>Level4</WarningLevel> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <PrecompiledHeader>NotUsing</PrecompiledHeader> + <PrecompiledHeaderFile></PrecompiledHeaderFile> + <ProgramDataBaseFileName>$(TargetDir)\$(TargetName).pdb</ProgramDataBaseFileName> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Lib> + <AdditionalOptions>/INCREMENTAL:NO</AdditionalOptions> + <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)$(ProjectName)PROFILE.lib</OutputFile> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <ProgramDatabaseFile>$(TargetDir)\$(TargetName).pdb</ProgramDatabaseFile> + <TargetMachine>MachineX86</TargetMachine> + </Lib> + <ResourceCompile> + </ResourceCompile> + <ProjectReference> + <LinkLibraryDependencies>true</LinkLibraryDependencies> + </ProjectReference> + </ItemDefinitionGroup> + <ItemGroup> + <ClInclude Include="..\..\include\windows\WindowsGLIncludes.h"> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\include\GLIncludes.h"> + </ClInclude> + <ClInclude Include="..\..\include\Renderer.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererBoxShape.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererCapsuleShape.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererClothShape.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererColor.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererConfig.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererDesc.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererDirectionalLight.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererDirectionalLightDesc.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererFoundation.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererGridShape.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererIndexBuffer.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererIndexBufferDesc.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererInstanceBuffer.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererInstanceBufferDesc.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererInteropableBuffer.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererLight.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererLightDesc.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererMaterial.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererMaterialDesc.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererMaterialInstance.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererMemoryMacros.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererMesh.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererMeshContext.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererMeshDesc.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererMeshShape.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererParticleSystemShape.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererProjection.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererShape.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererSimpleParticleSystemShape.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererSpotLight.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererSpotLightDesc.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererTarget.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererTargetDesc.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererTerrainShape.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererTexture.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererTexture2D.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererTexture2DDesc.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererTextureDesc.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererUtils.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererVertexBuffer.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererVertexBufferDesc.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererWindow.h"> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\src\ogl\OGLRenderer.h"> + </ClInclude> + <ClInclude Include="..\..\src\ogl\OGLRendererDirectionalLight.h"> + </ClInclude> + <ClInclude Include="..\..\src\ogl\OGLRendererIndexBuffer.h"> + </ClInclude> + <ClInclude Include="..\..\src\ogl\OGLRendererInstanceBuffer.h"> + </ClInclude> + <ClInclude Include="..\..\src\ogl\OGLRendererMaterial.h"> + </ClInclude> + <ClInclude Include="..\..\src\ogl\OGLRendererMesh.h"> + </ClInclude> + <ClInclude Include="..\..\src\ogl\OGLRendererSpotLight.h"> + </ClInclude> + <ClInclude Include="..\..\src\ogl\OGLRendererTexture2D.h"> + </ClInclude> + <ClInclude Include="..\..\src\ogl\OGLRendererVertexBuffer.h"> + </ClInclude> + <ClCompile Include="..\..\src\ogl\OGLRenderer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\ogl\OGLRendererDirectionalLight.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\ogl\OGLRendererIndexBuffer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\ogl\OGLRendererInstanceBuffer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\ogl\OGLRendererMaterial.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\ogl\OGLRendererMesh.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\ogl\OGLRendererSpotLight.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\ogl\OGLRendererTexture2D.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\ogl\OGLRendererVertexBuffer.cpp"> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\src\d3d9\D3D9Renderer.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d9\D3D9RendererDirectionalLight.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d9\D3D9RendererIndexBuffer.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d9\D3D9RendererInstanceBuffer.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d9\D3D9RendererMaterial.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d9\D3D9RendererMesh.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d9\D3D9RendererSpotLight.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d9\D3D9RendererTarget.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d9\D3D9RendererTexture2D.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d9\D3D9RendererVertexBuffer.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d9\D3D9WPFRenderer.h"> + </ClInclude> + <ClCompile Include="..\..\src\d3d9\D3D9Renderer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d9\D3D9RendererDirectionalLight.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d9\D3D9RendererIndexBuffer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d9\D3D9RendererInstanceBuffer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d9\D3D9RendererMaterial.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d9\D3D9RendererMesh.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d9\D3D9RendererSpotLight.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d9\D3D9RendererTarget.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d9\D3D9RendererTexture2D.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d9\D3D9RendererVertexBuffer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d9\D3D9WPFRenderer.cpp"> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\src\d3d11\D3D11Renderer.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererDirectionalLight.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererIndexBuffer.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererInstanceBuffer.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererMaterial.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererMemoryMacros.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererMesh.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererResourceManager.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererSpotLight.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererTarget.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererTexture2D.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererTexture3D.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererTextureCommon.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererTraits.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererUtils.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererVariableManager.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererVertexBuffer.h"> + </ClInclude> + <ClCompile Include="..\..\src\d3d11\D3D11Renderer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d11\D3D11RendererDirectionalLight.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d11\D3D11RendererIndexBuffer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d11\D3D11RendererInstanceBuffer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d11\D3D11RendererMaterial.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d11\D3D11RendererMesh.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d11\D3D11RendererSpotLight.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d11\D3D11RendererTarget.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d11\D3D11RendererTexture2D.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d11\D3D11RendererTexture3D.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d11\D3D11RendererUtils.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d11\D3D11RendererVariableManager.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d11\D3D11RendererVertexBuffer.cpp"> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\src\null\NULLRenderer.h"> + </ClInclude> + <ClInclude Include="..\..\src\null\NULLRendererDirectionalLight.h"> + </ClInclude> + <ClInclude Include="..\..\src\null\NULLRendererIndexBuffer.h"> + </ClInclude> + <ClInclude Include="..\..\src\null\NULLRendererInstanceBuffer.h"> + </ClInclude> + <ClInclude Include="..\..\src\null\NULLRendererMaterial.h"> + </ClInclude> + <ClInclude Include="..\..\src\null\NULLRendererMesh.h"> + </ClInclude> + <ClInclude Include="..\..\src\null\NULLRendererSpotLight.h"> + </ClInclude> + <ClInclude Include="..\..\src\null\NULLRendererTexture2D.h"> + </ClInclude> + <ClInclude Include="..\..\src\null\NULLRendererVertexBuffer.h"> + </ClInclude> + <ClCompile Include="..\..\src\null\NULLRenderer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\null\NULLRendererDirectionalLight.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\null\NULLRendererIndexBuffer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\null\NULLRendererInstanceBuffer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\null\NULLRendererMaterial.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\null\NULLRendererMesh.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\null\NULLRendererSpotLight.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\null\NULLRendererTexture2D.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\null\NULLRendererVertexBuffer.cpp"> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\src\Renderer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererBoxShape.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererCapsuleShape.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererClothShape.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererColor.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererDesc.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererDirectionalLight.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererDirectionalLightDesc.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererGridShape.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererIndexBuffer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererIndexBufferDesc.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererInstanceBuffer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererInstanceBufferDesc.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererLight.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererLightDesc.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererMaterial.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererMaterialDesc.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererMaterialInstance.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererMesh.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererMeshContext.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererMeshDesc.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererMeshShape.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererParticleSystemShape.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererProjection.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererShape.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererSimpleParticleSystemShape.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererSpotLight.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererSpotLightDesc.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererTarget.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererTargetDesc.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererTerrainShape.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererTexture.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererTexture2D.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererTexture2DDesc.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererTextureDesc.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererVertexBuffer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererVertexBufferDesc.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererWindow.cpp"> + </ClCompile> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"></ImportGroup> +</Project> diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/compiler/vc11win64/SampleRenderer-MT.vcxproj b/PhysX_3.4/Samples/SampleFramework/renderer/compiler/vc11win64/SampleRenderer-MT.vcxproj new file mode 100644 index 00000000..ea3d1264 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/compiler/vc11win64/SampleRenderer-MT.vcxproj @@ -0,0 +1,582 @@ +<?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="checked|x64"> + <Configuration>checked</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="profile|x64"> + <Configuration>profile</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{67A61354-2C14-B851-8530-DDD43BDC1D9C}</ProjectGuid> + <RootNamespace>SampleRenderer-MT</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)'=='checked|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> + <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" /> + </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" /> + </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" /> + </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" /> + </ImportGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> + <OutDir>./../../lib/vc11win64\</OutDir> + <IntDir>./x64/SampleRenderer-MT/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> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FloatingPointModel>Fast</FloatingPointModel> + <BasicRuntimeChecks>UninitializedLocalUsageCheck</BasicRuntimeChecks> + <AdditionalOptions>/EHsc /MP /Wall /wd4514 /wd4820 /wd4062 /wd4100 /wd4130 /wd4201 /wd4242 /wd4244 /wd4245 /wd4265 /wd4266 /wd4324 /wd4389 /wd4365 /wd4371 /wd4447 /wd4189 /wd4191 /wd4350 /wd4505 /wd4512 /wd4548 /wd4571 /wd4625 /wd4626 /wd4668 /wd4619 /wd4701 /wd4702 /wd4706 /wd4710 /wd4711 /wd4640 /wd4061 /wd4826 /wd4946 /wd4917 /wd4986 /wd4987 /d2Zi+</AdditionalOptions> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>./../../include;./../../../platform/include;./../../../framework/include;./../../../../PxToolkit/include;./../../../../../Source/Common/include;./../../../../../Source/Common/include/windows;./../../../../../Include;./../../../../../../PxShared/include;./../../../../../../PxShared/src/foundation/include;$(DXSDK_DIR)/Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>PHYSX_PROFILE_SDK;WIN32;WIN64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;_DEBUG;PX_DEBUG=1;PX_CHECKED=1;PX_NVTX=1;PX_SUPPORT_PVD=1;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ExceptionHandling>false</ExceptionHandling> + <WarningLevel>Level4</WarningLevel> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeader>NotUsing</PrecompiledHeader> + <PrecompiledHeaderFile></PrecompiledHeaderFile> + <ProgramDataBaseFileName>$(TargetDir)\$(TargetName).pdb</ProgramDataBaseFileName> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Lib> + <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)$(ProjectName)DEBUG.lib</OutputFile> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <ProgramDatabaseFile>$(TargetDir)\$(TargetName).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>./x64/SampleRenderer-MT/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> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FloatingPointModel>Fast</FloatingPointModel> + <AdditionalOptions>/EHsc /MP /Wall /wd4514 /wd4820 /wd4062 /wd4100 /wd4130 /wd4201 /wd4242 /wd4244 /wd4245 /wd4265 /wd4266 /wd4324 /wd4389 /wd4365 /wd4371 /wd4447 /wd4189 /wd4191 /wd4350 /wd4505 /wd4512 /wd4548 /wd4571 /wd4625 /wd4626 /wd4668 /wd4619 /wd4701 /wd4702 /wd4706 /wd4710 /wd4711 /wd4640 /wd4061 /wd4826 /wd4946 /wd4917 /wd4986 /wd4987 /d2Zi+</AdditionalOptions> + <Optimization>Full</Optimization> + <AdditionalIncludeDirectories>./../../include;./../../../platform/include;./../../../framework/include;./../../../../PxToolkit/include;./../../../../../Source/Common/include;./../../../../../Source/Common/include/windows;./../../../../../Include;./../../../../../../PxShared/include;./../../../../../../PxShared/src/foundation/include;$(DXSDK_DIR)/Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>PHYSX_PROFILE_SDK;WIN32;WIN64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;NDEBUG;PX_SUPPORT_PVD=0;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ExceptionHandling>false</ExceptionHandling> + <WarningLevel>Level4</WarningLevel> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <PrecompiledHeader>NotUsing</PrecompiledHeader> + <PrecompiledHeaderFile></PrecompiledHeaderFile> + <ProgramDataBaseFileName>$(TargetDir)\$(TargetName).pdb</ProgramDataBaseFileName> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Lib> + <AdditionalOptions>/INCREMENTAL:NO</AdditionalOptions> + <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)$(ProjectName).lib</OutputFile> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <ProgramDatabaseFile>$(TargetDir)\$(TargetName).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>./x64/SampleRenderer-MT/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> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FloatingPointModel>Fast</FloatingPointModel> + <AdditionalOptions>/EHsc /MP /Wall /wd4514 /wd4820 /wd4062 /wd4100 /wd4130 /wd4201 /wd4242 /wd4244 /wd4245 /wd4265 /wd4266 /wd4324 /wd4389 /wd4365 /wd4371 /wd4447 /wd4189 /wd4191 /wd4350 /wd4505 /wd4512 /wd4548 /wd4571 /wd4625 /wd4626 /wd4668 /wd4619 /wd4701 /wd4702 /wd4706 /wd4710 /wd4711 /wd4640 /wd4061 /wd4826 /wd4946 /wd4917 /wd4986 /wd4987 /d2Zi+</AdditionalOptions> + <Optimization>Full</Optimization> + <AdditionalIncludeDirectories>./../../include;./../../../platform/include;./../../../framework/include;./../../../../PxToolkit/include;./../../../../../Source/Common/include;./../../../../../Source/Common/include/windows;./../../../../../Include;./../../../../../../PxShared/include;./../../../../../../PxShared/src/foundation/include;$(DXSDK_DIR)/Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>PHYSX_PROFILE_SDK;WIN32;WIN64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;NDEBUG;PX_CHECKED=1;PX_NVTX=1;PX_SUPPORT_PVD=1;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ExceptionHandling>false</ExceptionHandling> + <WarningLevel>Level4</WarningLevel> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <PrecompiledHeader>NotUsing</PrecompiledHeader> + <PrecompiledHeaderFile></PrecompiledHeaderFile> + <ProgramDataBaseFileName>$(TargetDir)\$(TargetName).pdb</ProgramDataBaseFileName> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Lib> + <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)$(ProjectName)CHECKED.lib</OutputFile> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <ProgramDatabaseFile>$(TargetDir)\$(TargetName).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>./x64/SampleRenderer-MT/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> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FloatingPointModel>Fast</FloatingPointModel> + <AdditionalOptions>/EHsc /MP /Wall /wd4514 /wd4820 /wd4062 /wd4100 /wd4130 /wd4201 /wd4242 /wd4244 /wd4245 /wd4265 /wd4266 /wd4324 /wd4389 /wd4365 /wd4371 /wd4447 /wd4189 /wd4191 /wd4350 /wd4505 /wd4512 /wd4548 /wd4571 /wd4625 /wd4626 /wd4668 /wd4619 /wd4701 /wd4702 /wd4706 /wd4710 /wd4711 /wd4640 /wd4061 /wd4826 /wd4946 /wd4917 /wd4986 /wd4987 /d2Zi+</AdditionalOptions> + <Optimization>Full</Optimization> + <AdditionalIncludeDirectories>./../../include;./../../../platform/include;./../../../framework/include;./../../../../PxToolkit/include;./../../../../../Source/Common/include;./../../../../../Source/Common/include/windows;./../../../../../Include;./../../../../../../PxShared/include;./../../../../../../PxShared/src/foundation/include;$(DXSDK_DIR)/Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>PHYSX_PROFILE_SDK;WIN32;WIN64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;NDEBUG;PX_PROFILE=1;PX_NVTX=1;PX_SUPPORT_PVD=1;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ExceptionHandling>false</ExceptionHandling> + <WarningLevel>Level4</WarningLevel> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <PrecompiledHeader>NotUsing</PrecompiledHeader> + <PrecompiledHeaderFile></PrecompiledHeaderFile> + <ProgramDataBaseFileName>$(TargetDir)\$(TargetName).pdb</ProgramDataBaseFileName> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Lib> + <AdditionalOptions>/INCREMENTAL:NO</AdditionalOptions> + <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)$(ProjectName)PROFILE.lib</OutputFile> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <ProgramDatabaseFile>$(TargetDir)\$(TargetName).pdb</ProgramDatabaseFile> + <TargetMachine>MachineX64</TargetMachine> + </Lib> + <ResourceCompile> + </ResourceCompile> + <ProjectReference> + <LinkLibraryDependencies>true</LinkLibraryDependencies> + </ProjectReference> + </ItemDefinitionGroup> + <ItemGroup> + <ClInclude Include="..\..\include\windows\WindowsGLIncludes.h"> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\include\GLIncludes.h"> + </ClInclude> + <ClInclude Include="..\..\include\Renderer.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererBoxShape.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererCapsuleShape.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererClothShape.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererColor.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererConfig.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererDesc.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererDirectionalLight.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererDirectionalLightDesc.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererFoundation.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererGridShape.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererIndexBuffer.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererIndexBufferDesc.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererInstanceBuffer.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererInstanceBufferDesc.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererInteropableBuffer.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererLight.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererLightDesc.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererMaterial.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererMaterialDesc.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererMaterialInstance.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererMemoryMacros.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererMesh.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererMeshContext.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererMeshDesc.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererMeshShape.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererParticleSystemShape.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererProjection.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererShape.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererSimpleParticleSystemShape.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererSpotLight.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererSpotLightDesc.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererTarget.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererTargetDesc.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererTerrainShape.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererTexture.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererTexture2D.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererTexture2DDesc.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererTextureDesc.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererUtils.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererVertexBuffer.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererVertexBufferDesc.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererWindow.h"> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\src\ogl\OGLRenderer.h"> + </ClInclude> + <ClInclude Include="..\..\src\ogl\OGLRendererDirectionalLight.h"> + </ClInclude> + <ClInclude Include="..\..\src\ogl\OGLRendererIndexBuffer.h"> + </ClInclude> + <ClInclude Include="..\..\src\ogl\OGLRendererInstanceBuffer.h"> + </ClInclude> + <ClInclude Include="..\..\src\ogl\OGLRendererMaterial.h"> + </ClInclude> + <ClInclude Include="..\..\src\ogl\OGLRendererMesh.h"> + </ClInclude> + <ClInclude Include="..\..\src\ogl\OGLRendererSpotLight.h"> + </ClInclude> + <ClInclude Include="..\..\src\ogl\OGLRendererTexture2D.h"> + </ClInclude> + <ClInclude Include="..\..\src\ogl\OGLRendererVertexBuffer.h"> + </ClInclude> + <ClCompile Include="..\..\src\ogl\OGLRenderer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\ogl\OGLRendererDirectionalLight.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\ogl\OGLRendererIndexBuffer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\ogl\OGLRendererInstanceBuffer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\ogl\OGLRendererMaterial.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\ogl\OGLRendererMesh.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\ogl\OGLRendererSpotLight.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\ogl\OGLRendererTexture2D.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\ogl\OGLRendererVertexBuffer.cpp"> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\src\d3d9\D3D9Renderer.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d9\D3D9RendererDirectionalLight.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d9\D3D9RendererIndexBuffer.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d9\D3D9RendererInstanceBuffer.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d9\D3D9RendererMaterial.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d9\D3D9RendererMesh.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d9\D3D9RendererSpotLight.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d9\D3D9RendererTarget.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d9\D3D9RendererTexture2D.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d9\D3D9RendererVertexBuffer.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d9\D3D9WPFRenderer.h"> + </ClInclude> + <ClCompile Include="..\..\src\d3d9\D3D9Renderer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d9\D3D9RendererDirectionalLight.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d9\D3D9RendererIndexBuffer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d9\D3D9RendererInstanceBuffer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d9\D3D9RendererMaterial.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d9\D3D9RendererMesh.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d9\D3D9RendererSpotLight.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d9\D3D9RendererTarget.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d9\D3D9RendererTexture2D.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d9\D3D9RendererVertexBuffer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d9\D3D9WPFRenderer.cpp"> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\src\d3d11\D3D11Renderer.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererDirectionalLight.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererIndexBuffer.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererInstanceBuffer.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererMaterial.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererMemoryMacros.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererMesh.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererResourceManager.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererSpotLight.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererTarget.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererTexture2D.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererTexture3D.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererTextureCommon.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererTraits.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererUtils.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererVariableManager.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererVertexBuffer.h"> + </ClInclude> + <ClCompile Include="..\..\src\d3d11\D3D11Renderer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d11\D3D11RendererDirectionalLight.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d11\D3D11RendererIndexBuffer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d11\D3D11RendererInstanceBuffer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d11\D3D11RendererMaterial.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d11\D3D11RendererMesh.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d11\D3D11RendererSpotLight.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d11\D3D11RendererTarget.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d11\D3D11RendererTexture2D.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d11\D3D11RendererTexture3D.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d11\D3D11RendererUtils.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d11\D3D11RendererVariableManager.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d11\D3D11RendererVertexBuffer.cpp"> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\src\null\NULLRenderer.h"> + </ClInclude> + <ClInclude Include="..\..\src\null\NULLRendererDirectionalLight.h"> + </ClInclude> + <ClInclude Include="..\..\src\null\NULLRendererIndexBuffer.h"> + </ClInclude> + <ClInclude Include="..\..\src\null\NULLRendererInstanceBuffer.h"> + </ClInclude> + <ClInclude Include="..\..\src\null\NULLRendererMaterial.h"> + </ClInclude> + <ClInclude Include="..\..\src\null\NULLRendererMesh.h"> + </ClInclude> + <ClInclude Include="..\..\src\null\NULLRendererSpotLight.h"> + </ClInclude> + <ClInclude Include="..\..\src\null\NULLRendererTexture2D.h"> + </ClInclude> + <ClInclude Include="..\..\src\null\NULLRendererVertexBuffer.h"> + </ClInclude> + <ClCompile Include="..\..\src\null\NULLRenderer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\null\NULLRendererDirectionalLight.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\null\NULLRendererIndexBuffer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\null\NULLRendererInstanceBuffer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\null\NULLRendererMaterial.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\null\NULLRendererMesh.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\null\NULLRendererSpotLight.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\null\NULLRendererTexture2D.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\null\NULLRendererVertexBuffer.cpp"> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\src\Renderer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererBoxShape.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererCapsuleShape.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererClothShape.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererColor.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererDesc.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererDirectionalLight.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererDirectionalLightDesc.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererGridShape.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererIndexBuffer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererIndexBufferDesc.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererInstanceBuffer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererInstanceBufferDesc.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererLight.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererLightDesc.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererMaterial.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererMaterialDesc.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererMaterialInstance.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererMesh.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererMeshContext.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererMeshDesc.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererMeshShape.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererParticleSystemShape.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererProjection.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererShape.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererSimpleParticleSystemShape.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererSpotLight.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererSpotLightDesc.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererTarget.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererTargetDesc.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererTerrainShape.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererTexture.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererTexture2D.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererTexture2DDesc.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererTextureDesc.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererVertexBuffer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererVertexBufferDesc.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererWindow.cpp"> + </ClCompile> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"></ImportGroup> +</Project> diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/compiler/vc12win32/SampleRenderer-MT.vcxproj b/PhysX_3.4/Samples/SampleFramework/renderer/compiler/vc12win32/SampleRenderer-MT.vcxproj new file mode 100644 index 00000000..4bd30eee --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/compiler/vc12win32/SampleRenderer-MT.vcxproj @@ -0,0 +1,586 @@ +<?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="checked|Win32"> + <Configuration>checked</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="profile|Win32"> + <Configuration>profile</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{67A61354-2C14-B851-8530-DDD43BDC1D9C}</ProjectGuid> + <RootNamespace>SampleRenderer-MT</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)'=='checked|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> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup 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" /> + </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" /> + </ImportGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> + <OutDir>./../../lib/vc12win32\</OutDir> + <IntDir>./Win32/SampleRenderer-MT/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> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FloatingPointModel>Fast</FloatingPointModel> + <BasicRuntimeChecks>UninitializedLocalUsageCheck</BasicRuntimeChecks> + <AdditionalOptions>/EHsc /MP /Wall /wd4514 /wd4820 /wd4062 /wd4100 /wd4130 /wd4201 /wd4242 /wd4244 /wd4245 /wd4265 /wd4266 /wd4324 /wd4389 /wd4365 /wd4371 /wd4447 /wd4189 /wd4191 /wd4350 /wd4505 /wd4512 /wd4548 /wd4571 /wd4625 /wd4626 /wd4668 /wd4619 /wd4701 /wd4702 /wd4706 /wd4710 /wd4711 /wd4640 /wd4061 /wd4826 /wd4946 /wd4917 /wd4986 /wd4987 /d2Zi+</AdditionalOptions> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>./../../include;./../../../platform/include;./../../../framework/include;./../../../../PxToolkit/include;./../../../../../Source/Common/include;./../../../../../Source/Common/include/windows;./../../../../../Include;./../../../../../../PxShared/include;./../../../../../../PxShared/src/foundation/include;$(DXSDK_DIR)/Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>PHYSX_PROFILE_SDK;WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;_DEBUG;PX_DEBUG=1;PX_CHECKED=1;PX_NVTX=1;PX_SUPPORT_PVD=1;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ExceptionHandling>false</ExceptionHandling> + <WarningLevel>Level4</WarningLevel> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeader>NotUsing</PrecompiledHeader> + <PrecompiledHeaderFile></PrecompiledHeaderFile> + <ProgramDataBaseFileName>$(TargetDir)\$(TargetName).pdb</ProgramDataBaseFileName> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Lib> + <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)$(ProjectName)DEBUG.lib</OutputFile> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <ProgramDatabaseFile>$(TargetDir)\$(TargetName).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>./Win32/SampleRenderer-MT/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> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FloatingPointModel>Fast</FloatingPointModel> + <AdditionalOptions>/EHsc /MP /Wall /wd4514 /wd4820 /wd4062 /wd4100 /wd4130 /wd4201 /wd4242 /wd4244 /wd4245 /wd4265 /wd4266 /wd4324 /wd4389 /wd4365 /wd4371 /wd4447 /wd4189 /wd4191 /wd4350 /wd4505 /wd4512 /wd4548 /wd4571 /wd4625 /wd4626 /wd4668 /wd4619 /wd4701 /wd4702 /wd4706 /wd4710 /wd4711 /wd4640 /wd4061 /wd4826 /wd4946 /wd4917 /wd4986 /wd4987 /d2Zi+</AdditionalOptions> + <Optimization>Full</Optimization> + <AdditionalIncludeDirectories>./../../include;./../../../platform/include;./../../../framework/include;./../../../../PxToolkit/include;./../../../../../Source/Common/include;./../../../../../Source/Common/include/windows;./../../../../../Include;./../../../../../../PxShared/include;./../../../../../../PxShared/src/foundation/include;$(DXSDK_DIR)/Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>PHYSX_PROFILE_SDK;WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;NDEBUG;PX_SUPPORT_PVD=0;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ExceptionHandling>false</ExceptionHandling> + <WarningLevel>Level4</WarningLevel> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <PrecompiledHeader>NotUsing</PrecompiledHeader> + <PrecompiledHeaderFile></PrecompiledHeaderFile> + <ProgramDataBaseFileName>$(TargetDir)\$(TargetName).pdb</ProgramDataBaseFileName> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Lib> + <AdditionalOptions>/INCREMENTAL:NO</AdditionalOptions> + <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)$(ProjectName).lib</OutputFile> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <ProgramDatabaseFile>$(TargetDir)\$(TargetName).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>./Win32/SampleRenderer-MT/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> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FloatingPointModel>Fast</FloatingPointModel> + <AdditionalOptions>/EHsc /MP /Wall /wd4514 /wd4820 /wd4062 /wd4100 /wd4130 /wd4201 /wd4242 /wd4244 /wd4245 /wd4265 /wd4266 /wd4324 /wd4389 /wd4365 /wd4371 /wd4447 /wd4189 /wd4191 /wd4350 /wd4505 /wd4512 /wd4548 /wd4571 /wd4625 /wd4626 /wd4668 /wd4619 /wd4701 /wd4702 /wd4706 /wd4710 /wd4711 /wd4640 /wd4061 /wd4826 /wd4946 /wd4917 /wd4986 /wd4987 /d2Zi+</AdditionalOptions> + <Optimization>Full</Optimization> + <AdditionalIncludeDirectories>./../../include;./../../../platform/include;./../../../framework/include;./../../../../PxToolkit/include;./../../../../../Source/Common/include;./../../../../../Source/Common/include/windows;./../../../../../Include;./../../../../../../PxShared/include;./../../../../../../PxShared/src/foundation/include;$(DXSDK_DIR)/Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>PHYSX_PROFILE_SDK;WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;NDEBUG;PX_CHECKED=1;PX_NVTX=1;PX_SUPPORT_PVD=1;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ExceptionHandling>false</ExceptionHandling> + <WarningLevel>Level4</WarningLevel> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <PrecompiledHeader>NotUsing</PrecompiledHeader> + <PrecompiledHeaderFile></PrecompiledHeaderFile> + <ProgramDataBaseFileName>$(TargetDir)\$(TargetName).pdb</ProgramDataBaseFileName> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Lib> + <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)$(ProjectName)CHECKED.lib</OutputFile> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <ProgramDatabaseFile>$(TargetDir)\$(TargetName).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>./Win32/SampleRenderer-MT/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> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FloatingPointModel>Fast</FloatingPointModel> + <AdditionalOptions>/EHsc /MP /Wall /wd4514 /wd4820 /wd4062 /wd4100 /wd4130 /wd4201 /wd4242 /wd4244 /wd4245 /wd4265 /wd4266 /wd4324 /wd4389 /wd4365 /wd4371 /wd4447 /wd4189 /wd4191 /wd4350 /wd4505 /wd4512 /wd4548 /wd4571 /wd4625 /wd4626 /wd4668 /wd4619 /wd4701 /wd4702 /wd4706 /wd4710 /wd4711 /wd4640 /wd4061 /wd4826 /wd4946 /wd4917 /wd4986 /wd4987 /d2Zi+</AdditionalOptions> + <Optimization>Full</Optimization> + <AdditionalIncludeDirectories>./../../include;./../../../platform/include;./../../../framework/include;./../../../../PxToolkit/include;./../../../../../Source/Common/include;./../../../../../Source/Common/include/windows;./../../../../../Include;./../../../../../../PxShared/include;./../../../../../../PxShared/src/foundation/include;$(DXSDK_DIR)/Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>PHYSX_PROFILE_SDK;WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;NDEBUG;PX_PROFILE=1;PX_NVTX=1;PX_SUPPORT_PVD=1;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ExceptionHandling>false</ExceptionHandling> + <WarningLevel>Level4</WarningLevel> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <PrecompiledHeader>NotUsing</PrecompiledHeader> + <PrecompiledHeaderFile></PrecompiledHeaderFile> + <ProgramDataBaseFileName>$(TargetDir)\$(TargetName).pdb</ProgramDataBaseFileName> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Lib> + <AdditionalOptions>/INCREMENTAL:NO</AdditionalOptions> + <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)$(ProjectName)PROFILE.lib</OutputFile> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <ProgramDatabaseFile>$(TargetDir)\$(TargetName).pdb</ProgramDatabaseFile> + <TargetMachine>MachineX86</TargetMachine> + </Lib> + <ResourceCompile> + </ResourceCompile> + <ProjectReference> + <LinkLibraryDependencies>true</LinkLibraryDependencies> + </ProjectReference> + </ItemDefinitionGroup> + <ItemGroup> + <ClInclude Include="..\..\include\windows\WindowsGLIncludes.h"> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\include\GLIncludes.h"> + </ClInclude> + <ClInclude Include="..\..\include\Renderer.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererBoxShape.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererCapsuleShape.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererClothShape.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererColor.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererConfig.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererDesc.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererDirectionalLight.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererDirectionalLightDesc.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererFoundation.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererGridShape.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererIndexBuffer.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererIndexBufferDesc.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererInstanceBuffer.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererInstanceBufferDesc.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererInteropableBuffer.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererLight.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererLightDesc.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererMaterial.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererMaterialDesc.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererMaterialInstance.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererMemoryMacros.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererMesh.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererMeshContext.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererMeshDesc.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererMeshShape.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererParticleSystemShape.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererProjection.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererShape.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererSimpleParticleSystemShape.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererSpotLight.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererSpotLightDesc.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererTarget.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererTargetDesc.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererTerrainShape.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererTexture.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererTexture2D.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererTexture2DDesc.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererTextureDesc.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererUtils.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererVertexBuffer.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererVertexBufferDesc.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererWindow.h"> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\src\ogl\OGLRenderer.h"> + </ClInclude> + <ClInclude Include="..\..\src\ogl\OGLRendererDirectionalLight.h"> + </ClInclude> + <ClInclude Include="..\..\src\ogl\OGLRendererIndexBuffer.h"> + </ClInclude> + <ClInclude Include="..\..\src\ogl\OGLRendererInstanceBuffer.h"> + </ClInclude> + <ClInclude Include="..\..\src\ogl\OGLRendererMaterial.h"> + </ClInclude> + <ClInclude Include="..\..\src\ogl\OGLRendererMesh.h"> + </ClInclude> + <ClInclude Include="..\..\src\ogl\OGLRendererSpotLight.h"> + </ClInclude> + <ClInclude Include="..\..\src\ogl\OGLRendererTexture2D.h"> + </ClInclude> + <ClInclude Include="..\..\src\ogl\OGLRendererVertexBuffer.h"> + </ClInclude> + <ClCompile Include="..\..\src\ogl\OGLRenderer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\ogl\OGLRendererDirectionalLight.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\ogl\OGLRendererIndexBuffer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\ogl\OGLRendererInstanceBuffer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\ogl\OGLRendererMaterial.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\ogl\OGLRendererMesh.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\ogl\OGLRendererSpotLight.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\ogl\OGLRendererTexture2D.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\ogl\OGLRendererVertexBuffer.cpp"> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\src\d3d9\D3D9Renderer.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d9\D3D9RendererDirectionalLight.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d9\D3D9RendererIndexBuffer.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d9\D3D9RendererInstanceBuffer.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d9\D3D9RendererMaterial.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d9\D3D9RendererMesh.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d9\D3D9RendererSpotLight.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d9\D3D9RendererTarget.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d9\D3D9RendererTexture2D.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d9\D3D9RendererVertexBuffer.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d9\D3D9WPFRenderer.h"> + </ClInclude> + <ClCompile Include="..\..\src\d3d9\D3D9Renderer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d9\D3D9RendererDirectionalLight.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d9\D3D9RendererIndexBuffer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d9\D3D9RendererInstanceBuffer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d9\D3D9RendererMaterial.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d9\D3D9RendererMesh.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d9\D3D9RendererSpotLight.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d9\D3D9RendererTarget.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d9\D3D9RendererTexture2D.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d9\D3D9RendererVertexBuffer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d9\D3D9WPFRenderer.cpp"> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\src\d3d11\D3D11Renderer.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererDirectionalLight.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererIndexBuffer.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererInstanceBuffer.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererMaterial.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererMemoryMacros.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererMesh.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererResourceManager.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererSpotLight.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererTarget.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererTexture2D.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererTexture3D.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererTextureCommon.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererTraits.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererUtils.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererVariableManager.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererVertexBuffer.h"> + </ClInclude> + <ClCompile Include="..\..\src\d3d11\D3D11Renderer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d11\D3D11RendererDirectionalLight.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d11\D3D11RendererIndexBuffer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d11\D3D11RendererInstanceBuffer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d11\D3D11RendererMaterial.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d11\D3D11RendererMesh.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d11\D3D11RendererSpotLight.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d11\D3D11RendererTarget.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d11\D3D11RendererTexture2D.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d11\D3D11RendererTexture3D.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d11\D3D11RendererUtils.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d11\D3D11RendererVariableManager.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d11\D3D11RendererVertexBuffer.cpp"> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\src\null\NULLRenderer.h"> + </ClInclude> + <ClInclude Include="..\..\src\null\NULLRendererDirectionalLight.h"> + </ClInclude> + <ClInclude Include="..\..\src\null\NULLRendererIndexBuffer.h"> + </ClInclude> + <ClInclude Include="..\..\src\null\NULLRendererInstanceBuffer.h"> + </ClInclude> + <ClInclude Include="..\..\src\null\NULLRendererMaterial.h"> + </ClInclude> + <ClInclude Include="..\..\src\null\NULLRendererMesh.h"> + </ClInclude> + <ClInclude Include="..\..\src\null\NULLRendererSpotLight.h"> + </ClInclude> + <ClInclude Include="..\..\src\null\NULLRendererTexture2D.h"> + </ClInclude> + <ClInclude Include="..\..\src\null\NULLRendererVertexBuffer.h"> + </ClInclude> + <ClCompile Include="..\..\src\null\NULLRenderer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\null\NULLRendererDirectionalLight.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\null\NULLRendererIndexBuffer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\null\NULLRendererInstanceBuffer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\null\NULLRendererMaterial.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\null\NULLRendererMesh.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\null\NULLRendererSpotLight.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\null\NULLRendererTexture2D.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\null\NULLRendererVertexBuffer.cpp"> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\src\Renderer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererBoxShape.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererCapsuleShape.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererClothShape.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererColor.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererDesc.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererDirectionalLight.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererDirectionalLightDesc.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererGridShape.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererIndexBuffer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererIndexBufferDesc.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererInstanceBuffer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererInstanceBufferDesc.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererLight.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererLightDesc.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererMaterial.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererMaterialDesc.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererMaterialInstance.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererMesh.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererMeshContext.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererMeshDesc.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererMeshShape.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererParticleSystemShape.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererProjection.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererShape.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererSimpleParticleSystemShape.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererSpotLight.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererSpotLightDesc.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererTarget.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererTargetDesc.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererTerrainShape.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererTexture.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererTexture2D.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererTexture2DDesc.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererTextureDesc.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererVertexBuffer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererVertexBufferDesc.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererWindow.cpp"> + </ClCompile> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"></ImportGroup> +</Project> diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/compiler/vc12win64/SampleRenderer-MT.vcxproj b/PhysX_3.4/Samples/SampleFramework/renderer/compiler/vc12win64/SampleRenderer-MT.vcxproj new file mode 100644 index 00000000..749f5a22 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/compiler/vc12win64/SampleRenderer-MT.vcxproj @@ -0,0 +1,582 @@ +<?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="checked|x64"> + <Configuration>checked</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="profile|x64"> + <Configuration>profile</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{67A61354-2C14-B851-8530-DDD43BDC1D9C}</ProjectGuid> + <RootNamespace>SampleRenderer-MT</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)'=='checked|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> + <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" /> + </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" /> + </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" /> + </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" /> + </ImportGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> + <OutDir>./../../lib/vc12win64\</OutDir> + <IntDir>./x64/SampleRenderer-MT/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> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FloatingPointModel>Fast</FloatingPointModel> + <BasicRuntimeChecks>UninitializedLocalUsageCheck</BasicRuntimeChecks> + <AdditionalOptions>/EHsc /MP /Wall /wd4514 /wd4820 /wd4062 /wd4100 /wd4130 /wd4201 /wd4242 /wd4244 /wd4245 /wd4265 /wd4266 /wd4324 /wd4389 /wd4365 /wd4371 /wd4447 /wd4189 /wd4191 /wd4350 /wd4505 /wd4512 /wd4548 /wd4571 /wd4625 /wd4626 /wd4668 /wd4619 /wd4701 /wd4702 /wd4706 /wd4710 /wd4711 /wd4640 /wd4061 /wd4826 /wd4946 /wd4917 /wd4986 /wd4987 /d2Zi+</AdditionalOptions> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>./../../include;./../../../platform/include;./../../../framework/include;./../../../../PxToolkit/include;./../../../../../Source/Common/include;./../../../../../Source/Common/include/windows;./../../../../../Include;./../../../../../../PxShared/include;./../../../../../../PxShared/src/foundation/include;$(DXSDK_DIR)/Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>PHYSX_PROFILE_SDK;WIN32;WIN64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;_DEBUG;PX_DEBUG=1;PX_CHECKED=1;PX_NVTX=1;PX_SUPPORT_PVD=1;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ExceptionHandling>false</ExceptionHandling> + <WarningLevel>Level4</WarningLevel> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeader>NotUsing</PrecompiledHeader> + <PrecompiledHeaderFile></PrecompiledHeaderFile> + <ProgramDataBaseFileName>$(TargetDir)\$(TargetName).pdb</ProgramDataBaseFileName> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Lib> + <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)$(ProjectName)DEBUG.lib</OutputFile> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <ProgramDatabaseFile>$(TargetDir)\$(TargetName).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>./x64/SampleRenderer-MT/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> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FloatingPointModel>Fast</FloatingPointModel> + <AdditionalOptions>/EHsc /MP /Wall /wd4514 /wd4820 /wd4062 /wd4100 /wd4130 /wd4201 /wd4242 /wd4244 /wd4245 /wd4265 /wd4266 /wd4324 /wd4389 /wd4365 /wd4371 /wd4447 /wd4189 /wd4191 /wd4350 /wd4505 /wd4512 /wd4548 /wd4571 /wd4625 /wd4626 /wd4668 /wd4619 /wd4701 /wd4702 /wd4706 /wd4710 /wd4711 /wd4640 /wd4061 /wd4826 /wd4946 /wd4917 /wd4986 /wd4987 /d2Zi+</AdditionalOptions> + <Optimization>Full</Optimization> + <AdditionalIncludeDirectories>./../../include;./../../../platform/include;./../../../framework/include;./../../../../PxToolkit/include;./../../../../../Source/Common/include;./../../../../../Source/Common/include/windows;./../../../../../Include;./../../../../../../PxShared/include;./../../../../../../PxShared/src/foundation/include;$(DXSDK_DIR)/Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>PHYSX_PROFILE_SDK;WIN32;WIN64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;NDEBUG;PX_SUPPORT_PVD=0;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ExceptionHandling>false</ExceptionHandling> + <WarningLevel>Level4</WarningLevel> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <PrecompiledHeader>NotUsing</PrecompiledHeader> + <PrecompiledHeaderFile></PrecompiledHeaderFile> + <ProgramDataBaseFileName>$(TargetDir)\$(TargetName).pdb</ProgramDataBaseFileName> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Lib> + <AdditionalOptions>/INCREMENTAL:NO</AdditionalOptions> + <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)$(ProjectName).lib</OutputFile> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <ProgramDatabaseFile>$(TargetDir)\$(TargetName).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>./x64/SampleRenderer-MT/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> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FloatingPointModel>Fast</FloatingPointModel> + <AdditionalOptions>/EHsc /MP /Wall /wd4514 /wd4820 /wd4062 /wd4100 /wd4130 /wd4201 /wd4242 /wd4244 /wd4245 /wd4265 /wd4266 /wd4324 /wd4389 /wd4365 /wd4371 /wd4447 /wd4189 /wd4191 /wd4350 /wd4505 /wd4512 /wd4548 /wd4571 /wd4625 /wd4626 /wd4668 /wd4619 /wd4701 /wd4702 /wd4706 /wd4710 /wd4711 /wd4640 /wd4061 /wd4826 /wd4946 /wd4917 /wd4986 /wd4987 /d2Zi+</AdditionalOptions> + <Optimization>Full</Optimization> + <AdditionalIncludeDirectories>./../../include;./../../../platform/include;./../../../framework/include;./../../../../PxToolkit/include;./../../../../../Source/Common/include;./../../../../../Source/Common/include/windows;./../../../../../Include;./../../../../../../PxShared/include;./../../../../../../PxShared/src/foundation/include;$(DXSDK_DIR)/Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>PHYSX_PROFILE_SDK;WIN32;WIN64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;NDEBUG;PX_CHECKED=1;PX_NVTX=1;PX_SUPPORT_PVD=1;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ExceptionHandling>false</ExceptionHandling> + <WarningLevel>Level4</WarningLevel> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <PrecompiledHeader>NotUsing</PrecompiledHeader> + <PrecompiledHeaderFile></PrecompiledHeaderFile> + <ProgramDataBaseFileName>$(TargetDir)\$(TargetName).pdb</ProgramDataBaseFileName> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Lib> + <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)$(ProjectName)CHECKED.lib</OutputFile> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <ProgramDatabaseFile>$(TargetDir)\$(TargetName).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>./x64/SampleRenderer-MT/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> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FloatingPointModel>Fast</FloatingPointModel> + <AdditionalOptions>/EHsc /MP /Wall /wd4514 /wd4820 /wd4062 /wd4100 /wd4130 /wd4201 /wd4242 /wd4244 /wd4245 /wd4265 /wd4266 /wd4324 /wd4389 /wd4365 /wd4371 /wd4447 /wd4189 /wd4191 /wd4350 /wd4505 /wd4512 /wd4548 /wd4571 /wd4625 /wd4626 /wd4668 /wd4619 /wd4701 /wd4702 /wd4706 /wd4710 /wd4711 /wd4640 /wd4061 /wd4826 /wd4946 /wd4917 /wd4986 /wd4987 /d2Zi+</AdditionalOptions> + <Optimization>Full</Optimization> + <AdditionalIncludeDirectories>./../../include;./../../../platform/include;./../../../framework/include;./../../../../PxToolkit/include;./../../../../../Source/Common/include;./../../../../../Source/Common/include/windows;./../../../../../Include;./../../../../../../PxShared/include;./../../../../../../PxShared/src/foundation/include;$(DXSDK_DIR)/Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>PHYSX_PROFILE_SDK;WIN32;WIN64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;NDEBUG;PX_PROFILE=1;PX_NVTX=1;PX_SUPPORT_PVD=1;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ExceptionHandling>false</ExceptionHandling> + <WarningLevel>Level4</WarningLevel> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <PrecompiledHeader>NotUsing</PrecompiledHeader> + <PrecompiledHeaderFile></PrecompiledHeaderFile> + <ProgramDataBaseFileName>$(TargetDir)\$(TargetName).pdb</ProgramDataBaseFileName> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Lib> + <AdditionalOptions>/INCREMENTAL:NO</AdditionalOptions> + <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)$(ProjectName)PROFILE.lib</OutputFile> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <ProgramDatabaseFile>$(TargetDir)\$(TargetName).pdb</ProgramDatabaseFile> + <TargetMachine>MachineX64</TargetMachine> + </Lib> + <ResourceCompile> + </ResourceCompile> + <ProjectReference> + <LinkLibraryDependencies>true</LinkLibraryDependencies> + </ProjectReference> + </ItemDefinitionGroup> + <ItemGroup> + <ClInclude Include="..\..\include\windows\WindowsGLIncludes.h"> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\include\GLIncludes.h"> + </ClInclude> + <ClInclude Include="..\..\include\Renderer.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererBoxShape.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererCapsuleShape.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererClothShape.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererColor.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererConfig.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererDesc.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererDirectionalLight.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererDirectionalLightDesc.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererFoundation.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererGridShape.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererIndexBuffer.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererIndexBufferDesc.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererInstanceBuffer.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererInstanceBufferDesc.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererInteropableBuffer.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererLight.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererLightDesc.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererMaterial.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererMaterialDesc.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererMaterialInstance.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererMemoryMacros.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererMesh.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererMeshContext.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererMeshDesc.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererMeshShape.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererParticleSystemShape.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererProjection.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererShape.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererSimpleParticleSystemShape.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererSpotLight.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererSpotLightDesc.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererTarget.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererTargetDesc.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererTerrainShape.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererTexture.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererTexture2D.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererTexture2DDesc.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererTextureDesc.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererUtils.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererVertexBuffer.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererVertexBufferDesc.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererWindow.h"> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\src\ogl\OGLRenderer.h"> + </ClInclude> + <ClInclude Include="..\..\src\ogl\OGLRendererDirectionalLight.h"> + </ClInclude> + <ClInclude Include="..\..\src\ogl\OGLRendererIndexBuffer.h"> + </ClInclude> + <ClInclude Include="..\..\src\ogl\OGLRendererInstanceBuffer.h"> + </ClInclude> + <ClInclude Include="..\..\src\ogl\OGLRendererMaterial.h"> + </ClInclude> + <ClInclude Include="..\..\src\ogl\OGLRendererMesh.h"> + </ClInclude> + <ClInclude Include="..\..\src\ogl\OGLRendererSpotLight.h"> + </ClInclude> + <ClInclude Include="..\..\src\ogl\OGLRendererTexture2D.h"> + </ClInclude> + <ClInclude Include="..\..\src\ogl\OGLRendererVertexBuffer.h"> + </ClInclude> + <ClCompile Include="..\..\src\ogl\OGLRenderer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\ogl\OGLRendererDirectionalLight.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\ogl\OGLRendererIndexBuffer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\ogl\OGLRendererInstanceBuffer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\ogl\OGLRendererMaterial.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\ogl\OGLRendererMesh.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\ogl\OGLRendererSpotLight.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\ogl\OGLRendererTexture2D.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\ogl\OGLRendererVertexBuffer.cpp"> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\src\d3d9\D3D9Renderer.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d9\D3D9RendererDirectionalLight.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d9\D3D9RendererIndexBuffer.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d9\D3D9RendererInstanceBuffer.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d9\D3D9RendererMaterial.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d9\D3D9RendererMesh.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d9\D3D9RendererSpotLight.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d9\D3D9RendererTarget.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d9\D3D9RendererTexture2D.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d9\D3D9RendererVertexBuffer.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d9\D3D9WPFRenderer.h"> + </ClInclude> + <ClCompile Include="..\..\src\d3d9\D3D9Renderer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d9\D3D9RendererDirectionalLight.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d9\D3D9RendererIndexBuffer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d9\D3D9RendererInstanceBuffer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d9\D3D9RendererMaterial.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d9\D3D9RendererMesh.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d9\D3D9RendererSpotLight.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d9\D3D9RendererTarget.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d9\D3D9RendererTexture2D.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d9\D3D9RendererVertexBuffer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d9\D3D9WPFRenderer.cpp"> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\src\d3d11\D3D11Renderer.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererDirectionalLight.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererIndexBuffer.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererInstanceBuffer.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererMaterial.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererMemoryMacros.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererMesh.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererResourceManager.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererSpotLight.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererTarget.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererTexture2D.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererTexture3D.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererTextureCommon.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererTraits.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererUtils.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererVariableManager.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererVertexBuffer.h"> + </ClInclude> + <ClCompile Include="..\..\src\d3d11\D3D11Renderer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d11\D3D11RendererDirectionalLight.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d11\D3D11RendererIndexBuffer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d11\D3D11RendererInstanceBuffer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d11\D3D11RendererMaterial.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d11\D3D11RendererMesh.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d11\D3D11RendererSpotLight.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d11\D3D11RendererTarget.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d11\D3D11RendererTexture2D.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d11\D3D11RendererTexture3D.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d11\D3D11RendererUtils.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d11\D3D11RendererVariableManager.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d11\D3D11RendererVertexBuffer.cpp"> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\src\null\NULLRenderer.h"> + </ClInclude> + <ClInclude Include="..\..\src\null\NULLRendererDirectionalLight.h"> + </ClInclude> + <ClInclude Include="..\..\src\null\NULLRendererIndexBuffer.h"> + </ClInclude> + <ClInclude Include="..\..\src\null\NULLRendererInstanceBuffer.h"> + </ClInclude> + <ClInclude Include="..\..\src\null\NULLRendererMaterial.h"> + </ClInclude> + <ClInclude Include="..\..\src\null\NULLRendererMesh.h"> + </ClInclude> + <ClInclude Include="..\..\src\null\NULLRendererSpotLight.h"> + </ClInclude> + <ClInclude Include="..\..\src\null\NULLRendererTexture2D.h"> + </ClInclude> + <ClInclude Include="..\..\src\null\NULLRendererVertexBuffer.h"> + </ClInclude> + <ClCompile Include="..\..\src\null\NULLRenderer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\null\NULLRendererDirectionalLight.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\null\NULLRendererIndexBuffer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\null\NULLRendererInstanceBuffer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\null\NULLRendererMaterial.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\null\NULLRendererMesh.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\null\NULLRendererSpotLight.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\null\NULLRendererTexture2D.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\null\NULLRendererVertexBuffer.cpp"> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\src\Renderer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererBoxShape.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererCapsuleShape.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererClothShape.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererColor.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererDesc.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererDirectionalLight.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererDirectionalLightDesc.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererGridShape.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererIndexBuffer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererIndexBufferDesc.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererInstanceBuffer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererInstanceBufferDesc.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererLight.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererLightDesc.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererMaterial.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererMaterialDesc.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererMaterialInstance.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererMesh.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererMeshContext.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererMeshDesc.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererMeshShape.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererParticleSystemShape.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererProjection.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererShape.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererSimpleParticleSystemShape.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererSpotLight.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererSpotLightDesc.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererTarget.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererTargetDesc.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererTerrainShape.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererTexture.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererTexture2D.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererTexture2DDesc.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererTextureDesc.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererVertexBuffer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererVertexBufferDesc.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererWindow.cpp"> + </ClCompile> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"></ImportGroup> +</Project> diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/compiler/vc14win32/SampleRenderer-MT.vcxproj b/PhysX_3.4/Samples/SampleFramework/renderer/compiler/vc14win32/SampleRenderer-MT.vcxproj new file mode 100644 index 00000000..a36eb6e7 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/compiler/vc14win32/SampleRenderer-MT.vcxproj @@ -0,0 +1,574 @@ +<?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="checked|Win32"> + <Configuration>checked</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="profile|Win32"> + <Configuration>profile</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{67A61354-2C14-B851-8530-DDD43BDC1D9C}</ProjectGuid> + <RootNamespace>SampleRenderer-MT</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)'=='checked|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> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup 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" /> + </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" /> + </ImportGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> + <OutDir>./../../lib/vc14win32\</OutDir> + <IntDir>./Win32/SampleRenderer-MT/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> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FloatingPointModel>Fast</FloatingPointModel> + <BasicRuntimeChecks>UninitializedLocalUsageCheck</BasicRuntimeChecks> + <AdditionalOptions>/EHsc /GR- /GF /arch:SSE2 /MP /Wall /wd4514 /wd4820 /wd4062 /wd4100 /wd4130 /wd4201 /wd4242 /wd4244 /wd4245 /wd4265 /wd4266 /wd4324 /wd4389 /wd4365 /wd4371 /wd4447 /wd4189 /wd4191 /wd4350 /wd4505 /wd4512 /wd4548 /wd4571 /wd4625 /wd4626 /wd4668 /wd4619 /wd4701 /wd4702 /wd4706 /wd4710 /wd4711 /wd4640 /wd4061 /wd4826 /wd4946 /wd4917 /wd4986 /wd4987 /wd4456 /wd4457 /wd4458 /wd4459 /wd4774 /wd4777 /wd5027 /wd5029 /wd4464 /Zi /d2Zi+</AdditionalOptions> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>./../../include;./../../../platform/include;./../../../framework/include;./../../../../PxToolkit/include;./../../../../../Source/Common/include;./../../../../../Source/Common/include/windows;./../../../../../Include;./../../../../../../PxShared/include;./../../../../../../PxShared/src/foundation/include;$(DXSDK_DIR)/Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>PHYSX_PROFILE_SDK;WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;_DEBUG;PX_DEBUG=1;PX_CHECKED=1;PX_NVTX=1;PX_SUPPORT_PVD=1;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ExceptionHandling>false</ExceptionHandling> + <WarningLevel>Level4</WarningLevel> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeader>NotUsing</PrecompiledHeader> + <PrecompiledHeaderFile></PrecompiledHeaderFile> + <ProgramDataBaseFileName>$(TargetDir)\$(TargetName).pdb</ProgramDataBaseFileName> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Lib> + <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)$(ProjectName)DEBUG.lib</OutputFile> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <ProgramDatabaseFile>$(TargetDir)\$(TargetName).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>./Win32/SampleRenderer-MT/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> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FloatingPointModel>Fast</FloatingPointModel> + <AdditionalOptions>/EHsc /GR- /GF /arch:SSE2 /MP /Wall /wd4514 /wd4820 /wd4062 /wd4100 /wd4130 /wd4201 /wd4242 /wd4244 /wd4245 /wd4265 /wd4266 /wd4324 /wd4389 /wd4365 /wd4371 /wd4447 /wd4189 /wd4191 /wd4350 /wd4505 /wd4512 /wd4548 /wd4571 /wd4625 /wd4626 /wd4668 /wd4619 /wd4701 /wd4702 /wd4706 /wd4710 /wd4711 /wd4640 /wd4061 /wd4826 /wd4946 /wd4917 /wd4986 /wd4987 /wd4456 /wd4457 /wd4458 /wd4459 /wd4774 /wd4777 /wd5027 /wd5029 /wd4464 /d2Zi+</AdditionalOptions> + <Optimization>Full</Optimization> + <AdditionalIncludeDirectories>./../../include;./../../../platform/include;./../../../framework/include;./../../../../PxToolkit/include;./../../../../../Source/Common/include;./../../../../../Source/Common/include/windows;./../../../../../Include;./../../../../../../PxShared/include;./../../../../../../PxShared/src/foundation/include;$(DXSDK_DIR)/Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>PHYSX_PROFILE_SDK;WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;NDEBUG;PX_SUPPORT_PVD=0;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ExceptionHandling>false</ExceptionHandling> + <WarningLevel>Level4</WarningLevel> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <PrecompiledHeader>NotUsing</PrecompiledHeader> + <PrecompiledHeaderFile></PrecompiledHeaderFile> + <ProgramDataBaseFileName>$(TargetDir)\$(TargetName).pdb</ProgramDataBaseFileName> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Lib> + <AdditionalOptions>/INCREMENTAL:NO</AdditionalOptions> + <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)$(ProjectName).lib</OutputFile> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <ProgramDatabaseFile>$(TargetDir)\$(TargetName).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>./Win32/SampleRenderer-MT/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> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FloatingPointModel>Fast</FloatingPointModel> + <AdditionalOptions>/EHsc /GR- /GF /arch:SSE2 /MP /Wall /wd4514 /wd4820 /wd4062 /wd4100 /wd4130 /wd4201 /wd4242 /wd4244 /wd4245 /wd4265 /wd4266 /wd4324 /wd4389 /wd4365 /wd4371 /wd4447 /wd4189 /wd4191 /wd4350 /wd4505 /wd4512 /wd4548 /wd4571 /wd4625 /wd4626 /wd4668 /wd4619 /wd4701 /wd4702 /wd4706 /wd4710 /wd4711 /wd4640 /wd4061 /wd4826 /wd4946 /wd4917 /wd4986 /wd4987 /wd4456 /wd4457 /wd4458 /wd4459 /wd4774 /wd4777 /wd5027 /wd5029 /wd4464 /d2Zi+</AdditionalOptions> + <Optimization>Full</Optimization> + <AdditionalIncludeDirectories>./../../include;./../../../platform/include;./../../../framework/include;./../../../../PxToolkit/include;./../../../../../Source/Common/include;./../../../../../Source/Common/include/windows;./../../../../../Include;./../../../../../../PxShared/include;./../../../../../../PxShared/src/foundation/include;$(DXSDK_DIR)/Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>PHYSX_PROFILE_SDK;WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;NDEBUG;PX_CHECKED=1;PX_NVTX=1;PX_SUPPORT_PVD=1;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ExceptionHandling>false</ExceptionHandling> + <WarningLevel>Level4</WarningLevel> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <PrecompiledHeader>NotUsing</PrecompiledHeader> + <PrecompiledHeaderFile></PrecompiledHeaderFile> + <ProgramDataBaseFileName>$(TargetDir)\$(TargetName).pdb</ProgramDataBaseFileName> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Lib> + <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)$(ProjectName)CHECKED.lib</OutputFile> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <ProgramDatabaseFile>$(TargetDir)\$(TargetName).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>./Win32/SampleRenderer-MT/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> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FloatingPointModel>Fast</FloatingPointModel> + <AdditionalOptions>/EHsc /GR- /GF /arch:SSE2 /MP /Wall /wd4514 /wd4820 /wd4062 /wd4100 /wd4130 /wd4201 /wd4242 /wd4244 /wd4245 /wd4265 /wd4266 /wd4324 /wd4389 /wd4365 /wd4371 /wd4447 /wd4189 /wd4191 /wd4350 /wd4505 /wd4512 /wd4548 /wd4571 /wd4625 /wd4626 /wd4668 /wd4619 /wd4701 /wd4702 /wd4706 /wd4710 /wd4711 /wd4640 /wd4061 /wd4826 /wd4946 /wd4917 /wd4986 /wd4987 /wd4456 /wd4457 /wd4458 /wd4459 /wd4774 /wd4777 /wd5027 /wd5029 /wd4464 /d2Zi+</AdditionalOptions> + <Optimization>Full</Optimization> + <AdditionalIncludeDirectories>./../../include;./../../../platform/include;./../../../framework/include;./../../../../PxToolkit/include;./../../../../../Source/Common/include;./../../../../../Source/Common/include/windows;./../../../../../Include;./../../../../../../PxShared/include;./../../../../../../PxShared/src/foundation/include;$(DXSDK_DIR)/Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>PHYSX_PROFILE_SDK;WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;NDEBUG;PX_PROFILE=1;PX_NVTX=1;PX_SUPPORT_PVD=1;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ExceptionHandling>false</ExceptionHandling> + <WarningLevel>Level4</WarningLevel> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <PrecompiledHeader>NotUsing</PrecompiledHeader> + <PrecompiledHeaderFile></PrecompiledHeaderFile> + <ProgramDataBaseFileName>$(TargetDir)\$(TargetName).pdb</ProgramDataBaseFileName> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Lib> + <AdditionalOptions>/INCREMENTAL:NO</AdditionalOptions> + <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)$(ProjectName)PROFILE.lib</OutputFile> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <ProgramDatabaseFile>$(TargetDir)\$(TargetName).pdb</ProgramDatabaseFile> + <TargetMachine>MachineX86</TargetMachine> + </Lib> + <ResourceCompile> + </ResourceCompile> + <ProjectReference> + <LinkLibraryDependencies>true</LinkLibraryDependencies> + </ProjectReference> + </ItemDefinitionGroup> + <ItemGroup> + <ClInclude Include="..\..\include\windows\WindowsGLIncludes.h"> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\include\GLIncludes.h"> + </ClInclude> + <ClInclude Include="..\..\include\Renderer.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererBoxShape.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererCapsuleShape.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererClothShape.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererColor.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererConfig.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererDesc.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererDirectionalLight.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererDirectionalLightDesc.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererFoundation.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererGridShape.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererIndexBuffer.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererIndexBufferDesc.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererInstanceBuffer.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererInstanceBufferDesc.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererInteropableBuffer.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererLight.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererLightDesc.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererMaterial.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererMaterialDesc.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererMaterialInstance.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererMemoryMacros.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererMesh.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererMeshContext.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererMeshDesc.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererMeshShape.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererParticleSystemShape.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererProjection.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererShape.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererSimpleParticleSystemShape.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererSpotLight.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererSpotLightDesc.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererTarget.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererTargetDesc.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererTerrainShape.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererTexture.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererTexture2D.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererTexture2DDesc.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererTextureDesc.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererUtils.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererVertexBuffer.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererVertexBufferDesc.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererWindow.h"> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\src\ogl\OGLRenderer.h"> + </ClInclude> + <ClInclude Include="..\..\src\ogl\OGLRendererDirectionalLight.h"> + </ClInclude> + <ClInclude Include="..\..\src\ogl\OGLRendererIndexBuffer.h"> + </ClInclude> + <ClInclude Include="..\..\src\ogl\OGLRendererInstanceBuffer.h"> + </ClInclude> + <ClInclude Include="..\..\src\ogl\OGLRendererMaterial.h"> + </ClInclude> + <ClInclude Include="..\..\src\ogl\OGLRendererMesh.h"> + </ClInclude> + <ClInclude Include="..\..\src\ogl\OGLRendererSpotLight.h"> + </ClInclude> + <ClInclude Include="..\..\src\ogl\OGLRendererTexture2D.h"> + </ClInclude> + <ClInclude Include="..\..\src\ogl\OGLRendererVertexBuffer.h"> + </ClInclude> + <ClCompile Include="..\..\src\ogl\OGLRenderer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\ogl\OGLRendererDirectionalLight.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\ogl\OGLRendererIndexBuffer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\ogl\OGLRendererInstanceBuffer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\ogl\OGLRendererMaterial.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\ogl\OGLRendererMesh.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\ogl\OGLRendererSpotLight.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\ogl\OGLRendererTexture2D.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\ogl\OGLRendererVertexBuffer.cpp"> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\src\d3d9\D3D9Renderer.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d9\D3D9RendererDirectionalLight.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d9\D3D9RendererIndexBuffer.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d9\D3D9RendererInstanceBuffer.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d9\D3D9RendererMaterial.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d9\D3D9RendererMesh.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d9\D3D9RendererSpotLight.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d9\D3D9RendererTarget.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d9\D3D9RendererTexture2D.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d9\D3D9RendererVertexBuffer.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d9\D3D9WPFRenderer.h"> + </ClInclude> + <ClCompile Include="..\..\src\d3d9\D3D9Renderer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d9\D3D9RendererDirectionalLight.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d9\D3D9RendererIndexBuffer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d9\D3D9RendererInstanceBuffer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d9\D3D9RendererMaterial.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d9\D3D9RendererMesh.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d9\D3D9RendererSpotLight.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d9\D3D9RendererTarget.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d9\D3D9RendererTexture2D.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d9\D3D9RendererVertexBuffer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d9\D3D9WPFRenderer.cpp"> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\src\d3d11\D3D11Renderer.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererDirectionalLight.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererIndexBuffer.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererInstanceBuffer.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererMaterial.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererMemoryMacros.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererMesh.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererResourceManager.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererSpotLight.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererTarget.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererTexture2D.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererTexture3D.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererTextureCommon.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererTraits.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererUtils.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererVariableManager.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererVertexBuffer.h"> + </ClInclude> + <ClCompile Include="..\..\src\d3d11\D3D11Renderer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d11\D3D11RendererDirectionalLight.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d11\D3D11RendererIndexBuffer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d11\D3D11RendererInstanceBuffer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d11\D3D11RendererMaterial.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d11\D3D11RendererMesh.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d11\D3D11RendererSpotLight.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d11\D3D11RendererTarget.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d11\D3D11RendererTexture2D.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d11\D3D11RendererTexture3D.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d11\D3D11RendererUtils.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d11\D3D11RendererVariableManager.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d11\D3D11RendererVertexBuffer.cpp"> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\src\null\NULLRenderer.h"> + </ClInclude> + <ClInclude Include="..\..\src\null\NULLRendererDirectionalLight.h"> + </ClInclude> + <ClInclude Include="..\..\src\null\NULLRendererIndexBuffer.h"> + </ClInclude> + <ClInclude Include="..\..\src\null\NULLRendererInstanceBuffer.h"> + </ClInclude> + <ClInclude Include="..\..\src\null\NULLRendererMaterial.h"> + </ClInclude> + <ClInclude Include="..\..\src\null\NULLRendererMesh.h"> + </ClInclude> + <ClInclude Include="..\..\src\null\NULLRendererSpotLight.h"> + </ClInclude> + <ClInclude Include="..\..\src\null\NULLRendererTexture2D.h"> + </ClInclude> + <ClInclude Include="..\..\src\null\NULLRendererVertexBuffer.h"> + </ClInclude> + <ClCompile Include="..\..\src\null\NULLRenderer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\null\NULLRendererDirectionalLight.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\null\NULLRendererIndexBuffer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\null\NULLRendererInstanceBuffer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\null\NULLRendererMaterial.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\null\NULLRendererMesh.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\null\NULLRendererSpotLight.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\null\NULLRendererTexture2D.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\null\NULLRendererVertexBuffer.cpp"> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\src\Renderer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererBoxShape.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererCapsuleShape.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererClothShape.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererColor.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererDesc.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererDirectionalLight.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererDirectionalLightDesc.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererGridShape.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererIndexBuffer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererIndexBufferDesc.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererInstanceBuffer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererInstanceBufferDesc.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererLight.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererLightDesc.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererMaterial.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererMaterialDesc.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererMaterialInstance.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererMesh.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererMeshContext.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererMeshDesc.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererMeshShape.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererParticleSystemShape.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererProjection.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererShape.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererSimpleParticleSystemShape.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererSpotLight.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererSpotLightDesc.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererTarget.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererTargetDesc.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererTerrainShape.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererTexture.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererTexture2D.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererTexture2DDesc.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererTextureDesc.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererVertexBuffer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererVertexBufferDesc.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererWindow.cpp"> + </ClCompile> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"></ImportGroup> +</Project> diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/compiler/vc14win64/SampleRenderer-MT.vcxproj b/PhysX_3.4/Samples/SampleFramework/renderer/compiler/vc14win64/SampleRenderer-MT.vcxproj new file mode 100644 index 00000000..c41cda5a --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/compiler/vc14win64/SampleRenderer-MT.vcxproj @@ -0,0 +1,574 @@ +<?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="checked|x64"> + <Configuration>checked</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="profile|x64"> + <Configuration>profile</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{67A61354-2C14-B851-8530-DDD43BDC1D9C}</ProjectGuid> + <RootNamespace>SampleRenderer-MT</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)'=='checked|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> + <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" /> + </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" /> + </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" /> + </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" /> + </ImportGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> + <OutDir>./../../lib/vc14win64\</OutDir> + <IntDir>./x64/SampleRenderer-MT/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> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FloatingPointModel>Fast</FloatingPointModel> + <BasicRuntimeChecks>UninitializedLocalUsageCheck</BasicRuntimeChecks> + <AdditionalOptions>/EHsc /GR- /GF /MP /Wall /wd4514 /wd4820 /wd4062 /wd4100 /wd4130 /wd4201 /wd4242 /wd4244 /wd4245 /wd4265 /wd4266 /wd4324 /wd4389 /wd4365 /wd4371 /wd4447 /wd4189 /wd4191 /wd4350 /wd4505 /wd4512 /wd4548 /wd4571 /wd4625 /wd4626 /wd4668 /wd4619 /wd4701 /wd4702 /wd4706 /wd4710 /wd4711 /wd4640 /wd4061 /wd4826 /wd4946 /wd4917 /wd4986 /wd4987 /wd4456 /wd4457 /wd4458 /wd4459 /wd4774 /wd4777 /wd5027 /wd5029 /wd4464 /Zi /d2Zi+</AdditionalOptions> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>./../../include;./../../../platform/include;./../../../framework/include;./../../../../PxToolkit/include;./../../../../../Source/Common/include;./../../../../../Source/Common/include/windows;./../../../../../Include;./../../../../../../PxShared/include;./../../../../../../PxShared/src/foundation/include;$(DXSDK_DIR)/Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>PHYSX_PROFILE_SDK;WIN32;WIN64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;_DEBUG;PX_DEBUG=1;PX_CHECKED=1;PX_NVTX=1;PX_SUPPORT_PVD=1;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ExceptionHandling>false</ExceptionHandling> + <WarningLevel>Level4</WarningLevel> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeader>NotUsing</PrecompiledHeader> + <PrecompiledHeaderFile></PrecompiledHeaderFile> + <ProgramDataBaseFileName>$(TargetDir)\$(TargetName).pdb</ProgramDataBaseFileName> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Lib> + <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)$(ProjectName)DEBUG.lib</OutputFile> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <ProgramDatabaseFile>$(TargetDir)\$(TargetName).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>./x64/SampleRenderer-MT/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> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FloatingPointModel>Fast</FloatingPointModel> + <AdditionalOptions>/EHsc /GR- /GF /MP /Wall /wd4514 /wd4820 /wd4062 /wd4100 /wd4130 /wd4201 /wd4242 /wd4244 /wd4245 /wd4265 /wd4266 /wd4324 /wd4389 /wd4365 /wd4371 /wd4447 /wd4189 /wd4191 /wd4350 /wd4505 /wd4512 /wd4548 /wd4571 /wd4625 /wd4626 /wd4668 /wd4619 /wd4701 /wd4702 /wd4706 /wd4710 /wd4711 /wd4640 /wd4061 /wd4826 /wd4946 /wd4917 /wd4986 /wd4987 /wd4456 /wd4457 /wd4458 /wd4459 /wd4774 /wd4777 /wd5027 /wd5029 /wd4464 /d2Zi+</AdditionalOptions> + <Optimization>Full</Optimization> + <AdditionalIncludeDirectories>./../../include;./../../../platform/include;./../../../framework/include;./../../../../PxToolkit/include;./../../../../../Source/Common/include;./../../../../../Source/Common/include/windows;./../../../../../Include;./../../../../../../PxShared/include;./../../../../../../PxShared/src/foundation/include;$(DXSDK_DIR)/Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>PHYSX_PROFILE_SDK;WIN32;WIN64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;NDEBUG;PX_SUPPORT_PVD=0;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ExceptionHandling>false</ExceptionHandling> + <WarningLevel>Level4</WarningLevel> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <PrecompiledHeader>NotUsing</PrecompiledHeader> + <PrecompiledHeaderFile></PrecompiledHeaderFile> + <ProgramDataBaseFileName>$(TargetDir)\$(TargetName).pdb</ProgramDataBaseFileName> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Lib> + <AdditionalOptions>/INCREMENTAL:NO</AdditionalOptions> + <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)$(ProjectName).lib</OutputFile> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <ProgramDatabaseFile>$(TargetDir)\$(TargetName).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>./x64/SampleRenderer-MT/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> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FloatingPointModel>Fast</FloatingPointModel> + <AdditionalOptions>/EHsc /GR- /GF /MP /Wall /wd4514 /wd4820 /wd4062 /wd4100 /wd4130 /wd4201 /wd4242 /wd4244 /wd4245 /wd4265 /wd4266 /wd4324 /wd4389 /wd4365 /wd4371 /wd4447 /wd4189 /wd4191 /wd4350 /wd4505 /wd4512 /wd4548 /wd4571 /wd4625 /wd4626 /wd4668 /wd4619 /wd4701 /wd4702 /wd4706 /wd4710 /wd4711 /wd4640 /wd4061 /wd4826 /wd4946 /wd4917 /wd4986 /wd4987 /wd4456 /wd4457 /wd4458 /wd4459 /wd4774 /wd4777 /wd5027 /wd5029 /wd4464 /d2Zi+</AdditionalOptions> + <Optimization>Full</Optimization> + <AdditionalIncludeDirectories>./../../include;./../../../platform/include;./../../../framework/include;./../../../../PxToolkit/include;./../../../../../Source/Common/include;./../../../../../Source/Common/include/windows;./../../../../../Include;./../../../../../../PxShared/include;./../../../../../../PxShared/src/foundation/include;$(DXSDK_DIR)/Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>PHYSX_PROFILE_SDK;WIN32;WIN64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;NDEBUG;PX_CHECKED=1;PX_NVTX=1;PX_SUPPORT_PVD=1;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ExceptionHandling>false</ExceptionHandling> + <WarningLevel>Level4</WarningLevel> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <PrecompiledHeader>NotUsing</PrecompiledHeader> + <PrecompiledHeaderFile></PrecompiledHeaderFile> + <ProgramDataBaseFileName>$(TargetDir)\$(TargetName).pdb</ProgramDataBaseFileName> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Lib> + <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)$(ProjectName)CHECKED.lib</OutputFile> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <ProgramDatabaseFile>$(TargetDir)\$(TargetName).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>./x64/SampleRenderer-MT/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> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FloatingPointModel>Fast</FloatingPointModel> + <AdditionalOptions>/EHsc /GR- /GF /MP /Wall /wd4514 /wd4820 /wd4062 /wd4100 /wd4130 /wd4201 /wd4242 /wd4244 /wd4245 /wd4265 /wd4266 /wd4324 /wd4389 /wd4365 /wd4371 /wd4447 /wd4189 /wd4191 /wd4350 /wd4505 /wd4512 /wd4548 /wd4571 /wd4625 /wd4626 /wd4668 /wd4619 /wd4701 /wd4702 /wd4706 /wd4710 /wd4711 /wd4640 /wd4061 /wd4826 /wd4946 /wd4917 /wd4986 /wd4987 /wd4456 /wd4457 /wd4458 /wd4459 /wd4774 /wd4777 /wd5027 /wd5029 /wd4464 /d2Zi+</AdditionalOptions> + <Optimization>Full</Optimization> + <AdditionalIncludeDirectories>./../../include;./../../../platform/include;./../../../framework/include;./../../../../PxToolkit/include;./../../../../../Source/Common/include;./../../../../../Source/Common/include/windows;./../../../../../Include;./../../../../../../PxShared/include;./../../../../../../PxShared/src/foundation/include;$(DXSDK_DIR)/Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>PHYSX_PROFILE_SDK;WIN32;WIN64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;NDEBUG;PX_PROFILE=1;PX_NVTX=1;PX_SUPPORT_PVD=1;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ExceptionHandling>false</ExceptionHandling> + <WarningLevel>Level4</WarningLevel> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <PrecompiledHeader>NotUsing</PrecompiledHeader> + <PrecompiledHeaderFile></PrecompiledHeaderFile> + <ProgramDataBaseFileName>$(TargetDir)\$(TargetName).pdb</ProgramDataBaseFileName> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Lib> + <AdditionalOptions>/INCREMENTAL:NO</AdditionalOptions> + <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)$(ProjectName)PROFILE.lib</OutputFile> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <ProgramDatabaseFile>$(TargetDir)\$(TargetName).pdb</ProgramDatabaseFile> + <TargetMachine>MachineX64</TargetMachine> + </Lib> + <ResourceCompile> + </ResourceCompile> + <ProjectReference> + <LinkLibraryDependencies>true</LinkLibraryDependencies> + </ProjectReference> + </ItemDefinitionGroup> + <ItemGroup> + <ClInclude Include="..\..\include\windows\WindowsGLIncludes.h"> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\include\GLIncludes.h"> + </ClInclude> + <ClInclude Include="..\..\include\Renderer.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererBoxShape.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererCapsuleShape.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererClothShape.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererColor.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererConfig.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererDesc.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererDirectionalLight.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererDirectionalLightDesc.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererFoundation.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererGridShape.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererIndexBuffer.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererIndexBufferDesc.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererInstanceBuffer.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererInstanceBufferDesc.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererInteropableBuffer.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererLight.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererLightDesc.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererMaterial.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererMaterialDesc.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererMaterialInstance.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererMemoryMacros.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererMesh.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererMeshContext.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererMeshDesc.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererMeshShape.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererParticleSystemShape.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererProjection.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererShape.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererSimpleParticleSystemShape.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererSpotLight.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererSpotLightDesc.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererTarget.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererTargetDesc.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererTerrainShape.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererTexture.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererTexture2D.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererTexture2DDesc.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererTextureDesc.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererUtils.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererVertexBuffer.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererVertexBufferDesc.h"> + </ClInclude> + <ClInclude Include="..\..\include\RendererWindow.h"> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\src\ogl\OGLRenderer.h"> + </ClInclude> + <ClInclude Include="..\..\src\ogl\OGLRendererDirectionalLight.h"> + </ClInclude> + <ClInclude Include="..\..\src\ogl\OGLRendererIndexBuffer.h"> + </ClInclude> + <ClInclude Include="..\..\src\ogl\OGLRendererInstanceBuffer.h"> + </ClInclude> + <ClInclude Include="..\..\src\ogl\OGLRendererMaterial.h"> + </ClInclude> + <ClInclude Include="..\..\src\ogl\OGLRendererMesh.h"> + </ClInclude> + <ClInclude Include="..\..\src\ogl\OGLRendererSpotLight.h"> + </ClInclude> + <ClInclude Include="..\..\src\ogl\OGLRendererTexture2D.h"> + </ClInclude> + <ClInclude Include="..\..\src\ogl\OGLRendererVertexBuffer.h"> + </ClInclude> + <ClCompile Include="..\..\src\ogl\OGLRenderer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\ogl\OGLRendererDirectionalLight.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\ogl\OGLRendererIndexBuffer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\ogl\OGLRendererInstanceBuffer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\ogl\OGLRendererMaterial.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\ogl\OGLRendererMesh.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\ogl\OGLRendererSpotLight.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\ogl\OGLRendererTexture2D.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\ogl\OGLRendererVertexBuffer.cpp"> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\src\d3d9\D3D9Renderer.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d9\D3D9RendererDirectionalLight.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d9\D3D9RendererIndexBuffer.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d9\D3D9RendererInstanceBuffer.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d9\D3D9RendererMaterial.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d9\D3D9RendererMesh.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d9\D3D9RendererSpotLight.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d9\D3D9RendererTarget.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d9\D3D9RendererTexture2D.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d9\D3D9RendererVertexBuffer.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d9\D3D9WPFRenderer.h"> + </ClInclude> + <ClCompile Include="..\..\src\d3d9\D3D9Renderer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d9\D3D9RendererDirectionalLight.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d9\D3D9RendererIndexBuffer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d9\D3D9RendererInstanceBuffer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d9\D3D9RendererMaterial.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d9\D3D9RendererMesh.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d9\D3D9RendererSpotLight.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d9\D3D9RendererTarget.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d9\D3D9RendererTexture2D.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d9\D3D9RendererVertexBuffer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d9\D3D9WPFRenderer.cpp"> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\src\d3d11\D3D11Renderer.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererDirectionalLight.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererIndexBuffer.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererInstanceBuffer.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererMaterial.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererMemoryMacros.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererMesh.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererResourceManager.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererSpotLight.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererTarget.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererTexture2D.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererTexture3D.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererTextureCommon.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererTraits.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererUtils.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererVariableManager.h"> + </ClInclude> + <ClInclude Include="..\..\src\d3d11\D3D11RendererVertexBuffer.h"> + </ClInclude> + <ClCompile Include="..\..\src\d3d11\D3D11Renderer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d11\D3D11RendererDirectionalLight.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d11\D3D11RendererIndexBuffer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d11\D3D11RendererInstanceBuffer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d11\D3D11RendererMaterial.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d11\D3D11RendererMesh.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d11\D3D11RendererSpotLight.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d11\D3D11RendererTarget.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d11\D3D11RendererTexture2D.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d11\D3D11RendererTexture3D.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d11\D3D11RendererUtils.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d11\D3D11RendererVariableManager.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\d3d11\D3D11RendererVertexBuffer.cpp"> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\src\null\NULLRenderer.h"> + </ClInclude> + <ClInclude Include="..\..\src\null\NULLRendererDirectionalLight.h"> + </ClInclude> + <ClInclude Include="..\..\src\null\NULLRendererIndexBuffer.h"> + </ClInclude> + <ClInclude Include="..\..\src\null\NULLRendererInstanceBuffer.h"> + </ClInclude> + <ClInclude Include="..\..\src\null\NULLRendererMaterial.h"> + </ClInclude> + <ClInclude Include="..\..\src\null\NULLRendererMesh.h"> + </ClInclude> + <ClInclude Include="..\..\src\null\NULLRendererSpotLight.h"> + </ClInclude> + <ClInclude Include="..\..\src\null\NULLRendererTexture2D.h"> + </ClInclude> + <ClInclude Include="..\..\src\null\NULLRendererVertexBuffer.h"> + </ClInclude> + <ClCompile Include="..\..\src\null\NULLRenderer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\null\NULLRendererDirectionalLight.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\null\NULLRendererIndexBuffer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\null\NULLRendererInstanceBuffer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\null\NULLRendererMaterial.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\null\NULLRendererMesh.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\null\NULLRendererSpotLight.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\null\NULLRendererTexture2D.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\null\NULLRendererVertexBuffer.cpp"> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\src\Renderer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererBoxShape.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererCapsuleShape.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererClothShape.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererColor.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererDesc.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererDirectionalLight.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererDirectionalLightDesc.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererGridShape.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererIndexBuffer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererIndexBufferDesc.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererInstanceBuffer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererInstanceBufferDesc.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererLight.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererLightDesc.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererMaterial.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererMaterialDesc.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererMaterialInstance.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererMesh.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererMeshContext.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererMeshDesc.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererMeshShape.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererParticleSystemShape.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererProjection.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererShape.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererSimpleParticleSystemShape.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererSpotLight.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererSpotLightDesc.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererTarget.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererTargetDesc.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererTerrainShape.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererTexture.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererTexture2D.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererTexture2DDesc.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererTextureDesc.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererVertexBuffer.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererVertexBufferDesc.cpp"> + </ClCompile> + <ClCompile Include="..\..\src\RendererWindow.cpp"> + </ClCompile> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"></ImportGroup> +</Project> diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/include/GLIncludes.h b/PhysX_3.4/Samples/SampleFramework/renderer/include/GLIncludes.h new file mode 100644 index 00000000..25ad462b --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/include/GLIncludes.h @@ -0,0 +1,53 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#ifndef GL_INCLUDES_H +#define GL_INCLUDES_H + +#if defined(RENDERER_WINDOWS) + #if defined(RENDERER_ENABLE_OPENGL) + #include <windows/WindowsGLIncludes.h> + #endif +#elif defined(RENDERER_PS3) + #include <ps3/PS3GLIncludes.h> +#elif defined(RENDERER_MACOSX) + #include <osx/OSXGLIncludes.h> +#elif defined(RENDERER_XBOX360) + #include <xbox360/Xbox360GLIncludes.h> +#elif defined(RENDERER_PS4) + #include <ps4/PS4GLIncludes.h> +#elif defined(RENDERER_LINUX) + #include <linux/LinuxGLIncludes.h> +#elif defined(RENDERER_ANDROID) + #include <android/AndroidGLIncludes.h> +#elif defined(RENDERER_IOS) +#else +#error Undefined platform. +#endif + + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/include/Renderer.h b/PhysX_3.4/Samples/SampleFramework/renderer/include/Renderer.h new file mode 100644 index 00000000..b051e225 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/include/Renderer.h @@ -0,0 +1,438 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#ifndef RENDERER_H +#define RENDERER_H + +#include <RendererConfig.h> + +#include <RendererMaterial.h> +#include <RendererWindow.h> +#include <RendererColor.h> +#include <RendererUtils.h> +#include <SampleUserInput.h> + +#include <vector> +#include <string> +#include <queue> + +#if PX_VC +#pragma warning(push) +#pragma warning(disable:4702) +#include <map> +#pragma warning(pop) +#else +#include <map> +#endif + +#include "foundation/PxVec2.h" +#include "foundation/PxProfiler.h" + +namespace SampleRenderer +{ + + class RendererDesc; + class RendererWindow; + class RendererVertexBuffer; + class RendererVertexBufferDesc; + class RendererIndexBuffer; + class RendererIndexBufferDesc; + class RendererSurfaceBuffer; + class RendererSurfaceBufferDesc; + class RendererInstanceBuffer; + class RendererInstanceBufferDesc; + class RendererTexture; + class RendererTextureDesc; + class RendererTarget; + class RendererTargetDesc; + class RendererMaterial; + class RendererMaterialDesc; + class RendererMesh; + class RendererMeshDesc; + class RendererMeshContext; + class RendererLight; + class RendererLightDesc; + + class RendererColor; + class RendererProjection; + + class ScreenQuad + { + public: + ScreenQuad(); + + RendererColor mLeftUpColor; //!< Color for left-up vertex + RendererColor mLeftDownColor; //!< Color for left-down vertex + RendererColor mRightUpColor; //!< Color for right-up vertex + RendererColor mRightDownColor; //!< Color for right-down vertex + PxReal mAlpha; //!< Alpha value + PxReal mX0, mY0; //!< Up-left coordinates + PxReal mX1, mY1; //!< Bottom-right coordinates + }; + + class Renderer + { + public: + struct TextVertex + { + PxVec3 p; + PxReal rhw; + PxU32 color; + PxReal u,v; + }; + + struct TessellationParams + { + TessellationParams(); + + void setDefault(); + std::string toString(); + + PxVec4 tessFactor; + PxReal tessMinMaxDistance[2]; + PxReal tessHeightScaleAndBias[2]; + PxReal tessUVScale[2]; + }; + + typedef enum DriverType + { + DRIVER_OPENGL = 0, // Supports Windows, Linux, MacOSX and PS3. + DRIVER_GLES2, // Supports Android (> 2.2) and iPhone. + DRIVER_DIRECT3D9, // Supports Windows, XBOX360. + DRIVER_LIBGCM, // Supports PS3, currently unused (PS3 uses OpenGL) + DRIVER_LIBGNM, // Supports PS4 + DRIVER_DIRECT3D11, // Supports Windows 7/Vista. + DRIVER_NULL, + } DriverType; + + public: + // assetDir should point to the directory where shaders can be found in the assetDir/shaders/ subdirectory and textures are in assetDir/textures + // enableMaterialCaching will try to compile as few shaders as possible + static Renderer *createRenderer(const RendererDesc &desc, const char* assetDir, bool enableMaterialCaching = true); + + static const char *getDriverTypeName(DriverType type); + + protected: + Renderer(DriverType driver, PxErrorCallback* errorCallback, const char* shaderDir); + virtual ~Renderer(void); + + public: + void release(void); + + // get the driver type for this renderer. + DriverType getDriverType(void) const; + + // get the offset to the center of a pixel relative to the size of a pixel (so either 0 or 0.5). + PxF32 getPixelCenterOffset(void) const; + + // get the name of the hardware device. + const char *getDeviceName(void) const; + + // adds a mesh to the render queue. + void queueMeshForRender(RendererMeshContext &mesh); + void removeMeshFromRenderQueue(RendererMesh& mesh); + + // adds a light to the render queue. + void queueLightForRender(RendererLight &light); + void removeLightFromRenderQueue(RendererLight &light); + + // renders the current scene to the offscreen buffers. empties the render queue when done. + void render(const physx::PxMat44 &eye, const RendererProjection &proj, RendererTarget *target=0, bool depthOnly=false); + + // sets fog + void setFog(const RendererColor &fogColor, float fogDistance); + + // sets the ambient lighting color. + void setAmbientColor(const RendererColor &ambientColor); + // get the ambient lighting color. + RendererColor getAmbientColor(); + + // sets the clear color. + void setClearColor(const RendererColor &clearColor); + RendererColor& getClearColor() { return m_clearColor; } + + // sets whether tessellation is enabled. must be supported by the underlying renderer implementation + void setEnableTessellation(bool enable) { m_enableTessellation = enable && isTessellationSupported(); } + bool getEnableTessellation() const { return m_enableTessellation; } + virtual bool isTessellationSupported(void) const { return false; } + + // sets appropriate tessellation parameters + void setTessellationParams(const TessellationParams&); + TessellationParams& getTessellationParams() { return m_tessellationParams; } + + // sets whether wireframe mode is enabled + void toggleWireframe() { m_enableWireframe = !m_enableWireframe; } + bool wireframeEnabled() const { return m_enableWireframe; } + + // sets whether to override the blending of individual meshes + void setEnableBlendingOverride(bool enable) { m_enableBlendingOverride = enable; } + bool blendingOverrideEnabled() const { return m_enableBlendingOverride; } + + // sets whether to use culling on meshes with blending + void setEnableBlendingCull(bool enable) { m_enableBlendingCull = enable; } + bool blendingCull() const { return m_enableBlendingCull; } + + // get and set the output message stream + void setErrorCallback(PxErrorCallback* errc) { m_errorCallback = errc; } + PxErrorCallback* getErrorCallback() { return m_errorCallback; } + + // sprite renderer is not available on dx11 feature level dx9 + virtual bool isSpriteRenderingSupported(void) const { return true; } + + // clears the offscreen buffers. + virtual void clearBuffers(void) = 0; + + // presents the current color buffer to the screen. + // returns true on device reset and if buffers need to be rewritten. + virtual bool swapBuffers(void) = 0; + + // get the device pointer (void * abstraction) + virtual void *getDevice() = 0; + + // save the screen data to disk + virtual bool captureScreen(const char* filename); + + // gets a handle to the current frame's data, in bitmap format + // note: subsequent calls will invalidate any previously returned data + virtual bool captureScreen(PxU32 &width, PxU32& height, PxU32& sizeInBytes, const void*& screenshotData) = 0; + + virtual void getWindowSize(PxU32 &width, PxU32 &height) const = 0; + + virtual PxU32 convertColor(const RendererColor& color) const = 0; + virtual void finishRendering() {} + + virtual RendererVertexBuffer *createVertexBuffer( const RendererVertexBufferDesc &desc) = 0; + virtual RendererIndexBuffer *createIndexBuffer( const RendererIndexBufferDesc &desc) = 0; +// virtual RendererSurfaceBuffer *createSurfaceBuffer( const RendererSurfaceBufferDesc &desc) = 0; + virtual RendererInstanceBuffer *createInstanceBuffer(const RendererInstanceBufferDesc &desc) = 0; + virtual RendererTexture *createTexture( const RendererTextureDesc &desc); + virtual RendererTexture2D *createTexture2D( const RendererTexture2DDesc &desc) = 0; + virtual RendererTexture3D *createTexture3D( const RendererTexture3DDesc &desc) = 0; + virtual RendererTarget *createTarget( const RendererTargetDesc &desc) = 0; + virtual RendererMaterial *createMaterial( const RendererMaterialDesc &desc) = 0; + virtual RendererMesh *createMesh( const RendererMeshDesc &desc) = 0; + virtual RendererLight *createLight( const RendererLightDesc &desc) = 0; + + virtual void disableDepthTest() {} + virtual void enableDepthTest() {} + + // These two methods are only necessary for internal caching of compiled materials + bool getEnableMaterialCaching() { return mEnableMaterialCaching; } + + virtual void setVsync(bool on) = 0; + protected: + void setEnableMaterialCaching(bool enable) { mEnableMaterialCaching = enable; } + RendererMaterial *hasMaterialAlready( const RendererMaterialDesc& desc); + void registerMaterial( const RendererMaterialDesc& desc, RendererMaterial* mat); + void releaseAllMaterials(); + + void formatScreenshot(PxU32 width, PxU32 height, PxU32 sizeInBytes, int rPosition, int gPosition, int bPosition, bool bFlipY, void* screenshotData); + public: + + // Text rendering + virtual bool initTexter(); + virtual void closeTexter(); + void print(PxU32 x, PxU32 y, const char* text, PxReal scale=0.5f, PxReal shadowOffset=6.0f, RendererColor textColor = RendererColor(255, 255, 255, 255), bool forceFixWidthNumbers = false); + void print(PxU32* x, PxU32* y, const char** text, PxU32 textCount, PxReal scale=0.5f, PxReal shadowOffset=6.0f, RendererColor* textColors = NULL, bool forceFixWidthNumbers = false); + const char* getAssetDir(); + + // assetDir should point to the directory where shaders can be found in the assetDir/shaders/ subdirectory and textures are in assetDir/textures + void setAssetDir( const char * assetDir ); + + void setCacheShaderDir( const char * cacheDir ) { m_cacheDir = cacheDir; } + const char* getCacheShaderDir() { return m_cacheDir; } + // On-screen controls/sticks for tablets +#if defined(RENDERER_TABLET) + struct TabletButton + { + PxVec2 leftBottom; + PxVec2 rightTop; + physx::PxU8 pressedCount; + physx::PxU16 emulatedKeyCode; + std::string text; + RendererMesh* mesh; + RendererMaterial* material; + RendererMaterialInstance* materialInstance; + + PxVec4 defaultColor, pressedColor; + + void (*callback)(); + + TabletButton(); + void setPressedCount(physx::PxU8); + void incPressed(); + void decPressed(); + }; + + virtual bool initControls(RendererMaterial* controlMaterial, RendererMaterialInstance* controlMaterialInstance); + void setControlPosition(int ctrl_idx, const PxVec2&); + void setControlDefaultPosition(int ctrl_idx); + PxBounds3 getControlBounds(int ctrl_idx); + PxBounds3 getCenteredControlBounds(int ctrl_idx); + PxVec2 getControlPosition(int ctrl_idx); + PxVec2 getCenteredControlPosition(int ctrl_idx); + // On-screen buttons for tablets + void addButton(const PxVec2& leftBottom, + const PxVec2& rightTop, + void (*func_ptr)(), + RendererMaterial* controlMaterial, + RendererMaterialInstance* controlMaterialInstance); + void releaseAllButtons(); + void bindButtonToUserInput(size_t buttonIndex, physx::PxU16 userInputId, const char* buttonName); + std::vector<TabletButton>& screenButtons(); +#endif + + // Screenquad + virtual bool initScreenquad(); + virtual void closeScreenquad(); + bool drawScreenQuad(const ScreenQuad& screenQuad); + bool drawTouchControls(); + bool drawLines2D(PxU32 nbVerts, const PxReal* vertices, const RendererColor& color); + bool drawLines2D(PxU32 nbVerts, const PxReal* vertices, const RendererColor* colors); + + private: + void renderMeshes(std::vector<RendererMeshContext>& meshes, RendererMaterial::Pass pass); + void renderDeferredLights(void); + void sortMeshes(const physx::PxMat44& eye); + + private: + RendererMesh* initControl(PxReal* vertices, PxReal* texcoords, PxU32 verticesCount); + friend class ScopedRender; + virtual bool beginRender(void) { return true;} + virtual void endRender(void) {} + virtual void bindViewProj(const physx::PxMat44 &eye, const RendererProjection &proj) = 0; + virtual void bindFogState(const RendererColor &fogColor, float fogDistance) = 0; + virtual void bindAmbientState(const RendererColor &ambientColor) = 0; + virtual void bindDeferredState(void) = 0; + virtual void bindMeshContext(const RendererMeshContext &context) = 0; + virtual void beginMultiPass(void) = 0; + virtual void endMultiPass(void) = 0; + virtual void beginTransparentMultiPass(void) = 0; + virtual void endTransparentMultiPass(void) = 0; + virtual void renderDeferredLight(const RendererLight &light) = 0; + + virtual bool isOk(void) const = 0; + + public: + virtual void setupTextRenderStates() = 0; + virtual void resetTextRenderStates() = 0; + virtual void renderTextBuffer(const void* vertices, PxU32 nbVerts, const PxU16* indices, PxU32 nbIndices, RendererMaterial* material) = 0; + virtual void renderLines2D(const void* vertices, PxU32 nbVerts) = 0; + +#if defined(RENDERER_TABLET) + void renderControls(); + void renderButtons(); +#endif + virtual void setupScreenquadRenderStates() = 0; + virtual void resetScreenquadRenderStates() = 0; + + private: + Renderer &operator=(const Renderer&) { return *this; } + + + const DriverType m_driver; + + protected: + PxErrorCallback* m_errorCallback; + // Texter data + RendererMaterial* m_textMaterial; + RendererMaterialInstance* m_textMaterialInstance; + + private: + typedef std::vector<RendererMeshContext> MeshVector; + MeshVector m_visibleLitMeshes; + MeshVector m_visibleUnlitMeshes; + MeshVector m_screenSpaceMeshes; + MeshVector m_visibleLitTransparentMeshes; + + //std::priority_queue<RendererMeshContext, MeshVector, CompareMeshCameraDistance> m_visibleLitTransparentMeshes; + std::vector<RendererLight*> m_visibleLights; + + RendererColor m_fogColor; + float m_fogDistance; + + RendererColor m_ambientColor; + RendererColor m_clearColor; + + // Screenquad data + RendererMaterial* m_screenquadOpaqueMaterial; + RendererMaterialInstance* m_screenquadOpaqueMaterialInstance; + RendererMaterial* m_screenquadAlphaMaterial; + RendererMaterialInstance* m_screenquadAlphaMaterialInstance; + +#if defined(RENDERER_TABLET) + RendererMaterial* m_controlMaterial; + RendererMaterialInstance* m_controlMaterialInstance; + RendererMesh* m_controlMesh[2]; + PxVec2 m_controlHalfSize; + PxVec2 m_controlCenteredPos[2]; + PxVec2 m_controlPos[2]; + std::vector<TabletButton> m_buttons; +#endif + + protected: + PxF32 m_pixelCenterOffset; + char m_deviceName[256]; + bool m_useShadersForTextRendering; + std::string m_assetDir; + const char* m_cacheDir; + + // Tessellation data + TessellationParams m_tessellationParams; + bool m_enableTessellation; + + bool m_enableWireframe; + bool m_enableBlendingOverride; + bool m_enableBlendingCull; + + bool mEnableMaterialCaching; + struct CompareRenderMaterialDesc + { + bool operator()(const RendererMaterialDesc& desc1, const RendererMaterialDesc& desc2) const; + }; + typedef std::map<RendererMaterialDesc, RendererMaterial*, CompareRenderMaterialDesc> tMaterialCache; + tMaterialCache m_materialCache; + }; + + // Ensure that endRender() is called after each successful beginRender() + class ScopedRender : public safe_bool<> + { + public: + ScopedRender(Renderer& renderer) : mRenderer(renderer), mBeginRenderSuccessful(mRenderer.beginRender()) { } + ~ScopedRender() { if (boolean_test()) mRenderer.endRender(); } + ScopedRender& operator=(const ScopedRender&) {return *this;} + + bool boolean_test() const { return mBeginRenderSuccessful; } + + protected: + Renderer& mRenderer; + bool mBeginRenderSuccessful; + }; + +} // namespace SampleRenderer + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererBoxShape.h b/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererBoxShape.h new file mode 100644 index 00000000..d08f5eb9 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererBoxShape.h @@ -0,0 +1,55 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +// +// RendererBoxShape : convenience class for generating a box mesh. +// +#ifndef RENDERER_BOX_SHAPE_H +#define RENDERER_BOX_SHAPE_H + +#include <RendererShape.h> + +namespace SampleRenderer +{ + + class RendererVertexBuffer; + class RendererIndexBuffer; + + class RendererBoxShape : public RendererShape + { + public: + RendererBoxShape(Renderer &renderer, const PxVec3 &extents, const PxReal* uvs=NULL); + virtual ~RendererBoxShape(void); + + private: + RendererVertexBuffer *m_vertexBuffer; + RendererIndexBuffer *m_indexBuffer; + }; + +} // namespace SampleRenderer + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererCapsuleShape.h b/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererCapsuleShape.h new file mode 100644 index 00000000..9dbcf3e2 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererCapsuleShape.h @@ -0,0 +1,60 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +// +// RendererCapsuleShape : convenience class for generating a capsule mesh. +// +#ifndef RENDERER_CAPSULE_SHAPE_H +#define RENDERER_CAPSULE_SHAPE_H + +#include <RendererShape.h> +#include <RendererBoxShape.h> + +namespace SampleRenderer +{ + + class RendererVertexBuffer; + class RendererIndexBuffer; + + class RendererCapsuleShape : public RendererShape + { + public: + RendererCapsuleShape(Renderer &renderer, PxF32 halfHeight, PxF32 radius); + + // resize the capsule + void setDimensions(PxF32 halfHeight, PxF32 radius0, PxF32 radius1); + + virtual ~RendererCapsuleShape(void); + + private: + RendererVertexBuffer *m_vertexBuffer; + RendererIndexBuffer *m_indexBuffer; + }; + +} // namespace SampleRenderer + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererClothShape.h b/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererClothShape.h new file mode 100644 index 00000000..d93817eb --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererClothShape.h @@ -0,0 +1,88 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#ifndef RENDERER_CLOTH_SHAPE_H +#define RENDERER_CLOTH_SHAPE_H + +#include <RendererShape.h> +#include "gpu/PxGpu.h" + +// fwd to avoid including cuda.h +#if defined(__x86_64) || defined(AMD64) || defined(_M_AMD64) +typedef unsigned long long CUdeviceptr; +#else +typedef unsigned int CUdeviceptr; +#endif + + +namespace SampleRenderer +{ + class RendererVertexBuffer; + class RendererIndexBuffer; + + class RendererClothShape : public RendererShape + { + enum VertexBufferEnum + { + STATIC_VB, + DYNAMIC_VB, + NUM_VERTEX_BUFFERS + }; + public: + RendererClothShape(Renderer& renderer, + const PxVec3* verts, PxU32 numVerts, + const PxVec3* normals, + const PxReal* uvs, + const PxU16* faces, PxU32 numFaces, bool flipWinding=false, + PxCudaContextManager* ctxMgr=NULL); + + // must acquire the cuda context and map buffers before calling + bool update(CUdeviceptr srcVerts, PxU32 numVerts); + void update(const PxVec3* verts, PxU32 numVerts, const PxVec3* normals); + + // helper functions to map the buffers for multiple shapes + // at once because interop mapping has a large per-call overhead + // thread must acquire the cuda context before calling + static void mapShapes(RendererClothShape** shapes, PxU32 n); + static void unmapShapes(RendererClothShape** shapes, PxU32 n); + + virtual ~RendererClothShape(); + + bool isInteropEnabled() const { return m_ctxMgr != NULL; } + + private: + RendererVertexBuffer* m_vertexBuffer[NUM_VERTEX_BUFFERS]; + RendererIndexBuffer* m_indexBuffer; + + PxU32 m_numFaces; + + PxCudaContextManager* m_ctxMgr; + }; + +} // namespace SampleRenderer + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererColor.h b/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererColor.h new file mode 100644 index 00000000..de1dc37c --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererColor.h @@ -0,0 +1,67 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#ifndef RENDERER_COLOR_H +#define RENDERER_COLOR_H + +#include <RendererConfig.h> + +namespace SampleRenderer +{ + + class RendererColor + { + public: + + // use the API color format for OpenGL platforms +#if !(defined(RENDERER_PS3) || defined(RENDERER_ANDROID)) + PxU8 b, g, r, a; +#else + PxU8 r, g, b, a; +#endif + + public: + RendererColor(void); + RendererColor(PxU8 r, PxU8 g, PxU8 b, PxU8 a = 255); + + // conversion constructor, format must be 0xAARRGGBB (but alpha is ignored) + RendererColor(PxU32 rgba); + void swizzleRB(void); + }; + + PX_INLINE RendererColor lerp( const RendererColor& start, const RendererColor& end, float s ) + { + return RendererColor( + start.r + PxU8(( end.r - start.r ) * s), + start.g + PxU8(( end.g - start.g ) * s), + start.b + PxU8(( end.b - start.b ) * s), + start.a + PxU8(( end.a - start.a ) * s)); + } + +} // namespace SampleRenderer + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererConfig.h b/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererConfig.h new file mode 100644 index 00000000..e8d1c7b4 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererConfig.h @@ -0,0 +1,277 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#ifndef RENDERER_CONFIG_H +#define RENDERER_CONFIG_H + +#include <RendererFoundation.h> +#include <assert.h> + +#define RENDERER_TEXT(_foo) #_foo +#define RENDERER_TEXT2(_foo) RENDERER_TEXT(_foo) + +// number of lights required before it switches from forward rendering to deferred rendering. +#define RENDERER_DEFERRED_THRESHOLD 0x7FFFFFFF // set to a big number just to disable it for now... + +// Enables/Disables support for dresscode in the renderer... +#define RENDERER_ENABLE_DRESSCODE 0 + +// If turned on, asserts get compiled in as print statements in release mode. +#define RENDERER_ENABLE_CHECKED_RELEASE 0 + +// If enabled, all lights will be bound in a single pass. Requires appropriate shader support. +#define RENDERER_ENABLE_SINGLE_PASS_LIGHTING 0 + +// maximum number of bones per-drawcall allowed. +#define RENDERER_MAX_BONES 60 + +#define RENDERER_TANGENT_CHANNEL 5 +#define RENDERER_BONEINDEX_CHANNEL 6 +#define RENDERER_BONEWEIGHT_CHANNEL 7 +#define RENDERER_INSTANCE_POSITION_CHANNEL 8 +#define RENDERER_INSTANCE_NORMALX_CHANNEL 9 +#define RENDERER_INSTANCE_NORMALY_CHANNEL 10 +#define RENDERER_INSTANCE_NORMALZ_CHANNEL 11 +#define RENDERER_INSTANCE_VEL_LIFE_CHANNEL 12 +#define RENDERER_INSTANCE_DENSITY_CHANNEL 13 + +#define RENDERER_INSTANCE_UV_CHANNEL 12 +#define RENDERER_INSTANCE_LOCAL_CHANNEL 13 + +#define RENDERER_DISPLACEMENT_CHANNEL 14 +#define RENDERER_X_DISPLACEMENT_CHANNEL 13 +#define RENDERER_Y_DISPLACEMENT_CHANNEL 14 +#define RENDERER_Z_DISPLACEMENT_CHANNEL 15 +#define RENDERER_DISPLACEMENT_FLAGS_CHANNEL 15 + +// Compiler specific configuration... +#if defined(_MSC_VER) +#define RENDERER_VISUALSTUDIO +#pragma warning(disable : 4127) // conditional expression is constant +#pragma warning(disable : 4100) // unreferenced formal parameter + +#elif defined(__ghs__) + #define RENDERER_GHS +#elif defined(__GNUC__) + #define RENDERER_GCC +#else +#error Unknown Compiler! + +#endif + +#if PX_PS4 +#pragma clang diagnostic push +// variadic macros are incompatible with C++98 +#pragma clang diagnostic ignored "-Wc++98-compat-pedantic" +#endif + +// Platform specific configuration... +#if defined(WIN32) || defined(WIN64) || defined(_M_ARM) || PX_XBOXONE + #define RENDERER_WINDOWS +#if !PX_XBOXONE + #define RENDERER_ENABLE_DIRECT3D9 +#endif + #define RENDERER_ENABLE_DIRECT3D11 + #define RENDERER_ENABLE_NVPERFHUD + #define RENDERER_ENABLE_TGA_SUPPORT + #if !defined(RENDERER_PVD) && !PX_XBOXONE && PX_SUPPORT_GPU_PHYSX + //Removed this to get PhysX distro working without shipping CUDA. + //#define RENDERER_ENABLE_CUDA_INTEROP + #endif + #define DIRECT3D9_SUPPORT_D3DUSAGE_DYNAMIC + #if defined(WIN64) + #define RENDERER_64BIT + #endif +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#define NOMINMAX +#include <windows.h> +#elif defined(__APPLE__) && !defined(__arm__) && !defined(__arm64__) +#define RENDERER_MACOSX +#define RENDERER_ENABLE_OPENGL +#define RENDERER_ENABLE_CG +#if !PX_PPC +#define RENDERER_ENABLE_TGA_SUPPORT +#endif + +#elif defined(_XBOX) && _XBOX_VER == 200 +#define RENDERER_XBOX360 +#define RENDERER_ENABLE_DIRECT3D9 +#define NOMINMAX +#define RENDERER_ENABLE_TGA_SUPPORT +#define RENDERER_BIG_ENDIAN + +#elif PX_PS4 + #define RENDERER_PS4 + #define RENDERER_ENABLE_LIBGNM + #define RENDERER_ENABLE_CG + #define RENDERER_ENABLE_TGA_SUPPORT + +#elif defined(__CYGWIN__) +#define RENDERER_LINUX +#define RENDERER_ENABLE_OPENGL +#define RENDERER_ENABLE_CG +#define RENDERER_ENABLE_TGA_SUPPORT + +#elif defined(ANDROID) + #define RENDERER_DEBUG + #define RENDERER_ANDROID + #define RENDERER_TABLET + #define RENDERER_ENABLE_GLES2 + #define RENDERER_ENABLE_TGA_SUPPORT + +#elif defined(__linux__) + #define RENDERER_LINUX + #define RENDERER_ENABLE_OPENGL + #define RENDERER_ENABLE_CG + #define RENDERER_ENABLE_TGA_SUPPORT + +#elif defined(__APPLE__) && (defined(__arm__) || defined(__arm64__)) + #define RENDERER_DEBUG + #define RENDERER_IOS + #define RENDERER_TABLET + #define RENDERER_ENABLE_GLES2 + #define RENDERER_ENABLE_TGA_SUPPORT + #define RENDERER_ENABLE_PVR_SUPPORT + +#elif defined(RENDERER_GHS) + #define RENDERER_WIIU + #define RENDERER_ENABLE_GX2 + #define RENDERER_ENABLE_TGA_SUPPORT + #define RENDERER_BIG_ENDIAN + +#else +#error "Unknown Platform!" + +#endif + +#if PX_DEBUG +#define RENDERER_DEBUG +#endif + + +#if defined(RENDERER_DEBUG) + #if defined(RENDERER_WINDOWS) && !PX_XBOXONE + #define RENDERER_ASSERT(_exp, _msg) \ + if(!(_exp)) \ + { \ + MessageBoxA(0, _msg, "Renderer Assert", MB_OK); \ + __debugbreak(); \ + } + #elif defined(RENDERER_ANDROID) + #include <android/log.h> + #define RENDERER_ASSERT(_exp, _msg) \ + if(!(_exp)) \ + __android_log_print(ANDROID_LOG_INFO, _msg, "RENDERER_ASSERT: %s\n", #_exp);\ + assert(_exp && (_msg)); + #else + #define RENDERER_ASSERT(_exp, _msg) assert(_exp && (_msg)); + #endif +#elif RENDERER_ENABLE_CHECKED_RELEASE +#if defined(RENDERER_VISUALSTUDIO) +#define RENDERER_ASSERT(_exp, _msg) \ + if(!(_exp)) \ + { \ + OutputDebugStringA("*** (" __FILE__":"RENDERER_TEXT2(__LINE__)") "); \ + OutputDebugStringA(_msg); \ + OutputDebugStringA(" ***\n"); \ + } +#else +#define RENDERER_ASSERT(_exp, _msg) if(!(_exp)) shdfnd::printFormatted("*** (" __FILE__ ":" RENDERER_TEXT2(__LINE__)") %s ***\n", _msg); +#endif +#else +#define RENDERER_ASSERT(_exp, _msg) +#endif + +#define RENDERER_OUTPUT_MESSAGE(_rendererPtr, _msg) \ + if((_rendererPtr) && (_rendererPtr)->getErrorCallback()) \ + { \ + (_rendererPtr)->getErrorCallback()->reportError(PxErrorCode::eDEBUG_INFO, (_msg), __FILE__, __LINE__); \ + } + + +#if defined(RENDERER_ANDROID) + #include <android/log.h> + #define LOG_INFO(title, ...) ((void)__android_log_print(ANDROID_LOG_INFO, title, __VA_ARGS__)) +#else + +#if 0 + #include <stdio.h> + #include <stdarg.h> + + static void printInfo(const char* title, const char* message, ...) + { + char buff[4096]; + + shdfnd::printFormatted("%s ", title); + va_list va; + va_start(va, message); + vsprintf(buff, message, va); + va_end(va); + if (strlen(buff)>=4096) + assert(!"buffer overflow!!"); + + shdfnd::printFormatted("%s\n", buff); + } + + #define LOG_INFO(title, ...) (printInfo(title, __VA_ARGS__)) +#else + #define LOG_INFO(title, ...) +#endif + +#endif + +#if defined(RENDERER_XBOX360) +#define RENDERER_INSTANCING 0 +#else +#define RENDERER_INSTANCING 1 +#endif + +namespace SampleRenderer +{ + // 2D and 3D Textures have identical external interfaces + // Using a typedef provides compatibility with legacy code that used only 2D textures + class RendererTexture; + class RendererTextureDesc; + typedef RendererTexture RendererTexture2D; + typedef RendererTextureDesc RendererTexture2DDesc; + typedef RendererTexture RendererTexture3D; + typedef RendererTextureDesc RendererTexture3DDesc; +} +#if defined(RENDERER_ANDROID) && !defined(LOGI) +# include <android/log.h> +# define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO, "RendererConfig", __VA_ARGS__)) +#else +# define LOGI(...) LOG_INFO("LOGI: ", __VA_ARGS__) +#endif + +#if PX_PS4 +#pragma clang diagnostic pop +#endif + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererDesc.h b/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererDesc.h new file mode 100644 index 00000000..8fa8c9da --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererDesc.h @@ -0,0 +1,60 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#ifndef RENDERER_DESC_H +#define RENDERER_DESC_H + +#include <RendererConfig.h> +#include <Renderer.h> + +namespace SampleRenderer +{ + + class RendererWindow; + + class RendererDesc + { + public: + Renderer::DriverType driver; + + /* optional error callback */ + PxErrorCallback* errorCallback; + physx::PxU64 windowHandle; + + bool vsync; + + /* enable depth bias for multipass rendering */ + bool multipassDepthBias; + public: + RendererDesc(void); + + bool isValid(void) const; + }; + +} // namespace SampleRenderer + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererDirectionalLight.h b/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererDirectionalLight.h new file mode 100644 index 00000000..900614e5 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererDirectionalLight.h @@ -0,0 +1,54 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#ifndef RENDERER_DIRECTIONAL_LIGHT_H +#define RENDERER_DIRECTIONAL_LIGHT_H + +#include <RendererLight.h> + +namespace SampleRenderer +{ + + class RendererDirectionalLightDesc; + + class RendererDirectionalLight : public RendererLight + { + protected: + RendererDirectionalLight(const RendererDirectionalLightDesc &desc); + virtual ~RendererDirectionalLight(void); + + public: + const PxVec3 &getDirection(void) const; + void setDirection(const PxVec3 &dir); + + protected: + PxVec3 m_direction; + }; + +} // namespace SampleRenderer + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererDirectionalLightDesc.h b/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererDirectionalLightDesc.h new file mode 100644 index 00000000..ee608356 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererDirectionalLightDesc.h @@ -0,0 +1,49 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#ifndef RENDERER_DIRECTIONAL_LIGHT_DESC_H +#define RENDERER_DIRECTIONAL_LIGHT_DESC_H + +#include <RendererLightDesc.h> + +namespace SampleRenderer +{ + + class RendererDirectionalLightDesc : public RendererLightDesc + { + public: + PxVec3 direction; + + public: + RendererDirectionalLightDesc(void); + + virtual bool isValid(void) const; + }; + +} // namespace SampleRenderer + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererFoundation.h b/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererFoundation.h new file mode 100644 index 00000000..ed56285c --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererFoundation.h @@ -0,0 +1,56 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#ifndef RENDERER_FOUNDATION_H +#define RENDERER_FOUNDATION_H + +#include <stdio.h> +#include "foundation/PxPreprocessor.h" +#include "task/PxTask.h" + +namespace physx +{ + namespace shdfnd{} +} + +namespace SampleRenderer +{ + using namespace physx; + namespace Fnd = physx::shdfnd; + + typedef ::FILE File; + +} // namespace Renderer + +#include <foundation/PxSimpleTypes.h> +#include <foundation/PxVec3.h> +#include <foundation/PxMat33.h> +#include <foundation/PxMat44.h> +#include <foundation/PxTransform.h> +#include <foundation/PxErrorCallback.h> + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererGridShape.h b/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererGridShape.h new file mode 100644 index 00000000..383a98e8 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererGridShape.h @@ -0,0 +1,63 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +// +// RendererGridShape : convenience class for generating a grid mesh. +// +#ifndef RENDERER_GRID_SHAPE_H +#define RENDERER_GRID_SHAPE_H + +#include <RendererShape.h> + +namespace SampleRenderer +{ + + class RendererVertexBuffer; + + class RendererGridShape : public RendererShape + { + public: + enum UpAxis + { + UP_X, + UP_Y, + UP_Z, + }; + + RendererGridShape(Renderer &renderer, PxU32 size, float cellSize, bool showAxis = false, UpAxis = UP_Y); + virtual ~RendererGridShape(void); + + UpAxis getUpAxis() { return m_UpAxis; } + + private: + RendererVertexBuffer *m_vertexBuffer; + UpAxis m_UpAxis; + }; + +} // namespace SampleRenderer + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererIndexBuffer.h b/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererIndexBuffer.h new file mode 100644 index 00000000..28d84718 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererIndexBuffer.h @@ -0,0 +1,90 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#ifndef RENDERER_INDEXBUFFER_H +#define RENDERER_INDEXBUFFER_H + +#include <RendererConfig.h> +#include "RendererInteropableBuffer.h" + +namespace SampleRenderer +{ + + class RendererIndexBufferDesc; + + class RendererIndexBuffer: public RendererInteropableBuffer + { + friend class RendererMesh; + friend class GLES2Renderer; + public: + enum Format + { + FORMAT_UINT16 = 0, + FORMAT_UINT32, + + NUM_FORMATS + }_Format; + + enum Hint + { + HINT_STATIC = 0, + HINT_DYNAMIC, + }_Hint; + + public: + static PxU32 getFormatByteSize(Format format); + + protected: + RendererIndexBuffer(const RendererIndexBufferDesc &desc); + virtual ~RendererIndexBuffer(void); + + public: + void release(void) { delete this; } + + Hint getHint(void) const; + Format getFormat(void) const; + PxU32 getMaxIndices(void) const; + + public: + virtual void *lock(void) = 0; + virtual void unlock(void) = 0; + + private: + virtual void bind(void) const = 0; + virtual void unbind(void) const = 0; + + RendererIndexBuffer &operator=(const RendererIndexBuffer &) { return *this; } + + protected: + const Hint m_hint; + const Format m_format; + PxU32 m_maxIndices; + }; + +} // namespace SampleRenderer + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererIndexBufferDesc.h b/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererIndexBufferDesc.h new file mode 100644 index 00000000..dda9ec78 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererIndexBufferDesc.h @@ -0,0 +1,59 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#ifndef RENDERER_INDEXBUFFER_DESC_H +#define RENDERER_INDEXBUFFER_DESC_H + +#include <RendererIndexBuffer.h> + +namespace SampleRenderer +{ + + class RendererIndexBufferDesc + { + public: + RendererIndexBuffer::Hint hint; + RendererIndexBuffer::Format format; + + PxU32 maxIndices; + + ///mark this buffer can be read back by lock, lock flag should not be discard + bool canReadBack; + ///choose if the resource must be registered in CUDA upon creation + bool registerInCUDA; + ///This context must be used to register and unregister the resource everytime the device is lost and recreated + physx::PxCudaContextManager *interopContext; + + public: + RendererIndexBufferDesc(void); + + bool isValid(void) const; + }; + +} // namespace SampleRenderer + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererInstanceBuffer.h b/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererInstanceBuffer.h new file mode 100644 index 00000000..041c61fa --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererInstanceBuffer.h @@ -0,0 +1,130 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#ifndef RENDERER_INSTANCEBUFFER_H +#define RENDERER_INSTANCEBUFFER_H + +#include <RendererConfig.h> +#include "RendererInteropableBuffer.h" + +namespace SampleRenderer +{ + + class RendererInstanceBufferDesc; + + class RendererInstanceBuffer: public RendererInteropableBuffer + { + friend class RendererMesh; + public: + enum Semantic + { + SEMANTIC_POSITION = 0, + SEMANTIC_NORMALX, + SEMANTIC_NORMALY, + SEMANTIC_NORMALZ, + SEMANTIC_VELOCITY_LIFE,// life remain (0-1] is packed into w + SEMANTIC_DENSITY, + SEMANTIC_UV_OFFSET, + SEMANTIC_LOCAL_OFFSET, + + NUM_SEMANTICS + }_Semantic; + + enum Format + { + FORMAT_FLOAT1 = 0, + FORMAT_FLOAT2, + FORMAT_FLOAT3, + FORMAT_FLOAT4, + + NUM_FORMATS, + }_Format; + + enum Hint + { + HINT_STATIC = 0, + HINT_DYNAMIC, + }_Hint; + + public: + static PxU32 getFormatByteSize(Format format); + + protected: + RendererInstanceBuffer(const RendererInstanceBufferDesc &desc); + virtual ~RendererInstanceBuffer(void); + + public: + void release(void) { delete this; } + + Hint getHint(void) const; + Format getFormatForSemantic(Semantic semantic) const; + PxU32 getMaxInstances(void) const; + PxU32 getOffsetForSemantic(Semantic semantic) const; + + void *lockSemantic(Semantic semantic, PxU32 &stride); + void unlockSemantic(Semantic semantic); + + virtual void *lock(void) = 0; + virtual void unlock(void) = 0; + virtual PxU32 getStride(void) const { return m_stride; } + private: + + virtual void bind(PxU32 streamID, PxU32 firstInstance) const = 0; + virtual void unbind(PxU32 streamID) const = 0; + + RendererInstanceBuffer &operator=(const RendererInstanceBuffer &) { return *this; } + + protected: + class SemanticDesc + { + public: + Format format; + PxU32 offset; + bool locked; + public: + SemanticDesc(void) + { + format = NUM_FORMATS; + offset = 0; + locked = false; + } + }; + + protected: + const Hint m_hint; + PxU32 m_maxInstances; + PxU32 m_stride; + SemanticDesc m_semanticDescs[NUM_SEMANTICS]; + + private: + void *m_lockedBuffer; + PxU32 m_numSemanticLocks; + }; + +} // namespace SampleRenderer + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererInstanceBufferDesc.h b/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererInstanceBufferDesc.h new file mode 100644 index 00000000..50d594dd --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererInstanceBufferDesc.h @@ -0,0 +1,58 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#ifndef RENDERER_INSTANCEBUFFER_DESC_H +#define RENDERER_INSTANCEBUFFER_DESC_H + +#include <RendererInstanceBuffer.h> + +namespace SampleRenderer +{ + + class RendererInstanceBufferDesc + { + public: + RendererInstanceBuffer::Hint hint; + RendererInstanceBuffer::Format semanticFormats[RendererInstanceBuffer::NUM_SEMANTICS]; + + PxU32 maxInstances; + + ///mark this buffer can be read back by lock, lock flag should not be discard + bool canReadBack; + + bool registerInCUDA; + physx::PxCudaContextManager *interopContext; + + public: + RendererInstanceBufferDesc(void); + + bool isValid(void) const; + }; + +} // namespace SampleRenderer + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererInteropableBuffer.h b/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererInteropableBuffer.h new file mode 100644 index 00000000..74387672 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererInteropableBuffer.h @@ -0,0 +1,73 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#ifndef RENDERER_INTEROPABLE_BUFFER_H +#define RENDERER_INTEROPABLE_BUFFER_H + +#include <RendererConfig.h> +#include "cudamanager/PxCudaContextManager.h" + +typedef struct CUgraphicsResource_st *CUgraphicsResource; + +namespace SampleRenderer +{ + + class RendererInteropableBuffer + { + public: + RendererInteropableBuffer(bool mustBeRegistered, physx::PxCudaContextManager *interopContext) + : m_mustBeRegisteredInCUDA(mustBeRegistered) + , m_registeredInCUDA(false) + , m_interopContext(interopContext) + , m_InteropHandle(NULL) + + { + } + + bool getInteropResourceHandle(CUgraphicsResource &handle) + { + if(m_registeredInCUDA && m_InteropHandle) + { + handle = m_InteropHandle; + + return true; + } + + return false; + } + + protected: + + bool m_mustBeRegisteredInCUDA; + bool m_registeredInCUDA; + physx::PxCudaContextManager* m_interopContext; + CUgraphicsResource m_InteropHandle; + }; + +} // namespace SampleRenderer + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererLight.h b/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererLight.h new file mode 100644 index 00000000..03031b83 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererLight.h @@ -0,0 +1,104 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + + +#ifndef RENDERER_LIGHT_H +#define RENDERER_LIGHT_H + +#include <RendererConfig.h> +#include <RendererColor.h> +#include <RendererMaterial.h> +#include <RendererProjection.h> + +namespace SampleRenderer +{ + + class RendererLightDesc; + class Renderer; + class RendererLight + { + friend class Renderer; + public: + enum Type + { + TYPE_POINT = 0, + TYPE_DIRECTIONAL, + TYPE_SPOT, + + NUM_TYPES + }_Type; + + protected: + RendererLight(const RendererLightDesc &desc); + virtual ~RendererLight(void); + + public: + void release(void); + + Type getType(void) const; + + RendererMaterial::Pass getPass(void) const; + + const RendererColor &getColor(void) const; + void setColor(const RendererColor &color); + + float getIntensity(void) const; + void setIntensity(float intensity); + + bool isLocked(void) const; + + RendererTexture2D *getShadowMap(void) const; + void setShadowMap(RendererTexture2D *shadowMap); + + const physx::PxTransform &getShadowTransform(void) const { return m_shadowTransform; } + void setShadowTransform(const physx::PxTransform &shadowTransform) { m_shadowTransform = shadowTransform; } + + const RendererProjection &getShadowProjection(void) const; + void setShadowProjection(const RendererProjection &shadowProjection); + + private: + RendererLight &operator=(const RendererLight &) { return *this; } + + virtual void bind(void) const = 0; + + protected: + const Type m_type; + + RendererColor m_color; + float m_intensity; + + RendererTexture2D *m_shadowMap; + physx::PxTransform m_shadowTransform; + RendererProjection m_shadowProjection; + + private: + Renderer *m_renderer; + }; + +} // namespace SampleRenderer + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererLightDesc.h b/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererLightDesc.h new file mode 100644 index 00000000..12b6ade6 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererLightDesc.h @@ -0,0 +1,62 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#ifndef RENDERER_LIGHT_DESC_H +#define RENDERER_LIGHT_DESC_H + +#include <RendererLight.h> +#include <RendererProjection.h> + +namespace SampleRenderer +{ + + class RendererLightDesc + { + public: + const RendererLight::Type type; + + RendererColor color; + float intensity; + + RendererTexture2D *shadowMap; + physx::PxTransform shadowTransform; + RendererProjection shadowProjection; + + protected: + RendererLightDesc(RendererLight::Type _type); + virtual ~RendererLightDesc() {} + + public: + virtual bool isValid(void) const; + + private: + RendererLightDesc &operator=(const RendererLightDesc&) { return *this; } + }; + +} // namespace SampleRenderer + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererMaterial.h b/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererMaterial.h new file mode 100644 index 00000000..2ac8d77f --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererMaterial.h @@ -0,0 +1,194 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#ifndef RENDERER_MATERIAL_H +#define RENDERER_MATERIAL_H + +#include <RendererConfig.h> +#include <vector> + +namespace SampleRenderer +{ + + class RendererMaterialDesc; + + class RendererTexture; + class RendererTextureDesc; + + //ps3 need this declare + class RendererMaterialInstance; + + //ps3 need this declare + class Renderer; + + class RendererMaterial + { + friend class Renderer; + friend class RendererMaterialInstance; + public: + typedef enum Type + { + TYPE_UNLIT = 0, + TYPE_LIT, + NUM_TYPES, + } Type; + + typedef enum AlphaTestFunc + { + ALPHA_TEST_ALWAYS = 0, // disabled alpha testing... + ALPHA_TEST_EQUAL, + ALPHA_TEST_NOT_EQUAL, + ALPHA_TEST_LESS, + ALPHA_TEST_LESS_EQUAL, + ALPHA_TEST_GREATER, + ALPHA_TEST_GREATER_EQUAL, + + NUM_ALPHA_TEST_FUNCS, + } AlphaTestFunc; + + typedef enum BlendFunc + { + BLEND_ZERO = 0, + BLEND_ONE, + BLEND_SRC_COLOR, + BLEND_ONE_MINUS_SRC_COLOR, + BLEND_SRC_ALPHA, + BLEND_ONE_MINUS_SRC_ALPHA, + BLEND_DST_ALPHA, + BLEND_ONE_MINUS_DST_ALPHA, + BLEND_DST_COLOR, + BLEND_ONE_MINUS_DST_COLOR, + BLEND_SRC_ALPHA_SATURATE, + } BlendFunc; + + typedef enum Pass + { + PASS_UNLIT = 0, + + PASS_AMBIENT_LIGHT, + PASS_POINT_LIGHT, + PASS_DIRECTIONAL_LIGHT, + PASS_SPOT_LIGHT_NO_SHADOW, + PASS_SPOT_LIGHT, + + PASS_NORMALS, + PASS_DEPTH, + + // LRR: The deferred pass causes compiles with the ARB_draw_buffers profile option, creating + // multiple color draw buffers. This doesn't work in OGL on ancient Intel parts. + //PASS_DEFERRED, + + NUM_PASSES, + } Pass; + + typedef enum VariableType + { + VARIABLE_FLOAT = 0, + VARIABLE_FLOAT2, + VARIABLE_FLOAT3, + VARIABLE_FLOAT4, + VARIABLE_FLOAT4x4, + VARIABLE_INT, + VARIABLE_SAMPLER2D, + VARIABLE_SAMPLER3D, + + NUM_VARIABLE_TYPES + } VariableType; + + class Variable + { + friend class RendererMaterial; + protected: + Variable(const char *name, VariableType type, PxU32 offset); + virtual ~Variable(void); + + public: + const char *getName(void) const; + VariableType getType(void) const; + PxU32 getDataOffset(void) const; + PxU32 getDataSize(void) const; + + void setSize(PxU32); + + private: + char *m_name; + VariableType m_type; + PxU32 m_offset; + PxI32 m_size; + }; + + public: + static const char *getPassName(Pass pass); + virtual void setModelMatrix(const PxF32 *matrix) = 0; + + protected: + RendererMaterial(const RendererMaterialDesc &desc, bool enableMaterialCaching); + virtual ~RendererMaterial(void); + + public: + void incRefCount() { m_refCount++; } + void release(void); + const Variable *findVariable(const char *name, VariableType varType); + + PX_FORCE_INLINE Type getType(void) const { return m_type; } + PX_FORCE_INLINE AlphaTestFunc getAlphaTestFunc(void) const { return m_alphaTestFunc; } + PX_FORCE_INLINE float getAlphaTestRef(void) const { return m_alphaTestRef; } + PX_FORCE_INLINE bool getBlending(void) const { return m_blending && !rendererBlendingOverrideEnabled(); } + PX_FORCE_INLINE BlendFunc getSrcBlendFunc(void) const { return m_srcBlendFunc; } + PX_FORCE_INLINE BlendFunc getDstBlendFunc(void) const { return m_dstBlendFunc; } + PX_FORCE_INLINE PxU32 getMaterialInstanceDataSize(void) const { return m_variableBufferSize; } + + protected: + virtual const Renderer& getRenderer() const = 0; + virtual void bind(RendererMaterial::Pass pass, RendererMaterialInstance *materialInstance, bool instanced) const; + virtual void bindMeshState(bool instanced) const = 0; + virtual void unbind(void) const = 0; + virtual void bindVariable(Pass pass, const Variable &variable, const void *data) const = 0; + + RendererMaterial &operator=(const RendererMaterial&) { return *this; } + + bool rendererBlendingOverrideEnabled() const; + + protected: + const Type m_type; + + const AlphaTestFunc m_alphaTestFunc; + float m_alphaTestRef; + + bool m_blending; + const BlendFunc m_srcBlendFunc; + const BlendFunc m_dstBlendFunc; + + std::vector<Variable*> m_variables; + PxU32 m_variableBufferSize; + + PxI32 m_refCount; + bool mEnableMaterialCaching; + }; +} // namespace SampleRenderer + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererMaterialDesc.h b/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererMaterialDesc.h new file mode 100644 index 00000000..3c4257b3 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererMaterialDesc.h @@ -0,0 +1,68 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#ifndef RENDERER_MATERIAL_DESC_H +#define RENDERER_MATERIAL_DESC_H + +#include <RendererMaterial.h> + +namespace SampleRenderer +{ + + class RendererMaterialDesc + { + public: + RendererMaterial::Type type; + + RendererMaterial::AlphaTestFunc alphaTestFunc; + float alphaTestRef; + + bool blending; + bool instanced; + RendererMaterial::BlendFunc srcBlendFunc; + RendererMaterial::BlendFunc dstBlendFunc; + + const char *geometryShaderPath; + const char *hullShaderPath; + const char *domainShaderPath; + const char *vertexShaderPath; + const char *fragmentShaderPath; + + //all passes enabled + bool enabledPasses[RendererMaterial::NUM_PASSES]; + //instancing enabled + bool enableInstancing; + + public: + RendererMaterialDesc(void); + + bool isValid(void) const; + }; + +} // namespace SampleRenderer + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererMaterialInstance.h b/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererMaterialInstance.h new file mode 100644 index 00000000..6669faeb --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererMaterialInstance.h @@ -0,0 +1,65 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#ifndef RENDERER_MATERIAL_INSTANCE_H +#define RENDERER_MATERIAL_INSTANCE_H + +#include <RendererConfig.h> + +#include <RendererMaterial.h> + +namespace SampleRenderer +{ + + class RendererMaterialInstance + { + friend class RendererMaterial; + public: + RendererMaterialInstance(RendererMaterial &material); + RendererMaterialInstance(const RendererMaterialInstance& other); + ~RendererMaterialInstance(void); + + PX_FORCE_INLINE RendererMaterial &getMaterial(void) { return m_material; } + + PX_FORCE_INLINE const RendererMaterial::Variable *findVariable(const char *name, RendererMaterial::VariableType varType) + { + return m_material.findVariable(name, varType); + } + + void writeData(const RendererMaterial::Variable &var, const void *data); + + RendererMaterialInstance &operator=(const RendererMaterialInstance&); + + private: + RendererMaterial &m_material; + PxU8 *m_data; + + }; + +} // namespace SampleRenderer + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererMemoryMacros.h b/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererMemoryMacros.h new file mode 100644 index 00000000..6ef58e78 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererMemoryMacros.h @@ -0,0 +1,39 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + + +#ifndef RENDERER_MEMORY_MACROS_H +#define RENDERER_MEMORY_MACROS_H + + // PT: if you don't like those macros, don't use them. But don't touch/remove them! + #define DELETESINGLE(x) if(x){ delete x; x = NULL; } + #define DELETEARRAY(x) if(x){ delete []x; x = NULL; } + #define SAFE_RELEASE(x) if(x){ x->release(); x = NULL; } + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererMesh.h b/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererMesh.h new file mode 100644 index 00000000..f2edb8fd --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererMesh.h @@ -0,0 +1,118 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#ifndef RENDERER_MESH_H +#define RENDERER_MESH_H + +#include <RendererConfig.h> +#include <RendererIndexBuffer.h> + +namespace SampleRenderer +{ + class Renderer; + class RendererMeshDesc; + class RendererVertexBuffer; + class RendererIndexBuffer; + class RendererInstanceBuffer; + class RendererMaterial; + + class RendererMesh + { + friend class Renderer; + friend class GLES2Renderer; + public: + enum Primitive + { + PRIMITIVE_POINTS = 0, + PRIMITIVE_LINES, + PRIMITIVE_LINE_STRIP, + PRIMITIVE_TRIANGLES, + PRIMITIVE_TRIANGLE_STRIP, + PRIMITIVE_POINT_SPRITES, + + NUM_PRIMITIVES + }_Primitive; + + protected: + RendererMesh(const RendererMeshDesc &desc); + virtual ~RendererMesh(void); + + public: + void release(void); + + Primitive getPrimitives(void) const; + + PxU32 getNumVertices(void) const; + PxU32 getNumIndices(void) const; + PxU32 getNumInstances(void) const; + + void setVertexBufferRange(PxU32 firstVertex, PxU32 numVertices); + void setIndexBufferRange(PxU32 firstIndex, PxU32 numIndices); + void setInstanceBufferRange(PxU32 firstInstance, PxU32 numInstances); + + PxU32 getNumVertexBuffers(void) const; + const RendererVertexBuffer *const*getVertexBuffers(void) const; + + const RendererIndexBuffer *getIndexBuffer(void) const; + + const RendererInstanceBuffer *getInstanceBuffer(void) const; + + virtual bool willRender() const { return true; } + + protected: + void bind(void) const; + void render(RendererMaterial *material) const; + void unbind(void) const; + + virtual void renderIndices(PxU32 numVertices, PxU32 firstIndex, PxU32 numIndices, RendererIndexBuffer::Format indexFormat, RendererMaterial *material) const = 0; + virtual void renderVertices(PxU32 numVertices, RendererMaterial *material) const = 0; + + virtual void renderIndicesInstanced(PxU32 numVertices, PxU32 firstIndex, PxU32 numIndices, RendererIndexBuffer::Format indexFormat,RendererMaterial *material) const = 0; + virtual void renderVerticesInstanced(PxU32 numVertices,RendererMaterial *material) const = 0; + + virtual Renderer& renderer() = 0; + + protected: + Primitive m_primitives; + + RendererVertexBuffer **m_vertexBuffers; + PxU32 m_numVertexBuffers; + PxU32 m_firstVertex; + PxU32 m_numVertices; + + RendererIndexBuffer *m_indexBuffer; + PxU32 m_firstIndex; + PxU32 m_numIndices; + + RendererInstanceBuffer *m_instanceBuffer; + PxU32 m_firstInstance; + PxU32 m_numInstances; + }; + +} // namespace SampleRenderer + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererMeshContext.h b/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererMeshContext.h new file mode 100644 index 00000000..f7e96385 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererMeshContext.h @@ -0,0 +1,85 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#ifndef RENDERER_MESH_CONTEXT_H +#define RENDERER_MESH_CONTEXT_H + +#include <RendererConfig.h> + +namespace SampleRenderer +{ + + class Renderer; + class RendererMesh; + class RendererMaterial; + class RendererMaterialInstance; + + class RendererMeshContext + { + friend class Renderer; + public: + const RendererMesh *mesh; + RendererMaterial *material; + RendererMaterialInstance *materialInstance; + const physx::PxMat44 *transform; + const physx::PxF32 *shaderData; + + bool negativeScale; + + // TODO: this is kind of hacky, would prefer a more generalized + // solution via RendererMatrialInstance. + const physx::PxMat44 *boneMatrices; + PxU32 numBones; + + enum CullMode + { + CLOCKWISE = 0, + COUNTER_CLOCKWISE, + NONE + }; + + CullMode cullMode; + bool screenSpace; //TODO: I am not sure if this is needed! + + enum FillMode + { + SOLID, + LINE, + POINT, + }; + FillMode fillMode; + + public: + RendererMeshContext(void); + ~RendererMeshContext(void); + + bool isValid(void) const; + }; + +} // namespace SampleRenderer + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererMeshDesc.h b/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererMeshDesc.h new file mode 100644 index 00000000..1b717b74 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererMeshDesc.h @@ -0,0 +1,66 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#ifndef RENDERER_MESH_DESC_H +#define RENDERER_MESH_DESC_H + +#include <RendererMesh.h> + +namespace SampleRenderer +{ + + class RendererVertexBuffer; + class RendererIndexBuffer; + class RendererInstanceBuffer; + + class RendererMeshDesc + { + public: + RendererMesh::Primitive primitives; + + RendererVertexBuffer **vertexBuffers; + PxU32 numVertexBuffers; + PxU32 firstVertex; + PxU32 numVertices; + + RendererIndexBuffer *indexBuffer; + PxU32 firstIndex; + PxU32 numIndices; + + RendererInstanceBuffer *instanceBuffer; + PxU32 firstInstance; + PxU32 numInstances; + + public: + RendererMeshDesc(void); + + bool isValid(void) const; + }; + +} // namespace SampleRenderer + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererMeshShape.h b/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererMeshShape.h new file mode 100644 index 00000000..f6f83e45 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererMeshShape.h @@ -0,0 +1,56 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#ifndef RENDERER_MESH_SHAPE_H +#define RENDERER_MESH_SHAPE_H + +#include <RendererShape.h> + +namespace SampleRenderer +{ + + class RendererVertexBuffer; + class RendererIndexBuffer; + + class RendererMeshShape : public RendererShape + { + public: + RendererMeshShape(Renderer& renderer, + const PxVec3* verts, PxU32 numVerts, + const PxVec3* normals, + const PxReal* uvs, + const PxU16* faces16, const PxU32* faces32, PxU32 numFaces, bool flipWinding=false); + virtual ~RendererMeshShape(); + + private: + RendererVertexBuffer* m_vertexBuffer; + RendererIndexBuffer* m_indexBuffer; + }; + +} // namespace SampleRenderer + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererParticleSystemShape.h b/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererParticleSystemShape.h new file mode 100644 index 00000000..f6b504a1 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererParticleSystemShape.h @@ -0,0 +1,111 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#ifndef RENDERER_PARTICLE_SYSTEM_SHAPE_H +#define RENDERER_PARTICLE_SYSTEM_SHAPE_H + +#include <RendererShape.h> +#include "gpu/PxGpu.h" + +// fwd to avoid including cuda.h +#if defined(__x86_64) || defined(AMD64) || defined(_M_AMD64) +typedef unsigned long long CUdeviceptr; +#else +typedef unsigned int CUdeviceptr; +#endif + +namespace SampleRenderer +{ + + class RendererVertexBuffer; + class RendererInstanceBuffer; + class RendererIndexBuffer; + + class RendererParticleSystemShape : public RendererShape + { + enum VertexBufferEnum + { + STATIC_VB, + DYNAMIC_POS_VB, + DYNAMIC_COL_VB, + NUM_VERTEX_BUFFERS + }; + + public: + RendererParticleSystemShape(Renderer &renderer, + physx::PxU32 num_vertices, + bool _mInstanced, + bool _mFading, + PxReal fadingPeriod = 1.0f, + PxReal debriScaleFactor = 1.0f, + PxCudaContextManager* ctxMgr=NULL + ); + virtual ~RendererParticleSystemShape(void); + + bool updateBillboard(PxU32 validParticleRange, + CUdeviceptr positions, + CUdeviceptr validParticleBitmap, + CUdeviceptr lifetimes, + PxU32 numParticles); + + bool updateInstanced(PxU32 validParticleRange, + CUdeviceptr positions, + CUdeviceptr validParticleBitmap, + CUdeviceptr orientations, + PxU32 numParticles); + + void updateBillboard(PxU32 validParticleRange, + const PxVec3* positions, + const PxU32* validParticleBitmap, + const PxReal* lifetime = NULL); + + void updateInstanced(PxU32 validParticleRange, + const PxVec3* positions, + const PxU32* validParticleBitmap, + const PxMat33* orientation); + + bool isInteropEnabled() { return mCtxMgr != NULL; } + + private: + bool mInstanced; + bool mFading; + PxReal mFadingPeriod; + PxU32 mMaxParticles; + RendererVertexBuffer* mVertexBuffer[NUM_VERTEX_BUFFERS]; + RendererInstanceBuffer* mInstanceBuffer; + RendererIndexBuffer* mIndexBuffer; + + PxCudaContextManager* mCtxMgr; + + void initializeVertexBuffer(PxU32 color); + void initializeBuffersAsSimpleConvex(PxU32 color, PxReal scaleFactor); + void initializeInstanceBuffer(); + }; + +} // namespace SampleRenderer + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererProjection.h b/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererProjection.h new file mode 100644 index 00000000..b64b1b4d --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererProjection.h @@ -0,0 +1,60 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#ifndef RENDERER_PROJECTION_H +#define RENDERER_PROJECTION_H + +#include <RendererConfig.h> + +namespace SampleRenderer +{ + + class RendererProjection + { + public: + RendererProjection(float fov, float aspectRatio, float nearPlane, float farPlane); + RendererProjection(float left, float right, float bottom, float top, float near, float far); + RendererProjection(const PxMat44 mat); + + void getColumnMajor44(float *f) const; + void getRowMajor44(float *f) const; + operator PxMat44 () const { return *reinterpret_cast<const PxMat44*>( m_matrix ); } + PxMat44& getPxMat44() { return reinterpret_cast<PxMat44&>(*m_matrix ); } + const PxMat44& getPxMat44() const { return reinterpret_cast<const PxMat44&>(*m_matrix ); } + + private: + float m_matrix[16]; + }; + + void buildProjectMatrix(float *dst, const RendererProjection &proj, const physx::PxTransform &view); + void buildUnprojectMatrix(float *dst, const RendererProjection &proj, const physx::PxTransform &view); + PxVec3 unproject(const RendererProjection &proj, const physx::PxTransform &view, PxF32 x, PxF32 y, PxF32 z = 0); + PxVec3 project( const RendererProjection &proj, const physx::PxTransform &view, const PxVec3& pos); + +} // namespace SampleRenderer + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererShape.h b/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererShape.h new file mode 100644 index 00000000..18cec741 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererShape.h @@ -0,0 +1,65 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +// +// RendererShape : base class for convenience classes for generating meshes based on shapes. +// +#ifndef RENDERER_SHAPE_H +#define RENDERER_SHAPE_H + +#include <RendererConfig.h> + +namespace SampleRenderer +{ + + class Renderer; + class RendererMesh; + + class RendererShape + { + protected: + RendererShape(Renderer &renderer); + + public: + virtual ~RendererShape(void); + + RendererMesh *getMesh(void); + Renderer& getRenderer() const { return m_renderer; } + + private: + RendererShape &operator=(const RendererShape &) { return *this; } + + protected: + Renderer& m_renderer; + RendererMesh* m_mesh; + public: + void* m_userData; + }; + +} // namespace SampleRenderer + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererSimpleParticleSystemShape.h b/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererSimpleParticleSystemShape.h new file mode 100644 index 00000000..b7959f83 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererSimpleParticleSystemShape.h @@ -0,0 +1,62 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#ifndef RENDERER_SIMPLE_PARTICLE_SYSTEM_SHAPE_H +#define RENDERER_SIMPLE_PARTICLE_SYSTEM_SHAPE_H + +#include <RendererShape.h> + +namespace SampleRenderer +{ + + class RendererVertexBuffer; + class RendererIndexBuffer; + + // this shape is used when no sprite rendering is possible - dx11 with feature dx9 for example + class RendererSimpleParticleSystemShape : public RendererShape + { + public: + RendererSimpleParticleSystemShape(Renderer &renderer, + physx::PxU32 num_vertices); + virtual ~RendererSimpleParticleSystemShape(void); + + void updateBillboard(PxU32 validParticleRange, + const PxVec3* positions, + const PxU32* validParticleBitmap, + const PxReal* lifetime = NULL); + + private: + PxU32 mMaxParticles; + RendererVertexBuffer* mVertexBuffer; + RendererIndexBuffer* mIndexBuffer; + + void initializeVertexBuffer(PxU32 color); + }; + +} // namespace SampleRenderer + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererSpotLight.h b/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererSpotLight.h new file mode 100644 index 00000000..effd11f1 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererSpotLight.h @@ -0,0 +1,70 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#ifndef RENDERER_SPOT_LIGHT_H +#define RENDERER_SPOT_LIGHT_H + +#include <RendererLight.h> + +namespace SampleRenderer +{ + + class RendererSpotLightDesc; + + class RendererSpotLight : public RendererLight + { + protected: + RendererSpotLight(const RendererSpotLightDesc &desc); + virtual ~RendererSpotLight(void); + + public: + const PxVec3 &getPosition(void) const; + void setPosition(const PxVec3 &pos); + + const PxVec3 &getDirection(void) const; + void setDirection(const PxVec3 &dir); + + PxF32 getInnerRadius(void) const; + PxF32 getOuterRadius(void) const; + void setRadius(PxF32 innerRadius, PxF32 outerRadius); + + PxF32 getInnerCone(void) const; + PxF32 getOuterCone(void) const; + void setCone(PxF32 innerCone, PxF32 outerCone); + + protected: + PxVec3 m_position; + PxVec3 m_direction; + PxF32 m_innerRadius; + PxF32 m_outerRadius; + PxF32 m_innerCone; + PxF32 m_outerCone; + }; + +} // namespace SampleRenderer + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererSpotLightDesc.h b/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererSpotLightDesc.h new file mode 100644 index 00000000..676ae2f0 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererSpotLightDesc.h @@ -0,0 +1,58 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#ifndef RENDERER_SPOT_LIGHT_DESC_H +#define RENDERER_SPOT_LIGHT_DESC_H + +#include <RendererLightDesc.h> + +namespace SampleRenderer +{ + + class RendererSpotLightDesc : public RendererLightDesc + { + public: + PxVec3 position; + PxVec3 direction; + + PxF32 innerRadius; + PxF32 outerRadius; + + // cone = dot(direction, directionToFragment); + // so cone value of 0 is completely open and value of 1 is completely closed. + PxF32 innerCone; + PxF32 outerCone; + + public: + RendererSpotLightDesc(void); + + virtual bool isValid(void) const; + }; + +} // namespace SampleRenderer + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererTarget.h b/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererTarget.h new file mode 100644 index 00000000..698404ab --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererTarget.h @@ -0,0 +1,50 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#ifndef RENDERER_TARGET_H +#define RENDERER_TARGET_H + +namespace SampleRenderer +{ + + class RendererTarget + { + friend class Renderer; + public: + RendererTarget(void); + virtual ~RendererTarget(void); + + void release(void) { delete this; } + + private: + virtual void bind(void)=0; + virtual void unbind(void)=0; + }; + +} // namespace SampleRenderer + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererTargetDesc.h b/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererTargetDesc.h new file mode 100644 index 00000000..d8a055b4 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererTargetDesc.h @@ -0,0 +1,52 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#ifndef RENDERER_TARGET_DESC_H +#define RENDERER_TARGET_DESC_H + +#include <RendererConfig.h> + +namespace SampleRenderer +{ + + class RendererTargetDesc + { + public: + RendererTexture2D **textures; + PxU32 numTextures; + + RendererTexture2D *depthStencilSurface; + + public: + RendererTargetDesc(void); + + bool isValid(void) const; + }; + +} // namespace SampleRenderer + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererTerrainShape.h b/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererTerrainShape.h new file mode 100644 index 00000000..c066617a --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererTerrainShape.h @@ -0,0 +1,59 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +// +// RendererTerrainShape : convenience class for generating a terrain mesh. +// +#ifndef RENDERER_TERRAIN_SHAPE_H +#define RENDERER_TERRAIN_SHAPE_H + +#include <RendererShape.h> + +namespace SampleRenderer +{ + + class RendererVertexBuffer; + class RendererIndexBuffer; + + class RendererTerrainShape : public RendererShape + { + public: + RendererTerrainShape(Renderer &renderer, + PxVec3 *verts, PxU32 numVerts, + PxVec3 *normals, PxU32 numNorms, + PxU16 *faces, PxU32 numFaces, + PxF32 uvScale); + virtual ~RendererTerrainShape(void); + + private: + RendererVertexBuffer *m_vertexBuffer; + RendererIndexBuffer *m_indexBuffer; + }; + +} // namespace SampleRenderer + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererTexture.h b/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererTexture.h new file mode 100644 index 00000000..bc15dcd0 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererTexture.h @@ -0,0 +1,131 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#ifndef RENDERER_TEXTURE_H +#define RENDERER_TEXTURE_H + +#include <RendererConfig.h> + +namespace SampleRenderer +{ + + class RendererTextureDesc; + + class RendererTexture + { + public: + enum Format + { + FORMAT_B8G8R8A8 = 0, + FORMAT_R8G8B8A8, + FORMAT_A8, + FORMAT_R32F, + + FORMAT_DXT1, + FORMAT_DXT3, + FORMAT_DXT5, + + FORMAT_D16, + FORMAT_D24S8, + + FORMAT_GXT, + + FORMAT_PVR_2BPP, + FORMAT_PVR_4BPP, + + NUM_FORMATS + }_Format; + + enum Filter + { + FILTER_NEAREST = 0, + FILTER_LINEAR, + FILTER_ANISOTROPIC, + + NUM_FILTERS + }_Filter; + + enum Addressing + { + ADDRESSING_WRAP = 0, + ADDRESSING_CLAMP, + ADDRESSING_MIRROR, + + NUM_ADDRESSING + }_Addressing; + + public: + static PxU32 computeImageByteSize(PxU32 width, PxU32 height, PxU32 depth, Format format); + static PxU32 getLevelDimension(PxU32 dimension, PxU32 level); + static bool isCompressedFormat(Format format); + static bool isDepthStencilFormat(Format format); + static PxU32 getFormatNumBlocks(PxU32 dimension, Format format); + static PxU32 getFormatBlockSize(Format format); + + protected: + RendererTexture(const RendererTextureDesc &desc); + virtual ~RendererTexture(void); + + public: + void release(void) { delete this; } + + Format getFormat(void) const { return m_format; } + Filter getFilter(void) const { return m_filter; } + Addressing getAddressingU(void) const { return m_addressingU; } + Addressing getAddressingV(void) const { return m_addressingV; } + PxU32 getWidth(void) const { return m_width; } + PxU32 getHeight(void) const { return m_height; } + PxU32 getDepth(void) const { return m_depth; } + PxU32 getNumLevels(void) const { return m_numLevels; } + + PxU32 getWidthInBlocks(void) const; + PxU32 getHeightInBlocks(void) const; + PxU32 getBlockSize(void) const; + + public: + //! pitch is the number of bytes between the start of each row. + virtual void *lockLevel(PxU32 level, PxU32 &pitch) = 0; + virtual void unlockLevel(PxU32 level) = 0; + virtual void select(PxU32 stageIndex) = 0; + + private: + RendererTexture &operator=(const RendererTexture&) { return *this; } + + private: + Format m_format; + Filter m_filter; + Addressing m_addressingU; + Addressing m_addressingV; + PxU32 m_width; + PxU32 m_height; + PxU32 m_depth; + PxU32 m_numLevels; + }; + +} // namespace SampleRenderer + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererTexture2D.h b/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererTexture2D.h new file mode 100644 index 00000000..601a3eb3 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererTexture2D.h @@ -0,0 +1,33 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#ifndef RENDERER_TEXTURE_2D_H +#define RENDERER_TEXTURE_2D_H + +#include <RendererTexture.h> + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererTexture2DDesc.h b/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererTexture2DDesc.h new file mode 100644 index 00000000..4d8b16ab --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererTexture2DDesc.h @@ -0,0 +1,33 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#ifndef RENDERER_TEXTURE_2D_DESC_H +#define RENDERER_TEXTURE_2D_DESC_H + +#include <RendererTextureDesc.h> + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererTextureDesc.h b/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererTextureDesc.h new file mode 100644 index 00000000..08a7929e --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererTextureDesc.h @@ -0,0 +1,62 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#ifndef RENDERER_TEXTURE_DESC_H +#define RENDERER_TEXTURE_DESC_H + +#include <RendererTexture.h> + +namespace SampleRenderer +{ + + class RendererTextureDesc + { + public: + RendererTexture::Format format; + RendererTexture::Filter filter; + RendererTexture::Addressing addressingU; + RendererTexture::Addressing addressingV; + RendererTexture::Addressing addressingW; + + PxU32 width; + PxU32 height; + PxU32 depth; + PxU32 numLevels; + + bool renderTarget; + + void* data; + + public: + RendererTextureDesc(void); + + bool isValid(void) const; + }; + +} // namespace SampleRenderer + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererUtils.h b/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererUtils.h new file mode 100644 index 00000000..d750a9de --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererUtils.h @@ -0,0 +1,90 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + + +#ifndef RENDERER_UTILS_H +#define RENDERER_UTILS_H + +namespace SampleRenderer +{ + +class safe_bool_base +{ +protected: + typedef void (safe_bool_base::*bool_type)() const; + void this_type_does_not_support_comparisons() const {} + + safe_bool_base() {} + safe_bool_base(const safe_bool_base&) {} + safe_bool_base& operator=(const safe_bool_base&) {return *this;} + ~safe_bool_base() {} +}; + +template <typename T=void> class safe_bool : public safe_bool_base +{ +public: + operator bool_type() const + { + return (static_cast<const T*>(this))->boolean_test() ? + //&safe_bool_base::this_type_does_not_support_comparisons : 0; + &safe_bool<T>::this_type_does_not_support_comparisons : 0; + } +protected: + ~safe_bool() {} +}; + +template<> class safe_bool<void> : public safe_bool_base +{ +public: + operator bool_type() const + { + return boolean_test()==true ? + //&safe_bool_base::this_type_does_not_support_comparisons : 0; + &safe_bool<void>::this_type_does_not_support_comparisons : 0; + } +protected: + virtual bool boolean_test() const=0; + virtual ~safe_bool() {} +}; + +template <typename T, typename U> +PX_INLINE bool operator==(const safe_bool<T>& lhs,const safe_bool<U>& rhs) +{ + lhs.this_type_does_not_support_comparisons(); + return false; +} + +template <typename T,typename U> +PX_INLINE bool operator!=(const safe_bool<T>& lhs,const safe_bool<U>& rhs) +{ + lhs.this_type_does_not_support_comparisons(); + return false; +} + +} + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererVertexBuffer.h b/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererVertexBuffer.h new file mode 100644 index 00000000..a1914677 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererVertexBuffer.h @@ -0,0 +1,156 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#ifndef RENDERER_VERTEXBUFFER_H +#define RENDERER_VERTEXBUFFER_H + +#include <RendererConfig.h> +#include "RendererInteropableBuffer.h" + +namespace SampleRenderer +{ + + class RendererVertexBufferDesc; + + class RendererVertexBuffer: public RendererInteropableBuffer + { + friend class RendererMesh; + friend class GLES2Renderer; + public: + enum Semantic + { + SEMANTIC_POSITION = 0, + SEMANTIC_COLOR, + SEMANTIC_NORMAL, + SEMANTIC_TANGENT, + + SEMANTIC_DISPLACEMENT_TEXCOORD, + SEMANTIC_DISPLACEMENT_FLAGS, + + SEMANTIC_BONEINDEX, + SEMANTIC_BONEWEIGHT, + + SEMANTIC_TEXCOORD0, + SEMANTIC_TEXCOORD1, + SEMANTIC_TEXCOORD2, + SEMANTIC_TEXCOORD3, + SEMANTIC_TEXCOORDMAX = SEMANTIC_TEXCOORD3, + + NUM_SEMANTICS, + NUM_TEXCOORD_SEMANTICS = SEMANTIC_TEXCOORDMAX - SEMANTIC_TEXCOORD0, + }_Semantic; + + enum Format + { + FORMAT_FLOAT1 = 0, + FORMAT_FLOAT2, + FORMAT_FLOAT3, + FORMAT_FLOAT4, + + FORMAT_UBYTE4, + FORMAT_USHORT4, + + FORMAT_COLOR_BGRA, // RendererColor + FORMAT_COLOR_RGBA, // OGL format + FORMAT_COLOR_NATIVE, // do not convert + + NUM_FORMATS, + }_Format; + + enum Hint + { + HINT_STATIC = 0, + HINT_DYNAMIC, + }_Hint; + + public: + static PxU32 getFormatByteSize(Format format); + + protected: + RendererVertexBuffer(const RendererVertexBufferDesc &desc); + virtual ~RendererVertexBuffer(void); + + public: + void release(void) { delete this; } + + PxU32 getMaxVertices(void) const; + + Hint getHint(void) const; + Format getFormatForSemantic(Semantic semantic) const; + + void *lockSemantic(Semantic semantic, PxU32 &stride); + void unlockSemantic(Semantic semantic); + + //Checks buffer written state for vertex buffers in D3D + virtual bool checkBufferWritten() { return true; } + + virtual void *lock(void) = 0; + virtual void unlock(void) = 0; + PxU32 getStride(void) const { return m_stride; } + + private: + virtual void swizzleColor(void *colors, PxU32 stride, PxU32 numColors, RendererVertexBuffer::Format inFormat) = 0; + + virtual void bind(PxU32 streamID, PxU32 firstVertex) = 0; + virtual void unbind(PxU32 streamID) = 0; + + RendererVertexBuffer &operator=(const RendererVertexBuffer &) { return *this; } + + protected: + void prepareForRender(void); + + protected: + class SemanticDesc + { + public: + Format format; + PxU32 offset; + bool locked; + public: + SemanticDesc(void) + { + format = NUM_FORMATS; + offset = 0; + locked = false; + } + }; + + protected: + const Hint m_hint; + PxU32 m_maxVertices; + PxU32 m_stride; + bool m_deferredUnlock; + SemanticDesc m_semanticDescs[NUM_SEMANTICS]; + + private: + void *m_lockedBuffer; + PxU32 m_numSemanticLocks; + }; + +} // namespace SampleRenderer + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererVertexBufferDesc.h b/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererVertexBufferDesc.h new file mode 100644 index 00000000..aef6ecc6 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererVertexBufferDesc.h @@ -0,0 +1,58 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#ifndef RENDERER_VERTEXBUFFER_DESC_H +#define RENDERER_VERTEXBUFFER_DESC_H + +#include <RendererVertexBuffer.h> + +namespace SampleRenderer +{ + + class RendererVertexBufferDesc + { + public: + RendererVertexBuffer::Hint hint; + RendererVertexBuffer::Format semanticFormats[RendererVertexBuffer::NUM_SEMANTICS]; + + PxU32 maxVertices; + + ///mark this buffer can be read back by lock, lock flag should not be discard + bool canReadBack; + + bool registerInCUDA; + physx::PxCudaContextManager* interopContext; + + public: + RendererVertexBufferDesc(void); + + bool isValid(void) const; + }; + +} // namespace SampleRenderer + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererWindow.h b/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererWindow.h new file mode 100644 index 00000000..ace5bbe7 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/include/RendererWindow.h @@ -0,0 +1,88 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + + +#ifndef RENDERER_WINDOW_H +#define RENDERER_WINDOW_H + +#include <RendererConfig.h> + +namespace SampleFramework { + class SamplePlatform; +} + +namespace SampleRenderer +{ + + class RendererWindow + { + public: + RendererWindow(void); + virtual ~RendererWindow(void); + + bool open(PxU32 width, PxU32 height, const char *title, bool fullscreen=false); + void close(void); + + bool isOpen(void) const; + + // update the window's state... handle messages, etc. + void update(void); + + // resize the window... + void setSize(PxU32 width, PxU32 height); + + // get/set the window's title... + void getTitle(char *title, PxU32 maxLength) const; + void setTitle(const char *title); + + bool hasFocus() const; + void setFocus(bool b); + + SampleFramework::SamplePlatform* getPlatform() { return m_platform; } + public: + // called just AFTER the window opens. + virtual void onOpen(void) {} + + // called just BEFORE the window closes. return 'true' to confirm the window closure. + virtual bool onClose(void) { return true; } + + // called just AFTER the window is resized. + virtual void onResize(PxU32 /*width*/, PxU32 /*height*/) {} + + // called when the window's contents needs to be redrawn. + virtual void onDraw(void) = 0; + + protected: + SampleFramework::SamplePlatform* m_platform; + + private: + bool m_isOpen; + }; + +} // namespace SampleRenderer + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/include/windows/WindowsGLIncludes.h b/PhysX_3.4/Samples/SampleFramework/renderer/include/windows/WindowsGLIncludes.h new file mode 100644 index 00000000..01fadfc0 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/include/windows/WindowsGLIncludes.h @@ -0,0 +1,34 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#ifndef WINDOWS_GL_INCLUDES_H +#define WINDOWS_GL_INCLUDES_H + +#define GLEW_STATIC +#include <GL/glew.h> + +#endif
\ No newline at end of file diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/Renderer.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/Renderer.cpp new file mode 100644 index 00000000..3c59cfef --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/Renderer.cpp @@ -0,0 +1,2107 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#include "RendererFoundation.h" +#include <Renderer.h> +#include <RendererDesc.h> +#include "ogl/OGLRenderer.h" +#include "gles2/GLES2Renderer.h" +#include "d3d9/D3D9Renderer.h" +#if defined(RENDERER_ENABLE_LIBGNM) +#include "ps4/GnmRenderer.h" +#endif +#include "d3d11/D3D11Renderer.h" +#include "null/NULLRenderer.h" +#include <RendererMesh.h> +#include <RendererMeshContext.h> + +#include <RendererMaterial.h> +#include <RendererMaterialDesc.h> +#include <RendererMaterialInstance.h> +#include <RendererProjection.h> + +#include <RendererTarget.h> +#include <RendererTexture2D.h> +#include <RendererTexture2DDesc.h> + +#include <RendererVertexBuffer.h> +#include <RendererVertexBufferDesc.h> +#include <RendererMesh.h> +#include <RendererMeshDesc.h> + +#include <RendererLight.h> +#include "PsUtilities.h" + +#include <algorithm> +#include <sstream> +#include <string> +#include <vector> + +#include "PsUtilities.h" +#include "extensions/PxDefaultStreams.h" + +#if defined(RENDERER_ANDROID) +#include <android/AndroidSampleUserInputIds.h> +#endif + +// for PsString.h +#include <PsString.h> +#include <PxTkFile.h> + +namespace Ps = physx::shdfnd; + +using namespace SampleRenderer; + + +/* Screen pads for tablets. + Initialize two controls - second one is the vertically mirrored version of the first one with respect to the screen center + All values are in relative units, given that bottom-left point is (-1.0f, -1.0f), center is (0.0f, 0.0f) and top-right point is (1.0f, 1.0f) */ +#if defined(RENDERER_TABLET) +const PxReal gControlSizeRelative = 0.16f; +const PxReal gControlMarginRelative = 0.08f; +const PxU8 CONTROL_COUNT = 2; + +const PxU8 TEXT_HEIGHT = 16; +const PxU8 TEXT_VERTICAL_SPACING = TEXT_HEIGHT / 4; +#endif + +Renderer *Renderer::createRenderer(const RendererDesc &desc, const char* assetDir, bool enableMaterialCaching) +{ + Renderer *renderer = 0; + const bool valid = desc.isValid(); + if(valid) + { + switch(desc.driver) + { + case DRIVER_GLES2: +#if defined(RENDERER_ENABLE_GLES2) + renderer = new GLES2Renderer(desc, assetDir); + // disable material caching, not implemented! + enableMaterialCaching = false; +#endif + break; + + case DRIVER_OPENGL: +#if defined(RENDERER_ENABLE_OPENGL) + renderer = new OGLRenderer(desc, assetDir); +#endif + break; + + case DRIVER_DIRECT3D9: +#if defined(RENDERER_ENABLE_DIRECT3D9) + renderer = new D3D9Renderer(desc, assetDir); +#endif + break; + + case DRIVER_DIRECT3D11: +#if defined(RENDERER_ENABLE_DIRECT3D11) + renderer = new D3D11Renderer(desc, assetDir); +#endif + break; + + case DRIVER_LIBGCM: +#if defined(RENDERER_ENABLE_LIBGCM) + // not implemented, PS3 should use OpenGL +#endif + break; + + case DRIVER_LIBGNM: +#if defined(RENDERER_ENABLE_LIBGNM) + renderer = new GnmRenderer(desc, assetDir); + // disable material caching, not implemented! + enableMaterialCaching = false; +#endif + break; + + case DRIVER_NULL: + renderer = new NullRenderer(desc,assetDir); + break; + } + + if(renderer) + { + renderer->setEnableMaterialCaching(enableMaterialCaching); + } + } + if(renderer && !renderer->isOk()) + { + renderer->release(); + renderer = 0; + } + RENDERER_ASSERT(renderer, "Failed to create renderer!"); + return renderer; +} + +const char *Renderer::getDriverTypeName(DriverType type) +{ + const char *name = 0; + switch(type) + { + case DRIVER_OPENGL: name = "OpenGL"; break; + case DRIVER_GLES2: name = "OpenGL ES 2.0"; break; + case DRIVER_DIRECT3D9: name = "Direct3D9"; break; + case DRIVER_DIRECT3D11: name = "Direct3D11"; break; + case DRIVER_LIBGCM: name = "LibGCM"; break; + case DRIVER_LIBGNM: name = "LibGNM"; break; + case DRIVER_NULL: name = "NullRenderer"; break; + } + RENDERER_ASSERT(name, "Unable to find Name String for Renderer Driver Type."); + return name; +} + + +Renderer::Renderer(DriverType driver, PxErrorCallback* errorCallback, const char* assetDir) : + m_driver (driver), + m_errorCallback (errorCallback), + m_textMaterial (NULL), + m_textMaterialInstance (NULL), + m_screenquadOpaqueMaterial (NULL), + m_screenquadOpaqueMaterialInstance (NULL), + m_screenquadAlphaMaterial (NULL), + m_screenquadAlphaMaterialInstance (NULL), + m_useShadersForTextRendering (true), + m_assetDir (assetDir), + m_cacheDir (NULL), + m_enableTessellation (false), + m_enableWireframe (false), + m_enableBlendingOverride (false), + m_enableBlendingCull (false), + mEnableMaterialCaching (true) +{ + m_pixelCenterOffset = 0; + setAmbientColor(RendererColor(64,64,64, 255)); + setFog(RendererColor(0,0,10,255), 20000.0f); + setClearColor(RendererColor(133,153,181,255)); + Ps::strlcpy(m_deviceName, sizeof(m_deviceName), "UNKNOWN"); +#ifdef RENDERER_TABLET + m_buttons.reserve(16); +#endif +} + +Renderer::~Renderer(void) +{ + PX_ASSERT(!m_screenquadOpaqueMaterial); + PX_ASSERT(!m_screenquadOpaqueMaterialInstance); + PX_ASSERT(!m_screenquadAlphaMaterial); + PX_ASSERT(!m_screenquadAlphaMaterialInstance); + + PX_ASSERT(!m_textMaterial); + PX_ASSERT(!m_textMaterialInstance); + + for (tMaterialCache::iterator it = m_materialCache.begin(); it != m_materialCache.end(); ++it) + { + ::free((void*)it->first.vertexShaderPath); + ::free((void*)it->first.fragmentShaderPath); + ::free((void*)it->first.geometryShaderPath); + ::free((void*)it->first.domainShaderPath); + ::free((void*)it->first.hullShaderPath); + + PX_ASSERT(it->second == NULL); + } +} + + +void Renderer::release(void) +{ + closeScreenquad(); + delete this; +} + +// Create a 2D or 3D texture, depending on texture depth +RendererTexture* SampleRenderer::Renderer::createTexture(const RendererTextureDesc &desc) +{ + return desc.depth > 1 ? createTexture3D(desc) : createTexture2D(desc); +} + +// get the driver type for this renderer. +Renderer::DriverType Renderer::getDriverType(void) const +{ + return m_driver; +} + +// get the offset to the center of a pixel relative to the size of a pixel (so either 0 or 0.5). +PxF32 Renderer::getPixelCenterOffset(void) const +{ + return m_pixelCenterOffset; +} + +// get the name of the hardware device. +const char *Renderer::getDeviceName(void) const +{ + return m_deviceName; +} + +const char *Renderer::getAssetDir() +{ + return m_assetDir.c_str(); +} + +void Renderer::setAssetDir(const char * assetDir) +{ + m_assetDir = assetDir; +} + +// adds a mesh to the render queue. +void Renderer::queueMeshForRender(RendererMeshContext &mesh) +{ + RENDERER_ASSERT( mesh.isValid(), "Mesh Context is invalid."); + if(mesh.isValid()) + { + if (mesh.screenSpace) + { + m_screenSpaceMeshes.push_back(mesh); + } + else + { + switch (mesh.material->getType()) + { + case RendererMaterial::TYPE_LIT: + if (mesh.material->getBlending()) + m_visibleLitTransparentMeshes.push_back(mesh); + else + m_visibleLitMeshes.push_back(mesh); + break; + default: //case RendererMaterial::TYPE_UNLIT: + m_visibleUnlitMeshes.push_back(mesh); + // break; + } + } + } +} + +struct RenderMeshContextHasMesh +{ + RenderMeshContextHasMesh(const RendererMesh* mesh) : mMesh(mesh) { } + + bool operator()(const RendererMeshContext& meshContext) + { + return meshContext.mesh == mMesh; + } + + const RendererMesh* mMesh; +}; + +void SampleRenderer::Renderer::removeMeshFromRenderQueue(RendererMesh& mesh) +{ + MeshVector* meshContextQueues[] = { &m_visibleLitMeshes, + &m_visibleUnlitMeshes, + &m_screenSpaceMeshes, + &m_visibleLitTransparentMeshes }; + + // All queues must be searched, as a single mesh can be used in multiple contexts + for (PxU32 i = 0; i < PX_ARRAY_SIZE(meshContextQueues); ++i) + { + MeshVector& meshContextQueue = *meshContextQueues[i]; + meshContextQueue.erase(std::remove_if(meshContextQueue.begin(), + meshContextQueue.end(), + RenderMeshContextHasMesh(&mesh)), + meshContextQueue.end()); + } +} + +// adds a light to the render queue. +void Renderer::queueLightForRender(RendererLight &light) +{ + RENDERER_ASSERT(!light.isLocked(), "Light is already locked to a Renderer."); + if(!light.isLocked()) + { + light.m_renderer = this; + m_visibleLights.push_back(&light); + } +} + +void SampleRenderer::Renderer::removeLightFromRenderQueue(RendererLight &light) +{ + m_visibleLights.erase(std::remove(m_visibleLights.begin(), m_visibleLights.end(), &light)); +} + +// renders the current scene to the offscreen buffers. empties the render queue when done. +void Renderer::render(const physx::PxMat44 &eye, const RendererProjection &proj, RendererTarget *target, bool depthOnly) +{ + PX_PROFILE_ZONE("Renderer_render",0); + const PxU32 numLights = (PxU32)m_visibleLights.size(); + if(target) + { + target->bind(); + } + // TODO: Sort meshes by material.. + ScopedRender renderSection(*this); + if(renderSection) + { + if(!depthOnly) + { + // YOU CAN PASS THE PROJECTION MATIX RIGHT INTO THIS FUNCTION! + // TODO: Get rid of this. + if (m_screenSpaceMeshes.size()) + { + physx::PxMat44 id = physx::PxMat44(PxIdentity); + bindViewProj(id, RendererProjection(-1.0f, 1.0f, -1.0f, 1.0f, 1.0f, -1.0f)); //TODO: pass screen space matrices + renderMeshes(m_screenSpaceMeshes, RendererMaterial::PASS_UNLIT); //render screen space stuff first so stuff we occlude doesn't waste time on shading. + } + } + + sortMeshes(eye); + + if(depthOnly) + { + PX_PROFILE_ZONE("Renderer_render_depthOnly",0); + bindAmbientState(RendererColor(0,0,0,255)); + bindViewProj(eye, proj); + renderMeshes(m_visibleLitMeshes, RendererMaterial::PASS_DEPTH); + renderMeshes(m_visibleUnlitMeshes, RendererMaterial::PASS_DEPTH); + } + else if(numLights > RENDERER_DEFERRED_THRESHOLD) + { + PX_PROFILE_ZONE("Renderer_render_deferred",0); + bindDeferredState(); + bindViewProj(eye, proj); + renderMeshes(m_visibleLitMeshes, RendererMaterial::PASS_UNLIT); + renderMeshes(m_visibleUnlitMeshes, RendererMaterial::PASS_UNLIT); + renderMeshes(m_visibleLitTransparentMeshes, RendererMaterial::PASS_UNLIT); + renderDeferredLights(); + } + else if(numLights > 0) + { + PX_PROFILE_ZONE("Renderer_render_lit",0); + bindAmbientState(m_ambientColor); + bindFogState(m_fogColor, m_fogDistance); + bindViewProj(eye, proj); + +#if RENDERER_ENABLE_SINGLE_PASS_LIGHTING + for(PxU32 i=0; i<numLights; i++) + { + m_visibleLights[i]->bind(i); + } + renderMeshes(m_visibleLitMeshes, m_visibleLights[0]->getPass()); + for(PxU32 i=0; i<numLights; i++) + { + m_visibleLights[i]->m_renderer = NULL; + } +#else + RendererLight &light0 = *m_visibleLights[0]; + light0.bind(); + renderMeshes(m_visibleLitMeshes, light0.getPass()); + + bindAmbientState(RendererColor(0,0,0,255)); + beginMultiPass(); + for(PxU32 i=1; i<numLights; i++) + { + RendererLight &light = *m_visibleLights[i]; + light.bind(); + renderMeshes(m_visibleLitMeshes, light.getPass()); + } + endMultiPass(); +#endif + renderMeshes(m_visibleUnlitMeshes, RendererMaterial::PASS_UNLIT); + + /////////////////////////////////////////////////////////////////////////// + if (m_visibleLitTransparentMeshes.size() > 0) + { + light0.bind(); + renderMeshes(m_visibleLitTransparentMeshes, light0.getPass()); + + bindAmbientState(RendererColor(0,0,0,255)); + beginTransparentMultiPass(); + for(PxU32 i=1; i<numLights; i++) + { + RendererLight &light = *m_visibleLights[i]; + light.bind(); + renderMeshes(m_visibleLitTransparentMeshes, light.getPass()); + } + endTransparentMultiPass(); + } + /////////////////////////////////////////////////////////////////////////// + + for (physx::PxU32 i = 0; i < numLights; ++i) + m_visibleLights[i]->m_renderer = 0; + } + else + { + PX_PROFILE_ZONE("Renderer_render_unlit",0); + bindAmbientState(RendererColor(0,0,0,255)); + bindViewProj(eye, proj); + renderMeshes(m_visibleLitMeshes, RendererMaterial::PASS_UNLIT); + renderMeshes(m_visibleUnlitMeshes, RendererMaterial::PASS_UNLIT); + renderMeshes(m_visibleLitTransparentMeshes, RendererMaterial::PASS_UNLIT); + } + } + { + PX_PROFILE_ZONE("Cleanup", 0); + if (target) target->unbind(); + m_visibleLitMeshes.clear(); + m_visibleUnlitMeshes.clear(); + m_visibleLitTransparentMeshes.clear(); + m_screenSpaceMeshes.clear(); + m_visibleLights.clear(); + } +} + +// sets the ambient lighting color. +void Renderer::setAmbientColor(const RendererColor &ambientColor) +{ + m_ambientColor = ambientColor; + m_ambientColor.a = 255; +} + +void Renderer::setFog(const RendererColor &fogColor, float fogDistance) +{ + m_fogColor = fogColor; + m_fogDistance = fogDistance; +} + +void Renderer::setClearColor(const RendererColor &clearColor) +{ + m_clearColor = clearColor; + m_clearColor.a = 255; +} + +Renderer::TessellationParams::TessellationParams() +{ + setDefault(); +} + +void Renderer::TessellationParams::setDefault() +{ + tessFactor = PxVec4(6.f, 6.f, 3.f, 100.f); + tessMinMaxDistance[0] = 5.0f; + tessMinMaxDistance[1] = 50; + tessHeightScaleAndBias[0] = 1.0f; + tessHeightScaleAndBias[1] = 0.5f; + tessUVScale[0] = 1.0f; + tessUVScale[1] = 1.0f; +} + +std::string SampleRenderer::Renderer::TessellationParams::toString() +{ + std::stringstream ss; + ss << "TessParams = " << std::endl; + ss << "\tTessFactor: " << tessFactor.x << " " << tessFactor.y << " " << tessFactor.z << " " << tessFactor.w << std::endl; + ss << "\tTessMinMax: " << tessMinMaxDistance[0] << " " << tessMinMaxDistance[1] << std::endl; + ss << "\tTessHeightScale: " << tessHeightScaleAndBias[0] << " " << tessHeightScaleAndBias[1] << std::endl; + ss << "\tTessUVScale: " << tessUVScale[0] << " " << tessUVScale[1] << std::endl; + return ss.str(); +} + +void Renderer::setTessellationParams(const TessellationParams& params) +{ + m_tessellationParams = params; +} + +static PX_INLINE PxU32 createPixel(PxU8 r, PxU8 g, PxU8 b) +{ + // G = bits 0-7 + // B = bits 8-15 + // R = bits 16-23 + return (r << 16) | (g << 8) | b; +} + +void Renderer::formatScreenshot(PxU32 width, PxU32 height, PxU32 sizeInBytes, int rPosition, int gPosition, int bPosition, bool bFlipY, void* screenshotData) +{ + if (width <= 0 || height <= 0 || sizeInBytes <= 0) + return; + + PxU32 srcByteStride = sizeInBytes / (width * height); + RENDERER_ASSERT((srcByteStride > 0) && (srcByteStride <= sizeof(PxU32)), "Invalid image format."); + if (srcByteStride <= 0 || srcByteStride > sizeof(PxU32)) + return; + + PxU32* pSrc = static_cast<PxU32*>(screenshotData); + PxU8* pSrcByte = static_cast<PxU8*>(screenshotData); + if (bFlipY) + { + for (PxU32 i = 0; i < height/2; ++i) + { + PxU32* pSrc2 = static_cast<PxU32*>(screenshotData) + width * (height - i - 1); + PxU8* pSrc2Byte = static_cast<PxU8*>(screenshotData) + srcByteStride * width * (height - i - 1); + for (PxU32 j = 0; j < width; ++j, pSrcByte+=srcByteStride, pSrc2Byte+=srcByteStride, ++pSrc, ++pSrc2) + { + PxU32 temp = createPixel(pSrcByte[rPosition], pSrcByte[gPosition], pSrcByte[bPosition]); + *pSrc = createPixel(pSrc2Byte[rPosition], pSrc2Byte[gPosition], pSrc2Byte[bPosition]); + *pSrc2 = temp; + } + } + // Format the middle scanline + if (height % 2 == 1) + { + for (PxU32 j = 0; j < width; ++j, pSrcByte+=srcByteStride,++pSrc) + { + *pSrc = createPixel(pSrcByte[rPosition], pSrcByte[gPosition], pSrcByte[bPosition]); + } + } + } + else + { + for (PxU32 i = 0; i < height; ++i) + { + for (PxU32 j = 0; j < width; ++j, pSrcByte+=srcByteStride,++pSrc) + { + *pSrc = createPixel(pSrcByte[rPosition], pSrcByte[gPosition], pSrcByte[bPosition]); + } + } + } +} + +void Renderer::renderMeshes(std::vector<RendererMeshContext>& meshes, RendererMaterial::Pass pass) +{ + PX_PROFILE_ZONE("Renderer_renderMeshes",0); + + RendererMaterial *lastMaterial = 0; + RendererMaterialInstance *lastMaterialInstance = 0; + const RendererMesh *lastMesh = 0; + + const PxU32 numMeshes = (PxU32)meshes.size(); + for(PxU32 i=0; i<numMeshes; i++) + { + RendererMeshContext& context = meshes[i]; + + if(!context.mesh->willRender()) + { + continue; + } + + // the mesh context should be bound before the material, this is + // necessary because the materials read state from the graphics device + // for instance to determine if two-sided lighting should be enabled + // for gles 2 this doesn't work yet due to internal hacks +#if !defined(RENDERER_ENABLE_GLES2) + bindMeshContext(context); +#endif + + bool instanced = context.mesh->getInstanceBuffer()?true:false; + + if(context.materialInstance && context.materialInstance != lastMaterialInstance) + { + if(lastMaterial) lastMaterial->unbind(); + lastMaterialInstance = context.materialInstance; + lastMaterial = &context.materialInstance->getMaterial(); + lastMaterial->bind(pass, lastMaterialInstance, instanced); + } + else if(context.material != lastMaterial) + { + if(lastMaterial) lastMaterial->unbind(); + lastMaterialInstance = 0; + lastMaterial = context.material; + lastMaterial->bind(pass, lastMaterialInstance, instanced); + } + +#if defined(RENDERER_ENABLE_GLES2) + bindMeshContext(context); +#endif + + if(lastMaterial) lastMaterial->bindMeshState(instanced); + if(context.mesh != lastMesh) + { + if(lastMesh) lastMesh->unbind(); + lastMesh = context.mesh; + if(lastMesh) lastMesh->bind(); + } + if(lastMesh) context.mesh->render(context.material); + } + if(lastMesh) lastMesh->unbind(); + if(lastMaterial) lastMaterial->unbind(); +} + +struct CompareMeshCameraDist +{ + CompareMeshCameraDist(const physx::PxVec3& t_) : t(t_) { } + bool operator()(const RendererMeshContext& c1, const RendererMeshContext& c2) const + { + // Equivalent, return false + if (NULL == c1.transform && NULL == c2.transform) + return false; + // NULL transforms will be rendered first + if (NULL == c1.transform) + return true; + if (NULL == c2.transform) + return false; + // A larger magnitude means further away, which should be ordered first + // TODO: Use bones + return (c1.transform->getPosition() - t).magnitudeSquared() > (c2.transform->getPosition() - t).magnitudeSquared(); + } + physx::PxVec3 t; +}; + +void Renderer::sortMeshes(const physx::PxMat44& eye) +{ + CompareMeshCameraDist meshComp(eye.getPosition()); + std::sort(m_visibleLitTransparentMeshes.begin(), m_visibleLitTransparentMeshes.end(), meshComp); +} + +void Renderer::renderDeferredLights(void) +{ + PX_PROFILE_ZONE("Renderer_renderDeferredLights",0); + const PxU32 numLights = (PxU32)m_visibleLights.size(); + for(PxU32 i=0; i<numLights; i++) + { + renderDeferredLight(*m_visibleLights[i]); + } +} + +bool Renderer::CompareRenderMaterialDesc::operator()(const RendererMaterialDesc& desc1, const RendererMaterialDesc& desc2) const +{ + if (desc1.type != desc2.type) + return desc1.type < desc2.type; + + if (desc1.alphaTestFunc != desc2.alphaTestFunc) + return desc1.alphaTestFunc < desc2.alphaTestFunc; + + if (desc1.alphaTestRef != desc2.alphaTestRef) + return desc1.alphaTestRef < desc2.alphaTestRef; + + if (desc1.blending != desc2.blending) + return desc1.blending < desc2.blending; + + if (desc1.srcBlendFunc != desc2.srcBlendFunc) + return desc1.srcBlendFunc < desc2.srcBlendFunc; + + if (desc1.dstBlendFunc != desc2.dstBlendFunc) + return desc1.dstBlendFunc < desc2.dstBlendFunc; + + int result = Ps::stricmp(desc1.vertexShaderPath, desc2.vertexShaderPath); + if (result != 0) + return result < 0; + + result = Ps::stricmp(desc1.fragmentShaderPath, desc2.fragmentShaderPath); + if (result != 0) + return result < 0; + + // Geometry, hull and domain shaders are optional, so only check when present + // * stricmp only works properly for well defined pointers, so only test when both present + // * if one material has a particular shader when the other material does not, the one WITH should be first + if (desc1.geometryShaderPath || desc2.geometryShaderPath) + { + if (desc1.geometryShaderPath && desc2.geometryShaderPath) + result = Ps::stricmp(desc1.geometryShaderPath, desc2.geometryShaderPath); + else + result = desc1.geometryShaderPath ? -1 : 1; + } + + if (0 == result && (desc1.hullShaderPath || desc2.hullShaderPath)) + { + if (desc1.hullShaderPath && desc2.hullShaderPath) + result = Ps::stricmp(desc1.hullShaderPath, desc2.hullShaderPath); + else + result = desc1.hullShaderPath ? -1 : 1; + } + + if (0 == result && (desc1.domainShaderPath || desc2.domainShaderPath)) + { + if (desc1.domainShaderPath && desc2.domainShaderPath) + result = Ps::stricmp(desc1.domainShaderPath, desc2.domainShaderPath); + else + result = desc1.domainShaderPath ? -1 : 1; + } + + return result < 0; +} + +RendererMaterial* Renderer::hasMaterialAlready(const RendererMaterialDesc& desc) +{ + if (mEnableMaterialCaching) + { + tMaterialCache::iterator it = m_materialCache.find(desc); + + if (it != m_materialCache.end()) + { + PX_ASSERT(it->second != NULL); + it->second->incRefCount(); + return it->second; + } + } + + return NULL; +} + + + +static const char* local_strdup(const char* input) +{ + if (input == NULL) + { + return NULL; + } + + unsigned int strLen = (unsigned int)strlen(input) + 1; + char* retStr = (char*)::malloc(strLen); + + PX_ASSERT(retStr); + + if (NULL != retStr) + { +#if PX_WINDOWS + strcpy_s(retStr, strLen, input); +#else + strncpy(retStr, input, strLen); +#endif + } + return retStr; +} + + + +void Renderer::registerMaterial(const RendererMaterialDesc& desc, RendererMaterial* mat) +{ + if (mEnableMaterialCaching) + { + tMaterialCache::iterator it = m_materialCache.find(desc); + + if (it == m_materialCache.end()) + { + RendererMaterialDesc descCopy = desc; + descCopy.vertexShaderPath = local_strdup(desc.vertexShaderPath); + descCopy.fragmentShaderPath = local_strdup(desc.fragmentShaderPath); + descCopy.geometryShaderPath = local_strdup(desc.geometryShaderPath); + descCopy.domainShaderPath = local_strdup(desc.domainShaderPath); + descCopy.hullShaderPath = local_strdup(desc.hullShaderPath); + + PX_ASSERT(mat->m_refCount == 1); + m_materialCache[descCopy] = mat; + } + else + { + PX_ASSERT(it->second == NULL); + it->second = mat; + } + } +} + + + +void Renderer::releaseAllMaterials() +{ + for (tMaterialCache::iterator it = m_materialCache.begin(); it != m_materialCache.end(); ++it) + { + PX_ASSERT(it->second != NULL); + delete it->second; + + it->second = NULL; + } +} + + + +/////////////////////////////////////////////////////////////////////////////// + + +#include "RendererMemoryMacros.h" +#include "RendererMaterialDesc.h" +#include "RendererTexture2DDesc.h" + +// PT: text stuff from ICE. Adapted quickly, should be cleaned up when we have some time. + +struct FntInfo +{ + PxReal u0; + PxReal v0; + PxReal u1; + PxReal v1; + PxU32 dx; + PxU32 dy; +}; + +class FntData +{ +public: + FntData(); + ~FntData(); + + void Reset(); + PxU32 ComputeSize(const char* text, PxReal& width, PxReal& height, PxReal scale, bool forceFixWidthNumbers) const; + + bool Load(Renderer& renderer, const char* filename); + + PX_FORCE_INLINE PxU32 GetNbFnts() const { return mNbFnts; } + PX_FORCE_INLINE const FntInfo* GetFnts() const { return mFnts; } + PX_FORCE_INLINE PxU32 GetMaxDx() const { return mMaxDx; } + PX_FORCE_INLINE PxU32 GetMaxDy() const { return mMaxDy; } + PX_FORCE_INLINE const PxU8* GetXRef() const { return mXRef; } + PX_FORCE_INLINE PxU32 GetMaxDxNumbers() const { return mMaxDxNumbers; } + PX_FORCE_INLINE bool IsFixWidthCharacter(unsigned char c) const { return mFixWidthCharacters[c]; } + +private: + PxU32 mNbFnts; + FntInfo* mFnts; + PxU32 mMaxDx, mMaxDy; + PxU8 mXRef[256]; + bool mFixWidthCharacters[256]; + PxU32 mMaxDxNumbers; +public: + RendererTexture2D* mTexture; +}; + +FntData::FntData() +{ + mNbFnts = 0; + mFnts = NULL; + mMaxDx = 0; + mMaxDy = 0; + memset(mXRef, 0, 256*sizeof(PxU8)); + memset(mFixWidthCharacters, 0, 256 * sizeof(bool)); + for (int i = '0'; i <= '9'; i++) + { + mFixWidthCharacters[i] = true; + } + //mFixWidthCharacters[size_t(' ')] = true; + mFixWidthCharacters[size_t('.')] = true; + mFixWidthCharacters[size_t('+')] = true; + mFixWidthCharacters[size_t('-')] = true; + mFixWidthCharacters[size_t('*')] = true; + mFixWidthCharacters[size_t('/')] = true; + mMaxDxNumbers = 0; + mTexture = NULL; +} + +FntData::~FntData() +{ + Reset(); +} + +void FntData::Reset() +{ + SAFE_RELEASE(mTexture); + DELETEARRAY(mFnts); + mNbFnts = 0; + mMaxDx = 0; + mMaxDy = 0; + memset(mXRef, 0, 256*sizeof(PxU8)); + memset(mFixWidthCharacters, 0, 256 * sizeof(bool)); + mMaxDxNumbers = 0; +} + +// Compute size of a given text +PxU32 FntData::ComputeSize(const char* text, PxReal& width, PxReal& height, PxReal scale, bool forceFixWidthNumbers) const +{ + // Get and check length + if(!text) return 0; + PxU32 Nb = (PxU32)strlen((const char*)text); + if(!Nb) return 0; + + PxReal x = 0.0f; + PxReal y = 0.0f; + + width = -1.0f; + height = -1.0f; + + // Loop through characters + for(PxU32 j=0;j<Nb;j++) + { + if(text[j]!='\n') + { + // Catch current character index + const PxU32 i = mXRef[(unsigned char)(text[j])]; + + // Catch size of current character + const PxReal sx = PxReal((forceFixWidthNumbers && mFixWidthCharacters[(size_t)text[j]]) ? mMaxDxNumbers : mFnts[i].dx) * scale; + const PxReal sy = PxReal(mFnts[i].dy) * scale; + + // Keep track of greatest dimensions + if((x+sx)>width) width = x+sx; + if((y+sy)>height) height = y+sy; + + // Adjust x for next character + x += sx + 1.0f; + } + else + { + // Jump to next line + x = 0.0f; + y += PxReal(mMaxDy) * scale; + } + } + return Nb; +} + +#include "PxTkFile.h" + +#if PX_INTEL_FAMILY +static const bool gFlip = false; +#elif PX_PPC +static const bool gFlip = true; +#elif PX_ARM_FAMILY +static const bool gFlip = false; +#else +#error Unknown platform! +#endif + +PX_INLINE void Flip(PxU32& v) +{ + PxU8* b = (PxU8*)&v; + + PxU8 temp = b[0]; + b[0] = b[3]; + b[3] = temp; + temp = b[1]; + b[1] = b[2]; + b[2] = temp; +} + +PX_INLINE void Flip(PxI32& v) +{ + Flip((PxU32&)v); +} + +PX_INLINE void Flip(PxF32& v) +{ + Flip((PxU32&)v); +} + +static PxU32 read32(File* fp) +{ + PxU32 data; + size_t numRead = fread(&data, 1, 4, fp); + if(numRead != 4) { fclose(fp); return 0; } + if(gFlip) + Flip(data); + return data; +} + +bool FntData::Load(Renderer& renderer, const char* filename) +{ + File* fp = NULL; + PxToolkit::fopen_s(&fp, filename, "rb"); + if(!fp) + return false; + + // Init texture + { + const PxU32 width = read32(fp); + const PxU32 height = read32(fp); + PxU8* data = new PxU8[width*height*4]; + const size_t size = width*height*4; + size_t numRead = fread(data, 1, size, fp); + if(numRead != size) { fclose(fp); return false; } + + /* if(gFlip) + { + PxU32* data32 = (PxU32*)data; + for(PxU32 i=0;i<width*height;i++) + { + Flip(data32[i]); + } + }*/ + + RendererTexture2DDesc tdesc; + tdesc.format = RendererTexture2D::FORMAT_B8G8R8A8; + tdesc.width = width; + tdesc.height = height; + tdesc.filter = RendererTexture2D::FILTER_ANISOTROPIC; + tdesc.numLevels = 1; + /* + tdesc.filter; + tdesc.addressingU; + tdesc.addressingV; + tdesc.renderTarget; + */ + PX_ASSERT(tdesc.isValid()); + mTexture = renderer.createTexture2D(tdesc); + PX_ASSERT(mTexture); + if(!mTexture) + { + DELETEARRAY(data); + fclose(fp); + return false; + } + + const PxU32 componentCount = 4; + + if(mTexture) + { + PxU32 pitch = 0; + void* buffer = mTexture->lockLevel(0, pitch); + PX_ASSERT(buffer); + if(buffer) + { + PxU8* levelDst = (PxU8*)buffer; + const PxU8* levelSrc = (PxU8*)data; + const PxU32 levelWidth = mTexture->getWidthInBlocks(); + const PxU32 levelHeight = mTexture->getHeightInBlocks(); + PX_ASSERT(levelWidth * mTexture->getBlockSize() <= pitch); // the pitch can't be less than the source row size. + for(PxU32 row=0; row<levelHeight; row++) + { + // copy per pixel to handle RBG case, based on component count + for(PxU32 col=0; col<levelWidth; col++) + { + *levelDst++ = levelSrc[0]; + *levelDst++ = levelSrc[1]; + *levelDst++ = levelSrc[2]; + *levelDst++ = levelSrc[3]; + levelSrc += componentCount; + } + } + } + mTexture->unlockLevel(0); + } + DELETEARRAY(data); + } + + mNbFnts = read32(fp); + + mFnts = new FntInfo[mNbFnts]; + const size_t size = mNbFnts*sizeof(FntInfo); + size_t numRead = fread(mFnts, 1, size, fp); + if(numRead != size) { fclose(fp); return false; } + if(gFlip) + { + for(PxU32 i=0;i<mNbFnts;i++) + { + Flip(mFnts[i].u0); + Flip(mFnts[i].v0); + Flip(mFnts[i].u1); + Flip(mFnts[i].v1); + Flip(mFnts[i].dx); + Flip(mFnts[i].dy); + } + } + + mMaxDx = read32(fp); + mMaxDy = read32(fp); + + const size_t xRefSize = 256*sizeof(PxU8); + numRead = fread(mXRef, 1, xRefSize, fp); + if(numRead != xRefSize) { fclose(fp); return false; } + + for (unsigned int c = 0; c < 256; c++) + { + if (mFixWidthCharacters[c]) + { + mMaxDxNumbers = PxMax(mFnts[mXRef[c]].dx, mMaxDxNumbers); + } + } + + fclose(fp); + return true; +} + + +struct ClipBox +{ + PxReal mXMin; + PxReal mYMin; + PxReal mXMax; + PxReal mYMax; +}; + +static bool ClipQuad(Renderer::TextVertex* /*quad*/, const ClipBox& /*clip_box*/) +{ + return true; +} + +static bool GenerateTextQuads( const char* text, PxU32 nb_characters, + Renderer::TextVertex* fnt_verts, PxU16* fnt_indices, const ClipBox& clip_box, const FntData* fnt_data, PxReal& x, PxReal& y, PxReal scale_x, PxReal scale_y, PxU32 color, + PxReal* x_min, PxReal* y_min, PxReal* x_max, PxReal* y_max, PxU32* nb_lines, PxU32* nb_active_characters, bool forceFixWidthNumbers) +{ + // Checkings + if(!text || !fnt_verts || !fnt_indices || !fnt_data) return false; + + PxReal mX = x; + + ////////// + + Renderer::TextVertex* V = fnt_verts; + PxU16* I = fnt_indices; + PxU16 Offset = 0; + PxU32 NbActiveCharacters = 0; // Number of non-NULL characters (the ones to render) + + PxReal XMin = 100000.0f, XMax = -100000.0f; + PxReal YMin = 100000.0f, YMax = -100000.0f; + + PxU32 NbLines = 1; // Number of lines + + // Loop through characters + for(PxU32 j=0;j<nb_characters;j++) + { + if(text[j]!='\n') + { + PxU32 i = fnt_data->GetXRef()[(size_t)text[j]]; + const FntInfo character = fnt_data->GetFnts()[i]; + + // Character size + const PxReal sx = PxReal(character.dx) * scale_x; + const PxReal sy = PxReal(character.dy) * scale_y; + + if (forceFixWidthNumbers && fnt_data->IsFixWidthCharacter(text[j])) + { + // move forward half the distance + x += (fnt_data->GetMaxDxNumbers() - character.dx) * scale_x * 0.5f; + } + + if(text[j]!=' ') + { + const PxReal rhw = 1.0f; + + + // Initialize the vertices + V[0].p.x = x; V[0].p.y = y+sy; V[0].u = character.u0; V[0].v = character.v1; + V[1].p.x = x; V[1].p.y = y; V[1].u = character.u0; V[1].v = character.v0; + V[2].p.x = x+sx; V[2].p.y = y+sy; V[2].u = character.u1; V[2].v = character.v1; + V[3].p.x = x+sx; V[3].p.y = y; V[3].u = character.u1; V[3].v = character.v0; + V[0].rhw = V[1].rhw = V[2].rhw = V[3].rhw = rhw; + V[0].p.z = V[1].p.z = V[2].p.z = V[3].p.z = 0.0f; + V[0].color = V[1].color = V[2].color = V[3].color = color; + + if(ClipQuad(V, clip_box)) + { + V+=4; + + // Initialize the indices + *I++ = Offset+0; + *I++ = Offset+1; + *I++ = Offset+2; + *I++ = Offset+2; + *I++ = Offset+1; + *I++ = Offset+3; + Offset+=4; + + NbActiveCharacters++; + } + } + + if (forceFixWidthNumbers && fnt_data->IsFixWidthCharacter(text[j])) + { + // move forward theo ther half of the distance + x += (fnt_data->GetMaxDxNumbers() - character.dx) * scale_x * 0.5f; + } + + // + if((x+sx)>XMax) XMax = x+sx; if(x<XMin) XMin = x; + if((y+sy)>YMax) YMax = y+sy; if(y<YMin) YMin = y; + + x += sx + 1.0f; + } + else + { + // Jump to next line + x = mX; + y += PxReal(fnt_data->GetMaxDy()) * scale_y; + NbLines++; + } + } + + if(x_min) *x_min = XMin; + if(y_min) *y_min = YMin; + if(x_max) *x_max = XMax; + if(y_max) *y_max = YMax; + if(nb_lines) *nb_lines = NbLines; + if(nb_active_characters) *nb_active_characters = NbActiveCharacters; + + return true; +} + +enum RenderTextQuadFlag_ +{ + RTQF_ALIGN_LEFT = 0, + RTQF_ALIGN_CENTER = (1<<0), + RTQF_ALIGN_RIGHT = (1<<1), +}; + +struct RenderTextData +{ + RenderTextData(Renderer::TextVertex* pFntVerts, PxU16* pFntIndices) + : mpFntVerts(pFntVerts), mpFntIndices(pFntIndices) { } + + ~RenderTextData() + { + DELETEARRAY(mpFntVerts); + DELETEARRAY(mpFntIndices); + } + + Renderer::TextVertex* mpFntVerts; + PxU16* mpFntIndices; + +private: + // Disable default, copy and assign + RenderTextData(); + RenderTextData(const RenderTextData&); + void operator=(const RenderTextData&); +}; + +static void RenderTextQuads(Renderer* textRender, + const FntData* fnts, + const char* text, PxReal x, PxReal y, PxU32 text_color, PxU32 shadow_color, + PxReal scale_x, PxReal scale_y, + PxU32 align_flags, PxReal max_length, + PxReal shadow_offset, + PxReal* nx, PxReal* ny, + const ClipBox* clip_box, + PxReal text_y_offset, + bool use_max_dy, + bool forceFixWidthNumbers, + RendererMaterial* material + ) +{ + // We want to render the whole text in one run... + const PxReal text_x = x; + const PxReal text_y = y; + + // Compute text size + PxReal Width, Height; + const PxU32 NbCharacters = fnts->ComputeSize(text, Width, Height, 1.0f, forceFixWidthNumbers); + + // Prepare clip box + ClipBox CB; + if(clip_box) + { + CB = *clip_box; + } + else + { + PxU32 width, height; + textRender->getWindowSize(width, height); + + const PxReal Margin = 0.0f; + CB.mXMin = Margin; + CB.mYMin = Margin; + CB.mXMax = PxReal(width) - Margin; + CB.mYMax = PxReal(height) - Margin; + } + + // Allocate space for vertices + RenderTextData FntData(new Renderer::TextVertex[NbCharacters*4], new PxU16[NbCharacters*6]); + + // Generate quads + PxReal XMin, YMin, XMax, YMax; + PxU32 NbLines, NbActiveCharacters; + GenerateTextQuads(text, NbCharacters, FntData.mpFntVerts, FntData.mpFntIndices, CB, fnts, x, y, scale_x, scale_y, text_color, &XMin, &YMin, &XMax, &YMax, &NbLines, &NbActiveCharacters, forceFixWidthNumbers); + + for(PxU32 i=0;i<NbActiveCharacters*4;i++) + FntData.mpFntVerts[i].p.y += text_y_offset; + + if(use_max_dy) + YMax = YMin + (PxReal)fnts->GetMaxDy(); + + const bool centered = (align_flags & RTQF_ALIGN_CENTER)!=0; + const bool align_right = (align_flags & RTQF_ALIGN_RIGHT)!=0; + + if(centered || align_right) + { + const PxReal L = XMax - XMin; + XMax = XMin + max_length; + const PxReal Offset = centered ? (-FntData.mpFntVerts[0].p.x + XMin + (max_length - L)*0.5f) : + (-FntData.mpFntVerts[0].p.x + XMax - L); + // (-FntVerts[0].p.x + XMin + (max_length - L)); + for(PxU32 i=0;i<NbActiveCharacters*4;i++) + FntData.mpFntVerts[i].p.x += Offset; + } + + textRender->setupTextRenderStates(); + + // Handle shadow + if(shadow_offset!=0.0f) + { + // Allocate space for vertices + RenderTextData SFntData(new Renderer::TextVertex[NbCharacters*4], new PxU16[NbCharacters*6]); + + // Generate quads + PxReal SXMin, SYMin, SXMax, SYMax; + PxU32 SNbLines, SNbActiveCharacters; + PxReal ShX = text_x + shadow_offset; + PxReal ShY = text_y + shadow_offset; + GenerateTextQuads(text, NbCharacters, SFntData.mpFntVerts, SFntData.mpFntIndices, CB, fnts, ShX, ShY, scale_x, scale_y, shadow_color, &SXMin, &SYMin, &SXMax, &SYMax, &SNbLines, &SNbActiveCharacters, forceFixWidthNumbers); + + for(PxU32 i=0;i<SNbActiveCharacters*4;i++) + SFntData.mpFntVerts[i].p.y += text_y_offset; + + if(centered || align_right) + { + const PxReal L = SXMax - SXMin; + SXMax = SXMin + max_length; + const PxReal Offset = centered ? (-SFntData.mpFntVerts[0].p.x + SXMin + (max_length - L)*0.5f) : + (-SFntData.mpFntVerts[0].p.x + SXMax - L); + for(PxU32 i=0;i<SNbActiveCharacters*4;i++) + SFntData.mpFntVerts[i].p.x += Offset; + } + + textRender->renderTextBuffer(SFntData.mpFntVerts, 4*SNbActiveCharacters, SFntData.mpFntIndices, 6*SNbActiveCharacters, material); + } + + textRender->renderTextBuffer(FntData.mpFntVerts, 4*NbActiveCharacters, FntData.mpFntIndices, 6*NbActiveCharacters, material); + + textRender->resetTextRenderStates(); +} + + +static FntData* gFntData = NULL; + + +bool Renderer::initTexter() +{ + if(gFntData) + return true; + + char filename[1024]; + Ps::strlcpy(filename, sizeof(filename), getAssetDir()); + Ps::strlcat(filename, sizeof(filename), "fonts/arial_black.bin"); + + gFntData = new FntData; + if(!gFntData->Load(*this, filename)) + { + closeTexter(); + return false; + } + + { + RendererMaterialDesc matDesc; + matDesc.alphaTestFunc = RendererMaterial::ALPHA_TEST_ALWAYS; + matDesc.alphaTestRef = 0.0f; + matDesc.type = RendererMaterial::TYPE_UNLIT; + matDesc.blending = true; + matDesc.srcBlendFunc = RendererMaterial::BLEND_SRC_ALPHA; + matDesc.dstBlendFunc = RendererMaterial::BLEND_ONE_MINUS_SRC_ALPHA; + matDesc.geometryShaderPath = NULL; + matDesc.vertexShaderPath = "vertex/text.cg"; + matDesc.fragmentShaderPath = "fragment/text.cg"; + PX_ASSERT(matDesc.isValid()); + + m_textMaterial = createMaterial(matDesc); + if(!m_textMaterial) + { + closeTexter(); + return false; + } + + m_textMaterialInstance = new RendererMaterialInstance(*m_textMaterial); + if(!m_textMaterialInstance) + { + closeTexter(); + return false; + } + + const RendererMaterial::Variable* var = m_textMaterial->findVariable("diffuseTexture", RendererMaterial::VARIABLE_SAMPLER2D); + if(!var) + { + closeTexter(); + return false; + } + m_textMaterialInstance->writeData(*var, &(gFntData->mTexture)); + } + + return true; +} + +void Renderer::closeTexter() +{ + DELETESINGLE(m_textMaterialInstance); + SAFE_RELEASE(m_textMaterial); + DELETESINGLE(gFntData); +} + +// splits string by delimeter +#if defined(RENDERER_TABLET) +static std::vector<std::string> &split(const std::string &s, char delim, std::vector<std::string> &elems) { + std::stringstream ss(s); + std::string item; + while(std::getline(ss, item, delim)) { + elems.push_back(item); + } + return elems; +} + +static std::vector<std::string> split(const std::string &s, char delim) { + std::vector<std::string> elems; + return split(s, delim, elems); +} +#endif + +void SampleRenderer::Renderer::print(PxU32* x, PxU32* y, const char** text, PxU32 textCount, PxReal scale, PxReal shadowOffset, RendererColor* textColors, bool forceFixWidthNumbers) +{ + // we split string containing '\n' in a vector of strings. This prevents from need to have a really big vertex/index buffer for text in GLES2 renderer +#if defined(RENDERER_TABLET) + if(std::string(*text).find('\n') != std::string::npos) { + std::vector<std::string> strings = split(*text, '\n'); + PxU32 nx = *x, ny = *y; + for(PxU32 i = 0; i < strings.size(); ++i) + { + const char* sptr = strings[i].c_str(); + print(&nx, &ny, &sptr, 1, scale, shadowOffset, textColors, forceFixWidthNumbers); + ny += TEXT_HEIGHT + TEXT_VERTICAL_SPACING; + } + return; + } +#endif + + if(!gFntData || !gFntData->mTexture || !m_textMaterial || !m_textMaterialInstance || 0==textCount || NULL==x || NULL==y || NULL==text || 0 == *text || (*text)[0] == '\0') + return; + + ScopedRender renderSection(*this); + if (renderSection) + { + m_textMaterial->bind(RendererMaterial::PASS_UNLIT, m_textMaterialInstance, false); + + if(!m_useShadersForTextRendering) + { + m_textMaterial->unbind(); + gFntData->mTexture->select(0); + } + + const PxU32 alignFlags = 0; + const float maxLength = 0.0f; + float* nx = NULL; + float* ny = NULL; + const ClipBox* clipBox = NULL; + const float textYOffset = 0.0f; + const bool useMaxDy = false; + const RendererColor defaultColor(255, 255, 255, 255); + +#if defined(RENDERER_TABLET) + shadowOffset = 0.0f; +#endif + + for (PxU32 i = 0; i < textCount; ++i) + { + const PxU32 color = convertColor(textColors ? textColors[i] : defaultColor); + const PxU32 shadowColor = convertColor(textColors ? RendererColor(0,0,0,textColors[i].a) : RendererColor(0,0,0,defaultColor.a)); + + RenderTextQuads(this, + gFntData, + text[i], + PxReal(x[i]), PxReal(y[i]), + color, shadowColor, + scale, scale, + alignFlags, + maxLength, + shadowOffset * scale, + nx, ny, + clipBox, + textYOffset, + useMaxDy, + forceFixWidthNumbers, + m_textMaterial + ); + } + + if(m_useShadersForTextRendering) + m_textMaterial->unbind(); + } +} + +bool SampleRenderer::Renderer::captureScreen(const char* filename) +{ + if(!filename) + return false; + + physx::PxU32 width, height, sizeInBytes; + const void* data = NULL; + if (captureScreen(width, height, sizeInBytes, data) && sizeInBytes > 0) + { + PxDefaultFileOutputStream fileBuffer(filename); + return fileBuffer.write(data, sizeInBytes) > 0; + } + else + { + return false; + } +} + + +void Renderer::print(PxU32 x, PxU32 y, const char* text, PxReal scale, PxReal shadowOffset, RendererColor textColor, bool forceFixWidthNumbers) +{ + if (NULL == text || strlen(text) <= 0) + return; + print(&x, &y, &text, 1, scale, shadowOffset, &textColor, forceFixWidthNumbers); +} + +/////////////////////////////////////////////////////////////////////////////// + +bool Renderer::initScreenquad() +{ + RendererMaterialDesc matDesc; + matDesc.alphaTestFunc = RendererMaterial::ALPHA_TEST_ALWAYS; + matDesc.alphaTestRef = 0.0f; + matDesc.type = RendererMaterial::TYPE_UNLIT; + matDesc.blending = false; + matDesc.vertexShaderPath = "vertex/screenquad.cg"; + matDesc.fragmentShaderPath = "fragment/screenquad.cg"; + matDesc.geometryShaderPath = NULL; +#if defined(RENDERER_TABLET) + matDesc.srcBlendFunc = RendererMaterial::BLEND_SRC_ALPHA; + matDesc.dstBlendFunc = RendererMaterial::BLEND_ONE_MINUS_SRC_ALPHA; +#else + matDesc.srcBlendFunc = RendererMaterial::BLEND_ONE; + matDesc.dstBlendFunc = RendererMaterial::BLEND_ONE; +#endif + PX_ASSERT(matDesc.isValid()); + + m_screenquadOpaqueMaterial = createMaterial(matDesc); + if(!m_screenquadOpaqueMaterial) + { + closeScreenquad(); + return false; + } + + m_screenquadOpaqueMaterialInstance = new RendererMaterialInstance(*m_screenquadOpaqueMaterial); + if(!m_screenquadOpaqueMaterialInstance) + { + closeScreenquad(); + return false; + } + + matDesc.blending = true; + matDesc.srcBlendFunc = RendererMaterial::BLEND_SRC_ALPHA; + matDesc.dstBlendFunc = RendererMaterial::BLEND_ONE_MINUS_SRC_ALPHA; + + m_screenquadAlphaMaterial = createMaterial(matDesc); + if(!m_screenquadAlphaMaterial) + { + closeScreenquad(); + return false; + } + + m_screenquadAlphaMaterialInstance = new RendererMaterialInstance(*m_screenquadAlphaMaterial); + if(!m_screenquadAlphaMaterialInstance ) + { + closeScreenquad(); + return false; + } + + return true; +} + +#if defined(RENDERER_TABLET) +void Renderer::setControlPosition(int ctrl_idx, const PxVec2& pos) +{ + if(ctrl_idx < CONTROL_COUNT) + { + m_controlPos[ctrl_idx] = pos; + } +} + +#include "foundation/PxBounds3.h" + +PxBounds3 Renderer::getCenteredControlBounds(int ctrl_idx) +{ + /* Return PxBounds3 with positive volume */ + return PxBounds3( + PxVec3(m_controlCenteredPos[ctrl_idx].x - m_controlHalfSize.x, m_controlCenteredPos[ctrl_idx].y - m_controlHalfSize.y, -1.0f), + PxVec3(m_controlCenteredPos[ctrl_idx].x + m_controlHalfSize.x, m_controlCenteredPos[ctrl_idx].y + m_controlHalfSize.y, 1.0f)); +} + +PxBounds3 Renderer::getControlBounds(int ctrl_idx) +{ + /* Return PxBounds3 with positive volume */ + return PxBounds3( + PxVec3(m_controlPos[ctrl_idx].x - m_controlHalfSize.x, m_controlPos[ctrl_idx].y - m_controlHalfSize.y, -1.0f), + PxVec3(m_controlPos[ctrl_idx].x + m_controlHalfSize.x, m_controlPos[ctrl_idx].y + m_controlHalfSize.y, 1.0f)); +} + +PxVec2 Renderer::getControlPosition(int ctrl_idx) +{ + return m_controlPos[ctrl_idx]; +} + +PxVec2 Renderer::getCenteredControlPosition(int ctrl_idx) +{ + return m_controlCenteredPos[ctrl_idx]; +} + +bool Renderer::initControls(RendererMaterial* controlMaterial, RendererMaterialInstance* controlMaterialInstance) +{ + // create quad control + using physx::PxReal; + using physx::PxU32; + using physx::PxU8; + + m_controlMaterial = controlMaterial; + m_controlMaterialInstance = controlMaterialInstance; + + // compute control dimensions and placement according to window aspect + // screen coordinate range: [-1,1] + PxVec2 controlSize; + PxVec2 controlCenterOffset; + { + PxU32 width, height; + getWindowSize(width, height); + + PX_ASSERT(width > 0 && height > 0); + PX_ASSERT(gControlSizeRelative > 0.0f && gControlSizeRelative < 0.5f); + PX_ASSERT(gControlMarginRelative > 0.0f && gControlMarginRelative < 0.5f); + + //size and margin should be relative to smaller screen dimension + if (width > height) + { + PxReal aspect = (PxReal)height/(PxReal)width; + controlSize.y = 2.0f*gControlSizeRelative; + controlSize.x = controlSize.y * aspect; + controlCenterOffset.y = 1.0f - controlSize.y*0.5f - 2.0f*gControlMarginRelative; + controlCenterOffset.x = 1.0f - controlSize.x*0.5f - 2.0f*gControlMarginRelative*aspect; + } + else + { + PxReal aspect = (PxReal)width/(PxReal)height; + controlSize.x = 2.0f*gControlSizeRelative; + controlSize.y = controlSize.x * aspect; + controlCenterOffset.x = 1.0f - controlSize.x*0.5f - 2.0f*gControlMarginRelative; + controlCenterOffset.y = 1.0f - controlSize.y*0.5f - 2.0f*gControlMarginRelative*aspect; + } + } + + m_controlHalfSize = controlSize*0.5f; + + /* Initialize sticks positions - default and current */ + m_controlCenteredPos[0].x = -controlCenterOffset.x; + m_controlCenteredPos[0].y = -controlCenterOffset.y; + m_controlCenteredPos[1].x = controlCenterOffset.x; + m_controlCenteredPos[1].y = -controlCenterOffset.y; + m_controlPos[0] = m_controlCenteredPos[0]; + m_controlPos[1] = m_controlCenteredPos[1]; + + PxReal controlVertices[] = { + -m_controlHalfSize.x, -m_controlHalfSize.y, 0.0f, + -m_controlHalfSize.x, m_controlHalfSize.y, 0.0f, + m_controlHalfSize.x, -m_controlHalfSize.y, 0.0f, + m_controlHalfSize.x, m_controlHalfSize.y, 0.0f }; + + PxReal controlTexcoords[] = { + 0.0f, 0.0f, // each face + 0.0f, 1.0f, + 1.0f, 0.0f, + 1.0f, 1.0f }; + + const PxU32 controlVerticesCount = sizeof(controlVertices) / (sizeof(controlVertices[0]) * 3); + + m_controlMesh[0] = initControl(controlVertices, controlTexcoords, controlVerticesCount); + + for(int i = 0; i < controlVerticesCount; ++i) + controlVertices[3 * i] = -controlVertices[3 * i]; + + m_controlMesh[1] = initControl(controlVertices, controlTexcoords, controlVerticesCount); + + return true; +} + +void Renderer::setControlDefaultPosition(int ctrl_idx) +{ + m_controlPos[ctrl_idx] = m_controlCenteredPos[ctrl_idx]; +} + +RendererMesh* Renderer::initControl(PxReal* controlVertices, PxReal* controlTexcoords, PxU32 count) +{ + const PxU32 controlVerticesCount = count; + + RendererVertexBufferDesc vbdesc; + vbdesc.hint = RendererVertexBuffer::HINT_STATIC; + vbdesc.maxVertices = controlVerticesCount; + vbdesc.semanticFormats[RendererVertexBuffer::SEMANTIC_POSITION] = RendererVertexBuffer::FORMAT_FLOAT3; + vbdesc.semanticFormats[RendererVertexBuffer::SEMANTIC_TEXCOORD0] = RendererVertexBuffer::FORMAT_FLOAT2; + RendererVertexBuffer* mVertexBuffer = createVertexBuffer(vbdesc); + RendererMesh* controlMesh = NULL; + if(mVertexBuffer) + { + RendererMeshDesc meshdesc; + meshdesc.primitives = RendererMesh::PRIMITIVE_TRIANGLE_STRIP; + meshdesc.vertexBuffers = &mVertexBuffer; + meshdesc.numVertexBuffers = 1; + meshdesc.firstVertex = 0; + meshdesc.numVertices = mVertexBuffer->getMaxVertices(); + meshdesc.indexBuffer = NULL; + meshdesc.firstIndex = 0; + meshdesc.numIndices = 0; + meshdesc.instanceBuffer = NULL; + meshdesc.firstInstance = 0; + meshdesc.numInstances = 0; + controlMesh = createMesh(meshdesc); + RENDERER_ASSERT(controlMesh, "Failed to create Mesh."); + } + PxU32 positionStride = 0, texcoordStride = 0; + PxU8* locked_positions = static_cast<PxU8*>(mVertexBuffer->lockSemantic(RendererVertexBuffer::SEMANTIC_POSITION, positionStride)); + PxU8* locked_texcoords = static_cast<PxU8*>(mVertexBuffer->lockSemantic(RendererVertexBuffer::SEMANTIC_TEXCOORD0, texcoordStride)); + for(PxU32 i = 0; i < controlVerticesCount; ++i, + locked_positions += positionStride, + locked_texcoords += texcoordStride) + { + memcpy(locked_positions, controlVertices + 3 * i, sizeof(PxReal) * 3); + memcpy(locked_texcoords, controlTexcoords + 2 * i , sizeof(PxReal) * 2); + } + mVertexBuffer->unlockSemantic(RendererVertexBuffer::SEMANTIC_TEXCOORD0); + mVertexBuffer->unlockSemantic(RendererVertexBuffer::SEMANTIC_POSITION); + return controlMesh; +} + +Renderer::TabletButton::TabletButton() : + pressedCount(0), + emulatedKeyCode(0), + defaultColor(PxVec4(1.0f, 1.0f, 1.0f, 0.4f)), + pressedColor(PxVec4(1.0f, 0.0f, 0.0f, 0.4f)), + callback(NULL) +{ +} + + +void Renderer::TabletButton::setPressedCount(physx::PxU8 p) +{ + pressedCount = p; +} + +void Renderer::TabletButton::incPressed() +{ + pressedCount++; +} + +void Renderer::TabletButton::decPressed() +{ + //sschirm: this caused issues on switching samples, because the OS keeps the touch states. + //PX_ASSERT(pressedCount); + if(pressedCount > 0) + pressedCount--; +} + +void Renderer::addButton(const PxVec2& leftBottom, const PxVec2& rightTop, void (*func_ptr)(), RendererMaterial* controlMaterial, + RendererMaterialInstance* controlMaterialInstance) +{ + /* Create button object and save into the vector */ + TabletButton button; + button.leftBottom = leftBottom; + button.rightTop = rightTop; + button.emulatedKeyCode = 0; + button.text = "Empty"; + button.callback = func_ptr; + /* Create graphic representation of the button. That is, quad. */ + PxReal buttonVertices[] = { leftBottom.x, leftBottom.y, 0.0f, + leftBottom.x, rightTop.y, 0.0f, + rightTop.x, leftBottom.y, 0.0f, + rightTop.x, rightTop.y, 0.0f }; + + /* Use full texture */ + PxReal buttonTexcoords[] = { 0.0f, 0.0f, + 0.0f, 1.0f, + 1.0f, 0.0f, + 1.0f, 1.0f}; + const PxU32 buttonVerticesCount = sizeof(buttonVertices) / (sizeof(buttonVertices[0]) * 3); + button.mesh = initControl(buttonVertices, buttonTexcoords, buttonVerticesCount); + button.material = controlMaterial; + button.materialInstance = controlMaterialInstance; + button.setPressedCount(0); + + m_buttons.push_back(button); +} + +void Renderer::releaseAllButtons() +{ + m_buttons.clear(); +} + +void Renderer::bindButtonToUserInput(size_t buttonIndex, physx::PxU16 userInputId, const char* buttonName) +{ + PX_ASSERT(m_buttons.size() > buttonIndex); + + TabletButton& button = m_buttons[buttonIndex]; + button.emulatedKeyCode = userInputId; + button.text = buttonName; +} +#endif // RENDERER_TABLET + + +void Renderer::closeScreenquad() +{ + DELETESINGLE(m_screenquadAlphaMaterialInstance); + SAFE_RELEASE(m_screenquadAlphaMaterial); + DELETESINGLE(m_screenquadOpaqueMaterialInstance); + SAFE_RELEASE(m_screenquadOpaqueMaterial); +} + +ScreenQuad::ScreenQuad() : + mLeftUpColor (0xffffffff), + mLeftDownColor (0xffffffff), + mRightUpColor (0xffffffff), + mRightDownColor (0xffffffff), + mAlpha (1.0f), + mX0 (0.0f), + mY0 (0.0f), + mX1 (1.0f), + mY1 (1.0f) +{ +} + +bool Renderer::drawScreenQuad(const ScreenQuad& screenQuad) +{ + RendererMaterial* screenquadMaterial; + RendererMaterialInstance* screenquadMaterialInstance; + if(screenQuad.mAlpha==1.0f) + { + screenquadMaterial = m_screenquadOpaqueMaterial; + screenquadMaterialInstance = m_screenquadOpaqueMaterialInstance; + } + else + { + screenquadMaterial = m_screenquadAlphaMaterial; + screenquadMaterialInstance = m_screenquadAlphaMaterialInstance; + } + + if(!screenquadMaterialInstance || !screenquadMaterial) + return false; + + screenquadMaterial->bind(RendererMaterial::PASS_UNLIT, screenquadMaterialInstance, false); + if(!m_useShadersForTextRendering) + screenquadMaterial->unbind(); + + ScopedRender renderSection(*this); + if(renderSection) + { + setupScreenquadRenderStates(); + + TextVertex Verts[4]; + const PxU16 Indices[6] = { 0,1,2,2,1,3 }; + + PxU32 renderWidth, renderHeight; + getWindowSize(renderWidth, renderHeight); + + // Initalize the vertices + const PxReal xCoeff = PxReal(renderWidth); + const PxReal yCoeff = PxReal(renderHeight); + const PxReal x0 = screenQuad.mX0 * xCoeff; + const PxReal y0 = screenQuad.mY0 * yCoeff; + const PxReal sx = screenQuad.mX1 * xCoeff; + const PxReal sy = screenQuad.mY1 * yCoeff; + const PxReal rhw = 1.0f; + const PxReal z = 0.0f; + + RendererColor leftUpColor = screenQuad.mLeftUpColor; + RendererColor leftDownColor = screenQuad.mLeftDownColor; + RendererColor rightUpColor = screenQuad.mRightUpColor; + RendererColor rightDownColor = screenQuad.mRightDownColor; + const PxU8 alpha = PxU8(screenQuad.mAlpha*255.0f); + leftUpColor.a = alpha; + leftDownColor.a = alpha; + rightUpColor.a = alpha; + rightDownColor.a = alpha; + + Verts[0].p = PxVec3(x0, sy, z); Verts[0].rhw = rhw; Verts[0].color = convertColor(leftDownColor); + Verts[1].p = PxVec3(x0, y0, z); Verts[1].rhw = rhw; Verts[1].color = convertColor(leftUpColor); + Verts[2].p = PxVec3(sx, sy, z); Verts[2].rhw = rhw; Verts[2].color = convertColor(rightDownColor); + Verts[3].p = PxVec3(sx, y0, z); Verts[3].rhw = rhw; Verts[3].color = convertColor(rightUpColor); + + renderTextBuffer(Verts, 4, Indices, 6, screenquadMaterial); + resetScreenquadRenderStates(); + } + + if(m_useShadersForTextRendering) + screenquadMaterial->unbind(); + + return true; +} + +bool Renderer::drawTouchControls() +{ +#if defined(RENDERER_TABLET) + renderControls(); + renderButtons(); +#endif + return true; +} + +#ifdef RENDERER_TABLET +void Renderer::renderControls() +{ + m_controlMaterial->bind(RendererMaterial::PASS_UNLIT, m_controlMaterialInstance, false); + for(int i = 0; i < PX_ARRAY_SIZE(m_controlMesh); ++i) + { + RendererMeshContext ctx; + PxReal zero = 0; + physx::PxMat44 ctrl_transform(PxVec4(m_controlPos[i].x, zero, zero, zero), + PxVec4(m_controlPos[i].y, zero, zero, zero), + PxVec4(m_controlPos[i].x, zero, zero, zero), + PxVec4(zero, zero, zero, zero)); + ctx.cullMode = RendererMeshContext::NONE; + ctx.transform = &ctrl_transform; + bindMeshContext(ctx); + m_controlMesh[i]->bind(); + m_controlMesh[i]->render(m_controlMaterial); + m_controlMesh[i]->unbind(); + } + m_controlMaterial->unbind(); +} + +std::vector<Renderer::TabletButton>& Renderer::screenButtons() +{ + return m_buttons; +} + +void Renderer::renderButtons() +{ + if(m_buttons.size()) + { + for(PxU32 i = 0; i < m_buttons.size(); ++i) + { + // if the button is not used do not draw it + if(m_buttons[i].emulatedKeyCode == 0) + continue; + + const PxVec4& color = m_buttons[i].pressedCount ? m_buttons[i].pressedColor : m_buttons[i].defaultColor; + const RendererMaterial::Variable* var = m_buttons[i].materialInstance->findVariable("diffuseColor", RendererMaterial::VARIABLE_FLOAT4); + if(var) + { + const PxReal data[] = { color.x, color.y, color.z, color.w }; + m_buttons[i].materialInstance->writeData(*var, data); + } + + m_buttons[i].material->bind(RendererMaterial::PASS_UNLIT, m_buttons[i].materialInstance, false); + RendererMeshContext ctx; + physx::PxMat44 ctrl_transform(PxVec4(0.0f)); + ctx.cullMode = RendererMeshContext::NONE; + ctx.transform = &ctrl_transform; + + bindMeshContext(ctx); + + m_buttons[i].mesh->bind(); + m_buttons[i].mesh->render(m_buttons[i].material); + m_buttons[i].mesh->unbind(); + m_buttons[i].material->unbind(); + } + for(PxU32 i = 0; i < m_buttons.size(); ++i) + { + if(m_buttons[i].emulatedKeyCode == 0) + continue; + + /* TODO: It seems that characters has variable width, so this code is not entirely valid, + even though it makes it look better than just printing text starting from + the center of the button */ + const RendererColor textColor(255, 255, 255, 255); + const PxReal TEXT_CHARACTER_WIDTH = 12.0f; + const PxReal TEXT_CHARACTER_HEIGHT = 12.0f; + /* Convert relative buttons coordinates to the absolute screen coordinates */ + PxU32 width, height; + getWindowSize(width, height); + PxVec2 absoluteLeftBottom = PxVec2((m_buttons[i].leftBottom.x + 1.0f) * ((PxReal)width / 2.0f), -(m_buttons[i].leftBottom.y - 1.0f) * ((PxReal)height / 2.0f)); + PxVec2 absoluteRightTop = PxVec2((m_buttons[i].rightTop.x + 1.0f) * ((PxReal)width / 2.0f), -(m_buttons[i].rightTop.y - 1.0f) * ((PxReal)height / 2.0f)); + + PxVec2 absoluteCenter = (absoluteLeftBottom + absoluteRightTop) / 2.0f; + PxReal absoluteWidth = absoluteRightTop.x - absoluteLeftBottom.x; + + /* Leave empty space for half character near edges of the button */ + PxU8 characterToFit = (PxU8) (absoluteWidth / TEXT_CHARACTER_WIDTH - 1); + + std::string text; + PxVec2 textPos; + /* Shrink text if not enough space and decide where to start printing */ + if(characterToFit < m_buttons[i].text.size()) + { + textPos.x = absoluteLeftBottom.x + TEXT_CHARACTER_WIDTH / 2.0f; + text = m_buttons[i].text.substr(0, characterToFit); + } + else + { + textPos.x = absoluteCenter.x - ((PxReal)m_buttons[i].text.size() / 2.0f) * TEXT_CHARACTER_WIDTH; + text = m_buttons[i].text; + } + textPos.y = absoluteCenter.y - TEXT_CHARACTER_HEIGHT / 2.0f; + + + print((PxU32) textPos.x,(PxU32) textPos.y, text.c_str(), 0.5f, 6.0f, textColor, true); + } + } +} +#endif + +bool Renderer::drawLines2D(PxU32 nbVerts, const PxReal* vertices, const RendererColor& color) +{ + RendererMaterial* screenquadMaterial; + RendererMaterialInstance* screenquadMaterialInstance; + screenquadMaterial = m_screenquadOpaqueMaterial; + screenquadMaterialInstance = m_screenquadOpaqueMaterialInstance; + if(!screenquadMaterialInstance || !screenquadMaterial) + return false; + + screenquadMaterial->bind(RendererMaterial::PASS_UNLIT, screenquadMaterialInstance, false); + if(!m_useShadersForTextRendering) + screenquadMaterial->unbind(); + + setupScreenquadRenderStates(); + + TextVertex* verts = new TextVertex[nbVerts]; + + PxU32 renderWidth, renderHeight; + getWindowSize(renderWidth, renderHeight); + const PxReal xCoeff = PxReal(renderWidth); + const PxReal yCoeff = PxReal(renderHeight); + + const PxU32 convertedColor = convertColor(color); + + for(PxU32 i=0;i<nbVerts;i++) + { + verts[i].p.x = vertices[i*2+0] * xCoeff; + verts[i].p.y = vertices[i*2+1] * yCoeff; + verts[i].p.z = 0.0f; + verts[i].rhw = 1.0f; + verts[i].color = convertedColor; + verts[i].u = 0.0f; + verts[i].v = 0.0f; + } + + renderLines2D(verts, nbVerts); + + DELETEARRAY(verts); + + resetScreenquadRenderStates(); + if(m_useShadersForTextRendering) + screenquadMaterial->unbind(); + + return true; +} + +bool Renderer::drawLines2D(PxU32 nbVerts, const PxReal* vertices, const RendererColor* colors) +{ + RendererMaterial* screenquadMaterial; + RendererMaterialInstance* screenquadMaterialInstance; + screenquadMaterial = m_screenquadOpaqueMaterial; + screenquadMaterialInstance = m_screenquadOpaqueMaterialInstance; + if(!screenquadMaterialInstance || !screenquadMaterial) + return false; + + screenquadMaterial->bind(RendererMaterial::PASS_UNLIT, screenquadMaterialInstance, false); + if(!m_useShadersForTextRendering) + screenquadMaterial->unbind(); + + setupScreenquadRenderStates(); + + TextVertex* verts = new TextVertex[nbVerts]; + + PxU32 renderWidth, renderHeight; + getWindowSize(renderWidth, renderHeight); + const PxReal xCoeff = PxReal(renderWidth); + const PxReal yCoeff = PxReal(renderHeight); + + for(PxU32 i=0;i<nbVerts;i++) + { + verts[i].p.x = vertices[i*2+0] * xCoeff; + verts[i].p.y = vertices[i*2+1] * yCoeff; + verts[i].p.z = 0.0f; + verts[i].rhw = 1.0f; + verts[i].color = convertColor(colors[i]); + verts[i].u = 0.0f; + verts[i].v = 0.0f; + } + + renderLines2D(verts, nbVerts); + + DELETEARRAY(verts); + + resetScreenquadRenderStates(); + if(m_useShadersForTextRendering) + screenquadMaterial->unbind(); + + return true; +} + + diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererBoxShape.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererBoxShape.cpp new file mode 100644 index 00000000..c19c5c72 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererBoxShape.cpp @@ -0,0 +1,193 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +// +// RendererBoxShape : convenience class for generating a box mesh. +// +#include <RendererBoxShape.h> + +#include <Renderer.h> + +#include <RendererVertexBuffer.h> +#include <RendererVertexBufferDesc.h> + +#include <RendererIndexBuffer.h> +#include <RendererIndexBufferDesc.h> + +#include <RendererMesh.h> +#include <RendererMeshDesc.h> + +#include <RendererMemoryMacros.h> + +using namespace SampleRenderer; + +typedef struct +{ + PxVec3 positions[4]; + PxVec3 normal; +} BoxFace; + +static const BoxFace g_BoxFaces[] = +{ + { // Z+ + {PxVec3(-1,-1, 1), PxVec3(-1, 1, 1), PxVec3( 1, 1, 1), PxVec3( 1,-1, 1)}, + PxVec3( 0, 0, 1) + }, + { // X+ + {PxVec3( 1,-1, 1), PxVec3( 1, 1, 1), PxVec3( 1, 1,-1), PxVec3( 1,-1,-1)}, + PxVec3( 1, 0, 0) + }, + { // Z- + {PxVec3( 1,-1,-1), PxVec3( 1, 1,-1), PxVec3(-1, 1,-1), PxVec3(-1,-1,-1)}, + PxVec3( 0, 0,-1) + }, + { // X- + {PxVec3(-1,-1,-1), PxVec3(-1, 1,-1), PxVec3(-1, 1, 1), PxVec3(-1,-1, 1)}, + PxVec3(-1, 0, 0) + }, + { // Y+ + {PxVec3(-1, 1, 1), PxVec3(-1, 1,-1), PxVec3( 1, 1,-1), PxVec3( 1, 1, 1)}, + PxVec3( 0, 1, 0) + }, + { // Y- + {PxVec3(-1,-1,-1), PxVec3(-1,-1, 1), PxVec3( 1,-1, 1), PxVec3( 1,-1,-1)}, + PxVec3( 0,-1, 0) + } +}; + +static const PxVec3 g_BoxUVs[] = +{ + PxVec3(0,1,0), PxVec3(0,0,0), + PxVec3(1,0,0), PxVec3(1,1,0), +}; + +namespace physx +{ + static PxVec3 operator*(const PxVec3 &a, const PxVec3 &b) + { + return PxVec3(a.x*b.x, a.y*b.y, a.z*b.z); + } +} + +RendererBoxShape::RendererBoxShape(Renderer &renderer, const PxVec3 &extents, const PxReal* userUVs) : +RendererShape(renderer) +{ + const PxU32 numVerts = 24; + const PxU32 numIndices = 36; + + RendererVertexBufferDesc vbdesc; + vbdesc.hint = RendererVertexBuffer::HINT_STATIC; + vbdesc.semanticFormats[RendererVertexBuffer::SEMANTIC_POSITION] = RendererVertexBuffer::FORMAT_FLOAT3; + vbdesc.semanticFormats[RendererVertexBuffer::SEMANTIC_NORMAL] = RendererVertexBuffer::FORMAT_FLOAT3; + vbdesc.semanticFormats[RendererVertexBuffer::SEMANTIC_TEXCOORD0] = RendererVertexBuffer::FORMAT_FLOAT2; + vbdesc.maxVertices = numVerts; + m_vertexBuffer = m_renderer.createVertexBuffer(vbdesc); + RENDERER_ASSERT(m_vertexBuffer, "Failed to create Vertex Buffer."); + if(m_vertexBuffer) + { + PxU32 positionStride = 0; + void *positions = m_vertexBuffer->lockSemantic(RendererVertexBuffer::SEMANTIC_POSITION, positionStride); + PxU32 normalStride = 0; + void *normals = m_vertexBuffer->lockSemantic(RendererVertexBuffer::SEMANTIC_NORMAL, normalStride); + PxU32 uvStride = 0; + void *uvs = m_vertexBuffer->lockSemantic(RendererVertexBuffer::SEMANTIC_TEXCOORD0, uvStride); + if(positions && normals && uvs) + { + for(PxU32 i=0; i<6; i++) + { + const BoxFace &bf = g_BoxFaces[i]; + for(PxU32 j=0; j<4; j++) + { + PxVec3 &p = *(PxVec3*)positions; positions = ((PxU8*)positions) + positionStride; + PxVec3 &n = *(PxVec3*)normals; normals = ((PxU8*)normals) + normalStride; + PxF32 *uv = (PxF32*)uvs; uvs = ((PxU8*)uvs) + uvStride; + n = bf.normal; + p = bf.positions[j] * extents; + if(userUVs) + { + uv[0] = *userUVs++; + uv[1] = *userUVs++; + } + else + { + uv[0] = g_BoxUVs[j].x; + uv[1] = g_BoxUVs[j].y; + } + } + } + } + m_vertexBuffer->unlockSemantic(RendererVertexBuffer::SEMANTIC_TEXCOORD0); + m_vertexBuffer->unlockSemantic(RendererVertexBuffer::SEMANTIC_NORMAL); + m_vertexBuffer->unlockSemantic(RendererVertexBuffer::SEMANTIC_POSITION); + } + + RendererIndexBufferDesc ibdesc; + ibdesc.hint = RendererIndexBuffer::HINT_STATIC; + ibdesc.format = RendererIndexBuffer::FORMAT_UINT16; + ibdesc.maxIndices = numIndices; + m_indexBuffer = m_renderer.createIndexBuffer(ibdesc); + RENDERER_ASSERT(m_indexBuffer, "Failed to create Index Buffer."); + if(m_indexBuffer) + { + PxU16 *indices = (PxU16*)m_indexBuffer->lock(); + if(indices) + { + for(PxU8 i=0; i<6; i++) + { + const PxU16 base = i*4; + *(indices++) = base+0; + *(indices++) = base+1; + *(indices++) = base+2; + *(indices++) = base+0; + *(indices++) = base+2; + *(indices++) = base+3; + } + } + m_indexBuffer->unlock(); + } + + if(m_vertexBuffer && m_indexBuffer) + { + RendererMeshDesc meshdesc; + meshdesc.primitives = RendererMesh::PRIMITIVE_TRIANGLES; + meshdesc.vertexBuffers = &m_vertexBuffer; + meshdesc.numVertexBuffers = 1; + meshdesc.firstVertex = 0; + meshdesc.numVertices = numVerts; + meshdesc.indexBuffer = m_indexBuffer; + meshdesc.firstIndex = 0; + meshdesc.numIndices = numIndices; + m_mesh = m_renderer.createMesh(meshdesc); + RENDERER_ASSERT(m_mesh, "Failed to create Mesh."); + } +} + +RendererBoxShape::~RendererBoxShape(void) +{ + SAFE_RELEASE(m_vertexBuffer); + SAFE_RELEASE(m_indexBuffer); + SAFE_RELEASE(m_mesh); +} diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererCapsuleShape.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererCapsuleShape.cpp new file mode 100644 index 00000000..1d453131 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererCapsuleShape.cpp @@ -0,0 +1,315 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +// +// RendererCapsuleShape : convenience class for generating a capsule mesh. +// + +#include <PsUtilities.h> + +#include <RendererCapsuleShape.h> + +#include <Renderer.h> + +#include <RendererVertexBuffer.h> +#include <RendererVertexBufferDesc.h> + +#include <RendererIndexBuffer.h> +#include <RendererIndexBufferDesc.h> + +#include <RendererMesh.h> +#include <RendererMeshDesc.h> + +#include <RendererMemoryMacros.h> +#include "PsUtilities.h" + +using namespace SampleRenderer; + +namespace +{ + +const PxU32 g_numSlices = 8; // along lines of longitude +const PxU32 g_numStacks = 16; // along lines of latitude + +const PxU32 g_numSphereVertices = (g_numSlices*2+1)*(g_numStacks+1); +const PxU32 g_numSphereIndices = g_numSlices*2*g_numStacks*6; + +const PxU32 g_numConeVertices = (g_numSlices*2+1)*2; +const PxU32 g_numConeIndices = g_numSlices*2*6; + +PxVec3 g_spherePositions[g_numSphereVertices]; +PxU16 g_sphereIndices[g_numSphereIndices]; + +PxVec3 g_conePositions[g_numConeVertices]; +PxU16 g_coneIndices[g_numConeIndices]; + +// total vertex count +const PxU32 g_numCapsuleVertices = 2*g_numSphereVertices + g_numConeVertices; +const PxU32 g_numCapsuleIndices = 2*g_numSphereIndices + g_numConeIndices; + +void generateSphereMesh(PxU16 slices, PxU16 stacks, PxVec3* positions, PxU16* indices) +{ + const PxF32 thetaStep = PxPi/stacks; + const PxF32 phiStep = PxTwoPi/(slices*2); + + PxF32 theta = 0.0f; + + // generate vertices + for (PxU16 y=0; y <= stacks; ++y) + { + PxF32 phi = 0.0f; + + PxF32 cosTheta = PxCos(theta); + PxF32 sinTheta = PxSin(theta); + + for (PxU16 x=0; x <= slices*2; ++x) + { + PxF32 cosPhi = PxCos(phi); + PxF32 sinPhi = PxSin(phi); + + PxVec3 p(cosPhi*sinTheta, cosTheta, sinPhi*sinTheta); + + // write vertex + *(positions++)= p; + + phi += phiStep; + } + + theta += thetaStep; + } + + const PxU16 numRingQuads = 2*slices; + const PxU16 numRingVerts = 2*slices+1; + + // add faces + for (PxU16 y=0; y < stacks; ++y) + { + for (PxU16 i=0; i < numRingQuads; ++i) + { + // add a quad + *(indices++) = (y+0)*numRingVerts + i; + *(indices++) = (y+1)*numRingVerts + i; + *(indices++) = (y+1)*numRingVerts + i + 1; + + *(indices++) = (y+1)*numRingVerts + i + 1; + *(indices++) = (y+0)*numRingVerts + i + 1; + *(indices++) = (y+0)*numRingVerts + i; + } + } +} + +void generateConeMesh(PxU16 slices, PxVec3* positions, PxU16* indices, PxU16 offset) +{ + // generate vertices + const PxF32 phiStep = PxTwoPi/(slices*2); + PxF32 phi = 0.0f; + + // generate two rings of vertices for the cone ends + for (int i=0; i < 2; ++i) + { + for (PxU16 x=0; x <= slices*2; ++x) + { + PxF32 cosPhi = PxCos(phi); + PxF32 sinPhi = PxSin(phi); + + PxVec3 p(cosPhi, 0.0f, sinPhi); + + // write vertex + *(positions++)= p; + + phi += phiStep; + } + } + + const PxU16 numRingQuads = 2*slices; + const PxU16 numRingVerts = 2*slices+1; + + // add faces + for (PxU16 i=0; i < numRingQuads; ++i) + { + // add a quad + *(indices++) = offset + i; + *(indices++) = offset + numRingVerts + i; + *(indices++) = offset + numRingVerts + i + 1; + + *(indices++) = offset + numRingVerts + i + 1; + *(indices++) = offset + i + 1; + *(indices++) = offset + i; + } +} + +void generateCapsuleMesh() +{ + generateSphereMesh(g_numSlices, g_numStacks, g_spherePositions, g_sphereIndices); + generateConeMesh(g_numSlices, g_conePositions, g_coneIndices, g_numSphereVertices*2); +} + +} // anonymous namespace + +RendererCapsuleShape::RendererCapsuleShape(Renderer &renderer, PxF32 halfHeight, PxF32 radius) : RendererShape(renderer) +{ + static bool meshValid = false; + if (!meshValid) + { + generateCapsuleMesh(); + meshValid = true; + } + + RendererVertexBufferDesc vbdesc; + vbdesc.hint = RendererVertexBuffer::HINT_STATIC; + vbdesc.semanticFormats[RendererVertexBuffer::SEMANTIC_POSITION] = RendererVertexBuffer::FORMAT_FLOAT3; + vbdesc.semanticFormats[RendererVertexBuffer::SEMANTIC_NORMAL] = RendererVertexBuffer::FORMAT_FLOAT3; + vbdesc.semanticFormats[RendererVertexBuffer::SEMANTIC_TEXCOORD0] = RendererVertexBuffer::FORMAT_FLOAT2; + vbdesc.maxVertices = g_numCapsuleVertices; + m_vertexBuffer = m_renderer.createVertexBuffer(vbdesc); + RENDERER_ASSERT(m_vertexBuffer, "Failed to create Vertex Buffer."); + + RendererIndexBufferDesc ibdesc; + ibdesc.hint = RendererIndexBuffer::HINT_STATIC; + ibdesc.format = RendererIndexBuffer::FORMAT_UINT16; + ibdesc.maxIndices = g_numCapsuleIndices; + m_indexBuffer = m_renderer.createIndexBuffer(ibdesc); + RENDERER_ASSERT(m_indexBuffer, "Failed to create Index Buffer."); + + // set position data + setDimensions(halfHeight, radius, radius); + + if(m_indexBuffer) + { + PxU16 *indices = (PxU16*)m_indexBuffer->lock(); + if(indices) + { + // first sphere + for (PxU32 i=0; i < g_numSphereIndices; ++i) + indices[i] = g_sphereIndices[i]; + + indices += g_numSphereIndices; + + // second sphere + for (PxU32 i=0; i < g_numSphereIndices; ++i) + indices[i] = g_sphereIndices[i] + g_numSphereVertices; + + indices += g_numSphereIndices; + + // cone indices + for (PxU32 i=0; i < g_numConeIndices; ++i) + indices[i] = g_coneIndices[i]; + } + m_indexBuffer->unlock(); + } + + if(m_vertexBuffer && m_indexBuffer) + { + RendererMeshDesc meshdesc; + meshdesc.primitives = RendererMesh::PRIMITIVE_TRIANGLES; + meshdesc.vertexBuffers = &m_vertexBuffer; + meshdesc.numVertexBuffers = 1; + meshdesc.firstVertex = 0; + meshdesc.numVertices = g_numCapsuleVertices; + meshdesc.indexBuffer = m_indexBuffer; + meshdesc.firstIndex = 0; + meshdesc.numIndices = g_numCapsuleIndices; + m_mesh = m_renderer.createMesh(meshdesc); + RENDERER_ASSERT(m_mesh, "Failed to create Mesh."); + } +} + +RendererCapsuleShape::~RendererCapsuleShape(void) +{ + SAFE_RELEASE(m_vertexBuffer); + SAFE_RELEASE(m_indexBuffer); + SAFE_RELEASE(m_mesh); +} + +void RendererCapsuleShape::setDimensions(PxF32 halfHeight, PxF32 radius0, PxF32 radius1) +{ + if(m_vertexBuffer) + { + PxU32 positionStride = 0; + PxVec3* positions = (PxVec3*)m_vertexBuffer->lockSemantic(RendererVertexBuffer::SEMANTIC_POSITION, positionStride); + + PxU32 normalStride = 0; + PxVec3* normals = (PxVec3*)m_vertexBuffer->lockSemantic(RendererVertexBuffer::SEMANTIC_NORMAL, normalStride); + + if (positions && normals) + { + const PxF32 radii[2] = { radius1, radius0}; + const PxF32 offsets[2] = { halfHeight, -halfHeight }; + + // write two copies of the sphere mesh scaled and offset appropriately + for (PxU32 s=0; s < 2; ++s) + { + const PxF32 r = radii[s]; + const PxF32 offset = offsets[s]; + + for (PxU32 i=0; i < g_numSphereVertices; ++i) + { + PxVec3 p = g_spherePositions[i]*r; + p.y += offset; + + *positions = p; + *normals = g_spherePositions[i]; + + positions = (PxVec3*)(((PxU8*)positions)+positionStride); + normals = (PxVec3*)(((PxU8*)normals)+normalStride); + } + } + + // calculate cone angle + PxF32 cosTheta = 0.0f; + + if (halfHeight > 0.0f) + cosTheta = (radius0-radius1)/(halfHeight*2.0f); + + // scale factor for normals to avoid re-normalizing each time + PxF32 nscale = PxSqrt(1.0f - cosTheta*cosTheta); + + for (PxU32 s=0; s < 2; ++s) + { + const PxF32 y = radii[s]*cosTheta; + const PxF32 r = PxSqrt(radii[s]*radii[s] - y*y); + const PxF32 offset = offsets[s] + y; + + for (PxU32 i=0; i < g_numConeVertices/2; ++i) + { + PxVec3 p = g_conePositions[i]*r; + p.y += offset; + *positions = p; + + PxVec3 n = g_conePositions[i]*nscale; + n.y = cosTheta; + *normals = n; + + positions = (PxVec3*)(((PxU8*)positions)+positionStride); + normals = (PxVec3*)(((PxU8*)normals)+normalStride); + } + } + } + + m_vertexBuffer->unlockSemantic(RendererVertexBuffer::SEMANTIC_POSITION); + m_vertexBuffer->unlockSemantic(RendererVertexBuffer::SEMANTIC_NORMAL); + } +} diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererClothShape.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererClothShape.cpp new file mode 100644 index 00000000..07d2e753 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererClothShape.cpp @@ -0,0 +1,378 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#include <RendererClothShape.h> + +#include <Renderer.h> + +#include <RendererVertexBuffer.h> +#include <RendererVertexBufferDesc.h> + +#include <RendererIndexBuffer.h> +#include <RendererIndexBufferDesc.h> + +#include <RendererMesh.h> +#include <RendererMeshDesc.h> + +#include <RendererMemoryMacros.h> + +#if defined(RENDERER_ENABLE_CUDA_INTEROP) +#include <task/PxTask.h> +#include <cuda.h> + +// pre-compiled fatbin +#if defined(_M_X64) +#include "cuda/RenderClothNormals_x64.cuh" +#else +#include "cuda/RenderClothNormals_x86.cuh" +#endif + +namespace +{ + CUmodule gClothRenderModule; + CUfunction gClothRenderFunction; + + void checkSuccess(CUresult r) + { + PX_ASSERT(r == CUDA_SUCCESS); + } +} + +#endif + +using namespace SampleRenderer; + +RendererClothShape::RendererClothShape( Renderer& renderer, + const PxVec3* verts, PxU32 numVerts, + const PxVec3* normals, + const PxReal* uvs, + const PxU16* faces, PxU32 numFaces, bool flipWinding, + PxCudaContextManager* ctxMgr) : +RendererShape(renderer), m_numFaces(numFaces), m_ctxMgr(ctxMgr) +{ + PX_UNUSED(m_numFaces); + + { + RendererVertexBufferDesc vbdesc; + vbdesc.hint = RendererVertexBuffer::HINT_STATIC; + vbdesc.semanticFormats[RendererVertexBuffer::SEMANTIC_TEXCOORD0] = RendererVertexBuffer::FORMAT_FLOAT2; + vbdesc.maxVertices = numVerts; + m_vertexBuffer[STATIC_VB] = m_renderer.createVertexBuffer(vbdesc); + RENDERER_ASSERT(m_vertexBuffer[STATIC_VB], "Failed to create Vertex Buffer."); + } + { + RendererVertexBufferDesc vbdesc; + vbdesc.hint = RendererVertexBuffer::HINT_DYNAMIC; + vbdesc.semanticFormats[RendererVertexBuffer::SEMANTIC_POSITION] = RendererVertexBuffer::FORMAT_FLOAT3; + vbdesc.semanticFormats[RendererVertexBuffer::SEMANTIC_NORMAL] = RendererVertexBuffer::FORMAT_FLOAT3; + vbdesc.maxVertices = numVerts; + +#if defined(RENDERER_ENABLE_CUDA_INTEROP) + if (ctxMgr) + { + vbdesc.registerInCUDA = true; + vbdesc.interopContext = ctxMgr; + + ctxMgr->acquireContext(); + + // find module containing our kernel + CUresult success; + + success = cuModuleLoadDataEx(&gClothRenderModule, computeSmoothNormals, 0, NULL, NULL); + RENDERER_ASSERT(success == CUDA_SUCCESS, "Could not load cloth render CUDA module."); + + success = cuModuleGetFunction(&gClothRenderFunction, gClothRenderModule, "computeSmoothNormals"); + RENDERER_ASSERT(success == CUDA_SUCCESS, "Could not find cloth render CUDA function."); + + ctxMgr->releaseContext(); + } +#endif //RENDERER_ENABLE_CUDA_INTEROP + + m_vertexBuffer[DYNAMIC_VB] = m_renderer.createVertexBuffer(vbdesc); + RENDERER_ASSERT(m_vertexBuffer[DYNAMIC_VB], "Failed to create Vertex Buffer."); + } + + if(m_vertexBuffer[DYNAMIC_VB] && m_vertexBuffer[STATIC_VB]) + { + PxU32 positionStride = 0; + void* vertPositions = m_vertexBuffer[DYNAMIC_VB]->lockSemantic(RendererVertexBuffer::SEMANTIC_POSITION, positionStride); + + PxU32 normalStride = 0; + void* vertNormals = m_vertexBuffer[DYNAMIC_VB]->lockSemantic(RendererVertexBuffer::SEMANTIC_NORMAL, normalStride); + + PxU32 uvStride = 0; + void* vertUVs = m_vertexBuffer[STATIC_VB]->lockSemantic(RendererVertexBuffer::SEMANTIC_TEXCOORD0, uvStride); + + if(vertPositions && vertNormals && vertUVs) + { + for(PxU32 i=0; i<numVerts; i++) + { + memcpy(vertPositions, verts+i, sizeof(PxVec3)); + if(normals) + memcpy(vertNormals, normals+i, sizeof(PxVec3)); + else + memset(vertNormals, 0, sizeof(PxVec3)); + + if(uvs) + memcpy(vertUVs, uvs+i*2, sizeof(PxReal)*2); + else + memset(vertUVs, 0, sizeof(PxReal)*2); + + vertPositions = (void*)(((PxU8*)vertPositions) + positionStride); + vertNormals = (void*)(((PxU8*)vertNormals) + normalStride); + vertUVs = (void*)(((PxU8*)vertUVs) + uvStride); + } + } + m_vertexBuffer[DYNAMIC_VB]->unlockSemantic(RendererVertexBuffer::SEMANTIC_NORMAL); + m_vertexBuffer[DYNAMIC_VB]->unlockSemantic(RendererVertexBuffer::SEMANTIC_POSITION); + m_vertexBuffer[STATIC_VB]->unlockSemantic(RendererVertexBuffer::SEMANTIC_TEXCOORD0); + } + + const PxU32 numIndices = numFaces*3; + + RendererIndexBufferDesc ibdesc; + ibdesc.hint = RendererIndexBuffer::HINT_STATIC; + ibdesc.format = RendererIndexBuffer::FORMAT_UINT16; + ibdesc.maxIndices = numIndices; + +#if defined(RENDERER_ENABLE_CUDA_INTEROP) + if (ctxMgr) + { + ibdesc.registerInCUDA = true; + ibdesc.interopContext = ctxMgr; + ibdesc.hint = RendererIndexBuffer::HINT_DYNAMIC; + } +#endif // RENDERER_ENABLE_CUDA_INTEROP + + m_indexBuffer = m_renderer.createIndexBuffer(ibdesc); + RENDERER_ASSERT(m_indexBuffer, "Failed to create Index Buffer."); + if(m_indexBuffer) + { + PxU16* indices = (PxU16*)m_indexBuffer->lock(); + if(indices) + { + if(flipWinding) + { + for(PxU32 i=0;i<numFaces;i++) + { + indices[i*3+0] = faces[i*3+0]; + indices[i*3+1] = faces[i*3+2]; + indices[i*3+2] = faces[i*3+1]; + } + } + else + { + memcpy(indices, faces, sizeof(*faces)*numFaces*3); + } + } + m_indexBuffer->unlock(); + } + + if(m_vertexBuffer[DYNAMIC_VB] && m_vertexBuffer[STATIC_VB] && m_indexBuffer) + { + RendererMeshDesc meshdesc; + meshdesc.primitives = RendererMesh::PRIMITIVE_TRIANGLES; + meshdesc.vertexBuffers = m_vertexBuffer; + meshdesc.numVertexBuffers = NUM_VERTEX_BUFFERS; + meshdesc.firstVertex = 0; + meshdesc.numVertices = numVerts; + meshdesc.indexBuffer = m_indexBuffer; + meshdesc.firstIndex = 0; + meshdesc.numIndices = numIndices; + m_mesh = m_renderer.createMesh(meshdesc); + RENDERER_ASSERT(m_mesh, "Failed to create Mesh."); + } +} +namespace +{ + +#if defined(RENDERER_ENABLE_CUDA_INTEROP) + +PX_INLINE void cuuAlignUp(int* offset, int alignment) +{ + *offset = ((*offset) + (alignment) - 1) & ~((alignment) - 1); +} + +template <typename T, typename T2> CUresult +cuuParamSet(CUfunction hf, int* offset, const T2& var) +{ + cuuAlignUp(offset, __alignof(T)); + CUresult err = cuParamSetv(hf, *offset, (void*)&var, sizeof(T)); + *offset += sizeof(T); + return err; +} + +#endif // RENDERER_ENABLE_CUDA_INTEROP + +} // anonymous namespace + + +bool RendererClothShape::update(CUdeviceptr srcVerts, PxU32 numVerts) +{ +#if defined(RENDERER_ENABLE_CUDA_INTEROP) + + // note: CUDA context must be acquired, and buffers mapped at this point + + PX_ASSERT(m_ctxMgr); + PX_ASSERT(srcVerts); + + // get vertex buffer + CUgraphicsResource vbRes; + CUdeviceptr destVerts; + size_t destSize; + m_vertexBuffer[DYNAMIC_VB]->getInteropResourceHandle(vbRes); + cuGraphicsResourceGetMappedPointer(&destVerts, &destSize, vbRes); + + // get index buffer + CUgraphicsResource ibRes; + CUdeviceptr srcIndices; + size_t indicesSize; + m_indexBuffer->getInteropResourceHandle(ibRes); + cuGraphicsResourceGetMappedPointer(&srcIndices, &indicesSize, ibRes); + + // if either buffers could not be mapped revert to CPU + if (!destVerts || !srcIndices) + return false; + + const size_t ptrSize = sizeof(CUdeviceptr); + + int offset = 0; + checkSuccess(cuuParamSet<CUdeviceptr>(gClothRenderFunction, &offset, srcVerts)); + checkSuccess(cuuParamSet<CUdeviceptr>(gClothRenderFunction, &offset, srcIndices)); + checkSuccess(cuuParamSet<CUdeviceptr>(gClothRenderFunction, &offset, destVerts)); + checkSuccess(cuuParamSet<PxU32>(gClothRenderFunction, &offset, m_numFaces)); + checkSuccess(cuuParamSet<PxU32>(gClothRenderFunction, &offset, numVerts)); + checkSuccess(cuParamSetSize(gClothRenderFunction, offset)); + + const PxU32 blockSize = 512; + const PxU32 numBlocks = 1; + + checkSuccess(cuFuncSetBlockShape(gClothRenderFunction, blockSize, 1, 1)); + checkSuccess(cuLaunchGridAsync(gClothRenderFunction, numBlocks, 1, 0)); + + m_mesh->setVertexBufferRange(0, numVerts); + +#else + PX_ASSERT(0); +#endif + + return true; +} + +void RendererClothShape::mapShapes(RendererClothShape** shapes, PxU32 n) +{ + PX_UNUSED(shapes); + PX_UNUSED(n); + +#if defined(RENDERER_ENABLE_CUDA_INTEROP) + + if (n == 0) + return; + + PX_PROFILE_ZONE("RendererClothShape::mapGraphicsResource",0); + + std::vector<CUgraphicsResource> resources; + for (PxU32 i=0; i < n; ++i) + { + CUgraphicsResource vbRes, ibRes; + shapes[i]->m_vertexBuffer[DYNAMIC_VB]->getInteropResourceHandle(vbRes); + shapes[i]->m_indexBuffer->getInteropResourceHandle(ibRes); + + resources.push_back(vbRes); + resources.push_back(ibRes); + } + + checkSuccess(cuGraphicsMapResources(unsigned int(resources.size()), &resources[0], 0)); + +#else + PX_ASSERT(0); +#endif +} + +void RendererClothShape::unmapShapes(RendererClothShape** shapes, PxU32 n) +{ + PX_UNUSED(shapes); + PX_UNUSED(n); + +#if defined(RENDERER_ENABLE_CUDA_INTEROP) + + if (n == 0) + return; + + PX_PROFILE_ZONE("RendererClothShape::unmapGraphicsResource",0); + + std::vector<CUgraphicsResource> resources; + for (PxU32 i=0; i < n; ++i) + { + CUgraphicsResource vbRes, ibRes; + shapes[i]->m_vertexBuffer[DYNAMIC_VB]->getInteropResourceHandle(vbRes); + shapes[i]->m_indexBuffer->getInteropResourceHandle(ibRes); + + resources.push_back(vbRes); + resources.push_back(ibRes); + } + + checkSuccess(cuGraphicsUnmapResources(unsigned int(resources.size()), &resources[0], 0)); + +#else + PX_ASSERT(0); +#endif +} + +void RendererClothShape::update(const PxVec3* verts, PxU32 numVerts, const PxVec3* normals) +{ + PxU32 positionStride = 0, normalStride = 0; + + PxU8 *locked_positions = static_cast<PxU8*>(m_vertexBuffer[DYNAMIC_VB]->lockSemantic( + RendererVertexBuffer::SEMANTIC_POSITION, positionStride)); + PxU8 *locked_normals = static_cast<PxU8*>(m_vertexBuffer[DYNAMIC_VB]->lockSemantic( + RendererVertexBuffer::SEMANTIC_NORMAL, normalStride)); + + for(PxU32 i=0; i<numVerts; i++) + { + memcpy(locked_positions, verts + i, sizeof(PxVec3)); + memcpy(locked_normals, normals + i, sizeof(PxVec3)); + + locked_positions += positionStride; + locked_normals += normalStride; + } + + m_vertexBuffer[DYNAMIC_VB]->unlockSemantic(SampleRenderer::RendererVertexBuffer::SEMANTIC_NORMAL); + m_vertexBuffer[DYNAMIC_VB]->unlockSemantic(SampleRenderer::RendererVertexBuffer::SEMANTIC_POSITION); + + m_mesh->setVertexBufferRange(0, numVerts); +} + +RendererClothShape::~RendererClothShape(void) +{ + for(PxU32 i = 0; i < NUM_VERTEX_BUFFERS; i++ ) + { + SAFE_RELEASE(m_vertexBuffer[i]); + } + SAFE_RELEASE(m_indexBuffer); + SAFE_RELEASE(m_mesh); +} diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererColor.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererColor.cpp new file mode 100644 index 00000000..f0f9add6 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererColor.cpp @@ -0,0 +1,57 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#include <RendererColor.h> + +using namespace SampleRenderer; + +RendererColor::RendererColor(void) +{ + +} + +RendererColor::RendererColor(PxU8 _r, PxU8 _g, PxU8 _b, PxU8 _a) +{ + r=_r; + g=_g; + b=_b; + a=_a; +} + +RendererColor::RendererColor(PxU32 rgba) +{ + b = (PxU8)((rgba>>16) & 0xff); + g = (PxU8)((rgba>>8) & 0xff); + r = (PxU8)((rgba) & 0xff); + a = 255; +} + +void RendererColor::swizzleRB(void) +{ + PxU8 t = b; + b = r; + r = t; +} diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererDesc.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererDesc.cpp new file mode 100644 index 00000000..7253ceba --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererDesc.cpp @@ -0,0 +1,66 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#include <RendererDesc.h> + +using namespace SampleRenderer; + +RendererDesc::RendererDesc(void) +{ +#if defined(RENDERER_ENABLE_OPENGL) + driver = Renderer::DRIVER_OPENGL; +#elif defined(RENDERER_ENABLE_GLES2) + driver = Renderer::DRIVER_GLES2; +#elif defined(RENDERER_ENABLE_DIRECT3D9) + driver = Renderer::DRIVER_DIRECT3D9; +#elif defined(RENDERER_ENABLE_DIRECT3D11) + driver = Renderer::DRIVER_DIRECT3D11; +#elif defined(RENDERER_ENABLE_LIBGCM) + driver = Renderer::DRIVER_LIBGCM; +#elif defined(RENDERER_ENABLE_LIBGNM) + driver = Renderer::DRIVER_LIBGNM; +#elif defined(RENDERER_ENABLE_GX2) + driver = Renderer::DRIVER_NULL; +#else +#error "No Renderer Drivers support!" +#endif + windowHandle = 0; + + errorCallback = 0; + + vsync = false; + + multipassDepthBias = false; +} + +bool RendererDesc::isValid(void) const +{ + bool ok = true; +#if defined(RENDERER_WINDOWS) + if(!windowHandle) ok = false; +#endif + return ok; +} diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererDirectionalLight.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererDirectionalLight.cpp new file mode 100644 index 00000000..c7739d3c --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererDirectionalLight.cpp @@ -0,0 +1,56 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#include <RendererDirectionalLight.h> +#include <RendererDirectionalLightDesc.h> + +using namespace SampleRenderer; + +RendererDirectionalLight::RendererDirectionalLight(const RendererDirectionalLightDesc &desc) : +RendererLight(desc) +{ + setDirection(desc.direction); +} + +RendererDirectionalLight::~RendererDirectionalLight(void) +{ + +} + +const PxVec3 &RendererDirectionalLight::getDirection(void) const +{ + return m_direction; +} + +void RendererDirectionalLight::setDirection(const PxVec3 &dir) +{ + RENDERER_ASSERT(dir.magnitudeSquared() >= 0.1f, "Trying to give Direction Light invalid Direction value."); + if(dir.magnitudeSquared() >= 0.1f) + { + m_direction = dir; + m_direction.normalize(); + } +} diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererDirectionalLightDesc.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererDirectionalLightDesc.cpp new file mode 100644 index 00000000..d7122bc9 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererDirectionalLightDesc.cpp @@ -0,0 +1,42 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#include <RendererDirectionalLightDesc.h> + +using namespace SampleRenderer; + +RendererDirectionalLightDesc::RendererDirectionalLightDesc(void) : +RendererLightDesc(RendererLight::TYPE_DIRECTIONAL) +{ + direction = PxVec3(0,0,0); +} + +bool RendererDirectionalLightDesc::isValid(void) const +{ + bool ok = RendererLightDesc::isValid(); + if(direction.magnitudeSquared() < 0.1f) ok = false; + return ok; +} diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererGridShape.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererGridShape.cpp new file mode 100644 index 00000000..beaabd73 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererGridShape.cpp @@ -0,0 +1,156 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +// +// RendererGridShape : convenience class for generating a grid mesh. +// +#include <RendererGridShape.h> + +#include <Renderer.h> + +#include <RendererVertexBuffer.h> +#include <RendererVertexBufferDesc.h> + +#include <RendererMesh.h> +#include <RendererMeshDesc.h> + +#include <RendererMemoryMacros.h> + +#include <foundation/PxStrideIterator.h> +#include <PsMathUtils.h> + +using namespace SampleRenderer; + +RendererGridShape::RendererGridShape(Renderer &renderer, PxU32 size, float cellSize, bool showAxis /*= false*/, UpAxis up/*= UP_Y*/) : +RendererShape(renderer), m_UpAxis(up) +{ + m_vertexBuffer = 0; + + const PxU32 numVerts = size*8 + 8; + + RendererVertexBufferDesc vbdesc; + vbdesc.hint = RendererVertexBuffer::HINT_STATIC; + vbdesc.semanticFormats[RendererVertexBuffer::SEMANTIC_POSITION] = RendererVertexBuffer::FORMAT_FLOAT3; + vbdesc.semanticFormats[RendererVertexBuffer::SEMANTIC_COLOR] = RendererVertexBuffer::FORMAT_COLOR_NATIVE; + vbdesc.maxVertices = numVerts; + m_vertexBuffer = m_renderer.createVertexBuffer(vbdesc); + + if(m_vertexBuffer) + { + RendererMeshDesc meshdesc; + meshdesc.primitives = RendererMesh::PRIMITIVE_LINES; + meshdesc.vertexBuffers = &m_vertexBuffer; + meshdesc.numVertexBuffers = 1; + meshdesc.firstVertex = 0; + meshdesc.numVertices = numVerts; + m_mesh = m_renderer.createMesh(meshdesc); + } + if(m_vertexBuffer && m_mesh) + { + PxU32 color1 = m_renderer.convertColor(RendererColor ( 94, 108, 127)); + PxU32 color2 = m_renderer.convertColor(RendererColor (120, 138, 163)); + PxU32 colorRed = m_renderer.convertColor(RendererColor (255, 0, 0)); + PxU32 colorGreen = m_renderer.convertColor(RendererColor ( 0, 255, 0)); + PxU32 colorBlue = m_renderer.convertColor(RendererColor ( 0, 0, 255)); + + PxStrideIterator<PxVec3> positions; + { + PxU32 positionStride = 0; + void* pos = m_vertexBuffer->lockSemantic(RendererVertexBuffer::SEMANTIC_POSITION, positionStride); + positions = PxMakeIterator((PxVec3*)pos, positionStride); + } + PxStrideIterator<PxU32> colors; + { + PxU32 colorStride = 0; + void* color = m_vertexBuffer->lockSemantic(RendererVertexBuffer::SEMANTIC_COLOR, colorStride); + colors = PxMakeIterator((PxU32*)color, colorStride); + } + + if(positions.ptr() && colors.ptr()) + { + PxVec3 upAxis(0.0f); + + PxU32 colorX1 = color1; + PxU32 colorX2 = color1; + PxU32 colorZ1 = color1; + PxU32 colorZ2 = color1; + + switch(up) + { + case UP_X: upAxis = PxVec3(1.0f, 0.0f, 0.0f); break; + case UP_Y: upAxis = PxVec3(0.0f, 1.0f, 0.0f); break; + case UP_Z: upAxis = PxVec3(0.0f, 0.0f, 1.0f); break; + } + PxMat33 rotation = physx::shdfnd::rotFrom2Vectors(PxVec3(0.0f, 1.0f, 0.0f), upAxis); + + if (showAxis) + { + switch(up) + { + case UP_X: colorX2 = colorGreen; colorZ1 = colorBlue; break; + case UP_Y: colorX1 = colorRed; colorZ1 = colorBlue; break; + case UP_Z: colorX1 = colorRed; colorZ2 = colorGreen; break; + } + } + + float radius = size*cellSize; + + positions[0] = rotation * PxVec3( 0.0f, 0.0f, 0.0f); colors[0] = colorX1; + positions[1] = rotation * PxVec3( radius, 0.0f, 0.0f); colors[1] = colorX1; + positions[2] = rotation * PxVec3( 0.0f, 0.0f, 0.0f); colors[2] = colorX2; + positions[3] = rotation * PxVec3(-radius, 0.0f, 0.0f); colors[3] = colorX2; + positions[4] = rotation * PxVec3( 0.0f, 0.0f, 0.0f); colors[4] = colorZ1; + positions[5] = rotation * PxVec3( 0.0f, 0.0f, radius); colors[5] = colorZ1; + positions[6] = rotation * PxVec3( 0.0f, 0.0f, 0.0f); colors[6] = colorZ2; + positions[7] = rotation * PxVec3( 0.0f, 0.0f,-radius); colors[7] = colorZ2; + + + for (PxU32 i = 1; i <= size; i++) + { + positions[i*8+0] = rotation * PxVec3(-radius, 0.0f, cellSize * i); + positions[i*8+1] = rotation * PxVec3( radius, 0.0f, cellSize * i); + positions[i*8+2] = rotation * PxVec3(-radius, 0.0f,-cellSize * i); + positions[i*8+3] = rotation * PxVec3( radius, 0.0f,-cellSize * i); + positions[i*8+4] = rotation * PxVec3( cellSize * i, 0.0f,-radius); + positions[i*8+5] = rotation * PxVec3( cellSize * i, 0.0f, radius); + positions[i*8+6] = rotation * PxVec3(-cellSize * i, 0.0f,-radius); + positions[i*8+7] = rotation * PxVec3(-cellSize * i, 0.0f, radius); + + for (PxU32 j = 0; j < 8; j++) + colors[i*8+j] = color2; + } + } + + m_vertexBuffer->unlockSemantic(RendererVertexBuffer::SEMANTIC_COLOR); + m_vertexBuffer->unlockSemantic(RendererVertexBuffer::SEMANTIC_POSITION); + } +} + +RendererGridShape::~RendererGridShape(void) +{ + SAFE_RELEASE(m_vertexBuffer); + SAFE_RELEASE(m_mesh); +} diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererIndexBuffer.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererIndexBuffer.cpp new file mode 100644 index 00000000..6060c966 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererIndexBuffer.cpp @@ -0,0 +1,71 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#include <RendererIndexBuffer.h> +#include <RendererIndexBufferDesc.h> + +using namespace SampleRenderer; + +PxU32 RendererIndexBuffer::getFormatByteSize(Format format) +{ + PxU32 size = 0; + switch(format) + { + case FORMAT_UINT16: size = sizeof(PxU16); break; + case FORMAT_UINT32: size = sizeof(PxU32); break; + default: break; + } + RENDERER_ASSERT(size, "Unable to determine size of format."); + return size; +} + +RendererIndexBuffer::RendererIndexBuffer(const RendererIndexBufferDesc &desc) : +RendererInteropableBuffer(desc.registerInCUDA, desc.interopContext), + m_hint(desc.hint), + m_format(desc.format) +{ + m_maxIndices = 0; +} + +RendererIndexBuffer::~RendererIndexBuffer(void) +{ + +} + +RendererIndexBuffer::Hint RendererIndexBuffer::getHint(void) const +{ + return m_hint; +} + +RendererIndexBuffer::Format RendererIndexBuffer::getFormat(void) const +{ + return m_format; +} + +PxU32 RendererIndexBuffer::getMaxIndices(void) const +{ + return m_maxIndices; +} diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererIndexBufferDesc.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererIndexBufferDesc.cpp new file mode 100644 index 00000000..b4c7e407 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererIndexBufferDesc.cpp @@ -0,0 +1,49 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#include <RendererIndexBufferDesc.h> + +using namespace SampleRenderer; + +RendererIndexBufferDesc::RendererIndexBufferDesc(void) +{ + hint = RendererIndexBuffer::HINT_STATIC; + format = RendererIndexBuffer::NUM_FORMATS; + maxIndices = 0; + canReadBack = false; + registerInCUDA = false; + interopContext = 0; +} + +bool RendererIndexBufferDesc::isValid(void) const +{ + bool ok = true; + if(format >= RendererIndexBuffer::NUM_FORMATS) ok = false; + if(maxIndices == 0) ok = false; + if(registerInCUDA && !interopContext) + ok = false; + return ok; +} diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererInstanceBuffer.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererInstanceBuffer.cpp new file mode 100644 index 00000000..e745723f --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererInstanceBuffer.cpp @@ -0,0 +1,140 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#include <RendererInstanceBuffer.h> +#include <RendererInstanceBufferDesc.h> + +using namespace SampleRenderer; + +PxU32 RendererInstanceBuffer::getFormatByteSize(Format format) +{ + PxU32 size = 0; + switch(format) + { + case FORMAT_FLOAT1: size = sizeof(float)*1; break; + case FORMAT_FLOAT2: size = sizeof(float)*2; break; + case FORMAT_FLOAT3: size = sizeof(float)*3; break; + case FORMAT_FLOAT4: size = sizeof(float)*4; break; + default: break; + } + RENDERER_ASSERT(size, "Unable to determine size of Format."); + return size; +} + +RendererInstanceBuffer::RendererInstanceBuffer(const RendererInstanceBufferDesc &desc) : +RendererInteropableBuffer(desc.registerInCUDA, desc.interopContext), + m_hint(desc.hint) +{ + m_maxInstances = 0; + m_stride = 0; + m_lockedBuffer = 0; + m_numSemanticLocks = 0; + for(PxU32 i=0; i<NUM_SEMANTICS; i++) + { + Format format = desc.semanticFormats[i]; + if(format < NUM_FORMATS) + { + SemanticDesc &sm = m_semanticDescs[i]; + sm.format = format; + sm.offset = m_stride; + m_stride += getFormatByteSize(format); + } + } +} + +RendererInstanceBuffer::~RendererInstanceBuffer(void) +{ + RENDERER_ASSERT(m_lockedBuffer==0 && m_numSemanticLocks==0, "InstanceBuffer had outstanding locks during destruction!"); +} + +RendererInstanceBuffer::Hint RendererInstanceBuffer::getHint(void) const +{ + return m_hint; +} + +RendererInstanceBuffer::Format RendererInstanceBuffer::getFormatForSemantic(Semantic semantic) const +{ + return m_semanticDescs[semantic].format; +} + +PxU32 SampleRenderer::RendererInstanceBuffer::getMaxInstances(void) const +{ + return m_maxInstances; +} + +PxU32 RendererInstanceBuffer::getOffsetForSemantic(Semantic semantic) const +{ + return m_semanticDescs[semantic].offset; +} + +void *RendererInstanceBuffer::lockSemantic(Semantic semantic, PxU32 &stride) +{ + void *semanticBuffer = 0; + RENDERER_ASSERT(semantic < NUM_SEMANTICS, "Invalid InstanceBuffer Semantic!"); + if(semantic < NUM_SEMANTICS) + { + SemanticDesc &sm = m_semanticDescs[semantic]; + RENDERER_ASSERT(!sm.locked, "InstanceBuffer Semantic already locked."); + RENDERER_ASSERT(sm.format < NUM_FORMATS, "InstanceBuffer Semantic format not valid."); + if(!sm.locked && sm.format < NUM_FORMATS) + { + if(!m_lockedBuffer && !m_numSemanticLocks) + { + m_lockedBuffer = lock(); + } + RENDERER_ASSERT(m_lockedBuffer, "Unable to lock InstanceBuffer!"); + if(m_lockedBuffer) + { + m_numSemanticLocks++; + sm.locked = true; + semanticBuffer = ((PxU8*)m_lockedBuffer) + sm.offset; + stride = m_stride; + } + } + } + return semanticBuffer; +} + +void RendererInstanceBuffer::unlockSemantic(Semantic semantic) +{ + RENDERER_ASSERT(semantic < NUM_SEMANTICS, "Invalid InstanceBuffer Semantic!"); + if(semantic < NUM_SEMANTICS) + { + SemanticDesc &sm = m_semanticDescs[semantic]; + RENDERER_ASSERT(m_lockedBuffer && m_numSemanticLocks && sm.locked, "Trying to unlock a semantic that was not locked."); + if(m_lockedBuffer && m_numSemanticLocks && sm.locked) + { + sm.locked = false; + m_numSemanticLocks--; + } + if(m_lockedBuffer && m_numSemanticLocks == 0) + { + unlock(); + m_lockedBuffer = 0; + } + } +} + diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererInstanceBufferDesc.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererInstanceBufferDesc.cpp new file mode 100644 index 00000000..91297e6e --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererInstanceBufferDesc.cpp @@ -0,0 +1,69 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#include <RendererInstanceBufferDesc.h> +#include "foundation/PxAssert.h" + +using namespace SampleRenderer; + +RendererInstanceBufferDesc::RendererInstanceBufferDesc(void) +{ + hint = RendererInstanceBuffer::HINT_STATIC; + for(PxU32 i=0; i<RendererInstanceBuffer::NUM_SEMANTICS; i++) + { + semanticFormats[i] = RendererInstanceBuffer::NUM_FORMATS; + } + maxInstances = 0; + canReadBack = false; + registerInCUDA = false; + interopContext = 0; +} + +bool RendererInstanceBufferDesc::isValid(void) const +{ + bool ok = true; + if(!maxInstances) ok = false; + + bool bValidTurbulence = ok; + if(semanticFormats[RendererInstanceBuffer::SEMANTIC_POSITION] != RendererInstanceBuffer::FORMAT_FLOAT3) ok = false; + if(semanticFormats[RendererInstanceBuffer::SEMANTIC_NORMALX] != RendererInstanceBuffer::FORMAT_FLOAT3) ok = false; + if(semanticFormats[RendererInstanceBuffer::SEMANTIC_NORMALY] != RendererInstanceBuffer::FORMAT_FLOAT3) ok = false; + if(semanticFormats[RendererInstanceBuffer::SEMANTIC_NORMALZ] != RendererInstanceBuffer::FORMAT_FLOAT3) ok = false; + + if(semanticFormats[RendererInstanceBuffer::SEMANTIC_POSITION] != RendererInstanceBuffer::FORMAT_FLOAT3) bValidTurbulence = false; + if(semanticFormats[RendererInstanceBuffer::SEMANTIC_VELOCITY_LIFE] != RendererInstanceBuffer::FORMAT_FLOAT4) bValidTurbulence = false; + + if((semanticFormats[RendererInstanceBuffer::SEMANTIC_UV_OFFSET] != RendererInstanceBuffer::FORMAT_FLOAT2) && + (semanticFormats[RendererInstanceBuffer::SEMANTIC_UV_OFFSET] != RendererInstanceBuffer::NUM_FORMATS)) ok = false; + if((semanticFormats[RendererInstanceBuffer::SEMANTIC_LOCAL_OFFSET] != RendererInstanceBuffer::FORMAT_FLOAT3) && + (semanticFormats[RendererInstanceBuffer::SEMANTIC_LOCAL_OFFSET] != RendererInstanceBuffer::NUM_FORMATS)) ok = false; + + if(registerInCUDA && !interopContext) + ok = false; + + PX_ASSERT(bValidTurbulence || ok); + return bValidTurbulence || ok; +} diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererLight.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererLight.cpp new file mode 100644 index 00000000..1e91d124 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererLight.cpp @@ -0,0 +1,124 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#include <RendererLight.h> +#include <RendererLightDesc.h> + +#include <Renderer.h> + +using namespace SampleRenderer; + +RendererLight::RendererLight(const RendererLightDesc &desc) : +m_type(desc.type), +m_shadowProjection(45, 1, 0.1f, 100.0f) +{ + m_renderer = 0; + setColor(desc.color); + setIntensity(desc.intensity); + setShadowMap(desc.shadowMap); + setShadowTransform(desc.shadowTransform); + setShadowProjection(desc.shadowProjection); +} + +RendererLight::~RendererLight(void) +{ + RENDERER_ASSERT(!isLocked(), "Light is locked by a Renderer during release."); +} + +void SampleRenderer::RendererLight::release(void) +{ + if (m_renderer) m_renderer->removeLightFromRenderQueue(*this); + delete this; +} + +RendererLight::Type RendererLight::getType(void) const +{ + return m_type; +} + +RendererMaterial::Pass RendererLight::getPass(void) const +{ + RendererMaterial::Pass pass = RendererMaterial::NUM_PASSES; + switch(m_type) + { + case TYPE_POINT: pass = RendererMaterial::PASS_POINT_LIGHT; break; + case TYPE_DIRECTIONAL: pass = RendererMaterial::PASS_DIRECTIONAL_LIGHT; break; + case TYPE_SPOT: pass = m_shadowMap != NULL ? RendererMaterial::PASS_SPOT_LIGHT : RendererMaterial::PASS_SPOT_LIGHT_NO_SHADOW; break; + default: break; + } + RENDERER_ASSERT(pass < RendererMaterial::NUM_PASSES, "Unable to compute the Pass for the Light."); + return pass; +} + +const RendererColor &RendererLight::getColor(void) const +{ + return m_color; +} + +void RendererLight::setColor(const RendererColor &color) +{ + m_color = color; +} + +float RendererLight::getIntensity(void) const +{ + return m_intensity; +} + +void RendererLight::setIntensity(float intensity) +{ + RENDERER_ASSERT(intensity >= 0, "Light intensity is negative."); + if(intensity >= 0) + { + m_intensity = intensity; + } +} + +bool RendererLight::isLocked(void) const +{ + return m_renderer ? true : false; +} + +RendererTexture2D *RendererLight::getShadowMap(void) const +{ + return m_shadowMap; +} + +void RendererLight::setShadowMap(RendererTexture2D *shadowMap) +{ + m_shadowMap = shadowMap; +} + +const RendererProjection &RendererLight::getShadowProjection(void) const +{ + return m_shadowProjection; +} + +void RendererLight::setShadowProjection(const RendererProjection &shadowProjection) +{ + m_shadowProjection = shadowProjection; +} + diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererLightDesc.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererLightDesc.cpp new file mode 100644 index 00000000..fa7f7582 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererLightDesc.cpp @@ -0,0 +1,46 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#include <RendererLightDesc.h> + +using namespace SampleRenderer; + +RendererLightDesc::RendererLightDesc(RendererLight::Type _type) : +type(_type), +shadowProjection(45, 1, 0.1f, 100.0f) +{ + color = RendererColor(0,0,0,0); + intensity = 0; + shadowMap = 0; + shadowTransform = physx::PxTransform(PxIdentity); +} + +bool RendererLightDesc::isValid(void) const +{ + bool ok = true; + if(intensity < 0) ok = false; + return ok; +} diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererMaterial.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererMaterial.cpp new file mode 100644 index 00000000..aec0c0b9 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererMaterial.cpp @@ -0,0 +1,195 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#include <RendererMaterial.h> + +#include <Renderer.h> +#include <RendererMaterialDesc.h> +#include <RendererMaterialInstance.h> + + +#include <PsString.h> +namespace Ps = physx::shdfnd; +#undef PxI32 + +using namespace SampleRenderer; + +static PxU32 getVariableTypeSize(RendererMaterial::VariableType type) +{ + PxU32 size = 0; + switch(type) + { + case RendererMaterial::VARIABLE_FLOAT: size = sizeof(float)*1; break; + case RendererMaterial::VARIABLE_FLOAT2: size = sizeof(float)*2; break; + case RendererMaterial::VARIABLE_FLOAT3: size = sizeof(float)*3; break; + case RendererMaterial::VARIABLE_FLOAT4: size = sizeof(float)*4; break; + case RendererMaterial::VARIABLE_FLOAT4x4: size = sizeof(float)*4*4; break; + case RendererMaterial::VARIABLE_INT: size = sizeof(int)*1; break; + case RendererMaterial::VARIABLE_SAMPLER2D: size = sizeof(RendererTexture2D*); break; + case RendererMaterial::VARIABLE_SAMPLER3D: size = sizeof(RendererTexture3D*); break; + default: break; + } + RENDERER_ASSERT(size>0, "Unable to compute Variable Type size."); + return size; +} + +RendererMaterial::Variable::Variable(const char *name, VariableType type, unsigned int offset) +{ + size_t len = strlen(name)+1; + m_name = new char[len]; + Ps::strlcpy(m_name, len, name); + m_type = type; + m_offset = offset; + m_size = -1; +} + +void RendererMaterial::Variable::setSize(PxU32 size) +{ + m_size = size; +} + +RendererMaterial::Variable::~Variable(void) +{ + if(m_name) delete [] m_name; +} + +const char *RendererMaterial::Variable::getName(void) const +{ + return m_name; +} + +RendererMaterial::VariableType RendererMaterial::Variable::getType(void) const +{ + return m_type; +} + +PxU32 RendererMaterial::Variable::getDataOffset(void) const +{ + return m_offset; +} + +PxU32 RendererMaterial::Variable::getDataSize(void) const +{ + return m_size != -1 ? m_size : getVariableTypeSize(m_type); +} + +const char *RendererMaterial::getPassName(Pass pass) +{ + const char *passName = 0; + switch(pass) + { + case PASS_UNLIT: passName="PASS_UNLIT"; break; + + case PASS_AMBIENT_LIGHT: passName="PASS_AMBIENT_LIGHT"; break; + case PASS_POINT_LIGHT: passName="PASS_POINT_LIGHT"; break; + case PASS_DIRECTIONAL_LIGHT: passName="PASS_DIRECTIONAL_LIGHT"; break; + case PASS_SPOT_LIGHT_NO_SHADOW: passName="PASS_SPOT_LIGHT_NO_SHADOW"; break; + case PASS_SPOT_LIGHT: passName="PASS_SPOT_LIGHT"; break; + + case PASS_NORMALS: passName="PASS_NORMALS"; break; + case PASS_DEPTH: passName="PASS_DEPTH"; break; + default: break; + + // LRR: The deferred pass causes compiles with the ARB_draw_buffers profile option, creating + // multiple color draw buffers. This doesn't work in OGL on ancient Intel parts. + //case PASS_DEFERRED: passName="PASS_DEFERRED"; break; + } + RENDERER_ASSERT(passName, "Unable to obtain name for the given Material Pass."); + return passName; +} + +RendererMaterial::RendererMaterial(const RendererMaterialDesc &desc, bool enableMaterialCaching) : + m_type(desc.type), + m_alphaTestFunc(desc.alphaTestFunc), + m_srcBlendFunc(desc.srcBlendFunc), + m_dstBlendFunc(desc.dstBlendFunc), + m_refCount(1), + mEnableMaterialCaching(enableMaterialCaching) +{ + m_alphaTestRef = desc.alphaTestRef; + m_blending = desc.blending; + m_variableBufferSize = 0; +} + +RendererMaterial::~RendererMaterial(void) +{ + RENDERER_ASSERT(m_refCount == 0, "RendererMaterial was not released as often as it was created"); + + PxU32 numVariables = (PxU32)m_variables.size(); + for(PxU32 i=0; i<numVariables; i++) + { + delete m_variables[i]; + } +} + +void RendererMaterial::release() +{ + m_refCount--; + + if (!mEnableMaterialCaching) + { + PX_ASSERT(m_refCount == 0); + delete this; + } +} + +void RendererMaterial::bind(RendererMaterial::Pass pass, RendererMaterialInstance *materialInstance, bool instanced) const +{ + if(materialInstance) + { + PxU32 numVariables = (PxU32)m_variables.size(); + for(PxU32 i = 0; i < numVariables; i++) + { + const Variable &variable = *m_variables[i]; + bindVariable(pass, variable, materialInstance->m_data+variable.getDataOffset()); + } + } +} + +bool RendererMaterial::rendererBlendingOverrideEnabled() const +{ + return getRenderer().blendingOverrideEnabled(); +} + +const RendererMaterial::Variable *RendererMaterial::findVariable(const char *name, RendererMaterial::VariableType varType) +{ + RendererMaterial::Variable *var = 0; + PxU32 numVariables = (PxU32)m_variables.size(); + for(PxU32 i=0; i<numVariables; i++) + { + RendererMaterial::Variable &v = *m_variables[i]; + if(!strcmp(v.getName(), name)) + { + var = &v; + break; + } + } + if(var && var->getType() != varType) + { + var = 0; + } + return var; +} diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererMaterialDesc.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererMaterialDesc.cpp new file mode 100644 index 00000000..ab726676 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererMaterialDesc.cpp @@ -0,0 +1,64 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#include <RendererMaterialDesc.h> + +using namespace SampleRenderer; + +RendererMaterialDesc::RendererMaterialDesc(void) +{ + type = RendererMaterial::TYPE_UNLIT; + alphaTestFunc = RendererMaterial::ALPHA_TEST_ALWAYS; + alphaTestRef = 0; + blending = false; + instanced = false; + srcBlendFunc = RendererMaterial::BLEND_ZERO; + dstBlendFunc = RendererMaterial::BLEND_ZERO; + geometryShaderPath = 0; + hullShaderPath = 0; + domainShaderPath = 0; + vertexShaderPath = 0; + fragmentShaderPath = 0; +} + +bool RendererMaterialDesc::isValid(void) const +{ + bool ok = true; + if(type >= RendererMaterial::NUM_TYPES) ok = false; + if(alphaTestRef < 0 || alphaTestRef > 1) ok = false; + // Note: Lighting and blending may not be properly supported, but that + // shouldn't crash the system, so this check is disabled for now + // if(blending && type != RendererMaterial::TYPE_UNLIT) ok = false; + if(geometryShaderPath || domainShaderPath || fragmentShaderPath) + { + // Note: These should be completely optional! Disabling for now. + //RENDERER_ASSERT(0, "Not implemented!"); + //ok = false; + } + if(!vertexShaderPath) ok = false; + if(!fragmentShaderPath) ok = false; + return ok; +} diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererMaterialInstance.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererMaterialInstance.cpp new file mode 100644 index 00000000..4b25dfe8 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererMaterialInstance.cpp @@ -0,0 +1,77 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#include <RendererMaterialInstance.h> +#include <RendererMaterial.h> +#include <foundation/PxAssert.h> + +using namespace SampleRenderer; + +RendererMaterialInstance::RendererMaterialInstance(RendererMaterial &material) : +m_material(material) +{ + m_data = 0; + PxU32 dataSize = m_material.getMaterialInstanceDataSize(); + if(dataSize > 0) + { + m_data = new PxU8[dataSize]; + memset(m_data, 0, dataSize); + } +} + +RendererMaterialInstance::RendererMaterialInstance(const RendererMaterialInstance& other) : +m_material(other.m_material) +{ + PxU32 dataSize = m_material.getMaterialInstanceDataSize(); + if (dataSize > 0) + { + m_data = new PxU8[dataSize]; + memcpy(m_data, other.m_data, dataSize); + } +} + +RendererMaterialInstance::~RendererMaterialInstance(void) +{ + if(m_data) delete [] m_data; +} + +void RendererMaterialInstance::writeData(const RendererMaterial::Variable &var, const void *data) +{ + if(m_data && data) + { + memcpy(m_data+var.getDataOffset(), data, var.getDataSize()); + } +} + +RendererMaterialInstance &RendererMaterialInstance::operator=(const RendererMaterialInstance &b) +{ + PX_ASSERT(&m_material == &b.m_material); + if(&m_material == &b.m_material) + { + memcpy(m_data, b.m_data, m_material.getMaterialInstanceDataSize()); + } + return *this; +} diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererMesh.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererMesh.cpp new file mode 100644 index 00000000..9a76579a --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererMesh.cpp @@ -0,0 +1,193 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#include <RendererMesh.h> +#include <RendererMeshDesc.h> + +#include <Renderer.h> +#include <RendererVertexBuffer.h> +#include <RendererIndexBuffer.h> +#include <RendererInstanceBuffer.h> + + +using namespace SampleRenderer; + +RendererMesh::RendererMesh(const RendererMeshDesc &desc) +{ + m_primitives = desc.primitives; + + m_numVertexBuffers = desc.numVertexBuffers; + m_vertexBuffers = new RendererVertexBuffer*[m_numVertexBuffers]; + for(PxU32 i=0; i<m_numVertexBuffers; i++) + { + m_vertexBuffers[i] = desc.vertexBuffers[i]; + } + m_firstVertex = desc.firstVertex; + m_numVertices = desc.numVertices; + + m_indexBuffer = desc.indexBuffer; + m_firstIndex = desc.firstIndex; + m_numIndices = desc.numIndices; + + m_instanceBuffer = desc.instanceBuffer; + m_firstInstance = desc.firstInstance; + m_numInstances = desc.numInstances; +} + +RendererMesh::~RendererMesh(void) +{ + delete [] m_vertexBuffers; +} + +void SampleRenderer::RendererMesh::release(void) +{ + renderer().removeMeshFromRenderQueue(*this); + delete this; +} + +RendererMesh::Primitive RendererMesh::getPrimitives(void) const +{ + return m_primitives; +} + +PxU32 RendererMesh::getNumVertices(void) const +{ + return m_numVertices; +} + +PxU32 RendererMesh::getNumIndices(void) const +{ + return m_numIndices; +} + +PxU32 RendererMesh::getNumInstances(void) const +{ + return m_numInstances; +} + +void RendererMesh::setVertexBufferRange(PxU32 firstVertex, PxU32 numVertices) +{ + // TODO: Check for valid range... + m_firstVertex = firstVertex; + m_numVertices = numVertices; +} + +void RendererMesh::setIndexBufferRange(PxU32 firstIndex, PxU32 numIndices) +{ + // TODO: Check for valid range... + m_firstIndex = firstIndex; + m_numIndices = numIndices; +} + +void RendererMesh::setInstanceBufferRange(PxU32 firstInstance, PxU32 numInstances) +{ + // TODO: Check for valid range... + m_firstInstance = firstInstance; + m_numInstances = numInstances; +} + +PxU32 RendererMesh::getNumVertexBuffers(void) const +{ + return m_numVertexBuffers; +} + +const RendererVertexBuffer *const*RendererMesh::getVertexBuffers(void) const +{ + return m_vertexBuffers; +} + +const RendererIndexBuffer *RendererMesh::getIndexBuffer(void) const +{ + return m_indexBuffer; +} + +const RendererInstanceBuffer *RendererMesh::getInstanceBuffer(void) const +{ + return m_instanceBuffer; +} + +void RendererMesh::bind(void) const +{ + for(PxU32 i=0; i<m_numVertexBuffers; i++) + { + //RENDERER_ASSERT(m_vertexBuffers[i]->checkBufferWritten(), "Vertex buffer is empty!"); + if (m_vertexBuffers[i]->checkBufferWritten()) + { + m_vertexBuffers[i]->bind(i, m_firstVertex); + } + } + if(m_instanceBuffer) + { + m_instanceBuffer->bind(m_numVertexBuffers, m_firstInstance); + } + if(m_indexBuffer) + { + m_indexBuffer->bind(); + } +} + +void RendererMesh::render(RendererMaterial *material) const +{ + if(m_instanceBuffer) + { + if(m_indexBuffer) + { + renderIndicesInstanced(m_numVertices, m_firstIndex, m_numIndices, m_indexBuffer->getFormat(), material); + } + else if(m_numVertices) + { + renderVerticesInstanced(m_numVertices, material); + } + } + else + { + if(m_indexBuffer) + { + renderIndices(m_numVertices, m_firstIndex, m_numIndices, m_indexBuffer->getFormat(), material); + } + else if(m_numVertices) + { + renderVertices(m_numVertices, material); + } + } +} + +void RendererMesh::unbind(void) const +{ + if(m_indexBuffer) + { + m_indexBuffer->unbind(); + } + if(m_instanceBuffer) + { + m_instanceBuffer->unbind(m_numVertexBuffers); + } + for(PxU32 i=0; i<m_numVertexBuffers; i++) + { + m_vertexBuffers[i]->unbind(i); + } +} + diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererMeshContext.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererMeshContext.cpp new file mode 100644 index 00000000..8bbbfcea --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererMeshContext.cpp @@ -0,0 +1,56 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#include <RendererMeshContext.h> + +using namespace SampleRenderer; + +RendererMeshContext::RendererMeshContext(void) +{ + mesh = 0; + material = 0; + materialInstance = 0; + transform = 0; + shaderData = 0; + boneMatrices = 0; + numBones = 0; + cullMode = CLOCKWISE; + screenSpace = false; + fillMode = SOLID; + negativeScale = false; +} + +RendererMeshContext::~RendererMeshContext(void) +{ +} + +bool RendererMeshContext::isValid(void) const +{ + bool ok = true; + if(!mesh) ok = false; + if(!material) ok = false; + return ok; +} diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererMeshDesc.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererMeshDesc.cpp new file mode 100644 index 00000000..2a461a36 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererMeshDesc.cpp @@ -0,0 +1,57 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#include <RendererMeshDesc.h> + +using namespace SampleRenderer; + +RendererMeshDesc::RendererMeshDesc(void) +{ + primitives = RendererMesh::PRIMITIVE_POINTS; + + vertexBuffers = 0; + numVertexBuffers = 0; + firstVertex = 0; + numVertices = 0; + + indexBuffer = 0; + firstIndex = 0; + numIndices = 0; + + instanceBuffer = 0; + firstInstance = 0; + numInstances = 0; +} + +bool RendererMeshDesc::isValid(void) const +{ + bool ok = true; + // remove vertexBuffer check for sprites + /* if(!vertexBuffers || !numVertexBuffers) ok = false; */ + if(numIndices && !indexBuffer) ok = false; + if(numInstances && !instanceBuffer) ok = false; + return ok; +} diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererMeshShape.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererMeshShape.cpp new file mode 100644 index 00000000..94e167bb --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererMeshShape.cpp @@ -0,0 +1,171 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#include <RendererMeshShape.h> + +#include <Renderer.h> + +#include <RendererVertexBuffer.h> +#include <RendererVertexBufferDesc.h> + +#include <RendererIndexBuffer.h> +#include <RendererIndexBufferDesc.h> + +#include <RendererMesh.h> +#include <RendererMeshDesc.h> + +#include <RendererMemoryMacros.h> + +using namespace SampleRenderer; + +RendererMeshShape::RendererMeshShape( Renderer& renderer, + const PxVec3* verts, PxU32 numVerts, + const PxVec3* normals, + const PxReal* uvs, + const PxU16* faces16, const PxU32* faces32, PxU32 numFaces, bool flipWinding) : +RendererShape(renderer) +{ + RENDERER_ASSERT((faces16 || faces32), "Needs either 16bit or 32bit indices."); + RendererVertexBufferDesc vbdesc; + vbdesc.hint = RendererVertexBuffer::HINT_STATIC; + vbdesc.semanticFormats[RendererVertexBuffer::SEMANTIC_POSITION] = RendererVertexBuffer::FORMAT_FLOAT3; + vbdesc.semanticFormats[RendererVertexBuffer::SEMANTIC_NORMAL] = RendererVertexBuffer::FORMAT_FLOAT3; + vbdesc.semanticFormats[RendererVertexBuffer::SEMANTIC_TEXCOORD0] = RendererVertexBuffer::FORMAT_FLOAT2; + vbdesc.maxVertices = numVerts; + m_vertexBuffer = m_renderer.createVertexBuffer(vbdesc); + RENDERER_ASSERT(m_vertexBuffer, "Failed to create Vertex Buffer."); + if(m_vertexBuffer) + { + PxU32 positionStride = 0; + void* vertPositions = m_vertexBuffer->lockSemantic(RendererVertexBuffer::SEMANTIC_POSITION, positionStride); + + PxU32 normalStride = 0; + void* vertNormals = m_vertexBuffer->lockSemantic(RendererVertexBuffer::SEMANTIC_NORMAL, normalStride); + + PxU32 uvStride = 0; + void* vertUVs = m_vertexBuffer->lockSemantic(RendererVertexBuffer::SEMANTIC_TEXCOORD0, uvStride); + + if(vertPositions && vertNormals && vertUVs) + { + for(PxU32 i=0; i<numVerts; i++) + { + memcpy(vertPositions, verts+i, sizeof(PxVec3)); + if(normals) + memcpy(vertNormals, normals+i, sizeof(PxVec3)); + else + memset(vertNormals, 0, sizeof(PxVec3)); + + if(uvs) + memcpy(vertUVs, uvs+i*2, sizeof(PxReal)*2); + else + memset(vertUVs, 0, sizeof(PxReal)*2); + + vertPositions = (void*)(((PxU8*)vertPositions) + positionStride); + vertNormals = (void*)(((PxU8*)vertNormals) + normalStride); + vertUVs = (void*)(((PxU8*)vertUVs) + uvStride); + } + } + m_vertexBuffer->unlockSemantic(RendererVertexBuffer::SEMANTIC_NORMAL); + m_vertexBuffer->unlockSemantic(RendererVertexBuffer::SEMANTIC_POSITION); + m_vertexBuffer->unlockSemantic(RendererVertexBuffer::SEMANTIC_TEXCOORD0); + } + + const PxU32 numIndices = numFaces*3; + + RendererIndexBufferDesc ibdesc; + ibdesc.hint = RendererIndexBuffer::HINT_STATIC; + ibdesc.format = faces16 ? RendererIndexBuffer::FORMAT_UINT16 : RendererIndexBuffer::FORMAT_UINT32; + ibdesc.maxIndices = numIndices; + m_indexBuffer = m_renderer.createIndexBuffer(ibdesc); + RENDERER_ASSERT(m_indexBuffer, "Failed to create Index Buffer."); + if(m_indexBuffer) + { + if(faces16) + { + PxU16* indices = (PxU16*)m_indexBuffer->lock(); + if(indices) + { + if(flipWinding) + { + for(PxU32 i=0;i<numFaces;i++) + { + indices[i*3+0] = faces16[i*3+0]; + indices[i*3+1] = faces16[i*3+2]; + indices[i*3+2] = faces16[i*3+1]; + } + } + else + { + memcpy(indices, faces16, sizeof(*faces16)*numFaces*3); + } + } + } + else + { + PxU32* indices = (PxU32*)m_indexBuffer->lock(); + if(indices) + { + if(flipWinding) + { + for(PxU32 i=0;i<numFaces;i++) + { + indices[i*3+0] = faces32[i*3+0]; + indices[i*3+1] = faces32[i*3+2]; + indices[i*3+2] = faces32[i*3+1]; + } + } + else + { + memcpy(indices, faces32, sizeof(*faces32)*numFaces*3); + } + } + } + m_indexBuffer->unlock(); + } + + if(m_vertexBuffer && m_indexBuffer) + { + RendererMeshDesc meshdesc; + meshdesc.primitives = RendererMesh::PRIMITIVE_TRIANGLES; + meshdesc.vertexBuffers = &m_vertexBuffer; + meshdesc.numVertexBuffers = 1; + meshdesc.firstVertex = 0; + meshdesc.numVertices = numVerts; + meshdesc.indexBuffer = m_indexBuffer; + meshdesc.firstIndex = 0; + meshdesc.numIndices = numIndices; + m_mesh = m_renderer.createMesh(meshdesc); + RENDERER_ASSERT(m_mesh, "Failed to create Mesh."); + } +} + +RendererMeshShape::~RendererMeshShape(void) +{ + SAFE_RELEASE(m_vertexBuffer); + SAFE_RELEASE(m_indexBuffer); + SAFE_RELEASE(m_mesh); +} diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererParticleSystemShape.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererParticleSystemShape.cpp new file mode 100644 index 00000000..06e62043 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererParticleSystemShape.cpp @@ -0,0 +1,643 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. +#include <PsUtilities.h> + +#include <RendererParticleSystemShape.h> + +#include <Renderer.h> + +#include <RendererMemoryMacros.h> +#include <RendererIndexBuffer.h> +#include <RendererIndexBufferDesc.h> +#include <RendererVertexBuffer.h> +#include <RendererVertexBufferDesc.h> +#include <RendererInstanceBuffer.h> +#include <RendererInstanceBufferDesc.h> +#include <RendererMesh.h> +#include <RendererMeshDesc.h> +#include "PsUtilities.h" +#include "PsBitUtils.h" + +using namespace SampleRenderer; +using namespace physx::shdfnd; + +PxReal convexVertices[] = { 0.0f, 1.0f, 0.0f, // 1 up face + 0.5f, 0.0f, 0.5f, + 0.5f, 0.0f, -0.5f, + 0.0f, 1.0f, 0.0f, // 2 up face + 0.5f, 0.0f, -0.5f, + -0.5f, 0.0f, -0.5f, + 0.0f, 1.0f, 0.0f, // 3 up face + -0.5f, 0.0f, -0.5f, + -0.5f, 0.0f, 0.5f, + 0.0f, 1.0f, 0.0f, // 4 up face + -0.5f, 0.0f, 0.5f, + 0.5f, 0.0f, 0.5f, + 0.0f, -1.0f, 0.0f, // 1 down face + 0.5f, 0.0f, 0.5f, + 0.5f, 0.0f, -0.5f, + 0.0f, -1.0f, 0.0f, // 2 down face + 0.5f, 0.0f, -0.5f, + -0.5f, 0.0f, -0.5f, + 0.0f, -1.0f, 0.0f, // 3 down face + -0.5f, 0.0f, -0.5f, + -0.5f, 0.0f, 0.5f, + 0.0f, -1.0f, 0.0f, // 4 down face + -0.5f, 0.0f, 0.5f, + 0.5f, 0.0f, 0.5f }; +PxReal convexTexcoords[] = { 0.0f, 0.0f, // each face + 0.0f, 1.0f, + 1.0f, 0.0f }; +PxReal convexNormals[] = { 1.0f, -0.5f, 0.0f, // 1 up face + 1.0f, -0.5f, 0.0f, + 1.0f, -0.5f, 0.0f, + 0.0f, -0.5f, -1.0f, // 2 up face + 0.0f, -0.5f, -1.0f, + 0.0f, -0.5f, -1.0f, + -1.0f, -0.5f, 0.0f, // 3 up face + -1.0f, -0.5f, 0.0f, + -1.0f, -0.5f, 0.0f, + 0.0f, -0.5f, 1.0f, // 4 up face + 0.0f, -0.5f, 1.0f, + 0.0f, -0.5f, 1.0f, + 1.0f, 0.5f, 0.0f, // 1 down face + 1.0f, 0.5f, 0.0f, + 1.0f, 0.5f, 0.0f, + 0.0f, 0.5f, -1.0f, // 2 down face + 0.0f, 0.5f, -1.0f, + 0.0f, 0.5f, -1.0f, + -1.0f, -0.5f, 0.0f, // 3 down face + -1.0f, -0.5f, 0.0f, + -1.0f, -0.5f, 0.0f, + 0.0f, -0.5f, 1.0f, // 4 down face + 0.0f, -0.5f, 1.0f, + 0.0f, -0.5f, 1.0f }; +PxU32 convexIndices[] = { 0, 1, 2, + 3, 4, 5, + 6, 7, 8, + 9, 10, 11, + 12, 13, 14, + 15, 16, 17, + 18, 19, 20, + 21, 22, 23 }; + +const PxU32 convexVerticesCount = PX_ARRAY_SIZE(convexVertices) / 3 ; +const PxU32 convexIndicesCount = PX_ARRAY_SIZE(convexIndices); +//const PxU32 convexNormalsCount = PX_ARRAY_SIZE(convexNormals) / 3; +//const PxU32 convexTexcoordsCount = PX_ARRAY_SIZE(convexTexcoords) / 2; + +#if defined(RENDERER_ENABLE_CUDA_INTEROP) +#include <task/PxTask.h> +#include <cuda.h> + +// pre-compiled fatbin +#if defined(_M_X64) +#include "cuda/RenderParticles_x64.cuh" +#else +#include "cuda/RenderParticles_x86.cuh" +#endif + +namespace +{ + CUmodule gParticlesCuRenderModule; + CUfunction gParticlesCuUpdateInstanceFunc; + CUfunction gParticlesCuUpdateBillboardFunc; + + void checkSuccess(CUresult r) + { + PX_ASSERT(r == CUDA_SUCCESS); + } +} + +#endif // RENDERER_ENABLE_CUDA_INTEROP + +RendererParticleSystemShape::RendererParticleSystemShape(Renderer &renderer, + PxU32 _mMaxParticles, bool _mInstanced, bool _mFading, + PxReal fadingPeriod, PxReal debriScaleFactor, PxCudaContextManager* ctxMgr) : + RendererShape(renderer), + mInstanced(_mInstanced), + mFading(_mFading), + mFadingPeriod(fadingPeriod), + mMaxParticles(_mMaxParticles), + mInstanceBuffer(NULL), + mIndexBuffer(NULL), + mCtxMgr(ctxMgr) +{ + for(PxU32 i = 0; i < NUM_VERTEX_BUFFERS; i++ ) + { + mVertexBuffer[i] = NULL; + } + RendererVertexBufferDesc vbdesc; + +#if defined(RENDERER_ENABLE_CUDA_INTEROP) + if (ctxMgr) + { + vbdesc.registerInCUDA = true; + vbdesc.interopContext = ctxMgr; + + ctxMgr->acquireContext(); + + // find module containing our kernel + CUresult success; + + success = cuModuleLoadDataEx(&gParticlesCuRenderModule, updateParticleVertexBuffer, 0, NULL, NULL); + RENDERER_ASSERT(success == CUDA_SUCCESS, "Could not load cloth render CUDA module."); + + success = cuModuleGetFunction(&gParticlesCuUpdateInstanceFunc, gParticlesCuRenderModule, "updateInstancedVB"); + RENDERER_ASSERT(success == CUDA_SUCCESS, "Could not find cloth render CUDA function."); + + success = cuModuleGetFunction(&gParticlesCuUpdateBillboardFunc, gParticlesCuRenderModule, "updateBillboardVB"); + RENDERER_ASSERT(success == CUDA_SUCCESS, "Could not find cloth render CUDA function."); + + ctxMgr->releaseContext(); + } +#endif //RENDERER_ENABLE_CUDA_INTEROP + + if(mInstanced) + { + vbdesc.hint = RendererVertexBuffer::HINT_STATIC; + vbdesc.maxVertices = convexVerticesCount; + } + else + { +#if defined(RENDERER_TABLET) + vbdesc.hint = RendererVertexBuffer::HINT_STATIC; +#else + vbdesc.hint = RendererVertexBuffer::HINT_DYNAMIC; +#endif + vbdesc.maxVertices = mMaxParticles; + } + { + RendererVertexBufferDesc vbdesc_l = vbdesc; + vbdesc_l.semanticFormats[RendererVertexBuffer::SEMANTIC_POSITION] = RendererVertexBuffer::FORMAT_FLOAT3; + mVertexBuffer[DYNAMIC_POS_VB] = m_renderer.createVertexBuffer(vbdesc_l); + RENDERER_ASSERT(mVertexBuffer[DYNAMIC_POS_VB], "Failed to create Vertex Buffer."); + } + { + RendererVertexBufferDesc vbdesc_l = vbdesc; + vbdesc_l.semanticFormats[RendererVertexBuffer::SEMANTIC_COLOR] = RendererVertexBuffer::FORMAT_COLOR_NATIVE; + mVertexBuffer[DYNAMIC_COL_VB] = m_renderer.createVertexBuffer(vbdesc_l); + RENDERER_ASSERT(mVertexBuffer[DYNAMIC_COL_VB], "Failed to create Vertex Buffer."); + } + vbdesc.hint = RendererVertexBuffer::HINT_STATIC; + vbdesc.semanticFormats[RendererVertexBuffer::SEMANTIC_NORMAL] = RendererVertexBuffer::FORMAT_FLOAT3; + vbdesc.semanticFormats[RendererVertexBuffer::SEMANTIC_TEXCOORD0] = RendererVertexBuffer::FORMAT_FLOAT2; + mVertexBuffer[STATIC_VB] = m_renderer.createVertexBuffer(vbdesc); + RENDERER_ASSERT(mVertexBuffer[STATIC_VB], "Failed to create Vertex Buffer."); + // if enabled mInstanced meshes -> create instance buffer + if(mInstanced) + { + // create index buffer + RendererIndexBufferDesc inbdesc; + inbdesc.hint = RendererIndexBuffer::HINT_STATIC; + inbdesc.format = RendererIndexBuffer::FORMAT_UINT32; + inbdesc.maxIndices = convexIndicesCount; + mIndexBuffer = m_renderer.createIndexBuffer(inbdesc); + RENDERER_ASSERT(mIndexBuffer, "Failed to create Instance Buffer."); + // create instance buffer + RendererInstanceBufferDesc ibdesc; + ibdesc.hint = RendererInstanceBuffer::HINT_DYNAMIC; + ibdesc.semanticFormats[RendererInstanceBuffer::SEMANTIC_POSITION] = RendererInstanceBuffer::FORMAT_FLOAT3; + ibdesc.semanticFormats[RendererInstanceBuffer::SEMANTIC_NORMALX] = RendererInstanceBuffer::FORMAT_FLOAT3; + ibdesc.semanticFormats[RendererInstanceBuffer::SEMANTIC_NORMALY] = RendererInstanceBuffer::FORMAT_FLOAT3; + ibdesc.semanticFormats[RendererInstanceBuffer::SEMANTIC_NORMALZ] = RendererInstanceBuffer::FORMAT_FLOAT3; + ibdesc.semanticFormats[RendererInstanceBuffer::SEMANTIC_VELOCITY_LIFE] = RendererInstanceBuffer::FORMAT_FLOAT4; + ibdesc.maxInstances = mMaxParticles; + + if (ctxMgr) + { + ibdesc.registerInCUDA = true; + ibdesc.interopContext = ctxMgr; + } + + mInstanceBuffer = m_renderer.createInstanceBuffer(ibdesc); + RENDERER_ASSERT(mInstanceBuffer, "Failed to create Instance Buffer."); + } + PxU32 color = renderer.convertColor(RendererColor(255, 255, 255, 255)); + PxU32 numInstances = 0; + RendererMesh::Primitive primitive = RendererMesh::PRIMITIVE_POINT_SPRITES; + if(mInstanced) + { + numInstances = mMaxParticles; + initializeBuffersAsSimpleConvex(color, debriScaleFactor); + initializeInstanceBuffer(); + primitive = RendererMesh::PRIMITIVE_TRIANGLES; + } + else + { + initializeVertexBuffer(color); + } + if(mVertexBuffer[DYNAMIC_POS_VB] && mVertexBuffer[DYNAMIC_COL_VB] && mVertexBuffer[STATIC_VB]) + { + RendererMeshDesc meshdesc; + meshdesc.primitives = primitive; + meshdesc.vertexBuffers = mVertexBuffer; + meshdesc.numVertexBuffers = NUM_VERTEX_BUFFERS; + meshdesc.firstVertex = 0; + meshdesc.numVertices = mVertexBuffer[STATIC_VB]->getMaxVertices(); + meshdesc.indexBuffer = mIndexBuffer; + meshdesc.firstIndex = 0; + if(mIndexBuffer) + { + meshdesc.numIndices = mIndexBuffer->getMaxIndices(); + } + else + { + meshdesc.numIndices = 0; + } + meshdesc.instanceBuffer = mInstanceBuffer; + meshdesc.firstInstance = 0; + meshdesc.numInstances = numInstances; + m_mesh = m_renderer.createMesh(meshdesc); + RENDERER_ASSERT(m_mesh, "Failed to create Mesh."); + } +} + +RendererParticleSystemShape::~RendererParticleSystemShape(void) +{ + SAFE_RELEASE(mInstanceBuffer); + SAFE_RELEASE(mIndexBuffer); + for(PxU32 i = 0; i < NUM_VERTEX_BUFFERS; i++ ) + { + SAFE_RELEASE(mVertexBuffer[i]); + } + SAFE_RELEASE(m_mesh); +} + +void RendererParticleSystemShape::initializeBuffersAsSimpleConvex(PxU32 color, PxReal scaleFactor) +{ + // initialize vertex buffer + PxU32 positionStride = 0, colorStride = 0, texcoordStride = 0, normalStride = 0; + PxU8* locked_normals = static_cast<PxU8*>(mVertexBuffer[STATIC_VB]->lockSemantic(RendererVertexBuffer::SEMANTIC_NORMAL, normalStride)); + PxU8* locked_texcoords = static_cast<PxU8*>(mVertexBuffer[STATIC_VB]->lockSemantic(RendererVertexBuffer::SEMANTIC_TEXCOORD0, texcoordStride)); + PxU8* locked_positions = static_cast<PxU8*>(mVertexBuffer[DYNAMIC_POS_VB]->lockSemantic(RendererVertexBuffer::SEMANTIC_POSITION, positionStride)); + PxU8* locked_colors = static_cast<PxU8*>(mVertexBuffer[DYNAMIC_COL_VB]->lockSemantic(RendererVertexBuffer::SEMANTIC_COLOR, colorStride)); + PxU32 maxVertices = mVertexBuffer[STATIC_VB]->getMaxVertices(); + for(PxU32 i = 0; i < maxVertices; ++i, + locked_positions += positionStride, + locked_colors += colorStride, + locked_texcoords += texcoordStride, + locked_normals += normalStride) + { + PxReal localConvexVertices[] = { convexVertices[3 * i + 0] * scaleFactor, + convexVertices[3 * i + 1] * scaleFactor, + convexVertices[3 * i + 2] * scaleFactor }; + PxReal localConvexNormals[] = { convexNormals[3 * i + 0] / 2.25f, + convexNormals[3 * i + 1] / 2.25f, + convexNormals[3 * i + 2] / 2.25f }; + memcpy(locked_positions, localConvexVertices, sizeof(PxReal) * 3); + memcpy(locked_normals, localConvexNormals, sizeof(PxReal) * 3); + memcpy(locked_texcoords, convexTexcoords + 2 * (i % 3), sizeof(PxReal) * 2); + memset(locked_colors, color, sizeof(PxU32)); + } + mVertexBuffer[STATIC_VB]->unlockSemantic(RendererVertexBuffer::SEMANTIC_TEXCOORD0); + mVertexBuffer[STATIC_VB]->unlockSemantic(RendererVertexBuffer::SEMANTIC_NORMAL); + mVertexBuffer[DYNAMIC_COL_VB]->unlockSemantic(RendererVertexBuffer::SEMANTIC_COLOR); + mVertexBuffer[DYNAMIC_POS_VB]->unlockSemantic(RendererVertexBuffer::SEMANTIC_POSITION); + // initialize index buffer + PxU32* locked_indices = static_cast<PxU32*>(mIndexBuffer->lock()); + memcpy(locked_indices, convexIndices, mIndexBuffer->getMaxIndices() * sizeof(PxU32)); + mIndexBuffer->unlock(); +} + +void RendererParticleSystemShape::initializeVertexBuffer(PxU32 color) +{ + PxU32 positionStride = 0, colorStride = 0; + PxU8* locked_positions = static_cast<PxU8*>(mVertexBuffer[DYNAMIC_POS_VB]->lockSemantic(RendererVertexBuffer::SEMANTIC_POSITION, positionStride)); + PxU8* locked_colors = static_cast<PxU8*>(mVertexBuffer[DYNAMIC_COL_VB]->lockSemantic(RendererVertexBuffer::SEMANTIC_COLOR, colorStride)); + for(PxU32 i = 0; i < mMaxParticles; ++i, + locked_positions += positionStride, + locked_colors += colorStride) + { + memset(locked_positions, 0, sizeof(PxReal) * 3); + memset(locked_colors, color, sizeof(PxU32)); + } + mVertexBuffer[DYNAMIC_COL_VB]->unlockSemantic(RendererVertexBuffer::SEMANTIC_COLOR); + mVertexBuffer[DYNAMIC_POS_VB]->unlockSemantic(RendererVertexBuffer::SEMANTIC_POSITION); +} + +void RendererParticleSystemShape::initializeInstanceBuffer() +{ + PxU32 positionStride = 0, + normalXStride = 0, + normalYStride = 0, + normalZStride = 0, + velocityLifeStride = 0; + PxU8* locked_positions = static_cast<PxU8*>(mInstanceBuffer->lockSemantic( + RendererInstanceBuffer::SEMANTIC_POSITION, positionStride)); + PxU8* locked_normalsx = static_cast<PxU8*>(mInstanceBuffer->lockSemantic( + RendererInstanceBuffer::SEMANTIC_NORMALX, normalXStride)); + PxU8* locked_normalsy = static_cast<PxU8*>(mInstanceBuffer->lockSemantic( + RendererInstanceBuffer::SEMANTIC_NORMALY, normalYStride)); + PxU8* locked_normalsz = static_cast<PxU8*>(mInstanceBuffer->lockSemantic( + RendererInstanceBuffer::SEMANTIC_NORMALZ, normalZStride)); + PxU8* locked_velocitylife = static_cast<PxU8*>(mInstanceBuffer->lockSemantic( + RendererInstanceBuffer::SEMANTIC_VELOCITY_LIFE, velocityLifeStride)); + // fill buffer here + PxReal normalx[] = { 1.0f, 0.0f, 0.0f }; + PxReal normaly[] = { 0.0f, 1.0f, 0.0f }; + PxReal normalz[] = { 0.0f, 0.0f, 1.0f }; + for(PxU32 i = 0; i < mMaxParticles; ++i, + locked_positions += positionStride, + locked_normalsx += normalXStride, + locked_normalsy += normalYStride, + locked_normalsz += normalZStride, + locked_velocitylife += velocityLifeStride) + { + memset(locked_positions, 0, sizeof(PxReal) * 3); + memcpy(locked_normalsx, normalx, sizeof(physx::PxVec3)); + memcpy(locked_normalsy, normaly, sizeof(physx::PxVec3)); + memcpy(locked_normalsz, normalz, sizeof(physx::PxVec3)); + memset(locked_velocitylife, 0, sizeof(PxReal) * 4); + } + mInstanceBuffer->unlockSemantic(RendererInstanceBuffer::SEMANTIC_VELOCITY_LIFE); + mInstanceBuffer->unlockSemantic(RendererInstanceBuffer::SEMANTIC_NORMALZ); + mInstanceBuffer->unlockSemantic(RendererInstanceBuffer::SEMANTIC_NORMALY); + mInstanceBuffer->unlockSemantic(RendererInstanceBuffer::SEMANTIC_NORMALX); + mInstanceBuffer->unlockSemantic(RendererInstanceBuffer::SEMANTIC_POSITION); +} + +namespace +{ + +#if defined(RENDERER_ENABLE_CUDA_INTEROP) + + void cuuAlignUp(int* offset, int alignment) + { + *offset = ((*offset) + (alignment) - 1) & ~((alignment) - 1); + } + + template <typename T, typename T2> CUresult + cuuParamSet(CUfunction hf, int* offset, const T2& var) + { + cuuAlignUp(offset, __alignof(T)); + CUresult err = cuParamSetv(hf, *offset, (void*)&var, sizeof(T)); + *offset += sizeof(T); + return err; + } + +#endif // RENDERER_ENABLE_CUDA_INTEROP + +} // anonymous namespace + + +bool RendererParticleSystemShape::updateInstanced(PxU32 validParticleRange, + CUdeviceptr positions, + CUdeviceptr validParticleBitmap, + CUdeviceptr orientations, + PxU32 numParticles) +{ +#if defined(RENDERER_ENABLE_CUDA_INTEROP) + + CUgraphicsResource res; + if (mInstanceBuffer->getInteropResourceHandle(res)) + { + mCtxMgr->acquireContext(); + + checkSuccess(cuGraphicsMapResources(1, &res, 0)); + + CUdeviceptr destBuffer; + size_t destSize; + cuGraphicsResourceGetMappedPointer(&destBuffer, &destSize, res); + + // if either buffers could not be mapped abort + if (!destBuffer) + { + mCtxMgr->releaseContext(); + return false; + } + + int offset = 0; + checkSuccess(cuuParamSet<CUdeviceptr>(gParticlesCuUpdateInstanceFunc, &offset, destBuffer + mInstanceBuffer->getOffsetForSemantic(RendererInstanceBuffer::SEMANTIC_POSITION))); + checkSuccess(cuuParamSet<CUdeviceptr>(gParticlesCuUpdateInstanceFunc, &offset, destBuffer + mInstanceBuffer->getOffsetForSemantic(RendererInstanceBuffer::SEMANTIC_NORMALX))); + checkSuccess(cuuParamSet<CUdeviceptr>(gParticlesCuUpdateInstanceFunc, &offset, destBuffer + mInstanceBuffer->getOffsetForSemantic(RendererInstanceBuffer::SEMANTIC_NORMALY))); + checkSuccess(cuuParamSet<CUdeviceptr>(gParticlesCuUpdateInstanceFunc, &offset, destBuffer + mInstanceBuffer->getOffsetForSemantic(RendererInstanceBuffer::SEMANTIC_NORMALZ))); + checkSuccess(cuuParamSet<PxU32>(gParticlesCuUpdateInstanceFunc, &offset, mInstanceBuffer->getStride())); + checkSuccess(cuuParamSet<CUdeviceptr>(gParticlesCuUpdateInstanceFunc, &offset, positions)); + checkSuccess(cuuParamSet<CUdeviceptr>(gParticlesCuUpdateInstanceFunc, &offset, orientations)); + checkSuccess(cuuParamSet<CUdeviceptr>(gParticlesCuUpdateInstanceFunc, &offset, validParticleBitmap)); + checkSuccess(cuuParamSet<PxU32>(gParticlesCuUpdateInstanceFunc, &offset, validParticleRange)); + checkSuccess(cuParamSetSize(gParticlesCuUpdateInstanceFunc, offset)); + + const PxU32 blockSize = 512; + const PxU32 numBlocks = 1; + + checkSuccess(cuFuncSetBlockShape(gParticlesCuUpdateInstanceFunc, blockSize, 1, 1)); + checkSuccess(cuLaunchGridAsync(gParticlesCuUpdateInstanceFunc, numBlocks, 1, 0)); + + checkSuccess(cuGraphicsUnmapResources(1, &res, 0)); + + mCtxMgr->releaseContext(); + } + + m_mesh->setInstanceBufferRange(0, numParticles); + +#endif // RENDERER_ENABLE_CUDA_INTEROP + + return true; + +} + +bool RendererParticleSystemShape::updateBillboard(PxU32 validParticleRange, + CUdeviceptr positions, + CUdeviceptr validParticleBitmap, + CUdeviceptr lifetimes, + PxU32 numParticles) +{ + +#if defined(RENDERER_ENABLE_CUDA_INTEROP) + + CUgraphicsResource res[2]; + mVertexBuffer[DYNAMIC_POS_VB]->getInteropResourceHandle(res[0]); + mVertexBuffer[DYNAMIC_COL_VB]->getInteropResourceHandle(res[1]); + + if (res[0] && res[1]) + { + mCtxMgr->acquireContext(); + + checkSuccess(cuGraphicsMapResources(2, res, 0)); + + CUdeviceptr posBuffer, colBuffer; + size_t destSize; + checkSuccess(cuGraphicsResourceGetMappedPointer(&posBuffer, &destSize, res[0])); + checkSuccess(cuGraphicsResourceGetMappedPointer(&colBuffer, &destSize, res[1])); + + // if either buffers could not be mapped abort + if (!posBuffer || !colBuffer) + { + mCtxMgr->releaseContext(); + return false; + } + + int offset = 0; + checkSuccess(cuuParamSet<CUdeviceptr>(gParticlesCuUpdateBillboardFunc, &offset, posBuffer)); + checkSuccess(cuuParamSet<CUdeviceptr>(gParticlesCuUpdateBillboardFunc, &offset, colBuffer+3)); + checkSuccess(cuuParamSet<PxU32>(gParticlesCuUpdateBillboardFunc, &offset, mVertexBuffer[DYNAMIC_POS_VB]->getStride())); + checkSuccess(cuuParamSet<PxF32>(gParticlesCuUpdateBillboardFunc, &offset, mFadingPeriod)); + checkSuccess(cuuParamSet<CUdeviceptr>(gParticlesCuUpdateBillboardFunc, &offset, positions)); + checkSuccess(cuuParamSet<CUdeviceptr>(gParticlesCuUpdateBillboardFunc, &offset, lifetimes)); + checkSuccess(cuuParamSet<CUdeviceptr>(gParticlesCuUpdateBillboardFunc, &offset, validParticleBitmap)); + checkSuccess(cuuParamSet<PxU32>(gParticlesCuUpdateBillboardFunc, &offset, validParticleRange)); + checkSuccess(cuParamSetSize(gParticlesCuUpdateBillboardFunc, offset)); + + const PxU32 blockSize = 512; + const PxU32 numBlocks = 1; + + checkSuccess(cuFuncSetBlockShape(gParticlesCuUpdateBillboardFunc, blockSize, 1, 1)); + checkSuccess(cuLaunchGridAsync(gParticlesCuUpdateBillboardFunc, numBlocks, 1, 0)); + + checkSuccess(cuGraphicsUnmapResources(2, res, 0)); + + mCtxMgr->releaseContext(); + } + + m_mesh->setVertexBufferRange(0, numParticles); + +#endif // RENDERER_ENABLE_CUDA_INTEROP + + return true; + +} + + +void RendererParticleSystemShape::updateInstanced(PxU32 validParticleRange, + const PxVec3* positions, + const PxU32* validParticleBitmap, + const PxMat33* orientation) +{ + PxU32 positionStride = 0, + normalXStride = 0, + normalYStride = 0, + normalZStride = 0; + PxU8 *locked_positions = NULL, + *locked_normalsx = NULL, + *locked_normalsy = NULL, + *locked_normalsz = NULL; + locked_positions = static_cast<PxU8*>(mInstanceBuffer->lockSemantic( + RendererInstanceBuffer::SEMANTIC_POSITION, positionStride)); + locked_normalsx = static_cast<PxU8*>(mInstanceBuffer->lockSemantic( + RendererInstanceBuffer::SEMANTIC_NORMALX, normalXStride)); + locked_normalsy = static_cast<PxU8*>(mInstanceBuffer->lockSemantic( + RendererInstanceBuffer::SEMANTIC_NORMALY, normalYStride)); + locked_normalsz = static_cast<PxU8*>(mInstanceBuffer->lockSemantic( + RendererInstanceBuffer::SEMANTIC_NORMALZ, normalZStride)); + + // update vertex or instance buffer here + PxU32 numParticles = 0; + if(validParticleRange > 0) + { + for (PxU32 w = 0; w <= (validParticleRange-1) >> 5; w++) + { + for (PxU32 b = validParticleBitmap[w]; b; b &= b-1) + { + PxU32 index = (w << 5 | physx::shdfnd::lowestSetBit(b)); + + memcpy(locked_normalsx, &(orientation[index].column0), sizeof(PxVec3)); + memcpy(locked_normalsy, &(orientation[index].column1), sizeof(PxVec3)); + memcpy(locked_normalsz, &(orientation[index].column2), sizeof(PxVec3)); + memcpy(locked_positions, positions + index, sizeof(PxVec3)); + + locked_positions += positionStride; + locked_normalsx += normalXStride; + locked_normalsy += normalYStride; + locked_normalsz += normalZStride; + numParticles++; + } + } + } + + mInstanceBuffer->unlockSemantic(RendererInstanceBuffer::SEMANTIC_NORMALZ); + mInstanceBuffer->unlockSemantic(RendererInstanceBuffer::SEMANTIC_NORMALY); + mInstanceBuffer->unlockSemantic(RendererInstanceBuffer::SEMANTIC_NORMALX); + mInstanceBuffer->unlockSemantic(RendererInstanceBuffer::SEMANTIC_POSITION); + m_mesh->setInstanceBufferRange(0, numParticles); +} + +void RendererParticleSystemShape::updateBillboard(PxU32 validParticleRange, + const PxVec3* positions, + const PxU32* validParticleBitmap, + const PxReal* lifetime) +{ + PxU32 positionStride = 0, colorStride = 0; + PxU8 *locked_positions = NULL, *locked_colors = NULL; + locked_positions = static_cast<PxU8*>(mVertexBuffer[DYNAMIC_POS_VB]->lockSemantic( + RendererVertexBuffer::SEMANTIC_POSITION, positionStride)); + if(mFading && lifetime) + { + locked_colors = static_cast<PxU8*>(mVertexBuffer[DYNAMIC_COL_VB]->lockSemantic( + RendererVertexBuffer::SEMANTIC_COLOR, colorStride)); + // move ptr to alpha +#if !defined(RENDERER_XBOX360) + locked_colors += 3 * sizeof(PxU8); +#endif + } + // update vertex or instance buffer here + PxU32 numParticles = 0; + if(validParticleRange > 0) + { + for (PxU32 w = 0; w <= (validParticleRange-1) >> 5; w++) + { + for (PxU32 b = validParticleBitmap[w]; b; b &= b-1) + { + PxU32 index = (w << 5 | physx::shdfnd::lowestSetBit(b)); + *reinterpret_cast<PxVec3*>(locked_positions) = positions[index]; + locked_positions += positionStride; + if(mFading && lifetime) + { + PxU8 particle_lifetime = 0; + if(lifetime[index] >= mFadingPeriod) + { + particle_lifetime = 255; + } + else + { + if(lifetime[index] <= 0.0f) + { + particle_lifetime = 0; + } + else + { + particle_lifetime = static_cast<PxU8>(lifetime[index] * 255 / mFadingPeriod); + } + } + locked_colors[0] = particle_lifetime; + locked_colors += colorStride; + } + numParticles++; + } + } + } + + if(mFading && lifetime) + { + mVertexBuffer[DYNAMIC_COL_VB]->unlockSemantic(RendererVertexBuffer::SEMANTIC_COLOR); + } + mVertexBuffer[DYNAMIC_POS_VB]->unlockSemantic(RendererVertexBuffer::SEMANTIC_POSITION); + m_mesh->setVertexBufferRange(0, numParticles); +} diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererProjection.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererProjection.cpp new file mode 100644 index 00000000..14a36df6 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererProjection.cpp @@ -0,0 +1,232 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#include <RendererProjection.h> +#include <math.h> + +using namespace SampleRenderer; + +RendererProjection::RendererProjection(float fov, float aspectRatio, float nearPlane, float farPlane) +{ + RENDERER_ASSERT(farPlane > nearPlane, "Cannot construct a Projection Matrix whose nearPlane is further than the farPlane."); + memset(m_matrix, 0, sizeof(m_matrix)); + + float fd = 1/tanf(fov/2); + m_matrix[0] = fd; + m_matrix[5] = fd*aspectRatio; + m_matrix[10] = (farPlane + nearPlane)/(nearPlane - farPlane); + m_matrix[11] = -1; + m_matrix[14] = (2 * farPlane * nearPlane)/(nearPlane - farPlane); +} + +RendererProjection::RendererProjection(float left, float right, float bottom, float top, float nearPlane, float farPlane) +{ + memset(m_matrix, 0, sizeof(m_matrix)); + m_matrix[0] = 2/(right - left); + m_matrix[5] = 2/(top - bottom); + m_matrix[10] = -2/(farPlane - nearPlane); + m_matrix[12] = - (right + left) / (right - left); + m_matrix[13] = - (top + bottom) / (top - bottom); + m_matrix[14] = - (farPlane + nearPlane) / (farPlane - nearPlane); + m_matrix[15] = 1; +} + +RendererProjection::RendererProjection(const PxMat44 mat) +{ + getPxMat44() = mat; +} + +void RendererProjection::getColumnMajor44(float *f) const +{ + if(f) memcpy(f, m_matrix, sizeof(m_matrix)); +} + +void RendererProjection::getRowMajor44(float *f) const +{ + getColumnMajor44(f); + for (int i = 0; i < 4; i++) { + for (int j = i + 1; j < 4; j++) { + float save = f[4 * i + j]; + f[4 * i + j] = f[4 * j + i]; + f[4 * j + i] = save; + } + } +} + +class vec4 +{ +public: + vec4(void) {} + + vec4(const PxVec3& v3) + { + x=v3.x; + y=v3.y; + z=v3.z; + w=1.0f; + } + + vec4(PxF32 _x, PxF32 _y, PxF32 _z, PxF32 _w) + { + x=_x; + y=_y; + z=_z; + w=_w; + } + + vec4 operator*=(PxF32 f) + { + x*=f; + y*=f; + z*=f; + w*=f; + return *this; + } + +public: + PxF32 x, y, z, w; +}; + +class mat4x4 +{ +public: + mat4x4(void){} + + mat4x4(const physx::PxTransform &m) + { + PxMat44 mat44(m); + memcpy(&x.x, mat44.front(), 4 * 4 * sizeof (PxReal)); + } + + mat4x4(const RendererProjection &m) + { + m.getColumnMajor44(&x.x); + } + +public: + vec4 x; + vec4 y; + vec4 z; + vec4 w; +}; + +mat4x4 invert(const mat4x4 &m) +{ + mat4x4 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.x.x = det3x3(m.y.y, m.y.z, m.y.w, m.z.y, m.z.z, m.z.w, m.w.y, m.w.z, m.w.w); + inv.x.y = -det3x3(m.x.y, m.x.z, m.x.w, m.z.y, m.z.z, m.z.w, m.w.y, m.w.z, m.w.w); + inv.x.z = det3x3(m.x.y, m.x.z, m.x.w, m.y.y, m.y.z, m.y.w, m.w.y, m.w.z, m.w.w); + inv.x.w = -det3x3(m.x.y, m.x.z, m.x.w, m.y.y, m.y.z, m.y.w, m.z.y, m.z.z, m.z.w); + + inv.y.x = -det3x3(m.y.x, m.y.z, m.y.w, m.z.x, m.z.z, m.z.w, m.w.x, m.w.z, m.w.w); + inv.y.y = det3x3(m.x.x, m.x.z, m.x.w, m.z.x, m.z.z, m.z.w, m.w.x, m.w.z, m.w.w); + inv.y.z = -det3x3(m.x.x, m.x.z, m.x.w, m.y.x, m.y.z, m.y.w, m.w.x, m.w.z, m.w.w); + inv.y.w = det3x3(m.x.x, m.x.z, m.x.w, m.y.x, m.y.z, m.y.w, m.z.x, m.z.z, m.z.w); + + inv.z.x = det3x3(m.y.x, m.y.y, m.y.w, m.z.x, m.z.y, m.z.w, m.w.x, m.w.y, m.w.w); + inv.z.y = -det3x3(m.x.x, m.x.y, m.x.w, m.z.x, m.z.y, m.z.w, m.w.x, m.w.y, m.w.w); + inv.z.z = det3x3(m.x.x, m.x.y, m.x.w, m.y.x, m.y.y, m.y.w, m.w.x, m.w.y, m.w.w); + inv.z.w = -det3x3(m.x.x, m.x.y, m.x.w, m.y.x, m.y.y, m.y.w, m.z.x, m.z.y, m.z.w); + + inv.w.x = -det3x3(m.y.x, m.y.y, m.y.z, m.z.x, m.z.y, m.z.z, m.w.x, m.w.y, m.w.z); + inv.w.y = det3x3(m.x.x, m.x.y, m.x.z, m.z.x, m.z.y, m.z.z, m.w.x, m.w.y, m.w.z); + inv.w.z = -det3x3(m.x.x, m.x.y, m.x.z, m.y.x, m.y.y, m.y.z, m.w.x, m.w.y, m.w.z); + inv.w.w = det3x3(m.x.x, m.x.y, m.x.z, m.y.x, m.y.y, m.y.z, m.z.x, m.z.y, m.z.z); + +#undef det3x3 + + PxF32 det = m.x.x*inv.x.x + m.y.x*inv.x.y + m.z.x*inv.x.z + m.w.x*inv.x.w; + RENDERER_ASSERT(det, "Matrix inversion failed!"); + if(!det) det = 1; + PxF32 invDet = 1 / det; + + inv.x *= invDet; + inv.y *= invDet; + inv.z *= invDet; + inv.w *= invDet; + + return inv; +} + +mat4x4 operator*(const mat4x4 &a, const mat4x4 &b) +{ + mat4x4 t; +#define VECMUL(_r, _c) \ +t._c ._r = a._c.x * b.x._r + \ +a._c.y * b.y._r + \ +a._c.z * b.z._r + \ +a._c.w * b.w._r; + VECMUL(x,x); VECMUL(x,y); VECMUL(x,z); VECMUL(x,w); + VECMUL(y,x); VECMUL(y,y); VECMUL(y,z); VECMUL(y,w); + VECMUL(z,x); VECMUL(z,y); VECMUL(z,z); VECMUL(z,w); + VECMUL(w,x); VECMUL(w,y); VECMUL(w,z); VECMUL(w,w); +#undef VECMUL + return t; +} + +vec4 operator*(const mat4x4 &a, const vec4 &b) +{ + vec4 v; + v.x = a.x.x * b.x + a.y.x * b.y + a.z.x * b.z + a.w.x; + v.y = a.x.y * b.x + a.y.y * b.y + a.z.y * b.z + a.w.y; + v.z = a.x.z * b.x + a.y.z * b.y + a.z.z * b.z + a.w.z; + v.w = a.x.w * b.x + a.y.w * b.y + a.z.w * b.z + a.w.w; + return v; +} + +void SampleRenderer::buildProjectMatrix(float *dst, const RendererProjection &proj, const physx::PxTransform &view) +{ + mat4x4 projview = invert(mat4x4(view)) * mat4x4(proj); + memcpy(dst, &projview.x.x, sizeof(float)*16); +} + +void SampleRenderer::buildUnprojectMatrix(float *dst, const RendererProjection &proj, const physx::PxTransform &view) +{ + mat4x4 invprojview = invert(mat4x4(view) * mat4x4(proj)); + memcpy(dst, &invprojview.x.x, sizeof(float)*16); +} + +PxVec3 SampleRenderer::unproject(const RendererProjection &proj, const physx::PxTransform &view, PxF32 x, PxF32 y, PxF32 z) +{ + vec4 screenPoint(x, y, z, 1); + mat4x4 invprojview = invert(mat4x4(view) * mat4x4(proj)); + vec4 nearPoint = invprojview * screenPoint; + RENDERER_ASSERT(nearPoint.w, "Unproject failed!"); + if(nearPoint.w) nearPoint *= 1.0f / nearPoint.w; + return PxVec3(nearPoint.x, nearPoint.y, nearPoint.z); +} + +PxVec3 SampleRenderer::project( const RendererProjection &proj, const physx::PxTransform &view, const PxVec3& pos) +{ + mat4x4 projView = mat4x4(view) * mat4x4(proj); + vec4 screenPoint = projView * vec4(pos); + float rw = 1.0f / screenPoint.w; + return PxVec3( screenPoint.x, -screenPoint.y, screenPoint.z ) * rw; +} diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererShape.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererShape.cpp new file mode 100644 index 00000000..2061f366 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererShape.cpp @@ -0,0 +1,49 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +// +// RendererShape : base class for convenience classes for generating meshes based on shapes. +// +#include <RendererShape.h> + +using namespace SampleRenderer; + +RendererShape::RendererShape(Renderer& renderer) : + m_renderer (renderer), + m_mesh (NULL), + m_userData (NULL) +{ +} + +RendererShape::~RendererShape(void) +{ + RENDERER_ASSERT(m_mesh==0, "Mesh was not properly released before Shape destruction."); +} + +RendererMesh* RendererShape::getMesh(void) +{ + return m_mesh; +} diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererSimpleParticleSystemShape.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererSimpleParticleSystemShape.cpp new file mode 100644 index 00000000..7520893d --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererSimpleParticleSystemShape.cpp @@ -0,0 +1,206 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. +#include <PsUtilities.h> + +#include <RendererSimpleParticleSystemShape.h> + +#include <Renderer.h> + +#include <RendererMemoryMacros.h> +#include <RendererIndexBuffer.h> +#include <RendererIndexBufferDesc.h> +#include <RendererVertexBuffer.h> +#include <RendererVertexBufferDesc.h> +#include <RendererMesh.h> +#include <RendererMeshDesc.h> +#include "PsUtilities.h" +#include "PsBitUtils.h" + +using namespace SampleRenderer; +using namespace physx::shdfnd; + +RendererSimpleParticleSystemShape::RendererSimpleParticleSystemShape(Renderer &renderer, + PxU32 _mMaxParticles) : + RendererShape(renderer), + mMaxParticles(_mMaxParticles), + mVertexBuffer(NULL), + mIndexBuffer(NULL) +{ + RendererVertexBufferDesc vbdesc; + + vbdesc.maxVertices = mMaxParticles*4; + vbdesc.hint = RendererVertexBuffer::HINT_DYNAMIC; + vbdesc.semanticFormats[RendererVertexBuffer::SEMANTIC_POSITION] = RendererVertexBuffer::FORMAT_FLOAT3; + vbdesc.semanticFormats[RendererVertexBuffer::SEMANTIC_COLOR] = RendererVertexBuffer::FORMAT_COLOR_NATIVE; + vbdesc.semanticFormats[RendererVertexBuffer::SEMANTIC_TEXCOORD0] = RendererVertexBuffer::FORMAT_FLOAT2; + mVertexBuffer = m_renderer.createVertexBuffer(vbdesc); + RENDERER_ASSERT(mVertexBuffer, "Failed to create Vertex Buffer."); + // if enabled mInstanced meshes -> create instance buffer + PxU32 color = renderer.convertColor(RendererColor(255, 255, 255, 255)); + RendererMesh::Primitive primitive = RendererMesh::PRIMITIVE_TRIANGLES; + initializeVertexBuffer(color); + + if(mVertexBuffer) + { + RendererMeshDesc meshdesc; + meshdesc.primitives = primitive; + meshdesc.vertexBuffers = &mVertexBuffer; + meshdesc.numVertexBuffers = 1; + meshdesc.firstVertex = 0; + meshdesc.numVertices = mVertexBuffer->getMaxVertices(); + meshdesc.indexBuffer = mIndexBuffer; + meshdesc.firstIndex = 0; + if(mIndexBuffer) + { + meshdesc.numIndices = mIndexBuffer->getMaxIndices(); + } + else + { + meshdesc.numIndices = 0; + } + meshdesc.instanceBuffer = NULL; + meshdesc.firstInstance = 0; + meshdesc.numInstances = 0; + m_mesh = m_renderer.createMesh(meshdesc); + RENDERER_ASSERT(m_mesh, "Failed to create Mesh."); + } +} + +RendererSimpleParticleSystemShape::~RendererSimpleParticleSystemShape(void) +{ + SAFE_RELEASE(mIndexBuffer); + SAFE_RELEASE(mVertexBuffer); + SAFE_RELEASE(m_mesh); +} + +void RendererSimpleParticleSystemShape::initializeVertexBuffer(PxU32 color) +{ + PxU32 positionStride = 0, colorStride = 0, uvStride = 0; + PxU8* locked_positions = static_cast<PxU8*>(mVertexBuffer->lockSemantic(RendererVertexBuffer::SEMANTIC_POSITION, positionStride)); + PxU8* locked_colors = static_cast<PxU8*>(mVertexBuffer->lockSemantic(RendererVertexBuffer::SEMANTIC_COLOR, colorStride)); + PxU8* locked_uvs_base = static_cast<PxU8*>(mVertexBuffer->lockSemantic(RendererVertexBuffer::SEMANTIC_TEXCOORD0, uvStride)); + for(PxU32 i = 0; i < mMaxParticles; ++i) + { + + for (PxU32 j = 0;j < 4; j++) + { + memset(locked_colors, color, sizeof(PxU32)); + memset(locked_positions, 0, sizeof(PxReal) * 3); + locked_colors += colorStride; + locked_positions += positionStride; + } + + PxReal* locked_uvs = reinterpret_cast<PxReal*> (locked_uvs_base); + *locked_uvs = 0.0f; + locked_uvs++; + *locked_uvs = 0.0f; + locked_uvs_base += uvStride; + + locked_uvs = reinterpret_cast<PxReal*> (locked_uvs_base); + *locked_uvs = 1.0f; + locked_uvs++; + *locked_uvs = 0.0f; + locked_uvs_base += uvStride; + + locked_uvs = reinterpret_cast<PxReal*> (locked_uvs_base); + *locked_uvs = 0.0f; + locked_uvs++; + *locked_uvs = 1.0f; + locked_uvs_base += uvStride; + + locked_uvs = reinterpret_cast<PxReal*> (locked_uvs_base); + *locked_uvs = 1.0f; + locked_uvs++; + *locked_uvs = 1.0f; + locked_uvs_base += uvStride; + } + mVertexBuffer->unlockSemantic(RendererVertexBuffer::SEMANTIC_COLOR); + mVertexBuffer->unlockSemantic(RendererVertexBuffer::SEMANTIC_POSITION); + mVertexBuffer->unlockSemantic(RendererVertexBuffer::SEMANTIC_TEXCOORD0); + + RendererIndexBufferDesc inbdesc; + inbdesc.hint = RendererIndexBuffer::HINT_STATIC; + inbdesc.format = RendererIndexBuffer::FORMAT_UINT16; + inbdesc.maxIndices = mMaxParticles*6; + mIndexBuffer = m_renderer.createIndexBuffer(inbdesc); + + PxU16* ib = (PxU16*) mIndexBuffer->lock(); + for (PxU16 i = 0; i<mMaxParticles; i++) + { + ib[i * 6 + 0] = i * 4 + 0; + ib[i * 6 + 1] = i * 4 + 1; + ib[i * 6 + 2] = i * 4 + 2; + ib[i * 6 + 3] = i * 4 + 1; + ib[i * 6 + 4] = i * 4 + 3; + ib[i * 6 + 5] = i * 4 + 2; + } + mIndexBuffer->unlock(); +} + +void RendererSimpleParticleSystemShape::updateBillboard(PxU32 validParticleRange, + const PxVec3* positions, + const PxU32* validParticleBitmap, + const PxReal* lifetime) +{ + PxU32 positionStride = 0; + PxU8 *locked_positions = NULL; + locked_positions = static_cast<PxU8*>(mVertexBuffer->lockSemantic( + RendererVertexBuffer::SEMANTIC_POSITION, positionStride)); + // update vertex buffer here + PxU32 numParticles = 0; + if(validParticleRange > 0) + { + for (PxU32 w = 0; w <= (validParticleRange-1) >> 5; w++) + { + for (PxU32 b = validParticleBitmap[w]; b; b &= b-1) + { + PxU32 index = (w << 5 | physx::shdfnd::lowestSetBit(b)); + const PxVec3& basePos = positions[index]; + const float particleSize = 1.0f; + PxVec3 offsets[4] = + { + PxVec3(-particleSize, particleSize, 0.0f), + PxVec3( particleSize, particleSize, 0.0f), + PxVec3(-particleSize, -particleSize, 0.0f), + PxVec3( particleSize, -particleSize, 0.0f) + }; + + for (int p = 0; p < 4; p++) + { + *reinterpret_cast<PxVec3*>(locked_positions) = basePos + offsets[p]; + locked_positions += positionStride; + } + numParticles++; + } + } + } + + mVertexBuffer->unlockSemantic(RendererVertexBuffer::SEMANTIC_POSITION); + m_mesh->setVertexBufferRange(0, numParticles*4); +} diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererSpotLight.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererSpotLight.cpp new file mode 100644 index 00000000..79aeb1c3 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererSpotLight.cpp @@ -0,0 +1,109 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#include <RendererSpotLight.h> +#include <RendererSpotLightDesc.h> + +using namespace SampleRenderer; + +RendererSpotLight::RendererSpotLight(const RendererSpotLightDesc &desc) : + RendererLight(desc) +{ + setPosition(desc.position); + setDirection(desc.direction); + setRadius(desc.innerRadius, desc.outerRadius); + setCone(desc.innerCone, desc.outerCone); +} + +RendererSpotLight::~RendererSpotLight(void) +{ + +} + +const PxVec3 &RendererSpotLight::getPosition(void) const +{ + return m_position; +} + +void RendererSpotLight::setPosition(const PxVec3 &pos) +{ + m_position = pos; +} + +const PxVec3 &RendererSpotLight::getDirection(void) const +{ + return m_direction; +} + +void RendererSpotLight::setDirection(const PxVec3 &dir) +{ + RENDERER_ASSERT(dir.magnitudeSquared() >= 0.1f, "Trying to give Direction Light invalid Direction value."); + if(dir.magnitudeSquared() >= 0.1f) + { + m_direction = dir; + m_direction.normalize(); + } +} + +PxF32 RendererSpotLight::getInnerRadius(void) const +{ + return m_innerRadius; +} + +PxF32 RendererSpotLight::getOuterRadius(void) const +{ + return m_outerRadius; +} + +void RendererSpotLight::setRadius(PxF32 innerRadius, PxF32 outerRadius) +{ + RENDERER_ASSERT(innerRadius>=0 && innerRadius<=outerRadius, "Invalid Spot Light radius values."); + if(innerRadius>=0 && innerRadius<=outerRadius) + { + m_innerRadius = innerRadius; + m_outerRadius = outerRadius; + } +} + +PxF32 RendererSpotLight::getInnerCone(void) const +{ + return m_innerCone; +} + +PxF32 RendererSpotLight::getOuterCone(void) const +{ + return m_outerCone; +} + +void RendererSpotLight::setCone(PxF32 innerCone, PxF32 outerCone) +{ + RENDERER_ASSERT(innerCone<=1 && innerCone>=outerCone, "Invalid Spot Light cone values."); + if(innerCone<=1 && innerCone>=outerCone) + { + m_innerCone = innerCone; + m_outerCone = outerCone; + } +} diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererSpotLightDesc.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererSpotLightDesc.cpp new file mode 100644 index 00000000..cd2544a4 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererSpotLightDesc.cpp @@ -0,0 +1,51 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#include <RendererSpotLightDesc.h> + +using namespace SampleRenderer; + +RendererSpotLightDesc::RendererSpotLightDesc(void) : + RendererLightDesc(RendererLight::TYPE_SPOT) +{ + position = PxVec3(0,0,0); + direction = PxVec3(0,0,0); + innerRadius = 0; + outerRadius = 0; + innerCone = 0; + outerCone = 0; +} + +bool RendererSpotLightDesc::isValid(void) const +{ + bool ok = RendererLightDesc::isValid(); + if(direction.magnitudeSquared() < 0.1f) ok = false; + if(innerRadius < 0) ok = false; + if(outerRadius < innerRadius) ok = false; + if(innerCone > 1) ok = false; + if(outerCone > innerCone) ok = false; + return ok; +} diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererTarget.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererTarget.cpp new file mode 100644 index 00000000..8c302c4a --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererTarget.cpp @@ -0,0 +1,37 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#include <RendererTarget.h> + +using namespace SampleRenderer; + +RendererTarget::RendererTarget(void) +{ +} + +RendererTarget::~RendererTarget(void) +{ +} diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererTargetDesc.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererTargetDesc.cpp new file mode 100644 index 00000000..094345a4 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererTargetDesc.cpp @@ -0,0 +1,81 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#include <RendererTargetDesc.h> +#include <RendererTexture2D.h> + +using namespace SampleRenderer; + +RendererTargetDesc::RendererTargetDesc(void) +{ + textures = 0; + numTextures = 0; + depthStencilSurface = 0; +} + +bool RendererTargetDesc::isValid(void) const +{ + bool ok = true; + PxU32 width = 0; + PxU32 height = 0; + if(numTextures != 1) ok = false; // for now we only support single render targets at the moment. + if(textures) + { + if(textures[0]) + { + width = textures[0]->getWidth(); + height = textures[0]->getHeight(); + } + for(PxU32 i=0; i<numTextures; i++) + { + if(!textures[i]) ok = false; + else + { + if(width != textures[i]->getWidth()) ok = false; + if(height != textures[i]->getHeight()) ok = false; + const RendererTexture2D::Format format = textures[i]->getFormat(); + if( format == RendererTexture2D::FORMAT_DXT1) ok = false; + else if(format == RendererTexture2D::FORMAT_DXT3) ok = false; + else if(format == RendererTexture2D::FORMAT_DXT5) ok = false; + } + } + } + else + { + ok = false; + } + if(depthStencilSurface) + { + if(width != depthStencilSurface->getWidth()) ok = false; + if(height != depthStencilSurface->getHeight()) ok = false; + if(!RendererTexture2D::isDepthStencilFormat(depthStencilSurface->getFormat())) ok = false; + } + else + { + ok = false; + } + return ok; +} diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererTerrainShape.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererTerrainShape.cpp new file mode 100644 index 00000000..716ed066 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererTerrainShape.cpp @@ -0,0 +1,128 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +// +// RendererTerrainShape : convenience class for generating a box mesh. +// +#include <RendererTerrainShape.h> + +#include <Renderer.h> + +#include <RendererVertexBuffer.h> +#include <RendererVertexBufferDesc.h> + +#include <RendererIndexBuffer.h> +#include <RendererIndexBufferDesc.h> + +#include <RendererMesh.h> +#include <RendererMeshDesc.h> + +#include <RendererMemoryMacros.h> + +using namespace SampleRenderer; + +RendererTerrainShape::RendererTerrainShape(Renderer &renderer, + PxVec3 *verts, PxU32 numVerts, + PxVec3 *normals, PxU32 numNorms, + PxU16 *faces, PxU32 numFaces, + PxF32 uvScale) : +RendererShape(renderer) +{ + RendererVertexBufferDesc vbdesc; + vbdesc.hint = RendererVertexBuffer::HINT_STATIC; + vbdesc.semanticFormats[RendererVertexBuffer::SEMANTIC_POSITION] = RendererVertexBuffer::FORMAT_FLOAT3; + vbdesc.semanticFormats[RendererVertexBuffer::SEMANTIC_NORMAL] = RendererVertexBuffer::FORMAT_FLOAT3; + vbdesc.semanticFormats[RendererVertexBuffer::SEMANTIC_TEXCOORD0] = RendererVertexBuffer::FORMAT_FLOAT2; + vbdesc.maxVertices = numVerts; + m_vertexBuffer = m_renderer.createVertexBuffer(vbdesc); + RENDERER_ASSERT(m_vertexBuffer, "Failed to create Vertex Buffer."); + if(m_vertexBuffer) + { + PxU32 positionStride = 0; + void *vertPositions = m_vertexBuffer->lockSemantic(RendererVertexBuffer::SEMANTIC_POSITION, positionStride); + PxU32 normalStride = 0; + void *vertNormals = m_vertexBuffer->lockSemantic(RendererVertexBuffer::SEMANTIC_NORMAL, normalStride); + PxU32 uvStride = 0; + void *vertUVs = m_vertexBuffer->lockSemantic(RendererVertexBuffer::SEMANTIC_TEXCOORD0, uvStride); + if(vertPositions && vertNormals) + { + for(PxU32 i=0; i<numVerts; i++) + { + memcpy(vertPositions, verts+i, sizeof(PxVec3)); + memcpy(vertNormals, normals+i, sizeof(PxVec3)); + ((PxF32*)vertUVs)[0] = verts[i].x * uvScale; + ((PxF32*)vertUVs)[1] = verts[i].z * uvScale; + + vertPositions = (void*)(((PxU8*)vertPositions) + positionStride); + vertNormals = (void*)(((PxU8*)vertNormals) + normalStride); + vertUVs = (void*)(((PxU8*)vertUVs) + uvStride); + } + } + m_vertexBuffer->unlockSemantic(RendererVertexBuffer::SEMANTIC_NORMAL); + m_vertexBuffer->unlockSemantic(RendererVertexBuffer::SEMANTIC_POSITION); + m_vertexBuffer->unlockSemantic(RendererVertexBuffer::SEMANTIC_TEXCOORD0); + } + + PxU32 numIndices = numFaces*3; + + RendererIndexBufferDesc ibdesc; + ibdesc.hint = RendererIndexBuffer::HINT_STATIC; + ibdesc.format = RendererIndexBuffer::FORMAT_UINT16; + ibdesc.maxIndices = numIndices; + m_indexBuffer = m_renderer.createIndexBuffer(ibdesc); + RENDERER_ASSERT(m_indexBuffer, "Failed to create Index Buffer."); + if(m_indexBuffer) + { + PxU16 *indices = (PxU16*)m_indexBuffer->lock(); + if(indices) + { + memcpy(indices, faces, sizeof(*faces)*numFaces*3); + } + m_indexBuffer->unlock(); + } + + if(m_vertexBuffer && m_indexBuffer) + { + RendererMeshDesc meshdesc; + meshdesc.primitives = RendererMesh::PRIMITIVE_TRIANGLES; + meshdesc.vertexBuffers = &m_vertexBuffer; + meshdesc.numVertexBuffers = 1; + meshdesc.firstVertex = 0; + meshdesc.numVertices = numVerts; + meshdesc.indexBuffer = m_indexBuffer; + meshdesc.firstIndex = 0; + meshdesc.numIndices = numIndices; + m_mesh = m_renderer.createMesh(meshdesc); + RENDERER_ASSERT(m_mesh, "Failed to create Mesh."); + } +} + +RendererTerrainShape::~RendererTerrainShape(void) +{ + SAFE_RELEASE(m_vertexBuffer); + SAFE_RELEASE(m_indexBuffer); + SAFE_RELEASE(m_mesh); +} diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererTexture.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererTexture.cpp new file mode 100644 index 00000000..44b65c76 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererTexture.cpp @@ -0,0 +1,163 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#include <RendererTexture.h> +#include <RendererTextureDesc.h> +#include "foundation/PxMath.h" + +using namespace SampleRenderer; + +static PxU32 computeCompressedDimension(PxU32 dimension) +{ + if(dimension < 4) + { + dimension = 4; + } + else + { + PxU32 mod = dimension % 4; + if(mod) dimension += 4 - mod; + } + return dimension; +} + +PxU32 RendererTexture::computeImageByteSize(PxU32 width, PxU32 height, PxU32 depth, RendererTexture::Format format) +{ + PxU32 size = 0; + PxU32 numPixels = width * height * depth; + switch(format) + { + case RendererTexture::FORMAT_B8G8R8A8: + case RendererTexture::FORMAT_R8G8B8A8: + size = numPixels * sizeof(PxU8) * 4; + break; + case RendererTexture::FORMAT_A8: + size = numPixels * sizeof(PxU8) * 1; + break; + case RendererTexture::FORMAT_R32F: + size = numPixels * sizeof(float); + break; + case RendererTexture::FORMAT_DXT1: + width = computeCompressedDimension(width); + height = computeCompressedDimension(height); + size = computeImageByteSize(width, height, depth, RendererTexture::FORMAT_B8G8R8A8) / 8; + break; + case RendererTexture::FORMAT_DXT3: + case RendererTexture::FORMAT_DXT5: + width = computeCompressedDimension(width); + height = computeCompressedDimension(height); + size = computeImageByteSize(width, height, depth, RendererTexture::FORMAT_B8G8R8A8) / 4; + break; + case RendererTexture::FORMAT_PVR_2BPP: + { + PxU32 bytesPerBlock = 8 * 4 * 2; //8 by 4 pixels times bytes per pixel + width = PxMax(PxI32(width / 8), 2); + height = PxMax(PxI32(height / 4), 2); + size = width*height*bytesPerBlock / 8; + } + break; + case RendererTexture::FORMAT_PVR_4BPP: + { + PxU32 bytesPerBlock = 4 * 4 * 4; //4 by 4 pixels times bytes per pixel + width = PxMax(PxI32(width / 4), 2); + height = PxMax(PxI32(height / 4), 2); + size = width*height*bytesPerBlock / 8; + } + break; + default: break; + } + RENDERER_ASSERT(size, "Unable to compute Image Size."); + return size; +} + +PxU32 RendererTexture::getLevelDimension(PxU32 dimension, PxU32 level) +{ + dimension >>=level; + if(!dimension) dimension=1; + return dimension; +} + +bool RendererTexture::isCompressedFormat(Format format) +{ + return (format >= FORMAT_DXT1 && format <= FORMAT_DXT5) || (format == FORMAT_PVR_2BPP) || (format == FORMAT_PVR_4BPP); +} + +bool RendererTexture::isDepthStencilFormat(Format format) +{ + return (format >= FORMAT_D16 && format <= FORMAT_D24S8); +} + +PxU32 RendererTexture::getFormatNumBlocks(PxU32 dimension, Format format) +{ + PxU32 blockDimension = 0; + if(isCompressedFormat(format)) + { + blockDimension = dimension / 4; + if(dimension % 4) blockDimension++; + } + else + { + blockDimension = dimension; + } + return blockDimension; +} + +PxU32 RendererTexture::getFormatBlockSize(Format format) +{ + return computeImageByteSize(1, 1, 1, format); +} + +RendererTexture::RendererTexture(const RendererTextureDesc &desc) +{ + m_format = desc.format; + m_filter = desc.filter; + m_addressingU = desc.addressingU; + m_addressingV = desc.addressingV; + m_width = desc.width; + m_height = desc.height; + m_depth = desc.depth; + m_numLevels = desc.numLevels; +} + +RendererTexture::~RendererTexture(void) +{ + +} + +PxU32 RendererTexture::getWidthInBlocks(void) const +{ + return getFormatNumBlocks(getWidth(), getFormat()); +} + +PxU32 RendererTexture::getHeightInBlocks(void) const +{ + return getFormatNumBlocks(getHeight(), getFormat()); +} + +PxU32 RendererTexture::getBlockSize(void) const +{ + return getFormatBlockSize(getFormat()); +} diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererTexture2D.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererTexture2D.cpp new file mode 100644 index 00000000..46c0b1ab --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererTexture2D.cpp @@ -0,0 +1,30 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#include <RendererTexture2D.h> +#include <RendererTexture2DDesc.h> + +using namespace SampleRenderer; diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererTexture2DDesc.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererTexture2DDesc.cpp new file mode 100644 index 00000000..709e6b8b --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererTexture2DDesc.cpp @@ -0,0 +1,27 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#include <RendererTexture2DDesc.h> diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererTextureDesc.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererTextureDesc.cpp new file mode 100644 index 00000000..3308d283 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererTextureDesc.cpp @@ -0,0 +1,64 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#include <RendererTextureDesc.h> + +using namespace SampleRenderer; + +RendererTextureDesc::RendererTextureDesc(void) +{ + format = RendererTexture::NUM_FORMATS; + filter = RendererTexture::FILTER_LINEAR; + addressingU = RendererTexture::ADDRESSING_WRAP; + addressingV = RendererTexture::ADDRESSING_WRAP; + addressingW = RendererTexture::ADDRESSING_WRAP; + width = 0; + height = 0; + depth = 1; + numLevels = 0; + renderTarget = false; + data = NULL; +} + + +bool RendererTextureDesc::isValid(void) const +{ + bool ok = true; + if(format >= RendererTexture2D::NUM_FORMATS) ok = false; + if(filter >= RendererTexture2D::NUM_FILTERS) ok = false; + if(addressingU >= RendererTexture2D::NUM_ADDRESSING) ok = false; + if(addressingV >= RendererTexture2D::NUM_ADDRESSING) ok = false; + if(width <= 0 || height <= 0 || depth <= 0) ok = false; // TODO: check for power of two. + if(numLevels <= 0) ok = false; + if(renderTarget) + { + if(depth > 1) ok = false; + if(format == RendererTexture2D::FORMAT_DXT1) ok = false; + if(format == RendererTexture2D::FORMAT_DXT3) ok = false; + if(format == RendererTexture2D::FORMAT_DXT5) ok = false; + } + return ok; +} diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererVertexBuffer.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererVertexBuffer.cpp new file mode 100644 index 00000000..c6bb4528 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererVertexBuffer.cpp @@ -0,0 +1,156 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#include <RendererVertexBuffer.h> +#include <RendererVertexBufferDesc.h> + +using namespace SampleRenderer; + +PxU32 RendererVertexBuffer::getFormatByteSize(Format format) +{ + PxU32 size = 0; + switch(format) + { + case FORMAT_FLOAT1: size = sizeof(float) * 1; break; + case FORMAT_FLOAT2: size = sizeof(float) * 2; break; + case FORMAT_FLOAT3: size = sizeof(float) * 3; break; + case FORMAT_FLOAT4: size = sizeof(float) * 4; break; + case FORMAT_UBYTE4: size = sizeof(PxU8) * 4; break; + case FORMAT_USHORT4: size = sizeof(PxU16) * 4; break; + case FORMAT_COLOR_BGRA: size = sizeof(PxU8) * 4; break; + case FORMAT_COLOR_RGBA: size = sizeof(PxU8) * 4; break; + case FORMAT_COLOR_NATIVE: size = sizeof(PxU8) * 4; break; + default: break; + } + RENDERER_ASSERT(size, "Unable to determine size of Format."); + return size; +} + +RendererVertexBuffer::RendererVertexBuffer(const RendererVertexBufferDesc &desc) : +RendererInteropableBuffer(desc.registerInCUDA, desc.interopContext), + m_hint(desc.hint), + m_deferredUnlock(desc.interopContext == NULL) +{ + m_maxVertices = 0; + m_stride = 0; + m_lockedBuffer = 0; + m_numSemanticLocks = 0; + + for(PxU32 i=0; i<NUM_SEMANTICS; i++) + { + Format format = desc.semanticFormats[i]; + if(format < NUM_FORMATS) + { + SemanticDesc &sm = m_semanticDescs[i]; + sm.format = format; + sm.offset = m_stride; + m_stride += getFormatByteSize(format); + } + } +} + +RendererVertexBuffer::~RendererVertexBuffer(void) +{ + RENDERER_ASSERT(m_numSemanticLocks==0, "VertexBuffer had outstanding locks during destruction!"); +} + +PxU32 RendererVertexBuffer::getMaxVertices(void) const +{ + return m_maxVertices; +} + +RendererVertexBuffer::Hint RendererVertexBuffer::getHint(void) const +{ + return m_hint; +} + +RendererVertexBuffer::Format RendererVertexBuffer::getFormatForSemantic(Semantic semantic) const +{ + RENDERER_ASSERT(semantic < NUM_SEMANTICS, "Invalid VertexBuffer Semantic!"); + return m_semanticDescs[semantic].format; +} + +void *RendererVertexBuffer::lockSemantic(Semantic semantic, PxU32 &stride) +{ + void *semanticBuffer = 0; + RENDERER_ASSERT(semantic < NUM_SEMANTICS, "Invalid VertexBuffer Semantic!"); + if(semantic < NUM_SEMANTICS) + { + SemanticDesc &sm = m_semanticDescs[semantic]; + RENDERER_ASSERT(!sm.locked, "VertexBuffer Semantic already locked."); + RENDERER_ASSERT(sm.format < NUM_FORMATS, "VertexBuffer does not use this semantic."); + if(!sm.locked && sm.format < NUM_FORMATS) + { + if(!m_lockedBuffer && !m_numSemanticLocks) + { + m_lockedBuffer = lock(); + } + RENDERER_ASSERT(m_lockedBuffer, "Unable to lock VertexBuffer!"); + if(m_lockedBuffer) + { + m_numSemanticLocks++; + sm.locked = true; + semanticBuffer = ((PxU8*)m_lockedBuffer) + sm.offset; + stride = m_stride; + } + } + } + return semanticBuffer; +} + +void RendererVertexBuffer::unlockSemantic(Semantic semantic) +{ + RENDERER_ASSERT(semantic < NUM_SEMANTICS, "Invalid VertexBuffer Semantic!"); + if(semantic < NUM_SEMANTICS) + { + SemanticDesc &sm = m_semanticDescs[semantic]; + RENDERER_ASSERT(m_lockedBuffer && m_numSemanticLocks && sm.locked, "Trying to unlock a semantic that was not locked."); + if(m_lockedBuffer && m_numSemanticLocks && sm.locked) + { + if(m_lockedBuffer && semantic == SEMANTIC_COLOR) + { + swizzleColor(((PxU8*)m_lockedBuffer)+sm.offset, m_stride, m_maxVertices, sm.format); + } + sm.locked = false; + m_numSemanticLocks--; + } + if(m_lockedBuffer && m_numSemanticLocks == 0 && m_deferredUnlock == false) + { + unlock(); + m_lockedBuffer = 0; + } + } +} + +void RendererVertexBuffer::prepareForRender(void) +{ + if(m_lockedBuffer && m_numSemanticLocks == 0) + { + unlock(); + m_lockedBuffer = 0; + } + RENDERER_ASSERT(m_lockedBuffer==0, "Vertex Buffer locked during usage!"); +} diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererVertexBufferDesc.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererVertexBufferDesc.cpp new file mode 100644 index 00000000..73cd4b06 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererVertexBufferDesc.cpp @@ -0,0 +1,52 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#include <RendererVertexBufferDesc.h> + +using namespace SampleRenderer; + +RendererVertexBufferDesc::RendererVertexBufferDesc(void) +{ + hint = RendererVertexBuffer::HINT_STATIC; + for(PxU32 i=0; i<RendererVertexBuffer::NUM_SEMANTICS; i++) + { + semanticFormats[i] = RendererVertexBuffer::NUM_FORMATS; + } + maxVertices = 0; + canReadBack = false; + registerInCUDA = false; + interopContext = 0; +} + +bool RendererVertexBufferDesc::isValid(void) const +{ + bool ok = true; + // TODO: make sure at least "some" of the semanticFormats are set. + if(!maxVertices) ok = false; + if(registerInCUDA && !interopContext) + ok = false; + return ok; +} diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererWindow.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererWindow.cpp new file mode 100644 index 00000000..c946419f --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/RendererWindow.cpp @@ -0,0 +1,115 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#include <RendererWindow.h> +#include <RendererMemoryMacros.h> +#include <SamplePlatform.h> +#include <stdio.h> + +using namespace SampleRenderer; + +RendererWindow::RendererWindow(void) : m_platform(NULL), m_isOpen(false) +{ + m_platform = SampleFramework::createPlatform(this); +} + +bool RendererWindow::hasFocus() const +{ + return m_platform->hasFocus(); +} + +void RendererWindow::setFocus(bool b) +{ + m_platform->setFocus(b); +} + +RendererWindow::~RendererWindow(void) +{ + DELETESINGLE(m_platform); +} + +bool RendererWindow::open(PxU32 width, PxU32 height, const char *title, bool fullscreen) +{ + bool ok = false; + RENDERER_ASSERT(width && height, "Attempting to open a window with invalid width and/or height."); + if(width && height) + { + ok = m_platform->openWindow(width, height, title, fullscreen); +#if !defined(RENDERER_WINDOWS) + m_isOpen = true; +#endif + } + return ok; +} + +void RendererWindow::close(void) +{ + m_platform->closeWindow(); +#if !defined(RENDERER_WINDOWS) + if(isOpen()) + { + m_isOpen = false; + onClose(); + } +#endif +} + +bool RendererWindow::isOpen(void) const +{ + bool open = m_platform->isOpen(); +#if !defined(RENDERER_WINDOWS) + open = m_isOpen; +#endif + return open; +} + +// update the window's state... handle messages, etc. +void RendererWindow::update(void) +{ + m_platform->update(); + +#if defined(RENDERER_ANDROID) + if (!m_platform->isOpen()) + return; +#endif +} + +void RendererWindow::setSize(PxU32 width, PxU32 height) +{ + m_platform->setWindowSize(width, height); +} + +// get the window's title... +void RendererWindow::getTitle(char *title, PxU32 maxLength) const +{ + m_platform->getTitle(title, maxLength); +} + +// set the window's title... +void RendererWindow::setTitle(const char *title) +{ + m_platform->setTitle(title); +} diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/cuda/RenderClothNormals.cu b/PhysX_3.4/Samples/SampleFramework/renderer/src/cuda/RenderClothNormals.cu new file mode 100644 index 00000000..1140a11b --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/cuda/RenderClothNormals.cu @@ -0,0 +1,113 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#include "PxPhysics.h" +#include "PxVec4.h" +#include "PxVec3.h" +#include "PxVec2.h" + +#include "cloth/PxClothTypes.h" + +namespace physx +{ + +// interleaved format must match that used by RendererClothShape +struct Vertex +{ + PxVec3 position; + PxVec3 normal; +}; + +namespace +{ + __device__ inline void PxAtomicFloatAdd(float* dest, float x) + { +#if __CUDA_ARCH__ >= 200 + atomicAdd(dest, x); +#else + union bits { float f; unsigned int i; }; + bits oldVal, newVal; + + do + { + // emulate atomic float add on 1.1 arch + oldVal.f = *dest; + newVal.f = oldVal.f + x; + } + while (atomicCAS((unsigned int*)dest, oldVal.i, newVal.i) != oldVal.i); +#endif + } + + + __device__ void PxAtomicVec3Add(PxVec3& dest, PxVec3 inc) + { + PxAtomicFloatAdd(&dest.x, inc.x); + PxAtomicFloatAdd(&dest.y, inc.y); + PxAtomicFloatAdd(&dest.z, inc.z); + } +} + +extern "C" __global__ void computeSmoothNormals( + const PxClothParticle* particles, + const PxU16* indices, + Vertex* vertices, + PxU32 numTris, + PxU32 numParticles) +{ + // zero old normals + for (PxU32 i=threadIdx.x; i < numParticles; i += blockDim.x) + vertices[i].normal = PxVec3(0.0f); + + __syncthreads(); + + for (PxU32 i=threadIdx.x; i < numTris; i += blockDim.x) + { + PxU16 a = indices[i*3]; + PxU16 b = indices[i*3+1]; + PxU16 c = indices[i*3+2]; + + // calculate face normal + PxVec3 e1 = particles[b].pos-particles[a].pos; + PxVec3 e2 = particles[c].pos-particles[a].pos; + PxVec3 n = e2.cross(e1); + + PxAtomicVec3Add(vertices[a].normal, n); + PxAtomicVec3Add(vertices[b].normal, n); + PxAtomicVec3Add(vertices[c].normal, n); + } + + __syncthreads(); + + // update vertex buffer + for (PxU32 i=threadIdx.x; i < numParticles; i += blockDim.x) + { + vertices[i].position = particles[i].pos; + vertices[i].normal = vertices[i].normal.getNormalized(); + } +} + +}
\ No newline at end of file diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/cuda/RenderClothNormals_x64.cuh b/PhysX_3.4/Samples/SampleFramework/renderer/src/cuda/RenderClothNormals_x64.cuh new file mode 100644 index 00000000..42a0ca22 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/cuda/RenderClothNormals_x64.cuh @@ -0,0 +1,841 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#ifdef __cplusplus +extern "C" { +#endif + +unsigned char computeSmoothNormals[] = { +0x50,0xed,0x55,0xba,0x01,0x00,0x10,0x00,0x20,0x32,0x00,0x00,0x00,0x00,0x00,0x00, +0x02,0x00,0x01,0x01,0x58,0x00,0x00,0x00,0x80,0x0d,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x01,0x00,0x0b,0x00,0x00,0x00, +0x40,0x00,0x00,0x00,0x15,0x00,0x00,0x00,0x45,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x52,0x65,0x6e,0x64,0x65,0x72,0x43,0x6c,0x6f,0x74,0x68,0x4e,0x6f,0x72,0x6d,0x61, +0x6c,0x73,0x2e,0x63,0x75,0x00,0x00,0x00,0x7f,0x45,0x4c,0x46,0x02,0x01,0x01,0x33, +0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0xbe,0x00,0x01,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xd8,0x0c,0x00,0x00,0x00,0x00,0x00,0x00, +0x98,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x0b,0x01,0x0b,0x00,0x40,0x00,0x38,0x00, +0x03,0x00,0x40,0x00,0x09,0x00,0x01,0x00,0x00,0x2e,0x73,0x68,0x73,0x74,0x72,0x74, +0x61,0x62,0x00,0x2e,0x73,0x74,0x72,0x74,0x61,0x62,0x00,0x2e,0x73,0x79,0x6d,0x74, +0x61,0x62,0x00,0x2e,0x74,0x65,0x78,0x74,0x2e,0x63,0x6f,0x6d,0x70,0x75,0x74,0x65, +0x53,0x6d,0x6f,0x6f,0x74,0x68,0x4e,0x6f,0x72,0x6d,0x61,0x6c,0x73,0x00,0x2e,0x6e, +0x76,0x2e,0x69,0x6e,0x66,0x6f,0x2e,0x63,0x6f,0x6d,0x70,0x75,0x74,0x65,0x53,0x6d, +0x6f,0x6f,0x74,0x68,0x4e,0x6f,0x72,0x6d,0x61,0x6c,0x73,0x00,0x2e,0x6e,0x76,0x2e, +0x73,0x68,0x61,0x72,0x65,0x64,0x2e,0x63,0x6f,0x6d,0x70,0x75,0x74,0x65,0x53,0x6d, +0x6f,0x6f,0x74,0x68,0x4e,0x6f,0x72,0x6d,0x61,0x6c,0x73,0x00,0x2e,0x6e,0x76,0x2e, +0x63,0x6f,0x6e,0x73,0x74,0x61,0x6e,0x74,0x31,0x2e,0x63,0x6f,0x6d,0x70,0x75,0x74, +0x65,0x53,0x6d,0x6f,0x6f,0x74,0x68,0x4e,0x6f,0x72,0x6d,0x61,0x6c,0x73,0x00,0x2e, +0x6e,0x76,0x2e,0x6c,0x6f,0x63,0x61,0x6c,0x2e,0x63,0x6f,0x6d,0x70,0x75,0x74,0x65, +0x53,0x6d,0x6f,0x6f,0x74,0x68,0x4e,0x6f,0x72,0x6d,0x61,0x6c,0x73,0x00,0x00,0x2e, +0x73,0x68,0x73,0x74,0x72,0x74,0x61,0x62,0x00,0x2e,0x73,0x74,0x72,0x74,0x61,0x62, +0x00,0x2e,0x73,0x79,0x6d,0x74,0x61,0x62,0x00,0x63,0x6f,0x6d,0x70,0x75,0x74,0x65, +0x53,0x6d,0x6f,0x6f,0x74,0x68,0x4e,0x6f,0x72,0x6d,0x61,0x6c,0x73,0x00,0x2e,0x74, +0x65,0x78,0x74,0x2e,0x63,0x6f,0x6d,0x70,0x75,0x74,0x65,0x53,0x6d,0x6f,0x6f,0x74, +0x68,0x4e,0x6f,0x72,0x6d,0x61,0x6c,0x73,0x00,0x2e,0x6e,0x76,0x2e,0x69,0x6e,0x66, +0x6f,0x2e,0x63,0x6f,0x6d,0x70,0x75,0x74,0x65,0x53,0x6d,0x6f,0x6f,0x74,0x68,0x4e, +0x6f,0x72,0x6d,0x61,0x6c,0x73,0x00,0x2e,0x6e,0x76,0x2e,0x73,0x68,0x61,0x72,0x65, +0x64,0x2e,0x63,0x6f,0x6d,0x70,0x75,0x74,0x65,0x53,0x6d,0x6f,0x6f,0x74,0x68,0x4e, +0x6f,0x72,0x6d,0x61,0x6c,0x73,0x00,0x2e,0x6e,0x76,0x2e,0x63,0x6f,0x6e,0x73,0x74, +0x61,0x6e,0x74,0x31,0x2e,0x63,0x6f,0x6d,0x70,0x75,0x74,0x65,0x53,0x6d,0x6f,0x6f, +0x74,0x68,0x4e,0x6f,0x72,0x6d,0x61,0x6c,0x73,0x00,0x63,0x6f,0x6e,0x73,0x74,0x00, +0x2e,0x6e,0x76,0x2e,0x6c,0x6f,0x63,0x61,0x6c,0x2e,0x63,0x6f,0x6d,0x70,0x75,0x74, +0x65,0x53,0x6d,0x6f,0x6f,0x74,0x68,0x4e,0x6f,0x72,0x6d,0x61,0x6c,0x73,0x00,0x24, +0x63,0x6f,0x6d,0x70,0x75,0x74,0x65,0x53,0x6d,0x6f,0x6f,0x74,0x68,0x4e,0x6f,0x72, +0x6d,0x61,0x6c,0x73,0x24,0x6c,0x6f,0x63,0x61,0x6c,0x00,0x5f,0x5f,0x63,0x75,0x64, +0x61,0x70,0x61,0x72,0x6d,0x5f,0x63,0x6f,0x6d,0x70,0x75,0x74,0x65,0x53,0x6d,0x6f, +0x6f,0x74,0x68,0x4e,0x6f,0x72,0x6d,0x61,0x6c,0x73,0x5f,0x70,0x61,0x72,0x74,0x69, +0x63,0x6c,0x65,0x73,0x00,0x5f,0x5f,0x63,0x75,0x64,0x61,0x70,0x61,0x72,0x6d,0x5f, +0x63,0x6f,0x6d,0x70,0x75,0x74,0x65,0x53,0x6d,0x6f,0x6f,0x74,0x68,0x4e,0x6f,0x72, +0x6d,0x61,0x6c,0x73,0x5f,0x69,0x6e,0x64,0x69,0x63,0x65,0x73,0x00,0x5f,0x5f,0x63, +0x75,0x64,0x61,0x70,0x61,0x72,0x6d,0x5f,0x63,0x6f,0x6d,0x70,0x75,0x74,0x65,0x53, +0x6d,0x6f,0x6f,0x74,0x68,0x4e,0x6f,0x72,0x6d,0x61,0x6c,0x73,0x5f,0x76,0x65,0x72, +0x74,0x69,0x63,0x65,0x73,0x00,0x5f,0x5f,0x63,0x75,0x64,0x61,0x70,0x61,0x72,0x6d, +0x5f,0x63,0x6f,0x6d,0x70,0x75,0x74,0x65,0x53,0x6d,0x6f,0x6f,0x74,0x68,0x4e,0x6f, +0x72,0x6d,0x61,0x6c,0x73,0x5f,0x6e,0x75,0x6d,0x54,0x72,0x69,0x73,0x00,0x5f,0x5f, +0x63,0x75,0x64,0x61,0x70,0x61,0x72,0x6d,0x5f,0x63,0x6f,0x6d,0x70,0x75,0x74,0x65, +0x53,0x6d,0x6f,0x6f,0x74,0x68,0x4e,0x6f,0x72,0x6d,0x61,0x6c,0x73,0x5f,0x6e,0x75, +0x6d,0x50,0x61,0x72,0x74,0x69,0x63,0x6c,0x65,0x73,0x00,0x24,0x5f,0x5f,0x5f,0x5f, +0x63,0x75,0x64,0x61,0x5f,0x5f,0x5f,0x63,0x75,0x64,0x61,0x5f,0x5f,0x5f,0x54,0x32, +0x31,0x36,0x5f,0x35,0x36,0x33,0x32,0x5f,0x5f,0x37,0x31,0x00,0x24,0x5f,0x5f,0x5f, +0x5f,0x63,0x75,0x64,0x61,0x5f,0x5f,0x5f,0x63,0x75,0x64,0x61,0x5f,0x5f,0x5f,0x54, +0x32,0x32,0x31,0x5f,0x36,0x38,0x34,0x34,0x5f,0x5f,0x37,0x32,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x03,0x00,0x06,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x69,0x00,0x00,0x00,0x03,0x00,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x89,0x00,0x00,0x00,0x03,0x00,0x05,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0xb2,0x00,0x00,0x00,0x03,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1b,0x00,0x00,0x00,0x12,0x10,0x06,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xa8,0x06,0x00,0x00,0x00,0x00,0x00,0x00, +0x03,0x18,0x20,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x1c,0x00, +0x00,0xf0,0x13,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x18,0x00, +0x00,0xf0,0x13,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x10,0x00, +0x00,0xf0,0x23,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x08,0x00, +0x00,0xf0,0x23,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0xf0,0x23,0x00,0x03,0x1b,0x01,0x00,0x04,0x1e,0x04,0x00,0x10,0x01,0x00,0x00, +0x18,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x0d,0x00,0x00,0xa0,0x80,0x07,0x00,0x04, +0x01,0xd6,0x03,0x30,0xd0,0x07,0x21,0x64,0xfd,0x01,0x00,0xa0,0xc8,0x47,0x01,0x0c, +0x03,0x50,0x01,0xa0,0x00,0x00,0x00,0x00,0x03,0x50,0x01,0x10,0x00,0x11,0x00,0x00, +0x01,0xd6,0x04,0x30,0x80,0x07,0x30,0xc4,0x05,0xd6,0x03,0x30,0x80,0x07,0x30,0xc4, +0x05,0x00,0x00,0x20,0x80,0x47,0x00,0x04,0x01,0x06,0x58,0x40,0x03,0x00,0x00,0x00, +0x09,0x22,0x18,0x41,0x03,0x00,0x00,0x00,0x15,0xd0,0x00,0x20,0x80,0x07,0x20,0x04, +0x11,0x80,0x00,0x10,0x03,0x00,0x00,0x00,0x19,0x8a,0x0c,0x20,0x03,0x00,0x00,0x00, +0x11,0x0c,0x0e,0xd0,0x80,0x07,0xc0,0xa0,0x19,0x8a,0x10,0x20,0x03,0x00,0x00,0x00, +0x01,0x00,0x00,0x20,0x80,0x87,0x00,0x04,0x11,0x0c,0x0e,0xd0,0x80,0x07,0xc0,0xa0, +0x15,0x8a,0x14,0x20,0x03,0x00,0x00,0x00,0xfd,0x01,0x01,0x30,0xd8,0x47,0x00,0x64, +0x11,0x0a,0x0e,0xd0,0x80,0x07,0xc0,0xa0,0x03,0xa0,0x00,0x10,0x80,0x12,0x00,0x00, +0x01,0x00,0x00,0xf0,0x02,0x00,0x00,0xe0,0x03,0xfe,0x1f,0x86,0x00,0x00,0x00,0x00, +0xfd,0xd5,0x03,0x30,0xd8,0xc7,0x20,0x64,0x03,0x80,0x09,0xa0,0x00,0x00,0x00,0x00, +0x03,0x80,0x09,0x10,0x80,0x12,0x00,0x00,0x01,0xd4,0x02,0x30,0x80,0x07,0x30,0xc4, +0x05,0xd4,0x01,0x30,0x80,0x07,0x30,0xc4,0x15,0x00,0x00,0x20,0x80,0x47,0x00,0x04, +0x11,0x06,0x46,0x40,0x03,0x00,0x00,0x00,0x19,0x22,0x06,0x41,0x03,0x00,0x00,0x00, +0x01,0xcc,0x00,0x20,0x80,0x07,0x21,0x04,0x25,0x00,0x0e,0xd0,0x80,0x07,0x40,0x80, +0x05,0x80,0x02,0x20,0x03,0x00,0x00,0x00,0x1d,0x02,0x0e,0xd0,0x80,0x07,0x40,0x80, +0x01,0x80,0x04,0x20,0x03,0x00,0x00,0x00,0x21,0x00,0x0e,0xd0,0x80,0x07,0x40,0x80, +0x01,0x08,0x00,0x10,0x80,0xc7,0x00,0x44,0x09,0x24,0x82,0x60,0x80,0x07,0x40,0x00, +0x2d,0x04,0x0e,0xd0,0x80,0x07,0xc0,0x80,0x05,0x1c,0x82,0x60,0x80,0x07,0x40,0x00, +0x29,0x02,0x0e,0xd0,0x80,0x07,0xc0,0x80,0x01,0x20,0x10,0x60,0x03,0x00,0x00,0x00, +0x39,0x00,0x0e,0xd0,0x80,0x07,0xc0,0x80,0x31,0x84,0x04,0x20,0x03,0x00,0x00,0x00, +0x31,0x18,0x0e,0xd0,0x80,0x07,0xc0,0x80,0x35,0x82,0x04,0x20,0x03,0x00,0x00,0x00, +0x35,0x1a,0x0e,0xd0,0x80,0x07,0xc0,0x80,0x28,0x14,0x4b,0xb0,0x2c,0x96,0x0e,0xb0, +0x09,0x84,0x08,0x20,0x03,0x00,0x00,0x00,0x09,0x04,0x0e,0xd0,0x80,0x07,0xc0,0x80, +0x05,0x82,0x08,0x20,0x03,0x00,0x00,0x00,0x05,0x02,0x0e,0xd0,0x80,0x07,0xc0,0x80, +0x39,0x80,0x04,0x20,0x03,0x00,0x00,0x00,0x39,0x1c,0x0e,0xd0,0x80,0x07,0xc0,0x80, +0x01,0x80,0x08,0x20,0x03,0x00,0x00,0x00,0x01,0x00,0x0e,0xd0,0x80,0x07,0xc0,0x80, +0x34,0x1a,0x4c,0xb0,0x30,0x98,0x0e,0xb0,0x38,0x02,0x42,0xb0,0x3c,0x84,0x00,0xb0, +0x01,0x10,0x00,0x10,0x80,0xc7,0x00,0x44,0x05,0x24,0x80,0x60,0x80,0x07,0x40,0x00, +0x08,0x1a,0x0f,0xc0,0x00,0x20,0x00,0x10,0x05,0x1c,0x00,0x10,0x80,0xc7,0x03,0x00, +0x1d,0x82,0x0c,0x20,0x03,0x00,0x00,0x00,0x09,0x1c,0x0c,0xe0,0x80,0x87,0x00,0x08, +0x03,0x80,0x04,0xa0,0x00,0x00,0x00,0x00,0x21,0x82,0x0c,0x20,0x03,0x00,0x00,0x00, +0x21,0x10,0x0e,0xd0,0x80,0x07,0xc0,0x80,0x25,0x10,0x00,0xb0,0x80,0x87,0x00,0x00, +0x25,0x0e,0x08,0xd7,0x88,0x47,0xc2,0xe0,0xfd,0x13,0x08,0x30,0xd8,0x47,0x01,0x64, +0x03,0x20,0x04,0x10,0x80,0x12,0x00,0x00,0x1d,0x1c,0x0b,0xc0,0x82,0x07,0x00,0x00, +0x1d,0x14,0x0f,0xe0,0x80,0xc7,0x01,0x08,0x03,0x20,0x05,0xa0,0x00,0x00,0x00,0x00, +0x21,0x82,0x10,0x20,0x03,0x00,0x00,0x00,0x25,0x82,0x10,0x20,0x03,0x00,0x00,0x00, +0x25,0x12,0x0e,0xd0,0x80,0x07,0xc0,0x80,0x39,0x12,0x00,0xb0,0x80,0xc7,0x01,0x00, +0x39,0x10,0x09,0xd7,0x88,0x87,0xc3,0xe0,0xfd,0x1d,0x09,0x30,0xd8,0x47,0x01,0x64, +0x03,0xc0,0x04,0x10,0x80,0x12,0x00,0x00,0x21,0x14,0x0c,0xc0,0x82,0x07,0x00,0x00, +0x21,0x1a,0x0b,0xe0,0x80,0x07,0x02,0x08,0x03,0xc0,0x05,0xa0,0x00,0x00,0x00,0x00, +0x25,0x82,0x14,0x20,0x03,0x00,0x00,0x00,0x29,0x82,0x14,0x20,0x03,0x00,0x00,0x00, +0x29,0x14,0x0e,0xd0,0x80,0x07,0xc0,0x80,0x2d,0x14,0x00,0xb0,0x80,0x07,0x02,0x00, +0x2d,0x12,0x0a,0xd7,0x88,0xc7,0xc2,0xe0,0xfd,0x17,0x0a,0x30,0xd8,0x47,0x01,0x64, +0x03,0x60,0x05,0x10,0x80,0x12,0x00,0x00,0x05,0x10,0x00,0x10,0x82,0xc7,0x00,0x44, +0x05,0x02,0x18,0x60,0x03,0x00,0x00,0x00,0x03,0x60,0x06,0xa0,0x00,0x00,0x00,0x00, +0x25,0x82,0x0c,0x20,0x03,0x00,0x00,0x00,0x29,0x82,0x0c,0x20,0x03,0x00,0x00,0x00, +0x29,0x14,0x0e,0xd0,0x80,0x07,0xc0,0x80,0x2d,0x14,0x00,0xb0,0x80,0x87,0x00,0x00, +0x2d,0x12,0x0a,0xd7,0x88,0xc7,0xc2,0xe0,0xfd,0x17,0x0a,0x30,0xd8,0x47,0x01,0x64, +0x03,0x00,0x06,0x10,0x80,0x12,0x00,0x00,0x01,0x00,0x00,0xf0,0x02,0x00,0x00,0xe0, +0x03,0xf0,0x06,0xa0,0x00,0x00,0x00,0x00,0x25,0x82,0x10,0x20,0x03,0x00,0x00,0x00, +0x29,0x82,0x10,0x20,0x03,0x00,0x00,0x00,0x29,0x14,0x0e,0xd0,0x80,0x07,0xc0,0x80, +0x2d,0x14,0x00,0xb0,0x80,0xc7,0x01,0x00,0x2d,0x12,0x0a,0xd7,0x88,0xc7,0xc2,0xe0, +0xfd,0x17,0x0a,0x30,0xd8,0x47,0x01,0x64,0x03,0x90,0x06,0x10,0x80,0x12,0x00,0x00, +0x01,0x00,0x00,0xf0,0x02,0x00,0x00,0xe0,0x03,0x80,0x07,0xa0,0x00,0x00,0x00,0x00, +0x25,0x82,0x14,0x20,0x03,0x00,0x00,0x00,0x29,0x82,0x14,0x20,0x03,0x00,0x00,0x00, +0x29,0x14,0x0e,0xd0,0x80,0x07,0xc0,0x80,0x2d,0x14,0x00,0xb0,0x80,0x07,0x02,0x00, +0x2d,0x12,0x0a,0xd7,0x88,0xc7,0xc2,0xe0,0xfd,0x17,0x0a,0x30,0xd8,0x47,0x01,0x64, +0x03,0x20,0x07,0x10,0x80,0x12,0x00,0x00,0x05,0x10,0x00,0x10,0x82,0xc7,0x00,0x44, +0x01,0x00,0x80,0x60,0x80,0x47,0x40,0x00,0x03,0x20,0x08,0xa0,0x00,0x00,0x00,0x00, +0x05,0x80,0x0c,0x20,0x03,0x00,0x00,0x00,0x25,0x80,0x0c,0x20,0x03,0x00,0x00,0x00, +0x25,0x12,0x0e,0xd0,0x80,0x07,0xc0,0x80,0x29,0x12,0x00,0xb0,0x80,0x87,0x00,0x00, +0x29,0x02,0x09,0xd7,0x88,0x87,0xc2,0xe0,0xfd,0x15,0x09,0x30,0xd8,0x47,0x01,0x64, +0x03,0xc0,0x07,0x10,0x80,0x12,0x00,0x00,0x01,0x00,0x00,0xf0,0x02,0x00,0x00,0xe0, +0x03,0xb0,0x08,0xa0,0x00,0x00,0x00,0x00,0x05,0x80,0x10,0x20,0x03,0x00,0x00,0x00, +0x09,0x80,0x10,0x20,0x03,0x00,0x00,0x00,0x09,0x04,0x0e,0xd0,0x80,0x07,0xc0,0x80, +0x25,0x04,0x00,0xb0,0x80,0xc7,0x01,0x00,0x25,0x02,0x02,0xd7,0x88,0x47,0xc2,0xe0, +0xfd,0x13,0x02,0x30,0xd8,0x47,0x01,0x64,0x03,0x50,0x08,0x10,0x80,0x12,0x00,0x00, +0x01,0x00,0x00,0xf0,0x02,0x00,0x00,0xe0,0x03,0x40,0x09,0xa0,0x00,0x00,0x00,0x00, +0x05,0x80,0x14,0x20,0x03,0x00,0x00,0x00,0x09,0x80,0x14,0x20,0x03,0x00,0x00,0x00, +0x09,0x04,0x0e,0xd0,0x80,0x07,0xc0,0x80,0x1d,0x04,0x00,0xb0,0x80,0x07,0x02,0x00, +0x1d,0x02,0x02,0xd7,0x88,0xc7,0xc1,0xe0,0xfd,0x0f,0x02,0x30,0xd8,0x47,0x01,0x64, +0x03,0xe0,0x08,0x10,0x80,0x12,0x00,0x00,0x01,0x00,0x00,0xf0,0x02,0x00,0x00,0xe0, +0x11,0x08,0x00,0x20,0x80,0x87,0x01,0x04,0xfd,0x09,0x05,0x30,0xd8,0x47,0x00,0x64, +0x03,0xf0,0x01,0x10,0x80,0x12,0x00,0x00,0x01,0x00,0x00,0xf0,0x02,0x00,0x00,0xe0, +0x03,0xfe,0x1f,0x86,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x30,0x00,0x01,0x00,0x00, +0x01,0x06,0x04,0x30,0x80,0x07,0x10,0xc4,0x0d,0x06,0x58,0x40,0x03,0x00,0x00,0x00, +0x05,0xd6,0x04,0x30,0x80,0x07,0x30,0xc4,0x09,0x22,0x10,0x41,0x03,0x00,0x00,0x00, +0x11,0x22,0x18,0x41,0x03,0x00,0x00,0x00,0x1d,0xc8,0x00,0x20,0x80,0x07,0x20,0x04, +0x19,0x0e,0x0e,0xd0,0x80,0x07,0xc0,0x80,0x15,0xd0,0x00,0x20,0x80,0xc7,0x20,0x04, +0x19,0x0a,0x0e,0xd0,0x80,0x07,0xc0,0xa0,0x19,0x8e,0x04,0x20,0x03,0x00,0x00,0x00, +0x19,0x0c,0x0e,0xd0,0x80,0x07,0xc0,0x80,0x21,0x8a,0x04,0x20,0x03,0x00,0x00,0x00, +0x19,0x10,0x0e,0xd0,0x80,0x07,0xc0,0xa0,0x19,0x8e,0x08,0x20,0x03,0x00,0x00,0x00, +0x19,0x0c,0x0e,0xd0,0x80,0x07,0xc0,0x80,0x1d,0x8a,0x08,0x20,0x03,0x00,0x00,0x00, +0x19,0x0e,0x0e,0xd0,0x80,0x07,0xc0,0xa0,0x19,0x8a,0x10,0x20,0x03,0x00,0x00,0x00, +0x19,0x0c,0x0e,0xd0,0x80,0x07,0xc0,0x80,0x03,0x70,0x0c,0xa0,0x00,0x00,0x00,0x00, +0x1d,0x8a,0x0c,0x20,0x03,0x00,0x00,0x00,0x21,0x0e,0x0e,0xd0,0x80,0x07,0xc0,0x80, +0x1d,0x8a,0x14,0x20,0x03,0x00,0x00,0x00,0x1d,0x0e,0x0e,0xd0,0x80,0x07,0xc0,0x80, +0x25,0x0c,0x06,0xc0,0x80,0x07,0x00,0x00,0x25,0x10,0x08,0xe0,0x80,0x47,0x02,0x00, +0x25,0x0e,0x07,0xe0,0x80,0x47,0x02,0x00,0xfd,0x13,0x7c,0xb0,0xc8,0x07,0x01,0x60, +0x03,0x10,0x0c,0x10,0x00,0x01,0x00,0x00,0x25,0x12,0x00,0x90,0x80,0x07,0x00,0x40, +0x24,0x12,0x00,0x90,0x24,0x12,0x00,0x90,0x21,0x12,0x08,0xc0,0x80,0x07,0x00,0x00, +0x21,0x00,0x00,0xd0,0x80,0x07,0xc0,0x60,0x18,0x12,0x06,0xc0,0x1c,0x12,0x07,0xc0, +0x19,0x08,0x00,0xd0,0x80,0x07,0xc0,0x60,0x1d,0x10,0x00,0xd0,0x80,0x07,0xc0,0x60, +0x05,0xf8,0x00,0x00,0x80,0x07,0x00,0xc0,0x03,0x70,0x0c,0x10,0x80,0x07,0x00,0x00, +0x19,0x80,0x00,0x10,0x03,0x00,0x00,0x00,0x19,0x18,0x00,0xd0,0x80,0x07,0xc0,0x60, +0x19,0x20,0x00,0xd0,0x80,0x07,0xc0,0x60,0x1d,0x80,0x0c,0x10,0x03,0x00,0x00,0x00, +0x19,0x28,0x00,0xd0,0x80,0x07,0xc0,0x60,0x05,0x0e,0x00,0x00,0x80,0x07,0x00,0xc0, +0x19,0x00,0x00,0xd4,0x82,0x07,0xc0,0x40,0x21,0x08,0x00,0xd4,0x80,0x07,0xc0,0x40, +0x1d,0x10,0x00,0xd4,0x80,0x07,0xc0,0x40,0x25,0x8a,0x0c,0x20,0x03,0x00,0x00,0x00, +0x19,0x12,0x0e,0xd0,0x80,0x07,0xc0,0xa0,0x19,0x8a,0x10,0x20,0x03,0x00,0x00,0x00, +0x01,0x00,0x00,0x20,0x80,0x87,0x00,0x04,0x21,0x0c,0x0e,0xd0,0x80,0x07,0xc0,0xa0, +0x15,0x8a,0x14,0x20,0x03,0x00,0x00,0x00,0xfd,0x01,0x01,0x30,0xc8,0x47,0x00,0x64, +0x1d,0x0a,0x0e,0xd0,0x80,0x07,0xc0,0xa0,0x0d,0x06,0x00,0x20,0x80,0x07,0x01,0x04, +0x03,0x00,0x0a,0x10,0x80,0x02,0x00,0x00,0x01,0x00,0x00,0xf0,0x01,0x00,0x00,0xe0, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x01,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0xb6,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x0b,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf6,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0xff,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x13,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf8,0x02,0x00,0x00,0x00,0x00,0x00,0x00, +0x90,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x04,0x00,0x00,0x00, +0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x36,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x88,0x03,0x00,0x00,0x00,0x00,0x00,0x00, +0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x06,0x00,0x00,0x00, +0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x74,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xe8,0x03,0x00,0x00,0x00,0x00,0x00,0x00, +0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x00, +0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x1b,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x06,0x00,0x10,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf0,0x03,0x00,0x00,0x00,0x00,0x00,0x00, +0xa8,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x05,0x00,0x00,0x10, +0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x54,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x98,0x0a,0x00,0x00,0x00,0x00,0x00,0x00, +0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x00, +0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x97,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x98,0x0a,0x00,0x00,0x00,0x00,0x00,0x00, +0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x00, +0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x06,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0xd8,0x0c,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0xa8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xa8,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x05,0x00,0x00,0x00, +0xe8,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xb0,0x06,0x00,0x00,0x00,0x00,0x00,0x00, +0xb0,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x01,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x98,0x0a,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x01,0x01,0x58,0x00,0x00,0x00, +0x70,0x09,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x07,0x00,0x01,0x00,0x14,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x15,0x00,0x00,0x00, +0x45,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x52,0x65,0x6e,0x64,0x65,0x72,0x43,0x6c, +0x6f,0x74,0x68,0x4e,0x6f,0x72,0x6d,0x61,0x6c,0x73,0x2e,0x63,0x75,0x00,0x00,0x00, +0x7f,0x45,0x4c,0x46,0x02,0x01,0x01,0x33,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x02,0x00,0xbe,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0xc8,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0xc8,0x06,0x00,0x00,0x00,0x00,0x00,0x00, +0x14,0x05,0x14,0x00,0x40,0x00,0x38,0x00,0x03,0x00,0x40,0x00,0x08,0x00,0x01,0x00, +0x00,0x2e,0x73,0x68,0x73,0x74,0x72,0x74,0x61,0x62,0x00,0x2e,0x73,0x74,0x72,0x74, +0x61,0x62,0x00,0x2e,0x73,0x79,0x6d,0x74,0x61,0x62,0x00,0x2e,0x74,0x65,0x78,0x74, +0x2e,0x63,0x6f,0x6d,0x70,0x75,0x74,0x65,0x53,0x6d,0x6f,0x6f,0x74,0x68,0x4e,0x6f, +0x72,0x6d,0x61,0x6c,0x73,0x00,0x2e,0x6e,0x76,0x2e,0x69,0x6e,0x66,0x6f,0x2e,0x63, +0x6f,0x6d,0x70,0x75,0x74,0x65,0x53,0x6d,0x6f,0x6f,0x74,0x68,0x4e,0x6f,0x72,0x6d, +0x61,0x6c,0x73,0x00,0x2e,0x6e,0x76,0x2e,0x73,0x68,0x61,0x72,0x65,0x64,0x2e,0x63, +0x6f,0x6d,0x70,0x75,0x74,0x65,0x53,0x6d,0x6f,0x6f,0x74,0x68,0x4e,0x6f,0x72,0x6d, +0x61,0x6c,0x73,0x00,0x2e,0x6e,0x76,0x2e,0x69,0x6e,0x66,0x6f,0x00,0x2e,0x6e,0x76, +0x2e,0x63,0x6f,0x6e,0x73,0x74,0x61,0x6e,0x74,0x30,0x2e,0x63,0x6f,0x6d,0x70,0x75, +0x74,0x65,0x53,0x6d,0x6f,0x6f,0x74,0x68,0x4e,0x6f,0x72,0x6d,0x61,0x6c,0x73,0x00, +0x00,0x2e,0x73,0x68,0x73,0x74,0x72,0x74,0x61,0x62,0x00,0x2e,0x73,0x74,0x72,0x74, +0x61,0x62,0x00,0x2e,0x73,0x79,0x6d,0x74,0x61,0x62,0x00,0x63,0x6f,0x6d,0x70,0x75, +0x74,0x65,0x53,0x6d,0x6f,0x6f,0x74,0x68,0x4e,0x6f,0x72,0x6d,0x61,0x6c,0x73,0x00, +0x2e,0x74,0x65,0x78,0x74,0x2e,0x63,0x6f,0x6d,0x70,0x75,0x74,0x65,0x53,0x6d,0x6f, +0x6f,0x74,0x68,0x4e,0x6f,0x72,0x6d,0x61,0x6c,0x73,0x00,0x2e,0x6e,0x76,0x2e,0x69, +0x6e,0x66,0x6f,0x2e,0x63,0x6f,0x6d,0x70,0x75,0x74,0x65,0x53,0x6d,0x6f,0x6f,0x74, +0x68,0x4e,0x6f,0x72,0x6d,0x61,0x6c,0x73,0x00,0x2e,0x6e,0x76,0x2e,0x73,0x68,0x61, +0x72,0x65,0x64,0x2e,0x63,0x6f,0x6d,0x70,0x75,0x74,0x65,0x53,0x6d,0x6f,0x6f,0x74, +0x68,0x4e,0x6f,0x72,0x6d,0x61,0x6c,0x73,0x00,0x2e,0x6e,0x76,0x2e,0x69,0x6e,0x66, +0x6f,0x00,0x2e,0x6e,0x76,0x2e,0x63,0x6f,0x6e,0x73,0x74,0x61,0x6e,0x74,0x30,0x2e, +0x63,0x6f,0x6d,0x70,0x75,0x74,0x65,0x53,0x6d,0x6f,0x6f,0x74,0x68,0x4e,0x6f,0x72, +0x6d,0x61,0x6c,0x73,0x00,0x5f,0x70,0x61,0x72,0x61,0x6d,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x03,0x00,0x07,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x92,0x00,0x00,0x00,0x03,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1b,0x00,0x00,0x00,0x12,0x10,0x07,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x04,0x00,0x00,0x00,0x00,0x00,0x00, +0x04,0x0a,0x08,0x00,0x02,0x00,0x00,0x00,0x20,0x00,0x20,0x00,0x03,0x19,0x20,0x00, +0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x1c,0x00,0x00,0xf0,0x11,0x00, +0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x18,0x00,0x00,0xf0,0x11,0x00, +0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x10,0x00,0x00,0xf0,0x21,0x00, +0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x08,0x00,0x00,0xf0,0x21,0x00, +0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf0,0x21,0x00, +0x04,0x1e,0x04,0x00,0x8c,0x01,0x00,0x00,0x04,0x12,0x08,0x00,0x03,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x04,0x11,0x08,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0xe4,0x5d,0x00,0x00,0x04,0x44,0x00,0x28,0x04,0x1c,0x04,0x84,0x00,0x00,0x00,0x2c, +0x07,0x00,0x00,0xc0,0x01,0x00,0x00,0x60,0x03,0xdc,0x01,0xf1,0x00,0x40,0x0e,0x1b, +0xe7,0x01,0x00,0x60,0x01,0x00,0x00,0x40,0xe4,0x1d,0x00,0x40,0x00,0x00,0x00,0x28, +0xe2,0x1d,0x01,0x60,0x00,0x00,0x00,0x18,0x03,0xdc,0x1f,0xfc,0x00,0x00,0x7e,0x20, +0x03,0x9c,0x00,0xc0,0x00,0x80,0x09,0x20,0x43,0xdc,0x00,0xd0,0x00,0x80,0x88,0x20, +0x03,0x1c,0x00,0x20,0x00,0x40,0x00,0x48,0x85,0xdc,0x2f,0x30,0x00,0x00,0x00,0x94, +0x03,0xdc,0x01,0xf0,0x00,0x40,0x8e,0x18,0x85,0xdc,0x2f,0x40,0x00,0x00,0x00,0x94, +0x85,0xdc,0x2f,0x50,0x00,0x00,0x00,0x94,0xe7,0x01,0x00,0x00,0xff,0xff,0x03,0x40, +0x13,0xdc,0x1f,0xfc,0x00,0x00,0x7e,0x20,0x07,0x00,0x00,0x20,0x09,0x00,0x00,0x60, +0x04,0xdc,0xff,0xff,0x00,0x00,0xee,0x50,0x03,0xdc,0x01,0xe1,0x00,0x40,0x0e,0x1b, +0xe7,0x01,0x00,0xa0,0x08,0x00,0x00,0x40,0xe4,0x1d,0x00,0x40,0x00,0x00,0x00,0x28, +0xe2,0x5d,0x04,0x08,0x00,0x00,0x00,0x18,0xe2,0x9d,0x04,0x40,0x00,0x00,0x00,0x18, +0xa3,0xdc,0x00,0x0c,0x00,0xc0,0x00,0x50,0x03,0x1c,0x00,0x20,0x00,0x40,0x00,0x48, +0x03,0x9c,0x31,0xa0,0x00,0x80,0x23,0x20,0x03,0x5c,0x31,0x04,0x00,0xc0,0x00,0x48, +0x03,0x1c,0x31,0x08,0x00,0xc0,0x00,0x48,0x43,0xdc,0x31,0xb0,0x00,0x80,0xa2,0x20, +0x03,0x9c,0x50,0xa0,0x00,0x80,0x23,0x20,0x03,0xdc,0x01,0xe0,0x00,0x40,0x8e,0x18, +0x45,0x1c,0x65,0x00,0x00,0x00,0x00,0x84,0x43,0xdc,0x50,0xb0,0x00,0x80,0xa2,0x20, +0x03,0x1c,0x42,0xa0,0x00,0x80,0x23,0x20,0x45,0xdc,0x23,0x00,0x00,0x00,0x00,0x84, +0x43,0x5c,0x42,0xb0,0x00,0x80,0xa2,0x20,0x45,0x9c,0x83,0x00,0x00,0x00,0x00,0x84, +0x03,0x1c,0x41,0x81,0x00,0x80,0x25,0x20,0x43,0x5c,0x41,0x91,0x00,0x80,0xa4,0x20, +0x03,0x9c,0xf1,0x80,0x00,0x80,0x25,0x20,0x85,0x5c,0x43,0x10,0x00,0x00,0x00,0x84, +0x43,0xdc,0xf1,0x90,0x00,0x80,0xa4,0x20,0x03,0x9c,0xe0,0x80,0x00,0x80,0x25,0x20, +0x85,0x9c,0x42,0x20,0x00,0x00,0x00,0x84,0x85,0x1c,0x63,0x10,0x00,0x00,0x00,0x84, +0x43,0xdc,0xe0,0x90,0x00,0x80,0xa4,0x20,0x85,0x5c,0x62,0x20,0x00,0x00,0x00,0x84, +0x85,0xdc,0x44,0x00,0x00,0x00,0x00,0x84,0x85,0xdc,0x22,0x10,0x00,0x00,0x00,0x84, +0x85,0x1c,0x22,0x20,0x00,0x00,0x00,0x84,0x85,0x5c,0x65,0x00,0x00,0x00,0x00,0x84, +0x85,0x9c,0x25,0x00,0x00,0x00,0x00,0x84,0x03,0xdc,0x45,0x61,0x00,0xc0,0x01,0x50, +0x43,0x1c,0x45,0x61,0x00,0xc0,0xff,0x20,0x03,0x5c,0xf1,0x63,0x00,0xc0,0xa8,0x20, +0x03,0x1c,0x71,0xc1,0x00,0x40,0x01,0x48,0x43,0x5c,0x51,0xd0,0x00,0x40,0x00,0x48, +0x03,0x9c,0xf0,0x60,0x00,0xc0,0x01,0x50,0x43,0x9c,0xf1,0x60,0x00,0xc0,0xff,0x20, +0x03,0x9c,0xf1,0x63,0x00,0xc0,0x8c,0x20,0x03,0xdc,0xe1,0x60,0x00,0xc0,0x01,0x50, +0x43,0x9c,0xe3,0x60,0x00,0xc0,0xff,0x20,0x20,0x1d,0xc3,0x34,0x00,0x00,0x00,0x50, +0x20,0xdd,0x90,0x28,0x00,0x00,0x00,0x50,0x20,0x5d,0xb3,0x34,0x00,0x00,0x00,0x50, +0x20,0x9d,0x82,0x28,0x00,0x00,0x00,0x50,0x20,0x1d,0x52,0x4d,0x00,0x00,0x00,0x50, +0x40,0x5c,0xd2,0x0c,0x00,0x00,0x00,0x58,0x20,0xdd,0x64,0x4d,0x00,0x00,0x00,0x50, +0x40,0xdc,0xa2,0x20,0x00,0x00,0x00,0x58,0x40,0x5e,0xa2,0x30,0x00,0x00,0x12,0x30, +0x03,0x9c,0xf2,0x63,0x00,0xc0,0x9c,0x20,0x03,0x9c,0x20,0xc0,0x00,0x40,0x01,0x48, +0x40,0x1c,0x33,0x31,0x00,0x00,0x00,0x58,0x40,0xde,0x32,0x0d,0x00,0x00,0x16,0x30, +0x43,0xdc,0x60,0xd0,0x00,0x40,0x00,0x48,0x40,0x1e,0xd2,0x20,0x00,0x00,0x18,0x30, +0x03,0x9c,0x71,0xc0,0x00,0x40,0x01,0x48,0x05,0x5e,0x42,0x30,0x00,0x00,0x00,0x2c, +0x05,0xde,0x42,0x40,0x00,0x00,0x00,0x2c,0x05,0x1e,0x42,0x50,0x00,0x00,0x00,0x2c, +0x43,0xdc,0xa1,0xd0,0x00,0x40,0x00,0x48,0x05,0x5e,0x22,0x30,0x00,0x00,0x00,0x2c, +0x05,0xde,0x22,0x40,0x00,0x00,0x00,0x2c,0x05,0x1e,0x22,0x50,0x00,0x00,0x00,0x2c, +0x05,0x5e,0x62,0x30,0x00,0x00,0x00,0x2c,0x05,0xde,0x62,0x40,0x00,0x00,0x00,0x2c, +0x05,0x1e,0x62,0x50,0x00,0x00,0x00,0x2c,0xe7,0x01,0x00,0xc0,0xf7,0xff,0x03,0x40, +0x13,0xdc,0x01,0xf1,0x00,0x40,0x8e,0x18,0x04,0xdc,0xff,0x07,0x00,0xc0,0x00,0x30, +0x04,0xdc,0xff,0xff,0x00,0x00,0xee,0x50,0xe7,0x21,0x00,0x00,0x00,0x00,0x00,0x80, +0xe2,0x1d,0x00,0x40,0x00,0x00,0x00,0x18,0xe2,0x9d,0x01,0x60,0x00,0x00,0x00,0x18, +0x03,0x1c,0x01,0x81,0x00,0x80,0x01,0x20,0x43,0x5c,0x01,0x91,0x00,0x80,0x80,0x20, +0x03,0x9c,0x00,0xc1,0x00,0x80,0x0d,0x20,0x85,0xdc,0x42,0x00,0x00,0x00,0x00,0x84, +0x43,0xdc,0x00,0xd1,0x00,0x80,0x8c,0x20,0x85,0xdc,0x22,0x00,0x00,0x00,0x00,0x94, +0x85,0x9c,0x42,0x10,0x00,0x00,0x00,0x84,0x85,0x1c,0x22,0x40,0x00,0x00,0x00,0x84, +0x85,0x5c,0x22,0x30,0x00,0x00,0x00,0x84,0x85,0xdc,0x21,0x50,0x00,0x00,0x00,0x84, +0x85,0x9c,0x22,0x10,0x00,0x00,0x00,0x94,0x85,0x1c,0x41,0x20,0x00,0x00,0x00,0x84, +0x40,0xdc,0x82,0x20,0x00,0x00,0x00,0x58,0x40,0xdc,0x92,0x24,0x00,0x00,0x16,0x30, +0x40,0xdc,0x72,0x1c,0x00,0x00,0x16,0x30,0x00,0xdc,0xb1,0xfc,0x00,0x00,0x0e,0x2a, +0x85,0x1c,0x21,0x20,0x00,0x00,0x00,0x94,0xe7,0x81,0x00,0x80,0x00,0x00,0x00,0x40, +0xe4,0x21,0x01,0xfc,0x00,0x00,0x00,0x28,0xe4,0x61,0x01,0xfc,0x00,0x00,0x00,0x28, +0xe4,0xe1,0x01,0xfc,0x00,0x00,0x00,0x28,0xe7,0xa1,0x00,0x80,0x00,0x00,0x00,0x40, +0x00,0x80,0xb2,0x14,0x00,0x00,0x00,0xc8,0x40,0x00,0x91,0x28,0x00,0x00,0x00,0x58, +0x40,0x40,0x81,0x28,0x00,0x00,0x00,0x58,0x40,0xc0,0x71,0x28,0x00,0x00,0x00,0x58, +0x03,0x1c,0x04,0x21,0x00,0x40,0x00,0x48,0x85,0x1c,0x21,0x30,0x00,0x00,0x00,0x94, +0x85,0x5c,0x21,0x40,0x00,0x00,0x00,0x94,0x03,0xdc,0x01,0xf1,0x00,0x40,0x8e,0x18, +0x85,0xdc,0x21,0x50,0x00,0x00,0x00,0x94,0xe7,0x01,0x00,0x00,0xfc,0xff,0x03,0x40, +0xe7,0x1d,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x03,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xa0,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0b,0x00,0x00,0x00,0x03,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xbc,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x13,0x00,0x00,0x00,0x02,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0xa0,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x02,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x36,0x00,0x00,0x00,0x00,0x00,0x00,0x70, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x68,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x03,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x74,0x00,0x00,0x00,0x00,0x00,0x00,0x70, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x68,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7d,0x00,0x00,0x00,0x01,0x00,0x00,0x00, +0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x80,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1b,0x00,0x00,0x00,0x01,0x00,0x00,0x00, +0x06,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0xc0,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x04,0x00,0x00,0x00,0x00,0x00,0x00, +0x03,0x00,0x00,0x00,0x03,0x00,0x00,0x18,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x05,0x00,0x00,0x00, +0xc8,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xa8,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0xa8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x01,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x80,0x02,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x48,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x48,0x04,0x00,0x00,0x00,0x00,0x00,0x00, +0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x06,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x02,0x00,0x01,0x01,0x58,0x00,0x00,0x00,0x68,0x0b,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x01,0x00,0x1e,0x00,0x00,0x00, +0x40,0x00,0x00,0x00,0x15,0x00,0x00,0x00,0x45,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x52,0x65,0x6e,0x64,0x65,0x72,0x43,0x6c,0x6f,0x74,0x68,0x4e,0x6f,0x72,0x6d,0x61, +0x6c,0x73,0x2e,0x63,0x75,0x00,0x00,0x00,0x7f,0x45,0x4c,0x46,0x02,0x01,0x01,0x33, +0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0xbe,0x00,0x01,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x0a,0x00,0x00,0x00,0x00,0x00,0x00, +0xc0,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x1e,0x05,0x1e,0x00,0x40,0x00,0x38,0x00, +0x03,0x00,0x40,0x00,0x08,0x00,0x01,0x00,0x00,0x2e,0x73,0x68,0x73,0x74,0x72,0x74, +0x61,0x62,0x00,0x2e,0x73,0x74,0x72,0x74,0x61,0x62,0x00,0x2e,0x73,0x79,0x6d,0x74, +0x61,0x62,0x00,0x2e,0x74,0x65,0x78,0x74,0x2e,0x63,0x6f,0x6d,0x70,0x75,0x74,0x65, +0x53,0x6d,0x6f,0x6f,0x74,0x68,0x4e,0x6f,0x72,0x6d,0x61,0x6c,0x73,0x00,0x2e,0x6e, +0x76,0x2e,0x69,0x6e,0x66,0x6f,0x2e,0x63,0x6f,0x6d,0x70,0x75,0x74,0x65,0x53,0x6d, +0x6f,0x6f,0x74,0x68,0x4e,0x6f,0x72,0x6d,0x61,0x6c,0x73,0x00,0x2e,0x6e,0x76,0x2e, +0x73,0x68,0x61,0x72,0x65,0x64,0x2e,0x63,0x6f,0x6d,0x70,0x75,0x74,0x65,0x53,0x6d, +0x6f,0x6f,0x74,0x68,0x4e,0x6f,0x72,0x6d,0x61,0x6c,0x73,0x00,0x2e,0x6e,0x76,0x2e, +0x69,0x6e,0x66,0x6f,0x00,0x2e,0x6e,0x76,0x2e,0x63,0x6f,0x6e,0x73,0x74,0x61,0x6e, +0x74,0x30,0x2e,0x63,0x6f,0x6d,0x70,0x75,0x74,0x65,0x53,0x6d,0x6f,0x6f,0x74,0x68, +0x4e,0x6f,0x72,0x6d,0x61,0x6c,0x73,0x00,0x00,0x2e,0x73,0x68,0x73,0x74,0x72,0x74, +0x61,0x62,0x00,0x2e,0x73,0x74,0x72,0x74,0x61,0x62,0x00,0x2e,0x73,0x79,0x6d,0x74, +0x61,0x62,0x00,0x63,0x6f,0x6d,0x70,0x75,0x74,0x65,0x53,0x6d,0x6f,0x6f,0x74,0x68, +0x4e,0x6f,0x72,0x6d,0x61,0x6c,0x73,0x00,0x2e,0x74,0x65,0x78,0x74,0x2e,0x63,0x6f, +0x6d,0x70,0x75,0x74,0x65,0x53,0x6d,0x6f,0x6f,0x74,0x68,0x4e,0x6f,0x72,0x6d,0x61, +0x6c,0x73,0x00,0x2e,0x6e,0x76,0x2e,0x69,0x6e,0x66,0x6f,0x2e,0x63,0x6f,0x6d,0x70, +0x75,0x74,0x65,0x53,0x6d,0x6f,0x6f,0x74,0x68,0x4e,0x6f,0x72,0x6d,0x61,0x6c,0x73, +0x00,0x2e,0x6e,0x76,0x2e,0x73,0x68,0x61,0x72,0x65,0x64,0x2e,0x63,0x6f,0x6d,0x70, +0x75,0x74,0x65,0x53,0x6d,0x6f,0x6f,0x74,0x68,0x4e,0x6f,0x72,0x6d,0x61,0x6c,0x73, +0x00,0x2e,0x6e,0x76,0x2e,0x69,0x6e,0x66,0x6f,0x00,0x2e,0x6e,0x76,0x2e,0x63,0x6f, +0x6e,0x73,0x74,0x61,0x6e,0x74,0x30,0x2e,0x63,0x6f,0x6d,0x70,0x75,0x74,0x65,0x53, +0x6d,0x6f,0x6f,0x74,0x68,0x4e,0x6f,0x72,0x6d,0x61,0x6c,0x73,0x00,0x5f,0x70,0x61, +0x72,0x61,0x6d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x30,0x00,0x00,0x00,0x03,0x00,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x92,0x00,0x00,0x00,0x03,0x00,0x06,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x1b,0x00,0x00,0x00,0x12,0x10,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0xc0,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x0a,0x08,0x00,0x02,0x00,0x00,0x00, +0x40,0x01,0x20,0x00,0x03,0x19,0x20,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x04,0x00,0x1c,0x00,0x00,0xf0,0x11,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x03,0x00,0x18,0x00,0x00,0xf0,0x11,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x02,0x00,0x10,0x00,0x00,0xf0,0x21,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x01,0x00,0x08,0x00,0x00,0xf0,0x21,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0xf0,0x21,0x00,0x04,0x1e,0x04,0x00,0x10,0x02,0x00,0x00, +0x04,0x12,0x08,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x11,0x08,0x00, +0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf7,0x42,0x80,0xc2,0x22,0x42,0x00,0x20, +0xe4,0x5d,0x00,0x10,0x01,0x40,0x00,0x28,0x04,0x1c,0x00,0x84,0x00,0x00,0x00,0x2c, +0x07,0x00,0x00,0xe0,0x01,0x00,0x00,0x60,0x03,0xdc,0x01,0x70,0x05,0x40,0x0e,0x1b, +0xe7,0x01,0x00,0x80,0x01,0x00,0x00,0x40,0xe4,0x9d,0x00,0x00,0x00,0x00,0x00,0x28, +0xe2,0xdd,0x00,0x60,0x00,0x00,0x00,0x18,0xc7,0x82,0x42,0xe0,0x42,0xe0,0x02,0x22, +0x03,0x1c,0x21,0x40,0x05,0x80,0x07,0x20,0x43,0x5c,0x21,0x50,0x05,0x80,0x86,0x20, +0x03,0x9c,0x20,0xa0,0x00,0x40,0x00,0x48,0x85,0xdc,0x4f,0x30,0x00,0x00,0x00,0x94, +0x03,0xdc,0x21,0x70,0x05,0x40,0x8e,0x18,0x85,0xdc,0x4f,0x40,0x00,0x00,0x00,0x94, +0x85,0xdc,0x4f,0x50,0x00,0x00,0x00,0x94,0xe7,0x02,0x10,0x43,0xc0,0x22,0x02,0x22, +0xe7,0x01,0x00,0xc0,0xfe,0xff,0x03,0x40,0xf4,0x1d,0x00,0x00,0x00,0x00,0x00,0x40, +0x04,0x1c,0x00,0x00,0x00,0xc0,0x0e,0x50,0x03,0xdc,0x01,0x60,0x05,0x40,0x0e,0x1b, +0x07,0x00,0x00,0x20,0x0a,0x00,0x00,0x60,0xe7,0x01,0x00,0xe0,0x09,0x00,0x00,0x40, +0xe4,0x1d,0x02,0x00,0x00,0x00,0x00,0x28,0x47,0x00,0x80,0x42,0xc0,0x42,0x30,0x22, +0xe2,0x5d,0x02,0x08,0x00,0x00,0x00,0x18,0xe2,0x9d,0x02,0x40,0x00,0x00,0x00,0x18, +0xa3,0x9c,0x80,0x0c,0x00,0xc0,0x00,0x50,0x03,0x9c,0x21,0x20,0x05,0x80,0x13,0x20, +0x03,0x1c,0x21,0x04,0x00,0xc0,0x00,0x48,0x43,0xdc,0x21,0x30,0x05,0x80,0x92,0x20, +0x03,0x9c,0x20,0x08,0x00,0xc0,0x00,0x48,0x47,0x72,0x32,0x42,0x72,0x32,0x42,0x22, +0x03,0x1c,0x44,0x20,0x05,0x80,0x13,0x20,0x45,0x1c,0x65,0x00,0x00,0x00,0x00,0x84, +0x43,0x5c,0x44,0x30,0x05,0x80,0x92,0x20,0x03,0x1c,0x23,0x20,0x05,0x80,0x13,0x20, +0x45,0xdc,0x02,0x01,0x00,0x00,0x00,0x84,0x43,0x5c,0x23,0x30,0x05,0x80,0x92,0x20, +0x03,0x9c,0x41,0x01,0x05,0x80,0x15,0x20,0x77,0x82,0x42,0xc0,0x32,0x02,0xb2,0x22, +0x45,0x9c,0xc3,0x00,0x00,0x00,0x00,0x84,0x43,0xdc,0x41,0x11,0x05,0x80,0x94,0x20, +0x03,0x1c,0xb1,0x00,0x05,0x80,0x15,0x20,0x85,0xdc,0x64,0x20,0x00,0x00,0x00,0x84, +0x43,0x5c,0xb1,0x10,0x05,0x80,0x94,0x20,0x03,0x9c,0xe0,0x00,0x05,0x80,0x15,0x20, +0x85,0x5c,0x65,0x10,0x00,0x00,0x00,0x84,0x07,0x72,0x42,0x30,0x42,0x30,0x42,0x22, +0x43,0xdc,0xe0,0x10,0x05,0x80,0x94,0x20,0x85,0x1c,0x44,0x20,0x00,0x00,0x00,0x84, +0x85,0x5c,0x24,0x10,0x00,0x00,0x00,0x84,0x03,0x1c,0x46,0x61,0x00,0xc0,0x01,0x50, +0x85,0x1c,0x43,0x10,0x00,0x00,0x00,0x84,0x03,0x1c,0x82,0xa0,0x00,0x40,0x00,0x48, +0x85,0x5c,0x23,0x20,0x00,0x00,0x00,0x84,0x27,0x42,0x30,0x42,0x30,0x02,0x22,0x23, +0x43,0x9c,0x45,0x61,0x00,0xc0,0xff,0x20,0x85,0xdc,0x63,0x00,0x00,0x00,0x00,0x84, +0x20,0x1d,0x05,0x4d,0x00,0x00,0x00,0x50,0x85,0x9c,0x44,0x00,0x00,0x00,0x00,0x84, +0x03,0xdc,0x81,0x60,0x05,0x40,0x8e,0x18,0x20,0x1d,0x14,0x55,0x00,0x00,0x00,0x50, +0x85,0x5c,0x24,0x00,0x00,0x00,0x00,0x84,0x47,0x00,0x42,0x00,0x42,0x20,0x82,0x22, +0x03,0xdc,0xf5,0x63,0x00,0xc0,0xac,0x20,0x20,0x5d,0x26,0x3d,0x00,0x00,0x00,0x50, +0x20,0x9d,0xc5,0x54,0x00,0x00,0x00,0x50,0x03,0x1c,0x83,0x41,0x05,0x40,0x01,0x48, +0x20,0x5d,0xd5,0x4c,0x00,0x00,0x00,0x50,0x40,0xdc,0x04,0x51,0x00,0x00,0x00,0x58, +0x20,0x5d,0x14,0x3d,0x00,0x00,0x00,0x50,0x07,0x02,0x72,0x02,0x32,0x02,0xb2,0x22, +0x43,0x5c,0x73,0x51,0x05,0x40,0x00,0x48,0x40,0x5c,0x51,0x65,0x00,0x00,0x00,0x58, +0x03,0xdc,0xb1,0x60,0x00,0xc0,0x01,0x50,0x40,0x9e,0x10,0x51,0x00,0x00,0x0a,0x30, +0x40,0x5c,0x11,0x59,0x00,0x00,0x00,0x58,0x43,0x9c,0xb1,0x60,0x00,0xc0,0xff,0x20, +0x40,0x1e,0x51,0x59,0x00,0x00,0x26,0x30,0x47,0x00,0x42,0xc0,0x42,0x10,0xa2,0x22, +0x40,0xde,0x00,0x65,0x00,0x00,0x0a,0x30,0x03,0x5c,0xf1,0x63,0x00,0xc0,0x8c,0x20, +0x03,0x9c,0x71,0x40,0x05,0x40,0x01,0x48,0x05,0x1e,0xc1,0x30,0x00,0x00,0x00,0x2c, +0x43,0xdc,0x51,0x50,0x05,0x40,0x00,0x48,0x03,0xdc,0xe2,0x60,0x00,0xc0,0x01,0x50, +0x05,0x9e,0xc0,0x40,0x00,0x00,0x00,0x2c,0x37,0xe2,0x42,0xc0,0x42,0xe0,0xe2,0x22, +0x43,0x5c,0xe1,0x60,0x00,0xc0,0xff,0x20,0x05,0xde,0xc0,0x50,0x00,0x00,0x00,0x2c, +0x03,0x5c,0xf1,0x63,0x00,0xc0,0x8a,0x20,0x03,0x1c,0xb3,0x40,0x05,0x40,0x01,0x48, +0x05,0x1e,0x61,0x30,0x00,0x00,0x00,0x2c,0x43,0x5c,0x53,0x50,0x05,0x40,0x00,0x48, +0x05,0x9e,0x60,0x40,0x00,0x00,0x00,0x2c,0xe7,0xe2,0xe2,0x42,0xe0,0xf2,0x12,0x23, +0x05,0xde,0x60,0x50,0x00,0x00,0x00,0x2c,0x05,0x1e,0xc1,0x30,0x00,0x00,0x00,0x2c, +0x05,0x9e,0xc0,0x40,0x00,0x00,0x00,0x2c,0x05,0xde,0xc0,0x50,0x00,0x00,0x00,0x2c, +0xe7,0x01,0x00,0xa0,0xf6,0xff,0x03,0x40,0x13,0xdc,0x01,0x70,0x05,0x40,0x8e,0x18, +0x04,0x1c,0x00,0x00,0x00,0xc0,0x0e,0x50,0xe7,0x42,0x00,0xc0,0x82,0x02,0xc2,0x22, +0xe7,0x21,0x00,0x00,0x00,0x00,0x00,0x80,0xe2,0x5d,0x02,0x40,0x00,0x00,0x00,0x18, +0xe2,0x1d,0x03,0x60,0x00,0x00,0x00,0x18,0x03,0x9c,0x02,0x00,0x05,0x80,0x13,0x20, +0x43,0xdc,0x02,0x10,0x05,0x80,0x92,0x20,0x85,0x1c,0xa1,0x00,0x00,0x00,0x00,0x84, +0x03,0x9c,0x00,0x40,0x05,0x80,0x19,0x20,0x97,0xe2,0x72,0xe3,0x32,0x32,0xf2,0x22, +0x43,0xdc,0x00,0x50,0x05,0x80,0x98,0x20,0x85,0x1c,0x21,0x00,0x00,0x00,0x00,0x94, +0x85,0xdc,0xa1,0x10,0x00,0x00,0x00,0x84,0x85,0xdc,0x21,0x10,0x00,0x00,0x00,0x94, +0x85,0x5c,0x21,0x40,0x00,0x00,0x00,0x84,0x85,0x1c,0x21,0x30,0x00,0x00,0x00,0x84, +0x85,0x9c,0x21,0x50,0x00,0x00,0x00,0x84,0x47,0x80,0xe2,0x02,0x82,0xc2,0x02,0x20, +0x40,0x1c,0x52,0x14,0x00,0x00,0x00,0x58,0x85,0xdc,0xa1,0x20,0x00,0x00,0x00,0x84, +0x40,0x1c,0x42,0x10,0x00,0x00,0x10,0x30,0x85,0xdc,0x21,0x20,0x00,0x00,0x00,0x94, +0x40,0x1c,0x62,0x18,0x00,0x00,0x10,0x30,0x00,0xdc,0x81,0xfc,0x00,0x00,0x0e,0x2a, +0xe7,0x81,0x00,0xa0,0x00,0x00,0x00,0x40,0x47,0x00,0x42,0x00,0x80,0x42,0x00,0x22, +0xe4,0x21,0x01,0xfc,0x00,0x00,0x00,0x28,0xe4,0x61,0x01,0xfc,0x00,0x00,0x00,0x28, +0xe4,0xa1,0x01,0xfc,0x00,0x00,0x00,0x28,0xe7,0xa1,0x00,0xa0,0x00,0x00,0x00,0x40, +0x00,0x00,0x82,0x14,0x00,0x00,0x00,0xc8,0x40,0x00,0x41,0x20,0x00,0x00,0x00,0x58, +0x40,0x40,0x51,0x20,0x00,0x00,0x00,0x58,0x07,0x00,0x72,0x62,0xe2,0x42,0xe0,0x22, +0x40,0x80,0x61,0x20,0x00,0x00,0x00,0x58,0x03,0x1c,0x00,0xa0,0x00,0x40,0x00,0x48, +0x85,0x1c,0x21,0x30,0x00,0x00,0x00,0x94,0x03,0xdc,0x01,0x70,0x05,0x40,0x8e,0x18, +0x85,0x5c,0x21,0x40,0x00,0x00,0x00,0x94,0x85,0x9c,0x21,0x50,0x00,0x00,0x00,0x94, +0xe7,0x01,0x00,0x80,0xfb,0xff,0x03,0x40,0xe7,0x02,0x00,0x00,0x00,0x00,0x00,0x20, +0xe7,0x1d,0x00,0x00,0x00,0x00,0x00,0x80,0xe7,0x1d,0x00,0xe0,0xff,0xff,0x03,0x40, +0xe4,0x1d,0x00,0x00,0x00,0x00,0x00,0x40,0xe4,0x1d,0x00,0x00,0x00,0x00,0x00,0x40, +0xe4,0x1d,0x00,0x00,0x00,0x00,0x00,0x40,0xe4,0x1d,0x00,0x00,0x00,0x00,0x00,0x40, +0xe4,0x1d,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x03,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xa0,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0b,0x00,0x00,0x00,0x03,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xbc,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x13,0x00,0x00,0x00,0x02,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0xa0,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x02,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x36,0x00,0x00,0x00,0x00,0x00,0x00,0x70, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x68,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x03,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x74,0x00,0x00,0x00,0x00,0x00,0x00,0x70, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x68,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7d,0x00,0x00,0x00,0x01,0x00,0x00,0x00, +0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x80,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x01,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1b,0x00,0x00,0x00,0x01,0x00,0x00,0x00, +0x06,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x04,0x00,0x00,0x00,0x00,0x00,0x00, +0x03,0x00,0x00,0x00,0x03,0x00,0x00,0x1a,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x05,0x00,0x00,0x00, +0xc0,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xa8,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0xa8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x01,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x80,0x02,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x20,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x06,0x00,0x00,0x00,0x00,0x00,0x00, +0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x06,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x02,0x00,0x01,0x01,0x58,0x00,0x00,0x00,0x68,0x0e,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x01,0x00,0x32,0x00,0x00,0x00, +0x40,0x00,0x00,0x00,0x15,0x00,0x00,0x00,0x45,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x52,0x65,0x6e,0x64,0x65,0x72,0x43,0x6c,0x6f,0x74,0x68,0x4e,0x6f,0x72,0x6d,0x61, +0x6c,0x73,0x2e,0x63,0x75,0x00,0x00,0x00,0x7f,0x45,0x4c,0x46,0x02,0x01,0x01,0x33, +0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0xbe,0x00,0x01,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x0d,0x00,0x00,0x00,0x00,0x00,0x00, +0xc0,0x0b,0x00,0x00,0x00,0x00,0x00,0x00,0x32,0x05,0x32,0x00,0x40,0x00,0x38,0x00, +0x03,0x00,0x40,0x00,0x08,0x00,0x01,0x00,0x00,0x2e,0x73,0x68,0x73,0x74,0x72,0x74, +0x61,0x62,0x00,0x2e,0x73,0x74,0x72,0x74,0x61,0x62,0x00,0x2e,0x73,0x79,0x6d,0x74, +0x61,0x62,0x00,0x2e,0x74,0x65,0x78,0x74,0x2e,0x63,0x6f,0x6d,0x70,0x75,0x74,0x65, +0x53,0x6d,0x6f,0x6f,0x74,0x68,0x4e,0x6f,0x72,0x6d,0x61,0x6c,0x73,0x00,0x2e,0x6e, +0x76,0x2e,0x69,0x6e,0x66,0x6f,0x2e,0x63,0x6f,0x6d,0x70,0x75,0x74,0x65,0x53,0x6d, +0x6f,0x6f,0x74,0x68,0x4e,0x6f,0x72,0x6d,0x61,0x6c,0x73,0x00,0x2e,0x6e,0x76,0x2e, +0x73,0x68,0x61,0x72,0x65,0x64,0x2e,0x63,0x6f,0x6d,0x70,0x75,0x74,0x65,0x53,0x6d, +0x6f,0x6f,0x74,0x68,0x4e,0x6f,0x72,0x6d,0x61,0x6c,0x73,0x00,0x2e,0x6e,0x76,0x2e, +0x69,0x6e,0x66,0x6f,0x00,0x2e,0x6e,0x76,0x2e,0x63,0x6f,0x6e,0x73,0x74,0x61,0x6e, +0x74,0x30,0x2e,0x63,0x6f,0x6d,0x70,0x75,0x74,0x65,0x53,0x6d,0x6f,0x6f,0x74,0x68, +0x4e,0x6f,0x72,0x6d,0x61,0x6c,0x73,0x00,0x00,0x2e,0x73,0x68,0x73,0x74,0x72,0x74, +0x61,0x62,0x00,0x2e,0x73,0x74,0x72,0x74,0x61,0x62,0x00,0x2e,0x73,0x79,0x6d,0x74, +0x61,0x62,0x00,0x63,0x6f,0x6d,0x70,0x75,0x74,0x65,0x53,0x6d,0x6f,0x6f,0x74,0x68, +0x4e,0x6f,0x72,0x6d,0x61,0x6c,0x73,0x00,0x2e,0x74,0x65,0x78,0x74,0x2e,0x63,0x6f, +0x6d,0x70,0x75,0x74,0x65,0x53,0x6d,0x6f,0x6f,0x74,0x68,0x4e,0x6f,0x72,0x6d,0x61, +0x6c,0x73,0x00,0x2e,0x6e,0x76,0x2e,0x69,0x6e,0x66,0x6f,0x2e,0x63,0x6f,0x6d,0x70, +0x75,0x74,0x65,0x53,0x6d,0x6f,0x6f,0x74,0x68,0x4e,0x6f,0x72,0x6d,0x61,0x6c,0x73, +0x00,0x2e,0x6e,0x76,0x2e,0x73,0x68,0x61,0x72,0x65,0x64,0x2e,0x63,0x6f,0x6d,0x70, +0x75,0x74,0x65,0x53,0x6d,0x6f,0x6f,0x74,0x68,0x4e,0x6f,0x72,0x6d,0x61,0x6c,0x73, +0x00,0x2e,0x6e,0x76,0x2e,0x69,0x6e,0x66,0x6f,0x00,0x2e,0x6e,0x76,0x2e,0x63,0x6f, +0x6e,0x73,0x74,0x61,0x6e,0x74,0x30,0x2e,0x63,0x6f,0x6d,0x70,0x75,0x74,0x65,0x53, +0x6d,0x6f,0x6f,0x74,0x68,0x4e,0x6f,0x72,0x6d,0x61,0x6c,0x73,0x00,0x5f,0x70,0x61, +0x72,0x61,0x6d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x30,0x00,0x00,0x00,0x03,0x00,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x92,0x00,0x00,0x00,0x03,0x00,0x06,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x1b,0x00,0x00,0x00,0x12,0x10,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0xc0,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x0a,0x08,0x00,0x02,0x00,0x00,0x00, +0x40,0x01,0x20,0x00,0x03,0x19,0x20,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x04,0x00,0x1c,0x00,0x00,0xf0,0x11,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x03,0x00,0x18,0x00,0x00,0xf0,0x11,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x02,0x00,0x10,0x00,0x00,0xf0,0x21,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x01,0x00,0x08,0x00,0x00,0xf0,0x21,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0xf0,0x21,0x00,0x04,0x1e,0x04,0x00,0x10,0x02,0x00,0x00, +0x04,0x1c,0x10,0x00,0x30,0x04,0x00,0x00,0x98,0x05,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x04,0x12,0x08,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x04,0x11,0x08,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xe6,0x07,0x20,0xe2,0x00,0xf4,0x1f,0x00, +0x01,0x00,0x87,0x00,0x80,0x07,0x98,0x4c,0x00,0x00,0x17,0x02,0x00,0x00,0xc8,0xf0, +0x00,0x00,0x80,0x0d,0x00,0x00,0x90,0xe2,0xed,0x0f,0xa0,0xff,0x00,0x98,0x1f,0x00, +0x07,0x00,0x77,0x05,0x80,0x03,0x6c,0x4b,0x0f,0x00,0x80,0x0b,0x00,0x00,0x40,0xe2, +0x02,0x00,0x07,0x00,0x80,0x07,0x98,0x5c,0xe1,0x07,0x20,0xfc,0x00,0x90,0x1f,0x00, +0x05,0xf0,0x87,0x01,0x00,0x00,0x00,0x01,0x03,0x02,0x87,0x01,0x80,0x7f,0x00,0x36, +0x07,0x02,0x87,0x01,0x80,0x7f,0x00,0x36,0xe1,0x07,0x20,0xfc,0x00,0x84,0x1f,0x00, +0x04,0x02,0x57,0x00,0x88,0x7f,0x00,0x5b,0x06,0x02,0x87,0x01,0x80,0x01,0x28,0x36, +0x05,0x02,0x57,0x00,0x88,0x7f,0x20,0x5b,0xe1,0x07,0x80,0xfc,0x00,0x84,0x1f,0x00, +0x03,0x02,0x87,0x01,0x90,0x03,0x20,0x36,0x02,0x02,0x27,0x00,0x00,0x00,0x10,0x4c, +0x04,0x06,0x47,0x00,0xa0,0x02,0xc0,0x5c,0xe1,0x07,0x80,0xfd,0x00,0x88,0x1f,0x00, +0x06,0x03,0x47,0x05,0x00,0x80,0x10,0x4c,0x07,0x02,0x77,0x05,0x80,0x03,0x62,0x4b, +0x07,0x04,0x57,0x05,0x00,0x08,0x10,0x4c,0xf1,0x00,0x20,0x3e,0x00,0xf4,0x0b,0x00, +0xff,0x06,0xc7,0x00,0x00,0x20,0xdc,0xee,0xff,0x06,0x07,0x01,0x00,0x20,0xdc,0xee, +0xff,0x06,0x47,0x01,0x00,0x20,0xdc,0xee,0xfd,0x3f,0xa0,0xff,0x00,0xfc,0x1f,0x00, +0x0f,0x00,0x80,0xf5,0xff,0x0f,0x40,0xe2,0x0f,0x00,0x07,0x00,0x00,0x00,0xf8,0xf0, +0x00,0x00,0x07,0x00,0x80,0x1b,0xa8,0xf0,0xf0,0x07,0xa0,0xfd,0x00,0xf4,0x1f,0x00, +0x07,0x00,0x67,0x05,0x80,0x03,0x6c,0x4b,0x00,0x00,0x00,0x47,0x00,0x00,0x90,0xe2, +0x0f,0x00,0x80,0x45,0x00,0x00,0x40,0xe2,0xe6,0x07,0xc0,0xfc,0x00,0x98,0x1f,0x00, +0x06,0x00,0x07,0x00,0x80,0x07,0x98,0x5c,0x03,0x06,0x37,0x00,0x80,0x7f,0x00,0x36, +0x02,0x06,0x37,0x00,0x90,0x01,0x20,0x36,0xe1,0x07,0x20,0xfc,0x00,0x90,0x1f,0x00, +0x03,0x02,0x17,0x00,0x80,0x00,0x48,0x38,0x05,0x02,0x17,0x00,0x00,0x00,0x10,0x38, +0x04,0x02,0xf7,0x01,0x00,0x00,0x28,0x38,0xe1,0x07,0x20,0xfc,0x00,0x84,0x1f,0x00, +0x0a,0x03,0x27,0x05,0x00,0x80,0x10,0x4c,0x07,0x05,0x17,0x00,0x80,0x00,0x48,0x38, +0x02,0x02,0x27,0x00,0x00,0x00,0x10,0x38,0xea,0x07,0x40,0xfc,0x00,0xc0,0x1f,0x00, +0x08,0x05,0xf7,0x01,0x00,0x00,0x28,0x38,0x0b,0x04,0x37,0x05,0x00,0x08,0x10,0x4c, +0x0c,0x07,0x27,0x05,0x00,0x80,0x10,0x4c,0xb2,0x07,0x40,0xfc,0x00,0xa4,0x1f,0x00, +0x04,0x0a,0x07,0x00,0x00,0x20,0xd2,0xee,0x05,0x02,0x17,0x00,0x80,0x00,0x48,0x38, +0x03,0x02,0xf7,0x01,0x00,0x00,0x28,0x38,0xe2,0x07,0x20,0xf6,0x00,0xb4,0x1f,0x00, +0x0d,0x08,0x37,0x05,0x00,0x08,0x10,0x4c,0x02,0x0c,0x07,0x00,0x00,0x20,0xd2,0xee, +0x08,0x05,0x27,0x05,0x00,0x80,0x10,0x4c,0xe2,0x07,0x40,0xf6,0x00,0x50,0x1c,0x04, +0x09,0x03,0x37,0x05,0x00,0x08,0x10,0x4c,0x03,0x08,0x07,0x00,0x00,0x20,0xd2,0xee, +0x0f,0x06,0x47,0x00,0x00,0x00,0xe0,0x5c,0x5d,0x01,0x00,0xfe,0x01,0x48,0x1c,0x00, +0x0e,0x06,0x27,0x00,0x00,0x00,0xe0,0x5c,0x04,0x0f,0x47,0x00,0xc0,0x7f,0xf8,0x36, +0x0b,0x06,0x37,0x00,0x00,0x00,0xe0,0x5c,0xe2,0x17,0x80,0xfc,0x04,0x84,0x1f,0x00, +0x02,0x0f,0x47,0x00,0x00,0x00,0x48,0x38,0x05,0x0e,0x47,0x00,0x00,0x00,0x48,0x38, +0x0c,0x02,0x07,0x05,0x00,0x80,0x10,0x4c,0xe2,0x07,0x40,0xfd,0x01,0x88,0x1f,0x00, +0x07,0x0e,0x47,0x00,0xc0,0x7f,0xf8,0x36,0x02,0x0b,0x47,0x00,0x00,0x00,0x48,0x38, +0x0d,0x04,0x17,0x05,0x00,0x08,0x10,0x4c,0xf0,0x07,0x40,0xfe,0x00,0xac,0x1f,0x00, +0x04,0x05,0x07,0x05,0x00,0x80,0x10,0x4c,0x08,0x0c,0x87,0x00,0x00,0x20,0xd4,0xee, +0x03,0x0b,0x47,0x00,0xc0,0x7f,0xf8,0x36,0xf0,0x07,0x20,0xfe,0x00,0xc0,0x1f,0x00, +0x05,0x07,0x17,0x05,0x00,0x08,0x10,0x4c,0x09,0x0c,0x47,0x00,0x00,0x20,0xd4,0xee, +0x02,0x02,0x07,0x05,0x00,0x80,0x10,0x4c,0xf1,0x00,0x20,0xf6,0x00,0xec,0x1e,0x00, +0x07,0x0c,0x07,0x00,0x00,0x20,0xd4,0xee,0x11,0x04,0x87,0x00,0x00,0x20,0xd4,0xee, +0x0a,0x04,0x07,0x00,0x00,0x20,0xd4,0xee,0xf0,0x07,0x40,0x3e,0x00,0xc4,0x1e,0x00, +0x03,0x03,0x17,0x05,0x00,0x08,0x10,0x4c,0x10,0x04,0x47,0x00,0x00,0x20,0xd4,0xee, +0x13,0x02,0x47,0x00,0x00,0x20,0xd4,0xee,0xb1,0x07,0x20,0x56,0x00,0x84,0x1f,0x00, +0x12,0x02,0x87,0x00,0x00,0x20,0xd4,0xee,0x14,0x02,0x07,0x00,0x00,0x20,0xd4,0xee, +0x16,0xf0,0x87,0x01,0x00,0x00,0x00,0x01,0xe1,0x07,0x20,0xfc,0x00,0x84,0x1f,0x00, +0x15,0x00,0xf7,0x0f,0x80,0x07,0x98,0x5c,0x18,0x00,0xf7,0x0f,0x80,0x07,0x98,0x5c, +0x19,0x00,0xf7,0x0f,0x80,0x07,0x98,0x5c,0xe2,0x07,0x20,0xfc,0x01,0x84,0x1f,0x00, +0x17,0x00,0xf7,0x0f,0x80,0x07,0x98,0x5c,0x0c,0xff,0x67,0x01,0x88,0x7f,0x00,0x5b, +0x16,0x0f,0x87,0x01,0x80,0x8a,0x20,0x36,0xe1,0x07,0x60,0xfd,0x02,0x84,0x1f,0x00, +0x0d,0x0f,0x87,0x01,0x80,0x7f,0x04,0x36,0x05,0x00,0xf7,0x0f,0x80,0x07,0x98,0x5c, +0x04,0x19,0xc7,0x00,0x00,0x0c,0xc1,0x5c,0xe1,0x27,0x20,0xfc,0x00,0x84,0x1f,0x00, +0x03,0xff,0x87,0x01,0x80,0x0b,0x00,0x36,0x02,0x16,0xd7,0x00,0x00,0x88,0xd7,0x5b, +0x0f,0x00,0xf7,0x0f,0x80,0x07,0x98,0x5c,0xeb,0x07,0x20,0xfc,0x00,0x84,0x1f,0x00, +0x0d,0x00,0xf7,0x0f,0x80,0x07,0x98,0x5c,0x03,0x16,0x37,0x00,0x41,0x02,0xdf,0x5b, +0x05,0x0e,0x87,0x01,0x80,0x82,0x20,0x36,0xe1,0x07,0x60,0xfd,0x00,0x84,0x1f,0x00, +0x04,0x00,0xf7,0x0f,0x80,0x07,0x98,0x5c,0x16,0x00,0xf7,0x0f,0x80,0x07,0x98,0x5c, +0x0f,0x0d,0xc7,0x00,0x80,0x07,0xc1,0x5c,0xe1,0x07,0x20,0xfc,0x00,0x84,0x1f,0x00, +0x0d,0x0b,0x87,0x01,0x00,0x82,0x20,0x36,0x04,0x0e,0x87,0x01,0x80,0x7f,0x04,0x36, +0x0e,0x00,0xf7,0x0f,0x80,0x07,0x98,0x5c,0xea,0x07,0x20,0xfc,0x00,0x84,0x1f,0x00, +0x0b,0x0b,0x87,0x01,0x80,0x7f,0x04,0x36,0x16,0x16,0xc7,0x00,0x80,0x0b,0xc1,0x5c, +0x0c,0xff,0x87,0x01,0x80,0x0a,0x00,0x36,0xed,0x07,0x20,0xfc,0x00,0x84,0x1f,0x00, +0x04,0x05,0x47,0x00,0x00,0x88,0xd7,0x5b,0x05,0x05,0xc7,0x00,0xc1,0x07,0xdf,0x5b, +0x0c,0xff,0x87,0x01,0x00,0x07,0x00,0x36,0xed,0x07,0x20,0xfc,0x00,0xb4,0x1f,0x00, +0x0b,0x0d,0xb7,0x00,0x00,0x88,0xd7,0x5b,0x0c,0x0d,0xc7,0x00,0x41,0x0b,0xdf,0x5b, +0x02,0x02,0x47,0x05,0x00,0x80,0x10,0x4c,0xe1,0x07,0x20,0xfc,0x00,0xb0,0x1f,0x00, +0x03,0x03,0x57,0x05,0x00,0x08,0x10,0x4c,0x04,0x04,0x47,0x05,0x00,0x80,0x10,0x4c, +0x06,0x06,0x27,0x00,0x00,0x00,0x10,0x4c,0xe1,0x07,0x20,0xfc,0x00,0x84,0x1f,0x04, +0x05,0x05,0x57,0x05,0x00,0x08,0x10,0x4c,0x07,0x06,0x67,0x05,0x80,0x03,0x62,0x4b, +0x0e,0x11,0x87,0x00,0x00,0x30,0x58,0x5c,0xe1,0x07,0x20,0xfc,0x00,0x84,0x1f,0x00, +0x0a,0x0a,0x77,0x00,0x00,0x30,0x58,0x5c,0x0d,0x13,0x97,0x00,0x00,0x30,0x58,0x5c, +0x08,0x12,0x87,0x00,0x00,0x30,0x58,0x5c,0xe1,0x07,0x60,0xfc,0x00,0x84,0x1f,0x00, +0x09,0x10,0x97,0x00,0x00,0x30,0x58,0x5c,0x10,0x14,0x77,0x00,0x00,0x30,0x58,0x5c, +0x07,0x0d,0xe7,0x00,0x00,0x10,0x68,0x5c,0xe2,0x07,0x60,0xfc,0x00,0x88,0x1f,0x00, +0x0f,0x08,0xa7,0x00,0x00,0x10,0x68,0x5c,0x13,0x10,0x97,0x00,0x00,0x10,0x68,0x5c, +0x07,0x08,0x97,0x00,0x80,0x03,0xa1,0x59,0xf0,0x07,0x20,0x1e,0x00,0x84,0x1f,0x00, +0x08,0x10,0xe7,0x00,0x80,0x07,0xa1,0x59,0x07,0x02,0x37,0xc0,0x00,0x00,0xf9,0xeb, +0x0e,0x0b,0x47,0x05,0x00,0x80,0x10,0x4c,0xf0,0x07,0x40,0x3e,0x00,0xc4,0x0b,0x00, +0x09,0x0d,0xa7,0x00,0x80,0x09,0xa1,0x59,0x08,0x02,0x37,0x00,0x01,0x00,0xf9,0xeb, +0x09,0x02,0x37,0x40,0x01,0x00,0xf9,0xeb,0xf1,0x03,0x00,0x9f,0x00,0x84,0x1f,0x00, +0x07,0x04,0x37,0xc0,0x00,0x00,0xf9,0xeb,0x08,0x04,0x37,0x00,0x01,0x00,0xf9,0xeb, +0x0f,0x0c,0x57,0x05,0x00,0x08,0x10,0x4c,0xf1,0x00,0x20,0x1e,0x00,0xc4,0x03,0x00, +0x09,0x04,0x37,0x40,0x01,0x00,0xf9,0xeb,0x07,0x0e,0x37,0xc0,0x00,0x00,0xf9,0xeb, +0x08,0x0e,0x37,0x00,0x01,0x00,0xf9,0xeb,0xf2,0x00,0xa0,0xff,0x1f,0xf4,0x1f,0x00, +0x09,0x0e,0x37,0x40,0x01,0x00,0xf9,0xeb,0x0f,0x00,0x80,0xbb,0xff,0x0f,0x40,0xe2, +0x0f,0x00,0x07,0x00,0x00,0x00,0xf8,0xf0,0xf0,0x07,0xe0,0xff,0x00,0xf4,0x1f,0x00, +0x07,0x00,0x77,0x05,0x80,0x03,0x62,0x4b,0x00,0x00,0x07,0x00,0x80,0x1b,0xa8,0xf0, +0x0f,0x00,0x08,0x00,0x00,0x00,0x00,0xe3,0xf0,0x07,0x40,0xfe,0x00,0x90,0x1f,0x00, +0x02,0x00,0x47,0x00,0x80,0x00,0x48,0x38,0x00,0x00,0x00,0x18,0x00,0x00,0x90,0xe2, +0x03,0x00,0xc7,0x01,0x00,0x00,0x28,0x38,0xed,0x07,0x40,0xfc,0x00,0xc4,0x1e,0x00, +0x04,0x02,0x07,0x05,0x00,0x80,0x10,0x4c,0x05,0x03,0x17,0x05,0x00,0x08,0x10,0x4c, +0x06,0x04,0x07,0x00,0x00,0x20,0xd4,0xee,0xe1,0x07,0x20,0xfc,0x00,0x90,0x1f,0x00, +0x02,0x00,0x87,0x01,0x80,0x7f,0x00,0x36,0x0a,0xf0,0x87,0x01,0x00,0x00,0x00,0x01, +0x07,0x00,0x87,0x01,0x80,0x7f,0x00,0x36,0xe1,0x07,0x20,0xfc,0x00,0x84,0x1f,0x00, +0x09,0x00,0x87,0x01,0x00,0x01,0x28,0x36,0x03,0x00,0xa7,0x00,0x88,0x7f,0x00,0x5b, +0x08,0x00,0xa7,0x00,0x88,0x7f,0x20,0x5b,0xfd,0x07,0x20,0xfc,0x00,0xb4,0x1f,0x00, +0x02,0x00,0x87,0x01,0x90,0x03,0x20,0x36,0x03,0x09,0x37,0x00,0x20,0x04,0xc0,0x5c, +0x02,0x02,0x47,0x05,0x00,0x80,0x10,0x4c,0xe2,0x07,0x20,0xfe,0x20,0xc8,0x1e,0x00, +0x03,0x03,0x57,0x05,0x00,0x08,0x10,0x4c,0x06,0x02,0x07,0x00,0x00,0x20,0xdc,0xee, +0x09,0x04,0x47,0x00,0x00,0x20,0xd4,0xee,0xf1,0x07,0x21,0xf6,0x00,0xc4,0x1f,0x00, +0x09,0x02,0x47,0x00,0x00,0x20,0xdc,0xee,0x07,0x02,0x07,0x01,0x00,0x20,0xd4,0xee, +0x08,0x02,0xc7,0x00,0x00,0x20,0xd4,0xee,0xf1,0x07,0x40,0x16,0x00,0xc0,0x3f,0x04, +0x06,0x02,0x47,0x01,0x00,0x20,0xd4,0xee,0x04,0x04,0x87,0x00,0x00,0x20,0xd4,0xee, +0x05,0x07,0x77,0x00,0x00,0x10,0x68,0x5c,0xf6,0x00,0xc0,0xfc,0x00,0x98,0x1f,0x00, +0x04,0x02,0x87,0x00,0x00,0x20,0xdc,0xee,0x05,0x08,0x87,0x00,0x80,0x02,0xa0,0x59, +0x05,0x06,0x67,0x00,0x80,0x02,0xa0,0x59,0xed,0x07,0xa0,0xff,0x01,0x84,0x1f,0x00, +0x07,0x05,0xf7,0x0f,0x80,0x83,0xb4,0x5b,0x0f,0x00,0x00,0x03,0x00,0x00,0x40,0xe2, +0x04,0x00,0xf7,0x0f,0x80,0x07,0x98,0x5c,0xe1,0x07,0x00,0xfe,0x00,0xf4,0x1f,0x00, +0x05,0x00,0xf7,0x0f,0x80,0x07,0x98,0x5c,0x06,0x00,0xf7,0x0f,0x80,0x07,0x98,0x5c, +0x0f,0x00,0x07,0x00,0x00,0x00,0xf8,0xf0,0x1d,0x07,0x20,0xfc,0x01,0x84,0x1f,0x00, +0x09,0x05,0x57,0x00,0x00,0x00,0x80,0x50,0x04,0x08,0x97,0x00,0x00,0x10,0x68,0x5c, +0x05,0x07,0x97,0x00,0x00,0x10,0x68,0x5c,0xf0,0x07,0xa0,0xff,0x00,0x84,0x1f,0x00, +0x06,0x06,0x97,0x00,0x00,0x10,0x68,0x5c,0x0f,0x00,0x07,0x00,0x00,0x00,0xf8,0xf0, +0x00,0x00,0x27,0x00,0x00,0x00,0x10,0x4c,0xf1,0x00,0x80,0x3e,0x00,0xc0,0x1f,0x00, +0x04,0x02,0xc7,0x00,0x00,0x20,0xdc,0xee,0x05,0x02,0x07,0x01,0x00,0x20,0xdc,0xee, +0x07,0x00,0x77,0x05,0x80,0x03,0x62,0x4b,0xed,0x02,0xa0,0xff,0x07,0xfc,0x1f,0x00, +0x06,0x02,0x47,0x01,0x00,0x20,0xdc,0xee,0x0f,0x00,0x00,0xe3,0xff,0x0f,0x40,0xe2, +0x0f,0x00,0x07,0x00,0x00,0x00,0x00,0xe3,0xff,0x07,0x00,0xfc,0x00,0x80,0x1f,0x00, +0x0f,0x00,0x87,0xff,0xff,0x0f,0x40,0xe2,0x00,0x0f,0x07,0x00,0x00,0x00,0xb0,0x50, +0x00,0x0f,0x07,0x00,0x00,0x00,0xb0,0x50,0xe0,0x07,0x00,0xfc,0x00,0x80,0x1f,0x00, +0x00,0x0f,0x07,0x00,0x00,0x00,0xb0,0x50,0x00,0x0f,0x07,0x00,0x00,0x00,0xb0,0x50, +0x00,0x0f,0x07,0x00,0x00,0x00,0xb0,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x03,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xa0,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0b,0x00,0x00,0x00,0x03,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xbc,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x13,0x00,0x00,0x00,0x02,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0xa0,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x02,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x36,0x00,0x00,0x00,0x00,0x00,0x00,0x70, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x7c,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x03,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x74,0x00,0x00,0x00,0x00,0x00,0x00,0x70, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x7c,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7d,0x00,0x00,0x00,0x01,0x00,0x00,0x00, +0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x94,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x01,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1b,0x00,0x00,0x00,0x01,0x00,0x00,0x00, +0x06,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x07,0x00,0x00,0x00,0x00,0x00,0x00, +0x03,0x00,0x00,0x00,0x03,0x00,0x00,0x1a,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x05,0x00,0x00,0x00, +0xc0,0x0d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xa8,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0xa8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x01,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x94,0x02,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x20,0x09,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x09,0x00,0x00,0x00,0x00,0x00,0x00, +0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x06,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00 +}; + +#ifdef __cplusplus +} +#endif + diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/cuda/RenderClothNormals_x86.cuh b/PhysX_3.4/Samples/SampleFramework/renderer/src/cuda/RenderClothNormals_x86.cuh new file mode 100644 index 00000000..17b2276e --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/cuda/RenderClothNormals_x86.cuh @@ -0,0 +1,683 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#ifdef __cplusplus +extern "C" { +#endif + +unsigned char computeSmoothNormals[] = { +0x50,0xed,0x55,0xba,0x01,0x00,0x10,0x00,0x38,0x28,0x00,0x00,0x00,0x00,0x00,0x00, +0x02,0x00,0x01,0x01,0x58,0x00,0x00,0x00,0x28,0x0c,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x01,0x00,0x0b,0x00,0x00,0x00, +0x40,0x00,0x00,0x00,0x15,0x00,0x00,0x00,0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x52,0x65,0x6e,0x64,0x65,0x72,0x43,0x6c,0x6f,0x74,0x68,0x4e,0x6f,0x72,0x6d,0x61, +0x6c,0x73,0x2e,0x63,0x75,0x00,0x00,0x00,0x7f,0x45,0x4c,0x46,0x01,0x01,0x01,0x33, +0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0xbe,0x00,0x01,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0xc8,0x0b,0x00,0x00,0x60,0x0a,0x00,0x00,0x0b,0x01,0x0b,0x00, +0x34,0x00,0x20,0x00,0x03,0x00,0x28,0x00,0x09,0x00,0x01,0x00,0x00,0x2e,0x73,0x68, +0x73,0x74,0x72,0x74,0x61,0x62,0x00,0x2e,0x73,0x74,0x72,0x74,0x61,0x62,0x00,0x2e, +0x73,0x79,0x6d,0x74,0x61,0x62,0x00,0x2e,0x74,0x65,0x78,0x74,0x2e,0x63,0x6f,0x6d, +0x70,0x75,0x74,0x65,0x53,0x6d,0x6f,0x6f,0x74,0x68,0x4e,0x6f,0x72,0x6d,0x61,0x6c, +0x73,0x00,0x2e,0x6e,0x76,0x2e,0x69,0x6e,0x66,0x6f,0x2e,0x63,0x6f,0x6d,0x70,0x75, +0x74,0x65,0x53,0x6d,0x6f,0x6f,0x74,0x68,0x4e,0x6f,0x72,0x6d,0x61,0x6c,0x73,0x00, +0x2e,0x6e,0x76,0x2e,0x73,0x68,0x61,0x72,0x65,0x64,0x2e,0x63,0x6f,0x6d,0x70,0x75, +0x74,0x65,0x53,0x6d,0x6f,0x6f,0x74,0x68,0x4e,0x6f,0x72,0x6d,0x61,0x6c,0x73,0x00, +0x2e,0x6e,0x76,0x2e,0x63,0x6f,0x6e,0x73,0x74,0x61,0x6e,0x74,0x31,0x2e,0x63,0x6f, +0x6d,0x70,0x75,0x74,0x65,0x53,0x6d,0x6f,0x6f,0x74,0x68,0x4e,0x6f,0x72,0x6d,0x61, +0x6c,0x73,0x00,0x2e,0x6e,0x76,0x2e,0x6c,0x6f,0x63,0x61,0x6c,0x2e,0x63,0x6f,0x6d, +0x70,0x75,0x74,0x65,0x53,0x6d,0x6f,0x6f,0x74,0x68,0x4e,0x6f,0x72,0x6d,0x61,0x6c, +0x73,0x00,0x00,0x2e,0x73,0x68,0x73,0x74,0x72,0x74,0x61,0x62,0x00,0x2e,0x73,0x74, +0x72,0x74,0x61,0x62,0x00,0x2e,0x73,0x79,0x6d,0x74,0x61,0x62,0x00,0x63,0x6f,0x6d, +0x70,0x75,0x74,0x65,0x53,0x6d,0x6f,0x6f,0x74,0x68,0x4e,0x6f,0x72,0x6d,0x61,0x6c, +0x73,0x00,0x2e,0x74,0x65,0x78,0x74,0x2e,0x63,0x6f,0x6d,0x70,0x75,0x74,0x65,0x53, +0x6d,0x6f,0x6f,0x74,0x68,0x4e,0x6f,0x72,0x6d,0x61,0x6c,0x73,0x00,0x2e,0x6e,0x76, +0x2e,0x69,0x6e,0x66,0x6f,0x2e,0x63,0x6f,0x6d,0x70,0x75,0x74,0x65,0x53,0x6d,0x6f, +0x6f,0x74,0x68,0x4e,0x6f,0x72,0x6d,0x61,0x6c,0x73,0x00,0x2e,0x6e,0x76,0x2e,0x73, +0x68,0x61,0x72,0x65,0x64,0x2e,0x63,0x6f,0x6d,0x70,0x75,0x74,0x65,0x53,0x6d,0x6f, +0x6f,0x74,0x68,0x4e,0x6f,0x72,0x6d,0x61,0x6c,0x73,0x00,0x2e,0x6e,0x76,0x2e,0x63, +0x6f,0x6e,0x73,0x74,0x61,0x6e,0x74,0x31,0x2e,0x63,0x6f,0x6d,0x70,0x75,0x74,0x65, +0x53,0x6d,0x6f,0x6f,0x74,0x68,0x4e,0x6f,0x72,0x6d,0x61,0x6c,0x73,0x00,0x63,0x6f, +0x6e,0x73,0x74,0x00,0x2e,0x6e,0x76,0x2e,0x6c,0x6f,0x63,0x61,0x6c,0x2e,0x63,0x6f, +0x6d,0x70,0x75,0x74,0x65,0x53,0x6d,0x6f,0x6f,0x74,0x68,0x4e,0x6f,0x72,0x6d,0x61, +0x6c,0x73,0x00,0x24,0x63,0x6f,0x6d,0x70,0x75,0x74,0x65,0x53,0x6d,0x6f,0x6f,0x74, +0x68,0x4e,0x6f,0x72,0x6d,0x61,0x6c,0x73,0x24,0x6c,0x6f,0x63,0x61,0x6c,0x00,0x5f, +0x5f,0x63,0x75,0x64,0x61,0x70,0x61,0x72,0x6d,0x5f,0x63,0x6f,0x6d,0x70,0x75,0x74, +0x65,0x53,0x6d,0x6f,0x6f,0x74,0x68,0x4e,0x6f,0x72,0x6d,0x61,0x6c,0x73,0x5f,0x70, +0x61,0x72,0x74,0x69,0x63,0x6c,0x65,0x73,0x00,0x5f,0x5f,0x63,0x75,0x64,0x61,0x70, +0x61,0x72,0x6d,0x5f,0x63,0x6f,0x6d,0x70,0x75,0x74,0x65,0x53,0x6d,0x6f,0x6f,0x74, +0x68,0x4e,0x6f,0x72,0x6d,0x61,0x6c,0x73,0x5f,0x69,0x6e,0x64,0x69,0x63,0x65,0x73, +0x00,0x5f,0x5f,0x63,0x75,0x64,0x61,0x70,0x61,0x72,0x6d,0x5f,0x63,0x6f,0x6d,0x70, +0x75,0x74,0x65,0x53,0x6d,0x6f,0x6f,0x74,0x68,0x4e,0x6f,0x72,0x6d,0x61,0x6c,0x73, +0x5f,0x76,0x65,0x72,0x74,0x69,0x63,0x65,0x73,0x00,0x5f,0x5f,0x63,0x75,0x64,0x61, +0x70,0x61,0x72,0x6d,0x5f,0x63,0x6f,0x6d,0x70,0x75,0x74,0x65,0x53,0x6d,0x6f,0x6f, +0x74,0x68,0x4e,0x6f,0x72,0x6d,0x61,0x6c,0x73,0x5f,0x6e,0x75,0x6d,0x54,0x72,0x69, +0x73,0x00,0x5f,0x5f,0x63,0x75,0x64,0x61,0x70,0x61,0x72,0x6d,0x5f,0x63,0x6f,0x6d, +0x70,0x75,0x74,0x65,0x53,0x6d,0x6f,0x6f,0x74,0x68,0x4e,0x6f,0x72,0x6d,0x61,0x6c, +0x73,0x5f,0x6e,0x75,0x6d,0x50,0x61,0x72,0x74,0x69,0x63,0x6c,0x65,0x73,0x00,0x24, +0x5f,0x5f,0x5f,0x5f,0x63,0x75,0x64,0x61,0x5f,0x5f,0x5f,0x63,0x75,0x64,0x61,0x5f, +0x5f,0x5f,0x54,0x32,0x31,0x36,0x5f,0x34,0x30,0x32,0x30,0x5f,0x5f,0x37,0x30,0x00, +0x24,0x5f,0x5f,0x5f,0x5f,0x63,0x75,0x64,0x61,0x5f,0x5f,0x5f,0x63,0x75,0x64,0x61, +0x5f,0x5f,0x5f,0x54,0x32,0x32,0x31,0x5f,0x35,0x32,0x33,0x32,0x5f,0x5f,0x37,0x31, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x03,0x00,0x06,0x00,0x69,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x03,0x00,0x07,0x00,0x89,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x03,0x00,0x05,0x00,0xb2,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x03,0x00,0x08,0x00,0x1b,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xa8,0x06,0x00,0x00, +0x12,0x10,0x06,0x00,0x03,0x18,0x14,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x04,0x00,0x10,0x00,0x00,0xf0,0x13,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x03,0x00,0x0c,0x00,0x00,0xf0,0x13,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x02,0x00,0x08,0x00,0x00,0xf0,0x13,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x01,0x00,0x04,0x00,0x00,0xf0,0x13,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0xf0,0x13,0x00,0x03,0x1b,0x01,0x00,0x04,0x1e,0x04,0x00, +0x10,0x01,0x00,0x00,0x18,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x10,0x00,0x00,0x00, +0x11,0x00,0x00,0xa0,0x80,0x07,0x00,0x04,0x01,0xd0,0x04,0x30,0xd0,0x07,0x21,0x64, +0xfd,0x01,0x00,0xa0,0xc8,0x47,0x01,0x0c,0x03,0x50,0x01,0xa0,0x00,0x00,0x00,0x00, +0x03,0x50,0x01,0x10,0x00,0x11,0x00,0x00,0x05,0xd0,0x04,0x30,0x80,0x07,0x30,0xc4, +0x09,0xd0,0x03,0x30,0x80,0x07,0x30,0xc4,0x00,0xec,0x00,0x11,0x08,0x82,0x02,0x20, +0x05,0x22,0x18,0x41,0x03,0x00,0x00,0x00,0x01,0x08,0x80,0x60,0x80,0x07,0x40,0x60, +0x09,0xcc,0x00,0x20,0x80,0x87,0x20,0x04,0x15,0x80,0x0c,0x20,0x03,0x00,0x00,0x00, +0x0d,0x80,0x00,0x10,0x03,0x00,0x00,0x00,0x19,0x80,0x10,0x20,0x03,0x00,0x00,0x00, +0x1d,0x80,0x14,0x20,0x03,0x00,0x00,0x00,0x0d,0x0a,0x0e,0xd0,0x80,0x07,0xc0,0xa0, +0x01,0x00,0x00,0x20,0x80,0x47,0x00,0x04,0x0d,0x0c,0x0e,0xd0,0x80,0x07,0xc0,0xa0, +0xfd,0x01,0x02,0x30,0xd8,0x47,0x00,0x64,0x0d,0x0e,0x0e,0xd0,0x80,0x07,0xc0,0xa0, +0x03,0xb0,0x00,0x10,0x80,0x12,0x00,0x00,0x01,0x00,0x00,0xf0,0x02,0x00,0x00,0xe0, +0x03,0xfe,0x1f,0x86,0x00,0x00,0x00,0x00,0xfd,0xcf,0x04,0x30,0xd8,0xc7,0x20,0x64, +0x03,0x80,0x09,0xa0,0x00,0x00,0x00,0x00,0x03,0x80,0x09,0x10,0x80,0x12,0x00,0x00, +0x05,0xce,0x02,0x30,0x80,0x07,0x30,0xc4,0x09,0xce,0x01,0x30,0x80,0x07,0x30,0xc4, +0x00,0xea,0x00,0x11,0x04,0x82,0x02,0x20,0x15,0x22,0x06,0x41,0x03,0x00,0x00,0x00, +0x01,0x08,0x81,0x60,0x80,0x07,0x40,0x60,0x19,0xca,0x00,0x20,0x80,0x47,0x20,0x04, +0x25,0x00,0x0e,0xd0,0x80,0x07,0x40,0x80,0x05,0x80,0x02,0x20,0x03,0x00,0x00,0x00, +0x21,0x02,0x0e,0xd0,0x80,0x07,0x40,0x80,0x05,0x80,0x04,0x20,0x03,0x00,0x00,0x00, +0x1d,0x02,0x0e,0xd0,0x80,0x07,0x40,0x80,0x05,0x08,0x00,0x10,0x80,0xc7,0x00,0x44, +0x0d,0x24,0x84,0x60,0x80,0x47,0x40,0x00,0x2d,0x06,0x0e,0xd0,0x80,0x07,0xc0,0x80, +0x09,0x20,0x84,0x60,0x80,0x47,0x40,0x00,0x29,0x04,0x0e,0xd0,0x80,0x07,0xc0,0x80, +0x05,0x1c,0x10,0x60,0x03,0x00,0x00,0x00,0x39,0x02,0x0e,0xd0,0x80,0x07,0xc0,0x80, +0x31,0x86,0x04,0x20,0x03,0x00,0x00,0x00,0x31,0x18,0x0e,0xd0,0x80,0x07,0xc0,0x80, +0x35,0x84,0x04,0x20,0x03,0x00,0x00,0x00,0x35,0x1a,0x0e,0xd0,0x80,0x07,0xc0,0x80, +0x28,0x14,0x4b,0xb0,0x2c,0x96,0x0e,0xb0,0x0d,0x86,0x08,0x20,0x03,0x00,0x00,0x00, +0x0d,0x06,0x0e,0xd0,0x80,0x07,0xc0,0x80,0x09,0x84,0x08,0x20,0x03,0x00,0x00,0x00, +0x09,0x04,0x0e,0xd0,0x80,0x07,0xc0,0x80,0x39,0x82,0x04,0x20,0x03,0x00,0x00,0x00, +0x39,0x1c,0x0e,0xd0,0x80,0x07,0xc0,0x80,0x05,0x82,0x08,0x20,0x03,0x00,0x00,0x00, +0x05,0x02,0x0e,0xd0,0x80,0x07,0xc0,0x80,0x34,0x1a,0x4c,0xb0,0x30,0x98,0x0e,0xb0, +0x38,0x04,0x43,0xb0,0x3c,0x86,0x01,0xb0,0x09,0x0c,0x00,0x10,0x80,0xc7,0x00,0x44, +0x09,0x24,0x18,0x60,0x03,0x00,0x00,0x00,0x0c,0x1a,0x0f,0xc0,0x08,0x1c,0x00,0x10, +0x0d,0x20,0x00,0x10,0x80,0xc7,0x03,0x00,0x1d,0x84,0x0c,0x20,0x03,0x00,0x00,0x00, +0x0d,0x1c,0x0c,0xe0,0x80,0xc7,0x00,0x08,0x03,0x80,0x04,0xa0,0x00,0x00,0x00,0x00, +0x21,0x84,0x0c,0x20,0x03,0x00,0x00,0x00,0x21,0x10,0x0e,0xd0,0x80,0x07,0xc0,0x80, +0x25,0x10,0x00,0xb0,0x80,0xc7,0x00,0x00,0x25,0x0e,0x08,0xd7,0x88,0x47,0xc2,0xe0, +0xfd,0x13,0x08,0x30,0xd8,0x47,0x01,0x64,0x03,0x20,0x04,0x10,0x80,0x12,0x00,0x00, +0x1d,0x1c,0x0b,0xc0,0x82,0x07,0x00,0x00,0x1d,0x14,0x0f,0xe0,0x80,0xc7,0x01,0x08, +0x03,0x20,0x05,0xa0,0x00,0x00,0x00,0x00,0x21,0x84,0x10,0x20,0x03,0x00,0x00,0x00, +0x25,0x84,0x10,0x20,0x03,0x00,0x00,0x00,0x25,0x12,0x0e,0xd0,0x80,0x07,0xc0,0x80, +0x39,0x12,0x00,0xb0,0x80,0xc7,0x01,0x00,0x39,0x10,0x09,0xd7,0x88,0x87,0xc3,0xe0, +0xfd,0x1d,0x09,0x30,0xd8,0x47,0x01,0x64,0x03,0xc0,0x04,0x10,0x80,0x12,0x00,0x00, +0x21,0x14,0x0c,0xc0,0x82,0x07,0x00,0x00,0x21,0x1a,0x0b,0xe0,0x80,0x07,0x02,0x08, +0x03,0xc0,0x05,0xa0,0x00,0x00,0x00,0x00,0x25,0x84,0x14,0x20,0x03,0x00,0x00,0x00, +0x29,0x84,0x14,0x20,0x03,0x00,0x00,0x00,0x29,0x14,0x0e,0xd0,0x80,0x07,0xc0,0x80, +0x2d,0x14,0x00,0xb0,0x80,0x07,0x02,0x00,0x2d,0x12,0x0a,0xd7,0x88,0xc7,0xc2,0xe0, +0xfd,0x17,0x0a,0x30,0xd8,0x47,0x01,0x64,0x03,0x60,0x05,0x10,0x80,0x12,0x00,0x00, +0x09,0x0c,0x00,0x10,0x82,0xc7,0x00,0x44,0x09,0x06,0x18,0x60,0x03,0x00,0x00,0x00, +0x03,0x60,0x06,0xa0,0x00,0x00,0x00,0x00,0x25,0x84,0x0c,0x20,0x03,0x00,0x00,0x00, +0x29,0x84,0x0c,0x20,0x03,0x00,0x00,0x00,0x29,0x14,0x0e,0xd0,0x80,0x07,0xc0,0x80, +0x2d,0x14,0x00,0xb0,0x80,0xc7,0x00,0x00,0x2d,0x12,0x0a,0xd7,0x88,0xc7,0xc2,0xe0, +0xfd,0x17,0x0a,0x30,0xd8,0x47,0x01,0x64,0x03,0x00,0x06,0x10,0x80,0x12,0x00,0x00, +0x01,0x00,0x00,0xf0,0x02,0x00,0x00,0xe0,0x03,0xf0,0x06,0xa0,0x00,0x00,0x00,0x00, +0x25,0x84,0x10,0x20,0x03,0x00,0x00,0x00,0x29,0x84,0x10,0x20,0x03,0x00,0x00,0x00, +0x29,0x14,0x0e,0xd0,0x80,0x07,0xc0,0x80,0x2d,0x14,0x00,0xb0,0x80,0xc7,0x01,0x00, +0x2d,0x12,0x0a,0xd7,0x88,0xc7,0xc2,0xe0,0xfd,0x17,0x0a,0x30,0xd8,0x47,0x01,0x64, +0x03,0x90,0x06,0x10,0x80,0x12,0x00,0x00,0x01,0x00,0x00,0xf0,0x02,0x00,0x00,0xe0, +0x03,0x80,0x07,0xa0,0x00,0x00,0x00,0x00,0x25,0x84,0x14,0x20,0x03,0x00,0x00,0x00, +0x29,0x84,0x14,0x20,0x03,0x00,0x00,0x00,0x29,0x14,0x0e,0xd0,0x80,0x07,0xc0,0x80, +0x2d,0x14,0x00,0xb0,0x80,0x07,0x02,0x00,0x2d,0x12,0x0a,0xd7,0x88,0xc7,0xc2,0xe0, +0xfd,0x17,0x0a,0x30,0xd8,0x47,0x01,0x64,0x03,0x20,0x07,0x10,0x80,0x12,0x00,0x00, +0x09,0x0c,0x00,0x10,0x82,0xc7,0x00,0x44,0x05,0x04,0x80,0x60,0x80,0x87,0x40,0x00, +0x03,0x20,0x08,0xa0,0x00,0x00,0x00,0x00,0x09,0x82,0x0c,0x20,0x03,0x00,0x00,0x00, +0x25,0x82,0x0c,0x20,0x03,0x00,0x00,0x00,0x25,0x12,0x0e,0xd0,0x80,0x07,0xc0,0x80, +0x29,0x12,0x00,0xb0,0x80,0xc7,0x00,0x00,0x29,0x04,0x09,0xd7,0x88,0x87,0xc2,0xe0, +0xfd,0x15,0x09,0x30,0xd8,0x47,0x01,0x64,0x03,0xc0,0x07,0x10,0x80,0x12,0x00,0x00, +0x01,0x00,0x00,0xf0,0x02,0x00,0x00,0xe0,0x03,0xb0,0x08,0xa0,0x00,0x00,0x00,0x00, +0x09,0x82,0x10,0x20,0x03,0x00,0x00,0x00,0x0d,0x82,0x10,0x20,0x03,0x00,0x00,0x00, +0x0d,0x06,0x0e,0xd0,0x80,0x07,0xc0,0x80,0x25,0x06,0x00,0xb0,0x80,0xc7,0x01,0x00, +0x25,0x04,0x03,0xd7,0x88,0x47,0xc2,0xe0,0xfd,0x13,0x03,0x30,0xd8,0x47,0x01,0x64, +0x03,0x50,0x08,0x10,0x80,0x12,0x00,0x00,0x01,0x00,0x00,0xf0,0x02,0x00,0x00,0xe0, +0x03,0x40,0x09,0xa0,0x00,0x00,0x00,0x00,0x09,0x82,0x14,0x20,0x03,0x00,0x00,0x00, +0x0d,0x82,0x14,0x20,0x03,0x00,0x00,0x00,0x0d,0x06,0x0e,0xd0,0x80,0x07,0xc0,0x80, +0x1d,0x06,0x00,0xb0,0x80,0x07,0x02,0x00,0x1d,0x04,0x03,0xd7,0x88,0xc7,0xc1,0xe0, +0xfd,0x0f,0x03,0x30,0xd8,0x47,0x01,0x64,0x03,0xe0,0x08,0x10,0x80,0x12,0x00,0x00, +0x01,0x00,0x00,0xf0,0x02,0x00,0x00,0xe0,0x01,0x0a,0x00,0x20,0x80,0x07,0x00,0x04, +0xfd,0x01,0x06,0x30,0xd8,0x47,0x00,0x64,0x03,0x00,0x02,0x10,0x80,0x12,0x00,0x00, +0x01,0x00,0x00,0xf0,0x02,0x00,0x00,0xe0,0x03,0xfe,0x1f,0x86,0x00,0x00,0x00,0x00, +0x03,0x00,0x00,0x30,0x00,0x01,0x00,0x00,0x01,0x0c,0x00,0x10,0x80,0xc7,0x00,0x44, +0x01,0x08,0x80,0x60,0x80,0x07,0x40,0x60,0x0d,0x08,0x04,0x30,0x80,0x07,0x10,0xc4, +0x11,0xd0,0x04,0x30,0x80,0x07,0x30,0xc4,0x05,0x22,0x10,0x41,0x03,0x00,0x00,0x00, +0x09,0x22,0x18,0x41,0x03,0x00,0x00,0x00,0x0c,0xe8,0x03,0x21,0x10,0xe8,0x04,0x21, +0x15,0x06,0x0e,0xd0,0x80,0x07,0xc0,0x80,0x15,0x00,0x0e,0xd0,0x80,0x07,0xc0,0xa0, +0x15,0x86,0x04,0x20,0x03,0x00,0x00,0x00,0x15,0x0a,0x0e,0xd0,0x80,0x07,0xc0,0x80, +0x19,0x80,0x04,0x20,0x03,0x00,0x00,0x00,0x15,0x0c,0x0e,0xd0,0x80,0x07,0xc0,0xa0, +0x15,0x86,0x08,0x20,0x03,0x00,0x00,0x00,0x15,0x0a,0x0e,0xd0,0x80,0x07,0xc0,0x80, +0x19,0x80,0x08,0x20,0x03,0x00,0x00,0x00,0x15,0x0c,0x0e,0xd0,0x80,0x07,0xc0,0xa0, +0x15,0x80,0x10,0x20,0x03,0x00,0x00,0x00,0x15,0x0a,0x0e,0xd0,0x80,0x07,0xc0,0x80, +0x03,0x70,0x0c,0xa0,0x00,0x00,0x00,0x00,0x19,0x80,0x0c,0x20,0x03,0x00,0x00,0x00, +0x19,0x0c,0x0e,0xd0,0x80,0x07,0xc0,0x80,0x1d,0x80,0x14,0x20,0x03,0x00,0x00,0x00, +0x1d,0x0e,0x0e,0xd0,0x80,0x07,0xc0,0x80,0x21,0x0a,0x05,0xc0,0x80,0x07,0x00,0x00, +0x21,0x0c,0x06,0xe0,0x80,0x07,0x02,0x00,0x21,0x0e,0x07,0xe0,0x80,0x07,0x02,0x00, +0xfd,0x11,0x7c,0xb0,0xc8,0x07,0x01,0x60,0x03,0x10,0x0c,0x10,0x00,0x01,0x00,0x00, +0x21,0x10,0x00,0x90,0x80,0x07,0x00,0x40,0x20,0x10,0x00,0x90,0x20,0x10,0x00,0x90, +0x19,0x10,0x06,0xc0,0x80,0x07,0x00,0x00,0x19,0x00,0x00,0xd0,0x80,0x07,0xc0,0x60, +0x14,0x10,0x05,0xc0,0x18,0x10,0x07,0xc0,0x15,0x08,0x00,0xd0,0x80,0x07,0xc0,0x60, +0x19,0x10,0x00,0xd0,0x80,0x07,0xc0,0x60,0x05,0xf8,0x00,0x00,0x80,0x07,0x00,0xc0, +0x03,0x70,0x0c,0x10,0x80,0x07,0x00,0x00,0x15,0x80,0x00,0x10,0x03,0x00,0x00,0x00, +0x15,0x18,0x00,0xd0,0x80,0x07,0xc0,0x60,0x15,0x20,0x00,0xd0,0x80,0x07,0xc0,0x60, +0x19,0x80,0x0c,0x10,0x03,0x00,0x00,0x00,0x15,0x28,0x00,0xd0,0x80,0x07,0xc0,0x60, +0x05,0x0c,0x00,0x00,0x80,0x07,0x00,0xc0,0x15,0x00,0x00,0xd4,0x82,0x07,0xc0,0x40, +0x1d,0x08,0x00,0xd4,0x80,0x07,0xc0,0x40,0x19,0x10,0x00,0xd4,0x80,0x07,0xc0,0x40, +0x21,0x80,0x0c,0x20,0x03,0x00,0x00,0x00,0x15,0x10,0x0e,0xd0,0x80,0x07,0xc0,0xa0, +0x15,0x80,0x10,0x20,0x03,0x00,0x00,0x00,0x0d,0x02,0x00,0x20,0x80,0xc7,0x00,0x04, +0x1d,0x0a,0x0e,0xd0,0x80,0x07,0xc0,0xa0,0x15,0x80,0x14,0x20,0x03,0x00,0x00,0x00, +0xfd,0x07,0x04,0x30,0xc8,0x47,0x00,0x64,0x19,0x0a,0x0e,0xd0,0x80,0x07,0xc0,0xa0, +0x01,0x00,0x00,0x20,0x80,0x87,0x00,0x04,0x03,0x20,0x0a,0x10,0x80,0x02,0x00,0x00, +0x01,0x00,0x00,0xf0,0x01,0x00,0x00,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x01,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x34,0x00,0x00,0x00,0xb6,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0b,0x00,0x00,0x00,0x03,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xea,0x00,0x00,0x00,0xff,0x01,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x13,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0xec,0x02,0x00,0x00,0x60,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x04,0x00,0x00,0x00, +0x04,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x36,0x00,0x00,0x00,0x00,0x00,0x00,0x70, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x4c,0x03,0x00,0x00,0x60,0x00,0x00,0x00, +0x03,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x74,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0xac,0x03,0x00,0x00,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x00, +0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1b,0x00,0x00,0x00,0x01,0x00,0x00,0x00, +0x06,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0xb8,0x03,0x00,0x00,0xa8,0x06,0x00,0x00, +0x03,0x00,0x00,0x00,0x05,0x00,0x00,0x10,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x54,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x60,0x0a,0x00,0x00,0x24,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x00, +0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x97,0x00,0x00,0x00,0x08,0x00,0x00,0x00, +0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x0a,0x00,0x00,0x18,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x06,0x00,0x00,0x00,0xc8,0x0b,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x60,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x04,0x00,0x00,0x00, +0x01,0x00,0x00,0x00,0xac,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0xb4,0x06,0x00,0x00,0xb4,0x06,0x00,0x00,0x05,0x00,0x00,0x00,0x04,0x00,0x00,0x00, +0x01,0x00,0x00,0x00,0x60,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x24,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x04,0x00,0x00,0x00, +0x02,0x00,0x01,0x01,0x58,0x00,0x00,0x00,0x70,0x07,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x01,0x00,0x14,0x00,0x00,0x00, +0x40,0x00,0x00,0x00,0x15,0x00,0x00,0x00,0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x52,0x65,0x6e,0x64,0x65,0x72,0x43,0x6c,0x6f,0x74,0x68,0x4e,0x6f,0x72,0x6d,0x61, +0x6c,0x73,0x2e,0x63,0x75,0x00,0x00,0x00,0x7f,0x45,0x4c,0x46,0x01,0x01,0x01,0x33, +0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0xbe,0x00,0x01,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x0c,0x07,0x00,0x00,0xcc,0x05,0x00,0x00,0x14,0x01,0x14,0x00, +0x34,0x00,0x20,0x00,0x03,0x00,0x28,0x00,0x08,0x00,0x01,0x00,0x00,0x2e,0x73,0x68, +0x73,0x74,0x72,0x74,0x61,0x62,0x00,0x2e,0x73,0x74,0x72,0x74,0x61,0x62,0x00,0x2e, +0x73,0x79,0x6d,0x74,0x61,0x62,0x00,0x2e,0x74,0x65,0x78,0x74,0x2e,0x63,0x6f,0x6d, +0x70,0x75,0x74,0x65,0x53,0x6d,0x6f,0x6f,0x74,0x68,0x4e,0x6f,0x72,0x6d,0x61,0x6c, +0x73,0x00,0x2e,0x6e,0x76,0x2e,0x69,0x6e,0x66,0x6f,0x2e,0x63,0x6f,0x6d,0x70,0x75, +0x74,0x65,0x53,0x6d,0x6f,0x6f,0x74,0x68,0x4e,0x6f,0x72,0x6d,0x61,0x6c,0x73,0x00, +0x2e,0x6e,0x76,0x2e,0x73,0x68,0x61,0x72,0x65,0x64,0x2e,0x63,0x6f,0x6d,0x70,0x75, +0x74,0x65,0x53,0x6d,0x6f,0x6f,0x74,0x68,0x4e,0x6f,0x72,0x6d,0x61,0x6c,0x73,0x00, +0x2e,0x6e,0x76,0x2e,0x69,0x6e,0x66,0x6f,0x00,0x2e,0x6e,0x76,0x2e,0x63,0x6f,0x6e, +0x73,0x74,0x61,0x6e,0x74,0x30,0x2e,0x63,0x6f,0x6d,0x70,0x75,0x74,0x65,0x53,0x6d, +0x6f,0x6f,0x74,0x68,0x4e,0x6f,0x72,0x6d,0x61,0x6c,0x73,0x00,0x00,0x2e,0x73,0x68, +0x73,0x74,0x72,0x74,0x61,0x62,0x00,0x2e,0x73,0x74,0x72,0x74,0x61,0x62,0x00,0x2e, +0x73,0x79,0x6d,0x74,0x61,0x62,0x00,0x63,0x6f,0x6d,0x70,0x75,0x74,0x65,0x53,0x6d, +0x6f,0x6f,0x74,0x68,0x4e,0x6f,0x72,0x6d,0x61,0x6c,0x73,0x00,0x2e,0x74,0x65,0x78, +0x74,0x2e,0x63,0x6f,0x6d,0x70,0x75,0x74,0x65,0x53,0x6d,0x6f,0x6f,0x74,0x68,0x4e, +0x6f,0x72,0x6d,0x61,0x6c,0x73,0x00,0x2e,0x6e,0x76,0x2e,0x69,0x6e,0x66,0x6f,0x2e, +0x63,0x6f,0x6d,0x70,0x75,0x74,0x65,0x53,0x6d,0x6f,0x6f,0x74,0x68,0x4e,0x6f,0x72, +0x6d,0x61,0x6c,0x73,0x00,0x2e,0x6e,0x76,0x2e,0x73,0x68,0x61,0x72,0x65,0x64,0x2e, +0x63,0x6f,0x6d,0x70,0x75,0x74,0x65,0x53,0x6d,0x6f,0x6f,0x74,0x68,0x4e,0x6f,0x72, +0x6d,0x61,0x6c,0x73,0x00,0x2e,0x6e,0x76,0x2e,0x69,0x6e,0x66,0x6f,0x00,0x2e,0x6e, +0x76,0x2e,0x63,0x6f,0x6e,0x73,0x74,0x61,0x6e,0x74,0x30,0x2e,0x63,0x6f,0x6d,0x70, +0x75,0x74,0x65,0x53,0x6d,0x6f,0x6f,0x74,0x68,0x4e,0x6f,0x72,0x6d,0x61,0x6c,0x73, +0x00,0x5f,0x70,0x61,0x72,0x61,0x6d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x03,0x00,0x07,0x00,0x92,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x03,0x00,0x06,0x00,0x1b,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x48,0x03,0x00,0x00,0x12,0x10,0x07,0x00,0x04,0x0a,0x08,0x00,0x02,0x00,0x00,0x00, +0x20,0x00,0x14,0x00,0x03,0x19,0x14,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x04,0x00,0x10,0x00,0x00,0xf0,0x11,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x03,0x00,0x0c,0x00,0x00,0xf0,0x11,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x02,0x00,0x08,0x00,0x00,0xf0,0x11,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x01,0x00,0x04,0x00,0x00,0xf0,0x11,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0xf0,0x11,0x00,0x04,0x1e,0x04,0x00,0x8c,0x01,0x00,0x00, +0x04,0x12,0x08,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x11,0x08,0x00, +0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xe4,0x5d,0x00,0x00, +0x04,0x44,0x00,0x28,0x04,0x1c,0x00,0x84,0x00,0x00,0x00,0x2c,0x07,0x00,0x00,0xa0, +0x01,0x00,0x00,0x60,0x03,0xdc,0x01,0xc0,0x00,0x40,0x0e,0x1b,0xe7,0x01,0x00,0x40, +0x01,0x00,0x00,0x40,0xe4,0x1d,0x01,0xa0,0x00,0x40,0x00,0x28,0xe4,0x9d,0x00,0x00, +0x00,0x00,0x00,0x28,0x03,0xdc,0x1f,0x10,0x00,0x00,0x7e,0x20,0xa3,0xdc,0x20,0x60, +0x00,0xc0,0x08,0x20,0x03,0x9c,0x20,0x20,0x00,0x40,0x00,0x48,0x85,0xdc,0x3f,0x30, +0x00,0x00,0x00,0x90,0x03,0xdc,0x21,0xc0,0x00,0x40,0x8e,0x18,0x85,0xdc,0x3f,0x40, +0x00,0x00,0x00,0x90,0x85,0xdc,0x3f,0x50,0x00,0x00,0x00,0x90,0xe7,0x01,0x00,0x20, +0xff,0xff,0x03,0x40,0x13,0xdc,0x1f,0xfc,0x00,0x00,0x7e,0x20,0x07,0x00,0x00,0x80, +0x06,0x00,0x00,0x60,0x04,0xdc,0xff,0xff,0x00,0x00,0xee,0x50,0x03,0xdc,0x01,0xb0, +0x00,0x40,0x0e,0x1b,0xe7,0x01,0x00,0x00,0x06,0x00,0x00,0x40,0xe4,0x5d,0x02,0xa0, +0x00,0x40,0x00,0x28,0xe4,0x9d,0x00,0x00,0x00,0x00,0x00,0x28,0x03,0xdc,0x9f,0xfc, +0x00,0x00,0x7e,0x20,0xe4,0x1d,0x00,0x00,0x00,0x00,0x00,0x40,0xa3,0xdc,0x20,0x0c, +0x00,0xc0,0x00,0x50,0x03,0x9c,0x20,0x20,0x00,0x40,0x00,0x48,0x23,0xdc,0x30,0x90, +0x00,0x40,0x00,0x40,0x03,0xdc,0x21,0xb0,0x00,0x40,0x8e,0x18,0x45,0xdc,0x33,0x10, +0x00,0x00,0x00,0x80,0x45,0x1c,0x32,0x08,0x00,0x00,0x00,0x80,0x45,0x9c,0x32,0x00, +0x00,0x00,0x00,0x80,0x83,0x9c,0xf1,0x80,0x00,0x40,0x00,0x40,0x83,0x5c,0x81,0x80, +0x00,0x40,0x00,0x40,0x83,0x1c,0xa4,0x80,0x00,0x40,0x00,0x40,0x85,0x5c,0x63,0x00, +0x00,0x00,0x00,0x80,0x85,0xdc,0x61,0x10,0x00,0x00,0x00,0x80,0x85,0x9c,0x53,0x00, +0x00,0x00,0x00,0x80,0x85,0xdc,0x52,0x20,0x00,0x00,0x00,0x80,0x85,0xdc,0x00,0x11, +0x00,0x00,0x00,0x80,0x85,0x1c,0x01,0x21,0x00,0x00,0x00,0x80,0x85,0x1c,0x03,0x01, +0x00,0x00,0x00,0x80,0x85,0x9c,0x61,0x20,0x00,0x00,0x00,0x80,0x85,0x5c,0x51,0x10, +0x00,0x00,0x00,0x80,0xa3,0x9c,0xa2,0x60,0x00,0xc0,0x12,0x20,0xa3,0x1c,0x82,0x60, +0x00,0xc0,0x12,0x20,0xa3,0xdc,0xf3,0x60,0x00,0xc0,0x12,0x20,0x20,0xdd,0x71,0x0c, +0x00,0x00,0x00,0x50,0x20,0xdd,0xb2,0x10,0x00,0x00,0x00,0x50,0x20,0x9d,0xe3,0x30, +0x00,0x00,0x00,0x50,0x20,0x1d,0x61,0x10,0x00,0x00,0x00,0x50,0x20,0x1d,0xd3,0x30, +0x00,0x00,0x00,0x50,0x20,0x5d,0x51,0x0c,0x00,0x00,0x00,0x50,0x40,0xdc,0x70,0x2c, +0x00,0x00,0x00,0x58,0x40,0x9c,0x41,0x38,0x00,0x00,0x00,0x58,0x40,0x5c,0xc3,0x14, +0x00,0x00,0x00,0x58,0x40,0xde,0x40,0x14,0x00,0x00,0x06,0x30,0x40,0x1e,0xc1,0x2c, +0x00,0x00,0x0c,0x30,0x40,0x5e,0x71,0x38,0x00,0x00,0x1a,0x30,0x05,0xde,0xa0,0x30, +0x00,0x00,0x00,0x28,0x05,0x1e,0xa1,0x40,0x00,0x00,0x00,0x28,0x05,0x5e,0xa1,0x50, +0x00,0x00,0x00,0x28,0x05,0xde,0x80,0x30,0x00,0x00,0x00,0x28,0x05,0x1e,0x81,0x40, +0x00,0x00,0x00,0x28,0x05,0x5e,0x81,0x50,0x00,0x00,0x00,0x28,0x05,0xde,0xf0,0x30, +0x00,0x00,0x00,0x28,0x05,0x1e,0xf1,0x40,0x00,0x00,0x00,0x28,0x05,0x5e,0xf1,0x50, +0x00,0x00,0x00,0x28,0xe7,0x01,0x00,0x80,0xfa,0xff,0x03,0x40,0x13,0xdc,0x01,0xc0, +0x00,0x40,0x8e,0x18,0x04,0xdc,0xff,0x07,0x00,0xc0,0x00,0x30,0x04,0xdc,0xff,0xff, +0x00,0x00,0xee,0x50,0xe7,0x21,0x00,0x00,0x00,0x00,0x00,0x80,0xe4,0x9d,0x02,0xa0, +0x00,0x40,0x00,0x28,0x03,0xdc,0xaf,0xfc,0x00,0x00,0x7e,0x20,0x83,0x1c,0x02,0x80, +0x00,0x40,0x00,0x40,0xa3,0xdc,0x01,0x60,0x00,0xc0,0x14,0x20,0x85,0x5c,0x81,0x00, +0x00,0x00,0x00,0x80,0x85,0x5c,0x71,0x00,0x00,0x00,0x00,0x90,0x85,0x9c,0x81,0x10, +0x00,0x00,0x00,0x80,0x85,0xdc,0x70,0x40,0x00,0x00,0x00,0x80,0x85,0x9c,0x70,0x30, +0x00,0x00,0x00,0x80,0x85,0x1c,0x71,0x50,0x00,0x00,0x00,0x80,0x85,0x9c,0x71,0x10, +0x00,0x00,0x00,0x90,0x85,0x5c,0x81,0x20,0x00,0x00,0x00,0x80,0x40,0x5c,0x32,0x0c, +0x00,0x00,0x00,0x58,0x40,0x5c,0x22,0x08,0x00,0x00,0x12,0x30,0x40,0x5c,0x42,0x10, +0x00,0x00,0x12,0x30,0x00,0xdc,0x91,0xfc,0x00,0x00,0x0e,0x2a,0x85,0x5c,0x71,0x20, +0x00,0x00,0x00,0x90,0xe7,0x81,0x00,0x80,0x00,0x00,0x00,0x40,0xe4,0xa1,0x00,0xfc, +0x00,0x00,0x00,0x28,0xe4,0xe1,0x00,0xfc,0x00,0x00,0x00,0x28,0xe4,0x21,0x01,0xfc, +0x00,0x00,0x00,0x28,0xe7,0xa1,0x00,0x80,0x00,0x00,0x00,0x40,0x00,0x40,0x91,0x14, +0x00,0x00,0x00,0xc8,0x40,0x80,0x20,0x14,0x00,0x00,0x00,0x58,0x40,0xc0,0x30,0x14, +0x00,0x00,0x00,0x58,0x40,0x00,0x41,0x14,0x00,0x00,0x00,0x58,0x03,0x1c,0x00,0x20, +0x00,0x40,0x00,0x48,0x85,0x9c,0x70,0x30,0x00,0x00,0x00,0x90,0x85,0xdc,0x70,0x40, +0x00,0x00,0x00,0x90,0x03,0xdc,0x01,0xc0,0x00,0x40,0x8e,0x18,0x85,0x1c,0x71,0x50, +0x00,0x00,0x00,0x90,0xe7,0x01,0x00,0x40,0xfc,0xff,0x03,0x40,0xe7,0x1d,0x00,0x00, +0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00, +0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x34,0x00,0x00,0x00, +0xa0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x0b,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0xd4,0x00,0x00,0x00,0xbc,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x13,0x00,0x00,0x00, +0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x90,0x01,0x00,0x00, +0x40,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x04,0x00,0x00,0x00, +0x10,0x00,0x00,0x00,0x36,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0xd0,0x01,0x00,0x00,0x68,0x00,0x00,0x00,0x03,0x00,0x00,0x00, +0x07,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x74,0x00,0x00,0x00, +0x00,0x00,0x00,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x02,0x00,0x00, +0x18,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x7d,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x02,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x50,0x02,0x00,0x00,0x34,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x07,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1b,0x00,0x00,0x00, +0x01,0x00,0x00,0x00,0x06,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x84,0x02,0x00,0x00, +0x48,0x03,0x00,0x00,0x03,0x00,0x00,0x00,0x03,0x00,0x00,0x11,0x04,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x0c,0x07,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x05,0x00,0x00,0x00, +0x04,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x50,0x02,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x7c,0x03,0x00,0x00,0x7c,0x03,0x00,0x00,0x05,0x00,0x00,0x00, +0x04,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x00, +0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x01,0x01,0x58,0x00,0x00,0x00, +0x20,0x09,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x07,0x00,0x01,0x00,0x1e,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x15,0x00,0x00,0x00, +0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x52,0x65,0x6e,0x64,0x65,0x72,0x43,0x6c, +0x6f,0x74,0x68,0x4e,0x6f,0x72,0x6d,0x61,0x6c,0x73,0x2e,0x63,0x75,0x00,0x00,0x00, +0x7f,0x45,0x4c,0x46,0x01,0x01,0x01,0x33,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x02,0x00,0xbe,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x08,0x00,0x00, +0x80,0x07,0x00,0x00,0x1e,0x01,0x1e,0x00,0x34,0x00,0x20,0x00,0x03,0x00,0x28,0x00, +0x08,0x00,0x01,0x00,0x00,0x2e,0x73,0x68,0x73,0x74,0x72,0x74,0x61,0x62,0x00,0x2e, +0x73,0x74,0x72,0x74,0x61,0x62,0x00,0x2e,0x73,0x79,0x6d,0x74,0x61,0x62,0x00,0x2e, +0x74,0x65,0x78,0x74,0x2e,0x63,0x6f,0x6d,0x70,0x75,0x74,0x65,0x53,0x6d,0x6f,0x6f, +0x74,0x68,0x4e,0x6f,0x72,0x6d,0x61,0x6c,0x73,0x00,0x2e,0x6e,0x76,0x2e,0x69,0x6e, +0x66,0x6f,0x2e,0x63,0x6f,0x6d,0x70,0x75,0x74,0x65,0x53,0x6d,0x6f,0x6f,0x74,0x68, +0x4e,0x6f,0x72,0x6d,0x61,0x6c,0x73,0x00,0x2e,0x6e,0x76,0x2e,0x73,0x68,0x61,0x72, +0x65,0x64,0x2e,0x63,0x6f,0x6d,0x70,0x75,0x74,0x65,0x53,0x6d,0x6f,0x6f,0x74,0x68, +0x4e,0x6f,0x72,0x6d,0x61,0x6c,0x73,0x00,0x2e,0x6e,0x76,0x2e,0x69,0x6e,0x66,0x6f, +0x00,0x2e,0x6e,0x76,0x2e,0x63,0x6f,0x6e,0x73,0x74,0x61,0x6e,0x74,0x30,0x2e,0x63, +0x6f,0x6d,0x70,0x75,0x74,0x65,0x53,0x6d,0x6f,0x6f,0x74,0x68,0x4e,0x6f,0x72,0x6d, +0x61,0x6c,0x73,0x00,0x00,0x2e,0x73,0x68,0x73,0x74,0x72,0x74,0x61,0x62,0x00,0x2e, +0x73,0x74,0x72,0x74,0x61,0x62,0x00,0x2e,0x73,0x79,0x6d,0x74,0x61,0x62,0x00,0x63, +0x6f,0x6d,0x70,0x75,0x74,0x65,0x53,0x6d,0x6f,0x6f,0x74,0x68,0x4e,0x6f,0x72,0x6d, +0x61,0x6c,0x73,0x00,0x2e,0x74,0x65,0x78,0x74,0x2e,0x63,0x6f,0x6d,0x70,0x75,0x74, +0x65,0x53,0x6d,0x6f,0x6f,0x74,0x68,0x4e,0x6f,0x72,0x6d,0x61,0x6c,0x73,0x00,0x2e, +0x6e,0x76,0x2e,0x69,0x6e,0x66,0x6f,0x2e,0x63,0x6f,0x6d,0x70,0x75,0x74,0x65,0x53, +0x6d,0x6f,0x6f,0x74,0x68,0x4e,0x6f,0x72,0x6d,0x61,0x6c,0x73,0x00,0x2e,0x6e,0x76, +0x2e,0x73,0x68,0x61,0x72,0x65,0x64,0x2e,0x63,0x6f,0x6d,0x70,0x75,0x74,0x65,0x53, +0x6d,0x6f,0x6f,0x74,0x68,0x4e,0x6f,0x72,0x6d,0x61,0x6c,0x73,0x00,0x2e,0x6e,0x76, +0x2e,0x69,0x6e,0x66,0x6f,0x00,0x2e,0x6e,0x76,0x2e,0x63,0x6f,0x6e,0x73,0x74,0x61, +0x6e,0x74,0x30,0x2e,0x63,0x6f,0x6d,0x70,0x75,0x74,0x65,0x53,0x6d,0x6f,0x6f,0x74, +0x68,0x4e,0x6f,0x72,0x6d,0x61,0x6c,0x73,0x00,0x5f,0x70,0x61,0x72,0x61,0x6d,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x07,0x00, +0x92,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x06,0x00, +0x1b,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x03,0x00,0x00,0x12,0x10,0x07,0x00, +0x04,0x0a,0x08,0x00,0x02,0x00,0x00,0x00,0x40,0x01,0x14,0x00,0x03,0x19,0x14,0x00, +0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x10,0x00,0x00,0xf0,0x11,0x00, +0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x0c,0x00,0x00,0xf0,0x11,0x00, +0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x08,0x00,0x00,0xf0,0x11,0x00, +0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x04,0x00,0x00,0xf0,0x11,0x00, +0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf0,0x11,0x00, +0x04,0x1e,0x04,0x00,0x10,0x02,0x00,0x00,0x04,0x12,0x08,0x00,0x03,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x04,0x11,0x08,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0xf7,0x42,0x80,0xc2,0x22,0x42,0xf0,0x22,0xe4,0x5d,0x00,0x10,0x01,0x40,0x00,0x28, +0x04,0x1c,0x00,0x84,0x00,0x00,0x00,0x2c,0x07,0x00,0x00,0xc0,0x01,0x00,0x00,0x60, +0x03,0xdc,0x01,0x40,0x05,0x40,0x0e,0x1b,0xe7,0x01,0x00,0x40,0x01,0x00,0x00,0x40, +0xe4,0x9d,0x00,0x00,0x00,0x00,0x00,0x28,0xe4,0x1d,0x01,0x20,0x05,0x40,0x00,0x28, +0x47,0x80,0x42,0xe0,0xe2,0x42,0xe0,0x22,0xa3,0xdc,0x20,0x60,0x00,0xc0,0x08,0x20, +0x03,0x9c,0x20,0xa0,0x00,0x40,0x00,0x48,0x85,0xdc,0x3f,0x30,0x00,0x00,0x00,0x90, +0x03,0xdc,0x21,0x40,0x05,0x40,0x8e,0x18,0x85,0xdc,0x3f,0x40,0x00,0x00,0x00,0x90, +0x85,0xdc,0x3f,0x50,0x00,0x00,0x00,0x90,0xe7,0x01,0x00,0x00,0xff,0xff,0x03,0x40, +0x07,0x10,0x43,0xc0,0x22,0x42,0xf0,0x22,0xf4,0x1d,0x00,0x00,0x00,0x00,0x00,0x40, +0x04,0x1c,0x00,0x00,0x00,0xc0,0x0e,0x50,0x03,0xdc,0x01,0x30,0x05,0x40,0x0e,0x1b, +0x07,0x00,0x00,0xe0,0x06,0x00,0x00,0x60,0xe7,0x01,0x00,0xa0,0x06,0x00,0x00,0x40, +0xe4,0x9d,0x00,0x00,0x00,0x00,0x00,0x28,0xe4,0xdd,0x00,0x20,0x05,0x40,0x00,0x28, +0x47,0x80,0x82,0x42,0x70,0x43,0x30,0x22,0xa3,0x1c,0x21,0x0c,0x00,0xc0,0x00,0x50, +0x03,0x9c,0x20,0xa0,0x00,0x40,0x00,0x48,0x23,0x9c,0x41,0x10,0x05,0x40,0x00,0x40, +0x45,0xdc,0x63,0x00,0x00,0x00,0x00,0x80,0x03,0xdc,0x21,0x30,0x05,0x40,0x8e,0x18, +0x45,0x1c,0x61,0x08,0x00,0x00,0x00,0x80,0x83,0x5c,0xf4,0x00,0x05,0x40,0x00,0x40, +0x37,0x43,0x30,0x42,0x40,0x42,0x70,0x23,0x45,0x5c,0x61,0x10,0x00,0x00,0x00,0x80, +0x85,0xdc,0x12,0x21,0x00,0x00,0x00,0x80,0x83,0x9c,0x44,0x00,0x05,0x40,0x00,0x40, +0x83,0x1c,0x54,0x00,0x05,0x40,0x00,0x40,0x85,0x5c,0x13,0x11,0x00,0x00,0x00,0x80, +0x85,0x1c,0x23,0x21,0x00,0x00,0x00,0x80,0xa3,0x1c,0x41,0x60,0x00,0xc0,0x06,0x20, +0x47,0x70,0x43,0x30,0x32,0x32,0xf2,0x22,0x85,0x9c,0x03,0x11,0x00,0x00,0x00,0x80, +0x20,0xdd,0xc4,0x2c,0x00,0x00,0x00,0x50,0x85,0x9c,0x02,0x21,0x00,0x00,0x00,0x80, +0x20,0x1d,0xe3,0x34,0x00,0x00,0x00,0x50,0x85,0x5c,0x22,0x11,0x00,0x00,0x00,0x80, +0x85,0xdc,0x11,0x01,0x00,0x00,0x00,0x80,0x85,0x1c,0x22,0x01,0x00,0x00,0x00,0x80, +0x47,0x00,0x02,0x52,0x42,0x80,0x82,0x22,0x20,0x5d,0x93,0x34,0x00,0x00,0x00,0x50, +0x85,0x9c,0x01,0x01,0x00,0x00,0x00,0x80,0xa3,0x5c,0xf2,0x60,0x00,0xc0,0x06,0x20, +0x20,0xdd,0xa2,0x2c,0x00,0x00,0x00,0x50,0x40,0x9c,0xc2,0x4c,0x00,0x00,0x00,0x58, +0x20,0xdd,0x83,0x1c,0x00,0x00,0x00,0x50,0x40,0x1e,0xb2,0x34,0x00,0x00,0x14,0x30, +0x47,0x00,0x82,0x42,0x30,0x42,0x02,0x22,0x20,0x9d,0x62,0x1c,0x00,0x00,0x00,0x50, +0x05,0x1e,0x92,0x30,0x00,0x00,0x00,0x28,0x40,0x9c,0xb1,0x3c,0x00,0x00,0x00,0x58, +0x40,0x9e,0xa1,0x4c,0x00,0x00,0x0c,0x30,0x40,0x9c,0xa2,0x34,0x00,0x00,0x00,0x58, +0xa3,0x5c,0x51,0x60,0x00,0xc0,0x06,0x20,0x05,0x9e,0x91,0x40,0x00,0x00,0x00,0x28, +0xd7,0xe2,0xe2,0xe2,0xe2,0xe2,0xe2,0x22,0x40,0xde,0xc1,0x3c,0x00,0x00,0x14,0x30, +0x05,0xde,0x91,0x50,0x00,0x00,0x00,0x28,0x05,0x1e,0x42,0x30,0x00,0x00,0x00,0x28, +0x05,0x9e,0x41,0x40,0x00,0x00,0x00,0x28,0x05,0xde,0x41,0x50,0x00,0x00,0x00,0x28, +0x05,0x1e,0x52,0x30,0x00,0x00,0x00,0x28,0x05,0x9e,0x51,0x40,0x00,0x00,0x00,0x28, +0x47,0xe0,0xf2,0x12,0xe3,0x42,0xf0,0x22,0x05,0xde,0x51,0x50,0x00,0x00,0x00,0x28, +0xe7,0x01,0x00,0xa0,0xf9,0xff,0x03,0x40,0x13,0xdc,0x01,0x40,0x05,0x40,0x8e,0x18, +0x04,0x1c,0x00,0x00,0x00,0xc0,0x0e,0x50,0xe7,0x21,0x00,0x00,0x00,0x00,0x00,0x80, +0xe4,0xdd,0x02,0x20,0x05,0x40,0x00,0x28,0xe4,0x1d,0x00,0x00,0x00,0x00,0x00,0x40, +0x87,0x42,0x70,0xe3,0x72,0xe3,0x72,0x23,0x83,0xdc,0x01,0x00,0x05,0x40,0x00,0x40, +0x85,0x9c,0x70,0x00,0x00,0x00,0x00,0x80,0xa3,0x9c,0x01,0x60,0x00,0xc0,0x16,0x20, +0x85,0x9c,0x60,0x00,0x00,0x00,0x00,0x90,0x85,0x5c,0x71,0x10,0x00,0x00,0x00,0x80, +0x85,0x5c,0x61,0x10,0x00,0x00,0x00,0x90,0x85,0xdc,0x60,0x40,0x00,0x00,0x00,0x80, +0x47,0x70,0x43,0x70,0x43,0x80,0xe2,0x22,0x85,0x9c,0x60,0x30,0x00,0x00,0x00,0x80, +0x40,0x5c,0x32,0x0c,0x00,0x00,0x00,0x58,0x85,0x1c,0x61,0x50,0x00,0x00,0x00,0x80, +0x40,0x1c,0x22,0x08,0x00,0x00,0x12,0x30,0x85,0x5c,0x71,0x20,0x00,0x00,0x00,0x80, +0x40,0x1c,0x42,0x10,0x00,0x00,0x10,0x30,0x00,0xdc,0x81,0xfc,0x00,0x00,0x0e,0x2a, +0x47,0x00,0x40,0x00,0x42,0x00,0x80,0x22,0x85,0x5c,0x61,0x20,0x00,0x00,0x00,0x90, +0xe7,0x81,0x00,0x80,0x00,0x00,0x00,0x40,0xe4,0xa1,0x00,0xfc,0x00,0x00,0x00,0x28, +0xe4,0xe1,0x00,0xfc,0x00,0x00,0x00,0x28,0xe4,0x21,0x01,0xfc,0x00,0x00,0x00,0x28, +0xe7,0xa1,0x00,0xa0,0x00,0x00,0x00,0x40,0x00,0x40,0x81,0x14,0x00,0x00,0x00,0xc8, +0x47,0x00,0x02,0x00,0xe2,0x42,0xe0,0x22,0x40,0x80,0x20,0x14,0x00,0x00,0x00,0x58, +0x40,0xc0,0x30,0x14,0x00,0x00,0x00,0x58,0x40,0x00,0x41,0x14,0x00,0x00,0x00,0x58, +0x03,0x1c,0x00,0xa0,0x00,0x40,0x00,0x48,0x85,0x9c,0x60,0x30,0x00,0x00,0x00,0x90, +0x03,0xdc,0x01,0x40,0x05,0x40,0x8e,0x18,0x85,0xdc,0x60,0x40,0x00,0x00,0x00,0x90, +0x47,0xe0,0xe2,0x02,0x00,0x00,0x00,0x20,0x85,0x1c,0x61,0x50,0x00,0x00,0x00,0x90, +0xe7,0x01,0x00,0xa0,0xfb,0xff,0x03,0x40,0xe7,0x1d,0x00,0x00,0x00,0x00,0x00,0x80, +0xe7,0x1d,0x00,0xe0,0xff,0xff,0x03,0x40,0xe4,0x1d,0x00,0x00,0x00,0x00,0x00,0x40, +0xe4,0x1d,0x00,0x00,0x00,0x00,0x00,0x40,0xe4,0x1d,0x00,0x00,0x00,0x00,0x00,0x40, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x03,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x34,0x00,0x00,0x00,0xa0,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x0b,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0xd4,0x00,0x00,0x00,0xbc,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x13,0x00,0x00,0x00,0x02,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x90,0x01,0x00,0x00,0x40,0x00,0x00,0x00, +0x02,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x10,0x00,0x00,0x00, +0x36,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0xd0,0x01,0x00,0x00,0x68,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x07,0x00,0x00,0x00, +0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x74,0x00,0x00,0x00,0x00,0x00,0x00,0x70, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x02,0x00,0x00,0x18,0x00,0x00,0x00, +0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x7d,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x50,0x02,0x00,0x00,0x54,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x00,0x00, +0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1b,0x00,0x00,0x00,0x01,0x00,0x00,0x00, +0x06,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0xc0,0x03,0x00,0x00,0xc0,0x03,0x00,0x00, +0x03,0x00,0x00,0x00,0x03,0x00,0x00,0x14,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x06,0x00,0x00,0x00,0xc0,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x60,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x04,0x00,0x00,0x00, +0x01,0x00,0x00,0x00,0x50,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x14,0x05,0x00,0x00,0x14,0x05,0x00,0x00,0x05,0x00,0x00,0x00,0x04,0x00,0x00,0x00, +0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x04,0x00,0x00,0x00, +0x02,0x00,0x01,0x01,0x58,0x00,0x00,0x00,0x20,0x0a,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x01,0x00,0x32,0x00,0x00,0x00, +0x40,0x00,0x00,0x00,0x15,0x00,0x00,0x00,0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x52,0x65,0x6e,0x64,0x65,0x72,0x43,0x6c,0x6f,0x74,0x68,0x4e,0x6f,0x72,0x6d,0x61, +0x6c,0x73,0x2e,0x63,0x75,0x00,0x00,0x00,0x7f,0x45,0x4c,0x46,0x01,0x01,0x01,0x33, +0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0xbe,0x00,0x01,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0xc0,0x09,0x00,0x00,0x80,0x08,0x00,0x00,0x32,0x01,0x32,0x00, +0x34,0x00,0x20,0x00,0x03,0x00,0x28,0x00,0x08,0x00,0x01,0x00,0x00,0x2e,0x73,0x68, +0x73,0x74,0x72,0x74,0x61,0x62,0x00,0x2e,0x73,0x74,0x72,0x74,0x61,0x62,0x00,0x2e, +0x73,0x79,0x6d,0x74,0x61,0x62,0x00,0x2e,0x74,0x65,0x78,0x74,0x2e,0x63,0x6f,0x6d, +0x70,0x75,0x74,0x65,0x53,0x6d,0x6f,0x6f,0x74,0x68,0x4e,0x6f,0x72,0x6d,0x61,0x6c, +0x73,0x00,0x2e,0x6e,0x76,0x2e,0x69,0x6e,0x66,0x6f,0x2e,0x63,0x6f,0x6d,0x70,0x75, +0x74,0x65,0x53,0x6d,0x6f,0x6f,0x74,0x68,0x4e,0x6f,0x72,0x6d,0x61,0x6c,0x73,0x00, +0x2e,0x6e,0x76,0x2e,0x73,0x68,0x61,0x72,0x65,0x64,0x2e,0x63,0x6f,0x6d,0x70,0x75, +0x74,0x65,0x53,0x6d,0x6f,0x6f,0x74,0x68,0x4e,0x6f,0x72,0x6d,0x61,0x6c,0x73,0x00, +0x2e,0x6e,0x76,0x2e,0x69,0x6e,0x66,0x6f,0x00,0x2e,0x6e,0x76,0x2e,0x63,0x6f,0x6e, +0x73,0x74,0x61,0x6e,0x74,0x30,0x2e,0x63,0x6f,0x6d,0x70,0x75,0x74,0x65,0x53,0x6d, +0x6f,0x6f,0x74,0x68,0x4e,0x6f,0x72,0x6d,0x61,0x6c,0x73,0x00,0x00,0x2e,0x73,0x68, +0x73,0x74,0x72,0x74,0x61,0x62,0x00,0x2e,0x73,0x74,0x72,0x74,0x61,0x62,0x00,0x2e, +0x73,0x79,0x6d,0x74,0x61,0x62,0x00,0x63,0x6f,0x6d,0x70,0x75,0x74,0x65,0x53,0x6d, +0x6f,0x6f,0x74,0x68,0x4e,0x6f,0x72,0x6d,0x61,0x6c,0x73,0x00,0x2e,0x74,0x65,0x78, +0x74,0x2e,0x63,0x6f,0x6d,0x70,0x75,0x74,0x65,0x53,0x6d,0x6f,0x6f,0x74,0x68,0x4e, +0x6f,0x72,0x6d,0x61,0x6c,0x73,0x00,0x2e,0x6e,0x76,0x2e,0x69,0x6e,0x66,0x6f,0x2e, +0x63,0x6f,0x6d,0x70,0x75,0x74,0x65,0x53,0x6d,0x6f,0x6f,0x74,0x68,0x4e,0x6f,0x72, +0x6d,0x61,0x6c,0x73,0x00,0x2e,0x6e,0x76,0x2e,0x73,0x68,0x61,0x72,0x65,0x64,0x2e, +0x63,0x6f,0x6d,0x70,0x75,0x74,0x65,0x53,0x6d,0x6f,0x6f,0x74,0x68,0x4e,0x6f,0x72, +0x6d,0x61,0x6c,0x73,0x00,0x2e,0x6e,0x76,0x2e,0x69,0x6e,0x66,0x6f,0x00,0x2e,0x6e, +0x76,0x2e,0x63,0x6f,0x6e,0x73,0x74,0x61,0x6e,0x74,0x30,0x2e,0x63,0x6f,0x6d,0x70, +0x75,0x74,0x65,0x53,0x6d,0x6f,0x6f,0x74,0x68,0x4e,0x6f,0x72,0x6d,0x61,0x6c,0x73, +0x00,0x5f,0x70,0x61,0x72,0x61,0x6d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x03,0x00,0x07,0x00,0x92,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x03,0x00,0x06,0x00,0x1b,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0xc0,0x04,0x00,0x00,0x12,0x10,0x07,0x00,0x04,0x0a,0x08,0x00,0x02,0x00,0x00,0x00, +0x40,0x01,0x14,0x00,0x03,0x19,0x14,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x04,0x00,0x10,0x00,0x00,0xf0,0x11,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x03,0x00,0x0c,0x00,0x00,0xf0,0x11,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x02,0x00,0x08,0x00,0x00,0xf0,0x11,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x01,0x00,0x04,0x00,0x00,0xf0,0x11,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0xf0,0x11,0x00,0x04,0x1e,0x04,0x00,0x10,0x02,0x00,0x00, +0x04,0x1c,0x10,0x00,0x48,0x02,0x00,0x00,0x60,0x03,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x04,0x12,0x08,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x04,0x11,0x08,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xe6,0x07,0x20,0xe2,0x00,0xf4,0x1f,0x00, +0x01,0x00,0x87,0x00,0x80,0x07,0x98,0x4c,0x00,0x00,0x17,0x02,0x00,0x00,0xc8,0xf0, +0x00,0x00,0x00,0x09,0x00,0x00,0x90,0xe2,0xed,0x0f,0xa0,0xff,0x00,0x98,0x1f,0x00, +0x07,0x00,0x47,0x05,0x80,0x03,0x6c,0x4b,0x0f,0x00,0x00,0x07,0x00,0x00,0x40,0xe2, +0x02,0x00,0x07,0x00,0x80,0x07,0x98,0x5c,0xe6,0x07,0xc0,0xfc,0x00,0x88,0x1f,0x00, +0x03,0x00,0x27,0x05,0x80,0x07,0x98,0x4c,0x03,0x02,0x87,0x01,0x80,0x01,0x00,0x36, +0x03,0x02,0x87,0x01,0x90,0x01,0x20,0x36,0xf0,0x07,0x20,0x1e,0x00,0xc4,0x07,0x00, +0x02,0x02,0x27,0x00,0x00,0x00,0x10,0x4c,0xff,0x03,0xc7,0x00,0x00,0x00,0xdc,0xee, +0xff,0x03,0x07,0x01,0x00,0x00,0xdc,0xee,0xf4,0x02,0xa0,0xfd,0x00,0xf4,0xff,0x00, +0xff,0x03,0x47,0x01,0x00,0x00,0xdc,0xee,0x07,0x02,0x47,0x05,0x80,0x03,0x62,0x4b, +0x0f,0x00,0x80,0xfa,0xff,0x0f,0x40,0xe2,0xfd,0x07,0xe0,0xff,0x00,0x84,0x1f,0x00, +0x0f,0x00,0x07,0x00,0x00,0x00,0xf8,0xf0,0x00,0x00,0x07,0x00,0x80,0x1b,0xa8,0xf0, +0x07,0x00,0x37,0x05,0x80,0x03,0x6c,0x4b,0xec,0x07,0xa0,0xff,0x00,0x98,0x1f,0x00, +0x00,0x00,0x80,0x22,0x00,0x00,0x90,0xe2,0x0f,0x00,0x80,0x21,0x00,0x00,0x40,0xe2, +0x02,0x00,0x07,0x00,0x80,0x07,0x98,0x5c,0xe6,0x07,0xc0,0xfc,0x00,0x88,0x1f,0x00, +0x03,0x02,0x37,0x00,0x80,0x7f,0x00,0x36,0x03,0x02,0x37,0x00,0x90,0x01,0x20,0x36, +0x05,0x03,0x17,0x05,0x80,0x00,0x18,0x4c,0xb1,0x07,0x20,0xf6,0x00,0xc8,0x1e,0x00, +0x0e,0x05,0x07,0x00,0x00,0x00,0xd2,0xee,0x04,0x05,0x27,0x00,0x00,0x00,0xd2,0xee, +0x03,0x05,0x47,0x00,0x00,0x00,0xd2,0xee,0xe2,0x07,0x21,0xfe,0x00,0xc4,0x1f,0x00, +0x08,0x0e,0x07,0x05,0x00,0x02,0x18,0x4c,0x06,0x08,0x07,0x00,0x00,0x00,0xd4,0xee, +0x0d,0x08,0x47,0x00,0x00,0x00,0xd4,0xee,0xf1,0x00,0x40,0xfc,0x00,0xc0,0x1f,0x00, +0x0a,0x08,0x87,0x00,0x00,0x00,0xd4,0xee,0x10,0x04,0x07,0x05,0x00,0x02,0x18,0x4c, +0x0f,0x03,0x07,0x05,0x00,0x02,0x18,0x4c,0xb1,0x07,0x20,0xfe,0x00,0xc4,0x1e,0x00, +0x0b,0x10,0x87,0x00,0x00,0x00,0xd4,0xee,0x07,0x10,0x07,0x00,0x00,0x00,0xd4,0xee, +0x09,0x0f,0x87,0x00,0x00,0x00,0xd4,0xee,0xb1,0x07,0xa0,0x37,0x00,0xc4,0x3e,0x00, +0x0c,0x0f,0x47,0x00,0x00,0x00,0xd4,0xee,0x05,0x0f,0x07,0x00,0x00,0x00,0xd4,0xee, +0x08,0x10,0x47,0x00,0x00,0x00,0xd4,0xee,0xe1,0x07,0xc0,0xfc,0x00,0x84,0x1f,0x00, +0x15,0x00,0x27,0x05,0x80,0x07,0x98,0x4c,0x02,0x02,0x27,0x00,0x00,0x00,0x10,0x4c, +0x07,0x02,0x37,0x05,0x80,0x03,0x62,0x4b,0xe1,0x07,0x21,0xfc,0x02,0x84,0x1f,0x00, +0x0b,0x0b,0xa7,0x00,0x00,0x30,0x58,0x5c,0x0f,0x09,0xa7,0x00,0x00,0x30,0x58,0x5c, +0x0a,0x07,0x67,0x00,0x00,0x30,0x58,0x5c,0xe1,0x07,0x20,0xfc,0x00,0x8c,0x1f,0x00, +0x09,0x0c,0xd7,0x00,0x00,0x30,0x58,0x5c,0x11,0x05,0x67,0x00,0x00,0x30,0x58,0x5c, +0x05,0x0e,0x87,0x01,0x80,0x0a,0x00,0x36,0xe1,0x07,0x20,0xfc,0x00,0x84,0x1f,0x00, +0x0c,0x0f,0xa7,0x00,0x00,0x10,0x68,0x5c,0x08,0x08,0xd7,0x00,0x00,0x30,0x58,0x5c, +0x06,0x09,0xb7,0x00,0x00,0x10,0x68,0x5c,0xe3,0x07,0x20,0xfc,0x00,0x84,0x1f,0x00, +0x0d,0x04,0x87,0x01,0x80,0x0a,0x00,0x36,0x07,0x11,0xb7,0x00,0x00,0x06,0xa1,0x59, +0x10,0x11,0x87,0x00,0x00,0x10,0x68,0x5c,0xe1,0x07,0x40,0xfc,0x00,0xc0,0x1f,0x00, +0x05,0x0e,0x87,0x01,0x90,0x02,0x20,0x36,0x06,0x0f,0x87,0x00,0x00,0x03,0xa1,0x59, +0x0c,0x03,0x87,0x01,0x80,0x0a,0x00,0x36,0xf1,0x00,0x00,0xfe,0x00,0xc4,0x07,0x00, +0x06,0x05,0x37,0xc0,0x00,0x00,0xf8,0xeb,0x04,0x04,0x87,0x01,0x90,0x06,0x20,0x36, +0x07,0x05,0x37,0x00,0x01,0x00,0xf8,0xeb,0xe2,0x07,0x20,0x5e,0x00,0xc4,0x0f,0x00, +0x08,0x09,0xa7,0x00,0x00,0x08,0xa1,0x59,0x08,0x05,0x37,0x40,0x01,0x00,0xf8,0xeb, +0x06,0x04,0x37,0xc0,0x00,0x00,0xf8,0xeb,0xf0,0x07,0x20,0x9e,0x00,0xc4,0x03,0x00, +0x03,0x03,0x87,0x01,0x10,0x06,0x20,0x36,0x07,0x04,0x37,0x00,0x01,0x00,0xf8,0xeb, +0x08,0x04,0x37,0x40,0x01,0x00,0xf8,0xeb,0xf1,0x00,0x20,0x1e,0x00,0xc8,0x03,0x00, +0x06,0x03,0x37,0xc0,0x00,0x00,0xf8,0xeb,0x07,0x03,0x37,0x00,0x01,0x00,0xf8,0xeb, +0x08,0x03,0x37,0x40,0x01,0x00,0xf8,0xeb,0xfd,0xff,0xa0,0xff,0x00,0x84,0x1f,0x00, +0x0f,0x00,0x80,0xdf,0xff,0x0f,0x40,0xe2,0x0f,0x00,0x07,0x00,0x00,0x00,0xf8,0xf0, +0x07,0x00,0x47,0x05,0x80,0x03,0x62,0x4b,0xff,0x07,0xa0,0xff,0x00,0xc0,0x1f,0x00, +0x00,0x00,0x07,0x00,0x80,0x1b,0xa8,0xf0,0x0f,0x00,0x08,0x00,0x00,0x00,0x00,0xe3, +0x05,0x00,0x07,0x05,0x00,0x02,0x18,0x4c,0xf2,0x07,0x20,0xf6,0x00,0x98,0x1f,0x00, +0x00,0x00,0x80,0x11,0x00,0x00,0x90,0xe2,0x02,0x05,0x07,0x00,0x00,0x00,0xd4,0xee, +0x03,0x00,0x27,0x05,0x80,0x07,0x98,0x4c,0xe6,0x07,0x40,0xfc,0x00,0xc4,0x1f,0x04, +0x03,0x00,0x87,0x01,0x80,0x01,0x00,0x36,0x07,0x00,0x87,0x01,0x90,0x01,0x20,0x36, +0x02,0x07,0x07,0x00,0x00,0x00,0xdc,0xee,0xb2,0x07,0x20,0xfe,0x20,0xc4,0x1e,0x00, +0x06,0x05,0x47,0x00,0x00,0x00,0xd4,0xee,0x06,0x07,0x47,0x00,0x00,0x00,0xdc,0xee, +0x03,0x07,0x07,0x01,0x00,0x00,0xd4,0xee,0xf1,0x07,0x20,0xfe,0x00,0xc8,0x1e,0x00, +0x02,0x07,0xc7,0x00,0x00,0x00,0xd4,0xee,0x04,0x07,0x47,0x01,0x00,0x00,0xd4,0xee, +0x05,0x05,0x87,0x00,0x00,0x00,0xd4,0xee,0xf0,0x07,0xc1,0x1e,0x00,0x98,0x1f,0x00, +0x08,0x03,0x37,0x00,0x00,0x10,0x68,0x5c,0x05,0x07,0x87,0x00,0x00,0x00,0xdc,0xee, +0x06,0x02,0x27,0x00,0x00,0x04,0xa0,0x59,0xe6,0x07,0xa0,0xfd,0x00,0xf4,0x3f,0x00, +0x06,0x04,0x47,0x00,0x00,0x03,0xa0,0x59,0x07,0x06,0xf7,0x0f,0x80,0x83,0xb4,0x5b, +0x0f,0x00,0x00,0x03,0x00,0x00,0x40,0xe2,0xe1,0x07,0x20,0xfc,0x00,0x84,0x1f,0x00, +0x02,0x00,0xf7,0x0f,0x80,0x07,0x98,0x5c,0x03,0x00,0xf7,0x0f,0x80,0x07,0x98,0x5c, +0x04,0x00,0xf7,0x0f,0x80,0x07,0x98,0x5c,0xfd,0x07,0xa0,0xe3,0x00,0x84,0x3f,0x00, +0x0f,0x00,0x07,0x00,0x00,0x00,0xf8,0xf0,0x05,0x06,0x57,0x00,0x00,0x00,0x80,0x50, +0x02,0x02,0x57,0x00,0x00,0x10,0x68,0x5c,0xe1,0x07,0x00,0xfe,0x00,0xf4,0x1f,0x00, +0x03,0x03,0x57,0x00,0x00,0x10,0x68,0x5c,0x04,0x04,0x57,0x00,0x00,0x10,0x68,0x5c, +0x0f,0x00,0x07,0x00,0x00,0x00,0xf8,0xf0,0xf0,0x07,0x20,0x1e,0x00,0xc4,0x07,0x00, +0x00,0x00,0x27,0x00,0x00,0x00,0x10,0x4c,0x02,0x07,0xc7,0x00,0x00,0x00,0xdc,0xee, +0x03,0x07,0x07,0x01,0x00,0x00,0xdc,0xee,0xf4,0x02,0xa0,0xfd,0x00,0xf4,0xff,0x00, +0x04,0x07,0x47,0x01,0x00,0x00,0xdc,0xee,0x07,0x00,0x47,0x05,0x80,0x03,0x62,0x4b, +0x0f,0x00,0x80,0xe9,0xff,0x0f,0x40,0xe2,0xff,0x07,0xe0,0xff,0x00,0x80,0x1f,0x00, +0x0f,0x00,0x07,0x00,0x00,0x00,0x00,0xe3,0x0f,0x00,0x87,0xff,0xff,0x0f,0x40,0xe2, +0x00,0x0f,0x07,0x00,0x00,0x00,0xb0,0x50,0xe0,0x07,0x00,0xfc,0x00,0x80,0x1f,0x00, +0x00,0x0f,0x07,0x00,0x00,0x00,0xb0,0x50,0x00,0x0f,0x07,0x00,0x00,0x00,0xb0,0x50, +0x00,0x0f,0x07,0x00,0x00,0x00,0xb0,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x01,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x34,0x00,0x00,0x00,0xa0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0b,0x00,0x00,0x00,0x03,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xd4,0x00,0x00,0x00,0xbc,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x13,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x90,0x01,0x00,0x00,0x40,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x02,0x00,0x00,0x00, +0x04,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x36,0x00,0x00,0x00,0x00,0x00,0x00,0x70, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xd0,0x01,0x00,0x00,0x7c,0x00,0x00,0x00, +0x03,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x74,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x4c,0x02,0x00,0x00,0x18,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7d,0x00,0x00,0x00,0x01,0x00,0x00,0x00, +0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x64,0x02,0x00,0x00,0x54,0x01,0x00,0x00, +0x00,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x1b,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x06,0x00,0x10,0x00,0x00,0x00,0x00,0x00, +0xc0,0x03,0x00,0x00,0xc0,0x04,0x00,0x00,0x03,0x00,0x00,0x00,0x03,0x00,0x00,0x16, +0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0xc0,0x09,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x60,0x00,0x00,0x00, +0x05,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x64,0x02,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x14,0x06,0x00,0x00,0x14,0x06,0x00,0x00, +0x05,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x06,0x00,0x00,0x00,0x04,0x00,0x00,0x00 +}; + +#ifdef __cplusplus +} +#endif + diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/cuda/RenderParticles.cu b/PhysX_3.4/Samples/SampleFramework/renderer/src/cuda/RenderParticles.cu new file mode 100644 index 00000000..f78def28 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/cuda/RenderParticles.cu @@ -0,0 +1,163 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#include "PxPhysics.h" +#include "PxVec4.h" +#include "PxVec3.h" +#include "PxVec2.h" +#include "PxMat33.h" +#include "PxStrideIterator.h" + +namespace physx +{ + +template <typename T> +__device__ T* ptrOffset(T* p, PxU32 byteOffset) +{ + return (T*)((unsigned char*)(p) + byteOffset); +} + +#if __CUDA_ARCH__ < 200 +__device__ PxU32 gOffset; +#else +__device__ __shared__ PxU32 gOffset; +#endif + + +// copies orientations and positions to the destination vertex +// buffer based on the validityBitmap state +extern "C" __global__ void updateInstancedVB( + PxVec3* destPositions, + PxVec3* destRotation0, + PxVec3* destRotation1, + PxVec3* destRotation2, + PxU32 destStride, + const PxVec4* srcPositions, + const PxMat33* srcRotations, + const PxU32* validParticleBitmap, + PxU32 validParticleRange) +{ + if (!threadIdx.x) + gOffset = 0; + + __syncthreads(); + + if (validParticleRange) + { + for (PxU32 w=threadIdx.x; w <= (validParticleRange) >> 5; w+=blockDim.x) + { + const PxU32 srcBaseIndex = w << 5; + + // reserve space in the output vertex buffer based on + // population count of validity bitmap (avoids excess atomic ops) + PxU32 destIndex = atomicAdd(&gOffset, __popc(validParticleBitmap[w])); + + for (PxU32 b=validParticleBitmap[w]; b; b &= b-1) + { + const PxU32 index = srcBaseIndex | __ffs(b)-1; + + const PxU32 offset = destIndex*destStride; + + *ptrOffset(destRotation0, offset) = srcRotations[index].column0; + *ptrOffset(destRotation1, offset) = srcRotations[index].column1; + *ptrOffset(destRotation2, offset) = srcRotations[index].column2; + + PxVec3* p = ptrOffset(destPositions, offset); + p->x = srcPositions[index].x; + p->y = srcPositions[index].y; + p->z = srcPositions[index].z; + + ++destIndex; + } + } + } +} + + +// copies positions and alpha to the destination vertex buffer based on +// validity bitmap and particle life times +extern "C" __global__ void updateBillboardVB( + PxVec3* destPositions, + PxU8* destAlphas, + PxU32 destStride, + PxF32 fadingPeriod, + const PxVec4* srcPositions, + const PxReal* srcLifetimes, + const PxU32* validParticleBitmap, + PxU32 validParticleRange) +{ + if (!threadIdx.x) + gOffset = 0; + + __syncthreads(); + + if (validParticleRange) + { + for (PxU32 w=threadIdx.x; w <= (validParticleRange) >> 5; w+=blockDim.x) + { + const PxU32 srcBaseIndex = w << 5; + + // reserve space in the output vertex buffer based on + // population count of validity bitmap (avoids excess atomic ops) + PxU32 destIndex = atomicAdd(&gOffset, __popc(validParticleBitmap[w])); + + for (PxU32 b=validParticleBitmap[w]; b; b &= b-1) + { + PxU32 index = srcBaseIndex | __ffs(b)-1; + + const PxU32 offset = destIndex*destStride; + + // copy position + PxVec3* p = ptrOffset(destPositions, offset); + p->x = srcPositions[index].x; + p->y = srcPositions[index].y; + p->z = srcPositions[index].z; + + // update alpha + if (srcLifetimes) + { + PxU8 lifetime = 0; + if(srcLifetimes[index] >= fadingPeriod) + lifetime = 255; + else + { + if(srcLifetimes[index] <= 0.0f) + lifetime = 0; + else + lifetime = static_cast<PxU8>(srcLifetimes[index] * 255 / fadingPeriod); + } + + destAlphas[destIndex*4] = lifetime; + } + + ++destIndex; + } + } + } +} + +}
\ No newline at end of file diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/cuda/RenderParticles_x64.cuh b/PhysX_3.4/Samples/SampleFramework/renderer/src/cuda/RenderParticles_x64.cuh new file mode 100644 index 00000000..b87fec7c --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/cuda/RenderParticles_x64.cuh @@ -0,0 +1,1201 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#ifdef __cplusplus +extern "C" { +#endif + +unsigned char updateParticleVertexBuffer[] = { +0x50,0xed,0x55,0xba,0x01,0x00,0x10,0x00,0xa0,0x48,0x00,0x00,0x00,0x00,0x00,0x00, +0x02,0x00,0x01,0x01,0x58,0x00,0x00,0x00,0x50,0x13,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x01,0x00,0x0b,0x00,0x00,0x00, +0x40,0x00,0x00,0x00,0x12,0x00,0x00,0x00,0x45,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x52,0x65,0x6e,0x64,0x65,0x72,0x50,0x61,0x72,0x74,0x69,0x63,0x6c,0x65,0x73,0x2e, +0x63,0x75,0x00,0x00,0x00,0x00,0x00,0x00,0x7f,0x45,0x4c,0x46,0x02,0x01,0x01,0x33, +0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0xbe,0x00,0x01,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xa8,0x12,0x00,0x00,0x00,0x00,0x00,0x00, +0xe8,0x0e,0x00,0x00,0x00,0x00,0x00,0x00,0x0b,0x01,0x0b,0x00,0x40,0x00,0x38,0x00, +0x03,0x00,0x40,0x00,0x0f,0x00,0x01,0x00,0x00,0x2e,0x73,0x68,0x73,0x74,0x72,0x74, +0x61,0x62,0x00,0x2e,0x73,0x74,0x72,0x74,0x61,0x62,0x00,0x2e,0x73,0x79,0x6d,0x74, +0x61,0x62,0x00,0x2e,0x74,0x65,0x78,0x74,0x2e,0x75,0x70,0x64,0x61,0x74,0x65,0x49, +0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x64,0x56,0x42,0x00,0x2e,0x6e,0x76,0x2e,0x69, +0x6e,0x66,0x6f,0x2e,0x75,0x70,0x64,0x61,0x74,0x65,0x49,0x6e,0x73,0x74,0x61,0x6e, +0x63,0x65,0x64,0x56,0x42,0x00,0x2e,0x6e,0x76,0x2e,0x73,0x68,0x61,0x72,0x65,0x64, +0x2e,0x75,0x70,0x64,0x61,0x74,0x65,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x64, +0x56,0x42,0x00,0x2e,0x6e,0x76,0x2e,0x63,0x6f,0x6e,0x73,0x74,0x61,0x6e,0x74,0x31, +0x2e,0x75,0x70,0x64,0x61,0x74,0x65,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x64, +0x56,0x42,0x00,0x2e,0x74,0x65,0x78,0x74,0x2e,0x75,0x70,0x64,0x61,0x74,0x65,0x42, +0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x56,0x42,0x00,0x2e,0x6e,0x76,0x2e,0x69, +0x6e,0x66,0x6f,0x2e,0x75,0x70,0x64,0x61,0x74,0x65,0x42,0x69,0x6c,0x6c,0x62,0x6f, +0x61,0x72,0x64,0x56,0x42,0x00,0x2e,0x6e,0x76,0x2e,0x73,0x68,0x61,0x72,0x65,0x64, +0x2e,0x75,0x70,0x64,0x61,0x74,0x65,0x42,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64, +0x56,0x42,0x00,0x2e,0x6e,0x76,0x2e,0x63,0x6f,0x6e,0x73,0x74,0x61,0x6e,0x74,0x31, +0x2e,0x75,0x70,0x64,0x61,0x74,0x65,0x42,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64, +0x56,0x42,0x00,0x2e,0x6e,0x76,0x2e,0x67,0x6c,0x6f,0x62,0x61,0x6c,0x00,0x2e,0x6e, +0x76,0x2e,0x63,0x6f,0x6e,0x73,0x74,0x61,0x6e,0x74,0x31,0x34,0x00,0x2e,0x72,0x65, +0x6c,0x2e,0x6e,0x76,0x2e,0x63,0x6f,0x6e,0x73,0x74,0x61,0x6e,0x74,0x31,0x34,0x00, +0x00,0x2e,0x73,0x68,0x73,0x74,0x72,0x74,0x61,0x62,0x00,0x2e,0x73,0x74,0x72,0x74, +0x61,0x62,0x00,0x2e,0x73,0x79,0x6d,0x74,0x61,0x62,0x00,0x75,0x70,0x64,0x61,0x74, +0x65,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x64,0x56,0x42,0x00,0x2e,0x74,0x65, +0x78,0x74,0x2e,0x75,0x70,0x64,0x61,0x74,0x65,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63, +0x65,0x64,0x56,0x42,0x00,0x2e,0x6e,0x76,0x2e,0x69,0x6e,0x66,0x6f,0x2e,0x75,0x70, +0x64,0x61,0x74,0x65,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x64,0x56,0x42,0x00, +0x2e,0x6e,0x76,0x2e,0x73,0x68,0x61,0x72,0x65,0x64,0x2e,0x75,0x70,0x64,0x61,0x74, +0x65,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x64,0x56,0x42,0x00,0x2e,0x6e,0x76, +0x2e,0x63,0x6f,0x6e,0x73,0x74,0x61,0x6e,0x74,0x31,0x2e,0x75,0x70,0x64,0x61,0x74, +0x65,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x64,0x56,0x42,0x00,0x63,0x6f,0x6e, +0x73,0x74,0x00,0x5f,0x5f,0x63,0x75,0x64,0x61,0x70,0x61,0x72,0x6d,0x5f,0x75,0x70, +0x64,0x61,0x74,0x65,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x64,0x56,0x42,0x5f, +0x64,0x65,0x73,0x74,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x73,0x00,0x5f,0x5f, +0x63,0x75,0x64,0x61,0x70,0x61,0x72,0x6d,0x5f,0x75,0x70,0x64,0x61,0x74,0x65,0x49, +0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x64,0x56,0x42,0x5f,0x64,0x65,0x73,0x74,0x52, +0x6f,0x74,0x61,0x74,0x69,0x6f,0x6e,0x30,0x00,0x5f,0x5f,0x63,0x75,0x64,0x61,0x70, +0x61,0x72,0x6d,0x5f,0x75,0x70,0x64,0x61,0x74,0x65,0x49,0x6e,0x73,0x74,0x61,0x6e, +0x63,0x65,0x64,0x56,0x42,0x5f,0x64,0x65,0x73,0x74,0x52,0x6f,0x74,0x61,0x74,0x69, +0x6f,0x6e,0x31,0x00,0x5f,0x5f,0x63,0x75,0x64,0x61,0x70,0x61,0x72,0x6d,0x5f,0x75, +0x70,0x64,0x61,0x74,0x65,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x64,0x56,0x42, +0x5f,0x64,0x65,0x73,0x74,0x52,0x6f,0x74,0x61,0x74,0x69,0x6f,0x6e,0x32,0x00,0x5f, +0x5f,0x63,0x75,0x64,0x61,0x70,0x61,0x72,0x6d,0x5f,0x75,0x70,0x64,0x61,0x74,0x65, +0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x64,0x56,0x42,0x5f,0x64,0x65,0x73,0x74, +0x53,0x74,0x72,0x69,0x64,0x65,0x00,0x5f,0x5f,0x63,0x75,0x64,0x61,0x70,0x61,0x72, +0x6d,0x5f,0x75,0x70,0x64,0x61,0x74,0x65,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65, +0x64,0x56,0x42,0x5f,0x73,0x72,0x63,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x73, +0x00,0x5f,0x5f,0x63,0x75,0x64,0x61,0x70,0x61,0x72,0x6d,0x5f,0x75,0x70,0x64,0x61, +0x74,0x65,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x64,0x56,0x42,0x5f,0x73,0x72, +0x63,0x52,0x6f,0x74,0x61,0x74,0x69,0x6f,0x6e,0x73,0x00,0x5f,0x5f,0x63,0x75,0x64, +0x61,0x70,0x61,0x72,0x6d,0x5f,0x75,0x70,0x64,0x61,0x74,0x65,0x49,0x6e,0x73,0x74, +0x61,0x6e,0x63,0x65,0x64,0x56,0x42,0x5f,0x76,0x61,0x6c,0x69,0x64,0x50,0x61,0x72, +0x74,0x69,0x63,0x6c,0x65,0x42,0x69,0x74,0x6d,0x61,0x70,0x00,0x5f,0x5f,0x63,0x75, +0x64,0x61,0x70,0x61,0x72,0x6d,0x5f,0x75,0x70,0x64,0x61,0x74,0x65,0x49,0x6e,0x73, +0x74,0x61,0x6e,0x63,0x65,0x64,0x56,0x42,0x5f,0x76,0x61,0x6c,0x69,0x64,0x50,0x61, +0x72,0x74,0x69,0x63,0x6c,0x65,0x52,0x61,0x6e,0x67,0x65,0x00,0x75,0x70,0x64,0x61, +0x74,0x65,0x42,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x56,0x42,0x00,0x2e,0x74, +0x65,0x78,0x74,0x2e,0x75,0x70,0x64,0x61,0x74,0x65,0x42,0x69,0x6c,0x6c,0x62,0x6f, +0x61,0x72,0x64,0x56,0x42,0x00,0x2e,0x6e,0x76,0x2e,0x69,0x6e,0x66,0x6f,0x2e,0x75, +0x70,0x64,0x61,0x74,0x65,0x42,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x56,0x42, +0x00,0x2e,0x6e,0x76,0x2e,0x73,0x68,0x61,0x72,0x65,0x64,0x2e,0x75,0x70,0x64,0x61, +0x74,0x65,0x42,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x56,0x42,0x00,0x2e,0x6e, +0x76,0x2e,0x63,0x6f,0x6e,0x73,0x74,0x61,0x6e,0x74,0x31,0x2e,0x75,0x70,0x64,0x61, +0x74,0x65,0x42,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x56,0x42,0x00,0x5f,0x5f, +0x63,0x75,0x64,0x61,0x70,0x61,0x72,0x6d,0x5f,0x75,0x70,0x64,0x61,0x74,0x65,0x42, +0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x56,0x42,0x5f,0x64,0x65,0x73,0x74,0x50, +0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x73,0x00,0x5f,0x5f,0x63,0x75,0x64,0x61,0x70, +0x61,0x72,0x6d,0x5f,0x75,0x70,0x64,0x61,0x74,0x65,0x42,0x69,0x6c,0x6c,0x62,0x6f, +0x61,0x72,0x64,0x56,0x42,0x5f,0x64,0x65,0x73,0x74,0x41,0x6c,0x70,0x68,0x61,0x73, +0x00,0x5f,0x5f,0x63,0x75,0x64,0x61,0x70,0x61,0x72,0x6d,0x5f,0x75,0x70,0x64,0x61, +0x74,0x65,0x42,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x56,0x42,0x5f,0x64,0x65, +0x73,0x74,0x53,0x74,0x72,0x69,0x64,0x65,0x00,0x5f,0x5f,0x63,0x75,0x64,0x61,0x70, +0x61,0x72,0x6d,0x5f,0x75,0x70,0x64,0x61,0x74,0x65,0x42,0x69,0x6c,0x6c,0x62,0x6f, +0x61,0x72,0x64,0x56,0x42,0x5f,0x66,0x61,0x64,0x69,0x6e,0x67,0x50,0x65,0x72,0x69, +0x6f,0x64,0x00,0x5f,0x5f,0x63,0x75,0x64,0x61,0x70,0x61,0x72,0x6d,0x5f,0x75,0x70, +0x64,0x61,0x74,0x65,0x42,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x56,0x42,0x5f, +0x73,0x72,0x63,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x73,0x00,0x5f,0x5f,0x63, +0x75,0x64,0x61,0x70,0x61,0x72,0x6d,0x5f,0x75,0x70,0x64,0x61,0x74,0x65,0x42,0x69, +0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x56,0x42,0x5f,0x73,0x72,0x63,0x4c,0x69,0x66, +0x65,0x74,0x69,0x6d,0x65,0x73,0x00,0x5f,0x5f,0x63,0x75,0x64,0x61,0x70,0x61,0x72, +0x6d,0x5f,0x75,0x70,0x64,0x61,0x74,0x65,0x42,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72, +0x64,0x56,0x42,0x5f,0x76,0x61,0x6c,0x69,0x64,0x50,0x61,0x72,0x74,0x69,0x63,0x6c, +0x65,0x42,0x69,0x74,0x6d,0x61,0x70,0x00,0x5f,0x5f,0x63,0x75,0x64,0x61,0x70,0x61, +0x72,0x6d,0x5f,0x75,0x70,0x64,0x61,0x74,0x65,0x42,0x69,0x6c,0x6c,0x62,0x6f,0x61, +0x72,0x64,0x56,0x42,0x5f,0x76,0x61,0x6c,0x69,0x64,0x50,0x61,0x72,0x74,0x69,0x63, +0x6c,0x65,0x52,0x61,0x6e,0x67,0x65,0x00,0x2e,0x6e,0x76,0x2e,0x67,0x6c,0x6f,0x62, +0x61,0x6c,0x00,0x5f,0x5a,0x4e,0x35,0x70,0x68,0x79,0x73,0x78,0x37,0x67,0x4f,0x66, +0x66,0x73,0x65,0x74,0x45,0x00,0x2e,0x6e,0x76,0x2e,0x63,0x6f,0x6e,0x73,0x74,0x61, +0x6e,0x74,0x31,0x34,0x00,0x24,0x41,0x44,0x44,0x52,0x45,0x53,0x53,0x24,0x5f,0x5a, +0x4e,0x35,0x70,0x68,0x79,0x73,0x78,0x37,0x67,0x4f,0x66,0x66,0x73,0x65,0x74,0x45, +0x00,0x2e,0x72,0x65,0x6c,0x2e,0x6e,0x76,0x2e,0x63,0x6f,0x6e,0x73,0x74,0x61,0x6e, +0x74,0x31,0x34,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x2d,0x00,0x00,0x00,0x03,0x00,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x03,0x00,0x0c,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x7d,0x00,0x00,0x00,0x03,0x00,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3e,0x02,0x00,0x00,0x03,0x00,0x0b,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x71,0x02,0x00,0x00,0x03,0x00,0x0d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x8e,0x02,0x00,0x00,0x03,0x00,0x08,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x08,0x04,0x00,0x00,0x03,0x00,0x0e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x13,0x04,0x00,0x00,0x01,0x00,0x0e,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x26,0x04,0x00,0x00,0x03,0x00,0x09,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1b,0x00,0x00,0x00,0x12,0x10,0x0a,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x78,0x03,0x00,0x00,0x00,0x00,0x00,0x00, +0x2c,0x02,0x00,0x00,0x12,0x10,0x0b,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x10,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x18,0x44,0x00,0x04,0x17,0x0c,0x00, +0x00,0x00,0x00,0x00,0x08,0x00,0x40,0x00,0x00,0xf0,0x13,0x00,0x04,0x17,0x0c,0x00, +0x00,0x00,0x00,0x00,0x07,0x00,0x38,0x00,0x00,0xf0,0x23,0x00,0x04,0x17,0x0c,0x00, +0x00,0x00,0x00,0x00,0x06,0x00,0x30,0x00,0x00,0xf0,0x23,0x00,0x04,0x17,0x0c,0x00, +0x00,0x00,0x00,0x00,0x05,0x00,0x28,0x00,0x00,0xf0,0x23,0x00,0x04,0x17,0x0c,0x00, +0x00,0x00,0x00,0x00,0x04,0x00,0x20,0x00,0x00,0xf0,0x13,0x00,0x04,0x17,0x0c,0x00, +0x00,0x00,0x00,0x00,0x03,0x00,0x18,0x00,0x00,0xf0,0x23,0x00,0x04,0x17,0x0c,0x00, +0x00,0x00,0x00,0x00,0x02,0x00,0x10,0x00,0x00,0xf0,0x23,0x00,0x04,0x17,0x0c,0x00, +0x00,0x00,0x00,0x00,0x01,0x00,0x08,0x00,0x00,0xf0,0x23,0x00,0x04,0x17,0x0c,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf0,0x23,0x00,0x04,0x1e,0x04,0x00, +0x08,0x01,0x00,0x00,0x03,0x18,0x34,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x07,0x00,0x30,0x00,0x00,0xf0,0x13,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x06,0x00,0x28,0x00,0x00,0xf0,0x23,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x05,0x00,0x20,0x00,0x00,0xf0,0x23,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x04,0x00,0x18,0x00,0x00,0xf0,0x23,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x03,0x00,0x14,0x00,0x00,0xf0,0x13,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x02,0x00,0x10,0x00,0x00,0xf0,0x13,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x01,0x00,0x08,0x00,0x00,0xf0,0x23,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0xf0,0x23,0x00,0x04,0x1e,0x04,0x00,0x10,0x01,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x08,0x00,0x00,0x00, +0x55,0x55,0x55,0x55,0x33,0x33,0x33,0x33,0x0f,0x0f,0x0f,0x0f,0x00,0x00,0x00,0x00, +0x20,0x00,0x00,0x00,0x9e,0x00,0x00,0x00,0x55,0x55,0x55,0x55,0x33,0x33,0x33,0x33, +0x0f,0x0f,0x0f,0x0f,0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x9e,0x00,0x00,0x00, +0x00,0x00,0x7f,0x43,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0xa0,0xc0,0x07,0x00,0x04, +0x09,0x00,0x00,0x10,0x00,0xc5,0x80,0x27,0x05,0x06,0x00,0x10,0x00,0xc5,0x40,0x24, +0x05,0x04,0x0e,0xd0,0x00,0x05,0xc0,0xa0,0x03,0xfe,0x1f,0x86,0x00,0x00,0x00,0x00, +0xfd,0xe9,0x7c,0x30,0xc8,0x87,0x20,0x64,0x03,0x00,0x00,0x30,0x80,0x02,0x00,0x00, +0x0d,0xe8,0x05,0x30,0x80,0x07,0x30,0xe4,0xfd,0x07,0x00,0x30,0xc8,0x47,0x00,0x64, +0x09,0x00,0x00,0x10,0x80,0xc7,0x03,0x04,0x03,0x00,0x00,0x30,0x80,0x02,0x00,0x00, +0x11,0x42,0x00,0xa0,0x80,0x07,0x20,0x04,0x15,0x00,0x02,0x30,0x80,0x07,0x10,0xc4, +0x19,0x08,0x02,0x30,0x80,0x07,0x10,0xc4,0x01,0xe4,0x00,0x20,0x80,0x47,0x21,0x04, +0x05,0x00,0x0e,0xd0,0x80,0x07,0xc0,0x80,0x1d,0x02,0x01,0x30,0x80,0x07,0x10,0xe4, +0x1d,0x0e,0x80,0xd0,0x80,0x07,0x40,0x04,0x05,0x02,0x40,0x20,0x80,0xc7,0x01,0x04, +0x1d,0x02,0x02,0x30,0x80,0x07,0x10,0xe4,0x05,0x02,0x81,0xd0,0x80,0x07,0x40,0x04, +0x1d,0x0e,0x81,0xd0,0x80,0x07,0x40,0x04,0x05,0x02,0x00,0x20,0x80,0xc7,0x01,0x04, +0x1d,0x02,0x04,0x30,0x80,0x07,0x10,0xe4,0x05,0x02,0x00,0x20,0x80,0xc7,0x01,0x04, +0x05,0x02,0x82,0xd0,0x80,0x07,0x40,0x04,0x1d,0x02,0x40,0x40,0x0b,0x08,0x08,0x00, +0x1d,0x0e,0x01,0x30,0x80,0x07,0x10,0xc4,0x1d,0x02,0x00,0x20,0x80,0xc7,0x01,0x04, +0x05,0x00,0x00,0x10,0x80,0xc7,0x80,0x27,0x1d,0x0e,0x18,0x30,0x80,0x07,0x10,0xe4, +0x05,0x02,0x07,0xd7,0x80,0x07,0xc0,0xe0,0x1d,0x00,0x0e,0xd0,0x80,0x07,0xc0,0x80, +0x03,0xa0,0x06,0xa0,0x00,0x00,0x00,0x00,0xfd,0x0f,0x7c,0x30,0xc8,0x87,0x00,0x64, +0x03,0xa0,0x06,0x10,0x80,0x02,0x00,0x00,0x01,0x18,0x00,0x10,0x80,0xc7,0x00,0x44, +0x21,0x04,0x01,0x40,0x80,0x07,0x00,0x00,0x21,0x06,0x00,0x60,0x80,0x07,0x02,0x00, +0x21,0x10,0x10,0x30,0x80,0x07,0x10,0xc4,0x05,0x04,0x00,0x60,0x80,0x07,0x02,0x00, +0x01,0x04,0x05,0x30,0x80,0x07,0x10,0xc4,0x21,0x8e,0x00,0x30,0x03,0x00,0x00,0x00, +0x21,0x10,0x07,0xd0,0xc0,0x07,0x00,0x04,0x21,0x10,0x00,0xa0,0x80,0x46,0x06,0x44, +0x21,0x10,0x17,0x30,0x80,0x06,0x10,0xec,0x21,0x10,0x00,0x31,0x80,0x46,0x41,0x04, +0x21,0x08,0x00,0x10,0x00,0xc1,0x40,0x24,0x29,0xcc,0x00,0x20,0x80,0x47,0x20,0x04, +0x21,0x90,0x1f,0x30,0x03,0x00,0x00,0x00,0x21,0x10,0x00,0xd0,0x80,0x47,0x00,0x04, +0x25,0x10,0x05,0x30,0x80,0x07,0x10,0xc4,0x2d,0x10,0x02,0x30,0x80,0x07,0x10,0xc4, +0x25,0x12,0x00,0x20,0x80,0xc7,0x02,0x04,0x25,0xe0,0x00,0x20,0x80,0x47,0x22,0x04, +0x2d,0x12,0x0e,0xd0,0x80,0x07,0xc0,0x80,0x2d,0x14,0x0e,0xd0,0x80,0x07,0xc0,0xa0, +0x2d,0x92,0x04,0x20,0x03,0x00,0x00,0x00,0x2d,0x16,0x0e,0xd0,0x80,0x07,0xc0,0x80, +0x31,0x94,0x04,0x20,0x03,0x00,0x00,0x00,0x2d,0x18,0x0e,0xd0,0x80,0x07,0xc0,0xa0, +0x2d,0x92,0x08,0x20,0x03,0x00,0x00,0x00,0x2d,0x16,0x0e,0xd0,0x80,0x07,0xc0,0x80, +0x29,0x94,0x08,0x20,0x03,0x00,0x00,0x00,0x2d,0x14,0x0e,0xd0,0x80,0x07,0xc0,0xa0, +0x29,0x92,0x0c,0x20,0x03,0x00,0x00,0x00,0x2d,0x14,0x0e,0xd0,0x80,0x07,0xc0,0x80, +0x29,0xd0,0x00,0x20,0x80,0x47,0x20,0x04,0x2d,0x14,0x0e,0xd0,0x80,0x07,0xc0,0xa0, +0x2d,0x92,0x10,0x20,0x03,0x00,0x00,0x00,0x2d,0x16,0x0e,0xd0,0x80,0x07,0xc0,0x80, +0x31,0x94,0x04,0x20,0x03,0x00,0x00,0x00,0x2d,0x18,0x0e,0xd0,0x80,0x07,0xc0,0xa0, +0x2d,0x92,0x14,0x20,0x03,0x00,0x00,0x00,0x2d,0x16,0x0e,0xd0,0x80,0x07,0xc0,0x80, +0x29,0x94,0x08,0x20,0x03,0x00,0x00,0x00,0x2d,0x14,0x0e,0xd0,0x80,0x07,0xc0,0xa0, +0x29,0x92,0x18,0x20,0x03,0x00,0x00,0x00,0x2d,0x14,0x0e,0xd0,0x80,0x07,0xc0,0x80, +0x29,0xd4,0x00,0x20,0x80,0x47,0x20,0x04,0x2d,0x14,0x0e,0xd0,0x80,0x07,0xc0,0xa0, +0x2d,0x92,0x1c,0x20,0x03,0x00,0x00,0x00,0x2d,0x16,0x0e,0xd0,0x80,0x07,0xc0,0x80, +0x31,0x94,0x04,0x20,0x03,0x00,0x00,0x00,0x2d,0x18,0x0e,0xd0,0x80,0x07,0xc0,0xa0, +0x25,0x92,0x20,0x20,0x03,0x00,0x00,0x00,0x25,0x12,0x0e,0xd0,0x80,0x07,0xc0,0x80, +0x29,0x94,0x08,0x20,0x03,0x00,0x00,0x00,0x21,0x10,0x04,0x30,0x80,0x07,0x10,0xc4, +0x25,0x14,0x0e,0xd0,0x80,0x07,0xc0,0xa0,0x29,0xdc,0x00,0x20,0x80,0x07,0x22,0x04, +0x25,0x14,0x0e,0xd0,0x80,0x07,0xc0,0x80,0x21,0xc8,0x00,0x20,0x80,0x47,0x20,0x04, +0x25,0x10,0x0e,0xd0,0x80,0x07,0xc0,0xa0,0x25,0x94,0x04,0x20,0x03,0x00,0x00,0x00, +0x25,0x12,0x0e,0xd0,0x80,0x07,0xc0,0x80,0x2d,0x90,0x04,0x20,0x03,0x00,0x00,0x00, +0x25,0x16,0x0e,0xd0,0x80,0x07,0xc0,0xa0,0x25,0x94,0x08,0x20,0x03,0x00,0x00,0x00, +0x25,0x12,0x0e,0xd0,0x80,0x07,0xc0,0x80,0x21,0x90,0x08,0x20,0x03,0x00,0x00,0x00, +0x29,0x8e,0x3f,0x20,0xff,0xff,0xff,0x0f,0x1d,0x0e,0x0a,0xd0,0xc0,0x07,0x00,0x04, +0x25,0x10,0x0e,0xd0,0x80,0x07,0xc0,0xa0,0x05,0xd8,0x00,0x20,0x80,0x47,0x20,0x04, +0x03,0xa0,0x02,0x10,0x80,0x02,0x00,0x00,0x09,0x04,0x00,0x20,0x82,0x07,0x01,0x04, +0xfd,0x07,0x02,0x30,0xc8,0x87,0x01,0x64,0x15,0x0a,0x00,0x20,0x80,0x87,0x01,0x04, +0x03,0xe0,0x00,0x10,0x80,0x02,0x00,0x00,0x01,0x00,0x00,0xf0,0x01,0x00,0x00,0xe0, +0x01,0x00,0x00,0xa0,0xc0,0x07,0x00,0x04,0x09,0x00,0x00,0x10,0x00,0xc5,0x80,0x27, +0x05,0x06,0x00,0x10,0x00,0xc5,0x40,0x24,0x05,0x04,0x0e,0xd0,0x00,0x05,0xc0,0xa0, +0x03,0xfe,0x1f,0x86,0x00,0x00,0x00,0x00,0xfd,0xe1,0x7c,0x30,0xc8,0x87,0x20,0x64, +0x03,0x00,0x00,0x30,0x80,0x02,0x00,0x00,0x11,0xe0,0x05,0x30,0x80,0x07,0x30,0xe4, +0xfd,0x09,0x00,0x30,0xc8,0x47,0x00,0x64,0x09,0x00,0x00,0x10,0x80,0xc7,0x03,0x04, +0x03,0x00,0x00,0x30,0x80,0x02,0x00,0x00,0x15,0x42,0x00,0xa0,0x80,0x07,0x20,0x04, +0x19,0x00,0x02,0x30,0x80,0x07,0x10,0xc4,0x1d,0x0a,0x02,0x30,0x80,0x07,0x10,0xc4, +0x01,0xdc,0x00,0x20,0x80,0x87,0x21,0x04,0x05,0x00,0x0e,0xd0,0x80,0x07,0xc0,0x80, +0x0d,0x02,0x01,0x30,0x80,0x07,0x10,0xe4,0x0d,0x06,0x80,0xd0,0x80,0x07,0x40,0x04, +0x05,0x02,0x40,0x20,0x80,0xc7,0x00,0x04,0x0d,0x02,0x02,0x30,0x80,0x07,0x10,0xe4, +0x05,0x02,0x81,0xd0,0x80,0x07,0x40,0x04,0x0d,0x06,0x81,0xd0,0x80,0x07,0x40,0x04, +0x05,0x02,0x00,0x20,0x80,0xc7,0x00,0x04,0x0d,0x02,0x04,0x30,0x80,0x07,0x10,0xe4, +0x05,0x02,0x00,0x20,0x80,0xc7,0x00,0x04,0x05,0x02,0x82,0xd0,0x80,0x07,0x40,0x04, +0x0d,0x02,0x40,0x40,0x0b,0x08,0x08,0x00,0x0d,0x06,0x01,0x30,0x80,0x07,0x10,0xc4, +0x0d,0x02,0x00,0x20,0x80,0xc7,0x00,0x04,0x05,0x00,0x00,0x10,0x80,0xc7,0x80,0x27, +0x0d,0x06,0x18,0x30,0x80,0x07,0x10,0xe4,0x05,0x02,0x03,0xd7,0x80,0x07,0xc0,0xe0, +0x21,0x00,0x0e,0xd0,0x80,0x07,0xc0,0x80,0x03,0xd0,0x05,0xa0,0x00,0x00,0x00,0x00, +0xfd,0x11,0x7c,0x30,0xc8,0x87,0x00,0x64,0x0d,0x02,0x00,0x10,0x80,0xc7,0x03,0x04, +0x03,0xd0,0x05,0x10,0x80,0x02,0x00,0x00,0x01,0x10,0x00,0x10,0x80,0xc7,0x00,0x44, +0x29,0xd8,0x7c,0x30,0x80,0x87,0x20,0x64,0x25,0x04,0x01,0x40,0x80,0x07,0x00,0x00, +0x2d,0xda,0x7c,0x30,0x80,0x87,0x20,0x64,0x25,0x06,0x00,0x60,0x80,0x47,0x02,0x00, +0x29,0x14,0x0b,0xd0,0x80,0x07,0x00,0x04,0x25,0x12,0x10,0x30,0x80,0x07,0x10,0xc4, +0x29,0x00,0x0a,0xd0,0x80,0xc7,0x02,0x04,0x25,0x04,0x00,0x60,0x80,0x47,0x02,0x00, +0xfd,0x15,0x00,0xa0,0xc8,0x47,0x01,0x0c,0x05,0x04,0x05,0x30,0x80,0x07,0x10,0xc4, +0x01,0x90,0x00,0x30,0x03,0x00,0x00,0x00,0x01,0x00,0x08,0xd0,0xd0,0x07,0x00,0x04, +0x01,0x00,0x00,0xa0,0x80,0x56,0x06,0x44,0x01,0x00,0x17,0x30,0x80,0x16,0x10,0xec, +0x01,0x00,0x00,0x31,0x80,0x56,0x41,0x04,0x01,0x08,0x00,0x10,0x00,0xd1,0x40,0x24, +0x01,0x80,0x1f,0x30,0x03,0x00,0x00,0x00,0x01,0x00,0x01,0xd0,0x80,0x47,0x00,0x04, +0x29,0x00,0x04,0x30,0x80,0x07,0x10,0xc4,0x2d,0xd4,0x00,0x20,0x80,0x87,0x22,0x04, +0x31,0x16,0x0e,0xd0,0x80,0x07,0xc0,0x80,0x29,0xc8,0x00,0x20,0x80,0x47,0x22,0x04, +0x31,0x14,0x0e,0xd0,0x80,0x07,0xc0,0xa0,0x31,0x96,0x04,0x20,0x03,0x00,0x00,0x00, +0x31,0x18,0x0e,0xd0,0x80,0x07,0xc0,0x80,0x35,0x94,0x04,0x20,0x03,0x00,0x00,0x00, +0x31,0x1a,0x0e,0xd0,0x80,0x07,0xc0,0xa0,0x2d,0x96,0x08,0x20,0x03,0x00,0x00,0x00, +0x2d,0x16,0x0e,0xd0,0x80,0x07,0xc0,0x80,0x29,0x94,0x08,0x20,0x03,0x00,0x00,0x00, +0x2d,0x14,0x0e,0xd0,0x80,0x07,0xc0,0xa0,0x03,0x80,0x05,0x10,0x00,0x01,0x00,0x00, +0x01,0x00,0x02,0x30,0x80,0x07,0x10,0xc4,0x01,0xd8,0x00,0x20,0x80,0x07,0x20,0x04, +0x29,0x00,0x0e,0xd0,0x80,0x07,0xc0,0x80,0xfd,0xd3,0x0a,0xb0,0xd8,0xc7,0x20,0x60, +0x03,0x50,0x05,0xa0,0x00,0x00,0x00,0x00,0x03,0xe0,0x04,0x10,0x00,0x11,0x00,0x00, +0x01,0x80,0x3f,0x10,0x0f,0x00,0x00,0x00,0x03,0x50,0x05,0x10,0x80,0x07,0x00,0x00, +0xfd,0x15,0x7c,0xb0,0xd8,0xc7,0x00,0x60,0x01,0xf8,0x00,0x10,0x80,0xd6,0x03,0x04, +0x01,0x12,0x00,0x10,0x00,0xd1,0x00,0x44,0x29,0x14,0x86,0xc0,0x00,0x11,0x40,0x00, +0x01,0x00,0x00,0x90,0x00,0x11,0x00,0x00,0x01,0x14,0x00,0xc0,0x00,0x11,0x00,0x00, +0x01,0x00,0x00,0xa0,0x00,0x51,0x06,0x84,0x29,0x06,0x02,0x30,0x82,0x07,0x10,0xc4, +0x29,0xcc,0x00,0x20,0x80,0x87,0x22,0x04,0x01,0x14,0x0e,0xd0,0x80,0x07,0x00,0xa0, +0x01,0x90,0x3f,0x20,0xff,0xff,0xff,0x0f,0x21,0x10,0x00,0xd0,0xd0,0x07,0x00,0x04, +0x25,0xd0,0x00,0x20,0x80,0x47,0x22,0x04,0x0d,0x86,0x01,0x20,0x03,0x00,0x00,0x00, +0x03,0x00,0x03,0x10,0x80,0x12,0x00,0x00,0x09,0x04,0x00,0x20,0x82,0x47,0x01,0x04, +0xfd,0x09,0x02,0x30,0xc8,0x87,0x01,0x64,0x19,0x0c,0x00,0x20,0x80,0xc7,0x01,0x04, +0x03,0xe0,0x00,0x10,0x80,0x02,0x00,0x00,0x01,0x00,0x00,0xf0,0x01,0x00,0x00,0xe0, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x01,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x28,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x0b,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x68,0x01,0x00,0x00,0x00,0x00,0x00,0x00, +0x64,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x13,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xd0,0x05,0x00,0x00,0x00,0x00,0x00,0x00, +0x20,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x09,0x00,0x00,0x00, +0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x33,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf0,0x06,0x00,0x00,0x00,0x00,0x00,0x00, +0x9c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x0a,0x00,0x00,0x00, +0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0xa3,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x8c,0x07,0x00,0x00,0x00,0x00,0x00,0x00, +0x8c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x0b,0x00,0x00,0x00, +0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x15,0x01,0x00,0x00,0x09,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x08,0x00,0x00,0x00,0x00,0x00,0x00, +0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x09,0x00,0x00,0x00, +0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x6b,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x28,0x08,0x00,0x00,0x00,0x00,0x00,0x00, +0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0a,0x00,0x00,0x00, +0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0xdb,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x08,0x00,0x00,0x00,0x00,0x00,0x00, +0x1c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0b,0x00,0x00,0x00, +0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x06,0x01,0x00,0x00,0x01,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x5c,0x08,0x00,0x00,0x00,0x00,0x00,0x00, +0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x1b,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x06,0x00,0x10,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x08,0x00,0x00,0x00,0x00,0x00,0x00, +0x78,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x0a,0x00,0x00,0x0d, +0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x8b,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x06,0x00,0x10,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xd8,0x0b,0x00,0x00,0x00,0x00,0x00,0x00, +0x10,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x0b,0x00,0x00,0x0e, +0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x4e,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xe8,0x0e,0x00,0x00,0x00,0x00,0x00,0x00, +0x54,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0a,0x00,0x00,0x00, +0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0xbe,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xe8,0x0e,0x00,0x00,0x00,0x00,0x00,0x00, +0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0b,0x00,0x00,0x00, +0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0xfb,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xe8,0x0e,0x00,0x00,0x00,0x00,0x00,0x00, +0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x06,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0xa8,0x12,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0xa8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xa8,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x05,0x00,0x00,0x00, +0x28,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x06,0x00,0x00,0x00,0x00,0x00,0x00, +0xc0,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x01,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0xe8,0x0e,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x54,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x01,0x01,0x58,0x00,0x00,0x00, +0x80,0x0e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x07,0x00,0x01,0x00,0x14,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x12,0x00,0x00,0x00, +0x45,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x52,0x65,0x6e,0x64,0x65,0x72,0x50,0x61, +0x72,0x74,0x69,0x63,0x6c,0x65,0x73,0x2e,0x63,0x75,0x00,0x00,0x00,0x00,0x00,0x00, +0x7f,0x45,0x4c,0x46,0x02,0x01,0x01,0x33,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x02,0x00,0xbe,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0xd8,0x0d,0x00,0x00,0x00,0x00,0x00,0x00,0x98,0x0a,0x00,0x00,0x00,0x00,0x00,0x00, +0x14,0x05,0x14,0x00,0x40,0x00,0x38,0x00,0x03,0x00,0x40,0x00,0x0d,0x00,0x01,0x00, +0x00,0x2e,0x73,0x68,0x73,0x74,0x72,0x74,0x61,0x62,0x00,0x2e,0x73,0x74,0x72,0x74, +0x61,0x62,0x00,0x2e,0x73,0x79,0x6d,0x74,0x61,0x62,0x00,0x2e,0x74,0x65,0x78,0x74, +0x2e,0x75,0x70,0x64,0x61,0x74,0x65,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x64, +0x56,0x42,0x00,0x2e,0x6e,0x76,0x2e,0x69,0x6e,0x66,0x6f,0x2e,0x75,0x70,0x64,0x61, +0x74,0x65,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x64,0x56,0x42,0x00,0x2e,0x6e, +0x76,0x2e,0x73,0x68,0x61,0x72,0x65,0x64,0x2e,0x75,0x70,0x64,0x61,0x74,0x65,0x49, +0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x64,0x56,0x42,0x00,0x2e,0x6e,0x76,0x2e,0x69, +0x6e,0x66,0x6f,0x00,0x2e,0x6e,0x76,0x2e,0x63,0x6f,0x6e,0x73,0x74,0x61,0x6e,0x74, +0x30,0x2e,0x75,0x70,0x64,0x61,0x74,0x65,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65, +0x64,0x56,0x42,0x00,0x2e,0x74,0x65,0x78,0x74,0x2e,0x75,0x70,0x64,0x61,0x74,0x65, +0x42,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x56,0x42,0x00,0x2e,0x6e,0x76,0x2e, +0x69,0x6e,0x66,0x6f,0x2e,0x75,0x70,0x64,0x61,0x74,0x65,0x42,0x69,0x6c,0x6c,0x62, +0x6f,0x61,0x72,0x64,0x56,0x42,0x00,0x2e,0x6e,0x76,0x2e,0x73,0x68,0x61,0x72,0x65, +0x64,0x2e,0x75,0x70,0x64,0x61,0x74,0x65,0x42,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72, +0x64,0x56,0x42,0x00,0x2e,0x6e,0x76,0x2e,0x63,0x6f,0x6e,0x73,0x74,0x61,0x6e,0x74, +0x30,0x2e,0x75,0x70,0x64,0x61,0x74,0x65,0x42,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72, +0x64,0x56,0x42,0x00,0x00,0x2e,0x73,0x68,0x73,0x74,0x72,0x74,0x61,0x62,0x00,0x2e, +0x73,0x74,0x72,0x74,0x61,0x62,0x00,0x2e,0x73,0x79,0x6d,0x74,0x61,0x62,0x00,0x75, +0x70,0x64,0x61,0x74,0x65,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x64,0x56,0x42, +0x00,0x2e,0x74,0x65,0x78,0x74,0x2e,0x75,0x70,0x64,0x61,0x74,0x65,0x49,0x6e,0x73, +0x74,0x61,0x6e,0x63,0x65,0x64,0x56,0x42,0x00,0x2e,0x6e,0x76,0x2e,0x69,0x6e,0x66, +0x6f,0x2e,0x75,0x70,0x64,0x61,0x74,0x65,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65, +0x64,0x56,0x42,0x00,0x2e,0x6e,0x76,0x2e,0x73,0x68,0x61,0x72,0x65,0x64,0x2e,0x75, +0x70,0x64,0x61,0x74,0x65,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x64,0x56,0x42, +0x00,0x2e,0x6e,0x76,0x2e,0x69,0x6e,0x66,0x6f,0x00,0x5f,0x5a,0x4e,0x35,0x70,0x68, +0x79,0x73,0x78,0x37,0x67,0x4f,0x66,0x66,0x73,0x65,0x74,0x45,0x00,0x2e,0x6e,0x76, +0x2e,0x63,0x6f,0x6e,0x73,0x74,0x61,0x6e,0x74,0x30,0x2e,0x75,0x70,0x64,0x61,0x74, +0x65,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x64,0x56,0x42,0x00,0x5f,0x70,0x61, +0x72,0x61,0x6d,0x00,0x75,0x70,0x64,0x61,0x74,0x65,0x42,0x69,0x6c,0x6c,0x62,0x6f, +0x61,0x72,0x64,0x56,0x42,0x00,0x2e,0x74,0x65,0x78,0x74,0x2e,0x75,0x70,0x64,0x61, +0x74,0x65,0x42,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x56,0x42,0x00,0x2e,0x6e, +0x76,0x2e,0x69,0x6e,0x66,0x6f,0x2e,0x75,0x70,0x64,0x61,0x74,0x65,0x42,0x69,0x6c, +0x6c,0x62,0x6f,0x61,0x72,0x64,0x56,0x42,0x00,0x2e,0x6e,0x76,0x2e,0x73,0x68,0x61, +0x72,0x65,0x64,0x2e,0x75,0x70,0x64,0x61,0x74,0x65,0x42,0x69,0x6c,0x6c,0x62,0x6f, +0x61,0x72,0x64,0x56,0x42,0x00,0x24,0x75,0x70,0x64,0x61,0x74,0x65,0x42,0x69,0x6c, +0x6c,0x62,0x6f,0x61,0x72,0x64,0x56,0x42,0x24,0x5f,0x5a,0x4e,0x35,0x70,0x68,0x79, +0x73,0x78,0x37,0x67,0x4f,0x66,0x66,0x73,0x65,0x74,0x45,0x00,0x2e,0x6e,0x76,0x2e, +0x63,0x6f,0x6e,0x73,0x74,0x61,0x6e,0x74,0x30,0x2e,0x75,0x70,0x64,0x61,0x74,0x65, +0x42,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x56,0x42,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x2d,0x00,0x00,0x00,0x03,0x00,0x09,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x60,0x00,0x00,0x00,0x03,0x00,0x0b,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x99,0x00,0x00,0x00,0x03,0x00,0x07,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0xd2,0x00,0x00,0x00,0x03,0x00,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x01,0x00,0x00,0x03,0x00,0x0c,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x48,0x01,0x00,0x00,0x03,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1b,0x00,0x00,0x00,0x12,0x10,0x09,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x78,0x02,0x00,0x00,0x00,0x00,0x00,0x00, +0xc0,0x00,0x00,0x00,0x12,0x10,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x70,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x0a,0x08,0x00,0x03,0x00,0x00,0x00, +0x20,0x00,0x44,0x00,0x03,0x19,0x44,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x08,0x00,0x40,0x00,0x00,0xf0,0x11,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x07,0x00,0x38,0x00,0x00,0xf0,0x21,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x06,0x00,0x30,0x00,0x00,0xf0,0x21,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x05,0x00,0x28,0x00,0x00,0xf0,0x21,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x04,0x00,0x20,0x00,0x00,0xf0,0x11,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x03,0x00,0x18,0x00,0x00,0xf0,0x21,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x02,0x00,0x10,0x00,0x00,0xf0,0x21,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x01,0x00,0x08,0x00,0x00,0xf0,0x21,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0xf0,0x21,0x00,0x04,0x1e,0x04,0x00,0x8c,0x01,0x00,0x00, +0x04,0x12,0x08,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x11,0x08,0x00, +0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x12,0x08,0x00,0x07,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x04,0x11,0x08,0x00,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x04,0x0a,0x08,0x00,0x06,0x00,0x00,0x00,0x20,0x00,0x34,0x00,0x03,0x19,0x34,0x00, +0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x30,0x00,0x00,0xf0,0x11,0x00, +0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x28,0x00,0x00,0xf0,0x21,0x00, +0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00,0x05,0x00,0x20,0x00,0x00,0xf0,0x21,0x00, +0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x18,0x00,0x00,0xf0,0x21,0x00, +0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x14,0x00,0x00,0xf0,0x11,0x00, +0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x10,0x00,0x00,0xf0,0x11,0x00, +0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x08,0x00,0x00,0xf0,0x21,0x00, +0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf0,0x21,0x00, +0x04,0x1e,0x04,0x00,0x8c,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0xe4,0x5d,0x00,0x00,0x04,0x44,0x00,0x28,0x04,0xdc,0x02,0x84,0x00,0x00,0x00,0x2c, +0x03,0xdc,0x1f,0xfc,0x00,0x00,0x7e,0x20,0x23,0xdc,0xb1,0xfc,0x00,0x00,0x8e,0x1a, +0x85,0xe0,0xff,0x03,0x00,0x00,0x00,0xc9,0x04,0xdc,0xff,0xff,0x00,0x00,0xee,0x50, +0x23,0xdc,0xf1,0x83,0x01,0x40,0x0e,0x19,0xe7,0x01,0x00,0x00,0x00,0x00,0x00,0x80, +0xe4,0x1d,0x00,0x80,0x01,0x40,0x00,0x28,0x03,0x5c,0x03,0x14,0x00,0xc0,0x00,0x58, +0x03,0xdc,0xb1,0x34,0x00,0x00,0x0e,0x1a,0xe7,0x01,0x00,0x00,0x00,0x00,0x00,0x80, +0xe2,0x9d,0x03,0x10,0x00,0x00,0x00,0x18,0x03,0x9c,0xb0,0x60,0x01,0x80,0x1d,0x20, +0x03,0x1c,0xb3,0x14,0x00,0xc0,0x00,0x60,0x07,0x00,0x00,0x00,0x01,0x00,0x00,0x60, +0x43,0xdc,0xb0,0x70,0x01,0x80,0x9c,0x20,0x85,0x9c,0x22,0x00,0x00,0x00,0x00,0x84, +0x04,0x9c,0xa0,0x28,0x00,0x00,0x00,0x54,0x85,0x1c,0xf0,0x03,0x00,0x00,0x00,0xc4, +0x03,0xc0,0x00,0x08,0x00,0x00,0x00,0x48,0x85,0xc0,0xf0,0x03,0x00,0x00,0x00,0xcc, +0xe7,0x21,0x00,0x80,0xff,0xff,0x03,0x40,0x33,0xdc,0xa1,0xfc,0x00,0x00,0x0e,0x19, +0x07,0x00,0x00,0x60,0x06,0x00,0x00,0x60,0xe7,0x01,0x00,0x20,0x06,0x00,0x00,0x40, +0xe4,0xdd,0x03,0x00,0x01,0x40,0x00,0x28,0xe2,0x1d,0x04,0x90,0x00,0x00,0x00,0x18, +0xe2,0x5d,0x04,0x40,0x00,0x00,0x00,0x18,0x03,0xdc,0xff,0xfc,0x00,0x00,0x7e,0x20, +0x84,0x9f,0x20,0x29,0x00,0x00,0x00,0x1c,0x03,0x9c,0xa0,0x08,0x00,0x00,0x00,0x68, +0x03,0x9c,0x00,0x08,0x00,0x00,0x00,0x78,0x43,0xdc,0x21,0x30,0x00,0x00,0x00,0x68, +0x03,0x9c,0x70,0x40,0x01,0x80,0x21,0x20,0x43,0xdc,0x70,0x50,0x01,0x80,0xa0,0x20, +0xa3,0x1c,0x01,0xa0,0x00,0x80,0x1f,0x20,0x85,0x1c,0x22,0x00,0x00,0x00,0x00,0x84, +0x43,0x5c,0xf1,0xb3,0x00,0x40,0x00,0x48,0x85,0x1c,0x42,0x00,0x00,0x00,0x00,0x94, +0x85,0x9c,0x21,0x10,0x00,0x00,0x00,0x84,0xa3,0x1c,0x02,0xc0,0x00,0x80,0x1f,0x20, +0x43,0x5c,0xf2,0xd3,0x00,0x40,0x00,0x48,0x85,0x9c,0x41,0x10,0x00,0x00,0x00,0x94, +0x85,0x9c,0x24,0x20,0x00,0x00,0x00,0x84,0x85,0x9c,0x44,0x20,0x00,0x00,0x00,0x94, +0x85,0x9c,0x21,0x30,0x00,0x00,0x00,0x84,0x85,0x9c,0x81,0x00,0x00,0x00,0x00,0x94, +0x85,0x1c,0x21,0x40,0x00,0x00,0x00,0x84,0x85,0x1c,0x81,0x10,0x00,0x00,0x00,0x94, +0x85,0x9c,0x24,0x50,0x00,0x00,0x00,0x84,0xa3,0x1c,0x01,0xe0,0x00,0x80,0x1f,0x20, +0x43,0x5c,0xf1,0xf3,0x00,0x40,0x00,0x48,0x85,0x9c,0x84,0x20,0x00,0x00,0x00,0x94, +0x85,0x9c,0x21,0x60,0x00,0x00,0x00,0x84,0x85,0x9c,0x41,0x00,0x00,0x00,0x00,0x94, +0x85,0x1c,0x22,0x70,0x00,0x00,0x00,0x84,0x03,0x9c,0x71,0x20,0x01,0x80,0x23,0x20, +0x43,0xdc,0x71,0x30,0x01,0x80,0xa2,0x20,0x85,0x1c,0x42,0x10,0x00,0x00,0x00,0x94, +0x85,0x5c,0x22,0x80,0x00,0x00,0x00,0x84,0xa3,0x9c,0x00,0x80,0x00,0x80,0x1f,0x20, +0x03,0x1c,0x00,0x04,0x00,0xc0,0x00,0x48,0x43,0xdc,0xf0,0x93,0x00,0x40,0x00,0x48, +0x85,0x5c,0x42,0x20,0x00,0x00,0x00,0x94,0x85,0x1c,0x62,0x00,0x00,0x00,0x00,0x84, +0x85,0x1c,0x22,0x00,0x00,0x00,0x00,0x94,0x85,0x5c,0x61,0x10,0x00,0x00,0x00,0x84, +0x03,0x1c,0xa2,0xfc,0xff,0xff,0x00,0x48,0x03,0x9c,0x82,0x28,0x00,0x00,0x00,0x68, +0x23,0xdc,0xa1,0xfc,0x00,0x00,0x8e,0x1a,0x85,0x5c,0x21,0x10,0x00,0x00,0x00,0x94, +0x85,0x1c,0x61,0x20,0x00,0x00,0x00,0x84,0x85,0x1c,0x21,0x20,0x00,0x00,0x00,0x94, +0xe7,0x01,0x00,0x60,0xfa,0xff,0x03,0x40,0x13,0xdc,0xb2,0x20,0x00,0x40,0x00,0x48, +0x03,0xdc,0xb1,0x34,0x00,0x00,0x8e,0x19,0xe7,0x01,0x00,0xe0,0xf7,0xff,0x03,0x40, +0xe7,0x1d,0x00,0x00,0x00,0x00,0x00,0x80,0xe4,0x5d,0x00,0x00,0x04,0x44,0x00,0x28, +0x04,0x1c,0x00,0x84,0x00,0x00,0x00,0x2c,0x03,0xdc,0x1f,0xfc,0x00,0x00,0x7e,0x20, +0x23,0xdc,0x01,0xfc,0x00,0x00,0x8e,0x1a,0x85,0xe0,0xff,0x03,0x00,0x00,0x00,0xc9, +0x04,0xdc,0xff,0xff,0x00,0x00,0xee,0x50,0x23,0xdc,0xf1,0x43,0x01,0x40,0x0e,0x19, +0xe7,0x01,0x00,0x00,0x00,0x00,0x00,0x80,0xe4,0x9d,0x00,0x40,0x01,0x40,0x00,0x28, +0x03,0x5c,0x22,0x14,0x00,0xc0,0x00,0x58,0x03,0xdc,0x01,0x24,0x00,0x00,0x0e,0x1a, +0xe7,0x01,0x00,0x00,0x00,0x00,0x00,0x80,0xe2,0x9d,0x02,0x10,0x00,0x00,0x00,0x18, +0x03,0x9c,0x00,0x20,0x01,0x80,0x15,0x20,0x03,0x9c,0x01,0x14,0x00,0xc0,0x00,0x60, +0x07,0x00,0x00,0x00,0x01,0x00,0x00,0x60,0x43,0xdc,0x00,0x30,0x01,0x80,0x94,0x20, +0x85,0x1c,0x22,0x00,0x00,0x00,0x00,0x84,0x04,0x9c,0x80,0x20,0x00,0x00,0x00,0x54, +0x85,0xdc,0xf1,0x03,0x00,0x00,0x00,0xc4,0x03,0xc0,0x70,0x08,0x00,0x00,0x00,0x48, +0x85,0xc0,0xf0,0x03,0x00,0x00,0x00,0xcc,0xe7,0x21,0x00,0x80,0xff,0xff,0x03,0x40, +0x33,0xdc,0x81,0xfc,0x00,0x00,0x0e,0x19,0x07,0x00,0x00,0x40,0x06,0x00,0x00,0x60, +0xe7,0x01,0x00,0x00,0x06,0x00,0x00,0x40,0xe4,0x5d,0x03,0x80,0x00,0x40,0x00,0x28, +0xe4,0x1d,0x03,0x10,0x01,0x40,0x00,0x28,0xe2,0xdd,0x02,0x40,0x00,0x00,0x00,0x18, +0x03,0xdc,0xcf,0x34,0x00,0x00,0x7e,0x20,0x84,0x9f,0x20,0x21,0x00,0x00,0x00,0x1c, +0x03,0x9c,0x80,0x08,0x00,0x00,0x00,0x68,0x03,0x9c,0x00,0x08,0x00,0x00,0x00,0x78, +0x43,0x1c,0x24,0x18,0x00,0x00,0x00,0x68,0x03,0x1c,0x01,0xe1,0x00,0x80,0x17,0x20, +0x43,0x5c,0x01,0xf1,0x00,0x80,0x96,0x20,0xa3,0x9c,0x70,0xc0,0x00,0x40,0x1b,0x20, +0x85,0xdc,0x43,0x00,0x00,0x00,0x00,0x84,0x43,0xdc,0xf0,0x93,0x00,0x40,0x00,0x48, +0x03,0xde,0xff,0x03,0x01,0x40,0x01,0x48,0x63,0xdc,0xc1,0xfc,0x00,0x00,0x0e,0x19, +0x85,0xdc,0x23,0x00,0x00,0x00,0x00,0x94,0x85,0x9c,0x43,0x10,0x00,0x00,0x00,0x84, +0x85,0x9c,0x23,0x10,0x00,0x00,0x00,0x94,0x85,0x1c,0x41,0x20,0x00,0x00,0x00,0x84, +0x85,0x1c,0x21,0x20,0x00,0x00,0x00,0x94,0xe7,0x01,0x00,0xc0,0x02,0x00,0x00,0x40, +0xe2,0xdd,0x00,0x10,0x00,0x00,0x00,0x18,0x07,0x00,0x00,0x20,0x02,0x00,0x00,0x60, +0x03,0x9c,0x00,0x01,0x01,0x80,0x07,0x20,0x43,0xdc,0x00,0x11,0x01,0x80,0x86,0x20, +0x85,0x9c,0x20,0x00,0x00,0x00,0x00,0x84,0x00,0xdc,0x21,0xd0,0x00,0x40,0x8e,0x2c, +0xe7,0x01,0x00,0x40,0x00,0x00,0x00,0x40,0xe2,0x1d,0x01,0xfc,0x03,0x00,0x00,0x18, +0xe7,0x1d,0x00,0x20,0x01,0x00,0x00,0x40,0x00,0xdc,0x21,0xfc,0x00,0x00,0x0e,0x2e, +0xe4,0x21,0x01,0xfc,0x00,0x00,0x00,0x28,0xe7,0xa1,0x00,0xc0,0x00,0x00,0x00,0x40, +0xe4,0xc1,0x00,0xd0,0x00,0x40,0x00,0x28,0x40,0x80,0x20,0xc0,0xdf,0xd0,0x00,0x58, +0x00,0xc0,0x30,0x10,0x00,0x00,0x00,0xc8,0x40,0x80,0x20,0x0c,0x00,0x00,0x00,0x58, +0x04,0x80,0x20,0x09,0x00,0x00,0x86,0x14,0x84,0x00,0x91,0x08,0x00,0x00,0x00,0x1c, +0xf4,0x9d,0x00,0xa0,0x00,0x40,0x00,0x28,0x03,0x9c,0x70,0x10,0x00,0xc0,0x05,0x20, +0x43,0xdc,0xf0,0xb3,0x00,0x40,0x00,0x48,0x05,0x1c,0x21,0x00,0x00,0x00,0x00,0x94, +0x03,0x9c,0x80,0xfc,0xff,0xff,0x00,0x48,0x03,0xdc,0x71,0x04,0x00,0xc0,0x00,0x48, +0x03,0x1c,0x22,0x20,0x00,0x00,0x00,0x68,0x23,0xdc,0x81,0xfc,0x00,0x00,0x8e,0x1a, +0xe7,0x01,0x00,0x80,0xfa,0xff,0x03,0x40,0x13,0x1c,0x00,0x20,0x00,0x40,0x00,0x48, +0x03,0xdc,0x01,0x24,0x00,0x00,0x8e,0x19,0xe7,0x01,0x00,0x00,0xf8,0xff,0x03,0x40, +0xe7,0x1d,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x03,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x01,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0b,0x00,0x00,0x00,0x03,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x44,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x68,0x01,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x13,0x00,0x00,0x00,0x02,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0xb0,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0xd8,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x02,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x33,0x00,0x00,0x00,0x00,0x00,0x00,0x70, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x88,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0xa8,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x03,0x00,0x00,0x00,0x09,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6b,0x00,0x00,0x00,0x00,0x00,0x00,0x70, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x30,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xac,0x00,0x00,0x00,0x00,0x00,0x00,0x70, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x60,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x98,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x03,0x00,0x00,0x00,0x0a,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x74,0x00,0x00,0x00,0x01,0x00,0x00,0x00, +0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0xf8,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x64,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x09,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xe4,0x00,0x00,0x00,0x01,0x00,0x00,0x00, +0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x5c,0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x54,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x0a,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1b,0x00,0x00,0x00,0x01,0x00,0x00,0x00, +0x06,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0xb0,0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x78,0x02,0x00,0x00,0x00,0x00,0x00,0x00, +0x03,0x00,0x00,0x00,0x07,0x00,0x00,0x13,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x94,0x00,0x00,0x00,0x01,0x00,0x00,0x00, +0x06,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x28,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x02,0x00,0x00,0x00,0x00,0x00,0x00, +0x03,0x00,0x00,0x00,0x08,0x00,0x00,0x11,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x4e,0x00,0x00,0x00,0x08,0x00,0x00,0x00, +0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x98,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x09,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc7,0x00,0x00,0x00,0x08,0x00,0x00,0x00, +0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x98,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x0a,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x05,0x00,0x00,0x00, +0xd8,0x0d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xa8,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0xa8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x01,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0xf8,0x04,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0xa0,0x05,0x00,0x00,0x00,0x00,0x00,0x00,0xa0,0x05,0x00,0x00,0x00,0x00,0x00,0x00, +0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x06,0x00,0x00,0x00, +0x98,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x02,0x00,0x01,0x01,0x58,0x00,0x00,0x00,0xe8,0x11,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x01,0x00,0x1e,0x00,0x00,0x00, +0x40,0x00,0x00,0x00,0x12,0x00,0x00,0x00,0x45,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x52,0x65,0x6e,0x64,0x65,0x72,0x50,0x61,0x72,0x74,0x69,0x63,0x6c,0x65,0x73,0x2e, +0x63,0x75,0x00,0x00,0x00,0x00,0x00,0x00,0x7f,0x45,0x4c,0x46,0x02,0x01,0x01,0x33, +0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0xbe,0x00,0x01,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x11,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x0e,0x00,0x00,0x00,0x00,0x00,0x00,0x1e,0x05,0x1e,0x00,0x40,0x00,0x38,0x00, +0x03,0x00,0x40,0x00,0x0d,0x00,0x01,0x00,0x00,0x2e,0x73,0x68,0x73,0x74,0x72,0x74, +0x61,0x62,0x00,0x2e,0x73,0x74,0x72,0x74,0x61,0x62,0x00,0x2e,0x73,0x79,0x6d,0x74, +0x61,0x62,0x00,0x2e,0x74,0x65,0x78,0x74,0x2e,0x75,0x70,0x64,0x61,0x74,0x65,0x49, +0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x64,0x56,0x42,0x00,0x2e,0x6e,0x76,0x2e,0x69, +0x6e,0x66,0x6f,0x2e,0x75,0x70,0x64,0x61,0x74,0x65,0x49,0x6e,0x73,0x74,0x61,0x6e, +0x63,0x65,0x64,0x56,0x42,0x00,0x2e,0x6e,0x76,0x2e,0x73,0x68,0x61,0x72,0x65,0x64, +0x2e,0x75,0x70,0x64,0x61,0x74,0x65,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x64, +0x56,0x42,0x00,0x2e,0x6e,0x76,0x2e,0x69,0x6e,0x66,0x6f,0x00,0x2e,0x6e,0x76,0x2e, +0x63,0x6f,0x6e,0x73,0x74,0x61,0x6e,0x74,0x30,0x2e,0x75,0x70,0x64,0x61,0x74,0x65, +0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x64,0x56,0x42,0x00,0x2e,0x74,0x65,0x78, +0x74,0x2e,0x75,0x70,0x64,0x61,0x74,0x65,0x42,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72, +0x64,0x56,0x42,0x00,0x2e,0x6e,0x76,0x2e,0x69,0x6e,0x66,0x6f,0x2e,0x75,0x70,0x64, +0x61,0x74,0x65,0x42,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x56,0x42,0x00,0x2e, +0x6e,0x76,0x2e,0x73,0x68,0x61,0x72,0x65,0x64,0x2e,0x75,0x70,0x64,0x61,0x74,0x65, +0x42,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x56,0x42,0x00,0x2e,0x6e,0x76,0x2e, +0x63,0x6f,0x6e,0x73,0x74,0x61,0x6e,0x74,0x30,0x2e,0x75,0x70,0x64,0x61,0x74,0x65, +0x42,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x56,0x42,0x00,0x00,0x2e,0x73,0x68, +0x73,0x74,0x72,0x74,0x61,0x62,0x00,0x2e,0x73,0x74,0x72,0x74,0x61,0x62,0x00,0x2e, +0x73,0x79,0x6d,0x74,0x61,0x62,0x00,0x75,0x70,0x64,0x61,0x74,0x65,0x49,0x6e,0x73, +0x74,0x61,0x6e,0x63,0x65,0x64,0x56,0x42,0x00,0x2e,0x74,0x65,0x78,0x74,0x2e,0x75, +0x70,0x64,0x61,0x74,0x65,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x64,0x56,0x42, +0x00,0x2e,0x6e,0x76,0x2e,0x69,0x6e,0x66,0x6f,0x2e,0x75,0x70,0x64,0x61,0x74,0x65, +0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x64,0x56,0x42,0x00,0x2e,0x6e,0x76,0x2e, +0x73,0x68,0x61,0x72,0x65,0x64,0x2e,0x75,0x70,0x64,0x61,0x74,0x65,0x49,0x6e,0x73, +0x74,0x61,0x6e,0x63,0x65,0x64,0x56,0x42,0x00,0x2e,0x6e,0x76,0x2e,0x69,0x6e,0x66, +0x6f,0x00,0x5f,0x5a,0x4e,0x35,0x70,0x68,0x79,0x73,0x78,0x37,0x67,0x4f,0x66,0x66, +0x73,0x65,0x74,0x45,0x00,0x2e,0x6e,0x76,0x2e,0x63,0x6f,0x6e,0x73,0x74,0x61,0x6e, +0x74,0x30,0x2e,0x75,0x70,0x64,0x61,0x74,0x65,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63, +0x65,0x64,0x56,0x42,0x00,0x5f,0x70,0x61,0x72,0x61,0x6d,0x00,0x75,0x70,0x64,0x61, +0x74,0x65,0x42,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x56,0x42,0x00,0x2e,0x74, +0x65,0x78,0x74,0x2e,0x75,0x70,0x64,0x61,0x74,0x65,0x42,0x69,0x6c,0x6c,0x62,0x6f, +0x61,0x72,0x64,0x56,0x42,0x00,0x2e,0x6e,0x76,0x2e,0x69,0x6e,0x66,0x6f,0x2e,0x75, +0x70,0x64,0x61,0x74,0x65,0x42,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x56,0x42, +0x00,0x2e,0x6e,0x76,0x2e,0x73,0x68,0x61,0x72,0x65,0x64,0x2e,0x75,0x70,0x64,0x61, +0x74,0x65,0x42,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x56,0x42,0x00,0x24,0x75, +0x70,0x64,0x61,0x74,0x65,0x42,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x56,0x42, +0x24,0x5f,0x5a,0x4e,0x35,0x70,0x68,0x79,0x73,0x78,0x37,0x67,0x4f,0x66,0x66,0x73, +0x65,0x74,0x45,0x00,0x2e,0x6e,0x76,0x2e,0x63,0x6f,0x6e,0x73,0x74,0x61,0x6e,0x74, +0x30,0x2e,0x75,0x70,0x64,0x61,0x74,0x65,0x42,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72, +0x64,0x56,0x42,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x2d,0x00,0x00,0x00,0x03,0x00,0x09,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x03,0x00,0x0b,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x99,0x00,0x00,0x00,0x03,0x00,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xd2,0x00,0x00,0x00,0x03,0x00,0x0a,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x05,0x01,0x00,0x00,0x03,0x00,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x48,0x01,0x00,0x00,0x03,0x00,0x08,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x1b,0x00,0x00,0x00,0x12,0x10,0x09,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x00,0x00,0x00,0x12,0x10,0x0a,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00, +0x04,0x0a,0x08,0x00,0x03,0x00,0x00,0x00,0x40,0x01,0x44,0x00,0x03,0x19,0x44,0x00, +0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x40,0x00,0x00,0xf0,0x11,0x00, +0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x38,0x00,0x00,0xf0,0x21,0x00, +0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x30,0x00,0x00,0xf0,0x21,0x00, +0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00,0x05,0x00,0x28,0x00,0x00,0xf0,0x21,0x00, +0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x20,0x00,0x00,0xf0,0x11,0x00, +0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x18,0x00,0x00,0xf0,0x21,0x00, +0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x10,0x00,0x00,0xf0,0x21,0x00, +0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x08,0x00,0x00,0xf0,0x21,0x00, +0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf0,0x21,0x00, +0x04,0x1e,0x04,0x00,0x10,0x02,0x00,0x00,0x04,0x12,0x08,0x00,0x08,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x04,0x11,0x08,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x04,0x12,0x08,0x00,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x11,0x08,0x00, +0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x0a,0x08,0x00,0x06,0x00,0x00,0x00, +0x40,0x01,0x34,0x00,0x03,0x19,0x34,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x07,0x00,0x30,0x00,0x00,0xf0,0x11,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x06,0x00,0x28,0x00,0x00,0xf0,0x21,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x05,0x00,0x20,0x00,0x00,0xf0,0x21,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x04,0x00,0x18,0x00,0x00,0xf0,0x21,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x03,0x00,0x14,0x00,0x00,0xf0,0x11,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x02,0x00,0x10,0x00,0x00,0xf0,0x11,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x01,0x00,0x08,0x00,0x00,0xf0,0x21,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0xf0,0x21,0x00,0x04,0x1e,0x04,0x00,0x10,0x02,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf7,0x82,0xc2,0xe2,0x12,0xc3,0xe2,0x22, +0xe4,0x5d,0x00,0x10,0x01,0x40,0x00,0x28,0x04,0x1c,0x00,0x84,0x00,0x00,0x00,0x2c, +0x23,0xdc,0x01,0xfc,0x00,0x00,0x8e,0x1a,0x85,0xe0,0xff,0x03,0x00,0x00,0x00,0xc9, +0x04,0x1c,0x00,0x00,0x00,0xc0,0x0e,0x50,0x23,0xdc,0xf1,0x03,0x06,0x40,0x0e,0x19, +0xe7,0x01,0x00,0x00,0x00,0x00,0x00,0x80,0x87,0x82,0xc2,0xe2,0x02,0x40,0xc0,0x22, +0xe4,0x9d,0x00,0x00,0x06,0x40,0x00,0x28,0x03,0x5c,0x22,0x14,0x00,0xc0,0x00,0x58, +0x03,0xdc,0x01,0x24,0x00,0x00,0x0e,0x1a,0xe7,0x01,0x00,0x00,0x00,0x00,0x00,0x80, +0xe2,0xdd,0x02,0x10,0x00,0x00,0x00,0x18,0x03,0x1c,0x01,0xe0,0x05,0x80,0x17,0x20, +0x07,0x00,0x00,0x80,0x01,0x00,0x00,0x60,0x47,0x80,0x42,0x70,0x03,0xb0,0x83,0x22, +0x43,0x5c,0x01,0xf0,0x05,0x80,0x96,0x20,0x04,0xdc,0xf3,0x1c,0x00,0x00,0x0e,0x0c, +0x85,0x1c,0x42,0x00,0x00,0x00,0x00,0x84,0x03,0x9c,0x01,0x14,0x00,0xc0,0x00,0x60, +0x04,0x9c,0x80,0x20,0x00,0x00,0x00,0x54,0x85,0xdc,0xf1,0x03,0x00,0x00,0x00,0xa8, +0x03,0xc0,0x70,0x08,0x00,0x00,0x00,0x48,0xb7,0xe3,0x02,0x40,0x02,0x40,0x00,0x22, +0x85,0xc1,0xf0,0x03,0x00,0x00,0x00,0xb8,0xe7,0x25,0x00,0x60,0xff,0xff,0x03,0x40, +0x33,0xdc,0x81,0xfc,0x00,0x00,0x0e,0x19,0x07,0x00,0x00,0x20,0x07,0x00,0x00,0x60, +0xe7,0x01,0x00,0xe0,0x06,0x00,0x00,0x40,0xe4,0x9d,0x02,0x80,0x05,0x40,0x00,0x28, +0xe2,0x1d,0x03,0x90,0x00,0x00,0x00,0x18,0xe7,0x82,0x82,0x82,0x82,0xc2,0x82,0x22, +0xe2,0x5d,0x03,0x40,0x00,0x00,0x00,0x18,0x84,0xdf,0x20,0x21,0x00,0x00,0x00,0x1c, +0x03,0x9c,0x80,0x0c,0x00,0x00,0x00,0x68,0x03,0x9c,0x00,0x08,0x00,0x00,0x00,0x78, +0x43,0x9c,0x24,0x18,0x00,0x00,0x00,0x68,0x03,0x9c,0x20,0xc1,0x05,0x80,0x19,0x20, +0x43,0xdc,0x20,0xd1,0x05,0x80,0x98,0x20,0x07,0xc2,0x92,0xe2,0x72,0xe3,0x02,0x22, +0x85,0xdc,0x23,0x00,0x00,0x00,0x00,0x84,0xa3,0x1c,0x71,0x20,0x05,0x80,0x15,0x20, +0x43,0x5c,0xf1,0x33,0x05,0x40,0x00,0x48,0x85,0xdc,0x43,0x00,0x00,0x00,0x00,0x94, +0x85,0x9c,0x23,0x10,0x00,0x00,0x00,0x84,0x85,0x9c,0x43,0x10,0x00,0x00,0x00,0x94, +0x85,0x5c,0x24,0x20,0x00,0x00,0x00,0x84,0x67,0x43,0xe0,0x72,0xe3,0x72,0xe3,0x22, +0xa3,0x9c,0x73,0x40,0x05,0x80,0x15,0x20,0x85,0x5c,0x44,0x20,0x00,0x00,0x00,0x94, +0x43,0xdc,0xf3,0x53,0x05,0x40,0x00,0x48,0x85,0x1c,0x24,0x30,0x00,0x00,0x00,0x84, +0x85,0x1c,0xe4,0x00,0x00,0x00,0x00,0x94,0x85,0x1c,0x21,0x40,0x00,0x00,0x00,0x84, +0x85,0x1c,0xe1,0x10,0x00,0x00,0x00,0x94,0x07,0x62,0x43,0xe0,0x72,0xe3,0x72,0x23, +0x85,0x5c,0x24,0x50,0x00,0x00,0x00,0x84,0xa3,0x1c,0x71,0x60,0x05,0x80,0x15,0x20, +0x85,0x5c,0xe4,0x20,0x00,0x00,0x00,0x94,0x43,0x5c,0xf1,0x73,0x05,0x40,0x00,0x48, +0x85,0x1c,0x24,0x60,0x00,0x00,0x00,0x84,0x85,0x1c,0x44,0x00,0x00,0x00,0x00,0x94, +0x85,0xdc,0x23,0x70,0x00,0x00,0x00,0x84,0x47,0xe0,0x02,0xd2,0x82,0xe2,0x02,0x22, +0x03,0x9c,0x23,0xa1,0x05,0x80,0x1b,0x20,0x85,0xdc,0x43,0x10,0x00,0x00,0x00,0x94, +0x85,0x5c,0x24,0x80,0x00,0x00,0x00,0x84,0x43,0xdc,0x23,0xb1,0x05,0x80,0x9a,0x20, +0xa3,0x9c,0x70,0x00,0x05,0x80,0x15,0x20,0x85,0x5c,0x44,0x20,0x00,0x00,0x00,0x94, +0x85,0x1c,0xe4,0x00,0x00,0x00,0x00,0x84,0x47,0x60,0x43,0xe0,0x42,0x80,0xe2,0x22, +0x43,0xdc,0xf0,0x13,0x05,0x40,0x00,0x48,0x03,0x5c,0x84,0xfc,0xff,0xff,0x00,0x48, +0x03,0xdc,0x71,0x04,0x00,0xc0,0x00,0x48,0x85,0x1c,0x24,0x00,0x00,0x00,0x00,0x94, +0x03,0x1c,0x12,0x21,0x00,0x00,0x00,0x68,0x85,0x5c,0xe1,0x10,0x00,0x00,0x00,0x84, +0x23,0xdc,0x81,0xfc,0x00,0x00,0x8e,0x1a,0xe7,0x72,0x43,0xe0,0xf2,0xc2,0xe2,0x22, +0x85,0x5c,0x21,0x10,0x00,0x00,0x00,0x94,0x85,0x1c,0xe1,0x20,0x00,0x00,0x00,0x84, +0x85,0x1c,0x21,0x20,0x00,0x00,0x00,0x94,0xe7,0x01,0x00,0xa0,0xf9,0xff,0x03,0x40, +0x13,0x1c,0x00,0xa0,0x00,0x40,0x00,0x48,0x03,0xdc,0x01,0x24,0x00,0x00,0x8e,0x19, +0xe7,0x01,0x00,0xc0,0xf6,0xff,0x03,0x40,0xe7,0x02,0x00,0x00,0x00,0x00,0x00,0x20, +0xe7,0x1d,0x00,0x00,0x00,0x00,0x00,0x80,0xe7,0x1d,0x00,0xe0,0xff,0xff,0x03,0x40, +0xe4,0x1d,0x00,0x00,0x00,0x00,0x00,0x40,0xe4,0x1d,0x00,0x00,0x00,0x00,0x00,0x40, +0xe4,0x1d,0x00,0x00,0x00,0x00,0x00,0x40,0xe4,0x1d,0x00,0x00,0x00,0x00,0x00,0x40, +0xe4,0x1d,0x00,0x00,0x00,0x00,0x00,0x40,0xf7,0x82,0xc2,0xe2,0x12,0xc3,0xe2,0x22, +0xe4,0x5d,0x00,0x10,0x01,0x40,0x00,0x28,0x04,0x1c,0x00,0x84,0x00,0x00,0x00,0x2c, +0x23,0xdc,0x01,0xfc,0x00,0x00,0x8e,0x1a,0x85,0xe0,0xff,0x03,0x00,0x00,0x00,0xc9, +0x04,0x1c,0x00,0x00,0x00,0xc0,0x0e,0x50,0x23,0xdc,0xf1,0xc3,0x05,0x40,0x0e,0x19, +0xe7,0x01,0x00,0x00,0x00,0x00,0x00,0x80,0x87,0x82,0xc2,0xe2,0x02,0x40,0xc0,0x22, +0xe4,0x9d,0x00,0xc0,0x05,0x40,0x00,0x28,0x03,0x1c,0x21,0x14,0x00,0xc0,0x00,0x58, +0x03,0xdc,0x01,0x10,0x00,0x00,0x0e,0x1a,0xe7,0x01,0x00,0x00,0x00,0x00,0x00,0x80, +0xe2,0x5d,0x01,0x10,0x00,0x00,0x00,0x18,0x03,0x1c,0x02,0xa0,0x05,0x80,0x0b,0x20, +0x07,0x00,0x00,0x80,0x01,0x00,0x00,0x60,0x47,0x80,0x02,0x62,0x03,0xb0,0x83,0x22, +0x43,0x5c,0x02,0xb0,0x05,0x80,0x8a,0x20,0x04,0xdc,0xf3,0x1c,0x00,0x00,0x0e,0x0c, +0x85,0x1c,0x82,0x00,0x00,0x00,0x00,0x84,0x03,0x9c,0x01,0x14,0x00,0xc0,0x00,0x60, +0x04,0x9c,0x80,0x20,0x00,0x00,0x00,0x54,0x85,0xdc,0xf1,0x03,0x00,0x00,0x00,0xa8, +0x03,0xc0,0x70,0x08,0x00,0x00,0x00,0x48,0xb7,0xe3,0x02,0x40,0x02,0x40,0x00,0x22, +0x85,0xc1,0xf0,0x03,0x00,0x00,0x00,0xb8,0xe7,0x25,0x00,0x60,0xff,0xff,0x03,0x40, +0x33,0xdc,0x81,0xfc,0x00,0x00,0x0e,0x19,0x07,0x00,0x00,0x00,0x07,0x00,0x00,0x60, +0xe7,0x01,0x00,0xc0,0x06,0x00,0x00,0x40,0xe4,0xdd,0x02,0x00,0x05,0x40,0x00,0x28, +0xe2,0x5d,0x02,0x40,0x00,0x00,0x00,0x18,0xf7,0x82,0x82,0x82,0x82,0xc2,0x82,0x22, +0xe4,0x9d,0x02,0x90,0x05,0x40,0x00,0x28,0x84,0xdf,0x20,0x21,0x00,0x00,0x00,0x1c, +0x03,0x9c,0x80,0x0c,0x00,0x00,0x00,0x68,0x03,0x9c,0x00,0x08,0x00,0x00,0x00,0x78, +0x43,0x9c,0x23,0x18,0x00,0x00,0x00,0x68,0x03,0x1c,0xe4,0x60,0x05,0x80,0x13,0x20, +0x43,0x5c,0xe4,0x70,0x05,0x80,0x92,0x20,0x07,0xc2,0x92,0x42,0xe0,0x02,0x62,0x23, +0x85,0x1c,0x03,0x01,0x00,0x00,0x00,0x84,0xa3,0x9c,0x70,0x40,0x05,0x40,0x17,0x20, +0x43,0xdc,0xf0,0x13,0x05,0x40,0x00,0x48,0x85,0x1c,0x23,0x00,0x00,0x00,0x00,0x94, +0x03,0xde,0xff,0x83,0x05,0x40,0x01,0x48,0x85,0x5c,0x03,0x11,0x00,0x00,0x00,0x84, +0x63,0xdc,0xa1,0xfc,0x00,0x00,0x0e,0x19,0xe7,0x72,0x43,0x00,0x40,0x80,0xc2,0x22, +0x85,0x5c,0x23,0x10,0x00,0x00,0x00,0x94,0x85,0x1c,0x03,0x21,0x00,0x00,0x00,0x84, +0x85,0x1c,0x23,0x20,0x00,0x00,0x00,0x94,0xe7,0x01,0x00,0x20,0x03,0x00,0x00,0x40, +0xe2,0xdd,0x00,0x10,0x00,0x00,0x00,0x18,0x07,0x00,0x00,0x80,0x02,0x00,0x00,0x60, +0x03,0x9c,0xe0,0x80,0x05,0x80,0x07,0x20,0x87,0x72,0xc3,0x22,0x42,0xe0,0xc2,0x22, +0x43,0xdc,0xe0,0x90,0x05,0x80,0x86,0x20,0x85,0x9c,0x20,0x00,0x00,0x00,0x00,0x84, +0x00,0xdc,0x21,0x50,0x05,0x40,0x8e,0x2c,0xe7,0x01,0x00,0x40,0x00,0x00,0x00,0x40, +0xe2,0x9d,0x00,0xfc,0x03,0x00,0x00,0x18,0xe7,0x1d,0x00,0x60,0x01,0x00,0x00,0x40, +0x00,0xdc,0x21,0xfc,0x00,0x00,0x0e,0x2e,0x47,0x00,0x40,0x80,0x82,0x82,0x82,0x22, +0xe4,0xa1,0x00,0xfc,0x00,0x00,0x00,0x28,0xe7,0xa1,0x00,0xe0,0x00,0x00,0x00,0x40, +0xe4,0xc1,0x00,0x50,0x05,0x40,0x00,0x28,0x40,0x80,0x20,0xc0,0xdf,0xd0,0x00,0x58, +0x00,0xc0,0x30,0x10,0x00,0x00,0x00,0xc8,0x40,0x80,0x20,0x0c,0x00,0x00,0x00,0x58, +0x04,0x80,0x20,0x09,0x00,0x00,0x86,0x14,0x07,0xf0,0xc2,0x82,0x62,0x42,0x80,0x22, +0x84,0x80,0x90,0x08,0x00,0x00,0x00,0x1c,0xf4,0xdd,0x00,0x20,0x05,0x40,0x00,0x28, +0x03,0x1c,0x73,0x10,0x00,0xc0,0x07,0x20,0x43,0x5c,0xf3,0x33,0x05,0x40,0x00,0x48, +0x05,0x9c,0xc0,0x00,0x00,0x00,0x00,0x94,0x03,0xdc,0x80,0xfc,0xff,0xff,0x00,0x48, +0x03,0xdc,0x71,0x04,0x00,0xc0,0x00,0x48,0x87,0xc2,0xe2,0xf2,0xc2,0xe2,0xe2,0x22, +0x03,0x1c,0x32,0x20,0x00,0x00,0x00,0x68,0x23,0xdc,0x81,0xfc,0x00,0x00,0x8e,0x1a, +0xe7,0x01,0x00,0xc0,0xf9,0xff,0x03,0x40,0x13,0x1c,0x00,0xa0,0x00,0x40,0x00,0x48, +0x03,0xdc,0x01,0x10,0x00,0x00,0x8e,0x19,0xe7,0x01,0x00,0xe0,0xf6,0xff,0x03,0x40, +0xe7,0x1d,0x00,0x00,0x00,0x00,0x00,0x80,0xe7,0x1d,0x00,0xe0,0xff,0xff,0x03,0x40, +0xe4,0x1d,0x00,0x00,0x00,0x00,0x00,0x40,0xe4,0x1d,0x00,0x00,0x00,0x00,0x00,0x40, +0xe4,0x1d,0x00,0x00,0x00,0x00,0x00,0x40,0xe4,0x1d,0x00,0x00,0x00,0x00,0x00,0x40, +0xe4,0x1d,0x00,0x00,0x00,0x00,0x00,0x40,0xe4,0x1d,0x00,0x00,0x00,0x00,0x00,0x40, +0xe4,0x1d,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x03,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x01,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0b,0x00,0x00,0x00,0x03,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x44,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x68,0x01,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x13,0x00,0x00,0x00,0x02,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0xb0,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0xd8,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x02,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x33,0x00,0x00,0x00,0x00,0x00,0x00,0x70, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x88,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0xa8,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x03,0x00,0x00,0x00,0x09,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6b,0x00,0x00,0x00,0x00,0x00,0x00,0x70, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x30,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xac,0x00,0x00,0x00,0x00,0x00,0x00,0x70, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x60,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x98,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x03,0x00,0x00,0x00,0x0a,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x74,0x00,0x00,0x00,0x01,0x00,0x00,0x00, +0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0xf8,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x84,0x01,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x09,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xe4,0x00,0x00,0x00,0x01,0x00,0x00,0x00, +0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x7c,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x74,0x01,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x0a,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1b,0x00,0x00,0x00,0x01,0x00,0x00,0x00, +0x06,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00, +0x03,0x00,0x00,0x00,0x07,0x00,0x00,0x13,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x94,0x00,0x00,0x00,0x01,0x00,0x00,0x00, +0x06,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x0b,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00, +0x03,0x00,0x00,0x00,0x08,0x00,0x00,0x12,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x4e,0x00,0x00,0x00,0x08,0x00,0x00,0x00, +0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x0e,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x09,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc7,0x00,0x00,0x00,0x08,0x00,0x00,0x00, +0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x0e,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x0a,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x05,0x00,0x00,0x00, +0x40,0x11,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xa8,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0xa8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x01,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0xf8,0x04,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0xf8,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0xf8,0x08,0x00,0x00,0x00,0x00,0x00,0x00, +0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x06,0x00,0x00,0x00, +0x00,0x0e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x02,0x00,0x01,0x01,0x58,0x00,0x00,0x00,0x88,0x13,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x01,0x00,0x32,0x00,0x00,0x00, +0x40,0x00,0x00,0x00,0x12,0x00,0x00,0x00,0x45,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x52,0x65,0x6e,0x64,0x65,0x72,0x50,0x61,0x72,0x74,0x69,0x63,0x6c,0x65,0x73,0x2e, +0x63,0x75,0x00,0x00,0x00,0x00,0x00,0x00,0x7f,0x45,0x4c,0x46,0x02,0x01,0x01,0x33, +0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0xbe,0x00,0x01,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xe0,0x12,0x00,0x00,0x00,0x00,0x00,0x00, +0xa0,0x0f,0x00,0x00,0x00,0x00,0x00,0x00,0x32,0x05,0x32,0x00,0x40,0x00,0x38,0x00, +0x03,0x00,0x40,0x00,0x0d,0x00,0x01,0x00,0x00,0x2e,0x73,0x68,0x73,0x74,0x72,0x74, +0x61,0x62,0x00,0x2e,0x73,0x74,0x72,0x74,0x61,0x62,0x00,0x2e,0x73,0x79,0x6d,0x74, +0x61,0x62,0x00,0x2e,0x74,0x65,0x78,0x74,0x2e,0x75,0x70,0x64,0x61,0x74,0x65,0x49, +0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x64,0x56,0x42,0x00,0x2e,0x6e,0x76,0x2e,0x69, +0x6e,0x66,0x6f,0x2e,0x75,0x70,0x64,0x61,0x74,0x65,0x49,0x6e,0x73,0x74,0x61,0x6e, +0x63,0x65,0x64,0x56,0x42,0x00,0x2e,0x6e,0x76,0x2e,0x73,0x68,0x61,0x72,0x65,0x64, +0x2e,0x75,0x70,0x64,0x61,0x74,0x65,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x64, +0x56,0x42,0x00,0x2e,0x6e,0x76,0x2e,0x69,0x6e,0x66,0x6f,0x00,0x2e,0x6e,0x76,0x2e, +0x63,0x6f,0x6e,0x73,0x74,0x61,0x6e,0x74,0x30,0x2e,0x75,0x70,0x64,0x61,0x74,0x65, +0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x64,0x56,0x42,0x00,0x2e,0x74,0x65,0x78, +0x74,0x2e,0x75,0x70,0x64,0x61,0x74,0x65,0x42,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72, +0x64,0x56,0x42,0x00,0x2e,0x6e,0x76,0x2e,0x69,0x6e,0x66,0x6f,0x2e,0x75,0x70,0x64, +0x61,0x74,0x65,0x42,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x56,0x42,0x00,0x2e, +0x6e,0x76,0x2e,0x73,0x68,0x61,0x72,0x65,0x64,0x2e,0x75,0x70,0x64,0x61,0x74,0x65, +0x42,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x56,0x42,0x00,0x2e,0x6e,0x76,0x2e, +0x63,0x6f,0x6e,0x73,0x74,0x61,0x6e,0x74,0x30,0x2e,0x75,0x70,0x64,0x61,0x74,0x65, +0x42,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x56,0x42,0x00,0x00,0x2e,0x73,0x68, +0x73,0x74,0x72,0x74,0x61,0x62,0x00,0x2e,0x73,0x74,0x72,0x74,0x61,0x62,0x00,0x2e, +0x73,0x79,0x6d,0x74,0x61,0x62,0x00,0x75,0x70,0x64,0x61,0x74,0x65,0x49,0x6e,0x73, +0x74,0x61,0x6e,0x63,0x65,0x64,0x56,0x42,0x00,0x2e,0x74,0x65,0x78,0x74,0x2e,0x75, +0x70,0x64,0x61,0x74,0x65,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x64,0x56,0x42, +0x00,0x2e,0x6e,0x76,0x2e,0x69,0x6e,0x66,0x6f,0x2e,0x75,0x70,0x64,0x61,0x74,0x65, +0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x64,0x56,0x42,0x00,0x2e,0x6e,0x76,0x2e, +0x73,0x68,0x61,0x72,0x65,0x64,0x2e,0x75,0x70,0x64,0x61,0x74,0x65,0x49,0x6e,0x73, +0x74,0x61,0x6e,0x63,0x65,0x64,0x56,0x42,0x00,0x2e,0x6e,0x76,0x2e,0x69,0x6e,0x66, +0x6f,0x00,0x5f,0x5a,0x4e,0x35,0x70,0x68,0x79,0x73,0x78,0x37,0x67,0x4f,0x66,0x66, +0x73,0x65,0x74,0x45,0x00,0x2e,0x6e,0x76,0x2e,0x63,0x6f,0x6e,0x73,0x74,0x61,0x6e, +0x74,0x30,0x2e,0x75,0x70,0x64,0x61,0x74,0x65,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63, +0x65,0x64,0x56,0x42,0x00,0x5f,0x70,0x61,0x72,0x61,0x6d,0x00,0x75,0x70,0x64,0x61, +0x74,0x65,0x42,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x56,0x42,0x00,0x2e,0x74, +0x65,0x78,0x74,0x2e,0x75,0x70,0x64,0x61,0x74,0x65,0x42,0x69,0x6c,0x6c,0x62,0x6f, +0x61,0x72,0x64,0x56,0x42,0x00,0x2e,0x6e,0x76,0x2e,0x69,0x6e,0x66,0x6f,0x2e,0x75, +0x70,0x64,0x61,0x74,0x65,0x42,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x56,0x42, +0x00,0x2e,0x6e,0x76,0x2e,0x73,0x68,0x61,0x72,0x65,0x64,0x2e,0x75,0x70,0x64,0x61, +0x74,0x65,0x42,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x56,0x42,0x00,0x24,0x75, +0x70,0x64,0x61,0x74,0x65,0x42,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x56,0x42, +0x24,0x5f,0x5a,0x4e,0x35,0x70,0x68,0x79,0x73,0x78,0x37,0x67,0x4f,0x66,0x66,0x73, +0x65,0x74,0x45,0x00,0x2e,0x6e,0x76,0x2e,0x63,0x6f,0x6e,0x73,0x74,0x61,0x6e,0x74, +0x30,0x2e,0x75,0x70,0x64,0x61,0x74,0x65,0x42,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72, +0x64,0x56,0x42,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x2d,0x00,0x00,0x00,0x03,0x00,0x09,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x03,0x00,0x0b,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x99,0x00,0x00,0x00,0x03,0x00,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xd2,0x00,0x00,0x00,0x03,0x00,0x0a,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x05,0x01,0x00,0x00,0x03,0x00,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x48,0x01,0x00,0x00,0x03,0x00,0x08,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x1b,0x00,0x00,0x00,0x12,0x10,0x09,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0xc0,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x00,0x00,0x00,0x12,0x10,0x0a,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x03,0x00,0x00,0x00,0x00,0x00,0x00, +0x04,0x0a,0x08,0x00,0x03,0x00,0x00,0x00,0x40,0x01,0x44,0x00,0x03,0x19,0x44,0x00, +0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x40,0x00,0x00,0xf0,0x11,0x00, +0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x38,0x00,0x00,0xf0,0x21,0x00, +0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x30,0x00,0x00,0xf0,0x21,0x00, +0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00,0x05,0x00,0x28,0x00,0x00,0xf0,0x21,0x00, +0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x20,0x00,0x00,0xf0,0x11,0x00, +0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x18,0x00,0x00,0xf0,0x21,0x00, +0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x10,0x00,0x00,0xf0,0x21,0x00, +0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x08,0x00,0x00,0xf0,0x21,0x00, +0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf0,0x21,0x00, +0x04,0x1e,0x04,0x00,0x10,0x02,0x00,0x00,0x04,0x1c,0x14,0x00,0x30,0x00,0x00,0x00, +0x50,0x00,0x00,0x00,0xb8,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x04,0x12,0x08,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x11,0x08,0x00, +0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x12,0x08,0x00,0x07,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x04,0x11,0x08,0x00,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x04,0x0a,0x08,0x00,0x06,0x00,0x00,0x00,0x40,0x01,0x34,0x00,0x03,0x19,0x34,0x00, +0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x30,0x00,0x00,0xf0,0x11,0x00, +0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x28,0x00,0x00,0xf0,0x21,0x00, +0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00,0x05,0x00,0x20,0x00,0x00,0xf0,0x21,0x00, +0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x18,0x00,0x00,0xf0,0x21,0x00, +0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x14,0x00,0x00,0xf0,0x11,0x00, +0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x10,0x00,0x00,0xf0,0x11,0x00, +0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x08,0x00,0x00,0xf0,0x21,0x00, +0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf0,0x21,0x00, +0x04,0x1e,0x04,0x00,0x20,0x02,0x00,0x00,0x04,0x1c,0x14,0x00,0x30,0x00,0x00,0x00, +0x50,0x00,0x00,0x00,0xa8,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xe6,0x07,0xa0,0xe3,0x00,0xb4,0x3f,0x00, +0x01,0x00,0x87,0x00,0x80,0x07,0x98,0x4c,0x00,0x00,0x17,0x02,0x00,0x00,0xc8,0xf0, +0x07,0x00,0xf7,0x0f,0x80,0x03,0x6b,0x5b,0xf4,0x07,0xe0,0xff,0x00,0xb4,0x1f,0x00, +0xff,0xff,0x08,0x00,0x00,0x00,0x5c,0xef,0x00,0x00,0x07,0x00,0x80,0x1b,0xa8,0xf0, +0x07,0xff,0x07,0x06,0x80,0x03,0x65,0x4b,0xfd,0x07,0xc0,0xfc,0x00,0x98,0x1f,0x00, +0x0f,0x00,0x00,0x00,0x00,0x00,0x00,0xe3,0x02,0x00,0x07,0x06,0x80,0x07,0x98,0x4c, +0x05,0x02,0x57,0x00,0x00,0x00,0x28,0x38,0xed,0x07,0xa0,0xff,0x00,0x88,0x1f,0x00, +0x07,0x00,0x57,0x00,0x80,0x03,0x68,0x5b,0x0f,0x00,0x00,0x00,0x00,0x00,0x00,0xe3, +0x02,0x00,0x27,0x00,0x80,0x00,0x48,0x38,0xf0,0x07,0x80,0xfe,0x00,0xb4,0x1f,0x00, +0x03,0x00,0xe7,0x01,0x00,0x00,0x28,0x38,0x00,0x00,0x00,0x2f,0x00,0x00,0x90,0xe2, +0x02,0x02,0xe7,0x05,0x00,0x80,0x10,0x4c,0xe2,0x07,0x20,0xf6,0x00,0x84,0x1f,0x00, +0x03,0x03,0xf7,0x05,0x00,0x08,0x10,0x4c,0x04,0x02,0x07,0x00,0x00,0x20,0xd4,0xee, +0x06,0x00,0x57,0x00,0x00,0x00,0x48,0x38,0x1d,0x07,0x01,0xfe,0x00,0xb4,0x20,0x00, +0x02,0x00,0x47,0x00,0x00,0x00,0x08,0x5c,0x07,0x04,0xf7,0x0f,0x80,0x03,0x65,0x5b, +0x07,0xff,0x27,0x00,0x00,0x00,0x00,0xec,0xfd,0x1f,0xa0,0xe3,0x00,0x88,0x3f,0x00, +0x0f,0x00,0x80,0x28,0x00,0x00,0x40,0xe2,0x02,0x3a,0x47,0x00,0x00,0x20,0xe0,0x5c, +0x02,0x04,0x27,0x00,0x00,0x00,0x47,0x5c,0x1d,0x07,0xc0,0xfc,0x01,0x84,0x1f,0x00, +0x02,0x00,0x27,0x00,0x00,0x00,0x30,0x5c,0x02,0x02,0xf7,0x01,0x00,0x00,0x12,0x38, +0x03,0x02,0xf7,0x01,0x00,0x00,0x12,0x38,0xe5,0x07,0xc0,0xfc,0x00,0x84,0x1f,0x00, +0x09,0xf0,0x47,0x02,0x00,0x00,0x00,0x01,0x0a,0x03,0x67,0x00,0x00,0x02,0x47,0x5c, +0x03,0x0a,0x47,0x02,0x80,0x7f,0x00,0x36,0xe1,0x07,0x20,0xfc,0x00,0x8c,0x1f,0x00, +0x0b,0x0a,0x47,0x02,0x80,0x7f,0x00,0x36,0x08,0x0a,0x97,0x00,0x88,0x7f,0x00,0x5b, +0x09,0x0a,0x97,0x00,0x88,0x7f,0x20,0x5b,0xe1,0x07,0xa0,0xfc,0x00,0x84,0x1f,0x00, +0x03,0x0a,0x47,0x02,0x80,0x01,0x28,0x36,0x02,0x0a,0x47,0x02,0x90,0x05,0x20,0x36, +0x03,0x03,0x87,0x00,0xa0,0x04,0xc0,0x5c,0xed,0x07,0x40,0xfc,0x00,0xc4,0x1e,0x00, +0x02,0x02,0xc7,0x05,0x00,0x80,0x10,0x4c,0x03,0x03,0xd7,0x05,0x00,0x08,0x10,0x4c, +0x08,0x02,0x07,0x00,0x00,0x20,0xd4,0xee,0xfd,0x07,0x20,0xfc,0x00,0x98,0x1f,0x00, +0x0c,0x00,0x87,0x05,0x80,0x07,0x98,0x4c,0x09,0x07,0xc7,0x00,0x80,0x7f,0x00,0x5b, +0x0c,0x07,0xc7,0x00,0xa8,0x7f,0x00,0x5b,0xe6,0x07,0xa0,0xfd,0x00,0x88,0x1f,0x00, +0x0d,0x07,0xc7,0x00,0x98,0x04,0x30,0x5b,0x0e,0x0d,0x27,0x05,0x00,0x80,0x10,0x4c, +0x0f,0xff,0x37,0x05,0x00,0x08,0x10,0x4c,0xf1,0x07,0x41,0xf6,0x00,0xc4,0x1f,0x04, +0x08,0x0e,0x07,0x00,0x00,0x20,0xdc,0xee,0x09,0x02,0x47,0x00,0x00,0x20,0xd4,0xee, +0x09,0x0e,0x47,0x00,0x00,0x20,0xdc,0xee,0xb1,0x07,0x20,0xfc,0x00,0xc4,0x1f,0x04, +0x08,0x02,0x87,0x00,0x00,0x20,0xd4,0xee,0x10,0x0d,0x47,0x05,0x00,0x80,0x10,0x4c, +0x08,0x0e,0x87,0x00,0x00,0x20,0xdc,0xee,0xbb,0x07,0x40,0xfc,0x00,0xc4,0x1f,0x04, +0x09,0x02,0xc7,0x00,0x00,0x20,0xd4,0xee,0x11,0xff,0x57,0x05,0x00,0x08,0x10,0x4c, +0x09,0x10,0x07,0x00,0x00,0x20,0xdc,0xee,0xb2,0x07,0x20,0xfe,0x20,0xc8,0x1e,0x00, +0x08,0x02,0x07,0x01,0x00,0x20,0xd4,0xee,0x08,0x10,0x47,0x00,0x00,0x20,0xdc,0xee, +0x0b,0x02,0x47,0x01,0x00,0x20,0xd4,0xee,0xf1,0x07,0x21,0xf6,0x00,0xb4,0x1f,0x00, +0x0b,0x10,0x87,0x00,0x00,0x20,0xdc,0xee,0x0c,0x02,0x87,0x01,0x00,0x20,0xd4,0xee, +0x08,0x0d,0x67,0x05,0x00,0x80,0x10,0x4c,0xe2,0x07,0x20,0xfe,0x20,0xc8,0x1e,0x00, +0x09,0xff,0x77,0x05,0x00,0x08,0x10,0x4c,0x0c,0x08,0x07,0x00,0x00,0x20,0xdc,0xee, +0x0b,0x02,0xc7,0x01,0x00,0x20,0xd4,0xee,0xf1,0x07,0x21,0xf6,0x00,0x88,0x1f,0x00, +0x0b,0x08,0x47,0x00,0x00,0x20,0xdc,0xee,0x03,0x02,0x07,0x02,0x00,0x20,0xd4,0xee, +0x0c,0x0a,0x47,0x00,0x80,0x00,0x48,0x38,0xe4,0x07,0xa0,0xfd,0x00,0x84,0x1f,0x00, +0x0a,0x0a,0xc7,0x01,0x00,0x00,0x28,0x38,0x0e,0x0c,0xa7,0x05,0x00,0x80,0x10,0x4c, +0x0f,0x0a,0xb7,0x05,0x00,0x08,0x10,0x4c,0xf1,0x07,0x21,0xf6,0x00,0xb4,0x1f,0x00, +0x03,0x08,0x87,0x00,0x00,0x20,0xdc,0xee,0x02,0x0e,0x07,0x00,0x00,0x20,0xd4,0xee, +0x0a,0x0d,0x07,0x05,0x00,0x80,0x10,0x4c,0xe2,0x07,0x20,0xfe,0x20,0xc8,0x1e,0x00, +0x0b,0xff,0x17,0x05,0x00,0x08,0x10,0x4c,0x02,0x0a,0x07,0x00,0x00,0x20,0xdc,0xee, +0x03,0x0e,0x47,0x00,0x00,0x20,0xd4,0xee,0xf1,0x00,0xa1,0xf7,0x00,0x98,0x3f,0x00, +0x03,0x0a,0x47,0x00,0x00,0x20,0xdc,0xee,0x02,0x0e,0x87,0x00,0x00,0x20,0xd4,0xee, +0x03,0x04,0xf7,0xff,0x7f,0x00,0x10,0x39,0xe1,0x07,0xa0,0xfc,0x00,0x84,0x1f,0x00, +0x04,0x03,0x47,0x00,0x00,0x00,0x47,0x5c,0x07,0x07,0x17,0x00,0x00,0x00,0x10,0x38, +0x07,0x04,0xf7,0x0f,0x80,0x03,0x6b,0x5b,0xec,0x00,0xa1,0xff,0x01,0xf4,0x1f,0x00, +0x02,0x0a,0x87,0x00,0x00,0x20,0xdc,0xee,0x0f,0x00,0x80,0xd7,0xff,0x0f,0x40,0xe2, +0x0f,0x00,0x07,0x00,0x00,0x00,0xf8,0xf0,0xe6,0x07,0xa0,0xfd,0x00,0xf4,0x1f,0x00, +0x00,0x00,0x27,0x00,0x00,0x00,0x10,0x4c,0x07,0x00,0x57,0x00,0x80,0x03,0x66,0x5b, +0x0f,0x00,0x80,0xcd,0xff,0x0f,0x40,0xe2,0xff,0x07,0xe0,0xff,0x00,0x80,0x1f,0x00, +0x0f,0x00,0x07,0x00,0x00,0x00,0x00,0xe3,0x0f,0x00,0x87,0xff,0xff,0x0f,0x40,0xe2, +0x00,0x0f,0x07,0x00,0x00,0x00,0xb0,0x50,0xe6,0x07,0xa0,0xe3,0x00,0xb4,0x3f,0x00, +0x01,0x00,0x87,0x00,0x80,0x07,0x98,0x4c,0x00,0x00,0x17,0x02,0x00,0x00,0xc8,0xf0, +0x07,0x00,0xf7,0x0f,0x80,0x03,0x6b,0x5b,0xf4,0x07,0xe0,0xff,0x00,0xb4,0x1f,0x00, +0xff,0xff,0x08,0x00,0x00,0x00,0x5c,0xef,0x00,0x00,0x07,0x00,0x80,0x1b,0xa8,0xf0, +0x07,0xff,0xc7,0x05,0x80,0x03,0x65,0x4b,0xfd,0x07,0xc0,0xfc,0x00,0x98,0x1f,0x00, +0x0f,0x00,0x00,0x00,0x00,0x00,0x00,0xe3,0x02,0x00,0xc7,0x05,0x80,0x07,0x98,0x4c, +0x02,0x02,0x57,0x00,0x00,0x00,0x28,0x38,0xed,0x07,0xa0,0xff,0x00,0x88,0x1f,0x00, +0x07,0x00,0x27,0x00,0x80,0x03,0x68,0x5b,0x0f,0x00,0x00,0x00,0x00,0x00,0x00,0xe3, +0x03,0x00,0x27,0x00,0x80,0x00,0x48,0x38,0xf0,0x07,0x80,0xfe,0x00,0xb4,0x1f,0x00, +0x04,0x00,0xe7,0x01,0x00,0x00,0x28,0x38,0x00,0x00,0x80,0x2d,0x00,0x00,0x90,0xe2, +0x06,0x03,0xa7,0x05,0x00,0x80,0x10,0x4c,0xe2,0x07,0x40,0xf6,0x00,0x74,0x1c,0x04, +0x07,0x04,0xb7,0x05,0x00,0x08,0x10,0x4c,0x03,0x06,0x07,0x00,0x00,0x20,0xd4,0xee, +0x04,0x00,0x37,0x00,0x00,0x00,0x08,0x5c,0xf0,0x07,0xa0,0x05,0x01,0xc0,0x3f,0x00, +0x07,0x03,0xf7,0x0f,0x80,0x03,0x65,0x5b,0x05,0xff,0x47,0x00,0x00,0x00,0x00,0xec, +0x04,0x00,0x57,0x00,0x00,0x00,0x48,0x38,0xfd,0x17,0xa0,0xe3,0x00,0x88,0x3f,0x00, +0x0f,0x00,0x80,0x27,0x00,0x00,0x40,0xe2,0x06,0x3a,0x37,0x00,0x00,0x20,0xe0,0x5c, +0x06,0x03,0x67,0x00,0x00,0x00,0x47,0x5c,0x1d,0x07,0xc0,0xfc,0x01,0x98,0x1f,0x00, +0x06,0x00,0x67,0x00,0x00,0x00,0x30,0x5c,0x06,0x06,0xf7,0x01,0x00,0x00,0x12,0x38, +0x06,0x06,0xf7,0x01,0x00,0x00,0x12,0x38,0xe6,0x07,0x40,0xfc,0x00,0x90,0x1f,0x00, +0x0a,0x06,0x47,0x00,0x00,0x02,0x47,0x5c,0x06,0x0a,0x47,0x00,0x80,0x00,0x48,0x38, +0x07,0x0a,0xc7,0x01,0x00,0x00,0x28,0x38,0xed,0x07,0x40,0xfc,0x00,0xc4,0x1e,0x00, +0x06,0x06,0x67,0x05,0x00,0x80,0x10,0x4c,0x07,0x07,0x77,0x05,0x00,0x08,0x10,0x4c, +0x09,0x06,0x07,0x00,0x00,0x20,0xd4,0xee,0xe6,0x07,0x20,0xfc,0x00,0x98,0x1f,0x00, +0x0b,0x00,0x47,0x05,0x80,0x07,0x98,0x4c,0x08,0x05,0xb7,0x00,0x80,0x7f,0x00,0x5b, +0x0b,0x05,0xb7,0x00,0xa8,0x7f,0x00,0x5b,0xfd,0x07,0xa0,0xfd,0x00,0x88,0x1f,0x00, +0x08,0x05,0xb7,0x00,0x18,0x04,0x30,0x5b,0x0c,0x08,0x07,0x05,0x00,0x80,0x10,0x4c, +0x0d,0xff,0x17,0x05,0x00,0x08,0x10,0x4c,0xf1,0x07,0x21,0xf6,0x00,0x84,0x1f,0x00, +0x09,0x0c,0x07,0x00,0x00,0x20,0xdc,0xee,0x08,0x06,0x47,0x00,0x00,0x20,0xd4,0xee, +0xff,0xff,0x87,0x05,0x00,0x80,0x12,0x4c,0xf1,0x07,0xa1,0x17,0x00,0x84,0x3f,0x00, +0x08,0x0c,0x47,0x00,0x00,0x20,0xdc,0xee,0x06,0x06,0x87,0x00,0x00,0x20,0xd4,0xee, +0x07,0x00,0x97,0x05,0x80,0x07,0x98,0x4c,0xe8,0x07,0x20,0xfc,0x00,0x84,0x1f,0x00, +0x08,0x00,0xf7,0x0f,0x80,0x07,0x98,0x5c,0x07,0x07,0xf7,0x0f,0x80,0x0b,0x65,0x5b, +0x07,0x00,0xf7,0x0f,0x80,0x07,0x98,0x5c,0xfb,0x00,0xa1,0xff,0x01,0xc0,0x1f,0x00, +0x06,0x0c,0x87,0x00,0x00,0x20,0xdc,0xee,0x0f,0x00,0x80,0x11,0x00,0x00,0x40,0xe2, +0x06,0x0a,0x27,0x00,0x00,0x00,0x48,0x38,0xf2,0x07,0x80,0xfc,0x00,0xb4,0x1f,0x00, +0x00,0x00,0x80,0x0c,0x00,0x00,0x90,0xe2,0x07,0x0a,0x27,0x00,0xc0,0x03,0xf8,0x36, +0x06,0x06,0x87,0x05,0x00,0x80,0x10,0x4c,0xe2,0x07,0x40,0xf6,0x00,0xb4,0x1f,0x04, +0x07,0x07,0x97,0x05,0x00,0x08,0x10,0x4c,0x06,0x06,0x07,0x00,0x00,0x20,0xd4,0xee, +0x07,0x06,0x57,0x05,0x80,0x83,0xb9,0x4b,0xfd,0x07,0x00,0xfe,0x00,0xf4,0x1f,0x00, +0x0f,0x00,0x80,0x01,0x00,0x00,0x40,0xe2,0x06,0xf0,0xf7,0x0f,0x00,0x00,0x00,0x01, +0x0f,0x00,0x07,0x00,0x00,0x00,0xf8,0xf0,0xed,0x07,0xa0,0xff,0x00,0xc0,0x1f,0x00, +0x07,0x06,0xf7,0x0f,0x80,0x83,0xbc,0x5b,0x0f,0x00,0x80,0x01,0x00,0x00,0x40,0xe2, +0x06,0x00,0xf7,0x0f,0x80,0x07,0x98,0x5c,0xfd,0x07,0x40,0xfc,0x00,0x44,0x1c,0x00, +0x0f,0x00,0x07,0x00,0x00,0x00,0xf8,0xf0,0x07,0x00,0x57,0x05,0x80,0x07,0x98,0x4c, +0x07,0x07,0x47,0x00,0x00,0x00,0x80,0x50,0xfd,0x07,0x40,0xfc,0x01,0x74,0x1c,0x00, +0x06,0x06,0x07,0x7f,0x43,0x10,0x68,0x38,0x06,0x06,0x77,0x00,0x00,0x10,0x68,0x5c, +0x06,0x0a,0x67,0x00,0x80,0x11,0xb0,0x5c,0x3d,0x08,0xa0,0xff,0x03,0x98,0x1f,0x00, +0x06,0x15,0x67,0x00,0x00,0x00,0xe0,0x5c,0x0f,0x00,0x07,0x00,0x00,0x00,0xf8,0xf0, +0x07,0x05,0x27,0x00,0x00,0x00,0x48,0x38,0xed,0x07,0x40,0xfc,0x00,0xc4,0x03,0x00, +0x0a,0x07,0x27,0x05,0x00,0x80,0x10,0x4c,0x0b,0x08,0x37,0x05,0x00,0x08,0x10,0x4c, +0x06,0x0a,0x07,0x00,0x00,0x20,0xd8,0xee,0xe3,0x07,0xc0,0xfc,0x00,0x84,0x1f,0x00, +0x01,0x00,0x07,0x00,0x00,0x00,0xf0,0xf0,0x06,0x03,0xf7,0xff,0x7f,0x00,0x10,0x39, +0x03,0x06,0x37,0x00,0x00,0x00,0x47,0x5c,0xe5,0x07,0xa0,0xfd,0x00,0xf4,0x1f,0x00, +0x05,0x05,0x17,0x00,0x00,0x00,0x10,0x38,0x07,0x03,0xf7,0x0f,0x80,0x03,0x6b,0x5b, +0x0f,0x00,0x00,0xd9,0xff,0x0f,0x40,0xe2,0xfd,0x07,0xc0,0xfc,0x00,0xb4,0x1f,0x00, +0x0f,0x00,0x07,0x00,0x00,0x00,0xf8,0xf0,0x00,0x00,0x27,0x00,0x00,0x00,0x10,0x4c, +0x07,0x00,0x27,0x00,0x80,0x03,0x66,0x5b,0xfd,0x07,0xe0,0xff,0x00,0xfc,0x1f,0x00, +0x0f,0x00,0x80,0xce,0xff,0x0f,0x40,0xe2,0x0f,0x00,0x07,0x00,0x00,0x00,0x00,0xe3, +0x0f,0x00,0x87,0xff,0xff,0x0f,0x40,0xe2,0xe0,0x07,0x00,0xfc,0x00,0x80,0x1f,0x00, +0x00,0x0f,0x07,0x00,0x00,0x00,0xb0,0x50,0x00,0x0f,0x07,0x00,0x00,0x00,0xb0,0x50, +0x00,0x0f,0x07,0x00,0x00,0x00,0xb0,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x03,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x01,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0b,0x00,0x00,0x00,0x03,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x44,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x68,0x01,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x13,0x00,0x00,0x00,0x02,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0xb0,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0xd8,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x02,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x33,0x00,0x00,0x00,0x00,0x00,0x00,0x70, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x88,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x03,0x00,0x00,0x00,0x09,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6b,0x00,0x00,0x00,0x00,0x00,0x00,0x70, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x48,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xac,0x00,0x00,0x00,0x00,0x00,0x00,0x70, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x78,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0xb0,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x03,0x00,0x00,0x00,0x0a,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x74,0x00,0x00,0x00,0x01,0x00,0x00,0x00, +0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x28,0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x84,0x01,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x09,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xe4,0x00,0x00,0x00,0x01,0x00,0x00,0x00, +0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0xac,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x74,0x01,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x0a,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1b,0x00,0x00,0x00,0x01,0x00,0x00,0x00, +0x06,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x20,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x03,0x00,0x00,0x00,0x00,0x00,0x00, +0x03,0x00,0x00,0x00,0x07,0x00,0x00,0x12,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x94,0x00,0x00,0x00,0x01,0x00,0x00,0x00, +0x06,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0xe0,0x0b,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x03,0x00,0x00,0x00,0x00,0x00,0x00, +0x03,0x00,0x00,0x00,0x08,0x00,0x00,0x0e,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x4e,0x00,0x00,0x00,0x08,0x00,0x00,0x00, +0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0xa0,0x0f,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x09,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc7,0x00,0x00,0x00,0x08,0x00,0x00,0x00, +0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0xa0,0x0f,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x0a,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x05,0x00,0x00,0x00, +0xe0,0x12,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xa8,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0xa8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x01,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x28,0x05,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x78,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x78,0x0a,0x00,0x00,0x00,0x00,0x00,0x00, +0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x06,0x00,0x00,0x00, +0xa0,0x0f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00 +}; + +#ifdef __cplusplus +} +#endif + diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/cuda/RenderParticles_x86.cuh b/PhysX_3.4/Samples/SampleFramework/renderer/src/cuda/RenderParticles_x86.cuh new file mode 100644 index 00000000..77db5db9 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/cuda/RenderParticles_x86.cuh @@ -0,0 +1,1021 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#ifdef __cplusplus +extern "C" { +#endif + +unsigned char updateParticleVertexBuffer[] = { +0x50,0xed,0x55,0xba,0x01,0x00,0x10,0x00,0x60,0x3d,0x00,0x00,0x00,0x00,0x00,0x00, +0x02,0x00,0x01,0x01,0x58,0x00,0x00,0x00,0xf8,0x10,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x01,0x00,0x0b,0x00,0x00,0x00, +0x40,0x00,0x00,0x00,0x12,0x00,0x00,0x00,0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x52,0x65,0x6e,0x64,0x65,0x72,0x50,0x61,0x72,0x74,0x69,0x63,0x6c,0x65,0x73,0x2e, +0x63,0x75,0x00,0x00,0x00,0x00,0x00,0x00,0x7f,0x45,0x4c,0x46,0x01,0x01,0x01,0x33, +0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0xbe,0x00,0x01,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x98,0x10,0x00,0x00,0x40,0x0e,0x00,0x00,0x0b,0x01,0x0b,0x00, +0x34,0x00,0x20,0x00,0x03,0x00,0x28,0x00,0x0f,0x00,0x01,0x00,0x00,0x2e,0x73,0x68, +0x73,0x74,0x72,0x74,0x61,0x62,0x00,0x2e,0x73,0x74,0x72,0x74,0x61,0x62,0x00,0x2e, +0x73,0x79,0x6d,0x74,0x61,0x62,0x00,0x2e,0x74,0x65,0x78,0x74,0x2e,0x75,0x70,0x64, +0x61,0x74,0x65,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x64,0x56,0x42,0x00,0x2e, +0x6e,0x76,0x2e,0x69,0x6e,0x66,0x6f,0x2e,0x75,0x70,0x64,0x61,0x74,0x65,0x49,0x6e, +0x73,0x74,0x61,0x6e,0x63,0x65,0x64,0x56,0x42,0x00,0x2e,0x6e,0x76,0x2e,0x73,0x68, +0x61,0x72,0x65,0x64,0x2e,0x75,0x70,0x64,0x61,0x74,0x65,0x49,0x6e,0x73,0x74,0x61, +0x6e,0x63,0x65,0x64,0x56,0x42,0x00,0x2e,0x6e,0x76,0x2e,0x63,0x6f,0x6e,0x73,0x74, +0x61,0x6e,0x74,0x31,0x2e,0x75,0x70,0x64,0x61,0x74,0x65,0x49,0x6e,0x73,0x74,0x61, +0x6e,0x63,0x65,0x64,0x56,0x42,0x00,0x2e,0x74,0x65,0x78,0x74,0x2e,0x75,0x70,0x64, +0x61,0x74,0x65,0x42,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x56,0x42,0x00,0x2e, +0x6e,0x76,0x2e,0x69,0x6e,0x66,0x6f,0x2e,0x75,0x70,0x64,0x61,0x74,0x65,0x42,0x69, +0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x56,0x42,0x00,0x2e,0x6e,0x76,0x2e,0x73,0x68, +0x61,0x72,0x65,0x64,0x2e,0x75,0x70,0x64,0x61,0x74,0x65,0x42,0x69,0x6c,0x6c,0x62, +0x6f,0x61,0x72,0x64,0x56,0x42,0x00,0x2e,0x6e,0x76,0x2e,0x63,0x6f,0x6e,0x73,0x74, +0x61,0x6e,0x74,0x31,0x2e,0x75,0x70,0x64,0x61,0x74,0x65,0x42,0x69,0x6c,0x6c,0x62, +0x6f,0x61,0x72,0x64,0x56,0x42,0x00,0x2e,0x6e,0x76,0x2e,0x67,0x6c,0x6f,0x62,0x61, +0x6c,0x00,0x2e,0x6e,0x76,0x2e,0x63,0x6f,0x6e,0x73,0x74,0x61,0x6e,0x74,0x31,0x34, +0x00,0x2e,0x72,0x65,0x6c,0x2e,0x6e,0x76,0x2e,0x63,0x6f,0x6e,0x73,0x74,0x61,0x6e, +0x74,0x31,0x34,0x00,0x00,0x2e,0x73,0x68,0x73,0x74,0x72,0x74,0x61,0x62,0x00,0x2e, +0x73,0x74,0x72,0x74,0x61,0x62,0x00,0x2e,0x73,0x79,0x6d,0x74,0x61,0x62,0x00,0x75, +0x70,0x64,0x61,0x74,0x65,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x64,0x56,0x42, +0x00,0x2e,0x74,0x65,0x78,0x74,0x2e,0x75,0x70,0x64,0x61,0x74,0x65,0x49,0x6e,0x73, +0x74,0x61,0x6e,0x63,0x65,0x64,0x56,0x42,0x00,0x2e,0x6e,0x76,0x2e,0x69,0x6e,0x66, +0x6f,0x2e,0x75,0x70,0x64,0x61,0x74,0x65,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65, +0x64,0x56,0x42,0x00,0x2e,0x6e,0x76,0x2e,0x73,0x68,0x61,0x72,0x65,0x64,0x2e,0x75, +0x70,0x64,0x61,0x74,0x65,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x64,0x56,0x42, +0x00,0x2e,0x6e,0x76,0x2e,0x63,0x6f,0x6e,0x73,0x74,0x61,0x6e,0x74,0x31,0x2e,0x75, +0x70,0x64,0x61,0x74,0x65,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x64,0x56,0x42, +0x00,0x63,0x6f,0x6e,0x73,0x74,0x00,0x5f,0x5f,0x63,0x75,0x64,0x61,0x70,0x61,0x72, +0x6d,0x5f,0x75,0x70,0x64,0x61,0x74,0x65,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65, +0x64,0x56,0x42,0x5f,0x64,0x65,0x73,0x74,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e, +0x73,0x00,0x5f,0x5f,0x63,0x75,0x64,0x61,0x70,0x61,0x72,0x6d,0x5f,0x75,0x70,0x64, +0x61,0x74,0x65,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x64,0x56,0x42,0x5f,0x64, +0x65,0x73,0x74,0x52,0x6f,0x74,0x61,0x74,0x69,0x6f,0x6e,0x30,0x00,0x5f,0x5f,0x63, +0x75,0x64,0x61,0x70,0x61,0x72,0x6d,0x5f,0x75,0x70,0x64,0x61,0x74,0x65,0x49,0x6e, +0x73,0x74,0x61,0x6e,0x63,0x65,0x64,0x56,0x42,0x5f,0x64,0x65,0x73,0x74,0x52,0x6f, +0x74,0x61,0x74,0x69,0x6f,0x6e,0x31,0x00,0x5f,0x5f,0x63,0x75,0x64,0x61,0x70,0x61, +0x72,0x6d,0x5f,0x75,0x70,0x64,0x61,0x74,0x65,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63, +0x65,0x64,0x56,0x42,0x5f,0x64,0x65,0x73,0x74,0x52,0x6f,0x74,0x61,0x74,0x69,0x6f, +0x6e,0x32,0x00,0x5f,0x5f,0x63,0x75,0x64,0x61,0x70,0x61,0x72,0x6d,0x5f,0x75,0x70, +0x64,0x61,0x74,0x65,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x64,0x56,0x42,0x5f, +0x64,0x65,0x73,0x74,0x53,0x74,0x72,0x69,0x64,0x65,0x00,0x5f,0x5f,0x63,0x75,0x64, +0x61,0x70,0x61,0x72,0x6d,0x5f,0x75,0x70,0x64,0x61,0x74,0x65,0x49,0x6e,0x73,0x74, +0x61,0x6e,0x63,0x65,0x64,0x56,0x42,0x5f,0x73,0x72,0x63,0x50,0x6f,0x73,0x69,0x74, +0x69,0x6f,0x6e,0x73,0x00,0x5f,0x5f,0x63,0x75,0x64,0x61,0x70,0x61,0x72,0x6d,0x5f, +0x75,0x70,0x64,0x61,0x74,0x65,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x64,0x56, +0x42,0x5f,0x73,0x72,0x63,0x52,0x6f,0x74,0x61,0x74,0x69,0x6f,0x6e,0x73,0x00,0x5f, +0x5f,0x63,0x75,0x64,0x61,0x70,0x61,0x72,0x6d,0x5f,0x75,0x70,0x64,0x61,0x74,0x65, +0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x64,0x56,0x42,0x5f,0x76,0x61,0x6c,0x69, +0x64,0x50,0x61,0x72,0x74,0x69,0x63,0x6c,0x65,0x42,0x69,0x74,0x6d,0x61,0x70,0x00, +0x5f,0x5f,0x63,0x75,0x64,0x61,0x70,0x61,0x72,0x6d,0x5f,0x75,0x70,0x64,0x61,0x74, +0x65,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x64,0x56,0x42,0x5f,0x76,0x61,0x6c, +0x69,0x64,0x50,0x61,0x72,0x74,0x69,0x63,0x6c,0x65,0x52,0x61,0x6e,0x67,0x65,0x00, +0x75,0x70,0x64,0x61,0x74,0x65,0x42,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x56, +0x42,0x00,0x2e,0x74,0x65,0x78,0x74,0x2e,0x75,0x70,0x64,0x61,0x74,0x65,0x42,0x69, +0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x56,0x42,0x00,0x2e,0x6e,0x76,0x2e,0x69,0x6e, +0x66,0x6f,0x2e,0x75,0x70,0x64,0x61,0x74,0x65,0x42,0x69,0x6c,0x6c,0x62,0x6f,0x61, +0x72,0x64,0x56,0x42,0x00,0x2e,0x6e,0x76,0x2e,0x73,0x68,0x61,0x72,0x65,0x64,0x2e, +0x75,0x70,0x64,0x61,0x74,0x65,0x42,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x56, +0x42,0x00,0x2e,0x6e,0x76,0x2e,0x63,0x6f,0x6e,0x73,0x74,0x61,0x6e,0x74,0x31,0x2e, +0x75,0x70,0x64,0x61,0x74,0x65,0x42,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x56, +0x42,0x00,0x5f,0x5f,0x63,0x75,0x64,0x61,0x70,0x61,0x72,0x6d,0x5f,0x75,0x70,0x64, +0x61,0x74,0x65,0x42,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x56,0x42,0x5f,0x64, +0x65,0x73,0x74,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x73,0x00,0x5f,0x5f,0x63, +0x75,0x64,0x61,0x70,0x61,0x72,0x6d,0x5f,0x75,0x70,0x64,0x61,0x74,0x65,0x42,0x69, +0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x56,0x42,0x5f,0x64,0x65,0x73,0x74,0x41,0x6c, +0x70,0x68,0x61,0x73,0x00,0x5f,0x5f,0x63,0x75,0x64,0x61,0x70,0x61,0x72,0x6d,0x5f, +0x75,0x70,0x64,0x61,0x74,0x65,0x42,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x56, +0x42,0x5f,0x64,0x65,0x73,0x74,0x53,0x74,0x72,0x69,0x64,0x65,0x00,0x5f,0x5f,0x63, +0x75,0x64,0x61,0x70,0x61,0x72,0x6d,0x5f,0x75,0x70,0x64,0x61,0x74,0x65,0x42,0x69, +0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x56,0x42,0x5f,0x66,0x61,0x64,0x69,0x6e,0x67, +0x50,0x65,0x72,0x69,0x6f,0x64,0x00,0x5f,0x5f,0x63,0x75,0x64,0x61,0x70,0x61,0x72, +0x6d,0x5f,0x75,0x70,0x64,0x61,0x74,0x65,0x42,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72, +0x64,0x56,0x42,0x5f,0x73,0x72,0x63,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x73, +0x00,0x5f,0x5f,0x63,0x75,0x64,0x61,0x70,0x61,0x72,0x6d,0x5f,0x75,0x70,0x64,0x61, +0x74,0x65,0x42,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x56,0x42,0x5f,0x73,0x72, +0x63,0x4c,0x69,0x66,0x65,0x74,0x69,0x6d,0x65,0x73,0x00,0x5f,0x5f,0x63,0x75,0x64, +0x61,0x70,0x61,0x72,0x6d,0x5f,0x75,0x70,0x64,0x61,0x74,0x65,0x42,0x69,0x6c,0x6c, +0x62,0x6f,0x61,0x72,0x64,0x56,0x42,0x5f,0x76,0x61,0x6c,0x69,0x64,0x50,0x61,0x72, +0x74,0x69,0x63,0x6c,0x65,0x42,0x69,0x74,0x6d,0x61,0x70,0x00,0x5f,0x5f,0x63,0x75, +0x64,0x61,0x70,0x61,0x72,0x6d,0x5f,0x75,0x70,0x64,0x61,0x74,0x65,0x42,0x69,0x6c, +0x6c,0x62,0x6f,0x61,0x72,0x64,0x56,0x42,0x5f,0x76,0x61,0x6c,0x69,0x64,0x50,0x61, +0x72,0x74,0x69,0x63,0x6c,0x65,0x52,0x61,0x6e,0x67,0x65,0x00,0x2e,0x6e,0x76,0x2e, +0x67,0x6c,0x6f,0x62,0x61,0x6c,0x00,0x5f,0x5a,0x4e,0x35,0x70,0x68,0x79,0x73,0x78, +0x37,0x67,0x4f,0x66,0x66,0x73,0x65,0x74,0x45,0x00,0x2e,0x6e,0x76,0x2e,0x63,0x6f, +0x6e,0x73,0x74,0x61,0x6e,0x74,0x31,0x34,0x00,0x24,0x41,0x44,0x44,0x52,0x45,0x53, +0x53,0x24,0x5f,0x5a,0x4e,0x35,0x70,0x68,0x79,0x73,0x78,0x37,0x67,0x4f,0x66,0x66, +0x73,0x65,0x74,0x45,0x00,0x2e,0x72,0x65,0x6c,0x2e,0x6e,0x76,0x2e,0x63,0x6f,0x6e, +0x73,0x74,0x61,0x6e,0x74,0x31,0x34,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x2d,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x03,0x00,0x0a,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x03,0x00,0x0c,0x00,0x7d,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x03,0x00,0x07,0x00,0x3e,0x02,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x03,0x00,0x0b,0x00,0x71,0x02,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x03,0x00,0x0d,0x00,0x8e,0x02,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x03,0x00,0x08,0x00,0x08,0x04,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x03,0x00,0x0e,0x00,0x13,0x04,0x00,0x00,0x00,0x00,0x00,0x00, +0x04,0x00,0x00,0x00,0x01,0x00,0x0e,0x00,0x26,0x04,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x03,0x00,0x09,0x00,0x1b,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x68,0x03,0x00,0x00,0x12,0x10,0x0a,0x00,0x2c,0x02,0x00,0x00,0x00,0x00,0x00,0x00, +0xf0,0x02,0x00,0x00,0x12,0x10,0x0b,0x00,0x03,0x18,0x24,0x00,0x04,0x17,0x0c,0x00, +0x00,0x00,0x00,0x00,0x08,0x00,0x20,0x00,0x00,0xf0,0x13,0x00,0x04,0x17,0x0c,0x00, +0x00,0x00,0x00,0x00,0x07,0x00,0x1c,0x00,0x00,0xf0,0x13,0x00,0x04,0x17,0x0c,0x00, +0x00,0x00,0x00,0x00,0x06,0x00,0x18,0x00,0x00,0xf0,0x13,0x00,0x04,0x17,0x0c,0x00, +0x00,0x00,0x00,0x00,0x05,0x00,0x14,0x00,0x00,0xf0,0x13,0x00,0x04,0x17,0x0c,0x00, +0x00,0x00,0x00,0x00,0x04,0x00,0x10,0x00,0x00,0xf0,0x13,0x00,0x04,0x17,0x0c,0x00, +0x00,0x00,0x00,0x00,0x03,0x00,0x0c,0x00,0x00,0xf0,0x13,0x00,0x04,0x17,0x0c,0x00, +0x00,0x00,0x00,0x00,0x02,0x00,0x08,0x00,0x00,0xf0,0x13,0x00,0x04,0x17,0x0c,0x00, +0x00,0x00,0x00,0x00,0x01,0x00,0x04,0x00,0x00,0xf0,0x13,0x00,0x04,0x17,0x0c,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf0,0x13,0x00,0x04,0x1e,0x04,0x00, +0x08,0x01,0x00,0x00,0x03,0x18,0x20,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x07,0x00,0x1c,0x00,0x00,0xf0,0x13,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x06,0x00,0x18,0x00,0x00,0xf0,0x13,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x05,0x00,0x14,0x00,0x00,0xf0,0x13,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x04,0x00,0x10,0x00,0x00,0xf0,0x13,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x03,0x00,0x0c,0x00,0x00,0xf0,0x13,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x02,0x00,0x08,0x00,0x00,0xf0,0x13,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x01,0x00,0x04,0x00,0x00,0xf0,0x13,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0xf0,0x13,0x00,0x04,0x1e,0x04,0x00,0x10,0x01,0x00,0x00, +0x00,0x00,0x00,0x00,0x01,0x08,0x00,0x00,0x55,0x55,0x55,0x55,0x33,0x33,0x33,0x33, +0x0f,0x0f,0x0f,0x0f,0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x9e,0x00,0x00,0x00, +0x55,0x55,0x55,0x55,0x33,0x33,0x33,0x33,0x0f,0x0f,0x0f,0x0f,0x00,0x00,0x00,0x00, +0x20,0x00,0x00,0x00,0x9e,0x00,0x00,0x00,0x00,0x00,0x7f,0x43,0x00,0x00,0x00,0x00, +0x05,0x00,0x00,0xa0,0xc0,0x07,0x00,0x04,0x09,0x00,0x00,0x10,0x00,0xc5,0x80,0x27, +0x01,0x06,0x00,0x10,0x00,0xc5,0x40,0x24,0x01,0x04,0x0e,0xd0,0x00,0x05,0xc0,0xa0, +0x03,0xfe,0x1f,0x86,0x00,0x00,0x00,0x00,0xfd,0xd9,0x7c,0x30,0xc8,0x87,0x20,0x64, +0x03,0x00,0x00,0x30,0x80,0x02,0x00,0x00,0x0d,0xd8,0x05,0x30,0x80,0x07,0x30,0xe4, +0xfd,0x07,0x01,0x30,0xc8,0x47,0x00,0x64,0x01,0x02,0x00,0x10,0x80,0xc7,0x03,0x04, +0x03,0x00,0x00,0x30,0x80,0x02,0x00,0x00,0x05,0x02,0x02,0x30,0x80,0x07,0x10,0xc4, +0x11,0x42,0x00,0xa0,0x80,0x07,0x20,0x04,0x19,0xd6,0x00,0x20,0x80,0x47,0x20,0x04, +0x15,0x08,0x02,0x30,0x80,0x07,0x10,0xc4,0x05,0x0c,0x0e,0xd0,0x80,0x07,0xc0,0x80, +0x09,0x02,0x01,0x30,0x80,0x07,0x10,0xe4,0x09,0x04,0x80,0xd0,0x80,0x07,0x40,0x04, +0x05,0x02,0x40,0x20,0x80,0x87,0x00,0x04,0x09,0x02,0x02,0x30,0x80,0x07,0x10,0xe4, +0x05,0x02,0x81,0xd0,0x80,0x07,0x40,0x04,0x09,0x04,0x81,0xd0,0x80,0x07,0x40,0x04, +0x05,0x02,0x00,0x20,0x80,0x87,0x00,0x04,0x09,0x02,0x04,0x30,0x80,0x07,0x10,0xe4, +0x05,0x02,0x00,0x20,0x80,0x87,0x00,0x04,0x05,0x02,0x82,0xd0,0x80,0x07,0x40,0x04, +0x09,0x02,0x40,0x40,0x0b,0x08,0x08,0x00,0x09,0x04,0x01,0x30,0x80,0x07,0x10,0xc4, +0x05,0x02,0x00,0x20,0x80,0x87,0x00,0x04,0x09,0x00,0x00,0x10,0x80,0xc7,0x80,0x27, +0x05,0x02,0x18,0x30,0x80,0x07,0x10,0xe4,0x05,0x04,0x01,0xd7,0x80,0x07,0xc0,0xe0, +0x1d,0x0c,0x0e,0xd0,0x80,0x07,0xc0,0x80,0x03,0x80,0x06,0xa0,0x00,0x00,0x00,0x00, +0xfd,0x0f,0x7c,0x30,0xc8,0x87,0x00,0x64,0x03,0x80,0x06,0x10,0x80,0x02,0x00,0x00, +0x09,0x10,0x00,0x10,0x80,0xc7,0x00,0x44,0x21,0x04,0x05,0x40,0x80,0x07,0x00,0x00, +0x21,0x06,0x04,0x60,0x80,0x07,0x02,0x00,0x21,0x10,0x10,0x30,0x80,0x07,0x10,0xc4, +0x29,0x04,0x04,0x60,0x80,0x07,0x02,0x00,0x05,0x00,0x05,0x30,0x80,0x07,0x10,0xc4, +0x08,0xea,0x0a,0x21,0x20,0xec,0x0a,0x21,0x24,0xee,0x0a,0x21,0x28,0xe8,0x0a,0x21, +0x2d,0x8e,0x00,0x30,0x03,0x00,0x00,0x00,0x2d,0x16,0x07,0xd0,0xc0,0x07,0x00,0x04, +0x2d,0x16,0x00,0xa0,0x80,0x46,0x06,0x44,0x2d,0x16,0x17,0x30,0x80,0x06,0x10,0xec, +0x2d,0x16,0x00,0x31,0x80,0x46,0x41,0x04,0x2d,0x08,0x00,0x10,0x00,0xc1,0x40,0x24, +0x2d,0x96,0x1f,0x30,0x03,0x00,0x00,0x00,0x2d,0x16,0x01,0xd0,0x80,0x47,0x00,0x04, +0x31,0x16,0x05,0x30,0x80,0x07,0x10,0xc4,0x35,0x16,0x02,0x30,0x80,0x07,0x10,0xc4, +0x30,0x98,0x0d,0x20,0x30,0xf4,0x0c,0x21,0x35,0x18,0x0e,0xd0,0x80,0x07,0xc0,0x80, +0x35,0x04,0x0e,0xd0,0x80,0x07,0xc0,0xa0,0x35,0x98,0x04,0x20,0x03,0x00,0x00,0x00, +0x35,0x1a,0x0e,0xd0,0x80,0x07,0xc0,0x80,0x39,0x84,0x04,0x20,0x03,0x00,0x00,0x00, +0x35,0x1c,0x0e,0xd0,0x80,0x07,0xc0,0xa0,0x35,0x98,0x08,0x20,0x03,0x00,0x00,0x00, +0x35,0x1a,0x0e,0xd0,0x80,0x07,0xc0,0x80,0x39,0x84,0x08,0x20,0x03,0x00,0x00,0x00, +0x35,0x1c,0x0e,0xd0,0x80,0x07,0xc0,0xa0,0x35,0x98,0x0c,0x20,0x03,0x00,0x00,0x00, +0x35,0x1a,0x0e,0xd0,0x80,0x07,0xc0,0x80,0x35,0x10,0x0e,0xd0,0x80,0x07,0xc0,0xa0, +0x35,0x98,0x10,0x20,0x03,0x00,0x00,0x00,0x35,0x1a,0x0e,0xd0,0x80,0x07,0xc0,0x80, +0x39,0x90,0x04,0x20,0x03,0x00,0x00,0x00,0x35,0x1c,0x0e,0xd0,0x80,0x07,0xc0,0xa0, +0x35,0x98,0x14,0x20,0x03,0x00,0x00,0x00,0x35,0x1a,0x0e,0xd0,0x80,0x07,0xc0,0x80, +0x39,0x90,0x08,0x20,0x03,0x00,0x00,0x00,0x35,0x1c,0x0e,0xd0,0x80,0x07,0xc0,0xa0, +0x35,0x98,0x18,0x20,0x03,0x00,0x00,0x00,0x35,0x1a,0x0e,0xd0,0x80,0x07,0xc0,0x80, +0x35,0x12,0x0e,0xd0,0x80,0x07,0xc0,0xa0,0x35,0x98,0x1c,0x20,0x03,0x00,0x00,0x00, +0x35,0x1a,0x0e,0xd0,0x80,0x07,0xc0,0x80,0x39,0x92,0x04,0x20,0x03,0x00,0x00,0x00, +0x35,0x1c,0x0e,0xd0,0x80,0x07,0xc0,0xa0,0x31,0x98,0x20,0x20,0x03,0x00,0x00,0x00, +0x31,0x18,0x0e,0xd0,0x80,0x07,0xc0,0x80,0x35,0x92,0x08,0x20,0x03,0x00,0x00,0x00, +0x31,0x1a,0x0e,0xd0,0x80,0x07,0xc0,0xa0,0x2d,0x16,0x04,0x30,0x80,0x07,0x10,0xc4, +0x31,0xd2,0x00,0x20,0x80,0xc7,0x22,0x04,0x2d,0x18,0x0e,0xd0,0x80,0x07,0xc0,0x80, +0x2d,0x14,0x0e,0xd0,0x80,0x07,0xc0,0xa0,0x2d,0x98,0x04,0x20,0x03,0x00,0x00,0x00, +0x2d,0x16,0x0e,0xd0,0x80,0x07,0xc0,0x80,0x35,0x94,0x04,0x20,0x03,0x00,0x00,0x00, +0x2d,0x1a,0x0e,0xd0,0x80,0x07,0xc0,0xa0,0x2d,0x98,0x08,0x20,0x03,0x00,0x00,0x00, +0x2d,0x16,0x0e,0xd0,0x80,0x07,0xc0,0x80,0x31,0x94,0x08,0x20,0x03,0x00,0x00,0x00, +0x2d,0x18,0x0e,0xd0,0x80,0x07,0xc0,0xa0,0x2d,0x8e,0x3f,0x20,0xff,0xff,0xff,0x0f, +0x1d,0x0e,0x0b,0xd0,0xc0,0x07,0x00,0x04,0x08,0xf0,0x02,0x21,0x20,0xf0,0x08,0x21, +0x24,0xf0,0x09,0x21,0x28,0xf0,0x0a,0x21,0x03,0xc0,0x02,0x10,0x80,0x02,0x00,0x00, +0x01,0x00,0x00,0x20,0x82,0x07,0x01,0x04,0xfd,0x07,0x00,0x30,0xc8,0x87,0x01,0x64, +0x19,0x0a,0x00,0x20,0x80,0x87,0x01,0x04,0x03,0xf0,0x00,0x10,0x80,0x02,0x00,0x00, +0x01,0x00,0x00,0xf0,0x01,0x00,0x00,0xe0,0x01,0x00,0x00,0xa0,0xc0,0x07,0x00,0x04, +0x09,0x00,0x00,0x10,0x00,0xc5,0x80,0x27,0x05,0x06,0x00,0x10,0x00,0xc5,0x40,0x24, +0x05,0x04,0x0e,0xd0,0x00,0x05,0xc0,0xa0,0x03,0xfe,0x1f,0x86,0x00,0x00,0x00,0x00, +0xfd,0xd7,0x7c,0x30,0xc8,0x87,0x20,0x64,0x03,0x00,0x00,0x30,0x80,0x02,0x00,0x00, +0x11,0xd6,0x05,0x30,0x80,0x07,0x30,0xe4,0xfd,0x09,0x00,0x30,0xc8,0x47,0x00,0x64, +0x09,0x00,0x00,0x10,0x80,0xc7,0x03,0x04,0x03,0x00,0x00,0x30,0x80,0x02,0x00,0x00, +0x01,0x00,0x02,0x30,0x80,0x07,0x10,0xc4,0x15,0x42,0x00,0xa0,0x80,0x07,0x20,0x04, +0x1d,0xd4,0x00,0x20,0x80,0x07,0x20,0x04,0x19,0x0a,0x02,0x30,0x80,0x07,0x10,0xc4, +0x01,0x0e,0x0e,0xd0,0x80,0x07,0xc0,0x80,0x05,0x00,0x01,0x30,0x80,0x07,0x10,0xe4, +0x05,0x02,0x80,0xd0,0x80,0x07,0x40,0x04,0x01,0x00,0x40,0x20,0x80,0x47,0x00,0x04, +0x05,0x00,0x02,0x30,0x80,0x07,0x10,0xe4,0x01,0x00,0x81,0xd0,0x80,0x07,0x40,0x04, +0x05,0x02,0x81,0xd0,0x80,0x07,0x40,0x04,0x01,0x00,0x00,0x20,0x80,0x47,0x00,0x04, +0x05,0x00,0x04,0x30,0x80,0x07,0x10,0xe4,0x01,0x00,0x00,0x20,0x80,0x47,0x00,0x04, +0x01,0x00,0x82,0xd0,0x80,0x07,0x40,0x04,0x05,0x00,0x40,0x40,0x0b,0x08,0x08,0x00, +0x05,0x02,0x01,0x30,0x80,0x07,0x10,0xc4,0x01,0x00,0x00,0x20,0x80,0x47,0x00,0x04, +0x05,0x00,0x00,0x10,0x80,0xc7,0x80,0x27,0x01,0x00,0x18,0x30,0x80,0x07,0x10,0xe4, +0x05,0x02,0x00,0xd7,0x80,0x07,0xc0,0xe0,0x21,0x0e,0x0e,0xd0,0x80,0x07,0xc0,0x80, +0x03,0x90,0x05,0xa0,0x00,0x00,0x00,0x00,0x0d,0x02,0x00,0x10,0x80,0xc7,0x03,0x04, +0xfd,0x11,0x7c,0x30,0xc8,0x87,0x00,0x64,0x03,0x90,0x05,0x10,0x80,0x02,0x00,0x00, +0x01,0x0c,0x00,0x10,0x80,0xc7,0x00,0x44,0x25,0x04,0x01,0x40,0x80,0x07,0x00,0x00, +0x25,0x06,0x00,0x60,0x80,0x47,0x02,0x00,0x25,0x12,0x10,0x30,0x80,0x07,0x10,0xc4, +0x01,0x04,0x00,0x60,0x80,0x47,0x02,0x00,0xfd,0xd3,0x7c,0x30,0xc8,0x47,0x21,0x64, +0x05,0x04,0x05,0x30,0x80,0x07,0x10,0xc4,0x25,0xc8,0x00,0x20,0x80,0x07,0x20,0x04, +0x01,0x90,0x00,0x30,0x03,0x00,0x00,0x00,0x01,0x00,0x08,0xd0,0xd0,0x07,0x00,0x04, +0x01,0x00,0x00,0xa0,0x80,0x56,0x06,0x44,0x01,0x00,0x17,0x30,0x80,0x16,0x10,0xec, +0x01,0x00,0x00,0x31,0x80,0x56,0x41,0x04,0x01,0x08,0x00,0x10,0x00,0xd1,0x40,0x24, +0x01,0x80,0x1f,0x30,0x03,0x00,0x00,0x00,0x01,0x00,0x01,0xd0,0x80,0x47,0x00,0x04, +0x29,0x00,0x04,0x30,0x80,0x07,0x10,0xc4,0x29,0xd0,0x00,0x20,0x80,0x87,0x22,0x04, +0x2d,0x14,0x0e,0xd0,0x80,0x07,0xc0,0x80,0x2d,0x12,0x0e,0xd0,0x80,0x07,0xc0,0xa0, +0x2d,0x94,0x04,0x20,0x03,0x00,0x00,0x00,0x2d,0x16,0x0e,0xd0,0x80,0x07,0xc0,0x80, +0x31,0x92,0x04,0x20,0x03,0x00,0x00,0x00,0x2d,0x18,0x0e,0xd0,0x80,0x07,0xc0,0xa0, +0x29,0x94,0x08,0x20,0x03,0x00,0x00,0x00,0x29,0x14,0x0e,0xd0,0x80,0x07,0xc0,0x80, +0x2d,0x92,0x08,0x20,0x03,0x00,0x00,0x00,0x29,0x16,0x0e,0xd0,0x80,0x07,0xc0,0xa0, +0x03,0x40,0x05,0x10,0x00,0x01,0x00,0x00,0x01,0x00,0x02,0x30,0x80,0x07,0x10,0xc4, +0x01,0xd2,0x00,0x20,0x80,0x07,0x20,0x04,0x29,0x00,0x0e,0xd0,0x80,0x07,0xc0,0x80, +0xfd,0xcf,0x0a,0xb0,0xd8,0xc7,0x20,0x60,0x03,0x10,0x05,0xa0,0x00,0x00,0x00,0x00, +0x03,0xa0,0x04,0x10,0x00,0x11,0x00,0x00,0x01,0x80,0x3f,0x10,0x0f,0x00,0x00,0x00, +0x03,0x10,0x05,0x10,0x80,0x07,0x00,0x00,0xfd,0x15,0x7c,0xb0,0xd8,0xc7,0x00,0x60, +0x01,0xf8,0x00,0x10,0x80,0xd6,0x03,0x04,0x01,0x0e,0x00,0x10,0x00,0xd1,0x00,0x44, +0x29,0x14,0x86,0xc0,0x00,0x11,0x40,0x00,0x01,0x00,0x00,0x90,0x00,0x11,0x00,0x00, +0x01,0x14,0x00,0xc0,0x00,0x11,0x00,0x00,0x01,0x00,0x00,0xa0,0x00,0x51,0x06,0x84, +0x29,0x06,0x02,0x30,0x82,0x07,0x10,0xc4,0x29,0xca,0x00,0x20,0x80,0x87,0x22,0x04, +0x01,0x14,0x0e,0xd0,0x80,0x07,0x00,0xa0,0x01,0x90,0x3f,0x20,0xff,0xff,0xff,0x0f, +0x21,0x10,0x00,0xd0,0xd0,0x07,0x00,0x04,0x25,0xcc,0x00,0x20,0x80,0x47,0x22,0x04, +0x0d,0x86,0x01,0x20,0x03,0x00,0x00,0x00,0x03,0xd0,0x02,0x10,0x80,0x12,0x00,0x00, +0x09,0x04,0x00,0x20,0x82,0x47,0x01,0x04,0xfd,0x09,0x02,0x30,0xc8,0x87,0x01,0x64, +0x1d,0x0c,0x00,0x20,0x80,0xc7,0x01,0x04,0x03,0xf0,0x00,0x10,0x80,0x02,0x00,0x00, +0x01,0x00,0x00,0xf0,0x01,0x00,0x00,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x01,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x34,0x00,0x00,0x00,0x28,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0b,0x00,0x00,0x00,0x03,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x5c,0x01,0x00,0x00,0x64,0x04,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x13,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0xc0,0x05,0x00,0x00,0xc0,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x09,0x00,0x00,0x00, +0x04,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x33,0x00,0x00,0x00,0x00,0x00,0x00,0x70, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x06,0x00,0x00,0x9c,0x00,0x00,0x00, +0x03,0x00,0x00,0x00,0x0a,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0xa3,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x1c,0x07,0x00,0x00,0x8c,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x0b,0x00,0x00,0x00, +0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x15,0x01,0x00,0x00,0x09,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xa8,0x07,0x00,0x00,0x08,0x00,0x00,0x00, +0x03,0x00,0x00,0x00,0x09,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x08,0x00,0x00,0x00, +0x6b,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0xb0,0x07,0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0a,0x00,0x00,0x00, +0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xdb,0x00,0x00,0x00,0x01,0x00,0x00,0x00, +0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc8,0x07,0x00,0x00,0x1c,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x0b,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x06,0x01,0x00,0x00,0x01,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0xe4,0x07,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1b,0x00,0x00,0x00,0x01,0x00,0x00,0x00, +0x06,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0xe8,0x07,0x00,0x00,0x68,0x03,0x00,0x00, +0x03,0x00,0x00,0x00,0x0a,0x00,0x00,0x0f,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x8b,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x06,0x00,0x10,0x00,0x00,0x00,0x00,0x00, +0x50,0x0b,0x00,0x00,0xf0,0x02,0x00,0x00,0x03,0x00,0x00,0x00,0x0b,0x00,0x00,0x0d, +0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x4e,0x00,0x00,0x00,0x08,0x00,0x00,0x00, +0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x0e,0x00,0x00,0x34,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x0a,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0xbe,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x40,0x0e,0x00,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0b,0x00,0x00,0x00, +0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfb,0x00,0x00,0x00,0x08,0x00,0x00,0x00, +0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x0e,0x00,0x00,0x04,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x06,0x00,0x00,0x00,0x98,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x60,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x04,0x00,0x00,0x00, +0x01,0x00,0x00,0x00,0xb0,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x90,0x06,0x00,0x00,0x90,0x06,0x00,0x00,0x05,0x00,0x00,0x00,0x04,0x00,0x00,0x00, +0x01,0x00,0x00,0x00,0x40,0x0e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x34,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x04,0x00,0x00,0x00, +0x02,0x00,0x01,0x01,0x58,0x00,0x00,0x00,0xd8,0x0b,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x01,0x00,0x14,0x00,0x00,0x00, +0x40,0x00,0x00,0x00,0x12,0x00,0x00,0x00,0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x52,0x65,0x6e,0x64,0x65,0x72,0x50,0x61,0x72,0x74,0x69,0x63,0x6c,0x65,0x73,0x2e, +0x63,0x75,0x00,0x00,0x00,0x00,0x00,0x00,0x7f,0x45,0x4c,0x46,0x01,0x01,0x01,0x33, +0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0xbe,0x00,0x01,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x74,0x0b,0x00,0x00,0x6c,0x09,0x00,0x00,0x14,0x01,0x14,0x00, +0x34,0x00,0x20,0x00,0x03,0x00,0x28,0x00,0x0d,0x00,0x01,0x00,0x00,0x2e,0x73,0x68, +0x73,0x74,0x72,0x74,0x61,0x62,0x00,0x2e,0x73,0x74,0x72,0x74,0x61,0x62,0x00,0x2e, +0x73,0x79,0x6d,0x74,0x61,0x62,0x00,0x2e,0x74,0x65,0x78,0x74,0x2e,0x75,0x70,0x64, +0x61,0x74,0x65,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x64,0x56,0x42,0x00,0x2e, +0x6e,0x76,0x2e,0x69,0x6e,0x66,0x6f,0x2e,0x75,0x70,0x64,0x61,0x74,0x65,0x49,0x6e, +0x73,0x74,0x61,0x6e,0x63,0x65,0x64,0x56,0x42,0x00,0x2e,0x6e,0x76,0x2e,0x73,0x68, +0x61,0x72,0x65,0x64,0x2e,0x75,0x70,0x64,0x61,0x74,0x65,0x49,0x6e,0x73,0x74,0x61, +0x6e,0x63,0x65,0x64,0x56,0x42,0x00,0x2e,0x6e,0x76,0x2e,0x69,0x6e,0x66,0x6f,0x00, +0x2e,0x6e,0x76,0x2e,0x63,0x6f,0x6e,0x73,0x74,0x61,0x6e,0x74,0x30,0x2e,0x75,0x70, +0x64,0x61,0x74,0x65,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x64,0x56,0x42,0x00, +0x2e,0x74,0x65,0x78,0x74,0x2e,0x75,0x70,0x64,0x61,0x74,0x65,0x42,0x69,0x6c,0x6c, +0x62,0x6f,0x61,0x72,0x64,0x56,0x42,0x00,0x2e,0x6e,0x76,0x2e,0x69,0x6e,0x66,0x6f, +0x2e,0x75,0x70,0x64,0x61,0x74,0x65,0x42,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64, +0x56,0x42,0x00,0x2e,0x6e,0x76,0x2e,0x73,0x68,0x61,0x72,0x65,0x64,0x2e,0x75,0x70, +0x64,0x61,0x74,0x65,0x42,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x56,0x42,0x00, +0x2e,0x6e,0x76,0x2e,0x63,0x6f,0x6e,0x73,0x74,0x61,0x6e,0x74,0x30,0x2e,0x75,0x70, +0x64,0x61,0x74,0x65,0x42,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x56,0x42,0x00, +0x00,0x2e,0x73,0x68,0x73,0x74,0x72,0x74,0x61,0x62,0x00,0x2e,0x73,0x74,0x72,0x74, +0x61,0x62,0x00,0x2e,0x73,0x79,0x6d,0x74,0x61,0x62,0x00,0x75,0x70,0x64,0x61,0x74, +0x65,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x64,0x56,0x42,0x00,0x2e,0x74,0x65, +0x78,0x74,0x2e,0x75,0x70,0x64,0x61,0x74,0x65,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63, +0x65,0x64,0x56,0x42,0x00,0x2e,0x6e,0x76,0x2e,0x69,0x6e,0x66,0x6f,0x2e,0x75,0x70, +0x64,0x61,0x74,0x65,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x64,0x56,0x42,0x00, +0x2e,0x6e,0x76,0x2e,0x73,0x68,0x61,0x72,0x65,0x64,0x2e,0x75,0x70,0x64,0x61,0x74, +0x65,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x64,0x56,0x42,0x00,0x2e,0x6e,0x76, +0x2e,0x69,0x6e,0x66,0x6f,0x00,0x5f,0x5a,0x4e,0x35,0x70,0x68,0x79,0x73,0x78,0x37, +0x67,0x4f,0x66,0x66,0x73,0x65,0x74,0x45,0x00,0x2e,0x6e,0x76,0x2e,0x63,0x6f,0x6e, +0x73,0x74,0x61,0x6e,0x74,0x30,0x2e,0x75,0x70,0x64,0x61,0x74,0x65,0x49,0x6e,0x73, +0x74,0x61,0x6e,0x63,0x65,0x64,0x56,0x42,0x00,0x5f,0x70,0x61,0x72,0x61,0x6d,0x00, +0x75,0x70,0x64,0x61,0x74,0x65,0x42,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x56, +0x42,0x00,0x2e,0x74,0x65,0x78,0x74,0x2e,0x75,0x70,0x64,0x61,0x74,0x65,0x42,0x69, +0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x56,0x42,0x00,0x2e,0x6e,0x76,0x2e,0x69,0x6e, +0x66,0x6f,0x2e,0x75,0x70,0x64,0x61,0x74,0x65,0x42,0x69,0x6c,0x6c,0x62,0x6f,0x61, +0x72,0x64,0x56,0x42,0x00,0x2e,0x6e,0x76,0x2e,0x73,0x68,0x61,0x72,0x65,0x64,0x2e, +0x75,0x70,0x64,0x61,0x74,0x65,0x42,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x56, +0x42,0x00,0x24,0x75,0x70,0x64,0x61,0x74,0x65,0x42,0x69,0x6c,0x6c,0x62,0x6f,0x61, +0x72,0x64,0x56,0x42,0x24,0x5f,0x5a,0x4e,0x35,0x70,0x68,0x79,0x73,0x78,0x37,0x67, +0x4f,0x66,0x66,0x73,0x65,0x74,0x45,0x00,0x2e,0x6e,0x76,0x2e,0x63,0x6f,0x6e,0x73, +0x74,0x61,0x6e,0x74,0x30,0x2e,0x75,0x70,0x64,0x61,0x74,0x65,0x42,0x69,0x6c,0x6c, +0x62,0x6f,0x61,0x72,0x64,0x56,0x42,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x2d,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x03,0x00,0x09,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x03,0x00,0x0b,0x00,0x99,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x03,0x00,0x07,0x00,0xd2,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x03,0x00,0x0a,0x00,0x05,0x01,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x03,0x00,0x0c,0x00,0x48,0x01,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x03,0x00,0x08,0x00,0x1b,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x30,0x02,0x00,0x00,0x12,0x10,0x09,0x00,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x18,0x02,0x00,0x00,0x12,0x10,0x0a,0x00,0x04,0x0a,0x08,0x00,0x03,0x00,0x00,0x00, +0x20,0x00,0x24,0x00,0x03,0x19,0x24,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x08,0x00,0x20,0x00,0x00,0xf0,0x11,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x07,0x00,0x1c,0x00,0x00,0xf0,0x11,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x06,0x00,0x18,0x00,0x00,0xf0,0x11,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x05,0x00,0x14,0x00,0x00,0xf0,0x11,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x04,0x00,0x10,0x00,0x00,0xf0,0x11,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x03,0x00,0x0c,0x00,0x00,0xf0,0x11,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x02,0x00,0x08,0x00,0x00,0xf0,0x11,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x01,0x00,0x04,0x00,0x00,0xf0,0x11,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0xf0,0x11,0x00,0x04,0x1e,0x04,0x00,0x8c,0x01,0x00,0x00, +0x04,0x12,0x08,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x11,0x08,0x00, +0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x12,0x08,0x00,0x07,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x04,0x11,0x08,0x00,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x04,0x0a,0x08,0x00,0x06,0x00,0x00,0x00,0x20,0x00,0x20,0x00,0x03,0x19,0x20,0x00, +0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x1c,0x00,0x00,0xf0,0x11,0x00, +0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x18,0x00,0x00,0xf0,0x11,0x00, +0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00,0x05,0x00,0x14,0x00,0x00,0xf0,0x11,0x00, +0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x10,0x00,0x00,0xf0,0x11,0x00, +0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x0c,0x00,0x00,0xf0,0x11,0x00, +0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x08,0x00,0x00,0xf0,0x11,0x00, +0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x04,0x00,0x00,0xf0,0x11,0x00, +0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf0,0x11,0x00, +0x04,0x1e,0x04,0x00,0x8c,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xe4,0x5d,0x00,0x00, +0x04,0x44,0x00,0x28,0x04,0x1c,0x00,0x84,0x00,0x00,0x00,0x2c,0x03,0xdc,0x1f,0xfc, +0x00,0x00,0x7e,0x20,0x23,0xdc,0x01,0xfc,0x00,0x00,0x8e,0x1a,0x85,0xe0,0xff,0x03, +0x00,0x00,0x00,0xc9,0x04,0xdc,0xff,0xff,0x00,0x00,0xee,0x50,0x23,0xdc,0xf1,0x03, +0x01,0x40,0x0e,0x19,0xe7,0x01,0x00,0x00,0x00,0x00,0x00,0x80,0xe4,0x9d,0x00,0x00, +0x01,0x40,0x00,0x28,0x03,0x9c,0x20,0x14,0x00,0xc0,0x00,0x58,0x03,0xdc,0x01,0x08, +0x00,0x00,0x0e,0x1a,0xe7,0x01,0x00,0x00,0x00,0x00,0x00,0x80,0x43,0x1c,0x01,0xf0, +0x00,0x40,0x00,0x40,0x03,0xdc,0x00,0x14,0x00,0xc0,0x00,0x60,0x07,0x00,0x00,0xe0, +0x00,0x00,0x00,0x60,0x85,0x1c,0x41,0x00,0x00,0x00,0x00,0x80,0x04,0x9c,0x41,0x10, +0x00,0x00,0x00,0x54,0x85,0x5c,0xf1,0x03,0x00,0x00,0x00,0xc4,0x03,0xc0,0x51,0x18, +0x00,0x00,0x00,0x48,0x85,0xc0,0xf1,0x03,0x00,0x00,0x00,0xcc,0xe7,0x21,0x00,0x80, +0xff,0xff,0x03,0x40,0x33,0xdc,0x41,0xfc,0x00,0x00,0x0e,0x19,0x07,0x00,0x00,0x80, +0x05,0x00,0x00,0x60,0xe7,0x01,0x00,0x40,0x05,0x00,0x00,0x40,0xe4,0x9d,0x01,0xc0, +0x00,0x40,0x00,0x28,0xe4,0xdd,0x01,0xe0,0x00,0x40,0x00,0x28,0x03,0xdc,0x6f,0x1c, +0x00,0x00,0x7e,0x20,0x84,0x1f,0x22,0x11,0x00,0x00,0x00,0x1c,0xa3,0x1c,0x53,0x90, +0x00,0x80,0x0c,0x20,0xa3,0x5c,0x53,0xa0,0x00,0x80,0x0c,0x20,0x03,0x1c,0x42,0x20, +0x00,0x00,0x00,0x68,0x03,0x1c,0x02,0x20,0x00,0x00,0x00,0x78,0x43,0x1c,0x82,0x0c, +0x00,0x00,0x00,0x68,0xa3,0x5c,0x82,0x90,0x00,0xc0,0x0e,0x20,0x85,0xdc,0x92,0x00, +0x00,0x00,0x00,0x80,0x85,0xdc,0xc2,0x00,0x00,0x00,0x00,0x90,0x85,0x9c,0x92,0x10, +0x00,0x00,0x00,0x80,0x85,0x9c,0xc2,0x10,0x00,0x00,0x00,0x90,0x85,0xdc,0x92,0x20, +0x00,0x00,0x00,0x80,0x85,0xdc,0xc2,0x20,0x00,0x00,0x00,0x90,0x85,0x9c,0x92,0x30, +0x00,0x00,0x00,0x80,0xa3,0x1c,0x53,0xb0,0x00,0x80,0x0c,0x20,0x85,0x9c,0xd2,0x00, +0x00,0x00,0x00,0x90,0x85,0xdc,0x92,0x40,0x00,0x00,0x00,0x80,0x85,0xdc,0xd2,0x10, +0x00,0x00,0x00,0x90,0x85,0x9c,0x92,0x50,0x00,0x00,0x00,0x80,0x85,0x9c,0xd2,0x20, +0x00,0x00,0x00,0x90,0x85,0xdc,0x92,0x60,0x00,0x00,0x00,0x80,0x85,0xdc,0xc2,0x00, +0x00,0x00,0x00,0x90,0x85,0x9c,0x92,0x70,0x00,0x00,0x00,0x80,0x83,0xdc,0x82,0xd0, +0x00,0x40,0x00,0x40,0x85,0x9c,0xc2,0x10,0x00,0x00,0x00,0x90,0x85,0x5c,0x92,0x80, +0x00,0x00,0x00,0x80,0xa3,0x9c,0x52,0x80,0x00,0x80,0x0c,0x20,0x03,0x5c,0x51,0x04, +0x00,0xc0,0x00,0x48,0x85,0x5c,0xc2,0x20,0x00,0x00,0x00,0x90,0x85,0x1c,0xb2,0x00, +0x00,0x00,0x00,0x80,0x03,0x1c,0x43,0xfc,0xff,0xff,0x00,0x48,0x03,0x1c,0xc1,0x10, +0x00,0x00,0x00,0x68,0x23,0xdc,0x41,0xfc,0x00,0x00,0x8e,0x1a,0x85,0x1c,0xa2,0x00, +0x00,0x00,0x00,0x90,0x85,0x5c,0xb2,0x10,0x00,0x00,0x00,0x80,0x85,0x5c,0xa2,0x10, +0x00,0x00,0x00,0x90,0x85,0x1c,0xb2,0x20,0x00,0x00,0x00,0x80,0x85,0x1c,0xa2,0x20, +0x00,0x00,0x00,0x90,0xe7,0x01,0x00,0x20,0xfb,0xff,0x03,0x40,0x13,0x1c,0x00,0x20, +0x00,0x40,0x00,0x48,0x03,0xdc,0x01,0x08,0x00,0x00,0x8e,0x19,0xe7,0x01,0x00,0xe0, +0xf8,0xff,0x03,0x40,0xe7,0x1d,0x00,0x00,0x00,0x00,0x00,0x80,0xe4,0x5d,0x00,0x00, +0x04,0x44,0x00,0x28,0x04,0x1c,0x00,0x84,0x00,0x00,0x00,0x2c,0x03,0xdc,0x1f,0xfc, +0x00,0x00,0x7e,0x20,0x23,0xdc,0x01,0xfc,0x00,0x00,0x8e,0x1a,0x85,0xe0,0xff,0x03, +0x00,0x00,0x00,0xc9,0x04,0xdc,0xff,0xff,0x00,0x00,0xee,0x50,0x23,0xdc,0xf1,0xf3, +0x00,0x40,0x0e,0x19,0xe7,0x01,0x00,0x00,0x00,0x00,0x00,0x80,0xe4,0x9d,0x00,0xf0, +0x00,0x40,0x00,0x28,0x03,0x9c,0x20,0x14,0x00,0xc0,0x00,0x58,0x03,0xdc,0x01,0x08, +0x00,0x00,0x0e,0x1a,0xe7,0x01,0x00,0x00,0x00,0x00,0x00,0x80,0x43,0x1c,0x01,0xe0, +0x00,0x40,0x00,0x40,0x03,0xdc,0x00,0x14,0x00,0xc0,0x00,0x60,0x07,0x00,0x00,0xe0, +0x00,0x00,0x00,0x60,0x85,0x5c,0x41,0x00,0x00,0x00,0x00,0x80,0x04,0x9c,0x51,0x14, +0x00,0x00,0x00,0x54,0x85,0x1c,0xf1,0x03,0x00,0x00,0x00,0xc4,0x03,0xc0,0x41,0x18, +0x00,0x00,0x00,0x48,0x85,0xc0,0xf1,0x03,0x00,0x00,0x00,0xcc,0xe7,0x21,0x00,0x80, +0xff,0xff,0x03,0x40,0x33,0xdc,0x51,0xfc,0x00,0x00,0x0e,0x19,0x07,0x00,0x00,0x20, +0x05,0x00,0x00,0x60,0xe7,0x01,0x00,0xe0,0x04,0x00,0x00,0x40,0xe4,0x9d,0x01,0x80, +0x00,0x40,0x00,0x28,0x03,0xdc,0x6f,0xfc,0x00,0x00,0x7e,0x20,0x84,0xdf,0x21,0x15, +0x00,0x00,0x00,0x1c,0xa3,0x9c,0x42,0xa0,0x00,0x40,0x0c,0x20,0x23,0xdc,0xf1,0xd3, +0x00,0x40,0x0e,0x19,0x03,0xdc,0x51,0x1c,0x00,0x00,0x00,0x68,0x03,0xdc,0x01,0x1c, +0x00,0x00,0x00,0x78,0x43,0x5c,0x72,0x0c,0x00,0x00,0x00,0x68,0x83,0xdc,0x92,0xc0, +0x00,0x40,0x00,0x40,0x85,0xdc,0xb1,0x00,0x00,0x00,0x00,0x80,0x85,0xdc,0xa1,0x00, +0x00,0x00,0x00,0x90,0x85,0x1c,0xb2,0x10,0x00,0x00,0x00,0x80,0x85,0x1c,0xa2,0x10, +0x00,0x00,0x00,0x90,0x85,0xdc,0xb1,0x20,0x00,0x00,0x00,0x80,0x85,0xdc,0xa1,0x20, +0x00,0x00,0x00,0x90,0xe7,0x01,0x00,0x40,0x02,0x00,0x00,0x40,0x43,0xdc,0x91,0xd0, +0x00,0x40,0x00,0x40,0x07,0x00,0x00,0xe0,0x01,0x00,0x00,0x60,0x85,0xdc,0x71,0x00, +0x00,0x00,0x00,0x80,0x00,0xdc,0x71,0xb0,0x00,0x40,0x8e,0x2c,0xe7,0x01,0x00,0x40, +0x00,0x00,0x00,0x40,0xe2,0xdd,0x01,0xfc,0x03,0x00,0x00,0x18,0xe7,0x1d,0x00,0x20, +0x01,0x00,0x00,0x40,0x00,0xdc,0x71,0xfc,0x00,0x00,0x0e,0x2e,0xe4,0xe1,0x01,0xfc, +0x00,0x00,0x00,0x28,0xe7,0xa1,0x00,0xc0,0x00,0x00,0x00,0x40,0xe4,0x01,0x02,0xb0, +0x00,0x40,0x00,0x28,0x40,0xc0,0x71,0xc0,0xdf,0xd0,0x00,0x58,0x00,0x00,0x82,0x10, +0x00,0x00,0x00,0xc8,0x40,0xc0,0x71,0x20,0x00,0x00,0x00,0x58,0x04,0xc0,0x21,0x1d, +0x00,0x00,0x86,0x14,0x84,0xc0,0x91,0x1c,0x00,0x00,0x00,0x1c,0x53,0x1c,0x42,0x90, +0x00,0x40,0x00,0x40,0x05,0xdc,0x81,0x00,0x00,0x00,0x00,0x90,0x03,0xdc,0x51,0xfc, +0xff,0xff,0x00,0x48,0x03,0x1c,0x41,0x04,0x00,0xc0,0x00,0x48,0x03,0x5c,0x71,0x14, +0x00,0x00,0x00,0x68,0x23,0xdc,0x51,0xfc,0x00,0x00,0x8e,0x1a,0xe7,0x01,0x00,0x60, +0xfb,0xff,0x03,0x40,0x13,0x1c,0x00,0x20,0x00,0x40,0x00,0x48,0x03,0xdc,0x01,0x08, +0x00,0x00,0x8e,0x19,0xe7,0x01,0x00,0x40,0xf9,0xff,0x03,0x40,0xe7,0x1d,0x00,0x00, +0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00, +0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x34,0x00,0x00,0x00, +0x04,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x0b,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x38,0x01,0x00,0x00,0x68,0x01,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x13,0x00,0x00,0x00, +0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xa0,0x02,0x00,0x00, +0x90,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x04,0x00,0x00,0x00, +0x10,0x00,0x00,0x00,0x33,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x30,0x03,0x00,0x00,0xa8,0x00,0x00,0x00,0x03,0x00,0x00,0x00, +0x09,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6b,0x00,0x00,0x00, +0x00,0x00,0x00,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xd8,0x03,0x00,0x00, +0x30,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0xac,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x08,0x04,0x00,0x00,0x98,0x00,0x00,0x00,0x03,0x00,0x00,0x00, +0x0a,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x74,0x00,0x00,0x00, +0x01,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xa0,0x04,0x00,0x00, +0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x09,0x00,0x00,0x00,0x04,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0xe4,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x02,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0xe4,0x04,0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x0a,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1b,0x00,0x00,0x00, +0x01,0x00,0x00,0x00,0x06,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x24,0x05,0x00,0x00, +0x30,0x02,0x00,0x00,0x03,0x00,0x00,0x00,0x07,0x00,0x00,0x0e,0x04,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x94,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x06,0x00,0x10,0x00, +0x00,0x00,0x00,0x00,0x54,0x07,0x00,0x00,0x18,0x02,0x00,0x00,0x03,0x00,0x00,0x00, +0x08,0x00,0x00,0x0c,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x4e,0x00,0x00,0x00, +0x08,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6c,0x09,0x00,0x00, +0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x09,0x00,0x00,0x00,0x04,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0xc7,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x03,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x6c,0x09,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x0a,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x00, +0x74,0x0b,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x00,0x00, +0x60,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x01,0x00,0x00,0x00, +0xa0,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xcc,0x04,0x00,0x00, +0xcc,0x04,0x00,0x00,0x05,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x01,0x00,0x00,0x00, +0x6c,0x09,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x04,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x02,0x00,0x01,0x01,0x58,0x00,0x00,0x00,0xe8,0x0e,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x01,0x00,0x1e,0x00,0x00,0x00, +0x40,0x00,0x00,0x00,0x12,0x00,0x00,0x00,0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x52,0x65,0x6e,0x64,0x65,0x72,0x50,0x61,0x72,0x74,0x69,0x63,0x6c,0x65,0x73,0x2e, +0x63,0x75,0x00,0x00,0x00,0x00,0x00,0x00,0x7f,0x45,0x4c,0x46,0x01,0x01,0x01,0x33, +0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0xbe,0x00,0x01,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x88,0x0e,0x00,0x00,0x80,0x0c,0x00,0x00,0x1e,0x01,0x1e,0x00, +0x34,0x00,0x20,0x00,0x03,0x00,0x28,0x00,0x0d,0x00,0x01,0x00,0x00,0x2e,0x73,0x68, +0x73,0x74,0x72,0x74,0x61,0x62,0x00,0x2e,0x73,0x74,0x72,0x74,0x61,0x62,0x00,0x2e, +0x73,0x79,0x6d,0x74,0x61,0x62,0x00,0x2e,0x74,0x65,0x78,0x74,0x2e,0x75,0x70,0x64, +0x61,0x74,0x65,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x64,0x56,0x42,0x00,0x2e, +0x6e,0x76,0x2e,0x69,0x6e,0x66,0x6f,0x2e,0x75,0x70,0x64,0x61,0x74,0x65,0x49,0x6e, +0x73,0x74,0x61,0x6e,0x63,0x65,0x64,0x56,0x42,0x00,0x2e,0x6e,0x76,0x2e,0x73,0x68, +0x61,0x72,0x65,0x64,0x2e,0x75,0x70,0x64,0x61,0x74,0x65,0x49,0x6e,0x73,0x74,0x61, +0x6e,0x63,0x65,0x64,0x56,0x42,0x00,0x2e,0x6e,0x76,0x2e,0x69,0x6e,0x66,0x6f,0x00, +0x2e,0x6e,0x76,0x2e,0x63,0x6f,0x6e,0x73,0x74,0x61,0x6e,0x74,0x30,0x2e,0x75,0x70, +0x64,0x61,0x74,0x65,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x64,0x56,0x42,0x00, +0x2e,0x74,0x65,0x78,0x74,0x2e,0x75,0x70,0x64,0x61,0x74,0x65,0x42,0x69,0x6c,0x6c, +0x62,0x6f,0x61,0x72,0x64,0x56,0x42,0x00,0x2e,0x6e,0x76,0x2e,0x69,0x6e,0x66,0x6f, +0x2e,0x75,0x70,0x64,0x61,0x74,0x65,0x42,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64, +0x56,0x42,0x00,0x2e,0x6e,0x76,0x2e,0x73,0x68,0x61,0x72,0x65,0x64,0x2e,0x75,0x70, +0x64,0x61,0x74,0x65,0x42,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x56,0x42,0x00, +0x2e,0x6e,0x76,0x2e,0x63,0x6f,0x6e,0x73,0x74,0x61,0x6e,0x74,0x30,0x2e,0x75,0x70, +0x64,0x61,0x74,0x65,0x42,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x56,0x42,0x00, +0x00,0x2e,0x73,0x68,0x73,0x74,0x72,0x74,0x61,0x62,0x00,0x2e,0x73,0x74,0x72,0x74, +0x61,0x62,0x00,0x2e,0x73,0x79,0x6d,0x74,0x61,0x62,0x00,0x75,0x70,0x64,0x61,0x74, +0x65,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x64,0x56,0x42,0x00,0x2e,0x74,0x65, +0x78,0x74,0x2e,0x75,0x70,0x64,0x61,0x74,0x65,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63, +0x65,0x64,0x56,0x42,0x00,0x2e,0x6e,0x76,0x2e,0x69,0x6e,0x66,0x6f,0x2e,0x75,0x70, +0x64,0x61,0x74,0x65,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x64,0x56,0x42,0x00, +0x2e,0x6e,0x76,0x2e,0x73,0x68,0x61,0x72,0x65,0x64,0x2e,0x75,0x70,0x64,0x61,0x74, +0x65,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x64,0x56,0x42,0x00,0x2e,0x6e,0x76, +0x2e,0x69,0x6e,0x66,0x6f,0x00,0x5f,0x5a,0x4e,0x35,0x70,0x68,0x79,0x73,0x78,0x37, +0x67,0x4f,0x66,0x66,0x73,0x65,0x74,0x45,0x00,0x2e,0x6e,0x76,0x2e,0x63,0x6f,0x6e, +0x73,0x74,0x61,0x6e,0x74,0x30,0x2e,0x75,0x70,0x64,0x61,0x74,0x65,0x49,0x6e,0x73, +0x74,0x61,0x6e,0x63,0x65,0x64,0x56,0x42,0x00,0x5f,0x70,0x61,0x72,0x61,0x6d,0x00, +0x75,0x70,0x64,0x61,0x74,0x65,0x42,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x56, +0x42,0x00,0x2e,0x74,0x65,0x78,0x74,0x2e,0x75,0x70,0x64,0x61,0x74,0x65,0x42,0x69, +0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x56,0x42,0x00,0x2e,0x6e,0x76,0x2e,0x69,0x6e, +0x66,0x6f,0x2e,0x75,0x70,0x64,0x61,0x74,0x65,0x42,0x69,0x6c,0x6c,0x62,0x6f,0x61, +0x72,0x64,0x56,0x42,0x00,0x2e,0x6e,0x76,0x2e,0x73,0x68,0x61,0x72,0x65,0x64,0x2e, +0x75,0x70,0x64,0x61,0x74,0x65,0x42,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x56, +0x42,0x00,0x24,0x75,0x70,0x64,0x61,0x74,0x65,0x42,0x69,0x6c,0x6c,0x62,0x6f,0x61, +0x72,0x64,0x56,0x42,0x24,0x5f,0x5a,0x4e,0x35,0x70,0x68,0x79,0x73,0x78,0x37,0x67, +0x4f,0x66,0x66,0x73,0x65,0x74,0x45,0x00,0x2e,0x6e,0x76,0x2e,0x63,0x6f,0x6e,0x73, +0x74,0x61,0x6e,0x74,0x30,0x2e,0x75,0x70,0x64,0x61,0x74,0x65,0x42,0x69,0x6c,0x6c, +0x62,0x6f,0x61,0x72,0x64,0x56,0x42,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x2d,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x03,0x00,0x09,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x03,0x00,0x0b,0x00,0x99,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x03,0x00,0x07,0x00,0xd2,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x03,0x00,0x0a,0x00,0x05,0x01,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x03,0x00,0x0c,0x00,0x48,0x01,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x03,0x00,0x08,0x00,0x1b,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x80,0x02,0x00,0x00,0x12,0x10,0x09,0x00,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x80,0x02,0x00,0x00,0x12,0x10,0x0a,0x00,0x04,0x0a,0x08,0x00,0x03,0x00,0x00,0x00, +0x40,0x01,0x24,0x00,0x03,0x19,0x24,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x08,0x00,0x20,0x00,0x00,0xf0,0x11,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x07,0x00,0x1c,0x00,0x00,0xf0,0x11,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x06,0x00,0x18,0x00,0x00,0xf0,0x11,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x05,0x00,0x14,0x00,0x00,0xf0,0x11,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x04,0x00,0x10,0x00,0x00,0xf0,0x11,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x03,0x00,0x0c,0x00,0x00,0xf0,0x11,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x02,0x00,0x08,0x00,0x00,0xf0,0x11,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x01,0x00,0x04,0x00,0x00,0xf0,0x11,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0xf0,0x11,0x00,0x04,0x1e,0x04,0x00,0x10,0x02,0x00,0x00, +0x04,0x12,0x08,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x11,0x08,0x00, +0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x12,0x08,0x00,0x07,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x04,0x11,0x08,0x00,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x04,0x0a,0x08,0x00,0x06,0x00,0x00,0x00,0x40,0x01,0x20,0x00,0x03,0x19,0x20,0x00, +0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x1c,0x00,0x00,0xf0,0x11,0x00, +0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x18,0x00,0x00,0xf0,0x11,0x00, +0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00,0x05,0x00,0x14,0x00,0x00,0xf0,0x11,0x00, +0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x10,0x00,0x00,0xf0,0x11,0x00, +0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x0c,0x00,0x00,0xf0,0x11,0x00, +0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x08,0x00,0x00,0xf0,0x11,0x00, +0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x04,0x00,0x00,0xf0,0x11,0x00, +0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf0,0x11,0x00, +0x04,0x1e,0x04,0x00,0x10,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf7,0x82,0xc2,0xe2,0x12,0xc3,0xe2,0x22, +0xe4,0x5d,0x00,0x10,0x01,0x40,0x00,0x28,0x04,0x1c,0x00,0x84,0x00,0x00,0x00,0x2c, +0x23,0xdc,0x01,0xfc,0x00,0x00,0x8e,0x1a,0x85,0xe0,0xff,0x03,0x00,0x00,0x00,0xc9, +0x04,0x1c,0x00,0x00,0x00,0xc0,0x0e,0x50,0x23,0xdc,0xf1,0x83,0x05,0x40,0x0e,0x19, +0xe7,0x01,0x00,0x00,0x00,0x00,0x00,0x80,0x87,0x82,0xc2,0xe2,0x42,0x80,0x02,0x22, +0xe4,0x9d,0x00,0x80,0x05,0x40,0x00,0x28,0x03,0xdc,0x20,0x14,0x00,0xc0,0x00,0x58, +0x03,0xdc,0x01,0x0c,0x00,0x00,0x0e,0x1a,0xe7,0x01,0x00,0x00,0x00,0x00,0x00,0x80, +0x43,0x9c,0x00,0x70,0x05,0x40,0x00,0x40,0x04,0xdc,0xf3,0x1c,0x00,0x00,0x0e,0x0c, +0x85,0x1c,0x21,0x00,0x00,0x00,0x00,0x80,0x07,0x52,0x03,0xb0,0x83,0xb2,0xe3,0x22, +0x07,0x00,0x00,0x00,0x01,0x00,0x00,0x60,0x03,0x5c,0x01,0x14,0x00,0xc0,0x00,0x60, +0x04,0x9c,0x41,0x10,0x00,0x00,0x00,0x54,0x85,0x9c,0xf0,0x03,0x00,0x00,0x00,0xa8, +0x03,0xc0,0x21,0x18,0x00,0x00,0x00,0x48,0x85,0xc1,0xf1,0x03,0x00,0x00,0x00,0xb8, +0xe7,0x25,0x00,0x80,0xff,0xff,0x03,0x40,0x07,0x40,0x02,0x40,0xf0,0x82,0x82,0x22, +0x33,0xdc,0x41,0xfc,0x00,0x00,0x0e,0x19,0x07,0x00,0x00,0x20,0x06,0x00,0x00,0x60, +0xe7,0x01,0x00,0xe0,0x05,0x00,0x00,0x40,0xe4,0x1d,0x03,0x40,0x05,0x40,0x00,0x28, +0xe4,0x5d,0x03,0x60,0x05,0x40,0x00,0x28,0x84,0xdf,0x21,0x11,0x00,0x00,0x00,0x1c, +0x03,0x9c,0x41,0x1c,0x00,0x00,0x00,0x68,0x87,0x82,0x82,0x02,0x62,0xe3,0x72,0x23, +0x03,0x9c,0x01,0x18,0x00,0x00,0x00,0x78,0x43,0x5c,0x62,0x14,0x00,0x00,0x00,0x68, +0xa3,0x9c,0x92,0x90,0x00,0xc0,0x1a,0x20,0x85,0xdc,0xa1,0x00,0x00,0x00,0x00,0x80, +0xa3,0x1c,0x22,0x10,0x05,0x80,0x18,0x20,0x85,0xdc,0x81,0x00,0x00,0x00,0x00,0x90, +0x85,0x9c,0xa1,0x10,0x00,0x00,0x00,0x80,0xe7,0x02,0x62,0xe3,0x72,0xe3,0x72,0x23, +0x85,0x9c,0x81,0x10,0x00,0x00,0x00,0x90,0x85,0xdc,0xa1,0x20,0x00,0x00,0x00,0x80, +0xa3,0xdc,0x22,0x20,0x05,0x80,0x18,0x20,0x85,0xdc,0x81,0x20,0x00,0x00,0x00,0x90, +0x85,0x9c,0xa1,0x30,0x00,0x00,0x00,0x80,0x85,0x9c,0xb1,0x00,0x00,0x00,0x00,0x90, +0x85,0xdc,0xa1,0x40,0x00,0x00,0x00,0x80,0x47,0xe0,0x72,0xe3,0x42,0x70,0xe3,0x22, +0x85,0xdc,0xb1,0x10,0x00,0x00,0x00,0x90,0xa3,0x1c,0x22,0x30,0x05,0x80,0x18,0x20, +0x85,0x9c,0xa1,0x50,0x00,0x00,0x00,0x80,0x85,0x9c,0xb1,0x20,0x00,0x00,0x00,0x90, +0x85,0xdc,0xa1,0x60,0x00,0x00,0x00,0x80,0x83,0xdc,0x92,0x50,0x05,0x40,0x00,0x40, +0x85,0xdc,0x81,0x00,0x00,0x00,0x00,0x90,0x77,0xe3,0x02,0x42,0x60,0xe3,0x02,0x22, +0x85,0x9c,0xa1,0x70,0x00,0x00,0x00,0x80,0x85,0x9c,0x81,0x10,0x00,0x00,0x00,0x90, +0x85,0xdc,0xa1,0x80,0x00,0x00,0x00,0x80,0xa3,0x5c,0x22,0x00,0x05,0x80,0x18,0x20, +0x03,0x9c,0x20,0x04,0x00,0xc0,0x00,0x48,0x85,0xdc,0x81,0x20,0x00,0x00,0x00,0x90, +0x85,0x9c,0xb1,0x00,0x00,0x00,0x00,0x80,0x67,0xe3,0x42,0x70,0x43,0xe0,0x72,0x23, +0x03,0x1c,0x42,0xfc,0xff,0xff,0x00,0x48,0x85,0x9c,0x91,0x00,0x00,0x00,0x00,0x90, +0x85,0xdc,0xb1,0x10,0x00,0x00,0x00,0x80,0x03,0x1c,0x81,0x10,0x00,0x00,0x00,0x68, +0x85,0xdc,0x91,0x10,0x00,0x00,0x00,0x90,0x23,0xdc,0x41,0xfc,0x00,0x00,0x8e,0x1a, +0x85,0x9c,0xb1,0x20,0x00,0x00,0x00,0x80,0x47,0xe0,0xf2,0xc2,0xe2,0xe2,0x02,0x20, +0x85,0x9c,0x91,0x20,0x00,0x00,0x00,0x90,0xe7,0x01,0x00,0x60,0xfa,0xff,0x03,0x40, +0x13,0x1c,0x00,0xa0,0x00,0x40,0x00,0x48,0x03,0xdc,0x01,0x0c,0x00,0x00,0x8e,0x19, +0xe7,0x01,0x00,0xe0,0xf7,0xff,0x03,0x40,0xe7,0x1d,0x00,0x00,0x00,0x00,0x00,0x80, +0xe7,0x1d,0x00,0xe0,0xff,0xff,0x03,0x40,0xf7,0x82,0xc2,0xe2,0x12,0xc3,0xe2,0x22, +0xe4,0x5d,0x00,0x10,0x01,0x40,0x00,0x28,0x04,0x1c,0x00,0x84,0x00,0x00,0x00,0x2c, +0x23,0xdc,0x01,0xfc,0x00,0x00,0x8e,0x1a,0x85,0xe0,0xff,0x03,0x00,0x00,0x00,0xc9, +0x04,0x1c,0x00,0x00,0x00,0xc0,0x0e,0x50,0x23,0xdc,0xf1,0x73,0x05,0x40,0x0e,0x19, +0xe7,0x01,0x00,0x00,0x00,0x00,0x00,0x80,0x87,0x82,0xc2,0xe2,0x42,0x80,0x02,0x22, +0xe4,0x9d,0x00,0x70,0x05,0x40,0x00,0x28,0x03,0x9c,0x21,0x14,0x00,0xc0,0x00,0x58, +0x03,0xdc,0x01,0x18,0x00,0x00,0x0e,0x1a,0xe7,0x01,0x00,0x00,0x00,0x00,0x00,0x80, +0x43,0xdc,0x00,0x60,0x05,0x40,0x00,0x40,0x04,0xdc,0xf3,0x1c,0x00,0x00,0x0e,0x0c, +0x85,0x1c,0x31,0x00,0x00,0x00,0x00,0x80,0x47,0x60,0x03,0xb0,0x83,0xb2,0xe3,0x22, +0x03,0x9c,0x00,0x14,0x00,0xc0,0x00,0x60,0x07,0x00,0x00,0xe0,0x00,0x00,0x00,0x60, +0x04,0x5c,0x41,0x10,0x00,0x00,0x00,0x54,0x85,0xdc,0xf0,0x03,0x00,0x00,0x00,0xa8, +0x03,0xc0,0x31,0x14,0x00,0x00,0x00,0x48,0x85,0xc1,0xf1,0x03,0x00,0x00,0x00,0xb8, +0xe7,0x25,0x00,0x80,0xff,0xff,0x03,0x40,0x07,0x40,0x02,0xf0,0x42,0x80,0x82,0x22, +0x33,0xdc,0x41,0xfc,0x00,0x00,0x0e,0x19,0x07,0x00,0x00,0xa0,0x05,0x00,0x00,0x60, +0xe7,0x01,0x00,0x60,0x05,0x00,0x00,0x40,0xe4,0x1d,0x03,0x00,0x05,0x40,0x00,0x28, +0x84,0x5f,0x21,0x11,0x00,0x00,0x00,0x1c,0x23,0xdc,0xf1,0x53,0x05,0x40,0x0e,0x19, +0x03,0x5c,0x41,0x14,0x00,0x00,0x00,0x68,0x87,0x42,0x80,0x82,0x72,0xe3,0x72,0x23, +0x03,0x5c,0x01,0x14,0x00,0x00,0x00,0x78,0x43,0x1c,0x52,0x08,0x00,0x00,0x00,0x68, +0xa3,0x5c,0x32,0x20,0x05,0x40,0x18,0x20,0x83,0x9c,0x82,0x40,0x05,0x40,0x00,0x40, +0x85,0x5c,0xa1,0x00,0x00,0x00,0x00,0x80,0x85,0x5c,0x91,0x00,0x00,0x00,0x00,0x90, +0x85,0xdc,0xa1,0x10,0x00,0x00,0x00,0x80,0xe7,0x72,0x43,0x00,0x80,0x42,0x70,0x23, +0x85,0xdc,0x91,0x10,0x00,0x00,0x00,0x90,0x85,0x5c,0xa1,0x20,0x00,0x00,0x00,0x80, +0x85,0x5c,0x91,0x20,0x00,0x00,0x00,0x90,0xe7,0x01,0x00,0xa0,0x02,0x00,0x00,0x40, +0x43,0x5c,0x81,0x50,0x05,0x40,0x00,0x40,0x85,0x5c,0x51,0x00,0x00,0x00,0x00,0x80, +0x07,0x00,0x00,0x00,0x02,0x00,0x00,0x60,0xc7,0x22,0x42,0xe0,0xc2,0x42,0x00,0x20, +0x00,0xdc,0x51,0x30,0x05,0x40,0x8e,0x2c,0xe7,0x01,0x00,0x40,0x00,0x00,0x00,0x40, +0xe2,0x5d,0x01,0xfc,0x03,0x00,0x00,0x18,0xe7,0x1d,0x00,0x40,0x01,0x00,0x00,0x40, +0x00,0xdc,0x51,0xfc,0x00,0x00,0x0e,0x2e,0xe4,0x61,0x01,0xfc,0x00,0x00,0x00,0x28, +0xe7,0xa1,0x00,0xe0,0x00,0x00,0x00,0x40,0x47,0x80,0x82,0x82,0x82,0x02,0xf0,0x22, +0xe4,0xc1,0x01,0x30,0x05,0x40,0x00,0x28,0x40,0x40,0x51,0xc0,0xdf,0xd0,0x00,0x58, +0x00,0x00,0x72,0x10,0x00,0x00,0x00,0xc8,0x40,0x40,0x51,0x20,0x00,0x00,0x00,0x58, +0x04,0x40,0x21,0x15,0x00,0x00,0x86,0x14,0x84,0x40,0x91,0x14,0x00,0x00,0x00,0x1c, +0x53,0xdc,0x31,0x10,0x05,0x40,0x00,0x40,0x07,0x40,0x80,0x82,0xc2,0xe2,0xf2,0x22, +0x05,0x5c,0x71,0x00,0x00,0x00,0x00,0x90,0x03,0x5c,0x41,0xfc,0xff,0xff,0x00,0x48, +0x03,0xdc,0x30,0x04,0x00,0xc0,0x00,0x48,0x03,0x1c,0x51,0x10,0x00,0x00,0x00,0x68, +0x23,0xdc,0x41,0xfc,0x00,0x00,0x8e,0x1a,0xe7,0x01,0x00,0xc0,0xfa,0xff,0x03,0x40, +0x13,0x1c,0x00,0xa0,0x00,0x40,0x00,0x48,0xc7,0xe2,0xe2,0x02,0x00,0x00,0x00,0x20, +0x03,0xdc,0x01,0x18,0x00,0x00,0x8e,0x19,0xe7,0x01,0x00,0x40,0xf8,0xff,0x03,0x40, +0xe7,0x1d,0x00,0x00,0x00,0x00,0x00,0x80,0xe7,0x1d,0x00,0xe0,0xff,0xff,0x03,0x40, +0xe4,0x1d,0x00,0x00,0x00,0x00,0x00,0x40,0xe4,0x1d,0x00,0x00,0x00,0x00,0x00,0x40, +0xe4,0x1d,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x01,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x34,0x00,0x00,0x00,0x04,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0b,0x00,0x00,0x00,0x03,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x01,0x00,0x00,0x68,0x01,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x13,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0xa0,0x02,0x00,0x00,0x90,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x06,0x00,0x00,0x00, +0x04,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x33,0x00,0x00,0x00,0x00,0x00,0x00,0x70, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x03,0x00,0x00,0xa8,0x00,0x00,0x00, +0x03,0x00,0x00,0x00,0x09,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x6b,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0xd8,0x03,0x00,0x00,0x30,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xac,0x00,0x00,0x00,0x00,0x00,0x00,0x70, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x04,0x00,0x00,0x98,0x00,0x00,0x00, +0x03,0x00,0x00,0x00,0x0a,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x74,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0xa0,0x04,0x00,0x00,0x64,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x09,0x00,0x00,0x00, +0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xe4,0x00,0x00,0x00,0x01,0x00,0x00,0x00, +0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x06,0x00,0x00,0x60,0x01,0x00,0x00, +0x00,0x00,0x00,0x00,0x0a,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x1b,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x06,0x00,0x10,0x00,0x00,0x00,0x00,0x00, +0x80,0x07,0x00,0x00,0x80,0x02,0x00,0x00,0x03,0x00,0x00,0x00,0x07,0x00,0x00,0x0e, +0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x94,0x00,0x00,0x00,0x01,0x00,0x00,0x00, +0x06,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x0a,0x00,0x00,0x80,0x02,0x00,0x00, +0x03,0x00,0x00,0x00,0x08,0x00,0x00,0x0d,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x4e,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x80,0x0c,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x09,0x00,0x00,0x00, +0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc7,0x00,0x00,0x00,0x08,0x00,0x00,0x00, +0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x0c,0x00,0x00,0x04,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x0a,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x06,0x00,0x00,0x00,0x88,0x0e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x60,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x04,0x00,0x00,0x00, +0x01,0x00,0x00,0x00,0xa0,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0xc4,0x07,0x00,0x00,0xc4,0x07,0x00,0x00,0x05,0x00,0x00,0x00,0x04,0x00,0x00,0x00, +0x01,0x00,0x00,0x00,0x80,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x04,0x00,0x00,0x00, +0x02,0x00,0x01,0x01,0x58,0x00,0x00,0x00,0x48,0x10,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x01,0x00,0x32,0x00,0x00,0x00, +0x40,0x00,0x00,0x00,0x12,0x00,0x00,0x00,0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x52,0x65,0x6e,0x64,0x65,0x72,0x50,0x61,0x72,0x74,0x69,0x63,0x6c,0x65,0x73,0x2e, +0x63,0x75,0x00,0x00,0x00,0x00,0x00,0x00,0x7f,0x45,0x4c,0x46,0x01,0x01,0x01,0x33, +0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0xbe,0x00,0x01,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0xe8,0x0f,0x00,0x00,0xe0,0x0d,0x00,0x00,0x32,0x01,0x32,0x00, +0x34,0x00,0x20,0x00,0x03,0x00,0x28,0x00,0x0d,0x00,0x01,0x00,0x00,0x2e,0x73,0x68, +0x73,0x74,0x72,0x74,0x61,0x62,0x00,0x2e,0x73,0x74,0x72,0x74,0x61,0x62,0x00,0x2e, +0x73,0x79,0x6d,0x74,0x61,0x62,0x00,0x2e,0x74,0x65,0x78,0x74,0x2e,0x75,0x70,0x64, +0x61,0x74,0x65,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x64,0x56,0x42,0x00,0x2e, +0x6e,0x76,0x2e,0x69,0x6e,0x66,0x6f,0x2e,0x75,0x70,0x64,0x61,0x74,0x65,0x49,0x6e, +0x73,0x74,0x61,0x6e,0x63,0x65,0x64,0x56,0x42,0x00,0x2e,0x6e,0x76,0x2e,0x73,0x68, +0x61,0x72,0x65,0x64,0x2e,0x75,0x70,0x64,0x61,0x74,0x65,0x49,0x6e,0x73,0x74,0x61, +0x6e,0x63,0x65,0x64,0x56,0x42,0x00,0x2e,0x6e,0x76,0x2e,0x69,0x6e,0x66,0x6f,0x00, +0x2e,0x6e,0x76,0x2e,0x63,0x6f,0x6e,0x73,0x74,0x61,0x6e,0x74,0x30,0x2e,0x75,0x70, +0x64,0x61,0x74,0x65,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x64,0x56,0x42,0x00, +0x2e,0x74,0x65,0x78,0x74,0x2e,0x75,0x70,0x64,0x61,0x74,0x65,0x42,0x69,0x6c,0x6c, +0x62,0x6f,0x61,0x72,0x64,0x56,0x42,0x00,0x2e,0x6e,0x76,0x2e,0x69,0x6e,0x66,0x6f, +0x2e,0x75,0x70,0x64,0x61,0x74,0x65,0x42,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64, +0x56,0x42,0x00,0x2e,0x6e,0x76,0x2e,0x73,0x68,0x61,0x72,0x65,0x64,0x2e,0x75,0x70, +0x64,0x61,0x74,0x65,0x42,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x56,0x42,0x00, +0x2e,0x6e,0x76,0x2e,0x63,0x6f,0x6e,0x73,0x74,0x61,0x6e,0x74,0x30,0x2e,0x75,0x70, +0x64,0x61,0x74,0x65,0x42,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x56,0x42,0x00, +0x00,0x2e,0x73,0x68,0x73,0x74,0x72,0x74,0x61,0x62,0x00,0x2e,0x73,0x74,0x72,0x74, +0x61,0x62,0x00,0x2e,0x73,0x79,0x6d,0x74,0x61,0x62,0x00,0x75,0x70,0x64,0x61,0x74, +0x65,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x64,0x56,0x42,0x00,0x2e,0x74,0x65, +0x78,0x74,0x2e,0x75,0x70,0x64,0x61,0x74,0x65,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63, +0x65,0x64,0x56,0x42,0x00,0x2e,0x6e,0x76,0x2e,0x69,0x6e,0x66,0x6f,0x2e,0x75,0x70, +0x64,0x61,0x74,0x65,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x64,0x56,0x42,0x00, +0x2e,0x6e,0x76,0x2e,0x73,0x68,0x61,0x72,0x65,0x64,0x2e,0x75,0x70,0x64,0x61,0x74, +0x65,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x64,0x56,0x42,0x00,0x2e,0x6e,0x76, +0x2e,0x69,0x6e,0x66,0x6f,0x00,0x5f,0x5a,0x4e,0x35,0x70,0x68,0x79,0x73,0x78,0x37, +0x67,0x4f,0x66,0x66,0x73,0x65,0x74,0x45,0x00,0x2e,0x6e,0x76,0x2e,0x63,0x6f,0x6e, +0x73,0x74,0x61,0x6e,0x74,0x30,0x2e,0x75,0x70,0x64,0x61,0x74,0x65,0x49,0x6e,0x73, +0x74,0x61,0x6e,0x63,0x65,0x64,0x56,0x42,0x00,0x5f,0x70,0x61,0x72,0x61,0x6d,0x00, +0x75,0x70,0x64,0x61,0x74,0x65,0x42,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x56, +0x42,0x00,0x2e,0x74,0x65,0x78,0x74,0x2e,0x75,0x70,0x64,0x61,0x74,0x65,0x42,0x69, +0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x56,0x42,0x00,0x2e,0x6e,0x76,0x2e,0x69,0x6e, +0x66,0x6f,0x2e,0x75,0x70,0x64,0x61,0x74,0x65,0x42,0x69,0x6c,0x6c,0x62,0x6f,0x61, +0x72,0x64,0x56,0x42,0x00,0x2e,0x6e,0x76,0x2e,0x73,0x68,0x61,0x72,0x65,0x64,0x2e, +0x75,0x70,0x64,0x61,0x74,0x65,0x42,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x56, +0x42,0x00,0x24,0x75,0x70,0x64,0x61,0x74,0x65,0x42,0x69,0x6c,0x6c,0x62,0x6f,0x61, +0x72,0x64,0x56,0x42,0x24,0x5f,0x5a,0x4e,0x35,0x70,0x68,0x79,0x73,0x78,0x37,0x67, +0x4f,0x66,0x66,0x73,0x65,0x74,0x45,0x00,0x2e,0x6e,0x76,0x2e,0x63,0x6f,0x6e,0x73, +0x74,0x61,0x6e,0x74,0x30,0x2e,0x75,0x70,0x64,0x61,0x74,0x65,0x42,0x69,0x6c,0x6c, +0x62,0x6f,0x61,0x72,0x64,0x56,0x42,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x2d,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x03,0x00,0x09,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x03,0x00,0x0b,0x00,0x99,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x03,0x00,0x07,0x00,0xd2,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x03,0x00,0x0a,0x00,0x05,0x01,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x03,0x00,0x0c,0x00,0x48,0x01,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x03,0x00,0x08,0x00,0x1b,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x40,0x03,0x00,0x00,0x12,0x10,0x09,0x00,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x03,0x00,0x00,0x12,0x10,0x0a,0x00,0x04,0x0a,0x08,0x00,0x03,0x00,0x00,0x00, +0x40,0x01,0x24,0x00,0x03,0x19,0x24,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x08,0x00,0x20,0x00,0x00,0xf0,0x11,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x07,0x00,0x1c,0x00,0x00,0xf0,0x11,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x06,0x00,0x18,0x00,0x00,0xf0,0x11,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x05,0x00,0x14,0x00,0x00,0xf0,0x11,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x04,0x00,0x10,0x00,0x00,0xf0,0x11,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x03,0x00,0x0c,0x00,0x00,0xf0,0x11,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x02,0x00,0x08,0x00,0x00,0xf0,0x11,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x01,0x00,0x04,0x00,0x00,0xf0,0x11,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0xf0,0x11,0x00,0x04,0x1e,0x04,0x00,0x10,0x02,0x00,0x00, +0x04,0x1c,0x14,0x00,0x30,0x00,0x00,0x00,0x50,0x00,0x00,0x00,0x58,0x02,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x12,0x08,0x00,0x08,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x04,0x11,0x08,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x04,0x12,0x08,0x00,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x11,0x08,0x00, +0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x0a,0x08,0x00,0x06,0x00,0x00,0x00, +0x40,0x01,0x20,0x00,0x03,0x19,0x20,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x07,0x00,0x1c,0x00,0x00,0xf0,0x11,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x06,0x00,0x18,0x00,0x00,0xf0,0x11,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x05,0x00,0x14,0x00,0x00,0xf0,0x11,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x04,0x00,0x10,0x00,0x00,0xf0,0x11,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x03,0x00,0x0c,0x00,0x00,0xf0,0x11,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x02,0x00,0x08,0x00,0x00,0xf0,0x11,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x01,0x00,0x04,0x00,0x00,0xf0,0x11,0x00,0x04,0x17,0x0c,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0xf0,0x11,0x00,0x04,0x1e,0x04,0x00,0x20,0x02,0x00,0x00, +0x04,0x1c,0x14,0x00,0x30,0x00,0x00,0x00,0x50,0x00,0x00,0x00,0x20,0x02,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xe6,0x07,0xa0,0xe3,0x00,0xb4,0x3f,0x00, +0x01,0x00,0x87,0x00,0x80,0x07,0x98,0x4c,0x00,0x00,0x17,0x02,0x00,0x00,0xc8,0xf0, +0x07,0x00,0xf7,0x0f,0x80,0x03,0x6b,0x5b,0xf4,0x07,0xe0,0xff,0x00,0xb4,0x1f,0x00, +0xff,0xff,0x08,0x00,0x00,0x00,0x5c,0xef,0x00,0x00,0x07,0x00,0x80,0x1b,0xa8,0xf0, +0x07,0xff,0x87,0x05,0x80,0x03,0x65,0x4b,0xfd,0x07,0xc0,0xfc,0x00,0x98,0x1f,0x00, +0x0f,0x00,0x00,0x00,0x00,0x00,0x00,0xe3,0x02,0x00,0x87,0x05,0x80,0x07,0x98,0x4c, +0x02,0x02,0x57,0x00,0x00,0x00,0x28,0x38,0xed,0x07,0xa0,0xff,0x00,0x88,0x1f,0x00, +0x07,0x00,0x27,0x00,0x80,0x03,0x68,0x5b,0x0f,0x00,0x00,0x00,0x00,0x00,0x00,0xe3, +0x03,0x00,0x77,0x05,0x00,0x01,0x18,0x4c,0xb1,0x07,0x20,0xfe,0x00,0x74,0x1c,0x04, +0x03,0x03,0x07,0x00,0x00,0x00,0xd4,0xee,0x00,0x00,0x00,0x27,0x00,0x00,0x90,0xe2, +0x04,0x00,0x37,0x00,0x00,0x00,0x08,0x5c,0xf0,0x07,0x40,0x06,0x01,0xac,0x3f,0x00, +0x07,0x03,0xf7,0x0f,0x80,0x03,0x65,0x5b,0x05,0xff,0x47,0x00,0x00,0x00,0x00,0xec, +0x04,0x00,0x57,0x00,0x00,0x00,0x48,0x38,0xfd,0x17,0xa0,0xe3,0x00,0x88,0x3f,0x00, +0x0f,0x00,0x80,0x22,0x00,0x00,0x40,0xe2,0x06,0x3a,0x37,0x00,0x00,0x20,0xe0,0x5c, +0x06,0x03,0x67,0x00,0x00,0x00,0x47,0x5c,0x1d,0x07,0xc0,0xfc,0x01,0x84,0x1f,0x00, +0x06,0x00,0x67,0x00,0x00,0x00,0x30,0x5c,0x06,0x06,0xf7,0x01,0x00,0x00,0x12,0x38, +0x06,0x06,0xf7,0x01,0x00,0x00,0x12,0x38,0xe5,0x07,0xc0,0xfc,0x00,0x98,0x1f,0x00, +0x07,0x00,0x67,0x05,0x80,0x07,0x98,0x4c,0x09,0x06,0x47,0x00,0x00,0x02,0x47,0x5c, +0x06,0x09,0x47,0x02,0x80,0x03,0x00,0x36,0xe2,0x07,0x20,0xf6,0x00,0x98,0x1f,0x00, +0x0a,0x09,0x47,0x02,0x10,0x03,0x20,0x36,0x07,0x0a,0x07,0x00,0x00,0x00,0xd4,0xee, +0x0f,0x00,0x47,0x05,0x80,0x07,0x98,0x4c,0xe1,0x07,0xc0,0xfc,0x00,0x88,0x1f,0x00, +0x06,0x05,0x17,0x05,0x80,0x07,0x00,0x51,0x08,0x05,0xf7,0x00,0xa8,0x7f,0x00,0x5b, +0x08,0x05,0x87,0x00,0x18,0x03,0x30,0x5b,0xf1,0x07,0x41,0xf6,0x00,0xc4,0x1f,0x04, +0x07,0x08,0x07,0x00,0x00,0x00,0xdc,0xee,0x06,0x0a,0x47,0x00,0x00,0x00,0xd4,0xee, +0x06,0x08,0x47,0x00,0x00,0x00,0xdc,0xee,0xb1,0x07,0x20,0xfc,0x00,0x84,0x1f,0x00, +0x07,0x0a,0x87,0x00,0x00,0x00,0xd4,0xee,0x0b,0x05,0x27,0x05,0x80,0x07,0x00,0x51, +0x0c,0x05,0xf7,0x00,0xa8,0x7f,0x00,0x5b,0xf1,0x07,0x81,0xf6,0x00,0x88,0x1f,0x00, +0x07,0x08,0x87,0x00,0x00,0x00,0xdc,0xee,0x06,0x0a,0xc7,0x00,0x00,0x00,0xd4,0xee, +0x0b,0x05,0xc7,0x00,0x98,0x05,0x30,0x5b,0xf1,0x07,0x41,0xf6,0x00,0xc4,0x1f,0x04, +0x06,0x0b,0x07,0x00,0x00,0x00,0xdc,0xee,0x07,0x0a,0x07,0x01,0x00,0x00,0xd4,0xee, +0x07,0x0b,0x47,0x00,0x00,0x00,0xdc,0xee,0xb1,0x07,0x20,0xfc,0x00,0x84,0x1f,0x00, +0x06,0x0a,0x47,0x01,0x00,0x00,0xd4,0xee,0x08,0x05,0x37,0x05,0x80,0x07,0x00,0x51, +0x0e,0x05,0xf7,0x00,0xa8,0x7f,0x00,0x5b,0xf1,0x07,0x81,0xf6,0x00,0x88,0x1f,0x00, +0x06,0x0b,0x87,0x00,0x00,0x00,0xdc,0xee,0x07,0x0a,0x87,0x01,0x00,0x00,0xd4,0xee, +0x08,0x05,0xe7,0x00,0x18,0x04,0x30,0x5b,0xf1,0x07,0x41,0xf6,0x00,0xc4,0x1f,0x04, +0x07,0x08,0x07,0x00,0x00,0x00,0xdc,0xee,0x06,0x0a,0xc7,0x01,0x00,0x00,0xd4,0xee, +0x06,0x08,0x47,0x00,0x00,0x00,0xdc,0xee,0xbd,0x00,0x20,0xfc,0x01,0xc4,0x1f,0x04, +0x07,0x0a,0x07,0x02,0x00,0x00,0xd4,0xee,0x0a,0x09,0x57,0x05,0x00,0x02,0x18,0x4c, +0x07,0x08,0x87,0x00,0x00,0x00,0xdc,0xee,0xb1,0x07,0x20,0xfc,0x00,0x98,0x1f,0x00, +0x06,0x0a,0x07,0x00,0x00,0x00,0xd4,0xee,0x0b,0x05,0x07,0x05,0x80,0x07,0x00,0x51, +0x0c,0x05,0xf7,0x00,0xa8,0x7f,0x00,0x5b,0xe2,0x07,0x20,0xfe,0x20,0xc4,0x1e,0x00, +0x09,0x05,0xc7,0x00,0x98,0x05,0x30,0x5b,0x06,0x09,0x07,0x00,0x00,0x00,0xdc,0xee, +0x07,0x0a,0x47,0x00,0x00,0x00,0xd4,0xee,0xe6,0x07,0x20,0xfc,0x00,0xc4,0x1f,0x04, +0x08,0x03,0xf7,0xff,0x7f,0x00,0x10,0x39,0x03,0x08,0x37,0x00,0x00,0x00,0x47,0x5c, +0x07,0x09,0x47,0x00,0x00,0x00,0xdc,0xee,0xb4,0x07,0x20,0xfc,0x00,0xc0,0x1f,0x00, +0x06,0x0a,0x87,0x00,0x00,0x00,0xd4,0xee,0x07,0x03,0xf7,0x0f,0x80,0x03,0x6b,0x5b, +0x05,0x05,0x17,0x00,0x00,0x00,0x10,0x38,0xec,0x00,0xa1,0xff,0x01,0xf4,0x1f,0x00, +0x06,0x09,0x87,0x00,0x00,0x00,0xdc,0xee,0x0f,0x00,0x80,0xdd,0xff,0x0f,0x40,0xe2, +0x0f,0x00,0x07,0x00,0x00,0x00,0xf8,0xf0,0xe6,0x07,0xa0,0xfd,0x00,0xf4,0x1f,0x00, +0x00,0x00,0x27,0x00,0x00,0x00,0x10,0x4c,0x07,0x00,0x27,0x00,0x80,0x03,0x66,0x5b, +0x0f,0x00,0x80,0xd5,0xff,0x0f,0x40,0xe2,0xff,0x07,0xe0,0xff,0x00,0x80,0x1f,0x00, +0x0f,0x00,0x07,0x00,0x00,0x00,0x00,0xe3,0x0f,0x00,0x87,0xff,0xff,0x0f,0x40,0xe2, +0x00,0x0f,0x07,0x00,0x00,0x00,0xb0,0x50,0xe6,0x07,0xa0,0xe3,0x00,0xb4,0x3f,0x00, +0x01,0x00,0x87,0x00,0x80,0x07,0x98,0x4c,0x00,0x00,0x17,0x02,0x00,0x00,0xc8,0xf0, +0x07,0x00,0xf7,0x0f,0x80,0x03,0x6b,0x5b,0xf4,0x07,0xe0,0xff,0x00,0xb4,0x1f,0x00, +0xff,0xff,0x08,0x00,0x00,0x00,0x5c,0xef,0x00,0x00,0x07,0x00,0x80,0x1b,0xa8,0xf0, +0x07,0xff,0x77,0x05,0x80,0x03,0x65,0x4b,0xfd,0x07,0xc0,0xfc,0x00,0x98,0x1f,0x00, +0x0f,0x00,0x00,0x00,0x00,0x00,0x00,0xe3,0x02,0x00,0x77,0x05,0x80,0x07,0x98,0x4c, +0x06,0x02,0x57,0x00,0x00,0x00,0x28,0x38,0xed,0x07,0xa0,0xff,0x00,0x88,0x1f,0x00, +0x07,0x00,0x67,0x00,0x80,0x03,0x68,0x5b,0x0f,0x00,0x00,0x00,0x00,0x00,0x00,0xe3, +0x02,0x00,0x67,0x05,0x00,0x01,0x18,0x4c,0xb1,0x07,0x20,0xfe,0x00,0x74,0x1c,0x04, +0x04,0x02,0x07,0x00,0x00,0x00,0xd4,0xee,0x00,0x00,0x00,0x22,0x00,0x00,0x90,0xe2, +0x02,0x00,0x47,0x00,0x00,0x00,0x08,0x5c,0xf0,0x07,0x40,0x06,0x01,0xac,0x3f,0x00, +0x07,0x04,0xf7,0x0f,0x80,0x03,0x65,0x5b,0x03,0xff,0x27,0x00,0x00,0x00,0x00,0xec, +0x02,0x00,0x57,0x00,0x00,0x00,0x48,0x38,0xfd,0x17,0xa0,0xe3,0x00,0x88,0x3f,0x00, +0x0f,0x00,0x00,0x1e,0x00,0x00,0x40,0xe2,0x05,0x3a,0x47,0x00,0x00,0x20,0xe0,0x5c, +0x05,0x04,0x57,0x00,0x00,0x00,0x47,0x5c,0x1d,0x07,0xc0,0xfc,0x01,0x98,0x1f,0x00, +0x05,0x00,0x57,0x00,0x00,0x00,0x30,0x5c,0x05,0x05,0xf7,0x01,0x00,0x00,0x12,0x38, +0x05,0x05,0xf7,0x01,0x00,0x00,0x12,0x38,0xe6,0x07,0x40,0xfc,0x00,0xc4,0x1e,0x00, +0x08,0x05,0x27,0x00,0x00,0x02,0x47,0x5c,0x0a,0x08,0x47,0x05,0x00,0x02,0x18,0x4c, +0x05,0x0a,0x07,0x00,0x00,0x00,0xd4,0xee,0xe6,0x07,0x20,0xfc,0x00,0x98,0x1f,0x00, +0x0c,0x00,0x27,0x05,0x80,0x07,0x98,0x4c,0x09,0x03,0x07,0x05,0x00,0x06,0x00,0x51, +0x0c,0x03,0xc7,0x00,0xa8,0x7f,0x00,0x5b,0xe2,0x07,0x20,0xfe,0x20,0xc8,0x1e,0x00, +0x09,0x03,0xc7,0x00,0x98,0x04,0x30,0x5b,0x05,0x09,0x07,0x00,0x00,0x00,0xdc,0xee, +0x07,0x0a,0x47,0x00,0x00,0x00,0xd4,0xee,0xf0,0x07,0x20,0xfe,0x20,0xc8,0x1e,0x00, +0x07,0xff,0x57,0x05,0x80,0x03,0x65,0x4b,0x07,0x09,0x47,0x00,0x00,0x00,0xdc,0xee, +0x05,0x0a,0x87,0x00,0x00,0x00,0xd4,0xee,0xfa,0x00,0xa1,0xff,0x01,0xc0,0x1f,0x00, +0x05,0x09,0x87,0x00,0x00,0x00,0xdc,0xee,0x0f,0x00,0x00,0x0e,0x00,0x00,0x40,0xe2, +0x05,0x08,0x57,0x05,0x00,0x01,0x18,0x4c,0xf2,0x07,0x40,0xf6,0x00,0xb4,0x1f,0x04, +0x00,0x00,0x80,0x0a,0x00,0x00,0x90,0xe2,0x05,0x05,0x07,0x00,0x00,0x00,0xd4,0xee, +0x07,0x05,0x37,0x05,0x80,0x83,0xb9,0x4b,0xfd,0x07,0x00,0xfe,0x00,0xf4,0x1f,0x00, +0x0f,0x00,0x80,0x01,0x00,0x00,0x40,0xe2,0x05,0xf0,0xf7,0x0f,0x00,0x00,0x00,0x01, +0x0f,0x00,0x07,0x00,0x00,0x00,0xf8,0xf0,0xed,0x07,0xa0,0xff,0x00,0x84,0x1f,0x00, +0x07,0x05,0xf7,0x0f,0x80,0x83,0xbc,0x5b,0x0f,0x00,0x80,0x01,0x00,0x00,0x40,0xe2, +0x05,0x00,0xf7,0x0f,0x80,0x07,0x98,0x5c,0xfd,0x07,0x40,0xfc,0x00,0x44,0x1c,0x00, +0x0f,0x00,0x07,0x00,0x00,0x00,0xf8,0xf0,0x07,0x00,0x37,0x05,0x80,0x07,0x98,0x4c, +0x07,0x07,0x47,0x00,0x00,0x00,0x80,0x50,0xfd,0x07,0x40,0xfc,0x01,0x74,0x1c,0x00, +0x05,0x05,0x07,0x7f,0x43,0x10,0x68,0x38,0x05,0x05,0x77,0x00,0x00,0x10,0x68,0x5c, +0x05,0x0a,0x57,0x00,0x80,0x11,0xb0,0x5c,0x3d,0x08,0xa0,0xff,0x03,0x88,0x1f,0x00, +0x05,0x15,0x57,0x00,0x00,0x00,0xe0,0x5c,0x0f,0x00,0x07,0x00,0x00,0x00,0xf8,0xf0, +0x07,0x03,0x17,0x05,0x00,0x01,0x18,0x4c,0xf1,0x00,0x60,0xfc,0x00,0x98,0x1f,0x00, +0x05,0x07,0x07,0x00,0x00,0x00,0xd8,0xee,0x01,0x00,0x07,0x00,0x00,0x00,0xf0,0xf0, +0x05,0x04,0xf7,0xff,0x7f,0x00,0x10,0x39,0xe1,0x07,0xa0,0xfc,0x00,0xb4,0x1f,0x00, +0x04,0x05,0x47,0x00,0x00,0x00,0x47,0x5c,0x03,0x03,0x17,0x00,0x00,0x00,0x10,0x38, +0x07,0x04,0xf7,0x0f,0x80,0x03,0x6b,0x5b,0xfd,0x07,0xa0,0xff,0x00,0x98,0x1f,0x00, +0x0f,0x00,0x00,0xe2,0xff,0x0f,0x40,0xe2,0x0f,0x00,0x07,0x00,0x00,0x00,0xf8,0xf0, +0x00,0x00,0x27,0x00,0x00,0x00,0x10,0x4c,0xed,0x07,0xa0,0xff,0x00,0xfc,0x1f,0x00, +0x07,0x00,0x67,0x00,0x80,0x03,0x66,0x5b,0x0f,0x00,0x00,0xda,0xff,0x0f,0x40,0xe2, +0x0f,0x00,0x07,0x00,0x00,0x00,0x00,0xe3,0xff,0x07,0x00,0xfc,0x00,0x80,0x1f,0x00, +0x0f,0x00,0x87,0xff,0xff,0x0f,0x40,0xe2,0x00,0x0f,0x07,0x00,0x00,0x00,0xb0,0x50, +0x00,0x0f,0x07,0x00,0x00,0x00,0xb0,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x01,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x34,0x00,0x00,0x00,0x04,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0b,0x00,0x00,0x00,0x03,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x01,0x00,0x00,0x68,0x01,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x13,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0xa0,0x02,0x00,0x00,0x90,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x06,0x00,0x00,0x00, +0x04,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x33,0x00,0x00,0x00,0x00,0x00,0x00,0x70, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x03,0x00,0x00,0xc0,0x00,0x00,0x00, +0x03,0x00,0x00,0x00,0x09,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x6b,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0xf0,0x03,0x00,0x00,0x30,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xac,0x00,0x00,0x00,0x00,0x00,0x00,0x70, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x04,0x00,0x00,0xb0,0x00,0x00,0x00, +0x03,0x00,0x00,0x00,0x0a,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x74,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0xd0,0x04,0x00,0x00,0x64,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x09,0x00,0x00,0x00, +0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xe4,0x00,0x00,0x00,0x01,0x00,0x00,0x00, +0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x34,0x06,0x00,0x00,0x60,0x01,0x00,0x00, +0x00,0x00,0x00,0x00,0x0a,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x1b,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x06,0x00,0x10,0x00,0x00,0x00,0x00,0x00, +0xa0,0x07,0x00,0x00,0x40,0x03,0x00,0x00,0x03,0x00,0x00,0x00,0x07,0x00,0x00,0x10, +0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x94,0x00,0x00,0x00,0x01,0x00,0x00,0x00, +0x06,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0xe0,0x0a,0x00,0x00,0x00,0x03,0x00,0x00, +0x03,0x00,0x00,0x00,0x08,0x00,0x00,0x0d,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x4e,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0xe0,0x0d,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x09,0x00,0x00,0x00, +0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc7,0x00,0x00,0x00,0x08,0x00,0x00,0x00, +0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xe0,0x0d,0x00,0x00,0x04,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x0a,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x06,0x00,0x00,0x00,0xe8,0x0f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x60,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x04,0x00,0x00,0x00, +0x01,0x00,0x00,0x00,0xd0,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x04,0x09,0x00,0x00,0x04,0x09,0x00,0x00,0x05,0x00,0x00,0x00,0x04,0x00,0x00,0x00, +0x01,0x00,0x00,0x00,0xe0,0x0d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x04,0x00,0x00,0x00 +}; + +#ifdef __cplusplus +} +#endif + diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/cuda/build.cmd b/PhysX_3.4/Samples/SampleFramework/renderer/src/cuda/build.cmd new file mode 100755 index 00000000..0cf97a64 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/cuda/build.cmd @@ -0,0 +1,21 @@ +REM Rebuilds the cloth CUDA kernel that calculates smooth normals, the resulting fatbin +REM will be converted to a C header file that is included in the SampleRenderer + +set CUDA_PATH=..\..\..\..\..\..\..\..\..\externals\CUDA\6.0.2-17056404 +set SDK_ROOT=..\..\..\..\.. +set COMPILER_DIR=C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\Tools + +"%CUDA_PATH%\bin\nvcc.exe" -m32 -g -gencode=arch=compute_11,code=sm_11 -gencode=arch=compute_20,code=sm_20 -gencode=arch=compute_30,code=sm_30 -gencode=arch=compute_50,code=sm_50 -Xopencc -woffall -prec-div=false -prec-sqrt=false -ftz=true -use_fast_math -D_USE_MATH_DEFINES -DNDEBUG --compiler-bindir="%COMPILER_DIR%" --compiler-options=/W3,/nologo,/Zi,/MT,/Ox -I"%CUDA_PATH%\include" -I"%SDK_ROOT%\Include" -I"%SDK_ROOT%\Include\foundation" -I"%SDK_ROOT%\Source\LowLevelCloth\include" -I"%SDK_ROOT%\Source\LowLevelCloth\src" --fatbin -o RenderClothNormals_x86.fatbin RenderClothNormals.cu +"%CUDA_PATH%\bin\bin2c.exe" --name computeSmoothNormals RenderClothNormals_x86.fatbin > RenderClothNormals_x86.cuh + +"%CUDA_PATH%\bin\nvcc.exe" -m64 -g -gencode=arch=compute_11,code=sm_11 -gencode=arch=compute_20,code=sm_20 -gencode=arch=compute_30,code=sm_30 -gencode=arch=compute_50,code=sm_50 -Xopencc -woffall -prec-div=false -prec-sqrt=false -ftz=true -use_fast_math -D_USE_MATH_DEFINES -DNDEBUG --compiler-bindir="%COMPILER_DIR%" --compiler-options=/W3,/nologo,/Zi,/MT,/Ox -I"%CUDA_PATH%\include" -I"%SDK_ROOT%\Include" -I"%SDK_ROOT%\Include\foundation" -I"%SDK_ROOT%\Source\LowLevelCloth\include" -I"%SDK_ROOT%\Source\LowLevelCloth\src" --fatbin -o RenderClothNormals_x64.fatbin RenderClothNormals.cu +"%CUDA_PATH%\bin\bin2c.exe" --name computeSmoothNormals RenderClothNormals_x64.fatbin > RenderClothNormals_x64.cuh + +"%CUDA_PATH%\bin\nvcc.exe" -m32 -g -gencode=arch=compute_11,code=sm_11 -gencode=arch=compute_20,code=sm_20 -gencode=arch=compute_30,code=sm_30 -gencode=arch=compute_50,code=sm_50 -Xopencc -woffall -prec-div=false -prec-sqrt=false -ftz=true -use_fast_math -D_USE_MATH_DEFINES -DNDEBUG --compiler-bindir="%COMPILER_DIR%" --compiler-options=/W3,/nologo,/Zi,/MT,/Ox -I"%CUDA_PATH%\include" -I"%SDK_ROOT%\Include" -I"%SDK_ROOT%\Include\foundation" -I"%SDK_ROOT%\Source\LowLevelCloth\include" -I"%SDK_ROOT%\Source\LowLevelCloth\src" --fatbin -o RenderParticles_x86.fatbin RenderParticles.cu +"%CUDA_PATH%\bin\bin2c.exe" --name updateParticleVertexBuffer RenderParticles_x86.fatbin > RenderParticles_x86.cuh + +"%CUDA_PATH%\bin\nvcc.exe" -m64 -g -gencode=arch=compute_11,code=sm_11 -gencode=arch=compute_20,code=sm_20 -gencode=arch=compute_30,code=sm_30 -gencode=arch=compute_50,code=sm_50 -Xopencc -woffall -prec-div=false -prec-sqrt=false -ftz=true -use_fast_math -D_USE_MATH_DEFINES -DNDEBUG --compiler-bindir="%COMPILER_DIR%" --compiler-options=/W3,/nologo,/Zi,/MT,/Ox -I"%CUDA_PATH%\include" -I"%SDK_ROOT%\Include" -I"%SDK_ROOT%\Include\foundation" -I"%SDK_ROOT%\Source\LowLevelCloth\include" -I"%SDK_ROOT%\Source\LowLevelCloth\src" --fatbin -o RenderParticles_x64.fatbin RenderParticles.cu +"%CUDA_PATH%\bin\bin2c.exe" --name updateParticleVertexBuffer RenderParticles_x64.fatbin > RenderParticles_x64.cuh + +pause + diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11Renderer.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11Renderer.cpp new file mode 100644 index 00000000..ea820c3d --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11Renderer.cpp @@ -0,0 +1,1467 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#include <RendererConfig.h> + +#if defined(RENDERER_ENABLE_DIRECT3D11) + +#include "D3D11Renderer.h" + +#include <RendererDesc.h> + +#include <RendererProjection.h> + +#include <RendererVertexBufferDesc.h> +#include "D3D11RendererVertexBuffer.h" + +#include <RendererIndexBufferDesc.h> +#include "D3D11RendererIndexBuffer.h" + +#include <RendererInstanceBufferDesc.h> +#include "D3D11RendererInstanceBuffer.h" + +#include <RendererMeshDesc.h> +#include <RendererMeshContext.h> +#include "D3D11RendererMesh.h" + +#include <RendererMaterialDesc.h> +#include <RendererMaterialInstance.h> +#include "D3D11RendererMaterial.h" + +#include <RendererLightDesc.h> +#include <RendererDirectionalLightDesc.h> +#include "D3D11RendererDirectionalLight.h" +#include <RendererSpotLightDesc.h> +#include "D3D11RendererSpotLight.h" + +#include <RendererTextureDesc.h> +#include "D3D11RendererTexture2D.h" +#include "D3D11RendererTexture3D.h" + +#include <RendererTargetDesc.h> +#include "D3D11RendererTarget.h" + +#include "D3D11RendererResourceManager.h" +#include "D3D11RendererVariableManager.h" +#include "D3D11RendererMemoryMacros.h" +#include "D3D11RendererUtils.h" + +#include <PsUtilities.h> +#include <SamplePlatform.h> +#include <deque> + +using namespace SampleRenderer; +using std::tr1::get; + +void SampleRenderer::convertToD3D11(PxVec3& dxcolor, const RendererColor& color) +{ + static const float inv255 = 1.0f / 255.0f; + dxcolor = PxVec3(color.r * inv255, color.g * inv255, color.b * inv255); +} + +void SampleRenderer::convertToD3D11(PxVec4& dxcolor, const RendererColor& color) +{ + static const float inv255 = 1.0f / 255.0f; + dxcolor = PxVec4(color.r * inv255, color.g * inv255, color.b * inv255, color.a * inv255); +} + +void SampleRenderer::convertToD3D11(PxMat44& dxmat, const physx::PxMat44 &mat) +{ + dxmat = mat.getTranspose(); +} + +void SampleRenderer::convertToD3D11(PxMat44& dxmat, const RendererProjection& mat) +{ + convertToD3D11(dxmat, mat.getPxMat44()); +} + +/**************************************** +* D3D11Renderer::D3D11ShaderEnvironment * +****************************************/ + +D3D11Renderer::D3D11ShaderEnvironment::D3D11ShaderEnvironment() +{ + memset(this, 0, sizeof(*this)); + vfs = 1.; +} + +#define SHADER_VAR_NAME(_name) PX_STRINGIZE(PX_CONCAT(g_, _name)) + +void D3D11Renderer::D3D11ShaderEnvironment::bindFrame() const +{ + constantManager->setSharedVariable("cbFrame", SHADER_VAR_NAME(viewMatrix), &viewMatrix); + constantManager->setSharedVariable("cbFrame", SHADER_VAR_NAME(projMatrix), &projMatrix); + constantManager->setSharedVariable("cbFrame", SHADER_VAR_NAME(eyePosition), &eyePosition.x); + constantManager->setSharedVariable("cbFrame", SHADER_VAR_NAME(eyeDirection), &eyeDirection.x); + constantManager->setSharedVariable("cbFrameInv", SHADER_VAR_NAME(invViewProjMatrix), &invViewProjMatrix); +} + +void D3D11Renderer::D3D11ShaderEnvironment::bindLight(PxU32 lightIndex) const +{ + RENDERER_ASSERT(lightIndex < RENDERER_MAX_LIGHTS, "Invalid light index"); + if (lightIndex < RENDERER_MAX_LIGHTS) + { + if (numLights < ((int)lightIndex + 1)) numLights = lightIndex + 1; + const char* lightName = RENDERER_ENABLE_SINGLE_PASS_LIGHTING ? "cbLights" : "cbLight"; + constantManager->setSharedVariable(lightName, SHADER_VAR_NAME(lightColor), &lightColor[lightIndex].x, sizeof(PxVec3), lightIndex*sizeof(PxVec3)); + constantManager->setSharedVariable(lightName, SHADER_VAR_NAME(lightDirection), &lightDirection[lightIndex].x, sizeof(PxVec3), lightIndex*sizeof(PxVec3)); + constantManager->setSharedVariable(lightName, SHADER_VAR_NAME(lightPosition), &lightPosition[lightIndex].x, sizeof(PxVec3), lightIndex*sizeof(PxVec3)); + constantManager->setSharedVariable(lightName, SHADER_VAR_NAME(lightIntensity), &lightIntensity[lightIndex], sizeof(float), lightIndex*sizeof(float)); + constantManager->setSharedVariable(lightName, SHADER_VAR_NAME(lightInnerRadius), &lightInnerRadius[lightIndex], sizeof(float), lightIndex*sizeof(float)); + constantManager->setSharedVariable(lightName, SHADER_VAR_NAME(lightOuterRadius), &lightOuterRadius[lightIndex], sizeof(float), lightIndex*sizeof(float)); + constantManager->setSharedVariable(lightName, SHADER_VAR_NAME(lightInnerCone), &lightInnerCone[lightIndex], sizeof(float), lightIndex*sizeof(float)); + constantManager->setSharedVariable(lightName, SHADER_VAR_NAME(lightOuterCone), &lightOuterCone[lightIndex], sizeof(float), lightIndex*sizeof(float)); +#if RENDERER_ENABLE_SINGLE_PASS_LIGHTING + constantManager->setSharedVariable(lightName, SHADER_VAR_NAME(lightType), &lightType[lightIndex], sizeof(int), lightIndex*sizeof(int)); + constantManager->setSharedVariable(lightName, SHADER_VAR_NAME(numLights), &numLights, sizeof(int)); +#endif + +#if RENDERER_ENABLE_SHADOWS + if (lightShadowMap) + { + // The actual shadow map texture will be bound as a variable of the material + constantManager->setSharedVariable("cbLightShadow", SHADER_VAR_NAME(lightShadowMatrix), &lightShadowMatrix); + } +#endif + } +} + +void D3D11Renderer::D3D11ShaderEnvironment::bindModel() const +{ + constantManager->setSharedVariable("cbMesh", SHADER_VAR_NAME(modelMatrix), &modelMatrix); + constantManager->setSharedVariable("cbMesh", SHADER_VAR_NAME(modelViewMatrix), &modelViewMatrix); + constantManager->setSharedVariable("cbMesh", SHADER_VAR_NAME(modelViewProjMatrix), &modelViewProjMatrix); +} + +void D3D11Renderer::D3D11ShaderEnvironment::bindBones() const +{ + if (numBones > 0) + { + constantManager->setSharedVariable("cbBones", SHADER_VAR_NAME(boneMatrices), &boneMatrices[0], numBones * sizeof(PxMat44)); + } +} + +void D3D11Renderer::D3D11ShaderEnvironment::bindFogState() const +{ + constantManager->setSharedVariable("cbFog", SHADER_VAR_NAME(fogColorAndDistance), &fogColorAndDistance.x); +} + +void D3D11Renderer::D3D11ShaderEnvironment::bindAmbientState() const +{ + constantManager->setSharedVariable("cbAmbient", SHADER_VAR_NAME(ambientColor), &ambientColor.x); +} + +void D3D11Renderer::D3D11ShaderEnvironment::bindVFaceScale() const +{ +#if defined(RENDERER_ENABLE_VFACE_SCALE) + constantManager->setSharedVariable("cbScale", SHADER_VAR_NAME(vfaceScale), &vfs); +#endif +} + +void D3D11Renderer::D3D11ShaderEnvironment::reset() +{ + numLights = 0; +} + +#undef SHADER_VAR_NAME + +/*************** +* D3D11Renderer * +***************/ + +static std::deque<ID3D11BlendState*> gBlendState; +static std::deque<ID3D11DepthStencilState*> gDepthStencilState; +static std::deque<ID3D11RasterizerState*> gRasterizerState; +static std::deque<D3D11_VIEWPORT> gViewport; +static std::deque<PxVec4> gBlendFactor; +static std::deque<UINT> gBlendMask; +static std::deque<UINT> gDepthStencilMask; + +D3D11Renderer::D3D11Renderer(const RendererDesc& desc, const char* assetDir) : + Renderer(DRIVER_DIRECT3D11, desc.errorCallback, assetDir), + m_displayWidth(0), + m_displayHeight(0), + m_displayBuffer(0), + m_vsync(desc.vsync), + m_multipassDepthBias(desc.multipassDepthBias ? -1 : 0), + m_d3d(NULL), + m_d3dSwapChain(NULL), + m_d3dDevice(NULL), + m_d3dDeviceContext(NULL), + m_d3dDeviceFeatureLevel(D3D_FEATURE_LEVEL_11_0), + m_d3dDepthStencilBuffer(NULL), + m_d3dDepthStencilView(NULL), + m_d3dRenderTargetBuffer(NULL), + m_d3dRenderTargetView(NULL), + m_currentTextMesh(0), + m_linesMesh(NULL), + m_linesVertices(NULL), + m_d3dx(NULL), + m_constantManager(NULL), + m_resourceManager(NULL) +{ + for (PxU32 i = 0; i < NUM_BLEND_STATES; ++i) + m_d3dBlendStates[i] = NULL; + for (PxU32 i = 0; i < NUM_DEPTH_STENCIL_STATES; ++i) + m_d3dDepthStencilStates[i] = NULL; + + m_useShadersForTextRendering = true; + m_pixelCenterOffset = 0.f; + m_viewMatrix = physx::PxMat44(PxIdentity); + + SampleFramework::SamplePlatform* m_platform = SampleFramework::SamplePlatform::platform(); + m_d3d = static_cast<IDXGIFactory*>(m_platform->initializeD3D11()); + RENDERER_ASSERT(m_d3d, "Could not create Direct3D11 Interface."); + if (m_d3d) + { + // Setup swap chain configuration + memset(&m_swapChainDesc, 0, sizeof(m_swapChainDesc)); + m_swapChainDesc.BufferCount = 1; + m_swapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; + m_swapChainDesc.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; + m_swapChainDesc.BufferDesc.Height = m_displayHeight; + m_swapChainDesc.BufferDesc.RefreshRate.Numerator = 60; + m_swapChainDesc.BufferDesc.RefreshRate.Denominator = 1; + m_swapChainDesc.BufferDesc.Scaling = DXGI_MODE_SCALING_UNSPECIFIED; + m_swapChainDesc.BufferDesc.ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED; + m_swapChainDesc.BufferDesc.Width = m_displayWidth; + m_swapChainDesc.Flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH ; + m_swapChainDesc.SampleDesc.Count = 1; + m_swapChainDesc.SampleDesc.Quality = 0; + m_swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD; + m_swapChainDesc.Windowed = 1; + + HRESULT hr = m_platform->initializeD3D11Display( + &m_swapChainDesc, + m_deviceName, + m_displayWidth, + m_displayHeight, + &m_d3dDevice, + &m_d3dDeviceContext, + &m_d3dSwapChain); + RENDERER_ASSERT(SUCCEEDED(hr), "Failed to create Direct3D11 Device."); + if (SUCCEEDED(hr)) + { + m_d3dDeviceFeatureLevel = m_d3dDevice->GetFeatureLevel(); + setEnableTessellation(true); + checkResize(false); + } + } + + D3D11RendererVariableManager::StringSet cbNames; + cbNames.insert("cbAllData"); + cbNames.insert("cbMesh"); + cbNames.insert("cbFrame"); + cbNames.insert("cbFrameInv"); + cbNames.insert("cbBones"); + cbNames.insert("cbFog"); + cbNames.insert("cbAmbient"); + cbNames.insert("cbLight"); + cbNames.insert("cbLights"); + cbNames.insert("cbLightShadow"); + cbNames.insert("cbScale"); + cbNames.insert("cbTessellation"); + + m_d3dx = new D3DX11(); + m_constantManager = new D3D11RendererVariableManager(*this, cbNames /*, D3D11RendererVariableManager::BIND_MAP*/); + m_resourceManager = new D3D11RendererResourceManager( ); + m_environment.constantManager = m_constantManager; +} + +D3D11Renderer::~D3D11Renderer(void) +{ + releaseAllMaterials(); + + if (m_d3dDeviceContext) + { + m_d3dDeviceContext->ClearState(); + m_d3dDeviceContext->Flush(); + } + + dxSafeRelease(m_displayBuffer); + + dxSafeRelease(m_d3d); + dxSafeRelease(m_d3dSwapChain); + dxSafeRelease(m_d3dDevice); + dxSafeRelease(m_d3dDeviceContext); + + dxSafeRelease(m_d3dDepthStencilBuffer); + dxSafeRelease(m_d3dDepthStencilView); + dxSafeRelease(m_d3dRenderTargetBuffer); + dxSafeRelease(m_d3dRenderTargetView); + + for (PxU32 i = 0; i < NUM_BLEND_STATES; ++i) + dxSafeRelease(m_d3dBlendStates[i]); + for (PxU32 i = 0; i < NUM_DEPTH_STENCIL_STATES; ++i) + dxSafeRelease(m_d3dDepthStencilStates[i]); + + dxSafeReleaseAll(gRasterizerState); + dxSafeReleaseAll(gBlendState); + dxSafeReleaseAll(gDepthStencilState); + + deleteAll(m_textMeshes); + deleteAll(m_textVertices); + deleteAll(m_textIndices); + + delete m_linesMesh; + delete m_linesVertices; + + delete m_constantManager; + delete m_resourceManager; + delete m_d3dx; +} + +bool D3D11Renderer::checkResize(bool resetDevice) +{ + bool isDeviceReset = false; +#if defined(RENDERER_WINDOWS) + if (SampleFramework::SamplePlatform::platform()->getWindowHandle() && m_d3dDevice) + { + PxU32 width = 0; + PxU32 height = 0; + SampleFramework::SamplePlatform::platform()->getWindowSize(width, height); + if (width && height && (width != m_displayWidth || height != m_displayHeight) || resetDevice) + { + m_displayWidth = width; + m_displayHeight = height; + m_d3dDeviceContext->ClearState(); + m_d3dDeviceContext->OMSetRenderTargets(0, NULL, NULL); + + dxSafeRelease(m_d3dRenderTargetView); + dxSafeRelease(m_d3dRenderTargetBuffer); + dxSafeRelease(m_d3dDepthStencilView); + dxSafeRelease(m_d3dDepthStencilBuffer); + + HRESULT hr = S_OK; + DXGI_SWAP_CHAIN_DESC desc; + m_d3dSwapChain->GetDesc(&desc); + if(desc.BufferDesc.Width != width || desc.BufferDesc.Height != height) + hr = m_d3dSwapChain->ResizeBuffers(0, 0, 0, DXGI_FORMAT_UNKNOWN, 0); + RENDERER_ASSERT(SUCCEEDED(hr), "Failed to resize swap chain buffers."); + + D3D11_TEXTURE2D_DESC depthDesc; + depthDesc.Format = DXGI_FORMAT_D24_UNORM_S8_UINT; + if (SUCCEEDED(hr)) + { + depthDesc.Width = m_displayWidth; + depthDesc.Height = m_displayHeight; + depthDesc.MipLevels = 1; + depthDesc.ArraySize = 1; + depthDesc.SampleDesc.Count = m_swapChainDesc.SampleDesc.Count; + depthDesc.SampleDesc.Quality = m_swapChainDesc.SampleDesc.Quality; + depthDesc.Usage = D3D11_USAGE_DEFAULT; + depthDesc.BindFlags = D3D11_BIND_DEPTH_STENCIL; + depthDesc.CPUAccessFlags = 0; + depthDesc.MiscFlags = 0; + + hr = m_d3dDevice->CreateTexture2D(&depthDesc, NULL, &m_d3dDepthStencilBuffer); + RENDERER_ASSERT(SUCCEEDED(hr), "Failed to create depth stencil buffer."); + } + + if (SUCCEEDED(hr)) + { + hr = m_d3dSwapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), (void**)&m_d3dRenderTargetBuffer); + RENDERER_ASSERT(SUCCEEDED(hr), "Failed to acquire swap chain buffer."); + } + + if (SUCCEEDED(hr) && m_d3dRenderTargetBuffer) + { + D3D11_RENDER_TARGET_VIEW_DESC rtvDesc; + rtvDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; + rtvDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2DMS; + //rtvDesc.Texture2D.MipSlice = 0; + hr = m_d3dDevice->CreateRenderTargetView(m_d3dRenderTargetBuffer, &rtvDesc, &m_d3dRenderTargetView); + RENDERER_ASSERT(SUCCEEDED(hr), "Failed to create render target view."); + } + + if (SUCCEEDED(hr)) + { + D3D11_DEPTH_STENCIL_VIEW_DESC dsvDesc; + dsvDesc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2DMS; + dsvDesc.Format = depthDesc.Format; + dsvDesc.Flags = 0; + //dsvDesc.Texture2D.MipSlice = 0; + hr = m_d3dDevice->CreateDepthStencilView(m_d3dDepthStencilBuffer, &dsvDesc, &m_d3dDepthStencilView); + RENDERER_ASSERT(SUCCEEDED(hr), "Failed to create depth stencil view."); + } + + m_d3dDeviceContext->OMSetRenderTargets(1, &m_d3dRenderTargetView, m_d3dDepthStencilView); + + if (resetDevice) + { + onDeviceReset(); + isDeviceReset = true; + } + + PxU32 NUM_VIEWPORTS = 1; + D3D11_VIEWPORT viewport[1]; + ZeroMemory(viewport, sizeof(D3D11_VIEWPORT)*NUM_VIEWPORTS); + m_d3dDeviceContext->RSGetViewports(&NUM_VIEWPORTS, viewport); + viewport[0].Width = (FLOAT)m_displayWidth; + viewport[0].Height = (FLOAT)m_displayHeight; + viewport[0].MinDepth = 0.0f; + viewport[0].MaxDepth = 1.0f; + m_d3dDeviceContext->RSSetViewports(1, viewport); + } + } + +#endif + return isDeviceReset; +} + +void D3D11Renderer::onDeviceLost(void) +{ + notifyResourcesLostDevice(); +} + +void D3D11Renderer::onDeviceReset(void) +{ + notifyResourcesResetDevice(); +} + +// clears the offscreen buffers. +void D3D11Renderer::clearBuffers(void) +{ + if (m_d3dDeviceContext && m_d3dRenderTargetView) + { + PxVec4 clearColor; + convertToD3D11(clearColor, getClearColor()); + m_d3dDeviceContext->ClearRenderTargetView(m_d3dRenderTargetView, &clearColor.x); + } + if (m_d3dDeviceContext && m_d3dDepthStencilView) + { + m_d3dDeviceContext->ClearDepthStencilView(m_d3dDepthStencilView, D3D11_CLEAR_DEPTH | D3D11_CLEAR_STENCIL, 1.0, 0); + } +} + +// presents the current color buffer to the screen. +// returns true on device reset and if buffers need to be rewritten. +bool D3D11Renderer::swapBuffers(void) +{ + PX_PROFILE_ZONE("SwapBuffers", 0); + bool isDeviceReset = false; + if (m_d3dDevice) + { + HRESULT result = SampleFramework::SamplePlatform::platform()->D3D11Present(m_vsync); + if ( DXGI_STATUS_OCCLUDED == result ) + { + // This is fine, though we should set a flag to use a "test" D3D11Present + // for the next frame until the window is no longer occluded + } + else if (SUCCEEDED(result) || DXGI_ERROR_DEVICE_RESET == result) + { + isDeviceReset = checkResize(DXGI_ERROR_DEVICE_RESET == result); + } + } + return isDeviceReset; +} + +void D3D11Renderer::getWindowSize(PxU32& width, PxU32& height) const +{ + RENDERER_ASSERT(m_displayHeight * m_displayWidth > 0, "variables not initialized properly"); + width = m_displayWidth; + height = m_displayHeight; +} + +RendererVertexBuffer* D3D11Renderer::createVertexBuffer(const RendererVertexBufferDesc& desc) +{ + D3D11RendererVertexBuffer* vb = 0; + if (m_d3dDevice) + { + RENDERER_ASSERT(desc.isValid(), "Invalid Vertex Buffer Descriptor."); + if (desc.isValid()) + { + vb = new D3D11RendererVertexBuffer(*m_d3dDevice, *m_d3dDeviceContext, desc); + } + } + if (vb) + { + addResource(*vb); + } + return vb; +} + +RendererIndexBuffer* D3D11Renderer::createIndexBuffer(const RendererIndexBufferDesc& desc) +{ + D3D11RendererIndexBuffer* ib = 0; + if (m_d3dDevice) + { + RENDERER_ASSERT(desc.isValid(), "Invalid Index Buffer Descriptor."); + if (desc.isValid()) + { + ib = new D3D11RendererIndexBuffer(*m_d3dDevice, *m_d3dDeviceContext, desc); + } + } + if (ib) + { + addResource(*ib); + } + return ib; +} + +RendererInstanceBuffer* D3D11Renderer::createInstanceBuffer(const RendererInstanceBufferDesc& desc) +{ + D3D11RendererInstanceBuffer* ib = 0; + if (m_d3dDevice) + { + RENDERER_ASSERT(desc.isValid(), "Invalid Instance Buffer Descriptor."); + if (desc.isValid()) + { + ib = new D3D11RendererInstanceBuffer(*m_d3dDevice, *m_d3dDeviceContext, desc); + } + } + if (ib) + { + addResource(*ib); + } + return ib; +} + +RendererTexture2D* D3D11Renderer::createTexture2D(const RendererTexture2DDesc& desc) +{ + D3D11RendererTexture2D* texture = 0; + if (m_d3dDevice) + { + RENDERER_ASSERT(desc.isValid(), "Invalid Texture 2D Descriptor."); + if (desc.isValid()) + { + texture = new D3D11RendererTexture2D(*m_d3dDevice, *m_d3dDeviceContext, desc); + } + } + if (texture) + { + addResource(*texture); + } + return texture; +} + +RendererTexture3D* D3D11Renderer::createTexture3D(const RendererTexture3DDesc& desc) +{ + D3D11RendererTexture3D* texture = 0; + if (m_d3dDevice) + { + RENDERER_ASSERT(desc.isValid(), "Invalid Texture 3D Descriptor."); + if (desc.isValid()) + { + texture = new D3D11RendererTexture3D(*m_d3dDevice, *m_d3dDeviceContext, desc); + } + } + if (texture) + { + addResource(*texture); + } + return texture; +} + +RendererTarget* D3D11Renderer::createTarget(const RendererTargetDesc& desc) +{ + RendererTarget* target = 0; +#if defined(RENDERER_ENABLE_DIRECT3D11_TARGET) + D3D11RendererTarget* d3dTarget = 0; + RENDERER_ASSERT(desc.isValid(), "Invalid Target Descriptor."); + if (desc.isValid()) + { + d3dTarget = new D3D11RendererTarget(*m_d3dDevice, *m_d3dDeviceContext, desc); + } + if (d3dTarget) + { + addResource(*d3dTarget); + } + target = d3dTarget; +#endif + return target; +} + +RendererMaterial* D3D11Renderer::createMaterial(const RendererMaterialDesc& desc) +{ + RendererMaterial* mat = hasMaterialAlready(desc); + RENDERER_ASSERT(desc.isValid(), "Invalid Material Descriptor."); + if (!mat && desc.isValid()) + { + mat = new D3D11RendererMaterial(*this, desc); + + registerMaterial(desc, mat); + } + return mat; +} + +RendererMesh* D3D11Renderer::createMesh(const RendererMeshDesc& desc) +{ + D3D11RendererMesh* mesh = 0; + RENDERER_ASSERT(desc.isValid(), "Invalid Mesh Descriptor."); + if (desc.isValid()) + { + mesh = new D3D11RendererMesh(*this, desc); + } + return mesh; +} + +RendererLight* D3D11Renderer::createLight(const RendererLightDesc& desc) +{ + RendererLight* light = 0; + if (m_d3dDevice) + { + RENDERER_ASSERT(desc.isValid(), "Invalid Light Descriptor."); + if (desc.isValid()) + { + switch (desc.type) + { + case RendererLight::TYPE_DIRECTIONAL: + light = new D3D11RendererDirectionalLight(*this, *(RendererDirectionalLightDesc*)&desc); + break; + case RendererLight::TYPE_SPOT: + light = new D3D11RendererSpotLight(*this, *(RendererSpotLightDesc*)&desc); + break; + default: + RENDERER_ASSERT(0, "Not implemented!"); + } + } + } + return light; +} + +void D3D11Renderer::setVsync(bool on) +{ + m_vsync = on; +} + +bool D3D11Renderer::beginRender(void) +{ + setBlendState(); + + setRasterizerState(); + + setTessellationState(); + + m_environment.reset(); + m_currentTextMesh = 0; + return true; +} + +void D3D11Renderer::endRender(void) +{ + +} + +void D3D11Renderer::bindViewProj(const physx::PxMat44& eye, const RendererProjection& proj) +{ + m_viewMatrix = eye.inverseRT(); + + convertToD3D11(m_environment.viewMatrix, m_viewMatrix); + convertToD3D11(m_environment.invViewProjMatrix, eye); + convertToD3D11(m_environment.projMatrix, proj); + + m_environment.eyePosition = eye.getPosition(); + m_environment.eyeDirection = -eye.getBasis(2); + + m_environment.bindFrame(); +} + +void D3D11Renderer::bindFogState(const RendererColor& fogColor, float fogDistance) +{ + const float inv255 = 1.0f / 255.0f; + + m_environment.fogColorAndDistance.x = fogColor.r * inv255; + m_environment.fogColorAndDistance.y = fogColor.g * inv255; + m_environment.fogColorAndDistance.z = fogColor.b * inv255; + m_environment.fogColorAndDistance.w = fogDistance; + m_environment.bindFogState(); +} + +void D3D11Renderer::bindAmbientState(const RendererColor& ambientColor) +{ + convertToD3D11(m_environment.ambientColor, ambientColor); + m_environment.bindAmbientState(); +} + +void D3D11Renderer::bindDeferredState(void) +{ + RENDERER_ASSERT(0, "Not implemented!"); +} + +void D3D11Renderer::bindMeshContext(const RendererMeshContext& context) +{ + physx::PxMat44 model; + physx::PxMat44 modelView; + if(context.transform) model = *context.transform; + else model = PxMat44(PxIdentity); + modelView = m_viewMatrix * model; + + convertToD3D11(m_environment.modelMatrix, model); + convertToD3D11(m_environment.modelViewMatrix, modelView); + m_environment.bindModel(); + + + // it appears that D3D winding is backwards, so reverse them... + D3D11_CULL_MODE cullMode = D3D11_CULL_BACK; + switch (context.cullMode) + { + case RendererMeshContext::CLOCKWISE: + cullMode = context.negativeScale ? D3D11_CULL_BACK : D3D11_CULL_FRONT; + break; + case RendererMeshContext::COUNTER_CLOCKWISE: + cullMode = context.negativeScale ? D3D11_CULL_FRONT : D3D11_CULL_BACK; + break; + case RendererMeshContext::NONE: + cullMode = D3D11_CULL_NONE; + break; + default: + RENDERER_ASSERT(0, "Invalid Cull Mode"); + } + if (!blendingCull() && NULL != context.material && context.material->getBlending()) + cullMode = D3D11_CULL_NONE; + + D3D11_FILL_MODE fillMode = D3D11_FILL_SOLID; + switch (context.fillMode) + { + case RendererMeshContext::SOLID: + fillMode = D3D11_FILL_SOLID; + break; + case RendererMeshContext::LINE: + fillMode = D3D11_FILL_WIREFRAME; + break; + case RendererMeshContext::POINT: + fillMode = D3D11_FILL_SOLID; + break; + default: + RENDERER_ASSERT(0, "Invalid Fill Mode"); + } + if (wireframeEnabled()) + { + fillMode = D3D11_FILL_WIREFRAME; + } + + setRasterizerState(fillMode, cullMode, get<2>(m_boundRasterizerStateKey)); + + RENDERER_ASSERT(context.numBones <= RENDERER_MAX_BONES, "Too many bones."); + if (context.boneMatrices && context.numBones > 0 && context.numBones <= RENDERER_MAX_BONES) + { + for (PxU32 i = 0; i < context.numBones; ++i) + { + convertToD3D11(m_environment.boneMatrices[i], context.boneMatrices[i]); + } + m_environment.numBones = context.numBones; + m_environment.bindBones(); + } +} + +void D3D11Renderer::setRasterizerState(D3D11_FILL_MODE fillMode, D3D11_CULL_MODE cullMode, PxI32 depthBias) +{ + + D3DTraits<ID3D11RasterizerState>::key_type rasterizerStateKey(fillMode, cullMode, depthBias); + + ID3D11RasterizerState* pRasterizerState = + getResourceManager()->hasResource<ID3D11RasterizerState>(rasterizerStateKey); + if (NULL == pRasterizerState) + { + RENDERER_ASSERT(m_d3dDevice, "Invalid D3D11 device."); + D3D11_RASTERIZER_DESC rasterizerDesc = + { + fillMode, // D3D11_FILL_MODE FillMode; + cullMode, // D3D11_CULL_MODE CullMode; + TRUE, // BOOL FrontCounterClockwise; + 0, // INT DepthBias; + .05f * depthBias, // FLOAT DepthBiasClamp; + .05f * depthBias, // FLOAT SlopeScaledDepthBias; + FALSE, // BOOL DepthClipEnable; + FALSE, // BOOL ScissorEnable; + (fillMode == D3D11_FILL_WIREFRAME) ? FALSE : TRUE, // BOOL MultisampleEnable; + FALSE, // BOOL AntialiasedLineEnable; + }; + if(getFeatureLevel() <= D3D_FEATURE_LEVEL_9_3) + { + rasterizerDesc.DepthClipEnable = TRUE; + } + HRESULT result = m_d3dDevice->CreateRasterizerState(&rasterizerDesc, &pRasterizerState); + RENDERER_ASSERT(SUCCEEDED(result) && pRasterizerState, "Error creating D3D11 rasterizer state."); + if (SUCCEEDED(result)) + { + getResourceManager()->registerResource<ID3D11RasterizerState>(rasterizerStateKey, pRasterizerState); + } + } + RENDERER_ASSERT(pRasterizerState, "Invalid D3D11RasterizerState"); + if (pRasterizerState && m_d3dDeviceContext) + { + m_d3dDeviceContext->RSSetState(pRasterizerState); + if (get<1>(m_boundRasterizerStateKey) != get<1>(rasterizerStateKey)) + { + m_environment.vfs = (get<1>(rasterizerStateKey) == D3D11_CULL_BACK) ? 1.f : -1.f; + m_environment.bindVFaceScale(); + } + m_boundRasterizerStateKey = rasterizerStateKey; + } +} + + +void SampleRenderer::D3D11Renderer::setDepthStencilState(DepthStencilState state) +{ + if (!m_d3dDeviceContext || state >= NUM_DEPTH_STENCIL_STATES) + { + return; + } + + // The standard depth-stencil state + D3D11_DEPTH_STENCIL_DESC depthStencilDesc = + { + TRUE, // BOOL DepthEnable; + D3D11_DEPTH_WRITE_MASK_ALL, // D3D11_DEPTH_WRITE_MASK DepthWriteMask; + D3D11_COMPARISON_LESS, // D3D11_COMPARISON_FUNC DepthFunc; + TRUE, // BOOL StencilEnable; + 0xFF, // UINT8 StencilReadMask; + 0xFF, // UINT8 StencilWriteMask; + { + // D3D11_DEPTH_STENCILOP_DESC FrontFace; + D3D11_STENCIL_OP_KEEP, // D3D11_STENCIL_OP StencilFailOp; + D3D11_STENCIL_OP_INCR, // D3D11_STENCIL_OP StencilDepthFailOp; + D3D11_STENCIL_OP_KEEP, // D3D11_STENCIL_OP StencilPassOp; + D3D11_COMPARISON_ALWAYS, // D3D11_COMPARISON_FUNC StencilFunc; + }, + { + // D3D11_DEPTH_STENCILOP_DESC BackFace; + D3D11_STENCIL_OP_KEEP, // D3D11_STENCIL_OP StencilFailOp; + D3D11_STENCIL_OP_INCR, // D3D11_STENCIL_OP StencilDepthFailOp; + D3D11_STENCIL_OP_KEEP, // D3D11_STENCIL_OP StencilPassOp; + D3D11_COMPARISON_ALWAYS, // D3D11_COMPARISON_FUNC StencilFunc; + }, + }; + + if (!m_d3dDepthStencilStates[DEPTHSTENCIL_DEFAULT]) + { + m_d3dDevice->CreateDepthStencilState(&depthStencilDesc, &m_d3dDepthStencilStates[DEPTHSTENCIL_DEFAULT]); + RENDERER_ASSERT(m_d3dDepthStencilStates[DEPTHSTENCIL_DEFAULT], "Error creating D3D depth stencil state"); + } + if (!m_d3dDepthStencilStates[DEPTHSTENCIL_TRANSPARENT]) + { + depthStencilDesc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ZERO; + depthStencilDesc.DepthFunc = D3D11_COMPARISON_LESS_EQUAL; + depthStencilDesc.StencilWriteMask = 0x00; + m_d3dDevice->CreateDepthStencilState(&depthStencilDesc, &m_d3dDepthStencilStates[DEPTHSTENCIL_TRANSPARENT]); + RENDERER_ASSERT(m_d3dDepthStencilStates[DEPTHSTENCIL_TRANSPARENT], "Error creating D3D depth stencil state"); + } + if (!m_d3dDepthStencilStates[DEPTHSTENCIL_DISABLED]) + { + depthStencilDesc.DepthEnable = FALSE; + depthStencilDesc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ZERO; + depthStencilDesc.DepthFunc = D3D11_COMPARISON_NEVER; + depthStencilDesc.StencilEnable = FALSE; + depthStencilDesc.StencilReadMask = 0x00; + depthStencilDesc.StencilWriteMask = 0x00; + m_d3dDevice->CreateDepthStencilState(&depthStencilDesc, &m_d3dDepthStencilStates[DEPTHSTENCIL_DISABLED]); + RENDERER_ASSERT(m_d3dDepthStencilStates[DEPTHSTENCIL_DISABLED], "Error creating D3D depth stencil state"); + } + + m_d3dDeviceContext->OMSetDepthStencilState(m_d3dDepthStencilStates[state], 1); +} + +void SampleRenderer::D3D11Renderer::setBlendState(BlendState state) +{ + if (!m_d3dDeviceContext || state >= NUM_BLEND_STATES) + { + return; + } + + // BLEND_DEFAULT is purposefully NULL + if (!m_d3dBlendStates[BLEND_MULTIPASS] && m_d3dDevice) + { + D3D11_BLEND_DESC blendDesc; + memset(&blendDesc, 0, sizeof(blendDesc)); + if(getFeatureLevel() <= D3D_FEATURE_LEVEL_9_3) + { + blendDesc.AlphaToCoverageEnable = FALSE; + blendDesc.IndependentBlendEnable = FALSE; + } + else + { + blendDesc.AlphaToCoverageEnable = TRUE; + blendDesc.IndependentBlendEnable = TRUE; + } + blendDesc.RenderTarget[0].BlendEnable = TRUE; + blendDesc.RenderTarget[0].SrcBlend = D3D11_BLEND_ONE; + blendDesc.RenderTarget[0].DestBlend = D3D11_BLEND_ONE; + blendDesc.RenderTarget[0].BlendOp = D3D11_BLEND_OP_ADD; + blendDesc.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_ONE; + blendDesc.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_ONE; + blendDesc.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD; + blendDesc.RenderTarget[0].RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL; + + m_d3dDevice->CreateBlendState(&blendDesc, &m_d3dBlendStates[BLEND_MULTIPASS]); + RENDERER_ASSERT(m_d3dBlendStates[BLEND_MULTIPASS], "Error creating D3D blend state"); + } + if (!m_d3dBlendStates[BLEND_TRANSPARENT_ALPHA_COVERAGE] && m_d3dDevice) + { + D3D11_BLEND_DESC blendDesc; + memset(&blendDesc, 0, sizeof(blendDesc)); + if(getFeatureLevel() <= D3D_FEATURE_LEVEL_9_3) + { + blendDesc.AlphaToCoverageEnable = FALSE; + blendDesc.IndependentBlendEnable = FALSE; + } + else + { + blendDesc.AlphaToCoverageEnable = TRUE; + blendDesc.IndependentBlendEnable = TRUE; + } + blendDesc.RenderTarget[0].BlendEnable = TRUE; + blendDesc.RenderTarget[0].SrcBlend = D3D11_BLEND_SRC_ALPHA; + blendDesc.RenderTarget[0].DestBlend = D3D11_BLEND_ONE; + blendDesc.RenderTarget[0].BlendOp = D3D11_BLEND_OP_ADD; + blendDesc.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_ONE; + blendDesc.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_ONE; + blendDesc.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD; + blendDesc.RenderTarget[0].RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL; + + m_d3dDevice->CreateBlendState(&blendDesc, &m_d3dBlendStates[BLEND_TRANSPARENT_ALPHA_COVERAGE]); + RENDERER_ASSERT(m_d3dBlendStates[BLEND_TRANSPARENT_ALPHA_COVERAGE], "Error creating D3D blend state"); + } + if (!m_d3dBlendStates[BLEND_TRANSPARENT] && m_d3dDevice) + { + D3D11_BLEND_DESC blendDesc; + memset(&blendDesc, 0, sizeof(blendDesc)); + blendDesc.AlphaToCoverageEnable = FALSE; + if(getFeatureLevel() <= D3D_FEATURE_LEVEL_9_3) + { + blendDesc.IndependentBlendEnable = FALSE; + } + else + { + blendDesc.IndependentBlendEnable = TRUE; + } + blendDesc.RenderTarget[0].BlendEnable = TRUE; + blendDesc.RenderTarget[0].SrcBlend = D3D11_BLEND_SRC_ALPHA; + blendDesc.RenderTarget[0].DestBlend = D3D11_BLEND_INV_SRC_ALPHA; + blendDesc.RenderTarget[0].BlendOp = D3D11_BLEND_OP_ADD; + blendDesc.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_ONE; + blendDesc.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_ONE; + blendDesc.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD; + blendDesc.RenderTarget[0].RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL; + + m_d3dDevice->CreateBlendState(&blendDesc, &m_d3dBlendStates[BLEND_TRANSPARENT]); + RENDERER_ASSERT(m_d3dBlendStates[BLEND_TRANSPARENT], "Error creating D3D blend state"); + } + + const FLOAT BlendFactor[4] = {0, 0, 0, 0}; + m_d3dDeviceContext->OMSetBlendState(m_d3dBlendStates[state], BlendFactor, 0xffffffff); +} + +void SampleRenderer::D3D11Renderer::setTessellationState() +{ + getVariableManager()->setSharedVariable("cbTessellation", "g_tessFactor", &getTessellationParams().tessFactor); + getVariableManager()->setSharedVariable("cbTessellation", "g_tessMinMaxDistance", &getTessellationParams().tessMinMaxDistance); + getVariableManager()->setSharedVariable("cbTessellation", "g_tessHeightScaleAndBias", &getTessellationParams().tessHeightScaleAndBias); + getVariableManager()->setSharedVariable("cbTessellation", "g_tessUVScale", &getTessellationParams().tessUVScale); +} + +bool D3D11Renderer::tessellationEnabled() const +{ + return getEnableTessellation(); +} + +bool D3D11Renderer::isTessellationSupported(void) const +{ + return m_d3dDeviceFeatureLevel >= D3D_FEATURE_LEVEL_11_0; +} + +bool D3D11Renderer::multisamplingEnabled() const +{ + return m_swapChainDesc.SampleDesc.Count > 1 && m_swapChainDesc.SampleDesc.Quality > 0; +} + +void D3D11Renderer::beginMultiPass(void) +{ + setBlendState(BLEND_MULTIPASS); + setDepthStencilState(DEPTHSTENCIL_TRANSPARENT); + setRasterizerState(get<0>(m_boundRasterizerStateKey), get<1>(m_boundRasterizerStateKey), m_multipassDepthBias); +} + +void D3D11Renderer::endMultiPass(void) +{ + setBlendState(BLEND_DEFAULT); + setDepthStencilState(DEPTHSTENCIL_DEFAULT); + setRasterizerState(get<0>(m_boundRasterizerStateKey), get<1>(m_boundRasterizerStateKey), 0); +} + +void D3D11Renderer::beginTransparentMultiPass(void) +{ + setEnableBlendingOverride(true); + setBlendState(BLEND_TRANSPARENT_ALPHA_COVERAGE); + setDepthStencilState(DEPTHSTENCIL_TRANSPARENT); +} + +void D3D11Renderer::endTransparentMultiPass(void) +{ + setEnableBlendingOverride(false); + setBlendState(BLEND_DEFAULT); + setDepthStencilState(DEPTHSTENCIL_DEFAULT); +} + +void D3D11Renderer::renderDeferredLight(const RendererLight& light) +{ + RENDERER_ASSERT(0, "Not implemented!"); +} + +PxU32 D3D11Renderer::convertColor(const RendererColor& color) const +{ + return color.a << 24 | color.r << 16 | color.g << 8 | color.b; +} + +bool D3D11Renderer::isOk(void) const +{ + bool ok = (m_d3d && m_d3dDevice); +#if defined(RENDERER_WINDOWS) + if (!SampleFramework::SamplePlatform::platform()->isD3D11ok() || !m_d3dx->m_library) + { + ok = false; + } +#endif + return ok; +} + +void D3D11Renderer::addResource(D3D11RendererResource& resource) +{ + RENDERER_ASSERT(resource.m_d3dRenderer == 0, "Resource already in added to the Renderer!"); + if (resource.m_d3dRenderer == 0) + { + resource.m_d3dRenderer = this; + m_resources.push_back(&resource); + } +} + +void D3D11Renderer::removeResource(D3D11RendererResource& resource) +{ + RENDERER_ASSERT(resource.m_d3dRenderer == this, "Resource not part of this Renderer!"); + if (resource.m_d3dRenderer == this) + { + resource.m_d3dRenderer = 0; + const PxU32 numResources = (PxU32)m_resources.size(); + PxU32 foundResource = numResources; + for (PxU32 i = 0; i < numResources; ++i) + { + if (m_resources[i] == &resource) + { + foundResource = i; + break; + } + } + if (foundResource < numResources) + { + m_resources[foundResource] = m_resources.back(); + m_resources.pop_back(); + } + } +} + +void D3D11Renderer::notifyResourcesLostDevice(void) +{ + const PxU32 numResources = (PxU32)m_resources.size(); + for (PxU32 i = 0; i < numResources; ++i) + { + m_resources[i]->onDeviceLost(); + } +} + +void D3D11Renderer::notifyResourcesResetDevice(void) +{ + const PxU32 numResources = (PxU32)m_resources.size(); + for (PxU32 i = 0; i < numResources; ++i) { + m_resources[i]->onDeviceReset(); + } +} + +void D3D11Renderer::bind(RendererMaterialInstance* materialInstance) +{ + m_boundMaterial = materialInstance; +#if RENDERER_ENABLE_SHADOWS + if (m_boundMaterial && m_environment.lightShadowMap) + { + const RendererMaterial::Variable* pShadowMap = m_boundMaterial->findVariable("g_lightShadowMap", RendererMaterial::VARIABLE_SAMPLER2D); + if (pShadowMap) + { + m_boundMaterial->writeData(*pShadowMap, &m_environment.lightShadowMap); + } + } +#endif +} + +/////////////////////////////////////////////////////////////////////////////// + +static void pushRasterizer(ID3D11DeviceContext& context) +{ + gRasterizerState.push_back(NULL); + gViewport.push_back(D3D11_VIEWPORT()); + PxU32 NUM_VIEWPORTS = 1; + context.RSGetState(&gRasterizerState.back()); + context.RSGetViewports(&NUM_VIEWPORTS, &gViewport.back()); +} + +static void pushBlend(ID3D11DeviceContext& context) +{ + gBlendState.push_back(NULL); + gBlendFactor.push_back(PxVec4()); + gBlendMask.push_back(0); + context.OMGetBlendState(&gBlendState.back(), &gBlendFactor.back()[0], &gBlendMask.back()); +} + +static void pushDepthStencil(ID3D11DeviceContext& context) +{ + gDepthStencilState.push_back(NULL); + gDepthStencilMask.push_back(0); + context.OMGetDepthStencilState(&gDepthStencilState.back(), &gDepthStencilMask.back()); +} + +static void popRasterizer(ID3D11DeviceContext& context) +{ + if (!gRasterizerState.empty()) + { + context.RSSetState(gRasterizerState.back()); + dxSafeRelease(gRasterizerState.back()); + gRasterizerState.pop_back(); + } + if (!gViewport.empty()) + { + context.RSSetViewports(1, &gViewport.back()); + gViewport.pop_back(); + } +} + +static void popBlend(ID3D11DeviceContext& context) +{ + if (!gBlendState.empty()) + { + context.OMSetBlendState(gBlendState.back(), &gBlendFactor.back()[0], gBlendMask.back()); + dxSafeRelease(gBlendState.back()); + gBlendState.pop_back(); + gBlendFactor.pop_back(); + gBlendMask.pop_back(); + } +} + +static void popDepthStencil(ID3D11DeviceContext& context) +{ + if (!gDepthStencilState.empty()) + { + context.OMSetDepthStencilState(gDepthStencilState.back(), gDepthStencilMask.back()); + dxSafeRelease(gDepthStencilState.back()); + gDepthStencilState.pop_back(); + gDepthStencilMask.pop_back(); + } +} + +void D3D11Renderer::pushState(StateType stateType) +{ + if (m_d3dDeviceContext) + { + switch (stateType) + { + case STATE_BLEND: + pushBlend(*m_d3dDeviceContext); + break; + case STATE_RASTERIZER: + pushRasterizer(*m_d3dDeviceContext); + break; + case STATE_DEPTHSTENCIL: + pushDepthStencil(*m_d3dDeviceContext); + break; + default: + break; + } + } +} + +void D3D11Renderer::popState(StateType stateType) +{ + if (m_d3dDeviceContext) + { + switch (stateType) + { + case STATE_BLEND: + popBlend(*m_d3dDeviceContext); + break; + case STATE_RASTERIZER: + popRasterizer(*m_d3dDeviceContext); + break; + case STATE_DEPTHSTENCIL: + popDepthStencil(*m_d3dDeviceContext); + break; + default: + break; + } + } +} + +bool D3D11Renderer::initTexter() +{ + if (!Renderer::initTexter() || !m_d3dDevice) + { + return false; + } + + return true; +} + +void D3D11Renderer::closeTexter() +{ + Renderer::closeTexter(); +} + +void D3D11Renderer::setupTextRenderStates() +{ + if (m_d3dDeviceContext) + { + pushState(STATE_BLEND); + pushState(STATE_DEPTHSTENCIL); + pushState(STATE_RASTERIZER); + + setBlendState(BLEND_TRANSPARENT); + setDepthStencilState(DEPTHSTENCIL_DISABLED); + setRasterizerState(D3D11_FILL_SOLID, D3D11_CULL_NONE); + } +} + +void D3D11Renderer::resetTextRenderStates() +{ + if (m_d3dDeviceContext) + { + popState(STATE_RASTERIZER); + popState(STATE_DEPTHSTENCIL); + popState(STATE_BLEND); + } +} + +void D3D11Renderer::renderTextBuffer(const void* vertices, PxU32 nbVerts, const PxU16* indices, PxU32 nbIndices, RendererMaterial* material) +{ + PX_UNUSED(material); + // PT: font texture must have been selected prior to calling this function + if (m_d3dDeviceContext && m_d3dDevice && m_boundMaterial) + { + const PxU32 minMeshSize = m_currentTextMesh + 1; + if ((m_currentTextMesh + 1) > m_textVertices.size() || m_textVertices[m_currentTextMesh]->getMaxVertices() < nbVerts) + { + resizeIfSmallerThan(m_textVertices, minMeshSize, NULL); + resizeIfSmallerThan(m_textMeshes, minMeshSize, NULL); + + deleteSafe(m_textVertices[m_currentTextMesh]); + deleteSafe(m_textMeshes[m_currentTextMesh]); + + RendererVertexBufferDesc desc; + desc.maxVertices = nbVerts * 3; + desc.semanticFormats[RendererVertexBuffer::SEMANTIC_POSITION] = RendererVertexBuffer::FORMAT_FLOAT4; + desc.semanticFormats[RendererVertexBuffer::SEMANTIC_COLOR] = RendererVertexBuffer::FORMAT_COLOR_BGRA; + desc.semanticFormats[RendererVertexBuffer::SEMANTIC_TEXCOORD0] = RendererVertexBuffer::FORMAT_FLOAT2; + m_textVertices[m_currentTextMesh] = new D3D11RendererVertexBuffer(*m_d3dDevice, *m_d3dDeviceContext, desc, false); + } + if ((m_currentTextMesh + 1) > m_textIndices.size() || m_textIndices[m_currentTextMesh]->getMaxIndices() < nbIndices) + { + resizeIfSmallerThan(m_textIndices, minMeshSize, NULL); + resizeIfSmallerThan(m_textMeshes, minMeshSize, NULL); + + deleteSafe(m_textIndices[m_currentTextMesh]); + deleteSafe(m_textMeshes[m_currentTextMesh]); + + RendererIndexBufferDesc desc; + desc.maxIndices = nbIndices * 3; + desc.hint = RendererIndexBuffer::HINT_DYNAMIC; + desc.format = RendererIndexBuffer::FORMAT_UINT16; + m_textIndices[m_currentTextMesh] = new D3D11RendererIndexBuffer(*m_d3dDevice, *m_d3dDeviceContext, desc); + } + if ((m_currentTextMesh + 1) > m_textMeshes.size() || NULL == m_textMeshes[m_currentTextMesh] && m_textIndices[m_currentTextMesh] && m_textVertices[m_currentTextMesh]) + { + resizeIfSmallerThan(m_textMeshes, minMeshSize, NULL); + + RendererMeshDesc meshdesc; + meshdesc.primitives = RendererMesh::PRIMITIVE_TRIANGLES; + RendererVertexBuffer* vertexBuffer = m_textVertices[m_currentTextMesh]; + meshdesc.vertexBuffers = &vertexBuffer; + meshdesc.numVertexBuffers = 1; + meshdesc.firstVertex = 0; + meshdesc.numVertices = nbVerts; + meshdesc.indexBuffer = m_textIndices[m_currentTextMesh]; + meshdesc.firstIndex = 0; + meshdesc.numIndices = nbIndices; + m_textMeshes[m_currentTextMesh] = new D3D11RendererMesh(*this, meshdesc); + } + + if (m_textMeshes[m_currentTextMesh]) + { + // Assign the vertex transform and bind to the pipeline + const RendererMaterial::Variable* pViewVariable = m_boundMaterial->findVariable("g_viewMatrix2D", RendererMaterial::VARIABLE_FLOAT4x4); + RENDERER_ASSERT(pViewVariable, "Unable to locate view matrix variable in text vertex shader."); + if (pViewVariable) + { + PxMat44 viewMatrix (PxVec4(2.f / m_displayWidth , 0, 0, -1), + PxVec4(0, -2.f / m_displayHeight, 0, 1), + PxVec4(0 , 0, 1, 0), + PxVec4(0 , 0, 0, 1)); + m_boundMaterial->writeData(*pViewVariable, &viewMatrix); + static_cast<D3D11RendererMaterial&>(m_boundMaterial->getMaterial()).bindMeshState(false); + } + memcpy(m_textVertices[m_currentTextMesh]->internalLock(D3D11_MAP_WRITE_DISCARD), vertices, nbVerts * sizeof(TextVertex)); + m_textVertices[m_currentTextMesh]->unlock(); + memcpy(m_textIndices[m_currentTextMesh]->internalLock(D3D11_MAP_WRITE_DISCARD), indices, nbIndices * sizeof(PxU16)); + m_textIndices[m_currentTextMesh]->unlock(); + + m_textMeshes[m_currentTextMesh]->setNumVerticesAndIndices(nbVerts, nbIndices); + m_textMeshes[m_currentTextMesh]->bind(); + m_textMeshes[m_currentTextMesh]->render(&m_boundMaterial->getMaterial()); + ++m_currentTextMesh; + } + } +} + +bool D3D11Renderer::isSpriteRenderingSupported(void) const +{ + if(getFeatureLevel() <= D3D_FEATURE_LEVEL_9_3) + { + return false; + } + else + { + return true; + } +} + +void D3D11Renderer::renderLines2D(const void* vertices, PxU32 nbVerts) +{ + if (m_d3dDeviceContext && m_d3dDevice && m_boundMaterial) + { + if (!m_linesVertices || m_linesVertices->getMaxVertices() < nbVerts) + { + deleteSafe(m_linesVertices); + deleteSafe(m_linesMesh); + + RendererVertexBufferDesc desc; + desc.maxVertices = nbVerts * 3; + desc.semanticFormats[RendererVertexBuffer::SEMANTIC_POSITION] = RendererVertexBuffer::FORMAT_FLOAT4; + desc.semanticFormats[RendererVertexBuffer::SEMANTIC_COLOR] = RendererVertexBuffer::FORMAT_COLOR_BGRA; + desc.semanticFormats[RendererVertexBuffer::SEMANTIC_TEXCOORD0] = RendererVertexBuffer::FORMAT_FLOAT2; + m_linesVertices = new D3D11RendererVertexBuffer(*m_d3dDevice, *m_d3dDeviceContext, desc, false); + } + if (!m_linesMesh && m_linesVertices) + { + RendererMeshDesc meshdesc; + meshdesc.primitives = RendererMesh::PRIMITIVE_LINE_STRIP; + RendererVertexBuffer* vertexBuffer = m_linesVertices; + meshdesc.vertexBuffers = &vertexBuffer; + meshdesc.numVertexBuffers = 1; + meshdesc.firstVertex = 0; + meshdesc.numVertices = nbVerts; + m_linesMesh = new D3D11RendererMesh(*this, meshdesc); + } + + if (m_linesMesh) + { + const RendererMaterial::Variable* pViewVariable = m_boundMaterial->findVariable("g_viewMatrix2D", RendererMaterial::VARIABLE_FLOAT4x4); + if (pViewVariable) + { + PxMat44 viewMatrix (PxVec4(2.f / m_displayWidth , 0, 0, -1), + PxVec4(0, -2.f / m_displayHeight, 0, 1), + PxVec4(0 , 0, 1, 0), + PxVec4(0 , 0, 0, 1)); + m_boundMaterial->writeData(*pViewVariable, &viewMatrix); + static_cast<D3D11RendererMaterial&>(m_boundMaterial->getMaterial()).bindMeshState(false); + } + memcpy(m_linesVertices->internalLock(D3D11_MAP_WRITE_DISCARD), vertices, nbVerts * sizeof(TextVertex)); + m_linesVertices->unlock(); + + m_linesMesh->setNumVerticesAndIndices(nbVerts, 0); + m_linesMesh->bind(); + m_linesMesh->render(&m_boundMaterial->getMaterial()); + } + } +} + +void D3D11Renderer::setupScreenquadRenderStates() +{ + if (m_d3dDeviceContext) + { + pushState(STATE_DEPTHSTENCIL); + pushState(STATE_RASTERIZER); + pushState(STATE_BLEND); + + setDepthStencilState(DEPTHSTENCIL_DISABLED); + setRasterizerState(D3D11_FILL_SOLID, D3D11_CULL_NONE); + setBlendState(BLEND_TRANSPARENT); + } +} + +void D3D11Renderer::resetScreenquadRenderStates() +{ + if (m_d3dDeviceContext) + { + popState(STATE_DEPTHSTENCIL); + popState(STATE_RASTERIZER); + popState(STATE_BLEND); + } +} + +bool D3D11Renderer::captureScreen( PxU32 &width, PxU32& height, PxU32& sizeInBytes, const void*& screenshotData ) +{ + bool bSuccess = false; + + HRESULT hr; + ID3D11Resource *backbufferRes; + m_d3dRenderTargetView->GetResource(&backbufferRes); + + D3D11_TEXTURE2D_DESC texDesc; + texDesc.ArraySize = 1; + texDesc.BindFlags = 0; + texDesc.CPUAccessFlags = 0; + texDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; + texDesc.Width = m_displayWidth; + texDesc.Height = m_displayHeight; + texDesc.MipLevels = 1; + texDesc.MiscFlags = 0; + texDesc.SampleDesc.Count = 1; + texDesc.SampleDesc.Quality = 0; + texDesc.Usage = D3D11_USAGE_DEFAULT; + + ID3D11Texture2D *texture = NULL; + hr = m_d3dDevice->CreateTexture2D(&texDesc, 0, &texture); + + if (SUCCEEDED(hr)) + { + dxSafeRelease(m_displayBuffer); + m_d3dDeviceContext->CopyResource(texture, backbufferRes); +#if !PX_XBOXONE + hr = m_d3dx->saveTextureToMemory(m_d3dDeviceContext, texture, D3DX11_IFF_BMP, &m_displayBuffer, 0); +#endif + } + + dxSafeRelease(texture); + dxSafeRelease(backbufferRes); + + if(SUCCEEDED(hr)) + { + getWindowSize(width, height); + sizeInBytes = (physx::PxU32)m_displayBuffer->GetBufferSize(); + screenshotData = m_displayBuffer->GetBufferPointer(); + bSuccess = true; + } + return bSuccess; +} + + +#endif // #if defined(RENDERER_ENABLE_DIRECT3D11) diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11Renderer.h b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11Renderer.h new file mode 100644 index 00000000..f716cfa6 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11Renderer.h @@ -0,0 +1,344 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#ifndef D3D11_RENDERER_H +#define D3D11_RENDERER_H + +#include <RendererConfig.h> + +#if defined(RENDERER_ENABLE_DIRECT3D11) + +#include <Renderer.h> +#include <vector> +#include <tuple> + +#if defined(RENDERER_DEBUG) +//#define D3D_DEBUG_INFO 1 +#endif + +#define RENDERER_ENABLE_VFACE_SCALE 1 +#define RENDERER_ENABLE_SHADOWS 0 + +#if RENDERER_ENABLE_SINGLE_PASS_LIGHTING +#define RENDERER_MAX_LIGHTS 4 +#else +#define RENDERER_MAX_LIGHTS 1 +#endif + +#define INITGUID +#pragma warning(push) +// Disable macro redefinition warnings +#pragma warning(disable: 4005) +#include <d3d11.h> +#pragma warning(pop) +#undef INITGUID + +namespace SampleRenderer +{ +class RendererDesc; +class RendererColor; + +void convertToD3D11(PxVec3& dxcolor, const RendererColor& color); +void convertToD3D11(PxVec4& dxcolor, const RendererColor& color); +void convertToD3D11(PxMat44& dxmat, const RendererProjection& mat); +void convertToD3D11(PxMat44& dxmat, const physx::PxMat44 &mat); + +class D3D11RendererVariableManager; +class D3D11RendererResourceManager; +class D3D11RendererResource; +class D3D11RendererMaterial; +class D3D11RendererMesh; +class D3D11RendererVertexBuffer; +class D3D11RendererIndexBuffer; +class D3D11RendererTexture2D; + +class D3DX11; + +class D3D11Renderer : public Renderer +{ + friend class D3D11RendererResource; + friend class D3D11RendererMesh; +public: + class D3D11ShaderEnvironment + { + friend class D3D11Renderer; + friend class D3D11RendererSpotLight; + friend class D3D11RendererDirectionalLight; + + public: + D3D11ShaderEnvironment(); + + void bindFrame() const; + void bindLight(PxU32 lightIndex = 0) const; + void bindModel() const; + void bindBones() const; + void bindFogState() const; + void bindAmbientState() const; + void bindVFaceScale() const; + + void reset(); + + protected: + PxMat44 modelMatrix; + PxMat44 modelViewMatrix; + PxMat44 modelViewProjMatrix; + + PxMat44 viewMatrix; + PxMat44 projMatrix; + PxMat44 invViewProjMatrix; + PxMat44 lightShadowMatrix; + + PxMat44 boneMatrices[RENDERER_MAX_BONES]; + PxU32 numBones; + + PxVec4 fogColorAndDistance; + + PxVec3 eyePosition; + PxVec3 eyeDirection; + + PxVec3 ambientColor; + + PxVec3 lightColor[RENDERER_MAX_LIGHTS]; + PxVec3 lightDirection[RENDERER_MAX_LIGHTS]; + PxVec3 lightPosition[RENDERER_MAX_LIGHTS]; + float lightIntensity[RENDERER_MAX_LIGHTS]; + float lightInnerRadius[RENDERER_MAX_LIGHTS]; + float lightOuterRadius[RENDERER_MAX_LIGHTS]; + float lightInnerCone[RENDERER_MAX_LIGHTS]; + float lightOuterCone[RENDERER_MAX_LIGHTS]; + int lightType[RENDERER_MAX_LIGHTS]; + mutable int numLights; + + D3D11RendererTexture2D* lightShadowMap; + + float vfs; + + D3D11RendererVariableManager* constantManager; + }; + +public: + D3D11Renderer(const RendererDesc& desc, const char* assetDir); + virtual ~D3D11Renderer(void); + + ID3D11Device* getD3DDevice(void) { return m_d3dDevice; } + ID3D11DeviceContext* getD3DDeviceContext(void) { return m_d3dDeviceContext; } + D3DX11* getD3DX11(void) { return m_d3dx; } + D3D11ShaderEnvironment& getShaderEnvironment(void) { return m_environment; } + const D3D11ShaderEnvironment& getShaderEnvironment(void) const { return m_environment; } + D3D11RendererResourceManager* getResourceManager(void) { return m_resourceManager; } + D3D11RendererVariableManager* getVariableManager(void) { return m_constantManager; } + + bool multisamplingEnabled(void) const; + bool tessellationEnabled(void) const; + bool isTessellationSupported(void) const; + +private: + bool checkResize(bool resetDevice); + +public: + void onDeviceLost(void); + void onDeviceReset(void); + +public: + // clears the offscreen buffers. + virtual void clearBuffers(void); + + // presents the current color buffer to the screen. + // returns true on device reset and if buffers need to be rewritten. + virtual bool swapBuffers(void); + + // get the device pointer (void * abstraction) + virtual void* getDevice() + { + return static_cast<void*>(getD3DDevice()); + } + + // get the window size + void getWindowSize(PxU32& width, PxU32& height) const; + + // gets a handle to the current frame's data, in bitmap format + // note: subsequent calls will invalidate any previously returned data + // return true on successful screenshot capture + bool captureScreen(PxU32 &width, PxU32& height, PxU32& sizeInBytes, const void*& screenshotData); + + D3D_FEATURE_LEVEL getFeatureLevel() const { return (D3D_FEATURE_LEVEL)m_d3dDeviceFeatureLevel; } + + virtual RendererVertexBuffer* createVertexBuffer(const RendererVertexBufferDesc& desc); + virtual RendererIndexBuffer* createIndexBuffer(const RendererIndexBufferDesc& desc); + virtual RendererInstanceBuffer* createInstanceBuffer(const RendererInstanceBufferDesc& desc); + virtual RendererTexture2D* createTexture2D(const RendererTexture2DDesc& desc); + virtual RendererTexture3D* createTexture3D(const RendererTexture3DDesc& desc); + virtual RendererTarget* createTarget(const RendererTargetDesc& desc); + virtual RendererMaterial* createMaterial(const RendererMaterialDesc& desc); + virtual RendererMesh* createMesh(const RendererMeshDesc& desc); + virtual RendererLight* createLight(const RendererLightDesc& desc); + + virtual void setVsync(bool on); + + virtual bool initTexter(); + virtual void closeTexter(); + + void bind(RendererMaterialInstance* materialInstance); + + virtual bool isSpriteRenderingSupported(void) const; + +private: + virtual bool beginRender(void); + virtual void endRender(void); + virtual void bindViewProj(const physx::PxMat44& eye, const RendererProjection& proj); + virtual void bindFogState(const RendererColor& fogColor, float fogDistance); + virtual void bindAmbientState(const RendererColor& ambientColor); + virtual void bindDeferredState(void); + virtual void bindMeshContext(const RendererMeshContext& context); + virtual void beginMultiPass(void); + virtual void endMultiPass(void); + virtual void beginTransparentMultiPass(void); + virtual void endTransparentMultiPass(void); + virtual void renderDeferredLight(const RendererLight& light); + virtual PxU32 convertColor(const RendererColor& color) const; + + virtual bool isOk(void) const; + + virtual void setupTextRenderStates(); + virtual void resetTextRenderStates(); + virtual void renderTextBuffer(const void* vertices, PxU32 nbVerts, const PxU16* indices, PxU32 nbIndices, RendererMaterial* material); + virtual void renderLines2D(const void* vertices, PxU32 nbVerts); + virtual void setupScreenquadRenderStates(); + virtual void resetScreenquadRenderStates(); + +public: + enum BlendState + { + BLEND_DEFAULT = 0, + BLEND_MULTIPASS, + BLEND_TRANSPARENT, + BLEND_TRANSPARENT_ALPHA_COVERAGE, + NUM_BLEND_STATES + }; + void setBlendState(BlendState state = BLEND_DEFAULT); + + void setRasterizerState(D3D11_FILL_MODE = D3D11_FILL_SOLID, D3D11_CULL_MODE = D3D11_CULL_BACK, PxI32 depthBias = 0); + + enum DepthStencilState + { + DEPTHSTENCIL_DEFAULT = 0, + DEPTHSTENCIL_DISABLED, + DEPTHSTENCIL_TRANSPARENT, + NUM_DEPTH_STENCIL_STATES + }; + void setDepthStencilState(DepthStencilState state); + + enum StateType + { + STATE_BLEND, + STATE_DEPTHSTENCIL, + STATE_RASTERIZER, + NUM_STATE_TYPES + }; + void pushState(StateType stateType); + void popState(StateType stateType); + + void setTessellationState(); + +private: + void addResource(D3D11RendererResource& resource); + void removeResource(D3D11RendererResource& resource); + void notifyResourcesLostDevice(void); + void notifyResourcesResetDevice(void); + +private: + PxU32 m_displayWidth; + PxU32 m_displayHeight; + ID3DBlob* m_displayBuffer; + bool m_vsync; + PxI32 m_multipassDepthBias; + + IDXGIFactory* m_d3d; + IDXGISwapChain* m_d3dSwapChain; + + ID3D11BlendState* m_d3dBlendStates[NUM_BLEND_STATES]; + ID3D11Device* m_d3dDevice; + ID3D11DeviceContext* m_d3dDeviceContext; + PxU32 m_d3dDeviceFeatureLevel; + ID3D11Texture2D* m_d3dDepthStencilBuffer; + ID3D11DepthStencilView* m_d3dDepthStencilView; + ID3D11DepthStencilState* m_d3dDepthStencilStates[NUM_DEPTH_STENCIL_STATES]; + ID3D11Texture2D* m_d3dRenderTargetBuffer; + ID3D11RenderTargetView* m_d3dRenderTargetView; + + std::tr1::tuple<D3D11_FILL_MODE, D3D11_CULL_MODE, int> m_boundRasterizerStateKey; + + RendererMaterialInstance* m_boundMaterial; + + std::vector<D3D11RendererMesh*> m_textMeshes; + std::vector<D3D11RendererVertexBuffer*> m_textVertices; + std::vector<D3D11RendererIndexBuffer*> m_textIndices; + PxU32 m_currentTextMesh; + D3D11RendererMesh* m_linesMesh; + D3D11RendererVertexBuffer* m_linesVertices; + + DXGI_SWAP_CHAIN_DESC m_swapChainDesc; + physx::PxMat44 m_viewMatrix; + + // non-managed resources... + std::vector<D3D11RendererResource*> m_resources; + + D3DX11* m_d3dx; + D3D11ShaderEnvironment m_environment; + D3D11RendererVariableManager* m_constantManager; + D3D11RendererResourceManager* m_resourceManager; +}; + +class D3D11RendererResource +{ + friend class D3D11Renderer; +public: + D3D11RendererResource(void) + { + m_d3dRenderer = 0; + } + + virtual ~D3D11RendererResource(void) + { + if (m_d3dRenderer) + { + m_d3dRenderer->removeResource(*this); + } + } + +public: + virtual void onDeviceLost(void) = 0; + virtual void onDeviceReset(void) = 0; + +private: + D3D11Renderer* m_d3dRenderer; +}; + +} // namespace SampleRenderer + +#endif // #if defined(RENDERER_ENABLE_DIRECT3D11) +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11RendererDirectionalLight.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11RendererDirectionalLight.cpp new file mode 100644 index 00000000..16e25b1b --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11RendererDirectionalLight.cpp @@ -0,0 +1,61 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#include <RendererConfig.h> + +#if defined(RENDERER_ENABLE_DIRECT3D11) + +#include "D3D11RendererDirectionalLight.h" + +using namespace SampleRenderer; + +D3D11RendererDirectionalLight::D3D11RendererDirectionalLight(D3D11Renderer& renderer, const RendererDirectionalLightDesc& desc) : + RendererDirectionalLight(desc), + m_renderer(renderer) +{ + +} + +D3D11RendererDirectionalLight::~D3D11RendererDirectionalLight(void) +{ + +} + +void D3D11RendererDirectionalLight::bind(PxU32 lightIndex) const +{ + D3D11Renderer::D3D11ShaderEnvironment& shaderEnv = m_renderer.getShaderEnvironment(); + if (lightIndex < RENDERER_MAX_LIGHTS) + { + convertToD3D11(shaderEnv.lightColor[lightIndex], m_color); + shaderEnv.lightDirection[lightIndex] = m_direction; + shaderEnv.lightIntensity[lightIndex] = m_intensity; + shaderEnv.lightType[lightIndex] = RendererMaterial::PASS_DIRECTIONAL_LIGHT; + shaderEnv.bindLight(lightIndex); + } +} + +#endif // #if defined(RENDERER_ENABLE_DIRECT3D11) diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11RendererDirectionalLight.h b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11RendererDirectionalLight.h new file mode 100644 index 00000000..7c98e693 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11RendererDirectionalLight.h @@ -0,0 +1,58 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#ifndef D3D11_RENDERER_DIRECTIONAL_LIGHT_H +#define D3D11_RENDERER_DIRECTIONAL_LIGHT_H + +#include <RendererConfig.h> + +#if defined(RENDERER_ENABLE_DIRECT3D11) + +#include <RendererDirectionalLight.h> + +#include "D3D11Renderer.h" + +namespace SampleRenderer +{ + +class D3D11RendererDirectionalLight : public RendererDirectionalLight +{ +public: + D3D11RendererDirectionalLight(D3D11Renderer& renderer, const RendererDirectionalLightDesc& desc); + virtual ~D3D11RendererDirectionalLight(void); + + virtual void bind(void) const { bind(0); } + virtual void bind(PxU32) const; + +private: + D3D11Renderer& m_renderer; +}; + +} // namespace SampleRenderer + +#endif // #if defined(RENDERER_ENABLE_DIRECT3D11) +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11RendererIndexBuffer.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11RendererIndexBuffer.cpp new file mode 100644 index 00000000..5265c28e --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11RendererIndexBuffer.cpp @@ -0,0 +1,193 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#include <RendererConfig.h> + +#if defined(RENDERER_ENABLE_DIRECT3D11) + +#include "D3D11RendererIndexBuffer.h" +#include <RendererIndexBufferDesc.h> + +#if PX_WINDOWS +#include <task/PxTask.h> +#endif + +using namespace SampleRenderer; + +static DXGI_FORMAT getD3D11Format(RendererIndexBuffer::Format format) +{ + DXGI_FORMAT dxgiFormat = DXGI_FORMAT_UNKNOWN; + switch (format) + { + case RendererIndexBuffer::FORMAT_UINT16: + dxgiFormat = DXGI_FORMAT_R16_UINT; + break; + case RendererIndexBuffer::FORMAT_UINT32: + dxgiFormat = DXGI_FORMAT_R32_UINT; + break; + } + RENDERER_ASSERT(dxgiFormat != DXGI_FORMAT_UNKNOWN, "Unable to convert to DXGI_FORMAT."); + return dxgiFormat; +} + +D3D11RendererIndexBuffer::D3D11RendererIndexBuffer(ID3D11Device& d3dDevice, ID3D11DeviceContext& d3dDeviceContext, const RendererIndexBufferDesc& desc, bool bUseMapForLocking) : + RendererIndexBuffer(desc), + m_d3dDevice(d3dDevice), + m_d3dDeviceContext(d3dDeviceContext), + m_d3dIndexBuffer(NULL), + m_bUseMapForLocking(bUseMapForLocking && (!desc.registerInCUDA)), + m_buffer(NULL) +{ + memset(&m_d3dBufferDesc, 0, sizeof(D3D11_BUFFER_DESC)); + m_d3dBufferDesc.BindFlags = D3D11_BIND_INDEX_BUFFER; + m_d3dBufferDesc.ByteWidth = (UINT)(getFormatByteSize(desc.format) * desc.maxIndices); + m_d3dBufferFormat = getD3D11Format(desc.format); + + if (m_bUseMapForLocking) + { + m_d3dBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; + m_d3dBufferDesc.Usage = D3D11_USAGE_DYNAMIC; + } + else + { + m_d3dBufferDesc.CPUAccessFlags = 0; + m_d3dBufferDesc.Usage = D3D11_USAGE_DEFAULT; + m_buffer = new PxU8[m_d3dBufferDesc.ByteWidth]; + memset(m_buffer, 0, sizeof(PxU8)*m_d3dBufferDesc.ByteWidth); + } + + onDeviceReset(); + + if (m_d3dIndexBuffer) + { + m_maxIndices = desc.maxIndices; + } + +} + +D3D11RendererIndexBuffer::~D3D11RendererIndexBuffer(void) +{ + if (m_d3dIndexBuffer) + { +#if PX_WINDOWS && PX_SUPPORT_GPU_PHYSX + if (m_interopContext && m_registeredInCUDA) + { + m_registeredInCUDA = !m_interopContext->unregisterResourceInCuda(m_InteropHandle); + } +#endif + m_d3dIndexBuffer->Release(); + m_d3dIndexBuffer = NULL; + } + + delete [] m_buffer; +} + + +void D3D11RendererIndexBuffer::onDeviceLost(void) +{ + m_registeredInCUDA = false; + + if (m_d3dIndexBuffer) + { +#if PX_WINDOWS && PX_SUPPORT_GPU_PHYSX + if (m_interopContext && m_registeredInCUDA) + { + m_registeredInCUDA = !m_interopContext->unregisterResourceInCuda(m_InteropHandle); + } +#endif + m_d3dIndexBuffer->Release(); + m_d3dIndexBuffer = 0; + } +} + +void D3D11RendererIndexBuffer::onDeviceReset(void) +{ + if (!m_d3dIndexBuffer) + { + m_d3dDevice.CreateBuffer(&m_d3dBufferDesc, NULL, &m_d3dIndexBuffer); + RENDERER_ASSERT(m_d3dIndexBuffer, "Failed to create DIRECT3D11 Index Buffer."); +#if PX_WINDOWS && PX_SUPPORT_GPU_PHYSX + if (m_interopContext && m_d3dIndexBuffer && m_mustBeRegisteredInCUDA) + { + m_registeredInCUDA = m_interopContext->registerResourceInCudaD3D(m_InteropHandle, m_d3dIndexBuffer); + } +#endif + } +} + +void* D3D11RendererIndexBuffer::lock(void) +{ + // For now NO_OVERWRITE is the only mapping that functions properly + return internalLock(getHint() == HINT_STATIC ? /* D3D11_MAP_WRITE_DISCARD */ D3D11_MAP_WRITE_NO_OVERWRITE : D3D11_MAP_WRITE_NO_OVERWRITE); +} + +void* D3D11RendererIndexBuffer::internalLock(D3D11_MAP MapType) +{ + void* buffer = 0; + if (m_d3dIndexBuffer) + { + if (m_bUseMapForLocking) + { + D3D11_MAPPED_SUBRESOURCE mappedRead; + m_d3dDeviceContext.Map(m_d3dIndexBuffer, 0, MapType, NULL, &mappedRead); + RENDERER_ASSERT(mappedRead.pData, "Failed to lock DIRECT3D11 Index Buffer."); + buffer = mappedRead.pData; + } + else + { + buffer = m_buffer; + } + } + return buffer; +} + +void D3D11RendererIndexBuffer::unlock(void) +{ + if (m_d3dIndexBuffer) + { + if (m_bUseMapForLocking) + { + m_d3dDeviceContext.Unmap(m_d3dIndexBuffer, 0); + } + else + { + m_d3dDeviceContext.UpdateSubresource(m_d3dIndexBuffer, 0, NULL, m_buffer, m_d3dBufferDesc.ByteWidth, 0); + } + } +} + +void D3D11RendererIndexBuffer::bind(void) const +{ + m_d3dDeviceContext.IASetIndexBuffer(m_d3dIndexBuffer, m_d3dBufferFormat, 0); +} + +void D3D11RendererIndexBuffer::unbind(void) const +{ + m_d3dDeviceContext.IASetIndexBuffer(NULL, DXGI_FORMAT(), 0); +} + +#endif // #if defined(RENDERER_ENABLE_DIRECT3D11) diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11RendererIndexBuffer.h b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11RendererIndexBuffer.h new file mode 100644 index 00000000..52d8aaf4 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11RendererIndexBuffer.h @@ -0,0 +1,75 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#ifndef D3D11_RENDERER_INDEXBUFFER_H +#define D3D11_RENDERER_INDEXBUFFER_H + +#include <RendererConfig.h> + +#if defined(RENDERER_ENABLE_DIRECT3D11) + +#include <RendererIndexBuffer.h> +#include "D3D11Renderer.h" + +namespace SampleRenderer +{ + +class D3D11RendererIndexBuffer : public RendererIndexBuffer, public D3D11RendererResource +{ + friend class D3D11Renderer; +public: + D3D11RendererIndexBuffer(ID3D11Device& d3dDevice, ID3D11DeviceContext& d3dDeviceContext, const RendererIndexBufferDesc& desc, bool bUseMapForLocking = TRUE); + virtual ~D3D11RendererIndexBuffer(void); + +public: + virtual void* lock(void); + virtual void unlock(void); + +private: + virtual void bind(void) const; + virtual void unbind(void) const; + + virtual void onDeviceLost(void); + virtual void onDeviceReset(void); + + void* internalLock(D3D11_MAP MapType); + +private: + ID3D11Device& m_d3dDevice; + ID3D11DeviceContext& m_d3dDeviceContext; + ID3D11Buffer* m_d3dIndexBuffer; + D3D11_BUFFER_DESC m_d3dBufferDesc; + DXGI_FORMAT m_d3dBufferFormat; + + bool m_bUseMapForLocking; + PxU8* m_buffer; +}; + +} // namespace SampleRenderer + +#endif // #if defined(RENDERER_ENABLE_DIRECT3D11) +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11RendererInstanceBuffer.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11RendererInstanceBuffer.cpp new file mode 100644 index 00000000..8ee0191e --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11RendererInstanceBuffer.cpp @@ -0,0 +1,278 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#include <RendererConfig.h> +#if defined(RENDERER_ENABLE_DIRECT3D11) + +#include "D3D11RendererInstanceBuffer.h" +#include <RendererInstanceBufferDesc.h> + +#if PX_WINDOWS +#include <task/PxTask.h> +#endif + +using namespace SampleRenderer; + +static D3D11_INPUT_ELEMENT_DESC buildVertexElement(LPCSTR name, UINT index, DXGI_FORMAT format, UINT inputSlot, UINT alignedByOffset, D3D11_INPUT_CLASSIFICATION inputSlotClass, UINT instanceDataStepRate) +{ + D3D11_INPUT_ELEMENT_DESC element; + element.SemanticName = name; + element.SemanticIndex = index; + element.Format = format; + element.InputSlot = inputSlot; + element.AlignedByteOffset = alignedByOffset; + element.InputSlotClass = inputSlotClass; + element.InstanceDataStepRate = instanceDataStepRate; + return element; +} + +static DXGI_FORMAT getD3DFormat(RendererInstanceBuffer::Format format) +{ + DXGI_FORMAT d3dFormat = DXGI_FORMAT_UNKNOWN; + switch (format) + { + case RendererInstanceBuffer::FORMAT_FLOAT1: + d3dFormat = DXGI_FORMAT_R32_FLOAT; + break; + case RendererInstanceBuffer::FORMAT_FLOAT2: + d3dFormat = DXGI_FORMAT_R32G32_FLOAT; + break; + case RendererInstanceBuffer::FORMAT_FLOAT3: + d3dFormat = DXGI_FORMAT_R32G32B32_FLOAT; + break; + case RendererInstanceBuffer::FORMAT_FLOAT4: + d3dFormat = DXGI_FORMAT_R32G32B32A32_FLOAT; + break; + } + RENDERER_ASSERT(d3dFormat != DXGI_FORMAT_UNKNOWN, "Invalid DIRECT3D11 vertex type."); + return d3dFormat; +} + +static void getD3DUsage(RendererInstanceBuffer::Semantic semantic, LPCSTR& usageName, PxU8& usageIndex) +{ + if (semantic >= RendererInstanceBuffer::SEMANTIC_POSITION && semantic < RendererInstanceBuffer::NUM_SEMANTICS) + { + usageName = "TEXCOORD"; + switch (semantic) + { + case RendererInstanceBuffer::SEMANTIC_POSITION: + usageIndex = RENDERER_INSTANCE_POSITION_CHANNEL; + break; + case RendererInstanceBuffer::SEMANTIC_NORMALX: + usageIndex = RENDERER_INSTANCE_NORMALX_CHANNEL; + break; + case RendererInstanceBuffer::SEMANTIC_NORMALY: + usageIndex = RENDERER_INSTANCE_NORMALY_CHANNEL; + break; + case RendererInstanceBuffer::SEMANTIC_NORMALZ: + usageIndex = RENDERER_INSTANCE_NORMALZ_CHANNEL; + break; + case RendererInstanceBuffer::SEMANTIC_VELOCITY_LIFE: + usageIndex = RENDERER_INSTANCE_VEL_LIFE_CHANNEL; + break; + case RendererInstanceBuffer::SEMANTIC_DENSITY: + usageIndex = RENDERER_INSTANCE_DENSITY_CHANNEL; + break; + case RendererInstanceBuffer::SEMANTIC_UV_OFFSET: + usageIndex = RENDERER_INSTANCE_UV_CHANNEL; + break; + case RendererInstanceBuffer::SEMANTIC_LOCAL_OFFSET: + usageIndex = RENDERER_INSTANCE_LOCAL_CHANNEL; + break; + } + } + else + { + RENDERER_ASSERT(false, "Invalid Direct3D11 instance usage."); + } +} + +D3D11RendererInstanceBuffer::D3D11RendererInstanceBuffer(ID3D11Device& d3dDevice, ID3D11DeviceContext& d3dDeviceContext, const RendererInstanceBufferDesc& desc, bool bUseMapForLocking) : + RendererInstanceBuffer(desc) + , m_d3dDevice(d3dDevice) + , m_d3dDeviceContext(d3dDeviceContext) + , m_d3dInstanceBuffer(NULL) + , m_bUseMapForLocking(bUseMapForLocking) + , m_buffer(NULL) +{ + memset(&m_d3dBufferDesc, 0, sizeof(D3D11_BUFFER_DESC)); + m_d3dBufferDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER; + m_d3dBufferDesc.ByteWidth = (UINT)(desc.maxInstances * m_stride); + + if (m_bUseMapForLocking) + { + m_d3dBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; + m_d3dBufferDesc.Usage = D3D11_USAGE_DYNAMIC; + } + else + { + m_d3dBufferDesc.CPUAccessFlags = 0; + m_d3dBufferDesc.Usage = D3D11_USAGE_DEFAULT; + m_buffer = new PxU8[m_d3dBufferDesc.ByteWidth]; + memset(m_buffer, 0, sizeof(PxU8)*m_d3dBufferDesc.ByteWidth); + } + + onDeviceReset(); + + if (m_d3dInstanceBuffer) + { + m_maxInstances = desc.maxInstances; + } +} + +D3D11RendererInstanceBuffer::~D3D11RendererInstanceBuffer(void) +{ + if (m_d3dInstanceBuffer) + { +#if PX_WINDOWS && PX_SUPPORT_GPU_PHYSX + if (m_interopContext && m_registeredInCUDA) + { + m_registeredInCUDA = !m_interopContext->unregisterResourceInCuda(m_InteropHandle); + } +#endif + m_d3dInstanceBuffer->Release(); + m_d3dInstanceBuffer = NULL; + } + + delete [] m_buffer; +} + +void D3D11RendererInstanceBuffer::addVertexElements(PxU32 streamIndex, std::vector<D3D11_INPUT_ELEMENT_DESC> &vertexElements) const +{ + for (PxU32 i = 0; i < NUM_SEMANTICS; i++) + { + Semantic semantic = (Semantic)i; + const SemanticDesc& sm = m_semanticDescs[semantic]; + if (sm.format < NUM_FORMATS) + { + PxU8 d3dUsageIndex = 0; + LPCSTR d3dUsageName = ""; + getD3DUsage(semantic, d3dUsageName, d3dUsageIndex); + vertexElements.push_back(buildVertexElement(d3dUsageName, + d3dUsageIndex, + getD3DFormat(sm.format), + streamIndex, + (UINT)sm.offset, + D3D11_INPUT_PER_INSTANCE_DATA, + 1)); + } + } +} + +void* D3D11RendererInstanceBuffer::lock(void) +{ + return internalLock(getHint() == HINT_STATIC ? D3D11_MAP_WRITE_DISCARD : D3D11_MAP_WRITE_NO_OVERWRITE); +} + +void* D3D11RendererInstanceBuffer::internalLock(D3D11_MAP MapType) +{ + void* lockedBuffer = 0; + if (m_d3dInstanceBuffer) + { + if (m_bUseMapForLocking) + { + D3D11_MAPPED_SUBRESOURCE mappedRead; + m_d3dDeviceContext.Map(m_d3dInstanceBuffer, 0, MapType, NULL, &mappedRead); + RENDERER_ASSERT(mappedRead.pData, "Failed to lock DIRECT3D11 Vertex Buffer."); + lockedBuffer = mappedRead.pData; + } + else + { + lockedBuffer = m_buffer; + } + } + return lockedBuffer; +} + +void D3D11RendererInstanceBuffer::unlock(void) +{ + if (m_d3dInstanceBuffer) + { + if (m_bUseMapForLocking) + { + m_d3dDeviceContext.Unmap(m_d3dInstanceBuffer, 0); + } + else + { + m_d3dDeviceContext.UpdateSubresource(m_d3dInstanceBuffer, 0, NULL, m_buffer, m_d3dBufferDesc.ByteWidth, 0); + } + } +} + +void D3D11RendererInstanceBuffer::bind(PxU32 streamID, PxU32 firstInstance) const +{ + if (m_d3dInstanceBuffer) + { + ID3D11Buffer* pBuffers[1] = { m_d3dInstanceBuffer }; + UINT strides[1] = { m_stride }; + UINT offsets[1] = { firstInstance* m_stride }; + m_d3dDeviceContext.IASetVertexBuffers(streamID, 1, pBuffers, strides, offsets); + } +} + +void D3D11RendererInstanceBuffer::unbind(PxU32 streamID) const +{ + ID3D11Buffer* pBuffers[1] = { NULL }; + UINT strides[1] = { 0 }; + UINT offsets[1] = { 0 }; + m_d3dDeviceContext.IASetVertexBuffers(streamID, 1, pBuffers, strides, offsets); +} + +void D3D11RendererInstanceBuffer::onDeviceLost(void) +{ +#if PX_WINDOWS && PX_SUPPORT_GPU_PHYSX + if (m_interopContext && m_registeredInCUDA) + { + PX_ASSERT(m_d3dInstanceBuffer); + m_interopContext->unregisterResourceInCuda(m_InteropHandle); + } + + m_registeredInCUDA = false; +#endif + if (m_d3dInstanceBuffer) + { + m_d3dInstanceBuffer->Release(); + m_d3dInstanceBuffer = 0; + } +} + +void D3D11RendererInstanceBuffer::onDeviceReset(void) +{ + if (!m_d3dInstanceBuffer) + { + m_d3dDevice.CreateBuffer(&m_d3dBufferDesc, NULL, &m_d3dInstanceBuffer); + RENDERER_ASSERT(m_d3dInstanceBuffer, "Failed to create DIRECT3D11 Vertex Buffer."); +#if PX_WINDOWS && PX_SUPPORT_GPU_PHYSX + if (m_interopContext && m_d3dInstanceBuffer && m_mustBeRegisteredInCUDA) + { + m_registeredInCUDA = m_interopContext->registerResourceInCudaD3D(m_InteropHandle, m_d3dInstanceBuffer); + } +#endif + } +} + +#endif // #if defined(RENDERER_ENABLE_DIRECT3D11) diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11RendererInstanceBuffer.h b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11RendererInstanceBuffer.h new file mode 100644 index 00000000..7180bfb5 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11RendererInstanceBuffer.h @@ -0,0 +1,74 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#ifndef D3D11_RENDERER_INSTANCEBUFFER_H +#define D3D11_RENDERER_INSTANCEBUFFER_H + +#include <RendererConfig.h> + +#if defined(RENDERER_ENABLE_DIRECT3D11) + +#include <RendererInstanceBuffer.h> +#include "D3D11Renderer.h" + +namespace SampleRenderer +{ + +class D3D11RendererInstanceBuffer : public RendererInstanceBuffer, public D3D11RendererResource +{ +public: + D3D11RendererInstanceBuffer(ID3D11Device& d3dDevice, ID3D11DeviceContext& d3dDeviceContext, const RendererInstanceBufferDesc& desc, bool bUseMapForLocking = FALSE); + virtual ~D3D11RendererInstanceBuffer(void); + + void addVertexElements(PxU32 streamIndex, std::vector<D3D11_INPUT_ELEMENT_DESC> &vertexElements) const; + +protected: + virtual void* lock(void); + virtual void unlock(void); + + virtual void bind(PxU32 streamID, PxU32 firstInstance) const; + virtual void unbind(PxU32 streamID) const; + +private: + virtual void onDeviceLost(void); + virtual void onDeviceReset(void); + + void *internalLock(D3D11_MAP MapType); + +private: + ID3D11Device& m_d3dDevice; + ID3D11DeviceContext& m_d3dDeviceContext; + ID3D11Buffer* m_d3dInstanceBuffer; + D3D11_BUFFER_DESC m_d3dBufferDesc; + + bool m_bUseMapForLocking; + PxU8* m_buffer; +}; + +} // namespace SampleRenderer + +#endif // #if defined(RENDERER_ENABLE_DIRECT3D11) +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11RendererMaterial.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11RendererMaterial.cpp new file mode 100644 index 00000000..70ccab14 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11RendererMaterial.cpp @@ -0,0 +1,729 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#include <RendererConfig.h> + +#if defined(RENDERER_ENABLE_DIRECT3D11) + +#include "D3D11RendererMaterial.h" + +#include <RendererMaterialDesc.h> + +#include "D3D11RendererVariableManager.h" +#include "D3D11RendererTexture2D.h" +#include "D3D11RendererMemoryMacros.h" +#include "D3D11RendererResourceManager.h" +#include "D3D11RendererUtils.h" +#include "D3D11RendererTraits.h" +#include "RendererMemoryMacros.h" + +#include <stdio.h> +#include <sstream> + +#include <PsUtilities.h> + +#if !defined PX_USE_DX11_PRECOMPILED_SHADERS +#define RENDERER_ENABLE_LAYOUT_PRECACHE 1 +#endif +static D3D_FEATURE_LEVEL gFeatureLevel = D3D_FEATURE_LEVEL_9_1; + +#if RENDERER_ENABLE_LAYOUT_PRECACHE + +static bool gBonePrecached = false; +static bool gStaticPrecached = false; + +/* Cache some sensible default input layouts */ +static D3D11_INPUT_ELEMENT_DESC inputDescStaticDiffuse[4] = +{{"POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0}, + {"NORMAL", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0}, + {"TANGENT", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0}, + {"TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0}}; + +static D3D11_INPUT_ELEMENT_DESC inputDescStaticDiffuseInstanced[10] = +{{"POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0}, + {"NORMAL", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0}, + {"TANGENT", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0}, + {"TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0}, + {"TEXCOORD", 8, DXGI_FORMAT_R32G32B32_FLOAT, 1, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 1}, + {"TEXCOORD", 9, DXGI_FORMAT_R32G32B32_FLOAT, 1, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_INSTANCE_DATA, 1}, + {"TEXCOORD", 10, DXGI_FORMAT_R32G32B32_FLOAT, 1, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_INSTANCE_DATA, 1}, + {"TEXCOORD", 11, DXGI_FORMAT_R32G32B32_FLOAT, 1, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_INSTANCE_DATA, 1}, + {"TEXCOORD", 12, DXGI_FORMAT_R32G32B32A32_FLOAT, 1, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_INSTANCE_DATA, 1}, + {"TEXCOORD", 13, DXGI_FORMAT_R32G32_FLOAT, 1, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_INSTANCE_DATA, 1}}; + +static D3D11_INPUT_ELEMENT_DESC inputDescBoneDiffuse0[3] = +{{"POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0}, + {"NORMAL", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0}, + {"TANGENT", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0}}; + +static D3D11_INPUT_ELEMENT_DESC inputDescBoneDiffuse1[5] = +{{"POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0}, + {"NORMAL", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0}, + {"TANGENT", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0}, + {"TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0}, + {"TEXCOORD", 6, DXGI_FORMAT_R16G16B16A16_UINT, 1, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0}}; + +static D3D11_INPUT_ELEMENT_DESC inputDescBoneDiffuse2[6] = +{{"COLOR", 0, DXGI_FORMAT_R8G8B8A8_UNORM, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0}, + {"TANGENT", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0}, + {"TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0}, + {"POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 1, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0}, + {"NORMAL", 0, DXGI_FORMAT_R32G32B32_FLOAT, 1, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0}, + {"TEXCOORD", 6, DXGI_FORMAT_R16G16B16A16_UINT, 2, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0}}; + +static D3D11_INPUT_ELEMENT_DESC inputDescBoneDiffuse3[4] = +{{"POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0}, + {"NORMAL", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0}, + {"TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0}, + {"TEXCOORD", 6, DXGI_FORMAT_R16G16B16A16_UINT, 1, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0}}; + +static D3D11_INPUT_ELEMENT_DESC inputDescBoneSimple[5] = +{{"COLOR", 0, DXGI_FORMAT_R8G8B8A8_UNORM, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0}, + {"TANGENT", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0}, + {"POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 1, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0}, + {"NORMAL", 0, DXGI_FORMAT_R32G32B32_FLOAT, 1, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0}, + {"TEXCOORD", 6, DXGI_FORMAT_R16G16B16A16_UINT, 2, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0}}; + +#endif + +using namespace SampleRenderer; + +static D3D11_BLEND getD3DBlend(RendererMaterial::BlendFunc func) +{ + D3D11_BLEND d3dBlend = D3D11_BLEND_ONE; + switch (func) + { + case RendererMaterial::BLEND_ZERO: + d3dBlend = D3D11_BLEND_ZERO; + break; + case RendererMaterial::BLEND_ONE: + d3dBlend = D3D11_BLEND_ONE; + break; + case RendererMaterial::BLEND_SRC_COLOR: + d3dBlend = D3D11_BLEND_SRC_COLOR; + break; + case RendererMaterial::BLEND_ONE_MINUS_SRC_COLOR: + d3dBlend = D3D11_BLEND_INV_SRC_COLOR; + break; + case RendererMaterial::BLEND_SRC_ALPHA: + d3dBlend = D3D11_BLEND_SRC_ALPHA; + break; + case RendererMaterial::BLEND_ONE_MINUS_SRC_ALPHA: + d3dBlend = D3D11_BLEND_INV_SRC_ALPHA; + break; + case RendererMaterial::BLEND_DST_ALPHA: + d3dBlend = D3D11_BLEND_DEST_ALPHA; + break; + case RendererMaterial::BLEND_ONE_MINUS_DST_ALPHA: + d3dBlend = D3D11_BLEND_INV_DEST_ALPHA; + break; + case RendererMaterial::BLEND_DST_COLOR: + d3dBlend = D3D11_BLEND_DEST_COLOR; + break; + case RendererMaterial::BLEND_ONE_MINUS_DST_COLOR: + d3dBlend = D3D11_BLEND_INV_DEST_COLOR; + break; + case RendererMaterial::BLEND_SRC_ALPHA_SATURATE: + d3dBlend = D3D11_BLEND_SRC_ALPHA_SAT; + break; + } + return d3dBlend; +} + +static D3D_SHADER_MACRO getD3DDefine(const D3D11_INPUT_ELEMENT_DESC& inputDesc) +{ +#define D3D_DEFINE_NAME(a) d3dDefine.Name = PX_STRINGIZE(PX_CONCAT(USE_,a)) +#define D3D_DEFINE_NAME_2(a,b) D3D_DEFINE_NAME(PX_CONCAT(a,b)) +#define D3D_CASE_INDEX_DEFINE_NAME_WITH_INDEX(a,b) case b: D3D_DEFINE_NAME_2(a,b); break; +#define D3D_DEFINE_NAME_WITH_INDEX(a,b) { \ + switch(b) { \ + D3D_CASE_INDEX_DEFINE_NAME_WITH_INDEX(a,0) \ + D3D_CASE_INDEX_DEFINE_NAME_WITH_INDEX(a,1) \ + D3D_CASE_INDEX_DEFINE_NAME_WITH_INDEX(a,2) \ + D3D_CASE_INDEX_DEFINE_NAME_WITH_INDEX(a,3) \ + D3D_CASE_INDEX_DEFINE_NAME_WITH_INDEX(a,4) \ + D3D_CASE_INDEX_DEFINE_NAME_WITH_INDEX(a,5) \ + D3D_CASE_INDEX_DEFINE_NAME_WITH_INDEX(a,6) \ + D3D_CASE_INDEX_DEFINE_NAME_WITH_INDEX(a,7) \ + D3D_CASE_INDEX_DEFINE_NAME_WITH_INDEX(a,8) \ + D3D_CASE_INDEX_DEFINE_NAME_WITH_INDEX(a,9) \ + D3D_CASE_INDEX_DEFINE_NAME_WITH_INDEX(a,10) \ + D3D_CASE_INDEX_DEFINE_NAME_WITH_INDEX(a,11) \ + D3D_CASE_INDEX_DEFINE_NAME_WITH_INDEX(a,12) \ + D3D_CASE_INDEX_DEFINE_NAME_WITH_INDEX(a,13) \ + D3D_CASE_INDEX_DEFINE_NAME_WITH_INDEX(a,14) \ + D3D_CASE_INDEX_DEFINE_NAME_WITH_INDEX(a,15) \ + D3D_CASE_INDEX_DEFINE_NAME_WITH_INDEX(a,16) \ + default: D3D_DEFINE_NAME(a); break; \ + }; \ +} \ + + D3D_SHADER_MACRO d3dDefine = {"DEFAULT", "1"}; + if (_stricmp(inputDesc.SemanticName, "TEXCOORD") == 0) D3D_DEFINE_NAME_WITH_INDEX(TEXCOORD, inputDesc.SemanticIndex) + else if (_stricmp(inputDesc.SemanticName, "TANGENT") == 0) D3D_DEFINE_NAME(TANGENT); + else if (_stricmp(inputDesc.SemanticName, "POSITION") == 0) D3D_DEFINE_NAME(POSITION); + else if (_stricmp(inputDesc.SemanticName, "NORMAL") == 0) D3D_DEFINE_NAME(NORMAL); + else if (_stricmp(inputDesc.SemanticName, "COLOR") == 0) D3D_DEFINE_NAME(COLOR); + else if (_stricmp(inputDesc.SemanticName, "BONE") == 0) D3D_DEFINE_NAME(BONE); + return d3dDefine; + +#undef D3D_DEFINE_NAME +#undef D3D_DEFINE_NAME_2 +#undef D3D_CASE_INDEX_DEFINE_NAME_WITH_INDEX +#undef D3D_DEFINE_NAME_WITH_INDEX +} + +static void getD3DDefines(const char* passName, std::vector<D3D10_SHADER_MACRO>& outputDefines) +{ + if(gFeatureLevel <= D3D_FEATURE_LEVEL_9_3) + { + const D3D_SHADER_MACRO psDefines[] = + { + "RENDERER_FRAGMENT", "1", + "RENDERER_D3D11", "1", +#if RENDERER_ENABLE_SINGLE_PASS_LIGHTING + "PASS_ALL_LIGHTS", "1", + RendererMaterial::getPassName((RendererMaterial::Pass)1), RENDERER_TEXT2(1), + RendererMaterial::getPassName((RendererMaterial::Pass)2), RENDERER_TEXT2(2), + RendererMaterial::getPassName((RendererMaterial::Pass)3), RENDERER_TEXT2(3), + RendererMaterial::getPassName((RendererMaterial::Pass)4), RENDERER_TEXT2(4), + "MAX_LIGHTS", RENDERER_TEXT2(RENDERER_MAX_LIGHTS), +#else + passName, "1", +#endif + "NO_SUPPORT_DDX_DDY", "1", + "ENABLE_VFACE", "0", + "ENABLE_VFACE_SCALE", "0", + "PX_WINDOWS", "1", + "ENABLE_SHADOWS", RENDERER_TEXT2(RENDERER_ENABLE_SHADOWS), + NULL, NULL + }; + + outputDefines.resize(PX_ARRAY_SIZE(psDefines)); + //memcpy(&outputDefines[0], psDefines, sizeof(psDefines)); + for (PxU32 i = 0; i < outputDefines.size(); ++i) + { + outputDefines[i] = psDefines[i]; + } + } + else + { + const D3D_SHADER_MACRO psDefines[] = + { + "RENDERER_FRAGMENT", "1", + "RENDERER_D3D11", "1", +#if RENDERER_ENABLE_SINGLE_PASS_LIGHTING + "PASS_ALL_LIGHTS", "1", + RendererMaterial::getPassName((RendererMaterial::Pass)1), RENDERER_TEXT2(1), + RendererMaterial::getPassName((RendererMaterial::Pass)2), RENDERER_TEXT2(2), + RendererMaterial::getPassName((RendererMaterial::Pass)3), RENDERER_TEXT2(3), + RendererMaterial::getPassName((RendererMaterial::Pass)4), RENDERER_TEXT2(4), + "MAX_LIGHTS", RENDERER_TEXT2(RENDERER_MAX_LIGHTS), +#else + passName, "1", +#endif + "ENABLE_VFACE", RENDERER_TEXT2(RENDERER_ENABLE_VFACE_SCALE), + "ENABLE_VFACE_SCALE", RENDERER_TEXT2(RENDERER_ENABLE_VFACE_SCALE), + "PX_WINDOWS", "1", + "ENABLE_SHADOWS", RENDERER_TEXT2(RENDERER_ENABLE_SHADOWS), + NULL, NULL + }; + + outputDefines.resize(PX_ARRAY_SIZE(psDefines)); + //memcpy(&outputDefines[0], psDefines, sizeof(psDefines)); + for (PxU32 i = 0; i < outputDefines.size(); ++i) + { + outputDefines[i] = psDefines[i]; + } + } +} + +static const char* boolToString(bool bTrue) +{ + return bTrue ? "1" : "0"; +} + +/* +static const bool hasDisplacementSemantic(const D3D11_INPUT_ELEMENT_DESC* inputDesc, PxU32 numInputDescs) +{ + // If no input semantics were specified, enable it by default + if (NULL == inputDesc || numInputDescs == 0) + return true; + + for (PxU32 i = 0; i < numInputDescs; ++i) + { + if (strcmp(inputDesc[i].SemanticName, "TEXCOORD") == 0 && + (inputDesc[i].SemanticIndex == RENDERER_DISPLACEMENT_CHANNEL || + inputDesc[i].SemanticIndex == RENDERER_DISPLACEMENT_FLAGS_CHANNEL)) + return true; + } + return false; +} +*/ + +static void getD3DDefines(const D3D11_INPUT_ELEMENT_DESC* inputDesc, PxU32 numInputDescs, bool bTessellationEnabled, bool bInstanced, std::vector<D3D10_SHADER_MACRO>& outputDefines) +{ + PxU32 i = 0; + static const D3D_SHADER_MACRO allVsDefine = { "USE_ALL", "1" }; + static const D3D_SHADER_MACRO nullVsDefine = { NULL, NULL }; + + if(gFeatureLevel <= D3D_FEATURE_LEVEL_9_3) + { + const D3D_SHADER_MACRO baseVsDefines[] = + { + "RENDERER_VERTEX", "1", + "RENDERER_D3D11", "1", + "PX_WINDOWS", "1", + "RENDERER_INSTANCED", "0", + "RENDERER_DISPLACED", "0", + "ENABLE_VFACE", "0", + "ENABLE_VFACE_SCALE", "0", + "ENABLE_TESSELLATION", "0", + "ADAPTIVE_TESSELLATION", "0", + "SEMANTIC_TANGENT", "TANGENT", // This will prevent mapping tangent to texcoord5 and instead to the proper TANGENT semantic + }; + const int numBaseVsDefines = PX_ARRAY_SIZE(baseVsDefines); + + // Each input element description adds a define + if (inputDesc && numInputDescs > 0) outputDefines.resize(numBaseVsDefines + numInputDescs + 1); + // If there are no input element descriptions, we simply add a "USE_ALL" define + else outputDefines.resize(numBaseVsDefines + 2); + + for (; i < numBaseVsDefines; ++i) + { + outputDefines[i] = baseVsDefines[i]; + } + } + else + { + const D3D_SHADER_MACRO baseVsDefines[] = + { + "RENDERER_VERTEX", "1", + "RENDERER_D3D11", "1", + "PX_WINDOWS", "1", + "RENDERER_INSTANCED", boolToString(bInstanced), + "RENDERER_DISPLACED", boolToString(bTessellationEnabled),// && hasDisplacementSemantic(inputDesc, numInputDescs)), + "ENABLE_VFACE", RENDERER_TEXT2(RENDERER_ENABLE_VFACE_SCALE), + "ENABLE_VFACE_SCALE", RENDERER_TEXT2(RENDERER_ENABLE_VFACE_SCALE), + "ENABLE_TESSELLATION", boolToString(bTessellationEnabled), + "ADAPTIVE_TESSELLATION", boolToString(bTessellationEnabled), + "SEMANTIC_TANGENT", "TANGENT", // This will prevent mapping tangent to texcoord5 and instead to the proper TANGENT semantic + }; + const int numBaseVsDefines = PX_ARRAY_SIZE(baseVsDefines); + + // Each input element description adds a define + if (inputDesc && numInputDescs > 0) outputDefines.resize(numBaseVsDefines + numInputDescs + 1); + // If there are no input element descriptions, we simply add a "USE_ALL" define + else outputDefines.resize(numBaseVsDefines + 2); + + for (; i < numBaseVsDefines; ++i) + { + outputDefines[i] = baseVsDefines[i]; + } + } + + // If input element descriptions were provided, add the appropriate shader defines + if (inputDesc && numInputDescs > 0) + { + for (PxU32 j = 0; j < numInputDescs; ++j) + { + if (inputDesc[j].SemanticName) + outputDefines[i++] = getD3DDefine(inputDesc[j]); + } + } + // Otherwise add the default USE_ALL define + else + { + outputDefines[i++] = allVsDefine; + } + + outputDefines[i] = nullVsDefine; +} + +D3D11RendererMaterial::D3D11RendererMaterial(D3D11Renderer& renderer, const RendererMaterialDesc& desc) : + RendererMaterial(desc, renderer.getEnableMaterialCaching()), + m_renderer(renderer), + m_blendState(NULL), + m_vertexShader(NULL), + m_instancedVertexShader(NULL), + m_geometryShader(NULL), + m_hullShader(NULL), + m_domainShader(NULL) +{ + gFeatureLevel = m_renderer.getFeatureLevel(); + memset(m_fragmentPrograms, 0, sizeof(m_fragmentPrograms)); + + if (m_renderer.getD3DDevice()) + { + if (getBlending()) loadBlending(desc); + loadShaders(desc); + } +} + +D3D11RendererMaterial::~D3D11RendererMaterial(void) +{ + dxSafeRelease(m_blendState); + m_renderer.getVariableManager()->unloadVariables(this); + +} + +void D3D11RendererMaterial::setModelMatrix(const float* matrix) +{ + m_renderer.getVariableManager()->setSharedVariable("cbMesh", "g_modelMatrix", matrix); + bindMeshState(false); +} + +void D3D11RendererMaterial::bind(RendererMaterial::Pass pass, RendererMaterialInstance* materialInstance, bool instanced) const +{ + RENDERER_ASSERT(pass < NUM_PASSES, "Invalid Material Pass."); + if (m_renderer.getD3DDeviceContext() && pass < NUM_PASSES) + { + m_renderer.bind(materialInstance); + RendererMaterial::bind(pass, materialInstance, instanced); + setVariables(pass); + setBlending(pass); + setShaders(instanced, pass); + } +} + +void D3D11RendererMaterial::bindMeshState(bool instanced) const +{ + m_renderer.getVariableManager()->bind(this, D3DTypes::SHADER_VERTEX); + if (m_geometryShader) m_renderer.getVariableManager()->bind(this, D3DTypes::SHADER_GEOMETRY); + if (m_hullShader) m_renderer.getVariableManager()->bind(this, D3DTypes::SHADER_HULL); + if (m_domainShader) m_renderer.getVariableManager()->bind(this, D3DTypes::SHADER_DOMAIN); +} + +// This may not be the best place for this, but it works just fine +static ID3D11BlendState* gBlendState = NULL; +static FLOAT gBlendFactor[4] = {0., 0., 0., 0.}; +static UINT gBlendMask = 0; + +void D3D11RendererMaterial::unbind(void) const +{ + ID3D11DeviceContext* d3dDeviceContext = m_renderer.getD3DDeviceContext(); + if (d3dDeviceContext) + { + // Only reset the blend state if it was changed + if (getBlending() && m_blendState) + { + m_renderer.popState(D3D11Renderer::STATE_DEPTHSTENCIL); + d3dDeviceContext->OMSetBlendState(gBlendState, gBlendFactor, gBlendMask); + dxSafeRelease(gBlendState); + } + d3dDeviceContext->VSSetShader(NULL, NULL, 0); + d3dDeviceContext->PSSetShader(NULL, NULL, 0); + d3dDeviceContext->GSSetShader(NULL, NULL, 0); + d3dDeviceContext->HSSetShader(NULL, NULL, 0); + d3dDeviceContext->DSSetShader(NULL, NULL, 0); + } +} + +void D3D11RendererMaterial::bindVariable(Pass pass, const Variable& variable, const void* data) const +{ + D3D11Variable& var = *(D3D11Variable*)&variable; + var.bind(pass, data); +} + +void D3D11RendererMaterial::setBlending(RendererMaterial::Pass pass) const +{ + if (getBlending() && m_blendState) + { + m_renderer.pushState(D3D11Renderer::STATE_DEPTHSTENCIL); + m_renderer.setDepthStencilState(D3D11Renderer::DEPTHSTENCIL_TRANSPARENT); + + m_renderer.getD3DDeviceContext()->OMGetBlendState(&gBlendState, gBlendFactor, &gBlendMask); + m_renderer.getD3DDeviceContext()->OMSetBlendState(m_blendState, NULL, 0xffffffff); + } +} + +void D3D11RendererMaterial::setShaders(bool instanced, RendererMaterial::Pass pass) const +{ + m_renderer.getD3DDeviceContext()->VSSetShader(getVS(instanced), NULL, 0); + m_renderer.getD3DDeviceContext()->PSSetShader(getPS(pass), NULL, 0); + m_renderer.getD3DDeviceContext()->GSSetShader(getGS(), NULL, 0); + m_renderer.getD3DDeviceContext()->HSSetShader(getHS(), NULL, 0); + m_renderer.getD3DDeviceContext()->DSSetShader(getDS(), NULL, 0); +} + +void D3D11RendererMaterial::setVariables(RendererMaterial::Pass pass) const +{ + m_renderer.getVariableManager()->bind(this, D3DTypes::SHADER_PIXEL, pass); +} + +bool D3D11RendererMaterial::tessellationEnabled() const +{ + return m_renderer.tessellationEnabled() && tessellationSupported(); +} + +bool SampleRenderer::D3D11RendererMaterial::tessellationInitialized() const +{ + return (NULL != m_hullShader) && (NULL != m_domainShader); +} + +bool D3D11RendererMaterial::tessellationSupported() const +{ + return m_renderer.isTessellationSupported() && + !m_shaderNames[D3DTypes::SHADER_DOMAIN].empty() && + !m_shaderNames[D3DTypes::SHADER_HULL].empty(); +} + +bool D3D11RendererMaterial::geometryEnabled() const +{ + return m_renderer.getFeatureLevel() >= D3D_FEATURE_LEVEL_10_0 && + !m_shaderNames[D3DTypes::SHADER_GEOMETRY].empty(); +} + +bool D3D11RendererMaterial::geometryInitialized() const +{ + return NULL != m_geometryShader; +} + +void D3D11RendererMaterial::loadBlending(const RendererMaterialDesc& desc) +{ + D3D11_BLEND_DESC blendDesc; + memset(&blendDesc, 0, sizeof(blendDesc)); + blendDesc.AlphaToCoverageEnable = m_renderer.multisamplingEnabled(); + blendDesc.IndependentBlendEnable = FALSE; + blendDesc.RenderTarget[0].BlendEnable = getBlending(); + blendDesc.RenderTarget[0].SrcBlend = getD3DBlend(getSrcBlendFunc()); + blendDesc.RenderTarget[0].DestBlend = getD3DBlend(getDstBlendFunc()); + blendDesc.RenderTarget[0].BlendOp = D3D11_BLEND_OP_ADD; + blendDesc.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_ONE; + blendDesc.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_ZERO; + blendDesc.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD; + blendDesc.RenderTarget[0].RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL; + m_renderer.getD3DDevice()->CreateBlendState(&blendDesc, &m_blendState); + RENDERER_ASSERT(m_blendState, "Failed to create blend state."); +} + +void D3D11RendererMaterial::loadShaders(const RendererMaterialDesc& desc) +{ + HRESULT result = S_OK; + +#ifdef PX_USE_DX11_PRECOMPILED_SHADERS + if(gFeatureLevel < D3D_FEATURE_LEVEL_11_0) + { + m_shaderPaths[D3DTypes::SHADER_VERTEX] = std::string(m_renderer.getAssetDir()) + "compiledshaders/dx11feature9/" + desc.vertexShaderPath + ".cso"; + m_shaderNames[D3DTypes::SHADER_VERTEX] = std::string(desc.vertexShaderPath) + ".cso"; + m_shaderPaths[D3DTypes::SHADER_PIXEL] = std::string(m_renderer.getAssetDir()) + "compiledshaders/dx11feature9/" + desc.fragmentShaderPath; + m_shaderNames[D3DTypes::SHADER_PIXEL] = std::string(desc.fragmentShaderPath); + } + else + { + m_shaderPaths[D3DTypes::SHADER_VERTEX] = std::string(m_renderer.getAssetDir()) + "compiledshaders/dx11feature11/" + desc.vertexShaderPath + ".cso"; + m_shaderNames[D3DTypes::SHADER_VERTEX] = std::string(desc.vertexShaderPath) + ".cso"; + m_shaderPaths[D3DTypes::SHADER_PIXEL] = std::string(m_renderer.getAssetDir()) + "compiledshaders/dx11feature11/" + desc.fragmentShaderPath; + m_shaderNames[D3DTypes::SHADER_PIXEL] = std::string(desc.fragmentShaderPath); + + if (desc.geometryShaderPath) + { + m_shaderPaths[D3DTypes::SHADER_GEOMETRY] = std::string(m_renderer.getAssetDir()) + "compiledshaders/dx11feature11/" + desc.geometryShaderPath; + m_shaderNames[D3DTypes::SHADER_GEOMETRY] = desc.geometryShaderPath; + } + if (desc.hullShaderPath) + { + m_shaderPaths[D3DTypes::SHADER_HULL] = std::string(m_renderer.getAssetDir()) + "compiledshaders/dx11feature11/" + desc.hullShaderPath; + m_shaderNames[D3DTypes::SHADER_HULL] = desc.hullShaderPath; + } + if (desc.domainShaderPath) + { + m_shaderPaths[D3DTypes::SHADER_DOMAIN] = std::string(m_renderer.getAssetDir()) + "compiledshaders/dx11feature11/" + desc.domainShaderPath; + m_shaderNames[D3DTypes::SHADER_DOMAIN] = desc.domainShaderPath; + } + + } +#else + m_shaderPaths[D3DTypes::SHADER_VERTEX] = std::string(m_renderer.getAssetDir()) + "shaders/" + desc.vertexShaderPath; + m_shaderNames[D3DTypes::SHADER_VERTEX] = desc.vertexShaderPath; + m_shaderPaths[D3DTypes::SHADER_PIXEL] = std::string(m_renderer.getAssetDir()) + "shaders/" + desc.fragmentShaderPath; + m_shaderNames[D3DTypes::SHADER_PIXEL] = desc.fragmentShaderPath; + if (desc.geometryShaderPath) + { + m_shaderPaths[D3DTypes::SHADER_GEOMETRY] = std::string(m_renderer.getAssetDir()) + "shaders/" + desc.geometryShaderPath; + m_shaderNames[D3DTypes::SHADER_GEOMETRY] = desc.geometryShaderPath; + } + if (desc.hullShaderPath) + { + m_shaderPaths[D3DTypes::SHADER_HULL] = std::string(m_renderer.getAssetDir()) + "shaders/" + desc.hullShaderPath; + m_shaderNames[D3DTypes::SHADER_HULL] = desc.hullShaderPath; + } + if (desc.domainShaderPath) + { + m_shaderPaths[D3DTypes::SHADER_DOMAIN] = std::string(m_renderer.getAssetDir()) + "shaders/" + desc.domainShaderPath; + m_shaderNames[D3DTypes::SHADER_DOMAIN] = desc.domainShaderPath; + } +#endif + + ID3DBlob* pShaderBlob = NULL; + + D3D11ShaderLoader loader(m_renderer); + std::vector<D3D_SHADER_MACRO> vsDefines; + std::vector<D3D_SHADER_MACRO> psDefines; + + // Load vertex shader + getD3DDefines(NULL, 0, tessellationSupported(), false, vsDefines); + D3DTraits<ID3D11VertexShader>::key_type vsKey(0xffffff, m_shaderNames[D3DTypes::SHADER_VERTEX]); + result = loader.load<ID3D11VertexShader>(vsKey, getPath(D3DTypes::SHADER_VERTEX), &vsDefines[0], &m_vertexShader, &pShaderBlob); + if (SUCCEEDED(result)) m_renderer.getVariableManager()->loadVariables(this, pShaderBlob, D3DTypes::SHADER_VERTEX); + + // Load pixel shadders for each pass + for (PxU32 i = 0; i < NUM_PASSES; i++) + { + if (SUCCEEDED(result)) + { + getD3DDefines(getPassName(Pass(i)), psDefines); + std::string shaderName = m_shaderNames[D3DTypes::SHADER_PIXEL]; + const char* pixelShaderPath = getPath(D3DTypes::SHADER_PIXEL); +#ifdef PX_USE_DX11_PRECOMPILED_SHADERS + shaderName += std::string(".") + (getPassName(Pass(i))) + ".cso"; + char shaderPathCompiled[MAX_PATH]; + strcpy(shaderPathCompiled,pixelShaderPath); + strcat(shaderPathCompiled,"."); + strcat(shaderPathCompiled,getPassName(Pass(i))); + strcat(shaderPathCompiled,".cso"); + pixelShaderPath = shaderPathCompiled; +#endif + D3DTraits<ID3D11PixelShader>::key_type psKey(i, shaderName); + result = loader.load<ID3D11PixelShader>(psKey, pixelShaderPath, &psDefines[0], &m_fragmentPrograms[i], &pShaderBlob, true); + if (SUCCEEDED(result)) m_renderer.getVariableManager()->loadVariables(this, pShaderBlob, D3DTypes::SHADER_PIXEL, (Pass)i); + } + } + + // Load geometry shader + if (SUCCEEDED(result) && geometryEnabled()) + { + D3DTraits<ID3D11GeometryShader>::key_type gsKey(m_shaderNames[D3DTypes::SHADER_GEOMETRY]); + result = loader.load<ID3D11GeometryShader>(gsKey, getPath(D3DTypes::SHADER_GEOMETRY), &vsDefines[0], &m_geometryShader, &pShaderBlob); + if (SUCCEEDED(result)) m_renderer.getVariableManager()->loadVariables(this, pShaderBlob, D3DTypes::SHADER_GEOMETRY); + } + + // Load hull shader + if (SUCCEEDED(result) && tessellationSupported()) + { + D3DTraits<ID3D11HullShader>::key_type hsKey(0xffffff, m_shaderNames[D3DTypes::SHADER_HULL]); + result = loader.load<ID3D11HullShader>(hsKey, getPath(D3DTypes::SHADER_HULL), &vsDefines[0], &m_hullShader, &pShaderBlob); + if (SUCCEEDED(result)) m_renderer.getVariableManager()->loadVariables(this, pShaderBlob, D3DTypes::SHADER_HULL); + } + + // Load domain shader + if (SUCCEEDED(result) && tessellationSupported()) + { + D3DTraits<ID3D11DomainShader>::key_type dsKey(0xffffff, m_shaderNames[D3DTypes::SHADER_DOMAIN]); + result = loader.load<ID3D11DomainShader>(dsKey, getPath(D3DTypes::SHADER_DOMAIN), &vsDefines[0], &m_domainShader, &pShaderBlob); + if (SUCCEEDED(result)) m_renderer.getVariableManager()->loadVariables(this, pShaderBlob, D3DTypes::SHADER_DOMAIN); + } + +#if RENDERER_ENABLE_LAYOUT_PRECACHE +#define CACHE_VS(desc, instanced) cacheVS(desc, ARRAYSIZE(desc), D3DX11::getInputHash(desc, ARRAYSIZE(desc)), instanced) + + if (!gStaticPrecached && !strcmp(desc.vertexShaderPath, "vertex/staticmesh.cg")) + { + gStaticPrecached = true; + CACHE_VS(inputDescStaticDiffuse, false); + CACHE_VS(inputDescStaticDiffuseInstanced, true); + } + if (!gBonePrecached && !strcmp(desc.vertexShaderPath, "vertex/skeletalmesh_1bone.cg")) + { + gBonePrecached = true; + CACHE_VS(inputDescBoneDiffuse0, false); + CACHE_VS(inputDescBoneDiffuse1, false); + CACHE_VS(inputDescBoneDiffuse2, false); + CACHE_VS(inputDescBoneDiffuse3, false); + CACHE_VS(inputDescBoneSimple, false); + } +#undef CACHE_VS +#endif // RENDERER_ENABLE_LAYOUT_PRECACHE +} + +std::string D3D11RendererMaterial::getShaderNameFromInputLayout(const D3D11_INPUT_ELEMENT_DESC* inputDesc,PxU32 numInputDescs, const std::string& shaderName) const +{ + std::string outString = shaderName; + +#ifdef PX_USE_DX11_PRECOMPILED_SHADERS + // rename + if(inputDesc && numInputDescs > 0) + { + PX_ASSERT(outString.size() > 4); + outString.resize(outString.length()-4); + for (PxU32 i = 0; i < numInputDescs; i++) + { + if (inputDesc[i].SemanticName) + { + outString += "_"; + outString += &getD3DDefine(inputDesc[i]).Name[4]; + } + } + outString += ".cso"; + } +#endif + + return outString; +} + +ID3DBlob* D3D11RendererMaterial::getVSBlob(const D3D11_INPUT_ELEMENT_DESC* inputDesc, PxU32 numInputDescs, PxU64 inputDescHash, bool bInstanced) const +{ + D3D11ShaderCacher cacher(m_renderer.getResourceManager()); + D3DTraits<ID3D11VertexShader>::value_type vsValue; + if (!cacher.check<ID3D11VertexShader>(std::make_pair(inputDescHash,getShaderNameFromInputLayout(inputDesc,numInputDescs,m_shaderNames[D3DTypes::SHADER_VERTEX])), vsValue.first, vsValue.second)) + { + cacheVS(inputDesc, numInputDescs, inputDescHash, bInstanced, &vsValue.first, &vsValue.second); + } + + // In the event we had to create a new shader for the given input layout, + // we'll need to assign it as the current shader + ID3D11VertexShader*& currentShader = bInstanced ? m_instancedVertexShader : m_vertexShader; + if (currentShader != vsValue.first) + { + currentShader = vsValue.first; + m_renderer.getD3DDeviceContext()->VSSetShader(currentShader, NULL, 0); + } + + return vsValue.second; +} + +ID3DBlob* D3D11RendererMaterial::getVSBlob(const std::vector<D3D11_INPUT_ELEMENT_DESC>& inputDesc, PxU64 inputDescHash, bool bInstanced) const +{ + return getVSBlob(&inputDesc[0], (UINT)inputDesc.size(), inputDescHash, bInstanced); +} + +void D3D11RendererMaterial::cacheVS(const D3D11_INPUT_ELEMENT_DESC* inputDesc, PxU32 numInputDescs, PxU64 inputDescHash, bool bInstanced, ID3D11VertexShader** ppShader, ID3DBlob** ppBlob) const +{ + std::vector<D3D10_SHADER_MACRO> defines; + getD3DDefines(inputDesc, numInputDescs, tessellationSupported(), bInstanced, defines); + + D3DTraits<ID3D11VertexShader>::key_type vsKey(inputDescHash, getShaderNameFromInputLayout(inputDesc,numInputDescs, m_shaderNames[D3DTypes::SHADER_VERTEX])); + + D3D11ShaderLoader loader(m_renderer); + if (FAILED(loader.load<ID3D11VertexShader>(vsKey, getShaderNameFromInputLayout(inputDesc,numInputDescs,getPath(D3DTypes::SHADER_VERTEX)).c_str(), &defines[0], ppShader, ppBlob, false))) + { + RENDERER_ASSERT(0, "Error loading D3D11 layout signature."); + } +} + +#endif + diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11RendererMaterial.h b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11RendererMaterial.h new file mode 100644 index 00000000..c32b3c3f --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11RendererMaterial.h @@ -0,0 +1,125 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#ifndef D3D11_RENDERER_MATERIAL_H +#define D3D11_RENDERER_MATERIAL_H + +#include <RendererConfig.h> + +#if defined(RENDERER_ENABLE_DIRECT3D11) + +#include <RendererMaterial.h> + +#include "D3D11Renderer.h" +#include "D3D11RendererTraits.h" +#include "D3Dcompiler.h" + +namespace SampleRenderer +{ + +class D3D11Renderer; + +class D3D11RendererMaterial : public RendererMaterial +{ + friend class D3D11Renderer; + friend class D3D11RendererMesh; + friend class D3D11RendererVariableManager; + + typedef RendererMaterial::Variable Variable; + +public: + D3D11RendererMaterial(D3D11Renderer& renderer, const RendererMaterialDesc& desc); + virtual ~D3D11RendererMaterial(void); + virtual void setModelMatrix(const float* matrix); + + bool tessellationEnabled() const; + bool tessellationInitialized() const; + bool tessellationSupported() const; + + bool geometryEnabled() const; + bool geometryInitialized() const; + +private: + virtual const Renderer& getRenderer() const { return m_renderer; } + virtual void bind(RendererMaterial::Pass pass, RendererMaterialInstance* materialInstance, bool instanced) const; + virtual void bindMeshState(bool instanced) const; + virtual void unbind(void) const; + virtual void bindVariable(Pass pass, const Variable& variable, const void* data) const; + +private: + typedef RendererMaterial::Variable D3D11BaseVariable; + class D3D11Variable : public D3D11BaseVariable + { + public: + D3D11Variable(const char* name, RendererMaterial::VariableType type, PxU32 offset) + : Variable(name, type, offset) { } + virtual void bind(RendererMaterial::Pass pass, const void* data) = 0; + }; + +private: + D3D11RendererMaterial& operator=(const D3D11RendererMaterial&) { return *this;} + + ID3D11VertexShader* getVS(bool bInstanced) const { return bInstanced ? m_instancedVertexShader : m_vertexShader; } + ID3D11PixelShader* getPS(RendererMaterial::Pass pass) const { return m_fragmentPrograms[pass]; } + ID3D11GeometryShader* getGS() const { return geometryEnabled() ? m_geometryShader : NULL; } + ID3D11HullShader* getHS() const { return tessellationEnabled() ? m_hullShader : NULL; } + ID3D11DomainShader* getDS() const { return tessellationEnabled() ? m_domainShader : NULL; } + + ID3DBlob* getVSBlob(const std::vector<D3D11_INPUT_ELEMENT_DESC>& inputDesc, PxU64 inputDescHash, bool bInstanced) const; + ID3DBlob* getVSBlob(const D3D11_INPUT_ELEMENT_DESC* inputDesc, PxU32 numInputDescs, PxU64 inputDescHash, bool bInstanced) const; + + const char* getPath(const D3DType type) const { return m_shaderPaths[type].c_str(); } + + void cacheVS(const D3D11_INPUT_ELEMENT_DESC* inputDesc, PxU32 numInputDescs, PxU64 inputDescHash, bool bInstanced, ID3D11VertexShader** ppShader = NULL, ID3DBlob** ppBlob = NULL) const; + std::string getShaderNameFromInputLayout(const D3D11_INPUT_ELEMENT_DESC* inputDesc, PxU32 numInputDescs,const std::string& shaderName) const; + + void setVariables(RendererMaterial::Pass pass) const; + void setBlending(RendererMaterial::Pass pass) const; + void setShaders(bool bInstanced, RendererMaterial::Pass pass) const; + + void loadBlending(const RendererMaterialDesc& desc); + void loadShaders(const RendererMaterialDesc& desc); + +private: + D3D11Renderer& m_renderer; + + ID3D11BlendState* m_blendState; + + mutable ID3D11VertexShader* m_vertexShader; + mutable ID3D11VertexShader* m_instancedVertexShader; + ID3D11GeometryShader* m_geometryShader; + ID3D11HullShader* m_hullShader; + ID3D11DomainShader* m_domainShader; + ID3D11PixelShader* m_fragmentPrograms[NUM_PASSES]; + + std::string m_shaderNames[D3DTypes::NUM_SHADER_TYPES]; + std::string m_shaderPaths[D3DTypes::NUM_SHADER_TYPES]; +}; + +} // namespace SampleRenderer + +#endif // #if defined(RENDERER_ENABLE_DIRECT3D11) +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11RendererMemoryMacros.h b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11RendererMemoryMacros.h new file mode 100644 index 00000000..29640f6b --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11RendererMemoryMacros.h @@ -0,0 +1,61 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#ifndef D3D11_RENDERER_MEMORY_MACROS_H +#define D3D11_RENDERER_MEMORY_MACROS_H + +namespace SampleRenderer +{ + +template<class T> +PX_INLINE void dxSafeRelease( T*& t ) { if(t) { t->Release(); t = NULL; } } + +template<class T> +PX_INLINE void deleteSafe( T*& t ) { if(t) { delete t; t = NULL; } } + +template<class T> +PX_INLINE bool deleteAndReturnTrue( T& t ) { deleteSafe(t); return true; } + +template<class T> +PX_INLINE bool dxReleaseAndReturnTrue( T& t ) { dxSafeRelease(t); return true; } + +template<class T> +PX_INLINE void deleteAll( T& t ) { std::remove_if(t.begin(), t.end(), deleteAndReturnTrue<typename T::value_type>); }; + +template<class T> +PX_INLINE void dxSafeReleaseAll( T& t ) { std::remove_if(t.begin(), t.end(), dxReleaseAndReturnTrue<typename T::value_type>); }; + +template<class T> +PX_INLINE void resizeIfSmallerThan( T& t, typename T::size_type s, typename T::value_type v = typename T::value_type() ) +{ + if (s > t.size()) + t.resize(s, v); +} + +} + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11RendererMesh.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11RendererMesh.cpp new file mode 100644 index 00000000..493b9850 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11RendererMesh.cpp @@ -0,0 +1,291 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#include <RendererConfig.h> + +#if defined(RENDERER_ENABLE_DIRECT3D11) + +#include "D3D11RendererMesh.h" +#include "D3D11RendererVertexBuffer.h" +#include "D3D11RendererInstanceBuffer.h" +#include "D3D11RendererMemoryMacros.h" +#include "D3D11RendererMaterial.h" +#include "D3D11RendererUtils.h" +#include "D3D11RendererResourceManager.h" +#include "D3D11RendererVariableManager.h" + +#include <RendererMeshDesc.h> + +#include <SamplePlatform.h> + +#pragma warning(disable:4702 4189) + +using namespace SampleRenderer; + +D3D11RendererMesh::D3D11RendererMesh(D3D11Renderer& renderer, const RendererMeshDesc& desc) : + RendererMesh(desc), + m_renderer(renderer), + m_inputHash(0), + m_instancedInputHash(0), + m_bPopStates(false), +#ifdef PX_USE_DX11_PRECOMPILED_SHADERS + m_spriteShaderPath(std::string(m_renderer.getAssetDir())+"compiledshaders/dx11feature11/geometry/pointsprite.cg.cso") +#else + m_spriteShaderPath(std::string(m_renderer.getAssetDir())+"shaders/vertex/pointsprite.cg") +#endif +{ + ID3D11Device* d3dDevice = m_renderer.getD3DDevice(); + RENDERER_ASSERT(d3dDevice, "Renderer's D3D Device not found!"); + if (d3dDevice) + { + PxU32 numVertexBuffers = getNumVertexBuffers(); + const RendererVertexBuffer* const* vertexBuffers = getVertexBuffers(); + + for (PxU32 i = 0; i < numVertexBuffers; i++) + { + const RendererVertexBuffer* vb = vertexBuffers[i]; + if (vb) + { + const D3D11RendererVertexBuffer& d3dVb = *static_cast<const D3D11RendererVertexBuffer*>(vb); + d3dVb.addVertexElements(i, m_inputDescriptions); + } + } + m_inputHash = D3DX11::getInputHash(m_inputDescriptions); + + m_instancedInputDescriptions = m_inputDescriptions; + if (m_instanceBuffer) + { + static_cast<const D3D11RendererInstanceBuffer*>(m_instanceBuffer)->addVertexElements(numVertexBuffers, m_instancedInputDescriptions); + m_instancedInputHash = D3DX11::getInputHash(m_instancedInputDescriptions); + } + else + { + m_instancedInputHash = m_inputHash; + } + } +} + +D3D11RendererMesh::~D3D11RendererMesh(void) +{ + +} + +static D3D_PRIMITIVE_TOPOLOGY getD3DPrimitive(const RendererMesh::Primitive& primitive, bool bTessellationEnabled) +{ + D3D_PRIMITIVE_TOPOLOGY d3dPrimitive = D3D_PRIMITIVE_TOPOLOGY_UNDEFINED; + switch (primitive) + { + case RendererMesh::PRIMITIVE_POINTS: + d3dPrimitive = D3D_PRIMITIVE_TOPOLOGY_POINTLIST; + break; + case RendererMesh::PRIMITIVE_LINES: + d3dPrimitive = D3D_PRIMITIVE_TOPOLOGY_LINELIST; + break; + case RendererMesh::PRIMITIVE_LINE_STRIP: + d3dPrimitive = D3D_PRIMITIVE_TOPOLOGY_LINESTRIP; + break; + case RendererMesh::PRIMITIVE_TRIANGLES: + d3dPrimitive = bTessellationEnabled ? D3D11_PRIMITIVE_TOPOLOGY_3_CONTROL_POINT_PATCHLIST : D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST; + break; + case RendererMesh::PRIMITIVE_TRIANGLE_STRIP: + d3dPrimitive = bTessellationEnabled ? D3D11_PRIMITIVE_TOPOLOGY_3_CONTROL_POINT_PATCHLIST : D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP; + break; + case RendererMesh::PRIMITIVE_POINT_SPRITES: + d3dPrimitive = D3D_PRIMITIVE_TOPOLOGY_POINTLIST; + break; + } + RENDERER_ASSERT(d3dPrimitive != D3D_PRIMITIVE_TOPOLOGY_UNDEFINED, "Unable to find DIRECT3D11 Primitive."); + return d3dPrimitive; +} + +class D3D11RendererMesh::ScopedMeshRender { +public: + + ScopedMeshRender(const D3D11RendererMesh& mesh_, RendererMaterial* material, bool instanced) : mesh(mesh_) + { + mesh.setTopology(mesh.getPrimitives(), static_cast<D3D11RendererMaterial*>(material)->tessellationEnabled()); + mesh.setLayout(material, instanced); + if (mesh.getPrimitives() == RendererMesh::PRIMITIVE_POINT_SPRITES) + mesh.setSprites(true); + } + + ~ScopedMeshRender() + { + if (mesh.getPrimitives() == RendererMesh::PRIMITIVE_POINT_SPRITES) + mesh.setSprites(false); + } + + ScopedMeshRender& operator=(const ScopedMeshRender&) { return *this; } + + const D3D11RendererMesh& mesh; +}; + +void D3D11RendererMesh::renderIndices(PxU32 numVertices, PxU32 firstIndex, PxU32 numIndices, RendererIndexBuffer::Format indexFormat, RendererMaterial* material) const +{ + ID3D11DeviceContext* d3dDeviceContext = m_renderer.getD3DDeviceContext(); + RENDERER_ASSERT(material, "Invalid RendererMaterial"); + if (d3dDeviceContext && material) + { + ScopedMeshRender renderScope(*this, material, false); + d3dDeviceContext->DrawIndexed(numIndices, firstIndex, 0); + } +} + +void D3D11RendererMesh::renderVertices(PxU32 numVertices, RendererMaterial* material) const +{ + ID3D11DeviceContext* d3dDeviceContext = m_renderer.getD3DDeviceContext(); + RENDERER_ASSERT(material, "Invalid RendererMaterial"); + if (d3dDeviceContext && material) + { + ScopedMeshRender renderScope(*this, material, false); + d3dDeviceContext->Draw(numVertices, 0); + } +} + +void D3D11RendererMesh::renderIndicesInstanced(PxU32 numVertices, PxU32 firstIndex, PxU32 numIndices, RendererIndexBuffer::Format indexFormat, RendererMaterial* material) const +{ + ID3D11DeviceContext* d3dDeviceContext = m_renderer.getD3DDeviceContext(); + RENDERER_ASSERT(material, "Invalid RendererMaterial"); + if (d3dDeviceContext && material) + { + ScopedMeshRender renderScope(*this, material, true); + d3dDeviceContext->DrawIndexedInstanced(numIndices, m_numInstances, firstIndex, 0, m_firstInstance); + } +} + +void D3D11RendererMesh::renderVerticesInstanced(PxU32 numVertices, RendererMaterial* material) const +{ + ID3D11DeviceContext* d3dDeviceContext = m_renderer.getD3DDeviceContext(); + RENDERER_ASSERT(material, "Invalid RendererMaterial"); + if (d3dDeviceContext && material) + { + ScopedMeshRender renderScope(*this, material, true); + d3dDeviceContext->DrawInstanced(numVertices, m_numInstances, 0, m_firstInstance); + } +} + +void D3D11RendererMesh::bind(void) const +{ + RendererMesh::bind(); +} + +void D3D11RendererMesh::render(RendererMaterial* material) const +{ + RendererMesh::render(material); +} + +void D3D11RendererMesh::setTopology(const Primitive& primitive, bool bTessellationEnabled) const +{ + ID3D11DeviceContext* d3dContext = m_renderer.getD3DDeviceContext(); + RENDERER_ASSERT(d3dContext, "Invalid D3D11 context"); + d3dContext->IASetPrimitiveTopology(getD3DPrimitive(primitive, bTessellationEnabled)); +} + +ID3D11InputLayout* D3D11RendererMesh::getInputLayoutForMaterial(const D3D11RendererMaterial* pMaterial, bool bInstanced) const +{ + ID3D11InputLayout* pLayout = NULL; + + RENDERER_ASSERT(pMaterial, "Invalid D3D11 Material"); + const LayoutVector& inputDescriptions = bInstanced ? m_instancedInputDescriptions : m_inputDescriptions; + const PxU64& inputHash = bInstanced ? m_instancedInputHash : m_inputHash; + ID3DBlob* pVSBlob = pMaterial->getVSBlob(inputDescriptions, inputHash, bInstanced); + RENDERER_ASSERT(pVSBlob, "Invalid D3D11 Shader Blob"); + + D3DTraits<ID3D11InputLayout>::key_type ilKey(inputHash, pVSBlob); + pLayout = m_renderer.getResourceManager()->hasResource<ID3D11InputLayout>(ilKey); + if (!pLayout) + { + ID3D11Device* d3dDevice = m_renderer.getD3DDevice(); + RENDERER_ASSERT(d3dDevice, "Invalid D3D11 device"); + HRESULT result = d3dDevice->CreateInputLayout(&inputDescriptions[0], + (UINT)inputDescriptions.size(), + pVSBlob->GetBufferPointer(), + pVSBlob->GetBufferSize(), + &pLayout); + RENDERER_ASSERT(SUCCEEDED(result) && pLayout, "Failed to create DIRECT3D11 Input Layout."); + if (SUCCEEDED(result) && pLayout) + { + m_renderer.getResourceManager()->registerResource<ID3D11InputLayout>(ilKey, pLayout); + } + } + + RENDERER_ASSERT(pLayout, "Failed to find DIRECT3D11 Input Layout."); + return pLayout; +} + +void D3D11RendererMesh::setLayout(const RendererMaterial* pMaterial, bool bInstanced) const +{ + ID3D11DeviceContext* d3dContext = m_renderer.getD3DDeviceContext(); + RENDERER_ASSERT(d3dContext, "Invalid D3D11 context"); + ID3D11InputLayout* pLayout = getInputLayoutForMaterial(static_cast<const D3D11RendererMaterial*>(pMaterial), bInstanced); + d3dContext->IASetInputLayout(pLayout); +} + +void D3D11RendererMesh::setSprites(bool bEnabled) const +{ + if (bEnabled && m_renderer.getFeatureLevel() > D3D_FEATURE_LEVEL_9_3) + { + static const D3D_SHADER_MACRO geometryDefines[] = + { + "RENDERER_GEOMETRY", "1", + "RENDERER_D3D11", "1", + "PX_WINDOWS", "1", + "USE_ALL", "1", + "SEMANTIC_TANGENT", "TANGENT", + NULL, NULL + }; + + ID3D11GeometryShader* pShader = NULL; + ID3DBlob* pBlob = NULL; + bool bLoadedFromCache = false; + + D3D11ShaderLoader gsLoader(m_renderer); + if (SUCCEEDED(gsLoader.load("pointsprite", m_spriteShaderPath.c_str(), geometryDefines, &pShader, &pBlob, true, &bLoadedFromCache))) + { + // If the shader was just compiled we need to load the proper variables for it + if (!bLoadedFromCache) + { + m_renderer.getVariableManager()->loadSharedVariables(this, pBlob, D3DTypes::SHADER_GEOMETRY); + } + m_renderer.getVariableManager()->bind(this, D3DTypes::SHADER_GEOMETRY); + m_renderer.getD3DDeviceContext()->GSSetShader(pShader, NULL, 0); + } + } + else + { + m_renderer.getD3DDeviceContext()->GSSetShader(NULL, NULL, 0); + } +} + +void D3D11RendererMesh::setNumVerticesAndIndices(PxU32 nbVerts, PxU32 nbIndices) +{ + m_numVertices = nbVerts; + m_numIndices = nbIndices; +} + + +#endif // #if defined(RENDERER_ENABLE_DIRECT3D11) diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11RendererMesh.h b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11RendererMesh.h new file mode 100644 index 00000000..577d7dbd --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11RendererMesh.h @@ -0,0 +1,93 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#ifndef D3D11_RENDERER_MESH_H +#define D3D11_RENDERER_MESH_H + +#include <RendererConfig.h> + +#if defined(RENDERER_ENABLE_DIRECT3D11) + +#include <RendererMesh.h> +#include "D3D11Renderer.h" + +namespace SampleRenderer +{ +class D3D11RendererMaterial; + +class D3D11RendererMesh : public RendererMesh +{ + friend class D3D11Renderer; + +public: + D3D11RendererMesh(D3D11Renderer& renderer, const RendererMeshDesc& desc); + virtual ~D3D11RendererMesh(void); + +protected: + virtual void renderIndices(PxU32 numVertices, PxU32 firstIndex, PxU32 numIndices, RendererIndexBuffer::Format indexFormat, RendererMaterial* material) const; + virtual void renderVertices(PxU32 numVertices, RendererMaterial* material) const; + + virtual void renderIndicesInstanced(PxU32 numVertices, PxU32 firstIndex, PxU32 numIndices, RendererIndexBuffer::Format indexFormat, RendererMaterial* material) const; + virtual void renderVerticesInstanced(PxU32 numVertices, RendererMaterial* material) const; + + D3D11RendererMesh& operator=(const D3D11RendererMesh&) { return *this; } + + Renderer& renderer() { return m_renderer; } + +private: + void bind(void) const; + void render(RendererMaterial* material) const; + + void setTopology(const Primitive& primitive, bool bTessellationEnabled) const; + void setLayout(const RendererMaterial*, bool bInstanced) const; + void setSprites(bool bEnabled) const; + void setNumVerticesAndIndices(PxU32 numIndices, PxU32 numVertices); + + ID3D11InputLayout* getInputLayoutForMaterial(const D3D11RendererMaterial*, bool bInstanced) const; + +private: + class ScopedMeshRender; + friend class ScopedMeshRender; + + typedef std::vector<D3D11_INPUT_ELEMENT_DESC> LayoutVector; + + D3D11Renderer& m_renderer; + + LayoutVector m_inputDescriptions; + LayoutVector m_instancedInputDescriptions; + PxU64 m_inputHash; + PxU64 m_instancedInputHash; + + // This is merely for cleanup, and has no effect on externally visible state + mutable bool m_bPopStates; + + std::string m_spriteShaderPath; +}; + +} // namespace SampleRenderer + +#endif // #if defined(RENDERER_ENABLE_DIRECT3D11) +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11RendererResourceManager.h b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11RendererResourceManager.h new file mode 100644 index 00000000..cb0d28c2 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11RendererResourceManager.h @@ -0,0 +1,333 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#ifndef D3D11_RENDERER_RESOURCE_MANAGER_H +#define D3D11_RENDERER_RESROUCE_MAANGER_H + +#include <RendererConfig.h> + +#if defined(RENDERER_ENABLE_DIRECT3D11) + +#include <algorithm> + +#include "D3D11RendererTraits.h" +#include "D3D11RendererMemoryMacros.h" + +namespace SampleRenderer +{ + +#define USE_ANY_AS_CONTAINER 1 +class Any +{ +public: + class Visitor; +private: + class Proxy; + +public: + Any() : mpProxy(NULL) { } + ~Any() { delete mpProxy; } + +public: + Any(const Any &other): mpProxy(other.mpProxy ? other.mpProxy->clone() : 0) { } + Any &swap(Any &rhs) { std::swap(mpProxy, rhs.mpProxy); return *this; } + Any &operator=(const Any &rhs) { Any rhsTemp(rhs); return swap(rhsTemp); } + + template<typename value_type> + Any(const value_type &value) : mpProxy(new ProxyImpl<value_type>(value)) { } + + template<typename value_type> + Any &operator=(const value_type &rhs) { Any rhsTemp(rhs); return swap(rhsTemp); } + + void assign(Proxy *otherProxy) { mpProxy = otherProxy; } + +public: + const std::type_info &type_info() const { return mpProxy ? mpProxy->type_info() : typeid(void); } + operator const void *() const { return mpProxy; } + + template<typename value_type> + bool copy_to(value_type &value) const { + const value_type *copyable = to_ptr<value_type>(); + if(copyable) value = *copyable; + return copyable; + } + template<typename value_type> + const value_type *to_ptr() const + { + return type_info() == typeid(value_type) ? &static_cast<ProxyImpl<value_type> *>(mpProxy)->mValue : 0; + } + template<typename value_type> + value_type *to_ptr() + { + return type_info() == typeid(value_type) ? &static_cast<ProxyImpl<value_type> *>(mpProxy)->mValue : 0; + } + +#if !USE_ANY_AS_CONTAINER + bool operator==(const Any& other) const { + return (mpProxy && other.mpProxy) ? (*mpProxy == *other.mpProxy) + :((!mpProxy && !other.mpProxy) ? true : false); } +#endif + + void release() { if(mpProxy) mpProxy->release(); } + //void accept(Visitor& visitor) { if (mpProxy) mpProxy->accept(visitor); } + +public: + class Visitor + { + public: + virtual void visit(Proxy& proxy) = 0; + }; + +private: + + + template<typename T> + struct Releaser { + public: + static void release(T& t) { } + }; + + template <typename T> + struct Releaser<T*> + { + public: + static void release(T*& t) { dxSafeRelease(t); } + }; + + template<typename T1,typename T2> + struct Releaser< std::pair<T1*,T2*> > + { + public: + static void release(std::pair<T1*,T2*>& t) { dxSafeRelease(t.first); dxSafeRelease(t.second); } + }; + + template<typename T1,typename T2> + struct Releaser< std::map<T1,T2> > : public Visitor + { + public: + static void release(std::map<T1,T2>& t) + { + for (typename std::map<T1,T2>::iterator it = t.begin(); it != t.end(); ++it) + { + Releaser<T2>::release(it->second); + } + } + }; + + class Proxy + { + public: + virtual const std::type_info& type_info() const = 0; + virtual Proxy *clone() const = 0; + virtual void release() = 0; +#if !USE_ANY_AS_CONTAINER + virtual bool operator<(const Proxy&) const = 0; + virtual bool operator==(const Proxy&) const = 0; +#endif + }; + template<typename value_type> + class ProxyImpl : public Proxy + { + public: + ProxyImpl(const value_type &value) : mValue(value) { } + virtual const std::type_info &type_info() const { return typeid(value_type); } + virtual Proxy *clone() const { return new ProxyImpl(mValue); } + virtual void release() { Releaser<value_type>::release(mValue); } + +#if !USE_ANY_AS_CONTAINER + virtual bool operator<(const Proxy& rhs) const { return mValue < static_cast< const ProxyImpl<value_type>& >(rhs).mValue; } + virtual bool operator==(const Proxy& rhs) const { return mValue == static_cast< const ProxyImpl<value_type>& >(rhs).mValue; } +#endif + value_type mValue; + private: + ProxyImpl &operator=(const ProxyImpl&); + }; + +public: + +#if !USE_ANY_AS_CONTAINER + struct Comp + { + bool operator()(const Any& lhs, const Any& rhs) const { return *(lhs.mpProxy) < *(rhs.mpProxy); } + }; +#endif + + // Let's us use the stack instead of calling new every time we use Any + template<typename value_type> + class Temp + { + public: + Temp(const value_type& value) : mProxy(value) { mAny.assign(&mProxy); } + ~Temp() { mAny.assign(NULL); } + + Any& operator()(void) { return mAny; } + const Any& operator()(void) const { return mAny; } + + protected: + ProxyImpl<value_type> mProxy; + Any mAny; + }; + + +private: + Proxy *mpProxy; +}; + +template<typename value_type> +value_type& any_cast(Any &operand) { + return *operand.to_ptr<value_type>(); +} + +template<typename value_type> +const value_type& any_cast(const Any &operand) { + return *operand.to_ptr<value_type>(); +} + +class D3D11RendererResourceManager +{ +public: +#if USE_ANY_AS_CONTAINER + typedef Any CacheType; +#else + typedef std::map<Any, Any, Any::Comp> CacheType; +#endif + D3D11RendererResourceManager() + { +#if USE_ANY_AS_CONTAINER + mResources[D3DTraits<ID3D11VertexShader>::getType()] = + std::map< typename D3DTraits<ID3D11VertexShader>::key_type, typename D3DTraits<ID3D11VertexShader>::value_type >(); + mResources[D3DTraits<ID3D11PixelShader>::getType()] = + std::map< typename D3DTraits<ID3D11PixelShader>::key_type, typename D3DTraits<ID3D11PixelShader>::value_type >(); + mResources[D3DTraits<ID3D11GeometryShader>::getType()] = + std::map< typename D3DTraits<ID3D11GeometryShader>::key_type, typename D3DTraits<ID3D11GeometryShader>::value_type >(); + mResources[D3DTraits<ID3D11HullShader>::getType()] = + std::map< typename D3DTraits<ID3D11HullShader>::key_type, typename D3DTraits<ID3D11HullShader>::value_type >(); + mResources[D3DTraits<ID3D11DomainShader>::getType()] = + std::map< typename D3DTraits<ID3D11DomainShader>::key_type, typename D3DTraits<ID3D11DomainShader>::value_type >(); + mResources[D3DTraits<ID3D11InputLayout>::getType()] = + std::map< typename D3DTraits<ID3D11InputLayout>::key_type, typename D3DTraits<ID3D11InputLayout>::value_type >(); + mResources[D3DTraits<ID3D11RasterizerState>::getType()] = + std::map< typename D3DTraits<ID3D11RasterizerState>::key_type, typename D3DTraits<ID3D11RasterizerState>::value_type >(); + mResources[D3DTraits<ID3D11DepthStencilState>::getType()] = + std::map< typename D3DTraits<ID3D11DepthStencilState>::key_type, typename D3DTraits<ID3D11DepthStencilState>::value_type >(); + mResources[D3DTraits<ID3D11BlendState>::getType()] = + std::map< typename D3DTraits<ID3D11BlendState>::key_type, typename D3DTraits<ID3D11BlendState>::value_type >(); +#endif + } + ~D3D11RendererResourceManager() + { +#if USE_ANY_AS_CONTAINER + for (PxU32 i = 0; i < D3DTypes::NUM_TYPES; ++i) + { + mResources[i].release(); + } +#else + for (PxU32 i = 0; i < D3DTypes::NUM_TYPES; ++i) + { + for (CacheType::iterator it = mResources[i].begin(); + it != mResources[i].end(); + ++it) + { + it->second.release(); + } + } +#endif + } + +public: + + template<typename d3d_type> + typename D3DTraits<d3d_type>::value_type + hasResource(const typename D3DTraits<d3d_type>::key_type& key) + { + typedef typename D3DTraits<d3d_type>::key_type key_type; + typedef typename D3DTraits<d3d_type>::value_type value_type; + typedef std::map<key_type,value_type> cache_type; + static const int resourceID = D3DTraits<d3d_type>::getType(); + RENDERER_ASSERT(resourceID != D3DTypes::INVALID, "Invalid D3D resource type"); +#if USE_ANY_AS_CONTAINER + RENDERER_ASSERT(!(mResources[resourceID] == Any()), "Invalid D3D resource container"); + cache_type& resources = any_cast< cache_type >(mResources[resourceID]); + typename cache_type::iterator it = resources.find(key); + return (it != resources.end()) ? it->second : NullTraits<value_type>::get(); +#else + Any::Temp<key_type> tempAny(key); + typename CacheType::iterator it = mResources[resourceID].find(tempAny()); + return (it != mResources[resourceID].end()) ? any_cast<value_type>(it->second) : NullTraits<value_type>::get(); +#endif + } + + template<typename d3d_type> + const typename D3DTraits<d3d_type>::value_type + hasResource(const typename D3DTraits<d3d_type>::key_type& key) const + { + typedef typename D3DTraits<d3d_type>::key_type key_type; + typedef typename D3DTraits<d3d_type>::value_type value_type; + typedef std::map<key_type,value_type> cache_type; + static const int resourceID = D3DTraits<d3d_type>::getType(); + RENDERER_ASSERT(resourceID != D3DTypes::INVALID, "Invalid D3D resource type"); +#if USE_ANY_AS_CONTAINER + RENDERER_ASSERT(!(mResources[resourceID] == Any()), "Invalid D3D resource container"); + const cache_type& resources = any_cast< cache_type >(mResources[resourceID]); + typename cache_type::const_iterator it = resources.find(key); + return (it != resources.end()) ? it->second : NullTraits<value_type>::get(); +#else + Any::Temp<key_type> tempAny(key); + typename CacheType::iterator it = mResources[resourceID].find(tempAny()); + return (it != mResources[resourceID].end()) ? any_cast<value_type>(it->second) : NullTraits<value_type>::get(); +#endif + } + + template<typename d3d_type> + void registerResource(const typename D3DTraits<d3d_type>::key_type& key, + const typename D3DTraits<d3d_type>::value_type& value) + { + typedef typename D3DTraits<d3d_type>::key_type key_type; + typedef typename D3DTraits<d3d_type>::value_type value_type; + typedef std::map<key_type,value_type> cache_type; + static const int resourceID = D3DTraits<d3d_type>::getType(); + RENDERER_ASSERT(resourceID != D3DTypes::INVALID, "Invalid D3D resource type"); +#if USE_ANY_AS_CONTAINER + RENDERER_ASSERT(!(mResources[resourceID] == Any()), "Invalid D3D resource container"); + cache_type& resources = any_cast< cache_type >(mResources[resourceID]); + //resources[key] = value; + resources.insert(std::make_pair(key, value)); +#else + Any::Temp<key_type> tempAny(key); + //mResources[resourceID][ tempAny() ] = value; + mResources[resourceID].insert(std::make_pair(tempAny(), value)); +#endif + } + +private: + CacheType mResources[D3DTypes::NUM_TYPES]; +}; + +} // namespace SampleRenderer + +#endif // #if defined(RENDERER_ENABLE_DIRECT3D11) + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11RendererSpotLight.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11RendererSpotLight.cpp new file mode 100644 index 00000000..a2e47ae5 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11RendererSpotLight.cpp @@ -0,0 +1,69 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#include <RendererConfig.h> + +#if defined(RENDERER_ENABLE_DIRECT3D11) + +#include "D3D11RendererSpotLight.h" +#include "D3D11RendererTexture2D.h" + +using namespace SampleRenderer; + +D3D11RendererSpotLight::D3D11RendererSpotLight(D3D11Renderer& renderer, const RendererSpotLightDesc& desc) : + RendererSpotLight(desc), + m_renderer(renderer) +{ + +} + +D3D11RendererSpotLight::~D3D11RendererSpotLight(void) +{ + +} + +void D3D11RendererSpotLight::bind(PxU32 lightIndex) const +{ + if (lightIndex < RENDERER_MAX_LIGHTS) + { + D3D11Renderer::D3D11ShaderEnvironment& shaderEnv = m_renderer.getShaderEnvironment(); + convertToD3D11(shaderEnv.lightColor[lightIndex], m_color); + shaderEnv.lightPosition[lightIndex] = m_position; + shaderEnv.lightDirection[lightIndex] = m_direction; + shaderEnv.lightIntensity[lightIndex] = m_intensity; + shaderEnv.lightInnerRadius[lightIndex] = m_innerRadius; + shaderEnv.lightOuterRadius[lightIndex] = m_outerRadius; + shaderEnv.lightInnerCone[lightIndex] = m_innerCone; + shaderEnv.lightOuterCone[lightIndex] = m_outerCone; + shaderEnv.lightType[lightIndex] = RendererMaterial::PASS_SPOT_LIGHT; + shaderEnv.lightShadowMap = m_shadowMap ? static_cast<D3D11RendererTexture2D*>(m_shadowMap) : NULL; + buildProjectMatrix(&shaderEnv.lightShadowMatrix.column0.x, m_shadowProjection, m_shadowTransform); + shaderEnv.bindLight(lightIndex); + } +} + +#endif // #if defined(RENDERER_ENABLE_DIRECT3D11) diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11RendererSpotLight.h b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11RendererSpotLight.h new file mode 100644 index 00000000..ed835ada --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11RendererSpotLight.h @@ -0,0 +1,57 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#ifndef D3D11_RENDERER_SPOT_LIGHT_H +#define D3D11_RENDERER_SPOT_LIGHT_H + +#include <RendererConfig.h> + +#if defined(RENDERER_ENABLE_DIRECT3D11) + +#include <RendererSpotLight.h> + +#include "D3D11Renderer.h" + +namespace SampleRenderer +{ + +class D3D11RendererSpotLight : public RendererSpotLight +{ +public: + D3D11RendererSpotLight(D3D11Renderer& renderer, const RendererSpotLightDesc& desc); + virtual ~D3D11RendererSpotLight(void); + + virtual void bind(void) const { bind(0); } + virtual void bind(PxU32 lightIndex) const; + +private: + D3D11Renderer& m_renderer; +}; + +} // namespace SampleRenderer + +#endif // #if defined(RENDERER_ENABLE_DIRECT3D11) +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11RendererTarget.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11RendererTarget.cpp new file mode 100644 index 00000000..60627b1b --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11RendererTarget.cpp @@ -0,0 +1,151 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#include <RendererConfig.h> +#include "D3D11RendererTarget.h" + +#if defined(RENDERER_ENABLE_DIRECT3D11) && defined(RENDERER_ENABLE_DIRECT3D11_TARGET) + +#include <RendererTargetDesc.h> +#include "D3D11RendererTexture2D.h" +#include "D3D11RendererMemoryMacros.h" + +using namespace SampleRenderer; + +D3D11RendererTarget::D3D11RendererTarget(ID3D11Device& d3dDevice, ID3D11DeviceContext& d3dDeviceContext, const RendererTargetDesc& desc) : + m_d3dDevice(d3dDevice), + m_d3dDeviceContext(d3dDeviceContext), + m_depthStencilSurface(NULL), + m_d3dDSV(NULL), + m_d3dLastDSV(NULL), + m_d3dRS(NULL), + m_d3dLastRS(NULL) +{ + for (PxU32 i = 0; i < desc.numTextures; i++) + { + D3D11RendererTexture2D& texture = *static_cast<D3D11RendererTexture2D*>(desc.textures[i]); + m_textures.push_back(&texture); + RENDERER_ASSERT(texture.m_d3dRTV, "Invalid render target specification"); + if (texture.m_d3dRTV) + { + m_d3dRTVs.push_back(texture.m_d3dRTV); + } + } + m_depthStencilSurface = static_cast<D3D11RendererTexture2D*>(desc.depthStencilSurface); + RENDERER_ASSERT(m_depthStencilSurface && m_depthStencilSurface->m_d3dTexture, "Invalid Target Depth Stencil Surface!"); + m_d3dDSV = m_depthStencilSurface->m_d3dDSV; + onDeviceReset(); +} + +D3D11RendererTarget::~D3D11RendererTarget(void) +{ + dxSafeRelease(m_d3dRS); +} + +void D3D11RendererTarget::bind(void) +{ + RENDERER_ASSERT(m_d3dRS && m_d3dLastDSV == NULL && m_d3dLastRTVs.size() == 0, "Render target in a bad state"); + if (m_d3dRS && !m_d3dLastDSV && m_d3dLastRTVs.size() == 0) + { + m_d3dLastRTVs.resize(D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT, NULL); + m_d3dLastDSV = NULL; + + m_d3dDeviceContext.OMGetRenderTargets(D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT, + &m_d3dLastRTVs[0], + &m_d3dLastDSV); + m_d3dDeviceContext.RSGetState(&m_d3dLastRS); + + static const PxF32 black[4] = {0.f, 0.f, 0.f, 0.f}; + for (PxU32 i = 0; i < m_d3dRTVs.size(); ++i) + { + m_d3dDeviceContext.ClearRenderTargetView(m_d3dRTVs[i], black); + } + m_d3dDeviceContext.ClearDepthStencilView(m_d3dDSV, D3D11_CLEAR_DEPTH | D3D11_CLEAR_STENCIL, 1., 0); + + m_d3dDeviceContext.OMSetRenderTargets((UINT)m_d3dRTVs.size(), &m_d3dRTVs[0], m_d3dDSV); + m_d3dDeviceContext.RSSetState(m_d3dRS); + } +} + +void D3D11RendererTarget::unbind(void) +{ + RENDERER_ASSERT(m_d3dLastDSV && m_d3dLastRTVs.size() > 0, "Render Target in a bad state."); + if (m_d3dLastDSV && m_d3dLastRTVs.size() > 0) + { + m_d3dDeviceContext.OMSetRenderTargets((UINT)m_d3dLastRTVs.size(), &m_d3dLastRTVs[0], m_d3dLastDSV); + for (PxU32 i = 0; i < m_d3dLastRTVs.size(); ++i) + { + dxSafeRelease(m_d3dLastRTVs[i]); + } + m_d3dLastRTVs.clear(); + dxSafeRelease(m_d3dLastDSV); + } + if (m_d3dLastRS) + { + m_d3dDeviceContext.RSSetState(m_d3dLastRS); + dxSafeRelease(m_d3dLastRS); + } +} + +void D3D11RendererTarget::onDeviceLost(void) +{ + RENDERER_ASSERT(m_d3dLastRS == NULL, "Render Target in bad state!"); + RENDERER_ASSERT(m_d3dRS, "Render Target in bad state!"); + dxSafeRelease(m_d3dRS); +} + +void D3D11RendererTarget::onDeviceReset(void) +{ + RENDERER_ASSERT(m_d3dRS == NULL, "Render Target in a bad state!"); + if (!m_d3dRS) + { + D3D11_RASTERIZER_DESC rasterizerDesc = + { + D3D11_FILL_SOLID, // D3D11_FILL_MODE FillMode; + D3D11_CULL_NONE, // D3D11_CULL_MODE CullMode; + FALSE, // BOOL FrontCounterClockwise; + 0, // INT DepthBias; + 0, // FLOAT DepthBiasClamp; + 1.0, // FLOAT SlopeScaledDepthBias; + TRUE, // BOOL DepthClipEnable; + FALSE, // BOOL ScissorEnable; + TRUE, // BOOL MultisampleEnable; + FALSE, // BOOL AntialiasedLineEnable; + }; + + //float depthBias = 0.0001f; + //float biasSlope = 1.58f; +#if RENDERER_ENABLE_DRESSCODE + //depthBias = dcParam("depthBias", depthBias, 0.0f, 0.01f); + //biasSlope = dcParam("biasSlope", biasSlope, 0.0f, 5.0f); +#endif + + m_d3dDevice.CreateRasterizerState(&rasterizerDesc, &m_d3dRS); + } +} + +#endif //#if defined(RENDERER_ENABLE_DIRECT3D11) && defined(RENDERER_ENABLE_DIRECT3D11_TARGET) diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11RendererTarget.h b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11RendererTarget.h new file mode 100644 index 00000000..efa8bd53 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11RendererTarget.h @@ -0,0 +1,80 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#ifndef D3D11_RENDERER_TARGET_H +#define D3D11_RENDERER_TARGET_H + +#include <RendererConfig.h> + +#if defined(RENDERER_WINDOWS) +#define RENDERER_ENABLE_DIRECT3D11_TARGET +#endif + +#if defined(RENDERER_ENABLE_DIRECT3D11) && defined(RENDERER_ENABLE_DIRECT3D11_TARGET) + +#include <RendererTarget.h> +#include "D3D11Renderer.h" + +namespace SampleRenderer +{ +class D3D11RendererTexture2D; + +class D3D11RendererTarget : public RendererTarget, public D3D11RendererResource +{ +public: + D3D11RendererTarget(ID3D11Device& d3dDevice, ID3D11DeviceContext& d3dDeviceContext, const RendererTargetDesc& desc); + virtual ~D3D11RendererTarget(void); + +private: + D3D11RendererTarget& operator=(const D3D11RendererTarget&) {} + virtual void bind(void); + virtual void unbind(void); + +private: + virtual void onDeviceLost(void); + virtual void onDeviceReset(void); + +private: + ID3D11Device& m_d3dDevice; + ID3D11DeviceContext& m_d3dDeviceContext; + + std::vector<D3D11RendererTexture2D*> m_textures; + D3D11RendererTexture2D* m_depthStencilSurface; + + std::vector<ID3D11RenderTargetView*> m_d3dRTVs; + std::vector<ID3D11RenderTargetView*> m_d3dLastRTVs; + + ID3D11DepthStencilView* m_d3dDSV; + ID3D11DepthStencilView* m_d3dLastDSV; + + ID3D11RasterizerState* m_d3dRS; + ID3D11RasterizerState* m_d3dLastRS; +}; + +} // namespace SampleRenderer + +#endif // #if defined(RENDERER_ENABLE_DIRECT3D11) && defined(RENDERER_ENABLE_DIRECT3D11_TARGET) +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11RendererTexture2D.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11RendererTexture2D.cpp new file mode 100644 index 00000000..e96b8959 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11RendererTexture2D.cpp @@ -0,0 +1,300 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#include <RendererConfig.h> + +#if defined(RENDERER_ENABLE_DIRECT3D11) + +#include "D3D11RendererTexture2D.h" +#include "D3D11RendererMemoryMacros.h" + +#include <RendererTexture2DDesc.h> + +using namespace SampleRenderer; + +D3D11RendererTexture2D::D3D11RendererTexture2D(ID3D11Device& d3dDevice, ID3D11DeviceContext& d3dDeviceContext, const RendererTexture2DDesc& desc) : + RendererTexture2D(desc), + m_d3dDevice(d3dDevice), + m_d3dDeviceContext(d3dDeviceContext), + m_d3dTexture(NULL), + m_d3dSamplerState(NULL), + m_d3dSRV(NULL), + m_d3dRTV(NULL), + m_d3dDSV(NULL) +{ + loadTextureDesc(desc); + onDeviceReset(); +} + +D3D11RendererTexture2D::~D3D11RendererTexture2D(void) +{ + dxSafeRelease(m_d3dTexture); + dxSafeRelease(m_d3dSamplerState); + dxSafeRelease(m_d3dSRV); + dxSafeRelease(m_d3dRTV); + dxSafeRelease(m_d3dDSV); + + if (m_data) + { + for (PxU32 i = 0; i < getNumLevels(); i++) + { + delete [] m_data[i]; + } + delete [] m_data; + } + if (m_resourceData) + { + delete [] m_resourceData; + } +} + +void* D3D11RendererTexture2D::lockLevel(PxU32 level, PxU32& pitch) +{ + void* buffer = 0; + RENDERER_ASSERT(level < getNumLevels(), "Level out of range!"); + if (level < getNumLevels()) + { + buffer = m_data[level]; + pitch = getFormatNumBlocks(getWidth() >> level, getFormat()) * getBlockSize(); + } + return buffer; +} + +void D3D11RendererTexture2D::unlockLevel(PxU32 level) +{ + RENDERER_ASSERT(level < getNumLevels(), "Level out of range!"); + + if (m_d3dTexture && level < getNumLevels()) + { + PxU32 w = getLevelDimension(getWidth(), level); + PxU32 h = getLevelDimension(getHeight(), level); + m_d3dDeviceContext.UpdateSubresource(m_d3dTexture, + level, + NULL, + m_data[level], + getFormatNumBlocks(w, getFormat()) * getBlockSize(), + computeImageByteSize(w, h, 1, getFormat())); + } +} + +void D3D11RendererTexture2D::bind(PxU32 samplerIndex, PxU32 flags) +{ + if (flags) + { + if (m_d3dSRV) + { + if (flags & BIND_VERTEX) + m_d3dDeviceContext.VSSetShaderResources(samplerIndex, 1, &m_d3dSRV); + if (flags & BIND_GEOMETRY) + m_d3dDeviceContext.GSSetShaderResources(samplerIndex, 1, &m_d3dSRV); + if (flags & BIND_PIXEL) + m_d3dDeviceContext.PSSetShaderResources(samplerIndex, 1, &m_d3dSRV); + if (flags & BIND_HULL) + m_d3dDeviceContext.HSSetShaderResources(samplerIndex, 1, &m_d3dSRV); + if (flags & BIND_DOMAIN) + m_d3dDeviceContext.DSSetShaderResources(samplerIndex, 1, &m_d3dSRV); + } + if (m_d3dSamplerState) + { + if (flags & BIND_VERTEX) + m_d3dDeviceContext.VSSetSamplers(samplerIndex, 1, &m_d3dSamplerState); + if (flags & BIND_GEOMETRY) + m_d3dDeviceContext.GSSetSamplers(samplerIndex, 1, &m_d3dSamplerState); + if (flags & BIND_PIXEL) + m_d3dDeviceContext.PSSetSamplers(samplerIndex, 1, &m_d3dSamplerState); + if (flags & BIND_HULL) + m_d3dDeviceContext.HSSetSamplers(samplerIndex, 1, &m_d3dSamplerState); + if (flags & BIND_DOMAIN) + m_d3dDeviceContext.DSSetSamplers(samplerIndex, 1, &m_d3dSamplerState); + } + } + else + { + ID3D11ShaderResourceView* nullResources[] = { NULL }; + m_d3dDeviceContext.VSSetShaderResources(samplerIndex, 1, nullResources); + m_d3dDeviceContext.GSSetShaderResources(samplerIndex, 1, nullResources); + m_d3dDeviceContext.PSSetShaderResources(samplerIndex, 1, nullResources); + m_d3dDeviceContext.HSSetShaderResources(samplerIndex, 1, nullResources); + m_d3dDeviceContext.DSSetShaderResources(samplerIndex, 1, nullResources); + ID3D11SamplerState* nullSamplers[] = { NULL }; + m_d3dDeviceContext.VSSetSamplers(samplerIndex, 1, nullSamplers); + m_d3dDeviceContext.GSSetSamplers(samplerIndex, 1, nullSamplers); + m_d3dDeviceContext.PSSetSamplers(samplerIndex, 1, nullSamplers); + m_d3dDeviceContext.HSSetSamplers(samplerIndex, 1, nullSamplers); + m_d3dDeviceContext.DSSetSamplers(samplerIndex, 1, nullSamplers); + } +} + +void D3D11RendererTexture2D::onDeviceLost(void) +{ + dxSafeRelease(m_d3dTexture); + dxSafeRelease(m_d3dSamplerState); + dxSafeRelease(m_d3dSRV); + dxSafeRelease(m_d3dRTV); + dxSafeRelease(m_d3dDSV); +} + +void D3D11RendererTexture2D::onDeviceReset(void) +{ + HRESULT result = S_OK; + if (!m_d3dTexture) + { + D3D11_SUBRESOURCE_DATA* pData = isDepthStencilFormat(getFormat()) ? NULL : m_resourceData; + result = m_d3dDevice.CreateTexture2D(&m_d3dTextureDesc, pData, &m_d3dTexture); + RENDERER_ASSERT(SUCCEEDED(result), "Unable to create D3D11 Texture."); + } + if (SUCCEEDED(result) && !m_d3dSamplerState) + { + result = m_d3dDevice.CreateSamplerState(&m_d3dSamplerDesc, &m_d3dSamplerState); + RENDERER_ASSERT(SUCCEEDED(result), "Unable to create D3D11 Sampler."); + } + if (SUCCEEDED(result) && m_d3dTextureDesc.BindFlags & D3D11_BIND_SHADER_RESOURCE && !m_d3dSRV) + { + result = m_d3dDevice.CreateShaderResourceView(m_d3dTexture, &m_d3dSRVDesc, &m_d3dSRV); + RENDERER_ASSERT(SUCCEEDED(result), "Unable to create D3D11 Shader Resource View."); + } + if (SUCCEEDED(result) && m_d3dTextureDesc.BindFlags & D3D11_BIND_RENDER_TARGET && !m_d3dRTV) + { + result = m_d3dDevice.CreateRenderTargetView(m_d3dTexture, &m_d3dRTVDesc, &m_d3dRTV); + RENDERER_ASSERT(SUCCEEDED(result), "Unable to create D3D11 Render Target View."); + } + if (SUCCEEDED(result) && m_d3dTextureDesc.BindFlags & D3D11_BIND_DEPTH_STENCIL && !m_d3dDSV) + { + result = m_d3dDevice.CreateDepthStencilView(m_d3dTexture, &m_d3dDSVDesc, &m_d3dDSV); + RENDERER_ASSERT(SUCCEEDED(result), "Unable to create D3D11 Depth Stencil View."); + } +} + + +void D3D11RendererTexture2D::loadTextureDesc(const RendererTexture2DDesc& desc) +{ + RENDERER_ASSERT(desc.depth == 1, "Invalid depth for 2D Texture!"); + + //memset(&m_d3dTextureDesc, 0, sizeof(m_d3dTextureDesc)); + m_d3dTextureDesc = D3D11_TEXTURE2D_DESC(); + m_d3dTextureDesc.Width = getWidth(); + m_d3dTextureDesc.Height = getHeight(); + m_d3dTextureDesc.MipLevels = getNumLevels(); + m_d3dTextureDesc.ArraySize = 1; + m_d3dTextureDesc.Format = getD3D11TextureFormat(desc.format); + m_d3dTextureDesc.SampleDesc.Count = 1; + m_d3dTextureDesc.SampleDesc.Quality = 0; + m_d3dTextureDesc.CPUAccessFlags = 0; + m_d3dTextureDesc.Usage = D3D11_USAGE_DEFAULT; + m_d3dTextureDesc.BindFlags = D3D11_BIND_SHADER_RESOURCE; + + loadResourceDesc(desc); + + if (isDepthStencilFormat(desc.format)) + { + m_d3dTextureDesc.BindFlags |= D3D11_BIND_DEPTH_STENCIL; + m_d3dTextureDesc.CPUAccessFlags = 0; + m_d3dTextureDesc.Usage = D3D11_USAGE_DEFAULT; + loadDepthStencilDesc(desc); + } + else if (desc.renderTarget) + { + m_d3dTextureDesc.BindFlags |= D3D11_BIND_RENDER_TARGET; + m_d3dTextureDesc.CPUAccessFlags = 0; + m_d3dTextureDesc.Usage = D3D11_USAGE_DEFAULT; + loadTargetDesc(desc); + } + + loadSamplerDesc(desc); + + //if (m_d3dTextureDesc.CPUAccessFlags) + { + m_data = new PxU8*[getNumLevels()]; + m_resourceData = new D3D11_SUBRESOURCE_DATA[getNumLevels()]; + memset(m_data, 0, sizeof(PxU8)*getNumLevels()); + memset(m_resourceData, 0, sizeof(D3D11_SUBRESOURCE_DATA)*getNumLevels()); + + for (PxU32 i = 0; i < desc.numLevels; i++) + { + PxU32 w = getLevelDimension(getWidth(), i); + PxU32 h = getLevelDimension(getHeight(), i); + PxU32 levelSize = computeImageByteSize(w, h, 1, desc.format); + m_data[i] = new PxU8[levelSize]; + memset(m_data[i], 0, levelSize); + m_resourceData[i].pSysMem = m_data[i]; + m_resourceData[i].SysMemPitch = levelSize / h; + m_resourceData[i].SysMemSlicePitch = 0; + } + } +} + +void D3D11RendererTexture2D::loadSamplerDesc(const RendererTexture2DDesc& desc) +{ + m_d3dSamplerDesc.Filter = getD3D11TextureFilter(desc.filter); + m_d3dSamplerDesc.AddressU = getD3D11TextureAddressing(desc.addressingU); + m_d3dSamplerDesc.AddressV = getD3D11TextureAddressing(desc.addressingV); + m_d3dSamplerDesc.AddressW = getD3D11TextureAddressing(desc.addressingW); + m_d3dSamplerDesc.MipLODBias = 0.f; + m_d3dSamplerDesc.MaxAnisotropy = 1; + m_d3dSamplerDesc.ComparisonFunc = D3D11_COMPARISON_ALWAYS; + m_d3dSamplerDesc.BorderColor[0] = m_d3dSamplerDesc.BorderColor[1] = m_d3dSamplerDesc.BorderColor[2] = m_d3dSamplerDesc.BorderColor[3] = 0.; + m_d3dSamplerDesc.MinLOD = 0; + if (desc.numLevels <= 1) + { + m_d3dSamplerDesc.MaxLOD = 0.; + } + else + { + m_d3dSamplerDesc.MaxLOD = D3D11_FLOAT32_MAX; + } + if(m_d3dDevice.GetFeatureLevel() <= D3D_FEATURE_LEVEL_9_3) + { + m_d3dSamplerDesc.MaxLOD = D3D11_FLOAT32_MAX; + } +} + +void D3D11RendererTexture2D::loadResourceDesc(const RendererTexture2DDesc& desc) +{ + m_d3dSRVDesc.Format = (m_d3dTextureDesc.Format == DXGI_FORMAT_R16_TYPELESS) ? DXGI_FORMAT_R16_UNORM : m_d3dTextureDesc.Format; + m_d3dSRVDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D; + m_d3dSRVDesc.Texture2D.MipLevels = m_d3dTextureDesc.MipLevels; + m_d3dSRVDesc.Texture2D.MostDetailedMip = 0; + //m_d3dSRVDesc.Texture2D.MostDetailedMip = m_d3dTextureDesc.MipLevels-1; +} + +void D3D11RendererTexture2D::loadTargetDesc(const RendererTexture2DDesc& desc) +{ + m_d3dRTVDesc = D3D11_RENDER_TARGET_VIEW_DESC(); + m_d3dRTVDesc.Format = (m_d3dTextureDesc.Format == DXGI_FORMAT_R16_TYPELESS) ? DXGI_FORMAT_R16_UNORM : m_d3dTextureDesc.Format; + m_d3dRTVDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D; + m_d3dRTVDesc.Texture2D.MipSlice = 0; +} + +void D3D11RendererTexture2D::loadDepthStencilDesc(const RendererTexture2DDesc& desc) +{ + m_d3dDSVDesc = D3D11_DEPTH_STENCIL_VIEW_DESC(); + m_d3dDSVDesc.Format = (m_d3dTextureDesc.Format == DXGI_FORMAT_R16_TYPELESS) ? DXGI_FORMAT_D16_UNORM : m_d3dTextureDesc.Format; + m_d3dDSVDesc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2D; + m_d3dDSVDesc.Texture2D.MipSlice = 0; +} + +#endif // #if defined(RENDERER_ENABLE_DIRECT3D11) diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11RendererTexture2D.h b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11RendererTexture2D.h new file mode 100644 index 00000000..89ac76b9 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11RendererTexture2D.h @@ -0,0 +1,96 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#ifndef D3D11_RENDERER_TEXTURE_2D_H +#define D3D11_RENDERER_TEXTURE_2D_H + +#include <RendererConfig.h> + +#if defined(RENDERER_ENABLE_DIRECT3D11) + +#include <RendererTexture2D.h> + +#include "D3D11Renderer.h" +#include "D3D11RendererTextureCommon.h" + +namespace SampleRenderer +{ + +class D3D11RendererTexture2D : public RendererTexture2D, public D3D11RendererResource +{ + friend class D3D11RendererTarget; + friend class D3D11RendererSpotLight; +public: + D3D11RendererTexture2D(ID3D11Device& d3dDevice, ID3D11DeviceContext& d3dDeviceContext, const RendererTexture2DDesc& desc); + virtual ~D3D11RendererTexture2D(void); + +public: + virtual void* lockLevel(PxU32 level, PxU32& pitch); + virtual void unlockLevel(PxU32 level); + + void bind(PxU32 samplerIndex, PxU32 flags = BIND_PIXEL); + + virtual void select(PxU32 stageIndex) + { + bind(stageIndex); + } + +private: + virtual void onDeviceLost(void); + virtual void onDeviceReset(void); + + void loadTextureDesc(const RendererTexture2DDesc&); + void loadSamplerDesc(const RendererTexture2DDesc&); + void loadResourceDesc(const RendererTexture2DDesc&); + void loadTargetDesc(const RendererTexture2DDesc&); + void loadDepthStencilDesc(const RendererTexture2DDesc&); + +private: + ID3D11Device& m_d3dDevice; + ID3D11DeviceContext& m_d3dDeviceContext; + ID3D11Texture2D* m_d3dTexture; + D3D11_TEXTURE2D_DESC m_d3dTextureDesc; + + ID3D11SamplerState* m_d3dSamplerState; + D3D11_SAMPLER_DESC m_d3dSamplerDesc; + + ID3D11ShaderResourceView* m_d3dSRV; + D3D11_SHADER_RESOURCE_VIEW_DESC m_d3dSRVDesc; + + ID3D11RenderTargetView* m_d3dRTV; + D3D11_RENDER_TARGET_VIEW_DESC m_d3dRTVDesc; + + ID3D11DepthStencilView* m_d3dDSV; + D3D11_DEPTH_STENCIL_VIEW_DESC m_d3dDSVDesc; + + PxU8** m_data; + D3D11_SUBRESOURCE_DATA* m_resourceData; +}; + +} // namespace SampleRenderer + +#endif // #if defined(RENDERER_ENABLE_DIRECT3D11) +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11RendererTexture3D.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11RendererTexture3D.cpp new file mode 100644 index 00000000..247340a3 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11RendererTexture3D.cpp @@ -0,0 +1,247 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#include <RendererConfig.h> + +#if defined(RENDERER_ENABLE_DIRECT3D11) + +#include "D3D11RendererTexture3D.h" +#include "D3D11RendererMemoryMacros.h" +#include "D3D11RendererTextureCommon.h" + +#include <RendererTextureDesc.h> + +using namespace SampleRenderer; + +D3D11RendererTexture3D::D3D11RendererTexture3D(ID3D11Device& d3dDevice, ID3D11DeviceContext& d3dDeviceContext, const RendererTexture3DDesc& desc) : + RendererTexture3D(desc), + m_d3dDevice(d3dDevice), + m_d3dDeviceContext(d3dDeviceContext), + m_d3dTexture(NULL), + m_d3dSamplerState(NULL), + m_d3dSRV(NULL) +{ + loadTextureDesc(desc); + onDeviceReset(); +} + +D3D11RendererTexture3D::~D3D11RendererTexture3D(void) +{ + dxSafeRelease(m_d3dTexture); + dxSafeRelease(m_d3dSamplerState); + dxSafeRelease(m_d3dSRV); + + if (m_data) + { + for (PxU32 i = 0; i < getNumLevels(); i++) + { + delete [] m_data[i]; + } + delete [] m_data; + } + if (m_resourceData) + { + delete [] m_resourceData; + } +} + +void* D3D11RendererTexture3D::lockLevel(PxU32 level, PxU32& pitch) +{ + void* buffer = 0; + RENDERER_ASSERT(level < getNumLevels(), "Level out of range!"); + if (level < getNumLevels()) + { + buffer = m_data[level]; + pitch = getFormatNumBlocks(getWidth() >> level, getFormat()) * getBlockSize(); + } + return buffer; +} + +void D3D11RendererTexture3D::unlockLevel(PxU32 level) +{ + RENDERER_ASSERT(level < getNumLevels(), "Level out of range!"); + + if (m_d3dTexture && level < getNumLevels()) + { + PxU32 w = getLevelDimension(getWidth(), level); + PxU32 h = getLevelDimension(getHeight(), level); + m_d3dDeviceContext.UpdateSubresource(m_d3dTexture, + level, + NULL, + m_data[level], + getFormatNumBlocks(w, getFormat()) * getBlockSize(), + computeImageByteSize(w, h, 1, getFormat())); + } +} + +void D3D11RendererTexture3D::bind(PxU32 samplerIndex, PxU32 flags) +{ + if (flags) + { + if (m_d3dSRV) + { + if (flags & BIND_VERTEX) + m_d3dDeviceContext.VSSetShaderResources(samplerIndex, 1, &m_d3dSRV); + if (flags & BIND_GEOMETRY) + m_d3dDeviceContext.GSSetShaderResources(samplerIndex, 1, &m_d3dSRV); + if (flags & BIND_PIXEL) + m_d3dDeviceContext.PSSetShaderResources(samplerIndex, 1, &m_d3dSRV); + if (flags & BIND_HULL) + m_d3dDeviceContext.HSSetShaderResources(samplerIndex, 1, &m_d3dSRV); + if (flags & BIND_DOMAIN) + m_d3dDeviceContext.DSSetShaderResources(samplerIndex, 1, &m_d3dSRV); + } + if (m_d3dSamplerState) + { + if (flags & BIND_VERTEX) + m_d3dDeviceContext.VSSetSamplers(samplerIndex, 1, &m_d3dSamplerState); + if (flags & BIND_GEOMETRY) + m_d3dDeviceContext.GSSetSamplers(samplerIndex, 1, &m_d3dSamplerState); + if (flags & BIND_PIXEL) + m_d3dDeviceContext.PSSetSamplers(samplerIndex, 1, &m_d3dSamplerState); + if (flags & BIND_HULL) + m_d3dDeviceContext.HSSetSamplers(samplerIndex, 1, &m_d3dSamplerState); + if (flags & BIND_DOMAIN) + m_d3dDeviceContext.DSSetSamplers(samplerIndex, 1, &m_d3dSamplerState); + } + } + else + { + ID3D11ShaderResourceView* nullResources[] = { NULL }; + m_d3dDeviceContext.VSSetShaderResources(samplerIndex, 1, nullResources); + m_d3dDeviceContext.GSSetShaderResources(samplerIndex, 1, nullResources); + m_d3dDeviceContext.PSSetShaderResources(samplerIndex, 1, nullResources); + m_d3dDeviceContext.HSSetShaderResources(samplerIndex, 1, nullResources); + m_d3dDeviceContext.DSSetShaderResources(samplerIndex, 1, nullResources); + ID3D11SamplerState* nullSamplers[] = { NULL }; + m_d3dDeviceContext.VSSetSamplers(samplerIndex, 1, nullSamplers); + m_d3dDeviceContext.GSSetSamplers(samplerIndex, 1, nullSamplers); + m_d3dDeviceContext.PSSetSamplers(samplerIndex, 1, nullSamplers); + m_d3dDeviceContext.HSSetSamplers(samplerIndex, 1, nullSamplers); + m_d3dDeviceContext.DSSetSamplers(samplerIndex, 1, nullSamplers); + } +} + +void D3D11RendererTexture3D::onDeviceLost(void) +{ + dxSafeRelease(m_d3dTexture); + dxSafeRelease(m_d3dSamplerState); + dxSafeRelease(m_d3dSRV); +} + +void D3D11RendererTexture3D::onDeviceReset(void) +{ + HRESULT result = S_OK; + if (!m_d3dTexture) + { + D3D11_SUBRESOURCE_DATA* pData = isDepthStencilFormat(getFormat()) ? NULL : m_resourceData; + result = m_d3dDevice.CreateTexture3D(&m_d3dTextureDesc, pData, &m_d3dTexture); + RENDERER_ASSERT(SUCCEEDED(result), "Unable to create D3D11 Texture."); + } + if (SUCCEEDED(result) && !m_d3dSamplerState) + { + result = m_d3dDevice.CreateSamplerState(&m_d3dSamplerDesc, &m_d3dSamplerState); + RENDERER_ASSERT(SUCCEEDED(result), "Unable to create D3D11 Sampler."); + } + if (SUCCEEDED(result) && m_d3dTextureDesc.BindFlags & D3D11_BIND_SHADER_RESOURCE && !m_d3dSRV) + { + result = m_d3dDevice.CreateShaderResourceView(m_d3dTexture, &m_d3dSRVDesc, &m_d3dSRV); + RENDERER_ASSERT(SUCCEEDED(result), "Unable to create D3D11 Shader Resource View."); + } + RENDERER_ASSERT((m_d3dTextureDesc.BindFlags & D3D11_BIND_RENDER_TARGET) == 0, "D3D11 3D Texture cannot be bound as render target."); + RENDERER_ASSERT((m_d3dTextureDesc.BindFlags & D3D11_BIND_DEPTH_STENCIL) == 0, "D3D11 3D Texture cannot be bound as depth stencil."); +} + + +void D3D11RendererTexture3D::loadTextureDesc(const RendererTexture3DDesc& desc) +{ + //memset(&m_d3dTextureDesc, 0, sizeof(m_d3dTextureDesc)); + m_d3dTextureDesc = D3D11_TEXTURE3D_DESC(); + m_d3dTextureDesc.Width = getWidth(); + m_d3dTextureDesc.Height = getHeight(); + m_d3dTextureDesc.Depth = getDepth(); + m_d3dTextureDesc.MipLevels = getNumLevels(); + m_d3dTextureDesc.Format = getD3D11TextureFormat(desc.format); + m_d3dTextureDesc.CPUAccessFlags = 0; + m_d3dTextureDesc.Usage = D3D11_USAGE_DEFAULT; + m_d3dTextureDesc.BindFlags = D3D11_BIND_SHADER_RESOURCE; + + loadResourceDesc(desc); + + loadSamplerDesc(desc); + + { + m_data = new PxU8*[getNumLevels()]; + m_resourceData = new D3D11_SUBRESOURCE_DATA[getNumLevels()]; + memset(m_data, 0, sizeof(PxU8)*getNumLevels()); + memset(m_resourceData, 0, sizeof(D3D11_SUBRESOURCE_DATA)*getNumLevels()); + + for (PxU32 i = 0; i < desc.numLevels; i++) + { + PxU32 w = getLevelDimension(getWidth(), i); + PxU32 h = getLevelDimension(getHeight(), i); + PxU32 d = getLevelDimension(getDepth(), i); + PxU32 levelSize = computeImageByteSize(w, h, d, desc.format); + m_data[i] = new PxU8[levelSize]; + memset(m_data[i], 0, levelSize); + m_resourceData[i].pSysMem = m_data[i]; + m_resourceData[i].SysMemPitch = levelSize / d / h; + m_resourceData[i].SysMemSlicePitch = levelSize / d; + } + } +} + +void D3D11RendererTexture3D::loadSamplerDesc(const RendererTexture3DDesc& desc) +{ + m_d3dSamplerDesc.Filter = getD3D11TextureFilter(desc.filter); + m_d3dSamplerDesc.AddressU = getD3D11TextureAddressing(desc.addressingU); + m_d3dSamplerDesc.AddressV = getD3D11TextureAddressing(desc.addressingV); + m_d3dSamplerDesc.AddressW = getD3D11TextureAddressing(desc.addressingW); + m_d3dSamplerDesc.MipLODBias = 0.f; + m_d3dSamplerDesc.MaxAnisotropy = 1; + m_d3dSamplerDesc.ComparisonFunc = D3D11_COMPARISON_ALWAYS; + m_d3dSamplerDesc.BorderColor[0] = m_d3dSamplerDesc.BorderColor[1] = m_d3dSamplerDesc.BorderColor[2] = m_d3dSamplerDesc.BorderColor[3] = 0.; + m_d3dSamplerDesc.MinLOD = 0; + if (desc.numLevels <= 1) + { + m_d3dSamplerDesc.MaxLOD = 0.; + } + else + { + m_d3dSamplerDesc.MaxLOD = D3D11_FLOAT32_MAX; + } +} + +void D3D11RendererTexture3D::loadResourceDesc(const RendererTexture3DDesc& desc) +{ + m_d3dSRVDesc.Format = (m_d3dTextureDesc.Format == DXGI_FORMAT_R16_TYPELESS) ? DXGI_FORMAT_R16_UNORM : m_d3dTextureDesc.Format; + m_d3dSRVDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE3D; + m_d3dSRVDesc.Texture3D.MipLevels = m_d3dTextureDesc.MipLevels; + m_d3dSRVDesc.Texture3D.MostDetailedMip = 0; +} + +#endif // #if defined(RENDERER_ENABLE_DIRECT3D11) diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11RendererTexture3D.h b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11RendererTexture3D.h new file mode 100644 index 00000000..fa19382a --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11RendererTexture3D.h @@ -0,0 +1,88 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#ifndef D3D11_RENDERER_TEXTURE_3D_H +#define D3D11_RENDERER_TEXTURE_3D_H + +#include <RendererConfig.h> + +#if defined(RENDERER_ENABLE_DIRECT3D11) + +#include <RendererTexture.h> + +#include "D3D11Renderer.h" +#include "D3D11RendererTextureCommon.h" + +namespace SampleRenderer +{ + +class D3D11RendererTexture3D : public RendererTexture3D, public D3D11RendererResource +{ + friend class D3D11RendererTarget; + friend class D3D11RendererSpotLight; +public: + D3D11RendererTexture3D(ID3D11Device& d3dDevice, ID3D11DeviceContext& d3dDeviceContext, const RendererTexture3DDesc& desc); + virtual ~D3D11RendererTexture3D(void); + +public: + virtual void* lockLevel(PxU32 level, PxU32& pitch); + virtual void unlockLevel(PxU32 level); + + void bind(PxU32 samplerIndex, PxU32 flags = BIND_PIXEL); + + virtual void select(PxU32 stageIndex) + { + bind(stageIndex); + } + +private: + virtual void onDeviceLost(void); + virtual void onDeviceReset(void); + + void loadTextureDesc(const RendererTexture3DDesc&); + void loadSamplerDesc(const RendererTexture3DDesc&); + void loadResourceDesc(const RendererTexture3DDesc&); + +private: + ID3D11Device& m_d3dDevice; + ID3D11DeviceContext& m_d3dDeviceContext; + ID3D11Texture3D* m_d3dTexture; + D3D11_TEXTURE3D_DESC m_d3dTextureDesc; + + ID3D11SamplerState* m_d3dSamplerState; + D3D11_SAMPLER_DESC m_d3dSamplerDesc; + + ID3D11ShaderResourceView* m_d3dSRV; + D3D11_SHADER_RESOURCE_VIEW_DESC m_d3dSRVDesc; + + PxU8** m_data; + D3D11_SUBRESOURCE_DATA* m_resourceData; +}; + +} // namespace SampleRenderer + +#endif // #if defined(RENDERER_ENABLE_DIRECT3D11) +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11RendererTextureCommon.h b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11RendererTextureCommon.h new file mode 100644 index 00000000..3d3321d0 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11RendererTextureCommon.h @@ -0,0 +1,107 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#ifndef D3D11_RENDERER_TEXTURE_COMMON_H +#define D3D11_RENDERER_TEXTURE_COMMON_H + +#include <RendererConfig.h> + +#if defined(RENDERER_ENABLE_DIRECT3D11) + +#include <RendererTexture.h> +#include <RendererTextureDesc.h> +#include <SamplePlatform.h> + +#include "D3D11RendererTraits.h" + + +namespace SampleRenderer +{ + +enum TEXTURE_BIND_FLAGS +{ + BIND_NONE = 0, + BIND_VERTEX = 1 << D3DTypes::SHADER_VERTEX, + BIND_GEOMETRY = 1 << D3DTypes::SHADER_GEOMETRY, + BIND_PIXEL = 1 << D3DTypes::SHADER_PIXEL, + BIND_HULL = 1 << D3DTypes::SHADER_HULL, + BIND_DOMAIN = 1 << D3DTypes::SHADER_DOMAIN, + BIND_ALL = (1 << D3DTypes::NUM_SHADER_TYPES) - 1 +}; + +PX_INLINE PxU32 getBindFlags(D3DType d3dType) { return 1 << d3dType; } + +PX_INLINE DXGI_FORMAT getD3D11TextureFormat(RendererTexture::Format format) +{ + DXGI_FORMAT dxgiFormat = static_cast<DXGI_FORMAT>(SampleFramework::SamplePlatform::platform()->getD3D11TextureFormat(format)); + RENDERER_ASSERT(dxgiFormat != DXGI_FORMAT_UNKNOWN, "Unable to convert to D3D11 Texture Format."); + return dxgiFormat; +} + +PX_INLINE D3D11_FILTER getD3D11TextureFilter(RendererTexture::Filter filter) +{ + D3D11_FILTER d3dFilter = D3D11_FILTER_MIN_MAG_MIP_LINEAR; + switch (filter) + { + case RendererTexture2D::FILTER_NEAREST: + d3dFilter = D3D11_FILTER_MIN_MAG_MIP_POINT; + break; + case RendererTexture2D::FILTER_LINEAR: + d3dFilter = D3D11_FILTER_MIN_MAG_MIP_LINEAR; + break; + case RendererTexture2D::FILTER_ANISOTROPIC: + d3dFilter = D3D11_FILTER_ANISOTROPIC; + break; + default: + RENDERER_ASSERT(0, "Unable to convert to D3D11 Filter mode."); + } + return d3dFilter; +} + +PX_INLINE D3D11_TEXTURE_ADDRESS_MODE getD3D11TextureAddressing(RendererTexture2D::Addressing addressing) +{ + D3D11_TEXTURE_ADDRESS_MODE d3dAddressing = (D3D11_TEXTURE_ADDRESS_MODE)0; + switch (addressing) + { + case RendererTexture2D::ADDRESSING_WRAP: + d3dAddressing = D3D11_TEXTURE_ADDRESS_WRAP; + break; + case RendererTexture2D::ADDRESSING_CLAMP: + d3dAddressing = D3D11_TEXTURE_ADDRESS_CLAMP; + break; + case RendererTexture2D::ADDRESSING_MIRROR: + d3dAddressing = D3D11_TEXTURE_ADDRESS_MIRROR; + break; + } + RENDERER_ASSERT(d3dAddressing != 0, "Unable to convert to D3D11 Addressing mode."); + return d3dAddressing; +} + +} + +#endif // #if defined(RENDERER_ENABLE_DIRECT3D11) + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11RendererTraits.h b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11RendererTraits.h new file mode 100644 index 00000000..ca8cd29f --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11RendererTraits.h @@ -0,0 +1,317 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#ifndef D3D11_RENDERER_TRAITS_H +#define D3D11_RENDERER_TRAITS_H + +#include <RendererConfig.h> + +#if defined(RENDERER_ENABLE_DIRECT3D11) + +#include <tuple> + +namespace SampleRenderer +{ + +namespace D3DTypes +{ + enum D3DType + { + SHADER_PIXEL = 0, + SHADER_VERTEX, + SHADER_GEOMETRY, + SHADER_HULL, + SHADER_DOMAIN, + LAYOUT_INPUT, + STATE_RASTERIZER, + STATE_BLEND, + STATE_DEPTHSTENCIL, + NUM_TYPES, + NUM_SHADER_TYPES = SHADER_DOMAIN + 1, + NUM_NON_PIXEL_SHADER_TYPES = NUM_SHADER_TYPES - 1, + INVALID = NUM_TYPES + }; +} +typedef D3DTypes::D3DType D3DType; + +typedef std::string D3DStringKey; + +template<typename d3d_type> +class D3DTraits +{ +public: + typedef D3DStringKey key_type; + typedef IUnknown* value_type; + static D3DType getType() { return D3DTypes::INVALID; } +}; + +template <> +class D3DTraits<ID3D11VertexShader> +{ +public: + // InputLayoutHash + Shader Name + typedef std::pair<PxU64, D3DStringKey> key_type; + typedef std::pair<ID3D11VertexShader*, ID3DBlob*> value_type; + static const char* getEntry() { return "vmain"; } + static const char* getProfile(D3D_FEATURE_LEVEL featureLevel = D3D_FEATURE_LEVEL_11_0) + { + switch(featureLevel) + { +#if PX_XBOXONE + case D3D_FEATURE_LEVEL_11_1: return "vs_5_0"; +#endif + case D3D_FEATURE_LEVEL_11_0: return "vs_5_0"; + case D3D_FEATURE_LEVEL_10_1: return "vs_4_1"; + case D3D_FEATURE_LEVEL_10_0: return "vs_4_0"; + case D3D_FEATURE_LEVEL_9_1: return "vs_4_0_level_9_1"; + case D3D_FEATURE_LEVEL_9_2: return "vs_4_0_level_9_2"; + case D3D_FEATURE_LEVEL_9_3: return "vs_4_0_level_9_3"; + default: RENDERER_ASSERT(0, "Invalid feature level"); return "vs_invalid"; + } + }; + static D3DType getType() { return D3DTypes::SHADER_VERTEX; } + static HRESULT create( ID3D11Device* pDevice, const void *pShaderBytecode, SIZE_T BytecodeLength, ID3D11ClassLinkage *pClassLinkage, ID3D11VertexShader **ppShader) + { + return pDevice->CreateVertexShader(pShaderBytecode, BytecodeLength, pClassLinkage, ppShader); + } + static void setConstants( ID3D11DeviceContext* pContext, UINT StartSlot, UINT NumBuffers, ID3D11Buffer *const *ppConstantBuffers ) + { + pContext->VSSetConstantBuffers(StartSlot, NumBuffers, ppConstantBuffers); + } +}; + +template <> +class D3DTraits<ID3D11PixelShader> +{ +public: + // Pass + Shader Name + typedef std::pair<PxU32, D3DStringKey> key_type; + typedef std::pair<ID3D11PixelShader*, ID3DBlob*> value_type; + static const char* getEntry() { return "fmain"; } + static const char* getProfile(D3D_FEATURE_LEVEL featureLevel = D3D_FEATURE_LEVEL_11_0) { + switch(featureLevel) + { +#if PX_XBOXONE + case D3D_FEATURE_LEVEL_11_1: return "ps_5_0"; +#endif + case D3D_FEATURE_LEVEL_11_0: return "ps_5_0"; + case D3D_FEATURE_LEVEL_10_1: return "ps_4_1"; + case D3D_FEATURE_LEVEL_10_0: return "ps_4_0"; + case D3D_FEATURE_LEVEL_9_1: return "ps_4_0_level_9_1"; + case D3D_FEATURE_LEVEL_9_2: return "ps_4_0_level_9_2"; + case D3D_FEATURE_LEVEL_9_3: return "ps_4_0_level_9_3"; + default: RENDERER_ASSERT(0, "Invalid feature level"); return "ps_invalid"; + }; + } + static D3DType getType() { return D3DTypes::SHADER_PIXEL; } + static HRESULT create( ID3D11Device* pDevice, const void *pShaderBytecode, SIZE_T BytecodeLength, ID3D11ClassLinkage *pClassLinkage, ID3D11PixelShader **ppShader) + { + return pDevice->CreatePixelShader(pShaderBytecode, BytecodeLength, pClassLinkage, ppShader); + } + static void setConstants( ID3D11DeviceContext* pContext, UINT StartSlot, UINT NumBuffers, ID3D11Buffer *const *ppConstantBuffers ) + { + pContext->PSSetConstantBuffers(StartSlot, NumBuffers, ppConstantBuffers); + } +}; + +template <> +class D3DTraits<ID3D11GeometryShader> +{ +public: + // Shader Name + typedef D3DStringKey key_type; + typedef std::pair<ID3D11GeometryShader*,ID3DBlob*> value_type; + static const char* getEntry() { return "gmain"; } + static const char* getProfile(D3D_FEATURE_LEVEL featureLevel = D3D_FEATURE_LEVEL_11_0) + { + switch(featureLevel) + { +#if PX_XBOXONE + case D3D_FEATURE_LEVEL_11_1: return "gs_5_0"; +#endif + case D3D_FEATURE_LEVEL_11_0: return "gs_5_0"; + case D3D_FEATURE_LEVEL_10_1: return "gs_4_1"; + case D3D_FEATURE_LEVEL_10_0: return "gs_4_0"; + default: RENDERER_ASSERT(0, "Invalid geometry shader feature level") return "gs_invalid"; + }; + } + + static D3DType getType() { return D3DTypes::SHADER_GEOMETRY; } + static HRESULT create( ID3D11Device* pDevice, const void *pShaderBytecode, SIZE_T BytecodeLength, ID3D11ClassLinkage *pClassLinkage, ID3D11GeometryShader **ppShader) + { + return pDevice->CreateGeometryShader(pShaderBytecode, BytecodeLength, pClassLinkage, ppShader); + } + static void setConstants( ID3D11DeviceContext* pContext, UINT StartSlot, UINT NumBuffers, ID3D11Buffer *const *ppConstantBuffers ) + { + pContext->GSSetConstantBuffers(StartSlot, NumBuffers, ppConstantBuffers); + } +}; + +template <> +class D3DTraits<ID3D11HullShader> +{ +public: + // Shader Name + typedef std::pair<PxU32, D3DStringKey> key_type; + typedef std::pair<ID3D11HullShader*,ID3DBlob*> value_type; + static const char* getEntry() { return "hmain"; } + static const char* getProfile(D3D_FEATURE_LEVEL featureLevel = D3D_FEATURE_LEVEL_11_0) + { + switch(featureLevel) + { +#if PX_XBOXONE + case D3D_FEATURE_LEVEL_11_1: return "hs_5_0"; +#endif + case D3D_FEATURE_LEVEL_11_0: return "hs_5_0"; + default: RENDERER_ASSERT(0, "Invalid hull shader feature level") return "hs_invalid"; + }; + } + static D3DType getType() { return D3DTypes::SHADER_HULL; } + static HRESULT create( ID3D11Device* pDevice, const void *pShaderBytecode, SIZE_T BytecodeLength, ID3D11ClassLinkage *pClassLinkage, ID3D11HullShader **ppShader) + { + return pDevice->CreateHullShader(pShaderBytecode, BytecodeLength, pClassLinkage, ppShader); + } + static void setConstants( ID3D11DeviceContext* pContext, UINT StartSlot, UINT NumBuffers, ID3D11Buffer *const *ppConstantBuffers ) + { + pContext->HSSetConstantBuffers(StartSlot, NumBuffers, ppConstantBuffers); + } +}; + +template <> +class D3DTraits<ID3D11DomainShader> +{ +public: + // Shader Name + typedef std::pair<PxU32, D3DStringKey> key_type; + typedef std::pair<ID3D11DomainShader*, ID3DBlob*> value_type; + static const char* getEntry() { return "dmain"; } + static const char* getProfile(D3D_FEATURE_LEVEL featureLevel = D3D_FEATURE_LEVEL_11_0) + { + switch(featureLevel) + { +#if PX_XBOXONE + case D3D_FEATURE_LEVEL_11_1: return "ds_5_0"; +#endif + case D3D_FEATURE_LEVEL_11_0: return "ds_5_0"; + default: RENDERER_ASSERT(0, "Invalid domain shader feature level") return "ds_invalid"; + }; + } + static D3DType getType() { return D3DTypes::SHADER_DOMAIN; } + static HRESULT create( ID3D11Device* pDevice, const void *pShaderBytecode, SIZE_T BytecodeLength, ID3D11ClassLinkage *pClassLinkage, ID3D11DomainShader **ppShader) + { + return pDevice->CreateDomainShader(pShaderBytecode, BytecodeLength, pClassLinkage, ppShader); + } + static void setConstants( ID3D11DeviceContext* pContext, UINT StartSlot, UINT NumBuffers, ID3D11Buffer *const *ppConstantBuffers ) + { + pContext->DSSetConstantBuffers(StartSlot, NumBuffers, ppConstantBuffers); + } +}; + +template <> +class D3DTraits<ID3D11InputLayout> +{ +public: + // InputLayoutHash + Shader Name + typedef std::pair<PxU64, ID3DBlob*> key_type; + typedef ID3D11InputLayout* value_type; + static D3DType getType() { return D3DTypes::LAYOUT_INPUT; } +}; + +template <> +class D3DTraits<ID3D11RasterizerState> +{ +public: + typedef std::tr1::tuple<D3D11_FILL_MODE, D3D11_CULL_MODE, int> key_type; + typedef ID3D11RasterizerState* value_type; + static D3DType getType() { return D3DTypes::STATE_RASTERIZER; } +}; + + +template <> +class D3DTraits<ID3D11DepthStencilState> +{ +public: + // Depth enable + stencil enable + typedef std::pair<bool, bool> key_type; + typedef ID3D11DepthStencilState* value_type; + static D3DType getType() { return D3DTypes::STATE_DEPTHSTENCIL; } +}; + + +template <> +class D3DTraits<ID3D11BlendState> +{ +public: + typedef D3D11_RENDER_TARGET_BLEND_DESC key_type; + typedef ID3D11BlendState* value_type; + static D3DType getType() { return D3DTypes::STATE_BLEND; } +}; + +// This lets us lookup a traits class based on the D3DType key, which is rather handy +template<PxU32 N> +class D3DTraitsLookup { }; +template<> +class D3DTraitsLookup<D3DTypes::SHADER_PIXEL> { typedef ID3D11PixelShader d3d_type; }; +template<> +class D3DTraitsLookup<D3DTypes::SHADER_VERTEX> { typedef ID3D11VertexShader d3d_type; }; +template<> +class D3DTraitsLookup<D3DTypes::SHADER_GEOMETRY> { typedef ID3D11GeometryShader d3d_type; }; +template<> +class D3DTraitsLookup<D3DTypes::SHADER_HULL> { typedef ID3D11HullShader d3d_type; }; +template<> +class D3DTraitsLookup<D3DTypes::SHADER_DOMAIN> { typedef ID3D11DomainShader d3d_type; }; +template<> +class D3DTraitsLookup<D3DTypes::LAYOUT_INPUT> { typedef ID3D11InputLayout d3d_type; }; +template<> +class D3DTraitsLookup<D3DTypes::STATE_BLEND> { typedef ID3D11BlendState d3d_type; }; +template<> +class D3DTraitsLookup<D3DTypes::STATE_DEPTHSTENCIL> { typedef ID3D11DepthStencilState d3d_type; }; +template<> +class D3DTraitsLookup<D3DTypes::STATE_RASTERIZER> { typedef ID3D11RasterizerState d3d_type; }; + +template <typename T> +struct NullTraits +{ + static T get() { return 0; } +}; + +template <typename T> +struct NullTraits<T*> +{ + static T* get() { return NULL; } +}; + +template<typename T1,typename T2> +struct NullTraits< std::pair<T1*,T2*> > +{ + static std::pair<T1*,T2*> get() { return std::pair<T1*,T2*>((T1*)NULL,(T2*)NULL); } +}; + +} // namespace SampleRenderer + +#endif // #if defined(RENDERER_ENABLE_DIRECT3D11) + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11RendererUtils.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11RendererUtils.cpp new file mode 100644 index 00000000..3113ba50 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11RendererUtils.cpp @@ -0,0 +1,502 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#include <RendererConfig.h> + +#if defined(RENDERER_ENABLE_DIRECT3D11) + +#include "D3D11RendererUtils.h" +#include "D3D11RendererMemoryMacros.h" + +#if !PX_XBOXONE +#include "D3DX11.h" +#endif +#include "D3Dcompiler.h" + +// for PsString.h +#include <PsString.h> +#include <PxTkFile.h> + +using namespace SampleRenderer; +namespace Ps = physx::shdfnd; + + +/****************************************** +* D3DX11::D3DX11 * +*******************************************/ + +D3DX11::D3DX11(void) + : m_pD3DX11CompileFromFile(NULL), + m_pD3DX11CompileFromMemory(NULL), + m_pD3DReflect(NULL) +{ +#if defined(RENDERER_WINDOWS) && !PX_XBOXONE + m_library = LoadLibraryA(D3DX11_DLL); + if (!m_library) + { + // This version should be present on all valid DX11 machines + m_library = LoadLibraryA("d3dx11_42.dll"); + if (!m_library) + { + MessageBoxA(0, "Unable to load " D3DX11_DLL ". Please install the latest DirectX End User Runtime available at www.microsoft.com/directx.", "Renderer Error.", MB_OK); + } + } + if (m_library) + { + m_pD3DX11CompileFromFile = (D3DX11COMPILEFROMFILE)GetProcAddress(m_library, "D3DX11CompileFromFileA"); + RENDERER_ASSERT(m_pD3DX11CompileFromFile, "Unable to find D3DX11 Function D3DX11CompileFromFile in " D3DX11_DLL "."); + m_pD3DX11CompileFromMemory = (D3DX11COMPILEFROMMEMORY)GetProcAddress(m_library, "D3DX11CompileFromMemory"); + RENDERER_ASSERT(m_pD3DX11CompileFromMemory, "Unable to find D3DX11 Function D3DX11CompileFromFile in " D3DX11_DLL "."); + m_pD3DX11SaveTextureToMemory = (D3DX11SAVETEXTURETOMEMORY)GetProcAddress(m_library, "D3DX11SaveTextureToMemory"); + RENDERER_ASSERT(m_pD3DX11SaveTextureToMemory, "Unable to find D3DX11 Function D3DX11SaveTextureToMemory in " D3DX11_DLL "."); + } + + m_compiler_library = LoadLibraryA(D3DCOMPILER_DLL); + if (!m_compiler_library) + { + // This version should be present on all valid DX11 machines + m_library = LoadLibraryA("D3DCompiler_42.dll"); + if (!m_compiler_library) + { + MessageBoxA(0, "Unable to load " D3DCOMPILER_DLL ". Please install the latest DirectX End User Runtime available at www.microsoft.com/directx.", "Renderer Error.", MB_OK); + } + } + if (m_compiler_library) + { + m_pD3DReflect = (D3DREFLECT)GetProcAddress(m_compiler_library, "D3DReflect"); + RENDERER_ASSERT(m_pD3DReflect, "Unable to find D3D Function D3DReflect in " D3DCOMPILER_DLL "."); + m_pD3DCreateBlob = (D3DCREATEBLOB)GetProcAddress(m_compiler_library, "D3DCreateBlob"); + RENDERER_ASSERT(m_pD3DCreateBlob, "Unable to find D3D Function D3DCreateBlob in " D3DCOMPILER_DLL "."); + } +#endif +} + +D3DX11::~D3DX11(void) +{ +#if defined(RENDERER_WINDOWS) + if (m_library) + { + FreeLibrary(m_library); + m_library = 0; + } + if (m_compiler_library) + { + FreeLibrary(m_compiler_library); + m_compiler_library = 0; + } +#endif +} + +HRESULT D3DX11::compileShaderFromFile(LPCSTR pSrcFile, + CONST D3D10_SHADER_MACRO* pDefines, + LPD3D10INCLUDE pInclude, + LPCSTR pFunctionName, + LPCSTR pProfile, + UINT Flags1, + UINT Flags2, + ID3DX11ThreadPump* pPump, + ID3D10Blob** ppShader, + ID3D10Blob** ppErrorMsgs, + HRESULT* pHResult) const +{ +#if !PX_XBOXONE + return m_pD3DX11CompileFromFile(pSrcFile, + pDefines, + pInclude, + pFunctionName, + pProfile, + Flags1, + Flags2, + pPump, + ppShader, + ppErrorMsgs, + pHResult); +#else + const size_t bufferSize = 256; + wchar_t wSrcFile[bufferSize]; + size_t length = 0; + mbstowcs_s(&length, wSrcFile, strlen(pSrcFile) + 1, pSrcFile, bufferSize); + HRESULT result = D3DCompileFromFile(wSrcFile, pDefines, pInclude, pFunctionName, pProfile, Flags1, Flags2, ppShader, ppErrorMsgs); + if(pHResult) + *pHResult = result; + return result; +#endif +} + +HRESULT D3DX11::compileShaderFromMemory(LPCSTR pSrcData, + SIZE_T SrcDataLen, + LPCSTR pFileName, + CONST D3D10_SHADER_MACRO* pDefines, + LPD3D10INCLUDE pInclude, + LPCSTR pFunctionName, + LPCSTR pProfile, + UINT Flags1, + UINT Flags2, + ID3DX11ThreadPump* pPump, + ID3D10Blob** ppShader, + ID3D10Blob** ppErrorMsgs, + HRESULT* pHResult) const +{ +#if !PX_XBOXONE + return m_pD3DX11CompileFromMemory(pSrcData, + SrcDataLen, + pFileName, + pDefines, + pInclude, + pFunctionName, + pProfile, + Flags1, + Flags2, + pPump, + ppShader, + ppErrorMsgs, + pHResult); +#else + HRESULT result = D3DCompile(pSrcData, SrcDataLen, pFileName, pDefines, pInclude, pFunctionName, pProfile, Flags1, Flags2, ppShader, ppErrorMsgs); + if(pHResult) + *pHResult = result; + return result; +#endif +} + +HRESULT D3DX11::reflect(LPCVOID pSrcData, SIZE_T SrcDataSize, REFIID pInterface, void** ppReflector) +{ +#if !PX_XBOXONE + return m_pD3DReflect(pSrcData, SrcDataSize, pInterface, ppReflector); +#else + return D3DReflect(pSrcData, SrcDataSize, pInterface, ppReflector); +#endif +} + +HRESULT D3DX11::saveTextureToMemory( ID3D11DeviceContext *pContext, ID3D11Resource *pSrcTexture, D3DX11_IMAGE_FILE_FORMAT DestFormat, LPD3D10BLOB *ppDestBuf, UINT Flags ) +{ + return m_pD3DX11SaveTextureToMemory(pContext, pSrcTexture, DestFormat, ppDestBuf, Flags); +} + +HRESULT D3DX11::createBlob(SIZE_T Size, ID3DBlob **ppBlob) +{ + return m_pD3DCreateBlob(Size, ppBlob); +} + +void D3DX11::processCompileErrors(ID3DBlob* errors) +{ +#if defined(RENDERER_WINDOWS) && !PX_XBOXONE + if (errors) + { + const char* errorStr = (const char*)errors->GetBufferPointer(); + if (errorStr) + { + static bool ignoreErrors = false; + if (!ignoreErrors) + { + int ret = MessageBoxA(0, errorStr, "D3DXCompileShaderFromFile Error", MB_ABORTRETRYIGNORE); + if (ret == IDABORT) + { + exit(0); + } + else if (ret == IDIGNORE) + { + ignoreErrors = true; + } + } + } + } +#endif +} + +PxU64 D3DX11::getInputHash(const std::vector<D3D11_INPUT_ELEMENT_DESC>& inputDesc) +{ + return getInputHash(&inputDesc[0], (UINT)inputDesc.size()); +} + +static PxU8 sizeOfFormatElement(DXGI_FORMAT format) +{ + switch( format ) + { + case DXGI_FORMAT_R32G32B32A32_TYPELESS: + case DXGI_FORMAT_R32G32B32A32_FLOAT: + case DXGI_FORMAT_R32G32B32A32_UINT: + case DXGI_FORMAT_R32G32B32A32_SINT: + return 128; + + case DXGI_FORMAT_R32G32B32_TYPELESS: + case DXGI_FORMAT_R32G32B32_FLOAT: + case DXGI_FORMAT_R32G32B32_UINT: + case DXGI_FORMAT_R32G32B32_SINT: + return 96; + + case DXGI_FORMAT_R16G16B16A16_TYPELESS: + case DXGI_FORMAT_R16G16B16A16_FLOAT: + case DXGI_FORMAT_R16G16B16A16_UNORM: + case DXGI_FORMAT_R16G16B16A16_UINT: + case DXGI_FORMAT_R16G16B16A16_SNORM: + case DXGI_FORMAT_R16G16B16A16_SINT: + case DXGI_FORMAT_R32G32_TYPELESS: + case DXGI_FORMAT_R32G32_FLOAT: + case DXGI_FORMAT_R32G32_UINT: + case DXGI_FORMAT_R32G32_SINT: + case DXGI_FORMAT_R32G8X24_TYPELESS: + case DXGI_FORMAT_D32_FLOAT_S8X24_UINT: + case DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS: + case DXGI_FORMAT_X32_TYPELESS_G8X24_UINT: + return 64; + + case DXGI_FORMAT_R10G10B10A2_TYPELESS: + case DXGI_FORMAT_R10G10B10A2_UNORM: + case DXGI_FORMAT_R10G10B10A2_UINT: + case DXGI_FORMAT_R11G11B10_FLOAT: + case DXGI_FORMAT_R8G8B8A8_TYPELESS: + case DXGI_FORMAT_R8G8B8A8_UNORM: + case DXGI_FORMAT_R8G8B8A8_UNORM_SRGB: + case DXGI_FORMAT_R8G8B8A8_UINT: + case DXGI_FORMAT_R8G8B8A8_SNORM: + case DXGI_FORMAT_R8G8B8A8_SINT: + case DXGI_FORMAT_R16G16_TYPELESS: + case DXGI_FORMAT_R16G16_FLOAT: + case DXGI_FORMAT_R16G16_UNORM: + case DXGI_FORMAT_R16G16_UINT: + case DXGI_FORMAT_R16G16_SNORM: + case DXGI_FORMAT_R16G16_SINT: + case DXGI_FORMAT_R32_TYPELESS: + case DXGI_FORMAT_D32_FLOAT: + case DXGI_FORMAT_R32_FLOAT: + case DXGI_FORMAT_R32_UINT: + case DXGI_FORMAT_R32_SINT: + case DXGI_FORMAT_R24G8_TYPELESS: + case DXGI_FORMAT_D24_UNORM_S8_UINT: + case DXGI_FORMAT_R24_UNORM_X8_TYPELESS: + case DXGI_FORMAT_X24_TYPELESS_G8_UINT: + case DXGI_FORMAT_B8G8R8A8_UNORM: + case DXGI_FORMAT_B8G8R8X8_UNORM: + return 32; + + case DXGI_FORMAT_R8G8_TYPELESS: + case DXGI_FORMAT_R8G8_UNORM: + case DXGI_FORMAT_R8G8_UINT: + case DXGI_FORMAT_R8G8_SNORM: + case DXGI_FORMAT_R8G8_SINT: + case DXGI_FORMAT_R16_TYPELESS: + case DXGI_FORMAT_R16_FLOAT: + case DXGI_FORMAT_D16_UNORM: + case DXGI_FORMAT_R16_UNORM: + case DXGI_FORMAT_R16_UINT: + case DXGI_FORMAT_R16_SNORM: + case DXGI_FORMAT_R16_SINT: + case DXGI_FORMAT_B5G6R5_UNORM: + case DXGI_FORMAT_B5G5R5A1_UNORM: + return 16; + + case DXGI_FORMAT_R8_TYPELESS: + case DXGI_FORMAT_R8_UNORM: + case DXGI_FORMAT_R8_UINT: + case DXGI_FORMAT_R8_SNORM: + case DXGI_FORMAT_R8_SINT: + case DXGI_FORMAT_A8_UNORM: + return 8; + + // Compressed format; http://msdn2.microso.../bb694531(VS.85).aspx + case DXGI_FORMAT_BC2_TYPELESS: + case DXGI_FORMAT_BC2_UNORM: + case DXGI_FORMAT_BC2_UNORM_SRGB: + case DXGI_FORMAT_BC3_TYPELESS: + case DXGI_FORMAT_BC3_UNORM: + case DXGI_FORMAT_BC3_UNORM_SRGB: + case DXGI_FORMAT_BC5_TYPELESS: + case DXGI_FORMAT_BC5_UNORM: + case DXGI_FORMAT_BC5_SNORM: + return 128; + + // Compressed format; http://msdn2.microso.../bb694531(VS.85).aspx + case DXGI_FORMAT_R1_UNORM: + case DXGI_FORMAT_BC1_TYPELESS: + case DXGI_FORMAT_BC1_UNORM: + case DXGI_FORMAT_BC1_UNORM_SRGB: + case DXGI_FORMAT_BC4_TYPELESS: + case DXGI_FORMAT_BC4_UNORM: + case DXGI_FORMAT_BC4_SNORM: + return 64; + + // Compressed format; http://msdn2.microso.../bb694531(VS.85).aspx + case DXGI_FORMAT_R9G9B9E5_SHAREDEXP: + return 32; + + // These are compressed, but bit-size information is unclear. + case DXGI_FORMAT_R8G8_B8G8_UNORM: + case DXGI_FORMAT_G8R8_G8B8_UNORM: + return 32; + + case DXGI_FORMAT_UNKNOWN: + default: + return 0; + } +} + +PxU64 D3DX11::getInputHash(const D3D11_INPUT_ELEMENT_DESC* inputDesc, UINT numInputDescs) +{ + enum ShaderInputFlag + { + USE_NONE = 0x00, + USE_POSITION = 0x01, + USE_NORMAL = USE_POSITION << 1, + USE_TANGENT = USE_POSITION << 2, + USE_COLOR = USE_POSITION << 3, + USE_TEXCOORD = USE_POSITION << 4, + NUM_INPUT_TYPES = 5, + }; + + // Each input element gets a certain number of bits in the hash + const PxU8 bitsPerElement = physx::PxMax((PxU8)((sizeof(PxU64) * 8) / numInputDescs), (PxU8)1); + + // Restrict the maximum amount each set of element bits can be shifted + const PxU8 maxSizeShift = physx::PxMin(bitsPerElement, (PxU8)NUM_INPUT_TYPES); + + PxU64 inputHash = 0; + for (UINT i = 0; i < numInputDescs; ++i) + { + if(inputDesc->SemanticName) + { + PxU8 flag = USE_NONE; + + if (Ps::stricmp(inputDesc[i].SemanticName, "TEXCOORD") == 0) + { + flag = USE_TEXCOORD; + } + else if (Ps::stricmp(inputDesc[i].SemanticName, "NORMAL") == 0) + { + flag = USE_NORMAL; + } + else if (Ps::stricmp(inputDesc[i].SemanticName, "TANGENT") == 0) + { + flag = USE_TANGENT; + } + else if (Ps::stricmp(inputDesc[i].SemanticName, "COLOR") == 0) + { + flag = USE_COLOR; + } + else if (Ps::stricmp(inputDesc[i].SemanticName, "POSITION") == 0) + { + flag = USE_POSITION; + } + + static const PxU8 bitsPerDefaultFormat = sizeOfFormatElement(DXGI_FORMAT_R8G8B8A8_UINT); + PX_ASSERT(bitsPerDefaultFormat > 0); + + // Shift the semantic bit depending on the element's relative format size + const PxU8 elementSizeShift = (sizeOfFormatElement(inputDesc[i].Format) / bitsPerDefaultFormat) & maxSizeShift; + + // Shift the semantic bit depending on it's order in the element array + const PxU8 elementOrderShift = (PxU8)(i * bitsPerElement); + + // Add the element's bits to the hash, shifted by it's order in the element array + inputHash |= (flag << (elementSizeShift + elementOrderShift)); + } + } + + return inputHash; +} + + +/******************************************* +* D3D11ShaderIncluder::D3D11ShaderIncluder * +*******************************************/ + +D3D11ShaderIncluder::D3D11ShaderIncluder(const char* assetDir) : m_assetDir(assetDir) {} + +HRESULT D3D11ShaderIncluder::Open( + D3D_INCLUDE_TYPE includeType, + LPCSTR fileName, + LPCVOID parentData, + LPCVOID* data, + UINT* dataSize +) +{ + HRESULT result = D3D11_ERROR_FILE_NOT_FOUND; + + char fullpath[1024]; + Ps::strlcpy(fullpath, 1024, m_assetDir); + Ps::strlcat(fullpath, 1024, "shaders/"); + if (includeType == D3D10_INCLUDE_SYSTEM) + { + Ps::strlcat(fullpath, 1024, "include/"); + } + Ps::strlcat(fullpath, 1024, fileName); + + FILE* file = 0; + PxToolkit::fopen_s(&file, fullpath, "r"); + if (file) + { + fseek(file, 0, SEEK_END); + size_t fileLen = ftell(file); + if (fileLen > 1) + { + fseek(file, 0, SEEK_SET); + char* fileData = new char[fileLen + 1]; + fileLen = fread(fileData, 1, fileLen, file); + fileData[fileLen] = 0; + *data = fileData; + *dataSize = (UINT)fileLen; + } + fclose(file); + result = S_OK; + } + RENDERER_ASSERT(result == S_OK, "Failed to include shader header."); + return result; +} + +HRESULT D3D11ShaderIncluder::Close(LPCVOID data) +{ + delete []((char*)data); + return S_OK; +} + +/*************************************** +* D3D11ShaderCacher::D3D11ShaderCacher * +***************************************/ + +D3D11ShaderCacher::D3D11ShaderCacher(D3D11RendererResourceManager* pResourceManager) +: mResourceManager(pResourceManager) +{ + RENDERER_ASSERT(pResourceManager, "Invalid D3D resource manager"); +} + + +/*************************************** +* D3D11ShaderLoader::D3D11ShaderLoader * +***************************************/ + +D3D11ShaderLoader::D3D11ShaderLoader(D3D11Renderer& renderer) + : mFeatureLevel(renderer.getFeatureLevel()), + mCacher(renderer.getResourceManager()), + mCompiler(renderer.getD3DX11()), + mIncluder(renderer.getAssetDir()), + mDevice(renderer.getD3DDevice()) +{ + RENDERER_ASSERT(mCompiler, "Invalid D3D compiler"); + RENDERER_ASSERT(mDevice, "Invalid D3D device"); +} + +#endif // #if defined(RENDERER_ENABLE_DIRECT3D11) diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11RendererUtils.h b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11RendererUtils.h new file mode 100644 index 00000000..86d42ddc --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11RendererUtils.h @@ -0,0 +1,296 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#ifndef D3D11_RENDERER_UTILS_H +#define D3D11_RENDERER_UTILS_H + +#include <RendererConfig.h> + +#if defined(RENDERER_ENABLE_DIRECT3D11) + +#include "D3D11Renderer.h" +#include "D3D11RendererTraits.h" + +#if !PX_XBOXONE +#include <d3dx11tex.h> +#else +#define D3D10_SHADER_MACRO D3D_SHADER_MACRO +#define LPD3D10INCLUDE LPD3DINCLUDE +#define D3DX11_IMAGE_FILE_FORMAT int +#endif + +struct ID3DX11ThreadPump; + +namespace SampleRenderer +{ + +PX_INLINE PxU32 fast_hash(const char *str, SIZE_T wrdlen) +{ + // "FNV" string hash + const PxU32 PRIME = 1607; + + PxU32 hash32 = 2166136261; + const char *p = str; + + for(; wrdlen >= sizeof(PxU32); wrdlen -= sizeof(PxU32), p += sizeof(PxU32)) { + hash32 = (hash32 ^ *(PxU32 *)p) * PRIME; + } + if (wrdlen & sizeof(PxU16)) { + hash32 = (hash32 ^ *(PxU16*)p) * PRIME; + p += sizeof(PxU16); + } + if (wrdlen & 1) + hash32 = (hash32 ^ *p) * PRIME; + + return hash32 ^ (hash32 >> 16); +} + +class D3D11StringKey +{ +public: + D3D11StringKey(const char* stringKey) : mStringHash(fast_hash(stringKey, strlen(stringKey))) { } + D3D11StringKey(const std::string& stringKey) : mStringHash(fast_hash(stringKey.c_str(), stringKey.length())) { } + bool operator<(const D3D11StringKey& other) const { return mStringHash < other.mStringHash; } +private: + D3D11StringKey(); + PxU32 mStringHash; +}; + +class D3DX11 +{ + friend class D3D11Renderer; +private: + D3DX11(void); + ~D3DX11(void); + +public: + HRESULT compileShaderFromFile(LPCSTR pSrcFile, CONST D3D10_SHADER_MACRO* pDefines, LPD3D10INCLUDE pInclude, + LPCSTR pFunctionName, LPCSTR pProfile, UINT Flags1, UINT Flags2, ID3DX11ThreadPump* pPump, ID3D10Blob** ppShader, ID3D10Blob** ppErrorMsgs, HRESULT* pHResult) const; + HRESULT compileShaderFromMemory(LPCSTR pSrcData, SIZE_T SrcDataLen, LPCSTR pFileName, CONST D3D10_SHADER_MACRO* pDefines, LPD3D10INCLUDE pInclude, + LPCSTR pFunctionName, LPCSTR pProfile, UINT Flags1, UINT Flags2, ID3DX11ThreadPump* pPump, ID3D10Blob** ppShader, ID3D10Blob** ppErrorMsgs, HRESULT* pHResult) const; + HRESULT reflect(LPCVOID pSrcData, SIZE_T SrcDataSize, REFIID pInterface, void** ppReflector); + HRESULT saveTextureToMemory(ID3D11DeviceContext *pContext, ID3D11Resource *pSrcTexture, D3DX11_IMAGE_FILE_FORMAT DestFormat, LPD3D10BLOB *ppDestBuf, UINT Flags); + HRESULT createBlob(SIZE_T Size, ID3DBlob **ppBlob); + +public: + static void processCompileErrors(ID3DBlob* errors); + + static PxU64 getInputHash(const std::vector<D3D11_INPUT_ELEMENT_DESC>& inputElementDesc); + static PxU64 getInputHash(const D3D11_INPUT_ELEMENT_DESC* inputElementDesc, UINT numInputElementDescs); + +private: +#if defined(RENDERER_WINDOWS) + HMODULE m_library; + HMODULE m_compiler_library; + + typedef HRESULT(WINAPI* D3DX11COMPILEFROMFILE)(LPCSTR, CONST D3D10_SHADER_MACRO*, LPD3D10INCLUDE, LPCSTR, LPCSTR, UINT, UINT, ID3DX11ThreadPump*, ID3D10Blob**, ID3D10Blob**, HRESULT*); + D3DX11COMPILEFROMFILE m_pD3DX11CompileFromFile; + typedef HRESULT(WINAPI* D3DX11COMPILEFROMMEMORY)(LPCSTR, SIZE_T, LPCSTR, CONST D3D10_SHADER_MACRO*, LPD3D10INCLUDE, LPCSTR, LPCSTR, UINT, UINT, ID3DX11ThreadPump*, ID3D10Blob**, ID3D10Blob**, HRESULT*); + D3DX11COMPILEFROMMEMORY m_pD3DX11CompileFromMemory; + typedef HRESULT(WINAPI* D3DREFLECT)(LPCVOID, SIZE_T, REFIID, void**); + D3DREFLECT m_pD3DReflect; + typedef HRESULT(WINAPI* D3DX11SAVETEXTURETOMEMORY)(ID3D11DeviceContext *, ID3D11Resource *, D3DX11_IMAGE_FILE_FORMAT, LPD3D10BLOB *, UINT); + D3DX11SAVETEXTURETOMEMORY m_pD3DX11SaveTextureToMemory; + typedef HRESULT(WINAPI* D3DCREATEBLOB)(SIZE_T, ID3DBlob**); + D3DCREATEBLOB m_pD3DCreateBlob; + +#endif + +}; + +class D3D11ShaderIncluder : public ID3DInclude +{ +public: + D3D11ShaderIncluder(const char* assetDir); + +private: + STDMETHOD(Open( + D3D_INCLUDE_TYPE includeType, + LPCSTR fileName, + LPCVOID parentData, + LPCVOID* data, + UINT* dataSize + )); + + STDMETHOD(Close(LPCVOID data)); + + const char* m_assetDir; +}; + + +class D3D11ShaderCacher +{ +public: + D3D11ShaderCacher(D3D11RendererResourceManager* pResourceManager); + + template<typename d3d_type> + bool check(const typename D3DTraits<d3d_type>::key_type& key, + d3d_type*& d3dResource, + ID3DBlob*& d3dResourceBlob) const + { + typename D3DTraits<d3d_type>::value_type value = mResourceManager->hasResource<d3d_type>(key); + d3dResource = value.first; + d3dResourceBlob = value.second; + return !((NULL == d3dResource) || (NULL == d3dResourceBlob)); + } + + template<typename d3d_type> + void cache(const typename D3DTraits<d3d_type>::key_type& key, + const typename D3DTraits<d3d_type>::value_type& value) + { + mResourceManager->registerResource<d3d_type>(key, value); + } + +private: + D3D11ShaderCacher(); + + D3D11RendererResourceManager* mResourceManager; +}; + +static void PxConvertToWchar(const char* inString, WCHAR* outString, int outSize) +{ + // convert to unicode + int succ = MultiByteToWideChar(CP_ACP, 0, inString, -1, outString, outSize); + + // validate + if (succ < 0) + succ = 0; + if (succ < outSize) + outString[succ] = 0; + else if (outString[outSize-1]) + outString[0] = 0; +} + +class D3D11ShaderLoader +{ +public: + D3D11ShaderLoader(D3D11Renderer& renderer); + + template<typename d3d_type> + HRESULT load(typename D3DTraits<d3d_type>::key_type shaderKey, + const char *pShaderPath, + const D3D10_SHADER_MACRO* pDefines, + d3d_type **ppShader = NULL, + ID3DBlob **ppShaderBlob = NULL, + bool bCheckCacheBeforeLoading = true, + bool *pbLoadedFromCache = NULL) + { + HRESULT result = S_OK; + d3d_type* pShader = NULL; + ID3DBlob* pShaderBlob = NULL; + + if (!bCheckCacheBeforeLoading || !mCacher.check<d3d_type>(shaderKey, pShader, pShaderBlob)) + { + result = internalLoad(pShaderPath, pDefines, &pShader, &pShaderBlob); + mCacher.cache<d3d_type>(shaderKey, std::make_pair(pShader, pShaderBlob)); + if (pbLoadedFromCache) *pbLoadedFromCache = false; + } + else if (pbLoadedFromCache) + { + *pbLoadedFromCache = true; + } + + if (SUCCEEDED(result)) + { + if (ppShader) *ppShader = pShader; + if (ppShaderBlob) *ppShaderBlob = pShaderBlob; + } + else + { + RENDERER_ASSERT(0, "Error loading D3D11 shader"); + } + + return result; + } + +protected: + template<typename d3d_type> + HRESULT internalLoad(const char* pShaderName, const D3D10_SHADER_MACRO* pDefines, d3d_type** ppShader, ID3DBlob** ppBlob) + { + HRESULT result = S_OK; + ID3DBlob* pErrorsBlob = NULL; + +#ifdef PX_USE_DX11_PRECOMPILED_SHADERS + //if(pDefines[0].Name == "RENDERER_FRAGMENT") + { + WCHAR bufferWchar[512]; + PxConvertToWchar(pShaderName,bufferWchar,512); + result = D3DReadFileToBlob(bufferWchar,ppBlob); + RENDERER_ASSERT(SUCCEEDED(result) && *ppBlob, "Failed to load precompiled shader."); + + char szBuff[1024]; + sprintf(szBuff,"Precompiled shader loaded: %s \n",pShaderName); + OutputDebugStringA(szBuff); + } +#else + const DWORD shaderFlags = D3DCOMPILE_ENABLE_BACKWARDS_COMPATIBILITY | D3DCOMPILE_PACK_MATRIX_ROW_MAJOR; + + result = mCompiler->compileShaderFromFile( + pShaderName, + pDefines, + &mIncluder, + D3DTraits<d3d_type>::getEntry(), + D3DTraits<d3d_type>::getProfile(mFeatureLevel), + shaderFlags, + 0, + NULL, + ppBlob, + &pErrorsBlob, + NULL + ); + D3DX11::processCompileErrors(pErrorsBlob); + RENDERER_ASSERT(SUCCEEDED(result) && *ppBlob, "Failed to compile shader."); +#endif + + if (SUCCEEDED(result) && *ppBlob) + { + result = D3DTraits<d3d_type>::create(mDevice, (*ppBlob)->GetBufferPointer(), (*ppBlob)->GetBufferSize(), NULL, ppShader); + RENDERER_ASSERT(SUCCEEDED(result) && *ppShader, "Failed to load Fragment Shader."); + } + if (pErrorsBlob) + { + pErrorsBlob->Release(); + } + return result; + } + +private: + D3D11ShaderLoader(); + D3D11ShaderLoader& operator=(const D3D11ShaderLoader&); + + D3D_FEATURE_LEVEL mFeatureLevel; + D3D11ShaderCacher mCacher; + D3D11ShaderIncluder mIncluder; + D3DX11* mCompiler; + ID3D11Device* mDevice; +}; + + +} + +#endif // #if defined(RENDERER_ENABLE_DIRECT3D11) +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11RendererVariableManager.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11RendererVariableManager.cpp new file mode 100644 index 00000000..24f1664a --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11RendererVariableManager.cpp @@ -0,0 +1,722 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#include <RendererConfig.h> + +#if defined(RENDERER_ENABLE_DIRECT3D11) + +#include "D3D11RendererVariableManager.h" + +#include "D3D11Renderer.h" +#include "D3D11RendererTexture2D.h" +#include "D3D11RendererTexture3D.h" +#include "D3D11RendererMemoryMacros.h" +#include "D3D11RendererUtils.h" + +#include "RendererMemoryMacros.h" + +#include <stdio.h> + +using namespace SampleRenderer; +static const PxU32 getShaderTypeKey(D3DType shaderType, RendererMaterial::Pass pass = RendererMaterial::NUM_PASSES) +{ + RENDERER_ASSERT(shaderType < D3DTypes::NUM_SHADER_TYPES && + ((shaderType > 0 && pass == RendererMaterial::NUM_PASSES) || + (shaderType == 0 && pass < RendererMaterial::NUM_PASSES)), + "Invalid shader index"); + // pass = NUM_PASSES for any non-pixel shader + // shaderType = 0 for any pixel shader + // pass + shaderType = UNIQUE for any combination + return (PxU32)shaderType + (PxU32)pass; +} + +static D3DType getD3DType(PxU32 shaderTypeKey) +{ + return D3DType(shaderTypeKey < RendererMaterial::NUM_PASSES ? D3DTypes::SHADER_PIXEL : shaderTypeKey-RendererMaterial::NUM_PASSES); +} + +class D3D11RendererVariableManager::D3D11ConstantBuffer +{ +public: + D3D11ConstantBuffer(ID3D11Buffer* pBuffer = NULL, PxU8* pData = NULL, PxU32 size = 0) + : buffer(pBuffer), + data(pData), + dataSize(size), + bDirty(false), + refCount(1) + { + + } + + ~D3D11ConstantBuffer() + { + RENDERER_ASSERT(refCount == 0, "Constant buffer not released as often as it was created."); + dxSafeRelease(buffer); + DELETEARRAY(data); + } + + void addref() + { + ++refCount; + } + + void release() + { + if(0 == --refCount) + { + delete this; + } + } + + ID3D11Buffer* buffer; + PxU8* data; + PxU32 dataSize; + mutable bool bDirty; + +protected: + PxU32 refCount; +}; + +/**************************************************** +* D3D11RendererVariableManager::D3D11SharedVariable * +****************************************************/ + +class D3D11RendererVariableManager::D3D11SharedVariable : public D3D11RendererMaterial::D3D11BaseVariable +{ + friend class D3D11RendererMaterial; + friend class D3D11RendererVariableManager; +public: + D3D11SharedVariable(const char* name, RendererMaterial::VariableType type, PxU32 offset, D3D11ConstantBuffer* pBuffer) + : D3D11RendererMaterial::D3D11BaseVariable(name, type, offset), m_pBuffer(pBuffer) + { + } + D3D11SharedVariable& operator=(const D3D11SharedVariable&) + { + return *this; + } +protected: + D3D11ConstantBuffer* m_pBuffer; +}; + +/************************************************** +* D3D11RendererVariableManager::D3D11DataVariable * +**************************************************/ + +class D3D11RendererVariableManager::D3D11DataVariable : public D3D11RendererMaterial::D3D11Variable +{ + friend class D3D11RendererMaterial; + friend class D3D11RendererVariableManager; +public: + D3D11DataVariable(const char* name, RendererMaterial::VariableType type, PxU32 offset) + : D3D11Variable(name, type, offset) + { + for (int i = 0; i < NUM_SHADER_TYPES; ++i) + { + m_pData[i] = NULL; + m_pDirtyFlags[i] = NULL; + } + } + + virtual void bind(RendererMaterial::Pass pass, const void* data) + { + for (PxU32 i = getShaderTypeKey(D3DTypes::SHADER_VERTEX); i < NUM_SHADER_TYPES; ++i) + { + internalBind(i, data); + } + internalBind(pass, data); + } + +private: + + void internalBind(PxU32 typeKey, const void* data) + { + if (m_pData[typeKey]) + { + memcpy(m_pData[typeKey], data, getDataSize()); + if (m_pDirtyFlags[typeKey]) + { + *(m_pDirtyFlags[typeKey]) = true; + } + } + } + + void addHandle(D3D11RendererVariableManager::ShaderTypeKey typeKey, PxU8* pData, bool* pDirtyFlag) + { + m_pData[typeKey] = pData; + m_pDirtyFlags[typeKey] = pDirtyFlag; + } + +private: + PxU8* m_pData[NUM_SHADER_TYPES]; + bool* m_pDirtyFlags[NUM_SHADER_TYPES]; +}; + + +/***************************************************** +* D3D11RendererVariableManager::D3D11TextureVariable * +*****************************************************/ + +class D3D11RendererVariableManager::D3D11TextureVariable : public D3D11RendererMaterial::D3D11Variable +{ + friend class D3D11RendererMaterial; + friend class D3D11RendererVariableManager; +public: + D3D11TextureVariable(const char* name, RendererMaterial::VariableType type, PxU32 offset) + : D3D11Variable(name, type, offset) + { + for (int i = 0; i < NUM_SHADER_TYPES; ++i) + { + m_bufferIndex[i] = -1; + } + } + + + virtual void bind(RendererMaterial::Pass pass, const void* data) + { + data = *(void**)data; + //RENDERER_ASSERT(data, "NULL Sampler."); + if (data) + { + for (PxU32 i = getShaderTypeKey(D3DTypes::SHADER_VERTEX); i < NUM_SHADER_TYPES; ++i) + { + internalBind(i, data); + } + internalBind(pass, data); + } + } + +private: + + void internalBind(PxU32 typeKey, const void* data) + { + if (m_bufferIndex[typeKey] != -1) + { + PxU32 bindFlags = getBindFlags(getD3DType(typeKey)); + if (RendererMaterial::VARIABLE_SAMPLER2D == getType()) + static_cast<D3D11RendererTexture2D*>((RendererTexture2D*)data)->bind(m_bufferIndex[typeKey], bindFlags); + else if (RendererMaterial::VARIABLE_SAMPLER3D == getType()) + static_cast<D3D11RendererTexture3D*>((RendererTexture2D*)data)->bind(m_bufferIndex[typeKey], bindFlags); + } + } + + void addHandle(D3D11RendererVariableManager::ShaderTypeKey typeKey, int bufferIndex) + { + m_bufferIndex[typeKey] = bufferIndex; + } + +private: + int m_bufferIndex[NUM_SHADER_TYPES]; +}; + +/******************************* +* D3D11RendererVariableManager * +*******************************/ + +D3D11RendererVariableManager::D3D11RendererVariableManager(D3D11Renderer& renderer, StringSet& cbNames, BindMode bindMode) + : mRenderer(renderer), mSharedBufferNames(cbNames), mBindMode(bindMode) +{ + +} + +D3D11RendererVariableManager::~D3D11RendererVariableManager(void) +{ + while (!mVariables.empty()) + { + delete mVariables.back(), mVariables.pop_back(); + } + + for (PxU32 i = 0; i < NUM_SHADER_TYPES; ++i) + { + for (ResourceBuffersMap::iterator it = mResourceToBuffers[i].begin(); + it != mResourceToBuffers[i].end(); + ++it) + { + for(PxU32 j = 0; j < it->second.size(); ++j) + { + it->second[j]->release(); + } + } + } +} + +class D3D11RendererResourceMapper +{ +public: + D3D11RendererResourceMapper( ID3D11DeviceContext *pContext, ID3D11Resource *pResource, UINT Subresource = 0, D3D11_MAP MapType = D3D11_MAP_WRITE_DISCARD ) + : mpContext(pContext), mpResource(pResource), mSubresource(Subresource) + { + pContext->Map(pResource, Subresource, MapType, NULL, &mMappedResource); + } + + void load(const void* pSrc, size_t srcSize) + { + RENDERER_ASSERT(mMappedResource.pData, "Invalid D3D11 mapped pointer"); + memcpy(mMappedResource.pData, pSrc, srcSize); + } + + ~D3D11RendererResourceMapper() + { + mpContext->Unmap(mpResource, mSubresource); + } + +protected: + ID3D11DeviceContext* mpContext; + ID3D11Resource* mpResource; + UINT mSubresource; + D3D11_MAPPED_SUBRESOURCE mMappedResource; +}; + +class D3D11RendererVariableBinder +{ +public: + D3D11RendererVariableBinder(ID3D11DeviceContext* pContext) + : mContext(pContext) + { + RENDERER_ASSERT(pContext, "Invalid D3D11 device context"); + } + + void bind(const D3DType d3dType, + const D3D11RendererVariableManager::ConstantBuffers* buffers, + D3D11RendererVariableManager::BindMode bindMode) + { + if (buffers && buffers->size() > 0) + { + D3D11RendererVariableManager::D3DBuffers pCBs(buffers->size()); + PxU32 cbIndex = 0; + for (D3D11RendererVariableManager::CBIterator cbIt = buffers->begin(); + cbIt != buffers->end(); + ++cbIt) + { + if ((*cbIt)->bDirty) + { + if (bindMode == D3D11RendererVariableManager::BIND_MAP) + { + D3D11RendererResourceMapper mappedResource(mContext, (*cbIt)->buffer); + mappedResource.load((*cbIt)->data, (*cbIt)->dataSize); + } + else + { + mContext->UpdateSubresource((*cbIt)->buffer, 0, NULL, (*cbIt)->data, 0, 0); + } + + (*cbIt)->bDirty = false; + } + pCBs[cbIndex++] = (*cbIt)->buffer; + } + switch (d3dType) + { + case D3DTypes::SHADER_PIXEL: D3DTraits<ID3D11PixelShader>::setConstants(mContext, 0, (UINT)pCBs.size(), &pCBs[0]); + break; + case D3DTypes::SHADER_VERTEX: D3DTraits<ID3D11VertexShader>::setConstants(mContext, 0, (UINT)pCBs.size(), &pCBs[0]); + break; + case D3DTypes::SHADER_GEOMETRY: D3DTraits<ID3D11GeometryShader>::setConstants(mContext, 0, (UINT)pCBs.size(), &pCBs[0]); + break; + case D3DTypes::SHADER_HULL: D3DTraits<ID3D11HullShader>::setConstants(mContext, 0, (UINT)pCBs.size(), &pCBs[0]); + break; + case D3DTypes::SHADER_DOMAIN: D3DTraits<ID3D11DomainShader>::setConstants(mContext, 0, (UINT)pCBs.size(), &pCBs[0]); + break; + default: + RENDERER_ASSERT(0, "Invalid D3D type"); + break; + } + } + + } + +private: + D3D11RendererVariableBinder(); + ID3D11DeviceContext* mContext; +}; + +void D3D11RendererVariableManager::bind(const void* pResource, D3DType type, RendererMaterial::Pass pass) const +{ + ID3D11DeviceContext* d3dDeviceContext = mRenderer.getD3DDeviceContext(); + ShaderTypeKey typeKey = getShaderTypeKey(type, pass); + + if (pResource && d3dDeviceContext && typeKey < NUM_SHADER_TYPES) + { + ResourceBuffersMap::const_iterator cbIterator = mResourceToBuffers[typeKey].find(pResource); + const ConstantBuffers* cb = (cbIterator != mResourceToBuffers[typeKey].end()) ? &(cbIterator->second) : NULL; + + D3D11RendererVariableBinder binder(d3dDeviceContext); + binder.bind(type, cb, mBindMode); + } +} + +void D3D11RendererVariableManager::setSharedVariable(const char* sharedBufferName, const char* variableName, const void* data, UINT size, UINT offset) +{ + NameVariablesMap::const_iterator svIt = mNameToSharedVariables.find(VariableKey(sharedBufferName, variableName)); + if (svIt != mNameToSharedVariables.end() && svIt->second) + { + D3D11SharedVariable* pSV = svIt->second; + RENDERER_ASSERT(pSV, "Invalid shared variable"); + internalSetVariable(pSV->m_pBuffer, pSV->getDataOffset()+offset, data, size ? size : pSV->getDataSize()); + } + else + { +#if RENDERER_ASSERT_SHARED_VARIABLE_EXISTS + RENDERER_ASSERT(0, "Shared variable has not been created!"); +#endif + } +} + +void D3D11RendererVariableManager::internalSetVariable(D3D11ConstantBuffer* pBuffer, PxU32 offset, const void* data, PxU32 size) +{ + RENDERER_ASSERT(pBuffer, "Invalid constant buffer"); + memcpy(pBuffer->data + offset, data, size); + pBuffer->bDirty = true; +} + +static RendererMaterial::VariableType getVariableType(const D3D11_SHADER_TYPE_DESC& desc) +{ + RendererMaterial::VariableType vt = RendererMaterial::NUM_VARIABLE_TYPES; + switch (desc.Type) + { + case D3D_SVT_INT: + if (desc.Rows == 1 && desc.Columns == 1) + { + vt = RendererMaterial::VARIABLE_INT; + } + break; + case D3D_SVT_FLOAT: + if (desc.Rows == 4 && desc.Columns == 4) + { + vt = RendererMaterial::VARIABLE_FLOAT4x4; + } + else if (desc.Rows == 1 && desc.Columns == 1) + { + vt = RendererMaterial::VARIABLE_FLOAT; + } + else if (desc.Rows == 1 && desc.Columns == 2) + { + vt = RendererMaterial::VARIABLE_FLOAT2; + } + else if (desc.Rows == 1 && desc.Columns == 3) + { + vt = RendererMaterial::VARIABLE_FLOAT3; + } + else if (desc.Rows == 1 && desc.Columns == 4) + { + vt = RendererMaterial::VARIABLE_FLOAT4; + } + break; + case D3D_SVT_SAMPLER2D: + vt = RendererMaterial::VARIABLE_SAMPLER2D; + break; + case D3D_SVT_SAMPLER3D: + vt = RendererMaterial::VARIABLE_SAMPLER3D; + break; + } + RENDERER_ASSERT(vt < RendererMaterial::NUM_VARIABLE_TYPES, "Unable to convert shader variable type."); + return vt; +} + +D3D11RendererVariableManager::D3D11ConstantBuffer* +D3D11RendererVariableManager::loadBuffer(std::vector<D3D11RendererMaterial::Variable*>& variables, + PxU32& variableBufferSize, + ShaderTypeKey typeKey, + ID3D11ShaderReflectionConstantBuffer* pReflectionBuffer, + const D3D11_SHADER_BUFFER_DESC& sbDesc, + const D3D11_BUFFER_DESC& cbDesc) +{ + ID3D11Buffer* pBuffer = NULL; + D3D11ConstantBuffer* pCB = NULL; + HRESULT result = mRenderer.getD3DDevice()->CreateBuffer(&cbDesc, NULL, &pBuffer); + RENDERER_ASSERT(SUCCEEDED(result), "Error creating D3D11 constant buffer."); + if (SUCCEEDED(result)) + { + pCB = new D3D11ConstantBuffer(pBuffer, new PxU8[sbDesc.Size], sbDesc.Size); + + try + { + for (PxU32 i = 0; i < sbDesc.Variables; ++i) + { + ID3D11ShaderReflectionVariable* pVariable = pReflectionBuffer->GetVariableByIndex(i); + D3D11_SHADER_VARIABLE_DESC vDesc; + pVariable->GetDesc(&vDesc); + + ID3D11ShaderReflectionType* pType = pVariable->GetType(); + D3D11_SHADER_TYPE_DESC tDesc; + pType->GetDesc(&tDesc); + + RendererMaterial::VariableType type = getVariableType(tDesc); + + D3D11DataVariable* var = 0; + + // Search to see if the variable already exists... + PxU32 numVariables = (PxU32)variables.size(); + for (PxU32 j = 0; j < numVariables; ++j) + { + if (!strcmp(variables[j]->getName(), vDesc.Name)) + { + var = static_cast<D3D11DataVariable*>(variables[j]); + break; + } + } + + // Check to see if the variable is of the same type. + if (var) + { + RENDERER_ASSERT(var->getType() == type, "Variable changes type!"); + } + + // If we couldn't find the variable... create a new variable... + if (!var) + { + var = new D3D11DataVariable(vDesc.Name, type, variableBufferSize); + variables.push_back(var); + variableBufferSize += var->getDataSize(); + } + + PxU8* varData = pCB->data + vDesc.StartOffset; + var->addHandle(typeKey, varData, &(pCB->bDirty)); + } + } + catch(...) + { + RENDERER_ASSERT(0, "Exception in processing D3D shader variables"); + delete pCB; + } + + } + return pCB; +} + +D3D11RendererVariableManager::D3D11ConstantBuffer* +D3D11RendererVariableManager::loadSharedBuffer(ShaderTypeKey typeKey, + ID3D11ShaderReflectionConstantBuffer* pReflectionBuffer, + const D3D11_SHADER_BUFFER_DESC& sbDesc, + const D3D11_BUFFER_DESC& cbDesc) +{ + D3D11ConstantBuffer* pCB = NULL; + // Check to see if the specified shared constant buffer has already been created + NameBuffersMap::iterator cbIt = mNameToSharedBuffer.find(sbDesc.Name); + if (cbIt != mNameToSharedBuffer.end()) + { + pCB = cbIt->second; + if( pCB ) + { + pCB->addref(); + } + } + else + { + ID3D11Buffer* pBuffer = NULL; + HRESULT result = mRenderer.getD3DDevice()->CreateBuffer(&cbDesc, NULL, &pBuffer); + RENDERER_ASSERT(SUCCEEDED(result), "Error creating D3D11 constant buffer."); + if (SUCCEEDED(result)) + { + pCB = new D3D11ConstantBuffer(pBuffer, new PxU8[sbDesc.Size], sbDesc.Size); + for (PxU32 i = 0; i < sbDesc.Variables; ++i) + { + ID3D11ShaderReflectionVariable* pVariable = pReflectionBuffer->GetVariableByIndex(i); + D3D11_SHADER_VARIABLE_DESC vDesc; + pVariable->GetDesc(&vDesc); + + ID3D11ShaderReflectionType* pType = pVariable->GetType(); + D3D11_SHADER_TYPE_DESC tDesc; + pType->GetDesc(&tDesc); + + mVariables.push_back(new D3D11SharedVariable(vDesc.Name, getVariableType(tDesc), vDesc.StartOffset, pCB)); + mNameToSharedVariables[VariableKey(sbDesc.Name, vDesc.Name)] = mVariables.back(); + } + mNameToSharedBuffer[sbDesc.Name] = pCB; + } + } + + return pCB; +} + +void D3D11RendererVariableManager::loadVariables(D3D11RendererMaterial* pMaterial, + ID3DBlob* pShader, + D3DType type, + RendererMaterial::Pass pass) +{ + D3DX11* pD3DX = mRenderer.getD3DX11(); + RENDERER_ASSERT(pD3DX, "Invalid D3D11 shader compiler"); + + ID3D11ShaderReflection* pReflection = NULL; + HRESULT result = pD3DX->reflect(pShader->GetBufferPointer(), + pShader->GetBufferSize(), + IID_ID3D11ShaderReflection, + (void**) &pReflection); + + RENDERER_ASSERT(SUCCEEDED(result) && pReflection, "Failure in processing D3D11 shader reflection") + if (SUCCEEDED(result) && pReflection) + { + loadConstantVariables(pMaterial, pShader, getShaderTypeKey(type, pass), pReflection, &pMaterial->m_variables, &pMaterial->m_variableBufferSize); + loadTextureVariables(pMaterial, pShader, getShaderTypeKey(type, pass), pReflection); + } +} + +void D3D11RendererVariableManager::loadSharedVariables(const void* pResource, + ID3DBlob* pShader, + D3DType type, + RendererMaterial::Pass pass) +{ + D3DX11* pD3DX = mRenderer.getD3DX11(); + RENDERER_ASSERT(pD3DX, "Invalid D3D11 shader compiler"); + + ID3D11ShaderReflection* pReflection = NULL; + HRESULT result = pD3DX->reflect(pShader->GetBufferPointer(), + pShader->GetBufferSize(), + IID_ID3D11ShaderReflection, + (void**) &pReflection); + + RENDERER_ASSERT(SUCCEEDED(result) && pReflection, "Failure in processing D3D11 shader reflection") + if (SUCCEEDED(result) && pReflection) + { + loadConstantVariables(pResource, pShader, getShaderTypeKey(type, pass), pReflection); + } +} + +void D3D11RendererVariableManager::loadConstantVariables(const void* pResource, + ID3DBlob* pShader, + ShaderTypeKey typeKey, + ID3D11ShaderReflection* pReflection, + MaterialVariables* pVariables, + PxU32* pVariableBufferSize) +{ + D3D11_SHADER_DESC desc; + pReflection->GetDesc(&desc); + + for (PxU32 i = 0; i < desc.ConstantBuffers; ++i) + { + D3D11_BUFFER_DESC cbDesc; + cbDesc.CPUAccessFlags = (mBindMode == BIND_MAP) ? D3D11_CPU_ACCESS_WRITE : 0; + cbDesc.Usage = (mBindMode == BIND_MAP) ? D3D11_USAGE_DYNAMIC : D3D11_USAGE_DEFAULT; + cbDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER; + cbDesc.MiscFlags = 0; + + ID3D11ShaderReflectionConstantBuffer* pConstBuffer = pReflection->GetConstantBufferByIndex(i); + + D3D11_SHADER_BUFFER_DESC sbDesc; + pConstBuffer->GetDesc(&sbDesc); + cbDesc.ByteWidth = sbDesc.Size; + + D3D11ConstantBuffer* pCB = NULL; + // Check to see if the constant buffer's name has been specified as s shared buffer + if (mSharedBufferNames.find(sbDesc.Name) != mSharedBufferNames.end()) + { + pCB = loadSharedBuffer(typeKey, pConstBuffer, sbDesc, cbDesc); + } + else if (pVariables && pVariableBufferSize) + { + pCB = loadBuffer(*pVariables, *pVariableBufferSize, typeKey, pConstBuffer, sbDesc, cbDesc); + } + else + { + RENDERER_ASSERT(0, "Only materials support non-shared variables."); + } + + RENDERER_ASSERT(pCB, "Error creating shared buffer"); + if (pCB) + { + mResourceToBuffers[typeKey][pResource].push_back(pCB); + } + } +} + +RendererMaterial::VariableType getTextureVariableType(const D3D11_SHADER_INPUT_BIND_DESC& resourceDesc) +{ + switch (resourceDesc.Dimension) + { + case D3D_SRV_DIMENSION_TEXTURE1D: + case D3D_SRV_DIMENSION_TEXTURE2D: + return RendererMaterial::VARIABLE_SAMPLER2D; + case D3D_SRV_DIMENSION_TEXTURE3D: + return RendererMaterial::VARIABLE_SAMPLER3D; + default: + RENDERER_ASSERT(0, "Invalid texture type."); + return RendererMaterial::NUM_VARIABLE_TYPES; + } +} + +void D3D11RendererVariableManager::loadTextureVariables(D3D11RendererMaterial* pMaterial, + ID3DBlob* pShader, + ShaderTypeKey typeKey, + ID3D11ShaderReflection* pReflection) +{ + D3D11_SHADER_DESC desc; + pReflection->GetDesc(&desc); + + // Load texture variables for the specified shader + for (PxU32 i = 0; i < desc.BoundResources; ++i) + { + D3D11_SHADER_INPUT_BIND_DESC resourceDesc; + HRESULT result = pReflection->GetResourceBindingDesc(i, &resourceDesc); + if (SUCCEEDED(result) && resourceDesc.Type == D3D10_SIT_TEXTURE) + { + D3D11TextureVariable* var = NULL; + // Search to see if the variable already exists... + PxU32 numVariables = (PxU32)pMaterial->m_variables.size(); + for (PxU32 j = 0; j < numVariables; ++j) + { + if (!strcmp(pMaterial->m_variables[j]->getName(), resourceDesc.Name)) + { + var = static_cast<D3D11TextureVariable*>(pMaterial->m_variables[j]); + break; + } + } + + RendererMaterial::VariableType varType = getTextureVariableType(resourceDesc); + + // Check to see if the variable is of the same type. + if (var) + { + RENDERER_ASSERT(var->getType() == varType, "Variable changes type!"); + } + + // If we couldn't find the variable... create a new variable... + if (!var && (varType == RendererMaterial::VARIABLE_SAMPLER2D || varType == RendererMaterial::VARIABLE_SAMPLER3D) ) + { + var = new D3D11TextureVariable(resourceDesc.Name, varType, pMaterial->m_variableBufferSize); + pMaterial->m_variables.push_back(var); + pMaterial->m_variableBufferSize += var->getDataSize(); + } + + var->addHandle(typeKey, resourceDesc.BindPoint); + } + } +} + +void D3D11RendererVariableManager::unloadVariables( const void* pResource ) +{ + for (PxU32 i = 0; i < NUM_SHADER_TYPES; ++i) + { + ResourceBuffersMap::iterator it = mResourceToBuffers[i].find(pResource); + if (it != mResourceToBuffers[i].end()) + { + for (PxU32 j = 0; j < it->second.size(); ++j) + { + it->second[j]->release(); + } + mResourceToBuffers[i].erase(it); + } + } +} +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11RendererVariableManager.h b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11RendererVariableManager.h new file mode 100644 index 00000000..fdd8a86c --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11RendererVariableManager.h @@ -0,0 +1,152 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#ifndef D3D11_RENDERER_VARIABLE_MANAGER_H +#define D3D11_RENDERER_VARIABLE_MANAGER_H + +#include <RendererConfig.h> + +#if defined(RENDERER_ENABLE_DIRECT3D11) + +#include <RendererMaterial.h> + +#include "D3D11RendererMaterial.h" +#include "D3D11RendererTraits.h" +#include "D3D11RendererUtils.h" +#include "D3Dcompiler.h" + +#include <set> +#include <string> +#include <limits> + +// Enable to check that binding a shared variable by name actually +// finds the specified shared variable +#define RENDERER_ASSERT_SHARED_VARIABLE_EXISTS 0 + +namespace SampleRenderer +{ + +static const PxU32 NUM_SHADER_TYPES = D3DTypes::NUM_SHADER_TYPES + RendererMaterial::NUM_PASSES; + +class D3D11RendererVariableManager +{ +public: + enum SharedVariableSize + { + USE_DEFAULT = 0, + }; + + enum BindMode + { + BIND_MAP = 0, + BIND_SUBRESOURCE + }; + +public: + typedef std::set<std::string> StringSet; + + D3D11RendererVariableManager(D3D11Renderer& renderer, StringSet& cbNames, BindMode bindMode = BIND_SUBRESOURCE); + virtual ~D3D11RendererVariableManager(void); + +public: + void bind(const void* pResource, D3DType shaderType, RendererMaterial::Pass pass = RendererMaterial::NUM_PASSES) const; + void setSharedVariable(const char* sharedBufferName, const char* variableName, const void* data, UINT size = USE_DEFAULT, UINT offset = 0); + void loadVariables(D3D11RendererMaterial* pMaterial, ID3DBlob* pShader, D3DType shaderType, RendererMaterial::Pass pass = RendererMaterial::NUM_PASSES); + void loadSharedVariables(const void* pResource, ID3DBlob* pShader, D3DType shaderType, RendererMaterial::Pass pass = RendererMaterial::NUM_PASSES); + void unloadVariables(const void* pResource); + + class D3D11ConstantBuffer; + class D3D11DataVariable; + class D3D11TextureVariable; + class D3D11SharedVariable; + + typedef std::vector<D3D11ConstantBuffer*> ConstantBuffers; + typedef std::vector<ID3D11Buffer*> D3DBuffers; + typedef std::vector<D3D11SharedVariable*> Variables; + typedef std::vector<D3D11RendererMaterial::Variable*> MaterialVariables; + + typedef D3D11StringKey StringKey; + typedef const void* ResourceKey; + typedef PxU32 ShaderTypeKey; + typedef std::pair<StringKey, StringKey> VariableKey; + + typedef std::map<StringKey, D3D11ConstantBuffer*> NameBuffersMap; + typedef std::map<VariableKey, D3D11SharedVariable*> NameVariablesMap; + typedef std::map<ResourceKey, ConstantBuffers> ResourceBuffersMap; + + typedef ConstantBuffers::const_iterator CBIterator; + +private: + D3D11RendererVariableManager& operator=(const D3D11RendererVariableManager&) + { + return *this; + } + + D3D11ConstantBuffer* loadBuffer(MaterialVariables& variables, + PxU32& variableBufferSize, + ShaderTypeKey typeKey, + ID3D11ShaderReflectionConstantBuffer* pReflectionBuffer, + const D3D11_SHADER_BUFFER_DESC& sbDesc, + const D3D11_BUFFER_DESC& cbDesc); + D3D11ConstantBuffer* loadSharedBuffer(ShaderTypeKey typeKey, + ID3D11ShaderReflectionConstantBuffer* pReflectionBuffer, + const D3D11_SHADER_BUFFER_DESC& sbDesc, + const D3D11_BUFFER_DESC& cbDesc); + + void loadConstantVariables(const void* pResource, + ID3DBlob* pShader, + ShaderTypeKey typeKey, + ID3D11ShaderReflection* pReflection, + MaterialVariables* pVariables = NULL, + PxU32* pVariableBufferSize = NULL); + void loadTextureVariables(D3D11RendererMaterial* pMaterial, + ID3DBlob* pShader, + ShaderTypeKey typeKey, + ID3D11ShaderReflection* pReflection); + + void internalSetVariable(D3D11ConstantBuffer* pBuffer, PxU32 offset, const void* data, PxU32 size); + void updateVariables(const ConstantBuffers*) const; + void bindVariables(const ConstantBuffers*, bool bFragment) const; + +private: + + D3D11Renderer& mRenderer; + StringSet mSharedBufferNames; + + BindMode mBindMode; + + Variables mVariables; + + NameBuffersMap mNameToSharedBuffer; + NameVariablesMap mNameToSharedVariables; + + ResourceBuffersMap mResourceToBuffers[NUM_SHADER_TYPES]; +}; + +} // namespace SampleRenderer + +#endif // #if defined(RENDERER_ENABLE_DIRECT3D11) +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11RendererVertexBuffer.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11RendererVertexBuffer.cpp new file mode 100644 index 00000000..88c6ba25 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11RendererVertexBuffer.cpp @@ -0,0 +1,374 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#include <RendererConfig.h> + +#if defined(RENDERER_ENABLE_DIRECT3D11) + +#include "D3D11RendererVertexBuffer.h" +#include <RendererVertexBufferDesc.h> + +#if PX_WINDOWS +#include <task/PxTask.h> +#endif + +using namespace SampleRenderer; + +static D3D_FEATURE_LEVEL gFeatureLevel = D3D_FEATURE_LEVEL_9_1; + +static D3D11_INPUT_ELEMENT_DESC buildVertexElement(LPCSTR name, UINT index, DXGI_FORMAT format, UINT inputSlot, UINT alignedByOffset, D3D11_INPUT_CLASSIFICATION inputSlotClass, UINT instanceDataStepRate) +{ + D3D11_INPUT_ELEMENT_DESC element; + element.SemanticName = name; + element.SemanticIndex = index; + element.Format = format; + element.InputSlot = inputSlot; + element.AlignedByteOffset = alignedByOffset; + element.InputSlotClass = inputSlotClass; + element.InstanceDataStepRate = instanceDataStepRate; + return element; +} + +static DXGI_FORMAT getD3DFormat(RendererVertexBuffer::Format format) +{ + DXGI_FORMAT d3dFormat = DXGI_FORMAT_UNKNOWN; + if(gFeatureLevel <= D3D_FEATURE_LEVEL_9_3) + { + switch (format) + { + case RendererVertexBuffer::FORMAT_FLOAT1: + d3dFormat = DXGI_FORMAT_R32_FLOAT; + break; + case RendererVertexBuffer::FORMAT_FLOAT2: + d3dFormat = DXGI_FORMAT_R32G32_FLOAT; + break; + case RendererVertexBuffer::FORMAT_FLOAT3: + d3dFormat = DXGI_FORMAT_R32G32B32_FLOAT; + break; + case RendererVertexBuffer::FORMAT_FLOAT4: + d3dFormat = DXGI_FORMAT_R32G32B32A32_FLOAT; + break; + case RendererVertexBuffer::FORMAT_UBYTE4: + d3dFormat = DXGI_FORMAT_R8G8B8A8_UINT; + break; + case RendererVertexBuffer::FORMAT_USHORT4: + d3dFormat = DXGI_FORMAT_R16G16B16A16_UINT; + break; + case RendererVertexBuffer::FORMAT_COLOR_BGRA: + d3dFormat = DXGI_FORMAT_R8G8B8A8_UINT; + break; + case RendererVertexBuffer::FORMAT_COLOR_RGBA: + d3dFormat = DXGI_FORMAT_R8G8B8A8_UINT; + break; + case RendererVertexBuffer::FORMAT_COLOR_NATIVE: + d3dFormat = DXGI_FORMAT_R32_FLOAT; + break; + } + } + else + { + switch (format) + { + case RendererVertexBuffer::FORMAT_FLOAT1: + d3dFormat = DXGI_FORMAT_R32_FLOAT; + break; + case RendererVertexBuffer::FORMAT_FLOAT2: + d3dFormat = DXGI_FORMAT_R32G32_FLOAT; + break; + case RendererVertexBuffer::FORMAT_FLOAT3: + d3dFormat = DXGI_FORMAT_R32G32B32_FLOAT; + break; + case RendererVertexBuffer::FORMAT_FLOAT4: + d3dFormat = DXGI_FORMAT_R32G32B32A32_FLOAT; + break; + case RendererVertexBuffer::FORMAT_UBYTE4: + d3dFormat = DXGI_FORMAT_R8G8B8A8_UINT; + break; + case RendererVertexBuffer::FORMAT_USHORT4: + d3dFormat = DXGI_FORMAT_R16G16B16A16_UINT; + break; + case RendererVertexBuffer::FORMAT_COLOR_BGRA: + d3dFormat = DXGI_FORMAT_B8G8R8A8_UNORM; + break; + case RendererVertexBuffer::FORMAT_COLOR_RGBA: + d3dFormat = DXGI_FORMAT_R8G8B8A8_UNORM; + break; + case RendererVertexBuffer::FORMAT_COLOR_NATIVE: + //d3dFormat = DXGI_FORMAT_R32G32B32_FLOAT; + d3dFormat = DXGI_FORMAT_R8G8B8A8_UNORM; + break; + } + } + RENDERER_ASSERT(d3dFormat != DXGI_FORMAT_UNKNOWN, "Invalid DIRECT3D11 vertex type."); + return d3dFormat; +} + +static void getD3DUsage(RendererVertexBuffer::Semantic semantic, LPCSTR& usageName, PxU8& usageIndex) +{ + usageName = "POSITION"; + usageIndex = 0; + if (semantic >= RendererVertexBuffer::SEMANTIC_TEXCOORD0 && semantic <= RendererVertexBuffer::SEMANTIC_TEXCOORDMAX) + { + usageName = "TEXCOORD"; + usageIndex = (PxU8)(semantic - RendererVertexBuffer::SEMANTIC_TEXCOORD0); + } + else + { + switch (semantic) + { + case RendererVertexBuffer::SEMANTIC_POSITION: + usageName = "POSITION"; + break; + case RendererVertexBuffer::SEMANTIC_NORMAL: + usageName = "NORMAL"; + break; + case RendererVertexBuffer::SEMANTIC_TANGENT: + usageName = "TANGENT"; + break; + case RendererVertexBuffer::SEMANTIC_COLOR: + usageName = "COLOR"; + break; + case RendererVertexBuffer::SEMANTIC_BONEINDEX: + usageName = "TEXCOORD"; + usageIndex = RENDERER_BONEINDEX_CHANNEL; + break; + case RendererVertexBuffer::SEMANTIC_BONEWEIGHT: + usageName = "TEXCOORD"; + usageIndex = RENDERER_BONEWEIGHT_CHANNEL; + break; + case RendererVertexBuffer::SEMANTIC_DISPLACEMENT_TEXCOORD: + usageName = "TEXCOORD"; + usageIndex = RENDERER_DISPLACEMENT_CHANNEL; + break; + case RendererVertexBuffer::SEMANTIC_DISPLACEMENT_FLAGS: + usageName = "TEXCOORD"; + usageIndex = RENDERER_DISPLACEMENT_FLAGS_CHANNEL; + break; + } + } +} + +D3D11RendererVertexBuffer::D3D11RendererVertexBuffer(ID3D11Device& d3dDevice, ID3D11DeviceContext& d3dDeviceContext, const RendererVertexBufferDesc& desc, bool bUseMapForLocking) : + RendererVertexBuffer(desc), + m_d3dDevice(d3dDevice), + m_d3dDeviceContext(d3dDeviceContext), + m_d3dVertexBuffer(NULL), + m_bUseMapForLocking(bUseMapForLocking && (!desc.registerInCUDA)), + m_buffer(NULL) +{ + gFeatureLevel = d3dDevice.GetFeatureLevel(); + + memset(&m_d3dBufferDesc, 0, sizeof(D3D11_BUFFER_DESC)); + m_d3dBufferDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER; + m_d3dBufferDesc.ByteWidth = (UINT)(desc.maxVertices * m_stride); + + if (m_bUseMapForLocking) + { + m_d3dBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; + m_d3dBufferDesc.Usage = D3D11_USAGE_DYNAMIC; + } + else + { + m_d3dBufferDesc.CPUAccessFlags = 0; + m_d3dBufferDesc.Usage = D3D11_USAGE_DEFAULT; + m_buffer = new PxU8[m_d3dBufferDesc.ByteWidth]; + memset(m_buffer, 0, sizeof(PxU8)*m_d3dBufferDesc.ByteWidth); + } + + m_bBufferWritten = false; + + onDeviceReset(); + + if (m_d3dVertexBuffer) + { + m_maxVertices = desc.maxVertices; + } +} + +D3D11RendererVertexBuffer::~D3D11RendererVertexBuffer(void) +{ + if (m_d3dVertexBuffer) + { +#if PX_WINDOWS && PX_SUPPORT_GPU_PHYSX + if (m_interopContext && m_registeredInCUDA) + { + m_registeredInCUDA = !m_interopContext->unregisterResourceInCuda(m_InteropHandle); + } +#endif + m_d3dVertexBuffer->Release(); + m_d3dVertexBuffer = NULL; + } + + delete [] m_buffer; +} + +void D3D11RendererVertexBuffer::addVertexElements(PxU32 streamIndex, std::vector<D3D11_INPUT_ELEMENT_DESC> &vertexElements) const +{ + for (PxU32 i = 0; i < NUM_SEMANTICS; i++) + { + Semantic semantic = (Semantic)i; + const SemanticDesc& sm = m_semanticDescs[semantic]; + if (sm.format < NUM_FORMATS) + { + PxU8 d3dUsageIndex = 0; + LPCSTR d3dUsageName = ""; + getD3DUsage(semantic, d3dUsageName, d3dUsageIndex); + vertexElements.push_back(buildVertexElement(d3dUsageName, + d3dUsageIndex, + getD3DFormat(sm.format), + streamIndex, + (UINT)sm.offset, + D3D11_INPUT_PER_VERTEX_DATA, + 0)); + } + } +} + +void D3D11RendererVertexBuffer::swizzleColor(void* colors, PxU32 stride, PxU32 numColors, RendererVertexBuffer::Format inFormat) +{ +/* + if (inFormat == RendererVertexBuffer::FORMAT_COLOR_BGRA) + { + const void* end = ((PxU8*)colors) + (stride * numColors); + for (PxU8* iterator = (PxU8*)colors; iterator < end; iterator += stride) + { + std::swap(((PxU8*)iterator)[0], ((PxU8*)iterator)[2]); + } + } +*/ +} + +void* D3D11RendererVertexBuffer::lock(void) +{ + // For now NO_OVERWRITE is the only mapping that functions properly + return internalLock(getHint() == HINT_STATIC ? /* D3D11_MAP_WRITE_DISCARD */ D3D11_MAP_WRITE_NO_OVERWRITE : D3D11_MAP_WRITE_NO_OVERWRITE); +} + +void* D3D11RendererVertexBuffer::internalLock(D3D11_MAP MapType) +{ + void* lockedBuffer = 0; + if (m_d3dVertexBuffer) + { + if (m_bUseMapForLocking) + { + D3D11_MAPPED_SUBRESOURCE mappedRead; + m_d3dDeviceContext.Map(m_d3dVertexBuffer, 0, MapType, NULL, &mappedRead); + RENDERER_ASSERT(mappedRead.pData, "Failed to lock DIRECT3D11 Vertex Buffer."); + lockedBuffer = mappedRead.pData; + } + else + { + lockedBuffer = m_buffer; + } + } + m_bBufferWritten = true; + return lockedBuffer; +} + +void D3D11RendererVertexBuffer::unlock(void) +{ + if (m_d3dVertexBuffer) + { + if (m_bUseMapForLocking) + { + m_d3dDeviceContext.Unmap(m_d3dVertexBuffer, 0); + } + else + { + m_d3dDeviceContext.UpdateSubresource(m_d3dVertexBuffer, 0, NULL, m_buffer, m_d3dBufferDesc.ByteWidth, 0); + } + } +} + +void D3D11RendererVertexBuffer::bind(PxU32 streamID, PxU32 firstVertex) +{ + prepareForRender(); + if (m_d3dVertexBuffer) + { + ID3D11Buffer* pBuffers[1] = { m_d3dVertexBuffer }; + UINT strides[1] = { m_stride }; + UINT offsets[1] = { firstVertex* m_stride }; + m_d3dDeviceContext.IASetVertexBuffers(streamID, 1, pBuffers, strides, offsets); + } +} + +void D3D11RendererVertexBuffer::unbind(PxU32 streamID) +{ + ID3D11Buffer* pBuffers[1] = { NULL }; + UINT strides[1] = { 0 }; + UINT offsets[1] = { 0 }; + m_d3dDeviceContext.IASetVertexBuffers(streamID, 1, pBuffers, strides, offsets); +} + +void D3D11RendererVertexBuffer::onDeviceLost(void) +{ +#if PX_WINDOWS && PX_SUPPORT_GPU_PHYSX + if (m_interopContext && m_registeredInCUDA) + { + m_interopContext->unregisterResourceInCuda(m_InteropHandle); + } +#endif + + m_registeredInCUDA = false; + + if (m_d3dVertexBuffer) + { + m_d3dVertexBuffer->Release(); + m_d3dVertexBuffer = 0; + } +} + +void D3D11RendererVertexBuffer::onDeviceReset(void) +{ + if (!m_d3dVertexBuffer) + { + m_d3dDevice.CreateBuffer(&m_d3dBufferDesc, NULL, &m_d3dVertexBuffer); + RENDERER_ASSERT(m_d3dVertexBuffer, "Failed to create DIRECT3D11 Vertex Buffer."); +#if PX_WINDOWS && PX_SUPPORT_GPU_PHYSX + if (m_interopContext && m_d3dVertexBuffer && m_mustBeRegisteredInCUDA) + { + RENDERER_ASSERT(m_deferredUnlock == false, "Deferred VB Unlock must be disabled when CUDA Interop is in use.") + m_registeredInCUDA = m_interopContext->registerResourceInCudaD3D(m_InteropHandle, m_d3dVertexBuffer); + } +#endif + m_bBufferWritten = false; + } +} + +bool D3D11RendererVertexBuffer::checkBufferWritten(void) +{ + if (m_InteropHandle) + { + return true; + } + else + { + return m_bBufferWritten; + } +} + +#endif // #if defined(RENDERER_ENABLE_DIRECT3D11) diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11RendererVertexBuffer.h b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11RendererVertexBuffer.h new file mode 100644 index 00000000..e37e27e3 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d11/D3D11RendererVertexBuffer.h @@ -0,0 +1,79 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#ifndef D3D11_RENDERER_VERTEXBUFFER_H +#define D3D11_RENDERER_VERTEXBUFFER_H + +#include <RendererConfig.h> + +#if defined(RENDERER_ENABLE_DIRECT3D11) + +#include <RendererVertexBuffer.h> +#include "D3D11Renderer.h" + +namespace SampleRenderer +{ + +class D3D11RendererVertexBuffer : public RendererVertexBuffer, public D3D11RendererResource +{ + friend class D3D11Renderer; +public: + D3D11RendererVertexBuffer(ID3D11Device& d3dDevice, ID3D11DeviceContext& d3dDeviceContext, const RendererVertexBufferDesc& desc, bool bUseMapForLocking = TRUE); + virtual ~D3D11RendererVertexBuffer(void); + + void addVertexElements(PxU32 streamIndex, std::vector<D3D11_INPUT_ELEMENT_DESC> &vertexElements) const; + + virtual bool checkBufferWritten(void); + +protected: + virtual void swizzleColor(void* colors, PxU32 stride, PxU32 numColors, RendererVertexBuffer::Format inFormat); + + virtual void* lock(void); + virtual void unlock(void); + + virtual void bind(PxU32 streamID, PxU32 firstVertex); + virtual void unbind(PxU32 streamID); + +private: + virtual void onDeviceLost(void); + virtual void onDeviceReset(void); + + void* internalLock(D3D11_MAP MapType); + +private: + ID3D11Device& m_d3dDevice; + ID3D11DeviceContext& m_d3dDeviceContext; + ID3D11Buffer* m_d3dVertexBuffer; + D3D11_BUFFER_DESC m_d3dBufferDesc; + bool m_bUseMapForLocking; + PxU8* m_buffer; + bool m_bBufferWritten; +}; + +} // namespace SampleRenderer + +#endif // #if defined(RENDERER_ENABLE_DIRECT3D11) +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d9/D3D9Renderer.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d9/D3D9Renderer.cpp new file mode 100644 index 00000000..2c650e4b --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d9/D3D9Renderer.cpp @@ -0,0 +1,1183 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#include <RendererConfig.h> + +#if defined(RENDERER_ENABLE_DIRECT3D9) + +#include "D3D9Renderer.h" + +#include <RendererDesc.h> + +#include <RendererProjection.h> + +#include <RendererVertexBufferDesc.h> +#include "D3D9RendererVertexBuffer.h" + +#include <RendererIndexBufferDesc.h> +#include "D3D9RendererIndexBuffer.h" + +#include <RendererInstanceBufferDesc.h> +#include "D3D9RendererInstanceBuffer.h" + +#include <RendererMeshDesc.h> +#include <RendererMeshContext.h> +#include "D3D9RendererMesh.h" + +#include <RendererMaterialDesc.h> +#include <RendererMaterialInstance.h> +#include "D3D9RendererMaterial.h" + +#include <RendererLightDesc.h> +#include <RendererDirectionalLightDesc.h> +#include "D3D9RendererDirectionalLight.h" +#include <RendererSpotLightDesc.h> +#include "D3D9RendererSpotLight.h" + +#include <RendererTexture2DDesc.h> +#include "D3D9RendererTexture2D.h" + +#include <RendererTargetDesc.h> +#include "D3D9RendererTarget.h" + +#include <SamplePlatform.h> + +using namespace SampleRenderer; + +void SampleRenderer::convertToD3D9(D3DCOLOR &dxcolor, const RendererColor &color) +{ + const float inv255 = 1.0f / 255.0f; + dxcolor = D3DXCOLOR(color.r*inv255, color.g*inv255, color.b*inv255, color.a*inv255); +} + +void SampleRenderer::convertToD3D9(float *dxvec, const PxVec3 &vec) +{ + dxvec[0] = vec.x; + dxvec[1] = vec.y; + dxvec[2] = vec.z; +} + +void SampleRenderer::convertToD3D9(D3DMATRIX &dxmat, const physx::PxMat44 &mat) +{ + PxMat44 mat44 = mat.getTranspose(); + memcpy(&dxmat._11, mat44.front(), 4 * 4 * sizeof (float)); +} + +void SampleRenderer::convertToD3D9(D3DMATRIX &dxmat, const RendererProjection &mat) +{ + float temp[16]; + mat.getColumnMajor44(temp); + for(PxU32 r=0; r<4; r++) + for(PxU32 c=0; c<4; c++) + { + dxmat.m[r][c] = temp[c*4+r]; + } +} + +/****************************** +* D3D9Renderer::D3DXInterface * +******************************/ + +D3D9Renderer::D3DXInterface::D3DXInterface(void) +{ + memset(this, 0, sizeof(*this)); +#if defined(RENDERER_WINDOWS) +#define D3DX_DLL "d3dx9_" RENDERER_TEXT2(D3DX_SDK_VERSION) ".dll" + + m_library = LoadLibraryA(D3DX_DLL); + if(!m_library) + { + MessageBoxA(0, "Unable to load " D3DX_DLL ". Please install the latest DirectX End User Runtime available at www.microsoft.com/directx.", "Renderer Error.", MB_OK); + } + if(m_library) + { +#define FIND_D3DX_FUNCTION(_name) \ +m_##_name = (LP##_name)GetProcAddress(m_library, #_name); \ +RENDERER_ASSERT(m_##_name, "Unable to find D3DX9 Function " #_name " in " D3DX_DLL "."); + + FIND_D3DX_FUNCTION(D3DXCompileShaderFromFileA) + FIND_D3DX_FUNCTION(D3DXGetVertexShaderProfile) + FIND_D3DX_FUNCTION(D3DXGetPixelShaderProfile) + FIND_D3DX_FUNCTION(D3DXSaveSurfaceToFileInMemory) + FIND_D3DX_FUNCTION(D3DXCreateBuffer) + FIND_D3DX_FUNCTION(D3DXSaveSurfaceToFileA) + FIND_D3DX_FUNCTION(D3DXGetShaderConstantTable) + +#undef FIND_D3DX_FUNCTION + } + +#define D3DCOMPILER_DLL "D3DCompiler_" RENDERER_TEXT2(D3DX_SDK_VERSION) ".dll" + m_compiler_library = LoadLibraryA(D3DCOMPILER_DLL); + if(!m_library) + { + MessageBoxA(0, "Unable to load " D3DCOMPILER_DLL ". Please install the latest DirectX End User Runtime available at www.microsoft.com/directx.", "Renderer Error.", MB_OK); + } + + +#undef D3DX_DLL +#endif +} + +D3D9Renderer::D3DXInterface::~D3DXInterface(void) +{ +#if defined(RENDERER_WINDOWS) + if(m_library) + { + FreeLibrary(m_library); + m_library = 0; + FreeLibrary(m_compiler_library); + m_compiler_library = 0; + } +#endif +} + +#if defined(RENDERER_WINDOWS) +#define CALL_D3DX_FUNCTION(_name, _params) if(m_##_name) result = m_##_name _params; +#else +#define CALL_D3DX_FUNCTION(_name, _params) result = _name _params; +#endif + +HRESULT D3D9Renderer::D3DXInterface::CompileShaderFromFileA(LPCSTR srcFile, CONST D3DXMACRO *defines, LPD3DXINCLUDE include, LPCSTR functionName, LPCSTR profile, DWORD flags, LPD3DXBUFFER *shader, LPD3DXBUFFER *errorMsgs, LPD3DXCONSTANTTABLE *constantTable) +{ + + HRESULT result = D3DERR_NOTAVAILABLE; + CALL_D3DX_FUNCTION(D3DXCompileShaderFromFileA, (srcFile, defines, include, functionName, profile, flags, shader, errorMsgs, constantTable)); + return result; + +} + +HRESULT D3D9Renderer::D3DXInterface::GetShaderConstantTable(const DWORD* pFunction, LPD3DXCONSTANTTABLE *constantTable) +{ + HRESULT result = D3DERR_NOTAVAILABLE; + CALL_D3DX_FUNCTION(D3DXGetShaderConstantTable, (pFunction, constantTable)); + return result; +} + +HRESULT D3D9Renderer::D3DXInterface::SaveSurfaceToFileA( LPCSTR pDestFile, D3DXIMAGE_FILEFORMAT DestFormat, LPDIRECT3DSURFACE9 pSrcSurface, CONST PALETTEENTRY* pSrcPalette, CONST RECT* pSrcRect) +{ + + HRESULT result = D3DERR_NOTAVAILABLE; + CALL_D3DX_FUNCTION(D3DXSaveSurfaceToFileA, (pDestFile, DestFormat, pSrcSurface, pSrcPalette, pSrcRect)); + return result; + +} + +LPCSTR D3D9Renderer::D3DXInterface::GetVertexShaderProfile(LPDIRECT3DDEVICE9 device) +{ + + LPCSTR result = 0; + CALL_D3DX_FUNCTION(D3DXGetVertexShaderProfile, (device)); + return result; + +} + +LPCSTR D3D9Renderer::D3DXInterface::GetPixelShaderProfile(LPDIRECT3DDEVICE9 device) +{ + LPCSTR result = 0; + CALL_D3DX_FUNCTION(D3DXGetPixelShaderProfile, (device)); + return result; +} + +HRESULT D3D9Renderer::D3DXInterface::SaveSurfaceToFileInMemory(LPD3DXBUFFER *ppDestBuf, D3DXIMAGE_FILEFORMAT DestFormat, LPDIRECT3DSURFACE9 pSrcSurface, const PALETTEENTRY *pSrcPalette, const RECT *pSrcRect) +{ + HRESULT result = D3DERR_NOTAVAILABLE; + CALL_D3DX_FUNCTION(D3DXSaveSurfaceToFileInMemory, (ppDestBuf, DestFormat, pSrcSurface, pSrcPalette, pSrcRect)); + return result; +} + +HRESULT D3D9Renderer::D3DXInterface::CreateBuffer(DWORD NumBytes, LPD3DXBUFFER *ppBuffer) +{ + HRESULT result = D3DERR_NOTAVAILABLE; + CALL_D3DX_FUNCTION(D3DXCreateBuffer, (NumBytes, ppBuffer)); + return result; +} + + +#undef CALL_D3DX_FUNCTION + +/********************************** +* D3D9Renderer::ShaderEnvironment * +**********************************/ + +D3D9Renderer::ShaderEnvironment::ShaderEnvironment(void) +{ + memset(this, 0, sizeof(*this)); +} + +/*************** +* D3D9Renderer * +***************/ + +D3D9Renderer::D3D9Renderer(IDirect3D9* inDirect3d, const char* devName, PxU32 dispWidth, PxU32 dispHeight, IDirect3DDevice9* inDevice, bool inIsDeviceEx, const char* assetDir) + : Renderer( DRIVER_DIRECT3D9, NULL, assetDir ) +{ + initialize(inIsDeviceEx); + m_d3d = inDirect3d; + strcpy_s( m_deviceName, 256, devName ); + m_displayWidth = dispWidth; + m_displayHeight = dispHeight; + m_d3dDevice = inDevice; + //Users must call + // checkResize(false); + // onDeviceReset(); +} + + +void D3D9Renderer::initialize( bool isDeviceEx ) +{ + m_textVDecl = NULL; + m_useShadersForTextRendering = true; + m_pixelCenterOffset = 0.5f; + m_displayWidth = 0; + m_displayHeight = 0; + m_displayBuffer = 0; + m_d3d = 0; + m_d3dDevice = 0; + m_d3dDepthStencilSurface = 0; + m_d3dSurface = 0; + m_d3dSwapChain = 0; + m_d3dSwapDepthStencilSurface = 0; + m_d3dSwapSurface = 0; + m_isDeviceEx = isDeviceEx; + + m_viewMatrix = PxMat44(PxIdentity); +} + +D3D9Renderer::D3D9Renderer(const RendererDesc &desc, const char* assetDir) : +Renderer (DRIVER_DIRECT3D9, desc.errorCallback, assetDir) +{ + initialize(false); + SampleFramework::SamplePlatform* m_platform = SampleFramework::SamplePlatform::platform(); + m_d3d = static_cast<IDirect3D9*>(m_platform->initializeD3D9()); + RENDERER_ASSERT(m_d3d, "Could not create Direct3D9 Interface."); + if(m_d3d) + { + memset(&m_d3dPresentParams, 0, sizeof(m_d3dPresentParams)); + m_d3dPresentParams.Windowed = 1; + m_d3dPresentParams.SwapEffect = D3DSWAPEFFECT_DISCARD; + m_d3dPresentParams.BackBufferFormat = D3DFMT_X8R8G8B8; + m_d3dPresentParams.EnableAutoDepthStencil = 0; + m_d3dPresentParams.AutoDepthStencilFormat = D3DFMT_D24S8; + m_d3dPresentParams.PresentationInterval = desc.vsync ? D3DPRESENT_INTERVAL_ONE : D3DPRESENT_INTERVAL_IMMEDIATE; + + HRESULT res = m_platform->initializeD3D9Display(&m_d3dPresentParams, + m_deviceName, + m_displayWidth, + m_displayHeight, + &m_d3dDevice); + + RENDERER_ASSERT(res==D3D_OK, "Failed to create Direct3D9 Device."); + if(res==D3D_OK) + { + m_d3dPresentParamsChanged = false; + checkResize(false); + onDeviceReset(); + } + } +} + +D3D9Renderer::~D3D9Renderer(void) +{ + assert(!m_textVDecl); + SampleFramework::SamplePlatform* m_platform = SampleFramework::SamplePlatform::platform(); + + releaseAllMaterials(); + + releaseSwapchain(); + + if(m_d3dDepthStencilSurface) + { + m_d3dDevice->SetDepthStencilSurface(NULL); + m_platform->D3D9BlockUntilNotBusy(m_d3dDepthStencilSurface); + m_d3dDepthStencilSurface->Release(); + } + m_platform->D3D9DeviceBlockUntilIdle(); + if(m_d3dDevice) m_d3dDevice->Release(); + if(m_d3d) m_d3d->Release(); + if(m_displayBuffer) m_displayBuffer->Release(); +} + +bool D3D9Renderer::checkResize(bool isDeviceLost) +{ + bool isDeviceReset = false; +#if defined(RENDERER_WINDOWS) + if(SampleFramework::SamplePlatform::platform()->getWindowHandle() && m_d3dDevice) + { + PxU32 width = 0; + PxU32 height = 0; + SampleFramework::SamplePlatform::platform()->getWindowSize(width, height); + if(width && height && (width != m_displayWidth || height != m_displayHeight) || isDeviceLost) + { + bool needsReset = (m_displayWidth&&m_displayHeight&&(isDeviceLost||!useSwapchain()) ? true : false); + m_displayWidth = width; + m_displayHeight = height; + + m_d3dPresentParams.BackBufferWidth = (UINT)m_displayWidth; + m_d3dPresentParams.BackBufferHeight = (UINT)m_displayHeight; + + D3DVIEWPORT9 viewport = {0}; + m_d3dDevice->GetViewport(&viewport); + viewport.Width = (DWORD)m_displayWidth; + viewport.Height = (DWORD)m_displayHeight; + viewport.MinZ = 0.0f; + viewport.MaxZ = 1.0f; + + if(needsReset) + { + physx::PxU64 res = m_d3dDevice->TestCooperativeLevel(); + if(res == D3D_OK || res == D3DERR_DEVICENOTRESET) //if device is lost, device has to be ready for reset + { + onDeviceLost(); + isDeviceReset = resetDevice(); + if (isDeviceReset) + { + onDeviceReset(); + m_d3dDevice->SetViewport(&viewport); + } + } + } + else + { + if(m_d3dSurface == NULL) + m_d3dDevice->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &m_d3dSurface); + buildSwapchain(); + m_d3dDevice->SetViewport(&viewport); + } + } + } +#endif + return isDeviceReset; +} + +bool D3D9Renderer::resetDevice(void) +{ + + HRESULT res = m_d3dDevice->Reset(&m_d3dPresentParams); + RENDERER_ASSERT(res == D3D_OK, "Failed to reset Direct3D9 Device."); + if(res == D3D_OK) + { + m_d3dPresentParamsChanged = false; + return true; + } + else + { + return false; + } +} + +void D3D9Renderer::buildSwapchain(void) +{ + if (!useSwapchain()) + return; + +#if RENDERER_ENABLE_DIRECT3D9_SWAPCHAIN + // Set the DX9 surfaces back to the originals + m_d3dDevice->SetRenderTarget(0, m_d3dSurface); + m_d3dDevice->SetDepthStencilSurface(m_d3dDepthStencilSurface); + + // Release the swapchain resources + releaseSwapchain(); + + // Recreate the swapchain resources + m_d3dDevice->CreateAdditionalSwapChain(&m_d3dPresentParams, &m_d3dSwapChain); + m_d3dSwapChain->GetBackBuffer(0, D3DBACKBUFFER_TYPE_MONO, &m_d3dSwapSurface); + m_d3dDevice->CreateDepthStencilSurface(m_displayWidth,m_displayHeight,D3DFMT_D24S8, D3DMULTISAMPLE_NONE, 0, false, &m_d3dSwapDepthStencilSurface, 0); + + // Re-assign the DX9 surfaces to use the swapchain + m_d3dDevice->SetRenderTarget(0, m_d3dSwapSurface); + m_d3dDevice->SetDepthStencilSurface(m_d3dSwapDepthStencilSurface); +#endif +} + +void SampleRenderer::D3D9Renderer::releaseSwapchain() +{ +#if RENDERER_ENABLE_DIRECT3D9_SWAPCHAIN + if(m_d3dSwapChain) + { + m_d3dSwapChain->Release(); + m_d3dSwapChain = 0; + } + if(m_d3dSwapDepthStencilSurface) + { + m_d3dSwapDepthStencilSurface->Release(); + m_d3dSwapDepthStencilSurface = 0; + } + if(m_d3dSwapSurface) + { + m_d3dSwapSurface->Release(); + m_d3dSwapSurface = 0; + } +#endif +} + +bool SampleRenderer::D3D9Renderer::useSwapchain() const +{ + return RENDERER_ENABLE_DIRECT3D9_SWAPCHAIN==1; +} + +bool SampleRenderer::D3D9Renderer::validSwapchain() const +{ +#if RENDERER_ENABLE_DIRECT3D9_SWAPCHAIN + return m_d3dSwapChain && m_d3dSwapDepthStencilSurface && m_d3dSwapSurface; +#else + return false; +#endif +} + +HRESULT SampleRenderer::D3D9Renderer::presentSwapchain() +{ +#if RENDERER_ENABLE_DIRECT3D9_SWAPCHAIN + RENDERER_ASSERT(m_d3dSwapChain, "Invalid D3D9 swapchain"); + if(m_d3dSwapChain) + return m_d3dSwapChain->Present(0, 0, 0, 0, 0); + else +#endif + return D3DERR_NOTAVAILABLE; +} + +void D3D9Renderer::releaseDepthStencilSurface(void) +{ + if(m_d3dDepthStencilSurface) + { + m_d3dDepthStencilSurface->Release(); + m_d3dDepthStencilSurface = 0; + } +} + +void D3D9Renderer::onDeviceLost(void) +{ + notifyResourcesLostDevice(); + if(m_d3dDepthStencilSurface) + { + m_d3dDepthStencilSurface->Release(); + m_d3dDepthStencilSurface = 0; + } + if (m_d3dSurface) + { + m_d3dSurface->Release(); + m_d3dSurface = 0; + } + releaseSwapchain(); +} + +void D3D9Renderer::onDeviceReset(void) +{ + if(m_d3dDevice) + { + // set out initial states... + m_d3dDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_CCW); +#if defined(RENDERER_WINDOWS) + m_d3dDevice->SetRenderState(D3DRS_LIGHTING, 0); +#endif + m_d3dDevice->SetRenderState(D3DRS_ZENABLE, 1); + m_d3dDevice->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &m_d3dSurface); + buildDepthStencilSurface(); + buildSwapchain(); + } + notifyResourcesResetDevice(); +} + +void D3D9Renderer::buildDepthStencilSurface(void) +{ + if(m_d3dDevice) + { + PxU32 width = m_displayWidth; + PxU32 height = m_displayHeight; + if(m_d3dDepthStencilSurface) + { + D3DSURFACE_DESC dssdesc; + m_d3dDepthStencilSurface->GetDesc(&dssdesc); + if(width != (PxU32)dssdesc.Width || height != (PxU32)dssdesc.Height) + { + m_d3dDepthStencilSurface->Release(); + m_d3dDepthStencilSurface = 0; + } + } + if(!m_d3dDepthStencilSurface) + { + const D3DFORMAT depthFormat = D3DFMT_D24S8; + const D3DMULTISAMPLE_TYPE multisampleType = D3DMULTISAMPLE_NONE; + const DWORD multisampleQuality = 0; + const BOOL discard = 0; + IDirect3DSurface9 *depthSurface = 0; + HRESULT result = m_d3dDevice->CreateDepthStencilSurface((UINT)width, (UINT)height, depthFormat, multisampleType, multisampleQuality, discard, &depthSurface, 0); + RENDERER_ASSERT(result == D3D_OK, "Failed to create Direct3D9 DepthStencil Surface."); + if(result == D3D_OK) + { + m_d3dDepthStencilSurface = depthSurface; + } + } + m_d3dDevice->SetDepthStencilSurface(m_d3dDepthStencilSurface); + } +} + +// clears the offscreen buffers. +void D3D9Renderer::clearBuffers(void) +{ + if(m_d3dDevice) + { + const DWORD flags = D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER | D3DCLEAR_STENCIL; + m_d3dDevice->Clear(0, NULL, flags, D3DCOLOR_RGBA(getClearColor().r, getClearColor().g, getClearColor().b, getClearColor().a), 1.0f, 0); + } +} + +// presents the current color buffer to the screen. +// returns true on device reset and if buffers need to be rewritten. +bool D3D9Renderer::swapBuffers(void) +{ + bool isDeviceReset = false; + if(m_d3dDevice) + { + HRESULT result = S_OK; + if (useSwapchain() && validSwapchain()) + result = presentSwapchain(); + else + result = SampleFramework::SamplePlatform::platform()->D3D9Present(); + RENDERER_ASSERT(result == D3D_OK || result == D3DERR_DEVICELOST, "Unknown Direct3D9 error when swapping buffers."); + if(result == D3D_OK || result == D3DERR_DEVICELOST) + { + isDeviceReset = checkResize(result == D3DERR_DEVICELOST || m_d3dPresentParamsChanged); + } + } + return isDeviceReset; +} + +void D3D9Renderer::getWindowSize(PxU32 &width, PxU32 &height) const +{ + RENDERER_ASSERT(m_displayHeight * m_displayWidth > 0, "variables not initialized properly"); + width = m_displayWidth; + height = m_displayHeight; +} + +RendererVertexBuffer *D3D9Renderer::createVertexBuffer(const RendererVertexBufferDesc &desc) +{ + PX_PROFILE_ZONE("D3D9Renderer_createVertexBuffer",0); + D3D9RendererVertexBuffer *vb = 0; + if(m_d3dDevice) + { + RENDERER_ASSERT(desc.isValid(), "Invalid Vertex Buffer Descriptor."); + if(desc.isValid()) + { + vb = new D3D9RendererVertexBuffer(*m_d3dDevice, *this, desc); + } + } + if(vb) addResource(*vb); + return vb; +} + +RendererIndexBuffer *D3D9Renderer::createIndexBuffer(const RendererIndexBufferDesc &desc) +{ + PX_PROFILE_ZONE("D3D9Renderer_createIndexBuffer",0); + D3D9RendererIndexBuffer *ib = 0; + if(m_d3dDevice) + { + RENDERER_ASSERT(desc.isValid(), "Invalid Index Buffer Descriptor."); + if(desc.isValid()) + { + ib = new D3D9RendererIndexBuffer(*m_d3dDevice, *this, desc); + } + } + if(ib) addResource(*ib); + return ib; +} + +RendererInstanceBuffer *D3D9Renderer::createInstanceBuffer(const RendererInstanceBufferDesc &desc) +{ + PX_PROFILE_ZONE("D3D9Renderer_createInstanceBuffer",0); + D3D9RendererInstanceBuffer *ib = 0; + if(m_d3dDevice) + { + RENDERER_ASSERT(desc.isValid(), "Invalid Instance Buffer Descriptor."); + if(desc.isValid()) + { + ib = new D3D9RendererInstanceBuffer(*m_d3dDevice, *this, desc); + } + } + if(ib) addResource(*ib); + return ib; +} + +RendererTexture2D *D3D9Renderer::createTexture2D(const RendererTexture2DDesc &desc) +{ + PX_PROFILE_ZONE("D3D9Renderer_createTexture2D",0); + D3D9RendererTexture2D *texture = 0; + if(m_d3dDevice) + { + RENDERER_ASSERT(desc.isValid(), "Invalid Texture 2D Descriptor."); + if(desc.isValid()) + { + texture = new D3D9RendererTexture2D(*m_d3dDevice, *this, desc); + } + } + if(texture) addResource(*texture); + return texture; +} + +RendererTexture3D *D3D9Renderer::createTexture3D(const RendererTexture3DDesc &desc) +{ + //RENDERER_ASSERT(0, "Not implemented!"); + // TODO: Properly implement. + return 0; +} + +RendererTarget *D3D9Renderer::createTarget(const RendererTargetDesc &desc) +{ + PX_PROFILE_ZONE("D3D9Renderer_createTarget",0); + RendererTarget *target = 0; +#if defined(RENDERER_ENABLE_DIRECT3D9_TARGET) + D3D9RendererTarget *d3dTarget = 0; + RENDERER_ASSERT(desc.isValid(), "Invalid Target Descriptor."); + if(desc.isValid()) + { + d3dTarget = new D3D9RendererTarget(*m_d3dDevice, desc); + } + if(d3dTarget) addResource(*d3dTarget); + target = d3dTarget; +#endif + return target; +} + +RendererMaterial *D3D9Renderer::createMaterial(const RendererMaterialDesc &desc) +{ + RendererMaterial *mat = hasMaterialAlready(desc); + RENDERER_ASSERT(desc.isValid(), "Invalid Material Descriptor."); + if(!mat && desc.isValid()) + { + PX_PROFILE_ZONE("D3D9Renderer_createMaterial",0); + mat = new D3D9RendererMaterial(*this, desc); + + registerMaterial(desc, mat); + } + return mat; +} + +RendererMesh *D3D9Renderer::createMesh(const RendererMeshDesc &desc) +{ + PX_PROFILE_ZONE("D3D9Renderer_createMesh",0); + D3D9RendererMesh *mesh = 0; + RENDERER_ASSERT(desc.isValid(), "Invalid Mesh Descriptor."); + if(desc.isValid()) + { + mesh = new D3D9RendererMesh(*this, desc); + } + return mesh; +} + +RendererLight *D3D9Renderer::createLight(const RendererLightDesc &desc) +{ + PX_PROFILE_ZONE("D3D9Renderer_createLight",0); + RendererLight *light = 0; + if(m_d3dDevice) + { + RENDERER_ASSERT(desc.isValid(), "Invalid Light Descriptor."); + if(desc.isValid()) + { + switch(desc.type) + { + case RendererLight::TYPE_DIRECTIONAL: + light = new D3D9RendererDirectionalLight(*this, *(RendererDirectionalLightDesc*)&desc); + break; + case RendererLight::TYPE_SPOT: + light = new D3D9RendererSpotLight(*this, *(RendererSpotLightDesc*)&desc); + break; + default: + RENDERER_ASSERT(0, "Not implemented!"); + } + } + } + return light; +} + +void D3D9Renderer::setVsync(bool on) +{ + UINT newVal = on ? D3DPRESENT_INTERVAL_ONE : D3DPRESENT_INTERVAL_IMMEDIATE; + m_d3dPresentParamsChanged |= m_d3dPresentParams.PresentationInterval != newVal; + m_d3dPresentParams.PresentationInterval = newVal; + //RENDERER_ASSERT(0, "Not implemented!"); +} + +void D3D9Renderer::disableDepthTest() +{ + m_d3dDevice->SetRenderState(D3DRS_ZENABLE, 0); +} + +void D3D9Renderer::enableDepthTest() +{ + m_d3dDevice->SetRenderState(D3DRS_ZENABLE, 1); +} + +bool D3D9Renderer::beginRender(void) +{ + bool ok = false; + if(m_d3dDevice) + { + ok = m_d3dDevice->BeginScene() == D3D_OK; + } + return ok; +} + +void D3D9Renderer::endRender(void) +{ + if(m_d3dDevice) + { + m_d3dDevice->EndScene(); + } +} + +void D3D9Renderer::bindViewProj(const physx::PxMat44 &eye, const RendererProjection &proj) +{ + m_viewMatrix = eye.inverseRT(); + convertToD3D9(m_environment.viewMatrix, m_viewMatrix); + convertToD3D9(m_environment.projMatrix, proj); + + const PxVec3 eyePosition = eye.getPosition(); + const PxVec3 eyeDirection = -eye.getBasis(2); + memcpy(m_environment.eyePosition, &eyePosition.x, sizeof(float)*3); + memcpy(m_environment.eyeDirection, &eyeDirection.x, sizeof(float)*3); +} + +void D3D9Renderer::bindFogState(const RendererColor &fogColor, float fogDistance) +{ + const float inv255 = 1.0f / 255.0f; + + m_environment.fogColorAndDistance[0] = fogColor.r*inv255; + m_environment.fogColorAndDistance[1] = fogColor.g*inv255; + m_environment.fogColorAndDistance[2] = fogColor.b*inv255; + m_environment.fogColorAndDistance[3] = fogDistance; +} + +void D3D9Renderer::bindAmbientState(const RendererColor &ambientColor) +{ + convertToD3D9(m_environment.ambientColor, ambientColor); +} + +void D3D9Renderer::bindDeferredState(void) +{ + RENDERER_ASSERT(0, "Not implemented!"); +} + +void D3D9Renderer::bindMeshContext(const RendererMeshContext &context) +{ + physx::PxMat44 model; + physx::PxMat44 modelView; + if(context.transform) model = *context.transform; + else model = PxMat44(PxIdentity); + modelView = m_viewMatrix * model; + + convertToD3D9(m_environment.modelMatrix, model); + convertToD3D9(m_environment.modelViewMatrix, modelView); + + // it appears that D3D winding is backwards, so reverse them... + DWORD cullMode = D3DCULL_CCW; + switch(context.cullMode) + { + case RendererMeshContext::CLOCKWISE: + cullMode = context.negativeScale ? D3DCULL_CW : D3DCULL_CCW; + break; + case RendererMeshContext::COUNTER_CLOCKWISE: + cullMode = context.negativeScale ? D3DCULL_CCW : D3DCULL_CW; + break; + case RendererMeshContext::NONE: + cullMode = D3DCULL_NONE; + break; + default: + RENDERER_ASSERT(0, "Invalid Cull Mode"); + } + if (!blendingCull() && NULL != context.material && context.material->getBlending()) + cullMode = D3DCULL_NONE; + + m_d3dDevice->SetRenderState(D3DRS_CULLMODE, cullMode); + + DWORD fillMode = D3DFILL_SOLID; + switch(context.fillMode) + { + case RendererMeshContext::SOLID: + fillMode = D3DFILL_SOLID; + break; + case RendererMeshContext::LINE: + fillMode = D3DFILL_WIREFRAME; + break; + case RendererMeshContext::POINT: + fillMode = D3DFILL_POINT; + break; + } + m_d3dDevice->SetRenderState(D3DRS_FILLMODE, fillMode); + + RENDERER_ASSERT(context.numBones <= RENDERER_MAX_BONES, "Too many bones."); + if(context.boneMatrices && context.numBones>0 && context.numBones <= RENDERER_MAX_BONES) + { + for(PxU32 i=0; i<context.numBones; i++) + { + convertToD3D9(m_environment.boneMatrices[i], context.boneMatrices[i]); + } + m_environment.numBones = context.numBones; + } +} + +void D3D9Renderer::beginMultiPass(void) +{ + if(m_d3dDevice) + { + m_d3dDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, 1); + m_d3dDevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_ONE); + m_d3dDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_ONE); + m_d3dDevice->SetRenderState(D3DRS_ZFUNC, D3DCMP_EQUAL); + } +} + +void D3D9Renderer::endMultiPass(void) +{ + if(m_d3dDevice) + { + m_d3dDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, 0); + m_d3dDevice->SetRenderState(D3DRS_ZFUNC, D3DCMP_LESS); + } +} + +void D3D9Renderer::beginTransparentMultiPass(void) +{ + if(m_d3dDevice) + { + setEnableBlendingOverride(true); + m_d3dDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, 1); + m_d3dDevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA); + m_d3dDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_ONE); + //m_d3dDevice->SetRenderState(D3DRS_ZFUNC, D3DCMP_EQUAL); + m_d3dDevice->SetRenderState(D3DRS_ZFUNC, D3DCMP_LESSEQUAL); + m_d3dDevice->SetRenderState(D3DRS_ZWRITEENABLE, false); + } +} + +void D3D9Renderer::endTransparentMultiPass(void) +{ + if(m_d3dDevice) + { + setEnableBlendingOverride(false); + m_d3dDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, 0); + m_d3dDevice->SetRenderState(D3DRS_ZFUNC, D3DCMP_LESS); + m_d3dDevice->SetRenderState(D3DRS_ZWRITEENABLE, true); + } +} + +void D3D9Renderer::renderDeferredLight(const RendererLight &light) +{ + RENDERER_ASSERT(0, "Not implemented!"); +} + +PxU32 D3D9Renderer::convertColor(const RendererColor& color) const +{ + D3DCOLOR outColor; + convertToD3D9(outColor, color); + + return outColor; +} + +bool D3D9Renderer::isOk(void) const +{ + bool ok = true; + if(!m_d3d) ok = false; + if(!m_d3dDevice) ok = false; +#if defined(RENDERER_WINDOWS) + ok = SampleFramework::SamplePlatform::platform()->isD3D9ok(); + if(!m_d3dx.m_library) ok = false; + // note: we could assert m_compiler_library here too, but actually loading that one is optional, so the app still may work without it. +#endif + return ok; +} + +void D3D9Renderer::addResource(D3D9RendererResource &resource) +{ + RENDERER_ASSERT(resource.m_d3dRenderer==0, "Resource already in added to the Renderer!"); + if(resource.m_d3dRenderer==0) + { + resource.m_d3dRenderer = this; + m_resources.push_back(&resource); + } +} + +void D3D9Renderer::removeResource(D3D9RendererResource &resource) +{ + RENDERER_ASSERT(resource.m_d3dRenderer==this, "Resource not part of this Renderer!"); + if(resource.m_d3dRenderer==this) + { + resource.m_d3dRenderer = 0; + const PxU32 numResources = (PxU32)m_resources.size(); + for (PxU32 i = 0; i < numResources; i++) + { + if(m_resources[i] == &resource) + { + // the order of resources needs to remain intact, otherwise a render target that has a dependency on a texture might get onDeviceReset'ed earlier which is an error + m_resources.erase(m_resources.begin() + i); + break; + } + } + } +} + +void D3D9Renderer::notifyResourcesLostDevice(void) +{ + const PxU32 numResources = (PxU32)m_resources.size(); + for(PxU32 i=0; i<numResources; i++) + { + m_resources[i]->onDeviceLost(); + } +} + +void D3D9Renderer::notifyResourcesResetDevice(void) +{ + const PxU32 numResources = (PxU32)m_resources.size(); + for(PxU32 i=0; i<numResources; i++) + { + m_resources[i]->onDeviceReset(); + } +} + + +/////////////////////////////////////////////////////////////////////////////// + +static DWORD gCullMode; +static DWORD gAlphaBlendEnable; +static DWORD gSrcBlend; +static DWORD gDstBlend; +static DWORD gFillMode; +static DWORD gZWrite; + +bool D3D9Renderer::initTexter() +{ + if(!Renderer::initTexter()) + return false; + + if(!m_textVDecl) + { + D3DVERTEXELEMENT9 vdecl[4]; + vdecl[0].Stream = 0; + vdecl[0].Offset = 0; + vdecl[0].Type = D3DDECLTYPE_FLOAT4; + vdecl[0].Method = D3DDECLMETHOD_DEFAULT; +#if defined(RENDERER_XBOX360) + vdecl[0].Usage = D3DDECLUSAGE_POSITION; // PT: D3DDECLUSAGE_POSITIONT is not available on Xbox +#endif +#if defined(RENDERER_WINDOWS) + vdecl[0].Usage = D3DDECLUSAGE_POSITIONT; +#endif + vdecl[0].UsageIndex = 0; + + vdecl[1].Stream = 0; + vdecl[1].Offset = 4*4; + vdecl[1].Type = D3DDECLTYPE_D3DCOLOR; + vdecl[1].Method = D3DDECLMETHOD_DEFAULT; + vdecl[1].Usage = D3DDECLUSAGE_COLOR; + vdecl[1].UsageIndex = 0; + + vdecl[2].Stream = 0; + vdecl[2].Offset = 4*4 + 4; + vdecl[2].Type = D3DDECLTYPE_FLOAT2; + vdecl[2].Method = D3DDECLMETHOD_DEFAULT; + vdecl[2].Usage = D3DDECLUSAGE_TEXCOORD; + vdecl[2].UsageIndex = 0; + + vdecl[3].Stream = 0xFF; + vdecl[3].Offset = 0; + vdecl[3].Type = (DWORD)D3DDECLTYPE_UNUSED; + vdecl[3].Method = 0; + vdecl[3].Usage = 0; + vdecl[3].UsageIndex = 0; + + m_d3dDevice->CreateVertexDeclaration(vdecl, &m_textVDecl); + if(!m_textVDecl) + { + closeTexter(); + return false; + } + } + + return true; +} + +void D3D9Renderer::closeTexter() +{ + if(m_textVDecl) + { + IDirect3DVertexDeclaration9* currDecl = NULL; + m_d3dDevice->GetVertexDeclaration(&currDecl); + if (currDecl == m_textVDecl) + { + m_d3dDevice->SetVertexDeclaration(NULL); + } + m_textVDecl->Release(); + m_textVDecl = NULL; + } + + Renderer::closeTexter(); +} + + +void D3D9Renderer::setupTextRenderStates() +{ + // PT: save render states. Let's just hope this isn't a pure device, else the Get method won't work + m_d3dDevice->GetRenderState(D3DRS_CULLMODE, &gCullMode); + m_d3dDevice->GetRenderState(D3DRS_ALPHABLENDENABLE, &gAlphaBlendEnable); + m_d3dDevice->GetRenderState(D3DRS_SRCBLEND, &gSrcBlend); + m_d3dDevice->GetRenderState(D3DRS_DESTBLEND, &gDstBlend); + m_d3dDevice->GetRenderState(D3DRS_FILLMODE, &gFillMode); + m_d3dDevice->GetRenderState(D3DRS_ZWRITEENABLE, &gZWrite); + + // PT: setup render states for text rendering + m_d3dDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE); + m_d3dDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, true); + m_d3dDevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA); + m_d3dDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA); + m_d3dDevice->SetRenderState(D3DRS_FILLMODE, D3DFILL_SOLID); + m_d3dDevice->SetRenderState(D3DRS_ZWRITEENABLE, false); + +#if defined(RENDERER_XBOX360) + // PT: D3DDECLUSAGE_POSITIONT is not available on Xbox, this is the workaround + m_d3dDevice->SetRenderState(D3DRS_VIEWPORTENABLE, false); +#endif +} + +void D3D9Renderer::resetTextRenderStates() +{ + // PT: restore render states. We want text rendering not to interfere with existing render states. + // For example the text should never be rendered in wireframe, even if the scene is. + m_d3dDevice->SetRenderState(D3DRS_CULLMODE, gCullMode); + m_d3dDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, gAlphaBlendEnable); + m_d3dDevice->SetRenderState(D3DRS_SRCBLEND, gSrcBlend); + m_d3dDevice->SetRenderState(D3DRS_DESTBLEND, gDstBlend); + m_d3dDevice->SetRenderState(D3DRS_FILLMODE, gFillMode); + m_d3dDevice->SetRenderState(D3DRS_ZWRITEENABLE, gZWrite); +#if defined(RENDERER_XBOX360) + m_d3dDevice->SetRenderState(D3DRS_VIEWPORTENABLE, true); +#endif +} + +void D3D9Renderer::renderTextBuffer(const void* vertices, PxU32 nbVerts, const PxU16* indices, PxU32 nbIndices, RendererMaterial* material) +{ + PX_UNUSED(material); + // PT: font texture must have been selected prior to calling this function + const int PrimCount = nbIndices/3; + const int Stride = sizeof(TextVertex); + + if(m_textVDecl && FAILED(m_d3dDevice->SetVertexDeclaration(m_textVDecl))) + { + assert(0); + return; + } + + DWORD hr = m_d3dDevice->DrawIndexedPrimitiveUP(D3DPT_TRIANGLELIST, 0, nbVerts, PrimCount, indices, D3DFMT_INDEX16, vertices, Stride); + if(FAILED(hr)) + { + // printf("Error!\n"); + } +} + +void D3D9Renderer::renderLines2D(const void* vertices, PxU32 nbVerts) +{ + const int PrimCount = nbVerts-1; + const int Stride = sizeof(TextVertex); + + if(m_textVDecl && FAILED(m_d3dDevice->SetVertexDeclaration(m_textVDecl))) + { + assert(0); + return; + } + + DWORD hr = m_d3dDevice->DrawPrimitiveUP(D3DPT_LINESTRIP, PrimCount, vertices, Stride); + if(FAILED(hr)) + { + // printf("Error!\n"); + } +} + +void D3D9Renderer::setupScreenquadRenderStates() +{ + m_d3dDevice->GetRenderState(D3DRS_CULLMODE, &gCullMode); + m_d3dDevice->GetRenderState(D3DRS_FILLMODE, &gFillMode); + + m_d3dDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE); + m_d3dDevice->SetRenderState(D3DRS_FILLMODE, D3DFILL_SOLID); + + m_d3dDevice->SetRenderState(D3DRS_ZWRITEENABLE, false); +#if defined(RENDERER_XBOX360) + m_d3dDevice->SetRenderState(D3DRS_VIEWPORTENABLE, false); +#endif +} + +void D3D9Renderer::resetScreenquadRenderStates() +{ + m_d3dDevice->SetRenderState(D3DRS_CULLMODE, gCullMode); + m_d3dDevice->SetRenderState(D3DRS_FILLMODE, gFillMode); + m_d3dDevice->SetRenderState(D3DRS_ZWRITEENABLE, true); +#if defined(RENDERER_XBOX360) + m_d3dDevice->SetRenderState(D3DRS_VIEWPORTENABLE, true); +#endif +} + +bool D3D9Renderer::captureScreen( PxU32 &width, PxU32& height, PxU32& sizeInBytes, const void*& screenshotData ) +{ +#if defined(RENDERER_XBOX360) + return false; +#else + bool bSuccess = false; + + IDirect3DSurface9* backBuffer = NULL; + if (useSwapchain() && validSwapchain()) + { +#if RENDERER_ENABLE_DIRECT3D9_SWAPCHAIN + bSuccess = SUCCEEDED(m_d3dSwapChain->GetBackBuffer(0, D3DBACKBUFFER_TYPE_MONO, &backBuffer)); +#endif + } + else + { + bSuccess = SUCCEEDED(m_d3dDevice->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &backBuffer)); + } + + if (bSuccess) + { + bSuccess = false; + if(m_displayBuffer) + { + m_displayBuffer->Release(); + m_displayBuffer = 0; + } + + if(SUCCEEDED(m_d3dx.SaveSurfaceToFileInMemory(&m_displayBuffer, D3DXIFF_BMP, backBuffer, NULL, NULL))) + { + getWindowSize(width, height); + sizeInBytes = (physx::PxU32)m_displayBuffer->GetBufferSize(); + screenshotData = m_displayBuffer->GetBufferPointer(); + bSuccess = true; + } + backBuffer->Release(); + } + + return bSuccess; +#endif +} + +#endif // #if defined(RENDERER_ENABLE_DIRECT3D9) + diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d9/D3D9Renderer.h b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d9/D3D9Renderer.h new file mode 100644 index 00000000..645d2314 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d9/D3D9Renderer.h @@ -0,0 +1,299 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#ifndef D3D9_RENDERER_H +#define D3D9_RENDERER_H + +#include <RendererConfig.h> + +#if defined(RENDERER_ENABLE_DIRECT3D9) + +#include <Renderer.h> +#include <vector> + +#if defined(RENDERER_DEBUG) + //#define D3D_DEBUG_INFO 1 +#endif + +#if defined(RENDERER_XBOX360) +#include <xtl.h> +#endif +#include <d3d9.h> +#include <d3dx9.h> + +// Enables/Disables use of non-managed resources for vertex/instance buffers. +// Disabled for now as it appears to actually slow us down significantly on particles. +#if defined(RENDERER_XBOX360) +#define RENDERER_ENABLE_DYNAMIC_VB_POOLS 0 +#define RENDERER_ENABLE_DIRECT3D9_SWAPCHAIN 0 +#else +#define RENDERER_ENABLE_DYNAMIC_VB_POOLS 1 +#define RENDERER_ENABLE_DIRECT3D9_SWAPCHAIN 1 +#endif +struct IDirect3DSwapChain9; + +namespace SampleRenderer +{ + + class RendererDesc; + class RendererColor; + + void convertToD3D9(D3DCOLOR &dxcolor, const RendererColor &color); + void convertToD3D9(float *dxvec, const PxVec3 &vec); + void convertToD3D9(D3DMATRIX &dxmat, const physx::PxMat44 &mat); + void convertToD3D9(D3DMATRIX &dxmat, const RendererProjection &mat); + + class D3D9RendererResource; + + class D3D9Renderer : public Renderer + { + friend class D3D9RendererResource; + public: + class D3DXInterface + { + friend class D3D9Renderer; + private: + D3DXInterface(void); + ~D3DXInterface(void); + + public: + HRESULT CompileShaderFromFileA(LPCSTR srcFile, CONST D3DXMACRO *defines, LPD3DXINCLUDE include, LPCSTR functionName, LPCSTR profile, DWORD flags, LPD3DXBUFFER *shader, LPD3DXBUFFER *errorMsgs, LPD3DXCONSTANTTABLE *constantTable); + HRESULT GetShaderConstantTable(const DWORD* pFunction, LPD3DXCONSTANTTABLE *constantTable); + LPCSTR GetVertexShaderProfile(LPDIRECT3DDEVICE9 device); + LPCSTR GetPixelShaderProfile(LPDIRECT3DDEVICE9 device); + HRESULT SaveSurfaceToFileInMemory(LPD3DXBUFFER *ppDestBuf, D3DXIMAGE_FILEFORMAT DestFormat, LPDIRECT3DSURFACE9 pSrcSurface, const PALETTEENTRY *pSrcPalette, const RECT *pSrcRect); + HRESULT CreateBuffer(DWORD NumBytes, LPD3DXBUFFER *ppBuffer); + HRESULT SaveSurfaceToFileA( LPCSTR pDestFile, D3DXIMAGE_FILEFORMAT DestFormat, LPDIRECT3DSURFACE9 pSrcSurface, CONST PALETTEENTRY* pSrcPalette, CONST RECT* pSrcRect); + + public: +#if defined(RENDERER_WINDOWS) + HMODULE m_library; + HMODULE m_compiler_library; + +#define DEFINE_D3DX_FUNCTION(_name, _return, _params) \ + typedef _return (WINAPI* LP##_name) _params; \ + LP##_name m_##_name; + + DEFINE_D3DX_FUNCTION(D3DXCompileShaderFromFileA, HRESULT, (LPCSTR, CONST D3DXMACRO*, LPD3DXINCLUDE, LPCSTR, LPCSTR, DWORD, LPD3DXBUFFER*, LPD3DXBUFFER*, LPD3DXCONSTANTTABLE *)) + DEFINE_D3DX_FUNCTION(D3DXGetVertexShaderProfile, LPCSTR, (LPDIRECT3DDEVICE9)); + DEFINE_D3DX_FUNCTION(D3DXGetPixelShaderProfile, LPCSTR, (LPDIRECT3DDEVICE9)); + DEFINE_D3DX_FUNCTION(D3DXSaveSurfaceToFileInMemory, HRESULT, (LPD3DXBUFFER*, D3DXIMAGE_FILEFORMAT, LPDIRECT3DSURFACE9, const PALETTEENTRY*, const RECT*)); + DEFINE_D3DX_FUNCTION(D3DXSaveSurfaceToFileA, HRESULT, (LPCSTR ,D3DXIMAGE_FILEFORMAT , LPDIRECT3DSURFACE9 , CONST PALETTEENTRY* , CONST RECT* )); + DEFINE_D3DX_FUNCTION(D3DXGetShaderConstantTable, HRESULT, (const DWORD* , LPD3DXCONSTANTTABLE*)); + DEFINE_D3DX_FUNCTION(D3DXCreateBuffer, HRESULT, (DWORD, LPD3DXBUFFER*)); + +#undef DEFINE_D3DX_FUNCTION +#endif + }; + + class ShaderEnvironment + { + public: + D3DMATRIX modelMatrix; + D3DMATRIX viewMatrix; + D3DMATRIX projMatrix; + D3DMATRIX modelViewMatrix; + D3DMATRIX modelViewProjMatrix; + + D3DXMATRIX boneMatrices[RENDERER_MAX_BONES]; + PxU32 numBones; + + float fogColorAndDistance[4]; + + float eyePosition[3]; + float eyeDirection[3]; + + D3DCOLOR ambientColor; + + D3DCOLOR lightColor; + float lightIntensity; + float lightDirection[3]; + float lightPosition[3]; + float lightInnerRadius; + float lightOuterRadius; + float lightInnerCone; + float lightOuterCone; + IDirect3DTexture9 *lightShadowMap; + D3DXMATRIX lightShadowMatrix; + + public: + ShaderEnvironment(void); + }; + + protected: + D3D9Renderer(IDirect3D9* inDirect3d, const char* devName, PxU32 dispWidth, PxU32 dispHeight, IDirect3DDevice9* inDevice, bool isDeviceEx, const char* assetDir); + void initialize(bool isDeviceEx); + + public: + D3D9Renderer(const RendererDesc &desc, const char* assetDir); + virtual ~D3D9Renderer(void); + + IDirect3DDevice9 *getD3DDevice(void) { return m_d3dDevice; } + D3DXInterface &getD3DX(void) { return m_d3dx; } + ShaderEnvironment &getShaderEnvironment(void) { return m_environment; } + const ShaderEnvironment &getShaderEnvironment(void) const { return m_environment; } + + protected: + virtual bool checkResize(bool isDeviceLost); + void buildDepthStencilSurface(void); + void buildSwapchain(); + void releaseSwapchain(); + bool useSwapchain() const; + bool validSwapchain() const; + HRESULT presentSwapchain(); + + void releaseDepthStencilSurface(void); + public: + bool resetDevice(void); + void onDeviceLost(void); + void onDeviceReset(void); + + public: + // clears the offscreen buffers. + virtual void clearBuffers(void); + + // presents the current color buffer to the screen. + // returns true on device reset and if buffers need to be rewritten. + virtual bool swapBuffers(void); + + // get the device pointer (void * abstraction) + virtual void *getDevice() { return static_cast<void*>(getD3DDevice()); } + + // get the window size + void getWindowSize(PxU32 &width, PxU32 &height) const; + + // gets a handle to the current frame's data, in bitmap format + // note: subsequent calls will invalidate any previously returned data + // return true on successful screenshot capture + virtual bool captureScreen(PxU32 &width, PxU32& height, PxU32& sizeInBytes, const void*& screenshotData); + + virtual RendererVertexBuffer *createVertexBuffer( const RendererVertexBufferDesc &desc); + virtual RendererIndexBuffer *createIndexBuffer( const RendererIndexBufferDesc &desc); + virtual RendererInstanceBuffer *createInstanceBuffer(const RendererInstanceBufferDesc &desc); + virtual RendererTexture2D *createTexture2D( const RendererTexture2DDesc &desc); + virtual RendererTexture3D *createTexture3D( const RendererTexture3DDesc &desc); + virtual RendererTarget *createTarget( const RendererTargetDesc &desc); + virtual RendererMaterial *createMaterial( const RendererMaterialDesc &desc); + virtual RendererMesh *createMesh( const RendererMeshDesc &desc); + virtual RendererLight *createLight( const RendererLightDesc &desc); + + virtual void disableDepthTest(); + virtual void enableDepthTest(); + + virtual void setVsync(bool on); + + virtual bool initTexter(); + virtual void closeTexter(); + + virtual bool beginRender(void); + virtual void endRender(void); + + bool canUseManagedResources() { return !m_isDeviceEx; } + + virtual void bindViewProj(const physx::PxMat44 &eye, const RendererProjection &proj); + virtual void bindFogState(const RendererColor &fogColor, float fogDistance); + virtual void bindAmbientState(const RendererColor &ambientColor); + virtual void bindDeferredState(void); + virtual void bindMeshContext(const RendererMeshContext &context); + virtual void beginMultiPass(void); + virtual void endMultiPass(void); + virtual void beginTransparentMultiPass(void); + virtual void endTransparentMultiPass(void); + virtual void renderDeferredLight(const RendererLight &light); + virtual PxU32 convertColor(const RendererColor& color) const; + + virtual bool isOk(void) const; + + virtual void setupTextRenderStates(); + virtual void resetTextRenderStates(); + virtual void renderTextBuffer(const void* vertices, PxU32 nbVerts, const PxU16* indices, PxU32 nbIndices, RendererMaterial* material); + virtual void renderLines2D(const void* vertices, PxU32 nbVerts); + virtual void setupScreenquadRenderStates(); + virtual void resetScreenquadRenderStates(); + + private: + void addResource(D3D9RendererResource &resource); + void removeResource(D3D9RendererResource &resource); + void notifyResourcesLostDevice(void); + void notifyResourcesResetDevice(void); + + protected: + PxU32 m_displayWidth; + PxU32 m_displayHeight; + ID3DXBuffer *m_displayBuffer; + + IDirect3D9 *m_d3d; + IDirect3DDevice9 *m_d3dDevice; + IDirect3DSurface9 *m_d3dDepthStencilSurface; + IDirect3DSurface9 *m_d3dSurface; + + IDirect3DSwapChain9 *m_d3dSwapChain; + IDirect3DSurface9 *m_d3dSwapDepthStencilSurface; + IDirect3DSurface9 *m_d3dSwapSurface; + private: + bool m_isDeviceEx; //implications all over the place + + D3DXInterface m_d3dx; + + ShaderEnvironment m_environment; + + D3DPRESENT_PARAMETERS m_d3dPresentParams; + bool m_d3dPresentParamsChanged; + + physx::PxMat44 m_viewMatrix; + + // non-managed resources... + std::vector<D3D9RendererResource*> m_resources; + + IDirect3DVertexDeclaration9* m_textVDecl; + }; + + class D3D9RendererResource + { + friend class D3D9Renderer; + public: + D3D9RendererResource(void) + { + m_d3dRenderer = 0; + } + + virtual ~D3D9RendererResource(void) + { + if(m_d3dRenderer) m_d3dRenderer->removeResource(*this); + } + + public: + virtual void onDeviceLost(void)=0; + virtual void onDeviceReset(void)=0; + + private: + D3D9Renderer *m_d3dRenderer; + }; + +} // namespace SampleRenderer + +#endif // #if defined(RENDERER_ENABLE_DIRECT3D9) +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d9/D3D9RendererDirectionalLight.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d9/D3D9RendererDirectionalLight.cpp new file mode 100644 index 00000000..e76c20e0 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d9/D3D9RendererDirectionalLight.cpp @@ -0,0 +1,56 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#include <RendererConfig.h> + +#if defined(RENDERER_ENABLE_DIRECT3D9) + +#include "D3D9RendererDirectionalLight.h" + +using namespace SampleRenderer; + +D3D9RendererDirectionalLight::D3D9RendererDirectionalLight(D3D9Renderer &renderer, const RendererDirectionalLightDesc &desc) : + RendererDirectionalLight(desc), + m_renderer(renderer) +{ + +} + +D3D9RendererDirectionalLight::~D3D9RendererDirectionalLight(void) +{ + +} + +void D3D9RendererDirectionalLight::bind(void) const +{ + D3D9Renderer::ShaderEnvironment &shaderEnv = m_renderer.getShaderEnvironment(); + convertToD3D9(shaderEnv.lightColor, m_color); + shaderEnv.lightIntensity = m_intensity; + convertToD3D9(shaderEnv.lightDirection, m_direction); +} + +#endif // #if defined(RENDERER_ENABLE_DIRECT3D9) diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d9/D3D9RendererDirectionalLight.h b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d9/D3D9RendererDirectionalLight.h new file mode 100644 index 00000000..1e5f8b6b --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d9/D3D9RendererDirectionalLight.h @@ -0,0 +1,56 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#ifndef D3D9_RENDERER_DIRECTIONAL_LIGHT_H +#define D3D9_RENDERER_DIRECTIONAL_LIGHT_H + +#include <RendererConfig.h> + +#if defined(RENDERER_ENABLE_DIRECT3D9) + +#include <RendererDirectionalLight.h> + +#include "D3D9Renderer.h" + +namespace SampleRenderer +{ + + class D3D9RendererDirectionalLight : public RendererDirectionalLight + { + public: + D3D9RendererDirectionalLight(D3D9Renderer &renderer, const RendererDirectionalLightDesc &desc); + virtual ~D3D9RendererDirectionalLight(void); + + virtual void bind(void) const; + + private: + D3D9Renderer &m_renderer; + }; + +} // namespace SampleRenderer + +#endif // #if defined(RENDERER_ENABLE_DIRECT3D9) +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d9/D3D9RendererIndexBuffer.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d9/D3D9RendererIndexBuffer.cpp new file mode 100644 index 00000000..af56f974 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d9/D3D9RendererIndexBuffer.cpp @@ -0,0 +1,161 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#include <RendererConfig.h> + +#if defined(RENDERER_ENABLE_DIRECT3D9) + +#include "D3D9RendererIndexBuffer.h" +#include <RendererIndexBufferDesc.h> + +#if PX_WINDOWS +#include <task/PxTask.h> +#endif + +using namespace SampleRenderer; + +static D3DFORMAT getD3D9Format(RendererIndexBuffer::Format format) +{ + D3DFORMAT d3dFormat = D3DFMT_UNKNOWN; + switch(format) + { + case RendererIndexBuffer::FORMAT_UINT16: d3dFormat = D3DFMT_INDEX16; break; + case RendererIndexBuffer::FORMAT_UINT32: d3dFormat = D3DFMT_INDEX32; break; + } + RENDERER_ASSERT(d3dFormat != D3DFMT_UNKNOWN, "Unable to convert to D3DFORMAT."); + return d3dFormat; +} + +D3D9RendererIndexBuffer::D3D9RendererIndexBuffer(IDirect3DDevice9 &d3dDevice, D3D9Renderer& renderer, const RendererIndexBufferDesc &desc) : + RendererIndexBuffer(desc), + m_d3dDevice(d3dDevice) +{ + m_d3dIndexBuffer = 0; + + m_usage = D3DUSAGE_WRITEONLY; + m_pool = renderer.canUseManagedResources() ? D3DPOOL_MANAGED : D3DPOOL_DEFAULT; + PxU32 indexSize = getFormatByteSize(desc.format); + m_format = getD3D9Format(desc.format); + m_bufferSize = indexSize * desc.maxIndices; + +#if RENDERER_ENABLE_DYNAMIC_VB_POOLS + if(desc.hint == RendererIndexBuffer::HINT_DYNAMIC ) + { + m_usage = desc.registerInCUDA ? 0 : D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY; + m_pool = D3DPOOL_DEFAULT; + } +#endif + + onDeviceReset(); + + if(m_d3dIndexBuffer) + { + m_maxIndices = desc.maxIndices; + } +} + +D3D9RendererIndexBuffer::~D3D9RendererIndexBuffer(void) +{ + if(m_d3dIndexBuffer) + { +#if PX_WINDOWS && PX_SUPPORT_GPU_PHYSX + if(m_interopContext && m_registeredInCUDA) + { + m_registeredInCUDA = !m_interopContext->unregisterResourceInCuda(m_InteropHandle); + } +#endif + m_d3dIndexBuffer->Release(); + } +} + +void D3D9RendererIndexBuffer::onDeviceLost(void) +{ + m_registeredInCUDA = false; + + if(m_pool != D3DPOOL_MANAGED && m_d3dIndexBuffer) + { +#if PX_WINDOWS && PX_SUPPORT_GPU_PHYSX + if(m_interopContext && m_registeredInCUDA) + { + m_registeredInCUDA = !m_interopContext->unregisterResourceInCuda(m_InteropHandle); + } +#endif + m_d3dIndexBuffer->Release(); + m_d3dIndexBuffer = 0; + } +} + +void D3D9RendererIndexBuffer::onDeviceReset(void) +{ + if(!m_d3dIndexBuffer) + { + m_d3dDevice.CreateIndexBuffer(m_bufferSize, m_usage, m_format, m_pool, &m_d3dIndexBuffer, 0); + RENDERER_ASSERT(m_d3dIndexBuffer, "Failed to create Direct3D9 Index Buffer."); +#if PX_WINDOWS && PX_SUPPORT_GPU_PHYSX + if(m_interopContext && m_d3dIndexBuffer && m_mustBeRegisteredInCUDA) + { + m_registeredInCUDA = m_interopContext->registerResourceInCudaD3D(m_InteropHandle, m_d3dIndexBuffer); + } +#endif + } +} + +void *D3D9RendererIndexBuffer::lock(void) +{ + void *buffer = 0; + if(m_d3dIndexBuffer) + { + const Format format = getFormat(); + const PxU32 maxIndices = getMaxIndices(); + const PxU32 bufferSize = maxIndices * getFormatByteSize(format); + if(bufferSize > 0) + { + m_d3dIndexBuffer->Lock(0, (UINT)bufferSize, &buffer, 0); + } + } + return buffer; +} + +void D3D9RendererIndexBuffer::unlock(void) +{ + if(m_d3dIndexBuffer) + { + m_d3dIndexBuffer->Unlock(); + } +} + +void D3D9RendererIndexBuffer::bind(void) const +{ + m_d3dDevice.SetIndices(m_d3dIndexBuffer); +} + +void D3D9RendererIndexBuffer::unbind(void) const +{ + m_d3dDevice.SetIndices(0); +} + +#endif // #if defined(RENDERER_ENABLE_DIRECT3D9) diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d9/D3D9RendererIndexBuffer.h b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d9/D3D9RendererIndexBuffer.h new file mode 100644 index 00000000..7a8ac9d7 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d9/D3D9RendererIndexBuffer.h @@ -0,0 +1,70 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#ifndef D3D9_RENDERER_INDEXBUFFER_H +#define D3D9_RENDERER_INDEXBUFFER_H + +#include <RendererConfig.h> + +#if defined(RENDERER_ENABLE_DIRECT3D9) + +#include <RendererIndexBuffer.h> +#include "D3D9Renderer.h" + +namespace SampleRenderer +{ + + class D3D9RendererIndexBuffer : public RendererIndexBuffer, public D3D9RendererResource + { + public: + D3D9RendererIndexBuffer(IDirect3DDevice9 &d3dDevice, D3D9Renderer& renderer, const RendererIndexBufferDesc &desc); + virtual ~D3D9RendererIndexBuffer(void); + + public: + virtual void *lock(void); + virtual void unlock(void); + + private: + virtual void bind(void) const; + virtual void unbind(void) const; + + virtual void onDeviceLost(void); + virtual void onDeviceReset(void); + + private: + IDirect3DDevice9 &m_d3dDevice; + IDirect3DIndexBuffer9 *m_d3dIndexBuffer; + + DWORD m_usage; + D3DPOOL m_pool; + UINT m_bufferSize; + D3DFORMAT m_format; + }; + +} // namespace SampleRenderer + +#endif // #if defined(RENDERER_ENABLE_DIRECT3D9) +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d9/D3D9RendererInstanceBuffer.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d9/D3D9RendererInstanceBuffer.cpp new file mode 100644 index 00000000..573baba9 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d9/D3D9RendererInstanceBuffer.cpp @@ -0,0 +1,266 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#include <RendererConfig.h> +#if defined(RENDERER_ENABLE_DIRECT3D9) + +#include "D3D9RendererInstanceBuffer.h" +#include <RendererInstanceBufferDesc.h> + +#if PX_WINDOWS +#include <task/PxTask.h> +#endif + +using namespace SampleRenderer; + +static D3DVERTEXELEMENT9 buildVertexElement(WORD stream, WORD offset, D3DDECLTYPE type, BYTE method, BYTE usage, BYTE usageIndex) +{ + D3DVERTEXELEMENT9 element; + element.Stream = stream; + element.Offset = offset; +#if defined(RENDERER_WINDOWS) + element.Type = (BYTE)type; +#else + element.Type = type; +#endif + element.Method = method; + element.Usage = usage; + element.UsageIndex = usageIndex; + return element; +} + +static D3DDECLTYPE getD3DType(RendererInstanceBuffer::Format format) +{ + D3DDECLTYPE d3dType = D3DDECLTYPE_UNUSED; + switch(format) + { + case RendererInstanceBuffer::FORMAT_FLOAT1: d3dType = D3DDECLTYPE_FLOAT1; break; + case RendererInstanceBuffer::FORMAT_FLOAT2: d3dType = D3DDECLTYPE_FLOAT2; break; + case RendererInstanceBuffer::FORMAT_FLOAT3: d3dType = D3DDECLTYPE_FLOAT3; break; + case RendererInstanceBuffer::FORMAT_FLOAT4: d3dType = D3DDECLTYPE_FLOAT4; break; + } + RENDERER_ASSERT(d3dType != D3DDECLTYPE_UNUSED, "Invalid Direct3D9 vertex type."); + return d3dType; +} + +static D3DDECLUSAGE getD3DUsage(RendererInstanceBuffer::Semantic semantic, PxU8 &usageIndex) +{ + D3DDECLUSAGE d3dUsage = D3DDECLUSAGE_FOG; + usageIndex = 0; + switch(semantic) + { + case RendererInstanceBuffer::SEMANTIC_POSITION: + d3dUsage = D3DDECLUSAGE_TEXCOORD; + usageIndex = RENDERER_INSTANCE_POSITION_CHANNEL; + break; + case RendererInstanceBuffer::SEMANTIC_NORMALX: + d3dUsage = D3DDECLUSAGE_TEXCOORD; + usageIndex = RENDERER_INSTANCE_NORMALX_CHANNEL; + break; + case RendererInstanceBuffer::SEMANTIC_NORMALY: + d3dUsage = D3DDECLUSAGE_TEXCOORD; + usageIndex = RENDERER_INSTANCE_NORMALY_CHANNEL; + break; + case RendererInstanceBuffer::SEMANTIC_NORMALZ: + d3dUsage = D3DDECLUSAGE_TEXCOORD; + usageIndex = RENDERER_INSTANCE_NORMALZ_CHANNEL; + break; + case RendererInstanceBuffer::SEMANTIC_VELOCITY_LIFE: + d3dUsage = D3DDECLUSAGE_TEXCOORD; + usageIndex = RENDERER_INSTANCE_VEL_LIFE_CHANNEL; + break; + case RendererInstanceBuffer::SEMANTIC_DENSITY: + d3dUsage = D3DDECLUSAGE_TEXCOORD; + usageIndex = RENDERER_INSTANCE_DENSITY_CHANNEL; + break; + case RendererInstanceBuffer::SEMANTIC_UV_OFFSET: + d3dUsage = D3DDECLUSAGE_TEXCOORD; + usageIndex = RENDERER_INSTANCE_UV_CHANNEL; + break; + case RendererInstanceBuffer::SEMANTIC_LOCAL_OFFSET: + d3dUsage = D3DDECLUSAGE_TEXCOORD; + usageIndex = RENDERER_INSTANCE_LOCAL_CHANNEL; + break; + } + RENDERER_ASSERT(d3dUsage != D3DDECLUSAGE_FOG, "Invalid Direct3D9 vertex usage."); + return d3dUsage; +} + +D3D9RendererInstanceBuffer::D3D9RendererInstanceBuffer(IDirect3DDevice9 &d3dDevice, D3D9Renderer& renderer, const RendererInstanceBufferDesc &desc) : +RendererInstanceBuffer(desc) +#if RENDERER_INSTANCING + ,m_d3dDevice(d3dDevice) +#endif +{ +#if RENDERER_INSTANCING + m_d3dVertexBuffer = 0; +#endif + + m_usage = D3DUSAGE_WRITEONLY; + m_pool = renderer.canUseManagedResources() ? D3DPOOL_MANAGED : D3DPOOL_DEFAULT; + m_bufferSize = (UINT)(desc.maxInstances * m_stride); + +#if RENDERER_ENABLE_DYNAMIC_VB_POOLS + if(desc.hint==RendererInstanceBuffer::HINT_DYNAMIC ) + { + m_usage = desc.registerInCUDA ? 0 : D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY; + m_pool = D3DPOOL_DEFAULT; + } +#endif + + onDeviceReset(); + +#if RENDERER_INSTANCING + if(m_d3dVertexBuffer) + { + m_maxInstances = desc.maxInstances; + } +#else + m_maxInstances = desc.maxInstances; + mInstanceBuffer = malloc(m_maxInstances*m_stride); // PX_ALLOC(m_maxInstances*m_stride); +#endif +} + +D3D9RendererInstanceBuffer::~D3D9RendererInstanceBuffer(void) +{ +#if RENDERER_INSTANCING +#if PX_WINDOWS && PX_SUPPORT_GPU_PHYSX + if(m_interopContext && m_registeredInCUDA) + { + PX_ASSERT(m_d3dVertexBuffer); + m_registeredInCUDA = !m_interopContext->unregisterResourceInCuda(m_InteropHandle); + } +#endif + if(m_d3dVertexBuffer) m_d3dVertexBuffer->Release(); +#else + free(mInstanceBuffer); // PX_FREE(mInstanceBuffer); +#endif +} + +void D3D9RendererInstanceBuffer::addVertexElements(PxU32 streamIndex, std::vector<D3DVERTEXELEMENT9> &vertexElements) const +{ + for(PxU32 i=0; i<NUM_SEMANTICS; i++) + { + Semantic semantic = (Semantic)i; + const SemanticDesc &sm = m_semanticDescs[semantic]; + if(sm.format < NUM_FORMATS) + { + PxU8 d3dUsageIndex = 0; + D3DDECLUSAGE d3dUsage = getD3DUsage(semantic, d3dUsageIndex); + vertexElements.push_back(buildVertexElement((WORD)streamIndex, (WORD)sm.offset, getD3DType(sm.format), D3DDECLMETHOD_DEFAULT, (BYTE)d3dUsage, d3dUsageIndex)); + } + } +} + +void *D3D9RendererInstanceBuffer::lock(void) +{ + PX_PROFILE_ZONE("D3D9RenderIBlock",0); + + void *lockedBuffer = 0; +#if RENDERER_INSTANCING + if(m_d3dVertexBuffer) + { + const PxU32 bufferSize = m_maxInstances * m_stride; + m_d3dVertexBuffer->Lock(0, (UINT)bufferSize, &lockedBuffer, 0); + RENDERER_ASSERT(lockedBuffer, "Failed to lock Direct3D9 Vertex Buffer."); + } +#else + lockedBuffer = mInstanceBuffer; +#endif + return lockedBuffer; +} + +void D3D9RendererInstanceBuffer::unlock(void) +{ + PX_PROFILE_ZONE("D3D9RenderIBunlock",0); +#if RENDERER_INSTANCING + if(m_d3dVertexBuffer) + { + m_d3dVertexBuffer->Unlock(); + } +#endif +} + +void D3D9RendererInstanceBuffer::bind(PxU32 streamID, PxU32 firstInstance) const +{ +#if RENDERER_INSTANCING + if(m_d3dVertexBuffer) + { + m_d3dDevice.SetStreamSourceFreq((UINT)streamID, (UINT)(D3DSTREAMSOURCE_INSTANCEDATA | 1)); + m_d3dDevice.SetStreamSource( (UINT)streamID, m_d3dVertexBuffer, firstInstance*m_stride, m_stride); + } +#endif +} + +void D3D9RendererInstanceBuffer::unbind(PxU32 streamID) const +{ +#if RENDERER_INSTANCING + m_d3dDevice.SetStreamSource((UINT)streamID, 0, 0, 0); +#endif +} + +void D3D9RendererInstanceBuffer::onDeviceLost(void) +{ +#if RENDERER_INSTANCING + +#if PX_WINDOWS && PX_SUPPORT_GPU_PHYSX + if(m_interopContext && m_registeredInCUDA) + { + PX_ASSERT(m_d3dVertexBuffer); + m_interopContext->unregisterResourceInCuda(m_InteropHandle); + } +#endif + + m_registeredInCUDA = false; + + if(m_pool != D3DPOOL_MANAGED && m_d3dVertexBuffer) + { + m_d3dVertexBuffer->Release(); + m_d3dVertexBuffer = 0; + } +#endif +} + +void D3D9RendererInstanceBuffer::onDeviceReset(void) +{ +#if RENDERER_INSTANCING + if(!m_d3dVertexBuffer) + { + m_d3dDevice.CreateVertexBuffer(m_bufferSize, m_usage, 0, m_pool, &m_d3dVertexBuffer, 0); + RENDERER_ASSERT(m_d3dVertexBuffer, "Failed to create Direct3D9 Vertex Buffer."); + +#if PX_WINDOWS && PX_SUPPORT_GPU_PHYSX + if(m_interopContext && m_d3dVertexBuffer && m_mustBeRegisteredInCUDA) + { + m_registeredInCUDA = m_interopContext->registerResourceInCudaD3D(m_InteropHandle, m_d3dVertexBuffer); + } +#endif + } +#endif +} + +#endif // #if defined(RENDERER_ENABLE_DIRECT3D9) diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d9/D3D9RendererInstanceBuffer.h b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d9/D3D9RendererInstanceBuffer.h new file mode 100644 index 00000000..bc32d885 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d9/D3D9RendererInstanceBuffer.h @@ -0,0 +1,74 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#ifndef D3D9_RENDERER_INSTANCEBUFFER_H +#define D3D9_RENDERER_INSTANCEBUFFER_H + +#include <RendererConfig.h> + +#if defined(RENDERER_ENABLE_DIRECT3D9) + +#include <RendererInstanceBuffer.h> +#include "D3D9Renderer.h" + +namespace SampleRenderer +{ + + class D3D9RendererInstanceBuffer : public RendererInstanceBuffer, public D3D9RendererResource + { + public: + D3D9RendererInstanceBuffer(IDirect3DDevice9 &d3dDevice, D3D9Renderer& renderer, const RendererInstanceBufferDesc &desc); + virtual ~D3D9RendererInstanceBuffer(void); + + void addVertexElements(PxU32 streamIndex, std::vector<D3DVERTEXELEMENT9> &vertexElements) const; + + protected: + virtual void *lock(void); + virtual void unlock(void); + + virtual void bind(PxU32 streamID, PxU32 firstInstance) const; + virtual void unbind(PxU32 streamID) const; + + private: + virtual void onDeviceLost(void); + virtual void onDeviceReset(void); + + private: +#if RENDERER_INSTANCING + IDirect3DDevice9 &m_d3dDevice; + IDirect3DVertexBuffer9 *m_d3dVertexBuffer; +#else + void *mInstanceBuffer; +#endif + DWORD m_usage; + D3DPOOL m_pool; + UINT m_bufferSize; + }; + +} // namespace SampleRenderer + +#endif // #if defined(RENDERER_ENABLE_DIRECT3D9) +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d9/D3D9RendererMaterial.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d9/D3D9RendererMaterial.cpp new file mode 100644 index 00000000..247e4665 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d9/D3D9RendererMaterial.cpp @@ -0,0 +1,950 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#include <RendererConfig.h> + +#if defined(RENDERER_ENABLE_DIRECT3D9) + +#include "D3D9RendererMaterial.h" +#include <RendererMaterialDesc.h> + +#include "D3D9RendererTexture2D.h" + +#include <stdio.h> + +// for PsString.h +#include <PsString.h> +#include <PxTkFile.h> +#include "SampleDirManager.h" + +namespace Ps = physx::shdfnd; + +using namespace SampleRenderer; + +void D3D9RendererMaterial::setModelMatrix(const float* matrix) +{ + if (m_instancedVertexConstants.table && m_instancedVertexConstants.modelMatrix) + { + m_instancedVertexConstants.table->SetMatrix(m_renderer.getD3DDevice(), m_instancedVertexConstants.modelMatrix, (const D3DXMATRIX*)matrix); + } +} + +D3D9RendererMaterial::ShaderConstants::ShaderConstants(void) +{ + memset(this, 0, sizeof(*this)); +} + +D3D9RendererMaterial::ShaderConstants::~ShaderConstants(void) +{ + if (table) + { + table->Release(); + } +} + +static D3DXHANDLE getShaderConstantByName(ID3DXConstantTable& table, const char* name) +{ + D3DXHANDLE found = 0; + D3DXCONSTANTTABLE_DESC desc; + table.GetDesc(&desc); + for (UINT i = 0; i < desc.Constants; i++) + { + D3DXHANDLE constant = table.GetConstant(0, i); + RENDERER_ASSERT(constant, "Unable to find constant"); + if (constant) + { + D3DXCONSTANT_DESC cdesc; + UINT count = 1; + table.GetConstantDesc(constant, &cdesc, &count); + RENDERER_ASSERT(count == 1, "Unable to obtain Constant Descriptor."); + if (count == 1 && !strcmp(cdesc.Name, name)) + { + found = constant; + break; + } + } + } + return found; +} + +static D3DBLEND getD3DBlendFunc(RendererMaterial::BlendFunc func) +{ + D3DBLEND d3dfunc = D3DBLEND_FORCE_DWORD; + switch (func) + { + case RendererMaterial::BLEND_ZERO: + d3dfunc = D3DBLEND_ZERO; + break; + case RendererMaterial::BLEND_ONE: + d3dfunc = D3DBLEND_ONE; + break; + case RendererMaterial::BLEND_SRC_COLOR: + d3dfunc = D3DBLEND_SRCCOLOR; + break; + case RendererMaterial::BLEND_ONE_MINUS_SRC_COLOR: + d3dfunc = D3DBLEND_INVSRCCOLOR; + break; + case RendererMaterial::BLEND_SRC_ALPHA: + d3dfunc = D3DBLEND_SRCALPHA; + break; + case RendererMaterial::BLEND_ONE_MINUS_SRC_ALPHA: + d3dfunc = D3DBLEND_INVSRCALPHA; + break; + case RendererMaterial::BLEND_DST_ALPHA: + d3dfunc = D3DBLEND_DESTALPHA; + break; + case RendererMaterial::BLEND_ONE_MINUS_DST_ALPHA: + d3dfunc = D3DBLEND_INVDESTALPHA; + break; + case RendererMaterial::BLEND_DST_COLOR: + d3dfunc = D3DBLEND_DESTCOLOR; + break; + case RendererMaterial::BLEND_ONE_MINUS_DST_COLOR: + d3dfunc = D3DBLEND_INVDESTCOLOR; + break; + case RendererMaterial::BLEND_SRC_ALPHA_SATURATE: + d3dfunc = D3DBLEND_SRCALPHASAT; + break; + } + RENDERER_ASSERT(d3dfunc != D3DBLEND_FORCE_DWORD, "Failed to look up D3D Blend Func."); + return d3dfunc; +} + +void D3D9RendererMaterial::ShaderConstants::loadConstants(void) +{ + if (table) + { + modelMatrix = table->GetConstantByName(0, "g_" "modelMatrix"); + viewMatrix = table->GetConstantByName(0, "g_" "viewMatrix"); + projMatrix = table->GetConstantByName(0, "g_" "projMatrix"); + modelViewMatrix = table->GetConstantByName(0, "g_" "modelViewMatrix"); + modelViewProjMatrix = table->GetConstantByName(0, "g_" "modelViewProjMatrix"); + + boneMatrices = getShaderConstantByName(*table, "g_" "boneMatrices"); + + fogColorAndDistance = table->GetConstantByName(0, "g_" "fogColorAndDistance"); + + eyePosition = table->GetConstantByName(0, "g_" "eyePosition"); + eyeDirection = table->GetConstantByName(0, "g_" "eyeDirection"); + + ambientColor = table->GetConstantByName(0, "g_" "ambientColor"); + + lightColor = table->GetConstantByName(0, "g_" "lightColor"); + lightIntensity = table->GetConstantByName(0, "g_" "lightIntensity"); + lightDirection = table->GetConstantByName(0, "g_" "lightDirection"); + lightPosition = table->GetConstantByName(0, "g_" "lightPosition"); + lightInnerRadius = table->GetConstantByName(0, "g_" "lightInnerRadius"); + lightOuterRadius = table->GetConstantByName(0, "g_" "lightOuterRadius"); + lightInnerCone = table->GetConstantByName(0, "g_" "lightInnerCone"); + lightOuterCone = table->GetConstantByName(0, "g_" "lightOuterCone"); + + lightShadowMap = table->GetConstantByName(0, "g_" "lightShadowMap"); + lightShadowMatrix = table->GetConstantByName(0, "g_" "lightShadowMatrix"); + + vfaceScale = table->GetConstantByName(0, "g_" "vfaceScale"); + } +} + +void D3D9RendererMaterial::ShaderConstants::bindEnvironment(IDirect3DDevice9& d3dDevice, const D3D9Renderer::ShaderEnvironment& shaderEnv) const +{ + if (table) + { +#define SET_MATRIX(_name) \ + if(_name) \ + { \ + const D3DXMATRIX xm(shaderEnv._name); \ + table->SetMatrix(&d3dDevice, _name, &xm); \ + } + +#define SET_FLOAT3(_name) \ + if(_name) \ + { \ + const D3DXVECTOR4 xv(shaderEnv._name[0], \ + shaderEnv._name[1], \ + shaderEnv._name[2], 1); \ + table->SetVector(&d3dDevice, _name, &xv); \ + } + +#define SET_FLOAT4(_name) \ + if(_name) \ + { \ + const D3DXVECTOR4 xv(shaderEnv._name[0], \ + shaderEnv._name[1], \ + shaderEnv._name[2], \ + shaderEnv._name[3]); \ + table->SetVector(&d3dDevice, _name, &xv); \ + } + +#define SET_COLOR(_name) \ + if(_name) \ + { \ + const D3DXCOLOR xc(shaderEnv._name); \ + const D3DXVECTOR4 xv(xc.r, xc.g, xc.b, xc.a); \ + table->SetVector(&d3dDevice, _name, &xv); \ + } + +#define SET_FLOAT(_name) \ + if(_name) table->SetFloat(&d3dDevice, _name, shaderEnv._name); + + SET_MATRIX(modelMatrix) + SET_MATRIX(viewMatrix) + SET_MATRIX(projMatrix) + SET_MATRIX(modelViewMatrix) + SET_MATRIX(modelViewProjMatrix) + + if (boneMatrices && shaderEnv.numBones > 0) + { + table->SetMatrixArray(&d3dDevice, boneMatrices, shaderEnv.boneMatrices, shaderEnv.numBones); + } + + SET_FLOAT4(fogColorAndDistance) + + + SET_FLOAT3(eyePosition) + SET_FLOAT3(eyeDirection) + + SET_COLOR(ambientColor) + + SET_COLOR(lightColor) + SET_FLOAT(lightIntensity) + SET_FLOAT3(lightDirection) + SET_FLOAT3(lightPosition) + SET_FLOAT(lightInnerRadius) + SET_FLOAT(lightOuterRadius) + SET_FLOAT(lightInnerCone) + SET_FLOAT(lightOuterCone) + if (lightShadowMap) + { + UINT index = table->GetSamplerIndex(lightShadowMap); + d3dDevice.SetSamplerState((DWORD)index, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR); + d3dDevice.SetSamplerState((DWORD)index, D3DSAMP_MINFILTER, D3DTEXF_LINEAR); + d3dDevice.SetSamplerState((DWORD)index, D3DSAMP_MIPFILTER, D3DTEXF_LINEAR); + d3dDevice.SetSamplerState((DWORD)index, D3DSAMP_ADDRESSU, D3DTADDRESS_CLAMP); + d3dDevice.SetSamplerState((DWORD)index, D3DSAMP_ADDRESSV, D3DTADDRESS_CLAMP); + d3dDevice.SetTexture(index, shaderEnv.lightShadowMap); + } + SET_MATRIX(lightShadowMatrix) + + if (vfaceScale) + { + float vfs = 1.0f; + DWORD cullmode = 0; + d3dDevice.GetRenderState(D3DRS_CULLMODE, &cullmode); + if (cullmode == D3DCULL_CW) + { + vfs = -1.0f; + } +#if defined(RENDERER_XBOX360) + else if (cullmode == D3DCULL_NONE) + { + vfs = -1.0f; + } +#endif + table->SetFloat(&d3dDevice, vfaceScale, vfs); + } + +#undef SET_MATRIX +#undef SET_FLOAT3 +#undef SET_FLOAT4 +#undef SET_COLOR +#undef SET_FLOAT + } +} + +/************************************** +* D3D9RendererMaterial::D3D9Variable * +**************************************/ + +D3D9RendererMaterial::D3D9Variable::D3D9Variable(const char* name, VariableType type, PxU32 offset) : + Variable(name, type, offset) +{ + m_vertexHandle = 0; + memset(m_fragmentHandles, 0, sizeof(m_fragmentHandles)); +} + +D3D9RendererMaterial::D3D9Variable::~D3D9Variable(void) +{ + +} + +void D3D9RendererMaterial::D3D9Variable::addVertexHandle(ID3DXConstantTable& table, D3DXHANDLE handle) +{ + m_vertexHandle = handle; + D3DXCONSTANT_DESC cdesc; + UINT count = 1; + table.GetConstantDesc(handle, &cdesc, &count); + m_vertexRegister = cdesc.RegisterIndex; +} + +void D3D9RendererMaterial::D3D9Variable::addFragmentHandle(ID3DXConstantTable& table, D3DXHANDLE handle, Pass pass) +{ + m_fragmentHandles[pass] = handle; + D3DXCONSTANT_DESC cdesc; + UINT count = 1; + table.GetConstantDesc(handle, &cdesc, &count); + m_fragmentRegisters[pass] = cdesc.RegisterIndex; +} + +/********************************* +* D3D Shader Compiler Callbacks * +*********************************/ + +static void processCompileErrors(LPD3DXBUFFER errors) +{ +#if defined(RENDERER_WINDOWS) + if (errors) + { + const char* errorStr = (const char*)errors->GetBufferPointer(); + if (errorStr) + { + static bool ignoreErrors = false; + if (!ignoreErrors) + { + int ret = MessageBoxA(0, errorStr, "D3DXCompileShaderFromFile Error", MB_ABORTRETRYIGNORE); + if (ret == IDABORT) + { + exit(0); + } + else if (ret == IDIGNORE) + { + ignoreErrors = true; + } + } + } + } +#elif defined(RENDERER_XBOX360) + // this allows to watch errors in the debugger + if(errors) + { + const char *errorStr = (const char*)errors->GetBufferPointer(); + PX_UNUSED(errorStr); + } +#endif +} + +class D3D9ShaderIncluder : public ID3DXInclude +{ +public: + D3D9ShaderIncluder(const char* assetDir) : m_assetDir(assetDir) {} + +private: +#if defined(RENDERER_XBOX360) + STDMETHOD(Open)(THIS_ D3DXINCLUDE_TYPE includeType, LPCSTR fileName, LPCVOID parentData, LPCVOID* data, UINT* dataSize, LPSTR pFullPath, DWORD cbFullPath) +#else + STDMETHOD(Open)(THIS_ D3DXINCLUDE_TYPE includeType, LPCSTR fileName, LPCVOID parentData, LPCVOID* data, UINT* dataSize) +#endif + { + HRESULT result = D3DERR_NOTFOUND; + + char fullpath[1024]; + Ps::strlcpy(fullpath, 1024, m_assetDir); + Ps::strlcat(fullpath, 1024, "shaders/"); + if (includeType == D3DXINC_SYSTEM) + { + Ps::strlcat(fullpath, 1024, "include/"); + } + Ps::strlcat(fullpath, 1024, fileName); + + FILE* file = 0; + PxToolkit::fopen_s(&file, fullpath, "r"); + if (file) + { + fseek(file, 0, SEEK_END); + size_t fileLen = ftell(file); + if (fileLen > 1) + { + fseek(file, 0, SEEK_SET); + char* fileData = new char[fileLen + 1]; + fileLen = fread(fileData, 1, fileLen, file); + fileData[fileLen] = 0; + *data = fileData; + *dataSize = (UINT)fileLen; + } + fclose(file); + result = D3D_OK; + } + RENDERER_ASSERT(result == D3D_OK, "Failed to include shader header."); + return result; + } + + STDMETHOD(Close)(THIS_ LPCVOID data) + { + delete []((char*)data); + return D3D_OK; + } + + const char* m_assetDir; +}; + +D3D9RendererMaterial::D3D9RendererMaterial(D3D9Renderer& renderer, const RendererMaterialDesc& desc) : + RendererMaterial(desc, renderer.getEnableMaterialCaching()), + m_renderer(renderer) +{ + m_d3dAlphaTestFunc = D3DCMP_ALWAYS; + m_vertexShader = 0; + m_instancedVertexShader = 0; + memset(m_fragmentPrograms, 0, sizeof(m_fragmentPrograms)); + + AlphaTestFunc alphaTestFunc = getAlphaTestFunc(); + switch (alphaTestFunc) + { + case ALPHA_TEST_ALWAYS: + m_d3dAlphaTestFunc = D3DCMP_ALWAYS; + break; + case ALPHA_TEST_EQUAL: + m_d3dAlphaTestFunc = D3DCMP_EQUAL; + break; + case ALPHA_TEST_NOT_EQUAL: + m_d3dAlphaTestFunc = D3DCMP_NOTEQUAL; + break; + case ALPHA_TEST_LESS: + m_d3dAlphaTestFunc = D3DCMP_LESS; + break; + case ALPHA_TEST_LESS_EQUAL: + m_d3dAlphaTestFunc = D3DCMP_LESSEQUAL; + break; + case ALPHA_TEST_GREATER: + m_d3dAlphaTestFunc = D3DCMP_GREATER; + break; + case ALPHA_TEST_GREATER_EQUAL: + m_d3dAlphaTestFunc = D3DCMP_GREATEREQUAL; + break; + default: + RENDERER_ASSERT(0, "Unknown Alpha Test Func."); + } + + m_d3dSrcBlendFunc = getD3DBlendFunc(getSrcBlendFunc()); + m_d3dDstBlendFunc = getD3DBlendFunc(getDstBlendFunc()); + + D3D9Renderer::D3DXInterface& d3dx = m_renderer.getD3DX(); + IDirect3DDevice9* d3dDevice = m_renderer.getD3DDevice(); + if (d3dDevice) + { + D3D9ShaderIncluder shaderIncluder(m_renderer.getAssetDir()); + + const char* vertexEntry = "vmain"; + const char* vertexProfile = d3dx.GetVertexShaderProfile(d3dDevice); + const char* vertexShaderPath = desc.vertexShaderPath; + const DWORD vertexFlags = D3DXSHADER_PACKMATRIX_COLUMNMAJOR; + const D3DXMACRO vertexDefines[] = + { + {"RENDERER_VERTEX", "1"}, + {"RENDERER_D3D", "1"}, + {"SEMANTIC_TANGENT", "TANGENT"}, // This will prevent mapping tangent to texcoord5 and instead to the proper TANGENT semantic + {0, 0} + }; + + LPD3DXBUFFER vshader = 0; + + HRESULT result = loadCacheShader(vertexShaderPath, ".cache", vertexDefines, &shaderIncluder, vertexEntry, vertexProfile, vertexFlags, vshader, &m_vertexConstants.table); + + if (result == D3D_OK && vshader) + { + result = d3dDevice->CreateVertexShader((const DWORD*)vshader->GetBufferPointer(), &m_vertexShader); + RENDERER_ASSERT(result == D3D_OK && m_vertexShader, "Failed to load Vertex Shader."); + if (result == D3D_OK && m_vertexShader) + { + m_vertexConstants.loadConstants(); + if (m_vertexConstants.table) + { + loadCustomConstants(*m_vertexConstants.table, NUM_PASSES); + } + } + } + + if(vshader) + { + vshader->Release(); + } + +#if RENDERER_INSTANCING + const D3DXMACRO vertexDefinesInstanced[] = + { + {"RENDERER_VERTEX", "1"}, + {"RENDERER_D3D", "1"}, + {"RENDERER_INSTANCED", "1"}, + {"SEMANTIC_TANGENT", "TANGENT"}, +#if PX_WINDOWS + {"PX_WINDOWS", "1"}, +#endif + {0, 0} + }; +#else + const D3DXMACRO vertexDefinesInstanced[] = + { + {"RENDERER_VERTEX", "1"}, + {"RENDERER_INSTANCED", "0"}, + {"SEMANTIC_TANGENT", "TANGENT"}, +#if PX_WINDOWS + {"PX_WINDOWS", "1"}, +#endif + {0, 0} + }; +#endif + vshader = 0; + result = loadCacheShader(vertexShaderPath, ".instcache", vertexDefinesInstanced, &shaderIncluder, vertexEntry, vertexProfile, vertexFlags, vshader, &m_instancedVertexConstants.table); + + if (result == D3D_OK && vshader) + { + result = d3dDevice->CreateVertexShader((const DWORD*)vshader->GetBufferPointer(), &m_instancedVertexShader); + RENDERER_ASSERT(result == D3D_OK && m_vertexShader, "Failed to load Vertex Shader."); + if (result == D3D_OK && m_vertexShader) + { + m_instancedVertexConstants.loadConstants(); + if (m_instancedVertexConstants.table) + { + loadCustomConstants(*m_instancedVertexConstants.table, NUM_PASSES); + } + } + } + if (vshader) + { + vshader->Release(); + } + + const char* fragmentEntry = "fmain"; + const char* fragmentProfile = d3dx.GetPixelShaderProfile(d3dDevice); + const char* fragmentShaderPath = desc.fragmentShaderPath; + const DWORD fragmentFlags = D3DXSHADER_PACKMATRIX_COLUMNMAJOR; + + // profile string in the format "ps_x_x" + int majorVersion = fragmentProfile[3]-'0'; + + // vface is sm3.0 and up + bool vFaceSupported = majorVersion > 2; + // shadow shader pushes fragment prog registers > 32 which limits support to sm 3.0 as well + bool shadowsSupported = majorVersion > 2; + PX_UNUSED(shadowsSupported); + + for (PxU32 i = 0; i < NUM_PASSES; i++) + { + const D3DXMACRO fragmentDefines[] = + { + {"RENDERER_FRAGMENT", "1"}, + {getPassName((Pass)i), "1"}, + {"ENABLE_VFACE", vFaceSupported?"1":"0"}, + {"ENABLE_VFACE_SCALE", vFaceSupported?"1":"0"}, +#if PX_WINDOWS + {"PX_WINDOWS", "1"}, + {"ENABLE_SHADOWS", shadowsSupported?"1":"0"}, +#endif + {0, 0} + }; + LPD3DXBUFFER fshader = 0; + char suffix[32]; + Ps::snprintf(suffix, 32, ".cache%d", i); + result = loadCacheShader(fragmentShaderPath, suffix, fragmentDefines, &shaderIncluder, fragmentEntry, fragmentProfile, fragmentFlags, fshader, &m_fragmentConstants[i].table); + if (result == D3D_OK && fshader) + { + result = d3dDevice->CreatePixelShader((const DWORD*)fshader->GetBufferPointer(), &m_fragmentPrograms[i]); + RENDERER_ASSERT(result == D3D_OK && m_fragmentPrograms[i], "Failed to load Fragment Shader."); + if (result == D3D_OK && m_fragmentPrograms[i]) + { + m_fragmentConstants[i].loadConstants(); + if (m_fragmentConstants[i].table) + { + loadCustomConstants(*m_fragmentConstants[i].table, (Pass)i); + } + } + } + if (fshader) + { + fshader->Release(); + } + } + } +} + +D3D9RendererMaterial::~D3D9RendererMaterial(void) +{ + if (m_vertexShader) + { + m_vertexShader->Release(); + } + if (m_instancedVertexShader) + { + m_instancedVertexShader->Release(); + } + for (PxU32 i = 0; i < NUM_PASSES; i++) + { + IDirect3DPixelShader9* fp = m_fragmentPrograms[i]; + if (fp) + { + fp->Release(); + } + } +} + +void D3D9RendererMaterial::bind(RendererMaterial::Pass pass, RendererMaterialInstance* materialInstance, bool instanced) const +{ + IDirect3DDevice9* d3dDevice = m_renderer.getD3DDevice(); + RENDERER_ASSERT(pass < NUM_PASSES, "Invalid Material Pass."); + if (d3dDevice && pass < NUM_PASSES) + { + const D3D9Renderer::ShaderEnvironment& shaderEnv = m_renderer.getShaderEnvironment(); + + if (m_d3dAlphaTestFunc == D3DCMP_ALWAYS) + { + d3dDevice->SetRenderState(D3DRS_ALPHATESTENABLE, 0); + } + else + { + PxU8 alphaTestRef = (PxU8)(PxClamp(getAlphaTestRef(), 0.0f, 1.0f) * 255.0f); + d3dDevice->SetRenderState(D3DRS_ALPHATESTENABLE, 1); + d3dDevice->SetRenderState(D3DRS_ALPHAFUNC, (DWORD)m_d3dAlphaTestFunc); + d3dDevice->SetRenderState(D3DRS_ALPHAREF , (DWORD)alphaTestRef); + } + + if (getBlending()) + { + d3dDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, 1); + d3dDevice->SetRenderState(D3DRS_ZWRITEENABLE, 0); + d3dDevice->SetRenderState(D3DRS_SRCBLEND, (DWORD)m_d3dSrcBlendFunc); + d3dDevice->SetRenderState(D3DRS_DESTBLEND, (DWORD)m_d3dDstBlendFunc); + } + + if (instanced) + { + d3dDevice->SetVertexShader(m_instancedVertexShader); + } + else + { + d3dDevice->SetVertexShader(m_vertexShader); + } + + m_fragmentConstants[pass].bindEnvironment(*d3dDevice, shaderEnv); + d3dDevice->SetPixelShader(m_fragmentPrograms[pass]); + + RendererMaterial::bind(pass, materialInstance, instanced); + } +} + +void D3D9RendererMaterial::bindMeshState(bool instanced) const +{ + IDirect3DDevice9* d3dDevice = m_renderer.getD3DDevice(); + if (d3dDevice) + { + const D3D9Renderer::ShaderEnvironment& shaderEnv = m_renderer.getShaderEnvironment(); + + if (instanced) + { + m_instancedVertexConstants.bindEnvironment(*d3dDevice, shaderEnv); + } + else + { + m_vertexConstants.bindEnvironment(*d3dDevice, shaderEnv); + } + } +} + +void D3D9RendererMaterial::unbind(void) const +{ + IDirect3DDevice9* d3dDevice = m_renderer.getD3DDevice(); + if (d3dDevice) + { + if (getBlending()) + { + d3dDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, 0); + d3dDevice->SetRenderState(D3DRS_ZWRITEENABLE, 1); + } + + d3dDevice->SetVertexShader(0); + d3dDevice->SetPixelShader(0); + } +} + +template<class TextureType, class D3DTextureType> +static void bindSamplerVariable(IDirect3DDevice9& d3dDevice, ID3DXConstantTable& table, D3DXHANDLE handle, TextureType& texture) +{ + if (handle) + { + UINT samplerIndex = table.GetSamplerIndex(handle); + static_cast<D3DTextureType*>(&texture)->bind(samplerIndex); + } +} + +void D3D9RendererMaterial::bindVariable(Pass pass, const Variable& variable, const void* data) const +{ + D3D9Variable& var = *(D3D9Variable*)&variable; + IDirect3DDevice9* d3dDevice = m_renderer.getD3DDevice(); + if (d3dDevice) + { + switch (var.getType()) + { + case VARIABLE_FLOAT: + { + const float fdata[4] = {*(const float*)data, 0, 0, 0}; + if (var.m_vertexHandle) + { + d3dDevice->SetVertexShaderConstantF(var.m_vertexRegister, fdata, 1); + } + else if (var.m_fragmentHandles[pass]) + { + d3dDevice->SetPixelShaderConstantF(var.m_fragmentRegisters[pass], fdata, 1); + } + break; + } + case VARIABLE_FLOAT2: + { + const float fdata[4] = {((const float*)data)[0], ((const float*)data)[1], 0, 0}; + if (var.m_vertexHandle) + { + d3dDevice->SetVertexShaderConstantF(var.m_vertexRegister, fdata, 1); + } + else if (var.m_fragmentHandles[pass]) + { + d3dDevice->SetPixelShaderConstantF(var.m_fragmentRegisters[pass], fdata, 1); + } + break; + } + case VARIABLE_FLOAT3: + { + const float fdata[4] = {((const float*)data)[0], ((const float*)data)[1], ((const float*)data)[2], 0}; + if (var.m_vertexHandle) + { + d3dDevice->SetVertexShaderConstantF(var.m_vertexRegister, fdata, 1); + } + else if (var.m_fragmentHandles[pass]) + { + d3dDevice->SetPixelShaderConstantF(var.m_fragmentRegisters[pass], fdata, 1); + } + break; + } + case VARIABLE_FLOAT4: + { + const float fdata[4] = {((const float*)data)[0], ((const float*)data)[1], ((const float*)data)[2], ((const float*)data)[3]}; + if (var.m_vertexHandle) + { + d3dDevice->SetVertexShaderConstantF(var.m_vertexRegister, fdata, 1); + } + else if (var.m_fragmentHandles[pass]) + { + d3dDevice->SetPixelShaderConstantF(var.m_fragmentRegisters[pass], fdata, 1); + } + break; + } + case VARIABLE_SAMPLER2D: + data = *(void**)data; + RENDERER_ASSERT(data, "NULL Sampler."); + if (data) + { + bindSamplerVariable<RendererTexture2D, D3D9RendererTexture2D>(*m_renderer.getD3DDevice(), *m_vertexConstants.table, var.m_vertexHandle, *(RendererTexture2D*)data); + bindSamplerVariable<RendererTexture2D, D3D9RendererTexture2D>(*m_renderer.getD3DDevice(), *m_fragmentConstants[pass].table, var.m_fragmentHandles[pass], *(RendererTexture2D*)data); + } + break; + case VARIABLE_SAMPLER3D: + RENDERER_ASSERT(0, "3D D3D9 Textures Not Implemented."); + /* + data = *(void**)data; + RENDERER_ASSERT(data, "NULL Sampler."); + if (data) + { + bindSamplerVariable<RendererTexture3D, D3D9RendererTexture3D>(*m_renderer.getD3DDevice(), *m_vertexConstants.table, var.m_vertexHandle, *(RendererTexture2D*)data); + bindSamplerVariable<RendererTexture3D, D3D9RendererTexture3D>(*m_renderer.getD3DDevice(), *m_fragmentConstants[pass].table, var.m_fragmentHandles[pass], *(RendererTexture2D*)data); + } + */ + break; + } + } +} + +static RendererMaterial::VariableType getVariableType(const D3DXCONSTANT_DESC& desc) +{ + RendererMaterial::VariableType vt = RendererMaterial::NUM_VARIABLE_TYPES; + switch (desc.Type) + { + case D3DXPT_FLOAT: + if (desc.Rows == 4 && desc.Columns == 4) + { + vt = RendererMaterial::VARIABLE_FLOAT4x4; + } + else if (desc.Rows == 1 && desc.Columns == 1) + { + vt = RendererMaterial::VARIABLE_FLOAT; + } + else if (desc.Rows == 1 && desc.Columns == 2) + { + vt = RendererMaterial::VARIABLE_FLOAT2; + } + else if (desc.Rows == 1 && desc.Columns == 3) + { + vt = RendererMaterial::VARIABLE_FLOAT3; + } + else if (desc.Rows == 1 && desc.Columns == 4) + { + vt = RendererMaterial::VARIABLE_FLOAT4; + } + break; + case D3DXPT_SAMPLER2D: + vt = RendererMaterial::VARIABLE_SAMPLER2D; + break; + } + RENDERER_ASSERT(vt < RendererMaterial::NUM_VARIABLE_TYPES, "Unable to convert shader variable type."); + return vt; +} + +void D3D9RendererMaterial::loadCustomConstants(ID3DXConstantTable& table, Pass pass) +{ + D3DXCONSTANTTABLE_DESC desc; + table.GetDesc(&desc); + for (UINT i = 0; i < desc.Constants; i++) + { + D3DXHANDLE constant = table.GetConstant(0, i); + RENDERER_ASSERT(constant, "Unable to find constant"); + if (constant) + { + D3DXCONSTANT_DESC cdesc; + UINT count = 1; + table.GetConstantDesc(constant, &cdesc, &count); + PX_ASSERT(count == 1); + if (count == 1 && strncmp(cdesc.Name, "g_", 2)) + { + VariableType type = getVariableType(cdesc); + if (type < NUM_VARIABLE_TYPES) + { + D3D9Variable* var = 0; + // search to see if the variable already exists... + PxU32 numVariables = (PxU32)m_variables.size(); + for (PxU32 j = 0; j < numVariables; j++) + { + if (!strcmp(m_variables[j]->getName(), cdesc.Name)) + { + var = static_cast<D3D9Variable*>(m_variables[j]); + break; + } + } + // check to see if the variable is of the same type. + if (var) + { + RENDERER_ASSERT(var->getType() == type, "Variable changes type!"); + } + // if we couldn't find the variable... create a new variable... + if (!var) + { + var = new D3D9Variable(cdesc.Name, type, m_variableBufferSize); + m_variables.push_back(var); + m_variableBufferSize += var->getDataSize(); + } + // add the handle to the variable... + if (pass < NUM_PASSES) + { + var->addFragmentHandle(table, constant, pass); + } + else + { + var->addVertexHandle(table, constant); + } + } + } + } + } +} + +HRESULT D3D9RendererMaterial::loadCacheShader(LPCSTR shaderFilePath, const char* suffix, CONST D3DXMACRO *defines, LPD3DXINCLUDE shaderIncluder, LPCSTR functionName, LPCSTR profile, DWORD flags, LPD3DXBUFFER &shader, LPD3DXCONSTANTTABLE *constantTable) +{ + const char* cacheDir = m_renderer.getCacheShaderDir(); + D3D9Renderer::D3DXInterface &d3dx = m_renderer.getD3DX(); + char fullpath[1024]; + FILE* file = NULL; + WIN32_FIND_DATA FindFileData; + + if(cacheDir) + { + //get shader file time + char originpath[1024]; + Ps::strlcpy(originpath, 1024, m_renderer.getAssetDir()); + Ps::strlcat(originpath, 1024, "shaders/"); + Ps::strlcat(originpath, 1024, shaderFilePath); + + HANDLE hFind = FindFirstFile(originpath, &FindFileData); + if (hFind == INVALID_HANDLE_VALUE) + return D3DERR_NOTAVAILABLE; + FindClose(hFind); + + //read cached file + char relativepath[512]; + Ps::strlcpy(relativepath, 512, shaderFilePath); + Ps::strlcat(relativepath, 512, suffix); + + SampleFramework::SampleDirManager cacheOutputDirManager(cacheDir, false); + cacheOutputDirManager.getFilePath(relativepath, fullpath, false); + + PxToolkit::fopen_s(&file, fullpath, "rb"); + if(file) + { + FILETIME lastWriteTime1; + fread(&lastWriteTime1, 1, sizeof(FILETIME), file); + + if( CompareFileTime(&FindFileData.ftLastWriteTime, &lastWriteTime1) == 0) + { + PxU32 shaderSize; + size_t len = fread(&shaderSize, 1, sizeof(PxU32), file); + + HRESULT result = d3dx.CreateBuffer( shaderSize, &shader); + PX_ASSERT( result == D3D_OK); + if(result == D3D_OK) + { + len = fread(shader->GetBufferPointer(), 1, shader->GetBufferSize(), file); + PX_ASSERT(len == shaderSize); + result = d3dx.GetShaderConstantTable((const DWORD*)shader->GetBufferPointer(), constantTable); + } + fclose(file); + return result; + } + fclose(file); + } + } + + LPD3DXBUFFER errors = 0; + + HRESULT result = d3dx.CompileShaderFromFileA(shaderFilePath, defines, shaderIncluder, functionName, profile, flags, &shader, &errors, constantTable); + processCompileErrors(errors); + RENDERER_ASSERT(result == D3D_OK && shader, "Failed to compile shader."); + if(errors) + { + errors->Release(); + } + + //save compiled shader + if(cacheDir && result == D3D_OK && shader) + { + PxToolkit::fopen_s(&file, fullpath, "wb"); + if(file) + { + fwrite(&FindFileData.ftLastWriteTime, 1, sizeof(FILETIME), file); + + PxU32 shaderSize = shader->GetBufferSize(); + fwrite(&shaderSize, 1, sizeof(PxU32), file); + fwrite(shader->GetBufferPointer(), 1, shaderSize, file); + fclose(file); + } + } + + return result; +} + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d9/D3D9RendererMaterial.h b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d9/D3D9RendererMaterial.h new file mode 100644 index 00000000..10ba4e64 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d9/D3D9RendererMaterial.h @@ -0,0 +1,146 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#ifndef D3D9_RENDERER_MATERIAL_H +#define D3D9_RENDERER_MATERIAL_H + +#include <RendererConfig.h> + +#if defined(RENDERER_ENABLE_DIRECT3D9) + +#include <RendererMaterial.h> + +#include "D3D9Renderer.h" + +namespace SampleRenderer +{ + + class D3D9Renderer; + + class D3D9RendererMaterial : public RendererMaterial + { + public: + D3D9RendererMaterial(D3D9Renderer &renderer, const RendererMaterialDesc &desc); + virtual ~D3D9RendererMaterial(void); + virtual void setModelMatrix(const float *matrix); + + private: + virtual const Renderer& getRenderer() const { return m_renderer; } + virtual void bind(RendererMaterial::Pass pass, RendererMaterialInstance *materialInstance, bool instanced) const; + virtual void bindMeshState(bool instanced) const; + virtual void unbind(void) const; + virtual void bindVariable(Pass pass, const Variable &variable, const void *data) const; + + void loadCustomConstants(ID3DXConstantTable &table, Pass pass); + HRESULT loadCacheShader(LPCSTR shaderFilePath, const char* suffix, CONST D3DXMACRO *defines, LPD3DXINCLUDE shaderIncluder, + LPCSTR functionName, LPCSTR profile, DWORD flags, LPD3DXBUFFER &shader, LPD3DXCONSTANTTABLE *constantTable); + + private: + class ShaderConstants + { + public: + LPD3DXCONSTANTTABLE table; + + D3DXHANDLE modelMatrix; + D3DXHANDLE viewMatrix; + D3DXHANDLE projMatrix; + D3DXHANDLE modelViewMatrix; + D3DXHANDLE modelViewProjMatrix; + + D3DXHANDLE boneMatrices; + + D3DXHANDLE fogColorAndDistance; + + D3DXHANDLE eyePosition; + D3DXHANDLE eyeDirection; + + D3DXHANDLE ambientColor; + + D3DXHANDLE lightColor; + D3DXHANDLE lightIntensity; + D3DXHANDLE lightDirection; + D3DXHANDLE lightPosition; + D3DXHANDLE lightInnerRadius; + D3DXHANDLE lightOuterRadius; + D3DXHANDLE lightInnerCone; + D3DXHANDLE lightOuterCone; + D3DXHANDLE lightShadowMap; + D3DXHANDLE lightShadowMatrix; + + D3DXHANDLE vfaceScale; + + public: + ShaderConstants(void); + ~ShaderConstants(void); + + void loadConstants(void); + + void bindEnvironment(IDirect3DDevice9 &d3dDevice, const D3D9Renderer::ShaderEnvironment &shaderEnv) const; + }; + + class D3D9Variable : public Variable + { + friend class D3D9RendererMaterial; + public: + D3D9Variable(const char *name, VariableType type, PxU32 offset); + virtual ~D3D9Variable(void); + + void addVertexHandle(ID3DXConstantTable &table, D3DXHANDLE handle); + void addFragmentHandle(ID3DXConstantTable &table, D3DXHANDLE handle, Pass pass); + + private: + D3D9Variable &operator=(const D3D9Variable&) { return *this; } + + private: + D3DXHANDLE m_vertexHandle; + UINT m_vertexRegister; + D3DXHANDLE m_fragmentHandles[NUM_PASSES]; + UINT m_fragmentRegisters[NUM_PASSES]; + }; + + private: + D3D9RendererMaterial &operator=(const D3D9RendererMaterial&) { return *this; } + + private: + D3D9Renderer &m_renderer; + + D3DCMPFUNC m_d3dAlphaTestFunc; + D3DBLEND m_d3dSrcBlendFunc; + D3DBLEND m_d3dDstBlendFunc; + + IDirect3DVertexShader9 *m_vertexShader; + IDirect3DVertexShader9 *m_instancedVertexShader; + IDirect3DPixelShader9 *m_fragmentPrograms[NUM_PASSES]; + + ShaderConstants m_vertexConstants; + ShaderConstants m_instancedVertexConstants; + ShaderConstants m_fragmentConstants[NUM_PASSES]; + }; + +} // namespace SampleRenderer + +#endif // #if defined(RENDERER_ENABLE_DIRECT3D9) +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d9/D3D9RendererMesh.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d9/D3D9RendererMesh.cpp new file mode 100644 index 00000000..f403c7f0 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d9/D3D9RendererMesh.cpp @@ -0,0 +1,333 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#include <RendererConfig.h> + +#if defined(RENDERER_ENABLE_DIRECT3D9) + +#include "D3D9RendererMesh.h" +#include "D3D9RendererVertexBuffer.h" +#include "D3D9RendererInstanceBuffer.h" + +#include <RendererMeshDesc.h> + +#include <SamplePlatform.h> + +#pragma warning(disable:4702 4189) + +using namespace SampleRenderer; + +static D3DVERTEXELEMENT9 buildVertexElement(WORD stream, WORD offset, D3DDECLTYPE type, BYTE method, BYTE usage, BYTE usageIndex) +{ + D3DVERTEXELEMENT9 element; + element.Stream = stream; + element.Offset = offset; +#if defined(RENDERER_WINDOWS) + element.Type = (BYTE)type; +#else + element.Type = type; +#endif + element.Method = method; + element.Usage = usage; + element.UsageIndex = usageIndex; + return element; +} + +D3D9RendererMesh::D3D9RendererMesh(D3D9Renderer &renderer, const RendererMeshDesc &desc) : +RendererMesh(desc), + m_renderer(renderer) +{ + m_d3dVertexDecl = 0; + + IDirect3DDevice9 *d3dDevice = m_renderer.getD3DDevice(); + RENDERER_ASSERT(d3dDevice, "Renderer's D3D Device not found!"); + if(d3dDevice) + { + PxU32 numVertexBuffers = getNumVertexBuffers(); + const RendererVertexBuffer *const*vertexBuffers = getVertexBuffers(); + std::vector<D3DVERTEXELEMENT9> vertexElements; + for(PxU32 i=0; i<numVertexBuffers; i++) + { + const RendererVertexBuffer *vb = vertexBuffers[i]; + if(vb) + { + const D3D9RendererVertexBuffer &d3dVb = *static_cast<const D3D9RendererVertexBuffer*>(vb); + d3dVb.addVertexElements(i, vertexElements); + } + } +#if RENDERER_INSTANCING + if(m_instanceBuffer) + { + static_cast<const D3D9RendererInstanceBuffer*>(m_instanceBuffer)->addVertexElements(numVertexBuffers, vertexElements); + } +#endif + vertexElements.push_back(buildVertexElement(0xFF, 0, D3DDECLTYPE_UNUSED, 0, 0, 0)); + + d3dDevice->CreateVertexDeclaration(&vertexElements[0], &m_d3dVertexDecl); + RENDERER_ASSERT(m_d3dVertexDecl, "Failed to create Direct3D9 Vertex Declaration."); + } +} + +D3D9RendererMesh::~D3D9RendererMesh(void) +{ + if(m_d3dVertexDecl) + { + SampleFramework::SamplePlatform::platform()->D3D9BlockUntilNotBusy(m_d3dVertexDecl); + m_d3dVertexDecl->Release(); + m_d3dVertexDecl = 0; + } +} + +static D3DPRIMITIVETYPE getD3DPrimitive(RendererMesh::Primitive primitive) +{ + D3DPRIMITIVETYPE d3dPrimitive = D3DPT_FORCE_DWORD; + switch(primitive) + { + case RendererMesh::PRIMITIVE_POINTS: d3dPrimitive = D3DPT_POINTLIST; break; + case RendererMesh::PRIMITIVE_LINES: d3dPrimitive = D3DPT_LINELIST; break; + case RendererMesh::PRIMITIVE_LINE_STRIP: d3dPrimitive = D3DPT_LINESTRIP; break; + case RendererMesh::PRIMITIVE_TRIANGLES: d3dPrimitive = D3DPT_TRIANGLELIST; break; + case RendererMesh::PRIMITIVE_TRIANGLE_STRIP: d3dPrimitive = D3DPT_TRIANGLESTRIP; break; + case RendererMesh::PRIMITIVE_POINT_SPRITES: d3dPrimitive = D3DPT_POINTLIST; break; + } + RENDERER_ASSERT(d3dPrimitive != D3DPT_FORCE_DWORD, "Unable to find Direct3D9 Primitive."); + return d3dPrimitive; +} + +static PxU32 computePrimitiveCount(RendererMesh::Primitive primitive, PxU32 vertexCount) +{ + PxU32 numPrimitives = 0; + switch(primitive) + { + case RendererMesh::PRIMITIVE_POINTS: numPrimitives = vertexCount; break; + case RendererMesh::PRIMITIVE_LINES: numPrimitives = vertexCount / 2; break; + case RendererMesh::PRIMITIVE_LINE_STRIP: numPrimitives = vertexCount>=2 ? vertexCount - 1 : 0; break; + case RendererMesh::PRIMITIVE_TRIANGLES: numPrimitives = vertexCount / 3; break; + case RendererMesh::PRIMITIVE_TRIANGLE_STRIP: numPrimitives = vertexCount>=3 ? vertexCount - 2 : 0; break; + case RendererMesh::PRIMITIVE_POINT_SPRITES: numPrimitives = vertexCount; break; + } + RENDERER_ASSERT(numPrimitives, "Unable to compute the number of Primitives."); + return numPrimitives; +} + +void D3D9RendererMesh::renderIndices(PxU32 numVertices, PxU32 firstIndex, PxU32 numIndices, RendererIndexBuffer::Format indexFormat, RendererMaterial *material) const +{ + PX_PROFILE_ZONE("D3D9RendererMesh_renderIndices",0); + IDirect3DDevice9 *d3dDevice = m_renderer.getD3DDevice(); + if(d3dDevice && m_d3dVertexDecl) + { + d3dDevice->SetVertexDeclaration(m_d3dVertexDecl); + Primitive primitive = getPrimitives(); +#if RENDERER_INSTANCING + PxU32 numVertexBuffers = getNumVertexBuffers(); + // Only reset stream source when multiple vertex buffers are given + // This fixes issues with several GPU vendors when rendering a given indexed mesh multiple times + static const physx::PxU32 minVertexBuffersForStreamSourceReset = 2; + if (numVertexBuffers >= minVertexBuffersForStreamSourceReset) + { + for(PxU32 i=0; i<numVertexBuffers; i++) + { + d3dDevice->SetStreamSourceFreq((UINT)i, D3DSTREAMSOURCE_INDEXEDDATA | 1); + } + } +#endif + if(primitive == RendererMesh::PRIMITIVE_POINT_SPRITES) d3dDevice->SetRenderState(D3DRS_POINTSPRITEENABLE, 1); + + d3dDevice->DrawIndexedPrimitive(getD3DPrimitive(primitive), 0, 0, numVertices, firstIndex, computePrimitiveCount(primitive, numIndices)); + + if(primitive == RendererMesh::PRIMITIVE_POINT_SPRITES) d3dDevice->SetRenderState(D3DRS_POINTSPRITEENABLE, 0); + } +} + +void D3D9RendererMesh::renderVertices(PxU32 numVertices, RendererMaterial *material) const +{ + PX_PROFILE_ZONE("D3D9RendererMesh_renderVertices",0); + IDirect3DDevice9 *d3dDevice = m_renderer.getD3DDevice(); + if(d3dDevice && m_d3dVertexDecl) + { + d3dDevice->SetVertexDeclaration(m_d3dVertexDecl); + Primitive primitive = getPrimitives(); +#if RENDERER_INSTANCING + PxU32 numVertexBuffers = getNumVertexBuffers(); + for(PxU32 i=0; i<numVertexBuffers; i++) + { + d3dDevice->SetStreamSourceFreq((UINT)i, 1); + } +#endif + if(primitive == RendererMesh::PRIMITIVE_POINT_SPRITES) d3dDevice->SetRenderState(D3DRS_POINTSPRITEENABLE, 1); + + D3DPRIMITIVETYPE d3dPrimitive = getD3DPrimitive(primitive); + PxU32 numPrimitives = computePrimitiveCount(primitive, numVertices); + PX_ASSERT(d3dPrimitive != D3DPT_LINELIST || (numVertices&1)==0); // can't have an odd number of verts when drawing lines...! + d3dDevice->DrawPrimitive(d3dPrimitive, 0, numPrimitives); + + if(primitive == RendererMesh::PRIMITIVE_POINT_SPRITES) d3dDevice->SetRenderState(D3DRS_POINTSPRITEENABLE, 0); + } +} + +void D3D9RendererMesh::renderIndicesInstanced(PxU32 numVertices, PxU32 firstIndex, PxU32 numIndices, RendererIndexBuffer::Format indexFormat,RendererMaterial *material) const +{ + PX_PROFILE_ZONE("D3D9RendererMesh_renderIndicesInstanced",0); + IDirect3DDevice9 *d3dDevice = m_renderer.getD3DDevice(); + if(d3dDevice && m_d3dVertexDecl) + { +#if RENDERER_INSTANCING + PxU32 numVertexBuffers = getNumVertexBuffers(); + for(PxU32 i=0; i<numVertexBuffers; i++) + { + d3dDevice->SetStreamSourceFreq((UINT)i, D3DSTREAMSOURCE_INDEXEDDATA | m_numInstances); + } +#endif + + d3dDevice->SetVertexDeclaration(m_d3dVertexDecl); + + Primitive primitive = getPrimitives(); + + if(primitive == RendererMesh::PRIMITIVE_POINT_SPRITES) + { + d3dDevice->SetRenderState(D3DRS_POINTSPRITEENABLE, 1); + } + +#if RENDERER_INSTANCING + d3dDevice->DrawIndexedPrimitive(getD3DPrimitive(primitive), 0, 0, numVertices, firstIndex, computePrimitiveCount(primitive, numIndices)); +#else + const PxU8 *ibuffer = (const PxU8 *)m_instanceBuffer->lock(); + ibuffer+=m_instanceBuffer->getStride()*m_firstInstance; + D3DXMATRIX m; + D3DXMatrixIdentity(&m); + for (PxU32 i=0; i<m_numInstances; i++) + { + PxF32 *dest = (PxF32 *)&m; + + const PxF32 *src = (const PxF32 *)ibuffer; + + dest[0] = src[3]; + dest[1] = src[6]; + dest[2] = src[9]; + dest[3] = src[0]; + + dest[4] = src[4]; + dest[5] = src[7]; + dest[6] = src[10]; + dest[7] = src[1]; + + dest[8] = src[5]; + dest[9] = src[8]; + dest[10] = src[11]; + dest[11] = src[2]; + + dest[12] = 0; + dest[13] = 0; + dest[14] = 0; + dest[15] = 1; + + material->setModelMatrix(dest); + d3dDevice->DrawIndexedPrimitive(getD3DPrimitive(primitive), 0, 0, numVertices, firstIndex, computePrimitiveCount(primitive, numIndices)); + ibuffer+=m_instanceBuffer->getStride(); + } +#endif + + if(primitive == RendererMesh::PRIMITIVE_POINT_SPRITES) + { + d3dDevice->SetRenderState(D3DRS_POINTSPRITEENABLE, 0); + } + } +} + +void D3D9RendererMesh::renderVerticesInstanced(PxU32 numVertices,RendererMaterial *material) const +{ + PX_PROFILE_ZONE("D3D9RendererMesh_renderVerticesInstanced",0); + IDirect3DDevice9 *d3dDevice = m_renderer.getD3DDevice(); + if(d3dDevice && m_d3dVertexDecl) + { +#if RENDERER_INSTANCING + PxU32 numVertexBuffers = getNumVertexBuffers(); + for(PxU32 i=0; i<numVertexBuffers; i++) + { + d3dDevice->SetStreamSourceFreq((UINT)i, m_numInstances); + } +#endif + + d3dDevice->SetVertexDeclaration(m_d3dVertexDecl); + + Primitive primitive = getPrimitives(); + + if(primitive == RendererMesh::PRIMITIVE_POINT_SPRITES) + { + d3dDevice->SetRenderState(D3DRS_POINTSPRITEENABLE, 1); + } + + +#if RENDERER_INSTANCING + d3dDevice->DrawPrimitive(getD3DPrimitive(primitive), 0, computePrimitiveCount(primitive, numVertices)); +#else + const PxU8 *ibuffer = (const PxU8 *)m_instanceBuffer->lock(); + D3DXMATRIX m; + D3DXMatrixIdentity(&m); + for (PxU32 i=0; i<m_numInstances; i++) + { + PxF32 *dest = (PxF32 *)&m; + + const PxF32 *src = (const PxF32 *)ibuffer; + + dest[0] = src[3]; + dest[1] = src[6]; + dest[2] = src[9]; + dest[3] = src[0]; + + dest[4] = src[4]; + dest[5] = src[7]; + dest[6] = src[10]; + dest[7] = src[1]; + + dest[8] = src[5]; + dest[9] = src[8]; + dest[10] = src[11]; + dest[11] = src[2]; + + dest[12] = 0; + dest[13] = 0; + dest[14] = 0; + dest[15] = 1; + + + material->setModelMatrix(dest); + + d3dDevice->DrawPrimitive(getD3DPrimitive(primitive), 0, computePrimitiveCount(primitive, numVertices)); + + ibuffer+=m_instanceBuffer->getStride(); + } +#endif + + if(primitive == RendererMesh::PRIMITIVE_POINT_SPRITES) + { + d3dDevice->SetRenderState(D3DRS_POINTSPRITEENABLE, 0); + } + } +} + +#endif // #if defined(RENDERER_ENABLE_DIRECT3D9) diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d9/D3D9RendererMesh.h b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d9/D3D9RendererMesh.h new file mode 100644 index 00000000..d0e8f0b0 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d9/D3D9RendererMesh.h @@ -0,0 +1,66 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#ifndef D3D9_RENDERER_MESH_H +#define D3D9_RENDERER_MESH_H + +#include <RendererConfig.h> + +#if defined(RENDERER_ENABLE_DIRECT3D9) + +#include <RendererMesh.h> +#include "D3D9Renderer.h" + +namespace SampleRenderer +{ + + class D3D9RendererMesh : public RendererMesh + { + public: + D3D9RendererMesh(D3D9Renderer &renderer, const RendererMeshDesc &desc); + virtual ~D3D9RendererMesh(void); + + public: + virtual void renderIndices(PxU32 numVertices, PxU32 firstIndex, PxU32 numIndices, RendererIndexBuffer::Format indexFormat,RendererMaterial *material) const; + virtual void renderVertices(PxU32 numVertices,RendererMaterial *material) const; + + virtual void renderIndicesInstanced(PxU32 numVertices, PxU32 firstIndex, PxU32 numIndices, RendererIndexBuffer::Format indexFormat,RendererMaterial *material) const; + virtual void renderVerticesInstanced(PxU32 numVertices,RendererMaterial *material) const; + + protected: + D3D9RendererMesh &operator=(const D3D9RendererMesh &) { return *this; } + + Renderer& renderer() { return m_renderer; } + + private: + D3D9Renderer &m_renderer; + IDirect3DVertexDeclaration9 *m_d3dVertexDecl; + }; + +} // namespace SampleRenderer + +#endif // #if defined(RENDERER_ENABLE_DIRECT3D9) +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d9/D3D9RendererSpotLight.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d9/D3D9RendererSpotLight.cpp new file mode 100644 index 00000000..4be8e978 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d9/D3D9RendererSpotLight.cpp @@ -0,0 +1,64 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#include <RendererConfig.h> + +#if defined(RENDERER_ENABLE_DIRECT3D9) + +#include "D3D9RendererSpotLight.h" +#include "D3D9RendererTexture2D.h" + +using namespace SampleRenderer; + +D3D9RendererSpotLight::D3D9RendererSpotLight(D3D9Renderer &renderer, const RendererSpotLightDesc &desc) : + RendererSpotLight(desc), +m_renderer(renderer) +{ + +} + +D3D9RendererSpotLight::~D3D9RendererSpotLight(void) +{ + +} + +void D3D9RendererSpotLight::bind(void) const +{ + D3D9Renderer::ShaderEnvironment &shaderEnv = m_renderer.getShaderEnvironment(); + convertToD3D9(shaderEnv.lightColor, m_color); + shaderEnv.lightIntensity = m_intensity; + convertToD3D9(shaderEnv.lightPosition, m_position); + convertToD3D9(shaderEnv.lightDirection, m_direction); + shaderEnv.lightInnerRadius = m_innerRadius; + shaderEnv.lightOuterRadius = m_outerRadius; + shaderEnv.lightInnerCone = m_innerCone; + shaderEnv.lightOuterCone = m_outerCone; + shaderEnv.lightShadowMap = m_shadowMap ? static_cast<D3D9RendererTexture2D*>(m_shadowMap)->m_d3dTexture : 0; + buildProjectMatrix(shaderEnv.lightShadowMatrix, m_shadowProjection, m_shadowTransform); +} + +#endif // #if defined(RENDERER_ENABLE_DIRECT3D9) diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d9/D3D9RendererSpotLight.h b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d9/D3D9RendererSpotLight.h new file mode 100644 index 00000000..cbeb668b --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d9/D3D9RendererSpotLight.h @@ -0,0 +1,56 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#ifndef D3D9_RENDERER_SPOT_LIGHT_H +#define D3D9_RENDERER_SPOT_LIGHT_H + +#include <RendererConfig.h> + +#if defined(RENDERER_ENABLE_DIRECT3D9) + +#include <RendererSpotLight.h> + +#include "D3D9Renderer.h" + +namespace SampleRenderer +{ + + class D3D9RendererSpotLight : public RendererSpotLight + { + public: + D3D9RendererSpotLight(D3D9Renderer &renderer, const RendererSpotLightDesc &desc); + virtual ~D3D9RendererSpotLight(void); + + virtual void bind(void) const; + + private: + D3D9Renderer &m_renderer; + }; + +} // namespace SampleRenderer + +#endif // #if defined(RENDERER_ENABLE_DIRECT3D9) +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d9/D3D9RendererTarget.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d9/D3D9RendererTarget.cpp new file mode 100644 index 00000000..0428ad04 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d9/D3D9RendererTarget.cpp @@ -0,0 +1,143 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +// suppress LNK4221 on Xbox +namespace {char dummySymbol; } + +#include <RendererConfig.h> +#include "D3D9RendererTarget.h" + +#if defined(RENDERER_ENABLE_DIRECT3D9) && defined(RENDERER_ENABLE_DIRECT3D9_TARGET) + +#include <RendererTargetDesc.h> +#include "D3D9RendererTexture2D.h" + +using namespace SampleRenderer; + +D3D9RendererTarget::D3D9RendererTarget(IDirect3DDevice9 &d3dDevice, const RendererTargetDesc &desc) : + m_d3dDevice(d3dDevice) +{ + m_d3dLastSurface = 0; + m_d3dLastDepthStencilSurface = 0; + m_d3dDepthStencilSurface = 0; + for(PxU32 i=0; i<desc.numTextures; i++) + { + D3D9RendererTexture2D &texture = *static_cast<D3D9RendererTexture2D*>(desc.textures[i]); + m_textures.push_back(&texture); + } + m_depthStencilSurface = static_cast<D3D9RendererTexture2D*>(desc.depthStencilSurface); + RENDERER_ASSERT(m_depthStencilSurface && m_depthStencilSurface->m_d3dTexture, "Invalid Target Depth Stencil Surface!"); + onDeviceReset(); +} + +D3D9RendererTarget::~D3D9RendererTarget(void) +{ + if(m_d3dDepthStencilSurface) m_d3dDepthStencilSurface->Release(); +} + +void D3D9RendererTarget::bind(void) +{ + RENDERER_ASSERT(m_d3dLastSurface==0 && m_d3dLastDepthStencilSurface==0, "Render Target in bad state!"); + if(m_d3dDepthStencilSurface && !m_d3dLastSurface && !m_d3dLastDepthStencilSurface) + { + m_d3dDevice.GetRenderTarget(0, &m_d3dLastSurface); + m_d3dDevice.GetDepthStencilSurface(&m_d3dLastDepthStencilSurface); + const PxU32 numTextures = (PxU32)m_textures.size(); + for(PxU32 i=0; i<numTextures; i++) + { + IDirect3DSurface9 *d3dSurcace = 0; + D3D9RendererTexture2D &texture = *m_textures[i]; + /* HRESULT result = */ texture.m_d3dTexture->GetSurfaceLevel(0, &d3dSurcace); + RENDERER_ASSERT(d3dSurcace, "Cannot get Texture Surface!"); + if(d3dSurcace) + { + m_d3dDevice.SetRenderTarget(i, d3dSurcace); + d3dSurcace->Release(); + } + } + m_d3dDevice.SetDepthStencilSurface(m_d3dDepthStencilSurface); + const DWORD flags = D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER; + m_d3dDevice.Clear(0, 0, flags, 0x00000000, 1.0f, 0); + } + float depthBias = 0.0001f; + float biasSlope = 1.58f; +#if RENDERER_ENABLE_DRESSCODE + depthBias = dcParam("depthBias", depthBias, 0.0f, 0.01f); + biasSlope = dcParam("biasSlope", biasSlope, 0.0f, 5.0f); +#endif + m_d3dDevice.SetRenderState(D3DRS_DEPTHBIAS, *(DWORD*)&depthBias); + m_d3dDevice.SetRenderState(D3DRS_SLOPESCALEDEPTHBIAS, *(DWORD*)&biasSlope); +} + +void D3D9RendererTarget::unbind(void) +{ + RENDERER_ASSERT(m_d3dLastSurface && m_d3dLastDepthStencilSurface, "Render Target in bad state!"); + if(m_d3dDepthStencilSurface && m_d3dLastSurface && m_d3dLastDepthStencilSurface) + { + m_d3dDevice.SetDepthStencilSurface(m_d3dLastDepthStencilSurface); + m_d3dDevice.SetRenderTarget(0, m_d3dLastSurface); + const PxU32 numTextures = (PxU32)m_textures.size(); + for(PxU32 i=1; i<numTextures; i++) + { + m_d3dDevice.SetRenderTarget(i, 0); + } + m_d3dLastSurface->Release(); + m_d3dLastSurface = 0; + m_d3dLastDepthStencilSurface->Release(); + m_d3dLastDepthStencilSurface = 0; + } + float depthBias = 0; + float biasSlope = 0; + m_d3dDevice.SetRenderState(D3DRS_DEPTHBIAS, *(DWORD*)&depthBias); + m_d3dDevice.SetRenderState(D3DRS_SLOPESCALEDEPTHBIAS, *(DWORD*)&biasSlope); +} + +void D3D9RendererTarget::onDeviceLost(void) +{ + RENDERER_ASSERT(m_d3dLastDepthStencilSurface==0, "Render Target in bad state!"); + RENDERER_ASSERT(m_d3dDepthStencilSurface, "Render Target in bad state!"); + if(m_d3dDepthStencilSurface) + { + m_d3dDepthStencilSurface->Release(); + m_d3dDepthStencilSurface = 0; + } +} + +void D3D9RendererTarget::onDeviceReset(void) +{ + RENDERER_ASSERT(m_d3dDepthStencilSurface==0, "Render Target in bad state!"); + if(!m_d3dDepthStencilSurface && m_depthStencilSurface && m_depthStencilSurface->m_d3dTexture) + { + bool ok = m_depthStencilSurface->m_d3dTexture->GetSurfaceLevel(0, &m_d3dDepthStencilSurface) == D3D_OK; + if(!ok) + { + RENDERER_ASSERT(ok, "Failed to create Render Target Depth Stencil Surface."); + } + } +} + +#endif //#if defined(RENDERER_ENABLE_DIRECT3D9) && defined(RENDERER_ENABLE_DIRECT3D9_TARGET) diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d9/D3D9RendererTarget.h b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d9/D3D9RendererTarget.h new file mode 100644 index 00000000..495f9cd2 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d9/D3D9RendererTarget.h @@ -0,0 +1,76 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#ifndef D3D9_RENDERER_TARGET_H +#define D3D9_RENDERER_TARGET_H + +#include <RendererConfig.h> + +// TODO: 360 can't render directly into texture memory, so we need to create a pool of +// surfaces to share internally and then "resolve" them into the textures inside of +// the 'unbind' call. +#if defined(RENDERER_WINDOWS) + #define RENDERER_ENABLE_DIRECT3D9_TARGET +#endif + +#if defined(RENDERER_ENABLE_DIRECT3D9) && defined(RENDERER_ENABLE_DIRECT3D9_TARGET) + +#include <RendererTarget.h> +#include "D3D9Renderer.h" + +namespace SampleRenderer +{ + + class D3D9RendererTexture2D; + + class D3D9RendererTarget : public RendererTarget, public D3D9RendererResource + { + public: + D3D9RendererTarget(IDirect3DDevice9 &d3dDevice, const RendererTargetDesc &desc); + virtual ~D3D9RendererTarget(void); + + private: + D3D9RendererTarget& operator=( const D3D9RendererTarget& ) {} + virtual void bind(void); + virtual void unbind(void); + + private: + virtual void onDeviceLost(void); + virtual void onDeviceReset(void); + + private: + IDirect3DDevice9 &m_d3dDevice; + IDirect3DSurface9 *m_d3dLastSurface; + IDirect3DSurface9 *m_d3dLastDepthStencilSurface; + IDirect3DSurface9 *m_d3dDepthStencilSurface; + std::vector<D3D9RendererTexture2D*> m_textures; + D3D9RendererTexture2D *m_depthStencilSurface; + }; + +} // namespace SampleRenderer + +#endif // #if defined(RENDERER_ENABLE_DIRECT3D9) && defined(RENDERER_ENABLE_DIRECT3D9_TARGET) +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d9/D3D9RendererTexture2D.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d9/D3D9RendererTexture2D.cpp new file mode 100644 index 00000000..a1c4e09f --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d9/D3D9RendererTexture2D.cpp @@ -0,0 +1,190 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#include <RendererConfig.h> + +#if defined(RENDERER_ENABLE_DIRECT3D9) + +#include "D3D9RendererTexture2D.h" +#include <RendererTexture2DDesc.h> + +#include <SamplePlatform.h> + +using namespace SampleRenderer; + +static void supportsAnisotropic(IDirect3DDevice9& device, bool& min, bool& mag, bool& mip) +{ + D3DCAPS9 caps; + device.GetDeviceCaps(&caps); + min = (caps.TextureFilterCaps & D3DPTFILTERCAPS_MINFANISOTROPIC) != 0; + mag = (caps.TextureFilterCaps & D3DPTFILTERCAPS_MAGFANISOTROPIC) != 0; + mip = false; +} + +static D3DFORMAT getD3D9TextureFormat(RendererTexture2D::Format format) +{ + D3DFORMAT d3dFormat = static_cast<D3DFORMAT>(SampleFramework::SamplePlatform::platform()->getD3D9TextureFormat(format)); + RENDERER_ASSERT(d3dFormat != D3DFMT_UNKNOWN, "Unable to convert to D3D9 Texture Format."); + return d3dFormat; +} + +static D3DTEXTUREFILTERTYPE getD3D9TextureFilter(RendererTexture2D::Filter filter, bool anisoSupport) +{ + D3DTEXTUREFILTERTYPE d3dFilter = D3DTEXF_FORCE_DWORD; + switch(filter) + { + case RendererTexture2D::FILTER_NEAREST: d3dFilter = D3DTEXF_POINT; break; + case RendererTexture2D::FILTER_LINEAR: d3dFilter = D3DTEXF_LINEAR; break; + case RendererTexture2D::FILTER_ANISOTROPIC: d3dFilter = anisoSupport ? D3DTEXF_ANISOTROPIC : D3DTEXF_LINEAR; break; + } + RENDERER_ASSERT(d3dFilter != D3DTEXF_FORCE_DWORD, "Unable to convert to D3D9 Filter mode."); + return d3dFilter; +} + +static D3DTEXTUREADDRESS getD3D9TextureAddressing(RendererTexture2D::Addressing addressing) +{ + D3DTEXTUREADDRESS d3dAddressing = D3DTADDRESS_FORCE_DWORD; + switch(addressing) + { + case RendererTexture2D::ADDRESSING_WRAP: d3dAddressing = D3DTADDRESS_WRAP; break; + case RendererTexture2D::ADDRESSING_CLAMP: d3dAddressing = D3DTADDRESS_CLAMP; break; + case RendererTexture2D::ADDRESSING_MIRROR: d3dAddressing = D3DTADDRESS_MIRROR; break; + } + RENDERER_ASSERT(d3dAddressing != D3DTADDRESS_FORCE_DWORD, "Unable to convert to D3D9 Addressing mode."); + return d3dAddressing; +} + +D3D9RendererTexture2D::D3D9RendererTexture2D(IDirect3DDevice9 &d3dDevice, D3D9Renderer& renderer, const RendererTexture2DDesc &desc) + : RendererTexture2D(desc) + , m_d3dDevice(d3dDevice) +{ + RENDERER_ASSERT(desc.depth == 1, "Invalid depth for 2D Texture!"); + + m_d3dTexture = 0; + //managed textures can't be locked. +#ifdef DIRECT3D9_SUPPORT_D3DUSAGE_DYNAMIC + m_usage = renderer.canUseManagedResources() ? 0 : D3DUSAGE_DYNAMIC; +#else + m_usage = 0; +#endif + m_pool = renderer.canUseManagedResources() ? D3DPOOL_MANAGED : D3DPOOL_DEFAULT; + m_format = getD3D9TextureFormat(desc.format); + + bool minAniso, magAniso, mipAniso; + supportsAnisotropic(d3dDevice, minAniso, magAniso, mipAniso); + m_d3dMinFilter = getD3D9TextureFilter(desc.filter, minAniso); + m_d3dMagFilter = getD3D9TextureFilter(desc.filter, magAniso); + m_d3dMipFilter = getD3D9TextureFilter(desc.filter, mipAniso); + m_d3dAddressingU = getD3D9TextureAddressing(desc.addressingU); + m_d3dAddressingV = getD3D9TextureAddressing(desc.addressingV); + if(desc.renderTarget) + { + m_usage = D3DUSAGE_RENDERTARGET; + m_pool = D3DPOOL_DEFAULT; + } + if(isDepthStencilFormat(desc.format)) + { + m_usage = D3DUSAGE_DEPTHSTENCIL; + m_pool = D3DPOOL_DEFAULT; + } + onDeviceReset(); +} + +D3D9RendererTexture2D::~D3D9RendererTexture2D(void) +{ + if(m_d3dTexture) + { + D3DCAPS9 pCaps; + m_d3dDevice.GetDeviceCaps(&pCaps); + DWORD i = pCaps.MaxTextureBlendStages; + while(i--) m_d3dDevice.SetTexture(i, NULL); + SampleFramework::SamplePlatform::platform()->D3D9BlockUntilNotBusy(m_d3dTexture); + m_d3dTexture->Release(); + } +} + +void *D3D9RendererTexture2D::lockLevel(PxU32 level, PxU32 &pitch) +{ + void *buffer = 0; + if(m_d3dTexture) + { + D3DLOCKED_RECT lockedRect; + HRESULT result = m_d3dTexture->LockRect((DWORD)level, &lockedRect, 0, D3DLOCK_NOSYSLOCK); + RENDERER_ASSERT(result == D3D_OK, "Unable to lock Texture 2D."); + if(result == D3D_OK) + { + buffer = lockedRect.pBits; + pitch = (PxU32)lockedRect.Pitch; + } + } + return buffer; +} + +void D3D9RendererTexture2D::unlockLevel(PxU32 level) +{ + if(m_d3dTexture) + { + m_d3dTexture->UnlockRect(level); + } +} + +void D3D9RendererTexture2D::bind(PxU32 samplerIndex) +{ + m_d3dDevice.SetTexture( (DWORD)samplerIndex, m_d3dTexture); + m_d3dDevice.SetSamplerState((DWORD)samplerIndex, D3DSAMP_MINFILTER, m_d3dMinFilter); + m_d3dDevice.SetSamplerState((DWORD)samplerIndex, D3DSAMP_MAGFILTER, m_d3dMagFilter); + m_d3dDevice.SetSamplerState((DWORD)samplerIndex, D3DSAMP_MIPFILTER, m_d3dMipFilter); + m_d3dDevice.SetSamplerState((DWORD)samplerIndex, D3DSAMP_ADDRESSU, m_d3dAddressingU); + m_d3dDevice.SetSamplerState((DWORD)samplerIndex, D3DSAMP_ADDRESSV, m_d3dAddressingV); +} + +void D3D9RendererTexture2D::onDeviceLost(void) +{ + if(m_pool != D3DPOOL_MANAGED) + { + if(m_d3dTexture) + { + m_d3dTexture->Release(); + m_d3dTexture = 0; + } + } +} + +void D3D9RendererTexture2D::onDeviceReset(void) +{ + if(!m_d3dTexture) + { + HRESULT result = m_d3dDevice.CreateTexture((UINT)getWidth(), (UINT)getHeight(), (UINT)getNumLevels(), m_usage, m_format, m_pool, &m_d3dTexture, 0); + RENDERER_ASSERT(result == D3D_OK, "Unable to create D3D9 Texture."); + if(result == D3D_OK) + { + + } + } +} + +#endif // #if defined(RENDERER_ENABLE_DIRECT3D9) diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d9/D3D9RendererTexture2D.h b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d9/D3D9RendererTexture2D.h new file mode 100644 index 00000000..29166103 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d9/D3D9RendererTexture2D.h @@ -0,0 +1,82 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#ifndef D3D9_RENDERER_TEXTURE_2D_H +#define D3D9_RENDERER_TEXTURE_2D_H + +#include <RendererConfig.h> + +#if defined(RENDERER_ENABLE_DIRECT3D9) + +#include <RendererTexture2D.h> +#include "D3D9Renderer.h" + +namespace SampleRenderer +{ + class D3D9Renderer; + class D3D9RendererTexture2D : public RendererTexture2D, public D3D9RendererResource + { + friend class D3D9RendererTarget; + friend class D3D9RendererSpotLight; + public: + D3D9RendererTexture2D(IDirect3DDevice9 &d3dDevice, D3D9Renderer& renderer, const RendererTexture2DDesc &desc); + virtual ~D3D9RendererTexture2D(void); + + public: + virtual void *lockLevel(PxU32 level, PxU32 &pitch); + virtual void unlockLevel(PxU32 level); + + void bind(PxU32 samplerIndex); + + virtual void select(PxU32 stageIndex) + { + bind(stageIndex); + } + + private: + + virtual void onDeviceLost(void); + virtual void onDeviceReset(void); + + private: + IDirect3DDevice9 &m_d3dDevice; + IDirect3DTexture9 *m_d3dTexture; + + DWORD m_usage; + D3DPOOL m_pool; + D3DFORMAT m_format; + + D3DTEXTUREFILTERTYPE m_d3dMinFilter; + D3DTEXTUREFILTERTYPE m_d3dMagFilter; + D3DTEXTUREFILTERTYPE m_d3dMipFilter; + D3DTEXTUREADDRESS m_d3dAddressingU; + D3DTEXTUREADDRESS m_d3dAddressingV; + }; + +} // namespace SampleRenderer + +#endif // #if defined(RENDERER_ENABLE_DIRECT3D9) +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d9/D3D9RendererVertexBuffer.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d9/D3D9RendererVertexBuffer.cpp new file mode 100644 index 00000000..383154a2 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d9/D3D9RendererVertexBuffer.cpp @@ -0,0 +1,299 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#include <RendererConfig.h> + +#if defined(RENDERER_ENABLE_DIRECT3D9) + +#include "D3D9RendererVertexBuffer.h" +#include <RendererVertexBufferDesc.h> + +#if PX_WINDOWS +#include <task/PxTask.h> +#endif + +using namespace SampleRenderer; + +static D3DVERTEXELEMENT9 buildVertexElement(WORD stream, WORD offset, D3DDECLTYPE type, BYTE method, BYTE usage, BYTE usageIndex) +{ + D3DVERTEXELEMENT9 element; + element.Stream = stream; + element.Offset = offset; +#if defined(RENDERER_WINDOWS) + element.Type = (BYTE)type; +#else + element.Type = type; +#endif + element.Method = method; + element.Usage = usage; + element.UsageIndex = usageIndex; + return element; +} + +static D3DDECLTYPE getD3DType(RendererVertexBuffer::Format format) +{ + D3DDECLTYPE d3dType = D3DDECLTYPE_UNUSED; + switch(format) + { + case RendererVertexBuffer::FORMAT_FLOAT1: d3dType = D3DDECLTYPE_FLOAT1; break; + case RendererVertexBuffer::FORMAT_FLOAT2: d3dType = D3DDECLTYPE_FLOAT2; break; + case RendererVertexBuffer::FORMAT_FLOAT3: d3dType = D3DDECLTYPE_FLOAT3; break; + case RendererVertexBuffer::FORMAT_FLOAT4: d3dType = D3DDECLTYPE_FLOAT4; break; + case RendererVertexBuffer::FORMAT_UBYTE4: d3dType = D3DDECLTYPE_UBYTE4; break; + case RendererVertexBuffer::FORMAT_USHORT4: d3dType = D3DDECLTYPE_SHORT4; break; + case RendererVertexBuffer::FORMAT_COLOR_BGRA: d3dType = D3DDECLTYPE_D3DCOLOR; break; + case RendererVertexBuffer::FORMAT_COLOR_RGBA: d3dType = D3DDECLTYPE_D3DCOLOR; break; + case RendererVertexBuffer::FORMAT_COLOR_NATIVE: d3dType = D3DDECLTYPE_D3DCOLOR; break; + } + RENDERER_ASSERT(d3dType != D3DDECLTYPE_UNUSED, "Invalid Direct3D9 vertex type."); + return d3dType; +} + +static D3DDECLUSAGE getD3DUsage(RendererVertexBuffer::Semantic semantic, PxU8 &usageIndex) +{ + D3DDECLUSAGE d3dUsage = D3DDECLUSAGE_FOG; + usageIndex = 0; + if(semantic >= RendererVertexBuffer::SEMANTIC_TEXCOORD0 && semantic <= RendererVertexBuffer::SEMANTIC_TEXCOORDMAX) + { + d3dUsage = D3DDECLUSAGE_TEXCOORD; + usageIndex = (PxU8)(semantic - RendererVertexBuffer::SEMANTIC_TEXCOORD0); + } + else + { + switch(semantic) + { + case RendererVertexBuffer::SEMANTIC_POSITION: d3dUsage = D3DDECLUSAGE_POSITION; break; + case RendererVertexBuffer::SEMANTIC_NORMAL: d3dUsage = D3DDECLUSAGE_NORMAL; break; + case RendererVertexBuffer::SEMANTIC_TANGENT: d3dUsage = D3DDECLUSAGE_TANGENT; break; + case RendererVertexBuffer::SEMANTIC_COLOR: d3dUsage = D3DDECLUSAGE_COLOR; break; + case RendererVertexBuffer::SEMANTIC_BONEINDEX: + d3dUsage = D3DDECLUSAGE_TEXCOORD; + usageIndex = RENDERER_BONEINDEX_CHANNEL; + break; + case RendererVertexBuffer::SEMANTIC_BONEWEIGHT: + d3dUsage = D3DDECLUSAGE_TEXCOORD; + usageIndex = RENDERER_BONEWEIGHT_CHANNEL; + break; + } + } + // There's absolutely no reason why there can't be semantics for which Direct3D9 has no support + //RENDERER_ASSERT(d3dUsage != D3DDECLUSAGE_FOG, "Invalid Direct3D9 vertex usage."); + return d3dUsage; +} + +D3D9RendererVertexBuffer::D3D9RendererVertexBuffer(IDirect3DDevice9 &d3dDevice, D3D9Renderer& renderer, const RendererVertexBufferDesc &desc) : +RendererVertexBuffer(desc), + m_d3dDevice(d3dDevice), + m_savedData(NULL) +{ + m_d3dVertexBuffer = 0; + + m_usage = D3DUSAGE_WRITEONLY; + m_lockFlags = 0; + m_pool = renderer.canUseManagedResources() ? D3DPOOL_MANAGED : D3DPOOL_DEFAULT; + m_bufferSize = (UINT)(desc.maxVertices * m_stride); + + m_bufferWritten = false; + +#if RENDERER_ENABLE_DYNAMIC_VB_POOLS + if(desc.hint==RendererVertexBuffer::HINT_DYNAMIC ) + { + if (!desc.registerInCUDA) + { + m_usage = D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY; + // discard all that data if we are going to overwrite it again (saves some time waiting to copy everything back) + m_lockFlags = D3DLOCK_DISCARD; + } + else + { + m_usage = 0; + } + + m_pool = D3DPOOL_DEFAULT; + } +#endif + + onDeviceReset(); + + if(m_d3dVertexBuffer) + { + m_maxVertices = desc.maxVertices; + } +} + +D3D9RendererVertexBuffer::~D3D9RendererVertexBuffer(void) +{ + if(m_d3dVertexBuffer) + { +#if PX_WINDOWS && PX_SUPPORT_GPU_PHYSX + if(m_interopContext && m_registeredInCUDA) + { + m_registeredInCUDA = !m_interopContext->unregisterResourceInCuda(m_InteropHandle); + } +#endif + + m_d3dVertexBuffer->Release(); + } + + delete[] m_savedData; +} + +void D3D9RendererVertexBuffer::addVertexElements(PxU32 streamIndex, std::vector<D3DVERTEXELEMENT9> &vertexElements) const +{ + for(PxU32 i=0; i<NUM_SEMANTICS; i++) + { + Semantic semantic = (Semantic)i; + const SemanticDesc &sm = m_semanticDescs[semantic]; + if(sm.format < NUM_FORMATS) + { + PxU8 d3dUsageIndex = 0; + D3DDECLUSAGE d3dUsage = getD3DUsage(semantic, d3dUsageIndex); + if (D3DDECLUSAGE_FOG != d3dUsage) + { + vertexElements.push_back(buildVertexElement((WORD)streamIndex, (WORD)sm.offset, getD3DType(sm.format), D3DDECLMETHOD_DEFAULT, (BYTE)d3dUsage, d3dUsageIndex)); + } + } + } +} + +void D3D9RendererVertexBuffer::swizzleColor(void *colors, PxU32 stride, PxU32 numColors, RendererVertexBuffer::Format inFormat) +{ + if (inFormat == RendererVertexBuffer::FORMAT_COLOR_RGBA) + { + const void *end = ((PxU8*)colors)+(stride*numColors); + for(PxU8* iterator = (PxU8*)colors; iterator < end; iterator+=stride) + { + std::swap(((PxU8*)iterator)[0], ((PxU8*)iterator)[2]); + } + } +} + +void *D3D9RendererVertexBuffer::lock(void) +{ + PX_PROFILE_ZONE("D3D9RenderVBlock",0); + void *lockedBuffer = 0; + if(m_d3dVertexBuffer) + { + const PxU32 bufferSize = m_maxVertices * m_stride; + HRESULT res = m_d3dVertexBuffer->Lock(0, (UINT)bufferSize, &lockedBuffer, m_lockFlags); + if(res != S_OK) + lockedBuffer = NULL; + RENDERER_ASSERT(lockedBuffer, "Failed to lock Direct3D9 Vertex Buffer."); + } + m_bufferWritten = true; + return lockedBuffer; +} + +void D3D9RendererVertexBuffer::unlock(void) +{ + PX_PROFILE_ZONE("D3D9RenderVBunlock",0); + if(m_d3dVertexBuffer) + { + m_d3dVertexBuffer->Unlock(); + } +} + +void D3D9RendererVertexBuffer::bind(PxU32 streamID, PxU32 firstVertex) +{ + prepareForRender(); + if(m_d3dVertexBuffer) + { + m_d3dDevice.SetStreamSource((UINT)streamID, m_d3dVertexBuffer, firstVertex*m_stride, m_stride); + } +} + +void D3D9RendererVertexBuffer::unbind(PxU32 streamID) +{ + m_d3dDevice.SetStreamSource((UINT)streamID, 0, 0, 0); +} + +void D3D9RendererVertexBuffer::onDeviceLost(void) +{ +#if PX_WINDOWS && PX_SUPPORT_GPU_PHYSX + if(m_interopContext && m_registeredInCUDA) + { + m_interopContext->unregisterResourceInCuda(m_InteropHandle); + } +#endif + m_registeredInCUDA = false; + + if(m_pool != D3DPOOL_MANAGED && m_d3dVertexBuffer) + { + if (m_bufferWritten) + { + if (NULL == m_savedData) + m_savedData = new char[m_bufferSize]; + + void* lockedBuffer = 0; + m_d3dVertexBuffer->Lock(0, m_bufferSize, &lockedBuffer, m_lockFlags); + RENDERER_ASSERT(lockedBuffer, "Failed to lock Direct3D9 Vertex Buffer."); + + memcpy(m_savedData, lockedBuffer, m_bufferSize); + m_d3dVertexBuffer->Unlock(); + } + + m_d3dVertexBuffer->Release(); + m_d3dVertexBuffer = 0; + } +} + +void D3D9RendererVertexBuffer::onDeviceReset(void) +{ + if(!m_d3dVertexBuffer) + { + m_d3dDevice.CreateVertexBuffer(m_bufferSize, m_usage, 0, m_pool, &m_d3dVertexBuffer, 0); + RENDERER_ASSERT(m_d3dVertexBuffer, "Failed to create Direct3D9 Vertex Buffer."); +#if PX_WINDOWS && PX_SUPPORT_GPU_PHYSX + if(m_interopContext && m_d3dVertexBuffer && m_mustBeRegisteredInCUDA) + { + RENDERER_ASSERT(m_deferredUnlock == false, "Deferred VB Unlock must be disabled when CUDA Interop is in use.") + m_registeredInCUDA = m_interopContext->registerResourceInCudaD3D(m_InteropHandle, m_d3dVertexBuffer); + } +#endif + + if (m_bufferWritten) + { + void* lockedBuffer = 0; + m_d3dVertexBuffer->Lock(0, m_bufferSize, &lockedBuffer, m_lockFlags); + RENDERER_ASSERT(lockedBuffer, "Failed to lock Direct3D9 Vertex Buffer."); + + RENDERER_ASSERT(m_savedData != NULL, "Data buffer must have been allocated."); + memcpy(lockedBuffer, m_savedData, m_bufferSize); + m_d3dVertexBuffer->Unlock(); + } + } +} + +bool D3D9RendererVertexBuffer::checkBufferWritten(void) +{ + if(m_InteropHandle) + return true; + else + return m_bufferWritten; +} + +#endif // #if defined(RENDERER_ENABLE_DIRECT3D9) diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d9/D3D9RendererVertexBuffer.h b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d9/D3D9RendererVertexBuffer.h new file mode 100644 index 00000000..7f95f6d7 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d9/D3D9RendererVertexBuffer.h @@ -0,0 +1,79 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#ifndef D3D9_RENDERER_VERTEXBUFFER_H +#define D3D9_RENDERER_VERTEXBUFFER_H + +#include <RendererConfig.h> + +#if defined(RENDERER_ENABLE_DIRECT3D9) + +#include <RendererVertexBuffer.h> +#include "D3D9Renderer.h" + +namespace SampleRenderer +{ + + class D3D9RendererVertexBuffer : public RendererVertexBuffer, public D3D9RendererResource + { + public: + D3D9RendererVertexBuffer(IDirect3DDevice9 &d3dDevice, D3D9Renderer& renderer, const RendererVertexBufferDesc &desc); + virtual ~D3D9RendererVertexBuffer(void); + + void addVertexElements(PxU32 streamIndex, std::vector<D3DVERTEXELEMENT9> &vertexElements) const; + + virtual bool checkBufferWritten(void); + + protected: + virtual void swizzleColor(void *colors, PxU32 stride, PxU32 numColors, RendererVertexBuffer::Format inFormat); + + virtual void *lock(void); + virtual void unlock(void); + + virtual void bind(PxU32 streamID, PxU32 firstVertex); + virtual void unbind(PxU32 streamID); + + private: + virtual void onDeviceLost(void); + virtual void onDeviceReset(void); + + private: + IDirect3DDevice9 &m_d3dDevice; + IDirect3DVertexBuffer9 *m_d3dVertexBuffer; + + DWORD m_usage; + DWORD m_lockFlags; + D3DPOOL m_pool; + UINT m_bufferSize; + + bool m_bufferWritten; + void* m_savedData; + }; + +} // namespace SampleRenderer + +#endif // #if defined(RENDERER_ENABLE_DIRECT3D9) +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d9/D3D9WPFRenderer.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d9/D3D9WPFRenderer.cpp new file mode 100644 index 00000000..41426bb6 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d9/D3D9WPFRenderer.cpp @@ -0,0 +1,350 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#ifdef WIN32 // win32 only + +#include "D3D9WPFRenderer.h" +#include "SamplePlatform.h" + +#define APP_NAME "D3D9WPFRenderer" + +namespace SampleRenderer +{ + + + static volatile LONG classRefCount = 0; + + static LONG incrementClassReference() + { + return InterlockedIncrement( &classRefCount ); + } + static LONG decrementClassReference() + { + return InterlockedDecrement( &classRefCount ); + } + + D3D9WPFRenderer::D3D9WPFRenderer( HWND hWnd + , IDirect3D9* inDirect3d + , IDirect3DDevice9* inDevice + , const char* devName + , PxU32 dispWidth + , PxU32 dispHeight + , const char* assetDir + , bool lockable + , bool isDeviceEx ) + : D3D9Renderer( inDirect3d, devName, 0, 0, inDevice, isDeviceEx, assetDir ) + , mHwnd( hWnd ) + , mDesiredWidth( dispWidth ) + , mDesiredHeight( dispHeight ) + , mCanonicalSurface( NULL ) + , mLockable( lockable ) + , mListener( NULL ) + { + SampleFramework::createPlatform(NULL); + } + + D3D9WPFRenderer::~D3D9WPFRenderer() + { + releaseSurface(); + DestroyWindow(mHwnd); + if ( mListener ) mListener->release(); mListener = NULL; + if ( decrementClassReference() == 0 ) + UnregisterClass(TEXT(APP_NAME), NULL); + } + + WPFRendererListener* D3D9WPFRenderer::getListener() { return mListener; } + void D3D9WPFRenderer::setListener( WPFRendererListener* listener ) + { + if ( mListener != listener ) + { + if ( mListener ) mListener->release(); mListener = NULL; + mListener = listener; + if ( mCanonicalSurface && mListener ) mListener->afterSurfaceCreated( mCanonicalSurface ); + } + } + + void D3D9WPFRenderer::onResize( PxU32 newWidth, PxU32 newHeight ) + { + mDesiredWidth = newWidth; + mDesiredHeight = newHeight; + checkResize( false ); + } + + bool D3D9WPFRenderer::swapBuffers() + { + return true; //does nothing, that is up for the parent context to do. + } + + bool D3D9WPFRenderer::isOk() const + { + return true;} + + void D3D9WPFRenderer::onDeviceLost() + { + releaseSurface(); + D3D9Renderer::onDeviceLost(); + } + + void D3D9WPFRenderer::onDeviceReset() + { + allocateSurface(); + D3D9Renderer::onDeviceReset(); + } + + void D3D9WPFRenderer::releaseSurface() + { + if( mListener ) mListener->beforeSurfaceRelease( mCanonicalSurface ); + if ( mCanonicalSurface ) mCanonicalSurface->Release(); + mCanonicalSurface = NULL; + } + + void D3D9WPFRenderer::allocateSurface() + { + PX_ASSERT( mCanonicalSurface == NULL ); + + HRESULT result = m_d3dDevice->CreateRenderTarget( + m_displayWidth + , m_displayHeight + , D3DFMT_X8R8G8B8 + , D3DMULTISAMPLE_NONE + , 0 + , mLockable + , &mCanonicalSurface + , NULL ); + PX_ASSERT( mCanonicalSurface ); + PX_ASSERT( result == D3D_OK ); + + if ( mCanonicalSurface != NULL ) + m_d3dDevice->SetRenderTarget(0, mCanonicalSurface); + + if ( mListener ) mListener->afterSurfaceCreated( mCanonicalSurface ); + } + + bool D3D9WPFRenderer::checkResize( bool isDeviceLost ) + { + bool isDeviceReset = false; + //resize the system if the desired width or height is more than we can support. + if ( mDesiredWidth > m_displayWidth + || mDesiredHeight > m_displayHeight + || isDeviceLost ) + { + m_displayWidth = PxMax( mDesiredWidth, m_displayWidth ); + m_displayHeight = PxMax( mDesiredHeight, m_displayHeight ); + if ( isDeviceLost ) + { + physx::PxU64 res = m_d3dDevice->TestCooperativeLevel(); + if(res == D3D_OK || res == D3DERR_DEVICENOTRESET) //if device is lost, device has to be ready for reset + { + isDeviceReset = true; + onDeviceLost(); + onDeviceReset(); + } + } + else + { + releaseSurface(); + releaseDepthStencilSurface(); + allocateSurface(); + buildDepthStencilSurface(); + // set out initial states... + m_d3dDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_CCW); + m_d3dDevice->SetRenderState(D3DRS_LIGHTING, 0); + m_d3dDevice->SetRenderState(D3DRS_ZENABLE, 1); + } + } + //else just mess with the viewport so we only render pixel-by-pixel + D3DVIEWPORT9 viewport = {0}; + m_d3dDevice->GetViewport(&viewport); + if ( viewport.Width != mDesiredWidth + || viewport.Height != mDesiredHeight ) + { + viewport.X = 0; + viewport.Y = 0; + viewport.Width = (DWORD)mDesiredWidth; + viewport.Height = (DWORD)mDesiredHeight; + viewport.MinZ = 0.0f; + viewport.MaxZ = 1.0f; + m_d3dDevice->SetViewport(&viewport); + } + return isDeviceReset; + } + + void D3D9WPFRenderer::setupAlphaBlendState() + { + m_d3dDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, 1); + m_d3dDevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_ONE); + m_d3dDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA); + } + + void D3D9WPFRenderer::restoreAlphaBlendState() + { + m_d3dDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, 0); + } + + void D3D9WPFRenderer::disableZWrite() + { + m_d3dDevice->SetRenderState(D3DRS_ZWRITEENABLE, 0); + } + void D3D9WPFRenderer::enableZWrite() + { + m_d3dDevice->SetRenderState(D3DRS_ZWRITEENABLE, 1); + } + + static DWORD GetVertexProcessingCaps(IDirect3D9* d3d) + { + D3DCAPS9 caps; + DWORD dwVertexProcessing = D3DCREATE_SOFTWARE_VERTEXPROCESSING; + if (SUCCEEDED(d3d->GetDeviceCaps(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, &caps))) + { + if ((caps.DevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) == D3DDEVCAPS_HWTRANSFORMANDLIGHT) + { + dwVertexProcessing = D3DCREATE_HARDWARE_VERTEXPROCESSING; + } + } + return dwVertexProcessing; + } + + + HRESULT InitializeD3D(HWND hWnd, D3DPRESENT_PARAMETERS d3dpp, IDirect3D9*& d3d, IDirect3DDevice9*& d3dDevice ) + { + d3d = NULL; + d3dDevice = NULL; + // initialize Direct3D + d3d = Direct3DCreate9(D3D_SDK_VERSION); + if ( d3d != NULL ) + { + // determine what type of vertex processing to use based on the device capabilities + DWORD dwVertexProcessing = GetVertexProcessingCaps(d3d); + // create the D3D device + return d3d->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd, + dwVertexProcessing | D3DCREATE_MULTITHREADED | D3DCREATE_FPU_PRESERVE, + &d3dpp, &d3dDevice); + } + return -1; + } + + typedef HRESULT (WINAPI *D3DEXCreateFn)( DWORD version, IDirect3D9Ex** result ); + + + HRESULT InitializeD3DEx(HWND hWnd, D3DPRESENT_PARAMETERS d3dpp, IDirect3D9*& d3d, IDirect3DDevice9*& d3dDevice, D3DEXCreateFn createFn ) + { + d3d = NULL; + d3dDevice = NULL; + IDirect3D9Ex* d3dEx = NULL; + // initialize Direct3D using the Ex function + HRESULT result = createFn( D3D_SDK_VERSION, &d3dEx ); + if ( FAILED( result ) ) return result; + + result = d3dEx->QueryInterface(__uuidof(IDirect3D9), reinterpret_cast<void **>(&d3d) ); + if ( FAILED( result ) ) { d3dEx->Release(); return result; } + + // determine what type of vertex processing to use based on the device capabilities + DWORD dwVertexProcessing = GetVertexProcessingCaps(d3d); + + // create the D3D device using the Ex function + IDirect3DDevice9Ex* deviceEx = NULL; + result = d3dEx->CreateDeviceEx(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd, + dwVertexProcessing | D3DCREATE_MULTITHREADED | D3DCREATE_FPU_PRESERVE, + &d3dpp, NULL, &deviceEx); + + if ( FAILED(result) ) { d3dEx->Release(); d3d->Release(); return result; } + + // obtain the standard D3D device interface + deviceEx->QueryInterface(__uuidof(IDirect3DDevice9), reinterpret_cast<void **>(&d3dDevice) ); + + deviceEx->Release(); + d3dEx->Release(); + + return 0; + } + + D3D9WPFRenderer* D3D9WPFRenderer::createWPFRenderer( const char* inAssetDir, PxU32 initialWidth, PxU32 initialHeight ) + { + if ( incrementClassReference() == 1 ) + { + WNDCLASS wndclass; + memset( &wndclass, 0, sizeof( WNDCLASS ) ); + + wndclass.style = CS_HREDRAW | CS_VREDRAW; + wndclass.lpfnWndProc = DefWindowProc; + wndclass.lpszClassName = TEXT(APP_NAME); + + RegisterClass(&wndclass); + } + + HWND hWnd = CreateWindow(TEXT(APP_NAME), + TEXT(APP_NAME), + WS_OVERLAPPEDWINDOW, + 0, // Initial X + 0, // Initial Y + 0, // Width + 0, // Height + NULL, + NULL, + NULL, + NULL); + if ( hWnd == 0 ) return NULL; + + HMODULE hD3D9 = LoadLibrary(TEXT("d3d9.dll")); + D3DEXCreateFn exCreateFn = reinterpret_cast<D3DEXCreateFn>( GetProcAddress(hD3D9, "Direct3DCreate9Ex") ); + bool is9x = exCreateFn != NULL; + IDirect3D9* d3d = NULL; + IDirect3DDevice9* d3dDevice = NULL; + D3DPRESENT_PARAMETERS d3dpp; + ZeroMemory(&d3dpp, sizeof(d3dpp)); + d3dpp.Windowed = TRUE; + d3dpp.BackBufferHeight = 1; + d3dpp.BackBufferWidth = 1; + d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; + d3dpp.BackBufferFormat = D3DFMT_A8R8G8B8; + d3dpp.hDeviceWindow = hWnd; + HRESULT result; + + if (is9x) + { + result = InitializeD3DEx(NULL, d3dpp, d3d, d3dDevice, exCreateFn); + } + else + { + result = InitializeD3D(NULL, d3dpp, d3d, d3dDevice); + } + PX_ASSERT( result >= 0 ); + if ( result >= 0 ) + { + bool lockable = !is9x; + //We only lock earlier interface, not later ones because the later ones use a hardware transfer mechanism + //where you seem to not need to lock according to some... + D3D9WPFRenderer* retval = new D3D9WPFRenderer( hWnd, d3d, d3dDevice, "Direct3d", initialWidth, initialHeight, inAssetDir, !is9x, is9x ); + retval->checkResize( false ); //setup viewport. + //Can we create a vertex buffer here? + PX_ASSERT( result == D3D_OK ); + return retval; + } + return NULL; + } +} + +#endif
\ No newline at end of file diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d9/D3D9WPFRenderer.h b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d9/D3D9WPFRenderer.h new file mode 100644 index 00000000..b21b815c --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/d3d9/D3D9WPFRenderer.h @@ -0,0 +1,100 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#ifndef D3D9_WPF_RENDERER_H +#define D3D9_WPF_RENDERER_H +#include "D3D9Renderer.h" + +namespace SampleRenderer +{ + class WPFRendererListener + { + protected: + virtual ~WPFRendererListener(){} + public: + + virtual void beforeSurfaceRelease( IDirect3DSurface9* surface ) = 0; + virtual void afterSurfaceCreated( IDirect3DSurface9* surface ) = 0; + virtual void release() = 0; + }; + + //This renderer has special interop needs with WFP so it needs to use a slightly slowing + //device specification. Also it uses some special creation mechanisms so we get as much + //performance as we can on various platforms taking the interop considerations into account. + + //One component is that SamplePlatform isn't initialized nor available thus forcing us to override + //details on some functions + class D3D9WPFRenderer : public D3D9Renderer + { + HWND mHwnd; + IDirect3DSurface9* mCanonicalSurface; + PxU32 mDesiredWidth; + PxU32 mDesiredHeight; + const bool mLockable; + WPFRendererListener* mListener; + + protected: + + D3D9WPFRenderer( HWND hWnd + , IDirect3D9* inDirect3d + , IDirect3DDevice9* inDevice + , const char* devName + , PxU32 dispWidth + , PxU32 dispHeight + , const char* assetDir + , bool lockable + , bool isDeviceEx ); + + public: + static D3D9WPFRenderer* createWPFRenderer(const char* inAssetDir, PxU32 initialWidth = 1024, PxU32 initialHeight = 768 ); + + virtual ~D3D9WPFRenderer(); + + virtual IDirect3DSurface9* getSurface() { return mCanonicalSurface; } + virtual WPFRendererListener* getListener(); + virtual void setListener( WPFRendererListener* listener ); + + virtual void onResize( PxU32 newWidth, PxU32 newHeight ); + virtual bool swapBuffers(); + virtual bool isOk() const; + virtual void onDeviceLost(); + virtual void onDeviceReset(); + + virtual PxU32 getWidth() { return mDesiredWidth; } + virtual PxU32 getHeight() { return mDesiredHeight; } + virtual void render() { beginRender(); endRender(); } + virtual void setupAlphaBlendState(); + virtual void restoreAlphaBlendState(); + virtual void disableZWrite(); + virtual void enableZWrite(); + protected: + virtual bool checkResize( bool isDeviceLost ); + void releaseSurface(); + void allocateSurface(); + }; +} + +#endif
\ No newline at end of file diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/gles2/GLES2Renderer.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/gles2/GLES2Renderer.cpp new file mode 100644 index 00000000..fb2aeb4f --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/gles2/GLES2Renderer.cpp @@ -0,0 +1,746 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + + +#include "GLES2Renderer.h" + +#if defined(RENDERER_ENABLE_GLES2) + +#include <RendererDesc.h> + +#include <RendererVertexBufferDesc.h> +#include "GLES2RendererVertexBuffer.h" + +#include <RendererIndexBufferDesc.h> +#include "GLES2RendererIndexBuffer.h" + +#include <RendererInstanceBufferDesc.h> +#include "GLES2RendererInstanceBuffer.h" + +#include <RendererMeshDesc.h> +#include <RendererMeshContext.h> +#include "GLES2RendererMesh.h" + +#include <RendererMaterialDesc.h> +#include <RendererMaterialInstance.h> +#include "GLES2RendererMaterial.h" + +#include <RendererLightDesc.h> +#include <RendererDirectionalLightDesc.h> +#include "GLES2RendererDirectionalLight.h" + +#include <RendererTexture2DDesc.h> +#include "GLES2RendererTexture2D.h" + +#include <RendererProjection.h> + +#include <SamplePlatform.h> + +#include "foundation/PxMat44.h" + +#if defined(RENDERER_ANDROID) +PFNGLMAPBUFFEROESPROC glMapBufferOES = 0; +PFNGLUNMAPBUFFEROESPROC glUnmapBufferOES = 0; +#endif +bool GLEW_ARB_vertex_buffer_object = true; + +void SampleRenderer::PxToGL(GLfloat *gl44, const physx::PxMat44 &mat) +{ + PxMat44 mat44 = mat.getTranspose(); + memcpy(gl44, mat44.front(), 4 * 4 * sizeof (GLfloat)); +} + +void SampleRenderer::PxToGLColumnMajor(GLfloat *gl44, const physx::PxMat44 &mat44) +{ + memcpy(gl44, mat44.front(), 4 * 4 * sizeof (GLfloat)); +} + +void SampleRenderer::RenToGL(GLfloat *gl44, const RendererProjection &proj) +{ + proj.getRowMajor44(gl44); +} + +void SampleRenderer::RenToGLColumnMajor(GLfloat *gl44, const RendererProjection &proj) +{ + proj.getColumnMajor44(gl44); +} + +namespace SampleRenderer +{ + +GLES2Renderer::GLES2Renderer(const RendererDesc &desc, const char* assetDir) : + Renderer(DRIVER_GLES2, desc.errorCallback, assetDir), m_platform(SampleFramework::SamplePlatform::platform()) +{ + m_displayWidth = 0; + m_displayHeight = 0; + + m_viewMatrix = PxMat44(PxIdentity); + m_platform->initializeOGLDisplay(desc, m_displayWidth, m_displayHeight); + +#if defined RENDERER_ANDROID + glMapBufferOES = (PFNGLMAPBUFFEROESPROC) eglGetProcAddress("glMapBufferOES"); + glUnmapBufferOES = (PFNGLUNMAPBUFFEROESPROC) eglGetProcAddress("glUnmapBufferOES"); + + if (!glMapBufferOES || !glUnmapBufferOES) + { + GLEW_ARB_vertex_buffer_object = false; + } +#endif + + checkResize(); + + RendererColor& clearColor = getClearColor(); + glClearColor(clearColor.r/255.0f, clearColor.g/255.0f, clearColor.b/255.0f, clearColor.a/255.0f); + glEnable(GL_CULL_FACE); + glCullFace(GL_BACK); + glFrontFace(GL_CW); + glEnable(GL_DEPTH_TEST); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glDepthMask(GL_TRUE); + glDepthFunc(GL_LESS); +} + +RendererTexture3D* GLES2Renderer::createTexture3D(const RendererTexture3DDesc &desc) +{ + // TODO: Implement + return 0; +} + +void GLES2Renderer::setVsync(bool on) +{ + // TODO: Implement +} + +void GLES2Renderer::bindFogState(const RendererColor &fogColor, float fogDistance) +{ + m_fogColorAndDistance[0] = fogColor.r; + m_fogColorAndDistance[1] = fogColor.g; + m_fogColorAndDistance[2] = fogColor.b; + m_fogColorAndDistance[3] = fogDistance; +} + +GLES2Renderer::~GLES2Renderer(void) +{ + m_platform->freeDisplay(); +} + +bool GLES2Renderer::begin(void) +{ + return true; +} + +void GLES2Renderer::end(void) +{ + +} +void* GLES2Renderer::getDevice() +{ + /* @dduka, TODO: return something valid here */ + return NULL; +} + +bool GLES2Renderer::captureScreen(const char*) +{ + return false; +} + +bool GLES2Renderer::captureScreen(PxU32 &, PxU32&, PxU32&, const void*&) +{ + return false; +} + +void GLES2Renderer::getWindowSize(PxU32 &width, PxU32 &height) const +{ + RENDERER_ASSERT(m_displayHeight * m_displayWidth > 0, "variables not initialized properly"); + width = m_displayWidth; + height = m_displayHeight; +} + +PxU32 GLES2Renderer::convertColor(const RendererColor& color) const +{ + return GLES2RendererVertexBuffer::convertColor(color); +} + +void GLES2Renderer::checkResize(void) +{ + PxU32 width = m_displayWidth; + PxU32 height = m_displayHeight; + m_platform->getWindowSize(width, height); + if(width != m_displayWidth || height != m_displayHeight) + { + m_displayWidth = width; + m_displayHeight = height; + glViewport(0, 0, (GLsizei)m_displayWidth, (GLsizei)m_displayHeight); + glScissor( 0, 0, (GLsizei)m_displayWidth, (GLsizei)m_displayHeight); + } +} + +void GLES2Renderer::finishRendering() +{ + glFinish(); + glFlush(); +} + +// clears the offscreen buffers. +void GLES2Renderer::clearBuffers(void) +{ + if(begin()) + { + glFinish(); + GLbitfield glbuf = GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT; + //glDepthMask(1); + RendererColor& clearColor = getClearColor(); + glClearColor(clearColor.r/255.0f, clearColor.g/255.0f, clearColor.b/255.0f, clearColor.a/255.0f); + glClear(glbuf); + } + end(); +} + +// presents the current color buffer to the screen. +bool GLES2Renderer::swapBuffers(void) +{ + if(begin()) + { + m_platform->swapBuffers(); + checkResize(); + } + end(); + return false; +} + +RendererVertexBuffer *GLES2Renderer::createVertexBuffer(const RendererVertexBufferDesc &desc) +{ + GLES2RendererVertexBuffer *vb = 0; + RENDERER_ASSERT(desc.isValid(), "Invalid Vertex Buffer Descriptor."); + if(desc.isValid()) + { + vb = new GLES2RendererVertexBuffer(desc); + } + return vb; +} + +RendererIndexBuffer *GLES2Renderer::createIndexBuffer(const RendererIndexBufferDesc &desc) +{ + GLES2RendererIndexBuffer *ib = 0; + RENDERER_ASSERT(desc.isValid(), "Invalid Index Buffer Descriptor."); + if(desc.isValid()) + { + ib = new GLES2RendererIndexBuffer(desc); + } + return ib; +} + +RendererInstanceBuffer *GLES2Renderer::createInstanceBuffer(const RendererInstanceBufferDesc &desc) +{ + GLES2RendererInstanceBuffer *ib = 0; + RENDERER_ASSERT(desc.isValid(), "Invalid Instance Buffer Descriptor."); + if(desc.isValid()) + { + ib = new GLES2RendererInstanceBuffer(desc); + } + return ib; +} + +RendererTexture2D *GLES2Renderer::createTexture2D(const RendererTexture2DDesc &desc) +{ + GLES2RendererTexture2D *texture = 0; + RENDERER_ASSERT(desc.isValid(), "Invalid Texture 2D Descriptor."); + if(desc.isValid()) + { + texture = new GLES2RendererTexture2D(desc); + } + return texture; +} + +RendererTarget *GLES2Renderer::createTarget(const RendererTargetDesc &desc) +{ + RENDERER_ASSERT(0, "Not Implemented."); + return 0; +} + +RendererMaterial *GLES2Renderer::createMaterial(const RendererMaterialDesc &desc) +{ + GLES2RendererMaterial *mat = 0; + RENDERER_ASSERT(desc.isValid(), "Invalid Material Descriptor."); + if(desc.isValid()) + { + mat = new GLES2RendererMaterial(*this, desc); + } + return mat; +} + +RendererMesh *GLES2Renderer::createMesh(const RendererMeshDesc &desc) +{ + GLES2RendererMesh *mesh = 0; + RENDERER_ASSERT(desc.isValid(), "Invalid Mesh Descriptor."); + if(desc.isValid()) + { + mesh = new GLES2RendererMesh(*this, desc); + } + return mesh; +} + +RendererLight *GLES2Renderer::createLight(const RendererLightDesc &desc) +{ + RendererLight *light = 0; + RENDERER_ASSERT(desc.isValid(), "Invalid Light Descriptor."); + if(desc.isValid()) + { + switch(desc.type) + { + case RendererLight::TYPE_DIRECTIONAL: + light = new GLES2RendererDirectionalLight(*static_cast<const RendererDirectionalLightDesc*>(&desc), *this, m_lightColor, m_intensity, m_lightDirection); + break; + default: + break; + } + } + return light; +} + + +void GLES2Renderer::bindViewProj(const physx::PxMat44 &eye, const RendererProjection &proj) +{ + physx::PxMat44 inveye = eye.inverseRT(); + + // load the projection matrix... + RenToGL(m_glProjectionMatrix, proj); + RenToGL(m_glProjectionMatrixC, proj); + + // load the view matrix... + m_viewMatrix = inveye; + + m_eyePosition = eye.getPosition(); + m_eyeDirection = -eye.getBasis(2); +} + +extern GLES2RendererMaterial* g_hackCurrentMat; +extern RendererMaterialInstance* g_hackCurrentMatInstance; + +void GLES2Renderer::bindAmbientState(const RendererColor &ambient) +{ + m_ambientColor[0] = ambient.r/255.0f; + m_ambientColor[1] = ambient.g/255.0f; + m_ambientColor[2] = ambient.b/255.0f; +} + +void GLES2Renderer::bindDeferredState(void) +{ + RENDERER_ASSERT(0, "Not implemented!"); +} + +void GLES2Renderer::setCommonRendererParameters() +{ + // if we use MojoShader + GLES2RendererMaterial::shaderProgram& program = g_hackCurrentMat->m_program[g_hackCurrentMat->m_currentPass]; + + if((program.vertexMojoResult || program.fragmentMojoResult) && (g_hackCurrentMatInstance != NULL)) + { + // eye position + const RendererMaterial::Variable* var = g_hackCurrentMat->findVariable("g_eyePosition", RendererMaterial::VARIABLE_FLOAT3); + if(var) g_hackCurrentMatInstance->writeData(*var, &m_eyePosition.x); + // eye direction + var = g_hackCurrentMat->findVariable("g_eyeDirection", RendererMaterial::VARIABLE_FLOAT3); + if(var) + { + g_hackCurrentMatInstance->writeData(*var, &m_eyeDirection.x); + } + // ambient color + var = g_hackCurrentMat->findVariable("g_ambientColor", RendererMaterial::VARIABLE_FLOAT3); + if(var) + { + g_hackCurrentMatInstance->writeData(*var, m_ambientColor); + } + // light color + m_lightColor[0] = .8f; + m_lightColor[1] = .8f; + m_lightColor[2] = .8f; + var = g_hackCurrentMat->findVariable("g_lightColor", RendererMaterial::VARIABLE_FLOAT3); + if(var) g_hackCurrentMatInstance->writeData(*var, m_lightColor); + // light intensity + var = g_hackCurrentMat->findVariable("g_lightIntensity", RendererMaterial::VARIABLE_FLOAT); + if(var) + { + g_hackCurrentMatInstance->writeData(*var, &m_intensity); + } + // light direction + var = g_hackCurrentMat->findVariable("g_lightDirection", RendererMaterial::VARIABLE_FLOAT3); + if(var) + { + g_hackCurrentMatInstance->writeData(*var, m_lightDirection); + } + // fog color and distance + var = g_hackCurrentMat->findVariable("g_fogColorAndDistance", RendererMaterial::VARIABLE_FLOAT3); + if(var) g_hackCurrentMatInstance->writeData(*var, m_fogColorAndDistance); + } +} + +void GLES2Renderer::bindMeshContext(const RendererMeshContext &context) +{ + physx::PxMat44 model = physx::PxMat44(PxIdentity); + physx::PxMat44 modelView; + + if(context.transform) model = *context.transform; + + GLfloat glmvp[16]; + GLfloat glmodel[16]; + GLfloat glview[16]; + GLfloat glmodelview[16]; + + GLES2RendererMaterial::shaderProgram& program = g_hackCurrentMat->m_program[g_hackCurrentMat->m_currentPass]; + + // if we don't use MojoShader + if (program.modelMatrixUniform != -1) + { + PxToGLColumnMajor(glmodel, model); + glUniformMatrix4fv(program.modelMatrixUniform, 1, GL_FALSE, glmodel); + } + if (program.viewMatrixUniform != -1) + { + PxToGLColumnMajor(glview, m_viewMatrix); + glUniformMatrix4fv(program.viewMatrixUniform, 1, GL_FALSE, glview); + } + if (program.projMatrixUniform != -1) + { + glUniformMatrix4fv(program.projMatrixUniform, 1, GL_FALSE, m_glProjectionMatrix); + } + if (program.modelViewMatrixUniform != -1) + { + modelView = m_viewMatrix * model; + PxToGLColumnMajor(glmodelview, modelView); + glUniformMatrix4fv(program.modelViewMatrixUniform, 1, GL_FALSE, glmodelview); + } + if (program.modelViewProjMatrixUniform != -1) + { + physx::PxMat44 MVP = physx::PxMat44(m_glProjectionMatrix); + modelView = m_viewMatrix * model; + PxToGL(glmodelview, modelView); + + MVP = modelView.getTranspose() * MVP; + memcpy(glmvp, MVP.front(), sizeof(MVP)); + + glUniformMatrix4fv(program.modelViewProjMatrixUniform, 1, GL_FALSE, glmvp); + } + + RENDERER_ASSERT(context.numBones <= RENDERER_MAX_BONES, "Too many bones."); + if(context.boneMatrices && context.numBones>0 && context.numBones <= RENDERER_MAX_BONES && + g_hackCurrentMat->m_program[g_hackCurrentMat->m_currentPass].boneMatricesUniform != -1) + { + GLfloat glbonematrix[16 * RENDERER_MAX_BONES]; + for(PxU32 i=0; i<context.numBones; i++) + { + PxToGL(glbonematrix+(16*i), context.boneMatrices[i]); + } + glUniformMatrix4fv(g_hackCurrentMat->m_program[g_hackCurrentMat->m_currentPass].boneMatricesUniform, context.numBones, GL_FALSE, glbonematrix); + } + + // if we use MojoShader + if(program.vertexMojoResult || program.fragmentMojoResult) + { + // view matrix + const RendererMaterial::Variable* var = g_hackCurrentMat->findVariable("g_viewMatrix", RendererMaterial::VARIABLE_FLOAT4x4); + if(var) + { + GLfloat glview[16]; + PxToGL(glview, m_viewMatrix); + g_hackCurrentMatInstance->writeData(*var, glview); + } + // projection matrix + var = g_hackCurrentMat->findVariable("g_projMatrix", RendererMaterial::VARIABLE_FLOAT4x4); + if(var) + { + g_hackCurrentMatInstance->writeData(*var, m_glProjectionMatrix); + } + // boneMatrices matrix + RENDERER_ASSERT(context.numBones <= RENDERER_MAX_BONES, "Too many bones."); // Not enough cash? CALL CASH BONE! + var = g_hackCurrentMat->findVariable("g_boneMatrices", RendererMaterial::VARIABLE_FLOAT4x4); + if(var) + { + GLfloat glbonematrices[16 * RENDERER_MAX_BONES]; + if(context.boneMatrices && context.numBones > 0 && context.numBones <= RENDERER_MAX_BONES) { + for(size_t i = 0; i < context.numBones; ++i) { + PxToGL(glbonematrices + 16 * i, context.boneMatrices[i]); + } + g_hackCurrentMat->bindVariable(g_hackCurrentMat->m_currentPass, *var, glbonematrices); + } + } + // model matrix + var = g_hackCurrentMat->findVariable("g_modelMatrix", RendererMaterial::VARIABLE_FLOAT4x4); + if(var) + { + PxToGL(glmodel, model); + g_hackCurrentMat->bindVariable(g_hackCurrentMat->m_currentPass, *var, glmodel); + } + // model-view matrix + var = g_hackCurrentMat->findVariable("g_modelViewMatrix", RendererMaterial::VARIABLE_FLOAT4x4); + if(var) + { + modelView = m_viewMatrix * model; + PxToGL(glmodelview, modelView); + g_hackCurrentMat->bindVariable(g_hackCurrentMat->m_currentPass, *var, glmodelview); + } + // model-view-projection matrix + var = g_hackCurrentMat->findVariable("g_MVP", RendererMaterial::VARIABLE_FLOAT4x4); + if(var) + { + physx::PxMat44 MVP = physx::PxMat44(m_glProjectionMatrix); + modelView = m_viewMatrix * model; + PxToGL(glmodelview, modelView); + + MVP = modelView.getTranspose() * MVP; + memcpy(glmvp, MVP.front(), sizeof(MVP)); + + g_hackCurrentMat->bindVariable(g_hackCurrentMat->m_currentPass, *var, glmvp); + } + } else LOGI("Couldn't bind uniform values! vr = %p, fr = %p, inst = %p, -- %p", g_hackCurrentMat->m_program[g_hackCurrentMat->m_currentPass].vertexMojoResult, + g_hackCurrentMat->m_program[g_hackCurrentMat->m_currentPass].fragmentMojoResult, g_hackCurrentMatInstance, g_hackCurrentMat); + + g_hackCurrentMat->submitUniforms(); + + switch(context.cullMode) + { + case RendererMeshContext::CLOCKWISE: + glFrontFace( GL_CW ); + glCullFace( GL_BACK ); + glEnable( GL_CULL_FACE ); + break; + case RendererMeshContext::COUNTER_CLOCKWISE: + glFrontFace( GL_CCW ); + glCullFace( GL_BACK ); + glEnable( GL_CULL_FACE ); + break; + case RendererMeshContext::NONE: + glDisable( GL_CULL_FACE ); + break; + default: + RENDERER_ASSERT(0, "Invalid Cull Mode"); + } +} + +void GLES2Renderer::beginMultiPass(void) +{ +} + +void GLES2Renderer::endMultiPass(void) +{ +} + +void GLES2Renderer::beginTransparentMultiPass(void) +{ +} + +void GLES2Renderer::endTransparentMultiPass(void) +{ +} + +void GLES2Renderer::renderDeferredLight(const RendererLight &/*light*/) +{ + RENDERER_ASSERT(0, "Not implemented!"); +} + +bool GLES2Renderer::isOk(void) const +{ + bool ok = true; + return ok; +} + +void GLES2Renderer::setupTextRenderStates() +{ + glDisable(GL_CULL_FACE); + glDisable(GL_DEPTH_TEST); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glDepthMask(false); + glEnable(GL_TEXTURE_2D); +} + +void GLES2Renderer::resetTextRenderStates() +{ + glEnable(GL_CULL_FACE); + glEnable(GL_DEPTH_TEST); + glDepthMask(true); + glDisable(GL_TEXTURE_2D); +} + +bool GLES2Renderer::initTexter() +{ + Renderer::initTexter(); + + PxU32 width, height; + getWindowSize(width, height); + const PxU32 MIN_CHARACTER_WIDTH = 8; + const PxU32 TEXT_MAX_VERTICES = 4 * (width / MIN_CHARACTER_WIDTH); + const PxU32 TEXT_MAX_INDICES = TEXT_MAX_VERTICES * 1.5f; // we need 1.5 times more indices than vertices to describe text quads + + // Although text buffers (vertex and index buffers) are constantly updating, I received information that STATIC hint set on these buffers + // results in slightly better performance due to a bug (possibly) in GLES2 drivers on Android/Tegra. + // initialize vertex buffer -- will be used by all texts + RendererVertexBufferDesc vbdesc; + vbdesc.hint = RendererVertexBuffer::HINT_STATIC; + vbdesc.maxVertices = TEXT_MAX_VERTICES; + vbdesc.semanticFormats[RendererVertexBuffer::SEMANTIC_POSITION] = RendererVertexBuffer::FORMAT_FLOAT3; + vbdesc.semanticFormats[RendererVertexBuffer::SEMANTIC_TEXCOORD0] = RendererVertexBuffer::FORMAT_FLOAT2; + vbdesc.semanticFormats[RendererVertexBuffer::SEMANTIC_COLOR] = RendererVertexBuffer::FORMAT_COLOR_NATIVE; + m_textVertexBuffer = createVertexBuffer(vbdesc); + RENDERER_ASSERT(m_textVertexBuffer, "Failed to create Vertex Buffer."); + // initialize index buffer + RendererIndexBufferDesc inbdesc; + inbdesc.hint = RendererIndexBuffer::HINT_STATIC; + inbdesc.format = RendererIndexBuffer::FORMAT_UINT16; + inbdesc.maxIndices = TEXT_MAX_INDICES; + m_textIndexBuffer = createIndexBuffer(inbdesc); + RENDERER_ASSERT(m_textIndexBuffer, "Failed to create Instance Buffer."); + RendererMeshDesc meshdesc; + meshdesc.primitives = RendererMesh::PRIMITIVE_TRIANGLES; + meshdesc.vertexBuffers = &m_textVertexBuffer; + meshdesc.numVertexBuffers = 1; + meshdesc.firstVertex = 0; + meshdesc.numVertices = m_textVertexBuffer->getMaxVertices(); + meshdesc.indexBuffer = m_textIndexBuffer; + meshdesc.firstIndex = 0; + meshdesc.numIndices = m_textIndexBuffer->getMaxIndices(); + meshdesc.instanceBuffer = NULL; + meshdesc.firstInstance = 0; + meshdesc.numInstances = 0; + m_textMesh = createMesh(meshdesc); + RENDERER_ASSERT(m_textMesh, "Failed to create Mesh."); + + //m_textMaterial = NULL; + //m_textVertexBufferOffset = 0; + //m_textIndexBufferOffset = 0; + return true; +} + +void GLES2Renderer::renderTextBuffer(const void* verts, PxU32 nbVerts, const PxU16* indices, PxU32 nbIndices, RendererMaterial* material) +{ + PxU32 positionStride = 0, colorStride = 0, texcoordStride = 0; + PxU8* locked_positions = static_cast<PxU8*>(m_textVertexBuffer->lockSemantic(RendererVertexBuffer::SEMANTIC_POSITION, positionStride)); + PxU8* locked_texcoords = static_cast<PxU8*>(m_textVertexBuffer->lockSemantic(RendererVertexBuffer::SEMANTIC_TEXCOORD0, texcoordStride)); + PxU8* locked_colors = static_cast<PxU8*>(m_textVertexBuffer->lockSemantic(RendererVertexBuffer::SEMANTIC_COLOR, colorStride)); + + // copy indices + PxU16* locked_indices = static_cast<PxU16*>(m_textIndexBuffer->lock()); + memcpy(locked_indices, indices, nbIndices * sizeof(PxU16)); + m_textIndexBuffer->unlock(); + + PxU32 windowWidth, windowHeight; + getWindowSize(windowWidth, windowHeight); + PxReal windowWidthHalf = windowWidth / 2.0f, + windowHeightHalf = windowHeight / 2.0f; + + TextVertex* tv = (TextVertex*)verts; + for(PxU32 i = 0; i < nbVerts; ++i, + locked_positions += positionStride, + locked_colors += colorStride, + locked_texcoords += texcoordStride, + tv += 1) + { + PxVec3 pos = PxVec3(tv->p.x / windowWidthHalf - 1.0f, 1.0f - tv->p.y / windowHeightHalf, 0.0f); + memcpy(locked_positions, &(pos), sizeof(tv->p)); + memcpy(locked_colors, &(tv->color), sizeof(tv->color)); + memcpy(locked_texcoords, &(tv->u), sizeof(PxReal)); + memcpy(locked_texcoords + sizeof(PxReal), &(tv->v), sizeof(PxReal)); + } + m_textVertexBuffer->unlockSemantic(RendererVertexBuffer::SEMANTIC_COLOR); + m_textVertexBuffer->unlockSemantic(RendererVertexBuffer::SEMANTIC_TEXCOORD0); + m_textVertexBuffer->unlockSemantic(RendererVertexBuffer::SEMANTIC_POSITION); + + // rendering goes here + m_textMesh->setVertexBufferRange(0, nbVerts); + m_textMesh->setIndexBufferRange(0, nbIndices); + m_textMesh->bind(); + m_textMesh->render(m_textMaterial); + m_textMesh->unbind(); +} + +void GLES2Renderer::renderLines2D(const void* vertices, PxU32 nbVerts) +{ + // @dduka, TODO: glEnableClientState is not available on GL ES 2.0 + /* + const int stride = sizeof(TextVertex); + char* data = (char*)vertices; + + glEnableClientState(GL_VERTEX_ARRAY); + glDisableClientState(GL_NORMAL_ARRAY); + glEnableClientState(GL_COLOR_ARRAY); + glEnableClientState(GL_TEXTURE_COORD_ARRAY); + + // pos + glVertexPointer(3, GL_FLOAT, stride, data); + data += 3*sizeof(float); + + // rhw + PxU32 width, height; + getWindowSize(width, height); + + glMatrixMode(GL_PROJECTION); + glPushMatrix(); + glLoadIdentity(); + glOrtho(0, width, height, 0, -1, 1); + glMatrixMode(GL_MODELVIEW); + glPushMatrix(); + glLoadIdentity(); + data += sizeof(float); + + // Diffuse color + glColorPointer(4, GL_UNSIGNED_BYTE, stride, data); + data += sizeof(int); + + // Texture coordinates + glTexCoordPointer(2, GL_FLOAT, stride, data); + data += 2*sizeof(float); + + glDrawArrays(GL_LINE_STRIP, 0, nbVerts); + + glPopMatrix(); + glMatrixMode(GL_PROJECTION); + glPopMatrix(); + glMatrixMode(GL_MODELVIEW); + + glDisableClientState(GL_VERTEX_ARRAY); + glDisableClientState(GL_COLOR_ARRAY); + glDisableClientState(GL_TEXTURE_COORD_ARRAY); + */ +} + +void GLES2Renderer::setupScreenquadRenderStates() +{ + //glDisable(GL_DEPTH_TEST); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glDisable(GL_CULL_FACE); + glDepthMask(false); +} + +void GLES2Renderer::resetScreenquadRenderStates() +{ + //glEnable(GL_DEPTH_TEST); + glEnable(GL_CULL_FACE); + glDepthMask(true); +} + +} +#endif // #if defined(RENDERER_ENABLE_GLES2) diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/gles2/GLES2Renderer.h b/PhysX_3.4/Samples/SampleFramework/renderer/src/gles2/GLES2Renderer.h new file mode 100644 index 00000000..60f3a586 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/gles2/GLES2Renderer.h @@ -0,0 +1,189 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#ifndef GLES2_RENDERER_H +#define GLES2_RENDERER_H + +#include <RendererConfig.h> + +#if defined(RENDERER_ENABLE_GLES2) + +#if defined(RENDERER_ANDROID) +#include <GLES2/gl2.h> +#include <GLES2/gl2ext.h> +#include <EGL/egl.h> + +extern PFNGLMAPBUFFEROESPROC glMapBufferOES; +extern PFNGLUNMAPBUFFEROESPROC glUnmapBufferOES; + +#elif defined(RENDERER_IOS) + +#include <OpenGLES/ES2/gl.h> +#include <OpenGLES/ES2/glext.h> + +#endif + +#define GL_TEXTURE0_ARB GL_TEXTURE0 +#define glBindBufferARB glBindBuffer +#define glBufferDataARB glBufferData +#define GL_ELEMENT_ARRAY_BUFFER_ARB GL_ELEMENT_ARRAY_BUFFER +#define GL_ARRAY_BUFFER_ARB GL_ARRAY_BUFFER +#define GL_STATIC_DRAW_ARB GL_STATIC_DRAW +#define GL_DYNAMIC_DRAW_ARB GL_DYNAMIC_DRAW +#define glGenBuffersARB glGenBuffers +#define glDeleteBuffersARB glDeleteBuffers +#define GL_CLAMP GL_CLAMP_TO_EDGE +#define GL_WRITE_ONLY GL_WRITE_ONLY_OES +#define GL_READ_WRITE GL_WRITE_ONLY_OES + +extern bool GLEW_ARB_vertex_buffer_object; + +#define glActiveTextureARB glActiveTexture +#define glClientActiveTextureARB(a) + +/* GL_EXT_texture_compression_dxt1 */ +#ifndef GL_EXT_texture_compression_dxt1 +#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0 +#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1 +#endif + +/* GL_EXT_texture_compression_s3tc */ +#ifndef GL_EXT_texture_compression_s3tc +/* GL_COMPRESSED_RGB_S3TC_DXT1_EXT defined in GL_EXT_texture_compression_dxt1 already. */ +/* GL_COMPRESSED_RGBA_S3TC_DXT1_EXT defined in GL_EXT_texture_compression_dxt1 already. */ +#define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F2 +#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3 +#endif + +#define GL_RGBA8 GL_RGBA +#define GL_BGRA8 GL_BGRA + +#include <Renderer.h> + +namespace SampleFramework { + class SamplePlatform; +} + +namespace SampleRenderer +{ + +class RendererVertexBuffer; +class RendererIndexBuffer; +class RendererMaterial; + +void PxToGL(GLfloat *gl44, const physx::PxMat44 &mat); +void PxToGLColumnMajor(GLfloat *gl44, const physx::PxMat44 &mat); +void RenToGL(GLfloat *gl44, const RendererProjection &proj); +void RenToGLColumnMajor(GLfloat *gl44, const RendererProjection &proj); + +class GLES2Renderer : public Renderer +{ + public: + GLES2Renderer(const RendererDesc &desc, const char* assetDir); + virtual ~GLES2Renderer(void); + + private: + bool begin(void); + void end(void); + void checkResize(void); + + public: + // clears the offscreen buffers. + virtual void clearBuffers(void); + + // presents the current color buffer to the screen. + virtual bool swapBuffers(void); + // get the device pointer (void * abstraction) + virtual void *getDevice(); + + virtual bool captureScreen(const char*); + virtual bool captureScreen(PxU32 &width, PxU32& height, PxU32& sizeInBytes, const void*& screenshotData); + + // get the window size + void getWindowSize(PxU32 &width, PxU32 &height) const; + // copy common renderer variables to the material (like g_MVP, g_modelMatrix, etc) + virtual void setCommonRendererParameters(); + + virtual RendererVertexBuffer *createVertexBuffer( const RendererVertexBufferDesc &desc); + virtual RendererIndexBuffer *createIndexBuffer( const RendererIndexBufferDesc &desc); + virtual RendererInstanceBuffer *createInstanceBuffer(const RendererInstanceBufferDesc &desc); + virtual RendererTexture2D *createTexture2D( const RendererTexture2DDesc &desc); + virtual RendererTexture3D *createTexture3D( const RendererTexture3DDesc &desc); + virtual RendererTarget *createTarget( const RendererTargetDesc &desc); + virtual RendererMaterial *createMaterial( const RendererMaterialDesc &desc); + virtual RendererMesh *createMesh( const RendererMeshDesc &desc); + virtual RendererLight *createLight( const RendererLightDesc &desc); + + void finalizeTextRender(); + void finishRendering(); + virtual void setVsync(bool on); + private: + virtual void bindViewProj(const physx::PxMat44 &inveye, const RendererProjection &proj); + virtual void bindFogState(const RendererColor &fogColor, float fogDistance); + virtual void bindAmbientState(const RendererColor &ambientColor); + virtual void bindDeferredState(void); + virtual void bindMeshContext(const RendererMeshContext &context); + virtual void beginMultiPass(void); + virtual void endMultiPass(void); + virtual void beginTransparentMultiPass(void); + virtual void endTransparentMultiPass(void); + virtual void renderDeferredLight(const RendererLight &light); + virtual PxU32 convertColor(const RendererColor& color) const; + + virtual bool isOk(void) const; + + virtual bool initTexter(); + virtual void setupTextRenderStates(); + virtual void resetTextRenderStates(); + virtual void renderTextBuffer(const void* vertices, PxU32 nbVerts, const PxU16* indices, PxU32 nbIndices, SampleRenderer::RendererMaterial* material); + virtual void renderLines2D(const void* vertices, PxU32 nbVerts); + virtual void setupScreenquadRenderStates(); + virtual void resetScreenquadRenderStates(); + private: + SampleFramework::SamplePlatform* m_platform; + RendererVertexBuffer* m_textVertexBuffer; + RendererIndexBuffer* m_textIndexBuffer; + PxU32 m_textVertexBufferOffset; + PxU32 m_textIndexBufferOffset; + RendererMaterial* m_textMaterial; + RendererMesh* m_textMesh; + PxU32 m_displayWidth; + PxU32 m_displayHeight; + + physx::PxMat44 m_viewMatrix; + GLfloat m_glProjectionMatrix[16], m_glProjectionMatrixC[16]; + PxVec3 m_eyePosition; + PxVec3 m_eyeDirection; + GLfloat m_ambientColor[3]; + GLfloat m_lightColor[3]; + GLfloat m_intensity; + GLfloat m_lightDirection[3]; + GLfloat m_fogColorAndDistance[4]; +}; +} +#endif // #if defined(RENDERER_ENABLE_GLES2) +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/gles2/GLES2RendererDirectionalLight.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/gles2/GLES2RendererDirectionalLight.cpp new file mode 100644 index 00000000..2f1fe5b9 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/gles2/GLES2RendererDirectionalLight.cpp @@ -0,0 +1,65 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + + +#include "GLES2RendererDirectionalLight.h" +#include "GLES2RendererMaterial.h" +#include "GLES2Renderer.h" +#include "RendererMaterialInstance.h" + +#if defined(RENDERER_ENABLE_GLES2) +namespace SampleRenderer +{ + +GLES2RendererDirectionalLight::GLES2RendererDirectionalLight(const RendererDirectionalLightDesc &desc, + GLES2Renderer &renderer, GLfloat (&_lightColor)[3], + GLfloat& _lightIntensity, GLfloat (&_lightDirection)[3]) : + RendererDirectionalLight(desc), m_lightColor(_lightColor), m_lightIntensity(_lightIntensity), m_lightDirection(_lightDirection) +{ +} + +GLES2RendererDirectionalLight::~GLES2RendererDirectionalLight(void) +{ +} + +extern GLES2RendererMaterial* g_hackCurrentMat; +extern RendererMaterialInstance* g_hackCurrentMatInstance; + +void GLES2RendererDirectionalLight::bind(void) const +{ + m_lightColor[0] = m_color.r/255.0f; + m_lightColor[1] = m_color.g/255.0f; + m_lightColor[2] = m_color.b/255.0f; + m_lightIntensity = m_intensity; + m_lightDirection[0] = m_direction.x; + m_lightDirection[1] = m_direction.y; + m_lightDirection[2] = m_direction.z; +} + +} + +#endif // #if defined(RENDERER_ENABLE_GLES2) diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/gles2/GLES2RendererDirectionalLight.h b/PhysX_3.4/Samples/SampleFramework/renderer/src/gles2/GLES2RendererDirectionalLight.h new file mode 100644 index 00000000..d3b6dbe4 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/gles2/GLES2RendererDirectionalLight.h @@ -0,0 +1,61 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + + +#ifndef GLES2_RENDERER_DIRECTIONAL_LIGHT_H +#define GLES2_RENDERER_DIRECTIONAL_LIGHT_H + +#include <RendererConfig.h> + +#if defined(RENDERER_ENABLE_GLES2) + +#include <RendererDirectionalLight.h> + +#include "GLES2Renderer.h" + +namespace SampleRenderer +{ +class RendererDirectionalLightDesc; + +class GLES2RendererDirectionalLight : public RendererDirectionalLight +{ + public: + GLES2RendererDirectionalLight(const RendererDirectionalLightDesc &desc, + GLES2Renderer &renderer, + GLfloat (&_lightColor)[3], GLfloat& _lightIntensity, GLfloat (&_lightDirection)[3]); + virtual ~GLES2RendererDirectionalLight(void); + + virtual void bind(void) const; + private: + GLfloat (&m_lightColor)[3]; + GLfloat& m_lightIntensity; + GLfloat (&m_lightDirection)[3]; +}; +} + +#endif // #if defined(RENDERER_ENABLE_GLES2) +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/gles2/GLES2RendererIndexBuffer.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/gles2/GLES2RendererIndexBuffer.cpp new file mode 100644 index 00000000..a12230c2 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/gles2/GLES2RendererIndexBuffer.cpp @@ -0,0 +1,115 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + + +#include "GLES2RendererIndexBuffer.h" + +#if defined(RENDERER_ENABLE_GLES2) +#include <RendererIndexBufferDesc.h> + +namespace SampleRenderer +{ + +GLES2RendererIndexBuffer::GLES2RendererIndexBuffer(const RendererIndexBufferDesc &desc) : + RendererIndexBuffer(desc) +{ + m_indexSize = getFormatByteSize(getFormat()); + RENDERER_ASSERT(GLEW_ARB_vertex_buffer_object, "Vertex Buffer Objects not supported on this machine!"); + if(GLEW_ARB_vertex_buffer_object) + { + RENDERER_ASSERT(desc.maxIndices > 0 && desc.maxIndices > 0, "Cannot create zero size Index Buffer."); + if(desc.maxIndices > 0 && desc.maxIndices > 0) + { + GLenum usage = GL_STATIC_DRAW_ARB; + if(getHint() == HINT_DYNAMIC) + { + usage = GL_DYNAMIC_DRAW_ARB; + } + + glGenBuffersARB(1, &m_ibo); + RENDERER_ASSERT(m_ibo, "Failed to create Index Buffer."); + if(m_ibo) + { + m_maxIndices = desc.maxIndices; + const PxU32 bufferSize = m_indexSize * m_maxIndices; + + glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, m_ibo); + glBufferDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, bufferSize, 0, usage); + glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0); + } + } + } +} + +GLES2RendererIndexBuffer::~GLES2RendererIndexBuffer(void) +{ + if(m_ibo) + { + glDeleteBuffersARB(1, &m_ibo); + } +} + +void *GLES2RendererIndexBuffer::lock(void) +{ + void *buffer = 0; + if(m_ibo) + { + glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, m_ibo); + buffer = glMapBufferOES(GL_ELEMENT_ARRAY_BUFFER_ARB, GL_WRITE_ONLY); + glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0); + } + return buffer; +} + +void GLES2RendererIndexBuffer::unlock(void) +{ + if(m_ibo) + { + glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, m_ibo); + glUnmapBufferOES(GL_ELEMENT_ARRAY_BUFFER_ARB); + glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0); + } +} + +void GLES2RendererIndexBuffer::bind(void) const +{ + if(m_ibo) + { + glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, m_ibo); + } +} + +void GLES2RendererIndexBuffer::unbind(void) const +{ + if(m_ibo) + { + glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0); + } + } +} + +#endif // #if defined(RENDERER_ENABLE_GLES2) diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/gles2/GLES2RendererIndexBuffer.h b/PhysX_3.4/Samples/SampleFramework/renderer/src/gles2/GLES2RendererIndexBuffer.h new file mode 100644 index 00000000..3f489a25 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/gles2/GLES2RendererIndexBuffer.h @@ -0,0 +1,61 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + + +#ifndef GLES2_RENDERER_INDEXBUFFER_H +#define GLES2_RENDERER_INDEXBUFFER_H + +#include <RendererConfig.h> + +#if defined(RENDERER_ENABLE_GLES2) + +#include <RendererIndexBuffer.h> +#include "GLES2Renderer.h" + +namespace SampleRenderer +{ +class GLES2RendererIndexBuffer : public RendererIndexBuffer +{ + public: + GLES2RendererIndexBuffer(const RendererIndexBufferDesc &desc); + virtual ~GLES2RendererIndexBuffer(void); + + public: + virtual void *lock(void); + virtual void unlock(void); + + private: + virtual void bind(void) const; + virtual void unbind(void) const; + + private: + GLuint m_ibo; + PxU32 m_indexSize; +}; +} +#endif // #if defined(RENDERER_ENABLE_GLES2) +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/gles2/GLES2RendererInstanceBuffer.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/gles2/GLES2RendererInstanceBuffer.cpp new file mode 100644 index 00000000..a78ddeac --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/gles2/GLES2RendererInstanceBuffer.cpp @@ -0,0 +1,90 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#include <RendererConfig.h> + +#if defined(RENDERER_ENABLE_GLES2) + +#include "GLES2RendererInstanceBuffer.h" +#include <RendererInstanceBufferDesc.h> + +using namespace SampleRenderer; + +GLES2RendererInstanceBuffer::GLES2RendererInstanceBuffer(const RendererInstanceBufferDesc &desc) : + RendererInstanceBuffer(desc) +{ + m_bufferSize = (PxU32)(desc.maxInstances * m_stride); + m_buffer = malloc(m_bufferSize);//PX_ALLOC(m_bufferSize); + m_maxInstances = desc.maxInstances; +} + +GLES2RendererInstanceBuffer::~GLES2RendererInstanceBuffer(void) +{ + if(m_buffer) free(m_buffer);//PX_FREE(m_buffer); +} + +physx::PxMat44 GLES2RendererInstanceBuffer::getModelMatrix(PxU32 index) const +{ + physx::PxMat44 model = PxMat44(PxIdentity); + if(index < m_maxInstances) + { + const void *instance = ((PxU8*)m_buffer)+(m_stride*index); + model = PxMat44(getInstanceColumn(instance, m_semanticDescs[SEMANTIC_NORMALX]), + getInstanceColumn(instance, m_semanticDescs[SEMANTIC_NORMALY]), + getInstanceColumn(instance, m_semanticDescs[SEMANTIC_NORMALZ]), + getInstanceColumn(instance, m_semanticDescs[SEMANTIC_POSITION])); + } + return model; +} + +PxVec3 GLES2RendererInstanceBuffer::getInstanceColumn(const void *instance, const GLES2RendererInstanceBuffer::SemanticDesc &sd) const +{ + PxVec3 col = *(PxVec3*)(((PxU8*)instance)+sd.offset); + return col; +} + +void *GLES2RendererInstanceBuffer::lock(void) +{ + return m_buffer; +} + +void GLES2RendererInstanceBuffer::unlock(void) +{ + +} + +void GLES2RendererInstanceBuffer::bind(PxU32 streamID, PxU32 firstInstance) const +{ + +} + +void GLES2RendererInstanceBuffer::unbind(PxU32 streamID) const +{ + +} + +#endif // #if defined(RENDERER_ENABLE_GLES2) diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/gles2/GLES2RendererInstanceBuffer.h b/PhysX_3.4/Samples/SampleFramework/renderer/src/gles2/GLES2RendererInstanceBuffer.h new file mode 100644 index 00000000..67c719cc --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/gles2/GLES2RendererInstanceBuffer.h @@ -0,0 +1,67 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#ifndef GLES2_RENDERER_INSTANCEBUFFER_H +#define GLES2_RENDERER_INSTANCEBUFFER_H + +#include <RendererConfig.h> + +#if defined(RENDERER_ENABLE_GLES2) + +#include <RendererInstanceBuffer.h> +#include "GLES2Renderer.h" + +namespace SampleRenderer +{ + + class GLES2RendererInstanceBuffer : public RendererInstanceBuffer + { + public: + GLES2RendererInstanceBuffer(const RendererInstanceBufferDesc &desc); + virtual ~GLES2RendererInstanceBuffer(void); + + physx::PxMat44 getModelMatrix(PxU32 index) const; + + private: + PxVec3 getInstanceColumn(const void *instance, const GLES2RendererInstanceBuffer::SemanticDesc &sd) const; + + public: + + virtual void *lock(void); + virtual void unlock(void); + + virtual void bind(PxU32 streamID, PxU32 firstInstance) const; + virtual void unbind(PxU32 streamID) const; + + private: + PxU32 m_bufferSize; + void *m_buffer; + }; + +} // namespace SampleRenderer + +#endif // #if defined(RENDERER_ENABLE_GLES2) +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/gles2/GLES2RendererMaterial.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/gles2/GLES2RendererMaterial.cpp new file mode 100644 index 00000000..252cc0c5 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/gles2/GLES2RendererMaterial.cpp @@ -0,0 +1,667 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + + +#include "GLES2RendererMaterial.h" + +#if defined(RENDERER_ENABLE_GLES2) + +#include <RendererMaterialDesc.h> +#include <RendererMemoryMacros.h> + +#include "GLES2RendererTexture2D.h" + +#include <stdio.h> + +#include "mojoshader.h" + +namespace SampleRenderer +{ + +class GLESVariable : public RendererMaterial::Variable +{ +public: + GLESVariable(const char *name, RendererMaterial::VariableType type, PxU32 offset) + : Variable(name, type, offset) + { + } + + virtual ~GLESVariable(void) {} + + GLint m_location[RendererMaterial::NUM_PASSES]; + GLint m_sampler[RendererMaterial::NUM_PASSES]; +}; + +const std::string vertexUniformArrayName = "vs_uniforms_vec4"; +const std::string pixelUniformArrayName = "ps_uniforms_vec4"; + +std::string load_file(const char* file) +{ + LOG_INFO("GLES2RendererMaterial", "Opening: \"%s\"", file); + char file2[512]; + sprintf(file2, "/sdcard/media/SampleRenderer/4/shaders/%s", file); + FILE *f = fopen(file2, "rb"); + assert(f); + + fseek(f, 0, SEEK_END); + size_t size = ftell(f); + fseek(f, 0, SEEK_SET); + char *buffer = new char[size+1]; + fread(buffer, 1, size, f); + fclose(f); + buffer[size] = '\0'; + + std::string result(buffer); + delete[] buffer; + return result; +} + + +static int glsl_log(GLuint obj, GLenum check_compile) +{ + if (check_compile == GL_COMPILE_STATUS) + { + int len = 0; + glGetShaderiv(obj, GL_INFO_LOG_LENGTH, &len); + if(len > 0) + { + char *str = (char *) malloc(len * sizeof(char)); + if (str) + { + glGetShaderInfoLog(obj, len, NULL, str); + LOG_INFO("nv_shader", "shader_debug: %s\n", str); + free(str); + } + } + } + else + { + int len = 0; + glGetProgramiv(obj, GL_INFO_LOG_LENGTH, &len); + if(len > 0) + { + char *str = (char *)malloc(len * sizeof(char)); + if (str) + { + glGetProgramInfoLog(obj, len, NULL, str); + LOG_INFO("nv_shader", "shader_debug: %s\n", str); + free(str); + } + } + } + return 0; +} + +GLES2RendererMaterial::shaderProgram::shaderProgram() : + modelMatrixUniform(-1), + viewMatrixUniform(-1), + projMatrixUniform(-1), + modelViewMatrixUniform(-1), + boneMatricesUniform(-1), + modelViewProjMatrixUniform(-1), + positionAttr(-1), + colorAttr(-1), + normalAttr(-1), + tangentAttr(-1), + boneIndexAttr(-1), + boneWeightAttr(-1), + vsUniformsTotal(0), + psUniformsTotal(0), + vsUniformsVec4(NULL), + vsUniformsVec4Location(-1), + vsUniformsVec4Size(0), + psUniformsVec4(NULL), + psUniformsVec4Location(-1), + psUniformsVec4Size(0), + vertexMojoResult(NULL), + fragmentMojoResult(NULL) +{ +} + +GLES2RendererMaterial::shaderProgram::~shaderProgram() +{ + for(int i = 0; i < NUM_PASSES; ++i) + glDeleteProgram(program); + DELETESINGLE(vertexMojoResult); + DELETESINGLE(fragmentMojoResult); + DELETEARRAY(vsUniformsVec4); + DELETEARRAY(psUniformsVec4); +} + + +GLES2RendererMaterial::GLES2RendererMaterial(GLES2Renderer &renderer, const RendererMaterialDesc &desc) : + RendererMaterial(desc, false), + m_renderer(renderer) +{ + m_glAlphaTestFunc = GL_ALWAYS; + + AlphaTestFunc alphaTestFunc = getAlphaTestFunc(); + switch(alphaTestFunc) + { + case ALPHA_TEST_ALWAYS: m_glAlphaTestFunc = GL_ALWAYS; break; + case ALPHA_TEST_EQUAL: m_glAlphaTestFunc = GL_EQUAL; break; + case ALPHA_TEST_NOT_EQUAL: m_glAlphaTestFunc = GL_NOTEQUAL; break; + case ALPHA_TEST_LESS: m_glAlphaTestFunc = GL_LESS; break; + case ALPHA_TEST_LESS_EQUAL: m_glAlphaTestFunc = GL_LEQUAL; break; + case ALPHA_TEST_GREATER: m_glAlphaTestFunc = GL_GREATER; break; + case ALPHA_TEST_GREATER_EQUAL: m_glAlphaTestFunc = GL_GEQUAL; break; + default: + RENDERER_ASSERT(0, "Unknown Alpha Test Func."); + } + + std::string vertexShaderPath(desc.vertexShaderPath); + std::string fragmentShaderPath(desc.fragmentShaderPath); + std::string vertexSource, fragmentSource; + + for(int i = 0; i < NUM_PASSES; ++i) + { + if(vertexShaderPath.substr(vertexShaderPath.size() - 3, 3) == ".cg") + { + m_program[i].vertexMojoResult = static_cast<mojoResult*>(SampleFramework::SamplePlatform::platform()-> + compileProgram(NULL, m_renderer.getAssetDir(), desc.vertexShaderPath, 0, getPassName(static_cast<Pass>(i)), "vmain", NULL)); + vertexSource = m_program[i].vertexMojoResult->parseResult.source; + LOGI("Vertex source is: \n %s \n", vertexSource.c_str()); + } + else + { + vertexSource = load_file(desc.vertexShaderPath); + } + if(fragmentShaderPath.substr(fragmentShaderPath.size() - 3, 3) == ".cg") + { + m_program[i].fragmentMojoResult = static_cast<mojoResult*>(SampleFramework::SamplePlatform::platform()-> + compileProgram(NULL, m_renderer.getAssetDir(), desc.fragmentShaderPath, 0, getPassName(static_cast<Pass>(i)), "fmain", NULL)); + fragmentSource = m_program[i].fragmentMojoResult->parseResult.source; + LOGI("Fragment source is: \n %s \n", fragmentSource.c_str()); + } + else + { + fragmentSource = load_file(desc.fragmentShaderPath); + } + + m_program[i].program = glCreateProgram(); + if(!m_program[i].program) + LOGI("GLES2RenderMaterial", "Failed to create program"); + m_program[i].vertexShader = glCreateShader(GL_VERTEX_SHADER); + if(!m_program[i].vertexShader) + LOGI("GLES2RenderMaterial", "Failed to create vertex shader"); + m_program[i].fragmentShader = glCreateShader(GL_FRAGMENT_SHADER); + if(!m_program[i].fragmentShader) + LOGI("GLES2RenderMaterial", "Failed to create vertex shader"); + + glAttachShader(m_program[i].program, m_program[i].vertexShader); + glAttachShader(m_program[i].program, m_program[i].fragmentShader); + + int size = (int)vertexSource.size(); + const char* vertexShaderCstr = vertexSource.c_str(); + glShaderSource(m_program[i].vertexShader, 1, &vertexShaderCstr, &size); + glCompileShader(m_program[i].vertexShader); + // __android_log_print(ANDROID_LOG_DEBUG, "GLES2RendererMaterial", "Compiling:\n_______________________________\n%s\n_______________________________\n", vertexSource.c_str()); + LOGI("Vertex shader compile status:"); + glsl_log(m_program[i].vertexShader, GL_COMPILE_STATUS); + + size = (int)fragmentSource.size(); + const char* fragmentShaderCstr = fragmentSource.c_str(); + glShaderSource(m_program[i].fragmentShader, 1, &fragmentShaderCstr, &size); + glCompileShader(m_program[i].fragmentShader); + // __android_log_print(ANDROID_LOG_DEBUG, "GLES2RendererMaterial", "Compiling:\n_______________________________\n%s\n_______________________________\n", fragmentSource.c_str()); + LOGI("Fragment shader compile status:"); + glsl_log(m_program[i].fragmentShader, GL_COMPILE_STATUS); + + glLinkProgram(m_program[i].program); + GLint link_status; + glsl_log(m_program[i].program, GL_LINK_STATUS); + glGetProgramiv(m_program[i].program, GL_LINK_STATUS, &link_status); + if(link_status == GL_FALSE) + { + LOGI("Failed to link program"); + GLint error = glGetError(); + if(error == GL_INVALID_VALUE) + LOGI("GL_INVALID_VALUE"); + else if(error == GL_INVALID_OPERATION) + LOGI("GL_INVALID_OPERATION"); + } + loadCustomConstants(static_cast<Pass>(i)); + } + LOGI(""); +} + +GLES2RendererMaterial::~GLES2RendererMaterial() +{ +} + +GLES2RendererMaterial *g_hackCurrentMat = NULL; +RendererMaterialInstance *g_hackCurrentMatInstance = NULL; + +void GLES2RendererMaterial::bind(RendererMaterial::Pass pass, RendererMaterialInstance *materialInstance, bool instanced) const +{ + g_hackCurrentMat = const_cast<GLES2RendererMaterial*>(this); + g_hackCurrentMatInstance = materialInstance; + m_currentPass = pass; + glUseProgram(m_program[m_currentPass].program); + m_renderer.setCommonRendererParameters(); + RendererMaterial::bind(m_currentPass, materialInstance, instanced); +} + +void GLES2RendererMaterial::bindMeshState(bool instanced) const +{ +} + +void GLES2RendererMaterial::unbind(void) const +{ +} + +static void bindSampler(const RendererMaterial::Variable &variable, const void *data, RendererMaterial::Pass pass) +{ + GLESVariable &var = (GLESVariable&) variable; + data = *(void**)data; + RENDERER_ASSERT(data, "NULL Sampler."); + if(data) + { + GLES2RendererTexture2D *tex = const_cast<GLES2RendererTexture2D*>(static_cast<const GLES2RendererTexture2D*>(data)); + glUniform1i(var.m_location[pass], var.m_sampler[pass]); + tex->bind(var.m_sampler[pass]); + } +} + +void GLES2RendererMaterial::submitUniforms() +{ + /* When all variables were fetched, we send this uniform array and clear collected variables. + At this point, if some variables will be binded after all variables already were supplied, + this will cause these variables not binded at all, until all other variables collected again. */ + Pass pass = g_hackCurrentMat->m_currentPass; + if(m_program[pass].vsUniformsTotal > 0 && m_program[pass].vsUniformsCollected.size() == m_program[pass].vsUniformsTotal) + { + const GLfloat* ptr = const_cast<const GLfloat*>(reinterpret_cast<GLfloat*>(m_program[pass].vsUniformsVec4)); + //LOGI("VERTEX: Setting uniform at %d of size %d from %x", m_program[pass].vsUniformsVec4Location, m_program[pass].vsUniformsVec4Size, ptr); + glUniform4fv(m_program[pass].vsUniformsVec4Location, (int)m_program[pass].vsUniformsVec4Size, ptr); + m_program[pass].vsUniformsCollected.clear(); + } + /* When all variables were fetched, we send this uniform array and clear collected variables. + At this point, if some variables will be binded after all variables already were supplied, + this will cause these variables not binded at all, until all other variables collected again. */ + if(m_program[pass].psUniformsTotal > 0 && m_program[pass].psUniformsCollected.size() == m_program[pass].psUniformsTotal) + { + const GLfloat* ptr = const_cast<const GLfloat*>(reinterpret_cast<GLfloat*>(m_program[pass].psUniformsVec4)); + // LOGI("FRAGMENT: Setting uniform at %d of size %d from %x", m_program[pass].psUniformsVec4Location, m_program[pass].psUniformsVec4Size, ptr); + glUniform4fv(m_program[pass].psUniformsVec4Location, (int)m_program[pass].psUniformsVec4Size, ptr); + m_program[pass].psUniformsCollected.clear(); + } +} + +void GLES2RendererMaterial::bindVariable(Pass pass, const Variable &variable, const void *data) const +{ + GLESVariable &var = (GLESVariable&) variable; + if(m_program[pass].vertexMojoResult || m_program[pass].fragmentMojoResult) + { + mojoResult::relocationType::iterator it = m_program[pass].vertexMojoResult->relocation.find(variable.getName()); + if(it != m_program[pass].vertexMojoResult->relocation.end()) + { + if(it->second.name == vertexUniformArrayName) + { + mojoResult::shaderUniformRelocation& relocation = it->second; + // Mojo could truncate unused parts of the original variable, so in the D3D assembly it'll have type which is bigger then needed in the translated shader. + // This is to prevent buffer overruns in such cases. + //relocation.size = (relocation.index + relocation.size) > m_program[pass].vsUniformsVec4SizeInBytes ? (m_program[pass].vsUniformsVec4SizeInBytes - relocation.index) : relocation.size; + //LOGI("Found variable '%s' for %s (%x)", variable.getName(), getPassName(pass), this); + //LOGI("VERTEX: Copying %d bytes from %x to %x+%d for %s (%s) -- %p", relocation.size, data, m_program[pass].vsUniformsVec4, relocation.index, variable.getName(), getPassName(pass), this); + memcpy(m_program[pass].vsUniformsVec4 + relocation.index, data, relocation.size); + m_program[pass].vsUniformsCollected.insert(variable.getName()); + } + else + { + bindSampler(variable, data, pass); + } + } + else if((it = m_program[pass].fragmentMojoResult->relocation.find(variable.getName())) != m_program[pass].fragmentMojoResult->relocation.end()) + { + if(it->second.name == pixelUniformArrayName) + { + mojoResult::shaderUniformRelocation& relocation = it->second; + // Mojo could truncate unused parts of the original variable, so in the D3D assembly it'll have type which is bigger then needed in the translated shader. + // This is to prevent buffer overruns in such cases. + //relocation.size = (relocation.index + relocation.size) > m_program[pass].psUniformsVec4SizeInBytes ? (m_program[pass].psUniformsVec4SizeInBytes - relocation.index) : relocation.size; + //LOGI("FRAGMENT: Copying %d bytes from %x to %x+%d for %s (%s) -- %p", relocation.size, data, m_program[pass].psUniformsVec4, relocation.index, variable.getName(), getPassName(pass), this); + memcpy(m_program[pass].psUniformsVec4 + relocation.index, data, relocation.size); + m_program[pass].psUniformsCollected.insert(variable.getName()); + } + else + { + bindSampler(variable, data, pass); + } + } + } + else + { + switch(var.getType()) + { + case VARIABLE_FLOAT: + { + float f = *(const float*)data; + //LOGI("GLES2RendererMaterial: VARIABLE_FLOAT"); + glUniform1f(var.m_location[pass], f); + break; + } + case VARIABLE_FLOAT2: + { + //LOGI("GLES2RendererMaterial: VARIABLE_FLOAT2"); + glUniform2fv(var.m_location[pass], 1, (const GLfloat*)data); + break; + } + case VARIABLE_FLOAT3: + { + //LOGI("GLES2RendererMaterial: VARIABLE_FLOAT3"); + glUniform3fv(var.m_location[pass], 1, (const GLfloat*)data); + break; + } + case VARIABLE_FLOAT4: + { + //LOGI("GLES2RendererMaterial: VARIABLE_FLOAT4"); + glUniform4fv(var.m_location[pass], 1, (const GLfloat*)data); + break; + } + case VARIABLE_FLOAT4x4: + { + //LOGI("GLES2RendererMaterial: VARIABLE_FLOAT4x4"); + glUniformMatrix4fv(var.m_location[pass], 1, GL_FALSE, (const GLfloat*)data); + break; + } + case VARIABLE_SAMPLER2D: + { + bindSampler(variable, data, pass); + break; + } + default: + break; + } + } +} + +RendererMaterial::VariableType GLES2RendererMaterial::GLTypetoVariableType(GLenum type) +{ + switch (type) + { + case GL_SAMPLER_2D: return VARIABLE_SAMPLER2D; + case GL_FLOAT: return VARIABLE_FLOAT; + case GL_FLOAT_VEC2: return VARIABLE_FLOAT2; + case GL_FLOAT_VEC3: return VARIABLE_FLOAT3; + case GL_FLOAT_VEC4: return VARIABLE_FLOAT4; + case GL_FLOAT_MAT4: return VARIABLE_FLOAT4x4; + default: return NUM_VARIABLE_TYPES; + } +} + +static std::string variableTypeToString(RendererMaterial::VariableType type) +{ + switch (type) + { + case RendererMaterial::VARIABLE_SAMPLER2D: return "VARIABLE_SAMPLER2D"; + case RendererMaterial::VARIABLE_FLOAT: return "VARIABLE_FLOAT"; + case RendererMaterial::VARIABLE_FLOAT2: return "VARIABLE_FLOAT2"; + case RendererMaterial::VARIABLE_FLOAT3: return "VARIABLE_FLOAT3"; + case RendererMaterial::VARIABLE_FLOAT4: return "VARIABLE_FLOAT4"; + case RendererMaterial::VARIABLE_FLOAT4x4: return "VARIABLE_FLOAT4x4"; + default: return "VARIABLE_UNKNOWN"; + } +} + +GLint GLES2RendererMaterial::getAttribLocation(size_t usage, size_t index, Pass pass) +{ + GLint result = -1; + if(m_program[pass].vertexMojoResult->parseResult.attributes.find(usage) != m_program[pass].vertexMojoResult->parseResult.attributes.end() && + m_program[pass].vertexMojoResult->parseResult.attributes[usage].size() > index) + return glGetAttribLocation(m_program[pass].program, m_program[pass].vertexMojoResult->parseResult.attributes[usage][index].c_str()); + return result; +} + +std::string GLES2RendererMaterial::mojoSampleNameToOriginal(Pass pass, const std::string& name) +{ + for(mojoResult::relocationType::const_iterator it = m_program[pass].vertexMojoResult->relocation.begin(); + it != m_program[pass].vertexMojoResult->relocation.end(); ++it) + { + if(it->second.name == name) return it->first; + } + for(mojoResult::relocationType::const_iterator it = m_program[pass].fragmentMojoResult->relocation.begin(); + it != m_program[pass].fragmentMojoResult->relocation.end(); ++it) + { + if(it->second.name == name) return it->first; + } + return std::string(); +} + +void GLES2RendererMaterial::loadCustomConstants(Pass pass) +{ + /* Find samplers locations */ + std::vector<std::string> uniformArrayName; + uniformArrayName.push_back("vs_uniforms_vec4"); + uniformArrayName.push_back("ps_uniforms_vec4"); + int sampler = 0; + GLint count; + glGetProgramiv(m_program[pass].program, GL_ACTIVE_UNIFORMS, &count); + + if (count == 0) + { + LOGI("No active uniforms!"); + } + + for (int i = 0; i < count; i++) + { + char name[512]; + GLsizei length; + GLint size; + GLenum type; + glGetActiveUniform(m_program[pass].program, i, 512, &length, &size, &type, name); + + assert(m_program[pass].vertexMojoResult && m_program[pass].fragmentMojoResult); + + RendererMaterial::VariableType vtype = GLTypetoVariableType(type); + if (strncmp(name, "g_", 2) && (vtype != NUM_VARIABLE_TYPES)) + { + if(m_program[pass].vertexMojoResult || m_program[pass].fragmentMojoResult) + { + if (vtype == VARIABLE_SAMPLER2D) + { + // find existing variable... + GLESVariable *var = NULL; + bool varFound = false; + const char* varName = mojoSampleNameToOriginal(pass, name).c_str(); + PxU32 numVariables = (PxU32)m_variables.size(); + for(PxU32 j=0; j<numVariables; j++) + { + if(!strcmp(m_variables[j]->getName(), varName)) + { + var = static_cast<GLESVariable*>(m_variables[j]); + varFound = true; + break; + } + } + + if(!varFound) + var = new GLESVariable(varName, vtype, m_variableBufferSize); + + var->m_location[pass] = glGetUniformLocation(m_program[pass].program, name); + var->m_sampler[pass] = sampler++; + if(!varFound) + { + m_variables.push_back(var); + m_variableBufferSize += var->getDataSize(); + LOGI("Uniform '%s' -> location %d, size %d", var->getName(), var->m_location[pass], var->getDataSize()); + } + else + { + LOGI("Uniform '%s' was updated -> location %d, m_sampler %d", var->getName(), var->m_location[pass], var->m_sampler[pass]); + } + } + else if(uniformArrayName[0].compare(0, uniformArrayName[0].size(), name, uniformArrayName[0].size()) == 0) + { + m_program[pass].vsUniformsVec4Size = size; + m_program[pass].vsUniformsVec4SizeInBytes = m_program[pass].vsUniformsVec4Size * sizeof(float) * 4; + m_program[pass].vsUniformsVec4 = new char[m_program[pass].vsUniformsVec4SizeInBytes]; + LOGI("Allocated %d bytes at %x for vsUniformsVec4", m_program[pass].vsUniformsVec4SizeInBytes, size_t(m_program[pass].vsUniformsVec4)); + m_program[pass].vsUniformsVec4Location = glGetUniformLocation(m_program[pass].program, name); + LOGI("Hidden uniform '%s' -> location %d, size %d x vec4", name, m_program[pass].vsUniformsVec4Location, m_program[pass].vsUniformsVec4Size); + } + else if(uniformArrayName[1].compare(0, uniformArrayName[1].size(), name, uniformArrayName[1].size()) == 0) + { + m_program[pass].psUniformsVec4Size = size; + m_program[pass].psUniformsVec4SizeInBytes = m_program[pass].psUniformsVec4Size * sizeof(float) * 4; + m_program[pass].psUniformsVec4 = new char[m_program[pass].psUniformsVec4SizeInBytes]; + LOGI("Allocated %d bytes at %x for psUniformsVec4", m_program[pass].psUniformsVec4SizeInBytes, size_t(m_program[pass].psUniformsVec4)); + m_program[pass].psUniformsVec4Location = glGetUniformLocation(m_program[pass].program, name); + LOGI("Hidden uniform '%s' -> location %d, size %d x vec4", name, m_program[pass].psUniformsVec4Location, m_program[pass].psUniformsVec4Size); + } + else + { + LOGI("Couldn't find uniform!"); + } + } + else + { + GLESVariable *var = new GLESVariable(name, vtype, m_variableBufferSize); + var->m_location[pass] = glGetUniformLocation(m_program[pass].program, name); + if (vtype == VARIABLE_SAMPLER2D) + var->m_sampler[pass] = sampler++; + LOGI("Uniform '%s' -> location %d, size %d", name, var->m_location[pass], var->getDataSize()); + m_variables.push_back(var); + m_variableBufferSize += var->getDataSize(); + } + } + } + /* Use attributes info received from the AndroidSamplePlatform layer */ + if(m_program[pass].vertexMojoResult || m_program[pass].fragmentMojoResult) + { + /* Find attributes locations */ + m_program[pass].positionAttr = getAttribLocation(MOJOSHADER_USAGE_POSITION, 0, pass); + m_program[pass].colorAttr = getAttribLocation(MOJOSHADER_USAGE_COLOR, 0, pass); + m_program[pass].normalAttr = getAttribLocation(MOJOSHADER_USAGE_NORMAL, 0, pass); + m_program[pass].tangentAttr = getAttribLocation(MOJOSHADER_USAGE_TANGENT, 0, pass); + m_program[pass].boneIndexAttr = -1; + m_program[pass].boneWeightAttr = -1; + memset(m_program[pass].texcoordAttr, -1, sizeof(m_program[pass].texcoordAttr)); + LOGI("Attributes:"); + if(m_program[pass].vertexMojoResult->parseResult.attributes.find(MOJOSHADER_USAGE_TEXCOORD) != m_program[pass].vertexMojoResult->parseResult.attributes.end()) + { + for(int i = 0; i < m_program[pass].vertexMojoResult->parseResult.attributes[MOJOSHADER_USAGE_TEXCOORD].size(); ++i) + { + m_program[pass].texcoordAttr[i] = glGetAttribLocation(m_program[pass].program, m_program[pass].vertexMojoResult->parseResult.attributes[MOJOSHADER_USAGE_TEXCOORD][i].c_str()); + LOGI("\t TEXCOORD%d: %d", i, m_program[pass].texcoordAttr[i]); + } + /* If shader contains more than 4 texture coords inputs, then next one/two should be: bone indices input, bone weights input */ + if(m_program[pass].vertexMojoResult->parseResult.attributes[MOJOSHADER_USAGE_TEXCOORD].size() > 4) + { + m_program[pass].boneIndexAttr = glGetAttribLocation(m_program[pass].program, m_program[pass].vertexMojoResult->parseResult.attributes[MOJOSHADER_USAGE_TEXCOORD][4].c_str()); + } + if(m_program[pass].vertexMojoResult->parseResult.attributes[MOJOSHADER_USAGE_TEXCOORD].size() > 5) + { + m_program[pass].boneWeightAttr = glGetAttribLocation(m_program[pass].program, m_program[pass].vertexMojoResult->parseResult.attributes[MOJOSHADER_USAGE_TEXCOORD][5].c_str()); + } + } + + LOGI("\t POSITION: %d", m_program[pass].positionAttr); + LOGI("\t COLOR: %d", m_program[pass].colorAttr); + LOGI("\t NORMAL: %d", m_program[pass].normalAttr); + LOGI("\t TANGENT: %d", m_program[pass].tangentAttr); + LOGI("\t BONE INDEX: %d", m_program[pass].boneIndexAttr); + LOGI("\t BONE WEIGHT: %d", m_program[pass].boneWeightAttr); + + /* Expose variables that were in the original shader, but are now inside one vec4 array */ + std::vector<mojoResult*> mojoResults; + mojoResults.push_back(m_program[pass].vertexMojoResult); + mojoResults.push_back(m_program[pass].fragmentMojoResult); + for(int i = 0; i < mojoResults.size(); ++i) + { + for(mojoResult::relocationType::const_iterator it = mojoResults[i]->relocation.begin(); + it != mojoResults[i]->relocation.end(); ++it) + { + if(it->second.name == uniformArrayName[i]) { + // find existing variable... + GLESVariable *var = NULL; + bool varFound = false; + PxU32 numVariables = (PxU32)m_variables.size(); + for(PxU32 j=0; j<numVariables; j++) + { + if(!strcmp(m_variables[j]->getName(), it->first.c_str())) + { + var = static_cast<GLESVariable*>(m_variables[j]); + varFound = true; + break; + } + } + if(!varFound) + var = new GLESVariable(it->first.c_str(), GLTypetoVariableType(it->second.type), m_variableBufferSize); + + var->setSize(it->second.size); + var->m_location[pass] = glGetAttribLocation(m_program[pass].program, it->second.name.c_str()); + + /* Count total variables inside an array */ + /* Inside vertex uniform array ... */ + if(i == 0) m_program[pass].vsUniformsTotal++; + /* or fragment uniform array */ + else m_program[pass].psUniformsTotal++; + + if(!varFound) + { + m_variables.push_back(var); + m_variableBufferSize += it->second.size; + } + if(varFound) + LOGI("Variable is found and updated with m_location for %s", getPassName(static_cast<Pass>(pass))); + LOGI("Uniform '%s' -> location %d, size %d of type %s", var->getName(), var->m_location[pass], it->second.size, variableTypeToString(var->getType()).c_str()); + } + } + } + LOGI("Variables inside vertex uniform array - %d", m_program[pass].vsUniformsTotal); + LOGI("Variables inside fragment uniform array - %d", m_program[pass].psUniformsTotal); + } + else + { + m_program[pass].modelViewProjMatrixUniform = glGetUniformLocation(m_program[pass].program, "g_MVP"); + m_program[pass].modelMatrixUniform = glGetUniformLocation(m_program[pass].program, "g_modelMatrix"); + m_program[pass].viewMatrixUniform = glGetUniformLocation(m_program[pass].program, "g_viewMatrix"); + m_program[pass].projMatrixUniform = glGetUniformLocation(m_program[pass].program, "g_projMatrix"); + m_program[pass].modelViewMatrixUniform = glGetUniformLocation(m_program[pass].program, "g_modelViewMatrix"); + m_program[pass].boneMatricesUniform = glGetUniformLocation(m_program[pass].program, "g_boneMatrices"); + + m_program[pass].positionAttr = glGetAttribLocation(m_program[pass].program, "position_attr"); + m_program[pass].colorAttr = glGetAttribLocation(m_program[pass].program, "color_attr"); + m_program[pass].normalAttr = glGetAttribLocation(m_program[pass].program, "normal_attr"); + m_program[pass].tangentAttr = glGetAttribLocation(m_program[pass].program, "tangent_attr"); + m_program[pass].boneIndexAttr = glGetAttribLocation(m_program[pass].program, "boneIndex_attr"); + m_program[pass].boneWeightAttr = glGetAttribLocation(m_program[pass].program, "boneWeight_attr"); + + for(PxU32 i=0; i<8; i++) + { + char attr[32]; + sprintf(attr, "texcoord%d_attr", i); + m_program[pass].texcoordAttr[i] = glGetAttribLocation(m_program[pass].program, attr); + } + } + + LOGI("That was %p", this); +} + +} +#endif // #if defined(RENDERER_ENABLE_GLES2) diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/gles2/GLES2RendererMaterial.h b/PhysX_3.4/Samples/SampleFramework/renderer/src/gles2/GLES2RendererMaterial.h new file mode 100644 index 00000000..b278f5e3 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/gles2/GLES2RendererMaterial.h @@ -0,0 +1,139 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + + +#ifndef GLES2_RENDERER_MATERIAL_H +#define GLES2_RENDERER_MATERIAL_H + +#include <RendererConfig.h> + +#if defined(RENDERER_ENABLE_GLES2) + +#include <RendererMaterial.h> +#include "GLES2Renderer.h" + +#if defined(RENDERER_ANDROID) +#include "android/AndroidSamplePlatform.h" +#elif defined(RENDERER_IOS) +#include "ios/IosSamplePlatform.h" +#endif + +#include <set> + +#include <set> + +namespace SampleRenderer +{ + +class GLES2RendererMaterial : public RendererMaterial +{ + public: + GLES2RendererMaterial(GLES2Renderer &renderer, const RendererMaterialDesc &desc); + virtual ~GLES2RendererMaterial(void); + virtual void setModelMatrix(const float *matrix) + { + PX_UNUSED(matrix); + PX_ALWAYS_ASSERT(); + } + virtual const Renderer& getRenderer() const { return m_renderer; } + + /* Actually executes glUniform* and submits data saved in the m_program[m_currentPass].vsUniformsVec4/psUniformsVec4 */ + void submitUniforms(); + + private: + virtual void bind(RendererMaterial::Pass pass, RendererMaterialInstance *materialInstance, bool instanced) const; + virtual void bindMeshState(bool instanced) const; + virtual void unbind(void) const; + virtual void bindVariable(Pass pass, const Variable &variable, const void *data) const; + + VariableType GLTypetoVariableType(GLenum type); + GLint getAttribLocation(size_t usage, size_t index, Pass pass); + std::string mojoSampleNameToOriginal(Pass pass, const std::string& name); + + private: + GLES2RendererMaterial &operator=(const GLES2RendererMaterial&) { return *this; } + + private: + void loadCustomConstants(Pass pass); + + friend class GLES2Renderer; + friend class GLES2RendererVertexBuffer; + friend class GLES2RendererDirectionalLight; + GLES2Renderer &m_renderer; + + GLenum m_glAlphaTestFunc; + + mutable struct shaderProgram { + GLuint vertexShader; + GLuint fragmentShader; + GLuint program; + + GLint modelMatrixUniform; + GLint viewMatrixUniform; + GLint projMatrixUniform; + GLint modelViewMatrixUniform; + GLint boneMatricesUniform; + GLint modelViewProjMatrixUniform; + + GLint positionAttr; + GLint colorAttr; + GLint normalAttr; + GLint tangentAttr; + GLint boneIndexAttr; + GLint boneWeightAttr; + + GLint texcoordAttr[8]; + + mutable std::set<std::string> vsUniformsCollected; + mutable std::set<std::string> psUniformsCollected; + + size_t vsUniformsTotal; + size_t psUniformsTotal; + + char* vsUniformsVec4; + GLuint vsUniformsVec4Location; + size_t vsUniformsVec4Size; + size_t vsUniformsVec4SizeInBytes; + char* psUniformsVec4; + GLuint psUniformsVec4Location; + size_t psUniformsVec4Size; + size_t psUniformsVec4SizeInBytes; + + mojoResult* vertexMojoResult; + mojoResult* fragmentMojoResult; + + shaderProgram(); + ~shaderProgram(); + } m_program[NUM_PASSES]; + + mutable Pass m_currentPass; +}; + +} + +#endif // #if defined(RENDERER_ENABLE_GLES2) +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/gles2/GLES2RendererMesh.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/gles2/GLES2RendererMesh.cpp new file mode 100644 index 00000000..b5a0ff2c --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/gles2/GLES2RendererMesh.cpp @@ -0,0 +1,103 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + + +#include "GLES2RendererMesh.h" + +#if defined(RENDERER_ENABLE_GLES2) +namespace SampleRenderer +{ + +static GLenum getGLPrimitive(RendererMesh::Primitive primitive) +{ + GLenum glprim = ~(GLenum)0; + switch(primitive) + { + case RendererMesh::PRIMITIVE_POINTS: glprim = GL_POINTS; break; + case RendererMesh::PRIMITIVE_LINES: glprim = GL_LINES; break; + case RendererMesh::PRIMITIVE_LINE_STRIP: glprim = GL_LINE_STRIP; break; + case RendererMesh::PRIMITIVE_TRIANGLES: glprim = GL_TRIANGLES; break; + case RendererMesh::PRIMITIVE_TRIANGLE_STRIP: glprim = GL_TRIANGLE_STRIP; break; + case RendererMesh::PRIMITIVE_POINT_SPRITES: glprim = GL_POINTS; break; + default: break; + } + RENDERER_ASSERT(glprim != ~(GLenum)0, "Unable to find GL Primitive type."); + return glprim; +} + +static GLenum getGLIndexType(RendererIndexBuffer::Format format) +{ + GLenum gltype = 0; + switch(format) + { + case RendererIndexBuffer::FORMAT_UINT16: gltype = GL_UNSIGNED_SHORT; break; + case RendererIndexBuffer::FORMAT_UINT32: gltype = GL_UNSIGNED_INT; break; + default: break; + } + RENDERER_ASSERT(gltype, "Unable to convert to GL Index Type."); + return gltype; +} + +GLES2RendererMesh::GLES2RendererMesh(GLES2Renderer& renderer, const RendererMeshDesc &desc) : + RendererMesh(desc), m_renderer(renderer) +{ + +} + +GLES2RendererMesh::~GLES2RendererMesh(void) +{ + +} + +void GLES2RendererMesh::renderIndices(PxU32 numVertices, PxU32 firstIndex, PxU32 numIndices, RendererIndexBuffer::Format indexFormat, RendererMaterial *material) const +{ + const PxU32 indexSize = RendererIndexBuffer::getFormatByteSize(indexFormat); + void *buffer = ((PxU8*) 0)+indexSize*firstIndex; + glDrawElements(getGLPrimitive(getPrimitives()), numIndices, getGLIndexType(indexFormat), buffer); +} + +void GLES2RendererMesh::renderVertices(PxU32 numVertices, RendererMaterial *material) const +{ + RendererMesh::Primitive primitive = getPrimitives(); + if(primitive == RendererMesh::PRIMITIVE_POINT_SPRITES) glDepthMask(false); + glDrawArrays(getGLPrimitive(primitive), 0, numVertices); + if(primitive == RendererMesh::PRIMITIVE_POINT_SPRITES) glDepthMask(true); + } + +void GLES2RendererMesh::renderIndicesInstanced(PxU32 numVertices, PxU32 firstIndex, PxU32 numIndices, RendererIndexBuffer::Format indexFormat, RendererMaterial *material) const +{ + RENDERER_ASSERT(0, "TODO") +} + +void GLES2RendererMesh::renderVerticesInstanced(PxU32 numVertices, RendererMaterial *material) const +{ + RENDERER_ASSERT(0, "TODO") +} + +} +#endif // #if defined(RENDERER_ENABLE_GLES2) + diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/gles2/GLES2RendererMesh.h b/PhysX_3.4/Samples/SampleFramework/renderer/src/gles2/GLES2RendererMesh.h new file mode 100644 index 00000000..b24dd778 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/gles2/GLES2RendererMesh.h @@ -0,0 +1,62 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + + +#ifndef GLES2_RENDERER_MESH_H +#define GLES2_RENDERER_MESH_H + +#include <RendererConfig.h> + +#if defined(RENDERER_ENABLE_GLES2) + +#include <RendererMesh.h> + +#include "GLES2Renderer.h" + +namespace SampleRenderer +{ +class GLES2RendererMesh : public RendererMesh +{ + public: + GLES2RendererMesh(GLES2Renderer& renderer, const RendererMeshDesc &desc); + virtual ~GLES2RendererMesh(void); + + public: + virtual void renderIndices(PxU32 numVertices, PxU32 firstIndex, PxU32 numIndices, RendererIndexBuffer::Format indexFormat, RendererMaterial *material) const; + virtual void renderVertices(PxU32 numVertices, RendererMaterial *material) const; + + virtual void renderIndicesInstanced(PxU32 numVertices, PxU32 firstIndex, PxU32 numIndices, RendererIndexBuffer::Format indexFormat, RendererMaterial *material) const; + virtual void renderVerticesInstanced(PxU32 numVertices, RendererMaterial *material) const; + + protected: + Renderer& renderer() { return m_renderer; } + + GLES2Renderer& m_renderer; +}; +} +#endif // #if defined(RENDERER_ENABLE_OPENGL) +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/gles2/GLES2RendererTexture2D.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/gles2/GLES2RendererTexture2D.cpp new file mode 100644 index 00000000..fab87c05 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/gles2/GLES2RendererTexture2D.cpp @@ -0,0 +1,273 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + + +#include "GLES2RendererTexture2D.h" + +#if defined(RENDERER_ENABLE_GLES2) + +namespace SampleRenderer +{ + +static GLuint getGLPixelFormat(RendererTexture2D::Format format) +{ + GLuint glformat = 0; + switch(format) + { +#if !defined(RENDERER_IOS) + case RendererTexture2D::FORMAT_B8G8R8A8: glformat = GL_RGBA8; break; +#else + case RendererTexture2D::FORMAT_B8G8R8A8: glformat = GL_BGRA8; break; +#endif + case RendererTexture2D::FORMAT_R32F: glformat = GL_LUMINANCE; break; + case RendererTexture2D::FORMAT_D16: glformat = GL_DEPTH_COMPONENT; break; + case RendererTexture2D::FORMAT_D24S8: glformat = GL_DEPTH_COMPONENT; break; + default: break; + } + return glformat; +} + +static GLuint getGLPixelInternalFormat(RendererTexture2D::Format format) +{ + GLuint glinternalformat = 0; + switch(format) + { + case RendererTexture2D::FORMAT_B8G8R8A8: + //apparently APPLE's current GLES2 implementation doesn't really support BGRA as an internal texture format + glinternalformat = GL_RGBA8; + break; + case RendererTexture2D::FORMAT_DXT1: + glinternalformat = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT; + break; + case RendererTexture2D::FORMAT_DXT3: + glinternalformat = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT; + break; + case RendererTexture2D::FORMAT_DXT5: + glinternalformat = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT; + break; + case RendererTexture2D::FORMAT_PVR_2BPP: + glinternalformat = GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG; + break; + case RendererTexture2D::FORMAT_PVR_4BPP: + glinternalformat = GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG; + break; + default: + break; + } + RENDERER_ASSERT(glinternalformat, "Unable to compute GL Internal Format."); + return glinternalformat; +} + +static GLuint getGLPixelType(RendererTexture2D::Format format) +{ + GLuint gltype = 0; + switch(format) + { + case RendererTexture2D::FORMAT_B8G8R8A8: + gltype = GL_UNSIGNED_BYTE; + break; + case RendererTexture2D::FORMAT_R32F: + gltype = GL_FLOAT; + break; + case RendererTexture2D::FORMAT_D16: + gltype = GL_UNSIGNED_SHORT; + break; + case RendererTexture2D::FORMAT_D24S8: + gltype = GL_UNSIGNED_INT; + break; + default: + break; + } + return gltype; +} + +static GLint getGLTextureFilter(RendererTexture2D::Filter filter, bool mipmap) +{ + GLint glfilter = 0; + switch(filter) + { + case RendererTexture2D::FILTER_NEAREST: glfilter = mipmap ? GL_NEAREST_MIPMAP_NEAREST : GL_NEAREST; break; + case RendererTexture2D::FILTER_LINEAR: glfilter = mipmap ? GL_LINEAR_MIPMAP_LINEAR : GL_LINEAR; break; + case RendererTexture2D::FILTER_ANISOTROPIC: glfilter = mipmap ? GL_LINEAR_MIPMAP_LINEAR : GL_LINEAR; break; + default: break; + } + RENDERER_ASSERT(glfilter, "Unable to convert to OpenGL Filter mode."); + return glfilter; +} + +static GLint getGLTextureAddressing(RendererTexture2D::Addressing addressing) +{ + GLint glwrap = 0; + switch(addressing) + { + case RendererTexture2D::ADDRESSING_WRAP: glwrap = GL_REPEAT; break; + case RendererTexture2D::ADDRESSING_CLAMP: glwrap = GL_CLAMP; break; + case RendererTexture2D::ADDRESSING_MIRROR: glwrap = GL_MIRRORED_REPEAT; break; + default: break; + + } + RENDERER_ASSERT(glwrap, "Unable to convert to OpenGL Addressing mode."); + return glwrap; +} + +GLES2RendererTexture2D::GLES2RendererTexture2D(const RendererTextureDesc &desc) : + RendererTexture2D(desc) +{ + m_textureid = 0; + m_glformat = 0; + m_glinternalformat = 0; + m_gltype = 0; + m_numLevels = 0; + m_data = 0; + + m_glformat = getGLPixelFormat(desc.format); + m_glinternalformat = getGLPixelInternalFormat(desc.format); + m_gltype = getGLPixelType(desc.format); + + glGenTextures(1, &m_textureid); + RENDERER_ASSERT(m_textureid, "Failed to create OpenGL Texture."); + if(m_textureid) + { + m_width = desc.width; + m_height = desc.height; + m_numLevels = desc.numLevels; + m_data = new PxU8*[m_numLevels]; + memset(m_data, 0, sizeof(PxU8*)*m_numLevels); + + glBindTexture(GL_TEXTURE_2D, m_textureid); + if(isCompressedFormat(desc.format)) + { + for(PxU32 i=0; i<desc.numLevels; i++) + { + PxU32 w = getLevelDimension(m_width, i); + PxU32 h = getLevelDimension(m_height, i); + PxU32 levelSize = computeImageByteSize(w, h, 1, desc.format); + m_data[i] = new PxU8[levelSize]; + memset(m_data[i], 0, levelSize); + glCompressedTexImage2D(GL_TEXTURE_2D, (GLint)i, m_glinternalformat, w, h, 0, levelSize, m_data[i]); + } + } + else + { + RENDERER_ASSERT(m_glformat, "Unknown OpenGL Format!"); + for(PxU32 i=0; i<desc.numLevels; i++) + { + PxU32 w = getLevelDimension(m_width, i); + PxU32 h = getLevelDimension(m_height, i); + PxU32 levelSize = computeImageByteSize(w, h, 1, desc.format); + m_data[i] = new PxU8[levelSize]; + memset(m_data[i], 0, levelSize); + glTexImage2D(GL_TEXTURE_2D, (GLint)i, m_glinternalformat, w, h, 0, m_glformat, m_gltype, m_data[i]); + } + } + + + // set filtering mode... + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, getGLTextureFilter(desc.filter, m_numLevels > 1)); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, getGLTextureFilter(desc.filter, false)); + if(desc.filter == FILTER_ANISOTROPIC) + { + GLfloat maxAnisotropy = 1.0f; + glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &maxAnisotropy); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, maxAnisotropy); + } + + // set addressing modes... + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, getGLTextureAddressing(desc.addressingU)); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, getGLTextureAddressing(desc.addressingV)); + + glBindTexture(GL_TEXTURE_2D, 0); + } +} + +GLES2RendererTexture2D::~GLES2RendererTexture2D(void) +{ + if(m_textureid) + { + glDeleteTextures(1, &m_textureid); + } + if(m_data) + { + for(PxU32 i=0; i<m_numLevels; i++) + { + delete [] m_data[i]; + } + delete [] m_data; + } +} + +void *GLES2RendererTexture2D::lockLevel(PxU32 level, PxU32 &pitch) +{ + void *buffer = 0; + RENDERER_ASSERT(level < m_numLevels, "Level out of range!"); + if(level < m_numLevels) + { + buffer = m_data[level]; + pitch = getFormatNumBlocks(getWidth()>>level, getFormat()) * getBlockSize(); + } + return buffer; +} + + +void GLES2RendererTexture2D::select(PxU32 stageIndex) +{ + bind(stageIndex); +} + +void GLES2RendererTexture2D::unlockLevel(PxU32 level) +{ + RENDERER_ASSERT(level < m_numLevels, "Level out of range!"); + if(m_textureid && level < m_numLevels) + { + PxU32 w = getLevelDimension(getWidth(), level); + PxU32 h = getLevelDimension(getHeight(), level); + glBindTexture(GL_TEXTURE_2D, m_textureid); + if(isCompressedFormat(getFormat())) + { + PxU32 levelSize = computeImageByteSize(w, h, 1, getFormat()); + glCompressedTexSubImage2D(GL_TEXTURE_2D, (GLint)level, 0, 0, w, h, m_glinternalformat, levelSize, m_data[level]); + } + else + { + glTexImage2D(GL_TEXTURE_2D, (GLint)level, m_glinternalformat, w, h, 0, m_glformat, m_gltype, m_data[level]); + } + glBindTexture(GL_TEXTURE_2D, 0); + } +} + +void GLES2RendererTexture2D::bind(PxU32 textureUnit) +{ + if(m_textureid) + { + glActiveTextureARB(GL_TEXTURE0_ARB + textureUnit); + glClientActiveTextureARB(GL_TEXTURE0_ARB + textureUnit); + glBindTexture(GL_TEXTURE_2D, m_textureid); + } +} + +} +#endif // #if defined(RENDERER_ENABLE_GLES2) diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/gles2/GLES2RendererTexture2D.h b/PhysX_3.4/Samples/SampleFramework/renderer/src/gles2/GLES2RendererTexture2D.h new file mode 100644 index 00000000..9c9a2010 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/gles2/GLES2RendererTexture2D.h @@ -0,0 +1,72 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + + +#ifndef GLES2_RENDERER_TEXTURE_2D_H +#define GLES2_RENDERER_TEXTURE_2D_H + +#include <RendererConfig.h> + +#if defined(RENDERER_ENABLE_GLES2) + +#include <RendererTexture2D.h> +#include <RendererTexture2DDesc.h> +#include "GLES2Renderer.h" + +namespace SampleRenderer +{ +class RendererTextureDesc; + +class GLES2RendererTexture2D : public RendererTexture2D +{ + public: + GLES2RendererTexture2D(const RendererTextureDesc &desc); + virtual ~GLES2RendererTexture2D(void); + + public: + virtual void *lockLevel(PxU32 level, PxU32 &pitch); + virtual void unlockLevel(PxU32 level); + + void bind(PxU32 textureUnit); + void select(PxU32 stageIndex); + + private: + GLuint m_textureid; + GLuint m_glformat; + GLuint m_glinternalformat; + GLuint m_gltype; + + PxU32 m_width; + PxU32 m_height; + + PxU32 m_numLevels; + + PxU8 **m_data; +}; +} +#endif // #if defined(RENDERER_ENABLE_GLES2) +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/gles2/GLES2RendererVertexBuffer.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/gles2/GLES2RendererVertexBuffer.cpp new file mode 100644 index 00000000..e9a0ec75 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/gles2/GLES2RendererVertexBuffer.cpp @@ -0,0 +1,332 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + + +#include "GLES2RendererVertexBuffer.h" +#include "GLES2RendererMaterial.h" + +#if defined(RENDERER_ENABLE_GLES2) + +#include <RendererVertexBufferDesc.h> + +namespace SampleRenderer +{ + +extern GLES2RendererMaterial *g_hackCurrentMat; + +GLES2RendererVertexBuffer::GLES2RendererVertexBuffer(const RendererVertexBufferDesc &desc) : + RendererVertexBuffer(desc) +{ + m_vbo = 0; + + RENDERER_ASSERT(GLEW_ARB_vertex_buffer_object, "Vertex Buffer Objects not supported on this machine!"); + if(GLEW_ARB_vertex_buffer_object) + { + GLenum usage = GL_STATIC_DRAW_ARB; + if(getHint() == HINT_DYNAMIC) + { + usage = GL_DYNAMIC_DRAW_ARB; + } + + RENDERER_ASSERT(m_stride && desc.maxVertices, "Unable to create Vertex Buffer of zero size."); + if(m_stride && desc.maxVertices) + { + glGenBuffersARB(1, &m_vbo); + RENDERER_ASSERT(m_vbo, "Failed to create Vertex Buffer Object."); + } + if(m_vbo) + { + m_maxVertices = desc.maxVertices; + PxU32 bufferSize = m_stride * m_maxVertices; + glBindBufferARB(GL_ARRAY_BUFFER_ARB, m_vbo); + glBufferDataARB(GL_ARRAY_BUFFER_ARB, bufferSize, 0, usage); + glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0); + } + } +} + +GLES2RendererVertexBuffer::~GLES2RendererVertexBuffer(void) +{ + if(m_vbo) + { + glDeleteBuffersARB(1, &m_vbo); + } +} + +void GLES2RendererVertexBuffer::swizzleColor(void *colors, PxU32 stride, PxU32 numColors, RendererVertexBuffer::Format inFormat) +{ + if (inFormat == RendererVertexBuffer::FORMAT_COLOR_RGBA) + { + const void *end = ((PxU8*)colors)+(stride*numColors); + for(PxU8* iterator = (PxU8*)colors; iterator < end; iterator+=stride) + { + std::swap(((PxU8*)iterator)[0], ((PxU8*)iterator)[2]); + } + } +} + +PxU32 GLES2RendererVertexBuffer::convertColor(const RendererColor& color) +{ + return color.a << 24 | color.b << 16 | color.g << 8 | color.r; +} + +void *GLES2RendererVertexBuffer::lock(void) +{ + void *buffer = 0; + if(m_vbo) + { + glBindBufferARB(GL_ARRAY_BUFFER_ARB, m_vbo); + buffer = glMapBufferOES(GL_ARRAY_BUFFER, GL_WRITE_ONLY); + glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0); + } + return buffer; +} + +void GLES2RendererVertexBuffer::unlock(void) +{ + if(m_vbo) + { + /* TODO: print out if format is USHORT4 */ + glBindBufferARB(GL_ARRAY_BUFFER_ARB, m_vbo); + glUnmapBufferOES(GL_ARRAY_BUFFER); + glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0); + } +} + +static GLuint getGLFormatSize(RendererVertexBuffer::Format format) +{ + PxU32 size = 0; + switch(format) + { + case RendererVertexBuffer::FORMAT_FLOAT1: size = 1; break; + case RendererVertexBuffer::FORMAT_FLOAT2: size = 2; break; + case RendererVertexBuffer::FORMAT_FLOAT3: size = 3; break; + case RendererVertexBuffer::FORMAT_FLOAT4: size = 4; break; + case RendererVertexBuffer::FORMAT_UBYTE4: size = 4; break; + case RendererVertexBuffer::FORMAT_USHORT4: size = 4; break; + case RendererVertexBuffer::FORMAT_COLOR_BGRA: size = 4; break; + case RendererVertexBuffer::FORMAT_COLOR_RGBA: size = 4; break; + case RendererVertexBuffer::FORMAT_COLOR_NATIVE: size = 4; break; + default: break; + } + RENDERER_ASSERT(size, "Unable to compute number of Vertex Buffer elements."); + return size; +} + +static GLenum getGLFormatType(RendererVertexBuffer::Format format) +{ + GLenum type = 0; + switch(format) + { + case RendererVertexBuffer::FORMAT_FLOAT1: + case RendererVertexBuffer::FORMAT_FLOAT2: + case RendererVertexBuffer::FORMAT_FLOAT3: + case RendererVertexBuffer::FORMAT_FLOAT4: + type = GL_FLOAT; + break; + case RendererVertexBuffer::FORMAT_UBYTE4: + type = GL_BYTE; + break; + case RendererVertexBuffer::FORMAT_USHORT4: + type = GL_SHORT; + break; + case RendererVertexBuffer::FORMAT_COLOR_BGRA: + case RendererVertexBuffer::FORMAT_COLOR_RGBA: + case RendererVertexBuffer::FORMAT_COLOR_NATIVE: + type = GL_UNSIGNED_BYTE; + break; + default: + break; + } + RENDERER_ASSERT(type, "Unable to compute GLType for Vertex Buffer Format."); + return type; +} + +#if !defined(RENDERER_ANDROID) && !defined(RENDERER_IOS) +static GLenum getGLSemantic(RendererVertexBuffer::Semantic semantic) +{ + GLenum glsemantic = 0; + switch(semantic) + { + case RendererVertexBuffer::SEMANTIC_POSITION: glsemantic = GL_VERTEX_ARRAY; break; + case RendererVertexBuffer::SEMANTIC_COLOR: glsemantic = GL_COLOR_ARRAY; break; + case RendererVertexBuffer::SEMANTIC_NORMAL: glsemantic = GL_NORMAL_ARRAY; break; + case RendererVertexBuffer::SEMANTIC_TANGENT: glsemantic = GL_TEXTURE_COORD_ARRAY; break; + + case RendererVertexBuffer::SEMANTIC_TEXCOORD0: + case RendererVertexBuffer::SEMANTIC_TEXCOORD1: + case RendererVertexBuffer::SEMANTIC_TEXCOORD2: + case RendererVertexBuffer::SEMANTIC_TEXCOORD3: + case RendererVertexBuffer::SEMANTIC_TEXCOORD3: + case RendererVertexBuffer::SEMANTIC_BONEINDEX: + case RendererVertexBuffer::SEMANTIC_BONEWEIGHT: + glsemantic = GL_TEXTURE_COORD_ARRAY; + break; + } + RENDERER_ASSERT(glsemantic, "Unable to compute the GL Semantic for Vertex Buffer Semantic."); + return glsemantic; +} +#endif + +void GLES2RendererVertexBuffer::bindGL(GLint position, const SemanticDesc &sm, PxU8 *buffer) +{ + if (position == -1) + return; + + glEnableVertexAttribArray(position); + GLenum type = getGLFormatType(sm.format); + glVertexAttribPointer(position, getGLFormatSize(sm.format), type, type == GL_UNSIGNED_BYTE, m_stride, buffer+sm.offset); +} + +void GLES2RendererVertexBuffer::unbindGL(GLint pos) +{ + if (pos != -1) + glDisableVertexAttribArray(pos); +} + +void GLES2RendererVertexBuffer::bind(PxU32 streamID, PxU32 firstVertex) +{ + prepareForRender(); + GLES2RendererMaterial *mat = g_hackCurrentMat; + PxU8 *buffer = ((PxU8*)0) + firstVertex*m_stride; + if(m_vbo) + { + glBindBufferARB(GL_ARRAY_BUFFER_ARB, m_vbo); + for(PxU32 i=0; i<NUM_SEMANTICS; i++) + { + Semantic semantic = (Semantic)i; + const SemanticDesc &sm = m_semanticDescs[semantic]; + if(sm.format < NUM_FORMATS) + { + switch(semantic) + { + case SEMANTIC_POSITION: + RENDERER_ASSERT(sm.format >= FORMAT_FLOAT1 && sm.format <= FORMAT_FLOAT4, "Unsupported Vertex Buffer Format for POSITION semantic."); + if(sm.format >= FORMAT_FLOAT1 && sm.format <= FORMAT_FLOAT4) + { + bindGL(mat->m_program[mat->m_currentPass].positionAttr, sm, buffer); + } + break; + case SEMANTIC_COLOR: + RENDERER_ASSERT(sm.format == FORMAT_COLOR_BGRA || sm.format == FORMAT_COLOR_RGBA || sm.format == FORMAT_COLOR_NATIVE || sm.format == FORMAT_FLOAT4, "Unsupported Vertex Buffer Format for COLOR semantic."); + if(sm.format == FORMAT_COLOR_BGRA || sm.format == FORMAT_COLOR_RGBA || sm.format == FORMAT_COLOR_NATIVE || sm.format == FORMAT_FLOAT4) + { + bindGL(mat->m_program[mat->m_currentPass].colorAttr, sm, buffer); + } + break; + case SEMANTIC_NORMAL: + RENDERER_ASSERT(sm.format == FORMAT_FLOAT3 || sm.format == FORMAT_FLOAT4, "Unsupported Vertex Buffer Format for NORMAL semantic."); + if(sm.format == FORMAT_FLOAT3 || sm.format == FORMAT_FLOAT4) + { + bindGL(mat->m_program[mat->m_currentPass].normalAttr, sm, buffer); + } + break; + case SEMANTIC_TANGENT: + RENDERER_ASSERT(sm.format == FORMAT_FLOAT3 || sm.format == FORMAT_FLOAT4, "Unsupported Vertex Buffer Format for TANGENT semantic."); + if(sm.format == FORMAT_FLOAT3 || sm.format == FORMAT_FLOAT4) + { + bindGL(mat->m_program[mat->m_currentPass].tangentAttr, sm, buffer); + } + break; + case SEMANTIC_TEXCOORD0: + case SEMANTIC_TEXCOORD1: + case SEMANTIC_TEXCOORD2: + case SEMANTIC_TEXCOORD3: + { + const PxU32 channel = semantic - SEMANTIC_TEXCOORD0; + glActiveTextureARB((GLenum)(GL_TEXTURE0_ARB + channel)); + glClientActiveTextureARB((GLenum)(GL_TEXTURE0_ARB + channel)); + + bindGL(mat->m_program[mat->m_currentPass].texcoordAttr[channel], sm, buffer); + + break; + } + case SEMANTIC_BONEINDEX: + { + glActiveTextureARB((GLenum)(GL_TEXTURE0_ARB + RENDERER_BONEINDEX_CHANNEL)); + glClientActiveTextureARB((GLenum)(GL_TEXTURE0_ARB + RENDERER_BONEINDEX_CHANNEL)); + bindGL(mat->m_program[mat->m_currentPass].boneIndexAttr, sm, buffer); + break; + } + case SEMANTIC_BONEWEIGHT: + { + glActiveTextureARB((GLenum)(GL_TEXTURE0_ARB + RENDERER_BONEWEIGHT_CHANNEL)); + glClientActiveTextureARB((GLenum)(GL_TEXTURE0_ARB + RENDERER_BONEWEIGHT_CHANNEL)); + bindGL(mat->m_program[mat->m_currentPass].boneWeightAttr, sm, buffer); + break; + } + default: + /* + __android_log_print(ANDROID_LOG_DEBUG, "GLES2RendererVertexBuffer", "semantic: %d", i); + RENDERER_ASSERT(0, "Unable to bind Vertex Buffer Semantic."); + */ + break; + } + } + } + glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0); + } +} + +void GLES2RendererVertexBuffer::unbind(PxU32 streamID) +{ + GLES2RendererMaterial *mat = g_hackCurrentMat; + + for(PxU32 i=0; i<NUM_SEMANTICS; i++) + { + Semantic semantic = (Semantic)i; + const SemanticDesc &sm = m_semanticDescs[semantic]; + if(sm.format < NUM_FORMATS) + { + switch (semantic) + { + case SEMANTIC_POSITION: unbindGL(mat->m_program[mat->m_currentPass].positionAttr); break; + case SEMANTIC_COLOR: unbindGL(mat->m_program[mat->m_currentPass].positionAttr); break; + case SEMANTIC_NORMAL: unbindGL(mat->m_program[mat->m_currentPass].normalAttr); break; + case SEMANTIC_TANGENT: unbindGL(mat->m_program[mat->m_currentPass].tangentAttr); break; + case SEMANTIC_BONEINDEX: unbindGL(mat->m_program[mat->m_currentPass].boneIndexAttr); break; + case SEMANTIC_BONEWEIGHT: unbindGL(mat->m_program[mat->m_currentPass].boneWeightAttr); break; + default: + /* + __android_log_print(ANDROID_LOG_DEBUG, "GLES2RendererVertexBuffer", "semantic: %d", i); + RENDERER_ASSERT(0, "Unable to unbind Vertex Buffer Semantic."); + */ + break; + } + } + } + for(PxU32 i=0; i<8; i++) + { + glActiveTextureARB((GLenum)(GL_TEXTURE0_ARB + i)); + glClientActiveTextureARB((GLenum)(GL_TEXTURE0_ARB + i)); + + unbindGL(mat->m_program[mat->m_currentPass].texcoordAttr[i]); + } +} + +} +#endif // #if defined(RENDERER_ENABLE_GLES2) diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/gles2/GLES2RendererVertexBuffer.h b/PhysX_3.4/Samples/SampleFramework/renderer/src/gles2/GLES2RendererVertexBuffer.h new file mode 100644 index 00000000..29009f90 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/gles2/GLES2RendererVertexBuffer.h @@ -0,0 +1,67 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + + +#ifndef GLES2_RENDERER_VERTEXBUFFER_H +#define GLES2_RENDERER_VERTEXBUFFER_H + +#include <RendererConfig.h> + +#if defined(RENDERER_ENABLE_GLES2) + +#include <RendererVertexBuffer.h> +#include "GLES2Renderer.h" + +namespace SampleRenderer +{ + +class GLES2RendererVertexBuffer : public RendererVertexBuffer +{ + public: + GLES2RendererVertexBuffer(const RendererVertexBufferDesc &desc); + virtual ~GLES2RendererVertexBuffer(void); + static PxU32 convertColor(const RendererColor& color); + + protected: + virtual void swizzleColor(void *colors, PxU32 stride, PxU32 numColors, RendererVertexBuffer::Format inFormat); + virtual void *lock(void); + virtual void unlock(void); + + virtual void bind(PxU32 streamID, PxU32 firstVertex); + virtual void unbind(PxU32 streamID); + + virtual void bindGL(GLint position, const SemanticDesc &sm, PxU8 *buffer); + virtual void unbindGL(GLint attr); + private: + + GLuint m_vbo; +}; + +} + +#endif // #if defined(RENDERER_ENABLE_GLES2) +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRenderer.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRenderer.cpp new file mode 100644 index 00000000..323bde15 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRenderer.cpp @@ -0,0 +1,292 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#include <RendererConfig.h> +#include "NULLRenderer.h" + +#include <RendererDesc.h> + +#include "NULLRendererDirectionalLight.h" +#include "NULLRendererIndexBuffer.h" +#include "NULLRendererInstanceBuffer.h" +#include "NULLRendererMaterial.h" +#include "NULLRendererMesh.h" +#include "NULLRendererSpotLight.h" +#include "NULLRendererTexture2D.h" +#include "NULLRendererVertexBuffer.h" + +#include "RendererVertexBufferDesc.h" +#include "RendererIndexBufferDesc.h" +#include "RendererInstanceBufferDesc.h" +#include "RendererTexture2DDesc.h" +#include "RendererMaterialDesc.h" +#include "RendererDirectionalLightDesc.h" +#include "RendererSpotLightDesc.h" +#include "RendererMeshDesc.h" + +using namespace SampleRenderer; + +NullRenderer::NullRenderer(const RendererDesc &desc, const char* assetDir) : +Renderer(DRIVER_NULL, desc.errorCallback, assetDir) +{ + +} + +NullRenderer::~NullRenderer(void) +{ +} + +void NullRenderer::finishRendering() +{ +} + +bool NullRenderer::captureScreen(const char* filename) +{ + return false; +} + +// clears the offscreen buffers. +void NullRenderer::clearBuffers(void) +{ +} + +// presents the current color buffer to the screen. +// returns true on device reset and if buffers need to be rewritten. +bool NullRenderer::swapBuffers(void) +{ + return false; +} + +RendererVertexBuffer *NullRenderer::createVertexBuffer(const RendererVertexBufferDesc &desc) +{ + NullRendererVertexBuffer *vb = 0; + RENDERER_ASSERT(desc.isValid(), "Invalid Vertex Buffer Descriptor."); + if(desc.isValid()) + { + vb = new NullRendererVertexBuffer(desc); + } + return vb; +} + +RendererIndexBuffer *NullRenderer::createIndexBuffer(const RendererIndexBufferDesc &desc) +{ + NullRendererIndexBuffer *ib = 0; + RENDERER_ASSERT(desc.isValid(), "Invalid Index Buffer Descriptor."); + if(desc.isValid()) + { + ib = new NullRendererIndexBuffer(desc); + } + return ib; +} + +void* NullRenderer::getDevice() +{ + return NULL; +} + +void NullRenderer::getWindowSize(PxU32 &width, PxU32 &height) const +{ + width = 640; + height = 480; +} + +void NullRenderer::renderLines2D(const void* vertices, PxU32 nbVerts) +{ + +} + +RendererInstanceBuffer *NullRenderer::createInstanceBuffer(const RendererInstanceBufferDesc &desc) +{ + NullRendererInstanceBuffer *ib = 0; + RENDERER_ASSERT(desc.isValid(), "Invalid Instance Buffer Descriptor."); + if(desc.isValid()) + { + ib = new NullRendererInstanceBuffer(desc); + } + return ib; +} + +RendererTexture2D *NullRenderer::createTexture2D(const RendererTexture2DDesc &desc) +{ + RendererTexture2D *texture = 0; + RENDERER_ASSERT(desc.isValid(), "Invalid Texture 2D Descriptor."); + if(desc.isValid()) + { + texture = new NullRendererTexture2D(desc); + } + return texture; +} + +RendererTexture3D *NullRenderer::createTexture3D(const RendererTexture3DDesc &desc) +{ + RendererTexture3D *texture = 0; + RENDERER_ASSERT(desc.isValid(), "Invalid Texture 3D Descriptor."); + if(desc.isValid()) + { + // TODO: implement + texture = NULL; + } + return texture; +} + +RendererTarget *NullRenderer::createTarget(const RendererTargetDesc &desc) +{ + RENDERER_ASSERT(0, "Not Implemented."); + return 0; +} + +RendererMaterial *NullRenderer::createMaterial(const RendererMaterialDesc &desc) +{ + NullRendererMaterial *mat = 0; + RENDERER_ASSERT(desc.isValid(), "Invalid Material Descriptor."); + if(desc.isValid()) + { + mat = new NullRendererMaterial(*this, desc); + } + return mat; +} + +RendererMesh *NullRenderer::createMesh(const RendererMeshDesc &desc) +{ + NullRendererMesh *mesh = 0; + RENDERER_ASSERT(desc.isValid(), "Invalid Mesh Descriptor."); + if(desc.isValid()) + { + mesh = new NullRendererMesh(*this,desc); + } + return mesh; +} + +RendererLight *NullRenderer::createLight(const RendererLightDesc &desc) +{ + RendererLight *light = 0; + RENDERER_ASSERT(desc.isValid(), "Invalid Light Descriptor."); + if(desc.isValid()) + { + switch(desc.type) + { + case RendererLight::TYPE_DIRECTIONAL: + light = new NullRendererDirectionalLight(*static_cast<const RendererDirectionalLightDesc*>(&desc)); + break; + case RendererLight::TYPE_SPOT: + { + light = new NullRendererSpotLight(*static_cast<const RendererSpotLightDesc*>(&desc)); + } + break; + default: + break; + } + + } + return light; +} + +void NullRenderer::bindViewProj(const physx::PxMat44 &eye, const RendererProjection &proj) +{ + +} + +void NullRenderer::bindFogState(const RendererColor &fogColor, float fogDistance) +{ +} + +void NullRenderer::bindAmbientState(const RendererColor &ambientColor) +{ + +} + +void NullRenderer::bindDeferredState(void) +{ + RENDERER_ASSERT(0, "Not implemented!"); +} + +void NullRenderer::bindMeshContext(const RendererMeshContext &context) +{ + +} + +void NullRenderer::beginMultiPass(void) +{ +} + +void NullRenderer::endMultiPass(void) +{ +} + +void NullRenderer::renderDeferredLight(const RendererLight &/*light*/) +{ + RENDERER_ASSERT(0, "Not implemented!"); +} + +PxU32 NullRenderer::convertColor(const RendererColor& color) const +{ + return color.a << 24 | color.b << 16 | color.g << 8 | color.r; +} + + +bool NullRenderer::isOk(void) const +{ + return true; +} + +/////////////////////////////////////////////////////////////////////////////// + +void NullRenderer::setupTextRenderStates() +{ +} + +void NullRenderer::resetTextRenderStates() +{ + +} + +bool NullRenderer::initTexter() +{ + + return true; +} + +void NullRenderer::renderTextBuffer(const void* verts, PxU32 nbVerts, const PxU16* indices, PxU32 nbIndices, RendererMaterial* material) +{ + +} + +void NullRenderer::renderLines2D(const void* vertices, PxU32 nbPassedVerts, RendererMaterial* material) +{ + +} + +void NullRenderer::setupScreenquadRenderStates() +{ + +} + +void NullRenderer::resetScreenquadRenderStates() +{ + +} + diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRenderer.h b/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRenderer.h new file mode 100644 index 00000000..9ca77a08 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRenderer.h @@ -0,0 +1,102 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#ifndef NULL_RENDERER_H +#define NULL_RENDERER_H + +#include <RendererConfig.h> + +#include <Renderer.h> + +namespace SampleRenderer +{ + + class NullRenderer : public Renderer + { + public: + NullRenderer(const RendererDesc &desc, const char* assetDir); + virtual ~NullRenderer(void); + + public: + // clears the offscreen buffers. + virtual void clearBuffers(void); + + // presents the current color buffer to the screen. + // returns true on device reset and if buffers need to be rewritten. + virtual bool swapBuffers(void); + + // get the device pointer (void * abstraction) + virtual void *getDevice(); + + virtual void finishRendering(); + + virtual void getWindowSize(PxU32 &width, PxU32 &height) const; + + virtual RendererVertexBuffer *createVertexBuffer( const RendererVertexBufferDesc &desc); + virtual RendererIndexBuffer *createIndexBuffer( const RendererIndexBufferDesc &desc); + virtual RendererInstanceBuffer *createInstanceBuffer(const RendererInstanceBufferDesc &desc); + virtual RendererTexture2D *createTexture2D( const RendererTexture2DDesc &desc); + virtual RendererTexture3D *createTexture3D( const RendererTexture3DDesc &desc); + virtual RendererTarget *createTarget( const RendererTargetDesc &desc); + virtual RendererMaterial *createMaterial( const RendererMaterialDesc &desc); + virtual RendererMesh *createMesh( const RendererMeshDesc &desc); + virtual RendererLight *createLight( const RendererLightDesc &desc); + + virtual bool captureScreen(const char* filename); + + virtual void renderLines2D(const void* vertices, PxU32 nbVerts); + + private: + virtual void bindViewProj(const physx::PxMat44 &eye, const RendererProjection &proj); + virtual void bindAmbientState(const RendererColor &ambientColor); + virtual void bindFogState(const RendererColor &fogColor, float fogDistance); + virtual void bindDeferredState(void); + virtual void bindMeshContext(const RendererMeshContext &context); + virtual void beginMultiPass(void); + virtual void endMultiPass(void); + virtual void renderDeferredLight(const RendererLight &light); + virtual PxU32 convertColor(const RendererColor& color) const; + virtual void beginTransparentMultiPass(void) {} + virtual void endTransparentMultiPass(void) {} + virtual void setVsync(bool on) {} + virtual bool captureScreen(PxU32 &width, PxU32& height, PxU32& sizeInBytes, const void*& screenshotData) { return false; } + + virtual bool isOk(void) const; + + virtual void setupTextRenderStates(); + virtual void resetTextRenderStates(); + virtual void renderTextBuffer(const void* vertices, PxU32 nbVerts, const PxU16* indices, PxU32 nbIndices, RendererMaterial* material); + virtual void renderLines2D(const void* vertices, PxU32 nbVerts, RendererMaterial* material); + virtual void setupScreenquadRenderStates(); + virtual void resetScreenquadRenderStates(); + virtual bool initTexter(); + + private: + }; + +} // namespace SampleRenderer + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererDirectionalLight.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererDirectionalLight.cpp new file mode 100644 index 00000000..d5ff3852 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererDirectionalLight.cpp @@ -0,0 +1,48 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#include <RendererConfig.h> + + + +#include "NULLRendererDirectionalLight.h" + +using namespace SampleRenderer; + +NullRendererDirectionalLight::NullRendererDirectionalLight(const RendererDirectionalLightDesc &desc) : + RendererDirectionalLight(desc) +{ +} + +NullRendererDirectionalLight::~NullRendererDirectionalLight(void) +{ +} + +void NullRendererDirectionalLight::bind(void) const +{ +} + diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererDirectionalLight.h b/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererDirectionalLight.h new file mode 100644 index 00000000..ba38aeb9 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererDirectionalLight.h @@ -0,0 +1,54 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#ifndef NULL_RENDERER_DIRECTIONAL_LIGHT_H +#define NULL_RENDERER_DIRECTIONAL_LIGHT_H + +#include <RendererConfig.h> + + +#include <RendererDirectionalLight.h> + +namespace SampleRenderer +{ + + class RendererDirectionalLightDesc; + + class NullRendererDirectionalLight : public RendererDirectionalLight + { + public: + NullRendererDirectionalLight(const RendererDirectionalLightDesc &desc); + virtual ~NullRendererDirectionalLight(void); + + virtual void bind(void) const; + + private: + + }; + +} // namespace SampleRenderer + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererIndexBuffer.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererIndexBuffer.cpp new file mode 100644 index 00000000..b57108a6 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererIndexBuffer.cpp @@ -0,0 +1,74 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#include <RendererConfig.h> + + +#include "NULLRendererIndexBuffer.h" +#include <RendererIndexBufferDesc.h> + +using namespace SampleRenderer; + +NullRendererIndexBuffer::NullRendererIndexBuffer(const RendererIndexBufferDesc &desc) : + RendererIndexBuffer(desc), m_Buffer(0) +{ + PxU32 indexSize = getFormatByteSize(getFormat()); + + RENDERER_ASSERT(desc.maxIndices > 0 && desc.maxIndices > 0, "Cannot create zero size Index Buffer."); + if(indexSize && desc.maxIndices > 0) + { + m_Buffer = new PxU8[indexSize*desc.maxIndices]; + m_maxIndices = desc.maxIndices; + } + +} + +NullRendererIndexBuffer::~NullRendererIndexBuffer(void) +{ + if(m_Buffer) + { + delete [] m_Buffer; + m_Buffer = NULL; + } +} + +void *NullRendererIndexBuffer::lock(void) +{ + return m_Buffer; +} + +void NullRendererIndexBuffer::unlock(void) +{ +} + +void NullRendererIndexBuffer::bind(void) const +{ +} + +void NullRendererIndexBuffer::unbind(void) const +{ +} diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererIndexBuffer.h b/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererIndexBuffer.h new file mode 100644 index 00000000..07551449 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererIndexBuffer.h @@ -0,0 +1,57 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#ifndef NULL_RENDERER_INDEXBUFFER_H +#define NULL_RENDERER_INDEXBUFFER_H + +#include <RendererConfig.h> + +#include <RendererIndexBuffer.h> + +namespace SampleRenderer +{ + + class NullRendererIndexBuffer : public RendererIndexBuffer + { + public: + NullRendererIndexBuffer(const RendererIndexBufferDesc &desc); + virtual ~NullRendererIndexBuffer(void); + + public: + virtual void *lock(void); + virtual void unlock(void); + + private: + virtual void bind(void) const; + virtual void unbind(void) const; + + private: + PxU8* m_Buffer; + }; + +} // namespace SampleRenderer + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererInstanceBuffer.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererInstanceBuffer.cpp new file mode 100644 index 00000000..bc5244c7 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererInstanceBuffer.cpp @@ -0,0 +1,74 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#include <RendererConfig.h> + +#include "NULLRendererInstanceBuffer.h" +#include <RendererInstanceBufferDesc.h> + +using namespace SampleRenderer; + +NullRendererInstanceBuffer::NullRendererInstanceBuffer(const RendererInstanceBufferDesc &desc) : + RendererInstanceBuffer(desc) +{ + m_bufferSize = (PxU32)(desc.maxInstances * m_stride); + m_buffer = new PxU8[m_bufferSize]; + + RENDERER_ASSERT(m_buffer, "Failed to create Vertex Buffer Object."); + + m_maxInstances = desc.maxInstances; +} + +NullRendererInstanceBuffer::~NullRendererInstanceBuffer(void) +{ + if(m_buffer) + { + delete [] m_buffer; + m_buffer = NULL; + } +} + + +void *NullRendererInstanceBuffer::lock(void) +{ + return m_buffer; +} + +void NullRendererInstanceBuffer::unlock(void) +{ + +} + +void NullRendererInstanceBuffer::bind(PxU32 streamID, PxU32 firstInstance) const +{ +} + +void NullRendererInstanceBuffer::unbind(PxU32 streamID) const +{ + +} + diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererInstanceBuffer.h b/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererInstanceBuffer.h new file mode 100644 index 00000000..68d9178e --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererInstanceBuffer.h @@ -0,0 +1,58 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#ifndef NULL_RENDERER_INSTANCEBUFFER_H +#define NULL_RENDERER_INSTANCEBUFFER_H + +#include <RendererConfig.h> + +#include <RendererInstanceBuffer.h> + +namespace SampleRenderer +{ + + class NullRendererInstanceBuffer : public RendererInstanceBuffer + { + public: + NullRendererInstanceBuffer(const RendererInstanceBufferDesc &desc); + virtual ~NullRendererInstanceBuffer(void); + + public: + + virtual void *lock(void); + virtual void unlock(void); + + virtual void bind(PxU32 streamID, PxU32 firstInstance) const; + virtual void unbind(PxU32 streamID) const; + + private: + PxU8 *m_buffer; + PxU32 m_bufferSize; + }; + +} // namespace SampleRenderer + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererMaterial.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererMaterial.cpp new file mode 100644 index 00000000..89540069 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererMaterial.cpp @@ -0,0 +1,78 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#include "RendererConfig.h" + +#include "NULLRendererMaterial.h" + +#include <RendererMaterialDesc.h> + +#include <SamplePlatform.h> + +// for PsString.h +namespace physx +{ + namespace string + {} +} +#include <PsString.h> +#include <PxTkFile.h> + +using namespace SampleRenderer; + +NullRendererMaterial::NullRendererMaterial(NullRenderer &renderer, const RendererMaterialDesc &desc) : + RendererMaterial(desc, renderer.getEnableMaterialCaching()), + m_renderer(renderer) +{ +} + +NullRendererMaterial::~NullRendererMaterial(void) +{ +} + + +void NullRendererMaterial::bind(RendererMaterial::Pass pass, RendererMaterialInstance *materialInstance, bool instanced) const +{ + RendererMaterial::bind(pass, materialInstance, instanced); +} + +void NullRendererMaterial::bindMeshState(bool instanced) const +{ + +} + +void NullRendererMaterial::unbind(void) const +{ + +} + + +void NullRendererMaterial::bindVariable(Pass pass, const Variable &variable, const void *data) const +{ +} + + diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererMaterial.h b/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererMaterial.h new file mode 100644 index 00000000..88674136 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererMaterial.h @@ -0,0 +1,66 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#ifndef NULL_RENDERER_MATERIAL_H +#define NULL_RENDERER_MATERIAL_H + +#include <RendererConfig.h> + +#include <RendererMaterial.h> + +#include "NULLRenderer.h" + +namespace SampleRenderer +{ + + class NullRendererMaterial : public RendererMaterial + { + public: + NullRendererMaterial(NullRenderer &renderer, const RendererMaterialDesc &desc); + virtual ~NullRendererMaterial(void); + virtual void setModelMatrix(const float *matrix) + { + PX_UNUSED(matrix); + PX_ALWAYS_ASSERT(); + } + + private: + virtual const Renderer& getRenderer() const { return m_renderer; } + virtual void bind(RendererMaterial::Pass pass, RendererMaterialInstance *materialInstance, bool instanced) const; + virtual void bindMeshState(bool instanced) const; + virtual void unbind(void) const; + virtual void bindVariable(Pass pass, const Variable &variable, const void *data) const; + + private: + NullRendererMaterial &operator=(const NullRendererMaterial&) { return *this; } + + private: + NullRenderer & m_renderer; + }; + +} // namespace SampleRenderer + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererMesh.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererMesh.cpp new file mode 100644 index 00000000..6d2a7e20 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererMesh.cpp @@ -0,0 +1,72 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#include <RendererConfig.h> + +#include "NULLRendererMesh.h" + +using namespace SampleRenderer; + + +NullRendererMesh::NullRendererMesh(NullRenderer &renderer, const RendererMeshDesc &desc) : +RendererMesh(desc), +mRenderer(renderer) +{ +} + +NullRendererMesh::~NullRendererMesh(void) +{ + + + +} + +void NullRendererMesh::renderIndices(PxU32 numVertices, PxU32 firstIndex, PxU32 numIndices, RendererIndexBuffer::Format indexFormat, RendererMaterial *material) const +{ + +} + +bool NullRendererMesh::willRender() const +{ + return true; + +} + +void NullRendererMesh::renderVertices(PxU32 numVertices, RendererMaterial *material) const +{ + +} + +void NullRendererMesh::renderIndicesInstanced(PxU32 numVertices, PxU32 firstIndex, PxU32 numIndices, RendererIndexBuffer::Format indexFormat,RendererMaterial *material) const +{ +} + +void NullRendererMesh::renderVerticesInstanced(PxU32 numVertices,RendererMaterial *material) const +{ +} + + diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererMesh.h b/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererMesh.h new file mode 100644 index 00000000..b0b87ba0 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererMesh.h @@ -0,0 +1,62 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#ifndef NULL_RENDERER_MESH_H +#define NULL_RENDERER_MESH_H + +#include <RendererConfig.h> +#include <RendererMesh.h> +#include "NULLRenderer.h" + +namespace SampleRenderer +{ + + class NullRendererMesh : public RendererMesh + { + public: + NullRendererMesh(NullRenderer &renderer, const RendererMeshDesc &desc); + virtual ~NullRendererMesh(void); + + virtual bool willRender() const; + + public: + virtual void renderIndices(PxU32 numVertices, PxU32 firstIndex, PxU32 numIndices, RendererIndexBuffer::Format indexFormat, RendererMaterial *material) const; + virtual void renderVertices(PxU32 numVertices, RendererMaterial *material) const; + + virtual void renderIndicesInstanced(PxU32 numVertices, PxU32 firstIndex, PxU32 numIndices, RendererIndexBuffer::Format indexFormat,RendererMaterial *material) const; + virtual void renderVerticesInstanced(PxU32 numVertices,RendererMaterial *material) const; + + protected: + void operator=(const NullRendererMesh &){} + Renderer& renderer() { return mRenderer; } + + private: + NullRenderer& mRenderer; + }; + +} // namespace SampleRenderer + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererSpotLight.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererSpotLight.cpp new file mode 100644 index 00000000..22a3d032 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererSpotLight.cpp @@ -0,0 +1,46 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#include <RendererConfig.h> + +#include "NULLRendererSpotLight.h" + +using namespace SampleRenderer; + +NullRendererSpotLight::NullRendererSpotLight(const RendererSpotLightDesc &desc) : + RendererSpotLight(desc) +{ + +} + +NullRendererSpotLight::~NullRendererSpotLight(void) +{ + +} + +void NullRendererSpotLight::bind(void) const +{ +} diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererSpotLight.h b/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererSpotLight.h new file mode 100644 index 00000000..f349e98e --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererSpotLight.h @@ -0,0 +1,51 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#ifndef NULL_RENDERER_SPOT_LIGHT_H +#define NULL_RENDERER_SPOT_LIGHT_H + +#include <RendererConfig.h> +#include <RendererSpotLight.h> + + +namespace SampleRenderer +{ + + class NullRendererSpotLight : public RendererSpotLight + { + public: + NullRendererSpotLight (const RendererSpotLightDesc &desc); + virtual ~NullRendererSpotLight (void); + + virtual void bind(void) const; + + private: + }; + +} // namespace SampleRenderer + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererTexture2D.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererTexture2D.cpp new file mode 100644 index 00000000..d0a19ac1 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererTexture2D.cpp @@ -0,0 +1,100 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#include <RendererConfig.h> + +#include "NULLRendererTexture2D.h" +#include <RendererTexture2DDesc.h> + +using namespace SampleRenderer; + +NullRendererTexture2D::NullRendererTexture2D(const RendererTexture2DDesc &desc) : +RendererTexture2D(desc) +{ + PxU32 width = desc.width; + PxU32 height = desc.height; + + m_numLevels = desc.numLevels; + m_data = new PxU8*[m_numLevels]; + m_width = new PxU32[m_numLevels]; + memset(m_data, 0, sizeof(PxU8*)*m_numLevels); + + for(PxU32 i=0; i<desc.numLevels; i++) + { + PxU32 w = getLevelDimension(width, i); + m_width[i] = w; + PxU32 h = getLevelDimension(height, i); + PxU32 levelSize = computeImageByteSize(w, h, 1, desc.format); + + // allocate memory + m_data[i] = new PxU8[levelSize]; + + memset(m_data[i], 0, levelSize); + } +} + +NullRendererTexture2D::~NullRendererTexture2D(void) +{ + for(PxU32 i=0; i<m_numLevels; i++) + { + delete [] m_data[i]; + } + + if(m_data) + { + delete [] m_data; + } + + if(m_width) + { + delete [] m_width; + } +} + +void *NullRendererTexture2D::lockLevel(PxU32 level, PxU32 &pitch) +{ + void *buffer = 0; + pitch = 0; + RENDERER_ASSERT(level < m_numLevels, "Level out of range!"); + if(level < m_numLevels) + { + buffer = m_data[level]; + PxU32 w = SampleRenderer::RendererTexture2D::getFormatNumBlocks(m_width[level], getFormat()); + pitch = w * getBlockSize(); + } + return buffer; +} + +void NullRendererTexture2D::unlockLevel(PxU32 level) +{ + RENDERER_ASSERT(level < m_numLevels, "Level out of range!"); +} + +void NullRendererTexture2D::bind(PxU32 textureUnit) +{ +} + diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererTexture2D.h b/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererTexture2D.h new file mode 100644 index 00000000..e4fa175b --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererTexture2D.h @@ -0,0 +1,63 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#ifndef NULL_RENDERER_TEXTURE_2D_H +#define NULL_RENDERER_TEXTURE_2D_H + +#include <RendererConfig.h> + +#include <RendererTexture2D.h> + +namespace SampleRenderer +{ + + class NullRendererTexture2D : public RendererTexture2D + { + public: + NullRendererTexture2D(const RendererTexture2DDesc &desc); + virtual ~NullRendererTexture2D(void); + + public: + virtual void *lockLevel(PxU32 level, PxU32 &pitch); + virtual void unlockLevel(PxU32 level); + + void bind(PxU32 textureUnit); + + virtual void select(PxU32 stageIndex) + { + bind(stageIndex); + } + + private: + PxU8** m_data; + PxU32 m_numLevels; + PxU32* m_width; + + }; + +} // namespace SampleRenderer + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererVertexBuffer.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererVertexBuffer.cpp new file mode 100644 index 00000000..a7a73e3c --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererVertexBuffer.cpp @@ -0,0 +1,82 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#include "RendererConfig.h" +#include <SamplePlatform.h> + +#include "NULLRendererVertexBuffer.h" + +#include <RendererVertexBufferDesc.h> + + +using namespace SampleRenderer; + +NullRendererVertexBuffer::NullRendererVertexBuffer(const RendererVertexBufferDesc &desc) + :RendererVertexBuffer(desc),m_buffer(0) +{ + RENDERER_ASSERT(m_stride && desc.maxVertices, "Unable to create Vertex Buffer of zero size."); + if(m_stride && desc.maxVertices) + { + m_buffer = new PxU8[m_stride * desc.maxVertices]; + + RENDERER_ASSERT(m_buffer, "Failed to create Vertex Buffer Object."); + + m_maxVertices = desc.maxVertices; + } +} + +NullRendererVertexBuffer::~NullRendererVertexBuffer(void) +{ + if(m_buffer) + { + delete [] m_buffer; + m_buffer = NULL; + } +} + +void NullRendererVertexBuffer::swizzleColor(void *colors, PxU32 stride, PxU32 numColors, RendererVertexBuffer::Format inFormat) +{ +} + +void *NullRendererVertexBuffer::lock(void) +{ + return m_buffer; +} + +void NullRendererVertexBuffer::unlock(void) +{ +} + + +void NullRendererVertexBuffer::bind(PxU32 streamID, PxU32 firstVertex) +{ +} + +void NullRendererVertexBuffer::unbind(PxU32 streamID) +{ +} + diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererVertexBuffer.h b/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererVertexBuffer.h new file mode 100644 index 00000000..5a27c512 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererVertexBuffer.h @@ -0,0 +1,58 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#ifndef NULL_RENDERER_VERTEXBUFFER_H +#define NULL_RENDERER_VERTEXBUFFER_H + +#include <RendererConfig.h> + +#include <RendererVertexBuffer.h> + +namespace SampleRenderer +{ + + class NullRendererVertexBuffer : public RendererVertexBuffer + { + public: + NullRendererVertexBuffer(const RendererVertexBufferDesc &desc); + virtual ~NullRendererVertexBuffer(void); + + protected: + virtual void swizzleColor(void *colors, PxU32 stride, PxU32 numColors, RendererVertexBuffer::Format inFormat); + + virtual void *lock(void); + virtual void unlock(void); + + virtual void bind(PxU32 streamID, PxU32 firstVertex); + virtual void unbind(PxU32 streamID); + + private: + PxU8* m_buffer; + }; + +} // namespace SampleRenderer + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/ogl/OGLRenderer.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/ogl/OGLRenderer.cpp new file mode 100644 index 00000000..0d536f1d --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/ogl/OGLRenderer.cpp @@ -0,0 +1,873 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#include <RendererConfig.h> + +#if defined(RENDERER_ENABLE_OPENGL) + +#include "OGLRenderer.h" + +#include <RendererDesc.h> + +#include <RendererVertexBufferDesc.h> +#include "OGLRendererVertexBuffer.h" + +#include <RendererIndexBufferDesc.h> +#include "OGLRendererIndexBuffer.h" + +#include <RendererInstanceBufferDesc.h> +#include "OGLRendererInstanceBuffer.h" + +#include <RendererMeshDesc.h> +#include <RendererMeshContext.h> +#include "OGLRendererMesh.h" + +#include <RendererMaterialDesc.h> +#include <RendererMaterialInstance.h> +#include "OGLRendererMaterial.h" + +#include <RendererLightDesc.h> +#include <RendererDirectionalLightDesc.h> +#include "OGLRendererDirectionalLight.h" +#include <RendererSpotLightDesc.h> +#include "OGLRendererSpotLight.h" + +#include <RendererTexture2DDesc.h> +#include "OGLRendererTexture2D.h" + +#include <RendererProjection.h> + +#include <SamplePlatform.h> + +#include "PxTkFile.h" +#include "PsString.h" + +namespace Ps = physx::shdfnd; + +using namespace SampleRenderer; + +#if defined(RENDERER_ENABLE_CG) + void SampleRenderer::setColorParameter(CGparameter param, const RendererColor &color) + { + const float inv255 = 1.0f / 255.0f; + const float fcolor[3] = { color.r*inv255, color.g*inv255, color.b*inv255 }; + cgSetParameter3fv(param, fcolor); + } + + void SampleRenderer::setFloat4Parameter(CGparameter param, float* values) + { + cgSetParameter4fv(param, values); + } + +#endif + +#if defined(RENDERER_ENABLE_CG) + +#if !defined(RENDERER_PS3) + static void CGENTRY onCgError(CGcontext cgContext, CGerror err, void * data) + { + const char *errstr = cgGetErrorString(err); + if(cgContext) + { + errstr = cgGetLastListing(cgContext); + } + static_cast<SampleFramework::SamplePlatform*>(data)->showMessage("Cg error", errstr); + } +#endif + + OGLRenderer::CGEnvironment::CGEnvironment(void) + { + memset(this, 0, sizeof(*this)); + } + + OGLRenderer::CGEnvironment::CGEnvironment(CGcontext cgContext) + { + modelMatrix = cgCreateParameter(cgContext, CG_FLOAT4x4); + viewMatrix = cgCreateParameter(cgContext, CG_FLOAT4x4); + projMatrix = cgCreateParameter(cgContext, CG_FLOAT4x4); + modelViewMatrix = cgCreateParameter(cgContext, CG_FLOAT4x4); + modelViewProjMatrix = cgCreateParameter(cgContext, CG_FLOAT4x4); + + boneMatrices = cgCreateParameterArray(cgContext, CG_FLOAT4x4, RENDERER_MAX_BONES); + + fogColorAndDistance = cgCreateParameter(cgContext, CG_FLOAT4); + + eyePosition = cgCreateParameter(cgContext, CG_FLOAT3); + eyeDirection = cgCreateParameter(cgContext, CG_FLOAT3); + + ambientColor = cgCreateParameter(cgContext, CG_FLOAT3); + + lightColor = cgCreateParameter(cgContext, CG_FLOAT3); + lightIntensity = cgCreateParameter(cgContext, CG_FLOAT); + lightDirection = cgCreateParameter(cgContext, CG_FLOAT3); + lightPosition = cgCreateParameter(cgContext, CG_FLOAT3); + lightInnerRadius = cgCreateParameter(cgContext, CG_FLOAT); + lightOuterRadius = cgCreateParameter(cgContext, CG_FLOAT); + lightInnerCone = cgCreateParameter(cgContext, CG_FLOAT); + lightOuterCone = cgCreateParameter(cgContext, CG_FLOAT); + } +#endif + + void SampleRenderer::PxToGL(GLfloat *gl44, const physx::PxMat44 &mat44) + { + memcpy(gl44, mat44.front(), 4 * 4 * sizeof (GLfloat)); + } + + void SampleRenderer::RenToGL(GLfloat *gl44, const RendererProjection &proj) + { + proj.getColumnMajor44(gl44); + } + + OGLRenderer::OGLRenderer(const RendererDesc &desc, const char* assetDir) : + Renderer(DRIVER_OPENGL, desc.errorCallback, assetDir), m_platform(SampleFramework::SamplePlatform::platform()) + { + m_useShadersForTextRendering = false; + m_displayWidth = 0; + m_displayHeight = 0; + m_currMaterial = 0; + m_viewMatrix = PxMat44(PxIdentity); + + m_platform->initializeOGLDisplay(desc, m_displayWidth, m_displayHeight); + m_platform->postInitializeOGLDisplay(); + + //added this to avoid garbage being displayed during initialization + RendererColor savedColor = getClearColor(); + setClearColor(RendererColor(0U)); + clearBuffers(); + swapBuffers(); + setClearColor(savedColor); + + checkResize(); + +#if defined(RENDERER_ENABLE_CG) + m_cgContext = cgCreateContext(); + RENDERER_ASSERT(m_cgContext, "Unable to obtain Cg Context."); + + m_platform->initializeCGRuntimeCompiler(); + + if(m_cgContext) + { + m_cgEnv = CGEnvironment(m_cgContext); + +#if !defined(RENDERER_PS3) + cgSetErrorHandler(onCgError, m_platform); + cgSetParameterSettingMode(m_cgContext, CG_DEFERRED_PARAMETER_SETTING); +#endif +#if defined(RENDERER_DEBUG) + cgGLSetDebugMode(CG_TRUE); +#else + cgGLSetDebugMode(CG_FALSE); +#endif + } +#endif + + Ps::strlcpy(m_deviceName, sizeof(m_deviceName), (const char*)glGetString(GL_RENDERER)); + for(char *c=m_deviceName; *c; c++) + { + if(*c == '/') + { + *c = 0; + break; + } + } + + RendererColor& clearColor = getClearColor(); + glClearColor(clearColor.r/255.0f, clearColor.g/255.0f, clearColor.b/255.0f, clearColor.a/255.0f); + glEnable(GL_CULL_FACE); + glCullFace(GL_BACK); + glFrontFace(GL_CW); + glEnable(GL_DEPTH_TEST); + } + + OGLRenderer::~OGLRenderer(void) + { + // avoid displaying garbage on screen + setClearColor(RendererColor(0U)); + clearBuffers(); + swapBuffers(); + releaseAllMaterials(); + +#if defined(RENDERER_ENABLE_CG) + if(m_cgContext) + { + cgDestroyContext(m_cgContext); + } +#endif + + m_platform->freeDisplay(); + } + + bool OGLRenderer::begin(void) + { + bool ok = false; + ok = m_platform->makeContextCurrent(); + return ok; + } + + void OGLRenderer::end(void) + { + GLenum error = glGetError(); + //RENDERER_ASSERT(GL_NO_ERROR == error, "An OpenGL error has occured"); + + if (GL_NO_ERROR != error) + { + const char* errorString = "unknown"; + +#define CASE(MESSAGE) case MESSAGE: errorString = #MESSAGE; break; + switch(error) + { + CASE(GL_INVALID_ENUM) + CASE(GL_INVALID_VALUE) + CASE(GL_INVALID_OPERATION) + CASE(GL_STACK_OVERFLOW) + CASE(GL_STACK_UNDERFLOW) + CASE(GL_OUT_OF_MEMORY) +#if !defined(RENDERER_PS3) + CASE(GL_INVALID_FRAMEBUFFER_OPERATION) +#endif + + }; + +#undef CASE + + char buf[128]; + Ps::snprintf(buf, 128, "GL error %x occurred (%s)\n", error, errorString); + if (m_errorCallback) + m_errorCallback->reportError(PxErrorCode::eINTERNAL_ERROR, buf, __FILE__, __LINE__); + } + } + + void OGLRenderer::checkResize(void) + { + PxU32 width = m_displayWidth; + PxU32 height = m_displayHeight; + m_platform->getWindowSize(width, height); + if(width != m_displayWidth || height != m_displayHeight) + { + m_displayWidth = width; + m_displayHeight = height; + glViewport(0, 0, (GLsizei)m_displayWidth, (GLsizei)m_displayHeight); + glScissor( 0, 0, (GLsizei)m_displayWidth, (GLsizei)m_displayHeight); + } + } + + // clears the offscreen buffers. + void OGLRenderer::clearBuffers(void) + { + if(begin()) + { + GLbitfield glbuf = GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT; + glDepthMask(1); + + RendererColor& clearColor = getClearColor(); + glClearColor(clearColor.r/255.0f, clearColor.g/255.0f, clearColor.b/255.0f, clearColor.a/255.0f); + glClear(glbuf); + } + end(); + } + + // presents the current color buffer to the screen. + // returns true on device reset and if buffers need to be rewritten. + bool OGLRenderer::swapBuffers(void) + { + PX_PROFILE_ZONE("OGLRendererSwapBuffers",0); + if(begin()) + { + m_platform->swapBuffers(); + checkResize(); + } + end(); + return false; + } + + void OGLRenderer::getWindowSize(PxU32 &width, PxU32 &height) const + { + RENDERER_ASSERT(m_displayHeight * m_displayWidth > 0, "variables not initialized properly"); + width = m_displayWidth; + height = m_displayHeight; + } + + RendererVertexBuffer *OGLRenderer::createVertexBuffer(const RendererVertexBufferDesc &desc) + { + PX_PROFILE_ZONE("OGLRenderer_createVertexBuffer",0); + OGLRendererVertexBuffer *vb = 0; + RENDERER_ASSERT(desc.isValid(), "Invalid Vertex Buffer Descriptor."); + if(desc.isValid()) + { + vb = new OGLRendererVertexBuffer(desc); + } + return vb; + } + + RendererIndexBuffer *OGLRenderer::createIndexBuffer(const RendererIndexBufferDesc &desc) + { + PX_PROFILE_ZONE("OGLRenderer_createIndexBuffer",0); + OGLRendererIndexBuffer *ib = 0; + RENDERER_ASSERT(desc.isValid(), "Invalid Index Buffer Descriptor."); + if(desc.isValid()) + { + ib = new OGLRendererIndexBuffer(desc); + } + return ib; + } + + RendererInstanceBuffer *OGLRenderer::createInstanceBuffer(const RendererInstanceBufferDesc &desc) + { + PX_PROFILE_ZONE("OGLRenderer_createInstanceBuffer",0); + OGLRendererInstanceBuffer *ib = 0; + RENDERER_ASSERT(desc.isValid(), "Invalid Instance Buffer Descriptor."); + if(desc.isValid()) + { + ib = new OGLRendererInstanceBuffer(desc); + } + return ib; + } + + RendererTexture2D *OGLRenderer::createTexture2D(const RendererTexture2DDesc &desc) + { + PX_PROFILE_ZONE("OGLRenderer_createTexture2D",0); + OGLRendererTexture2D *texture = 0; + RENDERER_ASSERT(desc.isValid(), "Invalid Texture 2D Descriptor."); + if(desc.isValid()) + { + texture = new OGLRendererTexture2D(desc); + } + return texture; + } + + RendererTexture3D *OGLRenderer::createTexture3D(const RendererTexture3DDesc &desc) + { + // TODO: Implement + return 0; + } + + RendererTarget *OGLRenderer::createTarget(const RendererTargetDesc &desc) + { + PX_PROFILE_ZONE("OGLRenderer_createTarget",0); + RENDERER_ASSERT(0, "Not Implemented."); + return 0; + } + + RendererMaterial *OGLRenderer::createMaterial(const RendererMaterialDesc &desc) + { + RendererMaterial *mat = hasMaterialAlready(desc); + RENDERER_ASSERT(desc.isValid(), "Invalid Material Descriptor."); + if(!mat && desc.isValid()) + { + PX_PROFILE_ZONE("OGLRenderer_createMaterial",0); + mat = new OGLRendererMaterial(*this, desc); + + registerMaterial(desc, mat); + } + return mat; + } + + RendererMesh *OGLRenderer::createMesh(const RendererMeshDesc &desc) + { + PX_PROFILE_ZONE("OGLRenderer_createMesh",0); + OGLRendererMesh *mesh = 0; + RENDERER_ASSERT(desc.isValid(), "Invalid Mesh Descriptor."); + if(desc.isValid()) + { + mesh = new OGLRendererMesh(*this, desc); + } + return mesh; + } + + RendererLight *OGLRenderer::createLight(const RendererLightDesc &desc) + { + PX_PROFILE_ZONE("OGLRenderer_createLight",0); + RendererLight *light = 0; + RENDERER_ASSERT(desc.isValid(), "Invalid Light Descriptor."); + if(desc.isValid()) + { + switch(desc.type) + { + case RendererLight::TYPE_DIRECTIONAL: + light = new OGLRendererDirectionalLight(*static_cast<const RendererDirectionalLightDesc*>(&desc), *this); + break; + case RendererLight::TYPE_SPOT: + light = new OGLRendererSpotLight(*static_cast<const RendererSpotLightDesc*>(&desc), *this); + break; + default: + RENDERER_ASSERT(0, "OGLRenderer does not support this light type"); + break; + } + } + return light; + } + + void OGLRenderer::setVsync(bool on) + { + m_platform->setOGLVsync(on); + } + + void OGLRenderer::bindViewProj(const physx::PxMat44 &eye, const RendererProjection &proj) + { + PxMat44 inveye = eye.inverseRT(); + + // load the projection matrix... + const GLfloat* glproj = &proj.getPxMat44().column0.x; + + // load the view matrix... + m_viewMatrix = inveye; + +#if defined(RENDERER_ENABLE_CG) + GLfloat glview[16]; + PxToGL(glview, inveye); + const PxVec3 &eyePosition = eye.getPosition(); + const PxVec3 eyeDirection = -eye.getBasis(2); + if(m_cgEnv.viewMatrix) cgGLSetMatrixParameterfc(m_cgEnv.viewMatrix, glview); + if(m_cgEnv.projMatrix) cgGLSetMatrixParameterfc(m_cgEnv.projMatrix, glproj); + if(m_cgEnv.eyePosition) cgGLSetParameter3fv( m_cgEnv.eyePosition, &eyePosition.x); + if(m_cgEnv.eyeDirection) cgGLSetParameter3fv( m_cgEnv.eyeDirection, &eyeDirection.x); +#endif + } + + void OGLRenderer::bindFogState(const RendererColor &fogColor, float fogDistance) + { +#if defined(RENDERER_ENABLE_CG) + const float inv255 = 1.0f / 255.0f; + + float values[4]; + values[0] = fogColor.r*inv255; + values[1] = fogColor.g*inv255; + values[2] = fogColor.b*inv255; + values[3] = fogDistance; + + setFloat4Parameter(m_cgEnv.fogColorAndDistance, values); +#endif + } + + void OGLRenderer::bindAmbientState(const RendererColor &ambientColor) + { +#if defined(RENDERER_ENABLE_CG) + setColorParameter(m_cgEnv.ambientColor, ambientColor); +#endif + } + + void OGLRenderer::bindDeferredState(void) + { + RENDERER_ASSERT(0, "Not implemented!"); + } + + void OGLRenderer::bindMeshContext(const RendererMeshContext &context) + { + PX_PROFILE_ZONE("OGLRendererBindMeshContext",0); + physx::PxMat44 model; + physx::PxMat44 modelView; + + if(context.transform) model = *context.transform; + else model = PxMat44(PxIdentity); + modelView = m_viewMatrix * model; + + GLfloat glmodelview[16]; + PxToGL(glmodelview, modelView); + glLoadMatrixf(glmodelview); + + RendererMeshContext::CullMode cullMode = context.cullMode; + if (!blendingCull() && NULL != context.material && context.material->getBlending()) + cullMode = RendererMeshContext::NONE; + + switch(cullMode) + { + case RendererMeshContext::CLOCKWISE: + glFrontFace( GL_CW ); + glCullFace( GL_BACK ); + glEnable( GL_CULL_FACE ); + break; + case RendererMeshContext::COUNTER_CLOCKWISE: + glFrontFace( GL_CCW ); + glCullFace( GL_BACK ); + glEnable( GL_CULL_FACE ); + break; + case RendererMeshContext::NONE: + glDisable( GL_CULL_FACE ); + break; + default: + RENDERER_ASSERT(0, "Invalid Cull Mode"); + } + + switch(context.fillMode) + { + case RendererMeshContext::SOLID: + glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); + break; + case RendererMeshContext::LINE: + glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); + break; + case RendererMeshContext::POINT: + glPolygonMode(GL_FRONT_AND_BACK, GL_POINT); + break; + } + + +#if defined(RENDERER_ENABLE_CG) + GLfloat glmodel[16]; + PxToGL(glmodel, model); + if(m_cgEnv.modelMatrix) cgGLSetMatrixParameterfc(m_cgEnv.modelMatrix, glmodel); + if(m_cgEnv.modelViewMatrix) cgGLSetMatrixParameterfc(m_cgEnv.modelViewMatrix, glmodelview); + + RENDERER_ASSERT(context.numBones <= RENDERER_MAX_BONES, "Too many bones."); + if(context.boneMatrices && context.numBones>0 && context.numBones <= RENDERER_MAX_BONES) + { +#if 0 + for(PxU32 i=0; i<context.numBones; i++) + { + GLfloat glbonematrix[16]; + PxToGL(glbonematrix, context.boneMatrices[i]); + cgSetMatrixParameterfc(cgGetArrayParameter(m_cgEnv.boneMatrices, i), glbonematrix); + } +#else + GLfloat glbonematrix[16*RENDERER_MAX_BONES]; + for(PxU32 i=0; i<context.numBones; i++) + { + PxToGL(glbonematrix+(16*i), context.boneMatrices[i]); + } + +#if defined(RENDERER_PS3) + OGLRendererMaterial* pMaterial = (OGLRendererMaterial*)context.material; + if( pMaterial ) + { + CGprogram program = pMaterial->GetVertexProgramPS3(); + cgGLSetMatrixParameterArrayfc(cgGetNamedParameter(program, "g_" "boneMatrices"), + 0, context.numBones, glbonematrix); + } +#else + { + PX_PROFILE_ZONE("cgGLSetMatrixParameter",0); + cgGLSetMatrixParameterArrayfc(m_cgEnv.boneMatrices, 0, context.numBones, glbonematrix); + } +#endif +#endif + } + +#endif + } + + void OGLRenderer::beginMultiPass(void) + { + glEnable(GL_BLEND); + glBlendFunc(GL_ONE, GL_ONE); + glDepthFunc(GL_EQUAL); + } + + void OGLRenderer::endMultiPass(void) + { + glDisable(GL_BLEND); + glDepthFunc(GL_LESS); + } + + void OGLRenderer::beginTransparentMultiPass(void) + { + setEnableBlendingOverride(true); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE); + glDepthFunc(GL_LEQUAL); + glDepthMask(false); + } + + void OGLRenderer::endTransparentMultiPass(void) + { + setEnableBlendingOverride(false); + glDisable(GL_BLEND); + glDepthFunc(GL_LESS); + glDepthMask(true); + } + + void OGLRenderer::renderDeferredLight(const RendererLight &/*light*/) + { + RENDERER_ASSERT(0, "Not implemented!"); + } + + PxU32 OGLRenderer::convertColor(const RendererColor& color) const + { + return OGLRendererVertexBuffer::convertColor(color); + } + + + bool OGLRenderer::isOk(void) const + { + bool ok = true; + ok = m_platform->isContextValid(); + return ok; + } + + /////////////////////////////////////////////////////////////////////////////// + + /*static DWORD gCullMode; + static DWORD gAlphaBlendEnable; + static DWORD gSrcBlend; + static DWORD gDstBlend; + static DWORD gFillMode; + static DWORD gZWrite; + static DWORD gLighting; + */ + + void OGLRenderer::setupTextRenderStates() + { + /* // PT: save render states. Let's just hope this isn't a pure device, else the Get method won't work + m_d3dDevice->GetRenderState(D3DRS_CULLMODE, &gCullMode); + m_d3dDevice->GetRenderState(D3DRS_ALPHABLENDENABLE, &gAlphaBlendEnable); + m_d3dDevice->GetRenderState(D3DRS_SRCBLEND, &gSrcBlend); + m_d3dDevice->GetRenderState(D3DRS_DESTBLEND, &gDstBlend); + m_d3dDevice->GetRenderState(D3DRS_FILLMODE, &gFillMode); + m_d3dDevice->GetRenderState(D3DRS_ZWRITEENABLE, &gZWrite); + m_d3dDevice->GetRenderState(D3DRS_LIGHTING, &gLighting); + + // PT: setup render states for text rendering + m_d3dDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE); + m_d3dDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE); + m_d3dDevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA); + m_d3dDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA); + m_d3dDevice->SetRenderState(D3DRS_FILLMODE, D3DFILL_SOLID); + m_d3dDevice->SetRenderState(D3DRS_ZWRITEENABLE, FALSE); + m_d3dDevice->SetRenderState(D3DRS_LIGHTING, FALSE);*/ + + glDisable(GL_CULL_FACE); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); + glDepthMask(false); + glDisable(GL_LIGHTING); + glEnable(GL_TEXTURE_2D); + glDisable(GL_DEPTH_TEST); + } + + void OGLRenderer::resetTextRenderStates() + { + glEnable(GL_CULL_FACE); + glDisable(GL_BLEND); + // glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); + glDepthMask(true); + glEnable(GL_LIGHTING); + glDisable(GL_TEXTURE_2D); + glEnable(GL_DEPTH_TEST); + } + + void OGLRenderer::renderTextBuffer(const void* verts, PxU32 nbVerts, const PxU16* indices, PxU32 nbIndices, RendererMaterial* material) + { + const int stride = sizeof(TextVertex); + char* data = (char*)verts; + + glEnableClientState(GL_VERTEX_ARRAY); + glDisableClientState(GL_NORMAL_ARRAY); + glEnableClientState(GL_COLOR_ARRAY); + glEnableClientState(GL_TEXTURE_COORD_ARRAY); + + // pos + glVertexPointer(3, GL_FLOAT, stride, data); + data += 3*sizeof(float); + + // rhw + PxU32 width, height; + getWindowSize(width, height); + + glMatrixMode(GL_PROJECTION); + glPushMatrix(); + glLoadIdentity(); + glOrtho(0, width, height, 0, -1, 1); + glMatrixMode(GL_MODELVIEW); + glPushMatrix(); + glLoadIdentity(); + data += sizeof(float); + + // Diffuse color + glColorPointer(4, GL_UNSIGNED_BYTE, stride, data); + data += sizeof(int); + + // Texture coordinates + glTexCoordPointer(2, GL_FLOAT, stride, data); + data += 2*sizeof(float); + + glDrawRangeElements(GL_TRIANGLES, 0, nbVerts, nbIndices, GL_UNSIGNED_SHORT, indices); + + glPopMatrix(); + glMatrixMode(GL_PROJECTION); + glPopMatrix(); + glMatrixMode(GL_MODELVIEW); + + glDisableClientState(GL_VERTEX_ARRAY); + glDisableClientState(GL_COLOR_ARRAY); + glDisableClientState(GL_TEXTURE_COORD_ARRAY); + } + + void OGLRenderer::renderLines2D(const void* vertices, PxU32 nbVerts) + { + const int stride = sizeof(TextVertex); + char* data = (char*)vertices; + + glEnableClientState(GL_VERTEX_ARRAY); + glDisableClientState(GL_NORMAL_ARRAY); + glEnableClientState(GL_COLOR_ARRAY); + glEnableClientState(GL_TEXTURE_COORD_ARRAY); + + // pos + glVertexPointer(3, GL_FLOAT, stride, data); + data += 3*sizeof(float); + + // rhw + PxU32 width, height; + getWindowSize(width, height); + + glMatrixMode(GL_PROJECTION); + glPushMatrix(); + glLoadIdentity(); + glOrtho(0, width, height, 0, -1, 1); + glMatrixMode(GL_MODELVIEW); + glPushMatrix(); + glLoadIdentity(); + data += sizeof(float); + + // Diffuse color + glColorPointer(4, GL_UNSIGNED_BYTE, stride, data); + data += sizeof(int); + + // Texture coordinates + glTexCoordPointer(2, GL_FLOAT, stride, data); + data += 2*sizeof(float); + + glDrawArrays(GL_LINE_STRIP, 0, nbVerts); + + glPopMatrix(); + glMatrixMode(GL_PROJECTION); + glPopMatrix(); + glMatrixMode(GL_MODELVIEW); + + glDisableClientState(GL_VERTEX_ARRAY); + glDisableClientState(GL_COLOR_ARRAY); + glDisableClientState(GL_TEXTURE_COORD_ARRAY); + } + + void OGLRenderer::setupScreenquadRenderStates() + { + glDisable(GL_CULL_FACE); + glEnable(GL_BLEND); + glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); + glDepthMask(false); + glDisable(GL_LIGHTING); + } + + void OGLRenderer::resetScreenquadRenderStates() + { + glEnable(GL_CULL_FACE); + glDisable(GL_BLEND); + glDepthMask(true); + glEnable(GL_LIGHTING); + } + +#pragma pack(push,2) + typedef struct + { + unsigned short bfType; + unsigned int bfSize; + unsigned short bfReserved1; + unsigned short bfReserved2; + unsigned int bfOffBits; + } PXT_BITMAPFILEHEADER; +#pragma pack(pop) + typedef struct _tagBITMAPINFO + { + struct + { + GLuint biSize; + GLuint biWidth; + GLuint biHeight; + GLushort biPlanes; + GLushort biBitCount; + GLuint biCompression; + GLuint biSizeImage; + GLuint biXPelsPerMeter; + GLuint biYPelsPerMeter; + GLuint biClrUsed; + GLuint biClrImportant; + } bmiHeader; + unsigned int bmiColors[1]; + } PXT_BITMAPINFO; + + static inline PxU32 screenshotDataOffset() + { + return sizeof(PXT_BITMAPFILEHEADER) + sizeof(PXT_BITMAPINFO); + } + static inline PxU32 screenshotSize(PxU32 width, PxU32 height) + { + return width * height * 4 *sizeof(GLubyte) + screenshotDataOffset(); + } + + bool OGLRenderer::captureScreen(PxU32 &width, PxU32& height, PxU32& sizeInBytes, const void*& screenshotData) + { + // Target buffer size + const PxU32 newBufferSize = screenshotSize(m_displayWidth, m_displayHeight); + + // Resize of necessary + if (newBufferSize != (PxU32)m_displayData.size()) + m_displayData.resize(newBufferSize); + + // Quit if resize failed + if (newBufferSize != (PxU32)m_displayData.size()) + return false; + + // Write the screen data into the buffer + glPixelStorei(GL_UNPACK_ALIGNMENT, 4); + glReadPixels(0, 0, m_displayWidth, m_displayHeight, GL_RGBA, GL_UNSIGNED_BYTE, &m_displayData[screenshotDataOffset()]); + if (GL_NO_ERROR != glGetError()) + return false; + + // Write the header data into the buffer + PXT_BITMAPFILEHEADER bitmapFileHeader; + PXT_BITMAPINFO bitmapInfoHeader; + + bitmapFileHeader.bfType = 0x4D42; //"BM" + bitmapFileHeader.bfReserved1 = 0; + bitmapFileHeader.bfReserved2 = 0; + bitmapFileHeader.bfOffBits = sizeof(PXT_BITMAPFILEHEADER) + sizeof(bitmapInfoHeader.bmiHeader); + bitmapFileHeader.bfSize = m_displayWidth * m_displayHeight * 4 + bitmapFileHeader.bfOffBits; + + bitmapInfoHeader.bmiHeader.biSize = sizeof(bitmapInfoHeader.bmiHeader); + bitmapInfoHeader.bmiHeader.biWidth = m_displayWidth; + bitmapInfoHeader.bmiHeader.biHeight = m_displayHeight; + bitmapInfoHeader.bmiHeader.biPlanes = 1; + bitmapInfoHeader.bmiHeader.biBitCount = 32; + bitmapInfoHeader.bmiHeader.biCompression = 0 /*BI_RGB*/; + bitmapInfoHeader.bmiHeader.biSizeImage = 0; + bitmapInfoHeader.bmiHeader.biXPelsPerMeter = 0; + bitmapInfoHeader.bmiHeader.biYPelsPerMeter = 0; + bitmapInfoHeader.bmiHeader.biClrUsed = 0; + bitmapInfoHeader.bmiHeader.biClrImportant = 0; + + memcpy(&m_displayData[0], &bitmapFileHeader, sizeof(bitmapFileHeader)); + memcpy(&m_displayData[sizeof(bitmapFileHeader)], &bitmapInfoHeader.bmiHeader, sizeof(bitmapInfoHeader.bmiHeader)); + + // Output the result + getWindowSize(width, height); + sizeInBytes = (PxU32)m_displayData.size(); + screenshotData = &m_displayData[0]; + + return true; + } + +#endif // #if defined(RENDERER_ENABLE_OPENGL) diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/ogl/OGLRenderer.h b/PhysX_3.4/Samples/SampleFramework/renderer/src/ogl/OGLRenderer.h new file mode 100644 index 00000000..afd18693 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/ogl/OGLRenderer.h @@ -0,0 +1,189 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#ifndef OGL_RENDERER_H +#define OGL_RENDERER_H + +#include <RendererConfig.h> + +#if defined(RENDERER_ENABLE_OPENGL) +#include <GLIncludes.h> + +#if defined(RENDERER_ENABLE_CG) + #include <Cg/cg.h> + #include <Cg/cgGL.h> +#endif + +#include <Renderer.h> + +namespace SampleFramework { + class SamplePlatform; +} + +namespace SampleRenderer +{ + +#if defined(RENDERER_ENABLE_CG) + void setColorParameter(CGparameter param, const RendererColor &color); + void setFloat4Parameter(CGparameter param, float* values); +#endif + + class OGLRendererMaterial; + + + void PxToGL(GLfloat *gl44, const physx::PxMat44 &mat); + void RenToGL(GLfloat *gl44, const RendererProjection &proj); + + class OGLRenderer : public Renderer + { + public: + OGLRenderer(const RendererDesc &desc, const char* assetDir); + virtual ~OGLRenderer(void); + +#if defined(RENDERER_ENABLE_CG) + class CGEnvironment + { + public: + CGparameter modelMatrix; + CGparameter viewMatrix; + CGparameter projMatrix; + CGparameter modelViewMatrix; + CGparameter modelViewProjMatrix; + + CGparameter boneMatrices; + + CGparameter fogColorAndDistance; + + CGparameter eyePosition; + CGparameter eyeDirection; + + CGparameter ambientColor; + + CGparameter lightColor; + CGparameter lightIntensity; + CGparameter lightDirection; + CGparameter lightPosition; + CGparameter lightInnerRadius; + CGparameter lightOuterRadius; + CGparameter lightInnerCone; + CGparameter lightOuterCone; + + public: + CGEnvironment(void); + CGEnvironment(CGcontext cgContext); + }; + + CGcontext getCGContext(void) { return m_cgContext; } + CGEnvironment &getCGEnvironment(void) { return m_cgEnv; } + const CGEnvironment &getCGEnvironment(void) const { return m_cgEnv; } +#endif + + const physx::PxMat44 &getViewMatrix(void) const { return m_viewMatrix; } + + void setCurrentMaterial(const OGLRendererMaterial *cm) { m_currMaterial = cm; } + const OGLRendererMaterial *getCurrentMaterial(void) { return m_currMaterial; } + + private: + bool begin(void); + void end(void); + void checkResize(void); + + public: + // clears the offscreen buffers. + virtual void clearBuffers(void); + + // presents the current color buffer to the screen. + // returns true on device reset and if buffers need to be rewritten. + virtual bool swapBuffers(void); + + // get the device pointer (void * abstraction) + virtual void *getDevice() { return static_cast<void*>(getCGContext()); } + + virtual bool captureScreen(const char* ) { PX_ASSERT("not supported"); return false; } + + // gets a handle to the current frame's data, in bitmap format + // note: subsequent calls will invalidate any previously returned data + // return true on successful screenshot capture + virtual bool captureScreen(PxU32 &width, PxU32& height, PxU32& sizeInBytes, const void*& screenshotData); + + // get the window size + void getWindowSize(PxU32 &width, PxU32 &height) const; + + virtual RendererVertexBuffer *createVertexBuffer( const RendererVertexBufferDesc &desc); + virtual RendererIndexBuffer *createIndexBuffer( const RendererIndexBufferDesc &desc); + virtual RendererInstanceBuffer *createInstanceBuffer(const RendererInstanceBufferDesc &desc); + virtual RendererTexture2D *createTexture2D( const RendererTexture2DDesc &desc); + virtual RendererTexture3D *createTexture3D( const RendererTexture3DDesc &desc); + virtual RendererTarget *createTarget( const RendererTargetDesc &desc); + virtual RendererMaterial *createMaterial( const RendererMaterialDesc &desc); + virtual RendererMesh *createMesh( const RendererMeshDesc &desc); + virtual RendererLight *createLight( const RendererLightDesc &desc); + + virtual void setVsync(bool on); + + private: + virtual void bindViewProj(const physx::PxMat44 &inveye, const RendererProjection &proj); + virtual void bindAmbientState(const RendererColor &ambientColor); + virtual void bindFogState(const RendererColor &fogColor, float fogDistance); + virtual void bindDeferredState(void); + virtual void bindMeshContext(const RendererMeshContext &context); + virtual void beginMultiPass(void); + virtual void endMultiPass(void); + virtual void beginTransparentMultiPass(void); + virtual void endTransparentMultiPass(void); + virtual void renderDeferredLight(const RendererLight &light); + virtual PxU32 convertColor(const RendererColor& color) const; + + virtual bool isOk(void) const; + + virtual void setupTextRenderStates(); + virtual void resetTextRenderStates(); + virtual void renderTextBuffer(const void* vertices, PxU32 nbVerts, const PxU16* indices, PxU32 nbIndices, RendererMaterial* material); + virtual void renderLines2D(const void* vertices, PxU32 nbVerts); + virtual void setupScreenquadRenderStates(); + virtual void resetScreenquadRenderStates(); + + private: + SampleFramework::SamplePlatform* m_platform; +#if defined(RENDERER_ENABLE_CG) + CGcontext m_cgContext; + CGEnvironment m_cgEnv; +#endif + + const OGLRendererMaterial *m_currMaterial; + + PxU32 m_displayWidth; + PxU32 m_displayHeight; + + std::vector<GLubyte> m_displayData; + + physx::PxMat44 m_viewMatrix; + }; + +} // namespace SampleRenderer + +#endif // #if defined(RENDERER_ENABLE_OPENGL) +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/ogl/OGLRendererDirectionalLight.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/ogl/OGLRendererDirectionalLight.cpp new file mode 100644 index 00000000..4301033d --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/ogl/OGLRendererDirectionalLight.cpp @@ -0,0 +1,58 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#include <RendererConfig.h> + +#if defined(RENDERER_ENABLE_OPENGL) + +#include "OGLRendererDirectionalLight.h" + +using namespace SampleRenderer; + +OGLRendererDirectionalLight::OGLRendererDirectionalLight(const RendererDirectionalLightDesc &desc, OGLRenderer &renderer) +: RendererDirectionalLight(desc) +#if defined(RENDERER_ENABLE_CG) +, m_cgenv(renderer.getCGEnvironment()) +#endif + +{ +} + +OGLRendererDirectionalLight::~OGLRendererDirectionalLight(void) +{ +} + +void OGLRendererDirectionalLight::bind(void) const +{ +#if defined(RENDERER_ENABLE_CG) + setColorParameter(m_cgenv.lightColor, m_color); + cgSetParameter1f( m_cgenv.lightIntensity, m_intensity); + cgSetParameter3fv(m_cgenv.lightDirection, &m_direction.x); +#endif +} + +#endif // #if defined(RENDERER_ENABLE_OPENGL) diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/ogl/OGLRendererDirectionalLight.h b/PhysX_3.4/Samples/SampleFramework/renderer/src/ogl/OGLRendererDirectionalLight.h new file mode 100644 index 00000000..cefad68f --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/ogl/OGLRendererDirectionalLight.h @@ -0,0 +1,60 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#ifndef OGL_RENDERER_DIRECTIONAL_LIGHT_H +#define OGL_RENDERER_DIRECTIONAL_LIGHT_H + +#include <RendererConfig.h> + +#if defined(RENDERER_ENABLE_OPENGL) + +#include <RendererDirectionalLight.h> + +#include "OGLRenderer.h" + +namespace SampleRenderer +{ + + class RendererDirectionalLightDesc; + + class OGLRendererDirectionalLight : public RendererDirectionalLight + { + public: + OGLRendererDirectionalLight(const RendererDirectionalLightDesc &desc, OGLRenderer &renderer); + virtual ~OGLRendererDirectionalLight(void); + + virtual void bind(void) const; + + private: +#if defined(RENDERER_ENABLE_CG) + const OGLRenderer::CGEnvironment &m_cgenv; +#endif + }; + +} // namespace SampleRenderer + +#endif // #if defined(RENDERER_ENABLE_OPENGL) +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/ogl/OGLRendererIndexBuffer.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/ogl/OGLRendererIndexBuffer.cpp new file mode 100644 index 00000000..4dda7229 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/ogl/OGLRendererIndexBuffer.cpp @@ -0,0 +1,138 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#include <RendererConfig.h> + +#if defined(RENDERER_ENABLE_OPENGL) + +#include "OGLRendererIndexBuffer.h" +#include <RendererIndexBufferDesc.h> + +#if PX_WINDOWS +#include "cudamanager/PxCudaContextManager.h" +#endif + +using namespace SampleRenderer; + +OGLRendererIndexBuffer::OGLRendererIndexBuffer(const RendererIndexBufferDesc &desc) : + RendererIndexBuffer(desc) +{ + m_indexSize = getFormatByteSize(getFormat()); + + RENDERER_ASSERT(GLEW_ARB_vertex_buffer_object, "Vertex Buffer Objects not supported on this machine!"); + if(GLEW_ARB_vertex_buffer_object) + { + RENDERER_ASSERT(desc.maxIndices > 0, "Cannot create zero size Index Buffer."); + if(desc.maxIndices > 0) + { + GLenum usage = GL_STATIC_DRAW_ARB; + if(getHint() == HINT_DYNAMIC) + { + usage = GL_DYNAMIC_DRAW_ARB; + } + + glGenBuffersARB(1, &m_ibo); + RENDERER_ASSERT(m_ibo, "Failed to create Index Buffer."); + if(m_ibo) + { + m_maxIndices = desc.maxIndices; + const PxU32 bufferSize = m_indexSize * m_maxIndices; + + glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, m_ibo); + glBufferDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, bufferSize, 0, usage); + glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0); + +#if PX_WINDOWS + if(m_interopContext && m_mustBeRegisteredInCUDA) + { + m_registeredInCUDA = m_interopContext->registerResourceInCudaGL(m_InteropHandle, (PxU32) m_ibo); + } +#endif + } + } + } +} + +OGLRendererIndexBuffer::~OGLRendererIndexBuffer(void) +{ + if(m_ibo) + { +#if PX_WINDOWS + if(m_registeredInCUDA) + { + m_interopContext->unregisterResourceInCuda(m_InteropHandle); + } +#endif + glDeleteBuffersARB(1, &m_ibo); + } +} + +void *OGLRendererIndexBuffer::lock(void) +{ + void *buffer = 0; + if(m_ibo) + { + glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, m_ibo); + buffer = glMapBuffer(GL_ELEMENT_ARRAY_BUFFER_ARB, GL_READ_WRITE); + glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0); + } + return buffer; +} + +void OGLRendererIndexBuffer::unlock(void) +{ + if(m_ibo) + { + glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, m_ibo); + glUnmapBuffer(GL_ELEMENT_ARRAY_BUFFER_ARB); + glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0); + } +} + +void OGLRendererIndexBuffer::bind(void) const +{ + if(m_ibo) + { +#if !defined(RENDERER_PS3) + glEnableClientState(GL_INDEX_ARRAY); +#endif + glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, m_ibo); + } +} + +void OGLRendererIndexBuffer::unbind(void) const +{ + if(m_ibo) + { + glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0); +#if !defined(RENDERER_PS3) + glDisableClientState(GL_INDEX_ARRAY); +#endif + } +} + +#endif // #if defined(RENDERER_ENABLE_OPENGL) diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/ogl/OGLRendererIndexBuffer.h b/PhysX_3.4/Samples/SampleFramework/renderer/src/ogl/OGLRendererIndexBuffer.h new file mode 100644 index 00000000..84e24b15 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/ogl/OGLRendererIndexBuffer.h @@ -0,0 +1,62 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#ifndef OGL_RENDERER_INDEXBUFFER_H +#define OGL_RENDERER_INDEXBUFFER_H + +#include <RendererConfig.h> + +#if defined(RENDERER_ENABLE_OPENGL) + +#include <RendererIndexBuffer.h> +#include "OGLRenderer.h" + +namespace SampleRenderer +{ + + class OGLRendererIndexBuffer : public RendererIndexBuffer + { + public: + OGLRendererIndexBuffer(const RendererIndexBufferDesc &desc); + virtual ~OGLRendererIndexBuffer(void); + + public: + virtual void *lock(void); + virtual void unlock(void); + + private: + virtual void bind(void) const; + virtual void unbind(void) const; + + private: + GLuint m_ibo; + PxU32 m_indexSize; + }; + +} // namespace SampleRenderer + +#endif // #if defined(RENDERER_ENABLE_OPENGL) +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/ogl/OGLRendererInstanceBuffer.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/ogl/OGLRendererInstanceBuffer.cpp new file mode 100644 index 00000000..738a439c --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/ogl/OGLRendererInstanceBuffer.cpp @@ -0,0 +1,92 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#include <RendererConfig.h> + +#if defined(RENDERER_ENABLE_OPENGL) + +#include "OGLRendererInstanceBuffer.h" +#include <RendererInstanceBufferDesc.h> + +using namespace SampleRenderer; + +OGLRendererInstanceBuffer::OGLRendererInstanceBuffer(const RendererInstanceBufferDesc &desc) : + RendererInstanceBuffer(desc) +{ + m_bufferSize = (PxU32)(desc.maxInstances * m_stride); + m_buffer = malloc(m_bufferSize);//PX_ALLOC(m_bufferSize); + m_maxInstances = desc.maxInstances; +} + +OGLRendererInstanceBuffer::~OGLRendererInstanceBuffer(void) +{ + if(m_buffer) free(m_buffer);//PX_FREE(m_buffer); +} + +physx::PxMat44 OGLRendererInstanceBuffer::getModelMatrix(PxU32 index) const +{ + physx::PxMat44 model = PxMat44(PxIdentity); + if(index < m_maxInstances) + { + const void *instance = ((PxU8*)m_buffer)+(m_stride*index); + PxVec3 column0 = getInstanceColumn(instance, m_semanticDescs[SEMANTIC_NORMALX]); + PxVec3 column1 = getInstanceColumn(instance, m_semanticDescs[SEMANTIC_NORMALY]); + PxVec3 column2 = getInstanceColumn(instance, m_semanticDescs[SEMANTIC_NORMALZ]); + PxVec3 column3 = getInstanceColumn(instance, m_semanticDescs[SEMANTIC_POSITION]); + + model = PxMat44(column0, column1, column2, column3); + } + return model; +} + +PxVec3 OGLRendererInstanceBuffer::getInstanceColumn(const void *instance, const OGLRendererInstanceBuffer::SemanticDesc &sd) const +{ + PxVec3 col = *(PxVec3*)(((PxU8*)instance)+sd.offset); + return col; +} + +void *OGLRendererInstanceBuffer::lock(void) +{ + return m_buffer; +} + +void OGLRendererInstanceBuffer::unlock(void) +{ + +} + +void OGLRendererInstanceBuffer::bind(PxU32 streamID, PxU32 firstInstance) const +{ + +} + +void OGLRendererInstanceBuffer::unbind(PxU32 streamID) const +{ + +} + +#endif // #if defined(RENDERER_ENABLE_OPENGL) diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/ogl/OGLRendererInstanceBuffer.h b/PhysX_3.4/Samples/SampleFramework/renderer/src/ogl/OGLRendererInstanceBuffer.h new file mode 100644 index 00000000..f6ac259b --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/ogl/OGLRendererInstanceBuffer.h @@ -0,0 +1,67 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#ifndef OGL_RENDERER_INSTANCEBUFFER_H +#define OGL_RENDERER_INSTANCEBUFFER_H + +#include <RendererConfig.h> + +#if defined(RENDERER_ENABLE_OPENGL) + +#include <RendererInstanceBuffer.h> +#include "OGLRenderer.h" + +namespace SampleRenderer +{ + + class OGLRendererInstanceBuffer : public RendererInstanceBuffer + { + public: + OGLRendererInstanceBuffer(const RendererInstanceBufferDesc &desc); + virtual ~OGLRendererInstanceBuffer(void); + + physx::PxMat44 getModelMatrix(PxU32 index) const; + + private: + PxVec3 getInstanceColumn(const void *instance, const OGLRendererInstanceBuffer::SemanticDesc &sd) const; + + public: + + virtual void *lock(void); + virtual void unlock(void); + + virtual void bind(PxU32 streamID, PxU32 firstInstance) const; + virtual void unbind(PxU32 streamID) const; + + private: + PxU32 m_bufferSize; + void *m_buffer; + }; + +} // namespace SampleRenderer + +#endif // #if defined(RENDERER_ENABLE_OPENGL) +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/ogl/OGLRendererMaterial.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/ogl/OGLRendererMaterial.cpp new file mode 100644 index 00000000..fa84492c --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/ogl/OGLRendererMaterial.cpp @@ -0,0 +1,518 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#include "RendererConfig.h" + +#if defined(RENDERER_ENABLE_OPENGL) + +#include "OGLRendererMaterial.h" +#include "OGLRendererTexture2D.h" + +#include <RendererMaterialDesc.h> + +#include <SamplePlatform.h> + +#include <stdio.h> + +// for PsString.h +namespace physx +{ + namespace string + {} +} +#include <PsString.h> +#include <PxTkFile.h> +namespace Ps = physx::shdfnd; + +using namespace SampleRenderer; + +#if defined(RENDERER_ENABLE_CG) + +static RendererMaterial::VariableType getVariableType(CGtype cgt) +{ + RendererMaterial::VariableType vt = RendererMaterial::NUM_VARIABLE_TYPES; + switch(cgt) + { + case CG_INT: vt = RendererMaterial::VARIABLE_INT; break; + case CG_FLOAT: vt = RendererMaterial::VARIABLE_FLOAT; break; + case CG_FLOAT2: vt = RendererMaterial::VARIABLE_FLOAT2; break; + case CG_FLOAT3: vt = RendererMaterial::VARIABLE_FLOAT3; break; + case CG_FLOAT4: vt = RendererMaterial::VARIABLE_FLOAT4; break; + case CG_FLOAT4x4: vt = RendererMaterial::VARIABLE_FLOAT4x4; break; + case CG_SAMPLER2D: vt = RendererMaterial::VARIABLE_SAMPLER2D; break; + case CG_SAMPLER3D: vt = RendererMaterial::VARIABLE_SAMPLER3D; break; + default: break; + } + RENDERER_ASSERT(vt < RendererMaterial::NUM_VARIABLE_TYPES, "Unable to convert shader parameter type."); + return vt; +} + +static GLuint getGLBlendFunc(RendererMaterial::BlendFunc func) +{ + GLuint glfunc = 0; + switch(func) + { + case RendererMaterial::BLEND_ZERO: glfunc = GL_ZERO; break; + case RendererMaterial::BLEND_ONE: glfunc = GL_ONE; break; + case RendererMaterial::BLEND_SRC_COLOR: glfunc = GL_SRC_COLOR; break; + case RendererMaterial::BLEND_ONE_MINUS_SRC_COLOR: glfunc = GL_ONE_MINUS_SRC_COLOR; break; + case RendererMaterial::BLEND_SRC_ALPHA: glfunc = GL_SRC_ALPHA; break; + case RendererMaterial::BLEND_ONE_MINUS_SRC_ALPHA: glfunc = GL_ONE_MINUS_SRC_ALPHA; break; + case RendererMaterial::BLEND_DST_ALPHA: glfunc = GL_DST_COLOR; break; + case RendererMaterial::BLEND_ONE_MINUS_DST_ALPHA: glfunc = GL_ONE_MINUS_DST_ALPHA; break; + case RendererMaterial::BLEND_DST_COLOR: glfunc = GL_DST_COLOR; break; + case RendererMaterial::BLEND_ONE_MINUS_DST_COLOR: glfunc = GL_ONE_MINUS_DST_COLOR; break; + case RendererMaterial::BLEND_SRC_ALPHA_SATURATE: glfunc = GL_SRC_ALPHA_SATURATE; break; + default: break; + } + RENDERER_ASSERT(glfunc, "Unable to convert Material Blend Func."); + return glfunc; +} + +static void connectParameters(CGparameter from, CGparameter to) +{ + if(from && to) cgConnectParameter(from, to); +} + +static void connectEnvParameters(const OGLRenderer::CGEnvironment &cgEnv, CGprogram program) +{ + connectParameters(cgEnv.modelMatrix, cgGetNamedParameter(program, "g_" "modelMatrix")); + connectParameters(cgEnv.viewMatrix, cgGetNamedParameter(program, "g_" "viewMatrix")); + connectParameters(cgEnv.projMatrix, cgGetNamedParameter(program, "g_" "projMatrix")); + connectParameters(cgEnv.modelViewMatrix, cgGetNamedParameter(program, "g_" "modelViewMatrix")); + connectParameters(cgEnv.modelViewProjMatrix, cgGetNamedParameter(program, "g_" "modelViewProjMatrix")); + + +#if !defined(RENDERER_PS3) + connectParameters(cgEnv.boneMatrices, cgGetNamedParameter(program, "g_" "boneMatrices")); +#endif + connectParameters(cgEnv.eyePosition, cgGetNamedParameter(program, "g_" "eyePosition")); + connectParameters(cgEnv.eyeDirection, cgGetNamedParameter(program, "g_" "eyeDirection")); + + connectParameters(cgEnv.fogColorAndDistance, cgGetNamedParameter(program, "g_" "fogColorAndDistance")); + + connectParameters(cgEnv.ambientColor, cgGetNamedParameter(program, "g_" "ambientColor")); + + connectParameters(cgEnv.lightColor, cgGetNamedParameter(program, "g_" "lightColor")); + connectParameters(cgEnv.lightIntensity, cgGetNamedParameter(program, "g_" "lightIntensity")); + connectParameters(cgEnv.lightDirection, cgGetNamedParameter(program, "g_" "lightDirection")); + connectParameters(cgEnv.lightPosition, cgGetNamedParameter(program, "g_" "lightPosition")); + connectParameters(cgEnv.lightInnerRadius, cgGetNamedParameter(program, "g_" "lightInnerRadius")); + connectParameters(cgEnv.lightOuterRadius, cgGetNamedParameter(program, "g_" "lightOuterRadius")); + connectParameters(cgEnv.lightInnerCone, cgGetNamedParameter(program, "g_" "lightInnerCone")); + connectParameters(cgEnv.lightOuterCone, cgGetNamedParameter(program, "g_" "lightOuterCone")); +} + +OGLRendererMaterial::CGVariable::CGVariable(const char *name, VariableType type, PxU32 offset) : + Variable(name, type, offset) +{ + m_vertexHandle = 0; + memset(m_fragmentHandles, 0, sizeof(m_fragmentHandles)); +} + +OGLRendererMaterial::CGVariable::~CGVariable(void) +{ + +} + +void OGLRendererMaterial::CGVariable::addVertexHandle(CGparameter handle) +{ + m_vertexHandle = handle; +} + +void OGLRendererMaterial::CGVariable::addFragmentHandle(CGparameter handle, Pass pass) +{ + m_fragmentHandles[pass] = handle; +} + +#endif + +OGLRendererMaterial::OGLRendererMaterial(OGLRenderer &renderer, const RendererMaterialDesc &desc) : + RendererMaterial(desc, renderer.getEnableMaterialCaching()), + m_renderer(renderer) +{ + m_glAlphaTestFunc = GL_ALWAYS; + + AlphaTestFunc alphaTestFunc = getAlphaTestFunc(); + switch(alphaTestFunc) + { + case ALPHA_TEST_ALWAYS: m_glAlphaTestFunc = GL_ALWAYS; break; + case ALPHA_TEST_EQUAL: m_glAlphaTestFunc = GL_EQUAL; break; + case ALPHA_TEST_NOT_EQUAL: m_glAlphaTestFunc = GL_NOTEQUAL; break; + case ALPHA_TEST_LESS: m_glAlphaTestFunc = GL_LESS; break; + case ALPHA_TEST_LESS_EQUAL: m_glAlphaTestFunc = GL_LEQUAL; break; + case ALPHA_TEST_GREATER: m_glAlphaTestFunc = GL_GREATER; break; + case ALPHA_TEST_GREATER_EQUAL: m_glAlphaTestFunc = GL_GEQUAL; break; + default: + RENDERER_ASSERT(0, "Unknown Alpha Test Func."); + } + +#if defined(RENDERER_ENABLE_CG) + m_vertexProgram = 0; +#if defined(RENDERER_PS3) + m_vertexProfile = getVertexProfile(); + m_fragmentProfile = getFragmentProfile(); +#else +#define NO_SUPPORT_DDX_DDY +#if 0 + // JD: CG_PROFILE_GPU_VP FAILS SO BAD! + m_vertexProfile = CG_PROFILE_ARBVP1; + m_fragmentProfile = CG_PROFILE_ARBVP1; +#else + // PH: Seems to work fine nowadays + m_vertexProfile = cgGLGetLatestProfile(CG_GL_VERTEX); + m_fragmentProfile = cgGLGetLatestProfile(CG_GL_FRAGMENT); +#endif +#endif + memset(m_fragmentPrograms, 0, sizeof(m_fragmentPrograms)); + + CGcontext cgContext = m_renderer.getCGContext(); + const OGLRenderer::CGEnvironment &cgEnv = m_renderer.getCGEnvironment(); + if(cgContext && m_vertexProfile && m_fragmentProfile) + { + char fullPath[1024] = "-I"; + Ps::strlcat(fullPath, 1024, m_renderer.getAssetDir()); + Ps::strlcat(fullPath, 1024, "shaders/include"); + const char *vertexEntry = "vmain"; + const char *vertexArgs[] = + { + fullPath, + "-DRENDERER_VERTEX", +#ifdef RENDERER_PS3 + "-DRENDERER_PS3", + "-melf", +#endif + 0, 0, + }; + + cgGLSetOptimalOptions(m_vertexProfile); + if(1) + { + PX_PROFILE_ZONE("OGLRendererMaterial_compile_vertexProgram",0); + m_vertexProgram = static_cast<CGprogram>(SampleFramework::SamplePlatform::platform()->compileProgram(cgContext, m_renderer.getAssetDir(), desc.vertexShaderPath, m_vertexProfile, 0, vertexEntry, vertexArgs)); + } + RENDERER_ASSERT(m_vertexProgram, "Failed to compile Vertex Shader."); + if(m_vertexProgram) + { + PX_PROFILE_ZONE("OGLRendererMaterial_load_vertexProgram",0); + connectEnvParameters(cgEnv, m_vertexProgram); + cgGLLoadProgram(m_vertexProgram); + loadCustomConstants(m_vertexProgram, NUM_PASSES); + } + else + { + char msg[1024]; + Ps::snprintf(msg, sizeof(msg), "Could not find shader file: <%s> in path: <%sshaders/>", desc.vertexShaderPath, m_renderer.getAssetDir()); + RENDERER_OUTPUT_MESSAGE(&m_renderer, msg); + } + + const char *fragmentEntry = "fmain"; + for(PxU32 i=0; i<NUM_PASSES; i++) + { + char passDefine[64] = {0}; + Ps::snprintf(passDefine, 63, "-D%s", getPassName((Pass)i)); + + char fvaceDefine[20] = "-DENABLE_VFACE=0"; +#if PX_WINDOWS + // Aparently the FACE semantic is only supported with fp40 + if (cgGLIsProfileSupported(CG_PROFILE_FP40)) + { + fvaceDefine[15] = '1'; + } +#endif + const char *fragmentArgs[] = + { + fullPath, + "-DRENDERER_FRAGMENT", + fvaceDefine, // used for double sided rendering (as done in D3D anyways) + "-DVFACE=FACE", // rename VFACE to FACE semantic, the first is only known to HLSL shaders... +#ifdef RENDERER_PS3 + "-DRENDERER_PS3", + "-melf", + "-DENABLE_VFACE", +#endif +#ifdef NO_SUPPORT_DDX_DDY + "-DNO_SUPPORT_DDX_DDY", +#endif + passDefine, + 0, 0, + }; + cgGLSetOptimalOptions(m_fragmentProfile); + CGprogram fp = 0; + if(1) + { + PX_PROFILE_ZONE("OGLRendererMaterial_compile_fragmentProgram",0); + fp = static_cast<CGprogram>(SampleFramework::SamplePlatform::platform()->compileProgram(cgContext, m_renderer.getAssetDir(), desc.fragmentShaderPath, m_fragmentProfile, getPassName((Pass)i), fragmentEntry, fragmentArgs)); + } + RENDERER_ASSERT(fp, "Failed to compile Fragment Shader."); + if(fp) + { + PX_PROFILE_ZONE("OGLRendererMaterial_load_fragmentProgram",0); + connectEnvParameters(cgEnv, fp); + cgGLLoadProgram(fp); + m_fragmentPrograms[i] = fp; + loadCustomConstants(fp, (Pass)i); + } + } + } +#endif +} + +OGLRendererMaterial::~OGLRendererMaterial(void) +{ +#if defined(RENDERER_ENABLE_CG) + if(m_vertexProgram) + { + cgDestroyProgram(m_vertexProgram); + } + for(PxU32 i=0; i<NUM_PASSES; i++) + { + CGprogram fp = m_fragmentPrograms[i]; + if(fp) + { + cgDestroyProgram(fp); + } + } +#endif +} + +void OGLRendererMaterial::bind(RendererMaterial::Pass pass, RendererMaterialInstance *materialInstance, bool instanced) const +{ + m_renderer.setCurrentMaterial(this); + + if(m_glAlphaTestFunc == GL_ALWAYS) + { + glDisable(GL_ALPHA_TEST); + } + else + { + glEnable(GL_ALPHA_TEST); + glAlphaFunc(m_glAlphaTestFunc, PxClamp(getAlphaTestRef(), 0.0f, 1.0f)); + } + + if(getBlending()) + { + glBlendFunc(getGLBlendFunc(getSrcBlendFunc()), getGLBlendFunc(getDstBlendFunc())); + glEnable(GL_BLEND); + glDepthMask(0); + } + +#if defined(RENDERER_ENABLE_CG) + if(m_vertexProgram) + { + cgGLEnableProfile(m_vertexProfile); + cgGLBindProgram(m_vertexProgram); +#if !defined(RENDERER_PS3) + cgUpdateProgramParameters(m_vertexProgram); +#endif + } + if(pass < NUM_PASSES && m_fragmentPrograms[pass]) + { + cgGLEnableProfile(m_fragmentProfile); + cgGLBindProgram(m_fragmentPrograms[pass]); + + RendererMaterial::bind(pass, materialInstance, instanced); + //this is a kludge to make the particles work. I see no way to set env's through this interface + glEnable(GL_POINT_SPRITE_ARB); + glTexEnvf(GL_POINT_SPRITE_ARB, GL_COORD_REPLACE_ARB, GL_TRUE); + glEnable(GL_VERTEX_PROGRAM_POINT_SIZE_ARB); + +#if !defined(RENDERER_PS3) + cgUpdateProgramParameters(m_fragmentPrograms[pass]); +#endif + } +#endif +} + +void OGLRendererMaterial::bindMeshState(bool instanced) const +{ +#if defined(RENDERER_ENABLE_CG) + if(m_vertexProgram) + { +#if defined(RENDERER_PS3) + cgGLBindProgram(m_vertexProgram); +#else + cgUpdateProgramParameters(m_vertexProgram); +#endif + } +#endif +} + +void OGLRendererMaterial::unbind(void) const +{ +#if defined(RENDERER_ENABLE_CG) + glTexEnvf(GL_POINT_SPRITE_ARB, GL_COORD_REPLACE_ARB, GL_FALSE); + glDisable(GL_POINT_SPRITE_ARB); + glDisable(GL_VERTEX_PROGRAM_POINT_SIZE_ARB); + + if(m_vertexProfile) + { + cgGLUnbindProgram(m_vertexProfile); + cgGLDisableProfile(m_vertexProfile); + } + if(m_fragmentProfile) + { + cgGLUnbindProgram(m_fragmentProfile); + cgGLDisableProfile(m_fragmentProfile); + } +#endif + + if(getBlending()) + { + glDisable(GL_BLEND); + glDepthMask(1); + } + + m_renderer.setCurrentMaterial(0); +} + +#if defined(RENDERER_ENABLE_CG) +template<class TextureType> +static void bindSamplerVariable(CGparameter param, RendererTexture2D &texture) +{ + TextureType &tex = *static_cast<TextureType*>(&texture); + if(param) + { + CGresource resource = cgGetParameterResource(param); + RENDERER_ASSERT(resource >= CG_TEXUNIT0 && resource <= CG_TEXUNIT15, "Invalid Texture Resource Location."); + if(resource >= CG_TEXUNIT0 && resource <= CG_TEXUNIT15) + { + tex.bind(resource-CG_TEXUNIT0); + } + } +} +#endif + +void OGLRendererMaterial::bindVariable(Pass pass, const Variable &variable, const void *data) const +{ +#if defined(RENDERER_ENABLE_CG) + CGVariable &var = *(CGVariable*)&variable; + switch(var.getType()) + { + case VARIABLE_FLOAT: + { + float f = *(const float*)data; + if(var.m_vertexHandle) cgGLSetParameter1f(var.m_vertexHandle, f); + if(var.m_fragmentHandles[pass]) cgGLSetParameter1f(var.m_fragmentHandles[pass], f); + break; + } + case VARIABLE_FLOAT2: + { + const float *f = (const float*)data; + if(var.m_vertexHandle) cgGLSetParameter2fv(var.m_vertexHandle, f); + if(var.m_fragmentHandles[pass]) cgGLSetParameter2fv(var.m_fragmentHandles[pass], f); + break; + } + case VARIABLE_FLOAT3: + { + const float *f = (const float*)data; + if(var.m_vertexHandle) cgGLSetParameter3fv(var.m_vertexHandle, f); + if(var.m_fragmentHandles[pass]) cgGLSetParameter3fv(var.m_fragmentHandles[pass], f); + break; + } + case VARIABLE_FLOAT4: + { + const float *f = (const float*)data; + if(var.m_vertexHandle) cgGLSetParameter4fv(var.m_vertexHandle, f); + if(var.m_fragmentHandles[pass]) cgGLSetParameter4fv(var.m_fragmentHandles[pass], f); + break; + } + case VARIABLE_SAMPLER2D: + data = *(void**)data; + RENDERER_ASSERT(data, "NULL Sampler."); + if(data) + { + bindSamplerVariable<OGLRendererTexture2D>(var.m_vertexHandle, *(RendererTexture2D*)data); + bindSamplerVariable<OGLRendererTexture2D>(var.m_fragmentHandles[pass], *(RendererTexture2D*)data); + } + break; + case VARIABLE_SAMPLER3D: + RENDERER_ASSERT(0, "3D GL Textures Not Implemented."); + /* + data = *(void**)data; + RENDERER_ASSERT(data, "NULL Sampler."); + if(data) + { + bindSamplerVariable<OGLRendererTexture3D>(var.m_vertexHandle, *(RendererTexture2D*)data); + bindSamplerVariable<OGLRendererTexture3D>(var.m_fragmentHandles[pass], *(RendererTexture2D*)data); + } + */ + break; + default: + RENDERER_ASSERT(0, "Cannot bind variable of this type."); + break; + } +#endif +} + +#if defined(RENDERER_ENABLE_CG) +void OGLRendererMaterial::loadCustomConstants(CGprogram program, Pass pass) +{ + for(CGparameter param = cgGetFirstParameter(program, CG_GLOBAL); param; param=cgGetNextParameter(param)) + { + const char *name = cgGetParameterName(param); + CGtype cgtype = cgGetParameterType(param); + VariableType type = cgtype != CG_STRUCT && cgtype != CG_ARRAY ? getVariableType(cgtype) : NUM_VARIABLE_TYPES; + if(type < NUM_VARIABLE_TYPES && cgIsParameter(param) && cgIsParameterReferenced(param) && strncmp(name, "g_", 2)) + { + CGVariable *var = 0; + // find existing variable... + PxU32 numVariables = (PxU32)m_variables.size(); + for(PxU32 i=0; i<numVariables; i++) + { + if(!strcmp(m_variables[i]->getName(), name)) + { + var = static_cast<CGVariable*>(m_variables[i]); + break; + } + } + // check to see if the variable is of the same type. + if(var) + { + RENDERER_ASSERT(var->getType() == type, "Variable changes type!"); + } + // if the variable was not found, add it. + if(!var) + { + var = new CGVariable(name, type, m_variableBufferSize); + m_variables.push_back(var); + m_variableBufferSize += var->getDataSize(); + } + if(pass < NUM_PASSES) + { + var->addFragmentHandle(param, pass); + } + else + { + var->addVertexHandle(param); + } + } + } +} +#endif + +#endif // #if defined(RENDERER_ENABLE_OPENGL) diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/ogl/OGLRendererMaterial.h b/PhysX_3.4/Samples/SampleFramework/renderer/src/ogl/OGLRendererMaterial.h new file mode 100644 index 00000000..f415e3a6 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/ogl/OGLRendererMaterial.h @@ -0,0 +1,106 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#ifndef OGL_RENDERER_MATERIAL_H +#define OGL_RENDERER_MATERIAL_H + +#include <RendererConfig.h> + +#if defined(RENDERER_ENABLE_OPENGL) + +#include <RendererMaterial.h> + +#include "OGLRenderer.h" + +namespace SampleRenderer +{ + + class OGLRendererMaterial : public RendererMaterial + { + friend class OGLRendererMesh; + public: + OGLRendererMaterial(OGLRenderer &renderer, const RendererMaterialDesc &desc); + virtual ~OGLRendererMaterial(void); + virtual void setModelMatrix(const float *matrix) + { + PX_UNUSED(matrix); + PX_ALWAYS_ASSERT(); + } + + private: + virtual const Renderer& getRenderer() const { return m_renderer; } + virtual void bind(RendererMaterial::Pass pass, RendererMaterialInstance *materialInstance, bool instanced) const; + virtual void bindMeshState(bool instanced) const; + virtual void unbind(void) const; + virtual void bindVariable(Pass pass, const Variable &variable, const void *data) const; + +#if defined(RENDERER_ENABLE_CG) + void loadCustomConstants(CGprogram program, Pass pass); +#endif + + private: +#if defined(RENDERER_ENABLE_CG) + class CGVariable : public Variable + { + friend class OGLRendererMaterial; + public: + CGVariable(const char *name, VariableType type, PxU32 offset); + virtual ~CGVariable(void); + + void addVertexHandle(CGparameter handle); + void addFragmentHandle(CGparameter handle, Pass pass); + + private: + CGparameter m_vertexHandle; + CGparameter m_fragmentHandles[NUM_PASSES]; + }; +#endif + + private: + OGLRendererMaterial &operator=(const OGLRendererMaterial&) { return *this; } + + private: + OGLRenderer &m_renderer; + + GLenum m_glAlphaTestFunc; + +#if defined(RENDERER_ENABLE_CG) + CGprofile m_vertexProfile; + CGprogram m_vertexProgram; + + CGprofile m_fragmentProfile; + CGprogram m_fragmentPrograms[NUM_PASSES]; +#if defined(RENDERER_PS3) + public: + CGprogram GetVertexProgramPS3(){ return m_vertexProgram;} +#endif +#endif + }; + +} // namespace SampleRenderer + +#endif // #if defined(RENDERER_ENABLE_OPENGL) +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/ogl/OGLRendererMesh.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/ogl/OGLRendererMesh.cpp new file mode 100644 index 00000000..cd25df2b --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/ogl/OGLRendererMesh.cpp @@ -0,0 +1,171 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#include <RendererConfig.h> + +#if defined(RENDERER_ENABLE_OPENGL) + +#include "OGLRendererMesh.h" + +#include "OGLRendererInstanceBuffer.h" +#include "OGLRendererMaterial.h" + +using namespace SampleRenderer; + +static GLenum getGLPrimitive(RendererMesh::Primitive primitive) +{ + GLenum glprim = ~(GLenum)0; + switch(primitive) + { + case RendererMesh::PRIMITIVE_POINTS: glprim = GL_POINTS; break; + case RendererMesh::PRIMITIVE_LINES: glprim = GL_LINES; break; + case RendererMesh::PRIMITIVE_LINE_STRIP: glprim = GL_LINE_STRIP; break; + case RendererMesh::PRIMITIVE_TRIANGLES: glprim = GL_TRIANGLES; break; + case RendererMesh::PRIMITIVE_TRIANGLE_STRIP: glprim = GL_TRIANGLE_STRIP; break; + case RendererMesh::PRIMITIVE_POINT_SPRITES: glprim = GL_POINTS; break; + default: break; + } + RENDERER_ASSERT(glprim != ~(GLenum)0, "Unable to find GL Primitive type."); + return glprim; +} + +static GLenum getGLIndexType(RendererIndexBuffer::Format format) +{ + GLenum gltype = 0; + switch(format) + { + case RendererIndexBuffer::FORMAT_UINT16: gltype = GL_UNSIGNED_SHORT; break; + case RendererIndexBuffer::FORMAT_UINT32: gltype = GL_UNSIGNED_INT; break; + default: break; + } + RENDERER_ASSERT(gltype, "Unable to convert to GL Index Type."); + return gltype; +} + +OGLRendererMesh::OGLRendererMesh(OGLRenderer &renderer, const RendererMeshDesc &desc) +: RendererMesh(desc) +, m_renderer(renderer) +{ + +} + +OGLRendererMesh::~OGLRendererMesh(void) +{ + +} + +void OGLRendererMesh::renderIndices(PxU32 numVertices, PxU32 firstIndex, PxU32 numIndices, RendererIndexBuffer::Format indexFormat, RendererMaterial *material) const +{ + const PxU32 indexSize = RendererIndexBuffer::getFormatByteSize(indexFormat); + void *buffer = ((PxU8*)0)+indexSize*firstIndex; + glDrawElements(getGLPrimitive(getPrimitives()), numIndices, getGLIndexType(indexFormat), buffer); +} + +void OGLRendererMesh::renderVertices(PxU32 numVertices, RendererMaterial *material) const +{ + RendererMesh::Primitive primitive = getPrimitives(); + glDrawArrays(getGLPrimitive(primitive), 0, numVertices); +} + +void OGLRendererMesh::renderIndicesInstanced(PxU32 numVertices, PxU32 firstIndex, PxU32 numIndices, RendererIndexBuffer::Format indexFormat, RendererMaterial *material) const +{ + const OGLRendererInstanceBuffer *ib = static_cast<const OGLRendererInstanceBuffer*>(getInstanceBuffer()); + if(ib) + { + const PxU32 firstInstance = m_firstInstance; + const PxU32 numInstances = getNumInstances(); + + const OGLRendererMaterial *currentMaterial = m_renderer.getCurrentMaterial(); + + CGparameter modelMatrixParam = m_renderer.getCGEnvironment().modelMatrix; + CGparameter modelViewMatrixParam = m_renderer.getCGEnvironment().modelViewMatrix; + + if(currentMaterial && modelMatrixParam && modelViewMatrixParam) + { + for(PxU32 i=0; i<numInstances; i++) + { +#if defined(RENDERER_ENABLE_CG) + const physx::PxMat44 &model = ib->getModelMatrix(firstInstance+i); + GLfloat glmodel[16]; + PxToGL(glmodel, model); + + physx::PxMat44 modelView = m_renderer.getViewMatrix() * model; + GLfloat glmodelview[16]; + PxToGL(glmodelview, modelView); + + cgGLSetMatrixParameterfc(modelMatrixParam, glmodel); + cgGLSetMatrixParameterfc(modelViewMatrixParam, glmodelview); +#endif + + currentMaterial->bindMeshState(false); + + renderIndices(numVertices, firstIndex, numIndices, indexFormat, material); + } + } + } +} + +void OGLRendererMesh::renderVerticesInstanced(PxU32 numVertices, RendererMaterial *material) const +{ + const OGLRendererInstanceBuffer *ib = static_cast<const OGLRendererInstanceBuffer*>(getInstanceBuffer()); + if(ib) + { + const PxU32 firstInstance = m_firstInstance; + const PxU32 numInstances = getNumInstances(); + + const OGLRendererMaterial *currentMaterial = m_renderer.getCurrentMaterial(); + + CGparameter modelMatrixParam = m_renderer.getCGEnvironment().modelMatrix; + CGparameter modelViewMatrixParam = m_renderer.getCGEnvironment().modelViewMatrix; + + if(currentMaterial && modelMatrixParam && modelViewMatrixParam) + { + for(PxU32 i=0; i<numInstances; i++) + { +#if defined(RENDERER_ENABLE_CG) + const physx::PxMat44 &model = ib->getModelMatrix(firstInstance+i); + GLfloat glmodel[16]; + PxToGL(glmodel, model); + + physx::PxMat44 modelView = m_renderer.getViewMatrix() * model; + GLfloat glmodelview[16]; + PxToGL(glmodelview, modelView); + + cgGLSetMatrixParameterfc(modelMatrixParam, glmodel); + cgGLSetMatrixParameterfc(modelViewMatrixParam, glmodelview); +#endif + + currentMaterial->bindMeshState(false); + + renderVertices(numVertices, material); + } + } + } +} + +#endif // #if defined(RENDERER_ENABLE_OPENGL) + diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/ogl/OGLRendererMesh.h b/PhysX_3.4/Samples/SampleFramework/renderer/src/ogl/OGLRendererMesh.h new file mode 100644 index 00000000..95281bbd --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/ogl/OGLRendererMesh.h @@ -0,0 +1,66 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#ifndef OGL_RENDERER_MESH_H +#define OGL_RENDERER_MESH_H + +#include <RendererConfig.h> + +#if defined(RENDERER_ENABLE_OPENGL) + +#include <RendererMesh.h> + +#include "OGLRenderer.h" + +namespace SampleRenderer +{ + + class OGLRendererMesh : public RendererMesh + { + public: + OGLRendererMesh(OGLRenderer &renderer, const RendererMeshDesc &desc); + virtual ~OGLRendererMesh(void); + + public: + virtual void renderIndices(PxU32 numVertices, PxU32 firstIndex, PxU32 numIndices, RendererIndexBuffer::Format indexFormat,RendererMaterial *material) const; + virtual void renderVertices(PxU32 numVertices,RendererMaterial *material) const; + + virtual void renderIndicesInstanced(PxU32 numVertices, PxU32 firstIndex, PxU32 numIndices, RendererIndexBuffer::Format indexFormat,RendererMaterial *material) const; + virtual void renderVerticesInstanced(PxU32 numVertices,RendererMaterial *material) const; + + protected: + void operator=(const OGLRendererMesh &){} + + Renderer& renderer() { return m_renderer; } + + private: + OGLRenderer &m_renderer; + }; + +} // namespace SampleRenderer + +#endif // #if defined(RENDERER_ENABLE_OPENGL) +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/ogl/OGLRendererSpotLight.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/ogl/OGLRendererSpotLight.cpp new file mode 100644 index 00000000..9a44b99d --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/ogl/OGLRendererSpotLight.cpp @@ -0,0 +1,63 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#include <RendererConfig.h> + +#if defined(RENDERER_ENABLE_OPENGL) + +#include "OGLRendererSpotLight.h" + +using namespace SampleRenderer; + +OGLRendererSpotLight::OGLRendererSpotLight(const RendererSpotLightDesc &desc, OGLRenderer &renderer) +: RendererSpotLight(desc) +#if defined(RENDERER_ENABLE_CG) +, m_cgenv(renderer.getCGEnvironment()) +#endif +{ + +} + +OGLRendererSpotLight::~OGLRendererSpotLight(void) +{ + +} + +void OGLRendererSpotLight::bind(void) const +{ +#if defined(RENDERER_ENABLE_CG) + setColorParameter(m_cgenv.lightColor, m_color); + cgSetParameter1f( m_cgenv.lightIntensity, m_intensity); + cgSetParameter3fv(m_cgenv.lightDirection, &m_direction.x); + cgSetParameter3fv(m_cgenv.lightPosition, &m_position.x); + cgSetParameter1f( m_cgenv.lightInnerRadius, m_innerRadius); + cgSetParameter1f( m_cgenv.lightOuterRadius, m_outerRadius); + cgSetParameter1f( m_cgenv.lightInnerCone, m_innerCone); + cgSetParameter1f( m_cgenv.lightOuterCone, m_outerCone); +#endif +} + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/ogl/OGLRendererSpotLight.h b/PhysX_3.4/Samples/SampleFramework/renderer/src/ogl/OGLRendererSpotLight.h new file mode 100644 index 00000000..c6828849 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/ogl/OGLRendererSpotLight.h @@ -0,0 +1,58 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#ifndef OGL_RENDERER_SPOT_LIGHT_H +#define OGL_RENDERER_SPOT_LIGHT_H + +#include <RendererConfig.h> + +#if defined(RENDERER_ENABLE_OPENGL) + +#include <RendererSpotLight.h> + +#include "OGLRenderer.h" + +namespace SampleRenderer +{ + + class OGLRendererSpotLight : public RendererSpotLight + { + public: + OGLRendererSpotLight(const RendererSpotLightDesc &desc, OGLRenderer &renderer); + virtual ~OGLRendererSpotLight(void); + + virtual void bind(void) const; + + private: +#if defined(RENDERER_ENABLE_CG) + const OGLRenderer::CGEnvironment &m_cgenv; +#endif + }; + +} // namespace SampleRenderer + +#endif // #if defined(RENDERER_ENABLE_DIRECT3D9) +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/ogl/OGLRendererTexture2D.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/ogl/OGLRendererTexture2D.cpp new file mode 100644 index 00000000..a0d99b8b --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/ogl/OGLRendererTexture2D.cpp @@ -0,0 +1,299 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#include <RendererConfig.h> + +#if defined(RENDERER_ENABLE_OPENGL) + +#include "OGLRendererTexture2D.h" +#include <RendererTexture2DDesc.h> + +using namespace SampleRenderer; + +static GLuint getGLPixelFormat(RendererTexture2D::Format format) +{ + GLuint glformat = 0; + switch(format) + { + case RendererTexture2D::FORMAT_B8G8R8A8: glformat = GL_BGRA; break; + case RendererTexture2D::FORMAT_R8G8B8A8: glformat = GL_RGBA; break; + case RendererTexture2D::FORMAT_A8: glformat = GL_ALPHA; break; + case RendererTexture2D::FORMAT_R32F: glformat = GL_LUMINANCE; break; + case RendererTexture2D::FORMAT_D16: glformat = GL_DEPTH_COMPONENT; break; + case RendererTexture2D::FORMAT_D24S8: glformat = GL_DEPTH_COMPONENT; break; + default: + // The pixel type need not be defined (in the case of compressed formats) + break; + } + return glformat; +} + +static GLuint getGLPixelInternalFormat(RendererTexture2D::Format format) +{ + GLuint glinternalformat = 0; + switch(format) + { + case RendererTexture2D::FORMAT_B8G8R8A8: + glinternalformat = GL_RGBA8; + break; + case RendererTexture2D::FORMAT_R8G8B8A8: + glinternalformat = GL_RGBA8; + break; + case RendererTexture2D::FORMAT_A8: + glinternalformat = GL_ALPHA8; + break; +#if !defined(RENDERER_PS3) + case RendererTexture2D::FORMAT_R32F: + if(GLEW_ARB_texture_float) glinternalformat = GL_LUMINANCE32F_ARB; + else if(GLEW_ATI_texture_float) glinternalformat = GL_LUMINANCE_FLOAT32_ATI; + break; +#endif + case RendererTexture2D::FORMAT_DXT1: + glinternalformat = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT; + break; + case RendererTexture2D::FORMAT_DXT3: + glinternalformat = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT; + break; + case RendererTexture2D::FORMAT_DXT5: + glinternalformat = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT; + break; +#if !defined(RENDERER_PS3) + case RendererTexture2D::FORMAT_D16: + glinternalformat = GL_DEPTH_COMPONENT16_ARB; + break; + case RendererTexture2D::FORMAT_D24S8: + glinternalformat = GL_DEPTH_COMPONENT24_ARB; + break; +#endif + default: RENDERER_ASSERT(0, "Unsupported GL pixel internal format."); break; + } + RENDERER_ASSERT(glinternalformat, "Unable to compute GL Internal Format."); + return glinternalformat; +} + +static GLuint getGLPixelType(RendererTexture2D::Format format) +{ + GLuint gltype = 0; + switch(format) + { + case RendererTexture2D::FORMAT_B8G8R8A8: + case RendererTexture2D::FORMAT_R8G8B8A8: + gltype = GL_UNSIGNED_BYTE; + break; + case RendererTexture2D::FORMAT_A8: + gltype = GL_UNSIGNED_BYTE; + break; + case RendererTexture2D::FORMAT_R32F: + gltype = GL_FLOAT; + break; + case RendererTexture2D::FORMAT_D16: + gltype = GL_UNSIGNED_SHORT; + break; + case RendererTexture2D::FORMAT_D24S8: + gltype = GL_UNSIGNED_INT; + break; + default: + // The pixel type need not be defined (in the case of compressed formats) + break; + } + return gltype; +} + +static GLint getGLTextureFilter(RendererTexture2D::Filter filter, bool mipmap) +{ + GLint glfilter = 0; + switch(filter) + { + case RendererTexture2D::FILTER_NEAREST: glfilter = mipmap ? GL_NEAREST_MIPMAP_NEAREST : GL_NEAREST; break; + case RendererTexture2D::FILTER_LINEAR: glfilter = mipmap ? GL_LINEAR_MIPMAP_LINEAR : GL_LINEAR; break; + case RendererTexture2D::FILTER_ANISOTROPIC: glfilter = mipmap ? GL_LINEAR_MIPMAP_LINEAR : GL_LINEAR; break; + default: break; + } + RENDERER_ASSERT(glfilter, "Unable to convert to OpenGL Filter mode."); + return glfilter; +} + +static GLint getGLTextureAddressing(RendererTexture2D::Addressing addressing) +{ + GLint glwrap = 0; + switch(addressing) + { + case RendererTexture2D::ADDRESSING_WRAP: glwrap = GL_REPEAT; break; + case RendererTexture2D::ADDRESSING_CLAMP: glwrap = GL_CLAMP; break; + case RendererTexture2D::ADDRESSING_MIRROR: glwrap = GL_MIRRORED_REPEAT; break; + default: break; + } + RENDERER_ASSERT(glwrap, "Unable to convert to OpenGL Addressing mode."); + return glwrap; +} + +OGLRendererTexture2D::OGLRendererTexture2D(const RendererTexture2DDesc &desc) : +RendererTexture2D(desc) +{ + RENDERER_ASSERT(desc.depth == 1, "Invalid depth for 3D Texture!"); + + m_textureid = 0; + m_glformat = 0; + m_glinternalformat = 0; + m_gltype = 0; + m_numLevels = 0; + m_data = 0; + + m_glformat = getGLPixelFormat(desc.format); + m_glinternalformat = getGLPixelInternalFormat(desc.format); + m_gltype = getGLPixelType(desc.format); + + glGenTextures(1, &m_textureid); + RENDERER_ASSERT(m_textureid, "Failed to create OpenGL Texture."); + if(m_textureid) + { + m_width = desc.width; + m_height = desc.height; + m_numLevels = desc.numLevels; + m_data = new PxU8*[m_numLevels]; + memset(m_data, 0, sizeof(PxU8*)*m_numLevels); + + glBindTexture(GL_TEXTURE_2D, m_textureid); + if(isDepthStencilFormat(desc.format)) + { + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE_ARB, GL_COMPARE_R_TO_TEXTURE_ARB); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FUNC_ARB, GL_LEQUAL); + glTexParameteri(GL_TEXTURE_2D, GL_DEPTH_TEXTURE_MODE_ARB, GL_INTENSITY); + } + if(isCompressedFormat(desc.format)) + { + for(PxU32 i=0; i<desc.numLevels; i++) + { + PxU32 w = getLevelDimension(m_width, i); + PxU32 h = getLevelDimension(m_height, i); + PxU32 levelSize = computeImageByteSize(w, h, 1, desc.format); + m_data[i] = new PxU8[levelSize]; + memset(m_data[i], 0, levelSize); + + // limit the maximum level used for mip mapping (we don't update levels < 4 pixels wide) + if (w >= 4 && h >= 4) + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, float(i)); + + glCompressedTexImage2D(GL_TEXTURE_2D, (GLint)i, m_glinternalformat, w, h, 0, levelSize, m_data[i]); + } + } + else + { + RENDERER_ASSERT(m_glformat, "Unknown OpenGL Format!"); + for(PxU32 i=0; i<desc.numLevels; i++) + { + PxU32 w = getLevelDimension(m_width, i); + PxU32 h = getLevelDimension(m_height, i); + PxU32 levelSize = computeImageByteSize(w, h, 1, desc.format); + m_data[i] = new PxU8[levelSize]; + memset(m_data[i], 0, levelSize); + glTexImage2D(GL_TEXTURE_2D, (GLint)i, m_glinternalformat, w, h, 0, m_glformat, m_gltype, m_data[i]); + } + } + + + // set filtering mode... + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, getGLTextureFilter(desc.filter, m_numLevels > 1)); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, getGLTextureFilter(desc.filter, false)); + if(desc.filter == FILTER_ANISOTROPIC) + { + GLfloat maxAnisotropy = 1.0f; + glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &maxAnisotropy); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, maxAnisotropy); + } + + // set addressing modes... + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, getGLTextureAddressing(desc.addressingU)); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, getGLTextureAddressing(desc.addressingV)); + + glBindTexture(GL_TEXTURE_2D, 0); + } +} + +OGLRendererTexture2D::~OGLRendererTexture2D(void) +{ + if(m_textureid) + { + glDeleteTextures(1, &m_textureid); + } + if(m_data) + { + for(PxU32 i=0; i<m_numLevels; i++) + { + delete [] m_data[i]; + } + delete [] m_data; + } +} + +void *OGLRendererTexture2D::lockLevel(PxU32 level, PxU32 &pitch) +{ + void *buffer = 0; + RENDERER_ASSERT(level < m_numLevels, "Level out of range!"); + if(level < m_numLevels) + { + buffer = m_data[level]; + pitch = getFormatNumBlocks(getWidth()>>level, getFormat()) * getBlockSize(); + } + return buffer; +} + +void OGLRendererTexture2D::unlockLevel(PxU32 level) +{ + RENDERER_ASSERT(level < m_numLevels, "Level out of range!"); + if(m_textureid && level < m_numLevels) + { + PxU32 w = getLevelDimension(getWidth(), level); + PxU32 h = getLevelDimension(getHeight(), level); + glBindTexture(GL_TEXTURE_2D, m_textureid); + if(isCompressedFormat(getFormat())) + { + PxU32 levelSize = computeImageByteSize(w, h, 1, getFormat()); + + // Some platforms don't like smaller than 4x4 compressed textures + if (w >= 4 && h >= 4) + glCompressedTexSubImage2D(GL_TEXTURE_2D, (GLint)level, 0, 0, w, h, m_glinternalformat, levelSize, m_data[level]); + } + else + { + glTexImage2D(GL_TEXTURE_2D, (GLint)level, m_glinternalformat, w, h, 0, m_glformat, m_gltype, m_data[level]); + } + glBindTexture(GL_TEXTURE_2D, 0); + } +} + +void OGLRendererTexture2D::bind(PxU32 textureUnit) +{ + if(m_textureid) + { + glActiveTextureARB(GL_TEXTURE0_ARB + textureUnit); + glClientActiveTextureARB(GL_TEXTURE0_ARB + textureUnit); + glBindTexture(GL_TEXTURE_2D, m_textureid); + } +} + +#endif // #if defined(RENDERER_ENABLE_OPENGL) diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/ogl/OGLRendererTexture2D.h b/PhysX_3.4/Samples/SampleFramework/renderer/src/ogl/OGLRendererTexture2D.h new file mode 100644 index 00000000..de894347 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/ogl/OGLRendererTexture2D.h @@ -0,0 +1,75 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#ifndef OGL_RENDERER_TEXTURE_2D_H +#define OGL_RENDERER_TEXTURE_2D_H + +#include <RendererConfig.h> + +#if defined(RENDERER_ENABLE_OPENGL) + +#include <RendererTexture2D.h> +#include "OGLRenderer.h" + +namespace SampleRenderer +{ + + class OGLRendererTexture2D : public RendererTexture2D + { + public: + OGLRendererTexture2D(const RendererTexture2DDesc &desc); + virtual ~OGLRendererTexture2D(void); + + public: + virtual void *lockLevel(PxU32 level, PxU32 &pitch); + virtual void unlockLevel(PxU32 level); + + void bind(PxU32 textureUnit); + + virtual void select(PxU32 stageIndex) + { + bind(stageIndex); + } + + private: + + GLuint m_textureid; + GLuint m_glformat; + GLuint m_glinternalformat; + GLuint m_gltype; + + PxU32 m_width; + PxU32 m_height; + + PxU32 m_numLevels; + + PxU8 **m_data; + }; + +} // namespace SampleRenderer + +#endif // #if defined(RENDERER_ENABLE_OPENGL) +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/ogl/OGLRendererVertexBuffer.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/ogl/OGLRendererVertexBuffer.cpp new file mode 100644 index 00000000..6ca1c52c --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/ogl/OGLRendererVertexBuffer.cpp @@ -0,0 +1,342 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. + +#include "RendererConfig.h" +#include <SamplePlatform.h> + +#if defined(RENDERER_ENABLE_OPENGL) + +#include "OGLRendererVertexBuffer.h" + +#include <RendererVertexBufferDesc.h> + +#if PX_WINDOWS +#include "cudamanager/PxCudaContextManager.h" +#endif + +using namespace SampleRenderer; + +OGLRendererVertexBuffer::OGLRendererVertexBuffer(const RendererVertexBufferDesc &desc) : + RendererVertexBuffer(desc) +, m_vbo(0) +, m_access(0) +{ + RENDERER_ASSERT(GLEW_ARB_vertex_buffer_object, "Vertex Buffer Objects not supported on this machine!"); + if(GLEW_ARB_vertex_buffer_object) + { + GLenum usage = GL_STATIC_DRAW_ARB; + m_access = GL_READ_WRITE; + if(getHint() == HINT_DYNAMIC) + { + usage = GL_DYNAMIC_DRAW_ARB; + m_access = GL_WRITE_ONLY; + } + + RENDERER_ASSERT(m_stride && desc.maxVertices, "Unable to create Vertex Buffer of zero size."); + if(m_stride && desc.maxVertices) + { + glGenBuffersARB(1, &m_vbo); + RENDERER_ASSERT(m_vbo, "Failed to create Vertex Buffer Object."); + } + if(m_vbo) + { + m_maxVertices = desc.maxVertices; + PxU32 bufferSize = m_stride * m_maxVertices; + glBindBufferARB(GL_ARRAY_BUFFER_ARB, m_vbo); + glBufferDataARB(GL_ARRAY_BUFFER_ARB, bufferSize, 0, usage); + glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0); + +#if PX_WINDOWS + if(m_interopContext && m_mustBeRegisteredInCUDA) + { + RENDERER_ASSERT(m_deferredUnlock == false, "Deferred VB Unlock must be disabled when CUDA Interop is in use.") + m_registeredInCUDA = m_interopContext->registerResourceInCudaGL(m_InteropHandle, (PxU32) m_vbo); + } +#endif + } + } +} + +OGLRendererVertexBuffer::~OGLRendererVertexBuffer(void) +{ + if(m_vbo) + { +#if PX_WINDOWS + if(m_registeredInCUDA) + { + m_interopContext->unregisterResourceInCuda(m_InteropHandle); + } +#endif + glDeleteBuffersARB(1, &m_vbo); + } +} + +PxU32 OGLRendererVertexBuffer::convertColor(const RendererColor& color) +{ +#if defined(RENDERER_WINDOWS) + return color.a << 24 | color.b << 16 | color.g << 8 | color.r; +#elif defined (RENDERER_PS3) + return (PxU32&)color; +#elif defined (RENDERER_MACOSX) + return color.a << 24 | color.b << 16 | color.g << 8 | color.r; // TODO: JPB: Check if this is the right order +#elif defined(RENDERER_LINUX) + return color.a << 24 | color.b << 16 | color.g << 8 | color.r; +#else + PX_ASSERT(!"Platform not implemented"); + return (PxU32&)color; +#endif +} + +void OGLRendererVertexBuffer::swizzleColor(void *colors, PxU32 stride, PxU32 numColors, RendererVertexBuffer::Format inFormat) +{ +#if !defined(RENDERER_PS3) + if (inFormat == RendererVertexBuffer::FORMAT_COLOR_BGRA) + { + const void *end = ((PxU8*)colors)+(stride*numColors); + for(PxU8* iterator = (PxU8*)colors; iterator < end; iterator+=stride) + { + // swizzle red and blue + std::swap(((PxU8*)iterator)[0], ((PxU8*)iterator)[2]); + } + } +#endif +} + +void *OGLRendererVertexBuffer::lock(void) +{ + PX_PROFILE_ZONE("OGLRendererVertexBufferLock",0); + void *buffer = 0; + if(m_vbo) + { + glBindBufferARB(GL_ARRAY_BUFFER_ARB, m_vbo); + buffer = glMapBuffer(GL_ARRAY_BUFFER, m_access); + glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0); + } + return buffer; +} + +void OGLRendererVertexBuffer::unlock(void) +{ + if(m_vbo) + { + glBindBufferARB(GL_ARRAY_BUFFER_ARB, m_vbo); + glUnmapBuffer(GL_ARRAY_BUFFER); + glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0); + } +} + +static GLuint getGLFormatSize(RendererVertexBuffer::Format format) +{ + PxU32 size = 0; + switch(format) + { + case RendererVertexBuffer::FORMAT_FLOAT1: size = 1; break; + case RendererVertexBuffer::FORMAT_FLOAT2: size = 2; break; + case RendererVertexBuffer::FORMAT_FLOAT3: size = 3; break; + case RendererVertexBuffer::FORMAT_FLOAT4: size = 4; break; + case RendererVertexBuffer::FORMAT_UBYTE4: size = 4; break; + case RendererVertexBuffer::FORMAT_USHORT4: size = 4; break; + case RendererVertexBuffer::FORMAT_COLOR_BGRA: size = 4; break; + case RendererVertexBuffer::FORMAT_COLOR_RGBA: size = 4; break; + case RendererVertexBuffer::FORMAT_COLOR_NATIVE: size = 4; break; + default: break; + } + RENDERER_ASSERT(size, "Unable to compute number of Vertex Buffer elements."); + return size; +} + +static GLenum getGLFormatType(RendererVertexBuffer::Format format) +{ + GLenum type = 0; + switch(format) + { + case RendererVertexBuffer::FORMAT_FLOAT1: + case RendererVertexBuffer::FORMAT_FLOAT2: + case RendererVertexBuffer::FORMAT_FLOAT3: + case RendererVertexBuffer::FORMAT_FLOAT4: + type = GL_FLOAT; + break; + case RendererVertexBuffer::FORMAT_UBYTE4: + type = GL_BYTE; + break; + case RendererVertexBuffer::FORMAT_USHORT4: + type = GL_SHORT; + break; + case RendererVertexBuffer::FORMAT_COLOR_BGRA: + case RendererVertexBuffer::FORMAT_COLOR_RGBA: + case RendererVertexBuffer::FORMAT_COLOR_NATIVE: + type = GL_UNSIGNED_BYTE; + break; + default: break; + } + RENDERER_ASSERT(type, "Unable to compute GLType for Vertex Buffer Format."); + return type; +} + +static GLenum getGLSemantic(RendererVertexBuffer::Semantic semantic) +{ + GLenum glsemantic = 0; + switch(semantic) + { + case RendererVertexBuffer::SEMANTIC_POSITION: glsemantic = GL_VERTEX_ARRAY; break; + case RendererVertexBuffer::SEMANTIC_COLOR: glsemantic = GL_COLOR_ARRAY; break; + case RendererVertexBuffer::SEMANTIC_NORMAL: glsemantic = GL_NORMAL_ARRAY; break; + case RendererVertexBuffer::SEMANTIC_TANGENT: glsemantic = GL_TEXTURE_COORD_ARRAY; break; + + case RendererVertexBuffer::SEMANTIC_TEXCOORD0: + case RendererVertexBuffer::SEMANTIC_TEXCOORD1: + case RendererVertexBuffer::SEMANTIC_TEXCOORD2: + case RendererVertexBuffer::SEMANTIC_TEXCOORD3: + case RendererVertexBuffer::SEMANTIC_BONEINDEX: + case RendererVertexBuffer::SEMANTIC_BONEWEIGHT: + glsemantic = GL_TEXTURE_COORD_ARRAY; + break; + default: + break; + } + // There is no reason why certain semantics can go unsupported by OpenGL + //RENDERER_ASSERT(glsemantic, "Unable to compute the GL Semantic for Vertex Buffer Semantic."); + return glsemantic; +} + +void OGLRendererVertexBuffer::bind(PxU32 streamID, PxU32 firstVertex) +{ + PX_PROFILE_ZONE("OGLRendererVertexBufferBind",0); + prepareForRender(); + const PxU8 *buffer = ((PxU8*)0) + firstVertex*m_stride; + if(m_vbo) + { + glBindBufferARB(GL_ARRAY_BUFFER_ARB, m_vbo); + for(PxU32 i=0; i<NUM_SEMANTICS; i++) + { + Semantic semantic = (Semantic)i; + const SemanticDesc &sm = m_semanticDescs[semantic]; + if(sm.format < NUM_FORMATS) + { + switch(semantic) + { + case SEMANTIC_POSITION: + RENDERER_ASSERT(sm.format >= FORMAT_FLOAT1 && sm.format <= FORMAT_FLOAT4, "Unsupported Vertex Buffer Format for POSITION semantic."); + if(sm.format >= FORMAT_FLOAT1 && sm.format <= FORMAT_FLOAT4) + { + glVertexPointer(getGLFormatSize(sm.format), getGLFormatType(sm.format), m_stride, buffer+sm.offset); + } + break; + case SEMANTIC_COLOR: + // swizzling was already handled in unlock() + RENDERER_ASSERT((sm.format == FORMAT_COLOR_BGRA || sm.format == FORMAT_COLOR_RGBA || sm.format == FORMAT_COLOR_NATIVE), "Unsupported Vertex Buffer Format for COLOR semantic."); + if(sm.format == FORMAT_COLOR_BGRA || sm.format == FORMAT_COLOR_RGBA || sm.format == FORMAT_COLOR_NATIVE) + { + glColorPointer(getGLFormatSize(sm.format), getGLFormatType(sm.format), m_stride, buffer+sm.offset); + } + break; + case SEMANTIC_NORMAL: + RENDERER_ASSERT((sm.format == FORMAT_FLOAT3 || sm.format == FORMAT_FLOAT4), "Unsupported Vertex Buffer Format for NORMAL semantic."); + if(sm.format == FORMAT_FLOAT3 || sm.format == FORMAT_FLOAT4) + { + glNormalPointer(getGLFormatType(sm.format), m_stride, buffer+sm.offset); + } + break; + case SEMANTIC_TANGENT: + RENDERER_ASSERT((sm.format == FORMAT_FLOAT3 || sm.format == FORMAT_FLOAT4), "Unsupported Vertex Buffer Format for TANGENT semantic."); + if(sm.format == FORMAT_FLOAT3 || sm.format == FORMAT_FLOAT4) + { + const PxU32 channel = RENDERER_TANGENT_CHANNEL; + glActiveTextureARB((GLenum)(GL_TEXTURE0_ARB + channel)); + glClientActiveTextureARB((GLenum)(GL_TEXTURE0_ARB + channel)); + glTexCoordPointer(getGLFormatSize(sm.format), getGLFormatType(sm.format), m_stride, buffer+sm.offset); + } + break; + case SEMANTIC_TEXCOORD0: + case SEMANTIC_TEXCOORD1: + case SEMANTIC_TEXCOORD2: + case SEMANTIC_TEXCOORD3: + { + const PxU32 channel = semantic - SEMANTIC_TEXCOORD0; + glActiveTextureARB((GLenum)(GL_TEXTURE0_ARB + channel)); + glClientActiveTextureARB((GLenum)(GL_TEXTURE0_ARB + channel)); + glTexCoordPointer(getGLFormatSize(sm.format), getGLFormatType(sm.format), m_stride, buffer+sm.offset); + break; + } + case SEMANTIC_BONEINDEX: + { + const PxU32 channel = RENDERER_BONEINDEX_CHANNEL; + glActiveTextureARB((GLenum)(GL_TEXTURE0_ARB + channel)); + glClientActiveTextureARB((GLenum)(GL_TEXTURE0_ARB + channel)); + glTexCoordPointer(getGLFormatSize(sm.format), getGLFormatType(sm.format), m_stride, buffer+sm.offset); + break; + } + case SEMANTIC_BONEWEIGHT: + { + const PxU32 channel = RENDERER_BONEWEIGHT_CHANNEL; + glActiveTextureARB((GLenum)(GL_TEXTURE0_ARB + channel)); + glClientActiveTextureARB((GLenum)(GL_TEXTURE0_ARB + channel)); + glTexCoordPointer(getGLFormatSize(sm.format), getGLFormatType(sm.format), m_stride, buffer+sm.offset); + break; + } + case SEMANTIC_DISPLACEMENT_TEXCOORD: + case SEMANTIC_DISPLACEMENT_FLAGS: + break; + default: + RENDERER_ASSERT(0, "Unable to bind Vertex Buffer Semantic."); + } + + GLenum glsemantic = getGLSemantic(semantic); + if(glsemantic) + { + glEnableClientState(getGLSemantic(semantic)); + } + } + } + glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0); + } +} + +void OGLRendererVertexBuffer::unbind(PxU32 streamID) +{ + for(PxU32 i=0; i<NUM_SEMANTICS; i++) + { + Semantic semantic = (Semantic)i; + const SemanticDesc &sm = m_semanticDescs[semantic]; + if(sm.format < NUM_FORMATS) + { + GLenum glsemantic = getGLSemantic(semantic); + if(glsemantic != GL_TEXTURE_COORD_ARRAY) + { + glDisableClientState(glsemantic); + } + } + } + for(PxU32 i=0; i<8; i++) + { + glActiveTextureARB((GLenum)(GL_TEXTURE0_ARB + i)); + glClientActiveTextureARB((GLenum)(GL_TEXTURE0_ARB + i)); + glDisableClientState(GL_TEXTURE_COORD_ARRAY); + } +} + +#endif // #if defined(RENDERER_ENABLE_OPENGL) diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/ogl/OGLRendererVertexBuffer.h b/PhysX_3.4/Samples/SampleFramework/renderer/src/ogl/OGLRendererVertexBuffer.h new file mode 100644 index 00000000..bca28184 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/ogl/OGLRendererVertexBuffer.h @@ -0,0 +1,65 @@ +// 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-2016 NVIDIA Corporation. All rights reserved. +#ifndef OGL_RENDERER_VERTEXBUFFER_H +#define OGL_RENDERER_VERTEXBUFFER_H + +#include <RendererConfig.h> + +#if defined(RENDERER_ENABLE_OPENGL) + +#include <RendererVertexBuffer.h> +#include "OGLRenderer.h" + +namespace SampleRenderer +{ + + class OGLRendererVertexBuffer : public RendererVertexBuffer + { + public: + OGLRendererVertexBuffer(const RendererVertexBufferDesc &desc); + virtual ~OGLRendererVertexBuffer(void); + + static PxU32 convertColor(const RendererColor& color); + + protected: + virtual void swizzleColor(void *colors, PxU32 stride, PxU32 numColors, RendererVertexBuffer::Format inFormat); + + virtual void *lock(void); + virtual void unlock(void); + + virtual void bind(PxU32 streamID, PxU32 firstVertex); + virtual void unbind(PxU32 streamID); + + private: + GLuint m_vbo; + GLenum m_access; + }; + +} // namespace SampleRenderer + +#endif // #if defined(RENDERER_ENABLE_OPENGL) +#endif |