X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Fpublic-api%2Fshader-effects%2Fmotion-blur-effect.cpp;h=205327ddcf280f5a2f59bfac92660ebccf0ad43f;hp=c28eaa9331a57f72ef13e80d5ab25bd97aca2d6b;hb=68106e2cbb8541c18a77f39770ea7759f44e02a0;hpb=e2eda444afbe82e9591fe198eef339227f90a616 diff --git a/dali-toolkit/public-api/shader-effects/motion-blur-effect.cpp b/dali-toolkit/public-api/shader-effects/motion-blur-effect.cpp index c28eaa9..205327d 100644 --- a/dali-toolkit/public-api/shader-effects/motion-blur-effect.cpp +++ b/dali-toolkit/public-api/shader-effects/motion-blur-effect.cpp @@ -1,20 +1,27 @@ -// -// Copyright (c) 2014 Samsung Electronics Co., Ltd. -// -// Licensed under the Flora License, Version 1.0 (the License); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://floralicense.org/license/ -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an AS IS BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - +/* + * 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// CLASS HEADER #include + +// EXTERNAL INCLUDES +#include +#include + namespace Dali { @@ -73,19 +80,18 @@ MotionBlurEffect::~MotionBlurEffect() { } -MotionBlurEffect MotionBlurEffect::Apply( Actor handle ) +MotionBlurEffect MotionBlurEffect::Apply( RenderableActor renderable ) { MotionBlurEffect newEffect = New( MOTION_BLUR_NUM_SAMPLES ); - handle.SetShaderEffect( newEffect ); + renderable.SetShaderEffect( newEffect ); - Property::Index uModelProperty = newEffect.GetPropertyIndex( MOTION_BLUR_MODEL_LASTFRAME ); + Dali::Property::Index uModelProperty = newEffect.GetPropertyIndex( MOTION_BLUR_MODEL_LASTFRAME ); - Constraint constraint = Constraint::New( uModelProperty, - Source( handle, Actor::WORLD_MATRIX ), - EqualToConstraint() ); + Constraint constraint = Constraint::New( newEffect, uModelProperty, EqualToConstraint() ); + constraint.AddSource( Source( renderable, Actor::Property::WORLD_MATRIX ) ); // and set up constraint. - newEffect.ApplyConstraint( constraint ); + constraint.Apply(); return newEffect; } @@ -94,7 +100,7 @@ MotionBlurEffect MotionBlurEffect::New() return New( MOTION_BLUR_NUM_SAMPLES ); } -MotionBlurEffect MotionBlurEffect::New( const unsigned int numBlurSamples ) +MotionBlurEffect MotionBlurEffect::New( unsigned int numBlurSamples ) { // Dali vertexSource prefix for reference: // precision highp float; @@ -108,6 +114,7 @@ MotionBlurEffect MotionBlurEffect::New( const unsigned int numBlurSamples ) // varying vec2 vTexCoord; std::string vertexSource; vertexSource = + "precision mediump float;\n" "uniform mat4 uModelLastFrame;\n" "uniform float uTimeDelta;\n" @@ -180,7 +187,6 @@ MotionBlurEffect MotionBlurEffect::New( const unsigned int numBlurSamples ) std::string fragmentSource; fragmentSource = "precision mediump float;\n" - "uniform vec2 uObjectFadeStart;\n" "uniform vec2 uObjectFadeEnd;\n" "uniform float uAlphaScale;\n" @@ -221,8 +227,7 @@ MotionBlurEffect MotionBlurEffect::New( const unsigned int numBlurSamples ) "}\n"; // NOTE: we must turn on alpha blending for the actor (HINT_BLENDING) - ShaderEffect shader = ShaderEffect::New( vertexSource, - fragmentSource, + ShaderEffect shader = ShaderEffect::New( vertexSource, fragmentSource, GEOMETRY_TYPE_IMAGE, ShaderEffect::GeometryHints( ShaderEffect::HINT_BLENDING | ShaderEffect::HINT_GRID) ); @@ -325,4 +330,3 @@ const std::string& MotionBlurEffect::GetAlphaScalePropertyName() const } } -