Scene class changed, made as resource (Mesh,Material,Light,ShaderProgram) container...
authorYouri Sdobnikov <i.sdobnikov@samsung.com>
Fri, 6 Dec 2013 14:34:17 +0000 (16:34 +0200)
committerYouri Sdobnikov <i.sdobnikov@samsung.com>
Fri, 6 Dec 2013 14:34:17 +0000 (16:34 +0200)
Change-Id: I95b062f3f47ab2139b610429401dada68801a38b
Signed-off-by: Youri Sdobnikov <i.sdobnikov@samsung.com>
29 files changed:
inc/FUiAnimLight.h
inc/FUiAnimMaterial.h
inc/FUiAnimMesh.h
inc/FUiAnimModelImporter.h
inc/FUiAnimScene.h
inc/FUiAnimShaderProgram.h
inc/FUiIAccessibilityListener.h
src/ui/CMakeLists.txt
src/ui/animations/FUiAnimLight.cpp
src/ui/animations/FUiAnimMaterial.cpp
src/ui/animations/FUiAnimMesh.cpp
src/ui/animations/FUiAnimModelImporter.cpp
src/ui/animations/FUiAnimScene.cpp
src/ui/animations/FUiAnimShaderProgram.cpp
src/ui/animations/FUiAnim_LightParser.cpp [new file with mode: 0644]
src/ui/animations/FUiAnim_LightParser.h [new file with mode: 0644]
src/ui/animations/FUiAnim_MaterialImpl.cpp
src/ui/animations/FUiAnim_MaterialImpl.h
src/ui/animations/FUiAnim_MaterialParser.cpp [new file with mode: 0644]
src/ui/animations/FUiAnim_MaterialParser.h [new file with mode: 0644]
src/ui/animations/FUiAnim_MeshImpl.cpp
src/ui/animations/FUiAnim_ModelImporterImpl.cpp
src/ui/animations/FUiAnim_SceneImpl.cpp
src/ui/animations/FUiAnim_ShaderProgramImpl.cpp
src/ui/animations/FUiAnim_ShaderProgramImpl.h
src/ui/animations/FUiAnim_VisualElementImpl.cpp
src/ui/inc/FUiAnim_MeshImpl.h
src/ui/inc/FUiAnim_ModelImporterImpl.h
src/ui/inc/FUiAnim_SceneImpl.h

index d16cdad..2b4e461 100644 (file)
@@ -41,14 +41,12 @@ class _OSP_EXPORT_ Light
        : public Tizen::Base::Object
 {
 public:
-    Light(void);
-    Light(const Light& light); // deep copy
 
-    virtual ~Light(void);
-
-       Light& operator =(const Light& rhs);
-
-public:
+       /**
+        *      @enum LightType
+        *      Defines the Type of the light for Light class.
+        *      The contents of Light will be rendered using this operation.
+        */
        enum LightType {
                LIGHT_TYPE_POINT = 0,
                LIGHT_TYPE_SPOT = 1,
@@ -56,6 +54,40 @@ public:
        };
 
        /**
+        * This is the default constructor for this class.
+        *
+        * @since               3.0
+        */
+       Light(void);
+
+       /**
+        * This is copy constructor for the Light class.
+        *
+        * @since               3.0
+        *
+        * @param[in]   rhs                                     An instance of Light
+        * @remarks             Deep copy
+        */
+       Light(const Light& light);
+
+       /**
+        * This is the destructor for this class.
+        *
+        * @since               3.0
+        */
+       virtual ~Light(void);
+
+       /**
+        * Assigns the values of the specified instance to the current instance of Light.
+        *
+        * @since 3.0
+        *
+        * @return      The reference to this instance
+        * @param[in]   rhs     An instance of Light
+        */
+       Light& operator =(const Light& rhs);
+
+       /**
         * Get light type.
         *
         * @since 3.0
@@ -71,7 +103,7 @@ public:
         *
         * @since 3.0
         *
-        * @param[]             lightType       Type of the light.
+        * @param[in]   lightType       Type of the light.
         * @see                 GetLightType().
         */
        void SetType(LightType lightType);
@@ -92,7 +124,7 @@ public:
         *
         * @since 3.0
         *
-        * @param[]             ambient Ambient of the light.
+        * @param[in]   ambient Ambient of the light.
         * @see                 GetAmbient().
         */
        void SetAmbient(const Tizen::Graphics::FloatVector4& ambient);
@@ -113,7 +145,7 @@ public:
         *
         * @since 3.0
         *
-        * @param[]             diffuse Diffuse color of the light.
+        * @param[in]   diffuse Diffuse color of the light.
         * @see                 GetDiffuse().
         */
        void SetDiffuse(const Tizen::Graphics::FloatVector4& diffuse);
@@ -134,7 +166,7 @@ public:
         *
         * @since 3.0
         *
-        * @param[]             specular        Type of the light.
+        * @param[in]   specular        Type of the light.
         * @see                 GetSpecular().
         */
        void SetSpecular(const Tizen::Graphics::FloatVector4& specular);
@@ -155,7 +187,7 @@ public:
         *
         * @since 3.0
         *
-        * @param[]             position        Position of the light.
+        * @param[in]   position        Position of the light.
         * @see                 GetPosition().
         */
        void SetPosition(const Tizen::Graphics::FloatVector4& position);
@@ -176,7 +208,7 @@ public:
         *
         * @since 3.0
         *
-        * @param[]             lightType       Direction of the light.
+        * @param[in]   lightType       Direction of the light.
         * @see                 GetDirection().
         */
        void SetDirection(const Tizen::Graphics::FloatPoint3& direction);
@@ -197,7 +229,7 @@ public:
         *
         * @since 3.0
         *
-        * @param[]             exponent        Exponent of the light.
+        * @param[in]   exponent        Exponent of the light.
         * @see                 SetExponent().
         */
        void SetExponent(float exponent);
@@ -218,7 +250,7 @@ public:
         *
         * @since 3.0
         *
-        * @param[]             cutOff  Cut off of the light.
+        * @param[in]   cutOff  Cut off of the light.
         * @see                 GetCutOff().
         */
        void SetCutOff(float cutOff);
@@ -239,7 +271,7 @@ public:
         *
         * @since 3.0
         *
-        * @param[]             attenuation     Constant attenuation of the light.
+        * @param[in]   attenuation     Constant attenuation of the light.
         * @see                 GetConstantAttenuation().
         */
        void SetConstantAttenuation(float attenuation);
@@ -260,7 +292,7 @@ public:
         *
         * @since 3.0
         *
-        * @param[]             attenuation     Linear attenuation of the light.
+        * @param[in]   attenuation     Linear attenuation of the light.
         * @see                 GetLinearAttenuation().
         */
        void SetLinearAttenuation(float attenuation);
@@ -281,7 +313,7 @@ public:
         *
         * @since 3.0
         *
-        * @param[]             attenuation     Quadratic attenuation of the light.
+        * @param[in]   attenuation     Quadratic attenuation of the light.
         * @see                 GetQuadraticAttenuation().
         */
        void SetQuadraticAttenuation(float attenuation);
@@ -302,7 +334,7 @@ public:
         *
         * @since 3.0
         *
-        * @param[]             name    Name of the light.
+        * @param[in]   name    Name of the light.
         * @see                 GetName().
         */
        result SetName(const Tizen::Base::String& name);
@@ -323,7 +355,7 @@ public:
         *
         * @since 3.0
         *
-        * @param[]             enables Enable status of the light.
+        * @param[in]   enables Enable status of the light.
         * @see                 IsEnabled().
         */
        void SetEnabled(bool enabled);
@@ -331,10 +363,36 @@ public:
        result SetProperty(const Tizen::Base::String& name, const Tizen::Ui::Variant& value);
        Variant GetProperty(const Tizen::Base::String& name) const;
 
+       /**
+        *      Gets the hash value of the current instance of %Light.
+        *
+        *  @since 3.0
+        *
+        *      @return         An integer value indicating the hash value of the current instance of %Light
+        *      @remarks        Two equal instances must return the same hash value. For better performance,
+        *                              the used hash function must generate a random distribution for all inputs. @n
+        *                              The default implementation of this method returns the address of the current instance.
+        *                              Returns Mesh unique code (not depended of public instance) like mesh id
+        */
+       virtual int GetHashCode(void) const;
+
+       /**
+        * Saving light to xml file.
+        *
+        * @since               3.0
+        *
+        * @return              An error code
+        * @param[in]   fileName                        Name of file
+        * @exception   E_SUCCESS                       The method is successful
+        * @exception   E_OPERATION_FAILED      Fail to save Light instance to the file
+        */
+       result SaveLight(const Tizen::Base::String& fileName);
+
 private:
        class _LightImpl* __pLightImpl;
 
        friend class _LightImpl;
+       friend class _SceneImpl;
 };
 
 }}} //namespace Tizen { namespace Ui { namespace Animations {
index 3581e67..63c2688 100644 (file)
@@ -174,13 +174,61 @@ public:
         */
        result SetName(const Tizen::Base::String& name);
 
+
+///////
+       /**
+        * Get emissive power.
+        *
+        * @since 3.0
+        *
+        * @return              emissive power of the material.
+        * @see                 SetEmissivePower().
+        *
+        */
+       float GetEmissivePower(void) const;
+
+       /**
+        * Sets material emissive power.
+        *
+        * @since 3.0
+        *
+        * @param[]             value           Emissive power of the material.
+        * @see                 GetEmissivePower().
+        */
+       void SetEmissivePower(const float& value);
+
        result SetProperty(const Tizen::Base::String& name, const Tizen::Ui::Variant& value);
        Tizen::Ui::Variant GetProperty(const Tizen::Base::String& name) const;
+       /**
+        *      Gets the hash value of the current instance of %Material.
+        *
+        *  @since 3.0
+        *
+        *      @return         An integer value indicating the hash value of the current instance of %Material
+        *      @remarks        Two equal instances must return the same hash value. For better performance,
+        *                              the used hash function must generate a random distribution for all inputs. @n
+        *                              The default implementation of this method returns the address of the current instance.
+        *                              Returns Mesh unique code (not depended of public instance) like mesh id
+        */
+       virtual int GetHashCode(void) const;
+
+       /**
+        * Saving material to xml file.
+        *
+        * @since               3.0
+        *
+        * @return              An error code
+        * @param[in]   fileName                        Name of file
+        * @exception   E_SUCCESS                       The method is successful
+        * @exception   E_OPERATION_FAILED      Fail to save Material instance to the file
+        */
+       result SaveMaterial (const Tizen::Base::String& fileName);
 
 private:
        class _MaterialImpl* __pMaterialImpl;
 
        friend class _MaterialImpl;
+       friend class _SceneImpl;
 };
 
 }}} //namespace Tizen { namespace Ui { namespace Animations {
index f436a1c..5b63e14 100644 (file)
@@ -421,7 +421,7 @@ public:
         * @exception   E_OPERATION_FAILED      File for saving didn't open
         * @exception   E_INVALID_DATA          Mesh without vertices
         */
-    result SaveMeshToBinary(const Tizen::Base::String& fileName);
+    result SaveMesh(const Tizen::Base::String& fileName);
 
        /**
         * Checking for indexing enabling
@@ -479,6 +479,7 @@ public:
         *
         * @return              Mesh's name
         */
+       Tizen::Base::String GetName(void);
        Tizen::Base::String GetName(void) const;
 
        //--------------------------------------------------TEMP
@@ -504,6 +505,7 @@ public:
 private:
        class _MeshImpl* __pMeshImpl;
 
+       friend class _SceneImpl;
        friend class _MeshImpl;
        friend class _VisualElementImpl;
 };
index fc37709..ed39950 100644 (file)
@@ -55,6 +55,16 @@ public:
        static Mesh* LoadMeshN(MODEL_FORMAT modelFormat, const Tizen::Base::String& fileName, const Tizen::Base::String& modelName);
 
        /**
+        * Load mesh from file.
+        *
+        * @since               3.0
+        *
+        * @return              New mesh object
+        * @param[in]   fileName                        Name of file
+        */
+       static Mesh* LoadMeshN(const Tizen::Base::String& fileName);
+
+       /**
         * Load material from file.
         *
         * @since               3.0
@@ -75,7 +85,8 @@ public:
         * @param[in]   fileName                        Name of file
         * @param[in]   sceneName                       Id of scene in COLLADA file
         */
-       static Scene* LoadSceneN(const Tizen::Base::String& fileName, const Tizen::Base::String& sceneName);
+       static Scene* LoadSceneN(const Tizen::Base::String& fileName, const Tizen::Base::String& sceneName, VisualElement& pSceneRootVisualElement);
+
 
 private:
        ModelImporter(void);
index 785c7f5..357bad1 100644 (file)
 #define _FUI_ANIM_SCENE_H_
 
 #include <FBaseObject.h>
-#include <FBaseColArrayList.h>
+//#include <FBaseColIList.h>
+//#include <FBaseColArrayList.h>
+
+namespace Tizen { namespace Base { namespace Collection {
+class IList;
+}}}
 
 namespace Tizen { namespace Ui { namespace Animations {
 
 class _SceneImpl;
 class Mesh;
 class Material;
+class Light;
+class ShaderProgram;
 class VisualElement;
 
 class _OSP_EXPORT_ Scene
        : public Tizen::Base::Object
 {
 public:
+       /**
+        * Default constructor of the class
+        *
+        * @since               3.0
+        *
+        */
        Scene(void);
+       /**
+        * Virtual destructor of the class
+        *
+        * @since               3.0
+        *
+        */
        virtual ~Scene(void);
 
-       result Construct(void);
+       /**
+        * Construct method, realize second stage of object construction. Must be called after object creation before object using
+        *
+        * @since               3.0
+        *
+        * @return              An error code
+        * @exception   E_SUCCESS                       The method is successful.
+        * @exception   E_OUT_OF_MEMORY         Failed to create SceneImpl instance
+        */
+       result Construct(VisualElement& pSceneRootVisualElement);
 
        /**
-        * Returns pointer to the root element of the scene tree
+        * Returns pointer to the scene tree root VisualElement
         *
         * @since               3.0
         *
-        * @return              Pointer to root VisualElement
+        * @return              Pointer to local root VisualElement
+        * @exception   E_SUCCESS                       The method is successful.
         */
-       VisualElement* GetRootVisualElement(void) const;
+       Tizen::Ui::Animations::VisualElement* GetRootVisualElement(void) const;
 
        /**
-        * Adding a new mesh object to the scene
+        * Set Scene name
         *
         * @since               3.0
         *
         * @return              An error code
-        * @param[in]   pMesh                   Pointer to mesh object
+        * @exception   E_SUCCESS                       The method is successful.
         */
-       result AddMesh(Mesh* pMesh);
+       result SetName(const Tizen::Base::String& sceneName);
 
        /**
-        * Deleting a mesh object from the scene
+        * Get Scene name
+        *
+        * @since               3.0
+        *
+        * @return              Scene name
+        */
+       Tizen::Base::String GetName(void) const;
+
+       /**
+        * Removes all scene elements (VisualElements,Meshes, Materials, Lights, ShaderPrograms, TextureFileNames)
         *
         * @since               3.0
         *
         * @return              An error code
-        * @param[in]   meshName                        Name of mesh object
+        * @exception   E_SUCCESS                       The method is successful.
+        */
+       result ResetScene(void);
+
+       /**
+        * Adds a new Mesh object to the scene container
+        *
+        * @since               3.0
+        *
+        * @param[in]   pMesh                   Pointer to object
+        *
+        * @return              An error code
+        * @exception   E_SUCCESS                       The method is successful.
+        * @exception   E_INVALID_ARG           Input object pointer is null
+        * @exception   E_OUT_OF_MEMORY         Failed to create new object instance
+        *
+        * @remark      Creates a new public object instance, given one memory free left by user
+        * @see GetMeshN(), RemoveMesh()
+        */
+       result AddMesh(const Mesh* pMesh);
+
+       /**
+        * Removes a Mesh object from the scene container by name
+        *
+        * @since               3.0
+        *
+        * @param[in]   meshName                Name of object to remove
+        *
+        * @return              An error code
+        * @exception   E_SUCCESS                       The method is successful.
+        * @exception   E_OBJ_NOT_FOUND         No such object in scene
+        *
+        * @see AddMesh()
+        */
+       //result RemoveMesh(const Tizen::Base::String meshName);
+
+       /**
+        * Removes a Mesh object from the scene container by pointer
+        *
+        * @since               3.0
+        *
+        * @param[in]   pMesh           Pointer to object
+        *
+        * @return              An error code
+        * @exception   E_SUCCESS                       The method is successful.
+        * @exception   E_OBJ_NOT_FOUND         No such object in scene
+        * @exception   E_INVALID_ARG           Pointer to object is null
+        */
+       result RemoveMesh(const Mesh* pMesh);
+
+       /**
+        * Removes all Meshes in scene
+        *
+        * @since               3.0
+        *
+        * @return              An error code
+        * @exception   E_SUCCESS                       The method is successful.
+        */
+       result RemoveAllMesh(void);
+
+       /**
+        * Gets a pointer to the first Mesh in scene with this name
+        *
+        * @since               3.0
+        *
+        * @param[in]   meshName                Name of  object
+        *
+        * @return              Pointer to the object
+        * @exception   E_SUCCESS                       The method is successful.
+        * @exception   E_OBJ_NOT_FOUND         No such object in scene
+        * @exception   E_OUT_OF_MEMORY         Failed to create new object instance
+        *
+        * @remark      Creates a new public object instance, memory free left by user
+        * @see AddMesh()
+        */
+       Mesh* GetMeshN(const Tizen::Base::String meshName) const;
+
+       /**
+        * Checks if Mesh exists in scene by name
+        *
+        * @since               3.0
+        *
+        * @param[in]   meshName                Name of  object
+        *
+        * @return              object index in scene container, or -1 if not found
+        * @exception   E_SUCCESS                       The method is successful.
+        *
+        * @remark              Return value is in range [0,n-1] n - object count
+        * @see AddMesh(), GetMeshCount(), GetMeshAtN()
+        */
+       //int ContainsMesh(const Tizen::Base::String meshName) const;
+
+       /**
+        * Checks if Mesh exists in scene by name
+        *
+        * @since               3.0
+        *
+        * @param[in]   meshName                Name of  object
+        *
+        * @return              object index in scene container, or -1 if not found
+        * @exception   E_SUCCESS                       The method is successful.
+        * @exception   E_INVALID_ARG           invalid object pointer
+        *
+        * @remark              Return value is in range [0,n-1] n - object count
+        * @see AddMesh(), GetMeshCount(), GetMeshAtN()
+        */
+       int ContainsMesh(const Mesh* pMesh) const;
+
+       /**
+        * Takes Mesh count in scene container
+        *
+        * @since               3.0
+        *
+        * @return              object count in scene
+        *
+        * @see AddMesh(), GetMeshAtN()
         */
-       result RemoveMesh(Tizen::Base::String meshName);
+       int GetMeshCount(void) const;
 
        /**
-        * Gets a pointer to the mesh in scene
+        * Gets a pointer to the Mesh in scene container by index
         *
         * @since               3.0
         *
-        * @return              Pointer to the mesh object
-        * @param[in]   meshName                        Name of mesh object
+        * @param[in]   index           object index in scene
+        *
+        * @return              Pointer to the object
+        * @exception   E_SUCCESS                       The method is successful.
+        * @exception   E_OBJ_NOT_FOUND         No such index in scene
+        * @exception   E_OUT_OF_MEMORY         Failed to create new object instance
+        *
+        * @remark      Creates a new public object instance, memory free left by user
+        * @see AddMesh(), GetMeshCount()
+        */
+       Mesh* GetMeshAtN(int index) const;
+
+       /**
+        * Gets an Mesh name in scene container by index
+        *
+        * @since               3.0
+        *
+        * @param[in]   index           object index in scene
+        *
+        * @return              name of object
+        * @exception   E_SUCCESS                       The method is successful.
+        * @exception   E_OBJ_NOT_FOUND         No such index in scene
+        * @exception   E_OUT_OF_MEMORY         Failed to create new object instance
+        *
+        * @see AddMesh(), GetMeshCount()
         */
-       Mesh* GetMeshN(Tizen::Base::String meshName) const;
+       Tizen::Base::String GetMeshNameAt(int index) const;
 
        /**
-        * Gets a list of names of all meshes in scene
+        * Adds a new Material object to the scene container
         *
         * @since               3.0
         *
-        * @return              Pointer to the ArrayList
+        * @param[in]   pMaterial                       Pointer to object
+        *
+        * @return              An error code
+        * @exception   E_SUCCESS                       The method is successful.
+        * @exception   E_INVALID_ARG           Input object pointer is null
+        * @exception   E_OUT_OF_MEMORY         Failed to create new object instance
+        *
+        * @remark      Creates a new public object instance, given one memory free left by user
+        * @see GetMaterialN(), RemoveMaterial()
         */
-       Tizen::Base::Collection::ArrayList* GetMeshNamesN(void) const;
+       result AddMaterial(const Material* pMaterial);
 
        /**
-        * Adding a new material object to the scene
+        * Removes a Material object from the scene container by name
         *
         * @since               3.0
         *
+        * @param[in]   materialName            Name of object to remove
+        *
         * @return              An error code
-        * @param[in]   pMaterial                       Pointer to material object
+        * @exception   E_SUCCESS                       The method is successful.
+        * @exception   E_OBJ_NOT_FOUND         No such object in scene
+        *
+        * @see AddMaterial()
         */
-       result AddMaterial(Material* pMaterial);
+       //result RemoveMaterial(const Tizen::Base::String materialName);
 
        /**
-        * Deleting a material object from the scene
+        * Removes a Material object from the scene container by pointer
         *
         * @since               3.0
         *
+        * @param[in]   pMaterial               Pointer to object
+        *
         * @return              An error code
-        * @param[in]   materialName                    Name of material object
+        * @exception   E_SUCCESS                       The method is successful.
+        * @exception   E_OBJ_NOT_FOUND         No such object in scene
+        * @exception   E_INVALID_ARG           Pointer to object is null
         */
-       result RemoveMaterial(Tizen::Base::String materialName);
+       result RemoveMaterial(const Material* pMaterial);
 
        /**
-        * Gets a pointer to the material in scene
+        * Removes all Materials in scene
         *
         * @since               3.0
         *
-        * @return              Pointer to the material object
-        * @param[in]   materialName                    Name of material object
+        * @return              An error code
+        * @exception   E_SUCCESS                       The method is successful.
         */
-       Material* GetMaterialN(Tizen::Base::String materialName) const;
+       result RemoveAllMaterial(void);
 
        /**
-        * Gets a list of names of all materials in scene
+        * Gets a pointer to the first Material in scene with this name
         *
         * @since               3.0
         *
-        * @return              Pointer to the ArrayList
+        * @param[in]   materialName            Name of  object
+        *
+        * @return              Pointer to the object
+        * @exception   E_SUCCESS                       The method is successful.
+        * @exception   E_OBJ_NOT_FOUND         No such object in scene
+        * @exception   E_OUT_OF_MEMORY         Failed to create new object instance
+        *
+        * @remark      Creates a new public object instance, memory free left by user
+        * @see AddMaterial()
         */
-       Tizen::Base::Collection::ArrayList* GetMaterialNamesN(void) const;
+       Material* GetMaterialN(const Tizen::Base::String materialName) const;
 
        /**
-        * Adding a texture file name
+        * Checks if Material exists in scene by name
         *
         * @since               3.0
         *
+        * @param[in]   materialName            Name of  object
+        *
+        * @return              object index in scene container, or -1 if not found
+        * @exception   E_SUCCESS                       The method is successful.
+        *
+        * @remark              Return value is in range [0,n-1] n - object count
+        * @see AddMaterial(), GetMaterialCount(), GetMaterialAtN()
+        */
+       //int ContainsMaterial(const Tizen::Base::String materialName) const;
+
+       /**
+        * Checks if Material exists in scene by name
+        *
+        * @since               3.0
+        *
+        * @param[in]   materialName            Name of  object
+        *
+        * @return              object index in scene container, or -1 if not found
+        * @exception   E_SUCCESS                       The method is successful.
+        * @exception   E_INVALID_ARG           invalid object pointer
+        *
+        * @remark              Return value is in range [0,n-1] n - object count
+        * @see AddMaterial(), GetMaterialCount(), GetMaterialAtN()
+        */
+       int ContainsMaterial(const Material* pMaterial) const;
+
+       /**
+        * Takes Material count in scene container
+        *
+        * @since               3.0
+        *
+        * @return              object count in scene
+        *
+        * @see AddMaterial(), GetMaterialAtN()
+        */
+       int GetMaterialCount(void) const;
+
+       /**
+        *
+        * Gets a pointer to the Material in scene container by index
+        *
+        * @since               3.0
+        *
+        * @param[in]   index           object index in scene
+        *
+        * @return              Pointer to the object
+        * @exception   E_SUCCESS                       The method is successful.
+        * @exception   E_OBJ_NOT_FOUND         No such index in scene
+        * @exception   E_OUT_OF_MEMORY         Failed to create new object instance
+        *
+        * @remark      Creates a new public object instance, memory free left by user
+        * @see AddMaterial(), GetMaterialCount()
+        */
+       Material* GetMaterialAtN(int index) const;
+
+       /**
+        * Gets an Material name in scene container by index
+        *
+        * @since               3.0
+        *
+        * @param[in]   index           object index in scene
+        *
+        * @return              name of object
+        * @exception   E_SUCCESS                       The method is successful.
+        * @exception   E_OBJ_NOT_FOUND         No such index in scene
+        * @exception   E_OUT_OF_MEMORY         Failed to create new object instance
+        *
+        * @see AddMaterial(), GetMaterialCount()
+        */
+       Tizen::Base::String GetMaterialNameAt(int index) const;
+
+       /**
+        * Adds a new Light object to the scene container
+        *
+        * @since               3.0
+        *
+        * @param[in]   pLight                  Pointer to object
+        *
+        * @return              An error code
+        * @exception   E_SUCCESS                       The method is successful.
+        * @exception   E_INVALID_ARG           Input object pointer is null
+        * @exception   E_OUT_OF_MEMORY         Failed to create new object instance
+        *
+        * @remark      Creates a new public object instance, given one memory free left by user
+        * @see GetLightN(), RemoveLight()
+        */
+       result AddLight(const Light* pLight);
+
+       /**
+        * Removes a Light object from the scene container by name
+        *
+        * @since               3.0
+        *
+        * @param[in]   lightName               Name of object to remove
+        *
         * @return              An error code
+        * @exception   E_SUCCESS                       The method is successful.
+        * @exception   E_OBJ_NOT_FOUND         No such object in scene
+        *
+        * @see AddLight()
+        */
+       //result RemoveLight(const Tizen::Base::String lightName);
+
+       /**
+        * Removes a Light object from the scene container by pointer
+        *
+        * @since               3.0
+        *
+        * @param[in]   pLight          Pointer to object
+        *
+        * @return              An error code
+        * @exception   E_SUCCESS                       The method is successful.
+        * @exception   E_OBJ_NOT_FOUND         No such object in scene
+        * @exception   E_INVALID_ARG           Pointer to object is null
+        */
+       result RemoveLight(const Light* pLight);
+
+       /**
+        * Removes all Lights in scene
+        *
+        * @since               3.0
+        *
+        * @return              An error code
+        * @exception   E_SUCCESS                       The method is successful.
+        */
+       result RemoveAllLight(void);
+
+       /**
+        * Gets a pointer to the first Light in scene with this name
+        *
+        * @since               3.0
+        *
+        * @param[in]   lightName               Name of  object
+        *
+        * @return              Pointer to the object
+        * @exception   E_SUCCESS                       The method is successful.
+        * @exception   E_OBJ_NOT_FOUND         No such object in scene
+        * @exception   E_OUT_OF_MEMORY         Failed to create new object instance
+        *
+        * @remark      Creates a new public object instance, memory free left by user
+        * @see AddLight()
+        */
+       Light* GetLightN(const Tizen::Base::String lightName) const;
+
+       /**
+        * Checks if Light exists in scene by name
+        *
+        * @since               3.0
+        *
+        * @param[in]   lightName               Name of  object
+        *
+        * @return              object index in scene container, or -1 if not found
+        * @exception   E_SUCCESS                       The method is successful.
+        *
+        * @remark              Return value is in range [0,n-1] n - object count
+        * @see AddLight(), GetLightCount(), GetLightAtN()
+        */
+       //int ContainsLight(const Tizen::Base::String lightName) const;
+
+       /**
+        * Checks if Light exists in scene by name
+        *
+        * @since               3.0
+        *
+        * @param[in]   lightName               Name of  object
+        *
+        * @return              object index in scene container, or -1 if not found
+        * @exception   E_SUCCESS                       The method is successful.
+        * @exception   E_INVALID_ARG           invalid object pointer
+        *
+        * @remark              Return value is in range [0,n-1] n - object count
+        * @see AddLight(), GetLightCount(), GetLightAtN()
+        */
+       int ContainsLight(const Light* pLight) const;
+
+       /**
+        * Takes Light count in scene container
+        *
+        * @since               3.0
+        *
+        * @return              object count in scene
+        *
+        * @see AddLight(), GetLightAtN()
+        */
+       int GetLightCount(void) const;
+
+       /**
+        * Gets a pointer to the Light in scene container by index
+        *
+        * @since               3.0
+        *
+        * @param[in]   index           object index in scene
+        *
+        * @return              Pointer to the object
+        * @exception   E_SUCCESS                       The method is successful.
+        * @exception   E_OBJ_NOT_FOUND         No such index in scene
+        * @exception   E_OUT_OF_MEMORY         Failed to create new object instance
+        *
+        * @remark      Creates a new public object instance, memory free left by user
+        * @see AddLight(), GetLightCount()
+        */
+       Light* GetLightAtN(int index) const;
+
+       /**
+        * Gets an Light name in scene container by index
+        *
+        * @since               3.0
+        *
+        * @param[in]   index           object index in scene
+        *
+        * @return              name of object
+        * @exception   E_SUCCESS                       The method is successful.
+        * @exception   E_OBJ_NOT_FOUND         No such index in scene
+        * @exception   E_OUT_OF_MEMORY         Failed to create new object instance
+        *
+        * @see AddLight(), GetLightCount()
+        */
+       Tizen::Base::String GetLightNameAt(int index) const;
+
+       /**
+        * Adds a new ShaderProgram object to the scene container
+        *
+        * @since               3.0
+        *
+        * @param[in]   shaderProgramName               Name of new object
+        * @param[in]   vertexShader                    Pointer to custom vertex shader text
+        * @param[in]   pShaderProgram                  Pointer to custom fragment shader text
+        *
+        * @return              Pointer to an ShaderProgram object
+        * @exception   E_SUCCESS                       The method is successful.
+        * @exception   E_INVALID_ARG           Input object pointer is null
+        * @exception   E_OUT_OF_MEMORY         Failed to create new object instance
+        *
+        * @remark      Creates a new public object instance, given one memory free left by user
+        * @see GetShaderProgramN(), RemoveShaderProgram()
+        */
+       ShaderProgram* AddShaderProgramN(const Tizen::Base::String shaderProgramName, const char* vertexShader, const char* fragmentShader);
+
+       /**
+        * Removes a ShaderProgram object from the scene container by name
+        *
+        * @since               3.0
+        *
+        * @param[in]   shaderProgramName               Name of object to remove
+        *
+        * @return              An error code
+        * @exception   E_SUCCESS                       The method is successful.
+        * @exception   E_OBJ_NOT_FOUND         No such object in scene
+        *
+        * @see AddShaderProgram()
+        */
+       //result RemoveShaderProgram(const Tizen::Base::String shaderProgramName);
+
+       /**
+        * Removes a ShaderProgram object from the scene container by pointer
+        *
+        * @since               3.0
+        *
+        * @param[in]   pShaderProgram          Pointer to object
+        *
+        * @return              An error code
+        * @exception   E_SUCCESS                       The method is successful.
+        * @exception   E_OBJ_NOT_FOUND         No such object in scene
+        * @exception   E_INVALID_ARG           Pointer to object is null
+        */
+       result RemoveShaderProgram(const ShaderProgram* pShaderProgram);
+
+       /**
+        * Removes all ShaderPrograms in scene
+        *
+        * @since               3.0
+        *
+        * @return              An error code
+        * @exception   E_SUCCESS                       The method is successful.
+        */
+       result RemoveAllShaderProgram(void);
+
+       /**
+        * Gets a pointer to the first ShaderProgram in scene with this name
+        *
+        * @since               3.0
+        *
+        * @param[in]   shaderProgramName               Name of  object
+        *
+        * @return              Pointer to the object
+        * @exception   E_SUCCESS                       The method is successful.
+        * @exception   E_OBJ_NOT_FOUND         No such object in scene
+        * @exception   E_OUT_OF_MEMORY         Failed to create new object instance
+        *
+        * @remark      Creates a new public object instance, memory free left by user
+        * @see AddShaderProgram()
+        */
+       ShaderProgram* GetShaderProgramN(const Tizen::Base::String shaderProgramName) const;
+
+       /**
+        * Checks if ShaderProgram exists in scene by name
+        *
+        * @since               3.0
+        *
+        * @param[in]   shaderProgramName               Name of  object
+        *
+        * @return              object index in scene container, or -1 if not found
+        * @exception   E_SUCCESS                       The method is successful.
+        *
+        * @remark              Return value is in range [0,n-1] n - object count
+        * @see AddShaderProgram(), GetShaderProgramCount(), GetShaderProgramAtN()
+        */
+       //int ContainsShaderProgram(const Tizen::Base::String shaderProgramName) const;
+
+       /**
+        * Checks if ShaderProgram exists in scene by name
+        *
+        * @since               3.0
+        *
+        * @param[in]   shaderProgramName               Name of  object
+        *
+        * @return              object index in scene container, or -1 if not found
+        * @exception   E_SUCCESS                       The method is successful.
+        * @exception   E_INVALID_ARG           invalid object pointer
+        *
+        * @remark              Return value is in range [0,n-1] n - object count
+        * @see AddShaderProgram(), GetShaderProgramCount(), GetShaderProgramAtN()
+        */
+       int ContainsShaderProgram(const ShaderProgram* pShaderProgram) const;
+
+       /**
+        * Takes ShaderProgram count in scene container
+        *
+        * @since               3.0
+        *
+        * @return              object count in scene
+        *
+        * @see AddShaderProgram(), GetShaderProgramAtN()
+        */
+       int GetShaderProgramCount(void) const;
+
+       /**
+        * Gets a pointer to the ShaderProgram in scene container by index
+        *
+        * @since               3.0
+        *
+        * @param[in]   index           object index in scene
+        *
+        * @return              Pointer to the object
+        * @exception   E_SUCCESS                       The method is successful.
+        * @exception   E_OBJ_NOT_FOUND         No such index in scene
+        * @exception   E_OUT_OF_MEMORY         Failed to create new object instance
+        *
+        * @remark      Creates a new public object instance, memory free left by user
+        * @see AddShaderProgram(), GetShaderProgramCount()
+        */
+       ShaderProgram* GetShaderProgramAtN(int index) const;
+
+       /**
+        * Gets an ShaderProgram name in scene container by index
+        *
+        * @since               3.0
+        *
+        * @param[in]   index           object index in scene
+        *
+        * @return              name of object
+        * @exception   E_SUCCESS                       The method is successful.
+        * @exception   E_OBJ_NOT_FOUND         No such index in scene
+        * @exception   E_OUT_OF_MEMORY         Failed to create new object instance
+        *
+        * @see AddShaderProgram(), GetShaderProgramCount()
+        */
+       Tizen::Base::String GetShaderProgramNameAt(int index) const;
+
+       /**
+        * Adds a texture file name to scene container
+        *
+        * @since               3.0
+        *
         * @param[in]   textureFileName                 Name of texture file
+        *
+        * @return              An error code
+        * @exception   E_SUCCESS               The method is successful.
+        * @exception   E_OUT_OF_MEMORY The memory is insufficient.
+        */
+       result AddTextureFileName(const Tizen::Base::String textureFileName);
+
+       /**
+        * Takes TextureFileName count in scene container
+        *
+        * @since               3.0
+        *
+        * @return              object count in scene
+        *
+        * @see AddTextureFileName(), GetTextureFileNameAt()
+        */
+       int GetTextureFileNameCount(void) const;
+
+       /**
+        * Gets a TextureFileName string in scene container by index
+        *
+        * @since               3.0
+        *
+        * @param[in]   index           object index in scene
+        *
+        * @return              String containing file name or path and name
+        * @exception   E_SUCCESS                       The method is successful.
+        * @exception   E_OBJ_NOT_FOUND         No such index in scene
+        * @exception   E_OUT_OF_MEMORY         Failed to create new object instance
+        *
+        * @see AddTextureFileName(), GetTextureFileNameCount()
         */
-       result AddTextureFileName(Tizen::Base::String textureFileName);
+       Tizen::Base::String GetTextureFileNameAt(int index) const;
 
        /**
-        * Gets a list of texture file names
+        * Gets a TextureFileName string in scene container by index
         *
         * @since               3.0
         *
-        * @return              Pointer to the ArrayList
+        * @param[in]   index           object index in scene
+        *
+        * @return              an error code
+        * @exception   E_SUCCESS                       The method is successful.
+        * @exception   E_OBJ_NOT_FOUND         No such index in scene
+        *
+        * @see AddTextureFileName(), GetTextureFileNameCount(), GetTextureFileNameAt()
         */
-       Tizen::Base::Collection::ArrayList* GetTextureFileNamesN(void) const;
+       result RemoveTextureFileNameAt(int index);
+
+       /**
+        * Removes all Texture file names in scene
+        *
+        * @since               3.0
+        *
+        * @return              An error code
+        * @exception   E_SUCCESS                       The method is successful.
+        */
+       result RemoveAllTextureFileName(void);
+
+       /**
+        * Saves scene content into set of files at path, and scene structure to .xml
+        *
+        * @since               3.0
+        *
+        * @param[in]   filesPath                       Path to save scene content file
+        * @param[in]   resourceFilesPath       Path to save scene resources
+        * @param[in]   scenePrefix                     Scene structure file name and scene content prefix
+        *
+        * @return              An error code
+        * @exception   E_SUCCESS               The method is successful.
+        * @exception   E_OUT_OF_MEMORY The memory is insufficient.
+        * @exception   E_SYSTEM                XML subsystem error.
+        */
+       result SaveScene(const Tizen::Base::String filesPath, const Tizen::Base::String resourceFilesPath, const Tizen::Base::String scenePrefix) const;
 
 protected:
-       _SceneImpl* _pSceneImpl;
+private:
+       _SceneImpl* __pSceneImpl;
+
+       friend class _SceneImpl;
 };
 
 }}} //Tizen::Ui::Animations
