Browse Source

Added blob and fluid types.
Updated to use map entity storage.
Added DepthBufferToText function.

woollybah 10 years ago
parent
commit
2c7d99f028

+ 144 - 94
openb3d.mod/functions.bmx

@@ -141,7 +141,7 @@ Rem
 bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CameraPick">Online doc</a>
 End Rem
 Function CameraPick:TEntity( cam:TCamera, x:Float, y:Float )
-	Return globals.ent.GetEntity( CameraPick_( cam.instance, x, GraphicsHeight()-y ) ) ' inverted y
+	Return globals.ent.EntityValue( CameraPick_( cam.instance, x, GraphicsHeight()-y ) ) ' inverted y
 End Function
 
 Rem
@@ -183,7 +183,7 @@ Rem
 bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CollisionEntity">Online doc</a>
 End Rem
 Function CollisionEntity:TEntity( ent:TEntity, index:Int )
-	Return globals.ent.GetEntity( CollisionEntity_( ent.instance, index ) )
+	Return globals.ent.EntityValue( CollisionEntity_( ent.instance, index ) )
 End Function
 
 Rem
@@ -211,7 +211,10 @@ Rem
 bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CollisionSurface">Online doc</a>
 End Rem
 Function CollisionSurface:TSurface( ent:TEntity, index:Int )
-	Return globals.mesh.GetSurface( CollisionSurface_( ent.instance, index ) )
+	Local instance:Byte Ptr=CollisionSurface_( ent.instance, index )
+	Local surf:TSurface=globals.surf.SurfaceValue( instance )
+	If surf=Null And instance<>Null Then surf=globals.surf.NewSurface( instance )
+	Return surf
 End Function
 
 Rem
@@ -288,8 +291,8 @@ Rem
 bbdoc: undocumented
 End Rem
 Function CreateStencil:TStencil()
-	Local stencil:TStencil=globals.stencil.NewStencil()
-	stencil.instance=CreateStencil_()
+	Local instance:Byte Ptr=CreateStencil_()
+	Local stencil:TStencil=globals.stencil.NewStencil( instance )
 	Return stencil
 End Function
 
@@ -346,7 +349,7 @@ Rem
 bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=EntityCollided">Online doc</a>
 End Rem
 Function EntityCollided:TEntity( ent:TEntity, type_no:Int )
-	Return globals.ent.GetEntity( EntityCollided_( ent.instance, type_no ) )
+	Return globals.ent.EntityValue( EntityCollided_( ent.instance, type_no ) )
 End Function
 
 Rem
@@ -395,7 +398,7 @@ Rem
 bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=EntityPick">Online doc</a>
 End Rem
 Function EntityPick:TEntity( ent:TEntity, Range:Float )
-	Return globals.ent.GetEntity( EntityPick_( ent.instance, Range ) )
+	Return globals.ent.EntityValue( EntityPick_( ent.instance, Range ) )
 End Function
 
 Rem
@@ -416,14 +419,17 @@ Rem
 bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=FindChild">Online doc</a>
 End Rem
 Function FindChild:TEntity( ent:TEntity, child_name:String )
-	Return globals.ent.GetEntity( FindChild_( ent.instance, child_name.ToCString() ) )
+	Return globals.ent.EntityValue( FindChild_( ent.instance, child_name.ToCString() ) )
 End Function
 
 Rem
 bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=FindSurface">Online doc</a>
 End Rem
 Function FindSurface:TSurface( mesh:TMesh, brush:TBrush )
-	Return globals.mesh.GetSurface( FindSurface_( mesh.instance, brush.instance ) )
+	Local instance:Byte Ptr=FindSurface_( mesh.instance, brush.instance )
+	Local surf:TSurface=globals.surf.SurfaceValue( instance )
+	If surf=Null And instance<>Null Then surf=globals.surf.NewSurface( instance )
+	Return surf
 End Function
 
 Rem
@@ -437,7 +443,7 @@ Rem
 bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=FreeBrush">Online doc</a>
 End Rem
 Function FreeBrush( brush:TBrush )
-	brush.DeleteBrush()
+	brush.DeleteBrush( brush.instance )
 	FreeBrush_( brush.instance )
 End Function
 
@@ -445,7 +451,7 @@ Rem
 bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=FreeEntity">Online doc</a>
 End Rem
 Function FreeEntity( ent:TEntity )
-	ent.DeleteEntity()
+	ent.DeleteEntity( ent.instance )
 	FreeEntity_( ent.instance )
 End Function
 
@@ -453,7 +459,7 @@ Rem
 bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=FreeTexture">Online doc</a>
 End Rem
 Function FreeTexture( tex:TTexture )
-	tex.DeleteTexture()
+	tex.DeleteTexture( tex.instance )
 	FreeTexture_( tex.instance )
 End Function
 
@@ -469,11 +475,8 @@ bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=GetChild">Onl
 End Rem
 Function GetChild:TEntity( ent:TEntity, child_no:Int )
 	Local instance:Byte Ptr=GetChild_( ent.instance, child_no )
-	Local child:TEntity=globals.ent.GetEntity( instance )
-	If child=Null
-		child=globals.ent.NewEntity()
-		child.instance=instance
-	EndIf
+	Local child:TEntity=globals.ent.EntityValue( instance )
+	If child=Null And instance<>Null Then child=globals.ent.NewEntity( instance )
 	Return child
 End Function
 
@@ -481,7 +484,10 @@ Rem
 bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=GetEntityBrush">Online doc</a>
 End Rem
 Function GetEntityBrush:TBrush( ent:TEntity )
-	Return globals.brush.GetBrush( GetEntityBrush_( ent.instance ) )
+	Local instance:Byte Ptr=GetEntityBrush_( ent.instance )
+	Local brush:TBrush=globals.brush.BrushValue( instance )
+	If brush=Null And instance<>Null Then brush=globals.brush.NewBrush( instance )
+	Return brush
 End Function
 
 Rem
@@ -502,21 +508,27 @@ Rem
 bbdoc: undocumented
 End Rem
 Function GetParentEntity:TEntity( ent:TEntity )
-	Return globals.ent.GetEntity( GetParentEntity_( ent.instance ) )
+	Return globals.ent.EntityValue( GetParentEntity_( ent.instance ) )
 End Function
 
 Rem
 bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=GetSurface">Online doc</a>
 End Rem
 Function GetSurface:TSurface( mesh:TMesh, surf_no:Int )
-	Return globals.mesh.GetSurface( GetSurface_( mesh.instance, surf_no ) )
+	Local instance:Byte Ptr=GetSurface_( mesh.instance, surf_no )
+	Local surf:TSurface=globals.surf.SurfaceValue( instance )
+	If surf=Null And instance<>Null Then surf=globals.surf.NewSurface( instance )
+	Return surf
 End Function
 
 Rem
 bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=GetSurfaceBrush">Online doc</a>
 End Rem
 Function GetSurfaceBrush:TBrush( surf:TSurface )	
-	Return globals.brush.GetBrush( GetSurfaceBrush_( surf.instance ) )
+	Local instance:Byte Ptr=GetSurfaceBrush_( surf.instance )
+	Local brush:TBrush=globals.brush.BrushValue( instance )
+	If brush=Null And instance<>Null Then brush=globals.brush.NewBrush( instance )
+	Return brush
 End Function
 
 Rem
@@ -558,8 +570,8 @@ Rem
 bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=LoadAnimTexture">Online doc</a>
 End Rem
 Function LoadAnimTexture:TTexture( file:String, flags:Int, frame_width:Int, frame_height:Int, first_frame:Int, frame_count:Int )
-	Local tex:TTexture=globals.tex.NewTexture()
-	tex.instance=LoadAnimTexture_( file.ToCString(), flags, frame_width, frame_height, first_frame, frame_count )
+	Local instance:Byte Ptr=LoadAnimTexture_( file.ToCString(), flags, frame_width, frame_height, first_frame, frame_count )
+	Local tex:TTexture=globals.tex.NewTexture( instance )
 	Return tex
 End Function
 
@@ -644,14 +656,17 @@ Rem
 bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=PickedEntity">Online doc</a>
 End Rem
 Function PickedEntity:TEntity()
-	Return globals.ent.GetEntity( PickedEntity_() )
+	Return globals.ent.EntityValue( PickedEntity_() )
 End Function
 
 Rem
 bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=PickedSurface">Online doc</a>
 End Rem
 Function PickedSurface:TSurface()
-	Return globals.mesh.GetSurface( PickedSurface_() )
+	Local instance:Byte Ptr=PickedSurface_()
+	Local surf:TSurface=globals.surf.SurfaceValue( instance )
+	If surf=Null And instance<>Null Then surf=globals.surf.NewSurface( instance )
+	Return surf
 End Function
 
 Rem
@@ -738,6 +753,13 @@ Function ShowEntity( ent:TEntity )
 	ShowEntity_( ent.instance )
 End Function
 
+Rem
+bbdoc: undocumented
+End Rem
+Function SpriteRenderMode( sprite:TSprite, Mode:Int )
+	SpriteRenderMode_( sprite.instance, Mode )
+End Function
+
 Rem
 bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=SpriteViewMode">Online doc</a>
 End Rem
@@ -982,8 +1004,8 @@ Rem
 bbdoc: Load shader from two files, vertex and fragment.
 End Rem
 Function LoadShader:TShader( ShaderName:String, VshaderFileName:String, FshaderFileName:String )
-	Local material:TShader=globals.material.NewShader()
-	material.instance=LoadShader_( ShaderName.ToCString(), VshaderFileName.ToCString(), FshaderFileName.ToCString() )
+	Local instance:Byte Ptr=LoadShader_( ShaderName.ToCString(), VshaderFileName.ToCString(), FshaderFileName.ToCString() )
+	Local material:TShader=globals.material.NewShader( instance )
 	Return material
 End Function
 
@@ -991,8 +1013,8 @@ Rem
 bbdoc: Load shader from two strings, vertex and fragment.
 End Rem
 Function CreateShader:TShader( ShaderName:String, VshaderString:String, FshaderString:String )
-	Local material:TShader=globals.material.NewShader()
-	material.instance=CreateShader_( ShaderName.ToCString(), VshaderString.ToCString(), FshaderString.ToCString() )
+	Local instance:Byte Ptr=CreateShader_( ShaderName.ToCString(), VshaderString.ToCString(), FshaderString.ToCString() )
+	Local material:TShader=globals.material.NewShader( instance )
 	Return material
 End Function
 
@@ -1148,8 +1170,8 @@ Rem
 bbdoc: undocumented
 End Rem
 Function LoadMaterial:TMaterial( filename:String, flags:Int, frame_width:Int, frame_height:Int, first_frame:Int, frame_count:Int )
-	Local mat:TMaterial=globals.mat.NewMaterial()
-	mat.instance=LoadMaterial_( filename.ToCString(), flags, frame_width, frame_height, first_frame, frame_count )
+	Local instance:Byte Ptr=LoadMaterial_( filename.ToCString(), flags, frame_width, frame_height, first_frame, frame_count )
+	Local mat:TMaterial=globals.mat.NewMaterial( instance )
 	Return mat
 End Function
 
@@ -1171,6 +1193,13 @@ Function BufferToTex( tex:TTexture, buffer:Byte Ptr, frame:Int=0 )
 	BufferToTex_( tex.instance, buffer, frame )
 End Function
 
+Rem
+bbdoc: Copy the contents of the depthbuffer to a texture.
+End Rem
+Function DepthBufferToTex( tex:TTexture, frame:Int=0 )
+	DepthBufferToTex_( tex.instance, frame )
+End Function
+
 Rem
 bbdoc: Copy a rendered camera view to texture.
 End Rem
@@ -1233,8 +1262,8 @@ Rem
 bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CopyEntity">Online doc</a>
 End Rem
 Function CopyEntity:TEntity( ent:TEntity, parent:TEntity=Null )
-	Local copy:TEntity=globals.ent.NewEntity()
-	copy.instance=CopyEntity_( ent.instance, TEntity.EntityExists( parent ) )
+	Local instance:Byte Ptr=CopyEntity_( ent.instance, TEntity.EntityExists( parent ) )
+	Local copy:TEntity=globals.ent.NewEntity( instance )
 	Return copy
 End Function
 
@@ -1242,17 +1271,26 @@ Rem
 bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CopyMesh">Online doc</a>
 End Rem
 Function CopyMesh:TMesh( mesh:TMesh, parent:TEntity=Null )
-	Local copy:TMesh=globals.mesh.NewMesh()
-	copy.instance=CopyMesh_( mesh.instance, TEntity.EntityExists( parent ) )
+	Local instance:Byte Ptr=CopyMesh_( mesh.instance, TEntity.EntityExists( parent ) )
+	Local copy:TMesh=globals.mesh.NewMesh( instance )
 	Return copy
 End Function
 
+Rem
+bbdoc: undocumented
+End Rem
+Function CreateBlob:TBlob( fluid:TFluid, radius:Float, parent_ent:TEntity=Null )
+	Local instance:Byte Ptr=CreateBlob_( fluid, radius, TEntity.EntityExists( parent_ent ) )
+	Local blob:TBlob=globals.blob.NewBlob( instance )
+	Return blob
+End Function
+
 Rem
 bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CreateBrush">Online doc</a>
 End Rem
 Function CreateBrush:TBrush( r:Float=255, g:Float=255, b:Float=255 )
-	Local brush:TBrush=globals.brush.NewBrush()
-	brush.instance=CreateBrush_( r, g, b )
+	Local instance:Byte Ptr=CreateBrush_( r, g, b )
+	Local brush:TBrush=globals.brush.NewBrush( instance )
 	Return brush
 End Function
 
@@ -1260,8 +1298,8 @@ Rem
 bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CreateCamera">Online doc</a>
 End Rem
 Function CreateCamera:TCamera( parent:TEntity=Null )
-	Local cam:TCamera=globals.cam.NewCamera()
-	cam.instance=CreateCamera_( TEntity.EntityExists( parent ) )
+	Local instance:Byte Ptr=CreateCamera_( TEntity.EntityExists( parent ) )
+	Local cam:TCamera=globals.cam.NewCamera( instance )
 	Return cam
 End Function
 
@@ -1269,8 +1307,8 @@ Rem
 bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CreateCone">Online doc</a>
 End Rem
 Function CreateCone:TMesh( segments:Int=8, solid:Int=True, parent:TEntity=Null )
-	Local mesh:TMesh=globals.mesh.NewMesh()
-	mesh.instance=CreateCone_( segments, solid, TEntity.EntityExists( parent ) )
+	Local instance:Byte Ptr=CreateCone_( segments, solid, TEntity.EntityExists( parent ) )
+	Local mesh:TMesh=globals.mesh.NewMesh( instance )
 	Return mesh
 End Function
 
@@ -1278,8 +1316,8 @@ Rem
 bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CreateCylinder">Online doc</a>
 End Rem
 Function CreateCylinder:TMesh( segments:Int=8, solid:Int=True, parent:TEntity=Null )
-	Local mesh:TMesh=globals.mesh.NewMesh()
-	mesh.instance=CreateCylinder_( segments, solid, TEntity.EntityExists( parent ) )
+	Local instance:Byte Ptr=CreateCylinder_( segments, solid, TEntity.EntityExists( parent ) )
+	Local mesh:TMesh=globals.mesh.NewMesh( instance )
 	Return mesh
 End Function
 
@@ -1287,17 +1325,26 @@ Rem
 bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CreateCube">Online doc</a>
 End Rem
 Function CreateCube:TMesh( parent:TEntity=Null )
-	Local mesh:TMesh=globals.mesh.NewMesh()
-	mesh.instance=CreateCube_( TEntity.EntityExists( parent ) )
+	Local instance:Byte Ptr=CreateCube_( TEntity.EntityExists( parent ) )
+	Local mesh:TMesh=globals.mesh.NewMesh( instance )
 	Return mesh
 End Function
 
+Rem
+bbdoc: undocumented
+End Rem
+Function CreateFluid:TFluid()
+	Local instance:Byte Ptr=CreateFluid_()
+	Local fluid:TFluid=globals.fluid.NewFluid( instance )
+	Return fluid
+End Function
+
 Rem
 bbdoc: undocumented
 End Rem
 Function CreateGeosphere:TGeosphere( size:Int, parent:TEntity=Null )
-	Local geo:TGeosphere=globals.geo.NewGeosphere()
-	geo.instance=CreateGeosphere_( size, TEntity.EntityExists( parent ) )
+	Local instance:Byte Ptr=CreateGeosphere_( size, TEntity.EntityExists( parent ) )
+	Local geo:TGeosphere=globals.geo.NewGeosphere( instance )
 	Return geo
 End Function
 
@@ -1305,8 +1352,8 @@ Rem
 bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CreateMesh">Online doc</a>
 End Rem
 Function CreateMesh:TMesh( parent:TEntity=Null )
-	Local mesh:TMesh=globals.mesh.NewMesh()
-	mesh.instance=CreateMesh_( TEntity.EntityExists( parent ) )
+	Local instance:Byte Ptr=CreateMesh_( TEntity.EntityExists( parent ) )
+	Local mesh:TMesh=globals.mesh.NewMesh( instance )
 	Return mesh
 End Function
 
@@ -1314,8 +1361,8 @@ Rem
 bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CreateLight">Online doc</a>
 End Rem
 Function CreateLight:TLight( light_type:Int=1, parent:TEntity=Null )
-	Local light:TLight=globals.light.NewLight()
-	light.instance=CreateLight_( light_type, TEntity.EntityExists( parent ) )
+	Local instance:Byte Ptr=CreateLight_( light_type, TEntity.EntityExists( parent ) )
+	Local light:TLight=globals.light.NewLight( instance )
 	Return light
 End Function
 
@@ -1323,8 +1370,8 @@ Rem
 bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CreatePivot">Online doc</a>
 End Rem
 Function CreatePivot:TPivot( parent:TEntity=Null )
-	Local piv:TPivot=globals.piv.NewPivot()
-	piv.instance=CreatePivot_( TEntity.EntityExists( parent ) )
+	Local instance:Byte Ptr=CreatePivot_( TEntity.EntityExists( parent ) )
+	Local piv:TPivot=globals.piv.NewPivot( instance )
 	Return piv
 End Function
 
@@ -1332,8 +1379,8 @@ Rem
 bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CreatePlane">Online doc</a>
 End Rem
 Function CreatePlane:TMesh( divisions:Int=1, parent:TEntity=Null )
-	Local mesh:TMesh=globals.mesh.NewMesh()
-	mesh.instance=CreatePlane_( divisions, TEntity.EntityExists( parent ) )
+	Local instance:Byte Ptr=CreatePlane_( divisions, TEntity.EntityExists( parent ) )
+	Local mesh:TMesh=globals.mesh.NewMesh( instance )
 	Return mesh
 End Function
 
@@ -1341,8 +1388,8 @@ Rem
 bbdoc: undocumented
 End Rem
 Function CreateQuad:TMesh( parent:TEntity=Null )
-	Local mesh:TMesh=globals.mesh.NewMesh()
-	mesh.instance=CreateQuad_( TEntity.EntityExists( parent ) )
+	Local instance:Byte Ptr=CreateQuad_( TEntity.EntityExists( parent ) )
+	Local mesh:TMesh=globals.mesh.NewMesh( instance )
 	Return mesh
 End Function
 
@@ -1350,8 +1397,8 @@ Rem
 bbdoc: undocumented
 End Rem
 Function CreateShadow:TShadowObject( parent:TMesh, Static:Int=False )
-	Local shad:TShadowObject=globals.shad.NewShadowObject()
-	shad.instance=CreateShadow_( parent.instance, Static )
+	Local instance:Byte Ptr=CreateShadow_( parent.instance, Static )
+	Local shad:TShadowObject=globals.shad.NewShadowObject( instance )
 	Return shad
 End Function
 
@@ -1359,8 +1406,8 @@ Rem
 bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CreateSphere">Online doc</a>
 End Rem
 Function CreateSphere:TMesh( segments:Int=8, parent:TEntity=Null )
-	Local mesh:TMesh=globals.mesh.NewMesh()
-	mesh.instance=CreateSphere_( segments, TEntity.EntityExists( parent ) )
+	Local instance:Byte Ptr=CreateSphere_( segments, TEntity.EntityExists( parent ) )
+	Local mesh:TMesh=globals.mesh.NewMesh( instance )
 	Return mesh
 End Function
 
@@ -1368,8 +1415,8 @@ Rem
 bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CreateSprite">Online doc</a>
 End Rem
 Function CreateSprite:TSprite( parent:TEntity=Null )
-	Local sprite:TSprite=globals.sprite.NewSprite()
-	sprite.instance=CreateSprite_( TEntity.EntityExists( parent ) )
+	Local instance:Byte Ptr=CreateSprite_( TEntity.EntityExists( parent ) )
+	Local sprite:TSprite=globals.sprite.NewSprite( instance )
 	Return sprite
 End Function
 
@@ -1377,8 +1424,8 @@ Rem
 bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CreateSurface">Online doc</a>
 End Rem
 Function CreateSurface:TSurface( mesh:TMesh, brush:TBrush=Null )
-	Local surf:TSurface=globals.mesh.NewSurface()
-	surf.instance=CreateSurface_( mesh.instance, globals.brush.BrushExists( brush ) )
+	Local instance:Byte Ptr=CreateSurface_( mesh.instance, globals.brush.BrushExists( brush ) )
+	Local surf:TSurface=globals.surf.NewSurface( instance )
 	Return surf
 End Function
 
@@ -1386,8 +1433,8 @@ Rem
 bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CreateTerrain">Online doc</a>
 End Rem
 Function CreateTerrain:TTerrain( size:Int, parent:TEntity=Null )
-	Local terr:TTerrain=globals.terr.NewTerrain()
-	terr.instance=CreateTerrain_( size, TEntity.EntityExists( parent ) )
+	Local instance:Byte Ptr=CreateTerrain_( size, TEntity.EntityExists( parent ) )
+	Local terr:TTerrain=globals.terr.NewTerrain( instance )
 	Return terr
 End Function
 
@@ -1395,8 +1442,8 @@ Rem
 bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CreateTexture">Online doc</a>
 End Rem
 Function CreateTexture:TTexture( width:Int, height:Int, flags:Int=9, frames:Int=1 )
-	Local tex:TTexture=globals.tex.NewTexture()
-	tex.instance=CreateTexture_( width, height, flags, frames )
+	Local instance:Byte Ptr=CreateTexture_( width, height, flags, frames )
+	Local tex:TTexture=globals.tex.NewTexture( instance )
 	Return tex
 End Function
 
@@ -1404,8 +1451,8 @@ Rem
 bbdoc: undocumented
 End Rem
 Function CreateVoxelSprite:TVoxelSprite( slices:Int=64, parent:TEntity=Null )
-	Local voxelspr:TVoxelSprite=globals.voxelspr.NewVoxelSprite()
-	voxelspr.instance=CreateVoxelSprite_( slices, TEntity.EntityExists( parent ) )
+	Local instance:Byte Ptr=CreateVoxelSprite_( slices, TEntity.EntityExists( parent ) )
+	Local voxelspr:TVoxelSprite=globals.voxelspr.NewVoxelSprite( instance )
 	Return voxelspr
 End Function
 
@@ -1504,7 +1551,7 @@ Rem
 bbdoc: undocumented
 End Rem
 Function FreeShadow( shad:TShadowObject )
-	shad.DeleteShadowObject()
+	shad.DeleteShadowObject( shad.instance )
 	FreeShadow_( shad.instance )
 End Function
 
@@ -1512,22 +1559,25 @@ Rem
 bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=GetBrushTexture">Online doc</a>
 End Rem
 Function GetBrushTexture:TTexture( brush:TBrush, index:Int=0 )
-	Return globals.tex.GetTexture( GetBrushTexture_( brush.instance, index ) )
+	Local instance:Byte Ptr=GetBrushTexture_( brush.instance, index )
+	Local tex:TTexture=globals.tex.TextureValue( instance )
+	If tex=Null And instance<>Null Then tex=globals.tex.NewTexture( instance )
+	Return tex
 End Function
 
 Rem
 bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=LinePick">Online doc</a>
 End Rem
 Function LinePick:TEntity( x:Float, y:Float, z:Float, dx:Float, dy:Float, dz:Float, radius:Float=0 )
-	Return globals.ent.GetEntity( LinePick_( x, y, z, dx, dy, dz, radius ) )
+	Return globals.ent.EntityValue( LinePick_( x, y, z, dx, dy, dz, radius ) )
 End Function
 
 Rem
 bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=LoadAnimMesh">Online doc</a>
 End Rem
 Function LoadAnimMesh:TMesh( file:String, parent:TEntity=Null )
-	Local mesh:TMesh=globals.mesh.NewMesh()
-	mesh.instance=LoadAnimMesh_( file.ToCString(), TEntity.EntityExists( parent ) )
+	Local instance:Byte Ptr=LoadAnimMesh_( file.ToCString(), TEntity.EntityExists( parent ) )
+	Local mesh:TMesh=globals.mesh.NewMesh( instance )
 	Return mesh
 End Function
 
@@ -1535,8 +1585,8 @@ Rem
 bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=LoadBrush">Online doc</a>
 End Rem
 Function LoadBrush:TBrush( file:String, flags:Int=1, u_scale:Float=1, v_scale:Float=1 )
-	Local brush:TBrush=globals.brush.NewBrush()
-	brush.instance=LoadBrush_( file.ToCString(), flags, u_scale, v_scale )
+	Local instance:Byte Ptr=LoadBrush_( file.ToCString(), flags, u_scale, v_scale )
+	Local brush:TBrush=globals.brush.NewBrush( instance )
 	Return brush
 End Function
 
@@ -1544,8 +1594,8 @@ Rem
 bbdoc: undocumented
 End Rem
 Function LoadGeosphere:TGeosphere( file:String, parent:TEntity=Null )
-	Local geo:TGeosphere=globals.geo.NewGeosphere()
-	geo.instance=LoadGeosphere_( file.ToCString(), TEntity.EntityExists( parent ) )
+	Local instance:Byte Ptr=LoadGeosphere_( file.ToCString(), TEntity.EntityExists( parent ) )
+	Local geo:TGeosphere=globals.geo.NewGeosphere( instance )
 	Return geo
 End Function
 
