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

Method RenderSetup

light/point.go:98–113  ·  view source on GitHub ↗

RenderSetup is called by the engine before rendering the scene

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

Source from the content-addressed store, hash-verified

96
97// RenderSetup is called by the engine before rendering the scene
98func (lp *Point) RenderSetup(gs *gls.GLS, rinfo *core.RenderInfo, idx int) {
99
100 // Calculates light position in camera coordinates and updates uniform
101 var pos math32.Vector3
102 lp.WorldPosition(&pos)
103 pos4 := math32.Vector4{pos.X, pos.Y, pos.Z, 1.0}
104 pos4.ApplyMatrix4(&rinfo.ViewMatrix)
105 lp.udata.position.X = pos4.X
106 lp.udata.position.Y = pos4.Y
107 lp.udata.position.Z = pos4.Z
108
109 // Transfer uniform data
110 const vec3count = 3
111 location := lp.uni.LocationIdx(gs, vec3count*int32(idx))
112 gs.Uniform3fv(location, vec3count, &lp.udata.color.R)
113}

Callers

nothing calls this directly

Calls 4

ApplyMatrix4Method · 0.95
WorldPositionMethod · 0.80
LocationIdxMethod · 0.80
Uniform3fvMethod · 0.45

Tested by

no test coverage detected