X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;ds=sidebyside;f=examples%2Fmodel3d-view%2Fmodel3d-view-example.cpp;h=08cb8fa86cddac6bed8a33f804576f16196648e4;hb=fe51b34a968be11d80b032030cf1a20ff8bf7e85;hp=5adb9456ddf2855c76d961a79f802d4d9601001a;hpb=0ecb46ffb2230dc6858d6c46d16eb9852905f162;p=platform%2Fcore%2Fuifw%2Fdali-demo.git diff --git a/examples/model3d-view/model3d-view-example.cpp b/examples/model3d-view/model3d-view-example.cpp index 5adb945..08cb8fa 100644 --- a/examples/model3d-view/model3d-view-example.cpp +++ b/examples/model3d-view/model3d-view-example.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 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. @@ -57,7 +57,16 @@ class Model3dViewController : public ConnectionTracker public: Model3dViewController( Application& application ) - : mApplication( application ) + : mApplication( application ), + mModelCounter( 0 ), + mModel3dView(), + mButtonLayer(), + mTapDetector(), + mIlluminationShader( Model3dView::DIFFUSE ), + mRotationAnimation(), + mLightAnimation(), + mPlaying( false ), + mScaled( false ) { // Connect to the Application's Init signal mApplication.InitSignal().Connect( this, &Model3dViewController::Create ); @@ -76,18 +85,10 @@ public: Vector2 screenSize = stage.GetSize(); //Add background - Toolkit::ImageView backView = Toolkit::ImageView::New(BACKGROUND_IMAGE); - backView.SetAnchorPoint( AnchorPoint::TOP_LEFT ); - stage.Add(backView); - - //Add 3D model control - m3DLayer = Layer::New(); - stage.GetRootLayer().Add(m3DLayer); - - //3D models require 3D based rendering method, so it can use depth buffer, etc. - m3DLayer.SetBehavior(Layer::LAYER_3D); - m3DLayer.SetParentOrigin( ParentOrigin::CENTER ); - m3DLayer.SetAnchorPoint( AnchorPoint::CENTER ); + Toolkit::ImageView backView = Toolkit::ImageView::New( BACKGROUND_IMAGE ); + backView.SetParentOrigin( ParentOrigin::CENTER ); + backView.SetAnchorPoint( AnchorPoint::CENTER ); + stage.Add( backView ); mModelCounter = 0; @@ -100,7 +101,7 @@ public: mModel3dView.SetProperty(Model3dView::Property::LIGHT_POSITION, Vector3(5,10.,0)); - m3DLayer.Add( mModel3dView ); + backView.Add( mModel3dView ); mIlluminationShader = Model3dView::IlluminationType(mModel3dView.GetProperty(Model3dView::Property::ILLUMINATION_TYPE)); @@ -108,7 +109,7 @@ public: mButtonLayer.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); mButtonLayer.SetParentOrigin( ParentOrigin::CENTER ); mButtonLayer.SetAnchorPoint( AnchorPoint::CENTER ); - stage.GetRootLayer().Add(mButtonLayer); + stage.Add(mButtonLayer); // Create button for model changing Toolkit::PushButton editButton = Toolkit::PushButton::New(); @@ -116,7 +117,7 @@ public: editButton.ClickedSignal().Connect( this, &Model3dViewController::OnChangeModelClicked); editButton.SetParentOrigin( ParentOrigin::TOP_LEFT ); editButton.SetAnchorPoint( AnchorPoint::TOP_LEFT ); - editButton.SetLabelText( "Change Model" ); + editButton.SetProperty( Toolkit::Button::Property::LABEL, "Change Model" ); mButtonLayer.Add( editButton ); // Create button for shader changing @@ -125,7 +126,7 @@ public: editButton.ClickedSignal().Connect( this, &Model3dViewController::OnChangeLightingClicked); editButton.SetParentOrigin( ParentOrigin::TOP_RIGHT ); editButton.SetAnchorPoint( AnchorPoint::TOP_RIGHT ); - editButton.SetLabelText( "Change Shader" ); + editButton.SetProperty( Toolkit::Button::Property::LABEL, "Change Shader" ); mButtonLayer.Add( editButton ); // Create button for pause/resume animation @@ -134,7 +135,7 @@ public: editButton.ClickedSignal().Connect( this, &Model3dViewController::OnPauseAnimationsClicked); editButton.SetParentOrigin( ParentOrigin::BOTTOM_CENTER ); editButton.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER ); - editButton.SetLabelText( "Pause Animations" ); + editButton.SetProperty( Toolkit::Button::Property::LABEL, "Pause Animations" ); mButtonLayer.Add( editButton ); //Create animations @@ -281,7 +282,6 @@ private: int mModelCounter; Model3dView mModel3dView; - Layer m3DLayer; Layer mButtonLayer; TapGestureDetector mTapDetector;