RenderSetup is called by the engine before rendering the scene
(gs *gls.GLS, rinfo *core.RenderInfo, idx int)
| 66 | |
| 67 | // RenderSetup is called by the engine before rendering the scene |
| 68 | func (ld *Directional) RenderSetup(gs *gls.GLS, rinfo *core.RenderInfo, idx int) { |
| 69 | |
| 70 | // Calculates light position in camera coordinates and updates uniform |
| 71 | var pos math32.Vector3 |
| 72 | ld.WorldPosition(&pos) |
| 73 | pos4 := math32.Vector4{pos.X, pos.Y, pos.Z, 0.0} |
| 74 | pos4.ApplyMatrix4(&rinfo.ViewMatrix) |
| 75 | ld.udata.position.X = pos4.X |
| 76 | ld.udata.position.Y = pos4.Y |
| 77 | ld.udata.position.Z = pos4.Z |
| 78 | |
| 79 | // Transfer uniform data |
| 80 | const vec3count = 2 |
| 81 | location := ld.uni.LocationIdx(gs, vec3count*int32(idx)) |
| 82 | gs.Uniform3fv(location, vec3count, &ld.udata.color.R) |
| 83 | } |
nothing calls this directly
no test coverage detected