refactor rendering

This commit is contained in:
2025-07-16 13:38:02 +02:00
parent 1bee6aed9c
commit 9667454811
14 changed files with 130 additions and 105 deletions

View File

@@ -0,0 +1,21 @@
#include <td/render/shader/CameraShaderProgram.h>
namespace td {
namespace shader {
void CameraShaderProgram::SetProjectionMatrix(const Mat4f& proj) const {
LoadMat4(m_LocationProjection, proj);
}
void CameraShaderProgram::SetViewMatrix(const Mat4f& view) const {
LoadMat4(m_LocationView, view);
}
void CameraShaderProgram::GetAllUniformLocation() {
m_LocationProjection = static_cast<unsigned int>(GetUniformLocation("projectionMatrix"));
m_LocationView = static_cast<unsigned int>(GetUniformLocation("viewMatrix"));
}
} // namespace shader
} // namespace td

View File

@@ -81,22 +81,9 @@ void main(void){
)";
#endif
WorldShader::WorldShader() : ShaderProgram() {
WorldShader::WorldShader() : CameraShaderProgram() {
ShaderProgram::LoadProgram(vertexSource, fragmentSource);
}
void WorldShader::GetAllUniformLocation() {
m_LocationProjection = static_cast<unsigned int>(GetUniformLocation("projectionMatrix"));
m_LocationView = static_cast<unsigned int>(GetUniformLocation("viewMatrix"));
}
void WorldShader::SetProjectionMatrix(const Mat4f& proj) const {
LoadMat4(m_LocationProjection, proj);
}
void WorldShader::SetViewMatrix(const Mat4f& view) const {
LoadMat4(m_LocationView, view);
}
} // namespace shader
} // namespace td