Handbook
Glossary
image-placement>texcoords ( image-placement atlas-image -- image texcoords )
Vocabulary
images
.
atlas
Inputs
image-placement
an
object
atlas-image
an
object
Outputs
image
an
object
texcoords
an
object
Definition
USING:
accessors
arrays
kernel
math
sequences
;
IN:
images.atlas
::
image-placement>texcoords
( image-placement atlas-image -- image texcoords )
atlas-image
dim>>
first2
:>
( aw ah ) image-placement
image>>
:>
image image-placement
loc>>
first2
:>
( x y )
image
dim>>
first2
:>
( w h ) x aw
/f
:>
left-u y ah
/f
:>
top-v x w
+
aw
/f
:>
right-u y h
+
ah
/f
:>
bottom-v image
dup
upside-down?>>
[
left-u top-v right-u bottom-v
]
[
left-u bottom-v right-u top-v
]
if
4array
;
inline