Mesh public comments added, Picking upgraded to use root visual element projection...
authorYouri Sdobnikov <i.sdobnikov@samsung.com>
Wed, 4 Dec 2013 07:24:39 +0000 (09:24 +0200)
committerYouri Sdobnikov <i.sdobnikov@samsung.com>
Wed, 4 Dec 2013 07:24:39 +0000 (09:24 +0200)
Change-Id: Iad463e59a1b301252bef4b3f54355333a1aefabb
Signed-off-by: Youri Sdobnikov <i.sdobnikov@samsung.com>
16 files changed:
inc/FUiAnimMesh.h
inc/FUiAnimVisualElement.h
src/ui/animations/FUiAnimBoundingVolume.cpp
src/ui/animations/FUiAnimMesh.cpp
src/ui/animations/FUiAnimVisualElement.cpp
src/ui/animations/FUiAnim_BoundingVolumeImpl.cpp
src/ui/animations/FUiAnim_MatrixUtil.cpp
src/ui/animations/FUiAnim_MatrixUtil.h
src/ui/animations/FUiAnim_MeshImpl.cpp
src/ui/animations/FUiAnim_Plane.cpp
src/ui/animations/FUiAnim_Plane.h
src/ui/animations/FUiAnim_Ray.cpp
src/ui/animations/FUiAnim_Ray.h
src/ui/animations/FUiAnim_VisualElementImpl.cpp
src/ui/inc/FUiAnim_MeshImpl.h
src/ui/inc/FUiAnim_VisualElementImpl.h

index ee8d3ee..8d3dfdb 100644 (file)
@@ -1,3 +1,28 @@
+//
+// 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       FUiAnimMesh.h
+ * @brief      This is the header file for the Mesh class.
+ *
+ * This header file contains the declarations of the Mesh class.
+ */
+
 #ifndef _FUI_ANIM_MESH_H_
 #define _FUI_ANIM_MESH_H_
 
