closed #4761, fix zfighting between tests

This commit is contained in:
andyque 2014-04-11 16:30:25 +08:00
parent 588d825691
commit 4be149e492
4 changed files with 11 additions and 0 deletions

View File

@ -1053,6 +1053,7 @@ void CameraTest1::onEnter()
void CameraTest1::onExit() void CameraTest1::onExit()
{ {
Director::getInstance()->setProjection(_preProjection); Director::getInstance()->setProjection(_preProjection);
Director::getInstance()->setDepthTest(false);
TestCocosNodeDemo::onExit(); TestCocosNodeDemo::onExit();
} }
@ -1100,6 +1101,7 @@ void CameraTest2::onEnter()
void CameraTest2::onExit() void CameraTest2::onExit()
{ {
Director::getInstance()->setProjection(_preProjection); Director::getInstance()->setProjection(_preProjection);
Director::getInstance()->setDepthTest(false);
TestCocosNodeDemo::onExit(); TestCocosNodeDemo::onExit();
} }

View File

@ -118,6 +118,11 @@ void TileDemo::onEnter()
BaseTest::onEnter(); BaseTest::onEnter();
} }
void TileMapTestScene::onExit()
{
Layer::onExit();
Director::getInstance()->setDepthTest(false);
}
void TileDemo::restartCallback(Ref* sender) void TileDemo::restartCallback(Ref* sender)
{ {
auto s = new TileMapTestScene(); auto s = new TileMapTestScene();
@ -166,6 +171,7 @@ void TileMapTestScene::runThisTest()
Director::getInstance()->replaceScene(this); Director::getInstance()->replaceScene(this);
} }
//------------------------------------------------------------------ //------------------------------------------------------------------
// //
// TileMapTest // TileMapTest

View File

@ -14,6 +14,7 @@ public:
virtual std::string title() const override; virtual std::string title() const override;
virtual std::string subtitle() const override; virtual std::string subtitle() const override;
virtual void onEnter() override; virtual void onEnter() override;
virtual void onExit()override;
void restartCallback(Ref* sender); void restartCallback(Ref* sender);
void nextCallback(Ref* sender); void nextCallback(Ref* sender);

View File

@ -380,6 +380,7 @@ void TestLayer1::onExitTransitionDidStart()
void TestLayer1::onExit() void TestLayer1::onExit()
{ {
Layer::onExit(); Layer::onExit();
Director::getInstance()->setDepthTest(false);
log("Scene 1 onExit"); log("Scene 1 onExit");
} }
@ -509,5 +510,6 @@ void TestLayer2::onExitTransitionDidStart()
void TestLayer2::onExit() void TestLayer2::onExit()
{ {
Layer::onExit(); Layer::onExit();
Director::getInstance()->setDepthTest(false);
log("Scene 2 onExit"); log("Scene 2 onExit");
} }