当前位置: 首页>>代码示例>>C++>>正文


C++ CC_NODE_DRAW_SETUP函数代码示例

本文整理汇总了C++中CC_NODE_DRAW_SETUP函数的典型用法代码示例。如果您正苦于以下问题:C++ CC_NODE_DRAW_SETUP函数的具体用法?C++ CC_NODE_DRAW_SETUP怎么用?C++ CC_NODE_DRAW_SETUP使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了CC_NODE_DRAW_SETUP函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CC_NODE_DRAW_SETUP

void BatchNode::draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated)
{
    if (_children.empty())
    {
        return;
    }

    CC_NODE_DRAW_SETUP();

    bool pushed = false;
    for(auto object : _children)
    {
        Armature *armature = dynamic_cast<Armature *>(object);
        if (armature)
        {
            if (!pushed)
            {
                generateGroupCommand();
                pushed = true;
            }
        
            armature->visit(renderer, transform, transformUpdated);
        }
        else
        {
            renderer->popGroup();
            pushed = false;
            
            ((Node *)object)->visit(renderer, transform, transformUpdated);
        }
    }
}
开发者ID:BellyWong,项目名称:EarthWarrior3D,代码行数:32,代码来源:CCBatchNode.cpp

示例2: CC_NODE_DRAW_SETUP

void TextureSprite::draw()
{
    if (!m_bVisible) return;

    CC_NODE_DRAW_SETUP();

    ccGLBlendFunc(m_sBlendFunc.src, m_sBlendFunc.dst);

    ccGLBindTexture2D(mTexture2D->getName());
    ccGLEnableVertexAttribs(kCCVertexAttribFlag_Position | kCCVertexAttribFlag_TexCoords);

    /// Time offset
    getShaderProgram()->setUniformLocationWith2f(mTimeLocation, mTime.x, mTime.y);
    /// Color
    getShaderProgram()->setUniformLocationWith4f(mColorLocation, mColor.r, mColor.g, mColor.b, mColor.a);
    /// Vertex
    glVertexAttribPointer(kCCVertexAttrib_Position, 3, GL_FLOAT, GL_FALSE, sizeof(ccVertex3F), (void*)&mVertexPos[0]);
    /// Texture coord.
    glVertexAttribPointer(kCCVertexAttrib_TexCoords, 2, GL_FLOAT, GL_FALSE, sizeof(ccTex2F), (void*)&mTexCoords[0]);
    /// Available mode: GL_TRIANGLES, GL_TRIANGLES_STRIP and GL_TRIANGLE_FAN
    glDrawArrays(GL_TRIANGLES, 0, mVertexPos.size());

    /// Do NOT call glFlush or performance will decrease drastically!
    /// glFlush();

    CHECK_GL_ERROR_DEBUG();

    CC_INCREMENT_GL_DRAWS(1);
}
开发者ID:xoraphics,项目名称:yummyjump,代码行数:29,代码来源:texturesprite.cpp

示例3: CC_NODE_DRAW_SETUP

void CADrawView::draw()
{
    CC_NODE_DRAW_SETUP();
    ccGLBlendFunc(m_sBlendFunc.src, m_sBlendFunc.dst);
    
    render();
}
开发者ID:Brian1900,项目名称:CrossApp,代码行数:7,代码来源:CADrawView.cpp

示例4: CC_NODE_DRAW_SETUP

KDvoid Controller::draw ( KDvoid )
{
    CC_NODE_DRAW_SETUP ( );
    
	GLfloat  fVertices [ ] = 
	{
		   0,  512, 
		1024,  512, 
		   0,    0, 
		1024,    0, 
	};

	GLfloat  fCoords [ ] =
	{
		   0,  0,
		   1,  0,
		   0,  1, 
		   1,  1, 
	};

	ccGLBindTexture2D ( m_uTexture );
    ccGLEnableVertexAttribs ( kCCVertexAttribFlag_Position | kCCVertexAttribFlag_TexCoords );

	if ( m_pDrawFunc )
	{
		m_pDrawFunc ( KD_GET_UST2MSEC );
	}

	ccGLVertexAttribPointer ( kCCVertexAttrib_Position , 2, GL_FLOAT, GL_FALSE, 0, fVertices );
	ccGLVertexAttribPointer ( kCCVertexAttrib_TexCoords, 2, GL_FLOAT, GL_FALSE, 0, fCoords );	

	glDrawArrays ( GL_TRIANGLE_STRIP, 0, 4 );

	ccGLBindTexture2D ( 0 );
}
开发者ID:mcodegeeks,项目名称:OpenKODE-Framework,代码行数:35,代码来源:Controller.cpp

