public int AddFace(Face.Facing facing, float x, float y, float z, Vector3 size, ref Color color) { if (color == Color.Black) Console.WriteLine("Black detected."); for (int i = 0; i < buffers.Count; i++) { if (!buffers[i].Full) { //int k = buffers[i].AddFace(Face.getFace(facing, new Vector3(x, y, z), size, color.ToVector3())); int k = buffers[i].AddFace(Face.getInstancedFace(facing, new Vector3(x, y, z), size, color.ToVector3())); if (k > -1) return (i * Size) + k; return -1; } } buffers.Add(new BatchBuffer(Size)); int j = buffers[buffers.Count - 1].AddFace(Face.getInstancedFace(facing, new Vector3(x, y, z), size, color.ToVector3())); if (j > -1) return ((buffers.Count - 1) * Size) + j; return -1; }
public void AddFace( Face.Facing facing, Vector3 position, Vector3 color) { tmp = Face.getFace(facing, position, color); if (tmp == null) return; for (int i = 0; i < 6; i++) { vertices.Add(tmp[i]); } tmp = null; }
public void insertFace( Face.Facing facing, ref Voxel voxel) { List<VertexPositionNormalColor> faces = getVisibleFaces( voxel ); // If empty, append the face to the end and exit; if( faces.Count() == 0 ) { VertexPositionNormalColor[] face = Face.getFace( facing, ref voxel ); vertices.AddRange( face ); return; } int index; // If faces don't exist in the visible vertices, exit. Something's wrong if so, and this should never occur. if( (index = getFaceIndex( ref faces ) ) == -1 ) return; for( int i = 0; i < faces.Count() - 6; i = i + 6 ) { if ( facing < Face.getFacing( faces.GetRange(i, 6) ) ) { vertices.InsertRange( index + i, Face.getFace( facing, ref voxel ) ); return; } } try { vertices.InsertRange(index + 30, Face.getFace(facing, ref voxel)); } catch (ArgumentOutOfRangeException e) { } }
public BasicFace( Face.Facing facing, Vector3 position, int size, Color color ) { this.arrayPosition = 0; this.facing = facing; vertices = Face.getFace( facing, position, size, color.ToVector3() ) ; }
public int AddFace(Face.Facing facing, ref Vector3 position, Vector3 size, ref Color color) { return this.AddFace(facing, position.X, position.Y, position.Z, size, ref color); }
public int AddFace(Face.Facing facing, float x, float y, float z, Vector3 size, ref Color color) { for (int i = 0; i < buffers.Count; i++) { if (!buffers[i].Full) { int k = buffers[i].AddVertices(Face.getFace(facing, new Vector3(x, y, z), size, color.ToVector3())); if (k > -1) return (i * Size) + k; return -1; } } buffers.Add(new BatchBuffer(Size)); int j = buffers[buffers.Count - 1].AddVertices(Face.getFace(facing, new Vector3(x, y, z), size, color.ToVector3())); if (j > -1) return ((buffers.Count - 1) * Size) + j; return -1; }
/// <summary> /// Adds a particular face to the global FaceBatch. /// </summary> /// <param name="facing">The face to add.</param> public void AddFace(Face.Facing facing) { if (facebufferpositions[(int)facing] > -1) Game.world.faceBatch.RemoveFace(facebufferpositions[(int)facing]); facebufferpositions[(int)facing] = Game.world.faceBatch.AddFace(facing, ref Position, m_size, ref color); }
/// <summary> /// Removes a particular face fo a volume from the global FaceBatch. /// </summary> /// <param name="facing">The face to remove.</param> public void RemoveFace(Face.Facing facing) { Game.world.faceBatch.RemoveFace(facebufferpositions[(int)facing]); facebufferpositions[(int)facing] = -1; }