The Z-Depth values fix irregular displayed sprites from looking distorted. If you remove the optional Z-Depth values from the TransformSprite() examples below, you will understand their purpose.
As you can see. The shortest side is divided by the longer/opposing side. The divided value is then used as the Z-Depth for the short side. The remaining two sides are of the same length and we need not worry about.
Currently Z-Depth only works in DirectX and not in OpenGL. So Windows only for now.
Code: Select all
TransformSprite(0,0,0, 128,32,2, 128,96,2, 0,128,0)
; X = 0, Y = 0, Z = 0 ____
; | ____
; | ____ X = 128, Y = 32, Z = 2
; 1 | /|
; 2 | / | 6 ; 128 / 64 = 2
; 8 | / | 4
; | / |
; | / ____ X = 128, Y = 96, Z = 2
; |/ ____
; ____
; X = 0, Y = 128, Z = 0
TransformSprite(0,0,0, 128,16,1.6, 128,96,1.6, 0,128,0)
; X = 0, Y = 0, Z = 0 ______
; | ______ X = 128, Y = 16, Z = 1.6
; | |
; 1 | / |
; 2 | / | 8 ; 128 / 80 = 1.6
; 8 | / | 0
; | / |
; | / ____ X = 128, Y = 96, Z = 1.6
; | ____
; ____
; X = 0, Y = 128, Z = 0
TransformSprite(224,0,8, 288,0,8, 512,512,0, 0,512,0)
; 64
; X = 224, Y = 0, Z = 8 ____ X = 288, Y = 0, Z = 8
; / /\
; / \
; / / \
; / \ ; 512 / 64 = 8
; / / \
; / \
; __________________
; X = 0, Y = 512, Z = 0 512 X = 512, Y = 512, Z = 0