* Applied abies fix to Sky rotation
* Blender importer now puts transparent materials in the transparent queue bucket * Blender importer creates RGBA8 textures as a result of blending * Blender importer - all textures are now mipmapped by default * Lighting shader now supports lightmap * Fixed GLSL 1.5 warnings * Ogre3D materials now use glow color as emissive color * MaterialLoader will now only load first texture unit instead of last * All XML loaders are now namespace aware by default so that android can properly load XML git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7792 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
parent
ef6b7157b9
commit
f41584e966
@ -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
|
||||
|
@ -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());
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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 );
|
||||
|
||||
}
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -13,9 +13,9 @@ MaterialDef Sky Plane {
|
||||
}
|
||||
|
||||
WorldParameters {
|
||||
NormalMatrix
|
||||
ViewMatrix
|
||||
ProjectionMatrix
|
||||
WorldMatrix
|
||||
}
|
||||
|
||||
Defines {
|
||||
|
@ -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 );
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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){
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
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();
|
||||
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;
|
||||
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
|
||||
|
@ -146,11 +146,11 @@ public class GLSLLoader implements AssetLoader {
|
||||
|
||||
private DependencyNode nextIndependentNode(List<DependencyNode> checkedNodes){
|
||||
Collection<DependencyNode> 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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user