Export back face culling flag, textures, and transparency flag.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4052 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -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")) ?
|
_boundingType = "sphere".equals(props.getProperty("bound")) ?
|
||||||
SPHERE_BOUND : BOX_BOUND;
|
SPHERE_BOUND : BOX_BOUND;
|
||||||
_texture = props.getProperty("texture");
|
_texture = props.getProperty("texture", texture);
|
||||||
_solid = !"false".equals(props.getProperty("solid"));
|
_solid = solid;
|
||||||
_transparent = "true".equals(props.getProperty("transparent"));
|
_transparent = transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -108,6 +108,15 @@ public class ModelDef
|
|||||||
/** A rigid triangle mesh. */
|
/** A rigid triangle mesh. */
|
||||||
public static class TriMeshDef extends SpatialDef
|
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. */
|
/** The vertices of the mesh. */
|
||||||
public ArrayList<Vertex> vertices = new ArrayList<Vertex>();
|
public ArrayList<Vertex> vertices = new ArrayList<Vertex>();
|
||||||
|
|
||||||
@@ -139,7 +148,7 @@ public class ModelDef
|
|||||||
protected ModelMesh configure (ModelMesh mmesh, Properties props)
|
protected ModelMesh configure (ModelMesh mmesh, Properties props)
|
||||||
{
|
{
|
||||||
// configure using properties
|
// configure using properties
|
||||||
mmesh.configure(props);
|
mmesh.configure(solid, texture, transparent, props);
|
||||||
|
|
||||||
// set the various buffers
|
// set the various buffers
|
||||||
int vsize = vertices.size();
|
int vsize = vertices.size();
|
||||||
|
|||||||
@@ -123,6 +123,15 @@ macroScript TRModelExporter category:"File" \
|
|||||||
outFile
|
outFile
|
||||||
writePoint3Attr " scale" xform.scalePart outFile
|
writePoint3Attr " scale" xform.scalePart outFile
|
||||||
if isMesh then (
|
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
|
format ">\n" to:outFile
|
||||||
if isProperty node #skin do (
|
if isProperty node #skin do (
|
||||||
setCommandPanelTaskMode mode:#modify
|
setCommandPanelTaskMode mode:#modify
|
||||||
|
|||||||
Reference in New Issue
Block a user