本文整理汇总了C++中Stage::GetRenderTaskList方法的典型用法代码示例。如果您正苦于以下问题:C++ Stage::GetRenderTaskList方法的具体用法?C++ Stage::GetRenderTaskList怎么用?C++ Stage::GetRenderTaskList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Stage
的用法示例。
在下文中一共展示了Stage::GetRenderTaskList方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UtcDaliMagnifierSetSourceActorP
int UtcDaliMagnifierSetSourceActorP(void)
{
ToolkitTestApplication application;
Stage stage = Stage::GetCurrent();
Magnifier view = Magnifier::New();
stage.Add( view );
application.SendNotification();
application.Render();
RenderTaskList renderTaskList = stage.GetRenderTaskList();
DALI_TEST_CHECK( renderTaskList.GetTaskCount() > 1 );
Actor actor = Actor::New();
stage.Add( actor );
DALI_TEST_CHECK( stage.GetRenderTaskList().GetTask( 1 ).GetSourceActor() != actor );
view.SetSourceActor( actor );
application.SendNotification();
application.Render();
DALI_TEST_EQUALS( stage.GetRenderTaskList().GetTask( 1 ).GetSourceActor(), actor, TEST_LOCATION );
END_TEST;
}
示例2: UtcDaliHoverOffscreenRenderTasks
int UtcDaliHoverOffscreenRenderTasks(void)
{
TestApplication application;
Stage stage ( Stage::GetCurrent() );
Vector2 stageSize ( stage.GetSize() );
// FrameBufferImage for offscreen RenderTask
FrameBufferImage frameBufferImage( FrameBufferImage::New( stageSize.width, stageSize.height, Pixel::RGBA8888 ) );
// Create a renderable actor to display the FrameBufferImage
Actor renderableActor = CreateRenderableActor( frameBufferImage );
renderableActor.SetParentOrigin(ParentOrigin::CENTER);
renderableActor.SetSize( stageSize.x, stageSize.y );
renderableActor.ScaleBy( Vector3(1.0f, -1.0f, 1.0f) ); // FIXME
stage.Add( renderableActor );
Actor actor = Actor::New();
actor.SetSize(100.0f, 100.0f);
actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
stage.Add( actor );
application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE ); // Ensure framebuffer connects
stage.GetRenderTaskList().GetTask( 0u ).SetScreenToFrameBufferFunction( RenderTask::FULLSCREEN_FRAMEBUFFER_FUNCTION );
// Create a RenderTask
RenderTask renderTask = stage.GetRenderTaskList().CreateTask();
renderTask.SetSourceActor( actor );
renderTask.SetTargetFrameBuffer( frameBufferImage );
renderTask.SetInputEnabled( true );
// Create another RenderTask
RenderTask renderTask2( stage.GetRenderTaskList().CreateTask() );
renderTask2.SetInputEnabled( true );
// Render and notify
application.SendNotification();
application.Render();
// Connect to actor's hovered signal
SignalData data;
HoverEventFunctor functor( data );
actor.HoveredSignal().Connect( &application, functor );
// Emit a started signal
application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, Vector2( 10.0f, 10.0f ) ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
data.Reset();
END_TEST;
}
示例3: HitTest
bool HitTest( Stage& stage, const Vector2& screenCoordinates, Results& results, HitTestInterface& hitTestInterface )
{
bool wasHit( false );
// Hit-test the system-overlay actors first
SystemOverlay* systemOverlay = stage.GetSystemOverlayInternal();
if ( systemOverlay )
{
RenderTaskList& overlayTaskList = systemOverlay->GetOverlayRenderTasks();
LayerList& overlayLayerList = systemOverlay->GetLayerList();
wasHit = HitTestForEachRenderTask( stage, overlayLayerList, overlayTaskList, screenCoordinates, results, hitTestInterface );
}
// Hit-test the regular on-stage actors
if ( !wasHit )
{
RenderTaskList& taskList = stage.GetRenderTaskList();
LayerList& layerList = stage.GetLayerList();
wasHit = HitTestForEachRenderTask( stage, layerList, taskList, screenCoordinates, results, hitTestInterface );
}
return wasHit;
}
示例4: UtcDaliHitTestAlgorithmOrtho02
int UtcDaliHitTestAlgorithmOrtho02(void)
{
TestApplication application;
tet_infoline("Testing Dali::HitTestAlgorithm with offset Ortho camera()");
Stage stage = Stage::GetCurrent();
RenderTaskList renderTaskList = stage.GetRenderTaskList();
RenderTask defaultRenderTask = renderTaskList.GetTask(0u);
Dali::CameraActor cameraActor = defaultRenderTask.GetCameraActor();
Vector2 stageSize ( stage.GetSize() );
cameraActor.SetOrthographicProjection(-stageSize.x * 0.3f, stageSize.x * 0.7f,
stageSize.y * 0.3f, -stageSize.y * 0.7f,
800.0f, 4895.0f);
cameraActor.SetPosition(0.0f, 0.0f, 1600.0f);
Vector2 actorSize( stageSize * 0.5f );
// Create two actors with half the size of the stage and set them to be partially overlapping
Actor blue = Actor::New();
blue.SetName( "Blue" );
blue.SetAnchorPoint( AnchorPoint::TOP_LEFT );
blue.SetParentOrigin( Vector3(0.2f, 0.2f, 0.5f) );
blue.SetSize( actorSize );
blue.SetZ(30.0f);
Actor green = Actor::New( );
green.SetName( "Green" );
green.SetAnchorPoint( AnchorPoint::TOP_LEFT );
green.SetParentOrigin( Vector3(0.4f, 0.4f, 0.5f) );
green.SetSize( actorSize );
// Add the actors to the view
stage.Add( blue );
stage.Add( green );
// Render and notify
application.SendNotification();
application.Render(0);
application.Render(10);
HitTestAlgorithm::Results results;
HitTest(stage, Vector2( 240.0f, 400.0f ), results, &DefaultIsActorTouchableFunction);
DALI_TEST_CHECK( results.actor == green );
DALI_TEST_EQUALS( results.actorCoordinates, actorSize * 0.6f, TEST_LOCATION );
HitTest(stage, Vector2::ZERO, results, &DefaultIsActorTouchableFunction);
DALI_TEST_CHECK( results.actor == blue );
DALI_TEST_EQUALS( results.actorCoordinates, Vector2::ZERO, TEST_LOCATION );
HitTest(stage, stageSize, results, &DefaultIsActorTouchableFunction);
DALI_TEST_CHECK( ! results.actor );
DALI_TEST_EQUALS( results.actorCoordinates, Vector2::ZERO, TEST_LOCATION );
// Just inside green
HitTest(stage, stageSize*0.69f, results, &DefaultIsActorTouchableFunction);
DALI_TEST_CHECK( results.actor == green );
DALI_TEST_EQUALS( results.actorCoordinates, actorSize * 0.98f, TEST_LOCATION );
END_TEST;
}
示例5: UtcDaliStageGetRenderTaskListP
int UtcDaliStageGetRenderTaskListP(void)
{
TestApplication app;
Stage stage = Stage::GetCurrent();
// Check we get a valid instance.
const RenderTaskList& tasks = stage.GetRenderTaskList();
// There should be 1 task by default.
DALI_TEST_EQUALS( tasks.GetTaskCount(), 1u, TEST_LOCATION );
// RenderTaskList has it's own UTC tests.
// But we can confirm that GetRenderTaskList in Stage retrieves the same RenderTaskList each time.
RenderTask newTask = stage.GetRenderTaskList().CreateTask();
DALI_TEST_EQUALS( stage.GetRenderTaskList().GetTask( 1 ), newTask, TEST_LOCATION );
END_TEST;
}
示例6: OnRenderFinished
// clear the resources created for the off screen rendering
void BubbleEmitter::OnRenderFinished(RenderTask& source)
{
mRenderTaskRunning = false;
Actor sourceActor = source.GetSourceActor();
if( sourceActor )
{
ImageActor renderable = ImageActor::DownCast( sourceActor );
if( renderable )
{
renderable.RemoveShaderEffect();
}
}
Stage stage = Stage::GetCurrent();
stage.Remove(sourceActor);
stage.GetRenderTaskList().RemoveTask(source);
}
示例7: InitializeRenderTask
void Magnifier::InitializeRenderTask()
{
Stage stage = Stage::GetCurrent();
RenderTaskList taskList = stage.GetRenderTaskList();
mTask = taskList.CreateTask();
mTask.SetInputEnabled(false);
mTask.SetClearColor(Vector4(0.5f, 0.5f, 0.5f, 1.0f));
mTask.SetClearEnabled(true);
mCameraActor = CameraActor::New();
mCameraActor.SetType(Camera::FREE_LOOK);
mCameraActor.SetRotation(Quaternion(M_PI, Vector3::YAXIS)); // Look at stage
stage.Add(mCameraActor);
mTask.SetCameraActor( mCameraActor );
SetFrameVisibility(true);
}
示例8: UtcDaliStageGetRenderTaskListN
int UtcDaliStageGetRenderTaskListN(void)
{
TestApplication app;
Stage stage;
// Check that getting the render task list with a bad stage instance causes an assert.
bool asserted = false;
try
{
stage.GetRenderTaskList();
}
catch( Dali::DaliException& e )
{
DALI_TEST_PRINT_ASSERT( e );
DALI_TEST_ASSERT( e, "stage && \"Stage handle is empty\"", TEST_LOCATION );
asserted = true;
}
DALI_TEST_CHECK( asserted );
END_TEST;
}
示例9: UtcDaliHitTestAlgorithmWithFunctorOnRenderTask
int UtcDaliHitTestAlgorithmWithFunctorOnRenderTask(void)
{
TestApplication application;
tet_infoline("Testing Dali::HitTestAlgorithm functor, specific to a given render task");
Stage stage = Stage::GetCurrent();
Size stageSize = stage.GetSize();
RenderTaskList taskList = stage.GetRenderTaskList();
Actor actor[2];
for( int i=0; i<2; i++ )
{
actor[i] = Actor::New();
actor[i].SetSize(100.f, 100.f);
actor[i].SetParentOrigin(ParentOrigin::TOP_LEFT);
actor[i].SetAnchorPoint(AnchorPoint::TOP_LEFT);
actor[i].SetName("HittableActor");
stage.Add(actor[i]);
}
Vector2 position( 50.f, 40.f );
actor[1].SetPosition( position.x, position.y );
RenderTask renderTask[2];
renderTask[0] = taskList.GetTask( 0u );
FrameBufferImage frameBufferImage = FrameBufferImage::New(stageSize.width, stageSize.height, Pixel::A8, Image::Never);
renderTask[1] = taskList.CreateTask();
renderTask[1].SetSourceActor( actor[1] );
renderTask[1].SetExclusive( true );
renderTask[1].SetInputEnabled( true );
renderTask[1].SetTargetFrameBuffer( frameBufferImage );
renderTask[1].SetRefreshRate( RenderTask::REFRESH_ONCE );
renderTask[1].SetScreenToFrameBufferFunction( RenderTask::FULLSCREEN_FRAMEBUFFER_FUNCTION );
// Render and notify
application.SendNotification();
application.Render();
application.Render();
application.SendNotification();
// Perform a hit-test at the given screen coordinates with different render tasks
Dali::HitTestAlgorithm::Results results;
Vector2 screenCoordinates( 25.f, 25.f );
Dali::HitTestAlgorithm::HitTest( renderTask[0], screenCoordinates, results, IsActorHittableFunction );
DALI_TEST_CHECK( results.actor == actor[0] );
DALI_TEST_EQUALS( screenCoordinates, results.actorCoordinates, 0.1f, TEST_LOCATION );
results.actor = Actor();
results.actorCoordinates = Vector2::ZERO;
Dali::HitTestAlgorithm::HitTest( renderTask[1], screenCoordinates, results, IsActorHittableFunction );
DALI_TEST_CHECK( !results.actor );
DALI_TEST_EQUALS( Vector2::ZERO, results.actorCoordinates, 0.1f, TEST_LOCATION );
screenCoordinates.x = 80.f;
screenCoordinates.y = 70.f;
results.actor = Actor();
results.actorCoordinates = Vector2::ZERO;
Dali::HitTestAlgorithm::HitTest( renderTask[0], screenCoordinates, results, IsActorHittableFunction );
DALI_TEST_CHECK( results.actor == actor[0] );
DALI_TEST_EQUALS( screenCoordinates, results.actorCoordinates, 0.1f, TEST_LOCATION );
results.actor = Actor();
results.actorCoordinates = Vector2::ZERO;
Dali::HitTestAlgorithm::HitTest( renderTask[1], screenCoordinates, results, IsActorHittableFunction );
DALI_TEST_CHECK( results.actor == actor[1]);
DALI_TEST_EQUALS( screenCoordinates - position, results.actorCoordinates, 0.1f, TEST_LOCATION );
screenCoordinates.x = 120.f;
screenCoordinates.y = 130.f;
results.actor = Actor();
results.actorCoordinates = Vector2::ZERO;
Dali::HitTestAlgorithm::HitTest( renderTask[0], screenCoordinates, results, IsActorHittableFunction );
DALI_TEST_CHECK( results.actor == actor[1] );
DALI_TEST_EQUALS( screenCoordinates - position, results.actorCoordinates, 0.1f, TEST_LOCATION );
results.actor = Actor();
results.actorCoordinates = Vector2::ZERO;
Dali::HitTestAlgorithm::HitTest( renderTask[1], screenCoordinates, results, IsActorHittableFunction );
DALI_TEST_CHECK( results.actor == actor[1]);
DALI_TEST_EQUALS( screenCoordinates - position, results.actorCoordinates, 0.1f, TEST_LOCATION );
END_TEST;
}
示例10: UtcDaliHoverOutsideCameraNearFarPlanes
int UtcDaliHoverOutsideCameraNearFarPlanes(void)
{
TestApplication application;
Stage stage = Stage::GetCurrent();
Vector2 stageSize = stage.GetSize();
Actor actor = Actor::New();
actor.SetSize(100.0f, 100.0f);
actor.SetAnchorPoint(AnchorPoint::CENTER);
actor.SetParentOrigin(ParentOrigin::CENTER);
stage.Add(actor);
// Render and notify
application.SendNotification();
application.Render();
// Get the camera's near and far planes
RenderTaskList taskList = stage.GetRenderTaskList();
Dali::RenderTask task = taskList.GetTask(0);
CameraActor camera = task.GetCameraActor();
float nearPlane = camera.GetNearClippingPlane();
float farPlane = camera.GetFarClippingPlane();
// Calculate the current distance of the actor from the camera
float tanHalfFov = tanf(camera.GetFieldOfView() * 0.5f);
float distance = (stageSize.y * 0.5f) / tanHalfFov;
// Connect to actor's hovered signal
SignalData data;
HoverEventFunctor functor( data );
actor.HoveredSignal().Connect( &application, functor );
Vector2 screenCoordinates( stageSize.x * 0.5f, stageSize.y * 0.5f );
// Emit a started signal
application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, screenCoordinates ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
data.Reset();
// Emit a started signal where actor is just at the camera's near plane
actor.SetZ(distance - nearPlane);
// Render and notify
application.SendNotification();
application.Render();
application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, screenCoordinates ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
data.Reset();
// Emit a started signal where actor is closer than the camera's near plane
actor.SetZ((distance - nearPlane) + 1.0f);
// Render and notify
application.SendNotification();
application.Render();
application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, screenCoordinates ) );
DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
data.Reset();
// Emit a started signal where actor is just at the camera's far plane
actor.SetZ(distance - farPlane);
// Render and notify
application.SendNotification();
application.Render();
application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, screenCoordinates ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
data.Reset();
// Emit a started signal where actor is further than the camera's far plane
actor.SetZ((distance - farPlane) - 1.0f);
// Render and notify
application.SendNotification();
application.Render();
application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, screenCoordinates ) );
DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
data.Reset();
END_TEST;
}