Updated all files to new format
[platform/core/uifw/dali-demo.git] / examples / line-mesh / line-mesh-example.cpp
index 3ef3d51..a71ce30 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
@@ -21,6 +21,8 @@
 #include <dali/devel-api/actors/actor-devel.h>
 
 // INTERNAL INCLUDES
+#include "generated/line-mesh-frag.h"
+#include "generated/line-mesh-vert.h"
 #include "shared/view.h"
 
 #include <sstream>
@@ -29,37 +31,6 @@ using namespace Dali;
 
 namespace
 {
-#define MAKE_SHADER(A) #A
-
-const char* VERTEX_SHADER = MAKE_SHADER(
-  attribute mediump vec2 aPosition1;
-  attribute mediump vec2 aPosition2;
-  attribute lowp vec3    aColor;
-  uniform mediump mat4   uMvpMatrix;
-  uniform mediump vec3   uSize;
-  uniform mediump float  uMorphAmount;
-
-  varying lowp vec3 vColor;
-
-  void main() {
-    mediump vec2 morphPosition  = mix(aPosition1, aPosition2, uMorphAmount);
-    mediump vec4 vertexPosition = vec4(morphPosition, 0.0, 1.0);
-    vColor                      = aColor;
-    vertexPosition.xyz *= uSize;
-    vertexPosition = uMvpMatrix * vertexPosition;
-    gl_Position    = vertexPosition;
-  });
-
-const char* FRAGMENT_SHADER = MAKE_SHADER(
-  uniform lowp vec4 uColor;
-  uniform sampler2D sTexture;
-
-  varying lowp vec3 vColor;
-
-  void main() {
-    gl_FragColor = uColor * vec4(vColor, 1.0);
-  });
-
 const unsigned short  INDEX_LINES[]   = {0, 1, 1, 2, 2, 3, 3, 4, 4, 0};
 const unsigned short  INDEX_LOOP[]    = {0, 1, 2, 3, 4};
 const unsigned short  INDEX_STRIP[]   = {0, 1, 2, 3, 4, 0};
@@ -177,7 +148,7 @@ public:
       mMeshActor.Reset();
     }
 
-    mShader   = Shader::New(VERTEX_SHADER, FRAGMENT_SHADER);
+    mShader   = Shader::New(SHADER_LINE_MESH_VERT, SHADER_LINE_MESH_FRAG);
     mGeometry = CreateGeometry();
     mRenderer = Renderer::New(mGeometry, mShader);