Documentation
¶
Index ¶
- func CountFaces(node Node) int
- type Anchor
- type AnchorWalker
- type ColorIndex
- type DynamicFaceAnchor
- type DynamicModel
- type DynamicNode
- type ExtensibleNode
- type Face
- type FaceAnchor
- type FaceWalker
- type FlatColoredFace
- type Model
- type Node
- type NodeAnchor
- type ShadeColoredFace
- type TextureCoordinate
- type TextureMappedFace
- type Vector
- type Vertex
- type VertexContainer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CountFaces ¶
CountFaces returns the number of faces found in the given node.
Types ¶
type Anchor ¶
type Anchor interface { // Specialize calls the anchor specific handler function on the provided walker. Specialize(walker AnchorWalker) // Normal returns the normal vector of the anchor. Normal() Vector // Reference returns the position of the anchor. Reference() Vector }
Anchor describes a reference for further nodes or faces
type AnchorWalker ¶
type AnchorWalker interface { // Nodes is called for a NodeAnchor. Nodes(anchor NodeAnchor) // Faces is called for a FaceAnchor. Faces(anchor FaceAnchor) }
AnchorWalker implementations receive specific anchors from a node.
type DynamicFaceAnchor ¶
type DynamicFaceAnchor struct {
// contains filtered or unexported fields
}
func NewDynamicFaceAnchor ¶
func NewDynamicFaceAnchor(normal, reference Vector) *DynamicFaceAnchor
NewSimpleNodeAnchor returns a NodeAnchor instance based on provided parameters.
func (*DynamicFaceAnchor) AddFace ¶
func (anchor *DynamicFaceAnchor) AddFace(face Face)
AddFace adds the given face to the anchor
func (*DynamicFaceAnchor) Normal ¶
func (anchor *DynamicFaceAnchor) Normal() Vector
Normal returns the normal vector of the anchor.
func (*DynamicFaceAnchor) Reference ¶
func (anchor *DynamicFaceAnchor) Reference() Vector
Reference returns the position of the anchor.
func (*DynamicFaceAnchor) Specialize ¶
func (anchor *DynamicFaceAnchor) Specialize(walker AnchorWalker)
Specialize is the Anchor implementation.
func (*DynamicFaceAnchor) WalkFaces ¶
func (anchor *DynamicFaceAnchor) WalkFaces(walker FaceWalker)
WalkFaces is the Anchor implementation.
type DynamicModel ¶
type DynamicModel struct { DynamicNode // contains filtered or unexported fields }
DynamicModel is a Model implementation that allows addition of content
func NewDynamicModel ¶
func NewDynamicModel() *DynamicModel
NewDynamicModel returns a new DynamicModel instance.
func (*DynamicModel) AddVertex ¶
func (model *DynamicModel) AddVertex(vertex Vertex)
AddVertex adds the given vertex to the model.
func (*DynamicModel) Vertex ¶
func (model *DynamicModel) Vertex(index int) Vertex
Vertex is the VertexContainer implementation
func (*DynamicModel) VertexCount ¶
func (model *DynamicModel) VertexCount() int
VertexCount is the VertexContainer implementation
type DynamicNode ¶
type DynamicNode struct {
// contains filtered or unexported fields
}
DynamicNode is a Node implementation that allows addition of content
func NewDynamicNode ¶
func NewDynamicNode() *DynamicNode
NewDynamicNode returns a new DynamicNode instance.
func (*DynamicNode) AddAnchor ¶
func (node *DynamicNode) AddAnchor(anchor Anchor)
AddAnchor adds the given anchor to the node.
func (*DynamicNode) WalkAnchors ¶
func (node *DynamicNode) WalkAnchors(walker AnchorWalker)
WalkAnchors is the Node implementation
type ExtensibleNode ¶
type ExtensibleNode interface { Node // AddAnchor adds the given anchor to the node. AddAnchor(anchor Anchor) }
ExtensibleNode is a node which allows addition of extra anchors
type Face ¶
type Face interface { // Specialize calls the face specific handler function on the walker. Specialize(walker FaceWalker) // Vertices returns the list of indices of the vertices for the face. Vertices() []int }
Face describes a rendered plane.
type FaceAnchor ¶
type FaceAnchor interface { Anchor // WalkFaces iterates over the contained faces and reports them specialized to the walker. WalkFaces(walker FaceWalker) }
FaceAnchor is an anchor for rendered faces.
type FaceWalker ¶
type FaceWalker interface { // FlatColored is called for faces with a simple color. FlatColored(face FlatColoredFace) // ShadeColored is called for faces with a shaded color. ShadeColored(face ShadeColoredFace) // TextureMapped is called for faces with textures. TextureMapped(face TextureMappedFace) }
FaceWalker receives specialized faces from a FaceAnchor
type FlatColoredFace ¶
type FlatColoredFace interface { Face // Color returns the color index of the face. Color() ColorIndex }
FlatColoredFace describes a face in a single color.
func NewSimpleFlatColoredFace ¶
func NewSimpleFlatColoredFace(vertices []int, color ColorIndex) FlatColoredFace
NewSimpleFlatColoredFace returns a new instance of a FlatColoredFace.
type Model ¶
type Model interface { VertexContainer Node }
Model describes the root node of a three dimensional object.
type Node ¶
type Node interface { // WalkAnchors iterates over the contained anchors and reports them (specialized) to the given walker. WalkAnchors(walker AnchorWalker) }
Node contains a list of anchors. These anchors can be iterated with a walk function.
type NodeAnchor ¶
type NodeAnchor interface { Anchor // Left returns the 'left' side of the binary tree. Left() Node // Right returns the 'right' side of the binary tree. Right() Node }
NodeAnchor is an anchor for two further nodes.
func NewSimpleNodeAnchor ¶
func NewSimpleNodeAnchor(normal, reference Vector, left, right Node) NodeAnchor
NewSimpleNodeAnchor returns a NodeAnchor instance based on provided parameters.
type ShadeColoredFace ¶
type ShadeColoredFace interface { Face // Color returns the color index of the face. Color() ColorIndex // Shade returns the shade intensity of the color. Shade() uint16 }
ShadeColoredFace is a face with a color and a specific shade.
func NewSimpleShadeColoredFace ¶
func NewSimpleShadeColoredFace(vertices []int, color ColorIndex, shade uint16) ShadeColoredFace
NewSimpleShadeColoredFace returns a new instance of a ShadeColoredFace.
type TextureCoordinate ¶
type TextureCoordinate interface { // Vertex returns the vertex index of the coordinate Vertex() int // U offset U() float32 // V offset V() float32 }
TextureCoordinate describes the offset values for a vertex within a texture.
func NewSimpleTextureCoordinate ¶
func NewSimpleTextureCoordinate(vertex int, u, v float32) TextureCoordinate
NewSimpleTextureCoordinate returns a TextureCoordinate instance with given parameters.
type TextureMappedFace ¶
type TextureMappedFace interface { Face // TextureID returns the identifier of the texture. TextureID() uint16 // TextureCoordinates returns the list of coordinates for the vertices. TextureCoordinates() []TextureCoordinate }
TextureMappedFace is a face with a texture.
func NewSimpleTextureMappedFace ¶
func NewSimpleTextureMappedFace(vertices []int, textureId uint16, textureCoordinates []TextureCoordinate) TextureMappedFace
NewSimpleTextureMappedFace returns a new TextureMappedFace instance with given parameters.
type Vector ¶
type Vector interface { // X coordinate X() float32 // Y coordinate Y() float32 // Z coordinate Z() float32 }
Vector describes a point in three dimensions
type Vertex ¶
type Vertex interface { // Position returns the position as a vector. Position() Vector }
Vertex describes the properties of a vertex.
func NewSimpleVertex ¶
NewSimpleVertex returns a vertex instance based on given parameters.
type VertexContainer ¶
type VertexContainer interface { // VertexCount returns the number of currently known vertices. VertexCount() int // Vertex returns the instance for the given index. Vertex(index int) Vertex }
VertexContainer provides acces to a list of vertices
Source Files
¶
- AbstractAnchor.go
- AbstractFace.go
- Anchor.go
- AnchorWalker.go
- ColorIndex.go
- CountFaces.go
- DynamicFaceAnchor.go
- DynamicModel.go
- DynamicNode.go
- ExtensibleNode.go
- Face.go
- FaceAnchor.go
- FaceWalker.go
- FlatColoredFace.go
- Model.go
- Node.go
- NodeAnchor.go
- ShadeColoredFace.go
- SimpleFlatColoredFace.go
- SimpleNodeAnchor.go
- SimpleShadeColoredFace.go
- SimpleTextureCoordinate.go
- SimpleTextureMappedFace.go
- SimpleVertex.go
- TextureCoordinate.go
- TextureMappedFace.go
- Vector.go
- Vertex.go
- VertexContainer.go