@@ -24,32 +49,61 @@ class VisualElement;
 class _OSP_EXPORT_ Mesh : public Tizen::Base::Object
 {
 public:
-       Mesh(void);
-    Mesh(const Mesh& mesh); // not deep copy
-
-       virtual ~Mesh(void);
 
-public:
+       /**
+        *      @enum GeometryType
+        *      Defines the Geometric Primitive Types for Mesh.
+        *      The contents of Mesh will be rendered using this operation.
+        */
        enum GeometryType
        {
-               GEO_TYPE_NONE,
-               GEO_TYPE_POINTS,
-               GEO_TYPE_LINES,
-               GEO_TYPE_LINE_STRIP,
-               GEO_TYPE_TRIANGLES,
-               GEO_TYPE_TRIANGLE_STRIP
+               GEO_TYPE_NONE = 0,              /* Non specified Geometry Type */
+               GEO_TYPE_POINTS,                /* Every Vertex specified is a Point */
+               GEO_TYPE_LINES,                 /* Every two Vertices specified forms a Line */
+               GEO_TYPE_LINE_STRIP,    /* Every Vertex specified after first two forms a Line */
+               GEO_TYPE_TRIANGLES,             /* Every three Vertices specified compose a Triangle */
+               GEO_TYPE_TRIANGLE_STRIP /* Every three Vertices specified after first three vertices composes a Triangle */
        };
 
        /**
+        * This is the default constructor for this class.
+        *
+        * @since               3.0
+        */
+    Mesh(void);
+
+       /**
+        * This is copy constructor for the Mesh class.
+        *
+        * @since               3.0
+        *
+        * @param[in]   rhs                                     An instance of Mesh
+        * @remarks             Not deep copy
+        */
+    Mesh(const Mesh& mesh);
+
+       /**
+        * This is the destructor for this class.
+        *
+        * @since               3.0
+        */
+    virtual ~Mesh(void);
+
+       /**
         * Replaces the vertex at the specified @c index with the specified value.
         *
         * @since               3.0
         *
         * @return              An error code
-        * @param[in]   pMesh                           The pointer to Mesh @n
-        * @exception   E_SUCCESS                       The method is successful.
-        ** @exception  E_OUT_OF_RANGE
-        * @see                 GetVertex()
+        * @param[in]   arrayIndex                      The index in the vertices array
+        * @param[in]   point                           The specified value
+        * @exception   E_SUCCESS                       The method is successful
+        * @exception   E_INVALID_STATE         Vertices haven't been allocated yet
+        * @exception   E_OUT_OF_RANGE          Invalid position of the vertices array. Either of the following conditions has occurred:
+        *                                                                      - The arrayIndex is bigger then count of allocated vertices;
+        *                                                                      - The arrayIndex is minus value.
+        * @remarks             Can only increase bounding volume size, call AdjustBoundingVolume() to readjust.
+        * @see                 GetVertex(), AdjustBoundingVolume()
         */
        result SetVertex(int arrayIndex, const Tizen::Graphics::FloatPoint3& point);
 
@@ -58,124 +112,152 @@ public:
         *
         * @since               3.0
         *
-        * @return              A FloatPoint3
-        * @remarks             The specific error code can be accessed using the GetLastResult() method.
+        * @return              Vertex position
+        * @param[in]   arrayIndex                      The index in the vertices array
+        * @exception   E_INVALID_STATE         Vertices haven't been allocated yet
+        * @exception   E_INVALID_ARG           Invalid position of the vertices array. Either of the following conditions has occurred:
+        *                                                                      - The arrayIndex is bigger then count of allocated vertices;
+        *                                                                      - The arrayIndex is minus value.
         * @see                 SetVertex()
         */
        Tizen::Graphics::FloatPoint3 GetVertex(int arrayIndex) const;
 
        /**
-        * Gets the count of vertex used
+        * Gets the current count of the vertices
         *
         * @since               3.0
         *
-        * @return              A vertex count int
-        * @remarks             The specific error code can be accessed using the GetLastResult() method.
+        * @return              Vertex count
         * @see                 SetVertex()
         * @see                 GetVertex()
         */
        int GetVertexCount(void) const;
 
-
        /**
         * Replaces the texture coordinate at the specified @c index with the specified value.
         *
         * @since               3.0
         *
         * @return              An error code
-        * @param[in]   pMesh                           The pointer to Mesh @n
-        * @exception   E_SUCCESS                       The method is successful.
-        * @exception   E_OUT_OF_RANGE
+        * @param[in]   arrayIndex                      The index in the texture coordinates array
+        * @param[in]   textureCoord            The specified value
+        * @exception   E_SUCCESS                       The method is successful
+        * @exception   E_OUT_OF_MEMORY         Insufficient memory for allocating texture coordinates
+        * @exception   E_INVALID_STATE         Texture coordinates haven't been allocated
+        * @exception   E_OUT_OF_RANGE          Invalid position of the texture coordinates array. Either of the following conditions has occurred:
+        *                                                                      - The arrayIndex is bigger then count of allocated vertices;
+        *                                                                      - The arrayIndex is minus value.
         * @see                 GetTextureCoord()
         */
        result SetTextureCoord(int arrayIndex, const Tizen::Graphics::FloatPoint& textureCoord);
 
-
        /**
         * Gets the texture coordinate at the specified @c arrayIndex of the texture coordinates array.
         *
         * @since               3.0
         *
-        * @return              A FloatPoint
-        * @remarks             The specific error code can be accessed using the GetLastResult() method.
+        * @return              Texture coordinate
+        * @param[in]   arrayIndex                      The index in the texture coordinates array
+        * @exception   E_INVALID_STATE         Texture coordinates haven't been allocated
+        * @exception   E_INVALID_ARG           Invalid position of the texture coordinates array. Either of the following conditions has occurred:
+        *                                                                      - The arrayIndex is bigger then count of allocated vertices;
+        *                                                                      - The arrayIndex is minus value.
         * @see                 SetTextureCoord()
         */
        Tizen::Graphics::FloatPoint GetTextureCoord(int arrayIndex) const;
 
-
        /**
         * Replaces the normal vector at the specified @c index with the specified value.
         *
         * @since               3.0
         *
         * @return              An error code
-        * @param[in]   pMesh                           The pointer to Mesh @n
-        * @exception   E_SUCCESS                       The method is successful.
-        * @exception   E_OUT_OF_RANGE
+        * @param[in]   arrayIndex                      The index in the normals array
+        * @param[in]   normal                          The specified value
+        * @exception   E_SUCCESS                       The method is successful
+        * @exception   E_OUT_OF_MEMORY         Insufficient memory for allocating normals
+        * @exception   E_OUT_OF_RANGE          Invalid position of the normals array. Either of the following conditions has occurred:
+        *                                                                      - The arrayIndex is bigger then count of allocated vertices;
+        *                                                                      - The arrayIndex is minus value.
         * @see                 GetNormal()
         */
        result SetNormal(int arrayIndex, const Tizen::Graphics::FloatPoint3& normal);
 
-
        /**
         * Gets the normal vector at the specified @c arrayIndex of the normal vectors array.
         *
         * @since               3.0
         *
-        * @return              A FloatPoint3
-        * @remarks             The specific error code can be accessed using the GetLastResult() method.
+        * @return              Normal vector
+        * @param[in]   arrayIndex                      The index in the normals array
+        * @exception   E_INVALID_STATE         Normals haven't been allocated
+        * @exception   E_INVALID_ARG           Invalid position of the normals array. Either of the following conditions has occurred:
+        *                                                                      - The arrayIndex is bigger then count of allocated vertices;
+        *                                                                      - The arrayIndex is minus value.
         * @see                 SetTextureCoord()
         */
        Tizen::Graphics::FloatPoint3 GetNormal(int arrayIndex) const;
 
-
        /**
         * Replaces the color at the specified @c index with the specified value.
         *
         * @since               3.0
         *
         * @return              An error code
-        * @param[in]   pMesh                           The pointer to Mesh @n
-        * @exception   E_SUCCESS                       The method is successful.
-        * @exception   E_OUT_OF_RANGE
+        * @param[in]   arrayIndex                      The index in the colors array
+        * @param[in]   color                           The specified value
+        * @exception   E_SUCCESS                       The method is successful
+        * @exception   E_OUT_OF_MEMORY         Insufficient memory for allocating colors
+        * @exception   E_OUT_OF_RANGE          Invalid position of the colors. Either of the following conditions has occurred:
+        *                                                                      - The arrayIndex is bigger then count of allocated vertices;
+        *                                                                      - The arrayIndex is minus value.
         * @see                 GetColor()
         */
        result SetColor(int arrayIndex, const Tizen::Graphics::Color& color);
 
-
        /**
         * Gets the color at the specified @c arrayIndex of the colors array.
         *
         * @since               3.0
         *
         * @return              A Color
-        * @remarks             The specific error code can be accessed using the GetLastResult() method.
+        * @param[in]   arrayIndex                      The index in the colors array
+        * @exception   E_INVALID_STATE         Colors haven't been allocated
+        * @exception   E_INVALID_ARG           Invalid position of the colors array. Either of the following conditions has occurred:
+        *                                                                      - The arrayIndex is bigger then count of allocated vertices;
+        *                                                                      - The arrayIndex is minus value.
         * @see                 SetColor()
         */
        Tizen::Graphics::Color GetColor(int arrayIndex) const;
 
-
        /**
         * Replaces the vertexIndex at the specified @c index with the specified value.
         *
         * @since               3.0
         *
         * @return              An error code
-        * @param[in]   pMesh                           The pointer to Mesh @n
-        * @exception   E_SUCCESS                       The method is successful.
-        * @exception   E_OUT_OF_RANGE
+        * @param[in]   arrayIndex                      The index in the vertexIndex array
+        * @param[in]   vertexIndex                     The specified value
+        * @exception   E_SUCCESS                       The method is successful
+        * @exception   E_INVALID_STATE         Indices haven't been allocated
+        * @exception   E_OUT_OF_RANGE          Invalid position of the indices. Either of the following conditions has occurred:
+        *                                                                      - The arrayIndex is bigger then count of allocated vertices;
+        *                                                                      - The arrayIndex is minus value.
         * @see                 GetIndex()
         */
        result SetIndex(int arrayIndex, int vertexIndex);
 
-
        /**
         * Gets the index at the specified @c arrayIndex of the indices array.
         *
         * @since               3.0
         *
-        * @return              A int
-        * @remarks             The specific error code can be accessed using the GetLastResult() method.
+        * @return              An index
+        * @param[in]   arrayIndex                      The index in the vertexIndex array
+        * @exception   E_INVALID_STATE         Indices haven't been allocated
+        * @exception   E_INVALID_ARG           Invalid position of the indices array. Either of the following conditions has occurred:
+        *                                                                      - The arrayIndex is bigger then count of allocated indices;
+        *                                                                      - The arrayIndex is minus value.
         * @see                 SetIndex()
         */
        int GetIndex(int arrayIndex) const;
@@ -185,52 +267,50 @@ public:
         *
         * @since               3.0
         *
-        * @return              A index count int
+        * @return              An index count
         * @remarks             The specific error code can be accessed using the GetLastResult() method.
         * @see                 SetIndex()
         * @see                 GetIndex()
         */
        int GetIndexCount(void) const;
 
-
        /**
         * Set the geometry type with the specified value.
         *
         * @since               3.0
         *
         * @return              An error code
-        * @param[in]   type                            The GeometryType value @n
+        * @param[in]   type                            The GeometryType value
         * @exception   E_SUCCESS                       The method is successful.
         * @see                 GetGeometryType()
         */
        result SetGeometryType(GeometryType type);
 
-
        /**
         * Gets the geometry type.
         *
         * @since               3.0
         *
-        * @return              A int
+        * @return              Geometry type
         * @remarks             The specific error code can be accessed using the GetLastResult() method.
-        * @see                 SetIndex()
         */
        GeometryType GetGeometryType(void) const;
 
-
        /**
         * Calculate bounding box of this mesh instance.
         *
         * @since               3.0
         *
         * @return              An error code
-        * @param[in]   rebuild                         rebuild flag @n
         * @exception   E_SUCCESS                       The method is successful.
+        * @exception   E_INVALID_STATE         Vertices haven't been allocated
+        * @remarks             If an exception occurs, this method returns E_INVALID_ARG. Calling Reset() method for bounding Volume and set hasBoundingVolume to false.
+        * @remarks             Additional exceptions can occur according to the behavior of subclasses.
+        * @remarks             Readjusts bounding volume size according to current vertices.
         * @see                 BoundingVolume
         *
         */
-       result AdjustBoundingVolume(bool rebuild = false);
-
+       result AdjustBoundingVolume(void);
 
        /**
         * Clear all instance data.
@@ -248,34 +328,180 @@ public:
         * @exception   E_SUCCESS                       The method is successful.
         * @see                 BoundingVolume
         */
-       BoundingVolume& GetBoundingVolume(void);
+       const BoundingVolume& GetBoundingVolume(void) const;
 
-//     Tizen::Graphics::FloatPoint3 GetBoundingBoxPosition(void) const;
-//    float GetBoundingBoxLength(void) const;
-//     float GetBoundingBoxWidth(void) const;
-//     float GetBoundingBoxHeight(void) const;
-
-       // 임시 함수
+       /**
+        * Allocating vertices of the mesh.
+        *
+        * @since               3.0
+        *
+        * @return              An error code
+        * @param[in]   count                           Quantity of allocated vertices
+        * @exception   E_SUCCESS                       The method is successful
+        * @exception   E_ALREADY_SET           Vertices have already been allocated
+        * @exception   E_INVALID_ARG           Incorrect count for allocating vertices. Either of the following conditions has occurred:
+        *                                                                      - The count is zero;
+        *                                                                      - The count is minus value.
+        * @exception   E_OUT_OF_MEMORY         Insufficient memory for allocating vertices
+        */
     result ReserveVertices(int count);
+
+       /**
+        * Allocating indices of the mesh.
+        *
+        * @since               3.0
+        *
+        * @return              An error code
+        * @param[in]   count                           Quantity of allocated indices
+        * @exception   E_SUCCESS                       The method is successful
+        * @exception   E_ALREADY_SET           Indices have already been allocated
+        * @exception   E_INVALID_ARG           Incorrect count for allocating indices. Either of the following conditions has occurred:
+        *                                                                      - The count is zero;
+        *                                                                      - The count is minus value.
+        * @exception   E_OUT_OF_MEMORY         Insufficient memory for allocating indices
+        */
     result ReserveIndices(int count);
-       result ReserveTextureCoordinates(void);
-       result ReserveNormals(void);
-       result ReserveColors(void);
-    result SaveMeshToBin(const Tizen::Base::String& fileName);
 
+       /**
+        * Allocating texture coordinates of the mesh.
+        *
+        * @since               3.0
+        *
+        * @return              An error code
+        * @exception   E_SUCCESS                       The method is successful
+        * @exception   E_ALREADY_SET           Texture coordinates have already been allocated
+        * @exception   E_INVALID_STATE         Incorrect count of allocated vertex. Either of the following conditions has occurred:
+        *                                                                      - The count of allocated vertices is zero;
+        *                                                                      - The count of allocated vertices is minus value.
+        * @exception   E_OUT_OF_MEMORY         Insufficient memory for allocating texture coordinates
+        * @remarks             This method depends from count of allocated vertices
+        */
+    result ReserveTextureCoordinates(void);
+
+       /**
+        * Allocating normals of the mesh.
+        *
+        * @since               3.0
+        *
+        * @return              An error code
+        * @exception   E_SUCCESS                       The method is successful
+        * @exception   E_ALREADY_SET           Normals have already been allocated
+        * @exception   E_INVALID_STATE         Incorrect count of allocated vertex. Either of the following conditions has occurred:
+        *                                                                      - The count of allocated vertices is zero;
+        *                                                                      - The count of allocated vertices is minus value.
+        * @exception   E_OUT_OF_MEMORY         Insufficient memory for allocating normals
+        * @remarks             This method depends from count of allocated vertices
+        */
+    result ReserveNormals(void);
+
+       /**
+        * Allocating colors of the mesh.
+        *
+        * @since               3.0
+        *
+        * @return              An error code
+        * @exception   E_SUCCESS                       The method is successful.
+        * @exception   E_ALREADY_SET           Colors have already been allocated
+        * @exception   E_INVALID_STATE         Incorrect count of allocated vertex. Either of the following conditions has occurred:
+        *                                                                      - The count of allocated vertices is zero;
+        *                                                                      - The count of allocated vertices is minus value.
+        * @exception   E_OUT_OF_MEMORY         Insufficient memory for allocating colors
+        * @remarks             This method depends from count of allocated vertices
+        */
+    result ReserveColors(void);
+
+       /**
+        * Saving mesh to binary file.
+        *
+        * @since               3.0
+        *
+        * @return              An error code
+        * @param[in]   fileName                        Saving Mesh's name
+        * @exception   E_SUCCESS                       The method is successful
+        * @exception   E_OPERATION_FAILED      File for saving didn't open
+        * @exception   E_INVALID_DATA          Mesh without vertices
+        */
+    result SaveMeshToBinary(const Tizen::Base::String& fileName);
+
+       /**
+        * Checking for indexing enabling
+        *
+        * @since               3.0
+        *
+        * @return              True if indexing is enabled
+        * @see                 ReserveIndices()
+        */
        bool IsIndexEnabled(void) const;
+
+       /**
+        * Checking for texture coordinate enabling
+        *
+        * @since               3.0
+        *
+        * @return              True if texture coordinate is enabled
+        * @see                 ReserveTextureCoordinates()
+        */
        bool IsTextureCoordinateEnabled(void) const;
+
+       /**
+        * Checking for colors enabling
+        *
+        * @since               3.0
+        *
+        * @return              True if coloring is enabled
+        * @see                 ReserveColors()
+        */
        bool IsColorEnabled(void) const;
+
+       /**
+        * Checking for normals are enabled or not
+        *
+        * @since               3.0
+        *
+        * @return              True if normals are enabled
+        * @see                 ReserveNormals()
+        */
        bool IsNormalEnabled(void) const;
 
+       /**
+        * Setting mesh's name
+        *
+        * @since               3.0
+        *
+        * @param[in]   name    Setting mesh's name
+        */
        void SetName(Tizen::Base::String name);
-       Tizen::Base::String GetName(void) const;
 
+       /**
+        * Getting mesh's name
+        *
+        * @since               3.0
+        *
+        * @return              Mesh's name
+        */
+       Tizen::Base::String GetName(void);
+       Tizen::Base::String GetName() const;
+
+       //--------------------------------------------------TEMP
        MeshController* GetMeshController(void);
+       //--------------------------------------------------
 
        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 %Mesh.
+        *
+        *  @since 3.0
+        *
+        *      @return         An integer value indicating the hash value of the current instance of %Mesh
+        *      @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:
        class _MeshImpl* __pMeshImpl;
 
index da530a8..e80e67a 100644 (file)
@@ -1482,9 +1482,37 @@ public:
         */
        Light* GetLightN(void) const;
 
+       /**
+        * Sets the contents of this instance with the specified ShaderProgram. @n
+        * The contents of the @c pShaderProgram is not copied by the %SetShaderProgram() method, but shared with this instance.
+        *
+        * @since               3.0
+        *
+        * @return              An error code
+        * @param[in]   pShaderProgram          The pointer to ShaderProgram @n
+        * @exception   E_SUCCESS                       The method is successful.
+        * @remarks             If applications modify the contents of @c pShaderProgram, the modifications will be applied to all
+        *                              the %VisualElements which share same ShaderProgram. But in this case, applications need to call
+        *                              the SetFlushNeeded() method for those %VisualElements because the modifications of the @c pShaderProgram will not be applied on the screen automatically.
+        * @see                 GetShaderProgramN()
+        */
        result SetShaderProgram(ShaderProgram* pShaderProgram);
 
        /**
+        * Gets the ShaderProgram data this instance uses for its contents.
+        *
+        * @since               3.0
+        *
+        * @return              A pointer to ShaderProgram
+        * @exception   E_SUCCESS                       The method is successful.
+        * @exception   E_SYSTEM                        A system error has occurred.
+        * @remarks             The specific error code can be accessed using the GetLastResult() method.
+        * @remarks             If an exception occurs, this method returns @c null.
+        * @see                 SetShaderProgram()
+        */
+       ShaderProgram* GetShaderProgramN(void) const;
+
+       /**
         * Flushes %VisualElements on screen.
         *
         * @since               2.0
@@ -1517,7 +1545,7 @@ public:
         * @return              BoundingVolume reference
         * @see                 AdjustBoundingVolume()
         */
-       BoundingVolume& GetBoundingVolume(void);
+       const BoundingVolume& GetBoundingVolume(void) const;
        /**
         * Build list of intersected VisualElements in the intersection order, starting from nearest
         *
index 77e43ec..6342033 100644 (file)
@@ -41,7 +41,7 @@ using namespace Tizen::Ui::Animations;
 namespace Tizen { namespace Ui { namespace Animations
 {
 
-BoundingVolume::BoundingVolume()
+BoundingVolume::BoundingVolume(void)
                : _pBoundingVolumeImpl(null)
 {
        ClearLastResult();
@@ -113,7 +113,7 @@ BoundingVolume::Set(const Tizen::Graphics::FloatPoint3& center, float radius)
 
 
 FloatPoint3
-BoundingVolume::GetCenter() const
+BoundingVolume::GetCenter(void) const
 {
        SysAssertf(_pBoundingVolumeImpl != null, "Failed to create BoundingVolume Impl instance. Not enough  memory.");
 
@@ -123,7 +123,7 @@ BoundingVolume::GetCenter() const
 }
 
 FloatPoint3
-BoundingVolume::GetHalfSize() const
+BoundingVolume::GetHalfSize(void) const
 {
        SysAssertf(_pBoundingVolumeImpl != null, "Failed to create BoundingVolume Impl instance. Not enough  memory.");
 
@@ -223,7 +223,7 @@ BoundingVolume::Transform(const Tizen::Graphics::FloatMatrix4& transformMatrix)
 }
 
 void
-BoundingVolume::Reset()
+BoundingVolume::Reset(void)
 {
        SysAssertf(_pBoundingVolumeImpl != null, "Failed to create BoundingVolume Impl instance. Not enough  memory.");
 
@@ -239,7 +239,7 @@ BoundingVolume::IsBoxTwiceLess(const BoundingVolume& volume, bool& is)
 }
 
 BoundingVolumeState
-BoundingVolume::GetState() const
+BoundingVolume::GetState(void) const
 {
        SysAssertf(_pBoundingVolumeImpl != null, "Failed to create BoundingVolume Impl instance. Not enough  memory.");
 
@@ -247,7 +247,7 @@ BoundingVolume::GetState() const
 }
 
 BoundingVolumeType
-BoundingVolume::GetType() const
+BoundingVolume::GetType(void) const
 {
        SysAssertf(_pBoundingVolumeImpl != null, "Failed to create BoundingVolume Impl instance. Not enough  memory.");
 
index d82aeba..7a52d8d 100644 (file)
@@ -150,29 +150,31 @@ Mesh::SetGeometryType(GeometryType type)
 }
 
 Mesh::GeometryType
-Mesh::GetGeometryType() const
+Mesh::GetGeometryType(void) const
 {
     CHECK_CONSTRUCTED;
     return __pMeshImpl->GetGeometryType();
 }
 
 result
-Mesh::AdjustBoundingVolume(bool rebuild)
+Mesh::AdjustBoundingVolume(void)
 {
+       SetLastResult(E_SUCCESS);
     CHECK_CONSTRUCTED;
-    return __pMeshImpl->AdjustBoundingVolume(rebuild);
+    return __pMeshImpl->AdjustBoundingVolume();
 }
 
 void
-Mesh::Clear()
+Mesh::Clear(void)
 {
     CHECK_CONSTRUCTED;
     __pMeshImpl->Clear();
 }
 
-BoundingVolume&
-Mesh::GetBoundingVolume()
+const BoundingVolume&
+Mesh::GetBoundingVolume(void) const
 {
+       SetLastResult(E_SUCCESS);
        CHECK_CONSTRUCTED;
        return __pMeshImpl->GetBoundingVolume();
 }
@@ -220,70 +222,70 @@ Mesh::ReserveIndices(int count)
 }
 
 result
-Mesh::ReserveTextureCoordinates()
+Mesh::ReserveTextureCoordinates(void)
 {
     CHECK_CONSTRUCTED;
     return __pMeshImpl->AllocTextureCoordinates();
 }
 
 result
-Mesh::ReserveNormals()
+Mesh::ReserveNormals(void)
 {
     CHECK_CONSTRUCTED;
     return __pMeshImpl->AllocNormals();
 }
 
 result
-Mesh::ReserveColors()
+Mesh::ReserveColors(void)
 {
     CHECK_CONSTRUCTED;
     return __pMeshImpl->AllocColors();
 }
 
 bool
-Mesh::IsIndexEnabled() const
+Mesh::IsIndexEnabled(void) const
 {
     CHECK_CONSTRUCTED;
     return __pMeshImpl->IsIndexEnabled();
 
 }
 bool
-Mesh::IsTextureCoordinateEnabled() const
+Mesh::IsTextureCoordinateEnabled(void) const
 {
     CHECK_CONSTRUCTED;
     return __pMeshImpl->IsTextureCoordinateEnabled();
 }
 bool
-Mesh::IsColorEnabled() const
+Mesh::IsColorEnabled(void) const
 {
     CHECK_CONSTRUCTED;
     return __pMeshImpl->IsColorEnabled();
 }
 bool
-Mesh::IsNormalEnabled() const
+Mesh::IsNormalEnabled(void) const
 {
     CHECK_CONSTRUCTED;
     return __pMeshImpl->IsNormalEnabled();
 }
 
 int
-Mesh::GetVertexCount() const
+Mesh::GetVertexCount(void) const
 {
        CHECK_CONSTRUCTED;
        return __pMeshImpl->GetCountOfVertices();
 }
 int
-Mesh::GetIndexCount() const
+Mesh::GetIndexCount(void) const
 {
        CHECK_CONSTRUCTED;
        return __pMeshImpl->GetCountOfIndices();
 }
 
 result
-Mesh::SaveMeshToBin(const Tizen::Base::String& fileName)
+Mesh::SaveMeshToBinary(const Tizen::Base::String& fileName)
 {
        CHECK_CONSTRUCTED;
-       return __pMeshImpl->SaveMeshToBin(fileName);
+       return __pMeshImpl->SaveMeshToBinary(fileName);
 }
 
 void
@@ -295,11 +297,26 @@ Mesh::SetName(Tizen::Base::String name)
 }
 
 Tizen::Base::String
+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());
 }
 
+int
+Mesh::GetHashCode(void) const
+{
+       CHECK_CONSTRUCTED;
+       return (int) __pMeshImpl;
+}
+//--------------------------------------------------TEMP
+
 MeshController*
 Mesh::GetMeshController(void)
 {
index 31dda44..af139b9 100644 (file)
@@ -946,6 +946,13 @@ VisualElement::SetShaderProgram(ShaderProgram* pShaderProgram)
        return _pVisualElementImpl->SetShaderProgram(pShaderProgram);
 }
 
+ShaderProgram*
+VisualElement::GetShaderProgramN(void) const
+{
+       CHECK_CONSTRUCTED;
+       return _pVisualElementImpl->GetShaderProgramN();
+}
+
 void
 VisualElement::SetImplicitAnimationEnabled(bool enable)
 {
@@ -1031,15 +1038,15 @@ VisualElement::OnCreateAnimationForProperty(const Tizen::Base::String& property)
 }
 
 result
-VisualElement::AdjustBoundingVolume()
+VisualElement::AdjustBoundingVolume(void)
 {
        CHECK_CONSTRUCTED;
 
        return _pVisualElementImpl->AdjustBoundingVolume();
 }
 
-BoundingVolume&
-VisualElement::GetBoundingVolume()
+const BoundingVolume&
+VisualElement::GetBoundingVolume(void) const
 {
        CHECK_CONSTRUCTED;
 
index 0b52145..d07213e 100644 (file)
@@ -36,7 +36,7 @@
 namespace Tizen{ namespace Ui{ namespace Animations
 {
 
-_BoundingVolumeImpl::_BoundingVolumeImpl()
+_BoundingVolumeImpl::_BoundingVolumeImpl(void)
        : __state(BOUNDING_VOLUME_STATE_EMPTY)
        , __type(BOUNDING_VOLUME_TYPE_AABB)
        , __min(0.0f)
@@ -45,7 +45,7 @@ _BoundingVolumeImpl::_BoundingVolumeImpl()
 
 }
 
-_BoundingVolumeImpl::~_BoundingVolumeImpl()
+_BoundingVolumeImpl::~_BoundingVolumeImpl(void)
 {
 
 }
@@ -122,7 +122,7 @@ _BoundingVolumeImpl::GetInstance(BoundingVolume* pPublic)
 }
 
 _Math::Vector3
-_BoundingVolumeImpl::GetCenter() const
+_BoundingVolumeImpl::GetCenter(void) const
 {
        switch(__type)
        {
@@ -555,7 +555,7 @@ _BoundingVolumeImpl::Transform(const _Math::Matrix4& world)
 }
 
 
-void _BoundingVolumeImpl::Reset()
+void _BoundingVolumeImpl::Reset(void)
 {
        __min = _Math::Vector3();
        __max = _Math::Vector3();
@@ -581,7 +581,7 @@ result _BoundingVolumeImpl::IsBoxTwiceLess(const _BoundingVolumeImpl& box, bool&
 }
 
 
-void _BoundingVolumeImpl::print() const
+void _BoundingVolumeImpl::print(void) const
 {
        switch(__type)
        {
index 70cfc19..af68058 100644 (file)
@@ -175,6 +175,30 @@ _MatrixUtilTransform(const Tizen::Graphics::FloatMatrix4& m, float* pX, float* p
 }
 
 void
+_MatrixUtilTransformDirection(const Tizen::Graphics::FloatMatrix4& m, float* pX, float* pY, float* pZ)
+{
+       float x = 0.f, y = 0.f, z = 0.f, w = 0.0f;
+
+       x = (m.matrix[0][0] * *pX) + (m.matrix[1][0] * *pY) + (m.matrix[2][0] * *pZ) + (m.matrix[3][0] * 0.0f);
+       y = (m.matrix[0][1] * *pX) + (m.matrix[1][1] * *pY) + (m.matrix[2][1] * *pZ) + (m.matrix[3][1] * 0.0f);
+       z = (m.matrix[0][2] * *pX) + (m.matrix[1][2] * *pY) + (m.matrix[2][2] * *pZ) + (m.matrix[3][2] * 0.0f);
+//     w = (m.matrix[0][3] * *pX) + (m.matrix[1][3] * *pY) + (m.matrix[2][3] * *pZ) + (m.matrix[3][3] * 0.0f);
+
+//     if (w != 1.0f && w != 0.0f)
+//     {
+               *pX = x;
+               *pY = y;
+               *pZ = z;
+//     }
+//     else
+//     {
+//             *pX = x;
+//             *pY = y;
+//             *pZ = z;
+//     }
+}
+
+void
 _MatrixUtilTranslate(Tizen::Graphics::FloatMatrix4& m, float tx, float ty, float tz)
 {
        m.matrix[3][0] += (m.matrix[0][0] * tx + m.matrix[1][0] * ty + m.matrix[2][0] * tz);
index a4f4327..208892a 100644 (file)
@@ -129,6 +129,7 @@ void _MatrixUtilSetIdentity(Tizen::Graphics::FloatMatrix4& m);
 bool _MatrixUtilIsEqual(const Tizen::Graphics::FloatMatrix4& m1, const Tizen::Graphics::FloatMatrix4& m2);
 void _MatrixUtilSetTranslation(Tizen::Graphics::FloatMatrix4& m, float tx, float ty, float tz);
 void _MatrixUtilTransform(const Tizen::Graphics::FloatMatrix4& m, float* pX, float* pY, float* pZ);
+void _MatrixUtilTransformDirection(const Tizen::Graphics::FloatMatrix4& m, float* pX, float* pY, float* pZ);
 void _MatrixUtilTranslate(Tizen::Graphics::FloatMatrix4& m, float tx, float ty, float tz);
 bool _MatrixUtilIsTranslation(const Tizen::Graphics::FloatMatrix4& m);
 void _MatrixUtilScale(Tizen::Graphics::FloatMatrix4& m, float sx, float sy, float sz);
index 91a94e9..537fbb1 100644 (file)
@@ -92,7 +92,6 @@ _MeshImpl::_MeshImpl(const Mesh& mesh)
     , __countOfAllocatedVertex(0)
     , __countOfIndex(0)
     , __countOfAllocatedIndex(0)
-       , __hasBoundingVolume(false)
        , __boundingVolume()
        , __pMeshController(null)
 {
@@ -128,7 +127,6 @@ _MeshImpl::Clear()
        __countOfAllocatedIndex = 0;
 
        __boundingVolume.Reset();
-       __hasBoundingVolume = false;
 
        if(__pMeshController)
        {
@@ -275,10 +273,7 @@ _MeshImpl::SetVertex(int arrayIndex, const FloatPoint3& vertex)
        __pVertices[i + 1] = vertex.y;// - __boundingVolume.GetCenter().y;   //y
        __pVertices[i + 2] = vertex.z;// - __boundingVolume.GetCenter().z;   //z
 
-       if (__hasBoundingVolume)
-       {
-               __boundingVolume.Merge(vertex);
-       }
+       __boundingVolume.Merge(vertex);
 
        if (__countOfVertex <= arrayIndex)
        {
@@ -473,7 +468,7 @@ _MeshImpl::GetGeometryType() const
 }
 
 result
-_MeshImpl::AdjustBoundingVolume(bool rebuild)
+_MeshImpl::AdjustBoundingVolume(void)
 {
        MESH_LOCK();
        result r;
@@ -492,48 +487,19 @@ _MeshImpl::AdjustBoundingVolume(bool rebuild)
                SysTryCatch(NID_UI_ANIM, r == E_SUCCESS, , r, "%s Adds volume of specified BoundingVolume to this BoundingVolume is failed.", GetErrorMessage(r));
        }
 
-       __hasBoundingVolume = true;
-
     return E_SUCCESS;
 
     CATCH:
        __boundingVolume.Reset();
-       __hasBoundingVolume = false;
        return r;
 }
 
-BoundingVolume&
-_MeshImpl::GetBoundingVolume()
+const BoundingVolume&
+_MeshImpl::GetBoundingVolume(void) const
 {
        return __boundingVolume;
 }
 
-//FloatPoint3
-//_MeshImpl::GetBoundingBoxPosition() const
-//{
-//     Vector3 v = __boundingVolume.GetCenter();
-//    return FloatPoint3(v.x, v.y, v.z);
-//}
-//
-//float
-//_MeshImpl::GetBoundingBoxVolume() const
-//{
-//     return __boundingVolume.GetHalfSize().z * 2;
-//}
-//
-//
-//float
-//_MeshImpl::GetBoundingBoxWidth() const
-//{
-//     return __boundingVolume.GetHalfSize().x * 2;
-//}
-//
-//float
-//_MeshImpl::GetBoundingBoxHeight() const
-//{
-//     return __boundingVolume.GetHalfSize().y * 2;
-//}
-
 Mesh*
 _MeshImpl::LoadMeshFromBinaryN(const std::string& fileName, const std::string& modelName)
  {
@@ -561,9 +527,6 @@ _MeshImpl::LoadMeshFromBinaryN(const std::string& fileName, const std::string& m
        quantityReadFromFile += fread(&pMeshImpl->__countOfAllocatedIndex, sizeof(int32_t), 1, pFile);
 
        quantityReadFromFile += fread(&intsData, sizeof(int32_t), 1, pFile);
-       pMeshImpl->__hasBoundingVolume = static_cast<bool>(intsData);
-
-       quantityReadFromFile += fread(&intsData, sizeof(int32_t), 1, pFile);
        pMeshImpl->__geoType = static_cast<Mesh::GeometryType> (intsData);
 
        if (localCapacity.isVerticesEnabled)
@@ -637,7 +600,7 @@ _MeshImpl::LoadMeshFromBinaryN(const std::string& fileName, const std::string& m
 }
 
 result
-_MeshImpl::SaveMeshToBin(const Tizen::Base::String& fileName)
+_MeshImpl::SaveMeshToBinary(const Tizen::Base::String& fileName)
 {
        int quantityWriteToFile;
        result r;
@@ -664,10 +627,6 @@ _MeshImpl::SaveMeshToBin(const Tizen::Base::String& fileName)
        intsData = __countOfAllocatedIndex;
        quantityWriteToFile += fwrite(&intsData, sizeof(int32_t), 1, pFile);
 
-
-       intsData = static_cast<int>(__hasBoundingVolume);
-       quantityWriteToFile += fwrite(&intsData, sizeof(int32_t), 1, pFile);
-
        intsData = static_cast<int>(__geoType);
        quantityWriteToFile += fwrite(&intsData, sizeof(int32_t), 1, pFile);
 
index 610d72f..0ee1c2d 100644 (file)
@@ -177,7 +177,7 @@ _Plane::Get(Tizen::Graphics::FloatPoint3& v1, Tizen::Graphics::FloatPoint3& v2,
 }
 
 PlaneIntersectionResult
-_Plane::Intersect(Tizen::Ui::Animations::_Plane& other) const
+_Plane::Intersect(const Tizen::Ui::Animations::_Plane& other) const
 {
        if (_a == other._a && _b == other._b && _c == other._c)
        {
@@ -202,7 +202,7 @@ _Plane::Intersect(Tizen::Ui::Animations::_Plane& other) const
 }
 
 PlaneIntersectionResult
-_Plane::Intersect(Tizen::Graphics::FloatPoint3& v) const
+_Plane::Intersect(const Tizen::Graphics::FloatPoint3& v) const
 {
        float d = (_a * v.x + _b * v.y + _c * v.z + _d);
 
@@ -222,7 +222,7 @@ _Plane::Intersect(Tizen::Graphics::FloatPoint3& v) const
 }
 
 PlaneIntersectionResult
-_Plane::Intersect(Tizen::Ui::Animations::BoundingVolume& volume) const
+_Plane::Intersect(const Tizen::Ui::Animations::BoundingVolume& volume) const
 {
        switch(volume.GetType())
        {
@@ -302,7 +302,7 @@ _Plane::Intersect(Tizen::Ui::Animations::BoundingVolume& volume) const
 }
 
 PlaneIntersectionResult
-_Plane::Intersect(Tizen::Ui::Animations::Mesh* pMesh) const
+_Plane::Intersect(const Tizen::Ui::Animations::Mesh* pMesh) const
 {
        FloatPoint3 v;
        bool pos = false;
@@ -343,7 +343,7 @@ _Plane::Intersect(Tizen::Ui::Animations::Mesh* pMesh) const
 }
 
 float
-_Plane::GetDistance(Tizen::Graphics::FloatPoint3& v) const
+_Plane::GetDistance(const Tizen::Graphics::FloatPoint3& v) const
 {
        return Abs(_a * v.x + _b * v.y + _c * v.z + _d);//normilized / Sqrt(_a * _a + _b * _b + _c * _c);
 }
@@ -373,7 +373,7 @@ _Selection::_Selection()
 
 }
 
-_Selection::_Selection(_Plane& plane1,_Plane& plane2,_Plane& plane3,_Plane& plane4)
+_Selection::_Selection(const _Plane& plane1, const _Plane& plane2, const _Plane& plane3, const _Plane& plane4)
 {
        _plane[0] = plane1;
        _plane[1] = plane2;
@@ -398,7 +398,7 @@ _Selection::operator = (const _Selection& rhs)
 }
 
 result
-_Selection::Set(_Plane& plane1, _Plane& plane2, _Plane& plane3, _Plane& plane4)
+_Selection::Set(const _Plane& plane1, const _Plane& plane2, const _Plane& plane3, const _Plane& plane4)
 {
        _plane[0] = plane1;
        _plane[1] = plane2;
@@ -409,7 +409,7 @@ _Selection::Set(_Plane& plane1, _Plane& plane2, _Plane& plane3, _Plane& plane4)
 }
 
 result
-_Selection::Set(int index, _Plane& plane)
+_Selection::Set(int index, const _Plane& plane)
 {
        if (index >= 0 && index < 4)
        {
@@ -424,7 +424,7 @@ _Selection::Set(int index, _Plane& plane)
 }
 
 result
-_Selection::Set(int index, Tizen::Graphics::FloatPoint3& v1, Tizen::Graphics::FloatPoint3& v2, Tizen::Graphics::FloatPoint3& v3)
+_Selection::Set(int index, const Tizen::Graphics::FloatPoint3& v1, const Tizen::Graphics::FloatPoint3& v2, const Tizen::Graphics::FloatPoint3& v3)
 {
        if (index >= 0 && index < 4)
        {
@@ -452,7 +452,7 @@ _Selection::Get(int index)
 }
 
 bool
-_Selection::FindIncludedPoints(Tizen::Graphics::FloatPoint3& v) const
+_Selection::FindIncludedPoints(const Tizen::Graphics::FloatPoint3& v) const
 {
        bool pos = false;
        bool neg = false;
@@ -479,7 +479,7 @@ _Selection::FindIncludedPoints(Tizen::Graphics::FloatPoint3& v) const
 }
 
 bool
-_Selection::FindExcludedPoints(Tizen::Graphics::FloatPoint3& v) const
+_Selection::FindExcludedPoints(const Tizen::Graphics::FloatPoint3& v) const
 {
        bool pos = false;
        bool neg = false;
@@ -506,7 +506,7 @@ _Selection::FindExcludedPoints(Tizen::Graphics::FloatPoint3& v) const
 }
 
 bool
-_Selection::FindIncludedPoints(Tizen::Ui::Animations::BoundingVolume& volume) const
+_Selection::FindIncludedPoints(const Tizen::Ui::Animations::BoundingVolume& volume) const
 {
        bool pos = false;
        bool neg = false;
@@ -533,7 +533,7 @@ _Selection::FindIncludedPoints(Tizen::Ui::Animations::BoundingVolume& volume) co
 }
 
 bool
-_Selection::FindExcludedPoints(Tizen::Ui::Animations::BoundingVolume& volume) const
+_Selection::FindExcludedPoints(const Tizen::Ui::Animations::BoundingVolume& volume) const
 {
        bool pos = false;
        bool neg = false;
@@ -564,7 +564,7 @@ _Selection::FindExcludedPoints(Tizen::Ui::Animations::BoundingVolume& volume) co
 }
 
 bool
-_Selection::FindIncludedPoints(Tizen::Ui::Animations::Mesh* pMesh) const
+_Selection::FindIncludedPoints(const Tizen::Ui::Animations::Mesh* pMesh) const
 {
        if (pMesh != null)
        {
@@ -586,7 +586,7 @@ _Selection::FindIncludedPoints(Tizen::Ui::Animations::Mesh* pMesh) const
 }
 
 bool
-_Selection::FindExcludedPoints(Tizen::Ui::Animations::Mesh* pMesh) const
+_Selection::FindExcludedPoints(const Tizen::Ui::Animations::Mesh* pMesh) const
 {
        if (pMesh != null)
        {
@@ -608,7 +608,7 @@ _Selection::FindExcludedPoints(Tizen::Ui::Animations::Mesh* pMesh) const
 }
 
 result
-_Selection::FindIncludedExcludedPoints(Tizen::Ui::Animations::Mesh* pMesh, bool& hasIncluded, bool& hasExcluded) const
+_Selection::FindIncludedExcludedPoints(const Tizen::Ui::Animations::Mesh* pMesh, bool& hasIncluded, bool& hasExcluded) const
 {
        hasIncluded = false;
        hasExcluded = false;
@@ -652,7 +652,7 @@ _Selection::FindIncludedExcludedPoints(Tizen::Ui::Animations::Mesh* pMesh, bool&
 }
 
 bool
-_Selection::FindIncludedEdgeIntersections(Tizen::Graphics::FloatPoint3& v1, Tizen::Graphics::FloatPoint3& v2) const
+_Selection::FindIncludedEdgeIntersections(const Tizen::Graphics::FloatPoint3& v1, const Tizen::Graphics::FloatPoint3& v2) const
 {
        FloatPoint3 v1v2(v2 - v1);
        FloatPoint3 n, intersectPoint;
@@ -678,7 +678,7 @@ _Selection::FindIncludedEdgeIntersections(Tizen::Graphics::FloatPoint3& v1, Tize
 }
 
 bool
-_Selection::FindIncludedMeshIntersections(Tizen::Ui::Animations::Mesh* pMesh) const
+_Selection::FindIncludedMeshIntersections(const Tizen::Ui::Animations::Mesh* pMesh) const
 {
        if (pMesh != null)
        {
index ec04253..49fdae3 100644 (file)
@@ -70,13 +70,13 @@ public:
        result Get(float& a,float& b, float& c, float& d) const;
        result Get(Tizen::Graphics::FloatPoint3& v1, Tizen::Graphics::FloatPoint3& v2, Tizen::Graphics::FloatPoint3& v3) const;
 
-       PlaneIntersectionResult Intersect(Tizen::Ui::Animations::_Plane& other) const;
-       PlaneIntersectionResult Intersect(Tizen::Graphics::FloatPoint3& v) const;
-       PlaneIntersectionResult Intersect(Tizen::Ui::Animations::BoundingVolume& volume) const;
-       PlaneIntersectionResult Intersect(Tizen::Ui::Animations::Mesh* pMesh) const;
+       PlaneIntersectionResult Intersect(const Tizen::Ui::Animations::_Plane& other) const;
+       PlaneIntersectionResult Intersect(const Tizen::Graphics::FloatPoint3& v) const;
+       PlaneIntersectionResult Intersect(const Tizen::Ui::Animations::BoundingVolume& volume) const;
+       PlaneIntersectionResult Intersect(const Tizen::Ui::Animations::Mesh* pMesh) const;
 
-       float GetDistance(Tizen::Graphics::FloatPoint3& v) const; //distance to point
-       Tizen::Graphics::FloatPoint3 GetNormal(void) const; //distance to point
+       float GetDistance(const Tizen::Graphics::FloatPoint3& v) const; //distance to point
+       Tizen::Graphics::FloatPoint3 GetNormal() const; //distance to point
 
        result Transform(const Tizen::Graphics::FloatMatrix4& transformMatrix);
 
@@ -91,30 +91,30 @@ class _Selection
 {
 public:
        _Selection(void);
-       _Selection(_Plane& plane1,_Plane& plane2,_Plane& plane3,_Plane& plane4);
+       _Selection(const _Plane& plane1, const _Plane& plane2, const _Plane& plane3, const _Plane& plane4);
        ~_Selection(void);
        _Selection& operator = (const _Selection& rhs);
 
-       result Set(_Plane& plane1, _Plane& plane2, _Plane& plane3, _Plane& plane4);
-       result Set(int index, _Plane& plane);
-       result Set(int index, Tizen::Graphics::FloatPoint3& v1, Tizen::Graphics::FloatPoint3& v2, Tizen::Graphics::FloatPoint3& v3);
+       result Set(const _Plane& plane1, const _Plane& plane2, const _Plane& plane3, const _Plane& plane4);
+       result Set(int index, const _Plane& plane);
+       result Set(int index, const Tizen::Graphics::FloatPoint3& v1, const Tizen::Graphics::FloatPoint3& v2, const Tizen::Graphics::FloatPoint3& v3);
 
        _Plane& Get(int index);
 
        result Transform(const Tizen::Graphics::FloatMatrix4& transformMatrix);
 
-       bool FindIncludedPoints(Tizen::Graphics::FloatPoint3& v) const;
-       bool FindExcludedPoints(Tizen::Graphics::FloatPoint3& v) const;
+       bool FindIncludedPoints(const Tizen::Graphics::FloatPoint3& v) const;
+       bool FindExcludedPoints(const Tizen::Graphics::FloatPoint3& v) const;
 
-       bool FindIncludedPoints(Tizen::Ui::Animations::BoundingVolume& volume) const;
-       bool FindExcludedPoints(Tizen::Ui::Animations::BoundingVolume& volume) const;
+       bool FindIncludedPoints(const Tizen::Ui::Animations::BoundingVolume& volume) const;
+       bool FindExcludedPoints(const Tizen::Ui::Animations::BoundingVolume& volume) const;
 
-       bool FindIncludedPoints(Tizen::Ui::Animations::Mesh* pMesh) const;
-       bool FindExcludedPoints(Tizen::Ui::Animations::Mesh* pMesh) const;
-       result FindIncludedExcludedPoints(Tizen::Ui::Animations::Mesh* pMesh, bool& hasIncluded, bool& hasExcluded) const;
+       bool FindIncludedPoints(const Tizen::Ui::Animations::Mesh* pMesh) const;
+       bool FindExcludedPoints(const Tizen::Ui::Animations::Mesh* pMesh) const;
+       result FindIncludedExcludedPoints(const Tizen::Ui::Animations::Mesh* pMesh, bool& hasIncluded, bool& hasExcluded) const;
 
-       bool FindIncludedMeshIntersections(Tizen::Ui::Animations::Mesh* pMesh) const;
-       bool FindIncludedEdgeIntersections(Tizen::Graphics::FloatPoint3& v1, Tizen::Graphics::FloatPoint3& v2) const;
+       bool FindIncludedMeshIntersections(const Tizen::Ui::Animations::Mesh* pMesh) const;
+       bool FindIncludedEdgeIntersections(const Tizen::Graphics::FloatPoint3& v1, const Tizen::Graphics::FloatPoint3& v2) const;
 
 protected:
        _Plane _plane[4];
index 46a7315..9a2f23a 100644 (file)
@@ -23,6 +23,7 @@
 #include <FGrpFloatPoint.h>
 #include <FGrpFloatDimension.h>
 #include <FGrpFloatRectangle.h>
+#include "FUiAnim_MatrixUtil.h"
 
 #include "math/FUiAnim_MathVector3.h"
 #include "math/FUiAnim_MathMatrix4.h"
@@ -37,19 +38,19 @@ float DotProduct(_Math::Vector3 v1, _Math::Vector3 v2)
        return v1.x * v2.x + v1.y * v2.y + v1.z * v2.z;
 }
 
-_Ray::_Ray()
-       : Position(0.0)
-       , Direction(0.0)
+_Ray::_Ray(void)
+       : position(0.0)
+       , direction(0.0)
 {
 
 }
 
 
-_Ray::_Ray(const _Math::Vector3& position, const _Math::Vector3& direction)
-       : Position(position)
-       , Direction(direction)
+_Ray::_Ray(const _Math::Vector3& positionInput, const _Math::Vector3& directionInput)
+       : position(positionInput)
+       , direction(directionInput)
 {
-       Direction.Normalize();
+       direction.Normalize();
 }
 
 _Ray&
@@ -61,15 +62,15 @@ _Ray::operator = (_Ray& rhs)
 _Ray&
 _Ray::Set(const _Ray& rhs)
 {
-       Position = rhs.Position;
-       Direction = rhs.Direction;
+       position = rhs.position;
+       direction = rhs.direction;
        return *this;
 }
 _Ray&
-_Ray::Set(const _Math::Vector3& position, const _Math::Vector3& direction)
+_Ray::Set(const _Math::Vector3& positionInput, const _Math::Vector3& directionInput)
 {
-       Position = position;
-       Direction = direction;
+       position = positionInput;
+       direction = directionInput;
        return *this;
 }
 
@@ -83,14 +84,14 @@ _Ray::Intersect(const BoundingVolume& boundingVolume) const
        if(boundingVolume.GetType() == BOUNDING_VOLUME_TYPE_AABB)
        {
                _Math::Vector3 center = boundingVolume._pBoundingVolumeImpl->GetCenter();
-               _Math::Vector3 centerOrigin = center - Position;
+               _Math::Vector3 centerOrigin = center - position;
                _Math::Vector3 halfSize = boundingVolume._pBoundingVolumeImpl->GetHalfSize();
 
                _Math::Vector3 normals[axisCount] = {_Math::Vector3(1.0f, 0.0f, 0.0f), _Math::Vector3(0.0f, 1.0f, 0.0f), _Math::Vector3(0.0f, 0.0f, 1.0f)};
                for(int i = 0; i < axisCount; ++i)
                {
                        float e = normals[i].Dot(centerOrigin);
-                       float f = normals[i].Dot(Direction);
+                       float f = normals[i].Dot(direction);
 
                        if (abs(f) > std::numeric_limits<float>::epsilon())
                        {
@@ -141,16 +142,16 @@ _Ray::Intersect(const BoundingVolume& boundingVolume) const
 
                c.Set(center.x, center.y, center.z);
 
-               c = Position - c;
+               c = position - c;
 
-               underRoot = DotProduct(Direction,c) * DotProduct(Direction,c) - DotProduct(c,c) - r * r;
+               underRoot = DotProduct(direction,c) * DotProduct(direction,c) - DotProduct(c,c) - r * r;
 
                if(underRoot < 0.0f)
                {
                        return std::make_pair(false, tMax);
                }
 
-               tMax = -DotProduct(Direction,c) - sqrt(underRoot);
+               tMax = -DotProduct(direction,c) - sqrt(underRoot);
 
                return std::make_pair(true, tMax);
        }
@@ -160,10 +161,10 @@ _Ray::Intersect(const BoundingVolume& boundingVolume) const
 
 
 void
-_Ray::print()
+_Ray::print(void)
 {
-       AppLog("Pos %.3f %.3f %.3f", Position.x, Position.y, Position.z);
-       AppLog("Dir %.3f %.3f %.3f", Direction.x, Direction.y, Direction.z);
+       AppLog("Pos %.3f %.3f %.3f", position.x, position.y, position.z);
+       AppLog("Dir %.3f %.3f %.3f", direction.x, direction.y, direction.z);
 }
 
 _Math::Vector3
@@ -201,24 +202,33 @@ _Ray::MakeRayLocal(const _Ray globalRay, const FloatMatrix4& toTop)
 {
        //make from top matrix
        //_Math::Matrix4 fromTop( &(pVEImpl->GetMatrixToTop().matrix[0][0]) );
-       _Math::Matrix4 fromTop(&(toTop.matrix[0][0]));
-       fromTop.Transpose();
-       fromTop.Inverse();
-
-       //_Math::Matrix4 fromTop( &(pVEImpl->GetMatrixFromTop().matrix[0][0]) );
-
-       //Transpose to convert into Matrix4
-       //fromTop.Transpose();
-       //Invert to convert from toTop to FfromTop
-       //fromTop.Inverse();
-
-       Position = fromTop * globalRay.Position;
-
-       //because Mat4 * vec3 treats vec3 as point
-       _Math::Vector4 direction(globalRay.Direction.x, globalRay.Direction.y, globalRay.Direction.z, 0.0f);
-       _Math::Vector4 directionT = fromTop * direction;
-
-       Direction.Set(directionT.x, directionT.y, directionT.z);
+//     _Math::Matrix4 fromTop(&(toTop.matrix[0][0]));
+//     fromTop.Transpose();
+//     fromTop.Inverse();
+//
+//     //_Math::Matrix4 fromTop( &(pVEImpl->GetMatrixFromTop().matrix[0][0]) );
+//
+//     //Transpose to convert into Matrix4
+//     //fromTop.Transpose();
+//     //Invert to convert from toTop to FfromTop
+//     //fromTop.Inverse();
+//
+//     Position = fromTop * globalRay.Position;
+//
+//     //because Mat4 * vec3 treats vec3 as point
+//     _Math::Vector4 direction(globalRay.Direction.x, globalRay.Direction.y, globalRay.Direction.z, 0.0f);
+//     _Math::Vector4 directionT = fromTop * direction;
+//
+//     Direction.Set(directionT.x, directionT.y, directionT.z);
+
+       FloatMatrix4 fromTop(toTop);
+       _MatrixUtilInvert(fromTop);
+
+       position = globalRay.position;
+       direction = globalRay.direction;
+
+       _MatrixUtilTransform(fromTop, &position.x, &position.y, &position.z);
+       _MatrixUtilTransformDirection(fromTop, &direction.x, &direction.y, &direction.z);
 
        return *this;
 }
@@ -239,6 +249,8 @@ _Ray::MakeRayGlobal(const _VisualElementImpl* pVEImpl, FloatPoint point)
 
        _Math::Vector3 screenNear = ConvertScreenToWorld(_Math::Vector3(absPoint.x, absPoint.y, 0.0f), pvInv, frame);
        _Math::Vector3 screenFar = ConvertScreenToWorld(_Math::Vector3(absPoint.x, absPoint.y, 1.0f), pvInv, frame);
+//     _Math::Vector3 screenNear = ConvertScreenToWorld(_Math::Vector3(point.x, point.y, 0.0f), pvInv, frame);
+//     _Math::Vector3 screenFar = ConvertScreenToWorld(_Math::Vector3(point.x, point.y, 1.0f), pvInv, frame);
 
        Set(screenNear, screenFar - screenNear);
 
@@ -253,16 +265,29 @@ _Ray::CreatePVInv(const _VisualElementImpl* pRootVe, _Math::Matrix4& pvInv, Floa
        Tizen::Graphics::FloatRectangle bounds = pLayer->GetBounds();
 
        frame = bounds;
-       frame.x = 0.0f;
-       frame.y = 0.0f;
-
-       _Matrix4f viewport;
-       viewport.MakeOrthogonal(0.0f, bounds.width, 0.0f, bounds.height, -bounds.height, bounds.height);
-       viewport.Translate(0.0f, bounds.height, 0.0f);
-       viewport.Scale(1.0f, -1.0f, 1.0f);
-
-       pvInv.Set(viewport.GetItems());
-       pvInv.Inverse();
+//     frame.x = 0.0f;
+//     frame.y = 0.0f;
+
+//     _Matrix4f viewport;
+//     viewport.MakeOrthogonal(0.0f, bounds.width, 0.0f, bounds.height, -bounds.height, bounds.height);
+//     viewport.Translate(0.0f, bounds.height, 0.0f);
+//     viewport.Scale(1.0f, -1.0f, 1.0f);
+//
+//     pvInv.Set(viewport.GetItems());
+//     pvInv.Inverse();
+//     pvInv.Transpose();
+
+       _Matrix4f view = pRoot->GetViewMatrix();
+
+       _Matrix4f viewProjection = pRoot->GetProjectionMatrix();
+       viewProjection.MultiplyMatrix(view);
+       viewProjection.Translate(0.0f, bounds.height, 0.0f);
+       viewProjection.Scale(1.0f, -1.0f, 1.0f);
+
+       FloatMatrix4 pvTizenInv;
+       viewProjection.CopyTo(pvTizenInv);
+       _MatrixUtilInvert(pvTizenInv);
+       pvInv.Set(&pvTizenInv.matrix[0][0]);
        pvInv.Transpose();
 
        return true;
index 3f2a0fd..6ba2b23 100644 (file)
@@ -69,8 +69,8 @@ public:
        bool CreatePVInv(const _VisualElementImpl* pRootVe, _Math::Matrix4& pvInv, Tizen::Graphics::FloatRectangle& frame);
        _Math::Vector3 ConvertScreenToWorld(const _Math::Vector3& screen, const _Math::Matrix4& pvInv, const Tizen::Graphics::FloatRectangle& frame);
 
-       _Math::Vector3 Position;
-       _Math::Vector3 Direction;
+       _Math::Vector3 position;
+       _Math::Vector3 direction;
 };
 
 
index f49379a..3135794 100644 (file)
@@ -291,20 +291,20 @@ public:
 
     std::pair<bool, float> IntersectsPlane()
     {
-        float rayOnNormal = Normal.Dot(Ray.Direction);
+        float rayOnNormal = Normal.Dot(Ray.direction);
                if (_Abs(rayOnNormal) < std::numeric_limits<float>::epsilon())
                {
                return make_pair(false, 0.0f);
         }
 
-        T = (Distance - Normal.Dot(Ray.Position)) / (Normal.Dot(Ray.Direction));
+        T = (Distance - Normal.Dot(Ray.position)) / (Normal.Dot(Ray.direction));
 
         return make_pair(true, T);
     }
 
     std::pair<bool, _Math::Vector3> IntersectsTriangle()
     {
-       _Math::Vector3 pP = Ray.Position + Ray.Direction * T;
+       _Math::Vector3 pP = Ray.position + Ray.direction * T;
                _Math::Vector3 normalAbs(_Abs(Normal.x), _Abs(Normal.y), _Abs(Normal.z));
 
         maxInd = 0;
@@ -353,8 +353,8 @@ private:
 _VisualElementImpl::_VisualElementImpl(VisualElement& element)
        : _zOrderGroup(Z_ORDER_GROUP_NORMAL)
        , __boundingVolume()
-       , __globalRay(_Math::Vector3(0.0f),_Math::Vector3(0.0f))
-       , __hasGlobalRay(false)
+//     , __globalRay(_Math::Vector3(0.0f),_Math::Vector3(0.0f))
+//     , __hasGlobalRay(false)
        , __nearestDistance(std::numeric_limits<float>::infinity())
        , __pNearestVEImpl(null)
        , __pSharedData(null)
@@ -418,8 +418,8 @@ _VisualElementImpl::_VisualElementImpl(VisualElement& element)
 _VisualElementImpl::_VisualElementImpl(VisualElement& presentation, _VisualElementImpl& modelImpl)
        : _zOrderGroup(modelImpl._zOrderGroup)
        , __boundingVolume()
-       , __globalRay(_Math::Vector3(0.0f),_Math::Vector3(0.0f))
-       , __hasGlobalRay(false)
+//     , __globalRay(_Math::Vector3(0.0f),_Math::Vector3(0.0f))
+//     , __hasGlobalRay(false)
        , __nearestDistance(std::numeric_limits<float>::infinity())
        , __pNearestVEImpl(null)
        , __pSharedData(null)
@@ -4694,7 +4694,7 @@ _VisualElementImpl::AddChild(_VisualElementImpl& child)
        if (converted.GetState() == BOUNDING_VOLUME_STATE_VALID)
        {
                converted.Transform(child.GetMatrixToSuper());
-               GetBoundingVolume().Merge(converted);
+               __boundingVolume.Merge(converted);
                __MergeParentsBV();
        }
 
@@ -4824,7 +4824,7 @@ _VisualElementImpl::InsertChild(_VisualElementImpl& child, const _VisualElementI
        if (converted.GetState() == BOUNDING_VOLUME_STATE_VALID)
        {
                converted.Transform(child.GetMatrixToSuper());
-               GetBoundingVolume().Merge(converted);
+               __boundingVolume.Merge(converted);
                __MergeParentsBV();
        }
 
@@ -5560,7 +5560,6 @@ _VisualElementImpl::GetDrawableRect(FloatRectangle& bounds) const
        bounds.SetBounds(0.0f, 0.0f, __bounds.width, __bounds.height);
 }
 
-
 float
 _VisualElementImpl::GetOpacityFromRoot(void) const
 {
@@ -6918,10 +6917,19 @@ _VisualElementImpl::GetRenderObjectProperty(const Tizen::Base::String& property)
        return Variant();
 }
 
-
 int
 _VisualElementImpl::HitTestI(const FloatPoint& point)
 {
+       //make gloabl ray
+       _Ray globalRay;
+       globalRay.MakeRayGlobal(this,point);
+
+       return HitTestI(point, globalRay);
+}
+
+int
+_VisualElementImpl::HitTestI(const FloatPoint& point, const _Ray& globalRay)
+{
        if (!IsVisibleI())
        {
                return HITTEST_NOWHERE;
@@ -6960,77 +6968,37 @@ _VisualElementImpl::HitTestI(const FloatPoint& point)
        }
        else // mesh is assigned - do 3D HitTest
        {
-               if (__hasGlobalRay == false) //VE have no local ray, create
-               {
-                       //make gloabl ray
-                       __globalRay.MakeRayGlobal(this,point);
-                       //__hasGlobalRay = true;
-               }
-
-               //hit VE mesh box?
-
-               //create global BoundingVolume
-               //get toTop matrix
-               static BoundingVolume globalVolume;//(pMesh->GetBoundingVolume());
-               if (pMesh->GetBoundingVolume().GetState() != BOUNDING_VOLUME_STATE_VALID)
-               {
-                       pMesh->AdjustBoundingVolume(true);
-               }
-               globalVolume = pMesh->GetBoundingVolume();
-
-               //GLNode - dravable so has an actual animated coordinates of drawed conext
-               _GlNode* pNode = dynamic_cast< _GlNode* >(this->GetNativeNode());
-               if (pNode != null)
-               {
-                       globalVolume.Transform(pNode->__transform);
-               }
-               else
-               {
-                       globalVolume.Transform(GetMatrixToTop());
-               }
-               //hope presentation works
-               //globalVolume.Transform(GetPresentation()->GetMatrixToTop());
+               _Ray localRay;
+               localRay.MakeRayLocal(globalRay, this->GetRenderObject()->GetMatrixToTop()); //make local ray for mesh
 
-               
 
-               std::pair<bool, float> intersect = __globalRay.Intersect(globalVolume);
+               std::pair<bool, float> intersect = localRay.Intersect(pMesh->GetBoundingVolume());
 
                if (intersect.first) // box intersected
                {
                        //hit VE mesh triangles?
                        Intersections intesections;
 
-                       //create local ray to intersect triangles in mesh
-                       _Ray localRay;
-                       localRay.MakeRayLocal(__globalRay, (pNode != null)?pNode->__transform:GetMatrixToTop()); //make local ray for mesh
-                       //hope presentation works
-                       //localRay.MakeRayLocal(__globalRay,GetPresentation()->GetMatrixToTop()); //make local ray for mesh
-
                        if (!__SearchTriangleIntersection(localRay, pMesh, intesections, true)) //get all intersected triangle
                        {
                                //no triangles intercected
                                return HITTEST_NOWHERE;
                        }
-
-                       if (__hasGlobalRay == true)
+                       //find nearest intersection
+                       DistToPoint nearestIntersection = *intesections.begin();
+                       for (Intersections::iterator it = ++intesections.begin(); it != intesections.end(); it++)
                        {
-                               //find nearest intersection
-                               DistToPoint nearestIntersection = *intesections.begin();
-                               for (Intersections::iterator it = ++intesections.begin(); it != intesections.end(); it++)
-                               {
-                                       if (it->first < nearestIntersection.first)
-                                       {
-                                               nearestIntersection = *it;
-                                       }
-                               }
-                               //test if nearest intersection in this mesh are closer than previously founded
-                               if (__nearestDistance > nearestIntersection.first)
+                               if (it->first < nearestIntersection.first)
                                {
-                                       __nearestDistance = nearestIntersection.first;
-                                       __pNearestVEImpl = this;
+                                       nearestIntersection = *it;
                                }
                        }
-
+                       //test if nearest intersection in this mesh are closer than previously founded
+                       if (__nearestDistance > nearestIntersection.first)
+                       {
+                               __nearestDistance = nearestIntersection.first;
+                               __pNearestVEImpl = this;
+                       }
                }
                else // box not intersected
                {
@@ -7043,7 +7011,7 @@ _VisualElementImpl::HitTestI(const FloatPoint& point)
 }
 
 _VisualElementImpl*
-_VisualElementImpl::GetChildAtPointI(const FloatPoint& point, int parentHitTest)
+_VisualElementImpl::GetChildAtPointI(const FloatPoint& point, const _Ray& globalRay, int parentHitTest)
 {
        _VisualElementImpl* pHitTarget = null;
        FloatPoint hitPoint = point;
@@ -7053,32 +7021,12 @@ _VisualElementImpl::GetChildAtPointI(const FloatPoint& point, int parentHitTest)
        //but animations can be provided so do not do this
        if (false)
        {
-               if (__hasGlobalRay == false) //VE have no local ray, create
-               {
-                       //make gloabl ray
-                       __globalRay.MakeRayGlobal(this,point);
-                       __hasGlobalRay = true;
-               }
-
                //hit VE mesh box?
 
-               //create global BoundingVolume
-               //get toTop matrix
-               static BoundingVolume globalVolume;//(pMesh->GetBoundingVolume());
-               globalVolume = GetBoundingVolume();
-
-               //GLNode - dravable so has an actual animated coordinates of drawed conext
-               _GlNode* pNode = dynamic_cast< _GlNode* >(this->GetNativeNode());
-               if (pNode != null)
-               {
-                       globalVolume.Transform(pNode->__transform);
-               }
-               else
-               {
-                       globalVolume.Transform(GetMatrixToTop());
-               }
+               _Ray localRay;
+               localRay.MakeRayLocal(globalRay, this->GetRenderObject()->GetTransformMatrix());
 
-               std::pair<bool, float> intersect = __globalRay.Intersect(globalVolume);
+               std::pair<bool, float> intersect = localRay.Intersect(GetBoundingVolume());
 
                if (!intersect.first) // box not intersected
                {
@@ -7087,7 +7035,7 @@ _VisualElementImpl::GetChildAtPointI(const FloatPoint& point, int parentHitTest)
        }
 
 
-       hitTest = VE_DELEGATE(this, InvokeHitTest, point);
+       hitTest = VE_DELEGATE(this, InvokeHitTest, point, globalRay);
        if ((hitTest & HITTEST_MATCH) != 0)
        {
                // passed hittest
@@ -7108,23 +7056,11 @@ _VisualElementImpl::GetChildAtPointI(const FloatPoint& point, int parentHitTest)
                        FloatPoint childHitPoint = point;
                        pChild->ConvertCoordinates(childHitPoint, this);
 
-                       //make local ray for child
-                       if (__hasGlobalRay)
-                       {
-                               pChild->__globalRay.Set(__globalRay);
-                               pChild->__hasGlobalRay = true;
-                       }
-
                        //Clear nearest searching parameters for child
                        pChild->__pNearestVEImpl = null;
                        pChild->__nearestDistance = std::numeric_limits<float>::infinity();
 
-                       _VisualElementImpl* pChildHitTarget = pChild->GetChildAtPointI(childHitPoint, hitTest);
-                       //remove local ray for child
-                       if (__hasGlobalRay)
-                       {
-                               pChild->__hasGlobalRay = false;
-                       }
+                       _VisualElementImpl* pChildHitTarget = pChild->GetChildAtPointI(childHitPoint, globalRay, hitTest);
 
 //                     if (pChildHitTarget)
 //                     {
@@ -7172,17 +7108,15 @@ _VisualElementImpl*
 _VisualElementImpl::GetChildAt(const FloatPoint& point)
 {
        //make gloabl ray
-       __globalRay.MakeRayGlobal(this,point);
+       _Ray globalRay;
+       globalRay.MakeRayGlobal(this,point);
 
        //Clear nearest-searching parameters for root
        __pNearestVEImpl = null;
        __nearestDistance = std::numeric_limits<float>::infinity();
-       __hasGlobalRay = true;
 
-       _VisualElementImpl* pHitTarget = GetChildAtPointI(point, HITTEST_MATCH);
+       _VisualElementImpl* pHitTarget = GetChildAtPointI(point, globalRay, HITTEST_MATCH);
 
-       //remove local ray
-       __hasGlobalRay = false;
 
        if (unlikely(!pHitTarget))
        {
@@ -8413,12 +8347,15 @@ _VisualElementImpl::SetBoundsChangedCallback(BoundsChangedCallback pCallback, vo
 result
 _VisualElementImpl::SetMesh(Mesh* pMesh)
 {
-       pMesh->AdjustBoundingVolume();
-
        Mesh* pOldMesh = GetSharedData().geometry.GetMesh();
 
        GetSharedData().geometry.SetMesh(pMesh);
 
+
+       if (pMesh != null)
+       {
+               pMesh->AdjustBoundingVolume();
+       }
        //merge BV
        if (pOldMesh != null)
        {
@@ -8430,7 +8367,7 @@ _VisualElementImpl::SetMesh(Mesh* pMesh)
                if (pMesh != null)
                {
                        //Only merge new mesh if it is first
-                       GetBoundingVolume().Merge(pMesh->GetBoundingVolume());
+                       __boundingVolume.Merge(pMesh->GetBoundingVolume());
                        __MergeParentsBV();
                }
        }
@@ -8500,6 +8437,19 @@ _VisualElementImpl::SetShaderProgram(ShaderProgram* pShaderProgram)
        return GetSharedData().geometry.SetShaderProgram(pShaderProgram);
 }
 
+ShaderProgram*
+_VisualElementImpl::GetShaderProgramN(void) const
+{
+       ShaderProgram* pShaderProgram = GetSharedData().geometry.GetShaderProgram();
+
+       if (pShaderProgram != null)
+       {
+               return new (std::nothrow) ShaderProgram(*pShaderProgram);
+       }
+
+       return null;
+}
+
 bool
 CompareIntersections(const DistToPoint& dp0, const DistToPoint& dp1)
 {
@@ -8717,7 +8667,7 @@ _VisualElementImpl::__SearchTriangleIntersection(const _Ray& localRay, const Mes
 void
 _VisualElementImpl::__AdjustBVWithChildren()
 {
-       GetBoundingVolume().Reset();
+       __boundingVolume.Reset();
 
        int count = __children.GetCount();
        _VisualElementImpl* pChild;
@@ -8726,7 +8676,7 @@ _VisualElementImpl::__AdjustBVWithChildren()
        Mesh* pMesh = GetSharedData().geometry.GetMesh();
        if (pMesh != null)
        {
-               GetBoundingVolume().Merge(pMesh->GetBoundingVolume());
+               __boundingVolume.Merge(pMesh->GetBoundingVolume());
        }
        //children BV add
        for (int i = 0; i < count; i++)
@@ -8738,7 +8688,7 @@ _VisualElementImpl::__AdjustBVWithChildren()
                        if (converted.GetState() == BOUNDING_VOLUME_STATE_VALID)
                        {
                                converted.Transform(pChild->GetMatrixToSuper());
-                               GetBoundingVolume().Merge(converted);
+                               __boundingVolume.Merge(converted);
                        }
                }
        }
@@ -8753,12 +8703,12 @@ _VisualElementImpl::__AdjustParentsBV()
 
        while(pVEImplParent != null && pVEImplParent != pVEImplChild)
        {
-               pVEImplParent->GetBoundingVolume().Reset();
+               pVEImplParent->__boundingVolume.Reset();
                //Mesh BV add
                Mesh* pMesh = pVEImplParent->GetSharedData().geometry.GetMesh();
                if (pMesh != null)
                {
-                       pVEImplParent->GetBoundingVolume().Merge(pMesh->GetBoundingVolume());
+                       pVEImplParent->__boundingVolume.Merge(pMesh->GetBoundingVolume());
                }
                //Children BV add
                int count = pVEImplParent->__children.GetCount();
@@ -8772,7 +8722,7 @@ _VisualElementImpl::__AdjustParentsBV()
                                if (converted.GetState() == BOUNDING_VOLUME_STATE_VALID)
                                {
                                        converted.Transform(pChild->GetMatrixToSuper());
-                                       pVEImplParent->GetBoundingVolume().Merge(converted);
+                                       pVEImplParent->__boundingVolume.Merge(converted);
                                }
                        }
                }
@@ -8794,7 +8744,7 @@ _VisualElementImpl::__MergeParentsBV()
                if (converted.GetState() == BOUNDING_VOLUME_STATE_VALID)
                {
                        converted.Transform(pVEImplChild->GetMatrixToSuper());
-                       pVEImplParent->GetBoundingVolume().Merge(converted);
+                       pVEImplParent->__boundingVolume.Merge(converted);
                }
 
                pVEImplChild = pVEImplParent;
@@ -8803,7 +8753,7 @@ _VisualElementImpl::__MergeParentsBV()
 }
 
 result
-_VisualElementImpl::AdjustBoundingVolume()
+_VisualElementImpl::AdjustBoundingVolume(void)
 {
        result r = E_SUCCESS;
 
@@ -8813,8 +8763,8 @@ _VisualElementImpl::AdjustBoundingVolume()
        return r;
 }
 
-BoundingVolume&
-_VisualElementImpl::GetBoundingVolume()
+const BoundingVolume&
+_VisualElementImpl::GetBoundingVolume(void) const
 {
        return __boundingVolume;
 }
@@ -8873,7 +8823,10 @@ _VisualElementImpl::GetChildListAtN(const Tizen::Graphics::FloatPoint& point)
        pairList.Construct();
        pairList.RemoveAll();
 
-       GetChildListAtI(point, pairList);
+       _Ray globalRay;
+       globalRay.MakeRayGlobal(this, point);
+
+       GetChildListAtI(point, globalRay, pairList);
 
        //sort by float
        Tizen::Base::Collection::IComparerT< Tizen::Base::Collection::MapEntryT< float, VisualElement* > >* pPairComparer = new IntersectedPairComparer();
@@ -8904,7 +8857,7 @@ _VisualElementImpl::GetChildListAtN(const Tizen::Graphics::FloatPoint& point)
 }
 
 result
-_VisualElementImpl::GetChildListAtI(const Tizen::Graphics::FloatPoint point, Tizen::Base::Collection::ArrayListT < Tizen::Base::Collection::MapEntryT < float, VisualElement* > >& pairList)
+_VisualElementImpl::GetChildListAtI(const Tizen::Graphics::FloatPoint point, const _Ray& globalRay, Tizen::Base::Collection::ArrayListT < Tizen::Base::Collection::MapEntryT < float, VisualElement* > >& pairList)
 {
        int count = __children.GetCount();
        _VisualElementImpl* pChild = null;
@@ -8922,12 +8875,12 @@ _VisualElementImpl::GetChildListAtI(const Tizen::Graphics::FloatPoint point, Tiz
                        pChild->__pNearestVEImpl = null;
                        pChild->__nearestDistance = std::numeric_limits<float>::infinity();
 
-                       if (pChild->HitTestI(localPoint) == HITTEST_MATCH)
+                       if (pChild->HitTestI(localPoint, globalRay) == HITTEST_MATCH)
                        {
                                pairList.Add(Tizen::Base::Collection::MapEntryT < float, VisualElement* >(pChild->__nearestDistance, pChild->GetPublic()) );
                        }
 
-                       pChild->GetChildListAtI(localPoint, pairList);
+                       pChild->GetChildListAtI(localPoint, globalRay, pairList);
                }
        }
 
@@ -8937,7 +8890,8 @@ _VisualElementImpl::GetChildListAtI(const Tizen::Graphics::FloatPoint point, Tiz
 Tizen::Base::Collection::IList*
 _VisualElementImpl::GetChildListAtN(const Tizen::Graphics::FloatRectangle& selection, VisualElement::SelectionMode mode)
 {
-
+       if (selection.width <= 0.0f || selection.height <= 0.0f)
+               return null;
        int j;
 
        //make global selection
@@ -9146,6 +9100,12 @@ _VisualElementImpl::InvokeOnDestructing(void)
 }
 
 int
+_VisualElementImpl::InvokeHitTest(const Tizen::Graphics::FloatPoint& point, const _Ray& globalRay)
+{
+       return HitTestI(point, globalRay);
+}
+
+int
 _VisualElementImpl::InvokeHitTest(const Tizen::Graphics::FloatPoint& point)
 {
        int hitTest = _VisualElementImpl::HITTEST_NOWHERE;
index 329653b..13ac305 100644 (file)
@@ -99,10 +99,7 @@ public:
 
        result AdjustBoundingVolume(bool rebuild);
        BoundingVolume& GetBoundingVolume(void);
-//     Tizen::Graphics::FloatPoint3 GetBoundingBoxPosition(void) const;
-//     float GetBoundingBoxVolume(void) const;
-//     float GetBoundingBoxWidth(void) const;
-//     float GetBoundingBoxHeight(void) const;
+
 
        // 임시 함수
        result AllocVertices(int count);
@@ -162,8 +159,12 @@ public:
        virtual result SetProperty(const Tizen::Base::String& name, const Variant& value);
        virtual Variant GetProperty(const Tizen::Base::String& name) const;
 
+       std::string GetName(void) const
+       {
+               return __name;
+       }
 
-       result SaveMeshToBin(const Tizen::Base::String& fileName);
+       result SaveMeshToBinary(const Tizen::Base::String& fileName);
 
        MeshController* CreateMeshController(_JointImpl* pRootJoint, const Tizen::Graphics::FloatMatrix4& bindShapeMatrix);
 
@@ -194,13 +195,6 @@ private:
        int __countOfIndex;
        int __countOfAllocatedIndex;
 
-       // bounding box
-//     Tizen::Graphics::FloatPoint3 __boundingBox;
-//     float __boundingBoxVolume;
-//     float __boundingBoxWidth;
-//     float __boundingBoxHeight;
-//
-       bool __hasBoundingVolume;
        BoundingVolume __boundingVolume;
 
        // temp pos
index 4814fac..998fa57 100644 (file)
@@ -775,6 +775,16 @@ public:
         */
        int HitTestI(const Tizen::Graphics::FloatPoint& point);
 
+       /**
+        * The hit testing by 3D meshes and 2D controls by bounds.
+        *
+        * @since               3.0
+        * @return              hit test result.
+        * @param[in]   point   hit test position.
+        * @see                 InvokeHitTest()
+        */
+       int HitTestI(const Tizen::Graphics::FloatPoint& point, const _Ray& globalRay);
+
 
        /**
         * The creating animation for the property.
@@ -806,7 +816,7 @@ public:
        Material* GetMaterialN(void) const;
 
        result SetShaderProgram(ShaderProgram* pShaderProgram);
-       ShaderProgram* GetShaderProgram(void) const;
+       ShaderProgram* GetShaderProgramN(void) const;
 
 
 protected:
@@ -1195,6 +1205,15 @@ private:
        void InvokeOnBoundsChanged(const Tizen::Graphics::FloatRectangle& oldBounds);
 
        /**
+        * For checking that point is in the VisualElement region or in region of it's meshes.
+        *
+        * @since               3.0
+        * @param[in]   point                           the point to check in self coordinate system.
+        *
+        */
+       int InvokeHitTest(const Tizen::Graphics::FloatPoint& point, const _Ray& globalRay);
+
+       /**
         * For checking that point is in the VisualElement region.
         *
         * @since               2.0
@@ -1233,9 +1252,11 @@ private:
        void  GetDrawableRect(Tizen::Graphics::FloatRectangle& bounds) const;
 
        const Tizen::Graphics::FloatRectangle& GetBoundingBoxI(void) const;
+public:
        const Tizen::Graphics::FloatMatrix4& GetMatrixToSuper(void) const;
        const Tizen::Graphics::FloatMatrix4& GetMatrixToTop(void) const;
        const Tizen::Graphics::FloatMatrix4& GetMatrixFromTop(void) const;
+private:
        Tizen::Graphics::FloatMatrix4 CalcMatrixToBase(const _VisualElementImpl& base) const;
        const Tizen::Graphics::FloatMatrix4& GetMatrixToClipSource(void) const;
 
@@ -1279,7 +1300,7 @@ private:
        int GetZOrderGroupIndex(int orderGroup, int& begin, int& end) const;
        result ChangeZOrder(_VisualElementImpl& child, const _VisualElementImpl* pReference, bool above, int zorderGroup);
 
-       _VisualElementImpl* GetChildAtPointI(const Tizen::Graphics::FloatPoint& point, int parentHitTest);
+       _VisualElementImpl* GetChildAtPointI(const Tizen::Graphics::FloatPoint& point, const _Ray& globalRay, int parentHitTest);
 
        result AddAnimationI(const Tizen::Base::String* pKeyName, VisualElementAnimation& animation);
        result AddAnimationGroupI(const Tizen::Base::String* pKeyName, VisualElementAnimation& animation);
@@ -1298,11 +1319,11 @@ private:
 
        //Visual Element Bounding volume related
        result AdjustBoundingVolume(void);
-       BoundingVolume& GetBoundingVolume(void);
+       const BoundingVolume& GetBoundingVolume(void) const;
 
        //Picking instruments
        Tizen::Base::Collection::IList* GetChildListAtN(const Tizen::Graphics::FloatPoint& point);
-       result GetChildListAtI(const Tizen::Graphics::FloatPoint point, Tizen::Base::Collection::ArrayListT<Tizen::Base::Collection::MapEntryT < float, VisualElement* > >& pairList);
+       result GetChildListAtI(const Tizen::Graphics::FloatPoint point, const _Ray& globalRay, Tizen::Base::Collection::ArrayListT<Tizen::Base::Collection::MapEntryT < float, VisualElement* > >& pairList);
        Tizen::Base::Collection::IList* GetChildListAtN(const Tizen::Graphics::FloatRectangle& selection, VisualElement::SelectionMode mode);
        result GetSelectedI(const Tizen::Ui::Animations::_Selection& selection, VisualElement::SelectionMode mode, Tizen::Base::Collection::IList& list);
 
@@ -1387,8 +1408,8 @@ private:
        //Visual Element Bounding volume related
        BoundingVolume __boundingVolume;
 
-       _Ray __globalRay;
-       bool __hasGlobalRay;
+//     _Ray __globalRay;
+//     bool __hasGlobalRay;
        float __nearestDistance;
        _VisualElementImpl*  __pNearestVEImpl;