2 Demonstrates how to create a mesh from scratch and to set color per vertex data.
6 def makePyramidMesh(mesh, side = 20.0):
14 mesh.GetFace(0).SetVerts(0, 1, 2)
15 mesh.GetFace(0).SetEdgeVisFlags(1,1,0)
16 mesh.GetFace(1).SetVerts(0, 2, 3)
17 mesh.GetFace(1).SetEdgeVisFlags(1,1,0)
18 mesh.GetFace(2).SetVerts(0, 3, 1)
19 mesh.GetFace(2).SetEdgeVisFlags(1,1,0)
20 mesh.GetFace(3).SetVerts(1, 2, 3)
21 mesh.GetFace(3).SetEdgeVisFlags(1,1,0)
22 mesh.InvalidateGeomCache()
23 mesh.InvalidateTopologyCache()
25 def outputChannel(mc, name):
32 for tv
in mc.TextureVertices:
36 for tf
in mc.TextureFaces:
39 def outputChannels(mesh):
40 outputChannel(mesh.DefaultMap,
"default")
41 outputChannel(mesh.AlphaMap,
"alpha")
42 outputChannel(mesh.ColorPerVertexMap,
"color per vertex")
43 outputChannel(mesh.ShadingMap,
"shading")
47 tri = MaxPlus.TriObject._CastFrom(geom)
53 mesh.ColorPerVertexMap.SetNumTextureVertices(2)
54 mesh.ColorPerVertexMap.SetTextureVertex(0,
MaxPlus.Point3(1, 0, 0))
55 mesh.ColorPerVertexMap.SetTextureVertex(1,
MaxPlus.Point3(0, 0, 1))
56 mesh.ColorPerVertexMap.SetTextureFace(0, 0, 0, 1)
57 mesh.ColorPerVertexMap.SetTextureFace(1, 0, 1, 1)
58 mesh.ColorPerVertexMap.SetTextureFace(2, 1, 1, 1)
59 mesh.ColorPerVertexMap.SetTextureFace(3, 0, 0, 0)
61 node.VertexColorMode =
True
63 if __name__ ==
"__main__":