here's some code i made up. should do the trick. when your rendering a mirror tho, try and hide all the things you know or you can check that won't be in view :D
Graphics3D 800,600,16
cube=CreateCube()
PositionEntity cube,-3,0,2
plane=CreatePlane()
EntityColor plane,40,40,200
MoveEntity plane,0,-2,0
planetex=CreateTexture(256,256)
SetBuffer TextureBuffer(planetex)
For loop=0 To 255 Step 2
For loop1=0 To 255 Step 2
Color 50,50,200
Rect loop,loop1,1,1
Color 20,20,200
Rect loop+1,loop,1,1
Color 50,50,200
Rect loop,loop1+1,1,1
Color 20,20,200
Rect loop+1,loop1+1,1,1
Next
Next
SetBuffer BackBuffer()
ScaleTexture planetex,200,200
EntityTexture plane,planetex
sphere=CreateSphere()
camera=CreateCamera(sphere)
PositionEntity camera,0,3,-5
CameraRange camera,1,100
mirror=CreateCube()
PositionEntity mirror,0,3,10
ScaleEntity mirror,3,1.5,0.2
mirrorframe=CreateCube()
PositionEntity mirrorframe,0,3,10.2
ScaleEntity mirrorframe,3.3,1.7,0.3
RotateEntity mirrorframe,20,180,0
EntityColor mirrorframe,70,70,200
mirrorcam=CreateCamera(mirror)
PositionEntity mirrorcam,0,0,0
HideEntity mirrorcam
CameraRange mirrorcam,1,100
mirrortex=CreateTexture(256,256,256)
EntityTexture mirror,mirrortex
ScaleTexture mirrortex,-1,1
light=CreateLight()
RotateEntity mirror,20,180,0
Color 255,255,255
While Not KeyHit(1)
If KeyDown(200) Then MoveEntity sphere,0,0,0.1
If KeyDown(208) Then MoveEntity sphere,0,0,-0.1
If KeyDown(203) Then TurnEntity sphere,0,1,0
If KeyDown(205) Then TurnEntity sphere,0,-1,0
If MilliSecs()<timer+1000 Then
frame=frame+1
Else
fps=frame
frame=0
timer=MilliSecs()
End If
Gosub updatemirror
UpdateWorld
RenderWorld
Text 0,0,"fps="+fps
Flip
Wend
End
.updatemirror
HideEntity camera
ShowEntity mirrorcam
RenderWorld
CopyRect 272,172,255,255,0,0,BackBuffer,TextureBuffer(mirrortex)
HideEntity mirrorcam
ShowEntity camera
Return
|