void FireWorkEffect::render(Pipeline& p, Renderer* r) { p.pushMatrix(); p.translate(m_position); p.addMatrix(m_rotation); p.scale(m_scale); r->setUniLocs(p); glBindBuffer(GL_ARRAY_BUFFER, m_particleBuffer[m_currTFB]); glEnableVertexAttribArray(0); glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(FireWorkParticle), (const GLvoid*)4); // position glDrawTransformFeedback(GL_POINTS, m_transformFeedback[m_currTFB]); glDisableVertexAttribArray(0); p.popMatrix(); m_currVB = m_currTFB; m_currTFB = (m_currTFB + 1) & 0x1; }
void ThirdPersonCamera::updateViewMatrix(Pipeline& p) { p.setMatrixMode(VIEW_MATRIX); p.loadIdentity(); updateEyePos(); glm::vec3 up = glm::vec3(0.0f,1.0f,0.0f); lookAt(m_eye, m_target, up); m_viewMatrix = m_viewMatrix * glm::translate(0.0f, -m_eyeOffset.y, 0.0f); m_eye.y += m_eyeOffset.y; p.setMatrixMode(VIEW_MATRIX); p.addMatrix(m_viewMatrix); p.setViewPosition(m_eye); }