Overview
As discussed before, WaveFront OBJ and MTL files needs to be parsed to get geometry, Material information. A new mesh class and new geometry object are required for this.
Details
A new utility class GenericObjParser is defined for loading OBJ and MTL files and generating VertexData, Material and texture information. A model can consists of 1 or more Mesh. Each mesh is associated with 1 material which in turn is associated with 0 or 1 texture. Each MeshInfo object represents a mesh which contains Vertex Data consisting of vertices.
System class diagram
The GenericParser is an abstract class. There are derived two derived classes WFObjParser and AssetImpParser to implement parsing functionality.
A new mesh class GenericObjMesh is defined for loading vertexdata, Material and texture data. It's used by another new class GenericObj object for loading vertex data to vertex shader and texture data to the vertex and fragment shaders. Note that a texture is not mandatory. A GenericObj is created for each MeshInfo object generated by the GenericParser derivative.
MeshInfo
GenericParser
GenericParser the base class for parser classes that parses OBJ file and MTL files to provide geometry and material color information for rendering. It supplies vertices, texture coordinates, normals, Ambient, Diffuse, Specular Colors and Texture information.
WFObjParser derives from GenericParser class. It parses OBJ file and MTL files to provide geometry and material color information for rendering. It supplies vertices, texture coordinates, normals, Ambient, Diffuse, Specular Colors and Texture information.
AssetImpParser
AssetImpParser derives from GenericParser class. It parses OBJ file and MTL files to provide geometry and material color information for rendering. It supplies vertices, texture coordinates, normals, Ambient, Diffuse, Specular Colors and Texture information. Internally it uses AssetImport library.
GenericObjMesh
The Source Code can be accessed from MeshInfo, GenericParser, WFObjParser ,AssetImpParser, GenericObjMesh, GenericObj
No comments:
Post a Comment