refactor rendering
This commit is contained in:
21
src/td/render/shader/CameraShaderProgram.cpp
Normal file
21
src/td/render/shader/CameraShaderProgram.cpp
Normal 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
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user