Add test-case for force depth bug

This commit is contained in:
Nite Luo 2015-01-29 00:21:33 -08:00
parent 3e1b25347d
commit 995b7225dd
2 changed files with 47 additions and 1 deletions

View File

@ -70,7 +70,8 @@ static std::function<Layer*()> createFunctions[] =
CL(Sprite3DMirrorTest), CL(Sprite3DMirrorTest),
CL(QuaternionTest), CL(QuaternionTest),
CL(Sprite3DEmptyTest), CL(Sprite3DEmptyTest),
CL(UseCaseSprite3D) CL(UseCaseSprite3D),
CL(Sprite3DForceDepthTest)
}; };
#define MAX_LAYER (sizeof(createFunctions) / sizeof(createFunctions[0])) #define MAX_LAYER (sizeof(createFunctions) / sizeof(createFunctions[0]))
@ -156,6 +157,42 @@ void Sprite3DTestDemo::backCallback(Ref* sender)
s->release(); s->release();
} }
//------------------------------------------------------------------
//
// Sprite3DForceDepthTest
//
//------------------------------------------------------------------
Sprite3DForceDepthTest::Sprite3DForceDepthTest()
{
auto orc = Sprite3D::create("Sprite3DTest/orc.c3b");
orc->setScale(5);
orc->setNormalizedPosition(Vec2(.5,.3));
orc->setPositionZ(40);
orc->setRotation3D(Vec3(0,180,0));
orc->setGlobalZOrder(-1);
addChild(orc);
auto ship = Sprite3D::create("Sprite3DTest/boss1.obj");
ship->setScale(5);
ship->setTexture("Sprite3DTest/boss.png");
ship->setNormalizedPosition(Vec2(.5,.5));
ship->setRotation3D(Vec3(90,0,0));
ship->setForceDepthWrite(true);
addChild(ship);
}
std::string Sprite3DForceDepthTest::title() const
{
return "Force Depth Write Test";
}
std::string Sprite3DForceDepthTest::subtitle() const
{
return "Ship should always appear behind orc";
}
//------------------------------------------------------------------ //------------------------------------------------------------------
// //
// Sprite3DEmptyTest // Sprite3DEmptyTest

View File

@ -54,6 +54,15 @@ public:
virtual void onEnter() override; virtual void onEnter() override;
}; };
class Sprite3DForceDepthTest : public Sprite3DTestDemo
{
public:
CREATE_FUNC(Sprite3DForceDepthTest);
Sprite3DForceDepthTest();
virtual std::string title() const override;
virtual std::string subtitle() const override;
};
class Sprite3DEmptyTest : public Sprite3DTestDemo class Sprite3DEmptyTest : public Sprite3DTestDemo
{ {
public: public: