#define __DALI_SHADER_EFFECT_H__
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2015 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.
*/
// INTERNAL INCLUDES
-#include <dali/public-api/animation/active-constraint-declarations.h>
#include <dali/public-api/object/handle.h>
#include <dali/public-api/object/property-index-ranges.h>
*/
#define DALI_COMPOSE_SHADER(STR) #STR
-class Constraint;
class Image;
struct Vector2;
struct Vector3;
*/
enum GeometryType
{
- GEOMETRY_TYPE_IMAGE = 0x01, ///< image, with flat color or texture
- GEOMETRY_TYPE_TEXT = 0x02, ///< text, with flat color or texture
- GEOMETRY_TYPE_UNTEXTURED_MESH = 0x04,///< Complex meshes, with flat color
- GEOMETRY_TYPE_TEXTURED_MESH = 0x08, ///< Complex meshes, with texture
- GEOMETRY_TYPE_LAST = 0x10
+ GEOMETRY_TYPE_IMAGE = 0x01, ///< image, with flat color or texture
+ GEOMETRY_TYPE_UNTEXTURED_MESH = 0x02, ///< Complex meshes, with flat color
+ GEOMETRY_TYPE_TEXTURED_MESH = 0x04, ///< Complex meshes, with texture
+ GEOMETRY_TYPE_LAST = 0x08
};
/**
* uniform vec4 uColor;
* varying vec2 vTexCoord;
* </pre>
- * and for text:
- * <pre>
- * \#extension GL_OES_standard_derivatives : enable
- * uniform mediump sampler2D sTexture;
- * uniform lowp vec4 uColor;
- * uniform lowp vec4 uTextColor;
- * uniform mediump float uSmoothing;
- * varying mediump vec2 vTexCoord;
- * </pre>
- * and the custom shader is expected to output the fragment color.
- * The basic fragment shader for images would contain:
- * <pre>
- * void main()
- * {
- * gl_FragColor = texture2D( sTexture, vTexCoord ) * uColor;
- * }
- * </pre>
- * and for text::
- * <pre>
- * void main()
- * {
- * // sample distance field
- * mediump float distance = texture2D(sTexture, vTexCoord).a;
- * mediump float smoothWidth = fwidth(distance);
- * // set fragment color
- * lowp vec4 color = uTextColor;
- * // adjust alpha by sampled distance
- * color.a *= smoothstep(uSmoothing - smoothWidth, uSmoothing + smoothWidth, distance);
- * // fragment color multiplied with uColor.
- * glFragColor = color * uColor;
- * }
- * </pre>
* <BR>
* <B>
* Note: In order for fade and color animations to work, the fragment shader needs to multiply the fragment color
{
enum
{
- GridDensity = DEFAULT_ACTOR_PROPERTY_START_INDEX, ///< name "grid-density", type FLOAT
- Image, ///< name "image", type MAP {"filename":"", "load-policy":...}
- Program, ///< name "program", type MAP {"vertex-prefix":"","fragment-prefix":"","vertex":"","fragment":""}
- GeometryHints, ///< name "geometry-hints", type INT (bitfield) values from enum GeometryHints
+ GRID_DENSITY = DEFAULT_ACTOR_PROPERTY_START_INDEX, ///< name "grid-density", type float
+ IMAGE, ///< name "image", type Map {"filename":"", "load-policy":...}
+ PROGRAM, ///< name "program", type Map {"vertex-prefix":"","fragment-prefix":"","vertex":"","fragment":""}
+ GEOMETRY_HINTS ///< name "geometry-hints", type int (bitfield) values from enum GeometryHints
};
};
GeometryHints hints = GeometryHints(HINT_NONE) );
/**
- * @brief Create ShaderEffect.
- * @param imageVertexShader code for the effect. If you pass in an empty string, the default version will be used
- * @param imageFragmentShader code for the effect. If you pass in an empty string, the default version will be used
- * @param textVertexShader code for the effect. If you pass in an empty string, the default version will be used
- * @param textFragmentShader code for the effect. If you pass in an empty string, the default version will be used
- * @param hints GeometryHints to define the geometry of the rendered object
- * @return A handle to a shader effect
- */
- static ShaderEffect New( const std::string& imageVertexShader,
- const std::string& imageFragmentShader,
- const std::string& textVertexShader,
- const std::string& textFragmentShader,
- GeometryHints hints = GeometryHints(HINT_NONE) );
-
- /**
- * @brief Create ShaderEffect.
- * @param imageVertexShader code for the effect. If you pass in an empty string, the default version will be used
- * @param imageFragmentShader code for the effect. If you pass in an empty string, the default version will be used
- * @param textVertexShader code for the effect. If you pass in an empty string, the default version will be used
- * @param textFragmentShader code for the effect. If you pass in an empty string, the default version will be used
- * @param texturedMeshVertexShader code for the effect. If you pass in an empty string, the default version will be used
- * @param texturedMeshFragmentShader code for the effect. If you pass in an empty string, the default version will be used
- * @param meshVertexShader code for the effect. If you pass in an empty string, the default version will be used
- * @param meshFragmentShader code for the effect. If you pass in an empty string, the default version will be used
- * @param hints GeometryHints to define the geometry of the rendered object
- * @return A handle to a shader effect
- */
- static ShaderEffect New( const std::string& imageVertexShader,
- const std::string& imageFragmentShader,
- const std::string& textVertexShader,
- const std::string& textFragmentShader,
- const std::string& texturedMeshVertexShader,
- const std::string& texturedMeshFragmentShader,
- const std::string& meshVertexShader,
- const std::string& meshFragmentShader,
- GeometryHints hints = GeometryHints(HINT_NONE) );
-
- /**
* @brief Downcast an Object handle to ShaderEffect.
*
* If handle points to a ShaderEffect the downcast produces valid