''********************************************************************
'' This source file is part of Ninfa3D Lite
''
'' Copyright (C) 2008-2009 Viz_Fuerte.
'' All rights reserved.
''
'' LIMITED WARRANTY
'' This software is provided "as-is", without any express or implied warranty.
'' In no event shall the author be held liable for any damages arising from the use of this software.
'' This is a contract. By accepting the Ninfa3D Engine (the SOFTWARE), 
'' you (either an individual or a single entity, the LICENSEE) accept the terms and conditions of this licensing agreement.
'' 
'' If the LICENSEE does not accept the terms and conditions, then LICENSEE must not accept the SOFTWARE.
'' If at a later time the LICENSEE decides not to continue licensing the SOFTWARE under these terms and 
'' conditions, then the LICENSEE must delete permanently all files constituting the SOFTWARE.
'' 
'' File: Ninfa3D.bi
''********************************************************************

#inclib "Ninfa3D"

Type I As Integer
Type UI As Uinteger
Type S As Single

Type nENTITY As Uinteger Ptr
Type nMESH As Uinteger Ptr
Type nCAMERA As Uinteger Ptr
Type nSOUND As Uinteger Ptr
Type nLIGHT As Uinteger Ptr
Type nSPRITE As Uinteger Ptr
Type nBODY As Uinteger Ptr
Type nCHILD As Uinteger Ptr
Type nFONT As Uinteger Ptr
Type nTEXTURE As Uinteger Ptr
Type nTERRAIN As Uinteger Ptr
Type nREAD As Uinteger Ptr
Type nWRITE As Uinteger Ptr
Type nPARTICLE As Uinteger Ptr
Type nEMITTER As Uinteger Ptr
Type nSHADER As Uinteger Ptr
Type nJOINT As Uinteger Ptr
Type nGUI As Uinteger Ptr
Type nMATERIAL As Uinteger Ptr
Type nLensFlare As Uinteger Ptr
Type nTimer As Uinteger Ptr
Type nClouds As Uinteger Ptr
Type nImage As Uinteger Ptr
Type nGrass As Uinteger Ptr
Type nBSPNode As Uinteger Ptr

'Keyboard
#define KEY_LBUTTON 1
#define KEY_RBUTTON 2
#define KEY_CANCEL 3
#define KEY_MBUTTON 4
#define KEY_XBUTTON1 5
#define KEY_XBUTTON2 6
#define KEY_BACK 8 
#define KEY_TAB 9 
#define KEY_CLEAR 12
#define KEY_RETURN 13 
#define KEY_SHIFT 16
#define KEY_CONTROL 17
#define KEY_MENU 18
#define KEY_PAUSE 19 
#define KEY_CAPITAL 20
#define KEY_KANA 21
#define KEY_HANGUEL 21
#define KEY_HANGUL 21
#define KEY_JUNJA 23
#define KEY_FINAL 24 
#define KEY_HANJA 25
#define KEY_KANJI 25
#define KEY_ESCAPE 27
#define KEY_CONVERT 28 
#define KEY_NONCONVERT 29 
#define KEY_ACCEPT 30
#define KEY_MODECHANGE 31
#define KEY_SPACE 32 
#define KEY_PRIOR 33
#define KEY_NEXT 34
#define KEY_END 35
#define KEY_HOME 36
#define KEY_LEFT 37
#define KEY_UP 38 
#define KEY_RIGHT 39 
#define KEY_DOWN 40 
#define KEY_SELECT 41
#define KEY_PRINT 42 
#define KEY_EXECUT 43
#define KEY_SNAPSHOT 44
#define KEY_INSERT 45 
#define KEY_DELETE 46 
#define KEY_HELP 47
#define KEY_0 48 
#define KEY_1 49
#define KEY_2 50
#define KEY_3 51
#define KEY_4 52 
#define KEY_5 53
#define KEY_6 54
#define KEY_7 55
#define KEY_8 56 
#define KEY_9 57
#define KEY_A 65 
#define KEY_B 66 
#define KEY_C 67 
#define KEY_D 68
#define KEY_E 69
#define KEY_F 70
#define KEY_G 71 
#Define KEY_H 72 
#define KEY_I 73 
#define KEY_J 74 
#define KEY_K 75 
#define KEY_L 76 
#define KEY_M 77 
#define KEY_N 78
#define KEY_O 79 
#define KEY_P 80
#define KEY_Q 81
#define KEY_R 82 
#define KEY_S 83 
#define KEY_T 84 
#define KEY_U 85 
#define KEY_V 86
#define KEY_W 87 
#define KEY_X 88 
#define KEY_Y 89
#define KEY_Z 90 
#define KEY_LWIN 91 
#define KEY_RWIN 92
#define KEY_APPS 93 
#define KEY_SLEEP 94
#define KEY_NUMPAD0 96 
#define KEY_NUMPAD1 97 
#define KEY_NUMPAD2 98 
#define KEY_NUMPAD3 99 
#define KEY_NUMPAD4 100 
#define KEY_NUMPAD5 101 
#define KEY_NUMPAD6 102 
#define KEY_NUMPAD7 103
#define KEY_NUMPAD8 104 
#define KEY_NUMPAD9 105
#define KEY_MULTIPLY 106
#define KEY_ADD 107
#define KEY_SEPARATOR 108
#define KEY_SUBTRACT 109
#define KEY_DECIMAL 110
#define KEY_DIVIDE 111
#define KEY_F1 112 
#define KEY_F2 113
#define KEY_F3 114
#define KEY_F4 115
#define KEY_F5 116 
#define KEY_F6 117
#define KEY_F7 118
#define KEY_F8 119
#define KEY_F9 120 
#define KEY_F10 121
#define KEY_F11 122 
#define KEY_F12 123
#define KEY_F13 124
#define KEY_F14 125
#define KEY_F15 126
#define KEY_F16 127 
#define KEY_F17 128 
#define KEY_F18 129 
#define KEY_F19 130
#define KEY_F20 131
#define KEY_F21 132
#define KEY_F22 133
#define KEY_F23 134
#define KEY_F24 135
#define KEY_NUMLOCK 144 
#define KEY_SCROLL 145
#define KEY_LSHIFT 160
#define KEY_RSHIFT 161
#define KEY_LCONTROL 162 
#define KEY_RCONTROL 163
#define KEY_LMENU 164
#define KEY_RMENU 165 
#define KEY_PLUS 187 
#define KEY_COMMA 188
#define KEY_MINUS 189
#define KEY_PERIOD 190
#define KEY_ATTN 246
#define KEY_CRSEL 247
#define KEY_EXSEL 248
#define KEY_EREOF 249
#define KEY_PLAY 250
#define KEY_ZOOM 251
#define KEY_PA1 253
#define KEY_OEM_CLEAR 254
#define KEY_CODES_COUNT 255






