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


C# GraphicsContext.DrawArrays方法代码示例

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


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

示例1: render

        public override void render(GraphicsContext context)
        {
            shaderColored.SetUniformValue(0, ref sceneTransform);
            shaderColored.SetUniformValue(1, ref screenMatrix);
            shaderColored.SetUniformValue(2, 1f);

            context.SetShaderProgram(shaderColored);
            context.SetVertexBuffer(0, vertexBuffer);
            context.DrawArrays(DrawMode.TriangleFan, 0, vertexBuffer.VertexCount);
        }
开发者ID:JimmyDeemo,项目名称:openfl-psm,代码行数:10,代码来源:RendererPerformanceBar.cs

示例2: render

        public override void render(GraphicsContext context)
        {
            if (vertexBuffer == null) return;

            program.SetUniformValue(0, ref sceneTransform);
            program.SetUniformValue(1, ref screenMatrix);
            program.SetUniformValue(2, 1f);

            context.SetShaderProgram(program);
            context.SetVertexBuffer(0, vertexBuffer);
            context.SetTexture(0, texture);
            context.DrawArrays(DrawMode.TriangleFan, 0, vertexBuffer.VertexCount);
            context.SetTexture(0, null);
        }
开发者ID:JimmyDeemo,项目名称:openfl-psm,代码行数:14,代码来源:RendererStartup.cs

示例3: Draw

        /// BasicProgram を指定した描画(一番オリジナルに近い形)
        public void Draw( 
                     GraphicsContext graphics, 
                     BasicProgram program
                      )
        {
            List< LocalPart > localPartList = updateLocalPart();

            // パーツを DrawOrder 順にソート
            localPartList.Sort();

            // パーツの描画
            foreach( LocalPart localPart in localPartList ){
            if( localPart.material != null ){
                setPolygonMode( graphics, localPart.material );
                program.SetMaterial( ref localPart.material );
                setLayers( graphics, program, localPart.material );
            }

            program.SetMatrixPalette( localPart.worldCount, ref localPart.matrixPalette );
            program.Update();

            graphics.SetVertexBuffer( 0, localPart.vertexBuffer ) ;
            graphics.DrawArrays( localPart.primitives ) ;
            }
        }
开发者ID:hatano0x06,项目名称:Coroppoxus,代码行数:26,代码来源:BasicModel+(2).cs

示例4: render

        public override void render(GraphicsContext context)
        {
            base.render(context);

            program.SetUniformValue(1, ref screenMatrix);
            program.SetUniformValue(0, ref sceneTransform);

            context.SetShaderProgram(program);
            context.SetVertexBuffer(0, vertexBuffer);

            foreach ( CellData cell in cells ){
                program.SetUniformValue(3, (float) cell.val);
                program.SetUniformValue(2, (float) cell.time);
                pos.X = cell.x * (CELL_SIZE + 5) - CELL_SIZE * .5f;
                pos.Y = cell.y * (CELL_SIZE + 5) - CELL_SIZE * .5f;
                program.SetUniformValue(4, ref pos);
                context.DrawArrays(DrawMode.Triangles, 0, vertexBuffer.VertexCount);
            }
        }
开发者ID:JimmyDeemo,项目名称:openfl-psm,代码行数:19,代码来源:RendererResourceFields.cs

示例5: render

        public override void render(GraphicsContext context)
        {
            if (dirtyBuffer) {
                validateBuffer();
            }
            if (vertexBuffer == null) return;

            program.SetUniformValue(0, ref sceneTransform);
            program.SetUniformValue(1, ref screenMatrix);
            program.SetUniformValue(2, (float) sceneAlpha);

            context.SetShaderProgram(program);
            context.SetVertexBuffer(0, vertexBuffer);
            if (program == shaderUniversal) context.SetTexture(0, texture);

            context.DrawArrays(DrawMode.Triangles, 0, vertexBuffer.VertexCount);

            if (program == shaderUniversal) context.SetTexture(0, null);
        }
开发者ID:JimmyDeemo,项目名称:openfl-psm,代码行数:19,代码来源:RendererUniversal.cs

