MCPcopy Create free account
hub / github.com/g3n/engine / RenderSetup

Method RenderSetup

light/directional.go:68–83  ·  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

66
67// RenderSetup is called by the engine before rendering the scene
68func (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}

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