X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Fdevel-api%2Fshader-effects%2Fshear-effect.h;h=edea72e376a5cd848e60a024296701af5006271d;hp=a9b819b218c9dead7b81808a0543378eb3fb0a3d;hb=ae34cf6aef4b3b807bd1e099baa48230b6b32156;hpb=f58b8383147de70affa1e3949cf1c6757d705d3c diff --git a/dali-toolkit/devel-api/shader-effects/shear-effect.h b/dali-toolkit/devel-api/shader-effects/shear-effect.h index a9b819b..edea72e 100644 --- a/dali-toolkit/devel-api/shader-effects/shear-effect.h +++ b/dali-toolkit/devel-api/shader-effects/shear-effect.h @@ -28,71 +28,50 @@ namespace Toolkit { /** + * @brief Creates a new ShearEffect + * * ShearEffect is a custom shader effect to achieve shear effects in Image actors + * + * Animatable/Constrainable uniforms: + * "uCenter" - The center point of the shear effect in screen coordinates + * "uAngleXAxis" - The angle of the shear effect in the X axis + * "uAngleYAxis" - The angle of the shear effect in the Y axis + * + * @return A handle to a newly allocated ShaderEffect */ -class DALI_IMPORT_API ShearEffect : public ShaderEffect +inline ShaderEffect CreateShearEffect() { -public: - - /** - * Create an uninitialized ShearEffect; this can be initialized with ShearEffect::New() - * Calling member functions with an uninitialized Dali::Object is not allowed. - */ - ShearEffect(); - - /** - * @brief Destructor - * - * This is non-virtual since derived Handle types must not contain data or virtual methods. - */ - ~ShearEffect(); - - /** - * Create an initialized ShearEffect. - * @return A handle to a newly allocated Dali resource. - */ - static ShearEffect New(); - - /** - * Set the center point of the shear effect in screen coordinates. - * @param [in] center The new center point. - */ - void SetCenter(const Vector2& center); - - /** - * Set the angle of the shear effect in the X axis. - * @param [in] angle The new angle. - */ - void SetAngleXAxis(float angle); - - /** - * Set the angle of the shear effect in the Y axis. - * @param [in] angle The new angle. - */ - void SetAngleYAxis(float angle); - - /** - * Get the name for the center property - * @return A std::string containing the property name - */ - const std::string& GetCenterPropertyName() const; - - /** - * Get the name for the X axis property - * @return A std::string containing the property name - */ - const std::string& GetAngleXAxisPropertyName() const; - - /** - * Get the name for the Y axis property - * @return A std::string containing the property name - */ - const std::string& GetAngleYAxisPropertyName() const; - - -private: // Not intended for application developers - DALI_INTERNAL ShearEffect(ShaderEffect handle); -}; + // append the default version + std::string vertexShader( + "uniform mediump vec2 uCenter;\n" + "uniform mediump float uAngleXAxis;\n" + "uniform mediump float uAngleYAxis;\n" + "\n" + "void main()\n" + "{\n" + "mediump vec4 world = uModelView * vec4(aPosition,1.0);\n" + "\n" + "world.x = world.x + tan(radians(uAngleXAxis)) * (world.y - uCenter.y * world.w);\n" + "world.y = world.y + tan(radians(uAngleYAxis)) * (world.x - uCenter.x * world.w);\n" + "\n" + "gl_Position = uProjection * world;\n" + "\n" + "vTexCoord = aTexCoord;\n" + "}" ); + + // Create the implementation, temporarily owned on stack, + ShaderEffect shaderEffect = Dali::ShaderEffect::New( + vertexShader, + "", + ShaderEffect::GeometryHints( ShaderEffect::HINT_GRID )); + + + shaderEffect.SetUniform( "uCenter", Vector2(0.0f, 0.0f), ShaderEffect::COORDINATE_TYPE_VIEWPORT_POSITION ); + shaderEffect.SetUniform( "uAngleXAxis", 0.0f); + shaderEffect.SetUniform( "uAngleYAxis", 0.0f); + + return shaderEffect; +} } // namespace Toolkit