2 Commits

2 changed files with 404 additions and 382 deletions

View File

@@ -186,14 +186,36 @@ TSE::Matrix4x4 BuildView_Zplus_RH(const TSE::Matrix4x4& world)
void TSE::Camera::PreDraw(IShader *shader)
{
rt->Bind();
shader->SetUniform("prMatrix", projectionMatrix);
// shader->SetUniform("prMatrix", projectionMatrix);
auto worlmatrix = baseObject->GetGlobalMatrix();
// auto worlmatrix = baseObject->GetGlobalMatrix();
viewMatrix = BuildView_Zplus_RH(worlmatrix);
// viewMatrix = BuildView_Zplus_RH(worlmatrix);
shader->SetUniform("camMatrix", &viewMatrix);
helper->OnRenderTargetChanged(lastRtSize.x, lastRtSize.y);
// shader->SetUniform("camMatrix", &viewMatrix);
// helper->OnRenderTargetChanged(lastRtSize.x, lastRtSize.y);
Vector3 pos = baseObject->GetGlobalPosition();
Vector3 right = baseObject->LocalToGlobalPosition(Vector3::right) - pos;
Vector3 up = baseObject->LocalToGlobalPosition(Vector3::up) - pos;
Vector3 forward = baseObject->LocalToGlobalPosition(Vector3::forward) - pos;
forward.Normalize();
shader->SetUniform("CamPos", &pos);
shader->SetUniform("CamRight", &right);
shader->SetUniform("CamUp", &up);
shader->SetUniform("CamForward", &forward);
float x = lastRtSize.x / RenderScale;
float y = lastRtSize.y / RenderScale;
float mx = -x;
float my = -y;
shader->SetUniform("OrthoLeft", mx);
shader->SetUniform("OrthoRight", x);
shader->SetUniform("OrthoBottom", my);
shader->SetUniform("OrthoTop", y);
shader->SetUniform("NearPlane", nearClippingPlane);
shader->SetUniform("FarPlane", farClippingPlane);
}
void TSE::Camera::PostDraw()

View File

@@ -105,7 +105,7 @@ void TSE::OpenGL::TextureHelperOpenGL::Apply3D(VolumeTexture3D *tex)
{
if(tex->bpp() == 32)
{
internal = GL_RGBA;
internal = GL_R16;
input = GL_BGRA;
size = GL_UNSIGNED_BYTE;
}
@@ -136,7 +136,7 @@ void TSE::OpenGL::TextureHelperOpenGL::Apply3D(VolumeTexture3D *tex)
);
}
glGenerateMipmap(GL_TEXTURE_3D);
//glGenerateMipmap(GL_TEXTURE_3D);
glBindTexture(GL_TEXTURE_3D, 0);
}