@@ -1553,8 +1603,8 @@ Rem
 bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=LoadMesh">Online doc</a>
 End Rem
 Function LoadMesh:TMesh( file:String, parent:TEntity=Null )
-	Local mesh:TMesh=globals.mesh.NewMesh()
-	mesh.instance=LoadMesh_( file.ToCString(), TEntity.EntityExists( parent ) )
+	Local instance:Byte Ptr=LoadMesh_( file.ToCString(), TEntity.EntityExists( parent ) )
+	Local mesh:TMesh=globals.mesh.NewMesh( instance )
 	Return mesh
 End Function
 
@@ -1562,8 +1612,8 @@ Rem
 bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=LoadTerrain">Online doc</a>
 End Rem
 Function LoadTerrain:TTerrain( file:String, parent:TEntity=Null )
-	Local terr:TTerrain=globals.terr.NewTerrain()
-	terr.instance=LoadTerrain_( file.ToCString(), TEntity.EntityExists( parent ) )
+	Local instance:Byte Ptr=LoadTerrain_( file.ToCString(), TEntity.EntityExists( parent ) )
+	Local terr:TTerrain=globals.terr.NewTerrain( instance )
 	Return terr
 End Function
 
@@ -1571,8 +1621,8 @@ Rem
 bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=LoadTexture">Online doc</a>
 End Rem
 Function LoadTexture:TTexture( file:String, flags:Int=1 )
-	Local tex:TTexture=globals.tex.NewTexture()
-	tex.instance=LoadTexture_( file.ToCString(), flags )
+	Local instance:Byte Ptr=LoadTexture_( file.ToCString(), flags )
+	Local tex:TTexture=globals.tex.NewTexture( instance )
 	Return tex
 End Function
 
@@ -1580,8 +1630,8 @@ Rem
 bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=LoadSprite">Online doc</a>
 End Rem
 Function LoadSprite:TSprite( tex_file:String, tex_flag:Int=1, parent:TEntity=Null )
-	Local sprite:TSprite=globals.sprite.NewSprite()
-	sprite.instance=LoadSprite_( tex_file.ToCString(), tex_flag, TEntity.EntityExists( parent ) )
+	Local instance:Byte Ptr=LoadSprite_( tex_file.ToCString(), tex_flag, TEntity.EntityExists( parent ) )
+	Local sprite:TSprite=globals.sprite.NewSprite( instance )
 	Return sprite
 End Function
 
@@ -1589,8 +1639,8 @@ Rem
 bbdoc: undocumented
 End Rem
 Function MeshCSG:TMesh( m1:TMesh, m2:TMesh, method_no:Int=1 )
-	Local mesh:TMesh=globals.mesh.NewMesh()
-	mesh.instance=MeshCSG_( m1.instance, m2.instance, method_no )
+	Local instance:Byte Ptr=MeshCSG_( m1.instance, m2.instance, method_no )
+	Local mesh:TMesh=globals.mesh.NewMesh( instance )
 	Return mesh
 End Function
 
@@ -1612,8 +1662,8 @@ Rem
 bbdoc: Like CopyMesh but for instancing effects.
 End Rem
 Function RepeatMesh:TMesh( mesh:TMesh, parent:TEntity=Null )
-	Local copy:TMesh=globals.mesh.NewMesh()
-	copy.instance=RepeatMesh_( mesh.instance, TEntity.EntityExists( parent ) )
+	Local instance:Byte Ptr=RepeatMesh_( mesh.instance, TEntity.EntityExists( parent ) )
+	Local copy:TMesh=globals.mesh.NewMesh( instance )
 	Return copy
 End Function
 
@@ -1749,8 +1799,8 @@ Rem
 bbdoc: undocumented
 End Rem
 Function CreateOcTree:TOcTree( w:Float, h:Float, d:Float, parent_ent:TEntity=Null )
-	Local octree:TOcTree=globals.octree.NewOcTree()
-	octree.instance=CreateOcTree_( w, h, d, TEntity.EntityExists( parent_ent ) )
+	Local instance:Byte Ptr=CreateOcTree_( w, h, d, TEntity.EntityExists( parent_ent ) )
+	Local octree:TOcTree=globals.octree.NewOcTree( instance )
 	Return octree
 End Function
 

+ 147 - 126
openb3d.mod/openb3dlib.bmx

@@ -24,7 +24,7 @@
 
 Strict
 
-Import brl.linkedlist
+Import brl.map
 Import brl.Graphics
 Import b3d.OpenB3dLib
 
@@ -36,6 +36,7 @@ Extern
 	Function BackBufferToTex_( tex:Byte Ptr, frame:Int )="BackBufferToTex"
 	Function BufferToTex_( tex:Byte Ptr, buffer:Byte Ptr, frame:Int )="BufferToTex"
 	Function CameraToTex_( tex:Byte Ptr, cam:Byte Ptr, frame:Int )="CameraToTex"
+	Function DepthBufferToTex_( tex:Byte Ptr, frame:Int )="DepthBufferToTex"
 	Function TexToBuffer_( tex:Byte Ptr, buffer:Byte Ptr, frame:Int )="TexToBuffer"
 ' Minib3d Only
 	Function MeshCullRadius_( ent:Byte Ptr, radius:Float )="MeshCullRadius"
@@ -90,11 +91,13 @@ Extern
 	Function CountSurfaces_:Int( mesh:Byte Ptr )="CountSurfaces"
 	Function CountTriangles_:Int( surf:Byte Ptr )="CountTriangles"
 	Function CountVertices_:Int( surf:Byte Ptr )="CountVertices"
+	Function CreateBlob_:Byte Ptr( fluid:Byte Ptr, radius:Float, parent_ent:Byte Ptr )="CreateBlob"
 	Function CreateBrush_:Byte Ptr( r:Float, g:Float, b:Float )="CreateBrush"
 	Function CreateCamera_:Byte Ptr( parent:Byte Ptr )="CreateCamera"
 	Function CreateCone_:Byte Ptr( segments:Int, solid:Int, parent:Byte Ptr )="CreateCone"
 	Function CreateCylinder_:Byte Ptr( segments:Int, solid:Int, parent:Byte Ptr )="CreateCylinder"
 	Function CreateCube_:Byte Ptr( parent:Byte Ptr )="CreateCube"
+	Function CreateFluid_:Byte Ptr()="CreateFluid"
 	Function CreateGeosphere_:Byte Ptr( size:Int, parent:Byte Ptr )="CreateGeosphere"
 	Function CreateMesh_:Byte Ptr( parent:Byte Ptr )="CreateMesh"
 	Function CreateLight_:Byte Ptr( light_type:Int, parent:Byte Ptr )="CreateLight"
@@ -215,6 +218,7 @@ Extern
 	Function SetCubeFace_( tex:Byte Ptr, face:Int )="SetCubeFace"
 	Function SetCubeMode_( tex:Byte Ptr, Mode:Int )="SetCubeMode"
 	Function ShowEntity_( ent:Byte Ptr )="ShowEntity"
+	Function SpriteRenderMode_( sprite:Byte Ptr, Mode:Int )="SpriteRenderMode"
 	Function SpriteViewMode_( sprite:Byte Ptr, Mode:Int )="SpriteViewMode"
 	Function StencilAlpha_( stencil:Byte Ptr, a:Float )="StencilAlpha"
 	Function StencilClsColor_( stencil:Byte Ptr, r:Float, g:Float, b:Float )="StencilClsColor"
@@ -303,8 +307,6 @@ End Extern
 
 Private
 
-'Global libDirs$[] = ["" , CurrentDir()+"/" , "BlitzMax/mod/angros.mod/openb3d.mod/"] ' install location
-Global hLib:Int
 Global globals:TGlobal=New TGlobal
 
 Public
@@ -383,9 +385,11 @@ End Function
 
 Type TGlobal
 
+	Global blob:TBlob=New TBlob
 	Global brush:TBrush=New TBrush
 	Global cam:TCamera=New TCamera
 	Global ent:TEntity=New TEntity
+	Global fluid:TFluid=New TFluid
 	Global geo:TGeosphere=New TGeosphere
 	Global light:TLight=New TLight
 	Global mat:TMaterial=New TMaterial
@@ -396,46 +400,53 @@ Type TGlobal
 	Global shad:TShadowObject=New TShadowObject
 	Global sprite:TSprite=New TSprite
 	Global stencil:TStencil=New TStencil
+	Global surf:TSurface=New TSurface
 	Global terr:TTerrain=New TTerrain
 	Global tex:TTexture=New TTexture
 	Global voxelspr:TVoxelSprite=New TVoxelSprite
 
 End Type
 
+Rem
+bbdoc: Blob entity
+End Rem
+Type TBlob Extends TEntity
+
+	Method NewBlob:TBlob( inst:Byte Ptr )
+	
+		Local blob:TBlob=New TBlob
+		entity_map.Insert( String(Long(inst)), blob )
+		blob.instance=inst
+		Return blob
+		
+	End Method
+	
+End Type
+
 Type TBrush
 
-	Global brush_list:TList=CreateList()
+	Global brush_map:TMap=New TMap
 
 	Field instance:Byte Ptr
-	Field last_instance:Byte Ptr
-	Field last_brush:TBrush
 	
-	Method NewBrush:TBrush()
+	Method NewBrush:TBrush( inst:Byte Ptr )
 	
 		Local brush:TBrush=New TBrush
-		ListAddLast( brush_list, brush )
+		brush_map.Insert( String(Long(inst)), brush )
+		brush.instance=inst
 		Return brush
 		
 	End Method
 	
-	Method DeleteBrush()
+	Method DeleteBrush( inst:Byte Ptr )
 	
-		ListRemove( brush_list, Self )
+		brush_map.Remove( String(Long(inst)) )
 	
 	End Method
 	
-	Method GetBrush:TBrush( instance:Byte Ptr )
+	Method BrushValue:TBrush( inst:Byte Ptr )
 	
-		If last_instance=instance Then Return last_brush
-		
-		For Local brush:TBrush=EachIn brush_list
-			If brush.instance=instance
-				last_instance=instance
-				last_brush=brush
-				Return brush
-			EndIf
-		Next
-		Return Null
+		Return TBrush( brush_map.ValueForKey( String(Long(inst)) ) )
 	
 	End Method
 	
@@ -453,10 +464,11 @@ End Type
 
 Type TCamera Extends TEntity
 
-	Method NewCamera:TCamera()
+	Method NewCamera:TCamera( inst:Byte Ptr )
 	
 		Local cam:TCamera=New TCamera
-		ListAddLast( entity_list, cam )
+		entity_map.Insert( String(Long(inst)), cam )
+		cam.instance=inst
 		Return cam
 		
 	End Method
@@ -465,41 +477,31 @@ End Type
 
 Type TEntity
 
-	Global entity_list:TList=CreateList()
+	Global entity_map:TMap=New TMap
 
 	Field instance:Byte Ptr
-	Field last_instance:Byte Ptr
-	Field last_ent:TEntity
 	
-	Method NewEntity:TEntity()
+	Method NewEntity:TEntity(inst:Byte Ptr)
 
 		Local ent:TEntity=New TEntity
-		ListAddLast( entity_list, ent )
+		entity_map.Insert( String(Long(inst)), ent )
+		ent.instance=inst
 		Return ent
 		
 	End Method
 	
-	Method DeleteEntity()
+	Method DeleteEntity(inst:Byte Ptr)
 	
-		ListRemove( entity_list, Self )
+		entity_map.Remove( String(Long(inst)) )
 	
 	End Method
+
+	Method EntityValue:TEntity( inst:Byte Ptr )
 	
-	Method GetEntity:TEntity( instance:Byte Ptr )
-	
-		If last_instance=instance Then Return last_ent
-		
-		For Local ent:TEntity=EachIn entity_list
-			If ent.instance=instance
-				last_instance=instance
-				last_ent=ent
-				Return ent
-			EndIf
-		Next
-		Return Null
+		Return TEntity( entity_map.ValueForKey( String(Long(inst)) ) )
 	
 	End Method
-	
+
 	Function EntityExists:Byte Ptr( ent:TEntity )
 	
 		If ent=Null
@@ -513,12 +515,13 @@ Type TEntity
 	' Recursively counts all children of an entity.
 	Function CountAllChildren:Int( ent:TEntity, no_children:Int=0 )
 
-		Local children%=CountChildren_( ent.instance )
+		Local children%=CountChildren( ent )
 		
-		For Local ent2:Int=1 To children
-			no_children=no_children+1
-			no_children=CountAllChildren( GetChild( ent, ent2 ), no_children)
+		For Local id:Int=1 To children
+			no_children :+ 1
+			no_children=CountAllChildren( GetChild( ent, id ), no_children)
 		Next
+		
 		Return no_children
 		
 	End Function
@@ -527,18 +530,36 @@ Type TEntity
 	Method GetChildFromAll:TEntity( child_no:Int, no_children:Int Var, ent:TEntity=Null )
 
 		If ent=Null Then ent=Self
-		Local ent3:TEntity=Null
-		Local children%= CountChildren_( ent.instance )
 		
