Olby wrote:Yeah I saw that thread right before I posted here. But they are documented in the DBPro help files so sooner or later I think they will be fixed. Anyways I got another question, yes I am a boring person
In DBPro we could use syntax like this to mask the objects, but PB says it's incorrect:
Code: Select all
dbSetObjectMask(drDirectLightObject, 2^(drDeferredCamera+2) )
What should I change ?
There is no "^" operator. Try this:
Code: Select all
dbSetObjectMask(drDirectLightObject, Pow((drDeferredCamera+2,2)) )
Since there are so many DB plugins supported natively, I'm wondering if there will be documentation on what the commands are via PureGDK.
See the "PureBasic\PureGDK\plugin-sdk\Supported Plugins" folder for a list of supported plugins. There are syntax lists for all of the commands in each folder but.. they appear to be missing for a couple of them.
To rebuild the syntax lists so you can know what the commands are, pass one of the GDKTable files (.gdt) to "Output Syntax.exe" in the plugin-sdk folder. It will output a file Syntax.txt.
You can also download them from here. I've included them with the installer for the next release:
http://puregdk.com/files/upload/syntax-gdk11b4.zip
My current interest is the EZRotate commands. Any chance someone could provide a basic example of using the EZRotate commands through PureGDK?
Here is some example code for EZRoate and EZRotate Basic. There seems to be a drift problem with the commercial plugin though.
EZRotate Basic:
Code: Select all
; EZrotate sample program
; 14-Dec-2005
; Written by: Ron Erickson
; http://www.gametoolshed.com
OpenWindow(0,0,0,640,480,"DarkBasic Professional - PureGDK",#PB_Window_SystemMenu|#PB_Window_ScreenCentered)
hDBWnd=OpenDBWnd(WindowID(0),0,0,640,480)
dbSyncRate(0)
; Main Cube Object
dbMakeObjectCube(1,1)
; Create Global Axis
;--------------------------
; X axis
dbMakeObjectCylinder(2,0.1)
dbScaleObject(2,100,2000,100)
dbPositionObject(2,1,0,0)
dbRotateObject(2,0,0,-90)
dbColorObject(2,dbRGB(255,0,0))
;Yaxis
dbMakeObjectCylinder(3,0.1)
dbScaleObject(3,100,2000,100)
dbPositionObject(3,0,1,0)
dbColorObject(3,dbRGB(0,255,0))
; Z axis
dbMakeObjectCylinder(4,0.1)
dbScaleObject(4,100,2000,100)
dbPositionObject(4,0,0,1)
dbRotateObject(4,90,0,0)
dbColorObject(4,dbRGB(0,0,255))
; Create Local Axis
;--------------------------
; X axis
dbMakeObjectCylinder(5,0.1)
dbScaleObject(5,100,2000,100)
dbMakeMeshFromObject(1,5)
dbDeleteObject(5)
dbAddLimb(1,1,1)
dbOffsetLimb(1,1,1,0,0)
dbRotateLimb(1,1,0,0,-90)
dbColorLimb(1,1,dbRGB(100,0,0))
; Y axis
dbMakeObjectCylinder(5,0.1)
dbScaleObject(5,100,2000,100)
dbMakeMeshFromObject(2,5)
dbDeleteObject(5)
dbAddLimb(1,2,2)
dbOffsetLimb(1,2,0,1,0)
dbColorLimb(1,2,dbRGB(0,100,0))
; Z axis
dbMakeObjectCylinder(5,0.1)
dbScaleObject(5,100,2000,100)
dbMakeMeshFromObject(3,5)
dbDeleteObject(5)
dbAddLimb(1,3,3)
dbOffsetLimb(1,3,0,0,1)
dbRotateLimb(1,3,90,0,0)
dbColorLimb(1,3,dbRGB(0,0,100))
; Camera
dbPositionCamera(-5,5,-5)
dbPointCamera(0,0,0)
mode=1
Repeat
; Set EZrotate to objects current angle
EZRoBasic_Set(dbObjectAngleX(1),dbObjectAngleY(1),dbObjectAngleZ(1))
If dbInKey()="1": mode=1: EndIf
If dbInKey()="2": mode=2: EndIf
; Rotate X Axis
If dbUpKey()=1
If mode=1: EZRoBasic_GX(1): EndIf
If mode=2: EZRoBasic_LX(1): EndIf
EndIf
If dbDownKey()=1
If mode=1: EZRoBasic_GX(-1): EndIf
If mode=2: EZRoBasic_LX(-1): EndIf
EndIf
; Rotate Y Axis
If dbRightKey()=1
If mode=1: EZRoBasic_GY(1): EndIf
If mode=2: EZRoBasic_LY(1): EndIf
EndIf
If dbLeftKey()=1
If mode=1: EZRoBasic_GY(-1): EndIf
If mode=2: EZRoBasic_LY(-1): EndIf
EndIf
; Rotate Z Axis
If dbInKey()="+"
If mode=1: EZRoBasic_GZ(1): EndIf
If mode=2: EZRoBasic_LZ(1): EndIf
EndIf
If dbInKey()="-"
If mode=1: EZRoBasic_GZ(-1): EndIf
If mode=2: EZRoBasic_LZ(-1): EndIf
EndIf
If dbSpaceKey()=1: EZRoBasic_Set(0,0,0): EndIf
; Set Object to EZrotate's calculated rotation
dbRotateObject(1,EZRoBasic_GetX(),EZRoBasic_GetY(),EZRoBasic_GetZ())
YPos=15
dbText(15,YPos,Str(dbScreenFPS())): YPos+15
dbText(15,YPos,"EZ-Rotate Basic version"): YPos+15
dbText(15,YPos,"By: Ron Erickson"): YPos+15
dbText(15,YPos,"visit: www.gametoolshed.com"): YPos+15
dbText(15,YPos," "): YPos+15
dbText(15,YPos,"Press 1 for Global Rotation"): YPos+15
dbText(15,YPos,"Press 2 for Local Rotation"): YPos+15
dbText(15,YPos,"---------------------------"): YPos+15
If mode=1: dbText(15,YPos,"Current mode: Global"): YPos+15: EndIf
If mode=2: dbText(15,YPos,"Current mode: Local"): YPos+15: EndIf
dbText(15,YPos," X Rotation - Up and Down arrows"): YPos+15
dbText(15,YPos," Y Rotation - Left and Right arrows"): YPos+15
dbText(15,YPos," Z Rotation - + and - keys"): YPos+15
dbText(15,YPos," "): YPos+15
dbText(15,YPos,"Euler X=" + StrD(EZRoBasic_GetX())): YPos+15
dbText(15,YPos,"Euler Y=" + StrD(EZRoBasic_GetY())): YPos+15
dbText(15,YPos,"Euler Z=" + StrD(EZRoBasic_GetZ())): YPos+15
dbText(15,YPos," "): YPos+15
dbText(15,YPos,"Matrix XX=" + StrD(EZRoBasic_GetMatXX())): YPos+15
dbText(15,YPos,"Matrix XY=" + StrD(EZRoBasic_GetMatXY())): YPos+15
dbText(15,YPos,"Matrix XZ=" + StrD(EZRoBasic_GetMatXZ())): YPos+15
dbText(15,YPos,"Matrix YX=" + StrD(EZRoBasic_GetMatYX())): YPos+15
dbText(15,YPos,"Matrix YY=" + StrD(EZRoBasic_GetMatYY())): YPos+15
dbText(15,YPos,"Matrix YZ=" + StrD(EZRoBasic_GetMatYZ())): YPos+15
dbText(15,YPos,"Matrix ZX=" + StrD(EZRoBasic_GetMatZX())): YPos+15
dbText(15,YPos,"Matrix ZY=" + StrD(EZRoBasic_GetMatZY())): YPos+15
dbText(15,YPos,"Matrix ZZ=" + StrD(EZRoBasic_GetMatZZ())): YPos+15
dbSync()
; End loop
Until WindowEvent()=#PB_Event_CloseWindow Or dbKeyState(#VK_ESCAPE)
End
EZRotate:
Code: Select all
; EZrotate sample program
; 14-Dec-2005
; Written by: Ron Erickson
; http://www.gametoolshed.com
OpenWindow(0,0,0,640,480,"DarkBasic Professional - PureGDK",#PB_Window_SystemMenu|#PB_Window_ScreenCentered)
hDBWnd=OpenDBWnd(WindowID(0),0,0,640,480)
dbSyncRate(0)
; Main Cube Object
dbMakeObjectCube(1,1)
; Create Global Axis
;--------------------------
; X axis
dbMakeObjectCylinder(2,0.1)
dbScaleObject(2,100,2000,100)
dbPositionObject(2,1,0,0)
dbRotateObject(2,0,0,-90)
dbColorObject(2,dbRGB(255,0,0))
;Yaxis
dbMakeObjectCylinder(3,0.1)
dbScaleObject(3,100,2000,100)
dbPositionObject(3,0,1,0)
dbColorObject(3,dbRGB(0,255,0))
; Z axis
dbMakeObjectCylinder(4,0.1)
dbScaleObject(4,100,2000,100)
dbPositionObject(4,0,0,1)
dbRotateObject(4,90,0,0)
dbColorObject(4,dbRGB(0,0,255))
; Create Local Axis
;--------------------------
; X axis
dbMakeObjectCylinder(5,0.1)
dbScaleObject(5,100,2000,100)
dbMakeMeshFromObject(1,5)
dbDeleteObject(5)
dbAddLimb(1,1,1)
dbOffsetLimb(1,1,1,0,0)
dbRotateLimb(1,1,0,0,-90)
dbColorLimb(1,1,dbRGB(100,0,0))
; Y axis
dbMakeObjectCylinder(5,0.1)
dbScaleObject(5,100,2000,100)
dbMakeMeshFromObject(2,5)
dbDeleteObject(5)
dbAddLimb(1,2,2)
dbOffsetLimb(1,2,0,1,0)
dbColorLimb(1,2,dbRGB(0,100,0))
; Z axis
dbMakeObjectCylinder(5,0.1)
dbScaleObject(5,100,2000,100)
dbMakeMeshFromObject(3,5)
dbDeleteObject(5)
dbAddLimb(1,3,3)
dbOffsetLimb(1,3,0,0,1)
dbRotateLimb(1,3,90,0,0)
dbColorLimb(1,3,dbRGB(0,0,100))
; Camera
dbPositionCamera(-5,5,-5)
dbPointCamera(0,0,0)
mode=1
Repeat
; Set EZrotate to objects current angle
EZro_SetEuler(dbObjectAngleX(1),dbObjectAngleY(1),dbObjectAngleZ(1))
If dbInKey()="1": mode=1: EndIf
If dbInKey()="2": mode=2: EndIf
; Rotate X Axis
If dbUpKey()=1
If mode=1: EZro_GX(1): EndIf
If mode=2: EZro_LX(1): EndIf
EndIf
If dbDownKey()=1
If mode=1: EZro_GX(-1): EndIf
If mode=2: EZro_LX(-1): EndIf
EndIf
; Rotate Y Axis
If dbRightKey()=1
If mode=1: EZro_GY(1): EndIf
If mode=2: EZro_LY(1): EndIf
EndIf
If dbLeftKey()=1
If mode=1: EZro_GY(-1): EndIf
If mode=2: EZro_LY(-1): EndIf
EndIf
; Rotate Z Axis
If dbInKey()="+"
If mode=1: EZro_GZ(1): EndIf
If mode=2: EZro_LZ(1): EndIf
EndIf
If dbInKey()="-"
If mode=1: EZro_GZ(-1): EndIf
If mode=2: EZro_LZ(-1): EndIf
EndIf
If dbSpaceKey()=1: EZro_SetEuler(0,0,0): EndIf
; Calculate the new Euler angles of the Internal EZrotate Object
EZro_FindEuler()
; Set Object to EZrotate's calculated rotation
dbRotateObject(1,EZro_GetEulerX(),EZro_GetEulerY(),EZro_GetEulerZ())
YPos=15
dbText(15,YPos,Str(dbScreenFPS())): YPos+15
dbText(15,YPos,"EZ-Rotate Basic version"): YPos+15
dbText(15,YPos,"By: Ron Erickson"): YPos+15
dbText(15,YPos,"visit: www.gametoolshed.com"): YPos+15
dbText(15,YPos," "): YPos+15
dbText(15,YPos,"Press 1 for Global Rotation"): YPos+15
dbText(15,YPos,"Press 2 for Local Rotation"): YPos+15
dbText(15,YPos,"---------------------------"): YPos+15
If mode=1: dbText(15,YPos,"Current mode: Global"): YPos+15: EndIf
If mode=2: dbText(15,YPos,"Current mode: Local"): YPos+15: EndIf
dbText(15,YPos," X Rotation - Up and Down arrows"): YPos+15
dbText(15,YPos," Y Rotation - Left and Right arrows"): YPos+15
dbText(15,YPos," Z Rotation - + and - keys"): YPos+15
dbText(15,YPos," "): YPos+15
dbText(15,YPos,"Euler X=" + StrD(EZro_GetEulerX())): YPos+15
dbText(15,YPos,"Euler Y=" + StrD(EZro_GetEulerY())): YPos+15
dbText(15,YPos,"Euler Z=" + StrD(EZro_GetEulerZ())): YPos+15
dbText(15,YPos," "): YPos+15
dbText(15,YPos,"Matrix XX=" + StrD(EZro_GetMatXX())): YPos+15
dbText(15,YPos,"Matrix XY=" + StrD(EZro_GetMatXY())): YPos+15
dbText(15,YPos,"Matrix XZ=" + StrD(EZro_GetMatXZ())): YPos+15
dbText(15,YPos,"Matrix YX=" + StrD(EZro_GetMatYX())): YPos+15
dbText(15,YPos,"Matrix YY=" + StrD(EZro_GetMatYY())): YPos+15
dbText(15,YPos,"Matrix YZ=" + StrD(EZro_GetMatYZ())): YPos+15
dbText(15,YPos,"Matrix ZX=" + StrD(EZro_GetMatZX())): YPos+15
dbText(15,YPos,"Matrix ZY=" + StrD(EZro_GetMatZY())): YPos+15
dbText(15,YPos,"Matrix ZZ=" + StrD(EZro_GetMatZZ())): YPos+15
dbSync()
; End loop
Until WindowEvent()=#PB_Event_CloseWindow Or dbKeyState(#VK_ESCAPE)
End