Geometry object
'
A simple 3d object class
'includes a 'load_obj' function
'encapsulates storage for...
'this is set by the load function. Check here after loading for the default path to check for images.
DefaultPath As String
vertice_count As Long
normal_count As Long
verticetexture_count As Long
face_count As Long
Face_Format As String 'we'll try to determin the format that faces are stored in, ei if it's just vertices, or if normals or texture coordinates are present
Enum Geometry_UV_Projection_Type
Geometry_UV_Projection_x = 0
Geometry_UV_Projection_y = 1
Geometry_UV_Projection_z = 2
Geometry_UV_Spherical_x = 3
Geometry_UV_Spherical_y = 4
Geometry_UV_Spherical_z = 5
End Enum
FastLoad As Boolean 'use this for faster loading and better memory efficiency
'it may exibit problems with UV maps with symetry, and handedness issues,
'because vertice normals/tangents are shared.
'It's faster because vertex normal/tangent smoothing is linear in time (one pass)
'as apposed to squared time for slow loading
SmoothingAngle As Single 'the angle at which point smoothing becomes hard edges. Set this before loading, or before calling SmoothNormals
'default value is 85.53, like Lightwave
'returns all the virtices in an object in an 2d array. array has count elements in the first index, and 3 elements in the second index.
Function GetVertices_variant() As Variant
Function GetNormals_variant() As Variant
Function GetBiNormals_Variant() As Variant
Friend Sub GetBiNormals(MyBinormals() As point3d)
Function GetTangents_Variant() As Variant
Function GetVerticeTextures_variant() As Variant
'returns vertices, vertice normals, and vertice textures, in that order, or v1,v2,v3,vn1,vn2,nv3,vt1,vt2,vt3
Function GetFaces_variant() As Variant
' v(n, 0) = faces(n).v1
' v(n, 1) = faces(n).v2
' v(n, 2) = faces(n).v3
' v(n, 3) = faces(n).vn1
' v(n, 4) = faces(n).vn2
' v(n, 5) = faces(n).vn3
' v(n, 6) = faces(n).vt1
' v(n, 7) = faces(n).vt2
' v(n, 8) = faces(n).vt3
' v(n, 9) = faces(n).mtl
' v(n, 10) = faces(n).FaceNormal.normal.x
' v(n, 11) = faces(n).FaceNormal.normal.y
' v(n, 12) = faces(n).FaceNormal.normal.z
' v(n, 13) = faces(n).FacePoint.x
' v(n, 14) = faces(n).FacePoint.y
' v(n, 15) = faces(n).FacePoint.z
' v(n, 16) = faces(n).tangent1.normal.x
' v(n, 17) = faces(n).tangent1.normal.y
' v(n, 18) = faces(n).tangent1.normal.z
' v(n, 19) = faces(n).tangent1.tangent.x
' v(n, 20) = faces(n).tangent1.tangent.y
' v(n, 21) = faces(n).tangent1.tangent.z
' v(n, 22) = faces(n).tangent1.binormal.x
' v(n, 23) = faces(n).tangent1.binormal.y
' v(n, 24) = faces(n).tangent1.binormal.z
' v(n, 25) = faces(n).tangent2.normal.x
' v(n, 26) = faces(n).tangent2.normal.y
' v(n, 27) = faces(n).tangent2.normal.z
' v(n, 28) = faces(n).tangent2.tangent
' v(n, 29) = faces(n).tangent2.binormal
' v(n, 30) = faces(n).tangent3.normal
' v(n, 31) = faces(n).tangent3.tangent
' v(n, 32) = faces(n).tangent3.binormal
Sub GetBoundingBox(MinX As Single, MinY As Single, MinZ As Single, MaxX As Single, MaxY As Single, MaxZ As Single)
'find the min and max vertex position
Function LoadOBJ(ByVal FileName As String) As Boolean
Function DeterminFaceFormat(ByVal MyString As String) As String
'the idea is to count the number of slashes in the string, and return an appropriate face format
'we'll support 3 formats.
'well return "v", "v/t" and "v/t/n" for vertex, vertex texture, and vertex texture normal.
Sub CalcFaceNormals()
Sub SmoothNormals_Full()
'only do this if the obj contains no vertice normals
'or if we need to use bump mapping, because we can extrapolate binormal and tanget vectors here later...
'or it can be called manually to override existing vertice normals
'face normals must be calculated with CalcFaceNormals, before calling this... This is normally done while loading.
Sub SmoothNormals()
'this function works by creating new vertice normals (overwrites the ones from the file) with the same count as vertices.
'it does not support smoothing groups or flat facets.
'if you need those features, you'll have to use the slower version.
'would be useful to be able to create UV texture coordinates, if they are not included in the file.
Sub MakeUV_Projection(ByVal projection As Geometry_UV_Projection_Type)