Testing ODE :)

Developed or developing a new product in PureBasic? Tell the world about it.
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Testing ODE :)

Post by Polo »

Hi !
I'm currently playing with ode in Purebasic, i'm only a beginner with it at the moment, but I hope to start doing better things, anyway, i've translated a blitz example, except one parameters that i've changed to see more the movement :)
Here's the files, please tell me if it works (if you see something on the screen), and if it's fast or not. Thx !

http://mitstudio.free.fr/OdeTest.zip

btw, I hope ode will be made available as a purelibrary instead as a dll, i hate having dlls included in my project, it's the only non-system dll i'm using :)
DarkDragon
Addict
Addict
Posts: 2345
Joined: Mon Jun 02, 2003 9:16 am
Location: Germany
Contact:

Post by DarkDragon »

:lol: Works fine on my notebook(S3 Graphics). But the cubes are not textured :-/ .
bye,
Daniel
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Post by Polo »

Hi ! Cool it's working ;)
Only the cubes are not textured, or the whole world is not textured ? If it's the cube, well it may comes from the texture loader i've made...
How fast does it works with... that graphics card :lol:
Well, mine is not better : geforce 2mx :D
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

Post by thefool »

its working nicely here.
But the boxes are way to fast moving and rotating.

[Radeon 9600xt 256mb graphiccard.]
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6166
Joined: Sat May 17, 2003 11:31 am
Contact:

Post by blueznl »

all thoose people that always complain :-)

works fine here, all textured (cross on grey on cubes, solar spots as ground), speed is okay
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
gilles_k
New User
New User
Posts: 9
Joined: Thu May 15, 2003 7:38 am

Post by gilles_k »

Same thing, work fine.

Poor cube, bouncing, bouncing and bouncing again and again and again.
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Post by Polo »

For the speed it's normal : the movement is not speed based, so it will be as fast as your computer can calculate it, i know it's not the good way to do it, but i don't care, it's just a test :)
it's done with my 3d engine, so it was also a little test of it (well, i haven't used a lot of it into it :)). The commands are similar to blitz3d's one nd the concept is the same also :)

Here's the code of the demo (not optimized)

Code: Select all

Graphics3D(800,600,16,2)

Procedure MoveMouse(x,y)
  SetCursorPos_(WindowX()+x,WindowY()+y)
EndProcedure
Procedure.f CurveValue(newvalue.f,oldvalue.f,increments.f)
  If increments>1
    oldvalue.f=oldvalue.f-(oldvalue.f-newvalue.f)/increments
  EndIf
  If increments<=1
    oldvalue.f=newvalue
  EndIf
  ProcedureReturn oldvalue
EndProcedure

dParamLoStop 			= 0
dParamHiStop			= 1
dParamVel				= 2
dParamVel2			= 258
dParamFMax			= 3
dParamFMax2			= 259
dParamFudgeFactor		= 4
dParamBounce			= 5
dParamCFM				= 6
dParamStopERP			= 7
dParamStopCFM			= 8
dParamSuspensionERP	= 9
dParamSuspensionCFM	= 10

dContactMu2		= $001
dContactFDir1		= $002
dContactBounce	= $004
dContactSoftERP	= $008
dContactSoftCFM	= $010
dContactMotion1	= $020
dContactMotion2	= $040
dContactSlip1		= $080
dContactSlip2		= $100
dContactApprox0	= $0000
dContactApprox1_1	= $1000
dContactApprox1_2	= $2000
dContactApprox1	= $3000


camera=CreateCamera(WindowID(),0)
PositionEntity(camera, 0, 10, -30)

img1=LoadTexture("tex3.jpg")
ScaleTexture(img1,20,20)
img2=LoadTexture("tex2.bmp")

cube1=CreateCube(0)
ScaleMesh(cube1,1000,0.5,1000)
PaintMesh(cube1,img1)



space=ODE_dWorldCreate(1)
ODE_dSetContactMode(dContactBounce + dContactSoftERP + dContactSoftCFM + dSlip1 + dSlip2)
ODE_dSetMU(0.6); Friction
ODE_dSetBOUNCE(0.5)
ODE_dSetSOFT_ERP(0.9)
ODE_dSetSOFT_CFM(0.1)

For i=1 To 10
  gbody = ODE_dBodyCreate()
	ggeom = ODE_dCreateBox(space, 2, 2, 2, 10)
  gmesh = CreateCube(0)
  PaintMesh(gmesh,img2)
  ODE_dGeomSetBody(ggeom,gbody,gmesh)
	ODE_dBodySetPosition(gbody,Random(30), Random(40), Random(30))
	ODE_dBodySetRotation(gbody, Random(180), Random(180), Random(180))
Next


geom = ODE_dCreateBox(space, 15, 1, 15, 10)
ODE_dGeomSetPosition(geom, 0, 3, 0)
ODE_dGeomSetRotation(geom, -20, 0, 0)
mesh = CreateCube(0)
PaintMesh(mesh,img2)
PositionEntity(mesh, 0, 3, 0)
RotateEntity(mesh, -20, 0, 0)
ScaleMesh(mesh, 0.5, 0.5, 0.5)
ScaleEntity(mesh, 15, 1, 15)