'MOUSE
#define MOUSE_LEFT 0
#define MOUSE_MIDDLE 1
#define MOUSE_RIGHT 2

Enum PHYSIC_QUALITY
	Q_LINEAR = 0
	Q_ADAPTATIVE
	Q_EXACT
End Enum

Enum CHIL_UPDATE_MODE
	C_NONE = 0
	C_READ
	C_CONTROL
	C_COUNT
End Enum

Enum LIGHT_TYPE
	LGT_POINT = 0
	LGT_SPOT
	LGT_DIRECTIONAL
End Enum

Enum MATERIAL_FLAG
	MF_WIREFRAME = 0
	MF_POINTCLOUD
	MF_FLAT
	MF_FULLBRITGH
	MF_ZBUFFER
	MF_ZWRITER
	MF_BACKFACE
	MF_FRONTFACE
	MF_FOG
	MF_NORMALIZE
End Enum

Enum MATERIAL_TYPE
	MT_SOLID = 0
	MT_LIGHT_MAP
	MT_DETAIL_MAP
	MT_SPHERE_MAP
	MT_REFLECTION
	MT_TRANSPARENT_ADD
	MT_TRANSPARENT
	MT_NORMAL_MAP
	MT_PARALLAX_MAP
End Enum


Enum VERTEX_TYPE
	VT_TCOORS = 0
	VT_TANGENTS
End Enum

Enum MODE_UP
	UP_ALL = 0
	UP_GRAPHICS
	UP_PHYSICS
	UP_SOUNDS
End Enum

Enum IRR_TERRAIN_PATCH_SIZE
    ETPS_9 = 9                    ' patch size of 9, at most, use 4 levels of detail with this patch size.  
    ETPS_17 = 17                  ' patch size of 17, at most, use 5 levels of detail with this patch size.  
    ETPS_33 = 33                  ' patch size of 33, at most, use 6 levels of detail with this patch size.  
    ETPS_65 = 65                  ' patch size of 65, at most, use 7 levels of detail with this patch size.  
    ETPS_129 = 129                ' patch size of 129, at most, use 8 levels of detail with this patch size. 
End Enum

'/--------------------------------|
'[GRAPHICS                        ]>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
'\-----------------------------------------------------------------------------------------------/

Declare Sub Transparency Cdecl Alias "Transparency" (Byval Level As Uinteger)
Declare Sub Colors Cdecl Alias "Colors" (Byval Red As Uinteger,Byval Green As Uinteger,Byval Blue As Uinteger)
Declare Sub Line2D Cdecl Alias "Line2D" (Byval x1 As Integer,Byval y1 As Integer,Byval x2 As Integer,Byval y2 As Integer)
Declare Sub Line3D Cdecl Alias "Line3D" (Byval x1 As single,Byval y1 As single,Byval z1 As single,Byval x2 As single,Byval y2 As single,Byval z2 As single,Byval thickness As single,Byval Alpha As Uinteger,Byval Red As Uinteger,Byval Green As Uinteger,Byval Blue As Uinteger)
Declare Sub Rect2D Cdecl Alias "Rect2D" (Byval x As Integer,Byval y As Integer,Byval widht As Integer,Byval height As Integer)
Declare Sub Pixel Cdecl Alias "Pixel" (Byval x As Integer,Byval y As Integer)
Declare Sub Image Cdecl Alias "Image" (Byval texture As nTEXTURE,Byval x As Integer,Byval y As Integer)
Declare Sub Oval Cdecl Alias "Oval" (Byval x As Integer,Byval y As Integer,Byval Radius As single)
Declare Sub ImageSprites2D Cdecl Alias "ImageSprites2D" (Byval texture As nTEXTURE,Byval x As Integer,Byval y As Integer,Byval TX As Integer,Byval TY As Integer,_
Byval BX As Integer,Byval BY As Integer)


'/--------------------------------|
'[INPUT                           ]>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
'\-----------------------------------------------------------------------------------------------/

Declare Function KeyDown Cdecl Alias "KeyDown" (Byval keystate As Integer) As Integer
Declare Function KeyHit Cdecl Alias "KeyHit" (Byval keystate As Integer) As Integer

Declare Function MouseHit Cdecl Alias "MouseHit" (Byval keystate As Integer) As Integer
Declare Function MouseDown Cdecl Alias "MouseDown" (Byval keystate As Integer) As Integer
Declare Sub MoveMouse Cdecl Alias "MoveMouse" (Byval x As Integer,Byval y As Integer)

Declare Function MouseWheel Cdecl Alias "MouseWheel" () As Integer
Declare Function MouseX Cdecl Alias "MouseX" () As Integer
Declare Function MouseY Cdecl Alias "MouseY" () As Integer

Declare Sub ShowMouse Cdecl Alias "ShowMouse" ()
Declare Sub HideMouse Cdecl Alias "HideMouse" ()

'/--------------------------------|
'[FILE                            ]>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
'\-----------------------------------------------------------------------------------------------/

Declare Sub ChangeDirectory Cdecl Alias "ChangeDirectory" (Byval file As I)
Declare Function ExistFile Cdecl Alias "ExistFile" (Byval file As Zstring Ptr) As Integer
Declare Sub LoadZip Cdecl Alias "LoadZip" (Byval file As ZString ptr)
Declare Function LoadScene Cdecl Alias "nLoadScene" (Byval file As ZString ptr) As nMesh
Declare Sub SaveScene Cdecl Alias "nSaveScene" (Byval file As ZString ptr)


'dont use!!!
'Declare Function CreateOpenFile Cdecl Alias "CreateOpenFile" (Byval File As Zstring Ptr) As nREAD
'Declare Function ReadCHAR Cdecl Alias "ReadCHAR" (Byval File As nREAD) As zString Ptr
'Declare Function ReadFLOAT Cdecl Alias "ReadFLOAT" (Byval File As nREAD) As S
'Declare Function ReadINT Cdecl Alias "ReadINT" (Byval File As nREAD) As I
'Declare Sub CloseRead Cdecl Alias "CloseRead" (Byval File As nREAD)

'Declare Function CreateWriteFile Cdecl Alias "CreateWriteFile" (Byval File As Zstring Ptr) As nWRITE
'Declare Sub WriteCHAR Cdecl Alias "WriteCHAR" (Byval File As nWRITE,Byval c As ZString ptr)
'Declare Sub WriteFLOAT Cdecl Alias "WriteFLOAT" (Byval File As nWRITE,Byval f As Single)
'Declare Sub WriteINT Cdecl Alias "WriteINT" (Byval File As nWRITE,Byval i As Integer ptr)
'Declare Sub CloseWrite Cdecl Alias "CloseWrite" (Byval File As nWRITE)





'/--------------------------------|
'[GRASS                        ]>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
'\----------------------------------------------------


Declare function AddGrass CDECL alias "nAddGrass"(Byval terrain as nTerrain,_
Byval x as integer,Byval z as integer,Byval patchSize as integer,Byval grassScale as Single,_
Byval maxDensity as Uinteger,Byval dataPozitionX as integer,Byval dataPozitionY as integer,_
Byval heightMap as nImage,Byval textureMap as nImage,Byval grassMap as nImage,Byval grassTexture as nTexture) as nGrass

Declare sub SetGrassDensity CDECL alias "nSetGrassDensity"(Byval grass as nGrass,Byval density as Integer,Byval distance as Single)
Declare sub SetGrassWind CDECL alias "nSetGrassWind"(Byval grass as nGrass,Byval strength as Single,Byval regularity as Single)
Declare function GetGrassDrawCount CDECL alias "nGetGrassDrawCount"(Byval grass as nGrass) as uinteger

'/--------------------------------|
'[CLOUDS                       ]>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
'\----------------------------------------------------

Declare Function CreateClouds cdecl alias "nAddClouds"(Byval texture As nTEXTURE,Byval lod as uinteger, Byval depth as uinteger, Byval density as uinteger) as uinteger ptr

'/--------------------------------|
'[LENS FLARE                       ]>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
'\----------------------------------------------------

Declare Function CreateLensFlareNode cdecl alias "nAddLensFlare"(Byval texture As nTEXTURE) as uinteger ptr
Declare sub setLensFlareScale cdecl alias "nSetFlareScale"(Byval flare as nLensFlare,Byval source as single,Byval optics as single)

'/--------------------------------|
'[TEXT                            ]>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
'\-----------------------------------------------------------------------------------------------/

Declare Function LoadFont Cdecl Alias "LoadFont" (Byval File As Zstring Ptr) As nFONT
Declare Sub Font Cdecl Alias "Font" (Byval Font As nFONT)
Declare Sub Text Cdecl Alias "Text" (Byval x As integer,Byval y As integer,Byval txt As ZString Ptr,Byval cenx As Integer = 0,Byval ceny As Integer = 0)

'/--------------------------------|
'[PARTICLES                       ]>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
'\-----------------------------------------------------------------------------------------------/

'Particles
Declare Function CreateParticle Cdecl Alias "CreateParticle" () As nPARTICLE
Declare Sub ParticleEndSize Cdecl Alias "ParticleEndSize" (Byval Particle As nPARTICLE,Byval sx As single,Byval sy As Single)
Declare Sub ParticleGravity Cdecl Alias "ParticleGravity" (Byval Particle As nPARTICLE,Byval gx As S,Byval gy As S,Byval gz As S)

'Global emitter functions
Declare Sub EmitterDirection Cdecl Alias "EmitterDirection" (Byval emitter As nEMITTER,Byval dx As S,Byval dy As S,Byval dz As S)
Declare Sub EmitterPPS Cdecl Alias "EmitterPPS" (Byval emitter As nEMITTER,Byval minpps As I,Byval maxpps As I)
Declare Sub EmitterStartColor Cdecl Alias "EmitterStartColor" (Byval emitter As nEMITTER,Byval mir As I,Byval mig As I,Byval mib As I,Byval mar As I,Byval mag As I,Byval mab As I)
Declare Sub EmitterStartSize Cdecl Alias "EmitterStartSize" (Byval emitter As nEMITTER,Byval mix As I,Byval miy As I,Byval max As I,Byval may As I)

'Box Emitter
Declare Function CreateBoxEmitter Cdecl Alias "CreateBoxEmitter" (Byval Particle As nPARTICLE,Byval minv As UInteger,Byval maxv As uinteger) As nEMITTER
Declare Sub BoxEmitterSize Cdecl Alias "BoxEmitterSize" (Byval emitter As nEMITTER,Byval sx As single,Byval sy As single,Byval sz As Single)

'Cylinder Emitter
Declare Function CreateCylinderEmitter Cdecl Alias "CreateCylinderEmitter" (Byval Particle As nPARTICLE,Byval minv As UInteger,Byval maxv As UInteger) As nEMITTER
Declare Sub CylinderEmitterCenter Cdecl Alias "CylinderEmitterCenter" (Byval emitter As nEMITTER,Byval x As Single,Byval y As single,Byval z As single)
Declare Sub CylinderEmitterRadius Cdecl Alias "CylinderEmitterRadius" (Byval emitter As nEMITTER,Byval radius As single)
Declare Sub CylinderEmitterLength Cdecl Alias "CylinderEmitterLength" (Byval emitter As nEMITTER,Byval length As Single)

'Mesh Emitter
Declare Function CreateMeshEmitter Cdecl Alias "CreateMeshEmitter" (Byval Particles As nPARTICLE,Byval minv As UInteger,Byval maxv As UInteger) As nEMITTER
Declare Sub MeshEmitterMesh Cdecl Alias "MeshEmitterMesh" (Byval emitter As nEMITTER,Byval Mesh As nMESH)
Declare Sub MeshEmitterEveryVertex Cdecl Alias "MeshEmitterEveryVertex" (Byval emitter As nEMITTER,Byval EveryMeshVertex As I)

'Ring Emitter
Declare Function CreateRingEmitter Cdecl Alias "CreateRingEmitter" (Byval Particle As nPARTICLE,Byval Min As UI,Byval Max As UI) As nEMITTER
Declare Sub RingEmitterCenter Cdecl Alias "RingEmitterCenter" (Byval emitter As nEMITTER,Byval X As S,Byval Y As S,Byval Z As S)
Declare Sub RingEmitterRadius Cdecl Alias "RingEmitterRadius" (Byval emitter As nEMITTER,Byval Radius As S)
Declare Sub RingEmitterThickness Cdecl Alias "RingEmitterThickness" (Byval emitter As nEMITTER,Byval Thickness As S)

'/--------------------------------|
'[MATERIALS                       ]>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
'\-----------------------------------------------------------------------------------------------/