示例5: CC_NODE_DRAW_SETUP

void BBWater::draw()
{
    CC_NODE_DRAW_SETUP();
    
//    ccGLBlendFunc( m_sBlendFunc.src, m_sBlendFunc.dst );
    
    ccGLBindTexture2D( m_sprite->getTexture()->getName() );
//    ccGLEnableVertexAttribs( kCCVertexAttribFlag_Position );
    
//    glBindBuffer(GL_ARRAY_BUFFER, m_vertexVbo);
//    glBufferData(GL_ARRAY_BUFFER, sizeof(float)*vertexArray.size(), &vertexArray[0], GL_STATIC_DRAW);
    
    glEnableVertexAttribArray( kCCVertexAttrib_Position );
    
    // vertex
    glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3, &vertexArray[0]);
    
//    // texCoods
//    diff = offsetof( ccV3F_C4B_T2F, texCoords);
//    glVertexAttribPointer(kCCVertexAttrib_TexCoords, 2, GL_FLOAT, GL_FALSE, kQuadSize, (void*)(offset + diff));
//    
//    // color
//    diff = offsetof( ccV3F_C4B_T2F, colors);
//    glVertexAttribPointer(kCCVertexAttrib_Color, 4, GL_UNSIGNED_BYTE, GL_TRUE, kQuadSize, (void*)(offset + diff));
    
    
    glDrawArrays(GL_TRIANGLES, 0, m_faceCount);
    
    CHECK_GL_ERROR_DEBUG();
}
开发者ID:newcl,项目名称:boom,代码行数:30,代码来源:BBWater.cpp

示例6: CC_NODE_DRAW_SETUP

void CCEPixelNode::draw()
{
	CC_NODE_DRAW_SETUP();

    ccGLEnableVertexAttribs( kCCVertexAttribFlag_Position | kCCVertexAttribFlag_Color );

    //
    // Attributes
    //
	ccePixelPart* pt = m_pPixels;
	while(pt!=NULL) {
		if(!pt->hide) {
			for(int i=0;i<pt->len;i++) {
				ccePixelInfo* p = pt->pixels+i;
				if(p->hide)continue;
				glVertexAttribPointer(kCCVertexAttrib_Position, 2, GL_FLOAT, GL_FALSE, 0, p->square);
				glVertexAttribPointer(kCCVertexAttrib_Color, 4, GL_FLOAT, GL_FALSE, 0, p->color);		
				ccGLBlendFunc( m_tBlendFunc.src, m_tBlendFunc.dst );
				glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
			}
		}
		pt = pt->next;
	}

    CC_INCREMENT_GL_DRAWS(1);	
}
开发者ID:catyguan,项目名称:gamedev.platform,代码行数:26,代码来源:CCEPixelNode.cpp

示例7: CC_NODE_DRAW_SETUP

void CCMenuItemColor::draw(Renderer *renderer, const kmMat4& transform, bool transformUpdated) {
    CC_NODE_DRAW_SETUP();
    
    ccGLEnableVertexAttribs( kCCVertexAttribFlag_Position | kCCVertexAttribFlag_Color );
    
    //
    // Attributes
    //
#ifdef EMSCRIPTEN
    setGLBufferData(m_pSquareVertices, 4 * sizeof(ccVertex2F), 0);
    glVertexAttribPointer(kCCVertexAttrib_Position, 2, GL_FLOAT, GL_FALSE, 0, 0);
    
    setGLBufferData(m_pSquareColors, 4 * sizeof(ccColor4F), 1);
    glVertexAttribPointer(kCCVertexAttrib_Color, 4, GL_FLOAT, GL_FALSE, 0, 0);
#else
    glVertexAttribPointer(kCCVertexAttrib_Position, 2, GL_FLOAT, GL_FALSE, 0, m_pSquareVertices);
    glVertexAttribPointer(kCCVertexAttrib_Color, 4, GL_FLOAT, GL_FALSE, 0, m_pSquareColors);
#endif // EMSCRIPTEN
    
    ccGLBlendFunc(m_tBlendFunc.src, m_tBlendFunc.dst);
    
    glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
    
    CC_INCREMENT_GL_DRAWS(1);
}
开发者ID:ourgames,项目名称:dc208,代码行数:25,代码来源:CCMenuItemColor.cpp

示例8: CC_PROFILER_START

void Label::onDraw()
{
    CC_PROFILER_START("Label - draw");

    // Optimization: Fast Dispatch
    if( _batchNodes.size() == 1 && _textureAtlas->getTotalQuads() == 0 )
    {
        return;
    }

    CC_NODE_DRAW_SETUP();

    if (_useDistanceField && _currLabelEffect != LabelEffect::NORMAL)
    {
        _shaderProgram->setUniformLocationWith3f(_uniformEffectColor, _effectColor.r/255.0f,_effectColor.g/255.0f,_effectColor.b/255.0f);
    }

    for(const auto &child: _children)
    {
        child->updateTransform();
    }

    GL::blendFunc( _blendFunc.src, _blendFunc.dst );

    for (const auto& batchNode:_batchNodes)
    {
        batchNode->getTextureAtlas()->drawQuads();
    }

    CC_PROFILER_STOP("Label - draw");
}
开发者ID:12white,项目名称:CocoStudioSamples,代码行数:31,代码来源:CCLabel.cpp

示例9: CC_NODE_DRAW_SETUP

void CCDrawNode::draw()
{
    CC_NODE_DRAW_SETUP();
    ccGLBlendFunc(m_sBlendFunc.src, m_sBlendFunc.dst);
    
    render();
}
开发者ID:wenhulove333,项目名称:ScutServer,代码行数:7,代码来源:CCDrawNode.cpp

示例10: CC_NODE_DRAW_SETUP

void MotionStreak::draw()
{
    if(_nuPoints <= 1)
        return;

    CC_NODE_DRAW_SETUP();

    GL::enableVertexAttribs(GL::VERTEX_ATTRIB_FLAG_POS_COLOR_TEX );
    GL::blendFunc( _blendFunc.src, _blendFunc.dst );

    GL::bindTexture2D( _texture->getName() );

#ifdef EMSCRIPTEN
    // Size calculations from ::initWithFade
    setGLBufferData(_vertices, (sizeof(Vertex2F) * _maxPoints * 2), 0);
    glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 2, GL_FLOAT, GL_FALSE, 0, 0);

    setGLBufferData(_texCoords, (sizeof(Tex2F) * _maxPoints * 2), 1);
    glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_TEX_COORDS, 2, GL_FLOAT, GL_FALSE, 0, 0);

    setGLBufferData(_colorPointer, (sizeof(GLubyte) * _maxPoints * 2 * 4), 2);
    glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_COLOR, 4, GL_UNSIGNED_BYTE, GL_TRUE, 0, 0);
#else
    glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 2, GL_FLOAT, GL_FALSE, 0, _vertices);
    glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_TEX_COORDS, 2, GL_FLOAT, GL_FALSE, 0, _texCoords);
    glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_COLOR, 4, GL_UNSIGNED_BYTE, GL_TRUE, 0, _colorPointer);
#endif // EMSCRIPTEN

    glDrawArrays(GL_TRIANGLE_STRIP, 0, (GLsizei)_nuPoints*2);

    CC_INCREMENT_GL_DRAWS(1);
}
开发者ID:Gamex,项目名称:GameX,代码行数:32,代码来源:CCMotionStreak.cpp

示例11: CC_NODE_DRAW_SETUP

