Revised exporter coordinate systems, updated emitter positioning.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4060 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -55,7 +55,7 @@ public abstract class EmissionController extends ModelController
|
|||||||
BufferUtils.populateFromBuffer(result,
|
BufferUtils.populateFromBuffer(result,
|
||||||
((Geometry)_target).getNormalBuffer(), 0);
|
((Geometry)_target).getNormalBuffer(), 0);
|
||||||
} else {
|
} else {
|
||||||
result.set(0f, -1f, 0f);
|
result.set(0f, 0f, -1f);
|
||||||
}
|
}
|
||||||
_target.getWorldRotation().multLocal(result);
|
_target.getWorldRotation().multLocal(result);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -520,6 +520,8 @@ public class Model extends ModelNode
|
|||||||
@Override // documentation inherited
|
@Override // documentation inherited
|
||||||
public void updateWorldData (float time)
|
public void updateWorldData (float time)
|
||||||
{
|
{
|
||||||
|
// slow evvvverything down by the animation speed
|
||||||
|
time *= _animSpeed;
|
||||||
if (_anim != null) {
|
if (_anim != null) {
|
||||||
updateAnimation(time);
|
updateAnimation(time);
|
||||||
}
|
}
|
||||||
@@ -567,7 +569,7 @@ public class Model extends ModelNode
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_elapsed += (time * _anim.frameRate * _animSpeed);
|
_elapsed += (time * _anim.frameRate);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -49,7 +49,12 @@ public abstract class ModelController extends Controller
|
|||||||
*/
|
*/
|
||||||
public void configure (Properties props, Spatial target)
|
public void configure (Properties props, Spatial target)
|
||||||
{
|
{
|
||||||
_target = target;
|
if (target instanceof ModelNode) {
|
||||||
|
_target = ((ModelNode)target).getChild("mesh");
|
||||||
|
}
|
||||||
|
if (_target == null) {
|
||||||
|
_target = target;
|
||||||
|
}
|
||||||
String[] anims = StringUtil.parseStringArray(
|
String[] anims = StringUtil.parseStringArray(
|
||||||
props.getProperty("animations", ""));
|
props.getProperty("animations", ""));
|
||||||
if (anims.length == 0) {
|
if (anims.length == 0) {
|
||||||
|
|||||||
@@ -197,6 +197,9 @@ public class ModelViewer extends JmeCanvasApp
|
|||||||
_animctrls.add(new Spacer(50, 1));
|
_animctrls.add(new Spacer(50, 1));
|
||||||
_animctrls.add(new JLabel(_msg.get("m.anim_speed")));
|
_animctrls.add(new JLabel(_msg.get("m.anim_speed")));
|
||||||
_animctrls.add(_animspeed = new JSlider(-100, +100, 0));
|
_animctrls.add(_animspeed = new JSlider(-100, +100, 0));
|
||||||
|
_animspeed.setMajorTickSpacing(10);
|
||||||
|
_animspeed.setSnapToTicks(true);
|
||||||
|
_animspeed.setPaintTicks(true);
|
||||||
_animspeed.addChangeListener(new ChangeListener() {
|
_animspeed.addChangeListener(new ChangeListener() {
|
||||||
public void stateChanged (ChangeEvent e) {
|
public void stateChanged (ChangeEvent e) {
|
||||||
updateAnimationSpeed();
|
updateAnimationSpeed();
|
||||||
@@ -484,7 +487,7 @@ public class ModelViewer extends JmeCanvasApp
|
|||||||
protected void updateAnimationSpeed ()
|
protected void updateAnimationSpeed ()
|
||||||
{
|
{
|
||||||
_model.setAnimationSpeed(
|
_model.setAnimationSpeed(
|
||||||
FastMath.pow(2f, _animspeed.getValue() / 50f));
|
FastMath.pow(2f, _animspeed.getValue() / 25f));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** The resource manager. */
|
/** The resource manager. */
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ macroScript TRAnimationExporter category:"File" \
|
|||||||
-- Writes a single animation frame
|
-- Writes a single animation frame
|
||||||
fn writeFrame nodes outFile = (
|
fn writeFrame nodes outFile = (
|
||||||
format " <frame>\n" to:outFile
|
format " <frame>\n" to:outFile
|
||||||
for node in nodes do (
|
for node in nodes do in coordsys world (
|
||||||
writeTransform node outFile
|
writeTransform node outFile
|
||||||
)
|
)
|
||||||
format " </frame>\n\n" to:outFile
|
format " </frame>\n\n" to:outFile
|
||||||
@@ -68,7 +68,7 @@ macroScript TRAnimationExporter category:"File" \
|
|||||||
) else (
|
) else (
|
||||||
nodes = objects
|
nodes = objects
|
||||||
)
|
)
|
||||||
for i = animationRange.start to animationRange.end do at time i (
|
for t = animationRange.start to animationRange.end do at time t (
|
||||||
writeFrame nodes outFile
|
writeFrame nodes outFile
|
||||||
)
|
)
|
||||||
format "</animation>\n" to:outFile
|
format "</animation>\n" to:outFile
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ macroScript TRModelExporter category:"File" \
|
|||||||
if mesh.numtverts > 0 do (
|
if mesh.numtverts > 0 do (
|
||||||
tvface = getTVFace mesh i
|
tvface = getTVFace mesh i
|
||||||
)
|
)
|
||||||
for i = 1 to 3 do in coordsys local (
|
for i = 1 to 3 do (
|
||||||
format " <vertex" to:outFile
|
format " <vertex" to:outFile
|
||||||
writePoint3Attr " location" (getVert mesh face[i]) outFile
|
writePoint3Attr " location" (getVert mesh face[i]) outFile
|
||||||
writePoint3Attr " normal" (getNormal mesh face[i]) outFile
|
writePoint3Attr " normal" (getNormal mesh face[i]) outFile
|
||||||
@@ -117,7 +117,7 @@ macroScript TRModelExporter category:"File" \
|
|||||||
writeQuatAttr " rotation" (inverse xform.rotationPart) \
|
writeQuatAttr " rotation" (inverse xform.rotationPart) \
|
||||||
outFile
|
outFile
|
||||||
writePoint3Attr " scale" xform.scalePart outFile
|
writePoint3Attr " scale" xform.scalePart outFile
|
||||||
if isMesh then (
|
if isMesh then in coordsys local (
|
||||||
writePoint3Attr " offsetTranslation" node.objectOffsetPos outFile
|
writePoint3Attr " offsetTranslation" node.objectOffsetPos outFile
|
||||||
writeQuatAttr " offsetRotation" node.objectOffsetRot outFile
|
writeQuatAttr " offsetRotation" node.objectOffsetRot outFile
|
||||||
writePoint3Attr " offsetScale" node.objectOffsetScale outFile
|
writePoint3Attr " offsetScale" node.objectOffsetScale outFile
|
||||||
@@ -156,7 +156,7 @@ macroScript TRModelExporter category:"File" \
|
|||||||
) else (
|
) else (
|
||||||
nodes = objects
|
nodes = objects
|
||||||
)
|
)
|
||||||
for node in nodes do (
|
for node in nodes do in coordsys world (
|
||||||
writeNode node outFile
|
writeNode node outFile
|
||||||
)
|
)
|
||||||
select oldsel
|
select oldsel
|
||||||
|
|||||||
Reference in New Issue
Block a user