Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Mesh ¶
type Mesh struct {
// contains filtered or unexported fields
}
func NewMesh ¶
func NewMesh(points []float32, uvs []float32, normals []float32, indices []uint32, fixedIndices []uint32) (*Mesh, error)
NewMesh creates a Mesh object from the buffers provided. The buffers provided may be modified by LSCM.
Parameters:
- points: slice of vertex coordinates, every 3 elements representing a vertex
- uvs: slice of texture coordinates, every 2 elements representing a vertex, the values will be overwritten by LSCM
- normals: may be nil, it is only included for convenience and not used by LSCM
- indices: slice of vertex indices for each face, every 3 elements representing a face
- fixedIndices: slice of vertex indices for fixed uvs for LSCM, at least 2 are required
If the wrong number of points, uvs, indices, or fixedIndices is detected, an error is returned.
func ParseObj ¶ added in v1.0.0
ParseObj parses a Wavefront .obj file content into a Mesh.
At least two of the vertex lines need "fix 0.0, 0.0" post-fixed to the line to indicate fixed vertices for LSCM The coordinates are fixed texture coordinates for those vertexes.
This does not support all obj properties. Only parses vertices, normals, and faces while ignoring other lines. Assumes the corresponding normal indices are the same as the vertex indices.
func (*Mesh) GetNormals ¶ added in v1.0.0
Source Files ¶
Click to show internal directories.
Click to hide internal directories.