The trial doesn't support external commands I think.
However, I had similar problems (let's say I don't like external commands very much) and so I got to make it work without the external commands. The only problem is, the camera now rotates but is not moving.
Gosub Init_Main
Gosub Variables_Declare_Camera
Gosub Variables_Declare_Timers
Gosub Variables_Declare_Object
Inittimer()
Make_Object_Plain( 1 , 5 , 5 ) : Position_Object( 1 , 15 , 0 , 0 ) : rem Set_Object_Diffuse( 1 , 255 , 0 , 0 ) : Set_Object_Opacity( 1 , 210 )
Make_Object_Cylinder( 2 , 5 , 5 , 20 , 0 ) : Position_Object( 2 , -5 , 0 , 0 ) : rem Set_Object_Diffuse( 2 , 0 , 255 , 0 ) : Set_Object_Opacity( 2 , 200 )
Make_Object_Cylinder( 3 , 5 , 5 , 20 , 1 ) : Position_Object( 3 , -5 , 0 , 15 ) : rem Set_Object_Diffuse( 3 , 255 , 255 , 0 ) : Set_Object_Opacity( 3 , 150 )
Make_Object_Cylinder( 4 , 5 , 5 , 20 , 1 ) : Position_Object( 4 , -5 , 0 , 30 ) : rem Set_Object_Diffuse( 4 , 0 , 0 , 255 ) : Set_Object_Opacity( 4 , 100 )
Position_Camera( 30 , 20 , -20 )
Rotate_Camera( 10 , -40 , 0)
Do
GetElapsed()
Debug()
Move_Camera( (upkey() - downkey()) * Duration * 20 )
Move_Camera_Left( (rightkey() - leftkey()) * Duration * 20 )
Rotate_Camera( Camera_Angle_X() + MouseMoveY() , Camera_Angle_Y() + MouseMoveX() , 0 )
Sync_Camera(0)
Loop
`-------------------------------------------------------------------------------
`-------------------------------------------------------------------------------
Function Debug()
Text 0 , 0 , "FPS: " + Str$( Screen FPS() )
EndFunction
`-------------------------------------------------------------------------------
`-------------------------------------------------------------------------------
Init_Main:
Sync On
Sync Rate 0
Hide Mouse
Return
`-------------------------------------------------------------------------------
`-------------------------------------------------------------------------------
Variables_Declare_Timers:
Global OldTime As Double integer
Global TimeGap As Double integer
Global FrameGap As Double integer
Global CurTime As Double integer
Global Duration As Float
Global Fps As Float
Global OldFps As Float
Global Elapsed As Float
Return
`-------------------------------------------------------------------------------
`-------------------------------------------------------------------------------
Function Inittimer()
Load DLL "kernel32.dll", 1
Ptr = make memory(8)
Null = Call Dll(1, "QueryPerformanceFrequency", Ptr )
TimeGap = (*Ptr)
Delete DLL 1
OldTime = timer()
Endfunction
`-------------------------------------------------------------------------------
`-------------------------------------------------------------------------------
Function GetElapsed()
CurTime = timer()
FrameGap = CurTime - OldTime
OldTime = timer()
Fps = TimeGap / FrameGap
Fps = ( Fps + OldFps ) * 0.5
OldFps = Fps
Elapsed = 1000 / Fps
Duration = Elapsed * 0.001
Endfunction
`-------------------------------------------------------------------------------
`-------------------------------------------------------------------------------
`*************************************************************************
`** **
`** DBP Software renderer - Carlos 'Darkcoder' Wilkes **
`** Original Camera/3D projection code by Lower Logic **
`** **
`*************************************************************************
Function Sync_Camera( CameraID As Dword )
Local ObjectID As Dword
`Lock Pixels
`ScreenWidth = Screen Width()
`PixelsPointer = Get Pixels Pointer()
For Tris = 0 To Array Count( Tri(0) )
If Tri(Tris).Exist
ObjectID = Tri(Tris).ObjectID
If Object(ObjectID).Hidden = 0
If Object(ObjectID).Opacity
Draw_Tri( CameraID , Tris , ObjectID )
Endif
Endif
Endif
Next Tris
`--------------------------- Draw the camera view
ink rgb(255,255,0), rgb(0,0,0)
Line Camera(CameraID).StartX,Camera(CameraID).StartY ,Camera(CameraID).EndX,Camera(CameraID).StartY
Line Camera(CameraID).StartX,Camera(CameraID).EndY -1 ,Camera(CameraID).EndX,Camera(CameraID).EndY -1
Line Camera(CameraID).StartX ,Camera(CameraID).StartY,Camera(CameraID).StartX ,Camera(CameraID).EndY
Line Camera(CameraID).EndX -1 ,Camera(CameraID).StartY,Camera(CameraID).EndX -1 ,Camera(CameraID).EndY
ink rgb(255,255,255), rgb(0,0,0)
`UnLock Pixels
Sync
Box Camera(CameraID).StartX , Camera(CameraID).StartY , Camera(CameraID).EndX , Camera(CameraID).EndY , RGB( BackdropR , BackdropG , BackdropB ), RGB( BackdropR , BackdropG , BackdropB ), RGB( BackdropR , BackdropG , BackdropB ), RGB( BackdropR , BackdropG , BackdropB )
EndFunction
`-------------------------------------------------------------------------------
`-------------------------------------------------------------------------------
Function Colour_Backdrop( R As Byte , G As Byte , B As Byte , A As Byte )
BackdropR = R
BackdropG = G
BackdropB = B
BackdropA = A
EndFunction
`-------------------------------------------------------------------------------
`-------------------------------------------------------------------------------
Function Draw_Tri( CameraID As Dword , TriID As Dword , ObjectID As Dword )
Local X As Float
Local Y As Float
Local Z As Float
Local P1 As Integer
Local P2 As Integer
Local P3 As Integer
Local Perc As Float
Local Perc2 As Float
Local Diff1 As Float
Local Diff2 As Float
Local Scans As Float
Local LDown As Float
Local Down As Float
Local FullSize As Integer
Local TopSize As Integer
Local BotSize As Integer
Local X1Shift As Float
Local X2Shift As Float
Local X3Shift As Float
Local SX As Float
Local SY As Float
Local SZ As Float
SX = Object(Tri(TriID).ObjectID).ScaleX
SY = Object(Tri(TriID).ObjectID).ScaleY
SZ = Object(Tri(TriID).ObjectID).ScaleZ
X = Object(Tri(TriID).ObjectID).X
Y = Object(Tri(TriID).ObjectID).Y
Z = Object(Tri(TriID).ObjectID).Z
Get_Tri_Point( 0 , Tri(TriID).X1 * SX + X , Tri(TriID).Y1 * SY + Y , Tri(TriID).Z1 * SZ + Z )
Get_Tri_Point( 1 , Tri(TriID).X2 * SX + X , Tri(TriID).Y2 * SY + Y , Tri(TriID).Z2 * SZ + Z )
Get_Tri_Point( 2 , Tri(TriID).X3 * SX + X , Tri(TriID).Y3 * SY + Y , Tri(TriID).Z3 * SZ + Z )
ink rgb(Object(ObjectID).DiffuseR , Object(ObjectID).DiffuseG , Object(ObjectID).DiffuseB), rgb(0,0,0)
If Object(Tri(TriID).ObjectID).Wireframe = 1 Or Object(Tri(TriID).ObjectID).Wireframe = 2
Line Points(0).X , Points(0).Y , Points(1).X , Points(1).Y
Line Points(1).X , Points(1).Y , Points(2).X , Points(2).Y
Line Points(2).X , Points(2).Y , Points(0).X , Points(0).Y
Else
If Object(Tri(TriID).ObjectID).Wireframe = 3 Or Object(Tri(TriID).ObjectID).Wireframe = 4
Line Points(0).X , Points(0).Y , Points(1).X , Points(1).Y
Line Points(1).X , Points(1).Y , Points(2).X , Points(2).Y
Endif
Endif
If Points(0).X < Camera(CameraID).StartX - Camera(CameraID).OffCheck Or Points(0).X > Camera(CameraID).EndX + Camera(CameraID).OffCheck Then ExitFunction
If Points(0).Y < Camera(CameraID).StartY - Camera(CameraID).OffCheck Or Points(0).Y > Camera(CameraID).EndY + Camera(CameraID).OffCheck Then ExitFunction
If Points(1).X < Camera(CameraID).StartX - Camera(CameraID).OffCheck Or Points(1).X > Camera(CameraID).EndX + Camera(CameraID).OffCheck Then ExitFunction
If Points(1).Y < Camera(CameraID).StartY - Camera(CameraID).OffCheck Or Points(1).Y > Camera(CameraID).EndY + Camera(CameraID).OffCheck Then ExitFunction
If Points(2).X < Camera(CameraID).StartX - Camera(CameraID).OffCheck Or Points(2).X > Camera(CameraID).EndX + Camera(CameraID).OffCheck Then ExitFunction
If Points(2).Y < Camera(CameraID).StartY - Camera(CameraID).OffCheck Or Points(2).Y > Camera(CameraID).EndY + Camera(CameraID).OffCheck Then ExitFunction
If Object(Tri(TriID).ObjectID).Wireframe = 0 Or Object(Tri(TriID).ObjectID).Wireframe = 2 Or Object(Tri(TriID).ObjectID).Wireframe = 3
If Points(1).Y < Points(0).Y Then P1 = 1
If Points(2).Y < Points(P1).Y Then P1 = 2
If P1 = 0
If Points(1).X < Points(2).X
P2 = 1 : P3 = 2
Else
P2 = 2 : P3 = 1
Endif
Else
If P1 = 1
If Points(0).X < Points(2).X
P2 = 0 : P3 = 2
Else
P2 = 2 : P3 = 0
Endif
Else
If P1 = 2
If Points(0).X < Points(1).X
P2 = 0 : P3 = 1
Else
P2 = 1 : P3 = 0
Endif
Endif
Endif
Endif
If Points(P3).Y > Points(P2).Y
TopSize = Points(P2).Y - Points(P1).Y
BotSize = Points(P3).Y - Points(P2).Y
FullSize = Points(P3).Y - Points(P1).Y
X1Shift = ( Points(P1).X - Points(P2).X ) / TopSize
X2Shift = ( Points(P3).X - Points(P1).X ) / FullSize
X3Shift = ( Points(P3).X - Points(P2).X ) / BotSize
For Scans = 1 To ( Points(P3).Y - Points(P1).Y )
Down = Scans + Points(P1).Y
If Scans < TopSize
Camera_Draw_Line( CameraID , Points(P1).X - X1Shift * Scans , Down , Points(P1).X + X2Shift * Scans )
Else
LScans = Scans - TopSize
Camera_Draw_Line( CameraID , Points(P2).X + X3Shift * LScans , Down , Points(P1).X + X2Shift * Scans )
Endif
Next Scans
Else
TopSize = Points(P3).Y - Points(P1).Y
FullSize = Points(P2).Y - Points(P1).Y
BotSize = Points(P2).Y - Points(P3).Y
X1Shift = ( Points(P3).X - Points(P1).X ) / TopSize
X2Shift = ( Points(P1).X - Points(P2).X ) / FullSize
X3Shift = ( Points(P3).X - Points(P2).X ) / BotSize
For Scans = 1 To ( Points(P2).Y - Points(P1).Y )
Down = Scans + Points(P1).Y
If Scans < TopSize
Camera_Draw_Line( CameraID , Points(P1).X - X2Shift * Scans , Down , Points(P1).X + X1Shift * Scans )
Else
LScans = Scans - TopSize
Camera_Draw_Line( CameraID , Points(P1).X - X2Shift * Scans , Down , Points(P3).X - X3Shift * LScans )
Endif
Next Scans
Endif
Endif
EndFunction
`-------------------------------------------------------------------------------
`-------------------------------------------------------------------------------
Function Camera_Draw_Line( CameraID As Dword , X1 As Integer , Y As Integer , X2 As Integer )
If X1 < Camera(CameraID).StartX Then X1 = Camera(CameraID).StartX
If X2 > Camera(CameraID).EndX Then X2 = Camera(CameraID).EndX
If Y1 < Camera(CameraID).StartY Then Y1 = Camera(CameraID).StartY
If Y2 > Camera(CameraID).EndY Then Y2 = Camera(CameraID).EndY
If X1 > Camera(CameraID).EndX Then X1 = Camera(CameraID).EndX
If X2 < Camera(CameraID).StartX Then X2 = Camera(CameraID).StartX
If Y1 > Camera(CameraID).EndY Then Y1 = Camera(CameraID).EndY
If Y2 < Camera(CameraID).StartY Then Y2 = Camera(CameraID).StartY
If Y < Camera(CameraID).StartY Or Y > Camera(CameraID).EndY Then ExitFunction
Line X1 , Y , X2 , Y
`For Draw = 5 To 15
` Pointer = ( PixelsPointer + ( Draw + ( Y * ScreenWidth ) ) * 4 )
` *Pointer = RGB( 255 , 255 , 255 )
`Next Draw
EndFunction
`-------------------------------------------------------------------------------
`-------------------------------------------------------------------------------
Function Make_Object_Plain( ObjectID As Dword , Width As Float , height As Float )
Local TriID As Dword
Make_Object( ObjectID )
TriID = Make_Tri( ObjectID )
Position_Tri( TriID , - Width , height , 0 , Width , - height , 0 , - Width , - height , 0 )
TriID = Make_Tri( ObjectID )
Position_Tri( TriID , - Width , height , 0 , Width , height , 0 , Width , - height , 0 )
EndFunction
`-------------------------------------------------------------------------------
`-------------------------------------------------------------------------------
Function Set_Object_Diffuse( ObjectID As Dword , R As Byte , G As Byte , B As Byte )
Object(ObjectID).DiffuseR = R
Object(ObjectID).DiffuseG = G
Object(ObjectID).DiffuseB = B
EndFunction
`-------------------------------------------------------------------------------
`-------------------------------------------------------------------------------
Function Object_Exist( ObjectID As Dword )
If ObjectID <= Array Count( Object(0) )
If Object(ObjectID).Exist = 1
ExitFunction 1
Endif
Endif
EndFunction 0
`-------------------------------------------------------------------------------
`-------------------------------------------------------------------------------
Function Scale_Object( ObjectID As Dword , ScaleX As Float , ScaleY As Float , ScaleZ As Float )
Object(ObjectID).ScaleX = ScaleX * 0.01
Object(ObjectID).ScaleY = ScaleY * 0.01
Object(ObjectID).ScaleZ = ScaleZ * 0.01
EndFunction
`-------------------------------------------------------------------------------
`-------------------------------------------------------------------------------
Function Set_Object_Opacity( ObjectID As Dword , A As Byte )
Object(ObjectID).Opacity = A
EndFunction
`-------------------------------------------------------------------------------
`-------------------------------------------------------------------------------
Function Set_Object_Wireframe( ObjectID As Dword , WF As Byte )
Object(ObjectID).Wireframe = WF
EndFunction
`-------------------------------------------------------------------------------
`-------------------------------------------------------------------------------
Function Set_Object_Visibility( ObjectID As Dword , Flag As Boolean )
Object(ObjectID).Hidden = 1 - Flag
EndFunction
`-------------------------------------------------------------------------------
`-------------------------------------------------------------------------------
Function Position_Object( ObjectID As Dword , X As Float , Y As Float , Z As Float )
Object(ObjectID).X = X
Object(ObjectID).Y = Y
Object(ObjectID).Z = Z
EndFunction
`-------------------------------------------------------------------------------
`-------------------------------------------------------------------------------
Function Make_Object_Cylinder( ObjectID As Dword , Height As Float , Radius As Float , Sides As Float , Capped )
Local TriID As Dword
Local Diff As Float
Local Ang As Float
Diff = 360.0 / Sides
Make_Object( ObjectID )
For Cyl = 1 To Sides
TriID = Make_Tri( ObjectID )
Position_Tri( TriID , Sin( Ang ) * Radius , - Height , Cos( Ang ) * Radius , Sin( Ang ) * Radius , Height , Cos( Ang ) * Radius , Sin( Ang + Diff ) * Radius , Height , Cos( Ang + Diff ) * Radius )
TriID = Make_Tri( ObjectID )
Position_Tri( TriID , Sin( Ang ) * Radius , - Height , Cos( Ang ) * Radius , Sin( Ang+ Diff ) * Radius , Height , Cos( Ang+ Diff ) * Radius , Sin( Ang+ Diff ) * Radius , - Height , Cos( Ang+ Diff ) * Radius )
Ang = Ang + Diff
Next Cyl
EndFunction
`-------------------------------------------------------------------------------
`-------------------------------------------------------------------------------
Function Make_Object( ObjectID As Dword )
Local ArrCount As Dword
ArrCount = Array Count(Object(0))
If ObjectID > ArrCount
Dim Object(ObjectID) As ObjectType
Else
If Object(ObjectID).Exist = 1
Exit Prompt "Object " + Str$( ObjectID ) + " alredy exists!" , "Error::Make_Object"
End
Endif
Endif
Object(ObjectID).Exist = 1
Object(ObjectID).Hidden = 0
Object(ObjectID).X = 0
Object(ObjectID).Y = 0
Object(ObjectID).Z = 0
Object(ObjectID).XRot = 0
Object(ObjectID).YRot = 0
Object(ObjectID).ZRot = 0
Object(ObjectID).Tris = 0
Object(ObjectID).Opacity = 255
Object(ObjectID).Wireframe = 0
Object(ObjectID).DiffuseR = 128
Object(ObjectID).DiffuseG = 128
Object(ObjectID).DiffuseB = 128
Object(ObjectID).ScaleX = 1.0
Object(ObjectID).ScaleY = 1.0
Object(ObjectID).ScaleZ = 1.0
EndFunction
`-------------------------------------------------------------------------------
`-------------------------------------------------------------------------------
Function Make_Tri( ObjectID As Dword )
Local Cell As Dword
Array Insert At Bottom Tri(0)
Cell = Array Count( Tri(0) )
Tri(Cell).Exist = 1
Tri(Cell).ObjectID = ObjectID
EndFunction Cell
`-------------------------------------------------------------------------------
`-------------------------------------------------------------------------------
Function Position_Tri( TriID As Dword , X1 As Float , Y1 As Float , Z1 As Float , X2 As Float , Y2 As Float , Z2 As Float , X3 As Float , Y3 As Float , Z3 As Float )
Local Check As Boolean
If Array Index Valid( Tri(0) ) Then Check = 1
If Tri(TriID).Exist Then Check = 1
If Check
Tri(TriID).X1 = X1
Tri(TriID).Y1 = Y1
Tri(TriID).Z1 = Z1
Tri(TriID).X2 = X2
Tri(TriID).Y2 = Y2
Tri(TriID).Z2 = Z2
Tri(TriID).X3 = X3
Tri(TriID).Y3 = Y3
Tri(TriID).Z3 = Z3
Else
Exit Prompt "Triangle " + Str$( TriID ) + " Doesn't exist!" , "Error::Position_Tri"
Endif
EndFunction
`-------------------------------------------------------------------------------
`-------------------------------------------------------------------------------
Variables_Declare_Object:
Type ObjectType
Exist As Boolean
Hidden As Boolean
X As Float
Y As Float
Z As Float
XRot As Float
YRot As Float
ZRot As Float
Tris As Dword
Opacity As Float
Wireframe As Byte
DiffuseR As Float
DiffuseG As Float
DiffuseB As Float
ScaleX As Float
ScaleY As Float
ScaleZ As Float
EndType
Dim Object(0) As ObjectType
Type TriType
Exist As Float
X1 As Float
Y1 As Float
Z1 As Float
X2 As Float
Y2 As Float
Z2 As Float
X3 As Float
Y3 As Float
Z3 As Float
Diffuse1 As Dword
Diffuse2 As Dword
Diffuse3 As Dword
Alpha1 As Float
Alpha2 As Float
Alpha3 As Float
ObjectID As Dword
EndType
Dim Tri(0) As TriType
Type PointsType
X As Float
Y As Float
EndType
Dim Points(3) As PointsType
Type CameraType
X As Float
X As Float
X As Float
XRot As Float
YRot As Float
ZRot As Float
FOV As Float
Range As Float
StartX As Integer
StartY As Integer
EndX As Integer
EndY As Integer
OffCheck As Integer
EndType
Dim Camera(0) As CameraType
Camera(0).StartX = 0
Camera(0).StartY = 0
Camera(0).EndX = Screen Width()
Camera(0).EndY = Screen Height()
Camera(0).OffCheck = 1000
Global PixelsPointer
Global CameraW As Dword
Global CameraH As Dword
Global BackdropR As Byte
Global BackdropG As Byte
Global BackdropB As Byte
Global BackdropA As Byte
CameraW = Screen Width() * 0.5
CameraH = Screen Height() * 0.5
BackdropR = 128
BackdropG = 128
BackdropB = 128
BackdropA = 255
Return
`-------------------------------------------------------------------------------
`-------------------------------------------------------------------------------
Variables_Declare_Camera:
type vec3
x as float
y as float
z as float
endtype
type vecvec3
x as vec3
y as vec3
z as vec3
endtype
type camera_type
angle as vec3
axis as vecvec3
position as vec3
fov as float
aspect_ratio as float
endtype
global camera as camera_type
camera.fov=80
camera.aspect_ratio=(1.0*screen width())/screen height()
Return
`-------------------------------------------------------------------------------
`-------------------------------------------------------------------------------
Function Camera_Angle_X()
Local ReturnValue As Float
ReturnValue = camera.angle.x
EndFunction ReturnValue
Function Camera_Angle_Y()
Local ReturnValue As Float
ReturnValue = camera.angle.y
EndFunction ReturnValue
Function Camera_Angle_Z()
Local ReturnValue As Float
ReturnValue = camera.angle.z
EndFunction ReturnValue
`-------------------------------------------------------------------------------
`-------------------------------------------------------------------------------
Function Rotate_Camera( X As Float , Y As Float , Z As Float )
camera.angle.x = X
camera.angle.y = Y
camera.angle.z = Z
update_camera()
EndFunction
`-------------------------------------------------------------------------------
`-------------------------------------------------------------------------------
Function Position_Camera( X As Float , Y As Float , Z As Float )
camera.position.x = X
camera.position.y = Y
camera.position.z = Z
EndFunction
`-------------------------------------------------------------------------------
`-------------------------------------------------------------------------------
Function Move_Camera( Distance As Float )
camera.position.x = camera.position.x + camera.axis.z.x * Distance
camera.position.y = camera.position.y + camera.axis.z.y * Distance
camera.position.z = camera.position.z + camera.axis.z.z * Distance
EndFunction
`-------------------------------------------------------------------------------
`-------------------------------------------------------------------------------
Function Move_Camera_Left( Distance As Float )
camera.position.x = camera.position.x + camera.axis.x.x * Distance
camera.position.y = camera.position.y + camera.axis.x.y * Distance
camera.position.z = camera.position.z + camera.axis.x.z * Distance
EndFunction
`-------------------------------------------------------------------------------
`-------------------------------------------------------------------------------
Function Move_Camera_Right( Distance As Float )
camera.position.x = camera.position.x + camera.axis.x.x * - Distance
camera.position.y = camera.position.y + camera.axis.x.y * - Distance
camera.position.z = camera.position.z + camera.axis.x.z * - Distance
EndFunction
`-------------------------------------------------------------------------------
`-------------------------------------------------------------------------------
Function Move_Camera_Up( Distance As Float )
camera.position.x = camera.position.x + camera.axis.y.x * Distance
camera.position.y = camera.position.y + camera.axis.y.y * Distance
camera.position.z = camera.position.z + camera.axis.y.z * Distance
EndFunction
`-------------------------------------------------------------------------------
`-------------------------------------------------------------------------------
Function Move_Camera_Down( Distance As Float )
camera.position.x = camera.position.x + camera.axis.y.x * - Distance
camera.position.y = camera.position.y + camera.axis.y.y * - Distance
camera.position.z = camera.position.z + camera.axis.y.z * - Distance
EndFunction
`-------------------------------------------------------------------------------
`-------------------------------------------------------------------------------
Function Get_Tri_Point( PointID , x0#,y0#,z0# )
x0#=x0#-camera.position.x
y0#=y0#-camera.position.y
z0#=z0#-camera.position.z
x00#=x0#*camera.axis.x.x+y0#*camera.axis.x.y+z0#*camera.axis.x.z
y00#=x0#*camera.axis.y.x+y0#*camera.axis.y.y+z0#*camera.axis.y.z
z00#=x0#*camera.axis.z.x+y0#*camera.axis.z.y+z0#*camera.axis.z.z
if z00#<=0 then exitfunction
x0=(x00#/z00#)/tan(camera.fov*0.5)*CameraW+CameraW
y0=(0-y00#/z00#)/tan(camera.fov*0.5)*camera.aspect_ratio*CameraH+CameraH
Points(PointID).X = x0
Points(PointID).Y = y0
EndFunction
`-------------------------------------------------------------------------------
`-------------------------------------------------------------------------------
function update_camera()
xx0#=1:xy0#=0:xz1#=0:yx0#=0:yy0#=1:yz1#=0:zx2#=0:zy1#=0:zz1#=1
xx2#=xx0#*cos(camera.angle.z):xy1#=xx0#*sin(camera.angle.z)
yx2#=-yy0#*sin(camera.angle.z):yy1#=yy0#*cos(camera.angle.z)
xy2#=xy1#*cos(camera.angle.x)-xz1#*sin(camera.angle.x)
xz2#=xz1#*cos(camera.angle.x)+xy1#*sin(camera.angle.x)
yy2#=yy1#*cos(camera.angle.x)-yz1#*sin(camera.angle.x)
yz2#=yz1#*cos(camera.angle.x)+yy1#*sin(camera.angle.x)
zy2#=zy1#*cos(camera.angle.x)-zz1#*sin(camera.angle.x)
zz2#=zz1#*cos(camera.angle.x)+zy1#*sin(camera.angle.x)
camera.axis.x.x=xx2#*cos(camera.angle.y)+xz2#*sin(camera.angle.y)
camera.axis.x.y=xy2#
camera.axis.x.z=xz2#*cos(camera.angle.y)-xx2#*sin(camera.angle.y)
camera.axis.y.x=yx2#*cos(camera.angle.y)+yz2#*sin(camera.angle.y)
camera.axis.y.y=yy2#
camera.axis.y.z=yz2#*cos(camera.angle.y)-yx2#*sin(camera.angle.y)
camera.axis.z.x=zx2#*cos(camera.angle.y)+zz2#*sin(camera.angle.y)
camera.axis.z.y=zy2#
camera.axis.z.z=zz2#*cos(camera.angle.y)-zx2#*sin(camera.angle.y)
endfunction
Enjoy
.
Bye, Berserk.
.