diff options
79 files changed, 485 insertions, 889 deletions
diff --git a/examples/animated-shapes/shaders/animated-shapes.frag b/examples/animated-shapes/shaders/animated-shapes.frag index a5c57171..61276842 100644 --- a/examples/animated-shapes/shaders/animated-shapes.frag +++ b/examples/animated-shapes/shaders/animated-shapes.frag @@ -1,11 +1,5 @@ -//@version 100 - -UNIFORM_BLOCK VanillaFrag -{ -UNIFORM lowp vec4 uColor; -}; - -INPUT lowp vec2 vCoefficient; +uniform lowp vec4 uColor; +varying lowp vec2 vCoefficient; void main() { diff --git a/examples/animated-shapes/shaders/animated-shapes.vert b/examples/animated-shapes/shaders/animated-shapes.vert index 5ba6c5c3..06e6523b 100644 --- a/examples/animated-shapes/shaders/animated-shapes.vert +++ b/examples/animated-shapes/shaders/animated-shapes.vert @@ -1,14 +1,7 @@ -//@version 100 - -INPUT mediump vec3 aCoefficient; - -UNIFORM_BLOCK Vanilla -{ -UNIFORM mediump mat4 uMvpMatrix; -UNIFORM mediump vec3 uPosition[MAX_POINT_COUNT]; -}; - -OUTPUT lowp vec2 vCoefficient; +attribute mediump vec3 aCoefficient; +uniform mediump mat4 uMvpMatrix; +uniform mediump vec3 uPosition[MAX_POINT_COUNT]; +varying lowp vec2 vCoefficient; void main() { diff --git a/examples/bezier-curve/shaders/bezier-curve.frag b/examples/bezier-curve/shaders/bezier-curve.frag index 8633599c..ef6b09ed 100644 --- a/examples/bezier-curve/shaders/bezier-curve.frag +++ b/examples/bezier-curve/shaders/bezier-curve.frag @@ -1,5 +1,4 @@ -//@version 100 - +uniform lowp vec4 uColor; void main() { diff --git a/examples/bezier-curve/shaders/bezier-curve.vert b/examples/bezier-curve/shaders/bezier-curve.vert index 1f807a54..a108a415 100644 --- a/examples/bezier-curve/shaders/bezier-curve.vert +++ b/examples/bezier-curve/shaders/bezier-curve.vert @@ -1,12 +1,6 @@ -//@version 100 - -INPUT mediump vec2 aPosition; - -UNIFORM_BLOCK Vanilla -{ -UNIFORM mediump mat4 uMvpMatrix; -UNIFORM vec3 uSize; -}; +attribute mediump vec2 aPosition; +uniform mediump mat4 uMvpMatrix; +uniform vec3 uSize; void main() { diff --git a/examples/bullet-physics/shaders/rendering-textured-shape.frag b/examples/bullet-physics/shaders/rendering-textured-shape.frag index af4064f3..1f7bac25 100644 --- a/examples/bullet-physics/shaders/rendering-textured-shape.frag +++ b/examples/bullet-physics/shaders/rendering-textured-shape.frag @@ -1,14 +1,7 @@ -//@version 100 - -UNIFORM sampler2D uTexture; - -UNIFORM_BLOCK VanFrag -{ -UNIFORM mediump float uBrightness; -}; - -INPUT mediump vec2 vTexCoord; -INPUT mediump vec3 vIllumination; +uniform sampler2D uTexture; +uniform mediump float uBrightness; +varying mediump vec2 vTexCoord; +varying mediump vec3 vIllumination; mediump vec3 redistribute_rgb(mediump vec3 color) { @@ -30,7 +23,7 @@ mediump vec3 redistribute_rgb(mediump vec3 color) void main() { - mediump vec4 texColor = TEXTURE( uTexture, vTexCoord ); + mediump vec4 texColor = texture2D( uTexture, vTexCoord ); //mediump vec4 texColor = vec4(0.5,0.5,0.5,1.0); //gl_FragColor = vec4(texColor.rgb, 1.0); diff --git a/examples/bullet-physics/shaders/rendering-textured-shape.vert b/examples/bullet-physics/shaders/rendering-textured-shape.vert index abad5039..02b1edbd 100644 --- a/examples/bullet-physics/shaders/rendering-textured-shape.vert +++ b/examples/bullet-physics/shaders/rendering-textured-shape.vert @@ -1,17 +1,11 @@ -//@version 100 - -UNIFORM_BLOCK Vanilla -{ -UNIFORM mediump mat4 uMvpMatrix; // DALi shader builtin -UNIFORM mediump mat4 uViewMatrix; // DALi shader builtin -UNIFORM mediump mat4 uModelView; // DALi shader builtin -UNIFORM mediump vec3 uSize; // DALi shader builtin -}; - -INPUT mediump vec3 aPosition; // DALi shader builtin -INPUT mediump vec2 aTexCoord; // DALi shader builtin -OUTPUT mediump vec3 vIllumination; -OUTPUT mediump vec2 vTexCoord; +attribute mediump vec3 aPosition; // DALi shader builtin +attribute mediump vec2 aTexCoord; // DALi shader builtin +uniform mediump mat4 uMvpMatrix; // DALi shader builtin +uniform mediump mat4 uViewMatrix; // DALi shader builtin +uniform mediump mat4 uModelView; // DALi shader builtin +uniform mediump vec3 uSize; // DALi shader builtin +varying mediump vec3 vIllumination; +varying mediump vec2 vTexCoord; void main() { diff --git a/examples/contact-cards/shaders/clipped-image.frag b/examples/contact-cards/shaders/clipped-image.frag index f9d80188..bde9850c 100644 --- a/examples/contact-cards/shaders/clipped-image.frag +++ b/examples/contact-cards/shaders/clipped-image.frag @@ -1,5 +1,3 @@ -//@version 100 - // This fragment-shader does not output anything. // It's for a control which is just going to clip as specified in the vertex shader. diff --git a/examples/contact-cards/shaders/clipped-image.vert b/examples/contact-cards/shaders/clipped-image.vert index f8c8a96e..cfe84bdd 100644 --- a/examples/contact-cards/shaders/clipped-image.vert +++ b/examples/contact-cards/shaders/clipped-image.vert @@ -1,19 +1,13 @@ -//@version 100 - // This vertex-shader mixes in the quad and circle geometry depending on the value of uDelta. // // uDelta is used to mix in the Circle and the Quad positions. // If uDelta is 0.0f, then the circle position is adopted and if it is 1.0f, then the quad position is adopted. -INPUT mediump vec2 aPositionCircle; -INPUT mediump vec2 aPositionQuad; - -UNIFORM_BLOCK Vanilla -{ -UNIFORM mediump float uDelta; -UNIFORM mediump mat4 uMvpMatrix; -UNIFORM mediump vec3 uSize; -}; +attribute mediump vec2 aPositionCircle; +attribute mediump vec2 aPositionQuad; +uniform mediump float uDelta; +uniform mediump mat4 uMvpMatrix; +uniform mediump vec3 uSize; void main() { diff --git a/examples/line-mesh/shaders/line-mesh.frag b/examples/line-mesh/shaders/line-mesh.frag index 4f11e44e..c9eeb01e 100644 --- a/examples/line-mesh/shaders/line-mesh.frag +++ b/examples/line-mesh/shaders/line-mesh.frag @@ -1,13 +1,7 @@ -//@version 100 +uniform lowp vec4 uColor; +uniform sampler2D sTexture; -UNIFORM sampler2D sTexture; - -UNIFORM_BLOCK VanillaFrag -{ -UNIFORM lowp vec4 uColor; -}; - -INPUT lowp vec3 vColor; +varying lowp vec3 vColor; void main() { diff --git a/examples/line-mesh/shaders/line-mesh.vert b/examples/line-mesh/shaders/line-mesh.vert index 98949b86..e9ff779e 100644 --- a/examples/line-mesh/shaders/line-mesh.vert +++ b/examples/line-mesh/shaders/line-mesh.vert @@ -1,17 +1,11 @@ -//@version 100 +attribute mediump vec2 aPosition1; +attribute mediump vec2 aPosition2; +attribute lowp vec3 aColor; +uniform mediump mat4 uMvpMatrix; +uniform mediump vec3 uSize; +uniform mediump float uMorphAmount; -INPUT mediump vec2 aPosition1; -INPUT mediump vec2 aPosition2; -INPUT lowp vec3 aColor; - -UNIFORM_BLOCK Vanilla -{ -UNIFORM mediump mat4 uMvpMatrix; -UNIFORM mediump vec3 uSize; -UNIFORM mediump float uMorphAmount; -}; - -OUTPUT lowp vec3 vColor; +varying lowp vec3 vColor; void main() { diff --git a/examples/mesh-morph/shaders/mesh-morph.frag b/examples/mesh-morph/shaders/mesh-morph.frag index bdd5ca04..93f7a013 100644 --- a/examples/mesh-morph/shaders/mesh-morph.frag +++ b/examples/mesh-morph/shaders/mesh-morph.frag @@ -1,6 +1,4 @@ -//@version 100 - -INPUT lowp vec4 vColor; +varying lowp vec4 vColor; void main() { diff --git a/examples/mesh-morph/shaders/mesh-morph.vert b/examples/mesh-morph/shaders/mesh-morph.vert index 222a5fd2..766c88c2 100644 --- a/examples/mesh-morph/shaders/mesh-morph.vert +++ b/examples/mesh-morph/shaders/mesh-morph.vert @@ -1,18 +1,11 @@ -//@version 100 - -INPUT mediump vec2 aInitPos; -INPUT mediump vec2 aFinalPos; -INPUT mediump vec3 aColor; - -OUTPUT lowp vec4 vColor; - -UNIFORM_BLOCK Vanilla -{ -UNIFORM mediump mat4 uMvpMatrix; -UNIFORM mediump vec3 uSize; -UNIFORM mediump float uDelta; -UNIFORM lowp vec4 uColor; -}; +attribute mediump vec2 aInitPos; +attribute mediump vec2 aFinalPos; +attribute mediump vec3 aColor; +uniform mediump mat4 uMvpMatrix; +uniform mediump vec3 uSize; +uniform mediump float uDelta; +uniform lowp vec4 uColor; +varying lowp vec4 vColor; void main() { diff --git a/examples/metaball-explosion/shaders/metaball-refraction.frag b/examples/metaball-explosion/shaders/metaball-refraction.frag index 7c3e1566..ad67df6d 100644 --- a/examples/metaball-explosion/shaders/metaball-refraction.frag +++ b/examples/metaball-explosion/shaders/metaball-refraction.frag @@ -1,18 +1,10 @@ -//@version 100 - //Fragment shader code for metaball and background composition with refraction effect precision highp float; -INPUT vec2 vTexCoord; - -UNIFORM sampler2D sTexture; -UNIFORM sampler2D sEffect; - -UNIFORM_BLOCK VanillaFrag -{ -UNIFORM vec2 uPositionMetaball; -}; - +varying vec2 vTexCoord; +uniform sampler2D sTexture; +uniform sampler2D sEffect; +uniform vec2 uPositionMetaball; void main() { vec2 zoomCoords; @@ -21,7 +13,7 @@ void main() vec3 color = vec3(1.0, 1.0, 1.0); float ambient = 0.2; - vec4 metaColor = TEXTURE(sEffect, vTexCoord); + vec4 metaColor = texture2D(sEffect, vTexCoord); vec2 adjustedCoords = vTexCoord.xy * vec2(2.0) - vec2(1.0); fakePos = adjustedCoords.xy - vec2(uPositionMetaball.x, -uPositionMetaball.y); @@ -73,7 +65,7 @@ void main() float specularFactor = max(0.0,dot(vertexToEye, lightReflect)); specularFactor = pow(specularFactor, 32.0) * 0.7; - vec4 texColor = TEXTURE(sTexture, zoomCoords); + vec4 texColor = texture2D(sTexture, zoomCoords); gl_FragColor.rgb = texColor.rgb * ambient + color.rgb * texColor.rgb * lightDiffuse + vec3(specularFactor); gl_FragColor.a = 1.0; } diff --git a/examples/metaball-explosion/shaders/metaball.frag b/examples/metaball-explosion/shaders/metaball.frag index 095eceb6..8411a181 100644 --- a/examples/metaball-explosion/shaders/metaball.frag +++ b/examples/metaball-explosion/shaders/metaball.frag @@ -1,19 +1,12 @@ -//@version 100 - // Fragment shader code for metaball precision mediump float; - -INPUT vec2 vTexCoord; - -UNIFORM_BLOCK VanillaFrag -{ -UNIFORM vec2 uPositionMetaball; -UNIFORM vec2 uPositionVar; -UNIFORM vec2 uGravityVector; -UNIFORM float uRadius; -UNIFORM float uRadiusVar; -}; +varying vec2 vTexCoord; +uniform vec2 uPositionMetaball; +uniform vec2 uPositionVar; +uniform vec2 uGravityVector; +uniform float uRadius; +uniform float uRadiusVar; void main() { diff --git a/examples/metaball-explosion/shaders/metaball.vert b/examples/metaball-explosion/shaders/metaball.vert index 6f6dd4b1..911e77ac 100644 --- a/examples/metaball-explosion/shaders/metaball.vert +++ b/examples/metaball-explosion/shaders/metaball.vert @@ -1,18 +1,11 @@ -//@version 100 - //Vertex shader code for metaball -INPUT mediump vec2 aPosition; -INPUT mediump vec2 aTexture; - -OUTPUT mediump vec2 vTexCoord; - -UNIFORM_BLOCK Vanilla -{ -UNIFORM mediump mat4 uMvpMatrix; -UNIFORM mediump vec3 uSize; -UNIFORM lowp vec4 uColor; -}; +attribute mediump vec2 aPosition; +attribute mediump vec2 aTexture; +uniform mediump mat4 uMvpMatrix; +uniform mediump vec3 uSize; +uniform lowp vec4 uColor; +varying mediump vec2 vTexCoord; void main() { diff --git a/examples/metaball-refrac/shaders/fragment.frag b/examples/metaball-refrac/shaders/fragment.frag index df97aeea..1878397b 100644 --- a/examples/metaball-refrac/shaders/fragment.frag +++ b/examples/metaball-refrac/shaders/fragment.frag @@ -1,13 +1,10 @@ -//@version 100 - // Fragment shader code when there's no effect precision mediump float; - -INPUT vec2 vTexCoord; -UNIFORM sampler2D sTexture; +varying vec2 vTexCoord; +uniform sampler2D sTexture; void main() { - gl_FragColor = TEXTURE(sTexture, vTexCoord); + gl_FragColor = texture2D(sTexture, vTexCoord); } diff --git a/examples/metaball-refrac/shaders/metaball-refraction.frag b/examples/metaball-refrac/shaders/metaball-refraction.frag index 718ffa2f..e84f3ea5 100644 --- a/examples/metaball-refrac/shaders/metaball-refraction.frag +++ b/examples/metaball-refrac/shaders/metaball-refraction.frag @@ -1,15 +1,13 @@ -//@version 100 // Fragment shader code for metaball and background composition with refraction effect precision mediump float; -INPUT vec2 vTexCoord; - -UNIFORM sampler2D sTexture; -UNIFORM sampler2D sEffect; +varying vec2 vTexCoord; +uniform sampler2D sTexture; +uniform sampler2D sEffect; void main() { - vec4 metaColor = TEXTURE(sEffect, vTexCoord); + vec4 metaColor = texture2D(sEffect, vTexCoord); vec2 zoomCoords; float bright = 1.0; if (metaColor.r > 0.85) @@ -27,5 +25,5 @@ void main() zoomCoords = vTexCoord; } - gl_FragColor = TEXTURE(sTexture, zoomCoords) * bright; + gl_FragColor = texture2D(sTexture, zoomCoords) * bright; } diff --git a/examples/metaball-refrac/shaders/metaball.frag b/examples/metaball-refrac/shaders/metaball.frag index 2fdc2697..ed877673 100644 --- a/examples/metaball-refrac/shaders/metaball.frag +++ b/examples/metaball-refrac/shaders/metaball.frag @@ -1,19 +1,13 @@ -//@version 100 - // Fragment shader for metaballs precision mediump float; -INPUT vec2 vTexCoord; - -UNIFORM_BLOCK VanillaFrag -{ -UNIFORM vec2 uPositionMetaball; -UNIFORM vec2 uPositionVar; -UNIFORM vec2 uGravityVector; -UNIFORM float uRadius; -UNIFORM float uRadiusVar; -UNIFORM float uAspect; -}; +varying vec2 vTexCoord; +uniform vec2 uPositionMetaball; +uniform vec2 uPositionVar; +uniform vec2 uGravityVector; +uniform float uRadius; +uniform float uRadiusVar; +uniform float uAspect; void main() { diff --git a/examples/metaball-refrac/shaders/metaball.vert b/examples/metaball-refrac/shaders/metaball.vert index fd002d96..370d8702 100644 --- a/examples/metaball-refrac/shaders/metaball.vert +++ b/examples/metaball-refrac/shaders/metaball.vert @@ -1,16 +1,11 @@ -//@version 100 // Vertex shader for metaballs -INPUT mediump vec2 aPosition; -INPUT mediump vec2 aTexture; -OUTPUT mediump vec2 vTexCoord; - -UNIFORM_BLOCK Vanilla -{ -UNIFORM mediump mat4 uMvpMatrix; -UNIFORM mediump vec3 uSize; -UNIFORM lowp vec4 uColor; -}; +attribute mediump vec2 aPosition; +attribute mediump vec2 aTexture; +uniform mediump mat4 uMvpMatrix; +uniform mediump vec3 uSize; +uniform lowp vec4 uColor; +varying mediump vec2 vTexCoord; void main() { diff --git a/examples/particles/shaders/particle-view-simple.frag b/examples/particles/shaders/particle-view-simple.frag index 457c31b6..942a401c 100644 --- a/examples/particles/shaders/particle-view-simple.frag +++ b/examples/particles/shaders/particle-view-simple.frag @@ -1,15 +1,11 @@ -//@version 100 - +#version 300 es // Shader for an unlit, unfogged, textured mesh. precision mediump float; - -UNIFORM_BLOCK VanillaFrag -{ -UNIFORM vec4 uColor; -}; +uniform vec4 uColor; +out vec4 oFragColor; void main() { - gl_FragColor = uColor; + oFragColor = uColor; } diff --git a/examples/particles/shaders/particle-view-simple.vert b/examples/particles/shaders/particle-view-simple.vert index dc472ba1..59238621 100644 --- a/examples/particles/shaders/particle-view-simple.vert +++ b/examples/particles/shaders/particle-view-simple.vert @@ -1,18 +1,12 @@ -//@version 100 - +#version 300 es // Shader for simple textured geometry. precision mediump float; - -UNIFORM_BLOCK VertexBlock -{ - UNIFORM mat4 uMvpMatrix; //by DALi - UNIFORM vec3 uSize; // by DALi -}; - -INPUT vec3 aPosition; +uniform mat4 uMvpMatrix;//by DALi +uniform vec3 uSize; // by DALi +in vec3 aPosition; void main() { - gl_Position = uMvpMatrix * vec4(aPosition * uSize, 1.0); + gl_Position = uMvpMatrix * vec4(aPosition * uSize, 1.f); } diff --git a/examples/particles/shaders/particle-view.frag b/examples/particles/shaders/particle-view.frag index c1c97ccc..293487c3 100644 --- a/examples/particles/shaders/particle-view.frag +++ b/examples/particles/shaders/particle-view.frag @@ -1,21 +1,16 @@ -//@version 100 - +#version 300 es // Fragment shader for particles, which simulates depth of field using // a combination of procedural texturing, alpha testing and alpha blending. precision lowp float; - -UNIFORM_BLOCK VanillaFrag -{ -UNIFORM float uAlphaTestRefValue; -UNIFORM vec2 uFadeRange; // near, far -}; - -INPUT vec2 vUvUnit; -INPUT flat float vDepth; -INPUT flat float vFocalDistance; -INPUT flat float vOpacity; -INPUT flat vec3 vColor; +uniform float uAlphaTestRefValue; +uniform vec2 uFadeRange; // near, far +in vec2 vUvUnit; +flat in float vDepth; +flat in float vFocalDistance; +flat in float vOpacity; +flat in vec3 vColor; +out vec4 oFragColor; const float REF_VALUE_THRESHOLD = 1. / 64.; @@ -40,5 +35,5 @@ void main() // Fade particles out as they get close to the near and far clipping planes alpha *= smoothstep(.0f, uFadeRange.x, vDepth) * smoothstep(1.f, uFadeRange.y, vDepth); - gl_FragColor = vec4(vColor, alpha); + oFragColor = vec4(vColor, alpha); } diff --git a/examples/particles/shaders/particle-view.vert b/examples/particles/shaders/particle-view.vert index d1b301d3..33cc108a 100644 --- a/examples/particles/shaders/particle-view.vert +++ b/examples/particles/shaders/particle-view.vert @@ -1,29 +1,22 @@ -//@version 100 - +#version 300 es // Shader for billboarded particles, where the vertices of the particles // are supplied as vec3 position (particle position) + vec2 sub-position. precision lowp float; -UNIFORM_BLOCK Vanilla -{ -UNIFORM mat4 uModelView; // DALi -UNIFORM mat4 uProjection; // DALi -UNIFORM vec3 uSize; // DALi -UNIFORM vec4 uColor; // DALi -}; - -UNIFORM_BLOCK Billboard -{ -UNIFORM vec3 uSecondaryColor; -UNIFORM vec2 uDepthRange; // x is zNear, y is 1.f / (zFar - zNear) -UNIFORM float uTwinkleFrequency; -UNIFORM float uTwinkleSizeScale; -UNIFORM float uTwinkleOpacityWeight; -UNIFORM float uTime; -UNIFORM float uFocalLength; -UNIFORM float uAperture; -UNIFORM float uPopulation; -}; +uniform mat4 uModelView; // DALi +uniform mat4 uProjection; // DALi +uniform vec3 uSize; // DALi +uniform vec4 uColor; // DALi + +uniform vec3 uSecondaryColor; +uniform vec2 uDepthRange; // x is zNear, y is 1.f / (zFar - zNear) +uniform float uTwinkleFrequency; +uniform float uTwinkleSizeScale; +uniform float uTwinkleOpacityWeight; +uniform float uTime; +uniform float uFocalLength; +uniform float uAperture; +uniform float uPopulation; struct Scatter { @@ -33,29 +26,22 @@ struct Scatter }; const int SCATTER_VARS = 6; // Must match ParticleView::mScatterProps' size. - -UNIFORM_BLOCK ScatterBlock -{ -UNIFORM Scatter uScatter[SCATTER_VARS]; -}; +uniform Scatter uScatter[SCATTER_VARS]; const int POPULATION_GRANULARITY = 128; -UNIFORM_BLOCK OrderLookup -{ -UNIFORM float uOrderLookUp[POPULATION_GRANULARITY]; -}; - -INPUT vec3 aPosition; -INPUT float aSeed; -INPUT vec4 aPath; -INPUT vec2 aSubPosition; -INPUT float aSize; - -OUTPUT flat float vDepth; -OUTPUT flat float vFocalDistance; -OUTPUT vec2 vUvUnit; -OUTPUT flat float vOpacity; -OUTPUT flat vec3 vColor; // ignore alpha +uniform float uOrderLookUp[POPULATION_GRANULARITY]; + +in vec3 aPosition; +in float aSeed; +in vec4 aPath; +in vec2 aSubPosition; +in float aSize; + +flat out float vDepth; +flat out float vFocalDistance; +out vec2 vUvUnit; +flat out float vOpacity; +flat out vec3 vColor; // ignore alpha float bezier(vec3 control, float alpha) { diff --git a/examples/perf-scroll/shaders/perf-scroll.frag b/examples/perf-scroll/shaders/perf-scroll.frag index a3f24dd3..f9eba48f 100644 --- a/examples/perf-scroll/shaders/perf-scroll.frag +++ b/examples/perf-scroll/shaders/perf-scroll.frag @@ -1,14 +1,8 @@ -//@version 100 - -UNIFORM_BLOCK VanillaFrag -{ -UNIFORM lowp vec4 uColor; -} -UNIFORM sampler2D sTexture; - -INPUT mediump vec2 vTexCoord; +uniform lowp vec4 uColor; +uniform sampler2D sTexture; +varying mediump vec2 vTexCoord; void main() { - gl_FragColor = TEXTURE( sTexture, vTexCoord ) * uColor; + gl_FragColor = texture2D( sTexture, vTexCoord ) * uColor; } diff --git a/examples/perf-scroll/shaders/perf-scroll.vert b/examples/perf-scroll/shaders/perf-scroll.vert index 643d96c8..3cb2121b 100644 --- a/examples/perf-scroll/shaders/perf-scroll.vert +++ b/examples/perf-scroll/shaders/perf-scroll.vert @@ -1,14 +1,8 @@ -//@version 100 - -INPUT mediump vec2 aPosition; -INPUT mediump vec2 aTexCoord; -OUTPUT mediump vec2 vTexCoord; - -UNIFORM_BLOCK Vanilla -{ -UNIFORM mediump mat4 uMvpMatrix; -UNIFORM mediump vec3 uSize; -}; +attribute mediump vec2 aPosition; +attribute mediump vec2 aTexCoord; +uniform mediump mat4 uMvpMatrix; +uniform mediump vec3 uSize; +varying mediump vec2 vTexCoord; void main() { diff --git a/examples/point-mesh/shaders/point-mesh.frag b/examples/point-mesh/shaders/point-mesh.frag index 08eb6021..51be2396 100644 --- a/examples/point-mesh/shaders/point-mesh.frag +++ b/examples/point-mesh/shaders/point-mesh.frag @@ -1,20 +1,13 @@ -//@version 100 - -INPUT mediump vec3 vVertexColor; -INPUT mediump float vHue; - -UNIFORM sampler2D sTexture1; -UNIFORM sampler2D sTexture2; - -UNIFORM_BLOCK FragUniforms -{ -UNIFORM lowp vec4 uColor; -UNIFORM lowp vec4 uFadeColor; -}; +varying mediump vec3 vVertexColor; +varying mediump float vHue; +uniform lowp vec4 uColor; +uniform sampler2D sTexture1; +uniform sampler2D sTexture2; +uniform lowp vec4 uFadeColor; void main() { - mediump vec4 texCol1 = TEXTURE(sTexture1, gl_PointCoord); - mediump vec4 texCol2 = TEXTURE(sTexture2, gl_PointCoord); + mediump vec4 texCol1 = texture2D(sTexture1, gl_PointCoord); + mediump vec4 texCol2 = texture2D(sTexture2, gl_PointCoord); gl_FragColor = vec4(vVertexColor, 1.0) * ((texCol1 * vHue) + (texCol2 * (1.0 - vHue))); } diff --git a/examples/point-mesh/shaders/point-mesh.vert b/examples/point-mesh/shaders/point-mesh.vert index 4c129ee8..6afbdb4a 100644 --- a/examples/point-mesh/shaders/point-mesh.vert +++ b/examples/point-mesh/shaders/point-mesh.vert @@ -1,21 +1,12 @@ -//@version 100 - -INPUT mediump vec2 aPosition; -INPUT highp float aHue; -OUTPUT mediump vec2 vTexCoord; -OUTPUT mediump vec3 vVertexColor; -OUTPUT mediump float vHue; - -UNIFORM_BLOCK Vanilla -{ -UNIFORM mediump mat4 uMvpMatrix; -UNIFORM mediump vec3 uSize; -}; - -UNIFORM_BLOCK Custom -{ -UNIFORM mediump float uPointSize; -}; +attribute mediump vec2 aPosition; +attribute highp float aHue; +varying mediump vec2 vTexCoord; +uniform mediump mat4 uMvpMatrix; +uniform mediump vec3 uSize; +uniform mediump float uPointSize; +uniform lowp vec4 uFadeColor; +varying mediump vec3 vVertexColor; +varying mediump float vHue; vec3 hsv2rgb(vec3 c) { diff --git a/examples/reflection-demo/reflection-example.cpp b/examples/reflection-demo/reflection-example.cpp index 68b5691d..77318180 100644 --- a/examples/reflection-demo/reflection-example.cpp +++ b/examples/reflection-demo/reflection-example.cpp @@ -78,7 +78,7 @@ Shader CreateShader(const std::string& vsh, const std::string& fsh) std::vector<char> fshShaderSource; // VSH - if(vsh[0] == '/' && vsh[1] != '/') + if(vsh[0] == '/') { std::string vshPath(DEMO_GAME_DIR); vshPath += '/'; @@ -91,7 +91,7 @@ Shader CreateShader(const std::string& vsh, const std::string& fsh) } // FSH - if(fsh[0] == '/' && fsh[1] != '/') + if(fsh[0] == '/') { std::string fshPath(DEMO_GAME_DIR); fshPath += '/'; diff --git a/examples/reflection-demo/shaders/reflection-plasma.frag b/examples/reflection-demo/shaders/reflection-plasma.frag index 15bf7aac..47b0055c 100644 --- a/examples/reflection-demo/shaders/reflection-plasma.frag +++ b/examples/reflection-demo/shaders/reflection-plasma.frag @@ -1,20 +1,13 @@ -//@version 100 - precision mediump float; +uniform sampler2D sTexture; -UNIFORM sampler2D sTexture; - -UNIFORM_BLOCK Custom -{ -UNIFORM float uTime; -UNIFORM float uKFactor; -UNIFORM mediump vec3 eyePos; -UNIFORM mediump vec3 lightDir; -}; - -INPUT mediump vec3 vNormal; -INPUT mediump vec3 vPosition; -INPUT mediump vec2 vTexCoord; +uniform float uTime; +uniform float uKFactor; +uniform mediump vec3 eyePos; +uniform mediump vec3 lightDir; +varying mediump vec3 vNormal; +varying mediump vec3 vPosition; +varying mediump vec2 vTexCoord; void main() { @@ -33,5 +26,5 @@ void main() v += sin(sqrt(c.x*c.x+c.y*c.y+1.0)+uTime); v = v/2.0; mediump vec3 col = vec3(1, sin(PI*v), cos(PI*v)); - gl_FragColor = (TEXTURE(sTexture, vTexCoord)) * (((col.r+col.g+col.b)/3.0)+1.0+intensity); + gl_FragColor = (texture2D(sTexture, vTexCoord)) * (((col.r+col.g+col.b)/3.0)+1.0+intensity); } diff --git a/examples/reflection-demo/shaders/reflection-simple.frag b/examples/reflection-demo/shaders/reflection-simple.frag index 4c59193f..1c813ae1 100644 --- a/examples/reflection-demo/shaders/reflection-simple.frag +++ b/examples/reflection-demo/shaders/reflection-simple.frag @@ -1,17 +1,10 @@ -//@version 100 - -UNIFORM_BLOCK VanillaFrag -{ -UNIFORM lowp vec4 uColor; -}; - -UNIFORM sampler2D sTexture; - -INPUT mediump vec3 vNormal; -INPUT mediump vec3 vPosition; -INPUT mediump vec2 vTexCoord; +uniform lowp vec4 uColor; +uniform sampler2D sTexture; +varying mediump vec3 vNormal; +varying mediump vec3 vPosition; +varying mediump vec2 vTexCoord; void main() { - gl_FragColor = TEXTURE(sTexture, vTexCoord) * 2.0; + gl_FragColor = texture2D(sTexture, vTexCoord) * 2.0; } diff --git a/examples/reflection-demo/shaders/reflection-tex.frag b/examples/reflection-demo/shaders/reflection-tex.frag index 0d17642c..8f792cc3 100644 --- a/examples/reflection-demo/shaders/reflection-tex.frag +++ b/examples/reflection-demo/shaders/reflection-tex.frag @@ -1,19 +1,12 @@ -//@version 100 - -UNIFORM sampler2D sTexture0; -UNIFORM sampler2D sTexture1; - -UNIFORM_BLOCK Custom -{ -UNIFORM lowp vec4 uColor; -UNIFORM mediump vec3 eyePos; -UNIFORM mediump vec3 lightDir; -UNIFORM mediump vec2 uScreenSize; -}; - -INPUT mediump vec3 vNormal; -INPUT mediump vec3 vPosition; -INPUT mediump vec2 vTexCoord; +uniform lowp vec4 uColor; +uniform sampler2D sTexture0; +uniform sampler2D sTexture1; +uniform mediump vec3 eyePos; +uniform mediump vec3 lightDir; +uniform mediump vec2 uScreenSize; +varying mediump vec3 vNormal; +varying mediump vec3 vPosition; +varying mediump vec2 vTexCoord; mediump float rand(mediump vec2 co) { @@ -29,6 +22,6 @@ void main() mediump float factor = gl_FragCoord.y / uScreenSize.y; mediump float intensity = max(dot(n,l), 0.0); mediump vec2 uv = tx; - gl_FragColor = ((TEXTURE(sTexture0, vTexCoord) * factor ) + - (TEXTURE(sTexture1, uv))) * intensity; + gl_FragColor = ((texture2D(sTexture0, vTexCoord) * factor ) + + (texture2D(sTexture1, uv))) * intensity; } diff --git a/examples/reflection-demo/shaders/reflection-textured.frag b/examples/reflection-demo/shaders/reflection-textured.frag index 1c3962e8..8eb60617 100644 --- a/examples/reflection-demo/shaders/reflection-textured.frag +++ b/examples/reflection-demo/shaders/reflection-textured.frag @@ -1,18 +1,13 @@ -//@version 100 +uniform lowp vec4 uColor; +uniform sampler2D sTexture; +uniform mediump vec2 uScreenSize; -UNIFORM sampler2D sTexture; +uniform mediump vec3 eyePos; +uniform mediump vec3 lightDir; -UNIFORM_BLOCK Custom -{ -UNIFORM lowp vec4 uColor; -UNIFORM mediump vec2 uScreenSize; -UNIFORM mediump vec3 eyePos; -UNIFORM mediump vec3 lightDir; -}; - -INPUT mediump vec3 vNormal; -INPUT mediump vec3 vPosition; -INPUT mediump vec2 vTexCoord; +varying mediump vec3 vNormal; +varying mediump vec3 vPosition; +varying mediump vec2 vTexCoord; void main() { @@ -20,5 +15,5 @@ void main() mediump vec3 l = normalize( lightDir ); mediump vec3 e = normalize( eyePos ); mediump float intensity = max(dot(n,l), 0.0); - gl_FragColor = TEXTURE(sTexture, vTexCoord) * intensity; + gl_FragColor = texture2D(sTexture, vTexCoord) * intensity; } diff --git a/examples/reflection-demo/shaders/reflection.frag b/examples/reflection-demo/shaders/reflection.frag index 44a0902e..55060a84 100644 --- a/examples/reflection-demo/shaders/reflection.frag +++ b/examples/reflection-demo/shaders/reflection.frag @@ -1,17 +1,10 @@ -//@version 100 - -UNIFORM_BLOCK VanillaFrag -{ -UNIFORM lowp vec4 uColor; -}; - -UNIFORM sampler2D sTexture; - -INPUT mediump vec3 vNormal; -INPUT mediump vec3 vPosition; -INPUT mediump vec2 vTexCoord; +uniform lowp vec4 uColor; +uniform sampler2D sTexture; +varying mediump vec3 vNormal; +varying mediump vec3 vPosition; +varying mediump vec2 vTexCoord; void main() { - gl_FragColor = TEXTURE(sTexture, vTexCoord) * 50.0; + gl_FragColor = texture2D(sTexture, vTexCoord) * 50.0; } diff --git a/examples/reflection-demo/shaders/reflection.vert b/examples/reflection-demo/shaders/reflection.vert index 67136505..872da7d4 100644 --- a/examples/reflection-demo/shaders/reflection.vert +++ b/examples/reflection-demo/shaders/reflection.vert @@ -1,19 +1,13 @@ -//@version 100 +attribute mediump vec3 aPosition; +attribute mediump vec3 aNormal; +attribute mediump vec2 aTexCoord; +uniform mediump mat4 uMvpMatrix; +uniform mediump mat3 uNormalMatrix; +uniform mediump vec3 uSize; -INPUT mediump vec3 aPosition; -INPUT mediump vec3 aNormal; -INPUT mediump vec2 aTexCoord; - -UNIFORM_BLOCK Vanilla -{ -UNIFORM mediump mat4 uMvpMatrix; -UNIFORM mediump mat3 uNormalMatrix; -UNIFORM mediump vec3 uSize; -}; - -OUTPUT mediump vec2 vTexCoord; -OUTPUT mediump vec3 vNormal; -OUTPUT mediump vec3 vPosition; +varying mediump vec2 vTexCoord; +varying mediump vec3 vNormal; +varying mediump vec3 vPosition; void main() { diff --git a/examples/refraction-effect/shaders/refraction-effect-flat.frag b/examples/refraction-effect/shaders/refraction-effect-flat.frag index 98aaa08d..f9eba48f 100644 --- a/examples/refraction-effect/shaders/refraction-effect-flat.frag +++ b/examples/refraction-effect/shaders/refraction-effect-flat.frag @@ -1,15 +1,8 @@ -//@version 100 - -UNIFORM_BLOCK VanillaFrag -{ -UNIFORM lowp vec4 uColor; -}; - -UNIFORM sampler2D sTexture; - -INPUT mediump vec2 vTexCoord; +uniform lowp vec4 uColor; +uniform sampler2D sTexture; +varying mediump vec2 vTexCoord; void main() { - gl_FragColor = TEXTURE( sTexture, vTexCoord ) * uColor; + gl_FragColor = texture2D( sTexture, vTexCoord ) * uColor; } diff --git a/examples/refraction-effect/shaders/refraction-effect-flat.vert b/examples/refraction-effect/shaders/refraction-effect-flat.vert index 148f9417..fc35d09d 100644 --- a/examples/refraction-effect/shaders/refraction-effect-flat.vert +++ b/examples/refraction-effect/shaders/refraction-effect-flat.vert @@ -1,16 +1,10 @@ -//@version 100 - // The shader source is used when the MeshActor is not touched -INPUT mediump vec3 aPosition; -INPUT mediump vec3 aNormal; -INPUT highp vec2 aTexCoord; -UNIFORM_BLOCK Vanilla -{ -UNIFORM mediump mat4 uMvpMatrix; -}; - -OUTPUT mediump vec2 vTexCoord; +attribute mediump vec3 aPosition; +attribute mediump vec3 aNormal; +attribute highp vec2 aTexCoord; +uniform mediump mat4 uMvpMatrix; +varying mediump vec2 vTexCoord; void main() { diff --git a/examples/refraction-effect/shaders/refraction-effect-refraction.frag b/examples/refraction-effect/shaders/refraction-effect-refraction.frag index b3cf5a9d..8fcf92d1 100644 --- a/examples/refraction-effect/shaders/refraction-effect-refraction.frag +++ b/examples/refraction-effect/shaders/refraction-effect-refraction.frag @@ -1,22 +1,15 @@ -//@version 100 - precision mediump float; -UNIFORM_BLOCK Custom -{ -UNIFORM mediump float uEffectStrength; -UNIFORM mediump vec3 uLightPosition; -UNIFORM mediump vec2 uLightXYOffset; -UNIFORM mediump vec2 uLightSpinOffset; -UNIFORM mediump float uLightIntensity; -UNIFORM lowp vec4 uColor; -}; - -UNIFORM sampler2D sTexture; - -INPUT mediump vec4 vVertex; -INPUT mediump vec3 vNormal; -INPUT mediump vec2 vTexCoord; -INPUT mediump vec2 vTextureOffset; +uniform mediump float uEffectStrength; +uniform mediump vec3 uLightPosition; +uniform mediump vec2 uLightXYOffset; +uniform mediump vec2 uLightSpinOffset; +uniform mediump float uLightIntensity; +uniform lowp vec4 uColor; +uniform sampler2D sTexture; +varying mediump vec4 vVertex; +varying mediump vec3 vNormal; +varying mediump vec2 vTexCoord; +varying mediump vec2 vTextureOffset; vec3 rgb2hsl(vec3 rgb) { @@ -56,7 +49,7 @@ void main() spotEffect = spotEffect * uEffectStrength; mediump float lightDiffuse = ( ( dot( vecToLight, normal )-0.75 ) *uLightIntensity ) * spotEffect; - lowp vec4 color = TEXTURE( sTexture, vTexCoord + vTextureOffset * spotEffect ); + lowp vec4 color = texture2D( sTexture, vTexCoord + vTextureOffset * spotEffect ); vec3 lightedColor = hsl2rgb( rgb2hsl(color.rgb) + vec3(0.0,0.0,lightDiffuse) ); gl_FragColor = vec4( lightedColor, color.a ) * uColor; diff --git a/examples/refraction-effect/shaders/refraction-effect-refraction.vert b/examples/refraction-effect/shaders/refraction-effect-refraction.vert index 52b5368f..00611230 100644 --- a/examples/refraction-effect/shaders/refraction-effect-refraction.vert +++ b/examples/refraction-effect/shaders/refraction-effect-refraction.vert @@ -1,18 +1,11 @@ -//@version 100 - -INPUT mediump vec3 aPosition; -INPUT mediump vec3 aNormal; -INPUT highp vec2 aTexCoord; - -UNIFORM_BLOCK Vanilla -{ -UNIFORM mediump mat4 uMvpMatrix; -}; - -OUTPUT mediump vec4 vVertex; -OUTPUT mediump vec3 vNormal; -OUTPUT mediump vec2 vTexCoord; -OUTPUT mediump vec2 vTextureOffset; +attribute mediump vec3 aPosition; +attribute mediump vec3 aNormal; +attribute highp vec2 aTexCoord; +uniform mediump mat4 uMvpMatrix; +varying mediump vec4 vVertex; +varying mediump vec3 vNormal; +varying mediump vec2 vTexCoord; +varying mediump vec2 vTextureOffset; void main() { diff --git a/examples/renderer-stencil/shaders/render-stencil-textured.frag b/examples/renderer-stencil/shaders/render-stencil-textured.frag index b6b7d36e..27c63e5c 100644 --- a/examples/renderer-stencil/shaders/render-stencil-textured.frag +++ b/examples/renderer-stencil/shaders/render-stencil-textured.frag @@ -1,15 +1,9 @@ -//@version 100 - -INPUT mediump vec2 vTexCoord; -INPUT mediump vec3 vIllumination; -UNIFORM_BLOCK Color -{ - UNIFORM lowp vec4 uColor; -}; - -UNIFORM sampler2D sTexture; +varying mediump vec2 vTexCoord; +varying mediump vec3 vIllumination; +uniform lowp vec4 uColor; +uniform sampler2D sTexture; void main() { - gl_FragColor = vec4( TEXTURE( sTexture, vTexCoord ).rgb * vIllumination.rgb * uColor.rgb, uColor.a ); -}
\ No newline at end of file + gl_FragColor = vec4( texture2D( sTexture, vTexCoord ).rgb * vIllumination.rgb * uColor.rgb, uColor.a ); +} diff --git a/examples/renderer-stencil/shaders/render-stencil-textured.vert b/examples/renderer-stencil/shaders/render-stencil-textured.vert index 629da946..7dd59185 100644 --- a/examples/renderer-stencil/shaders/render-stencil-textured.vert +++ b/examples/renderer-stencil/shaders/render-stencil-textured.vert @@ -1,24 +1,18 @@ -//@version 100 - // Shader for basic, per-vertex lighting with texture (vertex): -INPUT mediump vec3 aPosition; -INPUT highp vec3 aNormal; -INPUT highp vec2 aTexCoord; - -OUTPUT mediump vec3 vIllumination; -OUTPUT mediump vec2 vTexCoord; - -UNIFORM_BLOCK Vanilla -{ -UNIFORM mediump mat4 uMvpMatrix; -UNIFORM mediump vec3 uSize; -UNIFORM mediump vec3 uObjectDimensions; -UNIFORM mediump mat4 uModelView; -UNIFORM mediump mat4 uViewMatrix; -UNIFORM mediump mat3 uNormalMatrix; -UNIFORM mediump vec3 uLightPosition; -}; +attribute mediump vec3 aPosition; +attribute highp vec3 aNormal; +attribute highp vec2 aTexCoord; + +varying mediump vec2 vTexCoord; +uniform mediump mat4 uMvpMatrix; +uniform mediump vec3 uSize; +uniform mediump vec3 uObjectDimensions; +varying mediump vec3 vIllumination; +uniform mediump mat4 uModelView; +uniform mediump mat4 uViewMatrix; +uniform mediump mat3 uNormalMatrix; +uniform mediump vec3 uLightPosition; void main() { diff --git a/examples/renderer-stencil/shaders/render-stencil.frag b/examples/renderer-stencil/shaders/render-stencil.frag index 36b924a2..12dd2a91 100644 --- a/examples/renderer-stencil/shaders/render-stencil.frag +++ b/examples/renderer-stencil/shaders/render-stencil.frag @@ -1,14 +1,7 @@ -//@version 100 - -INPUT mediump vec2 vTexCoord; -INPUT mediump vec3 vIllumination; - -UNIFORM_BLOCK color -{ - UNIFORM lowp vec4 uColor; -}; - -UNIFORM sampler2D sTexture; +varying mediump vec2 vTexCoord; +varying mediump vec3 vIllumination; +uniform lowp vec4 uColor; +uniform sampler2D sTexture; void main() { diff --git a/examples/renderer-stencil/shaders/render-stencil.vert b/examples/renderer-stencil/shaders/render-stencil.vert index a48673a2..06270a9c 100644 --- a/examples/renderer-stencil/shaders/render-stencil.vert +++ b/examples/renderer-stencil/shaders/render-stencil.vert @@ -1,24 +1,18 @@ -//@version 100 - // Shader for basic, per-vertex lighting (vertex): -INPUT mediump vec3 aPosition; -INPUT highp vec3 aNormal; -INPUT highp vec2 aTexCoord; - -OUTPUT mediump vec2 vTexCoord; -OUTPUT mediump vec3 vIllumination; - -UNIFORM_BLOCK Vanilla -{ -UNIFORM mediump mat4 uMvpMatrix; -UNIFORM mediump vec3 uSize; -UNIFORM mediump vec3 uObjectDimensions; -UNIFORM mediump mat4 uModelView; -UNIFORM mediump mat4 uViewMatrix; -UNIFORM mediump mat3 uNormalMatrix; -UNIFORM mediump vec3 uLightPosition; -}; +attribute mediump vec3 aPosition; +attribute highp vec3 aNormal; +attribute highp vec2 aTexCoord; + +varying mediump vec2 vTexCoord; +uniform mediump mat4 uMvpMatrix; +uniform mediump vec3 uSize; +uniform mediump vec3 uObjectDimensions; +varying mediump vec3 vIllumination; +uniform mediump mat4 uModelView; +uniform mediump mat4 uViewMatrix; +uniform mediump mat3 uNormalMatrix; +uniform mediump vec3 uLightPosition; void main() { diff --git a/examples/rendering-basic-light/shaders/rendering-basic-light.frag b/examples/rendering-basic-light/shaders/rendering-basic-light.frag index ce202e32..6f561531 100644 --- a/examples/rendering-basic-light/shaders/rendering-basic-light.frag +++ b/examples/rendering-basic-light/shaders/rendering-basic-light.frag @@ -1,7 +1,6 @@ -//@version 100 - -INPUT mediump vec3 vNormal; -INPUT mediump vec3 vFragPos; +varying mediump vec3 vNormal; +varying mediump vec3 vFragPos; +uniform mediump vec3 viewPos; // custom uniform struct Material { @@ -17,12 +16,8 @@ struct Light mediump vec3 color; }; -UNIFORM_BLOCK CustomFrag -{ -UNIFORM mediump vec3 viewPos; // custom uniform -UNIFORM Material material; // custom uniform -UNIFORM Light light; // custom uniform -}; +uniform Material material; // custom uniform +uniform Light light; // custom uniform void main() { diff --git a/examples/rendering-basic-light/shaders/rendering-basic-light.vert b/examples/rendering-basic-light/shaders/rendering-basic-light.vert index d39ec461..bc5c85af 100644 --- a/examples/rendering-basic-light/shaders/rendering-basic-light.vert +++ b/examples/rendering-basic-light/shaders/rendering-basic-light.vert @@ -1,18 +1,12 @@ -//@version 100 +attribute mediump vec3 aPosition; // DALi shader builtin +attribute mediump vec3 aNormal; // DALi shader builtin +uniform mediump mat4 uMvpMatrix; // DALi shader builtin +uniform mediump vec3 uSize; // DALi shader builtin +uniform mediump mat4 uModelView; // DALi shader builtin +uniform mediump mat3 uNormalMatrix; // DALi shader builtin -INPUT mediump vec3 aPosition; // DALi shader builtin -INPUT mediump vec3 aNormal; // DALi shader builtin - -UNIFORM_BLOCK Vanilla -{ -UNIFORM mediump mat4 uMvpMatrix; // DALi shader builtin -UNIFORM mediump vec3 uSize; // DALi shader builtin -UNIFORM mediump mat4 uModelView; // DALi shader builtin -UNIFORM mediump mat3 uNormalMatrix; // DALi shader builtin -}; - -OUTPUT mediump vec3 vNormal; -OUTPUT mediump vec3 vFragPos; +varying mediump vec3 vNormal; +varying mediump vec3 vFragPos; void main() { diff --git a/examples/rendering-cube/shaders/rendering-cube.frag b/examples/rendering-cube/shaders/rendering-cube.frag index 67a08ab3..1f8954ad 100644 --- a/examples/rendering-cube/shaders/rendering-cube.frag +++ b/examples/rendering-cube/shaders/rendering-cube.frag @@ -1,6 +1,4 @@ -//@version 100 - -INPUT mediump vec4 vColor; +varying mediump vec4 vColor; void main() { diff --git a/examples/rendering-cube/shaders/rendering-cube.vert b/examples/rendering-cube/shaders/rendering-cube.vert index 5c793742..d4a0b5c8 100644 --- a/examples/rendering-cube/shaders/rendering-cube.vert +++ b/examples/rendering-cube/shaders/rendering-cube.vert @@ -1,15 +1,9 @@ -//@version 100 +attribute mediump vec3 aPosition; // DALi shader builtin +attribute mediump vec3 aColor; // DALi shader builtin +uniform mediump mat4 uMvpMatrix; // DALi shader builtin +uniform mediump vec3 uSize; // DALi shader builtin -INPUT mediump vec3 aPosition; // DALi shader builtin -INPUT mediump vec3 aColor; // DALi shader builtin - -UNIFORM_BLOCK Vanilla -{ -UNIFORM mediump mat4 uMvpMatrix; // DALi shader builtin -UNIFORM mediump vec3 uSize; // DALi shader builtin -}; - -OUTPUT mediump vec4 vColor; +varying mediump vec4 vColor; void main() { diff --git a/examples/rendering-line/shaders/rendering-line.frag b/examples/rendering-line/shaders/rendering-line.frag index 1456e4b1..b8d9d3ab 100644 --- a/examples/rendering-line/shaders/rendering-line.frag +++ b/examples/rendering-line/shaders/rendering-line.frag @@ -1,9 +1,4 @@ -//@version 100 - -UNIFORM_BLOCK Custom -{ -UNIFORM mediump vec4 uColor; -}; +uniform mediump vec4 uColor; void main() { diff --git a/examples/rendering-line/shaders/rendering-line.vert b/examples/rendering-line/shaders/rendering-line.vert index f70dabeb..53f4a4f7 100644 --- a/examples/rendering-line/shaders/rendering-line.vert +++ b/examples/rendering-line/shaders/rendering-line.vert @@ -1,12 +1,6 @@ -//@version 100 - -INPUT mediump vec2 aPosition; // DALi shader builtin - -UNIFORM_BLOCK Vanilla -{ -UNIFORM mediump mat4 uMvpMatrix; // DALi shader builtin -UNIFORM mediump vec3 uSize; // DALi shader builtin -}; +attribute mediump vec2 aPosition; // DALi shader builtin +uniform mediump mat4 uMvpMatrix; // DALi shader builtin +uniform mediump vec3 uSize; // DALi shader builtin void main() { diff --git a/examples/rendering-radial-progress/shaders/radial-progress-basic.frag b/examples/rendering-radial-progress/shaders/radial-progress-basic.frag index 50cfdae3..d8d62266 100644 --- a/examples/rendering-radial-progress/shaders/radial-progress-basic.frag +++ b/examples/rendering-radial-progress/shaders/radial-progress-basic.frag @@ -1,5 +1,3 @@ -//@version 100 - // Fragment shader for polygon void main() diff --git a/examples/rendering-radial-progress/shaders/radial-progress-basic.vert b/examples/rendering-radial-progress/shaders/radial-progress-basic.vert index 9c591231..9700c416 100644 --- a/examples/rendering-radial-progress/shaders/radial-progress-basic.vert +++ b/examples/rendering-radial-progress/shaders/radial-progress-basic.vert @@ -1,17 +1,11 @@ -//@version 100 - // Vertex shader for polygon -INPUT mediump vec3 aPosition; - -UNIFORM_BLOCK Vanilla -{ -UNIFORM mediump mat4 uMvpMatrix; // DALi shader builtin -UNIFORM mediump vec3 uSize; // DALi shader builtin -UNIFORM mediump float uProgress; -}; +attribute mediump vec3 aPosition; +uniform mediump mat4 uMvpMatrix; // DALi shader builtin +uniform mediump vec3 uSize; // DALi shader builtin +uniform mediump float uProgress; -OUTPUT mediump vec2 vTexCoord; +varying mediump vec2 vTexCoord; void main() { diff --git a/examples/rendering-radial-progress/shaders/radial-progress-textured.frag b/examples/rendering-radial-progress/shaders/radial-progress-textured.frag index 2f9a483d..4017c033 100644 --- a/examples/rendering-radial-progress/shaders/radial-progress-textured.frag +++ b/examples/rendering-radial-progress/shaders/radial-progress-textured.frag @@ -1,12 +1,10 @@ -//@version 100 - // Fragment shaderfor textured quad -UNIFORM sampler2D uTexture; -INPUT mediump vec2 vTexCoord; +uniform sampler2D uTexture; +varying mediump vec2 vTexCoord; void main() { - mediump vec4 texColor = TEXTURE( uTexture, vTexCoord ); + mediump vec4 texColor = texture2D( uTexture, vTexCoord ); gl_FragColor = texColor; } diff --git a/examples/rendering-radial-progress/shaders/radial-progress-textured.vert b/examples/rendering-radial-progress/shaders/radial-progress-textured.vert index deb23706..78aca625 100644 --- a/examples/rendering-radial-progress/shaders/radial-progress-textured.vert +++ b/examples/rendering-radial-progress/shaders/radial-progress-textured.vert @@ -1,15 +1,10 @@ -//@version 100 // Vertex shader for textured quad -INPUT mediump vec2 aPosition; +attribute mediump vec2 aPosition; +uniform mediump mat4 uMvpMatrix; // DALi shader builtin +uniform mediump vec3 uSize; // DALi shader builtin -UNIFORM_BLOCK Vanilla -{ -UNIFORM mediump mat4 uMvpMatrix; // DALi shader builtin -UNIFORM mediump vec3 uSize; // DALi shader builtin -}; - -OUTPUT mediump vec2 vTexCoord; +varying mediump vec2 vTexCoord; void main() { diff --git a/examples/rendering-skybox/shaders/rendering-skybox-cube.frag b/examples/rendering-skybox/shaders/rendering-skybox-cube.frag index 93d84519..b8a29f58 100644 --- a/examples/rendering-skybox/shaders/rendering-skybox-cube.frag +++ b/examples/rendering-skybox/shaders/rendering-skybox-cube.frag @@ -1,13 +1,11 @@ -//@version 100 - // Fragment shader for a textured cube -UNIFORM sampler2D uTexture; +uniform sampler2D uTexture; -INPUT mediump vec2 vTexCoord; +varying mediump vec2 vTexCoord; void main() { - mediump vec4 texColor = TEXTURE( uTexture, vTexCoord ); + mediump vec4 texColor = texture2D( uTexture, vTexCoord ); gl_FragColor = texColor; } diff --git a/examples/rendering-skybox/shaders/rendering-skybox-cube.vert b/examples/rendering-skybox/shaders/rendering-skybox-cube.vert index 3e6bc48a..621f98de 100644 --- a/examples/rendering-skybox/shaders/rendering-skybox-cube.vert +++ b/examples/rendering-skybox/shaders/rendering-skybox-cube.vert @@ -1,16 +1,11 @@ -//@version 100 // Vertex shader for a textured cube -INPUT mediump vec3 aPosition; // DALi shader builtin -INPUT mediump vec2 aTexCoord; // DALi shader builtin +attribute mediump vec3 aPosition; // DALi shader builtin +attribute mediump vec2 aTexCoord; // DALi shader builtin +uniform mediump mat4 uMvpMatrix; // DALi shader builtin +uniform mediump vec3 uSize; // DALi shader builtin -UNIFORM_BLOCK Vanilla -{ -UNIFORM mediump mat4 uMvpMatrix; // DALi shader builtin -UNIFORM mediump vec3 uSize; // DALi shader builtin -}; - -OUTPUT mediump vec2 vTexCoord; +varying mediump vec2 vTexCoord; void main() { diff --git a/examples/rendering-skybox/shaders/rendering-skybox-equirectangular.frag b/examples/rendering-skybox/shaders/rendering-skybox-equirectangular.frag index 4bc66fb3..e38d7e86 100644 --- a/examples/rendering-skybox/shaders/rendering-skybox-equirectangular.frag +++ b/examples/rendering-skybox/shaders/rendering-skybox-equirectangular.frag @@ -1,11 +1,9 @@ -//@version 100 - // Fragment shader for a skybox in equirectangular projection precision mediump float; -UNIFORM sampler2D uSkyBoxEquirectangularTexture; +uniform sampler2D uSkyBoxEquirectangularTexture; -INPUT vec3 vTexCoord; +varying vec3 vTexCoord; // Take the sample direction as interpolated from the cube's local position, // and use this direction vector and the spherical to cartesian coordinate @@ -32,6 +30,6 @@ void main() // Flip the texture UVs vertically vec2 uvFlippped = vec2(uv.x, 1.0 - uv.y); - vec4 texColor = TEXTURE( uSkyBoxEquirectangularTexture, uvFlippped ); + vec4 texColor = texture2D( uSkyBoxEquirectangularTexture, uvFlippped ); gl_FragColor = texColor; } diff --git a/examples/rendering-skybox/shaders/rendering-skybox.frag b/examples/rendering-skybox/shaders/rendering-skybox.frag index 7a15616b..c7556457 100644 --- a/examples/rendering-skybox/shaders/rendering-skybox.frag +++ b/examples/rendering-skybox/shaders/rendering-skybox.frag @@ -1,13 +1,11 @@ -//@version 100 - // Fragment shader for a skybox -UNIFORM samplerCube uSkyBoxTexture; +uniform samplerCube uSkyBoxTexture; -INPUT mediump vec3 vTexCoord; +varying mediump vec3 vTexCoord; void main() { - mediump vec4 texColor = TEXTURE( uSkyBoxTexture, vTexCoord ); + mediump vec4 texColor = textureCube( uSkyBoxTexture, vTexCoord ); gl_FragColor = texColor; } diff --git a/examples/rendering-skybox/shaders/rendering-skybox.vert b/examples/rendering-skybox/shaders/rendering-skybox.vert index 811357f6..c2ce43a9 100644 --- a/examples/rendering-skybox/shaders/rendering-skybox.vert +++ b/examples/rendering-skybox/shaders/rendering-skybox.vert @@ -1,16 +1,9 @@ -//@version 100 - // Vertex shader for a skybox -INPUT mediump vec3 aPosition; // DALi shader builtin - - -UNIFORM_BLOCK Vanilla -{ -UNIFORM mediump mat4 uMvpMatrix; // DALi shader builtin -}; +attribute mediump vec3 aPosition; // DALi shader builtin +uniform mediump mat4 uMvpMatrix; // DALi shader builtin -OUTPUT mediump vec3 vTexCoord; +varying mediump vec3 vTexCoord; void main() { diff --git a/examples/rendering-textured-cube/shaders/rendering-textured-cube.frag b/examples/rendering-textured-cube/shaders/rendering-textured-cube.frag index 96e0887e..43fb27f4 100644 --- a/examples/rendering-textured-cube/shaders/rendering-textured-cube.frag +++ b/examples/rendering-textured-cube/shaders/rendering-textured-cube.frag @@ -1,10 +1,8 @@ -//@version 100 - -UNIFORM sampler2D uTexture; -INPUT mediump vec2 vTexCoord; +uniform sampler2D uTexture; +varying mediump vec2 vTexCoord; void main() { - mediump vec4 texColor = TEXTURE( uTexture, vTexCoord ); + mediump vec4 texColor = texture2D( uTexture, vTexCoord ); gl_FragColor = texColor; } diff --git a/examples/rendering-textured-cube/shaders/rendering-textured-cube.vert b/examples/rendering-textured-cube/shaders/rendering-textured-cube.vert index 787104bd..36c0e608 100644 --- a/examples/rendering-textured-cube/shaders/rendering-textured-cube.vert +++ b/examples/rendering-textured-cube/shaders/rendering-textured-cube.vert @@ -1,15 +1,9 @@ -//@version 100 +attribute mediump vec3 aPosition; // DALi shader builtin +attribute mediump vec2 aTexCoord; // DALi shader builtin +uniform mediump mat4 uMvpMatrix; // DALi shader builtin +uniform mediump vec3 uSize; // DALi shader builtin -INPUT mediump vec3 aPosition; // DALi shader builtin -INPUT mediump vec2 aTexCoord; // DALi shader builtin - -UNIFORM_BLOCK Vert -{ -UNIFORM mediump mat4 uMvpMatrix; // DALi shader builtin -UNIFORM mediump vec3 uSize; // DALi shader builtin -}; - -OUTPUT mediump vec2 vTexCoord; +varying mediump vec2 vTexCoord; void main() { diff --git a/examples/rendering-triangle/shaders/rendering-triangle.frag b/examples/rendering-triangle/shaders/rendering-triangle.frag index a452cec2..b8d9d3ab 100644 --- a/examples/rendering-triangle/shaders/rendering-triangle.frag +++ b/examples/rendering-triangle/shaders/rendering-triangle.frag @@ -1,9 +1,4 @@ -//@version 100 - -UNIFORM_BLOCK Custome -{ -UNIFORM mediump vec4 uColor; -}; +uniform mediump vec4 uColor; void main() { diff --git a/examples/rendering-triangle/shaders/rendering-triangle.vert b/examples/rendering-triangle/shaders/rendering-triangle.vert index f70dabeb..53f4a4f7 100644 --- a/examples/rendering-triangle/shaders/rendering-triangle.vert +++ b/examples/rendering-triangle/shaders/rendering-triangle.vert @@ -1,12 +1,6 @@ -//@version 100 - -INPUT mediump vec2 aPosition; // DALi shader builtin - -UNIFORM_BLOCK Vanilla -{ -UNIFORM mediump mat4 uMvpMatrix; // DALi shader builtin -UNIFORM mediump vec3 uSize; // DALi shader builtin -}; +attribute mediump vec2 aPosition; // DALi shader builtin +uniform mediump mat4 uMvpMatrix; // DALi shader builtin +uniform mediump vec3 uSize; // DALi shader builtin void main() { diff --git a/examples/sparkle/shaders/sparkle-effect.frag b/examples/sparkle/shaders/sparkle-effect.frag index e2213894..006a7d2b 100644 --- a/examples/sparkle/shaders/sparkle-effect.frag +++ b/examples/sparkle/shaders/sparkle-effect.frag @@ -1,13 +1,11 @@ -//@version 100 - precision highp float; -UNIFORM sampler2D sTexture; +uniform sampler2D sTexture; +varying vec2 vTexCoord; -INPUT vec2 vTexCoord; -INPUT lowp vec4 vColor; +varying lowp vec4 vColor; void main() { gl_FragColor = vColor; - gl_FragColor.a *= TEXTURE(sTexture, vTexCoord).a; + gl_FragColor.a *= texture2D(sTexture, vTexCoord).a; } diff --git a/examples/sparkle/shaders/sparkle-effect.vert b/examples/sparkle/shaders/sparkle-effect.vert index 45689ab8..02c33df8 100644 --- a/examples/sparkle/shaders/sparkle-effect.vert +++ b/examples/sparkle/shaders/sparkle-effect.vert @@ -1,32 +1,29 @@ -//@version 100 precision highp float; -INPUT vec2 aTexCoord; -INPUT vec2 aParticlePath0; -INPUT vec2 aParticlePath1; -INPUT vec2 aParticlePath2; -INPUT vec2 aParticlePath3; -INPUT vec2 aParticlePath4; -INPUT vec2 aParticlePath5; +attribute vec2 aTexCoord; +uniform mat4 uMvpMatrix; +varying vec2 vTexCoord; -OUTPUT lowp vec4 vColor; -OUTPUT vec2 vTexCoord; +attribute vec2 aParticlePath0; +attribute vec2 aParticlePath1; +attribute vec2 aParticlePath2; +attribute vec2 aParticlePath3; +attribute vec2 aParticlePath4; +attribute vec2 aParticlePath5; -UNIFORM_BLOCK Custom -{ -UNIFORM mat4 uMvpMatrix; -UNIFORM float uPercentage; -UNIFORM float uPercentageMarked; -UNIFORM vec3 uParticleColors[NUM_COLOR]; -UNIFORM float uOpacity[NUM_PARTICLE]; -UNIFORM vec2 uTapIndices; -UNIFORM float uTapOffset[MAXIMUM_ANIMATION_COUNT]; -UNIFORM vec2 uTapPoint[MAXIMUM_ANIMATION_COUNT]; -UNIFORM float uAcceleration; -UNIFORM float uRadius; -UNIFORM float uEffectScale; -UNIFORM float uBreak; -}; +uniform float uPercentage; +uniform float uPercentageMarked; +uniform vec3 uParticleColors[NUM_COLOR]; +uniform float uOpacity[NUM_PARTICLE]; +uniform vec2 uTapIndices; +uniform float uTapOffset[MAXIMUM_ANIMATION_COUNT]; +uniform vec2 uTapPoint[MAXIMUM_ANIMATION_COUNT]; +uniform float uAcceleration; +uniform float uRadius; +uniform float uScale; +uniform float uBreak; + +varying lowp vec4 vColor; void main() { @@ -41,7 +38,7 @@ void main() return; } - // As the movement along the b-curve has nonUNIFORM speed with a UNIFORM increasing parameter 'uPercentage' + // As the movement along the b-curve has nonuniform speed with a uniform increasing parameter 'uPercentage' // we give different particles the different 'percentage' to make them looks more random float increment = idx / float(NUM_PARTICLE)*5.0; float percentage = mod(uPercentage +uAcceleration+increment, 1.0); @@ -78,8 +75,8 @@ void main() position = mix( position, vec2( 250.0,250.0 ),uBreak*(1.0-uOpacity[int(idx)]) ) ; // vertex position on the mesh: (sign(aTexCoord.x), sign(aTexCoord.y))*PARTICLE_HALF_SIZE - gl_Position = uMvpMatrix * vec4( position.x+sign(aTexCoord.x)*PARTICLE_HALF_SIZE/uEffectScale, - position.y+sign(aTexCoord.y)*PARTICLE_HALF_SIZE/uEffectScale, + gl_Position = uMvpMatrix * vec4( position.x+sign(aTexCoord.x)*PARTICLE_HALF_SIZE/uScale, + position.y+sign(aTexCoord.y)*PARTICLE_HALF_SIZE/uScale, 0.0, 1.0 ); // we store the color index inside texCoord attribute diff --git a/examples/sparkle/sparkle-effect-example.cpp b/examples/sparkle/sparkle-effect-example.cpp index 3f7d9ebb..a6c7a83c 100644 --- a/examples/sparkle/sparkle-effect-example.cpp +++ b/examples/sparkle/sparkle-effect-example.cpp @@ -356,12 +356,12 @@ private: // prepare the animation by setting the uniform to the required value mEffect.SetProperty(mEffect.GetPropertyIndex(BREAK_UNIFORM_NAME), 1.f); mMeshActor.SetProperty(Actor::Property::SCALE, 0.01f); - mEffect.SetProperty(mEffect.GetPropertyIndex("uEffectScale"), 0.01f); + mEffect.SetProperty(mEffect.GetPropertyIndex("uScale"), 0.01f); mMeshActor.SetProperty(Actor::Property::POSITION, Vector3(0.f, 0.f, 1.f)); Animation breakAnimation = Animation::New(duration * 1.5f); breakAnimation.AnimateTo(Property(mMeshActor, Actor::Property::SCALE), Vector3(ACTOR_SCALE, ACTOR_SCALE, ACTOR_SCALE), EaseOutSquare); - breakAnimation.AnimateTo(Property(mEffect, "uEffectScale"), ACTOR_SCALE, EaseOutSquare); + breakAnimation.AnimateTo(Property(mEffect, "uScale"), ACTOR_SCALE, EaseOutSquare); breakAnimation.AnimateTo(Property(mMeshActor, Actor::Property::POSITION), ACTOR_POSITION, EaseOutSquare); breakAnimation.FinishedSignal().Connect(this, &SparkleEffectExample::OnBreakAnimationFinished); diff --git a/examples/sparkle/sparkle-effect.h b/examples/sparkle/sparkle-effect.h index 2deee478..2f0247ad 100644 --- a/examples/sparkle/sparkle-effect.h +++ b/examples/sparkle/sparkle-effect.h @@ -244,7 +244,7 @@ Shader New() handle.RegisterProperty(oss.str(), PARTICLE_COLORS[i].RGB); } handle.RegisterProperty("uRadius", 250.f); - handle.RegisterProperty("uEffectScale", ACTOR_SCALE); + handle.RegisterProperty("uScale", ACTOR_SCALE); // set the initial uniform values diff --git a/examples/styling/shaders/image-channel-control.frag b/examples/styling/shaders/image-channel-control.frag index a717dd85..37bdf1c4 100644 --- a/examples/styling/shaders/image-channel-control.frag +++ b/examples/styling/shaders/image-channel-control.frag @@ -1,16 +1,9 @@ -//@version 100 - INPUT mediump vec2 vTexCoord; - -UNIFORM sampler2D sTexture; - -UNIFORM_BLOCK Custom -{ -UNIFORM mediump vec4 uColor; -UNIFORM mediump vec3 uChannels; -}; +uniform sampler2D sTexture; +uniform mediump vec4 uColor; +uniform mediump vec3 uChannels; void main() { - gl_FragColor = TEXTURE( sTexture, vTexCoord ) * uColor * vec4(uChannels, 1.0) ; + OUT_COLOR = TEXTURE( sTexture, vTexCoord ) * uColor * vec4(uChannels, 1.0) ; } diff --git a/examples/textured-mesh/shaders/textured-mesh.frag b/examples/textured-mesh/shaders/textured-mesh.frag index 06668b61..1edd66ec 100644 --- a/examples/textured-mesh/shaders/textured-mesh.frag +++ b/examples/textured-mesh/shaders/textured-mesh.frag @@ -1,16 +1,9 @@ -//@version 100 - -INPUT mediump vec2 vTexCoord; - -UNIFORM sampler2D sTexture; - -UNIFORM_BLOCK CustomColor -{ -UNIFORM lowp vec4 uColor; -UNIFORM lowp vec4 uFadeColor; -}; +varying mediump vec2 vTexCoord; +uniform lowp vec4 uColor; +uniform sampler2D sTexture; +uniform lowp vec4 uFadeColor; void main() { - gl_FragColor = TEXTURE(sTexture, vTexCoord)* uColor * uFadeColor; + gl_FragColor = texture2D(sTexture, vTexCoord) * uColor * uFadeColor; } diff --git a/examples/textured-mesh/shaders/textured-mesh.vert b/examples/textured-mesh/shaders/textured-mesh.vert index 3c974f22..11931501 100644 --- a/examples/textured-mesh/shaders/textured-mesh.vert +++ b/examples/textured-mesh/shaders/textured-mesh.vert @@ -1,15 +1,9 @@ -//@version 100 - -INPUT mediump vec2 aPosition; -INPUT highp vec2 aTexCoord; - -OUTPUT mediump vec2 vTexCoord; - -UNIFORM_BLOCK Vanilla -{ -UNIFORM mediump mat4 uMvpMatrix; -UNIFORM mediump vec3 uSize; -}; +attribute mediump vec2 aPosition; +attribute highp vec2 aTexCoord; +varying mediump vec2 vTexCoord; +uniform mediump mat4 uMvpMatrix; +uniform mediump vec3 uSize; +uniform lowp vec4 uFadeColor; void main() { diff --git a/examples/textured-mesh/textured-mesh-example.cpp b/examples/textured-mesh/textured-mesh-example.cpp index d87fc89c..2423d8e2 100644 --- a/examples/textured-mesh/textured-mesh-example.cpp +++ b/examples/textured-mesh/textured-mesh-example.cpp @@ -92,7 +92,6 @@ public: mRenderer = Renderer::New(mGeometry, mShader); mRenderer.SetTextures(mTextureSet1); - mRenderer[Renderer::Property::FACE_CULLING_MODE] = FaceCullingMode::NONE; mMeshActor = Actor::New(); mMeshActor.AddRenderer(mRenderer); diff --git a/examples/uniform-blocks/shaders/uniform-block-alt.frag b/examples/uniform-blocks/shaders/uniform-block-alt.frag index 6e0192b6..81cd3dfe 100644 --- a/examples/uniform-blocks/shaders/uniform-block-alt.frag +++ b/examples/uniform-blocks/shaders/uniform-block-alt.frag @@ -1,14 +1,12 @@ -//@version 100 - -UNIFORM_BLOCK FragmentBlock +layout(std140) uniform FragmentBlock { - UNIFORM lowp vec4 uColor; - UNIFORM mediump vec4 uColorArray[1024]; - UNIFORM mediump int uColorIndex; + lowp vec4 uColor; + mediump vec4 uColorArray[1024]; + mediump int uColorIndex; }; void main() { // Test that the array color is the same as the actor color - gl_FragColor = vec4(vec3(0.5, 0.5, 0.5) + vec3(uColorArray[uColorIndex].xyz-uColor.xyz)*0.5, 1.0); + fragColor = vec4(vec3(0.5, 0.5, 0.5) + vec3(uColorArray[uColorIndex].xyz-uColor.xyz)*0.5, 1.0); } diff --git a/examples/uniform-blocks/shaders/uniform-block.frag b/examples/uniform-blocks/shaders/uniform-block.frag index 71479353..9e699bf9 100644 --- a/examples/uniform-blocks/shaders/uniform-block.frag +++ b/examples/uniform-blocks/shaders/uniform-block.frag @@ -1,13 +1,11 @@ -//@version 100 - -UNIFORM_BLOCK FragmentBlock +layout(std140) uniform FragmentBlock { -UNIFORM lowp vec4 uColor; -UNIFORM mediump vec4 uColorArray[1024]; -UNIFORM mediump int uColorIndex; + lowp vec4 uColor; + mediump vec4 uColorArray[1024]; + mediump int uColorIndex; }; void main() { - gl_FragColor = uColorArray[uColorIndex]; + fragColor = uColorArray[uColorIndex]; } diff --git a/examples/uniform-blocks/shaders/uniform-block.vert b/examples/uniform-blocks/shaders/uniform-block.vert index ecdae31c..cbf8ff9d 100644 --- a/examples/uniform-blocks/shaders/uniform-block.vert +++ b/examples/uniform-blocks/shaders/uniform-block.vert @@ -1,11 +1,9 @@ -//@version 100 - INPUT vec2 aPosition; -UNIFORM_BLOCK Vanilla +layout(std140) uniform VertexBlock { -UNIFORM highp mat4 uMvpMatrix; -UNIFORM highp vec3 uSize; + highp mat4 uMvpMatrix; + highp vec3 uSize; }; void main() diff --git a/examples/waves/shaders/waves.frag b/examples/waves/shaders/waves.frag index 2c7589b8..8a496a19 100644 --- a/examples/waves/shaders/waves.frag +++ b/examples/waves/shaders/waves.frag @@ -1,25 +1,19 @@ -//@version 100 - precision highp float; -UNIFORM sampler2D uNormalMap; // DALi - -UNIFORM_BLOCK CustomFrag -{ -UNIFORM vec4 uColor; // DALi +uniform vec4 uColor; // DALi +uniform sampler2D uNormalMap; // DALi -UNIFORM vec3 uInvLightDir; -UNIFORM vec3 uLightColorSqr; -UNIFORM vec3 uAmbientColor; +uniform vec3 uInvLightDir; +uniform vec3 uLightColorSqr; +uniform vec3 uAmbientColor; -UNIFORM float uNormalMapWeight; -UNIFORM float uSpecularity; -}; +uniform float uNormalMapWeight; +uniform float uSpecularity; -INPUT vec2 vUv; -INPUT vec3 vNormal; -INPUT vec3 vViewPos; -INPUT float vHeight; +varying vec2 vUv; +varying vec3 vNormal; +varying vec3 vViewPos; +varying float vHeight; float Rand(vec2 co) { @@ -36,8 +30,8 @@ void main() vec3 viewPos = normalize(vViewPos); vec2 uv2 = vUv + vViewPos.xy / vViewPos.z * vHeight + vec2(.5, 0.); - vec3 perturbNormal = TEXTURE(uNormalMap, vUv).rgb * 2. - 1.; - vec3 perturbNormal2 = TEXTURE(uNormalMap, uv2).rgb * 2. - 1.; + vec3 perturbNormal = texture2D(uNormalMap, vUv).rgb * 2. - 1.; + vec3 perturbNormal2 = texture2D(uNormalMap, uv2).rgb * 2. - 1.; vec3 normal = normalize(vNormal + perturbNormal * uNormalMapWeight); vec3 normal2 = normalize(vNormal + perturbNormal2 * uNormalMapWeight); diff --git a/examples/waves/shaders/waves.vert b/examples/waves/shaders/waves.vert index 7830ec7c..ac9af2fd 100644 --- a/examples/waves/shaders/waves.vert +++ b/examples/waves/shaders/waves.vert @@ -1,39 +1,32 @@ -//@version 100 - #define FMA(a, b, c) ((a) * (b) + (c)) // fused multiply-add precision highp float; const float kTile = 1.; + const float kPi = 3.1415926535; const float kEpsilon = 1. / 32.; // DALI uniforms -UNIFORM_BLOCK Vanilla -{ -UNIFORM vec3 uSize; -UNIFORM mat4 uModelView; -UNIFORM mat4 uProjection; -UNIFORM mat3 uNormalMatrix; -}; - -// our UNIFORMs -UNIFORM_BLOCK CustomVert -{ -UNIFORM float uTime; -UNIFORM vec2 uScrollScale; -UNIFORM float uWaveRate; -UNIFORM float uWaveAmplitude; -UNIFORM float uParallaxAmount; -}; - -INPUT vec2 aPosition; -INPUT vec2 aTexCoord; - -OUTPUT vec2 vUv; -OUTPUT vec3 vViewPos; -OUTPUT vec3 vNormal; -OUTPUT float vHeight; +uniform vec3 uSize; +uniform mat4 uModelView; +uniform mat4 uProjection; +uniform mat3 uNormalMatrix; + +// our uniforms +uniform float uTime; +uniform vec2 uScrollScale; +uniform float uWaveRate; +uniform float uWaveAmplitude; +uniform float uParallaxAmount; + +attribute vec2 aPosition; +attribute vec2 aTexCoord; + +varying vec2 vUv; +varying vec3 vViewPos; +varying vec3 vNormal; +varying float vHeight; float CubicHermite(float B, float C, float t) { diff --git a/resources/shaders/raymarch_sphere_shaded.fsh b/resources/shaders/raymarch_sphere_shaded.fsh index 1a35b93b..7e7d6b8b 100644 --- a/resources/shaders/raymarch_sphere_shaded.fsh +++ b/resources/shaders/raymarch_sphere_shaded.fsh @@ -1,16 +1,11 @@ -//@version 100 - /* * Fragment shader for textured quad */ -INPUT mediump vec2 vTexCoord; -INPUT mediump vec2 vRayCastCoord; +varying mediump vec2 vTexCoord; +varying mediump vec2 vRayCastCoord; -UNIFORM_BLOCK Custom -{ -UNIFORM mediump float uRadius; -UNIFORM mediump float uAdjuster; -} +uniform mediump float uRadius; +uniform mediump float uAdjuster; #define CAMERA_Z_POSITION 1.0 // gives us a FOV of 90 degrees if Plane of projection is at Z = 0 with size 2x2 #define SPHERE_Z_POSITION -1.0 // Sphere placed behind Plane of projection diff --git a/resources/shaders/raymarch_sphere_shaded.vsh b/resources/shaders/raymarch_sphere_shaded.vsh index 5a41c5a8..fcc1df33 100644 --- a/resources/shaders/raymarch_sphere_shaded.vsh +++ b/resources/shaders/raymarch_sphere_shaded.vsh @@ -1,15 +1,9 @@ -//@version 100 - -INPUT mediump vec2 aPosition; -OUTPUT mediump vec2 vTexCoord; -OUTPUT mediump vec2 vRayCastCoord; - -UNIFORM_BLOCK Vanilla -{ -UNIFORM mediump mat4 uMvpMatrix; // DALi shader builtin -UNIFORM mediump vec3 uSize; // DALi shader builtin -}; +attribute mediump vec2 aPosition; +uniform mediump mat4 uMvpMatrix; // DALi shader builtin +uniform mediump vec3 uSize; // DALi shader builtin +varying mediump vec2 vTexCoord; +varying mediump vec2 vRayCastCoord; void main() { mediump vec4 vertexPosition = vec4(aPosition, 0.0, 1.0); diff --git a/resources/style/android/base-theme.json b/resources/style/android/base-theme.json index 667e2087..b477b966 100644 --- a/resources/style/android/base-theme.json +++ b/resources/style/android/base-theme.json @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Samsung Electronics Co., Ltd + * Copyright (c) 2019 Samsung Electronics Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -50,23 +50,20 @@ "shader": { "fragmentShader":[ - "//@version 100", " varying mediump vec2 vTexCoord;", - " UNIFORM sampler2D sTexture;", - " UNIFORM_BLOCK FragBlock", - " {", - " UNIFORM lowp vec4 uColor;", - " UNIFORM mediump vec3 uCustomPosition;", - " };", + " uniform lowp vec4 uColor;", + " uniform sampler2D sTexture;", + " uniform mediump vec3 uCustomPosition;", + "", " void main()", " {", - " if( TEXTURE( sTexture, vTexCoord ).a <= 0.0001 )", + " if( texture2D( sTexture, vTexCoord ).a <= 0.0001 )", " {", " discard;", " }", "", " mediump vec2 wrapTexCoord = vec2( ( vTexCoord.x / 4.0 ) + ( uCustomPosition.x / 4.0 ) + ( uCustomPosition.z / 2.0 ), vTexCoord.y / 4.0 );", - " mediump vec4 color = TEXTURE( sTexture, wrapTexCoord );", + " mediump vec4 color = texture2D( sTexture, wrapTexCoord );", " mediump float positionWeight = ( uCustomPosition.y + 0.3 ) * color.r * 2.0;", "", " gl_FragColor = vec4( positionWeight, positionWeight, positionWeight, 0.9 ) * uColor + vec4( uColor.xyz, 0.0 );", @@ -92,21 +89,19 @@ { "fragmentShader":[ " varying mediump vec2 vTexCoord;", - " UNIFORM sampler2D sTexture;", - " UNIFORM_BLOCK FragBlock", - " {", - " UNIFORM lowp vec4 uColor;", - " UNIFORM mediump vec3 uCustomPosition;", - " };", + " uniform lowp vec4 uColor;", + " uniform sampler2D sTexture;", + " uniform mediump vec3 uCustomPosition;", + "", " void main()", " {", - " if( TEXTURE( sTexture, vTexCoord ).a <= 0.0001 )", + " if( texture2D( sTexture, vTexCoord ).a <= 0.0001 )", " {", " discard;", " }", "", " mediump vec2 wrapTexCoord = vec2( ( vTexCoord.x / 4.0 ) + ( uCustomPosition.x / 4.0 ) + ( uCustomPosition.z / 2.0 ), vTexCoord.y / 4.0 );", - " mediump vec4 color = TEXTURE( sTexture, wrapTexCoord );", + " mediump vec4 color = texture2D( sTexture, wrapTexCoord );", " mediump float positionWeight = ( uCustomPosition.y + 0.3 ) * color.r * 2.0;", "", " gl_FragColor = vec4( positionWeight, positionWeight, positionWeight, 0.9 ) * uColor + vec4( uColor.xyz, 0.0 );", diff --git a/resources/style/base-theme.json b/resources/style/base-theme.json index fdcb4244..12404e94 100644 --- a/resources/style/base-theme.json +++ b/resources/style/base-theme.json @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Samsung Electronics Co., Ltd + * Copyright (c) 2019 Samsung Electronics Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -50,23 +50,20 @@ "shader": { "fragmentShader":[ - "//@version 100", - " INPUT mediump vec2 vTexCoord;", - " UNIFORM sampler2D sTexture;", - " UNIFORM_BLOCK FragBlock", - " {", - " UNIFORM lowp vec4 uColor;", - " UNIFORM mediump vec3 uCustomPosition;", - " };", + " varying mediump vec2 vTexCoord;", + " uniform lowp vec4 uColor;", + " uniform sampler2D sTexture;", + " uniform mediump vec3 uCustomPosition;", + "", " void main()", " {", - " if( TEXTURE( sTexture, vTexCoord ).a <= 0.0001 )", + " if( texture2D( sTexture, vTexCoord ).a <= 0.0001 )", " {", " discard;", " }", "", " mediump vec2 wrapTexCoord = vec2( ( vTexCoord.x / 4.0 ) + ( uCustomPosition.x / 4.0 ) + ( uCustomPosition.z / 2.0 ), vTexCoord.y / 4.0 );", - " mediump vec4 color = TEXTURE( sTexture, wrapTexCoord );", + " mediump vec4 color = texture2D( sTexture, wrapTexCoord );", " mediump float positionWeight = ( uCustomPosition.y + 0.3 ) * color.r * 2.0;", "", " gl_FragColor = vec4( positionWeight, positionWeight, positionWeight, 0.9 ) * uColor + vec4( uColor.xyz, 0.0 );", @@ -91,24 +88,20 @@ "shader": { "fragmentShader":[ - "//@version 100", - " INPUT mediump vec2 vTexCoord;", - " UNIFORM sampler2D sTexture;", - " UNIFORM_BLOCK FragBlock", - " {", - " UNIFORM lowp vec4 uColor;", - " UNIFORM mediump vec3 uCustomPosition;", - " };", + " varying mediump vec2 vTexCoord;", + " uniform lowp vec4 uColor;", + " uniform sampler2D sTexture;", + " uniform mediump vec3 uCustomPosition;", "", " void main()", " {", - " if( TEXTURE( sTexture, vTexCoord ).a <= 0.0001 )", + " if( texture2D( sTexture, vTexCoord ).a <= 0.0001 )", " {", " discard;", " }", "", " mediump vec2 wrapTexCoord = vec2( ( vTexCoord.x / 4.0 ) + ( uCustomPosition.x / 4.0 ) + ( uCustomPosition.z / 2.0 ), vTexCoord.y / 4.0 );", - " mediump vec4 color = TEXTURE( sTexture, wrapTexCoord );", + " mediump vec4 color = texture2D( sTexture, wrapTexCoord );", " mediump float positionWeight = ( uCustomPosition.y + 0.3 ) * color.r * 2.0;", "", " gl_FragColor = vec4( positionWeight, positionWeight, positionWeight, 0.9 ) * uColor + vec4( uColor.xyz, 0.0 );", diff --git a/resources/style/rpi/base-theme.json b/resources/style/rpi/base-theme.json index 5c3bd62a..d8400b33 100644 --- a/resources/style/rpi/base-theme.json +++ b/resources/style/rpi/base-theme.json @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Samsung Electronics Co., Ltd + * Copyright (c) 2019 Samsung Electronics Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -46,23 +46,20 @@ "shader": { "fragmentShader":[ - "//@version 100", - " INPUT mediump vec2 vTexCoord;", - " UNIFORM sampler2D sTexture;", - " UNIFORM_BLOCK FragmentBlock", - " {", - " UNIFORM lowp vec4 uColor;", - " UNIFORM mediump vec3 uCustomPosition;", - " };", + " varying mediump vec2 vTexCoord;", + " uniform lowp vec4 uColor;", + " uniform sampler2D sTexture;", + " uniform mediump vec3 uCustomPosition;", + "", " void main()", " {", - " if( TEXTURE( sTexture, vTexCoord ).a <= 0.0001 )", + " if( texture2D( sTexture, vTexCoord ).a <= 0.0001 )", " {", " discard;", " }", "", " mediump vec2 wrapTexCoord = vec2( ( vTexCoord.x / 4.0 ) + ( uCustomPosition.x / 4.0 ) + ( uCustomPosition.z / 2.0 ), vTexCoord.y / 4.0 );", - " mediump vec4 color = TEXTURE( sTexture, wrapTexCoord );", + " mediump vec4 color = texture2D( sTexture, wrapTexCoord );", " mediump float positionWeight = ( uCustomPosition.y + 0.3 ) * color.r * 2.0;", "", " gl_FragColor = vec4( positionWeight, positionWeight, positionWeight, 0.9 ) * uColor + vec4( uColor.xyz, 0.0 );", @@ -87,23 +84,20 @@ "shader": { "fragmentShader":[ - "//@version 100", - " INPUT mediump vec2 vTexCoord;", - " UNIFORM sampler2D sTexture;", - " UNIFORM_BLOCK FragmentBlock", - " {", - " UNIFORM lowp vec4 uColor;", - " UNIFORM mediump vec3 uCustomPosition;", - " };", + " varying mediump vec2 vTexCoord;", + " uniform lowp vec4 uColor;", + " uniform sampler2D sTexture;", + " uniform mediump vec3 uCustomPosition;", + "", " void main()", " {", - " if( TEXTURE( sTexture, vTexCoord ).a <= 0.0001 )", + " if( texture2D( sTexture, vTexCoord ).a <= 0.0001 )", " {", " discard;", " }", "", " mediump vec2 wrapTexCoord = vec2( ( vTexCoord.x / 4.0 ) + ( uCustomPosition.x / 4.0 ) + ( uCustomPosition.z / 2.0 ), vTexCoord.y / 4.0 );", - " mediump vec4 color = TEXTURE( sTexture, wrapTexCoord );", + " mediump vec4 color = texture2D( sTexture, wrapTexCoord );", " mediump float positionWeight = ( uCustomPosition.y + 0.3 ) * color.r * 2.0;", "", " gl_FragColor = vec4( positionWeight, positionWeight, positionWeight, 0.9 ) * uColor + vec4( uColor.xyz, 0.0 );", |