Rename struct/Add type aliases

This commit is contained in:
Atlante45 2015-11-18 16:23:31 -08:00
parent ca17c75631
commit 61511d57bb
2 changed files with 19 additions and 17 deletions

View file

@ -32,20 +32,22 @@ public:
using Payload = render::Payload<ParticlePayload>; using Payload = render::Payload<ParticlePayload>;
using Pointer = Payload::DataPointer; using Pointer = Payload::DataPointer;
using ParticlePrimitive = RenderableParticleEffectEntityItem::ParticlePrimitive; using ParticlePrimitive = RenderableParticleEffectEntityItem::ParticlePrimitive;
using PipelinePointer = gpu::PipelinePointer;
using FormatPointer = gpu::Stream::FormatPointer;
using BufferPointer = gpu::BufferPointer;
using TexturePointer = gpu::TexturePointer;
using Format = gpu::Stream::Format;
using Buffer = gpu::Buffer;
ParticlePayload(EntityItemPointer entity) : ParticlePayload(EntityItemPointer entity) : _entity(entity) {
_entity(entity),
_vertexFormat(std::make_shared<gpu::Stream::Format>()),
_particleBuffer(std::make_shared<gpu::Buffer>()) {
_vertexFormat->setAttribute(gpu::Stream::POSITION, 0, gpu::Element::VEC4F_XYZW, _vertexFormat->setAttribute(gpu::Stream::POSITION, 0, gpu::Element::VEC4F_XYZW,
offsetof(ParticlePrimitive, xyzw), gpu::Stream::PER_INSTANCE); offsetof(ParticlePrimitive, xyzw), gpu::Stream::PER_INSTANCE);
_vertexFormat->setAttribute(gpu::Stream::COLOR, 0, gpu::Element::COLOR_RGBA_32, _vertexFormat->setAttribute(gpu::Stream::COLOR, 0, gpu::Element::COLOR_RGBA_32,
offsetof(ParticlePrimitive, rgba), gpu::Stream::PER_INSTANCE); offsetof(ParticlePrimitive, rgba), gpu::Stream::PER_INSTANCE);
} }
void setPipeline(gpu::PipelinePointer pipeline) { _pipeline = pipeline; } void setPipeline(PipelinePointer pipeline) { _pipeline = pipeline; }
const gpu::PipelinePointer& getPipeline() const { return _pipeline; } const PipelinePointer& getPipeline() const { return _pipeline; }
const Transform& getModelTransform() const { return _modelTransform; } const Transform& getModelTransform() const { return _modelTransform; }
void setModelTransform(const Transform& modelTransform) { _modelTransform = modelTransform; } void setModelTransform(const Transform& modelTransform) { _modelTransform = modelTransform; }
@ -53,11 +55,11 @@ public:
const AABox& getBound() const { return _bound; } const AABox& getBound() const { return _bound; }
void setBound(AABox& bound) { _bound = bound; } void setBound(AABox& bound) { _bound = bound; }
gpu::BufferPointer getParticleBuffer() { return _particleBuffer; } BufferPointer getParticleBuffer() { return _particleBuffer; }
const gpu::BufferPointer& getParticleBuffer() const { return _particleBuffer; } const BufferPointer& getParticleBuffer() const { return _particleBuffer; }
void setTexture(gpu::TexturePointer texture) { _texture = texture; } void setTexture(TexturePointer texture) { _texture = texture; }
const gpu::TexturePointer& getTexture() const { return _texture; } const TexturePointer& getTexture() const { return _texture; }
bool getVisibleFlag() const { return _visibleFlag; } bool getVisibleFlag() const { return _visibleFlag; }
void setVisibleFlag(bool visibleFlag) { _visibleFlag = visibleFlag; } void setVisibleFlag(bool visibleFlag) { _visibleFlag = visibleFlag; }
@ -84,10 +86,10 @@ protected:
EntityItemPointer _entity; EntityItemPointer _entity;
Transform _modelTransform; Transform _modelTransform;
AABox _bound; AABox _bound;
gpu::PipelinePointer _pipeline; PipelinePointer _pipeline;
gpu::Stream::FormatPointer _vertexFormat; FormatPointer _vertexFormat { std::make_shared<Format>() };
gpu::BufferPointer _particleBuffer; BufferPointer _particleBuffer { std::make_shared<Buffer>() };
gpu::TexturePointer _texture; TexturePointer _texture;
bool _visibleFlag = true; bool _visibleFlag = true;
}; };

View file

@ -36,11 +36,11 @@ protected:
glm::vec4 xyzw; // Position + radius glm::vec4 xyzw; // Position + radius
uint32_t rgba; // Color uint32_t rgba; // Color
}; };
using Particles = std::vector<ParticlePrimitive>; using ParticlePrimitives = std::vector<ParticlePrimitive>;
void createPipelines(); void createPipelines();
Particles _particlePrimitives; ParticlePrimitives _particlePrimitives;
gpu::PipelinePointer _untexturedPipeline; gpu::PipelinePointer _untexturedPipeline;
gpu::PipelinePointer _texturedPipeline; gpu::PipelinePointer _texturedPipeline;