RenderSetup is called by the engine before rendering the scene
(gs *gls.GLS, rinfo *core.RenderInfo, idx int)
| 123 | |
| 124 | // RenderSetup is called by the engine before rendering the scene |
| 125 | func (l *Spot) RenderSetup(gs *gls.GLS, rinfo *core.RenderInfo, idx int) { |
| 126 | |
| 127 | // Calculates and updates light position uniform in camera coordinates |
| 128 | var pos math32.Vector3 |
| 129 | l.WorldPosition(&pos) |
| 130 | var pos4 math32.Vector4 |
| 131 | pos4.SetVector3(&pos, 1.0) |
| 132 | pos4.ApplyMatrix4(&rinfo.ViewMatrix) |
| 133 | l.udata.position.X = pos4.X |
| 134 | l.udata.position.Y = pos4.Y |
| 135 | l.udata.position.Z = pos4.Z |
| 136 | |
| 137 | // Calculates and updates light direction uniform in camera coordinates |
| 138 | var dir math32.Vector3 |
| 139 | l.WorldDirection(&dir) |
| 140 | pos4.SetVector3(&dir, 0.0) |
| 141 | pos4.ApplyMatrix4(&rinfo.ViewMatrix) |
| 142 | l.udata.direction.X = pos4.X |
| 143 | l.udata.direction.Y = pos4.Y |
| 144 | l.udata.direction.Z = pos4.Z |
| 145 | |
| 146 | // Transfer uniform data |
| 147 | const vec3count = 5 |
| 148 | location := l.uni.LocationIdx(gs, vec3count*int32(idx)) |
| 149 | gs.Uniform3fv(location, vec3count, &l.udata.color.R) |
| 150 | } |
nothing calls this directly
no test coverage detected