/* * @param the block's location */ public void addBlock(Vector3 loc, BlockFace face) { Vector3 displayCoord = this.mWorld.getDisplayCoords(this.mIsland.getPosition(), loc); for (int i = 0; i < 4; i++) { block.Position(displayCoord + getBlockPointsCoord((int)face * 4 + i)); block.TextureCoord(getTextureCoord((int)face * 4 + i)); block.Normal(this.getNormals((int)face)); this.faceNumber++; } block.Quad((uint)this.faceNumber - 4, (uint)this.faceNumber - 3, (uint)this.faceNumber - 2, (uint)this.faceNumber - 1); }
// creates a simple box with specified material public static MovableObject MakeBox(SceneManager mgr, String materialName, Vector3 dims, Vector2 coord) { ManualObject mo = mgr.CreateManualObject(); mo.Begin(materialName, RenderOperation.OperationTypes.OT_TRIANGLE_LIST); float w = dims.x * 0.5f; float h = dims.y * 0.5f; float d = dims.z * 0.5f; Vector3[] norm = { new Vector3(1.0f, 0.0f, 0.0f), new Vector3(0.0f, 1.0f, 0.0f), new Vector3(0.0f, 0.0f, 1.0f), new Vector3(-1.0f, 0.0f, 0.0f), new Vector3(0.0f, -1.0f, 0.0f), new Vector3(0.0f, 0.0f, -1.0f) }; Vector3[] geom = // 6 faces x 4 vertexes { new Vector3(+w, -h, +d), new Vector3(+w, -h, -d), new Vector3(+w, +h, -d), new Vector3(+w, +h, +d), new Vector3(+w, +h, +d), new Vector3(+w, +h, -d), new Vector3(-w, +h, -d), new Vector3(-w, +h, +d), new Vector3(+w, +h, +d), new Vector3(-w, +h, +d), new Vector3(-w, -h, +d), new Vector3(+w, -h, +d), new Vector3(-w, -h, +d), new Vector3(-w, +h, +d), new Vector3(-w, +h, -d), new Vector3(-w, -h, -d), new Vector3(-w, -h, +d), new Vector3(-w, -h, -d), new Vector3(+w, -h, -d), new Vector3(+w, -h, +d), new Vector3(-w, -h, -d), new Vector3(-w, +h, -d), new Vector3(+w, +h, -d), new Vector3(+w, -h, -d) }; // texcoords Vector2[] uvs = { new Vector2(0, 0), new Vector2(0, coord.y), coord, new Vector2(coord.x, 0) }; for (int i = 0; i < 6; i++) // 6 faces { uint k = (uint)(i * 4); for (int j = 0; j < 4; j++) // 4 verts { mo.Position(geom[k + j]); mo.Normal(norm[i]); mo.TextureCoord(uvs[j]); } mo.Quad(k, k + 1, k + 2, k + 3); } mo.End(); return(mo); }
static void DisplayRectangle(Vector3 origin, int height, int width, int depth, SceneNode node) { ManualObject block = new ManualObject(Guid.NewGuid().ToString()); block.Begin("cube/Sand", RenderOperation.OperationTypes.OT_TRIANGLE_LIST); Vector2[] textureCoord = new Vector2[] { new Vector2(0, 0), new Vector2(0, 1), new Vector2(1, 1), new Vector2(1, 0), new Vector2(1, 1), new Vector2(1, 0), new Vector2(0, 0), new Vector2(0, 1), new Vector2(0, 0), new Vector2(0, 1), new Vector2(1, 1), new Vector2(1, 0), new Vector2(0, 0), new Vector2(0, 1), new Vector2(1, 1), new Vector2(1, 0), new Vector2(1, 1), new Vector2(1, 0), new Vector2(0, 0), new Vector2(0, 1), new Vector2(0, 1), new Vector2(1, 1), new Vector2(1, 0), new Vector2(0, 0) }; Vector3[] blockPointCoords = new Vector3[] { new Vector3(0, height, 0), new Vector3(0, 0, 0), new Vector3(width, 0, 0), new Vector3(width, height, 0), new Vector3(0, 0, -depth), new Vector3(0, height, -depth), new Vector3(width, height, -depth), new Vector3(width, 0, -depth), new Vector3(width, height, 0), new Vector3(width, height, -depth), new Vector3(0, height, -depth), new Vector3(0, height, 0), new Vector3(0, 0, 0), new Vector3(0, 0, -depth), new Vector3(width, 0, -depth), new Vector3(width, 0, 0), new Vector3(0, 0, 0), new Vector3(0, height, 0), new Vector3(0, height, -depth), new Vector3(0, 0, -depth), new Vector3(width, 0, 0), new Vector3(width, 0, -depth), new Vector3(width, height, -depth), new Vector3(width, height, 0), }; int a = 0; for (int i = 0; i < 6; i++) { for (int j = 0; j < 4; j++) { block.Position(origin + blockPointCoords[j * 4 + i]); block.TextureCoord(textureCoord[j * 4 + i]); a++; } block.Quad((uint)a - 4, (uint)a - 3, (uint)a - 2, (uint)a - 1); } block.End(); node.AttachObject(block); }
public void createWalls( ManualObject room, short doorFlags, bool isEnclosure ) { if ( isEnclosure ) { if ( ( doorFlags & (short)RoomDoors.DOOR_FRONT ) != 0 ) { // make front wall outward facing with door room.Quad( 0, 8, 11, 3 ); room.Quad( 1, 9, 8, 0 ); room.Quad( 2, 10, 9, 1 ); room.Quad( 3, 11, 10, 2 ); } else { // make front wall outward facing without door room.Quad( 0, 1, 2, 3 ); } if ( ( doorFlags & (short)RoomDoors.DOOR_BACK ) != 0 ) { // make back wall outward facing with door room.Quad( 7, 15, 12, 4 ); room.Quad( 6, 14, 15, 7 ); room.Quad( 5, 13, 14, 6 ); room.Quad( 4, 12, 13, 5 ); } else { // make back wall outward facing without door room.Quad( 7, 6, 5, 4 ); } if ( ( doorFlags & (short)RoomDoors.DOOR_TOP ) != 0 ) { // make top wall outward facing with door room.Quad( 0, 17, 16, 4 ); room.Quad( 4, 16, 19, 7 ); room.Quad( 7, 19, 18, 3 ); room.Quad( 3, 18, 17, 0 ); } else { // make top wall outward facing without door room.Quad( 0, 3, 7, 4 ); } if ( ( doorFlags & (short)RoomDoors.DOOR_BOT ) != 0 ) { // make bottom wall outward facing with door room.Quad( 5, 20, 21, 1 ); room.Quad( 6, 23, 20, 5 ); room.Quad( 2, 22, 23, 6 ); room.Quad( 1, 21, 22, 2 ); } else { // make bottom wall outward facing without door room.Quad( 2, 1, 5, 6 ); } if ( ( doorFlags & (short)RoomDoors.DOOR_LEFT ) != 0 ) { // make left wall outward facing with door room.Quad( 0, 24, 25, 1 ); room.Quad( 4, 27, 24, 0 ); room.Quad( 5, 26, 27, 4 ); room.Quad( 1, 25, 26, 5 ); } else { // make left side wall outward facing without door room.Quad( 1, 0, 4, 5 ); } if ( ( doorFlags & (short)RoomDoors.DOOR_RIGHT ) != 0 ) { // make right wall outward facing with door room.Quad( 2, 29, 28, 3 ); room.Quad( 6, 30, 29, 2 ); room.Quad( 7, 31, 30, 6 ); room.Quad( 3, 28, 31, 7 ); } else { // make right side wall outward facing without door room.Quad( 3, 2, 6, 7 ); } } else { // front back if ( ( doorFlags & (short)RoomDoors.DOOR_FRONT ) != 0 ) { // make front wall inward facing with door room.Quad( 3, 11, 8, 0 ); room.Quad( 0, 8, 9, 1 ); room.Quad( 1, 9, 10, 2 ); room.Quad( 2, 10, 11, 3 ); } else { // make front wall inward facing without door room.Quad( 3, 2, 1, 0 ); } if ( ( doorFlags & (short)RoomDoors.DOOR_BACK ) != 0 ) { // make back wall inward facing with door room.Quad( 4, 12, 15, 7 ); room.Quad( 7, 15, 14, 6 ); room.Quad( 6, 14, 13, 5 ); room.Quad( 5, 13, 12, 4 ); } else { // make back wall inward facing without door room.Quad( 4, 5, 6, 7 ); } // top bottom if ( ( doorFlags & (short)RoomDoors.DOOR_TOP ) != 0 ) { // make top wall inward facing with door room.Quad( 4, 16, 17, 0 ); room.Quad( 7, 19, 16, 4 ); room.Quad( 3, 18, 19, 7 ); room.Quad( 0, 17, 18, 3 ); } else { // make top wall inward facing without door room.Quad( 4, 7, 3, 0 ); } if ( ( doorFlags & (short)RoomDoors.DOOR_BOT ) != 0 ) { // make bottom wall inward facing with door room.Quad( 1, 21, 20, 5 ); room.Quad( 5, 20, 23, 6 ); room.Quad( 6, 23, 22, 2 ); room.Quad( 2, 22, 21, 1 ); } else { // make bottom wall inward facing without door room.Quad( 6, 5, 1, 2 ); } // end caps if ( ( doorFlags & (short)RoomDoors.DOOR_LEFT ) != 0 ) { // make left wall inward facing with door room.Quad( 1, 25, 24, 0 ); room.Quad( 0, 24, 27, 4 ); room.Quad( 4, 27, 26, 5 ); room.Quad( 5, 26, 25, 1 ); } else { // make left side wall inward facing without door room.Quad( 5, 4, 0, 1 ); } if ( ( doorFlags & (short)RoomDoors.DOOR_RIGHT ) != 0 ) { // make right wall inward facing with door room.Quad( 3, 28, 29, 2 ); room.Quad( 2, 29, 30, 6 ); room.Quad( 6, 30, 31, 7 ); room.Quad( 7, 31, 28, 3 ); } else { // make right side wall inward facing without door room.Quad( 7, 6, 2, 3 ); } } }
/// <summary> /// Buduje quada o wymaganych parametrach. Quad bedzie mogl byc wyswietlony w przestrzeni 3D. Ma nakladn¹ teksture wg textureName /// </summary> /// <param name="quadrangle"></param> /// <param name="origin"></param> /// <param name="textureName"></param> public void SetCorners3D(Quadrangle quadrangle, Vector3 origin, String textureName) { this.quadrangle = quadrangle; Vector2 leftBottom = quadrangle.Peaks[0].ToVector2(); Vector2 leftTop = quadrangle.Peaks[1].ToVector2(); Vector2 rightTop = quadrangle.Peaks[2].ToVector2(); Vector2 rightBottom = quadrangle.Peaks[3].ToVector2(); float extend = 1.25f; corners = new float[4][]; corners[0] = new float[3]; corners[0][0] = extend * rightBottom.x + origin.x; corners[0][1] = extend * rightBottom.y + origin.y; corners[0][2] = origin.z; corners[1] = new float[3]; corners[1][0] = extend * rightTop.x + origin.x; corners[1][1] = extend * rightTop.y + origin.y; corners[1][2] = origin.z; corners[2] = new float[3]; corners[2][0] = extend * leftTop.x + origin.x; corners[2][1] = extend * leftTop.y + origin.y; corners[2][2] = origin.z; corners[3] = new float[3]; corners[3][0] = extend * leftBottom.x + origin.x; corners[3][1] = extend * leftBottom.y + origin.y; corners[3][2] = origin.z; float textureTop = 0; float textureLeft = 0; float textureBottom = 1; float textureRight = 1; // manualObject.RenderQueueGroup = (byte)RenderQueueGroupID.RENDER_QUEUE_MAIN - 1; manualObject.Clear(); manualObject.Begin("Misc/BoundingQuadrangle", RenderOperation.OperationTypes.OT_TRIANGLE_LIST); manualObject.Position(origin.x + leftBottom.x, origin.y + leftBottom.y, origin.z); manualObject.TextureCoord(textureLeft, textureBottom); manualObject.Position(origin.x + leftTop.x, origin.y + leftTop.y, origin.z); manualObject.TextureCoord(textureLeft, textureTop); manualObject.Position(origin.x + rightTop.x, origin.y + rightTop.y, origin.z); manualObject.TextureCoord(textureRight, textureTop); manualObject.Position(origin.x + rightBottom.x, origin.y + rightBottom.y, origin.z); manualObject.TextureCoord(textureRight, textureBottom); /* manualObject.Position( origin.x + leftBottom.x, origin.y + leftBottom.y, origin.z); * manualObject.TextureCoord(0, 0);*/ manualObject.Quad(3, 2, 1, 0); manualObject.End(); /* * AxisAlignedBox box = new AxisAlignedBox(); * float hwidth = 1.4f * (quadrangle.RightMostX - quadrangle.LeftMostX) * 0.5f; * float hheight = 1.4f * (quadrangle.HighestY - quadrangle.LowestY) * 0.5f; * box.SetMinimum(origin.x - hwidth, origin.y - hheight, origin.z - 10); * box.SetMaximum(origin.x + hwidth, origin.y + hheight, origin.z + 10); * * manualObject.BoundingBox = box; */ MaterialPtr mat = ViewHelper.CloneMaterial("AdMaterial", manualObject.Name + "AdMaterial"); Pass pass = mat.GetBestTechnique().GetPass(0); pass.DepthWriteEnabled = true; pass.SetSceneBlending(SceneBlendType.SBT_TRANSPARENT_ALPHA); TextureUnitState state = pass.GetTextureUnitState(0); state.SetTextureName(textureName); manualObject.SetMaterialName(0, mat.Name); manualObject.CastShadows = false; OnSetCorners(); // manualObject.SetMaterialName(0, "Concrete"); }
public static void generateFace() { string defaultMaterial = "Default"; ManualObject block = new ManualObject("frontFace"); block.Begin(defaultMaterial, RenderOperation.OperationTypes.OT_TRIANGLE_LIST); block.Position(new Vector3(0, 0, 0)); block.TextureCoord(1, 1); block.Normal(VanillaMultiBlock.normals[0]); block.Position(new Vector3(0, Cst.CUBE_SIDE, 0)); block.TextureCoord(1, 0); block.Normal(VanillaMultiBlock.normals[0]); block.Position(new Vector3(Cst.CUBE_SIDE, Cst.CUBE_SIDE, 0)); block.TextureCoord(0, 0); block.Normal(VanillaMultiBlock.normals[0]); block.Position(new Vector3(Cst.CUBE_SIDE, 0, 0)); block.TextureCoord(0, 1); block.Normal(VanillaMultiBlock.normals[0]); block.Quad(3, 2, 1, 0); block.End(); block.ConvertToMesh("frontFace"); block = new ManualObject("underFace"); block.Begin(defaultMaterial, RenderOperation.OperationTypes.OT_TRIANGLE_LIST); block.Position(new Vector3(0, 0, 0)); block.TextureCoord(1, 1); block.Normal(VanillaMultiBlock.normals[1]); block.Position(new Vector3(0, 0, -Cst.CUBE_SIDE)); block.TextureCoord(1, 0); block.Normal(VanillaMultiBlock.normals[1]); block.Position(new Vector3(Cst.CUBE_SIDE, 0, -Cst.CUBE_SIDE)); block.TextureCoord(0, 0); block.Normal(VanillaMultiBlock.normals[1]); block.Position(new Vector3(Cst.CUBE_SIDE, 0, 0)); block.TextureCoord(0, 1); block.Normal(VanillaMultiBlock.normals[1]); block.Quad(0, 1, 2, 3); block.End(); block.ConvertToMesh("underFace"); block = new ManualObject("rightFace"); block.Begin(defaultMaterial, RenderOperation.OperationTypes.OT_TRIANGLE_LIST); block.Position(new Vector3(Cst.CUBE_SIDE, 0, 0)); block.TextureCoord(0, 1); block.Normal(VanillaMultiBlock.normals[2]); block.Position(new Vector3(Cst.CUBE_SIDE, 0, -Cst.CUBE_SIDE)); block.TextureCoord(1, 1); block.Normal(VanillaMultiBlock.normals[2]); block.Position(new Vector3(Cst.CUBE_SIDE, Cst.CUBE_SIDE, -Cst.CUBE_SIDE)); block.TextureCoord(1, 0); block.Normal(VanillaMultiBlock.normals[2]); block.Position(new Vector3(Cst.CUBE_SIDE, Cst.CUBE_SIDE, 0)); block.TextureCoord(0, 0); block.Normal(VanillaMultiBlock.normals[2]); block.Quad(0, 1, 2, 3); block.End(); block.ConvertToMesh("rightFace"); block = new ManualObject("upperFace"); block.Begin(defaultMaterial, RenderOperation.OperationTypes.OT_TRIANGLE_LIST); block.Position(new Vector3(Cst.CUBE_SIDE, Cst.CUBE_SIDE, 0)); block.TextureCoord(1, 1); block.Normal(VanillaMultiBlock.normals[3]); block.Position(new Vector3(Cst.CUBE_SIDE, Cst.CUBE_SIDE, -Cst.CUBE_SIDE)); block.TextureCoord(1, 0); block.Normal(VanillaMultiBlock.normals[3]); block.Position(new Vector3(0, Cst.CUBE_SIDE, -Cst.CUBE_SIDE)); block.TextureCoord(0, 0); block.Normal(VanillaMultiBlock.normals[3]); block.Position(new Vector3(0, Cst.CUBE_SIDE, 0)); block.TextureCoord(0, 1); block.Normal(VanillaMultiBlock.normals[3]); block.Quad(0, 1, 2, 3); block.End(); block.ConvertToMesh("upperFace"); block = new ManualObject("leftFace"); block.Begin(defaultMaterial, RenderOperation.OperationTypes.OT_TRIANGLE_LIST); block.Position(new Vector3(0, 0, 0)); block.TextureCoord(1, 1); block.Normal(VanillaMultiBlock.normals[4]); block.Position(new Vector3(0, Cst.CUBE_SIDE, 0)); block.TextureCoord(1, 0); block.Normal(VanillaMultiBlock.normals[4]); block.Position(new Vector3(0, Cst.CUBE_SIDE, -Cst.CUBE_SIDE)); block.TextureCoord(0, 0); block.Normal(VanillaMultiBlock.normals[4]); block.Position(new Vector3(0, 0, -Cst.CUBE_SIDE)); block.TextureCoord(0, 1); block.Normal(VanillaMultiBlock.normals[4]); block.Quad(0, 1, 2, 3); block.End(); block.ConvertToMesh("leftFace"); block = new ManualObject("backFace"); block.Begin(defaultMaterial, RenderOperation.OperationTypes.OT_TRIANGLE_LIST); block.Position(new Vector3(0, 0, -Cst.CUBE_SIDE)); block.TextureCoord(1, 1); block.Normal(VanillaMultiBlock.normals[5]); block.Position(new Vector3(0, Cst.CUBE_SIDE, -Cst.CUBE_SIDE)); block.TextureCoord(1, 0); block.Normal(VanillaMultiBlock.normals[5]); block.Position(new Vector3(Cst.CUBE_SIDE, Cst.CUBE_SIDE, -Cst.CUBE_SIDE)); block.TextureCoord(0, 0); block.Normal(VanillaMultiBlock.normals[5]); block.Position(new Vector3(Cst.CUBE_SIDE, 0, -Cst.CUBE_SIDE)); block.TextureCoord(0, 1); block.Normal(VanillaMultiBlock.normals[5]); block.Quad(0, 1, 2, 3); block.End(); block.ConvertToMesh("backFace"); }
/// <summary> /// Helper method to render a composite map. /// </summary> /// <param name="size"> The requested composite map size</param> /// <param name="rect"> The region of the composite map to update, in image space</param> /// <param name="mat">The material to use to render the map</param> /// <param name="destCompositeMap"></param> public virtual void RenderCompositeMap(int size, Rectangle rect, Material mat, Texture destCompositeMap) { //return; if (mCompositeMapSM == null) { //dedicated SceneManager mCompositeMapSM = Root.Instance.CreateSceneManager(SceneType.ExteriorClose, "TerrainMaterialGenerator_SceneManager"); float camDist = 100; float halfCamDist = camDist * 0.5f; mCompositeMapCam = mCompositeMapSM.CreateCamera("TerrainMaterialGenerator_Camera"); mCompositeMapCam.Position = new Vector3(0, 0, camDist); //mCompositeMapCam.LookAt(Vector3.Zero); mCompositeMapCam.ProjectionType = Projection.Orthographic; mCompositeMapCam.Near = 10; mCompositeMapCam.Far = 999999* 3; //mCompositeMapCam.AspectRatio = camDist / camDist; mCompositeMapCam.SetOrthoWindow(camDist, camDist); // Just in case material relies on light auto params mCompositeMapLight = mCompositeMapSM.CreateLight("TerrainMaterialGenerator_Light"); mCompositeMapLight.Type = LightType.Directional; RenderSystem rSys = Root.Instance.RenderSystem; float hOffset = rSys.HorizontalTexelOffset / (float)size; float vOffset = rSys.VerticalTexelOffset / (float)size; //setup scene mCompositeMapPlane = mCompositeMapSM.CreateManualObject("TerrainMaterialGenerator_ManualObject"); mCompositeMapPlane.Begin(mat.Name, OperationType.TriangleList); mCompositeMapPlane.Position(-halfCamDist, halfCamDist, 0); mCompositeMapPlane.TextureCoord(0 - hOffset, 0 - vOffset); mCompositeMapPlane.Position(-halfCamDist, -halfCamDist, 0); mCompositeMapPlane.TextureCoord(0 - hOffset, 1 - vOffset); mCompositeMapPlane.Position(halfCamDist, -halfCamDist, 0); mCompositeMapPlane.TextureCoord(1 - hOffset, 1 - vOffset); mCompositeMapPlane.Position(halfCamDist, halfCamDist, 0); mCompositeMapPlane.TextureCoord(1 - hOffset, 0 - vOffset); mCompositeMapPlane.Quad(0, 1, 2, 3); mCompositeMapPlane.End(); mCompositeMapSM.RootSceneNode.AttachObject(mCompositeMapPlane); }//end if // update mCompositeMapPlane.SetMaterialName(0, mat.Name); mCompositeMapLight.Direction = TerrainGlobalOptions.LightMapDirection; mCompositeMapLight.Diffuse = TerrainGlobalOptions.CompositeMapDiffuse; mCompositeMapSM.AmbientLight =TerrainGlobalOptions.CompositeMapAmbient; //check for size change (allow smaller to be reused) if (mCompositeMapRTT != null && size != mCompositeMapRTT.Width) { TextureManager.Instance.Remove(mCompositeMapRTT); mCompositeMapRTT = null; } if (mCompositeMapRTT == null) { mCompositeMapRTT = TextureManager.Instance.CreateManual( mCompositeMapSM.Name + "/compRTT", ResourceGroupManager.DefaultResourceGroupName, TextureType.TwoD, size, size, 0, PixelFormat.BYTE_RGBA, TextureUsage.RenderTarget); RenderTarget rtt = mCompositeMapRTT.GetBuffer().GetRenderTarget(); // don't render all the time, only on demand rtt.IsAutoUpdated = false; Viewport vp = rtt.AddViewport(mCompositeMapCam); // don't render overlays vp.ShowOverlays = false; } // calculate the area we need to update float vpleft = (float)rect.Left / (float)size; float vptop = (float)rect.Top / (float)size; float vpright = (float)rect.Right / (float)size; float vpbottom = (float)rect.Bottom / (float)size; float vpwidth = (float)rect.Width / (float)size; float vpheight = (float)rect.Height / (float)size; RenderTarget rtt2 = mCompositeMapRTT.GetBuffer().GetRenderTarget(); Viewport vp2 = rtt2.GetViewport(0); mCompositeMapCam.SetWindow(vpleft, vptop, vpright, vpbottom); rtt2.Update(); vp2.Update(); // We have an RTT, we want to copy the results into a regular texture // That's because in non-update scenarios we don't want to keep an RTT // around. We use a single RTT to serve all terrain pages which is more // efficient. BasicBox box = new BasicBox((int)rect.Left, (int)rect.Top, (int)rect.Right, (int)rect.Bottom); destCompositeMap.GetBuffer().Blit(mCompositeMapRTT.GetBuffer(), box, box); }
static void DisplayRectangle(Vector3 origin, int height, int width, int depth, SceneNode node) { ManualObject block = new ManualObject(Guid.NewGuid().ToString()); block.Begin("cube/Sand", RenderOperation.OperationTypes.OT_TRIANGLE_LIST); Vector2[] textureCoord = new Vector2[] { new Vector2(0, 0), new Vector2(0, 1), new Vector2(1, 1), new Vector2(1, 0), new Vector2(1, 1), new Vector2(1, 0), new Vector2(0, 0), new Vector2(0, 1), new Vector2(0, 0), new Vector2(0, 1), new Vector2(1, 1), new Vector2(1, 0), new Vector2(0, 0), new Vector2(0, 1), new Vector2(1, 1), new Vector2(1, 0), new Vector2(1, 1), new Vector2(1, 0), new Vector2(0, 0), new Vector2(0, 1), new Vector2(0, 1), new Vector2(1, 1), new Vector2(1, 0), new Vector2(0, 0) }; Vector3[] blockPointCoords = new Vector3[] { new Vector3(0, height, 0), new Vector3(0, 0, 0), new Vector3(width, 0, 0), new Vector3(width, height, 0), new Vector3(0, 0, -depth), new Vector3(0, height, -depth), new Vector3(width, height, -depth), new Vector3(width, 0, -depth), new Vector3(width, height, 0), new Vector3(width, height, -depth), new Vector3(0, height, -depth), new Vector3(0, height, 0), new Vector3(0, 0, 0), new Vector3(0, 0, -depth), new Vector3(width, 0, -depth), new Vector3(width, 0, 0), new Vector3(0, 0, 0), new Vector3(0, height, 0), new Vector3(0, height, -depth), new Vector3(0, 0, -depth), new Vector3(width, 0, 0), new Vector3(width, 0, -depth), new Vector3(width, height, -depth), new Vector3(width, height, 0), }; int a = 0; for(int i = 0; i < 6; i++) { for(int j = 0; j < 4; j++) { block.Position(origin + blockPointCoords[j * 4 + i]); block.TextureCoord(textureCoord[j * 4 + i]); a++; } block.Quad((uint)a-4, (uint)a-3, (uint)a-2, (uint)a-1); } block.End(); node.AttachObject(block); }