Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- glm::mat4 billboardMVMatrix(glm::mat4 mvmatrix, glm::vec3 scale) {
- // Column 0:
- mvmatrix[0][0] = scale[0];
- mvmatrix[0][1] = 0;
- mvmatrix[0][2] = 0;
- // Column 1:
- mvmatrix[1][0] = 0;
- mvmatrix[1][1] = scale[1];
- mvmatrix[1][2] = 0;
- // Column 2:
- mvmatrix[2][0] = 0;
- mvmatrix[2][1] = 0;
- mvmatrix[2][2] = scale[2];
- return mvmatrix;
- }
- glm::mat4 tmp = ss->m_activeCamera->getVM() * spark->m_modelMatrix;
- uniform = glGetUniformLocation(ss->m_activeShader->m_programObject, "MVMatrix");
- glUniformMatrix4fv(uniform, 1, GL_FALSE, (float*)&(this->billboardMVMatrix(tmp, spark->scale))[0]);
- // Shader
- #version 330 core //compatibility
- layout(location = 0) in vec3 VertexPosition;
- // layout(location = 1) in vec3 VertexNormal;
- layout(location = 2) in vec2 VertexTex;
- uniform mat4 PMatrix; //Camera projection matrix
- uniform mat4 MVMatrix; //VMatrix * Model matrix
- out vec2 textureCoords;
- void main()
- {
- gl_Position = PMatrix * MVMatrix * vec4(VertexPosition, 1.0);
- textureCoords = VertexTex.xy;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement