Init initializes the Mesh and its uniforms.
(igeom geometry.IGeometry, imat material.IMaterial)
| 33 | |
| 34 | // Init initializes the Mesh and its uniforms. |
| 35 | func (m *Mesh) Init(igeom geometry.IGeometry, imat material.IMaterial) { |
| 36 | |
| 37 | m.Graphic.Init(m, igeom, gls.TRIANGLES) |
| 38 | |
| 39 | // Initialize uniforms |
| 40 | m.uniMm.Init("ModelMatrix") |
| 41 | m.uniMVm.Init("ModelViewMatrix") |
| 42 | m.uniMVPm.Init("MVP") |
| 43 | m.uniNm.Init("NormalMatrix") |
| 44 | |
| 45 | // Adds single material if not nil |
| 46 | if imat != nil { |
| 47 | m.AddMaterial(imat, 0, 0) |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | // SetMaterial clears all materials and adds the specified material for all vertices. |
| 52 | func (m *Mesh) SetMaterial(imat material.IMaterial) { |
no test coverage detected