Unit a3dge.Wavefront

Description

Wavefront .obj file loader.

It defines a couple of routines that allows to load Wavefront's .obj and .mtl files.

It also registers the .obj loader to be used by LoadModel.

Overview

Classes, Interfaces, Objects and Records

Name Description
Class EWavefrontFileLoaderError Exception class used by Wavefront loader.

Functions and Procedures

function LoadWavefrontObj (const aFilename: AnsiString): TModel3D;
procedure LoadWavefrontMtl ( const aFileName: AnsiString; aMaterialList: TMaterialList );

Description

Functions and Procedures

function LoadWavefrontObj (const aFilename: AnsiString): TModel3D;

Create a model from a Wavefront .obj file.

If the .obj file includes references to .mtl files, it will load the material library and the textures.

If the .mtl file isn't available then it won't be loaded but the name of the library will be stored in the Name property of the Materials list of the polyhedron, as well as each material name in their correspondent item.

Parameters
aFilename
File to load.
Returns

The reference to the new model or Nil if it cannot load it.

See also
LoadWavefrontMtl
Load a Wavefront Material Template Library (mtl) file.
LoadModel
Load 3D model.
TMaterialList.Merge
Merge current list with given list.
procedure LoadWavefrontMtl ( const aFileName: AnsiString; aMaterialList: TMaterialList );

Load a Wavefront Material Template Library (mtl) file.

If the material references to a texture bitmap it will try to load it. If it cannot, it won't fail and add the filename of the bitmap (without extension) to the TMaterial.TextureName property.

Note that the material list will be clean before loading the file (see TMaterialList.Clear. If you want to keep the previous material mapping, load it in a new material list then use TMaterialList.Merge.

See also
LoadWavefrontObj
Create a model from a Wavefront .obj file.

Generated by PasDoc 0.15.0. Generated on 2025-07-31 11:41:01.