google-code-export / papervision3d

Automatically exported from code.google.com/p/papervision3d
1 stars 1 forks source link

MeshUtil.cutTriangleMesh does not preserve triangle materials #129

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. create a Cube with different materials like
var paper:Cube = new Cube(new MaterialsList({front:new
ColorMaterial(0xFF0000), back:new ColorMaterial(0x00FF00)}), 800, 0, 800,
2, 2, 1, Cube.NONE, Cube.ALL-Cube.FRONT-Cube.BACK);

2. cut it somewhere
var meshes:Array = MeshUtil.cutTriangleMesh(paper, cutPlane);

3. display the resulting meshes

What is the expected output? What do you see instead?
I would expect the two sides of the parts still being colored according to
the original materials, but I do see wire frames instead

What version of the product are you using? On what operating system?
trunk/as3/trunk 758 on Windows XP

Please provide any additional information below.
It can be fixed in MeshUtil by creating the new Meshes first and adding
vertices and triangles afterwards:

if(geom.faces.length){
var meshA:TriangleMesh3D = new TriangleMesh3D(mesh.material, new Array(),
new Array());
var meshB:TriangleMesh3D = new TriangleMesh3D(mesh.material, new Array(),
new Array());
var triangleBucketA:Array = meshA.geometry.faces;
var triangleBucketB:Array = meshB.geometry.faces;
var vertBucketA:Array= meshA.geometry.vertices;
var vertBucketB:Array = meshB.geometry.vertices;
...

Original issue reported on code.google.com by benno.st...@gmail.com on 12 Nov 2008 at 3:22

GoogleCodeExporter commented 9 years ago
Although I couldn't reproduce, I've added a fix for any possible issues. Thank 
you
for reporting.

Original comment by r.hauw...@gmail.com on 17 Nov 2008 at 1:32