From 1d47e3aa120539e053ffa41293f3f756b9d07844 Mon Sep 17 00:00:00 2001 From: mattkae Date: Sun, 16 Jan 2022 18:32:50 -0500 Subject: Successful beginnings of the winter theme --- themes/LeafParticleRender.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'themes/LeafParticleRender.cpp') diff --git a/themes/LeafParticleRender.cpp b/themes/LeafParticleRender.cpp index 2fc89ac..e1ed1ec 100644 --- a/themes/LeafParticleRender.cpp +++ b/themes/LeafParticleRender.cpp @@ -16,12 +16,12 @@ inline void updateLeaf(Renderer2dVertex* vertices, Vector2 position, Vector4 col Vector2 topLeft = Vector2(-radius, radius) + position; Vector2 topRight = Vector2(radius, radius) + position; - vertices[0] = { bottomLeft, color }; - vertices[1] = { bottomRight, color }; - vertices[2] = { topLeft, color }; - vertices[3] = { topLeft, color }; - vertices[4] = { topRight, color }; - vertices[5] = { bottomRight, color }; + vertices[0] = { bottomLeft, color, Mat4x4() }; + vertices[1] = { bottomRight, color, Mat4x4() }; + vertices[2] = { topLeft, color, Mat4x4() }; + vertices[3] = { topLeft, color, Mat4x4() }; + vertices[4] = { topRight, color, Mat4x4() }; + vertices[5] = { bottomRight, color, Mat4x4() }; } void LeafParticleRender::load(Renderer2d *renderer, TreeShapeLoadResult* lr) { @@ -58,6 +58,11 @@ void LeafParticleRender::load(Renderer2d *renderer, TreeShapeLoadResult* lr) { glEnableVertexAttribArray(renderer->attributes.color); glVertexAttribPointer(renderer->attributes.color, 4, GL_FLOAT, GL_FALSE, sizeof(Renderer2dVertex), (GLvoid *)offsetof(Renderer2dVertex, color)); + for (int32 idx = 0; idx < 4; idx++) { + glEnableVertexAttribArray(renderer->attributes.vMatrix + idx); + glVertexAttribPointer(renderer->attributes.vMatrix + idx, 4, GL_FLOAT, GL_FALSE, sizeof(Renderer2dVertex), (GLvoid *)(offsetof(Renderer2dVertex, vMatrix) + (idx * 16))); + } + glBindBuffer(GL_ARRAY_BUFFER, 0); glBindVertexArray(0); } @@ -158,4 +163,4 @@ void LeafParticleRender::unload() { delete [] vertices; elapsedTimeSeconds = 0; -} \ No newline at end of file +} -- cgit v1.2.1