render pipe fixes

This commit is contained in:
aap
2020-08-18 11:03:07 +02:00
parent a78a02394e
commit 93c246b6b1
19 changed files with 745 additions and 831 deletions

View File

@@ -122,8 +122,6 @@ void
defaultRenderCB(Atomic *atomic, InstanceDataHeader *header)
{
Material *m;
RGBAf col;
GLfloat surfProps[4];
setWorldMatrix(atomic->getFrame()->getLTM());
lightingCB(atomic);

View File

@@ -1,13 +1,16 @@
namespace rw {
namespace gl3 {
void initMatFX(void);
ObjPipeline *makeMatFXPipeline(void);
void matfxRenderCB(Atomic *atomic, InstanceDataHeader *header);
ObjPipeline *makeSkinPipeline(void);
ObjPipeline *makeMatFXPipeline(void);
void initMatFX(void);
void initSkin(void);
ObjPipeline *makeSkinPipeline(void);
void skinInstanceCB(Geometry *geo, InstanceDataHeader *header, bool32 reinstance);
void skinRenderCB(Atomic *atomic, InstanceDataHeader *header);
void uploadSkinMatrices(Atomic *atomic);
}
}

View File

@@ -10,15 +10,15 @@ out float v_fog;
void
main(void)
{
vec4 V = u_world * vec4(in_pos, 1.0);
gl_Position = u_proj * u_view * V;
vec3 N = mat3(u_world) * in_normal;
vec4 Vertex = u_world * vec4(in_pos, 1.0);
gl_Position = u_proj * u_view * Vertex;
vec3 Normal = mat3(u_world) * in_normal;
v_tex0 = in_tex0;
v_color = in_color;
v_color.rgb += u_ambLight.rgb*surfAmbient;
v_color.rgb += DoDynamicLight(V.xyz, N)*surfDiffuse;
v_color.rgb += DoDynamicLight(Vertex.xyz, Normal)*surfDiffuse;
v_color = clamp(v_color, 0.0, 1.0);
v_color *= u_matColor;

View File

@@ -11,15 +11,15 @@ const char *default_vert_src =
"void\n"
"main(void)\n"
"{\n"
" vec4 V = u_world * vec4(in_pos, 1.0);\n"
" gl_Position = u_proj * u_view * V;\n"
" vec3 N = mat3(u_world) * in_normal;\n"
" vec4 Vertex = u_world * vec4(in_pos, 1.0);\n"
" gl_Position = u_proj * u_view * Vertex;\n"
" vec3 Normal = mat3(u_world) * in_normal;\n"
" v_tex0 = in_tex0;\n"
" v_color = in_color;\n"
" v_color.rgb += u_ambLight.rgb*surfAmbient;\n"
" v_color.rgb += DoDynamicLight(V.xyz, N)*surfDiffuse;\n"
" v_color.rgb += DoDynamicLight(Vertex.xyz, Normal)*surfDiffuse;\n"
" v_color = clamp(v_color, 0.0, 1.0);\n"
" v_color *= u_matColor;\n"

View File

@@ -9,9 +9,9 @@ out float v_fog;
void
main(void)
{
vec4 V = u_world * vec4(in_pos, 1.0);
vec4 cV = u_view * V;
gl_Position = u_proj * cV;
vec4 Vertex = u_world * vec4(in_pos, 1.0);
vec4 CamVertex = u_view * Vertex;
gl_Position = u_proj * CamVertex;
v_color = in_color;
v_tex0 = in_tex0;
v_fog = DoFog(gl_Position.w);

View File

@@ -10,9 +10,9 @@ const char *im3d_vert_src =
"void\n"
"main(void)\n"
"{\n"
" vec4 V = u_world * vec4(in_pos, 1.0);\n"
" vec4 cV = u_view * V;\n"
" gl_Position = u_proj * cV;\n"
" vec4 Vertex = u_world * vec4(in_pos, 1.0);\n"
" vec4 CamVertex = u_view * Vertex;\n"
" gl_Position = u_proj * CamVertex;\n"
" v_color = in_color;\n"
" v_tex0 = in_tex0;\n"
" v_fog = DoFog(gl_Position.w);\n"

View File

@@ -13,16 +13,16 @@ out float v_fog;
void
main(void)
{
vec4 V = u_world * vec4(in_pos, 1.0);
gl_Position = u_proj * u_view * V;
vec3 N = mat3(u_world) * in_normal;
vec4 Vertex = u_world * vec4(in_pos, 1.0);
gl_Position = u_proj * u_view * Vertex;
vec3 Normal = mat3(u_world) * in_normal;
v_tex0 = in_tex0;
v_tex1 = (u_texMatrix * vec4(N, 1.0)).xy;
v_tex1 = (u_texMatrix * vec4(Normal, 1.0)).xy;
v_color = in_color;
v_color.rgb += u_ambLight.rgb*surfAmbient;
v_color.rgb += DoDynamicLight(V.xyz, N)*surfDiffuse;
v_color.rgb += DoDynamicLight(Vertex.xyz, Normal)*surfDiffuse;
v_color = clamp(v_color, 0.0, 1.0);
v_color *= u_matColor;

View File

@@ -14,16 +14,16 @@ const char *matfx_env_vert_src =
"void\n"
"main(void)\n"
"{\n"
" vec4 V = u_world * vec4(in_pos, 1.0);\n"
" gl_Position = u_proj * u_view * V;\n"
" vec3 N = mat3(u_world) * in_normal;\n"
" vec4 Vertex = u_world * vec4(in_pos, 1.0);\n"
" gl_Position = u_proj * u_view * Vertex;\n"
" vec3 Normal = mat3(u_world) * in_normal;\n"
" v_tex0 = in_tex0;\n"
" v_tex1 = (u_texMatrix * vec4(N, 1.0)).xy;\n"
" v_tex1 = (u_texMatrix * vec4(Normal, 1.0)).xy;\n"
" v_color = in_color;\n"
" v_color.rgb += u_ambLight.rgb*surfAmbient;\n"
" v_color.rgb += DoDynamicLight(V.xyz, N)*surfDiffuse;\n"
" v_color.rgb += DoDynamicLight(Vertex.xyz, Normal)*surfDiffuse;\n"
" v_color = clamp(v_color, 0.0, 1.0);\n"
" v_color *= u_matColor;\n"

View File

@@ -21,15 +21,15 @@ main(void)
SkinNormal += (mat3(u_boneMatrices[int(in_indices[i])]) * in_normal) * in_weights[i];
}
vec4 V = u_world * vec4(SkinVertex, 1.0);
gl_Position = u_proj * u_view * V;
vec3 N = mat3(u_world) * SkinNormal;
vec4 Vertex = u_world * vec4(SkinVertex, 1.0);
gl_Position = u_proj * u_view * Vertex;
vec3 Normal = mat3(u_world) * SkinNormal;
v_tex0 = in_tex0;
v_color = in_color;
v_color.rgb += u_ambLight.rgb*surfAmbient;
v_color.rgb += DoDynamicLight(V.xyz, N)*surfDiffuse;
v_color.rgb += DoDynamicLight(Vertex.xyz, Normal)*surfDiffuse;
v_color = clamp(v_color, 0.0, 1.0);
v_color *= u_matColor;

View File

@@ -22,15 +22,15 @@ const char *skin_vert_src =
" SkinNormal += (mat3(u_boneMatrices[int(in_indices[i])]) * in_normal) * in_weights[i];\n"
" }\n"
" vec4 V = u_world * vec4(SkinVertex, 1.0);\n"
" gl_Position = u_proj * u_view * V;\n"
" vec3 N = mat3(u_world) * SkinNormal;\n"
" vec4 Vertex = u_world * vec4(SkinVertex, 1.0);\n"
" gl_Position = u_proj * u_view * Vertex;\n"
" vec3 Normal = mat3(u_world) * SkinNormal;\n"
" v_tex0 = in_tex0;\n"
" v_color = in_color;\n"
" v_color.rgb += u_ambLight.rgb*surfAmbient;\n"
" v_color.rgb += DoDynamicLight(V.xyz, N)*surfDiffuse;\n"
" v_color.rgb += DoDynamicLight(Vertex.xyz, Normal)*surfDiffuse;\n"
" v_color = clamp(v_color, 0.0, 1.0);\n"
" v_color *= u_matColor;\n"