public override void Draw()
        {
            CCDrawManager.BlendFunc(m_tBlendFunc);
            CCDrawManager.BindTexture(m_pTexture);

            CCDrawManager.DrawPrimitives(PrimitiveType.TriangleStrip, m_pVertices, 0, m_uNuPoints * 2 - 2);
        }
示例#2
0
        public override void Draw()
        {
            Debug.Assert(m_pobBatchNode == null);

            CCDrawManager.BlendFunc(m_sBlendFunc);
            CCDrawManager.BindTexture(Texture);
            CCDrawManager.DrawQuad(ref m_sQuad);
        }
示例#3
0
        // overriding draw method
        public override void Draw()
        {
            Debug.Assert(m_pBatchNode == null, "draw should not be called when added to a particleBatchNode");
            //Debug.Assert(m_uParticleIdx == m_uParticleCount, "Abnormal error in particle quad");

            //updateQuadsWithParticles();

            CCDrawManager.BindTexture(m_pTexture);
            CCDrawManager.BlendFunc(m_tBlendFunc);
            CCDrawManager.DrawQuads(m_pQuads, 0, m_uParticleCount);
        }
示例#4
0
        public override void Draw()
        {
            if (m_pVertexData == null || m_pSprite == null)
            {
                return;
            }

            CCDrawManager.BindTexture(Sprite.Texture);
            CCDrawManager.BlendFunc(m_pSprite.BlendFunc);

            var count = (m_nVertexDataCount - 2);

            if (s_pIndexes == null || s_pIndexes.Length < count * 3)
            {
                s_pIndexes = new short[count * 3];
            }

            if (m_eType == CCProgressTimerType.Radial)
            {
                //FAN
                for (int i = 0; i < count; i++)
                {
                    var i3 = i * 3;
                    s_pIndexes[i3 + 0] = 0;
                    s_pIndexes[i3 + 1] = (short)(i + 1);
                    s_pIndexes[i3 + 2] = (short)(i + 2);
                }

                CCDrawManager.DrawIndexedPrimitives(PrimitiveType.TriangleList, m_pVertexData, 0, m_nVertexDataCount,
                                                    s_pIndexes, 0, count);
            }
            else if (m_eType == CCProgressTimerType.Bar)
            {
                //TRIANGLE STRIP
                for (int i = 0; i < count; i++)
                {
                    var i3 = i * 3;
                    s_pIndexes[i3 + 0] = (short)(i + 0);
                    s_pIndexes[i3 + 1] = (short)(i + 1);
                    s_pIndexes[i3 + 2] = (short)(i + 2);
                }

                if (!m_bReverseDirection)
                {
                    CCDrawManager.DrawIndexedPrimitives(PrimitiveType.TriangleList, m_pVertexData, 0, m_nVertexDataCount,
                                                        s_pIndexes, 0, count);
                }
                else
                {
                    CCDrawManager.DrawIndexedPrimitives(PrimitiveType.TriangleList, m_pVertexData, 0, m_nVertexDataCount,
                                                        s_pIndexes, 0, count);
                }
            }
        }
示例#5
0
        public override void Draw()
        {
            Debug.Assert(m_pobBatchNode == null);

            CCDrawManager.BlendFunc(m_sBlendFunc);
            CCDrawManager.BindTexture(Texture);
            CCDrawManager.DrawQuad(ref m_sQuad);

            /*
             * var sb = DrawManager.spriteBatch;
             * sb.Begin(SpriteSortMode.Deferred, null, null, null, null, null, DrawManager.basicEffect.World);
             * sb.Draw(Texture.getTexture2D(), new Vector2(0, 0), new Color(this.Color.r, this.Color.g, this.Color.b, Opacity));
             * sb.End();
             */
        }
