Browse Source

The ShaderNodes system now correctly handles swizzle of types like ivecn, uvecn, bvecn

Nehon 11 năm trước cách đây
mục cha
commit
e898f26cf4
1 tập tin đã thay đổi với 2 bổ sung2 xóa
  1. 2 2
      jme3-core/src/main/java/com/jme3/shader/ShaderUtils.java

+ 2 - 2
jme3-core/src/main/java/com/jme3/shader/ShaderUtils.java

@@ -117,7 +117,7 @@ public class ShaderUtils {
                     card = 0;
                 }
             } else {
-                card = Integer.parseInt(type.replaceAll("vec", ""));
+                card = Integer.parseInt(type.replaceAll(".*vec", ""));
 
                 if (swizzling.length() > 0) {
                     if (card >= swizzling.length()) {
@@ -138,6 +138,6 @@ public class ShaderUtils {
      * @return true if a variable of the given type can have a swizzle
      */
     public static boolean isSwizzlable(String type) {
-        return type.equals("vec4") || type.equals("vec3") || type.equals("vec2") || type.equals("float");
+        return type.indexOf("vec4")>-1 || type.indexOf("vec3")>-1 || type.indexOf("vec2")>-1 || type.equals("float");
     }
 }