-		For Local ent2:Int=1 To children
+		Local ent2:TEntity=Null
+		Local children%=CountChildren( ent )
+		
+		For Local id:Int=1 To children
 			no_children=no_children+1
-			If no_children=child_no Then Return GetChild( ent, ent2 )
+			If no_children=child_no Then Return GetChild( ent, id )
 			
-			If ent3=Null
-				ent3=GetChildFromAll( child_no, no_children, GetChild( ent, ent2 ) )
+			If ent2=Null
+				ent2=GetChildFromAll( child_no, no_children, GetChild( ent, id ) )
 			EndIf
 		Next
-		Return ent3
+		
+		Return ent2
+		
+	End Method
+	
+End Type
+
+Rem
+bbdoc: Fluid mesh entity
+End Rem
+Type TFluid Extends TMesh
+
+	Method NewFluid:TFluid( inst:Byte Ptr )
+	
+		Local fluid:TFluid=New TFluid
+		entity_map.Insert( String(Long(inst)), fluid )
+		fluid.instance=inst
+		Return fluid
 		
 	End Method
 	
@@ -546,10 +567,11 @@ End Type
 
 Type TGeosphere Extends TTerrain
 
-	Method NewGeosphere:TGeosphere()
+	Method NewGeosphere:TGeosphere(inst:Byte Ptr)
 	
 		Local geo:TGeosphere=New TGeosphere
-		ListAddLast( entity_list, geo )
+		entity_map.Insert( String(Long(inst)), geo )
+		geo.instance=inst
 		Return geo
 		
 	End Method
@@ -558,10 +580,11 @@ End Type
 
 Type TLight Extends TEntity
 
-	Method NewLight:TLight()
+	Method NewLight:TLight( inst:Byte Ptr )
 	
 		Local light:TLight=New TLight
-		ListAddLast( entity_list, light )
+		entity_map.Insert( String(Long(inst)), light )
+		light.instance=inst
 		Return light
 		
 	End Method
@@ -570,10 +593,11 @@ End Type
 
 Type TMaterial Extends TTexture
 
-	Method NewMaterial:TMaterial()
+	Method NewMaterial:TMaterial( inst:Byte Ptr )
 	
 		Local mat:TMaterial=New TMaterial
-		ListAddLast( tex_list, mat )
+		tex_map.Insert( String(Long(inst)), mat )
+		mat.instance=inst
 		Return mat
 		
 	End Method
@@ -582,50 +606,24 @@ End Type
 
 Type TMesh Extends TEntity
 
-	Global surf_list:TList=CreateList()
-	
-	Field last_surf_instance:Byte Ptr
-	Field last_surf:TSurface
-	
-	Method NewMesh:TMesh()
+	Method NewMesh:TMesh( inst:Byte Ptr )
 	
 		Local mesh:TMesh=New TMesh
-		ListAddLast( entity_list, mesh )
+		entity_map.Insert( String(Long(inst)), mesh )
+		mesh.instance=inst
 		Return mesh
 		
 	End Method
 	
-	Method NewSurface:TSurface()
-	
-		Local surf:TSurface=New TSurface
-		ListAddLast( surf_list, surf )
-		Return surf
-		
-	End Method
-	
-	Method GetSurface:TSurface( instance:Byte Ptr )
-	
-		If last_surf_instance=instance Then Return last_surf
-		
-		For Local surf:TSurface=EachIn surf_list
-			If surf.instance=instance
-				last_surf_instance=instance
-				last_surf=surf
-				Return surf
-			EndIf
-		Next
-		Return Null
-	
-	End Method
-	
 End Type
 
 Type TOcTree Extends TTerrain
 
-	Method NewOcTree:TOcTree()
+	Method NewOcTree:TOcTree( inst:Byte Ptr )
 	
 		Local octree:TOcTree=New TOcTree
-		ListAddLast( entity_list, octree )
+		entity_map.Insert( String(Long(inst)), octree )
+		octree.instance=inst
 		Return octree
 		
 	End Method
@@ -634,10 +632,11 @@ End Type
 
 Type TPivot Extends TEntity
 
-	Method NewPivot:TPivot()
+	Method NewPivot:TPivot( inst:Byte Ptr )
 	
 		Local piv:TPivot=New TPivot
-		ListAddLast( entity_list, piv )
+		entity_map.Insert( String(Long(inst)), piv )
+		piv.instance=inst
 		Return piv
 		
 	End Method
@@ -648,9 +647,10 @@ Type TShader
 
 	Field instance:Byte Ptr
 	
-	Method NewShader:TShader()
+	Method NewShader:TShader( inst:Byte Ptr )
 	
 		Local material:TShader=New TShader
+		material.instance=inst
 		Return material
 		
 	End Method
@@ -659,21 +659,22 @@ End Type
 
 Type TShadowObject
 
-	Global shad_list:TList=CreateList()
+	Global shad_map:TMap=New TMap
 
 	Field instance:Byte Ptr
 	
-	Method NewShadowObject:TShadowObject()
+	Method NewShadowObject:TShadowObject( inst:Byte Ptr )
 	
 		Local shad:TShadowObject=New TShadowObject
-		ListAddLast( shad_list, shad )
+		shad_map.Insert( String(Long(inst)), shad )
+		shad.instance=inst
 		Return shad
 		
 	End Method
 	
-	Method DeleteShadowObject()
+	Method DeleteShadowObject( inst:Byte Ptr )
 	
-		ListRemove( shad_list, Self )
+		shad_map.Remove( String(Long(inst)) )
 	
 	End Method
 	
@@ -681,10 +682,11 @@ End Type
 
 Type TSprite Extends TMesh
 
-	Method NewSprite:TSprite()
+	Method NewSprite:TSprite( inst:Byte Ptr )
 	
 		Local sprite:TSprite=New TSprite
-		ListAddLast( entity_list, sprite )
+		entity_map.Insert( String(Long(inst)), sprite )
+		sprite.instance=inst
 		Return sprite
 		
 	End Method
@@ -695,67 +697,85 @@ Type TStencil
 
 	Field instance:Byte Ptr
 	
-	Method NewStencil:TStencil()
+	Method NewStencil:TStencil( inst:Byte Ptr )
 	
 		Local stencil:TStencil=New TStencil
+		stencil.instance=inst
 		Return stencil
 		
 	End Method
 	
 End Type
 
+Rem
+bbdoc: Surface
+End Rem
 Type TSurface
 
+	Global surf_map:TMap=New TMap
+	
 	Field instance:Byte Ptr
 	
+	Method NewSurface:TSurface( inst:Byte Ptr )
+	
+		Local surf:TSurface=New TSurface
+		surf_map.Insert( String(Long(inst)), surf )
+		surf.instance=inst
+		Return surf
+		
+	End Method
+	
+	Method SurfaceValue:TSurface( inst:Byte Ptr )
+	
+		Return TSurface( surf_map.ValueForKey( String(Long(inst)) ) )
+	
+	End Method
+	
 End Type
 
+Rem
+bbdoc: Terrain entity
+End Rem
 Type TTerrain Extends TEntity
 
-	Method NewTerrain:TTerrain()
+	Method NewTerrain:TTerrain( inst:Byte Ptr )
 	
 		Local terr:TTerrain=New TTerrain
-		ListAddLast( entity_list, terr )
+		entity_map.Insert( String(Long(inst)), terr )
+		terr.instance=inst
 		Return terr
 		
 	End Method
 	
 End Type
 
+Rem
+bbdoc: Texture
+End Rem
 Type TTexture
 
-	Global tex_list:TList=CreateList()
+	Global tex_map:TMap=New TMap
 
 	Field instance:Byte Ptr
-	Field last_instance:Byte Ptr
-	Field last_tex:TTexture
 	
-	Method NewTexture:TTexture()
+	Method NewTexture:TTexture( inst:Byte Ptr )
 	
 		Local tex:TTexture=New TTexture
-		ListAddLast( tex_list, tex )
+		tex_map.Insert( String(Long(inst)), tex )
+		tex.instance=inst
 		Return tex
 		
 	End Method
 	
-	Method DeleteTexture()
+	Method DeleteTexture( inst:Byte Ptr )
 	
-		ListRemove( tex_list, Self )
+		tex_map.Remove( String(Long(inst)) )
 	
 	End Method
 	
-	Method GetTexture:TTexture( instance:Byte Ptr )
+	Method TextureValue:TTexture( inst:Byte Ptr )
 	
-		If last_instance=instance Then Return last_tex
-		
-		For Local tex:TTexture=EachIn tex_list
-			If tex.instance=instance
-				last_instance=instance
-				last_tex=tex
-				Return tex
-			EndIf
-		Next
-		Return Null
+		Return TTexture( tex_map.ValueForKey( String(Long(inst)) ) )
 	
 	End Method
 	
@@ -763,14 +783,15 @@ End Type
 
 Type TVoxelSprite Extends TMesh
 
-	Method NewVoxelSprite:TVoxelSprite()
+	Method NewVoxelSprite:TVoxelSprite( inst:Byte Ptr )
 	
 		Local voxelspr:TVoxelSprite=New TVoxelSprite
-		ListAddLast( entity_list, voxelspr )
+		entity_map.Insert( String(Long(inst)), voxelspr )
+		voxelspr.instance=inst
 		Return voxelspr
 		
 	End Method
-	
+		
 End Type
 
 

+ 11 - 7
openb3dlib.mod/openb3d/src/functions.cpp

@@ -23,6 +23,10 @@ void BackBufferToTex(Texture* tex,int frame){
 	tex->BackBufferToTex(frame);
 }
 
+void DepthBufferToTex(Texture* tex,int frame){
+	tex->DepthBufferToTex(frame);
+}
+
 void CameraToTex(Texture* tex, Camera* cam, int frame){
 	tex->CameraToTex(cam,frame);
 }
