respect visibility yay

This commit is contained in:
James B. Pollack 2015-12-09 18:26:13 -08:00
parent b4c272aaa1
commit 4e93f3ae81

View file

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