Common.ShaderLib.MultiSample.glsllib Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jme3-core Show documentation
Show all versions of jme3-core Show documentation
jMonkeyEngine is a 3-D game engine for adventurous Java developers
#extension GL_ARB_texture_multisample : enable
uniform int m_NumSamples;
uniform int m_NumSamplesDepth;
#ifdef RESOLVE_MS
#define COLORTEXTURE sampler2DMS
#else
#define COLORTEXTURE sampler2D
#endif
#ifdef RESOLVE_DEPTH_MS
#define DEPTHTEXTURE sampler2DMS
#else
#define DEPTHTEXTURE sampler2D
#endif
// NOTE: Only define multisample functions if multisample is available
#if defined(GL_ARB_texture_multisample) || (defined GL_ES && __VERSION__>=310)
vec4 textureFetch(in sampler2DMS tex,in vec2 texC, in int numSamples){
ivec2 iTexC = ivec2(texC * vec2(textureSize(tex)));
vec4 color = vec4(0.0);
for (int i = 0; i < numSamples; i++){
color += texelFetch(tex, iTexC, i);
}
return color / float(numSamples);
}
vec4 fetchTextureSample(in sampler2DMS tex,in vec2 texC,in int sampleId){
ivec2 iTexC = ivec2(texC * vec2(textureSize(tex)));
return texelFetch(tex, iTexC, sampleId);
}
vec4 getColor(in sampler2DMS tex, in vec2 texC){
return textureFetch(tex, texC, m_NumSamples);
}
vec4 getColorSingle(in sampler2DMS tex, in vec2 texC){
ivec2 iTexC = ivec2(texC * vec2(textureSize(tex)));
return texelFetch(tex, iTexC, 0);
}
vec4 getDepth(in sampler2DMS tex,in vec2 texC){
return textureFetch(tex,texC,m_NumSamplesDepth);
}
#endif
vec4 fetchTextureSample(in sampler2D tex,in vec2 texC,in int sampleId){
return texture2D(tex,texC);
}
vec4 getColor(in sampler2D tex, in vec2 texC){
return texture2D(tex,texC);
}
vec4 getColorSingle(in sampler2D tex, in vec2 texC){
return texture2D(tex, texC);
}
vec4 getDepth(in sampler2D tex,in vec2 texC){
return texture2D(tex,texC);
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy