View Javadoc
1   /*
2    * Created on 2004-12-11
3    *
4    * TODO To change the template for this generated file go to
5    * Window - Preferences - Java - Code Style - Code Templates
6    */
7   package org.sourceforge.jvb3d.Model;
8   
9   import java.io.Externalizable;
10  import java.io.IOException;
11  import java.io.ObjectInput;
12  import java.io.ObjectOutput;
13  
14  
15  import javax.media.j3d.*;
16  import javax.vecmath.Color3f;
17  
18  import com.sun.j3d.utils.geometry.*;
19  /***
20   * @author spootnick
21   *
22   * Klasa bazowa dla wszystkich klas reprezentujących obiekty dynamiczne
23   */
24  public abstract class DynamicObject extends BranchGroup implements Externalizable, IMakesTurn{
25  
26  	protected Transform3D transform=new Transform3D(); 
27  	protected TransformGroup transformGroup=new TransformGroup(); 
28  	protected Node appearance;
29  	protected long baseTtl=1000000000;
30  	protected long ttl=baseTtl;
31  	/***
32  	 * Określa czy dany obiekt znajduje się na serwerze
33  	 */
34  	public boolean isServer = true;
35  	protected BranchGroup staticWorld; 
36  	
37  	/***
38  	 * Ustawia referencję do świata, w którym danyc obiekt się znajduje
39  	 * @param world
40  	 */
41  	public void setWorld(BranchGroup world){
42  		staticWorld=world;
43  	}
44  	
45  	/***
46  	 * Zwraca informację czy obiekt jest żywy
47  	 * @return czy obiekt żyje
48  	 */
49  	public boolean isAlive(){
50  		return ttl>0 || isServer;
51  	}
52  	
53  	/***
54  	 *Zwraca aktualną transformację obiektu 
55  	 */
56  	public Transform3D getTransform(){
57  		return this.transform;
58  	}
59  	
60  	/***
61  	 * Ustawia transformację 
62  	 */
63  	public synchronized void setTransform(Transform3D transform){
64  		this.transform=transform;
65  	}
66  	public DynamicObject(){
67  		
68  	}
69  	
70  	/***
71  	 * @see org.sourceforge.jvb3d.Model.IMakesTurn#nextTurn(long)
72  	 */
73  	public synchronized void nextTurn(long time){
74  		
75  	}
76  	/***
77  	 * @see java.io.Externalizable#writeExternal(java.io.ObjectOutput)
78  	 */
79  	public synchronized void writeExternal(ObjectOutput arg0) throws IOException {
80  		// TODO Auto-generated method stub
81  
82  	}
83  
84  	/***
85  	 * @see java.io.Externalizable#readExternal(java.io.ObjectInput)
86  	 */
87  	public synchronized void readExternal(ObjectInput arg0) throws IOException,
88  			ClassNotFoundException {
89  		// TODO Auto-generated method stub
90  
91  	}
92  
93  }