X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=examples%2Frendering-basic-pbr%2Frendering-basic-pbr-example.cpp;h=17a181db1b5370b65d9a9f7311356f937e20fcad;hb=2e182925204bf3ef9f2a36cbfbf998e79fbafaf5;hp=9d2a9d1ea48e4839a3b53f0fa580b3ed6a3dac88;hpb=e73c5dea0fd58569c54a3384098e343d9449e2bd;p=platform%2Fcore%2Fuifw%2Fdali-demo.git diff --git a/examples/rendering-basic-pbr/rendering-basic-pbr-example.cpp b/examples/rendering-basic-pbr/rendering-basic-pbr-example.cpp index 9d2a9d1..17a181d 100644 --- a/examples/rendering-basic-pbr/rendering-basic-pbr-example.cpp +++ b/examples/rendering-basic-pbr/rendering-basic-pbr-example.cpp @@ -26,7 +26,7 @@ #include "model-skybox.h" #include "model-pbr.h" #include -#include +#include using namespace Dali; using namespace Toolkit; @@ -113,9 +113,9 @@ public: stage.SetBackgroundColor( Color::BLACK ); mAnimation = Animation::New( 1.0f ); mLabel = TextLabel::New( "R:1 M:0" ); - mLabel.SetAnchorPoint( AnchorPoint::TOP_CENTER ); - mLabel.SetParentOrigin( ParentOrigin::TOP_CENTER ); - mLabel.SetSize( stage.GetSize().width * 0.5f, stage.GetSize().height * 0.083f ); + mLabel.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_CENTER ); + mLabel.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_CENTER ); + mLabel.SetProperty( Actor::Property::SIZE, Vector2( stage.GetSize().width * 0.5f, stage.GetSize().height * 0.083f ) ); mLabel.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" ); mLabel.SetProperty( TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" ); mLabel.SetProperty( TextLabel::Property::TEXT_COLOR, Color::WHITE ); @@ -223,9 +223,9 @@ public: const Quaternion yawRot(Radian(Degree(angle2 * -200.0f)), modelOrientation.Rotate( Vector3::YAXIS ) ); mModelOrientation = mModelOrientation * yawRot * pitchRot ; - mSkybox.GetActor().SetOrientation( mModelOrientation ); - actor1.SetOrientation( mModelOrientation ); - actor2.SetOrientation( mModelOrientation ); + mSkybox.GetActor().SetProperty( Actor::Property::ORIENTATION, mModelOrientation ); + actor1.SetProperty( Actor::Property::ORIENTATION, mModelOrientation ); + actor2.SetProperty( Actor::Property::ORIENTATION, mModelOrientation ); mPointZ = point; } @@ -284,25 +284,25 @@ public: mUiRoot = Actor::New(); m3dRoot = Actor::New(); CameraActor cameraUi = CameraActor::New(stage.GetSize()); - cameraUi.SetAnchorPoint(AnchorPoint::CENTER); - cameraUi.SetParentOrigin(ParentOrigin::CENTER); + cameraUi.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::CENTER); + cameraUi.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::CENTER); RenderTask rendertask = Stage::GetCurrent().GetRenderTaskList().CreateTask(); rendertask.SetCameraActor( cameraUi ); rendertask.SetSourceActor( mUiRoot ); - mUiRoot.SetAnchorPoint(AnchorPoint::TOP_LEFT); - mUiRoot.SetParentOrigin(ParentOrigin::TOP_LEFT); - mUiRoot.SetSize(stage.GetSize()); + mUiRoot.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + mUiRoot.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::TOP_LEFT); + mUiRoot.SetProperty( Actor::Property::SIZE, stage.GetSize()); - m3dRoot.SetAnchorPoint(AnchorPoint::CENTER); - m3dRoot.SetParentOrigin(ParentOrigin::CENTER); + m3dRoot.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::CENTER); + m3dRoot.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::CENTER); // Setting camera parameters for 3D Scene - mSkybox.GetActor().SetPosition( CAMERA_DEFAULT_POSITION ); + mSkybox.GetActor().SetProperty( Actor::Property::POSITION, CAMERA_DEFAULT_POSITION ); CameraActor camera3d = stage.GetRenderTaskList().GetTask(0).GetCameraActor(); camera3d.SetInvertYAxis( true ); - camera3d.SetPosition( CAMERA_DEFAULT_POSITION ); + camera3d.SetProperty( Actor::Property::POSITION, CAMERA_DEFAULT_POSITION ); camera3d.SetNearClippingPlane( CAMERA_DEFAULT_NEAR ); camera3d.SetFarClippingPlane( CAMERA_DEFAULT_FAR ); camera3d.SetFieldOfView( Radian( Degree( CAMERA_DEFAULT_FOV ) ) ); @@ -392,15 +392,8 @@ public: */ bool LoadShaderCode( const std::string& fullpath, std::vector& output ) { - std::streampos bufferSize = 0; - Dali::Vector fileBuffer; - if( !Dali::FileLoader::ReadFile( fullpath, bufferSize, fileBuffer, FileLoader::FileType::BINARY ) ) - { - DALI_LOG_WARNING( "file open failed for: \"%s\"", path ); - return false; - } - - FILE* file = fmemopen( &fileBuffer[0], bufferSize, "rb" ); + Dali::FileStream fileStream( fullpath, FileStream::READ | FileStream::BINARY ); + FILE* file = fileStream.GetFile(); if( NULL == file ) { return false; @@ -421,7 +414,7 @@ public: retValue = ( result >= 0 ); } } - fclose( file ); + return retValue; }