Skip to content

Commit

Permalink
solve issue #1780 (built-in matdefs/shaders lack core-profile support) (
Browse files Browse the repository at this point in the history
#1781)

* jme3-terrain:  add GLSLCompat.glsllib to 4 jme3-terrain frag shaders

* jme3-terrain:  add GLSLCompat.glsllib to 4 jme3-terrain vertex shaders

* jme3-terrain:  add GLSL150 to 3 jme3-terrain material definitions

* jme3-vr:  add GLSLCompat.glsllib to 5 shaders

* jme3-niftygui:  add GLSLCompat.glsllib to 6 shaders

* jme3-niftygui:  add GLSL150 to 3 material definitions
  • Loading branch information
stephengold committed Mar 18, 2022
1 parent b052622 commit 28bf1c9
Show file tree
Hide file tree
Showing 25 changed files with 39 additions and 20 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#import "Common/ShaderLib/GLSLCompat.glsllib"
uniform vec4 m_Color;

void main() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ MaterialDef Default GUI {
}

Technique {
VertexShader GLSL100: Common/MatDefs/Nifty/NiftyQuad.vert
FragmentShader GLSL100: Common/MatDefs/Nifty/NiftyQuad.frag
VertexShader GLSL100 GLSL150: Common/MatDefs/Nifty/NiftyQuad.vert
FragmentShader GLSL100 GLSL150: Common/MatDefs/Nifty/NiftyQuad.frag

WorldParameters {
WorldViewProjectionMatrix
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#import "Common/ShaderLib/GLSLCompat.glsllib"
uniform mat4 g_WorldViewProjectionMatrix;

attribute vec4 inPosition;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#import "Common/ShaderLib/GLSLCompat.glsllib"
varying vec4 color;

void main() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ MaterialDef Default GUI {
}

Technique {
VertexShader GLSL100: Common/MatDefs/Nifty/NiftyQuadGrad.vert
FragmentShader GLSL100: Common/MatDefs/Nifty/NiftyQuadGrad.frag
VertexShader GLSL100 GLSL150: Common/MatDefs/Nifty/NiftyQuadGrad.vert
FragmentShader GLSL100 GLSL150: Common/MatDefs/Nifty/NiftyQuadGrad.frag

WorldParameters {
WorldViewProjectionMatrix
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#import "Common/ShaderLib/GLSLCompat.glsllib"
uniform mat4 g_WorldViewProjectionMatrix;

attribute vec4 inPosition;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#import "Common/ShaderLib/GLSLCompat.glsllib"
uniform sampler2D m_Texture;
uniform vec4 m_Color;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ MaterialDef Default GUI {
}

Technique {
VertexShader GLSL100: Common/MatDefs/Nifty/NiftyTex.vert
FragmentShader GLSL100: Common/MatDefs/Nifty/NiftyTex.frag
VertexShader GLSL100 GLSL150: Common/MatDefs/Nifty/NiftyTex.vert
FragmentShader GLSL100 GLSL150: Common/MatDefs/Nifty/NiftyTex.frag

WorldParameters {
WorldViewProjectionMatrix
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#import "Common/ShaderLib/GLSLCompat.glsllib"
uniform mat4 g_WorldViewProjectionMatrix;

attribute vec4 inPosition;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#import "Common/ShaderLib/GLSLCompat.glsllib"
uniform vec3 m_region1;
uniform vec3 m_region2;
uniform vec3 m_region3;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ MaterialDef Terrain {
}

Technique {
VertexShader GLSL100: Common/MatDefs/Terrain/HeightBasedTerrain.vert
FragmentShader GLSL100: Common/MatDefs/Terrain/HeightBasedTerrain.frag
VertexShader GLSL100 GLSL150: Common/MatDefs/Terrain/HeightBasedTerrain.vert
FragmentShader GLSL100 GLSL150: Common/MatDefs/Terrain/HeightBasedTerrain.frag

WorldParameters {
WorldViewProjectionMatrix
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#import "Common/ShaderLib/GLSLCompat.glsllib"
uniform float m_tilingFactor;
uniform mat4 g_WorldViewProjectionMatrix;
uniform mat4 g_WorldMatrix;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#import "Common/ShaderLib/GLSLCompat.glsllib"
#import "Common/ShaderLib/BlinnPhongLighting.glsllib"
#import "Common/ShaderLib/Lighting.glsllib"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#import "Common/ShaderLib/GLSLCompat.glsllib"
uniform mat4 g_WorldViewProjectionMatrix;
uniform mat4 g_WorldViewMatrix;
uniform mat3 g_NormalMatrix;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#import "Common/ShaderLib/GLSLCompat.glsllib"
uniform sampler2D m_Alpha;
uniform sampler2D m_Tex1;
uniform sampler2D m_Tex2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ MaterialDef Terrain {
}

Technique {
VertexShader GLSL100: Common/MatDefs/Terrain/Terrain.vert
FragmentShader GLSL100: Common/MatDefs/Terrain/Terrain.frag
VertexShader GLSL100 GLSL150: Common/MatDefs/Terrain/Terrain.vert
FragmentShader GLSL100 GLSL150: Common/MatDefs/Terrain/Terrain.frag

WorldParameters {
WorldViewProjectionMatrix
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#import "Common/ShaderLib/GLSLCompat.glsllib"
uniform mat4 g_WorldViewProjectionMatrix;

attribute vec3 inPosition;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#import "Common/ShaderLib/GLSLCompat.glsllib"
#import "Common/ShaderLib/BlinnPhongLighting.glsllib"
#import "Common/ShaderLib/Lighting.glsllib"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ MaterialDef Terrain Lighting {

LightMode MultiPass

VertexShader GLSL100: Common/MatDefs/Terrain/TerrainLighting.vert
FragmentShader GLSL100: Common/MatDefs/Terrain/TerrainLighting.frag
VertexShader GLSL100 GLSL150: Common/MatDefs/Terrain/TerrainLighting.vert
FragmentShader GLSL100 GLSL150: Common/MatDefs/Terrain/TerrainLighting.frag

WorldParameters {
WorldViewProjectionMatrix
Expand Down Expand Up @@ -173,8 +173,8 @@ MaterialDef Terrain Lighting {

LightMode SinglePass

VertexShader GLSL100: Common/MatDefs/Terrain/SPTerrainLighting.vert
FragmentShader GLSL100: Common/MatDefs/Terrain/SPTerrainLighting.frag
VertexShader GLSL100 GLSL150: Common/MatDefs/Terrain/SPTerrainLighting.vert
FragmentShader GLSL100 GLSL150: Common/MatDefs/Terrain/SPTerrainLighting.frag

WorldParameters {
WorldViewProjectionMatrix
Expand Down Expand Up @@ -236,8 +236,8 @@ MaterialDef Terrain Lighting {

Technique PreShadow {

VertexShader GLSL100 : Common/MatDefs/Shadow/PreShadow.vert
FragmentShader GLSL100 : Common/MatDefs/Shadow/PreShadow.frag
VertexShader GLSL100 GLSL150: Common/MatDefs/Shadow/PreShadow.vert
FragmentShader GLSL100 GLSL150: Common/MatDefs/Shadow/PreShadow.frag

WorldParameters {
WorldViewProjectionMatrix
Expand All @@ -260,8 +260,8 @@ MaterialDef Terrain Lighting {

Technique PreNormalPass {

VertexShader GLSL100 : Common/MatDefs/SSAO/normal.vert
FragmentShader GLSL100 : Common/MatDefs/SSAO/normal.frag
VertexShader GLSL100 GLSL150: Common/MatDefs/SSAO/normal.vert
FragmentShader GLSL100 GLSL150: Common/MatDefs/SSAO/normal.frag

WorldParameters {
WorldViewProjectionMatrix
Expand All @@ -283,8 +283,8 @@ MaterialDef Terrain Lighting {

Technique Glow {

VertexShader GLSL100: Common/MatDefs/Misc/Unshaded.vert
FragmentShader GLSL100: Common/MatDefs/Light/Glow.frag
VertexShader GLSL100 GLSL150: Common/MatDefs/Misc/Unshaded.vert
FragmentShader GLSL100 GLSL150: Common/MatDefs/Light/Glow.frag

WorldParameters {
WorldViewProjectionMatrix
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#import "Common/ShaderLib/GLSLCompat.glsllib"
#import "Common/ShaderLib/Lighting.glsllib"

uniform mat4 g_WorldViewProjectionMatrix;
Expand Down
1 change: 1 addition & 0 deletions jme3-vr/src/main/resources/Common/MatDefs/VR/OpenVR.frag
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#import "Common/ShaderLib/GLSLCompat.glsllib"
uniform sampler2D m_Texture;

varying vec2 UVred;
Expand Down
1 change: 1 addition & 0 deletions jme3-vr/src/main/resources/Common/MatDefs/VR/OpenVR.vert
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#import "Common/ShaderLib/GLSLCompat.glsllib"
attribute vec4 inPosition;

attribute vec2 inTexCoord; // m_inUVred
Expand Down
1 change: 1 addition & 0 deletions jme3-vr/src/main/resources/Common/MatDefs/VR/OpenVR15.frag
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#import "Common/ShaderLib/GLSLCompat.glsllib"
uniform sampler2D m_Texture;

in vec2 UVred;
Expand Down
1 change: 1 addition & 0 deletions jme3-vr/src/main/resources/Common/MatDefs/VR/OpenVR15.vert
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#import "Common/ShaderLib/GLSLCompat.glsllib"
in vec4 inPosition;

in vec2 inTexCoord; // m_inUVred
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#import "Common/ShaderLib/GLSLCompat.glsllib"
#import "Common/ShaderLib/MultiSample.glsllib"
#import "Common/ShaderLib/Shadows.glsllib"

Expand Down

0 comments on commit 28bf1c9

Please sign in to comment.