Merge pull request #4735 from dabingnn/develop_transitionPageTurn

migration transition page turn to new renderer
This commit is contained in:
minggo 2013-12-29 23:25:38 -08:00
commit b474f7ca0e
2 changed files with 35 additions and 8 deletions

View File

@ -30,6 +30,7 @@ THE SOFTWARE.
#include "CCActionGrid.h" #include "CCActionGrid.h"
#include "CCActionPageTurn3D.h" #include "CCActionPageTurn3D.h"
#include "CCNodeGrid.h" #include "CCNodeGrid.h"
#include "renderer/CCRenderer.h"
NS_CC_BEGIN NS_CC_BEGIN
@ -78,24 +79,43 @@ void TransitionPageTurn::sceneOrder()
_isInSceneOnTop = _back; _isInSceneOnTop = _back;
} }
void TransitionPageTurn::onEnablePolygonOffset()
{
glEnable(GL_POLYGON_OFFSET_FILL);
glPolygonOffset(POLYGON_OFFSET_FACTOR, POLYGON_OFFSET_UNITS);
}
void TransitionPageTurn::onDisablePolygonOffset()
{
glDisable(GL_POLYGON_OFFSET_FILL);
glPolygonOffset(0, 0);
}
void TransitionPageTurn::draw() void TransitionPageTurn::draw()
{ {
Scene::draw(); Scene::draw();
if( _isInSceneOnTop ) { if( _isInSceneOnTop ) {
_outSceneProxy->visit(); _outSceneProxy->visit();
glEnable(GL_POLYGON_OFFSET_FILL); _enableOffsetCmd.init(0, _vertexZ);
glPolygonOffset(POLYGON_OFFSET_FACTOR, POLYGON_OFFSET_UNITS); _enableOffsetCmd.func = CC_CALLBACK_0(TransitionPageTurn::onEnablePolygonOffset, this);
Director::getInstance()->getRenderer()->addCommand(&_enableOffsetCmd);
_inSceneProxy->visit(); _inSceneProxy->visit();
glDisable(GL_POLYGON_OFFSET_FILL); _disableOffsetCmd.init(0, _vertexZ);
glPolygonOffset(0, 0); _disableOffsetCmd.func = CC_CALLBACK_0(TransitionPageTurn::onDisablePolygonOffset, this);
Director::getInstance()->getRenderer()->addCommand(&_disableOffsetCmd);
} else { } else {
_inSceneProxy->visit(); _inSceneProxy->visit();
glEnable(GL_POLYGON_OFFSET_FILL);
glPolygonOffset(POLYGON_OFFSET_FACTOR, POLYGON_OFFSET_UNITS); _enableOffsetCmd.init(0, _vertexZ);
_enableOffsetCmd.func = CC_CALLBACK_0(TransitionPageTurn::onEnablePolygonOffset, this);
Director::getInstance()->getRenderer()->addCommand(&_enableOffsetCmd);
_outSceneProxy->visit(); _outSceneProxy->visit();
glDisable(GL_POLYGON_OFFSET_FILL);
glPolygonOffset(0, 0); _disableOffsetCmd.init(0, _vertexZ);
_disableOffsetCmd.func = CC_CALLBACK_0(TransitionPageTurn::onDisablePolygonOffset, this);
Director::getInstance()->getRenderer()->addCommand(&_disableOffsetCmd);
} }
} }

View File

@ -27,6 +27,7 @@ THE SOFTWARE.
#define __CCPAGE_TURN_TRANSITION_H__ #define __CCPAGE_TURN_TRANSITION_H__
#include "CCTransition.h" #include "CCTransition.h"
#include "renderer/CCCustomCommand.h"
NS_CC_BEGIN NS_CC_BEGIN
@ -96,6 +97,12 @@ protected:
bool _back; bool _back;
static float POLYGON_OFFSET_FACTOR; static float POLYGON_OFFSET_FACTOR;
static float POLYGON_OFFSET_UNITS; static float POLYGON_OFFSET_UNITS;
protected:
CustomCommand _enableOffsetCmd;
CustomCommand _disableOffsetCmd;
void onEnablePolygonOffset();
void onDisablePolygonOffset();
}; };
// end of transition group // end of transition group