Merge pull request #6607 from imgntn/particle_system_visibility

Particle Systems Now Respect Visibility Setting
This commit is contained in:
Brad Hefta-Gaub 2015-12-10 07:49:54 -08:00
commit 0213426f0c

View file

@ -60,9 +60,6 @@ public:
void setTexture(gpu::TexturePointer texture) { _texture = texture; }
const gpu::TexturePointer& getTexture() const { return _texture; }
bool getVisibleFlag() const { return _visibleFlag; }
void setVisibleFlag(bool visibleFlag) { _visibleFlag = visibleFlag; }
void render(RenderArgs* args) const {
assert(_pipeline);
@ -81,23 +78,23 @@ public:
auto numIndices = _indexBuffer->getSize() / sizeof(uint16_t);
batch.drawIndexed(gpu::TRIANGLES, numIndices);
}
EntityItemPointer _entity;
protected:
EntityItemPointer _entity;
Transform _modelTransform;
AABox _bound;
gpu::PipelinePointer _pipeline;
gpu::Stream::FormatPointer _vertexFormat;
gpu::BufferPointer _vertexBuffer;
gpu::BufferPointer _indexBuffer;
gpu::TexturePointer _texture;
bool _visibleFlag = true;
gpu::TexturePointer _texture;
};
namespace render {
template <>
const ItemKey payloadGetKey(const ParticlePayload::Pointer& payload) {
if (payload->getVisibleFlag()) {
if (payload->_entity->getVisible()) {
return ItemKey::Builder::transparentShape();
} else {
return ItemKey::Builder().withInvisible().build();
@ -111,7 +108,10 @@ namespace render {
template <>
void payloadRender(const ParticlePayload::Pointer& payload, RenderArgs* args) {
payload->render(args);
if (payload->_entity->getVisible()) {
payload->render(args);
}
}
}