void DrawSkyY(int x1, int z1, int x2, int z2, int y, int axisSize, FastColour col, VertexPos3fCol4b[] vertices) { int endX = x2, endZ = z2, startZ = z1; int i = 0; for ( ; x1 < endX; x1 += axisSize) { x2 = x1 + axisSize; if (x2 > endX) { x2 = endX; } z1 = startZ; for ( ; z1 < endZ; z1 += axisSize) { z2 = z1 + axisSize; if (z2 > endZ) { z2 = endZ; } vertices[i++] = new VertexPos3fCol4b(x1, y, z1, col); vertices[i++] = new VertexPos3fCol4b(x1, y, z2, col); vertices[i++] = new VertexPos3fCol4b(x2, y, z2, col); vertices[i++] = new VertexPos3fCol4b(x2, y, z1, col); } } }
void YQuad(float y, float x1, float z1, float x2, float z2) { vertices[index++] = new VertexPos3fCol4b(x1, y, z1, col); vertices[index++] = new VertexPos3fCol4b(x1, y, z2, col); vertices[index++] = new VertexPos3fCol4b(x2, y, z2, col); vertices[index++] = new VertexPos3fCol4b(x2, y, z1, col); }
void InitData() { vertices = new VertexPos3fCol4b[256 * VerticesCount]; lineVertices = new VertexPos3fCol4b[256 * LineVerticesCount]; vb = Graphics.CreateDynamicVb(VertexFormat.Pos3fCol4b, vertices.Length); lineVb = Graphics.CreateDynamicVb(VertexFormat.Pos3fCol4b, lineVertices.Length); }
void XQuad(float x, float z1, float y1, float z2, float y2) { vertices[index++] = new VertexPos3fCol4b(x, y1, z1, col); vertices[index++] = new VertexPos3fCol4b(x, y2, z1, col); vertices[index++] = new VertexPos3fCol4b(x, y2, z2, col); vertices[index++] = new VertexPos3fCol4b(x, y1, z2, col); }
public void Render( double delta, Vector3 cameraPos, VertexPos3fCol4b[] vertices, VertexPos3fCol4b[] lineVertices, ref int index, ref int lineIndex ) { float dist = Math.Min( Utils.DistanceSquared( (Vector3)Min, cameraPos ), Utils.DistanceSquared( (Vector3)Max, cameraPos ) ); float offset = dist < 32 * 32 ? 1/32f : 1/16f; Vector3 p1 = (Vector3)Min + new Vector3( offset ); Vector3 p2 = (Vector3)Max - new Vector3( offset ); FastColour col = Colour; YQuad( vertices, ref index, p1.X, p1.Z, p2.X, p2.Z, p1.Y, col ); // bottom YQuad( vertices, ref index, p1.X, p1.Z, p2.X, p2.Z, p2.Y, col ); // top XQuad( vertices, ref index, p1.X, p1.Y, p2.X, p2.Y, p1.Z, col ); // sides XQuad( vertices, ref index, p1.X, p1.Y, p2.X, p2.Y, p2.Z, col ); ZQuad( vertices, ref index, p1.Z, p1.Y, p2.Z, p2.Y, p1.X, col ); ZQuad( vertices, ref index, p1.Z, p1.Y, p2.Z, p2.Y, p2.X, col ); col = new FastColour( (byte)~col.R, (byte)~col.G, (byte)~col.B ); // bottom face Line( lineVertices, ref lineIndex, p1.X, p1.Y, p1.Z, p2.X, p1.Y, p1.Z, col ); Line( lineVertices, ref lineIndex, p2.X, p1.Y, p1.Z, p2.X, p1.Y, p2.Z, col ); Line( lineVertices, ref lineIndex, p2.X, p1.Y, p2.Z, p1.X, p1.Y, p2.Z, col ); Line( lineVertices, ref lineIndex, p1.X, p1.Y, p2.Z, p1.X, p1.Y, p1.Z, col ); // top face Line( lineVertices, ref lineIndex, p1.X, p2.Y, p1.Z, p2.X, p2.Y, p1.Z, col ); Line( lineVertices, ref lineIndex, p2.X, p2.Y, p1.Z, p2.X, p2.Y, p2.Z, col ); Line( lineVertices, ref lineIndex, p2.X, p2.Y, p2.Z, p1.X, p2.Y, p2.Z, col ); Line( lineVertices, ref lineIndex, p1.X, p2.Y, p2.Z, p1.X, p2.Y, p1.Z, col ); // side faces Line( lineVertices, ref lineIndex, p1.X, p1.Y, p1.Z, p1.X, p2.Y, p1.Z, col ); Line( lineVertices, ref lineIndex, p2.X, p1.Y, p1.Z, p2.X, p2.Y, p1.Z, col ); Line( lineVertices, ref lineIndex, p2.X, p1.Y, p2.Z, p2.X, p2.Y, p2.Z, col ); Line( lineVertices, ref lineIndex, p1.X, p1.Y, p2.Z, p1.X, p2.Y, p2.Z, col ); }
void HorQuad(ref int index, float x1, float z1, float x2, float z2, float y, FastColour col) { vertices[index++] = new VertexPos3fCol4b(x1, y, z1, col); vertices[index++] = new VertexPos3fCol4b(x1, y, z2, col); vertices[index++] = new VertexPos3fCol4b(x2, y, z2, col); vertices[index++] = new VertexPos3fCol4b(x2, y, z1, col); }
void ZQuad(float z, float x1, float y1, float x2, float y2) { vertices[index++] = new VertexPos3fCol4b(x1, y1, z, col); vertices[index++] = new VertexPos3fCol4b(x1, y2, z, col); vertices[index++] = new VertexPos3fCol4b(x2, y2, z, col); vertices[index++] = new VertexPos3fCol4b(x2, y1, z, col); }
static void YQuad( VertexPos3fCol4b[] vertices, ref int index, float x1, float z1, float x2, float z2, float y, FastColour col ) { vertices[index++] = new VertexPos3fCol4b( x1, y, z1, col ); vertices[index++] = new VertexPos3fCol4b( x1, y, z2, col ); vertices[index++] = new VertexPos3fCol4b( x2, y, z2, col ); vertices[index++] = new VertexPos3fCol4b( x2, y, z1, col ); }
static void XQuad( VertexPos3fCol4b[] vertices, ref int index, float x1, float y1, float x2, float y2, float z, FastColour col ) { vertices[index++] = new VertexPos3fCol4b( x1, y1, z, col ); vertices[index++] = new VertexPos3fCol4b( x1, y2, z, col ); vertices[index++] = new VertexPos3fCol4b( x2, y2, z, col ); vertices[index++] = new VertexPos3fCol4b( x2, y1, z, col ); }
static void ZQuad(VertexPos3fCol4b[] vertices, ref int index, float z1, float y1, float z2, float y2, float x, FastColour col) { vertices[index++] = new VertexPos3fCol4b(x, y1, z1, col); vertices[index++] = new VertexPos3fCol4b(x, y2, z1, col); vertices[index++] = new VertexPos3fCol4b(x, y2, z2, col); vertices[index++] = new VertexPos3fCol4b(x, y1, z2, col); }
static void XQuad(VertexPos3fCol4b[] vertices, ref int index, float x1, float y1, float x2, float y2, float z, FastColour col) { vertices[index++] = new VertexPos3fCol4b(x1, y1, z, col); vertices[index++] = new VertexPos3fCol4b(x1, y2, z, col); vertices[index++] = new VertexPos3fCol4b(x2, y2, z, col); vertices[index++] = new VertexPos3fCol4b(x2, y1, z, col); }
public virtual void Draw2DQuad(float x, float y, float width, float height, FastColour col) { quadVerts[0] = new VertexPos3fCol4b(x, y, 0, col); quadVerts[1] = new VertexPos3fCol4b(x + width, y, 0, col); quadVerts[2] = new VertexPos3fCol4b(x + width, y + height, 0, col); quadVerts[3] = new VertexPos3fCol4b(x, y + height, 0, col); SetBatchFormat(VertexFormat.Pos3fCol4b); UpdateDynamicIndexedVb(DrawMode.Triangles, quadVb, quadVerts, 4, 6); }
void ResetSky(int extent, int axisSize) { extent = Utils.AdjViewDist(extent); int x1 = -extent, x2 = map.Width + extent; int z1 = -extent, z2 = map.Length + extent; skyVertices = Utils.CountVertices(x2 - x1, z2 - z1, axisSize); VertexPos3fCol4b[] vertices = new VertexPos3fCol4b[skyVertices]; int height = Math.Max(map.Height + 2 + 6, map.CloudHeight + 6); DrawSkyY(x1, z1, x2, z2, height, axisSize, map.SkyCol, vertices); skyVb = graphics.CreateVb(vertices, VertexFormat.Pos3fCol4b, skyVertices); }
void ZQuad( ref int index, float z1, float z2, float y1, float y2, float x, FastColour col ) { vertices[index++] = new VertexPos3fCol4b( x, y1, z1, col ); vertices[index++] = new VertexPos3fCol4b( x, y2, z1, col ); vertices[index++] = new VertexPos3fCol4b( x, y2, z2, col ); vertices[index++] = new VertexPos3fCol4b( x, y1, z2, col ); }
void InitData() { vertices = new VertexPos3fCol4b[256 * VerticesCount]; lineVertices = new VertexPos3fCol4b[256 * LineVerticesCount]; vb = Graphics.CreateDynamicVb( VertexFormat.Pos3fCol4b, vertices.Length ); lineVb = Graphics.CreateDynamicVb( VertexFormat.Pos3fCol4b, lineVertices.Length ); }
void RenderXPlane( ref int index, float x1, float x2, float y1, float y2, float z, FastColour col ) { vertices[index++] = new VertexPos3fCol4b( x1, y1, z, col ); vertices[index++] = new VertexPos3fCol4b( x1, y2, z, col ); vertices[index++] = new VertexPos3fCol4b( x2, y2, z, col ); vertices[index++] = new VertexPos3fCol4b( x2, y1, z, col ); }
void RenderYPlane( ref int index, float x1, float z1, float x2, float z2, float y, FastColour col ) { vertices[index++] = new VertexPos3fCol4b( x1, y, z1, col ); vertices[index++] = new VertexPos3fCol4b( x1, y, z2, col ); vertices[index++] = new VertexPos3fCol4b( x2, y, z2, col ); vertices[index++] = new VertexPos3fCol4b( x2, y, z1, col ); }
void DrawXPlane( float x, float z1, float y1, float z2, float y2 ) { vertices[index++] = new VertexPos3fCol4b( x, y1, z1, col ); vertices[index++] = new VertexPos3fCol4b( x, y2, z1, col ); vertices[index++] = new VertexPos3fCol4b( x, y2, z2, col ); vertices[index++] = new VertexPos3fCol4b( x, y1, z2, col ); }
void DrawZPlane( float z, float x1, float y1, float x2, float y2 ) { vertices[index++] = new VertexPos3fCol4b( x1, y1, z, col ); vertices[index++] = new VertexPos3fCol4b( x1, y2, z, col ); vertices[index++] = new VertexPos3fCol4b( x2, y2, z, col ); vertices[index++] = new VertexPos3fCol4b( x2, y1, z, col ); }
void Line( ref int index, float x1, float y1, float z1, float x2, float y2, float z2, FastColour col ) { vertices[index++] = new VertexPos3fCol4b( x1, y1, z1, col ); vertices[index++] = new VertexPos3fCol4b( x2, y2, z2, col ); }
void DrawYPlane( float y, float x1, float z1, float x2, float z2 ) { vertices[index++] = new VertexPos3fCol4b( x1, y, z1, col ); vertices[index++] = new VertexPos3fCol4b( x1, y, z2, col ); vertices[index++] = new VertexPos3fCol4b( x2, y, z2, col ); vertices[index++] = new VertexPos3fCol4b( x2, y, z1, col ); }
void DrawSkyY( int x1, int z1, int x2, int z2, int y, int axisSize, FastColour col, VertexPos3fCol4b* vertices ) { int endX = x2, endZ = z2, startZ = z1; for( ; x1 < endX; x1 += axisSize ) { x2 = x1 + axisSize; if( x2 > endX ) x2 = endX; z1 = startZ; for( ; z1 < endZ; z1 += axisSize ) { z2 = z1 + axisSize; if( z2 > endZ ) z2 = endZ; *vertices++ = new VertexPos3fCol4b( x1, y, z1, col ); *vertices++ = new VertexPos3fCol4b( x1, y, z2, col ); *vertices++ = new VertexPos3fCol4b( x2, y, z2, col ); *vertices++ = new VertexPos3fCol4b( x2, y, z1, col ); } } }