Ver código fonte

improved mesh API

Daniel Salvadori 7 anos atrás
pai
commit
185beb174e
1 arquivos alterados com 7 adições e 0 exclusões
  1. 7 0
      graphic/mesh.go

+ 7 - 0
graphic/mesh.go

@@ -48,6 +48,13 @@ func (m *Mesh) Init(igeom geometry.IGeometry, imat material.IMaterial) {
 	}
 }
 
+// SetMaterial clears all materials and adds the specified material for all vertices.
+func (m *Mesh) SetMaterial(imat material.IMaterial) {
+
+	m.Graphic.ClearMaterials()
+	m.Graphic.AddMaterial(m, imat, 0, 0)
+}
+
 // AddMaterial adds a material for the specified subset of vertices.
 func (m *Mesh) AddMaterial(imat material.IMaterial, start, count int) {