index 54315d0..19c738d 100644 (file)
@@ -62,6 +62,7 @@ namespace Tizen { namespace Ui { namespace Animations
 class _ShaderProgramImpl;
 
 class _OSP_EXPORT_ ShaderProgram
+               : public Tizen::Base::Object
 {
 public:
        /**
@@ -134,11 +135,44 @@ public:
         */
        result SetUniform(const Tizen::Base::String& name, const Tizen::Ui::Variant& value);
 
-       bool Equals(const ShaderProgram& obj) const;
+       /**
+        * Get ShaderProgram name.
+        *
+        * @since 3.0
+        *
+        * @return              Name of the ShaderProgram.
+        * @see                 SetName().
+        *
+        */
+       Tizen::Base::String GetName(void) const;
+
+       /**
+        * Sets ShaderProgram name.
+        *
+        * @since 3.0
+        *
+        * @param[in]           name    Name of the ShaderProgram.
+        * @see                 GetName().
+        */
+       result SetName(const Tizen::Base::String name);
 
        result SetProperty(const Tizen::Base::String& name, const Tizen::Ui::Variant& value);
        Variant GetProperty(const Tizen::Base::String& name) const;
 
+       virtual bool Equals(const ShaderProgram& obj) const;
+       /**
+        *      Gets the hash value of the current instance of %ShaderProgram.
+        *
+        *  @since 3.0
+        *
+        *      @return         An integer value indicating the hash value of the current instance of %ShaderProgram
+        *      @remarks        Two equal instances must return the same hash value. For better performance,
+        *                              the used hash function must generate a random distribution for all inputs. @n
+        *                              The default implementation of this method returns the address of the current instance.
+        *                              Returns Mesh unique code (not depended of public instance) like mesh id
+        */
+       virtual int GetHashCode(void) const;
+
 private:
 
        ShaderProgram& operator =(const ShaderProgram& rhs);
@@ -146,6 +180,7 @@ private:
        class _ShaderProgramImpl* __pShaderProgramImpl;
 
        friend class _ShaderProgramImpl;
+       friend class _SceneImpl;
 };
 
 }}} //Tizen::Ui::Animations
index 4c583e6..aedb403 100644 (file)
@@ -142,4 +142,4 @@ protected:
 }; // IAccessibilityListener
 
 }} // Tizen::Ui
-#endif // _FUI_IACCESSIBILITY_LISTENER_H_
+#endif // _FUI_IACCESSIBILITY_LISTENER_H_
\ No newline at end of file
index 3944d38..4e30369 100644 (file)
@@ -872,6 +872,8 @@ SET (${this_target}_SOURCE_FILES
     animations/FUiAnimBoundingVolume.cpp
     animations/FUiAnim_Ray.cpp
     animations/FUiAnim_Plane.cpp
+    animations/FUiAnim_MaterialParser.cpp
+    animations/FUiAnim_LightParser.cpp
 ## TouchEffect
         FUiTouchEffect.cpp
         FUi_TouchEffectImpl.cpp
index c44f261..fa24c40 100644 (file)
 #include <FBaseSysLog.h>
 #include <FBaseString.h>
 #include <FUiAnimLight.h>
+#include <FUiAnim_LightParser.h>
 #include "FUiAnim_LightImpl.h"
 
+
 namespace Tizen { namespace Ui { namespace Animations
 {
 
@@ -337,6 +339,13 @@ Light::SetProperty(const Tizen::Base::String& name, const Tizen::Ui::Variant& va
        return __pLightImpl->SetProperty(name, value);
 }
 
+int
+Light::GetHashCode(void) const
+{
+       SysAssertf(__pLightImpl != null, "Not yet constructed.");
+       return (int) __pLightImpl;
+}
+
 Variant
 Light::GetProperty(const Tizen::Base::String& name) const
 {
@@ -344,5 +353,13 @@ Light::GetProperty(const Tizen::Base::String& name) const
        return __pLightImpl->GetProperty(name);
 }
 
+result
+Light::SaveLight(const Tizen::Base::String& fileName)
+{
+       SetLastResult(E_SUCCESS);
+       SysAssertf(__pLightImpl != null, "Not yet constructed.");
+
+       return _LightParser::SaveLight(this, fileName);
+}
 
 }}} //Tizen::Ui::Animations
index 94bff33..b3e088d 100644 (file)
@@ -26,6 +26,7 @@
 #include <FBaseString.h>
 #include "FUiAnimMaterial.h"
 #include "FUiAnim_MaterialImpl.h"
+#include "FUiAnim_MaterialParser.h"
 
 namespace Tizen { namespace Ui { namespace Animations
 {
@@ -224,6 +225,26 @@ Material::SetName(const Tizen::Base::String& name)
        return __pMaterialImpl->SetName(name);
 }
 
+
+/////
+
+float
+Material::GetEmissivePower(void) const
+{
+       SysAssertf(__pMaterialImpl != null, "Not yet constructed.");
+
+       return __pMaterialImpl->GetEmissivePower();
+}
+
+void
+Material::SetEmissivePower(const float& value)
+{
+       SysAssertf(__pMaterialImpl != null, "Not yet constructed.");
+
+       __pMaterialImpl->SetEmissivePower(value);
+}
+
+
 result
 Material::SetProperty(const Tizen::Base::String& name, const Tizen::Ui::Variant& value)
 {
@@ -239,4 +260,21 @@ Material::GetProperty(const Tizen::Base::String& name) const
        return __pMaterialImpl->GetProperty(name);
 }
 
+
+int
+Material::GetHashCode(void) const
+{
+       SysAssertf(__pMaterialImpl != null, "Not yet constructed.");
+       return (int) __pMaterialImpl;
+}
+
+result
+Material::SaveMaterial (const Tizen::Base::String& fileName)
+{
+       SetLastResult(E_SUCCESS);
+       SysAssertf(__pMaterialImpl != null, "Not yet constructed.");
+
+       return _MaterialParser::SaveMaterial(this, fileName);
+}
+
 }}} // namespace Tizen::Ui::Animations
index e1b00a6..32f16e7 100644 (file)
@@ -282,10 +282,11 @@ Mesh::GetIndexCount(void) const
 }
 
 result
-Mesh::SaveMeshToBinary(const Tizen::Base::String& fileName)
+Mesh::SaveMesh(const Tizen::Base::String& fileName)
 {
+       SetLastResult(E_SUCCESS);
        CHECK_CONSTRUCTED;
-       return __pMeshImpl->SaveMeshToBinary(fileName);
+       return __pMeshImpl->SaveMesh(fileName);
 }
 
 void
@@ -297,7 +298,14 @@ Mesh::SetName(Tizen::Base::String name)
 }
 
 Tizen::Base::String
-Mesh::GetName(void) const
+Mesh::GetName(void)
+{
+       SetLastResult(E_SUCCESS);
+       return Tizen::Base::String(__pMeshImpl->GetName().c_str());
+}
+
+Tizen::Base::String
+Mesh::GetName() const
 {
        return Tizen::Base::String(__pMeshImpl->GetName().c_str());
 }
index 9668f00..f1fee3c 100644 (file)
@@ -58,13 +58,19 @@ ModelImporter::LoadMeshN(MODEL_FORMAT modelFormat, const Tizen::Base::String& fi
                        std::string materialId;
                        pMesh = modelImporter.LoadMeshCollada(strModelName, materialId);
                }break;
-               case BIN:{
-                       pMesh = _ModelImporterImpl::LoadMeshFromBinaryN(strFileName, strModelName);
-               }break;
        }
        return pMesh;
 }
 
+Mesh*
+ModelImporter::LoadMeshN(const Tizen::Base::String& fileName)
+{
+       SetLastResult(E_SUCCESS);
+       AppLog("ModelImporter::LoadMesh::BIN");
+       Mesh* pMesh = _ModelImporterImpl::LoadMeshN(fileName);
+       return pMesh;
+}
+
 Material*
 ModelImporter::LoadMaterialN(const Tizen::Base::String& fileName, const Tizen::Base::String& materialName, Tizen::Base::String* pTextureName)
 {
@@ -85,10 +91,18 @@ ModelImporter::LoadMaterialN(const Tizen::Base::String& fileName, const Tizen::B
 }
 
 Scene*
-ModelImporter::LoadSceneN(const Tizen::Base::String& fileName, const Tizen::Base::String& sceneName)
+ModelImporter::LoadSceneN(const Tizen::Base::String& fileName, const Tizen::Base::String& sceneName, VisualElement& pSceneRootVisualElement)
 {
-       _ModelImporterImpl modelImporter(WToStd(fileName), true, true, true, true, true, true, true, false, false); //true: VisualScene, Geometries, Controllers, Animations, Materials, Effects, Images
-       return modelImporter.LoadScene(WToStd(sceneName));
+
+       _ModelImporterImpl modelImporter(WToStd(fileName), true, true, true, true, true, true, true, false, false);
+
+//#ifndef BUILD_UI_CORE
+//     _ModelImporterImpl modelImporter(WToStd(fileName), true, true, true, true, true, false, false, false, false); //true: VisualScene, Geometries, Controllers, Animations, Materials, Effects, Images
+//#else
+//     _ModelImporterImpl modelImporter(WToStd(fileName), true, true, false, false, true, true, false, false, false); //true: VisualScene, Geometries, Controllers, Animations, Materials, Effects, Images
+//#endif
+
+       return modelImporter.LoadScene(WToStd(sceneName), pSceneRootVisualElement);
 }
 
 }}}
index c48e8f7..a981f47 100644 (file)
  * This file contains implementation Scene class.
  */
 
+#include "FBaseSysLog.h"
 #include "FUiAnimScene.h"
 #include "FUiAnim_SceneImpl.h"
 
-#include <string>
-
 namespace Tizen { namespace Ui { namespace Animations {
 
+using namespace Tizen::Base;
+using namespace Tizen::Ui::Animations;
+
 Scene::Scene(void)
+       : __pSceneImpl(null)
 {
-       _pSceneImpl = new (std::nothrow) _SceneImpl();
+
 }
 
 Scene::~Scene(void)
 {
-       delete _pSceneImpl;
-       _pSceneImpl = null;
+       if (__pSceneImpl != null)
+       {
+               delete __pSceneImpl;
+               __pSceneImpl = null;
+       }
 }
 
 result
-Scene::Construct()
+Scene::Construct(VisualElement& pSceneRootVisualElement)
 {
-       return _pSceneImpl->Construct();
+       ClearLastResult();
+       SysAssertf(__pSceneImpl == null,
+                                       "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");
+
+       __pSceneImpl = new (std::nothrow) _SceneImpl();
+       SysTryReturnResult(NID_UI_ANIM, __pSceneImpl != null, E_OUT_OF_MEMORY, "Memory allocation failed. Failed to create _SceneImpl instance");
+
+       result r = __pSceneImpl->Construct(pSceneRootVisualElement);
+       SysTryReturnResult(NID_UI_ANIM, r == E_SUCCESS, r, "Propagating.");
+
+       return E_SUCCESS;
 }
 
 VisualElement*
 Scene::GetRootVisualElement(void) const
 {
-       SetLastResult(E_SUCCESS);
-       return _pSceneImpl->GetRootVisualElement();
+       ClearLastResult();
+       SysAssertf(__pSceneImpl != null,
+               "Not yet constructed. Construct() should be called before use.");
+       return __pSceneImpl->GetRootVisualElement();
+}
+
+result
+Scene::SetName(const Tizen::Base::String& sceneName)
+{
+       ClearLastResult();
+       SysAssertf(__pSceneImpl != null,
+               "Not yet constructed. Construct() should be called before use.");
+       return __pSceneImpl->SetName(sceneName);
+}
+
+Tizen::Base::String
+Scene::GetName(void) const
+{
+       ClearLastResult();
+       SysAssertf(__pSceneImpl != null,
+               "Not yet constructed. Construct() should be called before use.");
+       return __pSceneImpl->GetName();
+}
+
+result
+Scene::ResetScene(void)
+{
+       ClearLastResult();
+       SysAssertf(__pSceneImpl != null,
+               "Not yet constructed. Construct() should be called before use.");
+       return __pSceneImpl->ResetScene();
+}
+
+//----------Mesh
+result
+Scene::AddMesh(const Mesh* pMesh)
+{
+       ClearLastResult();
+       SysAssertf(__pSceneImpl != null,
+               "Not yet constructed. Construct() should be called before use.");
+       return __pSceneImpl->AddMesh(pMesh);
 }
 
+//result
+//Scene::RemoveMesh(const Tizen::Base::String meshName)
+//{
+//     ClearLastResult();
+//     SysAssertf(__pSceneImpl != null,
+//             "Not yet constructed. Construct() should be called before use.");
+//     return __pSceneImpl->RemoveMesh(meshName);
+//}
+
 result
-Scene::AddMesh(Mesh* pMesh)
+Scene::RemoveMesh(const Mesh* pMesh)
 {
-       SetLastResult(E_SUCCESS);
-       return _pSceneImpl->AddMesh(pMesh);
+       ClearLastResult();
+       SysAssertf(__pSceneImpl != null,
+               "Not yet constructed. Construct() should be called before use.");
+       return __pSceneImpl->RemoveMesh(pMesh);
 }
 
 result
-Scene::RemoveMesh(Tizen::Base::String meshName)
+Scene::RemoveAllMesh(void)
+{
+       ClearLastResult();
+       SysAssertf(__pSceneImpl != null,
+               "Not yet constructed. Construct() should be called before use.");
+       return __pSceneImpl->RemoveAllMesh();
+}
+
+Mesh*
+Scene::GetMeshN(const Tizen::Base::String meshName) const
+{
+       ClearLastResult();
+       SysAssertf(__pSceneImpl != null,
+               "Not yet constructed. Construct() should be called before use.");
+       return __pSceneImpl->GetMeshN(meshName);
+}
+
+//int
+//Scene::ContainsMesh(const Tizen::Base::String meshName) const //index = [0,n-1], or -1 if not exist
+//{
+//     ClearLastResult();
+//     SysAssertf(__pSceneImpl != null,
+//             "Not yet constructed. Construct() should be called before use.");
+//     return __pSceneImpl->ContainsMesh(meshName);
+//}
+
+int
+Scene::ContainsMesh(const Mesh* pMesh) const //index = [0,n-1], or -1 if not exist
 {
-       SetLastResult(E_SUCCESS);
-       std::wstring wStr(meshName.GetPointer());
-       std::string str(wStr.begin(), wStr.end());
-       return _pSceneImpl->RemoveMesh(str);
+       ClearLastResult();
+       SysAssertf(__pSceneImpl != null,
+               "Not yet constructed. Construct() should be called before use.");
+       return __pSceneImpl->ContainsMesh(pMesh);
+}
+
+int
+Scene::GetMeshCount(void) const
+{
+       ClearLastResult();
+       SysAssertf(__pSceneImpl != null,
+               "Not yet constructed. Construct() should be called before use.");
+       return __pSceneImpl->GetMeshCount();
 }
 
 Mesh*
-Scene::GetMeshN(Tizen::Base::String meshName) const
+Scene::GetMeshAtN(int index) const
+{
+       ClearLastResult();
+       SysAssertf(__pSceneImpl != null,
+               "Not yet constructed. Construct() should be called before use.");
+       return __pSceneImpl->GetMeshAtN(index);
+}
+
+Tizen::Base::String
+Scene::GetMeshNameAt(int index) const
 {
-       SetLastResult(E_SUCCESS);
-       std::wstring wStr(meshName.GetPointer());
-       std::string str(wStr.begin(), wStr.end());
-       return _pSceneImpl->GetMeshN(str);
+       ClearLastResult();
+       SysAssertf(__pSceneImpl != null,
+               "Not yet constructed. Construct() should be called before use.");
+       return __pSceneImpl->GetMeshNameAt(index);
 }
 
-Tizen::Base::Collection::ArrayList*
-Scene::GetMeshNamesN(void) const
+//----------Material
+result
+Scene::AddMaterial(const Material* pMaterial)
 {
-       SetLastResult(E_SUCCESS);
-       return _pSceneImpl->GetMeshNamesN();
+       ClearLastResult();
+       SysAssertf(__pSceneImpl != null,
+               "Not yet constructed. Construct() should be called before use.");
+       return __pSceneImpl->AddMaterial(pMaterial);
 }
 
+//result
+//Scene::RemoveMaterial(const Tizen::Base::String materialName)
+//{
+//     ClearLastResult();
+//     SysAssertf(__pSceneImpl != null,
+//             "Not yet constructed. Construct() should be called before use.");
+//     return __pSceneImpl->RemoveMaterial(materialName);
+//}
+
 result
-Scene::AddMaterial(Material* pMaterial)
+Scene::RemoveMaterial(const Material* pMaterial)
 {
-       SetLastResult(E_SUCCESS);
-       return _pSceneImpl->AddMaterial(pMaterial);
+       ClearLastResult();
+       SysAssertf(__pSceneImpl != null,
+               "Not yet constructed. Construct() should be called before use.");
+       return __pSceneImpl->RemoveMaterial(pMaterial);
 }
 
 result
-Scene::RemoveMaterial(Tizen::Base::String materialName)
+Scene::RemoveAllMaterial(void)
+{
+       ClearLastResult();
+       SysAssertf(__pSceneImpl != null,
+               "Not yet constructed. Construct() should be called before use.");
+       return __pSceneImpl->RemoveAllMaterial();
+}
+
+Material*
+Scene::GetMaterialN(const Tizen::Base::String materialName) const
+{
+       ClearLastResult();
+       SysAssertf(__pSceneImpl != null,
+               "Not yet constructed. Construct() should be called before use.");
+       return __pSceneImpl->GetMaterialN(materialName);
+}
+
+//int
+//Scene::ContainsMaterial(const Tizen::Base::String materialName) const //index = [0,n-1], or -1 if not exist
+//{
+//     ClearLastResult();
+//     SysAssertf(__pSceneImpl != null,
+//             "Not yet constructed. Construct() should be called before use.");
+//     return __pSceneImpl->ContainsMaterial(materialName);
+//}
+
+int
+Scene::ContainsMaterial(const Material* pMaterial) const //index = [0,n-1], or -1 if not exist
+{
+       ClearLastResult();
+       SysAssertf(__pSceneImpl != null,
+               "Not yet constructed. Construct() should be called before use.");
+       return __pSceneImpl->ContainsMaterial(pMaterial);
+}
+
+int
+Scene::GetMaterialCount(void) const
 {
-       SetLastResult(E_SUCCESS);
-       std::wstring wStr(materialName.GetPointer());
-       std::string str(wStr.begin(), wStr.end());
-       return _pSceneImpl->RemoveMaterial(str);
+       ClearLastResult();
+       SysAssertf(__pSceneImpl != null,
+               "Not yet constructed. Construct() should be called before use.");
+       return __pSceneImpl->GetMaterialCount();
 }
 
 Material*
-Scene::GetMaterialN(Tizen::Base::String materialName) const
+Scene::GetMaterialAtN(int index) const
 {
-       SetLastResult(E_SUCCESS);
-       std::wstring wStr(materialName.GetPointer());
-       std::string str(wStr.begin(), wStr.end());
-       return _pSceneImpl->GetMaterialN(str);
+       ClearLastResult();
+       SysAssertf(__pSceneImpl != null,
+               "Not yet constructed. Construct() should be called before use.");
+       return __pSceneImpl->GetMaterialAtN(index);
 }
 
-Tizen::Base::Collection::ArrayList*
-Scene::GetMaterialNamesN(void) const
+Tizen::Base::String
+Scene::GetMaterialNameAt(int index) const
 {
-       SetLastResult(E_SUCCESS);
-       return _pSceneImpl->GetMaterialNamesN();
+       ClearLastResult();
+       SysAssertf(__pSceneImpl != null,
+               "Not yet constructed. Construct() should be called before use.");
+       return __pSceneImpl->GetMaterialNameAt(index);
 }
+//----------Light
+result
+Scene::AddLight(const Light* pLight)
+{
+       ClearLastResult();
+       SysAssertf(__pSceneImpl != null,
+               "Not yet constructed. Construct() should be called before use.");
+       return __pSceneImpl->AddLight(pLight);
+}
+
+//result
+//Scene::RemoveLight(const Tizen::Base::String lightName)
+//{
+//     ClearLastResult();
+//     SysAssertf(__pSceneImpl != null,
+//             "Not yet constructed. Construct() should be called before use.");
+//     return __pSceneImpl->RemoveLight(lightName);
+//}
 
 result
-Scene::AddTextureFileName(Tizen::Base::String textureFileName)
+Scene::RemoveLight(const Light* pLight)
 {
-       SetLastResult(E_SUCCESS);
-       std::wstring wStr(textureFileName.GetPointer());
-       std::string str(wStr.begin(), wStr.end());
-       return _pSceneImpl->AddTextureFileName(str);
+       ClearLastResult();
+       SysAssertf(__pSceneImpl != null,
+               "Not yet constructed. Construct() should be called before use.");
+       return __pSceneImpl->RemoveLight(pLight);
 }
 
-Tizen::Base::Collection::ArrayList*
-Scene::GetTextureFileNamesN(void) const
+result
+Scene::RemoveAllLight(void)
+{
+       ClearLastResult();
+       SysAssertf(__pSceneImpl != null,
+               "Not yet constructed. Construct() should be called before use.");
+       return __pSceneImpl->RemoveAllLight();
+}
+
+Light*
+Scene::GetLightN(const Tizen::Base::String lightName) const
 {
-       SetLastResult(E_SUCCESS);
-       return _pSceneImpl->GetTextureFileNamesN();
+       ClearLastResult();
+       SysAssertf(__pSceneImpl != null,
+               "Not yet constructed. Construct() should be called before use.");
+       return __pSceneImpl->GetLightN(lightName);
 }
 
+//int
+//Scene::ContainsLight(const Tizen::Base::String lightName) const //index = [0,n-1], or -1 if not exist
+//{
+//     ClearLastResult();
+//     SysAssertf(__pSceneImpl != null,
+//             "Not yet constructed. Construct() should be called before use.");
+//     return __pSceneImpl->ContainsLight(lightName);
+//}
+
+int
+Scene::ContainsLight(const Light* pLight) const //index = [0,n-1], or -1 if not exist
+{
+       ClearLastResult();
+       SysAssertf(__pSceneImpl != null,
+               "Not yet constructed. Construct() should be called before use.");
+       return __pSceneImpl->ContainsLight(pLight);
+}
+
+int
+Scene::GetLightCount(void) const
+{
+       ClearLastResult();
+       SysAssertf(__pSceneImpl != null,
+               "Not yet constructed. Construct() should be called before use.");
+       return __pSceneImpl->GetLightCount();
+}
+
+Light*
+Scene::GetLightAtN(int index) const
+{
+       ClearLastResult();
+       SysAssertf(__pSceneImpl != null,
+               "Not yet constructed. Construct() should be called before use.");
+       return __pSceneImpl->GetLightAtN(index);
+}
+
+Tizen::Base::String
+Scene::GetLightNameAt(int index) const
+{
+       ClearLastResult();
+       SysAssertf(__pSceneImpl != null,
+               "Not yet constructed. Construct() should be called before use.");
+       return __pSceneImpl->GetLightNameAt(index);
+}
+//----------ShaderProgram
+ShaderProgram*
+Scene::AddShaderProgramN(const String shaderProgramName, const char* vertexShader, const char* fragmentShader)
+{
+       ClearLastResult();
+       SysAssertf(__pSceneImpl != null,
+               "Not yet constructed. Construct() should be called before use.");
+       return __pSceneImpl->AddShaderProgramN(shaderProgramName, vertexShader, fragmentShader);
+}
+
+//result
+//Scene::RemoveShaderProgram(const Tizen::Base::String shaderProgramName)
+//{
+//     ClearLastResult();
+//     SysAssertf(__pSceneImpl != null,
+//             "Not yet constructed. Construct() should be called before use.");
+//     return __pSceneImpl->RemoveShaderProgram(shaderProgramName);
+//}
+
+result
+Scene::RemoveShaderProgram(const ShaderProgram* pShaderProgram)
+{
+       ClearLastResult();
+       SysAssertf(__pSceneImpl != null,
+               "Not yet constructed. Construct() should be called before use.");
+       return __pSceneImpl->RemoveShaderProgram(pShaderProgram);
+}
+
+result
+Scene::RemoveAllShaderProgram(void)
+{
+       ClearLastResult();
+       SysAssertf(__pSceneImpl != null,
+               "Not yet constructed. Construct() should be called before use.");
+       return __pSceneImpl->RemoveAllShaderProgram();
+}
+
+ShaderProgram*
+Scene::GetShaderProgramN(const Tizen::Base::String shaderProgramName) const
+{
+       ClearLastResult();
+       SysAssertf(__pSceneImpl != null,
+               "Not yet constructed. Construct() should be called before use.");
+       return __pSceneImpl->GetShaderProgramN(shaderProgramName);
+}
+
+//int
+//Scene::ContainsShaderProgram(const Tizen::Base::String shaderProgramName) const //index = [0,n-1], or -1 if not exist
+//{
+//     ClearLastResult();
+//     SysAssertf(__pSceneImpl != null,
+//             "Not yet constructed. Construct() should be called before use.");
+//     return __pSceneImpl->ContainsShaderProgram(shaderProgramName);
+//}
+
+int
+Scene::ContainsShaderProgram(const ShaderProgram* pShaderProgram) const //index = [0,n-1], or -1 if not exist
+{
+       ClearLastResult();
+       SysAssertf(__pSceneImpl != null,
+               "Not yet constructed. Construct() should be called before use.");
+       return __pSceneImpl->ContainsShaderProgram(pShaderProgram);
+}
+
+int
+Scene::GetShaderProgramCount(void) const
+{
+       ClearLastResult();
+       SysAssertf(__pSceneImpl != null,
+               "Not yet constructed. Construct() should be called before use.");
+       return __pSceneImpl->GetShaderProgramCount();
+}
+
+ShaderProgram*
+Scene::GetShaderProgramAtN(int index) const
+{
+       ClearLastResult();
+       SysAssertf(__pSceneImpl != null,
+               "Not yet constructed. Construct() should be called before use.");
+       return __pSceneImpl->GetShaderProgramAtN(index);
+}
+
+Tizen::Base::String
+Scene::GetShaderProgramNameAt(int index) const
+{
+       ClearLastResult();
+       SysAssertf(__pSceneImpl != null,
+               "Not yet constructed. Construct() should be called before use.");
+       return __pSceneImpl->GetShaderProgramNameAt(index);
+}
+
+//------------Texture
+
+result
+Scene::AddTextureFileName(const Tizen::Base::String textureFileName)
+{
+       ClearLastResult();
+       SysAssertf(__pSceneImpl != null,
+               "Not yet constructed. Construct() should be called before use.");
+       return __pSceneImpl->AddTextureFileName(textureFileName);
+}
+
+int
+Scene::GetTextureFileNameCount(void) const
+{
+       ClearLastResult();
+       SysAssertf(__pSceneImpl != null,
+               "Not yet constructed. Construct() should be called before use.");
+       return __pSceneImpl->GetTextureFileNameCount();
+}
+
+Tizen::Base::String
+Scene::GetTextureFileNameAt(int index) const
+{
+       ClearLastResult();
+       SysAssertf(__pSceneImpl != null,
+               "Not yet constructed. Construct() should be called before use.");
+       return __pSceneImpl->GetTextureFileNameAt(index);
+}
+
+result
+Scene::RemoveTextureFileNameAt(int index)
+{
+       ClearLastResult();
+       SysAssertf(__pSceneImpl != null,
+               "Not yet constructed. Construct() should be called before use.");
+       return __pSceneImpl->RemoveTextureFileNameAt(index);
+}
+
+result
+Scene::RemoveAllTextureFileName(void)
+{
+       ClearLastResult();
+       SysAssertf(__pSceneImpl != null,
+               "Not yet constructed. Construct() should be called before use.");
+       return __pSceneImpl->RemoveAllTextureFileName();
+}
+
+result
+Scene::SaveScene(const Tizen::Base::String filesPath, const Tizen::Base::String resourceFilesPath,  const Tizen::Base::String scenePrefix) const
+{
+       ClearLastResult();
+       SysAssertf(__pSceneImpl != null,
+               "Not yet constructed. Construct() should be called before use.");
+       return __pSceneImpl->SaveScene(filesPath, resourceFilesPath,  scenePrefix);
+}
 
 }}} //Tizen::Ui::Animations
index 708f0c0..ea74112 100644 (file)
@@ -104,6 +104,35 @@ ShaderProgram::Equals(const ShaderProgram& obj) const
        return __pShaderProgramImpl->Equals(obj);
 }
 
