OpenB3D 3D DLL framework include file for PureBasic

Share your advanced PureBasic knowledge/code with the community.
Axeman
User
User
Posts: 89
Joined: Mon Nov 03, 2003 5:34 am

OpenB3D 3D DLL framework include file for PureBasic

Post by Axeman »

The include file below lets you use the OpenB3D DLL file in PureBasic. You can learn more about OpenB3D at: https://sourceforge.net/projects/minib3d/

Here's a video of a game project that is using OpenB3D: https://www.youtube.com/watch?v=Fdxv3kRQDkQ

See the notes below for information about obtaining, installing, and using OpenB3D.
See below this post for the code I used to convert the FreeBasic bi file this include is based on.

; NOTES:-
; All 'handle' values (entity handles, texture handles, etc) used with this library should use PureBasic pointer variables to store the handle, or the PB integer '.i' datatype.
; OpenB3D seems to use 32 bit values internally, so use long integers '.l' and single-precision floats '.f' where appropriate.
; Before ending your program, make sure that you call the supplied 'EndProgram()' function or your own version of that code to close the library and trigger the DLL to do cleanup.
; The 'openb3d.dll' file can be found at: https://sourceforge.net/projects/minib3d/ inside the 'OpenB3D 1.26 for FB win64.zip' file or its 32 bit equivalent. The version number may be different. ~
; ~ The first version of the dll that you will encounter in the zip (the one with the biggest file size) is the one you want. The one in the 'mingw64' library has some dependencies that require mingw to be installed.
; Make sure that you place the DLL into the same folder that the code or executable that calls it is in.
; If you are using the 32 bit version of the DLL then you may need to change 'Prototype' in the code below to 'PrototypeC'.
; For instructions on how to use the library, grab the 'OpenB3D.pdf' file from the web page linked above. Most of the commands are identical to those used in Blitz3D, so you can also find documentation ~
; at: https://kippykip.com/b3ddocs/commands/index.htm | https://blitzresearch.itch.io/blitz3d | https://nitrologic.itch.io/blitz3d
; When using the 'Graphics3D' command, you'll first need to create an OpenGL screen that the OpenB3D library can use. The PureBasic screen commands work for this as long as you have the 'OpenGL' subsystem set ~
; ~ in the compiler options for your main source file. You can also use an 'OpenGLGadget'. Make sure that you use the same width, height, and color depth values, or it may not work.
; OpenB3D uses a left-hand coordinate system. X+ is to the right.
; You'll need to manually repaint the screen if the display becomes corrupted. See the demo code at the bottom of this file for an example of how to do this.

Include this file with your code to allow you to use the OpenB3D DLL. See the notes at the top of the file for more info.

Code: Select all



; NOTES:-
; All 'handle' values (entity handles, texture handles, etc) used with this library should use PureBasic pointer variables to store the handle, or the PB integer '.i' datatype.
; OpenB3D seems to use 32 bit values internally, so use long integers '.l' and single-precision floats '.f' where appropriate.
; Before ending your program, make sure that you call the supplied 'EndProgram()' function or your own version of that code to close the library and trigger the DLL to do cleanup.
; The 'openb3d.dll' file can be found at: https://sourceforge.net/projects/minib3d/ inside the 'OpenB3D 1.26 for FB win64.zip' file or its 32 bit equivalent. The version number may be different. ~
; ~ The first version of the dll that you will encounter in the zip (the one with the biggest file size) is the one you want. The one in the 'mingw64' library has some dependencies that require mingw to be installed.
; Make sure that you place the DLL into the same folder that the code or executable that calls it is in.
; If you are using the 32 bit version of the DLL then you may need to change 'Prototype' in the code below to 'PrototypeC'.
; For instructions on how to use the library, grab the 'OpenB3D.pdf' file from the web page linked above. Most of the commands are identical to those used in Blitz3D, so you can also find documentation ~
; at: https://kippykip.com/b3ddocs/commands/index.htm | https://blitzresearch.itch.io/blitz3d | https://nitrologic.itch.io/blitz3d
; When using the 'Graphics3D' command, you'll first need to create an OpenGL screen that the OpenB3D library can use. The PureBasic screen commands work for this as long as you have the 'OpenGL' subsystem set ~
; ~ in the compiler options for your main source file. You can also use an 'OpenGLGadget'. Make sure that you use the same width, height, and color depth values, or it may not work.
; OpenB3D uses a left-hand coordinate system. X+ is to the right.
; You'll need to manually repaint the screen if the display becomes corrupted. See the demo code at the bottom of this file for an example of how to do this.



#LIB_OPENB3D = 0 ; Declare the constant used with the OpenB3D library.



Procedure FatalError( msg.s ) ; An example 'FatalError' function. A caret '^' can be used in the message to include double linefeeds.
MessageRequester( "Fatal Error", ReplaceString( "The program encountered a fatal error and needs to close. The error was:-^" + msg.s, "^", ~"\n\n" ), #PB_MessageRequester_Error )
End
EndProcedure



Procedure EndProgram() ; An example 'EndProgram' function. This needs to close the library used with 'openb3d.dll' to ensure that the DLL runs its cleanup routines.
; *** Do any general cleanup here.
If IsLibrary( #LIB_OPENB3D ) ; If the library is still open...
	; *** Do any cleanup here that requires the OpenB3D library to still be open.
	CloseLibrary( #LIB_OPENB3D ) ; If the library is still open then close it.
EndIf
; *** Do any cleanup here that requires the OpenB3D library to have been closed.
End ; End the program.
EndProcedure



If OpenLibrary( #LIB_OPENB3D, "openb3d.dll" ) = 0 : FatalError( "Unable to access the 'openb3d.dll' library file." ) : End : EndIf ; Attempt to open the library. Abort if unsuccessful.

Prototype OB3D_BackBufferToTex( *tex, frame.l = 0 ) : Global OB3D_BackBufferToTex.OB3D_BackBufferToTex = GetFunction( #LIB_OPENB3D, "BackBufferToTex" )
Prototype OB3D_BufferToTex( *tex, *buffer, frame.l = 0 ) : Global OB3D_BufferToTex.OB3D_BufferToTex = GetFunction( #LIB_OPENB3D, "BufferToTex" )
Prototype OB3D_CameraToTex( *tex, *cam, frame.l = 0 ) : Global OB3D_CameraToTex.OB3D_CameraToTex = GetFunction( #LIB_OPENB3D, "CameraToTex" )
Prototype OB3D_TexToBuffer( *tex, *buffer, frame.l ) : Global OB3D_TexToBuffer.OB3D_TexToBuffer = GetFunction( #LIB_OPENB3D, "TexToBuffer" )
Prototype OB3D_MeshCullRadius( *ent, radius.f ) : Global OB3D_MeshCullRadius.OB3D_MeshCullRadius = GetFunction( #LIB_OPENB3D, "MeshCullRadius" )
Prototype.l OB3D_AddAnimSeq( *ent, length.l ) : Global OB3D_AddAnimSeq.OB3D_AddAnimSeq = GetFunction( #LIB_OPENB3D, "AddAnimSeq" )
Prototype OB3D_AddMesh( *mesh1, *mesh2 ) : Global OB3D_AddMesh.OB3D_AddMesh = GetFunction( #LIB_OPENB3D, "AddMesh" )
Prototype.l OB3D_AddTriangle( *surf, v0.l, v1.l, v2.l ) : Global OB3D_AddTriangle.OB3D_AddTriangle = GetFunction( #LIB_OPENB3D, "AddTriangle" )
Prototype.l OB3D_AddVertex( *surf, x.f, y.f, z.f, u.f = 0, v.f = 0, w.f = 0 ) : Global OB3D_AddVertex.OB3D_AddVertex = GetFunction( #LIB_OPENB3D, "AddVertex" )
Prototype OB3D_AmbientLight( r.f, g.f, b.f ) : Global OB3D_AmbientLight.OB3D_AmbientLight = GetFunction( #LIB_OPENB3D, "AmbientLight" )
Prototype OB3D_AntiAlias( samples.l ) : Global OB3D_AntiAlias.OB3D_AntiAlias = GetFunction( #LIB_OPENB3D, "AntiAlias" )
Prototype OB3D_Animate( *ent, mode.l = 1, speed.f = 1, seq.l = 0, trans.l = 0 ) : Global OB3D_Animate.OB3D_Animate = GetFunction( #LIB_OPENB3D, "Animate" )
Prototype.l OB3D_Animating( *ent ) : Global OB3D_Animating.OB3D_Animating = GetFunction( #LIB_OPENB3D, "Animating" )
Prototype.l OB3D_AnimLength( *ent ) : Global OB3D_AnimLength.OB3D_AnimLength = GetFunction( #LIB_OPENB3D, "AnimLength" )
Prototype.l OB3D_AnimSeq( *ent ) : Global OB3D_AnimSeq.OB3D_AnimSeq = GetFunction( #LIB_OPENB3D, "AnimSeq" )
Prototype.f OB3D_AnimTime( *ent ) : Global OB3D_AnimTime.OB3D_AnimTime = GetFunction( #LIB_OPENB3D, "AnimTime" )
Prototype OB3D_BrushAlpha( *brush, a.f ) : Global OB3D_BrushAlpha.OB3D_BrushAlpha = GetFunction( #LIB_OPENB3D, "BrushAlpha" )
Prototype OB3D_BrushBlend( *brush, blend.l ) : Global OB3D_BrushBlend.OB3D_BrushBlend = GetFunction( #LIB_OPENB3D, "BrushBlend" )
Prototype OB3D_BrushColor( *brush, r.f, g.f, b.f ) : Global OB3D_BrushColor.OB3D_BrushColor = GetFunction( #LIB_OPENB3D, "BrushColor" )
Prototype OB3D_BrushFX( *brush, fx.l ) : Global OB3D_BrushFX.OB3D_BrushFX = GetFunction( #LIB_OPENB3D, "BrushFX" )
Prototype OB3D_BrushShininess( *brush, s.f ) : Global OB3D_BrushShininess.OB3D_BrushShininess = GetFunction( #LIB_OPENB3D, "BrushShininess" )
Prototype OB3D_BrushTexture( *brush, *tex, frame.l = 0, index.l = 0 ) : Global OB3D_BrushTexture.OB3D_BrushTexture = GetFunction( #LIB_OPENB3D, "BrushTexture" )
Prototype OB3D_CameraClsColor( *cam, r.f, g.f, b.f ) : Global OB3D_CameraClsColor.OB3D_CameraClsColor = GetFunction( #LIB_OPENB3D, "CameraClsColor" )
Prototype OB3D_CameraClsMode( *cam, cls_depth.l, cls_zbuffer.l ) : Global OB3D_CameraClsMode.OB3D_CameraClsMode = GetFunction( #LIB_OPENB3D, "CameraClsMode" )
Prototype OB3D_CameraFogColor( *cam, r.f, g.f, b.f ) : Global OB3D_CameraFogColor.OB3D_CameraFogColor = GetFunction( #LIB_OPENB3D, "CameraFogColor" )
Prototype OB3D_CameraFogMode( *cam, mode.l ) : Global OB3D_CameraFogMode.OB3D_CameraFogMode = GetFunction( #LIB_OPENB3D, "CameraFogMode" )
Prototype OB3D_CameraFogRange( *cam, nnear.f, nfar.f ) : Global OB3D_CameraFogRange.OB3D_CameraFogRange = GetFunction( #LIB_OPENB3D, "CameraFogRange" )
Prototype.i OB3D_CameraPick( *cam, x.f, y.f ) : Global OB3D_CameraPick.OB3D_CameraPick = GetFunction( #LIB_OPENB3D, "CameraPick" )
Prototype OB3D_CameraProject( *cam, x.f, y.f, z.f ) : Global OB3D_CameraProject.OB3D_CameraProject = GetFunction( #LIB_OPENB3D, "CameraProject" )
Prototype OB3D_CameraProjMode( *cam, mode.l ) : Global OB3D_CameraProjMode.OB3D_CameraProjMode = GetFunction( #LIB_OPENB3D, "CameraProjMode" )
Prototype OB3D_CameraRange( *cam, nnear.f, nfar.f ) : Global OB3D_CameraRange.OB3D_CameraRange = GetFunction( #LIB_OPENB3D, "CameraRange" )
Prototype OB3D_CameraViewport( *cam, x.l, y.l, width.l, height.l ) : Global OB3D_CameraViewport.OB3D_CameraViewport = GetFunction( #LIB_OPENB3D, "CameraViewport" )
Prototype OB3D_CameraZoom( *cam, zoom.f ) : Global OB3D_CameraZoom.OB3D_CameraZoom = GetFunction( #LIB_OPENB3D, "CameraZoom" )
Prototype OB3D_ClearCollisions() : Global OB3D_ClearCollisions.OB3D_ClearCollisions = GetFunction( #LIB_OPENB3D, "ClearCollisions" )
Prototype OB3D_ClearSurface( *surf, clear_verts.l = 1, clear_tris.l = 1 ) : Global OB3D_ClearSurface.OB3D_ClearSurface = GetFunction( #LIB_OPENB3D, "ClearSurface" )
Prototype OB3D_ClearTextureFilters() : Global OB3D_ClearTextureFilters.OB3D_ClearTextureFilters = GetFunction( #LIB_OPENB3D, "ClearTextureFilters" )
Prototype OB3D_ClearWorld( entities.l = 1, brushes.l = 1, textures.l = 1 ) : Global OB3D_ClearWorld.OB3D_ClearWorld = GetFunction( #LIB_OPENB3D, "ClearWorld" )
Prototype.i OB3D_CollisionEntity( *ent, index.l ) : Global OB3D_CollisionEntity.OB3D_CollisionEntity = GetFunction( #LIB_OPENB3D, "CollisionEntity" )
Prototype OB3D_Collisions( src_no.l, dest_no.l, method_no.l, response_no.l = 0 ) : Global OB3D_Collisions.OB3D_Collisions = GetFunction( #LIB_OPENB3D, "Collisions" )
Prototype.f OB3D_CollisionNX( *ent, index.l ) : Global OB3D_CollisionNX.OB3D_CollisionNX = GetFunction( #LIB_OPENB3D, "CollisionNX" )
Prototype.f OB3D_CollisionNY( *ent, index.l ) : Global OB3D_CollisionNY.OB3D_CollisionNY = GetFunction( #LIB_OPENB3D, "CollisionNY" )
Prototype.f OB3D_CollisionNZ( *ent, index.l ) : Global OB3D_CollisionNZ.OB3D_CollisionNZ = GetFunction( #LIB_OPENB3D, "CollisionNZ" )
Prototype.i OB3D_CollisionSurface( *ent, index.l ) : Global OB3D_CollisionSurface.OB3D_CollisionSurface = GetFunction( #LIB_OPENB3D, "CollisionSurface" )
Prototype.f OB3D_CollisionTime( *ent, index.l ) : Global OB3D_CollisionTime.OB3D_CollisionTime = GetFunction( #LIB_OPENB3D, "CollisionTime" )
Prototype.l OB3D_CollisionTriangle( *ent, index.l ) : Global OB3D_CollisionTriangle.OB3D_CollisionTriangle = GetFunction( #LIB_OPENB3D, "CollisionTriangle" )
Prototype.f OB3D_CollisionX( *ent, index.l ) : Global OB3D_CollisionX.OB3D_CollisionX = GetFunction( #LIB_OPENB3D, "CollisionX" )
Prototype.f OB3D_CollisionY( *ent, index.l ) : Global OB3D_CollisionY.OB3D_CollisionY = GetFunction( #LIB_OPENB3D, "CollisionY" )
Prototype.f OB3D_CollisionZ( *ent, index.l ) : Global OB3D_CollisionZ.OB3D_CollisionZ = GetFunction( #LIB_OPENB3D, "CollisionZ" )
Prototype.l OB3D_CountChildren( *ent ) : Global OB3D_CountChildren.OB3D_CountChildren = GetFunction( #LIB_OPENB3D, "CountChildren" )
Prototype.l OB3D_CountCollisions( *ent ) : Global OB3D_CountCollisions.OB3D_CountCollisions = GetFunction( #LIB_OPENB3D, "CountCollisions" )
Prototype.i OB3D_CopyEntity( *ent, *parent = 0 ) : Global OB3D_CopyEntity.OB3D_CopyEntity = GetFunction( #LIB_OPENB3D, "CopyEntity" )
Prototype.i OB3D_CopyMesh( *mesh, *parent = 0 ) : Global OB3D_CopyMesh.OB3D_CopyMesh = GetFunction( #LIB_OPENB3D, "CopyMesh" )
Prototype.l OB3D_CountSurfaces( *mesh ) : Global OB3D_CountSurfaces.OB3D_CountSurfaces = GetFunction( #LIB_OPENB3D, "CountSurfaces" )
Prototype.l OB3D_CountTriangles( *surf ) : Global OB3D_CountTriangles.OB3D_CountTriangles = GetFunction( #LIB_OPENB3D, "CountTriangles" )
Prototype.l OB3D_CountVertices( *surf ) : Global OB3D_CountVertices.OB3D_CountVertices = GetFunction( #LIB_OPENB3D, "CountVertices" )
Prototype.i OB3D_CreateBlob( *fluid, radius.f, *parent = 0 ) : Global OB3D_CreateBlob.OB3D_CreateBlob = GetFunction( #LIB_OPENB3D, "CreateBlob" )
Prototype.i OB3D_CreateBone( *mesh, *parent = 0 ) : Global OB3D_CreateBone.OB3D_CreateBone = GetFunction( #LIB_OPENB3D, "CreateBone" )
Prototype.i OB3D_CreateBrush( r.f = 255, g.f = 255, b.f = 255 ) : Global OB3D_CreateBrush.OB3D_CreateBrush = GetFunction( #LIB_OPENB3D, "CreateBrush" )
Prototype.i OB3D_CreateCamera( *parent = 0 ) : Global OB3D_CreateCamera.OB3D_CreateCamera = GetFunction( #LIB_OPENB3D, "CreateCamera" )
Prototype.i OB3D_CreateConstraint( *p1, *p2, l.f ) : Global OB3D_CreateConstraint.OB3D_CreateConstraint = GetFunction( #LIB_OPENB3D, "CreateConstraint" )
Prototype.i OB3D_CreateCone( segments.l = 8, solid.l = 1, *parent = 0 ) : Global OB3D_CreateCone.OB3D_CreateCone = GetFunction( #LIB_OPENB3D, "CreateCone" )
Prototype.i OB3D_CreateCylinder( segments.l = 8, solid.l = 1, *parent = 0 ) : Global OB3D_CreateCylinder.OB3D_CreateCylinder = GetFunction( #LIB_OPENB3D, "CreateCylinder" )
Prototype.i OB3D_CreateCube( *parent = 0 ) : Global OB3D_CreateCube.OB3D_CreateCube = GetFunction( #LIB_OPENB3D, "CreateCube" )
Prototype.i OB3D_CreateFluid() : Global OB3D_CreateFluid.OB3D_CreateFluid = GetFunction( #LIB_OPENB3D, "CreateFluid" )
Prototype.i OB3D_CreateGeosphere( size.l, *parent = 0 ) : Global OB3D_CreateGeosphere.OB3D_CreateGeosphere = GetFunction( #LIB_OPENB3D, "CreateGeosphere" )
Prototype.i OB3D_CreateMesh( *parent = 0 ) : Global OB3D_CreateMesh.OB3D_CreateMesh = GetFunction( #LIB_OPENB3D, "CreateMesh" )
Prototype.i OB3D_CreateLight( light_type.l = 1, *parent = 0 ) : Global OB3D_CreateLight.OB3D_CreateLight = GetFunction( #LIB_OPENB3D, "CreateLight" )
Prototype.i OB3D_CreateOcTree( w.f, h.f, d.f, *parent_ent = 0 ) : Global OB3D_CreateOcTree.OB3D_CreateOcTree = GetFunction( #LIB_OPENB3D, "CreateOcTree" )
Prototype.i OB3D_CreatePivot( *parent = 0 ) : Global OB3D_CreatePivot.OB3D_CreatePivot = GetFunction( #LIB_OPENB3D, "CreatePivot" )
Prototype.i OB3D_CreatePlane( divisions.l = 1, *parent = 0 ) : Global OB3D_CreatePlane.OB3D_CreatePlane = GetFunction( #LIB_OPENB3D, "CreatePlane" )
Prototype.i OB3D_CreateQuad( *parent = 0 ) : Global OB3D_CreateQuad.OB3D_CreateQuad = GetFunction( #LIB_OPENB3D, "CreateQuad" )
Prototype.i OB3D_CreateRigidBody( *body, *p1, *p2, *p3, *p4 ) : Global OB3D_CreateRigidBody.OB3D_CreateRigidBody = GetFunction( #LIB_OPENB3D, "CreateRigidBody" )
Prototype.i OB3D_CreateShadow( *parent, static_type.l = 0 ) : Global OB3D_CreateShadow.OB3D_CreateShadow = GetFunction( #LIB_OPENB3D, "CreateShadow" )
Prototype.i OB3D_CreateSphere( segments.l = 8, *parent = 0 ) : Global OB3D_CreateSphere.OB3D_CreateSphere = GetFunction( #LIB_OPENB3D, "CreateSphere" )
Prototype.i OB3D_CreateSprite( *parent = 0 ) : Global OB3D_CreateSprite.OB3D_CreateSprite = GetFunction( #LIB_OPENB3D, "CreateSprite" )
Prototype.i OB3D_CreateSurface( *mesh, *brush = 0 ) : Global OB3D_CreateSurface.OB3D_CreateSurface = GetFunction( #LIB_OPENB3D, "CreateSurface" )
Prototype.i OB3D_CreateStencil() : Global OB3D_CreateStencil.OB3D_CreateStencil = GetFunction( #LIB_OPENB3D, "CreateStencil" )
Prototype.i OB3D_CreateTerrain( size.l, *parent = 0 ) : Global OB3D_CreateTerrain.OB3D_CreateTerrain = GetFunction( #LIB_OPENB3D, "CreateTerrain" )
Prototype.i OB3D_CreateTexture( width.l, height.l, flags.l = 1, frames.l = 1 ) : Global OB3D_CreateTexture.OB3D_CreateTexture = GetFunction( #LIB_OPENB3D, "CreateTexture" )
Prototype.f OB3D_DeltaPitch( *ent1, *ent2 ) : Global OB3D_DeltaPitch.OB3D_DeltaPitch = GetFunction( #LIB_OPENB3D, "DeltaPitch" )
Prototype.f OB3D_DeltaYaw( *ent1, *ent2 ) : Global OB3D_DeltaYaw.OB3D_DeltaYaw = GetFunction( #LIB_OPENB3D, "DeltaYaw" )
Prototype OB3D_EntityAlpha( *ent, alpha.f ) : Global OB3D_EntityAlpha.OB3D_EntityAlpha = GetFunction( #LIB_OPENB3D, "EntityAlpha" )
Prototype OB3D_EntityAutoFade( *ent, near.f, far.f ) : Global OB3D_EntityAutoFade.OB3D_EntityAutoFade = GetFunction( #LIB_OPENB3D, "EntityAutoFade" )
Prototype OB3D_EntityBlend( *ent, blend.l ) : Global OB3D_EntityBlend.OB3D_EntityBlend = GetFunction( #LIB_OPENB3D, "EntityBlend" )
Prototype OB3D_EntityBox( *ent, x.f, y.f, z.f, w.f, h.f, d.f ) : Global OB3D_EntityBox.OB3D_EntityBox = GetFunction( #LIB_OPENB3D, "EntityBox" )
Prototype.s OB3D_EntityClass( *ent ) : Global OB3D_EntityClass.OB3D_EntityClass = GetFunction( #LIB_OPENB3D, "EntityClass" )
Prototype.i OB3D_EntityCollided( *ent, type_no.l ) : Global OB3D_EntityCollided.OB3D_EntityCollided = GetFunction( #LIB_OPENB3D, "EntityCollided" )
Prototype OB3D_EntityColor( *ent, red.f, green.f, blue.f ) : Global OB3D_EntityColor.OB3D_EntityColor = GetFunction( #LIB_OPENB3D, "EntityColor" )
Prototype.f OB3D_EntityDistance( *ent1, *ent2 ) : Global OB3D_EntityDistance.OB3D_EntityDistance = GetFunction( #LIB_OPENB3D, "EntityDistance" )
Prototype OB3D_EntityFX( *ent, fx.l ) : Global OB3D_EntityFX.OB3D_EntityFX = GetFunction( #LIB_OPENB3D, "EntityFX" )
Prototype.l OB3D_EntityInView( *ent, *cam ) : Global OB3D_EntityInView.OB3D_EntityInView = GetFunction( #LIB_OPENB3D, "EntityInView" )
Prototype.s OB3D_EntityName( *ent ) : Global OB3D_EntityName.OB3D_EntityName = GetFunction( #LIB_OPENB3D, "EntityName" )
Prototype OB3D_EntityOrder( *ent, order.l ) : Global OB3D_EntityOrder.OB3D_EntityOrder = GetFunction( #LIB_OPENB3D, "EntityOrder" )
Prototype OB3D_EntityParent( *ent, *parent_ent, glob.l = 1 ) : Global OB3D_EntityParent.OB3D_EntityParent = GetFunction( #LIB_OPENB3D, "EntityParent" )
Prototype.i OB3D_EntityPick( *ent, range.f ) : Global OB3D_EntityPick.OB3D_EntityPick = GetFunction( #LIB_OPENB3D, "EntityPick" )
Prototype OB3D_EntityPickMode( *ent, pick_mode.l, obscurer.l = 1 ) : Global OB3D_EntityPickMode.OB3D_EntityPickMode = GetFunction( #LIB_OPENB3D, "EntityPickMode" )
Prototype.f OB3D_EntityPitch( *ent, glob.l = 0 ) : Global OB3D_EntityPitch.OB3D_EntityPitch = GetFunction( #LIB_OPENB3D, "EntityPitch" )
Prototype OB3D_EntityRadius( *ent, radius_x.f, radius_y.f = 0 ) : Global OB3D_EntityRadius.OB3D_EntityRadius = GetFunction( #LIB_OPENB3D, "EntityRadius" )
Prototype.f OB3D_EntityRoll( *ent, glob.l = 0 ) : Global OB3D_EntityRoll.OB3D_EntityRoll = GetFunction( #LIB_OPENB3D, "EntityRoll" )
Prototype OB3D_EntityShininess( *ent, shine.f ) : Global OB3D_EntityShininess.OB3D_EntityShininess = GetFunction( #LIB_OPENB3D, "EntityShininess" )
Prototype OB3D_EntityTexture( *ent, *tex, frame.l = 0, index.l = 0 ) : Global OB3D_EntityTexture.OB3D_EntityTexture = GetFunction( #LIB_OPENB3D, "EntityTexture" )
Prototype OB3D_EntityType( *ent, type_no.l, recursive.l = 0 ) : Global OB3D_EntityType.OB3D_EntityType = GetFunction( #LIB_OPENB3D, "EntityType" )
Prototype.l OB3D_EntityVisible( *src_ent, *dest_ent ) : Global OB3D_EntityVisible.OB3D_EntityVisible = GetFunction( #LIB_OPENB3D, "EntityVisible" )
Prototype.f OB3D_EntityX( *ent, glob.l = 0 ) : Global OB3D_EntityX.OB3D_EntityX = GetFunction( #LIB_OPENB3D, "EntityX" )
Prototype.f OB3D_EntityY( *ent, glob.l = 0 ) : Global OB3D_EntityY.OB3D_EntityY = GetFunction( #LIB_OPENB3D, "EntityY" )
Prototype.f OB3D_EntityYaw( *ent, glob.l = 0 ) : Global OB3D_EntityYaw.OB3D_EntityYaw = GetFunction( #LIB_OPENB3D, "EntityYaw" )
Prototype.f OB3D_EntityZ( *ent, glob.l = 0 ) : Global OB3D_EntityZ.OB3D_EntityZ = GetFunction( #LIB_OPENB3D, "EntityZ" )
Prototype.l OB3D_ExtractAnimSeq( *ent, first_frame.l, last_frame.l, seq.l = 0 ) : Global OB3D_ExtractAnimSeq.OB3D_ExtractAnimSeq = GetFunction( #LIB_OPENB3D, "ExtractAnimSeq" )
Prototype.i OB3D_FindChild( *ent, child_name.p-ascii ) : Global OB3D_FindChild.OB3D_FindChild = GetFunction( #LIB_OPENB3D, "FindChild" )
Prototype.i OB3D_FindSurface( *mesh, *brush ) : Global OB3D_FindSurface.OB3D_FindSurface = GetFunction( #LIB_OPENB3D, "FindSurface" )
Prototype OB3D_FitMesh( *mesh, x.f, y.f, z.f, width.f, height.f, depth.f, uniform.l = 0 ) : Global OB3D_FitMesh.OB3D_FitMesh = GetFunction( #LIB_OPENB3D, "FitMesh" )
Prototype OB3D_FlipMesh( *mesh ) : Global OB3D_FlipMesh.OB3D_FlipMesh = GetFunction( #LIB_OPENB3D, "FlipMesh" )
Prototype OB3D_FluidArray( *fluid, Array ParamFluidArray.f( 3 ), width.l, height.l, depth.l ) : Global OB3D_FluidArray.OB3D_FluidArray = GetFunction( #LIB_OPENB3D, "FluidArray" )
Prototype OB3D_FluidFunction( *fluid, *MyFieldFunction ) : Global OB3D_FluidFunction.OB3D_FluidFunction = GetFunction( #LIB_OPENB3D, "FluidFunction" )
Prototype OB3D_FluidThreshold( *fluid, threshold.f ) : Global OB3D_FluidThreshold.OB3D_FluidThreshold = GetFunction( #LIB_OPENB3D, "FluidThreshold" )
Prototype OB3D_FreeBrush( *brush ) : Global OB3D_FreeBrush.OB3D_FreeBrush = GetFunction( #LIB_OPENB3D, "FreeBrush" )
Prototype OB3D_FreeConstraint( *body ) : Global OB3D_FreeConstraint.OB3D_FreeConstraint = GetFunction( #LIB_OPENB3D, "FreeConstraint" )
Prototype OB3D_FreeEntity( *ent ) : Global OB3D_FreeEntity.OB3D_FreeEntity = GetFunction( #LIB_OPENB3D, "FreeEntity" )
Prototype OB3D_FreeRigidBody( *body ) : Global OB3D_FreeRigidBody.OB3D_FreeRigidBody = GetFunction( #LIB_OPENB3D, "FreeRigidBody" )
Prototype OB3D_FreeShader( *s ) : Global OB3D_FreeShader.OB3D_FreeShader = GetFunction( #LIB_OPENB3D, "FreeShader" )
Prototype OB3D_FreeShadow( *parent ) : Global OB3D_FreeShadow.OB3D_FreeShadow = GetFunction( #LIB_OPENB3D, "FreeShadow" )
Prototype OB3D_FreeTexture( *tex ) : Global OB3D_FreeTexture.OB3D_FreeTexture = GetFunction( #LIB_OPENB3D, "FreeTexture" )
Prototype OB3D_GeosphereHeight( *geo, h.f ) : Global OB3D_GeosphereHeight.OB3D_GeosphereHeight = GetFunction( #LIB_OPENB3D, "GeosphereHeight" )
Prototype.i OB3D_GetBrushTexture( *brush, index.l = 0 ) : Global OB3D_GetBrushTexture.OB3D_GetBrushTexture = GetFunction( #LIB_OPENB3D, "GetBrushTexture" )
Prototype.i OB3D_GetChild( *ent, child_no.l ) : Global OB3D_GetChild.OB3D_GetChild = GetFunction( #LIB_OPENB3D, "GetChild" )
Prototype.i OB3D_GetEntityBrush( *ent ) : Global OB3D_GetEntityBrush.OB3D_GetEntityBrush = GetFunction( #LIB_OPENB3D, "GetEntityBrush" )
Prototype.l OB3D_GetEntityType( *ent ) : Global OB3D_GetEntityType.OB3D_GetEntityType = GetFunction( #LIB_OPENB3D, "GetEntityType" )
Prototype.f OB3D_GetMatElement( *ent, row.l, col.l ) : Global OB3D_GetMatElement.OB3D_GetMatElement = GetFunction( #LIB_OPENB3D, "GetMatElement" )
Prototype.i OB3D_GetParentEntity( *ent ) : Global OB3D_GetParentEntity.OB3D_GetParentEntity = GetFunction( #LIB_OPENB3D, "GetParentEntity" )
Prototype.i OB3D_GetSurface( *mesh, surf_no.l ) : Global OB3D_GetSurface.OB3D_GetSurface = GetFunction( #LIB_OPENB3D, "GetSurface" )
Prototype.i OB3D_GetSurfaceBrush( *surf ) : Global OB3D_GetSurfaceBrush.OB3D_GetSurfaceBrush = GetFunction( #LIB_OPENB3D, "GetSurfaceBrush" )
Prototype OB3D_Graphics3D( width.l, height.l, depth.l = 0, mode.l = 0, rate.l = 60 ) : Global OB3D_Graphics3D.OB3D_Graphics3D = GetFunction( #LIB_OPENB3D, "Graphics3D" )
Prototype OB3D_HandleSprite( *sprite, h_x.f, h_y.f ) : Global OB3D_HandleSprite.OB3D_HandleSprite = GetFunction( #LIB_OPENB3D, "HandleSprite" )
Prototype OB3D_HideEntity( *ent ) : Global OB3D_HideEntity.OB3D_HideEntity = GetFunction( #LIB_OPENB3D, "HideEntity" )
Prototype OB3D_LightColor( *light, red.f, green.f, blue.f ) : Global OB3D_LightColor.OB3D_LightColor = GetFunction( #LIB_OPENB3D, "LightColor" )
Prototype OB3D_LightConeAngles( *light, inner_ang.f, outer_ang.f ) : Global OB3D_LightConeAngles.OB3D_LightConeAngles = GetFunction( #LIB_OPENB3D, "LightConeAngles" )
Prototype OB3D_LightRange( *light, range.f ) : Global OB3D_LightRange.OB3D_LightRange = GetFunction( #LIB_OPENB3D, "LightRange" )
Prototype.i OB3D_LinePick( x.f, y.f, z.f, dx.f, dy.f, dz.f, radius.f = 0 ) : Global OB3D_LinePick.OB3D_LinePick = GetFunction( #LIB_OPENB3D, "LinePick" )
Prototype.i OB3D_LoadAnimMesh( file.p-ascii, *parent = 0 ) : Global OB3D_LoadAnimMesh.OB3D_LoadAnimMesh = GetFunction( #LIB_OPENB3D, "LoadAnimMesh" )
Prototype.l OB3D_LoadAnimSeq( *ent, name.p-ascii ) : Global OB3D_LoadAnimSeq.OB3D_LoadAnimSeq = GetFunction( #LIB_OPENB3D, "LoadAnimSeq" )
Prototype.i OB3D_LoadAnimTexture( file.p-ascii, flags.l, frame_width.l, frame_height.l, first_frame.l, frame_count.l ) : Global OB3D_LoadAnimTexture.OB3D_LoadAnimTexture = GetFunction( #LIB_OPENB3D, "LoadAnimTexture" )
Prototype.i OB3D_LoadBrush( file.p-ascii, flags.l = 1, u_scale.f = 1, v_scale.f = 1 ) : Global OB3D_LoadBrush.OB3D_LoadBrush = GetFunction( #LIB_OPENB3D, "LoadBrush" )
Prototype.i OB3D_LoadGeosphere( file.p-ascii, *parent = 0 ) : Global OB3D_LoadGeosphere.OB3D_LoadGeosphere = GetFunction( #LIB_OPENB3D, "LoadGeosphere" )
Prototype.i OB3D_LoadMesh( file.p-ascii, *parent = 0 ) : Global OB3D_LoadMesh.OB3D_LoadMesh = GetFunction( #LIB_OPENB3D, "LoadMesh" )
Prototype.i OB3D_LoadTerrain( file.p-ascii, *parent = 0 ) : Global OB3D_LoadTerrain.OB3D_LoadTerrain = GetFunction( #LIB_OPENB3D, "LoadTerrain" )
Prototype.i OB3D_LoadTexture( file.p-ascii, flags.l = 1 ) : Global OB3D_LoadTexture.OB3D_LoadTexture = GetFunction( #LIB_OPENB3D, "LoadTexture" )
Prototype.i OB3D_LoadSprite( tex_file.p-ascii, tex_flag.l = 1, *parent = 0 ) : Global OB3D_LoadSprite.OB3D_LoadSprite = GetFunction( #LIB_OPENB3D, "LoadSprite" )
Prototype.i OB3D_MeshCSG( *m1, *m2, method.l = 1 ) : Global OB3D_MeshCSG.OB3D_MeshCSG = GetFunction( #LIB_OPENB3D, "MeshCSG" )
Prototype.f OB3D_MeshDepth( *mesh ) : Global OB3D_MeshDepth.OB3D_MeshDepth = GetFunction( #LIB_OPENB3D, "MeshDepth" )
Prototype.i OB3D_MeshesIntersect( *mesh1, *mesh2 ) : Global OB3D_MeshesIntersect.OB3D_MeshesIntersect = GetFunction( #LIB_OPENB3D, "MeshesIntersect" )
Prototype.f OB3D_MeshHeight( *mesh ) : Global OB3D_MeshHeight.OB3D_MeshHeight = GetFunction( #LIB_OPENB3D, "MeshHeight" )
Prototype.f OB3D_MeshWidth( *mesh ) : Global OB3D_MeshWidth.OB3D_MeshWidth = GetFunction( #LIB_OPENB3D, "MeshWidth" )
Prototype OB3D_ModifyGeosphere( *geo, x.l, z.l, height.f ) : Global OB3D_ModifyGeosphere.OB3D_ModifyGeosphere = GetFunction( #LIB_OPENB3D, "ModifyGeosphere" )
Prototype OB3D_ModifyTerrain( *terr, x.l, z.l, height.f ) : Global OB3D_ModifyTerrain.OB3D_ModifyTerrain = GetFunction( #LIB_OPENB3D, "ModifyTerrain" )
Prototype OB3D_MoveEntity( *ent, x.f, y.f, z.f ) : Global OB3D_MoveEntity.OB3D_MoveEntity = GetFunction( #LIB_OPENB3D, "MoveEntity" )
Prototype OB3D_NameEntity( *ent, name.p-ascii ) : Global OB3D_NameEntity.OB3D_NameEntity = GetFunction( #LIB_OPENB3D, "NameEntity" )
Prototype OB3D_NameTexture( *tex, name.p-ascii ) : Global OB3D_NameTexture.OB3D_NameTexture = GetFunction( #LIB_OPENB3D, "NameTexture" )
Prototype OB3D_OctreeMesh( *octree, *mesh, level.l, x.f, y.f, z.f, near.f = 0, far.f = 1000 ) : Global OB3D_OctreeMesh.OB3D_OctreeMesh = GetFunction( #LIB_OPENB3D, "OctreeMesh" )
Prototype OB3D_OctreeBlock( *octree, *mesh, level.l, x.f, y.f, z.f, near.f = 0, far.f = 1000 ) : Global OB3D_OctreeBlock.OB3D_OctreeBlock = GetFunction( #LIB_OPENB3D, "OctreeBlock" )
Prototype OB3D_PaintEntity( *ent, *brush ) : Global OB3D_PaintEntity.OB3D_PaintEntity = GetFunction( #LIB_OPENB3D, "PaintEntity" )
Prototype OB3D_PaintMesh( *mesh, *brush ) : Global OB3D_PaintMesh.OB3D_PaintMesh = GetFunction( #LIB_OPENB3D, "PaintMesh" )
Prototype OB3D_PaintSurface( *surf, *brush ) : Global OB3D_PaintSurface.OB3D_PaintSurface = GetFunction( #LIB_OPENB3D, "PaintSurface" )
Prototype OB3D_ParticleColor( *sprite, r.f, g.f, b.f, a.f = 0 ) : Global OB3D_ParticleColor.OB3D_ParticleColor = GetFunction( #LIB_OPENB3D, "ParticleColor" )
Prototype OB3D_ParticleVector( *sprite, x.f, y.f, z.f ) : Global OB3D_ParticleVector.OB3D_ParticleVector = GetFunction( #LIB_OPENB3D, "ParticleVector" )
Prototype OB3D_ParticleTrail( *sprite, length.l ) : Global OB3D_ParticleTrail.OB3D_ParticleTrail = GetFunction( #LIB_OPENB3D, "ParticleTrail" )
Prototype.i OB3D_PickedEntity() : Global OB3D_PickedEntity.OB3D_PickedEntity = GetFunction( #LIB_OPENB3D, "PickedEntity" )
Prototype.f OB3D_PickedNX() : Global OB3D_PickedNX.OB3D_PickedNX = GetFunction( #LIB_OPENB3D, "PickedNX" )
Prototype.f OB3D_PickedNY() : Global OB3D_PickedNY.OB3D_PickedNY = GetFunction( #LIB_OPENB3D, "PickedNY" )
Prototype.f OB3D_PickedNZ() : Global OB3D_PickedNZ.OB3D_PickedNZ = GetFunction( #LIB_OPENB3D, "PickedNZ" )
Prototype.i OB3D_PickedSurface() : Global OB3D_PickedSurface.OB3D_PickedSurface = GetFunction( #LIB_OPENB3D, "PickedSurface" )
Prototype.f OB3D_PickedTime() : Global OB3D_PickedTime.OB3D_PickedTime = GetFunction( #LIB_OPENB3D, "PickedTime" )
Prototype.l OB3D_PickedTriangle() : Global OB3D_PickedTriangle.OB3D_PickedTriangle = GetFunction( #LIB_OPENB3D, "PickedTriangle" )
Prototype.f OB3D_PickedX() : Global OB3D_PickedX.OB3D_PickedX = GetFunction( #LIB_OPENB3D, "PickedX" )
Prototype.f OB3D_PickedY() : Global OB3D_PickedY.OB3D_PickedY = GetFunction( #LIB_OPENB3D, "PickedY" )
Prototype.f OB3D_PickedZ() : Global OB3D_PickedZ.OB3D_PickedZ = GetFunction( #LIB_OPENB3D, "PickedZ" )
Prototype OB3D_PointEntity( *ent, *target_ent, roll.f = 0 ) : Global OB3D_PointEntity.OB3D_PointEntity = GetFunction( #LIB_OPENB3D, "PointEntity" )
Prototype OB3D_PositionEntity( *ent, x.f, y.f, z.f, glob.l = 0 ) : Global OB3D_PositionEntity.OB3D_PositionEntity = GetFunction( #LIB_OPENB3D, "PositionEntity" )
Prototype OB3D_PositionMesh( *mesh, px.f, py.f, pz.f ) : Global OB3D_PositionMesh.OB3D_PositionMesh = GetFunction( #LIB_OPENB3D, "PositionMesh" )
Prototype OB3D_PositionTexture( *tex, u_pos.f, v_pos.f ) : Global OB3D_PositionTexture.OB3D_PositionTexture = GetFunction( #LIB_OPENB3D, "PositionTexture" )
Prototype.f OB3D_ProjectedX() : Global OB3D_ProjectedX.OB3D_ProjectedX = GetFunction( #LIB_OPENB3D, "ProjectedX" )
Prototype.f OB3D_ProjectedY() : Global OB3D_ProjectedY.OB3D_ProjectedY = GetFunction( #LIB_OPENB3D, "ProjectedY" )
Prototype.f OB3D_ProjectedZ() : Global OB3D_ProjectedZ.OB3D_ProjectedZ = GetFunction( #LIB_OPENB3D, "ProjectedZ" )
Prototype OB3D_RenderWorld() : Global OB3D_RenderWorld.OB3D_RenderWorld = GetFunction( #LIB_OPENB3D, "RenderWorld" )
Prototype.i OB3D_RepeatMesh( *mesh, *parent = 0 ) : Global OB3D_RepeatMesh.OB3D_RepeatMesh = GetFunction( #LIB_OPENB3D, "RepeatMesh" )
Prototype OB3D_ResetEntity( *ent ) : Global OB3D_ResetEntity.OB3D_ResetEntity = GetFunction( #LIB_OPENB3D, "ResetEntity" )
Prototype OB3D_ResetShadow( *s ) : Global OB3D_ResetShadow.OB3D_ResetShadow = GetFunction( #LIB_OPENB3D, "ResetShadow" )
Prototype OB3D_RotateEntity( *ent, x.f, y.f, z.f, glob.l = 0 ) : Global OB3D_RotateEntity.OB3D_RotateEntity = GetFunction( #LIB_OPENB3D, "RotateEntity" )
Prototype OB3D_RotateMesh( *mesh, pitch.f, yaw.f, roll.f ) : Global OB3D_RotateMesh.OB3D_RotateMesh = GetFunction( #LIB_OPENB3D, "RotateMesh" )
Prototype OB3D_RotateSprite( *sprite, ang.f ) : Global OB3D_RotateSprite.OB3D_RotateSprite = GetFunction( #LIB_OPENB3D, "RotateSprite" )
Prototype OB3D_RotateTexture( *tex, ang.f ) : Global OB3D_RotateTexture.OB3D_RotateTexture = GetFunction( #LIB_OPENB3D, "RotateTexture" )
Prototype OB3D_ScaleEntity( *ent, x.f, y.f, z.f, glob.l = 0 ) : Global OB3D_ScaleEntity.OB3D_ScaleEntity = GetFunction( #LIB_OPENB3D, "ScaleEntity" )
Prototype OB3D_ScaleMesh( *mesh, sx.f, sy.f, sz.f ) : Global OB3D_ScaleMesh.OB3D_ScaleMesh = GetFunction( #LIB_OPENB3D, "ScaleMesh" )
Prototype OB3D_ScaleSprite( *sprite, s_x.f, s_y.f ) : Global OB3D_ScaleSprite.OB3D_ScaleSprite = GetFunction( #LIB_OPENB3D, "ScaleSprite" )
Prototype OB3D_ScaleTexture( *tex, u_scale.f, v_scale.f ) : Global OB3D_ScaleTexture.OB3D_ScaleTexture = GetFunction( #LIB_OPENB3D, "ScaleTexture" )
Prototype OB3D_SetAnimKey( *ent, frame.f, pos_key.l = 1, rot_key.l = 1, scale_key.l = 1 ) : Global OB3D_SetAnimKey.OB3D_SetAnimKey = GetFunction( #LIB_OPENB3D, "SetAnimKey" )
Prototype OB3D_SetAnimTime( *ent, time.f, seq.l = 0 ) : Global OB3D_SetAnimTime.OB3D_SetAnimTime = GetFunction( #LIB_OPENB3D, "SetAnimTime" )
Prototype OB3D_SetCubeFace( *tex, face.l ) : Global OB3D_SetCubeFace.OB3D_SetCubeFace = GetFunction( #LIB_OPENB3D, "SetCubeFace" )
Prototype OB3D_SetCubeMode( *tex, mode.l ) : Global OB3D_SetCubeMode.OB3D_SetCubeMode = GetFunction( #LIB_OPENB3D, "SetCubeMode" )
Prototype OB3D_ShowEntity( *ent ) : Global OB3D_ShowEntity.OB3D_ShowEntity = GetFunction( #LIB_OPENB3D, "ShowEntity" )
Prototype OB3D_SkinMesh( *mesh, surf_no.l, vid.l, bone1.l, weight1.f = 1.0, bone2.l = 0, weight2.f = 0, bone3.l = 0, weight3.f = 0, bone4.l = 0, weight4.f = 0 ) : Global OB3D_SkinMesh.OB3D_SkinMesh = GetFunction( #LIB_OPENB3D, "SkinMesh" )
Prototype OB3D_SpriteRenderMode( *sprite, mode.l ) : Global OB3D_SpriteRenderMode.OB3D_SpriteRenderMode = GetFunction( #LIB_OPENB3D, "SpriteRenderMode" )
Prototype OB3D_SpriteViewMode( *sprite, mode.l ) : Global OB3D_SpriteViewMode.OB3D_SpriteViewMode = GetFunction( #LIB_OPENB3D, "SpriteViewMode" )
Prototype OB3D_StencilAlpha( *stencil, a.f ) : Global OB3D_StencilAlpha.OB3D_StencilAlpha = GetFunction( #LIB_OPENB3D, "StencilAlpha" )
Prototype OB3D_StencilClsColor( *stencil, r.f, g.f, b.f ) : Global OB3D_StencilClsColor.OB3D_StencilClsColor = GetFunction( #LIB_OPENB3D, "StencilClsColor" )
Prototype OB3D_StencilClsMode( *stencil, cls_depth.l, cls_zbuffer.l ) : Global OB3D_StencilClsMode.OB3D_StencilClsMode = GetFunction( #LIB_OPENB3D, "StencilClsMode" )
Prototype OB3D_StencilMesh( *stencil, *mesh, mode.l = 1 ) : Global OB3D_StencilMesh.OB3D_StencilMesh = GetFunction( #LIB_OPENB3D, "StencilMesh" )
Prototype OB3D_StencilMode( *stencil, m.l, o.l = 1 ) : Global OB3D_StencilMode.OB3D_StencilMode = GetFunction( #LIB_OPENB3D, "StencilMode" )
Prototype OB3D_TextureBlend( *tex, blend.l ) : Global OB3D_TextureBlend.OB3D_TextureBlend = GetFunction( #LIB_OPENB3D, "TextureBlend" )
Prototype OB3D_TextureCoords( *tex, coords.l ) : Global OB3D_TextureCoords.OB3D_TextureCoords = GetFunction( #LIB_OPENB3D, "TextureCoords" )
Prototype.l OB3D_TextureHeight( *tex ) : Global OB3D_TextureHeight.OB3D_TextureHeight = GetFunction( #LIB_OPENB3D, "TextureHeight" )
Prototype OB3D_TextureFilter( match_text.p-ascii, flags.l ) : Global OB3D_TextureFilter.OB3D_TextureFilter = GetFunction( #LIB_OPENB3D, "TextureFilter" )
Prototype.s OB3D_TextureName( *tex ) : Global OB3D_TextureName.OB3D_TextureName = GetFunction( #LIB_OPENB3D, "TextureName" )
Prototype.f OB3D_TerrainHeight( *terr, x.l, z.l ) : Global OB3D_TerrainHeight.OB3D_TerrainHeight = GetFunction( #LIB_OPENB3D, "TerrainHeight" )
Prototype.f OB3D_TerrainX( *terr, x.f, y.f, z.f ) : Global OB3D_TerrainX.OB3D_TerrainX = GetFunction( #LIB_OPENB3D, "TerrainX" )
Prototype.f OB3D_TerrainY( *terr, x.f, y.f, z.f ) : Global OB3D_TerrainY.OB3D_TerrainY = GetFunction( #LIB_OPENB3D, "TerrainY" )
Prototype.f OB3D_TerrainZ( *terr, x.f, y.f, z.f ) : Global OB3D_TerrainZ.OB3D_TerrainZ = GetFunction( #LIB_OPENB3D, "TerrainZ" )
Prototype.l OB3D_TextureWidth( *tex ) : Global OB3D_TextureWidth.OB3D_TextureWidth = GetFunction( #LIB_OPENB3D, "TextureWidth" )
Prototype.f OB3D_TFormedX() : Global OB3D_TFormedX.OB3D_TFormedX = GetFunction( #LIB_OPENB3D, "TFormedX" )
Prototype.f OB3D_TFormedY() : Global OB3D_TFormedY.OB3D_TFormedY = GetFunction( #LIB_OPENB3D, "TFormedY" )
Prototype.f OB3D_TFormedZ() : Global OB3D_TFormedZ.OB3D_TFormedZ = GetFunction( #LIB_OPENB3D, "TFormedZ" )
Prototype OB3D_TFormNormal( x.f, y.f, z.f, *src_ent, *dest_ent ) : Global OB3D_TFormNormal.OB3D_TFormNormal = GetFunction( #LIB_OPENB3D, "TFormNormal" )
Prototype OB3D_TFormPoint( x.f, y.f, z.f, *src_ent, *dest_ent ) : Global OB3D_TFormPoint.OB3D_TFormPoint = GetFunction( #LIB_OPENB3D, "TFormPoint" )
Prototype OB3D_TFormVector( x.f, y.f, z.f, *src_ent, *dest_ent ) : Global OB3D_TFormVector.OB3D_TFormVector = GetFunction( #LIB_OPENB3D, "TFormVector" )
Prototype OB3D_TranslateEntity( *ent, x.f, y.f, z.f, glob.l = 0 ) : Global OB3D_TranslateEntity.OB3D_TranslateEntity = GetFunction( #LIB_OPENB3D, "TranslateEntity" )
Prototype.l OB3D_TriangleVertex( *surf, tri_no.l, corner.l ) : Global OB3D_TriangleVertex.OB3D_TriangleVertex = GetFunction( #LIB_OPENB3D, "TriangleVertex" )
Prototype OB3D_TurnEntity( *ent, x.f, y.f, z.f, glob.l = 0 ) : Global OB3D_TurnEntity.OB3D_TurnEntity = GetFunction( #LIB_OPENB3D, "TurnEntity" )
Prototype OB3D_UpdateNormals( *mesh ) : Global OB3D_UpdateNormals.OB3D_UpdateNormals = GetFunction( #LIB_OPENB3D, "UpdateNormals" )
Prototype OB3D_UpdateTexCoords( *surf ) : Global OB3D_UpdateTexCoords.OB3D_UpdateTexCoords = GetFunction( #LIB_OPENB3D, "UpdateTexCoords" )
Prototype OB3D_UpdateWorld( anim_speed.f = 1 ) : Global OB3D_UpdateWorld.OB3D_UpdateWorld = GetFunction( #LIB_OPENB3D, "UpdateWorld" )
Prototype OB3D_UseStencil( *stencil ) : Global OB3D_UseStencil.OB3D_UseStencil = GetFunction( #LIB_OPENB3D, "UseStencil" )
Prototype.f OB3D_VectorPitch( vx.f, vy.f, vz.f ) : Global OB3D_VectorPitch.OB3D_VectorPitch = GetFunction( #LIB_OPENB3D, "VectorPitch" )
Prototype.f OB3D_VectorYaw( vx.f, vy.f, vz.f ) : Global OB3D_VectorYaw.OB3D_VectorYaw = GetFunction( #LIB_OPENB3D, "VectorYaw" )
Prototype.f OB3D_VertexAlpha( *surf, vid.l ) : Global OB3D_VertexAlpha.OB3D_VertexAlpha = GetFunction( #LIB_OPENB3D, "VertexAlpha" )
Prototype.f OB3D_VertexBlue( *surf, vid.l ) : Global OB3D_VertexBlue.OB3D_VertexBlue = GetFunction( #LIB_OPENB3D, "VertexBlue" )
Prototype OB3D_VertexColor( *surf, vid.l, r.f, g.f, b.f, a.f = 1 ) : Global OB3D_VertexColor.OB3D_VertexColor = GetFunction( #LIB_OPENB3D, "VertexColor" )
Prototype OB3D_VertexCoords( *surf, vid.l, x.f, y.f, z.f ) : Global OB3D_VertexCoords.OB3D_VertexCoords = GetFunction( #LIB_OPENB3D, "VertexCoords" )
Prototype.f OB3D_VertexGreen( *surf, vid.l ) : Global OB3D_VertexGreen.OB3D_VertexGreen = GetFunction( #LIB_OPENB3D, "VertexGreen" )
Prototype OB3D_VertexNormal( *surf, vid.l, nx.f, ny.f, nz.f ) : Global OB3D_VertexNormal.OB3D_VertexNormal = GetFunction( #LIB_OPENB3D, "VertexNormal" )
Prototype.f OB3D_VertexNX( *surf, vid.l ) : Global OB3D_VertexNX.OB3D_VertexNX = GetFunction( #LIB_OPENB3D, "VertexNX" )
Prototype.f OB3D_VertexNY( *surf, vid.l ) : Global OB3D_VertexNY.OB3D_VertexNY = GetFunction( #LIB_OPENB3D, "VertexNY" )
Prototype.f OB3D_VertexNZ( *surf, vid.l ) : Global OB3D_VertexNZ.OB3D_VertexNZ = GetFunction( #LIB_OPENB3D, "VertexNZ" )
Prototype.f OB3D_VertexRed( *surf, vid.l ) : Global OB3D_VertexRed.OB3D_VertexRed = GetFunction( #LIB_OPENB3D, "VertexRed" )
Prototype OB3D_VertexTexCoords( *surf, vid.l, u.f, v.f, w.f = 0, coord_set.l = 0 ) : Global OB3D_VertexTexCoords.OB3D_VertexTexCoords = GetFunction( #LIB_OPENB3D, "VertexTexCoords" )
Prototype.f OB3D_VertexU( *surf, vid.l, coord_set.l = 0 ) : Global OB3D_VertexU.OB3D_VertexU = GetFunction( #LIB_OPENB3D, "VertexU" )
Prototype.f OB3D_VertexV( *surf, vid.l, coord_set.l = 0 ) : Global OB3D_VertexV.OB3D_VertexV = GetFunction( #LIB_OPENB3D, "VertexV" )
Prototype.f OB3D_VertexW( *surf, vid.l, coord_set.l = 0 ) : Global OB3D_VertexW.OB3D_VertexW = GetFunction( #LIB_OPENB3D, "VertexW" )
Prototype.f OB3D_VertexX( *surf, vid.l ) : Global OB3D_VertexX.OB3D_VertexX = GetFunction( #LIB_OPENB3D, "VertexX" )
Prototype.f OB3D_VertexY( *surf, vid.l ) : Global OB3D_VertexY.OB3D_VertexY = GetFunction( #LIB_OPENB3D, "VertexY" )
Prototype.f OB3D_VertexZ( *surf, vid.l ) : Global OB3D_VertexZ.OB3D_VertexZ = GetFunction( #LIB_OPENB3D, "VertexZ" )
Prototype OB3D_Wireframe( enable.l ) : Global OB3D_Wireframe.OB3D_Wireframe = GetFunction( #LIB_OPENB3D, "Wireframe" )
Prototype.f OB3D_EntityScaleX( *ent, glob.l = 0 ) : Global OB3D_EntityScaleX.OB3D_EntityScaleX = GetFunction( #LIB_OPENB3D, "EntityScaleX" )
Prototype.f OB3D_EntityScaleY( *ent, glob.l = 0 ) : Global OB3D_EntityScaleY.OB3D_EntityScaleY = GetFunction( #LIB_OPENB3D, "EntityScaleY" )
Prototype.f OB3D_EntityScaleZ( *ent, glob.l = 0 ) : Global OB3D_EntityScaleZ.OB3D_EntityScaleZ = GetFunction( #LIB_OPENB3D, "EntityScaleZ" )
Prototype.i OB3D_LoadShader( shadername.p-ascii, vfile.p-ascii, ffile.p-ascii ) : Global OB3D_LoadShader.OB3D_LoadShader = GetFunction( #LIB_OPENB3D, "LoadShader" )
Prototype.i OB3D_CreateShader( shader.p-ascii, vstring.p-ascii, fstring.p-ascii ) : Global OB3D_CreateShader.OB3D_CreateShader = GetFunction( #LIB_OPENB3D, "CreateShader" )
Prototype.i OB3D_LoadShaderVGF( shadername.p-ascii, vfile.p-ascii, gfile.p-ascii, ffile.p-ascii ) : Global OB3D_LoadShaderVGF.OB3D_LoadShaderVGF = GetFunction( #LIB_OPENB3D, "LoadShaderVGF" )
Prototype.i OB3D_CreateShaderVGF( shader.p-ascii, vstring.p-ascii, gstring.p-ascii, fstring.p-ascii ) : Global OB3D_CreateShaderVGF.OB3D_CreateShaderVGF = GetFunction( #LIB_OPENB3D, "CreateShaderVGF" )
Prototype OB3D_ShadeMesh( *mesh, *material ) : Global OB3D_ShadeMesh.OB3D_ShadeMesh = GetFunction( #LIB_OPENB3D, "ShadeMesh" )
Prototype OB3D_ShadeSurface( *surf, *material ) : Global OB3D_ShadeSurface.OB3D_ShadeSurface = GetFunction( #LIB_OPENB3D, "ShadeSurface" )
Prototype OB3D_ShadeEntity( *ent, *material ) : Global OB3D_ShadeEntity.OB3D_ShadeEntity = GetFunction( #LIB_OPENB3D, "ShadeEntity" )
Prototype OB3D_ShaderTexture( *material, *tex, name.p-ascii, index.l = 0 ) : Global OB3D_ShaderTexture.OB3D_ShaderTexture = GetFunction( #LIB_OPENB3D, "ShaderTexture" )
Prototype OB3D_SetFloat( *material, name.p-ascii, v1.f ) : Global OB3D_SetFloat.OB3D_SetFloat = GetFunction( #LIB_OPENB3D, "SetFloat" )
Prototype OB3D_SetFloat2( *material, name.p-ascii, v1.f, v2.f ) : Global OB3D_SetFloat2.OB3D_SetFloat2 = GetFunction( #LIB_OPENB3D, "SetFloat2" )
Prototype OB3D_SetFloat3( *material, name.p-ascii, v1.f, v2.f, v3.f ) : Global OB3D_SetFloat3.OB3D_SetFloat3 = GetFunction( #LIB_OPENB3D, "SetFloat3" )
Prototype OB3D_SetFloat4( *material, name.p-ascii, v1.f, v2.f, v3.f, v4.f ) : Global OB3D_SetFloat4.OB3D_SetFloat4 = GetFunction( #LIB_OPENB3D, "SetFloat4" )
Prototype OB3D_UseFloat( *material, name.p-ascii, *v1 ) : Global OB3D_UseFloat.OB3D_UseFloat = GetFunction( #LIB_OPENB3D, "UseFloat" )
Prototype OB3D_UseFloat2( *material, name.p-ascii, *v1, *v2 ) : Global OB3D_UseFloat2.OB3D_UseFloat2 = GetFunction( #LIB_OPENB3D, "UseFloat2" )
Prototype OB3D_UseFloat3( *material, name.p-ascii, *v1, *v2, *v3 ) : Global OB3D_UseFloat3.OB3D_UseFloat3 = GetFunction( #LIB_OPENB3D, "UseFloat3" )
Prototype OB3D_UseFloat4( *material, name.p-ascii, *v1, *v2, *v3, *v4 ) : Global OB3D_UseFloat4.OB3D_UseFloat4 = GetFunction( #LIB_OPENB3D, "UseFloat4" )
Prototype OB3D_SetInteger( *material, name.p-ascii, v1.l ) : Global OB3D_SetInteger.OB3D_SetInteger = GetFunction( #LIB_OPENB3D, "SetInteger" )
Prototype OB3D_SetInteger2( *material, name.p-ascii, v1.l, v2.l ) : Global OB3D_SetInteger2.OB3D_SetInteger2 = GetFunction( #LIB_OPENB3D, "SetInteger2" )
Prototype OB3D_SetInteger3( *material, name.p-ascii, v1.l, v2.l, v3.l ) : Global OB3D_SetInteger3.OB3D_SetInteger3 = GetFunction( #LIB_OPENB3D, "SetInteger3" )
Prototype OB3D_SetInteger4( *material, name.p-ascii, v1.l, v2.l, v3.l, v4.l ) : Global OB3D_SetInteger4.OB3D_SetInteger4 = GetFunction( #LIB_OPENB3D, "SetInteger4" )
Prototype OB3D_UseInteger( *material, name.p-ascii, *v1 ) : Global OB3D_UseInteger.OB3D_UseInteger = GetFunction( #LIB_OPENB3D, "UseInteger" )
Prototype OB3D_UseInteger2( *material, name.p-ascii, *v1, *v2 ) : Global OB3D_UseInteger2.OB3D_UseInteger2 = GetFunction( #LIB_OPENB3D, "UseInteger2" )
Prototype OB3D_UseInteger3( *material, name.p-ascii, *v1, *v2, *v3 ) : Global OB3D_UseInteger3.OB3D_UseInteger3 = GetFunction( #LIB_OPENB3D, "UseInteger3" )
Prototype OB3D_UseInteger4( *material, name.p-ascii, *v1, *v2, *v3, *v4 ) : Global OB3D_UseInteger4.OB3D_UseInteger4 = GetFunction( #LIB_OPENB3D, "UseInteger4" )
Prototype.i OB3D_LoadMaterial( file.p-ascii, flags.l, frame_width.l, frame_height.l, first_frame.l, frame_count.l ) : Global OB3D_LoadMaterial.OB3D_LoadMaterial = GetFunction( #LIB_OPENB3D, "LoadMaterial" )
Prototype OB3D_ShaderMaterial( *material, *tex, name.p-ascii, index.l = 0 ) : Global OB3D_ShaderMaterial.OB3D_ShaderMaterial = GetFunction( #LIB_OPENB3D, "ShaderMaterial" )
Prototype OB3D_UseSurface( *material, name.p-ascii, *surf, vbo.l ) : Global OB3D_UseSurface.OB3D_UseSurface = GetFunction( #LIB_OPENB3D, "UseSurface" )
Prototype OB3D_UseMatrix( *material, name.p-ascii, mode.l ) : Global OB3D_UseMatrix.OB3D_UseMatrix = GetFunction( #LIB_OPENB3D, "UseMatrix" )
Prototype OB3D_UseEntity( *material, name.p-ascii, *ent, mode.l ) : Global OB3D_UseEntity.OB3D_UseEntity = GetFunction( #LIB_OPENB3D, "UseEntity" )
Prototype OB3D_ShaderFunction( *material, *functionenable, *functiondisable ) : Global OB3D_ShaderFunction.OB3D_ShaderFunction = GetFunction( #LIB_OPENB3D, "ShaderFunction" )
Prototype OB3D_DepthBufferToTex( *tex, *cam = 0 ) : Global OB3D_DepthBufferToTex.OB3D_DepthBufferToTex = GetFunction( #LIB_OPENB3D, "DepthBufferToTex" )
Prototype.i OB3D_CreateVoxelSprite( slices.l = 64, *parent = 0 ) : Global OB3D_CreateVoxelSprite.OB3D_CreateVoxelSprite = GetFunction( #LIB_OPENB3D, "CreateVoxelSprite" )
Prototype OB3D_VoxelSpriteMaterial( *voxelspr, *mat ) : Global OB3D_VoxelSpriteMaterial.OB3D_VoxelSpriteMaterial = GetFunction( #LIB_OPENB3D, "VoxelSpriteMaterial" )
Prototype.i OB3D_CreateParticleEmitter( *particle, *parent = 0 ) : Global OB3D_CreateParticleEmitter.OB3D_CreateParticleEmitter = GetFunction( #LIB_OPENB3D, "CreateParticleEmitter" )
Prototype OB3D_EmitterVector( *emit, x.f, y.f, z.f ) : Global OB3D_EmitterVector.OB3D_EmitterVector = GetFunction( #LIB_OPENB3D, "EmitterVector" )
Prototype OB3D_EmitterRate( *emit, r.f ) : Global OB3D_EmitterRate.OB3D_EmitterRate = GetFunction( #LIB_OPENB3D, "EmitterRate" )
Prototype OB3D_EmitterVariance( *emit, v.f ) : Global OB3D_EmitterVariance.OB3D_EmitterVariance = GetFunction( #LIB_OPENB3D, "EmitterVariance" )
Prototype OB3D_EmitterParticleLife( *emit, l.l ) : Global OB3D_EmitterParticleLife.OB3D_EmitterParticleLife = GetFunction( #LIB_OPENB3D, "EmitterParticleLife" )
Prototype OB3D_EmitterParticleSpeed( *emit, s.f ) : Global OB3D_EmitterParticleSpeed.OB3D_EmitterParticleSpeed = GetFunction( #LIB_OPENB3D, "EmitterParticleSpeed" )
Prototype OB3D_EmitterParticleFunction( *emitter, *EmiterFunction ) : Global OB3D_EmitterParticleFunction.OB3D_EmitterParticleFunction = GetFunction( #LIB_OPENB3D, "EmitterParticleFunction" )
Prototype.i OB3D_ActMoveBy( *ent, a.f, b.f, c.f, r.f ) : Global OB3D_ActMoveBy.OB3D_ActMoveBy = GetFunction( #LIB_OPENB3D, "ActMoveBy" )
Prototype.i OB3D_ActTurnBy( *ent, a.f, b.f, c.f, r.f ) : Global OB3D_ActTurnBy.OB3D_ActTurnBy = GetFunction( #LIB_OPENB3D, "ActTurnBy" )
Prototype.i OB3D_ActVector( *ent, a.f, b.f, c.f ) : Global OB3D_ActVector.OB3D_ActVector = GetFunction( #LIB_OPENB3D, "ActVector" )
Prototype.i OB3D_ActMoveTo( *ent, a.f, b.f, c.f, r.f ) : Global OB3D_ActMoveTo.OB3D_ActMoveTo = GetFunction( #LIB_OPENB3D, "ActMoveTo" )
Prototype.i OB3D_ActTurnTo( *ent, a.f, b.f, c.f, r.f ) : Global OB3D_ActTurnTo.OB3D_ActTurnTo = GetFunction( #LIB_OPENB3D, "ActTurnTo" )
Prototype.i OB3D_ActScaleTo( *ent, a.f, b.f, c.f, r.f ) : Global OB3D_ActScaleTo.OB3D_ActScaleTo = GetFunction( #LIB_OPENB3D, "ActScaleTo" )
Prototype.i OB3D_ActFadeTo( *ent, a.f, r.f ) : Global OB3D_ActFadeTo.OB3D_ActFadeTo = GetFunction( #LIB_OPENB3D, "ActFadeTo" )
Prototype.i OB3D_ActTintBy( *ent, a.f, b.f, c.f, r.f ) : Global OB3D_ActTintBy.OB3D_ActTintBy = GetFunction( #LIB_OPENB3D, "ActTintBy" )
Prototype.i OB3D_ActTrackByPoint( *ent, *t, a.f, b.f, c.f, r.f ) : Global OB3D_ActTrackByPoint.OB3D_ActTrackByPoint = GetFunction( #LIB_OPENB3D, "ActTrackByPoint" )
Prototype.i OB3D_ActTrackByDistance( *ent, *t, a.f, r.f ) : Global OB3D_ActTrackByDistance.OB3D_ActTrackByDistance = GetFunction( #LIB_OPENB3D, "ActTrackByDistance" )
Prototype.i OB3D_ActNewtonian( *ent, r.f ) : Global OB3D_ActNewtonian.OB3D_ActNewtonian = GetFunction( #LIB_OPENB3D, "ActNewtonian" )
Prototype OB3D_AppendAction( *act1, *act2 ) : Global OB3D_AppendAction.OB3D_AppendAction = GetFunction( #LIB_OPENB3D, "AppendAction" )
Prototype.i OB3D_CreatePostFX( *camera, passes.l = 1 ) : Global OB3D_CreatePostFX.OB3D_CreatePostFX = GetFunction( #LIB_OPENB3D, "CreatePostFX" )
Prototype OB3D_AddRenderTarget( *fx, pass_no.l, numcolbufs.l, depth.l, format.l = 8, scale.f = 1.0 ) : Global OB3D_AddRenderTarget.OB3D_AddRenderTarget = GetFunction( #LIB_OPENB3D, "AddRenderTarget" )
Prototype OB3D_PostFXShader( *fx, pass_no.l, *shader ) : Global OB3D_PostFXShader.OB3D_PostFXShader = GetFunction( #LIB_OPENB3D, "PostFXShader" )
Prototype OB3D_PostFXShaderPass( *fx, pass_no.l, name.p-ascii, v.l ) : Global OB3D_PostFXShaderPass.OB3D_PostFXShaderPass = GetFunction( #LIB_OPENB3D, "PostFXShaderPass" )
Prototype OB3D_PostFXBuffer( *fx, pass_no.l, source_pass.l, index.l, slot.l ) : Global OB3D_PostFXBuffer.OB3D_PostFXBuffer = GetFunction( #LIB_OPENB3D, "PostFXBuffer" )
Prototype OB3D_PostFXTexture( *fx, pass_no.l, *tex, slot.l, frame.l = 0 ) : Global OB3D_PostFXTexture.OB3D_PostFXTexture = GetFunction( #LIB_OPENB3D, "PostFXTexture" )
Prototype OB3D_PostFXFunction( *fx, pass_no.l, *fxfunction ) : Global OB3D_PostFXFunction.OB3D_PostFXFunction = GetFunction( #LIB_OPENB3D, "PostFXFunction" )




; === DEMO ===
#MAIN_WINDOW = 0
#OPENGL_SCREEN = 0
#PREVIEW_SIZE = 1000
#Menu_Event_CloseWindow = 0

OpenWindow( #MAIN_WINDOW, 0, 0, #PREVIEW_SIZE, #PREVIEW_SIZE, "Test Window" )

;OpenWindowedScreen( WindowID( #MAIN_WINDOW ), 0, 0, #PREVIEW_SIZE, #PREVIEW_SIZE )
OpenGLGadget( #OPENGL_SCREEN, 0, 0, #PREVIEW_SIZE, #PREVIEW_SIZE )

OB3D_Graphics3D( #PREVIEW_SIZE, #PREVIEW_SIZE, 0, 2, 60 )
*camera = OB3D_CreateCamera()
OB3D_CameraClsColor( *camera, 0.0, 0.0, 255.0 )
OB3D_MoveEntity( *camera, 0.0, 0.0, -5.0 )
*light = OB3D_CreateLight()
OB3D_MoveEntity( *light, 0.0, -10.0, 0.0 )
*sphere = OB3D_CreateSphere()
OB3D_UpdateWorld()
OB3D_RenderWorld()
;FlipBuffers() ; Use for 'OpenWindowedScreen'.
SetGadgetAttribute( #OPENGL_SCREEN, #PB_OpenGL_FlipBuffers, #True ) ; Use for 'OpenGLGadget'.

AddKeyboardShortcut( #MAIN_WINDOW, #PB_Shortcut_Escape, #Menu_Event_CloseWindow )

Repeat
	Select WaitWindowEvent()
		Case #PB_Event_Menu
			If EventMenu() = #Menu_Event_CloseWindow : Break : EndIf
		Case #PB_Event_CloseWindow
			Break
		Case #PB_Event_Repaint ; Repaint the OpenB3D content, if needed.
			OB3D_RenderWorld()
			;FlipBuffers() ; Use for 'OpenWindowedScreen'.
			SetGadgetAttribute( #OPENGL_SCREEN, #PB_OpenGL_FlipBuffers, #True ) ; Use for 'OpenGLGadget'.
	EndSelect
ForEver

EndProgram()


Axeman
User
User
Posts: 89
Joined: Mon Nov 03, 2003 5:34 am

Re: OpenB3D 3D DLL framework include file for PureBasic

Post by Axeman »

Here's the code I used to convert the FreeBasic BI file.

Code: Select all


; This tool is intended to convert the FreeBasic 'openb3d.bi' declaration file for the openb3d.dll to an interface that will work with PureBasic.

; NOTES:-
; zstring - A zero-terminated ASCII (8 bit) string type. Use the 'p-ascii' psuedotype to convert it to the unicode used in PureBasic. The pseudotypes can be used for the parameters, but not for the returned value.

; The difference between 'sub' and 'function' seems to be that 'sub' doesn't return a value and 'function' does.

; The 32 bit version of the OpenB3D library seems to use the 'C' calling convention, rather than the standard call ('stdcall') convention. https://freebasic.net/forum/viewtopic.php?f=7&t=24013&p=212124
; This means that the 'PrototypeC' variant of 'Prototype' should probably be used for the 32 bit version. 64 bit computer versions should use 'stdcall', as that's all that 64 bit computers support as far as I know.


Global G_prototype_keyword.s = "Prototype" ; Use this for the 64 bit version of the openb3d.dll.
;Global G_prototype_keyword.s = "PrototypeC" ; Use this for the 32 bit version of the openb3d.dll.

; Holds the full filepath to the 'bi' file that needs to be converted.
Global G_input_filepath.s = "openb3d.bi"

; Holds the full filepath for the resulting Purebasic source code file used to declare the DLL interface prototypes.
Global G_output_filepath.s = "openb3d_interface.pb"

Global G_prototype_class_prefix.s = "OB3D_" ; An optional prefix to add to the start of the prototype class name.
Global G_prototype_var_prefix.s = "OB3D_" ; An optional prefix to add to the start of the prototype variable name.


; ---


#FILE = 0

#EOL = ~"\r\n"

Structure LINE_DATA
original_line_number.i
input_line.s
output_line.s
prototype_command.s ; This string holds the name of the command to use in the prototype code. This will be used for both the prototype class and the variable that stores the prototype function pointer.
alias_command.s ; This string holds the name of the command to use in the GetFunction 'FunctionName' parameter.
return_type.s ; This string holds the type of value returned (eg '.s' for a string type) or an empty string if no value is returned.

List ParameterList.s()
EndStructure

Global NewList InputLineList.LINE_DATA()


; Dialogs
Procedure Message( msg.s )
MessageRequester( "Message", ReplaceString( msg.s, "^", ~"\n\n" ), #PB_MessageRequester_Info )
EndProcedure

Procedure Error( msg.s )
MessageRequester( "Error", ReplaceString( msg.s, "^", ~"\n\n" ), #PB_MessageRequester_Warning )
EndProcedure

Procedure FatalError( msg.s )
MessageRequester( "Fatal Error", ReplaceString( "The program encountered a fatal error and needs to close. The error was:-^" + msg.s, "^", ~"\n\n" ), #PB_MessageRequester_Error )
End
EndProcedure

Procedure SyntaxError( msg.s, line_number, char_pos )
MessageRequester( "Syntax Error", ReplaceString( "^==========^Syntax error on source line: " + Str( line_number ) + " | Before char position: " + char_pos + "^" + msg.s, "^", ~"\n\n" ), #PB_MessageRequester_Error )
End
EndProcedure


; Procedure.s TrimWhitespace( value.s )
; 	Repeat ; Trim spaces and tabs from the start and end of the string.
; 		size = Len( value.s )
; 		value.s = Trim( Trim( value.s ), Chr( 9 ) )
; 	Until Len( value.s ) = size
; 	ProcedureReturn value.s
; EndProcedure



Procedure LoadInputFile( filepath.s )
; Loads the specified input text file and places its text lines into InputLineList().
; Lines will have leading and trailing tabs and spaces trimmed and any that don't start with 'declare' are ignored. This should eliminate all lines other than declaration lines.
; The resulting line stored in an element of InputLineList() will have the 'declare' removed from the start and will have any leading and trailing spaces and tabs trimmed from the result.
; Any error will result in a fatal error message and shutdown.

ClearList( InputLineList() )
If ReadFile( #FILE, filepath.s )
	bom = ReadStringFormat( #FILE ) ; Check for a byte order mark.
	Select bom : Case #PB_UTF16BE, #PB_UTF32, #PB_UTF32BE : FatalError( "Input file uses an unsupported text format: " + filepath.s ) : EndSelect
	original_line_number = 1
	While Eof( #FILE ) = 0
		text_line.s = Trim( ReplaceString( ReadString( #FILE, bom ), Chr( 9 ), Chr( 32 ) ) ) ; Read in the file line, convert any tabs into spaces, and trim any leading and trailing spaces.
		If Len( text_line.s ) > 6 ; If the line has room for 'declare'...
			If LCase( Left( text_line.s, 7 ) ) = "declare" ; Ensure that the line starts with 'declare'.
				Repeat ; Convert multiple sequential spaces into a single space.
					size = Len( text_line.s )
					text_line.s = ReplaceString( text_line.s, "  ", " " )
				Until Len( text_line.s ) = size
				AddElement( InputLineList() )
				InputLineList()\original_line_number = original_line_number
				InputLineList()\input_line = Trim( Right( text_line.s, Len( text_line.s ) - 7 ) ) ; Grab the section of line following the 'declare' and with any remaining leading spaces trimmed.
			EndIf
		EndIf
		original_line_number + 1
	Wend
	CloseFile( #FILE )
	
Else
	FatalError( "Unable to load source code file: " + filepath.s )
EndIf
EndProcedure



Procedure ParseInputLines()

output.s = #EOL + #EOL + #EOL

output.s + "; NOTES:-" + #EOL
output.s + "; All 'handle' values (entity handles, texture handles, etc) used with this library should use PureBasic pointer variables to store the handle, or the PB integer '.i' datatype." + #EOL
output.s + "; OpenB3D seems to use 32 bit values internally, so use long integers '.l' and single-precision floats '.f' where appropriate." + #EOL
output.s + "; Before ending your program, make sure that you call the supplied 'EndProgram()' function or your own version of that code to close the library and trigger the DLL to do cleanup." + #EOL
output.s + "; The 'openb3d.dll' file can be found at: https://sourceforge.net/projects/minib3d/ inside the 'OpenB3D 1.26 for FB win64.zip' file or its 32 bit equivalent. The version number may be different. ~" + #EOL
output.s + "; ~ The first version of the dll that you will encounter in the zip (the one with the biggest file size) is the one you want. The one in the 'mingw64' library has some dependencies that require mingw to be installed." + #EOL
output.s + "; Make sure that you place the DLL into the same folder that the code or executable that calls it is in." + #EOL
output.s + "; If you are using the 32 bit version of the DLL then you may need to change 'Prototype' in the code below to 'PrototypeC'." + #EOL
output.s + "; For instructions on how to use the library, grab the 'OpenB3D.pdf' file from the web page linked above. Most of the commands are identical to those used in Blitz3D, so you can also find documentation ~" + #EOL
output.s + "; at: https://kippykip.com/b3ddocs/commands/index.htm | https://blitzresearch.itch.io/blitz3d | https://nitrologic.itch.io/blitz3d" + #EOL
output.s + "; When using the 'Graphics3D' command, you'll first need to create an OpenGL screen that the OpenB3D library can use. The PureBasic screen commands work for this as long as you have the 'OpenGL' subsystem set ~" + #EOL
output.s + "; ~ in the compiler options for your main source file. You can also use an 'OpenGLGadget'. Make sure that you use the same width, height, and color depth values, or it may not work." + #EOL
output.s + "; OpenB3D uses a left-hand coordinate system. X+ is to the right." + #EOL
output.s + "; You'll need to manually repaint the screen if the display becomes corrupted. See the demo code at the bottom of this file for an example of how to do this." + #EOL
;output.s + "; " + #EOL
output.s + #EOL + #EOL + #EOL

output.s + "#LIB_OPENB3D = 0 ; Declare the constant used with the OpenB3D library." + #EOL + #EOL + #EOL + #EOL

output.s + "Procedure FatalError( msg.s ) ; An example 'FatalError' function. A caret '^' can be used in the message to include double linefeeds." + #EOL
output.s + ~"MessageRequester( \"Fatal Error\", ReplaceString( \"The program encountered a fatal error and needs to close. The error was:-^\" + msg.s, \"^\", ~\"\\n\\n\" ), #PB_MessageRequester_Error )" + #EOL
output.s + "End" + #EOL
output.s + "EndProcedure" + #EOL + #EOL + #EOL + #EOL

output.s + "Procedure EndProgram() ; An example 'EndProgram' function. This needs to close the library used with 'openb3d.dll' to ensure that the DLL runs its cleanup routines." + #EOL
output.s + "; *** Do any general cleanup here." + #EOL
output.s + "If IsLibrary( #LIB_OPENB3D ) ; If the library is still open..." + #EOL
output.s + ~"\t; *** Do any cleanup here that requires the OpenB3D library to still be open." + #EOL
output.s + ~"\tCloseLibrary( #LIB_OPENB3D ) ; If the library is still open then close it." + #EOL
output.s + "EndIf" + #EOL
output.s + "; *** Do any cleanup here that requires the OpenB3D library to have been closed." + #EOL
output.s + "End ; End the program." + #EOL
output.s + "EndProcedure" + #EOL + #EOL + #EOL + #EOL

output.s + ~"If OpenLibrary( #LIB_OPENB3D, \"openb3d.dll\" ) = 0 : FatalError( \"Unable to access the 'openb3d.dll' library file.\" ) : End : EndIf ; Attempt to open the library. Abort if unsuccessful." + #EOL + #EOL

ForEach InputLineList()
	input_line.s = InputLineList()\input_line
	length = Len( input_line.s )
	terminator.s = " " ; A single character terminator.
	;For pos = 1 To length
	pos = 1		
	state = 1
	While pos <= length
		
		; Get the parse string up to but not including the terminator char. The position will end up either at the start of the next string to parse in or outside the input string.
		parse_string.s = "" ; Reset the parse string.
		Repeat
			char.s = Mid( input_line.s, pos, 1 )
			If char.s = terminator.s : pos + 1 : Break : EndIf ; If the terminator char is found then move past it and end the loop.
			parse_string.s + char.s ; Builds the parse_string.s without the terminating char.s.
			pos + 1 ; Increment the position.
			If pos > length : Break : EndIf ; If the new position is outside the input string then end the loop.
		ForEver
		
		;Debug "[" + parse_string.s + "] | State: " + state
		
		
		; Handle processing integer state triggers.
		Select state
			Case 1
				;Debug "Case 1"
				Select LCase( parse_string.s )
					Case "function", "sub" ; Expected at state 1. Switches us to state 2. Leaves the terminator as a space.
						;Debug "Switch to state 2"
						state = 2
					Default
						SyntaxError( "'function' or 'sub' not found when expected. Parse string = " + LCase( parse_string.s ), InputLineList()\original_line_number, pos )
				EndSelect
		
			Case 2 ; This state involves parsing in the 'prototype_command'. Once complete we move to state 3.
				InputLineList()\prototype_command = parse_string.s
				
				; Deal with special cases.
				Select parse_string.s
					Case "FluidArray" ; VOID FLUIDARRAY( FLUID* FLUID, FLOAT* ARRAY, INT WIDTH, INT HEIGHT, INT DEPTH )
						InputLineList()\alias_command = parse_string.s
						AddElement( InputLineList()\ParameterList() ) : InputLineList()\ParameterList() = "*fluid"
						AddElement( InputLineList()\ParameterList() ) : InputLineList()\ParameterList() = "Array ParamFluidArray.f( 3 )" ; ( width.l, height.l, depth.l ) ; The number used with 'Array' here seems to be for the number of dimensions.
						AddElement( InputLineList()\ParameterList() ) : InputLineList()\ParameterList() = "width.l"
						AddElement( InputLineList()\ParameterList() ) : InputLineList()\ParameterList() = "height.l"
						AddElement( InputLineList()\ParameterList() ) : InputLineList()\ParameterList() = "depth.l"
						Break
						
					Case "FluidFunction" ; VOID FLUIDFUNCTION( FLUID* FLUID, FLOAT (*FIELDFUNCTION)(FLOAT, FLOAT, FLOAT ) )
						InputLineList()\alias_command = parse_string.s
						AddElement( InputLineList()\ParameterList() ) : InputLineList()\ParameterList() = "*fluid"
						AddElement( InputLineList()\ParameterList() ) : InputLineList()\ParameterList() = "*MyFieldFunction" ; FieldFunction.f( x.f, y.f, z.f ) ; Not sure if this is correct.
						Break
					
					Case "EmitterParticleFunction" ; VOID EMITTERPARTICLEFUNCTION(PARTICLEEMITTER* EMITTER, VOID (*EMITTERFUNCTION) (ENTITY*, INT))
						InputLineList()\alias_command = parse_string.s
						AddElement( InputLineList()\ParameterList() ) : InputLineList()\ParameterList() = "*emitter"
						AddElement( InputLineList()\ParameterList() ) : InputLineList()\ParameterList() = "*EmiterFunction"
						Break
					
				EndSelect
				
				terminator.s = Chr( 34 ) ; Set the terminator to a quote mark.
				state = 3
				
			Case 3 ; This state involves finding the begining of the 'alias_command'. Once complete we move to state 4. Leaves the terminator as a quote mark.
				state = 4
				
			Case 4 ; This state involves parsing in the 'alias_command'. Once complete we move to state 5.
				InputLineList()\alias_command = parse_string.s
				terminator.s = "(" ; Set the terminator to an open parenthesis char.
				state = 5
				
			Case 5 ; This state involves finding the begining of the parameter list. Once complete we move to state 6.
				terminator.s = ")" ; Set the terminator to a close parenthesis char.
				state = 6
				
			Case 6 ; This state involves parsing in the parameter list. Once complete we move to state 7 (the final state).
				If Trim( parse_string.s ) ; If the function has a parameter list. If it doesn't then there will be no elements in 'InputLineList()\ParameterList()'.
					parse_string.s = RemoveString( LCase( parse_string.s ), "byval" ) ; Remove the 'byval' string and set the parameter string to lower-case.
					num_params = CountString( parse_string.s, "," ) + 1
					For i = 1 To num_params
						AddElement( InputLineList()\ParameterList() )
						param.s = Trim( StringField( parse_string.s, i, "," ) )
						
						; If 'byref' is found then the parameter is a pointer.
						If FindString( param.s, "byref" )
							InputLineList()\ParameterList() = "*" + Trim( RemoveString( RemoveString( RemoveString( param.s, "byref" ), "as single" ), "as integer" ) ) ; Convert the parameter name to a pointer name.
							Continue ; Skip the rest of this loop iteration.
						EndIf
						
						defaultval.s = ""
						If FindString( param.s, "=" ) ; If a default value is present.
							defaultval.s = " = " + Trim( StringField( param.s, 2, "=" ) )
							param.s = Trim( StringField( param.s, 1, "=" ) )
						EndIf
						sep_pos = FindString( param.s, " " )
						If sep_pos = 0 : SyntaxError( "Space separator not found in parameter.", InputLineList()\original_line_number, pos ) : EndIf
						param_name.s = Trim( Left( param.s, sep_pos - 1 ) )
						param_type.s = Trim( Right( param.s, Len( param.s ) - sep_pos ) )
						
						; Modify any parameter names that conlict with PureBasic identifiers here.
						Select param_name.s
							Case "static"
							param_name.s + "_type"
						EndSelect
						
						Select param_type.s
							Case "as any ptr" ; A pointer (memory address).
								InputLineList()\ParameterList() = "*" + param_name.s + defaultval.s
							
							Case "as integer" ; An integer. This is a long (32 bit).
								InputLineList()\ParameterList() = param_name.s + ".l" + defaultval.s
								
							Case "as single" ; A single precision float.
								InputLineList()\ParameterList() = param_name.s + ".f" + defaultval.s
								
							Case "as zstring ptr" ; A zero terminated ASCII string. Use the 'p-ascii' psuedotype for the parameter. Note that psuedotypes don't work for the function return value apparently.
								InputLineList()\ParameterList() = param_name.s + ".p-ascii" + defaultval.s
								
							Case "as sub" ; A function pointer for a function that doesn't return anything. Treat it as a plain pointer.
								InputLineList()\ParameterList() = "*" + param_name.s + defaultval.s
								
							Default
								SyntaxError( "Unknown parameter type encountered: '" + param_type.s + "'", InputLineList()\original_line_number, pos )
								
						EndSelect
					Next
				EndIf
				terminator.s = "" ; Set the terminator to an empty string, as the next state is the final state.
				state = 7
				
			Case 7
				parse_string.s = Trim( parse_string.s )
				If parse_string.s ; If the command has a return value.
					Select parse_string.s
						Case "as any ptr" ; A pointer (memory address).
							InputLineList()\return_type = ".i"
						
						Case "as integer" ; A 32 bit integer.
							InputLineList()\return_type = ".l"
							
						Case "as single" ; A single precision 32 bit float.
							InputLineList()\return_type = ".f"
							
						Case "as zstring ptr" ; A zero terminated ASCII string. Use the 'p-ascii' psuedotype for the parameter. Note that psuedotypes doesn't work for the function return value apparently.
							;param_type.s = ".p-ascii"
							InputLineList()\return_type = ".s"
							
						Default
							SyntaxError( "Unknown return type encountered: '" + parse_string.s + "'", InputLineList()\original_line_number, pos )
					EndSelect
				EndIf
			
		EndSelect
		
	Wend
	
	; Build the parameter list.
	params.s = ""
	num_params = ListSize( InputLineList()\ParameterList() )
	index = 1
	ForEach InputLineList()\ParameterList()
		params.s + InputLineList()\ParameterList()
		If index <> num_params : params.s + ", " : EndIf
		index + 1
	Next
	If params.s : params.s = " " + params.s + " " : EndIf ; If the parameters are not empty then add leading and trailing spaces.
	
	output.s + G_prototype_keyword.s + InputLineList()\return_type + " " + G_prototype_class_prefix.s + InputLineList()\prototype_command + "(" + params.s + 
	") : Global " + G_prototype_var_prefix.s + InputLineList()\prototype_command + "." + G_prototype_class_prefix.s + InputLineList()\prototype_command + ~" = GetFunction( #LIB_OPENB3D, \"" + InputLineList()\alias_command + ~"\" )" + #EOL
Next

output.s + #EOL + #EOL + #EOL + #EOL

output.s + "; === DEMO ===" + #EOL
output.s + "#MAIN_WINDOW = 0" + #EOL
output.s + "#OPENGL_SCREEN = 0" + #EOL
output.s + "#PREVIEW_SIZE = 1000" + #EOL
output.s + "#Menu_Event_CloseWindow = 0" + #EOL
output.s + #EOL
output.s + ~"OpenWindow( #MAIN_WINDOW, 0, 0, #PREVIEW_SIZE, #PREVIEW_SIZE, \"Test Window\" )" + #EOL
output.s + #EOL
output.s + ";OpenWindowedScreen( WindowID( #MAIN_WINDOW ), 0, 0, #PREVIEW_SIZE, #PREVIEW_SIZE )" + #EOL
output.s + "OpenGLGadget( #OPENGL_SCREEN, 0, 0, #PREVIEW_SIZE, #PREVIEW_SIZE )" + #EOL
output.s + #EOL
output.s + "OB3D_Graphics3D( #PREVIEW_SIZE, #PREVIEW_SIZE, 0, 2, 60 )" + #EOL
output.s + "*camera = OB3D_CreateCamera()" + #EOL
output.s + "OB3D_CameraClsColor( *camera, 0.0, 0.0, 255.0 )" + #EOL
output.s + "OB3D_MoveEntity( *camera, 0.0, 0.0, -5.0 )" + #EOL
output.s + "*light = OB3D_CreateLight()" + #EOL
output.s + "OB3D_MoveEntity( *light, 0.0, -10.0, 0.0 )" + #EOL
output.s + "*sphere = OB3D_CreateSphere()" + #EOL
output.s + "OB3D_UpdateWorld()" + #EOL
output.s + "OB3D_RenderWorld()" + #EOL
output.s + ";FlipBuffers() ; Use for 'OpenWindowedScreen'." + #EOL
output.s + "SetGadgetAttribute( #OPENGL_SCREEN, #PB_OpenGL_FlipBuffers, #True ) ; Use for 'OpenGLGadget'." + #EOL
output.s + #EOL
output.s + "AddKeyboardShortcut( #MAIN_WINDOW, #PB_Shortcut_Escape, #Menu_Event_CloseWindow )" + #EOL
output.s + #EOL
output.s + "Repeat" + #EOL
output.s + ~"\tSelect WaitWindowEvent()" + #EOL
output.s + ~"\t\tCase #PB_Event_Menu" + #EOL
output.s + ~"\t\t\tIf EventMenu() = #Menu_Event_CloseWindow : Break : EndIf" + #EOL
output.s + ~"\t\tCase #PB_Event_CloseWindow" + #EOL
output.s + ~"\t\t\tBreak" + #EOL
output.s + ~"\t\tCase #PB_Event_Repaint ; Repaint the OpenB3D content, if needed." + #EOL
output.s + ~"\t\t\tOB3D_RenderWorld()" + #EOL
output.s + ~"\t\t\t;FlipBuffers() ; Use for 'OpenWindowedScreen'." + #EOL
output.s + ~"\t\t\tSetGadgetAttribute( #OPENGL_SCREEN, #PB_OpenGL_FlipBuffers, #True ) ; Use for 'OpenGLGadget'." + #EOL
output.s + ~"\tEndSelect" + #EOL
output.s + "ForEver" + #EOL
output.s + #EOL + "EndProgram()" + #EOL + #EOL + #EOL

If CreateFile( #FILE, G_output_filepath.s )
	WriteString( #FILE, output.s )
	CloseFile( #FILE )
Else
	FatalError( "Unable to create the output file." )
EndIf

EndProcedure



LoadInputFile( G_input_filepath.s )

ParseInputLines()





User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5342
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: OpenB3D 3D DLL framework include file for PureBasic

Post by Kwai chang caine »

Your code works here :D
I have a nice unperfect white circle on blue background
Thanks for sharing 8)
ImageThe happiness is a road...
Not a destination
MrBean
User
User
Posts: 17
Joined: Sat Dec 22, 2012 7:27 am

Re: OpenB3D 3D DLL framework include file for PureBasic

Post by MrBean »

Thanks for the Graphics engine,
i have tried your demo at the bottom of the include file, with a cube

Code: Select all

IncludeFile "openb3d.pb"
; === DEMO ===
#MAIN_WINDOW = 0
#OPENGL_SCREEN = 0
#PREVIEW_SIZE = 400
#Menu_Event_CloseWindow = 0

OpenWindow( #MAIN_WINDOW, 0, 0, #PREVIEW_SIZE, #PREVIEW_SIZE, "Test Window" )

;OpenWindowedScreen( WindowID( #MAIN_WINDOW ), 0, 0, #PREVIEW_SIZE, #PREVIEW_SIZE )
OpenGLGadget( #OPENGL_SCREEN, 0, 0, #PREVIEW_SIZE, #PREVIEW_SIZE )

OB3D_Graphics3D( #PREVIEW_SIZE, #PREVIEW_SIZE, 0, 2, 60 )
*camera = OB3D_CreateCamera()
OB3D_CameraClsColor( *camera, 0.0, 0.0, 255.0 )
OB3D_MoveEntity( *camera, 0.0, 0.0, -5.0 )
*light = OB3D_CreateLight()
OB3D_MoveEntity( *light, 0.0, -10.0, 0.0 )
*cube = OB3D_CreateCube()
OB3D_UpdateWorld()
OB3D_RenderWorld()
;FlipBuffers() ; Use for 'OpenWindowedScreen'.
SetGadgetAttribute( #OPENGL_SCREEN, #PB_OpenGL_FlipBuffers, #True ) ; Use for 'OpenGLGadget'.

AddKeyboardShortcut( #MAIN_WINDOW, #PB_Shortcut_Escape, #Menu_Event_CloseWindow )
OB3D_PositionEntity(*cube, 0, 0, 0)
Global rot.f
Repeat
	Select WaitWindowEvent()
		Case #PB_Event_Menu
			If EventMenu() = #Menu_Event_CloseWindow : Break : EndIf
		Case #PB_Event_CloseWindow
			Break
		Case #PB_Event_Repaint ; Repaint the OpenB3D content, if needed.
		  		  
		  OB3D_RotateEntity(*cube,0,rot,0)
		  OB3D_RenderWorld()
			;FlipBuffers() ; Use for 'OpenWindowedScreen'.
			SetGadgetAttribute( #OPENGL_SCREEN, #PB_OpenGL_FlipBuffers, #True ) ; Use for 'OpenGLGadget'.
	EndSelect
	rot+1
ForEver

EndProgram()
1- i want to rotate the cube contentiously by changing the value of rot at the y position, but the cube does not rotate until i move the window and force it to repaint then it will rotate for a few seconds.
2- how to resize the cube other than the default
3- a few more examples for PureBasic will be helpful
Thank you
User avatar
[blendman]
Enthusiast
Enthusiast
Posts: 297
Joined: Thu Apr 07, 2011 1:14 pm
Location: 3 arks
Contact:

Re: OpenB3D 3D DLL framework include file for PureBasic

Post by [blendman] »

Hi

Thank you very much for your code Axeman ! It's great and it works fine (compiled with pb5.73 x64).

MrBean wrote: Fri Jan 21, 2022 8:52 am 1- i want to rotate the cube contentiously by changing the value of rot at the y position, but the cube does not rotate until i move the window and force it to repaint then it will rotate for a few seconds.
2- how to resize the cube other than the default
3- a few more examples for PureBasic will be helpful
Thank you


1- you could tried like that :

Code: Select all

IncludeFile "openb3d.pb"
; === DEMO ===
#MAIN_WINDOW = 0
#OPENGL_SCREEN = 0
#PREVIEW_SIZE = 400
#Menu_Event_CloseWindow = 0

OpenWindow( #MAIN_WINDOW, 0, 0, #PREVIEW_SIZE, #PREVIEW_SIZE, "Test Window" )

;OpenWindowedScreen( WindowID( #MAIN_WINDOW ), 0, 0, #PREVIEW_SIZE, #PREVIEW_SIZE )
OpenGLGadget( #OPENGL_SCREEN, 0, 0, #PREVIEW_SIZE, #PREVIEW_SIZE )

OB3D_Graphics3D( #PREVIEW_SIZE, #PREVIEW_SIZE, 0, 2, 60 )
*camera = OB3D_CreateCamera()
OB3D_CameraClsColor( *camera, 0.0, 0.0, 255.0 )
OB3D_MoveEntity( *camera, 0.0, 0.0, -5.0 )
*light = OB3D_CreateLight()
OB3D_MoveEntity( *light, 0.0, -10.0, 0.0 )
*cube = OB3D_CreateCube()
OB3D_UpdateWorld()
OB3D_RenderWorld()
;FlipBuffers() ; Use for 'OpenWindowedScreen'.
SetGadgetAttribute( #OPENGL_SCREEN, #PB_OpenGL_FlipBuffers, #True ) ; Use for 'OpenGLGadget'.

AddKeyboardShortcut( #MAIN_WINDOW, #PB_Shortcut_Escape, #Menu_Event_CloseWindow )
OB3D_PositionEntity(*cube, 0, 0, 0)
Global rot.f
Repeat
	Select WaitWindowEvent(1)
		Case #PB_Event_Menu
			If EventMenu() = #Menu_Event_CloseWindow : Break : EndIf
		Case #PB_Event_CloseWindow
			Break
		  
	EndSelect
	
	; The event For 3D objects
	OB3D_RotateEntity(*cube,0,rot,0)
	OB3D_RenderWorld()
	;FlipBuffers() ; Use for 'OpenWindowedScreen'.
	SetGadgetAttribute( #OPENGL_SCREEN, #PB_OpenGL_FlipBuffers, #True ) ; Use for 'OpenGLGadget'.
	rot+1
ForEver

EndProgram()

2) Resize an entity :
You could use :

Code: Select all

OB3D_ScaleEntity( *cube, 1,1,0.5 )
3- a few more examples for PureBasic will be helpful
I agree ;).

EDIT :
a simple example :
- Create cube
- rotate cube and scale cube (in real time)
- loadtexture() (a jpg image)
- textureentity()

Code: Select all

IncludeFile "openb3d.pb"
; === DEMO ===
#MAIN_WINDOW = 0
#OPENGL_SCREEN = 0
#PREVIEW_SIZE = 600
#Menu_Event_CloseWindow = 0

OpenWindow( #MAIN_WINDOW, 0, 0, #PREVIEW_SIZE, #PREVIEW_SIZE, "Test Window" )

;OpenWindowedScreen( WindowID( #MAIN_WINDOW ), 0, 0, #PREVIEW_SIZE, #PREVIEW_SIZE )
OpenGLGadget( #OPENGL_SCREEN, 0, 0, #PREVIEW_SIZE, #PREVIEW_SIZE )

OB3D_Graphics3D( #PREVIEW_SIZE, #PREVIEW_SIZE, 0, 2, 60 )
OB3D_AntiAlias( 1 ) ; don't work
*texture = OB3D_LoadTexture(#PB_Compiler_Home+"Examples\3D\Data\Textures\Dirt.jpg" ) 
*camera = OB3D_CreateCamera()
OB3D_CameraClsColor( *camera, 0.0, 0.0, 255.0 )
OB3D_MoveEntity( *camera, 0.0, 0.0, -5.0 )
*light = OB3D_CreateLight()
OB3D_MoveEntity( *light, 0.0, -10.0, 0.0 )
*cube = OB3D_CreateCube()
OB3D_ScaleEntity( *cube, 1,1,0.5 )
OB3D_EntityTexture( *cube, *texture)
OB3D_UpdateWorld()
OB3D_RenderWorld()
;FlipBuffers() ; Use for 'OpenWindowedScreen'.
SetGadgetAttribute( #OPENGL_SCREEN, #PB_OpenGL_FlipBuffers, #True ) ; Use for 'OpenGLGadget'.

AddKeyboardShortcut( #MAIN_WINDOW, #PB_Shortcut_Escape, #Menu_Event_CloseWindow )
OB3D_PositionEntity(*cube, 0, 0, 0)
Global rot.f
Repeat
	Select WaitWindowEvent(1)
		Case #PB_Event_Menu
			If EventMenu() = #Menu_Event_CloseWindow : Break : EndIf
		Case #PB_Event_CloseWindow
			Break
		  
	EndSelect
	
	; changes variable
	rot+1
	
	; The event For 3D objects
	OB3D_RotateEntity(*cube,0,rot,0)
	OB3D_ScaleEntity( *cube, 1,1,Sin(rot*0.05)*0.5+1)

	OB3D_RenderWorld()
	;FlipBuffers() ; Use for 'OpenWindowedScreen'.
	SetGadgetAttribute( #OPENGL_SCREEN, #PB_OpenGL_FlipBuffers, #True ) ; Use for 'OpenGLGadget'.
	
ForEver

EndProgram()
EDIT2 :

here a test to load a .b3D file with its texture.
And it works very great :)

Image

The code :
(use your own model and texture)

Code: Select all

IncludeFile "openb3d.pb"
; === DEMO ===
#MAIN_WINDOW = 0
#OPENGL_SCREEN = 0
#PREVIEW_SIZEW =1024
#PREVIEW_SIZEH =600
#Menu_Event_CloseWindow = 0

OpenWindow( #MAIN_WINDOW, 0, 0, #PREVIEW_SIZEW, #PREVIEW_SIZEH, "Purebasic OpenB3D",
            #PB_Window_SystemMenu|#PB_Window_ScreenCentered|#PB_Window_MaximizeGadget|#PB_Window_MinimizeGadget)

;OpenWindowedScreen( WindowID( #MAIN_WINDOW ), 0, 0, #PREVIEW_SIZE, #PREVIEW_SIZE )
OpenGLGadget( #OPENGL_SCREEN, 0, 0, #PREVIEW_SIZEW, #PREVIEW_SIZEH )

OB3D_Graphics3D( #PREVIEW_SIZEW, #PREVIEW_SIZEH, 0, 2, 60 )
OB3D_AntiAlias( 1 ) ; don't work
; *texture = OB3D_LoadTexture(#PB_Compiler_Home+"Examples\3D\Data\Textures\Dirt.jpg" ) 
*texture = OB3D_LoadTexture("tinalien_D.jpg" ) 

*camera = OB3D_CreateCamera()
OB3D_CameraClsColor( *camera, 150.0, 150.0, 255.0 )
OB3D_MoveEntity( *camera, 0.0, 1, -5.0 )
OB3D_RotateEntity( *camera, -10, 0, 0 )


*light = OB3D_CreateLight()
OB3D_MoveEntity( *light, 0.0, -10.0, 0.0 )
*light2 = OB3D_CreateLight()
OB3D_MoveEntity( *light2, 1.0, 0.0, 0.0 )
*platform = OB3D_LoadMesh("tinalien.b3d")
OB3D_RotateMesh(*platform,0,40,0)
OB3D_EntityTexture( *platform, *texture)

AddKeyboardShortcut( #MAIN_WINDOW, #PB_Shortcut_Escape, #Menu_Event_CloseWindow )
OB3D_PositionMesh(*platform, 0, -5, 0)
OB3D_ScaleMesh(*platform, 0.5,0.5,0.5)
OB3D_RotateMesh(*platform, 0,-10,0)

OB3D_UpdateWorld()
OB3D_RenderWorld()
;FlipBuffers() ; Use for 'OpenWindowedScreen'.
SetGadgetAttribute( #OPENGL_SCREEN, #PB_OpenGL_FlipBuffers, #True ) ; Use for 'OpenGLGadget'.


Repeat
  Select WaitWindowEvent(1)
    Case #PB_Event_Menu
      If EventMenu() = #Menu_Event_CloseWindow : Break : EndIf
    Case #PB_Event_CloseWindow
      Break
  EndSelect
  
;   OB3D_UpdateWorld()
;   OB3D_RenderWorld()
;   ;FlipBuffers() ; Use for 'OpenWindowedScreen'.
;   SetGadgetAttribute( #OPENGL_SCREEN, #PB_OpenGL_FlipBuffers, #True ) ; Use for 'OpenGLGadget'.
  
ForEver
EndProgram()
MrBean
User
User
Posts: 17
Joined: Sat Dec 22, 2012 7:27 am

Re: OpenB3D 3D DLL framework include file for PureBasic

Post by MrBean »

Thank you [blendman] for the examples
all the examples run nicely. the nice animation and the model viewer
User avatar
Caronte3D
Addict
Addict
Posts: 1027
Joined: Fri Jan 22, 2016 5:33 pm
Location: Some Universe

Re: OpenB3D 3D DLL framework include file for PureBasic

Post by Caronte3D »

Question... Why use this library instead of the integrted one (Ogre3D)?
MrBean
User
User
Posts: 17
Joined: Sat Dec 22, 2012 7:27 am

Re: OpenB3D 3D DLL framework include file for PureBasic

Post by MrBean »

the ability to use many graphics engines denote the richness of purebasic and does not lower the value of its own engine, many people are using Ogre3D for their commercial projects.
it means that the enthusiasts are happy to create something for the purebasic. if purebasic is a trivial project no one will create anything for or with it.
this lib have used purebasic own opengl canvas to facilitate using opengl..
there are many graphics engines created for purebasic through the years as an example:
Xors3d https://github.com/Guevara-chan/Xors3D-for-PB
Irrlicht 3D Engine for PureBasic
N3XTD: 3D engine
MP3D
and other engines i forget.
User avatar
[blendman]
Enthusiast
Enthusiast
Posts: 297
Joined: Thu Apr 07, 2011 1:14 pm
Location: 3 arks
Contact:

Re: OpenB3D 3D DLL framework include file for PureBasic

Post by [blendman] »

Caronte3D wrote: Fri Jan 21, 2022 7:35 pm Question... Why use this library instead of the integrted one (Ogre3D)?
Hi

Ogre and other lib have their advantages and disadvantages :
- Ogre is not bad, but the export in .msh is not easy with blender, the materials and shaders are complexe. But the integrated functions are very usefull.
- OpenB3D : the import formats are great (.x, .b3D) it's easy to export from blender. The shaders are in glsl, so we can find lots of examples.
- MP3D : it's very interesting too, (import format .x, .obj, .b3D), very interesting features too.

I guess it's always good to have several lib to do what we would like to do. ;)
User avatar
Caronte3D
Addict
Addict
Posts: 1027
Joined: Fri Jan 22, 2016 5:33 pm
Location: Some Universe

Re: OpenB3D 3D DLL framework include file for PureBasic

Post by Caronte3D »

Thanks for the explanation :wink:
Axeman
User
User
Posts: 89
Joined: Mon Nov 03, 2003 5:34 am

Re: OpenB3D 3D DLL framework include file for PureBasic

Post by Axeman »

Question... Why use this library instead of the integrated one (Ogre3D)?
1/ I needed to do some overdraw rendering which involves preventing the renderer from clearing the color buffer. OpenB3d and Blitz3D support this via the CameraClsMode command, and Ogre3D also supports it. The Purebasic Ogre3D version doesn't include this functionality, however ( https://www.purebasic.fr/english/viewtopic.php?t=77689 ).

2/ Purebasic's 3D and game library implementation is rife with deal-killer bugs that the devs don't seem to take seriously ( https://www.purebasic.fr/english/viewtopic.php?t=77496 ). Every time I try developing something in it I hit some new snag that requires Fred and co to fix before I can continue. Many of these bugs have persisted for a decade or more, such as the issue with the mouse input library crapping the bed if you try using it with a high poll-rate mouse (which is why I made this library - https://www.purebasic.fr/english/viewtopic.php?t=77442 ).

Purebasic's 3D library has some nice stuff in it, but that doesn't do much good if key functionality such as setting a collision body doesn't work.
User avatar
Caronte3D
Addict
Addict
Posts: 1027
Joined: Fri Jan 22, 2016 5:33 pm
Location: Some Universe

Re: OpenB3D 3D DLL framework include file for PureBasic

Post by Caronte3D »

I understand you, but... I have another question:
Do you think OpenB3D will continue is development or is a dead project?
Axeman
User
User
Posts: 89
Joined: Mon Nov 03, 2003 5:34 am

Re: OpenB3D 3D DLL framework include file for PureBasic

Post by Axeman »

The last update was 15 hours ago, so not really a dead project ( https://sourceforge.net/projects/minib3d/files/ ). It's only intended to be a small framework for hobbyists and indies though, so the dev probably largely considers it a completed project.
User avatar
skinkairewalker
Enthusiast
Enthusiast
Posts: 627
Joined: Fri Dec 04, 2015 9:26 pm

Re: OpenB3D 3D DLL framework include file for PureBasic

Post by skinkairewalker »

is it possible to load a 3d mesh from memory, from a ".zip" package for example? similar to loading an image from memory with the command >" CatchImage " ?
Axeman
User
User
Posts: 89
Joined: Mon Nov 03, 2003 5:34 am

Re: OpenB3D 3D DLL framework include file for PureBasic

Post by Axeman »

I don't think OpenB3D has a command that supports unpacking a model file from RAM. It has options for building 3D mesh geometry manually though, so you can still write your own command to do this. That's probably not something you may wish to do, but the option still exists if it is useful to you.

You could always try putting in a feature request via the forum at: https://sourceforge.net/projects/minib3d/ or at https://www.syntaxbomb.com/index.php?action=forum
Post Reply