Ooops
May 24, 2020, 11:24:44 PM

Author Topic: mini3d vs openb3d  (Read 336 times)

Offline JBR

  • Jr. Member
  • **
  • Posts: 90
mini3d vs openb3d
« on: January 08, 2020, 11:58:29 PM »
Hi, I'm getting very unusual results regarding simple creating & freeing entities.

Try this - change from one to other at the top. mini3d is many times faster on my pc.

Code: [Select]
SuperStrict

Import sidesign.minib3d
'Import openb3dmax.B3dglgraphics

Global G_Width% = DesktopWidth()
Global G_Depth% = DesktopHeight()
 
Graphics3D G_Width%, G_Depth%, 32, 1
 
ClearTextureFilters()
SetBlend ALPHABLEND

Global time_free%
Global time_create%

'--------------------------------------------------------------------------------------------------------------------
' Camera related initialize
'--------------------------------------------------------------------------------------------------------------------
Global G_Camera:TCamera = CreateCamera()

CameraRange G_Camera, 1, 100000

Global G_Sphere:TEntity = CreateSphere(13) ' quicker to copy than create


Global spheres:TEntity[1000]

For Local i% = 0 To 999
spheres[i] = CreateSphere(13) ' just some dumb entities
Next



Repeat

GCCollect()

If KeyDown(KEY_ESCAPE) Then End

time_free = MilliSecs()
For Local i% = 0 To 999
FreeEntity spheres[i]
Next
time_free = MilliSecs()-time_free

time_create = MilliSecs()
For Local i% = 0 To 999
spheres[i] = CopyEntity(G_Sphere) ' CreateSphere(13)
EntityColor spheres[i], Rand(0,255), Rand(0,255), Rand(0,255)
PositionEntity spheres[i], Rnd(-100,100), Rnd(-100,100), Rnd(100,1000)
Next
time_create = MilliSecs()-time_create

RenderWorld

BeginMax2D()

DrawText("TIME FREE  : " + time_free, 0, 100)
DrawText("TIME CREATE: " + time_create, 0, 140)

EndMax2D()

Flip False

Forever
End


Offline JBR

  • Jr. Member
  • **
  • Posts: 90
Re: mini3d vs openb3d
« Reply #1 on: January 09, 2020, 12:02:42 AM »
Hi done more tests and found that HideEntity & ShowEntity is the way to go. (about the same speed)

Jim.

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal