projects
/
platform
/
core
/
uifw
/
dali-toolkit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[dali_2.3.22] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git]
/
dali-toolkit
/
internal
/
visuals
/
mesh
/
mesh-visual.h
diff --git
a/dali-toolkit/internal/visuals/mesh/mesh-visual.h
b/dali-toolkit/internal/visuals/mesh/mesh-visual.h
index
a07c02b
..
d4765e9
100644
(file)
--- 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
/*
#define DALI_TOOLKIT_INTERNAL_MESH_VISUAL_H
/*
- * Copyright (c) 20
16
Samsung Electronics Co., Ltd.
+ * Copyright (c) 20
21
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.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@
-19,21
+19,23
@@
*/
// EXTERNAL INCLUDES
*/
// EXTERNAL INCLUDES
-#include <
fstream
>
+#include <
dali/public-api/common/intrusive-ptr.h
>
#include <string.h>
#include <string.h>
+#include <fstream>
// INTERNAL INCLUDES
// INTERNAL INCLUDES
-#include <dali-toolkit/internal/visuals/visual-base-impl.h>
#include <dali-toolkit/internal/controls/model3d-view/obj-loader.h>
#include <dali-toolkit/internal/controls/model3d-view/obj-loader.h>
+#include <dali-toolkit/internal/visuals/visual-base-impl.h>
+#include <dali-toolkit/public-api/visuals/mesh-visual-properties.h>
namespace Dali
{
namespace Dali
{
-
namespace Toolkit
{
namespace Toolkit
{
-
namespace Internal
{
namespace Internal
{
+class MeshVisual;
+typedef IntrusivePtr<MeshVisual> MeshVisualPtr;
/**
* The visual which renders a 3D object to the control's quad
/**
* The visual which renders a 3D object to the control's quad
@@
-45,85
+47,68
@@
namespace Internal
* | objectUrl | STRING | A URL to the .obj file |
* | materialUrl | STRING | A URL to the .mtl file |
* | texturesPath | STRING | A URL of the path to the texture images |
* | objectUrl | STRING | A URL to the .obj file |
* | materialUrl | STRING | A URL to the .mtl file |
* | texturesPath | STRING | A URL of the path to the texture images |
- * | shad
erType | STRING | An enum of shader types
|
+ * | shad
ingMode | STRING | An enum of shading modes
|
* | useMipmapping | BOOLEAN | If true, use mipmaps for textures. Default true. |
* | useSoftNormals | BOOLEAN | If true, average normals at points for smooth textures. Default true. |
* | lightPosition | VECTOR3 | The position (on stage) of the light |
*/
* | useMipmapping | BOOLEAN | If true, use mipmaps for textures. Default true. |
* | 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:
{
public:
-
/**
/**
- * @brief C
onstructor
.
+ * @brief C
reate a new mesh visual
.
*
* @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
*
* @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
-
- /**
- * @copydoc Visual::SetSize
- */
- virtual void SetSize( const Vector2& size );
+ void DoCreatePropertyMap(Property::Map& map) const override;
/**
/**
- * @copydoc Visual::
SetClipRect
+ * @copydoc Visual::
Base::CreateInstancePropertyMap
*/
*/
- v
irtual void SetClipRect( const Rect<int>& clipRect )
;
+ v
oid DoCreateInstancePropertyMap(Property::Map& map) const override
;
+protected:
/**
/**
- * @copydoc Visual::SetOffset
+ * @brief Constructor.
+ *
+ * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
*/
*/
-
virtual void SetOffset( const Vector2& offset
);
+
MeshVisual(VisualFactoryCache& factoryCache
);
/**
/**
- * @
copydoc Visual::CreatePropertyMap
+ * @
brief A reference counted object may only be deleted by calling Unreference().
*/
*/
- virtual void DoCreatePropertyMap( Property::Map& map ) const;
-
-protected:
+ virtual ~MeshVisual();
/**
/**
- * @copydoc Visual::
Do
Initialize
+ * @copydoc Visual::
Base::On
Initialize
*/
*/
- v
irtual void DoInitialize( Actor& actor, const Property::Map& propertyMap )
;
+ v
oid OnInitialize() override
;
/**
/**
- * @copydoc Visual::
DoSetOnStage
+ * @copydoc Visual::
Base::DoSetProperties
*/
*/
- virtual void DoSetOnStage( Actor& actor );
-
-public:
+ 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:
private:
-
- //Corresponds to the shader that will be used by the mesh visual.
- enum ShaderType
- {
- TEXTURELESS,
- DIFFUSE_TEXTURE,
- ALL_TEXTURES
- };
-
/**
* @brief Provide an empty geometry for the visual to use.
* @details For use in error cases where the initialisation has failed for varying reasons.
/**
* @brief Provide an empty geometry for the visual to use.
* @details For use in error cases where the initialisation has failed for varying reasons.
@@
-131,11
+116,6
@@
private:
void SupplyEmptyGeometry();
/**
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();
* @brief Create a shader for the object to use.
*/
void CreateShader();
@@
-169,16
+149,21
@@
private:
*/
bool LoadTextures();
*/
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
// Undefined
- MeshVisual(
const MeshVisual& meshVisual
);
+ MeshVisual(
const MeshVisual& meshVisual
);
// Undefined
// Undefined
- MeshVisual& operator=(
const MeshVisual& meshVisual
);
+ MeshVisual& operator=(
const MeshVisual& meshVisual
);
private:
private:
-
std::string mObjectUrl;
std::string mMaterialUrl;
std::string mObjectUrl;
std::string mMaterialUrl;
@@
-187,16
+172,16
@@
private:
std::string mGlossTextureUrl;
std::string mTexturesPath;
std::string mGlossTextureUrl;
std::string mTexturesPath;
- Shader mShader;
- Geometry mGeometry;
+ Shader
mShader;
+ Geometry
mGeometry;
TextureSet mTextureSet;
ObjLoader mObjLoader;
TextureSet mTextureSet;
ObjLoader mObjLoader;
- Vector3 mSceneCenter;
- Vector3 mSceneSize;
+ Vector3
mSceneCenter;
+ Vector3
mSceneSize;
- Vector3 mLightPosition;
-
ShaderType mShaderTyp
e;
+ Vector3
mLightPosition;
+
Toolkit::MeshVisual::ShadingMode::Value mShadingMod
e;
bool mUseTexture;
bool mUseMipmapping;
bool mUseTexture;
bool mUseMipmapping;