float* GLQuadRenderer::createTextureBuffer(const Group& group) const { FloatBuffer* fbuffer = NULL; switch(texturingMode) { case TEXTURE_2D : fbuffer = dynamic_cast<FloatBuffer*>(group.createBuffer(TEXTURE_BUFFER_NAME,FloatBufferCreator(8),TEXTURE_2D,false)); if (!group.getModel()->isEnabled(PARAM_TEXTURE_INDEX)) { float t[8] = {1.0f,0.0f,0.0f,0.0f,0.0f,1.0f,1.0f,1.0f}; for (size_t i = 0; i < group.getParticles().getNbReserved() << 3; ++i) fbuffer->getData()[i] = t[i & 7]; } break; case TEXTURE_3D : fbuffer = dynamic_cast<FloatBuffer*>(group.createBuffer(TEXTURE_BUFFER_NAME,FloatBufferCreator(12),TEXTURE_3D,false)); float t[12] = {1.0f,0.0f,0.0f,0.0f,0.0f,0.0f,0.0f,1.0f,0.0f,1.0f,1.0f,0.0f}; for (size_t i = 0; i < group.getParticles().getNbReserved() * 12; ++i) fbuffer->getData()[i] = t[i % 12]; break; } return fbuffer->getData(); }
void GLQuadRenderer::createBuffers(const Group& group) { FloatBuffer* fBuffer = dynamic_cast<FloatBuffer*>(group.createBuffer(GPU_BUFFER_NAME,FloatBufferCreator(28),0,false)); gpuIterator = gpuBuffer = fBuffer->getData(); if (texturingMode != TEXTURE_NONE) textureIterator = textureBuffer = createTextureBuffer(group); }
bool GLLineRenderer::checkBuffers(const Group& group) { FloatBuffer* fBuffer; if ((fBuffer = dynamic_cast<FloatBuffer*>(group.getBuffer(GPU_BUFFER_NAME))) == NULL) return false; gpuIterator = gpuBuffer = fBuffer->getData(); return true; }
bool GLQuadRenderer::checkBuffers(const Group& group) { FloatBuffer* fGpuBuffer; if ((fGpuBuffer = dynamic_cast<FloatBuffer*>(group.getBuffer(GPU_BUFFER_NAME))) == NULL) return false; if (texturingMode != TEXTURE_NONE) { FloatBuffer* fTextureBuffer; if ((fTextureBuffer = dynamic_cast<FloatBuffer*>(group.getBuffer(TEXTURE_BUFFER_NAME,texturingMode))) == NULL) textureBuffer = createTextureBuffer(group); textureIterator = textureBuffer = fTextureBuffer->getData(); } gpuIterator = gpuBuffer = fGpuBuffer->getData(); return true; }
bool GLLineTrailRenderer::checkBuffers(const Group& group) { FloatBuffer* fVertexBuffer; FloatBuffer* fColorBuffer; FloatBuffer* fValueBuffer; if ((fVertexBuffer = dynamic_cast<FloatBuffer*>(group.getBuffer(VERTEX_BUFFER_NAME,nbSamples))) == NULL) return false; if ((fColorBuffer = dynamic_cast<FloatBuffer*>(group.getBuffer(COLOR_BUFFER_NAME,nbSamples))) == NULL) return false; if ((fValueBuffer = dynamic_cast<FloatBuffer*>(group.getBuffer(VALUE_BUFFER_NAME,nbSamples))) == NULL) return false; vertexIterator = vertexBuffer = fVertexBuffer->getData(); colorIterator = colorBuffer = fColorBuffer->getData(); valueIterator = valueBuffer = fValueBuffer->getData(); return true; }
void GLLineTrailRenderer::createBuffers(const Group& group) { FloatBuffer* fVertexBuffer = dynamic_cast<FloatBuffer*>(group.createBuffer(VERTEX_BUFFER_NAME,FloatBufferCreator((nbSamples + 2) * 3),nbSamples,true)); FloatBuffer* fColorBuffer = dynamic_cast<FloatBuffer*>(group.createBuffer(COLOR_BUFFER_NAME,FloatBufferCreator((nbSamples + 2) << 2),nbSamples,true)); FloatBuffer* fValueBuffer = dynamic_cast<FloatBuffer*>(group.createBuffer(VALUE_BUFFER_NAME,FloatBufferCreator(nbSamples),nbSamples,true)); vertexIterator = vertexBuffer = fVertexBuffer->getData(); colorIterator = colorBuffer = fColorBuffer->getData(); valueIterator = valueBuffer = fValueBuffer->getData(); // Fills the buffers with correct values for (size_t i = 0; i < group.getNbParticles(); ++i) { const Particle& particle = group.getParticle(i); init(particle,particle.getAge()); } // Resets the iterators at the beginning after the init vertexIterator = vertexBuffer; colorIterator = colorBuffer; valueIterator = valueBuffer; }
void GLLineRenderer::createBuffers(const Group& group) { FloatBuffer* fBuffer = dynamic_cast<FloatBuffer*>(group.createBuffer(GPU_BUFFER_NAME,FloatBufferCreator(14),0,false)); gpuIterator = gpuBuffer = fBuffer->getData(); }