Пример #1
0
        public override void Visit()
        {
            CCDrawManager drawManager = Window.DrawManager;

            if (drawManager.CurrentRenderTarget == null)
            {
                drawManager.Viewport = Viewport.XnaViewport;
            }

            base.Visit();
        }
Пример #2
0
        protected override void Draw()
        {
            base.Draw();

            CCDrawManager drawManager = CCDrawManager.SharedDrawManager;

            if (this.Visible)
            {
                InnerScene.Visit();
            }
        }
Пример #3
0
        internal override void Execute(CCDrawManager drawManager)
        {
//            drawManager.PushMatrix();
//            //var xnaMatrix = ModelViewTransform.XnaMatrix;
//            //drawManager.MultMatrix(ref xnaMatrix);
//            drawManager.BlendFunc(BlendType);
//            drawManager.BindTexture(Texture);
//
//            drawManager.DrawQuad(ref Quads[0]);
//
//            drawManager.PopMatrix();
        }
Пример #4
0
        void OnBegin()
        {
            CCDrawManager drawManager = CCDrawManager.SharedDrawManager;

            drawManager.SetRenderTarget(Texture);

            if (shouldClear)
            {
                drawManager.Clear(clearColor);
                shouldClear = false;
            }
        }
Пример #5
0
        internal CCRenderer(CCDrawManager drawManagerIn)
        {
            currentBatchedQuads = new CCRawList <CCV3F_C4B_T2F_Quad>(256, true);
            quadCommands        = new CCRawList <CCQuadCommand>(256, true);
            renderQueue         = new CCRawList <CCRenderCommand>();
            drawManager         = drawManagerIn;

            viewportGroupStack        = new Viewport[MaxStackDepth];
            layerGroupViewMatrixStack = new Matrix[MaxStackDepth];
            layerGroupProjMatrixStack = new Matrix[MaxStackDepth];
            viewportGroupIdStack      = new byte[MaxStackDepth];
            layerGroupIdStack         = new byte[MaxStackDepth];
            groupIdStack = new byte[MaxStackDepth];
        }
Пример #6
0
        internal override void Execute(CCDrawManager drawManager)
        {
            // Set Texture
            drawManager.BindTexture(Texture);

            // Set blend mode
            drawManager.BlendFunc(BlendType);

            // Draw the Primitives
            Primitive.Draw(drawManager);

            drawManager.DrawCount++;  // Drawn batches
            //drawManager.DrawVerticesCount = Primitive.Count; // Drawn Vertices in this batch
        }
Пример #7
0
        internal CCPrimitiveBatch(CCDrawManager drawManager, int bufferSize = DefaultBufferSize)
        {
            DrawManager = drawManager;

            if (drawManager.XnaGraphicsDevice == null)
            {
                throw new ArgumentNullException("graphicsDevice");
            }

            triangleVertices = new CCV3F_C4B[bufferSize - bufferSize % 3];
            lineVertices     = new CCV3F_C4B[bufferSize - bufferSize % 2];

            triangleVerts = new CCRawList <CCV3F_C4B[]>(100, true);
            lineVerts     = new CCRawList <CCV3F_C4B[]>(100, true);
        }
Пример #8
0
        public override void Blit()
        {
            if (dirty)
            {
                vertexBuffer.UpdateBuffer();
            }

            base.Blit();

            CCDrawManager drawManager = Scene.Window.DrawManager;
            bool          save        = drawManager.VertexColorEnabled;

            drawManager.VertexColorEnabled = false;
            drawManager.DrawBuffer(vertexBuffer, indexBuffer, 0, Indices.Length / 3);
            drawManager.VertexColorEnabled = save;
        }
Пример #9
0
        internal CCPrimitiveBatch(CCDrawManager drawManager, int bufferSize = DefaultBufferSize)
        {
            DrawManager = drawManager;

            if (drawManager.XnaGraphicsDevice == null)
            {
                throw new ArgumentNullException("graphicsDevice");
            }
            device = drawManager.XnaGraphicsDevice;

            triangleVertices = new VertexPositionColor[bufferSize - bufferSize % 3];
            lineVertices     = new VertexPositionColor[bufferSize - bufferSize % 2];

            // set up a new basic effect, and enable vertex colors.
            basicEffect = new BasicEffect(drawManager.XnaGraphicsDevice);
            basicEffect.VertexColorEnabled = true;
        }
Пример #10
0
        internal void RenderCustomCommand(CCDrawManager drawManager)
        {
            bool originalDepthTestState = drawManager.DepthTest;

            drawManager.DepthTest = UsingDepthTest;

            drawManager.PushMatrix();
            drawManager.SetIdentityMatrix();

            if (WorldTransform != CCAffineTransform.Identity)
            {
                var worldTrans = WorldTransform.XnaMatrix;
                drawManager.MultMatrix(ref worldTrans);
            }
            Action();

            drawManager.PopMatrix();

            drawManager.DepthTest = originalDepthTestState;
        }
Пример #11
0
        public void Draw(CCDrawManager drawManager)
        {
            // early out
            if (VertexBuffer == null || VertexBuffer.Count == 0)
            {
                return;
            }

            if (IndexBuffer != null)
            {
                VertexBuffer.UpdateBuffer();
                IndexBuffer.UpdateBuffer();

                drawManager.DrawBuffer(VertexBuffer, IndexBuffer, 0, IndexBuffer.Count / 3);
            }
            else
            {
                drawManager.DrawPrimitives(PrimitiveType, VertexBuffer.Data.Elements, 0, VertexBuffer.Count);
            }
        }
Пример #12
0
        internal CCGeometryBatch(CCDrawManager drawManager, int bufferSize = DefaultBufferSize)
        {
            DrawManager = drawManager;

            if (drawManager.XnaGraphicsDevice == null)
            {
                throw new ArgumentNullException("graphicsDevice");
            }
            device = drawManager.XnaGraphicsDevice;

            batchItemList      = new List <CCGeometryInstance>(bufferSize);
            freeBatchItemQueue = new Queue <CCGeometryInstance>(bufferSize);

            EnsureCapacity(bufferSize, bufferSize * 2);

            // set up a new basic effect, and enable vertex colors.
            basicEffect = new BasicEffect(drawManager.XnaGraphicsDevice);
            basicEffect.VertexColorEnabled = true;
            basicEffect.TextureEnabled     = true;

            AutoClearInstances = true;
        }
Пример #13
0
        public virtual void Begin()
        {
            CCDrawManager drawManager = CCDrawManager.SharedDrawManager;

            // Save the current matrix
            drawManager.PushMatrix();

//            Matrix projection = Matrix.CreateOrthographicOffCenter(
//                -1.0f / widthRatio, 1.0f / widthRatio,
//                -1.0f / heightRatio, 1.0f / heightRatio,
//                -1, 1
//            );
//
//            drawManager.MultMatrix(ref projection);

            drawManager.SetRenderTarget(Texture);

            if (firstUsage)
            {
                drawManager.Clear(CCColor4B.Transparent);
                firstUsage = false;
            }
        }
Пример #14
0
 internal void UseMaterial(CCDrawManager drawManager)
 {
     drawManager.BlendFunc(BlendType);
     drawManager.BindTexture(Texture);
 }
Пример #15
0
 internal CCGrabber(CCDrawManager drawManager)
 {
     this.drawManager = drawManager;
 }
        public virtual void Blit()
        {
            CCDrawManager drawManager = Scene.Window.DrawManager;

            drawManager.BindTexture(Texture);
        }