materials

package
v0.28.0 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2024 License: MIT Imports: 7 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetUnifMat2 added in v0.26.0

func SetUnifMat2(shaderProgId uint32, unifLoc int32, mat2 *gglm.Mat2)

func SetUnifMat3 added in v0.26.0

func SetUnifMat3(shaderProgId uint32, unifLoc int32, mat3 *gglm.Mat3)

func SetUnifMat4 added in v0.26.0

func SetUnifMat4(shaderProgId uint32, unifLoc int32, mat4 *gglm.Mat4)

func SetUnifVec2 added in v0.26.0

func SetUnifVec2(shaderProgId uint32, unifLoc int32, vec2 *gglm.Vec2)

func SetUnifVec3 added in v0.26.0

func SetUnifVec3(shaderProgId uint32, unifLoc int32, vec3 *gglm.Vec3)

func SetUnifVec4 added in v0.26.0

func SetUnifVec4(shaderProgId uint32, unifLoc int32, vec4 *gglm.Vec4)

Types

type Material

type Material struct {
	Id         uint32
	Name       string
	ShaderProg shaders.ShaderProgram
	Settings   MaterialSettings

	UnifLocs   map[string]int32
	AttribLocs map[string]int32

	// @TODO: Do this in a better way?. Perhaps something like how we do fbo attachments? Or keep it?
	// Phong shading
	DiffuseTex  uint32
	SpecularTex uint32
	NormalTex   uint32
	EmissionTex uint32

	// Shininess of specular highlights
	Shininess float32

	// Cubemaps
	CubemapTex      uint32
	CubemapArrayTex uint32

	// Shadowmaps
	ShadowMapTex1      uint32
	ShadowMapTexArray1 uint32
}

func NewMaterial

func NewMaterial(matName, shaderPath string) Material

func NewMaterialSrc added in v0.12.12

func NewMaterialSrc(matName string, shaderSrc []byte) Material

func (*Material) Bind

func (m *Material) Bind()

func (*Material) Delete

func (m *Material) Delete()

func (*Material) DisableAttribute

func (m *Material) DisableAttribute(attribName string)

func (*Material) EnableAttribute

func (m *Material) EnableAttribute(attribName string)

func (*Material) GetAttribLoc

func (m *Material) GetAttribLoc(attribName string) int32

func (*Material) GetUnifLoc added in v0.0.6

func (m *Material) GetUnifLoc(uniformName string) int32

func (*Material) SetUnifFloat32

func (m *Material) SetUnifFloat32(uniformName string, val float32)

func (*Material) SetUnifInt32 added in v0.0.5

func (m *Material) SetUnifInt32(uniformName string, val int32)

func (*Material) SetUnifMat2

func (m *Material) SetUnifMat2(uniformName string, mat2 *gglm.Mat2)

func (*Material) SetUnifMat3

func (m *Material) SetUnifMat3(uniformName string, mat3 *gglm.Mat3)

func (*Material) SetUnifMat4

func (m *Material) SetUnifMat4(uniformName string, mat4 *gglm.Mat4)

func (*Material) SetUnifVec2

func (m *Material) SetUnifVec2(uniformName string, vec2 *gglm.Vec2)

func (*Material) SetUnifVec3

func (m *Material) SetUnifVec3(uniformName string, vec3 *gglm.Vec3)

func (*Material) SetUnifVec4

func (m *Material) SetUnifVec4(uniformName string, vec4 *gglm.Vec4)

func (*Material) SetUniformBlockBindingPoint added in v0.28.0

func (m *Material) SetUniformBlockBindingPoint(uniformBlockName string, bindPointIndex uint32)

func (*Material) UnBind

func (m *Material) UnBind()

type MaterialSettings added in v0.24.0

type MaterialSettings uint64
const (
	MaterialSettings_None        MaterialSettings = iota
	MaterialSettings_HasModelMtx MaterialSettings = 1 << (iota - 1)
	MaterialSettings_HasNormalMtx
)

func (*MaterialSettings) Has added in v0.24.0

func (ms *MaterialSettings) Has(flags MaterialSettings) bool

func (*MaterialSettings) Remove added in v0.24.0

func (ms *MaterialSettings) Remove(flags MaterialSettings)

func (*MaterialSettings) Set added in v0.24.0

func (ms *MaterialSettings) Set(flags MaterialSettings)

type TextureSlot added in v0.21.0

type TextureSlot uint32
const (
	TextureSlot_Diffuse          TextureSlot = 0
	TextureSlot_Specular         TextureSlot = 1
	TextureSlot_Normal           TextureSlot = 2
	TextureSlot_Emission         TextureSlot = 3
	TextureSlot_Cubemap          TextureSlot = 10
	TextureSlot_Cubemap_Array    TextureSlot = 11
	TextureSlot_ShadowMap1       TextureSlot = 12
	TextureSlot_ShadowMap_Array1 TextureSlot = 13
)

Jump to

Keyboard shortcuts

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