Documentation ¶
Overview ¶
Package renderer implements the scene renderer.
Package renderer implements the scene renderer.
Index ¶
- Constants
- type Postprocessor
- type ProgSpecs
- type Renderer
- func (r *Renderer) CreatePostprocessor(width, height int32, vertexShaderSource, fragmentShaderSource string) *Postprocessor
- func (r *Renderer) ObjectSorting() bool
- func (r *Renderer) Render(scene core.INode, cam camera.ICamera) error
- func (r *Renderer) SetObjectSorting(sort bool)
- func (r *Renderer) Stats() Stats
- 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)
- type Stats
Constants ¶
const GLSL_VERSION = "330 core"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Postprocessor ¶
type Postprocessor struct { Width int32 Height int32 Fbo uint32 Tex uint32 Vao uint32 Prg *gls.Program Renderer *Renderer // contains filtered or unexported fields }
func (*Postprocessor) Render ¶
func (pp *Postprocessor) Render(fbwidth, fbheight int, render func())
type ProgSpecs ¶
type ProgSpecs struct {
// contains filtered or unexported fields
}
ProgSpecs represents a compiled shader program along with its specs
type Renderer ¶
type Renderer struct { Shaman // Embedded shader manager // contains filtered or unexported fields }
Renderer renders a scene containing 3D objects and/or 2D GUI elements.
func NewRenderer ¶
NewRenderer creates and returns a pointer to a new Renderer.
func (*Renderer) CreatePostprocessor ¶
func (r *Renderer) CreatePostprocessor(width, height int32, vertexShaderSource, fragmentShaderSource string) *Postprocessor
func (*Renderer) ObjectSorting ¶
ObjectSorting returns whether objects will be sorted before rendering.
func (*Renderer) Render ¶
Render renders the specified scene using the specified camera. Returns an an error.
func (*Renderer) SetObjectSorting ¶
SetObjectSorting sets whether objects will be sorted before rendering.
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 Defines gls.ShaderDefines // Additional shader defines }
ShaderSpecs describes the specification of a compiled shader program
type Shaman ¶
type Shaman struct {
// contains filtered or unexported fields
}
Shaman is the shader manager
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)
GenProgram generates shader program from the specified specs
func (*Shaman) SetProgram ¶
func (sm *Shaman) SetProgram(s *ShaderSpecs) (bool, error)
SetProgram sets 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.
type Stats ¶
type Stats struct { GraphicMats int // Number of graphic materials rendered Lights int // Number of lights rendered Panels int // Number of GUI panels rendered Others int // Number of other objects rendered }
Stats describes how many objects of each type are being rendered. It is cleared at the start of each render.