mirror of https://github.com/axmolengine/axmol.git
Merge branch 'drawRefactor' into fixDepth
This commit is contained in:
commit
e6d0251b55
|
@ -318,7 +318,9 @@ void Grid3D::beforeBlit()
|
|||
if(_needDepthTestForBlit)
|
||||
{
|
||||
_oldDepthTestValue = glIsEnabled(GL_DEPTH_TEST);
|
||||
_oldDepthWriteValue = glIsEnabled(GL_DEPTH_WRITEMASK);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glDepthMask(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -330,6 +332,8 @@ void Grid3D::afterBlit()
|
|||
glEnable(GL_DEPTH_TEST);
|
||||
else
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
|
||||
glDepthMask(_oldDepthWriteValue);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -165,6 +165,7 @@ protected:
|
|||
GLushort *_indices;
|
||||
bool _needDepthTestForBlit;
|
||||
bool _oldDepthTestValue;
|
||||
bool _oldDepthWriteValue;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -712,6 +712,7 @@ void Director::setDepthTest(bool on)
|
|||
{
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
}
|
||||
_renderer->setDepthTest(on);
|
||||
CHECK_GL_ERROR_DEBUG();
|
||||
}
|
||||
|
||||
|
|
|
@ -147,6 +147,7 @@ Renderer::Renderer()
|
|||
,_numberQuads(0)
|
||||
,_glViewAssigned(false)
|
||||
,_isRendering(false)
|
||||
,_isDepthTestFor2D(false)
|
||||
#if CC_ENABLE_CACHE_TEXTURE_DATA
|
||||
,_cacheTextureListener(nullptr)
|
||||
#endif
|
||||
|
@ -494,6 +495,12 @@ void Renderer::visitRenderQueue(const RenderQueue& queue)
|
|||
glDisable(GL_DEPTH_TEST);
|
||||
}
|
||||
|
||||
if(_isDepthTestFor2D)
|
||||
{
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glDepthMask(true);
|
||||
}
|
||||
|
||||
//Process Transparent Object
|
||||
for (ssize_t index = queue.getOpaqueQueueSize(); index < size; ++index)
|
||||
{
|
||||
|
|
|
@ -129,6 +129,13 @@ public:
|
|||
/* clear draw stats */
|
||||
void clearDrawStats() { _drawnBatches = _drawnVertices = 0; }
|
||||
|
||||
/**
|
||||
* Enable/Disable depth test
|
||||
* For 3D object depth test is enabled by default and can not be changed
|
||||
* For 2D object depth test is disabled by default
|
||||
*/
|
||||
void setDepthTest(bool value) { _isDepthTestFor2D = value; }
|
||||
|
||||
inline GroupCommandManager* getGroupCommandManager() const { return _groupCommandManager; };
|
||||
|
||||
/** returns whether or not a rectangle is visible or not */
|
||||
|
@ -197,6 +204,8 @@ protected:
|
|||
//the flag for checking whether renderer is rendering
|
||||
bool _isRendering;
|
||||
|
||||
bool _isDepthTestFor2D;
|
||||
|
||||
GroupCommandManager* _groupCommandManager;
|
||||
|
||||
#if CC_ENABLE_CACHE_TEXTURE_DATA
|
||||
|
|
Loading…
Reference in New Issue