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 »

DarkPhysics and any other supported plugin should "just work". The easiest solution is to install it with your DarkBasic Professional installation, license it, and re-run the PureGDK setup. It will prompt you asking to copy your existing plugins and license files.

Because of string table incompatibilities that might arise it's recommended that you use the plugin versions listed in the PureGDK help file. If you need to support other plugins or a different version you can do this easily using the PureGDK plugin framework (see the help file).
ale870 wrote:Can I modify the vertex of a terrain to "link" it to another neighbor terrain?
How?
I don't think it's possible to access the individual vertices of an advanced terrain grid. This question should be directed to the DBP forum or TGC who is the author of the plugin. If this doesn't provide a solution you could also try contacting IanM on the DBP forums and see if he can find a way to do it and add it to his Matrix1Utils library.

Advanced Terrain only supports heightmap generation from a grayscale bitmap. I suspect that if you match the colors of conjoining images then the edges will match. The algorithm may take an average of the surrounding vertices so you may have to match more than the last pixel. You can easily do all kinds of filtering techniques to blend two or more images together to make a smooth transition. You'll just have to experiment.

There are also several examples on the DBP forum for generating a terrain from scratch using memblocks or some other method.
ale870 wrote:I wish to know if I can use a shader to make it
Anything written in DBP can be written for PureGDK. You just have to convert it. If that's what Green Gandalf's code does then sure, you can do it.

Since you are using framework plugins with your project let me warn you about a bug that's been fixed for the next release. Any function from a framework library (not the DBP core command libraries) that returns a value and has only one parameter does not return the correct value. I think this may apply to any return type.

If this bug is a problem you can get around it by simply using OpenLibrary/GetFunction and calling the function yourself. Be sure to include at least one library function in your code from that particular framework library for it to be included in the compiled executable.
ale870
Enthusiast
Enthusiast
Posts: 180
Joined: Wed Jul 09, 2008 7:02 am
Contact:

Post by ale870 »

In DBPro demos there is "terrain.dbpro", can you convert it (terrain + physics) to use as example, just to understand how to do it in PureGDK?