ODE_UpdateGeoms()

MoveMouse(400,300)
XPos.f=WindowMouseX()
YPos.f=WindowMouseY()
yaw.f=-20
Repeat
  EventID.l = WindowEvent()
   
  If GetAsyncKeyState_(#VK_UP) <> 0
    move.f=0.5
  ElseIf GetAsyncKeyState_(#VK_DOWN) <> 0
    move.f=-0.5
  EndIf
  If GetAsyncKeyState_(#VK_RIGHT) <> 0
    strafe.f=0.4
  ElseIf GetAsyncKeyState_(#VK_LEFT) <> 0
    strafe.f=-0.4
  EndIf
  
  mx.f=curvevalue(-(WindowMouseX()-XPos)/10.0,mx,10)
  my.f=curvevalue((WindowMouseY()-YPos)/10.0,my,10)
  MoveMouse(400,300)
  
  XPos.f=WindowMouseX()
  YPos.f=WindowMouseY()
  yaw.f=yaw+mx
  pitch.f=pitch+my
  If pitch>85 :pitch=85:EndIf
  If pitch<-85 :pitch=-85:EndIf
  
  
  RotateEntity(camera,0,yaw.f,0)
  TurnEntity(camera,pitch.f,0,0)
  MoveEntity(camera,strafe,0,move)
  move=0
  strafe=0
  
  ODE_dWorldQuickStep(0.1)
  ODE_UpdateGeoms()
  
  
  RenderWorld()
  
Until EventID=#PB_EventCloseWindow Or GetAsyncKeyState_(#VK_ESCAPE)
End
Hmm, ok, i've lied, my 3d engine is nearly exactly the same syntax as blitz3d :) But i still miss some commands, though i've nearly done a dirextX .x file importer and i'm doing a .3ds file importer too :)
But i plan to integrate ode in the engine, so i'm doing that at the moment ;)
DarkDragon
Addict
Addict
Posts: 2345
Joined: Mon Jun 02, 2003 9:16 am
Location: Germany
Contact:

Post by DarkDragon »

Polo wrote:Hmm, ok, i've lied, my 3d engine is nearly exactly the same syntax as blitz3d :) But i still miss some commands, though i've nearly done a dirextX .x file importer and i'm doing a .3ds file importer too :)
But i plan to integrate ode in the engine, so i'm doing that at the moment ;)
And what about OBJ and B3D and ASC(ASCII Format of 3DS)?
Well, just the cubes are not textured. I made the start of a MD2 Importer, but it didn't work at all.

[Edit]btw.: This Forum has 444 Topics :roll: :roll: :roll: :)

Uhm do you have a good Frustum Culling and a LOD?
And well, I noticed that your cubes are bouncing not at the top-plane of the ground, just at the bottom plane :?
bye,
Daniel
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Post by Polo »

Yes, i may load some others format as well :)
For frustum culling and lod, no i haven't done that, lod terrain are not planned for the moment (there's so much things to do !), and for frustum culling, i haven't found any examples of this with meshes on the screen, so i'm not sure how does it works.
For the bounce, well, it's normal, actually on this example the cubes are not bouncing on the ground, they're just bouncing ;) It's coming from the tutorial i take it from i guess :)

btw, do you know how to do frustum culling ?
DarkDragon
Addict
Addict
Posts: 2345
Joined: Mon Jun 02, 2003 9:16 am
Location: Germany
Contact:

Post by DarkDragon »

Polo wrote:btw, do you know how to do frustum culling ?
Look gametutorials.com up for frustum culling(in opengl section there is a tutorial, but I don't know directX)
bye,
Daniel
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Post by Polo »

Yeah, but if i remember well, the opengl example is only for cube or sphere, no ?
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Post by Polo »

I've got the 3ds loader working, for simple objects, there's some object not or badly loaded because i'm not loading everything, i guess, i think i have to load also transformation matrix, and maybe some stuffs on the texture i've noticed. After i may try to read key frames animation, since my engine supports them. I'll post an example soon !
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Post by Polo »

Just got the 3ds load code working (it adds only 5k in the exe !!), but there is still ONE problem, and it seems it's the only one : some object are not correctly placed, i guess some objects take their position with the transformationmatrix, but i'm not sure how to load this chunk :( Anyway i'll see, and when i'll have time i'll add keyframe :)
I may try to load .x or .b3d now :)
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Post by Polo »

It's me again ;)
Here's an example of a 3ds (well, 2) file loaded. I've loaded to to have a lightmap effect, even if multitexturing would have been better for this :)
Here's the files :
http://mitstudio.free.fr/3DStest.rar

It's in fullscreen, because the windowed mode gives slow result :) Anyway you can see that the textures are not really good loaded, i plan to change that :)
traumatic
PureBasic Expert
PureBasic Expert
Posts: 1661
Joined: Sun Apr 27, 2003 4:41 pm
Location: Germany
Contact:

Post by traumatic »

Polo wrote:Anyway you can see that the textures are not really good loaded, i plan to change that :)
To be honest, I can hardly see anything - it's soooooo dark! ;)

Is it supposed to be that way?

(NVIDIA GeForce 4 Ti 4200)
Good programmers don't comment their code. It was hard to write, should be hard to read.
Post Reply