'For meshes
Declare Sub MaterialType Cdecl Alias "MaterialType" (Byval entity As nENTITY,Byval num As uinteger,Byval t As MATERIAL_TYPE)
Declare Sub MaterialFlag Cdecl Alias "MaterialFlag" (Byval entity As nENTITY,Byval num As uinteger,Byval flag As MATERIAL_FLAG,Byval mode As integer)
Declare Sub MaterialTexture Cdecl Alias "MaterialTexture" (Byval entity As nENTITY,Byval num As UInteger,Byval texture As nTEXTURE,Byval index As uinteger)
Declare Sub MaterialColor Cdecl Alias "MaterialColor" (Byval entity As nENTITY,Byval num As UInteger,Byval red As uinteger,Byval green As uinteger,Byval blue As UInteger)
Declare Sub MaterialEmissiveColor Cdecl Alias "MaterialColor" (Byval entity As nENTITY,Byval num As UInteger,Byval red As uinteger,Byval green As uinteger,Byval blue As UInteger)
Declare Sub MaterialShininess Cdecl Alias "MaterialShininess" (Byval entity As nENTITY,Byval num As UInteger,Byval shininess As single)
Declare Sub MaterialAlpha Cdecl Alias "MaterialAlpha" (Byval entity As nENTITY,Byval num As UInteger,Byval level As UI)
Declare Sub MaterialTextureUV Cdecl Alias "MaterialTextureUV" (Byval entity As nENTITY,Byval num As UInteger,Byval index As UI,Byval u As S,Byval v As S)
Declare Sub MaterialTextureAngle Cdecl Alias "MaterialTextureAngle" (Byval entity As nENTITY,Byval num As UInteger,Byval index As UI,Byval angle As S)
Declare Sub MaterialTextureScale Cdecl Alias "MaterialTextureScale" (Byval entity As nENTITY,Byval num As UInteger,Byval index As UI,Byval sx As S,Byval sy As S)
Declare function MaterialCount Cdecl Alias "MaterialCount"( Byval entity As 	nENTITY) as UInteger

'For Bodies
Declare function CreateMaterial Cdecl Alias "CreateMaterial" () As nMATERIAL
Declare Sub BodyMaterial Cdecl Alias"BodyMaterial" (Byval Body As nBODY, Byval material as nMATERIAL)
Declare Sub MaterialElasticity Cdecl Alias "MaterialElasticity" (Byval material1 As nMATERIAL,Byval material2 As nMATERIAL,Byval elasticity As single)
Declare Sub MaterialFriction Cdecl Alias "MaterialFriction" (Byval material1 As nMATERIAL,Byval material2 As nMATERIAL,Byval sfriction As single,Byval kfriction As single)
Declare Sub MaterialSoftness Cdecl Alias "MaterialSoftness" (Byval material1 As nMATERIAL,Byval material2 As nMATERIAL,Byval softness As single)
Declare Sub MaterialCollidable Cdecl Alias "MaterialCollidable" (Byval material1 As nMATERIAL,Byval material2 As nMATERIAL,Byval mode As integer)

'/--------------------------------|
'[CAMERA                          ]>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
'\-----------------------------------------------------------------------------------------------/

'Fader
Declare Sub FadeIn Cdecl Alias "FadeIn" (Byval t As UInteger)
Declare Sub FadeOut Cdecl Alias "FadeOut" (Byval t As uInteger)
Declare Sub FaderColor Cdecl Alias "FaderColor" (ByVal r As uinteger,Byval g As uinteger,Byval b As UInteger)
Declare Function FadeIsReady Cdecl Alias "FadeIsReady"( ) As integer 

'Camera
Declare Function CreateCamera Cdecl Alias "CreateCamera" () As nCAMERA
Declare Function CreateCameraFPS Cdecl Alias "CreateCameraFPS" (Byval rots As S,Byval movs As S) As nCAMERA
Declare Function CreateCameraMaya Cdecl Alias "CreateCameraMaya" (Byval rots As S,Byval zoos As S,Byval movs As S) As nCAMERA
Declare Function CreateCameraIsometric Cdecl Alias "CreateCameraIsometric" (Byval Width As Single,Byval height As Single,Byval near As Single,Byval far As Single) As nCAMERA
Declare Function CameraPick Cdecl Alias "CameraPick"( x As integer, y As integer ) As nENTITY 

Declare Sub CameraFOV Cdecl Alias "CameraFOV" (Byval camera As nCAMERA,Byval ratio As S)
Declare Sub CameraRange Cdecl Alias "CameraRange" (Byval camera As nCAMERA,Byval near As S,Byval far As S)
Declare Sub CameraTarget Cdecl Alias "CameraTarget" (Byval camera As nCAMERA,Byval tx As S,Byval ty As S,Byval tz As S)
Declare Sub ActiveCamera Cdecl Alias "ActiveCamera" (Byval camera As nCAMERA)
Declare Sub CameraViewPort Cdecl Alias "CameraViewPort" (Byval width As I,Byval height As I)
Declare Sub CameraAspectRatio Cdecl Alias "CameraAspectRatio" (Byval camera As nCAMERA,Byval aspect As S)

Declare Function TargetX Cdecl Alias "TargetX" (Byval camera As nCAMERA) As single
Declare Function TargetY Cdecl Alias "TargetY" (Byval camera As nCAMERA) As Single
Declare Function TargetZ Cdecl Alias "TargetZ" (Byval camera As nCAMERA) As single

Declare Function ViewPortWidth Cdecl Alias "ViewPortWidth" () As I
Declare Function ViewPortHeight Cdecl Alias "ViewPortHeight" () As I

'/--------------------------------|
'[LIGHT                           ]>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
'\-----------------------------------------------------------------------------------------------/

Declare Function CreateLight Cdecl Alias "CreateLight" (Byval mode As LIGHT_TYPE) As nLIGHT
Declare Sub LightRadius Cdecl Alias "LightRadius" (Byval light As nLIGHT,Byval radius As Single)
Declare Sub LightCastShadow Cdecl Alias "LightCastShadow" (Byval light As nLIGHT)
Declare Sub LightColor Cdecl Alias "LightColor" (Byval light As nLIGHT,Byval red As uinteger,Byval green As uinteger,Byval blue As UInteger)
Declare Sub LightFalloff Cdecl Alias "LightFalloff" (Byval light As nLIGHT,Byval falloff As S)
Declare Sub LightConeAngles Cdecl Alias "LightConeAngles" (Byval light As nLIGHT,Byval Inner As Single,Byval Outer As single)
Declare Sub LightAttenuation Cdecl Alias "LightAttenuation" (Byval light As nLIGHT,Byval c As single,Byval l As single,Byval q As single)
Declare Sub LightDirection Cdecl Alias "LightDirection" (Byval light As nLIGHT,Byval x As Single,Byval y As Single,Byval z As Single)

'/--------------------------------|
'[MESH                            ]>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
'\-----------------------------------------------------------------------------------------------/

Declare Function CreateMeshNull Cdecl Alias "CreateMeshNull" () As nMESH
Declare Function CreateMeshCube Cdecl Alias "CreateMeshCube" () As nMESH
Declare Function CreateMeshSphere Cdecl Alias "CreateMeshSphere" (Byval polycount As uinteger) As nMESH
Declare Function CreateMeshCylinder Cdecl Alias "CreateMeshCylinder" (Byval polycount As UInteger) As nMESH
Declare Function CreateMeshCone Cdecl Alias "CreateMeshCone" (Byval polycount As UInteger) As nMESH
Declare Function CreateMeshPlane Cdecl Alias "CreateMeshPlane" (Byval size As Single,Byval tileCount As uinteger) As nMESH
Declare Function CreateMeshWater Cdecl Alias "CreateMeshWater" (Byval height As single,Byval speed As single,Byval length As single) As nENTITY

