Documentation ¶
Overview ¶
Package graphic implements scene objects which have a graphic representation.
Index ¶
- Constants
- type Graphic
- func (gr *Graphic) AddGroupMaterial(igr GraphicI, imat material.MaterialI, gindex int)
- func (gr *Graphic) AddMaterial(igr GraphicI, imat material.MaterialI, start, count int)
- func (gr *Graphic) BoundingBox() math32.Box3
- func (gr *Graphic) CalculateMatrices(gs *gls.GLS, rinfo *renderinfo.RenderInfo)
- func (gr *Graphic) ClearMaterials()
- func (gr *Graphic) Clone() node.NodeI
- func (gr *Graphic) Cullable() bool
- func (gr *Graphic) Dispose()
- func (gr *Graphic) GeometryI() geometry.GeometryI
- func (gr *Graphic) GetGeometry() *geometry.Geometry
- func (gr *Graphic) GetGraphic() *Graphic
- func (gr *Graphic) GetMaterial(vpos int) material.MaterialI
- func (gr *Graphic) Init(igr GraphicI, igeom geometry.GeometryI, mode uint32) *Graphic
- func (gr *Graphic) Materials() []GraphicMaterial
- func (gr *Graphic) ModelMatrix() *math32.Matrix4
- func (gr *Graphic) ModelViewMatrix() *math32.Matrix4
- func (gr *Graphic) ModelViewProjectionMatrix() *math32.Matrix4
- func (gr *Graphic) RenderOrder() int
- func (gr *Graphic) Renderable() bool
- func (gr *Graphic) SetCullable(state bool)
- func (gr *Graphic) SetIGraphic(igr GraphicI)
- func (gr *Graphic) SetRenderOrder(order int)
- func (gr *Graphic) SetRenderable(state bool)
- type GraphicI
- type GraphicMaterial
- type LineStrip
- type Lines
- type Mesh
- func (m *Mesh) AddGroupMaterial(imat material.MaterialI, gindex int)
- func (m *Mesh) AddMaterial(imat material.MaterialI, start, count int)
- func (m *Mesh) Clone() node.NodeI
- func (m *Mesh) Init(igeom geometry.GeometryI, imat material.MaterialI)
- func (m *Mesh) RenderSetup(gs *gls.GLS, rinfo *renderinfo.RenderInfo)
- func (m *Mesh) SetMaterial(imat material.MaterialI)
- type Points
- type RiggedMesh
- type Skeleton
- type Skybox
- type SkyboxData
- type Sprite
Constants ¶
const MaxBoneInfluencers = 4
MaxBoneInfluencers is the maximum number of bone influencers per vertex.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Graphic ¶
type Graphic struct { node.Node // Embedded Node ShaderDefines gls.ShaderDefines // Graphic-specific shader defines // contains filtered or unexported fields }
Graphic is a Node which has a visible representation in the scene. It has an associated geometry and one or more materials. It is the base type used by other graphics such as lines, line_strip, points and meshes.
func NewGraphic ¶
NewGraphic creates and returns a pointer to a new graphic object with the specified geometry and OpenGL primitive. The created graphic object, though, has not materials.
func (*Graphic) AddGroupMaterial ¶
AddGroupMaterial adds a material for the specified geometry group.
func (*Graphic) AddMaterial ¶
AddMaterial adds a material for the specified subset of vertices. If the material applies to all vertices, start and count must be 0.
func (*Graphic) BoundingBox ¶
BoundingBox recursively calculates and returns the bounding box containing this node and all its children.
func (*Graphic) CalculateMatrices ¶
func (gr *Graphic) CalculateMatrices(gs *gls.GLS, rinfo *renderinfo.RenderInfo)
CalculateMatrices calculates the model view and model view projection matrices.
func (*Graphic) ClearMaterials ¶
func (gr *Graphic) ClearMaterials()
ClearMaterials removes all the materials from this Graphic.
func (*Graphic) Clone ¶
Clone clones the graphic and satisfies the NodeI interface. It should be called by Clone() implementations of GraphicI. Note that the topmost implementation calling this method needs to call clone.SetIGraphic(igraphic) after calling this method.
func (*Graphic) Cullable ¶
Cullable satisfies the GraphicI interface and returns the cullable state of this graphic.
func (*Graphic) Dispose ¶
func (gr *Graphic) Dispose()
Dispose overrides the embedded Node Dispose method.
func (*Graphic) GeometryI ¶
GeometryI satisfies the GraphicI interface and returns a pointer to the GeometryI associated with this graphic.
func (*Graphic) GetGeometry ¶
GetGeometry satisfies the GraphicI interface and returns a pointer to the geometry associated with this graphic.
func (*Graphic) GetGraphic ¶
GetGraphic satisfies the GraphicI interface and returns pointer to the base Graphic.
func (*Graphic) GetMaterial ¶
GetMaterial returns the material associated with the specified vertex position.
func (*Graphic) Init ¶
Init initializes a Graphic type embedded in another type with the specified geometry and OpenGL mode.
func (*Graphic) Materials ¶
func (gr *Graphic) Materials() []GraphicMaterial
Materials returns slice with this graphic materials.
func (*Graphic) ModelMatrix ¶
ModelViewMatrix returns the last cached model view matrix for this graphic.
func (*Graphic) ModelViewMatrix ¶
ModelViewMatrix returns the last cached model view matrix for this graphic.
func (*Graphic) ModelViewProjectionMatrix ¶
ModelViewProjectionMatrix returns the last cached model view projection matrix for this graphic.
func (*Graphic) RenderOrder ¶
RenderOrder returns the render order of the object.
func (*Graphic) Renderable ¶
Renderable satisfies the GraphicI interface and returns the renderable state of this graphic.
func (*Graphic) SetCullable ¶
SetCullable satisfies the GraphicI interface and sets the cullable state of this Graphic (default = true).
func (*Graphic) SetIGraphic ¶
SetIGraphic sets the GraphicI on all this Graphic's GraphicMaterials.
func (*Graphic) SetRenderOrder ¶
SetRenderOrder sets the render order of the object. All objects have renderOrder of 0 by default. To render before renderOrder 0 set a lower renderOrder e.g. -1. To render after renderOrder 0 set a higher renderOrder e.g. 1
func (*Graphic) SetRenderable ¶
SetRenderable satisfies the GraphicI interface and sets the renderable state of this Graphic (default = true).
type GraphicI ¶
type GraphicI interface { node.NodeI GetGraphic() *Graphic GetGeometry() *geometry.Geometry GeometryI() geometry.GeometryI SetRenderable(bool) Renderable() bool SetCullable(bool) Cullable() bool RenderSetup(gs *gls.GLS, rinfo *renderinfo.RenderInfo) }
GraphicI is the interface for all Graphic objects.
type GraphicMaterial ¶
type GraphicMaterial struct {
// contains filtered or unexported fields
}
GraphicMaterial specifies the material to be used for a subset of vertices from the Graphic geometry A Graphic object has at least one GraphicMaterial.
func (*GraphicMaterial) GraphicI ¶
func (grmat *GraphicMaterial) GraphicI() GraphicI
GraphicI returns the graphic associated with the GraphicMaterial.
func (*GraphicMaterial) MaterialI ¶
func (grmat *GraphicMaterial) MaterialI() material.MaterialI
MaterialI returns the material associated with the GraphicMaterial.
func (*GraphicMaterial) Render ¶
func (grmat *GraphicMaterial) Render(gs *gls.GLS, rinfo *renderinfo.RenderInfo)
Render is called by the renderer to render this graphic material.
type LineStrip ¶
type LineStrip struct { Graphic // Embedded graphic object // contains filtered or unexported fields }
LineStrip is a Graphic which is rendered as a collection of connected lines.
func NewLineStrip ¶
NewLineStrip creates and returns a pointer to a new LineStrip graphic with the specified geometry and material.
func (*LineStrip) RenderSetup ¶
func (l *LineStrip) RenderSetup(gs *gls.GLS, rinfo *renderinfo.RenderInfo)
RenderSetup is called by the engine before drawing this geometry.
type Lines ¶
type Lines struct { Graphic // Embedded graphic object // contains filtered or unexported fields }
Lines is a Graphic which is rendered as a collection of independent lines.
func (*Lines) RenderSetup ¶
func (l *Lines) RenderSetup(gs *gls.GLS, rinfo *renderinfo.RenderInfo)
RenderSetup is called by the engine before drawing this geometry.
type Mesh ¶
type Mesh struct { Graphic // Embedded graphic // contains filtered or unexported fields }
Mesh is a Graphic with uniforms for the model, view, projection, and normal matrices.
func NewMesh ¶
NewMesh creates and returns a pointer to a mesh with the specified geometry and material. If the mesh has multi materials, the material specified here must be nil and the individual materials must be add using "AddMaterial" or AddGroupMaterial".
func (*Mesh) AddGroupMaterial ¶
AddGroupMaterial adds a material for the specified geometry group.
func (*Mesh) AddMaterial ¶
AddMaterial adds a material for the specified subset of vertices.
func (*Mesh) RenderSetup ¶
func (m *Mesh) RenderSetup(gs *gls.GLS, rinfo *renderinfo.RenderInfo)
RenderSetup is called by the engine before drawing the mesh geometry It is responsible to updating the current shader uniforms with the model matrices.
func (*Mesh) SetMaterial ¶
SetMaterial clears all materials and adds the specified material for all vertices.
type Points ¶
type Points struct { Graphic // Embedded graphic // contains filtered or unexported fields }
Points represents a geometry containing only points
func NewPoints ¶
NewPoints creates and returns a graphic points object with the specified geometry and material.
func (*Points) RenderSetup ¶
func (p *Points) RenderSetup(gs *gls.GLS, rinfo *renderinfo.RenderInfo)
RenderSetup is called by the engine before rendering this graphic.
type RiggedMesh ¶
type RiggedMesh struct { *Mesh // Embedded mesh // contains filtered or unexported fields }
RiggedMesh is a Mesh associated with a skeleton.
func NewRiggedMesh ¶
func NewRiggedMesh(mesh *Mesh) *RiggedMesh
NewRiggedMesh returns a new rigged mesh.
func (*RiggedMesh) RenderSetup ¶
func (rm *RiggedMesh) RenderSetup(gs *gls.GLS, rinfo *renderinfo.RenderInfo)
RenderSetup is called by the renderer before drawing the geometry.
func (*RiggedMesh) SetSkeleton ¶
func (rm *RiggedMesh) SetSkeleton(sk *Skeleton)
SetSkeleton sets the skeleton used by the rigged mesh.
func (*RiggedMesh) Skeleton ¶
func (rm *RiggedMesh) Skeleton() *Skeleton
SetSkeleton returns the skeleton used by the rigged mesh.
type Skeleton ¶
type Skeleton struct {
// contains filtered or unexported fields
}
Skeleton contains armature information.
func NewSkeleton ¶
func NewSkeleton() *Skeleton
NewSkeleton creates and returns a pointer to a new Skeleton.
func (*Skeleton) AddBone ¶
AddBone adds a bone to the skeleton along with an optional inverseBindMatrix.
func (*Skeleton) BoneMatrices ¶
BoneMatrices calculates and returns the bone world matrices to be sent to the shader.
type Skybox ¶
type Skybox struct { Graphic // embedded graphic object // contains filtered or unexported fields }
Skybox is the Graphic that represents a skybox.
func NewSkybox ¶
func NewSkybox(data SkyboxData) (*Skybox, error)
NewSkybox creates and returns a pointer to a Skybox with the specified textures.
func (*Skybox) RenderSetup ¶
func (skybox *Skybox) RenderSetup(gs *gls.GLS, rinfo *renderinfo.RenderInfo)
RenderSetup is called by the engine before drawing the skybox geometry It is responsible to updating the current shader uniforms with the model matrices.
type SkyboxData ¶
SkyboxData contains the data necessary to locate the textures for a Skybox in a concise manner.
type Sprite ¶
type Sprite struct { Graphic // Embedded graphic // contains filtered or unexported fields }
Sprite is a potentially animated image positioned in space that always faces the camera.
func NewSprite ¶
NewSprite creates and returns a pointer to a sprite with the specified dimensions and material
func (*Sprite) RenderSetup ¶
func (s *Sprite) RenderSetup(gs *gls.GLS, rinfo *renderinfo.RenderInfo)
RenderSetup sets up the rendering of the sprite.