public OutpostColor this[OutpostLibrary.IntVector3 voxel] { get { return this[voxel.X, voxel.Y, voxel.Z]; } set { this[voxel.X, voxel.Y, voxel.Z] = value; } }
public void makeSelection(OutpostLibrary.IntVector3 selected) { if (selected == lastSelected) return; //it's still selected int voxPerEdge = OutpostLibrary.Navigation.Sizes.VoxelsPerEdge; if ((lastSelected.X >= 0 && lastSelected.X < voxPerEdge) && (lastSelected.Y >= 0 && lastSelected.Y < voxPerEdge) && (lastSelected.Z >= 0 && lastSelected.Z < voxPerEdge)) { int offset = lastSelected.X * voxPerEdge * voxPerEdge + lastSelected.Y * voxPerEdge + lastSelected.Z; offset = offset * 8; //a bit "magic number"-y, but it's the number of vertices per voxel. for (int i = 0; i < 8; i++) { wireframeVertices[i + offset].Color = Color.Black; } } if ((selected.X >= 0 && selected.X < voxPerEdge) && (selected.Y >= 0 && selected.Y < voxPerEdge) && (selected.Z >= 0 && selected.Z < voxPerEdge)) { int offset = selected.X * voxPerEdge * voxPerEdge + selected.Y * voxPerEdge + selected.Z; offset = offset * 8; //a bit "magic number"-y, but it's the number of vertices per voxel. for (int i = 0; i < 8; i++) { wireframeVertices[i + offset].Color = Color.Red; } } lastSelected = selected; wfVBuff.SetData<VertexPositionColor>(wireframeVertices); //actually, is that even necessary? //ah well //it doesn't hurt //I mean... except for optimization //but I don't think it makes a big difference there }
public void buildChunk(OutpostLibrary.IntVector3 location, Chunk chunk) { Func<Chunk, OutpostLibrary.IntVector3, LuaResult> doBuild = game["buildChunk"] as Func<Chunk, OutpostLibrary.IntVector3, LuaResult>; try { doBuild(chunk, location); } catch (LuaRuntimeException e) { Logger.Log(e.ToString()); LuaExceptionData d = LuaExceptionData.GetData(e); Logger.Log(d.GetStackTrace(0, false)); } }
public void makeVertices(float spread, OutpostLibrary.IntVector3 selected) { float midpoint = (voxelSize * Sizes.VoxelsPerEdge + spread * (Sizes.VoxelsPerEdge - 1)) * 0.5f; List<VertexPositionColorNormal> verts = new List<VertexPositionColorNormal>(); List<VertexPositionColor> wfVerts = new List<VertexPositionColor>(); for (int x = 0; x < Sizes.VoxelsPerEdge; x++) { float xPos = (x * (voxelSize + spread)) - midpoint; for (int y = 0; y < Sizes.VoxelsPerEdge; y++) { float yPos = (y * (voxelSize + spread)) - midpoint; for (int z = 0; z < Sizes.VoxelsPerEdge; z++) { float zPos = (z * (voxelSize + spread)) - midpoint; Vector3 pos = new Vector3(xPos, yPos, zPos); bool isSelected = false; if (selected.X == x && selected.Y == y && selected.Z == z) isSelected = true; makeVoxelVerts(verts, wfVerts, vox[x, y, z].color, pos, isSelected); } } } vertices = verts.ToArray(); wireframeVertices = wfVerts.ToArray(); vBuff.SetData<VertexPositionColorNormal>(vertices); wfVBuff.SetData<VertexPositionColor>(wireframeVertices); lastSelected = selected; }
public patternOrChunk(OutpostLibrary.Structure pat) { pattern = pat; chunk = null; }