Declare Function LoadMesh Cdecl Alias "LoadMesh" (Byval file As Zstring Ptr,Byval toTangents As VERTEX_TYPE = VT_TCOORS) As nBSPNode
Declare Sub MeshCastShadow Cdecl Alias "MeshCastShadow" (Byval mesh As nMESH)
Declare Sub OutlineMesh Cdecl Alias "OutlineMesh" (Byval mesh As nMESH,Byval w As single,Byval r As uinteger,Byval g As uinteger,Byval b As uinteger)
Declare Sub ScaleMesh Cdecl Alias "ScaleMesh" (Byval mesh As nMESH,Byval scax As single,Byval scay As single,Byval scaz As Single)
Declare Sub AnimateMesh Cdecl Alias "AnimateMesh" (Byval mesh As nMESH,Byval looped As I,Byval speed As Single,Byval b As integer,Byval e As integer,Byval t As single)
Declare Function MeshesCollide Cdecl Alias "MeshesCollide" (Byval mesh1 As nMESH,Byval mesh2 As nMESH) As Integer
Declare Function VertexCount Cdecl Alias "VertexCount" (Byval mesh As nMESH) As UInteger
Declare Function CurrentFrame Cdecl Alias "CurrentFrame" (Byval mesh As nMESH) As integer

Declare Function CountChildren Cdecl Alias "CountChildren" (Byval mesh As nMESH) As Uinteger
Declare Function FindChild Cdecl Alias "FindChild" (Byval mesh As nMESH,Byval nameChild As Zstring Ptr) As nCHILD
Declare Function ChildName Cdecl Alias "ChildName" (Byval child As nCHILD) As Zstring Ptr
Declare Sub ChildMode Cdecl Alias "ChildMode" (Byval mesh As nMESH,ByVal mode As integer)

'/--------------------------------|
'[TERRAIN                         ]>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
'\-----------------------------------------------------------------------------------------------/

declare function LoadTerrain CDECL alias "LoadTerrain" ( _
        byval path as zstring ptr, _
        byval xPosition as single = 0.0, _
        byval yPosition as single = 0.0, _
        byval zPosition as single = 0.0, _
        byval xRotation as single = 0.0, _
        byval yRotation as single = 0.0, _
        byval zRotation as single = 0.0, _
        byval xScale as single = 1.0, _
        byval yScale as single = 1.0, _
        byval zScale as single = 1.0, _
        byval vertexAlpha as integer = 255, _
        byval vertexRed as integer = 255, _
        byval vertexGreen as integer = 255, _
        byval vertexBlue as integer = 255, _
        byval smoothing as integer = 4, _
        byval maxLOD as integer = 5, _
        byval patchSize as IRR_TERRAIN_PATCH_SIZE = ETPS_17 ) as nterrain


Declare Sub ScaleTexture Cdecl Alias "ScaleTexture" (Byval terrain As nENTITY,Byval sx As S,Byval sy As S)
Declare Function TerrainHeight Cdecl Alias "TerrainHeight" (Byval terrain As nENTITY,Byval x As S,Byval z As S) As S

'/--------------------------------|
'[MISC                            ]>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
'\-----------------------------------------------------------------------------------------------/

'Sky
Declare Function CreateSkyDome Cdecl Alias "CreateSkyDome" (Byval texture As nTEXTURE,Byval radius as Single) As nENTITY
Declare Function CreateSkyBox Cdecl Alias "CreateSkyBox" (Byval tp As nTEXTURE,Byval bt As nTEXTURE,Byval lf As nTEXTURE,Byval rg As nTEXTURE,Byval ft As nTEXTURE,Byval bk As nTEXTURE) As nENTITY

'/--------------------------------|
'[MATHS                           ]>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
'\-----------------------------------------------------------------------------------------------/

Declare Function WrapValue Cdecl Alias "WrapValue" (Byval newvalue As S,Byval oldvalue As S,Byval increment As S) As S
Declare Function CurveValue Cdecl Alias "CurveValue" (Byval newvalue As S,Byval oldvalue As S,Byval increment As S) As S
Declare Function Distance2D Cdecl Alias "Distance2D" (Byval x1 As S,Byval y1 As S,Byval x2 As S,Byval y2 As S) As S
Declare Function Distance3D Cdecl Alias "Distance3D" (Byval x1 As S,Byval y1 As S,Byval z1 As S,Byval x2 As S,Byval y2 As S,Byval z2 As S) As S
Declare Function Min Cdecl Alias "Min" (Byval value1 As S,Byval value2 As S) As S
Declare Function Max Cdecl Alias "Max" (Byval value1 As S,Byval value2 As S) As S
Declare Function Rand Cdecl Alias "Rand" (Byval value1 As I,Byval value2 As I) As I

'/--------------------------------|
'[TEXTURE                         ]>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
'\-----------------------------------------------------------------------------------------------/

Declare Function LoadTexture Cdecl Alias "LoadTexture" (Byval filename As Zstring Ptr) As nTEXTURE
Declare Function CreateRTT Cdecl Alias "CreateRTT" (Byval sx As I,Byval sy As I) As nTEXTURE
Declare Sub RenderTarget Cdecl Alias "RenderTarget" (Byval texture As nTEXTURE)
Declare Sub ColorKeyTexture Cdecl Alias "ColorKeyTexture" (Byval texture As nTEXTURE,Byval red As UI,Byval green As UI,Byval blue As UI)
Declare Function FindTexture Cdecl Alias "FindTexture" (Byval n As Zstring Ptr) As nTEXTURE
Declare Function TextureWidth Cdecl Alias "TextureWidth" (Byval texture As nTEXTURE) As I
Declare Function TextureHeight Cdecl Alias "TextureHeight" (Byval texture As nTEXTURE) As I
Declare Function LockTexture Cdecl Alias "LockTexture" (Byval texture As nTEXTURE) As Uinteger Ptr
Declare Sub UnLockTexture Cdecl Alias "LockTexture" (Byval texture As nTEXTURE)
declare function LoadImageFromFile CDECL alias "nGetImage"(Byval filename as  zstring ptr) as nImage


'/--------------------------------|
'[SOUND                           ]>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
'\-----------------------------------------------------------------------------------------------/