示例6: DrawCapsule

        /// カプセル描画
        public void DrawCapsule( GraphicsContext graphics, GeometryCapsule trgCap, Camera cam, Rgba color )
        {
            if( debShader == null || trgCap.R <= 0.00001f ){
            return ;
            }

            /// 球体部分
            ///---------------------------------------------
            DrawSphere( graphics, new GeometrySphere( trgCap.StartPos, trgCap.R ), cam, color );
            DrawSphere( graphics, new GeometrySphere( trgCap.EndPos, trgCap.R ), cam, color );

            /// パイプ部分
            ///---------------------------------------------
            setCapsulePipeVertex( trgCap );

            debVb2.SetVertices( 0, debMesh2.Positions );
            debVb2.SetIndices( debMesh2.Indices );

            Matrix4 localMtx;
            if( trgCap.StartPos.X == trgCap.EndPos.X && trgCap.StartPos.Z == trgCap.EndPos.Z ){
            localMtx = Matrix4.LookAt( trgCap.EndPos, trgCap.StartPos, new Vector3(0.0f, 0.0f, 1.0f));
            }
            else{
            localMtx = Matrix4.LookAt( trgCap.EndPos, trgCap.StartPos, new Vector3(0.0f, 1.0f, 0.0f));
            }
            Matrix4 world = localMtx.Inverse() * Matrix4.Scale( new Vector3( trgCap.R, trgCap.R, trgCap.R ) );
            world.M41 = trgCap.StartPos.X;
            world.M42 = trgCap.StartPos.Y;
            world.M43 = trgCap.StartPos.Z;

            Matrix4 worldViewProj = cam.Projection * cam.View * world;

            // uniform value
            debShader.SetUniformValue( debUIdWVP, ref worldViewProj );

            Vector4 a_Color = new Vector4( (color.R / 255.0f), (color.G / 255.0f), (color.B / 255.0f), (color.A / 255.0f) );
            debShader.SetUniformValue( debShader.FindUniform( "IAmbient" ), ref a_Color );

            graphics.SetShaderProgram( debShader );

            graphics.SetVertexBuffer( 0, debVb2 );
            graphics.DrawArrays( debMesh2.Prim, 0, debMesh2.IndexCount );
        }
开发者ID:hatano0x06,项目名称:Coroppoxus,代码行数:44,代码来源:RenderGeometry.cs

示例7: drawMesh

        /// private メソッド
        ///---------------------------------------------------------------------------
        /// 描画
        private void drawMesh( GraphicsContext graphics, Camera cam, Rgba color )
        {
            Matrix4 world = Matrix4.Translation( new Vector3( 0, 0, 0 ) );
            Matrix4 worldViewProj = cam.Projection * cam.View * world;

            // uniform value
            debShader.SetUniformValue( debUIdWVP, ref worldViewProj );

            Vector4 a_Color = new Vector4( (color.R / 255.0f), (color.G / 255.0f), (color.B / 255.0f), (color.A / 255.0f) );
            debShader.SetUniformValue( debShader.FindUniform( "IAmbient" ), ref a_Color );

            graphics.SetShaderProgram( debShader );

            graphics.SetVertexBuffer( 0, debVb );
            graphics.DrawArrays( debMesh.Prim, 0, debMesh.IndexCount );
        }
开发者ID:hatano0x06,项目名称:Coroppoxus,代码行数:19,代码来源:RenderGeometry.cs

示例8: DrawSphere

        /// 球描画
        public void DrawSphere( GraphicsContext graphics, GeometrySphere trgSph, Camera cam, Rgba color )
        {
            if( debShader == null ){
            return ;
            }

            debVb.SetVertices( 0, debMesh.Positions );
            debVb.SetIndices( debMesh.Indices );

             		Matrix4 world = Matrix4.Translation( new Vector3( trgSph.X, trgSph.Y, trgSph.Z ) ) * Matrix4.Scale( new Vector3( trgSph.R, trgSph.R, trgSph.R ) );
            Matrix4 worldViewProj = cam.Projection * cam.View * world;

            // uniform value
            debShader.SetUniformValue( debUIdWVP, ref worldViewProj );

            Vector4 a_Color = new Vector4( (color.R / 255.0f), (color.G / 255.0f), (color.B / 255.0f), (color.A / 255.0f) );
            debShader.SetUniformValue( debShader.FindUniform( "IAmbient" ), ref a_Color );

            graphics.SetShaderProgram( debShader );

            graphics.SetVertexBuffer( 0, debVb );
            graphics.DrawArrays( debMesh.Prim, 0, debMesh.IndexCount );
        }
开发者ID:hatano0x06,项目名称:Coroppoxus,代码行数:24,代码来源:RenderGeometry.cs


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