示例#6
0
        public override void Draw()
        {
            if (m_pVertexBuffer == null)
            {
                m_pVertexBuffer = new VertexBuffer(CCDrawManager.graphicsDevice, typeof(VertexPositionColor), 4, BufferUsage.WriteOnly);
            }

            if (m_bChanged)
            {
                m_pVertexBuffer.SetData(m_pVertices);
                m_bChanged = false;
            }

            CCDrawManager.BindTexture((CCTexture2D)null);
            CCDrawManager.BlendFunc(m_tBlendFunc);
            CCDrawManager.DrawQuadsBuffer(m_pVertexBuffer, 0, 1);
        }
示例#7
0
        /// <summary>
        /// draws n quads from an index (offset).
        /// n + start can't be greater than the capacity of the atlas
        /// @since v1.0
        /// </summary>
        public void DrawNumberOfQuads(int n, int start)
        {
            if (n == 0)
            {
                return;
            }

            CCDrawManager.BindTexture(Texture);

            if (Dirty)
            {
                CCDrawManager.SetQuadsToBuffer(m_pVertexBuffer, m_pQuads, 0, m_pQuads.count);
                Dirty = false;
            }

            CCDrawManager.DrawQuadsBuffer(m_pVertexBuffer, start, n);
        }
示例#8
0
        /// <summary>
        /// draws n quads from an index (offset).
        /// n + start can't be greater than the capacity of the atlas
        /// @since v1.0
        /// </summary>
        public void DrawNumberOfQuads(int n, int start)
        {
            if (n == 0)
            {
                return;
            }

            CCDrawManager.BindTexture(Texture);

            if (Dirty)
            {
                m_pVertexBuffer.UpdateBuffer();
                Dirty = false;
            }

            CCDrawManager.DrawQuadsBuffer(m_pVertexBuffer, start, n);
        }
示例#9
0
        /// <summary>
        /// draws n quads from an index (offset).
        /// n + start can't be greater than the capacity of the atlas
        /// @since v1.0
        /// </summary>
        public void DrawNumberOfQuads(int n, int start)
        {
            if (n == 0)
            {
                return;
            }

            CCDrawManager.BindTexture(Texture);
            //CCDrawManager.BlendFunc(new ccBlendFunc(ccMacros.CCDefaultSourceBlending, ccMacros.CCDefaultDestinationBlending));

            if (Dirty)
            {
                CCDrawManager.SetQuadsToBuffer(m_pVertexBuffer, m_pQuads, 0, m_pQuads.count);
                Dirty = false;
            }

            CCDrawManager.DrawQuadsBuffer(m_pVertexBuffer, start, n);
        }
        public override void Draw()
        {
            CCDrawManager.BlendFunc(CCBlendFunc.AlphaBlend);
            CCDrawManager.BindTexture(Texture);
            CCDrawManager.DrawQuad(ref m_sQuad);

            //    /*
            //    CC_NODE_DRAW_SETUP();

            //    ccGLEnableVertexAttribs(kCCVertexAttribFlag_PosColorTex);
            //    ccGLBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
            //    getShaderProgram()->setUniformForModelViewProjectionMatrix();

            //    glActiveTexture(GL_TEXTURE0);
            //    glBindTexture( GL_TEXTURE_2D, getTexture()->getName());
            //    glUniform1i(m_uTextureLocation, 0);

            //    glActiveTexture(GL_TEXTURE1);
            //    glBindTexture( GL_TEXTURE_2D, m_pMaskTexture->getName() );
            //    glUniform1i(m_uMaskLocation, 1);

            //#define kQuadSize sizeof(m_sQuad.bl)
            //    long offset = (long)&m_sQuad;

            //    // vertex
            //    int diff = offsetof( ccV3F_C4B_T2F, vertices);
            //    glVertexAttribPointer(kCCVertexAttrib_Position, 3, GL_FLOAT, GL_FALSE, kQuadSize, (void*) (offset + diff));

            //    // 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_TRIANGLE_STRIP, 0, 4);
            //    glActiveTexture(GL_TEXTURE0);
            //    */
        }
示例#11
0
        public virtual void AfterDraw(CCNode target)
        {
            m_pGrabber.AfterRender(m_pTexture);

            CCDirector.SharedDirector.Projection = m_directorProjection;

            if (target.Camera.Dirty)
            {
                CCPoint offset = target.AnchorPointInPoints;

                CCDrawManager.Translate(offset.X, offset.Y, 0);
                target.Camera.Locate();
                CCDrawManager.Translate(-offset.X, -offset.Y, 0);
            }

            CCDrawManager.BindTexture(m_pTexture);

            //Blit();

            // restore projection for default FBO .fixed bug #543 #544
            //TODO:         CCDirector::sharedDirector()->setProjection(CCDirector::sharedDirector()->getProjection());
            //TODO:         CCDirector::sharedDirector()->applyOrientation();
        }
        // overriding draw method
        public override void Draw()
        {
            Debug.Assert(m_pBatchNode == null, "draw should not be called when added to a particleBatchNode");
            //Debug.Assert(m_uParticleIdx == m_uParticleCount, "Abnormal error in particle quad");

            //updateQuadsWithParticles();

            CCDrawManager.BindTexture(m_pTexture);
            CCDrawManager.BlendFunc(m_tBlendFunc);
            CCDrawManager.DrawQuads(m_pQuads, 0, m_uParticleCount);

            /*
             * CC_NODE_DRAW_SETUP();
             *
             * ccGLBindTexture2D(m_pTexture.Name);
             * ccGLBlendFunc(m_tBlendFunc.src, m_tBlendFunc.dst);
             *
             *
             #if CC_TEXTURE_ATLAS_USE_VAO
             *                                                                                      //
             * // Using VBO and VAO
             * //
             * glBindVertexArray( m_uVAOname );
             *
             #if CC_REBIND_INDICES_BUFFER
             * glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_pBuffersVBO[1]);
             #endif
             *
             * glDrawElements(GL_TRIANGLES, (GLsizei) m_uParticleIdx*6, GL_UNSIGNED_SHORT, 0);
             *
             #if CC_REBIND_INDICES_BUFFER
             * glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
             #endif
             *
             * glBindVertexArray( 0 );
             *
             #else
             *  //
             *  // Using VBO without VAO
             *  //
             *
             #define kQuadSize sizeof(m_pQuads[0].bl)
             *
             * ccGLEnableVertexAttribs(kCCVertexAttribFlag_PosColorTex);
             *
             * glBindBuffer(GL_ARRAY_BUFFER, m_pBuffersVBO[0]);
             * // vertices
             * glVertexAttribPointer(kCCVertexAttrib_Position, 3, GL_FLOAT, GL_FALSE, kQuadSize,
             *                    (GLvoid*) offsetof(ccV3F_C4B_T2F, vertices));
             * // colors
             * glVertexAttribPointer(kCCVertexAttrib_Color, 4, GL_UNSIGNED_BYTE, GL_TRUE, kQuadSize,
             *                    (GLvoid*) offsetof(ccV3F_C4B_T2F, colors));
             * // tex coords
             * glVertexAttribPointer(kCCVertexAttrib_TexCoords, 2, GL_FLOAT, GL_FALSE, kQuadSize,
             *                    (GLvoid*) offsetof(ccV3F_C4B_T2F, texCoords));
             *
             * glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_pBuffersVBO[1]);
             *
             * glDrawElements(GL_TRIANGLES, (GLsizei) m_uParticleIdx * 6, GL_UNSIGNED_SHORT, 0);
             *
             * glBindBuffer(GL_ARRAY_BUFFER, 0);
             * glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
             *
             #endif
             * CC_INCREMENT_GL_DRAWS(1);
             * CHECK_GL_ERROR_DEBUG();
             */
        }
