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

Method RenderSetup

graphic/mesh.go:89–111  ·  view source on GitHub ↗

RenderSetup is called by the engine before drawing the mesh geometry It is responsible to updating the current shader uniforms with the model matrices.

(gs *gls.GLS, rinfo *core.RenderInfo)

Source from the content-addressed store, hash-verified

87// It is responsible to updating the current shader uniforms with
88// the model matrices.
89func (m *Mesh) RenderSetup(gs *gls.GLS, rinfo *core.RenderInfo) {
90
91 // Transfer uniform for model matrix
92 mm := m.ModelMatrix()
93 location := m.uniMm.Location(gs)
94 gs.UniformMatrix4fv(location, 1, false, &mm[0])
95
96 // Transfer uniform for model view matrix
97 mvm := m.ModelViewMatrix()
98 location = m.uniMVm.Location(gs)
99 gs.UniformMatrix4fv(location, 1, false, &mvm[0])
100
101 // Transfer uniform for model view projection matrix
102 mvpm := m.ModelViewProjectionMatrix()
103 location = m.uniMVPm.Location(gs)
104 gs.UniformMatrix4fv(location, 1, false, &mvpm[0])
105
106 // Calculates normal matrix and transfer uniform
107 var nm math32.Matrix3
108 nm.GetNormalMatrix(mvm)
109 location = m.uniNm.Location(gs)
110 gs.UniformMatrix3fv(location, 1, false, &nm[0])
111}

Callers

nothing calls this directly

Calls 7

GetNormalMatrixMethod · 0.95
ModelMatrixMethod · 0.80
LocationMethod · 0.80
ModelViewMatrixMethod · 0.80
UniformMatrix4fvMethod · 0.45
UniformMatrix3fvMethod · 0.45

Tested by

no test coverage detected