Ejemplo n.º 1
0
	public static BlockModel GetCubeModel() {
		BlockModel NewBlockModel = new BlockModel ();
		// top
		NewBlockModel.BlockMeshes [0].Verticies.Add (new Vector3(- 0.5f, 0.5f, 0.5f));
		NewBlockModel.BlockMeshes [0].Verticies.Add (new Vector3(0.5f, 0.5f, 0.5f));
		NewBlockModel.BlockMeshes [0].Verticies.Add (new Vector3(0.5f, 0.5f, -0.5f));
		NewBlockModel.BlockMeshes [0].Verticies.Add (new Vector3(- 0.5f, 0.5f, - 0.5f));
		NewBlockModel.AddQuadIndicies (0);
		// bottom
		NewBlockModel.BlockMeshes [1].Verticies.Add (new Vector3(- 0.5f, -0.5f, -0.5f));
		NewBlockModel.BlockMeshes [1].Verticies.Add (new Vector3(0.5f, -0.5f, -0.5f));
		NewBlockModel.BlockMeshes [1].Verticies.Add (new Vector3(0.5f, -0.5f, 0.5f));
		NewBlockModel.BlockMeshes [1].Verticies.Add (new Vector3(- 0.5f, -0.5f, 0.5f));
		NewBlockModel.AddQuadIndicies (1);
		// north
		NewBlockModel.BlockMeshes [2].Verticies.Add (new Vector3(0.5f, -0.5f, 0.5f));
		NewBlockModel.BlockMeshes [2].Verticies.Add (new Vector3(0.5f, 0.5f, 0.5f));
		NewBlockModel.BlockMeshes [2].Verticies.Add (new Vector3(-0.5f, 0.5f, 0.5f));
		NewBlockModel.BlockMeshes [2].Verticies.Add (new Vector3(-0.5f, -0.5f, 0.5f));
		NewBlockModel.AddQuadIndicies (2);
		// east
		NewBlockModel.BlockMeshes [3].Verticies.Add (new Vector3(0.5f, -0.5f, -0.5f));
		NewBlockModel.BlockMeshes [3].Verticies.Add (new Vector3(0.5f, 0.5f, -0.5f));
		NewBlockModel.BlockMeshes [3].Verticies.Add (new Vector3(0.5f, 0.5f, 0.5f));
		NewBlockModel.BlockMeshes [3].Verticies.Add (new Vector3(0.5f, -0.5f, 0.5f));
		NewBlockModel.AddQuadIndicies (3);
		
		// south
		NewBlockModel.BlockMeshes [4].Verticies.Add (new Vector3(-0.5f, -0.5f, -0.5f));
		NewBlockModel.BlockMeshes [4].Verticies.Add (new Vector3(-0.5f, 0.5f, -0.5f));
		NewBlockModel.BlockMeshes [4].Verticies.Add (new Vector3(0.5f, 0.5f, -0.5f));
		NewBlockModel.BlockMeshes [4].Verticies.Add (new Vector3(0.5f, -0.5f, -0.5f));
		NewBlockModel.AddQuadIndicies (4);
		
		// west
		NewBlockModel.BlockMeshes [5].Verticies.Add (new Vector3(-0.5f, -0.5f, 0.5f));
		NewBlockModel.BlockMeshes [5].Verticies.Add (new Vector3(-0.5f, 0.5f, 0.5f));
		NewBlockModel.BlockMeshes [5].Verticies.Add (new Vector3(-0.5f, 0.5f, -0.5f));
		NewBlockModel.BlockMeshes [5].Verticies.Add (new Vector3(-0.5f, -0.5f, -0.5f));
		NewBlockModel.AddQuadIndicies (5);
		
		NewBlockModel.AllSolid ();
		// add in uvs
		for (int i = 0; i < 6; i++) {
			//NewBlockModel.ResetBlockFace (i, 1);
			/*NewBlockModel.BlockMeshes [i].TextureCoordinates.Add (new Vector2(tileSize * tilePos.x + tileSize, tileSize * tilePos.y));
			NewBlockModel.BlockMeshes [i].TextureCoordinates.Add (new Vector2(tileSize * tilePos.x + tileSize, tileSize * tilePos.y + tileSize));
			NewBlockModel.BlockMeshes [i].TextureCoordinates.Add (new Vector2(tileSize * tilePos.x, tileSize * tilePos.y + tileSize));
			NewBlockModel.BlockMeshes [i].TextureCoordinates.Add (new Vector2(tileSize * tilePos.x, tileSize * tilePos.y));*/
		}
		NewBlockModel.GenerateTextureMapsSingleFaceCube (16);
		return NewBlockModel;
	}