Documentation ¶
Overview ¶
Package renderer implements the scene renderer.
Index ¶
- type ProgSpecs
- type Renderer
- type ShaderSpecs
- type Shaman
- func (sm *Shaman) AddChunk(name, source string)
- func (sm *Shaman) AddDefaultShaders() error
- func (sm *Shaman) AddProgram(name, vertexName, fragName string, others ...string)
- func (sm *Shaman) AddShader(name, source string)
- func (sm *Shaman) GenProgram(specs *ShaderSpecs) (*gls.Program, error)
- func (sm *Shaman) Init(gs *gls.GLS)
- func (sm *Shaman) SetProgram(s *ShaderSpecs) (bool, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Renderer ¶
type Renderer struct {
// contains filtered or unexported fields
}
func NewRenderer ¶
func (*Renderer) AddDefaultShaders ¶
func (*Renderer) AddProgram ¶
type ShaderSpecs ¶
type ShaderSpecs struct { Name string // Shader name Version string // GLSL version ShaderUnique bool // indicates if shader is independent of lights and textures UseLights material.UseLights // Bitmask indicating which lights to consider AmbientLightsMax int // Current number of ambient lights DirLightsMax int // Current Number of directional lights PointLightsMax int // Current Number of point lights SpotLightsMax int // Current Number of spot lights MatTexturesMax int // Current Number of material textures }
ShaderSpecs describes the specification of a compiled shader program
func (*ShaderSpecs) Compare ¶
func (ss *ShaderSpecs) Compare(other *ShaderSpecs) bool
Compare compares two shaders specifications structures
type Shaman ¶
type Shaman struct {
// contains filtered or unexported fields
}
func (*Shaman) AddDefaultShaders ¶
AddDefaultShaders adds to this shader manager all default include chunks, shaders and programs statically registered.
func (*Shaman) AddProgram ¶
AddProgram adds a program with the specified name and associated vertex and fragment shaders names (previously registered)
func (*Shaman) GenProgram ¶
func (sm *Shaman) GenProgram(specs *ShaderSpecs) (*gls.Program, error)
Generates shader program from the specified specs
func (*Shaman) SetProgram ¶
func (sm *Shaman) SetProgram(s *ShaderSpecs) (bool, error)
SetProgram set the shader program to satisfy the specified specs. Returns an indication if the current shader has changed and a possible error when creating a new shader program. Receives a copy of the specs because it changes the fields which specify the number of lights depending on the UseLights flags.