+Tizen::Base::String
+ShaderProgram::GetName(void) const
+{
+       ClearLastResult();
+       SysAssertf(__pShaderProgramImpl != null,
+                                               "Not yet constructed. Construct() should be called before use.");
+
+       return __pShaderProgramImpl->GetName();
+}
+
+result
+ShaderProgram::SetName(const Tizen::Base::String name)
+{
+       ClearLastResult();
+       SysAssertf(__pShaderProgramImpl != null,
+                                               "Not yet constructed. Construct() should be called before use.");
+
+       return __pShaderProgramImpl->SetName(name);
+}
+
+int
+ShaderProgram::GetHashCode(void) const
+{
+       ClearLastResult();
+       SysAssertf(__pShaderProgramImpl != null,
+                                               "Not yet constructed. Construct() should be called before use.");
+       return (int) __pShaderProgramImpl;
+}
+
 result
 ShaderProgram::SetProperty(const Tizen::Base::String& name, const Variant& value)
 {
diff --git a/src/ui/animations/FUiAnim_LightParser.cpp b/src/ui/animations/FUiAnim_LightParser.cpp
new file mode 100644 (file)
index 0000000..ca84b06
--- /dev/null
@@ -0,0 +1,376 @@
+//
+// Open Service Platform
+// Copyright (c) 2013 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.
+//
+
+/**
+ * @file       FUiAnim_LightParser.cpp
+ * @brief      This file contains implementation of the _LightParser class.
+ *
+ * This file contains implementation of the _LightParser class.
+ */
+
+#include <FApp.h>
+#include <FBase.h>
+#include <FBaseSysLog.h>
+#include <FGrpFloatVector4.h>
+#include <FGrpFloatPoint3.h>
+#include <FUiAnimLight.h>
+#include "FUiAnim_LightParser.h"
+#include <libxml/parser.h>
+#include <libxml/tree.h>
+#include <libxml/xmlstring.h>
+#include <libxml/xmlwriter.h>
+#include <libxml/xmlreader.h>
+#include <libxml/xpath.h>
+#include <stdlib.h>
+#include <FIo.h>
+#include <algorithm>
+
+
+using namespace Tizen::Ui;
+using namespace Tizen::App;
+using namespace Tizen::Base;
+using namespace Tizen::Io;
+using namespace Tizen::Graphics;
+using namespace Tizen::Base::Utility;
+
+namespace Tizen { namespace Ui { namespace Animations
+{
+
+#define FLOAT_VECTOR_FOUR_SIZE 4
+#define FLOAT_VECTOR_THREE_SIZE 3
+
+bool _LightParser::_lightIsEnabled = false;
+
+float TizenStringToFloat(Tizen::Base::String& strbuf)
+{
+    std::wstringstream converter;
+    float value = 0;
+
+    converter.precision(FLOAT_VECTOR_FOUR_SIZE);
+    converter.fill('0');
+    converter.setf( std::ios::fixed, std::ios::floatfield );
+
+    converter << strbuf.GetPointer();
+    converter >> value;
+    return value;
+}
+
+void StringToTizenString(Tizen::Base::String& ws, const std::string s)
+{
+       Tizen::Base::String wsTmp(s.c_str());
+       ws = wsTmp;
+}
+
+void
+StartElement(void *ctx,        const xmlChar *name, const xmlChar **atts)
+{
+       std::string TagName((char*)name);
+       std::transform(TagName.begin(), TagName.end(), TagName.begin(), ::tolower);
+
+       Tizen::Base::String arrayAttributes[FLOAT_VECTOR_FOUR_SIZE];
+       int countArrayAttributes = 0;
+
+       Light* pParsingForLight = (Light*) ctx;
+
+       if (atts != null)
+       {
+               int j = 1;
+               while (atts[j] != null)
+               {
+                       if (countArrayAttributes < FLOAT_VECTOR_FOUR_SIZE)
+                       {
+                               StringToTizenString(arrayAttributes[countArrayAttributes], std::string((char*) atts[j]));
+                       }
+                       j += 2;
+                       countArrayAttributes++;
+        }
+       }
+       if (TagName.compare("ambient") == 0)
+               {
+                       SysTryReturnVoidResult(NID_UI_ANIM, countArrayAttributes == FLOAT_VECTOR_FOUR_SIZE, E_OUT_OF_RANGE, " Ambient attributes don't suitable, must be four instead there are (%d)", countArrayAttributes);
+                       pParsingForLight->SetAmbient(Tizen::Graphics::FloatVector4(TizenStringToFloat(arrayAttributes[0]), TizenStringToFloat(arrayAttributes[1]), TizenStringToFloat(arrayAttributes[2]), TizenStringToFloat(arrayAttributes[3])));
+               }
+       else if (TagName.compare("diffuse") == 0)
+                       {
+                               SysTryReturnVoidResult(NID_UI_ANIM, countArrayAttributes == FLOAT_VECTOR_FOUR_SIZE, E_OUT_OF_RANGE, " Diffuse attributes don't suitable, must be four instead there are (%d)", countArrayAttributes);
+                               pParsingForLight->SetDiffuse(Tizen::Graphics::FloatVector4(TizenStringToFloat(arrayAttributes[0]), TizenStringToFloat(arrayAttributes[1]), TizenStringToFloat(arrayAttributes[2]), TizenStringToFloat(arrayAttributes[3])));
+                       }
+       else if (TagName.compare("specular") == 0)
+                       {
+                               SysTryReturnVoidResult(NID_UI_ANIM, countArrayAttributes == FLOAT_VECTOR_FOUR_SIZE, E_OUT_OF_RANGE, " Specular attributes don't suitable, must be four instead there are (%d)", countArrayAttributes);
+                               pParsingForLight->SetSpecular(Tizen::Graphics::FloatVector4(TizenStringToFloat(arrayAttributes[0]), TizenStringToFloat(arrayAttributes[1]), TizenStringToFloat(arrayAttributes[2]), TizenStringToFloat(arrayAttributes[3])));
+                       }
+       else if (TagName.compare("position") == 0)
+                       {
+                               SysTryReturnVoidResult(NID_UI_ANIM, countArrayAttributes == FLOAT_VECTOR_FOUR_SIZE, E_OUT_OF_RANGE, " Position attributes don't suitable, must be four instead there are (%d)", countArrayAttributes);
+                               pParsingForLight->SetPosition(Tizen::Graphics::FloatVector4(TizenStringToFloat(arrayAttributes[0]), TizenStringToFloat(arrayAttributes[1]), TizenStringToFloat(arrayAttributes[2]), TizenStringToFloat(arrayAttributes[3])));
+                       }
+       else if (TagName.compare("direction") == 0)
+                       {
+                               SysTryReturnVoidResult(NID_UI_ANIM, countArrayAttributes == FLOAT_VECTOR_THREE_SIZE, E_OUT_OF_RANGE, " Direction attributes don't suitable, must be one instead there are (%d)", countArrayAttributes);
+                               pParsingForLight->SetDirection(Tizen::Graphics::FloatPoint3(TizenStringToFloat(arrayAttributes[0]), TizenStringToFloat(arrayAttributes[1]), TizenStringToFloat(arrayAttributes[2])));
+                       }
+       else if (TagName.compare("attenuation") == 0)
+                       {
+                               SysTryReturnVoidResult(NID_UI_ANIM, countArrayAttributes == FLOAT_VECTOR_THREE_SIZE, E_OUT_OF_RANGE, " Attenuation attributes don't suitable, must be one instead there are (%d)", countArrayAttributes);
+                               pParsingForLight->SetConstantAttenuation(TizenStringToFloat(arrayAttributes[0]));
+                               pParsingForLight->SetLinearAttenuation(TizenStringToFloat(arrayAttributes[1]));
+                               pParsingForLight->SetQuadraticAttenuation(TizenStringToFloat(arrayAttributes[2]));
+                       }
+       else if (TagName.compare("exponent") == 0)
+                       {
+                               SysTryReturnVoidResult(NID_UI_ANIM, countArrayAttributes == 1, E_OUT_OF_RANGE, " Exponent attributes don't suitable, must be one instead there are (%d)", countArrayAttributes);
+                               pParsingForLight->SetExponent(TizenStringToFloat(arrayAttributes[0]));
+                       }
+       else if (TagName.compare("cutoff") == 0)
+                       {
+                               SysTryReturnVoidResult(NID_UI_ANIM, countArrayAttributes == 1, E_OUT_OF_RANGE, " Cutoff attributes don't suitable, must be one instead there are (%d)", countArrayAttributes);
+                               pParsingForLight->SetCutOff(TizenStringToFloat(arrayAttributes[0]));
+                       }
+       else if (TagName.compare("lightname") == 0)
+                       {
+                               SysTryReturnVoidResult(NID_UI_ANIM, countArrayAttributes == 1, E_OUT_OF_RANGE, " LightName attributes don't suitable, must be one instead there are (%d)", countArrayAttributes);
+                               pParsingForLight->SetName(arrayAttributes[0]);
+                       }
+       else if (TagName.compare("light") == 0)
+                       {
+                               _LightParser::_lightIsEnabled = true;
+                       }
+       else if (TagName.compare("lighttype") == 0)
+                       {
+                               SysTryReturnVoidResult(NID_UI_ANIM, countArrayAttributes == 1, E_OUT_OF_RANGE, " Lighttype attributes don't suitable, must be one instead there are (%d)", countArrayAttributes);
+                               std::wstring wStr(arrayAttributes[0].GetPointer());
+                               std::string str(wStr.begin(), wStr.end());
+                               pParsingForLight->SetType(static_cast<Light::LightType>(atoi(str.c_str())));
+                       }
+       else if (TagName.compare("enabled") == 0)
+                       {
+                               SysTryReturnVoidResult(NID_UI_ANIM, countArrayAttributes == 1, E_OUT_OF_RANGE, " Enabled attributes don't suitable, must be one instead there are (%d)",  countArrayAttributes);
+                               pParsingForLight->SetEnabled((arrayAttributes[0].CompareTo("true") == 0)?1:0);
+                       }
+}
+
+result
+_LightParser::SaveLight (Light* pThis, const Tizen::Base::String& fileName)
+{
+               int rc;
+               std::wstring wStr(fileName.GetPointer());
+               std::string strFileName(wStr.begin(), wStr.end());
+
+               xmlTextWriterPtr writer = xmlNewTextWriterFilename((const char*) strFileName.c_str(), 0);
+
+               xmlError* err = xmlGetLastError();
+               SysTryCatch(NID_UI_ANIM, writer != null, , E_OPERATION_FAILED , "xmlNewTextWriterFilename Failed! %s", err->message);
+               rc = xmlTextWriterStartDocument(writer, null, "UTF-8", null);
+               err = xmlGetLastError();
+               SysTryCatch(NID_UI_ANIM, rc >= 0, , E_OPERATION_FAILED, "xmlTextWriterStartDocument Failed! %s", err->message);
+                       rc = xmlTextWriterStartElement(writer, (xmlChar*) "Light");
+                       err = xmlGetLastError();
+                       SysTryCatch(NID_UI_ANIM, rc >= 0, , E_OPERATION_FAILED, "xmlTextWriterStartElementLight Failed! %s", err->message);
+
+                       rc = xmlTextWriterStartElement(writer, (xmlChar*) "LightType");
+                       err = xmlGetLastError();
+                       SysTryCatch(NID_UI_ANIM, rc >= 0, , E_OPERATION_FAILED, "xmlTextWriterStartElementLightType Failed! %s", err->message);
+
+                               rc = xmlTextWriterWriteFormatAttribute(writer, (xmlChar*) "lightType", "%d", static_cast<int>(pThis->GetType()));
+                               rc = xmlTextWriterWriteString(writer, (xmlChar*) "");
+
+                       rc = xmlTextWriterEndElement(writer);//end of LightType
+                       err = xmlGetLastError();
+                       SysTryCatch(NID_UI_ANIM, rc >= 0, , E_OPERATION_FAILED, "xmlTextWriterEndElementLightType Failed! %s", err->message);
+
+                               rc = xmlTextWriterStartElement(writer, (xmlChar*) "Ambient");
+                               err = xmlGetLastError();
+                               SysTryCatch(NID_UI_ANIM, rc >= 0, , E_OPERATION_FAILED, "xmlTextWriterStartElementAmbient Failed! %s", err->message);
+
+                                       rc = xmlTextWriterWriteFormatAttribute(writer, (xmlChar*) "x", "%f", pThis->GetAmbient().x);
+                                       rc = xmlTextWriterWriteFormatAttribute(writer, (xmlChar*) "y", "%f", pThis->GetAmbient().y);
+                                       rc = xmlTextWriterWriteFormatAttribute(writer, (xmlChar*) "z", "%f", pThis->GetAmbient().z);
+                                       rc = xmlTextWriterWriteFormatAttribute(writer, (xmlChar*) "w", "%f", pThis->GetAmbient().w);
+                                       rc = xmlTextWriterWriteString(writer, (xmlChar*) "");
+
+                               rc = xmlTextWriterEndElement(writer);//end of Ambient
+                               err = xmlGetLastError();
+                               SysTryCatch(NID_UI_ANIM, rc >= 0, , E_OPERATION_FAILED, "xmlTextWriterEndElementAmbient Failed! %s", err->message);
+
+                               rc = xmlTextWriterStartElement(writer, (xmlChar*) "Diffuse");
+                               err = xmlGetLastError();
+                               SysTryCatch(NID_UI_ANIM, rc >= 0, , E_OPERATION_FAILED, "xmlTextWriterStartElementDiffuse Failed! %s", err->message);
+
+                                       rc = xmlTextWriterWriteFormatAttribute(writer, (xmlChar*) "x", "%f", pThis->GetDiffuse().x);
+                                       rc = xmlTextWriterWriteFormatAttribute(writer, (xmlChar*) "y", "%f", pThis->GetDiffuse().y);
+                                       rc = xmlTextWriterWriteFormatAttribute(writer, (xmlChar*) "z", "%f", pThis->GetDiffuse().z);
+                                       rc = xmlTextWriterWriteFormatAttribute(writer, (xmlChar*) "w", "%f", pThis->GetDiffuse().w);
+                                       rc = xmlTextWriterWriteString(writer, (xmlChar*) "");
+
+                               rc = xmlTextWriterEndElement(writer);//end of Diffuse
+                               err = xmlGetLastError();
+                               SysTryCatch(NID_UI_ANIM, rc >= 0, , E_OPERATION_FAILED, "xmlTextWriterEndElementDiffuse Failed! %s", err->message);
+
+                               rc = xmlTextWriterStartElement(writer, (xmlChar*) "Specular");
+                               err = xmlGetLastError();
+                               SysTryCatch(NID_UI_ANIM, rc >= 0, , E_OPERATION_FAILED, "xmlTextWriterStartElementSpecular Failed! %s", err->message);
+
+                                       rc = xmlTextWriterWriteFormatAttribute(writer, (xmlChar*) "x", "%f", pThis->GetSpecular().x);
+                                       rc = xmlTextWriterWriteFormatAttribute(writer, (xmlChar*) "y", "%f", pThis->GetSpecular().y);
+                                       rc = xmlTextWriterWriteFormatAttribute(writer, (xmlChar*) "z", "%f", pThis->GetSpecular().z);
+                                       rc = xmlTextWriterWriteFormatAttribute(writer, (xmlChar*) "w", "%f", pThis->GetSpecular().w);
+                                       rc = xmlTextWriterWriteString(writer, (xmlChar*) "");
+
+                               rc = xmlTextWriterEndElement(writer);//end of Specular
+                               err = xmlGetLastError();
+                               SysTryCatch(NID_UI_ANIM, rc >= 0, , E_OPERATION_FAILED, "xmlTextWriterEndElementSpecular Failed! %s", err->message);
+
+                               rc = xmlTextWriterStartElement(writer, (xmlChar*) "Position");
+                               err = xmlGetLastError();
+                               SysTryCatch(NID_UI_ANIM, rc >= 0, , E_OPERATION_FAILED, "xmlTextWriterStartElementPosition Failed! %s", err->message);
+
+                                       rc = xmlTextWriterWriteFormatAttribute(writer, (xmlChar*) "x", "%f", pThis->GetPosition().x);
+                                       rc = xmlTextWriterWriteFormatAttribute(writer, (xmlChar*) "y", "%f", pThis->GetPosition().y);
+                                       rc = xmlTextWriterWriteFormatAttribute(writer, (xmlChar*) "z", "%f", pThis->GetPosition().z);
+                                       rc = xmlTextWriterWriteFormatAttribute(writer, (xmlChar*) "w", "%f", pThis->GetPosition().w);
+                                       rc = xmlTextWriterWriteString(writer, (xmlChar*) "");
+
+                               rc = xmlTextWriterEndElement(writer);//end of Position
+                               err = xmlGetLastError();
+                               SysTryCatch(NID_UI_ANIM, rc >= 0, , E_OPERATION_FAILED, "xmlTextWriterEndElementPosition Failed! %s", err->message);
+
+                               rc = xmlTextWriterStartElement(writer, (xmlChar*) "Direction");
+                               err = xmlGetLastError();
+                               SysTryCatch(NID_UI_ANIM, rc >= 0, , E_OPERATION_FAILED, "xmlTextWriterStartElementDirection Failed! %s", err->message);
+
+                                       rc = xmlTextWriterWriteFormatAttribute(writer, (xmlChar*) "x", "%f", pThis->GetDirection().x);
+                                       rc = xmlTextWriterWriteFormatAttribute(writer, (xmlChar*) "y", "%f", pThis->GetDirection().y);
+                                       rc = xmlTextWriterWriteFormatAttribute(writer, (xmlChar*) "z", "%f", pThis->GetDirection().z);
+                                       rc = xmlTextWriterWriteString(writer, (xmlChar*) "");
+
+                               rc = xmlTextWriterEndElement(writer);//end of Direction
+                               err = xmlGetLastError();
+                               SysTryCatch(NID_UI_ANIM, rc >= 0, , E_OPERATION_FAILED, "xmlTextWriterEndElementDirection Failed! %s", err->message);
+
+                               rc = xmlTextWriterStartElement(writer, (xmlChar*) "Attenuation");
+                               err = xmlGetLastError();
+                               SysTryCatch(NID_UI_ANIM, rc >= 0, , E_OPERATION_FAILED, "xmlTextWriterStartElementAttenuation Failed! %s", err->message);
+
+                                       rc = xmlTextWriterWriteFormatAttribute(writer, (xmlChar*) "constAttenuation", "%f", pThis->GetConstantAttenuation());
+                                       rc = xmlTextWriterWriteFormatAttribute(writer, (xmlChar*) "linearAttenuation", "%f", pThis->GetLinearAttenuation());
+                                       rc = xmlTextWriterWriteFormatAttribute(writer, (xmlChar*) "quadraticAttenuation", "%f", pThis->GetQuadraticAttenuation());
+                                       rc = xmlTextWriterWriteString(writer, (xmlChar*) "");
+
+                               rc = xmlTextWriterEndElement(writer);//end of Attenuation
+                               err = xmlGetLastError();
+                               SysTryCatch(NID_UI_ANIM, rc >= 0, , E_OPERATION_FAILED, "xmlTextWriterEndElementAttenuation Failed! %s", err->message);
+
+                               rc = xmlTextWriterStartElement(writer, (xmlChar*) "Exponent");
+                               err = xmlGetLastError();
+                               SysTryCatch(NID_UI_ANIM, rc >= 0, , E_OPERATION_FAILED, "xmlTextWriterStartElementExponent Failed! %s", err->message);
+
+                                       rc = xmlTextWriterWriteFormatAttribute(writer, (xmlChar*) "float", "%f", pThis->GetExponent());
+                                       rc = xmlTextWriterWriteString(writer, (xmlChar*) "");
+
+                               rc = xmlTextWriterEndElement(writer);//end of Exponent
+                               err = xmlGetLastError();
+                               SysTryCatch(NID_UI_ANIM, rc >= 0, , E_OPERATION_FAILED, "xmlTextWriterEndElementExponent Failed! %s", err->message);
+
+                               rc = xmlTextWriterStartElement(writer, (xmlChar*) "CutOff");
+                               err = xmlGetLastError();
+                               SysTryCatch(NID_UI_ANIM, rc >= 0, , E_OPERATION_FAILED, "xmlTextWriterStartElementCutOff Failed! %s", err->message);
+
+                                       rc = xmlTextWriterWriteFormatAttribute(writer, (xmlChar*) "float", "%f", pThis->GetCutOff());
+                                       rc = xmlTextWriterWriteString(writer, (xmlChar*) "");
+
+                               rc = xmlTextWriterEndElement(writer);//end of CutOff
+                               err = xmlGetLastError();
+                               SysTryCatch(NID_UI_ANIM, rc >= 0, , E_OPERATION_FAILED, "xmlTextWriterEndElementCutOff Failed! %s", err->message);
+
+                               rc = xmlTextWriterStartElement(writer, (xmlChar*) "Enabled");
+                               err = xmlGetLastError();
+                               SysTryCatch(NID_UI_ANIM, rc >= 0, , E_OPERATION_FAILED, "xmlTextWriterStartElementEnabled Failed! %s", err->message);
+
+                                       rc = xmlTextWriterWriteFormatAttribute(writer, (xmlChar*) "bool", "%s", (pThis->IsEnabled())?"true":"false");
+                                       rc = xmlTextWriterWriteString(writer, (xmlChar*) "");
+
+                               rc = xmlTextWriterEndElement(writer);//end of Enabled
+                               err = xmlGetLastError();
+                               SysTryCatch(NID_UI_ANIM, rc >= 0, , E_OPERATION_FAILED, "xmlTextWriterEndElementEnabled Failed! %s", err->message);
+
+                               rc = xmlTextWriterStartElement(writer, (xmlChar*) "LightName");
+                               err = xmlGetLastError();
+                               SysTryCatch(NID_UI_ANIM, rc >= 0, , E_OPERATION_FAILED, "xmlTextWriterStartElementLightName Failed! %s", err->message);
+
+                                       rc = xmlTextWriterWriteFormatAttribute(writer, (xmlChar*) "String", "%ls", pThis->GetName().GetPointer());
+                                       rc = xmlTextWriterWriteString(writer, (xmlChar*) "");
+
+                               rc = xmlTextWriterEndElement(writer);//end of LightName
+                               err = xmlGetLastError();
+                               SysTryCatch(NID_UI_ANIM, rc >= 0, , E_OPERATION_FAILED, "xmlTextWriterEndElementLightName Failed! %s", err->message);
+
+                       rc = xmlTextWriterEndElement(writer);//end of Light
+                       err = xmlGetLastError();
+                       SysTryCatch(NID_UI_ANIM, rc >= 0, , E_OPERATION_FAILED, "xmlTextWriterEndElementLight Failed! %s", err->message);
+
+               rc = xmlTextWriterEndDocument(writer);
+               err = xmlGetLastError();
+               SysTryCatch(NID_UI_ANIM, rc >= 0, , E_OPERATION_FAILED, "xmlTextWriterEndDocument Failed! %s", err->message);
+
+               xmlFreeTextWriter(writer);
+               return E_SUCCESS;
+
+               CATCH:
+                       if (writer != null)
+                       {
+                               xmlFreeTextWriter(writer);
+                       }
+                       return E_OPERATION_FAILED;
+}
+
+Light*
+_LightParser::LoadLightN(const Tizen::Base::String& fileName)
+{
+       Light* pLight;
+       xmlSAXHandler SAXHandl;
+       xmlError* err;
+       int returnCount;
+
+       std::wstring wStr(fileName.GetPointer());
+       std::string strFileName(wStr.begin(), wStr.end());
+
+       pLight = new (std::nothrow) Light();
+       SysTryReturn(NID_UI_ANIM, pLight != null, null, E_OUT_OF_MEMORY, "%s Memory allocation failed while creating Light.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+       memset(&SAXHandl, 0, sizeof(xmlSAXHandler));
+       SAXHandl.startElement = StartElement;
+       returnCount = xmlSAXUserParseFile(&SAXHandl,(void*) pLight, strFileName.c_str());
+       AppLog("%d - returnCount", returnCount);
+
+       err = xmlGetLastError();
+       SysTryCatch(NID_UI_ANIM, returnCount >= 0, , E_INVALID_DATA, "xmlUserParsing Failed! %s", err->message);
+       SysTryCatch(NID_UI_ANIM, GetLastResult() != E_OUT_OF_RANGE, , E_PARSING_FAILED, "%s Parsing error occur due to incorrect of Light data attributes", GetErrorMessage(E_PARSING_FAILED));
+       SysTryCatch(NID_UI_ANIM, _lightIsEnabled, , E_PARSING_FAILED, "%s Parsing error occur due to incorrect Xml file", GetErrorMessage(E_PARSING_FAILED));
+
+       return pLight;
+
+       CATCH:
+
+               delete pLight;
+               pLight = null;
+               return null;
+}
+
+}}}
+
+
diff --git a/src/ui/animations/FUiAnim_LightParser.h b/src/ui/animations/FUiAnim_LightParser.h
new file mode 100644 (file)
index 0000000..ba4a9e6
--- /dev/null
@@ -0,0 +1,46 @@
+//
+// Open Service Platform
+// Copyright (c) 2013 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.
+//
+
+/**
+ * @file       FUiAnim_LightParser.h
+ * @brief      This is the header file for the _LightParser class.
+ *
+ * This header file contains the declarations of the _LightParser class.
+ */
+
+#ifndef _FUI_ANIM_INTERNAL_LIGHT_PARSER_H_
+#define _FUI_ANIM_INTERNAL_LIGHT_PARSER_H_
+
+#include <FUiAnimLight.h>
+#include <FApp.h>
+#include <FBase.h>
+
+namespace Tizen { namespace Ui { namespace Animations {
+
+class _LightParser
+{
+public:
+       static Light* LoadLightN(const Tizen::Base::String& fileName);
+       static result SaveLight (Light* pThis, const Tizen::Base::String& fileName);
+
+       static bool _lightIsEnabled;
+};
+
+}}}
+
+
+#endif /* _FUI_ANIM_INTERNAL_LIGHT_PARSER_H_ */
index cc7536a..2e4e768 100644 (file)
  * This file contains implementation _MaterialImpl class.
  */
 #include <unique_ptr.h>
+#include <FApp.h>
+#include <FBase.h>
 #include <FGrpFloatVector4.h>
 #include "FUiAnim_DynamicProperty.h"
 #include "FUiAnim_VisualElementImpl.h"
 #include "FUiAnim_MaterialImpl.h"
+#include <libxml/parser.h>
+#include <libxml/tree.h>
+//#include <libxml/xmlstring.h>
+#include <libxml/xmlwriter.h>
+#include <libxml/xmlreader.h>
+//#include <libxml/xpath.h>
+#include <stdlib.h>
+#include <FIo.h>
 
-using namespace Tizen::Graphics;
 using namespace Tizen::Ui;
+using namespace Tizen::App;
+using namespace Tizen::Base;
+using namespace Tizen::Io;
+using namespace Tizen::Graphics;
+using namespace Tizen::Base::Utility;
 
 //#define PRINT(...) fprintf(stderr, __VA_ARGS__)
 #define PRINT(...)
@@ -66,7 +80,7 @@ _MaterialImpl::~_MaterialImpl(void)
 }
 
 void
-_MaterialImpl::SetAmbient(const float ambient[4])
+_MaterialImpl::SetAmbient(const float ambient[FLOAT_ARRAY_SIZE])
 {
        __ambient[0] = ambient[0];
        __ambient[1] = ambient[1];
@@ -81,7 +95,7 @@ _MaterialImpl::GetAmbient(void) const
 }
 
 void
-_MaterialImpl::SetDiffuse(const float diffuse[4])
+_MaterialImpl::SetDiffuse(const float diffuse[FLOAT_ARRAY_SIZE])
 {
        __diffuse[0] = diffuse[0];
        __diffuse[1] = diffuse[1];
@@ -96,7 +110,7 @@ _MaterialImpl::GetDiffuse(void) const
 }
 
 void
-_MaterialImpl::SetSpecular(const float specular[4])
+_MaterialImpl::SetSpecular(const float specular[FLOAT_ARRAY_SIZE])
 {
        __specular[0] = specular[0];
        __specular[1] = specular[1];
@@ -111,7 +125,7 @@ _MaterialImpl::GetSpecular(void) const
 }
 
 void
-_MaterialImpl::SetEmissive(const float emissive[4])
+_MaterialImpl::SetEmissive(const float emissive[FLOAT_ARRAY_SIZE])
 {
        __emissive[0] = emissive[0];
        __emissive[1] = emissive[1];
@@ -296,4 +310,97 @@ _MaterialImpl::GetProperty(const Tizen::Base::String& name) const
        return Variant();
 }
 
+///////
+
+float
+_MaterialImpl::GetEmissivePower(void) const
+{
+       return __specularPower;
+}
+
+void
+_MaterialImpl::SetEmissivePower(const float& value)
+{
+       __specularPower = value;
+}
+
+unsigned long
+_MaterialImpl::GetAlphaTestRef(void) const
+{
+       return __alphaTestRef;
+}
+
+void
+_MaterialImpl::SetAlphaTestRef(const unsigned long& value)
+{
+       __alphaTestRef = value;
+}
+
+bool
+_MaterialImpl::GetTransparent(void) const
+{
+       return __transparent;
+}
+
+void
+_MaterialImpl::SetTransparent(bool value)
+{
+       __transparent = value;
+}
+
+bool
+_MaterialImpl::GetZWrite(void) const
+{
+       return __zWrite;
+}
+
+void
+_MaterialImpl::SetZWrite(bool value)
+{
+       __zWrite = value;
+}
+
+bool
+_MaterialImpl::GetAlphaTest(void) const
+{
+       return __alphaTest;
+}
+
+void
+_MaterialImpl::SetAlphaTest(bool value)
+{
+       __alphaTest = value;
+}
+
+bool
+_MaterialImpl::GetZBuffer(void) const
+{
+       return __zBuffer;
+}
+
+void
+_MaterialImpl::SetZBuffer(bool value)
+{
+       __zBuffer = value;
+}
+
+float
+_MaterialImpl::GetOpacity(void) const
+{
+       return __opacity;
+}
+
+void
+_MaterialImpl::SetOpacity(float value)
+{
+       __opacity = value;
+}
+
+bool
+_MaterialImpl::GetCastingShadow() const
+{
+       return __castingShadow;
+}
+
+
 }}} // Tizen::Ui::Animations
index 1d5df05..46e7ffd 100644 (file)
 
 #include <FBaseString.h>
 #include <FUiAnimMaterial.h>
+#include <FApp.h>
+#include <FBase.h>
 #include "FUiAnim_RefObject.h"
+#include <libxml/xmlstring.h>
+#include <libxml/xpath.h>
+#include <vector>
+#include <string>
+
+
 
 namespace Tizen { namespace Ui { namespace Animations
 {
 
+#define FLOAT_ARRAY_SIZE 4
+
 class _DynamicKeyString;
 
 EXTERN_DYNAMIC_PROPERTY(L"name",                                       MaterialPropName                                                        , 1)    //String
@@ -63,7 +73,7 @@ public:
         * @see                 GetAmbient().
         *
         */
-       void SetAmbient(const float ambient[4]);
+       void SetAmbient(const float ambient[FLOAT_ARRAY_SIZE]);
 
        /**
         * Get material ambient color.
@@ -85,7 +95,7 @@ public:
         * @see                 GetDiffuse().
         *
         */
-       void SetDiffuse(const float diffuse[4]);
+       void SetDiffuse(const float diffuse[FLOAT_ARRAY_SIZE]);
 
        /**
         * Get material diffuse color.
@@ -107,7 +117,7 @@ public:
         * @see                 GetSpecular().
         *
         */
-       void SetSpecular(const float specular[4]);
+       void SetSpecular(const float specular[FLOAT_ARRAY_SIZE]);
 
        /**
         * Get material specular color.
@@ -129,7 +139,7 @@ public:
         * @see                 GetEmissive().
         *
         */
-       void SetEmissive(const float emissive[4]);
+       void SetEmissive(const float emissive[FLOAT_ARRAY_SIZE]);
 
        /**
         * Get material emissive color.
@@ -167,6 +177,8 @@ public:
         */
        result SetName(const Tizen::Base::String& name);
 
+       result SaveMaterialToXml (const Tizen::Base::String& fileName);
+
        virtual result SetProperty(const Tizen::Base::String& name, const Variant& value);
        virtual Variant GetProperty(const Tizen::Base::String& name) const;
 
@@ -174,13 +186,182 @@ private:
        _MaterialImpl& operator=(const _MaterialImpl& rhs);
 
 private:
-       float __ambient[4];
-       float __diffuse[4];
-       float __specular[4];
-       float __emissive[4];
+       float __ambient[FLOAT_ARRAY_SIZE];
+       float __diffuse[FLOAT_ARRAY_SIZE];
+       float __specular[FLOAT_ARRAY_SIZE];
+       float __emissive[FLOAT_ARRAY_SIZE];
        float __shininess;
 
        Tizen::Base::String __name;
+
+//////
+public:
+       /**
+        * Get material emissive power
+        *
+        * @since 3.0
+        *
+        * @return              Emissive power of the material.
+        * @see                 SetEmissivePower().
+        *
+        */
+       float GetEmissivePower(void) const;
+
+       /**
+        * Set material specular power
+        *
+        * @since 3.0
+        *
+        * @param[in]   value           Material new specular power value.
+        * @see                 GetSpecularPower().
+        *
+        */
+       void SetEmissivePower(const float& value);
+
+       /**
+        * Get material alpha test ref.
+        *
+        * @since 3.0
+        *
+        * @return              Alpha test ref of the material.
+        * @see                 SetAlphaTestRef().
+        *
+        */
+       unsigned long GetAlphaTestRef(void) const;
+
+       /**
+        * Set material alpha test ref.
+        *
+        * @since 3.0
+        *
+        * @param[in]   value           Material new alpha test ref value.
+        * @see                 GetAlphaTestRef().
+        *
+        */
+       void SetAlphaTestRef(const unsigned long& value);
+
+       /**
+        * Get material transparent
+        *
+        * @since 3.0
+        *
+        * @return              Transparent of the material.
+        * @see                 SetTransparent().
+        *
+        */
+       bool GetTransparent(void) const;
+
+       /**
+        * Set material transparent
+        *
+        * @since 3.0
+        *
+        * @param[in]   value   Material new transparent value.
+        * @see                 GetTransparent().
+        *
+        */
+       void SetTransparent(bool value);
+
+       /**
+        * Get material ZWrite.
+        *
+        * @since 3.0
+        *
+        * @return              ZWrite of the material.
+        * @see                 SetZWrite
+        *
+        */
+       bool GetZWrite(void) const;
+
+       /**
+        * Set material ZWrite.
+        *
+        * @since 3.0
+        *
+        * @param[in]   value   Material new ZWrite value.
+        * @see                 GetZWrite
+        *
+        */
+       void SetZWrite(bool value);
+
+       /**
+        * Get material alpha test.
+        *
+        * @since 3.0
+        *
+        * @return              Alpha test of the material.
+        * @see                 SetAlphaTest().
+        *
+        */
+       bool GetAlphaTest(void) const;
+
+       /**
+        * Set material alpha test.
+        *
+        * @since 3.0
+        *
+        * @param[in]   value   Material new alpha test value.
+        * @see                 GetAlphaTest().
+        *
+        */
+       void SetAlphaTest(bool value);
+
+       /**
+        * Get material ZBuffer.
+        *
+        * @since 3.0
+        *
+        * @return              ZBuffer of the material,
+        * @see                 SetZBuffer().
+        *
+        */
+       bool GetZBuffer(void) const;
+
+       /**
+        * Set material ZBuffer.
+        *
+        * @since 3.0
+        *
+        * @param[in]   value   Material new ZBuffer value.
+        * @see                 GetZBuffer().
+        *
+        */
+       void SetZBuffer(bool value);
+
+       /**
+        * Get material opacity.
+        *
+        * @since 3.0
+        *
+        * @return              Opacity of the material.
+        * @see                 SetOpacity().
+        */
+       float GetOpacity(void) const;
+
+       /**
+        * Set material opacity
+        *
+        * @since 3.0
+        *
+        * @param[in]   value   Material new opacity value.
+        * @see                 GetOpacity().
+        *
+        */
+       void SetOpacity(float value);
+
+       bool GetCastingShadow() const;
+public:
+
+       float __specularPower;
+       float __opacity;
+
+       unsigned long __alphaTestRef;
+
+       bool __transparent;
+       bool __zWrite;
+       bool __alphaTest;
+       bool __zBuffer;
+       bool __castingShadow;
 };
 
 }}} // Tizen::Ui::Animations
diff --git a/src/ui/animations/FUiAnim_MaterialParser.cpp b/src/ui/animations/FUiAnim_MaterialParser.cpp
new file mode 100644 (file)
index 0000000..2ea4eb1
--- /dev/null
@@ -0,0 +1,317 @@
+
+//
+// Open Service Platform
+// Copyright (c) 2013 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.
+//
+
+/**
+ * @file       FUiAnim_MaterilParser.cpp
+ * @brief      This file contains implementation of the _MaterilParser class.
+ *
+ * This file contains implementation _MaterilParser class.
+ */
+
+
+#include <FApp.h>
+#include <FBase.h>
+#include <FBaseSysLog.h>
+#include <FGrpFloatVector4.h>
+#include <FUiAnimMaterial.h>
+#include "FUiAnim_MaterialParser.h"
+#include <libxml/parser.h>
+#include <libxml/tree.h>
+#include <libxml/xmlstring.h>
+#include <libxml/xmlwriter.h>
+#include <libxml/xmlreader.h>
+#include <libxml/xpath.h>
+#include <stdlib.h>
+#include <FIo.h>
+#include <algorithm>
+#include <vector>
+
+using namespace Tizen::Ui;
+using namespace Tizen::App;
+using namespace Tizen::Base;
+using namespace Tizen::Io;
+using namespace Tizen::Graphics;
+using namespace Tizen::Base::Utility;
+
+namespace Tizen { namespace Ui { namespace Animations
+{
+
+#define FLOAT_ARRAY_SIZE 4
+
+bool _MaterialParser::_materialIsEnabled = false;
+
+float ConvertingTizenStringToFloat(Tizen::Base::String& strbuf)
+{
+    std::wstringstream converter;
+    float value = 0;
+
+    converter.precision(FLOAT_ARRAY_SIZE);
+    converter.fill('0');
+    converter.setf( std::ios::fixed, std::ios::floatfield );
+
+    converter << strbuf.GetPointer();
+    converter >> value;
+    return value;
+}
+
+void ConvertingStringToTizenString(Tizen::Base::String& ws, const std::string s)
+{
+       Tizen::Base::String wsTmp(s.c_str());
+       ws = wsTmp;
+}
+
+void
+SH_startElement(void *ctx,     const xmlChar *name, const xmlChar **atts)
+{
+       std::string TagName((char*)name);
+       std::transform(TagName.begin(), TagName.end(), TagName.begin(), ::tolower);
+
+       Tizen::Base::String arrayAttributes[FLOAT_ARRAY_SIZE];
+       int countArrayAttributes = 0;
+
+       Material* pParsingForMaterial = (Material*) ctx;
+
+       if (atts != null)
+       {
+               int j = 1;
+               while (atts[j] != null)
+               {
+                       if (countArrayAttributes < FLOAT_ARRAY_SIZE)
+                       {
+                               ConvertingStringToTizenString(arrayAttributes[countArrayAttributes], std::string((char*) atts[j]));
+                       }
+                       j += 2;
+                       countArrayAttributes++;
+        }
+       }
+
+       if (TagName.compare("ambient") == 0)
+               {
+                       SysTryReturnVoidResult(NID_UI_ANIM, countArrayAttributes == FLOAT_ARRAY_SIZE, E_OUT_OF_RANGE, " Ambient attributes don't suitable, must be four instead there are (%d)", countArrayAttributes);
+                       pParsingForMaterial->SetAmbient(Tizen::Graphics::FloatVector4(ConvertingTizenStringToFloat(arrayAttributes[0]), ConvertingTizenStringToFloat(arrayAttributes[1]), ConvertingTizenStringToFloat(arrayAttributes[2]), ConvertingTizenStringToFloat(arrayAttributes[3])));
+               }
+
+       else if (TagName.compare("diffuse") == 0)
+               {
+                       SysTryReturnVoidResult(NID_UI_ANIM, countArrayAttributes == FLOAT_ARRAY_SIZE, E_OUT_OF_RANGE, " Diffuse attributes don't suitable, must be four instead there are (%d)", countArrayAttributes);
+                       pParsingForMaterial->SetDiffuse(Tizen::Graphics::FloatVector4(ConvertingTizenStringToFloat(arrayAttributes[0]), ConvertingTizenStringToFloat(arrayAttributes[1]), ConvertingTizenStringToFloat(arrayAttributes[2]), ConvertingTizenStringToFloat(arrayAttributes[3])));
+               }
+
+       else if (TagName.compare("specular") == 0)
+               {
+                       SysTryReturnVoidResult(NID_UI_ANIM, countArrayAttributes == FLOAT_ARRAY_SIZE, E_OUT_OF_RANGE, " Specular attributes don't suitable, must be four instead there are (%d)", countArrayAttributes);
+                       pParsingForMaterial->SetSpecular(Tizen::Graphics::FloatVector4(ConvertingTizenStringToFloat(arrayAttributes[0]), ConvertingTizenStringToFloat(arrayAttributes[1]), ConvertingTizenStringToFloat(arrayAttributes[2]), ConvertingTizenStringToFloat(arrayAttributes[3])));
+               }
+
+       else if (TagName.compare("emissive") == 0)
+               {
+                       SysTryReturnVoidResult(NID_UI_ANIM, countArrayAttributes == FLOAT_ARRAY_SIZE, E_OUT_OF_RANGE, " Emissive attributes don't suitable, must be four instead there are (%d)", countArrayAttributes);
+                       pParsingForMaterial->SetEmissive(Tizen::Graphics::FloatVector4(ConvertingTizenStringToFloat(arrayAttributes[0]), ConvertingTizenStringToFloat(arrayAttributes[1]), ConvertingTizenStringToFloat(arrayAttributes[2]), ConvertingTizenStringToFloat(arrayAttributes[3])));
+               }
+
+       else if (TagName.compare("shininess") == 0)
+               {
+                       SysTryReturnVoidResult(NID_UI_ANIM, countArrayAttributes == 1, E_OUT_OF_RANGE, " Shininess attributes don't suitable, must be one instead there are (%d)", countArrayAttributes);
+                       pParsingForMaterial->SetShininess(ConvertingTizenStringToFloat(arrayAttributes[0]));
+               }
+
+       else if (TagName.compare("specularpower") == 0)
+               {
+                       SysTryReturnVoidResult(NID_UI_ANIM, countArrayAttributes == 1, E_OUT_OF_RANGE, " SpecularPower attributes don't suitable, must be one instead there are (%d)", countArrayAttributes);
+                       pParsingForMaterial->SetEmissivePower(ConvertingTizenStringToFloat(arrayAttributes[0]));
+               }
+
+       else if (TagName.compare("materialname") == 0)
+               {
+                       SysTryReturnVoidResult(NID_UI_ANIM, countArrayAttributes == 1, E_OUT_OF_RANGE, " MaterialName attributes don't suitable, must be one instead there are (%d)", countArrayAttributes);
+                       pParsingForMaterial->SetName(arrayAttributes[0]);
+               }
+
+       else if (TagName.compare("material") == 0)
+               {
+                       _MaterialParser::_materialIsEnabled = true;
+               }
+}
+
+
+Material*
+_MaterialParser::LoadMaterialN(const Tizen::Base::String& fileName)
+{
+       Material* pMaterial;
+       xmlSAXHandler SAXHandler;
+       xmlError* err;
+       int returnCount;
+
+
+       std::wstring wStr(fileName.GetPointer());
+       std::string strFileName(wStr.begin(), wStr.end());
+
+       pMaterial = new (std::nothrow) Material();
+       SysTryReturn(NID_UI_ANIM, pMaterial != null, null, E_OUT_OF_MEMORY, "%s Memory allocation failed while creating Material.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+       memset(&SAXHandler, 0, sizeof(xmlSAXHandler));
+       SAXHandler.startElement = SH_startElement;
+       returnCount = xmlSAXUserParseFile(&SAXHandler,(void*) pMaterial, strFileName.c_str());
+
+       err = xmlGetLastError();
+       SysTryCatch(NID_UI_ANIM, returnCount >= 0, , E_INVALID_DATA, "xmlUserParsing Failed! %s", err->message);
+
+       SysTryCatch(NID_UI_ANIM, GetLastResult() != E_OUT_OF_RANGE, , E_PARSING_FAILED, "%s Parsing error occur due to incorrect of Material data attributes", GetErrorMessage(E_PARSING_FAILED));
+       SysTryCatch(NID_UI_ANIM, _materialIsEnabled, , E_PARSING_FAILED, "%s Parsing error occur due to incorrect Xml file", GetErrorMessage(E_PARSING_FAILED));
+
+       return pMaterial;
+
+       CATCH:
+
+               delete pMaterial;
+               pMaterial = null;
+               return null;
+}
+
+result
+_MaterialParser::SaveMaterial (Material* pThis, const Tizen::Base::String& fileName)
+{
+               int rc;
+               std::wstring wStr(fileName.GetPointer());
+               std::string strFileName(wStr.begin(), wStr.end());
+
+               xmlTextWriterPtr writer = xmlNewTextWriterFilename((const char*) strFileName.c_str(), 0);
+
+               xmlError* err = xmlGetLastError();
+               SysTryCatch(NID_UI_ANIM, writer != null, , E_OPERATION_FAILED, "xmlNewTextWriterFilename Failed! %s", err->message);
+
+               rc = xmlTextWriterStartDocument(writer, null, "UTF-8", null);
+               err = xmlGetLastError();
+               SysTryCatch(NID_UI_ANIM, rc >= 0, , E_OPERATION_FAILED, "xmlTextWriterStartDocument Failed! %s", err->message);
+
+                       rc = xmlTextWriterStartElement(writer, (xmlChar*) "Material");
+                       err = xmlGetLastError();
+                       SysTryCatch(NID_UI_ANIM, rc >= 0, , E_OPERATION_FAILED, "xmlTextWriterStartElementMaterial Failed! %s", err->message);
+
+                               rc = xmlTextWriterStartElement(writer, (xmlChar*) "Ambient");
+                               err = xmlGetLastError();
+                               SysTryCatch(NID_UI_ANIM, rc >= 0, , E_OPERATION_FAILED, "xmlTextWriterStartElementAmbient Failed! %s", err->message);
+
+                                       rc = xmlTextWriterWriteFormatAttribute(writer, (xmlChar*) "x", "%f", pThis->GetAmbient().x);
+                                       rc = xmlTextWriterWriteFormatAttribute(writer, (xmlChar*) "y", "%f", pThis->GetAmbient().y);
+                                       rc = xmlTextWriterWriteFormatAttribute(writer, (xmlChar*) "z", "%f", pThis->GetAmbient().z);
+                                       rc = xmlTextWriterWriteFormatAttribute(writer, (xmlChar*) "w", "%f", pThis->GetAmbient().w);
+                                       rc = xmlTextWriterWriteString(writer, (xmlChar*) "");
+
+                               rc = xmlTextWriterEndElement(writer);//end of Ambient
+                               err = xmlGetLastError();
+                               SysTryCatch(NID_UI_ANIM, rc >= 0, , E_OPERATION_FAILED, "xmlTextWriterEndElementAmbient Failed! %s", err->message);
+
+                               rc = xmlTextWriterStartElement(writer, (xmlChar*) "Diffuse");
+                               err = xmlGetLastError();
+                               SysTryCatch(NID_UI_ANIM, rc >= 0, , E_OPERATION_FAILED, "xmlTextWriterStartElementDiffuse Failed! %s", err->message);
+
+                                       rc = xmlTextWriterWriteFormatAttribute(writer, (xmlChar*) "x", "%f", pThis->GetDiffuse().x);
+                                       rc = xmlTextWriterWriteFormatAttribute(writer, (xmlChar*) "y", "%f", pThis->GetDiffuse().y);
+                                       rc = xmlTextWriterWriteFormatAttribute(writer, (xmlChar*) "z", "%f", pThis->GetDiffuse().z);
+                                       rc = xmlTextWriterWriteFormatAttribute(writer, (xmlChar*) "w", "%f", pThis->GetDiffuse().w);
+                                       rc = xmlTextWriterWriteString(writer, (xmlChar*) "");
+
+                               rc = xmlTextWriterEndElement(writer);//end of Diffuse
+                               err = xmlGetLastError();
+                               SysTryCatch(NID_UI_ANIM, rc >= 0, , E_OPERATION_FAILED, "xmlTextWriterEndElementDiffuse Failed! %s", err->message);
+
+                               rc = xmlTextWriterStartElement(writer, (xmlChar*) "Specular");
+                               err = xmlGetLastError();
+                               SysTryCatch(NID_UI_ANIM, rc >= 0, , E_OPERATION_FAILED, "xmlTextWriterStartElementSpecular Failed! %s", err->message);
+
+                                       rc = xmlTextWriterWriteFormatAttribute(writer, (xmlChar*) "x", "%f", pThis->GetSpecular().x);
+                                       rc = xmlTextWriterWriteFormatAttribute(writer, (xmlChar*) "y", "%f", pThis->GetSpecular().y);
+                                       rc = xmlTextWriterWriteFormatAttribute(writer, (xmlChar*) "z", "%f", pThis->GetSpecular().z);
+                                       rc = xmlTextWriterWriteFormatAttribute(writer, (xmlChar*) "w", "%f", pThis->GetSpecular().w);
+                                       rc = xmlTextWriterWriteString(writer, (xmlChar*) "");
+
+                               rc = xmlTextWriterEndElement(writer);//end of Specular
+                               err = xmlGetLastError();
+                               SysTryCatch(NID_UI_ANIM, rc >= 0, , E_OPERATION_FAILED, "xmlTextWriterEndElementSpecular Failed! %s", err->message);
+
+                               rc = xmlTextWriterStartElement(writer, (xmlChar*) "Emissive");
+                               err = xmlGetLastError();
+                               SysTryCatch(NID_UI_ANIM, rc >= 0, , E_OPERATION_FAILED, "xmlTextWriterStartElementEmissive Failed! %s", err->message);
+
+                                       rc = xmlTextWriterWriteFormatAttribute(writer, (xmlChar*) "x", "%f", pThis->GetEmissive().x);
+                                       rc = xmlTextWriterWriteFormatAttribute(writer, (xmlChar*) "y", "%f", pThis->GetEmissive().y);
+                                       rc = xmlTextWriterWriteFormatAttribute(writer, (xmlChar*) "z", "%f", pThis->GetEmissive().z);
+                                       rc = xmlTextWriterWriteFormatAttribute(writer, (xmlChar*) "w", "%f", pThis->GetEmissive().w);
+                                       rc = xmlTextWriterWriteString(writer, (xmlChar*) "");
+
+                               rc = xmlTextWriterEndElement(writer);//end of Emissive
+                               err = xmlGetLastError();
+                               SysTryCatch(NID_UI_ANIM, rc >= 0, , E_OPERATION_FAILED, "xmlTextWriterEndElementEmissive Failed! %s", err->message);
+
+                               rc = xmlTextWriterStartElement(writer, (xmlChar*) "Shininess");
+                               err = xmlGetLastError();
+                               SysTryCatch(NID_UI_ANIM, rc >= 0, , E_OPERATION_FAILED, "xmlTextWriterStartElementShininess Failed! %s", err->message);
+
+                                       rc = xmlTextWriterWriteFormatAttribute(writer, (xmlChar*) "float", "%f", pThis->GetShininess());
+                                       rc = xmlTextWriterWriteString(writer, (xmlChar*) "");
+
+                               rc = xmlTextWriterEndElement(writer);//end of Shininess
+                               err = xmlGetLastError();
+                               SysTryCatch(NID_UI_ANIM, rc >= 0, , E_OPERATION_FAILED, "xmlTextWriterEndElementShininess Failed! %s", err->message);
+
+                               rc = xmlTextWriterStartElement(writer, (xmlChar*) "SpecularPower");
+                               err = xmlGetLastError();
+                               SysTryCatch(NID_UI_ANIM, rc >= 0, , E_OPERATION_FAILED, "xmlTextWriterStartElementSpecularPower Failed! %s", err->message);
+
+                                       rc = xmlTextWriterWriteFormatAttribute(writer, (xmlChar*) "float", "%f", pThis->GetEmissivePower());
+                                       rc = xmlTextWriterWriteString(writer, (xmlChar*) "");
+
+                               rc = xmlTextWriterEndElement(writer);//end of SpecularPower
+                               err = xmlGetLastError();
+                               SysTryCatch(NID_UI_ANIM, rc >= 0, , E_OPERATION_FAILED, "xmlTextWriterEndElementSpecularPower Failed! %s", err->message);
+
+                               rc = xmlTextWriterStartElement(writer, (xmlChar*) "MaterialName");
+                               err = xmlGetLastError();
+                               SysTryCatch(NID_UI_ANIM, rc >= 0, , E_OPERATION_FAILED, "xmlTextWriterStartElementMaterialName Failed! %s", err->message);
+
+                                       rc = xmlTextWriterWriteFormatAttribute(writer, (xmlChar*) "String", "%ls", pThis->GetName().GetPointer());
+                                       rc = xmlTextWriterWriteString(writer, (xmlChar*) "");
+
+                               rc = xmlTextWriterEndElement(writer);//end of MaterialName
+                               err = xmlGetLastError();
+                               SysTryCatch(NID_UI_ANIM, rc >= 0, , E_OPERATION_FAILED, "xmlTextWriterEndElementMaterialName Failed! %s", err->message);
+
+                       rc = xmlTextWriterEndElement(writer);//end of Material
+                       err = xmlGetLastError();
+                       SysTryCatch(NID_UI_ANIM, rc >= 0, , E_OPERATION_FAILED, "xmlTextWriterEndElementMaterial Failed! %s", err->message);
+
+               rc = xmlTextWriterEndDocument(writer);
+               err = xmlGetLastError();
+               SysTryCatch(NID_UI_ANIM, rc >= 0, , E_OPERATION_FAILED, "xmlTextWriterEndDocument Failed! %s", err->message);
+
+               xmlFreeTextWriter(writer);
+
+               return E_SUCCESS;
+
+               CATCH:
+                       if (writer != null)
+                       {
+                               xmlFreeTextWriter(writer);
+                       }
+                       return E_OPERATION_FAILED;
+
+}
+
+}}}
+
diff --git a/src/ui/animations/FUiAnim_MaterialParser.h b/src/ui/animations/FUiAnim_MaterialParser.h
new file mode 100644 (file)
index 0000000..c41c681
--- /dev/null
@@ -0,0 +1,46 @@
+
+//
+// Open Service Platform
+// Copyright (c) 2013 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.
+//
+
+/**
+ * @file       FUiAnim_MaterialParser.h
+ * @brief      This is the header file for the _MaterialParser class.
+ *
+ * This header file contains the declarations of the _MaterialParser class.
+ */
+
+#ifndef _FUI_ANIM_MATERIAL_PARSER_H_
+#define _FUI_ANIM_MATERIAL_PARSER_H_
+
+#include <FUiAnimMaterial.h>
+#include <FApp.h>
+#include <FBase.h>
+
+namespace Tizen { namespace Ui { namespace Animations {
+
+class _MaterialParser
+{
+public:
+       static Material* LoadMaterialN(const Tizen::Base::String& fileName);
+       static result SaveMaterial (Material* pThis, const Tizen::Base::String& fileName);
+
+       static bool _materialIsEnabled;
+};
+
+}}}
+
+#endif /* FUIANIM_MATERIALPARSER_H_ */
index 537fbb1..a146fb7 100644 (file)
@@ -36,6 +36,8 @@
 #include "FUiAnim_DynamicProperty.h"
 #include "FUiAnim_VisualElementImpl.h"
 #include "FUiAnim_MeshImpl.h"
+#include <stdint.h>
+#include <string>
 
 #include "FUiAnim_MathMatrix4.h"
 
@@ -501,7 +503,7 @@ _MeshImpl::GetBoundingVolume(void) const
 }
 
 Mesh*
