OBJ Files
File format
- Read and write Wavefront OBJ files possibly with vertex colors.
- File extension is
.obj
. OBJ does not use a magic header.
Supported features
- Vertex positions 2D, 3D, 4D
- Texture coordinates 2D, 3D
- per vertex
- per half-edge (per vertex per face)
- Normals
- per vertex
- per half-edge (per vertex per face)
- Vertex colors
API
PMeshIO.readmesh
— MethodDelegate to readobjmesh
PMeshIO.readobjmesh
— Functionmesh = readobjmesh(io, template::Mesh[;
real_type=Float64, index_type=Int32,
color_type=RGBA,
position=Val(:x), normal=Val(:n),
texcoord=Val(:u), color=Val(:c))
Read mesh
of same type as template
from OBJ data steam io
.
real_type
,index_type
andcolor_type
are used byOBJBuffer
position
,normal
,texcoord
andcolor
denote attributes inmesh
, which may or may not exist or may be disabled.
This method is called by readmesh
PMeshIO.writemesh
— MethodDelegate to writeobjmesh
PMeshIO.writeobjmesh
— Methodwriteobjmesh(io, mesh[;
position=Val(:x), texcoord=Val(:u),
normal=nothing, color=Val(:c),
format="%g"])
Write mesh
to io
in OBJ format using attributes
position
texcoord
optional vertex texture coordinates, possibly stored per face (ashattr
).normal
optional vertex normal, possibly stored per face (ashattr
)color
optional vertex color (format)
Pass nothing
to ignore an optional attribute. Attributes the are disabled are also ignored, i.e., not written.
The optional format
argument specifies the output format of a floating point number as a String
using sprintf
-syntax.
This method is called by writemesh
.
See also writemesh
, readobjmesh
, readobj