MCPcopy
hub / github.com/g3n/engine / SetNormalMap

Method SetNormalMap

material/physical.go:122–134  ·  view source on GitHub ↗

SetNormalMap sets this material optional normal texture. Returns pointer to this updated material. TODO add SetNormalMap (and SetSpecularMap) to StandardMaterial.

(tex *texture.Texture2D)

Source from the content-addressed store, hash-verified

120// Returns pointer to this updated material.
121// TODO add SetNormalMap (and SetSpecularMap) to StandardMaterial.
122func (m *Physical) SetNormalMap(tex *texture.Texture2D) *Physical {
123
124 m.normalTex = tex
125 if m.normalTex != nil {
126 m.normalTex.SetUniformNames("uNormalSampler", "uNormalTexParams")
127 m.ShaderDefines.Set("HAS_NORMALMAP", "")
128 m.AddTexture(m.normalTex)
129 } else {
130 m.ShaderDefines.Unset("HAS_NORMALMAP")
131 m.RemoveTexture(m.normalTex)
132 }
133 return m
134}
135
136// SetOcclusionMap sets this material optional occlusion texture.
137// Returns pointer to this updated material.

Callers 1

loadMaterialPBRMethod · 0.95

Calls 5

SetUniformNamesMethod · 0.80
AddTextureMethod · 0.80
UnsetMethod · 0.80
RemoveTextureMethod · 0.80
SetMethod · 0.45

Tested by

no test coverage detected