The shader generator now supports swizzle on the left variable of a mapping :
input mapping vec3 v3.xy = v2 will generate vec3 v3 = vec3(0.0); v3.xy = v2; As this statement can't be done in one line.
This commit is contained in:
parent
a04a304954
commit
5b6b33c8f5
@ -396,7 +396,18 @@ public class Glsl100ShaderGenerator extends ShaderGenerator {
|
||||
source.append(mapping.getLeftVariable().getNameSpace());
|
||||
source.append("_");
|
||||
source.append(mapping.getLeftVariable().getName());
|
||||
|
||||
//left swizzle, the variable can't be declared and assigned on the same line.
|
||||
if (mapping.getLeftSwizzling().length() > 0) {
|
||||
//initialize the declared variable to 0.0
|
||||
source.append(" = ");
|
||||
source.append(mapping.getLeftVariable().getType());
|
||||
source.append("(0.0);\n");
|
||||
appendIndent(source);
|
||||
//assign the value on a new line
|
||||
source.append(mapping.getLeftVariable().getNameSpace());
|
||||
source.append("_");
|
||||
source.append(mapping.getLeftVariable().getName());
|
||||
source.append(".");
|
||||
source.append(mapping.getLeftSwizzling());
|
||||
}
|
||||
|
@ -120,11 +120,7 @@ public class ShaderUtils {
|
||||
card = Integer.parseInt(type.replaceAll(".*vec", ""));
|
||||
|
||||
if (swizzling.length() > 0) {
|
||||
//if (card >= swizzling.length()) {
|
||||
card = swizzling.length();
|
||||
// } else {
|
||||
// card = 0;
|
||||
// }
|
||||
card = swizzling.length();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user