MCPcopy Index your code
hub / github.com/g3n/engine / RenderSetup

Method RenderSetup

gui/panel.go:844–866  ·  view source on GitHub ↗

RenderSetup is called by the Engine before drawing the object

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

Source from the content-addressed store, hash-verified

842
843// RenderSetup is called by the Engine before drawing the object
844func (p *Panel) RenderSetup(gl *gls.GLS, rinfo *core.RenderInfo) {
845
846 // Sets texture valid flag in uniforms
847 // depending if the material has texture
848 if p.mat.TextureCount() > 0 {
849 p.udata.textureValid = 1
850 } else {
851 p.udata.textureValid = 0
852 }
853
854 // Sets model matrix
855 var mm math32.Matrix4
856 p.SetModelMatrix(gl, &mm)
857
858 // Transfer model matrix uniform
859 location := p.uniMatrix.Location(gl)
860 gl.UniformMatrix4fv(location, 1, false, &mm[0])
861
862 // Transfer panel parameters combined uniform
863 location = p.uniPanel.Location(gl)
864 const vec4count = 8
865 gl.Uniform4fv(location, vec4count, &p.udata.bounds.X)
866}
867
868// SetModelMatrix calculates and sets the specified matrix with the model matrix for this panel
869func (p *Panel) SetModelMatrix(gl *gls.GLS, mm *math32.Matrix4) {

Callers

nothing calls this directly

Calls 5

SetModelMatrixMethod · 0.95
TextureCountMethod · 0.80
LocationMethod · 0.80
UniformMatrix4fvMethod · 0.45
Uniform4fvMethod · 0.45

Tested by

no test coverage detected