void CCTMXLayer::parseInternalProperties() { // if cc_vertex=automatic, then tiles will be rendered using vertexz CCString *vertexz = propertyNamed("cc_vertexz"); if (vertexz) { // If "automatic" is on, then parse the "cc_alpha_func" too if (vertexz->m_sString == "automatic") { m_bUseAutomaticVertexZ = true; CCString *alphaFuncVal = propertyNamed("cc_alpha_func"); float alphaFuncValue = 0.0f; if (alphaFuncVal != NULL) { alphaFuncValue = alphaFuncVal->floatValue(); } setShaderProgram(CCShaderCache::sharedShaderCache()->programForKey(kCCShader_PositionTextureColorAlphaTest)); GLint alphaValueLocation = glGetUniformLocation(getShaderProgram()->getProgram(), kCCUniformAlphaTestValue); getShaderProgram()->use(); // NOTE: alpha test shader is hard-coded to use the equivalent of a glAlphaFunc(GL_GREATER) comparison getShaderProgram()->setUniformLocationWith1f(alphaValueLocation, alphaFuncValue); CHECK_GL_ERROR_DEBUG(); } else { m_nVertexZvalue = vertexz->intValue(); } } }
void CCTMXLayer::parseInternalProperties() { // if cc_vertex=automatic, then tiles will be rendered using vertexz CCString *vertexz = propertyNamed("cc_vertexz"); if (vertexz) { // If "automatic" is on, then parse the "cc_alpha_func" too if (vertexz->m_sString == "automatic") { m_bUseAutomaticVertexZ = true; CCString *alphaFuncVal = propertyNamed("cc_alpha_func"); float alphaFuncValue = 0.0f; if (alphaFuncVal != NULL) { alphaFuncValue = alphaFuncVal->floatValue(); } setShaderProgram(CCShaderCache::sharedShaderCache()->programForKey(kCCShader_PositionTextureColorAlphaTest)); GLint alphaValueLocation = glGetUniformLocation(getShaderProgram()->getProgram(), kCCUniformAlphaTestValue); // NOTE: alpha test shader is hard-coded to use the equivalent of a glAlphaFunc(GL_GREATER) comparison getShaderProgram()->setUniformLocationWith1f(alphaValueLocation, alphaFuncValue); } else { m_nVertexZvalue = vertexz->intValue(); } } // if cc_zorder=automatic, then tiles will be rendered using in row order from top to bottom CCString *zorder = propertyNamed("useZOrderbyY"); if (zorder) { m_bUseZOrderByY = true; // delete AtlasIndexArray as we no longer can use quads in this mode // all tiles will be instantiated as sprites if (m_pAtlasIndexArray) { ccCArrayFree(m_pAtlasIndexArray); m_pAtlasIndexArray = NULL; } } }
void CCTMXLayer::parseInternalProperties() { // if cc_vertex=automatic, then tiles will be rendered using vertexz CCString *vertexz = propertyNamed("cc_vertexz"); if( vertexz ) { if( vertexz->m_sString == "automatic" ) { m_bUseAutomaticVertexZ = true; } else { m_nVertexZvalue = vertexz->toInt(); } } CCString *alphaFuncVal = propertyNamed("cc_alpha_func"); if (alphaFuncVal) { m_fAlphaFuncValue = alphaFuncVal->toFloat(); } }