diff --git a/D3D11Engine/D2DSettingsDialog.cpp b/D3D11Engine/D2DSettingsDialog.cpp index 5d40472e..f8a36f66 100644 --- a/D3D11Engine/D2DSettingsDialog.cpp +++ b/D3D11Engine/D2DSettingsDialog.cpp @@ -544,7 +544,16 @@ XRESULT D2DSettingsDialog::InitControls() { } rainEffectsCheckbox->SetDataToUpdate( &Engine::GAPI->GetRendererState().RendererSettings.EnableRainEffects ); rainEffectsCheckbox->SetChecked( Engine::GAPI->GetRendererState().RendererSettings.EnableRainEffects ); - rainEffectsCheckbox->SetPosition( D2D1::Point2F( 170 + 160 + 20, rainEffectsCheckbox->GetPosition().y ) ); + + SV_Checkbox* lightCheckbox = new SV_Checkbox( MainView, MainPanel ); + lightCheckbox->SetPositionAndSize( D2D1::Point2F( 10, 10 ), D2D1::SizeF( 160, 20 ) ); + lightCheckbox->AlignUnder( rainEffectsCheckbox, 15 ); + switch ( userLanguage ) { + case LANGUAGE_POLISH: lightCheckbox->SetCaption( L"Ogranicz Natężenie Światła" ); break; + default: lightCheckbox->SetCaption( L"Limit Light Intesity" ); break; + } + lightCheckbox->SetDataToUpdate( &Engine::GAPI->GetRendererState().RendererSettings.LimitLightIntesity ); + lightCheckbox->SetChecked( Engine::GAPI->GetRendererState().RendererSettings.LimitLightIntesity ); // Mode changing label SV_Label* modeChangingLabel = new SV_Label( MainView, MainPanel ); diff --git a/D3D11Engine/D3D11GraphicsEngine.cpp b/D3D11Engine/D3D11GraphicsEngine.cpp index 114fd5c0..359fb84b 100644 --- a/D3D11Engine/D3D11GraphicsEngine.cpp +++ b/D3D11Engine/D3D11GraphicsEngine.cpp @@ -976,11 +976,10 @@ XRESULT D3D11GraphicsEngine::OnBeginFrame() { // Notify the shader manager ShaderManager->OnFrameStart(); - // Enable blending, in case some modifications need it - // and the ResetRenderStates won't be enough - Engine::GAPI->GetRendererState().BlendState.SetDefault(); - Engine::GAPI->GetRendererState().BlendState.BlendEnabled = true; - Engine::GAPI->GetRendererState().BlendState.SetDirty(); + // Disable culling for ui rendering(Sprite from LeGo needs it since it use CCW instead of CW order) + SetDefaultStates(); + Engine::GAPI->GetRendererState().RasterizerState.CullMode = GothicRasterizerStateInfo::CM_CULL_NONE; + Engine::GAPI->GetRendererState().RasterizerState.SetDirty(); UpdateRenderStates(); // Bind HDR Back Buffer @@ -1539,11 +1538,10 @@ XRESULT D3D11GraphicsEngine::DrawScreenFade( void* c ) { Continue_ResetState: if ( ResetStates ) { - // Enable blending, in case some modifications need it + // Disable culling for ui rendering(Sprite from LeGo needs it since it use CCW instead of CW order) SetDefaultStates(); - Engine::GAPI->GetRendererState().BlendState.SetDefault(); - Engine::GAPI->GetRendererState().BlendState.BlendEnabled = true; - Engine::GAPI->GetRendererState().BlendState.SetDirty(); + Engine::GAPI->GetRendererState().RasterizerState.CullMode = GothicRasterizerStateInfo::CM_CULL_NONE; + Engine::GAPI->GetRendererState().RasterizerState.SetDirty(); UpdateRenderStates(); } return XR_SUCCESS; @@ -2217,12 +2215,10 @@ XRESULT D3D11GraphicsEngine::OnStartWorldRendering() { GetContext()->OMSetRenderTargets( 1, HDRBackBuffer->GetRenderTargetView().GetAddressOf(), nullptr ); - // Enable blending, in case some modifications need it - // and the ResetRenderStates won't be enough + // Disable culling for ui rendering(Sprite from LeGo needs it since it use CCW instead of CW order) SetDefaultStates(); - Engine::GAPI->GetRendererState().BlendState.SetDefault(); - Engine::GAPI->GetRendererState().BlendState.BlendEnabled = true; - Engine::GAPI->GetRendererState().BlendState.SetDirty(); + Engine::GAPI->GetRendererState().RasterizerState.CullMode = GothicRasterizerStateInfo::CM_CULL_NONE; + Engine::GAPI->GetRendererState().RasterizerState.SetDirty(); UpdateRenderStates(); // Save screenshot if wanted @@ -4621,6 +4617,9 @@ XRESULT D3D11GraphicsEngine::DrawLighting( std::vector& lights ) WORLD_SECTION_SIZE ); Engine::GAPI->GetRendererState().BlendState.SetAdditiveBlending(); + if ( Engine::GAPI->GetRendererState().RendererSettings.LimitLightIntesity ) { + Engine::GAPI->GetRendererState().BlendState.BlendOp = GothicBlendStateInfo::BO_BLEND_OP_MAX; + } Engine::GAPI->GetRendererState().BlendState.SetDirty(); Engine::GAPI->GetRendererState().DepthState.DepthWriteEnabled = false; @@ -4758,6 +4757,9 @@ XRESULT D3D11GraphicsEngine::DrawLighting( std::vector& lights ) Engine::GAPI->GetRendererState().RendererInfo.FrameDrawnLights++; } + Engine::GAPI->GetRendererState().BlendState.BlendOp = GothicBlendStateInfo::BO_BLEND_OP_ADD; + Engine::GAPI->GetRendererState().BlendState.SetDirty(); + Engine::GAPI->GetRendererState().DepthState.DepthBufferCompareFunc = GothicDepthBufferStateInfo::CF_COMPARISON_ALWAYS; Engine::GAPI->GetRendererState().DepthState.SetDirty(); diff --git a/D3D11Engine/D3D11VShader.cpp b/D3D11Engine/D3D11VShader.cpp index a4edd757..75e73c83 100644 --- a/D3D11Engine/D3D11VShader.cpp +++ b/D3D11Engine/D3D11VShader.cpp @@ -103,15 +103,15 @@ XRESULT D3D11VShader::LoadShader( const char* vertexShader, int layout, const st const D3D11_INPUT_ELEMENT_DESC layout3[] = { - { "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 }, - { "POSITION", 1, DXGI_FORMAT_R32G32B32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 }, - { "POSITION", 2, DXGI_FORMAT_R32G32B32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 }, - { "POSITION", 3, DXGI_FORMAT_R32G32B32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 }, + { "POSITION", 0, DXGI_FORMAT_R16G16B16A16_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 }, + { "POSITION", 1, DXGI_FORMAT_R16G16B16A16_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 }, + { "POSITION", 2, DXGI_FORMAT_R16G16B16A16_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 }, + { "POSITION", 3, DXGI_FORMAT_R16G16B16A16_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 }, - { "DIFFUSE", 0, DXGI_FORMAT_R8G8B8A8_UNORM, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 }, + { "TEXCOORD", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 }, + { "TEXCOORD", 1, DXGI_FORMAT_R32G32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 }, { "BONEIDS", 0, DXGI_FORMAT_R8G8B8A8_UINT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 }, - { "WEIGHTS", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 }, + { "WEIGHTS", 0, DXGI_FORMAT_R16G16B16A16_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 }, }; const D3D11_INPUT_ELEMENT_DESC layout4[] = diff --git a/D3D11Engine/D3D7/MyDirect3DDevice7.h b/D3D11Engine/D3D7/MyDirect3DDevice7.h index d306180e..eff4dd70 100644 --- a/D3D11Engine/D3D7/MyDirect3DDevice7.h +++ b/D3D11Engine/D3D7/MyDirect3DDevice7.h @@ -741,12 +741,6 @@ class MyDirect3DDevice7 : public IDirect3DDevice7 { exv[i].Color = rhw[i].color; } - if ( Engine::GAPI->GetRendererState().RasterizerState.FrontCounterClockwise ) { - // Some mods can change winding order - Engine::GAPI->GetRendererState().RasterizerState.FrontCounterClockwise = false; - Engine::GAPI->GetRendererState().RasterizerState.SetDirty(); - } - Engine::GraphicsEngine->SetActiveVertexShader( "VS_TransformedEx" ); Engine::GraphicsEngine->BindViewportInformation( "VS_TransformedEx", 0 ); break; diff --git a/D3D11Engine/GothicAPI.cpp b/D3D11Engine/GothicAPI.cpp index a1e2800e..89ed3288 100644 --- a/D3D11Engine/GothicAPI.cpp +++ b/D3D11Engine/GothicAPI.cpp @@ -3828,6 +3828,7 @@ XRESULT GothicAPI::SaveMenuSettings( const std::string& file ) { WritePrivateProfileStringA( "Display", "UIScale", std::to_string( s.GothicUIScale ).c_str(), ini.c_str() ); WritePrivateProfileStringA( "Display", "Rain", std::to_string( s.EnableRain ? TRUE : FALSE ).c_str(), ini.c_str() ); WritePrivateProfileStringA( "Display", "RainEffects", std::to_string( s.EnableRainEffects ? TRUE : FALSE ).c_str(), ini.c_str() ); + WritePrivateProfileStringA( "Display", "LimitLightIntesity", std::to_string( s.LimitLightIntesity ? TRUE : FALSE ).c_str(), ini.c_str() ); WritePrivateProfileStringA( "Shadows", "EnableShadows", std::to_string( s.EnableShadows ? TRUE : FALSE ).c_str(), ini.c_str() ); WritePrivateProfileStringA( "Shadows", "EnableSoftShadows", std::to_string( s.EnableSoftShadows ? TRUE : FALSE ).c_str(), ini.c_str() ); @@ -3938,6 +3939,7 @@ XRESULT GothicAPI::LoadMenuSettings( const std::string& file ) { s.GothicUIScale = GetPrivateProfileFloatA( "Display", "UIScale", 1.0f, ini ); s.EnableRain = GetPrivateProfileBoolA( "Display", "Rain", true, ini ); s.EnableRainEffects = GetPrivateProfileBoolA( "Display", "RainEffects", true, ini ); + s.LimitLightIntesity = GetPrivateProfileBoolA( "Display", "LimitLightIntesity", false, ini ); s.EnableSMAA = GetPrivateProfileBoolA( "SMAA", "Enabled", false, ini ); s.SharpenFactor = GetPrivateProfileFloatA( "SMAA", "SharpenFactor", 0.30f, ini ); diff --git a/D3D11Engine/GothicGraphicsState.h b/D3D11Engine/GothicGraphicsState.h index b37b4adc..7514d057 100644 --- a/D3D11Engine/GothicGraphicsState.h +++ b/D3D11Engine/GothicGraphicsState.h @@ -637,6 +637,7 @@ struct GothicRendererSettings { GothicUIScale = 1.0f; //DisableEverything(); + LimitLightIntesity = false; AllowNormalmaps = true; AllowNumpadKeys = false; @@ -786,6 +787,7 @@ struct GothicRendererSettings { bool EnableRain; bool EnableRainEffects; + bool LimitLightIntesity; bool AllowNormalmaps; bool AllowNumpadKeys; diff --git a/D3D11Engine/Shaders/VS_ExSkeletal.hlsl b/D3D11Engine/Shaders/VS_ExSkeletal.hlsl index 9c543fc1..edea4010 100644 --- a/D3D11Engine/Shaders/VS_ExSkeletal.hlsl +++ b/D3D11Engine/Shaders/VS_ExSkeletal.hlsl @@ -29,10 +29,10 @@ cbuffer BoneTransforms : register( b2 ) //-------------------------------------------------------------------------------------- struct VS_INPUT { - float3 vPosition[4] : POSITION; + float4 vPosition[4] : POSITION; float3 vNormal : NORMAL; - float2 vTex1 : TEXCOORD0; - float4 vDiffuse : DIFFUSE; + float3 vBindPoseNormal : TEXCOORD0; + float2 vTex1 : TEXCOORD1; uint4 BoneIndices : BONEIDS; float4 Weights : WEIGHTS; }; @@ -55,10 +55,10 @@ VS_OUTPUT VSMain( VS_INPUT Input ) VS_OUTPUT Output; float3 position = float3(0, 0, 0); - position += Input.Weights.x * mul(float4(Input.vPosition[0], 1), BT_Transforms[Input.BoneIndices.x]).xyz; - position += Input.Weights.y * mul(float4(Input.vPosition[1], 1), BT_Transforms[Input.BoneIndices.y]).xyz; - position += Input.Weights.z * mul(float4(Input.vPosition[2], 1), BT_Transforms[Input.BoneIndices.z]).xyz; - position += Input.Weights.w * mul(float4(Input.vPosition[3], 1), BT_Transforms[Input.BoneIndices.w]).xyz; + position += Input.Weights.x * mul(float4(Input.vPosition[0].xyz, 1), BT_Transforms[Input.BoneIndices.x]).xyz; + position += Input.Weights.y * mul(float4(Input.vPosition[1].xyz, 1), BT_Transforms[Input.BoneIndices.y]).xyz; + position += Input.Weights.z * mul(float4(Input.vPosition[2].xyz, 1), BT_Transforms[Input.BoneIndices.z]).xyz; + position += Input.Weights.w * mul(float4(Input.vPosition[3].xyz, 1), BT_Transforms[Input.BoneIndices.w]).xyz; float3 normal = float3(0, 0, 0); normal += Input.Weights.x * mul(Input.vNormal, (float3x3)BT_Transforms[Input.BoneIndices.x]); @@ -73,7 +73,7 @@ VS_OUTPUT VSMain( VS_INPUT Input ) Output.vTexcoord2 = Input.vTex1; Output.vTexcoord = Input.vTex1; Output.vDiffuse = PI_ModelColor; - Output.vNormalVS = mul(normal, (float3x3)mul(M_World, M_View)); + Output.vNormalVS = mul(Input.vBindPoseNormal, (float3x3)mul(M_World, M_View)); Output.vViewPosition = mul(float4(positionWorld,1),M_View).xyz; //Output.vWorldPosition = positionWorld; diff --git a/D3D11Engine/Shaders/VS_ExSkeletalCube.hlsl b/D3D11Engine/Shaders/VS_ExSkeletalCube.hlsl index 574f6678..0afb6feb 100644 --- a/D3D11Engine/Shaders/VS_ExSkeletalCube.hlsl +++ b/D3D11Engine/Shaders/VS_ExSkeletalCube.hlsl @@ -29,10 +29,10 @@ cbuffer BoneTransforms : register( b2 ) //-------------------------------------------------------------------------------------- struct VS_INPUT { - float3 vPosition[4] : POSITION; + float4 vPosition[4] : POSITION; float3 vNormal : NORMAL; - float2 vTex1 : TEXCOORD0; - float4 vDiffuse : DIFFUSE; + float3 vBindPoseNormal : TEXCOORD0; + float2 vTex1 : TEXCOORD1; uint4 BoneIndices : BONEIDS; float4 Weights : WEIGHTS; }; @@ -54,10 +54,10 @@ VS_OUTPUT VSMain( VS_INPUT Input ) VS_OUTPUT Output; float3 position = float3(0, 0, 0); - position += Input.Weights.x * mul(float4(Input.vPosition[0], 1), BT_Transforms[Input.BoneIndices.x]).xyz; - position += Input.Weights.y * mul(float4(Input.vPosition[1], 1), BT_Transforms[Input.BoneIndices.y]).xyz; - position += Input.Weights.z * mul(float4(Input.vPosition[2], 1), BT_Transforms[Input.BoneIndices.z]).xyz; - position += Input.Weights.w * mul(float4(Input.vPosition[3], 1), BT_Transforms[Input.BoneIndices.w]).xyz; + position += Input.Weights.x * mul(float4(Input.vPosition[0].xyz, 1), BT_Transforms[Input.BoneIndices.x]).xyz; + position += Input.Weights.y * mul(float4(Input.vPosition[1].xyz, 1), BT_Transforms[Input.BoneIndices.y]).xyz; + position += Input.Weights.z * mul(float4(Input.vPosition[2].xyz, 1), BT_Transforms[Input.BoneIndices.z]).xyz; + position += Input.Weights.w * mul(float4(Input.vPosition[3].xyz, 1), BT_Transforms[Input.BoneIndices.w]).xyz; float3 normal = float3(0, 0, 0); normal += Input.Weights.x * mul(Input.vNormal, (float3x3)BT_Transforms[Input.BoneIndices.x]); @@ -72,7 +72,7 @@ VS_OUTPUT VSMain( VS_INPUT Input ) Output.vTexcoord2 = Input.vTex1; Output.vTexcoord = Input.vTex1; Output.vDiffuse = PI_ModelColor; - Output.vNormalWS = mul(normal, (float3x3)M_World); + Output.vNormalWS = mul(Input.vBindPoseNormal, (float3x3)M_World); return Output; diff --git a/D3D11Engine/VertexTypes.h b/D3D11Engine/VertexTypes.h index 49b29239..5cb79946 100644 --- a/D3D11Engine/VertexTypes.h +++ b/D3D11Engine/VertexTypes.h @@ -29,12 +29,12 @@ struct BasicVertexStruct { }; struct ExSkelVertexStruct { - float3 Position[4]; + unsigned short Position[4][4]; float3 Normal; + float3 BindPoseNormal; float2 TexCoord; - DWORD Color; unsigned char boneIndices[4]; - float weights[4]; + unsigned short weights[4]; }; struct Gothic_XYZ_DIF_T1_Vertex { diff --git a/D3D11Engine/WorldConverter.cpp b/D3D11Engine/WorldConverter.cpp index 5f779477..62badb29 100644 --- a/D3D11Engine/WorldConverter.cpp +++ b/D3D11Engine/WorldConverter.cpp @@ -955,7 +955,6 @@ void WorldConverter::ExtractSkeletalMeshFromVob( zCModel* model, SkeletalMeshVis ExSkelVertexStruct vx; //vx.Position = s->GetPositionList()->Array[i]; - vx.Color = 0xFFFFFFFF; vx.Normal = float3( 0, 0, 0 ); ZeroMemory( vx.weights, sizeof( vx.weights ) ); ZeroMemory( vx.Position, sizeof( vx.Position ) ); @@ -971,9 +970,11 @@ void WorldConverter::ExtractSkeletalMeshFromVob( zCModel* model, SkeletalMeshVis // Get index and weight if ( n < 4 ) { - vx.weights[n] = weightEntry.Weight; + vx.weights[n] = quantizeHalfFloat( weightEntry.Weight ); vx.boneIndices[n] = weightEntry.NodeIndex; - vx.Position[n] = weightEntry.VertexPosition; + vx.Position[n][0] = quantizeHalfFloat( weightEntry.VertexPosition.x ); + vx.Position[n][1] = quantizeHalfFloat( weightEntry.VertexPosition.y ); + vx.Position[n][2] = quantizeHalfFloat( weightEntry.VertexPosition.z ); } } @@ -1007,13 +1008,14 @@ void WorldConverter::ExtractSkeletalMeshFromVob( zCModel* model, SkeletalMeshVis ExSkelVertexStruct& vx = vertices.back(); int normalPosition = static_cast(wedge.position); - if ( normalPosition < nr->NumInArray ) + if ( normalPosition < nr->NumInArray ) { vx.Normal = nr->Array[normalPosition]; - else + } else { vx.Normal = wedge.normal; + } + vx.BindPoseNormal = wedge.normal; vx.TexCoord = wedge.texUV; - vx.Color = 0xFFFFFFFF; // Save vertexpos in bind pose, to run PNAEN on it bindPoseVertices.emplace_back(); @@ -1021,7 +1023,7 @@ void WorldConverter::ExtractSkeletalMeshFromVob( zCModel* model, SkeletalMeshVis pvx.Position = s->GetPositionList()->Array[wedge.position]; pvx.Normal = vx.Normal; pvx.TexCoord = vx.TexCoord; - pvx.Color = vx.Color; + pvx.Color = 0xFFFFFFFF; } zCMaterial* mat = s->GetSubmesh( i )->Material; @@ -1700,42 +1702,6 @@ void WorldConverter::IndexVertices( ExVertexStruct* input, unsigned int numInput outVertices[it.second] = it.first; } -struct CmpClassSkel // class comparing vertices in the set -{ - bool operator() ( const std::pair& p1, const std::pair& p2 ) const { - for ( int i = 0; i < 4; i++ ) { - if ( fabs( p1.first.Position[i].x - p2.first.Position[i].x ) > eps ) return p1.first.Position[i].x < p2.first.Position[i].x; - if ( fabs( p1.first.Position[i].y - p2.first.Position[i].y ) > eps ) return p1.first.Position[i].y < p2.first.Position[i].y; - if ( fabs( p1.first.Position[i].z - p2.first.Position[i].z ) > eps ) return p1.first.Position[i].z < p2.first.Position[i].z; - } - - if ( fabs( p1.first.TexCoord.x - p2.first.TexCoord.x ) > eps ) return p1.first.TexCoord.x < p2.first.TexCoord.x; - if ( fabs( p1.first.TexCoord.y - p2.first.TexCoord.y ) > eps ) return p1.first.TexCoord.y < p2.first.TexCoord.y; - - return false; - } -}; - -void WorldConverter::IndexVertices( ExSkelVertexStruct* input, unsigned int numInputVertices, std::vector& outVertices, std::vector& outIndices ) { - std::set, CmpClassSkel> vertices; - int index = 0; - - for ( unsigned int i = 0; i < numInputVertices; i++ ) { - std::set>::iterator it = vertices.find( std::make_pair( input[i], 0/*this value doesn't matter*/ ) ); - if ( it != vertices.end() ) outIndices.emplace_back( it->second ); - else { - vertices.insert( std::make_pair( input[i], index ) ); - outIndices.emplace_back( index++ ); - } - } - - // Notice that the vertices in the set are not sorted by the index - // so you'll have to rearrange them like this: - outVertices.resize( vertices.size() ); - for ( auto const& it : vertices ) - outVertices[it.second] = it.first; -} - /** Computes vertex normals for a mesh with face normals */ void WorldConverter::GenerateVertexNormals( std::vector& vertices, std::vector& indices ) { std::vector normals( vertices.size(), XMFLOAT3( 0, 0, 0 ) ); diff --git a/D3D11Engine/WorldConverter.h b/D3D11Engine/WorldConverter.h index 56daef29..80e37e97 100644 --- a/D3D11Engine/WorldConverter.h +++ b/D3D11Engine/WorldConverter.h @@ -78,7 +78,6 @@ class WorldConverter { /** Indexes the given vertex array */ static void IndexVertices( ExVertexStruct* input, unsigned int numInputVertices, std::vector& outVertices, std::vector& outIndices ); - static void IndexVertices( ExSkelVertexStruct* input, unsigned int numInputVertices, std::vector& outVertices, std::vector& outIndices ); static void IndexVertices( ExVertexStruct* input, unsigned int numInputVertices, std::vector& outVertices, std::vector& outIndices ); /** Marks the edges of the mesh */ diff --git a/D3D11Engine/pch.h b/D3D11Engine/pch.h index da092b19..1fe6d3b0 100644 --- a/D3D11Engine/pch.h +++ b/D3D11Engine/pch.h @@ -27,7 +27,7 @@ #define stdext std #endif -#define VERSION_NUMBER "17.7-dev32" +#define VERSION_NUMBER "17.7-dev33" __declspec(selectany) const char* VERSION_NUMBER_STR = VERSION_NUMBER; extern bool FeatureLevel10Compatibility; @@ -53,4 +53,17 @@ void DebugWrite_i( LPCSTR lpDebugMessage, void* thisptr ); /** Computes the size in bytes of the given FVF */ int ComputeFVFSize( DWORD fvf ); +inline unsigned short quantizeHalfFloat( float v ) +{ + union { float f; unsigned int ui; } u = { v }; + unsigned int ui = u.ui; + int s = (ui >> 16) & 0x8000; + int em = ui & 0x7fffffff; + + int h = (em - (112 << 23) + (1 << 12)) >> 13; + h = (em < (113 << 23)) ? 0 : h; + h = (em >= (143 << 23)) ? 0x7c00 : h; + h = (em > ( 255 << 23 )) ? 0x7e00 : h; + return (unsigned short)(s | h); +}