README

This directory contains GLSL shaders used by the engine

If any shader in this directory or include 'chunk' in the "include" subdirectory is modified or a new shader or chunk is added or removed it is necessary to execute:

go generate

in this directory to update the "sources.go" file. It will invoke the "g3nshaders" command which will read the shaders and include files and generate the "sources.go" file.

To install "g3nshaders" change to the "tools/g3nshaders" directory from the engine "root" and execute: "go install".

Expand ▾ Collapse ▴

Documentation

Overview

    Package shaders contains the several shaders used by the engine

    Index

    Constants

    This section is empty.

    Variables

    This section is empty.

    Functions

    func AddInclude

    func AddInclude(name string, source string)

      AddInclude adds a chunk of shader code to the default shaders registry which can be included in a shader using the "#include <name>" directive

      func AddProgram

      func AddProgram(name string, vertex string, frag string, others ...string)

        AddProgram adds a shader program to the default registry of programs. Currently up to 3 shaders: vertex, fragment and geometry (optional) can be specified.

        func AddShader

        func AddShader(name string, source string)

          AddShader add a shader to default shaders registry. The specified name can be used when adding programs to the registry

          func IncludeSource

          func IncludeSource(name string) string

            IncludeSource returns the source code of the specified shader include chunk. If the name is not found an empty string is returned.

            func Includes

            func Includes() []string

              Includes returns list with the names of all include chunks currently in the default shaders registry.

              func Programs

              func Programs() []string

                Programs returns list with the names of all programs currently in the default shaders registry.

                func ShaderSource

                func ShaderSource(name string) string

                  ShaderSource returns the source code of the specified shader in the default shaders registry. If the name is not found an empty string is returned

                  func Shaders

                  func Shaders() []string

                    Shaders returns list with the names of all shaders currently in the default shaders registry.

                    Types

                    type ProgramInfo

                    type ProgramInfo struct {
                    	Vertex   string // Vertex shader name
                    	Fragment string // Fragment shader name
                    	Geometry string // Geometry shader name (optional)
                    }

                      ProgramInfo contains information for a registered shader program

                      func GetProgramInfo

                      func GetProgramInfo(name string) ProgramInfo

                        GetProgramInfo returns ProgramInfo struct for the specified program name in the default shaders registry