#include <stdlib.h>
#include <dali/public-api/dali-core.h>
+#include <dali/devel-api/actors/mesh-actor.h>
#include <dali-test-suite-utils.h>
#include <stdlib.h>
#include <dali/public-api/dali-core.h>
#include <dali-test-suite-utils.h>
+#include <dali/devel-api/actors/mesh-actor.h>
// Internal headers are allowed here
*/
#include <dali/public-api/dali-core.h>
+#include <dali/devel-api/geometry/mesh.h>
namespace Dali
{
*/
// INTERNAL INCLUDES
-#include <dali/public-api/images/native-image-interface.h>
+#include <dali/devel-api/images/native-image-interface.h>
namespace Dali
{
#include <stdlib.h>
#include <dali/public-api/dali-core.h>
+#include <dali/devel-api/geometry/animatable-mesh.h>
+#include <dali/devel-api/actors/mesh-actor.h>
#include <dali-test-suite-utils.h>
#include <mesh-builder.h>
#include <stdlib.h>
#include <dali/public-api/dali-core.h>
#include <dali/integration-api/bitmap.h>
+#include <dali/devel-api/images/atlas.h>
#include <dali-test-suite-utils.h>
#include <test-native-image.h>
#include <stdlib.h>
#include <dali/public-api/dali-core.h>
+#include <dali/devel-api/animation/path-constrainer.h>
#include <dali-test-suite-utils.h>
using namespace Dali;
#include <stdlib.h>
#include <dali/public-api/dali-core.h>
+#include <dali/devel-api/actors/mesh-actor.h>
#include <dali-test-suite-utils.h>
using namespace Dali;
#include <stdlib.h>
#include <dali/public-api/dali-core.h>
+#include <dali/devel-api/images/distance-field.h>
#include <dali-test-suite-utils.h>
using std::max;
#include <string>
#include <stdlib.h>
-#include <dali/public-api/common/hash.h>
+#include <dali/devel-api/common/hash.h>
#include <dali-test-suite-utils.h>
void utc_dali_hash_startup(void)
#include <stdlib.h>
#include <dali/public-api/dali-core.h>
+#include <dali/devel-api/events/hit-test-algorithm.h>
#include <dali/integration-api/events/touch-event-integ.h>
#include <dali-test-suite-utils.h>
#include <stdlib.h>
#include <dali/public-api/dali-core.h>
+#include <dali/devel-api/actors/mesh-actor.h>
+#include <dali/devel-api/geometry/mesh.h>
+#include <dali/devel-api/geometry/animatable-mesh.h>
#include <dali-test-suite-utils.h>
using namespace Dali;
#include <stdlib.h>
#include <dali/public-api/dali-core.h>
+#include <dali/devel-api/actors/mesh-actor.h>
+#include <dali/devel-api/geometry/mesh.h>
+#include <dali/devel-api/geometry/animatable-mesh.h>
#include <dali-test-suite-utils.h>
using namespace Dali;
#include <stdlib.h>
#include <unistd.h>
#include <dali/public-api/dali-core.h>
+#include <dali/devel-api/common/mutex.h>
#include <dali-test-suite-utils.h>
using Dali::Mutex;
#include <stdlib.h>
#include <dali-test-suite-utils.h>
#include <dali/public-api/dali-core.h>
+#include <dali/devel-api/actors/mesh-actor.h>
+#include <dali/devel-api/geometry/mesh.h>
using namespace Dali;
#include <stdlib.h>
#include <dali/public-api/dali-core.h>
+#include <dali/devel-api/events/hit-test-algorithm.h>
#include <dali-test-suite-utils.h>
#include <dali/integration-api/debug.h>
#include <test-native-image.h>
#include <stdlib.h>
#include <dali/public-api/dali-core.h>
-
+#include <dali/devel-api/actors/mesh-actor.h>
#include <dali/integration-api/events/touch-event-integ.h>
#include <dali-test-suite-utils.h>
#include <stdlib.h>
#include <dali/public-api/dali-core.h>
+#include <dali/devel-api/scripting/scripting.h>
#include <dali-test-suite-utils.h>
using namespace Dali;
#devel api (used by adaptor / toolkit
develapidir = $(devincludepath)/dali/devel-api
develapiactorsdir = $(develapidir)/actors
+develapianimationdir = $(develapidir)/animation
develapicommondir = $(develapidir)/common
develapidynamicsdir = $(develapidir)/dynamics
+develapieventsdir = $(develapidir)/events
+develapigeometrydir = $(develapidir)/geometry
+develapiimagesdir = $(develapidir)/images
+develapimodelingdir = $(develapidir)/modeling
+develapiobjectdir = $(develapidir)/object
+develapiscriptingdir = $(develapidir)/scripting
develapi_HEADERS = $(devel_api_header_files)
+develapiactors_HEADERS = $(devel_api_core_actors_header_files)
+develapianimation_HEADERS = $(devel_api_core_animation_header_files)
develapicommon_HEADERS = $(devel_api_core_common_header_files)
develapidynamics_HEADERS = $(devel_api_core_dynamics_header_files)
+develapievents_HEADERS = $(devel_api_core_events_header_files)
+develapigeometry_HEADERS = $(devel_api_core_geometry_header_files)
+develapiimages_HEADERS = $(devel_api_core_images_header_files)
+develapimodeling_HEADERS = $(devel_api_core_modeling_header_files)
+develapiobject_HEADERS = $(devel_api_core_object_header_files)
+develapiscripting_HEADERS = $(devel_api_core_scripting_header_files)
publicapianimationdir = $(publicapidir)/animation
publicapicommondir = $(publicapidir)/common
publicapieventsdir = $(publicapidir)/events
-publicapigeometrydir = $(publicapidir)/geometry
publicapiimagesdir = $(publicapidir)/images
publicapimathdir = $(publicapidir)/math
-publicapimodelingdir = $(publicapidir)/modeling
publicapiobjectdir = $(publicapidir)/object
publicapirendertasksdir = $(publicapidir)/render-tasks
publicapishadereffectsdir = $(publicapidir)/shader-effects
publicapisignalsdir = $(publicapidir)/signals
-publicapitextdir = $(publicapidir)/text
-publicapiscriptingdir = $(publicapidir)/scripting
+
publicapisizenegotiationdir = $(publicapidir)/size-negotiation
publicapi_HEADERS = $(public_api_header_files)
publicapianimation_HEADERS = $(public_api_core_animation_header_files)
publicapicommon_HEADERS = $(public_api_core_common_header_files)
publicapievents_HEADERS = $(public_api_core_events_header_files)
-publicapigeometry_HEADERS = $(public_api_core_geometry_header_files)
publicapiimages_HEADERS = $(public_api_core_images_header_files)
publicapimath_HEADERS = $(public_api_core_math_header_files)
-publicapimodeling_HEADERS = $(public_api_core_modeling_header_files)
publicapirendertasks_HEADERS = $(public_api_core_render_tasks_header_files)
publicapiobject_HEADERS = $(public_api_core_object_header_files)
-publicapiscripting_HEADERS = $(public_api_core_scripting_header_files)
publicapisizenegotiation_HEADERS = $(public_api_core_size_negotiation_header_files)
publicapishadereffects_HEADERS = $(public_api_core_shader_effects_header_files)
publicapisignals_HEADERS = $(public_api_core_signals_header_files)
-publicapitext_HEADERS = $(public_api_core_text_header_files)
CLEANFILES = dali-shaders.cpp \
dali-shaders.h
--- /dev/null
+/*
+ * Copyright (c) 2015 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include <dali/devel-api/actors/mesh-actor.h>
+
+// INTERNAL INCLUDES
+#include <dali/integration-api/debug.h>
+#include <dali/internal/event/actors/mesh-actor-impl.h>
+#include <dali/internal/event/modeling/mesh-impl.h>
+#include <dali/internal/event/modeling/animatable-mesh-impl.h>
+
+namespace Dali
+{
+
+MeshActor::MeshActor()
+{
+}
+
+MeshActor MeshActor::New()
+{
+ Internal::MeshActorPtr internal = Internal::MeshActor::New();
+ return MeshActor(internal.Get());
+}
+
+MeshActor MeshActor::New( Mesh mesh)
+{
+ Internal::MeshActorPtr internal = Internal::MeshActor::New(mesh);
+ return MeshActor(internal.Get());
+}
+
+MeshActor MeshActor::New( AnimatableMesh mesh)
+{
+ Internal::MeshActorPtr internal = Internal::MeshActor::New(mesh);
+ return MeshActor(internal.Get());
+}
+
+MeshActor MeshActor::DownCast( BaseHandle handle )
+{
+ return MeshActor( dynamic_cast<Dali::Internal::MeshActor*>(handle.GetObjectPtr()) );
+}
+
+MeshActor::~MeshActor()
+{
+}
+
+MeshActor::MeshActor(const MeshActor& copy)
+: RenderableActor(copy)
+{
+}
+
+MeshActor& MeshActor::operator=(const MeshActor& rhs)
+{
+ BaseHandle::operator=(rhs);
+ return *this;
+}
+
+void MeshActor::SetMaterial(
+ Actor actor,
+ const std::string& actorName,
+ Material material)
+{
+ Actor child = actor.FindChildByName(actorName);
+ if(child)
+ {
+ Internal::MeshActor* meshActor = dynamic_cast<Internal::MeshActor*>(&GetImplementation(child));
+ if(meshActor)
+ {
+ meshActor->SetMaterial(material);
+ }
+ }
+ else
+ {
+ DALI_LOG_ERROR("MeshActor::SetMaterial() - Can't find mesh actor\n");
+ }
+}
+
+void MeshActor::SetMaterial(Material material)
+{
+ GetImplementation(*this).SetMaterial(material);
+}
+
+Material MeshActor::GetMaterial() const
+{
+ return GetImplementation(*this).GetMaterial();
+}
+
+void MeshActor::BindBonesToMesh(Actor rootActor)
+{
+ Internal::ActorPtr root(&GetImplementation(rootActor));
+
+ GetImplementation(*this).BindBonesToMesh(root);
+}
+
+MeshActor::MeshActor(Internal::MeshActor* internal)
+ : RenderableActor(internal)
+{
+}
+
+} // namespace Dali
--- /dev/null
+#ifndef __DALI_MESH_ACTOR_H__
+#define __DALI_MESH_ACTOR_H__
+
+/*
+ * Copyright (c) 2015 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+
+// INTERNAL INCLUDES
+#include <dali/public-api/actors/renderable-actor.h>
+
+namespace Dali
+{
+class Material;
+class Mesh;
+class Model;
+class AnimatableMesh;
+
+namespace Internal DALI_INTERNAL
+{
+class MeshActor;
+}
+
+/**
+ * @brief This actor is used to draw a mesh geometry with a material.
+ *
+ * It allows for a custom material to be drawn on the mesh.
+ * By default CullFaceMode is set to CullBack to enable back face culling.
+ */
+class DALI_IMPORT_API MeshActor : public RenderableActor
+{
+public:
+
+ /**
+ * @brief Create an uninitialized MeshActor handle.
+ *
+ * This can be initialised with MeshActor::New().
+ * Calling member functions with an uninitialized Dali::Object is not allowed.
+ */
+ MeshActor();
+
+ /**
+ * @brief Create a MeshActor object.
+ * @return the newly allocated MeshActor object
+ */
+ static MeshActor New();
+
+ /**
+ * @brief Create a MeshActor object.
+ *
+ * @param[in] mesh the Mesh the actor will use.
+ * @return the newly allocated MeshActor object
+ */
+ static MeshActor New( Mesh mesh );
+
+ /**
+ * @brief Create a MeshActor object
+ *
+ * @param[in] mesh the Animated Mesh the actor will use.
+ * @return the newly allocated MeshActor object
+ */
+ static MeshActor New( AnimatableMesh mesh );
+
+ /**
+ * @brief Downcast an Object handle to MeshActor.
+ *
+ * If handle points to a MeshActor the downcast produces a valid
+ * handle. If not the returned handle is left uninitialized.
+ * @param[in] handle to an object
+ * @return handle to a MeshActor or an uninitialized handle
+ */
+ static MeshActor DownCast( BaseHandle handle );
+
+ /**
+ * @brief Destructor
+ *
+ * This is non-virtual since derived Handle types must not contain data or virtual methods.
+ */
+ ~MeshActor();
+
+ /**
+ * @brief Copy constructor
+ *
+ * @param [in] copy The actor to copy.
+ */
+ MeshActor(const MeshActor& copy);
+
+ /**
+ * @brief Assignment operator
+ *
+ * @param [in] rhs The actor to copy.
+ */
+ MeshActor& operator=(const MeshActor& rhs);
+
+ /**
+ * @brief Set a custom material on the given actor or one of it's children.
+ *
+ * @pre the mesh is loaded
+ * @param[in] actor The first actor in the tree of model actors
+ * @param[in] actorName The name of the actor to search for.
+ * @param[in] material The custom material.<br>Pass NULL to revert to the
+ * original material.
+ */
+ static void SetMaterial(Actor actor, const std::string& actorName, Material material);
+
+ /**
+ * @brief Set a custom material on this actor.
+ *
+ * @pre the mesh is loaded
+ * @param[in] material The custom material.@n
+ * Pass an uninitialised Material to revert to the original material.
+ */
+ void SetMaterial(Material material);
+
+ /**
+ * @brief Get the material for this mesh actor.
+ *
+ * @pre the mesh is loaded
+ * @return The material
+ */
+ Material GetMaterial() const;
+
+ /**
+ * @brief Search the actor tree for all named bones in the mesh and connect them.
+ *
+ * @param[in] rootActor The root actor of the actor tree.
+ */
+ void BindBonesToMesh(Actor rootActor);
+
+public: // Not intended for application developers
+
+ /**
+ * @brief This constructor is used by Dali New() methods
+ *
+ * @param [in] actor A pointer to a newly allocated Dali resource
+ */
+ explicit DALI_INTERNAL MeshActor(Internal::MeshActor* actor);
+};
+
+} // namespace Dali
+
+#endif /* _MESH_ACTOR_H_ */
--- /dev/null
+/*
+ * Copyright (c) 2015 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include <dali/devel-api/animation/path-constrainer.h>
+
+// INTERNAL INCLUDES
+#include <dali/internal/event/animation/path-constrainer-impl.h>
+#include <dali/internal/event/animation/path-impl.h>
+
+namespace Dali
+{
+
+PathConstrainer PathConstrainer::New()
+{
+ Internal::PathConstrainer* internal = Internal::PathConstrainer::New();
+ return PathConstrainer(internal);
+}
+
+PathConstrainer PathConstrainer::DownCast( BaseHandle handle )
+{
+ return PathConstrainer( dynamic_cast<Dali::Internal::PathConstrainer*>(handle.GetObjectPtr()) );
+}
+
+PathConstrainer::PathConstrainer()
+{
+}
+
+PathConstrainer::~PathConstrainer()
+{
+}
+
+PathConstrainer::PathConstrainer(const PathConstrainer& handle)
+:Handle(handle)
+{
+}
+
+PathConstrainer::PathConstrainer(Internal::PathConstrainer* internal)
+: Handle(internal)
+{
+}
+
+PathConstrainer& PathConstrainer::operator=(const PathConstrainer& rhs)
+{
+ BaseHandle::operator=(rhs);
+ return *this;
+}
+
+void PathConstrainer::Apply( Dali::Property target, Dali::Property source, const Vector2& range, const Vector2& wrap )
+{
+ GetImplementation(*this).Apply( target, source, range, wrap );
+}
+
+void PathConstrainer::Remove( Dali::Handle& target )
+{
+ GetImplementation(*this).Remove( target );
+}
+
+
+} // Dali
--- /dev/null
+#ifndef __DALI_PATH_CONSTRAINER_H__
+#define __DALI_PATH_CONSTRAINER_H__
+
+/*
+ * Copyright (c) 2015 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+//EXTERNAL INCLUDES
+#include <cfloat> //For FLT_MAX
+
+// INTERNAL INCLUDES
+#include <dali/public-api/animation/path.h>
+#include <dali/public-api/object/handle.h>
+#include <dali/public-api/object/property-index-ranges.h>
+
+namespace Dali
+{
+
+namespace Internal DALI_INTERNAL
+{
+ class PathConstrainer;
+}
+/**
+ * @brief
+ *
+ * PathConstrainer applies constraints to objects to follow a path.
+ * A Vector3 property will be constrained to the position of the path and a Rotation property will be constrained to follow
+ * the tangent of the path given a forward vector in object's local space.
+ *
+ */
+class DALI_IMPORT_API PathConstrainer : public Handle
+{
+public:
+
+ /**
+ * @brief An enumeration of properties belonging to the PathConstrainer class.
+ */
+ struct Property
+ {
+ enum
+ {
+ FORWARD = DEFAULT_OBJECT_PROPERTY_START_INDEX, ///< name "forward" type Vector3
+ POINTS, ///< name "points" type Array of Vector3
+ CONTROL_POINTS ///< name "control-points" type Array of Vector3
+ };
+ };
+
+ /**
+ * @brief Create an initialized PathConstrainer handle.
+ *
+ * @return a handle to a newly allocated Dali resource.
+ */
+ static PathConstrainer New();
+
+ /**
+ * @brief Downcast an Object handle to PathConstrainer handle.
+ *
+ * If handle points to a PathConstrainer object the downcast produces
+ * valid handle. If not the returned handle is left uninitialized.
+ * @param[in] handle to An object
+ * @return handle to a PathConstrainer object or an uninitialized handle
+ */
+ static PathConstrainer DownCast( BaseHandle handle );
+
+ /**
+ * @brief Create an uninitialized PathConstrainer handle.
+ *
+ * This can be initialized with PathConstrainer::New(). Calling member
+ * functions with an uninitialized Dali::Object is not allowed.
+ */
+ PathConstrainer();
+
+ /**
+ * @brief Destructor
+ *
+ * This is non-virtual since derived Handle types must not contain data or virtual methods.
+ */
+ ~PathConstrainer();
+
+ /**
+ * @brief This copy constructor is required for (smart) pointer semantics.
+ *
+ * @param [in] handle A reference to the copied handle
+ */
+ PathConstrainer(const PathConstrainer& handle);
+
+ /**
+ * @brief This assignment operator is required for (smart) pointer semantics.
+ *
+ * @param [in] rhs A reference to the copied handle
+ * @return A reference to this
+ */
+ PathConstrainer& operator=(const PathConstrainer& rhs);
+
+ /**
+ * @brief Applies the path constraint to the target property
+ *
+ * @param[in] target Property to be constrained
+ * @param[in] source Property used as parameter for the path
+ * @param[in] range The range of values in the source property which will be mapped to [0,1]
+ * @param[in] wrap Wrapping domain. Source property will be wrapped in the domain [wrap.x,wrap.y] before mapping to [0,1]
+ */
+ void Apply( Dali::Property target, Dali::Property source, const Vector2& range, const Vector2& wrap = Vector2(-FLT_MAX, FLT_MAX) );
+
+ /**
+ * @brief Removes the path constraint in the target object
+ *
+ * @param[in] target A handle to an object constrained by the PathConstrainer
+ */
+ void Remove( Dali::Handle& target );
+
+public: // Not intended for application developers
+ /**
+ * @brief This constructor is used by Dali::New() methods.
+ *
+ * @param[in] pathConstrainer A pointer to an internal PathConstrainer resource
+ */
+ explicit DALI_INTERNAL PathConstrainer(Internal::PathConstrainer* pathConstrainer);
+};
+
+} // namespace Dali
+
+#endif // __DALI_PATH_CONSTRAINER_H__
--- /dev/null
+/*
+ * Copyright (c) 2015 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include <dali/devel-api/common/hash.h>
+
+namespace Dali
+{
+
+namespace //unnamed namespace
+{
+
+/*
+ * djb2 (http://www.cse.yorku.ca/~oz/hash.html)
+ */
+const std::size_t INITIAL_HASH_VALUE = 5381;
+
+inline void HashString( const char* string, std::size_t& hash )
+{
+ while( int c = *string++ )
+ {
+ hash = hash * 33 + c;
+ }
+}
+
+} // unnamed namespace
+
+std::size_t CalculateHash( const std::string& toHash)
+{
+ std::size_t hash( INITIAL_HASH_VALUE );
+
+ HashString( toHash.c_str(), hash );
+
+ return hash;
+}
+
+std::size_t CalculateHash( const std::string& string1, const std::string& string2 )
+{
+ std::size_t hash( INITIAL_HASH_VALUE );
+
+ HashString( string1.c_str(), hash);
+ HashString( string2.c_str(), hash );
+
+ return hash;
+}
+
+} // namespace Dali
--- /dev/null
+#ifndef __DALI_HASH__
+#define __DALI_HASH__
+
+/*
+ * Copyright (c) 2015 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <string>
+
+//INTERNAL INCLUDES
+#include <dali/public-api/common/dali-common.h>
+
+namespace Dali
+{
+
+/**
+ * @brief Create a hash code for a string
+ * @param toHash string to hash
+ * @return hash code
+ */
+DALI_IMPORT_API std::size_t CalculateHash( const std::string& toHash );
+
+/**
+ * @brief Create a hash code for 2 strings combined.
+ * Allows a hash to be calculated without concatenating the strings and allocating any memory.
+ * @param string1 first string
+ * @param string2 second string
+ * @return hash code
+ */
+DALI_IMPORT_API std::size_t CalculateHash( const std::string& string1, const std::string& string2 );
+
+} // namespace Dali
+
+#endif // __DALI_HASH__
--- /dev/null
+/*
+ * Copyright (c) 2015 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include <dali/devel-api/common/mutex.h>
+
+// EXTERNAL INCLUDES
+#include <pthread.h>
+
+namespace Dali
+{
+
+struct Mutex::MutexImpl
+{
+ pthread_mutex_t mutex;
+ bool locked;
+};
+
+Mutex::Mutex()
+: mImpl( new MutexImpl )
+{
+ pthread_mutex_init( &mImpl->mutex, NULL );
+ mImpl->locked = false;
+}
+
+Mutex::~Mutex()
+{
+ pthread_mutex_destroy( &mImpl->mutex );
+ // nothing else to do as there is no Lock/Unlock API
+ // ScopedLock destructor will always unlock the mutex
+ delete mImpl;
+}
+
+bool Mutex::IsLocked()
+{
+ return mImpl->locked;
+}
+
+Mutex::ScopedLock::ScopedLock( Mutex& mutex )
+: mMutex( mutex )
+{
+ pthread_mutex_lock( &mMutex.mImpl->mutex );
+ mMutex.mImpl->locked = true;
+}
+
+Mutex::ScopedLock::~ScopedLock()
+{
+ pthread_mutex_unlock( &mMutex.mImpl->mutex );
+ mMutex.mImpl->locked = false;
+}
+
+} // namespace Dali
--- /dev/null
+#ifndef __DALI_MUTEX_H__
+#define __DALI_MUTEX_H__
+
+/*
+ * Copyright (c) 2015 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/public-api/common/dali-common.h>
+
+/**
+ * The top level DALi namespace
+ */
+namespace Dali
+{
+
+/**
+ * Class to synchronize access to critical resources from multiple threads
+ */
+class DALI_IMPORT_API Mutex
+{
+public:
+
+ /**
+ * @brief Constructor, acquires the mutex from the underlying OS
+ */
+ Mutex();
+
+ /**
+ * @brief Destructor, non virtual as this is not meant as a base class
+ */
+ ~Mutex();
+
+ /**
+ * @brief Check if the mutex is locked
+ * @return true if the mutex is locked
+ */
+ bool IsLocked();
+
+public:
+
+ /**
+ * Helper class to do a scoped lock on a mutex implementing the RAII idiom.
+ * Note! this class *does not* prevent a deadlock in the case when same thread is
+ * locking the same mutex twice.
+ */
+ class ScopedLock
+ {
+ public:
+
+ /**
+ * Constructor
+ * @param mutex to lock
+ */
+ ScopedLock( Mutex& mutex );
+
+ /**
+ * Destructor, releases the lock
+ */
+ ~ScopedLock();
+
+ private:
+ Mutex& mMutex;
+ };
+
+private:
+
+ /// Not implemented as Mutex is not copyable
+ Mutex( const Mutex& );
+ const Mutex& operator= ( const Mutex& );
+
+ struct MutexImpl;
+ MutexImpl* mImpl;
+
+};
+
+} // namespace Dali
+
+#endif // __DALI_MUTEX_H__
--- /dev/null
+#ifndef __REF_COUNTED_DALI_VECTOR_H__
+#define __REF_COUNTED_DALI_VECTOR_H__
+
+/*
+ * Copyright (c) 2015 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/public-api/common/dali-vector.h>
+#include <dali/public-api/object/ref-object.h>
+
+namespace Dali
+{
+
+/**
+ * @brief A reference counting wrapper for a vector class that allows
+ * a set of referencing smart pointers to collaborate in managing its
+ * lifetime and eventually cleaning it up.
+ *
+ * This should only be allocated on the new/delete heap, not a thread's
+ * stack.
+ * @tparam T type of the data that the vector holds
+ */
+template< typename T >
+class RefCountedVector : public RefObject
+{
+public:
+ /**
+ * @brief Construct empty vector.
+ */
+ RefCountedVector()
+ {
+ }
+
+ /**
+ * @brief Get the referenced vector.
+ *
+ * @return A reference to the vector that this object wraps.
+ */
+ Vector< T >& GetVector()
+ {
+ return mVector;
+ }
+
+protected:
+ virtual ~RefCountedVector()
+ {
+ }
+
+private:
+ // Disable copy-constructing and copying:
+ RefCountedVector(const RefCountedVector &); ///< Undefined
+ RefCountedVector & operator = (const RefCountedVector &); ///< Undefined
+
+ Vector< T > mVector; ///< The vector of data
+};
+
+} // namespace Dali
+
+#endif /* __REF_COUNTED_DALI_VECTOR_H__ */
--- /dev/null
+#ifndef __DALI_SCOPED_POINTER_H__
+#define __DALI_SCOPED_POINTER_H__
+/*
+ * Copyright (c) 2015 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+namespace Dali
+{
+
+/**
+ * @brief Deletes the object pointed-to when it goes out of scope.
+ *
+ * A simple template class to call delete on an owned pointer when it goes
+ * out of scope, whether that be by ordinary return or stack unwind for
+ * exception throw.
+ */
+template<typename Owned>
+class ScopedPointer
+{
+public:
+
+ /**
+ * @brief Construct a ScopedPointer guarding a new Owned*.
+ */
+ ScopedPointer( Owned * const owned ) :
+ mOwned( owned )
+ {}
+
+ /**
+ * @brief Destroy the ScopedPointer and clean up its Owned*.
+ */
+ ~ScopedPointer()
+ {
+ if( mOwned != 0 )
+ {
+ delete mOwned;
+ mOwned = 0;
+ }
+ }
+
+ /**
+ * @brief Getter for the underlying pointer.
+ * @return The Owned* guarded by this object.
+ */
+ Owned* Get() const
+ {
+ return mOwned;
+ }
+
+ /**
+ * @brief Give up ownership of the object guarded by this pointer.
+ * @return The Owned* previously guarded by this object.
+ */
+ Owned* Release()
+ {
+ Owned* const owned = mOwned;
+ mOwned = 0;
+ return owned;
+ }
+
+ /**
+ * @brief Dereference this pointer.
+ */
+ Owned& operator*() const
+ {
+ return *mOwned;
+ }
+
+ /**
+ * @brief Allow member access through arrow notation.
+ */
+ Owned * operator->() const
+ {
+ return mOwned;
+ }
+
+private:
+
+ // Non-copyable:
+ ScopedPointer( const ScopedPointer& rhs );
+ ScopedPointer& operator = ( const ScopedPointer& rhs );
+
+ Owned* mOwned;
+};
+
+} /* namespace Dali */
+
+#endif /* __DALI_SCOPED_POINTER_H__ */
// BASE CLASS INCLUDES
#include <dali/public-api/object/base-handle.h>
-#include <dali/public-api/geometry/cloth.h>
+#include <dali/devel-api/geometry/cloth.h>
namespace Dali
{
--- /dev/null
+/*
+ * Copyright (c) 2015 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include <dali/devel-api/events/hit-test-algorithm.h>
+
+// INTERNAL INCLUDES
+#include <dali/internal/event/events/hit-test-algorithm-impl.h>
+#include <dali/internal/event/common/stage-impl.h>
+#include <dali/internal/event/render-tasks/render-task-impl.h>
+
+namespace Dali
+{
+
+namespace HitTestAlgorithm
+{
+
+bool HitTest( Stage stage, const Vector2& screenCoordinates, Results& results, HitTestFunction func )
+{
+ return Internal::HitTestAlgorithm::HitTest( GetImplementation(stage), screenCoordinates, results, func );
+}
+
+bool HitTest( RenderTask& renderTask, const Vector2& screenCoordinates, Results& results, HitTestFunction func )
+{
+ Stage stage = Stage::GetCurrent();
+ return Internal::HitTestAlgorithm::HitTest( GetImplementation( stage ), GetImplementation(renderTask), screenCoordinates, results, func );
+}
+
+} // namespace HitTestAlgorithm
+
+} // namespace Dali
--- /dev/null
+#ifndef __DALI_HIT_TEST_ALGORITHM_H__
+#define __DALI_HIT_TEST_ALGORITHM_H__
+
+/*
+ * Copyright (c) 2015 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <dali/public-api/actors/actor.h>
+#include <dali/public-api/common/stage.h>
+
+
+namespace Dali
+{
+
+class RenderTask;
+
+/**
+ * @brief This namespace is provided for application developers to do hit-test for the actors.
+ *
+ * <h3>Hit Test Algorithm:</h3>
+ *
+ * Hit testing is dependent on the camera used, which is specific to each RenderTask. For each RenderTask,
+ * hit testing starts from the top-most layer and we go through all the layers until we have a hit or there
+ * are none left. Before we perform a hit test within a layer, we check if all the layer's parents meet the
+ * conditions defined by the function ((e.g. whether it is visible)). If they are not, we skip hit testing
+ * the actors in that layer altogether. Otherwise, we walk through the actor tree within a layer to check
+ * whether the actors within the actor tree should be hit-tested.
+ *
+ * The following pseudocode gives an example of what the function can typically check, which should normally
+ * be provided by the application code:
+ *
+ * @code
+ * HIT-TEST-FUNCTION( ACTOR, TRAVERSE-TYPE )
+ * {
+ * if( TRAVERSE-TYPE == CHECK_ACTOR ) // Check whether current actor should be hit-tested
+ * {
+ * if( ACTOR-IS-VISIBLE &&
+ * ACTOR-WORLD-COLOR-IS-NOT-TRANSPARENT )
+ * {
+ * HITTABLE = TRUE
+ * }
+ * }
+ * else if( TRAVERSE-TYPE == DESCEND_ACTOR_TREE ) ///< Check whether the actor tree should be descended to hit-test its children.
+ * {
+ * if( ACTOR-IS-VISIBLE )
+ * {
+ * HITTABLE = TRUE
+ * }
+ * }
+ * }
+ * @endcode
+ *
+ * The following pseudocode explains how the algorithm performs the hit-test with the above functor:
+ *
+ * @code
+ * HIT-TEST-WITHIN-LAYER( ACTOR )
+ * {
+ * // Depth-first traversal within current layer, visiting parent first
+ *
+ * // Check whether current actor should be hit-tested
+ * IF ( HIT-TEST-FUNCTION( ACTOR, CHECK_ACTOR ) &&
+ * ACTOR-HAS-NON-ZERO-SIZE )
+ * {
+ * // Hit-test current actor
+ * IF ( ACTOR-HIT )
+ * {
+ * IF ( DISTANCE-TO-ACTOR < DISTANCE-TO-LAST-HIT-ACTOR )
+ * {
+ * // The current actor is the closest actor that was underneath the touch
+ * LAST-HIT-ACTOR = CURRENT-ACTOR
+ * }
+ * }
+ * }
+ *
+ * // Keep checking children, in case we hit something closer
+ * FOR-EACH CHILD (in order)
+ * {
+ * IF ( HIT-TEST-FUNCTION( ACTOR, DESCEND_ACTOR_TREE ) &&
+ * ACTOR-IS-NOT-A-LAYER )
+ * {
+ * // Continue traversal for this child's sub-tree
+ * HIT-TEST-WITHIN-LAYER ( CHILD )
+ * }
+ * // else we skip the sub-tree with from this child
+ * }
+ * }
+ * @endcode
+ */
+namespace HitTestAlgorithm
+{
+
+/**
+ * @brief How the actor tree should be traversed.
+ */
+enum TraverseType
+{
+ CHECK_ACTOR, ///< Hit test the given actor.
+ DESCEND_ACTOR_TREE ///< Check whether the actor tree should be descended to hit-test its children.
+};
+
+/**
+ * @brief Results structure containing the hit actor and where it was hit.
+ */
+struct Results
+{
+ Actor actor; ///< The hit actor.
+ Vector2 actorCoordinates; ///< The actor coordinates.
+};
+
+/**
+ * @brief Definition of a hit-test function to use in HitTest() method to check if the actor is hittable (e.g. touchable or focusable).
+ *
+ * @return true, if the actor is hittable, false otherwise.
+ */
+typedef bool (*HitTestFunction)(Actor actor, TraverseType type);
+
+/**
+ * @brief Given screen coordinates, this method returns the hit actor & the local coordinates relative to
+ * the top-left (0.0f, 0.0f, 0.5f) of the actor.
+ *
+ * An actor is only hittable if the actor meets all the conditions
+ * defined by the given function (see HitTestAlgorithm).
+ *
+ * Typically, if an actor has a zero size or its world color is fully transparent, it should not be
+ * hittable; and if an actor's visibility flag is unset, its children should not be hittable either.
+ *
+ * @param[in] stage The stage.
+ * @param[in] screenCoordinates The screen coordinates.
+ * @param[out] results The results of the hit-test, only modified if something is hit
+ * @param[in] func The function to use in the hit-test algorithm.
+ * @return true if something was hit
+ */
+DALI_IMPORT_API bool HitTest( Stage stage, const Vector2& screenCoordinates, Results& results, HitTestFunction func );
+
+/**
+ * @brief Hit test specific to a given RenderTask.
+ *
+ * @param[in] renderTask The render task for hit test
+ * @param[in] screenCoordinates The screen coordinates.
+ * @param[out] results The results of the hit-test, only modified if something is hit
+ * @param[in] func The function to use in the hit-test algorithm.
+ * @return true if something was hit
+ */
+DALI_IMPORT_API bool HitTest( RenderTask& renderTask, const Vector2& screenCoordinates, Results& results, HitTestFunction func );
+
+} // namespace HitTestAlgorithm
+
+} // namespace Dali
+
+#endif // __DALI_HIT_TEST_ALGORITHM_H__
# Add devel source files here for DALi internal developer files used by Adaptor & Toolkit
devel_api_src_files = \
+ $(devel_api_src_dir)/actors/mesh-actor.cpp \
+ $(devel_api_src_dir)/animation/path-constrainer.cpp \
+ $(devel_api_src_dir)/common/hash.cpp \
+ $(devel_api_src_dir)/common/mutex.cpp \
$(devel_api_src_dir)/dynamics/dynamics-body.cpp \
$(devel_api_src_dir)/dynamics/dynamics-body-config.cpp \
$(devel_api_src_dir)/dynamics/dynamics-collision.cpp \
$(devel_api_src_dir)/dynamics/dynamics-joint.cpp \
$(devel_api_src_dir)/dynamics/dynamics-shape.cpp \
$(devel_api_src_dir)/dynamics/dynamics-world.cpp \
- $(devel_api_src_dir)/dynamics/dynamics-world-config.cpp
+ $(devel_api_src_dir)/dynamics/dynamics-world-config.cpp \
+ $(devel_api_src_dir)/events/hit-test-algorithm.cpp \
+ $(devel_api_src_dir)/geometry/animatable-mesh.cpp \
+ $(devel_api_src_dir)/geometry/animatable-vertex.cpp \
+ $(devel_api_src_dir)/geometry/cloth.cpp \
+ $(devel_api_src_dir)/geometry/mesh-data.cpp \
+ $(devel_api_src_dir)/geometry/mesh-factory.cpp \
+ $(devel_api_src_dir)/geometry/mesh.cpp \
+ $(devel_api_src_dir)/images/atlas.cpp \
+ $(devel_api_src_dir)/images/distance-field.cpp \
+ $(devel_api_src_dir)/modeling/bone.cpp \
+ $(devel_api_src_dir)/modeling/material.cpp \
+ $(devel_api_src_dir)/scripting/scripting.cpp
# Add devel header files here DALi internal developer files used by Adaptor & Toolkit
+devel_api_core_actors_header_files = \
+ $(devel_api_src_dir)/actors/mesh-actor.h
+
+devel_api_core_animation_header_files = \
+ $(devel_api_src_dir)/animation/path-constrainer.h
+
devel_api_core_common_header_files = \
+ $(devel_api_src_dir)/common/hash.h \
$(devel_api_src_dir)/common/map-wrapper.h \
+ $(devel_api_src_dir)/common/mutex.h \
+ $(devel_api_src_dir)/common/ref-counted-dali-vector.h \
+ $(devel_api_src_dir)/common/scoped-pointer.h \
$(devel_api_src_dir)/common/set-wrapper.h
devel_api_core_dynamics_header_files = \
$(devel_api_src_dir)/dynamics/dynamics-shape.h \
$(devel_api_src_dir)/dynamics/dynamics-world.h \
$(devel_api_src_dir)/dynamics/dynamics-world-config.h
+
+
+devel_api_core_events_header_files = \
+ $(devel_api_src_dir)/events/hit-test-algorithm.h
+
+
+devel_api_core_geometry_header_files = \
+ $(devel_api_src_dir)/geometry/animatable-mesh.h \
+ $(devel_api_src_dir)/geometry/animatable-vertex.h \
+ $(devel_api_src_dir)/geometry/cloth.h \
+ $(devel_api_src_dir)/geometry/mesh.h \
+ $(devel_api_src_dir)/geometry/mesh-data.h \
+ $(devel_api_src_dir)/geometry/mesh-factory.h
+
+
+devel_api_core_images_header_files = \
+ $(devel_api_src_dir)/images/atlas.h \
+ $(devel_api_src_dir)/images/distance-field.h \
+ $(devel_api_src_dir)/images/image-operations.h \
+ $(devel_api_src_dir)/images/native-image-interface.h
+
+devel_api_core_modeling_header_files = \
+ $(devel_api_src_dir)/modeling/bone.h \
+ $(devel_api_src_dir)/modeling/material.h
+
+devel_api_core_object_header_files = \
+ $(devel_api_src_dir)/object/type-registry-helper.h
+
+devel_api_core_scripting_header_files = \
+ $(devel_api_src_dir)/scripting/scripting.h
+
+
--- /dev/null
+/*
+ * Copyright (c) 2015 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+
+#include <dali/devel-api/geometry/animatable-mesh.h>
+#include <dali/internal/event/modeling/animatable-mesh-impl.h>
+
+namespace Dali
+{
+
+AnimatableMesh::AnimatableMesh()
+{
+}
+
+AnimatableMesh AnimatableMesh::New(
+ unsigned int numVertices,
+ const AnimatableMesh::Faces& faceIndices,
+ Dali::Material material )
+{
+ Internal::AnimatableMeshPtr internal = Internal::AnimatableMesh::New( numVertices,
+ faceIndices,
+ material );
+ return AnimatableMesh(internal.Get());
+}
+
+AnimatableMesh AnimatableMesh::New( unsigned int numVertices,
+ const Faces& faceIndices )
+{
+
+ Internal::AnimatableMeshPtr internal = Internal::AnimatableMesh::New( numVertices, faceIndices );
+ return AnimatableMesh(internal.Get());
+}
+
+AnimatableMesh AnimatableMesh::DownCast( BaseHandle handle )
+{
+ return AnimatableMesh( dynamic_cast<Dali::Internal::AnimatableMesh*>(handle.GetObjectPtr()) );
+}
+
+AnimatableMesh::~AnimatableMesh()
+{
+}
+
+AnimatableMesh::AnimatableMesh(const AnimatableMesh& handle)
+: Handle(handle)
+{
+}
+
+AnimatableMesh& AnimatableMesh::operator=(const AnimatableMesh& rhs)
+{
+ BaseHandle::operator=(rhs);
+ return *this;
+}
+
+unsigned int AnimatableMesh::GetNumberOfVertices() const
+{
+ return GetImplementation(*this).GetNumberOfVertices();
+}
+
+AnimatableVertex AnimatableMesh::operator[](const unsigned int index) const
+{
+ DALI_ASSERT_ALWAYS( index < GetNumberOfVertices() && "Index out of bounds" );
+
+ return AnimatableVertex(index, *this);
+}
+
+Property::Index AnimatableMesh::GetPropertyIndex(
+ unsigned int index,
+ Property::Index property ) const
+{
+ DALI_ASSERT_ALWAYS( index < GetNumberOfVertices() && "Index out of bounds" );
+
+ return GetImplementation(*this).GetVertexPropertyIndex( index, property );
+}
+
+Property AnimatableMesh::GetVertexProperty( unsigned int vertex, Property::Index property)
+{
+ return Property( *this, GetPropertyIndex( vertex, property ) );
+}
+
+
+AnimatableMesh::AnimatableMesh( Internal::AnimatableMesh* internal )
+: Handle(internal)
+{
+}
+
+} // Dali
--- /dev/null
+#ifndef __DALI_ANIMATABLE_MESH__H__
+#define __DALI_ANIMATABLE_MESH__H__
+
+/*
+ * Copyright (c) 2015 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/public-api/common/vector-wrapper.h>
+#include <dali/public-api/object/handle.h>
+#include <dali/devel-api/geometry/animatable-vertex.h>
+#include <dali/devel-api/modeling/material.h>
+
+namespace Dali
+{
+class AnimatableVertex;
+
+namespace Internal DALI_INTERNAL
+{
+class AnimatableMesh;
+}
+
+/**
+ * @brief An animatable mesh can have any of its vertices animated using Dali's animation and
+ * constraint systems.
+ *
+ * It is recommended that the vertices of the mesh remain in the bounds -0.5 - 0.5, which
+ * will match the actor size boundaries. The origin of the mesh matches the actor's position.
+ */
+class DALI_IMPORT_API AnimatableMesh : public Handle
+{
+public:
+ /**
+ * @brief Vector of face indices.
+ */
+ typedef std::vector<unsigned short> Faces;
+ typedef Faces::iterator FacesIter; ///< Iterator for Dali::AnimatableMesh::Faces
+ typedef Faces::const_iterator FacesConstIter; ///< Const Iterator for Dali::AnimatableMesh::Faces
+
+ /**
+ * @brief Create an uninitialized handle, this can be initialized with New().
+ *
+ * Calling member functions on an uninitialized handle will result
+ * in an assertion
+ */
+ AnimatableMesh();
+
+ /**
+ * @brief Create a new animatable mesh with a given number of vertices and triangles.
+ *
+ * This will assert if any index is out of range.
+ * Using this constructor enables the vertex color property.
+ * AnimatableMesh does not take ownership of the faceIndices.
+ * @param[in] numVertices The number of vertices in the mesh
+ * @param[in] faceIndices A set of vertex indices, 3 per face.
+ * @return an initialized handle to the animatable mesh
+ * @note The maximum number of supported vertices is 3333333.
+ */
+ static AnimatableMesh New( unsigned int numVertices,
+ const Faces& faceIndices );
+
+ /**
+ * @brief Create a new animatable mesh with a given number of vertices and triangles.
+ *
+ * This will assert if any index is out of range.
+ * Using this constructor disables the vertex color property.
+ * AnimatableMesh does not take ownership of the faceIndices.
+ * @param[in] numVertices The number of vertices in the mesh
+ * @param[in] faceIndices A set of vertex indices, 3 per face.
+ * @param[in] material Material used to render mesh
+ * @return an initialized handle to the animatable mesh
+ * @note The maximum number of supported vertices is 3333333.
+ */
+ static AnimatableMesh New( unsigned int numVertices,
+ const Faces& faceIndices,
+ Dali::Material material );
+
+ /**
+ * @brief Downcast an Object handle to AnimatableMesh.
+ *
+ * If the handle points to an AnimatableMesh objec, the downcast
+ * produces a valid handle. If not, the handle is left
+ * uninitialized.
+ *
+ * @param[in] handle to an Object
+ * @return handle to an AnimatableMesh or an uninitialized handle
+ */
+ static AnimatableMesh DownCast( BaseHandle handle );
+
+ /**
+ * @brief Destructor
+ *
+ * This is non-virtual since derived Handle types must not contain data or virtual methods.
+ */
+ ~AnimatableMesh();
+
+ /**
+ * @brief This copy constructor is required for (smart) pointer semantics.
+ *
+ * @param [in] handle A reference to the copied handle
+ */
+ AnimatableMesh(const AnimatableMesh& handle);
+
+ /**
+ * @brief This assignment operator is required for (smart) pointer semantics.
+ *
+ * @param [in] rhs A reference to the copied handle
+ * @return A reference to this
+ */
+ AnimatableMesh& operator=(const AnimatableMesh& rhs);
+
+ /**
+ * @brief Get the number of vertices with which this mesh was created.
+ *
+ * @return number of vertices in this mesh
+ */
+ unsigned int GetNumberOfVertices() const;
+
+ /**
+ * @brief Array subscript operator overload.
+ *
+ * @pre The vertex index is in range
+ * @param[in] index subscript
+ * @return the vertex at the given index
+ */
+ AnimatableVertex operator[]( unsigned int index ) const;
+
+ /**
+ * @brief Get a property index for a given vertex.
+ *
+ * @pre The vertex index and property is in range
+ * @param[in] vertex The vertex
+ * @param[in] property The vertex attribute
+ * @return A property index for use in constraints or animations
+ */
+ Property::Index GetPropertyIndex( unsigned int vertex, Property::Index property) const;
+
+ /**
+ * @brief Get the property for a given vertex.
+ *
+ * @pre The vertex index and property is in range
+ * @param[in] vertex The vertex
+ * @param[in] property The vertex attribute
+ * @return A property index for use in constraints or animations
+ */
+ Property GetVertexProperty( unsigned int vertex, Property::Index property );
+
+public: // Not for use by application developer
+
+ /**
+ * @brief This constructor is used by Dali New() methods
+ *
+ * @param [in] mesh A pointer to a newly allocated Dali resource
+ */
+ explicit DALI_INTERNAL AnimatableMesh(Internal::AnimatableMesh* mesh);
+};
+
+}// Dali
+
+#endif
--- /dev/null
+/*
+ * Copyright (c) 2015 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <dali/devel-api/geometry/animatable-vertex.h>
+#include <dali/devel-api/geometry/animatable-mesh.h>
+#include <dali/internal/event/modeling/animatable-mesh-impl.h>
+
+namespace Dali
+{
+
+AnimatableVertex::AnimatableVertex( unsigned int vertex, AnimatableMesh mesh)
+ : mVertex(vertex),
+ mMesh(GetImplementation(mesh))
+{
+ DALI_ASSERT_ALWAYS( mesh && "Mesh handle is empty" );
+ DALI_ASSERT_ALWAYS( vertex < mesh.GetNumberOfVertices() && "vertex is out of bounds" );
+}
+
+AnimatableVertex::~AnimatableVertex()
+{
+}
+
+void AnimatableVertex::SetPosition(const Vector3& position)
+{
+ mMesh.SetProperty( mMesh.GetVertexPropertyIndex(mVertex, Property::POSITION), Dali::Property::Value(position) );
+}
+
+void AnimatableVertex::SetColor(const Vector4& color)
+{
+ mMesh.SetProperty( mMesh.GetVertexPropertyIndex(mVertex, Property::COLOR), Dali::Property::Value(color) );
+}
+
+void AnimatableVertex::SetTextureCoords(const Vector2& textureCoords)
+{
+ mMesh.SetProperty( mMesh.GetVertexPropertyIndex(mVertex, Property::TEXTURE_COORDS), Dali::Property::Value(textureCoords) );
+}
+
+Vector3 AnimatableVertex::GetCurrentPosition()
+{
+ Vector3 position;
+ mMesh.GetProperty( mMesh.GetVertexPropertyIndex(mVertex, Property::POSITION) ).Get(position);
+ return position;
+}
+
+Vector4 AnimatableVertex::GetCurrentColor()
+{
+ Vector4 color;
+ mMesh.GetProperty( mMesh.GetVertexPropertyIndex(mVertex, Property::COLOR) ).Get(color);
+ return color;
+}
+
+Vector2 AnimatableVertex::GetCurrentTextureCoords()
+{
+ Vector2 textureCoords;
+ mMesh.GetProperty( mMesh.GetVertexPropertyIndex(mVertex, Property::TEXTURE_COORDS) ).Get(textureCoords);
+ return textureCoords;
+}
+
+}//Dali
--- /dev/null
+#ifndef __DALI_ANIMATABLE_VERTEX__H__
+#define __DALI_ANIMATABLE_VERTEX__H__
+
+/*
+ * Copyright (c) 2015 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/public-api/common/dali-common.h>
+#include <dali/public-api/object/property.h>
+#include <dali/public-api/object/property-index-ranges.h>
+#include <dali/public-api/math/vector2.h>
+#include <dali/public-api/math/vector3.h>
+#include <dali/public-api/math/vector4.h>
+
+namespace Dali
+{
+class AnimatableMesh;
+
+namespace Internal DALI_INTERNAL
+{
+class AnimatableMesh;
+}
+
+/**
+ * @brief Represents a vertex in an AnimatableMesh.
+ *
+ * It is used by AnimatableMesh to offer an array interface for
+ * setting properties:
+ *
+ * @code
+ * AnimatableMesh mesh = AnimatableMesh(numVerts, faces);
+ * mesh[vertex].SetColor(color);
+ * @endcode
+ */
+class DALI_IMPORT_API AnimatableVertex
+{
+public:
+
+ /**
+ * @brief An enumeration of properties belonging to the AnimatableVertex class.
+ * Note: These are used by animatable mesh also.
+ */
+ struct Property
+ {
+ enum
+ {
+ POSITION = DEFAULT_OBJECT_PROPERTY_START_INDEX, ///< name prefix "position-", type Vector3
+ COLOR, ///< name prefix "color-", type Vector4
+ TEXTURE_COORDS, ///< name prefix "texture-coords-", type Vector2
+ };
+ };
+
+ /**
+ * @brief Destructor
+ */
+ ~AnimatableVertex();
+
+ /**
+ * @brief Set the position of the vertex.
+ *
+ * @param[in] position (note, -0.5 - +0.5 are inside the actor's boundaries)
+ */
+ void SetPosition(const Vector3& position);
+
+ /**
+ * @brief Set the vertex color.
+ * @param[in] color The vertex color
+ */
+ void SetColor(const Vector4& color);
+
+ /**
+ * @brief Set the texture coordinates.
+ *
+ * @param[in] textureCoords The texture coordinates
+ */
+ void SetTextureCoords(const Vector2& textureCoords);
+
+ /**
+ * @brief Get the current position of the vertex.
+ *
+ * @return position
+ */
+ Vector3 GetCurrentPosition();
+
+ /**
+ * @brief Get the current vertex color.
+ *
+ * @return The vertex color
+ */
+ Vector4 GetCurrentColor();
+
+ /**
+ * @brief Get the current texture coordinates.
+ *
+ * @return textureCoords The texture coordinates
+ */
+ Vector2 GetCurrentTextureCoords();
+
+private:
+ // Only allow AnimatableMesh to construct this object.
+ friend class Dali::AnimatableMesh;
+
+ /**
+ * @brief Constructor.
+ *
+ * @param[in] vertex The index of the vertex in the parent mesh
+ * @param[in] mesh The parent mesh
+ */
+ AnimatableVertex( unsigned int vertex, AnimatableMesh mesh );
+
+ /**
+ * @brief Undefined Copy Constructor
+ */
+ AnimatableVertex(const AnimatableVertex& vertex);
+
+ /**
+ * @brief Undefined Assignment Operator
+ */
+ AnimatableVertex& operator=(const AnimatableVertex& vertex);
+
+ int mVertex; ///< The index of this vertex in the parent mesh
+ Internal::AnimatableMesh& mMesh; ///< The parent mesh
+};
+
+
+}//Dali
+
+#endif
--- /dev/null
+/*
+ * Copyright (c) 2015 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include <dali/devel-api/geometry/cloth.h>
+
+// INTERNAL INCLUDES
+#include <dali/devel-api/geometry/mesh-factory.h>
+#include <dali/internal/event/modeling/cloth-impl.h>
+
+namespace Dali
+{
+
+namespace
+{
+
+} // namespace
+
+Cloth::Cloth()
+{
+}
+
+Cloth::~Cloth()
+{
+}
+
+Cloth::Cloth(const Cloth& handle)
+: Mesh(handle)
+{
+}
+
+Cloth& Cloth::operator=(const Cloth& rhs)
+{
+ BaseHandle::operator=(rhs);
+ return *this;
+}
+
+Cloth Cloth::New( const float width, const float height, const int xSteps, const int ySteps, const Rect<float>& textureCoordinates )
+{
+ MeshData meshData( MeshFactory::NewPlane(width, height, xSteps, ySteps, textureCoordinates) );
+
+ Internal::ClothIPtr clothPtr = Internal::Cloth::New( meshData );
+ return Cloth( clothPtr.Get() );
+}
+
+Cloth Cloth::DownCast( BaseHandle handle )
+{
+ return Cloth( dynamic_cast<Dali::Internal::Cloth*>(handle.GetObjectPtr()) );
+}
+
+Cloth::Cloth(Internal::Cloth* internal)
+: Mesh(internal)
+{
+}
+
+} // namespace Dali
--- /dev/null
+#ifndef __DALI_CLOTH_H__
+#define __DALI_CLOTH_H__
+
+/*
+ * Copyright (c) 2015 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+
+// INTERNAL INCLUDES
+#include <dali/public-api/math/rect.h>
+#include <dali/public-api/math/vector4.h>
+#include <dali/public-api/object/base-handle.h>
+#include <dali/devel-api/geometry/mesh.h>
+
+namespace Dali
+{
+
+namespace Internal DALI_INTERNAL
+{
+class Cloth;
+}
+
+/**
+ * @brief A Cloth is a specialized mesh that can be used and modified
+ * by the Dynamics engine.
+ */
+class DALI_IMPORT_API Cloth : public Mesh
+{
+public:
+
+ /**
+ * @brief Create an initialized plane aligned on the XY axis.
+ *
+ * @param[in] width The width of the plane
+ * @param[in] height The height of the plane
+ * @param[in] xSteps The number of vertices along the X axis
+ * @param[in] ySteps The number of vertices along the Y axis
+ * @param[in] textureCoordinates UV coordinates.
+ * @return A handle to a newly allocated Dali resource.
+ */
+ static Cloth New(const float width,
+ const float height,
+ const int xSteps,
+ const int ySteps,
+ const Rect<float>& textureCoordinates = Rect<float>(0.0f, 0.0f, 1.0f, 1.0f));
+
+
+ /**
+ * @brief Create an uninitialized Cloth; this can be initialized with Cloth::New().
+ *
+ * Calling member functions with an uninitialized Dali::Object is not allowed.
+ */
+ Cloth();
+
+ /**
+ * @brief Destructor
+ *
+ * This is non-virtual since derived Handle types must not contain data or virtual methods.
+ */
+ ~Cloth();
+
+ /**
+ * @brief This copy constructor is required for (smart) pointer semantics.
+ *
+ * @param [in] handle A reference to the copied handle
+ */
+ Cloth(const Cloth& handle);
+
+ /**
+ * @brief This assignment operator is required for (smart) pointer semantics.
+ *
+ * @param [in] rhs A reference to the copied handle
+ * @return A reference to this
+ */
+ Cloth& operator=(const Cloth& rhs);
+
+ /**
+ * @brief Downcast an Object handle to a Cloth handle.
+ *
+ * If handle points to a Cloth object the downcast produces valid
+ * handle. If not the returned handle is left uninitialized.
+ *
+ * @param[in] handle to an object
+ * @return handle to a Cloth object or an uninitialized handle
+ */
+ static Cloth DownCast( BaseHandle handle );
+
+public: // Not intended for application developers
+
+ /**
+ * @brief This constructor is used by Dali New() methods.
+ *
+ * @param [in] cloth A pointer to a newly allocated Dali resource
+ */
+ explicit DALI_INTERNAL Cloth(Internal::Cloth* cloth);
+};
+
+} // namespace Dali
+
+#endif // __DALI_CLOTH_H__
--- /dev/null
+/*
+ * Copyright (c) 2015 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// Class header
+#include <dali/devel-api/geometry/mesh-data.h>
+
+// Internal headers
+#include <dali/public-api/math/matrix.h>
+#include <dali/integration-api/debug.h>
+
+namespace Dali
+{
+
+namespace // unnamed namespace
+{
+const float kBoundsDefault = 1e10f;
+} // unnamed namespace
+
+using Dali::Vector4;
+
+
+MeshData::MeshData( )
+: mGeometryType(TRIANGLES),
+ mUseTextureCoords(false),
+ mUseNormals(false),
+ mUseColor(false),
+ mMin( kBoundsDefault, kBoundsDefault, kBoundsDefault, 0.0f),
+ mMax(-kBoundsDefault, -kBoundsDefault, -kBoundsDefault, 0.0f)
+{
+}
+
+MeshData::MeshData( const MeshData& meshData )
+: mVertices( meshData.mVertices ),
+ mFaces( meshData.mFaces ),
+ mGeometryType( meshData.mGeometryType ),
+ mUseTextureCoords( meshData.mUseTextureCoords ),
+ mUseNormals( meshData.mUseNormals ),
+ mUseColor( meshData.mUseColor ),
+ mBones( meshData.mBones ),
+ mMaterial( meshData.mMaterial ),
+ mMin( meshData.mMin ),
+ mMax( meshData.mMax )
+{
+}
+
+MeshData& MeshData::operator=(const MeshData& rhs)
+{
+ mVertices = rhs.mVertices;
+ mFaces = rhs.mFaces;
+ mGeometryType = rhs.mGeometryType;
+ mUseTextureCoords = rhs.mUseTextureCoords;
+ mUseNormals = rhs.mUseNormals;
+ mUseColor = rhs.mUseColor;
+ mBones = rhs.mBones;
+ mMaterial = rhs.mMaterial;
+ mMin = rhs.mMin;
+ mMax = rhs.mMax;
+
+ return *this;
+}
+
+MeshData::~MeshData()
+{
+}
+
+void MeshData::SetData(
+ const VertexContainer& vertices,
+ const FaceIndices& faceIndices,
+ const BoneContainer& bones,
+ Material material )
+{
+ DALI_ASSERT_ALWAYS( !vertices.empty() && "VertexContainer is empty" );
+ DALI_ASSERT_ALWAYS( !faceIndices.empty() && "FaceIndices is empty" );
+ DALI_ASSERT_ALWAYS( material && "Material handle is empty" );
+
+ mGeometryType = TRIANGLES;
+ mVertices = vertices;
+ mFaces = faceIndices;
+ mMaterial = material;
+ mBones = bones;
+}
+
+void MeshData::SetLineData(
+ const VertexContainer& vertices,
+ const FaceIndices& lineIndices,
+ Material material )
+{
+ DALI_ASSERT_ALWAYS( !vertices.empty() && "VertexContainer is empty" );
+ DALI_ASSERT_ALWAYS( !lineIndices.empty() && "FaceIndices is empty" );
+ DALI_ASSERT_ALWAYS( material && "Material handle is empty" );
+
+ mGeometryType = LINES;
+ mVertices = vertices;
+ mFaces = lineIndices;
+ mMaterial = material;
+}
+
+void MeshData::SetPointData(
+ const VertexContainer& vertices,
+ Material material )
+{
+ DALI_ASSERT_ALWAYS( !vertices.empty() && "VertexContainer is empty" );
+ DALI_ASSERT_ALWAYS( material && "Material handle is empty" );
+
+ mGeometryType = POINTS;
+ mVertices = vertices;
+ mMaterial = material;
+}
+
+void MeshData::SetVertices( const VertexContainer& vertices )
+{
+ DALI_ASSERT_ALWAYS( !vertices.empty() && "VertexContainer is empty" );
+
+ mVertices = vertices;
+}
+
+void MeshData::SetFaceIndices( const FaceIndices& faceIndices )
+{
+ DALI_ASSERT_ALWAYS( !faceIndices.empty() && "FaceIndices is empty" );
+
+ mFaces = faceIndices;
+}
+
+void MeshData::AddToBoundingVolume(Vector4& min, Vector4& max, const Dali::Matrix& transform)
+{
+ DALI_LOG_TRACE_METHOD(Debug::Filter::gModel);
+
+ for (VertexConstIter iter = mVertices.begin(); iter != mVertices.end(); ++iter)
+ {
+ const Vertex& vertex = *iter;
+ Vector4 point = Vector4(vertex.x, vertex.y, vertex.z, 0.0f);
+
+ mMin = Min(mMin, point);
+ mMax = Max(mMax, point);
+ }
+ // mMin/mMax are accessed through public API, so have chosen to set w to zero
+ // ( They should really be Vector3's )
+ mMin.w=0.0f;
+ mMax.w=0.0f;
+
+ // For the matrix multiplication below to work correctly, the w needs to be 1.
+ Vector4 tmpMin(mMin);
+ Vector4 tmpMax(mMax);
+ tmpMin.w = 1.0f;
+ tmpMax.w = 1.0f;
+
+ min = Min(min, transform * tmpMin);
+ max = Max(max, transform * tmpMax);
+
+ // Ensure the bounding volume out parameters also have w=0. (They should also
+ // be Vector3's )
+ min.w = 0.0f;
+ max.w = 0.0f;
+}
+
+MeshData::VertexGeometryType MeshData::GetVertexGeometryType() const
+{
+ return mGeometryType;
+}
+
+size_t MeshData::GetVertexCount() const
+{
+ return mVertices.size();
+}
+
+const MeshData::VertexContainer& MeshData::GetVertices() const
+{
+ return mVertices;
+}
+
+size_t MeshData::GetFaceCount() const
+{
+ size_t faceCount = 0;
+
+ switch( mGeometryType )
+ {
+ case POINTS:
+ faceCount = mVertices.size();
+ break;
+ case LINES:
+ faceCount = mFaces.size() / 2;
+ break;
+ case TRIANGLES:
+ faceCount = mFaces.size() / 3;
+ break;
+ }
+ return faceCount;
+}
+
+const MeshData::FaceIndices& MeshData::GetFaces() const
+{
+ return mFaces;
+}
+
+void MeshData::SetHasTextureCoords(bool hasTexCoords)
+{
+ mUseTextureCoords = hasTexCoords;
+}
+
+bool MeshData::HasTextureCoords() const
+{
+ return mUseTextureCoords;
+}
+
+void MeshData::SetHasNormals(bool hasNormals)
+{
+ mUseNormals = hasNormals;
+ if( hasNormals )
+ {
+ // Enforce mutual exclusivity
+ mUseColor = false;
+ }
+}
+
+bool MeshData::HasNormals() const
+{
+ return mUseNormals;
+}
+
+void MeshData::SetHasColor(bool hasColor)
+{
+ mUseColor = hasColor;
+ if( hasColor )
+ {
+ // Enforce mutual exclusivity
+ mUseNormals = false;
+ }
+}
+
+bool MeshData::HasColor() const
+{
+ return mUseColor;
+}
+
+Material MeshData::GetMaterial() const
+{
+ return mMaterial;
+}
+
+void MeshData::SetMaterial(Material material)
+{
+ mMaterial = material;
+}
+
+size_t MeshData::GetBoneCount() const
+{
+ return mBones.size();
+}
+
+bool MeshData::HasBones() const
+{
+ return mBones.size() > 0;
+}
+
+const BoneContainer& MeshData::GetBones() const
+{
+ return mBones;
+}
+
+const Vector4& MeshData::GetBoundingBoxMin() const
+{
+ return mMin;
+}
+
+void MeshData::SetBoundingBoxMin(const Vector4& bounds)
+{
+ mMin = bounds;
+}
+
+const Vector4& MeshData::GetBoundingBoxMax() const
+{
+ return mMax;
+}
+
+
+void MeshData::SetBoundingBoxMax(const Vector4& bounds)
+{
+ mMax = bounds;
+}
+
+} // namespace Dali
+
--- /dev/null
+#ifndef __DALI_MESH_DATA_H__
+#define __DALI_MESH_DATA_H__
+
+/*
+ * Copyright (c) 2015 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+
+// INTERNAL INCLUDES
+#include <dali/public-api/common/dali-common.h>
+#include <dali/public-api/math/vector4.h>
+#include <dali/devel-api/modeling/bone.h>
+#include <dali/devel-api/modeling/material.h>
+
+
+// DECLARATION FILES
+
+
+namespace Dali
+{
+class Matrix;
+
+/**
+ * @brief The MeshData class encompasses all the data required to describe and
+ * render a 3D mesh.
+ *
+ * The mesh can have one of three geometry types: Points, Lines or Triangles.
+ * The Point type draws each vertex. The shader can control the point size.
+ * The Line type draws single pixel width lines between each specified vertex.
+ * The Triangles type draws solid color or texture between each specified
+ * vertex.
+ *
+ * When using the Points or Lines geometry type, normals aren't used.
+ *
+ * If the HasColor property is set, the vertex color is used to draw the points,
+ * lines or triangles, otherwise the material's diffuse color or texture is
+ * used. The material's diffuse alpha value is always used.
+ *
+ * When using the Triangles geometry type, the normals are mutually exclusive
+ * with vertex color. This means that shading cannot be performed if vertex
+ * color is being used.
+ *
+ * It is possible to deform the mesh using skeletal deformation. To acheive
+ * this, a number of bones can be supplied during creation. These are named
+ * actors that can be anywhere in the actor tree. Each bone has an offset
+ * matrix. A vertex in the mesh can reference up to 4 bones in the bone
+ * container with an associated weighting.
+ *
+ * When the mesh is added to the scene graph, the node for each named actor is
+ * added to an internal container. Each Update frame after the node update pass,
+ * the node's world matrix is multiplied by the associated bone's offset matrix.
+ * When rendering the mesh, these transform matrices are multiplied by the view
+ * matrix, their inverse transforms calculated and passed onto the shaders.
+ *
+ * The mesh vertex shader then applies up to 4 weighted transforms to each
+ * vertex and vertex normal.
+ */
+class DALI_IMPORT_API MeshData
+{
+public:
+ static const unsigned int MAX_NUMBER_OF_BONES = 12; ///< Maximum number of bones that can affect this mesh.
+
+ struct Vertex;
+ typedef std::vector<Vertex> VertexContainer; ///< Collection of vertices
+ typedef VertexContainer::iterator VertexIter; ///< Iterator for @ref Dali::MeshData::VertexContainer
+ typedef VertexContainer::const_iterator VertexConstIter; ///< Const iterator for @ref Dali::MeshData::VertexContainer
+
+ typedef unsigned short FaceIndex; ///< index of one point of a polygonal face
+ typedef std::vector<FaceIndex> FaceIndices; ///< Collection of FaceIndex items ( The span should match the geometry type: Lines - span is 2; Triangles - span is 3 ).
+ typedef FaceIndices::iterator FaceIndexIter; ///< Iterator for @ref Dali::MeshData::FaceIndices
+ typedef FaceIndices::const_iterator FaceIndexConstIter; ///< Const iterator for @ref Dali::MeshData::FaceIndices
+
+ /**
+ * @brief The type of geometry to draw
+ */
+ enum VertexGeometryType
+ {
+ POINTS, ///< Draw only points at each vertex
+ LINES, ///< Draw lines between specified vertices
+ TRIANGLES ///< Draw filled triangles between specified vertices
+ };
+
+public: // construction, destruction and initialisation
+
+ /**
+ * @brief Create a new mesh.
+ */
+ MeshData( );
+
+ /**
+ * @brief Copy constructor.
+ *
+ * @param[in] meshData object to copy
+ */
+ MeshData( const MeshData& meshData );
+
+ /**
+ * @brief Assignment operator.
+ *
+ * @param[in] rhs MeshData object to copy data from
+ * @return A reference to this
+ */
+ MeshData& operator=(const MeshData& rhs);
+
+ /**
+ * @brief Sets the vertex coords, the face indices, the bones affecting this mesh and a default
+ * material.
+ *
+ * @param[in] vertices The Vertex data (coordinates of each vertex)
+ * @param[in] faceIndices The index into the vertices buffer for each corner of each triangular face.
+ * @param[in] bones A container of Bones affecting this mesh.
+ * @param[in] material A handle to a material object.
+ */
+ void SetData( const VertexContainer& vertices,
+ const FaceIndices& faceIndices,
+ const BoneContainer& bones,
+ const Material material );
+
+ /**
+ * @brief Set the vertex coords and end points of each line.
+ *
+ * @param[in] vertices The vertex data (coords & color of each vertex)
+ * @param[in] lineIndices A list of vertex indices for the start & end of each line.
+ * @param[in] material A handle to a material object.
+ */
+ void SetLineData( const VertexContainer& vertices,
+ const FaceIndices& lineIndices,
+ const Material material );
+
+ /**
+ * @brief Set the vertex coords for each point.
+ *
+ * @param[in] vertices The vertex data (coords & color of each vertex)
+ * @param[in] material A handle to a material object.
+ */
+ void SetPointData( const VertexContainer& vertices,
+ const Material material );
+
+ /**
+ * @brief Set the vertex coords for each point.
+ *
+ * @param[in] vertices The vertex data (coords & color of each vertex)
+ */
+ void SetVertices( const VertexContainer& vertices );
+
+ /**
+ * @brief Sets the face indices.
+ *
+ * @param[in] faceIndices The index into the vertices buffer for each corner of each triangular face.or for the start and end of each line.
+ */
+ void SetFaceIndices( const FaceIndices& faceIndices );
+
+ /**
+ * @brief Add the mesh to the bounding volume.
+ *
+ * Expands a bounding volume to include the mesh
+ * @param[in,out] min Lower bounds
+ * @param[in,out] max Upper bounds
+ * @param[in] transform transform the mesh vertices
+ */
+ void AddToBoundingVolume(Vector4& min, Vector4& max, const Matrix& transform);
+
+ /**
+ * @brief Get the geometry type.
+ *
+ * A mesh defaults to triangles if no data has been set.
+ * @return the geometry type;
+ */
+ VertexGeometryType GetVertexGeometryType() const;
+
+ /**
+ * @brief Get the number of vertices.
+ *
+ * @return The number of vertices
+ */
+ size_t GetVertexCount() const;
+
+ /**
+ * @brief Get the vertex array.
+ *
+ * @return The vertex array
+ */
+ const VertexContainer& GetVertices() const;
+
+ /**
+ * @brief Get the number of points, lines or faces (note this is not the same as the number of face indices!).
+ *
+ * depending on the geometry type;
+ * @return Number of points, lines or faces
+ */
+ size_t GetFaceCount() const;
+
+ /**
+ * @brief Get the face index array.
+ *
+ * @return The face index array
+ */
+ const FaceIndices& GetFaces() const;
+
+ /**
+ * @brief Sets if the mesh has texture coordinates.
+ *
+ * @param hasTexCoords - True if the mesh has texture coordinates.
+ */
+ void SetHasTextureCoords(bool hasTexCoords);
+
+ /**
+ * @brief Checks if the mesh is textured.
+ *
+ * @return true if the mesh is texture mapped.
+ */
+ bool HasTextureCoords() const;
+
+ /**
+ * @brief Sets if the mesh has normals.
+ *
+ * Mutually exclusive with HasColor. Setting this to true will force the
+ * HasColor property to be set to false.
+ * @param hasNormals - True if the mesh has normals
+ */
+ void SetHasNormals(bool hasNormals);
+
+ /**
+ * @brief Checks if the mesh has normals.
+ *
+ * @return true if the mesh contains normals.
+ */
+ bool HasNormals() const;
+
+ /**
+ * @brief Sets if the mesh vertices have color.
+ *
+ * Mutually exclusive with HasNormals. Setting this to true will force the
+ * HasNormals property to be set to false.
+ * @param hasColor - True if the mesh vertices have color.
+ */
+ void SetHasColor(bool hasColor);
+
+ /**
+ * @brief Checks if the mesh vertices have color.
+ *
+ * @return true if the mesh contains colored vertices.
+ */
+ bool HasColor() const;
+
+ /**
+ * @brief Get the original material associated with this mesh.
+ *
+ * @return Handle to the material
+ */
+ Material GetMaterial() const;
+
+ /**
+ * @brief Set the default material associated with this mesh.
+ */
+ void SetMaterial( Material material );
+
+ /**
+ * @brief Get the number of bones affecting this mesh.
+ *
+ * @return The number of bones affecting this mesh
+ */
+ size_t GetBoneCount() const;
+
+ /**
+ * @brief Does this mesh have bones?.
+ *
+ * @return true if this mesh has bones.
+ */
+ bool HasBones() const;
+
+ /**
+ * @brief Get the bone container.
+ *
+ * @return the bones
+ */
+ const BoneContainer& GetBones() const;
+
+ /**
+ * @brief Get the lower bounds of the bounding box containing the vertices.
+ *
+ * @return the lower bounds
+ */
+ const Vector4& GetBoundingBoxMin() const;
+
+ /**
+ * @brief Set the lower bounds of the bounding box containing the vertices.
+ *
+ * @param bounds The lower bounds
+ */
+ void SetBoundingBoxMin(const Vector4& bounds);
+
+ /**
+ * @brief Get the upper bounds of the bounding box containing the vertices.
+ *
+ * @return the upper bounds
+ */
+ const Vector4& GetBoundingBoxMax() const;
+
+ /**
+ * @brief Set the upper bounds of the bounding box containing the vertices.
+ *
+ * @param bounds The upper bounds
+ */
+ void SetBoundingBoxMax(const Vector4& bounds);
+
+ /**
+ * @brief Destructor.
+ */
+ ~MeshData();
+
+private:
+ VertexContainer mVertices; ///< The vertex data
+ FaceIndices mFaces; ///< Indices of triangle faces or line terminators
+ VertexGeometryType mGeometryType; ///< The type of geometry to draw
+ bool mUseTextureCoords; ///< Whether the vertex data contains texture coords
+ bool mUseNormals; ///< Whether the vertex data contains normals
+ bool mUseColor; ///< Whether the vertex data contains vertex color
+ BoneContainer mBones; ///< Bones for skeletal deformation
+
+ Material mMaterial; ///< Material of the mesh
+
+ Vector4 mMin; ///< The lower bounds of the bounding box
+ Vector4 mMax; ///< The upper bounds of the bounding box
+
+}; // class MeshData
+
+/**
+ * @brief A vertex within a mesh, with the corresponding texture coordinate, normal and up to 4 bone influences.
+ */
+struct MeshData::Vertex
+{
+ static const unsigned int MAX_BONE_INFLUENCE = 4; ///< Maximum number of bones that can influence this particular vertex.
+
+ Vertex()
+ : x(0.0f), y(0.0f), z(0.0f),
+ u(0.0f), v(0.0f),
+ nX(0.0f), nY(0.0f), nZ(0.0f)
+ {
+ }
+
+ /**
+ * @brief Constructor.
+ *
+ * @param[in] position The vertex position
+ * @param[in] textureCoordinates The texture coordinates
+ * @param[in] normal The surface normal
+ */
+ Vertex( const Vector3& position, const Vector2& textureCoordinates, const Vector3& normal )
+ : x(position.x), y(position.y), z(position.z),
+ u(textureCoordinates.x), v(textureCoordinates.y),
+ nX(normal.x), nY(normal.y), nZ(normal.z)
+ {
+ }
+
+ // Vertices
+ float x;
+ float y;
+ float z;
+
+ // Texture coordinates
+ float u;
+ float v;
+
+ // Normals / vertex colours
+ union
+ {
+ float nX;
+ float vertexR;
+ };
+ union
+ {
+ float nY;
+ float vertexG;
+ };
+ union
+ {
+ float nZ;
+ float vertexB;
+ };
+
+ /**
+ * @brief Bone indices specify which bones have an influence over the vertex (if any).
+ */
+ unsigned char boneIndices[MAX_BONE_INFLUENCE];
+
+ /**
+ * @brief Bone weights determine the strength of the influence of each bone.
+ */
+ float boneWeights[MAX_BONE_INFLUENCE];
+};
+
+} // namespace Dali
+
+#endif // __DALI_MESH_DATA_H__
--- /dev/null
+/*
+ * Copyright (c) 2015 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include "mesh-factory.h"
+
+#include <dali/devel-api/geometry/mesh-data.h>
+#include <dali/devel-api/modeling/material.h>
+
+namespace Dali
+{
+namespace MeshFactory
+{
+
+Dali::MeshData NewPlane(const float width, const float height, const int xSteps, const int ySteps, const Rect<float>& textureCoordinates)
+{
+ DALI_ASSERT_DEBUG( xSteps > 1 && ySteps > 1 );
+
+ const int vertexCount = xSteps * ySteps;
+
+ // vertices
+ MeshData::VertexContainer vertices(vertexCount);
+ const float xSpacing = width / ( xSteps - 1 );
+ const float ySpacing = height / (ySteps - 1 );
+ const float xOffset = -xSpacing * (0.5f * xSteps) + (0.5f * xSpacing); // origin at (width / 2, height / 2)
+ const float yOffset = -ySpacing * (0.5f * ySteps) + (0.5f * ySpacing);
+ const float xSpacingUV = textureCoordinates.width / (xSteps - 1);
+ const float ySpacingUV = textureCoordinates.height / (ySteps - 1);
+ int vertexIndex = 0;
+ for( int y = 0; y < ySteps; ++y )
+ {
+ for( int x = 0; x < xSteps; ++x )
+ {
+ MeshData::Vertex& vertex = vertices[vertexIndex];
+ vertex.x = xOffset + (xSpacing * x);
+ vertex.y = yOffset + (ySpacing * y);
+ vertex.z = 0.0f;
+
+ vertex.nX = 0.0f;
+ vertex.nY = 0.0f;
+ vertex.nZ = 1.0f;
+
+ vertex.u = textureCoordinates.x + (xSpacingUV * x);
+ vertex.v = textureCoordinates.y + (ySpacingUV * y);
+ ++vertexIndex;
+ }
+ }
+
+ // faces
+ const int faceCount = 2 * ((ySteps - 1) * (xSteps - 1));
+ MeshData::FaceIndices faces( faceCount * 3 );
+ unsigned short* pIndex = &(faces)[0];
+ unsigned short index0 = 0;
+ unsigned short index1 = 0;
+ unsigned short index2 = 0;
+
+ for( int y = 0; y < ySteps - 1; ++y )
+ {
+ for( int x = 0; x < xSteps - 1; ++x )
+ {
+ index0 = (y * xSteps) + x;
+ index1 = ((y + 1) * xSteps) + x;
+ index2 = ((y + 1) * xSteps) + (x + 1);
+ *pIndex++ = index0;
+ *pIndex++ = index1;
+ *pIndex++ = index2;
+
+ index0 = ((y + 1) * xSteps) + (x + 1);
+ index1 = (y * xSteps) + (x + 1);
+ index2 = (y * xSteps) + x;
+ *pIndex++ = index0;
+ *pIndex++ = index1;
+ *pIndex++ = index2;
+ }
+ }
+
+ BoneContainer bones;
+
+ Dali::MeshData meshData;
+
+ meshData.SetHasNormals(true);
+ meshData.SetHasTextureCoords(true);
+ meshData.SetData( vertices, faces, bones, Dali::Material::New("PlaneMat"));
+
+ Vector4 vMin;
+ Vector4 vMax;
+ meshData.AddToBoundingVolume(vMin, vMax, Matrix::IDENTITY);
+
+ meshData.SetBoundingBoxMin(vMin);
+ meshData.SetBoundingBoxMax(vMax);
+
+ return meshData;
+}
+
+Dali::MeshData NewPath( Dali::Path path, const unsigned int resolution )
+{
+ MeshData meshData;
+ meshData.SetHasNormals(false);
+ meshData.SetHasTextureCoords(false);
+
+ if( resolution != 0 )
+ {
+ size_t vertexCount(resolution+1);
+ MeshData::VertexContainer vertex(vertexCount);
+
+ float sampleDelta = 1.0f/(float)resolution;
+ Vector3 tangent;
+ for( size_t i(0); i!=vertexCount; ++i )
+ {
+ //Sample path to get the vertex position
+ Vector3* vertexPosition = reinterpret_cast<Vector3*>(&vertex[i].x);
+ path.Sample( i*sampleDelta, *vertexPosition, tangent );
+ }
+
+ //Generate indices. Each vertex is connected to the next
+ size_t indexCount(resolution*2);
+ MeshData::FaceIndices index(indexCount);
+ unsigned int nIndex = 0;
+ for( size_t i(0); i!=indexCount; i+=2 )
+ {
+ index[i] = nIndex;
+ index[i+1] = ++nIndex;
+ }
+
+ meshData.SetLineData(vertex, index, Dali::Material::New("PathMat"));
+ }
+
+ return meshData;
+}
+
+} // MeshFactory
+} // Dali
--- /dev/null
+#ifndef __DALI_MESH_FACTORY_H__
+#define __DALI_MESH_FACTORY_H__
+/*
+ * Copyright (c) 2015 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <dali/public-api/math/rect.h>
+#include <dali/public-api/animation/path.h>
+
+namespace Dali
+{
+class MeshData;
+
+namespace MeshFactory
+{
+
+/**
+ * @brief Create an initialized plane aligned on the XY axis.
+ *
+ * @param[in] width The width of the plane
+ * @param[in] height The height of the plane
+ * @param[in] xSteps The number of vertices along the X axis
+ * @param[in] ySteps The number of vertices along the Y axis
+ * @param[in] textureCoordinates UV coordinates.
+ * @return A mesh data structure containing the plane mesh
+ */
+DALI_IMPORT_API Dali::MeshData NewPlane( const float width,
+ const float height,
+ const int xSteps,
+ const int ySteps,
+ const Rect<float>& textureCoordinates = Rect<float>(0.0f, 0.0f, 1.0f, 1.0f) );
+
+/**
+ * @brief Create a mesh from a given path.
+ * The mesh generated will be a set of lines, each one connecting a point sampled from the path to the next sampled point.
+ *
+ * @param[in] path The path used to generate the mesh
+ * @param[in] resolution The number of vertices to generate
+ * @return A mesh data structure containing the path mesh
+ */
+DALI_IMPORT_API Dali::MeshData NewPath( Dali::Path path, const unsigned int resolution );
+
+} // MeshFactory
+} // Dali
+
+#endif // __DALI_MESH_FACTORY_H__
--- /dev/null
+/*
+ * Copyright (c) 2015 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include <dali/devel-api/geometry/mesh.h>
+
+// INTERNAL INCLUDES
+#include <dali/internal/event/modeling/mesh-impl.h>
+#include <dali/internal/event/modeling/material-impl.h>
+#include <dali/devel-api/geometry/mesh-factory.h>
+#include <dali/public-api/common/dali-common.h>
+#include <dali/public-api/math/vector3.h>
+
+namespace Dali
+{
+
+namespace
+{
+
+} // namespace
+
+Mesh::Mesh()
+{
+}
+
+Mesh::~Mesh()
+{
+}
+
+Mesh::Mesh(const Mesh& handle)
+: BaseHandle(handle)
+{
+}
+
+Mesh& Mesh::operator=(const Mesh& rhs)
+{
+ BaseHandle::operator=(rhs);
+ return *this;
+}
+
+Mesh Mesh::New( const MeshData& meshData )
+{
+ // Convert material handle to intrusive pointer
+ Dali::Material material( meshData.GetMaterial() );
+ Internal::MaterialIPtr materialPtr( &GetImplementation( material ) );
+
+ Internal::MeshIPtr meshPtr = Internal::Mesh::New( meshData, true /* discardable */, false /* scaling not required */ );
+ return Mesh( meshPtr.Get() );
+}
+
+Mesh Mesh::NewPlane(const float width, const float height, const int xSteps, const int ySteps, const Rect<float>& textureCoordinates)
+{
+ MeshData meshData( MeshFactory::NewPlane(width, height, xSteps, ySteps, textureCoordinates) );
+ return New(meshData);
+}
+
+Mesh Mesh::DownCast( BaseHandle handle )
+{
+ return Mesh( dynamic_cast<Dali::Internal::Mesh*>(handle.GetObjectPtr()) );
+}
+
+void Mesh::UpdateMeshData( const MeshData& meshData )
+{
+ GetImplementation(*this).UpdateMeshData( meshData );
+}
+
+Mesh::Mesh(Internal::Mesh* internal)
+: BaseHandle(internal)
+{
+}
+
+} // namespace Dali
--- /dev/null
+#ifndef __DALI_MESH_H__
+#define __DALI_MESH_H__
+
+/*
+ * Copyright (c) 2015 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+
+// INTERNAL INCLUDES
+#include <dali/devel-api/geometry/mesh-data.h>
+#include <dali/public-api/math/rect.h>
+#include <dali/public-api/object/base-handle.h>
+
+namespace Dali
+{
+
+namespace Internal DALI_INTERNAL
+{
+class Mesh;
+}
+
+/**
+ * @brief A Mesh holds a MeshData object supplied by the application writer.
+ *
+ * It is used to tell the Scene Graph if the mesh data has changed.
+ */
+class DALI_IMPORT_API Mesh : public BaseHandle
+{
+public:
+
+ /**
+ * @brief Create an initialized Mesh.
+ *
+ * @param[in] meshData The mesh data with which to initialize the handle
+ * @return A handle to a newly allocated Dali resource.
+ */
+ static Mesh New( const MeshData& meshData );
+
+ /**
+ * @brief Create an uninitialized Mesh; this can be initialized with Mesh::New().
+ *
+ * Calling member functions with an uninitialized Dali::Object is not allowed.
+ */
+ Mesh();
+
+ /**
+ * @brief Destructor
+ *
+ * This is non-virtual since derived Handle types must not contain data or virtual methods.
+ */
+ ~Mesh();
+
+ /**
+ * @brief This copy constructor is required for (smart) pointer semantics.
+ *
+ * @param [in] handle A reference to the copied handle
+ */
+ Mesh(const Mesh& handle);
+
+ /**
+ * @brief This assignment operator is required for (smart) pointer semantics.
+ *
+ * @param [in] rhs A reference to the copied handle
+ * @return A reference to this
+ */
+ Mesh& operator=(const Mesh& rhs);
+
+ /**
+ * @brief Create an initialized plane aligned on the XY axis.
+ *
+ * @param[in] width The width of the plane
+ * @param[in] height The height of the plane
+ * @param[in] xSteps The number of vertices along the X axis
+ * @param[in] ySteps The number of vertices along the Y axis
+ * @param[in] textureCoordinates UV coordinates.
+ * @return A handle to a newly allocated Dali resource.
+ */
+ static Mesh NewPlane(const float width,
+ const float height,
+ const int xSteps,
+ const int ySteps,
+ const Rect<float>& textureCoordinates = Rect<float>(0.0f, 0.0f, 1.0f, 1.0f));
+
+ /**
+ * @brief Downcast an Object handle to Mesh handle.
+ *
+ * If handle points to a Mesh object the downcast produces valid
+ * handle. If not the returned handle is left uninitialized.
+ *
+ * @param[in] handle to An object
+ * @return handle to an Mesh object or an uninitialized handle
+ */
+ static Mesh DownCast( BaseHandle handle );
+
+ /**
+ * @brief Tell Dali to update it's internal meshes from the changed mesh data.
+ *
+ * @param[in] meshData
+ */
+ void UpdateMeshData( const MeshData& meshData );
+
+public: // Not intended for application developers
+
+ /**
+ * @brief This constructor is used by Dali New() methods.
+ *
+ * @param [in] mesh A pointer to a newly allocated Dali resource
+ */
+ explicit DALI_INTERNAL Mesh(Internal::Mesh* mesh);
+};
+
+} // namespace Dali
+
+#endif // __DALI_MESH_H__
--- /dev/null
+/*
+ * Copyright (c) 2015 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include <dali/devel-api/images/atlas.h>
+
+// INTERNAL INCLUDES
+#include <dali/internal/event/images/atlas-impl.h>
+#include <dali/internal/event/images/buffer-image-impl.h>
+
+namespace Dali
+{
+
+Atlas Atlas::New( SizeType width,
+ SizeType height,
+ Pixel::Format pixelFormat,
+ bool recoverContext )
+{
+ DALI_ASSERT_ALWAYS( 0u != width && "Invalid Atlas width requested" );
+ DALI_ASSERT_ALWAYS( 0u != height && "Invalid Atlas height requested" );
+
+ return Atlas( Internal::Atlas::New( width, height, pixelFormat, recoverContext ) );
+}
+
+Atlas::Atlas()
+{
+}
+
+void Atlas::Clear( const Vector4& color )
+{
+ GetImplementation( *this ).Clear( color );
+}
+
+bool Atlas::Upload( BufferImage bufferImage,
+ SizeType xOffset,
+ SizeType yOffset )
+{
+ return GetImplementation(*this).Upload( GetImplementation(bufferImage), xOffset, yOffset );
+}
+
+bool Atlas::Upload( const std::string& url,
+ SizeType xOffset,
+ SizeType yOffset )
+{
+ return GetImplementation(*this).Upload( url, xOffset, yOffset );
+}
+
+Atlas Atlas::DownCast( BaseHandle handle )
+{
+ return Atlas( dynamic_cast<Dali::Internal::Atlas*>(handle.GetObjectPtr()) );
+}
+
+Atlas::~Atlas()
+{
+}
+
+Atlas::Atlas( const Atlas& handle )
+: Image( handle )
+{
+}
+
+Atlas& Atlas::operator=( const Atlas& rhs )
+{
+ BaseHandle::operator=(rhs);
+ return *this;
+}
+
+Atlas::Atlas( Internal::Atlas* internal )
+: Image( internal )
+{
+}
+
+} // namespace Dali
--- /dev/null
+#ifndef __DALI_ATLAS_H__
+#define __DALI_ATLAS_H__
+
+/*
+ * Copyright (c) 2015 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <stdint.h>
+
+// INTERNAL INCLUDES
+#include <dali/public-api/common/dali-common.h>
+#include <dali/public-api/images/image.h>
+#include <dali/public-api/images/buffer-image.h>
+
+namespace Dali
+{
+
+namespace Internal DALI_INTERNAL
+{
+class Atlas;
+}
+
+/**
+ * @brief An Atlas is a large image containing multiple smaller images.
+ *
+ * Buffer image and resource image( by providing the url ) are supported for uploading.
+ * Images must be uploaded at a specified position, to populate the Atlas.
+ * The client is responsible for generating the appropriate geometry (UV coordinates) needed to draw images within the Atlas.
+ *
+ * For context recovery after loss:
+ * By default, the atlas will re-upload the resource images automatically,
+ * while the buffer images are left to the client to upload again by connecting to the Stage::ContextRegainedSignal().
+ * If resource and buffer images are mixed and they overlap inside the atlas, the recovered contents may be incorrect.
+ * In these case, switch off the context recovery by calling SetContextRecovery( false ),
+ * and upload both buffer images and resource image to the atlas in order to restore the atlas.
+ */
+class DALI_IMPORT_API Atlas : public Image
+{
+public:
+
+ typedef uint32_t SizeType;
+
+public:
+
+ /**
+ * @brief Create a new Atlas.
+ *
+ * @pre width & height are greater than zero.
+ * The maximum size of the atlas is limited by GL_MAX_TEXTURE_SIZE.
+ * @param [in] width The atlas width in pixels.
+ * @param [in] height The atlas height in pixels.
+ * @param [in] pixelFormat The pixel format (rgba 32 bit by default).
+ * @param [in] recoverContext Whether re-uploading the resource images automatically when regaining the context( true by default )
+ * @return A handle to a new Atlas.
+ */
+ static Atlas New( SizeType width,
+ SizeType height,
+ Pixel::Format pixelFormat = Pixel::RGBA8888,
+ bool recoverContext = true );
+
+ /**
+ * @brief Create an empty handle.
+ *
+ * Calling member functions of an empty handle is not allowed.
+ */
+ Atlas();
+
+ /**
+ * @brief Clear the Atlas with the given color
+ *
+ * @note The Atlas does not clear itself automatically during construction.
+ * Application should call this clear function to avoid getting garbage pixels in the atlas.
+ * By calling Clear, all the current uploaded image information will be lost.
+ * @param [in] color The color used to clear the Atlas.
+ */
+ void Clear( const Vector4& color );
+
+ /**
+ * @brief Upload a buffer image to the atlas.
+ *
+ * @pre The pixel format of this buffer image must match the Atlas format.
+ * @param [in] bufferImage The buffer image to upload.
+ * @param [in] xOffset Specifies an offset in the x direction within the atlas.
+ * @param [in] yOffset Specifies an offset in the y direction within the atlas.
+ * @return True if the image has compatible pixel format and fits within the atlas at the specified offset.
+ */
+ bool Upload( BufferImage bufferImage,
+ SizeType xOffset,
+ SizeType yOffset );
+
+ /**
+ * @brief Upload a resource image to atlas
+ *
+ * @param [in] url The URL of the resource image file to use
+ * @param [in] xOffset Specifies an offset in the x direction within the atlas.
+ * @param [in] yOffset Specifies an offset in the y direction within the atlas.
+ * @return True if the image has compatible pixel format and fits within the atlas at the specified offset.
+ */
+ bool Upload( const std::string& url,
+ SizeType xOffset,
+ SizeType yOffset );
+ /**
+ * @brief Downcast an Object handle to Atlas.
+ *
+ * If handle points to a Atlas the downcast produces valid
+ * handle. If not the returned handle is left uninitialized.
+ *
+ * @param[in] handle to An object
+ * @return handle to a Atlas or an empty handle
+ */
+ static Atlas DownCast( BaseHandle handle );
+
+ /**
+ * @brief Destructor
+ *
+ * This is non-virtual since derived Handle types must not contain data or virtual methods.
+ */
+ ~Atlas();
+
+ /**
+ * @brief This copy constructor is required for (smart) pointer semantics.
+ *
+ * @param [in] handle A reference to the copied handle
+ */
+ Atlas( const Atlas& handle );
+
+ /**
+ * @brief This assignment operator is required for (smart) pointer semantics.
+ *
+ * @param [in] rhs A reference to the copied handle
+ * @return A reference to this
+ */
+ Atlas& operator=( const Atlas& rhs);
+
+public: // Not intended for application developers
+
+ explicit DALI_INTERNAL Atlas( Internal::Atlas* );
+};
+
+} // namespace Dali
+
+#endif // __DALI_ATLAS_H__
--- /dev/null
+/*
+ * Copyright (c) 2015 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include <dali/devel-api/images/distance-field.h>
+
+// EXTERNAL INCLUDES
+#include <algorithm>
+#include <math.h>
+#include <stdio.h>
+#include <time.h>
+
+// INTERNAL INCLUDES
+#include <dali/public-api/common/constants.h>
+#include <dali/public-api/common/vector-wrapper.h>
+#include <dali/public-api/math/vector2.h>
+#include <dali/public-api/math/math-utils.h>
+
+namespace Dali
+{
+
+namespace
+{
+
+float Interpolate( float a, float b, float factor )
+{
+ return a * (1.0f - factor) + b * factor;
+}
+
+float Bilinear( float a, float b, float c, float d, float dx, float dy )
+{
+ return Interpolate( Interpolate( a, b, dx), Interpolate( c, d, dx ), dy );
+}
+
+void ScaleField( int width, int height, float* in, int targetWidth, int targetHeight, float* out )
+{
+ float xScale = static_cast< float >(width) / targetWidth;
+ float yScale = static_cast< float >(height) / targetHeight;
+
+ // for each row in target
+ for(int y = 0; y < targetHeight; ++y)
+ {
+ const int sampleY = static_cast< int >( yScale * y );
+ const int otherY = std::min( sampleY + 1, height - 1 );
+ const float dy = (yScale * y ) - sampleY;
+
+ // for each column in target
+ for (int x = 0; x < targetWidth; ++x)
+ {
+ const int sampleX = static_cast< int >( xScale * x );
+ const int otherX = std::min( sampleX + 1, width - 1 );
+ const float dx = (xScale * x) - sampleX;
+
+ float value = Bilinear( in[ sampleY * width + sampleX ],
+ in[ sampleY * width + otherX ],
+ in[ otherY * width + sampleX ],
+ in[ otherY * width + otherX ],
+ dx, dy );
+
+ out[y * targetWidth + x] = std::min( value, 1.0f );
+ }
+ }
+}
+
+#define SQUARE(a) ((a) * (a))
+const float MAX_DISTANCE( 1e20 );
+
+/**
+ * Distance transform of 1D function using squared distance
+ */
+void DistanceTransform( float *source, float* dest, unsigned int length )
+{
+ int parabolas[length]; // Locations of parabolas in lower envelope
+ float edge[length + 1]; // Locations of boundaries between parabolas
+ int rightmost(0); // Index of rightmost parabola in lower envelope
+
+ parabolas[0] = 0;
+ edge[0] = -MAX_DISTANCE;
+ edge[1] = +MAX_DISTANCE;
+ for( unsigned int i = 1; i <= length - 1; i++ )
+ {
+ const float initialDistance( source[i] + SQUARE( i ) );
+ int parabola = parabolas[rightmost];
+ float newDistance( (initialDistance - (source[parabola] + SQUARE( parabola ))) / (2 * i - 2 * parabola) );
+ while( rightmost > 0 && newDistance <= edge[rightmost] )
+ {
+ rightmost--;
+ parabola = parabolas[rightmost];
+ newDistance = (initialDistance - (source[parabola] + SQUARE( parabola ))) / (2 * i - 2 * parabola);
+ }
+
+ rightmost++;
+ parabolas[rightmost] = i;
+ edge[rightmost] = newDistance;
+ edge[rightmost + 1] = MAX_DISTANCE;
+ }
+
+ rightmost = 0;
+ for( unsigned int i = 0; i <= length - 1; ++i )
+ {
+ while( edge[rightmost + 1] < i )
+ {
+ ++rightmost;
+ }
+ dest[i] = SQUARE( i - parabolas[rightmost] ) + source[parabolas[rightmost]];
+ }
+}
+
+/**
+ * Distance transform of 2D function using squared distance
+ */
+void DistanceTransform( float* data, unsigned int width, unsigned int height, float* sourceBuffer, float* destBuffer )
+{
+ // transform along columns
+ for( unsigned int x = 0; x < width; ++x )
+ {
+ for( unsigned int y = 0; y < height; ++y )
+ {
+ sourceBuffer[y] = data[ y * width + x ];
+ }
+
+ DistanceTransform( sourceBuffer, destBuffer, height );
+
+ for( unsigned int y = 0; y < height; y++ )
+ {
+ data[y * width + x] = destBuffer[y];
+ }
+ }
+
+ // transform along rows
+ for( unsigned int y = 0; y < height; ++y )
+ {
+ for( unsigned int x = 0; x < width; ++x )
+ {
+ sourceBuffer[x] = data[ y * width + x ];
+ }
+
+ DistanceTransform( sourceBuffer, destBuffer, width );
+
+ for( unsigned int x = 0; x < width; x++ )
+ {
+ data[y * width + x] = destBuffer[x];
+ }
+ }
+}
+
+} // namespace
+
+void GenerateDistanceFieldMap(const unsigned char* const imagePixels, const Size& imageSize,
+ unsigned char* const distanceMap, const Size& distanceMapSize,
+ const float fieldRadius, const unsigned int fieldBorder, bool highQuality)
+{
+ GenerateDistanceFieldMap( imagePixels, imageSize, distanceMap, distanceMapSize, fieldBorder, imageSize, highQuality );
+}
+
+void GenerateDistanceFieldMap(const unsigned char* const imagePixels, const Size& imageSize,
+ unsigned char* const distanceMap, const Size& distanceMapSize,
+ const unsigned int fieldBorder,
+ const Vector2& maxSize,
+ bool highQuality)
+{
+ // constants to reduce redundant calculations
+ const int originalWidth( static_cast<int>(imageSize.width) );
+ const int originalHeight( static_cast<int>(imageSize.height) );
+ const int paddedWidth( originalWidth + (fieldBorder * 2 ) );
+ const int paddedHeight( originalHeight + (fieldBorder * 2 ) );
+ const int scaledWidth( static_cast<int>(distanceMapSize.width) );
+ const int scaledHeight( static_cast<int>(distanceMapSize.height) );
+ const int maxWidth( static_cast<int>(maxSize.width) + (fieldBorder * 2 ));
+ const int maxHeight( static_cast<int>(maxSize.height) + (fieldBorder * 2 ) );
+
+ const int bufferLength( std::max( maxWidth, std::max(paddedWidth, scaledWidth) ) *
+ std::max( maxHeight, std::max(paddedHeight, scaledHeight) ) );
+
+ std::vector<float> outsidePixels( bufferLength, 0.0f );
+ std::vector<float> insidePixels( bufferLength, 0.0f );
+
+ float* outside( outsidePixels.data() );
+ float* inside( insidePixels.data() );
+
+ for( int y = 0; y < paddedHeight; ++y )
+ {
+ for ( int x = 0; x < paddedWidth; ++x)
+ {
+ if( y < (int)fieldBorder || y >= (paddedHeight - (int)fieldBorder) ||
+ x < (int)fieldBorder || x >= (paddedWidth - (int)fieldBorder) )
+ {
+ outside[ y * paddedWidth + x ] = MAX_DISTANCE;
+ inside[ y * paddedWidth + x ] = 0.0f;
+ }
+ else
+ {
+ unsigned int pixel( imagePixels[ (y - fieldBorder) * originalWidth + (x - fieldBorder) ] );
+ outside[ y * paddedWidth + x ] = (pixel == 0) ? MAX_DISTANCE : SQUARE((255 - pixel) / 255.0f);
+ inside[ y * paddedWidth + x ] = (pixel == 255) ? MAX_DISTANCE : SQUARE(pixel / 255.0f);
+ }
+ }
+ }
+
+ // perform distance transform if high quality requested, else use original figure
+ if( highQuality )
+ {
+ // create temporary buffers for DistanceTransform()
+ const int tempBufferLength( std::max(paddedWidth, paddedHeight) );
+ std::vector<float> tempSourceBuffer( tempBufferLength, 0.0f );
+ std::vector<float> tempDestBuffer( tempBufferLength, 0.0f );
+
+ // Perform distance transform for pixels 'outside' the figure
+ DistanceTransform( outside, paddedWidth, paddedHeight, tempSourceBuffer.data(), tempDestBuffer.data() );
+
+ // Perform distance transform for pixels 'inside' the figure
+ DistanceTransform( inside, paddedWidth, paddedHeight, tempSourceBuffer.data(), tempDestBuffer.data() );
+ }
+
+ // distmap = outside - inside; % Bipolar distance field
+ for( int y = 0; y < paddedHeight; ++y)
+ {
+ for( int x = 0; x < paddedWidth; ++x )
+ {
+ const int offset( y * paddedWidth + x );
+ float pixel( sqrtf(outside[offset]) - sqrtf(inside[offset]) );
+ pixel = 128.0f + pixel * 16.0f;
+ pixel = Clamp( pixel, 0.0f, 255.0f );
+ outside[offset] = (255.0f - pixel) / 255.0f;
+ }
+ }
+
+ // scale the figure to the distance field tile size
+ ScaleField( paddedWidth, paddedHeight, outside, scaledWidth, scaledHeight, inside );
+
+ // convert from floats to integers
+ for( int y = 0; y < scaledHeight; ++y )
+ {
+ for( int x = 0; x < scaledWidth; ++x )
+ {
+ float pixel( inside[ y * scaledWidth + x ] );
+ distanceMap[y * scaledWidth + x ] = static_cast< unsigned char >(pixel * 255.0f);
+ }
+ }
+}
+
+} // namespace Dali
--- /dev/null
+#ifndef __DALI_DISTANCE_FIELD_H__
+#define __DALI_DISTANCE_FIELD_H__
+
+/*
+ * Copyright (c) 2015 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+
+// INTERNAL INCLUDES
+#include <dali/public-api/common/dali-common.h>
+
+namespace Dali
+{
+
+struct Vector2;
+
+/**
+ * @brief Generate a distance field map from a source image.
+ *
+ * @param[in] imagePixels A pointer to a buffer containing the source image
+ * @param[in] imageSize The size, width and height, of the source image
+ * @param[out] distanceMap A pointer to a buffer to receive the calculated distance field map.
+ * Note: This must not overlap with imagePixels for correct distance field map generation.
+ * @param[in] distanceMapSize The size, width and height, of the distance field map
+ * @param[in] fieldBorder The amount of distance field cells to add around the data (for glow/shadow effects)
+ * @param[in] maxSize The image is scaled from this size to distanceMapSize
+ * @param[in] highQuality Set true to generate high quality distance fields
+ */
+DALI_IMPORT_API void GenerateDistanceFieldMap( const unsigned char* const imagePixels, const Vector2& imageSize,
+ unsigned char* const distanceMap, const Vector2& distanceMapSize,
+ const unsigned int fieldBorder,
+ const Vector2& maxSize,
+ bool highQuality = true);
+
+} //namespace Dali
+
+#endif // ifndef __DALI_DISTANCE_FIELD_H__
--- /dev/null
+#ifndef __DALI_IMAGE_OPERATIONS_H__
+#define __DALI_IMAGE_OPERATIONS_H__
+
+/*
+ * Copyright (c) 2015 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// EXTERNAL INCLUDES
+
+// INTERNAL INCLUDES
+#include <dali/public-api/math/uint-16-pair.h>
+
+namespace Dali
+{
+
+/**
+ * @brief The integer dimensions of an image or a region of an image packed into
+ * 16 bits per component.
+ *
+ * This can only be used for images of up to 65535 x 65535 pixels.
+ */
+typedef Uint16Pair ImageDimensions;
+
+/**
+ * @brief Fitting options, used when resizing images to fit desired dimensions.
+ *
+ * A fitting mode controls the region of a loaded image to be mapped to the
+ * desired image rectangle.
+ * All fitting modes preserve the aspect ratio of the image contents.
+ */
+namespace FittingMode
+{
+ enum Type
+ {
+ SHRINK_TO_FIT, ///< Fit full image inside desired width & height, potentially not
+ /// filling one of either the desired image width or height with
+ /// pixels.
+ SCALE_TO_FILL, ///< Image fills whole desired width & height with image data. The
+ /// image is centred in the desired dimensions, exactly touching
+ /// in one dimension, with image regions outside the other desired
+ /// dimension cropped away.
+ FIT_WIDTH, ///< Image fills whole width. Height is scaled proportionately to
+ /// maintain aspect ratio.
+ FIT_HEIGHT ///< Image fills whole height. Width is scaled proportionately to
+ /// maintain aspect ratio.
+ };
+ const Type DEFAULT = SHRINK_TO_FIT;
+}
+
+/**
+ * @brief Filtering options, used when resizing images to sample original pixels.
+ *
+ * A SamplingMode controls how pixels in an input image are sampled and
+ * combined to generate each pixel of a destination image during a scaling.
+ *
+ * NoFilter and Box modes do not guarantee that the output pixel array
+ * exactly matches the rectangle specified by the desired dimensions and
+ * FittingMode, but all other filter modes do if the desired dimensions are
+ * `<=` the raw dimensions of the input image file.
+ */
+namespace SamplingMode
+{
+ enum Type
+ {
+ BOX, ///< Iteratively box filter to generate an image of 1/2, 1/4,
+ /// 1/8, etc width and height and approximately the desired
+ /// size. This is the default.
+ NEAREST, ///< For each output pixel, read one input pixel.
+ LINEAR, ///< For each output pixel, read a quad of four input pixels
+ /// and write a weighted average of them.
+ BOX_THEN_NEAREST, ///< Iteratively box filter to generate an image of 1/2, 1/4,
+ /// 1/8 etc width and height and approximately the desired
+ /// size, then for each output pixel, read one pixel from the
+ /// last level of box filtering.
+ BOX_THEN_LINEAR, ///< Iteratively box filter to almost the right size, then for
+ /// each output pixel, read four pixels from the last level of
+ /// box filtering and write their weighted average.
+ NO_FILTER, ///< No filtering is performed. If the SCALE_TO_FILL scaling mode
+ /// is enabled, the borders of the image may be trimmed to
+ /// match the aspect ratio of the desired dimensions.
+ DONT_CARE ///< For caching algorithms where a client strongly prefers a
+ /// cache-hit to reuse a cached image.
+ };
+ const Type DEFAULT = BOX;
+}
+
+} // namespace Dali
+
+#endif // __DALI_IMAGE_OPERATIONS_H__
--- /dev/null
+#ifndef __DALI_INTEGRATION_NATIVE_IMAGE_INTERFACE_H__
+#define __DALI_INTEGRATION_NATIVE_IMAGE_INTERFACE_H__
+
+/*
+ * Copyright (c) 2015 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/public-api/object/ref-object.h>
+
+namespace Dali
+{
+
+/**
+ * @brief Abstract interface to provide platform-specific support for handling image data.
+ *
+ * For example, an implementation could use EGL extensions, etc.
+ */
+class NativeImageInterface : public Dali::RefObject
+{
+public:
+
+ /**
+ * @brief Create the GL resource for the NativeImage.
+ *
+ * e.g. For the EglImageKHR extension, this corresponds to calling eglCreateImageKHR()
+ * @pre There is a GL context for the current thread.
+ * @return false If the initialization fails.
+ */
+ virtual bool GlExtensionCreate() = 0;
+
+ /**
+ * @brief Destroy the GL resource for the NativeImage.
+ *
+ * e.g. For the EglImageKHR extension, this corresponds to calling eglDestroyImageKHR()
+ * @pre There is a GL context for the current thread.
+ */
+ virtual void GlExtensionDestroy() = 0;
+
+ /**
+ * @brief Use the NativeImage as a texture for rendering.
+ *
+ * @pre There is a GL context for the current thread.
+ * @return A GL error code
+ */
+ virtual unsigned int TargetTexture() = 0;
+
+ /**
+ * @brief Called in each NativeTexture::Bind() call to allow implementation specific operations.
+ *
+ * The correct texture sampler has already been bound before the function gets called.
+ * @pre glAbstraction is being used by context in current thread
+ */
+ virtual void PrepareTexture() = 0;
+
+ /**
+ * @brief Returns the width of the NativeImage.
+ *
+ * @return width
+ */
+ virtual unsigned int GetWidth() const = 0;
+
+ /**
+ * @brief Returns the height of the NativeImage.
+ *
+ * @return height
+ */
+ virtual unsigned int GetHeight() const = 0;
+
+ /**
+ * Query whether blending is required
+ */
+ virtual bool RequiresBlending() const = 0;
+
+protected:
+
+ /**
+ * @brief A reference counted object may only be deleted by calling Unreference().
+ *
+ * The implementation should destroy the NativeImage resources.
+ */
+ virtual ~NativeImageInterface()
+ {
+ }
+
+};
+
+/**
+ * @brief Pointer to Dali::NativeImageInterface
+ */
+typedef IntrusivePtr<NativeImageInterface> NativeImageInterfacePtr;
+
+} // namespace Dali
+
+#endif // __DALI_INTEGRATION_NATIVE_IMAGE_INTERFACE_H__
--- /dev/null
+/*
+ * Copyright (c) 2015 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include <dali/devel-api/modeling/bone.h>
+
+namespace Dali
+{
+
+Bone::Bone ()
+{
+}
+
+Bone::Bone( const std::string& name, const Matrix& offsetMatrix )
+: mName( name ),
+ mOffsetMatrix( offsetMatrix )
+{
+}
+
+Bone::~Bone()
+{
+}
+
+Bone::Bone( const Bone& rhs )
+: mName(rhs.mName),
+ mOffsetMatrix(rhs.mOffsetMatrix)
+{
+}
+
+Bone& Bone::operator=(const Bone& rhs)
+{
+ if (this != &rhs)
+ {
+ mName = rhs.mName;
+ mOffsetMatrix = rhs.mOffsetMatrix;
+ }
+ return *this;
+}
+
+const std::string& Bone::GetName() const
+{
+ return mName;
+}
+
+const Matrix& Bone::GetOffsetMatrix() const
+{
+ return mOffsetMatrix;
+}
+
+} // namespace Dali
--- /dev/null
+#ifndef __DALI_BONE_H__
+#define __DALI_BONE_H__
+
+/*
+ * Copyright (c) 2015 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <string>
+
+// INTERNAL INCLUDES
+#include <dali/public-api/common/vector-wrapper.h>
+#include <dali/public-api/math/matrix.h>
+
+namespace Dali
+{
+
+class Matrix;
+
+class Bone;
+typedef std::vector< Bone > BoneContainer; ///< Container for bones
+typedef BoneContainer::iterator BoneIter; ///< @ref Dali::BoneContainer iterator
+typedef BoneContainer::const_iterator BoneConstIter; ///< @ref Dali::BoneContainer const iterator
+
+/**
+ * @brief A single bone in a mesh.
+ *
+ * A Bone is a named actor that can be used to deform a mesh. @see Dali::MeshData for more
+ * information.
+ */
+class DALI_IMPORT_API Bone
+{
+public:
+ /**
+ * @brief Default constructor.
+ */
+ Bone ();
+
+ /**
+ * @brief Constructor.
+ *
+ * @param name of the bone
+ * @param offsetMatrix for the bone
+ */
+ Bone( const std::string& name, const Matrix& offsetMatrix );
+
+ /**
+ * @brief Destructor.
+ */
+ ~Bone();
+
+ /**
+ * @brief Copy constructor.
+ */
+ Bone( const Bone& rhs );
+
+ /**
+ * @brief Assignment operator.
+ */
+ Bone& operator=(const Bone& rhs);
+
+ /**
+ * @brief Get name.
+ *
+ * @return returns the name of the bone
+ */
+ const std::string& GetName() const;
+
+ /**
+ * @brief Get offset matrix.
+ *
+ * @return returns the offset matrix for this bone
+ */
+ const Matrix& GetOffsetMatrix() const;
+
+private:
+ // Attributes
+ std::string mName; ///< Name of bone
+ Matrix mOffsetMatrix; ///< Transform from mesh space to bone space in bind pose.
+
+}; // struct Bone
+
+} // namespace Dali
+
+#endif // __DALI_BONE_H__
--- /dev/null
+/*
+ * Copyright (c) 2015 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include <dali/devel-api/modeling/material.h>
+
+// INTERNAL INCLUDES
+#include <dali/internal/event/modeling/material-impl.h>
+
+namespace Dali
+{
+
+const float Material::DEFAULT_OPACITY = 1.0f;
+const float Material::DEFAULT_SHININESS = 0.5f;
+const Vector4 Material::DEFAULT_AMBIENT_COLOR(0.2f, 0.2f, 0.2f, 1.0f);
+const Vector4 Material::DEFAULT_DIFFUSE_COLOR (0.8f, 0.8f, 0.8f, 1.0f);
+const Vector4 Material::DEFAULT_SPECULAR_COLOR(0.0f, 0.0f, 0.0f, 1.0f);
+const Vector4 Material::DEFAULT_EMISSIVE_COLOR(0.0f, 0.0f, 0.0f, 1.0f);
+const Material::MappingMode Material::DEFAULT_MAPPING_MODE = Material::MAPPING_MODE_WRAP;
+const size_t Material::DEFAULT_DIFFUSE_UV_INDEX = 0;
+const size_t Material::DEFAULT_OPACITY_UV_INDEX = 0;
+const size_t Material::DEFAULT_NORMAL_UV_INDEX = 0;
+const bool Material::DEFAULT_HAS_HEIGHT_MAP = false;
+
+
+Material Material::New(const std::string& name)
+{
+ Internal::Material* internal = Internal::Material::New(name);
+
+ return Material(internal);
+}
+
+Material Material::DownCast( BaseHandle handle )
+{
+ return Material( dynamic_cast<Dali::Internal::Material*>(handle.GetObjectPtr()) );
+}
+
+Material::Material(Internal::Material* internal)
+: BaseHandle(internal)
+{
+}
+
+Material::Material()
+{
+}
+
+Material::~Material()
+{
+}
+
+Material::Material(const Material& handle)
+: BaseHandle(handle)
+{
+}
+
+Material& Material::operator=(const Material& rhs)
+{
+ BaseHandle::operator=(rhs);
+ return *this;
+}
+
+void Material::SetName(const std::string& name)
+{
+ GetImplementation(*this).SetName(name);
+}
+
+const std::string& Material::GetName() const
+{
+ return GetImplementation(*this).GetName();
+}
+
+void Material::SetOpacity(const float opacity)
+{
+ GetImplementation(*this).SetOpacity(opacity);
+}
+
+float Material::GetOpacity() const
+{
+ return GetImplementation(*this).GetOpacity();
+}
+
+void Material::SetShininess(const float shininess)
+{
+ GetImplementation(*this).SetShininess(shininess);
+}
+
+float Material::GetShininess() const
+{
+ return GetImplementation(*this).GetShininess();
+}
+
+void Material::SetAmbientColor(const Vector4& color)
+{
+ GetImplementation(*this).SetAmbientColor(color);
+}
+
+const Vector4& Material::GetAmbientColor() const
+{
+ return GetImplementation(*this).GetAmbientColor();
+}
+
+void Material::SetDiffuseColor(const Vector4& color)
+{
+ GetImplementation(*this).SetDiffuseColor(color);
+}
+
+const Vector4& Material::GetDiffuseColor() const
+{
+ return GetImplementation(*this).GetDiffuseColor();
+}
+
+void Material::SetSpecularColor(const Vector4& color)
+{
+ GetImplementation(*this).SetSpecularColor(color);
+}
+
+const Vector4& Material::GetSpecularColor() const
+{
+ return GetImplementation(*this).GetSpecularColor();
+}
+
+void Material::SetEmissiveColor(const Vector4& color)
+{
+ GetImplementation(*this).SetEmissiveColor(color);
+}
+
+const Vector4& Material::GetEmissiveColor() const
+{
+ return GetImplementation(*this).GetEmissiveColor();
+}
+
+void Material::SetDiffuseTexture(Image image)
+{
+ GetImplementation(*this).SetDiffuseTexture(image);
+}
+
+Image Material::GetDiffuseTexture() const
+{
+ return GetImplementation(*this).GetDiffuseTexture();
+}
+
+void Material::SetOpacityTexture(Image image)
+{
+ GetImplementation(*this).SetOpacityTexture(image);
+}
+
+Image Material::GetOpacityTexture() const
+{
+ return GetImplementation(*this).GetOpacityTexture();
+}
+
+void Material::SetNormalMap(Image image)
+{
+ GetImplementation(*this).SetNormalMap(image);
+}
+
+Image Material::GetNormalMap() const
+{
+ return GetImplementation(*this).GetNormalMap();
+}
+
+void Material::SetMapU(const unsigned int map)
+{
+ GetImplementation(*this).SetMapU(map);
+}
+
+unsigned int Material::GetMapU() const
+{
+ return GetImplementation(*this).GetMapU();
+}
+
+void Material::SetMapV(const unsigned int map)
+{
+ GetImplementation(*this).SetMapV(map);
+}
+
+unsigned int Material::GetMapV() const
+{
+ return GetImplementation(*this).GetMapV();
+}
+
+void Material::SetDiffuseUVIndex(const int index)
+{
+ GetImplementation(*this).SetDiffuseUVIndex(index);
+}
+
+unsigned int Material::GetDiffuseUVIndex() const
+{
+ return GetImplementation(*this).GetDiffuseUVIndex();
+}
+
+void Material::SetOpacityUVIndex(const int index)
+{
+ GetImplementation(*this).SetOpacityUVIndex(index);
+}
+
+unsigned int Material::GetOpacityUVIndex() const
+{
+ return GetImplementation(*this).GetOpacityUVIndex();
+}
+
+void Material::SetNormalUVIndex(const int index)
+{
+ GetImplementation(*this).SetNormalUVIndex(index);
+}
+
+unsigned int Material::GetNormalUVIndex() const
+{
+ return GetImplementation(*this).GetNormalUVIndex();
+}
+
+void Material::SetHasHeightMap(const bool flag)
+{
+ GetImplementation(*this).SetHasHeightMap(flag);
+}
+
+bool Material::GetHasHeightMap() const
+{
+ return GetImplementation(*this).GetHasHeightMap();
+}
+
+
+void Material::SetDiffuseTextureFileName(const std::string filename)
+{
+ GetImplementation(*this).SetDiffuseTextureFileName(filename);
+}
+const std::string& Material::GetDiffuseFileName() const
+{
+ return GetImplementation(*this).GetDiffuseTextureFileName();
+}
+void Material::SetOpacityTextureFileName(const std::string filename)
+{
+ GetImplementation(*this).SetOpacityTextureFileName(filename);
+}
+const std::string& Material::GetOpacityTextureFileName() const
+{
+ return GetImplementation(*this).GetOpacityTextureFileName();
+}
+void Material::SetNormalMapFileName(const std::string filename)
+{
+ GetImplementation(*this).SetNormalMapFileName(filename);
+}
+const std::string& Material::GetNormalMapFileName() const
+{
+ return GetImplementation(*this).GetNormalMapFileName();
+}
+
+} // namespace Dali
--- /dev/null
+#ifndef __DALI_MATERIAL_H__
+#define __DALI_MATERIAL_H__
+
+/*
+ * Copyright (c) 2015 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/public-api/images/image.h>
+#include <dali/public-api/common/constants.h>
+
+namespace Dali
+{
+
+struct Vector4;
+
+namespace Internal DALI_INTERNAL
+{
+class Material;
+}
+
+
+class Material;
+typedef std::vector<Material> MaterialContainer; ///< Container for Dali::Material
+typedef MaterialContainer::iterator MaterialIter; ///< Iterator for Dali::MaterialContainer
+typedef MaterialContainer::const_iterator MaterialConstIter; ///< Const iterator for Dali::MaterialContainer
+
+/**
+ * @brief Encapsulates the data describing a material.
+ *
+ * Color, opacity, shininess, shading mode, texture/normal/height mapping...
+ */
+class DALI_IMPORT_API Material : public BaseHandle
+{
+public:
+ /**
+ * @brief How the material's texture is sampled outside the range 0..1
+ */
+ enum MappingMode
+ {
+ MAPPING_MODE_WRAP = 0x0, ///< A texture coordinate u|v is translated to u%1|v%1
+ MAPPING_MODE_CLAMP = 0x1, ///< Texture coordinates outside [0...1] are clamped to the nearest valid value
+ MAPPING_MODE_MIRROR = 0x2, ///< A texture coordinate u|v becomes u%1|v%1 if (u-(u%1))%2 is zero and 1-(u%1)|1-(v%1) otherwise
+ MAPPING_MODE_DECAL = 0x3, ///< If the texture coordinates for a pixel are outside [0...1] the texture is not applied to that pixel
+ };
+
+ static const float DEFAULT_OPACITY; ///< 1.0f
+ static const float DEFAULT_SHININESS; ///< 0.5f
+ static const Vector4 DEFAULT_AMBIENT_COLOR; ///< (0.2f, 0.2f, 0.2f, 1.0f)
+ static const Vector4 DEFAULT_DIFFUSE_COLOR; ///< (0.8f, 0.8f, 0.8f, 1.0f)
+ static const Vector4 DEFAULT_SPECULAR_COLOR; ///< (0.0f, 0.0f, 0.0f, 1.0f)
+ static const Vector4 DEFAULT_EMISSIVE_COLOR; ///< (0.0f, 0.0f, 0.0f, 1.0f)
+ static const MappingMode DEFAULT_MAPPING_MODE; ///< Material::MAPPING_MODE_WRAP
+ static const size_t DEFAULT_DIFFUSE_UV_INDEX; ///< 0
+ static const size_t DEFAULT_OPACITY_UV_INDEX; ///< 0
+ static const size_t DEFAULT_NORMAL_UV_INDEX; ///< 0
+ static const bool DEFAULT_HAS_HEIGHT_MAP; ///< false
+
+ /**
+ * @brief Create an initialized Material.
+ *
+ * @param[in] name The material's name
+ * @return A handle to a newly allocated Dali resource.
+ */
+ static Material New(const std::string& name);
+
+ /**
+ * @brief Downcast an Object handle to Material handle.
+ *
+ * If handle points to a Material object the
+ * downcast produces valid handle. If not the returned handle is left uninitialized.
+ * @param[in] handle to An object
+ * @return handle to a Material object or an uninitialized handle
+ */
+ static Material DownCast( BaseHandle handle );
+
+ /**
+ * @brief Create an uninitialized material; this can be initialized with Material::New().
+ *
+ * Calling member functions with an uninitialized Dali::Object is not allowed.
+ */
+ Material();
+
+ /**
+ * @brief Destructor
+ *
+ * This is non-virtual since derived Handle types must not contain data or virtual methods.
+ */
+ ~Material();
+
+ /**
+ * @brief This copy constructor is required for (smart) pointer semantics.
+ *
+ * @param [in] handle A reference to the copied handle
+ */
+ Material(const Material& handle);
+
+ /**
+ * @brief This assignment operator is required for (smart) pointer semantics.
+ *
+ * @param [in] rhs A reference to the copied handle
+ * @return A reference to this
+ */
+ Material& operator=(const Material& rhs);
+
+ /**
+ * @brief Set the material's name.
+ *
+ * @param[in] name The material's name
+ */
+ void SetName(const std::string& name);
+
+ /**
+ * @brief Get the material's name.
+ */
+ const std::string& GetName() const;
+
+ /**
+ * @brief Set the material's opacity.
+ *
+ * @param[in] opacity The new opacity value
+ */
+ void SetOpacity(const float opacity);
+
+ /**
+ * @brief Get the material's opacity.
+ *
+ * @return The opacity.
+ */
+ float GetOpacity() const;
+
+ /**
+ * @brief Set the material's shininess (used for specular highlighting).
+ *
+ * @param[in] shininess The new shininess value
+ */
+ void SetShininess(const float shininess);
+
+ /**
+ * @brief Get the material's shininess.
+ *
+ * @return The shininess.
+ */
+ float GetShininess() const;
+
+ /**
+ * @brief Set the material's ambient color.
+ *
+ * @param[in] color The new color value
+ */
+ void SetAmbientColor(const Vector4& color);
+
+ /**
+ * @brief Get the material's ambient color.
+ *
+ * @return The color value
+ */
+ const Vector4& GetAmbientColor() const;
+
+ /**
+ * @brief Set the material's diffuse color.
+ *
+ * @param[in] color The new color value
+ */
+ void SetDiffuseColor(const Vector4& color);
+
+ /**
+ * @brief Get the material's diffuse color.
+ *
+ * @return The color value
+ */
+ const Vector4& GetDiffuseColor() const;
+
+ /**
+ * @brief Set the material's specular color.
+ *
+ * @param[in] color The new color value
+ */
+ void SetSpecularColor(const Vector4& color);
+
+ /**
+ * @brief Get the material's specular color.
+ *
+ * @return The color value
+ */
+ const Vector4& GetSpecularColor() const;
+
+ /**
+ * @brief Set the material's emissive color.
+ *
+ * @param[in] color The new color value
+ */
+ void SetEmissiveColor(const Vector4& color);
+
+ /**
+ * @brief Get the material's emissive color.
+ *
+ * @return The color value
+ */
+ const Vector4& GetEmissiveColor() const;
+
+ /**
+ * @brief Set the diffuse texture image.
+ *
+ * @param[in] image The new texture image
+ */
+ void SetDiffuseTexture(Image image);
+
+ /**
+ * @brief Set the diffuse texture image.
+ *
+ * @param[in] filename The name of the image file
+ */
+ void SetDiffuseTextureFileName(const std::string filename);
+
+ /**
+ * @brief Get the diffuse texture image.
+ *
+ * @return The texture image
+ */
+ Image GetDiffuseTexture() const;
+
+ /**
+ * @brief Get the diffuse texture image filename.
+ *
+ * @return the filename
+ */
+ const std::string& GetDiffuseFileName() const;
+
+ /**
+ * @brief Set the opacity texture image.
+ *
+ * @param[in] image The new texture image
+ */
+ void SetOpacityTexture(Image image);
+
+ /**
+ * @brief Set the opacity texture image.
+ *
+ * @param[in] filename The opacity texture image filename
+ */
+ void SetOpacityTextureFileName(const std::string filename);
+
+ /**
+ * @brief Get the opacity texture image.
+ *
+ * @return The texture image
+ */
+ Image GetOpacityTexture() const;
+
+ /**
+ * @brief Get the opacity texture image filename.
+ *
+ * @return The texture image's filename
+ */
+ const std::string& GetOpacityTextureFileName() const;
+
+
+ /**
+ * @brief Set the normal/height map texture image.
+ *
+ * @param[in] image The new texture image
+ */
+ void SetNormalMap(Image image);
+
+ /**
+ * @brief Set the normal/height map texture image filename.
+ *
+ * @param[in] filename The new texture image filename
+ */
+ void SetNormalMapFileName(const std::string filename);
+
+ /**
+ * @brief Get the normal/height map texture image.
+ *
+ * @return The texture image
+ */
+ Image GetNormalMap() const;
+
+ /**
+ * @brief Get the normal/height map texture image filename.
+ *
+ * @return The texture image filename
+ */
+ const std::string& GetNormalMapFileName() const;
+
+ /**
+ * @brief Set the U mapping mode.
+ *
+ * @param[in] map The mapping mode
+ */
+ void SetMapU(const unsigned int map);
+
+ /**
+ * @brief Get the U mapping mode.
+ *
+ * @return The mapping mode
+ */
+ unsigned int GetMapU() const;
+
+ /**
+ * @brief Set the V mapping mode.
+ *
+ * @param[in] map The mapping mode
+ */
+ void SetMapV(const unsigned int map);
+
+ /**
+ * @brief Get the U mapping mode.
+ *
+ * @return The mapping mode
+ */
+ unsigned int GetMapV() const;
+
+ /**
+ * @brief Set the index into the bound mesh's array of UV's for the diffuse texture coordinates.
+ *
+ * @param[in] index The diffuse uv index
+ */
+ void SetDiffuseUVIndex(const int index);
+
+ /**
+ * @brief Get the index into the bound mesh's array of UV's for the diffuse texture coordinates.
+ *
+ * @return The uv index
+ */
+ unsigned int GetDiffuseUVIndex() const;
+
+ /**
+ * @brief Set the index into the bound mesh's array of UV's for the opacity texture coordinates.
+ *
+ * @param[in] index The opacity uv index
+ */
+ void SetOpacityUVIndex(const int index);
+
+ /**
+ * @brief Get the index into the bound mesh's array of UV's for the opacity texture coordinates.
+ *
+ * @return The uv index
+ */
+ unsigned int GetOpacityUVIndex() const;
+
+ /**
+ * @brief Set the index into the bound mesh's array of UV's for the normal/height map texture coordinates.
+ *
+ * @param[in] index The normal/height map uv index
+ */
+ void SetNormalUVIndex(const int index);
+
+ /**
+ * @brief Get the index into the bound mesh's array of UV's for the normal/height map texture coordinates.
+ *
+ * @return The uv index
+ */
+ unsigned int GetNormalUVIndex() const;
+
+ /**
+ * @brief Set whether the normal texture contains a normal or height map.
+ *
+ * @param[in] flag true if the normal map contains a height map
+ */
+ void SetHasHeightMap(const bool flag);
+
+ /**
+ * @brief Get whether the normal texture contains a normal or height map.
+ *
+ * @return true if the normal map contains a height map, false otherwise
+ */
+ bool GetHasHeightMap() const;
+
+public: // Not intended for application developers
+
+ /**
+ * @brief This constructor is used by Dali New() methods.
+ *
+ * @param [in] material A pointer to an internal material resource
+ */
+ explicit DALI_INTERNAL Material(Internal::Material* material);
+}; // class Material
+
+} // namespace Dali
+
+#endif // __DALI_MATERIAL_H__
--- /dev/null
+#ifndef __DALI_TYPE_REGISTRY_HELPER_H__
+#define __DALI_TYPE_REGISTRY_HELPER_H__
+
+/*
+ * Copyright (c) 2015 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/public-api/common/compile-time-assert.h>
+#include <dali/public-api/object/type-registry.h>
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+/**
+ * @brief These macros are used to use the type-registry to register properties and signals.
+ * This forces registration to be done in a standard way across actors and controls and facilitates future compile-time checks to be added.
+ *
+ * Note: Currently a compile time check is done for the order of the properties. The order is not critical to registration, but helps maintain the ordering between the header and implementations to avoid properties being added out of place.
+ *
+ * Note: The signal macro also generates string const chars.
+ */
+#define DALI_TOKEN_PASTE_EXPAND( x, y ) x ## y
+#define DALI_TOKEN_PASTE( x, y ) DALI_TOKEN_PASTE_EXPAND(x, y)
+
+#define DALI_PROPERTY_REGISTRATION_INTERNAL( count, typeRegistrationObject, objectNamespace, objectType, text, valueType, enumIndex ) \
+ PropertyRegistration DALI_TOKEN_PASTE( property, count ) ( typeRegistrationObject, text, objectNamespace::objectType::Property::enumIndex, Property::valueType, &objectType::SetProperty, &objectType::GetProperty ); \
+ DALI_COMPILE_TIME_ASSERT( ( objectNamespace::objectType::Property::enumIndex - objectNamespace::objectType::PROPERTY_START_INDEX ) == count );
+
+#define DALI_ANIMATABLE_PROPERTY_REGISTRATION_INTERNAL( count, typeRegistrationObject, objectNamespace, objectType, text, valueType, enumIndex) \
+ AnimatablePropertyRegistration DALI_TOKEN_PASTE( property, count ) ( typeRegistrationObject, text, objectNamespace::objectType::Property::enumIndex, Property::valueType );
+
+#define DALI_ANIMATABLE_PROPERTY_COMPONENT_REGISTRATION_INTERNAL( count, typeRegistrationObject, objectNamespace, objectType, text, enumIndex, baseEnumIndex, componentIndex) \
+ AnimatablePropertyComponentRegistration DALI_TOKEN_PASTE( property, count ) ( typeRegistrationObject, text, objectNamespace::objectType::Property::enumIndex, objectNamespace::objectType::Property::baseEnumIndex, componentIndex );
+
+#define DALI_SIGNAL_REGISTRATION_INTERNAL( count, typeRegistrationObject, objectNamespace, objectType, text, textVariable ) \
+ const char* const textVariable = text; \
+ SignalConnectorType DALI_TOKEN_PASTE( signalConnector, count ) ( typeRegistrationObject, text, &objectNamespace::Internal::objectType::DoConnectSignal );
+
+#define DALI_ACTION_REGISTRATION_INTERNAL( count, typeRegistrationObject, objectNamespace, objectType, text, textVariable ) \
+ const char* const textVariable = text; \
+ TypeAction DALI_TOKEN_PASTE( signalConnector, count ) ( typeRegistrationObject, text, &objectNamespace::Internal::objectType::DoAction );
+
+// For use within implementations:
+
+#define DALI_TYPE_REGISTRATION_BEGIN( thisType, baseType, createFunction ) \
+ TypeRegistration typeRegistration( typeid( thisType ), typeid( baseType ), createFunction );
+
+#define DALI_TYPE_REGISTRATION_BEGIN_CREATE( thisType, baseType, createFunction, createAtStartup ) \
+ TypeRegistration typeRegistration( typeid( thisType ), typeid( baseType ), createFunction, createAtStartup );
+
+#define DALI_PROPERTY_REGISTRATION( objectNamespace, objectType, text, valueType, enumIndex ) \
+ DALI_PROPERTY_REGISTRATION_INTERNAL( __COUNTER__, typeRegistration, objectNamespace, objectType, text, valueType, enumIndex )
+
+#define DALI_ANIMATABLE_PROPERTY_REGISTRATION( objectNamespace, objectType, text, valueType, enumIndex ) \
+ DALI_ANIMATABLE_PROPERTY_REGISTRATION_INTERNAL( __COUNTER__, typeRegistration, objectNamespace, objectType, text, valueType, enumIndex )
+
+#define DALI_ANIMATABLE_PROPERTY_COMPONENT_REGISTRATION( objectNamespace, objectType, text, enumIndex, baseEnumIndex, componentIndex ) \
+ DALI_ANIMATABLE_PROPERTY_COMPONENT_REGISTRATION_INTERNAL( __COUNTER__, typeRegistration, objectNamespace, objectType, text, enumIndex, baseEnumIndex, componentIndex )
+
+#define DALI_SIGNAL_REGISTRATION( objectNamespace, objectType, text, textVariable ) \
+ DALI_SIGNAL_REGISTRATION_INTERNAL( __COUNTER__, typeRegistration, objectNamespace, objectType, text, textVariable )
+
+#define DALI_ACTION_REGISTRATION( objectNamespace, objectType, text, textVariable ) \
+ DALI_ACTION_REGISTRATION_INTERNAL( __COUNTER__, typeRegistration, objectNamespace, objectType, text, textVariable )
+
+#define DALI_TYPE_REGISTRATION_END( ) // Empty for now, can be used to perform checks.
+
+
+} // namespace Internal
+
+} // namespace Dali
+
+#endif // __DALI_TYPE_REGISTRY_HELPER_H__
--- /dev/null
+/*
+ * Copyright (c) 2015 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include <dali/devel-api/scripting/scripting.h>
+
+// INTERNAL INCLUDES
+#include <dali/public-api/actors/actor.h>
+#include <dali/public-api/images/resource-image.h>
+#include <dali/public-api/object/type-registry.h>
+#include <dali/public-api/object/property-array.h>
+#include <dali/internal/common/image-attributes.h>
+#include <dali/internal/event/images/resource-image-impl.h>
+#include <dali/internal/event/images/frame-buffer-image-impl.h>
+#include <dali/internal/event/images/buffer-image-impl.h>
+#include <dali/internal/event/effects/shader-effect-impl.h>
+
+namespace Dali
+{
+
+namespace Scripting
+{
+
+namespace
+{
+
+// Tables used here for converting strings to the enumerations and vice versa
+
+const StringEnum< ColorMode > COLOR_MODE_TABLE[] =
+{
+ { "USE_OWN_COLOR", USE_OWN_COLOR },
+ { "USE_PARENT_COLOR", USE_PARENT_COLOR },
+ { "USE_OWN_MULTIPLY_PARENT_COLOR", USE_OWN_MULTIPLY_PARENT_COLOR },
+ { "USE_OWN_MULTIPLY_PARENT_ALPHA", USE_OWN_MULTIPLY_PARENT_ALPHA },
+};
+const unsigned int COLOR_MODE_TABLE_COUNT = sizeof( COLOR_MODE_TABLE ) / sizeof( COLOR_MODE_TABLE[0] );
+
+const StringEnum< PositionInheritanceMode > POSITION_INHERITANCE_MODE_TABLE[] =
+{
+ { "INHERIT_PARENT_POSITION", INHERIT_PARENT_POSITION },
+ { "USE_PARENT_POSITION", USE_PARENT_POSITION },
+ { "USE_PARENT_POSITION_PLUS_LOCAL_POSITION", USE_PARENT_POSITION_PLUS_LOCAL_POSITION },
+ { "DONT_INHERIT_POSITION", DONT_INHERIT_POSITION },
+};
+const unsigned int POSITION_INHERITANCE_MODE_TABLE_COUNT = sizeof( POSITION_INHERITANCE_MODE_TABLE ) / sizeof( POSITION_INHERITANCE_MODE_TABLE[0] );
+
+const StringEnum< DrawMode::Type > DRAW_MODE_TABLE[] =
+{
+ { "NORMAL", DrawMode::NORMAL },
+ { "OVERLAY", DrawMode::OVERLAY },
+ { "STENCIL", DrawMode::STENCIL },
+};
+const unsigned int DRAW_MODE_TABLE_COUNT = sizeof( DRAW_MODE_TABLE ) / sizeof( DRAW_MODE_TABLE[0] );
+
+const StringEnum< Vector3 > ANCHOR_CONSTANT_TABLE[] =
+{
+ { "TOP_LEFT", ParentOrigin::TOP_LEFT },
+ { "TOP_CENTER", ParentOrigin::TOP_CENTER },
+ { "TOP_RIGHT", ParentOrigin::TOP_RIGHT },
+ { "CENTER_LEFT", ParentOrigin::CENTER_LEFT },
+ { "CENTER", ParentOrigin::CENTER },
+ { "CENTER_RIGHT", ParentOrigin::CENTER_RIGHT },
+ { "BOTTOM_LEFT", ParentOrigin::BOTTOM_LEFT },
+ { "BOTTOM_CENTER", ParentOrigin::BOTTOM_CENTER },
+ { "BOTTOM_RIGHT", ParentOrigin::BOTTOM_RIGHT },
+};
+const unsigned int ANCHOR_CONSTANT_TABLE_COUNT = sizeof( ANCHOR_CONSTANT_TABLE ) / sizeof( ANCHOR_CONSTANT_TABLE[0] );
+
+const StringEnum< ResourceImage::LoadPolicy > IMAGE_LOAD_POLICY_TABLE[] =
+{
+ { "IMMEDIATE", ResourceImage::IMMEDIATE },
+ { "ON_DEMAND", ResourceImage::ON_DEMAND },
+};
+const unsigned int IMAGE_LOAD_POLICY_TABLE_COUNT = sizeof( IMAGE_LOAD_POLICY_TABLE ) / sizeof( IMAGE_LOAD_POLICY_TABLE[0] );
+
+const StringEnum< Image::ReleasePolicy > IMAGE_RELEASE_POLICY_TABLE[] =
+{
+ { "UNUSED", Image::UNUSED },
+ { "NEVER", Image::NEVER },
+};
+const unsigned int IMAGE_RELEASE_POLICY_TABLE_COUNT = sizeof( IMAGE_RELEASE_POLICY_TABLE ) / sizeof( IMAGE_RELEASE_POLICY_TABLE[0] );
+
+const StringEnum< Pixel::Format > PIXEL_FORMAT_TABLE[] =
+{
+ { "A8", Pixel::A8 },
+ { "L8", Pixel::L8 },
+ { "LA88", Pixel::LA88 },
+ { "RGB565", Pixel::RGB565 },
+ { "BGR565", Pixel::BGR565 },
+ { "RGBA4444", Pixel::RGBA4444 },
+ { "BGRA4444", Pixel::BGRA4444 },
+ { "RGBA5551", Pixel::RGBA5551 },
+ { "BGRA5551", Pixel::BGRA5551 },
+ { "RGB888", Pixel::RGB888 },
+ { "RGB8888", Pixel::RGB8888 },
+ { "BGR8888", Pixel::BGR8888 },
+ { "RGBA8888", Pixel::RGBA8888 },
+ { "BGRA8888", Pixel::BGRA8888 },
+ { "COMPRESSED_R11_EAC", Pixel::COMPRESSED_R11_EAC },
+ { "COMPRESSED_SIGNED_R11_EAC", Pixel::COMPRESSED_SIGNED_R11_EAC },
+ { "COMPRESSED_SIGNED_RG11_EAC", Pixel::COMPRESSED_SIGNED_RG11_EAC },
+ { "COMPRESSED_RG11_EAC", Pixel::COMPRESSED_RG11_EAC },
+ { "COMPRESSED_RGB8_ETC2", Pixel::COMPRESSED_RGB8_ETC2 },
+ { "COMPRESSED_SRGB8_ETC2", Pixel::COMPRESSED_SRGB8_ETC2 },
+ { "COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2", Pixel::COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 },
+ { "COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2", Pixel::COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 },
+ { "COMPRESSED_RGBA8_ETC2_EAC", Pixel::COMPRESSED_RGBA8_ETC2_EAC },
+ { "COMPRESSED_SRGB8_ALPHA8_ETC2_EAC", Pixel::COMPRESSED_SRGB8_ALPHA8_ETC2_EAC },
+ { "COMPRESSED_RGB8_ETC1", Pixel::COMPRESSED_RGB8_ETC1 },
+ { "COMPRESSED_RGB_PVRTC_4BPPV1", Pixel::COMPRESSED_RGB_PVRTC_4BPPV1 },
+};
+const unsigned int PIXEL_FORMAT_TABLE_COUNT = sizeof( PIXEL_FORMAT_TABLE ) / sizeof( PIXEL_FORMAT_TABLE[0] );
+
+const StringEnum< FittingMode::Type > IMAGE_FITTING_MODE_TABLE[] =
+{
+ { "SHRINK_TO_FIT", FittingMode::SHRINK_TO_FIT },
+ { "SCALE_TO_FILL", FittingMode::SCALE_TO_FILL },
+ { "FIT_WIDTH", FittingMode::FIT_WIDTH },
+ { "FIT_HEIGHT", FittingMode::FIT_HEIGHT },
+};
+const unsigned int IMAGE_FITTING_MODE_TABLE_COUNT = sizeof( IMAGE_FITTING_MODE_TABLE ) / sizeof( IMAGE_FITTING_MODE_TABLE[0] );
+
+const StringEnum< SamplingMode::Type > IMAGE_SAMPLING_MODE_TABLE[] =
+{
+ { "BOX", SamplingMode::BOX },
+ { "NEAREST", SamplingMode::NEAREST },
+ { "LINEAR", SamplingMode::LINEAR },
+ { "BOX_THEN_NEAREST", SamplingMode::BOX_THEN_NEAREST },
+ { "BOX_THEN_LINEAR", SamplingMode::BOX_THEN_LINEAR },
+ { "NO_FILTER", SamplingMode::NO_FILTER },
+ { "DONT_CARE", SamplingMode::DONT_CARE },
+};
+const unsigned int IMAGE_SAMPLING_MODE_TABLE_COUNT = sizeof( IMAGE_SAMPLING_MODE_TABLE ) / sizeof( IMAGE_SAMPLING_MODE_TABLE[0] );
+
+} // unnamed namespace
+
+bool CompareEnums( const char * a, const char * b )
+{
+ while( ( *a != '\0' ) && ( *b != '\0' ) )
+ {
+ char ca = *a;
+ char cb = *b;
+
+ if( ( ( ca == '-' ) || ( ca == '_') ) &&
+ ( ( cb == '-' ) || ( cb == '_') ) )
+ {
+ ++a;
+ ++b;
+ continue;
+ }
+
+ if( ( 'A' <= ca ) && ( ca <= 'Z') )
+ {
+ ca = ca + ( 'a' - 'A' );
+ }
+
+ if( ( 'A' <= cb ) && ( cb <= 'Z') )
+ {
+ cb = cb + ( 'a' - 'A' );
+ }
+
+ if( ca != cb )
+ {
+ return false;
+ }
+
+ ++a;
+ ++b;
+ }
+
+ if( ( *a == '\0' ) && ( *b == '\0' ) )
+ {
+ return true;
+ }
+
+ return false;
+}
+
+
+ColorMode GetColorMode( const std::string& value )
+{
+ return GetEnumeration< ColorMode >( value.c_str(), COLOR_MODE_TABLE, COLOR_MODE_TABLE_COUNT );
+}
+
+
+std::string GetColorMode( ColorMode value )
+{
+ return GetEnumerationName< ColorMode >( value, COLOR_MODE_TABLE, COLOR_MODE_TABLE_COUNT );
+}
+
+PositionInheritanceMode GetPositionInheritanceMode( const std::string& value )
+{
+ return GetEnumeration< PositionInheritanceMode >( value.c_str(), POSITION_INHERITANCE_MODE_TABLE, POSITION_INHERITANCE_MODE_TABLE_COUNT );
+}
+
+
+std::string GetPositionInheritanceMode( PositionInheritanceMode value )
+{
+ return GetEnumerationName< PositionInheritanceMode >( value, POSITION_INHERITANCE_MODE_TABLE, POSITION_INHERITANCE_MODE_TABLE_COUNT );
+}
+
+
+DrawMode::Type GetDrawMode( const std::string& value )
+{
+ return GetEnumeration< DrawMode::Type >( value.c_str(), DRAW_MODE_TABLE, DRAW_MODE_TABLE_COUNT );
+}
+
+
+std::string GetDrawMode( DrawMode::Type value )
+{
+ return GetEnumerationName< DrawMode::Type >( value, DRAW_MODE_TABLE, DRAW_MODE_TABLE_COUNT );
+}
+
+
+Vector3 GetAnchorConstant( const std::string& value )
+{
+ return GetEnumeration< Vector3 >( value.c_str(), ANCHOR_CONSTANT_TABLE, ANCHOR_CONSTANT_TABLE_COUNT );
+}
+
+
+Image NewImage( const Property::Value& map )
+{
+ Image ret;
+
+ std::string filename;
+ ResourceImage::LoadPolicy loadPolicy = Dali::Internal::IMAGE_LOAD_POLICY_DEFAULT;
+ Image::ReleasePolicy releasePolicy = Dali::Internal::IMAGE_RELEASE_POLICY_DEFAULT;
+ Internal::ImageAttributes attributes = Internal::ImageAttributes::New();
+
+ if( Property::MAP == map.GetType() )
+ {
+ std::string field = "filename";
+ if( map.HasKey(field) )
+ {
+ DALI_ASSERT_ALWAYS(map.GetValue(field).GetType() == Property::STRING && "Image filename property is not a string" );
+ filename = map.GetValue(field).Get<std::string>();
+ }
+
+ field = "load-policy";
+ if( map.HasKey(field) )
+ {
+ DALI_ASSERT_ALWAYS(map.GetValue(field).GetType() == Property::STRING && "Image load-policy property is not a string" );
+ std::string v(map.GetValue(field).Get<std::string>());
+ loadPolicy = GetEnumeration< ResourceImage::LoadPolicy >( v.c_str(), IMAGE_LOAD_POLICY_TABLE, IMAGE_LOAD_POLICY_TABLE_COUNT );
+ }
+
+ field = "release-policy";
+ if( map.HasKey(field) )
+ {
+ DALI_ASSERT_ALWAYS(map.GetValue(field).GetType() == Property::STRING && "Image release-policy property is not a string" );
+ std::string v(map.GetValue(field).Get<std::string>());
+ releasePolicy = GetEnumeration< Image::ReleasePolicy >( v.c_str(), IMAGE_RELEASE_POLICY_TABLE, IMAGE_RELEASE_POLICY_TABLE_COUNT );
+ }
+
+ // Width and height can be set individually. Dali derives the unspecified
+ // dimension from the aspect ratio of the raw image.
+ unsigned int width = 0, height = 0;
+
+ field = "width";
+ if( map.HasKey( field ) )
+ {
+ Property::Value &value = map.GetValue( field );
+
+ // handle floats and integer the same for json script
+ if( value.GetType() == Property::FLOAT )
+ {
+ width = static_cast<unsigned int>( value.Get<float>() );
+ }
+ else
+ {
+ DALI_ASSERT_ALWAYS( value.GetType() == Property::INTEGER && "Image width property is not a number" );
+ width = value.Get<int>();
+ }
+ }
+
+ field = "height";
+ if( map.HasKey( field ) )
+ {
+ Property::Value &value = map.GetValue( field );
+ if( value.GetType() == Property::FLOAT )
+ {
+ height = static_cast<unsigned int>( value.Get<float>() );
+ }
+ else
+ {
+ DALI_ASSERT_ALWAYS( value.GetType() == Property::INTEGER && "Image width property is not a number" );
+ height = value.Get<int>();
+ }
+ }
+
+ attributes.SetSize( width, height );
+
+ field = "pixel-format";
+ Pixel::Format pixelFormat = Pixel::RGBA8888;
+ if( map.HasKey(field) )
+ {
+ DALI_ASSERT_ALWAYS( map.GetValue(field).GetType() == Property::STRING && "Image release-policy property is not a string" );
+ std::string s( map.GetValue(field).Get<std::string>() );
+ pixelFormat = GetEnumeration< Pixel::Format >( s.c_str(), PIXEL_FORMAT_TABLE, PIXEL_FORMAT_TABLE_COUNT );
+ }
+
+ field = "fitting-mode";
+ if( map.HasKey( field ) )
+ {
+ Property::Value& value = map.GetValue( field );
+ DALI_ASSERT_ALWAYS( value.GetType() == Property::STRING && "Image fitting-mode property is not a string" );
+ std::string s( value.Get<std::string>() );
+ attributes.SetScalingMode( GetEnumeration< FittingMode::Type >( s.c_str(), IMAGE_FITTING_MODE_TABLE, IMAGE_FITTING_MODE_TABLE_COUNT ) );
+ }
+
+ field = "sampling-mode";
+ if( map.HasKey( field ) )
+ {
+ Property::Value& value = map.GetValue( field );
+ DALI_ASSERT_ALWAYS( value.GetType() == Property::STRING && "Image sampling-mode property is not a string" );
+ std::string s( value.Get<std::string>() );
+ attributes.SetFilterMode( GetEnumeration< SamplingMode::Type >( s.c_str(), IMAGE_SAMPLING_MODE_TABLE, IMAGE_SAMPLING_MODE_TABLE_COUNT ) );
+ }
+
+ field = "orientation";
+ if( map.HasKey( field ) )
+ {
+ Property::Value& value = map.GetValue( field );
+ DALI_ASSERT_ALWAYS( value.GetType() == Property::BOOLEAN && "Image orientation property is not a boolean" );
+ bool b = value.Get<bool>();
+ attributes.SetOrientationCorrection( b );
+ }
+
+ if( map.HasKey("type") )
+ {
+ DALI_ASSERT_ALWAYS( map.GetValue("type").GetType() == Property::STRING );
+ std::string s(map.GetValue("type").Get<std::string>());
+ if("FrameBufferImage" == s)
+ {
+ ret = FrameBufferImage::New(attributes.GetWidth(),
+ attributes.GetHeight(),
+ pixelFormat,
+ releasePolicy);
+ }
+ else if("BufferImage" == s)
+ {
+ ret = BufferImage::New(attributes.GetWidth(),
+ attributes.GetHeight(),
+ pixelFormat,
+ releasePolicy);
+ }
+ else if("ResourceImage" == s)
+ {
+ ret = ResourceImage::New( filename, loadPolicy, releasePolicy, ImageDimensions( attributes.GetSize().x, attributes.GetSize().y ), attributes.GetScalingMode(), attributes.GetFilterMode(), attributes.GetOrientationCorrection() );
+ }
+ else
+ {
+ DALI_ASSERT_ALWAYS( !"Unknown image type" );
+ }
+ }
+ else
+ {
+ ret = ResourceImage::New( filename, loadPolicy, releasePolicy, ImageDimensions( attributes.GetSize().x, attributes.GetSize().y ), attributes.GetScalingMode(), attributes.GetFilterMode(), attributes.GetOrientationCorrection() );
+ }
+ }
+
+ return ret;
+
+} // Image NewImage( Property::Value map )
+
+
+ShaderEffect NewShaderEffect( const Property::Value& map )
+{
+ Internal::ShaderEffectPtr ret;
+
+ if( map.GetType() == Property::MAP )
+ {
+ ret = Internal::ShaderEffect::New(Dali::ShaderEffect::HINT_NONE); // hint can be reset if in map
+
+ if( map.HasKey("program") )
+ {
+ Property::Index index = ret->GetPropertyIndex("program");
+ DALI_ASSERT_DEBUG( map.GetValue("program").GetType() == Property::MAP );
+ ret->SetProperty(index, map.GetValue("program"));
+ }
+
+ for(int i = 0; i < map.GetSize(); ++i)
+ {
+ const std::string& key = map.GetKey(i);
+ if(key != "program")
+ {
+ Property::Index index = ret->GetPropertyIndex( key );
+
+ if( Property::INVALID_INDEX != index )
+ {
+ ret->SetProperty(index, map.GetItem(i));
+ }
+ else
+ {
+ // if its not a property then register it as a uniform (making a custom property)
+
+ if(map.GetItem(i).GetType() == Property::INTEGER)
+ {
+ // valid uniforms are floats, vec3's etc so we recast if the user accidentally
+ // set as integer. Note the map could have come from json script.
+ Property::Value asFloat( static_cast<float>( map.GetItem(i).Get<int>() ) );
+ ret->SetUniform( key, asFloat, Dali::ShaderEffect::COORDINATE_TYPE_DEFAULT );
+ }
+ else
+ {
+ ret->SetUniform( key, map.GetItem(i), Dali::ShaderEffect::COORDINATE_TYPE_DEFAULT );
+ }
+ }
+ }
+ }
+ }
+
+ return Dali::ShaderEffect(ret.Get());
+}
+
+
+Actor NewActor( const Property::Map& map )
+{
+ BaseHandle handle;
+
+ // First find type and create Actor
+ Property::Value* typeValue = map.Find( "type" );
+ if ( typeValue )
+ {
+ TypeInfo type = TypeRegistry::Get().GetTypeInfo( typeValue->Get< std::string >() );
+ if ( type )
+ {
+ handle = type.CreateInstance();
+ }
+ }
+
+ if ( !handle )
+ {
+ DALI_LOG_ERROR( "Actor type not provided, returning empty handle" );
+ return Actor();
+ }
+
+ Actor actor( Actor::DownCast( handle ) );
+
+ if ( actor )
+ {
+ // Now set the properties, or create children
+ for ( unsigned int i = 0, mapCount = map.Count(); i < mapCount; ++i )
+ {
+ const StringValuePair& pair( map.GetPair( i ) );
+ const std::string& key( pair.first );
+ if ( key == "type" )
+ {
+ continue;
+ }
+
+ const Property::Value& value( pair.second );
+
+ if ( key == "actors" )
+ {
+ // Create children
+
+ Property::Array actorArray = value.Get< Property::Array >();
+ for ( size_t i = 0; i < actorArray.Size(); ++i)
+ {
+ actor.Add( NewActor( actorArray[i].Get< Property::Map >() ) );
+ }
+ }
+ else if ( key == "signals" )
+ {
+ DALI_LOG_ERROR( "signals not supported" );
+ }
+ else if( key == "parent-origin" )
+ {
+ // Parent Origin can be a string constant as well as a Vector3
+
+ const Property::Type type( value.GetType() );
+ if ( type == Property::VECTOR3 )
+ {
+ actor.SetParentOrigin( value.Get< Vector3 >() );
+ }
+ else if( type == Property::STRING )
+ {
+ actor.SetParentOrigin( GetAnchorConstant( value.Get< std::string >() ) );
+ }
+ }
+ else if( key == "anchor-point" )
+ {
+ // Anchor Point can be a string constant as well as a Vector3
+
+ const Property::Type type( value.GetType() );
+ if ( type == Property::VECTOR3 )
+ {
+ actor.SetAnchorPoint( value.Get< Vector3 >() );
+ }
+ else if( type == Property::STRING )
+ {
+ actor.SetAnchorPoint( GetAnchorConstant( value.Get< std::string >() ) );
+ }
+ }
+ else
+ {
+ Property::Index index( actor.GetPropertyIndex( key ) );
+
+ if ( index != Property::INVALID_INDEX )
+ {
+ actor.SetProperty( index, value );
+ }
+ }
+ }
+ }
+
+ return actor;
+}
+
+void CreatePropertyMap( Actor actor, Property::Map& map )
+{
+ map.Clear();
+
+ if ( actor )
+ {
+ map[ "type" ] = actor.GetTypeName();
+
+ // Default properties
+ Property::IndexContainer indices;
+ actor.GetPropertyIndices( indices );
+ const Property::IndexContainer::const_iterator endIter = indices.end();
+ for ( Property::IndexContainer::iterator iter = indices.begin(); iter != endIter; ++iter )
+ {
+ map[ actor.GetPropertyName( *iter ) ] = actor.GetProperty( *iter );
+ }
+
+ // Children
+ unsigned int childCount( actor.GetChildCount() );
+ if ( childCount )
+ {
+ Property::Array childArray;
+ for ( unsigned int child = 0; child < childCount; ++child )
+ {
+ Property::Map childMap;
+ CreatePropertyMap( actor.GetChildAt( child ), childMap );
+ childArray.PushBack( childMap );
+ }
+ map[ "actors" ] = childArray;
+ }
+ }
+}
+
+void CreatePropertyMap( Image image, Property::Map& map )
+{
+ map.Clear();
+
+ if ( image )
+ {
+ std::string imageType( "ResourceImage" );
+
+ // Get Type - cannot use TypeRegistry as Image is not an Object and thus, not registered
+ BufferImage bufferImage = BufferImage::DownCast( image );
+ if ( bufferImage )
+ {
+ imageType = "BufferImage";
+ map[ "pixel-format" ] = GetEnumerationName< Pixel::Format >( bufferImage.GetPixelFormat(), PIXEL_FORMAT_TABLE, PIXEL_FORMAT_TABLE_COUNT );
+ }
+ else if ( FrameBufferImage::DownCast( image ) )
+ {
+ imageType = "FrameBufferImage";
+ }
+
+ map[ "type" ] = imageType;
+ map[ "release-policy" ] = GetEnumerationName< Image::ReleasePolicy >( image.GetReleasePolicy(), IMAGE_RELEASE_POLICY_TABLE, IMAGE_RELEASE_POLICY_TABLE_COUNT );
+
+ ResourceImage resourceImage = ResourceImage::DownCast( image );
+ if( resourceImage )
+ {
+ map[ "filename" ] = resourceImage.GetUrl();
+ map[ "load-policy" ] = GetEnumerationName< ResourceImage::LoadPolicy >( resourceImage.GetLoadPolicy(), IMAGE_LOAD_POLICY_TABLE, IMAGE_LOAD_POLICY_TABLE_COUNT );
+ }
+
+ int width( image.GetWidth() );
+ int height( image.GetHeight() );
+
+ if ( width && height )
+ {
+ map[ "width" ] = width;
+ map[ "height" ] = height;
+ }
+ }
+}
+
+} // namespace scripting
+
+} // namespace Dali
+
+
+
+
--- /dev/null
+#ifndef __DALI_SCRIPTING_H__
+#define __DALI_SCRIPTING_H__
+
+/*
+ * Copyright (c) 2015 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/public-api/actors/actor-enumerations.h>
+#include <dali/public-api/actors/draw-mode.h>
+#include <dali/public-api/images/image.h>
+#include <dali/public-api/shader-effects/shader-effect.h>
+#include <dali/public-api/object/property-map.h>
+#include <dali/public-api/object/property-value.h>
+
+namespace Dali
+{
+
+class Actor;
+
+/**
+ * @brief Utilities for scripting support.
+ */
+namespace Scripting
+{
+
+/**
+ * @brief Template structure which stores an enumeration and its string equivalent.
+ */
+template< typename T >
+struct StringEnum
+{
+ const char* string; ///< The string representation
+ const T value; ///< The actual enumeration
+};
+
+/**
+ * @brief Permissive comparison for string enums.
+ *
+ * Case insensitive and ignores '_', '-' in either string when comparing.
+ *
+ * @note If both strings are empty return true;
+ *
+ * @param[in] a The first string
+ * @param[in] b The string to compare
+ * @return true if the strings are equal as defined above. If both empty, then return true.
+ */
+DALI_IMPORT_API bool CompareEnums( const char * a, const char * b );
+
+/**
+ * @brief Set the value if strings pass a permissive compare.
+ *
+ * @param[in] a The input string
+ * @param[in] b The string to compare
+ * @param[in] set The variable to set
+ * @param[in] value The value to set
+ * @return true if the strings pass the permissive compare
+ */
+template <typename T>
+bool SetIfEqual(const char * a, const char * b, T& set, const T& value)
+{
+ if( CompareEnums( a, b ) )
+ {
+ set = value;
+ return true;
+ }
+
+ return false;
+}
+
+/**
+ * @brief Chooses the appropriate enumeration for the provided string from the given table.
+ *
+ * @param[in] value The string equivalent (case-insensitive).
+ * @param[in] table A pointer to an array with the enumeration to string equivalents.
+ * @param[in] tableCount Number of items in the array.
+ *
+ * @return The equivalent enumeration for the given string.
+ */
+template< typename T >
+T GetEnumeration( const char * value, const StringEnum< T >* table, unsigned int tableCount )
+{
+ T retVal( table->value );
+ bool set( false );
+
+ for ( unsigned int i = 0; ( i < tableCount ) && ( !set ); ++i )
+ {
+ set = SetIfEqual( value, table->string, retVal, table->value );
+ ++table;
+ }
+
+ if ( !set )
+ {
+ DALI_ASSERT_ALWAYS( !"Unknown enumeration string" );
+ }
+
+ return retVal;
+}
+
+/**
+ * @brief Chooses the appropriate string for the provided enumeration from the given table.
+ *
+ * @param[in] value The enumeration.
+ * @param[in] table A pointer to an array with the enumeration to string equivalents.
+ * @param[in] tableCount Number of items in the array.
+ *
+ * @return The equivalent enumeration for the given string. Will return NULL if the value does not exist
+ *
+ * @note The caller is NOT responsible for cleaning up the returned pointer as it is statically allocated.
+ */
+template< typename T >
+const char * GetEnumerationName( T value, const StringEnum< T >* table, unsigned int tableCount )
+{
+ for ( unsigned int i = 0; i < tableCount; ++i )
+ {
+ if ( value == table[ i ].value )
+ {
+ return table[ i ].string;
+ }
+ }
+
+ return NULL;
+}
+
+/**
+ * @brief Chooses the appropriate string for the provided enumeration from the given table.
+ * This is an optimised version that handles enumerations that start at 0 and are linear only.
+ *
+ * @param[in] value The enumeration.
+ * @param[in] table A pointer to an array with the enumeration to string equivalents.
+ * @param[in] tableCount Number of items in the array.
+ *
+ * @return The equivalent enumeration for the given string. Will return NULL if the value does not exist
+ *
+ * @note The caller is NOT responsible for cleaning up the returned pointer as it is statically allocated.
+ */
+template< typename T >
+const char * GetLinearEnumerationName( T value, const StringEnum< T >* table, unsigned int tableCount )
+{
+ if ( value < 0 || value >= (int)tableCount )
+ {
+ return NULL;
+ }
+
+ return table[value].string;
+}
+
+/**
+ * @brief Takes a string and returns the appropriate color mode.
+ *
+ * @param[in] value The input string
+ * @return The corresponding color-mode.
+ */
+DALI_IMPORT_API ColorMode GetColorMode( const std::string& value );
+
+/**
+ * @brief Takes a color mode and returns the appropriate string equivalent.
+ *
+ * @param[in] value The color mode
+ * @return The corresponding string.
+ */
+DALI_IMPORT_API std::string GetColorMode( ColorMode value );
+
+/**
+ * @brief Takes a string and returns the appropriate position inheritance mode.
+ *
+ * @param[in] value The input string
+ * @return The corresponding position-inheritance-mode.
+ */
+DALI_IMPORT_API PositionInheritanceMode GetPositionInheritanceMode( const std::string& value );
+
+/**
+ * @brief Takes a position inheritance mode and returns the string equivalent.
+ *
+ * @param[in] value The position-inheritance-mode.
+ * @return The corresponding string.
+ */
+DALI_IMPORT_API std::string GetPositionInheritanceMode( PositionInheritanceMode value );
+
+/**
+ * @brief Takes a string and returns the appropriate draw mode.
+ *
+ * @param[in] value The input string
+ * @return The corresponding draw-mode.
+ */
+DALI_IMPORT_API DrawMode::Type GetDrawMode( const std::string& value );
+
+/**
+ * @brief Takes a draw-mode and returns the string equivalent.
+ *
+ * @param[in] value The draw-mode.
+ * @return The corresponding string.
+ */
+DALI_IMPORT_API std::string GetDrawMode( DrawMode::Type value );
+
+/**
+ * @brief Takes a string and returns the appropriate anchor-point or parent-origin constant.
+ *
+ * @param[in] value The input string
+ * @return The corresponding anchor-point or parent-origin constant.
+ */
+DALI_IMPORT_API Vector3 GetAnchorConstant( const std::string& value );
+
+/**
+ * @brief Creates object with data from the property value map.
+ *
+ * @param[in] map The property value map with the following valid fields:
+ * @code
+ * "filename": type std::string
+ * "load-policy" type std::string (enum)
+ * "release-policy" type std::string (enum)
+ * "width" type float
+ * "height" type float
+ * "pixel-format" type std::string (enum)
+ * "fitting-mode" type std::string (enum)
+ * "sampling-mode" type std::string (enum)
+ * "orientation" type bool
+ * "type" type std::string (FrameBufferImage|BufferImage|ResourceImage(default))
+ * @endcode
+ * Some fields are optional and some only pertain to a specific type.
+ *
+ * @return a pointer to a newly created object.
+ */
+DALI_IMPORT_API Image NewImage( const Property::Value& map );
+
+/**
+ * @brief Creates object with data from the property value map.
+ *
+ * @param[in] map The property value map with the following valid fields:
+ * @code
+ * // a program can be specified as string or a filename.
+ * // some fields may be ignored depending on the geometry-type
+ * "program": type Map
+ * {
+ * "vertex": type std::string
+ * "fragment": type std::string
+ * "vertex-prefix": type std::string
+ * "fragment-prefix": type std::string
+ * "text-vertex": type std::string
+ * "text-fragment": type std::string
+ * "vertex-filename": type std::string
+ * "fragment-filename": type std::string
+ * "vertex-prefix-filename": type std::string
+ * "fragment-prefix-filename": type std::string
+ * "text-vertex-filename": type std::string
+ * "text-fragment-filename": type std::string
+ * "geometry-type": type std::string (enum)
+ * "geometry-hints": type std::string (enum)
+ * }
+ * // uniforms must be specified to be registered
+ * "uUniform1": type float,
+ * "uUniform2": type float, etc
+ * @endcode
+ *
+ * @return a pointer to a newly created object.
+ */
+DALI_IMPORT_API ShaderEffect NewShaderEffect( const Property::Value& map );
+
+/**
+ * @brief Creates an actor with the date from the property value map.
+ *
+ * @param[in] map The property value map with the properties (and hierarchy) of the actor required
+ * For example:
+ * @code
+ * {
+ * "type": "ImageActor",
+ * "image":
+ * {
+ * "filename":"my-image-path.png"
+ * },
+ * "actors":
+ * [
+ * {
+ * "type":"Actor",
+ * "position":[0,0,0]
+ * }
+ * ]
+ * }
+ * @endcode
+ *
+ * @return Handle to the newly created actor.
+ */
+DALI_IMPORT_API Actor NewActor( const Property::Map& map );
+
+/**
+ * @brief Creates a Property::Map from the actor provided.
+ *
+ * @param[in] actor The base-actor from which a Property::Map should be created
+ * @param[out] map This map is cleared and a property map of actor and its children is filled in
+ */
+DALI_IMPORT_API void CreatePropertyMap( Actor actor, Property::Map& map );
+
+/**
+ * @brief Creates a Property::Map from the image provided.
+ *
+ * @param[in] image The image from which a Property::Map should be created
+ * @param[out] map This map is cleared and a property map of the image is filled in
+ */
+DALI_IMPORT_API void CreatePropertyMap( Image image, Property::Map& map );
+
+}
+
+} // namespace Dali
+
+#endif // __DALI_SCRIPTING_H__
// INTERNAL INCLUDES
#include <dali/public-api/common/dali-common.h>
-#include <dali/public-api/geometry/mesh-data.h>
+#include <dali/devel-api/geometry/mesh-data.h>
namespace Dali
{
// INTERNAL INCLUDES
#include <dali/public-api/common/dali-common.h>
-#include <dali/public-api/geometry/mesh-data.h>
+#include <dali/devel-api/geometry/mesh-data.h>
namespace Dali
{
#include <dali/integration-api/resource-cache.h>
#include <dali/integration-api/bitmap.h> ///@todo Remove this include (a bunch of stuff needs to include it though)
-#include <dali/public-api/images/image-operations.h>
+#include <dali/devel-api/images/image-operations.h>
namespace Dali
{
// INTERNAL INCLUDES
#include <dali/public-api/common/dali-common.h>
#include <dali/public-api/common/vector-wrapper.h>
-#include <dali/public-api/images/image-operations.h>
+#include <dali/devel-api/images/image-operations.h>
#include <dali/public-api/math/uint-16-pair.h>
#include <dali/public-api/math/vector2.h>
#include <dali/integration-api/resource-declarations.h>
// INTERNAL INCLUDES
#include <dali/public-api/images/pixel.h>
-#include <dali/public-api/images/image-operations.h>
+#include <dali/devel-api/images/image-operations.h>
#include <dali/public-api/math/rect.h>
#include <dali/public-api/math/vector2.h>
*/
// INTERNAL INCLUDES
-#include <dali/public-api/geometry/mesh.h>
-#include <dali/public-api/modeling/material.h>
+#include <dali/devel-api/geometry/mesh.h>
+#include <dali/devel-api/modeling/material.h>
#include <dali/internal/common/owner-container.h>
#include <dali/internal/event/actors/actor-declarations.h>
#include <dali/internal/event/actor-attachments/actor-attachment-declarations.h>
#include <dali/public-api/math/vector3.h>
#include <dali/public-api/math/radian.h>
#include <dali/public-api/object/type-registry.h>
-#include <dali/public-api/scripting/scripting.h>
+#include <dali/devel-api/scripting/scripting.h>
#include <dali/internal/common/internal-constants.h>
#include <dali/internal/event/common/event-thread-services.h>
// INTERNAL INCLUDES
#include <dali/public-api/object/type-registry.h>
-#include <dali/public-api/scripting/scripting.h>
+#include <dali/devel-api/scripting/scripting.h>
#include <dali/internal/event/common/property-helper.h>
#include <dali/internal/event/images/image-connector.h>
#include <dali/internal/event/images/nine-patch-image-impl.h>
// INTERNAL INCLUDES
#include <dali/public-api/object/handle.h>
-#include <dali/public-api/actors/mesh-actor.h>
-#include <dali/public-api/geometry/mesh.h>
+#include <dali/devel-api/actors/mesh-actor.h>
+#include <dali/devel-api/geometry/mesh.h>
#include <dali/internal/event/actors/actor-impl.h>
#include <dali/internal/event/actors/actor-declarations.h>
#include <dali/internal/event/modeling/material-impl.h>
// INTERNAL INCLUDES
#include <dali/internal/event/animation/constrainer.h>
-#include <dali/public-api/animation/path-constrainer.h>
+#include <dali/devel-api/animation/path-constrainer.h>
#include <dali/public-api/math/math-utils.h>
#include <dali/internal/event/animation/path-impl.h>
// INTERNAL INCLUDES
#include <dali/public-api/common/dali-common.h>
-#include <dali/public-api/common/mutex.h>
+#include <dali/devel-api/common/mutex.h>
#include <dali/internal/common/owner-container.h>
#include <dali/internal/common/message.h>
#include <dali/internal/event/common/property-notification-impl.h>
#include <dali/internal/event/dynamics/dynamics-mesh-shape-impl.h>
#include <dali/internal/event/dynamics/dynamics-sphere-shape-impl.h>
#include <dali/internal/event/modeling/mesh-impl.h>
-#include <dali/public-api/geometry/cloth.h>
+#include <dali/devel-api/geometry/cloth.h>
namespace Dali
{
#include <dali/public-api/math/matrix3.h>
#include <dali/public-api/math/vector2.h>
#include <dali/public-api/object/type-registry.h>
-#include <dali/public-api/scripting/scripting.h>
+#include <dali/devel-api/scripting/scripting.h>
#include <dali/public-api/shader-effects/shader-effect.h>
#include <dali/internal/event/common/property-helper.h>
#include <dali/internal/event/common/stage-impl.h>
// INTERNAL INCLUDES
#include <dali/public-api/dali-core-version.h>
#include <dali/public-api/common/dali-common.h>
-#include <dali/public-api/common/hash.h>
+#include <dali/devel-api/common/hash.h>
#include <dali/integration-api/debug.h>
#include <dali/internal/event/resources/resource-client.h>
#include <dali/internal/event/effects/shader-effect-impl.h>
*/
// INTERNAL INCLUDES
-#include <dali/public-api/events/hit-test-algorithm.h>
+#include <dali/devel-api/events/hit-test-algorithm.h>
#include <dali/public-api/render-tasks/render-task.h>
namespace Dali
// INTERNAL INCLUDES
#include <dali/public-api/events/mouse-wheel-event.h>
-#include <dali/public-api/events/hit-test-algorithm.h>
+#include <dali/devel-api/events/hit-test-algorithm.h>
#include <dali/public-api/math/vector2.h>
#include <dali/integration-api/events/mouse-wheel-event-integ.h>
#include <dali/internal/event/common/stage-impl.h>
// INTERNAL INCLUDES
#include <dali/public-api/common/dali-vector.h>
-#include <dali/public-api/images/atlas.h>
+#include <dali/devel-api/images/atlas.h>
#include <dali/internal/event/images/context-recovery-interface.h>
#include <dali/internal/event/images/image-impl.h>
#include <dali/internal/event/images/buffer-image-impl.h>
#include <dali/integration-api/platform-abstraction.h>
#include <dali/public-api/common/dali-common.h>
#include <dali/public-api/common/constants.h>
-#include <dali/public-api/common/hash.h>
+#include <dali/devel-api/common/hash.h>
#include <dali/public-api/images/resource-image.h>
#include <dali/internal/event/common/thread-local-storage.h>
#include <dali/internal/event/common/notification-manager.h>
// INTERNAL INCLUDES
#include <dali/public-api/object/ref-object.h>
-#include <dali/public-api/geometry/animatable-mesh.h>
+#include <dali/devel-api/geometry/animatable-mesh.h>
#include <dali/internal/event/common/object-impl.h>
#include <dali/internal/event/modeling/modeling-declarations.h>
*/
// INTERNAL INCLUDES
-#include <dali/public-api/geometry/cloth.h>
+#include <dali/devel-api/geometry/cloth.h>
#include <dali/internal/event/modeling/mesh-impl.h>
namespace Dali
#include <dali/public-api/common/vector-wrapper.h>
#include <dali/public-api/images/image.h>
#include <dali/public-api/math/vector4.h>
-#include <dali/public-api/modeling/material.h>
+#include <dali/devel-api/modeling/material.h>
#include <dali/public-api/object/base-object.h>
namespace Dali
// INTERNAL INCLUDES
#include <dali/public-api/math/matrix.h>
-#include <dali/public-api/geometry/mesh.h>
+#include <dali/devel-api/geometry/mesh.h>
#include <dali/integration-api/platform-abstraction.h>
#include <dali/internal/event/common/thread-local-storage.h>
#include <dali/internal/event/modeling/material-impl.h>
// INTERNAL INCLUDES
#include <dali/public-api/common/dali-common.h>
#include <dali/public-api/math/vector4.h>
-#include <dali/public-api/geometry/mesh.h>
+#include <dali/devel-api/geometry/mesh.h>
#include <dali/public-api/object/base-object.h>
#include <dali/public-api/object/handle.h>
#include <dali/internal/event/modeling/modeling-declarations.h>
#include <string>
// INTERNAL INCLUDES
-#include <dali/public-api/common/ref-counted-dali-vector.h>
-#include <dali/public-api/images/native-image-interface.h>
+#include <dali/devel-api/common/ref-counted-dali-vector.h>
+#include <dali/devel-api/images/native-image-interface.h>
#include <dali/internal/event/resources/resource-client-declarations.h>
#include <dali/internal/event/resources/image-ticket.h>
#include <dali/internal/event/resources/resource-ticket-lifetime-observer.h>
#include <stdint.h>
// INTERNAL INCLUDES
-#include <dali/public-api/images/native-image-interface.h>
+#include <dali/devel-api/images/native-image-interface.h>
#include <dali/public-api/images/buffer-image.h>
#include <dali/public-api/images/pixel.h>
#include <dali/internal/common/message.h>
// INTERNAL INCLUDES
#include <dali/integration-api/gl-defines.h>
-#include <dali/public-api/images/native-image-interface.h>
+#include <dali/devel-api/images/native-image-interface.h>
#include <dali/internal/render/gl-resources/texture.h>
namespace Dali
// INTERNAL INCLUDES
#include <dali/public-api/object/ref-object.h>
-#include <dali/public-api/images/native-image-interface.h>
+#include <dali/devel-api/images/native-image-interface.h>
#include <dali/internal/render/gl-resources/texture-cache.h>
namespace Dali
*
*/
-#include <dali/public-api/geometry/mesh-data.h>
+#include <dali/devel-api/geometry/mesh-data.h>
#include <dali/integration-api/resource-policies.h>
namespace Dali
#include <dali/internal/update/modeling/bone-transforms.h>
#include <dali/internal/event/actor-attachments/mesh-attachment-impl.h>
#include <dali/internal/event/actors/mesh-actor-impl.h>
-#include <dali/public-api/geometry/mesh.h>
+#include <dali/devel-api/geometry/mesh.h>
#include <dali/public-api/math/matrix.h>
namespace Dali
// INTERNAL INCLUDES
#include <dali/public-api/common/vector-wrapper.h>
-#include <dali/public-api/common/mutex.h>
+#include <dali/devel-api/common/mutex.h>
#include <dali/integration-api/render-controller.h>
#include <dali/internal/common/message.h>
#include <dali/internal/common/message-buffer.h>
// INTERNAL INCLUDES
#include <dali/integration-api/bitmap.h>
#include <dali/public-api/images/pixel.h>
-#include <dali/public-api/images/native-image-interface.h>
+#include <dali/devel-api/images/native-image-interface.h>
namespace Dali
{
// INTERNAL INCLUDES
#include <dali/public-api/images/image.h>
-#include <dali/public-api/images/native-image-interface.h>
+#include <dali/devel-api/images/native-image-interface.h>
#include <dali/public-api/images/buffer-image.h>
-#include <dali/public-api/common/ref-counted-dali-vector.h>
+#include <dali/devel-api/common/ref-counted-dali-vector.h>
#include <dali/integration-api/bitmap.h>
#include <dali/integration-api/platform-abstraction.h>
+++ /dev/null
-/*
- * Copyright (c) 2015 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// CLASS HEADER
-#include <dali/public-api/actors/mesh-actor.h>
-
-// INTERNAL INCLUDES
-#include <dali/integration-api/debug.h>
-#include <dali/internal/event/actors/mesh-actor-impl.h>
-#include <dali/internal/event/modeling/mesh-impl.h>
-#include <dali/internal/event/modeling/animatable-mesh-impl.h>
-
-namespace Dali
-{
-
-MeshActor::MeshActor()
-{
-}
-
-MeshActor MeshActor::New()
-{
- Internal::MeshActorPtr internal = Internal::MeshActor::New();
- return MeshActor(internal.Get());
-}
-
-MeshActor MeshActor::New( Mesh mesh)
-{
- Internal::MeshActorPtr internal = Internal::MeshActor::New(mesh);
- return MeshActor(internal.Get());
-}
-
-MeshActor MeshActor::New( AnimatableMesh mesh)
-{
- Internal::MeshActorPtr internal = Internal::MeshActor::New(mesh);
- return MeshActor(internal.Get());
-}
-
-MeshActor MeshActor::DownCast( BaseHandle handle )
-{
- return MeshActor( dynamic_cast<Dali::Internal::MeshActor*>(handle.GetObjectPtr()) );
-}
-
-MeshActor::~MeshActor()
-{
-}
-
-MeshActor::MeshActor(const MeshActor& copy)
-: RenderableActor(copy)
-{
-}
-
-MeshActor& MeshActor::operator=(const MeshActor& rhs)
-{
- BaseHandle::operator=(rhs);
- return *this;
-}
-
-void MeshActor::SetMaterial(
- Actor actor,
- const std::string& actorName,
- Material material)
-{
- Actor child = actor.FindChildByName(actorName);
- if(child)
- {
- Internal::MeshActor* meshActor = dynamic_cast<Internal::MeshActor*>(&GetImplementation(child));
- if(meshActor)
- {
- meshActor->SetMaterial(material);
- }
- }
- else
- {
- DALI_LOG_ERROR("MeshActor::SetMaterial() - Can't find mesh actor\n");
- }
-}
-
-void MeshActor::SetMaterial(Material material)
-{
- GetImplementation(*this).SetMaterial(material);
-}
-
-Material MeshActor::GetMaterial() const
-{
- return GetImplementation(*this).GetMaterial();
-}
-
-void MeshActor::BindBonesToMesh(Actor rootActor)
-{
- Internal::ActorPtr root(&GetImplementation(rootActor));
-
- GetImplementation(*this).BindBonesToMesh(root);
-}
-
-MeshActor::MeshActor(Internal::MeshActor* internal)
- : RenderableActor(internal)
-{
-}
-
-} // namespace Dali
+++ /dev/null
-#ifndef __DALI_MESH_ACTOR_H__
-#define __DALI_MESH_ACTOR_H__
-
-/*
- * Copyright (c) 2015 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-
-// INTERNAL INCLUDES
-#include <dali/public-api/actors/renderable-actor.h>
-
-namespace Dali
-{
-class Material;
-class Mesh;
-class Model;
-class AnimatableMesh;
-
-namespace Internal DALI_INTERNAL
-{
-class MeshActor;
-}
-
-/**
- * @brief This actor is used to draw a mesh geometry with a material.
- *
- * It allows for a custom material to be drawn on the mesh.
- * By default CullFaceMode is set to CullBack to enable back face culling.
- */
-class DALI_IMPORT_API MeshActor : public RenderableActor
-{
-public:
-
- /**
- * @brief Create an uninitialized MeshActor handle.
- *
- * This can be initialised with MeshActor::New().
- * Calling member functions with an uninitialized Dali::Object is not allowed.
- */
- MeshActor();
-
- /**
- * @brief Create a MeshActor object.
- * @return the newly allocated MeshActor object
- */
- static MeshActor New();
-
- /**
- * @brief Create a MeshActor object.
- *
- * @param[in] mesh the Mesh the actor will use.
- * @return the newly allocated MeshActor object
- */
- static MeshActor New( Mesh mesh );
-
- /**
- * @brief Create a MeshActor object
- *
- * @param[in] mesh the Animated Mesh the actor will use.
- * @return the newly allocated MeshActor object
- */
- static MeshActor New( AnimatableMesh mesh );
-
- /**
- * @brief Downcast an Object handle to MeshActor.
- *
- * If handle points to a MeshActor the downcast produces a valid
- * handle. If not the returned handle is left uninitialized.
- * @param[in] handle to an object
- * @return handle to a MeshActor or an uninitialized handle
- */
- static MeshActor DownCast( BaseHandle handle );
-
- /**
- * @brief Destructor
- *
- * This is non-virtual since derived Handle types must not contain data or virtual methods.
- */
- ~MeshActor();
-
- /**
- * @brief Copy constructor
- *
- * @param [in] copy The actor to copy.
- */
- MeshActor(const MeshActor& copy);
-
- /**
- * @brief Assignment operator
- *
- * @param [in] rhs The actor to copy.
- */
- MeshActor& operator=(const MeshActor& rhs);
-
- /**
- * @brief Set a custom material on the given actor or one of it's children.
- *
- * @pre the mesh is loaded
- * @param[in] actor The first actor in the tree of model actors
- * @param[in] actorName The name of the actor to search for.
- * @param[in] material The custom material.<br>Pass NULL to revert to the
- * original material.
- */
- static void SetMaterial(Actor actor, const std::string& actorName, Material material);
-
- /**
- * @brief Set a custom material on this actor.
- *
- * @pre the mesh is loaded
- * @param[in] material The custom material.@n
- * Pass an uninitialised Material to revert to the original material.
- */
- void SetMaterial(Material material);
-
- /**
- * @brief Get the material for this mesh actor.
- *
- * @pre the mesh is loaded
- * @return The material
- */
- Material GetMaterial() const;
-
- /**
- * @brief Search the actor tree for all named bones in the mesh and connect them.
- *
- * @param[in] rootActor The root actor of the actor tree.
- */
- void BindBonesToMesh(Actor rootActor);
-
-public: // Not intended for application developers
-
- /**
- * @brief This constructor is used by Dali New() methods
- *
- * @param [in] actor A pointer to a newly allocated Dali resource
- */
- explicit DALI_INTERNAL MeshActor(Internal::MeshActor* actor);
-};
-
-} // namespace Dali
-
-#endif /* _MESH_ACTOR_H_ */
+++ /dev/null
-/*
- * Copyright (c) 2015 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// CLASS HEADER
-#include <dali/public-api/animation/path-constrainer.h>
-
-// INTERNAL INCLUDES
-#include <dali/internal/event/animation/path-constrainer-impl.h>
-#include <dali/internal/event/animation/path-impl.h>
-
-namespace Dali
-{
-
-PathConstrainer PathConstrainer::New()
-{
- Internal::PathConstrainer* internal = Internal::PathConstrainer::New();
- return PathConstrainer(internal);
-}
-
-PathConstrainer PathConstrainer::DownCast( BaseHandle handle )
-{
- return PathConstrainer( dynamic_cast<Dali::Internal::PathConstrainer*>(handle.GetObjectPtr()) );
-}
-
-PathConstrainer::PathConstrainer()
-{
-}
-
-PathConstrainer::~PathConstrainer()
-{
-}
-
-PathConstrainer::PathConstrainer(const PathConstrainer& handle)
-:Handle(handle)
-{
-}
-
-PathConstrainer::PathConstrainer(Internal::PathConstrainer* internal)
-: Handle(internal)
-{
-}
-
-PathConstrainer& PathConstrainer::operator=(const PathConstrainer& rhs)
-{
- BaseHandle::operator=(rhs);
- return *this;
-}
-
-void PathConstrainer::Apply( Dali::Property target, Dali::Property source, const Vector2& range, const Vector2& wrap )
-{
- GetImplementation(*this).Apply( target, source, range, wrap );
-}
-
-void PathConstrainer::Remove( Dali::Handle& target )
-{
- GetImplementation(*this).Remove( target );
-}
-
-
-} // Dali
+++ /dev/null
-#ifndef __DALI_PATH_CONSTRAINER_H__
-#define __DALI_PATH_CONSTRAINER_H__
-
-/*
- * Copyright (c) 2015 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-//EXTERNAL INCLUDES
-#include <cfloat> //For FLT_MAX
-
-// INTERNAL INCLUDES
-#include <dali/public-api/animation/path.h>
-#include <dali/public-api/object/handle.h>
-#include <dali/public-api/object/property-index-ranges.h>
-
-namespace Dali
-{
-
-namespace Internal DALI_INTERNAL
-{
- class PathConstrainer;
-}
-/**
- * @brief
- *
- * PathConstrainer applies constraints to objects to follow a path.
- * A Vector3 property will be constrained to the position of the path and a Rotation property will be constrained to follow
- * the tangent of the path given a forward vector in object's local space.
- *
- */
-class DALI_IMPORT_API PathConstrainer : public Handle
-{
-public:
-
- /**
- * @brief An enumeration of properties belonging to the PathConstrainer class.
- */
- struct Property
- {
- enum
- {
- FORWARD = DEFAULT_OBJECT_PROPERTY_START_INDEX, ///< name "forward" type Vector3
- POINTS, ///< name "points" type Array of Vector3
- CONTROL_POINTS ///< name "control-points" type Array of Vector3
- };
- };
-
- /**
- * @brief Create an initialized PathConstrainer handle.
- *
- * @return a handle to a newly allocated Dali resource.
- */
- static PathConstrainer New();
-
- /**
- * @brief Downcast an Object handle to PathConstrainer handle.
- *
- * If handle points to a PathConstrainer object the downcast produces
- * valid handle. If not the returned handle is left uninitialized.
- * @param[in] handle to An object
- * @return handle to a PathConstrainer object or an uninitialized handle
- */
- static PathConstrainer DownCast( BaseHandle handle );
-
- /**
- * @brief Create an uninitialized PathConstrainer handle.
- *
- * This can be initialized with PathConstrainer::New(). Calling member
- * functions with an uninitialized Dali::Object is not allowed.
- */
- PathConstrainer();
-
- /**
- * @brief Destructor
- *
- * This is non-virtual since derived Handle types must not contain data or virtual methods.
- */
- ~PathConstrainer();
-
- /**
- * @brief This copy constructor is required for (smart) pointer semantics.
- *
- * @param [in] handle A reference to the copied handle
- */
- PathConstrainer(const PathConstrainer& handle);
-
- /**
- * @brief This assignment operator is required for (smart) pointer semantics.
- *
- * @param [in] rhs A reference to the copied handle
- * @return A reference to this
- */
- PathConstrainer& operator=(const PathConstrainer& rhs);
-
- /**
- * @brief Applies the path constraint to the target property
- *
- * @param[in] target Property to be constrained
- * @param[in] source Property used as parameter for the path
- * @param[in] range The range of values in the source property which will be mapped to [0,1]
- * @param[in] wrap Wrapping domain. Source property will be wrapped in the domain [wrap.x,wrap.y] before mapping to [0,1]
- */
- void Apply( Dali::Property target, Dali::Property source, const Vector2& range, const Vector2& wrap = Vector2(-FLT_MAX, FLT_MAX) );
-
- /**
- * @brief Removes the path constraint in the target object
- *
- * @param[in] target A handle to an object constrained by the PathConstrainer
- */
- void Remove( Dali::Handle& target );
-
-public: // Not intended for application developers
- /**
- * @brief This constructor is used by Dali::New() methods.
- *
- * @param[in] pathConstrainer A pointer to an internal PathConstrainer resource
- */
- explicit DALI_INTERNAL PathConstrainer(Internal::PathConstrainer* pathConstrainer);
-};
-
-} // namespace Dali
-
-#endif // __DALI_PATH_CONSTRAINER_H__
+++ /dev/null
-/*
- * Copyright (c) 2015 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// CLASS HEADER
-#include <dali/public-api/common/hash.h>
-
-namespace Dali
-{
-
-namespace //unnamed namespace
-{
-
-/*
- * djb2 (http://www.cse.yorku.ca/~oz/hash.html)
- */
-const std::size_t INITIAL_HASH_VALUE = 5381;
-
-inline void HashString( const char* string, std::size_t& hash )
-{
- while( int c = *string++ )
- {
- hash = hash * 33 + c;
- }
-}
-
-} // unnamed namespace
-
-std::size_t CalculateHash( const std::string& toHash)
-{
- std::size_t hash( INITIAL_HASH_VALUE );
-
- HashString( toHash.c_str(), hash );
-
- return hash;
-}
-
-std::size_t CalculateHash( const std::string& string1, const std::string& string2 )
-{
- std::size_t hash( INITIAL_HASH_VALUE );
-
- HashString( string1.c_str(), hash);
- HashString( string2.c_str(), hash );
-
- return hash;
-}
-
-} // namespace Dali
+++ /dev/null
-#ifndef __DALI_HASH__
-#define __DALI_HASH__
-
-/*
- * Copyright (c) 2015 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// EXTERNAL INCLUDES
-#include <string>
-
-//INTERNAL INCLUDES
-#include <dali/public-api/common/dali-common.h>
-
-namespace Dali
-{
-
-/**
- * @brief Create a hash code for a string
- * @param toHash string to hash
- * @return hash code
- */
-DALI_IMPORT_API std::size_t CalculateHash( const std::string& toHash );
-
-/**
- * @brief Create a hash code for 2 strings combined.
- * Allows a hash to be calculated without concatenating the strings and allocating any memory.
- * @param string1 first string
- * @param string2 second string
- * @return hash code
- */
-DALI_IMPORT_API std::size_t CalculateHash( const std::string& string1, const std::string& string2 );
-
-} // namespace Dali
-
-#endif // __DALI_HASH__
+++ /dev/null
-/*
- * Copyright (c) 2015 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// CLASS HEADER
-#include <dali/public-api/common/mutex.h>
-
-// EXTERNAL INCLUDES
-#include <pthread.h>
-
-namespace Dali
-{
-
-struct Mutex::MutexImpl
-{
- pthread_mutex_t mutex;
- bool locked;
-};
-
-Mutex::Mutex()
-: mImpl( new MutexImpl )
-{
- pthread_mutex_init( &mImpl->mutex, NULL );
- mImpl->locked = false;
-}
-
-Mutex::~Mutex()
-{
- pthread_mutex_destroy( &mImpl->mutex );
- // nothing else to do as there is no Lock/Unlock API
- // ScopedLock destructor will always unlock the mutex
- delete mImpl;
-}
-
-bool Mutex::IsLocked()
-{
- return mImpl->locked;
-}
-
-Mutex::ScopedLock::ScopedLock( Mutex& mutex )
-: mMutex( mutex )
-{
- pthread_mutex_lock( &mMutex.mImpl->mutex );
- mMutex.mImpl->locked = true;
-}
-
-Mutex::ScopedLock::~ScopedLock()
-{
- pthread_mutex_unlock( &mMutex.mImpl->mutex );
- mMutex.mImpl->locked = false;
-}
-
-} // namespace Dali
+++ /dev/null
-#ifndef __DALI_MUTEX_H__
-#define __DALI_MUTEX_H__
-
-/*
- * Copyright (c) 2015 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// INTERNAL INCLUDES
-#include <dali/public-api/common/dali-common.h>
-
-/**
- * The top level DALi namespace
- */
-namespace Dali
-{
-
-/**
- * Class to synchronize access to critical resources from multiple threads
- */
-class DALI_IMPORT_API Mutex
-{
-public:
-
- /**
- * @brief Constructor, acquires the mutex from the underlying OS
- */
- Mutex();
-
- /**
- * @brief Destructor, non virtual as this is not meant as a base class
- */
- ~Mutex();
-
- /**
- * @brief Check if the mutex is locked
- * @return true if the mutex is locked
- */
- bool IsLocked();
-
-public:
-
- /**
- * Helper class to do a scoped lock on a mutex implementing the RAII idiom.
- * Note! this class *does not* prevent a deadlock in the case when same thread is
- * locking the same mutex twice.
- */
- class ScopedLock
- {
- public:
-
- /**
- * Constructor
- * @param mutex to lock
- */
- ScopedLock( Mutex& mutex );
-
- /**
- * Destructor, releases the lock
- */
- ~ScopedLock();
-
- private:
- Mutex& mMutex;
- };
-
-private:
-
- /// Not implemented as Mutex is not copyable
- Mutex( const Mutex& );
- const Mutex& operator= ( const Mutex& );
-
- struct MutexImpl;
- MutexImpl* mImpl;
-
-};
-
-} // namespace Dali
-
-#endif // __DALI_MUTEX_H__
+++ /dev/null
-#ifndef __REF_COUNTED_DALI_VECTOR_H__
-#define __REF_COUNTED_DALI_VECTOR_H__
-
-/*
- * Copyright (c) 2015 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// INTERNAL INCLUDES
-#include <dali/public-api/common/dali-vector.h>
-#include <dali/public-api/object/ref-object.h>
-
-namespace Dali
-{
-
-/**
- * @brief A reference counting wrapper for a vector class that allows
- * a set of referencing smart pointers to collaborate in managing its
- * lifetime and eventually cleaning it up.
- *
- * This should only be allocated on the new/delete heap, not a thread's
- * stack.
- * @tparam T type of the data that the vector holds
- */
-template< typename T >
-class RefCountedVector : public RefObject
-{
-public:
- /**
- * @brief Construct empty vector.
- */
- RefCountedVector()
- {
- }
-
- /**
- * @brief Get the referenced vector.
- *
- * @return A reference to the vector that this object wraps.
- */
- Vector< T >& GetVector()
- {
- return mVector;
- }
-
-protected:
- virtual ~RefCountedVector()
- {
- }
-
-private:
- // Disable copy-constructing and copying:
- RefCountedVector(const RefCountedVector &); ///< Undefined
- RefCountedVector & operator = (const RefCountedVector &); ///< Undefined
-
- Vector< T > mVector; ///< The vector of data
-};
-
-} // namespace Dali
-
-#endif /* __REF_COUNTED_DALI_VECTOR_H__ */
+++ /dev/null
-#ifndef __DALI_SCOPED_POINTER_H__
-#define __DALI_SCOPED_POINTER_H__
-/*
- * Copyright (c) 2015 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-namespace Dali
-{
-
-/**
- * @brief Deletes the object pointed-to when it goes out of scope.
- *
- * A simple template class to call delete on an owned pointer when it goes
- * out of scope, whether that be by ordinary return or stack unwind for
- * exception throw.
- */
-template<typename Owned>
-class ScopedPointer
-{
-public:
-
- /**
- * @brief Construct a ScopedPointer guarding a new Owned*.
- */
- ScopedPointer( Owned * const owned ) :
- mOwned( owned )
- {}
-
- /**
- * @brief Destroy the ScopedPointer and clean up its Owned*.
- */
- ~ScopedPointer()
- {
- if( mOwned != 0 )
- {
- delete mOwned;
- mOwned = 0;
- }
- }
-
- /**
- * @brief Getter for the underlying pointer.
- * @return The Owned* guarded by this object.
- */
- Owned* Get() const
- {
- return mOwned;
- }
-
- /**
- * @brief Give up ownership of the object guarded by this pointer.
- * @return The Owned* previously guarded by this object.
- */
- Owned* Release()
- {
- Owned* const owned = mOwned;
- mOwned = 0;
- return owned;
- }
-
- /**
- * @brief Dereference this pointer.
- */
- Owned& operator*() const
- {
- return *mOwned;
- }
-
- /**
- * @brief Allow member access through arrow notation.
- */
- Owned * operator->() const
- {
- return mOwned;
- }
-
-private:
-
- // Non-copyable:
- ScopedPointer( const ScopedPointer& rhs );
- ScopedPointer& operator = ( const ScopedPointer& rhs );
-
- Owned* mOwned;
-};
-
-} /* namespace Dali */
-
-#endif /* __DALI_SCOPED_POINTER_H__ */
#include <dali/public-api/actors/draw-mode.h>
#include <dali/public-api/actors/image-actor.h>
#include <dali/public-api/actors/layer.h>
-#include <dali/public-api/actors/mesh-actor.h>
#include <dali/public-api/actors/renderable-actor.h>
#include <dali/public-api/actors/sampling.h>
#include <dali/public-api/animation/key-frames.h>
#include <dali/public-api/animation/linear-constrainer.h>
#include <dali/public-api/animation/path.h>
-#include <dali/public-api/animation/path-constrainer.h>
#include <dali/public-api/animation/time-period.h>
#include <dali/public-api/common/compile-time-assert.h>
#include <dali/public-api/common/dali-vector.h>
#include <dali/public-api/common/intrusive-ptr.h>
#include <dali/public-api/common/loading-state.h>
-#include <dali/public-api/common/mutex.h>
#include <dali/public-api/common/stage.h>
#include <dali/public-api/common/vector-wrapper.h>
#include <dali/public-api/common/view-mode.h>
#include <dali/public-api/events/gesture-detector.h>
#include <dali/public-api/events/gesture.h>
-#include <dali/public-api/events/hit-test-algorithm.h>
#include <dali/public-api/events/hover-event.h>
#include <dali/public-api/events/key-event.h>
#include <dali/public-api/events/long-press-gesture-detector.h>
#include <dali/public-api/events/touch-event.h>
#include <dali/public-api/events/touch-point.h>
-#include <dali/public-api/geometry/animatable-mesh.h>
-#include <dali/public-api/geometry/animatable-vertex.h>
-#include <dali/public-api/geometry/cloth.h>
-#include <dali/public-api/geometry/mesh.h>
-#include <dali/public-api/geometry/mesh-factory.h>
-
-#include <dali/public-api/images/atlas.h>
#include <dali/public-api/images/buffer-image.h>
-#include <dali/public-api/images/distance-field.h>
#include <dali/public-api/images/encoded-buffer-image.h>
#include <dali/public-api/images/frame-buffer-image.h>
#include <dali/public-api/images/image.h>
-#include <dali/public-api/images/image-operations.h>
-#include <dali/public-api/images/native-image-interface.h>
#include <dali/public-api/images/native-image.h>
#include <dali/public-api/images/resource-image.h>
#include <dali/public-api/images/nine-patch-image.h>
#include <dali/public-api/math/vector3.h>
#include <dali/public-api/math/vector4.h>
-#include <dali/public-api/modeling/bone.h>
-#include <dali/public-api/modeling/material.h>
-
#include <dali/public-api/object/any.h>
#include <dali/public-api/object/base-handle.h>
#include <dali/public-api/object/base-object.h>
#include <dali/public-api/render-tasks/render-task-list.h>
#include <dali/public-api/render-tasks/render-task.h>
-#include <dali/public-api/scripting/scripting.h>
-
#include <dali/public-api/signals/base-signal.h>
#include <dali/public-api/signals/callback.h>
#include <dali/public-api/signals/connection-tracker-interface.h>
+++ /dev/null
-/*
- * Copyright (c) 2015 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// CLASS HEADER
-#include <dali/public-api/events/hit-test-algorithm.h>
-
-// INTERNAL INCLUDES
-#include <dali/internal/event/events/hit-test-algorithm-impl.h>
-#include <dali/internal/event/common/stage-impl.h>
-#include <dali/internal/event/render-tasks/render-task-impl.h>
-
-namespace Dali
-{
-
-namespace HitTestAlgorithm
-{
-
-bool HitTest( Stage stage, const Vector2& screenCoordinates, Results& results, HitTestFunction func )
-{
- return Internal::HitTestAlgorithm::HitTest( GetImplementation(stage), screenCoordinates, results, func );
-}
-
-bool HitTest( RenderTask& renderTask, const Vector2& screenCoordinates, Results& results, HitTestFunction func )
-{
- Stage stage = Stage::GetCurrent();
- return Internal::HitTestAlgorithm::HitTest( GetImplementation( stage ), GetImplementation(renderTask), screenCoordinates, results, func );
-}
-
-} // namespace HitTestAlgorithm
-
-} // namespace Dali
+++ /dev/null
-#ifndef __DALI_HIT_TEST_ALGORITHM_H__
-#define __DALI_HIT_TEST_ALGORITHM_H__
-
-/*
- * Copyright (c) 2015 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include <dali/public-api/actors/actor.h>
-#include <dali/public-api/common/stage.h>
-
-
-namespace Dali
-{
-
-class RenderTask;
-
-/**
- * @brief This namespace is provided for application developers to do hit-test for the actors.
- *
- * <h3>Hit Test Algorithm:</h3>
- *
- * Hit testing is dependent on the camera used, which is specific to each RenderTask. For each RenderTask,
- * hit testing starts from the top-most layer and we go through all the layers until we have a hit or there
- * are none left. Before we perform a hit test within a layer, we check if all the layer's parents meet the
- * conditions defined by the function ((e.g. whether it is visible)). If they are not, we skip hit testing
- * the actors in that layer altogether. Otherwise, we walk through the actor tree within a layer to check
- * whether the actors within the actor tree should be hit-tested.
- *
- * The following pseudocode gives an example of what the function can typically check, which should normally
- * be provided by the application code:
- *
- * @code
- * HIT-TEST-FUNCTION( ACTOR, TRAVERSE-TYPE )
- * {
- * if( TRAVERSE-TYPE == CHECK_ACTOR ) // Check whether current actor should be hit-tested
- * {
- * if( ACTOR-IS-VISIBLE &&
- * ACTOR-WORLD-COLOR-IS-NOT-TRANSPARENT )
- * {
- * HITTABLE = TRUE
- * }
- * }
- * else if( TRAVERSE-TYPE == DESCEND_ACTOR_TREE ) ///< Check whether the actor tree should be descended to hit-test its children.
- * {
- * if( ACTOR-IS-VISIBLE )
- * {
- * HITTABLE = TRUE
- * }
- * }
- * }
- * @endcode
- *
- * The following pseudocode explains how the algorithm performs the hit-test with the above functor:
- *
- * @code
- * HIT-TEST-WITHIN-LAYER( ACTOR )
- * {
- * // Depth-first traversal within current layer, visiting parent first
- *
- * // Check whether current actor should be hit-tested
- * IF ( HIT-TEST-FUNCTION( ACTOR, CHECK_ACTOR ) &&
- * ACTOR-HAS-NON-ZERO-SIZE )
- * {
- * // Hit-test current actor
- * IF ( ACTOR-HIT )
- * {
- * IF ( DISTANCE-TO-ACTOR < DISTANCE-TO-LAST-HIT-ACTOR )
- * {
- * // The current actor is the closest actor that was underneath the touch
- * LAST-HIT-ACTOR = CURRENT-ACTOR
- * }
- * }
- * }
- *
- * // Keep checking children, in case we hit something closer
- * FOR-EACH CHILD (in order)
- * {
- * IF ( HIT-TEST-FUNCTION( ACTOR, DESCEND_ACTOR_TREE ) &&
- * ACTOR-IS-NOT-A-LAYER )
- * {
- * // Continue traversal for this child's sub-tree
- * HIT-TEST-WITHIN-LAYER ( CHILD )
- * }
- * // else we skip the sub-tree with from this child
- * }
- * }
- * @endcode
- */
-namespace HitTestAlgorithm
-{
-
-/**
- * @brief How the actor tree should be traversed.
- */
-enum TraverseType
-{
- CHECK_ACTOR, ///< Hit test the given actor.
- DESCEND_ACTOR_TREE ///< Check whether the actor tree should be descended to hit-test its children.
-};
-
-/**
- * @brief Results structure containing the hit actor and where it was hit.
- */
-struct Results
-{
- Actor actor; ///< The hit actor.
- Vector2 actorCoordinates; ///< The actor coordinates.
-};
-
-/**
- * @brief Definition of a hit-test function to use in HitTest() method to check if the actor is hittable (e.g. touchable or focusable).
- *
- * @return true, if the actor is hittable, false otherwise.
- */
-typedef bool (*HitTestFunction)(Actor actor, TraverseType type);
-
-/**
- * @brief Given screen coordinates, this method returns the hit actor & the local coordinates relative to
- * the top-left (0.0f, 0.0f, 0.5f) of the actor.
- *
- * An actor is only hittable if the actor meets all the conditions
- * defined by the given function (see HitTestAlgorithm).
- *
- * Typically, if an actor has a zero size or its world color is fully transparent, it should not be
- * hittable; and if an actor's visibility flag is unset, its children should not be hittable either.
- *
- * @param[in] stage The stage.
- * @param[in] screenCoordinates The screen coordinates.
- * @param[out] results The results of the hit-test, only modified if something is hit
- * @param[in] func The function to use in the hit-test algorithm.
- * @return true if something was hit
- */
-DALI_IMPORT_API bool HitTest( Stage stage, const Vector2& screenCoordinates, Results& results, HitTestFunction func );
-
-/**
- * @brief Hit test specific to a given RenderTask.
- *
- * @param[in] renderTask The render task for hit test
- * @param[in] screenCoordinates The screen coordinates.
- * @param[out] results The results of the hit-test, only modified if something is hit
- * @param[in] func The function to use in the hit-test algorithm.
- * @return true if something was hit
- */
-DALI_IMPORT_API bool HitTest( RenderTask& renderTask, const Vector2& screenCoordinates, Results& results, HitTestFunction func );
-
-} // namespace HitTestAlgorithm
-
-} // namespace Dali
-
-#endif // __DALI_HIT_TEST_ALGORITHM_H__
$(public_api_src_dir)/actors/custom-actor-impl.cpp \
$(public_api_src_dir)/actors/image-actor.cpp \
$(public_api_src_dir)/actors/layer.cpp \
- $(public_api_src_dir)/actors/mesh-actor.cpp \
$(public_api_src_dir)/actors/renderable-actor.cpp \
$(public_api_src_dir)/animation/animation.cpp \
$(public_api_src_dir)/animation/alpha-function.cpp \
$(public_api_src_dir)/animation/key-frames.cpp \
$(public_api_src_dir)/animation/linear-constrainer.cpp \
$(public_api_src_dir)/animation/path.cpp \
- $(public_api_src_dir)/animation/path-constrainer.cpp \
$(public_api_src_dir)/animation/time-period.cpp \
$(public_api_src_dir)/common/constants.cpp \
$(public_api_src_dir)/common/dali-common.cpp \
$(public_api_src_dir)/common/dali-vector.cpp \
- $(public_api_src_dir)/common/hash.cpp \
- $(public_api_src_dir)/common/mutex.cpp \
$(public_api_src_dir)/common/stage.cpp \
$(public_api_src_dir)/events/gesture.cpp \
$(public_api_src_dir)/events/gesture-detector.cpp \
- $(public_api_src_dir)/events/hit-test-algorithm.cpp \
$(public_api_src_dir)/events/hover-event.cpp \
$(public_api_src_dir)/events/key-event.cpp \
$(public_api_src_dir)/events/long-press-gesture.cpp \
$(public_api_src_dir)/events/tap-gesture-detector.cpp \
$(public_api_src_dir)/events/touch-point.cpp \
$(public_api_src_dir)/events/touch-event.cpp \
- $(public_api_src_dir)/geometry/animatable-mesh.cpp \
- $(public_api_src_dir)/geometry/animatable-vertex.cpp \
- $(public_api_src_dir)/geometry/cloth.cpp \
- $(public_api_src_dir)/geometry/mesh-data.cpp \
- $(public_api_src_dir)/geometry/mesh-factory.cpp \
- $(public_api_src_dir)/geometry/mesh.cpp \
- $(public_api_src_dir)/images/atlas.cpp \
- $(public_api_src_dir)/images/distance-field.cpp \
$(public_api_src_dir)/images/image.cpp \
$(public_api_src_dir)/images/pixel.cpp \
$(public_api_src_dir)/images/buffer-image.cpp \
$(public_api_src_dir)/math/vector2.cpp \
$(public_api_src_dir)/math/vector3.cpp \
$(public_api_src_dir)/math/vector4.cpp \
- $(public_api_src_dir)/modeling/bone.cpp \
- $(public_api_src_dir)/modeling/material.cpp \
$(public_api_src_dir)/object/any.cpp \
$(public_api_src_dir)/object/base-handle.cpp \
$(public_api_src_dir)/object/handle.cpp \
$(public_api_src_dir)/render-tasks/render-task.cpp \
$(public_api_src_dir)/render-tasks/render-task-list.cpp \
$(public_api_src_dir)/shader-effects/shader-effect.cpp \
- $(public_api_src_dir)/scripting/scripting.cpp \
$(public_api_src_dir)/signals/callback.cpp \
$(public_api_src_dir)/signals/connection-tracker.cpp \
$(public_api_src_dir)/signals/connection-tracker-interface.cpp \
$(public_api_src_dir)/actors/draw-mode.h \
$(public_api_src_dir)/actors/image-actor.h \
$(public_api_src_dir)/actors/layer.h \
- $(public_api_src_dir)/actors/mesh-actor.h \
$(public_api_src_dir)/actors/renderable-actor.h \
$(public_api_src_dir)/actors/sampling.h
$(public_api_src_dir)/animation/key-frames.h \
$(public_api_src_dir)/animation/linear-constrainer.h \
$(public_api_src_dir)/animation/path.h \
- $(public_api_src_dir)/animation/path-constrainer.h \
$(public_api_src_dir)/animation/time-period.h
public_api_core_common_header_files = \
$(public_api_src_dir)/common/constants.h \
$(public_api_src_dir)/common/dali-common.h \
$(public_api_src_dir)/common/dali-vector.h \
- $(public_api_src_dir)/common/hash.h \
$(public_api_src_dir)/common/intrusive-ptr.h \
$(public_api_src_dir)/common/loading-state.h \
- $(public_api_src_dir)/common/mutex.h \
- $(public_api_src_dir)/common/ref-counted-dali-vector.h \
- $(public_api_src_dir)/common/scoped-pointer.h \
$(public_api_src_dir)/common/stage.h \
$(public_api_src_dir)/common/type-traits.h \
$(public_api_src_dir)/common/vector-wrapper.h \
public_api_core_events_header_files = \
$(public_api_src_dir)/events/gesture.h \
$(public_api_src_dir)/events/gesture-detector.h \
- $(public_api_src_dir)/events/hit-test-algorithm.h \
$(public_api_src_dir)/events/hover-event.h \
$(public_api_src_dir)/events/key-event.h \
$(public_api_src_dir)/events/long-press-gesture.h \
$(public_api_src_dir)/events/touch-point.h \
$(public_api_src_dir)/events/touch-event.h
-public_api_core_geometry_header_files = \
- $(public_api_src_dir)/geometry/animatable-mesh.h \
- $(public_api_src_dir)/geometry/animatable-vertex.h \
- $(public_api_src_dir)/geometry/cloth.h \
- $(public_api_src_dir)/geometry/mesh.h \
- $(public_api_src_dir)/geometry/mesh-data.h \
- $(public_api_src_dir)/geometry/mesh-factory.h
-
public_api_core_images_header_files = \
- $(public_api_src_dir)/images/atlas.h \
$(public_api_src_dir)/images/buffer-image.h \
- $(public_api_src_dir)/images/distance-field.h \
$(public_api_src_dir)/images/encoded-buffer-image.h \
$(public_api_src_dir)/images/frame-buffer-image.h \
$(public_api_src_dir)/images/image.h \
- $(public_api_src_dir)/images/image-operations.h \
- $(public_api_src_dir)/images/native-image-interface.h \
$(public_api_src_dir)/images/nine-patch-image.h \
$(public_api_src_dir)/images/pixel.h \
$(public_api_src_dir)/images/resource-image.h \
$(public_api_src_dir)/math/viewport.h
-public_api_core_modeling_header_files = \
- $(public_api_src_dir)/modeling/bone.h \
- $(public_api_src_dir)/modeling/material.h
public_api_core_object_header_files = \
$(public_api_src_dir)/object/any.h \
$(public_api_src_dir)/object/property.h \
$(public_api_src_dir)/object/ref-object.h \
$(public_api_src_dir)/object/type-info.h \
- $(public_api_src_dir)/object/type-registry.h \
- $(public_api_src_dir)/object/type-registry-helper.h
+ $(public_api_src_dir)/object/type-registry.h
public_api_core_render_tasks_header_files = \
$(public_api_src_dir)/render-tasks/render-task.h \
public_api_core_shader_effects_header_files = \
$(public_api_src_dir)/shader-effects/shader-effect.h
-public_api_core_scripting_header_files = \
- $(public_api_src_dir)/scripting/scripting.h
-
public_api_core_size_negotiation_header_files = \
$(public_api_src_dir)/size-negotiation/relayout-container.h
+++ /dev/null
-/*
- * Copyright (c) 2015 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-
-#include <dali/public-api/geometry/animatable-mesh.h>
-#include <dali/internal/event/modeling/animatable-mesh-impl.h>
-
-namespace Dali
-{
-
-AnimatableMesh::AnimatableMesh()
-{
-}
-
-AnimatableMesh AnimatableMesh::New(
- unsigned int numVertices,
- const AnimatableMesh::Faces& faceIndices,
- Dali::Material material )
-{
- Internal::AnimatableMeshPtr internal = Internal::AnimatableMesh::New( numVertices,
- faceIndices,
- material );
- return AnimatableMesh(internal.Get());
-}
-
-AnimatableMesh AnimatableMesh::New( unsigned int numVertices,
- const Faces& faceIndices )
-{
-
- Internal::AnimatableMeshPtr internal = Internal::AnimatableMesh::New( numVertices, faceIndices );
- return AnimatableMesh(internal.Get());
-}
-
-AnimatableMesh AnimatableMesh::DownCast( BaseHandle handle )
-{
- return AnimatableMesh( dynamic_cast<Dali::Internal::AnimatableMesh*>(handle.GetObjectPtr()) );
-}
-
-AnimatableMesh::~AnimatableMesh()
-{
-}
-
-AnimatableMesh::AnimatableMesh(const AnimatableMesh& handle)
-: Handle(handle)
-{
-}
-
-AnimatableMesh& AnimatableMesh::operator=(const AnimatableMesh& rhs)
-{
- BaseHandle::operator=(rhs);
- return *this;
-}
-
-unsigned int AnimatableMesh::GetNumberOfVertices() const
-{
- return GetImplementation(*this).GetNumberOfVertices();
-}
-
-AnimatableVertex AnimatableMesh::operator[](const unsigned int index) const
-{
- DALI_ASSERT_ALWAYS( index < GetNumberOfVertices() && "Index out of bounds" );
-
- return AnimatableVertex(index, *this);
-}
-
-Property::Index AnimatableMesh::GetPropertyIndex(
- unsigned int index,
- Property::Index property ) const
-{
- DALI_ASSERT_ALWAYS( index < GetNumberOfVertices() && "Index out of bounds" );
-
- return GetImplementation(*this).GetVertexPropertyIndex( index, property );
-}
-
-Property AnimatableMesh::GetVertexProperty( unsigned int vertex, Property::Index property)
-{
- return Property( *this, GetPropertyIndex( vertex, property ) );
-}
-
-
-AnimatableMesh::AnimatableMesh( Internal::AnimatableMesh* internal )
-: Handle(internal)
-{
-}
-
-} // Dali
+++ /dev/null
-#ifndef __DALI_ANIMATABLE_MESH__H__
-#define __DALI_ANIMATABLE_MESH__H__
-
-/*
- * Copyright (c) 2015 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// INTERNAL INCLUDES
-#include <dali/public-api/common/vector-wrapper.h>
-#include <dali/public-api/object/handle.h>
-#include <dali/public-api/geometry/animatable-vertex.h>
-#include <dali/public-api/modeling/material.h>
-
-namespace Dali
-{
-class AnimatableVertex;
-
-namespace Internal DALI_INTERNAL
-{
-class AnimatableMesh;
-}
-
-/**
- * @brief An animatable mesh can have any of its vertices animated using Dali's animation and
- * constraint systems.
- *
- * It is recommended that the vertices of the mesh remain in the bounds -0.5 - 0.5, which
- * will match the actor size boundaries. The origin of the mesh matches the actor's position.
- */
-class DALI_IMPORT_API AnimatableMesh : public Handle
-{
-public:
- /**
- * @brief Vector of face indices.
- */
- typedef std::vector<unsigned short> Faces;
- typedef Faces::iterator FacesIter; ///< Iterator for Dali::AnimatableMesh::Faces
- typedef Faces::const_iterator FacesConstIter; ///< Const Iterator for Dali::AnimatableMesh::Faces
-
- /**
- * @brief Create an uninitialized handle, this can be initialized with New().
- *
- * Calling member functions on an uninitialized handle will result
- * in an assertion
- */
- AnimatableMesh();
-
- /**
- * @brief Create a new animatable mesh with a given number of vertices and triangles.
- *
- * This will assert if any index is out of range.
- * Using this constructor enables the vertex color property.
- * AnimatableMesh does not take ownership of the faceIndices.
- * @param[in] numVertices The number of vertices in the mesh
- * @param[in] faceIndices A set of vertex indices, 3 per face.
- * @return an initialized handle to the animatable mesh
- * @note The maximum number of supported vertices is 3333333.
- */
- static AnimatableMesh New( unsigned int numVertices,
- const Faces& faceIndices );
-
- /**
- * @brief Create a new animatable mesh with a given number of vertices and triangles.
- *
- * This will assert if any index is out of range.
- * Using this constructor disables the vertex color property.
- * AnimatableMesh does not take ownership of the faceIndices.
- * @param[in] numVertices The number of vertices in the mesh
- * @param[in] faceIndices A set of vertex indices, 3 per face.
- * @param[in] material Material used to render mesh
- * @return an initialized handle to the animatable mesh
- * @note The maximum number of supported vertices is 3333333.
- */
- static AnimatableMesh New( unsigned int numVertices,
- const Faces& faceIndices,
- Dali::Material material );
-
- /**
- * @brief Downcast an Object handle to AnimatableMesh.
- *
- * If the handle points to an AnimatableMesh objec, the downcast
- * produces a valid handle. If not, the handle is left
- * uninitialized.
- *
- * @param[in] handle to an Object
- * @return handle to an AnimatableMesh or an uninitialized handle
- */
- static AnimatableMesh DownCast( BaseHandle handle );
-
- /**
- * @brief Destructor
- *
- * This is non-virtual since derived Handle types must not contain data or virtual methods.
- */
- ~AnimatableMesh();
-
- /**
- * @brief This copy constructor is required for (smart) pointer semantics.
- *
- * @param [in] handle A reference to the copied handle
- */
- AnimatableMesh(const AnimatableMesh& handle);
-
- /**
- * @brief This assignment operator is required for (smart) pointer semantics.
- *
- * @param [in] rhs A reference to the copied handle
- * @return A reference to this
- */
- AnimatableMesh& operator=(const AnimatableMesh& rhs);
-
- /**
- * @brief Get the number of vertices with which this mesh was created.
- *
- * @return number of vertices in this mesh
- */
- unsigned int GetNumberOfVertices() const;
-
- /**
- * @brief Array subscript operator overload.
- *
- * @pre The vertex index is in range
- * @param[in] index subscript
- * @return the vertex at the given index
- */
- AnimatableVertex operator[]( unsigned int index ) const;
-
- /**
- * @brief Get a property index for a given vertex.
- *
- * @pre The vertex index and property is in range
- * @param[in] vertex The vertex
- * @param[in] property The vertex attribute
- * @return A property index for use in constraints or animations
- */
- Property::Index GetPropertyIndex( unsigned int vertex, Property::Index property) const;
-
- /**
- * @brief Get the property for a given vertex.
- *
- * @pre The vertex index and property is in range
- * @param[in] vertex The vertex
- * @param[in] property The vertex attribute
- * @return A property index for use in constraints or animations
- */
- Property GetVertexProperty( unsigned int vertex, Property::Index property );
-
-public: // Not for use by application developer
-
- /**
- * @brief This constructor is used by Dali New() methods
- *
- * @param [in] mesh A pointer to a newly allocated Dali resource
- */
- explicit DALI_INTERNAL AnimatableMesh(Internal::AnimatableMesh* mesh);
-};
-
-}// Dali
-
-#endif
+++ /dev/null
-/*
- * Copyright (c) 2015 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include <dali/public-api/geometry/animatable-vertex.h>
-#include <dali/public-api/geometry/animatable-mesh.h>
-#include <dali/internal/event/modeling/animatable-mesh-impl.h>
-
-namespace Dali
-{
-
-AnimatableVertex::AnimatableVertex( unsigned int vertex, AnimatableMesh mesh)
- : mVertex(vertex),
- mMesh(GetImplementation(mesh))
-{
- DALI_ASSERT_ALWAYS( mesh && "Mesh handle is empty" );
- DALI_ASSERT_ALWAYS( vertex < mesh.GetNumberOfVertices() && "vertex is out of bounds" );
-}
-
-AnimatableVertex::~AnimatableVertex()
-{
-}
-
-void AnimatableVertex::SetPosition(const Vector3& position)
-{
- mMesh.SetProperty( mMesh.GetVertexPropertyIndex(mVertex, Property::POSITION), Dali::Property::Value(position) );
-}
-
-void AnimatableVertex::SetColor(const Vector4& color)
-{
- mMesh.SetProperty( mMesh.GetVertexPropertyIndex(mVertex, Property::COLOR), Dali::Property::Value(color) );
-}
-
-void AnimatableVertex::SetTextureCoords(const Vector2& textureCoords)
-{
- mMesh.SetProperty( mMesh.GetVertexPropertyIndex(mVertex, Property::TEXTURE_COORDS), Dali::Property::Value(textureCoords) );
-}
-
-Vector3 AnimatableVertex::GetCurrentPosition()
-{
- Vector3 position;
- mMesh.GetProperty( mMesh.GetVertexPropertyIndex(mVertex, Property::POSITION) ).Get(position);
- return position;
-}
-
-Vector4 AnimatableVertex::GetCurrentColor()
-{
- Vector4 color;
- mMesh.GetProperty( mMesh.GetVertexPropertyIndex(mVertex, Property::COLOR) ).Get(color);
- return color;
-}
-
-Vector2 AnimatableVertex::GetCurrentTextureCoords()
-{
- Vector2 textureCoords;
- mMesh.GetProperty( mMesh.GetVertexPropertyIndex(mVertex, Property::TEXTURE_COORDS) ).Get(textureCoords);
- return textureCoords;
-}
-
-}//Dali
+++ /dev/null
-#ifndef __DALI_ANIMATABLE_VERTEX__H__
-#define __DALI_ANIMATABLE_VERTEX__H__
-
-/*
- * Copyright (c) 2015 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// INTERNAL INCLUDES
-#include <dali/public-api/common/dali-common.h>
-#include <dali/public-api/object/property.h>
-#include <dali/public-api/object/property-index-ranges.h>
-#include <dali/public-api/math/vector2.h>
-#include <dali/public-api/math/vector3.h>
-#include <dali/public-api/math/vector4.h>
-
-namespace Dali
-{
-class AnimatableMesh;
-
-namespace Internal DALI_INTERNAL
-{
-class AnimatableMesh;
-}
-
-/**
- * @brief Represents a vertex in an AnimatableMesh.
- *
- * It is used by AnimatableMesh to offer an array interface for
- * setting properties:
- *
- * @code
- * AnimatableMesh mesh = AnimatableMesh(numVerts, faces);
- * mesh[vertex].SetColor(color);
- * @endcode
- */
-class DALI_IMPORT_API AnimatableVertex
-{
-public:
-
- /**
- * @brief An enumeration of properties belonging to the AnimatableVertex class.
- * Note: These are used by animatable mesh also.
- */
- struct Property
- {
- enum
- {
- POSITION = DEFAULT_OBJECT_PROPERTY_START_INDEX, ///< name prefix "position-", type Vector3
- COLOR, ///< name prefix "color-", type Vector4
- TEXTURE_COORDS, ///< name prefix "texture-coords-", type Vector2
- };
- };
-
- /**
- * @brief Destructor
- */
- ~AnimatableVertex();
-
- /**
- * @brief Set the position of the vertex.
- *
- * @param[in] position (note, -0.5 - +0.5 are inside the actor's boundaries)
- */
- void SetPosition(const Vector3& position);
-
- /**
- * @brief Set the vertex color.
- * @param[in] color The vertex color
- */
- void SetColor(const Vector4& color);
-
- /**
- * @brief Set the texture coordinates.
- *
- * @param[in] textureCoords The texture coordinates
- */
- void SetTextureCoords(const Vector2& textureCoords);
-
- /**
- * @brief Get the current position of the vertex.
- *
- * @return position
- */
- Vector3 GetCurrentPosition();
-
- /**
- * @brief Get the current vertex color.
- *
- * @return The vertex color
- */
- Vector4 GetCurrentColor();
-
- /**
- * @brief Get the current texture coordinates.
- *
- * @return textureCoords The texture coordinates
- */
- Vector2 GetCurrentTextureCoords();
-
-private:
- // Only allow AnimatableMesh to construct this object.
- friend class Dali::AnimatableMesh;
-
- /**
- * @brief Constructor.
- *
- * @param[in] vertex The index of the vertex in the parent mesh
- * @param[in] mesh The parent mesh
- */
- AnimatableVertex( unsigned int vertex, AnimatableMesh mesh );
-
- /**
- * @brief Undefined Copy Constructor
- */
- AnimatableVertex(const AnimatableVertex& vertex);
-
- /**
- * @brief Undefined Assignment Operator
- */
- AnimatableVertex& operator=(const AnimatableVertex& vertex);
-
- int mVertex; ///< The index of this vertex in the parent mesh
- Internal::AnimatableMesh& mMesh; ///< The parent mesh
-};
-
-
-}//Dali
-
-#endif
+++ /dev/null
-/*
- * Copyright (c) 2015 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// CLASS HEADER
-#include <dali/public-api/geometry/cloth.h>
-
-// INTERNAL INCLUDES
-#include <dali/public-api/geometry/mesh-factory.h>
-#include <dali/internal/event/modeling/cloth-impl.h>
-
-namespace Dali
-{
-
-namespace
-{
-
-} // namespace
-
-Cloth::Cloth()
-{
-}
-
-Cloth::~Cloth()
-{
-}
-
-Cloth::Cloth(const Cloth& handle)
-: Mesh(handle)
-{
-}
-
-Cloth& Cloth::operator=(const Cloth& rhs)
-{
- BaseHandle::operator=(rhs);
- return *this;
-}
-
-Cloth Cloth::New( const float width, const float height, const int xSteps, const int ySteps, const Rect<float>& textureCoordinates )
-{
- MeshData meshData( MeshFactory::NewPlane(width, height, xSteps, ySteps, textureCoordinates) );
-
- Internal::ClothIPtr clothPtr = Internal::Cloth::New( meshData );
- return Cloth( clothPtr.Get() );
-}
-
-Cloth Cloth::DownCast( BaseHandle handle )
-{
- return Cloth( dynamic_cast<Dali::Internal::Cloth*>(handle.GetObjectPtr()) );
-}
-
-Cloth::Cloth(Internal::Cloth* internal)
-: Mesh(internal)
-{
-}
-
-} // namespace Dali
+++ /dev/null
-#ifndef __DALI_CLOTH_H__
-#define __DALI_CLOTH_H__
-
-/*
- * Copyright (c) 2015 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-
-// INTERNAL INCLUDES
-#include <dali/public-api/math/rect.h>
-#include <dali/public-api/math/vector4.h>
-#include <dali/public-api/object/base-handle.h>
-#include <dali/public-api/geometry/mesh.h>
-
-namespace Dali
-{
-
-namespace Internal DALI_INTERNAL
-{
-class Cloth;
-}
-
-/**
- * @brief A Cloth is a specialized mesh that can be used and modified
- * by the Dynamics engine.
- */
-class DALI_IMPORT_API Cloth : public Mesh
-{
-public:
-
- /**
- * @brief Create an initialized plane aligned on the XY axis.
- *
- * @param[in] width The width of the plane
- * @param[in] height The height of the plane
- * @param[in] xSteps The number of vertices along the X axis
- * @param[in] ySteps The number of vertices along the Y axis
- * @param[in] textureCoordinates UV coordinates.
- * @return A handle to a newly allocated Dali resource.
- */
- static Cloth New(const float width,
- const float height,
- const int xSteps,
- const int ySteps,
- const Rect<float>& textureCoordinates = Rect<float>(0.0f, 0.0f, 1.0f, 1.0f));
-
-
- /**
- * @brief Create an uninitialized Cloth; this can be initialized with Cloth::New().
- *
- * Calling member functions with an uninitialized Dali::Object is not allowed.
- */
- Cloth();
-
- /**
- * @brief Destructor
- *
- * This is non-virtual since derived Handle types must not contain data or virtual methods.
- */
- ~Cloth();
-
- /**
- * @brief This copy constructor is required for (smart) pointer semantics.
- *
- * @param [in] handle A reference to the copied handle
- */
- Cloth(const Cloth& handle);
-
- /**
- * @brief This assignment operator is required for (smart) pointer semantics.
- *
- * @param [in] rhs A reference to the copied handle
- * @return A reference to this
- */
- Cloth& operator=(const Cloth& rhs);
-
- /**
- * @brief Downcast an Object handle to a Cloth handle.
- *
- * If handle points to a Cloth object the downcast produces valid
- * handle. If not the returned handle is left uninitialized.
- *
- * @param[in] handle to an object
- * @return handle to a Cloth object or an uninitialized handle
- */
- static Cloth DownCast( BaseHandle handle );
-
-public: // Not intended for application developers
-
- /**
- * @brief This constructor is used by Dali New() methods.
- *
- * @param [in] cloth A pointer to a newly allocated Dali resource
- */
- explicit DALI_INTERNAL Cloth(Internal::Cloth* cloth);
-};
-
-} // namespace Dali
-
-#endif // __DALI_CLOTH_H__
+++ /dev/null
-/*
- * Copyright (c) 2015 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// Class header
-#include <dali/public-api/geometry/mesh-data.h>
-
-// Internal headers
-#include <dali/public-api/math/matrix.h>
-#include <dali/integration-api/debug.h>
-
-namespace Dali
-{
-
-namespace // unnamed namespace
-{
-const float kBoundsDefault = 1e10f;
-} // unnamed namespace
-
-using Dali::Vector4;
-
-
-MeshData::MeshData( )
-: mGeometryType(TRIANGLES),
- mUseTextureCoords(false),
- mUseNormals(false),
- mUseColor(false),
- mMin( kBoundsDefault, kBoundsDefault, kBoundsDefault, 0.0f),
- mMax(-kBoundsDefault, -kBoundsDefault, -kBoundsDefault, 0.0f)
-{
-}
-
-MeshData::MeshData( const MeshData& meshData )
-: mVertices( meshData.mVertices ),
- mFaces( meshData.mFaces ),
- mGeometryType( meshData.mGeometryType ),
- mUseTextureCoords( meshData.mUseTextureCoords ),
- mUseNormals( meshData.mUseNormals ),
- mUseColor( meshData.mUseColor ),
- mBones( meshData.mBones ),
- mMaterial( meshData.mMaterial ),
- mMin( meshData.mMin ),
- mMax( meshData.mMax )
-{
-}
-
-MeshData& MeshData::operator=(const MeshData& rhs)
-{
- mVertices = rhs.mVertices;
- mFaces = rhs.mFaces;
- mGeometryType = rhs.mGeometryType;
- mUseTextureCoords = rhs.mUseTextureCoords;
- mUseNormals = rhs.mUseNormals;
- mUseColor = rhs.mUseColor;
- mBones = rhs.mBones;
- mMaterial = rhs.mMaterial;
- mMin = rhs.mMin;
- mMax = rhs.mMax;
-
- return *this;
-}
-
-MeshData::~MeshData()
-{
-}
-
-void MeshData::SetData(
- const VertexContainer& vertices,
- const FaceIndices& faceIndices,
- const BoneContainer& bones,
- Material material )
-{
- DALI_ASSERT_ALWAYS( !vertices.empty() && "VertexContainer is empty" );
- DALI_ASSERT_ALWAYS( !faceIndices.empty() && "FaceIndices is empty" );
- DALI_ASSERT_ALWAYS( material && "Material handle is empty" );
-
- mGeometryType = TRIANGLES;
- mVertices = vertices;
- mFaces = faceIndices;
- mMaterial = material;
- mBones = bones;
-}
-
-void MeshData::SetLineData(
- const VertexContainer& vertices,
- const FaceIndices& lineIndices,
- Material material )
-{
- DALI_ASSERT_ALWAYS( !vertices.empty() && "VertexContainer is empty" );
- DALI_ASSERT_ALWAYS( !lineIndices.empty() && "FaceIndices is empty" );
- DALI_ASSERT_ALWAYS( material && "Material handle is empty" );
-
- mGeometryType = LINES;
- mVertices = vertices;
- mFaces = lineIndices;
- mMaterial = material;
-}
-
-void MeshData::SetPointData(
- const VertexContainer& vertices,
- Material material )
-{
- DALI_ASSERT_ALWAYS( !vertices.empty() && "VertexContainer is empty" );
- DALI_ASSERT_ALWAYS( material && "Material handle is empty" );
-
- mGeometryType = POINTS;
- mVertices = vertices;
- mMaterial = material;
-}
-
-void MeshData::SetVertices( const VertexContainer& vertices )
-{
- DALI_ASSERT_ALWAYS( !vertices.empty() && "VertexContainer is empty" );
-
- mVertices = vertices;
-}
-
-void MeshData::SetFaceIndices( const FaceIndices& faceIndices )
-{
- DALI_ASSERT_ALWAYS( !faceIndices.empty() && "FaceIndices is empty" );
-
- mFaces = faceIndices;
-}
-
-void MeshData::AddToBoundingVolume(Vector4& min, Vector4& max, const Dali::Matrix& transform)
-{
- DALI_LOG_TRACE_METHOD(Debug::Filter::gModel);
-
- for (VertexConstIter iter = mVertices.begin(); iter != mVertices.end(); ++iter)
- {
- const Vertex& vertex = *iter;
- Vector4 point = Vector4(vertex.x, vertex.y, vertex.z, 0.0f);
-
- mMin = Min(mMin, point);
- mMax = Max(mMax, point);
- }
- // mMin/mMax are accessed through public API, so have chosen to set w to zero
- // ( They should really be Vector3's )
- mMin.w=0.0f;
- mMax.w=0.0f;
-
- // For the matrix multiplication below to work correctly, the w needs to be 1.
- Vector4 tmpMin(mMin);
- Vector4 tmpMax(mMax);
- tmpMin.w = 1.0f;
- tmpMax.w = 1.0f;
-
- min = Min(min, transform * tmpMin);
- max = Max(max, transform * tmpMax);
-
- // Ensure the bounding volume out parameters also have w=0. (They should also
- // be Vector3's )
- min.w = 0.0f;
- max.w = 0.0f;
-}
-
-MeshData::VertexGeometryType MeshData::GetVertexGeometryType() const
-{
- return mGeometryType;
-}
-
-size_t MeshData::GetVertexCount() const
-{
- return mVertices.size();
-}
-
-const MeshData::VertexContainer& MeshData::GetVertices() const
-{
- return mVertices;
-}
-
-size_t MeshData::GetFaceCount() const
-{
- size_t faceCount = 0;
-
- switch( mGeometryType )
- {
- case POINTS:
- faceCount = mVertices.size();
- break;
- case LINES:
- faceCount = mFaces.size() / 2;
- break;
- case TRIANGLES:
- faceCount = mFaces.size() / 3;
- break;
- }
- return faceCount;
-}
-
-const MeshData::FaceIndices& MeshData::GetFaces() const
-{
- return mFaces;
-}
-
-void MeshData::SetHasTextureCoords(bool hasTexCoords)
-{
- mUseTextureCoords = hasTexCoords;
-}
-
-bool MeshData::HasTextureCoords() const
-{
- return mUseTextureCoords;
-}
-
-void MeshData::SetHasNormals(bool hasNormals)
-{
- mUseNormals = hasNormals;
- if( hasNormals )
- {
- // Enforce mutual exclusivity
- mUseColor = false;
- }
-}
-
-bool MeshData::HasNormals() const
-{
- return mUseNormals;
-}
-
-void MeshData::SetHasColor(bool hasColor)
-{
- mUseColor = hasColor;
- if( hasColor )
- {
- // Enforce mutual exclusivity
- mUseNormals = false;
- }
-}
-
-bool MeshData::HasColor() const
-{
- return mUseColor;
-}
-
-Material MeshData::GetMaterial() const
-{
- return mMaterial;
-}
-
-void MeshData::SetMaterial(Material material)
-{
- mMaterial = material;
-}
-
-size_t MeshData::GetBoneCount() const
-{
- return mBones.size();
-}
-
-bool MeshData::HasBones() const
-{
- return mBones.size() > 0;
-}
-
-const BoneContainer& MeshData::GetBones() const
-{
- return mBones;
-}
-
-const Vector4& MeshData::GetBoundingBoxMin() const
-{
- return mMin;
-}
-
-void MeshData::SetBoundingBoxMin(const Vector4& bounds)
-{
- mMin = bounds;
-}
-
-const Vector4& MeshData::GetBoundingBoxMax() const
-{
- return mMax;
-}
-
-
-void MeshData::SetBoundingBoxMax(const Vector4& bounds)
-{
- mMax = bounds;
-}
-
-} // namespace Dali
-
+++ /dev/null
-#ifndef __DALI_MESH_DATA_H__
-#define __DALI_MESH_DATA_H__
-
-/*
- * Copyright (c) 2015 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-
-// INTERNAL INCLUDES
-#include <dali/public-api/common/dali-common.h>
-#include <dali/public-api/math/vector4.h>
-#include <dali/public-api/modeling/bone.h>
-#include <dali/public-api/modeling/material.h>
-
-
-// DECLARATION FILES
-
-
-namespace Dali
-{
-class Matrix;
-
-/**
- * @brief The MeshData class encompasses all the data required to describe and
- * render a 3D mesh.
- *
- * The mesh can have one of three geometry types: Points, Lines or Triangles.
- * The Point type draws each vertex. The shader can control the point size.
- * The Line type draws single pixel width lines between each specified vertex.
- * The Triangles type draws solid color or texture between each specified
- * vertex.
- *
- * When using the Points or Lines geometry type, normals aren't used.
- *
- * If the HasColor property is set, the vertex color is used to draw the points,
- * lines or triangles, otherwise the material's diffuse color or texture is
- * used. The material's diffuse alpha value is always used.
- *
- * When using the Triangles geometry type, the normals are mutually exclusive
- * with vertex color. This means that shading cannot be performed if vertex
- * color is being used.
- *
- * It is possible to deform the mesh using skeletal deformation. To acheive
- * this, a number of bones can be supplied during creation. These are named
- * actors that can be anywhere in the actor tree. Each bone has an offset
- * matrix. A vertex in the mesh can reference up to 4 bones in the bone
- * container with an associated weighting.
- *
- * When the mesh is added to the scene graph, the node for each named actor is
- * added to an internal container. Each Update frame after the node update pass,
- * the node's world matrix is multiplied by the associated bone's offset matrix.
- * When rendering the mesh, these transform matrices are multiplied by the view
- * matrix, their inverse transforms calculated and passed onto the shaders.
- *
- * The mesh vertex shader then applies up to 4 weighted transforms to each
- * vertex and vertex normal.
- */
-class DALI_IMPORT_API MeshData
-{
-public:
- static const unsigned int MAX_NUMBER_OF_BONES = 12; ///< Maximum number of bones that can affect this mesh.
-
- struct Vertex;
- typedef std::vector<Vertex> VertexContainer; ///< Collection of vertices
- typedef VertexContainer::iterator VertexIter; ///< Iterator for @ref Dali::MeshData::VertexContainer
- typedef VertexContainer::const_iterator VertexConstIter; ///< Const iterator for @ref Dali::MeshData::VertexContainer
-
- typedef unsigned short FaceIndex; ///< index of one point of a polygonal face
- typedef std::vector<FaceIndex> FaceIndices; ///< Collection of FaceIndex items ( The span should match the geometry type: Lines - span is 2; Triangles - span is 3 ).
- typedef FaceIndices::iterator FaceIndexIter; ///< Iterator for @ref Dali::MeshData::FaceIndices
- typedef FaceIndices::const_iterator FaceIndexConstIter; ///< Const iterator for @ref Dali::MeshData::FaceIndices
-
- /**
- * @brief The type of geometry to draw
- */
- enum VertexGeometryType
- {
- POINTS, ///< Draw only points at each vertex
- LINES, ///< Draw lines between specified vertices
- TRIANGLES ///< Draw filled triangles between specified vertices
- };
-
-public: // construction, destruction and initialisation
-
- /**
- * @brief Create a new mesh.
- */
- MeshData( );
-
- /**
- * @brief Copy constructor.
- *
- * @param[in] meshData object to copy
- */
- MeshData( const MeshData& meshData );
-
- /**
- * @brief Assignment operator.
- *
- * @param[in] rhs MeshData object to copy data from
- * @return A reference to this
- */
- MeshData& operator=(const MeshData& rhs);
-
- /**
- * @brief Sets the vertex coords, the face indices, the bones affecting this mesh and a default
- * material.
- *
- * @param[in] vertices The Vertex data (coordinates of each vertex)
- * @param[in] faceIndices The index into the vertices buffer for each corner of each triangular face.
- * @param[in] bones A container of Bones affecting this mesh.
- * @param[in] material A handle to a material object.
- */
- void SetData( const VertexContainer& vertices,
- const FaceIndices& faceIndices,
- const BoneContainer& bones,
- const Material material );
-
- /**
- * @brief Set the vertex coords and end points of each line.
- *
- * @param[in] vertices The vertex data (coords & color of each vertex)
- * @param[in] lineIndices A list of vertex indices for the start & end of each line.
- * @param[in] material A handle to a material object.
- */
- void SetLineData( const VertexContainer& vertices,
- const FaceIndices& lineIndices,
- const Material material );
-
- /**
- * @brief Set the vertex coords for each point.
- *
- * @param[in] vertices The vertex data (coords & color of each vertex)
- * @param[in] material A handle to a material object.
- */
- void SetPointData( const VertexContainer& vertices,
- const Material material );
-
- /**
- * @brief Set the vertex coords for each point.
- *
- * @param[in] vertices The vertex data (coords & color of each vertex)
- */
- void SetVertices( const VertexContainer& vertices );
-
- /**
- * @brief Sets the face indices.
- *
- * @param[in] faceIndices The index into the vertices buffer for each corner of each triangular face.or for the start and end of each line.
- */
- void SetFaceIndices( const FaceIndices& faceIndices );
-
- /**
- * @brief Add the mesh to the bounding volume.
- *
- * Expands a bounding volume to include the mesh
- * @param[in,out] min Lower bounds
- * @param[in,out] max Upper bounds
- * @param[in] transform transform the mesh vertices
- */
- void AddToBoundingVolume(Vector4& min, Vector4& max, const Matrix& transform);
-
- /**
- * @brief Get the geometry type.
- *
- * A mesh defaults to triangles if no data has been set.
- * @return the geometry type;
- */
- VertexGeometryType GetVertexGeometryType() const;
-
- /**
- * @brief Get the number of vertices.
- *
- * @return The number of vertices
- */
- size_t GetVertexCount() const;
-
- /**
- * @brief Get the vertex array.
- *
- * @return The vertex array
- */
- const VertexContainer& GetVertices() const;
-
- /**
- * @brief Get the number of points, lines or faces (note this is not the same as the number of face indices!).
- *
- * depending on the geometry type;
- * @return Number of points, lines or faces
- */
- size_t GetFaceCount() const;
-
- /**
- * @brief Get the face index array.
- *
- * @return The face index array
- */
- const FaceIndices& GetFaces() const;
-
- /**
- * @brief Sets if the mesh has texture coordinates.
- *
- * @param hasTexCoords - True if the mesh has texture coordinates.
- */
- void SetHasTextureCoords(bool hasTexCoords);
-
- /**
- * @brief Checks if the mesh is textured.
- *
- * @return true if the mesh is texture mapped.
- */
- bool HasTextureCoords() const;
-
- /**
- * @brief Sets if the mesh has normals.
- *
- * Mutually exclusive with HasColor. Setting this to true will force the
- * HasColor property to be set to false.
- * @param hasNormals - True if the mesh has normals
- */
- void SetHasNormals(bool hasNormals);
-
- /**
- * @brief Checks if the mesh has normals.
- *
- * @return true if the mesh contains normals.
- */
- bool HasNormals() const;
-
- /**
- * @brief Sets if the mesh vertices have color.
- *
- * Mutually exclusive with HasNormals. Setting this to true will force the
- * HasNormals property to be set to false.
- * @param hasColor - True if the mesh vertices have color.
- */
- void SetHasColor(bool hasColor);
-
- /**
- * @brief Checks if the mesh vertices have color.
- *
- * @return true if the mesh contains colored vertices.
- */
- bool HasColor() const;
-
- /**
- * @brief Get the original material associated with this mesh.
- *
- * @return Handle to the material
- */
- Material GetMaterial() const;
-
- /**
- * @brief Set the default material associated with this mesh.
- */
- void SetMaterial( Material material );
-
- /**
- * @brief Get the number of bones affecting this mesh.
- *
- * @return The number of bones affecting this mesh
- */
- size_t GetBoneCount() const;
-
- /**
- * @brief Does this mesh have bones?.
- *
- * @return true if this mesh has bones.
- */
- bool HasBones() const;
-
- /**
- * @brief Get the bone container.
- *
- * @return the bones
- */
- const BoneContainer& GetBones() const;
-
- /**
- * @brief Get the lower bounds of the bounding box containing the vertices.
- *
- * @return the lower bounds
- */
- const Vector4& GetBoundingBoxMin() const;
-
- /**
- * @brief Set the lower bounds of the bounding box containing the vertices.
- *
- * @param bounds The lower bounds
- */
- void SetBoundingBoxMin(const Vector4& bounds);
-
- /**
- * @brief Get the upper bounds of the bounding box containing the vertices.
- *
- * @return the upper bounds
- */
- const Vector4& GetBoundingBoxMax() const;
-
- /**
- * @brief Set the upper bounds of the bounding box containing the vertices.
- *
- * @param bounds The upper bounds
- */
- void SetBoundingBoxMax(const Vector4& bounds);
-
- /**
- * @brief Destructor.
- */
- ~MeshData();
-
-private:
- VertexContainer mVertices; ///< The vertex data
- FaceIndices mFaces; ///< Indices of triangle faces or line terminators
- VertexGeometryType mGeometryType; ///< The type of geometry to draw
- bool mUseTextureCoords; ///< Whether the vertex data contains texture coords
- bool mUseNormals; ///< Whether the vertex data contains normals
- bool mUseColor; ///< Whether the vertex data contains vertex color
- BoneContainer mBones; ///< Bones for skeletal deformation
-
- Material mMaterial; ///< Material of the mesh
-
- Vector4 mMin; ///< The lower bounds of the bounding box
- Vector4 mMax; ///< The upper bounds of the bounding box
-
-}; // class MeshData
-
-/**
- * @brief A vertex within a mesh, with the corresponding texture coordinate, normal and up to 4 bone influences.
- */
-struct MeshData::Vertex
-{
- static const unsigned int MAX_BONE_INFLUENCE = 4; ///< Maximum number of bones that can influence this particular vertex.
-
- Vertex()
- : x(0.0f), y(0.0f), z(0.0f),
- u(0.0f), v(0.0f),
- nX(0.0f), nY(0.0f), nZ(0.0f)
- {
- }
-
- /**
- * @brief Constructor.
- *
- * @param[in] position The vertex position
- * @param[in] textureCoordinates The texture coordinates
- * @param[in] normal The surface normal
- */
- Vertex( const Vector3& position, const Vector2& textureCoordinates, const Vector3& normal )
- : x(position.x), y(position.y), z(position.z),
- u(textureCoordinates.x), v(textureCoordinates.y),
- nX(normal.x), nY(normal.y), nZ(normal.z)
- {
- }
-
- // Vertices
- float x;
- float y;
- float z;
-
- // Texture coordinates
- float u;
- float v;
-
- // Normals / vertex colours
- union
- {
- float nX;
- float vertexR;
- };
- union
- {
- float nY;
- float vertexG;
- };
- union
- {
- float nZ;
- float vertexB;
- };
-
- /**
- * @brief Bone indices specify which bones have an influence over the vertex (if any).
- */
- unsigned char boneIndices[MAX_BONE_INFLUENCE];
-
- /**
- * @brief Bone weights determine the strength of the influence of each bone.
- */
- float boneWeights[MAX_BONE_INFLUENCE];
-};
-
-} // namespace Dali
-
-#endif // __DALI_MESH_DATA_H__
+++ /dev/null
-/*
- * Copyright (c) 2015 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include "mesh-factory.h"
-
-#include <dali/public-api/geometry/mesh-data.h>
-#include <dali/public-api/modeling/material.h>
-
-namespace Dali
-{
-namespace MeshFactory
-{
-
-Dali::MeshData NewPlane(const float width, const float height, const int xSteps, const int ySteps, const Rect<float>& textureCoordinates)
-{
- DALI_ASSERT_DEBUG( xSteps > 1 && ySteps > 1 );
-
- const int vertexCount = xSteps * ySteps;
-
- // vertices
- MeshData::VertexContainer vertices(vertexCount);
- const float xSpacing = width / ( xSteps - 1 );
- const float ySpacing = height / (ySteps - 1 );
- const float xOffset = -xSpacing * (0.5f * xSteps) + (0.5f * xSpacing); // origin at (width / 2, height / 2)
- const float yOffset = -ySpacing * (0.5f * ySteps) + (0.5f * ySpacing);
- const float xSpacingUV = textureCoordinates.width / (xSteps - 1);
- const float ySpacingUV = textureCoordinates.height / (ySteps - 1);
- int vertexIndex = 0;
- for( int y = 0; y < ySteps; ++y )
- {
- for( int x = 0; x < xSteps; ++x )
- {
- MeshData::Vertex& vertex = vertices[vertexIndex];
- vertex.x = xOffset + (xSpacing * x);
- vertex.y = yOffset + (ySpacing * y);
- vertex.z = 0.0f;
-
- vertex.nX = 0.0f;
- vertex.nY = 0.0f;
- vertex.nZ = 1.0f;
-
- vertex.u = textureCoordinates.x + (xSpacingUV * x);
- vertex.v = textureCoordinates.y + (ySpacingUV * y);
- ++vertexIndex;
- }
- }
-
- // faces
- const int faceCount = 2 * ((ySteps - 1) * (xSteps - 1));
- MeshData::FaceIndices faces( faceCount * 3 );
- unsigned short* pIndex = &(faces)[0];
- unsigned short index0 = 0;
- unsigned short index1 = 0;
- unsigned short index2 = 0;
-
- for( int y = 0; y < ySteps - 1; ++y )
- {
- for( int x = 0; x < xSteps - 1; ++x )
- {
- index0 = (y * xSteps) + x;
- index1 = ((y + 1) * xSteps) + x;
- index2 = ((y + 1) * xSteps) + (x + 1);
- *pIndex++ = index0;
- *pIndex++ = index1;
- *pIndex++ = index2;
-
- index0 = ((y + 1) * xSteps) + (x + 1);
- index1 = (y * xSteps) + (x + 1);
- index2 = (y * xSteps) + x;
- *pIndex++ = index0;
- *pIndex++ = index1;
- *pIndex++ = index2;
- }
- }
-
- BoneContainer bones;
-
- Dali::MeshData meshData;
-
- meshData.SetHasNormals(true);
- meshData.SetHasTextureCoords(true);
- meshData.SetData( vertices, faces, bones, Dali::Material::New("PlaneMat"));
-
- Vector4 vMin;
- Vector4 vMax;
- meshData.AddToBoundingVolume(vMin, vMax, Matrix::IDENTITY);
-
- meshData.SetBoundingBoxMin(vMin);
- meshData.SetBoundingBoxMax(vMax);
-
- return meshData;
-}
-
-Dali::MeshData NewPath( Dali::Path path, const unsigned int resolution )
-{
- MeshData meshData;
- meshData.SetHasNormals(false);
- meshData.SetHasTextureCoords(false);
-
- if( resolution != 0 )
- {
- size_t vertexCount(resolution+1);
- MeshData::VertexContainer vertex(vertexCount);
-
- float sampleDelta = 1.0f/(float)resolution;
- Vector3 tangent;
- for( size_t i(0); i!=vertexCount; ++i )
- {
- //Sample path to get the vertex position
- Vector3* vertexPosition = reinterpret_cast<Vector3*>(&vertex[i].x);
- path.Sample( i*sampleDelta, *vertexPosition, tangent );
- }
-
- //Generate indices. Each vertex is connected to the next
- size_t indexCount(resolution*2);
- MeshData::FaceIndices index(indexCount);
- unsigned int nIndex = 0;
- for( size_t i(0); i!=indexCount; i+=2 )
- {
- index[i] = nIndex;
- index[i+1] = ++nIndex;
- }
-
- meshData.SetLineData(vertex, index, Dali::Material::New("PathMat"));
- }
-
- return meshData;
-}
-
-} // MeshFactory
-} // Dali
+++ /dev/null
-#ifndef __DALI_MESH_FACTORY_H__
-#define __DALI_MESH_FACTORY_H__
-/*
- * Copyright (c) 2015 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include <dali/public-api/math/rect.h>
-#include <dali/public-api/animation/path.h>
-
-namespace Dali
-{
-class MeshData;
-
-namespace MeshFactory
-{
-
-/**
- * @brief Create an initialized plane aligned on the XY axis.
- *
- * @param[in] width The width of the plane
- * @param[in] height The height of the plane
- * @param[in] xSteps The number of vertices along the X axis
- * @param[in] ySteps The number of vertices along the Y axis
- * @param[in] textureCoordinates UV coordinates.
- * @return A mesh data structure containing the plane mesh
- */
-DALI_IMPORT_API Dali::MeshData NewPlane( const float width,
- const float height,
- const int xSteps,
- const int ySteps,
- const Rect<float>& textureCoordinates = Rect<float>(0.0f, 0.0f, 1.0f, 1.0f) );
-
-/**
- * @brief Create a mesh from a given path.
- * The mesh generated will be a set of lines, each one connecting a point sampled from the path to the next sampled point.
- *
- * @param[in] path The path used to generate the mesh
- * @param[in] resolution The number of vertices to generate
- * @return A mesh data structure containing the path mesh
- */
-DALI_IMPORT_API Dali::MeshData NewPath( Dali::Path path, const unsigned int resolution );
-
-} // MeshFactory
-} // Dali
-
-#endif // __DALI_MESH_FACTORY_H__
+++ /dev/null
-/*
- * Copyright (c) 2015 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// CLASS HEADER
-#include <dali/public-api/geometry/mesh.h>
-
-// INTERNAL INCLUDES
-#include <dali/internal/event/modeling/mesh-impl.h>
-#include <dali/internal/event/modeling/material-impl.h>
-#include <dali/public-api/geometry/mesh-factory.h>
-#include <dali/public-api/common/dali-common.h>
-#include <dali/public-api/math/vector3.h>
-
-namespace Dali
-{
-
-namespace
-{
-
-} // namespace
-
-Mesh::Mesh()
-{
-}
-
-Mesh::~Mesh()
-{
-}
-
-Mesh::Mesh(const Mesh& handle)
-: BaseHandle(handle)
-{
-}
-
-Mesh& Mesh::operator=(const Mesh& rhs)
-{
- BaseHandle::operator=(rhs);
- return *this;
-}
-
-Mesh Mesh::New( const MeshData& meshData )
-{
- // Convert material handle to intrusive pointer
- Dali::Material material( meshData.GetMaterial() );
- Internal::MaterialIPtr materialPtr( &GetImplementation( material ) );
-
- Internal::MeshIPtr meshPtr = Internal::Mesh::New( meshData, true /* discardable */, false /* scaling not required */ );
- return Mesh( meshPtr.Get() );
-}
-
-Mesh Mesh::NewPlane(const float width, const float height, const int xSteps, const int ySteps, const Rect<float>& textureCoordinates)
-{
- MeshData meshData( MeshFactory::NewPlane(width, height, xSteps, ySteps, textureCoordinates) );
- return New(meshData);
-}
-
-Mesh Mesh::DownCast( BaseHandle handle )
-{
- return Mesh( dynamic_cast<Dali::Internal::Mesh*>(handle.GetObjectPtr()) );
-}
-
-void Mesh::UpdateMeshData( const MeshData& meshData )
-{
- GetImplementation(*this).UpdateMeshData( meshData );
-}
-
-Mesh::Mesh(Internal::Mesh* internal)
-: BaseHandle(internal)
-{
-}
-
-} // namespace Dali
+++ /dev/null
-#ifndef __DALI_MESH_H__
-#define __DALI_MESH_H__
-
-/*
- * Copyright (c) 2015 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-
-// INTERNAL INCLUDES
-#include <dali/public-api/geometry/mesh-data.h>
-#include <dali/public-api/math/rect.h>
-#include <dali/public-api/object/base-handle.h>
-
-namespace Dali
-{
-
-namespace Internal DALI_INTERNAL
-{
-class Mesh;
-}
-
-/**
- * @brief A Mesh holds a MeshData object supplied by the application writer.
- *
- * It is used to tell the Scene Graph if the mesh data has changed.
- */
-class DALI_IMPORT_API Mesh : public BaseHandle
-{
-public:
-
- /**
- * @brief Create an initialized Mesh.
- *
- * @param[in] meshData The mesh data with which to initialize the handle
- * @return A handle to a newly allocated Dali resource.
- */
- static Mesh New( const MeshData& meshData );
-
- /**
- * @brief Create an uninitialized Mesh; this can be initialized with Mesh::New().
- *
- * Calling member functions with an uninitialized Dali::Object is not allowed.
- */
- Mesh();
-
- /**
- * @brief Destructor
- *
- * This is non-virtual since derived Handle types must not contain data or virtual methods.
- */
- ~Mesh();
-
- /**
- * @brief This copy constructor is required for (smart) pointer semantics.
- *
- * @param [in] handle A reference to the copied handle
- */
- Mesh(const Mesh& handle);
-
- /**
- * @brief This assignment operator is required for (smart) pointer semantics.
- *
- * @param [in] rhs A reference to the copied handle
- * @return A reference to this
- */
- Mesh& operator=(const Mesh& rhs);
-
- /**
- * @brief Create an initialized plane aligned on the XY axis.
- *
- * @param[in] width The width of the plane
- * @param[in] height The height of the plane
- * @param[in] xSteps The number of vertices along the X axis
- * @param[in] ySteps The number of vertices along the Y axis
- * @param[in] textureCoordinates UV coordinates.
- * @return A handle to a newly allocated Dali resource.
- */
- static Mesh NewPlane(const float width,
- const float height,
- const int xSteps,
- const int ySteps,
- const Rect<float>& textureCoordinates = Rect<float>(0.0f, 0.0f, 1.0f, 1.0f));
-
- /**
- * @brief Downcast an Object handle to Mesh handle.
- *
- * If handle points to a Mesh object the downcast produces valid
- * handle. If not the returned handle is left uninitialized.
- *
- * @param[in] handle to An object
- * @return handle to an Mesh object or an uninitialized handle
- */
- static Mesh DownCast( BaseHandle handle );
-
- /**
- * @brief Tell Dali to update it's internal meshes from the changed mesh data.
- *
- * @param[in] meshData
- */
- void UpdateMeshData( const MeshData& meshData );
-
-public: // Not intended for application developers
-
- /**
- * @brief This constructor is used by Dali New() methods.
- *
- * @param [in] mesh A pointer to a newly allocated Dali resource
- */
- explicit DALI_INTERNAL Mesh(Internal::Mesh* mesh);
-};
-
-} // namespace Dali
-
-#endif // __DALI_MESH_H__
+++ /dev/null
-/*
- * Copyright (c) 2015 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// CLASS HEADER
-#include <dali/public-api/images/atlas.h>
-
-// INTERNAL INCLUDES
-#include <dali/internal/event/images/atlas-impl.h>
-#include <dali/internal/event/images/buffer-image-impl.h>
-
-namespace Dali
-{
-
-Atlas Atlas::New( SizeType width,
- SizeType height,
- Pixel::Format pixelFormat,
- bool recoverContext )
-{
- DALI_ASSERT_ALWAYS( 0u != width && "Invalid Atlas width requested" );
- DALI_ASSERT_ALWAYS( 0u != height && "Invalid Atlas height requested" );
-
- return Atlas( Internal::Atlas::New( width, height, pixelFormat, recoverContext ) );
-}
-
-Atlas::Atlas()
-{
-}
-
-void Atlas::Clear( const Vector4& color )
-{
- GetImplementation( *this ).Clear( color );
-}
-
-bool Atlas::Upload( BufferImage bufferImage,
- SizeType xOffset,
- SizeType yOffset )
-{
- return GetImplementation(*this).Upload( GetImplementation(bufferImage), xOffset, yOffset );
-}
-
-bool Atlas::Upload( const std::string& url,
- SizeType xOffset,
- SizeType yOffset )
-{
- return GetImplementation(*this).Upload( url, xOffset, yOffset );
-}
-
-Atlas Atlas::DownCast( BaseHandle handle )
-{
- return Atlas( dynamic_cast<Dali::Internal::Atlas*>(handle.GetObjectPtr()) );
-}
-
-Atlas::~Atlas()
-{
-}
-
-Atlas::Atlas( const Atlas& handle )
-: Image( handle )
-{
-}
-
-Atlas& Atlas::operator=( const Atlas& rhs )
-{
- BaseHandle::operator=(rhs);
- return *this;
-}
-
-Atlas::Atlas( Internal::Atlas* internal )
-: Image( internal )
-{
-}
-
-} // namespace Dali
+++ /dev/null
-#ifndef __DALI_ATLAS_H__
-#define __DALI_ATLAS_H__
-
-/*
- * Copyright (c) 2015 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// EXTERNAL INCLUDES
-#include <stdint.h>
-
-// INTERNAL INCLUDES
-#include <dali/public-api/common/dali-common.h>
-#include <dali/public-api/images/image.h>
-#include <dali/public-api/images/buffer-image.h>
-
-namespace Dali
-{
-
-namespace Internal DALI_INTERNAL
-{
-class Atlas;
-}
-
-/**
- * @brief An Atlas is a large image containing multiple smaller images.
- *
- * Buffer image and resource image( by providing the url ) are supported for uploading.
- * Images must be uploaded at a specified position, to populate the Atlas.
- * The client is responsible for generating the appropriate geometry (UV coordinates) needed to draw images within the Atlas.
- *
- * For context recovery after loss:
- * By default, the atlas will re-upload the resource images automatically,
- * while the buffer images are left to the client to upload again by connecting to the Stage::ContextRegainedSignal().
- * If resource and buffer images are mixed and they overlap inside the atlas, the recovered contents may be incorrect.
- * In these case, switch off the context recovery by calling SetContextRecovery( false ),
- * and upload both buffer images and resource image to the atlas in order to restore the atlas.
- */
-class DALI_IMPORT_API Atlas : public Image
-{
-public:
-
- typedef uint32_t SizeType;
-
-public:
-
- /**
- * @brief Create a new Atlas.
- *
- * @pre width & height are greater than zero.
- * The maximum size of the atlas is limited by GL_MAX_TEXTURE_SIZE.
- * @param [in] width The atlas width in pixels.
- * @param [in] height The atlas height in pixels.
- * @param [in] pixelFormat The pixel format (rgba 32 bit by default).
- * @param [in] recoverContext Whether re-uploading the resource images automatically when regaining the context( true by default )
- * @return A handle to a new Atlas.
- */
- static Atlas New( SizeType width,
- SizeType height,
- Pixel::Format pixelFormat = Pixel::RGBA8888,
- bool recoverContext = true );
-
- /**
- * @brief Create an empty handle.
- *
- * Calling member functions of an empty handle is not allowed.
- */
- Atlas();
-
- /**
- * @brief Clear the Atlas with the given color
- *
- * @note The Atlas does not clear itself automatically during construction.
- * Application should call this clear function to avoid getting garbage pixels in the atlas.
- * By calling Clear, all the current uploaded image information will be lost.
- * @param [in] color The color used to clear the Atlas.
- */
- void Clear( const Vector4& color );
-
- /**
- * @brief Upload a buffer image to the atlas.
- *
- * @pre The pixel format of this buffer image must match the Atlas format.
- * @param [in] bufferImage The buffer image to upload.
- * @param [in] xOffset Specifies an offset in the x direction within the atlas.
- * @param [in] yOffset Specifies an offset in the y direction within the atlas.
- * @return True if the image has compatible pixel format and fits within the atlas at the specified offset.
- */
- bool Upload( BufferImage bufferImage,
- SizeType xOffset,
- SizeType yOffset );
-
- /**
- * @brief Upload a resource image to atlas
- *
- * @param [in] url The URL of the resource image file to use
- * @param [in] xOffset Specifies an offset in the x direction within the atlas.
- * @param [in] yOffset Specifies an offset in the y direction within the atlas.
- * @return True if the image has compatible pixel format and fits within the atlas at the specified offset.
- */
- bool Upload( const std::string& url,
- SizeType xOffset,
- SizeType yOffset );
- /**
- * @brief Downcast an Object handle to Atlas.
- *
- * If handle points to a Atlas the downcast produces valid
- * handle. If not the returned handle is left uninitialized.
- *
- * @param[in] handle to An object
- * @return handle to a Atlas or an empty handle
- */
- static Atlas DownCast( BaseHandle handle );
-
- /**
- * @brief Destructor
- *
- * This is non-virtual since derived Handle types must not contain data or virtual methods.
- */
- ~Atlas();
-
- /**
- * @brief This copy constructor is required for (smart) pointer semantics.
- *
- * @param [in] handle A reference to the copied handle
- */
- Atlas( const Atlas& handle );
-
- /**
- * @brief This assignment operator is required for (smart) pointer semantics.
- *
- * @param [in] rhs A reference to the copied handle
- * @return A reference to this
- */
- Atlas& operator=( const Atlas& rhs);
-
-public: // Not intended for application developers
-
- explicit DALI_INTERNAL Atlas( Internal::Atlas* );
-};
-
-} // namespace Dali
-
-#endif // __DALI_ATLAS_H__
+++ /dev/null
-/*
- * Copyright (c) 2015 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// CLASS HEADER
-#include <dali/public-api/images/distance-field.h>
-
-// EXTERNAL INCLUDES
-#include <algorithm>
-#include <math.h>
-#include <stdio.h>
-#include <time.h>
-
-// INTERNAL INCLUDES
-#include <dali/public-api/common/constants.h>
-#include <dali/public-api/common/vector-wrapper.h>
-#include <dali/public-api/math/vector2.h>
-#include <dali/public-api/math/math-utils.h>
-
-namespace Dali
-{
-
-namespace
-{
-
-float Interpolate( float a, float b, float factor )
-{
- return a * (1.0f - factor) + b * factor;
-}
-
-float Bilinear( float a, float b, float c, float d, float dx, float dy )
-{
- return Interpolate( Interpolate( a, b, dx), Interpolate( c, d, dx ), dy );
-}
-
-void ScaleField( int width, int height, float* in, int targetWidth, int targetHeight, float* out )
-{
- float xScale = static_cast< float >(width) / targetWidth;
- float yScale = static_cast< float >(height) / targetHeight;
-
- // for each row in target
- for(int y = 0; y < targetHeight; ++y)
- {
- const int sampleY = static_cast< int >( yScale * y );
- const int otherY = std::min( sampleY + 1, height - 1 );
- const float dy = (yScale * y ) - sampleY;
-
- // for each column in target
- for (int x = 0; x < targetWidth; ++x)
- {
- const int sampleX = static_cast< int >( xScale * x );
- const int otherX = std::min( sampleX + 1, width - 1 );
- const float dx = (xScale * x) - sampleX;
-
- float value = Bilinear( in[ sampleY * width + sampleX ],
- in[ sampleY * width + otherX ],
- in[ otherY * width + sampleX ],
- in[ otherY * width + otherX ],
- dx, dy );
-
- out[y * targetWidth + x] = std::min( value, 1.0f );
- }
- }
-}
-
-#define SQUARE(a) ((a) * (a))
-const float MAX_DISTANCE( 1e20 );
-
-/**
- * Distance transform of 1D function using squared distance
- */
-void DistanceTransform( float *source, float* dest, unsigned int length )
-{
- int parabolas[length]; // Locations of parabolas in lower envelope
- float edge[length + 1]; // Locations of boundaries between parabolas
- int rightmost(0); // Index of rightmost parabola in lower envelope
-
- parabolas[0] = 0;
- edge[0] = -MAX_DISTANCE;
- edge[1] = +MAX_DISTANCE;
- for( unsigned int i = 1; i <= length - 1; i++ )
- {
- const float initialDistance( source[i] + SQUARE( i ) );
- int parabola = parabolas[rightmost];
- float newDistance( (initialDistance - (source[parabola] + SQUARE( parabola ))) / (2 * i - 2 * parabola) );
- while( rightmost > 0 && newDistance <= edge[rightmost] )
- {
- rightmost--;
- parabola = parabolas[rightmost];
- newDistance = (initialDistance - (source[parabola] + SQUARE( parabola ))) / (2 * i - 2 * parabola);
- }
-
- rightmost++;
- parabolas[rightmost] = i;
- edge[rightmost] = newDistance;
- edge[rightmost + 1] = MAX_DISTANCE;
- }
-
- rightmost = 0;
- for( unsigned int i = 0; i <= length - 1; ++i )
- {
- while( edge[rightmost + 1] < i )
- {
- ++rightmost;
- }
- dest[i] = SQUARE( i - parabolas[rightmost] ) + source[parabolas[rightmost]];
- }
-}
-
-/**
- * Distance transform of 2D function using squared distance
- */
-void DistanceTransform( float* data, unsigned int width, unsigned int height, float* sourceBuffer, float* destBuffer )
-{
- // transform along columns
- for( unsigned int x = 0; x < width; ++x )
- {
- for( unsigned int y = 0; y < height; ++y )
- {
- sourceBuffer[y] = data[ y * width + x ];
- }
-
- DistanceTransform( sourceBuffer, destBuffer, height );
-
- for( unsigned int y = 0; y < height; y++ )
- {
- data[y * width + x] = destBuffer[y];
- }
- }
-
- // transform along rows
- for( unsigned int y = 0; y < height; ++y )
- {
- for( unsigned int x = 0; x < width; ++x )
- {
- sourceBuffer[x] = data[ y * width + x ];
- }
-
- DistanceTransform( sourceBuffer, destBuffer, width );
-
- for( unsigned int x = 0; x < width; x++ )
- {
- data[y * width + x] = destBuffer[x];
- }
- }
-}
-
-} // namespace
-
-void GenerateDistanceFieldMap(const unsigned char* const imagePixels, const Size& imageSize,
- unsigned char* const distanceMap, const Size& distanceMapSize,
- const float fieldRadius, const unsigned int fieldBorder, bool highQuality)
-{
- GenerateDistanceFieldMap( imagePixels, imageSize, distanceMap, distanceMapSize, fieldBorder, imageSize, highQuality );
-}
-
-void GenerateDistanceFieldMap(const unsigned char* const imagePixels, const Size& imageSize,
- unsigned char* const distanceMap, const Size& distanceMapSize,
- const unsigned int fieldBorder,
- const Vector2& maxSize,
- bool highQuality)
-{
- // constants to reduce redundant calculations
- const int originalWidth( static_cast<int>(imageSize.width) );
- const int originalHeight( static_cast<int>(imageSize.height) );
- const int paddedWidth( originalWidth + (fieldBorder * 2 ) );
- const int paddedHeight( originalHeight + (fieldBorder * 2 ) );
- const int scaledWidth( static_cast<int>(distanceMapSize.width) );
- const int scaledHeight( static_cast<int>(distanceMapSize.height) );
- const int maxWidth( static_cast<int>(maxSize.width) + (fieldBorder * 2 ));
- const int maxHeight( static_cast<int>(maxSize.height) + (fieldBorder * 2 ) );
-
- const int bufferLength( std::max( maxWidth, std::max(paddedWidth, scaledWidth) ) *
- std::max( maxHeight, std::max(paddedHeight, scaledHeight) ) );
-
- std::vector<float> outsidePixels( bufferLength, 0.0f );
- std::vector<float> insidePixels( bufferLength, 0.0f );
-
- float* outside( outsidePixels.data() );
- float* inside( insidePixels.data() );
-
- for( int y = 0; y < paddedHeight; ++y )
- {
- for ( int x = 0; x < paddedWidth; ++x)
- {
- if( y < (int)fieldBorder || y >= (paddedHeight - (int)fieldBorder) ||
- x < (int)fieldBorder || x >= (paddedWidth - (int)fieldBorder) )
- {
- outside[ y * paddedWidth + x ] = MAX_DISTANCE;
- inside[ y * paddedWidth + x ] = 0.0f;
- }
- else
- {
- unsigned int pixel( imagePixels[ (y - fieldBorder) * originalWidth + (x - fieldBorder) ] );
- outside[ y * paddedWidth + x ] = (pixel == 0) ? MAX_DISTANCE : SQUARE((255 - pixel) / 255.0f);
- inside[ y * paddedWidth + x ] = (pixel == 255) ? MAX_DISTANCE : SQUARE(pixel / 255.0f);
- }
- }
- }
-
- // perform distance transform if high quality requested, else use original figure
- if( highQuality )
- {
- // create temporary buffers for DistanceTransform()
- const int tempBufferLength( std::max(paddedWidth, paddedHeight) );
- std::vector<float> tempSourceBuffer( tempBufferLength, 0.0f );
- std::vector<float> tempDestBuffer( tempBufferLength, 0.0f );
-
- // Perform distance transform for pixels 'outside' the figure
- DistanceTransform( outside, paddedWidth, paddedHeight, tempSourceBuffer.data(), tempDestBuffer.data() );
-
- // Perform distance transform for pixels 'inside' the figure
- DistanceTransform( inside, paddedWidth, paddedHeight, tempSourceBuffer.data(), tempDestBuffer.data() );
- }
-
- // distmap = outside - inside; % Bipolar distance field
- for( int y = 0; y < paddedHeight; ++y)
- {
- for( int x = 0; x < paddedWidth; ++x )
- {
- const int offset( y * paddedWidth + x );
- float pixel( sqrtf(outside[offset]) - sqrtf(inside[offset]) );
- pixel = 128.0f + pixel * 16.0f;
- pixel = Clamp( pixel, 0.0f, 255.0f );
- outside[offset] = (255.0f - pixel) / 255.0f;
- }
- }
-
- // scale the figure to the distance field tile size
- ScaleField( paddedWidth, paddedHeight, outside, scaledWidth, scaledHeight, inside );
-
- // convert from floats to integers
- for( int y = 0; y < scaledHeight; ++y )
- {
- for( int x = 0; x < scaledWidth; ++x )
- {
- float pixel( inside[ y * scaledWidth + x ] );
- distanceMap[y * scaledWidth + x ] = static_cast< unsigned char >(pixel * 255.0f);
- }
- }
-}
-
-} // namespace Dali
+++ /dev/null
-#ifndef __DALI_DISTANCE_FIELD_H__
-#define __DALI_DISTANCE_FIELD_H__
-
-/*
- * Copyright (c) 2015 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-
-// INTERNAL INCLUDES
-#include <dali/public-api/common/dali-common.h>
-
-namespace Dali
-{
-
-struct Vector2;
-
-/**
- * @brief Generate a distance field map from a source image.
- *
- * @param[in] imagePixels A pointer to a buffer containing the source image
- * @param[in] imageSize The size, width and height, of the source image
- * @param[out] distanceMap A pointer to a buffer to receive the calculated distance field map.
- * Note: This must not overlap with imagePixels for correct distance field map generation.
- * @param[in] distanceMapSize The size, width and height, of the distance field map
- * @param[in] fieldBorder The amount of distance field cells to add around the data (for glow/shadow effects)
- * @param[in] maxSize The image is scaled from this size to distanceMapSize
- * @param[in] highQuality Set true to generate high quality distance fields
- */
-DALI_IMPORT_API void GenerateDistanceFieldMap( const unsigned char* const imagePixels, const Vector2& imageSize,
- unsigned char* const distanceMap, const Vector2& distanceMapSize,
- const unsigned int fieldBorder,
- const Vector2& maxSize,
- bool highQuality = true);
-
-} //namespace Dali
-
-#endif // ifndef __DALI_DISTANCE_FIELD_H__
// INTERNAL INCLUDES
#include <dali/public-api/images/image.h>
-#include <dali/public-api/images/image-operations.h>
+#include <dali/devel-api/images/image-operations.h>
#include <dali/public-api/math/uint-16-pair.h>
namespace Dali
// INTERNAL INCLUDES
#include <dali/public-api/images/image.h>
-#include <dali/public-api/images/native-image-interface.h>
+#include <dali/devel-api/images/native-image-interface.h>
#include <dali/public-api/images/pixel.h>
namespace Dali
+++ /dev/null
-#ifndef __DALI_IMAGE_OPERATIONS_H__
-#define __DALI_IMAGE_OPERATIONS_H__
-
-/*
- * Copyright (c) 2015 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// EXTERNAL INCLUDES
-
-// INTERNAL INCLUDES
-#include <dali/public-api/math/uint-16-pair.h>
-
-namespace Dali
-{
-
-/**
- * @brief The integer dimensions of an image or a region of an image packed into
- * 16 bits per component.
- *
- * This can only be used for images of up to 65535 x 65535 pixels.
- */
-typedef Uint16Pair ImageDimensions;
-
-/**
- * @brief Fitting options, used when resizing images to fit desired dimensions.
- *
- * A fitting mode controls the region of a loaded image to be mapped to the
- * desired image rectangle.
- * All fitting modes preserve the aspect ratio of the image contents.
- */
-namespace FittingMode
-{
- enum Type
- {
- SHRINK_TO_FIT, ///< Fit full image inside desired width & height, potentially not
- /// filling one of either the desired image width or height with
- /// pixels.
- SCALE_TO_FILL, ///< Image fills whole desired width & height with image data. The
- /// image is centred in the desired dimensions, exactly touching
- /// in one dimension, with image regions outside the other desired
- /// dimension cropped away.
- FIT_WIDTH, ///< Image fills whole width. Height is scaled proportionately to
- /// maintain aspect ratio.
- FIT_HEIGHT ///< Image fills whole height. Width is scaled proportionately to
- /// maintain aspect ratio.
- };
- const Type DEFAULT = SHRINK_TO_FIT;
-}
-
-/**
- * @brief Filtering options, used when resizing images to sample original pixels.
- *
- * A SamplingMode controls how pixels in an input image are sampled and
- * combined to generate each pixel of a destination image during a scaling.
- *
- * NoFilter and Box modes do not guarantee that the output pixel array
- * exactly matches the rectangle specified by the desired dimensions and
- * FittingMode, but all other filter modes do if the desired dimensions are
- * `<=` the raw dimensions of the input image file.
- */
-namespace SamplingMode
-{
- enum Type
- {
- BOX, ///< Iteratively box filter to generate an image of 1/2, 1/4,
- /// 1/8, etc width and height and approximately the desired
- /// size. This is the default.
- NEAREST, ///< For each output pixel, read one input pixel.
- LINEAR, ///< For each output pixel, read a quad of four input pixels
- /// and write a weighted average of them.
- BOX_THEN_NEAREST, ///< Iteratively box filter to generate an image of 1/2, 1/4,
- /// 1/8 etc width and height and approximately the desired
- /// size, then for each output pixel, read one pixel from the
- /// last level of box filtering.
- BOX_THEN_LINEAR, ///< Iteratively box filter to almost the right size, then for
- /// each output pixel, read four pixels from the last level of
- /// box filtering and write their weighted average.
- NO_FILTER, ///< No filtering is performed. If the SCALE_TO_FILL scaling mode
- /// is enabled, the borders of the image may be trimmed to
- /// match the aspect ratio of the desired dimensions.
- DONT_CARE ///< For caching algorithms where a client strongly prefers a
- /// cache-hit to reuse a cached image.
- };
- const Type DEFAULT = BOX;
-}
-
-} // namespace Dali
-
-#endif // __DALI_IMAGE_OPERATIONS_H__
+++ /dev/null
-#ifndef __DALI_INTEGRATION_NATIVE_IMAGE_INTERFACE_H__
-#define __DALI_INTEGRATION_NATIVE_IMAGE_INTERFACE_H__
-
-/*
- * Copyright (c) 2015 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// INTERNAL INCLUDES
-#include <dali/public-api/object/ref-object.h>
-
-namespace Dali
-{
-
-/**
- * @brief Abstract interface to provide platform-specific support for handling image data.
- *
- * For example, an implementation could use EGL extensions, etc.
- */
-class NativeImageInterface : public Dali::RefObject
-{
-public:
-
- /**
- * @brief Create the GL resource for the NativeImage.
- *
- * e.g. For the EglImageKHR extension, this corresponds to calling eglCreateImageKHR()
- * @pre There is a GL context for the current thread.
- * @return false If the initialization fails.
- */
- virtual bool GlExtensionCreate() = 0;
-
- /**
- * @brief Destroy the GL resource for the NativeImage.
- *
- * e.g. For the EglImageKHR extension, this corresponds to calling eglDestroyImageKHR()
- * @pre There is a GL context for the current thread.
- */
- virtual void GlExtensionDestroy() = 0;
-
- /**
- * @brief Use the NativeImage as a texture for rendering.
- *
- * @pre There is a GL context for the current thread.
- * @return A GL error code
- */
- virtual unsigned int TargetTexture() = 0;
-
- /**
- * @brief Called in each NativeTexture::Bind() call to allow implementation specific operations.
- *
- * The correct texture sampler has already been bound before the function gets called.
- * @pre glAbstraction is being used by context in current thread
- */
- virtual void PrepareTexture() = 0;
-
- /**
- * @brief Returns the width of the NativeImage.
- *
- * @return width
- */
- virtual unsigned int GetWidth() const = 0;
-
- /**
- * @brief Returns the height of the NativeImage.
- *
- * @return height
- */
- virtual unsigned int GetHeight() const = 0;
-
- /**
- * Query whether blending is required
- */
- virtual bool RequiresBlending() const = 0;
-
-protected:
-
- /**
- * @brief A reference counted object may only be deleted by calling Unreference().
- *
- * The implementation should destroy the NativeImage resources.
- */
- virtual ~NativeImageInterface()
- {
- }
-
-};
-
-/**
- * @brief Pointer to Dali::NativeImageInterface
- */
-typedef IntrusivePtr<NativeImageInterface> NativeImageInterfacePtr;
-
-} // namespace Dali
-
-#endif // __DALI_INTEGRATION_NATIVE_IMAGE_INTERFACE_H__
// INTERNAL INCLUDES
#include <dali/public-api/images/image.h>
-#include <dali/public-api/images/native-image-interface.h>
+#include <dali/devel-api/images/native-image-interface.h>
namespace Dali
{
#include <dali/public-api/common/loading-state.h>
#include <dali/public-api/images/image.h>
#include <dali/public-api/signals/dali-signal.h>
-#include <dali/public-api/images/image-operations.h>
+#include <dali/devel-api/images/image-operations.h>
namespace Dali
{
+++ /dev/null
-/*
- * Copyright (c) 2015 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// CLASS HEADER
-#include <dali/public-api/modeling/bone.h>
-
-namespace Dali
-{
-
-Bone::Bone ()
-{
-}
-
-Bone::Bone( const std::string& name, const Matrix& offsetMatrix )
-: mName( name ),
- mOffsetMatrix( offsetMatrix )
-{
-}
-
-Bone::~Bone()
-{
-}
-
-Bone::Bone( const Bone& rhs )
-: mName(rhs.mName),
- mOffsetMatrix(rhs.mOffsetMatrix)
-{
-}
-
-Bone& Bone::operator=(const Bone& rhs)
-{
- if (this != &rhs)
- {
- mName = rhs.mName;
- mOffsetMatrix = rhs.mOffsetMatrix;
- }
- return *this;
-}
-
-const std::string& Bone::GetName() const
-{
- return mName;
-}
-
-const Matrix& Bone::GetOffsetMatrix() const
-{
- return mOffsetMatrix;
-}
-
-} // namespace Dali
+++ /dev/null
-#ifndef __DALI_BONE_H__
-#define __DALI_BONE_H__
-
-/*
- * Copyright (c) 2015 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// EXTERNAL INCLUDES
-#include <string>
-
-// INTERNAL INCLUDES
-#include <dali/public-api/common/vector-wrapper.h>
-#include <dali/public-api/math/matrix.h>
-
-namespace Dali
-{
-
-class Matrix;
-
-class Bone;
-typedef std::vector< Bone > BoneContainer; ///< Container for bones
-typedef BoneContainer::iterator BoneIter; ///< @ref Dali::BoneContainer iterator
-typedef BoneContainer::const_iterator BoneConstIter; ///< @ref Dali::BoneContainer const iterator
-
-/**
- * @brief A single bone in a mesh.
- *
- * A Bone is a named actor that can be used to deform a mesh. @see Dali::MeshData for more
- * information.
- */
-class DALI_IMPORT_API Bone
-{
-public:
- /**
- * @brief Default constructor.
- */
- Bone ();
-
- /**
- * @brief Constructor.
- *
- * @param name of the bone
- * @param offsetMatrix for the bone
- */
- Bone( const std::string& name, const Matrix& offsetMatrix );
-
- /**
- * @brief Destructor.
- */
- ~Bone();
-
- /**
- * @brief Copy constructor.
- */
- Bone( const Bone& rhs );
-
- /**
- * @brief Assignment operator.
- */
- Bone& operator=(const Bone& rhs);
-
- /**
- * @brief Get name.
- *
- * @return returns the name of the bone
- */
- const std::string& GetName() const;
-
- /**
- * @brief Get offset matrix.
- *
- * @return returns the offset matrix for this bone
- */
- const Matrix& GetOffsetMatrix() const;
-
-private:
- // Attributes
- std::string mName; ///< Name of bone
- Matrix mOffsetMatrix; ///< Transform from mesh space to bone space in bind pose.
-
-}; // struct Bone
-
-} // namespace Dali
-
-#endif // __DALI_BONE_H__
+++ /dev/null
-/*
- * Copyright (c) 2015 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// CLASS HEADER
-#include <dali/public-api/modeling/material.h>
-
-// INTERNAL INCLUDES
-#include <dali/internal/event/modeling/material-impl.h>
-
-namespace Dali
-{
-
-const float Material::DEFAULT_OPACITY = 1.0f;
-const float Material::DEFAULT_SHININESS = 0.5f;
-const Vector4 Material::DEFAULT_AMBIENT_COLOR(0.2f, 0.2f, 0.2f, 1.0f);
-const Vector4 Material::DEFAULT_DIFFUSE_COLOR (0.8f, 0.8f, 0.8f, 1.0f);
-const Vector4 Material::DEFAULT_SPECULAR_COLOR(0.0f, 0.0f, 0.0f, 1.0f);
-const Vector4 Material::DEFAULT_EMISSIVE_COLOR(0.0f, 0.0f, 0.0f, 1.0f);
-const Material::MappingMode Material::DEFAULT_MAPPING_MODE = Material::MAPPING_MODE_WRAP;
-const size_t Material::DEFAULT_DIFFUSE_UV_INDEX = 0;
-const size_t Material::DEFAULT_OPACITY_UV_INDEX = 0;
-const size_t Material::DEFAULT_NORMAL_UV_INDEX = 0;
-const bool Material::DEFAULT_HAS_HEIGHT_MAP = false;
-
-
-Material Material::New(const std::string& name)
-{
- Internal::Material* internal = Internal::Material::New(name);
-
- return Material(internal);
-}
-
-Material Material::DownCast( BaseHandle handle )
-{
- return Material( dynamic_cast<Dali::Internal::Material*>(handle.GetObjectPtr()) );
-}
-
-Material::Material(Internal::Material* internal)
-: BaseHandle(internal)
-{
-}
-
-Material::Material()
-{
-}
-
-Material::~Material()
-{
-}
-
-Material::Material(const Material& handle)
-: BaseHandle(handle)
-{
-}
-
-Material& Material::operator=(const Material& rhs)
-{
- BaseHandle::operator=(rhs);
- return *this;
-}
-
-void Material::SetName(const std::string& name)
-{
- GetImplementation(*this).SetName(name);
-}
-
-const std::string& Material::GetName() const
-{
- return GetImplementation(*this).GetName();
-}
-
-void Material::SetOpacity(const float opacity)
-{
- GetImplementation(*this).SetOpacity(opacity);
-}
-
-float Material::GetOpacity() const
-{
- return GetImplementation(*this).GetOpacity();
-}
-
-void Material::SetShininess(const float shininess)
-{
- GetImplementation(*this).SetShininess(shininess);
-}
-
-float Material::GetShininess() const
-{
- return GetImplementation(*this).GetShininess();
-}
-
-void Material::SetAmbientColor(const Vector4& color)
-{
- GetImplementation(*this).SetAmbientColor(color);
-}
-
-const Vector4& Material::GetAmbientColor() const
-{
- return GetImplementation(*this).GetAmbientColor();
-}
-
-void Material::SetDiffuseColor(const Vector4& color)
-{
- GetImplementation(*this).SetDiffuseColor(color);
-}
-
-const Vector4& Material::GetDiffuseColor() const
-{
- return GetImplementation(*this).GetDiffuseColor();
-}
-
-void Material::SetSpecularColor(const Vector4& color)
-{
- GetImplementation(*this).SetSpecularColor(color);
-}
-
-const Vector4& Material::GetSpecularColor() const
-{
- return GetImplementation(*this).GetSpecularColor();
-}
-
-void Material::SetEmissiveColor(const Vector4& color)
-{
- GetImplementation(*this).SetEmissiveColor(color);
-}
-
-const Vector4& Material::GetEmissiveColor() const
-{
- return GetImplementation(*this).GetEmissiveColor();
-}
-
-void Material::SetDiffuseTexture(Image image)
-{
- GetImplementation(*this).SetDiffuseTexture(image);
-}
-
-Image Material::GetDiffuseTexture() const
-{
- return GetImplementation(*this).GetDiffuseTexture();
-}
-
-void Material::SetOpacityTexture(Image image)
-{
- GetImplementation(*this).SetOpacityTexture(image);
-}
-
-Image Material::GetOpacityTexture() const
-{
- return GetImplementation(*this).GetOpacityTexture();
-}
-
-void Material::SetNormalMap(Image image)
-{
- GetImplementation(*this).SetNormalMap(image);
-}
-
-Image Material::GetNormalMap() const
-{
- return GetImplementation(*this).GetNormalMap();
-}
-
-void Material::SetMapU(const unsigned int map)
-{
- GetImplementation(*this).SetMapU(map);
-}
-
-unsigned int Material::GetMapU() const
-{
- return GetImplementation(*this).GetMapU();
-}
-
-void Material::SetMapV(const unsigned int map)
-{
- GetImplementation(*this).SetMapV(map);
-}
-
-unsigned int Material::GetMapV() const
-{
- return GetImplementation(*this).GetMapV();
-}
-
-void Material::SetDiffuseUVIndex(const int index)
-{
- GetImplementation(*this).SetDiffuseUVIndex(index);
-}
-
-unsigned int Material::GetDiffuseUVIndex() const
-{
- return GetImplementation(*this).GetDiffuseUVIndex();
-}
-
-void Material::SetOpacityUVIndex(const int index)
-{
- GetImplementation(*this).SetOpacityUVIndex(index);
-}
-
-unsigned int Material::GetOpacityUVIndex() const
-{
- return GetImplementation(*this).GetOpacityUVIndex();
-}
-
-void Material::SetNormalUVIndex(const int index)
-{
- GetImplementation(*this).SetNormalUVIndex(index);
-}
-
-unsigned int Material::GetNormalUVIndex() const
-{
- return GetImplementation(*this).GetNormalUVIndex();
-}
-
-void Material::SetHasHeightMap(const bool flag)
-{
- GetImplementation(*this).SetHasHeightMap(flag);
-}
-
-bool Material::GetHasHeightMap() const
-{
- return GetImplementation(*this).GetHasHeightMap();
-}
-
-
-void Material::SetDiffuseTextureFileName(const std::string filename)
-{
- GetImplementation(*this).SetDiffuseTextureFileName(filename);
-}
-const std::string& Material::GetDiffuseFileName() const
-{
- return GetImplementation(*this).GetDiffuseTextureFileName();
-}
-void Material::SetOpacityTextureFileName(const std::string filename)
-{
- GetImplementation(*this).SetOpacityTextureFileName(filename);
-}
-const std::string& Material::GetOpacityTextureFileName() const
-{
- return GetImplementation(*this).GetOpacityTextureFileName();
-}
-void Material::SetNormalMapFileName(const std::string filename)
-{
- GetImplementation(*this).SetNormalMapFileName(filename);
-}
-const std::string& Material::GetNormalMapFileName() const
-{
- return GetImplementation(*this).GetNormalMapFileName();
-}
-
-} // namespace Dali
+++ /dev/null
-#ifndef __DALI_MATERIAL_H__
-#define __DALI_MATERIAL_H__
-
-/*
- * Copyright (c) 2015 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// INTERNAL INCLUDES
-#include <dali/public-api/images/image.h>
-#include <dali/public-api/common/constants.h>
-
-namespace Dali
-{
-
-struct Vector4;
-
-namespace Internal DALI_INTERNAL
-{
-class Material;
-}
-
-
-class Material;
-typedef std::vector<Material> MaterialContainer; ///< Container for Dali::Material
-typedef MaterialContainer::iterator MaterialIter; ///< Iterator for Dali::MaterialContainer
-typedef MaterialContainer::const_iterator MaterialConstIter; ///< Const iterator for Dali::MaterialContainer
-
-/**
- * @brief Encapsulates the data describing a material.
- *
- * Color, opacity, shininess, shading mode, texture/normal/height mapping...
- */
-class DALI_IMPORT_API Material : public BaseHandle
-{
-public:
- /**
- * @brief How the material's texture is sampled outside the range 0..1
- */
- enum MappingMode
- {
- MAPPING_MODE_WRAP = 0x0, ///< A texture coordinate u|v is translated to u%1|v%1
- MAPPING_MODE_CLAMP = 0x1, ///< Texture coordinates outside [0...1] are clamped to the nearest valid value
- MAPPING_MODE_MIRROR = 0x2, ///< A texture coordinate u|v becomes u%1|v%1 if (u-(u%1))%2 is zero and 1-(u%1)|1-(v%1) otherwise
- MAPPING_MODE_DECAL = 0x3, ///< If the texture coordinates for a pixel are outside [0...1] the texture is not applied to that pixel
- };
-
- static const float DEFAULT_OPACITY; ///< 1.0f
- static const float DEFAULT_SHININESS; ///< 0.5f
- static const Vector4 DEFAULT_AMBIENT_COLOR; ///< (0.2f, 0.2f, 0.2f, 1.0f)
- static const Vector4 DEFAULT_DIFFUSE_COLOR; ///< (0.8f, 0.8f, 0.8f, 1.0f)
- static const Vector4 DEFAULT_SPECULAR_COLOR; ///< (0.0f, 0.0f, 0.0f, 1.0f)
- static const Vector4 DEFAULT_EMISSIVE_COLOR; ///< (0.0f, 0.0f, 0.0f, 1.0f)
- static const MappingMode DEFAULT_MAPPING_MODE; ///< Material::MAPPING_MODE_WRAP
- static const size_t DEFAULT_DIFFUSE_UV_INDEX; ///< 0
- static const size_t DEFAULT_OPACITY_UV_INDEX; ///< 0
- static const size_t DEFAULT_NORMAL_UV_INDEX; ///< 0
- static const bool DEFAULT_HAS_HEIGHT_MAP; ///< false
-
- /**
- * @brief Create an initialized Material.
- *
- * @param[in] name The material's name
- * @return A handle to a newly allocated Dali resource.
- */
- static Material New(const std::string& name);
-
- /**
- * @brief Downcast an Object handle to Material handle.
- *
- * If handle points to a Material object the
- * downcast produces valid handle. If not the returned handle is left uninitialized.
- * @param[in] handle to An object
- * @return handle to a Material object or an uninitialized handle
- */
- static Material DownCast( BaseHandle handle );
-
- /**
- * @brief Create an uninitialized material; this can be initialized with Material::New().
- *
- * Calling member functions with an uninitialized Dali::Object is not allowed.
- */
- Material();
-
- /**
- * @brief Destructor
- *
- * This is non-virtual since derived Handle types must not contain data or virtual methods.
- */
- ~Material();
-
- /**
- * @brief This copy constructor is required for (smart) pointer semantics.
- *
- * @param [in] handle A reference to the copied handle
- */
- Material(const Material& handle);
-
- /**
- * @brief This assignment operator is required for (smart) pointer semantics.
- *
- * @param [in] rhs A reference to the copied handle
- * @return A reference to this
- */
- Material& operator=(const Material& rhs);
-
- /**
- * @brief Set the material's name.
- *
- * @param[in] name The material's name
- */
- void SetName(const std::string& name);
-
- /**
- * @brief Get the material's name.
- */
- const std::string& GetName() const;
-
- /**
- * @brief Set the material's opacity.
- *
- * @param[in] opacity The new opacity value
- */
- void SetOpacity(const float opacity);
-
- /**
- * @brief Get the material's opacity.
- *
- * @return The opacity.
- */
- float GetOpacity() const;
-
- /**
- * @brief Set the material's shininess (used for specular highlighting).
- *
- * @param[in] shininess The new shininess value
- */
- void SetShininess(const float shininess);
-
- /**
- * @brief Get the material's shininess.
- *
- * @return The shininess.
- */
- float GetShininess() const;
-
- /**
- * @brief Set the material's ambient color.
- *
- * @param[in] color The new color value
- */
- void SetAmbientColor(const Vector4& color);
-
- /**
- * @brief Get the material's ambient color.
- *
- * @return The color value
- */
- const Vector4& GetAmbientColor() const;
-
- /**
- * @brief Set the material's diffuse color.
- *
- * @param[in] color The new color value
- */
- void SetDiffuseColor(const Vector4& color);
-
- /**
- * @brief Get the material's diffuse color.
- *
- * @return The color value
- */
- const Vector4& GetDiffuseColor() const;
-
- /**
- * @brief Set the material's specular color.
- *
- * @param[in] color The new color value
- */
- void SetSpecularColor(const Vector4& color);
-
- /**
- * @brief Get the material's specular color.
- *
- * @return The color value
- */
- const Vector4& GetSpecularColor() const;
-
- /**
- * @brief Set the material's emissive color.
- *
- * @param[in] color The new color value
- */
- void SetEmissiveColor(const Vector4& color);
-
- /**
- * @brief Get the material's emissive color.
- *
- * @return The color value
- */
- const Vector4& GetEmissiveColor() const;
-
- /**
- * @brief Set the diffuse texture image.
- *
- * @param[in] image The new texture image
- */
- void SetDiffuseTexture(Image image);
-
- /**
- * @brief Set the diffuse texture image.
- *
- * @param[in] filename The name of the image file
- */
- void SetDiffuseTextureFileName(const std::string filename);
-
- /**
- * @brief Get the diffuse texture image.
- *
- * @return The texture image
- */
- Image GetDiffuseTexture() const;
-
- /**
- * @brief Get the diffuse texture image filename.
- *
- * @return the filename
- */
- const std::string& GetDiffuseFileName() const;
-
- /**
- * @brief Set the opacity texture image.
- *
- * @param[in] image The new texture image
- */
- void SetOpacityTexture(Image image);
-
- /**
- * @brief Set the opacity texture image.
- *
- * @param[in] filename The opacity texture image filename
- */
- void SetOpacityTextureFileName(const std::string filename);
-
- /**
- * @brief Get the opacity texture image.
- *
- * @return The texture image
- */
- Image GetOpacityTexture() const;
-
- /**
- * @brief Get the opacity texture image filename.
- *
- * @return The texture image's filename
- */
- const std::string& GetOpacityTextureFileName() const;
-
-
- /**
- * @brief Set the normal/height map texture image.
- *
- * @param[in] image The new texture image
- */
- void SetNormalMap(Image image);
-
- /**
- * @brief Set the normal/height map texture image filename.
- *
- * @param[in] filename The new texture image filename
- */
- void SetNormalMapFileName(const std::string filename);
-
- /**
- * @brief Get the normal/height map texture image.
- *
- * @return The texture image
- */
- Image GetNormalMap() const;
-
- /**
- * @brief Get the normal/height map texture image filename.
- *
- * @return The texture image filename
- */
- const std::string& GetNormalMapFileName() const;
-
- /**
- * @brief Set the U mapping mode.
- *
- * @param[in] map The mapping mode
- */
- void SetMapU(const unsigned int map);
-
- /**
- * @brief Get the U mapping mode.
- *
- * @return The mapping mode
- */
- unsigned int GetMapU() const;
-
- /**
- * @brief Set the V mapping mode.
- *
- * @param[in] map The mapping mode
- */
- void SetMapV(const unsigned int map);
-
- /**
- * @brief Get the U mapping mode.
- *
- * @return The mapping mode
- */
- unsigned int GetMapV() const;
-
- /**
- * @brief Set the index into the bound mesh's array of UV's for the diffuse texture coordinates.
- *
- * @param[in] index The diffuse uv index
- */
- void SetDiffuseUVIndex(const int index);
-
- /**
- * @brief Get the index into the bound mesh's array of UV's for the diffuse texture coordinates.
- *
- * @return The uv index
- */
- unsigned int GetDiffuseUVIndex() const;
-
- /**
- * @brief Set the index into the bound mesh's array of UV's for the opacity texture coordinates.
- *
- * @param[in] index The opacity uv index
- */
- void SetOpacityUVIndex(const int index);
-
- /**
- * @brief Get the index into the bound mesh's array of UV's for the opacity texture coordinates.
- *
- * @return The uv index
- */
- unsigned int GetOpacityUVIndex() const;
-
- /**
- * @brief Set the index into the bound mesh's array of UV's for the normal/height map texture coordinates.
- *
- * @param[in] index The normal/height map uv index
- */
- void SetNormalUVIndex(const int index);
-
- /**
- * @brief Get the index into the bound mesh's array of UV's for the normal/height map texture coordinates.
- *
- * @return The uv index
- */
- unsigned int GetNormalUVIndex() const;
-
- /**
- * @brief Set whether the normal texture contains a normal or height map.
- *
- * @param[in] flag true if the normal map contains a height map
- */
- void SetHasHeightMap(const bool flag);
-
- /**
- * @brief Get whether the normal texture contains a normal or height map.
- *
- * @return true if the normal map contains a height map, false otherwise
- */
- bool GetHasHeightMap() const;
-
-public: // Not intended for application developers
-
- /**
- * @brief This constructor is used by Dali New() methods.
- *
- * @param [in] material A pointer to an internal material resource
- */
- explicit DALI_INTERNAL Material(Internal::Material* material);
-}; // class Material
-
-} // namespace Dali
-
-#endif // __DALI_MATERIAL_H__
+++ /dev/null
-#ifndef __DALI_TYPE_REGISTRY_HELPER_H__
-#define __DALI_TYPE_REGISTRY_HELPER_H__
-
-/*
- * Copyright (c) 2015 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// INTERNAL INCLUDES
-#include <dali/public-api/common/compile-time-assert.h>
-#include <dali/public-api/object/type-registry.h>
-
-namespace Dali
-{
-
-namespace Internal
-{
-
-/**
- * @brief These macros are used to use the type-registry to register properties and signals.
- * This forces registration to be done in a standard way across actors and controls and facilitates future compile-time checks to be added.
- *
- * Note: Currently a compile time check is done for the order of the properties. The order is not critical to registration, but helps maintain the ordering between the header and implementations to avoid properties being added out of place.
- *
- * Note: The signal macro also generates string const chars.
- */
-#define DALI_TOKEN_PASTE_EXPAND( x, y ) x ## y
-#define DALI_TOKEN_PASTE( x, y ) DALI_TOKEN_PASTE_EXPAND(x, y)
-
-#define DALI_PROPERTY_REGISTRATION_INTERNAL( count, typeRegistrationObject, objectNamespace, objectType, text, valueType, enumIndex ) \
- PropertyRegistration DALI_TOKEN_PASTE( property, count ) ( typeRegistrationObject, text, objectNamespace::objectType::Property::enumIndex, Property::valueType, &objectType::SetProperty, &objectType::GetProperty ); \
- DALI_COMPILE_TIME_ASSERT( ( objectNamespace::objectType::Property::enumIndex - objectNamespace::objectType::PROPERTY_START_INDEX ) == count );
-
-#define DALI_ANIMATABLE_PROPERTY_REGISTRATION_INTERNAL( count, typeRegistrationObject, objectNamespace, objectType, text, valueType, enumIndex) \
- AnimatablePropertyRegistration DALI_TOKEN_PASTE( property, count ) ( typeRegistrationObject, text, objectNamespace::objectType::Property::enumIndex, Property::valueType );
-
-#define DALI_ANIMATABLE_PROPERTY_COMPONENT_REGISTRATION_INTERNAL( count, typeRegistrationObject, objectNamespace, objectType, text, enumIndex, baseEnumIndex, componentIndex) \
- AnimatablePropertyComponentRegistration DALI_TOKEN_PASTE( property, count ) ( typeRegistrationObject, text, objectNamespace::objectType::Property::enumIndex, objectNamespace::objectType::Property::baseEnumIndex, componentIndex );
-
-#define DALI_SIGNAL_REGISTRATION_INTERNAL( count, typeRegistrationObject, objectNamespace, objectType, text, textVariable ) \
- const char* const textVariable = text; \
- SignalConnectorType DALI_TOKEN_PASTE( signalConnector, count ) ( typeRegistrationObject, text, &objectNamespace::Internal::objectType::DoConnectSignal );
-
-#define DALI_ACTION_REGISTRATION_INTERNAL( count, typeRegistrationObject, objectNamespace, objectType, text, textVariable ) \
- const char* const textVariable = text; \
- TypeAction DALI_TOKEN_PASTE( signalConnector, count ) ( typeRegistrationObject, text, &objectNamespace::Internal::objectType::DoAction );
-
-// For use within implementations:
-
-#define DALI_TYPE_REGISTRATION_BEGIN( thisType, baseType, createFunction ) \
- TypeRegistration typeRegistration( typeid( thisType ), typeid( baseType ), createFunction );
-
-#define DALI_TYPE_REGISTRATION_BEGIN_CREATE( thisType, baseType, createFunction, createAtStartup ) \
- TypeRegistration typeRegistration( typeid( thisType ), typeid( baseType ), createFunction, createAtStartup );
-
-#define DALI_PROPERTY_REGISTRATION( objectNamespace, objectType, text, valueType, enumIndex ) \
- DALI_PROPERTY_REGISTRATION_INTERNAL( __COUNTER__, typeRegistration, objectNamespace, objectType, text, valueType, enumIndex )
-
-#define DALI_ANIMATABLE_PROPERTY_REGISTRATION( objectNamespace, objectType, text, valueType, enumIndex ) \
- DALI_ANIMATABLE_PROPERTY_REGISTRATION_INTERNAL( __COUNTER__, typeRegistration, objectNamespace, objectType, text, valueType, enumIndex )
-
-#define DALI_ANIMATABLE_PROPERTY_COMPONENT_REGISTRATION( objectNamespace, objectType, text, enumIndex, baseEnumIndex, componentIndex ) \
- DALI_ANIMATABLE_PROPERTY_COMPONENT_REGISTRATION_INTERNAL( __COUNTER__, typeRegistration, objectNamespace, objectType, text, enumIndex, baseEnumIndex, componentIndex )
-
-#define DALI_SIGNAL_REGISTRATION( objectNamespace, objectType, text, textVariable ) \
- DALI_SIGNAL_REGISTRATION_INTERNAL( __COUNTER__, typeRegistration, objectNamespace, objectType, text, textVariable )
-
-#define DALI_ACTION_REGISTRATION( objectNamespace, objectType, text, textVariable ) \
- DALI_ACTION_REGISTRATION_INTERNAL( __COUNTER__, typeRegistration, objectNamespace, objectType, text, textVariable )
-
-#define DALI_TYPE_REGISTRATION_END( ) // Empty for now, can be used to perform checks.
-
-
-} // namespace Internal
-
-} // namespace Dali
-
-#endif // __DALI_TYPE_REGISTRY_HELPER_H__
+++ /dev/null
-/*
- * Copyright (c) 2015 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// CLASS HEADER
-#include <dali/public-api/scripting/scripting.h>
-
-// INTERNAL INCLUDES
-#include <dali/public-api/actors/actor.h>
-#include <dali/public-api/images/resource-image.h>
-#include <dali/public-api/object/type-registry.h>
-#include <dali/public-api/object/property-array.h>
-#include <dali/internal/common/image-attributes.h>
-#include <dali/internal/event/images/resource-image-impl.h>
-#include <dali/internal/event/images/frame-buffer-image-impl.h>
-#include <dali/internal/event/images/buffer-image-impl.h>
-#include <dali/internal/event/effects/shader-effect-impl.h>
-
-namespace Dali
-{
-
-namespace Scripting
-{
-
-namespace
-{
-
-// Tables used here for converting strings to the enumerations and vice versa
-
-const StringEnum< ColorMode > COLOR_MODE_TABLE[] =
-{
- { "USE_OWN_COLOR", USE_OWN_COLOR },
- { "USE_PARENT_COLOR", USE_PARENT_COLOR },
- { "USE_OWN_MULTIPLY_PARENT_COLOR", USE_OWN_MULTIPLY_PARENT_COLOR },
- { "USE_OWN_MULTIPLY_PARENT_ALPHA", USE_OWN_MULTIPLY_PARENT_ALPHA },
-};
-const unsigned int COLOR_MODE_TABLE_COUNT = sizeof( COLOR_MODE_TABLE ) / sizeof( COLOR_MODE_TABLE[0] );
-
-const StringEnum< PositionInheritanceMode > POSITION_INHERITANCE_MODE_TABLE[] =
-{
- { "INHERIT_PARENT_POSITION", INHERIT_PARENT_POSITION },
- { "USE_PARENT_POSITION", USE_PARENT_POSITION },
- { "USE_PARENT_POSITION_PLUS_LOCAL_POSITION", USE_PARENT_POSITION_PLUS_LOCAL_POSITION },
- { "DONT_INHERIT_POSITION", DONT_INHERIT_POSITION },
-};
-const unsigned int POSITION_INHERITANCE_MODE_TABLE_COUNT = sizeof( POSITION_INHERITANCE_MODE_TABLE ) / sizeof( POSITION_INHERITANCE_MODE_TABLE[0] );
-
-const StringEnum< DrawMode::Type > DRAW_MODE_TABLE[] =
-{
- { "NORMAL", DrawMode::NORMAL },
- { "OVERLAY", DrawMode::OVERLAY },
- { "STENCIL", DrawMode::STENCIL },
-};
-const unsigned int DRAW_MODE_TABLE_COUNT = sizeof( DRAW_MODE_TABLE ) / sizeof( DRAW_MODE_TABLE[0] );
-
-const StringEnum< Vector3 > ANCHOR_CONSTANT_TABLE[] =
-{
- { "TOP_LEFT", ParentOrigin::TOP_LEFT },
- { "TOP_CENTER", ParentOrigin::TOP_CENTER },
- { "TOP_RIGHT", ParentOrigin::TOP_RIGHT },
- { "CENTER_LEFT", ParentOrigin::CENTER_LEFT },
- { "CENTER", ParentOrigin::CENTER },
- { "CENTER_RIGHT", ParentOrigin::CENTER_RIGHT },
- { "BOTTOM_LEFT", ParentOrigin::BOTTOM_LEFT },
- { "BOTTOM_CENTER", ParentOrigin::BOTTOM_CENTER },
- { "BOTTOM_RIGHT", ParentOrigin::BOTTOM_RIGHT },
-};
-const unsigned int ANCHOR_CONSTANT_TABLE_COUNT = sizeof( ANCHOR_CONSTANT_TABLE ) / sizeof( ANCHOR_CONSTANT_TABLE[0] );
-
-const StringEnum< ResourceImage::LoadPolicy > IMAGE_LOAD_POLICY_TABLE[] =
-{
- { "IMMEDIATE", ResourceImage::IMMEDIATE },
- { "ON_DEMAND", ResourceImage::ON_DEMAND },
-};
-const unsigned int IMAGE_LOAD_POLICY_TABLE_COUNT = sizeof( IMAGE_LOAD_POLICY_TABLE ) / sizeof( IMAGE_LOAD_POLICY_TABLE[0] );
-
-const StringEnum< Image::ReleasePolicy > IMAGE_RELEASE_POLICY_TABLE[] =
-{
- { "UNUSED", Image::UNUSED },
- { "NEVER", Image::NEVER },
-};
-const unsigned int IMAGE_RELEASE_POLICY_TABLE_COUNT = sizeof( IMAGE_RELEASE_POLICY_TABLE ) / sizeof( IMAGE_RELEASE_POLICY_TABLE[0] );
-
-const StringEnum< Pixel::Format > PIXEL_FORMAT_TABLE[] =
-{
- { "A8", Pixel::A8 },
- { "L8", Pixel::L8 },
- { "LA88", Pixel::LA88 },
- { "RGB565", Pixel::RGB565 },
- { "BGR565", Pixel::BGR565 },
- { "RGBA4444", Pixel::RGBA4444 },
- { "BGRA4444", Pixel::BGRA4444 },
- { "RGBA5551", Pixel::RGBA5551 },
- { "BGRA5551", Pixel::BGRA5551 },
- { "RGB888", Pixel::RGB888 },
- { "RGB8888", Pixel::RGB8888 },
- { "BGR8888", Pixel::BGR8888 },
- { "RGBA8888", Pixel::RGBA8888 },
- { "BGRA8888", Pixel::BGRA8888 },
- { "COMPRESSED_R11_EAC", Pixel::COMPRESSED_R11_EAC },
- { "COMPRESSED_SIGNED_R11_EAC", Pixel::COMPRESSED_SIGNED_R11_EAC },
- { "COMPRESSED_SIGNED_RG11_EAC", Pixel::COMPRESSED_SIGNED_RG11_EAC },
- { "COMPRESSED_RG11_EAC", Pixel::COMPRESSED_RG11_EAC },
- { "COMPRESSED_RGB8_ETC2", Pixel::COMPRESSED_RGB8_ETC2 },
- { "COMPRESSED_SRGB8_ETC2", Pixel::COMPRESSED_SRGB8_ETC2 },
- { "COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2", Pixel::COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 },
- { "COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2", Pixel::COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 },
- { "COMPRESSED_RGBA8_ETC2_EAC", Pixel::COMPRESSED_RGBA8_ETC2_EAC },
- { "COMPRESSED_SRGB8_ALPHA8_ETC2_EAC", Pixel::COMPRESSED_SRGB8_ALPHA8_ETC2_EAC },
- { "COMPRESSED_RGB8_ETC1", Pixel::COMPRESSED_RGB8_ETC1 },
- { "COMPRESSED_RGB_PVRTC_4BPPV1", Pixel::COMPRESSED_RGB_PVRTC_4BPPV1 },
-};
-const unsigned int PIXEL_FORMAT_TABLE_COUNT = sizeof( PIXEL_FORMAT_TABLE ) / sizeof( PIXEL_FORMAT_TABLE[0] );
-
-const StringEnum< FittingMode::Type > IMAGE_FITTING_MODE_TABLE[] =
-{
- { "SHRINK_TO_FIT", FittingMode::SHRINK_TO_FIT },
- { "SCALE_TO_FILL", FittingMode::SCALE_TO_FILL },
- { "FIT_WIDTH", FittingMode::FIT_WIDTH },
- { "FIT_HEIGHT", FittingMode::FIT_HEIGHT },
-};
-const unsigned int IMAGE_FITTING_MODE_TABLE_COUNT = sizeof( IMAGE_FITTING_MODE_TABLE ) / sizeof( IMAGE_FITTING_MODE_TABLE[0] );
-
-const StringEnum< SamplingMode::Type > IMAGE_SAMPLING_MODE_TABLE[] =
-{
- { "BOX", SamplingMode::BOX },
- { "NEAREST", SamplingMode::NEAREST },
- { "LINEAR", SamplingMode::LINEAR },
- { "BOX_THEN_NEAREST", SamplingMode::BOX_THEN_NEAREST },
- { "BOX_THEN_LINEAR", SamplingMode::BOX_THEN_LINEAR },
- { "NO_FILTER", SamplingMode::NO_FILTER },
- { "DONT_CARE", SamplingMode::DONT_CARE },
-};
-const unsigned int IMAGE_SAMPLING_MODE_TABLE_COUNT = sizeof( IMAGE_SAMPLING_MODE_TABLE ) / sizeof( IMAGE_SAMPLING_MODE_TABLE[0] );
-
-} // unnamed namespace
-
-bool CompareEnums( const char * a, const char * b )
-{
- while( ( *a != '\0' ) && ( *b != '\0' ) )
- {
- char ca = *a;
- char cb = *b;
-
- if( ( ( ca == '-' ) || ( ca == '_') ) &&
- ( ( cb == '-' ) || ( cb == '_') ) )
- {
- ++a;
- ++b;
- continue;
- }
-
- if( ( 'A' <= ca ) && ( ca <= 'Z') )
- {
- ca = ca + ( 'a' - 'A' );
- }
-
- if( ( 'A' <= cb ) && ( cb <= 'Z') )
- {
- cb = cb + ( 'a' - 'A' );
- }
-
- if( ca != cb )
- {
- return false;
- }
-
- ++a;
- ++b;
- }
-
- if( ( *a == '\0' ) && ( *b == '\0' ) )
- {
- return true;
- }
-
- return false;
-}
-
-
-ColorMode GetColorMode( const std::string& value )
-{
- return GetEnumeration< ColorMode >( value.c_str(), COLOR_MODE_TABLE, COLOR_MODE_TABLE_COUNT );
-}
-
-
-std::string GetColorMode( ColorMode value )
-{
- return GetEnumerationName< ColorMode >( value, COLOR_MODE_TABLE, COLOR_MODE_TABLE_COUNT );
-}
-
-PositionInheritanceMode GetPositionInheritanceMode( const std::string& value )
-{
- return GetEnumeration< PositionInheritanceMode >( value.c_str(), POSITION_INHERITANCE_MODE_TABLE, POSITION_INHERITANCE_MODE_TABLE_COUNT );
-}
-
-
-std::string GetPositionInheritanceMode( PositionInheritanceMode value )
-{
- return GetEnumerationName< PositionInheritanceMode >( value, POSITION_INHERITANCE_MODE_TABLE, POSITION_INHERITANCE_MODE_TABLE_COUNT );
-}
-
-
-DrawMode::Type GetDrawMode( const std::string& value )
-{
- return GetEnumeration< DrawMode::Type >( value.c_str(), DRAW_MODE_TABLE, DRAW_MODE_TABLE_COUNT );
-}
-
-
-std::string GetDrawMode( DrawMode::Type value )
-{
- return GetEnumerationName< DrawMode::Type >( value, DRAW_MODE_TABLE, DRAW_MODE_TABLE_COUNT );
-}
-
-
-Vector3 GetAnchorConstant( const std::string& value )
-{
- return GetEnumeration< Vector3 >( value.c_str(), ANCHOR_CONSTANT_TABLE, ANCHOR_CONSTANT_TABLE_COUNT );
-}
-
-
-Image NewImage( const Property::Value& map )
-{
- Image ret;
-
- std::string filename;
- ResourceImage::LoadPolicy loadPolicy = Dali::Internal::IMAGE_LOAD_POLICY_DEFAULT;
- Image::ReleasePolicy releasePolicy = Dali::Internal::IMAGE_RELEASE_POLICY_DEFAULT;
- Internal::ImageAttributes attributes = Internal::ImageAttributes::New();
-
- if( Property::MAP == map.GetType() )
- {
- std::string field = "filename";
- if( map.HasKey(field) )
- {
- DALI_ASSERT_ALWAYS(map.GetValue(field).GetType() == Property::STRING && "Image filename property is not a string" );
- filename = map.GetValue(field).Get<std::string>();
- }
-
- field = "load-policy";
- if( map.HasKey(field) )
- {
- DALI_ASSERT_ALWAYS(map.GetValue(field).GetType() == Property::STRING && "Image load-policy property is not a string" );
- std::string v(map.GetValue(field).Get<std::string>());
- loadPolicy = GetEnumeration< ResourceImage::LoadPolicy >( v.c_str(), IMAGE_LOAD_POLICY_TABLE, IMAGE_LOAD_POLICY_TABLE_COUNT );
- }
-
- field = "release-policy";
- if( map.HasKey(field) )
- {
- DALI_ASSERT_ALWAYS(map.GetValue(field).GetType() == Property::STRING && "Image release-policy property is not a string" );
- std::string v(map.GetValue(field).Get<std::string>());
- releasePolicy = GetEnumeration< Image::ReleasePolicy >( v.c_str(), IMAGE_RELEASE_POLICY_TABLE, IMAGE_RELEASE_POLICY_TABLE_COUNT );
- }
-
- // Width and height can be set individually. Dali derives the unspecified
- // dimension from the aspect ratio of the raw image.
- unsigned int width = 0, height = 0;
-
- field = "width";
- if( map.HasKey( field ) )
- {
- Property::Value &value = map.GetValue( field );
-
- // handle floats and integer the same for json script
- if( value.GetType() == Property::FLOAT )
- {
- width = static_cast<unsigned int>( value.Get<float>() );
- }
- else
- {
- DALI_ASSERT_ALWAYS( value.GetType() == Property::INTEGER && "Image width property is not a number" );
- width = value.Get<int>();
- }
- }
-
- field = "height";
- if( map.HasKey( field ) )
- {
- Property::Value &value = map.GetValue( field );
- if( value.GetType() == Property::FLOAT )
- {
- height = static_cast<unsigned int>( value.Get<float>() );
- }
- else
- {
- DALI_ASSERT_ALWAYS( value.GetType() == Property::INTEGER && "Image width property is not a number" );
- height = value.Get<int>();
- }
- }
-
- attributes.SetSize( width, height );
-
- field = "pixel-format";
- Pixel::Format pixelFormat = Pixel::RGBA8888;
- if( map.HasKey(field) )
- {
- DALI_ASSERT_ALWAYS( map.GetValue(field).GetType() == Property::STRING && "Image release-policy property is not a string" );
- std::string s( map.GetValue(field).Get<std::string>() );
- pixelFormat = GetEnumeration< Pixel::Format >( s.c_str(), PIXEL_FORMAT_TABLE, PIXEL_FORMAT_TABLE_COUNT );
- }
-
- field = "fitting-mode";
- if( map.HasKey( field ) )
- {
- Property::Value& value = map.GetValue( field );
- DALI_ASSERT_ALWAYS( value.GetType() == Property::STRING && "Image fitting-mode property is not a string" );
- std::string s( value.Get<std::string>() );
- attributes.SetScalingMode( GetEnumeration< FittingMode::Type >( s.c_str(), IMAGE_FITTING_MODE_TABLE, IMAGE_FITTING_MODE_TABLE_COUNT ) );
- }
-
- field = "sampling-mode";
- if( map.HasKey( field ) )
- {
- Property::Value& value = map.GetValue( field );
- DALI_ASSERT_ALWAYS( value.GetType() == Property::STRING && "Image sampling-mode property is not a string" );
- std::string s( value.Get<std::string>() );
- attributes.SetFilterMode( GetEnumeration< SamplingMode::Type >( s.c_str(), IMAGE_SAMPLING_MODE_TABLE, IMAGE_SAMPLING_MODE_TABLE_COUNT ) );
- }
-
- field = "orientation";
- if( map.HasKey( field ) )
- {
- Property::Value& value = map.GetValue( field );
- DALI_ASSERT_ALWAYS( value.GetType() == Property::BOOLEAN && "Image orientation property is not a boolean" );
- bool b = value.Get<bool>();
- attributes.SetOrientationCorrection( b );
- }
-
- if( map.HasKey("type") )
- {
- DALI_ASSERT_ALWAYS( map.GetValue("type").GetType() == Property::STRING );
- std::string s(map.GetValue("type").Get<std::string>());
- if("FrameBufferImage" == s)
- {
- ret = FrameBufferImage::New(attributes.GetWidth(),
- attributes.GetHeight(),
- pixelFormat,
- releasePolicy);
- }
- else if("BufferImage" == s)
- {
- ret = BufferImage::New(attributes.GetWidth(),
- attributes.GetHeight(),
- pixelFormat,
- releasePolicy);
- }
- else if("ResourceImage" == s)
- {
- ret = ResourceImage::New( filename, loadPolicy, releasePolicy, ImageDimensions( attributes.GetSize().x, attributes.GetSize().y ), attributes.GetScalingMode(), attributes.GetFilterMode(), attributes.GetOrientationCorrection() );
- }
- else
- {
- DALI_ASSERT_ALWAYS( !"Unknown image type" );
- }
- }
- else
- {
- ret = ResourceImage::New( filename, loadPolicy, releasePolicy, ImageDimensions( attributes.GetSize().x, attributes.GetSize().y ), attributes.GetScalingMode(), attributes.GetFilterMode(), attributes.GetOrientationCorrection() );
- }
- }
-
- return ret;
-
-} // Image NewImage( Property::Value map )
-
-
-ShaderEffect NewShaderEffect( const Property::Value& map )
-{
- Internal::ShaderEffectPtr ret;
-
- if( map.GetType() == Property::MAP )
- {
- ret = Internal::ShaderEffect::New(Dali::ShaderEffect::HINT_NONE); // hint can be reset if in map
-
- if( map.HasKey("program") )
- {
- Property::Index index = ret->GetPropertyIndex("program");
- DALI_ASSERT_DEBUG( map.GetValue("program").GetType() == Property::MAP );
- ret->SetProperty(index, map.GetValue("program"));
- }
-
- for(int i = 0; i < map.GetSize(); ++i)
- {
- const std::string& key = map.GetKey(i);
- if(key != "program")
- {
- Property::Index index = ret->GetPropertyIndex( key );
-
- if( Property::INVALID_INDEX != index )
- {
- ret->SetProperty(index, map.GetItem(i));
- }
- else
- {
- // if its not a property then register it as a uniform (making a custom property)
-
- if(map.GetItem(i).GetType() == Property::INTEGER)
- {
- // valid uniforms are floats, vec3's etc so we recast if the user accidentally
- // set as integer. Note the map could have come from json script.
- Property::Value asFloat( static_cast<float>( map.GetItem(i).Get<int>() ) );
- ret->SetUniform( key, asFloat, Dali::ShaderEffect::COORDINATE_TYPE_DEFAULT );
- }
- else
- {
- ret->SetUniform( key, map.GetItem(i), Dali::ShaderEffect::COORDINATE_TYPE_DEFAULT );
- }
- }
- }
- }
- }
-
- return Dali::ShaderEffect(ret.Get());
-}
-
-
-Actor NewActor( const Property::Map& map )
-{
- BaseHandle handle;
-
- // First find type and create Actor
- Property::Value* typeValue = map.Find( "type" );
- if ( typeValue )
- {
- TypeInfo type = TypeRegistry::Get().GetTypeInfo( typeValue->Get< std::string >() );
- if ( type )
- {
- handle = type.CreateInstance();
- }
- }
-
- if ( !handle )
- {
- DALI_LOG_ERROR( "Actor type not provided, returning empty handle" );
- return Actor();
- }
-
- Actor actor( Actor::DownCast( handle ) );
-
- if ( actor )
- {
- // Now set the properties, or create children
- for ( unsigned int i = 0, mapCount = map.Count(); i < mapCount; ++i )
- {
- const StringValuePair& pair( map.GetPair( i ) );
- const std::string& key( pair.first );
- if ( key == "type" )
- {
- continue;
- }
-
- const Property::Value& value( pair.second );
-
- if ( key == "actors" )
- {
- // Create children
-
- Property::Array actorArray = value.Get< Property::Array >();
- for ( size_t i = 0; i < actorArray.Size(); ++i)
- {
- actor.Add( NewActor( actorArray[i].Get< Property::Map >() ) );
- }
- }
- else if ( key == "signals" )
- {
- DALI_LOG_ERROR( "signals not supported" );
- }
- else if( key == "parent-origin" )
- {
- // Parent Origin can be a string constant as well as a Vector3
-
- const Property::Type type( value.GetType() );
- if ( type == Property::VECTOR3 )
- {
- actor.SetParentOrigin( value.Get< Vector3 >() );
- }
- else if( type == Property::STRING )
- {
- actor.SetParentOrigin( GetAnchorConstant( value.Get< std::string >() ) );
- }
- }
- else if( key == "anchor-point" )
- {
- // Anchor Point can be a string constant as well as a Vector3
-
- const Property::Type type( value.GetType() );
- if ( type == Property::VECTOR3 )
- {
- actor.SetAnchorPoint( value.Get< Vector3 >() );
- }
- else if( type == Property::STRING )
- {
- actor.SetAnchorPoint( GetAnchorConstant( value.Get< std::string >() ) );
- }
- }
- else
- {
- Property::Index index( actor.GetPropertyIndex( key ) );
-
- if ( index != Property::INVALID_INDEX )
- {
- actor.SetProperty( index, value );
- }
- }
- }
- }
-
- return actor;
-}
-
-void CreatePropertyMap( Actor actor, Property::Map& map )
-{
- map.Clear();
-
- if ( actor )
- {
- map[ "type" ] = actor.GetTypeName();
-
- // Default properties
- Property::IndexContainer indices;
- actor.GetPropertyIndices( indices );
- const Property::IndexContainer::const_iterator endIter = indices.end();
- for ( Property::IndexContainer::iterator iter = indices.begin(); iter != endIter; ++iter )
- {
- map[ actor.GetPropertyName( *iter ) ] = actor.GetProperty( *iter );
- }
-
- // Children
- unsigned int childCount( actor.GetChildCount() );
- if ( childCount )
- {
- Property::Array childArray;
- for ( unsigned int child = 0; child < childCount; ++child )
- {
- Property::Map childMap;
- CreatePropertyMap( actor.GetChildAt( child ), childMap );
- childArray.PushBack( childMap );
- }
- map[ "actors" ] = childArray;
- }
- }
-}
-
-void CreatePropertyMap( Image image, Property::Map& map )
-{
- map.Clear();
-
- if ( image )
- {
- std::string imageType( "ResourceImage" );
-
- // Get Type - cannot use TypeRegistry as Image is not an Object and thus, not registered
- BufferImage bufferImage = BufferImage::DownCast( image );
- if ( bufferImage )
- {
- imageType = "BufferImage";
- map[ "pixel-format" ] = GetEnumerationName< Pixel::Format >( bufferImage.GetPixelFormat(), PIXEL_FORMAT_TABLE, PIXEL_FORMAT_TABLE_COUNT );
- }
- else if ( FrameBufferImage::DownCast( image ) )
- {
- imageType = "FrameBufferImage";
- }
-
- map[ "type" ] = imageType;
- map[ "release-policy" ] = GetEnumerationName< Image::ReleasePolicy >( image.GetReleasePolicy(), IMAGE_RELEASE_POLICY_TABLE, IMAGE_RELEASE_POLICY_TABLE_COUNT );
-
- ResourceImage resourceImage = ResourceImage::DownCast( image );
- if( resourceImage )
- {
- map[ "filename" ] = resourceImage.GetUrl();
- map[ "load-policy" ] = GetEnumerationName< ResourceImage::LoadPolicy >( resourceImage.GetLoadPolicy(), IMAGE_LOAD_POLICY_TABLE, IMAGE_LOAD_POLICY_TABLE_COUNT );
- }
-
- int width( image.GetWidth() );
- int height( image.GetHeight() );
-
- if ( width && height )
- {
- map[ "width" ] = width;
- map[ "height" ] = height;
- }
- }
-}
-
-} // namespace scripting
-
-} // namespace Dali
-
-
-
-
+++ /dev/null
-#ifndef __DALI_SCRIPTING_H__
-#define __DALI_SCRIPTING_H__
-
-/*
- * Copyright (c) 2015 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// INTERNAL INCLUDES
-#include <dali/public-api/actors/actor-enumerations.h>
-#include <dali/public-api/actors/draw-mode.h>
-#include <dali/public-api/images/image.h>
-#include <dali/public-api/shader-effects/shader-effect.h>
-#include <dali/public-api/object/property-map.h>
-#include <dali/public-api/object/property-value.h>
-
-namespace Dali
-{
-
-class Actor;
-
-/**
- * @brief Utilities for scripting support.
- */
-namespace Scripting
-{
-
-/**
- * @brief Template structure which stores an enumeration and its string equivalent.
- */
-template< typename T >
-struct StringEnum
-{
- const char* string; ///< The string representation
- const T value; ///< The actual enumeration
-};
-
-/**
- * @brief Permissive comparison for string enums.
- *
- * Case insensitive and ignores '_', '-' in either string when comparing.
- *
- * @note If both strings are empty return true;
- *
- * @param[in] a The first string
- * @param[in] b The string to compare
- * @return true if the strings are equal as defined above. If both empty, then return true.
- */
-DALI_IMPORT_API bool CompareEnums( const char * a, const char * b );
-
-/**
- * @brief Set the value if strings pass a permissive compare.
- *
- * @param[in] a The input string
- * @param[in] b The string to compare
- * @param[in] set The variable to set
- * @param[in] value The value to set
- * @return true if the strings pass the permissive compare
- */
-template <typename T>
-bool SetIfEqual(const char * a, const char * b, T& set, const T& value)
-{
- if( CompareEnums( a, b ) )
- {
- set = value;
- return true;
- }
-
- return false;
-}
-
-/**
- * @brief Chooses the appropriate enumeration for the provided string from the given table.
- *
- * @param[in] value The string equivalent (case-insensitive).
- * @param[in] table A pointer to an array with the enumeration to string equivalents.
- * @param[in] tableCount Number of items in the array.
- *
- * @return The equivalent enumeration for the given string.
- */
-template< typename T >
-T GetEnumeration( const char * value, const StringEnum< T >* table, unsigned int tableCount )
-{
- T retVal( table->value );
- bool set( false );
-
- for ( unsigned int i = 0; ( i < tableCount ) && ( !set ); ++i )
- {
- set = SetIfEqual( value, table->string, retVal, table->value );
- ++table;
- }
-
- if ( !set )
- {
- DALI_ASSERT_ALWAYS( !"Unknown enumeration string" );
- }
-
- return retVal;
-}
-
-/**
- * @brief Chooses the appropriate string for the provided enumeration from the given table.
- *
- * @param[in] value The enumeration.
- * @param[in] table A pointer to an array with the enumeration to string equivalents.
- * @param[in] tableCount Number of items in the array.
- *
- * @return The equivalent enumeration for the given string. Will return NULL if the value does not exist
- *
- * @note The caller is NOT responsible for cleaning up the returned pointer as it is statically allocated.
- */
-template< typename T >
-const char * GetEnumerationName( T value, const StringEnum< T >* table, unsigned int tableCount )
-{
- for ( unsigned int i = 0; i < tableCount; ++i )
- {
- if ( value == table[ i ].value )
- {
- return table[ i ].string;
- }
- }
-
- return NULL;
-}
-
-/**
- * @brief Chooses the appropriate string for the provided enumeration from the given table.
- * This is an optimised version that handles enumerations that start at 0 and are linear only.
- *
- * @param[in] value The enumeration.
- * @param[in] table A pointer to an array with the enumeration to string equivalents.
- * @param[in] tableCount Number of items in the array.
- *
- * @return The equivalent enumeration for the given string. Will return NULL if the value does not exist
- *
- * @note The caller is NOT responsible for cleaning up the returned pointer as it is statically allocated.
- */
-template< typename T >
-const char * GetLinearEnumerationName( T value, const StringEnum< T >* table, unsigned int tableCount )
-{
- if ( value < 0 || value >= (int)tableCount )
- {
- return NULL;
- }
-
- return table[value].string;
-}
-
-/**
- * @brief Takes a string and returns the appropriate color mode.
- *
- * @param[in] value The input string
- * @return The corresponding color-mode.
- */
-DALI_IMPORT_API ColorMode GetColorMode( const std::string& value );
-
-/**
- * @brief Takes a color mode and returns the appropriate string equivalent.
- *
- * @param[in] value The color mode
- * @return The corresponding string.
- */
-DALI_IMPORT_API std::string GetColorMode( ColorMode value );
-
-/**
- * @brief Takes a string and returns the appropriate position inheritance mode.
- *
- * @param[in] value The input string
- * @return The corresponding position-inheritance-mode.
- */
-DALI_IMPORT_API PositionInheritanceMode GetPositionInheritanceMode( const std::string& value );
-
-/**
- * @brief Takes a position inheritance mode and returns the string equivalent.
- *
- * @param[in] value The position-inheritance-mode.
- * @return The corresponding string.
- */
-DALI_IMPORT_API std::string GetPositionInheritanceMode( PositionInheritanceMode value );
-
-/**
- * @brief Takes a string and returns the appropriate draw mode.
- *
- * @param[in] value The input string
- * @return The corresponding draw-mode.
- */
-DALI_IMPORT_API DrawMode::Type GetDrawMode( const std::string& value );
-
-/**
- * @brief Takes a draw-mode and returns the string equivalent.
- *
- * @param[in] value The draw-mode.
- * @return The corresponding string.
- */
-DALI_IMPORT_API std::string GetDrawMode( DrawMode::Type value );
-
-/**
- * @brief Takes a string and returns the appropriate anchor-point or parent-origin constant.
- *
- * @param[in] value The input string
- * @return The corresponding anchor-point or parent-origin constant.
- */
-DALI_IMPORT_API Vector3 GetAnchorConstant( const std::string& value );
-
-/**
- * @brief Creates object with data from the property value map.
- *
- * @param[in] map The property value map with the following valid fields:
- * @code
- * "filename": type std::string
- * "load-policy" type std::string (enum)
- * "release-policy" type std::string (enum)
- * "width" type float
- * "height" type float
- * "pixel-format" type std::string (enum)
- * "fitting-mode" type std::string (enum)
- * "sampling-mode" type std::string (enum)
- * "orientation" type bool
- * "type" type std::string (FrameBufferImage|BufferImage|ResourceImage(default))
- * @endcode
- * Some fields are optional and some only pertain to a specific type.
- *
- * @return a pointer to a newly created object.
- */
-DALI_IMPORT_API Image NewImage( const Property::Value& map );
-
-/**
- * @brief Creates object with data from the property value map.
- *
- * @param[in] map The property value map with the following valid fields:
- * @code
- * // a program can be specified as string or a filename.
- * // some fields may be ignored depending on the geometry-type
- * "program": type Map
- * {
- * "vertex": type std::string
- * "fragment": type std::string
- * "vertex-prefix": type std::string
- * "fragment-prefix": type std::string
- * "text-vertex": type std::string
- * "text-fragment": type std::string
- * "vertex-filename": type std::string
- * "fragment-filename": type std::string
- * "vertex-prefix-filename": type std::string
- * "fragment-prefix-filename": type std::string
- * "text-vertex-filename": type std::string
- * "text-fragment-filename": type std::string
- * "geometry-type": type std::string (enum)
- * "geometry-hints": type std::string (enum)
- * }
- * // uniforms must be specified to be registered
- * "uUniform1": type float,
- * "uUniform2": type float, etc
- * @endcode
- *
- * @return a pointer to a newly created object.
- */
-DALI_IMPORT_API ShaderEffect NewShaderEffect( const Property::Value& map );
-
-/**
- * @brief Creates an actor with the date from the property value map.
- *
- * @param[in] map The property value map with the properties (and hierarchy) of the actor required
- * For example:
- * @code
- * {
- * "type": "ImageActor",
- * "image":
- * {
- * "filename":"my-image-path.png"
- * },
- * "actors":
- * [
- * {
- * "type":"Actor",
- * "position":[0,0,0]
- * }
- * ]
- * }
- * @endcode
- *
- * @return Handle to the newly created actor.
- */
-DALI_IMPORT_API Actor NewActor( const Property::Map& map );
-
-/**
- * @brief Creates a Property::Map from the actor provided.
- *
- * @param[in] actor The base-actor from which a Property::Map should be created
- * @param[out] map This map is cleared and a property map of actor and its children is filled in
- */
-DALI_IMPORT_API void CreatePropertyMap( Actor actor, Property::Map& map );
-
-/**
- * @brief Creates a Property::Map from the image provided.
- *
- * @param[in] image The image from which a Property::Map should be created
- * @param[out] map This map is cleared and a property map of the image is filled in
- */
-DALI_IMPORT_API void CreatePropertyMap( Image image, Property::Map& map );
-
-}
-
-} // namespace Dali
-
-#endif // __DALI_SCRIPTING_H__