Make use of UniformCache in many Renderables and switch from setUniform(const std::string&, ...) to setUniform(GLint, ...) in those cases

This commit is contained in:
Alexander Bock
2017-12-31 17:31:10 -05:00
parent 8ea5837f00
commit 47233b8e6f
41 changed files with 1329 additions and 855 deletions
+19 -3
View File
@@ -72,6 +72,16 @@ void PointGlobe::initialize() {
absPath("${MODULE_GLOBEBROWSING}/shaders/pointglobe_fs.glsl")
);
_uniformCache.lightIntensityClamped = _programObject->uniformLocation(
"lightIntensityClamped"
);
_uniformCache.modelView = _programObject->uniformLocation(
"modelViewTransform"
);
_uniformCache.projection = _programObject->uniformLocation(
"projectionTransform"
);
glGenVertexArrays(1, &_vaoID);
glGenBuffers(1, &_vertexBufferID);
@@ -145,12 +155,18 @@ void PointGlobe::render(const RenderData& data, RendererTasks&) {
glm::dmat4 modelViewTransform = data.camera.combinedViewMatrix() * modelTransform;
_programObject->setUniform("lightIntensityClamped", lightIntensityClamped);
_programObject->setUniform(
_uniformCache.lightIntensityClamped,
lightIntensityClamped
);
//_programObject->setUniform("lightOverflow", lightOverflow);
//_programObject->setUniform("directionToSunViewSpace", directionToSunViewSpace);
_programObject->setUniform("modelViewTransform", glm::mat4(modelViewTransform));
_programObject->setUniform(
"projectionTransform",
_uniformCache.modelView,
glm::mat4(modelViewTransform)
);
_programObject->setUniform(
_uniformCache.projection,
data.camera.sgctInternal.projectionMatrix()
);