Gorilla.OBJ.Model
Unit Gorilla.OBJ.Model.pasClasses
- TOBJCache = class ( TVertexCache )
- TOBJSegment = class ( TObject )
- TOBJModel = class ( TModelDef )
Records
- record TOBJVertexID
- record TOBJPolygonID
- record TOBJPolygonIDList
Enumerations
- enum TOBJDataType = ( None, ObjectName, Coord, TexCoord, Normal, Group, SmoothGroup, MergingGroup, MatLib, UseMat, MapLib, UseMap, Point, Line, Face, Curve, Curve2D, Surface, Parameter, EndStatement, TrimLoop, Hole, SpecialCurve, SpecialPoint, Bevel, CInterp, DInterp, LOD, ShadowObj, TraceObj, CTech, STech, CSType, Deg, BasisMatrix, Step, Connect ) ;
Constants
- const GORILLA_OBJ_POLYGON_MAXSIZE : Integer = $C;
- const GORILLA_OBJ_MAPKD : string = "map_Kd";
- const GORILLA_OBJ_MAPKD_LOWER : string = "map_kd";
- const GORILLA_OBJ_MAPBUMP : string = "map_Bump";
- const GORILLA_OBJ_MAPBUMP_LOWER : string = "map_bump";
TOBJDataType
enum TOBJDataType = (
None, ObjectName, Coord, TexCoord, Normal, Group, SmoothGroup, MergingGroup, MatLib, UseMat, MapLib, UseMap, Point, Line, Face, Curve, Curve2D, Surface, Parameter, EndStatement, TrimLoop, Hole, SpecialCurve, SpecialPoint, Bevel, CInterp, DInterp, LOD, ShadowObj, TraceObj, CTech, STech, CSType, Deg, BasisMatrix, Step, Connect
) ;
Type defines a detector for all available tags in OBJ format. Not all tags are supported for now. Reference: http://paulbourke.net/dataformats/obj/
Remarks
Vertex data o geometric vertices (v) o texture vertices (vt) o vertex normals (vn) o parameter space vertices (vp) Free-form curve/surface attributes o rational or non-rational forms of curve or surface type: basis matrix, Bezier, B-spline, Cardinal, Taylor (cstype) o degree (deg) o basis matrix (bmat) o step size (step) Elements o point (p) o line (l) o face (f) o curve (curv) o 2D curve (curv2) o surface (surf) Free-form curve/surface body statements o parameter values (parm) o outer trimming loop (trim) o inner trimming loop (hole) o special curve (scrv) o special point (sp) o end statement (end) Connectivity between free-form surfaces o connect (con) Grouping o group name (g) o smoothing group (s) o merging group (mg) o object name (o) Display/render attributes o bevel interpolation (bevel) o color interpolation (c_interp) o dissolve interpolation (d_interp) o level of detail (lod) o material name (usemtl) o material library (mtllib) o shadow casting (shadow_obj) o ray tracing (trace_obj) o curve approximation technique (ctech) o surface approximation technique (stech)TOBJCache
Ancestors
Members
Fields
Methods
- public constructor Create ( ) ;
- public destructor Destroy ( ) ;
- public function DoOnCreateDefaultMaterial ( AMesh : TMeshDef ) : TMaterialDef ; override;
- public function DoOnCreateMaterialRef ( AMesh : TMeshDef; AMaterial : TMaterialDef ) : TMaterialRefDef ; override;
- public function AddPolygon ( const AIndexOffset : Integer; const APolygon : TOBJPolygonID; const AVertices : TList<Gorilla.DefTypes.TVertexData>; const AIndices : TList<Gorilla.DefTypes.TTriangleIndex> ) : Integer ; overload;
- public function GetVertex ( const AVertex : TOBJVertexID ) : TVertexData ; overload;
TOBJSegment
Ancestors
Members
Fields
- protected FName :
string
- protected FParent :
TOBJSegment
- protected FSegments :
TObjectList<Gorilla.OBJ.Model.TOBJSegment>
- protected FVertexOffset :
Integer
- protected FMaterial :
TMaterialDef
- protected FFaceVertices :
TOBJPolygonIDList
Methods
- public constructor Create ( AParent : TOBJSegment; AName : string ) ;
- public destructor Destroy ( ) ;
- public function FindSegmentByName ( const AName : string ) : TOBJSegment ;
- public procedure AddPolygon ( const APolygon : TOBJPolygonID ) ;
- public function GetMesh ( AParent : TMeshDef; ACache : TOBJCache ) : TMeshDef ;
Properties
TOBJModel
Ancestors
Members
Fields
- private FSmoothGroup :
Int64
- private FMainSegment :
TOBJSegment
- private FCurrentSegment :
TOBJSegment
- private FSegmentCounter :
Integer
- private FCurrentName :
string
- private FCurrentMaterial :
TMaterialDef
- private FDefaultMaterial :
TMaterialDef
Methods
- public constructor Create ( const AOwner : TMeshDef; const APackage : TObject ) ;
- public destructor Destroy ( ) ;
- private function ReadMaterials ( const ALine : string ) : string ;
- private function ReadUseMaterial ( const ACache : TOBJCache; const ALine : string ) : TMaterialDef ;
- private procedure ReadSources ( const ACache : TOBJCache; const ALine : string ) ;
- private function ReadGroup ( const AParent : TOBJSegment; const ALine : string ) : TOBJSegment ;
- private procedure ReadSmoothGroup ( const ALine : string ) ;
- private procedure ReadFaces ( AReader : TStreamReader; ACache : TOBJCache; ALine : string ) ;
- private procedure ReadFace ( const ACache : TOBJCache; const ASegment : TOBJSegment; const ALine : string ) ;
- private function GetDataType ( const ALine : string ) : TOBJDataType ; class;
- private procedure ParseDataType ( AReader : TStreamReader; ACache : TOBJCache; ALine : string ) ;
- private procedure LoadMaterialLibraryFromFile ( const AFileName : string ) ;
- private procedure LoadMaterialLibraryFromStream ( const AStream : TStream; const AFileName : string ) ;
- public procedure LoadFromFile ( const AFileName : string ) ; virtual;
- public procedure LoadFromStream ( const AStream : TStream; const APath : string ) ; virtual;