RenderSetup is called by the engine before drawing the skybox geometry It is responsible to updating the current shader uniforms with the model matrices.
(gs *gls.GLS, rinfo *core.RenderInfo)
| 70 | // It is responsible to updating the current shader uniforms with |
| 71 | // the model matrices. |
| 72 | func (skybox *Skybox) RenderSetup(gs *gls.GLS, rinfo *core.RenderInfo) { |
| 73 | |
| 74 | mvm := *skybox.ModelViewMatrix() |
| 75 | |
| 76 | // Clear translation |
| 77 | mvm[12] = 0 |
| 78 | mvm[13] = 0 |
| 79 | mvm[14] = 0 |
| 80 | // mvm.ExtractRotation(&rinfo.ViewMatrix) // TODO <- ExtractRotation does not work as expected? |
| 81 | |
| 82 | // Transfer mvp uniform |
| 83 | location := skybox.uniMVm.Location(gs) |
| 84 | gs.UniformMatrix4fv(location, 1, false, &mvm[0]) |
| 85 | |
| 86 | // Calculates model view projection matrix and updates uniform |
| 87 | var mvpm math32.Matrix4 |
| 88 | mvpm.MultiplyMatrices(&rinfo.ProjMatrix, &mvm) |
| 89 | location = skybox.uniMVPm.Location(gs) |
| 90 | gs.UniformMatrix4fv(location, 1, false, &mvpm[0]) |
| 91 | |
| 92 | // Calculates normal matrix and updates uniform |
| 93 | var nm math32.Matrix3 |
| 94 | nm.GetNormalMatrix(&mvm) |
| 95 | location = skybox.uniNm.Location(gs) |
| 96 | gs.UniformMatrix3fv(location, 1, false, &nm[0]) |
| 97 | } |
nothing calls this directly
no test coverage detected