X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-scene3d%2Finternal%2Fcontrols%2Fmodel%2Fmodel-impl.h;h=4dcd5c8ec4d0791635cd97d183233d12828b65fd;hb=refs%2Fchanges%2F45%2F292445%2F12;hp=e5e36d9b5e3f02ca8ad884a63b882cd1ffb327c8;hpb=eccac5f0bf98e362a2d5cfef00598e90f949883d;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-scene3d/internal/controls/model/model-impl.h b/dali-scene3d/internal/controls/model/model-impl.h index e5e36d9..4dcd5c8 100644 --- a/dali-scene3d/internal/controls/model/model-impl.h +++ b/dali-scene3d/internal/controls/model/model-impl.h @@ -20,19 +20,23 @@ // EXTERNAL INCLUDES #include +#include #include #include #include +#include #include #include // INTERNAL INCLUDES #include -#include +#include #include #include #include +#include #include +#include namespace Dali { @@ -45,11 +49,12 @@ namespace Internal /** * @brief Impl class for Model. */ -class Model : public Dali::Toolkit::Internal::Control, public ImageBasedLightObserver +class Model : public Dali::Toolkit::Internal::Control, public LightObserver { public: - using AnimationData = std::pair; - using CameraData = Loader::CameraParameters; + using AnimationData = std::pair; + using CameraData = Loader::CameraParameters; + using BlendShapeModelNodeMap = std::map>; /** * @copydoc Model::New() @@ -59,7 +64,17 @@ public: /** * @copydoc Model::GetModelRoot() */ - const Actor GetModelRoot() const; + const Scene3D::ModelNode GetModelRoot() const; + + /** + * @copydoc Model::AddModelNode() + */ + void AddModelNode(Scene3D::ModelNode modelNode); + + /** + * @copydoc Model::RemoveModelNode() + */ + void RemoveModelNode(Scene3D::ModelNode modelNode); /** * @copydoc Model::SetChildrenSensitive() @@ -126,6 +141,21 @@ public: */ bool ApplyCamera(uint32_t index, Dali::CameraActor camera) const; + /** + * @copydoc Model::FindChildModelNodeByName() + */ + Scene3D::ModelNode FindChildModelNodeByName(std::string_view nodeName); + + /** + * @copydoc Model::RetrieveBlendShapeNames() + */ + void RetrieveBlendShapeNames(std::vector& blendShapeNames) const; + + /** + * @copydoc Model::RetrieveModelNodesByBlendShapeName() + */ + void RetrieveModelNodesByBlendShapeName(std::string_view blendShapeName, std::vector& modelNodes) const; + protected: /** * @brief Constructs a new Model. @@ -156,6 +186,11 @@ private: void OnSceneDisconnection() override; /** + * @copydoc CustomActorImpl::OnSizeSet( const Vector3& size ) + */ + void OnSizeSet(const Vector3& size) override; + + /** * @copydoc Toolkit::Control::GetNaturalSize */ Vector3 GetNaturalSize() override; @@ -182,9 +217,14 @@ private: private: /** + * @brief Create Model Root of this Model class. + */ + void CreateModelRoot(); + + /** * @brief Scales the model to fit the control or to return to original size. */ - void ScaleModel(); + void ScaleModel(bool useCurrentSize); /** * @brief Changes model anchor point to set the model at center or returns to the original model pivot. @@ -194,7 +234,12 @@ private: /** * @brief Changes IBL information of the input node. */ - void CollectRenderableActor(Actor actor); + void UpdateImageBasedLightTextureRecursively(Scene3D::ModelNode node, Dali::Texture diffuseTexture, Dali::Texture specularTexture, float iblScaleFactor, uint32_t specularMipmapLevels); + + /** + * @brief Changes IBL factor of the input node. + */ + void UpdateImageBasedLightScaleFactorRecursively(Scene3D::ModelNode node, float iblScaleFactor); /** * @brief Changes IBL textures of the input node. @@ -215,17 +260,27 @@ private: */ void ApplyCameraTransform(Dali::CameraActor camera) const; -public: // Overrides ImageBasedLightObserver Methods. +public: // Overrides LightObserver Methods. /** - * @copydoc Dali::Scene3D::Internal::ImageBasedLightObserver::NotifyImageBasedLightTexture() + * @copydoc Dali::Scene3D::Internal::LightObserver::NotifyImageBasedLightTexture() */ void NotifyImageBasedLightTexture(Dali::Texture diffuseTexture, Dali::Texture specularTexture, float scaleFactor, uint32_t specularMipmapLevels) override; /** - * @copydoc Dali::Scene3D::Internal::ImageBasedLightObserver::NotifyImageBasedLightScaleFactor() + * @copydoc Dali::Scene3D::Internal::LightObserver::NotifyImageBasedLightScaleFactor() */ void NotifyImageBasedLightScaleFactor(float scaleFactor) override; + /** + * @copydoc Dali::Scene3D::Internal::LightObserver::NotifyLightAdded() + */ + void NotifyLightAdded(uint32_t lightIndex, Scene3D::Light light) override; + + /** + * @copydoc Dali::Scene3D::Internal::LightObserver::NotifyLightRemoved() + */ + void NotifyLightRemoved(uint32_t lightIndex) override; + private: /** * @brief Asynchronously model loading finished. @@ -248,6 +303,11 @@ private: void OnIblLoadComplete(); /** + * @brief Update model root scale when Model size property is updated. + */ + void OnSizeNotification(Dali::PropertyNotification& source); + + /** * @brief Reset Resource loading tasks. */ void ResetResourceTasks(); @@ -277,14 +337,25 @@ private: */ void ResetCameraParameters(); + /** + * @brief Collect ModelNode list by blendshape name + */ + void UpdateBlendShapeNodeMap(); + private: std::string mModelUrl; std::string mResourceDirectoryUrl; - Dali::Actor mModelRoot; + Scene3D::ModelNode mModelRoot; std::vector mAnimations; std::vector mCameraParameters; - std::vector> mRenderableActors; WeakHandle mParentSceneView; + Dali::PropertyNotification mSizeNotification; + + // Light + std::vector mLights; + + // List of ModelNode for name of blend shape. + BlendShapeModelNodeMap mBlendShapeModelNodeMap; // Asynchronous loading variable ModelLoadTaskPtr mModelLoadTask; @@ -294,7 +365,6 @@ private: std::string mDiffuseIblUrl; std::string mSpecularIblUrl; - // TODO: This default texture can be removed after 3D Resource Cache is added. Dali::Texture mDefaultSpecularTexture; Dali::Texture mDefaultDiffuseTexture; Dali::Texture mSceneSpecularTexture;