summaryrefslogtreecommitdiff
path: root/themes/LeafParticleRender.cpp
diff options
context:
space:
mode:
authormattkae <mattkae@protonmail.com>2022-01-16 18:32:50 -0500
committermattkae <mattkae@protonmail.com>2022-01-16 18:32:50 -0500
commit1d47e3aa120539e053ffa41293f3f756b9d07844 (patch)
tree864069813b642d7634f83b6a8843c3d23a8d4926 /themes/LeafParticleRender.cpp
parenteef48388c610bf37b07aedef03c55344d450386b (diff)
Successful beginnings of the winter theme
Diffstat (limited to 'themes/LeafParticleRender.cpp')
-rw-r--r--themes/LeafParticleRender.cpp19
1 files changed, 12 insertions, 7 deletions
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
+}