diff options
author | jmm <j0064423.lee@samsung.com> | 2024-11-20 10:30:30 +0900 |
---|---|---|
committer | jmm <j0064423.lee@samsung.com> | 2024-11-20 10:30:30 +0900 |
commit | 6aab485d345a2ca984ddb4555b7ccb0e82e59a2d (patch) | |
tree | 019d0d93ca0e3d9226e18b9e936020eb972d3f7a | |
parent | 4334b1a95c795e79f4d3cf1699c301eed496c495 (diff) | |
parent | 870b5284620ab27b66dd45ccf9843bb85cfe4f8a (diff) | |
download | dali-demo-accepted/tizen_9.0_unified.tar.gz dali-demo-accepted/tizen_9.0_unified.tar.bz2 dali-demo-accepted/tizen_9.0_unified.zip |
Merge branch 'devel/master' into tizen_9.0accepted/tizen/9.0/unified/20241121.045840tizen_9.0accepted/tizen_9.0_unified
Change-Id: I7c90350e212ebf3e3e0d864f8354a36d76433536
89 files changed, 1136 insertions, 556 deletions
diff --git a/examples/animated-shapes/shaders/animated-shapes.frag b/examples/animated-shapes/shaders/animated-shapes.frag index 61276842..a5c57171 100644 --- a/examples/animated-shapes/shaders/animated-shapes.frag +++ b/examples/animated-shapes/shaders/animated-shapes.frag @@ -1,5 +1,11 @@ -uniform lowp vec4 uColor; -varying lowp vec2 vCoefficient; +//@version 100 + +UNIFORM_BLOCK VanillaFrag +{ +UNIFORM lowp vec4 uColor; +}; + +INPUT lowp vec2 vCoefficient; void main() { diff --git a/examples/animated-shapes/shaders/animated-shapes.vert b/examples/animated-shapes/shaders/animated-shapes.vert index 06e6523b..5ba6c5c3 100644 --- a/examples/animated-shapes/shaders/animated-shapes.vert +++ b/examples/animated-shapes/shaders/animated-shapes.vert @@ -1,7 +1,14 @@ -attribute mediump vec3 aCoefficient; -uniform mediump mat4 uMvpMatrix; -uniform mediump vec3 uPosition[MAX_POINT_COUNT]; -varying lowp vec2 vCoefficient; +//@version 100 + +INPUT mediump vec3 aCoefficient; + +UNIFORM_BLOCK Vanilla +{ +UNIFORM mediump mat4 uMvpMatrix; +UNIFORM mediump vec3 uPosition[MAX_POINT_COUNT]; +}; + +OUTPUT lowp vec2 vCoefficient; void main() { diff --git a/examples/bezier-curve/shaders/bezier-curve.frag b/examples/bezier-curve/shaders/bezier-curve.frag index ef6b09ed..8633599c 100644 --- a/examples/bezier-curve/shaders/bezier-curve.frag +++ b/examples/bezier-curve/shaders/bezier-curve.frag @@ -1,4 +1,5 @@ -uniform lowp vec4 uColor; +//@version 100 + void main() { diff --git a/examples/bezier-curve/shaders/bezier-curve.vert b/examples/bezier-curve/shaders/bezier-curve.vert index a108a415..1f807a54 100644 --- a/examples/bezier-curve/shaders/bezier-curve.vert +++ b/examples/bezier-curve/shaders/bezier-curve.vert @@ -1,6 +1,12 @@ -attribute mediump vec2 aPosition; -uniform mediump mat4 uMvpMatrix; -uniform vec3 uSize; +//@version 100 + +INPUT mediump vec2 aPosition; + +UNIFORM_BLOCK Vanilla +{ +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 1f7bac25..af4064f3 100644 --- a/examples/bullet-physics/shaders/rendering-textured-shape.frag +++ b/examples/bullet-physics/shaders/rendering-textured-shape.frag @@ -1,7 +1,14 @@ -uniform sampler2D uTexture; -uniform mediump float uBrightness; -varying mediump vec2 vTexCoord; -varying mediump vec3 vIllumination; +//@version 100 + +UNIFORM sampler2D uTexture; + +UNIFORM_BLOCK VanFrag +{ +UNIFORM mediump float uBrightness; +}; + +INPUT mediump vec2 vTexCoord; +INPUT mediump vec3 vIllumination; mediump vec3 redistribute_rgb(mediump vec3 color) { @@ -23,7 +30,7 @@ mediump vec3 redistribute_rgb(mediump vec3 color) void main() { - mediump vec4 texColor = texture2D( uTexture, vTexCoord ); + mediump vec4 texColor = TEXTURE( 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 02b1edbd..abad5039 100644 --- a/examples/bullet-physics/shaders/rendering-textured-shape.vert +++ b/examples/bullet-physics/shaders/rendering-textured-shape.vert @@ -1,11 +1,17 @@ -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; +//@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; void main() { diff --git a/examples/contact-cards/shaders/clipped-image.frag b/examples/contact-cards/shaders/clipped-image.frag index bde9850c..f9d80188 100644 --- a/examples/contact-cards/shaders/clipped-image.frag +++ b/examples/contact-cards/shaders/clipped-image.frag @@ -1,3 +1,5 @@ +//@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 cfe84bdd..f8c8a96e 100644 --- a/examples/contact-cards/shaders/clipped-image.vert +++ b/examples/contact-cards/shaders/clipped-image.vert @@ -1,13 +1,19 @@ +//@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. -attribute mediump vec2 aPositionCircle; -attribute mediump vec2 aPositionQuad; -uniform mediump float uDelta; -uniform mediump mat4 uMvpMatrix; -uniform mediump vec3 uSize; +INPUT mediump vec2 aPositionCircle; +INPUT mediump vec2 aPositionQuad; + +UNIFORM_BLOCK Vanilla +{ +UNIFORM mediump float uDelta; +UNIFORM mediump mat4 uMvpMatrix; +UNIFORM mediump vec3 uSize; +}; void main() { diff --git a/examples/gradients/gradients-example.cpp b/examples/gradients/gradients-example.cpp index 5d571147..c82f0c4c 100644 --- a/examples/gradients/gradients-example.cpp +++ b/examples/gradients/gradients-example.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2024 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. @@ -91,6 +91,7 @@ public: Toolkit::Alignment::HORIZONTAL_CENTER, DemoHelper::DEFAULT_MODE_SWITCH_PADDING); + mGradientControl = Control::New(); mGradientControl.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER); mGradientControl.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); @@ -105,20 +106,22 @@ public: Property::Array stopOffsets; stopOffsets.PushBack(0.0f); - stopOffsets.PushBack(0.3f); + stopOffsets.PushBack(0.2f); + stopOffsets.PushBack(0.4f); stopOffsets.PushBack(0.6f); stopOffsets.PushBack(0.8f); stopOffsets.PushBack(1.0f); mGradientMap.Insert(GradientVisual::Property::STOP_OFFSET, stopOffsets); Property::Array stopColors; - stopColors.PushBack(Vector4(129.f, 198.f, 193.f, 255.f) / 255.f); - stopColors.PushBack(Vector4(196.f, 198.f, 71.f, 122.f) / 255.f); - stopColors.PushBack(Vector4(214.f, 37.f, 139.f, 191.f) / 255.f); - stopColors.PushBack(Vector4(129.f, 198.f, 193.f, 150.f) / 255.f); + stopColors.PushBack(Color::BLUE); + stopColors.PushBack(Color::MAGENTA); + stopColors.PushBack(Color::RED); + stopColors.PushBack(Color::ORANGE); stopColors.PushBack(Color::YELLOW); - mGradientMap.Insert(GradientVisual::Property::STOP_COLOR, stopColors); + stopColors.PushBack(Color::GREEN); + mGradientMap.Insert(GradientVisual::Property::STOP_COLOR, stopColors); mGradientMap.Insert(DevelVisual::Property::CORNER_RADIUS, mRoundedCorner ? CORNER_RADIUS_VALUE : Vector4::ZERO); UpdateGradientMap(); @@ -197,6 +200,11 @@ public: { mApplication.Quit(); } + else if(event.GetKeyName() >= "1" && event.GetKeyName() <= "4") + { + mIndex = (event.GetKeyName()[0] - '0') % 4; + UpdateGradientMap(); + } } } diff --git a/examples/line-mesh/shaders/line-mesh.frag b/examples/line-mesh/shaders/line-mesh.frag index c9eeb01e..4f11e44e 100644 --- a/examples/line-mesh/shaders/line-mesh.frag +++ b/examples/line-mesh/shaders/line-mesh.frag @@ -1,7 +1,13 @@ -uniform lowp vec4 uColor; -uniform sampler2D sTexture; +//@version 100 -varying lowp vec3 vColor; +UNIFORM sampler2D sTexture; + +UNIFORM_BLOCK VanillaFrag +{ +UNIFORM lowp vec4 uColor; +}; + +INPUT lowp vec3 vColor; void main() { diff --git a/examples/line-mesh/shaders/line-mesh.vert b/examples/line-mesh/shaders/line-mesh.vert index e9ff779e..98949b86 100644 --- a/examples/line-mesh/shaders/line-mesh.vert +++ b/examples/line-mesh/shaders/line-mesh.vert @@ -1,11 +1,17 @@ -attribute mediump vec2 aPosition1; -attribute mediump vec2 aPosition2; -attribute lowp vec3 aColor; -uniform mediump mat4 uMvpMatrix; -uniform mediump vec3 uSize; -uniform mediump float uMorphAmount; +//@version 100 -varying lowp vec3 vColor; +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; void main() { diff --git a/examples/mesh-morph/shaders/mesh-morph.frag b/examples/mesh-morph/shaders/mesh-morph.frag index 93f7a013..bdd5ca04 100644 --- a/examples/mesh-morph/shaders/mesh-morph.frag +++ b/examples/mesh-morph/shaders/mesh-morph.frag @@ -1,4 +1,6 @@ -varying lowp vec4 vColor; +//@version 100 + +INPUT lowp vec4 vColor; void main() { diff --git a/examples/mesh-morph/shaders/mesh-morph.vert b/examples/mesh-morph/shaders/mesh-morph.vert index 766c88c2..222a5fd2 100644 --- a/examples/mesh-morph/shaders/mesh-morph.vert +++ b/examples/mesh-morph/shaders/mesh-morph.vert @@ -1,11 +1,18 @@ -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; +//@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; +}; void main() { diff --git a/examples/metaball-explosion/shaders/metaball-refraction.frag b/examples/metaball-explosion/shaders/metaball-refraction.frag index ad67df6d..7c3e1566 100644 --- a/examples/metaball-explosion/shaders/metaball-refraction.frag +++ b/examples/metaball-explosion/shaders/metaball-refraction.frag @@ -1,10 +1,18 @@ +//@version 100 + //Fragment shader code for metaball and background composition with refraction effect precision highp float; -varying vec2 vTexCoord; -uniform sampler2D sTexture; -uniform sampler2D sEffect; -uniform vec2 uPositionMetaball; +INPUT vec2 vTexCoord; + +UNIFORM sampler2D sTexture; +UNIFORM sampler2D sEffect; + +UNIFORM_BLOCK VanillaFrag +{ +UNIFORM vec2 uPositionMetaball; +}; + void main() { vec2 zoomCoords; @@ -13,7 +21,7 @@ void main() vec3 color = vec3(1.0, 1.0, 1.0); float ambient = 0.2; - vec4 metaColor = texture2D(sEffect, vTexCoord); + vec4 metaColor = TEXTURE(sEffect, vTexCoord); vec2 adjustedCoords = vTexCoord.xy * vec2(2.0) - vec2(1.0); fakePos = adjustedCoords.xy - vec2(uPositionMetaball.x, -uPositionMetaball.y); @@ -65,7 +73,7 @@ void main() float specularFactor = max(0.0,dot(vertexToEye, lightReflect)); specularFactor = pow(specularFactor, 32.0) * 0.7; - vec4 texColor = texture2D(sTexture, zoomCoords); + vec4 texColor = TEXTURE(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 8411a181..095eceb6 100644 --- a/examples/metaball-explosion/shaders/metaball.frag +++ b/examples/metaball-explosion/shaders/metaball.frag @@ -1,12 +1,19 @@ +//@version 100 + // Fragment shader code for metaball precision mediump float; -varying vec2 vTexCoord; -uniform vec2 uPositionMetaball; -uniform vec2 uPositionVar; -uniform vec2 uGravityVector; -uniform float uRadius; -uniform float uRadiusVar; + +INPUT vec2 vTexCoord; + +UNIFORM_BLOCK VanillaFrag +{ +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 911e77ac..6f6dd4b1 100644 --- a/examples/metaball-explosion/shaders/metaball.vert +++ b/examples/metaball-explosion/shaders/metaball.vert @@ -1,11 +1,18 @@ +//@version 100 + //Vertex shader code for metaball -attribute mediump vec2 aPosition; -attribute mediump vec2 aTexture; -uniform mediump mat4 uMvpMatrix; -uniform mediump vec3 uSize; -uniform lowp vec4 uColor; -varying mediump vec2 vTexCoord; +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; +}; void main() { diff --git a/examples/metaball-refrac/shaders/fragment.frag b/examples/metaball-refrac/shaders/fragment.frag index 1878397b..df97aeea 100644 --- a/examples/metaball-refrac/shaders/fragment.frag +++ b/examples/metaball-refrac/shaders/fragment.frag @@ -1,10 +1,13 @@ +//@version 100 + // Fragment shader code when there's no effect precision mediump float; -varying vec2 vTexCoord; -uniform sampler2D sTexture; + +INPUT vec2 vTexCoord; +UNIFORM sampler2D sTexture; void main() { - gl_FragColor = texture2D(sTexture, vTexCoord); + gl_FragColor = TEXTURE(sTexture, vTexCoord); } diff --git a/examples/metaball-refrac/shaders/metaball-refraction.frag b/examples/metaball-refrac/shaders/metaball-refraction.frag index e84f3ea5..718ffa2f 100644 --- a/examples/metaball-refrac/shaders/metaball-refraction.frag +++ b/examples/metaball-refrac/shaders/metaball-refraction.frag @@ -1,13 +1,15 @@ +//@version 100 // Fragment shader code for metaball and background composition with refraction effect precision mediump float; -varying vec2 vTexCoord; -uniform sampler2D sTexture; -uniform sampler2D sEffect; +INPUT vec2 vTexCoord; + +UNIFORM sampler2D sTexture; +UNIFORM sampler2D sEffect; void main() { - vec4 metaColor = texture2D(sEffect, vTexCoord); + vec4 metaColor = TEXTURE(sEffect, vTexCoord); vec2 zoomCoords; float bright = 1.0; if (metaColor.r > 0.85) @@ -25,5 +27,5 @@ void main() zoomCoords = vTexCoord; } - gl_FragColor = texture2D(sTexture, zoomCoords) * bright; + gl_FragColor = TEXTURE(sTexture, zoomCoords) * bright; } diff --git a/examples/metaball-refrac/shaders/metaball.frag b/examples/metaball-refrac/shaders/metaball.frag index ed877673..2fdc2697 100644 --- a/examples/metaball-refrac/shaders/metaball.frag +++ b/examples/metaball-refrac/shaders/metaball.frag @@ -1,13 +1,19 @@ +//@version 100 + // Fragment shader for metaballs precision mediump float; -varying vec2 vTexCoord; -uniform vec2 uPositionMetaball; -uniform vec2 uPositionVar; -uniform vec2 uGravityVector; -uniform float uRadius; -uniform float uRadiusVar; -uniform float uAspect; +INPUT vec2 vTexCoord; + +UNIFORM_BLOCK VanillaFrag +{ +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 370d8702..fd002d96 100644 --- a/examples/metaball-refrac/shaders/metaball.vert +++ b/examples/metaball-refrac/shaders/metaball.vert @@ -1,11 +1,16 @@ +//@version 100 // Vertex shader for metaballs -attribute mediump vec2 aPosition; -attribute mediump vec2 aTexture; -uniform mediump mat4 uMvpMatrix; -uniform mediump vec3 uSize; -uniform lowp vec4 uColor; -varying mediump vec2 vTexCoord; +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; +}; void main() { diff --git a/examples/particles/shaders/particle-view-simple.frag b/examples/particles/shaders/particle-view-simple.frag index 942a401c..457c31b6 100644 --- a/examples/particles/shaders/particle-view-simple.frag +++ b/examples/particles/shaders/particle-view-simple.frag @@ -1,11 +1,15 @@ -#version 300 es +//@version 100 + // Shader for an unlit, unfogged, textured mesh. precision mediump float; -uniform vec4 uColor; -out vec4 oFragColor; + +UNIFORM_BLOCK VanillaFrag +{ +UNIFORM vec4 uColor; +}; void main() { - oFragColor = uColor; + gl_FragColor = uColor; } diff --git a/examples/particles/shaders/particle-view-simple.vert b/examples/particles/shaders/particle-view-simple.vert index 59238621..dc472ba1 100644 --- a/examples/particles/shaders/particle-view-simple.vert +++ b/examples/particles/shaders/particle-view-simple.vert @@ -1,12 +1,18 @@ -#version 300 es +//@version 100 + // Shader for simple textured geometry. precision mediump float; -uniform mat4 uMvpMatrix;//by DALi -uniform vec3 uSize; // by DALi -in vec3 aPosition; + +UNIFORM_BLOCK VertexBlock +{ + UNIFORM mat4 uMvpMatrix; //by DALi + UNIFORM vec3 uSize; // by DALi +}; + +INPUT vec3 aPosition; void main() { - gl_Position = uMvpMatrix * vec4(aPosition * uSize, 1.f); + gl_Position = uMvpMatrix * vec4(aPosition * uSize, 1.0); } diff --git a/examples/particles/shaders/particle-view.frag b/examples/particles/shaders/particle-view.frag index 293487c3..c1c97ccc 100644 --- a/examples/particles/shaders/particle-view.frag +++ b/examples/particles/shaders/particle-view.frag @@ -1,16 +1,21 @@ -#version 300 es +//@version 100 + // Fragment shader for particles, which simulates depth of field using // a combination of procedural texturing, alpha testing and alpha blending. precision lowp float; -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; + +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; const float REF_VALUE_THRESHOLD = 1. / 64.; @@ -35,5 +40,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); - oFragColor = vec4(vColor, alpha); + gl_FragColor = vec4(vColor, alpha); } diff --git a/examples/particles/shaders/particle-view.vert b/examples/particles/shaders/particle-view.vert index 33cc108a..d1b301d3 100644 --- a/examples/particles/shaders/particle-view.vert +++ b/examples/particles/shaders/particle-view.vert @@ -1,22 +1,29 @@ -#version 300 es +//@version 100 + // Shader for billboarded particles, where the vertices of the particles // are supplied as vec3 position (particle position) + vec2 sub-position. precision lowp float; -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; +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; +}; struct Scatter { @@ -26,22 +33,29 @@ struct Scatter }; const int SCATTER_VARS = 6; // Must match ParticleView::mScatterProps' size. -uniform Scatter uScatter[SCATTER_VARS]; + +UNIFORM_BLOCK ScatterBlock +{ +UNIFORM Scatter uScatter[SCATTER_VARS]; +}; const int POPULATION_GRANULARITY = 128; -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 +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 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 f9eba48f..a3f24dd3 100644 --- a/examples/perf-scroll/shaders/perf-scroll.frag +++ b/examples/perf-scroll/shaders/perf-scroll.frag @@ -1,8 +1,14 @@ -uniform lowp vec4 uColor; -uniform sampler2D sTexture; -varying mediump vec2 vTexCoord; +//@version 100 + +UNIFORM_BLOCK VanillaFrag +{ +UNIFORM lowp vec4 uColor; +} +UNIFORM sampler2D sTexture; + +INPUT mediump vec2 vTexCoord; void main() { - gl_FragColor = texture2D( sTexture, vTexCoord ) * uColor; + gl_FragColor = TEXTURE( sTexture, vTexCoord ) * uColor; } diff --git a/examples/perf-scroll/shaders/perf-scroll.vert b/examples/perf-scroll/shaders/perf-scroll.vert index 3cb2121b..643d96c8 100644 --- a/examples/perf-scroll/shaders/perf-scroll.vert +++ b/examples/perf-scroll/shaders/perf-scroll.vert @@ -1,8 +1,14 @@ -attribute mediump vec2 aPosition; -attribute mediump vec2 aTexCoord; -uniform mediump mat4 uMvpMatrix; -uniform mediump vec3 uSize; -varying mediump vec2 vTexCoord; +//@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; +}; void main() { diff --git a/examples/point-mesh/shaders/point-mesh.frag b/examples/point-mesh/shaders/point-mesh.frag index 51be2396..08eb6021 100644 --- a/examples/point-mesh/shaders/point-mesh.frag +++ b/examples/point-mesh/shaders/point-mesh.frag @@ -1,13 +1,20 @@ -varying mediump vec3 vVertexColor; -varying mediump float vHue; -uniform lowp vec4 uColor; -uniform sampler2D sTexture1; -uniform sampler2D sTexture2; -uniform lowp vec4 uFadeColor; +//@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; +}; void main() { - mediump vec4 texCol1 = texture2D(sTexture1, gl_PointCoord); - mediump vec4 texCol2 = texture2D(sTexture2, gl_PointCoord); + mediump vec4 texCol1 = TEXTURE(sTexture1, gl_PointCoord); + mediump vec4 texCol2 = TEXTURE(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 6afbdb4a..4c129ee8 100644 --- a/examples/point-mesh/shaders/point-mesh.vert +++ b/examples/point-mesh/shaders/point-mesh.vert @@ -1,12 +1,21 @@ -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; +//@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; +}; vec3 hsv2rgb(vec3 c) { diff --git a/examples/reflection-demo/reflection-example.cpp b/examples/reflection-demo/reflection-example.cpp index 77318180..68b5691d 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] == '/') + if(vsh[0] == '/' && vsh[1] != '/') { 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] == '/') + if(fsh[0] == '/' && fsh[1] != '/') { 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 47b0055c..15bf7aac 100644 --- a/examples/reflection-demo/shaders/reflection-plasma.frag +++ b/examples/reflection-demo/shaders/reflection-plasma.frag @@ -1,13 +1,20 @@ +//@version 100 + precision mediump float; -uniform sampler2D sTexture; -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; +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; void main() { @@ -26,5 +33,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 = (texture2D(sTexture, vTexCoord)) * (((col.r+col.g+col.b)/3.0)+1.0+intensity); + gl_FragColor = (TEXTURE(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 1c813ae1..4c59193f 100644 --- a/examples/reflection-demo/shaders/reflection-simple.frag +++ b/examples/reflection-demo/shaders/reflection-simple.frag @@ -1,10 +1,17 @@ -uniform lowp vec4 uColor; -uniform sampler2D sTexture; -varying mediump vec3 vNormal; -varying mediump vec3 vPosition; -varying mediump vec2 vTexCoord; +//@version 100 + +UNIFORM_BLOCK VanillaFrag +{ +UNIFORM lowp vec4 uColor; +}; + +UNIFORM sampler2D sTexture; + +INPUT mediump vec3 vNormal; +INPUT mediump vec3 vPosition; +INPUT mediump vec2 vTexCoord; void main() { - gl_FragColor = texture2D(sTexture, vTexCoord) * 2.0; + gl_FragColor = TEXTURE(sTexture, vTexCoord) * 2.0; } diff --git a/examples/reflection-demo/shaders/reflection-tex.frag b/examples/reflection-demo/shaders/reflection-tex.frag index 8f792cc3..0d17642c 100644 --- a/examples/reflection-demo/shaders/reflection-tex.frag +++ b/examples/reflection-demo/shaders/reflection-tex.frag @@ -1,12 +1,19 @@ -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; +//@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; mediump float rand(mediump vec2 co) { @@ -22,6 +29,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 = ((texture2D(sTexture0, vTexCoord) * factor ) + - (texture2D(sTexture1, uv))) * intensity; + gl_FragColor = ((TEXTURE(sTexture0, vTexCoord) * factor ) + + (TEXTURE(sTexture1, uv))) * intensity; } diff --git a/examples/reflection-demo/shaders/reflection-textured.frag b/examples/reflection-demo/shaders/reflection-textured.frag index 8eb60617..1c3962e8 100644 --- a/examples/reflection-demo/shaders/reflection-textured.frag +++ b/examples/reflection-demo/shaders/reflection-textured.frag @@ -1,13 +1,18 @@ -uniform lowp vec4 uColor; -uniform sampler2D sTexture; -uniform mediump vec2 uScreenSize; +//@version 100 -uniform mediump vec3 eyePos; -uniform mediump vec3 lightDir; +UNIFORM sampler2D sTexture; -varying mediump vec3 vNormal; -varying mediump vec3 vPosition; -varying mediump vec2 vTexCoord; +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; void main() { @@ -15,5 +20,5 @@ void main() mediump vec3 l = normalize( lightDir ); mediump vec3 e = normalize( eyePos ); mediump float intensity = max(dot(n,l), 0.0); - gl_FragColor = texture2D(sTexture, vTexCoord) * intensity; + gl_FragColor = TEXTURE(sTexture, vTexCoord) * intensity; } diff --git a/examples/reflection-demo/shaders/reflection.frag b/examples/reflection-demo/shaders/reflection.frag index 55060a84..44a0902e 100644 --- a/examples/reflection-demo/shaders/reflection.frag +++ b/examples/reflection-demo/shaders/reflection.frag @@ -1,10 +1,17 @@ -uniform lowp vec4 uColor; -uniform sampler2D sTexture; -varying mediump vec3 vNormal; -varying mediump vec3 vPosition; -varying mediump vec2 vTexCoord; +//@version 100 + +UNIFORM_BLOCK VanillaFrag +{ +UNIFORM lowp vec4 uColor; +}; + +UNIFORM sampler2D sTexture; + +INPUT mediump vec3 vNormal; +INPUT mediump vec3 vPosition; +INPUT mediump vec2 vTexCoord; void main() { - gl_FragColor = texture2D(sTexture, vTexCoord) * 50.0; + gl_FragColor = TEXTURE(sTexture, vTexCoord) * 50.0; } diff --git a/examples/reflection-demo/shaders/reflection.vert b/examples/reflection-demo/shaders/reflection.vert index 872da7d4..67136505 100644 --- a/examples/reflection-demo/shaders/reflection.vert +++ b/examples/reflection-demo/shaders/reflection.vert @@ -1,13 +1,19 @@ -attribute mediump vec3 aPosition; -attribute mediump vec3 aNormal; -attribute mediump vec2 aTexCoord; -uniform mediump mat4 uMvpMatrix; -uniform mediump mat3 uNormalMatrix; -uniform mediump vec3 uSize; +//@version 100 -varying mediump vec2 vTexCoord; -varying mediump vec3 vNormal; -varying mediump vec3 vPosition; +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; void main() { diff --git a/examples/refraction-effect/shaders/refraction-effect-flat.frag b/examples/refraction-effect/shaders/refraction-effect-flat.frag index f9eba48f..98aaa08d 100644 --- a/examples/refraction-effect/shaders/refraction-effect-flat.frag +++ b/examples/refraction-effect/shaders/refraction-effect-flat.frag @@ -1,8 +1,15 @@ -uniform lowp vec4 uColor; -uniform sampler2D sTexture; -varying mediump vec2 vTexCoord; +//@version 100 + +UNIFORM_BLOCK VanillaFrag +{ +UNIFORM lowp vec4 uColor; +}; + +UNIFORM sampler2D sTexture; + +INPUT mediump vec2 vTexCoord; void main() { - gl_FragColor = texture2D( sTexture, vTexCoord ) * uColor; + gl_FragColor = TEXTURE( sTexture, vTexCoord ) * uColor; } diff --git a/examples/refraction-effect/shaders/refraction-effect-flat.vert b/examples/refraction-effect/shaders/refraction-effect-flat.vert index fc35d09d..148f9417 100644 --- a/examples/refraction-effect/shaders/refraction-effect-flat.vert +++ b/examples/refraction-effect/shaders/refraction-effect-flat.vert @@ -1,10 +1,16 @@ +//@version 100 + // The shader source is used when the MeshActor is not touched -attribute mediump vec3 aPosition; -attribute mediump vec3 aNormal; -attribute highp vec2 aTexCoord; -uniform mediump mat4 uMvpMatrix; -varying mediump vec2 vTexCoord; +INPUT mediump vec3 aPosition; +INPUT mediump vec3 aNormal; +INPUT highp vec2 aTexCoord; +UNIFORM_BLOCK Vanilla +{ +UNIFORM mediump mat4 uMvpMatrix; +}; + +OUTPUT 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 8fcf92d1..b3cf5a9d 100644 --- a/examples/refraction-effect/shaders/refraction-effect-refraction.frag +++ b/examples/refraction-effect/shaders/refraction-effect-refraction.frag @@ -1,15 +1,22 @@ +//@version 100 + precision mediump float; -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; +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; vec3 rgb2hsl(vec3 rgb) { @@ -49,7 +56,7 @@ void main() spotEffect = spotEffect * uEffectStrength; mediump float lightDiffuse = ( ( dot( vecToLight, normal )-0.75 ) *uLightIntensity ) * spotEffect; - lowp vec4 color = texture2D( sTexture, vTexCoord + vTextureOffset * spotEffect ); + lowp vec4 color = TEXTURE( 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 00611230..52b5368f 100644 --- a/examples/refraction-effect/shaders/refraction-effect-refraction.vert +++ b/examples/refraction-effect/shaders/refraction-effect-refraction.vert @@ -1,11 +1,18 @@ -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; +//@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; void main() { diff --git a/examples/remote-image-loading/remote-image-loading-example.cpp b/examples/remote-image-loading/remote-image-loading-example.cpp index 63f5d161..ee94370e 100644 --- a/examples/remote-image-loading/remote-image-loading-example.cpp +++ b/examples/remote-image-loading/remote-image-loading-example.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Samsung Electronics Co., Ltd. + * Copyright (c) 2024 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. @@ -69,17 +69,17 @@ public: rubric.SetProperty(Actor::Property::ANCHOR_POINT, ParentOrigin::TOP_CENTER); mWindow.Add(rubric); - mImageView1 = Toolkit::ImageView::New("http://static.midomi.com/s/s/images/000/000/000/000/293/259/19/520_000000000000293259191500x1500_72dpi_RGB_q70.jpg"); + mImageView1 = Toolkit::ImageView::New("https://raw.githubusercontent.com/dalihub/dali-test/refs/heads/master/visual-tests/remote-download/images/rockstar.jpg"); mImageView1.SetProperty(Dali::Actor::Property::NAME, "mImageView1"); mImageView1.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT); mImageView1.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_CENTER); mImageView1.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false); - mImageView1.SetProperty(Actor::Property::POSITION, Vector2(0, 100)); + mImageView1.SetProperty(Actor::Property::POSITION, Vector2(0, 50)); mImageView1.SetBackgroundColor(Vector4(0.0f, 0.0f, 0.0f, 0.0f)); mWindow.Add(mImageView1); - mImageView2 = Toolkit::ImageView::New("http://static.midomi.com/s/s/images/000/000/000/000/212/651/88/520_000000000000212651881500x1500_72dpi_RGB_q70.jpg"); + mImageView2 = Toolkit::ImageView::New("https://raw.githubusercontent.com/dalihub/dali-test/refs/heads/master/visual-tests/remote-download/images/stars.jpg"); mImageView2.SetProperty(Dali::Actor::Property::NAME, "mImageView2"); mImageView2.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT); mImageView2.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_CENTER); @@ -88,7 +88,7 @@ public: mImageView2.SetBackgroundColor(Vector4(0.0f, 0.0f, 0.0f, 0.0f)); mWindow.Add(mImageView2); - mImageView3 = Toolkit::ImageView::New("http://static.midomi.com/s/s/images/000/000/000/000/212/353/21/520_000000000000212353211500x1500_72dpi_RGB_q70.jpg"); + mImageView3 = Toolkit::ImageView::New("https://raw.githubusercontent.com/dalihub/dali-test/refs/heads/master/visual-tests/remote-download/images/stormtrooper.jpg"); mImageView3.SetProperty(Dali::Actor::Property::NAME, "mImageView3"); mImageView3.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT); mImageView3.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_CENTER); @@ -97,15 +97,6 @@ public: mImageView3.SetBackgroundColor(Vector4(0.0f, 0.0f, 0.0f, 0.0f)); mWindow.Add(mImageView3); - mImageView4 = Toolkit::ImageView::New("http://d2k43l0oslhof9.cloudfront.net/platform/image/contents/vc/20/01/58/20170629100630071189_0bf6b911-a847-cba4-e518-be40fe2f579420170629192203240.jpg"); - mImageView4.SetProperty(Dali::Actor::Property::NAME, "mImageView4"); - mImageView4.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT); - mImageView4.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_CENTER); - mImageView4.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false); - mImageView4.SetProperty(Actor::Property::POSITION, Vector2(400, 400)); - mImageView4.SetBackgroundColor(Vector4(0.0f, 0.0f, 0.0f, 0.0f)); - mWindow.Add(mImageView4); - mImageView5 = Toolkit::ImageView::New("http://static.midomi.com/h/images/w/weather_sunny.png"); mImageView5.SetProperty(Dali::Actor::Property::NAME, "mImageView5"); mImageView5.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT); diff --git a/examples/render-effects/render-effects-example.cpp b/examples/render-effects/render-effects-example.cpp index 91ffa2e1..d538ffe8 100644 --- a/examples/render-effects/render-effects-example.cpp +++ b/examples/render-effects/render-effects-example.cpp @@ -18,8 +18,9 @@ #include <dali-toolkit/dali-toolkit.h> #include <dali/dali.h> -#include <devel-api/actors/actor-devel.h> -#include <public-api/events/key-event.h> +#include <dali/devel-api/actors/actor-devel.h> +#include <dali/integration-api/debug.h> +#include <dali/public-api/events/key-event.h> #include <dali-toolkit/devel-api/controls/table-view/table-view.h> #include <dali-toolkit/devel-api/visuals/image-visual-properties-devel.h> @@ -33,6 +34,9 @@ namespace { const char* BACKGROUND_IMAGE(DEMO_IMAGE_DIR "background-3.jpg"); const char* SUN_CLOUD_ICON_IMAGE(DEMO_IMAGE_DIR "light-icon-front.png"); + +constexpr float unitSizeWidth = 180.0f; +constexpr float unitSizeHeight = 180.0f; } // namespace class RenderEffectController : public Dali::ConnectionTracker @@ -50,32 +54,39 @@ public: void Create(Dali::Application& application) { - Window window = application.GetWindow(); - Layer backgroundLayer = Layer::New(); - - Vector2 size = window.GetSize(); + window = application.GetWindow(); // Background image { + backgroundLayer = Layer::New(); backgroundLayer.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); - backgroundLayer.SetProperty(Actor::Property::SIZE, size); + backgroundLayer.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, ResizePolicy::FILL_TO_PARENT); + backgroundLayer.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, ResizePolicy::FILL_TO_PARENT); Toolkit::ImageView backgroundImage = Toolkit::ImageView::New(BACKGROUND_IMAGE); - backgroundImage.SetProperty(Actor::Property::SIZE, size); backgroundImage.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); + backgroundImage.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, ResizePolicy::FILL_TO_PARENT); + backgroundImage.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, ResizePolicy::FILL_TO_PARENT); backgroundLayer.Add(backgroundImage); window.Add(backgroundLayer); } + { + pannelLayer = Layer::New(); + pannelLayer.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); + pannelLayer.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, ResizePolicy::FILL_TO_PARENT); + pannelLayer.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, ResizePolicy::FILL_TO_PARENT); - // UI panel - float unitSizeWidth = 180.0f; - float unitSizeHeight = 180.0f; + window.Add(pannelLayer); + } + + Vector2 size = window.GetSize(); - Toolkit::Control UIPanel = Toolkit::Control::New(); + // UI panel + UIPanel = Toolkit::Control::New(); UIPanel.SetProperty(Actor::Property::SIZE, size * 0.8f); UIPanel.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); - window.Add(UIPanel); - UIPanel.SetRenderEffect(Toolkit::BackgroundBlurEffect::New(0.4f, 40)); + pannelLayer.Add(UIPanel); + UIPanel.SetRenderEffect(Toolkit::BackgroundBlurEffect::New(1.0f, flexableRadius)); // Welcome message { @@ -92,6 +103,7 @@ public: weatherPanel.SetProperty(Actor::Property::SIZE, Vector2(unitSizeWidth * 2.0f, unitSizeHeight + 10.0f)); weatherPanel.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_CENTER); weatherPanel.SetProperty(Actor::Property::POSITION, Vector2(0, size.y * 0.15f)); + weatherPanel.SetProperty(Actor::Property::NAME, "Weather"); Property::Map colorVisualPropertyMap; colorVisualPropertyMap.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR); @@ -138,33 +150,36 @@ public: // Icon mini panels { Vector2 iconPanelSize = Vector2(unitSizeWidth, unitSizeHeight); - float x_incrementer = iconPanelSize.x / 2.0f + 10.0f; - float y_incrementer = iconPanelSize.y + 20.f; - float y_starter = size.y * .33f; + float xIncrementer = iconPanelSize.x / 2.0f + 10.0f; + float yIncrementer = iconPanelSize.y + 20.f; + float yStarter = size.y * .33f; Toolkit::Control control = CreateIconPanel("Security", "4 rooms", false, DEMO_IMAGE_DIR "application-icon-7.png", iconPanelSize); - control.SetProperty(Actor::Property::POSITION, Vector2(-x_incrementer, y_starter)); + control.SetProperty(Actor::Property::POSITION, Vector2(-xIncrementer, yStarter)); control.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_CENTER); UIPanel.Add(control); control.SetRenderEffect(Toolkit::BackgroundBlurEffect::New(0.4f, 40)); control = CreateIconPanel("BlueTooth", "2 devices", true, DEMO_IMAGE_DIR "application-icon-14.png", iconPanelSize); - control.SetProperty(Actor::Property::POSITION, Vector2(x_incrementer, y_starter)); + control.SetProperty(Actor::Property::POSITION, Vector2(xIncrementer, yStarter)); control.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_CENTER); UIPanel.Add(control); control.SetRenderEffect(Toolkit::BackgroundBlurEffect::New(0.4f, 40)); control = CreateIconPanel("Wi-Fi", "TizenUIFW", true, DEMO_IMAGE_DIR "application-icon-55.png", iconPanelSize); - control.SetProperty(Actor::Property::POSITION, Vector2(-x_incrementer, y_starter + y_incrementer)); + control.SetProperty(Actor::Property::POSITION, Vector2(-xIncrementer, yStarter + yIncrementer)); control.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_CENTER); UIPanel.Add(control); control.SetRenderEffect(Toolkit::BackgroundBlurEffect::New(0.4f, 40)); control = CreateIconPanel("Lighting", "5 devices", true, DEMO_IMAGE_DIR "application-icon-21.png", iconPanelSize); - control.SetProperty(Actor::Property::POSITION, Vector2(x_incrementer, y_starter + y_incrementer)); + control.SetProperty(Actor::Property::POSITION, Vector2(xIncrementer, yStarter + yIncrementer)); control.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_CENTER); UIPanel.Add(control); control.SetRenderEffect(Toolkit::BackgroundBlurEffect::New(0.4f, 40)); + + // Keep one of control to test visible option change. + mVisibilityChangedControl = control; } // Air conditioner @@ -174,6 +189,7 @@ public: airConPanel.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_CENTER); airConPanel.SetProperty(Actor::Property::POSITION_Y, -unitSizeHeight + 20.0f); airConPanel.SetProperty(DevelActor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN); + airConPanel.SetProperty(Actor::Property::NAME, "Air Conditioner"); Toolkit::TextLabel label = SetUpTextLabelProperties("Air Conditioner", Color::WHITE, "BEGIN", 15.0f); label.SetProperty(Actor::Property::SIZE_WIDTH, unitSizeWidth * 2.0f - 50.0f); @@ -220,13 +236,15 @@ public: backgroundLayer.LowerBelow(window.GetRootLayer()); // Connect signals - application.GetWindow().KeyEventSignal().Connect(this, &RenderEffectController::OnKeyEvent); + window.KeyEventSignal().Connect(this, &RenderEffectController::OnKeyEvent); + window.ResizeSignal().Connect(this, &RenderEffectController::OnWindowResized); } Toolkit::Control CreateIconPanel(std::string title, std::string detail, bool isOn, std::string iconURL, Vector2 size) { Toolkit::Control panel = Toolkit::Control::New(); panel.SetProperty(Actor::Property::SIZE, size); + panel.SetProperty(Actor::Property::NAME, title); Property::Map colorVisualPropertyMap; colorVisualPropertyMap.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR); @@ -280,6 +298,41 @@ public: return label; } + void OnWindowResized(Dali::Window windowHandle, Dali::Window::WindowSize windowSize) + { + DALI_LOG_RELEASE_INFO("Resize finish / %d x %d\n", windowSize.GetWidth(), windowSize.GetHeight()); + Vector2 size = Vector2(windowSize.GetWidth(), windowSize.GetHeight()); // Get new size + + // Change some window size relative properties. + UIPanel.SetProperty(Actor::Property::SIZE, size * 0.8f); + + // Weather panel + { + Actor childPannel; + childPannel = UIPanel.FindChildByName("Weather"); + childPannel.SetProperty(Actor::Property::POSITION_Y, size.y * 0.15f); + } + + // Mini pannel + { + float yIncrementer = unitSizeHeight + 20.f; + float yStarter = size.y * .33f; + + Actor childPannel; + childPannel = UIPanel.FindChildByName("Security"); + childPannel.SetProperty(Actor::Property::POSITION_Y, yStarter); + + childPannel = UIPanel.FindChildByName("BlueTooth"); + childPannel.SetProperty(Actor::Property::POSITION_Y, yStarter); + + childPannel = UIPanel.FindChildByName("Wi-Fi"); + childPannel.SetProperty(Actor::Property::POSITION_Y, yStarter + yIncrementer); + + childPannel = UIPanel.FindChildByName("Lighting"); + childPannel.SetProperty(Actor::Property::POSITION_Y, yStarter + yIncrementer); + } + } + void OnKeyEvent(const KeyEvent& event) { if(event.GetState() == KeyEvent::DOWN) @@ -288,11 +341,62 @@ public: { mApplication.Quit(); } + else if(event.GetKeyName() == "1") + { + if(UIPanel) + { + if(UIPanel.GetProperty<bool>(Actor::Property::CONNECTED_TO_SCENE)) + { + UIPanel.Unparent(); + } + else + { + pannelLayer.Add(UIPanel); + } + } + } + else if(event.GetKeyName() == "2") + { + if(mVisibilityChangedControl) + { + mVisibilityChangedControl.SetProperty(Actor::Property::VISIBLE, !mVisibilityChangedControl.GetProperty<bool>(Actor::Property::VISIBLE)); + } + } + else if(event.GetKeyName() == "3") + { + if(flexableRadius >= 10) + { + flexableRadius -= 10; + if(UIPanel) + { + UIPanel.SetRenderEffect(Toolkit::BackgroundBlurEffect::New(1.0f, flexableRadius)); + } + } + } + else if(event.GetKeyName() == "4") + { + if(flexableRadius < 1000) + { + flexableRadius += 10; + if(UIPanel) + { + UIPanel.SetRenderEffect(Toolkit::BackgroundBlurEffect::New(1.0f, flexableRadius)); + } + } + } } } private: Application& mApplication; + + Window window; + Layer backgroundLayer; + Layer pannelLayer; + + Toolkit::Control UIPanel; + Toolkit::Control mVisibilityChangedControl; + uint32_t flexableRadius{40}; }; int DALI_EXPORT_API main(int argc, char** argv) diff --git a/examples/renderer-stencil/shaders/render-stencil-textured.frag b/examples/renderer-stencil/shaders/render-stencil-textured.frag index 27c63e5c..b6b7d36e 100644 --- a/examples/renderer-stencil/shaders/render-stencil-textured.frag +++ b/examples/renderer-stencil/shaders/render-stencil-textured.frag @@ -1,9 +1,15 @@ -varying mediump vec2 vTexCoord; -varying mediump vec3 vIllumination; -uniform lowp vec4 uColor; -uniform sampler2D sTexture; +//@version 100 + +INPUT mediump vec2 vTexCoord; +INPUT mediump vec3 vIllumination; +UNIFORM_BLOCK Color +{ + UNIFORM lowp vec4 uColor; +}; + +UNIFORM sampler2D sTexture; void main() { - gl_FragColor = vec4( texture2D( sTexture, vTexCoord ).rgb * vIllumination.rgb * uColor.rgb, uColor.a ); -} + gl_FragColor = vec4( TEXTURE( sTexture, vTexCoord ).rgb * vIllumination.rgb * uColor.rgb, uColor.a ); +}
\ No newline at end of file diff --git a/examples/renderer-stencil/shaders/render-stencil-textured.vert b/examples/renderer-stencil/shaders/render-stencil-textured.vert index 7dd59185..629da946 100644 --- a/examples/renderer-stencil/shaders/render-stencil-textured.vert +++ b/examples/renderer-stencil/shaders/render-stencil-textured.vert @@ -1,18 +1,24 @@ +//@version 100 + // Shader for basic, per-vertex lighting with texture (vertex): -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; +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; +}; void main() { diff --git a/examples/renderer-stencil/shaders/render-stencil.frag b/examples/renderer-stencil/shaders/render-stencil.frag index 12dd2a91..36b924a2 100644 --- a/examples/renderer-stencil/shaders/render-stencil.frag +++ b/examples/renderer-stencil/shaders/render-stencil.frag @@ -1,7 +1,14 @@ -varying mediump vec2 vTexCoord; -varying mediump vec3 vIllumination; -uniform lowp vec4 uColor; -uniform sampler2D sTexture; +//@version 100 + +INPUT mediump vec2 vTexCoord; +INPUT mediump vec3 vIllumination; + +UNIFORM_BLOCK color +{ + 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 06270a9c..a48673a2 100644 --- a/examples/renderer-stencil/shaders/render-stencil.vert +++ b/examples/renderer-stencil/shaders/render-stencil.vert @@ -1,18 +1,24 @@ +//@version 100 + // Shader for basic, per-vertex lighting (vertex): -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; +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; +}; 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 6f561531..ce202e32 100644 --- a/examples/rendering-basic-light/shaders/rendering-basic-light.frag +++ b/examples/rendering-basic-light/shaders/rendering-basic-light.frag @@ -1,6 +1,7 @@ -varying mediump vec3 vNormal; -varying mediump vec3 vFragPos; -uniform mediump vec3 viewPos; // custom uniform +//@version 100 + +INPUT mediump vec3 vNormal; +INPUT mediump vec3 vFragPos; struct Material { @@ -16,8 +17,12 @@ struct Light mediump vec3 color; }; -uniform Material material; // custom uniform -uniform Light light; // custom uniform +UNIFORM_BLOCK CustomFrag +{ +UNIFORM mediump vec3 viewPos; // 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 bc5c85af..d39ec461 100644 --- a/examples/rendering-basic-light/shaders/rendering-basic-light.vert +++ b/examples/rendering-basic-light/shaders/rendering-basic-light.vert @@ -1,12 +1,18 @@ -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 +//@version 100 -varying mediump vec3 vNormal; -varying mediump vec3 vFragPos; +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; void main() { diff --git a/examples/rendering-cube/shaders/rendering-cube.frag b/examples/rendering-cube/shaders/rendering-cube.frag index 1f8954ad..67a08ab3 100644 --- a/examples/rendering-cube/shaders/rendering-cube.frag +++ b/examples/rendering-cube/shaders/rendering-cube.frag @@ -1,4 +1,6 @@ -varying mediump vec4 vColor; +//@version 100 + +INPUT mediump vec4 vColor; void main() { diff --git a/examples/rendering-cube/shaders/rendering-cube.vert b/examples/rendering-cube/shaders/rendering-cube.vert index d4a0b5c8..5c793742 100644 --- a/examples/rendering-cube/shaders/rendering-cube.vert +++ b/examples/rendering-cube/shaders/rendering-cube.vert @@ -1,9 +1,15 @@ -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 +//@version 100 -varying mediump vec4 vColor; +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; void main() { diff --git a/examples/rendering-line/shaders/rendering-line.frag b/examples/rendering-line/shaders/rendering-line.frag index b8d9d3ab..1456e4b1 100644 --- a/examples/rendering-line/shaders/rendering-line.frag +++ b/examples/rendering-line/shaders/rendering-line.frag @@ -1,4 +1,9 @@ -uniform mediump vec4 uColor; +//@version 100 + +UNIFORM_BLOCK Custom +{ +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 53f4a4f7..f70dabeb 100644 --- a/examples/rendering-line/shaders/rendering-line.vert +++ b/examples/rendering-line/shaders/rendering-line.vert @@ -1,6 +1,12 @@ -attribute mediump vec2 aPosition; // DALi shader builtin -uniform mediump mat4 uMvpMatrix; // DALi shader builtin -uniform mediump vec3 uSize; // DALi shader builtin +//@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 +}; 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 d8d62266..50cfdae3 100644 --- a/examples/rendering-radial-progress/shaders/radial-progress-basic.frag +++ b/examples/rendering-radial-progress/shaders/radial-progress-basic.frag @@ -1,3 +1,5 @@ +//@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 9700c416..9c591231 100644 --- a/examples/rendering-radial-progress/shaders/radial-progress-basic.vert +++ b/examples/rendering-radial-progress/shaders/radial-progress-basic.vert @@ -1,11 +1,17 @@ +//@version 100 + // Vertex shader for polygon -attribute mediump vec3 aPosition; -uniform mediump mat4 uMvpMatrix; // DALi shader builtin -uniform mediump vec3 uSize; // DALi shader builtin -uniform mediump float uProgress; +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; +}; -varying mediump vec2 vTexCoord; +OUTPUT 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 4017c033..2f9a483d 100644 --- a/examples/rendering-radial-progress/shaders/radial-progress-textured.frag +++ b/examples/rendering-radial-progress/shaders/radial-progress-textured.frag @@ -1,10 +1,12 @@ +//@version 100 + // Fragment shaderfor textured quad -uniform sampler2D uTexture; -varying mediump vec2 vTexCoord; +UNIFORM sampler2D uTexture; +INPUT mediump vec2 vTexCoord; void main() { - mediump vec4 texColor = texture2D( uTexture, vTexCoord ); + mediump vec4 texColor = TEXTURE( 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 78aca625..deb23706 100644 --- a/examples/rendering-radial-progress/shaders/radial-progress-textured.vert +++ b/examples/rendering-radial-progress/shaders/radial-progress-textured.vert @@ -1,10 +1,15 @@ +//@version 100 // Vertex shader for textured quad -attribute mediump vec2 aPosition; -uniform mediump mat4 uMvpMatrix; // DALi shader builtin -uniform mediump vec3 uSize; // DALi shader builtin +INPUT mediump vec2 aPosition; -varying mediump vec2 vTexCoord; +UNIFORM_BLOCK Vanilla +{ +UNIFORM mediump mat4 uMvpMatrix; // DALi shader builtin +UNIFORM mediump vec3 uSize; // DALi shader builtin +}; + +OUTPUT 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 b8a29f58..93d84519 100644 --- a/examples/rendering-skybox/shaders/rendering-skybox-cube.frag +++ b/examples/rendering-skybox/shaders/rendering-skybox-cube.frag @@ -1,11 +1,13 @@ +//@version 100 + // Fragment shader for a textured cube -uniform sampler2D uTexture; +UNIFORM sampler2D uTexture; -varying mediump vec2 vTexCoord; +INPUT mediump vec2 vTexCoord; void main() { - mediump vec4 texColor = texture2D( uTexture, vTexCoord ); + mediump vec4 texColor = TEXTURE( 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 621f98de..3e6bc48a 100644 --- a/examples/rendering-skybox/shaders/rendering-skybox-cube.vert +++ b/examples/rendering-skybox/shaders/rendering-skybox-cube.vert @@ -1,11 +1,16 @@ +//@version 100 // Vertex shader for a textured cube -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 -varying mediump vec2 vTexCoord; +UNIFORM_BLOCK Vanilla +{ +UNIFORM mediump mat4 uMvpMatrix; // DALi shader builtin +UNIFORM mediump vec3 uSize; // DALi shader builtin +}; + +OUTPUT 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 e38d7e86..4bc66fb3 100644 --- a/examples/rendering-skybox/shaders/rendering-skybox-equirectangular.frag +++ b/examples/rendering-skybox/shaders/rendering-skybox-equirectangular.frag @@ -1,9 +1,11 @@ +//@version 100 + // Fragment shader for a skybox in equirectangular projection precision mediump float; -uniform sampler2D uSkyBoxEquirectangularTexture; +UNIFORM sampler2D uSkyBoxEquirectangularTexture; -varying vec3 vTexCoord; +INPUT 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 @@ -30,6 +32,6 @@ void main() // Flip the texture UVs vertically vec2 uvFlippped = vec2(uv.x, 1.0 - uv.y); - vec4 texColor = texture2D( uSkyBoxEquirectangularTexture, uvFlippped ); + vec4 texColor = TEXTURE( uSkyBoxEquirectangularTexture, uvFlippped ); gl_FragColor = texColor; } diff --git a/examples/rendering-skybox/shaders/rendering-skybox.frag b/examples/rendering-skybox/shaders/rendering-skybox.frag index c7556457..7a15616b 100644 --- a/examples/rendering-skybox/shaders/rendering-skybox.frag +++ b/examples/rendering-skybox/shaders/rendering-skybox.frag @@ -1,11 +1,13 @@ +//@version 100 + // Fragment shader for a skybox -uniform samplerCube uSkyBoxTexture; +UNIFORM samplerCube uSkyBoxTexture; -varying mediump vec3 vTexCoord; +INPUT mediump vec3 vTexCoord; void main() { - mediump vec4 texColor = textureCube( uSkyBoxTexture, vTexCoord ); + mediump vec4 texColor = TEXTURE( uSkyBoxTexture, vTexCoord ); gl_FragColor = texColor; } diff --git a/examples/rendering-skybox/shaders/rendering-skybox.vert b/examples/rendering-skybox/shaders/rendering-skybox.vert index c2ce43a9..811357f6 100644 --- a/examples/rendering-skybox/shaders/rendering-skybox.vert +++ b/examples/rendering-skybox/shaders/rendering-skybox.vert @@ -1,9 +1,16 @@ +//@version 100 + // Vertex shader for a skybox -attribute mediump vec3 aPosition; // DALi shader builtin -uniform mediump mat4 uMvpMatrix; // DALi shader builtin +INPUT mediump vec3 aPosition; // DALi shader builtin + + +UNIFORM_BLOCK Vanilla +{ +UNIFORM mediump mat4 uMvpMatrix; // DALi shader builtin +}; -varying mediump vec3 vTexCoord; +OUTPUT 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 43fb27f4..96e0887e 100644 --- a/examples/rendering-textured-cube/shaders/rendering-textured-cube.frag +++ b/examples/rendering-textured-cube/shaders/rendering-textured-cube.frag @@ -1,8 +1,10 @@ -uniform sampler2D uTexture; -varying mediump vec2 vTexCoord; +//@version 100 + +UNIFORM sampler2D uTexture; +INPUT mediump vec2 vTexCoord; void main() { - mediump vec4 texColor = texture2D( uTexture, vTexCoord ); + mediump vec4 texColor = TEXTURE( 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 36c0e608..787104bd 100644 --- a/examples/rendering-textured-cube/shaders/rendering-textured-cube.vert +++ b/examples/rendering-textured-cube/shaders/rendering-textured-cube.vert @@ -1,9 +1,15 @@ -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 +//@version 100 -varying mediump vec2 vTexCoord; +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; void main() { diff --git a/examples/rendering-triangle/shaders/rendering-triangle.frag b/examples/rendering-triangle/shaders/rendering-triangle.frag index b8d9d3ab..a452cec2 100644 --- a/examples/rendering-triangle/shaders/rendering-triangle.frag +++ b/examples/rendering-triangle/shaders/rendering-triangle.frag @@ -1,4 +1,9 @@ -uniform mediump vec4 uColor; +//@version 100 + +UNIFORM_BLOCK Custome +{ +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 53f4a4f7..f70dabeb 100644 --- a/examples/rendering-triangle/shaders/rendering-triangle.vert +++ b/examples/rendering-triangle/shaders/rendering-triangle.vert @@ -1,6 +1,12 @@ -attribute mediump vec2 aPosition; // DALi shader builtin -uniform mediump mat4 uMvpMatrix; // DALi shader builtin -uniform mediump vec3 uSize; // DALi shader builtin +//@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 +}; void main() { diff --git a/examples/scene3d-model/scene3d-model-example.cpp b/examples/scene3d-model/scene3d-model-example.cpp index 414ae5eb..7cdd3f7d 100644 --- a/examples/scene3d-model/scene3d-model-example.cpp +++ b/examples/scene3d-model/scene3d-model-example.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Samsung Electronics Co., Ltd. + * Copyright (c) 2024 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. @@ -30,8 +30,8 @@ using namespace Dali::Toolkit; /* * This example shows how to create and display a Model control. - * The application can load 5 different glTF model to Model control. - * Each model has diffirent material. BoomBox shows glossy or matt plastic material. + * The application can load 3D models in different formats (i.e. glTF, USD, and DLI) to Model control. + * Each model has different material. BoomBox shows glossy or matt plastic material. * DamagedHelmet shows a kind of reflective glass and metallic object. * Microphone shows a roughness of metallic objects. * and Lantern shows a realistic difference between wood object and metallic object. @@ -41,6 +41,8 @@ using namespace Dali::Toolkit; namespace { +const Vector3 DEFAULT_CAMERA_POSITION(53.0f, -1300.0f, 3200.0f); + struct ModelInfo { const char* name; ///< The name of the model. @@ -48,7 +50,7 @@ struct ModelInfo const float yPosition; ///< The position of the model in the Y axis. }; -const ModelInfo gltf_list[] = +const ModelInfo model_list[] = { /** * For the BoxAnimated.glb @@ -69,7 +71,7 @@ const ModelInfo gltf_list[] = * Created by Ryan Martin * Take from https://github.com/KhronosGroup/glTF-Sample-Models/tree/master/2.0/Lantern */ - {"Lantern.gltf", Vector2(600.0f, 600.0f), 0.0f}, + {"Lantern.gltf", Vector2(600.0f, 600.0f), 300.0f}, /** * For the BoomBox.gltf and its Assets * Donated by Microsoft for glTF testing @@ -92,6 +94,38 @@ const ModelInfo gltf_list[] = */ {"microphone.gltf", Vector2(600.0f, 600.0f), 0.0f}, /** + * Converted from the AntiqueCamera glTF file and its Assets + * Old camera model by Maximilian Kamps + * Dontated by UX3D for glTF testing + * Take from https://github.com/KhronosGroup/glTF-Sample-Models/blob/master/2.0/AntiqueCamera + */ + {"AntiqueCamera.usdz", Vector2(60.0f, 60.0f), 350.0f}, + /** + * Converted from the BarramundiFish glTF file and its Assets + * Donated by Microsoft for glTF testing + * Take from https://github.com/KhronosGroup/glTF-Sample-Models/blob/master/2.0/BarramundiFish + */ + {"BarramundiFish.usdz", Vector2(2500.0f, 2500.0f), 300.0f}, + /** + * Converted from the CesiumMilkTruck glTF file and its Assets + * Published under a Creative Commons Attribution 4.0 International License + * Donated by Cesium for glTF testing + * Take from https://github.com/KhronosGroup/glTF-Sample-Models/blob/master/2.0/CesiumMilkTruck + */ + {"CesiumMilkTruck.usdz", Vector2(300.0f, 300.0f), 300.0f}, + /** + * Converted from the Corset glTF file and its Assets + * Donated by Microsoft for glTF testing + * Take from https://github.com/KhronosGroup/glTF-Sample-Models/blob/master/2.0/Corset + */ + {"Corset.usdz", Vector2(12000.0f, 12000.0f), 300.0f}, + /** + * Converted from the WaterBottle glTF file and its Assets + * Donated by Microsoft for glTF testing + * Take from https://github.com/KhronosGroup/glTF-Sample-Models/blob/master/2.0/WaterBottle + */ + {"WaterBottle.usdz", Vector2(3000.0f, 3000.0f), 0.0f}, + /** * For the beer_model.dli and its Assets * This model includes a bottle of beer and cube box. */ @@ -103,7 +137,7 @@ const ModelInfo gltf_list[] = {"exercise_model.dli", Vector2(600.0f, 600.0f), 0.0f}, }; -const int32_t NUM_OF_GLTF_MODELS = sizeof(gltf_list) / sizeof(gltf_list[0]); +const int32_t NUM_OF_MODELS = sizeof(model_list) / sizeof(model_list[0]); /** * For the diffuse and specular cube map texture. @@ -201,11 +235,11 @@ Shader LoadShaders(const std::string& shaderVertexFileName, const std::string& s } // namespace /** - * This example shows how to render glTF model with Model + * This example shows how to render 3D model with Model * How to test * - Input UP or DOWN key to make the model rotate or stop. - * - Input LEFT or RIGHT key to change glTF model - * - Double Touch also changes glTF model. + * - Input LEFT or RIGHT key to change 3D model + * - Double Touch also changes 3D model. */ class Scene3DModelExample : public ConnectionTracker { @@ -221,7 +255,10 @@ public: ~Scene3DModelExample() { - mAnimation.Stop(); + if(mAnimation) + { + mAnimation.Stop(); + } } // The Init signal is received once (only) during the Application lifetime @@ -233,11 +270,22 @@ public: // Get a handle to the mWindow mWindow.SetBackgroundColor(Color::WHITE); + // Create a text label for error message when a model is failed to load + mTextLabel = TextLabel::New(); + mTextLabel.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER); + mTextLabel.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); + mTextLabel.SetProperty(Actor::Property::DRAW_MODE, DrawMode::OVERLAY_2D); + mTextLabel.SetProperty(TextLabel::Property::HORIZONTAL_ALIGNMENT, HorizontalAlignment::CENTER); + mTextLabel.SetProperty(TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::IMMEDIATE); + mWindow.Add(mTextLabel); + + mTextLabel.SetProperty(Actor::Property::VISIBLE, false); + RenderTask renderTask = mWindow.GetRenderTaskList().GetTask(0); renderTask.SetCullMode(false); - mCurrentGlTF = 0u; - CreateSceneFromGLTF(mCurrentGlTF); + mCurrentModel = 0u; + CreateSceneFromModel(mCurrentModel); SetCameraActor(); CreateSkybox(); SetAnimation(); @@ -272,7 +320,7 @@ public: return true; } - void CreateSceneFromGLTF(uint32_t index) + void CreateSceneFromModel(uint32_t index) { mReadyToLoad = false; if(mModel) @@ -280,17 +328,18 @@ public: mWindow.GetRootLayer().Remove(mModel); } - std::string gltfUrl = modeldir; - gltfUrl += gltf_list[index].name; + std::string modelUrl = modeldir; + modelUrl += model_list[index].name; - mModel = Dali::Scene3D::Model::New(gltfUrl); - mModel.SetProperty(Dali::Actor::Property::SIZE, gltf_list[index].size); - mModel.SetProperty(Dali::Actor::Property::POSITION_Y, gltf_list[index].yPosition); + mModel = Dali::Scene3D::Model::New(modelUrl); + mModel.SetProperty(Dali::Actor::Property::SIZE, model_list[index].size); + mModel.SetProperty(Dali::Actor::Property::POSITION_Y, model_list[index].yPosition); mModel.SetProperty(Dali::Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER); mModel.SetProperty(Dali::Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); mModel.SetImageBasedLightSource(uri_diffuse_texture, uri_specular_texture, 0.6f); mModel.ResourceReadySignal().Connect(this, &Scene3DModelExample::ResourceReady); + mModel.LoadCompletedSignal().Connect(this, &Scene3DModelExample::LoadCompleted); mWindow.Add(mModel); } @@ -300,15 +349,33 @@ public: mReadyToLoad = true; if(mModel.GetAnimationCount() > 0) { - Animation animation = (std::string("exercise_model.dli") == gltf_list[mCurrentGlTF].name) ? mModel.GetAnimation("idleToSquatClip_0") : mModel.GetAnimation(0u); + Animation animation = (std::string("exercise_model.dli") == model_list[mCurrentModel].name) ? mModel.GetAnimation("idleToSquatClip_0") : mModel.GetAnimation(0u); animation.Play(); animation.SetLoopCount(0); } } + void LoadCompleted(Dali::Scene3D::Model model, bool succeeded) + { + if(!succeeded) + { + // Show an error message + std::ostringstream messageStream; + messageStream << "Failed to load " << model_list[mCurrentModel].name; + mTextLabel.SetProperty(TextLabel::Property::TEXT, messageStream.str()); + mTextLabel.SetProperty(TextLabel::Property::ENABLE_AUTO_SCROLL, true); + mTextLabel.SetProperty(Actor::Property::VISIBLE, true); + } + + // Current model finishes loading (regardless of successfully or not) + // So allow to load the next model + mReadyToLoad = true; + } + void SetCameraActor() { - mCameraActor = mWindow.GetRenderTaskList().GetTask(0).GetCameraActor(); + mCameraActor = mWindow.GetRenderTaskList().GetTask(0).GetCameraActor(); + mCameraActor.SetProperty(Dali::Actor::Property::POSITION, DEFAULT_CAMERA_POSITION); mCameraPosition = mCameraActor.GetProperty<Vector3>(Dali::Actor::Property::POSITION); mCameraActor.SetType(Dali::Camera::LOOK_AT_TARGET); } @@ -479,16 +546,20 @@ public: return; } - mCurrentGlTF += direction; - if(mCurrentGlTF >= NUM_OF_GLTF_MODELS) + // Hide any error message + mTextLabel.SetProperty(Actor::Property::VISIBLE, false); + mTextLabel.SetProperty(TextLabel::Property::ENABLE_AUTO_SCROLL, false); + + mCurrentModel += direction; + if(mCurrentModel >= NUM_OF_MODELS) { - mCurrentGlTF = 0; + mCurrentModel = 0; } - if(mCurrentGlTF < 0) + if(mCurrentModel < 0) { - mCurrentGlTF = NUM_OF_GLTF_MODELS - 1; + mCurrentModel = NUM_OF_MODELS - 1; } - CreateSceneFromGLTF(mCurrentGlTF); + CreateSceneFromModel(mCurrentModel); SetAnimation(); mAnimationStop = false; mWheelDelta = 1.0f; @@ -637,9 +708,11 @@ private: float mWheelDelta{1.0f}; - int32_t mCurrentGlTF{0}; + int32_t mCurrentModel{0}; bool mReadyToLoad{true}; + + TextLabel mTextLabel; }; int32_t DALI_EXPORT_API main(int32_t argc, char** argv) diff --git a/examples/sparkle/shaders/sparkle-effect.frag b/examples/sparkle/shaders/sparkle-effect.frag index 006a7d2b..e2213894 100644 --- a/examples/sparkle/shaders/sparkle-effect.frag +++ b/examples/sparkle/shaders/sparkle-effect.frag @@ -1,11 +1,13 @@ +//@version 100 + precision highp float; -uniform sampler2D sTexture; -varying vec2 vTexCoord; +UNIFORM sampler2D sTexture; -varying lowp vec4 vColor; +INPUT vec2 vTexCoord; +INPUT lowp vec4 vColor; void main() { gl_FragColor = vColor; - gl_FragColor.a *= texture2D(sTexture, vTexCoord).a; + gl_FragColor.a *= TEXTURE(sTexture, vTexCoord).a; } diff --git a/examples/sparkle/shaders/sparkle-effect.vert b/examples/sparkle/shaders/sparkle-effect.vert index 02c33df8..45689ab8 100644 --- a/examples/sparkle/shaders/sparkle-effect.vert +++ b/examples/sparkle/shaders/sparkle-effect.vert @@ -1,29 +1,32 @@ +//@version 100 precision highp float; -attribute vec2 aTexCoord; -uniform mat4 uMvpMatrix; -varying vec2 vTexCoord; +INPUT vec2 aTexCoord; +INPUT vec2 aParticlePath0; +INPUT vec2 aParticlePath1; +INPUT vec2 aParticlePath2; +INPUT vec2 aParticlePath3; +INPUT vec2 aParticlePath4; +INPUT vec2 aParticlePath5; -attribute vec2 aParticlePath0; -attribute vec2 aParticlePath1; -attribute vec2 aParticlePath2; -attribute vec2 aParticlePath3; -attribute vec2 aParticlePath4; -attribute vec2 aParticlePath5; +OUTPUT lowp vec4 vColor; +OUTPUT vec2 vTexCoord; -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; +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; +}; void main() { @@ -38,7 +41,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); @@ -75,8 +78,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/uScale, - position.y+sign(aTexCoord.y)*PARTICLE_HALF_SIZE/uScale, + gl_Position = uMvpMatrix * vec4( position.x+sign(aTexCoord.x)*PARTICLE_HALF_SIZE/uEffectScale, + position.y+sign(aTexCoord.y)*PARTICLE_HALF_SIZE/uEffectScale, 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 a6c7a83c..3f7d9ebb 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("uScale"), 0.01f); + mEffect.SetProperty(mEffect.GetPropertyIndex("uEffectScale"), 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, "uScale"), ACTOR_SCALE, EaseOutSquare); + breakAnimation.AnimateTo(Property(mEffect, "uEffectScale"), 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 2f0247ad..2deee478 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("uScale", ACTOR_SCALE); + handle.RegisterProperty("uEffectScale", 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 37bdf1c4..a717dd85 100644 --- a/examples/styling/shaders/image-channel-control.frag +++ b/examples/styling/shaders/image-channel-control.frag @@ -1,9 +1,16 @@ +//@version 100 + INPUT mediump vec2 vTexCoord; -uniform sampler2D sTexture; -uniform mediump vec4 uColor; -uniform mediump vec3 uChannels; + +UNIFORM sampler2D sTexture; + +UNIFORM_BLOCK Custom +{ +UNIFORM mediump vec4 uColor; +UNIFORM mediump vec3 uChannels; +}; void main() { - OUT_COLOR = TEXTURE( sTexture, vTexCoord ) * uColor * vec4(uChannels, 1.0) ; + gl_FragColor = 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 1edd66ec..06668b61 100644 --- a/examples/textured-mesh/shaders/textured-mesh.frag +++ b/examples/textured-mesh/shaders/textured-mesh.frag @@ -1,9 +1,16 @@ -varying mediump vec2 vTexCoord; -uniform lowp vec4 uColor; -uniform sampler2D sTexture; -uniform lowp vec4 uFadeColor; +//@version 100 + +INPUT mediump vec2 vTexCoord; + +UNIFORM sampler2D sTexture; + +UNIFORM_BLOCK CustomColor +{ +UNIFORM lowp vec4 uColor; +UNIFORM lowp vec4 uFadeColor; +}; void main() { - gl_FragColor = texture2D(sTexture, vTexCoord) * uColor * uFadeColor; + gl_FragColor = TEXTURE(sTexture, vTexCoord)* uColor * uFadeColor; } diff --git a/examples/textured-mesh/shaders/textured-mesh.vert b/examples/textured-mesh/shaders/textured-mesh.vert index 11931501..3c974f22 100644 --- a/examples/textured-mesh/shaders/textured-mesh.vert +++ b/examples/textured-mesh/shaders/textured-mesh.vert @@ -1,9 +1,15 @@ -attribute mediump vec2 aPosition; -attribute highp vec2 aTexCoord; -varying mediump vec2 vTexCoord; -uniform mediump mat4 uMvpMatrix; -uniform mediump vec3 uSize; -uniform lowp vec4 uFadeColor; +//@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; +}; void main() { diff --git a/examples/textured-mesh/textured-mesh-example.cpp b/examples/textured-mesh/textured-mesh-example.cpp index 2423d8e2..d87fc89c 100644 --- a/examples/textured-mesh/textured-mesh-example.cpp +++ b/examples/textured-mesh/textured-mesh-example.cpp @@ -92,6 +92,7 @@ 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 81cd3dfe..6e0192b6 100644 --- a/examples/uniform-blocks/shaders/uniform-block-alt.frag +++ b/examples/uniform-blocks/shaders/uniform-block-alt.frag @@ -1,12 +1,14 @@ -layout(std140) uniform FragmentBlock +//@version 100 + +UNIFORM_BLOCK FragmentBlock { - lowp vec4 uColor; - mediump vec4 uColorArray[1024]; - mediump int uColorIndex; + UNIFORM lowp vec4 uColor; + UNIFORM mediump vec4 uColorArray[1024]; + UNIFORM mediump int uColorIndex; }; void main() { // Test that the array color is the same as the actor color - fragColor = vec4(vec3(0.5, 0.5, 0.5) + vec3(uColorArray[uColorIndex].xyz-uColor.xyz)*0.5, 1.0); + gl_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 9e699bf9..71479353 100644 --- a/examples/uniform-blocks/shaders/uniform-block.frag +++ b/examples/uniform-blocks/shaders/uniform-block.frag @@ -1,11 +1,13 @@ -layout(std140) uniform FragmentBlock +//@version 100 + +UNIFORM_BLOCK FragmentBlock { - lowp vec4 uColor; - mediump vec4 uColorArray[1024]; - mediump int uColorIndex; +UNIFORM lowp vec4 uColor; +UNIFORM mediump vec4 uColorArray[1024]; +UNIFORM mediump int uColorIndex; }; void main() { - fragColor = uColorArray[uColorIndex]; + gl_FragColor = uColorArray[uColorIndex]; } diff --git a/examples/uniform-blocks/shaders/uniform-block.vert b/examples/uniform-blocks/shaders/uniform-block.vert index cbf8ff9d..ecdae31c 100644 --- a/examples/uniform-blocks/shaders/uniform-block.vert +++ b/examples/uniform-blocks/shaders/uniform-block.vert @@ -1,9 +1,11 @@ +//@version 100 + INPUT vec2 aPosition; -layout(std140) uniform VertexBlock +UNIFORM_BLOCK Vanilla { - highp mat4 uMvpMatrix; - highp vec3 uSize; +UNIFORM highp mat4 uMvpMatrix; +UNIFORM highp vec3 uSize; }; void main() diff --git a/examples/waves/shaders/waves.frag b/examples/waves/shaders/waves.frag index 8a496a19..2c7589b8 100644 --- a/examples/waves/shaders/waves.frag +++ b/examples/waves/shaders/waves.frag @@ -1,19 +1,25 @@ +//@version 100 + precision highp float; -uniform vec4 uColor; // DALi -uniform sampler2D uNormalMap; // DALi +UNIFORM sampler2D uNormalMap; // DALi + +UNIFORM_BLOCK CustomFrag +{ +UNIFORM vec4 uColor; // 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; +}; -varying vec2 vUv; -varying vec3 vNormal; -varying vec3 vViewPos; -varying float vHeight; +INPUT vec2 vUv; +INPUT vec3 vNormal; +INPUT vec3 vViewPos; +INPUT float vHeight; float Rand(vec2 co) { @@ -30,8 +36,8 @@ void main() vec3 viewPos = normalize(vViewPos); vec2 uv2 = vUv + vViewPos.xy / vViewPos.z * vHeight + vec2(.5, 0.); - vec3 perturbNormal = texture2D(uNormalMap, vUv).rgb * 2. - 1.; - vec3 perturbNormal2 = texture2D(uNormalMap, uv2).rgb * 2. - 1.; + vec3 perturbNormal = TEXTURE(uNormalMap, vUv).rgb * 2. - 1.; + vec3 perturbNormal2 = TEXTURE(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 ac9af2fd..7830ec7c 100644 --- a/examples/waves/shaders/waves.vert +++ b/examples/waves/shaders/waves.vert @@ -1,32 +1,39 @@ +//@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 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; +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; float CubicHermite(float B, float C, float t) { diff --git a/packaging/com.samsung.dali-demo.spec b/packaging/com.samsung.dali-demo.spec index d385e364..a57abc27 100755 --- a/packaging/com.samsung.dali-demo.spec +++ b/packaging/com.samsung.dali-demo.spec @@ -2,7 +2,7 @@ Name: com.samsung.dali-demo Summary: The OpenGLES Canvas Core Demo -Version: 2.3.45 +Version: 2.3.50 Release: 1 Group: System/Libraries License: Apache-2.0 diff --git a/resources/models/AntiqueCamera.usdz b/resources/models/AntiqueCamera.usdz Binary files differnew file mode 100644 index 00000000..32aa478c --- /dev/null +++ b/resources/models/AntiqueCamera.usdz diff --git a/resources/models/BarramundiFish.usdz b/resources/models/BarramundiFish.usdz Binary files differnew file mode 100644 index 00000000..4f7b53f3 --- /dev/null +++ b/resources/models/BarramundiFish.usdz diff --git a/resources/models/CesiumMilkTruck.usdz b/resources/models/CesiumMilkTruck.usdz Binary files differnew file mode 100644 index 00000000..7023881c --- /dev/null +++ b/resources/models/CesiumMilkTruck.usdz diff --git a/resources/models/Corset.usdz b/resources/models/Corset.usdz Binary files differnew file mode 100644 index 00000000..11cb11a2 --- /dev/null +++ b/resources/models/Corset.usdz diff --git a/resources/models/WaterBottle.usdz b/resources/models/WaterBottle.usdz Binary files differnew file mode 100644 index 00000000..0d65e12b --- /dev/null +++ b/resources/models/WaterBottle.usdz diff --git a/resources/shaders/raymarch_sphere_shaded.fsh b/resources/shaders/raymarch_sphere_shaded.fsh index 7e7d6b8b..1a35b93b 100644 --- a/resources/shaders/raymarch_sphere_shaded.fsh +++ b/resources/shaders/raymarch_sphere_shaded.fsh @@ -1,11 +1,16 @@ +//@version 100 + /* * Fragment shader for textured quad */ -varying mediump vec2 vTexCoord; -varying mediump vec2 vRayCastCoord; +INPUT mediump vec2 vTexCoord; +INPUT mediump vec2 vRayCastCoord; -uniform mediump float uRadius; -uniform mediump float uAdjuster; +UNIFORM_BLOCK Custom +{ +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 fcc1df33..5a41c5a8 100644 --- a/resources/shaders/raymarch_sphere_shaded.vsh +++ b/resources/shaders/raymarch_sphere_shaded.vsh @@ -1,9 +1,15 @@ -attribute mediump vec2 aPosition; -uniform mediump mat4 uMvpMatrix; // DALi shader builtin -uniform mediump vec3 uSize; // DALi shader builtin +//@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 +}; -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 b477b966..667e2087 100644 --- a/resources/style/android/base-theme.json +++ b/resources/style/android/base-theme.json @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 Samsung Electronics Co., Ltd + * Copyright (c) 2024 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,20 +50,23 @@ "shader": { "fragmentShader":[ + "//@version 100", " varying mediump vec2 vTexCoord;", - " uniform lowp vec4 uColor;", - " uniform sampler2D sTexture;", - " uniform mediump vec3 uCustomPosition;", - "", + " UNIFORM sampler2D sTexture;", + " UNIFORM_BLOCK FragBlock", + " {", + " UNIFORM lowp vec4 uColor;", + " UNIFORM mediump vec3 uCustomPosition;", + " };", " void main()", " {", - " if( texture2D( sTexture, vTexCoord ).a <= 0.0001 )", + " if( TEXTURE( 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 = texture2D( sTexture, wrapTexCoord );", + " mediump vec4 color = TEXTURE( 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 );", @@ -89,19 +92,21 @@ { "fragmentShader":[ " varying mediump vec2 vTexCoord;", - " uniform lowp vec4 uColor;", - " uniform sampler2D sTexture;", - " uniform mediump vec3 uCustomPosition;", - "", + " UNIFORM sampler2D sTexture;", + " UNIFORM_BLOCK FragBlock", + " {", + " UNIFORM lowp vec4 uColor;", + " UNIFORM mediump vec3 uCustomPosition;", + " };", " void main()", " {", - " if( texture2D( sTexture, vTexCoord ).a <= 0.0001 )", + " if( TEXTURE( 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 = texture2D( sTexture, wrapTexCoord );", + " mediump vec4 color = TEXTURE( 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 12404e94..fdcb4244 100644 --- a/resources/style/base-theme.json +++ b/resources/style/base-theme.json @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 Samsung Electronics Co., Ltd + * Copyright (c) 2024 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,20 +50,23 @@ "shader": { "fragmentShader":[ - " varying mediump vec2 vTexCoord;", - " uniform lowp vec4 uColor;", - " uniform sampler2D sTexture;", - " uniform mediump vec3 uCustomPosition;", - "", + "//@version 100", + " INPUT mediump vec2 vTexCoord;", + " UNIFORM sampler2D sTexture;", + " UNIFORM_BLOCK FragBlock", + " {", + " UNIFORM lowp vec4 uColor;", + " UNIFORM mediump vec3 uCustomPosition;", + " };", " void main()", " {", - " if( texture2D( sTexture, vTexCoord ).a <= 0.0001 )", + " if( TEXTURE( 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 = texture2D( sTexture, wrapTexCoord );", + " mediump vec4 color = TEXTURE( 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 );", @@ -88,20 +91,24 @@ "shader": { "fragmentShader":[ - " varying mediump vec2 vTexCoord;", - " uniform lowp vec4 uColor;", - " uniform sampler2D sTexture;", - " uniform mediump vec3 uCustomPosition;", + "//@version 100", + " INPUT mediump vec2 vTexCoord;", + " UNIFORM sampler2D sTexture;", + " UNIFORM_BLOCK FragBlock", + " {", + " UNIFORM lowp vec4 uColor;", + " UNIFORM mediump vec3 uCustomPosition;", + " };", "", " void main()", " {", - " if( texture2D( sTexture, vTexCoord ).a <= 0.0001 )", + " if( TEXTURE( 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 = texture2D( sTexture, wrapTexCoord );", + " mediump vec4 color = TEXTURE( 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 d8400b33..5c3bd62a 100644 --- a/resources/style/rpi/base-theme.json +++ b/resources/style/rpi/base-theme.json @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 Samsung Electronics Co., Ltd + * Copyright (c) 2024 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,20 +46,23 @@ "shader": { "fragmentShader":[ - " varying mediump vec2 vTexCoord;", - " uniform lowp vec4 uColor;", - " uniform sampler2D sTexture;", - " uniform mediump vec3 uCustomPosition;", - "", + "//@version 100", + " INPUT mediump vec2 vTexCoord;", + " UNIFORM sampler2D sTexture;", + " UNIFORM_BLOCK FragmentBlock", + " {", + " UNIFORM lowp vec4 uColor;", + " UNIFORM mediump vec3 uCustomPosition;", + " };", " void main()", " {", - " if( texture2D( sTexture, vTexCoord ).a <= 0.0001 )", + " if( TEXTURE( 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 = texture2D( sTexture, wrapTexCoord );", + " mediump vec4 color = TEXTURE( 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 );", @@ -84,20 +87,23 @@ "shader": { "fragmentShader":[ - " varying mediump vec2 vTexCoord;", - " uniform lowp vec4 uColor;", - " uniform sampler2D sTexture;", - " uniform mediump vec3 uCustomPosition;", - "", + "//@version 100", + " INPUT mediump vec2 vTexCoord;", + " UNIFORM sampler2D sTexture;", + " UNIFORM_BLOCK FragmentBlock", + " {", + " UNIFORM lowp vec4 uColor;", + " UNIFORM mediump vec3 uCustomPosition;", + " };", " void main()", " {", - " if( texture2D( sTexture, vTexCoord ).a <= 0.0001 )", + " if( TEXTURE( 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 = texture2D( sTexture, wrapTexCoord );", + " mediump vec4 color = TEXTURE( 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 );", |