Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Declaration ¶
type Declaration struct { Vertex int UV int Normal int // Pointers to actual geometry values. // When serialized to string, the index is read from ref // if available. This enables easy geometry rewrites. RefVertex, RefUV, RefNormal *GeometryValue }
zero value means it was not declared, should not be written @note exception: if sibling declares it, must be written eg. 1//2
func (*Declaration) Equals ¶
func (d *Declaration) Equals(other *Declaration) bool
func (*Declaration) Index ¶
func (d *Declaration) Index(t Type) int
Use this getter when possible index rewrites has occurred. Will first return index from geometry value pointers, if available.
type Geometry ¶
type Geometry struct { Vertices []*GeometryValue // v x y z [w] Normals []*GeometryValue // vn i j k UVs []*GeometryValue // vt u [v [w]] Params []*GeometryValue // vp u v [w] }
func NewGeometry ¶
func NewGeometry() *Geometry
func (*Geometry) Get ¶
func (g *Geometry) Get(t Type) []*GeometryValue
func (*Geometry) Set ¶
func (g *Geometry) Set(t Type, values []*GeometryValue)
func (*Geometry) Stats ¶
func (g *Geometry) Stats() GeometryStats
type GeometryStats ¶
type GeometryStats struct {
Vertices, Normals, UVs, Params int
}
func (GeometryStats) IsEmpty ¶
func (gs GeometryStats) IsEmpty() bool
func (GeometryStats) Num ¶
func (gs GeometryStats) Num(t Type) int
type GeometryValue ¶
func (*GeometryValue) Distance ¶
func (gv *GeometryValue) Distance(to *GeometryValue) float64
func (*GeometryValue) Equals ¶
func (gv *GeometryValue) Equals(other *GeometryValue, epsilon float64) bool
func (*GeometryValue) String ¶
func (gv *GeometryValue) String(t Type) (out string)
type OBJ ¶
type OBJ struct { Geometry *Geometry MaterialLibraries []string Objects []*Object Comments []string }
func (*OBJ) ObjectWithType ¶
type Object ¶
type Object struct { Type Type Name string Material string VertexData []*VertexData Comments []string // contains filtered or unexported fields }
func (*Object) ReadVertexData ¶
Reads a vertex data line eg. f and l into this object.
If parent OBJ is non nil, additionally converts negative index references into absolute indexes and check out of bounds errors.
type VertexData ¶
type VertexData struct { Type Type Declarations []*Declaration // contains filtered or unexported fields }
VertexData @todo Make face, line etc. separate objects with VertexData being an interface
func ParseFaceVertexData ¶
func ParseFaceVertexData(str string, strict bool) (vt *VertexData, err error)
func ParseListVertexData ¶
func ParseListVertexData(t Type, str string, strict bool) (*VertexData, error)
func (*VertexData) Index ¶
func (f *VertexData) Index(index int) *Declaration
func (*VertexData) Meta ¶
func (f *VertexData) Meta(t Type) string
func (*VertexData) SetMeta ¶
func (f *VertexData) SetMeta(t Type, value string)
func (*VertexData) String ¶
func (vt *VertexData) String() (out string)
Click to show internal directories.
Click to hide internal directories.