Fix camera orbit testcase

This commit is contained in:
ZhangMenghe 2015-08-11 15:13:11 +08:00
parent 0f3a2ca642
commit 417652cbbd
1 changed files with 6 additions and 2 deletions

View File

@ -502,6 +502,7 @@ var NodeToWorld = TestNodeDemo.extend({
}); });
var CameraOrbitTest = TestNodeDemo.extend({ var CameraOrbitTest = TestNodeDemo.extend({
_preProjection : null,
ctor:function () { ctor:function () {
//----start11----ctor //----start11----ctor
this._super(); this._super();
@ -513,7 +514,7 @@ var CameraOrbitTest = TestNodeDemo.extend({
p.opacity = 128; p.opacity = 128;
// LEFT // LEFT
var sw = p.width, sh = p.height; var sw = p.getContentSize().width, sh = p.getContentSize().height;
var sprite = new cc.Sprite(s_pathGrossini); var sprite = new cc.Sprite(s_pathGrossini);
sprite.scale = 0.5; sprite.scale = 0.5;
p.addChild(sprite, 0); p.addChild(sprite, 0);
@ -550,12 +551,15 @@ var CameraOrbitTest = TestNodeDemo.extend({
onEnter:function () { onEnter:function () {
//----start11----onEnter //----start11----onEnter
this._super(); this._super();
this._preProjection = director.getProjection();
director.setDepthTest(true);
director.setProjection(cc.Director.PROJECTION_3D); director.setProjection(cc.Director.PROJECTION_3D);
//----end11---- //----end11----
}, },
onExit:function () { onExit:function () {
//----start11----onExit //----start11----onExit
director.setProjection(cc.Director.PROJECTION_2D); director.setDepthTest(false);
director.setProjection(this._preProjection);
this._super(); this._super();
//----end11---- //----end11----
}, },