formatting of MeshLoader before an upcomming change

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10538 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
rem..om 12 years ago
parent eb5525e581
commit 1e2dc1486b
  1. 55
      engine/src/ogre/com/jme3/scene/plugins/ogre/MeshLoader.java

@ -148,17 +148,17 @@ public class MeshLoader extends DefaultHandler implements AssetLoader {
public void endDocument() {
}
private void pushIndex(int index){
if (ib != null){
private void pushIndex(int index) {
if (ib != null) {
ib.put(index);
}else{
sb.put((short)index);
} else {
sb.put((short) index);
}
}
private void pushFace(String v1, String v2, String v3) throws SAXException {
// TODO: fan/strip support
switch (mesh.getMode()){
switch (mesh.getMode()) {
case Triangles:
pushIndex(parseInt(v1));
pushIndex(parseInt(v2));
@ -175,15 +175,14 @@ public class MeshLoader extends DefaultHandler implements AssetLoader {
}
// private boolean isUsingSharedVerts(Geometry geom) {
// Old code for buffer sharer
//return geom.getUserData(UserData.JME_SHAREDMESH) != null;
// Old code for buffer sharer
//return geom.getUserData(UserData.JME_SHAREDMESH) != null;
// }
private void startFaces(String count) throws SAXException {
int numFaces = parseInt(count);
int indicesPerFace = 0;
switch (mesh.getMode()){
switch (mesh.getMode()) {
case Triangles:
indicesPerFace = 3;
break;
@ -218,9 +217,9 @@ public class MeshLoader extends DefaultHandler implements AssetLoader {
// load as native jme3 material instance
try {
mat = assetManager.loadMaterial(matName);
} catch (AssetNotFoundException ex){
} catch (AssetNotFoundException ex) {
// Warning will be raised (see below)
if (!ex.getMessage().equals(matName)){
if (!ex.getMessage().equals(matName)) {
throw ex;
}
}
@ -247,10 +246,10 @@ public class MeshLoader extends DefaultHandler implements AssetLoader {
mesh = new Mesh();
if (opType == null || opType.equals("triangle_list")) {
mesh.setMode(Mesh.Mode.Triangles);
//} else if (opType.equals("triangle_strip")) {
// mesh.setMode(Mesh.Mode.TriangleStrip);
//} else if (opType.equals("triangle_fan")) {
// mesh.setMode(Mesh.Mode.TriangleFan);
//} else if (opType.equals("triangle_strip")) {
// mesh.setMode(Mesh.Mode.TriangleStrip);
//} else if (opType.equals("triangle_fan")) {
// mesh.setMode(Mesh.Mode.TriangleFan);
} else if (opType.equals("line_list")) {
mesh.setMode(Mesh.Mode.Lines);
} else {
@ -268,7 +267,7 @@ public class MeshLoader extends DefaultHandler implements AssetLoader {
// for (Entry<VertexBuffer> entry : sharedBufs) {
// mesh.setBuffer(entry.getValue());
// }
}else{
} else {
usesSharedMesh.add(false);
}
@ -302,15 +301,15 @@ public class MeshLoader extends DefaultHandler implements AssetLoader {
}
/**
* Normalizes weights if needed and finds largest amount of weights used
* for all vertices in the buffer.
* Normalizes weights if needed and finds largest amount of weights used for
* all vertices in the buffer.
*/
private void endBoneAssigns() {
// if (mesh != sharedMesh && isUsingSharedVerts(geom)) {
// return;
// }
if (!actuallyHasWeights){
if (!actuallyHasWeights) {
// No weights were actually written (the tag didn't have any entries)
// remove those buffers
mesh.clearBuffer(Type.BoneIndex);
@ -521,12 +520,12 @@ public class MeshLoader extends DefaultHandler implements AssetLoader {
VertexBuffer originalIndexBuffer = mesh.getBuffer(Type.Index);
vb = new VertexBuffer(VertexBuffer.Type.Index);
if (originalIndexBuffer.getFormat() == Format.UnsignedInt){
if (originalIndexBuffer.getFormat() == Format.UnsignedInt) {
// LOD buffer should also be integer
ib = BufferUtils.createIntBuffer(faceCount * 3);
sb = null;
vb.setupData(Usage.Static, 3, Format.UnsignedInt, ib);
}else{
} else {
sb = BufferUtils.createShortBuffer(faceCount * 3);
ib = null;
vb.setupData(Usage.Static, 3, Format.UnsignedShort, sb);
@ -593,7 +592,7 @@ public class MeshLoader extends DefaultHandler implements AssetLoader {
AssetKey assetKey = new AssetKey(folderName + name + ".xml");
try {
animData = (AnimData) assetManager.loadAsset(assetKey);
} catch (AssetNotFoundException ex){
} catch (AssetNotFoundException ex) {
logger.log(Level.WARNING, "Cannot locate {0} for model {1}", new Object[]{assetKey, key});
animData = null;
}
@ -798,8 +797,8 @@ public class MeshLoader extends DefaultHandler implements AssetLoader {
// Old code for buffer sharer
//boolean useShared = isUsingSharedVerts(g);
//if (!useShared) {
// create bind pose
//m.generateBindPose(!HARDWARE_SKINNING);
// create bind pose
//m.generateBindPose(!HARDWARE_SKINNING);
//}
}
@ -853,7 +852,7 @@ public class MeshLoader extends DefaultHandler implements AssetLoader {
logger.log(Level.WARNING, "Cannot locate {0} for model {1}", new Object[]{materialKey, key});
}
}
}else{
} else {
// Make sure to reset it to null so that previous state
// doesn't leak onto this one
materialList = null;
@ -862,12 +861,12 @@ public class MeshLoader extends DefaultHandler implements AssetLoader {
// If for some reason material list could not be found through
// OgreMeshKey, or if regular ModelKey specified, load using
// default method.
if (materialList == null){
if (materialList == null) {
OgreMaterialKey materialKey = new OgreMaterialKey(folderName + meshName + ".material");
try {
materialList = (MaterialList) assetManager.loadAsset(materialKey);
} catch (AssetNotFoundException e) {
logger.log(Level.WARNING, "Cannot locate {0} for model {1}", new Object[]{ materialKey, key });
logger.log(Level.WARNING, "Cannot locate {0} for model {1}", new Object[]{materialKey, key});
}
}
@ -888,7 +887,7 @@ public class MeshLoader extends DefaultHandler implements AssetLoader {
r = new InputStreamReader(info.openStream());
xr.parse(new InputSource(r));
} finally {
if (r != null){
if (r != null) {
r.close();
}
}

Loading…
Cancel
Save