build-server.xml
jme.jnlp
properties.cfg
+ftp
<delete dir="${doc}" />
<delete>
<fileset dir="${src}" includes="**/*.class" />
+ <fileset dir="${release}" includes="jme*.jar"/>
+ <fileset dir="${webstart}" includes="*.jar"/>
</delete>
</target>
<ftp server="ftp.jmonkeyengine.com" userid="${ftpuser}" password="${ftppassword}" remotedir="nightly" >
<fileset dir="${webstart}" >
<include name="*.jar"/>
+ <include name="*.jnlp"/>
</fileset>
<fileset dir="${libs}" >
<include name="*.jar"/>
* of a main game loop. Interpolation is used between frames for varying framerates.
*
* @author Joshua Slack, (javadoc by cep21)
- * @version $Id: SimpleGame.java,v 1.37 2005-09-15 17:14:25 renanse Exp $
+ * @version $Id: SimpleGame.java,v 1.38 2005-09-20 09:47:17 irrisor Exp $
*/
public abstract class SimpleGame extends BaseGame {
simpleUpdate();
/** Update controllers/render states/transforms/bounds for rootNode. */
-rootNode.updateGeometricState(tpf, true);
+ rootNode.updateGeometricState(tpf, true);
}
*
* @author Per Thulin
*/
-public class StandardGameState extends BasicGameState {
+public class StandardGameState extends StandardGameStateDefaultCamera {
/** The camera of this game state. */
protected Camera cam;
super(name);
initCamera();
- initZBuffer();
-
- // Update geometric and rendering information for the rootNode.
- rootNode.updateGeometricState(0.0f, true);
- rootNode.updateRenderState();
- }
-
- /**
- * Creates a ZBuffer to display pixels closer to the camera above
- * farther ones.
- */
- protected void initZBuffer() {
- ZBufferState buf = DisplaySystem.getDisplaySystem().
- getRenderer().createZBufferState();
- buf.setEnabled(true);
- buf.setFunction(ZBufferState.CF_LEQUAL);
- rootNode.setRenderState(buf);
- }
-
- /**
- * Overwritten to appropriately call switchTo() or switchFrom().
- *
- * @see GameState#setActive(boolean)
- */
- public void setActive(boolean active) {
- if (active) onActivate();
- else onDeactivate();
- super.setActive(active);
- }
-
- /**
- * Calls stateUpdate(float), then updates the geometric state of the
- * rootNode.
- *
- * @param tpf The elapsed time since last frame.
- * @see GameState#update(float)
- * @see StandardGameState#stateUpdate(float)
- */
- public final void update(float tpf) {
- stateUpdate(tpf);
- super.update(tpf);
- }
-
- /**
- * Calls stateRender(float), then renders the rootNode.
- *
- * @param tpf The elapsed time since last frame.
- * @see GameState#render(float)
- * @see StandardGameState#stateRender(float)
- */
- public final void render(float tpf) {
- stateRender(tpf);
- super.render(tpf);
- }
-
- /**
- * This is where derived classes are supposed to put their game logic.
- * Gets called between the input.update and
- * rootNode.updateGeometricState calls.
- *
- * <p>
- * Much like the structure of <code>SimpleGame</code>.
- * </p>
- *
- * @param tpf The time since the last frame.
- */
- protected void stateUpdate(float tpf) {
- }
-
- /**
- * This is where derived classes are supposed to put their render logic.
- * Gets called before the rootNode gets rendered.
- *
- * <p>
- * Much like the structure of <code>SimpleGame</code>.
- * </p>
- *
- * @param tpf The time since the last frame.
- */
- protected void stateRender(float tpf) {
}
-
- /**
+
+ /**
* Points the renderers camera to the one contained by this state. Derived
* classes can put special actions they want to perform when activated here.
*/
protected void onActivate() {
DisplaySystem.getDisplaySystem().getRenderer().setCamera(cam);
}
-
- /**
- * Derived classes can put special actions they want to perform when
- * deactivated here.
- */
- protected void onDeactivate() {
- }
-
- /**
+
+ /**
* Gets the camera of this state.
*
* @return The camera of this state.
--- /dev/null
+package com.jme.app;
+
+import com.jme.scene.state.ZBufferState;
+import com.jme.scene.Node;
+import com.jme.system.DisplaySystem;
+
+/**
+ * @author christian.schneider@uni-kassel.de
+ * @created 18.06.2005, 15:58:36
+ */
+public abstract class StandardGameStateDefaultCamera extends BasicGameState {
+ public StandardGameStateDefaultCamera( String name ) {
+ super( name );
+
+ initZBuffer();
+
+ // Update geometric and rendering information for the rootNode.
+ rootNode.updateGeometricState(0.0f, true);
+ rootNode.updateRenderState();
+ }
+
+ public Node getRootNode()
+ {
+ return rootNode;
+ }
+
+ /**
+ * Creates a ZBuffer to display pixels closer to the camera above
+ * farther ones.
+ */
+ protected void initZBuffer() {
+ ZBufferState buf = DisplaySystem.getDisplaySystem().
+ getRenderer().createZBufferState();
+ buf.setEnabled(true);
+ buf.setFunction(ZBufferState.CF_LEQUAL);
+ rootNode.setRenderState(buf);
+ }
+
+ /**
+ * Overwritten to appropriately call switchTo() or switchFrom().
+ *
+ * @see GameState#setActive(boolean)
+ */
+ public void setActive(boolean active) {
+ if (active) onActivate();
+ else onDeactivate();
+ super.setActive(active);
+ }
+
+ /**
+ * Calls stateUpdate(float), then updates the geometric state of the
+ * rootNode.
+ *
+ * @param tpf The elapsed time since last frame.
+ * @see GameState#update(float)
+ * @see StandardGameState#stateUpdate(float)
+ */
+ public final void update(float tpf) {
+ stateUpdate(tpf);
+ super.update(tpf);
+ }
+
+ /**
+ * Calls stateRender(float), then renders the rootNode.
+ *
+ * @param tpf The elapsed time since last frame.
+ * @see GameState#render(float)
+ * @see StandardGameState#stateRender(float)
+ */
+ public final void render(float tpf) {
+ stateRender(tpf);
+ super.render(tpf);
+ }
+
+ /**
+ * This is where derived classes are supposed to put their game logic.
+ * Gets called between the input.update and
+ * rootNode.updateGeometricState calls.
+ *
+ * <p>
+ * Much like the structure of <code>SimpleGame</code>.
+ * </p>
+ *
+ * @param tpf The time since the last frame.
+ */
+ protected void stateUpdate(float tpf) {
+ }
+
+ /**
+ * This is where derived classes are supposed to put their render logic.
+ * Gets called before the rootNode gets rendered.
+ *
+ * <p>
+ * Much like the structure of <code>SimpleGame</code>.
+ * </p>
+ *
+ * @param tpf The time since the last frame.
+ */
+ protected void stateRender(float tpf) {
+ }
+
+ /**
+ * Points the renderers camera to the one contained by this state. Derived
+ * classes can put special actions they want to perform when activated here.
+ */
+ protected abstract void onActivate();
+
+ /**
+ * Derived classes can put special actions they want to perform when
+ * deactivated here.
+ */
+ protected void onDeactivate() {
+ }
+}
* <code>computeFramePoint</code> in turn calls <code>containAABB</code>.
*
* @author Mark Powell
- * @version $Id: BoundingSphere.java,v 1.29 2005-09-15 23:01:27 Mojomonkey Exp $
+ * @version $Id: BoundingSphere.java,v 1.30 2005-09-20 09:47:18 irrisor Exp $
*/
public class BoundingSphere extends Sphere implements BoundingVolume {
* the center of the sphere.
*/
public BoundingSphere(float radius, Vector3f center) {
- super("bsphere", center, 10, 10, radius);
- initCheckPlanes();
+ this("bsphere", radius, center);
}
/**
* the center of the sphere.
*/
public BoundingSphere(String name, float radius, Vector3f center) {
- super(name, center, 10, 10, radius);
+ super( name, center, 10, 10, radius );
initCheckPlanes();
}
* @see #calcWelzl(com.jme.math.Vector3f[])
*/
private void setSphere(Vector3f O, Vector3f A, Vector3f B) {
+ //todo: don't create vectors here!
Vector3f a = A.subtract(O);
Vector3f b = B.subtract(O);
Vector3f acrossB = a.cross(b);
return bv.intersectsSphere(this);
}
+ private static Vector3f tmp_intersectsSphere = new Vector3f();
+
/*
- * (non-Javadoc)
- *
- * @see com.jme.bounding.BoundingVolume#intersectsSphere(com.jme.bounding.BoundingSphere)
- */
+ * (non-Javadoc)
+ *
+ * @see com.jme.bounding.BoundingVolume#intersectsSphere(com.jme.bounding.BoundingSphere)
+ */
public boolean intersectsSphere(BoundingSphere bs) {
- Vector3f diff = getCenter().subtract(bs.getCenter());
+ //note: as a field is used this is not thread safe!
+ Vector3f diff = tmp_intersectsSphere.set(getCenter()).subtractLocal(bs.getCenter());
float rsum = getRadius() + bs.getRadius();
return (diff.dot(diff) <= rsum * rsum);
}
*
* @author Mark Powell
* @author Joshua Slack
- * @version $Id: BillboardNode.java,v 1.20 2005-09-15 17:13:38 renanse Exp $
+ * @version $Id: BillboardNode.java,v 1.21 2005-09-20 09:47:18 irrisor Exp $
*/
public class BillboardNode extends Node {
private static final long serialVersionUID = 1L;
break;
}
- for (int i = 0, cSize = children.size(); i < cSize; i++) {
- Spatial child = (Spatial) children.get(i);
+ for (int i = 0, cSize = getChildren().size(); i < cSize; i++) {
+ Spatial child = (Spatial) getChildren().get(i);
if (child != null) {
child.updateGeometricState(lastTime, false);
}
*
* @author Mark Powell
* @author Joshua Slack
- * @version $Id: Spatial.java,v 1.70 2005-09-16 19:33:40 Mojomonkey Exp $
+ * @version $Id: Spatial.java,v 1.71 2005-09-20 09:47:18 irrisor Exp $
*/
public abstract class Spatial implements Serializable {
}
/**
+ * Called by {@link Node#attachChild(Spatial)} and {@link Node#detachChild(Spatial)} - don't call directly.
* <code>setParent</code> sets the parent of this node.
*
* @param parent
* the parent of this node.
*/
- public void setParent(Node parent) {
+ protected void setParent(Node parent) {
this.parent = parent;
}
* Only FlareQuad objects are acceptable as children.
*
* @author Joshua Slack
- * @version $Id: LensFlare.java,v 1.5 2005-09-16 21:36:16 renanse Exp $
+ * @version $Id: LensFlare.java,v 1.6 2005-09-20 09:47:19 irrisor Exp $
*/
public class LensFlare extends Node {
}
}
- for (int x = children.size(); --x >= 0;) {
+ for (int x = getQuantity(); --x >= 0;) {
FlareQuad fq = (FlareQuad) getChild(x);
fq.setLocalScale(scale);
fq.updatePosition(flarePoint, midPoint);
generateSource();
}
- public Sample3D(URL url){
- LoggingSystem.getLogger().log(Level.INFO,"Load file:"+url.getFile());
+ public Sample3D(URL url){
+ LoggingSystem.getLogger().log(Level.INFO,"Load file:"+url);
buffer=SampleLoader.loadBuffer(url);
generateSource();
}
* It is recommended that different combinations are tried.
*
* @author Mark Powell
- * @version $Id: TerrainPage.java,v 1.3 2005-09-16 19:33:42 Mojomonkey Exp $
+ * @version $Id: TerrainPage.java,v 1.4 2005-09-20 09:47:20 irrisor Exp $
*/
public class TerrainPage extends Node {
}
public void fixNormals() {
- Iterator it = children.iterator();
+ Iterator it = getChildren().iterator();
while (it.hasNext()) {
Object child = it.next();
if (child instanceof TerrainPage) {
TestChooser chooser = new TestChooser();
final Vector classes = new Vector();
+ System.out.println( "Composing Test list..." );
Sys.class.getName(); //to check loading lwjgl library
//put some featured tests at the beginning
import com.jme.scene.state.MaterialState;
import com.jme.scene.state.TextureState;
import com.jme.util.TextureManager;
-import com.jmex.sound.fmod.SoundSystem;
+import com.jmex.sound.openAL.SoundSystem;
/**
snode = SoundSystem.createSoundNode();
/** Create program sound */
- targetSound = SoundSystem.create3DSample("D:/eclipse/workspace/JMonkeyEngine/src/jmetest/data/sound/explosion.wav");
- laserSound=SoundSystem.create3DSample("D:/eclipse/workspace/JMonkeyEngine/src/jmetest/data/sound/laser.ogg");
+ targetSound = SoundSystem.create3DSample( getClass().getResource( "/jmetest/data/sound/explosion.wav" ) );
+ laserSound = SoundSystem.create3DSample( getClass().getResource( "/jmetest/data/sound/laser.ogg" ) );
SoundSystem.setSampleMaxAudibleDistance(targetSound, 1000);
SoundSystem.setSampleMaxAudibleDistance(laserSound, 1000);
// Then we bind the programid we received to our laser event id.
import com.jme.input.action.KeyExitAction;
import com.jme.math.Matrix3f;
import com.jme.math.Vector3f;
-import com.jme.scene.CameraNode;
-import com.jme.scene.Controller;
-import com.jme.scene.Node;
-import com.jme.scene.TriMesh;
+import com.jme.scene.*;
import com.jme.scene.lod.AreaClodMesh;
import com.jme.scene.state.RenderState;
+import com.jme.util.LoggingSystem;
import com.jmex.model.XMLparser.JmeBinaryReader;
import com.jmex.model.XMLparser.Converters.FormatConverter;
import com.jmex.model.XMLparser.Converters.ObjToJme;
Node clodNode=new Node("Clod node");
// For each mesh in maggie
for (int i=0;i<meshParent.getQuantity();i++){
- // Create an AreaClodMesh for that mesh. Let it compute records automatically
- AreaClodMesh acm=new AreaClodMesh("part"+i,(TriMesh) meshParent.getChild(i),null);
- acm.setModelBound(new BoundingSphere());
- acm.updateModelBound();
-
- // Allow 1/2 of a triangle in every pixel on the screen in the bounds.
- acm.setTrisPerPixel(.5f);
-
- // Force a move of 2 units before updating the mesh geometry
- acm.setDistanceTolerance(2);
-
- // Give the clodMesh node the material state that the original had.
- acm.setRenderState(meshParent.getChild(i).getRenderStateList()[RenderState.RS_MATERIAL]);
-
- // Attach clod node.
- clodNode.attachChild(acm);
+ final Spatial child = meshParent.getChild(i);
+ if ( child instanceof Node )
+ {
+ clodNode.attachChild( getClodNodeFromParent( (Node) child ) );
+ }
+ else if ( child instanceof TriMesh )
+ {
+ // Create an AreaClodMesh for that mesh. Let it compute records automatically
+ AreaClodMesh acm=new AreaClodMesh("part"+i,(TriMesh) child,null);
+ acm.setModelBound(new BoundingSphere());
+ acm.updateModelBound();
+
+ // Allow 1/2 of a triangle in every pixel on the screen in the bounds.
+ acm.setTrisPerPixel(.5f);
+
+ // Force a move of 2 units before updating the mesh geometry
+ acm.setDistanceTolerance(2);
+
+ // Give the clodMesh node the material state that the original had.
+ acm.setRenderState(child.getRenderStateList()[RenderState.RS_MATERIAL]);
+
+ // Attach clod node.
+ clodNode.attachChild(acm);
+ }
+ else
+ {
+ LoggingSystem.getLogger().warning( "Unhandled Spatial type: " + child.getClass() );
+ }
}
return clodNode;
}
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * * Neither the name of 'jMonkeyEngine' nor the names of its contributors
- * may be used to endorse or promote products derived from this software
+ * * Neither the name of 'jMonkeyEngine' nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
import com.jme.light.AmbientLight;
import com.jme.math.Vector3f;
import com.jme.renderer.ColorRGBA;
-import com.jme.scene.Line;
-import com.jme.scene.Spatial;
-import com.jme.scene.Text;
+import com.jme.scene.*;
import com.jme.scene.shape.Box;
import com.jme.scene.state.LightState;
import com.jme.scene.state.MaterialState;
* Command for toggling edges.
*/
private static final String COMMAND_PATH_ONLY = "toggle_path_only";
+ private Box box;
/**
* Create a graphbrowser app that uses given {@link GraphAccessor} and {@link GraphLayouter}.
light.setEnabled( true );
light.setDiffuse( new ColorRGBA( SCENE_LIGHT, SCENE_LIGHT, SCENE_LIGHT, 1 ) );
lightState.attach( light );
+ box = new Box( "box", new Vector3f( -1, -1, -1 ), new Vector3f( 1, 1, 1 ) );
for ( int i = accessor.getNodeCount() - 1; i >= 0; i-- ) {
Object node = accessor.getNode( i );
- Box nodeVis = new Box( String.valueOf( node ), new Vector3f( -1, -1, -1 ), new Vector3f( 1, 1, 1 ) );
+ Spatial nodeVis = new SharedMesh( String.valueOf( node ), box );
nodeVis.getLocalTranslation().set( layouter.getCoordinates( node ) );
MaterialState material = display.getRenderer().createMaterialState();
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * * Neither the name of 'jMonkeyEngine' nor the names of its contributors
- * may be used to endorse or promote products derived from this software
+ * * Neither the name of 'jMonkeyEngine' nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS