* Small javadoc fixes
* Formatting for com.jme3.effect package * Formatting for blender importer and networking tests * All networking tests ported to new SpiderMonkey * Removed all mentions of java.util.Serializable * RMI now works under new SpiderMonkey git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7593 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
parent
95cdde7f53
commit
8cbb0f210d
@ -260,7 +260,10 @@ public class MaterialHelper extends AbstractBlenderHelper {
|
|||||||
Texture texture = textureHelper.getTexture(tex, dataRepository);
|
Texture texture = textureHelper.getTexture(tex, dataRepository);
|
||||||
if (texture != null) {
|
if (texture != null) {
|
||||||
if ((mapto & 0x01) != 0) {// Col
|
if ((mapto & 0x01) != 0) {// Col
|
||||||
result.setBoolean("UseMaterialColors", Boolean.FALSE);
|
if (!shadeless){
|
||||||
|
result.setBoolean("UseMaterialColors", false);
|
||||||
|
}
|
||||||
|
|
||||||
// blending the texture with material color and texture's defined color
|
// blending the texture with material color and texture's defined color
|
||||||
int blendType = ((Number) textureLink.getFieldValue("blendtype")).intValue();
|
int blendType = ((Number) textureLink.getFieldValue("blendtype")).intValue();
|
||||||
float[] color = new float[]{((Number) textureLink.getFieldValue("r")).floatValue(), ((Number) textureLink.getFieldValue("g")).floatValue(), ((Number) textureLink.getFieldValue("b")).floatValue()};
|
float[] color = new float[]{((Number) textureLink.getFieldValue("r")).floatValue(), ((Number) textureLink.getFieldValue("g")).floatValue(), ((Number) textureLink.getFieldValue("b")).floatValue()};
|
||||||
|
@ -48,6 +48,8 @@ import java.util.BitSet;
|
|||||||
*/
|
*/
|
||||||
public final class AnimChannel {
|
public final class AnimChannel {
|
||||||
|
|
||||||
|
private static final float DEFAULT_BLEND_TIME = 0.15f;
|
||||||
|
|
||||||
private AnimControl control;
|
private AnimControl control;
|
||||||
|
|
||||||
// private ArrayList<Integer> affectedBones;
|
// private ArrayList<Integer> affectedBones;
|
||||||
@ -61,7 +63,7 @@ public final class AnimChannel {
|
|||||||
private float speedBlendFrom;
|
private float speedBlendFrom;
|
||||||
|
|
||||||
private LoopMode loopMode, loopModeBlendFrom;
|
private LoopMode loopMode, loopModeBlendFrom;
|
||||||
private float defaultBlendTime = 0.15f;
|
|
||||||
|
|
||||||
private float blendAmount = 1f;
|
private float blendAmount = 1f;
|
||||||
private float blendRate = 0;
|
private float blendRate = 0;
|
||||||
@ -95,6 +97,15 @@ public final class AnimChannel {
|
|||||||
this.control = control;
|
this.control = control;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the parent control of this AnimChannel.
|
||||||
|
* @return the parent control of this AnimChannel.
|
||||||
|
* @see AnimControl
|
||||||
|
*/
|
||||||
|
public AnimControl getControl() {
|
||||||
|
return control;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return The name of the currently playing animation, or null if
|
* @return The name of the currently playing animation, or null if
|
||||||
* none is assigned.
|
* none is assigned.
|
||||||
@ -180,6 +191,7 @@ public final class AnimChannel {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the current animation that is played by this AnimChannel.
|
* Set the current animation that is played by this AnimChannel.
|
||||||
|
* <p>
|
||||||
* This resets the time to zero, and optionally blends the animation
|
* This resets the time to zero, and optionally blends the animation
|
||||||
* over <code>blendTime</code> seconds with the currently playing animation.
|
* over <code>blendTime</code> seconds with the currently playing animation.
|
||||||
* Notice that this method will reset the control's speed to 1.0.
|
* Notice that this method will reset the control's speed to 1.0.
|
||||||
@ -219,11 +231,15 @@ public final class AnimChannel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Set the current animation that is played by this AnimChannel.
|
||||||
|
* <p>
|
||||||
|
* See {@link #setAnim(java.lang.String, float) }.
|
||||||
|
* The blendTime argument by default is 150 milliseconds.
|
||||||
*
|
*
|
||||||
* @param name
|
* @param name The name of the animation to play
|
||||||
*/
|
*/
|
||||||
public void setAnim(String name){
|
public void setAnim(String name){
|
||||||
setAnim(name, defaultBlendTime);
|
setAnim(name, DEFAULT_BLEND_TIME);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -294,7 +310,6 @@ public final class AnimChannel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void reset(){
|
void reset(){
|
||||||
animation = null;
|
animation = null;
|
||||||
blendFrom = null;
|
blendFrom = null;
|
||||||
@ -340,11 +355,4 @@ public final class AnimChannel {
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public AnimControl getControl() {
|
|
||||||
return control;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -110,13 +110,14 @@ public final class AnimControl extends AbstractControl implements Savable, Clone
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used only for Saving/Loading models (all parameters of the non-default
|
* Serialization only. Do not use.
|
||||||
* constructor are restored from the saved model, but the object must be
|
|
||||||
* constructed beforehand)
|
|
||||||
*/
|
*/
|
||||||
public AnimControl() {
|
public AnimControl() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Internal use only.
|
||||||
|
*/
|
||||||
public Control cloneForSpatial(Spatial spatial) {
|
public Control cloneForSpatial(Spatial spatial) {
|
||||||
try {
|
try {
|
||||||
AnimControl clone = (AnimControl) super.clone();
|
AnimControl clone = (AnimControl) super.clone();
|
||||||
@ -268,6 +269,9 @@ public final class AnimControl extends AbstractControl implements Savable, Clone
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Internal use only.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void setSpatial(Spatial spatial) {
|
public void setSpatial(Spatial spatial) {
|
||||||
if (spatial == null && skeletonControl != null){
|
if (spatial == null && skeletonControl != null){
|
||||||
@ -311,6 +315,9 @@ public final class AnimControl extends AbstractControl implements Savable, Clone
|
|||||||
return a.getLength();
|
return a.getLength();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Internal use only.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void controlUpdate(float tpf) {
|
protected void controlUpdate(float tpf) {
|
||||||
skeleton.reset(); // reset skeleton to bind pose
|
skeleton.reset(); // reset skeleton to bind pose
|
||||||
@ -322,6 +329,9 @@ public final class AnimControl extends AbstractControl implements Savable, Clone
|
|||||||
skeleton.updateWorldVectors();
|
skeleton.updateWorldVectors();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Internal use only.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void controlRender(RenderManager rm, ViewPort vp) {
|
protected void controlRender(RenderManager rm, ViewPort vp) {
|
||||||
}
|
}
|
||||||
|
@ -93,7 +93,6 @@ public final class Bone implements Savable {
|
|||||||
private Vector3f worldPos = new Vector3f();
|
private Vector3f worldPos = new Vector3f();
|
||||||
private Quaternion worldRot = new Quaternion();
|
private Quaternion worldRot = new Quaternion();
|
||||||
private Vector3f worldScale = new Vector3f();
|
private Vector3f worldScale = new Vector3f();
|
||||||
|
|
||||||
//used for getCombinedTransform
|
//used for getCombinedTransform
|
||||||
private Transform tmpTransform = new Transform();
|
private Transform tmpTransform = new Transform();
|
||||||
|
|
||||||
@ -143,6 +142,8 @@ public final class Bone implements Savable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Returns the name of the bone, set in the constructor.
|
||||||
|
*
|
||||||
* @return The name of the bone, set in the constructor.
|
* @return The name of the bone, set in the constructor.
|
||||||
*/
|
*/
|
||||||
public String getName() {
|
public String getName() {
|
||||||
@ -150,6 +151,7 @@ public final class Bone implements Savable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Returns parent bone of this bone, or null if it is a root bone.
|
||||||
* @return The parent bone of this bone, or null if it is a root bone.
|
* @return The parent bone of this bone, or null if it is a root bone.
|
||||||
*/
|
*/
|
||||||
public Bone getParent() {
|
public Bone getParent() {
|
||||||
@ -157,6 +159,8 @@ public final class Bone implements Savable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Returns all the children bones of this bone.
|
||||||
|
*
|
||||||
* @return All the children bones of this bone.
|
* @return All the children bones of this bone.
|
||||||
*/
|
*/
|
||||||
public ArrayList<Bone> getChildren() {
|
public ArrayList<Bone> getChildren() {
|
||||||
@ -164,6 +168,8 @@ public final class Bone implements Savable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Returns the local position of the bone, relative to the parent bone.
|
||||||
|
*
|
||||||
* @return The local position of the bone, relative to the parent bone.
|
* @return The local position of the bone, relative to the parent bone.
|
||||||
*/
|
*/
|
||||||
public Vector3f getLocalPosition() {
|
public Vector3f getLocalPosition() {
|
||||||
@ -171,6 +177,8 @@ public final class Bone implements Savable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Returns the local rotation of the bone, relative to the parent bone.
|
||||||
|
*
|
||||||
* @return The local rotation of the bone, relative to the parent bone.
|
* @return The local rotation of the bone, relative to the parent bone.
|
||||||
*/
|
*/
|
||||||
public Quaternion getLocalRotation() {
|
public Quaternion getLocalRotation() {
|
||||||
@ -178,6 +186,8 @@ public final class Bone implements Savable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Returns the local scale of the bone, relative to the parent bone.
|
||||||
|
*
|
||||||
* @return The local scale of the bone, relative to the parent bone.
|
* @return The local scale of the bone, relative to the parent bone.
|
||||||
*/
|
*/
|
||||||
public Vector3f getLocalScale() {
|
public Vector3f getLocalScale() {
|
||||||
@ -185,6 +195,8 @@ public final class Bone implements Savable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Returns the position of the bone in model space.
|
||||||
|
*
|
||||||
* @return The position of the bone in model space.
|
* @return The position of the bone in model space.
|
||||||
*/
|
*/
|
||||||
public Vector3f getModelSpacePosition() {
|
public Vector3f getModelSpacePosition() {
|
||||||
@ -192,6 +204,8 @@ public final class Bone implements Savable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Returns the rotation of the bone in model space.
|
||||||
|
*
|
||||||
* @return The rotation of the bone in model space.
|
* @return The rotation of the bone in model space.
|
||||||
*/
|
*/
|
||||||
public Quaternion getModelSpaceRotation() {
|
public Quaternion getModelSpaceRotation() {
|
||||||
@ -199,20 +213,37 @@ public final class Bone implements Savable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Returns the scale of the bone in model space.
|
||||||
|
*
|
||||||
* @return The scale of the bone in model space.
|
* @return The scale of the bone in model space.
|
||||||
*/
|
*/
|
||||||
public Vector3f getModelSpaceScale() {
|
public Vector3f getModelSpaceScale() {
|
||||||
return worldScale;
|
return worldScale;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the inverse world bind pose position.
|
||||||
|
*
|
||||||
|
* @return the inverse world bind pose position.
|
||||||
|
*/
|
||||||
public Vector3f getWorldBindInversePosition() {
|
public Vector3f getWorldBindInversePosition() {
|
||||||
return worldBindInversePos;
|
return worldBindInversePos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the inverse world bind pose rotation.
|
||||||
|
*
|
||||||
|
* @return the inverse world bind pose rotation.
|
||||||
|
*/
|
||||||
public Quaternion getWorldBindInverseRotation() {
|
public Quaternion getWorldBindInverseRotation() {
|
||||||
return worldBindInverseRot;
|
return worldBindInverseRot;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the inverse world bind pose scale.
|
||||||
|
*
|
||||||
|
* @return the inverse world bind pose scale.
|
||||||
|
*/
|
||||||
public Vector3f getWorldBindInverseScale() {
|
public Vector3f getWorldBindInverseScale() {
|
||||||
return worldBindInverseScale;
|
return worldBindInverseScale;
|
||||||
}
|
}
|
||||||
@ -477,14 +508,6 @@ public final class Bone implements Savable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void setAnimTransforms(Vector3f translation, Quaternion rotation) {
|
|
||||||
this.setAnimTransforms(translation, rotation, Vector3f.UNIT_XYZ);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBindTransforms(Vector3f translation, Quaternion rotation) {
|
|
||||||
this.setBindTransforms(translation, rotation, Vector3f.UNIT_XYZ);
|
|
||||||
}
|
|
||||||
|
|
||||||
private String toString(int depth) {
|
private String toString(int depth) {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
for (int i = 0; i < depth; i++) {
|
for (int i = 0; i < depth; i++) {
|
||||||
|
@ -41,18 +41,22 @@ import java.io.IOException;
|
|||||||
import java.util.BitSet;
|
import java.util.BitSet;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bone animation updates each of it's tracks with the skeleton and time
|
* Bone animation updates each of its tracks with the skeleton and time
|
||||||
* to apply the animation.
|
* to apply the animation.
|
||||||
*/
|
*/
|
||||||
public final class BoneAnimation implements Savable {
|
public final class BoneAnimation implements Savable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
private float length;
|
private float length;
|
||||||
|
|
||||||
private BoneTrack[] tracks;
|
private BoneTrack[] tracks;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new BoneAnimation with the given name and length.
|
||||||
|
*
|
||||||
|
* @param name The name of the bone animation.
|
||||||
|
* @param length Length in seconds of the bone animation.
|
||||||
|
*/
|
||||||
public BoneAnimation(String name, float length){
|
public BoneAnimation(String name, float length){
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.length = length;
|
this.length = length;
|
||||||
|
@ -39,11 +39,8 @@ import com.jme3.export.OutputCapsule;
|
|||||||
import com.jme3.export.Savable;
|
import com.jme3.export.Savable;
|
||||||
import com.jme3.scene.Mesh;
|
import com.jme3.scene.Mesh;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
public class MeshAnimation implements Serializable, Savable {
|
public class MeshAnimation implements Savable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
private float length;
|
private float length;
|
||||||
|
@ -40,15 +40,12 @@ import com.jme3.export.Savable;
|
|||||||
import com.jme3.math.Vector3f;
|
import com.jme3.math.Vector3f;
|
||||||
import com.jme3.util.BufferUtils;
|
import com.jme3.util.BufferUtils;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.Serializable;
|
|
||||||
import java.nio.FloatBuffer;
|
import java.nio.FloatBuffer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A pose is a list of offsets that say where a mesh verticles should be for this pose.
|
* A pose is a list of offsets that say where a mesh verticles should be for this pose.
|
||||||
*/
|
*/
|
||||||
public final class Pose implements Serializable, Savable {
|
public final class Pose implements Savable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
private int targetMeshIndex;
|
private int targetMeshIndex;
|
||||||
|
@ -41,7 +41,6 @@ import com.jme3.scene.Mesh;
|
|||||||
import com.jme3.scene.VertexBuffer;
|
import com.jme3.scene.VertexBuffer;
|
||||||
import com.jme3.scene.VertexBuffer.Type;
|
import com.jme3.scene.VertexBuffer.Type;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.Serializable;
|
|
||||||
import java.nio.FloatBuffer;
|
import java.nio.FloatBuffer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -49,15 +48,11 @@ import java.nio.FloatBuffer;
|
|||||||
*/
|
*/
|
||||||
public final class PoseTrack extends Track {
|
public final class PoseTrack extends Track {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
private PoseFrame[] frames;
|
private PoseFrame[] frames;
|
||||||
private float[] times;
|
private float[] times;
|
||||||
|
|
||||||
public static class PoseFrame implements Savable {
|
public static class PoseFrame implements Savable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
Pose[] poses;
|
Pose[] poses;
|
||||||
float[] weights;
|
float[] weights;
|
||||||
|
|
||||||
|
@ -37,15 +37,12 @@ import com.jme3.export.JmeImporter;
|
|||||||
import com.jme3.export.Savable;
|
import com.jme3.export.Savable;
|
||||||
import com.jme3.scene.Mesh;
|
import com.jme3.scene.Mesh;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A single track of mesh animation (either morph or pose based).
|
* A single track of mesh animation (either morph or pose based).
|
||||||
* Currently morph animations are not supported (only pose).
|
* Currently morph animations are not supported (only pose).
|
||||||
*/
|
*/
|
||||||
public abstract class Track implements Serializable, Savable {
|
public abstract class Track implements Savable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
protected int targetMeshIndex;
|
protected int targetMeshIndex;
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@ import com.jme3.math.Vector3f;
|
|||||||
* @author Marcin Roguski (Kaelthas)
|
* @author Marcin Roguski (Kaelthas)
|
||||||
*/
|
*/
|
||||||
public class DefaultParticleInfluencer implements ParticleInfluencer {
|
public class DefaultParticleInfluencer implements ParticleInfluencer {
|
||||||
|
|
||||||
/** Temporary variable used to help with calculations. */
|
/** Temporary variable used to help with calculations. */
|
||||||
protected transient Vector3f temp = new Vector3f();
|
protected transient Vector3f temp = new Vector3f();
|
||||||
/** The initial velocity of the particles. */
|
/** The initial velocity of the particles. */
|
||||||
|
@ -16,16 +16,20 @@ import com.jme3.math.Vector3f;
|
|||||||
public class EmptyParticleInfluencer implements ParticleInfluencer {
|
public class EmptyParticleInfluencer implements ParticleInfluencer {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void write(JmeExporter ex) throws IOException {}
|
public void write(JmeExporter ex) throws IOException {
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void read(JmeImporter im) throws IOException {}
|
public void read(JmeImporter im) throws IOException {
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void influenceParticle(Particle particle, EmitterShape emitterShape) {}
|
public void influenceParticle(Particle particle, EmitterShape emitterShape) {
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setInitialVelocity(Vector3f initialVelocity) {}
|
public void setInitialVelocity(Vector3f initialVelocity) {
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Vector3f getInitialVelocity() {
|
public Vector3f getInitialVelocity() {
|
||||||
@ -33,7 +37,8 @@ public class EmptyParticleInfluencer implements ParticleInfluencer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setVelocityVariation(float variation) {}
|
public void setVelocityVariation(float variation) {
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getVelocityVariation() {
|
public float getVelocityVariation() {
|
||||||
|
@ -16,6 +16,7 @@ import com.jme3.math.Matrix3f;
|
|||||||
* @author Marcin Roguski (Kaelthas)
|
* @author Marcin Roguski (Kaelthas)
|
||||||
*/
|
*/
|
||||||
public class NewtonianParticleInfluencer extends DefaultParticleInfluencer {
|
public class NewtonianParticleInfluencer extends DefaultParticleInfluencer {
|
||||||
|
|
||||||
/** Normal to emitter's shape factor. */
|
/** Normal to emitter's shape factor. */
|
||||||
protected float normalVelocity;
|
protected float normalVelocity;
|
||||||
/** Emitter's surface tangent factor. */
|
/** Emitter's surface tangent factor. */
|
||||||
|
@ -11,6 +11,7 @@ import com.jme3.math.Vector3f;
|
|||||||
* @author Marcin Roguski (Kaelthas)
|
* @author Marcin Roguski (Kaelthas)
|
||||||
*/
|
*/
|
||||||
public interface ParticleInfluencer extends Savable, Cloneable {
|
public interface ParticleInfluencer extends Savable, Cloneable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method influences the particle.
|
* This method influences the particle.
|
||||||
* @param particle
|
* @param particle
|
||||||
|
@ -29,7 +29,6 @@
|
|||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.jme3.effect.shapes;
|
package com.jme3.effect.shapes;
|
||||||
|
|
||||||
import com.jme3.export.JmeExporter;
|
import com.jme3.export.JmeExporter;
|
||||||
@ -109,11 +108,11 @@ public class EmitterBoxShape implements EmitterShape {
|
|||||||
oc.write(min, "min", null);
|
oc.write(min, "min", null);
|
||||||
oc.write(len, "length", null);
|
oc.write(len, "length", null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void read(JmeImporter im) throws IOException {
|
public void read(JmeImporter im) throws IOException {
|
||||||
InputCapsule ic = im.getCapsule(this);
|
InputCapsule ic = im.getCapsule(this);
|
||||||
min = (Vector3f) ic.readSavable("min", null);
|
min = (Vector3f) ic.readSavable("min", null);
|
||||||
len = (Vector3f) ic.readSavable("length", null);
|
len = (Vector3f) ic.readSavable("length", null);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -13,10 +13,12 @@ import com.jme3.scene.Mesh;
|
|||||||
* @author Marcin Roguski (Kaelthas)
|
* @author Marcin Roguski (Kaelthas)
|
||||||
*/
|
*/
|
||||||
public class EmitterMeshConvexHullShape extends EmitterMeshFaceShape {
|
public class EmitterMeshConvexHullShape extends EmitterMeshFaceShape {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Empty constructor. Sets nothing.
|
* Empty constructor. Sets nothing.
|
||||||
*/
|
*/
|
||||||
public EmitterMeshConvexHullShape() {}
|
public EmitterMeshConvexHullShape() {
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor. It stores a copy of vertex list of all meshes.
|
* Constructor. It stores a copy of vertex list of all meshes.
|
||||||
|
@ -14,10 +14,12 @@ import com.jme3.util.BufferUtils;
|
|||||||
* @author Marcin Roguski (Kaelthas)
|
* @author Marcin Roguski (Kaelthas)
|
||||||
*/
|
*/
|
||||||
public class EmitterMeshFaceShape extends EmitterMeshVertexShape {
|
public class EmitterMeshFaceShape extends EmitterMeshVertexShape {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Empty constructor. Sets nothing.
|
* Empty constructor. Sets nothing.
|
||||||
*/
|
*/
|
||||||
public EmitterMeshFaceShape() {}
|
public EmitterMeshFaceShape() {
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor. It stores a copy of vertex list of all meshes.
|
* Constructor. It stores a copy of vertex list of all meshes.
|
||||||
|
@ -21,13 +21,15 @@ import com.jme3.util.BufferUtils;
|
|||||||
* @author Marcin Roguski (Kaelthas)
|
* @author Marcin Roguski (Kaelthas)
|
||||||
*/
|
*/
|
||||||
public class EmitterMeshVertexShape implements EmitterShape {
|
public class EmitterMeshVertexShape implements EmitterShape {
|
||||||
|
|
||||||
protected List<List<Vector3f>> vertices;
|
protected List<List<Vector3f>> vertices;
|
||||||
protected List<List<Vector3f>> normals;
|
protected List<List<Vector3f>> normals;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Empty constructor. Sets nothing.
|
* Empty constructor. Sets nothing.
|
||||||
*/
|
*/
|
||||||
public EmitterMeshVertexShape() {}
|
public EmitterMeshVertexShape() {
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor. It stores a copy of vertex list of all meshes.
|
* Constructor. It stores a copy of vertex list of all meshes.
|
||||||
|
@ -29,7 +29,6 @@
|
|||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.jme3.effect.shapes;
|
package com.jme3.effect.shapes;
|
||||||
|
|
||||||
import com.jme3.export.JmeExporter;
|
import com.jme3.export.JmeExporter;
|
||||||
@ -94,5 +93,4 @@ public class EmitterPointShape implements EmitterShape {
|
|||||||
public void read(JmeImporter im) throws IOException {
|
public void read(JmeImporter im) throws IOException {
|
||||||
this.point = (Vector3f) im.getCapsule(this).readSavable("point", null);
|
this.point = (Vector3f) im.getCapsule(this).readSavable("point", null);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,6 @@
|
|||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.jme3.effect.shapes;
|
package com.jme3.effect.shapes;
|
||||||
|
|
||||||
import com.jme3.export.Savable;
|
import com.jme3.export.Savable;
|
||||||
@ -40,6 +39,7 @@ import com.jme3.math.Vector3f;
|
|||||||
* @author Kirill
|
* @author Kirill
|
||||||
*/
|
*/
|
||||||
public interface EmitterShape extends Savable, Cloneable {
|
public interface EmitterShape extends Savable, Cloneable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method fills in the initial position of the particle.
|
* This method fills in the initial position of the particle.
|
||||||
* @param store
|
* @param store
|
||||||
|
@ -29,7 +29,6 @@
|
|||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.jme3.effect.shapes;
|
package com.jme3.effect.shapes;
|
||||||
|
|
||||||
import com.jme3.export.JmeExporter;
|
import com.jme3.export.JmeExporter;
|
||||||
@ -115,5 +114,4 @@ public class EmitterSphereShape implements EmitterShape {
|
|||||||
center = (Vector3f) ic.readSavable("center", null);
|
center = (Vector3f) ic.readSavable("center", null);
|
||||||
radius = ic.readFloat("radius", 0);
|
radius = ic.readFloat("radius", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,6 @@ import java.io.IOException;
|
|||||||
*/
|
*/
|
||||||
public final class ColorRGBA implements Savable, Cloneable {
|
public final class ColorRGBA implements Savable, Cloneable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
/**
|
/**
|
||||||
* the color black (0,0,0).
|
* the color black (0,0,0).
|
||||||
*/
|
*/
|
||||||
|
@ -40,7 +40,6 @@ import com.jme3.export.Savable;
|
|||||||
import com.jme3.util.BufferUtils;
|
import com.jme3.util.BufferUtils;
|
||||||
import com.jme3.util.TempVars;
|
import com.jme3.util.TempVars;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.Serializable;
|
|
||||||
import java.nio.FloatBuffer;
|
import java.nio.FloatBuffer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -51,8 +50,6 @@ import java.nio.FloatBuffer;
|
|||||||
* @author Joshua Slack
|
* @author Joshua Slack
|
||||||
*/
|
*/
|
||||||
public class Line implements Savable, Cloneable {
|
public class Line implements Savable, Cloneable {
|
||||||
//todo: merge with Ray?
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
private Vector3f origin;
|
private Vector3f origin;
|
||||||
private Vector3f direction;
|
private Vector3f direction;
|
||||||
|
@ -29,7 +29,6 @@
|
|||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.jme3.math;
|
package com.jme3.math;
|
||||||
|
|
||||||
import com.jme3.export.InputCapsule;
|
import com.jme3.export.InputCapsule;
|
||||||
@ -56,12 +55,8 @@ import java.io.IOException;
|
|||||||
*/
|
*/
|
||||||
public class LineSegment implements Cloneable, Savable {
|
public class LineSegment implements Cloneable, Savable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
private Vector3f origin;
|
private Vector3f origin;
|
||||||
|
|
||||||
private Vector3f direction;
|
private Vector3f direction;
|
||||||
|
|
||||||
private float extent;
|
private float extent;
|
||||||
|
|
||||||
public LineSegment() {
|
public LineSegment() {
|
||||||
@ -623,11 +618,16 @@ public class LineSegment implements Cloneable, Savable {
|
|||||||
*/
|
*/
|
||||||
public boolean isPointInsideBounds(Vector3f point, float error) {
|
public boolean isPointInsideBounds(Vector3f point, float error) {
|
||||||
|
|
||||||
if (FastMath.abs(point.x - origin.x) > FastMath.abs(direction.x * extent) + error) return false;
|
if (FastMath.abs(point.x - origin.x) > FastMath.abs(direction.x * extent) + error) {
|
||||||
if (FastMath.abs(point.y - origin.y) > FastMath.abs(direction.y * extent) + error) return false;
|
return false;
|
||||||
if (FastMath.abs(point.z - origin.z) > FastMath.abs(direction.z * extent) + error) return false;
|
}
|
||||||
|
if (FastMath.abs(point.y - origin.y) > FastMath.abs(direction.y * extent) + error) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (FastMath.abs(point.z - origin.z) > FastMath.abs(direction.z * extent) + error) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,6 @@ import java.io.IOException;
|
|||||||
public final class Ray implements Savable, Cloneable, Collidable {
|
public final class Ray implements Savable, Cloneable, Collidable {
|
||||||
|
|
||||||
//todo: merge with Line?
|
//todo: merge with Line?
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/** The ray's begining point. */
|
/** The ray's begining point. */
|
||||||
public Vector3f origin;
|
public Vector3f origin;
|
||||||
|
@ -38,7 +38,6 @@ import com.jme3.export.JmeImporter;
|
|||||||
import com.jme3.export.OutputCapsule;
|
import com.jme3.export.OutputCapsule;
|
||||||
import com.jme3.export.Savable;
|
import com.jme3.export.Savable;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -51,8 +50,7 @@ import java.io.Serializable;
|
|||||||
* @author Joshua Slack
|
* @author Joshua Slack
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public final class Rectangle implements Serializable, Savable, Cloneable {
|
public final class Rectangle implements Savable, Cloneable {
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
private Vector3f a, b, c;
|
private Vector3f a, b, c;
|
||||||
|
|
||||||
|
@ -38,7 +38,6 @@ import com.jme3.export.JmeImporter;
|
|||||||
import com.jme3.export.OutputCapsule;
|
import com.jme3.export.OutputCapsule;
|
||||||
import com.jme3.export.Savable;
|
import com.jme3.export.Savable;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -50,8 +49,7 @@ import java.io.Serializable;
|
|||||||
* @author Joshua Slack
|
* @author Joshua Slack
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public final class Ring implements Serializable, Savable, Cloneable {
|
public final class Ring implements Savable, Cloneable {
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
private Vector3f center, up;
|
private Vector3f center, up;
|
||||||
private float innerRadius, outerRadius;
|
private float innerRadius, outerRadius;
|
||||||
|
@ -52,8 +52,6 @@ import java.util.logging.Logger;
|
|||||||
public final class Vector2f implements Savable, Cloneable {
|
public final class Vector2f implements Savable, Cloneable {
|
||||||
private static final Logger logger = Logger.getLogger(Vector2f.class.getName());
|
private static final Logger logger = Logger.getLogger(Vector2f.class.getName());
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
public static final Vector2f ZERO = new Vector2f(0f, 0f);
|
public static final Vector2f ZERO = new Vector2f(0f, 0f);
|
||||||
public static final Vector2f UNIT_XY = new Vector2f(1f, 1f);
|
public static final Vector2f UNIT_XY = new Vector2f(1f, 1f);
|
||||||
|
|
||||||
|
@ -73,8 +73,6 @@ public class Box extends AbstractBox {
|
|||||||
1, 0, 0, 0, 0, 1, 1, 1 // bottom
|
1, 0, 0, 0, 0, 1, 1, 1 // bottom
|
||||||
};
|
};
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new box.
|
* Creates a new box.
|
||||||
* <p>
|
* <p>
|
||||||
|
@ -56,8 +56,6 @@ import java.nio.ShortBuffer;
|
|||||||
*/
|
*/
|
||||||
public class PQTorus extends Mesh {
|
public class PQTorus extends Mesh {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
private float p, q;
|
private float p, q;
|
||||||
|
|
||||||
private float radius, width;
|
private float radius, width;
|
||||||
|
@ -32,12 +32,14 @@
|
|||||||
|
|
||||||
package com.jme3.network.rmi;
|
package com.jme3.network.rmi;
|
||||||
|
|
||||||
|
import com.jme3.network.Client;
|
||||||
import com.jme3.network.connection.Client;
|
import com.jme3.network.ClientStateListener;
|
||||||
import com.jme3.network.connection.Server;
|
import com.jme3.network.ClientStateListener.DisconnectInfo;
|
||||||
import com.jme3.network.events.ConnectionListener;
|
import com.jme3.network.ConnectionListener;
|
||||||
import com.jme3.network.events.MessageListener;
|
import com.jme3.network.HostedConnection;
|
||||||
import com.jme3.network.message.Message;
|
import com.jme3.network.Message;
|
||||||
|
import com.jme3.network.MessageListener;
|
||||||
|
import com.jme3.network.Server;
|
||||||
import com.jme3.network.serializing.Serializer;
|
import com.jme3.network.serializing.Serializer;
|
||||||
import com.jme3.util.IntMap;
|
import com.jme3.util.IntMap;
|
||||||
import com.jme3.util.IntMap.Entry;
|
import com.jme3.util.IntMap.Entry;
|
||||||
@ -45,11 +47,12 @@ import java.io.IOException;
|
|||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.lang.reflect.Proxy;
|
import java.lang.reflect.Proxy;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
public class ObjectStore implements MessageListener, ConnectionListener {
|
public class ObjectStore {
|
||||||
|
|
||||||
private static final Logger logger = Logger.getLogger(ObjectStore.class.getName());
|
private static final Logger logger = Logger.getLogger(ObjectStore.class.getName());
|
||||||
|
|
||||||
@ -67,6 +70,9 @@ public class ObjectStore implements MessageListener, ConnectionListener {
|
|||||||
private Client client;
|
private Client client;
|
||||||
private Server server;
|
private Server server;
|
||||||
|
|
||||||
|
private ClientEventHandler clientEventHandler = new ClientEventHandler();
|
||||||
|
private ServerEventHandler serverEventHandler = new ServerEventHandler();
|
||||||
|
|
||||||
// Local object ID counter
|
// Local object ID counter
|
||||||
private volatile short objectIdCounter = 0;
|
private volatile short objectIdCounter = 0;
|
||||||
|
|
||||||
@ -85,6 +91,38 @@ public class ObjectStore implements MessageListener, ConnectionListener {
|
|||||||
|
|
||||||
private final Object receiveObjectLock = new Object();
|
private final Object receiveObjectLock = new Object();
|
||||||
|
|
||||||
|
public class ServerEventHandler implements MessageListener<HostedConnection>,
|
||||||
|
ConnectionListener {
|
||||||
|
|
||||||
|
public void messageReceived(HostedConnection source, Message m) {
|
||||||
|
onMessage(source, m);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void connectionAdded(Server server, HostedConnection conn) {
|
||||||
|
onConnection(conn);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void connectionRemoved(Server server, HostedConnection conn) {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ClientEventHandler implements MessageListener,
|
||||||
|
ClientStateListener {
|
||||||
|
|
||||||
|
public void messageReceived(Object source, Message m) {
|
||||||
|
onMessage(null, m);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clientConnected(Client c) {
|
||||||
|
onConnection(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clientDisconnected(Client c, DisconnectInfo info) {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
static {
|
static {
|
||||||
Serializer s = new RmiSerializer();
|
Serializer s = new RmiSerializer();
|
||||||
Serializer.registerClass(RemoteObjectDefMessage.class, s);
|
Serializer.registerClass(RemoteObjectDefMessage.class, s);
|
||||||
@ -94,18 +132,20 @@ public class ObjectStore implements MessageListener, ConnectionListener {
|
|||||||
|
|
||||||
public ObjectStore(Client client) {
|
public ObjectStore(Client client) {
|
||||||
this.client = client;
|
this.client = client;
|
||||||
client.addMessageListener(this, RemoteObjectDefMessage.class,
|
client.addMessageListener(clientEventHandler,
|
||||||
|
RemoteObjectDefMessage.class,
|
||||||
RemoteMethodCallMessage.class,
|
RemoteMethodCallMessage.class,
|
||||||
RemoteMethodReturnMessage.class);
|
RemoteMethodReturnMessage.class);
|
||||||
client.addConnectionListener(this);
|
client.addClientStateListener(clientEventHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ObjectStore(Server server) {
|
public ObjectStore(Server server) {
|
||||||
this.server = server;
|
this.server = server;
|
||||||
server.addMessageListener(this, RemoteObjectDefMessage.class,
|
server.addMessageListener(serverEventHandler,
|
||||||
|
RemoteObjectDefMessage.class,
|
||||||
RemoteMethodCallMessage.class,
|
RemoteMethodCallMessage.class,
|
||||||
RemoteMethodReturnMessage.class);
|
RemoteMethodReturnMessage.class);
|
||||||
server.addConnectionListener(this);
|
server.addConnectionListener(serverEventHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ObjectDef makeObjectDef(LocalObject localObj){
|
private ObjectDef makeObjectDef(LocalObject localObj){
|
||||||
@ -122,7 +162,15 @@ public class ObjectStore implements MessageListener, ConnectionListener {
|
|||||||
localObj.objectName = name;
|
localObj.objectName = name;
|
||||||
localObj.objectId = objectIdCounter++;
|
localObj.objectId = objectIdCounter++;
|
||||||
localObj.theObject = obj;
|
localObj.theObject = obj;
|
||||||
localObj.methods = obj.getClass().getMethods();
|
//localObj.methods = obj.getClass().getMethods();
|
||||||
|
|
||||||
|
ArrayList<Method> methodList = new ArrayList<Method>();
|
||||||
|
for (Method method : obj.getClass().getMethods()){
|
||||||
|
if (method.getDeclaringClass() == obj.getClass()){
|
||||||
|
methodList.add(method);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
localObj.methods = methodList.toArray(new Method[methodList.size()]);
|
||||||
|
|
||||||
// Put it in the store
|
// Put it in the store
|
||||||
localObjects.put(localObj.objectId, localObj);
|
localObjects.put(localObj.objectId, localObj);
|
||||||
@ -180,7 +228,6 @@ public class ObjectStore implements MessageListener, ConnectionListener {
|
|||||||
pendingInvocations.put(call.invocationId, invoke);
|
pendingInvocations.put(call.invocationId, invoke);
|
||||||
}
|
}
|
||||||
|
|
||||||
try{
|
|
||||||
if (server != null){
|
if (server != null){
|
||||||
remoteObj.client.send(call);
|
remoteObj.client.send(call);
|
||||||
logger.log(Level.INFO, "Server: Sending {0}", call);
|
logger.log(Level.INFO, "Server: Sending {0}", call);
|
||||||
@ -188,9 +235,6 @@ public class ObjectStore implements MessageListener, ConnectionListener {
|
|||||||
client.send(call);
|
client.send(call);
|
||||||
logger.log(Level.INFO, "Client: Sending {0}", call);
|
logger.log(Level.INFO, "Client: Sending {0}", call);
|
||||||
}
|
}
|
||||||
} catch (IOException ex){
|
|
||||||
ex.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (invoke != null){
|
if (invoke != null){
|
||||||
synchronized(invoke){
|
synchronized(invoke){
|
||||||
@ -210,7 +254,7 @@ public class ObjectStore implements MessageListener, ConnectionListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void messageReceived(Message message) {
|
private void onMessage(HostedConnection source, Message message) {
|
||||||
// Might want to do more strict validation of the data
|
// Might want to do more strict validation of the data
|
||||||
// in the message to prevent crashes
|
// in the message to prevent crashes
|
||||||
|
|
||||||
@ -219,7 +263,7 @@ public class ObjectStore implements MessageListener, ConnectionListener {
|
|||||||
|
|
||||||
ObjectDef[] defs = defMsg.objects;
|
ObjectDef[] defs = defMsg.objects;
|
||||||
for (ObjectDef def : defs){
|
for (ObjectDef def : defs){
|
||||||
RemoteObject remoteObject = new RemoteObject(this, message.getClient());
|
RemoteObject remoteObject = new RemoteObject(this, source);
|
||||||
remoteObject.objectId = (short)def.objectId;
|
remoteObject.objectId = (short)def.objectId;
|
||||||
remoteObject.methodDefs = def.methodDefs;
|
remoteObject.methodDefs = def.methodDefs;
|
||||||
remoteObjects.put(def.objectName, remoteObject);
|
remoteObjects.put(def.objectName, remoteObject);
|
||||||
@ -257,17 +301,13 @@ public class ObjectStore implements MessageListener, ConnectionListener {
|
|||||||
RemoteMethodReturnMessage retMsg = new RemoteMethodReturnMessage();
|
RemoteMethodReturnMessage retMsg = new RemoteMethodReturnMessage();
|
||||||
retMsg.invocationID = call.invocationId;
|
retMsg.invocationID = call.invocationId;
|
||||||
retMsg.retVal = ret;
|
retMsg.retVal = ret;
|
||||||
try {
|
|
||||||
if (server != null){
|
if (server != null){
|
||||||
call.getClient().send(retMsg);
|
source.send(retMsg);
|
||||||
logger.log(Level.INFO, "Server: Sending {0}", retMsg);
|
logger.log(Level.INFO, "Server: Sending {0}", retMsg);
|
||||||
} else{
|
} else{
|
||||||
client.send(retMsg);
|
client.send(retMsg);
|
||||||
logger.log(Level.INFO, "Client: Sending {0}", retMsg);
|
logger.log(Level.INFO, "Client: Sending {0}", retMsg);
|
||||||
}
|
}
|
||||||
} catch (IOException ex){
|
|
||||||
ex.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}else if (message instanceof RemoteMethodReturnMessage){
|
}else if (message instanceof RemoteMethodReturnMessage){
|
||||||
RemoteMethodReturnMessage retMsg = (RemoteMethodReturnMessage) message;
|
RemoteMethodReturnMessage retMsg = (RemoteMethodReturnMessage) message;
|
||||||
@ -285,7 +325,7 @@ public class ObjectStore implements MessageListener, ConnectionListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clientConnected(Client client) {
|
private void onConnection(HostedConnection conn) {
|
||||||
if (localObjects.size() > 0){
|
if (localObjects.size() > 0){
|
||||||
// send a object definition message
|
// send a object definition message
|
||||||
ObjectDef[] defs = new ObjectDef[localObjects.size()];
|
ObjectDef[] defs = new ObjectDef[localObjects.size()];
|
||||||
@ -297,31 +337,14 @@ public class ObjectStore implements MessageListener, ConnectionListener {
|
|||||||
|
|
||||||
RemoteObjectDefMessage defMsg = new RemoteObjectDefMessage();
|
RemoteObjectDefMessage defMsg = new RemoteObjectDefMessage();
|
||||||
defMsg.objects = defs;
|
defMsg.objects = defs;
|
||||||
try {
|
|
||||||
if (this.client != null){
|
if (this.client != null){
|
||||||
this.client.send(defMsg);
|
this.client.send(defMsg);
|
||||||
logger.log(Level.INFO, "Client: Sending {0}", defMsg);
|
logger.log(Level.INFO, "Client: Sending {0}", defMsg);
|
||||||
} else{
|
} else{
|
||||||
client.send(defMsg);
|
conn.send(defMsg);
|
||||||
logger.log(Level.INFO, "Server: Sending {0}", defMsg);
|
logger.log(Level.INFO, "Server: Sending {0}", defMsg);
|
||||||
}
|
}
|
||||||
} catch (IOException ex){
|
|
||||||
ex.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clientDisconnected(Client client) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void messageSent(Message message) {
|
|
||||||
}
|
|
||||||
|
|
||||||
public void objectReceived(Object object) {
|
|
||||||
}
|
|
||||||
|
|
||||||
public void objectSent(Object object) {
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
|
|
||||||
package com.jme3.network.rmi;
|
package com.jme3.network.rmi;
|
||||||
|
|
||||||
import com.jme3.network.message.Message;
|
import com.jme3.network.AbstractMessage;
|
||||||
import com.jme3.network.serializing.Serializable;
|
import com.jme3.network.serializing.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -41,7 +41,7 @@ import com.jme3.network.serializing.Serializable;
|
|||||||
* @author Kirill Vainer
|
* @author Kirill Vainer
|
||||||
*/
|
*/
|
||||||
@Serializable
|
@Serializable
|
||||||
public class RemoteMethodCallMessage extends Message {
|
public class RemoteMethodCallMessage extends AbstractMessage {
|
||||||
|
|
||||||
public RemoteMethodCallMessage(){
|
public RemoteMethodCallMessage(){
|
||||||
super(true);
|
super(true);
|
||||||
|
@ -32,8 +32,7 @@
|
|||||||
|
|
||||||
package com.jme3.network.rmi;
|
package com.jme3.network.rmi;
|
||||||
|
|
||||||
|
import com.jme3.network.AbstractMessage;
|
||||||
import com.jme3.network.message.Message;
|
|
||||||
import com.jme3.network.serializing.Serializable;
|
import com.jme3.network.serializing.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -43,7 +42,7 @@ import com.jme3.network.serializing.Serializable;
|
|||||||
* @author Kirill Vainer.
|
* @author Kirill Vainer.
|
||||||
*/
|
*/
|
||||||
@Serializable
|
@Serializable
|
||||||
public class RemoteMethodReturnMessage extends Message {
|
public class RemoteMethodReturnMessage extends AbstractMessage {
|
||||||
|
|
||||||
public RemoteMethodReturnMessage(){
|
public RemoteMethodReturnMessage(){
|
||||||
super(true);
|
super(true);
|
||||||
|
@ -32,8 +32,7 @@
|
|||||||
|
|
||||||
package com.jme3.network.rmi;
|
package com.jme3.network.rmi;
|
||||||
|
|
||||||
|
import com.jme3.network.HostedConnection;
|
||||||
import com.jme3.network.connection.Client;
|
|
||||||
import java.lang.reflect.InvocationHandler;
|
import java.lang.reflect.InvocationHandler;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -72,9 +71,9 @@ public class RemoteObject implements InvocationHandler {
|
|||||||
* The client who exposed the RMI interface, or null if the server
|
* The client who exposed the RMI interface, or null if the server
|
||||||
* exposed it.
|
* exposed it.
|
||||||
*/
|
*/
|
||||||
Client client;
|
HostedConnection client;
|
||||||
|
|
||||||
public RemoteObject(ObjectStore store, Client client){
|
public RemoteObject(ObjectStore store, HostedConnection client){
|
||||||
this.store = store;
|
this.store = store;
|
||||||
this.client = client;
|
this.client = client;
|
||||||
}
|
}
|
||||||
|
@ -32,9 +32,7 @@
|
|||||||
|
|
||||||
package com.jme3.network.rmi;
|
package com.jme3.network.rmi;
|
||||||
|
|
||||||
|
import com.jme3.network.AbstractMessage;
|
||||||
|
|
||||||
import com.jme3.network.message.Message;
|
|
||||||
import com.jme3.network.serializing.Serializable;
|
import com.jme3.network.serializing.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -42,7 +40,7 @@ import com.jme3.network.serializing.Serializable;
|
|||||||
* @author Kirill Vainer
|
* @author Kirill Vainer
|
||||||
*/
|
*/
|
||||||
@Serializable
|
@Serializable
|
||||||
public class RemoteObjectDefMessage extends Message {
|
public class RemoteObjectDefMessage extends AbstractMessage {
|
||||||
|
|
||||||
public ObjectDef[] objects;
|
public ObjectDef[] objects;
|
||||||
|
|
||||||
|
@ -17,7 +17,6 @@ package com.jme3.terrain.geomipmap;
|
|||||||
//
|
//
|
||||||
// Please contact the author if you need another license.
|
// Please contact the author if you need another license.
|
||||||
// This module is provided "as is", without warranties of any kind.
|
// This module is provided "as is", without warranties of any kind.
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
@ -41,7 +40,6 @@ import java.util.Map;
|
|||||||
public class LRUCache<K, V> {
|
public class LRUCache<K, V> {
|
||||||
|
|
||||||
private static final float hashTableLoadFactor = 0.75f;
|
private static final float hashTableLoadFactor = 0.75f;
|
||||||
|
|
||||||
private LinkedHashMap<K, V> map;
|
private LinkedHashMap<K, V> map;
|
||||||
private int cacheSize;
|
private int cacheSize;
|
||||||
|
|
||||||
@ -56,6 +54,7 @@ public class LRUCache<K, V> {
|
|||||||
int hashTableCapacity = (int) Math.ceil(cacheSize / LRUCache.hashTableLoadFactor) + 1;
|
int hashTableCapacity = (int) Math.ceil(cacheSize / LRUCache.hashTableLoadFactor) + 1;
|
||||||
this.map = new LinkedHashMap<K, V>(hashTableCapacity, LRUCache.hashTableLoadFactor, true) {
|
this.map = new LinkedHashMap<K, V>(hashTableCapacity, LRUCache.hashTableLoadFactor, true) {
|
||||||
// (an anonymous inner class)
|
// (an anonymous inner class)
|
||||||
|
|
||||||
private static final long serialVersionUID = 1;
|
private static final long serialVersionUID = 1;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -120,5 +119,4 @@ public class LRUCache<K, V> {
|
|||||||
public synchronized Collection<Map.Entry<K, V>> getAll() {
|
public synchronized Collection<Map.Entry<K, V>> getAll() {
|
||||||
return new ArrayList<Map.Entry<K, V>>(this.map.entrySet());
|
return new ArrayList<Map.Entry<K, V>>(this.map.entrySet());
|
||||||
}
|
}
|
||||||
|
|
||||||
} // end class LRUCache
|
} // end class LRUCache
|
||||||
|
@ -41,7 +41,7 @@ import java.util.logging.Level;
|
|||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import jme3test.blender.config.ConfigDialog;
|
import jme3test.blender.config.ConfigDialog;
|
||||||
import jme3test.blender.config.IConfigExecutable;
|
import jme3test.blender.config.ConfigExecutable;
|
||||||
import jme3test.blender.scene.Pivot;
|
import jme3test.blender.scene.Pivot;
|
||||||
|
|
||||||
import com.jme3.animation.AnimControl;
|
import com.jme3.animation.AnimControl;
|
||||||
@ -67,6 +67,7 @@ import com.jme3.texture.plugins.AWTLoader;
|
|||||||
* @author Marcin Roguski (Kaelthas)
|
* @author Marcin Roguski (Kaelthas)
|
||||||
*/
|
*/
|
||||||
public class ManualBlenderTester extends SimpleApplication {
|
public class ManualBlenderTester extends SimpleApplication {
|
||||||
|
|
||||||
private static final Logger LOGGER = Logger.getLogger(ManualBlenderTester.class.getName());
|
private static final Logger LOGGER = Logger.getLogger(ManualBlenderTester.class.getName());
|
||||||
private ModelKey modelKey;//the key that holds the test file configuration
|
private ModelKey modelKey;//the key that holds the test file configuration
|
||||||
private final boolean debug;
|
private final boolean debug;
|
||||||
@ -89,7 +90,8 @@ public class ManualBlenderTester extends SimpleApplication {
|
|||||||
}
|
}
|
||||||
final boolean debugMode = debug;
|
final boolean debugMode = debug;
|
||||||
//running the application
|
//running the application
|
||||||
new ConfigDialog("./src/test-data/Blender", new IConfigExecutable() {
|
new ConfigDialog("./src/test-data/Blender", new ConfigExecutable() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(ModelKey modelKey, Level logLevel) {
|
public void execute(ModelKey modelKey, Level logLevel) {
|
||||||
new ManualBlenderTester(modelKey, logLevel, debugMode).start();
|
new ManualBlenderTester(modelKey, logLevel, debugMode).start();
|
||||||
@ -126,6 +128,7 @@ public class ManualBlenderTester extends SimpleApplication {
|
|||||||
cam.setFrustumFar(1000.0f);
|
cam.setFrustumFar(1000.0f);
|
||||||
cam.setFrustumNear(1.0f);
|
cam.setFrustumNear(1.0f);
|
||||||
AssetInfo ai = new AssetInfo(assetManager, modelKey) {
|
AssetInfo ai = new AssetInfo(assetManager, modelKey) {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public InputStream openStream() {
|
public InputStream openStream() {
|
||||||
try {
|
try {
|
||||||
|
@ -45,9 +45,9 @@ import javax.swing.table.TableCellEditor;
|
|||||||
* @author Marcin Roguski (Kaelthas)
|
* @author Marcin Roguski (Kaelthas)
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractConfigDialog extends JFrame {
|
public abstract class AbstractConfigDialog extends JFrame {
|
||||||
|
|
||||||
private static final long serialVersionUID = -3677493125861310310L;
|
private static final long serialVersionUID = -3677493125861310310L;
|
||||||
private static final Logger LOGGER = Logger.getLogger(AbstractConfigDialog.class.getName());
|
private static final Logger LOGGER = Logger.getLogger(AbstractConfigDialog.class.getName());
|
||||||
|
|
||||||
protected JComboBox jComboBoxVersionSelection;
|
protected JComboBox jComboBoxVersionSelection;
|
||||||
protected JList jListBlenderFiles;
|
protected JList jListBlenderFiles;
|
||||||
protected JTable jTableProperties;
|
protected JTable jTableProperties;
|
||||||
@ -180,8 +180,8 @@ public abstract class AbstractConfigDialog extends JFrame {
|
|||||||
//model key check-box
|
//model key check-box
|
||||||
jCheckBoxUseModelKey = new JCheckBox();
|
jCheckBoxUseModelKey = new JCheckBox();
|
||||||
jCheckBoxUseModelKey.setText("Use ModelKey to start the test");
|
jCheckBoxUseModelKey.setText("Use ModelKey to start the test");
|
||||||
jCheckBoxUseModelKey.setToolTipText("All BlenderKey settings will remain here, but the application will be " +
|
jCheckBoxUseModelKey.setToolTipText("All BlenderKey settings will remain here, but the application will be "
|
||||||
"started using a model key. So only the path to the file will be given!");
|
+ "started using a model key. So only the path to the file will be given!");
|
||||||
|
|
||||||
//building the result panel
|
//building the result panel
|
||||||
JPanel jPanelResult = new JPanel();
|
JPanel jPanelResult = new JPanel();
|
||||||
@ -213,6 +213,7 @@ public abstract class AbstractConfigDialog extends JFrame {
|
|||||||
* @author Marcin Roguski
|
* @author Marcin Roguski
|
||||||
*/
|
*/
|
||||||
protected static class JRadioButtonLevel extends JRadioButton {
|
protected static class JRadioButtonLevel extends JRadioButton {
|
||||||
|
|
||||||
private static final long serialVersionUID = 8874525909060993518L;
|
private static final long serialVersionUID = 8874525909060993518L;
|
||||||
private static Level selectedLevel;
|
private static Level selectedLevel;
|
||||||
private static Map<Level, JRadioButtonLevel> radioButtons = new HashMap<Level, AbstractConfigDialog.JRadioButtonLevel>();
|
private static Map<Level, JRadioButtonLevel> radioButtons = new HashMap<Level, AbstractConfigDialog.JRadioButtonLevel>();
|
||||||
@ -228,6 +229,7 @@ public abstract class AbstractConfigDialog extends JFrame {
|
|||||||
this.level = level;
|
this.level = level;
|
||||||
radioButtons.put(level, this);
|
radioButtons.put(level, this);
|
||||||
this.addActionListener(new ActionListener() {
|
this.addActionListener(new ActionListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
JRadioButtonLevel.selectedLevel = JRadioButtonLevel.this.level;
|
JRadioButtonLevel.selectedLevel = JRadioButtonLevel.this.level;
|
||||||
@ -257,7 +259,9 @@ public abstract class AbstractConfigDialog extends JFrame {
|
|||||||
* @author Marcin Roguski (Kaelthas)
|
* @author Marcin Roguski (Kaelthas)
|
||||||
*/
|
*/
|
||||||
protected static class FileListItem {
|
protected static class FileListItem {
|
||||||
|
|
||||||
private File file; //the file to be stored
|
private File file; //the file to be stored
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructore. Stores the given file.
|
* Constructore. Stores the given file.
|
||||||
* @param file the file to be stored
|
* @param file the file to be stored
|
||||||
@ -286,6 +290,7 @@ public abstract class AbstractConfigDialog extends JFrame {
|
|||||||
* @author Marcin Roguski (Kaelthas)
|
* @author Marcin Roguski (Kaelthas)
|
||||||
*/
|
*/
|
||||||
protected static class BlenderTableModel extends DefaultTableModel {
|
protected static class BlenderTableModel extends DefaultTableModel {
|
||||||
|
|
||||||
private static final long serialVersionUID = -4211206550875326553L;
|
private static final long serialVersionUID = -4211206550875326553L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -317,6 +322,7 @@ public abstract class AbstractConfigDialog extends JFrame {
|
|||||||
* @author Marcin Roguski (Kaelthas)
|
* @author Marcin Roguski (Kaelthas)
|
||||||
*/
|
*/
|
||||||
protected static class BlenderTableCellEditor extends AbstractCellEditor implements TableCellEditor {
|
protected static class BlenderTableCellEditor extends AbstractCellEditor implements TableCellEditor {
|
||||||
|
|
||||||
private static final long serialVersionUID = -8601975203921608519L;
|
private static final long serialVersionUID = -8601975203921608519L;
|
||||||
private JCheckBox jCheckBox = new JCheckBox();
|
private JCheckBox jCheckBox = new JCheckBox();
|
||||||
private JTextField jTextField = new JTextField();
|
private JTextField jTextField = new JTextField();
|
||||||
@ -339,8 +345,7 @@ public abstract class AbstractConfigDialog extends JFrame {
|
|||||||
defaultComboBoxModel.addElement(object);
|
defaultComboBoxModel.addElement(object);
|
||||||
}
|
}
|
||||||
return jComboBox;
|
return jComboBox;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
jTextField.setText(value == null ? "" : value.toString());
|
jTextField.setText(value == null ? "" : value.toString());
|
||||||
return jTextField;
|
return jTextField;
|
||||||
}
|
}
|
||||||
|
@ -41,20 +41,20 @@ import com.jme3.export.binary.BinaryImporter;
|
|||||||
* @author Marcin Roguski (Kaelthas)
|
* @author Marcin Roguski (Kaelthas)
|
||||||
*/
|
*/
|
||||||
public class ConfigDialog extends AbstractConfigDialog {
|
public class ConfigDialog extends AbstractConfigDialog {
|
||||||
|
|
||||||
private static final long serialVersionUID = 2863364888664674247L;
|
private static final long serialVersionUID = 2863364888664674247L;
|
||||||
private static final Logger LOGGER = Logger.getLogger(ConfigDialog.class.getName());
|
private static final Logger LOGGER = Logger.getLogger(ConfigDialog.class.getName());
|
||||||
|
|
||||||
private String baseFolderName;
|
private String baseFolderName;
|
||||||
private File configFile; //the config file
|
private File configFile; //the config file
|
||||||
private Map<String, BlenderKeyConfiguration> configMap; //the blender key configuration map
|
private Map<String, BlenderKeyConfiguration> configMap; //the blender key configuration map
|
||||||
private BlenderKeyConfiguration blenderKeyConfiguration;//the configuration for the files
|
private BlenderKeyConfiguration blenderKeyConfiguration;//the configuration for the files
|
||||||
private IConfigExecutable configExecutable; //this is called after clicking the 'OK' button
|
private ConfigExecutable configExecutable; //this is called after clicking the 'OK' button
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor. Builds the whole window and stores its data.
|
* Constructor. Builds the whole window and stores its data.
|
||||||
* @param testAssetsFolderName the path to test files folder
|
* @param testAssetsFolderName the path to test files folder
|
||||||
*/
|
*/
|
||||||
public ConfigDialog(String baseFolderName, IConfigExecutable configExecutable) {
|
public ConfigDialog(String baseFolderName, ConfigExecutable configExecutable) {
|
||||||
if (baseFolderName == null) {
|
if (baseFolderName == null) {
|
||||||
throw new IllegalArgumentException("No test asset folder given!");
|
throw new IllegalArgumentException("No test asset folder given!");
|
||||||
}
|
}
|
||||||
@ -71,6 +71,7 @@ public class ConfigDialog extends AbstractConfigDialog {
|
|||||||
throw new IllegalArgumentException("The given base folder path either does not exists or does not point to a directory!");
|
throw new IllegalArgumentException("The given base folder path either does not exists or does not point to a directory!");
|
||||||
}
|
}
|
||||||
File[] folders = baseFolder.listFiles(new FileFilter() {
|
File[] folders = baseFolder.listFiles(new FileFilter() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean accept(File file) {
|
public boolean accept(File file) {
|
||||||
return file.isDirectory() && file.getName().charAt(0) != '.';
|
return file.isDirectory() && file.getName().charAt(0) != '.';
|
||||||
@ -103,6 +104,7 @@ public class ConfigDialog extends AbstractConfigDialog {
|
|||||||
|
|
||||||
//loading blender files
|
//loading blender files
|
||||||
File[] blenderFiles = testAssetsFolder.listFiles(new FileFilter() {
|
File[] blenderFiles = testAssetsFolder.listFiles(new FileFilter() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean accept(File file) {
|
public boolean accept(File file) {
|
||||||
return file.isFile() && file.canRead() && file.getName().endsWith(".blend");
|
return file.isFile() && file.canRead() && file.getName().endsWith(".blend");
|
||||||
@ -111,6 +113,7 @@ public class ConfigDialog extends AbstractConfigDialog {
|
|||||||
|
|
||||||
//loading the blender files configuration
|
//loading the blender files configuration
|
||||||
File[] files = testAssetsFolder.listFiles(new FileFilter() {
|
File[] files = testAssetsFolder.listFiles(new FileFilter() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean accept(File file) {
|
public boolean accept(File file) {
|
||||||
return file.isFile() && file.canRead() && file.getName().endsWith(".conf");
|
return file.isFile() && file.canRead() && file.getName().endsWith(".conf");
|
||||||
@ -121,9 +124,9 @@ public class ConfigDialog extends AbstractConfigDialog {
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
BinaryImporter jmeImporter = new BinaryImporter();
|
BinaryImporter jmeImporter = new BinaryImporter();
|
||||||
String instructionToUser = files.length==1 ?
|
String instructionToUser = files.length == 1
|
||||||
"No other config file to load! No configuration set!" :
|
? "No other config file to load! No configuration set!"
|
||||||
"Please choose different config file!";
|
: "Please choose different config file!";
|
||||||
do {
|
do {
|
||||||
if (files.length > 1) {
|
if (files.length > 1) {
|
||||||
configFile = (File) JOptionPane.showInputDialog(null, "Choose the config file!", "Config file selection",
|
configFile = (File) JOptionPane.showInputDialog(null, "Choose the config file!", "Config file selection",
|
||||||
@ -185,8 +188,8 @@ public class ConfigDialog extends AbstractConfigDialog {
|
|||||||
for (Field field : fields) {
|
for (Field field : fields) {
|
||||||
|
|
||||||
field.setAccessible(true);
|
field.setAccessible(true);
|
||||||
if(!"animations".equalsIgnoreCase(field.getName()) &&
|
if (!"animations".equalsIgnoreCase(field.getName())
|
||||||
(field.getModifiers() & Modifier.STATIC)==0) {
|
&& (field.getModifiers() & Modifier.STATIC) == 0) {
|
||||||
try {
|
try {
|
||||||
propertiesModel.addRow(new Object[]{field.getName(), field.get(blenderKey)});
|
propertiesModel.addRow(new Object[]{field.getName(), field.get(blenderKey)});
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
@ -267,6 +270,7 @@ public class ConfigDialog extends AbstractConfigDialog {
|
|||||||
private void initListeners() {
|
private void initListeners() {
|
||||||
//selection of blender version
|
//selection of blender version
|
||||||
jComboBoxVersionSelection.addActionListener(new ActionListener() {
|
jComboBoxVersionSelection.addActionListener(new ActionListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent evt) {
|
public void actionPerformed(ActionEvent evt) {
|
||||||
//save the previous congifuration
|
//save the previous congifuration
|
||||||
@ -293,6 +297,7 @@ public class ConfigDialog extends AbstractConfigDialog {
|
|||||||
});
|
});
|
||||||
//selection of the file changes the config on the right
|
//selection of the file changes the config on the right
|
||||||
jListBlenderFiles.addListSelectionListener(new ListSelectionListener() {
|
jListBlenderFiles.addListSelectionListener(new ListSelectionListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void valueChanged(ListSelectionEvent evt) {
|
public void valueChanged(ListSelectionEvent evt) {
|
||||||
BlenderKeyConfiguration config = ConfigDialog.this.blenderKeyConfiguration;
|
BlenderKeyConfiguration config = ConfigDialog.this.blenderKeyConfiguration;
|
||||||
@ -311,6 +316,7 @@ public class ConfigDialog extends AbstractConfigDialog {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
jTableProperties.getModel().addTableModelListener(new TableModelListener() {
|
jTableProperties.getModel().addTableModelListener(new TableModelListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void tableChanged(TableModelEvent evt) {
|
public void tableChanged(TableModelEvent evt) {
|
||||||
if (evt.getType() == TableModelEvent.UPDATE) {
|
if (evt.getType() == TableModelEvent.UPDATE) {
|
||||||
@ -335,6 +341,7 @@ public class ConfigDialog extends AbstractConfigDialog {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
jTableAnimations.getModel().addTableModelListener(new TableModelListener() {
|
jTableAnimations.getModel().addTableModelListener(new TableModelListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void tableChanged(TableModelEvent evt) {
|
public void tableChanged(TableModelEvent evt) {
|
||||||
if (evt.getType() == TableModelEvent.INSERT) {
|
if (evt.getType() == TableModelEvent.INSERT) {
|
||||||
@ -345,12 +352,14 @@ public class ConfigDialog extends AbstractConfigDialog {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
jButtonAddAnimation.addActionListener(new ActionListener() {
|
jButtonAddAnimation.addActionListener(new ActionListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent evt) {
|
public void actionPerformed(ActionEvent evt) {
|
||||||
((DefaultTableModel) jTableAnimations.getModel()).addRow(new Object[]{"", "", Integer.valueOf(-1), Integer.valueOf(-1)});
|
((DefaultTableModel) jTableAnimations.getModel()).addRow(new Object[]{"", "", Integer.valueOf(-1), Integer.valueOf(-1)});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
jButtonRemoveAnimation.addActionListener(new ActionListener() {
|
jButtonRemoveAnimation.addActionListener(new ActionListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent evt) {
|
public void actionPerformed(ActionEvent evt) {
|
||||||
int row = jTableAnimations.getSelectedRow();
|
int row = jTableAnimations.getSelectedRow();
|
||||||
@ -362,11 +371,13 @@ public class ConfigDialog extends AbstractConfigDialog {
|
|||||||
|
|
||||||
//button listeners
|
//button listeners
|
||||||
jButtonOK.addActionListener(new ActionListener() {
|
jButtonOK.addActionListener(new ActionListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent evt) {
|
public void actionPerformed(ActionEvent evt) {
|
||||||
ConfigDialog.this.storeConfig(blenderKeyConfiguration);
|
ConfigDialog.this.storeConfig(blenderKeyConfiguration);
|
||||||
//running the test
|
//running the test
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
SwingUtilities.invokeLater(new Runnable() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
configExecutable.execute(ConfigDialog.this.blenderKeyConfiguration.getKeyToUse(),
|
configExecutable.execute(ConfigDialog.this.blenderKeyConfiguration.getKeyToUse(),
|
||||||
@ -378,6 +389,7 @@ public class ConfigDialog extends AbstractConfigDialog {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
jButtonCancel.addActionListener(new ActionListener() {
|
jButtonCancel.addActionListener(new ActionListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent evt) {
|
public void actionPerformed(ActionEvent evt) {
|
||||||
ConfigDialog.this.dispose();
|
ConfigDialog.this.dispose();
|
||||||
@ -391,6 +403,7 @@ public class ConfigDialog extends AbstractConfigDialog {
|
|||||||
* @author Marcin Roguski (Kaelthas)
|
* @author Marcin Roguski (Kaelthas)
|
||||||
*/
|
*/
|
||||||
public static class BlenderKeyConfiguration implements Savable {
|
public static class BlenderKeyConfiguration implements Savable {
|
||||||
|
|
||||||
private Map<String, BlenderKey> blenderKeys;
|
private Map<String, BlenderKey> blenderKeys;
|
||||||
private BlenderKey lastUsedKey;
|
private BlenderKey lastUsedKey;
|
||||||
private Level logLevel;
|
private Level logLevel;
|
||||||
@ -399,7 +412,8 @@ public class ConfigDialog extends AbstractConfigDialog {
|
|||||||
/**
|
/**
|
||||||
* Constructor for jme serialization.
|
* Constructor for jme serialization.
|
||||||
*/
|
*/
|
||||||
public BlenderKeyConfiguration() {}
|
public BlenderKeyConfiguration() {
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor that creates new empty configuration for every blender file.
|
* Constructor that creates new empty configuration for every blender file.
|
||||||
|
@ -9,7 +9,7 @@ import com.jme3.asset.ModelKey;
|
|||||||
* itself.
|
* itself.
|
||||||
* @author Marcin Roguski (Kaelthas)
|
* @author Marcin Roguski (Kaelthas)
|
||||||
*/
|
*/
|
||||||
public interface IConfigExecutable {
|
public interface ConfigExecutable {
|
||||||
/**
|
/**
|
||||||
* This method runs the test with the given blender key.
|
* This method runs the test with the given blender key.
|
||||||
* @param modelKey
|
* @param modelKey
|
@ -7,8 +7,8 @@ import java.io.ObjectOutputStream;
|
|||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
|
||||||
public class NoiseConstantsGenerator {
|
public class NoiseConstantsGenerator {
|
||||||
|
|
||||||
private static final Logger LOGGER = Logger.getLogger(NoiseConstantsGenerator.class.getName());
|
private static final Logger LOGGER = Logger.getLogger(NoiseConstantsGenerator.class.getName());
|
||||||
private static final String FILE_NAME = "noiseconstants.dat";
|
private static final String FILE_NAME = "noiseconstants.dat";
|
||||||
|
|
||||||
@ -18,7 +18,6 @@ public class NoiseConstantsGenerator {
|
|||||||
noiseConstantsGenerator.execute();
|
noiseConstantsGenerator.execute();
|
||||||
LOGGER.info("Noise data generation successfull!");
|
LOGGER.info("Noise data generation successfull!");
|
||||||
}
|
}
|
||||||
|
|
||||||
private String filePath;
|
private String filePath;
|
||||||
|
|
||||||
public void execute() {
|
public void execute() {
|
||||||
@ -59,7 +58,6 @@ public class NoiseConstantsGenerator {
|
|||||||
public void setFilePath(String filePath) {
|
public void setFilePath(String filePath) {
|
||||||
this.filePath = filePath;
|
this.filePath = filePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Constants to be stored.
|
* Constants to be stored.
|
||||||
*/
|
*/
|
||||||
@ -192,7 +190,6 @@ public class NoiseConstantsGenerator {
|
|||||||
0.689943f, 0.168671f, 0.719417f, 0.188928f, 0.330464f, 0.265273f,
|
0.689943f, 0.168671f, 0.719417f, 0.188928f, 0.330464f, 0.265273f,
|
||||||
0.446271f, 0.171933f, 0.176133f, 0.474616f, 0.140182f, 0.114246f,
|
0.446271f, 0.171933f, 0.176133f, 0.474616f, 0.140182f, 0.114246f,
|
||||||
0.905043f, 0.713870f, 0.555261f, 0.951333f};
|
0.905043f, 0.713870f, 0.555261f, 0.951333f};
|
||||||
|
|
||||||
private static short[] hash = new short[]{// 512
|
private static short[] hash = new short[]{// 512
|
||||||
0xA2, 0xA0, 0x19, 0x3B, 0xF8, 0xEB, 0xAA, 0xEE, 0xF3, 0x1C, 0x67, 0x28,
|
0xA2, 0xA0, 0x19, 0x3B, 0xF8, 0xEB, 0xAA, 0xEE, 0xF3, 0x1C, 0x67, 0x28,
|
||||||
0x1D, 0xED, 0x0, 0xDE, 0x95, 0x2E, 0xDC, 0x3F, 0x3A, 0x82, 0x35,
|
0x1D, 0xED, 0x0, 0xDE, 0x95, 0x2E, 0xDC, 0x3F, 0x3A, 0x82, 0x35,
|
||||||
@ -241,7 +238,6 @@ public class NoiseConstantsGenerator {
|
|||||||
0xF7, 0x4A, 0x41, 0x26, 0x6A, 0x16, 0x5E, 0x52, 0x2D, 0x21, 0xAD,
|
0xF7, 0x4A, 0x41, 0x26, 0x6A, 0x16, 0x5E, 0x52, 0x2D, 0x21, 0xAD,
|
||||||
0xF0, 0x91, 0xFF, 0xEA, 0x54, 0xFA, 0x66, 0x1A, 0x45, 0x39, 0xCF,
|
0xF0, 0x91, 0xFF, 0xEA, 0x54, 0xFA, 0x66, 0x1A, 0x45, 0x39, 0xCF,
|
||||||
0x75, 0xA4, 0x88, 0xFB, 0x5D};
|
0x75, 0xA4, 0x88, 0xFB, 0x5D};
|
||||||
|
|
||||||
private static float[] hashvectf = new float[]{// 768
|
private static float[] hashvectf = new float[]{// 768
|
||||||
0.33783f, 0.715698f, -0.611206f, -0.944031f, -0.326599f, -0.045624f,
|
0.33783f, 0.715698f, -0.611206f, -0.944031f, -0.326599f, -0.045624f,
|
||||||
-0.101074f, -0.416443f, -0.903503f, 0.799286f, 0.49411f,
|
-0.101074f, -0.416443f, -0.903503f, 0.799286f, 0.49411f,
|
||||||
@ -383,7 +379,6 @@ public class NoiseConstantsGenerator {
|
|||||||
0.044525f, -0.992371f, 0.966003f, 0.244873f, -0.082764f};
|
0.044525f, -0.992371f, 0.966003f, 0.244873f, -0.082764f};
|
||||||
|
|
||||||
/* ********************* FROM PERLIN HIMSELF: ******************** */
|
/* ********************* FROM PERLIN HIMSELF: ******************** */
|
||||||
|
|
||||||
// 512 + 2
|
// 512 + 2
|
||||||
private static short[] p = new short[]{0xA2, 0xA0, 0x19, 0x3B, 0xF8,
|
private static short[] p = new short[]{0xA2, 0xA0, 0x19, 0x3B, 0xF8,
|
||||||
0xEB, 0xAA, 0xEE, 0xF3, 0x1C, 0x67, 0x28, 0x1D, 0xED, 0x0, 0xDE,
|
0xEB, 0xAA, 0xEE, 0xF3, 0x1C, 0x67, 0x28, 0x1D, 0xED, 0x0, 0xDE,
|
||||||
@ -433,7 +428,6 @@ public class NoiseConstantsGenerator {
|
|||||||
0x6A, 0x16, 0x5E, 0x52, 0x2D, 0x21, 0xAD, 0xF0, 0x91, 0xFF, 0xEA,
|
0x6A, 0x16, 0x5E, 0x52, 0x2D, 0x21, 0xAD, 0xF0, 0x91, 0xFF, 0xEA,
|
||||||
0x54, 0xFA, 0x66, 0x1A, 0x45, 0x39, 0xCF, 0x75, 0xA4, 0x88, 0xFB,
|
0x54, 0xFA, 0x66, 0x1A, 0x45, 0x39, 0xCF, 0x75, 0xA4, 0x88, 0xFB,
|
||||||
0x5D, 0xA2, 0xA0};
|
0x5D, 0xA2, 0xA0};
|
||||||
|
|
||||||
// [512+2][3]
|
// [512+2][3]
|
||||||
private static float[][] g = new float[][]{
|
private static float[][] g = new float[][]{
|
||||||
{0.33783f, 0.715698f, -0.611206f},
|
{0.33783f, 0.715698f, -0.611206f},
|
||||||
@ -950,5 +944,4 @@ public class NoiseConstantsGenerator {
|
|||||||
{0.966003f, 0.244873f, -0.082764f},
|
{0.966003f, 0.244873f, -0.082764f},
|
||||||
{0.33783f, 0.715698f, -0.611206f},
|
{0.33783f, 0.715698f, -0.611206f},
|
||||||
{-0.944031f, -0.326599f, -0.045624f}};
|
{-0.944031f, -0.326599f, -0.045624f}};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,7 @@ import com.jme3.scene.shape.Sphere;
|
|||||||
* @author Marcin Roguski
|
* @author Marcin Roguski
|
||||||
*/
|
*/
|
||||||
public class Pivot extends Node {
|
public class Pivot extends Node {
|
||||||
|
|
||||||
public Pivot(AssetManager assetManager) {
|
public Pivot(AssetManager assetManager) {
|
||||||
this.attachChild(this.getAxis("x", new Vector3f(10, 0, 0), ColorRGBA.Red, assetManager));
|
this.attachChild(this.getAxis("x", new Vector3f(10, 0, 0), ColorRGBA.Red, assetManager));
|
||||||
this.attachChild(this.getAxis("y", new Vector3f(0, 10, 0), ColorRGBA.Green, assetManager));
|
this.attachChild(this.getAxis("y", new Vector3f(0, 10, 0), ColorRGBA.Green, assetManager));
|
||||||
|
@ -16,6 +16,7 @@ import com.jme3.scene.shape.Sphere;
|
|||||||
* @author Marcin Roguski
|
* @author Marcin Roguski
|
||||||
*/
|
*/
|
||||||
public class VisibleBone extends Node {
|
public class VisibleBone extends Node {
|
||||||
|
|
||||||
private Vector3f globalPosition;
|
private Vector3f globalPosition;
|
||||||
|
|
||||||
public VisibleBone(Bone bone, Vector3f parentLocation, Quaternion parentRotation, AssetManager assetManager) {
|
public VisibleBone(Bone bone, Vector3f parentLocation, Quaternion parentRotation, AssetManager assetManager) {
|
||||||
|
@ -29,7 +29,6 @@
|
|||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package jme3test.network;
|
package jme3test.network;
|
||||||
|
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
@ -38,19 +37,13 @@ import java.awt.Component;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
|
||||||
import com.jme3.network.AbstractMessage;
|
|
||||||
import com.jme3.network.Client;
|
import com.jme3.network.Client;
|
||||||
import com.jme3.network.HostedConnection;
|
|
||||||
import com.jme3.network.Message;
|
import com.jme3.network.Message;
|
||||||
import com.jme3.network.MessageListener;
|
import com.jme3.network.MessageListener;
|
||||||
import com.jme3.network.Network;
|
import com.jme3.network.Network;
|
||||||
import com.jme3.network.Server;
|
|
||||||
import com.jme3.network.serializing.Serializable;
|
|
||||||
import com.jme3.network.serializing.Serializer;
|
|
||||||
|
|
||||||
import jme3test.network.TestChatServer.ChatMessage;
|
import jme3test.network.TestChatServer.ChatMessage;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A simple test chat server. When SM implements a set
|
* A simple test chat server. When SM implements a set
|
||||||
* of standard chat classes this can become a lot simpler.
|
* of standard chat classes this can become a lot simpler.
|
||||||
@ -58,16 +51,15 @@ import jme3test.network.TestChatServer.ChatMessage;
|
|||||||
* @version $Revision$
|
* @version $Revision$
|
||||||
* @author Paul Speed
|
* @author Paul Speed
|
||||||
*/
|
*/
|
||||||
public class TestChatClient extends JFrame
|
public class TestChatClient extends JFrame {
|
||||||
{
|
|
||||||
private Client client;
|
private Client client;
|
||||||
private JEditorPane chatLog;
|
private JEditorPane chatLog;
|
||||||
private StringBuilder chatMessages = new StringBuilder();
|
private StringBuilder chatMessages = new StringBuilder();
|
||||||
private JTextField nameField;
|
private JTextField nameField;
|
||||||
private JTextField messageField;
|
private JTextField messageField;
|
||||||
|
|
||||||
public TestChatClient( String host ) throws IOException
|
public TestChatClient(String host) throws IOException {
|
||||||
{
|
|
||||||
super("jME3 Test Chat Client - to:" + host);
|
super("jME3 Test Chat Client - to:" + host);
|
||||||
|
|
||||||
// Build out the UI
|
// Build out the UI
|
||||||
@ -103,14 +95,12 @@ public class TestChatClient extends JFrame
|
|||||||
client.start();
|
client.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getString( Component owner, String title, String message, String initialValue )
|
public static String getString(Component owner, String title, String message, String initialValue) {
|
||||||
{
|
|
||||||
return (String) JOptionPane.showInputDialog(owner, message, title, JOptionPane.PLAIN_MESSAGE,
|
return (String) JOptionPane.showInputDialog(owner, message, title, JOptionPane.PLAIN_MESSAGE,
|
||||||
null, null, initialValue);
|
null, null, initialValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main( String... args ) throws Exception
|
public static void main(String... args) throws Exception {
|
||||||
{
|
|
||||||
TestChatServer.initializeClasses();
|
TestChatServer.initializeClasses();
|
||||||
|
|
||||||
// Grab a host string from the user
|
// Grab a host string from the user
|
||||||
@ -124,10 +114,9 @@ public class TestChatClient extends JFrame
|
|||||||
test.setVisible(true);
|
test.setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ChatHandler implements MessageListener<Client>
|
private class ChatHandler implements MessageListener<Client> {
|
||||||
{
|
|
||||||
public void messageReceived( Client source, Message m )
|
public void messageReceived(Client source, Message m) {
|
||||||
{
|
|
||||||
ChatMessage chat = (ChatMessage) m;
|
ChatMessage chat = (ChatMessage) m;
|
||||||
|
|
||||||
System.out.println("Received:" + chat);
|
System.out.println("Received:" + chat);
|
||||||
@ -147,18 +136,16 @@ public class TestChatClient extends JFrame
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class SendAction extends AbstractAction
|
private class SendAction extends AbstractAction {
|
||||||
{
|
|
||||||
private boolean reliable;
|
private boolean reliable;
|
||||||
|
|
||||||
public SendAction( boolean reliable )
|
public SendAction(boolean reliable) {
|
||||||
{
|
|
||||||
super(reliable ? "TCP" : "UDP");
|
super(reliable ? "TCP" : "UDP");
|
||||||
this.reliable = reliable;
|
this.reliable = reliable;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void actionPerformed( ActionEvent evt )
|
public void actionPerformed(ActionEvent evt) {
|
||||||
{
|
|
||||||
String name = nameField.getText();
|
String name = nameField.getText();
|
||||||
String message = messageField.getText();
|
String message = messageField.getText();
|
||||||
|
|
||||||
@ -169,4 +156,3 @@ public class TestChatClient extends JFrame
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,7 +29,6 @@
|
|||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package jme3test.network;
|
package jme3test.network;
|
||||||
|
|
||||||
import com.jme3.network.Message;
|
import com.jme3.network.Message;
|
||||||
@ -41,7 +40,6 @@ import com.jme3.network.Server;
|
|||||||
import com.jme3.network.serializing.Serializable;
|
import com.jme3.network.serializing.Serializable;
|
||||||
import com.jme3.network.serializing.Serializer;
|
import com.jme3.network.serializing.Serializer;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A simple test chat server. When SM implements a set
|
* A simple test chat server. When SM implements a set
|
||||||
* of standard chat classes this can become a lot simpler.
|
* of standard chat classes this can become a lot simpler.
|
||||||
@ -49,25 +47,22 @@ import com.jme3.network.serializing.Serializer;
|
|||||||
* @version $Revision$
|
* @version $Revision$
|
||||||
* @author Paul Speed
|
* @author Paul Speed
|
||||||
*/
|
*/
|
||||||
public class TestChatServer
|
public class TestChatServer {
|
||||||
{
|
|
||||||
// Normally these and the initialized method would
|
// Normally these and the initialized method would
|
||||||
// be in shared constants or something.
|
// be in shared constants or something.
|
||||||
|
|
||||||
public static final String NAME = "Test Chat Server";
|
public static final String NAME = "Test Chat Server";
|
||||||
public static final int VERSION = 1;
|
public static final int VERSION = 1;
|
||||||
|
|
||||||
public static final int PORT = 5110;
|
public static final int PORT = 5110;
|
||||||
public static final int UDP_PORT = 5110;
|
public static final int UDP_PORT = 5110;
|
||||||
|
|
||||||
public static void initializeClasses()
|
public static void initializeClasses() {
|
||||||
{
|
|
||||||
// Doing it here means that the client code only needs to
|
// Doing it here means that the client code only needs to
|
||||||
// call our initialize.
|
// call our initialize.
|
||||||
Serializer.registerClass(ChatMessage.class);
|
Serializer.registerClass(ChatMessage.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main( String... args ) throws Exception
|
public static void main(String... args) throws Exception {
|
||||||
{
|
|
||||||
initializeClasses();
|
initializeClasses();
|
||||||
|
|
||||||
// Use this to test the client/server name version check
|
// Use this to test the client/server name version check
|
||||||
@ -83,14 +78,12 @@ public class TestChatServer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class ChatHandler implements MessageListener<HostedConnection>
|
private static class ChatHandler implements MessageListener<HostedConnection> {
|
||||||
{
|
|
||||||
public ChatHandler()
|
public ChatHandler() {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void messageReceived( HostedConnection source, Message m )
|
public void messageReceived(HostedConnection source, Message m) {
|
||||||
{
|
|
||||||
if (m instanceof ChatMessage) {
|
if (m instanceof ChatMessage) {
|
||||||
// Keep track of the name just in case we
|
// Keep track of the name just in case we
|
||||||
// want to know it for some other reason later and it's
|
// want to know it for some other reason later and it's
|
||||||
@ -109,45 +102,37 @@ public class TestChatServer
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
public static class ChatMessage extends AbstractMessage
|
public static class ChatMessage extends AbstractMessage {
|
||||||
{
|
|
||||||
private String name;
|
private String name;
|
||||||
private String message;
|
private String message;
|
||||||
|
|
||||||
public ChatMessage()
|
public ChatMessage() {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ChatMessage( String name, String message )
|
public ChatMessage(String name, String message) {
|
||||||
{
|
|
||||||
setName(name);
|
setName(name);
|
||||||
setMessage(message);
|
setMessage(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setName( String name )
|
public void setName(String name) {
|
||||||
{
|
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName()
|
public String getName() {
|
||||||
{
|
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMessage( String s )
|
public void setMessage(String s) {
|
||||||
{
|
|
||||||
this.message = s;
|
this.message = s;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getMessage()
|
public String getMessage() {
|
||||||
{
|
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toString()
|
public String toString() {
|
||||||
{
|
|
||||||
return name + ":" + message;
|
return name + ":" + message;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,58 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2009-2010 jMonkeyEngine
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are
|
|
||||||
* met:
|
|
||||||
*
|
|
||||||
* * Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
*
|
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
|
||||||
* 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
|
|
||||||
* without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
|
||||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
||||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
|
||||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
||||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
||||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
||||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
||||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package jme3test.network;
|
|
||||||
|
|
||||||
import com.jme3.network.connection.Client;
|
|
||||||
import com.jme3.network.connection.Server;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.net.InetAddress;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class TestHostDiscovery {
|
|
||||||
public static void main(String[] args) throws IOException, InterruptedException{
|
|
||||||
Server server = new Server(5110, 5110);
|
|
||||||
server.start();
|
|
||||||
|
|
||||||
Client client = new Client();
|
|
||||||
client.start();
|
|
||||||
|
|
||||||
List<InetAddress> hosts = client.discoverHosts(5110, 5000);
|
|
||||||
for (InetAddress host : hosts){
|
|
||||||
System.out.println("Found host: " + host);
|
|
||||||
System.out.println("Reachable? " + host.isReachable(5000));
|
|
||||||
}
|
|
||||||
|
|
||||||
System.out.println("Connecting to: "+ hosts.get(0));
|
|
||||||
client.connect(hosts.get(0).getCanonicalHostName(), 5110, 5110);
|
|
||||||
}
|
|
||||||
}
|
|
@ -32,16 +32,18 @@
|
|||||||
|
|
||||||
package jme3test.network;
|
package jme3test.network;
|
||||||
|
|
||||||
import com.jme3.network.connection.Client;
|
import com.jme3.network.Client;
|
||||||
import com.jme3.network.connection.Server;
|
import com.jme3.network.HostedConnection;
|
||||||
import com.jme3.network.events.MessageAdapter;
|
import com.jme3.network.MessageListener;
|
||||||
import com.jme3.network.message.Message;
|
import com.jme3.network.Network;
|
||||||
|
import com.jme3.network.Server;
|
||||||
|
import com.jme3.network.Message;
|
||||||
import com.jme3.network.serializing.Serializable;
|
import com.jme3.network.serializing.Serializable;
|
||||||
import com.jme3.network.serializing.Serializer;
|
import com.jme3.network.serializing.Serializer;
|
||||||
import com.jme3.network.sync.MovingAverage;
|
import com.jme3.network.sync.MovingAverage;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class TestLatency extends MessageAdapter {
|
public class TestLatency {
|
||||||
|
|
||||||
private static long startTime;
|
private static long startTime;
|
||||||
private static Client client;
|
private static Client client;
|
||||||
@ -56,7 +58,7 @@ public class TestLatency extends MessageAdapter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
public static class TimestampMessage extends Message {
|
public static class TimestampMessage extends com.jme3.network.message.Message {
|
||||||
|
|
||||||
long timeSent = 0;
|
long timeSent = 0;
|
||||||
long timeReceived = 0;
|
long timeReceived = 0;
|
||||||
@ -73,14 +75,19 @@ public class TestLatency extends MessageAdapter {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public static void main(String[] args) throws IOException, InterruptedException{
|
||||||
public void messageReceived(Message msg){
|
Serializer.registerClass(TimestampMessage.class);
|
||||||
TimestampMessage timeMsg = (TimestampMessage) msg;
|
|
||||||
try {
|
Server server = Network.createServer(5110);
|
||||||
if (timeMsg.timeReceived == 0){
|
server.start();
|
||||||
TimestampMessage outMsg = new TimestampMessage(timeMsg.timeSent, getTime());
|
|
||||||
msg.getClient().send(outMsg);
|
client = Network.connectToServer("localhost", 5110);
|
||||||
}else{
|
client.start();
|
||||||
|
|
||||||
|
client.addMessageListener(new MessageListener<Client>(){
|
||||||
|
public void messageReceived(Client source, Message m) {
|
||||||
|
TimestampMessage timeMsg = (TimestampMessage) m;
|
||||||
|
|
||||||
long curTime = getTime();
|
long curTime = getTime();
|
||||||
//System.out.println("Time sent: " + timeMsg.timeSent);
|
//System.out.println("Time sent: " + timeMsg.timeSent);
|
||||||
//System.out.println("Time received by server: " + timeMsg.timeReceived);
|
//System.out.println("Time received by server: " + timeMsg.timeReceived);
|
||||||
@ -99,26 +106,24 @@ public class TestLatency extends MessageAdapter {
|
|||||||
|
|
||||||
client.send(new TimestampMessage(getTime(), 0));
|
client.send(new TimestampMessage(getTime(), 0));
|
||||||
}
|
}
|
||||||
} catch (IOException ex) {
|
}, TimestampMessage.class);
|
||||||
ex.printStackTrace();
|
|
||||||
|
server.addMessageListener(new MessageListener<HostedConnection>(){
|
||||||
|
public void messageReceived(HostedConnection source, Message m) {
|
||||||
|
TimestampMessage timeMsg = (TimestampMessage) m;
|
||||||
|
TimestampMessage outMsg = new TimestampMessage(timeMsg.timeSent, getTime());
|
||||||
|
source.send(outMsg);
|
||||||
}
|
}
|
||||||
}
|
}, TimestampMessage.class);
|
||||||
|
|
||||||
public static void main(String[] args) throws IOException, InterruptedException{
|
|
||||||
Serializer.registerClass(TimestampMessage.class);
|
|
||||||
|
|
||||||
Server server = new Server(5110, 5110);
|
|
||||||
server.start();
|
|
||||||
|
|
||||||
client = new Client("localhost", 5110, 5110);
|
|
||||||
client.start();
|
|
||||||
|
|
||||||
client.addMessageListener(new TestLatency(), TimestampMessage.class);
|
|
||||||
server.addMessageListener(new TestLatency(), TimestampMessage.class);
|
|
||||||
|
|
||||||
Thread.sleep(1);
|
Thread.sleep(1);
|
||||||
|
|
||||||
client.send(new TimestampMessage(getTime(), 0));
|
client.send(new TimestampMessage(getTime(), 0));
|
||||||
|
|
||||||
|
Object obj = new Object();
|
||||||
|
synchronized(obj){
|
||||||
|
obj.wait();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -32,12 +32,12 @@
|
|||||||
|
|
||||||
package jme3test.network;
|
package jme3test.network;
|
||||||
|
|
||||||
|
import com.jme3.network.AbstractMessage;
|
||||||
import com.jme3.network.Client;
|
import com.jme3.network.Client;
|
||||||
import com.jme3.network.HostedConnection;
|
import com.jme3.network.HostedConnection;
|
||||||
import com.jme3.network.MessageListener;
|
import com.jme3.network.MessageListener;
|
||||||
import com.jme3.network.Network;
|
import com.jme3.network.Network;
|
||||||
import com.jme3.network.Server;
|
import com.jme3.network.Server;
|
||||||
import com.jme3.network.message.Message;
|
|
||||||
import com.jme3.network.serializing.Serializable;
|
import com.jme3.network.serializing.Serializable;
|
||||||
import com.jme3.network.serializing.Serializer;
|
import com.jme3.network.serializing.Serializer;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -45,11 +45,11 @@ import java.io.IOException;
|
|||||||
public class TestMessages {
|
public class TestMessages {
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
public static class PingMessage extends Message {
|
public static class PingMessage extends AbstractMessage {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
public static class PongMessage extends Message {
|
public static class PongMessage extends AbstractMessage {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class ServerPingResponder implements MessageListener<HostedConnection> {
|
private static class ServerPingResponder implements MessageListener<HostedConnection> {
|
||||||
@ -76,15 +76,18 @@ public class TestMessages {
|
|||||||
Server server = Network.createServer(5110);
|
Server server = Network.createServer(5110);
|
||||||
server.start();
|
server.start();
|
||||||
|
|
||||||
Client client = Network.connectToServer("192.168.1.101", 5110, 5111);
|
Client client = Network.connectToServer("localhost", 5110);
|
||||||
client.start();
|
client.start();
|
||||||
|
|
||||||
server.addMessageListener(new ServerPingResponder(), PingMessage.class);
|
server.addMessageListener(new ServerPingResponder(), PingMessage.class);
|
||||||
client.addMessageListener(new ClientPingResponder(), PongMessage.class);
|
client.addMessageListener(new ClientPingResponder(), PongMessage.class);
|
||||||
|
|
||||||
Thread.sleep(100);
|
System.out.println("Client: Sending ping message..");
|
||||||
|
|
||||||
System.out.println("Sending ping message..");
|
|
||||||
client.send(new PingMessage());
|
client.send(new PingMessage());
|
||||||
|
|
||||||
|
Object obj = new Object();
|
||||||
|
synchronized (obj){
|
||||||
|
obj.wait();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,37 +32,39 @@
|
|||||||
|
|
||||||
package jme3test.network;
|
package jme3test.network;
|
||||||
|
|
||||||
import com.jme3.network.connection.Client;
|
import com.jme3.network.Client;
|
||||||
import com.jme3.network.connection.Server;
|
import com.jme3.network.ConnectionListener;
|
||||||
import com.jme3.network.events.ConnectionAdapter;
|
import com.jme3.network.HostedConnection;
|
||||||
|
import com.jme3.network.Network;
|
||||||
|
import com.jme3.network.Server;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
public class TestNetworkStress extends ConnectionAdapter {
|
public class TestNetworkStress implements ConnectionListener {
|
||||||
|
|
||||||
@Override
|
public void connectionAdded(Server server, HostedConnection conn) {
|
||||||
public void clientConnected(Client client) {
|
System.out.println("Client Connected: "+conn.getId());
|
||||||
System.out.println("CLIENT CONNECTED: "+client.getClientID());
|
//conn.close("goodbye");
|
||||||
try {
|
|
||||||
client.kick("goodbye");
|
|
||||||
} catch (IOException ex) {
|
|
||||||
ex.printStackTrace();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void connectionRemoved(Server server, HostedConnection conn) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) throws IOException, InterruptedException{
|
public static void main(String[] args) throws IOException, InterruptedException{
|
||||||
Logger.getLogger("").getHandlers()[0].setLevel(Level.OFF);
|
Logger.getLogger("").getHandlers()[0].setLevel(Level.OFF);
|
||||||
|
|
||||||
Server server = new Server(5110, 5110);
|
Server server = Network.createServer(5110);
|
||||||
server.start();
|
server.start();
|
||||||
server.addConnectionListener(new TestNetworkStress());
|
server.addConnectionListener(new TestNetworkStress());
|
||||||
|
|
||||||
for (int i = 0; i < 1000; i++){
|
for (int i = 0; i < 1000; i++){
|
||||||
Client client = new Client("localhost", 5110, 5110);
|
Client client = Network.connectToServer("localhost", 5110);
|
||||||
client.start();
|
client.start();
|
||||||
|
|
||||||
Thread.sleep(10);
|
Thread.sleep(10);
|
||||||
|
|
||||||
|
client.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,25 +34,45 @@ package jme3test.network;
|
|||||||
|
|
||||||
import com.jme3.app.SimpleApplication;
|
import com.jme3.app.SimpleApplication;
|
||||||
import com.jme3.export.Savable;
|
import com.jme3.export.Savable;
|
||||||
import com.jme3.network.connection.Client;
|
import com.jme3.network.Client;
|
||||||
import com.jme3.network.connection.Server;
|
import com.jme3.network.Network;
|
||||||
|
import com.jme3.network.Server;
|
||||||
|
import com.jme3.network.rmi.ObjectDef;
|
||||||
import com.jme3.network.rmi.ObjectStore;
|
import com.jme3.network.rmi.ObjectStore;
|
||||||
|
import com.jme3.network.rmi.RemoteObjectDefMessage;
|
||||||
import com.jme3.network.serializing.Serializer;
|
import com.jme3.network.serializing.Serializer;
|
||||||
import com.jme3.network.serializing.serializers.SavableSerializer;
|
import com.jme3.network.serializing.serializers.SavableSerializer;
|
||||||
import com.jme3.scene.Spatial;
|
import com.jme3.scene.Spatial;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
|
|
||||||
public class TestRemoteCall {
|
public class TestRemoteCall {
|
||||||
|
|
||||||
private static SimpleApplication serverApp;
|
private static SimpleApplication serverApp;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interface implemented by the server, exposing
|
||||||
|
* RMI calls that clients can use.
|
||||||
|
*/
|
||||||
public static interface ServerAccess {
|
public static interface ServerAccess {
|
||||||
public void attachChild(String model);
|
/**
|
||||||
|
* Attaches the model with the given name to the server's scene.
|
||||||
|
*
|
||||||
|
* @param model The model name
|
||||||
|
*
|
||||||
|
* @return True if the model was attached.
|
||||||
|
*
|
||||||
|
* @throws RuntimeException If some error occurs.
|
||||||
|
*/
|
||||||
|
public boolean attachChild(String model);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ServerAccessImpl implements ServerAccess {
|
public static class ServerAccessImpl implements ServerAccess {
|
||||||
public void attachChild(String model) {
|
public boolean attachChild(String model) {
|
||||||
|
if (model == null)
|
||||||
|
throw new RuntimeException("Cannot be null. .. etc");
|
||||||
|
|
||||||
final String finalModel = model;
|
final String finalModel = model;
|
||||||
serverApp.enqueue(new Callable<Void>() {
|
serverApp.enqueue(new Callable<Void>() {
|
||||||
public Void call() throws Exception {
|
public Void call() throws Exception {
|
||||||
@ -61,6 +81,7 @@ public class TestRemoteCall {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,7 +94,7 @@ public class TestRemoteCall {
|
|||||||
serverApp.start();
|
serverApp.start();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Server server = new Server(5110, 5110);
|
Server server = Network.createServer(5110);
|
||||||
server.start();
|
server.start();
|
||||||
|
|
||||||
ObjectStore store = new ObjectStore(server);
|
ObjectStore store = new ObjectStore(server);
|
||||||
@ -88,11 +109,12 @@ public class TestRemoteCall {
|
|||||||
|
|
||||||
createServer();
|
createServer();
|
||||||
|
|
||||||
Client client = new Client("localhost", 5110, 5110);
|
Client client = Network.connectToServer("localhost", 5110);
|
||||||
client.start();
|
client.start();
|
||||||
|
|
||||||
ObjectStore store = new ObjectStore(client);
|
ObjectStore store = new ObjectStore(client);
|
||||||
ServerAccess access = store.getExposedObject("access", ServerAccess.class, true);
|
ServerAccess access = store.getExposedObject("access", ServerAccess.class, true);
|
||||||
access.attachChild("Models/Ferrari/WheelBackLeft.mesh.xml");
|
boolean result = access.attachChild("Models/Oto/Oto.mesh.xml");
|
||||||
|
System.out.println(result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,9 +29,9 @@
|
|||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package jme3test.network;
|
package jme3test.network;
|
||||||
|
|
||||||
|
import com.jme3.network.AbstractMessage;
|
||||||
import com.jme3.network.Client;
|
import com.jme3.network.Client;
|
||||||
import com.jme3.network.Message;
|
import com.jme3.network.Message;
|
||||||
import com.jme3.network.MessageConnection;
|
import com.jme3.network.MessageConnection;
|
||||||
@ -47,17 +47,22 @@ public class TestThroughput implements MessageListener<MessageConnection> { //ex
|
|||||||
private static long lastTime = -1;
|
private static long lastTime = -1;
|
||||||
private static long counter = 0;
|
private static long counter = 0;
|
||||||
private static long total = 0;
|
private static long total = 0;
|
||||||
private static Client client;
|
|
||||||
|
|
||||||
// Change this flag to test UDP instead of TCP
|
// Change this flag to test UDP instead of TCP
|
||||||
private static boolean testReliable = false;
|
private static boolean testReliable = false;
|
||||||
|
|
||||||
private boolean isOnServer;
|
private boolean isOnServer;
|
||||||
|
|
||||||
public TestThroughput(boolean isOnServer) {
|
public TestThroughput(boolean isOnServer) {
|
||||||
this.isOnServer = isOnServer;
|
this.isOnServer = isOnServer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
public static class TestMessage extends AbstractMessage {
|
||||||
|
|
||||||
|
public TestMessage() {
|
||||||
|
setReliable(testReliable);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void messageReceived(MessageConnection source, Message msg) {
|
public void messageReceived(MessageConnection source, Message msg) {
|
||||||
|
|
||||||
@ -84,7 +89,7 @@ public class TestThroughput implements MessageListener<MessageConnection> { //ex
|
|||||||
//System.out.println( "sending:" + msg + " back to client:" + source );
|
//System.out.println( "sending:" + msg + " back to client:" + source );
|
||||||
// The 'reliable' flag is transient and the server doesn't
|
// The 'reliable' flag is transient and the server doesn't
|
||||||
// (yet) reset this value for us.
|
// (yet) reset this value for us.
|
||||||
((com.jme3.network.message.Message)msg).setReliable(testReliable);
|
((com.jme3.network.Message) msg).setReliable(testReliable);
|
||||||
source.send(msg);
|
source.send(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -116,13 +121,4 @@ public class TestThroughput implements MessageListener<MessageConnection> { //ex
|
|||||||
|
|
||||||
//Thread.sleep(5000);
|
//Thread.sleep(5000);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Serializable
|
|
||||||
public static class TestMessage extends com.jme3.network.message.Message {
|
|
||||||
|
|
||||||
public TestMessage(){
|
|
||||||
setReliable(testReliable);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user