void CameraPathControls::draw(const mat4& projection, const mat4 views[], const vec3& lightPositionWorld, const int& selectedControlPoint, float deltaT) const { /// Common drawing. predraw(); /// Update the model matrix. static float angle = 1.0f; angle += deltaT * 1.0f; mat4 rotationMatrix = mat4::Identity(); rotationMatrix(0,0) = +std::cos(angle); rotationMatrix(0,1) = -std::sin(angle); rotationMatrix(1,0) = +std::sin(angle); rotationMatrix(1,1) = +std::cos(angle); /// Update the content of the uniforms. glUniformMatrix4fv( _projectionID, 1, GL_FALSE, projection.data()); glUniformMatrix4fv( _viewID, 1, GL_FALSE, views[0].data()); glUniform3fv(_lightPositionWorldID, 1, lightPositionWorld.data()); glUniform1i( _selectedControlPointID, selectedControlPoint); glUniformMatrix4fv(_rotationMatrixID, 1, GL_FALSE, rotationMatrix.data()); /// Render from camera point of view to 'normal' FBOs. glBindFramebuffer(GL_FRAMEBUFFER, framebufferIDs["controllerView"]); _vertices->draw(); }
void Program::setUniformDirectly(int nLoc, uint32_t type, const mat4& value) { #if !defined(ET_CONSOLE_APPLICATION) if (nLoc == -1) return; (void)type; ET_ASSERT(type == GL_FLOAT_MAT4); ET_ASSERT(apiHandleValid()); glUniformMatrix4fv(nLoc, 1, 0, value.data()); checkOpenGLError("glUniformMatrix4fv"); #endif }
void Program::setUniform(int nLoc, uint32_t type, const mat4& value, bool forced) { if (nLoc == -1) return; (void)type; assert(type == GL_FLOAT_MAT4); assert(loaded()); if (forced || ((_mat4Cache.count(nLoc) == 0) || (_mat4Cache[nLoc] != value))) { _mat4Cache[nLoc] = value; glUniformMatrix4fv(nLoc, 1, 0, value.data()); } checkOpenGLError("setUniform - mat4"); }
void Program::setUniform(int nLoc, uint32_t type, const mat4& value, bool forced) { #if !defined(ET_CONSOLE_APPLICATION) if (nLoc == -1) return; (void)type; ET_ASSERT(type == GL_FLOAT_MAT4); ET_ASSERT(apiHandleValid()); if (forced || ((_mat4Cache.count(nLoc) == 0) || (_mat4Cache[nLoc] != value))) { _mat4Cache[nLoc] = value; glUniformMatrix4fv(nLoc, 1, 0, value.data()); checkOpenGLError("glUniformMatrix4fv"); } #endif }