Commit d2b1cd65 authored by chili's avatar chili
Browse files

view space normal object space map

parent 617483fa
...@@ -17,6 +17,12 @@ cbuffer ObjectCBuf ...@@ -17,6 +17,12 @@ cbuffer ObjectCBuf
float padding[1]; float padding[1];
}; };
cbuffer TransformCBuf
{
matrix modelView;
matrix modelViewProj;
};
Texture2D tex; Texture2D tex;
Texture2D nmap : register(t2); Texture2D nmap : register(t2);
...@@ -33,6 +39,7 @@ float4 main( float3 viewPos : Position,float3 n : Normal,float2 tc : Texcoord ) ...@@ -33,6 +39,7 @@ float4 main( float3 viewPos : Position,float3 n : Normal,float2 tc : Texcoord )
n.x = normalSample.x * 2.0f - 1.0f; n.x = normalSample.x * 2.0f - 1.0f;
n.y = -normalSample.y * 2.0f + 1.0f; n.y = -normalSample.y * 2.0f + 1.0f;
n.z = -normalSample.z; n.z = -normalSample.z;
n = mul(n, (float3x3) modelView);
} }
// fragment to light vector data // fragment to light vector data
const float3 vToL = lightPos - viewPos; const float3 vToL = lightPos - viewPos;
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
#include "Plane.h" #include "Plane.h"
#include "BindableCommon.h" #include "BindableCommon.h"
#include "imgui/imgui.h" #include "imgui/imgui.h"
#include "TransformCbufDoubleboi.h"
TestPlane::TestPlane( Graphics& gfx,float size ) TestPlane::TestPlane( Graphics& gfx,float size )
{ {
...@@ -29,7 +30,7 @@ TestPlane::TestPlane( Graphics& gfx,float size ) ...@@ -29,7 +30,7 @@ TestPlane::TestPlane( Graphics& gfx,float size )
AddBind( Topology::Resolve( gfx,D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST ) ); AddBind( Topology::Resolve( gfx,D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST ) );
AddBind( std::make_shared<TransformCbuf>( gfx,*this ) ); AddBind( std::make_shared<TransformCbufDoubleboi>( gfx,*this,0u,2u ) );
} }
void TestPlane::SetPos( DirectX::XMFLOAT3 pos ) noexcept void TestPlane::SetPos( DirectX::XMFLOAT3 pos ) noexcept
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment