001         package com.croftsoft.core.media.j3d;
002    
003         import java.io.Serializable;
004    
005         import javax.media.j3d.Transform3D;
006    
007         import com.croftsoft.core.util.state.State;
008         import com.croftsoft.core.util.state.StateLib;
009    
010         /*********************************************************************
011         *
012         * A State object that carries Transform3D data.
013         *
014         * @author
015         *   <a href="https://www.croftsoft.com/">David Wallace Croft</a>
016         * @version
017         *   1999-02-06
018         *********************************************************************/
019    
020         public class  Transform3DState implements State, Serializable
021         //////////////////////////////////////////////////////////////////////
022         //////////////////////////////////////////////////////////////////////
023         {
024    
025         private static final long  serialVersionUID = 1L;
026    
027         private Object      key;
028         private double [ ]  transform;
029    
030         //////////////////////////////////////////////////////////////////////
031         //////////////////////////////////////////////////////////////////////
032    
033         public  Transform3DState (
034           Object       key,
035           Transform3D  transform3D )
036         //////////////////////////////////////////////////////////////////////
037         {
038           this.key = key;
039           transform = new double [ 16 ];
040           transform3D.get ( transform );
041         }
042    
043         //////////////////////////////////////////////////////////////////////
044         //////////////////////////////////////////////////////////////////////
045    
046         public Object  getKey ( ) { return key; }
047    
048         public void  getTransform3D ( Transform3D  transform3D )
049         //////////////////////////////////////////////////////////////////////
050         {
051           transform3D.set ( transform );
052         }
053    
054         //////////////////////////////////////////////////////////////////////
055         //////////////////////////////////////////////////////////////////////
056    
057         /*********************************************************************
058         * Returns true if the classes and State keys are equal.
059         *********************************************************************/
060         public boolean  equals ( Object  other )
061         //////////////////////////////////////////////////////////////////////
062         {
063           return StateLib.equals ( this, other );
064         }
065    
066         /*********************************************************************
067         * Returns the hash code of the State key.
068         *********************************************************************/
069         public int  hashCode ( )
070         //////////////////////////////////////////////////////////////////////
071         {
072           return StateLib.hashCode ( this );
073         }
074    
075         //////////////////////////////////////////////////////////////////////
076         //////////////////////////////////////////////////////////////////////
077         }