Rem
bbdoc: minib3d
End Rem
'Module sidesign.minib3d
'ModuleInfo "Version: 1.45"
'ModuleInfo "Main Author: Simon Harrison (simonh@blitzbasic.com). Includes routines by various authors."
'ModuleInfo "License: You are free to use this code as you please"
'ModuleInfo "Please see readme.txt for more details"

Strict

Import BRL.GLMax2D
Import BRL.GLGraphics
Import PUB.Glew
Import BRL.BMPLoader
Import BRL.PNGLoader
Import BRL.JPGLoader
Import BRL.Retro

' c++
Import "inc045/cfuncs.cpp"			' contains C_UpdateNormals and C_IntersectTriangle
Import "inc045/ccol.cpp"			' contains C_checkTriangle

' global
Include "inc045/TGlobal.bmx"

' entity
Include "inc045/TEntity.bmx"
Include "inc045/TCamera.bmx"
Include "inc045/TLight.bmx"
Include "inc045/TPivot.bmx"
Include "inc045/TMesh.bmx"
Include "inc045/TSprite.bmx"
Include "inc045/TBone.bmx"

' mesh structure
Include "inc045/TSurface.bmx"
Include "inc045/TTexture.bmx"
Include "inc045/TBrush.bmx"
Include "inc045/TAnimation.bmx"
Include "inc045/TModel.bmx"

' picking/collision/tree
Include "inc045/TPick.bmx"
Include "inc045/TCollisionA.bmx"	' TCollisionA = MiniB3D collisions	} include only one of TCollisionA and TCollisionB
'Include "inc045/TCollisionB.bmx"	' TCollisionB = Blitz3D collisions	} include only one of TCollisionA and TCollisionB
'Include "inc045/geomB.bmx"		' include if using TCollisionB.bmx
Include "inc045/TColTree.bmx"  
Include "inc045/TKDTree.bmx"
Include "inc045/TQuadtree.bmx"		' Kd-trees used by default for MiniB3D's collision trees. To use quadtrees instead, change TREE const values below
Include "inc045/TOctree.bmx"		' Kd-trees used by default for MiniB3D's collision trees. To use octrees instead, change TREE const values below

' geom
Include "inc045/TVector.bmx"
Include "inc045/TMatrix.bmx"
Include "inc045/TQuaternion.bmx"
Include "inc045/TPlane.bmx"
Include "inc045/TPolygon.bmx"
Include "inc045/BoxSphere.bmx"

' misc
Include "inc045/THardwareInfo.bmx"
Include "inc045/TBlitz2D.bmx"
Include "inc045/TUtility.bmx"
Include "inc045/TDebug.bmx"

' data
Include "inc045/data.bmx"

' functions
Include "inc045/functions.bmx"

Extern
	Function C_UpdateNormals(no_tris:Int,no_verts:Int,tris:Short Ptr,vert_coords:Float Ptr,vert_norms:Float Ptr) ' used by TMesh.bmx
	Function C_IntersectSegmentTriangle:Int(	px:Float, py:Float, pz:Float,..
												qx:Float, qy:Float, qz:Float,..
												ax:Float, ay:Float, az:Float,..
												bx:Float, by:Float, bz:Float,..
												cx:Float, cy:Float, cz:Float,..
                             					u:Float Var, v:Float Var, w:Float Var, t:Float Var) ' used by TPick.bmx
	Function C_checkTriangle:Int(col_pack:Float Ptr,a:Float Ptr,b:Float Ptr,c:Float Ptr) ' use by TCollision.bmx
End Extern

Const USE_C=True		' true to use c versions of certain function, false to use blitzmax versions
Const USE_VBO=True		' true to automatically use vbos if the hardware supports them
Const TREE_TYPE=0		' 0=kd-tree, 1=quadtree, 2=octree
Const TREE_MAX_POLYS=16	' max polys per leaf in collision trees. Recommended value is 16 for kd-trees, 0 for quadtrees and octrees
Const TREE_MAX_LEVELS=0	' max levels per tree for collision trees. Unused for kd-trees, recommended value is 2-4 for quadtrees and octrees
Const LOG_NEW=False		' true to write to debuglog when new minib3d object created
Const LOG_DEL=False		' true to write to debuglog when minib3d object destroyed