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

Method RenderSetup

graphic/rigged_mesh.go:52–70  ·  view source on GitHub ↗

RenderSetup is called by the renderer before drawing the geometry.

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

Source from the content-addressed store, hash-verified

50
51// RenderSetup is called by the renderer before drawing the geometry.
52func (rm *RiggedMesh) RenderSetup(gs *gls.GLS, rinfo *core.RenderInfo) {
53
54 // Call base mesh's RenderSetup
55 rm.Mesh.RenderSetup(gs, rinfo)
56
57 // Get inverse matrix world
58 var invMat math32.Matrix4
59 node := rm.GetNode()
60 nMW := node.MatrixWorld()
61 err := invMat.GetInverse(&nMW)
62 if err != nil {
63 log.Error("Skeleton.BoneMatrices: inverting matrix failed!")
64 }
65
66 // Transfer bone matrices
67 boneMatrices := rm.skeleton.BoneMatrices(&invMat)
68 location := rm.mBones.Location(gs)
69 gs.UniformMatrix4fv(location, int32(len(boneMatrices)), false, &boneMatrices[0][0])
70}

Callers

nothing calls this directly

Calls 8

GetInverseMethod · 0.95
MatrixWorldMethod · 0.80
ErrorMethod · 0.80
BoneMatricesMethod · 0.80
LocationMethod · 0.80
RenderSetupMethod · 0.65
GetNodeMethod · 0.65
UniformMatrix4fvMethod · 0.45

Tested by

no test coverage detected