Add DALI_COMPOSE_SHADER macro to write shader source conveniently. 72/17772/2
authorjonghyun.ho <jonghyun.ho@samsung.com>
Wed, 19 Feb 2014 07:44:02 +0000 (16:44 +0900)
committerPaul Wisbey <p.wisbey@samsung.com>
Mon, 10 Mar 2014 17:20:00 +0000 (10:20 -0700)
[Issue]    N/A
[Problem]  We normally use double quotation marks to write a string such as "Hello World".
           However many symbols are needed to add multiple lines of string.
[Cause]    We don't want to write quotation marks at every line.
[Solution] Add DALI_COMPOSE_SHADER macro to write shader source conveniently.

Signed-off-by: Paul Wisbey <p.wisbey@samsung.com>
Change-Id: I4862e9723a9b16a591385d0f6dd25b5fbbe96b67

capi/dali/public-api/shader-effects/shader-effect.h

index fa8a328..55fd601 100644 (file)
 namespace Dali DALI_IMPORT_API
 {
 
+/**
+ * DALI_COMPOSE_SHADER macro provides convenient way to write shader source code.
+ * We normally use double quotation marks to write a string such as "Hello World".
+ * However many symbols are needed to add multiple lines of string.
+ * We don't need to write quotation marks using this macro at every line.
+ *
+ * [An example of double quotation marks usage]
+ * const string FRAGMENT_SHADER_SOURCE = \
+ * "  void main()\n"
+ * "  {\n"
+ * "    gl_FragColor = texture2D( sTexture, vTexCoord ) * uColor;\n"
+ * "  }\n";
+ *
+ * [An example of DALI_COMPOSE_SHADER usage]
+ * const string FRAGMENT_SHADER_SOURCE = DALI_COMPOSE_SHADER (
+ *   void main()
+ *   {
+ *     gl_Position = uProjection * uModelView * vec4(aPosition, 1.0);
+ *     vTexCoord = aTexCoord;
+ *   }
+ * );
+ */
+#define DALI_COMPOSE_SHADER(STR) #STR
+
 class Constraint;
 class Image;
 struct Vector2;