( ----------------------------------------------------------------------
( FILE:		rgba.rpl
( DESCRIPTION:  These examples demonstrates how to manipulate colors
( 		fields of objects, materials, Rendering settings etc.
( 		by using the words provided by rpl/sys/colors.rpl.
( PLATFORM: 	AMIGA
( VERSION:	2.41
( DATE:		6-Feb-93
( ----------------------------------------------------------------------
?& RGBAEXAMPLE.RPL NOT ?IF
17 CONSTANT RGBAEXAMPLE.RPL

( load required words first
( ------------------------- 
"r3d2:rpl/sys/colors.rpl" LOAD
"r3d2:rpl/sys/objects.rpl" LOAD

( Define a Color variable
CVARIABLE cTest

( Assing R, G, B and Alpha value to the defined variable
255 100 10 0 cTest C!

( Fetch color from the variable
cTest C@

( Print out Color
C.

( Undefine color variable
FORGET cTest

( Returns the address of objects color variable
: GetObjRGBA ( aObj - aRGBA )
    O.aPRIM + @     ( find primitive data linked to object
    IF              ( if not zero, is primitive
        P.iRGBA + 
    ELSE
        "Not a Primitive" ERROR
    ENDIF
;

( This prints out the color of given object
( -----------------------------------------

: PrnObjCol ( aObj - )
    GetObjRGBA C@ 
    C.
;


( This assigns new RGBA values to given object
( --------------------------------------------

: SetObjRGBA ( iR iB iB iA aObj - )
    GetObjRGBA 
    C!
;

?ENDIF
