PureGDK - 3D Programming for PureBasic

Developed or developing a new product in PureBasic? Tell the world about it.
Mistrel
Addict
Addict
Posts: 3415
Joined: Sat Jun 30, 2007 8:04 pm

Post by Mistrel »

Yes, I know. I've gotten a few e-mails about this already. It expired a week earlier than expected. I'll have the new beta out later today.

Sorry for the trouble this is causing people. :x
Mistrel
Addict
Addict
Posts: 3415
Joined: Sat Jun 30, 2007 8:04 pm

Post by Mistrel »

Olby, correct me if I'm wrong but PureGDK is already up to date with support for the Enhanced Animations plugin. Unless new commands are added or the parameters change then it's still "up to date".

The files produced by the library builder are just a wrapper for the command library. It doesn't actually contain any code from the dll; it only contains the command names and parameters.

Let me know specifically if it's missing something and I'll add it to the official release.
Mistrel
Addict
Addict
Posts: 3415
Joined: Sat Jun 30, 2007 8:04 pm

Post by Mistrel »

Here it is, PureGDK 1.1.0 Beta 3. Unless any new bugs crop up I think this will be the last beta.

This release includes all of the commands I could find that have been added since DBP 6.7 as well as their entries in the documentation. The Advanced Terrain library has also been added to the documentation, since the plugin now ships with the product.

http://puregdk.com/files/upload/PureGDK ... 3-4.30.zip
http://puregdk.com/files/upload/PureGDK ... -1.1b3.zip

PureGDK 1.1.0 Beta 3
====================

Bug fixes:
- Fixed a bug where the PureGDK compiler would diplay both the GUI and the command-line window at the same time. The command line window is now hidden when compiling from the IDE as it was intended. This update was missing from 1.1.0 Beta 2.
- Fixed a bug where dbMouseMoveX and dbMouseMoveY calculated the first iteration incorrectly.
- Fixed a bug where the PureGDK compiler would not parse the include keyword correctly if it did not use parenthesis.
- Fixed a bug where the following commands would fail to return a value with the debugger on: dbLightExist, dbLightType, dbLightVisible, dbLightRange, dbLightPositionX, dbLightPositionY, dbLightPositionZ, dbLightDirectionX, dbLightDirectionY, dbLightDirectionZ.
- Removed old debug code in dbSetLightRotationVector that would cause a message box to be appear when called.
- Fixed a bug where dbMouseClick returned the wrong value for the right and middle mouse buttons. The value returned now matches the documentation.
- Fixed a bug where in dbIsIdentityMatrix could fail to recognize a matrix4 structure as an identity matrix.
- Fixed a bug in dbGetCameraPositionVector, dbGetCameraRotationVector, dbGetMatrixPositionVector, dbGetParticlePositionVector, and dbGetParticleRotationVector where they would failed to return the expected value.
- Fixed a bug where dbLoadEffect would cause an access violation error.
- Added all of the new GameFX commands which were missing from PureGDK 1.1.0 Beta 1.
- Added missing help documentaton to the System library.
- Fixed a bug where dbTextureScreen only accepted one parameter where it should have accepted two.

Updates:
- Swapped the parameter order of dbCloneSound to be consistent with other commands.
- DBP 7.0 Added new optional parameters to dbLoadEffect and dbSetCameraToImage
- DBP 7.0 Added new commands dbCheckListFValueA, dbCheckListFValueB, dbCheckListFValueC, and dbCheckListFValueD
- Removed the commands dbDisableSystemKeys, dbEnableSystemKeys, dbDisableEscapeKey and dbEnableEscapeKey. This functionality is obsolete in PureGDK 1.1.0 and can be handled through keyboard events.
- Added documentation to the help file for all of the new commands introduced since 6.7.
- Added the library Advanced Terrain to the core libraries. Refer to the documentation for a list of commands.
- The following commands will now automatically use and return the next free ID associated with the entity being created when passed an ID of #PB_Any or -1:
* dbLoadAnimation
* dbLoadDVDAnimation
* dbMakeLight
* dbLoadBitmap
* dbCreateBitmap
* dbLoadSound
* dbLoad3DSound
* dbCloneSound
* dbRecordSound
* dbLoadObject
* dbCloneObject
* dbInstanceObject
* dbMakeObject
* dbMakeObjectBox
* dbMakeObjectCone
* dbMakeObjectCube
* dbMakeObjectCylinder
* dbMakeObjectFromLimb
* dbMakeObjectPlain
* dbMakeObjectSphere
* dbMakeObjectTriangle
* dbLoadEffect
* dbLoadVertexShader
* dbLoadPixelShader
* dbLoadMesh
* dbMakeMeshFromObject
* dbLoadImage
* dbGetImage
* dbLoadMusic
* dbMakeMemblock
* dbMakeMemblockFromBitmap
* dbMakeMemblockFromImage
* dbMakeMemblockFromSound
* dbMakeMemblockFromMesh
* dbCopyMemblock
* dbMakeBitmapFromMemblock
* dbMakeImageFromMemblock
* dbMakeSoundFromMemblock
* dbMakeMeshFromMemblock
* dbChangeMeshFromMemblock
* dbMakeParticles
* dbMakeSnowParticles
* dbMakeFireParticles
* dbMakeCamera
* dbMakeMatrix
* dbMakeTerrain
* dbSprite
* dbCreateAnimatedSprite
* dbCloneSprite
Olby
Enthusiast
Enthusiast
Posts: 461
Joined: Mon Jan 12, 2009 10:33 am
Contact:

Post by Olby »

Looks like this is the best beta to date :)
Mistrel wrote:Olby, correct me if I'm wrong but PureGDK is already up to date with support for the Enhanced Animations plugin. Unless new commands are added or the parameters change then it's still "up to date".

The files produced by the library builder are just a wrapper for the command library. It doesn't actually contain any code from the dll; it only contains the command names and parameters.

Let me know specifically if it's missing something and I'll add it to the official release.
I know, I haven't checked if there are any new commands I just looked on the version numbers available for the download and what was then supported by the PGDK. If you say that there isn't any new commands then that's fine. I will inform you if there is a specific command EnAn is missing.
Intel Core i7 Quad 2.3 Ghz, 8GB RAM, GeForce GT 630M 2GB, Windows 10 (x64)
Mistrel
Addict
Addict
Posts: 3415
Joined: Sat Jun 30, 2007 8:04 pm

Post by Mistrel »

Be sure to uninstall any previous version of PureGDK that might be installed first, otherwise you'll get an error like this:

Image

Functionality for this plugin has been merged into the core library GDKLib_Terrain and the framework library has been removed. If you try to start the PureBasic compiler without removing the duplicate library it will error.
Mistrel
Addict
Addict
Posts: 3415
Joined: Sat Jun 30, 2007 8:04 pm

Post by Mistrel »

A small but important bug fix. Although I've been instructing people to uninstall PureGDK before reinstalling a new version since the start of this beta it would have helped if the uninstaller actually worked. :wink:
PureGDK 1.1.0 Beta 4
====================

Bug fixes:
- Updated the uninstaller to be compatible with PureBasic 4.30.
http://puregdk.com/files/upload/PureGDK ... 4-4.30.zip
Olby
Enthusiast
Enthusiast
Posts: 461
Joined: Mon Jan 12, 2009 10:33 am
Contact:

Post by Olby »

:shock: I wanted to inform you that uninstaller did not remove those libraries, but you fixed it faster than I was thinking about it... :)
Intel Core i7 Quad 2.3 Ghz, 8GB RAM, GeForce GT 630M 2GB, Windows 10 (x64)
Mistrel
Addict
Addict
Posts: 3415
Joined: Sat Jun 30, 2007 8:04 pm

Post by Mistrel »

Someone picked up on it earlier and notified me by e-mail. :)
SFSxOI
Addict
Addict
Posts: 2970
Joined: Sat Dec 31, 2005 5:24 pm
Location: Where ya would never look.....

Post by SFSxOI »

I have a sort of a stupid question; Does this include any features for transparency globally like for fade in and out effects?
Mistrel
Addict
Addict
Posts: 3415
Joined: Sat Jun 30, 2007 8:04 pm

Post by Mistrel »

SFSxOI wrote:I have a sort of a stupid question; Does this include any features for transparency globally like for fade in and out effects?
You can fade in/out in several different ways. You can use a shader, dbSetObjectTransparency(), or by fading an alpha map.

So to answer your question, yes. :)
Olby
Enthusiast
Enthusiast
Posts: 461
Joined: Mon Jan 12, 2009 10:33 am
Contact:

Post by Olby »

You missed a bunch of IMAGEBLOCK specific commands from the image dll. Those are new ones, I did not see them before. Great feature only if it would support more than 64 megs as today's game levels and models use large textures so 64 might be not enough.
Intel Core i7 Quad 2.3 Ghz, 8GB RAM, GeForce GT 630M 2GB, Windows 10 (x64)
Mistrel
Addict
Addict
Posts: 3415
Joined: Sat Jun 30, 2007 8:04 pm

Post by Mistrel »

Unfortunately, all of the new commands aren't listed in the release notes. If you find any more please let me know and I'll add them.

There's nothing to worry about with these commands anyways since they don't appear to do anything:

http://forum.thegamecreators.com/?m=for ... 46025&b=15
Onyx
User
User
Posts: 31
Joined: Mon Aug 07, 2006 10:19 pm

PureGDK EZRotate Example

Post by Onyx »

Since there are so many DB plugins supported natively, I'm wondering if there will be documentation on what the commands are via PureGDK.

My current interest is the EZRotate commands. Any chance someone could provide a basic example of using the EZRotate commands through PureGDK?
Olby
Enthusiast
Enthusiast
Posts: 461
Joined: Mon Jan 12, 2009 10:33 am
Contact:

Post by Olby »

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 ?
Intel Core i7 Quad 2.3 Ghz, 8GB RAM, GeForce GT 630M 2GB, Windows 10 (x64)
Mistrel
Addict
Addict
Posts: 3415
Joined: Sat Jun 30, 2007 8:04 pm

Post by Mistrel »

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
Post Reply