-_MeshImpl::LoadMeshFromBinaryN(const std::string& fileName, const std::string& modelName)
+_MeshImpl::LoadMeshN(const Tizen::Base::String& fileName)
  {
        result r;
        int quantityReadFromFile;
@@ -509,8 +511,11 @@ _MeshImpl::LoadMeshFromBinaryN(const std::string& fileName, const std::string& m
        char* charNameMesh;
 
        FILE* pFile;
-       pFile = fopen((fileName + modelName).c_str(), "r");
-       SysTryReturn(NID_UI_ANIM, pFile != null, null, E_INVALID_ARG, "%s Error occurred while opening file for reading: %s", GetErrorMessage(E_INVALID_ARG), (fileName + modelName).c_str());
+       std::wstring wStr(fileName.GetPointer());
+       std::string str(wStr.begin(), wStr.end());
+
+       pFile = fopen(str.c_str(), "r");
+       SysTryReturn(NID_UI_ANIM, pFile != null, null, E_INVALID_ARG, "%s Error occurred while opening file for reading: %s", GetErrorMessage(E_INVALID_ARG), str.c_str());
 
        _MeshImpl* pMeshImpl;
        Mesh* pMesh = new (std::nothrow) Mesh();
@@ -581,7 +586,7 @@ _MeshImpl::LoadMeshFromBinaryN(const std::string& fileName, const std::string& m
 
        quantityReadFromFile += fread (&intsData, sizeof(int32_t), 1, pFile);
        charNameMesh = new (std::nothrow) char[intsData + 1];
-       SysTryCatch(NID_UI_ANIM, charNameMesh != null, , E_OUT_OF_MEMORY, "%s Memory allocation failed while reading Mesh name: %s", GetErrorMessage(E_OUT_OF_MEMORY), (fileName + modelName).c_str());
+       SysTryCatch(NID_UI_ANIM, charNameMesh != null, , E_OUT_OF_MEMORY, "%s Memory allocation failed while reading Mesh name: %s", GetErrorMessage(E_OUT_OF_MEMORY), str.c_str());
        quantityReadFromFile += fread (charNameMesh, 1, intsData, pFile);
        charNameMesh[intsData] = '\0';
        pMeshImpl->__name.assign(charNameMesh, intsData);
@@ -600,14 +605,13 @@ _MeshImpl::LoadMeshFromBinaryN(const std::string& fileName, const std::string& m
 }
 
 result
-_MeshImpl::SaveMeshToBinary(const Tizen::Base::String& fileName)
+_MeshImpl::SaveMesh(const Tizen::Base::String& fileName)
 {
        int quantityWriteToFile;
        result r;
        int32_t intsData;
 
        FILE* pFile;
-       SetLastResult(E_SUCCESS);
 
        std::wstring wStr(fileName.GetPointer());
        std::string str(wStr.begin(), wStr.end());
@@ -670,6 +674,7 @@ _MeshImpl::SaveMeshToBinary(const Tizen::Base::String& fileName)
        quantityWriteToFile += fwrite(__name.c_str(), 1, intsData, pFile);
 
        fclose(pFile);
+       AppLog("SaveMesh completed debug");
        return E_SUCCESS;
 
        CATCH:
index a9d1e03..795f1f3 100644 (file)
@@ -535,9 +535,11 @@ _ModelImporterImpl::LoadMeshCollada(const std::string& modelName, std::string& m
 }
 
 Mesh*
-_ModelImporterImpl::LoadMeshFromBinaryN(const std::string& fileName, const std::string& modelName)
+_ModelImporterImpl::LoadMeshN(const Tizen::Base::String& fileName)
 {
-       Mesh* pMesh = _MeshImpl::LoadMeshFromBinaryN(fileName, modelName);
+       AppLog("LoadBin...");
+       Mesh* pMesh = _MeshImpl::LoadMeshN(fileName);
+       AppLog("Return mesh!!!!");
        return pMesh;
 }
 
@@ -596,7 +598,7 @@ _ModelImporterImpl::LoadTextureName(const std::string& imageId)
 }
 
 Scene*
-_ModelImporterImpl::LoadScene(const std::string& sceneId){
+_ModelImporterImpl::LoadScene(const std::string& sceneId, VisualElement& pSceneRootVisualElement){
        LibraryVisualScenes::LibraryVisualScenes* pLibVisScene = colladaAssets->pLibraryVisualScenes;
        LibraryGeometries::LibraryGeometries* pLibGeoms = colladaAssets->pLibraryGeometries;
 
@@ -607,7 +609,8 @@ _ModelImporterImpl::LoadScene(const std::string& sceneId){
        SysTryReturn(NID_UI_ANIM, pVisScene != null, null, E_OBJ_NOT_FOUND, "Scene '%s' not found.", sceneId.c_str());
 
        Scene* pScene = new (std::nothrow) Scene();
-       pScene->Construct();
+       pScene->Construct(pSceneRootVisualElement);
+       pScene->SetName(Tizen::Base::String(sceneId.c_str()));
 
        LibraryVisualScenes::Node* pNode = pVisScene->GetFirstNode();
 
index 6518040..dc0eeb5 100644 (file)
  */
 
 #include "FUiAnim_SceneImpl.h"
+#include "FUiAnimScene.h"
 #include "FBaseLog.h"
 #include "FBaseSysLog.h"
-#include <FGraphics.h>
+//#include <FGraphics.h>
+#include <FBaseColArrayList.h>
 
-namespace Tizen { namespace Ui { namespace Animations {
+#include <FGrpFloatMatrix4.h>
+#include <FGrpFloatPoint.h>
+#include <FGrpFloatRectangle.h>
+
+#include "FUiAnimMesh.h"
+#include "FUiAnimMaterial.h"
+#include "FUiAnimLight.h"
+#include "FUiAnimShaderProgram.h"
+#include "FUiAnimShader.h" //for  ShaderProgram compile
+
+#include "FUiAnim_MeshImpl.h"
+#include "FUiAnim_MaterialImpl.h"
+#include "FUiAnim_LightImpl.h"
+#include "FUiAnim_ShaderProgramImpl.h"
+
+#include "FUiAnim_MaterialParser.h"
+#include "FUiAnim_LightParser.h"
+
+#include "FUiAnimModelImporter.h"
+
+#include <FBaseUtilStringUtil.h>
+
+#include <stdio.h>
+#include <cstdlib>
+#include <string.h>
+#include <fstream>
+//#define LOCAL_XML_ENCODING "ISO-8859-1" //xml encoding
+#define LOCAL_XML_ENCODING "UTF-8" //xml encoding
+#define SCENE_DESCTRIPTOR_FILE_EXTENSION ".are"
+
+#define SCENE_MESH_RESOURCE_FILE_NAME "_mesh"
+#define SCENE_MESH_RESOURCE_FILE_EXTENSION ".bin"
 
+#define SCENE_MATERIAL_RESOURCE_FILE_NAME "_material"
+#define SCENE_MATERIAL_RESOURCE_FILE_EXTENSION ".xml"
+
+#define SCENE_LIGHT_RESOURCE_FILE_NAME "_light"
+#define SCENE_LIGHT_RESOURCE_FILE_EXTENSION ".xml"
+
+#define SCENE_VERTEX_SHADER_RESOURCE_FILE_NAME "_shader"
+#define SCENE_VERTEX_SHADER_RESOURCE_FILE_EXTENSION ".vert"
+
+#define SCENE_FRAGMENT_SHADER_RESOURCE_FILE_NAME "_shader"
+#define SCENE_FRAGMENT_SHADER_RESOURCE_FILE_EXTENSION ".frag"
+
+#define MAX_RES_FILES_COUNT 10000
+
+using namespace Tizen::Base;
+using namespace Tizen::Graphics;
 using namespace Tizen::Base::Collection;
+using namespace Tizen::Ui::Animations;
+
+namespace Tizen { namespace Ui { namespace Animations {
 
 _SceneImpl::_SceneImpl(void)
-       : Tizen::Base::Object()
-       , __meshes()
-       , __materials()
+       : _name()
+       , _pSceneRootVisualElement(null)
+//     , _pSceneFakeRootVisualElement(null)
+       , _meshes()
+       , _materials()
+       , _lights()
+       , _shaderPrograms()
+       , _textureFileNames()
+{
+}
+
+_SceneImpl::~_SceneImpl(void)
 {
+       ResetScene();
+
+       _pSceneRootVisualElement = null;
+//     _pSceneFakeRootVisualElement->Destroy();
 }
 
 result
-_SceneImpl::Construct()
+_SceneImpl::Construct(VisualElement& pSceneRootVisualElement)
 {
-       __pRootVisualElement = new (std::nothrow) VisualElement();
-       __pRootVisualElement->Construct();
+       _pSceneRootVisualElement = &pSceneRootVisualElement;
 
-//     A ce vzagali treba????
-       __pRootVisualElement->SetName(L"Node");
-       __pRootVisualElement->SetBounds(Tizen::Graphics::FloatRectangle(5, 5, 1, 1));
-       __pRootVisualElement->SetShowState(true);
-       __pRootVisualElement->SetImplicitAnimationEnabled(false);
+//     _pSceneFakeRootVisualElement = new (std::nothrow) VisualElement();
+//     SysTryReturnResult(NID_UI_ANIM, _pSceneFakeRootVisualElement != null, E_OUT_OF_MEMORY, \
+//                     "[E_OUT_OF_MEMORY] Insufficient memory.");
+//
+//     _pSceneFakeRootVisualElement->Construct();
+//     _pSceneFakeRootVisualElement->SetName("SceneFakeRootVisualElement");
+//     _pSceneFakeRootVisualElement->SetBounds(_pSceneRootVisualElement->GetBounds());
+//     _pSceneFakeRootVisualElement->SetShowState(true);
+//     _pSceneFakeRootVisualElement->SetImplicitAnimationEnabled(_pSceneRootVisualElement->IsImplicitAnimationEnabled());
+//     _pSceneRootVisualElement->AttachChild(_pSceneFakeRootVisualElement);
 
        return E_SUCCESS;
 }
 
-_SceneImpl::~_SceneImpl(void)
+result
+_SceneImpl::SetName(const Tizen::Base::String& sceneName)
 {
+       _name = sceneName;
+       return E_SUCCESS;
+}
 
+Tizen::Base::String
+_SceneImpl::GetName(void) const
+{
+       return _name;
 }
 
 VisualElement*
 _SceneImpl::GetRootVisualElement(void) const
 {
-       return __pRootVisualElement;
+//     return _pSceneFakeRootVisualElement;
+       return _pSceneRootVisualElement;
+}
+
+//result
+//_SceneImpl::RemoveAllVisualElements()
+//{
+//     IList* rootVEChildrenList = _pSceneFakeRootVisualElement->GetChildrenN();
+//     VisualElement* pChildVE;
+//
+//     if (rootVEChildrenList != null)
+//     {
+//             int count = rootVEChildrenList->GetCount();
+//             for (int i = 0; i < count; i++)
+//             {
+//                     pChildVE = (VisualElement*)rootVEChildrenList->GetAt(i);
+//                     if (pChildVE != null)
+//                     {
+//                             pChildVE->Destroy();
+//                     }
+//             }
+//     }
+//
+//     return E_SUCCESS;
+//}
+
+result
+_SceneImpl::ResetScene(void)
+{
+//     RemoveAllVisualElements();
+       RemoveAllMesh();
+       RemoveAllMaterial();
+       RemoveAllLight();
+       RemoveAllShaderProgram();
+       RemoveAllTextureFileName();
+
+       return E_SUCCESS;
+}
+
+_SceneImpl*
+_SceneImpl::GetInstance(Scene& scene)
+{
+       return scene.__pSceneImpl;
+}
+
+const _SceneImpl*
+_SceneImpl::GetInstance(const Scene& scene)
+{
+       return scene.__pSceneImpl;
 }
 
 //==========================================================================================MESH
 
 result
-_SceneImpl::AddMesh(Mesh* pMesh)
+_SceneImpl::AddMesh(const Mesh* pMesh)
 {
-       if (pMesh != null)
+       SysTryReturnResult(NID_UI_ANIM, pMesh != null, E_INVALID_ARG, \
+                       "[E_INVALID_ARG] Mesh pointer is null.");
+
+       SysTryReturnResult(NID_UI_ANIM, !(ContainsMesh(pMesh) >= 0), E_INVALID_ARG, \
+                       "[E_INVALID_ARG] Mesh \"%ls\" already exists in scene \"%ls\".", pMesh->GetName().GetPointer(), _name.GetPointer());
+
+       Mesh* pMeshCopy = new (std::nothrow) Mesh(*pMesh);
+       SysTryReturnResult(NID_UI_ANIM, pMeshCopy != null, E_OUT_OF_MEMORY, \
+                       "[E_OUT_OF_MEMORY] Insufficient memory.");
+
+       _SceneMeshDescriptor meshDescriptor;
+       meshDescriptor.pMesh = pMeshCopy;
+
+       return _meshes.Add( meshDescriptor);
+}
+
+result
+_SceneImpl::RemoveMesh(const String& meshName)
+{
+       int meshIndex = -1;
+       meshIndex = ContainsMesh(meshName);
+       SysTryReturnResult(NID_UI_ANIM, (meshIndex >= 0) && (meshIndex < GetMeshCount()), E_OBJ_NOT_FOUND, \
+                               "[E_OBJ_NOT_FOUND] Mesh \"%ls\" not found in scene \"%ls\".", meshName.GetPointer(), _name.GetPointer());
+
+       _SceneMeshDescriptor meshDescriptor;
+       _meshes.GetAt(meshIndex, meshDescriptor);
+       if (meshDescriptor.pMesh != null)
        {
-               Mesh* pMeshCopy = new (std::nothrow) Mesh(*pMesh);
-               SysTryReturnResult(NID_UI, pMeshCopy != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory.");
-               __meshes.push_back(pMeshCopy);
+               delete meshDescriptor.pMesh;
+               meshDescriptor.pMesh = null;
        }
-       return E_SUCCESS;
+
+       return _meshes.RemoveAt(meshIndex);
+}
+
+result
+_SceneImpl::RemoveMesh(const Mesh* pMesh)
+{
+       SysTryReturnResult(NID_UI_ANIM, pMesh != null, E_INVALID_ARG, \
+                               "[E_INVALID_ARG] Mesh pointer is null.");
+
+       int meshIndex = -1;
+       meshIndex = ContainsMesh(pMesh);
+
+       SysTryReturnResult(NID_UI_ANIM, (meshIndex >= 0) && (meshIndex < GetMeshCount()), E_OBJ_NOT_FOUND, \
+                               "[E_OBJ_NOT_FOUND] Mesh \"%ls\" not found in scene \"%ls\".", pMesh->GetName().GetPointer(), _name.GetPointer());
+
+       _SceneMeshDescriptor meshDescriptor;
+       _meshes.GetAt(meshIndex, meshDescriptor);
+       if (meshDescriptor.pMesh != null)
+       {
+               delete meshDescriptor.pMesh;
+               meshDescriptor.pMesh = null;
+       }
+
+       return _meshes.RemoveAt(meshIndex);
 }
 
 result
-_SceneImpl::RemoveMesh(const std::string& meshName)
+_SceneImpl::RemoveAllMesh(void)
 {
-       for (Meshes::iterator i = __meshes.begin(); i != __meshes.end(); i++)
+       _SceneMeshDescriptor meshDescriptor;
+       int count = _meshes.GetCount();
+
+       for (int i = 0; i < count; i++)
        {
-               Mesh* pMesh = *i;
-               if (pMesh->GetName().Equals(Tizen::Base::String(meshName.c_str())))
+               _meshes.GetAt(i, meshDescriptor);
+               if (meshDescriptor.pMesh != null)
                {
-                       __meshes.erase(i);
-                       delete pMesh;
-                       pMesh = null;
-                       return E_SUCCESS;
+                       delete meshDescriptor.pMesh;
+                       meshDescriptor.pMesh = null;
                }
        }
+       _meshes.RemoveAll();
 
-       SysTryReturnResult(NID_UI_ANIM, false, E_OBJ_NOT_FOUND, "Mesh '%s' not found.", meshName.c_str());
-       return E_OBJ_NOT_FOUND;
+       return E_SUCCESS;
 }
 
 Mesh*
-_SceneImpl::GetMeshN(const std::string& meshName) const
+_SceneImpl::GetMeshN(const String& meshName) const
+{
+       int meshIndex = -1;
+       meshIndex = ContainsMesh(meshName);
+
+       SysTryReturn(NID_UI_ANIM, (meshIndex >= 0) && (meshIndex < GetMeshCount()), null, E_OBJ_NOT_FOUND, \
+                               "[E_OBJ_NOT_FOUND] Mesh \"%ls\" not found in scene \"%ls\".", meshName.GetPointer(), _name.GetPointer());
+
+       _SceneMeshDescriptor meshDescriptor;
+       _meshes.GetAt(meshIndex,meshDescriptor);
+
+       if (meshDescriptor.pMesh == null)
+       {
+               return null;
+       }
+
+       Mesh* pMeshCopy = new (std::nothrow) Mesh(*meshDescriptor.pMesh);
+       SysTryReturn(NID_UI_ANIM, pMeshCopy != null, null, E_OUT_OF_MEMORY, \
+                               "[E_OUT_OF_MEMORY] Insufficient memory.");
+
+       return pMeshCopy;
+}
+
+int
+_SceneImpl::GetMeshCount(void) const
+{
+       return _meshes.GetCount();
+}
+
+int
+_SceneImpl::ContainsMesh(const Tizen::Base::String& meshName) const
 {
-       for (Meshes::const_iterator i = __meshes.begin(); i != __meshes.end(); i++)
+       _SceneMeshDescriptor meshDescriptor;
+       int meshIndex = -1;
+
+       for (int i = 0; i < GetMeshCount();i++)
        {
-               Mesh* pMesh = *i;
-               if (pMesh->GetName().Equals(Tizen::Base::String(meshName.c_str())))
+               _meshes.GetAt(i,meshDescriptor);
+               if (meshDescriptor.pMesh != null)
                {
-                       Mesh* pMeshCopy = new (std::nothrow) Mesh(*pMesh);
-                       SysTryReturn(NID_UI, pMeshCopy != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory.");
-                       return pMeshCopy;
+                       if (meshDescriptor.pMesh->GetName() == meshName)
+                       {
+                               meshIndex = i;
+                               break;
+                       }
                }
        }
 
-       return null;
+       return meshIndex;
+}
+
+int
+_SceneImpl::ContainsMesh(const Mesh* pMesh) const
+{
+       SysTryReturn(NID_UI_ANIM, pMesh != null, -1, E_INVALID_ARG, \
+                               "[E_INVALID_ARG] Mesh pointer is null.");
+
+       _SceneMeshDescriptor meshDescriptor;
+       int meshIndex = -1;
+
+       for (int i = 0; i < GetMeshCount();i++)
+       {
+               _meshes.GetAt(i,meshDescriptor);
+               if (meshDescriptor.pMesh != null)
+               {
+                       if (meshDescriptor.pMesh->GetHashCode() == pMesh->GetHashCode())
+                       {
+                               meshIndex = i;
+                               break;
+                       }
+               }
+       }
+
+       return meshIndex;
+}
+
+Mesh*
+_SceneImpl::GetMeshAtN(int index) const
+{
+       SysTryReturn(NID_UI_ANIM, (index >= 0) && (index < GetMeshCount()), null, E_OBJ_NOT_FOUND, \
+                               "[E_OBJ_NOT_FOUND] Mesh #%d not found in scene \"%ls\".", index, _name.GetPointer());
+
+       _SceneMeshDescriptor meshDescriptor;
+       _meshes.GetAt(index,meshDescriptor);
+
+       if (meshDescriptor.pMesh == null)
+       {
+               return null;
+       }
+
+       Mesh* pMeshCopy = new (std::nothrow) Mesh(*meshDescriptor.pMesh);
+       SysTryReturn(NID_UI_ANIM, pMeshCopy != null, null, E_OUT_OF_MEMORY, \
+                               "[E_OUT_OF_MEMORY] Insufficient memory.");
+
+       return pMeshCopy;
+}
+
+Tizen::Base::String
+_SceneImpl::GetMeshNameAt(int index) const
+{
+       SysTryReturn(NID_UI_ANIM, (index >= 0) && (index < GetMeshCount()), null, E_OBJ_NOT_FOUND, \
+                               "[E_OBJ_NOT_FOUND] Mesh #%d not found in scene \"%ls\".", index, _name.GetPointer());
+
+       _SceneMeshDescriptor meshDescriptor;
+       _meshes.GetAt(index,meshDescriptor);
+
+       if (meshDescriptor.pMesh == null)
+       {
+               return String(L"");
+       }
+
+       return meshDescriptor.pMesh->GetName();
+}
+
+String
+_SceneImpl::GetMeshSourceFileName(const String meshName) const
+{
+       int meshIndex = -1;
+       meshIndex = ContainsMesh(meshName);
+
+       SysTryReturn(NID_UI_ANIM, (meshIndex >= 0) && (meshIndex < GetMeshCount()), String(L""), E_OBJ_NOT_FOUND, \
+                               "[E_OBJ_NOT_FOUND] Mesh \"%ls\" not found in scene \"%ls\".", meshName.GetPointer(), _name.GetPointer());
+
+       _SceneMeshDescriptor meshDescriptor;
+       _meshes.GetAt(meshIndex,meshDescriptor);
+
+       return meshDescriptor.sourceFileName;
+}
+result
+_SceneImpl::SetMeshSourceFileName(const String meshName, const String editorFileName)
+{
+       int meshIndex = -1;
+       meshIndex = ContainsMesh(meshName);
+
+       SysTryReturnResult(NID_UI_ANIM, (meshIndex >= 0) && (meshIndex < GetMeshCount()), E_OBJ_NOT_FOUND, \
+                               "[E_OBJ_NOT_FOUND] Mesh \"%ls\" not found in scene \"%ls\".", meshName.GetPointer(), _name.GetPointer());
+
+       _SceneMeshDescriptor meshDescriptor;
+       _meshes.GetAt(meshIndex,meshDescriptor);
+
+       meshDescriptor.sourceFileName = editorFileName;
+
+       return _meshes.SetAt(meshDescriptor, meshIndex);
+}
+
+String
+_SceneImpl::GetMeshModelNameInSourceFile(const String meshName) const
+{
+       int meshIndex = -1;
+       meshIndex = ContainsMesh(meshName);
+
+       SysTryReturn(NID_UI_ANIM, (meshIndex >= 0) && (meshIndex < GetMeshCount()), String(L""), E_OBJ_NOT_FOUND, \
+                               "[E_OBJ_NOT_FOUND] Mesh \"%ls\" not found in scene \"%ls\".", meshName.GetPointer(), _name.GetPointer());
+
+       _SceneMeshDescriptor meshDescriptor;
+       _meshes.GetAt(meshIndex,meshDescriptor);
+
+       return meshDescriptor.modelNameInSourceFile;
+}
+
+result
+_SceneImpl::SetMeshModelNameInSourceFile(const String meshName, const String modelNameInSourceFile)
+{
+       int meshIndex = -1;
+       meshIndex = ContainsMesh(meshName);
+
+       SysTryReturnResult(NID_UI_ANIM, (meshIndex >= 0) && (meshIndex < GetMeshCount()), E_OBJ_NOT_FOUND, \
+                               "[E_OBJ_NOT_FOUND] Mesh \"%ls\" not found in scene \"%ls\".", meshName.GetPointer(), _name.GetPointer());
+
+       _SceneMeshDescriptor meshDescriptor;
+       _meshes.GetAt(meshIndex,meshDescriptor);
+
+       meshDescriptor.modelNameInSourceFile = modelNameInSourceFile;
+
+       return _meshes.SetAt(meshDescriptor, meshIndex);
+}
+//not for public, but for JNI example
+String
+_SceneImpl::GetMeshNameByHashCode(int code) const
+{
+       _MeshImpl* pMeshImpl = (_MeshImpl*)code;
+       if (pMeshImpl != null)
+       {
+               return String(pMeshImpl->GetName().c_str());
+       }
+       else
+       {
+               return String(L"");
+       }
+}
+
+Tizen::Base::String
+_SceneImpl::GetMeshSourceFileName(const Mesh* pMesh) const
+{
+       SysTryReturn(NID_UI_ANIM, pMesh != null, String(L""), E_INVALID_ARG, \
+                               "[E_INVALID_ARG] Mesh pointer is null.");
+
+       int meshIndex = -1;
+       meshIndex = ContainsMesh(pMesh);
+
+       SysTryReturn(NID_UI_ANIM, (meshIndex >= 0) && (meshIndex < GetMeshCount()), String(L""), E_OBJ_NOT_FOUND, \
+                               "[E_OBJ_NOT_FOUND] Mesh \"%ls\" not found in scene \"%ls\".", pMesh->GetName().GetPointer(), _name.GetPointer());
+
+       _SceneMeshDescriptor meshDescriptor;
+       _meshes.GetAt(meshIndex,meshDescriptor);
+
+       return meshDescriptor.sourceFileName;
+}
+
+result
+_SceneImpl::SetMeshSourceFileName(const Mesh* pMesh, const Tizen::Base::String sourceFileName)
+{
+       SysTryReturnResult(NID_UI_ANIM, pMesh != null, E_INVALID_ARG, \
+                               "[E_INVALID_ARG] Mesh pointer is null.");
+
+       int meshIndex = -1;
+       meshIndex = ContainsMesh(pMesh);
+
+       SysTryReturnResult(NID_UI_ANIM, (meshIndex >= 0) && (meshIndex < GetMeshCount()), E_OBJ_NOT_FOUND, \
+                               "[E_OBJ_NOT_FOUND] Mesh \"%ls\" not found in scene \"%ls\".", pMesh->GetName().GetPointer(), _name.GetPointer());
+
+       _SceneMeshDescriptor meshDescriptor;
+       _meshes.GetAt(meshIndex,meshDescriptor);
+
+       meshDescriptor.sourceFileName = sourceFileName;
+
+       return _meshes.SetAt(meshDescriptor, meshIndex);
+}
+
+Tizen::Base::String
+_SceneImpl::GetMeshModelNameInSourceFile(const Mesh* pMesh) const
+{
+       SysTryReturn(NID_UI_ANIM, pMesh != null, String(L""), E_INVALID_ARG, \
+                               "[E_INVALID_ARG] Mesh pointer is null.");
+
+       int meshIndex = -1;
+       meshIndex = ContainsMesh(pMesh);
+
+       SysTryReturn(NID_UI_ANIM, (meshIndex >= 0) && (meshIndex < GetMeshCount()), String(L""), E_OBJ_NOT_FOUND, \
+                               "[E_OBJ_NOT_FOUND] Mesh \"%ls\" not found in scene \"%ls\".", pMesh->GetName().GetPointer(), _name.GetPointer());
+
+       _SceneMeshDescriptor meshDescriptor;
+       _meshes.GetAt(meshIndex,meshDescriptor);
+
+       return meshDescriptor.modelNameInSourceFile;
+}
+
+result
+_SceneImpl::SetMeshModelNameInSourceFile(const Mesh* pMesh, const Tizen::Base::String modelNameInSourceFile)
+{
+       SysTryReturnResult(NID_UI_ANIM, pMesh != null, E_INVALID_ARG, \
+                               "[E_INVALID_ARG] Mesh pointer is null.");
+
+       int meshIndex = -1;
+       meshIndex = ContainsMesh(pMesh);
+
+       SysTryReturnResult(NID_UI_ANIM, (meshIndex >= 0) && (meshIndex < GetMeshCount()), E_OBJ_NOT_FOUND, \
+                               "[E_OBJ_NOT_FOUND] Mesh \"%ls\" not found in scene \"%ls\".", pMesh->GetName().GetPointer(), _name.GetPointer());
+
+       _SceneMeshDescriptor meshDescriptor;
+       _meshes.GetAt(meshIndex,meshDescriptor);
+
+       meshDescriptor.modelNameInSourceFile = modelNameInSourceFile;
+
+       return _meshes.SetAt(meshDescriptor, meshIndex);
 }
 
-Tizen::Base::Collection::ArrayList*
-_SceneImpl::GetMeshNamesN(void) const
+int
+_SceneImpl::GetMeshCodeAt(int index) const
 {
-       ArrayList* meshNames = new ArrayList(SingleObjectDeleter);
-       for (Meshes::const_iterator i = __meshes.begin(); i != __meshes.end(); i++)
+       SysTryReturn(NID_UI_ANIM, (index >= 0) && (index < GetMeshCount()), 0, E_OBJ_NOT_FOUND, \
+                               "[E_OBJ_NOT_FOUND] Mesh #%d not found in scene \"%ls\".", index, _name.GetPointer());
+
+       _SceneMeshDescriptor meshDescriptor;
+       _meshes.GetAt(index,meshDescriptor);
+       if (meshDescriptor.pMesh != null)
        {
+               return meshDescriptor.pMesh->GetHashCode();
+       }
+       return 0;
+}
 
-               Tizen::Base::String* meshName = new Tizen::Base::String((*i)->GetName());
-               meshNames->Add(meshName);
+int
+_SceneImpl::ContainsMesh(int code) const
+{
+       _SceneMeshDescriptor meshDescriptor;
+       int meshIndex = -1;
+
+       for (int i = 0; i < GetMeshCount();i++)
+       {
+               _meshes.GetAt(i,meshDescriptor);
+               if (meshDescriptor.pMesh != null)
+               {
+                       if (meshDescriptor.pMesh->GetHashCode() == code)
+                       {
+                               meshIndex = i;
+                               break;
+                       }
+               }
        }
-       return meshNames;
+
+       return meshIndex;
+}
+
+Mesh*
+_SceneImpl::GetMeshByHashCodeN(int code) const
+{
+       int meshIndex = ContainsMesh(code);
+       return GetMeshAtN(meshIndex);
 }
 
 //==========================================================================================MATERIAL
 
 result
-_SceneImpl::AddMaterial(Material* pMaterial)
+_SceneImpl::AddMaterial(const Material* pMaterial)
 {
-       if (pMaterial != null)
+       SysTryReturnResult(NID_UI_ANIM, pMaterial != null, E_INVALID_ARG, \
+                       "[E_INVALID_ARG] Material pointer is null.");
+
+       SysTryReturnResult(NID_UI_ANIM, !(ContainsMaterial(pMaterial) >= 0), E_INVALID_ARG, \
+                       "[E_INVALID_ARG] Material \"%ls\" already exists in scene \"%ls\".", pMaterial->GetName().GetPointer(), _name.GetPointer());
+
+       Material* pMaterialCopy = new (std::nothrow) Material(*pMaterial);
+       SysTryReturnResult(NID_UI_ANIM, pMaterialCopy != null, E_OUT_OF_MEMORY, \
+                       "[E_OUT_OF_MEMORY] Insufficient memory.");
+
+       _SceneMaterialDescriptor materialDescriptor;
+       materialDescriptor.pMaterial = pMaterialCopy;
+
+       return _materials.Add( materialDescriptor);
+}
+
+result
+_SceneImpl::RemoveMaterial(const String& materialName)
+{
+       int materialIndex = -1;
+       materialIndex = ContainsMaterial(materialName);
+       SysTryReturnResult(NID_UI_ANIM, (materialIndex >= 0) && (materialIndex < GetMaterialCount()), E_OBJ_NOT_FOUND, \
+                               "[E_OBJ_NOT_FOUND] Material \"%ls\" not found in scene \"%ls\".", materialName.GetPointer(), _name.GetPointer());
+
+       _SceneMaterialDescriptor materialDescriptor;
+       _materials.GetAt(materialIndex, materialDescriptor);
+       if (materialDescriptor.pMaterial != null)
        {
-               Material* pMaterialCopy = new (std::nothrow) Material(*pMaterial);
-               SysTryReturnResult(NID_UI, pMaterialCopy != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory.");
-               __materials.push_back(pMaterialCopy);
+               delete materialDescriptor.pMaterial;
+               materialDescriptor.pMaterial = null;
        }
-       return E_SUCCESS;
+
+       return _materials.RemoveAt(materialIndex);
+}
+
+result
+_SceneImpl::RemoveMaterial(const Material* pMaterial)
+{
+       SysTryReturnResult(NID_UI_ANIM, pMaterial != null, E_INVALID_ARG, \
+                               "[E_INVALID_ARG] Material pointer is null.");
+
+       int materialIndex = -1;
+       materialIndex = ContainsMaterial(pMaterial);
+       SysTryReturnResult(NID_UI_ANIM, (materialIndex >= 0) && (materialIndex < GetMaterialCount()), E_OBJ_NOT_FOUND, \
+                               "[E_OBJ_NOT_FOUND] Material \"%ls\" not found in scene \"%ls\".", pMaterial->GetName().GetPointer(), _name.GetPointer());
+
+       _SceneMaterialDescriptor materialDescriptor;
+       _materials.GetAt(materialIndex, materialDescriptor);
+       if (materialDescriptor.pMaterial != null)
+       {
+               delete materialDescriptor.pMaterial;
+               materialDescriptor.pMaterial = null;
+       }
+
+       return _materials.RemoveAt(materialIndex);
 }
 
 result
-_SceneImpl::RemoveMaterial(const std::string& materialName)
+_SceneImpl::RemoveAllMaterial(void)
 {
-       for (Materials::iterator i = __materials.begin(); i != __materials.end(); i++)
+       _SceneMaterialDescriptor materialDescriptor;
+       int count = _materials.GetCount();
+
+       for (int i = 0; i < count; i++)
        {
-               Material* pMaterial = *i;
-               if (pMaterial->GetName().Equals(Tizen::Base::String(materialName.c_str())))
+               _materials.GetAt(i, materialDescriptor);
+               if (materialDescriptor.pMaterial != null)
                {
-                       __materials.erase(i);
-                       delete pMaterial;
-                       pMaterial = null;
-                       return E_SUCCESS;
+                       delete materialDescriptor.pMaterial;
+                       materialDescriptor.pMaterial = null;
                }
        }
+       _materials.RemoveAll();
 
-       SysTryReturnResult(NID_UI_ANIM, false, E_OBJ_NOT_FOUND, "Material '%s' not found.", materialName.c_str());
-       return E_OBJ_NOT_FOUND;
+       return E_SUCCESS;
 }
 
 Material*
-_SceneImpl::GetMaterialN(const std::string& materialName) const
+_SceneImpl::GetMaterialN(const String& materialName) const
+{
+       int materialIndex = -1;
+       materialIndex = ContainsMaterial(materialName);
+
+       SysTryReturn(NID_UI_ANIM, (materialIndex >= 0) && (materialIndex < GetMaterialCount()), null, E_OBJ_NOT_FOUND, \
+                               "[E_OBJ_NOT_FOUND] Material \"%ls\" not found in scene \"%ls\".", materialName.GetPointer(), _name.GetPointer());
+
+       _SceneMaterialDescriptor materialDescriptor;
+       _materials.GetAt(materialIndex,materialDescriptor);
+
+       if (materialDescriptor.pMaterial == null)
+       {
+               return null;
+       }
+
+       Material* pMaterialCopy = new (std::nothrow) Material(*materialDescriptor.pMaterial);
+       SysTryReturn(NID_UI_ANIM, pMaterialCopy != null, null, E_OUT_OF_MEMORY, \
+                               "[E_OUT_OF_MEMORY] Insufficient memory.");
+
+       return pMaterialCopy;
+}
+
+int
+_SceneImpl::GetMaterialCount(void) const
+{
+       return _materials.GetCount();
+}
+
+int
+_SceneImpl::ContainsMaterial(const Tizen::Base::String& materialName) const
 {
-       for (Materials::const_iterator i = __materials.begin(); i != __materials.end(); i++)
+       _SceneMaterialDescriptor materialDescriptor;
+       int materialIndex = -1;
+
+       for (int i = 0; i < GetMaterialCount();i++)
        {
-               Material* pMaterial = *i;
-               if (pMaterial->GetName().Equals(Tizen::Base::String(materialName.c_str())))
+               _materials.GetAt(i,materialDescriptor);
+               if (materialDescriptor.pMaterial != null)
                {
-                       Material* pMaterialCopy = new (std::nothrow) Material(*pMaterial);
-                       SysTryReturn(NID_UI, pMaterialCopy != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory.");
-                       return pMaterialCopy;
+                       if (materialDescriptor.pMaterial->GetName() == materialName)
+                       {
+                               materialIndex = i;
+                               break;
+                       }
                }
        }
 
-       return null;
+       return materialIndex;
 }
 
-Tizen::Base::Collection::ArrayList*
-_SceneImpl::GetMaterialNamesN(void) const
+int
+_SceneImpl::ContainsMaterial(const Material* pMaterial) const
 {
-       ArrayList* materialNames = new ArrayList(SingleObjectDeleter);
-       for (Materials::const_iterator i = __materials.begin(); i != __materials.end(); i++)
+       SysTryReturn(NID_UI_ANIM, pMaterial != null, -1, E_INVALID_ARG, \
+                               "[E_INVALID_ARG] Material pointer is null.");
+
+       _SceneMaterialDescriptor materialDescriptor;
+       int materialIndex = -1;
+
+       for (int i = 0; i < GetMaterialCount();i++)
        {
-               Tizen::Base::String* materialName = new Tizen::Base::String((*i)->GetName());
-               materialNames->Add(materialName);
+               _materials.GetAt(i,materialDescriptor);
+               if (materialDescriptor.pMaterial != null)
+               {
+                       if (materialDescriptor.pMaterial->GetHashCode() == pMaterial->GetHashCode())
+                       {
+                               materialIndex = i;
+                               break;
+                       }
+               }
        }
-       return materialNames;
-}
 
-//==========================================================================================TEXTURE
+       return materialIndex;
+}
 
-result
-_SceneImpl::AddTextureFileName(std::string textureFileName)
+Material*
+_SceneImpl::GetMaterialAtN(int index) const
 {
-       __textureFileNames.push_back(textureFileName);
-       return E_SUCCESS;
+       SysTryReturn(NID_UI_ANIM, (index >= 0) && (index < GetMaterialCount()), null, E_OBJ_NOT_FOUND, \
+                               "[E_OBJ_NOT_FOUND] Material #%d not found in scene \"%ls\".", index, _name.GetPointer());
+
+       _SceneMaterialDescriptor materialDescriptor;
+       _materials.GetAt(index,materialDescriptor);
+
+       if (materialDescriptor.pMaterial == null)
+       {
+               return null;
+       }
+
+       Material* pMaterialCopy = new (std::nothrow) Material(*materialDescriptor.pMaterial);
+       SysTryReturn(NID_UI_ANIM, pMaterialCopy != null, null, E_OUT_OF_MEMORY, \
+                               "[E_OUT_OF_MEMORY] Insufficient memory.");
+
+       return pMaterialCopy;
 }
 
-Tizen::Base::Collection::ArrayList*
-_SceneImpl::GetTextureFileNamesN(void) const
+Tizen::Base::String
+_SceneImpl::GetMaterialNameAt(int index) const
 {
-       ArrayList* textureFileNames = new ArrayList(SingleObjectDeleter);
-       for (TextureFileNames::const_iterator i = __textureFileNames.begin(); i != __textureFileNames.end(); i++)
+       SysTryReturn(NID_UI_ANIM, (index >= 0) && (index < GetMaterialCount()), null, E_OBJ_NOT_FOUND, \
+                               "[E_OBJ_NOT_FOUND] Material #%d not found in scene \"%ls\".", index, _name.GetPointer());
+
+       _SceneMaterialDescriptor materialDescriptor;
+       _materials.GetAt(index,materialDescriptor);
+
+       if (materialDescriptor.pMaterial == null)
        {
-               Tizen::Base::String* textureFileName = new Tizen::Base::String((*i).c_str());
-               textureFileNames->Add(textureFileName);
+               return String(L"");
        }
-       return textureFileNames;
+
+       return materialDescriptor.pMaterial->GetName();
+}
+
+String
+_SceneImpl::GetMaterialSourceFileName(const String materialName) const
+{
+       int materialIndex = -1;
+       materialIndex = ContainsMaterial(materialName);
+
+       SysTryReturn(NID_UI_ANIM, (materialIndex >= 0) && (materialIndex < GetMaterialCount()), null, E_OBJ_NOT_FOUND, \
+                               "[E_OBJ_NOT_FOUND] Material \"%ls\" not found in scene \"%ls\".", materialName.GetPointer(), _name.GetPointer());
+
+       _SceneMaterialDescriptor materialDescriptor;
+       _materials.GetAt(materialIndex,materialDescriptor);
+
+       return materialDescriptor.sourceFileName;
+}
+result
+_SceneImpl::SetMaterialSourceFileName(const String materialName, const String sourceFileName)
+{
+       int materialIndex = -1;
+       materialIndex = ContainsMaterial(materialName);
+
+       SysTryReturnResult(NID_UI_ANIM, (materialIndex >= 0) && (materialIndex < GetMaterialCount()), E_OBJ_NOT_FOUND, \
+                               "[E_OBJ_NOT_FOUND] Material \"%ls\" not found in scene \"%ls\".", materialName.GetPointer(), _name.GetPointer());
+
+       _SceneMaterialDescriptor materialDescriptor;
+       _materials.GetAt(materialIndex,materialDescriptor);
+
+       materialDescriptor.sourceFileName = sourceFileName;
+
+       return _materials.SetAt(materialDescriptor, materialIndex);
 }
 
+//not for public, but for JNI example
+String
+_SceneImpl::GetMaterialNameByHashCode(int code) const
+{
+       _MaterialImpl* pMaterialImpl = (_MaterialImpl*)code;
+       if (pMaterialImpl != null)
+       {
+               return String(pMaterialImpl->GetName());
+       }
+       else
+       {
+               return String(L"");
+       }
+}
+
+String
+_SceneImpl::GetMaterialSourceFileName(const Material* pMaterial) const
+{
+       SysTryReturn(NID_UI_ANIM, pMaterial != null, String(L""), E_INVALID_ARG, \
+                                       "[E_INVALID_ARG] Material pointer is null.");
+
+       int materialIndex = -1;
+       materialIndex = ContainsMaterial(pMaterial);
+
+       SysTryReturn(NID_UI_ANIM, (materialIndex >= 0) && (materialIndex < GetMaterialCount()), null, E_OBJ_NOT_FOUND, \
+                               "[E_OBJ_NOT_FOUND] Material \"%ls\" not found in scene \"%ls\".", pMaterial->GetName().GetPointer(), _name.GetPointer());
+
+       _SceneMaterialDescriptor materialDescriptor;
+       _materials.GetAt(materialIndex,materialDescriptor);
+
+       return materialDescriptor.sourceFileName;
+}
+result
+_SceneImpl::SetMaterialSourceFileName(const Material* pMaterial, const String sourceFileName)
+{
+       SysTryReturnResult(NID_UI_ANIM, pMaterial != null, E_INVALID_ARG, \
+                                       "[E_INVALID_ARG] Material pointer is null.");
+
+       int materialIndex = -1;
+       materialIndex = ContainsMaterial(pMaterial);
+
+       SysTryReturnResult(NID_UI_ANIM, (materialIndex >= 0) && (materialIndex < GetMaterialCount()), E_OBJ_NOT_FOUND, \
+                               "[E_OBJ_NOT_FOUND] Material \"%ls\" not found in scene \"%ls\".", pMaterial->GetName().GetPointer(), _name.GetPointer());
+
+       _SceneMaterialDescriptor materialDescriptor;
+       _materials.GetAt(materialIndex,materialDescriptor);
+
+       materialDescriptor.sourceFileName = sourceFileName;
+
+       return _materials.SetAt(materialDescriptor, materialIndex);
+}
+
+//not for public, but for JNI example
+int
+_SceneImpl::GetMaterialCodeAt(int index) const
+{
+       SysTryReturn(NID_UI_ANIM, (index >= 0) && (index < GetMaterialCount()), null, E_OBJ_NOT_FOUND, \
+                               "[E_OBJ_NOT_FOUND] Material #%d not found in scene \"%ls\".", index, _name.GetPointer());
+
+       _SceneMaterialDescriptor materialDescriptor;
+       _materials.GetAt(index,materialDescriptor);
+
+       if (materialDescriptor.pMaterial != null)
+       {
+               return materialDescriptor.pMaterial->GetHashCode();
+       }
+       return 0;
+}
+
+int
+_SceneImpl::ContainsMaterial(int code) const
+{
+       _SceneMaterialDescriptor materialDescriptor;
+       int materialIndex = -1;
+
+       for (int i = 0; i < GetMaterialCount();i++)
+       {
+               _materials.GetAt(i,materialDescriptor);
+               if (materialDescriptor.pMaterial != null)
+               {
+                       if (materialDescriptor.pMaterial->GetHashCode() == code)
+                       {
+                               materialIndex = i;
+                               break;
+                       }
+               }
+       }
+
+       return materialIndex;
+}
+
+Material*
+_SceneImpl::GetMaterialByHashCodeN(int code) const
+{
+       int materialIndex = ContainsMaterial(code);
+       return GetMaterialAtN(materialIndex);
+}
+
+//==========================================================================================LIGHT
+
+result
+_SceneImpl::AddLight(const Light* pLight)
+{
+       SysTryReturnResult(NID_UI_ANIM, pLight != null, E_INVALID_ARG, \
+                       "[E_INVALID_ARG] Light pointer is null.");
+
+       SysTryReturnResult(NID_UI_ANIM, !(ContainsLight(pLight) >= 0), E_INVALID_ARG, \
+                       "[E_INVALID_ARG] Light \"%ls\" already exists in scene \"%ls\".", pLight->GetName().GetPointer(), _name.GetPointer());
+
+       Light* pLightCopy = new (std::nothrow) Light(*pLight);
+       SysTryReturnResult(NID_UI_ANIM, pLightCopy != null, E_OUT_OF_MEMORY, \
+                       "[E_OUT_OF_MEMORY] Insufficient memory.");
+
+       _SceneLightDescriptor lightDescriptor;
+       lightDescriptor.pLight = pLightCopy;
+
+       return _lights.Add( lightDescriptor);
+}
+
+result
+_SceneImpl::RemoveLight(const String& lightName)
+{
+       int lightIndex = -1;
+       lightIndex = ContainsLight(lightName);
+       SysTryReturnResult(NID_UI_ANIM, (lightIndex >= 0) && (lightIndex < GetLightCount()), E_OBJ_NOT_FOUND, \
+                               "[E_OBJ_NOT_FOUND] Light \"%ls\" not found in scene \"%ls\".", lightName.GetPointer(), _name.GetPointer());
+
+       _SceneLightDescriptor lightDescriptor;
+       _lights.GetAt(lightIndex, lightDescriptor);
+       if (lightDescriptor.pLight != null)
+       {
+               delete lightDescriptor.pLight;
+               lightDescriptor.pLight = null;
+       }
+
+       return _lights.RemoveAt(lightIndex);
+}
+
+result
+_SceneImpl::RemoveLight(const Light* pLight)
+{
+       SysTryReturnResult(NID_UI_ANIM, pLight != null, E_INVALID_ARG, \
+                               "[E_INVALID_ARG] Light pointer is null.");
+
+       int lightIndex = -1;
+       lightIndex = ContainsLight(pLight);
+       SysTryReturnResult(NID_UI_ANIM, (lightIndex >= 0) && (lightIndex < GetLightCount()), E_OBJ_NOT_FOUND, \
+                               "[E_OBJ_NOT_FOUND] Light \"%ls\" not found in scene \"%ls\".", pLight->GetName().GetPointer(), _name.GetPointer());
+
+       _SceneLightDescriptor lightDescriptor;
+       _lights.GetAt(lightIndex, lightDescriptor);
+       if (lightDescriptor.pLight != null)
+       {
+               delete lightDescriptor.pLight;
+               lightDescriptor.pLight = null;
+       }
+
+       return _lights.RemoveAt(lightIndex);
+}
+
+result
+_SceneImpl::RemoveAllLight(void)
+{
+       _SceneLightDescriptor lightDescriptor;
+       int count = _lights.GetCount();
+
+       for (int i = 0; i < count; i++)
+       {
+               _lights.GetAt(i, lightDescriptor);
+               if (lightDescriptor.pLight != null)
+               {
+                       delete lightDescriptor.pLight;
+                       lightDescriptor.pLight = null;
+               }
+       }
+       _lights.RemoveAll();
+
+       return E_SUCCESS;
+}
+
+Light*
+_SceneImpl::GetLightN(const String& lightName) const
+{
+       int lightIndex = -1;
+       lightIndex = ContainsLight(lightName);
+
+       SysTryReturn(NID_UI_ANIM, (lightIndex >= 0) && (lightIndex < GetLightCount()), null, E_OBJ_NOT_FOUND, \
+                               "[E_OBJ_NOT_FOUND] Light \"%ls\" not found in scene \"%ls\".", lightName.GetPointer(), _name.GetPointer());
+
+       _SceneLightDescriptor lightDescriptor;
+       _lights.GetAt(lightIndex,lightDescriptor);
+
+       if (lightDescriptor.pLight == null)
+       {
+               return null;
+       }
+
+       Light* pLightCopy = new (std::nothrow) Light(*lightDescriptor.pLight);
+       SysTryReturn(NID_UI_ANIM, pLightCopy != null, null, E_OUT_OF_MEMORY, \
+                               "[E_OUT_OF_MEMORY] Insufficient memory.");
+
+       return pLightCopy;
+}
+
+int
+_SceneImpl::GetLightCount(void) const
+{
+       return _lights.GetCount();
+}
+
+int
+_SceneImpl::ContainsLight(const Tizen::Base::String& lightName) const
+{
+       _SceneLightDescriptor lightDescriptor;
+       int lightIndex = -1;
+
+       for (int i = 0; i < GetLightCount();i++)
+       {
+               _lights.GetAt(i,lightDescriptor);
+               if (lightDescriptor.pLight != null)
+               {
+                       if (lightDescriptor.pLight->GetName() == lightName)
+                       {
+                               lightIndex = i;
+                               break;
+                       }
+               }
+       }
+
+       return lightIndex;
+}
+
+int
+_SceneImpl::ContainsLight(const Light* pLight) const
+{
+       SysTryReturn(NID_UI_ANIM, pLight != null, -1, E_INVALID_ARG, \
+                       "[E_INVALID_ARG] Light pointer is null.");
+       _SceneLightDescriptor lightDescriptor;
+       int lightIndex = -1;
+
+       for (int i = 0; i < GetLightCount();i++)
+       {
+               _lights.GetAt(i,lightDescriptor);
+               if (lightDescriptor.pLight != null)
+               {
+                       if (lightDescriptor.pLight->GetHashCode() == pLight->GetHashCode())
+                       {
+                               lightIndex = i;
+                               break;
+                       }
+               }
+       }
+
+       return lightIndex;
+
+}
+
+Light*
+_SceneImpl::GetLightAtN(int index) const
+{
+       SysTryReturn(NID_UI_ANIM, (index >= 0) && (index < GetLightCount()), null, E_OBJ_NOT_FOUND, \
+                               "[E_OBJ_NOT_FOUND] Light #%d not found in scene \"%ls\".", index, _name.GetPointer());
+
+       _SceneLightDescriptor lightDescriptor;
+       _lights.GetAt(index,lightDescriptor);
+
+       if (lightDescriptor.pLight == null)
+       {
+               return null;
+       }
+
+       Light* pLightCopy = new (std::nothrow) Light(*lightDescriptor.pLight);
+       SysTryReturn(NID_UI_ANIM, pLightCopy != null, null, E_OUT_OF_MEMORY, \
+                               "[E_OUT_OF_MEMORY] Insufficient memory.");
+
+       return pLightCopy;
+}
+
+Tizen::Base::String
+_SceneImpl::GetLightNameAt(int index) const
+{
+       SysTryReturn(NID_UI_ANIM, (index >= 0) && (index < GetLightCount()), null, E_OBJ_NOT_FOUND, \
+                               "[E_OBJ_NOT_FOUND] Light #%d not found in scene \"%ls\".", index, _name.GetPointer());
+
+       _SceneLightDescriptor lightDescriptor;
+       _lights.GetAt(index,lightDescriptor);
+
+       if (lightDescriptor.pLight == null)
+       {
+               return String(L"");
+       }
+
+       return lightDescriptor.pLight->GetName();
+}
+
+String
+_SceneImpl::GetLightSourceFileName(const String lightName) const
+{
+       int lightIndex = -1;
+       lightIndex = ContainsLight(lightName);
+
+       SysTryReturn(NID_UI_ANIM, (lightIndex >= 0) && (lightIndex < GetLightCount()), null, E_OBJ_NOT_FOUND, \
+                               "[E_OBJ_NOT_FOUND] Light \"%ls\" not found in scene \"%ls\".", lightName.GetPointer(), _name.GetPointer());
+
+       _SceneLightDescriptor lightDescriptor;
+       _lights.GetAt(lightIndex,lightDescriptor);
+
+       return lightDescriptor.sourceFileName;
+}
+result
+_SceneImpl::SetLightSourceFileName(const String lightName, const String sourceFileName)
+{
+       int lightIndex = -1;
+       lightIndex = ContainsLight(lightName);
+
+       SysTryReturnResult(NID_UI_ANIM, (lightIndex >= 0) && (lightIndex < GetLightCount()), E_OBJ_NOT_FOUND, \
+                               "[E_OBJ_NOT_FOUND] Light \"%ls\" not found in scene \"%ls\".", lightName.GetPointer(), _name.GetPointer());
+
+       _SceneLightDescriptor lightDescriptor;
+       _lights.GetAt(lightIndex,lightDescriptor);
+
+       lightDescriptor.sourceFileName = sourceFileName;
+
+       return _lights.SetAt(lightDescriptor, lightIndex);
+}
+
+//not for public, but for JNI example
+String
+_SceneImpl::GetLightNameByHashCode(int code) const
+{
+       _LightImpl* pLightImpl = (_LightImpl*)code;
+       if (pLightImpl != null)
+       {
+               return String(pLightImpl->GetName());
+       }
+       else
+       {
+               return String(L"");
+       }
+}
+
+Tizen::Base::String
+_SceneImpl::GetLightSourceFileName(const Light* pLight) const
+{
+       SysTryReturn(NID_UI_ANIM, pLight != null, String(L""), E_INVALID_ARG, \
+                               "[E_INVALID_ARG] Light pointer is null.");
+
+       int lightIndex = -1;
+       lightIndex = ContainsLight(pLight);
+
+       SysTryReturn(NID_UI_ANIM, (lightIndex >= 0) && (lightIndex < GetLightCount()), null, E_OBJ_NOT_FOUND, \
+                               "[E_OBJ_NOT_FOUND] Light \"%ls\" not found in scene \"%ls\".", pLight->GetName().GetPointer(), _name.GetPointer());
+
+       _SceneLightDescriptor lightDescriptor;
+       _lights.GetAt(lightIndex,lightDescriptor);
+
+       return lightDescriptor.sourceFileName;
+
+}
+
+result
+_SceneImpl::SetLightSourceFileName(const Light* pLight, const Tizen::Base::String sourceFileName)
+{
+       SysTryReturnResult(NID_UI_ANIM, pLight != null, E_INVALID_ARG, \
+                               "[E_INVALID_ARG] Light pointer is null.");
+       int lightIndex = -1;
+       lightIndex = ContainsLight(pLight);
+       SysTryReturnResult(NID_UI_ANIM, (lightIndex >= 0) && (lightIndex < GetLightCount()), E_OBJ_NOT_FOUND, \
+                               "[E_OBJ_NOT_FOUND] Light \"%ls\" not found in scene \"%ls\".", pLight->GetName().GetPointer(), _name.GetPointer());
+
+       _SceneLightDescriptor lightDescriptor;
+       _lights.GetAt(lightIndex,lightDescriptor);
+
+       lightDescriptor.sourceFileName = sourceFileName;
+
+       return _lights.SetAt(lightDescriptor, lightIndex);
+}
+
+int
+_SceneImpl::GetLightCodeAt(int index) const
+{
+       SysTryReturn(NID_UI_ANIM, (index >= 0) && (index < GetLightCount()), null, E_OBJ_NOT_FOUND, \
+                                       "[E_OBJ_NOT_FOUND] Light #%d not found in scene \"%ls\".", index, _name.GetPointer());
+
+       _SceneLightDescriptor lightDescriptor;
+       _lights.GetAt(index,lightDescriptor);
+
+       if (lightDescriptor.pLight != null)
+       {
+               return lightDescriptor.pLight->GetHashCode();
+       }
+
+       return 0;
+}
+
+int
+_SceneImpl::ContainsLight(int code) const
+{
+       _SceneLightDescriptor lightDescriptor;
+       int lightIndex = -1;
+
+       for (int i = 0; i < GetLightCount();i++)
+       {
+               _lights.GetAt(i,lightDescriptor);
+               if (lightDescriptor.pLight != null)
+               {
+                       if (lightDescriptor.pLight->GetHashCode() == code)
+                       {
+                               lightIndex = i;
+                               break;
+                       }
+               }
+       }
+
+       return lightIndex;
+}
+
+Light*
+_SceneImpl::GetLightByHashCodeN(int code) const
+{
+       int lightIndex = ContainsLight(code);
+       return GetLightAtN(lightIndex);
+}
+
+//==========================================================================================ShaderProgram
+ShaderProgram*
+_SceneImpl::AddShaderProgramN(const String shaderProgramName, const char* vertexShader, const char* fragmentShader)
+{
+       SysTryReturn(NID_UI_ANIM, vertexShader != null, null, E_INVALID_ARG, \
+                       "[E_INVALID_ARG] vertexShader pointer is null.");
+
+       SysTryReturn(NID_UI_ANIM, fragmentShader != null, null, E_INVALID_ARG, \
+                               "[E_INVALID_ARG] fragmentShader pointer is null.");
+
+       SysTryReturn(NID_UI_ANIM, !(ContainsShaderProgram(shaderProgramName) >= 0), null, E_INVALID_ARG, \
+                       "[E_INVALID_ARG] ShaderProgram \"%ls\" already exists in scene \"%ls\".", shaderProgramName.GetPointer(), _name.GetPointer());
+
+       Shader vertexShaderClass, fragmentShaderClass;
+//
+//     String stringT(vertexShader);
+//     std::wstring stringW(stringT.GetPointer());
+//     std::string stringVertexShader(stringW.begin(), stringW.end());
+       vertexShaderClass.Construct(Shader::SHADER_VERTEX, vertexShader);
+       fragmentShaderClass.Construct(Shader::SHADER_FRAGMENT, fragmentShader);
+
+       ShaderProgram* pNewShaderProgram = new (std::nothrow) ShaderProgram();
+
+       SysTryReturn(NID_UI_ANIM, pNewShaderProgram != null, null, E_OUT_OF_MEMORY, \
+                       "[E_OUT_OF_MEMORY] Insufficient memory.");
+
+       pNewShaderProgram->Construct(vertexShaderClass, fragmentShaderClass);
+       pNewShaderProgram->SetName(shaderProgramName);
+
+       _SceneShaderProgramDescriptor shaderProgramDescriptor;
+       shaderProgramDescriptor.pShaderProgram = pNewShaderProgram;
+       shaderProgramDescriptor.vertexShader = vertexShader;
+       shaderProgramDescriptor.fragmentShader = fragmentShader;
+       _shaderPrograms.Add( shaderProgramDescriptor);
+
+//     AppLog("vertex shader text: %s ",vertexShader);
+//     AppLog("vertex shader saved text: %ls ", shaderProgramDescriptor.vertexShader.GetPointer());
+
+       ShaderProgram* pUserShaderProgram = new (std::nothrow) ShaderProgram(*pNewShaderProgram);
+
+       SysTryReturn(NID_UI_ANIM, pUserShaderProgram != null, null, E_OUT_OF_MEMORY, \
+                               "[E_OUT_OF_MEMORY] Insufficient memory.");
+
+       return pUserShaderProgram;
+}
+
+result
+_SceneImpl::RemoveShaderProgram(const String& shaderProgramName)
+{
+       int shaderProgramIndex = -1;
+       shaderProgramIndex = ContainsShaderProgram(shaderProgramName);
+       SysTryReturnResult(NID_UI_ANIM, (shaderProgramIndex >= 0) && (shaderProgramIndex < GetShaderProgramCount()), E_OBJ_NOT_FOUND, \
+                               "[E_OBJ_NOT_FOUND] ShaderProgram \"%ls\" not found in scene \"%ls\".", shaderProgramName.GetPointer(), _name.GetPointer());
+
+       _SceneShaderProgramDescriptor shaderProgramDescriptor;
+       _shaderPrograms.GetAt(shaderProgramIndex, shaderProgramDescriptor);
+       if (shaderProgramDescriptor.pShaderProgram != null)
+       {
+               delete shaderProgramDescriptor.pShaderProgram;
+               shaderProgramDescriptor.pShaderProgram = null;
+       }
+
+       return _shaderPrograms.RemoveAt(shaderProgramIndex);
+}
+
+result
+_SceneImpl::RemoveShaderProgram(const ShaderProgram* pShaderProgram)
+{
+       SysTryReturnResult(NID_UI_ANIM, pShaderProgram != null, E_INVALID_ARG, \
+                               "[E_INVALID_ARG] ShaderProgram pointer is null.");
+
+       int shaderProgramIndex = -1;
+       shaderProgramIndex = ContainsShaderProgram(pShaderProgram);
+       SysTryReturnResult(NID_UI_ANIM, (shaderProgramIndex >= 0) && (shaderProgramIndex < GetShaderProgramCount()), E_OBJ_NOT_FOUND, \
+                               "[E_OBJ_NOT_FOUND] ShaderProgram \"%ls\" not found in scene \"%ls\".", pShaderProgram->GetName().GetPointer(), _name.GetPointer());
+
+       _SceneShaderProgramDescriptor shaderProgramDescriptor;
+       _shaderPrograms.GetAt(shaderProgramIndex, shaderProgramDescriptor);
+       if (shaderProgramDescriptor.pShaderProgram != null)
+       {
+               delete shaderProgramDescriptor.pShaderProgram;
+               shaderProgramDescriptor.pShaderProgram = null;
+       }
+
+       return _shaderPrograms.RemoveAt(shaderProgramIndex);
+}
+
+result
+_SceneImpl::RemoveAllShaderProgram(void)
+{
+       _SceneShaderProgramDescriptor shaderProgramDescriptor;
+       int count = _shaderPrograms.GetCount();
+
+       for (int i = 0; i < count; i++)
+       {
+               _shaderPrograms.GetAt(i, shaderProgramDescriptor);
+               if (shaderProgramDescriptor.pShaderProgram != null)
+               {
+                       delete shaderProgramDescriptor.pShaderProgram;
+                       shaderProgramDescriptor.pShaderProgram = null;
+               }
+       }
+       _shaderPrograms.RemoveAll();
+
+       return E_SUCCESS;
+}
+
+ShaderProgram*
+_SceneImpl::GetShaderProgramN(const String& shaderProgramName) const
+{
+       int shaderProgramIndex = -1;
+       shaderProgramIndex = ContainsShaderProgram(shaderProgramName);
+
+       SysTryReturn(NID_UI_ANIM, (shaderProgramIndex >= 0) && (shaderProgramIndex < GetShaderProgramCount()), null, E_OBJ_NOT_FOUND, \
+                               "[E_OBJ_NOT_FOUND] ShaderProgram \"%ls\" not found in scene \"%ls\".", shaderProgramName.GetPointer(), _name.GetPointer());
+
+       _SceneShaderProgramDescriptor shaderProgramDescriptor;
+       _shaderPrograms.GetAt(shaderProgramIndex,shaderProgramDescriptor);
+
+       if (shaderProgramDescriptor.pShaderProgram == null)
+       {
+               return null;
+       }
+
+       ShaderProgram* pShaderProgramCopy = new (std::nothrow) ShaderProgram(*shaderProgramDescriptor.pShaderProgram);
+       SysTryReturn(NID_UI_ANIM, pShaderProgramCopy != null, null, E_OUT_OF_MEMORY, \
+                               "[E_OUT_OF_MEMORY] Insufficient memory.");
+
+       return pShaderProgramCopy;
+}
+
+int
+_SceneImpl::GetShaderProgramCount(void) const
+{
+       return _shaderPrograms.GetCount();
+}
+
+int
+_SceneImpl::ContainsShaderProgram(const Tizen::Base::String& shaderProgramName) const
+{
+       _SceneShaderProgramDescriptor shaderProgramDescriptor;
+       int shaderProgramIndex = -1;
+
+       for (int i = 0; i < GetShaderProgramCount();i++)
+       {
+               _shaderPrograms.GetAt(i,shaderProgramDescriptor);
+               if (shaderProgramDescriptor.pShaderProgram != null)
+               {
+                       if (shaderProgramDescriptor.pShaderProgram->GetName() == shaderProgramName)
+                       {
+                               shaderProgramIndex = i;
+                               break;
+                       }
+               }
+       }
+
+       return shaderProgramIndex;
+}
+
+int
+_SceneImpl::ContainsShaderProgram(const ShaderProgram* pShaderProgram) const
+{
+       SysTryReturn(NID_UI_ANIM, pShaderProgram != null, -1, E_INVALID_ARG, \
+                               "[E_INVALID_ARG] ShaderProgram pointer is null.");
+
+       _SceneShaderProgramDescriptor shaderProgramDescriptor;
+       int shaderProgramIndex = -1;
+
+       for (int i = 0; i < GetShaderProgramCount();i++)
+       {
+               _shaderPrograms.GetAt(i,shaderProgramDescriptor);
+               if (shaderProgramDescriptor.pShaderProgram != null)
+               {
+                       if (shaderProgramDescriptor.pShaderProgram->GetHashCode() == pShaderProgram->GetHashCode())
+                       {
+                               shaderProgramIndex = i;
+                               break;
+                       }
+               }
+       }
+
+       return shaderProgramIndex;
+}
+
+ShaderProgram*
+_SceneImpl::GetShaderProgramAtN(int index) const
+{
+       SysTryReturn(NID_UI_ANIM, (index >= 0) && (index < GetShaderProgramCount()), null, E_OBJ_NOT_FOUND, \
+                               "[E_OBJ_NOT_FOUND] ShaderProgram #%d not found in scene \"%ls\".", index, _name.GetPointer());
+
+       _SceneShaderProgramDescriptor shaderProgramDescriptor;
+       _shaderPrograms.GetAt(index,shaderProgramDescriptor);
+
+       if (shaderProgramDescriptor.pShaderProgram == null)
+       {
+               return null;
+       }
+
+       ShaderProgram* pShaderProgramCopy = new (std::nothrow) ShaderProgram(*shaderProgramDescriptor.pShaderProgram);
+       SysTryReturn(NID_UI_ANIM, pShaderProgramCopy != null, null, E_OUT_OF_MEMORY, \
+                               "[E_OUT_OF_MEMORY] Insufficient memory.");
+
+       return pShaderProgramCopy;
+}
+
+Tizen::Base::String
+_SceneImpl::GetShaderProgramNameAt(int index) const
+{
+       SysTryReturn(NID_UI_ANIM, (index >= 0) && (index < GetShaderProgramCount()), null, E_OBJ_NOT_FOUND, \
+                               "[E_OBJ_NOT_FOUND] ShaderProgram #%d not found in scene \"%ls\".", index, _name.GetPointer());
+
+       _SceneShaderProgramDescriptor shaderProgramDescriptor;
+       _shaderPrograms.GetAt(index,shaderProgramDescriptor);
+
+       if (shaderProgramDescriptor.pShaderProgram == null)
+       {
+               return String(L"");
+       }
+
+       return shaderProgramDescriptor.pShaderProgram->GetName();
+}
+
+
+String
+_SceneImpl::GetShaderProgramSourceFileName(const String shaderProgramName) const
+{
+       int shaderProgramIndex = -1;
+       shaderProgramIndex = ContainsShaderProgram(shaderProgramName);
+
+       SysTryReturn(NID_UI_ANIM, (shaderProgramIndex >= 0) && (shaderProgramIndex < GetShaderProgramCount()), null, E_OBJ_NOT_FOUND, \
+                               "[E_OBJ_NOT_FOUND] ShaderProgram \"%ls\" not found in scene \"%ls\".", shaderProgramName.GetPointer(), _name.GetPointer());
+
+       _SceneShaderProgramDescriptor shaderProgramDescriptor;
+       _shaderPrograms.GetAt(shaderProgramIndex,shaderProgramDescriptor);
+
+       return shaderProgramDescriptor.sourceFileName;
+}
+result
+_SceneImpl::SetShaderProgramSourceFileName(const String shaderProgramName, const String sourceFileName)
+{
+       int shaderProgramIndex = -1;
+       shaderProgramIndex = ContainsShaderProgram(shaderProgramName);
+
+       SysTryReturnResult(NID_UI_ANIM, (shaderProgramIndex >= 0) && (shaderProgramIndex < GetShaderProgramCount()), E_OBJ_NOT_FOUND, \
+                               "[E_OBJ_NOT_FOUND] ShaderProgram \"%ls\" not found in scene \"%ls\".", shaderProgramName.GetPointer(), _name.GetPointer());
+
+       _SceneShaderProgramDescriptor shaderProgramDescriptor;
+       _shaderPrograms.GetAt(shaderProgramIndex,shaderProgramDescriptor);
+
+       shaderProgramDescriptor.sourceFileName = sourceFileName;
+
+       return _shaderPrograms.SetAt(shaderProgramDescriptor, shaderProgramIndex);
+}
+
+//not for public, but for JNI example
+String
+_SceneImpl::GetShaderProgramNameByHashCode(int code) const
+{
+       _ShaderProgramImpl* pShaderProgramImpl = (_ShaderProgramImpl*)code;
+       if (pShaderProgramImpl != null)
+       {
+               return String(pShaderProgramImpl->GetName());
+       }
+       else
+       {
+               return String(L"");
+       }
+}
+
+Tizen::Base::String
+_SceneImpl::GetShaderProgramSourceFileName(const ShaderProgram* pShaderProgram) const
+{
+       SysTryReturn(NID_UI_ANIM, pShaderProgram != null, String(L""), E_INVALID_ARG, \
+                                       "[E_INVALID_ARG] ShaderProgram pointer is null.");
+
+       int shaderProgramIndex = -1;
+       shaderProgramIndex = ContainsShaderProgram(pShaderProgram);
+
+       SysTryReturn(NID_UI_ANIM, (shaderProgramIndex >= 0) && (shaderProgramIndex < GetShaderProgramCount()), null, E_OBJ_NOT_FOUND, \
+                               "[E_OBJ_NOT_FOUND] ShaderProgram \"%ls\" not found in scene \"%ls\".", pShaderProgram->GetName().GetPointer(), _name.GetPointer());
+
+       _SceneShaderProgramDescriptor shaderProgramDescriptor;
+       _shaderPrograms.GetAt(shaderProgramIndex,shaderProgramDescriptor);
+
+       return shaderProgramDescriptor.sourceFileName;
+}
+
+result
+_SceneImpl::SetShaderProgramSourceFileName(const ShaderProgram* pShaderProgram, const Tizen::Base::String sourceFileName)
+{
+       SysTryReturnResult(NID_UI_ANIM, pShaderProgram != null, E_INVALID_ARG, \
+                               "[E_INVALID_ARG] ShaderProgram pointer is null.");
+
+       int shaderProgramIndex = -1;
+       shaderProgramIndex = ContainsShaderProgram(pShaderProgram);
+
+       SysTryReturnResult(NID_UI_ANIM, (shaderProgramIndex >= 0) && (shaderProgramIndex < GetShaderProgramCount()), E_OBJ_NOT_FOUND, \
+                               "[E_OBJ_NOT_FOUND] ShaderProgram \"%ls\" not found in scene \"%ls\".", pShaderProgram->GetName().GetPointer(), _name.GetPointer());
+
+       _SceneShaderProgramDescriptor shaderProgramDescriptor;
+       _shaderPrograms.GetAt(shaderProgramIndex,shaderProgramDescriptor);
+
+       shaderProgramDescriptor.sourceFileName = sourceFileName;
+
+       return _shaderPrograms.SetAt(shaderProgramDescriptor, shaderProgramIndex);
+}
+
+int
+_SceneImpl::GetShaderProgramCodeAt(int index) const
+{
+       SysTryReturn(NID_UI_ANIM, (index >= 0) && (index < GetShaderProgramCount()), null, E_OBJ_NOT_FOUND, \
+                               "[E_OBJ_NOT_FOUND] ShaderProgram #%d not found in scene \"%ls\".", index, _name.GetPointer());
+
+       _SceneShaderProgramDescriptor shaderProgramDescriptor;
+       _shaderPrograms.GetAt(index,shaderProgramDescriptor);
+
+       if (shaderProgramDescriptor.pShaderProgram != null)
+       {
+               return shaderProgramDescriptor.pShaderProgram->GetHashCode();
+       }
+       return 0;
+}
+
+int
+_SceneImpl::ContainsShaderProgram(int code) const
+{
+       _SceneShaderProgramDescriptor shaderProgramDescriptor;
+       int shaderProgramIndex = -1;
+
+       for (int i = 0; i < GetShaderProgramCount();i++)
+       {
+               _shaderPrograms.GetAt(i,shaderProgramDescriptor);
+               if (shaderProgramDescriptor.pShaderProgram != null)
+               {
+                       if (shaderProgramDescriptor.pShaderProgram->GetHashCode() == code)
+                       {
+                               shaderProgramIndex = i;
+                               break;
+                       }
+               }
+       }
+
+       return shaderProgramIndex;
+}
+
+ShaderProgram*
+_SceneImpl::GetShaderProgramByHashCodeN(int code) const
+{
+       int shaderProgramIndex = ContainsShaderProgram(code);
+       return GetShaderProgramAtN(shaderProgramIndex);
+}
+
+//==========================================================================================TEXTURE
+
+result
+_SceneImpl::AddTextureFileName(const String& textureFileName)
+{
+       return _textureFileNames.Add(textureFileName);
+}
+
+int
+_SceneImpl::GetTextureFileNameCount(void) const
+{
+       return _textureFileNames.GetCount();
+}
+
+String
+_SceneImpl::GetTextureFileNameAt(int index) const
+{
+       SysTryReturn(NID_UI_ANIM, (index >= 0) && (index < GetTextureFileNameCount()), String(L""), E_OBJ_NOT_FOUND, \
+                                       "[E_OBJ_NOT_FOUND] Texture File Name #%d not found in scene \"%ls\".", index, _name.GetPointer());
+       String textureFileName;
+       _textureFileNames.GetAt(index, textureFileName);
+       return textureFileName;
+}
+result
+_SceneImpl::RemoveTextureFileNameAt(int index)
+{
+       SysTryReturnResult(NID_UI_ANIM, (index >= 0) && (index < GetTextureFileNameCount()), E_OBJ_NOT_FOUND, \
+                                               "[E_OBJ_NOT_FOUND] Texture File Name #%d not found in scene \"%ls\".", index, _name.GetPointer());
+       return _textureFileNames.RemoveAt(index);
+}
+
+result
+_SceneImpl::RemoveAllTextureFileName(void)
+{
+       _textureFileNames.RemoveAll();
+       return E_SUCCESS;
+}
+
+//=====================Save/Load
+std::string
+ConvertWStringToString(std::wstring& wString)
+{
+       std::string s(wString.begin(), wString.end());
+       return s;
+}
+
+result
+_SceneImpl::SaveScene(const Tizen::Base::String filesPath, const Tizen::Base::String resourceFilesPath,  const Tizen::Base::String scenePrefix) const //in format: home/abc/scenespath/ or c:\\abc\\scenepath\\     ..
+{
+       /*xml structure:
+
+       <sceneName str></>
+
+       Mesh list[]
+       < id, .bin pFile str, sourceFileName str, modelNameInSourceFile str></>
+       ...
+
+       Material list[]
+       < id, .bin pFile str, sourceFileName str></>
+       ...
+
+       Light list[]
+       < id, .bin pFile str, sourceFileName str></>
+       ...
+
+       ShaderProgram list[]
+       < id, sourceFileName str>
+               <vertex shader>str</> <fragment shader>str</>
+       </>
+       ...
+
+       VisualElement []
+       <ve id, ve parent id, mesh id, material id, light id, shaderProgram id>, parentId == 0 if root scene ve, mesh...Id == -1 if non
+               <ve content></>
+       </>
+       ...
+
+       */
+
+       /*
+        * this initialize the library and check potential ABI mismatches
+        * between the version it was compiled for and the actual shared
+        * library used.
+        */
+       //LIBXML_TEST_VERSION
+
+       int rc;
+       result r;
+       xmlTextWriterPtr writer;
+
+       _SceneMeshDescriptor meshDescriptor;
+       _SceneMaterialDescriptor materialDescriptor;
+       _SceneLightDescriptor lightDescriptor;
+       _SceneShaderProgramDescriptor shaderProgramDescriptor;
+       int count;
+       IList* childrenVisualElementList = null;
+       VisualElement* pChildVisualElement = null;
+
+       std::string tempString;
+       std::wstring tempWString;
+       String tempTString;
+
+       //file name generating
+       String xmlFileName = scenePrefix;
+       String meshResFileName = SCENE_MESH_RESOURCE_FILE_NAME;
+       String meshResFileExtension = SCENE_MESH_RESOURCE_FILE_EXTENSION;
+       String materialResFileName = SCENE_MATERIAL_RESOURCE_FILE_NAME;
+       String materialResFileExtension = SCENE_MATERIAL_RESOURCE_FILE_EXTENSION;
+       String lightResFileName = SCENE_LIGHT_RESOURCE_FILE_NAME;
+       String lightResFileExtension = SCENE_LIGHT_RESOURCE_FILE_EXTENSION;
+
+       String vertexShaderResFileName = SCENE_VERTEX_SHADER_RESOURCE_FILE_NAME;
+       String vertexShaderResFileExtension = SCENE_VERTEX_SHADER_RESOURCE_FILE_EXTENSION;
+       String fragmentShaderResFileName = SCENE_FRAGMENT_SHADER_RESOURCE_FILE_NAME;
+       String fragmentShaderResFileExtension = SCENE_FRAGMENT_SHADER_RESOURCE_FILE_EXTENSION;
+
+       //xmlFileName.Format(10,L"scene%5d",_name.GetHashCode());
+       String sceneDescriptorExtension = SCENE_DESCTRIPTOR_FILE_EXTENSION;
+       tempTString.Format(filesPath.GetLength() + xmlFileName.GetLength() + sceneDescriptorExtension.GetLength() + 2, \
+                       L"%ls%ls%ls", filesPath.GetPointer(), xmlFileName.GetPointer(), sceneDescriptorExtension.GetPointer());
+       tempWString = tempTString.GetPointer();
+       tempString = ConvertWStringToString(tempWString);
+
+       /* Create a new XmlWriter for uri, with no compression. */
+       writer = xmlNewTextWriterFilename(tempString.c_str(), 0);
+       xmlError* err = xmlGetLastError();
+       SysTryReturnResult(NID_UI_ANIM, writer != null, E_SYSTEM, \
+                                       "Failed to create XmlWriter while saving scene \"%ls\" to %s with message: %s file: %s", \
+                                       _name.GetPointer(), tempString.c_str(), err->message, err->file);
+
+       //create folder for resources
+//     tempTString.Format(filesPath.GetLength() + xmlFileName.GetLength() + 4 + 50, L"mkdir %ls%ls_res", filesPath.GetPointer(), xmlFileName.GetPointer());
+//     tempWString = tempTString.GetPointer();
+//     tempString = ConvertWStringToString(tempWString);
+//     system(tempString.c_str());
+
+
+       /* Start the document with the xml default for the version,
+        * encoding ISO 8859-1 and the default for the standalone
+        * declaration. */
+       rc = xmlTextWriterStartDocument(writer, NULL, LOCAL_XML_ENCODING, NULL);
+       SysTryCatch(NID_UI_ANIM, rc >= 0, ,E_SYSTEM, \
+                                       "Failed to start document with XmlWriter while saving scene \"%ls\"", _name.GetPointer());
+
+        /* Start an element named "Scene". Since this is the first
+        * element, this will be the root element of the document. */
+       rc = xmlTextWriterStartElement(writer, BAD_CAST "Scene");
+       SysTryCatch(NID_UI_ANIM, rc >= 0, , E_SYSTEM, \
+                                       "Failed to write with XmlWriter while saving scene \"%ls\"", _name.GetPointer());
+
+       tempWString = _name.GetPointer();
+       tempString = ConvertWStringToString(tempWString);
+
+       rc = xmlTextWriterWriteAttribute(writer, BAD_CAST "name",
+                                            BAD_CAST tempString.c_str());
+
+       SysTryCatch(NID_UI_ANIM, rc >= 0, , E_SYSTEM, \
+                                       "Failed to write with XmlWriter while saving scene \"%ls\"", _name.GetPointer());
+
+       //open "Meshes" element
+       rc = xmlTextWriterStartElement(writer, BAD_CAST "Meshes");
+       SysTryCatch(NID_UI_ANIM, rc >= 0, , E_SYSTEM, \
+                                       "Failed to write with XmlWriter while saving scene \"%ls\"", _name.GetPointer());
+
+       count = _meshes.GetCount();
+       rc = xmlTextWriterWriteFormatAttribute(writer, BAD_CAST "count", "%d", count);
+       SysTryCatch(NID_UI_ANIM, rc >= 0, , E_SYSTEM, \
+                                       "Failed to write with XmlWriter while saving scene \"%ls\"", _name.GetPointer());
+
+       //write meshes
+       if (count == 0) //to close tag right way
+       {
+               rc = xmlTextWriterWriteString(writer, BAD_CAST "");
+               SysTryCatch(NID_UI_ANIM, rc >= 0, , E_SYSTEM, \
+                                               "Failed to write with XmlWriter while saving scene \"%ls\"", _name.GetPointer());
+       }
+
+       for(int i = 0; i < count && i < MAX_RES_FILES_COUNT; i++)
+       {
+               _meshes.GetAt(i, meshDescriptor);
+
+               //open "Mesh" element
+               rc = xmlTextWriterStartElement(writer, BAD_CAST "Mesh");
+               SysTryCatch(NID_UI_ANIM, rc >= 0, , E_SYSTEM, \
+                                               "Failed to write with XmlWriter while saving scene \"%ls\"", _name.GetPointer());
+
+               tempTString.Format(50,L"%d",i);
+               tempWString = tempTString.GetPointer();
+               tempString = ConvertWStringToString(tempWString);
+
+               rc = xmlTextWriterWriteAttribute(writer, BAD_CAST "id", BAD_CAST tempString.c_str());
+               SysTryCatch(NID_UI_ANIM, rc >= 0, , E_SYSTEM, \
+                                               "Failed to write with XmlWriter while saving scene \"%ls\"", _name.GetPointer());
+
+               if(meshDescriptor.pMesh != null)
+               {
+                       tempWString = meshDescriptor.pMesh->GetName().GetPointer();
+                       tempString = ConvertWStringToString(tempWString);
+
+                       rc = xmlTextWriterWriteAttribute(writer, BAD_CAST "name", BAD_CAST tempString.c_str());
+                       SysTryCatch(NID_UI_ANIM, rc >= 0, , E_SYSTEM, \
+                                                       "Failed to write with XmlWriter while saving scene \"%ls\"", _name.GetPointer());
+               }
+
+               tempWString = meshDescriptor.sourceFileName.GetPointer();
+               tempString = ConvertWStringToString(tempWString);
+
+               rc = xmlTextWriterWriteAttribute(writer, BAD_CAST "sourceFileName", BAD_CAST tempString.c_str());
+               SysTryCatch(NID_UI_ANIM, rc >= 0, , E_SYSTEM, \
+                                               "Failed to write with XmlWriter while saving scene \"%ls\"", _name.GetPointer());
+
+               tempWString = meshDescriptor.modelNameInSourceFile.GetPointer();
+               tempString = ConvertWStringToString(tempWString);
+
+               rc = xmlTextWriterWriteAttribute(writer, BAD_CAST "modelNameInSourceFile", BAD_CAST tempString.c_str());
+               SysTryCatch(NID_UI_ANIM, rc >= 0, , E_SYSTEM, \
+                                               "Failed to write with XmlWriter while saving scene \"%ls\"", _name.GetPointer());
+
+               rc = xmlTextWriterWriteString(writer, BAD_CAST "");
+               SysTryCatch(NID_UI_ANIM, rc >= 0, , E_SYSTEM, \
+                                               "Failed to write with XmlWriter while saving scene \"%ls\"", _name.GetPointer());
+
+               //form mesh bin file name
+
+               tempTString.Format(resourceFilesPath.GetLength() + xmlFileName.GetLength() + meshResFileName.GetLength() + meshResFileExtension.GetLength() + 8 + 2, \
+                               L"%ls%ls%ls%04d%ls", resourceFilesPath.GetPointer(), xmlFileName.GetPointer(), meshResFileName.GetPointer(), i, meshResFileExtension.GetPointer());
+
+               if(meshDescriptor.pMesh != null)
+               {
+                       meshDescriptor.pMesh->SaveMesh(tempTString);
+               }
+
+               //close "Mesh" element
+               rc = xmlTextWriterEndElement(writer);
+               SysTryCatch(NID_UI_ANIM, rc >= 0, , E_SYSTEM, \
+                                               "Failed to write with XmlWriter while saving scene \"%ls\"", _name.GetPointer());
+       }
+       //close "Meshes" element
+       rc = xmlTextWriterEndElement(writer);
+       SysTryCatch(NID_UI_ANIM, rc >= 0, , E_SYSTEM, \
+                                       "Failed to write with XmlWriter while saving scene \"%ls\"", _name.GetPointer());
+
+       //open "Materials" element
+       rc = xmlTextWriterStartElement(writer, BAD_CAST "Materials");
+       SysTryCatch(NID_UI_ANIM, rc >= 0, , E_SYSTEM, \
+                                       "Failed to write with XmlWriter while saving scene \"%ls\"", _name.GetPointer());
+       //write materials
+       count = _materials.GetCount();
+
+       rc = xmlTextWriterWriteFormatAttribute(writer, BAD_CAST "count", "%d", count);
+       SysTryCatch(NID_UI_ANIM, rc >= 0, , E_SYSTEM, \
+                                       "Failed to write with XmlWriter while saving scene \"%ls\"", _name.GetPointer());
+       if (count == 0)  //to close tag right way
+       {
+               rc = xmlTextWriterWriteString(writer, BAD_CAST "");
+               SysTryCatch(NID_UI_ANIM, rc >= 0, , E_SYSTEM, \
+                                               "Failed to write with XmlWriter while saving scene \"%ls\"", _name.GetPointer());
+       }
+       for (int i = 0; i < count && i < MAX_RES_FILES_COUNT; i++)
+       {
+               _materials.GetAt(i, materialDescriptor);
+
+               //open "Material" element
+               rc = xmlTextWriterStartElement(writer, BAD_CAST "Material");
+               SysTryCatch(NID_UI_ANIM, rc >= 0, , E_SYSTEM, \
+                                               "Failed to write with XmlWriter while saving scene \"%ls\"", _name.GetPointer());
+
+               tempTString.Format(50,L"%d",i);
+               tempWString = tempTString.GetPointer();
+               tempString = ConvertWStringToString(tempWString);
+
+               rc = xmlTextWriterWriteAttribute(writer, BAD_CAST "id", BAD_CAST tempString.c_str());
+               SysTryCatch(NID_UI_ANIM, rc >= 0, , E_SYSTEM, \
+                                               "Failed to write with XmlWriter while saving scene \"%ls\"", _name.GetPointer());
+
+               if(materialDescriptor.pMaterial != null)
+               {
+                       tempWString = materialDescriptor.pMaterial->GetName().GetPointer();
+                       tempString = ConvertWStringToString(tempWString);
+
+                       rc = xmlTextWriterWriteAttribute(writer, BAD_CAST "name", BAD_CAST tempString.c_str());
+                       SysTryCatch(NID_UI_ANIM, rc >= 0, , E_SYSTEM, \
+                                                       "Failed to write with XmlWriter while saving scene \"%ls\"", _name.GetPointer());
+               }
+
+               tempWString = materialDescriptor.sourceFileName.GetPointer();
+               tempString = ConvertWStringToString(tempWString);
+
+               rc = xmlTextWriterWriteAttribute(writer, BAD_CAST "sourceFileName", BAD_CAST tempString.c_str());
+               SysTryCatch(NID_UI_ANIM, rc >= 0, , E_SYSTEM, \
+                                               "Failed to write with XmlWriter while saving scene \"%ls\"", _name.GetPointer());
+
+               rc = xmlTextWriterWriteString(writer, BAD_CAST "");
+               SysTryCatch(NID_UI_ANIM, rc >= 0, , E_SYSTEM, \
+                                               "Failed to write with XmlWriter while saving scene \"%ls\"", _name.GetPointer());
+
+               //form material xml file name
+               tempTString.Format(resourceFilesPath.GetLength() + xmlFileName.GetLength() + materialResFileName.GetLength() + materialResFileExtension.GetLength() + 8 + 2, \
+                                       L"%ls%ls%ls%04d%ls", resourceFilesPath.GetPointer(), xmlFileName.GetPointer(), materialResFileName.GetPointer(), i, materialResFileExtension.GetPointer());
+
+
+               if (materialDescriptor.pMaterial != null)
+               {
+                       _MaterialParser::SaveMaterial(materialDescriptor.pMaterial, tempTString);
+                       //TODO://materialDescriptor.pMaterial->SaveMaterialToXml(tempTString);
+               }
+
+               //close "Material" element
+               rc = xmlTextWriterEndElement(writer);
+               SysTryCatch(NID_UI_ANIM, rc >= 0, , E_SYSTEM, \
+                                               "Failed to write with XmlWriter while saving scene \"%ls\"", _name.GetPointer());
+       }
+       //close "Material" element
+       rc = xmlTextWriterEndElement(writer);
+       SysTryCatch(NID_UI_ANIM, rc >= 0, , E_SYSTEM, \
+                                       "Failed to write with XmlWriter while saving scene \"%ls\"", _name.GetPointer());
+
+       //open "Meshes" element
+       rc = xmlTextWriterStartElement(writer, BAD_CAST "Lights");
+       SysTryCatch(NID_UI_ANIM, rc >= 0, , E_SYSTEM, \
+                                       "Failed to write with XmlWriter while saving scene \"%ls\"", _name.GetPointer());
+       //write lights
+       count = _lights.GetCount();
+       rc = xmlTextWriterWriteFormatAttribute(writer, BAD_CAST "count", "%d", count);
+       SysTryCatch(NID_UI_ANIM, rc >= 0, , E_SYSTEM, \
+                                       "Failed to write with XmlWriter while saving scene \"%ls\"", _name.GetPointer());
+       if (count == 0)  //to close tag right way
+       {
+               rc = xmlTextWriterWriteString(writer, BAD_CAST "");
+               SysTryCatch(NID_UI_ANIM, rc >= 0, , E_SYSTEM, \
+                                               "Failed to write with XmlWriter while saving scene \"%ls\"", _name.GetPointer());
+       }
+       for (int i = 0; i < count && i < MAX_RES_FILES_COUNT; i++)
+       {
+               _lights.GetAt(i, lightDescriptor);
+
+               //open "Light" element
+               rc = xmlTextWriterStartElement(writer, BAD_CAST "Light");
+               SysTryCatch(NID_UI_ANIM, rc >= 0, , E_SYSTEM, \
+                                               "Failed to write with XmlWriter while saving scene \"%ls\"", _name.GetPointer());
+
+               tempTString.Format(50,L"%d",i);
+               tempWString = tempTString.GetPointer();
+               tempString = ConvertWStringToString(tempWString);
+
+               rc = xmlTextWriterWriteAttribute(writer, BAD_CAST "id", BAD_CAST tempString.c_str());
+               SysTryCatch(NID_UI_ANIM, rc >= 0, , E_SYSTEM, \
+                                               "Failed to write with XmlWriter while saving scene \"%ls\"", _name.GetPointer());
+
+               if(lightDescriptor.pLight != null)
+               {
+                       tempWString = lightDescriptor.pLight->GetName().GetPointer();
+                       tempString = ConvertWStringToString(tempWString);
+
+                       rc = xmlTextWriterWriteAttribute(writer, BAD_CAST "name", BAD_CAST tempString.c_str());
+                       SysTryCatch(NID_UI_ANIM, rc >= 0, , E_SYSTEM, \
+                                                       "Failed to write with XmlWriter while saving scene \"%ls\"", _name.GetPointer());
+               }
+
+               tempWString = lightDescriptor.sourceFileName.GetPointer();
+               tempString = ConvertWStringToString(tempWString);
+
+               rc = xmlTextWriterWriteAttribute(writer, BAD_CAST "sourceFileName", BAD_CAST tempString.c_str());
+               SysTryCatch(NID_UI_ANIM, rc >= 0, , E_SYSTEM, \
+                                               "Failed to write with XmlWriter while saving scene \"%ls\"", _name.GetPointer());
+
+               rc = xmlTextWriterWriteString(writer, BAD_CAST "");
+               SysTryCatch(NID_UI_ANIM, rc >= 0, , E_SYSTEM, \
+                                               "Failed to write with XmlWriter while saving scene \"%ls\"", _name.GetPointer());
+
+               //form light xml file name
+               tempTString.Format(resourceFilesPath.GetLength() + xmlFileName.GetLength() + lightResFileName.GetLength() + lightResFileExtension.GetLength() + 8 + 2, \
+                               L"%ls%ls%ls%04d%ls", resourceFilesPath.GetPointer(), xmlFileName.GetPointer(), lightResFileName.GetPointer(), i, lightResFileExtension.GetPointer());
+
+               if (lightDescriptor.pLight != null)
+               {
+                       _LightParser::SaveLight(lightDescriptor.pLight, tempTString);
+                       //TODO://lightDescriptor.pLight->SaveLightToXml(tempTString);
+               }
+
+               //close "Light" element
+               rc = xmlTextWriterEndElement(writer);
+               SysTryCatch(NID_UI_ANIM, rc >= 0, , E_SYSTEM, \
+                                               "Failed to write with XmlWriter while saving scene \"%ls\"", _name.GetPointer());
+       }
+       //close "Lights" element
+       rc = xmlTextWriterEndElement(writer);
+       SysTryCatch(NID_UI_ANIM, rc >= 0, , E_SYSTEM, \
+                                       "Failed to write with XmlWriter while saving scene \"%ls\"", _name.GetPointer());
+
+       //open "ShaderPrograms" element
+       rc = xmlTextWriterStartElement(writer, BAD_CAST "ShaderPrograms");
+       SysTryCatch(NID_UI_ANIM, rc >= 0, , E_SYSTEM, \
+                                       "Failed to write with XmlWriter while saving scene \"%ls\"", _name.GetPointer());
+       //write ShaderPrograms
+       count = _shaderPrograms.GetCount();
+       rc = xmlTextWriterWriteFormatAttribute(writer, BAD_CAST "count", "%d", count);
+       SysTryCatch(NID_UI_ANIM, rc >= 0, , E_SYSTEM, \
+                                       "Failed to write with XmlWriter while saving scene \"%ls\"", _name.GetPointer());
+       if (count == 0)  //to close tag right way
+       {
+               rc = xmlTextWriterWriteString(writer, BAD_CAST "");
+               SysTryCatch(NID_UI_ANIM, rc >= 0, , E_SYSTEM, \
+                                               "Failed to write with XmlWriter while saving scene \"%ls\"", _name.GetPointer());
+       }
+       for (int i = 0; i < count; i++)
+       {
+               _shaderPrograms.GetAt(i, shaderProgramDescriptor);
+
+               //open "ShaderProgram" element
+               rc = xmlTextWriterStartElement(writer, BAD_CAST "ShaderProgram");
+               SysTryCatch(NID_UI_ANIM, rc >= 0, , E_SYSTEM, \
+                                               "Failed to write with XmlWriter while saving scene \"%ls\"", _name.GetPointer());
+
+               tempTString.Format(50,L"%d",i);
+               tempWString = tempTString.GetPointer();
+               tempString = ConvertWStringToString(tempWString);
+
+               rc = xmlTextWriterWriteAttribute(writer, BAD_CAST "id", BAD_CAST tempString.c_str());
+               SysTryCatch(NID_UI_ANIM, rc >= 0, , E_SYSTEM, \
+                                               "Failed to write with XmlWriter while saving scene \"%ls\"", _name.GetPointer());
+
+               if (shaderProgramDescriptor.pShaderProgram != null)
+               {
+                       tempWString = shaderProgramDescriptor.pShaderProgram->GetName().GetPointer();
+               }
+               else
+               {
+                       tempWString = L"";
+               }
+               tempString = ConvertWStringToString(tempWString);
+
+               rc = xmlTextWriterWriteAttribute(writer, BAD_CAST "name", BAD_CAST tempString.c_str());
+               SysTryCatch(NID_UI_ANIM, rc >= 0, , E_SYSTEM, \
+                                               "Failed to write with XmlWriter while saving scene \"%ls\"", _name.GetPointer());
+
+               tempWString = shaderProgramDescriptor.sourceFileName.GetPointer();
+               tempString = ConvertWStringToString(tempWString);
+
+               rc = xmlTextWriterWriteAttribute(writer, BAD_CAST "sourceFileName", BAD_CAST tempString.c_str());
+               SysTryCatch(NID_UI_ANIM, rc >= 0, , E_SYSTEM, \
+                                               "Failed to write with XmlWriter while saving scene \"%ls\"", _name.GetPointer());
+
+               //write shader to text file
+               tempTString.Format(resourceFilesPath.GetLength() + xmlFileName.GetLength() + vertexShaderResFileName.GetLength() + vertexShaderResFileExtension.GetLength() + 8 + 2, \
+                                               L"%ls%ls%ls%04d%ls", resourceFilesPath.GetPointer(), xmlFileName.GetPointer(), vertexShaderResFileName.GetPointer(), i, vertexShaderResFileExtension.GetPointer());
+               tempWString = tempTString.GetPointer();
+               tempString = ConvertWStringToString(tempWString);
+
+               std::ofstream vertex(tempString.c_str(), std::ofstream::out);
+               if (vertex.good())
+               {
+                       tempWString = shaderProgramDescriptor.vertexShader.GetPointer();
+                       tempString = ConvertWStringToString(tempWString);
+
+                       vertex.write(tempString.c_str(), tempString.length());
+                       vertex.close();
+               }
+
+////for UTF-8 shader saving in .are
+//             rc = xmlTextWriterWriteElement(writer, BAD_CAST "VertexShader", BAD_CAST tempString.c_str());
+//             SysTryCatch(NID_UI_ANIM, rc >= 0, , E_SYSTEM, \
+                                               "Failed to write with XmlWriter while saving scene \"%ls\"", _name.GetPointer());
+
+               tempTString.Format(resourceFilesPath.GetLength() + xmlFileName.GetLength() + fragmentShaderResFileName.GetLength() + fragmentShaderResFileExtension.GetLength() + 8 + 2, \
+                                               L"%ls%ls%ls%04d%ls", resourceFilesPath.GetPointer(), xmlFileName.GetPointer(), fragmentShaderResFileName.GetPointer(), i, fragmentShaderResFileExtension.GetPointer());
+               tempWString = tempTString.GetPointer();
+               tempString = ConvertWStringToString(tempWString);
+
+               std::ofstream fragment(tempString.c_str(), std::ofstream::out);
+               if (fragment.good())
+               {
+                       tempWString = shaderProgramDescriptor.fragmentShader.GetPointer();
+                       tempString = ConvertWStringToString(tempWString);
+
+                       fragment.write(tempString.c_str(), tempString.length());
+                       fragment.close();
+               }
+
+
+////for UTF-8 shader saving in .are
+//             rc = xmlTextWriterWriteElement(writer, BAD_CAST "FragmentShader", BAD_CAST tempString.c_str());
+//             SysTryCatch(NID_UI_ANIM, rc >= 0, , E_SYSTEM, \
+                                               "Failed to write with XmlWriter while saving scene \"%ls\"", _name.GetPointer());
+
+               //close "ShaderProgram" element
+               rc = xmlTextWriterEndElement(writer);
+               SysTryCatch(NID_UI_ANIM, rc >= 0, , E_SYSTEM, \
+                                               "Failed to write with XmlWriter while saving scene \"%ls\"", _name.GetPointer());
+       }
+       //close "ShaderPrograms" element
+       rc = xmlTextWriterEndElement(writer);
+       SysTryCatch(NID_UI_ANIM, rc >= 0, , E_SYSTEM, \
+                                       "Failed to write with XmlWriter while saving scene \"%ls\"", _name.GetPointer());
+
+       //open "TextureFileNames" element
+       rc = xmlTextWriterStartElement(writer, BAD_CAST "TextureFileNames");
+       SysTryCatch(NID_UI_ANIM, rc >= 0, , E_SYSTEM, \
+                                       "Failed to write with XmlWriter while saving scene \"%ls\"", _name.GetPointer());
+       //write TextureFileNames
+       count = _textureFileNames.GetCount();
+       rc = xmlTextWriterWriteFormatAttribute(writer, BAD_CAST "count", "%d", count);
+       SysTryCatch(NID_UI_ANIM, rc >= 0, , E_SYSTEM, \
+                                       "Failed to write with XmlWriter while saving scene \"%ls\"", _name.GetPointer());
+       if (count == 0)  //to close tag right way
+       {
+               rc = xmlTextWriterWriteString(writer, BAD_CAST "");
+               SysTryCatch(NID_UI_ANIM, rc >= 0, , E_SYSTEM, \
+                                               "Failed to write with XmlWriter while saving scene \"%ls\"", _name.GetPointer());
+       }
+       for (int i = 0; i < count; i++)
+       {
+               //open "TextureFileName" element
+               rc = xmlTextWriterStartElement(writer, BAD_CAST "TextureFileName");
+               SysTryCatch(NID_UI_ANIM, rc >= 0, , E_SYSTEM, \
+                                               "Failed to write with XmlWriter while saving scene \"%ls\"", _name.GetPointer());
+
+               rc = xmlTextWriterWriteFormatAttribute(writer, BAD_CAST "id", "%d", i);
+               SysTryCatch(NID_UI_ANIM, rc >= 0, , E_SYSTEM, \
+                                               "Failed to write with XmlWriter while saving scene \"%ls\"", _name.GetPointer());
+
+               _textureFileNames.GetAt(i, tempTString);
+               tempWString = tempTString.GetPointer();
+               tempString = ConvertWStringToString(tempWString);
+
+               rc = xmlTextWriterWriteAttribute(writer, BAD_CAST "textureFileName", BAD_CAST tempString.c_str());
+               SysTryCatch(NID_UI_ANIM, rc >= 0, , E_SYSTEM, \
+                                               "Failed to write with XmlWriter while saving scene \"%ls\"", _name.GetPointer());
+
+               rc = xmlTextWriterWriteString(writer, BAD_CAST "");
+               SysTryCatch(NID_UI_ANIM, rc >= 0, , E_SYSTEM, \
+                                               "Failed to write with XmlWriter while saving scene \"%ls\"", _name.GetPointer());
+
+               //close "TextureFileName" element
+               rc = xmlTextWriterEndElement(writer);
+               SysTryCatch(NID_UI_ANIM, rc >= 0, , E_SYSTEM, \
+                                               "Failed to write with XmlWriter while saving scene \"%ls\"", _name.GetPointer());
+       }
+       //close "TextureFileNames" element
+       rc = xmlTextWriterEndElement(writer);
+       SysTryCatch(NID_UI_ANIM, rc >= 0, , E_SYSTEM, \
+                                       "Failed to write with XmlWriter while saving scene \"%ls\"", _name.GetPointer());
+
+       //open "VisualElements" element
+       rc = xmlTextWriterStartElement(writer, BAD_CAST "VisualElements");
+       SysTryCatch(NID_UI_ANIM, rc >= 0, , E_SYSTEM, \
+                                       "Failed to write with XmlWriter while saving scene \"%ls\"", _name.GetPointer());
+       //write root children VisualElements
+       count = _pSceneRootVisualElement->GetChildrenCount();
+       if (count == 0)  //to close tag right way
+       {
+               rc = xmlTextWriterWriteString(writer, BAD_CAST "");
+               SysTryCatch(NID_UI_ANIM, rc >= 0, , E_SYSTEM, \
+                                               "Failed to write with XmlWriter while saving scene \"%ls\"", _name.GetPointer());
+       }
+       else
+       {
+               //save root children
+               childrenVisualElementList = _pSceneRootVisualElement->GetChildrenN();
+               if (childrenVisualElementList != null)
+               {
+                       count = childrenVisualElementList->GetCount();
+                       for (int i = 0; i < count; i++)
+                       {
+                               pChildVisualElement = (VisualElement*)childrenVisualElementList->GetAt(i);
+                               if (pChildVisualElement != null)
+                               {
+                                       r = __SaveSceneVisualElementTree(writer, pChildVisualElement);
+                                       SysTryCatch(NID_UI_ANIM, r == E_SUCCESS , , r, \
+                                                       "Failed save scene \"%ls\" propagating", _name.GetPointer());
+                               }
+                       }
+
+                       delete childrenVisualElementList;
+                       childrenVisualElementList = null;
+               }
+       }
+
+       //close "VisualElements" element
+       rc = xmlTextWriterEndElement(writer);
+       SysTryCatch(NID_UI_ANIM, rc >= 0, , E_SYSTEM, \
+                                       "Failed to write with XmlWriter while saving scene \"%ls\"", _name.GetPointer());
+
+       //write close "Scene"
+       rc = xmlTextWriterEndElement(writer);
+       SysTryCatch(NID_UI_ANIM, rc >= 0, , E_SYSTEM, \
+                                       "Failed to write with XmlWriter while saving scene \"%ls\"", _name.GetPointer());
+
+       //close document
+       rc = xmlTextWriterEndDocument(writer);
+
+
+       //finishing document
+       xmlFreeTextWriter(writer);
+
+       return E_SUCCESS;
+CATCH:
+       xmlFreeTextWriter(writer);
+       if (childrenVisualElementList != null)
+       {
+               delete childrenVisualElementList;
+       }
+
+
+       return E_SYSTEM;
+}
+
+result
+_SceneImpl::__SaveSceneVisualElementTree(const xmlTextWriterPtr writer, const VisualElement* pVisualElement) const
+{
+       IList* childrenVisualElementList = null;
+       Mesh* pMesh = null;
+       Material* pMaterial = null;
+       Light* pLight = null;
+       ShaderProgram* pShaderProgram = null;
+       VisualElement* pChildVisualElement = null;
+       int rc;
+       std::string tempString;
+       std::wstring tempWString;
+       String tempTString;
+
+       //open "VisualElement" element
+       rc = xmlTextWriterStartElement(writer, BAD_CAST "VisualElement");
+       SysTryReturnResult(NID_UI_ANIM, rc >= 0, E_SYSTEM, \
+                                       "Failed to write with XmlWriter while saving scene \"%ls\"", _name.GetPointer());
+
+       //save current VE ids to xml
+       pMesh = pVisualElement->GetMeshN();
+       if (pMesh != null)
+       {
+               tempTString.Format(50,L"%d", ContainsMesh(pMesh));
+               delete pMesh;
+               pMesh = null;
+       }
+       else
+       {
+               tempTString.Format(50,L"%d", -1);
+       }
+       tempWString = tempTString.GetPointer();
+       tempString = ConvertWStringToString(tempWString);
+
+       rc = xmlTextWriterWriteAttribute(writer, BAD_CAST "meshId", BAD_CAST tempString.c_str());
+       SysTryReturnResult(NID_UI_ANIM, rc >= 0, E_SYSTEM, \
+                                       "Failed to write with XmlWriter while saving scene \"%ls\"", _name.GetPointer());
+
+       pMaterial = pVisualElement->GetMaterialN();
+       if (pMaterial != null)
+       {
+               tempTString.Format(50,L"%d", ContainsMaterial(pMaterial));
+               delete pMaterial;
+               pMaterial = null;
+       }
+       else
+       {
+               tempTString.Format(50,L"%d", -1);
+       }
+       tempWString = tempTString.GetPointer();
+       tempString = ConvertWStringToString(tempWString);
+
+       rc = xmlTextWriterWriteAttribute(writer, BAD_CAST "materialId", BAD_CAST tempString.c_str());
+       SysTryReturnResult(NID_UI_ANIM, rc >= 0, E_SYSTEM, \
+                                       "Failed to write with XmlWriter while saving scene \"%ls\"", _name.GetPointer());
+
+       pLight = pVisualElement->GetLightN();
+       if (pLight != null)
+       {
+               tempTString.Format(50,L"%d", ContainsLight(pLight));
+               delete pLight;
+               pLight = null;
+       }
+       else
+       {
+               tempTString.Format(50,L"%d", -1);
+       }
+       tempWString = tempTString.GetPointer();
+       tempString = ConvertWStringToString(tempWString);
+
+       rc = xmlTextWriterWriteAttribute(writer, BAD_CAST "lightId", BAD_CAST tempString.c_str());
+       SysTryReturnResult(NID_UI_ANIM, rc >= 0, E_SYSTEM, \
+                                       "Failed to write with XmlWriter while saving scene \"%ls\"", _name.GetPointer());
+
+       pShaderProgram = pVisualElement->GetShaderProgramN();
+       if (pShaderProgram != null)
+       {
+               tempTString.Format(50,L"%d", ContainsShaderProgram(pShaderProgram));
+               delete pShaderProgram;
+               pShaderProgram = null;
+       }
+       else
+       {
+               tempTString.Format(50,L"%d", -1);
+       }
+       tempWString = tempTString.GetPointer();
+       tempString = ConvertWStringToString(tempWString);
+
+       rc = xmlTextWriterWriteAttribute(writer, BAD_CAST "shaderProgramId", BAD_CAST tempString.c_str());
+       SysTryReturnResult(NID_UI_ANIM, rc >= 0, E_SYSTEM, \
+                                       "Failed to write with XmlWriter while saving scene \"%ls\"", _name.GetPointer());
+
+       //save current ve content
+       rc = xmlTextWriterWriteFormatAttribute(writer, BAD_CAST "name", "%ls", pVisualElement->GetName().GetPointer());
+       SysTryReturnResult(NID_UI_ANIM, rc >= 0, E_SYSTEM, \
+                                       "Failed to write with XmlWriter while saving scene \"%ls\"", _name.GetPointer());
+
+       FloatPoint point = pVisualElement->GetAnchor();
+       rc = xmlTextWriterWriteFormatAttribute(writer, BAD_CAST "anchor", "%f %f", point.x, point.y);
+       SysTryReturnResult(NID_UI_ANIM, rc >= 0, E_SYSTEM, \
+                                       "Failed to write with XmlWriter while saving scene \"%ls\"", _name.GetPointer());
+
+       rc = xmlTextWriterWriteFormatAttribute(writer, BAD_CAST "anchorZ", "%f", pVisualElement->GetAnchorZ());
+       SysTryReturnResult(NID_UI_ANIM, rc >= 0, E_SYSTEM, \
+                                       "Failed to write with XmlWriter while saving scene \"%ls\"", _name.GetPointer());
+
+       FloatRectangle rectangle = pVisualElement->GetBounds();
+       rc = xmlTextWriterWriteFormatAttribute(writer, BAD_CAST "bounds", "%f %f %f %f", rectangle.x, rectangle.y, rectangle.width, rectangle.height);
+       SysTryReturnResult(NID_UI_ANIM, rc >= 0, E_SYSTEM, \
+                                       "Failed to write with XmlWriter while saving scene \"%ls\"", _name.GetPointer());
+
+       FloatMatrix4 matrix = pVisualElement->GetTransformMatrix();
+       rc = xmlTextWriterWriteFormatAttribute(writer, BAD_CAST "transformMatrix", "%f %f %f %f  %f %f %f %f  %f %f %f %f  %f %f %f %f", \
+                       matrix.matrix[0][0], matrix.matrix[0][1], matrix.matrix[0][2], matrix.matrix[0][3],
+                       matrix.matrix[1][0], matrix.matrix[1][1], matrix.matrix[1][2], matrix.matrix[1][3],
+                       matrix.matrix[2][0], matrix.matrix[2][1], matrix.matrix[2][2], matrix.matrix[2][3],
+                       matrix.matrix[3][0], matrix.matrix[3][1], matrix.matrix[3][2], matrix.matrix[3][3]);
+       SysTryReturnResult(NID_UI_ANIM, rc >= 0, E_SYSTEM, \
+                                       "Failed to write with XmlWriter while saving scene \"%ls\"", _name.GetPointer());
+
+       matrix = pVisualElement->GetChildrenTransformMatrix();
+       rc = xmlTextWriterWriteFormatAttribute(writer, BAD_CAST "childrenTransformMatrix", "%f %f %f %f  %f %f %f %f  %f %f %f %f  %f %f %f %f", \
+                       matrix.matrix[0][0], matrix.matrix[0][1], matrix.matrix[0][2], matrix.matrix[0][3],
+                       matrix.matrix[1][0], matrix.matrix[1][1], matrix.matrix[1][2], matrix.matrix[1][3],
+                       matrix.matrix[2][0], matrix.matrix[2][1], matrix.matrix[2][2], matrix.matrix[2][3],
+                       matrix.matrix[3][0], matrix.matrix[3][1], matrix.matrix[3][2], matrix.matrix[3][3]);
+       SysTryReturnResult(NID_UI_ANIM, rc >= 0, E_SYSTEM, \
+                                       "Failed to write with XmlWriter while saving scene \"%ls\"", _name.GetPointer());
+
+       rc = xmlTextWriterWriteFormatAttribute(writer, BAD_CAST "clipChildrenEnabled", "%s", pVisualElement->IsClipChildrenEnabled()?"true":"false");
+       SysTryReturnResult(NID_UI_ANIM, rc >= 0, E_SYSTEM, \
+                                       "Failed to write with XmlWriter while saving scene \"%ls\"", _name.GetPointer());
+
+       rectangle = pVisualElement->GetContentBounds();
+       rc = xmlTextWriterWriteFormatAttribute(writer, BAD_CAST "contentBounds", "%f %f %f %f", rectangle.x, rectangle.y, rectangle.width, rectangle.height);
+       SysTryReturnResult(NID_UI_ANIM, rc >= 0, E_SYSTEM, \
+                                       "Failed to write with XmlWriter while saving scene \"%ls\"", _name.GetPointer());
+
+       rc = xmlTextWriterWriteFormatAttribute(writer, BAD_CAST "implicitAnimationEnabled", "%s", pVisualElement->IsImplicitAnimationEnabled()?"true":"false");
+       SysTryReturnResult(NID_UI_ANIM, rc >= 0, E_SYSTEM, \
+                                       "Failed to write with XmlWriter while saving scene \"%ls\"", _name.GetPointer());
+
+       rc = xmlTextWriterWriteFormatAttribute(writer, BAD_CAST "opacity", "%f", pVisualElement->GetOpacity());
+       SysTryReturnResult(NID_UI_ANIM, rc >= 0, E_SYSTEM, \
+                                       "Failed to write with XmlWriter while saving scene \"%ls\"", _name.GetPointer());
+
+       rc = xmlTextWriterWriteFormatAttribute(writer, BAD_CAST "renderOperation", "%d", (int)pVisualElement->GetRenderOperation());
+       SysTryReturnResult(NID_UI_ANIM, rc >= 0, E_SYSTEM, \
+                                       "Failed to write with XmlWriter while saving scene \"%ls\"", _name.GetPointer());
+
+       rc = xmlTextWriterWriteFormatAttribute(writer, BAD_CAST "showState", "%s", pVisualElement->GetShowState()?"true":"false");
+       SysTryReturnResult(NID_UI_ANIM, rc >= 0, E_SYSTEM, \
+                                       "Failed to write with XmlWriter while saving scene \"%ls\"", _name.GetPointer());
+
+       rc = xmlTextWriterWriteFormatAttribute(writer, BAD_CAST "zorderGroup", "%d", pVisualElement->GetZOrderGroup());
+       SysTryReturnResult(NID_UI_ANIM, rc >= 0, E_SYSTEM, \
+                                       "Failed to write with XmlWriter while saving scene \"%ls\"", _name.GetPointer());
+
+       rc = xmlTextWriterWriteFormatAttribute(writer, BAD_CAST "zposition", "%f", pVisualElement->GetOpacity());
+       SysTryReturnResult(NID_UI_ANIM, rc >= 0, E_SYSTEM, \
+                                       "Failed to write with XmlWriter while saving scene \"%ls\"", _name.GetPointer());
+
+       //write children VisualElements
+       int count = pVisualElement->GetChildrenCount();
+       if (count == 0)  //to close tag right way
+       {
+               rc = xmlTextWriterWriteString(writer, BAD_CAST "");
+               SysTryReturnResult(NID_UI_ANIM, rc >= 0, E_SYSTEM, \
+                                               "Failed to write with XmlWriter while saving scene \"%ls\"", _name.GetPointer());
+       }
+       else
+       {
+               result r = E_SUCCESS;
+               //get children
+               childrenVisualElementList = pVisualElement->GetChildrenN();
+               if (childrenVisualElementList != null)
+               {
+                       count = childrenVisualElementList->GetCount();
+                       for (int i = 0; i < count; i++)
+                       {
+                               pChildVisualElement = (VisualElement*)childrenVisualElementList->GetAt(i);
+                               if (pChildVisualElement != null)
+                               {
+                                       r = __SaveSceneVisualElementTree(writer, pChildVisualElement);
+                                       if (r != E_SUCCESS)
+                                       {
+                                               delete childrenVisualElementList;
+                                               childrenVisualElementList = null;
+                                               return r;
+                                       }
+                               }
+                       }
+
+                       delete childrenVisualElementList;
+                       childrenVisualElementList = null;
+               }
+       }
+
+       //close "VisualElement" element
+       rc = xmlTextWriterEndElement(writer);
+       SysTryReturnResult(NID_UI_ANIM, rc >= 0, E_SYSTEM, \
+                                       "Failed to write with XmlWriter while saving scene \"%ls\"", _name.GetPointer());
+
+       return E_SUCCESS;
+}
+
+void __LoadSceneOnStartDocument(void* pUserData){}
+void __LoadSceneOnStartElement(void* pUserData, const xmlChar* pName, const xmlChar **pAttributes);
+void __LoadSceneOnContent(void* pUserData, const xmlChar* pContent, int length);
+void __LoadSceneOnEndElement(void* pUserData, const xmlChar* pName);
+void __LoadSceneOnEndDocument(void* pUserData){}
+void __LoadSceneOnError(void* pUserData, const char *pMsg){}
+
+struct __SceneSAXParsingUserData
+{
+       __SceneSAXParsingUserData(void)
+       {
+               parsingResult = E_SUCCESS;
+               pCurrentParentVisualElement = null;
+
+               currentMeshId = -1;
+               currentMaterialId = -1;
+               currentLightId = -1;
+               currentShaderProgramId = -1;
+               currentTexturFileNameId = -1;
+
+               isScene = false;
+               isMeshes = false; isMesh = false;
+               isMaterials = false; isMaterial = false;
+               isLights = false; isLight = false;
+               isShaderPrograms = false; isShaderProgram = false; isVertexShader = false; isFragmentShader = false;
+               isTextureFileNames = false; isTextureFileName = false;
+               isVisualElements = false; isVisualElement = false;
+       }
+       void Clear(void)
+       {
+//             currentMeshId = -1;
+//             currentMaterialId = -1;
+//             currentLightId = -1;
+//             currentShaderProgramId = -1;
+//             currentTexturFileNameId = -1;
+
+               meshDescriptor.Clear();
+               materialDescriptor.Clear();
+               lightDescriptor.Clear();
+               shaderProgramDescriptor.Clear();
+
+               shaderProgramName.Clear();
+               texfureFileName.Clear();
+       }
+
+       result parsingResult;
+
+       int currentMeshId;
+       int currentMaterialId;
+       int currentLightId;
+       int currentShaderProgramId;
+       int currentTexturFileNameId;
+
+       _SceneMeshDescriptor meshDescriptor;
+       _SceneMaterialDescriptor materialDescriptor;
+       _SceneLightDescriptor lightDescriptor;
+       _SceneShaderProgramDescriptor shaderProgramDescriptor;
+
+       VisualElement* pCurrentParentVisualElement;
+
+       String filesPath, scenePrefix, resourceFilesPath;
+
+       String shaderProgramName;
+       String texfureFileName;
+
+       _SceneImpl* pSceneImpl;
+
+       bool isScene;
+       bool isMeshes, isMesh;
+       bool isMaterials, isMaterial;
+       bool isLights, isLight;
+       bool isShaderPrograms, isShaderProgram, isVertexShader, isFragmentShader;
+       bool isTextureFileNames, isTextureFileName;
+       bool isVisualElements, isVisualElement;
+
+//     ArrayListT<  __SceneVisualElementDescriptor > children;
+};
+
+Scene*
+_SceneImpl::LoadSceneN(const Tizen::Base::String filesPath, const Tizen::Base::String resourceFilesPath, const Tizen::Base::String scenePrefix, VisualElement& sceneRootVisualElement) //in format: home/abc/scenespath/ or c:\\abc\\scenepath\\     ..
+{
+       std::string tempString;
+       std::wstring tempWString;
+       String tempTString;
+       int rc;
+       xmlError* err;
+       Scene* pScene = null;
+       struct __SceneSAXParsingUserData* pUserData = null;
+       result r;
+
+
+       //file name generating
+       String xmlFileName = scenePrefix;
+       //xmlFileName.Format(10,L"scene%5d",_name.GetHashCode());
+       String sceneDescriptorExtension = SCENE_DESCTRIPTOR_FILE_EXTENSION;
+       tempTString.Format(filesPath.GetLength() + xmlFileName.GetLength() + sceneDescriptorExtension.GetLength() + 2, \
+                       L"%ls%ls%ls", filesPath.GetPointer(), xmlFileName.GetPointer(), sceneDescriptorExtension.GetPointer());
+       tempWString = tempTString.GetPointer();
+       tempString = ConvertWStringToString(tempWString);
+
+       std::ifstream f(tempString.c_str());
+       SysTryReturn(NID_UI_ANIM, f.good(), null, E_FILE_NOT_FOUND, \
+                       "Cannot open file %s while loading scene.", tempString.c_str());
+       f.close();
+
+       xmlSAXHandler sceneSAXHandler;
+       memset(&sceneSAXHandler, 0, sizeof(_xmlSAXHandler));
+       //mySAXHandler.startDocument = __LoadSceneOnStartDocument;
+       sceneSAXHandler.startElement = __LoadSceneOnStartElement;
+       sceneSAXHandler.characters = __LoadSceneOnContent;
+       sceneSAXHandler.endElement = __LoadSceneOnEndElement;
+       //mySAXHandler.endDocument = __LoadSceneOnEndDocument;
+       //mySAXHandler.error = __LoadSceneOnError;
+
+       pUserData =  new (std::nothrow) struct __SceneSAXParsingUserData;
+       SysTryCatch(NID_UI_ANIM, pUserData != null, , E_OUT_OF_MEMORY, \
+                                       "Insufficient memory.");
+
+       pScene = new (std::nothrow) Scene();
+       SysTryCatch(NID_UI_ANIM, pScene != null, , E_OUT_OF_MEMORY, \
+                               "Insufficient memory.");
+
+       r = pScene->Construct(sceneRootVisualElement);
+
+       SysTryCatch(NID_UI_ANIM, r == E_SUCCESS, , r, \
+                                       "Scene construct error, propagating.");
+
+       pUserData->pSceneImpl = pScene->__pSceneImpl;
+       pUserData->parsingResult = E_SUCCESS;
+       pUserData->filesPath = filesPath;
+       pUserData->scenePrefix = scenePrefix;
+       pUserData->resourceFilesPath = resourceFilesPath;
+       pUserData->pCurrentParentVisualElement = pScene->GetRootVisualElement();
+
+       //start parsing
+       rc = xmlSAXUserParseFile(&sceneSAXHandler, (void*)pUserData, tempString.c_str());
+       err = xmlGetLastError();
+
+       SysTryCatch(NID_UI_ANIM, rc == 0,  , E_SYSTEM, \
+                       "Xml error while parsing file %s while loading scene. Error message: %s", tempString.c_str(), err->message);
+
+       SysTryCatch(NID_UI_ANIM, pUserData->parsingResult == E_SUCCESS, , pUserData->parsingResult, \
+                               "Error propagating while loading scene .");
+
+       return pScene;
+
+CATCH:
+       if (pUserData != null)
+       {
+               delete pUserData;
+               pUserData = null;
+       }
+       if (pScene != null)
+       {
+               delete pScene;
+               pScene = null;
+       }
+       return null;
+}
+
+void
+__LoadSceneOnStartElement(void* pUserData, const xmlChar* pName, const xmlChar **pAttributes)
+{
+       String elementName((const char*)pName);
+       std::string tempString;
+       std::wstring tempWString;
+       int count;
+       String attributeName;
+       String attributeValue;
+       result r;
+
+       struct __SceneSAXParsingUserData* pUserDataT = (struct __SceneSAXParsingUserData*)pUserData;
+       if (pUserDataT->parsingResult != E_SUCCESS)
+       {
+               return;
+       }
+
+       //read resources properties to create them on element closing
+       if (pUserDataT->isMeshes && !pUserDataT->isMesh)
+       {
+               if (elementName.CompareTo("Mesh") == 0)
+               {
+                       pUserDataT->isMesh = true;
+                       pUserDataT->currentMeshId = -1;
+                       pUserDataT->meshDescriptor.Clear();
+
+                       if (pAttributes != null)
+                       {
+                               for (int i = 0; pAttributes[i] != null; i+=2)
+                               {
+                                       attributeName = (const char*) pAttributes[i];
+                                       //attributeValue = (const char*) pAttributes[i+1];
+                                       if (attributeName.CompareTo("id") == 0)
+                                       {
+                                               pUserDataT->currentMeshId = atoi((const char*) pAttributes[i+1]);
+                                               //pUserDataT->currentMeshId = (const char*) pAttributes[i+1];
+                                               continue;
+                                       }
+                                       if (attributeName.CompareTo("sourceFileName") == 0)
+                                       {
+                                               pUserDataT->meshDescriptor.sourceFileName = (const char*) pAttributes[i+1];
+                                               continue;
+                                       }
+                                       if (attributeName.CompareTo("modelNameInSourceFile") == 0)
+                                       {
+                                               pUserDataT->meshDescriptor.modelNameInSourceFile = (const char*) pAttributes[i+1];
+                                               continue;
+                                       }
+                               }
+                       }
+
+                       return;
+               }
+       }
+
+       if (pUserDataT->isMaterials && !pUserDataT->isMaterial)
+       {
+               if (elementName.CompareTo("Material") == 0)
+               {
+                       pUserDataT->isMaterial = true;
+                       pUserDataT->currentMaterialId = -1;
+                       pUserDataT->materialDescriptor.Clear();
+
+                       if (pAttributes != null)
+                       {
+                               for (int i = 0; pAttributes[i] != null; i+=2)
+                               {
+                                       attributeName = (const char*) pAttributes[i];
+                                       //attributeValue = (const char*) pAttributes[i+1];
+                                       if (attributeName.CompareTo("id") == 0)
+                                       {
+                                               pUserDataT->currentMaterialId = atoi((const char*) pAttributes[i+1]);
+                                               //pUserDataT->currentMeshId = (const char*) pAttributes[i+1];
+                                               continue;
+                                       }
+                                       if (attributeName.CompareTo("sourceFileName") == 0)
+                                       {
+                                               pUserDataT->materialDescriptor.sourceFileName = (const char*) pAttributes[i+1];
+                                               continue;
+                                       }
+                               }
+                       }
+
+                       return;
+               }
+       }
+
+       if (pUserDataT->isLights && !pUserDataT->isLight)
+       {
+               if (elementName.CompareTo("Light") == 0)
+               {
+                       pUserDataT->isLight = true;
+                       pUserDataT->currentLightId = -1;
+                       pUserDataT->lightDescriptor.Clear();
+
+                       if (pAttributes != null)
+                       {
+                               for (int i = 0; pAttributes[i] != null; i+=2)
+                               {
+                                       attributeName = (const char*) pAttributes[i];
+                                       //attributeValue = (const char*) pAttributes[i+1];
+                                       if (attributeName.CompareTo("id") == 0)
+                                       {
+                                               pUserDataT->currentLightId = atoi((const char*) pAttributes[i+1]);
+                                               //pUserDataT->currentMeshId = (const char*) pAttributes[i+1];
+                                               continue;
+                                       }
+                                       if (attributeName.CompareTo("sourceFileName") == 0)
+                                       {
+                                               pUserDataT->lightDescriptor.sourceFileName = (const char*) pAttributes[i+1];
+                                               continue;
+                                       }
+                               }
+                       }
+
+                       return;
+               }
+       }
+
+       if (pUserDataT->isShaderPrograms && !pUserDataT->isShaderProgram)
+       {
+               if (elementName.CompareTo("ShaderProgram") == 0)
+               {
+                       pUserDataT->isShaderProgram = true;
+                       pUserDataT->currentShaderProgramId = -1;
+                       pUserDataT->shaderProgramName.Clear();
+                       pUserDataT->shaderProgramDescriptor.Clear();
+
+                       if (pAttributes != null)
+                       {
+                               for (int i = 0; pAttributes[i] != null; i+=2)
+                               {
+                                       attributeName = (const char*) pAttributes[i];
+                                       //attributeValue = (const char*) pAttributes[i+1];
+                                       if (attributeName.CompareTo("id") == 0)
+                                       {
+                                               pUserDataT->currentShaderProgramId = atoi((const char*) pAttributes[i+1]);
+                                               continue;
+                                       }
+                                       if (attributeName.CompareTo("name") == 0)
+                                       {
+                                               pUserDataT->shaderProgramName = (const char*) pAttributes[i+1];
+                                               continue;
+                                       }
+                                       if (attributeName.CompareTo("sourceFileName") == 0)
+                                       {
+                                               pUserDataT->shaderProgramDescriptor.sourceFileName = (const char*) pAttributes[i+1];
+                                               continue;
+                                       }
+                               }
+                       }
+
+                       return;
+               }
+       }
+////for UTF-8 shader saving in .are
+//     if (pUserDataT->isShaderProgram && !pUserDataT->isVertexShader && !pUserDataT->isFragmentShader)
+//     {
+//             if (elementName.CompareTo("VertexShader") == 0)
+//             {
+//                     pUserDataT->isVertexShader = true;
+//                     return;
+//             }
+//     }
+//
+//
+//     if (pUserDataT->isShaderProgram && !pUserDataT->isVertexShader && !pUserDataT->isFragmentShader)
+//     {
+//             if (elementName.CompareTo("FragmentShader") == 0)
+//             {
+//                     pUserDataT->isFragmentShader = true;
+//                     return;
+//             }
+//     }
+
+       if (pUserDataT->isTextureFileNames && !pUserDataT->isTextureFileName)
+       {
+               if (elementName.CompareTo("TextureFileName") == 0)
+               {
+                       pUserDataT->isTextureFileName = true;
+                       pUserDataT->currentTexturFileNameId = -1;
+                       pUserDataT->texfureFileName.Clear();
+
+                       if (pAttributes != null)
+                       {
+                               for (int i = 0; pAttributes[i] != null; i+=2)
+                               {
+                                       attributeName = (const char*) pAttributes[i];
+                                       //attributeValue = (const char*) pAttributes[i+1];
+                                       if (attributeName.CompareTo("id") == 0)
+                                       {
+                                               pUserDataT->currentTexturFileNameId = atoi((const char*) pAttributes[i+1]);
+                                               continue;
+                                       }
+                                       if (attributeName.CompareTo("textureFileName") == 0)
+                                       {
+                                               pUserDataT->texfureFileName = (const char*) pAttributes[i+1];
+                                               continue;
+                                       }
+                               }
+                       }
+
+                       return;
+               }
+       }
+
+       if (pUserDataT->isVisualElements)
+       {
+               if (elementName.CompareTo("VisualElement") == 0)
+               {
+                       pUserDataT->isVisualElement = true;
+                       _SceneVisualElementDescriptor veDescr;
+                       if (pAttributes != null)
+                       {
+                               for (int i = 0; pAttributes[i] != null; i+=2)
+                               {
+                                       attributeName = (const char*) pAttributes[i];
+                                       //attributeValue = (const char*) pAttributes[i+1];
+
+                                       if (attributeName.CompareTo("meshId") == 0)
+                                       {
+                                               veDescr.meshId = atoi((const char*) pAttributes[i+1]);
+                                               //sscanf((const char*) pAttributes[i+1], "%d", &visualElementDescriptor.meshId);
+                                               continue;
+                                       }
+                                       if (attributeName.CompareTo("materialId") == 0)
+                                       {
+                                               veDescr.materialId = atoi((const char*) pAttributes[i+1]);
+                                               continue;
+                                       }
+                                       if (attributeName.CompareTo("lightId") == 0)
+                                       {
+                                               veDescr.lightId = atoi((const char*) pAttributes[i+1]);
+                                               continue;
+                                       }
+                                       if (attributeName.CompareTo("shaderProgramId") == 0)
+                                       {
+                                               veDescr.shaderProgramId = atoi((const char*) pAttributes[i+1]);
+                                               continue;
+                                       }
+
+                                       if (attributeName.CompareTo("name") == 0)
+                                       {
+                                               veDescr.name = (const char*) pAttributes[i+1];
+                                               continue;
+                                       }
+                                       if (attributeName.CompareTo("anchor")  == 0)
+                                       {
+                                               sscanf((const char*) pAttributes[i+1], "%f %f", \
+                                                               &veDescr.anchor.x, &veDescr.anchor.y);
+                                               continue;
+                                       }
+                                       if (attributeName.CompareTo("anchorZ") == 0)
+                                       {
+                                               sscanf((const char*) pAttributes[i+1], "%f", &veDescr.anchorZ);
+                                               continue;
+                                       }
+                                       if (attributeName.CompareTo("bounds") == 0)
+                                       {
+                                               sscanf((const char*) pAttributes[i+1], "%f %f %f %f", \
+                                                               &veDescr.bounds.x, &veDescr.bounds.y, &veDescr.bounds.width, &veDescr.bounds.height);
+                                               continue;
+                                       }
+                                       if (attributeName.CompareTo("transformMatrix") == 0)
+                                       {
+                                               sscanf((const char*) pAttributes[i+1], "%f %f %f %f  %f %f %f %f  %f %f %f %f  %f %f %f %f", \
+                                                               &veDescr.transformMatrix.matrix[0][0], &veDescr.transformMatrix.matrix[0][1], &veDescr.transformMatrix.matrix[0][2], &veDescr.transformMatrix.matrix[0][3], \
+                                                               &veDescr.transformMatrix.matrix[1][0], &veDescr.transformMatrix.matrix[1][1], &veDescr.transformMatrix.matrix[1][2], &veDescr.transformMatrix.matrix[1][3], \
+                                                               &veDescr.transformMatrix.matrix[2][0], &veDescr.transformMatrix.matrix[2][1], &veDescr.transformMatrix.matrix[2][2], &veDescr.transformMatrix.matrix[2][3], \
+                                                               &veDescr.transformMatrix.matrix[3][0], &veDescr.transformMatrix.matrix[3][1], &veDescr.transformMatrix.matrix[3][2], &veDescr.transformMatrix.matrix[3][3]);
+                                               continue;
+                                       }
+                                       if (attributeName.CompareTo("childrenTransformMatrix") == 0)
+                                       {
+                                               sscanf((const char*) pAttributes[i+1], "%f %f %f %f  %f %f %f %f  %f %f %f %f  %f %f %f %f", \
+                                                               &veDescr.childrenTransformMatrix.matrix[0][0], &veDescr.childrenTransformMatrix.matrix[0][1], &veDescr.childrenTransformMatrix.matrix[0][2], &veDescr.childrenTransformMatrix.matrix[0][3], \
+                                                               &veDescr.childrenTransformMatrix.matrix[1][0], &veDescr.childrenTransformMatrix.matrix[1][1], &veDescr.childrenTransformMatrix.matrix[1][2], &veDescr.childrenTransformMatrix.matrix[1][3], \
+                                                               &veDescr.childrenTransformMatrix.matrix[2][0], &veDescr.childrenTransformMatrix.matrix[2][1], &veDescr.childrenTransformMatrix.matrix[2][2], &veDescr.childrenTransformMatrix.matrix[2][3], \
+                                                               &veDescr.childrenTransformMatrix.matrix[3][0], &veDescr.childrenTransformMatrix.matrix[3][1], &veDescr.childrenTransformMatrix.matrix[3][2], &veDescr.childrenTransformMatrix.matrix[3][3]);
+                                               continue;
+                                       }
+                                       if (attributeName.CompareTo("clipChildrenEnabled") == 0)
+                                       {
+                                               attributeValue = (const char*) pAttributes[i+1];
+                                               if (attributeValue.CompareTo("true") == 0)
+                                               {
+                                                       veDescr.clipChildrenEnabled = true;
+                                               }
+                                               else
+                                               {
+                                                       veDescr.clipChildrenEnabled = false;
+                                               }
+                                               continue;
+                                       }
+                                       if (attributeName.CompareTo("contentBounds") == 0)
+                                       {
+                                               sscanf((const char*) pAttributes[i+1], "%f %f %f %f", \
+                                                               &veDescr.contentBounds.x, &veDescr.contentBounds.y, &veDescr.contentBounds.width, &veDescr.contentBounds.height);
+                                               continue;
+                                       }
+                                       if (attributeName.CompareTo("implicitAnimationEnabled") == 0)
+                                       {
+                                               attributeValue = (const char*) pAttributes[i+1];
+                                               if (attributeValue.CompareTo("true") == 0)
+                                               {
+                                                       veDescr.implicitAnimationEnabled = true;
+                                               }
+                                               else
+                                               {
+                                                       veDescr.implicitAnimationEnabled = false;
+                                               }
+                                               continue;
+                                       }
+                                       if (attributeName.CompareTo("opacity") == 0)
+                                       {
+                                               sscanf((const char*) pAttributes[i+1], "%f", &veDescr.opacity);
+                                               continue;
+                                       }
+                                       if (attributeName.CompareTo("renderOperation") == 0)
+                                       {
+                                               sscanf((const char*) pAttributes[i+1], "%d", &veDescr.renderOperation);
+                                               continue;
+                                       }
+                                       if (attributeName.CompareTo("showState") == 0)
+                                       {
+                                               attributeValue = (const char*) pAttributes[i+1];
+                                               if (attributeValue.CompareTo("true") == 0)
+                                               {
+                                                       veDescr.showState = true;
+                                               }
+                                               else
+                                               {
+                                                       veDescr.showState = false;
+                                               }
+                                               continue;
+                                       }
+                                       if (attributeName.CompareTo("zorderGroup") == 0)
+                                       {
+                                               sscanf((const char*) pAttributes[i+1], "%d", &veDescr.zorderGroup);
+                                               continue;
+                                       }
+                                       if (attributeName.CompareTo("zposition") == 0)
+                                       {
+                                               sscanf((const char*) pAttributes[i+1], "%f", &veDescr.zposition);
+                                               continue;
+                                       }
+                               }
+                       }
+
+                       VisualElement* pVisualElement = new (std::nothrow) VisualElement();
+                       if (pVisualElement == null)
+                       {
+                               SysLogException(NID_UI_ANIM, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory.");
+                               pUserDataT->parsingResult = E_OUT_OF_MEMORY;
+                               return;
+                       }
+                       r = pVisualElement->Construct();
+                       if (r != E_SUCCESS)
+                       {
+                               SysLogException(NID_UI_ANIM, r, "VisualElement Construct error propagating.");
+                               pUserDataT->parsingResult = r;
+                               return;
+                       }
+
+                       if (pUserDataT->pCurrentParentVisualElement != null)
+                       {
+                               pVisualElement->SetName(veDescr.name);
+
+                               pVisualElement->SetAnchor(veDescr.anchor);
+                               pVisualElement->SetAnchorZ(veDescr.anchorZ);
+                               pVisualElement->SetBounds(veDescr.bounds);
+                               pVisualElement->SetTransformMatrix(veDescr.transformMatrix);
+                               pVisualElement->SetChildrenTransformMatrix(veDescr.childrenTransformMatrix);
+                               pVisualElement->SetClipChildrenEnabled(veDescr.clipChildrenEnabled);
+                               pVisualElement->SetContentBounds(veDescr.contentBounds);
+                               pVisualElement->SetImplicitAnimationEnabled(veDescr.implicitAnimationEnabled);
+                               pVisualElement->SetOpacity(veDescr.opacity);
+                               pVisualElement->SetRenderOperation((VisualElement::RenderOperation)veDescr.renderOperation);
+                               pVisualElement->SetShowState(veDescr.showState);
+                               pVisualElement->SetZOrderGroup(veDescr.zorderGroup);
+                               pVisualElement->SetZPosition(veDescr.zposition);
+
+                               if (veDescr.meshId != -1)
+                               {
+                                       Mesh* pMesh = pUserDataT->pSceneImpl->GetMeshAtN(veDescr.meshId);
+                                       pVisualElement->SetMesh(pMesh);
+                               }
+                               if (veDescr.materialId != -1)
+                               {
+                                       Material* pMaterial = pUserDataT->pSceneImpl->GetMaterialAtN(veDescr.materialId);
+                                       pVisualElement->SetMaterial(pMaterial);
+                               }
+                               if (veDescr.lightId != -1)
+                               {
+                                       Light* pLight = pUserDataT->pSceneImpl->GetLightAtN(veDescr.lightId);
+                                       pVisualElement->SetLight(pLight);
+                               }
+                               if (veDescr.shaderProgramId != -1)
+                               {
+                                       ShaderProgram* pShaderProgram = pUserDataT->pSceneImpl->GetShaderProgramAtN(veDescr.shaderProgramId);
+                                       pVisualElement->SetShaderProgram(pShaderProgram);
+                               }
+
+                               pUserDataT->pCurrentParentVisualElement->AttachChild(pVisualElement);
+                               pUserDataT->pCurrentParentVisualElement = pVisualElement;
+                       }
+                       else
+                       {
+                               pVisualElement->Destroy();
+                               SysLogException(NID_UI_ANIM, E_INVALID_ARG, "Scene tree building error.");
+                               pUserDataT->parsingResult = E_INVALID_ARG;
+                       }
+
+                       return;
+               }
+       }
+
+
+       //create empty recourses in scene lists, to save id structure
+       if (pUserDataT->isScene && !pUserDataT->isMeshes && !pUserDataT->isMaterials && !pUserDataT->isLights && !pUserDataT->isShaderPrograms  && !pUserDataT->isTextureFileNames && !pUserDataT->isVisualElements)
+       {
+               if (elementName.CompareTo("Meshes") == 0)
+               {
+                       pUserDataT->isMeshes = true;
+                       if (pAttributes != null)
+                       {
+
+                               for (int i = 0; pAttributes[i] != null; i+=2)
+                               {
+                                       attributeName = (const char*) pAttributes[i];
+                                       if (attributeName.CompareTo("count") == 0)
+                                       {
+                                               count = atoi((const char*) pAttributes[i+1]);
+                                               _SceneMeshDescriptor meshVoidDescriptor;
+                                               meshVoidDescriptor.Clear();
+
+                                               for (int j = 0; j < count; j++)
+                                               {
+                                                       pUserDataT->pSceneImpl->_meshes.Add(meshVoidDescriptor);
+                                               }
+                                       }
+                               }
+                       }
+                       return;
+               }
+       }
+
+       if (pUserDataT->isScene && !pUserDataT->isMeshes && !pUserDataT->isMaterials && !pUserDataT->isLights && !pUserDataT->isShaderPrograms  && !pUserDataT->isTextureFileNames && !pUserDataT->isVisualElements)
+       {
+               if (elementName.CompareTo("Materials") == 0)
+               {
+                       pUserDataT->isMaterials = true;
+                       if (pAttributes != null)
+                       {
+
+                               for (int i = 0; pAttributes[i] != null; i+=2)
+                               {
+                                       attributeName = (const char*) pAttributes[i];
+                                       if (attributeName.CompareTo("count") == 0)
+                                       {
+                                               count = atoi((const char*) pAttributes[i+1]);
+                                               _SceneMaterialDescriptor materialVoidDescriptor;
+                                               materialVoidDescriptor.Clear();
+                                               for (int j = 0; j < count; j++)
+                                               {
+                                                       pUserDataT->pSceneImpl->_materials.Add(materialVoidDescriptor);
+                                               }
+                                       }
+                               }
+                       }
+                       return;
+               }
+       }
+
+       if (pUserDataT->isScene && !pUserDataT->isMeshes && !pUserDataT->isMaterials && !pUserDataT->isLights && !pUserDataT->isShaderPrograms  && !pUserDataT->isTextureFileNames && !pUserDataT->isVisualElements)
+       {
+               if (elementName.CompareTo("Lights") == 0)
+               {
+                       pUserDataT->isLights = true;
+                       if (pAttributes != null)
+                       {
+
+                               for (int i = 0; pAttributes[i] != null; i+=2)
+                               {
+                                       attributeName = (const char*) pAttributes[i];
+                                       if (attributeName.CompareTo("count") == 0)
+                                       {
+                                               count = atoi((const char*) pAttributes[i+1]);
+                                               _SceneLightDescriptor lightVoidDescriptor;
+                                               lightVoidDescriptor.Clear();
+                                               for (int j = 0; j < count; j++)
+                                               {
+                                                       pUserDataT->pSceneImpl->_lights.Add(lightVoidDescriptor);
+                                               }
+                                       }
+                               }
+                       }
+                       return;
+               }
+       }
+
+       if (pUserDataT->isScene && !pUserDataT->isMeshes && !pUserDataT->isMaterials && !pUserDataT->isLights && !pUserDataT->isShaderPrograms  && !pUserDataT->isTextureFileNames && !pUserDataT->isVisualElements)
+       {
+               if (elementName.CompareTo("ShaderPrograms") == 0)
+               {
+                       pUserDataT->isShaderPrograms = true;
+                       if (pAttributes != null)
+                       {
+
+                               for (int i = 0; pAttributes[i] != null; i+=2)
+                               {
+                                       attributeName = (const char*) pAttributes[i];
+                                       if (attributeName.CompareTo("count") == 0)
+                                       {
+                                               count = atoi((const char*) pAttributes[i+1]);
+                                               _SceneShaderProgramDescriptor shaderProgramVoidDescriptor;
+                                               shaderProgramVoidDescriptor.Clear();
+
+                                               for (int j = 0; j < count; j++)
+                                               {
+                                                       pUserDataT->pSceneImpl->_shaderPrograms.Add(shaderProgramVoidDescriptor);
+                                               }
+                                       }
+                               }
+                       }
+                       return;
+               }
+       }
+
+       if (pUserDataT->isScene && !pUserDataT->isMeshes && !pUserDataT->isMaterials && !pUserDataT->isLights && !pUserDataT->isShaderPrograms  && !pUserDataT->isTextureFileNames && !pUserDataT->isVisualElements)
+       {
+               if (elementName.CompareTo("TextureFileNames") == 0)
+               {
+                       pUserDataT->isTextureFileNames = true;
+                       if (pAttributes != null)
+                       {
+                               for (int i = 0; pAttributes[i] != null; i+=2)
+                               {
+                                       attributeName = (const char*) pAttributes[i];
+                                       if (attributeName.CompareTo("count") == 0)
+                                       {
+                                               count = atoi((const char*) pAttributes[i+1]);
+                                               attributeValue.Clear();
+
+                                               for (int j = 0; j < count; j++)
+                                               {
+                                                       pUserDataT->pSceneImpl->_textureFileNames.Add(attributeValue);
+                                               }
+                                               break;
+                                       }
+                               }
+                       }
+                       return;
+               }
+       }
+
+       if (pUserDataT->isScene && !pUserDataT->isMeshes && !pUserDataT->isMaterials && !pUserDataT->isLights && !pUserDataT->isShaderPrograms  && !pUserDataT->isTextureFileNames && !pUserDataT->isVisualElements)
+       {
+               if (elementName.CompareTo("VisualElements") == 0)
+               {
+                       pUserDataT->isVisualElements = true;
+                       return;
+               }
+       }
+
+       if (!pUserDataT->isScene)
+       {
+               if (elementName.CompareTo("Scene") == 0)
+               {
+                       pUserDataT->isScene = true;
+                       if (pAttributes != null)
+                       {
+
+                               for (int i = 0; pAttributes[i] != null; i+=2)
+                               {
+                                       attributeName = (const char*) pAttributes[i];
+                                       if (attributeName.CompareTo("name") == 0)
+                                       {
+                                               attributeValue = (const char*) pAttributes[i+1];
+                                               pUserDataT->pSceneImpl->SetName(attributeValue);
+                                               break;
+                                       }
+                               }
+                       }
+                       return;
+               }
+       }
+       else
+       {
+               return; //ignore all until meet Scene element
+       }
+
+       //generate error to stop parsing by file structure mistakes
+       SysLogException(NID_UI_ANIM, E_INVALID_FORMAT, "Wrong file structure. Error reading.");
+       pUserDataT->parsingResult = E_INVALID_FORMAT;
+       return;
+}
+
+void
+__LoadSceneOnContent(void* pUserData, const xmlChar* pContent, int length)
+{
+       struct __SceneSAXParsingUserData* pUserDataT = (struct __SceneSAXParsingUserData*)pUserData;
+       if (pUserDataT->parsingResult != E_SUCCESS)
+       {
+               return;
+       }
+
+       if (pUserDataT->isVertexShader)
+       {
+               char* pVertexUtf8Text = new char[length + 2];
+               if (pVertexUtf8Text != null)
+               {
+                       strncpy(pVertexUtf8Text, (const char*)pContent, length);
+                       pVertexUtf8Text[length] = '\0';
+                       Tizen::Base::Utility::StringUtil::Utf8ToString(pVertexUtf8Text, pUserDataT->shaderProgramDescriptor.vertexShader);
+               }
+               else
+               {
+                       SysLogException(NID_UI_ANIM, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory.");
+                       pUserDataT->parsingResult = E_OUT_OF_MEMORY;
+               }
+
+//             pUserDataT->shaderProgramDescriptor.vertexShader = (const char*)pContent;
+//             pUserDataT->shaderProgramDescriptor.vertexShader.SetLength(length);
+               return;
+       }
+
+       if (pUserDataT->isFragmentShader)
+       {
+               char* pFragmentUtf8Text = new char[length + 2];
+               if (pFragmentUtf8Text != null)
+               {
+                       strncpy(pFragmentUtf8Text, (const char*)pContent, length);
+                       pFragmentUtf8Text[length] = '\0';
+                       Tizen::Base::Utility::StringUtil::Utf8ToString(pFragmentUtf8Text, pUserDataT->shaderProgramDescriptor.fragmentShader);
+               }
+               else
+               {
+                       SysLogException(NID_UI_ANIM, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory.");
+                       pUserDataT->parsingResult = E_OUT_OF_MEMORY;
+               }
+
+//             pUserDataT->shaderProgramDescriptor.fragmentShader = (const char*)pContent;
+//             pUserDataT->shaderProgramDescriptor.fragmentShader.SetLength(length);
+               return;
+       }
+}
+
+void
+__LoadSceneOnEndElement(void* pUserData, const xmlChar* pName)
+{
+       String elementName((const char*)pName);
+       std::string tempString;
+       std::wstring tempWString;
+
+       struct __SceneSAXParsingUserData* pUserDataT = (struct __SceneSAXParsingUserData*)pUserData;
+       if (pUserDataT->parsingResult != E_SUCCESS)
+       {
+               return;
+       }
+
+       if (pUserDataT->isVisualElements &&  pUserDataT->isVisualElement)
+       {
+               if (elementName.CompareTo("VisualElement") == 0)
+               {
+                       pUserDataT->isVisualElement = false;
+                       if (pUserDataT->pCurrentParentVisualElement != null && pUserDataT->pCurrentParentVisualElement != pUserDataT->pSceneImpl->GetRootVisualElement())
+                       {
+                               pUserDataT->pCurrentParentVisualElement = pUserDataT->pCurrentParentVisualElement->GetParent();
+                       }
+                       else
+                       {
+                               SysLogException(NID_UI_ANIM, E_INVALID_ARG, "Scene tree building error.");
+                               pUserDataT->parsingResult = E_INVALID_ARG;
+                       }
+                       return;
+               }
+       }
+
+       if (pUserDataT->isMeshes && pUserDataT->isMesh)
+       {
+               if (elementName.CompareTo("Mesh") == 0)
+               {
+                       String meshResFileName = SCENE_MESH_RESOURCE_FILE_NAME;
+                       String meshResFileExtension = SCENE_MESH_RESOURCE_FILE_EXTENSION;
+
+                       pUserDataT->isMesh = false;
+                       String meshFileName;
+                       meshFileName.Format(pUserDataT->resourceFilesPath.GetLength() + pUserDataT->scenePrefix.GetLength() + meshResFileName.GetLength() + meshResFileExtension.GetLength() + 8 + 2, \
+                                       L"%ls%ls%ls%04d%ls", pUserDataT->resourceFilesPath.GetPointer(), pUserDataT->scenePrefix.GetPointer(), meshResFileName.GetPointer(), pUserDataT->currentMeshId, meshResFileExtension.GetPointer());
+                       pUserDataT->meshDescriptor.pMesh = ModelImporter::LoadMeshN(meshFileName);
+
+                       if (pUserDataT->meshDescriptor.pMesh != null)
+                       {
+                               if (pUserDataT->pSceneImpl->ContainsMesh(pUserDataT->meshDescriptor.pMesh) == -1)
+                               {
+                                       pUserDataT->pSceneImpl->_meshes.SetAt(pUserDataT->meshDescriptor, pUserDataT->currentMeshId);
+                               }
+                               else
+                               {
+                                       delete pUserDataT->meshDescriptor.pMesh;
+                               }
+                       }
+                       else
+                       {
+                               pUserDataT->pSceneImpl->_meshes.SetAt(pUserDataT->meshDescriptor, pUserDataT->currentMeshId);
+                       }
+                       return;
+               }
+       }
+
+       if (pUserDataT->isMaterials && pUserDataT->isMaterial)
+       {
+               if (elementName.CompareTo("Material") == 0)
+               {
+                       String materialResFileName = SCENE_MATERIAL_RESOURCE_FILE_NAME;
+                       String materialResFileExtension = SCENE_MATERIAL_RESOURCE_FILE_EXTENSION;
+
+                       pUserDataT->isMaterial = false;
+                       String materialFileName;
+                       materialFileName.Format(pUserDataT->resourceFilesPath.GetLength() + pUserDataT->scenePrefix.GetLength() + materialResFileName.GetLength() + materialResFileExtension.GetLength() + 8 + 2, \
+                                       L"%ls%ls%ls%04d%ls", pUserDataT->resourceFilesPath.GetPointer(), pUserDataT->scenePrefix.GetPointer(), materialResFileName.GetPointer(), pUserDataT->currentMaterialId, materialResFileExtension.GetPointer());
+                       pUserDataT->materialDescriptor.pMaterial = _MaterialParser::LoadMaterialN(materialFileName);
+                       //TODO://pUserDataT->materialDescriptor.pMaterial = ModelImporter::LoadMaterialN(ModelImporter::BIN, materialFileName, "", null);
+                       //pUserDataT->materialDescriptor.pMaterial = null;
+
+                       if (pUserDataT->materialDescriptor.pMaterial != null)
+                       {
+                               if (pUserDataT->pSceneImpl->ContainsMaterial(pUserDataT->materialDescriptor.pMaterial) == -1)
+                               {
+                                       pUserDataT->pSceneImpl->_materials.SetAt(pUserDataT->materialDescriptor, pUserDataT->currentMaterialId);
+                               }
+                               else
+                               {
+                                       delete pUserDataT->materialDescriptor.pMaterial;
+                               }
+                       }
+                       else
+                       {
+                               pUserDataT->pSceneImpl->_materials.SetAt(pUserDataT->materialDescriptor, pUserDataT->currentMaterialId);
+                       }
+                       return;
+               }
+       }
+
+       if (pUserDataT->isLights && pUserDataT->isLight)
+       {
+               if (elementName.CompareTo("Light") == 0)
+               {
+                       String lightResFileName = SCENE_LIGHT_RESOURCE_FILE_NAME;
+                       String lightResFileExtension = SCENE_LIGHT_RESOURCE_FILE_EXTENSION;
+
+                       pUserDataT->isLight = false;
+                       String lightFileName;
+                       lightFileName.Format(pUserDataT->resourceFilesPath.GetLength() + pUserDataT->scenePrefix.GetLength() + lightResFileName.GetLength() + lightResFileExtension.GetLength() + 8 + 2, \
+                                       L"%ls%ls%ls%04d%ls", pUserDataT->resourceFilesPath.GetPointer(), pUserDataT->scenePrefix.GetPointer(), lightResFileName.GetPointer(), pUserDataT->currentLightId, lightResFileExtension.GetPointer());
+                       pUserDataT->lightDescriptor.pLight = _LightParser::LoadLightN(lightFileName);
+                       //TODO://pUserDataT->lightDescriptor.pLight = ModelImporter::LoadLightN(ModelImporter::BIN, lightFileName, "", null);
+                       //pUserDataT->lightDescriptor.pLight = null;
+
+                       if (pUserDataT->lightDescriptor.pLight != null)
+                       {
+                               if (pUserDataT->pSceneImpl->ContainsLight(pUserDataT->lightDescriptor.pLight) == -1)
+                               {
+                                       pUserDataT->pSceneImpl->_lights.SetAt(pUserDataT->lightDescriptor, pUserDataT->currentLightId);
+                               }
+                               else
+                               {
+                                       delete pUserDataT->lightDescriptor.pLight;
+                               }
+                       }
+                       else
+                       {
+                               pUserDataT->pSceneImpl->_lights.SetAt(pUserDataT->lightDescriptor, pUserDataT->currentLightId);
+                       }
+                       return;
+               }
+       }
+
+       if (pUserDataT->isShaderPrograms && pUserDataT->isShaderProgram)
+       {
+               if (elementName.CompareTo("ShaderProgram") == 0)
+               {
+                       pUserDataT->isShaderProgram = false;
+                       if (pUserDataT->pSceneImpl->ContainsShaderProgram(pUserDataT->shaderProgramName) != -1)
+                       {
+                               return;
+                       }
+
+                       ////for shader loading from file
+                       String vertexShaderResFileName = SCENE_VERTEX_SHADER_RESOURCE_FILE_NAME;
+                       String vertexShaderResFileExtension = SCENE_VERTEX_SHADER_RESOURCE_FILE_EXTENSION;
+                       pUserDataT->shaderProgramDescriptor.vertexShader.Clear();
+
+                       String tempTString;
+                       tempTString.Format(pUserDataT->resourceFilesPath.GetLength() + pUserDataT->scenePrefix.GetLength() + vertexShaderResFileName.GetLength() + vertexShaderResFileExtension.GetLength() + 8 + 2, \
+                                                       L"%ls%ls%ls%04d%ls", pUserDataT->resourceFilesPath.GetPointer(), pUserDataT->scenePrefix.GetPointer(), vertexShaderResFileName.GetPointer(), pUserDataT->currentShaderProgramId, vertexShaderResFileExtension.GetPointer());
+                       tempWString = tempTString.GetPointer();
+                       tempString = ConvertWStringToString(tempWString);
+
+                       std::ifstream vertex(tempString.c_str(), std::ifstream::in);
+
+                       if (vertex.good())
+                       {
+                               std::filebuf* pVertexFileBuf = vertex.rdbuf();
+                               if (pVertexFileBuf != null)
+                               {
+                                       std::size_t vertexSize = pVertexFileBuf->pubseekoff (0, vertex.end, vertex.in);
+                                       pVertexFileBuf->pubseekpos (0, vertex.in);
+                                       char* pVertexText = new (std::nothrow) char[vertexSize+2];
+                                       if (pVertexText != null)
+                                       {
+                                               pVertexFileBuf->sgetn(pVertexText, vertexSize);
+                                               pVertexText[vertexSize] = '\0';
+                                               pUserDataT->shaderProgramDescriptor.vertexShader = pVertexText;
+                                       }
+                               }
+                               vertex.close();
+                       }
+
+                       String fragmentShaderResFileName = SCENE_FRAGMENT_SHADER_RESOURCE_FILE_NAME;
+                       String fragmentShaderResFileExtension = SCENE_FRAGMENT_SHADER_RESOURCE_FILE_EXTENSION;
+                       pUserDataT->shaderProgramDescriptor.fragmentShader.Clear();
+
+                       tempTString.Format(pUserDataT->resourceFilesPath.GetLength() + pUserDataT->scenePrefix.GetLength() + fragmentShaderResFileName.GetLength() + fragmentShaderResFileExtension.GetLength() + 8 + 2, \
+                                                       L"%ls%ls%ls%04d%ls", pUserDataT->resourceFilesPath.GetPointer(), pUserDataT->scenePrefix.GetPointer(), fragmentShaderResFileName.GetPointer(), pUserDataT->currentShaderProgramId, fragmentShaderResFileExtension.GetPointer());
+                       tempWString = tempTString.GetPointer();
+                       tempString = ConvertWStringToString(tempWString);
+
+                       std::ifstream fragment(tempString.c_str(), std::ifstream::in);
+
+                       if (fragment.good())
+                       {
+                               std::filebuf* pFragmentFileBuf = fragment.rdbuf();
+                               if (pFragmentFileBuf != null)
+                               {
+                                       std::size_t fragmentSize = pFragmentFileBuf->pubseekoff (0, fragment.end, fragment.in);
+                                       pFragmentFileBuf->pubseekpos (0, fragment.in);
+                                       char* pFragmentText = new (std::nothrow) char[fragmentSize+2];
+                                       if (pFragmentText != null)
+                                       {
+                                               pFragmentFileBuf->sgetn(pFragmentText, fragmentSize);
+                                               pFragmentText[fragmentSize] = '\0';
+                                               pUserDataT->shaderProgramDescriptor.fragmentShader = pFragmentText;
+                                       }
+                               }
+                               fragment.close();
+                       }
+
+                       //shader loaded to String, build'em
+
+                       Shader vertexShaderClass, fragmentShaderClass;
+
+                       tempWString = pUserDataT->shaderProgramDescriptor.vertexShader.GetPointer();
+                       std::string vertexShader = ConvertWStringToString(tempWString);
+                       tempWString = pUserDataT->shaderProgramDescriptor.fragmentShader.GetPointer();
+                       std::string     fragmentShader = ConvertWStringToString(tempWString);
+
+                       vertexShaderClass.Construct(Shader::SHADER_VERTEX, vertexShader.c_str());
+                       fragmentShaderClass.Construct(Shader::SHADER_FRAGMENT, fragmentShader.c_str());
+
+                       ShaderProgram* pNewShaderProgram = new (std::nothrow) ShaderProgram();
+
+                       if (pNewShaderProgram == null)
+                       {
+                               SysLogException(NID_UI_ANIM, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory.");
+                               pUserDataT->parsingResult = E_OUT_OF_MEMORY;
+                               return;
+                       }
+                       pNewShaderProgram->Construct(vertexShaderClass, fragmentShaderClass);
+                       pNewShaderProgram->SetName(pUserDataT->shaderProgramName);
+
+                       pUserDataT->shaderProgramDescriptor.pShaderProgram = pNewShaderProgram;
+
+                       pUserDataT->pSceneImpl->_shaderPrograms.SetAt(pUserDataT->shaderProgramDescriptor, pUserDataT->currentShaderProgramId);
+
+                       return;
+               }
+       }
+////for UTF-8 shader saving in .are
+//     if (pUserDataT->isVertexShader && !pUserDataT->isFragmentShader)
+//     {
+//             if (elementName.CompareTo("VertexShader") == 0)
+//             {
+//                     pUserDataT->isVertexShader = false;
+//                     return;
+//             }
+//     }
+//
+//     if (pUserDataT->isVertexShader && !pUserDataT->isVertexShader)
+//     {
+//             if (elementName.CompareTo("FragmentShader") == 0)
+//             {
+//                     pUserDataT->isFragmentShader = false;
+//                     return;
+//             }
+//     }
+
+       if (pUserDataT->isTextureFileNames && pUserDataT->isTextureFileName)
+       {
+               if (elementName.CompareTo("TextureFileName") == 0)
+               {
+                       pUserDataT->isTextureFileName = false;
+                       pUserDataT->pSceneImpl->_textureFileNames.SetAt(pUserDataT->texfureFileName, pUserDataT->currentTexturFileNameId);
+                       return;
+               }
+       }
+
+       if (pUserDataT->isMeshes && !pUserDataT->isMesh)
+       {
+               if (pUserDataT->isMeshes)
+               {
+                       if (elementName.CompareTo("Meshes") == 0)
+                       {
+                               pUserDataT->isMeshes = false;
+                               return;
+                       }
+               }
+       }
+
+       if (pUserDataT->isMaterials && !pUserDataT->isMaterial)
+       {
+               if (pUserDataT->isMaterials)
+               {
+                       if (elementName.CompareTo("Materials") == 0)
+                       {
+                               pUserDataT->isMaterials = false;
+                               return;
+                       }
+               }
+       }
+
+       if (pUserDataT->isLights  && !pUserDataT->isLight)
+       {
+               if (elementName.CompareTo("Lights") == 0)
+               {
+                       pUserDataT->isLights = false;
+                       return;
+               }
+       }
+
+       if (pUserDataT->isShaderPrograms && !pUserDataT->isShaderProgram)
+       {
+               if (elementName.CompareTo("ShaderPrograms") == 0)
+               {
+                       pUserDataT->isShaderPrograms = false;
+                       return;
+               }
+       }
+
+       if (pUserDataT->isTextureFileNames && !pUserDataT->isTextureFileName)
+       {
+               if (elementName.CompareTo("TextureFileNames") == 0)
+               {
+                       pUserDataT->isTextureFileNames = false;
+                       return;
+               }
+       }
+
+       if (pUserDataT->isVisualElements && !pUserDataT->isVisualElement)
+       {
+               if (elementName.CompareTo("VisualElements") == 0)
+               {
+                       pUserDataT->isVisualElements = false;
+                       return;
+               }
+       }
+
+       if (pUserDataT->isScene && !pUserDataT->isVisualElements && !pUserDataT->isMeshes && !pUserDataT->isMaterials && !pUserDataT->isLights && !pUserDataT->isShaderPrograms && !pUserDataT->isTextureFileNames)
+       {
+               if (elementName.CompareTo("Scene") == 0)
+               {
+                       pUserDataT->isScene = false;
+                       return;
+               }
+       }
+       else
+       {
+               return;
+       }
+
+       //generate error to stop parsing by file structure mistakes
+       SysLogException(NID_UI_ANIM, E_INVALID_FORMAT, "Wrong file structure. Error reading.");
+       pUserDataT->parsingResult = E_INVALID_FORMAT;
+       return;
+}
 
-}}}
+}}} //Tizen::Ui::Animations
index 2292f77..4c47dc1 100644 (file)
@@ -299,6 +299,19 @@ GetDynamicPropertyStringN(const Tizen::Base::String& name)
 }
 
 result
+_ShaderProgramImpl::SetName(const Tizen::Base::String& name)
+{
+       __name = name;
+       return E_SUCCESS;
+}
+
+Tizen::Base::String
+_ShaderProgramImpl::GetName(void) const
+{
+       return __name;
+}
+
+result
 _ShaderProgramImpl::SetProperty(const Tizen::Base::String& name, const Variant& value)
 {
        std::unique_ptr<_DyanamicPropertyString> pProp( GetDynamicPropertyStringN(name));
index d5a7a58..8cdf3dd 100644 (file)
@@ -25,6 +25,7 @@
 #ifndef _FUI_ANIM_INTERNAL_SHADER_PROGRAM_IMPL_H_
 #define _FUI_ANIM_INTERNAL_SHADER_PROGRAM_IMPL_H_
 
+#include <FBaseString.h>
 #include <FBaseColHashMapT.h>
 #include <FUiVariant.h>
 #include <FUiAnimShaderProgram.h>
@@ -138,6 +139,9 @@ public:
        static _ShaderProgramImpl* GetInstance(ShaderProgram& program);
        static const _ShaderProgramImpl* GetInstance(const ShaderProgram& program);
 
+       Tizen::Base::String GetName(void) const;
+       result SetName(const Tizen::Base::String& name);
+
 private:
        void InitLocationTable(void);
        void MakeUniformLocationTable(void);
@@ -149,6 +153,8 @@ private:
        _ShaderProgramImpl& operator =(const _ShaderProgramImpl& rhs);
 
 private:
+       Tizen::Base::String __name;
+
        struct UniformValue
        {
                int location;
index dc35857..2a392c8 100644 (file)
@@ -22,6 +22,7 @@
  * This file contains implementation _VisualElementImpl class.
  */
 
+#include <iostream>
 #include <typeinfo>
 #include <unique_ptr.h>
 #include <FBaseString.h>
@@ -111,6 +112,7 @@ using namespace Tizen::Ui::Animations;
 #define LAZY_EVALUATION // lazy updating and reconfiguring.
 #define IMPLICIT_ANIMATION_IMPL  //prototyping implicit animation.
 //#define      MANUAL_PROPERTY_CHANGE_NOTIFICATION
+#define SELECTION_MAX_PROCESSED_INDICES_COUNT 5000 //maximum count of indices in mesh, which could be testet on edge intersection with a planes. to avoid big arrays
 
 #define RENDER_LOCK() _AutoMutex renderLock(*_VisualElementEnvironment::GetTreeLock())
 //#define RENDER_LOCK()
@@ -9044,10 +9046,14 @@ _VisualElementImpl::GetSelectedI(const Tizen::Ui::Animations::_Selection& global
                                        }
                                        else
                                        {
-                                               //test this mesh to have edges intersected with selection
-                                               if (localSelection.FindIncludedMeshIntersections(pMesh))
+                                               //test indexes to be lower than MAX to avoid big arrays of edges
+                                               if (pMesh->GetIndexCount() < SELECTION_MAX_PROCESSED_INDICES_COUNT)
                                                {
-                                                       list.Add(GetPublic());
+                                                       //test this mesh to have edges intersected with selection
+                                                       if (localSelection.FindIncludedMeshIntersections(pMesh))
+                                                       {
+                                                               list.Add(GetPublic());
+                                                       }
                                                }
                                        }
                                }
index 408af4c..4471fa0 100644 (file)
@@ -78,7 +78,7 @@ public:
        static _MeshImpl* GetInstance(Mesh& mesh);
        static const _MeshImpl* GetInstance(const Mesh& mesh);
 
-       static Mesh* LoadMeshFromBinaryN(const std::string& fileName, const std::string& modelName);
+       static Mesh* LoadMeshN(const Tizen::Base::String& fileName);
 
        result SetVertex(int arrayIndex, const Tizen::Graphics::FloatPoint3& point);
        result SetTextureCoord(int arrayIndex, const Tizen::Graphics::FloatPoint& textureCoord);
@@ -164,7 +164,7 @@ public:
                return __name;
        }
 
-       result SaveMeshToBinary(const Tizen::Base::String& fileName);
+       result SaveMesh(const Tizen::Base::String& fileName);
 
        MeshController* CreateMeshController(_JointImpl* pRootJoint, const Tizen::Graphics::FloatMatrix4& bindShapeMatrix);
 
index 5769213..fe8d879 100644 (file)
@@ -52,12 +52,11 @@ public:
        virtual ~_ModelImporterImpl(void);
 
        Mesh* LoadMeshCollada(const std::string& modelName, std::string& materialId, ColladaIndices* colladaIndices = null);
-       static Mesh* LoadMeshFromBinaryN(const std::string& fileName, const std::string& modelName);
+       static Mesh* LoadMeshN(const Tizen::Base::String& fileName);
 
        Material* LoadMaterial(const std::string& materialId, std::string& texureId, _ImportCollada::LibraryEffects::Effect::ShaderType& shaderType);
        std::string LoadTextureName(const std::string& imageId);
-       Scene* LoadScene(const std::string& sceneId);
-
+       Scene* LoadScene(const std::string& sceneId, VisualElement& pSceneRootVisualElement);
 
 private:
        virtual void LoadMesh(Mesh& pMesh, _ImportCollada::LibraryGeometries::GeometryMesh::Indexes& VertexIndices, _Math::Vector3* vertices, ColladaIndices* colladaIndices = null);
index e724756..14e38c8 100644 (file)
 
 #include <FBaseObject.h>
 #include <FBaseString.h>
-#include <FBaseDataType.h>
+#include <FBaseColArrayListT.h>
+#include <FBaseColHashMapT.h>
 #include <FBaseColArrayList.h>
 
-#include "FUiAnimMesh.h"
-#include "FUiAnimMaterial.h"
+#include <libxml/encoding.h>
+#include <libxml/xmlwriter.h>
+
+
 #include "FUiAnimVisualElement.h"
 
-#include <list>
-#include <string>
+namespace Tizen { namespace Base { namespace Collection {
+class IList;
+}}}
 
 namespace Tizen { namespace Ui { namespace Animations {
 
-class _SceneImpl
+class _MeshImpl;
+class _MaterialImpl;
+class _LightImpl;
+class _ShaderProgramImpl;
+
+class Mesh;
+class Material;
+class Light;
+class ShaderProgram;
+
+class Scene;
+
+typedef struct __SceneMeshDescriptor
+{
+       __SceneMeshDescriptor& operator = (const __SceneMeshDescriptor& obj)
+       {
+               modelNameInSourceFile = obj.modelNameInSourceFile;
+               sourceFileName = obj.sourceFileName;
+               pMesh = obj.pMesh;
+               return *this;
+       }
+       bool operator == (const  __SceneMeshDescriptor& obj) const
+       {
+               return (sourceFileName == obj.sourceFileName) && \
+                               (modelNameInSourceFile == obj.modelNameInSourceFile) && \
+                               (pMesh == obj.pMesh);
+       }
+       bool operator != (const  __SceneMeshDescriptor& obj) const
+       {
+               return !(*this == obj);
+       }
+       void Clear(void)
+       {
+               sourceFileName.Clear();
+               modelNameInSourceFile.Clear();
+               pMesh = null;
+       }
+
+       Tizen::Base::String sourceFileName;
+       Tizen::Base::String modelNameInSourceFile;
+       Mesh* pMesh;
+
+} _SceneMeshDescriptor;
+
+typedef struct __SceneMaterialDescriptor
+{
+       __SceneMaterialDescriptor& operator = (const __SceneMaterialDescriptor& obj)
+       {
+               sourceFileName = obj.sourceFileName;
+               pMaterial = obj.pMaterial;
+               return *this;
+       }
+       bool operator == (const  __SceneMaterialDescriptor& obj) const
+       {
+               return (sourceFileName == obj.sourceFileName) && \
+                               (pMaterial == obj.pMaterial);
+       }
+       bool operator != (const  __SceneMaterialDescriptor& obj) const
+       {
+               return !(*this == obj);
+       }
+       void Clear(void)
+       {
+               sourceFileName.Clear();
+               pMaterial = null;
+       }
+
+       Tizen::Base::String sourceFileName;
+       Material* pMaterial;
+
+} _SceneMaterialDescriptor;
+
+typedef struct __SceneLightDescriptor
+{
+       __SceneLightDescriptor& operator = (const __SceneLightDescriptor& obj)
+       {
+               sourceFileName = obj.sourceFileName;
+               pLight = obj.pLight;
+               return *this;
+       }
+       bool operator == (const  __SceneLightDescriptor& obj) const
+       {
+               return (sourceFileName == obj.sourceFileName) && (pLight == obj.pLight);
+       }
+       bool operator != (const  __SceneLightDescriptor& obj) const
+       {
+               return !(*this == obj);
+       }
+       void Clear(void)
+       {
+               sourceFileName.Clear();
+               pLight = null;
+       }
+
+       Tizen::Base::String sourceFileName;
+       Light* pLight;
+
+} _SceneLightDescriptor;
+
+typedef struct __SceneShaderProgramDescriptor
+{
+       __SceneShaderProgramDescriptor& operator = (const __SceneShaderProgramDescriptor& obj)
+       {
+               sourceFileName = obj.sourceFileName;
+               vertexShader = obj.vertexShader;
+               fragmentShader = obj.fragmentShader;
+               pShaderProgram = obj.pShaderProgram;
+               return *this;
+       }
+       bool operator == (const  __SceneShaderProgramDescriptor& obj) const
+       {
+               return (sourceFileName == obj.sourceFileName) && (pShaderProgram == obj.pShaderProgram)  \
+                               && (vertexShader == obj.vertexShader) && (fragmentShader == obj.fragmentShader);
+       }
+       bool operator != (const  __SceneShaderProgramDescriptor& obj) const
+       {
+               return !(*this == obj);
+       }
+       void Clear(void)
+       {
+               sourceFileName.Clear();
+               vertexShader.Clear();
+               fragmentShader.Clear();
+               pShaderProgram = null;
+       }
+
+       Tizen::Base::String sourceFileName;
+       Tizen::Base::String vertexShader;
+       Tizen::Base::String fragmentShader;
+       ShaderProgram* pShaderProgram;
+
+} _SceneShaderProgramDescriptor;
+
+typedef struct __SceneVisualElementDescriptor
+{
+       __SceneVisualElementDescriptor& operator = (const __SceneVisualElementDescriptor& obj)
+       {
+               name = obj.name;
+
+               meshId = obj.meshId;
+               materialId = obj.materialId;
+               lightId = obj.lightId;
+               shaderProgramId = obj.shaderProgramId;
+
+               anchor = obj.anchor;
+               anchorZ = obj.anchorZ;
+               bounds = obj.bounds;
+               childrenTransformMatrix = obj.childrenTransformMatrix;
+               clipChildrenEnabled = obj.clipChildrenEnabled;
+               contentBounds = obj.contentBounds;
+               implicitAnimationEnabled = obj.implicitAnimationEnabled;
+               opacity = obj.opacity;
+               renderOperation = obj.renderOperation;
+               showState = obj.showState;
+               transformMatrix = obj.transformMatrix;
+               zorderGroup = obj.zorderGroup;
+               zposition = obj.zposition;
+               return *this;
+       }
+       bool operator == (const  __SceneVisualElementDescriptor& obj) const
+       {
+               return (name == obj.name) && (meshId == obj.meshId) && (materialId == obj.materialId) && (lightId == obj.lightId) \
+                               && (shaderProgramId == obj.shaderProgramId) && (transformMatrix == obj.transformMatrix) && (bounds == obj.bounds) \
+                               && (opacity == obj.opacity) && (showState == obj.showState) && (clipChildrenEnabled == obj.clipChildrenEnabled);
+       }
+       bool operator != (const  __SceneVisualElementDescriptor& obj) const
+       {
+               return !(*this == obj);
+       }
+       __SceneVisualElementDescriptor(void)
+       {
+               Clear();
+       }
+       void Clear(void)
+       {
+               name.Clear();
+
+               meshId = -1;
+               materialId = -1;
+               lightId = -1;
+               shaderProgramId = -1;
+
+               anchor.SetPosition(0.0f, 0.0f);
+               anchorZ = 0.0f;
+               bounds.SetBounds(0.0f, 0.0f, 1.0f, 1.0f);
+               childrenTransformMatrix.SetAsIdentity();
+               clipChildrenEnabled = false;
+               contentBounds.SetBounds(0.0f, 0.0f, 1.0f, 1.0f);
+               implicitAnimationEnabled = false;
+               opacity = 0.0f;
+               renderOperation = 0;
+               showState = true;
+               transformMatrix.SetAsIdentity();
+               zorderGroup = 0;
+               zposition = 0.0f;
+       }
+
+       int meshId;
+       int materialId;
+       int lightId;
+       int shaderProgramId;
+
+       Tizen::Graphics::FloatPoint anchor;
+       float anchorZ;
+       Tizen::Graphics::FloatRectangle bounds;
+       Tizen::Graphics::FloatMatrix4 childrenTransformMatrix;
+       bool clipChildrenEnabled;
+       Tizen::Graphics::FloatRectangle contentBounds;
+       bool implicitAnimationEnabled;
+       float opacity;
+       int renderOperation;
+       bool showState;
+       Tizen::Graphics::FloatMatrix4 transformMatrix;
+       int zorderGroup;
+       float zposition;
+       Tizen::Base::String name;
+
+//     Tizen::Base::Collection::ArrayListT<  __SceneVisualElementDescriptor > children;
+
+} _SceneVisualElementDescriptor;
+
+class _OSP_EXPORT_ _SceneImpl
        : public Tizen::Base::Object
 {
 public:
        _SceneImpl(void);
        virtual ~_SceneImpl(void);
 
-       result Construct(void);
+       result Construct(VisualElement& pSceneRootVisualElement);
+
+       result SetName(const Tizen::Base::String& sceneName);
+       Tizen::Base::String GetName(void) const;
 
        VisualElement* GetRootVisualElement(void) const;
+//     result RemoveAllVisualElements(void);
+       result ResetScene(void);
+
+       static _SceneImpl* GetInstance(Scene& scene);
+       static const _SceneImpl* GetInstance(const Scene& scene);
+
+       //-----------Mesh API
+       result AddMesh(const Mesh* pMesh);
+       result RemoveMesh(const Tizen::Base::String& meshName);//todo:remove from public
+       result RemoveMesh(const Mesh* pMesh);
+       result RemoveAllMesh(void);
+       Mesh* GetMeshN(const Tizen::Base::String& meshName) const; //todo:remove from public
+       int ContainsMesh(const Tizen::Base::String& meshName) const; //index = [0,n-1], or -1 if not exist //todo:remove from public
+       int ContainsMesh(const Mesh* pMesh) const; //todo:get to public + exeption + use this
+       int GetMeshCount(void) const;
+       Mesh* GetMeshAtN(int index) const;
+       Tizen::Base::String GetMeshNameAt(int index) const;
+
+       //not for public
+       //for JNI interface:
+       Tizen::Base::String GetMeshSourceFileName(const Tizen::Base::String meshName) const;
+       result SetMeshSourceFileName(const Tizen::Base::String meshName, const Tizen::Base::String sourceFileName);
+       Tizen::Base::String GetMeshModelNameInSourceFile(const Tizen::Base::String meshName) const;
+       result SetMeshModelNameInSourceFile(const Tizen::Base::String meshName, const Tizen::Base::String modelNameInSourceFile);
+       Tizen::Base::String GetMeshNameByHashCode(int code) const;
 
-       result AddMesh(Mesh* pMesh);
-       result RemoveMesh(const std::string& meshName);
-       Mesh* GetMeshN(const std::string& meshName) const;
-       Tizen::Base::Collection::ArrayList* GetMeshNamesN(void) const;
+       Tizen::Base::String GetMeshSourceFileName(const Mesh* pMesh) const;
+       result SetMeshSourceFileName(const Mesh* pMesh, const Tizen::Base::String sourceFileName);
+       Tizen::Base::String GetMeshModelNameInSourceFile(const Mesh* pMesh) const;
+       result SetMeshModelNameInSourceFile(const Mesh* pMesh, const Tizen::Base::String modelNameInSourceFile);
+       int GetMeshCodeAt(int index) const;
+       int ContainsMesh(int code) const;
+       Mesh* GetMeshByHashCodeN(int code) const;
+       //todo:repeat to other
 
-       result AddMaterial(Material* pMaterial);
-       result RemoveMaterial(const std::string& materialName);
-       Material* GetMaterialN(const std::string& materialName) const;
-       Tizen::Base::Collection::ArrayList* GetMaterialNamesN(void) const;
+       //-----------Material API
+       result AddMaterial(const Material* pMaterial);
+       result RemoveMaterial(const Tizen::Base::String& materialName);
+       result RemoveMaterial(const Material* pMaterial);
+       result RemoveAllMaterial(void);
+       Material* GetMaterialN(const Tizen::Base::String& materialName) const;
+       int ContainsMaterial(const Tizen::Base::String& materialName) const; //index = [0,n-1], or -1 if not exist
+       int ContainsMaterial(const Material* pMaterial) const;
+       int GetMaterialCount(void) const;
+       Material* GetMaterialAtN(int index) const;
+       Tizen::Base::String GetMaterialNameAt(int index) const;
+       //for JNI interface:
+       Tizen::Base::String GetMaterialSourceFileName(const Tizen::Base::String materialName) const;
+       result SetMaterialSourceFileName(const Tizen::Base::String materialName, const Tizen::Base::String sourceFileName);
+       Tizen::Base::String GetMaterialNameByHashCode(int code) const;
 
-       result AddTextureFileName(std::string textureFileName);
-       Tizen::Base::Collection::ArrayList* GetTextureFileNamesN(void) const;
+       Tizen::Base::String GetMaterialSourceFileName(const Material* pMaterial) const;
+       result SetMaterialSourceFileName(const Material* pMaterial, const Tizen::Base::String sourceFileName);
+       int GetMaterialCodeAt(int index) const;
+       int ContainsMaterial(int code) const;
+       Material* GetMaterialByHashCodeN(int code) const;
+
+       //-----------Light API
+       result AddLight(const Light* pLight);
+       result RemoveLight(const Tizen::Base::String& lightName);
+       result RemoveLight(const Light* pLight);
+       result RemoveAllLight(void);
+       Light* GetLightN(const Tizen::Base::String& lightName) const;
+       int ContainsLight(const Tizen::Base::String& lightName) const; //index = [0,n-1], or -1 if not exist
+       int ContainsLight(const Light* pLight) const;
+       int GetLightCount(void) const;
+       Light* GetLightAtN(int index) const;
+       Tizen::Base::String GetLightNameAt(int index) const;
+       //for JNI interface:
+       Tizen::Base::String GetLightSourceFileName(const Tizen::Base::String lightName) const;
+       result SetLightSourceFileName(const Tizen::Base::String lightName, const Tizen::Base::String sourceFileName);
+       Tizen::Base::String GetLightNameByHashCode(int code) const;
+
+       Tizen::Base::String GetLightSourceFileName(const Light* pLight) const;
+       result SetLightSourceFileName(const Light* pLight, const Tizen::Base::String sourceFileName);
+       int GetLightCodeAt(int index) const;
+       int ContainsLight(int code) const;
+       Light* GetLightByHashCodeN(int code) const;
+
+       //-----------ShaderProgram API
+       ShaderProgram* AddShaderProgramN(const Tizen::Base::String shaderProgramName, const char* vertexShader, const char* fragmentShader);
+       result RemoveShaderProgram(const Tizen::Base::String& shaderProgramName);
+       result RemoveShaderProgram(const ShaderProgram* pShaderProgram);
+       result RemoveAllShaderProgram(void);
+       ShaderProgram* GetShaderProgramN(const Tizen::Base::String& shaderProgramName) const;
+       int ContainsShaderProgram(const Tizen::Base::String& shaderProgramName) const; //index = [0,n-1], or -1 if not exist
+       int ContainsShaderProgram(const ShaderProgram* pShaderProgram) const;
+       int GetShaderProgramCount(void) const;
+       ShaderProgram* GetShaderProgramAtN(int index) const;
+       Tizen::Base::String GetShaderProgramNameAt(int index) const;
+       //for JNI interface:
+       Tizen::Base::String GetShaderProgramSourceFileName(const Tizen::Base::String shaderProgramName) const;
+       result SetShaderProgramSourceFileName(const Tizen::Base::String shaderProgramName, const Tizen::Base::String sourceFileName);
+       Tizen::Base::String GetShaderProgramNameByHashCode(int code) const;
+
+       Tizen::Base::String GetShaderProgramSourceFileName(const ShaderProgram* pShaderProgram) const;
+       result SetShaderProgramSourceFileName(const ShaderProgram* pShaderProgram, const Tizen::Base::String sourceFileName);
+       int GetShaderProgramCodeAt(int index) const;
+       int ContainsShaderProgram(int code) const;
+       ShaderProgram* GetShaderProgramByHashCodeN(int code) const;
+
+       //-----------TextureFileName API
+       result AddTextureFileName(const Tizen::Base::String& textureFileName);
+       int GetTextureFileNameCount(void) const;
+       Tizen::Base::String GetTextureFileNameAt(int index) const;
+       result RemoveTextureFileNameAt(int index);
+       result RemoveAllTextureFileName(void);
+
+       result SaveScene(const Tizen::Base::String filesPath, const Tizen::Base::String resourceFilesPath, const Tizen::Base::String scenePrefix) const;
+       static Scene* LoadSceneN(const Tizen::Base::String filesPath, const Tizen::Base::String resourceFilesPath, const Tizen::Base::String scenePrefix, VisualElement& pSceneRootVisualElement);
+
+protected:
+
+       Tizen::Base::String _name;
+       VisualElement* _pSceneRootVisualElement;
+//     VisualElement* _pSceneFakeRootVisualElement;
+
+       Tizen::Base::Collection::ArrayListT< _SceneMeshDescriptor > _meshes;
+       Tizen::Base::Collection::ArrayListT< _SceneMaterialDescriptor > _materials;
+       Tizen::Base::Collection::ArrayListT< _SceneLightDescriptor > _lights;
+       Tizen::Base::Collection::ArrayListT< _SceneShaderProgramDescriptor > _shaderPrograms;
+
+       Tizen::Base::Collection::ArrayListT< Tizen::Base::String >  _textureFileNames;
 
 private:
-       VisualElement* __pRootVisualElement;
-
-       typedef std::list<Mesh*> Meshes;
-       typedef std::list<Material*> Materials;
-       typedef std::list<std::string> TextureFileNames;
-       Meshes __meshes;
-       Materials __materials;
-       TextureFileNames __textureFileNames;
+       result __SaveSceneVisualElementTree(const xmlTextWriterPtr writer, const VisualElement* pVisualElement) const;
+
+       friend void __LoadSceneOnEndElement(void* pUserData, const xmlChar* pName);
+       friend void __LoadSceneOnStartElement(void* pUserData, const xmlChar* pName, const xmlChar **pAttributes);
 };
 
 }}} //Tizen::Ui::Animations