//**********************************************************************************************
//              (C) Copyright 2002 by Dipl. Phys. Joerg Plewe, HARDCODE Development
//              All rights reserved. Copying, modification,
//              distribution or publication without the prior written
//              consent of the author is prohibited.
//
//      Created on 30. März 2002, 18:52
//**********************************************************************************************
package de.hardcode.threed.objects;

import javax.media.j3d.BranchGroup;
import javax.media.j3d.TransformGroup;
import javax.media.j3d.Node;

/**
 * A group representing an object movable in space. 
 * In spite of a simple TransfoormGroup, I am a BranchGroup so that I am 
 * allowed to be added and removed from life scenegraphs.
 *
 * @author  Herkules
 */
public class ObjectGroup extends BranchGroup
{
        private final TransformGroup mTransformGroup = new TransformGroup();
        
        /**
         * Creates a new instance of ObjectGroup.
         */
        public ObjectGroup( Node obj )
        {
                this.setCapability( BranchGroup.ALLOW_DETACH );
                mTransformGroup.addChild( obj );
                mTransformGroup.setCapability( TransformGroup.ALLOW_TRANSFORM_READ );
                mTransformGroup.setCapability( TransformGroup.ALLOW_TRANSFORM_WRITE );
                this.addChild( mTransformGroup );
                this.compile();
        }
        
        
        /**
         * Retrieve the transform part of this object.
         */
        public TransformGroup getTransformGroup()
        {
                return mTransformGroup;
        }
}
