Ejemplo n.º 1
0
        private void CubeSouth(int x, int y, int z, byte blockID)
        {
            _vertices.Add(new Vector3(x, y - 1, z));
            _vertices.Add(new Vector3(x, y, z));
            _vertices.Add(new Vector3(x + 1, y, z));
            _vertices.Add(new Vector3(x + 1, y - 1, z));

            TextureDetails details         = TextureFinder.TextureDetailsFor(blockID);
            Vector2        texturePosition = TextureFinder.AdjustForPosition(x, y, z, TextureFinder.TextureFace.South, details);

            Cube(texturePosition, true);
            _faceCount++;
        }
Ejemplo n.º 2
0
        public static Vector2 AdjustForPosition(int x, int y, int z, TextureFace face, TextureDetails details)
        {
            Vector2 texturePosition = details.origin;

            switch (face)
            {
            case TextureFace.Top:
            case TextureFace.Bottom:
                texturePosition.x += z;
                texturePosition.y += x;
                break;

            case TextureFace.North:
            case TextureFace.South:
                texturePosition.x += x;
                texturePosition.y += y;
                break;

            case TextureFace.East:
            case TextureFace.West:
                texturePosition.x += z;
                texturePosition.y += y;
                break;

            default:
                Debug.LogWarning("Invalid texture face provided: Unexpected texturing results may occur.");
                break;
            }
            while (texturePosition.x >= details.origin.x + details.dimensions.x)
            {
                texturePosition.x -= details.dimensions.x;
            }
            while (texturePosition.y >= details.origin.y + details.dimensions.y)
            {
                texturePosition.y -= details.dimensions.y;
            }
            return(texturePosition);
        }
Ejemplo n.º 3
0
 private static void SetTextureDetails(byte block, byte xOrigin, byte yOrigin, byte xDimension, byte yDimension)
 {
     _textureDetails[block] = new TextureDetails(new IntVec2(xOrigin, yOrigin), new IntVec2(xDimension, yDimension));
 }