Hello,
Some input variables seem to be trimmed off by the compiler as I used conditions
probably a bug, but is there a workaround ?
here is the shader node definition:
VertexShaderNodes {
ShaderNode PhongVert {
Definition : PhongVert : Shaders/Phong/PhongVert.j3sn
Condition : !NormalsMap
InputMappings {
lightPosition = MatParam.LightPosition ---- here they get generated
normal = Attr.inNormal ---- ...
modelPosition = Global.position.xyz
normalMatrix = WorldParam.NormalMatrix
viewMatrix= WorldParam.ViewMatrix
worldViewMatrix = WorldParam.WorldViewMatrix
worldMatrix=WorldParam.WorldMatrix
cameraPosition=WorldParam.CameraPosition
}
OutputMappings {
// normal, lightDir, eyeVec
}
}
ShaderNode NormalsMapVert {
Definition : NormalsMapVert : Shaders/NormalsMap/NormalsMapVert.j3sn
Condition : NormalsMap
InputMappings {
lightPosition = MatParam.LightPosition ---- this one is missing
normal = Attr.inNormal ---- this one's type is missing
tangent = Attr.inTangent
modelPosition = Global.position.xyz
normalMatrix = WorldParam.NormalMatrix
viewMatrix= WorldParam.ViewMatrix
worldViewMatrix = WorldParam.WorldViewMatrix
worldMatrix=WorldParam.WorldMatrix
cameraPosition=WorldParam.CameraPosition
}
OutputMappings {
// normal, lightDir, eyeVec
}
}
here is the generated code :
//NormalsMapVert : Begin
89 #if defined(NORMALSMAP)
90 NormalsMapVert_normal = inNormal; <<<<<<<<< compile exception here of course
91 vec3 NormalsMapVert_tangent = inTangent;
92 vec3 NormalsMapVert_modelPosition = Global_position.xyz;
93 vec4 NormalsMapVert_lightDir;
94 vec4 NormalsMapVert_v;
95 vec3 NormalsMapVert_eyeVec;
wich lead to an error
com.jme3.renderer.RendererException: compile error in:ShaderSource[name=Default.vert, defines, type=Vertex,
language=GLSL150] error:0(90) : error C1008: undefined variable "NormalsMapVert_normal"
let me know if you need the whole file, I can provide it…
regards
[edit : I managed to pass this issue, and I have no idea how, restarted ide, clean/build, removing code, re adding it
now I get another oddity
inNormal is present in both nodes, but defined in only one , not in the other one, it does not make any sens
generated code :
#if !defined(NORMALSMAP)
in vec3 inNormal;
#endif
#if defined(NORMALSMAP)
in vec3 inTangent;
#endif