Ver código fonte

* Put comment markers around imported library contents when loading shader

shadowislord 11 anos atrás
pai
commit
be3a6c03b2

+ 7 - 1
jme3-core/src/plugins/java/com/jme3/shader/plugins/GLSLLoader.java

@@ -84,7 +84,10 @@ public class GLSLLoader implements AssetLoader {
         try {
             bufReader = new BufferedReader(reader);
             String ln;
-            while ((ln = bufReader.readLine()) != null) {                
+            if (!nodeName.equals("[main]")) {
+                sb.append("// -- begin import ").append(nodeName).append(" --\n");
+            }
+            while ((ln = bufReader.readLine()) != null) {
                 if (ln.trim().startsWith("#import ")) {
                     ln = ln.trim().substring(8).trim();
                     if (ln.startsWith("\"") && ln.endsWith("\"") && ln.length() > 3) {
@@ -109,6 +112,9 @@ public class GLSLLoader implements AssetLoader {
                     sb.append(ln).append('\n');
                 }
             }
+            if (!nodeName.equals("[main]")) {
+                sb.append("// -- end import ").append(nodeName).append(" --\n");
+            }
         } catch (IOException ex) {
             if (bufReader != null) {
                 try {