diff --git a/engine/src/blender/com/jme3/scene/plugins/blender/helpers/v249/MaterialHelper.java b/engine/src/blender/com/jme3/scene/plugins/blender/helpers/v249/MaterialHelper.java index ea0d29179..a49493896 100644 --- a/engine/src/blender/com/jme3/scene/plugins/blender/helpers/v249/MaterialHelper.java +++ b/engine/src/blender/com/jme3/scene/plugins/blender/helpers/v249/MaterialHelper.java @@ -58,6 +58,7 @@ import com.jme3.shader.VarType; import com.jme3.texture.Image; import com.jme3.texture.Image.Format; import com.jme3.texture.Texture; +import com.jme3.texture.Texture.MinFilter; import com.jme3.texture.Texture.WrapMode; import com.jme3.util.BufferUtils; @@ -199,6 +200,7 @@ public class MaterialHelper extends AbstractBlenderHelper { result.getAdditionalRenderState().setFaceCullMode(faceCullMode); if (transparent) { + result.setTransparent(true); result.getAdditionalRenderState().setBlendMode(BlendMode.Alpha); } @@ -249,9 +251,16 @@ public class MaterialHelper extends AbstractBlenderHelper { Pointer pTex = (Pointer) textureLink.getFieldValue("tex"); Structure tex = pTex.fetchData(dataRepository.getInputStream()).get(0); Texture texture = textureHelper.getTexture(tex, dataRepository); + + // NOTE: Enable mipmaps FOR ALL TEXTURES EVER + texture.setMinFilter(MinFilter.Trilinear); + if (texture != null) { if ((mapto & 0x01) != 0) {// Col - result.setBoolean("UseMaterialColors", Boolean.FALSE); + // Map to COLOR channel or DIFFUSE + // Set diffuse to white so it doesn't get multiplied by texture + result.setColor("Diffuse", ColorRGBA.White); + //result.setBoolean("UseMaterialColors", Boolean.FALSE); // blending the texture with material color and texture's defined color int blendType = ((Number) textureLink.getFieldValue("blendtype")).intValue(); float[] color = new float[] { ((Number) textureLink.getFieldValue("r")).floatValue(), ((Number) textureLink.getFieldValue("g")).floatValue(), ((Number) textureLink.getFieldValue("b")).floatValue() }; @@ -271,6 +280,7 @@ public class MaterialHelper extends AbstractBlenderHelper { } } if ((mapto & 0x04) != 0) {// Spec + // Map to SPECULAR result.setTexture(TEXTURE_TYPE_SPECULAR, texture); } if ((mapto & 0x40) != 0) {// Emit diff --git a/engine/src/blender/com/jme3/scene/plugins/blender/helpers/v249/MeshHelper.java b/engine/src/blender/com/jme3/scene/plugins/blender/helpers/v249/MeshHelper.java index 1388de44a..955a3349f 100644 --- a/engine/src/blender/com/jme3/scene/plugins/blender/helpers/v249/MeshHelper.java +++ b/engine/src/blender/com/jme3/scene/plugins/blender/helpers/v249/MeshHelper.java @@ -45,6 +45,7 @@ import com.jme3.material.Material; import com.jme3.math.FastMath; import com.jme3.math.Vector2f; import com.jme3.math.Vector3f; +import com.jme3.renderer.queue.RenderQueue.Bucket; import com.jme3.scene.Geometry; import com.jme3.scene.Mesh; import com.jme3.scene.VertexBuffer; @@ -365,6 +366,9 @@ public class MeshHelper extends AbstractBlenderHelper { material = nonTexturedMaterials[materialNumber]; } geometry.setMaterial(material); + if (material.isTransparent()){ + geometry.setQueueBucket(Bucket.Transparent); + } } else { geometry.setMaterial(dataRepository.getDefaultMaterial()); } diff --git a/engine/src/blender/com/jme3/scene/plugins/blender/helpers/v249/TextureHelper.java b/engine/src/blender/com/jme3/scene/plugins/blender/helpers/v249/TextureHelper.java index b31b42ae5..13e28b0e6 100644 --- a/engine/src/blender/com/jme3/scene/plugins/blender/helpers/v249/TextureHelper.java +++ b/engine/src/blender/com/jme3/scene/plugins/blender/helpers/v249/TextureHelper.java @@ -1033,9 +1033,9 @@ public class TextureHelper extends AbstractBlenderHelper { data.rewind(); int width = texture.getImage().getWidth(); int height = texture.getImage().getHeight(); - ByteBuffer newData = BufferUtils.createByteBuffer(width * height * 3); + ByteBuffer newData = BufferUtils.createByteBuffer(width * height * 4); - float[] resultPixel = new float[3]; + float[] resultPixel = new float[4]; int dataIndex = 0; while (data.hasRemaining()) { float tin = this.setupMaterialColor(data, format, neg, materialColorClone); @@ -1043,8 +1043,9 @@ public class TextureHelper extends AbstractBlenderHelper { newData.put(dataIndex++, (byte) (resultPixel[0] * 255.0f)); newData.put(dataIndex++, (byte) (resultPixel[1] * 255.0f)); newData.put(dataIndex++, (byte) (resultPixel[2] * 255.0f)); + newData.put(dataIndex++, (byte) (1.0 * 255.0f)); } - return new Texture2D(new Image(Format.RGB8, width, height, newData)); + return new Texture2D(new Image(Format.RGBA8, width, height, newData)); } /** @@ -1144,7 +1145,7 @@ public class TextureHelper extends AbstractBlenderHelper { case RGBA16: case RGBA16F: case RGBA32F: - LOGGER.warning("Image type not yet supported for blending: " + imageFormat); + LOGGER.log(Level.WARNING, "Image type not yet supported for blending: {0}", imageFormat); break; default: throw new IllegalStateException("Unknown image format type: " + imageFormat); diff --git a/engine/src/core-data/Common/MatDefs/Blur/RadialBlur15.frag b/engine/src/core-data/Common/MatDefs/Blur/RadialBlur15.frag index 8b1f1213e..cc403501b 100644 --- a/engine/src/core-data/Common/MatDefs/Blur/RadialBlur15.frag +++ b/engine/src/core-data/Common/MatDefs/Blur/RadialBlur15.frag @@ -4,7 +4,9 @@ uniform COLORTEXTURE m_Texture; uniform float m_SampleDist; uniform float m_SampleStrength; uniform float m_Samples[10]; + in vec2 texCoord; +out vec4 outFragColor; void main(void) { @@ -43,6 +45,6 @@ void main(void) t = clamp( t ,0.0,1.0); //0 <= t <= 1 //Blend the original color with the averaged pixels - gl_FragColor =mix( colorRes, sum, t ); + outFragColor =mix( colorRes, sum, t ); } \ No newline at end of file diff --git a/engine/src/core-data/Common/MatDefs/Light/Lighting.frag b/engine/src/core-data/Common/MatDefs/Light/Lighting.frag index 0a7a02b12..cd931b367 100644 --- a/engine/src/core-data/Common/MatDefs/Light/Lighting.frag +++ b/engine/src/core-data/Common/MatDefs/Light/Lighting.frag @@ -3,6 +3,9 @@ //#define HQ_ATTENUATION varying vec2 texCoord; +#ifdef SEPARATE_TEXCOORD + varying vec2 texCoord2; +#endif varying vec4 AmbientSum; varying vec4 DiffuseSum; @@ -25,6 +28,10 @@ varying vec4 SpecularSum; #ifdef PARALLAXMAP uniform sampler2D m_ParallaxMap; #endif + +#ifdef LIGHTMAP + uniform sampler2D m_LightMap; +#endif #ifdef NORMALMAP uniform sampler2D m_NormalMap; @@ -170,6 +177,17 @@ void main(){ vec4 specularColor = vec4(1.0); #endif + #ifdef LIGHTMAP + vec3 lightMapColor; + #ifdef SEPARATE_TEXCOORD + lightMapColor = texture2D(m_LightMap, texCoord2).rgb; + #else + lightMapColor = texture2D(m_LightMap, texCoord).rgb; + #endif + specularColor.rgb *= lightMapColor; + diffuseColor.rgb *= lightMapColor; + #endif + #ifdef VERTEX_LIGHTING vec2 light = vec2(AmbientSum.a, SpecularSum.a); #ifdef COLORRAMP diff --git a/engine/src/core-data/Common/MatDefs/Light/Lighting.j3md b/engine/src/core-data/Common/MatDefs/Light/Lighting.j3md index afb721e64..32502028a 100644 --- a/engine/src/core-data/Common/MatDefs/Light/Lighting.j3md +++ b/engine/src/core-data/Common/MatDefs/Light/Lighting.j3md @@ -70,6 +70,12 @@ MaterialDef Phong Lighting { // Texture of the glowing parts of the material Texture2D GlowMap + // Set to Use Lightmap + Texture2D LightMap + + // Set to use TexCoord2 for the lightmap sampling + Boolean SeparateTexCoord + // The glow color of the object Color GlowColor @@ -120,6 +126,8 @@ MaterialDef Phong Lighting { PARALLAXMAP : ParallaxMap ALPHAMAP : AlphaMap COLORRAMP : ColorRamp + LIGHTMAP : LightMap + SEPARATE_TEXCOORD : SeparateTexCoord USE_REFLECTION : EnvMap SPHERE_MAP : SphereMap diff --git a/engine/src/core-data/Common/MatDefs/Light/Lighting.vert b/engine/src/core-data/Common/MatDefs/Light/Lighting.vert index 7de7713e4..a74fe9438 100644 --- a/engine/src/core-data/Common/MatDefs/Light/Lighting.vert +++ b/engine/src/core-data/Common/MatDefs/Light/Lighting.vert @@ -16,6 +16,10 @@ uniform vec4 g_LightPosition; uniform vec4 g_AmbientLightColor; varying vec2 texCoord; +#ifdef SEPARATE_TEXCOORD + varying vec2 texCoord2; + attribute vec2 inTexCoord2; +#endif varying vec4 AmbientSum; varying vec4 DiffuseSum; @@ -118,6 +122,9 @@ void main(){ vec4 pos = vec4(inPosition, 1.0); gl_Position = g_WorldViewProjectionMatrix * pos; texCoord = inTexCoord; + #ifdef SEPARATE_TEXCOORD + texCoord2 = inTexCoord2; + #endif vec3 wvPosition = (g_WorldViewMatrix * pos).xyz; vec3 wvNormal = normalize(g_NormalMatrix * inNormal); diff --git a/engine/src/core-data/Common/MatDefs/Misc/Sky.frag b/engine/src/core-data/Common/MatDefs/Misc/Sky.frag index 1c4dbbe96..3e36e0af5 100644 --- a/engine/src/core-data/Common/MatDefs/Misc/Sky.frag +++ b/engine/src/core-data/Common/MatDefs/Misc/Sky.frag @@ -5,12 +5,7 @@ uniform ENVMAP m_Texture; varying vec3 direction; void main() { - //gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0); - - //gl_FragDepth = 1.0; vec3 dir = normalize(direction); gl_FragColor = Optics_GetEnvColor(m_Texture, direction); - //gl_FragColor = vec4(textureCube(m_Texture, dir).xyz, 1.0); - //gl_FragColor = vec4((dir * vec3(0.5)) + vec3(0.5), 1.0); } diff --git a/engine/src/core-data/Common/MatDefs/Misc/Sky.j3md b/engine/src/core-data/Common/MatDefs/Misc/Sky.j3md index 3a9c05ee0..919309b30 100644 --- a/engine/src/core-data/Common/MatDefs/Misc/Sky.j3md +++ b/engine/src/core-data/Common/MatDefs/Misc/Sky.j3md @@ -13,9 +13,9 @@ MaterialDef Sky Plane { } WorldParameters { - NormalMatrix ViewMatrix ProjectionMatrix + WorldMatrix } Defines { diff --git a/engine/src/core-data/Common/MatDefs/Misc/Sky.vert b/engine/src/core-data/Common/MatDefs/Misc/Sky.vert index 63c58a453..f4cee113d 100644 --- a/engine/src/core-data/Common/MatDefs/Misc/Sky.vert +++ b/engine/src/core-data/Common/MatDefs/Misc/Sky.vert @@ -1,6 +1,5 @@ uniform mat4 g_ViewMatrix; uniform mat4 g_ProjectionMatrix; -uniform mat3 g_NormalMatrix; uniform vec3 m_NormalScale; @@ -20,5 +19,6 @@ void main(){ pos.w = 1.0; gl_Position = g_ProjectionMatrix * pos; - direction = normalize(inNormal * m_NormalScale); + vec4 normal = vec4(inNormal * m_NormalScale, 0.0); + direction = normalize( (g_WorldMatrix * normal).xyz ); } diff --git a/engine/src/core-data/Common/MatDefs/Post/bloomExtract15.frag b/engine/src/core-data/Common/MatDefs/Post/bloomExtract15.frag index f5cfea91e..aeb2e1105 100644 --- a/engine/src/core-data/Common/MatDefs/Post/bloomExtract15.frag +++ b/engine/src/core-data/Common/MatDefs/Post/bloomExtract15.frag @@ -6,18 +6,17 @@ uniform float m_ExposurePow; uniform float m_ExposureCutoff; in vec2 texCoord; +out vec4 outFragColor; #ifdef HAS_GLOWMAP uniform sampler2D m_GlowMap; #endif void main(){ - vec4 color; + vec4 color = vec4(0.0); #ifdef DO_EXTRACT color = getColor(m_Texture, texCoord); - if ( (color.r + color.g + color.b) / 3.0 < m_ExposureCutoff ) { - color = vec4(0.0); - }else{ + if ( (color.r + color.g + color.b) / 3.0 >= m_ExposureCutoff ) { color = pow(color, vec4(m_ExposurePow)); } #endif @@ -28,5 +27,5 @@ void main(){ color += glowColor; #endif - gl_FragColor = color; + outFragColor = color; } diff --git a/engine/src/core-data/Common/MatDefs/SSAO/ssao15.frag b/engine/src/core-data/Common/MatDefs/SSAO/ssao15.frag index bde22e3aa..de3b8468c 100644 --- a/engine/src/core-data/Common/MatDefs/SSAO/ssao15.frag +++ b/engine/src/core-data/Common/MatDefs/SSAO/ssao15.frag @@ -14,7 +14,7 @@ uniform float m_Scale; uniform float m_Bias; uniform vec2[4] m_Samples; -varying vec2 texCoord; +in vec2 texCoord; float depthv; diff --git a/engine/src/core-data/Common/MatDefs/SSAO/ssaoBlur15.frag b/engine/src/core-data/Common/MatDefs/SSAO/ssaoBlur15.frag index 34acae28b..e90a76f9e 100644 --- a/engine/src/core-data/Common/MatDefs/SSAO/ssaoBlur15.frag +++ b/engine/src/core-data/Common/MatDefs/SSAO/ssaoBlur15.frag @@ -10,7 +10,7 @@ uniform float m_XScale; uniform float m_YScale; uniform vec2 m_FrustumNearFar; -varying vec2 texCoord; +in vec2 texCoord; vec4 getResult(vec4 color){ diff --git a/engine/src/core-data/Common/MatDefs/Shadow/PostShadowPSSM.vert b/engine/src/core-data/Common/MatDefs/Shadow/PostShadowPSSM.vert index 122653996..5d1df2258 100644 --- a/engine/src/core-data/Common/MatDefs/Shadow/PostShadowPSSM.vert +++ b/engine/src/core-data/Common/MatDefs/Shadow/PostShadowPSSM.vert @@ -1,3 +1,8 @@ +/////////// + + + + uniform mat4 m_LightViewProjectionMatrix0; uniform mat4 m_LightViewProjectionMatrix1; uniform mat4 m_LightViewProjectionMatrix2; @@ -6,14 +11,14 @@ uniform mat4 m_LightViewProjectionMatrix3; uniform mat4 g_WorldViewProjectionMatrix; uniform mat4 g_WorldMatrix; -varying vec4 projCoord0; -varying vec4 projCoord1; -varying vec4 projCoord2; -varying vec4 projCoord3; +out vec4 projCoord0; +out vec4 projCoord1; +out vec4 projCoord2; +out vec4 projCoord3; -varying float shadowPosition; +out float shadowPosition; -attribute vec3 inPosition; +in vec3 inPosition; const mat4 biasMat = mat4(0.5, 0.0, 0.0, 0.0, 0.0, 0.5, 0.0, 0.0, @@ -22,8 +27,8 @@ const mat4 biasMat = mat4(0.5, 0.0, 0.0, 0.0, void main(){ - gl_Position = g_WorldViewProjectionMatrix * vec4(inPosition, 1.0); + shadowPosition = gl_Position.z; // get the vertex in world space vec4 worldPos = g_WorldMatrix * vec4(inPosition, 1.0); diff --git a/engine/src/core-data/Common/MatDefs/Shadow/PostShadowPSSM15.frag b/engine/src/core-data/Common/MatDefs/Shadow/PostShadowPSSM15.frag index 1c2cfb16d..18b4c816a 100644 --- a/engine/src/core-data/Common/MatDefs/Shadow/PostShadowPSSM15.frag +++ b/engine/src/core-data/Common/MatDefs/Shadow/PostShadowPSSM15.frag @@ -1,4 +1,4 @@ -#extension GL_ARB_texture_gather : enable +#extension GL_ARB_texture_gather : enable #extension GL_ARB_gpu_shader5 : enable #ifdef HARDWARE_SHADOWS diff --git a/engine/src/core/com/jme3/animation/BoneAnimation.java b/engine/src/core/com/jme3/animation/BoneAnimation.java index 7f0f39289..895310de0 100644 --- a/engine/src/core/com/jme3/animation/BoneAnimation.java +++ b/engine/src/core/com/jme3/animation/BoneAnimation.java @@ -124,37 +124,37 @@ public final class BoneAnimation implements Savable, Cloneable { } @Override - public BoneAnimation clone() { - BoneAnimation result; - try { - result = (BoneAnimation)super.clone(); - } catch (CloneNotSupportedException e) { - result = new BoneAnimation(name, length); - } - if(result.tracks == null) { - result.tracks = new BoneTrack[tracks.length]; - } - for (int i = 0; i < tracks.length; ++i) { - int tablesLength = tracks[i].getTimes().length; - - float[] times = tracks[i].getTimes().clone(); - Vector3f[] sourceTranslations = tracks[i].getTranslations(); - Quaternion[] sourceRotations = tracks[i].getRotations(); - Vector3f[] sourceScales = tracks[i].getScales(); - - Vector3f[] translations = new Vector3f[tablesLength]; - Quaternion[] rotations = new Quaternion[tablesLength]; - Vector3f[] scales = new Vector3f[tablesLength]; - for (int j = 0; j < tablesLength; ++j) { - translations[j] = sourceTranslations[j].clone(); - rotations[j] = sourceRotations[j].clone(); - scales[j] = sourceScales != null ? sourceScales[j].clone() : new Vector3f(1.0f, 1.0f, 1.0f); - } - // times do not change, no need to clone them - result.tracks[i] = new BoneTrack(tracks[i].getTargetBoneIndex(), times, - translations, rotations, scales); - } - return result; + public BoneAnimation clone() { + BoneAnimation result; + try { + result = (BoneAnimation) super.clone(); + } catch (CloneNotSupportedException e) { + result = new BoneAnimation(name, length); + } + if (result.tracks == null) { + result.tracks = new BoneTrack[tracks.length]; + } + for (int i = 0; i < tracks.length; ++i) { + int tablesLength = tracks[i].getTimes().length; + + float[] times = tracks[i].getTimes().clone(); + Vector3f[] sourceTranslations = tracks[i].getTranslations(); + Quaternion[] sourceRotations = tracks[i].getRotations(); + Vector3f[] sourceScales = tracks[i].getScales(); + + Vector3f[] translations = new Vector3f[tablesLength]; + Quaternion[] rotations = new Quaternion[tablesLength]; + Vector3f[] scales = new Vector3f[tablesLength]; + for (int j = 0; j < tablesLength; ++j) { + translations[j] = sourceTranslations[j].clone(); + rotations[j] = sourceRotations[j].clone(); + scales[j] = sourceScales != null ? sourceScales[j].clone() : new Vector3f(1.0f, 1.0f, 1.0f); + } + // times do not change, no need to clone them + result.tracks[i] = new BoneTrack(tracks[i].getTargetBoneIndex(), times, + translations, rotations, scales); + } + return result; } @Override diff --git a/engine/src/core/com/jme3/shader/plugins/GLSLLoader.java b/engine/src/core/com/jme3/shader/plugins/GLSLLoader.java index c7da6c6d0..12f7a0069 100644 --- a/engine/src/core/com/jme3/shader/plugins/GLSLLoader.java +++ b/engine/src/core/com/jme3/shader/plugins/GLSLLoader.java @@ -146,11 +146,11 @@ public class GLSLLoader implements AssetLoader { private DependencyNode nextIndependentNode(List checkedNodes){ Collection allNodes = dependCache.values(); - if (allNodes == null || allNodes.size() == 0) + if (allNodes == null || allNodes.isEmpty()) return null; for (DependencyNode node : allNodes){ - if (node.dependsOn.size() == 0){ + if (node.dependsOn.isEmpty()){ return node; } } diff --git a/engine/src/ogre/com/jme3/scene/plugins/ogre/MaterialLoader.java b/engine/src/ogre/com/jme3/scene/plugins/ogre/MaterialLoader.java index b1a4bff0b..b5d49e304 100644 --- a/engine/src/ogre/com/jme3/scene/plugins/ogre/MaterialLoader.java +++ b/engine/src/ogre/com/jme3/scene/plugins/ogre/MaterialLoader.java @@ -63,7 +63,7 @@ public class MaterialLoader implements AssetLoader { private String folderName; private AssetManager assetManager; private Scanner scan; - private ColorRGBA ambient, diffuse, specular; + private ColorRGBA ambient, diffuse, specular, emissive; private Texture texture; private String texName; private String matName; @@ -72,6 +72,7 @@ public class MaterialLoader implements AssetLoader { private boolean blend = false; private boolean twoSide = false; private boolean noLight = false; + private boolean readTexUnit = false; private String readString(String end){ scan.useDelimiter(end); @@ -191,7 +192,7 @@ public class MaterialLoader implements AssetLoader { } } - private void readTextureUnit(){ + private void readTextureUnit(boolean skipIt){ // name is optional if (!scan.hasNext("\\{")){ texName = readString("\\{"); @@ -200,10 +201,16 @@ public class MaterialLoader implements AssetLoader { } scan.next(); // skip "{" - texture = new Texture2D(); + if (!skipIt){ + texture = new Texture2D(); + } while (!scan.hasNext("\\}")){ - readTextureUnitStatement(); + if (skipIt){ + readString("\n"); + }else{ + readTextureUnitStatement(); + } } scan.next(); // skip "}" } @@ -231,6 +238,8 @@ public class MaterialLoader implements AssetLoader { }else{ ambient = readColor(); } + }else if (keyword.equals("emissive")){ + emissive = readColor(); }else if (keyword.equals("specular")){ specular = new ColorRGBA(); specular.r = scan.nextFloat(); @@ -247,7 +256,11 @@ public class MaterialLoader implements AssetLoader { shinines = unknown; } }else if (keyword.equals("texture_unit")){ - readTextureUnit(); + readTextureUnit(readTexUnit); + // After reading the first texunit, ignore the rest + if (!readTexUnit) { + readTexUnit = true; + } }else if (keyword.equals("scene_blend")){ if (scan.hasNextInt()){ readString("\n"); // blender2ogre workaround @@ -292,6 +305,10 @@ public class MaterialLoader implements AssetLoader { name = readString("\\{"); } scan.next(); // skip "{" + + // Has not yet read a tex unit for this pass + readTexUnit = false; + while (!scan.hasNext("\\}")){ readPassStatement(); } @@ -370,11 +387,12 @@ public class MaterialLoader implements AssetLoader { } if (!noLight){ - if (shinines > 0f) + if (shinines > 0f) { mat.setFloat("Shininess", shinines); - else + } else { mat.setFloat("Shininess", 16f); // set shininess to some value anyway.. - + } + if (vcolor) mat.setBoolean("UseVertexColor", true); @@ -399,16 +417,26 @@ public class MaterialLoader implements AssetLoader { }else{ mat.setColor("Specular", ColorRGBA.Black); } + + if (emissive != null){ + mat.setColor("GlowColor", emissive); + } }else{ - if (vcolor) + if (vcolor) { mat.setBoolean("VertexColor", true); + } - if (texture != null) + if (texture != null) { mat.setTexture("ColorMap", texture); + } if(diffuse != null){ mat.setColor("Color", diffuse); } + + if (emissive != null){ + mat.setColor("GlowColor", emissive); + } } noLight = false; diff --git a/engine/src/ogre/com/jme3/scene/plugins/ogre/MeshLoader.java b/engine/src/ogre/com/jme3/scene/plugins/ogre/MeshLoader.java index d15b5aba6..19e4b6cce 100644 --- a/engine/src/ogre/com/jme3/scene/plugins/ogre/MeshLoader.java +++ b/engine/src/ogre/com/jme3/scene/plugins/ogre/MeshLoader.java @@ -269,7 +269,7 @@ public class MeshLoader extends DefaultHandler implements AssetLoader { sharedMesh = new Mesh(); vertCount = parseInt(vertexcount); usesSharedVerts = false; - + geom = null; mesh = sharedMesh; } @@ -586,7 +586,6 @@ public class MeshLoader extends DefaultHandler implements AssetLoader { if (count == null) { count = attribs.getValue("count"); } - startGeometry(count); } else if (qName.equals("vertexbuffer")) { startVertexBuffer(attribs); @@ -617,6 +616,8 @@ public class MeshLoader extends DefaultHandler implements AssetLoader { // ok } else if (qName.equals("skeletonlink")) { startSkeleton(attribs.getValue("name")); + } else if (qName.equals("submeshnames")) { + // ok } else if (qName.equals("submeshname")) { startSubmeshName(attribs.getValue("index"), attribs.getValue("name")); } else if (qName.equals("mesh")) { @@ -696,7 +697,7 @@ public class MeshLoader extends DefaultHandler implements AssetLoader { for (int i = 0; i < geoms.size(); i++) { Geometry g = geoms.get(i); Mesh m = g.getMesh(); - if (sharedMesh != null && isUsingSharedVerts(geom)) { + if (sharedMesh != null && isUsingSharedVerts(g)) { m.setBound(sharedMesh.getBound().clone()); } model.attachChild(geoms.get(i)); @@ -797,14 +798,12 @@ public class MeshLoader extends DefaultHandler implements AssetLoader { // Added by larynx 25.06.2011 // Android needs the namespace aware flag set to true - XMLReader xr; - if (JmeSystem.getFullName().toUpperCase().contains("ANDROID")) { - SAXParserFactory factory = SAXParserFactory.newInstance(); - factory.setNamespaceAware(true); - xr = factory.newSAXParser().getXMLReader(); - } else { - xr = XMLReaderFactory.createXMLReader(); - } + // Kirill 30.06.2011 + // Now, hack is applied for both desktop and android to avoid + // checking with JmeSystem. + SAXParserFactory factory = SAXParserFactory.newInstance(); + factory.setNamespaceAware(true); + XMLReader xr = factory.newSAXParser().getXMLReader(); xr.setContentHandler(this); xr.setErrorHandler(this); diff --git a/engine/src/ogre/com/jme3/scene/plugins/ogre/SceneLoader.java b/engine/src/ogre/com/jme3/scene/plugins/ogre/SceneLoader.java index 3a0808870..7474e829d 100644 --- a/engine/src/ogre/com/jme3/scene/plugins/ogre/SceneLoader.java +++ b/engine/src/ogre/com/jme3/scene/plugins/ogre/SceneLoader.java @@ -358,14 +358,12 @@ public class SceneLoader extends DefaultHandler implements AssetLoader { // Added by larynx 25.06.2011 // Android needs the namespace aware flag set to true - XMLReader xr; - if (JmeSystem.getFullName().toUpperCase().contains("ANDROID")) { - SAXParserFactory factory = SAXParserFactory.newInstance(); - factory.setNamespaceAware(true); - xr = factory.newSAXParser().getXMLReader(); - } else { - xr = XMLReaderFactory.createXMLReader(); - } + // Kirill 30.06.2011 + // Now, hack is applied for both desktop and android to avoid + // checking with JmeSystem. + SAXParserFactory factory = SAXParserFactory.newInstance(); + factory.setNamespaceAware(true); + XMLReader xr = factory.newSAXParser().getXMLReader(); xr.setContentHandler(this); xr.setErrorHandler(this); diff --git a/engine/src/ogre/com/jme3/scene/plugins/ogre/SkeletonLoader.java b/engine/src/ogre/com/jme3/scene/plugins/ogre/SkeletonLoader.java index 5cd0102fe..a4012a5f3 100644 --- a/engine/src/ogre/com/jme3/scene/plugins/ogre/SkeletonLoader.java +++ b/engine/src/ogre/com/jme3/scene/plugins/ogre/SkeletonLoader.java @@ -261,15 +261,13 @@ public class SkeletonLoader extends DefaultHandler implements AssetLoader { // Added by larynx 25.06.2011 // Android needs the namespace aware flag set to true - XMLReader xr; - if (JmeSystem.getFullName().toUpperCase().contains("ANDROID")) { - SAXParserFactory factory = SAXParserFactory.newInstance(); - factory.setNamespaceAware(true); - xr = factory.newSAXParser().getXMLReader(); - } else { - xr = XMLReaderFactory.createXMLReader(); - } - + // Kirill 30.06.2011 + // Now, hack is applied for both desktop and android to avoid + // checking with JmeSystem. + SAXParserFactory factory = SAXParserFactory.newInstance(); + factory.setNamespaceAware(true); + XMLReader xr = factory.newSAXParser().getXMLReader(); + xr.setContentHandler(this); xr.setErrorHandler(this); InputStreamReader r = new InputStreamReader(in);