set depth write (#20071)

This commit is contained in:
coulsonwang 2019-09-04 10:02:03 +08:00 committed by minggo
parent 4d04b64a3a
commit 469fc61d5a
1 changed files with 6 additions and 0 deletions

View File

@ -565,12 +565,14 @@ void CameraOrbitTest::onEnter()
TestCocosNodeDemo::onEnter();
_preProjection = Director::getInstance()->getProjection();
Director::getInstance()->getRenderer()->setDepthTest(true);
Director::getInstance()->getRenderer()->setDepthWrite(true);
Director::getInstance()->setProjection(Director::Projection::_3D);
}
void CameraOrbitTest::onExit()
{
Director::getInstance()->getRenderer()->setDepthTest(false);
Director::getInstance()->getRenderer()->setDepthWrite(false);
Director::getInstance()->setProjection(_preProjection);
TestCocosNodeDemo::onExit();
}
@ -1035,12 +1037,14 @@ void CameraTest1::onEnter()
_preProjection = Director::getInstance()->getProjection();
Director::getInstance()->setProjection(Director::Projection::_3D);
Director::getInstance()->getRenderer()->setDepthTest(true);
Director::getInstance()->getRenderer()->setDepthWrite(true);
}
void CameraTest1::onExit()
{
Director::getInstance()->setProjection(_preProjection);
Director::getInstance()->getRenderer()->setDepthTest(false);
Director::getInstance()->getRenderer()->setDepthWrite(false);
TestCocosNodeDemo::onExit();
}
@ -1084,12 +1088,14 @@ void CameraTest2::onEnter()
_preProjection = Director::getInstance()->getProjection();
Director::getInstance()->setProjection(Director::Projection::_3D);
Director::getInstance()->getRenderer()->setDepthTest(true);
Director::getInstance()->getRenderer()->setDepthWrite(true);
}
void CameraTest2::onExit()
{
Director::getInstance()->setProjection(_preProjection);
Director::getInstance()->getRenderer()->setDepthTest(false);
Director::getInstance()->getRenderer()->setDepthWrite(false);
TestCocosNodeDemo::onExit();
}