X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fvisuals%2Fmesh%2Fmesh-visual.h;h=852d7efbad0805a860d13f9c42f743ff141c882b;hp=67e1fe1ae989595941e733d31f1999cfbcf29124;hb=HEAD;hpb=2795ebddeae62aa7a17c44d3b9448281e5992401 diff --git a/dali-toolkit/internal/visuals/mesh/mesh-visual.h b/dali-toolkit/internal/visuals/mesh/mesh-visual.h index 67e1fe1..d4765e9 100644 --- a/dali-toolkit/internal/visuals/mesh/mesh-visual.h +++ b/dali-toolkit/internal/visuals/mesh/mesh-visual.h @@ -2,7 +2,7 @@ #define DALI_TOOLKIT_INTERNAL_MESH_VISUAL_H /* - * Copyright (c) 2016 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,22 +19,23 @@ */ // EXTERNAL INCLUDES -#include +#include #include +#include // INTERNAL INCLUDES -#include -#include #include +#include +#include namespace Dali { - namespace Toolkit { - namespace Internal { +class MeshVisual; +typedef IntrusivePtr MeshVisualPtr; /** * The visual which renders a 3D object to the control's quad @@ -51,62 +52,63 @@ namespace Internal * | useSoftNormals | BOOLEAN | If true, average normals at points for smooth textures. Default true. | * | lightPosition | VECTOR3 | The position (on stage) of the light | */ -class MeshVisual: public Visual::Base +class MeshVisual : public Visual::Base { public: - /** - * @brief Constructor. + * @brief Create a new mesh visual. * * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object + * @param[in] properties A Property::Map containing settings for this visual + * @return A smart-pointer to the newly allocated visual. */ - MeshVisual( VisualFactoryCache& factoryCache ); + static MeshVisualPtr New(VisualFactoryCache& factoryCache, const Property::Map& properties); +public: // from Visual /** - * @brief A reference counted object may only be deleted by calling Unreference(). + * @copydoc Visual::Base::CreatePropertyMap */ - virtual ~MeshVisual(); - -public: // from Visual + void DoCreatePropertyMap(Property::Map& map) const override; /** - * @copydoc Visual::SetSize + * @copydoc Visual::Base::CreateInstancePropertyMap */ - virtual void SetSize( const Vector2& size ); + void DoCreateInstancePropertyMap(Property::Map& map) const override; +protected: /** - * @copydoc Visual::CreatePropertyMap + * @brief Constructor. + * + * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object */ - virtual void DoCreatePropertyMap( Property::Map& map ) const; - -protected: + MeshVisual(VisualFactoryCache& factoryCache); /** - * @copydoc Visual::DoInitialize + * @brief A reference counted object may only be deleted by calling Unreference(). */ - virtual void DoInitialize( Actor& actor, const Property::Map& propertyMap ); + virtual ~MeshVisual(); /** - * @copydoc Visual::DoSetOnStage + * @copydoc Visual::Base::OnInitialize */ - virtual void DoSetOnStage( Actor& actor ); + void OnInitialize() override; -public: + /** + * @copydoc Visual::Base::DoSetProperties + */ + void DoSetProperties(const Property::Map& propertyMap) override; /** - * Declare whether a texture map should be used for the object, if it's present. Defaults to true. - * @param[in] useTexture boolean declaration. + * @copydoc Visual::Base::OnSetTransform */ - void SetUseTexture( bool useTexture ); + void OnSetTransform() override; /** - * Declare whether a normal map should be used for the object, if it's present. Defaults to true. - * @param[in] useNormalMap boolean declaration. + * @copydoc Visual::Base::DoSetOnScene */ - void SetUseNormalMap( bool useNormalMap ); + void DoSetOnScene(Actor& actor) override; private: - /** * @brief Provide an empty geometry for the visual to use. * @details For use in error cases where the initialisation has failed for varying reasons. @@ -114,11 +116,6 @@ private: void SupplyEmptyGeometry(); /** - * @brief Initialize the visual with the geometry and shader from the cache, if not available, create and save to the cache for sharing. - */ - void InitializeRenderer(); - - /** * @brief Create a shader for the object to use. */ void CreateShader(); @@ -152,16 +149,21 @@ private: */ bool LoadTextures(); -private: + /** + * Helper method to set individual values by index key. + * @param[in] index The index key of the value + * @param[in] value The value + */ + void DoSetProperty(Property::Index index, const Property::Value& value); +private: // Undefined - MeshVisual( const MeshVisual& meshVisual ); + MeshVisual(const MeshVisual& meshVisual); // Undefined - MeshVisual& operator=( const MeshVisual& meshVisual ); + MeshVisual& operator=(const MeshVisual& meshVisual); private: - std::string mObjectUrl; std::string mMaterialUrl; @@ -170,15 +172,15 @@ private: std::string mGlossTextureUrl; std::string mTexturesPath; - Shader mShader; - Geometry mGeometry; + Shader mShader; + Geometry mGeometry; TextureSet mTextureSet; ObjLoader mObjLoader; - Vector3 mSceneCenter; - Vector3 mSceneSize; + Vector3 mSceneCenter; + Vector3 mSceneSize; - Vector3 mLightPosition; + Vector3 mLightPosition; Toolkit::MeshVisual::ShadingMode::Value mShadingMode; bool mUseTexture;