void CCMotionStreak::draw()
{
    if(m_uNuPoints <= 1)
        return;

    CC_NODE_DRAW_SETUP(this);

    ccGLEnableVertexAttribs(kCCVertexAttribFlag_PosColorTex );
    ccGLBlendFunc( m_tBlendFunc.src, m_tBlendFunc.dst );

    ccGLBindTexture2D( m_pTexture->getName() );
    if(m_pTexture->isETC()) {
        getShaderProgram()->useSeparatedAlphaChannel(m_pTexture->getAlphaChannel()->getName());
    }
    
#ifdef EMSCRIPTEN
    // Size calculations from ::initWithFade
    setGLBufferData(m_pVertices, (sizeof(ccVertex2F) * m_uMaxPoints * 2), 0);
    glVertexAttribPointer(kCCVertexAttrib_Position, 2, GL_FLOAT, GL_FALSE, 0, 0);

    setGLBufferData(m_pTexCoords, (sizeof(ccTex2F) * m_uMaxPoints * 2), 1);
    glVertexAttribPointer(kCCVertexAttrib_TexCoords, 2, GL_FLOAT, GL_FALSE, 0, 0);

    setGLBufferData(m_pColorPointer, (sizeof(GLubyte) * m_uMaxPoints * 2 * 4), 2);
    glVertexAttribPointer(kCCVertexAttrib_Color, 4, GL_UNSIGNED_BYTE, GL_TRUE, 0, 0);
#else
    glVertexAttribPointer(kCCVertexAttrib_Position, 2, GL_FLOAT, GL_FALSE, 0, m_pVertices);
    glVertexAttribPointer(kCCVertexAttrib_TexCoords, 2, GL_FLOAT, GL_FALSE, 0, m_pTexCoords);
    glVertexAttribPointer(kCCVertexAttrib_Color, 4, GL_UNSIGNED_BYTE, GL_TRUE, 0, m_pColorPointer);
#endif // EMSCRIPTEN

    glDrawArrays(GL_TRIANGLE_STRIP, 0, (GLsizei)m_uNuPoints*2);

    CC_INCREMENT_GL_DRAWS(1);
}
开发者ID:boruis,项目名称:cocos2dx-classical,代码行数:35,代码来源:CCMotionStreak.cpp

示例12: CC_NODE_DRAW_SETUP

void BatchNode::draw()
{
    if (_children.empty())
    {
        return;
    }

    CC_NODE_DRAW_SETUP();

    bool pushed = false;
    for(auto object : _children)
    {
        Armature *armature = dynamic_cast<Armature *>(object);
        if (armature)
        {
            if (!pushed)
            {
                generateGroupCommand();
                pushed = true;
            }
        
            armature->visit();
        }
        else
        {
            Director::getInstance()->getRenderer()->popGroup();
            pushed = false;
            
            ((Node *)object)->visit();
        }
    }
}
开发者ID:leanlyne,项目名称:ShootColorX,代码行数:32,代码来源:CCBatchNode.cpp

示例13: CC_NODE_DRAW_SETUP

void Sky::draw(Renderer *renderer, const Mat4& transform, uint32_t flags) {
    
    cocos2d::Size s = Director::getInstance()->getWinSize();
    
    DoodleTruck *doodleTruck = DoodleTruck::sharedDoodleTruck();
    CC_NODE_DRAW_SETUP();
    
    Vec2 _skyVertices[4];
    Vec2 _skyTexCoords[4];
    
    _skyVertices[0] = Vec2(0, 0);
    _skyTexCoords[0] = Vec2(1.0, 1.0f);
    _skyVertices[1] = Vec2(s.width, 0);
    _skyTexCoords[1] = Vec2(1.0f, 1.0f);
    
    _skyVertices[2] = Vec2(0, s.height);
    _skyTexCoords[2] = Vec2(31.0f, 63.0f);
    _skyVertices[3] = Vec2(s.width, s.height);
    _skyTexCoords[3] = Vec2(31.0f, 63.0f);
    
    
    Texture2D * tex = Director::getInstance()->getTextureCache()->textureForKey("sky-bg-rainbow.png");
    GL::bindTexture2D(tex->getName());
    GL::enableVertexAttribs( GL::VERTEX_ATTRIB_FLAG_POSITION | GL::VERTEX_ATTRIB_FLAG_TEX_COORD);
    
    ccDrawColor4F(1.0f, 1.0f, 1.0f, 1.0f);
    glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 2, GL_FLOAT, GL_FALSE, 0, _skyVertices);
    glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_TEX_COORD, 2, GL_FLOAT, GL_FALSE, 0, _skyTexCoords);
    
    glDrawArrays(GL_TRIANGLE_STRIP, 0, (GLsizei)4);
    
   // ccDrawColor4F(1.0, 1.0, 1.0, 1.0);*/
}
开发者ID:HoaPham98,项目名称:HillClimb,代码行数:33,代码来源:Sky.cpp

