ObjLoader class final
Decodes Wavefront OBJ, optionally with its .mtl material libraries.
Like the glTF layer, this depends on neither a graphics backend, dart:io nor
dart:ui: sibling files arrive through an AssetUriResolver.
OBJ is a text format with no version and plenty of dialects, so the parser is
permissive by design — unknown directives are recorded as warnings and
skipped rather than treated as errors. That holds for the .mtl half too:
see parseMtl, which reports its own once each.
- Implemented types
Constructors
- ObjLoader({VertexLayout layout = VertexLayout.standard, ObjNormals normals = ObjNormals.smooth, bool splitByGroup = true, bool flipTexcoordV = true})
Properties
- flipTexcoordV → bool
-
OBJ texture space has its origin at the bottom left, while our sampling and
glTF both put it at the top left, so V is flipped by default. This is the
single most common cause of upside-down textures on OBJ imports.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- layout → VertexLayout
-
final
- normals → ObjNormals
-
What to do when the file has no
vnrecords.final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- splitByGroup → bool
-
Whether
g,oandusemtlstart a new surface.final
Methods
-
decode(
Uint8List bytes, ModelLoadRequest request, AssetUriResolver resolveUri) → Future< ModelDocument> -
Reads
bytesinto a document.override -
handles(
String fileName, Uint8List bytes) → bool -
An
.objby name, and only by name: OBJ has no magic, and plain text that happens to begin withvis not a claim worth making before any other reader has had its turn.override -
load(
Uint8List bytes, {AssetUriResolver? resolveUri}) → Future< ObjDocument> -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited