Commit 9c50145e authored by chili's avatar chili
Browse files

put lightpos in camera ref frame > fixed spec but check diffuse...

parent f0ac931f
......@@ -53,7 +53,7 @@ void App::DoFrame()
const auto dt = timer.Mark() * speed_factor;
wnd.Gfx().BeginFrame( 0.07f,0.0f,0.12f );
wnd.Gfx().SetCamera( cam.GetMatrix() );
light.Bind( wnd.Gfx() );
light.Bind( wnd.Gfx(),cam.GetMatrix() );
for( auto& d : drawables )
{
......@@ -65,7 +65,7 @@ void App::DoFrame()
// imgui window to control simulation speed
if( ImGui::Begin( "Simulation Speed" ) )
{
ImGui::SliderFloat( "Speed Factor",&speed_factor,0.0f,4.0f );
ImGui::SliderFloat( "Speed Factor",&speed_factor,0.0f,6.0f,"%.4f",3.2f );
ImGui::Text( "%.3f ms/frame (%.1f FPS)",1000.0f / ImGui::GetIO().Framerate,ImGui::GetIO().Framerate );
ImGui::Text( "Status: %s",wnd.kbd.KeyIsPressed( VK_SPACE ) ? "PAUSED" : "RUNNING (hold spacebar to pause)" );
}
......
......@@ -55,8 +55,11 @@ void PointLight::Draw( Graphics& gfx ) const noexcept(!IS_DEBUG)
mesh.Draw( gfx );
}
void PointLight::Bind( Graphics& gfx ) const noexcept
void PointLight::Bind( Graphics& gfx,DirectX::FXMMATRIX view ) const noexcept
{
cbuf.Update( gfx,cbData );
auto dataCopy = cbData;
const auto pos = DirectX::XMLoadFloat3( &cbData.pos );
DirectX::XMStoreFloat3( &dataCopy.pos,DirectX::XMVector3Transform( pos,view ) );
cbuf.Update( gfx,dataCopy );
cbuf.Bind( gfx );
}
......@@ -10,7 +10,7 @@ public:
void SpawnControlWindow() noexcept;
void Reset() noexcept;
void Draw( Graphics& gfx ) const noexcept(!IS_DEBUG);
void Bind( Graphics& gfx ) const noexcept;
void Bind( Graphics& gfx,DirectX::FXMMATRIX view ) const noexcept;
private:
struct PointLightCBuf
{
......
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