; SetCubeMode Example ; ------------------- Graphics3D 640,480,0,2 SetBuffer BackBuffer() camera=CreateCamera() PositionEntity camera,0,1,-4 light=CreateLight() RotateEntity light,45,45,0 ; Flag 128 = cubic environment map, flag 256 = keep it drawable cube_tex=CreateTexture(128,128,128+256) ; Paint a simple sky-and-ground pattern into the texture SetBuffer TextureBuffer(cube_tex) ClsColor 90,150,255 Cls Color 70,140,60 Rect 0,64,128,64,1 Color 255,255,255 Rect 24,24,24,16,1 Rect 72,20,32,18,1 SetBuffer BackBuffer() ; A shiny pickup that wears the cubemap ball=CreateSphere(16) PositionEntity ball,0,1,0 EntityTexture ball,cube_tex mode=1 SetCubeMode cube_tex,mode While Not KeyDown(1) ; Keys 1/2/3 choose how the cubemap is applied If KeyHit(2) mode=1 SetCubeMode cube_tex,mode EndIf If KeyHit(3) mode=2 SetCubeMode cube_tex,mode EndIf If KeyHit(4) mode=3 SetCubeMode cube_tex,mode EndIf TurnEntity ball,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 name$="reflection (default)" If mode=2 Then name$="normal" If mode=3 Then name$="position" Text 0,0,"1/2/3: cubemap mode Arrows: camera Esc: exit" Text 0,20,"SetCubeMode cube_tex,"+mode+" - "+name$ Text 0,40,"Note: this DirectX 12 runtime stores the mode but does not apply" Text 0,60,"it yet - the texture maps by the sphere's UVs in every mode." Flip Wend End