Cloning geometry from one node to another

shoei321shoei321 Posts: 112

I have a custom node that I want to add geometry to programatically.    I have another node in the scene that I want to copy geometry from (this node was imported from an OBJ).    I've tried this :

 

        DzObject* o = geomNode->getObject();
        DzObject* no = new DzObject();

        DzFacetShape* fs = (DzFacetShape*) o->getCurrentShape();
        DzFacetShape* newFs = new DzFacetShape();

        DzFacetMesh* mesh = (DzFacetMesh*) fs->getGeometry();
        DzFacetMesh* newMesh = new DzFacetMesh();
        newMesh->copyFrom(mesh, true, true);

        newFs->setFacetMesh(newMesh);
        newFs->copyFrom(fs);

        no->addShape(newFs);
        no->copyFrom(o);
        this->setObject(no);

 

The bounding box for the new custom node grows but the new geometry doesn't show up.    Can someone tell me how this is best done?

 

Thanks

 

Post edited by shoei321 on

Comments

  • rbtwhizrbtwhiz Posts: 1,830

    Do you want to change ownership of the geometry from a donor (i.e., the imported OBJ) or do you want an actual copy of the geometry?

    -Rob

  • shoei321shoei321 Posts: 112

    Hey Rob, ideally I'd like to copy the geometry from another node, including materials/surfaces/etc if possible.  

     

    Thanks

     

Sign In or Register to comment.