X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=examples%2Frendering-skybox%2Frendering-skybox.cpp;h=4e48b486814c76351619ec9bc0df03ec14df4bfd;hb=b26d446b0cb6a316abc3a79d4fc70d0ae1b7994c;hp=cb8590dd73d365b6c2a686a61c3217af4b07eba0;hpb=312470da17142a335f5f743630b7fc19c0061ead;p=platform%2Fcore%2Fuifw%2Fdali-demo.git diff --git a/examples/rendering-skybox/rendering-skybox.cpp b/examples/rendering-skybox/rendering-skybox.cpp index cb8590d..4e48b48 100644 --- a/examples/rendering-skybox/rendering-skybox.cpp +++ b/examples/rendering-skybox/rendering-skybox.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 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. @@ -147,14 +147,9 @@ public: // The Init signal is received once (only) during the Application lifetime void Create( Application& application ) { - // Disable indicator. - // It avoids reposition the camera to fit with the indicator height. - Dali::Window winHandle = application.GetWindow(); - winHandle.ShowIndicator( Dali::Window::INVISIBLE ); - - // Get a handle to the stage - Stage stage = Stage::GetCurrent(); - stage.SetBackgroundColor( Color::WHITE ); + // Get a handle to the window + Window window = application.GetWindow(); + window.SetBackgroundColor( Color::WHITE ); // Step 1. Setup camera SetupCamera(); @@ -180,7 +175,7 @@ public: PlayAnimation(); // Respond to key events - stage.KeyEventSignal().Connect( this, &TexturedCubeController::OnKeyEvent ); + window.KeyEventSignal().Connect( this, &TexturedCubeController::OnKeyEvent ); } /** @@ -191,7 +186,7 @@ public: */ void OnKeyEvent( const KeyEvent& event ) { - if( event.state == KeyEvent::Down ) + if( event.GetState() == KeyEvent::DOWN ) { if ( IsKey( event, Dali::DALI_KEY_ESCAPE ) || IsKey( event, Dali::DALI_KEY_BACK ) ) { @@ -205,12 +200,12 @@ public: */ void SetupCamera() { - Stage stage = Stage::GetCurrent(); + Window window = mApplication.GetWindow(); - RenderTask renderTask = stage.GetRenderTaskList().GetTask( 0 ); + RenderTask renderTask = window.GetRenderTaskList().GetTask( 0 ); renderTask.SetCullMode( false ); // avoid frustum culling affecting the skybox - mCamera.Initialise( CAMERA_DEFAULT_POSITION, CAMERA_DEFAULT_FOV, CAMERA_DEFAULT_NEAR, CAMERA_DEFAULT_FAR ); + mCamera.Initialise( window, CAMERA_DEFAULT_POSITION, CAMERA_DEFAULT_FOV, CAMERA_DEFAULT_NEAR, CAMERA_DEFAULT_FAR ); } /** @@ -277,9 +272,9 @@ public: { Vector3( -1.0f, 1.0f, 1.0f ), Vector2( 0.0, 0.0 ) }, }; - PropertyBuffer vertexBuffer = PropertyBuffer::New( Property::Map() - .Add( "aPosition", Property::VECTOR3 ) - .Add( "aTexCoord", Property::VECTOR2 ) ); + VertexBuffer vertexBuffer = VertexBuffer::New( Property::Map() + .Add( "aPosition", Property::VECTOR3 ) + .Add( "aTexCoord", Property::VECTOR2 ) ); vertexBuffer.SetData( vertices, sizeof(vertices) / sizeof(Vertex) ); // create indices @@ -367,8 +362,8 @@ public: { Vector3( 1.0f, -1.0f, 1.0f ) } }; - PropertyBuffer vertexBuffer = PropertyBuffer::New( Property::Map() - .Add( "aPosition", Property::VECTOR3 ) ); + VertexBuffer vertexBuffer = VertexBuffer::New( Property::Map() + .Add( "aPosition", Property::VECTOR3 ) ); vertexBuffer.SetData( skyboxVertices, sizeof(skyboxVertices) / sizeof(Vertex) ); mSkyboxGeometry = Geometry::New(); @@ -402,15 +397,15 @@ public: mRenderer.SetProperty( Renderer::Property::DEPTH_WRITE_MODE, DepthWriteMode::ON ); mActor = Actor::New(); - mActor.SetName( "Cube" ); - mActor.SetAnchorPoint( AnchorPoint::CENTER ); - mActor.SetParentOrigin( ParentOrigin::CENTER ); + mActor.SetProperty( Dali::Actor::Property::NAME, "Cube" ); + mActor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER ); + mActor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); mActor.AddRenderer( mRenderer ); - mActor.SetSize( 10.f, 10.f, 10.f ); + mActor.SetProperty( Actor::Property::SIZE, Vector3( 10.f, 10.f, 10.f ) ); - Stage stage = Stage::GetCurrent(); - stage.Add( mActor ); + Window window = mApplication.GetWindow(); + window.Add( mActor ); } /** @@ -440,15 +435,15 @@ public: // The fragment shader will run only is those pixels that have the max depth value. mSkyboxRenderer.SetProperty( Renderer::Property::DEPTH_FUNCTION, DepthFunction::LESS_EQUAL ); - Stage stage = Stage::GetCurrent(); + Window window = mApplication.GetWindow(); mSkyboxActor = Actor::New(); - mSkyboxActor.SetName( "SkyBox" ); - mSkyboxActor.SetAnchorPoint( AnchorPoint::CENTER ); - mSkyboxActor.SetParentOrigin( ParentOrigin::CENTER ); - mSkyboxActor.SetPosition( CAMERA_DEFAULT_POSITION ); + mSkyboxActor.SetProperty( Dali::Actor::Property::NAME, "SkyBox" ); + mSkyboxActor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER ); + mSkyboxActor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); + mSkyboxActor.SetProperty( Actor::Property::POSITION, CAMERA_DEFAULT_POSITION ); mSkyboxActor.AddRenderer( mSkyboxRenderer ); - stage.Add( mSkyboxActor ); + window.Add( mSkyboxActor ); } /**