Browse Source

Added initial assimplib

markcwm 8 years ago
parent
commit
de6f3d8114
5 changed files with 1450 additions and 0 deletions
  1. 57 0
      assimplib.mod/assimplib.bmx
  2. 262 0
      assimplib.mod/common.bmx
  3. 161 0
      assimplib.mod/doc/commands.html
  4. 198 0
      assimplib.mod/source.bmx
  5. 772 0
      assimplib.mod/types.bmx

+ 57 - 0
assimplib.mod/assimplib.bmx

@@ -0,0 +1,57 @@
+' Copyright (c) 2009-2011 Peter Scheutz
+' All rights reserved.
+'
+' Redistribution and use in source and binary forms, with or without
+' modification, are permitted provided that the following conditions are met:
+'   * Redistributions of source code must retain the above copyright
+'     notice, this list of conditions and the following disclaimer.
+'   * Redistributions in binary form must reproduce the above copyright
+'     notice, this list of conditions and the following disclaimer in the
+'     documentation and/or other materials provided with the distribution.
+'   * Neither the name of copyright holder nor the names of its contributors
+'     may be used to endorse or promote products derived from this software
+'     without specific prior written permission.
+'
+' THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS'
+' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+' IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+' ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+' LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+' CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+' SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+' INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+' CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+' ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+' THE POSSIBILITY OF SUCH DAMAGE.
+
+Strict
+
+Rem
+bbdoc: Assimp
+about: Wrapper for Open Asset Import library. Requires BaH.Boost.
+End Rem
+Module Openb3dlibs.Assimplib
+
+ModuleInfo "Version: 0.40"
+ModuleInfo "License: BSD-3-Clause License"
+ModuleInfo "Copyright: 2009-2011 Peter Scheutz"
+ModuleInfo "Authors: Peter Scheutz, Mark Mcvittie"
+ModuleInfo "Source: https://github.com/markcwm/openb3dlibs.mod"
+ModuleInfo "Original: https://github.com/Difference/blitzmax-assimp"
+
+ModuleInfo "History: 0.40 Release on Jul 2017 - source wrapper, mesh streams"
+ModuleInfo "History: 0.35 Release on Sep 2014 - library wrapper, Assimp v3.1.1"
+ModuleInfo "History: 0.30 Release on Apr 2011"
+ModuleInfo "History: 0.22 Release on Nov 2009"
+ModuleInfo "History: 0.07 Initial Release on Jan 2009"
+
+ModuleInfo "CC_OPTS: -fexceptions"
+'ModuleInfo "CC_OPTS: -DASSIMP_ENABLE_BOOST_WORKAROUND"
+
+Import Brl.Math
+Import Brl.Retro
+
+Import "source.bmx"
+Import "common.bmx"
+
+Include "types.bmx"

+ 262 - 0
assimplib.mod/common.bmx

