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


C# Graphics.SetCullMode方法代码示例

本文整理汇总了C#中Graphics.SetCullMode方法的典型用法代码示例。如果您正苦于以下问题:C# Graphics.SetCullMode方法的具体用法?C# Graphics.SetCullMode怎么用?C# Graphics.SetCullMode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Graphics的用法示例。


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

示例1: Render

        internal void Render(Graphics zGfx, String pass, Matrix44 zView, Matrix44 zProjection)
        {
            if (!passState.ContainsKey (pass))
                return;

            zGfx.SetCullMode (CullMode.None);
            zGfx.SetActive ((VertexBuffer)null);
            zGfx.SetActive ((IndexBuffer)null);
            zGfx.SetActive ((Texture)null, 0);
            shader.SetVariable ("View", zView);
            shader.SetVariable ("Projection", zProjection);
            zGfx.SetActive (shader, VertexPositionTextureColour.Default.VertexDeclaration);

            _render_batch(zGfx, pass);
        }
开发者ID:dreamsxin,项目名称:engine-1,代码行数:15,代码来源:PrimitiveRenderer.cs

示例2: Render

        internal void Render(Graphics zGfx, string pass, Matrix44 zView, Matrix44 zProjection)
        {
            if (!activeShapes.ContainsKey(pass))
                return;

            var shapesForThisPass = this.activeShapes[pass];

            // Calculate the total number of vertices we're going to be rendering.
            int vertexCount = 0;
            foreach (var shape in shapesForThisPass)
                vertexCount += shape.LineCount * 2;

            // If we have some vertices to draw
            if (vertexCount > 0)
            {
                // Make sure our array is large enough
                if (verts.Length < vertexCount)
                {
                    // If we have to resize, we make our array twice as large as necessary so
                    // we hopefully won't have to resize it for a while.
                    verts = new VertexPositionColour[vertexCount * 2];
                }

                // Now go through the shapes again to move the vertices to our array and
                // add up the number of lines to draw.
                int lineCount = 0;
                int vertIndex = 0;
                foreach (DebugShape shape in shapesForThisPass)
                {
                    lineCount += shape.LineCount;
                    int shapeVerts = shape.LineCount * 2;
                    for (int i = 0; i < shapeVerts; i++)
                        verts[vertIndex++] = shape.Vertices[i];
                }

                zGfx.SetCullMode (CullMode.None);

                // Update the render states on the gpu
                zGfx.SetBlendEquation (BlendMode.Default);

                zGfx.SetActive ((VertexBuffer)null);
                zGfx.SetActive ((IndexBuffer)null);

                debugShader.SetVariable ("View", zView);
                debugShader.SetVariable ("Projection", zProjection);

                // Start our effect to begin rendering.
                zGfx.SetActive (debugShader, VertexPositionColour.Default.VertexDeclaration);

                // We draw in a loop because the Reach profile only supports 65,535 primitives. While it's
                // not incredibly likely, if a game tries to render more than 65,535 lines we don't want to
                // crash. We handle this by doing a loop and drawing as many lines as we can at a time, capped
                // at our limit. We then move ahead in our vertex array and draw the next set of lines.
                int vertexOffset = 0;
                while (lineCount > 0)
                {
                    // Figure out how many lines we're going to draw
                    int linesToDraw = Math.Min (lineCount, 65535);

                    FrameStats.Add ("DrawUserPrimitivesCount", 1);
                    zGfx.DrawUserPrimitives (PrimitiveType.LineList, verts, vertexOffset, linesToDraw);

                    // Move our vertex offset ahead based on the lines we drew
                    vertexOffset += linesToDraw * 2;

                    // Remove these lines from our total line count
                    lineCount -= linesToDraw;
                }
            }
        }
开发者ID:dreamsxin,项目名称:engine-1,代码行数:70,代码来源:DebugRenderer.cs


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