I give up:
From such program :
Code: Select all
#version 460
//-----------------------------------------------------------------------------
// PROGRAM DEPENDENCIES
//-----------------------------------------------------------------------------
#define USE_OGRE_FROM_FUTURE
#include <OgreUnifiedShader.h>
#include "FFPLib_Transform.glsl"
#include "SGXLib_PerPixelLighting.glsl"
#include "FFPLib_Texturing.glsl"
//-----------------------------------------------------------------------------
// GLOBAL PARAMETERS
//-----------------------------------------------------------------------------
layout(location = 0) uniform mat4 worldviewproj_matrix;
layout(location = 4) uniform mat3 normal_matrix;
layout(location = 7) uniform mat4 worldview_matrix;
//-----------------------------------------------------------------------------
// MAIN
//-----------------------------------------------------------------------------
IN(vec4 vertex, POSITION)
IN(mat3x4 uv1, TEXCOORD1)
IN(vec3 normal, NORMAL)
IN(vec4 uv0, TEXCOORD0)
OUT(vec3 iTexcoord_0, 0)
OUT(vec3 iTexcoord_1, 1)
OUT(vec2 iTexcoord_2, 2)
void main(void) {
vec4 lColor_0;
vec4 lColor_1;
vec4 local_vertex = vertex;
FFP_Transform(uv1, local_vertex, local_vertex.xyz);
vec3 local_normal = normal;
FFP_Transform(uv1, local_normal, local_normal);
FFP_Transform(worldviewproj_matrix, local_vertex, gl_Position);
lColor_0 = vec4(1.00000,1.00000,1.00000,1.00000);
lColor_1 = vec4(0.00000,0.00000,0.00000,0.00000);
FFP_Transform(worldview_matrix, local_vertex, iTexcoord_1);
iTexcoord_2 = uv0.xy;
}
I deduced such program :
Code: Select all
#version 330 core
#extension GL_ARB_explicit_uniform_location : enable
#extension GL_ARB_shading_language_include : enable
#define USE_OGRE_FROM_FUTURE
#include <OgreUnifiedShader.h>
#include "FFPLib_Transform.glsl"
#include "SGXLib_PerPixelLighting.glsl"
#include "FFPLib_Texturing.glsl"
#include "PerlinNoise.glsl"
uniform mat4 projectionMatrix;
uniform mat4 viewMatrix;
uniform mat4 worldMatrix;
uniform mat4 worldviewproj_matrix;
uniform mat4 lightMatrix;
layout (location = 0) in vec4 position;
layout (location = 2) in vec3 normal;
layout (location = 8) in vec2 uv_0;
layout (location = 8) in vec2 uv_1;
layout (location = 14) in vec3 tangent;
IN(mat3x4 uv1, TEXCOORD1)
out vec2 out_UV0;
out vec2 out_UV1;
out vec3 FragPos;
out vec4 VertexPos;
out mat3 TBN;
float freq = 3.1415;
void main() {
vec4 local_position = position;
FFP_Transform(uv1, local_position, local_position.xyz);
vec3 local_normal = normal;
FFP_Transform(uv1, local_normal, local_normal.xyz);
vec3 local_tangent =tangent;
FFP_Transform(uv1, local_tangent, local_tangent.xyz);
// compute world space local_position, local_tangent, bilocal_tangent
vec3 P = (worldMatrix * local_position).xyz;
vec3 T = normalize(vec3(worldMatrix * vec4(local_tangent, 0.0)));
vec3 B = normalize(vec3(worldMatrix * vec4(cross(local_tangent, local_normal), 0.0)));
vec3 N = cross(B, T);
TBN = mat3(T, B, N);
gl_Position = worldviewproj_matrix * local_position;
FragPos = P;
out_UV0 = vec2(1.0,1.0);// uv_0;
out_UV1 = vec2(1.0,1.0); //uv_1;
VertexPos = lightMatrix * local_position;
}
But I get degenerated mesh; that is instead of this :
I get this :
How does ogre3d handle mat3x4 , are those macrodefintions or extensions ? Afaik the GLSL does not support non-square matrix'es ....
EDIT : the deformed mesh is introduced only when line FFP_Transform(uv1, local_position, local_position.xyz); is present --- that means the uv1 format is wrong ...