renderer

package
v0.0.0-...-c2c5ea0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 28, 2017 License: BSD-2-Clause Imports: 12 Imported by: 0

Documentation

Overview

Package renderer implements the scene renderer.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ProgSpecs

type ProgSpecs struct {
	// contains filtered or unexported fields
}

type Renderer

type Renderer struct {
	// contains filtered or unexported fields
}

func NewRenderer

func NewRenderer(gs *gls.GLS) *Renderer

func (*Renderer) AddChunk

func (r *Renderer) AddChunk(name, source string)

func (*Renderer) AddDefaultShaders

func (r *Renderer) AddDefaultShaders() error

func (*Renderer) AddProgram

func (r *Renderer) AddProgram(name, vertex, frag string, others ...string)

func (*Renderer) AddShader

func (r *Renderer) AddShader(name, source string)

func (*Renderer) Render

func (r *Renderer) Render(iscene core.INode, icam camera.ICamera) error

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 NewShaman

func NewShaman(gs *gls.GLS) *Shaman

NewShaman creates and returns a pointer to a new shader manager

func (*Shaman) AddChunk

func (sm *Shaman) AddChunk(name, source string)

AddChunk adds a shader chunk with the specified name and source code

func (*Shaman) AddDefaultShaders

func (sm *Shaman) AddDefaultShaders() error

AddDefaultShaders adds to this shader manager all default include chunks, shaders and programs statically registered.

func (*Shaman) AddProgram

func (sm *Shaman) AddProgram(name, vertexName, fragName string, others ...string)

AddProgram adds a program with the specified name and associated vertex and fragment shaders names (previously registered)

func (*Shaman) AddShader

func (sm *Shaman) AddShader(name, source string)

AddShader adds a shader program with the specified name and source code

func (*Shaman) GenProgram

func (sm *Shaman) GenProgram(specs *ShaderSpecs) (*gls.Program, error)

Generates shader program from the specified specs

func (*Shaman) Init

func (sm *Shaman) Init(gs *gls.GLS)

Init initializes the shader manager

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.

Directories

Path Synopsis
Package shader contains the several shaders used by the engine
Package shader contains the several shaders used by the engine

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL