Only add buffer/tex to skymap if asked for

This commit is contained in:
Zach Pomerantz 2016-03-10 22:52:44 -08:00
parent 25607709a5
commit 4dad797e20

View file

@ -50,12 +50,16 @@ void Skybox::updateSchemaBuffer() const {
} }
void Skybox::prepare(gpu::Batch& batch, int textureSlot, int bufferSlot) const { void Skybox::prepare(gpu::Batch& batch, int textureSlot, int bufferSlot) const {
batch.setUniformBuffer(bufferSlot, _schemaBuffer); if (bufferSlot > -1) {
batch.setUniformBuffer(bufferSlot, _schemaBuffer);
}
gpu::TexturePointer skymap = getCubemap(); if (textureSlot > -1) {
// FIXME: skymap->isDefined may not be threadsafe gpu::TexturePointer skymap = getCubemap();
if (skymap && skymap->isDefined()) { // FIXME: skymap->isDefined may not be threadsafe
batch.setResourceTexture(textureSlot, skymap); if (skymap && skymap->isDefined()) {
batch.setResourceTexture(textureSlot, skymap);
}
} }
} }