@@ -0,0 +1,262 @@
+' common.bmx
+
+' config.h
+
+' Input parameter to the #aiProcess_SortByPType step:
+' Specifies which primitive types are removed by the step
+Const AI_CONFIG_PP_SBP_REMOVE:String = "PP_SBP_REMOVE"
+
+' types.h
+
+' just for backwards compatibility, don't use these constants anymore
+Const AI_SUCCESS:Int = $0
+Const AI_FAILURE:Int = -$1
+Const AI_OUTOFMEMORY:Int = -$3
+Const AI_INVALIDFILE:Int = -$2
+Const AI_INVALIDARG:Int = -$4
+
+' Maximum dimension for strings, ASSIMP strings are zero terminated.
+Const MAXLEN:Int = 1024
+
+' postprocess.h
+
+' enum aiPostProcessSteps - Defines the flags for all possible post processing step
+
+Const aiProcess_CalcTangentSpace:Int = $1
+Const aiProcess_JoinIdenticalVertices:Int = $2
+Const aiProcess_MakeLeftHanded:Int = $4
+Const aiProcess_Triangulate:Int = $8
+Const aiProcess_RemoveComponent:Int = $10
+Const aiProcess_GenNormals:Int = $20
+Const aiProcess_GenSmoothNormals:Int = $40
+Const aiProcess_SplitLargeMeshes:Int = $80
+Const aiProcess_PreTransformVertices:Int = $100
+Const aiProcess_LimitBoneWeights:Int = $200
+Const aiProcess_ValidateDataStructure:Int = $400
+Const aiProcess_ImproveCacheLocality:Int = $800
+Const aiProcess_RemoveRedundantMaterials:Int = $1000
+Const aiProcess_FixInfacingNormals:Int = $2000
+Const aiProcess_SortByPType:Int = $8000
+Const aiProcess_FindDegenerates:Int = $10000
+Const aiProcess_FindInvalidData:Int = $20000
+Const aiProcess_GenUVCoords:Int = $40000
+Const aiProcess_TransformUVCoords:Int = $80000
+Const aiProcess_FindInstances:Int = $100000
+Const aiProcess_OptimizeMeshes:Int = $200000 
+Const aiProcess_OptimizeGraph:Int = $400000
+Const aiProcess_FlipUVs:Int = $800000
+Const aiProcess_FlipWindingOrder:Int = $1000000
+Const aiProcess_SplitByBoneCount:Int = $2000000
+Const aiProcess_Debone:Int = $4000000
+
+' Shortcut to match Direct3D conventions: left-handed geometry, top-left origin for UV coords and clockwise face order
+Const aiProcess_ConvertToLeftHanded:Int = aiProcess_MakeLeftHanded | aiProcess_FlipUVs | aiProcess_FlipWindingOrder
+
+' mesh.h
+
+' Limits. These values are required to match the settings Assimp was compiled against.
+
+' Supported number of vertex color sets per mesh
+Const AI_MAX_NUMBER_OF_COLOR_SETS:Int = $8
+
+' Supported number of texture coord sets (UV(W) channels) per mesh
+Const AI_MAX_NUMBER_OF_TEXTURECOORDS:Int = $8
+
+' enum aiPrimitiveType - Enumerates the types of geometric primitives supported by Assimp.
+Const aiPrimitiveType_POINT:Int = $1
+Const aiPrimitiveType_LINE:Int = $2
+Const aiPrimitiveType_TRIANGLE:Int = $4
+Const aiPrimitiveType_POLYGON:Int = $8
+
+' material.h
+
+' enum aiTextureOp
+' enum aiTextureMapMode
+' enum aiTextureMapping
+' enum aiTextureType - Defines the purpose of a texture 
+
+' Dummy value.
+' No texture, but the value to be used as 'texture semantic' (#aiMaterialProperty::mSemantic)
+' for all material properties *not* related to textures.
+Const aiTextureType_NONE:Int = $0
+
+' The texture is combined with the result of the diffuse lighting equation.
+Const aiTextureType_DIFFUSE:Int = $1
+
+' The texture is combined with the result of the specular lighting equation.
+Const aiTextureType_SPECULAR:Int = $2
+
+' The texture is combined with the result of the ambient lighting equation.
+Const aiTextureType_AMBIENT:Int = $3
+
+' The texture is added to the result of the lighting calculation.
+' It isn't influenced by incoming light.
+Const aiTextureType_EMISSIVE:Int = $4
+
+' The texture is a height map.
+' By convention, higher grey-scale values stand for higher elevations from the base height.
+Const aiTextureType_HEIGHT:Int = $5
+
+' The texture is a (tangent space) normal-map.
+' Again, there are several conventions for tangent-space normal maps.
+' Assimp does (intentionally) not differenciate here.
+Const aiTextureType_NORMALS:Int = $6
+
+' The texture defines the glossiness of the material.
+' The glossiness is in fact the exponent of the specular (phong) lighting equation.
+' Usually there is a conversion function defined to map the linear color values in the texture
+' to a suitable exponent. Have fun.
+Const aiTextureType_SHININESS:Int = $7
+
+' The texture defines per-pixel opacity.
+' Usually 'white' means opaque and 'black' means 'transparency'. Or quite the opposite. Have fun.
+Const aiTextureType_OPACITY:Int = $8
+
+' Displacement texture.
+' The exact purpose and format is application-dependent.
+' Higher color values stand for higher vertex displacements.
+Const aiTextureType_DISPLACEMENT:Int = $9
+
+' Lightmap texture (aka Ambient Occlusion).
+' Both 'Lightmaps' and dedicated 'ambient occlusion maps' are covered by this material property.
+' The texture contains a scaling value for the final color value of a pixel.
+' It's intensity is not affected by incoming light.
+Const aiTextureType_LIGHTMAP:Int = $A
+
+' Reflection texture.
+' Contains the color of a perfect mirror reflection.
+' Rarely used, almost never for real-time applications.
+Const aiTextureType_REFLECTION:Int = $B
+
+' Unknown texture.
+' A texture reference that does not match any of the definitions above is considered to be 'unknown'.
+' It is still imported, but is excluded from any further postprocessing.
+Const aiTextureType_UNKNOWN:Int = $C
+
+' enum aiShadingMode
+' enum aiTextureFlags
+' enum aiBlendMode
+' enum aiPropertyTypeInfo - material property buffer content type
+
+Const aiPTI_Float:Int = $1
+Const aiPTI_String:Int = $3
+Const aiPTI_Integer:Int = $4
+Const aiPTI_Buffer:Int = $5
+
+' a few of the many matkey constants
+
+Const AI_MATKEY_NAME:String = "?mat.name"
+Const AI_MATKEY_TWOSIDED:String = "$mat.twosided"
+Const AI_MATKEY_OPACITY:String = "$mat.opacity"
+Const AI_MATKEY_SHININESS:String = "$mat.shininess"
+
+Const AI_MATKEY_COLOR_DIFFUSE:String = "$clr.diffuse"
+Const AI_MATKEY_COLOR_AMBIENT:String = "$clr.ambient"
+Const AI_MATKEY_COLOR_SPECULAR:String = "$clr.specular"
+Const AI_MATKEY_COLOR_EMISSIVE:String = "$clr.emissive"
+Const AI_MATKEY_COLOR_TRANSPARENT:String = "$clr.transparent"
+Const AI_MATKEY_COLOR_REFLECTIVE:String = "$clr.reflective"
+
+' Pure key names for all texture-related properties
+
+Const AI_MATKEY_TEXTURE_BASE:String = "$tex.file"
+Const AI_MATKEY_UVWSRC_BASE:String = "$tex.uvwsrc"
+Const AI_MATKEY_TEXOP_BASE:String = "$tex.op"
+Const AI_MATKEY_MAPPING_BASE:String = "$tex.mapping"
+Const AI_MATKEY_TEXBLEND_BASE:String = "$tex.blend"
+Const AI_MATKEY_MAPPINGMODE_U_BASE:String = "$tex.mapmodeu"
+Const AI_MATKEY_MAPPINGMODE_V_BASE:String = "$tex.mapmodev"
+Const AI_MATKEY_TEXMAP_AXIS_BASE:String = "$tex.mapaxis"
+Const AI_MATKEY_UVTRANSFORM_BASE:String = "$tex.uvtrafo"
+Const AI_MATKEY_TEXFLAGS_BASE:String = "$tex.flags"
+
+Extern
+
+' Assimp.cpp
+
+Rem
+bbdoc: Reads the given file and returns its content.
+about: See <a href="http://assimp.sourceforge.net/lib_html/class_assimp_1_1_importer.html">Assimp.cpp</a>
+and <a href="http://assimp.sourceforge.net/lib_html/cimport_8h.html">cimport.h</a>.
+End Rem
+	Function aiImportFile:Byte Ptr( pFile$z, pFlags:Int ) = "aiImportFile"
+
+Rem
+bbdoc: Reads the given file from a given memory buffer.
+about: See <a href="http://assimp.sourceforge.net/lib_html/class_assimp_1_1_importer.html">Assimp.cpp</a>
+and <a href="http://assimp.sourceforge.net/lib_html/cimport_8h.html">cimport.h</a>.
+End Rem
+	Function aiImportFileFromMemory:Byte Ptr( pBuffer:Byte Ptr,pLength:Int,pFlags:Int,pHint$z ) = "aiImportFileFromMemory"
+
+Rem
+bbdoc: Releases all resources associated with the given import process.
+about: See <a href="http://assimp.sourceforge.net/lib_html/class_assimp_1_1_importer.html">Assimp.cpp</a>
+and <a href="http://assimp.sourceforge.net/lib_html/cimport_8h.html">cimport.h</a>.
+End Rem
+	Function aiReleaseImport( pScene:Byte Ptr ) = "aiReleaseImport"
+
+Rem
+bbdoc: Returns the error text of the last failed import process.
+about: See <a href="http://assimp.sourceforge.net/lib_html/class_assimp_1_1_importer.html">Assimp.cpp</a>
+and <a href="http://assimp.sourceforge.net/lib_html/cimport_8h.html">cimport.h</a>.
+End Rem
+	Function aiIsExtensionSupported:Int( pFile$z ) = "aiIsExtensionSupported"
+
+' MaterialSystem.cpp
+
+Rem
+bbdoc: Get a color (3 or 4 floats) from the material.
+about: See <a href="http://assimp.sourceforge.net/lib_html/structai_material.html">MaterialSystem.cpp</a>
+and <a href="http://assimp.sourceforge.net/lib_html/material_8h.html">material.h</a>.
+End Rem
+	Function aiGetMaterialColor:Int( pMat:Byte Ptr, pKey$z, iType:Int, ..
+				index:Int, pOut:Byte Ptr ) = "aiGetMaterialColor"
+				
+Rem
+bbdoc: Get a string from the material.
+about: See <a href="http://assimp.sourceforge.net/lib_html/structai_material.html">MaterialSystem.cpp</a>
+and <a href="http://assimp.sourceforge.net/lib_html/material_8h.html">material.h</a>.
+End Rem
+	Function aiGetMaterialString:Int( pMat:Byte Ptr, pKey$z, iType:Int, ..
+				index:Int, pOut:Byte Ptr ) = "aiGetMaterialString"
+				
+Rem
+bbdoc: Get an array of integer values from the material.
+about: See <a href="http://assimp.sourceforge.net/lib_html/structai_material.html">MaterialSystem.cpp</a>
+and <a href="http://assimp.sourceforge.net/lib_html/material_8h.html">material.h</a>.
+End Rem
+	Function aiGetMaterialIntegerArray:Int( pMat:Byte Ptr, pKey$z, iType:Int, ..
+				index:Int, pOut:Int Ptr, pMax:Int Ptr ) = "aiGetMaterialIntegerArray"
+				
+Rem
+bbdoc: Get an array of floating-point values from the material.
+about: See <a href="http://assimp.sourceforge.net/lib_html/structai_material.html">MaterialSystem.cpp</a>
+and <a href="http://assimp.sourceforge.net/lib_html/material_8h.html">material.h</a>.
+End Rem
+	Function aiGetMaterialFloatArray:Int( pMat:Byte Ptr, pKey$z, iType:Int, ..
+				index:Int, pOut:Float Ptr, pMax:Int Ptr ) = "aiGetMaterialFloatArray"
+				
+Rem
+bbdoc: Get all values pertaining to a particular texture slot from the material.
+about: See <a href="http://assimp.sourceforge.net/lib_html/structai_material.html">MaterialSystem.cpp</a>
+and <a href="http://assimp.sourceforge.net/lib_html/material_8h.html">material.h</a>.
+End Rem
+	Function aiGetMaterialTexture:Int( pMat:Byte Ptr, texType:Int, index:Int, path:Byte Ptr, ..
+				mapping:Byte Ptr=Null, uvindex:Int Ptr=Null, blend:Float Ptr=Null, ..
+				op:Byte Ptr=Null, mapmode:Byte Ptr=Null, flags:Int Ptr=Null ) = "aiGetMaterialTexture"
+				
+Rem
+bbdoc: Get the number of textures for a particular texture type.
+about: See <a href="http://assimp.sourceforge.net/lib_html/structai_material.html">MaterialSystem.cpp</a>
+and <a href="http://assimp.sourceforge.net/lib_html/material_8h.html">material.h</a>.
+End Rem
+	Function aiGetMaterialTextureCount:Int( pMat:Byte Ptr, texType:Int ) = "aiGetMaterialTextureCount"
+	
+End Extern
+
+Rem
+ aiSetImportPropertyInteger caused crash, was missing p parameter
+ changed aiGetMaterialTexture pMat:Int Ptr to :Byte Ptr
+ changed aiImportFile:Int Ptr to :Byte Ptr
+ added aiImportFileFromMemory
+EndRem

