protected static Mesh CreateFromPrimitive(ParserContext context, BasicPrimitiveTessellator tessellator, Point3D center) { tessellator.Tessellate(); Mesh mesh = new Mesh(); mesh.Positions.AddRange(tessellator.Positions); mesh.Indices.AddRange(tessellator.Indices); mesh.Normals.AddRange(tessellator.Normals); mesh.Material = context.CurrentMaterial; mesh.Transform = new TranslateTransform { OffsetX = center.X, OffsetY = center.Y, OffsetZ = center.Z }; return mesh; }
private static Scene CreateFromPrimitive(BasicPrimitiveTessellator tessellator) { tessellator.Tessellate(); Material material = new Material(); material.Name = "Default"; material.DiffuseColor = ColorsRgbF.Blue; material.SpecularColor = ColorsRgbF.White; Mesh mesh = new Mesh(); mesh.Positions.AddRange(tessellator.Positions); mesh.Indices.AddRange(tessellator.Indices); mesh.Normals.AddRange(tessellator.Normals); mesh.Material = material; Scene scene = new Scene { FileName = "[New Sphere]" }; scene.Materials.Add(material); scene.Meshes.Add(mesh); return scene; }