RenderSetup is called by the renderer before drawing the geometry.
(gs *gls.GLS)
| 187 | |
| 188 | // RenderSetup is called by the renderer before drawing the geometry. |
| 189 | func (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 | } |
nothing calls this directly
no test coverage detected