AddPolygon wrong number of normals
murray_b wrote at 2012-01-30 05:07:
Hi
I am trying to display a mesh created from a polygon.
But when I run the toMesh I am getting the message "Wrong number of normals" And I am not sure what that message is referring to.
List<Point3D> vrt = new List<Point3D>(); // Create a list of Points for (int i = 0; i < set.Count(); i++) { vrt.Add( new Point3D ( (double)set[i].X, (double)set[i].Y, (double)set[i].Z )); } var surface = new MeshBuilder(); surface.AddPolygon(vrt); var mesh = surface.ToMesh();
Any help will be greatly appreciated. I am very new to WPF 3D and am finding the learning curve quite steep.
Thanks a lot
Murray
objo wrote at 2012-01-30 08:41:
hi Murray,
I see this can be a bit confusing, it should be improved..
The parameterless MeshBuilder constructor will create a mesh with both normals and texture coordinates. The AddPolygon will currently only add vertices, not normals and texture coordinates.
I think changing the constructor to
new MeshBuilder(false,false)
should work.
I think there are two possible improvements here
a. Let AddPolygon calculate normals and texture coordinates if this is requested
b. Remove the parameterless constructor of MeshBuilder - so you _have to_ specify if normals/texture coordinates should be generated
murray_b wrote at 2012-01-31 09:07:
Thanks for the quick reply Objo
That fixed the error I was getting.
Great work!
murray_b wrote at 2012-01-31 09:34:
Objo
When the meshbuilder now creates the mesh I can only see it from one side.
How do I get the meshbuilder to generate a mesh that I can rotate around and see from both sides?
Regards
Murray
objo wrote at 2012-01-31 10:01:
Remember to set the BackMaterial, it can be the same as the (front) Material.
Customer support service by UserEcho