Remove duplicated and unused code
This commit is contained in:
parent
4573e51e98
commit
c7dbe715fc
@ -21,7 +21,6 @@
|
||||
#include "graphics/irr_driver.hpp"
|
||||
#include "graphics/material.hpp"
|
||||
#include "graphics/material_manager.hpp"
|
||||
#include "graphics/shared_gpu_objects.hpp"
|
||||
#include "utils/log.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
@ -64,16 +63,6 @@ public:
|
||||
}; // AlphaTestParticleRenderer
|
||||
|
||||
// ============================================================================
|
||||
CPUParticleManager::~CPUParticleManager()
|
||||
{
|
||||
for (auto& p : m_gl_particles)
|
||||
{
|
||||
glDeleteVertexArrays(1, &std::get<0>(p.second));
|
||||
glDeleteBuffers(1, &std::get<1>(p.second));
|
||||
}
|
||||
} // ~CPUParticleManager
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
void CPUParticleManager::addParticleNode(STKParticle* node)
|
||||
{
|
||||
if (node->getMaterialCount() != 1)
|
||||
@ -192,12 +181,6 @@ void CPUParticleManager::uploadAll()
|
||||
GL_DYNAMIC_DRAW);
|
||||
glGenVertexArrays(1, &std::get<0>(m_gl_particles[p.first]));
|
||||
glBindVertexArray(std::get<0>(m_gl_particles[p.first]));
|
||||
glBindBuffer(GL_ARRAY_BUFFER,
|
||||
SharedGPUObjects::getParticleQuadVBO());
|
||||
glEnableVertexAttribArray(4);
|
||||
glVertexAttribPointer(4, 4, GL_FLOAT, GL_FALSE, 16, 0);
|
||||
glEnableVertexAttribArray(3);
|
||||
glVertexAttribPointer(3, 2, GL_FLOAT, GL_FALSE, 16, (void*)8);
|
||||
glBindBuffer(GL_ARRAY_BUFFER,
|
||||
std::get<1>(m_gl_particles[p.first]));
|
||||
glEnableVertexAttribArray(0);
|
||||
@ -211,6 +194,11 @@ void CPUParticleManager::uploadAll()
|
||||
glVertexAttribPointer(2, 2, GL_HALF_FLOAT, GL_FALSE, 20,
|
||||
(void*)16);
|
||||
glVertexAttribDivisorARB(2, 1);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, m_particle_quad);
|
||||
glEnableVertexAttribArray(4);
|
||||
glVertexAttribPointer(4, 2, GL_FLOAT, GL_FALSE, 16, 0);
|
||||
glEnableVertexAttribArray(3);
|
||||
glVertexAttribPointer(3, 2, GL_FLOAT, GL_FALSE, 16, (void*)8);
|
||||
if (isFlipsMaterial(p.first))
|
||||
{
|
||||
glBindBuffer(GL_ARRAY_BUFFER, STKParticle::getFlipsBuffer());
|
||||
|
@ -91,15 +91,39 @@ private:
|
||||
|
||||
std::unordered_set<std::string> m_flips_material;
|
||||
|
||||
GLuint m_particle_quad;
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
bool isFlipsMaterial(const std::string& name)
|
||||
{ return m_flips_material.find(name) != m_flips_material.end(); }
|
||||
|
||||
public:
|
||||
// ------------------------------------------------------------------------
|
||||
CPUParticleManager() {}
|
||||
CPUParticleManager()
|
||||
{
|
||||
const float vertices[] =
|
||||
{
|
||||
-0.5f, 0.5f, 0.0f, 0.0f,
|
||||
0.5f, 0.5f, 1.0f, 0.0f,
|
||||
-0.5f, -0.5f, 0.0f, 1.0f,
|
||||
0.5f, -0.5f, 1.0f, 1.0f,
|
||||
};
|
||||
glGenBuffers(1, &m_particle_quad);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, m_particle_quad);
|
||||
glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices,
|
||||
GL_STATIC_DRAW);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
}
|
||||
// ------------------------------------------------------------------------
|
||||
~CPUParticleManager();
|
||||
~CPUParticleManager()
|
||||
{
|
||||
for (auto& p : m_gl_particles)
|
||||
{
|
||||
glDeleteVertexArrays(1, &std::get<0>(p.second));
|
||||
glDeleteBuffers(1, &std::get<1>(p.second));
|
||||
}
|
||||
glDeleteBuffers(1, &m_particle_quad);
|
||||
}
|
||||
// ------------------------------------------------------------------------
|
||||
void addParticleNode(STKParticle* node);
|
||||
// ------------------------------------------------------------------------
|
||||
|
@ -24,11 +24,9 @@
|
||||
#include "matrix4.h"
|
||||
#include <algorithm>
|
||||
|
||||
GLuint SharedGPUObjects::m_billboard_vbo;
|
||||
GLuint SharedGPUObjects::m_sky_tri_vbo;
|
||||
GLuint SharedGPUObjects::m_frustrum_vbo;
|
||||
GLuint SharedGPUObjects::m_frustrum_indices;
|
||||
GLuint SharedGPUObjects::m_particle_quad_vbo;
|
||||
GLuint SharedGPUObjects::m_View_projection_matrices_ubo;
|
||||
GLuint SharedGPUObjects::m_lighting_data_ubo;
|
||||
GLuint SharedGPUObjects::m_full_screen_quad_vao;
|
||||
@ -103,21 +101,6 @@ void SharedGPUObjects::initQuadBuffer()
|
||||
glBindVertexArray(0);
|
||||
} // initQuadBuffer
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
void SharedGPUObjects::initBillboardVBO()
|
||||
{
|
||||
float QUAD[] =
|
||||
{
|
||||
-.5, -.5, 0., 1.,
|
||||
-.5, .5, 0., 0.,
|
||||
.5, -.5, 1., 1.,
|
||||
.5, .5, 1., 0.,
|
||||
};
|
||||
glGenBuffers(1, &m_billboard_vbo);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, m_billboard_vbo);
|
||||
glBufferData(GL_ARRAY_BUFFER, 16 * sizeof(float), QUAD, GL_STATIC_DRAW);
|
||||
} // initBillboardVBO
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
void SharedGPUObjects::initSkyTriVBO()
|
||||
{
|
||||
@ -194,23 +177,6 @@ void SharedGPUObjects::initSkinningUBO()
|
||||
glBindBuffer(GL_UNIFORM_BUFFER, 0);
|
||||
} // initSkinningUBO
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
void SharedGPUObjects::initParticleQuadVBO()
|
||||
{
|
||||
static const GLfloat QUAD_VERTEX[] =
|
||||
{
|
||||
-.5, .5, 0., 0.,
|
||||
.5, .5, 1., 0.,
|
||||
-.5, -.5, 0., 1.,
|
||||
.5, -.5, 1., 1.,
|
||||
};
|
||||
glGenBuffers(1, &m_particle_quad_vbo);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, m_particle_quad_vbo);
|
||||
glBufferData(GL_ARRAY_BUFFER, sizeof(QUAD_VERTEX), QUAD_VERTEX,
|
||||
GL_STATIC_DRAW);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
} // initParticleQuadVBO
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
void SharedGPUObjects::init()
|
||||
{
|
||||
@ -218,11 +184,9 @@ void SharedGPUObjects::init()
|
||||
return;
|
||||
initQuadVBO();
|
||||
initQuadBuffer();
|
||||
initBillboardVBO();
|
||||
initSkyTriVBO();
|
||||
initFrustrumVBO();
|
||||
initParticleQuadVBO();
|
||||
|
||||
|
||||
if (CVS->isARBUniformBufferObjectUsable())
|
||||
{
|
||||
initShadowVPMUBO();
|
||||
|
@ -26,11 +26,9 @@ class SharedGPUObjects
|
||||
{
|
||||
private:
|
||||
static bool m_has_been_initialised;
|
||||
static GLuint m_billboard_vbo;
|
||||
static GLuint m_sky_tri_vbo;
|
||||
static GLuint m_frustrum_vbo;
|
||||
static GLuint m_frustrum_indices;
|
||||
static GLuint m_particle_quad_vbo;
|
||||
static GLuint m_View_projection_matrices_ubo;
|
||||
static GLuint m_lighting_data_ubo;
|
||||
static GLuint m_full_screen_quad_vao;
|
||||
@ -42,24 +40,16 @@ private:
|
||||
|
||||
static void initQuadVBO();
|
||||
static void initQuadBuffer();
|
||||
static void initBillboardVBO();
|
||||
static void initSkyTriVBO();
|
||||
static void initFrustrumVBO();
|
||||
static void initShadowVPMUBO();
|
||||
static void initLightingDataUBO();
|
||||
static void initParticleQuadVBO();
|
||||
static void initSkinningUBO();
|
||||
|
||||
public:
|
||||
static void init();
|
||||
static void reset();
|
||||
// ------------------------------------------------------------------------
|
||||
static GLuint getBillboardVBO()
|
||||
{
|
||||
assert(m_has_been_initialised);
|
||||
return m_billboard_vbo;
|
||||
} // getBillboardVBO
|
||||
// ------------------------------------------------------------------------
|
||||
static GLuint getSkyTriVBO()
|
||||
{
|
||||
assert(m_has_been_initialised);
|
||||
@ -78,12 +68,6 @@ public:
|
||||
return m_frustrum_indices;
|
||||
} // getFrustrumIndices
|
||||
// ------------------------------------------------------------------------
|
||||
static GLuint getParticleQuadVBO()
|
||||
{
|
||||
assert(m_has_been_initialised);
|
||||
return m_particle_quad_vbo;
|
||||
} // getParticleQuadVBO
|
||||
// ------------------------------------------------------------------------
|
||||
static GLuint getViewProjectionMatricesUBO()
|
||||
{
|
||||
assert(m_has_been_initialised);
|
||||
|
Loading…
x
Reference in New Issue
Block a user