[COMMITTED] OBJ transparency support fix

Hello there!!!

Current implementation of ObjToJme has a conceptual error due to mtllib attributes order.



The actual implementation needs that Ka, Ks and Kd are declared before transparency. If not alpha value gets replaced with 1 (no transparency).



This patch keeps the current value as it load the set alpha value (1 is the default), so it is possible to declare d before colors (3ds max export function does this).



Index: src/com/jmex/model/converters/ObjToJme.java
===================================================================
--- src/com/jmex/model/converters/ObjToJme.java   (revision 4247)
+++ src/com/jmex/model/converters/ObjToJme.java   (working copy)
@@ -294,15 +294,15 @@
             return;
         } else if ("Ka".equals(parts[0])) {
             curGroup.m.setAmbient(new ColorRGBA(Float.parseFloat(parts[1]),
-                    Float.parseFloat(parts[2]), Float.parseFloat(parts[3]), 1));
+                    Float.parseFloat(parts[2]), Float.parseFloat(parts[3]), curGroup.m.getAmbient().a));
             return;
         } else if ("Kd".equals(parts[0])) {
             curGroup.m.setDiffuse(new ColorRGBA(Float.parseFloat(parts[1]),
-                    Float.parseFloat(parts[2]), Float.parseFloat(parts[3]), 1));
+                    Float.parseFloat(parts[2]), Float.parseFloat(parts[3]), curGroup.m.getDiffuse().a));
             return;
         } else if ("Ks".equals(parts[0])) {
             curGroup.m.setSpecular(new ColorRGBA(Float.parseFloat(parts[1]),
-                    Float.parseFloat(parts[2]), Float.parseFloat(parts[3]), 1));
+                    Float.parseFloat(parts[2]), Float.parseFloat(parts[3]), curGroup.m.getSpecular().a));
             return;
         } else if ("Ns".equals(parts[0])) {
             float shine = Float.parseFloat(parts[1]);



Hope you like ;o)
Eduard

Hi!



Yes I like it  :smiley: I use OBJ WaveFront format quite often, it will be useful for me.

Bump :slight_smile:



has this been committed?

committed now.

please add a [committed] to the topic.



To test it, i also modified maggie.mtl, maggy has now semi transparent eyes :slight_smile:

great :wink:

thank you all for making JME :slight_smile: