stuff
This commit is contained in:
+8
-11
@@ -66,10 +66,12 @@ public:
|
||||
public:
|
||||
std::vector<Particle*> particles;
|
||||
|
||||
Texture* tex;
|
||||
SurfaceTexture surface;
|
||||
|
||||
Mesh* mesh;
|
||||
|
||||
|
||||
unsigned int instanceBuffer = 0;
|
||||
|
||||
ParticleEmitter() {
|
||||
shadertype = ParticleShader;
|
||||
mesh = new Mesh(quadVertices3D, quadIndices3D);
|
||||
@@ -81,6 +83,7 @@ public:
|
||||
}
|
||||
|
||||
~ParticleEmitter() {
|
||||
if (instanceBuffer != 0) glDeleteBuffers(1, &instanceBuffer);
|
||||
mesh->Delete();
|
||||
}
|
||||
|
||||
@@ -131,13 +134,8 @@ public:
|
||||
|
||||
ShaderProgram.Set4F("color",color);
|
||||
|
||||
glActiveTexture(0);
|
||||
surface.Apply(ShaderProgram, 0, size);
|
||||
|
||||
if (tex != nullptr) {
|
||||
glBindTexture(GL_TEXTURE_2D, tex->ID);
|
||||
ShaderProgram.SetInt("tex", 0);
|
||||
}
|
||||
else glBindTexture(GL_TEXTURE_2D, 0);
|
||||
std::vector<glm::mat4> matrices;
|
||||
|
||||
if (color.w != 1.0f) {
|
||||
@@ -167,9 +165,8 @@ public:
|
||||
}
|
||||
}
|
||||
}
|
||||
unsigned int buffer;
|
||||
glGenBuffers(1, &buffer);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, buffer);
|
||||
if (instanceBuffer == 0) glGenBuffers(1, &instanceBuffer);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, instanceBuffer);
|
||||
glBufferData(GL_ARRAY_BUFFER, particles.size() * sizeof(glm::mat4), &matrices[0], GL_STATIC_DRAW);
|
||||
|
||||
mesh->vao.Bind();
|
||||
|
||||
Reference in New Issue
Block a user