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

Method RenderSetup

geometry/morph.go:189–212  ·  view source on GitHub ↗

RenderSetup is called by the renderer before drawing the geometry.

(gs *gls.GLS)

Source from the content-addressed store, hash-verified

187
188// RenderSetup is called by the renderer before drawing the geometry.
189func (mg *MorphGeometry) RenderSetup(gs *gls.GLS) {
190
191 mg.baseGeometry.RenderSetup(gs)
192
193 // Sort weights and find top 8 morph targets with largest current weight (8 is the max sent to shader)
194 activeMorphTargets, activeWeights := mg.ActiveMorphTargets()
195
196 // If the morph geometry has more targets than the shader supports we need to update attribute names
197 // as weights change - we only send the top morph targets with highest weights
198 if len(mg.targets) > MaxActiveMorphTargets {
199 mg.UpdateTargetAttributes(activeMorphTargets)
200 }
201
202 // Transfer morphed geometry VBOs
203 for _, mt := range activeMorphTargets {
204 for _, vbo := range mt.VBOs() {
205 vbo.Transfer(gs)
206 }
207 }
208
209 // Transfer active weights uniform
210 location := mg.uniWeights.Location(gs)
211 gs.Uniform1fv(location, int32(len(activeWeights)), &activeWeights[0])
212}

Callers

nothing calls this directly

Calls 7

ActiveMorphTargetsMethod · 0.95
VBOsMethod · 0.80
TransferMethod · 0.80
LocationMethod · 0.80
RenderSetupMethod · 0.65
Uniform1fvMethod · 0.45

Tested by

no test coverage detected