소스 검색

improved mesh API

Daniel Salvadori 7 년 전
부모
커밋
185beb174e
1개의 변경된 파일7개의 추가작업 그리고 0개의 파일을 삭제
  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) {