Declare Function LoadSound Cdecl Alias "LoadSound" (Byval File As zstring ptr) As nSOUND
Declare Sub SoundType Cdecl Alias "SoundType" (Byval sound As nSOUND,Byval mode As I)
Declare Sub VolumeSound Cdecl Alias "VolumeSound" (Byval sound As nSOUND,Byval volume as single)
Declare Sub PitchSound Cdecl Alias "PitchSound" (Byval sound As nSOUND,Byval pitch as single)
Declare Sub PlaySound Cdecl Alias "PlaySound" (Byval sound As nSOUND)
Declare Sub StopSound Cdecl Alias "StopSound" (Byval sound As nSOUND)
Declare Sub PauseSound Cdecl Alias "PauseSound" (Byval sound As nSOUND)
Declare Sub LoopSound Cdecl Alias "LoopSound" (Byval sound As nSOUND)
Declare Sub SoundReferenceDistance Cdecl Alias "SoundReferenceDistance" (Byval sound As nSOUND,Byval value As S)
Declare Sub SoundRollOff Cdecl Alias "SoundRollOff" (Byval sound As nSOUND,Byval value As S)

'/--------------------------------|
'[SPRITE                          ]>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
'\-----------------------------------------------------------------------------------------------/

Declare Function LoadSprite Cdecl Alias "LoadSprite" (Byval fileName As Zstring Ptr) As nSPRITE
Declare Sub ScaleSprite Cdecl Alias "ScaleSprite" (Byval sprite As nSPRITE,Byval sx As Single,Byval sy As Single)
Declare Sub SpriteColor Cdecl Alias "SpriteColor" (Byval sprite As nSPRITE,Byval red As Uinteger,Byval green As Uinteger,Byval blue As Uinteger)

'/--------------------------------|
'[SHADERS                         ]>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
'\-----------------------------------------------------------------------------------------------/

Declare Function LoadShader Cdecl Alias "LoadShader" (Byval VFileName As Zstring Ptr,Byval PFileName As Zstring Ptr) As nSHADER
Declare Sub ApplyShadersEntity Cdecl Alias "ApplyShadersEntity" (Byval Shader As nSHADER,Byval Entity As nENTITY)
Declare Sub ApplyShadersMaterial Cdecl Alias "ApplyShadersMaterial" (Byval Shader As nSHADER,Byval Entity As nENTITY,Byval Num As Uinteger)
Declare Sub VertexShaderConstant Cdecl Alias "VertexShaderConstant" (Byval Shader As nSHADER,Byval FName As Zstring Ptr,Byval CData As Single Ptr, Byval Count As Integer)
Declare Sub PixelShaderConstant Cdecl Alias "PixelShaderConstant" (Byval Shader As nSHADER,Byval FName As Zstring Ptr,Byval CData As Single Ptr, Byval Count As Integer)



'/--------------------------------|
'[CONTROL                         ]>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
'\-----------------------------------------------------------------------------------------------/

Declare Sub DeleteEntity Cdecl Alias "DeleteEntity" (Byval Entity As nENTITY)
Declare Sub ShowEntity Cdecl Alias "ShowEntity" (Byval Entity As nENTITY)
Declare Sub HideEntity Cdecl Alias "HideEntity" (Byval Entity As nENTITY)
Declare Sub NameEntity Cdecl Alias "NameEntity" (Byval Entity As nENTITY,Byval namemesh As zstring ptr)
Declare Sub EntityParent Cdecl Alias "EntityParent" (Byval entity As nENTITY,Byval Parent As nENTITY)
Declare Sub EntityTexture Cdecl Alias "EntityTexture" (Byval Entity As nENTITY,Byval Texture As nTEXTURE,Byval Index As Uinteger)
Declare Sub EntityColor Cdecl Alias "EntityColor" (Byval Entity As nENTITY,Byval Red As Uinteger,Byval Green As Uinteger,Byval Blue As Uinteger)
Declare Sub EntityShininess Cdecl Alias "EntityShininess" (Byval Entity As nENTITY,Byval shininess As Single)
Declare Sub EntityAlpha Cdecl Alias "EntityAlpha" (Byval Entity As nENTITY,Byval level As Uinteger)
Declare Sub EntityType Cdecl Alias "EntityType" (Byval Entity As nENTITY,Byval t As MATERIAL_TYPE)
Declare Sub EntityFlag Cdecl Alias "EntityFlag" (Byval Entity As nENTITY,Byval Flag As MATERIAL_FLAG,Byval Mode As Integer)
Declare Function CopyEntity Cdecl Alias "CopyEntity" (Byval Entity As nENTITY) As nENTITY

'/--------------------------------|
'[MOVEMENT                        ]>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
'\-----------------------------------------------------------------------------------------------/

Declare Sub PositionEntity Cdecl Alias "PositionEntity" (Byval entity As nENTITY,Byval x As Single,Byval y As Single,Byval z As Single)
Declare Sub RotateEntity Cdecl Alias "RotateEntity" (Byval entity As nENTITY,Byval x As Single,Byval y As Single,Byval z As Single)
Declare Sub TurnEntity Cdecl Alias "TurnEntity" (Byval entity As nENTITY,Byval x As Single,Byval y As Single,Byval z As Single)
Declare Sub MoveEntity Cdecl Alias "MoveEntity" (Byval entity As nENTITY,Byval x As Single,Byval y As Single,Byval z As Single)
Declare Sub PointEntity Cdecl Alias "PointEntity" (Byval entity1 As nENTITY,Byval entity2 As nENTITY)

'/--------------------------------|
'[STATE                           ]>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
'\-----------------------------------------------------------------------------------------------/

Declare Function EntityX Cdecl Alias "EntityX" (Byval entity As nENTITY) As Single
Declare Function EntityY Cdecl Alias "EntityY" (Byval entity As nENTITY) As Single
Declare Function EntityZ Cdecl Alias "EntityZ" (Byval entity As nENTITY) As Single
Declare Function EntityPitch Cdecl Alias "EntityPitch" (Byval entity As nENTITY) As Single
Declare Function EntityYaw Cdecl Alias "EntityYaw" (Byval entity As nENTITY) As Single
Declare Function EntityRoll Cdecl Alias "EntityRoll" (Byval entity As nENTITY) As Single
Declare Function EntityName Cdecl Alias "EntityName" (Byval entity As nENTITY) As zstring ptr
Declare Function LinePick Cdecl Alias " LinePick "(Byval X1 As single, Byval Y1 As single,Byval Z1 As single,_
    Byval X2 As single,Byval Y2 As single,Byval Z2 As single) As nENTITY
Declare Function EntityDistance Cdecl Alias "EntityDistance"(Byval entity1 As nENTITY,Byval entity2 As nENTITY) As Single 


'/--------------------------------|
'[PHYSIC                          ]>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
'\-----------------------------------------------------------------------------------------------/

