Fixed texture wrapping, meshes as bones, wrap/cycle mixup.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4063 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Andrzej Kapolka
2006-04-26 21:06:03 +00:00
parent 6436dc704c
commit e6ac65fd11
5 changed files with 14 additions and 7 deletions
+2 -2
View File
@@ -582,10 +582,10 @@ public class Model extends ModelNode
if (_anim.repeatType == Controller.RT_CLAMP) { if (_anim.repeatType == Controller.RT_CLAMP) {
_nidx = Math.min(_nidx + 1, nframes - 1); _nidx = Math.min(_nidx + 1, nframes - 1);
} else if (_anim.repeatType == Controller.RT_CYCLE) { } else if (_anim.repeatType == Controller.RT_WRAP) {
_nidx = (_nidx + 1) % nframes; _nidx = (_nidx + 1) % nframes;
} else { // _anim.repeatType == Controller.RT_WRAP } else { // _anim.repeatType == Controller.RT_CYCLE
if ((_nidx + _fdir) < 0 || (_nidx + _fdir) >= nframes) { if ((_nidx + _fdir) < 0 || (_nidx + _fdir) >= nframes) {
_fdir *= -1; // reverse direction _fdir *= -1; // reverse direction
} }
@@ -89,7 +89,8 @@ public class ModelMesh extends TriMesh
{ {
_boundingType = "sphere".equals(props.getProperty("bound")) ? _boundingType = "sphere".equals(props.getProperty("bound")) ?
SPHERE_BOUND : BOX_BOUND; SPHERE_BOUND : BOX_BOUND;
_texture = props.getProperty("texture", texture); _texture = (texture == null) ? null :
props.getProperty(texture, texture);
_solid = solid; _solid = solid;
_transparent = transparent; _transparent = transparent;
} }
@@ -146,10 +146,12 @@ public class ModelDef
// documentation inherited // documentation inherited
public Spatial createSpatial (Properties props) public Spatial createSpatial (Properties props)
{ {
_mesh = createMesh();
configureMesh(props);
ModelNode node = new ModelNode(name); ModelNode node = new ModelNode(name);
node.attachChild(_mesh); if (indices.size() > 0) {
_mesh = createMesh();
configureMesh(props);
node.attachChild(_mesh);
}
return node; return node;
} }
@@ -227,6 +229,9 @@ public class ModelDef
public void resolveReferences (HashMap<String, Spatial> nodes) public void resolveReferences (HashMap<String, Spatial> nodes)
{ {
super.resolveReferences(nodes); super.resolveReferences(nodes);
if (_mesh == null) {
return;
}
// divide the vertices up by weight groups // divide the vertices up by weight groups
HashMap<HashSet<ModelNode>, WeightGroupDef> groups = HashMap<HashSet<ModelNode>, WeightGroupDef> groups =
@@ -452,6 +452,7 @@ public class ModelViewer extends JmeCanvasApp
} }
Texture tex = TextureManager.loadTexture(file.toString(), Texture tex = TextureManager.loadTexture(file.toString(),
Texture.MM_LINEAR_LINEAR, Texture.FM_LINEAR); Texture.MM_LINEAR_LINEAR, Texture.FM_LINEAR);
tex.setWrap(Texture.WM_WRAP_S_WRAP_T);
if (tex == null) { if (tex == null) {
Log.warning("Couldn't find texture [path=" + file + Log.warning("Couldn't find texture [path=" + file +
"]."); "].");
+1 -1
View File
@@ -96,7 +96,7 @@ macroScript TRModelExporter category:"File" \
( (
local kind local kind
isMesh = false isMesh = false
if isKindOf node Editable_Mesh then ( if isKindOf node Editable_Mesh and not node.boneEnable then (
isMesh = true isMesh = true
if isProperty node #skin or isProperty node #physique then ( if isProperty node #skin or isProperty node #physique then (
kind = "skinMesh" kind = "skinMesh"