+ 161 - 0
assimplib.mod/doc/commands.html

@@ -0,0 +1,161 @@
+<html><head><title>Assimp reference</title>
+<link rel=stylesheet Type=text/css href='../../../../doc/bmxstyle.css'>
+</head><body>
+<table width=100% cellspacing=0><tr align=center><td class=small>&nbsp;</td>
+<td class=small width=1%><b>Openb3dlibs.Assimplib:</b></td>
+<td class=small width=1%><a href=#functions class=small>Functions</a></td>
+<td class=small width=1%><a href=#types class=small>Types</a></td>
+<td class=small width=1%><a href=#modinfo class=small>Modinfo</a></td>
+<td class=small width=1%><a href='../../../../mod/openb3dlibs.mod/assimplib.mod/assimplib.bmx' class=small>Source</a></td>
+<td class=small>&nbsp;</td></tr></table>
+<h1>Assimp</h1>
+Wrapper for Open Asset Import library. Requires BaH.Boost.
+<h2><a name=functions></a>Functions Summary</h2><table class=doc width=100%>
+<tr><td class=docleft width=1%><a href=#aiGetMaterialColor>aiGetMaterialColor</a></td><td class=docright>
+Get a color (3 or 4 floats) from the material.
+</td></tr>
+<tr><td class=docleft width=1%><a href=#aiGetMaterialFloatArray>aiGetMaterialFloatArray</a></td><td class=docright>
+Get an array of floating-point values from the material.
+</td></tr>
+<tr><td class=docleft width=1%><a href=#aiGetMaterialIntegerArray>aiGetMaterialIntegerArray</a></td><td class=docright>
+Get an array of integer values from the material.
+</td></tr>
+<tr><td class=docleft width=1%><a href=#aiGetMaterialString>aiGetMaterialString</a></td><td class=docright>
+Get a string from the material.
+</td></tr>
+<tr><td class=docleft width=1%><a href=#aiGetMaterialTexture>aiGetMaterialTexture</a></td><td class=docright>
+Get all values pertaining to a particular texture slot from the material.
+</td></tr>
+<tr><td class=docleft width=1%><a href=#aiGetMaterialTextureCount>aiGetMaterialTextureCount</a></td><td class=docright>
+Get the number of textures for a particular texture type.
+</td></tr>
+<tr><td class=docleft width=1%><a href=#aiImportFile>aiImportFile</a></td><td class=docright>
+Reads the given file and returns its content.
+</td></tr>
+<tr><td class=docleft width=1%><a href=#aiImportFileFromMemory>aiImportFileFromMemory</a></td><td class=docright>
+Reads the given file from a given memory buffer.
+</td></tr>
+<tr><td class=docleft width=1%><a href=#aiIsExtensionSupported>aiIsExtensionSupported</a></td><td class=docright>
+Returns the error text of the last failed import process.
+</td></tr>
+<tr><td class=docleft width=1%><a href=#aiReleaseImport>aiReleaseImport</a></td><td class=docright>
+Releases all resources associated with the given import process.
+</td></tr>
+</table>
+<h2><a name=types></a>Types Summary</h2><table class=doc width=100%>
+<tr><td class=docleft width=1%><a href=#aiMesh>aiMesh</a></td><td class=docright>
+A mesh represents a geometry Or model with a single material.
+</td></tr>
+</table>
+<h2
+ id=functionsdet>Functions
+</h2>
+<table class=doc width=100% cellspacing=3 id=aiGetMaterialColor>
+<tr><td class=doctop colspan=2>Function aiGetMaterialColor:Int( pMat:Byte Ptr, pKey$z, iType:Int, index:Int, pOut:Byte Ptr )</td></tr>
+<tr><td class=docleft width=1%>Description</td><td class=docright>Get a color (3 or 4 floats) from the material.</td></tr>
+<tr><td class=docleft width=1%>Information</td><td class=docright>See <a href="http://assimp.sourceforge.net/lib_html/structai_material.html">MaterialSystem.cpp</a>
+and <a href="http://assimp.sourceforge.net/lib_html/material_8h.html">material.h</a>.</td></tr>
+</table>
+<br>
+<table class=doc width=100% cellspacing=3 id=aiGetMaterialFloatArray>
+<tr><td class=doctop colspan=2>Function aiGetMaterialFloatArray:Int( pMat:Byte Ptr, pKey$z, iType:Int, index:Int, pOut:Float Ptr, pMax:Int Ptr )</td></tr>
+<tr><td class=docleft width=1%>Description</td><td class=docright>Get an array of floating-point values from the material.</td></tr>
+<tr><td class=docleft width=1%>Information</td><td class=docright>See <a href="http://assimp.sourceforge.net/lib_html/structai_material.html">MaterialSystem.cpp</a>
+and <a href="http://assimp.sourceforge.net/lib_html/material_8h.html">material.h</a>.</td></tr>
+</table>
+<br>
+<table class=doc width=100% cellspacing=3 id=aiGetMaterialIntegerArray>
+<tr><td class=doctop colspan=2>Function aiGetMaterialIntegerArray:Int( pMat:Byte Ptr, pKey$z, iType:Int, index:Int, pOut:Int Ptr, pMax:Int Ptr )</td></tr>
+<tr><td class=docleft width=1%>Description</td><td class=docright>Get an array of integer values from the material.</td></tr>
+<tr><td class=docleft width=1%>Information</td><td class=docright>See <a href="http://assimp.sourceforge.net/lib_html/structai_material.html">MaterialSystem.cpp</a>
+and <a href="http://assimp.sourceforge.net/lib_html/material_8h.html">material.h</a>.</td></tr>
+</table>
+<br>
+<table class=doc width=100% cellspacing=3 id=aiGetMaterialString>
+<tr><td class=doctop colspan=2>Function aiGetMaterialString:Int( pMat:Byte Ptr, pKey$z, iType:Int, index:Int, pOut:Byte Ptr )</td></tr>
+<tr><td class=docleft width=1%>Description</td><td class=docright>Get a string from the material.</td></tr>
+<tr><td class=docleft width=1%>Information</td><td class=docright>See <a href="http://assimp.sourceforge.net/lib_html/structai_material.html">MaterialSystem.cpp</a>
+and <a href="http://assimp.sourceforge.net/lib_html/material_8h.html">material.h</a>.</td></tr>
+</table>
+<br>
+<table class=doc width=100% cellspacing=3 id=aiGetMaterialTexture>
+<tr><td class=doctop colspan=2>Function aiGetMaterialTexture:Int( pMat:Byte Ptr, texType:Int, index:Int, path:Byte Ptr, mapping:Byte Ptr=Null, uvindex:Int Ptr=Null, blend:Float Ptr=Null, op:Byte Ptr=Null, mapmode:Byte Ptr=Null, flags:Int Ptr=Null )</td></tr>
+<tr><td class=docleft width=1%>Description</td><td class=docright>Get all values pertaining to a particular texture slot from the material.</td></tr>
+<tr><td class=docleft width=1%>Information</td><td class=docright>See <a href="http://assimp.sourceforge.net/lib_html/structai_material.html">MaterialSystem.cpp</a>
+and <a href="http://assimp.sourceforge.net/lib_html/material_8h.html">material.h</a>.</td></tr>
+</table>
+<br>
+<table class=doc width=100% cellspacing=3 id=aiGetMaterialTextureCount>
+<tr><td class=doctop colspan=2>Function aiGetMaterialTextureCount:Int( pMat:Byte Ptr, texType:Int )</td></tr>
+<tr><td class=docleft width=1%>Description</td><td class=docright>Get the number of textures for a particular texture type.</td></tr>
+<tr><td class=docleft width=1%>Information</td><td class=docright>See <a href="http://assimp.sourceforge.net/lib_html/structai_material.html">MaterialSystem.cpp</a>
+and <a href="http://assimp.sourceforge.net/lib_html/material_8h.html">material.h</a>.</td></tr>
+</table>
+<br>
+<table class=doc width=100% cellspacing=3 id=aiImportFile>
+<tr><td class=doctop colspan=2>Function aiImportFile:Byte Ptr( pFile$z, pFlags:Int )</td></tr>
+<tr><td class=docleft width=1%>Description</td><td class=docright>Reads the given file and returns its content.</td></tr>
+<tr><td class=docleft width=1%>Information</td><td class=docright>See <a href="http://assimp.sourceforge.net/lib_html/class_assimp_1_1_importer.html">Assimp.cpp</a>
+and <a href="http://assimp.sourceforge.net/lib_html/cimport_8h.html">cimport.h</a>.</td></tr>
+</table>
+<br>
+<table class=doc width=100% cellspacing=3 id=aiImportFileFromMemory>
+<tr><td class=doctop colspan=2>Function aiImportFileFromMemory:Byte Ptr( pBuffer:Byte Ptr,pLength:Int,pFlags:Int,pHint$z )</td></tr>
+<tr><td class=docleft width=1%>Description</td><td class=docright>Reads the given file from a given memory buffer.</td></tr>
+<tr><td class=docleft width=1%>Information</td><td class=docright>See <a href="http://assimp.sourceforge.net/lib_html/class_assimp_1_1_importer.html">Assimp.cpp</a>
+and <a href="http://assimp.sourceforge.net/lib_html/cimport_8h.html">cimport.h</a>.</td></tr>
+</table>
+<br>
+<table class=doc width=100% cellspacing=3 id=aiIsExtensionSupported>
+<tr><td class=doctop colspan=2>Function aiIsExtensionSupported:Int( pFile$z )</td></tr>
+<tr><td class=docleft width=1%>Description</td><td class=docright>Returns the error text of the last failed import process.</td></tr>
+<tr><td class=docleft width=1%>Information</td><td class=docright>See <a href="http://assimp.sourceforge.net/lib_html/class_assimp_1_1_importer.html">Assimp.cpp</a>
+and <a href="http://assimp.sourceforge.net/lib_html/cimport_8h.html">cimport.h</a>.</td></tr>
+</table>
+<br>
+<table class=doc width=100% cellspacing=3 id=aiReleaseImport>
+<tr><td class=doctop colspan=2>Function aiReleaseImport( pScene:Byte Ptr )</td></tr>
+<tr><td class=docleft width=1%>Description</td><td class=docright>Releases all resources associated with the given import process.</td></tr>
+<tr><td class=docleft width=1%>Information</td><td class=docright>See <a href="http://assimp.sourceforge.net/lib_html/class_assimp_1_1_importer.html">Assimp.cpp</a>
+and <a href="http://assimp.sourceforge.net/lib_html/cimport_8h.html">cimport.h</a>.</td></tr>
+</table>
+<br>
+<h2
+ id=typesdet>Types
+</h2>
+<table class=doc width=100% cellspacing=3 id=aiMesh>
+<tr><td class=doctop colspan=2>Type aiMesh</td></tr>
+<tr><td class=docleft width=1%>Description</td><td class=docright>A mesh represents a geometry Or model with a single material.</td></tr>
+<tr><td class=docleft width=1%>Information</td><td class=docright>* It usually consists of a number of vertices And a series of primitives/faces
+* referencing the vertices. In addition there might be a series of bones, each
+* of them addressing a number of vertices with a certain weight. Vertex data
+* is presented in channels with each channel containing a single per-vertex
+* information such as a set of texture coords Or a normal vector.
+* If a data pointer is non-Null, the corresponding data stream is present.
+* From C++-programs you can also use the comfort functions Has*() To
+* test For the presence of various data streams.
+*
+* A Mesh uses only a single material which is referenced by a material ID.
+* <b>note</b> The mPositions member is usually Not optional. However, vertex positions
+* *could* be missing If the AI_SCENE_FLAGS_INCOMPLETE flag is set in
+* <b>code</b>
+* aiScene::mFlags
+* <b>endcode</b>
+*/</td></tr>
+</table>
+<br>
+<h2 id=modinfo>Module Information</h2>
+<table width=100%>
+<tr><th width=1%>Version</th><td>0.40</td></tr>
+<tr><th width=1%>License</th><td>BSD-3-Clause License</td></tr>
+<tr><th width=1%>Copyright</th><td>2009-2011 Peter Scheutz</td></tr>
+<tr><th width=1%>Authors</th><td>Peter Scheutz, Mark Mcvittie</td></tr>
+<tr><th width=1%>Source</th><td>https://github.com/markcwm/openb3dlibs.mod</td></tr>
+<tr><th width=1%>Original</th><td>https://github.com/Difference/blitzmax-assimp</td></tr>
+<tr><th width=1%>History</th><td>0.40 Release on Jul 2017 - source wrapper, mesh streams</td></tr>
+<tr><th width=1%>History</th><td>0.35 Release on Sep 2014 - library wrapper, Assimp v3.1.1</td></tr>
+<tr><th width=1%>History</th><td>0.30 Release on Apr 2011</td></tr>
+<tr><th width=1%>History</th><td>0.22 Release on Nov 2009</td></tr>
+<tr><th width=1%>History</th><td>0.07 Initial Release on Jan 2009</td></tr>
+<tr><th width=1%>CC_OPTS</th><td>-fexceptions</td></tr>
+</body></html>

