Skyboxes now use Renderer ViewMatrix

instead of camera's one


Former-commit-id: ba78dd0c5a00a71f933b7f7e091d6d48f58827e9
This commit is contained in:
Lynix 2013-06-10 16:43:43 +02:00
parent 28175f3170
commit 97b2e90fb9
1 changed files with 2 additions and 4 deletions

View File

@ -204,9 +204,7 @@ void NzSkyboxBackground::Draw(const NzScene* scene) const
nzUInt8 textureUnit; nzUInt8 textureUnit;
m_shader->SendTexture(m_shader->GetUniformLocation("Skybox"), m_texture, &textureUnit); m_shader->SendTexture(m_shader->GetUniformLocation("Skybox"), m_texture, &textureUnit);
const NzCamera* camera = scene->GetActiveCamera(); const NzMatrix4f& viewMatrix = NzRenderer::GetMatrix(nzMatrixType_View);
const NzMatrix4f& viewMatrix = camera->GetViewMatrix();
NzMatrix4f skyboxMatrix(viewMatrix); NzMatrix4f skyboxMatrix(viewMatrix);
skyboxMatrix.SetTranslation(NzVector3f::Zero()); skyboxMatrix.SetTranslation(NzVector3f::Zero());
@ -219,7 +217,7 @@ void NzSkyboxBackground::Draw(const NzScene* scene) const
NzRenderer::SetFaceFilling(nzFaceFilling_Fill); NzRenderer::SetFaceFilling(nzFaceFilling_Fill);
NzRenderer::SetIndexBuffer(m_indexBuffer); NzRenderer::SetIndexBuffer(m_indexBuffer);
NzRenderer::SetMatrix(nzMatrixType_View, skyboxMatrix); NzRenderer::SetMatrix(nzMatrixType_View, skyboxMatrix);
NzRenderer::SetMatrix(nzMatrixType_World, NzMatrix4f::Scale(NzVector3f(camera->GetZNear()))); NzRenderer::SetMatrix(nzMatrixType_World, NzMatrix4f::Scale(NzVector3f(scene->GetActiveCamera()->GetZNear())));
NzRenderer::SetShader(m_shader); NzRenderer::SetShader(m_shader);
NzRenderer::SetTextureSampler(textureUnit, m_sampler); NzRenderer::SetTextureSampler(textureUnit, m_sampler);
NzRenderer::SetVertexBuffer(m_vertexBuffer); NzRenderer::SetVertexBuffer(m_vertexBuffer);