X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fcontrols%2Fmodel3d-view%2Fmodel3d-view-impl.cpp;h=a4f927a4ff481a17a64edca6bfe054ae12bab434;hp=e1e4b6f26f4c2e7cef4b1313096b4ec64e4d9a12;hb=dea624eb348a4926d8761c8a1364f03f9f71acf5;hpb=2194846d573d4c38d9f3a9fca0a5f47edd359959 diff --git a/dali-toolkit/internal/controls/model3d-view/model3d-view-impl.cpp b/dali-toolkit/internal/controls/model3d-view/model3d-view-impl.cpp index e1e4b6f..a4f927a 100644 --- a/dali-toolkit/internal/controls/model3d-view/model3d-view-impl.cpp +++ b/dali-toolkit/internal/controls/model3d-view/model3d-view-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 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. @@ -25,9 +25,8 @@ #include #include #include -#include #include -#include +#include // INTERNAL INCLUDES #include @@ -60,12 +59,11 @@ enum TextureIndex Texture LoadTexture( const char* imageUrl ) { Texture texture; - Dali::BitmapLoader loader = Dali::BitmapLoader::New( imageUrl ); - loader.Load(); - PixelData pixelData = loader.GetPixelData(); - if( pixelData ) + Devel::PixelBuffer pixelBuffer = LoadImageFromFile( imageUrl ); + if( pixelBuffer ) { - texture = Texture::New( TextureType::TEXTURE_2D, pixelData.GetPixelFormat(), pixelData.GetWidth(), pixelData.GetHeight() ); + texture = Texture::New( TextureType::TEXTURE_2D, pixelBuffer.GetPixelFormat(), pixelBuffer.GetWidth(), pixelBuffer.GetHeight() ); + PixelData pixelData = Devel::PixelBuffer::Convert( pixelBuffer ); texture.Upload( pixelData ); texture.GenerateMipmaps(); } @@ -278,7 +276,7 @@ const char* NRMMAP_FRAGMENT_SHADER = MAKE_SHADER( using namespace Dali; Model3dView::Model3dView() - : Control( ControlBehaviour( ACTOR_BEHAVIOUR_NONE ) ) +: Control( ControlBehaviour( CONTROL_BEHAVIOUR_DEFAULT ) ) { mIlluminationType = Toolkit::Model3dView::DIFFUSE_WITH_NORMAL_MAP; @@ -328,6 +326,7 @@ void Model3dView::SetProperty( BaseObject* object, Property::Index index, const { impl.LoadMaterial(); impl.CreateMaterial(); + impl.LoadTextures(); } break; } @@ -425,10 +424,8 @@ Property::Value Model3dView::GetProperty( BaseObject* object, Property::Index in ///////////////////////////////////////////////////////////// -void Model3dView::OnStageConnection( int depth ) +void Model3dView::OnSceneConnection( int depth ) { - Control::OnStageConnection( depth ); - CustomActor self = Self(); self.AddRenderer( mRenderer ); @@ -448,6 +445,8 @@ void Model3dView::OnStageConnection( int depth ) constraint.AddSource( Source( self, Toolkit::Model3dView::Property::LIGHT_POSITION ) ); constraint.Apply(); } + + Control::OnSceneConnection( depth ); } /////////////////////////////////////////////////////////// @@ -535,6 +534,7 @@ void Model3dView::CreateGeometry() { mRenderer.SetGeometry( mMesh ); mRenderer.SetProperty( Renderer::Property::DEPTH_WRITE_MODE, DepthWriteMode::ON ); + mRenderer.SetProperty( Renderer::Property::DEPTH_TEST_MODE, DepthTestMode::ON ); } } }