+ 198 - 0
assimplib.mod/source.bmx

@@ -0,0 +1,198 @@
+' source.bmx
+
+Import "../../bah.mod/boost.mod/src/*.hpp"
+Import "../../bah.mod/boost.mod/src/boost/*.hpp"
+Import "../../bah.mod/boost.mod/src/libs/system/src/error_code.cpp"
+
+Import "../../pub.mod/zlib.mod/*.h"
+
+'Import "assimp/*.h"
+Import "assimp/code/*.h"
+'Import "assimp/include/*.h"
+'Import "assimp/include/*.hpp"
+
+'Import "assimp/contrib/*.h"
+Import "assimp/contrib/clipper/*.hpp"
+Import "assimp/contrib/ConvertUTF/*.h"
+Import "assimp/contrib/irrXML/*.h"
+Import "assimp/contrib/poly2tri/poly2tri/*.h"
+Import "assimp/contrib/poly2tri/poly2tri/common/*.h"
+Import "assimp/contrib/poly2tri/poly2tri/sweep/*.h"
+Import "assimp/contrib/unzip/*.h"
+
+Import "assimp/code/3DSConverter.cpp"
+'Import "assimp/code/3DSExporter.cpp" ' 3.2
+Import "assimp/code/3DSLoader.cpp"
+'Import "assimp/code/ACLoader.cpp"
+'Import "assimp/code/ASELoader.cpp"
+'Import "assimp/code/ASEParser.cpp"
+'Import "assimp/code/AssbinExporter.cpp" ' 3.2
+'Import "assimp/code/AssbinLoader.cpp" ' 3.2
+Import "assimp/code/Assimp.cpp"
+Import "assimp/code/AssimpCExport.cpp"
+Import "assimp/code/AssimpPCH.cpp" ' Version.cpp in 3.2
+'Import "assimp/code/AssxmlExporter.cpp" ' 3.2
+Import "assimp/code/B3DImporter.cpp"
+Import "assimp/code/BaseImporter.cpp"
+Import "assimp/code/BaseProcess.cpp"
+Import "assimp/code/Bitmap.cpp"
+'Import "assimp/code/BlenderBMesh.cpp"
+'Import "assimp/code/BlenderDNA.cpp"
+'Import "assimp/code/BlenderLoader.cpp"
+'Import "assimp/code/BlenderModifier.cpp"
+'Import "assimp/code/BlenderScene.cpp"
+'Import "assimp/code/BlenderTessellator.cpp"
+'Import "assimp/code/BVHLoader.cpp"
+'Import "assimp/code/C4DImporter.cpp" ' 3.2 - C4D is MSVC only
+Import "assimp/code/CalcTangentsProcess.cpp"
+'Import "assimp/code/COBLoader.cpp"
+Import "assimp/code/ColladaExporter.cpp"
+Import "assimp/code/ColladaLoader.cpp"
+Import "assimp/code/ColladaParser.cpp"
+Import "assimp/code/ComputeUVMappingProcess.cpp"
+Import "assimp/code/ConvertToLHProcess.cpp"
+'Import "assimp/code/CSMLoader.cpp"
+Import "assimp/code/DeboneProcess.cpp"
+Import "assimp/code/DefaultIOStream.cpp"
+Import "assimp/code/DefaultIOSystem.cpp"
+Import "assimp/code/DefaultLogger.cpp"
+'Import "assimp/code/DXFLoader.cpp"
+Import "assimp/code/Exporter.cpp"
+'Import "assimp/code/FBXAnimation.cpp"
+'Import "assimp/code/FBXBinaryTokenizer.cpp"
+'Import "assimp/code/FBXConverter.cpp"
+'Import "assimp/code/FBXDeformer.cpp"
+'Import "assimp/code/FBXDocument.cpp"
+'Import "assimp/code/FBXDocumentUtil.cpp"
+'Import "assimp/code/FBXImporter.cpp"
+'Import "assimp/code/FBXMaterial.cpp"
+'Import "assimp/code/FBXMeshGeometry.cpp"
+'Import "assimp/code/FBXModel.cpp"
+'Import "assimp/code/FBXNodeAttribute.cpp"
+'Import "assimp/code/FBXParser.cpp"
+'Import "assimp/code/FBXProperties.cpp"
+'Import "assimp/code/FBXTokenizer.cpp"
+'Import "assimp/code/FBXUtil.cpp"
+Import "assimp/code/FindDegenerates.cpp"
+Import "assimp/code/FindInstancesProcess.cpp"
+Import "assimp/code/FindInvalidDataProcess.cpp"
+Import "assimp/code/FixNormalsStep.cpp"
+Import "assimp/code/GenFaceNormalsProcess.cpp"
+Import "assimp/code/GenVertexNormalsProcess.cpp"
+'Import "assimp/code/HMPLoader.cpp"
+'Import "assimp/code/IFCBoolean.cpp"
+'Import "assimp/code/IFCCurve.cpp"
+'Import "assimp/code/IFCGeometry.cpp"
+'Import "assimp/code/IFCLoader.cpp"
+'Import "assimp/code/IFCMaterial.cpp"
+'Import "assimp/code/IFCOpenings.cpp"
+'Import "assimp/code/IFCProfile.cpp"
+'Import "assimp/code/IFCReaderGen.cpp"
+'Import "assimp/code/IFCUtil.cpp"
+Import "assimp/code/Importer.cpp"
+Import "assimp/code/ImporterRegistry.cpp"
+Import "assimp/code/ImproveCacheLocality.cpp"
+'Import "assimp/code/IRRLoader.cpp"
+'Import "assimp/code/IRRMeshLoader.cpp"
+'Import "assimp/code/IRRShared.cpp"
+Import "assimp/code/JoinVerticesProcess.cpp"
+Import "assimp/code/LimitBoneWeightsProcess.cpp"
+'Import "assimp/code/LWOAnimation.cpp"
+'Import "assimp/code/LWOBLoader.cpp"
+'Import "assimp/code/LWOLoader.cpp"
+'Import "assimp/code/LWOMaterial.cpp"
+'Import "assimp/code/LWSLoader.cpp"
+Import "assimp/code/MakeVerboseFormat.cpp"
+Import "assimp/code/MaterialSystem.cpp"
+'Import "assimp/code/MD2Loader.cpp"
+'Import "assimp/code/MD3Loader.cpp"
+'Import "assimp/code/MD5Loader.cpp"
+'Import "assimp/code/MD5Parser.cpp"
+'Import "assimp/code/MDCLoader.cpp"
+'Import "assimp/code/MDLLoader.cpp"
+'Import "assimp/code/MDLMaterialLoader.cpp"
+'Import "assimp/code/MS3DLoader.cpp"
+'Import "assimp/code/NDOLoader.cpp"
+'Import "assimp/code/NFFLoader.cpp"
+Import "assimp/code/ObjExporter.cpp"
+Import "assimp/code/ObjFileImporter.cpp"
+Import "assimp/code/ObjFileMtlImporter.cpp"
+Import "assimp/code/ObjFileParser.cpp"
+'Import "assimp/code/OFFLoader.cpp"
+'Import "assimp/code/OgreBinarySerializer.cpp"
+'Import "assimp/code/OgreImporter.cpp"
+'Import "assimp/code/OgreMaterial.cpp"
+'Import "assimp/code/OgreStructs.cpp"
+'Import "assimp/code/OgreXmlSerializer.cpp"
+'Import "assimp/code/OpenGEXExporter.cpp"
+'Import "assimp/code/OpenGEXImporter.cpp"
+Import "assimp/code/OptimizeGraph.cpp"
+Import "assimp/code/OptimizeMeshes.cpp"
+'Import "assimp/code/PlyExporter.cpp"
+'Import "assimp/code/PlyLoader.cpp"
+'Import "assimp/code/PlyParser.cpp"
+Import "assimp/code/PostStepRegistry.cpp"
+Import "assimp/code/PretransformVertices.cpp"
+Import "assimp/code/ProcessHelper.cpp"
+'Import "assimp/code/Q3BSPFileImporter.cpp"
+'Import "assimp/code/Q3BSPFileParser.cpp"
+'Import "assimp/code/Q3BSPZipArchive.cpp"
+'Import "assimp/code/Q3DLoader.cpp"
+'Import "assimp/code/RawLoader.cpp"
+Import "assimp/code/RemoveComments.cpp"
+Import "assimp/code/RemoveRedundantMaterials.cpp"
+Import "assimp/code/RemoveVCProcess.cpp"
+Import "assimp/code/SceneCombiner.cpp"
+Import "assimp/code/ScenePreprocessor.cpp"
+Import "assimp/code/SGSpatialSort.cpp"
+Import "assimp/code/SkeletonMeshBuilder.cpp"
+'Import "assimp/code/SMDLoader.cpp"
+Import "assimp/code/SortByPTypeProcess.cpp"
+Import "assimp/code/SpatialSort.cpp"
+Import "assimp/code/SplitByBoneCountProcess.cpp"
+Import "assimp/code/SplitLargeMeshes.cpp"
+Import "assimp/code/StandardShapes.cpp"
+'Import "assimp/code/StepExporter.cpp"
+'Import "assimp/code/STEPFileEncoding.cpp"
+'Import "assimp/code/STEPFileReader.cpp"
+'Import "assimp/code/STLExporter.cpp"
+'Import "assimp/code/STLLoader.cpp"
+Import "assimp/code/Subdivision.cpp"
+Import "assimp/code/TargetAnimation.cpp"
+'Import "assimp/code/TerragenLoader.cpp"
+Import "assimp/code/TextureTransform.cpp"
+Import "assimp/code/TriangulateProcess.cpp"
+'Import "assimp/code/UnrealLoader.cpp"
+Import "assimp/code/ValidateDataStructure.cpp"
+Import "assimp/code/VertexTriangleAdjacency.cpp"
+'Import "assimp/code/XFileExporter.cpp" ' 3.2
+Import "assimp/code/XFileImporter.cpp"
+Import "assimp/code/XFileParser.cpp"
+'Import "assimp/code/XGLLoader.cpp"
+
+Import "assimp/contrib/clipper/clipper.cpp"
+Import "assimp/contrib/ConvertUTF/ConvertUTF.c"
+Import "assimp/contrib/irrXML/irrXML.cpp"
+Import "assimp/contrib/poly2tri/poly2tri/common/shapes.cc"
+Import "assimp/contrib/poly2tri/poly2tri/sweep/advancing_front.cc"
+Import "assimp/contrib/poly2tri/poly2tri/sweep/cdt.cc"
+Import "assimp/contrib/poly2tri/poly2tri/sweep/sweep.cc"
+Import "assimp/contrib/poly2tri/poly2tri/sweep/sweep_context.cc"
+Import "assimp/contrib/unzip/unzip.c"
+Import "assimp/contrib/unzip/ioapi.c"
+
+'Import "../../pub.mod/zlib.mod/adler32.c"
+'Import "../../pub.mod/zlib.mod/compress.c"
+'Import "../../pub.mod/zlib.mod/crc32.c"
+'Import "../../pub.mod/zlib.mod/deflate.c"
+'Import "../../pub.mod/zlib.mod/gzclose.c"
+'Import "../../pub.mod/zlib.mod/gzlib.c"
+'Import "../../pub.mod/zlib.mod/gzread.c"
+'Import "../../pub.mod/zlib.mod/gzwrite.c"
+'Import "../../pub.mod/zlib.mod/infback.c"
+'Import "../../pub.mod/zlib.mod/inffast.c"
+'Import "../../pub.mod/zlib.mod/inflate.c"
+'Import "../../pub.mod/zlib.mod/inftrees.c"
+'Import "../../pub.mod/zlib.mod/trees.c"
+'Import "../../pub.mod/zlib.mod/uncompr.c"
+'Import "../../pub.mod/zlib.mod/zutil.c"