@@ -866,13 +870,13 @@ void Graphics3D(int width,int height,int depth,int mode,int rate){
 }
 
 /*
-*/
-void GraphicsResize(int width,int height){
-	Global::width=width;
-	Global::height=height;
-}
-
-/*
+*/
+void GraphicsResize(int width,int height){
+	Global::width=width;
+	Global::height=height;
+}
+
+/*
 bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=HandleSprite">Online Help</a>
 */
 void HandleSprite(Sprite* sprite,float h_x,float h_y){

+ 1193 - 1192
openb3dlib.mod/openb3d/src/functions.h

@@ -1,1192 +1,1193 @@
-#ifndef __functions_h__
-#define __functions_h__
-
-// functions
-extern "C" {
-
-void BufferToTex(Texture* tex,unsigned char* buffer, int frame);
-void BackBufferToTex(Texture* tex,int frame);
-void TexToBuffer(Texture* tex,unsigned char* buffer, int frame);
-
-
-/*
-bbdoc: Minib3d Only
-about:
-This command is the equivalent of Blitz3D's MeshCullBox command.
-
-It is used to set the radius of a mesh's 'cull sphere' - if the 'cull sphere' is not inside the viewing area, the mesh will not
-be rendered.
-
-A mesh's cull radius is set automatically, therefore in most cases you will not have to use this command.
-
-One time you may have to use it is for animated meshes where the default cull radius may not take into account all animation
-positions, resulting in the mesh being wrongly culled at extreme positions.
-*/
-void MeshCullRadius(Entity* ent, float radius);
-// Blitz3D functions, A-Z
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=AddAnimSeq">Online Help</a>
-*/
-int AddAnimSeq(Entity* ent,int length);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=AddMesh">Online Help</a>
-*/
-void AddMesh(Mesh* mesh1,Mesh* mesh2);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=AddTriangle">Online Help</a>
-*/
-int AddTriangle(Surface* surf,int v0,int v1,int v2);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=AddVertex">Online Help</a>
-*/
-int AddVertex(Surface* surf,float x, float y,float z,float u, float v,float w);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=AmbientLight">Online Help</a>
-*/
-void AmbientLight(float r,float g,float b);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=AntiAlias">Online Help</a>
-*/
-void AntiAlias(int samples);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=Animate">Online Help</a>
-*/
-void Animate(Entity* ent,int mode,float speed,int seq,int trans);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=Animating">Online Help</a>
-*/
-int Animating(Entity* ent);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=AnimLength">Online Help</a>
-*/
-int AnimLength(Entity* ent);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=AnimSeq">Online Help</a>
-*/
-int AnimSeq(Entity* ent);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=AnimTime">Online Help</a>
-*/
-float AnimTime(Entity* ent);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=BrushAlpha">Online Help</a>
-*/
-void BrushAlpha(Brush* brush, float a);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=BrushBlend">Online Help</a>
-*/
-void BrushBlend(Brush* brush,int blend);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=BrushColor">Online Help</a>
-*/
-void BrushColor(Brush* brush,float r,float g,float b);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=BrushFX">Online Help</a>
-*/
-void BrushFX(Brush* brush,int fx);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=BrushShininess">Online Help</a>
-*/
-void BrushShininess(Brush* brush,float s);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=BrushTexture">Online Help</a>
-*/
-void BrushTexture(Brush* brush,Texture* tex,int frame,int index);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CameraClsColor">Online Help</a>
-*/
-void CameraClsColor(Camera* cam, float r,float g,float b);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CameraClsMode">Online Help</a>
-*/
-void CameraClsMode(Camera* cam,int cls_depth,int cls_zbuffer);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CameraFogColor">Online Help</a>
-*/
-void CameraFogColor(Camera* cam,float r,float g,float b);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CameraFogMode">Online Help</a>
-*/
-void CameraFogMode(Camera* cam,int mode);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CameraFogRange">Online Help</a>
-*/
-void CameraFogRange(Camera* cam,float nnear,float nfar);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CameraPick">Online Help</a>
-*/
-Entity* CameraPick(Camera* cam,float x,float y);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CameraProject">Online Help</a>
-*/
-void CameraProject(Camera* cam,float x,float y,float z);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CameraProjMode">Online Help</a>
-*/
-void  CameraProjMode(Camera* cam,int mode);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CameraRange">Online Help</a>
-*/
-void  CameraRange(Camera* cam,float nnear,float nfar);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CameraViewport">Online Help</a>
-*/
-void  CameraViewport(Camera* cam,int x,int y,int width,int height);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CameraZoom">Online Help</a>
-*/
-void  CameraZoom(Camera* cam,float zoom);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=ClearCollisions">Online Help</a>
-int ClearCollisions(){
-	Global::ClearCollisions();
-}
-*/
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=ClearSurface">Online Help</a>
-*/
-void ClearSurface(Surface* surf,bool clear_verts,bool clear_tris);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=ClearTextureFilters">Online Help</a>
-*/
-void ClearTextureFilters();
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=ClearWorld">Online Help</a>
-*/
-void ClearWorld(bool entities,bool brushes,bool textures);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CollisionEntity">Online Help</a>
-*/
-Entity* CollisionEntity(Entity* ent,int index);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=Collisions">Online Help</a>
-*/
-void Collisions(int src_no,int dest_no,int method_no,int response_no);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CollisionNX">Online Help</a>
-*/
-float CollisionNX(Entity* ent,int index);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CollisionNY">Online Help</a>
-*/
-float CollisionNY(Entity* ent,int index);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CollisionNZ">Online Help</a>
-*/
-float CollisionNZ(Entity* ent,int index);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CollisionSurface">Online Help</a>
-*/
-Surface* CollisionSurface(Entity* ent,int index);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CollisionTime">Online Help</a>
-*/
-float CollisionTime(Entity* ent,int index);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CollisionTriangle">Online Help</a>
-*/
-int CollisionTriangle(Entity* ent,int index);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CollisionX">Online Help</a>
-*/
-float CollisionX(Entity* ent,int index);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CollisionY">Online Help</a>
-*/
-float CollisionY(Entity* ent,int index);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CollisionZ">Online Help</a>
-*/
-float CollisionZ(Entity* ent,int index);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CountChildren">Online Help</a>
-*/
-int CountChildren(Entity* ent);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CountCollisions">Online Help</a>
-*/
-int CountCollisions(Entity* ent);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CopyEntity">Online Help</a>
-*/
-Entity* CopyEntity(Entity* ent,Entity* parent);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CopyMesh">Online Help</a>
-*/
-Mesh* CopyMesh(Mesh* mesh,Entity* parent);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CountSurfaces">Online Help</a>
-*/
-int CountSurfaces(Mesh* mesh);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CountTriangles">Online Help</a>
-*/
-int CountTriangles(Surface* surf);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CountVertices">Online Help</a>
-*/
-int CountVertices(Surface* surf);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CreateBrush">Online Help</a>
-*/
-Brush* CreateBrush(float r,float g,float b);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CreateCamera">Online Help</a>
-*/
-Camera* CreateCamera(Entity* parent);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CreateCone">Online Help</a>
-*/
-Mesh* CreateCone(int segments,bool solid,Entity* parent);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CreateCylinder">Online Help</a>
-*/
-Mesh* CreateCylinder(int segments,bool solid,Entity* parent);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CreateCube">Online Help</a>
-*/
-Mesh* CreateCube(Entity* parent);
-
-Terrain* CreateGeosphere(int size, Entity* parent);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CreateMesh">Online Help</a>
-*/
-Mesh* CreateMesh(Entity* parent);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CreateLight">Online Help</a>
-*/
-Light* CreateLight(int light_type,Entity* parent);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CreatePivot">Online Help</a>
-*/
-Pivot* CreatePivot(Entity* parent);
-
-Mesh* CreatePlane(int divisions,Entity* parent);
-
-Mesh* CreateQuad(Entity* parent);
-
-ShadowObject* CreateShadow(Mesh* parent, char Static);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CreateSphere">Online Help</a>
-*/
-Mesh* CreateSphere(int segments,Entity* parent);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CreateSprite">Online Help</a>
-*/
-Sprite* CreateSprite(Entity* parent);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CreateSurface">Online Help</a>
-*/
-Surface* CreateSurface(Mesh* mesh,Brush* brush);
-
-/*
-*/
-Stencil* CreateStencil();
-
-/*
-*/
-Terrain* CreateTerrain(int size, Entity* parent);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CreateTexture">Online Help</a>
-*/
-Texture* CreateTexture(int width,int height,int flags,int frames);
-
-/*
-*/
-VoxelSprite* CreateVoxelSprite(int slices, Entity* parent);
-
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=DeltaPitch">Online Help</a>
-*/
-float DeltaPitch(Entity* ent1,Entity* ent2);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=DeltaYaw">Online Help</a>
-*/
-float DeltaYaw(Entity* ent1,Entity* ent2);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=EntityAlpha">Online Help</a>
-*/
-void EntityAlpha(Entity* ent,float alpha);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=EntityAutoFade">Online Help</a>
-*/
-void EntityAutoFade(Entity* ent,float near,float far);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=EntityBlend">Online Help</a>
-*/
-void EntityBlend(Entity* ent, int blend);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=EntityBox">Online Help</a>
-*/
-void EntityBox(Entity* ent,float x,float y,float z,float w,float h,float d);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=EntityClass">Online Help</a>
-*/
-const char* EntityClass(Entity* ent);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=EntityCollided">Online Help</a>
-*/
-Entity* EntityCollided(Entity* ent,int type_no);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=EntityColor">Online Help</a>
-*/
-void EntityColor(Entity* ent,float red,float green,float blue);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=EntityDistance">Online Help</a>
-*/
-float EntityDistance(Entity* ent1,Entity* ent2);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=EntityFX">Online Help</a>
-*/
-void EntityFX(Entity* ent,int fx);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=EntityInView">Online Help</a>
-*/
-int EntityInView(Entity* ent,Camera* cam);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=EntityName">Online Help</a>
-*/
-const char* EntityName(Entity* ent);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=EntityOrder">Online Help</a>
-*/
-void EntityOrder(Entity* ent,int order);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=EntityParent">Online Help</a>
-
-
-
-
-*/
-void EntityParent(Entity* ent,Entity* parent_ent,bool glob);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=EntityPick">Online Help</a>
-*/
-Entity* EntityPick(Entity* ent,float range);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=EntityPickMode">Online Help</a>
-*/
-void EntityPickMode(Entity* ent,int pick_mode,bool obscurer);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=EntityPitch">Online Help</a>
-*/
-float EntityPitch(Entity* ent,bool glob);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=EntityRadius">Online Help</a>
-*/
-void EntityRadius(Entity* ent,float radius_x,float radius_y);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=EntityRoll">Online Help</a>
-*/
-float EntityRoll(Entity* ent,bool glob);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=EntityShininess">Online Help</a>
-*/
-void EntityShininess(Entity* ent,float shine);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=EntityTexture">Online Help</a>
-*/
-void EntityTexture(Entity* ent,Texture* tex,int frame,int index);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=EntityType">Online Help</a>
-*/
-void EntityType(Entity* ent,int type_no,bool recursive);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=EntityVisible">Online Help</a>
-*/
-int EntityVisible(Entity* src_ent,Entity* dest_ent);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=EntityX">Online Help</a>
-*/
-float EntityX(Entity* ent,bool glob);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=EntityY">Online Help</a>
-*/
-float EntityY(Entity* ent,bool glob);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=EntityYaw">Online Help</a>
-*/
-float EntityYaw(Entity* ent,bool glob);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=EntityZ">Online Help</a>
-*/
-float EntityZ(Entity* ent,bool glob);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=ExtractAnimSeq">Online Help</a>
-*/
-int ExtractAnimSeq(Entity* ent,int first_frame,int last_frame,int seq);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=FindChild">Online Help</a>
-*/
-Entity* FindChild(Entity* ent,char* child_name);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=FindSurface">Online Help</a>
-*/
-Surface* FindSurface(Mesh* mesh,Brush* brush);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=FitMesh">Online Help</a><p>
-*/
-void FitMesh(Mesh* mesh,float x,float y,float z,float width,float height,float depth,bool uniform);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=FlipMesh">Online Help</a>
-*/
-void FlipMesh(Mesh* mesh);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=FreeBrush">Online Help</a>
-*/
-void  FreeBrush(Brush* brush);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=FreeEntity">Online Help</a>
-*/
-void FreeEntity(Entity* ent);
-
-void FreeShadow(ShadowObject* shad);
-
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=FreeTexture">Online Help</a>
-*/
-void FreeTexture(Texture* tex);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=GetBrushTexture">Online Help</a>
-*/
-Texture* GetBrushTexture(Brush* brush,int index);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=GetChild">Online Help</a>
-*/
-Entity* GetChild(Entity* ent,int child_no);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=GetEntityBrush">Online Help</a>
-*/
-Brush* GetEntityBrush(Entity* ent);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=GetEntityType">Online Help</a>
-*/
-int GetEntityType(Entity* ent);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=ResetEntity">Online Help</a>
-*/
-float GetMatElement(Entity* ent,int row,int col);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=GetParent">Online Help</a>
-*/
-Entity* GetParentEntity(Entity* ent);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=GetSurface">Online Help</a>
-*/
-Surface* GetSurface(Mesh* mesh,int surf_no);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=GetSurfaceBrush">Online Help</a>
-*/
-Brush* GetSurfaceBrush(Surface* surf);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=Graphics3D">Online Help</a>
-*/
-void Graphics3D(int width,int height,int depth,int mode,int rate);
-
-/*
-*/
-void GraphicsResize(int width,int height);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=HandleSprite">Online Help</a>
-*/
-void HandleSprite(Sprite* sprite,float h_x,float h_y);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=HideEntity">Online Help</a>
-*/
-void HideEntity(Entity* ent);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=LightColor">Online Help</a>
-*/
-void LightColor(Light* light,float red,float green,float blue);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=LightConeAngles">Online Help</a>
-*/
-void LightConeAngles(Light* light,float inner_ang,float outer_ang);
-
-/*
-
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=LightRange">Online Help</a>
-*/
-void LightRange(Light* light,float range);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=LinePick">Online Help</a>
-*/
-Entity* LinePick(float x,float y,float z,float dx,float dy,float dz,float radius);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=LoadAnimMesh">Online Help</a>
-*/
-Mesh* LoadAnimMesh(char* file,Entity* parent);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=LoadAnimTexture">Online Help</a>
-*/
-Texture* LoadAnimTexture(char* file,int flags,int frame_width,int frame_height,int first_frame,int frame_count);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=LoadBrush">Online Help</a>
-*/
-Brush* LoadBrush(char *file,int flags,float u_scale,float v_scale);
-
-Terrain* LoadGeosphere(char* file,Entity* parent);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=LoadMesh">Online Help</a>
-*/
-Mesh* LoadMesh(char* file,Entity* parent);
-
-
-Terrain* LoadTerrain(char* file,Entity* parent);
-
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=LoadTexture">Online Help</a>
-*/
-Texture* LoadTexture(char* file,int flags);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=LoadSprite">Online Help</a>
-*/
-Sprite* LoadSprite(char* tex_file,int tex_flag,Entity* parent);
-
-/*
-*/
-Mesh* MeshCSG(Mesh* m1, Mesh* m2, int method = 1);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=MeshDepth">Online Help</a>
-*/
-float MeshDepth(Mesh* mesh);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=MeshesIntersect">Online Help</a>
-*/
-int MeshesIntersect(Mesh* mesh1,Mesh* mesh2);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=MeshHeight">Online Help</a>
-*/
-float MeshHeight(Mesh* mesh);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=MeshWidth">Online Help</a>
-*/
-float MeshWidth(Mesh* mesh);
-
-void ModifyGeosphere(Geosphere* geo, int x, int z, float new_height);
-
-void ModifyTerrain(Terrain* terr, int x, int z, float new_height);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=MoveEntity">Online Help</a>
-*/
-void MoveEntity(Entity* ent,float x,float y,float z);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=NameEntity">Online Help</a>
-*/
-void NameEntity(Entity* ent,char* name);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=PaintEntity">Online Help</a>
-*/
-void PaintEntity(Entity* ent,Brush* brush);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=PaintMesh">Online Help</a>
-*/
-void PaintMesh(Mesh* mesh,Brush* brush);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=PaintSurface">Online Help</a>
-*/
-void PaintSurface(Surface* surf,Brush* brush);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=PickedEntity">Online Help</a>
-*/
-Entity* PickedEntity();
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=PickedNX">Online Help</a>
-*/
-float PickedNX();
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=PickedNY">Online Help</a>
-*/
-float PickedNY();
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=PickedNZ">Online Help</a>
-*/
-float PickedNZ();
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=PickedSurface">Online Help</a>
-*/
-Surface* PickedSurface();
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=PickedTime">Online Help</a>
-*/
-float PickedTime();
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=PickedTriangle">Online Help</a>
-*/
-int PickedTriangle();
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=PickedX">Online Help</a>
-*/
-float PickedX();
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=PickedY">Online Help</a>
-*/
-float PickedY();
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=PickedZ">Online Help</a>
-*/
-float PickedZ();
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=PointEntity">Online Help</a>
-*/
-void PointEntity(Entity* ent,Entity* target_ent,float roll);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=PositionEntity">Online Help</a>
-*/
-void PositionEntity(Entity* ent,float x,float y,float z,bool glob);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=PositionMesh">Online Help</a>
-*/
-void PositionMesh(Mesh* mesh,float px,float py,float pz);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=PositionTexture">Online Help</a>
-*/
-void PositionTexture(Texture* tex,float u_pos,float v_pos);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=ProjectedX">Online Help</a>
-*/
-float ProjectedX();
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=ProjectedY">Online Help</a>
-*/
-float ProjectedY();
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=ProjectedZ">Online Help</a>
-*/
-float ProjectedZ();
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=RenderWorld">Online Help</a>
-*/
-void RenderWorld();
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=RepeatMesh">Online Help</a>
-*/
-Mesh* RepeatMesh(Mesh* mesh,Entity* parent);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=ResetEntity">Online Help</a>
-*/
-void ResetEntity(Entity* ent);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=RotateEntity">Online Help</a>
-*/
-void RotateEntity(Entity* ent,float x,float y,float z,bool glob);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=RotateMesh">Online Help</a>
-*/
-void RotateMesh(Mesh* mesh,float pitch,float yaw,float roll);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=RotateSprite">Online Help</a>
-*/
-void RotateSprite(Sprite* sprite,float ang);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=RotateTexture">Online Help</a>
-*/
-void RotateTexture(Texture* tex,float ang);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=ScaleEntity">Online Help</a>
-*/
-void ScaleEntity(Entity* ent,float x,float y,float z,bool glob);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=ScaleMesh">Online Help</a>
-*/
-void ScaleMesh(Mesh* mesh,float sx,float sy,float sz);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=ScaleSprite">Online Help</a>
-*/
-void ScaleSprite(Sprite* sprite,float s_x,float s_y);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=ScaleTexture">Online Help</a>
-*/
-void ScaleTexture(Texture* tex,float u_scale,float v_scale);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=SetAnimTime">Online Help</a>
-*/
-void SetAnimTime(Entity* ent,float time,int seq);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=SetCubeFace">Online Help</a>
-*/
-void SetCubeFace(Texture* tex,int face);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=SetCubeMode">Online Help</a>
-*/
-void SetCubeMode(Texture* tex,int mode);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=ShowEntity">Online Help</a>
-*/
-void ShowEntity(Entity* ent);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=SpriteViewMode">Online Help</a>
-*/
-void SpriteViewMode(Sprite* sprite,int mode);
-
-/*
-*/
-void StencilAlpha(Stencil* stencil, float a);
-
-/*
-*/
-void StencilClsColor(Stencil* stencil, float r,float g,float b);
-
-/*
-*/
-void StencilClsMode(Stencil* stencil,int cls_depth,int cls_zbuffer);
-
-/*
-*/
-void StencilMesh(Stencil* stencil, Mesh* mesh, int mode=1);
-
-/*
-*/
-void StencilMode(Stencil* stencil, int m, int o=1);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=TerrainHeight">Online Help</a>
-*/
-float TerrainHeight (Terrain* terr, int x, int z);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=TerrainX">Online Help</a>
-*/
-float TerrainX (Terrain* terr, float x, float y, float z);
-
-/*
-
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=TerrainY">Online Help</a>
-*/
-float TerrainY (Terrain* terr, float x, float y, float z);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=TerrainZ">Online Help</a>
-*/
-float TerrainZ (Terrain* terr, float x, float y, float z);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=TextureBlend">Online Help</a>
-*/
-void TextureBlend(Texture* tex,int blend);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=TextureCoords">Online Help</a>
-*/
-void TextureCoords(Texture* tex,int coords);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=TextureHeight">Online Help</a>
-*/
-int TextureHeight(Texture* tex);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=TextureFilter">Online Help</a>
-*/
-void TextureFilter(char* match_text,int flags);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=TextureName">Online Help</a>
-*/
-const char* TextureName(Texture* tex);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=TextureWidth">Online Help</a>
-*/
-int TextureWidth(Texture* tex);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=TFormedX">Online Help</a>
-*/
-float TFormedX();
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=TFormedY">Online Help</a>
-*/
-float TFormedY();
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=TFormedZ">Online Help</a>
-*/
-float TFormedZ();
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=TFormNormal">Online Help</a>
-*/
-void TFormNormal(float x,float y,float z,Entity* src_ent,Entity* dest_ent);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=TFormPoint">Online Help</a>
-*/
-void TFormPoint(float x,float y,float z,Entity* src_ent,Entity* dest_ent);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=TFormVector">Online Help</a>
-*/
-void TFormVector(float x,float y,float z,Entity* src_ent,Entity* dest_ent);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=TranslateEntity">Online Help</a>
-*/
-void TranslateEntity(Entity* ent,float x,float y,float z,bool glob);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=TriangleVertex">Online Help</a>
-*/
-int TriangleVertex(Surface* surf,int tri_no,int corner);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=TurnEntity">Online Help</a>
-*/
-void TurnEntity(Entity* ent,float x,float y,float z,bool glob);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=UpdateNormals">Online Help</a>
-*/
-void UpdateNormals(Mesh* mesh);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=UpdateNormals">Online Help</a>
-*/
-void UpdateTexCoords(Surface* surf);
-
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=UpdateWorld">Online Help</a>
-*/
-void UpdateWorld(float anim_speed);
-
-/*
-*/
-void UseStencil(Stencil* stencil);
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=VectorPitch">Online Help</a>
-*/
-float VectorPitch(float vx,float vy,float vz);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=VectorYaw">Online Help</a>
-*/
-float VectorYaw(float vx,float vy,float vz);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=VertexAlpha">Online Help</a>
-*/
-float VertexAlpha(Surface* surf,int vid);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=VertexBlue">Online Help</a>
-*/
-float VertexBlue(Surface* surf,int vid);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=VertexColor">Online Help</a>
-*/
-void VertexColor(Surface* surf,int vid,float r,float g,float b,float a);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=VertexCoords">Online Help</a>
-*/
-void VertexCoords(Surface* surf,int vid,float x,float y,float z);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=VertexGreen">Online Help</a>
-*/
-float VertexGreen(Surface* surf,int vid);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=VertexNormal">Online Help</a>
-*/
-void VertexNormal(Surface* surf,int vid,float nx,float ny,float nz);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=VertexNX">Online Help</a>
-*/
-float VertexNX(Surface* surf,int vid);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=VertexNY">Online Help</a>
-*/
-float VertexNY(Surface* surf,int vid);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=VertexNZ">Online Help</a>
-*/
-float VertexNZ(Surface* surf,int vid);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=VertexRed">Online Help</a>
-*/
-float VertexRed(Surface* surf,int vid);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=VertexTexCoords">Online Help</a>
-*/
-void VertexTexCoords(Surface* surf,int vid,float u,float v,float w,int coord_set);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=VertexU">Online Help</a>
-*/
-float VertexU(Surface* surf,int vid,int coord_set);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=VertexV">Online Help</a>
-*/
-float VertexV(Surface* surf,int vid,int coord_set);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=VertexW">Online Help</a>
-*/
-float VertexW(Surface* surf,int vid,int coord_set);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=VertexX">Online Help</a>
-*/
-float VertexX(Surface* surf,int vid);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=VertexY">Online Help</a>
-*/
-float VertexY(Surface* surf,int vid);
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=VertexZ">Online Help</a>
-*/
-float VertexZ(Surface* surf,int vid);
-
-/*
-*/
-void VoxelSpriteMaterial(VoxelSprite* voxelspr, Material* mat);
-
-
-/*
-bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=Wireframe">Online Help</a>
-*/
-void Wireframe(int enable);
-
-
-float EntityScaleX(Entity* ent,bool glob);
-
-float EntityScaleY(Entity* ent,bool glob);
-
-float EntityScaleZ(Entity* ent,bool glob);
-
-Shader* LoadShader(char* ShaderName, char* VshaderFileName, char* FshaderFileName);
-
-Shader* CreateShader(char* ShaderName, char* VshaderString, char* FshaderString);
-
-void ShadeSurface(Surface* surf, Shader* material);
-
-void ShadeMesh(Mesh* mesh, Shader* material);
-
-void ShadeEntity(Entity* ent, Shader* material);
-
-void ShaderTexture(Shader* material, Texture* tex, char* name, int index);
-
-void SetFloat(Shader* material, char* name, float v1);
-
-void SetFloat2(Shader* material, char* name, float v1, float v2);
-
-void SetFloat3(Shader* material, char* name, float v1, float v2, float v3);
-
-void SetFloat4(Shader* material, char* name, float v1, float v2, float v3, float v4);
-
-void UseFloat(Shader* material, char* name, float* v1);
-
-void UseFloat2(Shader* material, char* name, float* v1, float* v2);
-
-void UseFloat3(Shader* material, char* name, float* v1, float* v2, float* v3);
-
-void UseFloat4(Shader* material, char* name, float* v1, float* v2, float* v3, float* v4);
-
-void SetInteger(Shader* material, char* name, int v1);
-
-void SetInteger2(Shader* material, char* name, int v1, int v2):
-
-void SetInteger3(Shader* material, char* name, int v1, int v2, int v3);
-
-void SetInteger4(Shader* material, char* name, int v1, int v2, int v3, int v4);
-
-void UseInteger(Shader* material, char* name, int* v1);
-
-void UseInteger2(Shader* material, char* name, int* v1, int* v2);
-
-void UseInteger3(Shader* material, char* name, int* v1, int* v2, int* v3);
-
-void UseInteger4(Shader* material, char* name, int* v1, int* v2, int* v3, int* v4);
-
-void UseSurface(Shader* material, char* name, Surface* surf, int vbo);
-
-void UseMatrix(Shader* material, char* name, int mode);
-
-Material* LoadMaterial(char* filename,int flags, int frame_width,int frame_height,int first_frame,int frame_count);
-
-void ShaderMaterial(Shader* material, Material* tex, char* name, int index);
-
-
-
-
-
-
-OcTree* CreateOcTree(float w, float h, float d, Entity* parent_ent=0);
-
-void AddToOctree(OcTree* octree, Mesh* mesh, int level, float X, float Y, float Z, float Near=0.0, float Far=1000.0);
-
-
-} // extern "C"
-
-#endif
+#ifndef __functions_h__
+#define __functions_h__
+
+// functions
+extern "C" {
+
+void BufferToTex(Texture* tex,unsigned char* buffer, int frame);
+void BackBufferToTex(Texture* tex,int frame);
+void DepthBufferToTex(Texture* tex,int frame);
+void TexToBuffer(Texture* tex,unsigned char* buffer, int frame);
+
+
+/*
+bbdoc: Minib3d Only
+about:
+This command is the equivalent of Blitz3D's MeshCullBox command.
+
+It is used to set the radius of a mesh's 'cull sphere' - if the 'cull sphere' is not inside the viewing area, the mesh will not
+be rendered.
+
+A mesh's cull radius is set automatically, therefore in most cases you will not have to use this command.
+
+One time you may have to use it is for animated meshes where the default cull radius may not take into account all animation
+positions, resulting in the mesh being wrongly culled at extreme positions.
+*/
+void MeshCullRadius(Entity* ent, float radius);
+// Blitz3D functions, A-Z
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=AddAnimSeq">Online Help</a>
+*/
+int AddAnimSeq(Entity* ent,int length);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=AddMesh">Online Help</a>
+*/
+void AddMesh(Mesh* mesh1,Mesh* mesh2);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=AddTriangle">Online Help</a>
+*/
+int AddTriangle(Surface* surf,int v0,int v1,int v2);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=AddVertex">Online Help</a>
+*/
+int AddVertex(Surface* surf,float x, float y,float z,float u, float v,float w);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=AmbientLight">Online Help</a>
+*/
+void AmbientLight(float r,float g,float b);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=AntiAlias">Online Help</a>
+*/
+void AntiAlias(int samples);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=Animate">Online Help</a>
+*/
+void Animate(Entity* ent,int mode,float speed,int seq,int trans);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=Animating">Online Help</a>
+*/
+int Animating(Entity* ent);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=AnimLength">Online Help</a>
+*/
+int AnimLength(Entity* ent);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=AnimSeq">Online Help</a>
+*/
+int AnimSeq(Entity* ent);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=AnimTime">Online Help</a>
+*/
+float AnimTime(Entity* ent);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=BrushAlpha">Online Help</a>
+*/
+void BrushAlpha(Brush* brush, float a);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=BrushBlend">Online Help</a>
+*/
+void BrushBlend(Brush* brush,int blend);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=BrushColor">Online Help</a>
+*/
+void BrushColor(Brush* brush,float r,float g,float b);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=BrushFX">Online Help</a>
+*/
+void BrushFX(Brush* brush,int fx);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=BrushShininess">Online Help</a>
+*/
+void BrushShininess(Brush* brush,float s);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=BrushTexture">Online Help</a>
+*/
+void BrushTexture(Brush* brush,Texture* tex,int frame,int index);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CameraClsColor">Online Help</a>
+*/
+void CameraClsColor(Camera* cam, float r,float g,float b);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CameraClsMode">Online Help</a>
+*/
+void CameraClsMode(Camera* cam,int cls_depth,int cls_zbuffer);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CameraFogColor">Online Help</a>
+*/
+void CameraFogColor(Camera* cam,float r,float g,float b);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CameraFogMode">Online Help</a>
+*/
+void CameraFogMode(Camera* cam,int mode);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CameraFogRange">Online Help</a>
+*/
+void CameraFogRange(Camera* cam,float nnear,float nfar);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CameraPick">Online Help</a>
+*/
+Entity* CameraPick(Camera* cam,float x,float y);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CameraProject">Online Help</a>
+*/
+void CameraProject(Camera* cam,float x,float y,float z);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CameraProjMode">Online Help</a>
+*/
+void  CameraProjMode(Camera* cam,int mode);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CameraRange">Online Help</a>
+*/
+void  CameraRange(Camera* cam,float nnear,float nfar);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CameraViewport">Online Help</a>
+*/
+void  CameraViewport(Camera* cam,int x,int y,int width,int height);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CameraZoom">Online Help</a>
+*/
+void  CameraZoom(Camera* cam,float zoom);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=ClearCollisions">Online Help</a>
+int ClearCollisions(){
+	Global::ClearCollisions();
+}
+*/
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=ClearSurface">Online Help</a>
+*/
+void ClearSurface(Surface* surf,bool clear_verts,bool clear_tris);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=ClearTextureFilters">Online Help</a>
+*/
+void ClearTextureFilters();
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=ClearWorld">Online Help</a>
+*/
+void ClearWorld(bool entities,bool brushes,bool textures);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CollisionEntity">Online Help</a>
+*/
+Entity* CollisionEntity(Entity* ent,int index);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=Collisions">Online Help</a>
+*/
+void Collisions(int src_no,int dest_no,int method_no,int response_no);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CollisionNX">Online Help</a>
+*/
+float CollisionNX(Entity* ent,int index);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CollisionNY">Online Help</a>
+*/
+float CollisionNY(Entity* ent,int index);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CollisionNZ">Online Help</a>
+*/
+float CollisionNZ(Entity* ent,int index);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CollisionSurface">Online Help</a>
+*/
+Surface* CollisionSurface(Entity* ent,int index);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CollisionTime">Online Help</a>
+*/
+float CollisionTime(Entity* ent,int index);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CollisionTriangle">Online Help</a>
+*/
+int CollisionTriangle(Entity* ent,int index);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CollisionX">Online Help</a>
+*/
+float CollisionX(Entity* ent,int index);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CollisionY">Online Help</a>
+*/
+float CollisionY(Entity* ent,int index);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CollisionZ">Online Help</a>
+*/
+float CollisionZ(Entity* ent,int index);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CountChildren">Online Help</a>
+*/
+int CountChildren(Entity* ent);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CountCollisions">Online Help</a>
+*/
+int CountCollisions(Entity* ent);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CopyEntity">Online Help</a>
+*/
+Entity* CopyEntity(Entity* ent,Entity* parent);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CopyMesh">Online Help</a>
+*/
+Mesh* CopyMesh(Mesh* mesh,Entity* parent);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CountSurfaces">Online Help</a>
+*/
+int CountSurfaces(Mesh* mesh);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CountTriangles">Online Help</a>
+*/
+int CountTriangles(Surface* surf);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CountVertices">Online Help</a>
+*/
+int CountVertices(Surface* surf);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CreateBrush">Online Help</a>
+*/
+Brush* CreateBrush(float r,float g,float b);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CreateCamera">Online Help</a>
+*/
+Camera* CreateCamera(Entity* parent);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CreateCone">Online Help</a>
+*/
+Mesh* CreateCone(int segments,bool solid,Entity* parent);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CreateCylinder">Online Help</a>
+*/
+Mesh* CreateCylinder(int segments,bool solid,Entity* parent);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CreateCube">Online Help</a>
+*/
+Mesh* CreateCube(Entity* parent);
+
+Terrain* CreateGeosphere(int size, Entity* parent);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CreateMesh">Online Help</a>
+*/
+Mesh* CreateMesh(Entity* parent);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CreateLight">Online Help</a>
+*/
+Light* CreateLight(int light_type,Entity* parent);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CreatePivot">Online Help</a>
+*/
+Pivot* CreatePivot(Entity* parent);
+
+Mesh* CreatePlane(int divisions,Entity* parent);
+
+Mesh* CreateQuad(Entity* parent);
+
+ShadowObject* CreateShadow(Mesh* parent, char Static);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CreateSphere">Online Help</a>
+*/
+Mesh* CreateSphere(int segments,Entity* parent);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CreateSprite">Online Help</a>
+*/
+Sprite* CreateSprite(Entity* parent);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CreateSurface">Online Help</a>
+*/
+Surface* CreateSurface(Mesh* mesh,Brush* brush);
+
+/*
+*/
+Stencil* CreateStencil();
+
+/*
+*/
+Terrain* CreateTerrain(int size, Entity* parent);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=CreateTexture">Online Help</a>
+*/
+Texture* CreateTexture(int width,int height,int flags,int frames);
+
+/*
+*/
+VoxelSprite* CreateVoxelSprite(int slices, Entity* parent);
+
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=DeltaPitch">Online Help</a>
+*/
+float DeltaPitch(Entity* ent1,Entity* ent2);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=DeltaYaw">Online Help</a>
+*/
+float DeltaYaw(Entity* ent1,Entity* ent2);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=EntityAlpha">Online Help</a>
+*/
+void EntityAlpha(Entity* ent,float alpha);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=EntityAutoFade">Online Help</a>
+*/
+void EntityAutoFade(Entity* ent,float near,float far);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=EntityBlend">Online Help</a>
+*/
+void EntityBlend(Entity* ent, int blend);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=EntityBox">Online Help</a>
+*/
+void EntityBox(Entity* ent,float x,float y,float z,float w,float h,float d);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=EntityClass">Online Help</a>
+*/
+const char* EntityClass(Entity* ent);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=EntityCollided">Online Help</a>
+*/
+Entity* EntityCollided(Entity* ent,int type_no);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=EntityColor">Online Help</a>
+*/
+void EntityColor(Entity* ent,float red,float green,float blue);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=EntityDistance">Online Help</a>
+*/
+float EntityDistance(Entity* ent1,Entity* ent2);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=EntityFX">Online Help</a>
+*/
+void EntityFX(Entity* ent,int fx);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=EntityInView">Online Help</a>
+*/
+int EntityInView(Entity* ent,Camera* cam);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=EntityName">Online Help</a>
+*/
+const char* EntityName(Entity* ent);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=EntityOrder">Online Help</a>
+*/
+void EntityOrder(Entity* ent,int order);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=EntityParent">Online Help</a>
+
+
+
+
+*/
+void EntityParent(Entity* ent,Entity* parent_ent,bool glob);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=EntityPick">Online Help</a>
+*/
+Entity* EntityPick(Entity* ent,float range);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=EntityPickMode">Online Help</a>
+*/
+void EntityPickMode(Entity* ent,int pick_mode,bool obscurer);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=EntityPitch">Online Help</a>
+*/
+float EntityPitch(Entity* ent,bool glob);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=EntityRadius">Online Help</a>
+*/
+void EntityRadius(Entity* ent,float radius_x,float radius_y);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=EntityRoll">Online Help</a>
+*/
+float EntityRoll(Entity* ent,bool glob);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=EntityShininess">Online Help</a>
+*/
+void EntityShininess(Entity* ent,float shine);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=EntityTexture">Online Help</a>
+*/
+void EntityTexture(Entity* ent,Texture* tex,int frame,int index);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=EntityType">Online Help</a>
+*/
+void EntityType(Entity* ent,int type_no,bool recursive);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=EntityVisible">Online Help</a>
+*/
+int EntityVisible(Entity* src_ent,Entity* dest_ent);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=EntityX">Online Help</a>
+*/
+float EntityX(Entity* ent,bool glob);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=EntityY">Online Help</a>
+*/
+float EntityY(Entity* ent,bool glob);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=EntityYaw">Online Help</a>
+*/
+float EntityYaw(Entity* ent,bool glob);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=EntityZ">Online Help</a>
+*/
+float EntityZ(Entity* ent,bool glob);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=ExtractAnimSeq">Online Help</a>
+*/
+int ExtractAnimSeq(Entity* ent,int first_frame,int last_frame,int seq);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=FindChild">Online Help</a>
+*/
+Entity* FindChild(Entity* ent,char* child_name);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=FindSurface">Online Help</a>
+*/
+Surface* FindSurface(Mesh* mesh,Brush* brush);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=FitMesh">Online Help</a><p>
+*/
+void FitMesh(Mesh* mesh,float x,float y,float z,float width,float height,float depth,bool uniform);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=FlipMesh">Online Help</a>
+*/
+void FlipMesh(Mesh* mesh);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=FreeBrush">Online Help</a>
+*/
+void  FreeBrush(Brush* brush);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=FreeEntity">Online Help</a>
+*/
+void FreeEntity(Entity* ent);
+
+void FreeShadow(ShadowObject* shad);
+
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=FreeTexture">Online Help</a>
+*/
+void FreeTexture(Texture* tex);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=GetBrushTexture">Online Help</a>
+*/
+Texture* GetBrushTexture(Brush* brush,int index);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=GetChild">Online Help</a>
+*/
+Entity* GetChild(Entity* ent,int child_no);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=GetEntityBrush">Online Help</a>
+*/
+Brush* GetEntityBrush(Entity* ent);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=GetEntityType">Online Help</a>
+*/
+int GetEntityType(Entity* ent);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=ResetEntity">Online Help</a>
+*/
+float GetMatElement(Entity* ent,int row,int col);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=GetParent">Online Help</a>
+*/
+Entity* GetParentEntity(Entity* ent);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=GetSurface">Online Help</a>
+*/
+Surface* GetSurface(Mesh* mesh,int surf_no);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=GetSurfaceBrush">Online Help</a>
+*/
+Brush* GetSurfaceBrush(Surface* surf);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=Graphics3D">Online Help</a>
+*/
+void Graphics3D(int width,int height,int depth,int mode,int rate);
+
+/*
+*/
+void GraphicsResize(int width,int height);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=HandleSprite">Online Help</a>
+*/
+void HandleSprite(Sprite* sprite,float h_x,float h_y);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=HideEntity">Online Help</a>
+*/
+void HideEntity(Entity* ent);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=LightColor">Online Help</a>
+*/
+void LightColor(Light* light,float red,float green,float blue);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=LightConeAngles">Online Help</a>
+*/
+void LightConeAngles(Light* light,float inner_ang,float outer_ang);
+
+/*
+
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=LightRange">Online Help</a>
+*/
+void LightRange(Light* light,float range);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=LinePick">Online Help</a>
+*/
+Entity* LinePick(float x,float y,float z,float dx,float dy,float dz,float radius);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=LoadAnimMesh">Online Help</a>
+*/
+Mesh* LoadAnimMesh(char* file,Entity* parent);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=LoadAnimTexture">Online Help</a>
+*/
+Texture* LoadAnimTexture(char* file,int flags,int frame_width,int frame_height,int first_frame,int frame_count);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=LoadBrush">Online Help</a>
+*/
+Brush* LoadBrush(char *file,int flags,float u_scale,float v_scale);
+
+Terrain* LoadGeosphere(char* file,Entity* parent);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=LoadMesh">Online Help</a>
+*/
+Mesh* LoadMesh(char* file,Entity* parent);
+
+
+Terrain* LoadTerrain(char* file,Entity* parent);
+
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=LoadTexture">Online Help</a>
+*/
+Texture* LoadTexture(char* file,int flags);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=LoadSprite">Online Help</a>
+*/
+Sprite* LoadSprite(char* tex_file,int tex_flag,Entity* parent);
+
+/*
+*/
+Mesh* MeshCSG(Mesh* m1, Mesh* m2, int method = 1);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=MeshDepth">Online Help</a>
+*/
+float MeshDepth(Mesh* mesh);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=MeshesIntersect">Online Help</a>
+*/
+int MeshesIntersect(Mesh* mesh1,Mesh* mesh2);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=MeshHeight">Online Help</a>
+*/
+float MeshHeight(Mesh* mesh);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=MeshWidth">Online Help</a>
+*/
+float MeshWidth(Mesh* mesh);
+
+void ModifyGeosphere(Geosphere* geo, int x, int z, float new_height);
+
+void ModifyTerrain(Terrain* terr, int x, int z, float new_height);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=MoveEntity">Online Help</a>
+*/
+void MoveEntity(Entity* ent,float x,float y,float z);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=NameEntity">Online Help</a>
+*/
+void NameEntity(Entity* ent,char* name);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=PaintEntity">Online Help</a>
+*/
+void PaintEntity(Entity* ent,Brush* brush);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=PaintMesh">Online Help</a>
+*/
+void PaintMesh(Mesh* mesh,Brush* brush);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=PaintSurface">Online Help</a>
+*/
+void PaintSurface(Surface* surf,Brush* brush);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=PickedEntity">Online Help</a>
+*/
+Entity* PickedEntity();
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=PickedNX">Online Help</a>
+*/
+float PickedNX();
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=PickedNY">Online Help</a>
+*/
+float PickedNY();
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=PickedNZ">Online Help</a>
+*/
+float PickedNZ();
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=PickedSurface">Online Help</a>
+*/
+Surface* PickedSurface();
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=PickedTime">Online Help</a>
+*/
+float PickedTime();
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=PickedTriangle">Online Help</a>
+*/
+int PickedTriangle();
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=PickedX">Online Help</a>
+*/
+float PickedX();
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=PickedY">Online Help</a>
+*/
+float PickedY();
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=PickedZ">Online Help</a>
+*/
+float PickedZ();
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=PointEntity">Online Help</a>
+*/
+void PointEntity(Entity* ent,Entity* target_ent,float roll);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=PositionEntity">Online Help</a>
+*/
+void PositionEntity(Entity* ent,float x,float y,float z,bool glob);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=PositionMesh">Online Help</a>
+*/
+void PositionMesh(Mesh* mesh,float px,float py,float pz);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=PositionTexture">Online Help</a>
+*/
+void PositionTexture(Texture* tex,float u_pos,float v_pos);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=ProjectedX">Online Help</a>
+*/
+float ProjectedX();
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=ProjectedY">Online Help</a>
+*/
+float ProjectedY();
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=ProjectedZ">Online Help</a>
+*/
+float ProjectedZ();
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=RenderWorld">Online Help</a>
+*/
+void RenderWorld();
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=RepeatMesh">Online Help</a>
+*/
+Mesh* RepeatMesh(Mesh* mesh,Entity* parent);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=ResetEntity">Online Help</a>
+*/
+void ResetEntity(Entity* ent);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=RotateEntity">Online Help</a>
+*/
+void RotateEntity(Entity* ent,float x,float y,float z,bool glob);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=RotateMesh">Online Help</a>
+*/
+void RotateMesh(Mesh* mesh,float pitch,float yaw,float roll);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=RotateSprite">Online Help</a>
+*/
+void RotateSprite(Sprite* sprite,float ang);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=RotateTexture">Online Help</a>
+*/
+void RotateTexture(Texture* tex,float ang);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=ScaleEntity">Online Help</a>
+*/
+void ScaleEntity(Entity* ent,float x,float y,float z,bool glob);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=ScaleMesh">Online Help</a>
+*/
+void ScaleMesh(Mesh* mesh,float sx,float sy,float sz);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=ScaleSprite">Online Help</a>
+*/
+void ScaleSprite(Sprite* sprite,float s_x,float s_y);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=ScaleTexture">Online Help</a>
+*/
+void ScaleTexture(Texture* tex,float u_scale,float v_scale);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=SetAnimTime">Online Help</a>
+*/
+void SetAnimTime(Entity* ent,float time,int seq);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=SetCubeFace">Online Help</a>
+*/
+void SetCubeFace(Texture* tex,int face);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=SetCubeMode">Online Help</a>
+*/
+void SetCubeMode(Texture* tex,int mode);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=ShowEntity">Online Help</a>
+*/
+void ShowEntity(Entity* ent);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=SpriteViewMode">Online Help</a>
+*/
+void SpriteViewMode(Sprite* sprite,int mode);
+
+/*
+*/
+void StencilAlpha(Stencil* stencil, float a);
+
+/*
+*/
+void StencilClsColor(Stencil* stencil, float r,float g,float b);
+
+/*
+*/
+void StencilClsMode(Stencil* stencil,int cls_depth,int cls_zbuffer);
+
+/*
+*/
+void StencilMesh(Stencil* stencil, Mesh* mesh, int mode=1);
+
+/*
+*/
+void StencilMode(Stencil* stencil, int m, int o=1);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=TerrainHeight">Online Help</a>
+*/
+float TerrainHeight (Terrain* terr, int x, int z);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=TerrainX">Online Help</a>
+*/
+float TerrainX (Terrain* terr, float x, float y, float z);
+
+/*
+
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=TerrainY">Online Help</a>
+*/
+float TerrainY (Terrain* terr, float x, float y, float z);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=TerrainZ">Online Help</a>
+*/
+float TerrainZ (Terrain* terr, float x, float y, float z);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=TextureBlend">Online Help</a>
+*/
+void TextureBlend(Texture* tex,int blend);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=TextureCoords">Online Help</a>
+*/
+void TextureCoords(Texture* tex,int coords);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=TextureHeight">Online Help</a>
+*/
+int TextureHeight(Texture* tex);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=TextureFilter">Online Help</a>
+*/
+void TextureFilter(char* match_text,int flags);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=TextureName">Online Help</a>
+*/
+const char* TextureName(Texture* tex);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=TextureWidth">Online Help</a>
+*/
+int TextureWidth(Texture* tex);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=TFormedX">Online Help</a>
+*/
+float TFormedX();
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=TFormedY">Online Help</a>
+*/
+float TFormedY();
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=TFormedZ">Online Help</a>
+*/
+float TFormedZ();
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=TFormNormal">Online Help</a>
+*/
+void TFormNormal(float x,float y,float z,Entity* src_ent,Entity* dest_ent);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=TFormPoint">Online Help</a>
+*/
+void TFormPoint(float x,float y,float z,Entity* src_ent,Entity* dest_ent);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=TFormVector">Online Help</a>
+*/
+void TFormVector(float x,float y,float z,Entity* src_ent,Entity* dest_ent);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=TranslateEntity">Online Help</a>
+*/
+void TranslateEntity(Entity* ent,float x,float y,float z,bool glob);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=TriangleVertex">Online Help</a>
+*/
+int TriangleVertex(Surface* surf,int tri_no,int corner);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=TurnEntity">Online Help</a>
+*/
+void TurnEntity(Entity* ent,float x,float y,float z,bool glob);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=UpdateNormals">Online Help</a>
+*/
+void UpdateNormals(Mesh* mesh);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=UpdateNormals">Online Help</a>
+*/
+void UpdateTexCoords(Surface* surf);
+
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=UpdateWorld">Online Help</a>
+*/
+void UpdateWorld(float anim_speed);
+
+/*
+*/
+void UseStencil(Stencil* stencil);
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=VectorPitch">Online Help</a>
+*/
+float VectorPitch(float vx,float vy,float vz);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=VectorYaw">Online Help</a>
+*/
+float VectorYaw(float vx,float vy,float vz);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=VertexAlpha">Online Help</a>
+*/
+float VertexAlpha(Surface* surf,int vid);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=VertexBlue">Online Help</a>
+*/
+float VertexBlue(Surface* surf,int vid);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=VertexColor">Online Help</a>
+*/
+void VertexColor(Surface* surf,int vid,float r,float g,float b,float a);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=VertexCoords">Online Help</a>
+*/
+void VertexCoords(Surface* surf,int vid,float x,float y,float z);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=VertexGreen">Online Help</a>
+*/
+float VertexGreen(Surface* surf,int vid);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=VertexNormal">Online Help</a>
+*/
+void VertexNormal(Surface* surf,int vid,float nx,float ny,float nz);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=VertexNX">Online Help</a>
+*/
+float VertexNX(Surface* surf,int vid);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=VertexNY">Online Help</a>
+*/
+float VertexNY(Surface* surf,int vid);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=VertexNZ">Online Help</a>
+*/
+float VertexNZ(Surface* surf,int vid);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=VertexRed">Online Help</a>
+*/
+float VertexRed(Surface* surf,int vid);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=VertexTexCoords">Online Help</a>
+*/
+void VertexTexCoords(Surface* surf,int vid,float u,float v,float w,int coord_set);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=VertexU">Online Help</a>
+*/
+float VertexU(Surface* surf,int vid,int coord_set);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=VertexV">Online Help</a>
+*/
+float VertexV(Surface* surf,int vid,int coord_set);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=VertexW">Online Help</a>
+*/
+float VertexW(Surface* surf,int vid,int coord_set);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=VertexX">Online Help</a>
+*/
+float VertexX(Surface* surf,int vid);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=VertexY">Online Help</a>
+*/
+float VertexY(Surface* surf,int vid);
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=VertexZ">Online Help</a>
+*/
+float VertexZ(Surface* surf,int vid);
+
+/*
+*/
+void VoxelSpriteMaterial(VoxelSprite* voxelspr, Material* mat);
+
+
+/*
+bbdoc: <a href="http://www.blitzbasic.com/b3ddocs/command.php?name=Wireframe">Online Help</a>
+*/
+void Wireframe(int enable);
+
+
+float EntityScaleX(Entity* ent,bool glob);
+
+float EntityScaleY(Entity* ent,bool glob);
+
+float EntityScaleZ(Entity* ent,bool glob);
+
+Shader* LoadShader(char* ShaderName, char* VshaderFileName, char* FshaderFileName);
+
+Shader* CreateShader(char* ShaderName, char* VshaderString, char* FshaderString);
+
+void ShadeSurface(Surface* surf, Shader* material);
+
+void ShadeMesh(Mesh* mesh, Shader* material);
+
+void ShadeEntity(Entity* ent, Shader* material);
+
+void ShaderTexture(Shader* material, Texture* tex, char* name, int index);
+
+void SetFloat(Shader* material, char* name, float v1);
+
+void SetFloat2(Shader* material, char* name, float v1, float v2);
+
+void SetFloat3(Shader* material, char* name, float v1, float v2, float v3);
+
+void SetFloat4(Shader* material, char* name, float v1, float v2, float v3, float v4);
+
+void UseFloat(Shader* material, char* name, float* v1);
+
+void UseFloat2(Shader* material, char* name, float* v1, float* v2);
+
+void UseFloat3(Shader* material, char* name, float* v1, float* v2, float* v3);
+
+void UseFloat4(Shader* material, char* name, float* v1, float* v2, float* v3, float* v4);
+
+void SetInteger(Shader* material, char* name, int v1);
+
+void SetInteger2(Shader* material, char* name, int v1, int v2):
+
+void SetInteger3(Shader* material, char* name, int v1, int v2, int v3);
+
+void SetInteger4(Shader* material, char* name, int v1, int v2, int v3, int v4);
+
+void UseInteger(Shader* material, char* name, int* v1);
+
+void UseInteger2(Shader* material, char* name, int* v1, int* v2);
+
+void UseInteger3(Shader* material, char* name, int* v1, int* v2, int* v3);
+
+void UseInteger4(Shader* material, char* name, int* v1, int* v2, int* v3, int* v4);
+
+void UseSurface(Shader* material, char* name, Surface* surf, int vbo);
+
+void UseMatrix(Shader* material, char* name, int mode);
+
+Material* LoadMaterial(char* filename,int flags, int frame_width,int frame_height,int first_frame,int frame_count);
+
+void ShaderMaterial(Shader* material, Material* tex, char* name, int index);
+
+
+
+
+
+
+OcTree* CreateOcTree(float w, float h, float d, Entity* parent_ent=0);
+
+void AddToOctree(OcTree* octree, Mesh* mesh, int level, float X, float Y, float Z, float Near=0.0, float Far=1000.0);
+
+
+} // extern "C"
+
+#endif

+ 6 - 0
openb3dlib.mod/openb3d/src/texture.cpp

@@ -433,6 +433,12 @@ void Texture::BackBufferToTex(int frame){
 	}
 }
 
