Port also other shaders to use #stk_include

This commit is contained in:
deve 2016-06-27 13:11:27 +02:00
parent f679078e75
commit d5e30ee41e
34 changed files with 196 additions and 268 deletions

View File

@ -4,10 +4,10 @@ uniform sampler2D dtex;
out vec4 Diff; out vec4 Diff;
out vec4 Spec; out vec4 Spec;
vec3 DecodeNormal(vec2 n); #stk_include "utils/decodeNormal.frag"
vec4 getPosFromUVDepth(vec3 uvDepth, mat4 InverseProjectionMatrix); #stk_include "utils/getPosFromUVDepth.frag"
vec3 DiffuseIBL(vec3 normal); #stk_include "utils/DiffuseIBL.frag"
vec3 SpecularIBL(vec3 normal, vec3 V, float roughness); #stk_include "utils/SpecularIBL.frag"
void main(void) void main(void)
{ {

View File

@ -22,7 +22,7 @@ layout (std430) buffer BoundingBoxes
CascadeBoundingBox BB[4]; CascadeBoundingBox BB[4];
}; };
vec4 getPosFromUVDepth(vec3 uvDepth, mat4 InverseProjectionMatrix); #stk_include "utils/getPosFromUVDepth.frag"
shared int xmin[4]; shared int xmin[4];
shared int xmax[4]; shared int xmax[4];

View File

