; EntityBlend Example ; ------------------- Graphics3D 640,480,0,2 SetBuffer BackBuffer() camera=CreateCamera() light=CreateLight() RotateEntity light,45,45,0 ; A textured wall behind, so we can see how the cube blends into it wall=CreateCube() ScaleEntity wall,6,4,0.2 PositionEntity wall,0,0,9 wall_tex=LoadTexture("media/MossyGround.BMP") EntityTexture wall,wall_tex ; The blending cube: half-alpha so the alpha mode is visible cube=CreateCube() PositionEntity cube,0,0,5 EntityColor cube,255,255,0 EntityAlpha cube,0.5 blend=1 While Not KeyDown(1) ; Keys 1-3 pick the blend mode If KeyHit(2) Then blend=1 If KeyHit(3) Then blend=2 If KeyHit(4) Then blend=3 blend_name$="alpha (default)" If blend=2 Then blend_name="multiply" If blend=3 Then blend_name="add" ; Apply the blend mode to the cube EntityBlend cube,blend TurnEntity cube,0,1,0 ; Arrow keys move the camera If KeyDown(200) Then MoveEntity camera,0,0,0.1 If KeyDown(208) Then MoveEntity camera,0,0,-0.1 If KeyDown(203) Then TurnEntity camera,0,1,0 If KeyDown(205) Then TurnEntity camera,0,-1,0 RenderWorld Text 0,0,"1: alpha 2: multiply 3: add Arrows: camera Esc: exit" Text 0,20,"EntityBlend cube,"+blend+" ("+blend_name+")" Flip Wend End