示例14: CC_PROFILER_START_CATEGORY

//--------------------------------------------------------
void CRemoveBKSprite::draw(void)
{
	CC_PROFILER_START_CATEGORY(kCCProfilerCategorySprite, "CCSprite - draw");
	CCAssert(!m_pobBatchNode, "If CCSprite is being rendered by CCSpriteBatchNode, CCSprite#draw SHOULD NOT be called");

	CC_NODE_DRAW_SETUP();

	// 启用attributes变量输入,顶点坐标,纹理坐标,颜色
	ccGLEnableVertexAttribs( kCCVertexAttribFlag_PosColorTex );
	ccGLBlendFunc(m_sBlendFunc.src, m_sBlendFunc.dst);

	m_pShaderProgram->use();
	m_pShaderProgram->setUniformsForBuiltins();

	// 绑定纹理到纹理槽0
	ccGLBindTexture2D(m_pobTexture->getName());

	long offset = (long)&m_sQuad;
	// vertex
	int diff = offsetof( ccV3F_C4B_T2F, vertices);
	glVertexAttribPointer(kCCVertexAttrib_Position, 3, GL_FLOAT, GL_FALSE, sizeof(m_sQuad.bl), (void*) (offset + diff));
	// texCoods
	diff = offsetof( ccV3F_C4B_T2F, texCoords);
	glVertexAttribPointer(kCCVertexAttrib_TexCoords, 2, GL_FLOAT, GL_FALSE, sizeof(m_sQuad.bl), (void*)(offset + diff));
	// color
	diff = offsetof( ccV3F_C4B_T2F, colors);
	glVertexAttribPointer(kCCVertexAttrib_Color, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(m_sQuad.bl), (void*)(offset + diff));

	glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
	CHECK_GL_ERROR_DEBUG();

	CC_INCREMENT_GL_DRAWS(1);
	CC_PROFILER_STOP_CATEGORY(kCCProfilerCategorySprite, "CCSprite - draw");
}
开发者ID:Pancho2wang,项目名称:cocos2dx_shader_demo,代码行数:35,代码来源:RemoveBKSprite.cpp

示例15: CC_NODE_DRAW_SETUP

void ShaderNode::draw()
{
    CC_NODE_DRAW_SETUP();

    float w = SIZE_X, h = SIZE_Y;
    GLfloat vertices[12] = {0,0, w,0, w,h, 0,0, 0,h, w,h};

    //
    // Uniforms
    //
    getShaderProgram()->setUniformLocationWith2f(m_uniformCenter, m_center.x, m_center.y);
    getShaderProgram()->setUniformLocationWith2f(m_uniformResolution, m_resolution.x, m_resolution.y);


    // time changes all the time, so it is Ok to call OpenGL directly, and not the "cached" version
    glUniform1f(m_uniformTime, m_time);

    ccGLEnableVertexAttribs( kCCVertexAttribFlag_Position );

    glVertexAttribPointer(kCCVertexAttrib_Position, 2, GL_FLOAT, GL_FALSE, 0, vertices);

    glDrawArrays(GL_TRIANGLES, 0, 6);
    
    CC_INCREMENT_GL_DRAWS(1);
}
开发者ID:1vs1,项目名称:quick-cocos2d-x,代码行数:25,代码来源:CSShaderNode.cpp


注:本文中的CC_NODE_DRAW_SETUP函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。