@ -2,8 +2,8 @@ uniform sampler2D tex;
out vec4 FragColor; out vec4 FragColor;
vec3 getCIEYxy(vec3 rgbColor); #stk_include "utils/getCIEXYZ.frag"
vec3 getRGBFromCIEXxy(vec3 YxyColor); #stk_include "utils/getRGBfromCIEXxy.frag"
void main() void main()
{ {

View File

@ -3,10 +3,10 @@ uniform sampler2D ntex;
out vec4 Diff; out vec4 Diff;
out vec4 Spec; out vec4 Spec;
vec3 DecodeNormal(vec2 n); #stk_include "utils/decodeNormal.frag"
vec4 getPosFromUVDepth(vec3 uvDepth, mat4 InverseProjectionMatrix); #stk_include "utils/getPosFromUVDepth.frag"
vec3 DiffuseIBL(vec3 normal); #stk_include "utils/DiffuseIBL.frag"
vec3 SpecularIBL(vec3 normal, vec3 V, float roughness); #stk_include "utils/SpecularIBL.frag"
void main(void) void main(void)
{ {

View File

@ -6,7 +6,7 @@ uniform vec3 col;
out vec4 FragColor; out vec4 FragColor;
vec4 getPosFromUVDepth(vec3 uvDepth, mat4 InverseProjectionMatrix); #stk_include "utils/getPosFromUVDepth.frag"
void main() void main()
{ {

View File

@ -30,8 +30,8 @@ vec3 SH2RGB (in vec4 sh_r, in vec4 sh_g, in vec4 sh_b, in vec3 dir)
out vec4 Diffuse; out vec4 Diffuse;
vec3 DecodeNormal(vec2 n); #stk_include "utils/decodeNormal.frag"
vec4 getPosFromUVDepth(vec3 uvDepth, mat4 InverseProjectionMatrix); #stk_include "utils/getPosFromUVDepth.frag"
vec3 resolution = vec3(32, 16, 32); vec3 resolution = vec3(32, 16, 32);

View File

@ -12,8 +12,7 @@ layout(location = 12) in vec4 GlowColor;
flat out vec4 glowColor; flat out vec4 glowColor;
mat4 getWorldMatrix(vec3 translation, vec3 rotation, vec3 scale); #stk_include "utils/getworldmatrix.vert"
mat4 getInverseWorldMatrix(vec3 translation, vec3 rotation, vec3 scale);
void main(void) void main(void)
{ {

View File

@ -13,7 +13,7 @@ in vec2 uv;
in vec2 uv_bis; in vec2 uv_bis;
out vec4 FragColor; out vec4 FragColor;
vec3 getLightFactor(vec3 diffuseMatColor, vec3 specularMatColor, float specMapValue, float emitMapValue); #stk_include "utils/getLightFactor.frag"
void main(void) void main(void)
{ {

View File

@ -32,8 +32,7 @@ flat out sampler2D handle;
flat out sampler2D secondhandle; flat out sampler2D secondhandle;
#endif #endif
mat4 getWorldMatrix(vec3 translation, vec3 rotation, vec3 scale); #stk_include "utils/getworldmatrix.vert"
mat4 getInverseWorldMatrix(vec3 translation, vec3 rotation, vec3 scale);
void main() void main()
{ {

View File

@ -14,7 +14,7 @@ in vec3 nor;
in vec2 uv; in vec2 uv;
out vec4 FragColor; out vec4 FragColor;
vec3 getLightFactor(vec3 diffuseMatColor, vec3 specularMatColor, float specMapValue, float emitMapValue); #stk_include "utils/getLightFactor.frag"
void main(void) void main(void)
{ {

View File

@ -12,7 +12,7 @@ in vec3 bitangent;
in vec2 uv; in vec2 uv;
out vec3 EncodedNormal; out vec3 EncodedNormal;
vec2 EncodeNormal(vec3 n); #stk_include "utils/encode_normal.frag"
void main() void main()
{ {

View File

@ -42,8 +42,7 @@ flat out sampler2D secondhandle;
flat out sampler2D thirdhandle; flat out sampler2D thirdhandle;
#endif #endif
mat4 getWorldMatrix(vec3 translation, vec3 rotation, vec3 scale); #stk_include "utils/getworldmatrix.vert"
mat4 getInverseWorldMatrix(vec3 translation, vec3 rotation, vec3 scale);
void main(void) void main(void)
{ {

View File

@ -9,7 +9,7 @@ in vec3 nor;
in vec2 uv; in vec2 uv;
out vec3 EncodedNormal; out vec3 EncodedNormal;
vec2 EncodeNormal(vec3 n); #stk_include "utils/encode_normal.frag"
void main(void) void main(void)
{ {

View File

@ -11,7 +11,7 @@ in vec2 uv;
in vec4 color; in vec4 color;
out vec4 FragColor; out vec4 FragColor;
vec3 getLightFactor(vec3 diffuseMatColor, vec3 specularMatColor, float specMapValue, float emitMapValue); #stk_include "utils/getLightFactor.frag"
void main(void) void main(void)
{ {

View File

@ -10,9 +10,8 @@ flat in sampler2D handle;
in vec3 nor; in vec3 nor;
out vec4 FragColor; out vec4 FragColor;
#stk_include "utils/getPosFromUVDepth.frag"
vec4 getPosFromUVDepth(vec3 uvDepth, mat4 InverseProjectionMatrix); #stk_include "utils/getLightFactor.frag"
vec3 getLightFactor(vec3 diffuseMatColor, vec3 specularMatColor, float specMapValue, float emitMapValue);
void main() { void main() {
vec3 texc = gl_FragCoord.xyz / vec3(screen, 1.); vec3 texc = gl_FragCoord.xyz / vec3(screen, 1.);

View File

@ -11,7 +11,7 @@ in vec3 nor;
in vec2 uv; in vec2 uv;
out vec3 EncodedNormal; out vec3 EncodedNormal;
vec2 EncodeNormal(vec3 n); #stk_include "utils/encode_normal.frag"
void main() { void main() {
#ifdef Use_Bindless_Texture #ifdef Use_Bindless_Texture

View File

@ -11,7 +11,7 @@ in vec2 uv;
in vec4 color; in vec4 color;
out vec4 FragColor; out vec4 FragColor;
vec3 getLightFactor(vec3 diffuseMatColor, vec3 specularMatColor, float specMapValue, float emitMapValue); #stk_include "utils/getLightFactor.frag"
void main(void) void main(void)
{ {

View File

@ -21,8 +21,7 @@ flat out uvec2 handle;
#endif #endif
mat4 getWorldMatrix(vec3 translation, vec3 rotation, vec3 scale); #stk_include "utils/getworldmatrix.vert"
mat4 getInverseWorldMatrix(vec3 translation, vec3 rotation, vec3 scale);
void main(void) void main(void)
{ {

View File

@ -36,8 +36,7 @@ flat out uvec2 hdle;
#endif #endif
#endif #endif
mat4 getWorldMatrix(vec3 translation, vec3 rotation, vec3 scale); #stk_include "utils/getworldmatrix.vert"
mat4 getInverseWorldMatrix(vec3 translation, vec3 rotation, vec3 scale);
void main(void) void main(void)
{ {

View File

@ -33,8 +33,7 @@ flat out uvec2 hdle;
#endif #endif
#endif #endif
mat4 getWorldMatrix(vec3 translation, vec3 rotation, vec3 scale); #stk_include "utils/getworldmatrix.vert"
mat4 getInverseWorldMatrix(vec3 translation, vec3 rotation, vec3 scale);
void main(void) void main(void)
{ {

View File

@ -42,7 +42,7 @@ out vec4 FragColor;
// Number of samples used for blurring // Number of samples used for blurring
#define NB_SAMPLES 8 #define NB_SAMPLES 8
vec4 getPosFromUVDepth(vec3 uvDepth, mat4 InverseProjectionMatrix); #stk_include "utils/getPosFromUVDepth.frag"
void main() void main()
{ {

View File

@ -9,10 +9,10 @@ flat in float radius;
out vec4 Diff; out vec4 Diff;
out vec4 Spec; out vec4 Spec;
vec3 DecodeNormal(vec2 n); #stk_include "utils/decodeNormal.frag"
vec3 SpecularBRDF(vec3 normal, vec3 eyedir, vec3 lightdir, vec3 color, float roughness); #stk_include "utils/SpecularBRDF.frag"
vec3 DiffuseBRDF(vec3 normal, vec3 eyedir, vec3 lightdir, vec3 color, float roughness); #stk_include "utils/DiffuseBRDF.frag"
vec4 getPosFromUVDepth(vec3 uvDepth, mat4 InverseProjectionMatrix); #stk_include "utils/getPosFromUVDepth.frag"
void main() void main()
{ {

View File

@ -9,7 +9,7 @@ flat in float radius;
out vec4 Fog; out vec4 Fog;
vec4 getPosFromUVDepth(vec3 uvDepth, mat4 InverseProjectionMatrix); #stk_include "utils/getPosFromUVDepth.frag"
void main() void main()
{ {

View File

@ -4,11 +4,11 @@ uniform sampler2D dtex;
out vec4 Diff; out vec4 Diff;
out vec4 Spec; out vec4 Spec;
vec3 DecodeNormal(vec2 n); #stk_include "utils/decodeNormal.frag"
vec3 SpecularBRDF(vec3 normal, vec3 eyedir, vec3 lightdir, vec3 color, float roughness); #stk_include "utils/SpecularBRDF.frag"
vec3 DiffuseBRDF(vec3 normal, vec3 eyedir, vec3 lightdir, vec3 color, float roughness); #stk_include "utils/DiffuseBRDF.frag"
vec4 getPosFromUVDepth(vec3 uvDepth, mat4 InverseProjectionMatrix); #stk_include "utils/getPosFromUVDepth.frag"
vec3 SunMRP(vec3 normal, vec3 eyedir); #stk_include "utils/SunMRP.frag"
void main() { void main() {
vec2 uv = gl_FragCoord.xy / screen; vec2 uv = gl_FragCoord.xy / screen;

View File

@ -12,11 +12,11 @@ in vec2 uv;
out vec4 Diff; out vec4 Diff;
out vec4 Spec; out vec4 Spec;
vec3 DecodeNormal(vec2 n); #stk_include "utils/decodeNormal.frag"
vec3 SpecularBRDF(vec3 normal, vec3 eyedir, vec3 lightdir, vec3 color, float roughness); #stk_include "utils/SpecularBRDF.frag"
vec3 DiffuseBRDF(vec3 normal, vec3 eyedir, vec3 lightdir, vec3 color, float roughness); #stk_include "utils/DiffuseBRDF.frag"
vec4 getPosFromUVDepth(vec3 uvDepth, mat4 InverseProjectionMatrix); #stk_include "utils/getPosFromUVDepth.frag"
vec3 SunMRP(vec3 normal, vec3 eyedir); #stk_include "utils/SunMRP.frag"
float getShadowFactor(vec3 pos, int index) float getShadowFactor(vec3 pos, int index)
{ {

View File

@ -11,11 +11,11 @@ in vec2 uv;
out vec4 Diff; out vec4 Diff;
out vec4 Spec; out vec4 Spec;
vec3 DecodeNormal(vec2 n); #stk_include "utils/decodeNormal.frag"
vec3 SpecularBRDF(vec3 normal, vec3 eyedir, vec3 lightdir, vec3 color, float roughness); #stk_include "utils/SpecularBRDF.frag"
vec3 DiffuseBRDF(vec3 normal, vec3 eyedir, vec3 lightdir, vec3 color, float roughness); #stk_include "utils/DiffuseBRDF.frag"
vec4 getPosFromUVDepth(vec3 uvDepth, mat4 InverseProjectionMatrix); #stk_include "utils/getPosFromUVDepth.frag"
vec3 SunMRP(vec3 normal, vec3 eyedir); #stk_include "utils/SunMRP.frag"
float getShadowFactor(vec3 pos, int index) float getShadowFactor(vec3 pos, int index)
{ {

View File

@ -2,7 +2,7 @@
in vec4 color; in vec4 color;
out vec4 FragColor; out vec4 FragColor;
vec3 getLightFactor(float specMapValue); #stk_include "utils/getLightFactor.frag"
void main(void) void main(void)
{ {

View File

@ -6,6 +6,6 @@ vec3 SpecularBRDF(vec3 normal, vec3 eyedir, vec3 lightdir, vec3 color, float rou
vec3 H = normalize(eyedir + lightdir); vec3 H = normalize(eyedir + lightdir);
float NdotH = clamp(dot(normal, H), 0., 1.); float NdotH = clamp(dot(normal, H), 0., 1.);
float normalisationFactor = (exponentroughness + 2.) / 8.; float normalisationFactor = (exponentroughness + 2.) / 8.;
vec3 FresnelSchlick = color + (1.0f - color) * pow(1.0f - clamp(dot(eyedir, H), 0., 1.), 5); vec3 FresnelSchlick = color + (1.0f - color) * pow(1.0f - clamp(dot(eyedir, H), 0., 1.), 5.);
return max(pow(NdotH, exponentroughness) * FresnelSchlick * normalisationFactor, vec3(0.)); return max(pow(NdotH, exponentroughness) * FresnelSchlick * normalisationFactor, vec3(0.));
} }

View File

@ -81,7 +81,6 @@ public:
{ {
loadProgram(PARTICLES_RENDERING, loadProgram(PARTICLES_RENDERING,
GL_VERTEX_SHADER, "flipparticle.vert", GL_VERTEX_SHADER, "flipparticle.vert",
GL_FRAGMENT_SHADER, "utils/getPosFromUVDepth.frag",
GL_FRAGMENT_SHADER, "particle.frag"); GL_FRAGMENT_SHADER, "particle.frag");
assignUniforms(); assignUniforms();
assignSamplerNames(0, "tex", ST_TRILINEAR_ANISOTROPIC_FILTERED, assignSamplerNames(0, "tex", ST_TRILINEAR_ANISOTROPIC_FILTERED,

View File

@ -320,8 +320,6 @@ public:
BloomShader() BloomShader()
{ {
loadProgram(OBJECT, GL_VERTEX_SHADER, "screenquad.vert", loadProgram(OBJECT, GL_VERTEX_SHADER, "screenquad.vert",
GL_FRAGMENT_SHADER, "utils/getCIEXYZ.frag",
GL_FRAGMENT_SHADER, "utils/getRGBfromCIEXxy.frag",
GL_FRAGMENT_SHADER, "bloom.frag"); GL_FRAGMENT_SHADER, "bloom.frag");
assignUniforms(); assignUniforms();
assignSamplerNames(0, "tex", ST_NEAREST_FILTERED); assignSamplerNames(0, "tex", ST_NEAREST_FILTERED);
@ -440,10 +438,6 @@ public:
IBLShader() IBLShader()
{ {
loadProgram(OBJECT, GL_VERTEX_SHADER, "screenquad.vert", loadProgram(OBJECT, GL_VERTEX_SHADER, "screenquad.vert",
GL_FRAGMENT_SHADER, "utils/decodeNormal.frag",
GL_FRAGMENT_SHADER, "utils/getPosFromUVDepth.frag",
GL_FRAGMENT_SHADER, "utils/DiffuseIBL.frag",
GL_FRAGMENT_SHADER, "utils/SpecularIBL.frag",
GL_FRAGMENT_SHADER, "IBL.frag"); GL_FRAGMENT_SHADER, "IBL.frag");
assignUniforms(); assignUniforms();
assignSamplerNames(0, "ntex", ST_NEAREST_FILTERED, assignSamplerNames(0, "ntex", ST_NEAREST_FILTERED,
@ -459,10 +453,6 @@ public:
DegradedIBLShader() DegradedIBLShader()
{ {
loadProgram(OBJECT, GL_VERTEX_SHADER, "screenquad.vert", loadProgram(OBJECT, GL_VERTEX_SHADER, "screenquad.vert",
GL_FRAGMENT_SHADER, "utils/decodeNormal.frag",
GL_FRAGMENT_SHADER, "utils/getPosFromUVDepth.frag",
GL_FRAGMENT_SHADER, "utils/DiffuseIBL.frag",
GL_FRAGMENT_SHADER, "utils/SpecularIBL.frag",
GL_FRAGMENT_SHADER, "degraded_ibl.frag"); GL_FRAGMENT_SHADER, "degraded_ibl.frag");
assignUniforms(); assignUniforms();
assignSamplerNames(0, "ntex", ST_NEAREST_FILTERED); assignSamplerNames(0, "ntex", ST_NEAREST_FILTERED);
@ -497,8 +487,6 @@ public:
GlobalIlluminationReconstructionShader() GlobalIlluminationReconstructionShader()
{ {
loadProgram(OBJECT, GL_VERTEX_SHADER, "screenquad.vert", loadProgram(OBJECT, GL_VERTEX_SHADER, "screenquad.vert",
GL_FRAGMENT_SHADER, "utils/decodeNormal.frag",
GL_FRAGMENT_SHADER, "utils/getPosFromUVDepth.frag",
GL_FRAGMENT_SHADER, "gi.frag"); GL_FRAGMENT_SHADER, "gi.frag");
assignUniforms("rh_matrix", "inv_rh_matrix", "extents"); assignUniforms("rh_matrix", "inv_rh_matrix", "extents");
@ -627,8 +615,6 @@ public:
SSAOShader() SSAOShader()
{ {
loadProgram(OBJECT, GL_VERTEX_SHADER, "screenquad.vert", loadProgram(OBJECT, GL_VERTEX_SHADER, "screenquad.vert",
GL_FRAGMENT_SHADER, "utils/decodeNormal.frag",
GL_FRAGMENT_SHADER, "utils/getPosFromUVDepth.frag",
GL_FRAGMENT_SHADER, "ssao.frag"); GL_FRAGMENT_SHADER, "ssao.frag");
assignUniforms("radius", "k", "sigma"); assignUniforms("radius", "k", "sigma");
@ -656,7 +642,6 @@ public:
MotionBlurShader() MotionBlurShader()
{ {
loadProgram(OBJECT, GL_VERTEX_SHADER, "screenquad.vert", loadProgram(OBJECT, GL_VERTEX_SHADER, "screenquad.vert",
GL_FRAGMENT_SHADER, "utils/getPosFromUVDepth.frag",
GL_FRAGMENT_SHADER, "motion_blur.frag"); GL_FRAGMENT_SHADER, "motion_blur.frag");
assignUniforms("previous_viewproj", "center", "boost_amount", assignUniforms("previous_viewproj", "center", "boost_amount",
"mask_radius"); "mask_radius");
@ -793,11 +778,6 @@ public:
SunLightShader() SunLightShader()
{ {
loadProgram(OBJECT, GL_VERTEX_SHADER, "screenquad.vert", loadProgram(OBJECT, GL_VERTEX_SHADER, "screenquad.vert",
GL_FRAGMENT_SHADER, "utils/decodeNormal.frag",
GL_FRAGMENT_SHADER, "utils/SpecularBRDF.frag",
GL_FRAGMENT_SHADER, "utils/DiffuseBRDF.frag",
GL_FRAGMENT_SHADER, "utils/getPosFromUVDepth.frag",
GL_FRAGMENT_SHADER, "utils/SunMRP.frag",
GL_FRAGMENT_SHADER, "sunlight.frag"); GL_FRAGMENT_SHADER, "sunlight.frag");
assignSamplerNames(0, "ntex", ST_NEAREST_FILTERED, assignSamplerNames(0, "ntex", ST_NEAREST_FILTERED,

View File

@ -51,8 +51,7 @@ class InstancedColorizeShader : public Shader<InstancedColorizeShader>
public: public:
InstancedColorizeShader() InstancedColorizeShader()
{ {
loadProgram(OBJECT, GL_VERTEX_SHADER, "utils/getworldmatrix.vert", loadProgram(OBJECT, GL_VERTEX_SHADER, "glow_object.vert",
GL_VERTEX_SHADER, "glow_object.vert",
GL_FRAGMENT_SHADER, "glow_object.frag"); GL_FRAGMENT_SHADER, "glow_object.frag");
assignUniforms(); assignUniforms();
} // InstancedColorizeShader } // InstancedColorizeShader

View File

@ -83,9 +83,7 @@ class InstancedObjectPass1Shader : public TextureShader<InstancedObjectPass1Shad
public: public:
InstancedObjectPass1Shader() InstancedObjectPass1Shader()
{ {
loadProgram(OBJECT, GL_VERTEX_SHADER, "utils/getworldmatrix.vert", loadProgram(OBJECT, GL_VERTEX_SHADER, "instanced_object_pass.vert",
GL_VERTEX_SHADER, "instanced_object_pass.vert",
GL_FRAGMENT_SHADER, "utils/encode_normal.frag",
GL_FRAGMENT_SHADER, "instanced_object_pass1.frag"); GL_FRAGMENT_SHADER, "instanced_object_pass1.frag");
assignUniforms(); assignUniforms();
@ -99,9 +97,7 @@ class InstancedObjectRefPass1Shader : public TextureShader<InstancedObjectRefPas
public: public:
InstancedObjectRefPass1Shader() InstancedObjectRefPass1Shader()
{ {
loadProgram(OBJECT, GL_VERTEX_SHADER, "utils/getworldmatrix.vert", loadProgram(OBJECT, GL_VERTEX_SHADER, "instanced_object_pass.vert",
GL_VERTEX_SHADER, "instanced_object_pass.vert",
GL_FRAGMENT_SHADER, "utils/encode_normal.frag",
GL_FRAGMENT_SHADER, "instanced_objectref_pass1.frag"); GL_FRAGMENT_SHADER, "instanced_objectref_pass1.frag");
assignUniforms(); assignUniforms();
@ -135,9 +131,7 @@ class InstancedObjectPass2Shader : public TextureShader<InstancedObjectPass2Shad
public: public:
InstancedObjectPass2Shader() InstancedObjectPass2Shader()
{ {
loadProgram(OBJECT, GL_VERTEX_SHADER, "utils/getworldmatrix.vert", loadProgram(OBJECT, GL_VERTEX_SHADER, "instanced_object_pass.vert",
GL_VERTEX_SHADER, "instanced_object_pass.vert",
GL_FRAGMENT_SHADER, "utils/getLightFactor.frag",
GL_FRAGMENT_SHADER, "instanced_object_pass2.frag"); GL_FRAGMENT_SHADER, "instanced_object_pass2.frag");
assignUniforms(); assignUniforms();
assignSamplerNames(0, "DiffuseMap", ST_NEAREST_FILTERED, assignSamplerNames(0, "DiffuseMap", ST_NEAREST_FILTERED,
@ -154,9 +148,7 @@ class InstancedObjectRefPass2Shader : public TextureShader<InstancedObjectRefPas
public: public:
InstancedObjectRefPass2Shader() InstancedObjectRefPass2Shader()
{ {
loadProgram(OBJECT, GL_VERTEX_SHADER, "utils/getworldmatrix.vert", loadProgram(OBJECT, GL_VERTEX_SHADER, "instanced_object_pass.vert",
GL_VERTEX_SHADER, "instanced_object_pass.vert",
GL_FRAGMENT_SHADER, "utils/getLightFactor.frag",
GL_FRAGMENT_SHADER, "instanced_objectref_pass2.frag"); GL_FRAGMENT_SHADER, "instanced_objectref_pass2.frag");
assignUniforms(); assignUniforms();
assignSamplerNames(0, "DiffuseMap", ST_NEAREST_FILTERED, assignSamplerNames(0, "DiffuseMap", ST_NEAREST_FILTERED,
@ -206,14 +198,12 @@ public:
return; return;
if (CVS->isAMDVertexShaderLayerUsable()) if (CVS->isAMDVertexShaderLayerUsable())
{ {
loadProgram(OBJECT, GL_VERTEX_SHADER, "utils/getworldmatrix.vert", loadProgram(OBJECT, GL_VERTEX_SHADER, "instanciedshadow.vert",
GL_VERTEX_SHADER, "instanciedshadow.vert",
GL_FRAGMENT_SHADER, "shadow.frag"); GL_FRAGMENT_SHADER, "shadow.frag");
} }
else else
{ {
loadProgram(OBJECT, GL_VERTEX_SHADER, "utils/getworldmatrix.vert", loadProgram(OBJECT, GL_VERTEX_SHADER, "instanciedshadow.vert",
GL_VERTEX_SHADER, "instanciedshadow.vert",
GL_GEOMETRY_SHADER, "instanced_shadow.geom", GL_GEOMETRY_SHADER, "instanced_shadow.geom",
GL_FRAGMENT_SHADER, "shadow.frag"); GL_FRAGMENT_SHADER, "shadow.frag");
} }
@ -265,8 +255,7 @@ class CInstancedRSMShader : public TextureShader<CInstancedRSMShader, 1, core::m
public: public:
CInstancedRSMShader() CInstancedRSMShader()
{ {
loadProgram(OBJECT, GL_VERTEX_SHADER, "utils/getworldmatrix.vert", loadProgram(OBJECT, GL_VERTEX_SHADER, "instanced_rsm.vert",
GL_VERTEX_SHADER, "instanced_rsm.vert",
GL_FRAGMENT_SHADER, "instanced_rsm.frag"); GL_FRAGMENT_SHADER, "instanced_rsm.frag");
assignUniforms("RSMMatrix"); assignUniforms("RSMMatrix");
@ -297,10 +286,8 @@ class InstancedSphereMapShader : public TextureShader<InstancedSphereMapShader,
public: public:
InstancedSphereMapShader() InstancedSphereMapShader()
{ {
loadProgram(OBJECT, GL_VERTEX_SHADER, "utils/getworldmatrix.vert", loadProgram(OBJECT,
GL_VERTEX_SHADER, "instanced_object_pass.vert", GL_VERTEX_SHADER, "instanced_object_pass.vert",
GL_FRAGMENT_SHADER, "utils/getLightFactor.frag",
GL_FRAGMENT_SHADER, "utils/getPosFromUVDepth.frag",
GL_FRAGMENT_SHADER, "instanced_objectpass_spheremap.frag"); GL_FRAGMENT_SHADER, "instanced_objectpass_spheremap.frag");
assignUniforms(); assignUniforms();
assignSamplerNames(0, "DiffuseMap", ST_NEAREST_FILTERED, assignSamplerNames(0, "DiffuseMap", ST_NEAREST_FILTERED,
@ -369,9 +356,7 @@ class InstancedNormalMapShader : public TextureShader<InstancedNormalMapShader,
public: public:
InstancedNormalMapShader() InstancedNormalMapShader()
{ {
loadProgram(OBJECT, GL_VERTEX_SHADER, "utils/getworldmatrix.vert", loadProgram(OBJECT, GL_VERTEX_SHADER, "instanced_object_pass.vert",
GL_VERTEX_SHADER, "instanced_object_pass.vert",
GL_FRAGMENT_SHADER, "utils/encode_normal.frag",
GL_FRAGMENT_SHADER, "instanced_normalmap.frag"); GL_FRAGMENT_SHADER, "instanced_normalmap.frag");
assignUniforms(); assignUniforms();
assignSamplerNames(0, "normalMap", ST_TRILINEAR_ANISOTROPIC_FILTERED, assignSamplerNames(0, "normalMap", ST_TRILINEAR_ANISOTROPIC_FILTERED,
@ -402,8 +387,7 @@ class InstancedObjectUnlitShader : public TextureShader<InstancedObjectUnlitShad
public: public:
InstancedObjectUnlitShader() InstancedObjectUnlitShader()
{ {
loadProgram(OBJECT, GL_VERTEX_SHADER, "utils/getworldmatrix.vert", loadProgram(OBJECT, GL_VERTEX_SHADER, "instanced_object_pass.vert",
GL_VERTEX_SHADER, "instanced_object_pass.vert",
GL_FRAGMENT_SHADER, "instanced_object_unlit.frag"); GL_FRAGMENT_SHADER, "instanced_object_unlit.frag");
assignUniforms(); assignUniforms();
assignSamplerNames(0, "DiffuseMap", ST_NEAREST_FILTERED, assignSamplerNames(0, "DiffuseMap", ST_NEAREST_FILTERED,
@ -454,14 +438,12 @@ public:
return; return;
if (CVS->isAMDVertexShaderLayerUsable()) if (CVS->isAMDVertexShaderLayerUsable())
{ {
loadProgram(OBJECT,GL_VERTEX_SHADER, "utils/getworldmatrix.vert", loadProgram(OBJECT,GL_VERTEX_SHADER, "instanciedshadow.vert",
GL_VERTEX_SHADER, "instanciedshadow.vert",
GL_FRAGMENT_SHADER, "instanced_shadowref.frag"); GL_FRAGMENT_SHADER, "instanced_shadowref.frag");
} }
else else
{ {
loadProgram(OBJECT,GL_VERTEX_SHADER, "utils/getworldmatrix.vert", loadProgram(OBJECT,GL_VERTEX_SHADER, "instanciedshadow.vert",
GL_VERTEX_SHADER, "instanciedshadow.vert",
GL_GEOMETRY_SHADER, "instanced_shadow.geom", GL_GEOMETRY_SHADER, "instanced_shadow.geom",
GL_FRAGMENT_SHADER, "instanced_shadowref.frag"); GL_FRAGMENT_SHADER, "instanced_shadowref.frag");
} }
@ -508,8 +490,7 @@ public:
NormalVisualizer() NormalVisualizer()
{ {
#if !defined(ANDROID) && !defined(USE_GLES2) //????? #if !defined(ANDROID) && !defined(USE_GLES2) //?????
loadProgram(OBJECT, GL_VERTEX_SHADER, "utils/getworldmatrix.vert", loadProgram(OBJECT, GL_VERTEX_SHADER, "instanced_object_pass.vert",
GL_VERTEX_SHADER, "instanced_object_pass.vert",
GL_GEOMETRY_SHADER, "normal_visualizer.geom", GL_GEOMETRY_SHADER, "normal_visualizer.geom",
GL_FRAGMENT_SHADER, "coloredquad.frag"); GL_FRAGMENT_SHADER, "coloredquad.frag");
assignUniforms("color"); assignUniforms("color");
@ -659,9 +640,7 @@ class InstancedGrassPass1Shader : public TextureShader<InstancedGrassPass1Shader
public: public:
InstancedGrassPass1Shader() InstancedGrassPass1Shader()
{ {
loadProgram(OBJECT, GL_VERTEX_SHADER, "utils/getworldmatrix.vert", loadProgram(OBJECT, GL_VERTEX_SHADER, "instanced_grass.vert",
GL_VERTEX_SHADER, "instanced_grass.vert",
GL_FRAGMENT_SHADER, "utils/encode_normal.frag",
GL_FRAGMENT_SHADER, "instanced_objectref_pass1.frag"); GL_FRAGMENT_SHADER, "instanced_objectref_pass1.frag");
assignUniforms("windDir"); assignUniforms("windDir");
assignSamplerNames(0, "tex", ST_TRILINEAR_ANISOTROPIC_FILTERED, assignSamplerNames(0, "tex", ST_TRILINEAR_ANISOTROPIC_FILTERED,
@ -710,14 +689,12 @@ public:
return; return;
if (CVS->isAMDVertexShaderLayerUsable()) if (CVS->isAMDVertexShaderLayerUsable())
{ {
loadProgram(OBJECT, GL_VERTEX_SHADER, "utils/getworldmatrix.vert", loadProgram(OBJECT, GL_VERTEX_SHADER, "instanciedgrassshadow.vert",
GL_VERTEX_SHADER, "instanciedgrassshadow.vert",
GL_FRAGMENT_SHADER, "instanced_shadowref.frag"); GL_FRAGMENT_SHADER, "instanced_shadowref.frag");
} }
else else
{ {
loadProgram(OBJECT, GL_VERTEX_SHADER, "utils/getworldmatrix.vert", loadProgram(OBJECT, GL_VERTEX_SHADER, "instanciedgrassshadow.vert",
GL_VERTEX_SHADER, "instanciedgrassshadow.vert",
GL_GEOMETRY_SHADER, "instanced_shadow.geom", GL_GEOMETRY_SHADER, "instanced_shadow.geom",
GL_FRAGMENT_SHADER, "instanced_shadowref.frag"); GL_FRAGMENT_SHADER, "instanced_shadowref.frag");
} }
@ -754,9 +731,7 @@ class InstancedGrassPass2Shader : public TextureShader<InstancedGrassPass2Shader
public: public:
InstancedGrassPass2Shader() InstancedGrassPass2Shader()
{ {
loadProgram(OBJECT, GL_VERTEX_SHADER, "utils/getworldmatrix.vert", loadProgram(OBJECT, GL_VERTEX_SHADER, "instanced_grass.vert",
GL_VERTEX_SHADER, "instanced_grass.vert",
GL_FRAGMENT_SHADER, "utils/getLightFactor.frag",
GL_FRAGMENT_SHADER, "instanced_grass_pass2.frag"); GL_FRAGMENT_SHADER, "instanced_grass_pass2.frag");
assignUniforms("windDir", "SunDir"); assignUniforms("windDir", "SunDir");
assignSamplerNames(0, "DiffuseMap", ST_NEAREST_FILTERED, assignSamplerNames(0, "DiffuseMap", ST_NEAREST_FILTERED,
@ -793,9 +768,8 @@ class InstancedDetailedObjectPass2Shader : public TextureShader<InstancedDetaile
public: public:
InstancedDetailedObjectPass2Shader() InstancedDetailedObjectPass2Shader()
{ {
loadProgram(OBJECT, GL_VERTEX_SHADER, "utils/getworldmatrix.vert", loadProgram(OBJECT,
GL_VERTEX_SHADER, "instanced_object_pass.vert", GL_VERTEX_SHADER, "instanced_object_pass.vert",
GL_FRAGMENT_SHADER, "utils/getLightFactor.frag",
GL_FRAGMENT_SHADER, "instanced_detailed_object_pass2.frag"); GL_FRAGMENT_SHADER, "instanced_detailed_object_pass2.frag");
assignUniforms(); assignUniforms();
assignSamplerNames(0, "DiffuseMap", ST_NEAREST_FILTERED, assignSamplerNames(0, "DiffuseMap", ST_NEAREST_FILTERED,

View File

@ -66,10 +66,6 @@ public:
PointLightShader() PointLightShader()
{ {
loadProgram(OBJECT, GL_VERTEX_SHADER, "pointlight.vert", loadProgram(OBJECT, GL_VERTEX_SHADER, "pointlight.vert",
GL_FRAGMENT_SHADER, "utils/decodeNormal.frag",
GL_FRAGMENT_SHADER, "utils/SpecularBRDF.frag",
GL_FRAGMENT_SHADER, "utils/DiffuseBRDF.frag",
GL_FRAGMENT_SHADER, "utils/getPosFromUVDepth.frag",
GL_FRAGMENT_SHADER, "pointlight.frag"); GL_FRAGMENT_SHADER, "pointlight.frag");
assignUniforms(); assignUniforms();
@ -125,7 +121,6 @@ public:
PointLightScatterShader() PointLightScatterShader()
{ {
loadProgram(OBJECT, GL_VERTEX_SHADER, "pointlight.vert", loadProgram(OBJECT, GL_VERTEX_SHADER, "pointlight.vert",
GL_FRAGMENT_SHADER, "utils/getPosFromUVDepth.frag",
GL_FRAGMENT_SHADER, "pointlightscatter.frag"); GL_FRAGMENT_SHADER, "pointlightscatter.frag");
assignUniforms("density", "fogcol"); assignUniforms("density", "fogcol");
@ -175,11 +170,6 @@ public:
ShadowedSunLightShaderPCF() ShadowedSunLightShaderPCF()
{ {
loadProgram(OBJECT, GL_VERTEX_SHADER, "screenquad.vert", loadProgram(OBJECT, GL_VERTEX_SHADER, "screenquad.vert",
GL_FRAGMENT_SHADER, "utils/decodeNormal.frag",
GL_FRAGMENT_SHADER, "utils/SpecularBRDF.frag",
GL_FRAGMENT_SHADER, "utils/DiffuseBRDF.frag",
GL_FRAGMENT_SHADER, "utils/getPosFromUVDepth.frag",
GL_FRAGMENT_SHADER, "utils/SunMRP.frag",
GL_FRAGMENT_SHADER, "sunlightshadow.frag"); GL_FRAGMENT_SHADER, "sunlightshadow.frag");
// Use 8 to circumvent a catalyst bug when binding sampler // Use 8 to circumvent a catalyst bug when binding sampler
@ -212,11 +202,6 @@ public:
ShadowedSunLightShaderESM() ShadowedSunLightShaderESM()
{ {
loadProgram(OBJECT, GL_VERTEX_SHADER, "screenquad.vert", loadProgram(OBJECT, GL_VERTEX_SHADER, "screenquad.vert",
GL_FRAGMENT_SHADER, "utils/decodeNormal.frag",
GL_FRAGMENT_SHADER, "utils/SpecularBRDF.frag",
GL_FRAGMENT_SHADER, "utils/DiffuseBRDF.frag",
GL_FRAGMENT_SHADER, "utils/getPosFromUVDepth.frag",
GL_FRAGMENT_SHADER, "utils/SunMRP.frag",
GL_FRAGMENT_SHADER, "sunlightshadowesm.frag"); GL_FRAGMENT_SHADER, "sunlightshadowesm.frag");
// Use 8 to circumvent a catalyst bug when binding sampler // Use 8 to circumvent a catalyst bug when binding sampler
@ -299,7 +284,6 @@ public:
FogShader() FogShader()
{ {
loadProgram(OBJECT, GL_VERTEX_SHADER, "screenquad.vert", loadProgram(OBJECT, GL_VERTEX_SHADER, "screenquad.vert",
GL_FRAGMENT_SHADER, "utils/getPosFromUVDepth.frag",
GL_FRAGMENT_SHADER, "fog.frag"); GL_FRAGMENT_SHADER, "fog.frag");
assignUniforms("density", "col"); assignUniforms("density", "col");
assignSamplerNames(0, "tex", ST_NEAREST_FILTERED); assignSamplerNames(0, "tex", ST_NEAREST_FILTERED);

View File

@ -48,8 +48,7 @@ public:
LightspaceBoundingBoxShader() LightspaceBoundingBoxShader()
{ {
#if !defined(ANDROID) && !defined(USE_GLES2) #if !defined(ANDROID) && !defined(USE_GLES2)
loadProgram(OBJECT, GL_COMPUTE_SHADER, "Lightspaceboundingbox.comp", loadProgram(OBJECT, GL_COMPUTE_SHADER, "Lightspaceboundingbox.comp");
GL_COMPUTE_SHADER, "utils/getPosFromUVDepth.frag");
assignSamplerNames(0, "depth", ST_NEAREST_FILTERED); assignSamplerNames(0, "depth", ST_NEAREST_FILTERED);
assignUniforms("SunCamMatrix", "split0", "split1", "split2", "splitmax"); assignUniforms("SunCamMatrix", "split0", "split1", "split2", "splitmax");
GLuint block_idx = GLuint block_idx =