'WORLD
Declare Sub PhysicQuality Cdecl Alias "PhysicQuality" (Byval mode As PHYSIC_QUALITY)
Declare Sub WorldGravity Cdecl Alias "WorldGravity" (Byval GX As S,Byval GY As S,Byval GZ As S)
Declare Sub WorldSize Cdecl Alias "WorldSize" (Byval X As S,Byval Y As S,Byval state As S)
Declare Sub WorldMousePick Cdecl Alias "WorldMousePick" (Byval X As I,Byval Y As I,Byval Z As I)


'Body
Declare Function CreateBodyNull Cdecl Alias "CreateBodyNull" () As nBODY
Declare Function CreateBodyCube Cdecl Alias "CreateBodyCube" (Byval SX As Single,Byval SY As Single,Byval SZ As Single,Byval Mass As single) As nBODY
Declare Function CreateBodySphere Cdecl Alias "CreateBodySphere" (Byval SX As Single,Byval SY As Single,Byval SZ As Single,Byval Mass As Single) As nBODY
Declare Function CreateBodyCylinder Cdecl Alias "CreateBodyCylinder" (Byval Radius As Single,Byval Height As Single,Byval Mass As Single,ByVal Offset As Integer = 1) As nBODY
Declare Function CreateBodyCone Cdecl Alias "CreateBodyCone" (Byval Radius As single,Byval Height As Single,Byval Mass As Single,ByVal Offset As Integer = 1) As nBODY
Declare Function CreateBodyCapsule Cdecl Alias "CreateBodyCapsule" (Byval Radius As single,Byval Height As single,Byval Mass As Single,ByVal Offset As Integer = 1) As nBODY

Declare Function CreateBodyHull Cdecl Alias "CreateBodyHull" (Byval Mesh As nMESH,Byval mass As Single) As nBODY
Declare Function CreateBodyTree Cdecl Alias "CreateBodyTree" (Byval Mesh As nMESH,Byval mass As Single) As nBODY
Declare Function CreateBodyTreeBSP Cdecl Alias "CreateBodyTreeBSP"(Byval Mesh As Uinteger ptr,Byval Node As Uinteger ptr) As nBODY
Declare Function CreateBodyTerrain Cdecl Alias "CreateBodyTerrain" (Byval terrain As nTERRAIN,Byval LOD As Integer) As nBODY
Declare Function CreateBodyWater Cdecl Alias "CreateBodyWater" (Byval SX As Single,Byval SY As Single,Byval SZ As Single,Byval fluidDensity As Single,Byval linearViscosity As Single,Byval angularViscosity As Single) As nBODY

Declare Sub AngularVelocity Cdecl Alias "AngularVelocity" (Byval Body As nBODY,Byval VX As S,Byval VY As S,Byval VZ As S)
Declare Sub LinearVelocity Cdecl Alias "LinearVelocity" (Byval Body As nBODY,Byval VX As S,Byval VY As S,Byval VZ As S)

Declare Sub LinearDamping Cdecl Alias "LinearDamping" (Byval Body As nBODY,Byval Damping As S)
Declare Sub AngularDamping Cdecl Alias "AngularDamping" (Byval Body As nBODY,Byval ax As S,Byval ay As S,Byval az As S)
Declare Sub AddImpulse Cdecl Alias "AddImpulse" (Byval Body As nBODY,Byval PX As S,Byval PY As S,Byval PZ As S,Byval VX As S,Byval VY As S,Byval VZ As S)

Declare Function BodiesCollide Cdecl Alias "BodiesCollide" (Byval body1 As nBODY,Byval body2 As nBODY) As Integer


Declare Function BodyCollX Cdecl Alias "BodyCollX" (Byval body1 As nBODY,Byval body2 As nBODY) As Single
Declare Function BodyCollY Cdecl Alias "BodyCollY" (Byval body1 As nBODY,Byval body2 As nBODY) As Single
Declare Function BodyCollZ Cdecl Alias "BodyCollZ" (Byval body1 As nBODY,Byval body2 As nBODY) As Single

Declare Function BodyCollNX Cdecl Alias "BodyCollNX" (Byval body1 As nBODY,Byval body2 As nBODY) As Single
Declare Function BodyCollNY Cdecl Alias "BodyCollNY" (Byval body1 As nBODY,Byval body2 As nBODY) As Single
Declare Function BodyCollNZ Cdecl Alias "BodyCollNZ" (Byval body1 As nBODY,Byval body2 As nBODY) As Single

Declare Sub DrawBody Cdecl Alias "DrawBody" (Byval body As nBODY)

'Joint
Declare Function CreateJointBall Cdecl Alias "CreateJointBall" (Byval px As Single,Byval py As Single,Byval pz As Single,Byval dx As Single,Byval dy As Single,Byval dz As Single,Byval body1 As nBODY,Byval body2 As nBODY) As nJOINT
Declare Function CreateJointHinge Cdecl Alias "CreateJointHinge" (Byval px As Single,Byval py As Single,Byval pz As Single,Byval dx As Single,Byval dy As Single,Byval dz As Single,Byval body1 As nBODY,Byval body2 As nBODY) As nJOINT
Declare Function CreateJointSlider Cdecl Alias "CreateJointSlider" (Byval px As Single,Byval py As Single,Byval pz As Single,Byval dx As Single,Byval dy As Single,Byval dz As Single,Byval body1 As nBODY,Byval body2 As nBODY) As nJOINT
Declare Function CreateJointUpVector Cdecl Alias "CreateJointUpVector" (Byval px As Single,Byval py As Single,Byval pz As Single,Byval body1 As nBODY) As nJOINT
Declare Function CreateJointCorkscrew Cdecl Alias "CreateJointCorkscrew" (Byval px As Single,Byval py As Single,Byval pz As Single,Byval dx As Single,Byval dy As Single,Byval dz As Single,Byval body1 As nBODY,Byval body2 As nBODY) As nJOINT

'Declare Sub JointStiffness Cdecl Alias "JointStiffness" (Byval joint As nJOINT,Byval stiffness As Double)
Declare Sub JointCollisionState Cdecl Alias "JointCollisionState" (Byval joint As nJOINT,Byval state As Integer)
Declare Sub BallLimits Cdecl Alias "BallLimits" (Byval joint As nJOINT,Byval maxconeangle As Single,Byval mintwistangle As Single,Byval maxtwistangle As Single)
Declare Sub HingeLimits Cdecl Alias "HingeLimits" (Byval joint As nJOINT,Byval minAngle As Single,Byval maxAngle As Single)
Declare Sub SliderLimits Cdecl Alias "SliderLimits" (Byval joint As nJOINT,Byval minAngle As Single,Byval maxAngle As Single)
Declare Sub CorkScrewLinearLimits Cdecl Alias "CorkScrewLinearLimits" (Byval joint As nJOINT,Byval minDist As Single,Byval maxDist As Single)
Declare Sub CorkScrewAngularLimits Cdecl Alias "CorkScrewAngularLimits" (Byval joint As nJOINT,Byval minDist As Single,Byval maxDist As Single)

'Vehicle
Declare Function CreateVehicle Cdecl Alias "CreateVehicle" (Byval x As Single,Byval y As Single,Byval z As Single,Byval body1 As nBODY) As nJOINT
Declare function VehicleSpeed Cdecl Alias "VehicleSpeed" (Byval joint As nJOINT) As single
Declare sub AddTire Cdecl Alias "AddTire" (Byval joint As nJOINT,ByVal ud As nENTITY,Byval x As Single,Byval y As Single,Byval z As Single,Byval mass As Single,Byval r As Single,Byval w As Single,Byval f As Single,Byval sl As Single,Byval sc As Single,Byval sd As Single)
Declare Sub ApplyBrake Cdecl Alias "ApplyBrake" (Byval joint As nJOINT,Byval wheel As integer,Byval brake As Single)
Declare Sub ApplySteering Cdecl Alias "ApplySteering" (Byval joint As nJOINT,Byval wheel As integer,Byval vrate As Single)
Declare Sub ApplyTorque Cdecl Alias "ApplyTorque" (Byval joint As nJOINT,Byval wheel As integer,Byval torque As Single)

'/--------------------------------|
'[TIME                            ]>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
'\-----------------------------------------------------------------------------------------------/

Declare sub TimeStart Cdecl Alias "TimeStart" ()
Declare sub TimeStop Cdecl Alias "TimeStop" ()
Declare sub TimeSpeed Cdecl Alias "TimeSpeed" (byval speed As Single)
Declare Function GetTime Cdecl Alias "GetTime" () As UInteger
Declare Function GetRealTime Cdecl Alias "GetRealTime" () As UInteger

'/--------------------------------|
'[SYSTEM                          ]>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
'\-----------------------------------------------------------------------------------------------/

Declare Sub AppTitle Cdecl Alias "AppTitle" (Byval t As Zstring Ptr)
Declare Function SupportGLSL Cdecl Alias "SupportGLSL" () As Integer
Declare Function SupportHardwareTL Cdecl Alias "SupportHardwareTL" () As Integer
Declare Function AvailableMemory Cdecl Alias "AvailableMemory" () As UInteger
Declare Function TotalMemory Cdecl Alias "TotalMemory" () As UInteger
Declare Function VideoModeCount Cdecl Alias "VideoModeCount" () As Integer
Declare Function VideoModeDepth Cdecl Alias "VideoModeDepth" () As Integer
Declare Function VideoModeResolutionWidth Cdecl Alias "VideoModeResolutionWidth" () As Integer
Declare Function VideoModeResolutionHeight Cdecl Alias "VideoModeResolutionHeight" () As Integer
Declare Function SupportStencilBuffer Cdecl Alias "SupportStencilBuffer"() As Integer
Declare Function SupportMultiTexture Cdecl Alias "SupportMultiTexture"() As Integer
Declare Function SupportARB Cdecl Alias "SupportARB"() As Integer
Declare Function ProcessorSpeed Cdecl Alias "ProcessorSpeed"() As UInteger


'/--------------------------------|
'[GLOBAL                          ]>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
'\-----------------------------------------------------------------------------------------------/

Declare Sub BackGroundColor Cdecl Alias "BackGroundColor" (Byval r As UInteger,Byval g As UInteger,Byval b As UInteger)
Declare Sub AmbientLight Cdecl Alias "AmbientLight" (Byval r As UInteger,Byval g As UInteger,Byval b As UInteger)
Declare Sub ShadowColor Cdecl Alias "ShadowColor" (Byval r As UInteger,Byval g As UInteger,Byval b As UInteger,Byval a As UInteger)

Declare Sub Fog Cdecl Alias "Fog" (Byval r As UInteger,Byval g As UInteger,Byval b As UInteger,Byval Density As Single)

Declare Sub ScreenShot Cdecl Alias "ScreenShot" ()

Declare Sub InitEngine Cdecl Alias "InitEngine" (Byval X As Integer,Byval Y As Integer,Byval bits As Integer,Byval mode As Integer)
Declare Function EngineRun Cdecl Alias "EngineRun" () As Integer
Declare Sub UpdateEngine Cdecl Alias "UpdateEngine" (Byval TimeStep As Single,ByVal mode As MODE_UP = UP_ALL)
Declare Sub CloseEngine Cdecl Alias "CloseEngine" ()
Declare Sub EndEngine Cdecl Alias "EndEngine" ()

Declare Sub Collisions Cdecl Alias "Collisions" (Byval mesh As nMESH,Byval entity As nENTITY,Byval mode As I,_
        Byval SX AS Single=3,Byval SY AS Single=3,Byval SZ AS Single=3,_
        Byval GX AS SINGLE=0,Byval GY AS SINGLE=-1,Byval GZ AS SINGLE=0,_
        Byval OFFX AS SINGLE=0,Byval OFFY AS SINGLE=3,Byval OFFZ AS SINGLE=0)

Declare Sub EnableAntialias Cdecl Alias "EnableAntialias" ()
Declare Sub EnableVsync Cdecl Alias "EnableVsync" ()

Declare Sub BeginScene Cdecl Alias "BeginScene" ()
Declare Sub EndScene Cdecl Alias "EndScene" ()

Declare Function Fps Cdecl Alias "Fps" () As single'Integer
Declare Function TrisRendered Cdecl Alias "TrisRendered" () As uinteger

Declare Function LightCount Cdecl Alias "LightCount" () As UI
Declare Function PrimitiveCount Cdecl Alias "PrimitiveCount" () As I
Declare Function BodyCount Cdecl Alias "BodyCount" () As I


'BSP

declare function LoadMeshBSP CDECL alias "LoadMeshBSP" ( byval path as zstring ptr ) as UINTEGER PTR
declare function CreateNodeBSPfromMeshBSP CDECL alias "CreateNodeBSPfromMeshBSP" (byval mesh as UINTEGER PTR) as UINTEGER PTR
Declare Sub StaticCollisionsBSP Cdecl Alias "StaticCollisionsBSP" (Byval meshBSP As nMESH,Byval nodeBSP As nMESH,Byval entity As nENTITY,_
        Byval SX AS Single=10,Byval SY AS Single=10,Byval SZ AS Single=10,_
        Byval GX AS SINGLE=0,Byval GY AS SINGLE=-100,Byval GZ AS SINGLE=0,_
        Byval OFFX AS SINGLE=0,Byval OFFY AS SINGLE=50,Byval OFFZ AS SINGLE=0)






