diff --git a/src/java/com/threerings/jme/model/ModelMesh.java b/src/java/com/threerings/jme/model/ModelMesh.java index bf529ba7a..9432df14f 100644 --- a/src/java/com/threerings/jme/model/ModelMesh.java +++ b/src/java/com/threerings/jme/model/ModelMesh.java @@ -76,15 +76,21 @@ public class ModelMesh extends TriMesh } /** - * Configures this mesh based on the given (sub-)properties. + * Configures this mesh based on the given parameters and (sub-)properties. + * + * @param texture the texture specified in the model export, if any (can be + * overridden by a texture specified in the properties) + * @param solid whether or not the mesh allows back face culling + * @param transparent whether or not the mesh is (partially) transparent */ - public void configure (Properties props) + public void configure ( + boolean solid, String texture, boolean transparent, Properties props) { _boundingType = "sphere".equals(props.getProperty("bound")) ? SPHERE_BOUND : BOX_BOUND; - _texture = props.getProperty("texture"); - _solid = !"false".equals(props.getProperty("solid")); - _transparent = "true".equals(props.getProperty("transparent")); + _texture = props.getProperty("texture", texture); + _solid = solid; + _transparent = transparent; } /** diff --git a/src/java/com/threerings/jme/tools/ModelDef.java b/src/java/com/threerings/jme/tools/ModelDef.java index ee289cc85..28227c647 100644 --- a/src/java/com/threerings/jme/tools/ModelDef.java +++ b/src/java/com/threerings/jme/tools/ModelDef.java @@ -108,6 +108,15 @@ public class ModelDef /** A rigid triangle mesh. */ public static class TriMeshDef extends SpatialDef { + /** Whether or not the mesh allows back face culling. */ + public boolean solid; + + /** The texture of the mesh, if any. */ + public String texture; + + /** Whether or not the mesh is (partially) transparent. */ + public boolean transparent; + /** The vertices of the mesh. */ public ArrayList vertices = new ArrayList(); @@ -139,7 +148,7 @@ public class ModelDef protected ModelMesh configure (ModelMesh mmesh, Properties props) { // configure using properties - mmesh.configure(props); + mmesh.configure(solid, texture, transparent, props); // set the various buffers int vsize = vertices.size(); diff --git a/src/ms/TRModelExporter.mcr b/src/ms/TRModelExporter.mcr index 42cfa335e..2d4942726 100644 --- a/src/ms/TRModelExporter.mcr +++ b/src/ms/TRModelExporter.mcr @@ -123,6 +123,15 @@ macroScript TRModelExporter category:"File" \ outFile writePoint3Attr " scale" xform.scalePart outFile if isMesh then ( + format " solid=\"%\"" node.backFaceCull to:outFile + if node.material != undefined and + isKindOf node.material.diffuseMap BitmapTexture do ( + format " texture=\"%\"" (filenameFromPath \ + node.material.diffuseMap.filename) to:outFile + format " transparent=\"%\"" \ + (node.material.diffuseMap.bitmap.hasAlpha or \ + node.material.opacityMap != undefined) to:outFile + ) format ">\n" to:outFile if isProperty node #skin do ( setCommandPanelTaskMode mode:#modify