+ 772 - 0
assimplib.mod/types.bmx

@@ -0,0 +1,772 @@
+' types.bmx
+
+Type aiMatrix3x3
+
+	Field a1:Float , a2:Float , a3:Float
+	Field b1:Float , b2:Float , b3:Float
+	Field c1:Float , c2:Float , c3:Float
+	
+End Type
+
+Type aiMatrix4x4
+
+	Field a1:Float , a2:Float , a3:Float , a4:Float
+	Field b1:Float , b2:Float , b3:Float , b4:Float
+	Field c1:Float , c2:Float , c3:Float , c4:Float
+	Field d1:Float , d2:Float , d3:Float , d4:Float
+	
+	Field heading:Float
+	Field attitude:Float
+	Field bank:Float
+	
+	Field Tx:Float
+	Field Ty:Float
+	Field Tz:Float
+	Field Sx:Float
+	Field Sy:Float
+	Field Sz:Float	
+	Field Rx:Float
+	Field Ry:Float
+	Field Rz:Float
+	
+	Function Create:aiMatrix4x4(p:Float Ptr)
+	
+		Local m:aiMatrix4x4 = New aiMatrix4x4
+		
+		Rem	
+			DebugLog "Matrix"
+			For Local i:Int = 0 To 15
+				DebugLog i + " " + p[i]
+			Next		
+		EndRem
+		
+		m.a1 = p[0]
+		m.a2 = p[1]
+		m.a3 = p[2]
+		m.a4 = p[3]
+		
+		m.b1 = p[4]
+		m.b2 = p[5]
+		m.b3 = p[6]
+		m.b4 = p[7]
+
+		m.c1 = p[8]
+		m.c2 = p[9]
+		m.c3 = p[10]
+		m.c4 = p[11]
+
+		m.d1 = p[12]
+		m.d2 = p[13]
+		m.d3 = p[14]
+		m.d4 = p[15]
+		
+		Return m									
+		
+	End Function
+	
+	Method Decompose()
+	
+		_Decompose()		
+		
+		rx = heading
+		ry = attitude
+		rz = bank
+		
+	End Method
+	
+	Method _Decompose()
+	
+		Tx = a4
+		Ty = b4 
+		Tz = c4
+		
+		Sx = Sqr( a1*a1 + a2*a2 + a3*a3 )
+		Sy = Sqr( b1*b1 + b2*b2 + b3*b3 ) 
+		Sz = Sqr( c1*c1 + c2*c2 + c3*c3 )
+		
+		Local D:Float = a1 * (b2 * c3 - c2 * b3) - b1 * (a2 * c3 - c2 * a3) + c1 * (a2 * b3 - b2 * a3);
+		
+		Sx:* Sgn( D )
+		Sy:* Sgn( D )
+		Sz:* Sgn( D )
+		
+		Local rm:aiMatrix3x3 = New aiMatrix3x3	
+		
+		rm.a1 = a1 ; rm.a2 = a2 ; rm.a3 = a3
+		rm.b1 = b1 ; rm.b2 = b2 ; rm.b3 = b3
+		rm.c1 = c1 ; rm.c2 = c2 ; rm.c3 = c3		
+		
+		If sx Then
+			rm.a1:/sx	
+			rm.a2:/sx	
+			rm.a3:/sx	
+		EndIf
+		If sy Then
+			rm.b1:/sy
+			rm.b2:/sy	
+			rm.b3:/sy	
+		EndIf
+		If sz Then
+			rm.c1:/sz
+			rm.c2:/sz	
+			rm.c3:/sz	
+		EndIf
+		
+		If (b1 > 0.998) ' singularity at north pole
+			heading = ATan2(rm.a3,rm.c3)
+			attitude = 90 'Pi/2
+			bank = 0
+			'DebugLog "' singularity at north pole **"
+			Return
+		EndIf
+		
+		If (b1 < -0.998) ' singularity at south pole
+			heading = ATan2(rm.a3,rm.c3)
+			attitude = - 90 '-Pi/2
+			bank = 0
+			'DebugLog "' singularity at south pole **"
+			Return
+		EndIf
+		
+		heading = ATan2(-rm.c1,rm.a1)
+		bank = ATan2(-rm.b3,rm.b2)
+		attitude = ASin(rm.b1)	
+		
+	End Method
+
+	Method GetScaleX:Float()
+	
+		Return Sqr(a1*a1 + a2*a2 + a3*a3)
+		
+	End Method
+	
+	Method GetScaleY:Float()
+	
+		Return Sqr(b1*b1 + b2*b2 + b3*b3)
+
+	End Method
+	
+	Method GetScaleZ:Float()
+	
+		Return Sqr(c1*c1 + c2*c2 + c3*c3)
+		
+	End Method
+	
+End Type
+
+Type aiMaterial
+
+	Field pMaterial:Int Ptr
+	Field Properties:aiMaterialProperty[]
+	Field NumProperties:Int
+	Field NumAllocated:Int
+	
+	' helper functions based on Assimp api 
+	
+	Method GetMaterialName:String()
+	
+		Return GetMaterialString(AI_MATKEY_NAME)
+		
+	End Method	
+	
+	Method IsTwoSided:Int()
+	
+		Local values:Int[] = GetMaterialIntegerArray(AI_MATKEY_TWOSIDED)
+		If values.length Then Return values[0]
+		
+	End Method
+	
+	Method GetAlpha:Float()
+	
+		Local values:Float[] = GetMaterialFloatArray(AI_MATKEY_OPACITY)
+		If values.length Then
+			Return values[0]	
+		Else		
+			Return 1.0
+		EndIf
+		
+	End Method
+	
+	Method GetShininess:Float()
+	
+		Local values:Float[] = GetMaterialFloatArray(AI_MATKEY_SHININESS)
+		If values.length Then
+			Return values[0]	
+		Else		
+			Return 1.0
+		EndIf
+		
+	End Method
+	
+	' diffuse
+	Method GetDiffuseRed:Float()
+	
+		Local Colors:Float[] = GetMaterialColor(AI_MATKEY_COLOR_DIFFUSE)
+		If Colors.length Then Return Colors[0]
+		
+	End Method
+	
+	Method GetDiffuseGreen:Float()
+	
+		Local Colors:Float[] = GetMaterialColor(AI_MATKEY_COLOR_DIFFUSE)
+		If Colors.length Then Return Colors[1]
+		
+	End Method
+	
+	Method GetDiffuseBlue:Float()
+	
+		Local Colors:Float[] = GetMaterialColor(AI_MATKEY_COLOR_DIFFUSE)
+		If Colors.length Then Return Colors[2]
+		
+	End Method
+	
+	Method GetDiffuseAlpha:Float()
+	
+		Local Colors:Float[] = GetMaterialColor(AI_MATKEY_COLOR_DIFFUSE)
+		If Colors.length Then Return Colors[3]
+		
+	End Method		
+	
+	' helper functions assumes material properties loaded with scene 
+	
+	Method GetTexture()
+	
+	End Method
+	
+	Method GetPropertyNames:String[]()
+	
+		Local names:String[NumProperties]	
+		For Local i:Int = 0 To NumProperties - 1
+		
+			names[i] = Properties[i].mKey
+			'DebugLog "Property name: " + Properties[i].mKey
+			'DebugLog "Property type: " + Properties[i].mType
+			'DebugLog "Property Index " + Properties[i].Index
+			'DebugLog "Property length " + Properties[i].DataLength
+			'DebugLog "Property Semantic: " + Properties[i].Semantic
+			
+			Select Properties[i].mType
+				Case aiPTI_Float
+					For Local i:Int = 0 Until Properties[i].DataLength / 4 
+				'		DebugLog "FLOAT: " + Properties[i].GetFloatValue(i)
+					Next
+				Case aiPTI_String
+			'		DebugLog "String: " + Properties[i].GetStringValue()
+				Case aiPTI_Integer
+				
+				Case aiPTI_Buffer
+				
+			End Select
+			
+		Next
+		Return names
+		
+	End Method	
+	
+	' native ai functions 
+	
+	Method GetMaterialString:String(Key:String)
+	
+		Local s:Byte[4+MAXLEN]
+		'Local kp:Byte Ptr = Key.ToCstring()
+		
+		Local retVal:Int = aiGetMaterialString(pMaterial,Key,0,0,Varptr s[0])
+		'MemFree kp
+		
+		If retVal = AI_SUCCESS
+			Return String.FromCString(Varptr s[4])
+		'Else
+			'DebugLog "mat. aiGetMaterialString failed with code " + retVal
+		EndIf
+		
+	End Method
+	
+	Method GetMaterialColor:Float[](Key:String)	
+	
+		Local colors:Float[4]
+		If aiGetMaterialColor(pMaterial,Key,0,0,colors)	= AI_SUCCESS
+			Return colors
+		EndIf
+		
+	End Method
+	
+	Method GetMaterialIntegerArray:Int[](Key:String)
+		
+		Local size:Int = 1024
+		Local values:Int[size]
+		
+		If aiGetMaterialIntegerArray(pMaterial,Key,0,0,values,Varptr size)	= AI_SUCCESS
+			values = values[..size]
+			Return values
+		EndIf
+		
+	End Method	
+	
+	Method GetMaterialFloatArray:Float[](Key:String)
+	
+		Local size:Int = 1024
+		Local values:Float[size]
+		
+		If aiGetMaterialFloatArray(pMaterial,Key,0,0,values,Varptr size)	= AI_SUCCESS
+			values = values[..size]
+			Return values
+		EndIf
+		
+	End Method	
+	
+	Method GetMaterialTexture:String(index:Int=0)
+	
+		Local s:Byte[4+MAXLEN]
+		Local retval:Int = aiGetMaterialTexture(pMaterial,aiTextureType_DIFFUSE,index,Varptr s[0])
+		
+		If retVal = AI_SUCCESS			
+			Return String.FromCString(Varptr s[4])
+		Else
+			DebugLog "mat. GetMaterialTexture failed with code " + retVal
+		EndIf	
+		
+	End Method
+	
+End Type
+
+' used in aiMaterial
+Type aiMaterialProperty
+
+	Field mKey:String
+	Field Semantic:Int
+	Field Index:Int
+	Field DataLength:Int
+	Field mType:Int				
+	Field mData:Byte Ptr		
+	
+	Function Create:aiMaterialProperty(pProps:Byte Ptr)
+	
+		Local mp:aiMaterialProperty = New aiMaterialProperty
+		
+		mp.mKey = String.FromCString(pProps + 4)
+		
+		Local pVars:Int Ptr = Int Ptr(pProps + MAXLEN + 4 )
+		
+		mp.Semantic:Int = pVars[0]
+		mp.Index = pVars[1]
+		mp.DataLength = pVars[2]
+		mp.mType = pVars[3]
+		mp.mData = Byte Ptr pVars[4]
+		
+		Return mp
+		
+	End Function
+	
+	Method GetFloatValue:Float(index:Int)
+	
+		Return Float Ptr (mData)[index]
+		
+	End Method
+	
+	Method GetStringValue:String()
+	
+		Return String.FromCString(mData + 4 )
+		
+	End Method
+	
+	Method GetIntegerValue:Int (index:Int)
+	
+		Return Int Ptr (mData)[index]
+		
+	End Method
+	
+	Method GetByteValue:Byte(index:Int)
+	
+		Return mData[index]
+		
+	End Method
+	
+End Type
+
+Rem
+bbdoc: A mesh represents a geometry Or model with a single material.
+	about:
+
+* It usually consists of a number of vertices And a series of primitives/faces 
+* referencing the vertices. In addition there might be a series of bones, each 
+* of them addressing a number of vertices with a certain weight. Vertex data 
+* is presented in channels with each channel containing a single per-vertex 
+* information such as a set of texture coords Or a normal vector.
+* If a data pointer is non-Null, the corresponding data stream is present.
+* From C++-programs you can also use the comfort functions Has*() To
+* test For the presence of various data streams.
+*
+* A Mesh uses only a single material which is referenced by a material ID.
+* @note The mPositions member is usually Not optional. However, vertex positions 
+* *could* be missing If the AI_SCENE_FLAGS_INCOMPLETE flag is set in 
+* @code
+* aiScene::mFlags
+* @endcode
+*/
+EndRem
+Type aiMesh
+
+	Field PrimitiveTypes:Int
+	Field NumVertices:Int
+	Field NumFaces:Int
+	Field pVertices:Float Ptr
+	Field pNormals:Float Ptr
+	Field pTangents:Byte Ptr
+	Field pBitangents:Byte Ptr
+	Field pColors:Byte Ptr[AI_MAX_NUMBER_OF_COLOR_SETS]
+	Field pTextureCoords:Byte Ptr[AI_MAX_NUMBER_OF_TEXTURECOORDS]
+	Field NumUVComponents:Int[AI_MAX_NUMBER_OF_TEXTURECOORDS]
+	Field pFaces:Int Ptr
+	Field NumBones:Int
+	Field pBones:Byte Ptr
+	Field MaterialIndex:Int
+	
+	' vertices
+	
+	Method VertexX:Float(index:Int)
+	
+		Return pVertices[index*3]
+		
+	End Method
+	
+	Method VertexY:Float(index:Int)
+	
+		Return pVertices[index*3+1]
+		
+	End Method
+	
+	Method VertexZ:Float(index:Int)
+	
+		Return pVertices[index*3+2]
+		
+	End Method
+	
+	' normals
+	
+	Method VertexNX:Float(index:Int)
+	
+		Return pNormals[index*3]
+		
+	End Method
+	
+	Method VertexNY:Float(index:Int)
+	
+		Return pNormals[index*3+1]
+		
+	End Method
+	
+	Method VertexNZ:Float(index:Int)
+	
+		Return pNormals[index*3+2]
+		
+	End Method
+	
+	' texcoords - funky :-)
+	
+	Method VertexU:Float(index:Int,coord_set:Int=0)
+	
+		Return Float Ptr(pTextureCoords[coord_set])[index*3]
+		
+	End Method
+
+	Method VertexV:Float(index:Int,coord_set:Int=0)
+	
+		Return Float Ptr(pTextureCoords[coord_set])[index*3 + 1]
+		
+	End Method
+
+	Method VertexW:Float(index:Int,coord_set:Int=0)
+	
+		Return Float Ptr(pTextureCoords[coord_set])[index*3 + 2 ]
+		
+	End Method
+	
+	Method VertexRed:Float(index:Int,color_set:Int=0)
+	
+		Return Float Ptr(pColors[color_set])[index*4]
+		
+	End Method
+	
+	Method VertexGreen:Float(index:Int,color_set:Int=0)
+	
+		Return Float Ptr(pColors[color_set])[index*4 + 1]
+		
+	End Method
+	
+	Method VertexBlue:Float(index:Int,color_set:Int=0)
+	
+		Return Float Ptr(pColors[color_set])[index*4 + 2]
+		
+	End Method
+	
+	Method VertexAlpha:Float(index:Int,color_set:Int=0)
+	
+		Return Float Ptr(pColors[color_set])[index*4 + 3]
+		
+	End Method		
+	
+	Method HasPositions:Int()
+	
+		If NumVertices <= 0 Then Return False
+		If pVertices <> Null Then Return True
+		
+	End Method
+	
+	Method HasFaces:Int()
+	
+		If NumVertices <= 0 Then Return False
+		If pFaces <> Null Then Return True
+		
+	End Method	
+	
+	Method HasNormals:Int()
+	
+		If NumVertices <= 0 Then Return False
+		If pNormals <> Null Then Return True
+		
+	End Method	
+	
+	Method HasTangentsAndBitangents:Int() 
+	
+		If NumVertices <= 0 Then Return False	
+		If pTangents = Null Then Return False
+		If pBitangents <> Null Then Return True
+		
+	End Method
+	
+	Method HasTextureCoords:Int(coord_set:Int)
+	
+		If coord_set >= AI_MAX_NUMBER_OF_TEXTURECOORDS Then Return False
+		If pTextureCoords[coord_set] <> Null Then Return True
+		
+	End Method
+	
+	Method HasVertexColors:Int( color_set:Int)
+	
+		If NumVertices <= 0 Then Return False
+		If color_set >= AI_MAX_NUMBER_OF_COLOR_SETS Then Return False
+		If pColors[color_set] <> Null Then Return True
+		
+	End Method	
+	
+	Method TriangleVertex:Int(index:Int,corner:Int)
+	
+		Local faceIndexes:Int Ptr = Int Ptr pFaces[index*2+1]
+		Return faceIndexes[corner]
+		
+	End Method
+	
+	Method GetTriangularFaces:Int[,]()
+	
+		Local faces:Int[NumFaces,3]
+		Local index:Int
+		
+		For Local count:Int = 0 To NumFaces - 1
+			Local faceCount:Int = pFaces[index]
+			Local faceIndexes:Int Ptr = Int Ptr pFaces[index+1]
+			
+			' TODO for nontriangular faces: faceCount could be other than 3
+			For Local n:Int = 0 To 2
+				faces[count , n] = faceIndexes[n]
+			Next
+			
+			index:+2
+		Next
+		
+		Return faces
+		
+	End Method
+	
+End Type
+
+' used in aiScene
+Type aiNode
+
+	Field pointer:Byte Ptr
+	Field name:String
+	Field transformation:aiMatrix4x4
+	Field NumChildren:Int
+	Field Children:aiNode[]
+	Field NumMeshes:Int
+	Field MeshIndexes:Int[]
+	Field Parent:aiNode
+	
+	Function Create:aiNode(pointer:Byte Ptr,parent:aiNode = Null)
+	
+		Local n:aiNode = New aiNode
+		n.Parent = parent
+		n.pointer = pointer
+		n.name = String.FromCString(pointer + 4)
+		
+		'DebugLog "Nodename " + n.name
+
+		n.transformation = aiMatrix4x4.Create(Float Ptr (Byte Ptr pointer + MAXLEN + 4))
+		
+		Local pBase:Int Ptr = Int Ptr(Byte Ptr pointer + MAXLEN + 4 + 16*4)
+		
+		'Rem
+		n.NumMeshes = pBase[3]
+		
+		'DebugLog "Mesh count for this node: " + n.NumMeshes
+		
+		Local pMeshIndexArray:Int Ptr = Int Ptr pBase[4]
+		
+		n.MeshIndexes = n.MeshIndexes[..n.NumMeshes ]
+		
+		For Local i:Int = 0 To n.NumMeshes - 1
+			n.MeshIndexes[i] = pMeshIndexArray[i]
+		Next
+		'End Rem
+		
+		' get child nodes
+		n.NumChildren = pBase[1]
+		
+		If n.NumChildren		
+			Local pChildArray:Int Ptr = Int Ptr pBase[2]
+			
+			n.Children = n.Children[..n.NumChildren]
+			
+			For Local i:Int = 0 To n.NumChildren - 1
+				n.Children[i] = aiNode.Create(Byte Ptr pChildArray[i],n)
+			Next
+		EndIf
+		
+		Return n
+		
+	End Function
+	
+End Type
+
+Type aiScene
+
+	Field pointer:Int Ptr
+	Field flags:Int
+	
+	Field rootNode:aiNode
+	Field numMeshes:Int
+	Field meshes:aiMesh[]
+	Field NumMaterials:Int
+	Field materials:aiMaterial[]
+	
+	' aiImportFileFromMemory by Happy Cat (JM) - Jan 2013
+	Method ImportFile:Int Ptr( filename:String,readflags:Int )
+	
+		If (Left(filename, 8) = "incbin::")
+		
+			Local binName:String = Mid(filename, 9)
+			Local binPtr:Byte Ptr = IncbinPtr(binName)
+			Local binLen:Int = IncbinLen(binName)
+			
+			If (binPtr = Null Or binLen = 0) Then Return Null
+			
+			pointer = aiImportFileFromMemory(binPtr, binLen, readFlags, Right(fileName, 3))
+			
+		Else
+		?win32	
+			' TODO this is a fix for wavefront mtl not being found
+			' does this mess up UNC paths or something else?
+			filename = filename.Replace("/","\")
+		?
+			'DebugLog "filename " + filename
+			
+			pointer = aiImportFile(filename, readflags)
+		EndIf
+		
+		If pointer <> Null
+		
+			flags = pointer[0]
+			
+			rootNode = aiNode.Create(Byte Ptr pointer[1])
+			numMeshes = pointer[2]
+			
+			Local pMeshArray:Int Ptr = Int Ptr pointer[3]
+			meshes = meshes[..numMeshes]
+			
+			For Local i:Int = 0 To numMeshes - 1 
+				Local pMesh:Int Ptr = Int Ptr pMeshArray[i]
+				
+				meshes[i] = New aiMesh
+				meshes[i].PrimitiveTypes = pMesh[0]
+				meshes[i].NumVertices = pMesh[1]
+				meshes[i].NumFaces = pMesh[2]
+				
+				meshes[i].pVertices = Float Ptr pMesh[3]
+				meshes[i].pNormals = Float Ptr pMesh[4]
+				meshes[i].pTangents = Byte Ptr pMesh[5]
+				meshes[i].pBitangents = Byte Ptr pMesh[6]
+				
+				Local pMeshPointerOffset:Int = 7
+				
+				For Local n:Int = 0 To AI_MAX_NUMBER_OF_COLOR_SETS - 1
+					meshes[i].pColors[n] = Byte Ptr pMesh[pMeshPointerOffset + n]
+				Next
+				
+				pMeshPointerOffset:+ AI_MAX_NUMBER_OF_COLOR_SETS
+				
+				For Local n:Int = 0 To AI_MAX_NUMBER_OF_TEXTURECOORDS - 1
+					meshes[i].pTextureCoords[n] = Byte Ptr pMesh[pMeshPointerOffset + n]
+				Next 
+				
+				pMeshPointerOffset:+ AI_MAX_NUMBER_OF_TEXTURECOORDS
+				
+				For Local n:Int = 0 To AI_MAX_NUMBER_OF_TEXTURECOORDS - 1
+					meshes[i].NumUVComponents[n] = pMesh[pMeshPointerOffset + n]
+				Next
+				
+				pMeshPointerOffset:+ AI_MAX_NUMBER_OF_TEXTURECOORDS
+				
+				meshes[i].pFaces = Int Ptr pMesh[pMeshPointerOffset]
+				meshes[i].NumBones = pMesh[pMeshPointerOffset+1]
+				meshes[i].pBones = Byte Ptr pMesh[pMeshPointerOffset+2]
+				meshes[i].MaterialIndex = pMesh[pMeshPointerOffset+3]
+				
+			Next
+			
+			NumMaterials = pointer[4]
+			
+			Local pMaterialArray:Int Ptr = Int Ptr pointer[5]
+			materials = materials[..NumMaterials]
+			
+			For Local i:Int = 0 To NumMaterials - 1 
+				'DebugLog "Material found"
+				
+				materials [i] = New aiMaterial 
+				materials [i].pMaterial = Int Ptr pMaterialArray[i]
+				materials [i].NumProperties = materials [i].pMaterial[1]
+				materials [i].NumAllocated = materials [i].pMaterial[2]	
+				
+				'Rem ' loading properties is not needed, but I do it for now to make a list of loaded properties
+				' redim
+				materials [i].Properties = materials [i].Properties[..materials [i].pMaterial[1]]
+				
+				Local pMaterialPropertyArray:Int Ptr = Int Ptr materials [i].pMaterial[0]	
+				
+				For Local p:Int = 0 To materials [i].NumProperties - 1
+					'DebugLog "Materialproperty found"
+					materials [i].Properties[p] = aiMaterialProperty.Create(Byte Ptr pMaterialPropertyArray[p])
+				Next
+				
+				'EndRem
+			Next
+			
+		EndIf
+		
+		Return pointer
+		
+	End Method
+	
+	Method ReleaseImport()
+	
+		If pointer <> Null
+			aiReleaseImport(pointer)
+		EndIf
+		
+		pointer = Null
+		rootNode = Null
+		meshes = Null
+		numMeshes = 0
+		flags = 0
+	
+	End Method
+		
+End Type