Merge remote-tracking branch 'origin/master' into experimental
This commit is contained in:
commit
8f54af3263
@ -174,7 +174,7 @@ public class ConstraintDefinitionIK extends ConstraintDefinition {
|
|||||||
private static class BonesChain extends ArrayList<BoneContext> {
|
private static class BonesChain extends ArrayList<BoneContext> {
|
||||||
private static final long serialVersionUID = -1850524345643600718L;
|
private static final long serialVersionUID = -1850524345643600718L;
|
||||||
|
|
||||||
private List<Matrix> bonesMatrices = new ArrayList<Matrix>();
|
private List<Matrix> localBonesMatrices = new ArrayList<Matrix>();
|
||||||
|
|
||||||
public BonesChain(Bone bone, boolean useTail, int bonesAffected, Collection<Long> alteredOmas, BlenderContext blenderContext) {
|
public BonesChain(Bone bone, boolean useTail, int bonesAffected, Collection<Long> alteredOmas, BlenderContext blenderContext) {
|
||||||
if (bone != null) {
|
if (bone != null) {
|
||||||
@ -187,12 +187,21 @@ public class ConstraintDefinitionIK extends ConstraintDefinition {
|
|||||||
this.add(boneContext);
|
this.add(boneContext);
|
||||||
alteredOmas.add(boneContext.getBoneOma());
|
alteredOmas.add(boneContext.getBoneOma());
|
||||||
|
|
||||||
Space space = this.size() < bonesAffected ? Space.CONSTRAINT_SPACE_LOCAL : Space.CONSTRAINT_SPACE_WORLD;
|
Transform transform = constraintHelper.getTransform(boneContext.getArmatureObjectOMA(), boneContext.getBone().getName(), Space.CONSTRAINT_SPACE_WORLD);
|
||||||
Transform transform = constraintHelper.getTransform(boneContext.getArmatureObjectOMA(), boneContext.getBone().getName(), space);
|
localBonesMatrices.add(new DTransform(transform).toMatrix());
|
||||||
bonesMatrices.add(new DTransform(transform).toMatrix());
|
|
||||||
|
|
||||||
bone = bone.getParent();
|
bone = bone.getParent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(localBonesMatrices.size() > 0) {
|
||||||
|
// making the matrices describe the local transformation
|
||||||
|
Matrix parentWorldMatrix = localBonesMatrices.get(localBonesMatrices.size() - 1);
|
||||||
|
for(int i=localBonesMatrices.size() - 2;i>=0;--i) {
|
||||||
|
SimpleMatrix m = parentWorldMatrix.invert().mult(localBonesMatrices.get(i));
|
||||||
|
parentWorldMatrix = localBonesMatrices.get(i);
|
||||||
|
localBonesMatrices.set(i, new Matrix(m));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -211,16 +220,16 @@ public class ConstraintDefinitionIK extends ConstraintDefinition {
|
|||||||
SimpleMatrix m = parentWorldMatrix.invert().mult(boneMatrix);
|
SimpleMatrix m = parentWorldMatrix.invert().mult(boneMatrix);
|
||||||
boneMatrix = new Matrix(m);
|
boneMatrix = new Matrix(m);
|
||||||
}
|
}
|
||||||
bonesMatrices.set(index, boneMatrix);
|
localBonesMatrices.set(index, boneMatrix);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Matrix getWorldMatrix(int index) {
|
public Matrix getWorldMatrix(int index) {
|
||||||
if (index == this.size() - 1) {
|
if (index == this.size() - 1) {
|
||||||
return new Matrix(bonesMatrices.get(this.size() - 1));
|
return new Matrix(localBonesMatrices.get(this.size() - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
SimpleMatrix result = this.getWorldMatrix(index + 1);
|
SimpleMatrix result = this.getWorldMatrix(index + 1);
|
||||||
result = result.mult(bonesMatrices.get(index));
|
result = result.mult(localBonesMatrices.get(index));
|
||||||
return new Matrix(result);
|
return new Matrix(result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -180,8 +180,8 @@ public class CurvesTemporalMesh extends TemporalMesh {
|
|||||||
if (bevelObject != null && beziers.size() > 0) {
|
if (bevelObject != null && beziers.size() > 0) {
|
||||||
this.append(this.applyBevelAndTaper(this, bevelObject, taperObject, blenderContext));
|
this.append(this.applyBevelAndTaper(this, bevelObject, taperObject, blenderContext));
|
||||||
} else {
|
} else {
|
||||||
int originalVerticesAmount = vertices.size();
|
|
||||||
for (BezierLine bezierLine : beziers) {
|
for (BezierLine bezierLine : beziers) {
|
||||||
|
int originalVerticesAmount = vertices.size();
|
||||||
vertices.add(bezierLine.vertices[0]);
|
vertices.add(bezierLine.vertices[0]);
|
||||||
Vector3f v = bezierLine.vertices[1].subtract(bezierLine.vertices[0]).normalizeLocal();
|
Vector3f v = bezierLine.vertices[1].subtract(bezierLine.vertices[0]).normalizeLocal();
|
||||||
float temp = v.x;
|
float temp = v.x;
|
||||||
|
@ -135,6 +135,14 @@ public class DefaultJoystickAxis implements JoystickAxis {
|
|||||||
return deadZone;
|
return deadZone;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets/overrides the dead zone for this axis. This indicates that values
|
||||||
|
* within +/- deadZone should be ignored.
|
||||||
|
*/
|
||||||
|
public void setDeadZone( float f ) {
|
||||||
|
this.deadZone = f;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString(){
|
public String toString(){
|
||||||
return "JoystickAxis[name=" + name + ", parent=" + parent.getName() + ", id=" + axisIndex
|
return "JoystickAxis[name=" + name + ", parent=" + parent.getName() + ", id=" + axisIndex
|
||||||
|
@ -39,6 +39,7 @@ import com.jme3.math.FastMath;
|
|||||||
import com.jme3.math.Vector2f;
|
import com.jme3.math.Vector2f;
|
||||||
import com.jme3.util.IntMap;
|
import com.jme3.util.IntMap;
|
||||||
import com.jme3.util.IntMap.Entry;
|
import com.jme3.util.IntMap.Entry;
|
||||||
|
import com.jme3.util.SafeArrayList;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
@ -96,16 +97,15 @@ public class InputManager implements RawInputListener {
|
|||||||
private boolean eventsPermitted = false;
|
private boolean eventsPermitted = false;
|
||||||
private boolean mouseVisible = true;
|
private boolean mouseVisible = true;
|
||||||
private boolean safeMode = false;
|
private boolean safeMode = false;
|
||||||
private float axisDeadZone = 0.05f;
|
private float globalAxisDeadZone = 0.05f;
|
||||||
private Vector2f cursorPos = new Vector2f();
|
private final Vector2f cursorPos = new Vector2f();
|
||||||
private Joystick[] joysticks;
|
private Joystick[] joysticks;
|
||||||
private final IntMap<ArrayList<Mapping>> bindings = new IntMap<ArrayList<Mapping>>();
|
private final IntMap<ArrayList<Mapping>> bindings = new IntMap<ArrayList<Mapping>>();
|
||||||
private final HashMap<String, Mapping> mappings = new HashMap<String, Mapping>();
|
private final HashMap<String, Mapping> mappings = new HashMap<String, Mapping>();
|
||||||
private final IntMap<Long> pressedButtons = new IntMap<Long>();
|
private final IntMap<Long> pressedButtons = new IntMap<Long>();
|
||||||
private final IntMap<Float> axisValues = new IntMap<Float>();
|
private final IntMap<Float> axisValues = new IntMap<Float>();
|
||||||
private ArrayList<RawInputListener> rawListeners = new ArrayList<RawInputListener>();
|
private final SafeArrayList<RawInputListener> rawListeners = new SafeArrayList<RawInputListener>(RawInputListener.class);
|
||||||
private RawInputListener[] rawListenerArray = null;
|
private final ArrayList<InputEvent> inputQueue = new ArrayList<InputEvent>();
|
||||||
private ArrayList<InputEvent> inputQueue = new ArrayList<InputEvent>();
|
|
||||||
|
|
||||||
private static class Mapping {
|
private static class Mapping {
|
||||||
|
|
||||||
@ -248,8 +248,8 @@ public class InputManager implements RawInputListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void invokeAnalogsAndActions(int hash, float value, boolean applyTpf) {
|
private void invokeAnalogsAndActions(int hash, float value, float effectiveDeadZone, boolean applyTpf) {
|
||||||
if (value < axisDeadZone) {
|
if (value < effectiveDeadZone) {
|
||||||
invokeAnalogs(hash, value, !applyTpf);
|
invokeAnalogs(hash, value, !applyTpf);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -287,12 +287,14 @@ public class InputManager implements RawInputListener {
|
|||||||
/**
|
/**
|
||||||
* Callback from RawInputListener. Do not use.
|
* Callback from RawInputListener. Do not use.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void beginInput() {
|
public void beginInput() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Callback from RawInputListener. Do not use.
|
* Callback from RawInputListener. Do not use.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void endInput() {
|
public void endInput() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -304,17 +306,18 @@ public class InputManager implements RawInputListener {
|
|||||||
int joyId = evt.getJoyIndex();
|
int joyId = evt.getJoyIndex();
|
||||||
int axis = evt.getAxisIndex();
|
int axis = evt.getAxisIndex();
|
||||||
float value = evt.getValue();
|
float value = evt.getValue();
|
||||||
if (value < axisDeadZone && value > -axisDeadZone) {
|
float effectiveDeadZone = Math.max(globalAxisDeadZone, evt.getAxis().getDeadZone());
|
||||||
|
if (value < effectiveDeadZone && value > -effectiveDeadZone) {
|
||||||
int hash1 = JoyAxisTrigger.joyAxisHash(joyId, axis, true);
|
int hash1 = JoyAxisTrigger.joyAxisHash(joyId, axis, true);
|
||||||
int hash2 = JoyAxisTrigger.joyAxisHash(joyId, axis, false);
|
int hash2 = JoyAxisTrigger.joyAxisHash(joyId, axis, false);
|
||||||
|
|
||||||
Float val1 = axisValues.get(hash1);
|
Float val1 = axisValues.get(hash1);
|
||||||
Float val2 = axisValues.get(hash2);
|
Float val2 = axisValues.get(hash2);
|
||||||
|
|
||||||
if (val1 != null && val1.floatValue() > axisDeadZone) {
|
if (val1 != null && val1 > effectiveDeadZone) {
|
||||||
invokeActions(hash1, false);
|
invokeActions(hash1, false);
|
||||||
}
|
}
|
||||||
if (val2 != null && val2.floatValue() > axisDeadZone) {
|
if (val2 != null && val2 > effectiveDeadZone) {
|
||||||
invokeActions(hash2, false);
|
invokeActions(hash2, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -328,11 +331,11 @@ public class InputManager implements RawInputListener {
|
|||||||
// Clear the reverse direction's actions in case we
|
// Clear the reverse direction's actions in case we
|
||||||
// crossed center too quickly
|
// crossed center too quickly
|
||||||
Float otherVal = axisValues.get(otherHash);
|
Float otherVal = axisValues.get(otherHash);
|
||||||
if (otherVal != null && otherVal.floatValue() > axisDeadZone) {
|
if (otherVal != null && otherVal > effectiveDeadZone) {
|
||||||
invokeActions(otherHash, false);
|
invokeActions(otherHash, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
invokeAnalogsAndActions(hash, -value, true);
|
invokeAnalogsAndActions(hash, -value, effectiveDeadZone, true);
|
||||||
axisValues.put(hash, -value);
|
axisValues.put(hash, -value);
|
||||||
axisValues.remove(otherHash);
|
axisValues.remove(otherHash);
|
||||||
} else {
|
} else {
|
||||||
@ -342,11 +345,11 @@ public class InputManager implements RawInputListener {
|
|||||||
// Clear the reverse direction's actions in case we
|
// Clear the reverse direction's actions in case we
|
||||||
// crossed center too quickly
|
// crossed center too quickly
|
||||||
Float otherVal = axisValues.get(otherHash);
|
Float otherVal = axisValues.get(otherHash);
|
||||||
if (otherVal != null && otherVal.floatValue() > axisDeadZone) {
|
if (otherVal != null && otherVal > effectiveDeadZone) {
|
||||||
invokeActions(otherHash, false);
|
invokeActions(otherHash, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
invokeAnalogsAndActions(hash, value, true);
|
invokeAnalogsAndActions(hash, value, effectiveDeadZone, true);
|
||||||
axisValues.put(hash, value);
|
axisValues.put(hash, value);
|
||||||
axisValues.remove(otherHash);
|
axisValues.remove(otherHash);
|
||||||
}
|
}
|
||||||
@ -355,6 +358,7 @@ public class InputManager implements RawInputListener {
|
|||||||
/**
|
/**
|
||||||
* Callback from RawInputListener. Do not use.
|
* Callback from RawInputListener. Do not use.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void onJoyAxisEvent(JoyAxisEvent evt) {
|
public void onJoyAxisEvent(JoyAxisEvent evt) {
|
||||||
if (!eventsPermitted) {
|
if (!eventsPermitted) {
|
||||||
throw new UnsupportedOperationException("JoyInput has raised an event at an illegal time.");
|
throw new UnsupportedOperationException("JoyInput has raised an event at an illegal time.");
|
||||||
@ -376,6 +380,7 @@ public class InputManager implements RawInputListener {
|
|||||||
/**
|
/**
|
||||||
* Callback from RawInputListener. Do not use.
|
* Callback from RawInputListener. Do not use.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void onJoyButtonEvent(JoyButtonEvent evt) {
|
public void onJoyButtonEvent(JoyButtonEvent evt) {
|
||||||
if (!eventsPermitted) {
|
if (!eventsPermitted) {
|
||||||
throw new UnsupportedOperationException("JoyInput has raised an event at an illegal time.");
|
throw new UnsupportedOperationException("JoyInput has raised an event at an illegal time.");
|
||||||
@ -391,15 +396,15 @@ public class InputManager implements RawInputListener {
|
|||||||
|
|
||||||
if (evt.getDX() != 0) {
|
if (evt.getDX() != 0) {
|
||||||
float val = Math.abs(evt.getDX()) / 1024f;
|
float val = Math.abs(evt.getDX()) / 1024f;
|
||||||
invokeAnalogsAndActions(MouseAxisTrigger.mouseAxisHash(MouseInput.AXIS_X, evt.getDX() < 0), val, false);
|
invokeAnalogsAndActions(MouseAxisTrigger.mouseAxisHash(MouseInput.AXIS_X, evt.getDX() < 0), val, globalAxisDeadZone, false);
|
||||||
}
|
}
|
||||||
if (evt.getDY() != 0) {
|
if (evt.getDY() != 0) {
|
||||||
float val = Math.abs(evt.getDY()) / 1024f;
|
float val = Math.abs(evt.getDY()) / 1024f;
|
||||||
invokeAnalogsAndActions(MouseAxisTrigger.mouseAxisHash(MouseInput.AXIS_Y, evt.getDY() < 0), val, false);
|
invokeAnalogsAndActions(MouseAxisTrigger.mouseAxisHash(MouseInput.AXIS_Y, evt.getDY() < 0), val, globalAxisDeadZone, false);
|
||||||
}
|
}
|
||||||
if (evt.getDeltaWheel() != 0) {
|
if (evt.getDeltaWheel() != 0) {
|
||||||
float val = Math.abs(evt.getDeltaWheel()) / 100f;
|
float val = Math.abs(evt.getDeltaWheel()) / 100f;
|
||||||
invokeAnalogsAndActions(MouseAxisTrigger.mouseAxisHash(MouseInput.AXIS_WHEEL, evt.getDeltaWheel() < 0), val, false);
|
invokeAnalogsAndActions(MouseAxisTrigger.mouseAxisHash(MouseInput.AXIS_WHEEL, evt.getDeltaWheel() < 0), val, globalAxisDeadZone, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -419,6 +424,7 @@ public class InputManager implements RawInputListener {
|
|||||||
/**
|
/**
|
||||||
* Callback from RawInputListener. Do not use.
|
* Callback from RawInputListener. Do not use.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void onMouseMotionEvent(MouseMotionEvent evt) {
|
public void onMouseMotionEvent(MouseMotionEvent evt) {
|
||||||
if (!eventsPermitted) {
|
if (!eventsPermitted) {
|
||||||
throw new UnsupportedOperationException("MouseInput has raised an event at an illegal time.");
|
throw new UnsupportedOperationException("MouseInput has raised an event at an illegal time.");
|
||||||
@ -437,6 +443,7 @@ public class InputManager implements RawInputListener {
|
|||||||
/**
|
/**
|
||||||
* Callback from RawInputListener. Do not use.
|
* Callback from RawInputListener. Do not use.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void onMouseButtonEvent(MouseButtonEvent evt) {
|
public void onMouseButtonEvent(MouseButtonEvent evt) {
|
||||||
if (!eventsPermitted) {
|
if (!eventsPermitted) {
|
||||||
throw new UnsupportedOperationException("MouseInput has raised an event at an illegal time.");
|
throw new UnsupportedOperationException("MouseInput has raised an event at an illegal time.");
|
||||||
@ -459,6 +466,7 @@ public class InputManager implements RawInputListener {
|
|||||||
/**
|
/**
|
||||||
* Callback from RawInputListener. Do not use.
|
* Callback from RawInputListener. Do not use.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void onKeyEvent(KeyInputEvent evt) {
|
public void onKeyEvent(KeyInputEvent evt) {
|
||||||
if (!eventsPermitted) {
|
if (!eventsPermitted) {
|
||||||
throw new UnsupportedOperationException("KeyInput has raised an event at an illegal time.");
|
throw new UnsupportedOperationException("KeyInput has raised an event at an illegal time.");
|
||||||
@ -477,7 +485,7 @@ public class InputManager implements RawInputListener {
|
|||||||
* @param deadZone the deadzone for joystick axes.
|
* @param deadZone the deadzone for joystick axes.
|
||||||
*/
|
*/
|
||||||
public void setAxisDeadZone(float deadZone) {
|
public void setAxisDeadZone(float deadZone) {
|
||||||
this.axisDeadZone = deadZone;
|
this.globalAxisDeadZone = deadZone;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -486,7 +494,7 @@ public class InputManager implements RawInputListener {
|
|||||||
* @return the deadzone for joystick axes.
|
* @return the deadzone for joystick axes.
|
||||||
*/
|
*/
|
||||||
public float getAxisDeadZone() {
|
public float getAxisDeadZone() {
|
||||||
return axisDeadZone;
|
return globalAxisDeadZone;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -721,7 +729,6 @@ public class InputManager implements RawInputListener {
|
|||||||
*/
|
*/
|
||||||
public void addRawInputListener(RawInputListener listener) {
|
public void addRawInputListener(RawInputListener listener) {
|
||||||
rawListeners.add(listener);
|
rawListeners.add(listener);
|
||||||
rawListenerArray = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -734,7 +741,6 @@ public class InputManager implements RawInputListener {
|
|||||||
*/
|
*/
|
||||||
public void removeRawInputListener(RawInputListener listener) {
|
public void removeRawInputListener(RawInputListener listener) {
|
||||||
rawListeners.remove(listener);
|
rawListeners.remove(listener);
|
||||||
rawListenerArray = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -744,13 +750,6 @@ public class InputManager implements RawInputListener {
|
|||||||
*/
|
*/
|
||||||
public void clearRawInputListeners() {
|
public void clearRawInputListeners() {
|
||||||
rawListeners.clear();
|
rawListeners.clear();
|
||||||
rawListenerArray = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private RawInputListener[] getRawListenerArray() {
|
|
||||||
if (rawListenerArray == null)
|
|
||||||
rawListenerArray = rawListeners.toArray(new RawInputListener[rawListeners.size()]);
|
|
||||||
return rawListenerArray;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -813,7 +812,7 @@ public class InputManager implements RawInputListener {
|
|||||||
|
|
||||||
private void processQueue() {
|
private void processQueue() {
|
||||||
int queueSize = inputQueue.size();
|
int queueSize = inputQueue.size();
|
||||||
RawInputListener[] array = getRawListenerArray();
|
RawInputListener[] array = rawListeners.getArray();
|
||||||
|
|
||||||
for (RawInputListener listener : array) {
|
for (RawInputListener listener : array) {
|
||||||
listener.beginInput();
|
listener.beginInput();
|
||||||
|
@ -748,27 +748,43 @@ public class RenderManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the light filter to use when rendering Lighted Geometries
|
* Sets the light filter to use when rendering lit Geometries.
|
||||||
*
|
*
|
||||||
* @see LightFilter
|
* @see LightFilter
|
||||||
* @param lightFilter The light filter tose. Set it to null if you want all lights to be rendered
|
* @param lightFilter The light filter. Set it to null if you want all lights to be rendered.
|
||||||
*/
|
*/
|
||||||
public void setLightFilter(LightFilter lightFilter) {
|
public void setLightFilter(LightFilter lightFilter) {
|
||||||
this.lightFilter = lightFilter;
|
this.lightFilter = lightFilter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defines what light mode will be selected when a technique offers several light modes.
|
||||||
|
* @param preferredLightMode The light mode to use.
|
||||||
|
*/
|
||||||
public void setPreferredLightMode(TechniqueDef.LightMode preferredLightMode) {
|
public void setPreferredLightMode(TechniqueDef.LightMode preferredLightMode) {
|
||||||
this.preferredLightMode = preferredLightMode;
|
this.preferredLightMode = preferredLightMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* returns the preferred light mode.
|
||||||
|
* @return the light mode.
|
||||||
|
*/
|
||||||
public TechniqueDef.LightMode getPreferredLightMode() {
|
public TechniqueDef.LightMode getPreferredLightMode() {
|
||||||
return preferredLightMode;
|
return preferredLightMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* returns the number of lights used for each pass when the light mode is single pass.
|
||||||
|
* @return the number of lights.
|
||||||
|
*/
|
||||||
public int getSinglePassLightBatchSize() {
|
public int getSinglePassLightBatchSize() {
|
||||||
return singlePassLightBatchSize;
|
return singlePassLightBatchSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the number of lights to use for each pass when the light mode is single pass.
|
||||||
|
* @param singlePassLightBatchSize the number of lights.
|
||||||
|
*/
|
||||||
public void setSinglePassLightBatchSize(int singlePassLightBatchSize) {
|
public void setSinglePassLightBatchSize(int singlePassLightBatchSize) {
|
||||||
if (singlePassLightBatchSize < 1) {
|
if (singlePassLightBatchSize < 1) {
|
||||||
throw new IllegalArgumentException("batch size cannot be less than 1");
|
throw new IllegalArgumentException("batch size cannot be less than 1");
|
||||||
|
@ -198,6 +198,12 @@ public class Curve extends Mesh {
|
|||||||
* points
|
* points
|
||||||
*/
|
*/
|
||||||
private void createNurbMesh(int nbSubSegments) {
|
private void createNurbMesh(int nbSubSegments) {
|
||||||
|
if(spline.getControlPoints() != null && spline.getControlPoints().size() > 0) {
|
||||||
|
if(nbSubSegments == 0) {
|
||||||
|
nbSubSegments = spline.getControlPoints().size() + 1;
|
||||||
|
} else {
|
||||||
|
nbSubSegments = spline.getControlPoints().size() * nbSubSegments + 1;
|
||||||
|
}
|
||||||
float minKnot = spline.getMinNurbKnot();
|
float minKnot = spline.getMinNurbKnot();
|
||||||
float maxKnot = spline.getMaxNurbKnot();
|
float maxKnot = spline.getMaxNurbKnot();
|
||||||
float deltaU = (maxKnot - minKnot) / nbSubSegments;
|
float deltaU = (maxKnot - minKnot) / nbSubSegments;
|
||||||
@ -228,6 +234,7 @@ public class Curve extends Mesh {
|
|||||||
this.updateBound();
|
this.updateBound();
|
||||||
this.updateCounts();
|
this.updateCounts();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void createLinearMesh() {
|
private void createLinearMesh() {
|
||||||
float[] array = new float[spline.getControlPoints().size() * 3];
|
float[] array = new float[spline.getControlPoints().size() * 3];
|
||||||
|
@ -51,7 +51,8 @@ public class DefaultImageRaster extends ImageRaster {
|
|||||||
|
|
||||||
private void rangeCheck(int x, int y) {
|
private void rangeCheck(int x, int y) {
|
||||||
if (x < 0 || y < 0 || x >= width || y >= height) {
|
if (x < 0 || y < 0 || x >= width || y >= height) {
|
||||||
throw new IllegalArgumentException("x and y must be inside the image dimensions");
|
throw new IllegalArgumentException("x and y must be inside the image dimensions:"
|
||||||
|
+ x + ", " + y + " in:" + width + ", " + height);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -389,6 +389,7 @@ public class DefaultClient implements Client
|
|||||||
|
|
||||||
protected void startServices()
|
protected void startServices()
|
||||||
{
|
{
|
||||||
|
log.fine("Starting client services.");
|
||||||
// Let the services know we are finally started
|
// Let the services know we are finally started
|
||||||
services.start();
|
services.start();
|
||||||
}
|
}
|
||||||
@ -447,6 +448,10 @@ public class DefaultClient implements Client
|
|||||||
|
|
||||||
protected void dispatch( Message m )
|
protected void dispatch( Message m )
|
||||||
{
|
{
|
||||||
|
if( log.isLoggable(Level.FINER) ) {
|
||||||
|
log.log(Level.FINER, "{0} received:{1}", new Object[]{this, m});
|
||||||
|
}
|
||||||
|
|
||||||
// Pull off the connection management messages we're
|
// Pull off the connection management messages we're
|
||||||
// interested in and then pass on the rest.
|
// interested in and then pass on the rest.
|
||||||
if( m instanceof ClientRegistrationMessage ) {
|
if( m instanceof ClientRegistrationMessage ) {
|
||||||
|
@ -326,6 +326,10 @@ public class DefaultServer implements Server
|
|||||||
|
|
||||||
protected void dispatch( HostedConnection source, Message m )
|
protected void dispatch( HostedConnection source, Message m )
|
||||||
{
|
{
|
||||||
|
if( log.isLoggable(Level.FINER) ) {
|
||||||
|
log.log(Level.FINER, "{0} received:{1}", new Object[]{source, m});
|
||||||
|
}
|
||||||
|
|
||||||
if( source == null ) {
|
if( source == null ) {
|
||||||
messageListeners.messageReceived( source, m );
|
messageListeners.messageReceived( source, m );
|
||||||
} else {
|
} else {
|
||||||
|
@ -50,26 +50,34 @@ import java.util.logging.Logger;
|
|||||||
*/
|
*/
|
||||||
public class MessageListenerRegistry<S> implements MessageListener<S>
|
public class MessageListenerRegistry<S> implements MessageListener<S>
|
||||||
{
|
{
|
||||||
static Logger log = Logger.getLogger(MessageListenerRegistry.class.getName());
|
static final Logger log = Logger.getLogger(MessageListenerRegistry.class.getName());
|
||||||
|
|
||||||
private List<MessageListener<? super S>> listeners = new CopyOnWriteArrayList<MessageListener<? super S>>();
|
private final List<MessageListener<? super S>> listeners = new CopyOnWriteArrayList<MessageListener<? super S>>();
|
||||||
private Map<Class,List<MessageListener<? super S>>> typeListeners
|
private final Map<Class,List<MessageListener<? super S>>> typeListeners
|
||||||
= new ConcurrentHashMap<Class,List<MessageListener<? super S>>>();
|
= new ConcurrentHashMap<Class,List<MessageListener<? super S>>>();
|
||||||
|
|
||||||
public MessageListenerRegistry()
|
public MessageListenerRegistry()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void messageReceived( S source, Message m )
|
public void messageReceived( S source, Message m )
|
||||||
{
|
{
|
||||||
boolean delivered = false;
|
boolean delivered = false;
|
||||||
|
boolean trace = log.isLoggable(Level.FINER);
|
||||||
|
|
||||||
for( MessageListener<? super S> l : listeners ) {
|
for( MessageListener<? super S> l : listeners ) {
|
||||||
|
if( trace ) {
|
||||||
|
log.log(Level.FINER, "Delivering {0} to:{1}", new Object[]{m, l});
|
||||||
|
}
|
||||||
l.messageReceived( source, m );
|
l.messageReceived( source, m );
|
||||||
delivered = true;
|
delivered = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
for( MessageListener<? super S> l : getListeners(m.getClass(),false) ) {
|
for( MessageListener<? super S> l : getListeners(m.getClass(),false) ) {
|
||||||
|
if( trace ) {
|
||||||
|
log.log(Level.FINER, "Delivering {0} to:{1}", new Object[]{m, l});
|
||||||
|
}
|
||||||
l.messageReceived( source, m );
|
l.messageReceived( source, m );
|
||||||
delivered = true;
|
delivered = true;
|
||||||
}
|
}
|
||||||
|
@ -89,6 +89,10 @@ public class RmiHostedService extends AbstractHostedService {
|
|||||||
this((short)-1, (byte)MessageConnection.CHANNEL_DEFAULT_RELIABLE, true);
|
this((short)-1, (byte)MessageConnection.CHANNEL_DEFAULT_RELIABLE, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public RmiHostedService( byte defaultChannel ) {
|
||||||
|
this((short)-1, defaultChannel, true);
|
||||||
|
}
|
||||||
|
|
||||||
public RmiHostedService( short rmiId, byte defaultChannel, boolean autoHost ) {
|
public RmiHostedService( short rmiId, byte defaultChannel, boolean autoHost ) {
|
||||||
this.rmiId = rmiId;
|
this.rmiId = rmiId;
|
||||||
this.defaultChannel = defaultChannel;
|
this.defaultChannel = defaultChannel;
|
||||||
|
@ -84,6 +84,7 @@ public class RpcResponseMessage extends AbstractMessage {
|
|||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return getClass().getSimpleName() + "[#" + msgId + ", result=" + result
|
return getClass().getSimpleName() + "[#" + msgId + ", result=" + result
|
||||||
|
+ (error != null ? ", error=" + error : "")
|
||||||
+ "]";
|
+ "]";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user