Reference/API
PMeshIO.OBJBuffer
PMeshIO.OBJBuffer
PMesh.createmesh
PMesh.createmesh
PMeshIO.copy!
PMeshIO.hashn
PMeshIO.hasht
PMeshIO.hasnormal
PMeshIO.hastexcoord
PMeshIO.hasvertexcolor
PMeshIO.hasvn
PMeshIO.hasvt
PMeshIO.isnormalpervertex
PMeshIO.istexcoordpervertex
PMeshIO.istrianglemesh
PMeshIO.nf
PMeshIO.nn
PMeshIO.normal
PMeshIO.nt
PMeshIO.nv
PMeshIO.position
PMeshIO.positiondim
PMeshIO.readobj
PMeshIO.texcoord
PMeshIO.texcoorddim
PMeshIO.toggleattributes!
PMeshIO.update!
PMeshIO.AbstractMeshFormat
PMeshIO.OBJBuffer
PMeshIO.OBJBuffer
PMeshIO.RGBA
PMeshIO.convert_to
PMeshIO.copy!
PMeshIO.hashn
PMeshIO.hasht
PMeshIO.hasnormal
PMeshIO.hastexcoord
PMeshIO.hasvertexcolor
PMeshIO.hasvn
PMeshIO.hasvt
PMeshIO.isnormalpervertex
PMeshIO.istexcoordpervertex
PMeshIO.istrianglemesh
PMeshIO.meshformat
PMeshIO.nf
PMeshIO.nn
PMeshIO.normal
PMeshIO.nt
PMeshIO.nv
PMeshIO.position
PMeshIO.positiondim
PMeshIO.readmesh
PMeshIO.readmesh
PMeshIO.readmesh
PMeshIO.readmesh
PMeshIO.readobj
PMeshIO.readobjmesh
PMeshIO.readoffmesh
PMeshIO.texcoord
PMeshIO.texcoorddim
PMeshIO.toggleattributes!
PMeshIO.update!
PMeshIO.writemesh
PMeshIO.writemesh
PMeshIO.writemesh
PMeshIO.writemesh
PMeshIO.writeobjmesh
PMeshIO.writeoffmesh
PMeshIO.OBJBuffer
— TypeStore contents of Wavefront OBJ file, use for reading files.
T
is the scalar type,I
is the index type,ColorT
is used for RGBA colorsnv
: numberof verticespositiondim
number of coordinates (2,3,3)texcoorddim
number of texture coordinates (1,2,3)position
coordinates of vertex positionstexcoord
texture coordinatesnormal
coordinates of normals (always 3 coordinates per normal)fdegree
vector of face degreesvidx
indices of vertices (positions) spanning facestidx
indices of texture coordinates, may be discontinuous (i.e., possibly >1 per vertex)nidx
indices of normal vectors, may be discontinuous (i.e., possibly >1 per vertex)vcolor
per vertex color asColorT
In contrast to MeshIO, polygons are not triangulated, and there is support for "discontinuous" normals and texture coordinates that are defined per face vertex.
See also Wavefront OBJ and vertex color
See also writeobjmesh
PMeshIO.OBJBuffer
— MethodConstruct OBJBuffer
PMesh.createmesh
— Methodmesh = createmesh(obj::OBJBuffer;
template::Mesh=createmesh(; real_type=T),
position=Val(:x),
normal=Val(:n),
texcoord=Val(:u))
Create mesh from obj
that was read by readobj
using template
and the specified attribute names.
- Attributes which are not defined in
obj
will be disabled! - Attributes which are not defined in
template
are not copied fromobj
.
See also OBJBuffer
, `toggleattributes!
PMesh.createmesh
— Methodmesh = createmesh(::OBJ[; real_type=Float64, dimx=Val(3), dimu=Val(2)])
Create an empty mesh with all attributes that may be read from an OBJ file: position, normal, and texture coordinates:
- vertex attributes
:x
,:n
,:u
,:c
- face attributes:
:n
- half-edge attributes
:n
,:u
The latter stores texture coordinates and normals that are defined for each vertex of a face.
PMeshIO.copy!
— Methodcopy!(mesh, obj,
Val(NX), Val(NU),
Val(:x), Val(:n), Val(:u), Val(:c))
Helper that copies contents of [OBJBuffer
])@ref) obj
to mesh
using dimensions NX
and NU
and the provided attributes for position, normal, texture coordinates, and color.
See also OBJBuffer
, createmesh
PMeshIO.hashn
— MethodDoes OBJBuffer
provide texture coordinates per face?
PMeshIO.hasht
— MethodDoes OBJBuffer
provide vertex normals per face?
PMeshIO.hasnormal
— MethodDoes OBJBuffer
store vormal vectors coordinates?
PMeshIO.hastexcoord
— MethodDoes OBJBuffer
store texture coordinates?
PMeshIO.hasvertexcolor
— MethodDoes OBJBuffer
store vertex colors?
PMeshIO.hasvn
— MethodDoes OBJBuffer
provide texture coordinates?
PMeshIO.hasvt
— MethodDoes OBJBuffer
provide per-vertex normals?
PMeshIO.isnormalpervertex
— MethodAre normals given per vertex? Alternative is per face.
PMeshIO.istexcoordpervertex
— MethodAre texture coordinates given per vertex? Alternative is per face.
PMeshIO.istrianglemesh
— MethodDoes OBJBuffer
represent a triangle mesh?
PMeshIO.nf
— MethodGet number of faces in OBJBuffer
PMeshIO.nn
— MethodGet number of normal vectors in OBJBuffer
PMeshIO.normal
— FunctionN = normal(obj)
ns = normal(obj, Val(3))
Get normals stored in OBJBuffer
as N::Matrix{T}
with normals in columns or ns::Vector{SVector{T, 3}}
.
PMeshIO.nt
— MethodGet number of texture coordinates in OBJBuffer
PMeshIO.nv
— MethodGet number of vertices in OBJBuffer
PMeshIO.position
— FunctionX = position(obj)
xs = position(obj, Val(N))
Get vertex positions stored in OBJBuffer
as X::Matrix{T}
with positions in columns or xs::Vector{SVector{T, N}}
(where N
must match positiondim
.
PMeshIO.positiondim
— MethodGet dimension of positions in OBJBuffer
(2, 3, 4
)
PMeshIO.readobj
— Methodobj = readobj(io[; realtype=Float64, indextype=Int32, color_type=PMeshIO.RBGA)
Reads OBJ file from io
and returns OBJBuffer
obj
.
See also OBJBuffer
, writeobjmesh
PMeshIO.texcoord
— FunctionU = texcoord(obj)
us = texcoord(obj, Val(N))
Get texcoords stored in OBJBuffer
as U::Matrix{T}
with texture coordinates in columns or us::Vector{SVector{T, N}}
(where N
must match texcoorddim
.
PMeshIO.texcoorddim
— MethodGet dimension of texture coordinates in OBJBuffer
(2, 3
)
PMeshIO.toggleattributes!
— MethodEnable of disable attributes provided by mesh
depending on what is provided by OBJBuffer
.
See also createmesh
PMeshIO.update!
— MethodUpdate number of vertices and dimensions of OBJBuffer
after reading.