+void Texture::DepthBufferToTex(int frame){
+		glBindTexture (GL_TEXTURE_2D,texture);
+		glCopyTexImage2D(GL_TEXTURE_2D,0,GL_DEPTH_COMPONENT,0,Global::height-height,width,height,0);
+		glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP_SGIS, GL_TRUE);
+}
+
 void Texture::CameraToTex(Camera* cam, int frame){
 
 	GLenum target;

+ 1 - 0
openb3dlib.mod/openb3d/src/texture.h

@@ -67,6 +67,7 @@ public:
 	void BufferToTex(unsigned char* buffer, int frames=0);
 	void TexToBuffer(unsigned char* buffer, int frames=0);
 	void BackBufferToTex(int frames=0);
+	void DepthBufferToTex(int frames=0);
 	void CameraToTex(Camera* cam, int frames=0);
 	string TextureName();
 	static void ClearTextureFilters();

+ 1 - 1
openb3dlib.mod/openb3dlib.bmx

@@ -28,7 +28,7 @@ Module b3d.openb3dlib
 
 ModuleInfo "Version: 1.00"
 ModuleInfo "License: Wrapper - zlib/libpng"
-ModuleInfo "License: OpenB3D - LGPL"
+ModuleInfo "License: OpenB3D - LGPL with static linking exception"
 ModuleInfo "Copyright: Wrapper - 2014 Mark Mcvittie, Bruce A Henderson"
 ModuleInfo "Copyright: Openb3d - Angelo Rosina"