Exemplo n.º 1
0
        public CCMotionStreak(float fade, float minSegIn, float strokeIn, CCColor3B color, CCTexture2D texture)
        {
            streakRenderCommand = new CCCustomCommand(RenderMotionStreak);

            AnchorPoint = CCPoint.Zero;
            IgnoreAnchorPointForPosition = true;
            StartingPositionInitialized = false;
            FastMode = true;
            Texture = texture;
            Color = color;
            stroke = strokeIn;
            BlendFunc = CCBlendFunc.NonPremultiplied;

            minSeg = (minSegIn == -1.0f) ? stroke / 5.0f : minSegIn;
            minSeg *= minSeg;

            fadeDelta = 1.0f / fade;

            maxPoints = (int) (fade * 60.0f) + 2;

            pointState = new float[maxPoints];
            pointVertexes = new CCPoint[maxPoints];
            vertices = new CCV3F_C4B_T2F[(maxPoints + 1) * 2];

            Schedule();
        }
Exemplo n.º 2
0
        public CCMotionStreak(float fade, float minSegIn, float strokeIn, CCColor3B color, CCTexture2D texture)
        {
            streakRenderCommand = new CCCustomCommand(RenderMotionStreak);

            AnchorPoint = CCPoint.Zero;
            IgnoreAnchorPointForPosition = true;
            StartingPositionInitialized  = false;
            FastMode  = true;
            Texture   = texture;
            Color     = color;
            stroke    = strokeIn;
            BlendFunc = CCBlendFunc.NonPremultiplied;

            minSeg  = (minSegIn == -1.0f) ? stroke / 5.0f : minSegIn;
            minSeg *= minSeg;

            fadeDelta = 1.0f / fade;

            maxPoints = (int)(fade * 60.0f) + 2;

            pointState    = new float[maxPoints];
            pointVertexes = new CCPoint[maxPoints];
            vertices      = new CCV3F_C4B_T2F[(maxPoints + 1) * 2];

            Schedule();
        }
Exemplo n.º 3
0
        public CCLayer(CCCameraProjection cameraProjection, CCClipMode clipMode = CCClipMode.None)
            : base()
        {
            beforeDrawCommand = new CCCustomCommand(BeforeDraw);
            afterDrawCommand  = new CCCustomCommand(AfterDraw);

            ChildClippingMode            = clipMode;
            IgnoreAnchorPointForPosition = true;
            AnchorPoint = CCPoint.AnchorMiddle;

            initCameraProjection = cameraProjection;
        }
Exemplo n.º 4
0
        public void AddCommand(CCRenderCommand command)
        {
            // Render command might be used multiple times per draw loop
            // e.g. within render texture
            if(currentGroupId != 0)
                command = command.Copy();

            command.Group = currentGroupId;
            command.ViewportGroup = currentViewportGroupId;
            command.LayerGroup = currentLayerGroupId;
            command.ArrivalIndex = ++currentArrivalIndex;
            command.UsingDepthTest = UsingDepthTest;

            renderQueue.Push(command);
        }
Exemplo n.º 5
0
        public void AddCommand(CCRenderCommand command)
        {
            // Render command might be used multiple times per draw loop
            // e.g. within render texture
            if (currentGroupId != 0)
            {
                command = command.Copy();
            }

            command.Group          = currentGroupId;
            command.ViewportGroup  = currentViewportGroupId;
            command.LayerGroup     = currentLayerGroupId;
            command.ArrivalIndex   = ++currentArrivalIndex;
            command.UsingDepthTest = UsingDepthTest;

            renderQueue.Push(command);
        }
Exemplo n.º 6
0
        void ExecuteRenderCommand(CCRenderCommand command)
        {
            if (command is CCQuadCommand)
            {
                Flush3D();
                FlushTriangles();

                //Console.WriteLine(((CCQuadCommand)command).QuadCount);
                var quadCommand = (CCQuadCommand)command;

                var drawManager = DrawManager;

                //Draw batched quads if necessary
                // TODO: Check for buffer size
                if (command.IsSkipBatching) // || (numberQuads + cmd->getQuadCount()) * 4 > VBO_SIZE )
                {
                    // TODO: Check for buffer size
                    //CCASSERT(cmd->getQuadCount()>= 0 && cmd->getQuadCount() * 4 < VBO_SIZE, "VBO for vertex is not big enough, please break the data down or use customized render command");

                    //Draw batched quads if VBO is full
                    DrawBatchedQuads();
                }

                var mv = command.ModelViewTransform;

                batchQuadCommands.Add(quadCommand);

                for (int b = 0; b < quadCommand.QuadCount; b++)
                {
                    quads.Add(mv.Transform(quadCommand.Quads[b]));
                }
                numberQuads += quadCommand.QuadCount;

                if (quadCommand.IsSkipBatching)
                {
                    DrawBatchedQuads();
                }
            }
            else
            {
                Flush();
                command.Execute(DrawManager);
            }
        }
Exemplo n.º 7
0
        public void AddComand(CCRenderCommand command)
        {
            var renderQueueId = new CCRenderQueueId(Group, 0, (int)command.Depth, command.MaterialId);

            RenderQueue.Enqueue(renderQueueId, command);
        }
Exemplo n.º 8
0
 public void AddComand (CCRenderCommand command)
 {
     var renderQueueId = new CCRenderQueueId(Group, 0, (int)command.Depth, command.MaterialId);
     RenderQueue.Enqueue(renderQueueId, command);
 }
Exemplo n.º 9
0
        void ExecuteRenderCommand (CCRenderCommand command)
        {
            if (command is CCQuadCommand)
            {
                Flush3D();
                FlushTriangles();

                //Console.WriteLine(((CCQuadCommand)command).QuadCount);
                var quadCommand = (CCQuadCommand)command;

                var drawManager = DrawManager;

                //Draw batched quads if necessary
                // TODO: Check for buffer size
                if(command.IsSkipBatching) // || (numberQuads + cmd->getQuadCount()) * 4 > VBO_SIZE )
                {

                    // TODO: Check for buffer size
                    //CCASSERT(cmd->getQuadCount()>= 0 && cmd->getQuadCount() * 4 < VBO_SIZE, "VBO for vertex is not big enough, please break the data down or use customized render command");

                    //Draw batched quads if VBO is full
                    DrawBatchedQuads();
                }

                var mv = command.ModelViewTransform;

                batchQuadCommands.Add(quadCommand);

                for (int b = 0; b < quadCommand.QuadCount; b++)
                {
                    quads.Add(mv.Transform(quadCommand.Quads[b]));
                }
                numberQuads += quadCommand.QuadCount;

                if (quadCommand.IsSkipBatching)
                {
                    DrawBatchedQuads();
                }
            }
            else
            {
                Flush();
                command.Execute(DrawManager);
            }

        }
Exemplo n.º 10
0
        public CCLayer(CCCameraProjection cameraProjection, CCClipMode clipMode = CCClipMode.None)
            : base()
        {
            beforeDrawCommand = new CCCustomCommand(BeforeDraw);
            afterDrawCommand = new CCCustomCommand(AfterDraw);

            ChildClippingMode = clipMode;
            IgnoreAnchorPointForPosition = true;
            AnchorPoint = CCPoint.AnchorMiddle;

            initCameraProjection = cameraProjection;
        }