formatting of MeshLoader before an upcomming change
git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10538 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
parent
eb5525e581
commit
1e2dc1486b
@ -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));
|
||||
@ -178,12 +178,11 @@ public class MeshLoader extends DefaultHandler implements AssetLoader {
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
@ -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;
|
||||
}
|
||||
@ -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…
x
Reference in New Issue
Block a user