//----------------------------------------------------------------------------- // Class: DrawableInterface // Method: rotate // Description: Rotate the Drawable by a certain angle on every axis. //----------------------------------------------------------------------------- void DrawableInterface::rotate ( const GLfloat& angle, const std::array<float, 3>& axis ) { rotation_ *= glm::rotate(glm::mat4(1.0f), angle, glm::vec3(axis[0], axis[1], axis[2])); setMVP(true); } // ----- end of method DrawableInterface::rotate -----
//----------------------------------------------------------------------------- // Class: DrawableInterface // Method: setDrawState // Description: Collector function that groups functionality every draw call // needs. //----------------------------------------------------------------------------- void DrawableInterface::setDrawState () { // Bind the shader, recalculate the Modelview Projection matrix if // necessary and pass the MVP matrix to the GPU. shader_->bind(); setMVP(); shader_->setUniform("vMVP", mvp_); } // ----- end of method DrawableInterface::setDrawState -----
void CCDirector::setGLDefaultValues() { // This method SHOULD be called only after openGLView_ was initialized // CCAssert(m_pobOpenGLView, "opengl view should not be null"); // setAlphaBlending(true); // XXX: Fix me, should enable/disable depth test according the depth format as cocos2d-iphone did // [self setDepthTest: view_.depthFormat]; // setDepthTest(false); // setProjection(m_eProjection); setMVP(); // set other opengl default values glClearColor(0.0f, 0.0f, 0.0f, 1.0f); }
//----------------------------------------------------------------------------- // Class: DrawableInterface // Method: move // Description: Move the Drawable by a certain amount on every axis. //----------------------------------------------------------------------------- void DrawableInterface::move ( const GLfloat& x, const GLfloat& y, const GLfloat& z ) { translation_ *= glm::translate(glm::mat4(1.0f), glm::vec3(x, y, z)); setMVP(true); } // ----- end of method DrawableInterface::move -----