Hands On DarkBASIC Pro - Digital Skills
Hands On DarkBASIC Pro - Digital Skills
Hands On DarkBASIC Pro - Digital Skills
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
FIG-32.27<br />
The FADE OBJECT<br />
Statement<br />
LISTING-32.13<br />
Using FADE OBJECT to<br />
make a Transparent<br />
Object Disappear<br />
In the diagram:<br />
objno is an integer value specifying the 3D object<br />
whose reflective index is to be changed.<br />
value is an integer value between 0 and 200. A value of<br />
zero means that the object will reflect no light;<br />
a value of 100 creates normal amount of reflected<br />
light; a value of 200 gives twice the normal<br />
amount of reflected light.<br />
The program in LISTING-32.13 demonstrates the effect of this statement by<br />
gradually reducing the reflective value from 200 to zero.<br />
REM *** Set display resolution ***<br />
SET DISPLAY MODE 1280,1024,32<br />
REM *** Load texture images ***<br />
LOAD IMAGE "textureWood.jpg",1<br />
LOAD IMAGE "DoNot.bmp",2<br />
REM *** Make and position cube ***<br />
MAKE OBJECT CUBE 1, 40<br />
POSITION OBJECT 1,25,0,100<br />
REM *** Texture cube ***<br />
TEXTURE OBJECT 1,1<br />
REM *** Create background plain ***<br />
MAKE OBJECT PLAIN 2,100,100<br />
TEXTURE OBJECT 2, 2<br />
POSITION OBJECT 2,0,0,200<br />
REM *** Start reflective value at 200 ***<br />
reflectivity = 200<br />
REM *** rotate cube ***<br />
DO<br />
PITCH OBJECT DOWN 1, 1.0<br />
TURN OBJECT LEFT 1, 1.0<br />
FADE OBJECT 1,reflectivity<br />
REM *** Decrement reflective value until it reaches zero ***<br />
IF reflectivity > 0<br />
DEC reflectivity<br />
ENDIF<br />
WAIT 10<br />
LOOP<br />
REM *** End program ***<br />
END<br />
Activity 32.23<br />
FADE OBJECT objno<br />
, value<br />
Type in and test the program given in LISTING-32.13 (texture13.dbpro).<br />
When used in combination with the GHOST OBJECT ON statement, the FADE<br />
OBJECT statement can make a semi-transparent object disappear completely.<br />
818 <strong>DarkBASIC</strong> <strong>Pro</strong>: Texturing