diff --git a/interface/src/ui/overlays/Circle3DOverlay.cpp b/interface/src/ui/overlays/Circle3DOverlay.cpp index d8b481d75f..034095291f 100644 --- a/interface/src/ui/overlays/Circle3DOverlay.cpp +++ b/interface/src/ui/overlays/Circle3DOverlay.cpp @@ -113,7 +113,7 @@ void Circle3DOverlay::render(RenderArgs* args) { auto& batch = *args->_batch; batch._glLineWidth(_lineWidth); batch.setModelTransform(transform); - DependencyManager::get()->bindSimpleProgram(batch); + DependencyManager::get()->bindSimpleProgram(batch, false, false); // for our overlay, is solid means we draw a ring between the inner and outer radius of the circle, otherwise // we just draw a line... diff --git a/libraries/render-utils/src/DeferredLightingEffect.cpp b/libraries/render-utils/src/DeferredLightingEffect.cpp index f0a52af086..5ebd798c19 100644 --- a/libraries/render-utils/src/DeferredLightingEffect.cpp +++ b/libraries/render-utils/src/DeferredLightingEffect.cpp @@ -61,15 +61,26 @@ void DeferredLightingEffect::init(AbstractViewStateInterface* viewState) { gpu::Shader::BindingSet slotBindings; gpu::Shader::makeProgram(*program, slotBindings); gpu::Shader::makeProgram(*programTextured, slotBindings); - + gpu::StatePointer state = gpu::StatePointer(new gpu::State()); state->setCullMode(gpu::State::CULL_BACK); state->setDepthTest(true, true, gpu::LESS_EQUAL); state->setBlendFunction(false, gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA, gpu::State::FACTOR_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::ONE); + + + gpu::StatePointer stateCullNone = gpu::StatePointer(new gpu::State()); + stateCullNone->setCullMode(gpu::State::CULL_NONE); + stateCullNone->setDepthTest(true, true, gpu::LESS_EQUAL); + stateCullNone->setBlendFunction(false, + gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA, + gpu::State::FACTOR_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::ONE); + _simpleProgram = gpu::PipelinePointer(gpu::Pipeline::create(program, state)); + _simpleProgramCullNone = gpu::PipelinePointer(gpu::Pipeline::create(program, stateCullNone)); _simpleProgramTextured = gpu::PipelinePointer(gpu::Pipeline::create(programTextured, state)); + _simpleProgramTexturedCullNone = gpu::PipelinePointer(gpu::Pipeline::create(programTextured, stateCullNone)); _viewState = viewState; loadLightProgram(directional_light_frag, false, _directionalLight, _directionalLightLocations); @@ -106,13 +117,21 @@ void DeferredLightingEffect::init(AbstractViewStateInterface* viewState) { lp->setAmbientSpherePreset(gpu::SphericalHarmonics::Preset(_ambientLightMode % gpu::SphericalHarmonics::NUM_PRESET)); } -void DeferredLightingEffect::bindSimpleProgram(gpu::Batch& batch, bool textured) { +void DeferredLightingEffect::bindSimpleProgram(gpu::Batch& batch, bool textured, bool culled) { // DependencyManager::get()->setPrimaryDrawBuffers(batch, true, true, true); if (textured) { - batch.setPipeline(_simpleProgramTextured); + if (culled) { + batch.setPipeline(_simpleProgramTextured); + } else { + batch.setPipeline(_simpleProgramTexturedCullNone); + } } else { - batch.setPipeline(_simpleProgram); + if (culled) { + batch.setPipeline(_simpleProgram); + } else { + batch.setPipeline(_simpleProgramCullNone); + } } } diff --git a/libraries/render-utils/src/DeferredLightingEffect.h b/libraries/render-utils/src/DeferredLightingEffect.h index bd7fcb286b..e841fed321 100644 --- a/libraries/render-utils/src/DeferredLightingEffect.h +++ b/libraries/render-utils/src/DeferredLightingEffect.h @@ -34,7 +34,7 @@ public: void init(AbstractViewStateInterface* viewState); /// Sets up the state necessary to render static untextured geometry with the simple program. - void bindSimpleProgram(gpu::Batch& batch, bool textured = false); + void bindSimpleProgram(gpu::Batch& batch, bool textured = false, bool culled = true); /// Tears down the state necessary to render static untextured geometry with the simple program. void releaseSimpleProgram(gpu::Batch& batch); @@ -100,7 +100,9 @@ private: static void loadLightProgram(const char* fragSource, bool limited, ProgramObject& program, LightLocations& locations); gpu::PipelinePointer _simpleProgram; + gpu::PipelinePointer _simpleProgramCullNone; gpu::PipelinePointer _simpleProgramTextured; + gpu::PipelinePointer _simpleProgramTexturedCullNone; ProgramObject _directionalSkyboxLight; LightLocations _directionalSkyboxLightLocations;