示例#13
0
 public override void Draw()
 {
     CCDrawManager.BlendFunc(CCBlendFunc.AlphaBlend);
     CCDrawManager.BindTexture(Texture);
     CCDrawManager.DrawQuad(ref m_sQuad);
 }
示例#14
0
        public override void Draw()
        {
            if (m_pVertexData == null || m_pSprite == null)
            {
                return;
            }

            CCDrawManager.BindTexture(Sprite.Texture);
            CCDrawManager.BlendFunc(m_pSprite.BlendFunc);

            var count = (m_nVertexDataCount - 2);

            if (s_pIndexes == null || s_pIndexes.Length < count * 3)
            {
                s_pIndexes = new short[count * 3];
            }

            if (m_eType == CCProgressTimerType.Radial)
            {
                //FAN
                for (int i = 0; i < count; i++)
                {
                    var i3 = i * 3;
                    s_pIndexes[i3 + 0] = 0;
                    s_pIndexes[i3 + 1] = (short)(i + 1);
                    s_pIndexes[i3 + 2] = (short)(i + 2);
                }

                CCDrawManager.DrawIndexedPrimitives(PrimitiveType.TriangleList, m_pVertexData, 0, m_nVertexDataCount, s_pIndexes, 0, count);
            }
            else if (m_eType == CCProgressTimerType.Bar)
            {
                //TRIANGLE STRIP
                for (int i = 0; i < count; i++)
                {
                    var i3 = i * 3;
                    s_pIndexes[i3 + 0] = (short)(i + 0);
                    s_pIndexes[i3 + 1] = (short)(i + 1);
                    s_pIndexes[i3 + 2] = (short)(i + 2);
                }

                if (!m_bReverseDirection)
                {
                    CCDrawManager.DrawIndexedPrimitives(PrimitiveType.TriangleList, m_pVertexData, 0, m_nVertexDataCount, s_pIndexes, 0, count);
                }
                else
                {
                    CCDrawManager.DrawIndexedPrimitives(PrimitiveType.TriangleList, m_pVertexData, 0, m_nVertexDataCount, s_pIndexes, 0, count);
                }
            }

            /*
             * CC_NODE_DRAW_SETUP();
             *
             * ccGLBlendFunc( m_pSprite->getBlendFunc().src, m_pSprite->getBlendFunc().dst );
             *
             * ccGLEnableVertexAttribs(kCCVertexAttribFlag_PosColorTex );
             *
             * ccGLBindTexture2D( m_pSprite->getTexture()->getName() );
             *
             * glVertexAttribPointer( kCCVertexAttrib_Position, 2, GL_FLOAT, GL_FALSE, sizeof(m_pVertexData[0]) , &m_pVertexData[0].vertices);
             * glVertexAttribPointer( kCCVertexAttrib_TexCoords, 2, GL_FLOAT, GL_FALSE, sizeof(m_pVertexData[0]), &m_pVertexData[0].texCoords);
             * glVertexAttribPointer( kCCVertexAttrib_Color, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(m_pVertexData[0]), &m_pVertexData[0].colors);
             *
             * if(m_eType == kCCProgressTimerTypeRadial)
             * {
             *  glDrawArrays(GL_TRIANGLE_FAN, 0, m_nVertexDataCount);
             * }
             * else if (m_eType == kCCProgressTimerTypeBar)
             * {
             *  if (!m_bReverseDirection)
             *  {
             *      glDrawArrays(GL_TRIANGLE_STRIP, 0, m_nVertexDataCount);
             *  }
             *  else
             *  {
             *      glDrawArrays(GL_TRIANGLE_STRIP, 0, m_nVertexDataCount/2);
             *      glDrawArrays(GL_TRIANGLE_STRIP, 4, m_nVertexDataCount/2);
             *      // 2 draw calls
             *      CC_INCREMENT_GL_DRAWS(1);
             *  }
             * }
             * CC_INCREMENT_GL_DRAWS(1);
             */
        }