本文整理汇总了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);
}
示例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);
}
示例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 ) ;
}
}
示例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);
}
}
示例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);
}
示例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 );
}
示例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 );
}
示例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 );
}