X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fcontrols%2Fscene3d-view%2Fscene3d-view-impl.h;h=bc731d34f62780c988eba31099b6289cb1e14bcb;hb=1bc53ac578137a8f0f0ecedb30a6d76dc9d743c2;hp=afe95fd10fe588a3126a07deb81f7654c6578559;hpb=77f26df9824d174eda53dce2fc5440faddcf9f9b;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/controls/scene3d-view/scene3d-view-impl.h b/dali-toolkit/internal/controls/scene3d-view/scene3d-view-impl.h index afe95fd..bc731d3 100644 --- a/dali-toolkit/internal/controls/scene3d-view/scene3d-view-impl.h +++ b/dali-toolkit/internal/controls/scene3d-view/scene3d-view-impl.h @@ -2,7 +2,7 @@ #define DALI_TOOLKIT_INTERNAL_SCENE3D_VIEW_H /* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 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. @@ -19,31 +19,27 @@ */ // EXTERNAL INCLUDES -#include +#include +#include #include #include -#include -#include +#include // INTERNAL INCLUDES -#include #include #include +#include namespace Dali { - namespace Toolkit { - class Scene3dView; namespace Internal { - namespace Gltf { - class Loader; } @@ -54,15 +50,13 @@ class Loader; class Scene3dView : public Control { public: - enum CubeType { - CROSS_HORIZONTAL = 0, // Cross horizontal style cube map - ARRAY_HORIZONTAL, // array horizontal style cube map + CROSS_HORIZONTAL = 0, // Cross horizontal style cube map + ARRAY_HORIZONTAL, // array horizontal style cube map NONE }; - /** * @copydoc Dali::Toolkit::Scene3dView::Scene3dView */ @@ -76,12 +70,12 @@ public: /** * @copydoc Dali::Toolkit::Scene3dView::New( const std::string& filePath ) */ - static Dali::Toolkit::Scene3dView New( const std::string& filePath ); + static Dali::Toolkit::Scene3dView New(const std::string& filePath); /** * @copydoc Dali::Toolkit::Scene3dView::New( const std::string& filePath, const std::string& diffuseTexturePath, const std::string& specularTexturePath, Vector4 scaleFactor ) */ - static Dali::Toolkit::Scene3dView New( const std::string& filePath, const std::string& diffuseTexturePath, const std::string& specularTexturePath, Vector4 scaleFactor ); + static Dali::Toolkit::Scene3dView New(const std::string& filePath, const std::string& diffuseTexturePath, const std::string& specularTexturePath, Vector4 scaleFactor); /** * @copydoc Dali::Toolkit::Scene3dView::CreateScene() @@ -96,7 +90,7 @@ public: /** * @copydoc Dali::Toolkit::Scene3dView::PlayAnimation() */ - bool PlayAnimation( uint32_t index ); + bool PlayAnimation(uint32_t index); /** * @copydoc Dali::Toolkit::Scene3dView::PlayAnimations() @@ -106,7 +100,7 @@ public: /** * @copydoc Dali::Toolkit::Scene3dView::SetLight( Toolkit::Scene3dView::LightType type, Vector3 lightVector, Vector3 lightColor ) */ - bool SetLight( Toolkit::Scene3dView::LightType type, Vector3 lightVector, Vector3 lightColor ); + bool SetLight(Toolkit::Scene3dView::LightType type, Vector3 lightVector, Vector3 lightColor); /** * @brief Set default CameraActor specified in the each scene format specification. @@ -115,24 +109,24 @@ public: * near clipping plane = 0.1, * and camera position = Vector3( 0.0, 0.0, 0.0 ). */ - bool SetDefaultCamera( const Dali::Camera::Type type = Dali::Camera::LOOK_AT_TARGET, const float nearPlane = 0.1, const Vector3 cameraPosition = Vector3( 0.0, 0.0, 0.0 ) ); + bool SetDefaultCamera(const Dali::Camera::Type type = Dali::Camera::LOOK_AT_TARGET, const float nearPlane = 0.1, const Vector3 cameraPosition = Vector3(0.0, 0.0, 0.0)); /** * @brief Add CameraActor loaded from scene format file. */ - void AddCamera( CameraActor cameraActor ); + void AddCamera(CameraActor cameraActor); /** * @brief Add Animation loaded from scene format file. */ - void AddAnimation( Animation animation ); + void AddAnimation(Animation animation); /** * @brief Add new Shader. * Actors can share same Shader if they use same properties. * If a property changes in a shader, then the property of all actors that use the shader change. */ - void AddShader( Shader shader ); + void AddShader(Shader shader); /** * @brief Get Root Actor. @@ -152,7 +146,7 @@ public: /** * @copydoc Dali::Toolkit::Scene3dView::GetCamera( uint32_t cameraIndex ) */ - CameraActor GetCamera( uint32_t cameraIndex ); + CameraActor GetCamera(uint32_t cameraIndex); /** * @brief Get light type. @@ -191,86 +185,90 @@ public: */ Texture GetSpecularTexture(); + /** + * @brief Get whether the scene has image based rendering or not. + */ + bool HasImageBasedLighting(); + private: /** * @brief Get Cropped image buffer. * For each direction, Offset + faceSize must be width or height or less then them. */ - uint8_t* GetCroppedBuffer( uint8_t* sourceBuffer, uint32_t bytesPerPixel, uint32_t width, uint32_t height, uint32_t xOffset, uint32_t yOffset, uint32_t xFaceSize, uint32_t yFaceSize ); + uint8_t* GetCroppedBuffer(uint8_t* sourceBuffer, uint32_t bytesPerPixel, uint32_t width, uint32_t height, uint32_t xOffset, uint32_t yOffset, uint32_t xFaceSize, uint32_t yFaceSize); /** * @brief Upload cube map texture. */ - void UploadTextureFace( Texture& texture, Devel::PixelBuffer pixelBuffer, uint32_t faceIndex ); + void UploadTextureFace(Texture& texture, Devel::PixelBuffer pixelBuffer, uint32_t faceIndex); /** * @brief Set diffuse and specular cube map textures. */ - void SetCubeMap( const std::string& diffuseTexturePath, const std::string& specularTexturePath, Vector4 scaleFactor = Vector4( 1.0, 1.0, 1.0, 1.0 ) ); + void SetCubeMap(const std::string& diffuseTexturePath, const std::string& specularTexturePath, Vector4 scaleFactor = Vector4(1.0, 1.0, 1.0, 1.0)); virtual void OnInitialize(); - /** * @brief Load 2D texture. * @param[in] imageUrl Image URL of the texture. * @param[in] generateMipmaps If generateMipmaps is true, then generate mipmap of this texture. * @return Texture loaded from imageUrl. */ - Texture LoadTexture( const char *imageUrl, bool generateMipmaps ); + Texture LoadTexture(const char* imageUrl, bool generateMipmaps); private: - Actor mRoot; // Root actor that contains scene graph + Actor mRoot; // Root actor that contains scene graph std::string mFilePath; // Full file path of scene file std::vector mShaderArray; // Shader Array to change properties of scene such as lighting. std::vector mCameraActorArray; // CameraActer array loaded from scene format file. - CameraActor mDefaultCamera; // Default CameraActor for the empty mCameraActorArray. + CameraActor mDefaultCamera; // Default CameraActor for the empty mCameraActorArray. std::vector mAnimationArray; // Animation array loaded from scene format file. - Toolkit::Scene3dView::LightType mLightType; // Light type - Vector3 mLightVector; // Light position when mLightType is LightType::POINT_LIGHT - // Light direction when mLightType is LightType::DIRECTIONAL_LIGHT - Vector3 mLightColor; // Light color + Toolkit::Scene3dView::LightType mLightType; // Light type + Vector3 mLightVector; // Light position when mLightType is LightType::POINT_LIGHT + // Light direction when mLightType is LightType::DIRECTIONAL_LIGHT + Vector3 mLightColor; // Light color - Vector4 mIBLScaleFactor; // IBL scaling factor for the IBL rendering - Texture mBRDFTexture; // BRDF texture for the PBR rendering + Vector4 mIBLScaleFactor; // IBL scaling factor for the IBL rendering + Texture mBRDFTexture; // BRDF texture for the PBR rendering Texture mSpecularTexture; // Specular cube map texture - Texture mDiffuseTexture; // Diffuse cube map texture + Texture mDiffuseTexture; // Diffuse cube map texture + bool mUseIBL; private: - // Undefined copy constructor. - Scene3dView( const Scene3dView& ); + Scene3dView(const Scene3dView&); // Undefined assignment operator. - Scene3dView& operator=( const Scene3dView& ); + Scene3dView& operator=(const Scene3dView&); }; } // namespace Internal - // Helpers for public-api forwarding methods -inline const Internal::Scene3dView& GetImpl( const Toolkit::Scene3dView& scene3dView ) +// Helpers for public-api forwarding methods +inline const Internal::Scene3dView& GetImpl(const Toolkit::Scene3dView& scene3dView) { - DALI_ASSERT_ALWAYS( scene3dView && "Scene3dView handle is empty" ); + DALI_ASSERT_ALWAYS(scene3dView && "Scene3dView handle is empty"); const Dali::RefObject& handle = scene3dView.GetImplementation(); - return static_cast( handle ); + return static_cast(handle); } -inline Internal::Scene3dView& GetImpl( Toolkit::Scene3dView& scene3dView ) +inline Internal::Scene3dView& GetImpl(Toolkit::Scene3dView& scene3dView) { - DALI_ASSERT_ALWAYS( scene3dView && "Scene3dView handle is empty" ); + DALI_ASSERT_ALWAYS(scene3dView && "Scene3dView handle is empty"); Dali::RefObject& handle = scene3dView.GetImplementation(); - return static_cast( handle ); + return static_cast(handle); } -}//namespace Toolkit +} //namespace Toolkit -}//namespace Dali +} //namespace Dali #endif // DALI_TOOLKIT_INTERNAL_SCENE3D_VIEW_H