bigosmallm / papervision3d

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

Bug in DisplayObject3D's clone method #177

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
package {
    import org.papervision3d.view.BasicView;
    import org.papervision3d.materials.*;
    import org.papervision3d.objects.*;
    import org.papervision3d.objects.primitives.*;

    public class Main extends BasicView {
        public function Main() {
            var a:PaperPlane = new PaperPlane( new ColorMaterial( 0xFF8000,
0.5 ) );
            var b:DisplayObject3D;

            camera.zoom = 200;

            a.rotationY = 42; // first we rotate
            b = a.clone();    // then we clone

            // so b should be rotated too, right?

            scene.addChild( a );
            scene.addChild( b );

            renderer.renderScene( scene, camera, viewport ); // surprise!
        }
    }
}

What version of the product are you using? On what operating system?
SVN rev. 896

Please provide any additional information below.
clone() passes the object's transform (a Matrix3D) rather than the object
itself (a DisplayObject3D) to copyTransform, so copyTransform doesn't check
if the transform is dirty. Patch attached.

Original issue reported on code.google.com by Yonatan....@gmail.com on 18 Mar 2009 at 5:32

Attachments:

GoogleCodeExporter commented 9 years ago
This may be happening in other places as well, I'm not sure if it should update 
the
transform in those, but it seems likely:

yonatan@pinkelephant:~/src/play/pv2/git/trunk$ find . -name "*.as" | xargs grep 
-n
'copyTransform.*transform'
./as3/trunk/src/org/papervision3d/objects/DisplayObject3D.as:647:               

   object.copyTransform(this.transform);
./as3/trunk/src/org/papervision3d/core/geom/TriangleMesh3D.as:129:              

   mesh.copyTransform(this.transform);
./as3/trunk/src/org/papervision3d/core/geom/Vertices3D.as:46:                  
verts.copyTransform(this.transform);
./branches/cs4/src/org/papervision3d/objects/DisplayObject3D.as:642:            

   object.copyTransform(this.transform);
./branches/cs4/src/org/papervision3d/core/geom/TriangleMesh3D.as:147:           

   mesh.copyTransform(this.transform);
./branches/cs4/src/org/papervision3d/core/geom/Vertices3D.as:54:                

   verts.copyTransform(this.transform);

Original comment by Yonatan....@gmail.com on 18 Mar 2009 at 4:46

GoogleCodeExporter commented 9 years ago
Fixed all do3d classes to reference themselves rather than transform.

Thanks!

Original comment by azu...@gmail.com on 30 Mar 2009 at 1:29