(in your site you haven't any example about physics! )

Thank you!
Mistrel
Addict
Addict
Posts: 3415
Joined: Sat Jun 30, 2007 8:04 pm

Post by Mistrel »

I think this is the demo you're looking for:

Code: Select all

Declare rnd2(num)

Procedure ErrorHandler()
	description.s=GetErrorDescription()
	module.s=GetErrorModuleName()
	string.s+dbGetErrorDescription(@description.s)+#CRLF$
	string.s+"Line: "+Str(GetErrorLineNR())+#CRLF$
	string.s+"AFile: "+dbGetErrorFilename(@module.s)+#CRLF$
	MessageRequester("Custom Error",string.s)
	End
EndProcedure
OnErrorGosub(@ErrorHandler())

hDBWnd=OpenDBWnd(0,0,640,480,32,#GDK_Window_SystemMenu|#GDK_Window_ScreenCentered)

; Advanced Terrain System - Example 1

; sky textures from - SkyMatter
; heightmap created by - David Smith ( infiniteloop@optushome.com.au )
; terrain base texture - generated from Advanced Terrain System Plus
; demo by - TGC

; set up display And camera
dbBackdropOn()
dbAutoCamOff()
dbSetCameraRange(0.5, 30000)

; movement
g_fSpeed.f = 0.05
g_fTurn.f  = 0.3

; set the directory To media
dbSetDir("Media")

; load base And detail texture
dbLoadImage("texture.bmp",1)
dbLoadImage("detail.tga",2)

dbMakeObjectTerrain(1)													; create the terrain object
dbSetTerrainHeightMap(1,"map.bmp")							; set the heightmap
dbSetTerrainScale(1,3,0.6,3)										; set the scale
dbSetTerrainSplit(1,16)													; split value by 16 * 16
dbSetTerrainTiling(1,4)													; detail map tiling
dbSetTerrainLight(1,1,-0.25,0,1,1,0.78,0.5)			; light - xdir, ydir, zdir, red, green, blue, intensity
dbSetTerrainTexture(1,1,2)											; base And detail texture
dbBuildTerrain(1)																; finally build the terrain

; load our skybox
dbLoadObject("skybox2.x",200)
dbSetObjectLight(200,0)
dbSetObjectTexture(200,3,1)

dbPositionObject(200,1000,2000,4000)
dbScaleObject(200,30000,30000,30000)

; reset the directory
dbSetDir("..")

; position the camera
dbPositionCamera(385,23,100)

; main program loop
Repeat
   ; handle user input And show some stats
   Gosub userInput
   Gosub information

   ; get the height of the terrain at the current camera position
   a.f=dbGetTerrainGroundHeight(1,dbCameraPositionX(),dbCameraPositionZ())

   ; now position the camera slightly above the terrain
   dbPositionCamera(dbCameraPositionX(),a.f+3,dbCameraPositionZ())

   ; let the terrain handle some internal work
   dbUpdateTerrain()

   ; final screen update
   dbSync()
ForEver

userInput:
   ; simple mouse And keyboard movement

   ; move around With arrow keys
   dbControlCameraUsingArrowKeys(0,g_fSpeed.f,g_fTurn.f)

   ; store old camera angle
   OldCamAngleY.f=CameraAngleY.f
   OldCamAngleX.f=CameraAngleX.f

   ; store new camera angle
   CameraAngleY.f=dbWrapValue(CameraAngleY.f+dbMouseMoveX()*0.4)
   CameraAngleX.f=dbWrapValue(CameraAngleX.f+dbMouseMoveY()*0.4)

   ; rotate camera
   dbYRotateCamera(dbCurveAngle(CameraAngleY.f,OldCamAngleY.f,24))
   dbXRotateCamera(dbCurveAngle(CameraAngleX.f,OldCamAngleX.f,24))

   ; speed up movement
   If dbInKey()="+"
      If g_fSpeed.f<1000
         g_fSpeed.f=g_fSpeed.f+0.01
      EndIf
   EndIf

   ; slow down movement
   If dbInKey()="-"
      If g_fSpeed.f>0.002
         g_fSpeed.f=g_fSpeed.f-0.001
      EndIf
   EndIf
Return

information:
   ; show some information

   ; start printing at top of screen
   dbSetCursor(0,0)

   ; show frame rate
   dbPrint("fps = "+Str(dbScreenFPS()))
   dbPrint("")

   ; current camera position
   dbPrint("")
   dbPrint("x = "+StrF(dbCameraPositionX()))
   dbPrint("y = "+StrF(dbCameraPositionY()))
   dbPrint("z = "+StrF(dbCameraPositionZ()))
   dbPrint("")
   dbPrint("FPS "+Str(dbScreenFPS()))

   ; finally the polygon count
   dbPrint("polygon count = "+Str(dbStatistic(1)))
   dbPrint("")
Return
Here is an example for Dark Physics using the buoyancy demo. It uses some PureGDK 1.1 syntax so you'll have to tweak it to make it work. Specifically the OpenDBWnd parameters have changed, the OpenWindow superfluous, and dbGetActiveFunctions isn't implemented.

Code: Select all

; demonstrates a simple bouyancy effect

Procedure Thread(Null)
	ExamineDesktops()
	OpenWindow(1,DesktopWidth(0)-186,0,180,50,"")
	TextGadget(0,8,8,200,200,"dbGetActiveFunctions 0")
	Repeat
		WaitWindowEvent(10)
		SetGadgetText(0,"dbGetActiveFunctions "+Str(dbGetActiveFunctions()))
	ForEver
EndProcedure

; ThreadID=CreateThread(@Thread(),0)

; show the PureGDK render window
OpenWindow(0,0,0,640,480,"DarkBasic Professional - PureGDK 1.1.0 Beta",#PB_Window_SystemMenu|#PB_Window_ScreenCentered)
hDBWnd=OpenDBWnd(WindowID(0),0,0,640,480,32)
; SetParent_(hDBWnd,0)
; SetWindowLongPtr_(hDBWnd,#GWL_STYLE,GetWindowLongPtr_(hDBWnd,#GWL_STYLE)|#WS_POPUP&(~#WS_CHILD)&(~#WS_DISABLED))

; sync rate on
dbSetDisplayMode(640,480,32,1)

dbSetDir("D:\Program Files\Dark Basic Professional\Projects\Dark Physics\Demos\Rigid Body\Water")

; SetClassLong_(hDBWnd,#GCL_HICON,Str(#IDI_APPLICATION))

; Init
width.f=640: height.f=480
dbAutoCamOff()
dbSetTextFont("Verdana")
dbInk(dbRGB(255,255,255),0)

; prepare counters
Define tmlast.q
Define tmcode.q
Define tmphysics.q
Define tmvisuals.q

; Light
dbSetNormalizationOn(): dbSetAmbientLight(5)
dbSetDirectionalLight(0,0.2,-0.7,0.1)

; Camera
dbPositionCamera(-40,12,-55)
dbSetCameraRange(1,15000)
dbSetCameraAspect(width.f/height.f)
dbSetCameraFOV(70)
dbBackdropOff()

; settings
hardwaremode=1

; capability
dbGetD3DCapabilities(@Result.D3DCaps)
clipvalid=Result\ClipTLVerts
pixelshader.f=Result\MaxPixelShaderVersion.f

; Logo sprite
dbLoadImage("logo.png",100000)
dbSprite(1,0,dbScreenHeight()-60,100000)
dbSizeSprite(1,dbScreenWidth(),60)

; SW/HW loop
Repeat

; Setup physics
Gosub _physics_init
Gosub _physics_setup

; Setup water
Gosub _water_setup

; Main
While dbSpaceKey()=0
 dbSetCurrentCamera(0)
 

 
 ; camera movement
 If dbUpKey()=1
 	dbMoveCamera(1)
 EndIf
 If dbDownKey()=1
 	dbMoveCamera(-1)
 EndIf
 angy.f=dbCameraAngleY()
 angx.f=dbCameraAngleX()
 dbXRotateCamera(0)
 If dbLeftKey()=1 
 	dbYRotateCamera(angy.f-90): dbMoveCamera(1): dbYRotateCamera(angy.f)
 EndIf
 If dbRightKey()=1
 	dbYRotateCamera(angy.f+90): dbMoveCamera(1): dbYRotateCamera(angy.f)
 EndIf
 dbYRotateCamera(angy.f+dbMouseMoveX()/2.0)
 dbXRotateCamera(angx.f+dbMouseMoveY()/2.0)
 dbPointCamera(0,0,0)
 dbPositionListener(dbCameraPositionX(),dbCameraPositionY(),dbCameraPositionZ())
 dbRotateListener(90,0,0)

 ; prompts
 swhw.s="HARDWARE"
 If hardwaremode=0
 	swhw.s="SOFTWARE"
 	dbCenterText(dbScreenWidth()/2,60,"")
 EndIf
 dbCenterText(dbScreenWidth()/2,20,"PHYSX IN "+swhw.s+"  OBJECTS:"+Str(objid-1)+"  FPS:"+Str(dbScreenFPS())+"  CODE:"+Str(tmcode/1000)+"  PHYSICS:"+Str(tmphysics/1000)+"  VISUALS:"+Str(tmvisuals/1000))
 If dbPhysx()=1
  dbCenterText(dbScreenWidth()/2,40,"PRESS SPACE TO TOGGLE BETWEEN SOFTWARE AND HARDWARE")
 Else
  dbCenterText(dbScreenWidth()/2,40,"PHYSX SOFTWARE SUPPORT ONLY")
 EndIf
 If pixelshader.f<2.0
 	dbCenterText(dbScreenWidth()/2,60,"YOU NEED A GPU WITH PIXEL SHADERS 2.0 OR ABOVE")
 EndIf
 
 ; water camera and physics boyancy
 Gosub _physics_handle
 Gosub _water_handle
 
 ; update simulation
 tmlast=ElapsedMilliseconds()
 dbPhyUpdate()
 If tmdelay=0
 	tmphysics=ElapsedMilliseconds()-tmlast
 EndIf
 
 ; visual update
 tmlast=ElapsedMilliseconds()
 Gosub _sync
 If tmdelay=0
 	tmvisuals=ElapsedMilliseconds()-tmlast
 EndIf
 
 ; timer handler
 tmdelay+1
 If tmdelay>30
 	tmdelay=0
 EndIf
 
 If WindowEvent()=#WM_CLOSE
;  		KillThread(ThreadID)
		End
	EndIf
Wend

While dbSpaceKey()<>0 : Wend

; Prompt
dbSetTextSize(30)
dbCenterText(dbScreenWidth()/2,dbScreenHeight()/2,"RESETTING SCENE")
dbSync()

dbSetTextSize(12)

; toggle hardware flag
hardwaremode=1-hardwaremode

; free usages
dbPhyUpdate()
dbDeleteEffect(1): dbDeleteCamera(1): dbDeleteCamera(2)
For s=10 To 10+splashmax
	dbDeleteSound(s)
Next s
dbDeleteObjects(1,objidmax)
dbPhyEnd()

; SW/HW endloop
Until WindowEvent()=#WM_CLOSE
; KillThread(ThreadID)
End

_sync:

; Hide water
dbHideObject(2)

; Quick render the RTTs first
dbSyncMask($00000006): dbSync()

; Show water
dbShowObject(2)

; Debug keys
If dbShiftKey()=1
	dbPasteImage(3,0,0)
EndIf
If dbControlKey()=1
	dbPasteImage(4,0,0)
EndIf

; Sync/end loop
dbSyncMask($00000001): dbSync()

Return

_physics_init:
 
 ; Start the Physics Engine
 If hardwaremode=1
  If dbPhysx()=1
   dbPhyStart(1,0,1)
  Else
   hardwaremode=0
   dbPhyStart()
  EndIf
 Else
  dbPhyStart()
 EndIf
 dbPhySetSkinWidth(0.001)
 
Return

_water_setup:

; make a refraction camera
dbMakeCamera(1)
dbSetCameraRange(1,15000,1)
dbSetCameraFOV(70,1)
dbSetCameraAspect(width.f/height.f,1)
dbBackdropOff(1)
dbSetCameraToImage(1,3,512,512)

; make reflection camera
dbMakeCamera(2)
dbSetCameraRange(1,15000,2)
dbSetCameraFOV(70,2)
dbSetCameraAspect(width.f/height.f,2)
dbBackdropOff(2)
dbSetCameraToImage(2,4,512,512)
dbSetCameraClip(2,2,0,0,0,0,1,0)

; make water
dbSetDir("Water")
dbLoadImage("waves2.dds",2)
dbMakeObjectPlain(2,2000,2000)
dbXRotateObject(2,90)
dbTextureObject(2,2,0)
dbTextureObject(2,3,1)
dbTextureObject(2,4,2)
dbLoadEffect("Fresnel Water.fx",1,0)
dbSetObjectEffect(2,1)
dbSetObjectTransparency(2,1)

; make floor for water
dbLoadImage("f_g_01_d2.dds",5)
dbMakeObjectPlain(5,2000,2000)
dbXRotateObject(5,270)
dbPositionObject(5,0,-20,0)
dbScaleObjectTexture(5,20,20)
dbTextureObject(5,5)
dbSetDir("..")

; make skybox
dbSetDir("Sky")
dbLoadObject("skybox.x",3)
dbSetObjectLight(3,0)
dbScaleObject(3,20000,20000,20000)
dbSetObjectTexture(3,2,1)
dbSetObjectCull(3,0)
dbSetDir("..")

Return

_physics_setup:

; create original object
dbLoadObject("Wood\physXcrate.X",1): dbHideObject(1): dbSetObjectCull(1,0)

; make small box boat
objid=10: dbCloneObject(1,objid): dbScaleObject(objid,300,300,300): dbPositionObject(objid,0,0,0): dbRotateObject(objid,-5,0,0): dbPhyMakeRigidBodyDynamicBox(objid)
objid=11: dbCloneObject(1,objid): dbScaleObject(objid,200,200,200): dbPositionObject(objid,0,20,0): dbRotateObject(objid,-5,0,0): dbPhyMakeRigidBodyDynamicBox(objid)

; create many
Dim crate(2000)
For m=0 To 299
 ; crate
 objid+1: dbInstanceObject(1,objid)
 dbPositionObject(objid,dbCos(m*22)*50,50+(m*10),dbSin(m*22)*50)
 dbRotateObject(objid,Random(360),Random(360),Random(360))
 dbPhyMakeRigidBodyDynamicBox(objid)
 dbPhyAddRigidBodyForce(objid,0,Random(1000),0,1)
 crate(objid)=0
Next m

; Water splash
splashmax=50
dbSetDir("Water")
Dim splash(splashmax)
If splashmax>0
 dbLoad3DSound("splash.wav",10)
 For s=11 To 10+splashmax
 	dbCloneSound(s,10)
 Next s
EndIf

; Make splash objects (ripple & decal effect)
dbLoadImage("ripple16.png",11)
dbLoadImage("bigsplash161.dds",12)
For ss=1 To splashmax
 objid+1: dbMakeObjectPlain(objid,10,10)
 dbXRotateObject(objid,270)
 dbTextureObject(objid,11)
 dbSetObjectLight(objid,0)
 dbSetObjectTransparency(objid,2)
 dbHideObject(objid)
 If ss=1
 	splashobj=objid
 EndIf
 objid+1: dbMakeObjectPlain(objid,10,10)
 dbTextureObject(objid,12)
 dbSetObjectLight(objid,0)
 dbSetObjectTransparency(objid,2)
 dbHideObject(objid)
Next ss
objidmax=objid
dbSetDir("..")

; Scale listener for correct sound scape
dbScaleListener(0.2)

Return

_physics_handle:
 
 ; create a boyancy force effect below waterline
 waterlevelangle.f=dbWrapValue(waterlevelangle.f+1.0)
 waterlevel.f=dbCos(waterlevelangle.f)
	; For objid=10 To objidmax
 For objid=10 To 299
  ; boyancy force
  forcex.f=0.0
  forcey.f=0.0
  forcez.f=0.0
  mass.f=dbPhyGetRigidBodyMass(objid)
	
  If dbObjectPositionY(objid)<0
   ; hit water line
   forcey.f=(Abs(dbObjectPositionY(objid))*mass.f)/2.0
   dbPhySetRigidBodyAngularDamping(objid,0.1+Abs(dbObjectPositionY(objid)/2.0))
   dbPhySetRigidBodyLinearDamping(objid,0.1+Abs(dbObjectPositionY(objid)*4))
  EndIf
  If splashmax>0
   If dbObjectPositionY(objid)<0 And objid>11
    ; splash
    If crate(objid)=0
     For s=1 To splashmax
      If splash(s)=0
       splash(s)=32
       posx.f=dbObjectPositionX(objid)
       posz.f=dbObjectPositionZ(objid)
       dbPositionObject(splashobj+((s-1)*2)+0,posx.f,0.1,posz.f): dbShowObject(splashobj+((s-1)*2)+0)
       dbPositionObject(splashobj+((s-1)*2)+1,posx.f,6.0,posz.f): dbShowObject(splashobj+((s-1)*2)+1)
       dbPlaySound(10+s): dbPositionSound(10+s,posx.f,waterlevel.f,posz.f)
       dbSetSoundSpeed(10+s,18000+Random(3000))
       Break
      EndIf
     Next s
     crate(objid)=1
    EndIf
   EndIf
  EndIf
  ; small water/wave influences
  If dbObjectPositionY(objid)<waterlevel.f
   forcey.f=forcey.f+(Random(500)/100.0)*(mass.f/200.0)
  EndIf
  dbPhyAddRigidBodyForce(objid,forcex.f,forcey.f,forcez.f,1)
 Next objid
 
 ; handle splashes
 If splashmax>0
  For s=1 To splashmax
   If splash(s)>0
    n.f=50+(100-((splash(s)/32.0)*100.0)): nn.f=n.f/2.0
    splobj1=splashobj+((s-1)*2)+0: dbScaleObject(splobj1,n.f,n.f,n.f)
    splobj2=splashobj+((s-1)*2)+1: dbScaleObject(splobj2,100+nn.f,100+nn.f,100+nn.f)
    dbPointObject(splobj2,dbCameraPositionX(0),dbCameraPositionY(0),dbCameraPositionZ(0))
    dbRotateObject(splobj2,0,dbObjectAngleY(splobj2),0)
    splash(s)=splash(s)-1
    If splash(s)>0
     ; animation UV plain
     objid=splobj1: frame=15-(splash(s)/2): Gosub _animate_uv_plain
     objid=splobj2: frame=15-(splash(s)/2): Gosub _animate_uv_plain
    Else
     dbHideObject(splobj1): dbHideObject(splobj2)
    EndIf
   EndIf
  Next s
 EndIf
 
Return

_water_handle:
 
 ; move camera 2 to camera 1 pos
 dbPositionCamera(dbCameraPositionX(),dbCameraPositionY(),dbCameraPositionZ(),1)
 dbRotateCamera(dbCameraAngleX(),dbCameraAngleY(),dbCameraAngleZ(),1)
 dbPositionCamera(dbCameraPositionX(),dbCameraPositionY(),dbCameraPositionZ(),2)
 dbRotateCamera(dbCameraAngleX(),dbCameraAngleY(),dbCameraAngleZ(),2)
 
 ; sky position for camera
 dbPositionObject(3,dbCameraPositionX(0),dbCameraPositionY(0)+200,dbCameraPositionZ(0))
 
Return

_animate_uv_plain:
 dbLockVertexDataForLimb(objid,0)
 vi=0 : vv.f=Int(frame/4)/4.0 : uu.f=(frame-(Int(vv.f)*4))/4.0
 u0.f=uu.f : u1.f=uu.f+0.25 : v0.f=vv.f : v1.f=vv.f+0.25
 dbSetVertexDataUV(vi+0,u1.f,v0.f)
 dbSetVertexDataUV(vi+1,u0.f,v0.f)
 dbSetVertexDataUV(vi+2,u1.f,v1.f)
 dbSetVertexDataUV(vi+3,u0.f,v0.f)
 dbSetVertexDataUV(vi+4,u0.f,v1.f)
 dbSetVertexDataUV(vi+5,u1.f,v1.f)
 dbUnlockVertexData()
 
Return
There is another Dark Physics example someone posted here of the vehicle demo. I think it's in this thread or the beta one.
ale870
Enthusiast
Enthusiast
Posts: 180
Joined: Wed Jul 09, 2008 7:02 am
Contact:

Post by ale870 »

I love you Mistrel! :-) (I'm joking!)

This is the example (starting point) I really needed!
Thank you for this great piece of code!
I will work on it!

I think you could insert it in your PureGDK homepage, since many guys want to use BIG terrains and physics.

Thank you again for your great support.
Mistrel
Addict
Addict
Posts: 3415
Joined: Sat Jun 30, 2007 8:04 pm

Post by Mistrel »

I'll consider it. :)
ale870
Enthusiast
Enthusiast
Posts: 180
Joined: Wed Jul 09, 2008 7:02 am
Contact:

Post by ale870 »

Hello, maybe I'm stupid but I cannot compile phy-enabled apps since I get the message:

http://www.mediafire.com/imageview.php? ... iz&thumb=4


The problem is I cannot understand where I need to put my DarkPhysics.dll.
I tried to put it everywhere (in PureGDK licensed plugins), but I get the same error.
NOTE: obviously, I officially bought DBPro and DarkPhysics.

I get this error as soon as I insert the line dbPhyStart().

Thank you for your help :oops:

EDIT: the message refers to line 33, but I have this line at line 33:

Code: Select all

; demo by - TGC
My line dbPhyStart() is at line: 19.
ale870
Enthusiast
Enthusiast
Posts: 180
Joined: Wed Jul 09, 2008 7:02 am
Contact:

Post by ale870 »

Hello,

maybe it's trivial, but I cannot use dbPhyStart() in my project.
Everytime I try to use it, I got this error:

http://www.mediafire.com/imageview.php? ... iz&thumb=4

Consider that I bought both DBPro and DarkPhysic, but I cannot what I need to do to enable Ageia (and related commands). I get always that error.
Please help me!

(I'm working to make a demo using "paged" terrain. If it works I can give you the demo, source code and other terrain resources, so you can put it in your demo page!). I promise!

EDIT: one thing more: it seems fog command does not work. Funny thing is in DBPro code, the command fog color rgb(255,128,64) does not require a lightID, but your function dbFogColor(lightID, dbRGB(255,128,64)) wants it. Maybe that one is the problem?
Mistrel
Addict
Addict
Posts: 3415
Joined: Sat Jun 30, 2007 8:04 pm

Post by Mistrel »

Did you use the method of installing DarkPhysics, licensing it, and then reinstalling PureGDK to migrate the new plugins and files?

The fog problem it most likely a bug. I will look into this.
ale870
Enthusiast
Enthusiast
Posts: 180
Joined: Wed Jul 09, 2008 7:02 am
Contact:

Post by ale870 »

Ok, it worked!
But I think one must verify which kind of installation one need to make.
Well, when I install PureGDK I can install in my user profile, or with global installation. Firt time I made local user installation, and I forgot that Licensed plugin dir in not the one inside pureGDK, but inside my local profile (AppData).
Instead now I installed it as "all users" and PureGDK installer made a dir called "c:\program files\PureGDK".

Maybe there are some issues with local user install (maybe you could make a brief check, or define a more clear installation procedure, even for plugins).

Thank you!
ale870
Enthusiast
Enthusiast
Posts: 180
Joined: Wed Jul 09, 2008 7:02 am
Contact:

Post by ale870 »

Hello,
I found a strange behaviour of the functions

dbCameraAngleX
dbCameraAngleY
dbCameraAngleZ

In fact, in windows mode, it seems it return somthing related to mouse angle (?), instead camera angle.

Can you make a check?

Finally, I simply need to discover absolute camera rotation, in order make some other calculations about the object it is looking at.

NOTE: I tried the corresponding function in DBPro, and it seems it works correctly. I even tried to use the function with dbCurrentCamera() parameter... but the result is the same.

Thank you.
ale870
Enthusiast
Enthusiast
Posts: 180
Joined: Wed Jul 09, 2008 7:02 am
Contact:

Post by ale870 »

Hello, I found another strange (I think this is a real problem) using dbPhySetRigidBodyLinearVelocity() and dbPhySetRigidBodyAngularVelocity().

It seems the second function - dbPhySetRigidBodyAngularVelocity - does not manage correctly vectors. In fact I made a simple program that allow me to push a sphere in the direction of the camera.
But it seems that the first function works correctly, instad in the second one the sphere goes at 90 degres.

Example:

Code: Select all

CAMERA------->SPHERE
The arrow indicates the vector-direction. So I make a vector subtraction:

Code: Select all

vectorPosition(SPHERE) - vectorPosition(CAMERA)
I get a new vector indicating the direction from camera to the object.
Well, applying dbPhySetRigidBodyLinearVelocity() using that vector, my object goes in the right direction:

Code: Select all

CAMERA------->SPHERE====direction====>
instead using dbPhySetRigidBodyAngularVelocity() my SPHERE goes:

Code: Select all

                /\
                ||
                ||direction
                ||
CAMERA------->SPHERE
Well it seems there is a wrong vector management to apply forces with dbPhySetRigidBodyAngularVelocity().

If you want I can send you the code with the models (zip file).
ale870
Enthusiast
Enthusiast
Posts: 180
Joined: Wed Jul 09, 2008 7:02 am
Contact:

Post by ale870 »

Sorry, but I wish to highlight another problem (please do not forget my two previous posts :-) ).

Now I'm working with pseudo fullscreen (non exclusive mode).

My problem is I cannot setup dbSyncRate(60) or dbSyncRate(25).

The problem is serious for me, since when I walk over the terrain, global speed changes a lot, since frame rate change based on rendering.
So I see my sphere (sphere with physics roperties applied and moved applying forces) goes faster and slower based on frame rate.

Please help me to solve all these issues, thank you for your help.

NOTE: I almost completed an interesting example, containing a big terrain (1024x1024), with a sphere running on it.
Mistrel
Addict
Addict
Posts: 3415
Joined: Sat Jun 30, 2007 8:04 pm

Post by Mistrel »

I haven't had a chance to look into each of these individually but there are a few internal functions that have been fixed for PureGDK 1.1 that may address some of these. I just finished rewriting the new compiler last night and will have a beta prepared soon for people to test.

The beta will contain bugs but because there have been so many core changes I need as much testing as possible.

I'm aware of the SyncRate bug and it may or may not be fixed for the beta but it will be fixed. A work-around for now would be to write your own sync routine by calculating the time it takes to render a single frame and the desired fps and use a delay.

Beta soon-- I promise! :)

I also added a simple GUI to the PureGDK compiler when running from the IDE. This is a welcome change for larger projects that would appear to hang while the PureGDK compiler ran in the background. It also outputs the command-line log so any compiler errors can be easily identified.
ale870
Enthusiast
Enthusiast
Posts: 180
Joined: Wed Jul 09, 2008 7:02 am
Contact:

Post by ale870 »

Thank you Mistrel, I know you are working hard!

If you want, since I'm working making some tests, I can help you to debug the new version.
This could be useful for you (speed-up testing and make it better... two brains work better than one!) and could be useful for me too (learning new functions, make tests with the new version).

Finally, I could send you my source code to test the problems I found.

Thank you.
Mistrel
Addict
Addict
Posts: 3415
Joined: Sat Jun 30, 2007 8:04 pm

Post by Mistrel »

I'll make an announcement here when it's ready. :)
Post Reply