public override TextureAtlasCoords GetTextureTileCoords(FaceDirection faceDir) { TextureAtlasCoords texCoords = new TextureAtlasCoords(); // use the dirt texture for all sides of the block texCoords.x = 1; texCoords.y = 0; return(texCoords); }
/// <summary> /// Returns the uv coordinates of the face. /// </summary> /// <param name="faceDir">The direction of the face</param> /// <returns>The uv coordinates</returns> public Vector2[] GetFaceUVCoordinates(FaceDirection faceDir) { Vector2[] uvCoords = new Vector2[4]; // get the position of the texture TextureAtlasCoords texturePos = GetTextureTileCoords(faceDir); uvCoords[0] = new Vector2(tileSize * texturePos.x, tileSize * texturePos.y + tileSize); // texture for upper left vertex uvCoords[1] = new Vector2(tileSize * texturePos.x + tileSize, tileSize * texturePos.y + tileSize); // texture for upper right vertex uvCoords[2] = new Vector2(tileSize * texturePos.x + tileSize, tileSize * texturePos.y); // texture for lower right vertex uvCoords[3] = new Vector2(tileSize * texturePos.x, tileSize * texturePos.y); // texture for lower left vertex return(uvCoords); }
public override TextureAtlasCoords GetTextureTileCoords(FaceDirection faceDir) { TextureAtlasCoords texCoords = new TextureAtlasCoords(); // depending on the direction return the coordinates for the texture switch (faceDir) { case FaceDirection.up: texCoords.x = 2; texCoords.y = 0; return(texCoords); case FaceDirection.down: texCoords.x = 1; texCoords.y = 0; return(texCoords); default: // return the coordinates for the side face textures texCoords.x = 0; texCoords.y = 0; return(texCoords); } }