static StyleMonitor Get();
~StyleMonitor();
static StyleMonitor DownCast( BaseHandle handle );
- using BaseHandle::operator=;
public: // Style Information
std::string GetDefaultFontFamily() const;
Timer& operator=( const Timer& timer );
~Timer();
static Timer DownCast( BaseHandle handle );
- using BaseHandle::operator=;
void Start();
void Stop();
void SetInterval( unsigned int milliSec );
// special field 'effect' references the shader effect instances
if(key == "effect")
{
- Actor actor = Actor::DownCast(handle);
- OptionalString s = constant.IsString( keyChild.second );
- if(actor && s)
+ RenderableActor actor = RenderableActor::DownCast(handle);
+ if( actor )
{
- ShaderEffect e = GetShaderEffect(*s, constant);
- actor.SetShaderEffect(e);
+ OptionalString str = constant.IsString( keyChild.second );
+ if( str )
+ {
+ ShaderEffect effect = GetShaderEffect( *str, constant );
+ actor.SetShaderEffect(effect);
+ }
}
else
{
if( Property::INVALID_INDEX == index )
{
- Actor actor = Actor::DownCast(propertyObject);
+ RenderableActor actor = RenderableActor::DownCast(handle);
if( actor )
{
if( ShaderEffect effect = actor.GetShaderEffect() )
{
mHighlightMeshActor = MeshActor::New( mTextHighlight.CreateHighLightMesh() );
mHighlightMeshActor.SetName( "HighlightMeshActor" );
- mHighlightMeshActor.SetInheritShaderEffect( false );
mHighlightMeshActor.SetAffectedByLighting(false);
parent.Add( mHighlightMeshActor );
}
mHighlightMeshActor = MeshActor::New( mHighlightMesh );
mHighlightMeshActor.SetName( "HighlightMeshActor" );
- mHighlightMeshActor.SetInheritShaderEffect( false );
mHighlightMeshActor.SetParentOrigin( ParentOrigin::TOP_LEFT );
mHighlightMeshActor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
mHighlightMeshActor.SetPosition( 0.0f, 0.0f, DISPLAYED_HIGHLIGHT_Z_OFFSET );
* - \link boost-library Boost Library \endlink
* - \link boost-function Boost function usage \endlink
*
+ * \section Rendering
+ * - \link viewing-modes Viewing modes \endlink
+ *
* \section Profiling
* - \link resource-tracking Resource Tracking \endlink
* - \link performance-profiling Performance Profiling \endlink
--- /dev/null
+/*! \page viewing-modes Viewing modes
+ *
+ *
+ * <h2 class="pg">Introduction</h2>
+ *
+ * DALi supports multiple viewing modes: <br>
+* <ul>
+* <li>MONO <br>
+* <li>STEREO_HORIZONTAL <br>
+* <li>STEREO_VERTICAL <br>
+* </ul>
+* MONO is the default viewing mode. When using MONO mode, only one image of the scene is produced in every update. In this setup, DALi will create a default render task, which will render everything added to the stage root layer, and one default camera for that render task.<br><br>
+* STEREO_HORIZONTAL and STEREO_VERTICAL allow the application to produce stereo images. Stereo rendering techniques produce two images of the scene with an slight offset between them which will be presented to the left and the right eye independently. In this setup, DALi will create two additional render tasks, one for the right eye and one for the left, each with it's own camera. Those cameras will be parented to the default camera. The method to generate the projection transformation for each camera is known as "parallel axis asymmetric frustum perspective projection" and is illustrated in the image below.<br><br>
+
+* \image html viewing-modes/stereo-projection.png
+
+* <br>The separation between the two cameras is configurable, but, typically, it should range between 50 and 70 millimeters. Too large a separation can be hard to resolve and is known as hyperstereo. The convergence plane for both frustums is the 2D plane, so, the projection of anything lying in the 2D plane will be coincident for both left and right eyes, hence zero parallax. Objects that lie in front of the projection plane will appear to be in front of the screen and object behind the projection plane will appear to be "into" the screen. Object behind the projection plane ( positive parallax ) are easier to look and minimises eye strain.<br>
+
+ * In order to view stereoscopic images correctly, each image must be presented to each eye independently. There exist devices in the market for this, like head-mounted displays, which is a display device, worn in the head, that have two small displays, one for each eye. A cheaper alternative to this often expensive devices is Google's cardboard viewer.<br>
+ * \image html viewing-modes/google-cardboard.png
+ *<br>With Google cardboard, or some similar device, you can transform your phone into a basic virtual reality headset.
+ *
+ * <h2 class="pg">Stereoscopic rendering in DALi</h2>
+ * STEREO_HORIZONTAL mode will present the left image on the top half of the screen and the right image on the bottom half. It is intended to be used in landspace orientation, so the images are rotated 90 degrees counterclockwise. STEREO_VERTICAL mode, on the other hand, will render the left image on the left half of the screen and the right image on the right side.<br><br>
+*
+*To define the viewing mode to be used, applications can use the function Dali::Application::SetViewMode defined in the Application class, passing as the parameter which mode to use. It is possible for an application to query which view mode is being used by calling the funcion Dali::Application::GetViewMode. To define the separation between the left and right cameras, the application can use the function Dali::Application::SetStereoBase, passing as a parameter the distance in millimeters. This distance can be queried using Dali::Application::GetStereoBase.<br>
+*It is also possible to set the viewing mode and offset at initialization time using two command-line arguments for this purpose: --view-mode ( or -v ) and 0 for MONO, 1 for STEREO_HORIZONTAL, 2 for STEREO_VERTICAL, and --stereo-base ( or --s ) and the separation in millimeters.<br><br>
+
+* <h2 class="pg">Considerations</h2>
+*There are a some restrictions to be aware of when writing stereoscopic applications using DALi.
+
+<ul>
+* <li>When stereo mode is selected, the default's render task source actor will be set to an uninitialized actor so it doesn't render anything. Changing the default's render task source actor later on will produce undesired results, as you, typically, do not want to see anything rendered by the default camera when stereo mode is on.<br>
+
+* <li>Stereo cameras are parented to the default camera, so if the application need to change camera position or orientation it will need to change the default camera transformation. The handle to the default camera can be obtained form the default render task as shown below.<br>
+ * @code
+ * Dali::RenderTask defaultRenderTask = Dali::Stage::GetCurrent().GetRenderTaskList().GetTask(0);
+ * Dali::CameraActor defaultCamera = defaultRenderTask.GetCameraActor();
+ * @endcode
+
+* <li>Stereo render tasks will render everything added to the stage's root layer. If the application need to render any object hierarchy to an off-screen buffer, it will have to set the exclusive flag on that render task so stereo tasks doesn't render that particular subtree. To set the exclusive flag in a render task, the application can call the method Dali::RenderTask::SetExclusive defined in the render task.<br>
+*</ul>
+ *
+ */
// clear the resources created for the off screen rendering
void BubbleEmitter::OnRenderFinished(RenderTask& source)
{
- Actor sourceActor = source.GetSourceActor();
- sourceActor.RemoveShaderEffect();
+ Actor sourceActor = source.GetSourceActor();
+ if( sourceActor )
+ {
+ RenderableActor renderable = RenderableActor::DownCast( sourceActor );
+ if( renderable )
+ {
+ renderable.RemoveShaderEffect();
+ }
+ }
Stage::GetCurrent().Remove(sourceActor);
- sourceActor.Reset();
Stage::GetCurrent().GetRenderTaskList().RemoveTask(source);
}
mImageActor.SetImage( image );
DistanceFieldEffect effect = DistanceFieldEffect::New();
- Self().SetShaderEffect( effect );
+ mImageActor.SetShaderEffect( effect );
}
void ImageView::SetImage(Image image)
}
}
-void PageTurnLandscapeView::SetSpineEffect(Actor actor, bool isLeftSide)
+void PageTurnLandscapeView::SetSpineEffect(ImageActor actor, bool isLeftSide)
{
if(isLeftSide)
{
/**
* @copydoc PageTurnView::SetSpineEffect
*/
- virtual void SetSpineEffect(Actor actor, bool isLeftSide);
+ virtual void SetSpineEffect(ImageActor actor, bool isLeftSide);
private:
}
}
-void PageTurnPortraitView::SetSpineEffect(Actor actor, bool isLeftSide)
+void PageTurnPortraitView::SetSpineEffect(ImageActor actor, bool isLeftSide)
{
if(isLeftSide)
{
// There is previous page and an outwards flick is detected
if( mCurrentPageIndex > 0 && gestureSpeed > GESTURE_SPEED_THRESHOLD && offset.x > fabs( offset.y ))
{
- Actor actor = mPageActors[ (mCurrentPageIndex-1) % NUMBER_OF_CACHED_PAGES ];
+ ImageActor actor = mPageActors[ (mCurrentPageIndex-1) % NUMBER_OF_CACHED_PAGES ];
if(actor.GetParent() != mRootOnScreen)
{
return;
/**
* @copydoc PageTurnView::SetSpineEffect
*/
- virtual void SetSpineEffect(Actor actor, bool isLeftSide);
+ virtual void SetSpineEffect(ImageActor actor, bool isLeftSide);
/**
* @copydoc PageTurnView::OnPossibleOutwardsFlick
mPagePanFinishedSignal.Emit( handle );
- Actor actor = mPanActor;
+ ImageActor actor = mPanActor;
if(mPress)
{
if(!mConstraints) // if with constraints, the pan finished position is near spine, set up an animation to turn the page over
void PageTurnView::TurnedOver( Animation& animation )
{
- Actor actor = mAnimationActorPair[animation];
+ ImageActor actor = mAnimationActorPair[animation];
mIsTurnBack[actor] = !mIsTurnBack[actor];
actor.RemoveConstraints();
mRootOnScreen.Add(actor);
void PageTurnView::SliddenBack( Animation& animation )
{
- Actor actor = mAnimationActorPair[animation];
+ ImageActor actor = mAnimationActorPair[animation];
mRootOnScreen.Add(actor);
int index = mAnimationIndexPair[animation];
mIsSliding[index] = false;
}
}
-void PageTurnView::SetShaderEffect( Actor actor, ShaderEffect shaderEffect )
+void PageTurnView::SetShaderEffect( ImageActor actor, ShaderEffect shaderEffect )
{
- actor.SetShaderEffect( shaderEffect );
-
- if( actor.GetChildCount() > 0 )
- {
- actor.GetChildAt( 0 ).SetShaderEffect(shaderEffect);
- }
+ SetShaderEffectRecursively( actor, shaderEffect );
}
Toolkit::PageTurnView::PageTurnSignal& PageTurnView::PageTurnStartedSignal()
* @param[in] actor The actor which the shader effect would be applied onto
* @param[in] shaderEffect The shader effect to be set to the actor
*/
- void SetShaderEffect( Actor actor, ShaderEffect shaderEffect );
+ void SetShaderEffect( ImageActor actor, ShaderEffect shaderEffect );
private:
* @param[in] actor The current page actor
* @param[in] isLeftSide Which side the current page is located
*/
- virtual void SetSpineEffect(Actor actor, bool isLeftSide) = 0;
+ virtual void SetSpineEffect(ImageActor actor, bool isLeftSide) = 0;
/**
* This method is called when pan finished to detect outwards flick
std::vector<ImageActor> mPageActors; ///< The vector of pages on stage
int mCurrentPageIndex; ///< The index of the current page, between 0 ~ mTotalPageCount-1
- std::map<Actor,bool> mIsTurnBack; ///< The map to keep track the page actor's turning direction
- std::map<Animation, Actor> mAnimationActorPair; ///< The map to keep track which page actor is the animation act on
+ std::map<ImageActor,bool> mIsTurnBack; ///< The map to keep track the page actor's turning direction
+ std::map<Animation,ImageActor> mAnimationActorPair; ///< The map to keep track which page actor is the animation act on
std::map<Animation, int> mAnimationIndexPair; ///< The map to keep track which PageTurnEffect, PanDisplacementProperty, CurrentCenterProperty is used for the animation
int mIndex; ///< The index to keep track which PageTurnEffect, PanDisplacementProperty, CurrentCenterProperty is used for the current panning page
std::vector<bool> mIsAnimating; ///< The boolean vector to keep track which PageTurnEffect, PanDisplacementProperty, CurrentCenterProperty is available for using
const unsigned int TOOLKIT_MAJOR_VERSION = 1;
const unsigned int TOOLKIT_MINOR_VERSION = 0;
-const unsigned int TOOLKIT_MICRO_VERSION = 4;
+const unsigned int TOOLKIT_MICRO_VERSION = 5;
const char * const TOOLKIT_BUILD_DATE = __DATE__ " " __TIME__;
#ifdef DEBUG_ENABLED
{
}
-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 );
Constraint constraint = Constraint::New<Matrix>( uModelProperty,
- Source( handle, Actor::WORLD_MATRIX ),
+ Source( renderable, Actor::WORLD_MATRIX ),
EqualToConstraint() );
// and set up constraint.
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;
* Create a MotionBlurEffect and attach it to the specified actor
* The number of texture samples taken along the motion velocity vector of the
* actor, producing the blur, is set to a default of 8.
+ * @param renderable actor to apply the effect to
* @return A handle to a newly allocated Dali resource.
*/
- static MotionBlurEffect Apply( Actor handle );
+ static MotionBlurEffect Apply( RenderableActor renderable );
/**
* Create an initialized MotionBlurEffect
* @param numBlurSamples The number of texture samples taken along the motion
* velocity vector of the actor, producing the blur. A higher number gives a
* smoother blur but costs more in terms of performance.
+ * @param numBlurSamples to have
* @return A handle to a newly allocated Dali resource.
*/
- static MotionBlurEffect New( const unsigned int numBlurSamples );
+ static MotionBlurEffect New( unsigned int numBlurSamples );
/**
* Set texcoord scale property. This scales the offset for texture samples
{
}
-MotionStretchEffect MotionStretchEffect::Apply( Actor handle )
+MotionStretchEffect MotionStretchEffect::Apply( RenderableActor renderable )
{
MotionStretchEffect newEffect = New();
- handle.SetShaderEffect( newEffect );
+ renderable.SetShaderEffect( newEffect );
Property::Index uModelProperty = newEffect.GetPropertyIndex( MOTION_STRETCH_MODELVIEW_LASTFRAME );
Constraint constraint = Constraint::New<Matrix>( uModelProperty,
- Source( handle, Actor::WORLD_MATRIX ),
+ Source( renderable, Actor::WORLD_MATRIX ),
EqualToConstraint() );
// and set up constraint.
/**
* Create a MotionStretchEffect and attach it to the specified actor
+ * @param renderable actor to apply the effect to
* @return A handle to a newly allocated Dali resource.
*/
- static MotionStretchEffect Apply( Actor handle );
+ static MotionStretchEffect Apply( RenderableActor renderable );
/**
* Set geometry stretch factor property. This scales the amount the geometry
Name: dali-toolkit
Summary: The OpenGLES Canvas Core Library Toolkit
-Version: 1.0.4
+Version: 1.0.5
Release: 1
Group: System/Libraries
License: Apache-2.0