mirror of https://github.com/axmolengine/axmol.git
Merge pull request #4735 from dabingnn/develop_transitionPageTurn
migration transition page turn to new renderer
This commit is contained in:
commit
b474f7ca0e
|
@ -30,6 +30,7 @@ THE SOFTWARE.
|
|||
#include "CCActionGrid.h"
|
||||
#include "CCActionPageTurn3D.h"
|
||||
#include "CCNodeGrid.h"
|
||||
#include "renderer/CCRenderer.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
|
@ -78,24 +79,43 @@ void TransitionPageTurn::sceneOrder()
|
|||
_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()
|
||||
{
|
||||
Scene::draw();
|
||||
|
||||
if( _isInSceneOnTop ) {
|
||||
_outSceneProxy->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);
|
||||
_inSceneProxy->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);
|
||||
} else {
|
||||
_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();
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ THE SOFTWARE.
|
|||
#define __CCPAGE_TURN_TRANSITION_H__
|
||||
|
||||
#include "CCTransition.h"
|
||||
#include "renderer/CCCustomCommand.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
|
@ -96,6 +97,12 @@ protected:
|
|||
bool _back;
|
||||
static float POLYGON_OFFSET_FACTOR;
|
||||
static float POLYGON_OFFSET_UNITS;
|
||||
|
||||
protected:
|
||||
CustomCommand _enableOffsetCmd;
|
||||
CustomCommand _disableOffsetCmd;
|
||||
void onEnablePolygonOffset();
|
||||
void onDisablePolygonOffset();
|
||||
};
|
||||
|
||||
// end of transition group
|
||||
|
|
Loading…
Reference in New Issue