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)
| 87 | // It is responsible to updating the current shader uniforms with |
| 88 | // the model matrices. |
| 89 | func (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 | } |
nothing calls this directly
no test coverage detected