One example:

We have the difficult the vertex shader node with 3 imports, 1 additional local methods, some defines and local variables:

And we have using of this like this:

In the result we have:

```
#define PBRMainVertex_SD_IS_SET_inPosition 1
#define PBRMainVertex_SD_IS_SET_normalMap 1
#define PBRMainVertex_SD_IS_SET_parallaxMap 1
#define PBRMainVertex_SD_IS_SET_baseColor 1
// ------ Started Common/ShaderLib/GLSLCompat.glsllib ------ //
#if defined GL_ES
# define hfloat highp float
# define hvec2 highp vec2
# define hvec3 highp vec3
# define hvec4 highp vec4
# define lfloat lowp float
# define lvec2 lowp vec2
# define lvec3 lowp vec3
# define lvec4 lowp vec4
#else
# define hfloat float
# define hvec2 vec2
# define hvec3 vec3
# define hvec4 vec4
# define lfloat float
# define lvec2 vec2
# define lvec3 vec3
# define lvec4 vec4
#endif
#if __VERSION__ >= 130
out vec4 outFragColor;
# define texture1D texture
# define texture2D texture
# define texture3D texture
# define textureCube texture
# define texture2DLod textureLod
# define textureCubeLod textureLod
# if defined VERTEX_SHADER
# define varying out
# define attribute in
# elif defined FRAGMENT_SHADER
# define varying in
# define gl_FragColor outFragColor
# endif
#endif
// ------ Finished Common/ShaderLib/GLSLCompat.glsllib ------ //
// ------ Started Common/ShaderLib/Instancing.glsllib ------ //
// Instancing GLSL library.
//
// When the INSTANCING define is set in the shader,
// all global matrices are replaced with "instanced" versions.
// One exception is g_NormalMatrix which becomes unusable,
// instead the function ApplyNormalTransform is used to transform
// the normal and tangent vectors into world view space.
// The world matrix and normal transform quaternion need to be passed
// as vertex attributes "inWorldMatrix" and "inNormalRotationQuaternion"
// respectively.
// The VertexBuffers for those two attributes
// need to be configured into instanced mode (VertexBuffer.setInstanced(true)).
// - inWorldMatrix should have 12 * numInstances floats.
// - inNormalRotationQuaternion should have 4 * numInstances.
// Thus, instancing data occupies 4 vertex attributes (16 / 4 = 4).
//
// The GL_ARB_draw_instanced and GL_ARB_instanced_arrays extensions
// are required (OGL 3.3).
uniform mat4 g_WorldMatrix;
uniform mat4 g_ViewMatrix;
uniform mat4 g_ProjectionMatrix;
uniform mat4 g_WorldViewMatrix;
uniform mat4 g_WorldViewProjectionMatrix;
uniform mat4 g_ViewProjectionMatrix;
uniform mat3 g_NormalMatrix;
#if defined INSTANCING
// World Matrix + Normal Rotation Quaternion.
// The World Matrix is the top 3 rows -
// since the bottom row is always 0,0,0,1 for this transform.
// The bottom row is the transpose of the inverse of WorldView Transform
// as a quaternion. i.e. g_NormalMatrix converted to a quaternion.
//
// Using a quaternion instead of a matrix here allows saving approximately
// 2 vertex attributes which now can be used for additional per-vertex data.
attribute mat4 inInstanceData;
vec4 TransformWorld(vec4 position)
{
// Extract the world matrix out of the instance data, leaving out the
// quaternion at the end.
mat4 worldMatrix = mat4(vec4(inInstanceData[0].xyz, 0.0),
vec4(inInstanceData[1].xyz, 0.0),
vec4(inInstanceData[2].xyz, 0.0),
vec4(inInstanceData[3].xyz, 1.0));
return (worldMatrix * position);
}
vec4 TransformWorldView(vec4 position)
{
return g_ViewMatrix * TransformWorld(position);
}
vec4 TransformWorldViewProjection(vec4 position)
{
return g_ViewProjectionMatrix * TransformWorld(position);
}
vec3 TransformWorldNormal(vec3 vec) {
vec4 quat = vec4(inInstanceData[0].w, inInstanceData[1].w,
inInstanceData[2].w, inInstanceData[3].w);
return vec + vec3(2.0) * cross(cross(vec, quat.xyz) + vec3(quat.w) * vec, quat.xyz);
}
vec3 TransformNormal(vec3 vec)
{
return (g_ViewMatrix * vec4(TransformWorldNormal(vec), 0.0)).xyz;
}
// Prevent user from using g_** matrices which will have invalid data in this case.
#define g_WorldMatrix Use_the_instancing_functions_for_this
#define g_WorldViewMatrix Use_the_instancing_functions_for_this
#define g_WorldViewProjectionMatrix Use_the_instancing_functions_for_this
#define g_NormalMatrix Use_the_instancing_functions_for_this
#else
vec4 TransformWorld(vec4 position)
{
return g_WorldMatrix * position;
}
vec4 TransformWorldView(vec4 position)
{
return g_WorldViewMatrix * position;
}
vec4 TransformWorldViewProjection(vec4 position)
{
return g_WorldViewProjectionMatrix * position;
}
vec3 TransformNormal(vec3 normal) {
return g_NormalMatrix * normal;
}
vec3 TransformWorldNormal(vec3 normal) {
return normalize((g_WorldMatrix * vec4(normal,0.0)).xyz);
}
#endif
// ------ Finished Common/ShaderLib/Instancing.glsllib ------ //
// ------ Started Common/ShaderLib/Skinning.glsllib ------ //
#ifdef NUM_BONES
#if NUM_BONES < 1 || NUM_BONES > 255
#error NUM_BONES must be between 1 and 255.
#endif
#define NUM_WEIGHTS_PER_VERT 4
attribute vec4 inHWBoneWeight;
attribute vec4 inHWBoneIndex;
uniform mat4 m_BoneMatrices[NUM_BONES];
void Skinning_Compute(inout vec4 position){
if (inHWBoneWeight.x != 0.0) {
#if NUM_WEIGHTS_PER_VERT == 1
position = m_BoneMatrices[int(inHWBoneIndex.x)] * position;
#else
mat4 mat = mat4(0.0);
mat += m_BoneMatrices[int(inHWBoneIndex.x)] * inHWBoneWeight.x;
mat += m_BoneMatrices[int(inHWBoneIndex.y)] * inHWBoneWeight.y;
mat += m_BoneMatrices[int(inHWBoneIndex.z)] * inHWBoneWeight.z;
mat += m_BoneMatrices[int(inHWBoneIndex.w)] * inHWBoneWeight.w;
position = mat * position;
#endif
}
}
void Skinning_Compute(inout vec4 position, inout vec3 normal){
if (inHWBoneWeight.x != 0.0) {
#if NUM_WEIGHTS_PER_VERT == 1
position = m_BoneMatrices[int(inHWBoneIndex.x)] * position;
normal = (mat3(m_BoneMatrices[int(inHWBoneIndex.x)][0].xyz,
m_BoneMatrices[int(inHWBoneIndex.x)][1].xyz,
m_BoneMatrices[int(inHWBoneIndex.x)][2].xyz) * normal);
#else
mat4 mat = mat4(0.0);
mat += m_BoneMatrices[int(inHWBoneIndex.x)] * inHWBoneWeight.x;
mat += m_BoneMatrices[int(inHWBoneIndex.y)] * inHWBoneWeight.y;
mat += m_BoneMatrices[int(inHWBoneIndex.z)] * inHWBoneWeight.z;
mat += m_BoneMatrices[int(inHWBoneIndex.w)] * inHWBoneWeight.w;
position = mat * position;
mat3 rotMat = mat3(mat[0].xyz, mat[1].xyz, mat[2].xyz);
normal = rotMat * normal;
#endif
}
}
void Skinning_Compute(inout vec4 position, inout vec3 normal, inout vec3 tangent){
if (inHWBoneWeight.x != 0.0) {
#if NUM_WEIGHTS_PER_VERT == 1
position = m_BoneMatrices[int(inHWBoneIndex.x)] * position;
tangent = m_BoneMatrices[int(inHWBoneIndex.x)] * tangent;
normal = (mat3(m_BoneMatrices[int(inHWBoneIndex.x)][0].xyz,
m_BoneMatrices[int(inHWBoneIndex.x)][1].xyz,
m_BoneMatrices[int(inHWBoneIndex.x)][2].xyz) * normal);
#else
mat4 mat = mat4(0.0);
mat += m_BoneMatrices[int(inHWBoneIndex.x)] * inHWBoneWeight.x;
mat += m_BoneMatrices[int(inHWBoneIndex.y)] * inHWBoneWeight.y;
mat += m_BoneMatrices[int(inHWBoneIndex.z)] * inHWBoneWeight.z;
mat += m_BoneMatrices[int(inHWBoneIndex.w)] * inHWBoneWeight.w;
position = mat * position;
mat3 rotMat = mat3(mat[0].xyz, mat[1].xyz, mat[2].xyz);
tangent = rotMat * tangent;
normal = rotMat * normal;
#endif
}
}
#endif
// ------ Finished Common/ShaderLib/Skinning.glsllib ------ //
uniform sampler2D m_TestNormalMap;
uniform sampler2D m_TestParall;
uniform vec4 m_BaseColor;
in vec3 inPosition;
out vec4 PBRMainVertex_vertexColor;
vec3 PBRMainVertex_testMethod() {
return vec3(1.0, 1.0, 1.0);
}
void main() {
vec4 Global_position = vec4(inPosition,1.0);
//PBRMainVertex : Begin
vec3 PBRMainVertex_inPosition = Global_position.xyz;
vec4 PBRMainVertex_baseColor = m_BaseColor;
vec2 PBRMainVertex_texCoord;
vec2 PBRMainVertex_texCoord2;
vec4 PBRMainVertex_vertexPosition;
vec3 PBRMainVertex_worldNormal;
vec4 PBRMainVertex_worldTangent;
vec3 PBRMainVertex_worldPosition;
vec3 PBRMainVertex_test = PBRMainVertex_testMethod();
#ifdef PBRMainVertex_SD_IS_SET_inPosition
vec4 PBRMainVertex_modelSpacePosition = vec4(PBRMainVertex_inPosition, 1.0);
#else
vec4 PBRMainVertex_modelSpacePosition = vec4(1.0);
#endif
#ifdef PBRMainVertex_SD_IS_SET_inNormal
vec3 PBRMainVertex_modelSpaceNormal = inNormal;
#else
vec3 PBRMainVertex_modelSpaceNormal = vec3(1.0);
#endif
#if (defined(PBRMainVertex_SD_IS_SET_normalMap) || defined(PBRMainVertex_SD_IS_SET_parallaxMap)) && !defined(VERTEX_LIGHTING)
#ifdef PBRMainVertex_SD_IS_SET_inTangent
vec3 PBRMainVertex_modelSpaceTanget = inTangent.xyz;
#else
vec3 PBRMainVertex_modelSpaceTanget = vec3(1.0);
#endif
#endif
#ifdef NUM_BONES
#if defined(PBRMainVertex_SD_IS_SET_normalMap) && !defined(VERTEX_LIGHTING)
Skinning_Compute(PBRMainVertex_modelSpacePosition, PBRMainVertex_modelSpaceNormal, PBRMainVertex_modelSpaceTanget);
#else
Skinning_Compute(PBRMainVertex_modelSpacePosition, PBRMainVertex_modelSpaceNormal);
#endif
#endif
PBRMainVertex_vertexPosition = TransformWorldViewProjection(PBRMainVertex_modelSpacePosition);
PBRMainVertex_worldPosition = TransformWorld(PBRMainVertex_modelSpacePosition).xyz;
PBRMainVertex_worldNormal = TransformWorldNormal(PBRMainVertex_modelSpaceNormal);
#if defined(PBRMainVertex_SD_IS_SET_normalMap) || defined(PBRMainVertex_SD_IS_SET_parallaxMap)
#ifdef PBRMainVertex_SD_IS_SET_inTangent
float PBRMainVertex_inTangentW = inTangent.w;
#else
float PBRMainVertex_inTangentW = 1.0;
#endif
PBRMainVertex_worldTangent = vec4(TransformWorldNormal(PBRMainVertex_modelSpaceTanget), PBRMainVertex_inTangentW);
#endif
#ifdef PBRMainVertex_SD_IS_SET_baseColor
PBRMainVertex_vertexColor = PBRMainVertex_baseColor;
#else
PBRMainVertex_vertexColor = vec4(0.5, 0.5, 0.5, 0.5);
#endif
#ifdef PBRMainVertex_SD_IS_SET_inColor
PBRMainVertex_vertexColor *= inColor;
#endif
Global_position = PBRMainVertex_vertexPosition;
//PBRMainVertex : End
gl_Position = Global_position;
}
```

So you can see updated names of defines, methods, local variables, automaticly added defines:

```
#define PBRMainVertex_SD_IS_SET_inPosition 1
#define PBRMainVertex_SD_IS_SET_normalMap 1
#define PBRMainVertex_SD_IS_SET_parallaxMap 1
#define PBRMainVertex_SD_IS_SET_baseColor 1
```

also, the generator added missed world bindings from imported shaders and other things.