Added a GLSL150 to most of the shaders used in the engine (except deprecated ones).
All shaders now import the GLSLCompat.glsllib
This commit is contained in:
parent
12a2f0f63c
commit
d537a1c22e
@ -47,6 +47,10 @@ import com.jme3.ui.Picture;
|
|||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated use the ToneMappingFilter.
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
public class HDRRenderer implements SceneProcessor {
|
public class HDRRenderer implements SceneProcessor {
|
||||||
|
|
||||||
private static final int LUMMODE_NONE = 0x1,
|
private static final int LUMMODE_NONE = 0x1,
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
#import "Common/ShaderLib/GLSLCompat.glsllib"
|
||||||
uniform sampler2D m_Texture; // this should hold the texture rendered by the horizontal blur pass
|
uniform sampler2D m_Texture; // this should hold the texture rendered by the horizontal blur pass
|
||||||
uniform float m_Size;
|
uniform float m_Size;
|
||||||
uniform float m_Scale;
|
uniform float m_Scale;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
MaterialDef Bloom {
|
MaterialDef HGaussianBlur {
|
||||||
|
|
||||||
MaterialParameters {
|
MaterialParameters {
|
||||||
Int NumSamples
|
Int NumSamples
|
||||||
@ -8,8 +8,8 @@ MaterialDef Bloom {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Technique {
|
Technique {
|
||||||
VertexShader GLSL100: Common/MatDefs/Post/Post.vert
|
VertexShader GLSL100 GLSL150: Common/MatDefs/Post/Post.vert
|
||||||
FragmentShader GLSL100: Common/MatDefs/Blur/HGaussianBlur.frag
|
FragmentShader GLSL100 GLSL150: Common/MatDefs/Blur/HGaussianBlur.frag
|
||||||
|
|
||||||
WorldParameters {
|
WorldParameters {
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,11 @@
|
|||||||
uniform sampler2D m_Texture;
|
#import "Common/ShaderLib/GLSLCompat.glsllib"
|
||||||
|
#import "Common/ShaderLib/MultiSample.glsllib"
|
||||||
|
|
||||||
|
uniform COLORTEXTURE m_Texture;
|
||||||
uniform float m_SampleDist;
|
uniform float m_SampleDist;
|
||||||
uniform float m_SampleStrength;
|
uniform float m_SampleStrength;
|
||||||
uniform float m_Samples[10];
|
uniform float m_Samples[10];
|
||||||
|
|
||||||
varying vec2 texCoord;
|
varying vec2 texCoord;
|
||||||
|
|
||||||
void main(void)
|
void main(void)
|
||||||
@ -22,15 +26,14 @@ void main(void)
|
|||||||
|
|
||||||
// this is the original colour of this fragment
|
// this is the original colour of this fragment
|
||||||
// using only this would result in a nonblurred version
|
// using only this would result in a nonblurred version
|
||||||
vec4 colorRes = texture2D(m_Texture,texCoord);
|
vec4 colorRes = getColor(m_Texture,texCoord);
|
||||||
|
|
||||||
vec4 sum = colorRes;
|
vec4 sum = colorRes;
|
||||||
|
|
||||||
// take 10 additional blur samples in the direction towards
|
// take 10 additional blur samples in the direction towards
|
||||||
// the center of the screen
|
// the center of the screen
|
||||||
for (int i = 0; i < 10; i++)
|
for (int i = 0; i < 10; i++){
|
||||||
{
|
sum += getColor( m_Texture, texCoord + dir * m_Samples[i] * m_SampleDist );
|
||||||
sum += texture2D( m_Texture, texCoord + dir * m_Samples[i] * m_SampleDist );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// we have taken eleven samples
|
// we have taken eleven samples
|
||||||
@ -42,6 +45,6 @@ void main(void)
|
|||||||
t = clamp( t ,0.0,1.0); //0 <= t <= 1
|
t = clamp( t ,0.0,1.0); //0 <= t <= 1
|
||||||
|
|
||||||
//Blend the original color with the averaged pixels
|
//Blend the original color with the averaged pixels
|
||||||
gl_FragColor =mix( colorRes, sum, t );
|
gl_FragColor = mix( colorRes, sum, t );
|
||||||
|
|
||||||
}
|
}
|
@ -10,8 +10,8 @@ MaterialDef Radial Blur {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Technique {
|
Technique {
|
||||||
VertexShader GLSL150: Common/MatDefs/Post/Post15.vert
|
VertexShader GLSL120 GLSL150: Common/MatDefs/Post/Post.vert
|
||||||
FragmentShader GLSL150: Common/MatDefs/Blur/RadialBlur15.frag
|
FragmentShader GLSL120 GLSL150: Common/MatDefs/Blur/RadialBlur.frag
|
||||||
|
|
||||||
WorldParameters {
|
WorldParameters {
|
||||||
}
|
}
|
||||||
@ -20,12 +20,4 @@ MaterialDef Radial Blur {
|
|||||||
RESOLVE_MS : NumSamples
|
RESOLVE_MS : NumSamples
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Technique {
|
|
||||||
VertexShader GLSL120: Common/MatDefs/Post/Post.vert
|
|
||||||
FragmentShader GLSL120: Common/MatDefs/Blur/RadialBlur.frag
|
|
||||||
|
|
||||||
WorldParameters {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -1,50 +0,0 @@
|
|||||||
#import "Common/ShaderLib/MultiSample.glsllib"
|
|
||||||
|
|
||||||
uniform COLORTEXTURE m_Texture;
|
|
||||||
uniform float m_SampleDist;
|
|
||||||
uniform float m_SampleStrength;
|
|
||||||
uniform float m_Samples[10];
|
|
||||||
|
|
||||||
in vec2 texCoord;
|
|
||||||
out vec4 outFragColor;
|
|
||||||
|
|
||||||
void main(void)
|
|
||||||
{
|
|
||||||
// some sample positions
|
|
||||||
//float samples[10] = float[](-0.08,-0.05,-0.03,-0.02,-0.01,0.01,0.02,0.03,0.05,0.08);
|
|
||||||
|
|
||||||
// 0.5,0.5 is the center of the screen
|
|
||||||
// so substracting texCoord from it will result in
|
|
||||||
// a vector pointing to the middle of the screen
|
|
||||||
vec2 dir = 0.5 - texCoord;
|
|
||||||
|
|
||||||
// calculate the distance to the center of the screen
|
|
||||||
float dist = sqrt(dir.x*dir.x + dir.y*dir.y);
|
|
||||||
|
|
||||||
// normalize the direction (reuse the distance)
|
|
||||||
dir = dir/dist;
|
|
||||||
|
|
||||||
// this is the original colour of this fragment
|
|
||||||
// using only this would result in a nonblurred version
|
|
||||||
vec4 colorRes = getColor(m_Texture,texCoord);
|
|
||||||
|
|
||||||
vec4 sum = colorRes;
|
|
||||||
|
|
||||||
// take 10 additional blur samples in the direction towards
|
|
||||||
// the center of the screen
|
|
||||||
for (int i = 0; i < 10; i++){
|
|
||||||
sum += getColor( m_Texture, texCoord + dir * m_Samples[i] * m_SampleDist );
|
|
||||||
}
|
|
||||||
|
|
||||||
// we have taken eleven samples
|
|
||||||
sum *= 1.0/11.0;
|
|
||||||
|
|
||||||
// weighten the blur effect with the distance to the
|
|
||||||
// center of the screen ( further out is blurred more)
|
|
||||||
float t = dist * m_SampleStrength;
|
|
||||||
t = clamp( t ,0.0,1.0); //0 <= t <= 1
|
|
||||||
|
|
||||||
//Blend the original color with the averaged pixels
|
|
||||||
outFragColor =mix( colorRes, sum, t );
|
|
||||||
|
|
||||||
}
|
|
@ -1,3 +1,4 @@
|
|||||||
|
#import "Common/ShaderLib/GLSLCompat.glsllib"
|
||||||
uniform sampler2D m_Texture; // this should hold the texture rendered by the horizontal blur pass
|
uniform sampler2D m_Texture; // this should hold the texture rendered by the horizontal blur pass
|
||||||
uniform float m_Size;
|
uniform float m_Size;
|
||||||
uniform float m_Scale;
|
uniform float m_Scale;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
MaterialDef Bloom {
|
MaterialDef VGaussianBlur {
|
||||||
|
|
||||||
MaterialParameters {
|
MaterialParameters {
|
||||||
Int NumSamples
|
Int NumSamples
|
||||||
@ -8,8 +8,8 @@ MaterialDef Bloom {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Technique {
|
Technique {
|
||||||
VertexShader GLSL100: Common/MatDefs/Post/Post.vert
|
VertexShader GLSL100 GLSL150: Common/MatDefs/Post/Post.vert
|
||||||
FragmentShader GLSL100: Common/MatDefs/Blur/VGaussianBlur.frag
|
FragmentShader GLSL100 GLSL150: Common/MatDefs/Blur/VGaussianBlur.frag
|
||||||
|
|
||||||
WorldParameters {
|
WorldParameters {
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
//Don't use this
|
||||||
MaterialDef Phong Lighting Deferred {
|
MaterialDef Phong Lighting Deferred {
|
||||||
|
|
||||||
MaterialParameters {
|
MaterialParameters {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
|
#import "Common/ShaderLib/GLSLCompat.glsllib"
|
||||||
#if defined(NEED_TEXCOORD1)
|
#if defined(NEED_TEXCOORD1)
|
||||||
varying vec2 texCoord1;
|
varying vec2 texCoord1;
|
||||||
#else
|
#else
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
#import "Common/ShaderLib/GLSLCompat.glsllib"
|
||||||
#import "Common/ShaderLib/Parallax.glsllib"
|
#import "Common/ShaderLib/Parallax.glsllib"
|
||||||
#import "Common/ShaderLib/Optics.glsllib"
|
#import "Common/ShaderLib/Optics.glsllib"
|
||||||
#ifndef VERTEX_LIGHTING
|
#ifndef VERTEX_LIGHTING
|
||||||
|
@ -120,8 +120,8 @@ MaterialDef Phong Lighting {
|
|||||||
Technique {
|
Technique {
|
||||||
LightMode SinglePass
|
LightMode SinglePass
|
||||||
|
|
||||||
VertexShader GLSL100: Common/MatDefs/Light/SPLighting.vert
|
VertexShader GLSL100 GLSL150: Common/MatDefs/Light/SPLighting.vert
|
||||||
FragmentShader GLSL100: Common/MatDefs/Light/SPLighting.frag
|
FragmentShader GLSL100 GLSL150: Common/MatDefs/Light/SPLighting.frag
|
||||||
|
|
||||||
WorldParameters {
|
WorldParameters {
|
||||||
WorldViewProjectionMatrix
|
WorldViewProjectionMatrix
|
||||||
@ -159,8 +159,8 @@ MaterialDef Phong Lighting {
|
|||||||
|
|
||||||
LightMode MultiPass
|
LightMode MultiPass
|
||||||
|
|
||||||
VertexShader GLSL100: Common/MatDefs/Light/Lighting.vert
|
VertexShader GLSL100 GLSL150: Common/MatDefs/Light/Lighting.vert
|
||||||
FragmentShader GLSL100: Common/MatDefs/Light/Lighting.frag
|
FragmentShader GLSL100 GLSL150: Common/MatDefs/Light/Lighting.frag
|
||||||
|
|
||||||
WorldParameters {
|
WorldParameters {
|
||||||
WorldViewProjectionMatrix
|
WorldViewProjectionMatrix
|
||||||
@ -194,12 +194,10 @@ MaterialDef Phong Lighting {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Technique PreShadow {
|
Technique PreShadow {
|
||||||
|
|
||||||
VertexShader GLSL100 : Common/MatDefs/Shadow/PreShadow.vert
|
VertexShader GLSL100 GLSL150 : Common/MatDefs/Shadow/PreShadow.vert
|
||||||
FragmentShader GLSL100 : Common/MatDefs/Shadow/PreShadow.frag
|
FragmentShader GLSL100 GLSL150 : Common/MatDefs/Shadow/PreShadow.frag
|
||||||
|
|
||||||
WorldParameters {
|
WorldParameters {
|
||||||
WorldViewProjectionMatrix
|
WorldViewProjectionMatrix
|
||||||
@ -226,8 +224,8 @@ MaterialDef Phong Lighting {
|
|||||||
|
|
||||||
|
|
||||||
Technique PostShadow {
|
Technique PostShadow {
|
||||||
VertexShader GLSL150: Common/MatDefs/Shadow/PostShadow.vert
|
VertexShader GLSL100 GLSL150: Common/MatDefs/Shadow/PostShadow.vert
|
||||||
FragmentShader GLSL150: Common/MatDefs/Shadow/PostShadow.frag
|
FragmentShader GLSL100 GLSL150: Common/MatDefs/Shadow/PostShadow.frag
|
||||||
|
|
||||||
WorldParameters {
|
WorldParameters {
|
||||||
WorldViewProjectionMatrix
|
WorldViewProjectionMatrix
|
||||||
@ -258,43 +256,11 @@ MaterialDef Phong Lighting {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Technique PostShadow{
|
|
||||||
VertexShader GLSL100: Common/MatDefs/Shadow/PostShadow.vert
|
|
||||||
FragmentShader GLSL100: Common/MatDefs/Shadow/PostShadow.frag
|
|
||||||
|
|
||||||
WorldParameters {
|
|
||||||
WorldViewProjectionMatrix
|
|
||||||
WorldMatrix
|
|
||||||
ViewProjectionMatrix
|
|
||||||
ViewMatrix
|
|
||||||
NormalMatrix
|
|
||||||
}
|
|
||||||
|
|
||||||
Defines {
|
|
||||||
HARDWARE_SHADOWS : HardwareShadows
|
|
||||||
FILTER_MODE : FilterMode
|
|
||||||
PCFEDGE : PCFEdge
|
|
||||||
DISCARD_ALPHA : AlphaDiscardThreshold
|
|
||||||
SHADOWMAP_SIZE : ShadowMapSize
|
|
||||||
FADE : FadeInfo
|
|
||||||
PSSM : Splits
|
|
||||||
POINTLIGHT : LightViewProjectionMatrix5
|
|
||||||
NUM_BONES : NumberOfBones
|
|
||||||
INSTANCING : UseInstancing
|
|
||||||
BACKFACE_SHADOWS: BackfaceShadows
|
|
||||||
}
|
|
||||||
|
|
||||||
ForcedRenderState {
|
|
||||||
Blend Modulate
|
|
||||||
DepthWrite Off
|
|
||||||
PolyOffset -0.1 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Technique PreNormalPass {
|
Technique PreNormalPass {
|
||||||
|
|
||||||
VertexShader GLSL100 : Common/MatDefs/SSAO/normal.vert
|
VertexShader GLSL100 GLSL150 : Common/MatDefs/SSAO/normal.vert
|
||||||
FragmentShader GLSL100 : Common/MatDefs/SSAO/normal.frag
|
FragmentShader GLSL100 GLSL150 : Common/MatDefs/SSAO/normal.frag
|
||||||
|
|
||||||
WorldParameters {
|
WorldParameters {
|
||||||
WorldViewProjectionMatrix
|
WorldViewProjectionMatrix
|
||||||
@ -312,54 +278,10 @@ MaterialDef Phong Lighting {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Technique PreNormalPassDerivative {
|
|
||||||
|
|
||||||
VertexShader GLSL100 : Common/MatDefs/MSSAO/normal.vert
|
|
||||||
FragmentShader GLSL100 : Common/MatDefs/MSSAO/normal.frag
|
|
||||||
|
|
||||||
WorldParameters {
|
|
||||||
WorldViewProjectionMatrix
|
|
||||||
WorldViewMatrix
|
|
||||||
NormalMatrix
|
|
||||||
ViewProjectionMatrix
|
|
||||||
ViewMatrix
|
|
||||||
}
|
|
||||||
|
|
||||||
Defines {
|
|
||||||
DIFFUSEMAP_ALPHA : DiffuseMap
|
|
||||||
NUM_BONES : NumberOfBones
|
|
||||||
INSTANCING : UseInstancing
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
Technique GBuf {
|
|
||||||
|
|
||||||
VertexShader GLSL100: Common/MatDefs/Light/GBuf.vert
|
|
||||||
FragmentShader GLSL100: Common/MatDefs/Light/GBuf.frag
|
|
||||||
|
|
||||||
WorldParameters {
|
|
||||||
WorldViewProjectionMatrix
|
|
||||||
NormalMatrix
|
|
||||||
WorldViewMatrix
|
|
||||||
WorldMatrix
|
|
||||||
}
|
|
||||||
|
|
||||||
Defines {
|
|
||||||
VERTEX_COLOR : UseVertexColor
|
|
||||||
MATERIAL_COLORS : UseMaterialColors
|
|
||||||
DIFFUSEMAP : DiffuseMap
|
|
||||||
NORMALMAP : NormalMap
|
|
||||||
SPECULARMAP : SpecularMap
|
|
||||||
PARALLAXMAP : ParallaxMap
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Technique Glow {
|
Technique Glow {
|
||||||
|
|
||||||
VertexShader GLSL100: Common/MatDefs/Misc/Unshaded.vert
|
VertexShader GLSL100 GLSL150: Common/MatDefs/Misc/Unshaded.vert
|
||||||
FragmentShader GLSL100: Common/MatDefs/Light/Glow.frag
|
FragmentShader GLSL100 GLSL150: Common/MatDefs/Light/Glow.frag
|
||||||
|
|
||||||
WorldParameters {
|
WorldParameters {
|
||||||
WorldViewProjectionMatrix
|
WorldViewProjectionMatrix
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
#import "Common/ShaderLib/GLSLCompat.glsllib"
|
||||||
#import "Common/ShaderLib/Instancing.glsllib"
|
#import "Common/ShaderLib/Instancing.glsllib"
|
||||||
#import "Common/ShaderLib/Skinning.glsllib"
|
#import "Common/ShaderLib/Skinning.glsllib"
|
||||||
#import "Common/ShaderLib/Lighting.glsllib"
|
#import "Common/ShaderLib/Lighting.glsllib"
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#import "Common/ShaderLib/PBR.glsllib"
|
|
||||||
#import "Common/ShaderLib/GLSLCompat.glsllib"
|
#import "Common/ShaderLib/GLSLCompat.glsllib"
|
||||||
|
#import "Common/ShaderLib/PBR.glsllib"
|
||||||
#import "Common/ShaderLib/Parallax.glsllib"
|
#import "Common/ShaderLib/Parallax.glsllib"
|
||||||
#import "Common/ShaderLib/Lighting.glsllib"
|
#import "Common/ShaderLib/Lighting.glsllib"
|
||||||
|
|
||||||
|
@ -108,11 +108,11 @@ MaterialDef PBR Lighting {
|
|||||||
Boolean BackfaceShadows : false
|
Boolean BackfaceShadows : false
|
||||||
}
|
}
|
||||||
|
|
||||||
Technique {
|
Technique {
|
||||||
LightMode SinglePassAndImageBased
|
LightMode SinglePassAndImageBased
|
||||||
|
|
||||||
VertexShader GLSL110: Common/MatDefs/Light/PBRLighting.vert
|
VertexShader GLSL110 GLSL150: Common/MatDefs/Light/PBRLighting.vert
|
||||||
FragmentShader GLSL110: Common/MatDefs/Light/PBRLighting.frag
|
FragmentShader GLSL110 GLSL150: Common/MatDefs/Light/PBRLighting.frag
|
||||||
|
|
||||||
WorldParameters {
|
WorldParameters {
|
||||||
WorldViewProjectionMatrix
|
WorldViewProjectionMatrix
|
||||||
@ -142,11 +142,10 @@ MaterialDef PBR Lighting {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Technique PreShadow {
|
Technique PreShadow {
|
||||||
|
|
||||||
VertexShader GLSL100 : Common/MatDefs/Shadow/PreShadow.vert
|
VertexShader GLSL100 GLSL150 : Common/MatDefs/Shadow/PreShadow.vert
|
||||||
FragmentShader GLSL100 : Common/MatDefs/Shadow/PreShadow.frag
|
FragmentShader GLSL100 GLSL150 : Common/MatDefs/Shadow/PreShadow.frag
|
||||||
|
|
||||||
WorldParameters {
|
WorldParameters {
|
||||||
WorldViewProjectionMatrix
|
WorldViewProjectionMatrix
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
#import "Common/ShaderLib/GLSLCompat.glsllib"
|
||||||
#import "Common/ShaderLib/Parallax.glsllib"
|
#import "Common/ShaderLib/Parallax.glsllib"
|
||||||
#import "Common/ShaderLib/Optics.glsllib"
|
#import "Common/ShaderLib/Optics.glsllib"
|
||||||
#ifndef VERTEX_LIGHTING
|
#ifndef VERTEX_LIGHTING
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
#import "Common/ShaderLib/GLSLCompat.glsllib"
|
||||||
#import "Common/ShaderLib/Instancing.glsllib"
|
#import "Common/ShaderLib/Instancing.glsllib"
|
||||||
#import "Common/ShaderLib/Skinning.glsllib"
|
#import "Common/ShaderLib/Skinning.glsllib"
|
||||||
#import "Common/ShaderLib/Lighting.glsllib"
|
#import "Common/ShaderLib/Lighting.glsllib"
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
#import "Common/ShaderLib/GLSLCompat.glsllib"
|
||||||
#ifdef POINT_SPRITE
|
#ifdef POINT_SPRITE
|
||||||
# if !defined(GL_ES) && __VERSION__ < 120
|
# if !defined(GL_ES) && __VERSION__ < 120
|
||||||
# error Point sprite is not supported by the video hardware!
|
# error Point sprite is not supported by the video hardware!
|
||||||
|
@ -18,38 +18,14 @@ MaterialDef Point Sprite {
|
|||||||
|
|
||||||
Technique {
|
Technique {
|
||||||
|
|
||||||
VertexShader GLSL100 : Common/MatDefs/Misc/Particle.vert
|
// The GLSL100 technique is used in two cases:
|
||||||
FragmentShader GLSL120 : Common/MatDefs/Misc/Particle.frag
|
|
||||||
|
|
||||||
WorldParameters {
|
|
||||||
WorldViewProjectionMatrix
|
|
||||||
WorldViewMatrix
|
|
||||||
WorldMatrix
|
|
||||||
CameraPosition
|
|
||||||
}
|
|
||||||
|
|
||||||
RenderState {
|
|
||||||
Blend AlphaAdditive
|
|
||||||
DepthWrite Off
|
|
||||||
PointSprite On
|
|
||||||
}
|
|
||||||
|
|
||||||
Defines {
|
|
||||||
USE_TEXTURE : Texture
|
|
||||||
POINT_SPRITE : PointSprite
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Technique {
|
|
||||||
|
|
||||||
// This technique is used in two cases:
|
|
||||||
// - When the driver doesn't support GLSL 1.2
|
// - When the driver doesn't support GLSL 1.2
|
||||||
// - When running on OpenGL ES 2.0
|
// - When running on OpenGL ES 2.0
|
||||||
// Point sprite should be used if running on ES2, but crash
|
// Point sprite should be used if running on ES2, but crash
|
||||||
// if on desktop (because its not supported by HW)
|
// if on desktop (because its not supported by HW)
|
||||||
|
|
||||||
VertexShader GLSL100 : Common/MatDefs/Misc/Particle.vert
|
VertexShader GLSL100 GLSL100 GLSL150 : Common/MatDefs/Misc/Particle.vert
|
||||||
FragmentShader GLSL100 : Common/MatDefs/Misc/Particle.frag
|
FragmentShader GLSL100 GLSL120 GLSL150 : Common/MatDefs/Misc/Particle.frag
|
||||||
|
|
||||||
WorldParameters {
|
WorldParameters {
|
||||||
WorldViewProjectionMatrix
|
WorldViewProjectionMatrix
|
||||||
@ -72,25 +48,31 @@ MaterialDef Point Sprite {
|
|||||||
|
|
||||||
Technique PreShadow {
|
Technique PreShadow {
|
||||||
|
|
||||||
VertexShader GLSL100 : Common/MatDefs/Misc/Particle.vert
|
VertexShader GLSL100 GLSL150 : Common/MatDefs/Shadow/PreShadow.vert
|
||||||
FragmentShader GLSL100 : Common/MatDefs/Misc/Particle.frag
|
FragmentShader GLSL100 GLSL150 : Common/MatDefs/Shadow/PreShadow.frag
|
||||||
|
|
||||||
WorldParameters {
|
WorldParameters {
|
||||||
WorldViewProjectionMatrix
|
WorldViewProjectionMatrix
|
||||||
WorldViewMatrix
|
WorldViewMatrix
|
||||||
WorldMatrix
|
ViewProjectionMatrix
|
||||||
CameraPosition
|
ViewMatrix
|
||||||
}
|
}
|
||||||
|
|
||||||
Defines {
|
Defines {
|
||||||
USE_TEXTURE : Texture
|
COLOR_MAP : ColorMap
|
||||||
PRE_SHADOW
|
DISCARD_ALPHA : AlphaDiscardThreshold
|
||||||
|
NUM_BONES : NumberOfBones
|
||||||
|
INSTANCING : UseInstancing
|
||||||
}
|
}
|
||||||
|
|
||||||
ForcedRenderState {
|
ForcedRenderState {
|
||||||
|
FaceCull Off
|
||||||
|
DepthTest On
|
||||||
DepthWrite On
|
DepthWrite On
|
||||||
|
PolyOffset 5 3
|
||||||
ColorWrite Off
|
ColorWrite Off
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Technique SoftParticles{
|
Technique SoftParticles{
|
||||||
@ -117,7 +99,7 @@ MaterialDef Point Sprite {
|
|||||||
|
|
||||||
Technique SoftParticles15{
|
Technique SoftParticles15{
|
||||||
|
|
||||||
VertexShader GLSL100 : Common/MatDefs/Misc/SoftParticle.vert
|
VertexShader GLSL150 : Common/MatDefs/Misc/SoftParticle.vert
|
||||||
FragmentShader GLSL150 : Common/MatDefs/Misc/SoftParticle15.frag
|
FragmentShader GLSL150 : Common/MatDefs/Misc/SoftParticle15.frag
|
||||||
|
|
||||||
WorldParameters {
|
WorldParameters {
|
||||||
@ -150,8 +132,8 @@ MaterialDef Point Sprite {
|
|||||||
|
|
||||||
Technique Glow {
|
Technique Glow {
|
||||||
|
|
||||||
VertexShader GLSL100: Common/MatDefs/Misc/Unshaded.vert
|
VertexShader GLSL100 GLSL150: Common/MatDefs/Misc/Unshaded.vert
|
||||||
FragmentShader GLSL100: Common/MatDefs/Light/Glow.frag
|
FragmentShader GLSL100 GLSL150: Common/MatDefs/Light/Glow.frag
|
||||||
|
|
||||||
WorldParameters {
|
WorldParameters {
|
||||||
WorldViewProjectionMatrix
|
WorldViewProjectionMatrix
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
#import "Common/ShaderLib/GLSLCompat.glsllib"
|
||||||
uniform mat4 g_WorldViewProjectionMatrix;
|
uniform mat4 g_WorldViewProjectionMatrix;
|
||||||
|
|
||||||
attribute vec3 inPosition;
|
attribute vec3 inPosition;
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
#import "Common/ShaderLib/GLSLCompat.glsllib"
|
||||||
varying vec3 normal;
|
varying vec3 normal;
|
||||||
|
|
||||||
void main(){
|
void main(){
|
||||||
|
@ -5,8 +5,8 @@ MaterialDef Debug Normals {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Technique {
|
Technique {
|
||||||
VertexShader GLSL100: Common/MatDefs/Misc/ShowNormals.vert
|
VertexShader GLSL100 GLSL150: Common/MatDefs/Misc/ShowNormals.vert
|
||||||
FragmentShader GLSL100: Common/MatDefs/Misc/ShowNormals.frag
|
FragmentShader GLSL100 GLSL150: Common/MatDefs/Misc/ShowNormals.frag
|
||||||
|
|
||||||
WorldParameters {
|
WorldParameters {
|
||||||
WorldViewProjectionMatrix
|
WorldViewProjectionMatrix
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
#import "Common/ShaderLib/GLSLCompat.glsllib"
|
||||||
#import "Common/ShaderLib/Instancing.glsllib"
|
#import "Common/ShaderLib/Instancing.glsllib"
|
||||||
|
|
||||||
attribute vec3 inPosition;
|
attribute vec3 inPosition;
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
#import "Common/ShaderLib/GLSLCompat.glsllib"
|
||||||
#import "Common/ShaderLib/Optics.glsllib"
|
#import "Common/ShaderLib/Optics.glsllib"
|
||||||
|
|
||||||
uniform ENVMAP m_Texture;
|
uniform ENVMAP m_Texture;
|
||||||
|
@ -6,8 +6,8 @@ MaterialDef Sky Plane {
|
|||||||
Vector3 NormalScale
|
Vector3 NormalScale
|
||||||
}
|
}
|
||||||
Technique {
|
Technique {
|
||||||
VertexShader GLSL100: Common/MatDefs/Misc/Sky.vert
|
VertexShader GLSL100 GLSL150: Common/MatDefs/Misc/Sky.vert
|
||||||
FragmentShader GLSL100: Common/MatDefs/Misc/Sky.frag
|
FragmentShader GLSL100 GLSL150: Common/MatDefs/Misc/Sky.frag
|
||||||
|
|
||||||
WorldParameters {
|
WorldParameters {
|
||||||
ViewMatrix
|
ViewMatrix
|
||||||
@ -17,7 +17,7 @@ MaterialDef Sky Plane {
|
|||||||
|
|
||||||
Defines {
|
Defines {
|
||||||
SPHERE_MAP : SphereMap
|
SPHERE_MAP : SphereMap
|
||||||
EQUIRECT_MAP : EquirectMap
|
EQUIRECT_MAP : EquirectMap
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderState {
|
RenderState {
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
#import "Common/ShaderLib/GLSLCompat.glsllib"
|
||||||
uniform mat4 g_ViewMatrix;
|
uniform mat4 g_ViewMatrix;
|
||||||
uniform mat4 g_ProjectionMatrix;
|
uniform mat4 g_ProjectionMatrix;
|
||||||
uniform mat4 g_WorldMatrix;
|
uniform mat4 g_WorldMatrix;
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
#import "Common/ShaderLib/GLSLCompat.glsllib"
|
||||||
uniform mat4 g_WorldViewProjectionMatrix;
|
uniform mat4 g_WorldViewProjectionMatrix;
|
||||||
|
|
||||||
attribute vec3 inPosition;
|
attribute vec3 inPosition;
|
||||||
|
@ -56,30 +56,8 @@ MaterialDef Unshaded {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Technique {
|
Technique {
|
||||||
VertexShader GLSL150: Common/MatDefs/Misc/Unshaded.vert
|
VertexShader GLSL100 GLSL150: Common/MatDefs/Misc/Unshaded.vert
|
||||||
FragmentShader GLSL150: Common/MatDefs/Misc/Unshaded.frag
|
FragmentShader GLSL100 GLSL150: Common/MatDefs/Misc/Unshaded.frag
|
||||||
|
|
||||||
WorldParameters {
|
|
||||||
WorldViewProjectionMatrix
|
|
||||||
ViewProjectionMatrix
|
|
||||||
ViewMatrix
|
|
||||||
}
|
|
||||||
|
|
||||||
Defines {
|
|
||||||
INSTANCING : UseInstancing
|
|
||||||
SEPARATE_TEXCOORD : SeparateTexCoord
|
|
||||||
HAS_COLORMAP : ColorMap
|
|
||||||
HAS_LIGHTMAP : LightMap
|
|
||||||
HAS_VERTEXCOLOR : VertexColor
|
|
||||||
HAS_COLOR : Color
|
|
||||||
NUM_BONES : NumberOfBones
|
|
||||||
DISCARD_ALPHA : AlphaDiscardThreshold
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Technique {
|
|
||||||
VertexShader GLSL100: Common/MatDefs/Misc/Unshaded.vert
|
|
||||||
FragmentShader GLSL100: Common/MatDefs/Misc/Unshaded.frag
|
|
||||||
|
|
||||||
WorldParameters {
|
WorldParameters {
|
||||||
WorldViewProjectionMatrix
|
WorldViewProjectionMatrix
|
||||||
@ -101,8 +79,8 @@ MaterialDef Unshaded {
|
|||||||
|
|
||||||
Technique PreNormalPass {
|
Technique PreNormalPass {
|
||||||
|
|
||||||
VertexShader GLSL100 : Common/MatDefs/SSAO/normal.vert
|
VertexShader GLSL100 GLSL150 : Common/MatDefs/SSAO/normal.vert
|
||||||
FragmentShader GLSL100 : Common/MatDefs/SSAO/normal.frag
|
FragmentShader GLSL100 GLSL150 : Common/MatDefs/SSAO/normal.frag
|
||||||
|
|
||||||
WorldParameters {
|
WorldParameters {
|
||||||
WorldViewProjectionMatrix
|
WorldViewProjectionMatrix
|
||||||
@ -120,8 +98,8 @@ MaterialDef Unshaded {
|
|||||||
|
|
||||||
Technique PreShadow {
|
Technique PreShadow {
|
||||||
|
|
||||||
VertexShader GLSL100 : Common/MatDefs/Shadow/PreShadow.vert
|
VertexShader GLSL100 GLSL150 : Common/MatDefs/Shadow/PreShadow.vert
|
||||||
FragmentShader GLSL100 : Common/MatDefs/Shadow/PreShadow.frag
|
FragmentShader GLSL100 GLSL150 : Common/MatDefs/Shadow/PreShadow.frag
|
||||||
|
|
||||||
WorldParameters {
|
WorldParameters {
|
||||||
WorldViewProjectionMatrix
|
WorldViewProjectionMatrix
|
||||||
@ -149,8 +127,8 @@ MaterialDef Unshaded {
|
|||||||
|
|
||||||
|
|
||||||
Technique PostShadow {
|
Technique PostShadow {
|
||||||
VertexShader GLSL150: Common/MatDefs/Shadow/PostShadow.vert
|
VertexShader GLSL100 GLSL150: Common/MatDefs/Shadow/PostShadow.vert
|
||||||
FragmentShader GLSL150: Common/MatDefs/Shadow/PostShadow.frag
|
FragmentShader GLSL100 GLSL150: Common/MatDefs/Shadow/PostShadow.frag
|
||||||
|
|
||||||
WorldParameters {
|
WorldParameters {
|
||||||
WorldViewProjectionMatrix
|
WorldViewProjectionMatrix
|
||||||
@ -181,43 +159,10 @@ MaterialDef Unshaded {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Technique PostShadow {
|
|
||||||
VertexShader GLSL100: Common/MatDefs/Shadow/PostShadow.vert
|
|
||||||
FragmentShader GLSL100: Common/MatDefs/Shadow/PostShadow.frag
|
|
||||||
|
|
||||||
WorldParameters {
|
|
||||||
WorldViewProjectionMatrix
|
|
||||||
WorldMatrix
|
|
||||||
ViewProjectionMatrix
|
|
||||||
ViewMatrix
|
|
||||||
}
|
|
||||||
|
|
||||||
Defines {
|
|
||||||
HARDWARE_SHADOWS : HardwareShadows
|
|
||||||
FILTER_MODE : FilterMode
|
|
||||||
PCFEDGE : PCFEdge
|
|
||||||
DISCARD_ALPHA : AlphaDiscardThreshold
|
|
||||||
COLOR_MAP : ColorMap
|
|
||||||
SHADOWMAP_SIZE : ShadowMapSize
|
|
||||||
FADE : FadeInfo
|
|
||||||
PSSM : Splits
|
|
||||||
POINTLIGHT : LightViewProjectionMatrix5
|
|
||||||
NUM_BONES : NumberOfBones
|
|
||||||
INSTANCING : UseInstancing
|
|
||||||
BACKFACE_SHADOWS: BackfaceShadows
|
|
||||||
}
|
|
||||||
|
|
||||||
ForcedRenderState {
|
|
||||||
Blend Modulate
|
|
||||||
DepthWrite Off
|
|
||||||
PolyOffset -0.1 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Technique Glow {
|
Technique Glow {
|
||||||
|
|
||||||
VertexShader GLSL100: Common/MatDefs/Misc/Unshaded.vert
|
VertexShader GLSL100 GLSL150: Common/MatDefs/Misc/Unshaded.vert
|
||||||
FragmentShader GLSL100: Common/MatDefs/Light/Glow.frag
|
FragmentShader GLSL100 GLSL150: Common/MatDefs/Light/Glow.frag
|
||||||
|
|
||||||
WorldParameters {
|
WorldParameters {
|
||||||
WorldViewProjectionMatrix
|
WorldViewProjectionMatrix
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
#import "Common/ShaderLib/GLSLCompat.glsllib"
|
||||||
#import "Common/ShaderLib/BasicShadow.glsllib"
|
#import "Common/ShaderLib/BasicShadow.glsllib"
|
||||||
|
|
||||||
uniform SHADOWMAP m_ShadowMap;
|
uniform SHADOWMAP m_ShadowMap;
|
||||||
|
@ -6,8 +6,8 @@ MaterialDef Basic Post Shadow {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Technique {
|
Technique {
|
||||||
VertexShader GLSL100: Common/MatDefs/Shadow/BasicPostShadow.vert
|
VertexShader GLSL100 GLSL150: Common/MatDefs/Shadow/BasicPostShadow.vert
|
||||||
FragmentShader GLSL100: Common/MatDefs/Shadow/BasicPostShadow.frag
|
FragmentShader GLSL100 GLSL150: Common/MatDefs/Shadow/BasicPostShadow.frag
|
||||||
|
|
||||||
WorldParameters {
|
WorldParameters {
|
||||||
WorldViewProjectionMatrix
|
WorldViewProjectionMatrix
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
#import "Common/ShaderLib/GLSLCompat.glsllib"
|
||||||
uniform mat4 m_LightViewProjectionMatrix;
|
uniform mat4 m_LightViewProjectionMatrix;
|
||||||
uniform mat4 g_WorldViewProjectionMatrix;
|
uniform mat4 g_WorldViewProjectionMatrix;
|
||||||
uniform mat4 g_WorldMatrix;
|
uniform mat4 g_WorldMatrix;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#import "Common/ShaderLib/Shadows.glsllib"
|
|
||||||
#import "Common/ShaderLib/GLSLCompat.glsllib"
|
#import "Common/ShaderLib/GLSLCompat.glsllib"
|
||||||
|
#import "Common/ShaderLib/Shadows.glsllib"
|
||||||
|
|
||||||
#if defined(PSSM) || defined(FADE)
|
#if defined(PSSM) || defined(FADE)
|
||||||
varying float shadowPosition;
|
varying float shadowPosition;
|
||||||
|
@ -35,35 +35,8 @@ MaterialDef Post Shadow {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Technique {
|
Technique {
|
||||||
VertexShader GLSL150: Common/MatDefs/Shadow/PostShadow.vert
|
VertexShader GLSL100 GLSL150: Common/MatDefs/Shadow/PostShadow.vert
|
||||||
FragmentShader GLSL150: Common/MatDefs/Shadow/PostShadow.frag
|
FragmentShader GLSL100 GLSL150: Common/MatDefs/Shadow/PostShadow.frag
|
||||||
|
|
||||||
WorldParameters {
|
|
||||||
WorldViewProjectionMatrix
|
|
||||||
WorldMatrix
|
|
||||||
}
|
|
||||||
|
|
||||||
Defines {
|
|
||||||
HARDWARE_SHADOWS : HardwareShadows
|
|
||||||
FILTER_MODE : FilterMode
|
|
||||||
PCFEDGE : PCFEdge
|
|
||||||
SHADOWMAP_SIZE : ShadowMapSize
|
|
||||||
FADE : FadeInfo
|
|
||||||
PSSM : Splits
|
|
||||||
POINTLIGHT : LightViewProjectionMatrix5
|
|
||||||
BACKFACE_SHADOWS: BackfaceShadows
|
|
||||||
}
|
|
||||||
|
|
||||||
RenderState {
|
|
||||||
Blend Modulate
|
|
||||||
DepthWrite Off
|
|
||||||
PolyOffset -0.1 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Technique {
|
|
||||||
VertexShader GLSL100: Common/MatDefs/Shadow/PostShadow.vert
|
|
||||||
FragmentShader GLSL100: Common/MatDefs/Shadow/PostShadow.frag
|
|
||||||
|
|
||||||
WorldParameters {
|
WorldParameters {
|
||||||
WorldViewProjectionMatrix
|
WorldViewProjectionMatrix
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
|
#import "Common/ShaderLib/GLSLCompat.glsllib"
|
||||||
#import "Common/ShaderLib/Instancing.glsllib"
|
#import "Common/ShaderLib/Instancing.glsllib"
|
||||||
#import "Common/ShaderLib/Skinning.glsllib"
|
#import "Common/ShaderLib/Skinning.glsllib"
|
||||||
#import "Common/ShaderLib/GLSLCompat.glsllib"
|
|
||||||
|
|
||||||
uniform mat4 m_LightViewProjectionMatrix0;
|
uniform mat4 m_LightViewProjectionMatrix0;
|
||||||
uniform mat4 m_LightViewProjectionMatrix1;
|
uniform mat4 m_LightViewProjectionMatrix1;
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
#import "Common/ShaderLib/GLSLCompat.glsllib"
|
||||||
varying vec2 texCoord;
|
varying vec2 texCoord;
|
||||||
|
|
||||||
#ifdef DISCARD_ALPHA
|
#ifdef DISCARD_ALPHA
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
MaterialDef Pre Shadow {
|
MaterialDef Pre Shadow {
|
||||||
Technique {
|
Technique {
|
||||||
VertexShader GLSL100 : Common/MatDefs/Shadow/PreShadow.vert
|
VertexShader GLSL100 GLSL150 : Common/MatDefs/Shadow/PreShadow.vert
|
||||||
FragmentShader GLSL100 : Common/MatDefs/Shadow/PreShadow.frag
|
FragmentShader GLSL100 GLSL150 : Common/MatDefs/Shadow/PreShadow.frag
|
||||||
|
|
||||||
WorldParameters {
|
WorldParameters {
|
||||||
WorldViewProjectionMatrix
|
WorldViewProjectionMatrix
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
#import "Common/ShaderLib/GLSLCompat.glsllib"
|
||||||
#import "Common/ShaderLib/Instancing.glsllib"
|
#import "Common/ShaderLib/Instancing.glsllib"
|
||||||
#import "Common/ShaderLib/Skinning.glsllib"
|
#import "Common/ShaderLib/Skinning.glsllib"
|
||||||
attribute vec3 inPosition;
|
attribute vec3 inPosition;
|
||||||
|
@ -23,6 +23,7 @@ out vec4 outFragColor;
|
|||||||
# define texture1D texture
|
# define texture1D texture
|
||||||
# define texture2D texture
|
# define texture2D texture
|
||||||
# define texture3D texture
|
# define texture3D texture
|
||||||
|
# define textureCube texture
|
||||||
# define texture2DLod textureLod
|
# define texture2DLod textureLod
|
||||||
# define textureCubeLod textureLod
|
# define textureCubeLod textureLod
|
||||||
# if defined VERTEX_SHADER
|
# if defined VERTEX_SHADER
|
||||||
|
@ -15,12 +15,6 @@ uniform int m_NumSamplesDepth;
|
|||||||
#define DEPTHTEXTURE sampler2D
|
#define DEPTHTEXTURE sampler2D
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if __VERSION__ >= 150
|
|
||||||
#define TEXTURE texture
|
|
||||||
#else
|
|
||||||
#define TEXTURE texture2D
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// NOTE: Only define multisample functions if multisample is available
|
// NOTE: Only define multisample functions if multisample is available
|
||||||
#if defined(GL_ARB_texture_multisample)
|
#if defined(GL_ARB_texture_multisample)
|
||||||
vec4 textureFetch(in sampler2DMS tex,in vec2 texC, in int numSamples){
|
vec4 textureFetch(in sampler2DMS tex,in vec2 texC, in int numSamples){
|
||||||
@ -32,9 +26,9 @@ vec4 textureFetch(in sampler2DMS tex,in vec2 texC, in int numSamples){
|
|||||||
return color / float(numSamples);
|
return color / float(numSamples);
|
||||||
}
|
}
|
||||||
|
|
||||||
vec4 fetchTextureSample(in sampler2DMS tex,in vec2 texC,in int sample){
|
vec4 fetchTextureSample(in sampler2DMS tex,in vec2 texC,in int sampleId){
|
||||||
ivec2 iTexC = ivec2(texC * vec2(textureSize(tex)));
|
ivec2 iTexC = ivec2(texC * vec2(textureSize(tex)));
|
||||||
return texelFetch(tex, iTexC, sample);
|
return texelFetch(tex, iTexC, sampleId);
|
||||||
}
|
}
|
||||||
|
|
||||||
vec4 getColor(in sampler2DMS tex, in vec2 texC){
|
vec4 getColor(in sampler2DMS tex, in vec2 texC){
|
||||||
@ -52,19 +46,19 @@ vec4 getDepth(in sampler2DMS tex,in vec2 texC){
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
vec4 fetchTextureSample(in sampler2D tex,in vec2 texC,in int sample){
|
vec4 fetchTextureSample(in sampler2D tex,in vec2 texC,in int sampleId){
|
||||||
return TEXTURE(tex,texC);
|
return texture2D(tex,texC);
|
||||||
}
|
}
|
||||||
|
|
||||||
vec4 getColor(in sampler2D tex, in vec2 texC){
|
vec4 getColor(in sampler2D tex, in vec2 texC){
|
||||||
return TEXTURE(tex,texC);
|
return texture2D(tex,texC);
|
||||||
}
|
}
|
||||||
|
|
||||||
vec4 getColorSingle(in sampler2D tex, in vec2 texC){
|
vec4 getColorSingle(in sampler2D tex, in vec2 texC){
|
||||||
return TEXTURE(tex, texC);
|
return texture2D(tex, texC);
|
||||||
}
|
}
|
||||||
|
|
||||||
vec4 getDepth(in sampler2D tex,in vec2 texC){
|
vec4 getDepth(in sampler2D tex,in vec2 texC){
|
||||||
return TEXTURE(tex,texC);
|
return texture2D(tex,texC);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
#import "Common/ShaderLib/GLSLCompat.glsllib"
|
||||||
#extension GL_EXT_gpu_shader4 : enable
|
#extension GL_EXT_gpu_shader4 : enable
|
||||||
|
|
||||||
uniform sampler2D m_Texture;
|
uniform sampler2D m_Texture;
|
||||||
|
@ -8,8 +8,8 @@ MaterialDef FXAA {
|
|||||||
Float ReduceMul
|
Float ReduceMul
|
||||||
}
|
}
|
||||||
Technique {
|
Technique {
|
||||||
VertexShader GLSL100: Common/MatDefs/Post/FXAA.vert
|
VertexShader GLSL100 GLSL150: Common/MatDefs/Post/FXAA.vert
|
||||||
FragmentShader GLSL100: Common/MatDefs/Post/FXAA.frag
|
FragmentShader GLSL100 GLSL150: Common/MatDefs/Post/FXAA.frag
|
||||||
WorldParameters {
|
WorldParameters {
|
||||||
ResolutionInverse
|
ResolutionInverse
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
#import "Common/ShaderLib/GLSLCompat.glsllib"
|
||||||
uniform mat4 g_WorldViewProjectionMatrix;
|
uniform mat4 g_WorldViewProjectionMatrix;
|
||||||
uniform vec2 g_ResolutionInverse;
|
uniform vec2 g_ResolutionInverse;
|
||||||
|
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
#import "Common/ShaderLib/GLSLCompat.glsllib"
|
||||||
attribute vec4 inPosition;
|
attribute vec4 inPosition;
|
||||||
attribute vec2 inTexCoord;
|
attribute vec2 inTexCoord;
|
||||||
|
|
||||||
|
@ -1,17 +1,12 @@
|
|||||||
|
#import "Common/ShaderLib/GLSLCompat.glsllib"
|
||||||
#import "Common/ShaderLib/MultiSample.glsllib"
|
#import "Common/ShaderLib/MultiSample.glsllib"
|
||||||
|
|
||||||
uniform COLORTEXTURE m_Texture;
|
uniform COLORTEXTURE m_Texture;
|
||||||
uniform vec3 m_WhitePoint;
|
uniform vec3 m_WhitePoint;
|
||||||
|
|
||||||
#if __VERSION__ >= 150
|
|
||||||
in vec2 texCoord;
|
|
||||||
out vec4 outFragColor;
|
|
||||||
#else
|
|
||||||
varying vec2 texCoord;
|
varying vec2 texCoord;
|
||||||
#endif
|
|
||||||
|
|
||||||
vec3 FilmicCurve(in vec3 x)
|
vec3 FilmicCurve(in vec3 x){
|
||||||
{
|
|
||||||
const float A = 0.22;
|
const float A = 0.22;
|
||||||
const float B = 0.30;
|
const float B = 0.30;
|
||||||
const float C = 0.10;
|
const float C = 0.10;
|
||||||
@ -24,21 +19,27 @@ vec3 FilmicCurve(in vec3 x)
|
|||||||
|
|
||||||
// whitePoint should be 11.2
|
// whitePoint should be 11.2
|
||||||
|
|
||||||
vec3 ToneMap_Filmic(vec3 color, vec3 whitePoint)
|
vec3 ToneMap_Filmic(vec3 color, vec3 whitePoint){
|
||||||
{
|
|
||||||
return FilmicCurve(color) / FilmicCurve(whitePoint);
|
return FilmicCurve(color) / FilmicCurve(whitePoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
void main() {
|
vec4 tonemap(int i) {
|
||||||
// TODO: This is incorrect if multi-sampling is used.
|
|
||||||
// The tone-mapping should be performed for each sample independently.
|
|
||||||
|
|
||||||
vec4 texVal = getColor(m_Texture, texCoord);
|
vec4 texVal = fetchTextureSample(m_Texture, texCoord, i);
|
||||||
vec3 toneMapped = ToneMap_Filmic(texVal.rgb, m_WhitePoint);
|
vec3 toneMapped = ToneMap_Filmic(texVal.rgb, m_WhitePoint);
|
||||||
|
|
||||||
#if __VERSION__ >= 150
|
return vec4(toneMapped, texVal.a);
|
||||||
outFragColor = vec4(toneMapped, texVal.a);
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
#ifdef RESOLVE_MS
|
||||||
|
vec4 color = vec4(0.0);
|
||||||
|
for (int i = 0; i < m_NumSamples; i++){
|
||||||
|
color += tonemap(i);
|
||||||
|
}
|
||||||
|
gl_FragColor = color / m_NumSamples;
|
||||||
#else
|
#else
|
||||||
gl_FragColor = vec4(toneMapped, texVal.a);
|
gl_FragColor = tonemap(0);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
@ -8,8 +8,8 @@ MaterialDef Default GUI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Technique {
|
Technique {
|
||||||
VertexShader GLSL150: Common/MatDefs/Post/Post15.vert
|
VertexShader GLSL100 GLSL150: Common/MatDefs/Post/Post.vert
|
||||||
FragmentShader GLSL150: Common/MatDefs/Post/ToneMap.frag
|
FragmentShader GLSL100 GLSL150: Common/MatDefs/Post/ToneMap.frag
|
||||||
|
|
||||||
WorldParameters {
|
WorldParameters {
|
||||||
}
|
}
|
||||||
@ -20,12 +20,4 @@ MaterialDef Default GUI {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Technique {
|
|
||||||
VertexShader GLSL100: Common/MatDefs/Post/Post.vert
|
|
||||||
FragmentShader GLSL100: Common/MatDefs/Post/ToneMap.frag
|
|
||||||
|
|
||||||
WorldParameters {
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -1,3 +1,4 @@
|
|||||||
|
#import "Common/ShaderLib/GLSLCompat.glsllib"
|
||||||
varying vec3 normal;
|
varying vec3 normal;
|
||||||
varying vec2 texCoord;
|
varying vec2 texCoord;
|
||||||
|
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
|
#import "Common/ShaderLib/GLSLCompat.glsllib"
|
||||||
#import "Common/ShaderLib/Instancing.glsllib"
|
#import "Common/ShaderLib/Instancing.glsllib"
|
||||||
#import "Common/ShaderLib/Skinning.glsllib"
|
#import "Common/ShaderLib/Skinning.glsllib"
|
||||||
// These are included in the above now
|
|
||||||
//uniform mat4 g_WorldViewProjectionMatrix;
|
|
||||||
//uniform mat3 g_NormalMatrix;
|
|
||||||
|
|
||||||
attribute vec3 inPosition;
|
attribute vec3 inPosition;
|
||||||
attribute vec3 inNormal;
|
attribute vec3 inNormal;
|
||||||
|
@ -18,8 +18,8 @@ MaterialDef Simple Water {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Technique {
|
Technique {
|
||||||
VertexShader GLSL100: Common/MatDefs/Water/simple_water.vert
|
VertexShader GLSL100 GLSL150: Common/MatDefs/Water/simple_water.vert
|
||||||
FragmentShader GLSL100: Common/MatDefs/Water/simple_water.frag
|
FragmentShader GLSL100 GLSL150: Common/MatDefs/Water/simple_water.frag
|
||||||
|
|
||||||
WorldParameters {
|
WorldParameters {
|
||||||
WorldViewProjectionMatrix
|
WorldViewProjectionMatrix
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
#import "Common/ShaderLib/GLSLCompat.glsllib"
|
||||||
/*
|
/*
|
||||||
GLSL conversion of Michael Horsch water demo
|
GLSL conversion of Michael Horsch water demo
|
||||||
http://www.bonzaisoftware.com/wfs.html
|
http://www.bonzaisoftware.com/wfs.html
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
#import "Common/ShaderLib/GLSLCompat.glsllib"
|
||||||
/*
|
/*
|
||||||
GLSL conversion of Michael Horsch water demo
|
GLSL conversion of Michael Horsch water demo
|
||||||
http://www.bonzaisoftware.com/wfs.html
|
http://www.bonzaisoftware.com/wfs.html
|
||||||
|
@ -39,15 +39,14 @@ import com.jme3.light.DirectionalLight;
|
|||||||
import com.jme3.material.Material;
|
import com.jme3.material.Material;
|
||||||
import com.jme3.math.*;
|
import com.jme3.math.*;
|
||||||
import com.jme3.post.FilterPostProcessor;
|
import com.jme3.post.FilterPostProcessor;
|
||||||
import com.jme3.post.filters.ColorOverlayFilter;
|
import com.jme3.post.filters.*;
|
||||||
import com.jme3.post.filters.FadeFilter;
|
|
||||||
import com.jme3.post.filters.RadialBlurFilter;
|
|
||||||
import com.jme3.renderer.Caps;
|
import com.jme3.renderer.Caps;
|
||||||
import com.jme3.renderer.queue.RenderQueue.ShadowMode;
|
import com.jme3.renderer.queue.RenderQueue.ShadowMode;
|
||||||
import com.jme3.scene.Geometry;
|
import com.jme3.scene.Geometry;
|
||||||
import com.jme3.scene.Spatial;
|
import com.jme3.scene.Spatial;
|
||||||
import com.jme3.scene.Spatial.CullHint;
|
import com.jme3.scene.Spatial.CullHint;
|
||||||
import com.jme3.scene.shape.Box;
|
import com.jme3.scene.shape.Box;
|
||||||
|
import com.jme3.system.AppSettings;
|
||||||
import com.jme3.texture.Texture;
|
import com.jme3.texture.Texture;
|
||||||
import com.jme3.texture.Texture.WrapMode;
|
import com.jme3.texture.Texture.WrapMode;
|
||||||
import com.jme3.util.SkyFactory;
|
import com.jme3.util.SkyFactory;
|
||||||
@ -61,17 +60,21 @@ public class TestPostFilters extends SimpleApplication implements ActionListener
|
|||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
TestPostFilters app = new TestPostFilters();
|
TestPostFilters app = new TestPostFilters();
|
||||||
|
AppSettings settings = new AppSettings(true);
|
||||||
|
settings.setRenderer(AppSettings.LWJGL_OPENGL2);
|
||||||
|
app.setSettings(settings);
|
||||||
app.start();
|
app.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setupFilters() {
|
public void setupFilters() {
|
||||||
if (renderer.getCaps().contains(Caps.GLSL100)) {
|
if (renderer.getCaps().contains(Caps.GLSL100)) {
|
||||||
fpp = new FilterPostProcessor(assetManager);
|
fpp = new FilterPostProcessor(assetManager);
|
||||||
|
// fpp.setNumSamples(4);
|
||||||
// fpp.setNumSamples(4);
|
// fpp.setNumSamples(4);
|
||||||
fpp.addFilter(new ColorOverlayFilter(ColorRGBA.LightGray));
|
//fpp.addFilter(new ColorOverlayFilter(ColorRGBA.LightGray));
|
||||||
fpp.addFilter(new RadialBlurFilter());
|
fpp.addFilter(new RadialBlurFilter());
|
||||||
//fade=new FadeFilter(1.0f);
|
fade = new FadeFilter(1.0f);
|
||||||
//fpp.addFilter(fade);
|
fpp.addFilter(fade);
|
||||||
|
|
||||||
|
|
||||||
viewPort.addProcessor(fpp);
|
viewPort.addProcessor(fpp);
|
||||||
@ -102,7 +105,7 @@ public class TestPostFilters extends SimpleApplication implements ActionListener
|
|||||||
|
|
||||||
dl.setColor(new ColorRGBA(.4f, .4f, .4f, 1));
|
dl.setColor(new ColorRGBA(.4f, .4f, .4f, 1));
|
||||||
|
|
||||||
rootNode.addLight(dl);
|
// rootNode.addLight(dl);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setupFloor() {
|
public void setupFloor() {
|
||||||
@ -131,12 +134,6 @@ public class TestPostFilters extends SimpleApplication implements ActionListener
|
|||||||
public void simpleInitApp() {
|
public void simpleInitApp() {
|
||||||
cam.setLocation(new Vector3f(-32.295086f, 54.80136f, 79.59805f));
|
cam.setLocation(new Vector3f(-32.295086f, 54.80136f, 79.59805f));
|
||||||
cam.setRotation(new Quaternion(0.074364014f, 0.92519957f, -0.24794696f, 0.27748522f));
|
cam.setRotation(new Quaternion(0.074364014f, 0.92519957f, -0.24794696f, 0.27748522f));
|
||||||
cam.update();
|
|
||||||
|
|
||||||
cam.setFrustumFar(300);
|
|
||||||
flyCam.setMoveSpeed(30);
|
|
||||||
|
|
||||||
rootNode.setCullHint(CullHint.Never);
|
|
||||||
|
|
||||||
setupLighting();
|
setupLighting();
|
||||||
setupSkyBox();
|
setupSkyBox();
|
||||||
@ -153,7 +150,7 @@ public class TestPostFilters extends SimpleApplication implements ActionListener
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void initInput() {
|
protected void initInput() {
|
||||||
flyCam.setMoveSpeed(3);
|
flyCam.setMoveSpeed(50);
|
||||||
//init input
|
//init input
|
||||||
inputManager.addMapping("fadein", new KeyTrigger(KeyInput.KEY_I));
|
inputManager.addMapping("fadein", new KeyTrigger(KeyInput.KEY_I));
|
||||||
inputManager.addListener(this, "fadein");
|
inputManager.addListener(this, "fadein");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user