1) _ShaderProgramImpl is inherited from RefObject; 2) SetUniform(), BindAttribute...
authorm.kucher <m.kucher@samsung.com>
Thu, 3 Oct 2013 15:01:29 +0000 (18:01 +0300)
committerm.kucher <m.kucher@samsung.com>
Thu, 3 Oct 2013 15:01:29 +0000 (18:01 +0300)
Change-Id: I9fe74d56c03d251b65d9d086598a0cde2977b21a
Signed-off-by: m.kucher <m.kucher@samsung.com>
27 files changed:
inc/FUiAnimLight.h
inc/FUiAnimMaterial.h
inc/FUiAnimScene.h
inc/FUiAnimShaderProgram.h
inc/FUiAnimVisualElement.h
src/ui/animations/FUiAnimScene.cpp
src/ui/animations/FUiAnimShaderProgram.cpp
src/ui/animations/FUiAnimVisualElement.cpp
src/ui/animations/FUiAnim_GeometryInfo.cpp
src/ui/animations/FUiAnim_GlRenderManager.cpp
src/ui/animations/FUiAnim_GlRenderManager.h
src/ui/animations/FUiAnim_GlShaderProgram.cpp
src/ui/animations/FUiAnim_GlShaderProgram.h
src/ui/animations/FUiAnim_MeshImpl.cpp
src/ui/animations/FUiAnim_ModelImporterImpl.cpp
src/ui/animations/FUiAnim_Ray.cpp
src/ui/animations/FUiAnim_Ray.h
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/animations/math/FUiAnim_MathMatrix4.cpp
src/ui/inc/FUiAnim_LightImpl.h
src/ui/inc/FUiAnim_MaterialImpl.h
src/ui/inc/FUiAnim_MeshImpl.h
src/ui/inc/FUiAnim_SceneImpl.h
src/ui/inc/FUiAnim_VisualElementImpl.h

index 9af6d47..0e7097f 100644 (file)
@@ -31,7 +31,7 @@ public:
        /**
         * Get light type.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @return              Type of the light.
         * @see                 SetType().
@@ -42,7 +42,7 @@ public:
        /**
         * Sets light type.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @param[]             lightType       Type of the light.
         * @see                 GetLightType().
@@ -52,7 +52,7 @@ public:
        /**
         * Get light diffuse.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @return              Diffuse of the light.
         * @see                 SetDiffuse().
@@ -62,7 +62,7 @@ public:
        /**
         * Sets light diffuse color.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @param[]             diffuse Diffuse color of the light.
         * @see                 GetDiffuse().
@@ -72,7 +72,7 @@ public:
        /**
         * Get light specular.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @return              Specular of the light.
         * @see                 SetSpecular().
@@ -83,7 +83,7 @@ public:
        /**
         * Sets light specular.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @param[]             specular        Type of the light.
         * @see                 GetSpecular().
@@ -93,7 +93,7 @@ public:
        /**
         * Get light ambient.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @return              Ambient of the light.
         * @see                 SetAmbient().
@@ -104,7 +104,7 @@ public:
        /**
         * Sets light ambient.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @param[]             ambient Ambient of the light.
         * @see                 GetAmbient().
@@ -114,7 +114,7 @@ public:
        /**
         * Get light position.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @return              Position of the light.
         * @see                 SetPosition().
@@ -125,7 +125,7 @@ public:
        /**
         * Sets light position.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @param[]             position        Position of the light.
         * @see                 GetPosition().
@@ -135,7 +135,7 @@ public:
        /**
         * Get light direction.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @return              Direction of the light.
         * @see                 SetDirection().
@@ -146,7 +146,7 @@ public:
        /**
         * Sets light direction.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @param[]             lightType       Direction of the light.
         * @see                 GetDirection().
@@ -156,7 +156,7 @@ public:
        /**
         * Get light exponent.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @return              Exponent of the light.
         * @see                 SetExponent().
@@ -167,7 +167,7 @@ public:
        /**
         * Sets light exponent.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @param[]             exponent        Exponent of the light.
         * @see                 SetExponent().
@@ -177,7 +177,7 @@ public:
        /**
         * Get light cut off.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @return              CutOff of the light.
         * @see                 SetCutOff().
@@ -188,7 +188,7 @@ public:
        /**
         * Sets light cut off.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @param[]             cutOff  Cut off of the light.
         * @see                 GetCutOff().
@@ -198,7 +198,7 @@ public:
        /**
         * Get light position.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @return              Position of the light.
         * @see                 SetConstantAttenuation().
@@ -209,7 +209,7 @@ public:
        /**
         * Sets light constant attenuation.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @param[]             attenuation     Constant attenuation of the light.
         * @see                 GetConstantAttenuation().
@@ -219,7 +219,7 @@ public:
        /**
         * Get light linear attenuation.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @return              Linear attenuation of the light.
         * @see                 SetLinearAttenuation().
@@ -230,7 +230,7 @@ public:
        /**
         * Sets light linear attenuation.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @param[]             attenuation     Linear attenuation of the light.
         * @see                 GetLinearAttenuation().
@@ -240,7 +240,7 @@ public:
        /**
         * Get light linear attenuation.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @return              Quadratic attenuation of the light.
         * @see                 SetQuadraticAttenuation().
@@ -250,7 +250,7 @@ public:
        /**
         * Sets light quadratic attenuation.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @param[]             attenuation     Quadratic attenuation of the light.
         * @see                 GetQuadraticAttenuation().
@@ -260,7 +260,7 @@ public:
        /**
         * Get light name.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @return              Name of the light.
         * @see                 SetName().
@@ -271,7 +271,7 @@ public:
        /**
         * Sets light name.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @param[]             name    Name of the light.
         * @see                 GetName().
@@ -281,7 +281,7 @@ public:
        /**
         * Get light enabled status.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @return              true if light is enabled, false - otherwise.
         * @see                 SetEnabled().
@@ -292,7 +292,7 @@ public:
        /**
         * Sets light enable.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @param[]             enables Enable status of the light.
         * @see                 IsEnabled().
@@ -302,7 +302,7 @@ public:
        /**
         * Sets light color.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @param[]             color   Color of the light.
         * @see                 GetColor().
@@ -311,7 +311,7 @@ public:
        /**
         * Get light color.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @return              COlor of the light.
         * @see                 SetColor().
@@ -322,7 +322,7 @@ public:
        /**
         * Sets light intencity.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @param[]             intencity       Intencity of the light.
         * @see                 GetIntencity().
@@ -332,7 +332,7 @@ public:
        /**
         * Get light intencity.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @return              Intencity of the light.
         * @see                 SetIntensity().
@@ -343,7 +343,7 @@ public:
        /**
         * Sets light radius.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @param[]             radius  Radius of the light.
         * @see                 GetRadius().
@@ -352,7 +352,7 @@ public:
        /**
         * Get light radius.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @return              Radius attenuation of the light.
         * @see                 SetRadius().
@@ -363,7 +363,7 @@ public:
        /**
         * Sets light radius of the spot.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @param[]             spotlightRadius Radius of the light spot.
         * @see                 GetSpotlightRadius().
@@ -373,7 +373,7 @@ public:
        /**
         * Get light linear attenuation.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @return              Linear attenuation of the light.
         * @see                 SetSpotlightRaduis().
index f0b3905..50e6160 100644 (file)
@@ -25,7 +25,7 @@ public:
        /**
         * Get material diffuse color.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @return              Diffuse color of the material.
         * @see                 SetDiffuse().
@@ -36,7 +36,7 @@ public:
        /**
         * Sets material diffuse color.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @param[]             diffuse         Diffuse color of the material.
         * @see                 GetDiffuse().
@@ -46,7 +46,7 @@ public:
        /**
         * Get material specular color.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @return              specular color of the material.
         * @see                 SetSpecular().
@@ -57,7 +57,7 @@ public:
        /**
         * Sets material specular color.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @param[]             specular        Specular color of the material.
         * @see                 GetSpecular().
@@ -78,7 +78,7 @@ public:
        /**
         * Sets material ambient color.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @param[]             ambient         Ambient color of the material.
         * @see                 GetAmbient().
@@ -88,7 +88,7 @@ public:
        /**
         * Get material emissive color.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @return              Emissive color of the material.
         * @see                 SetEmissive().
@@ -98,7 +98,7 @@ public:
        /**
         * Sets material emissive color.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @param[]             emissive        Emissive color of the material.
         * @see                 GetEmissive().
@@ -108,7 +108,7 @@ public:
        /**
         * Get emissive power.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @return              emissive power of the material.
         * @see                 SetEmissivePower().
@@ -119,7 +119,7 @@ public:
        /**
         * Sets material emissive power.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @param[]             value           Emissive power of the material.
         * @see                 GetEmissivePower().
@@ -129,7 +129,7 @@ public:
        /**
         * Get material shininess.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @return              shininess of the material.
         * @see                 SetShininess().
@@ -140,7 +140,7 @@ public:
        /**
         * Sets material name.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @param[]             shininess               Shininess of the material.
         * @see                 GetShininess().
@@ -150,7 +150,7 @@ public:
        /**
         * Get material name.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @return              Name of the material.
         * @see                 SetName().
@@ -161,7 +161,7 @@ public:
        /**
         * Sets material name.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @param[]             name    Name of the material.
         * @see                 GetName().
index 8c0deaa..7a747c9 100644 (file)
@@ -42,6 +42,8 @@ public:
        Scene(void);
        virtual ~Scene(void);
 
+       result Construct();
+
        /**
         * Returns pointer to the root element of the scene tree
         *
index 9349178..c07915c 100644 (file)
@@ -74,7 +74,6 @@
 
 namespace Tizen { namespace Ui { namespace Animations
 {
-//class VisualElementSurface;
 
 class _ShaderProgramImpl;
 
@@ -82,6 +81,7 @@ class _OSP_EXPORT_ ShaderProgram
 {
 public:
        ShaderProgram(void);
+       ShaderProgram(const ShaderProgram& shaderProgram);
        virtual ~ShaderProgram(void);
 
        /**
@@ -101,6 +101,22 @@ public:
        result Construct(Shader& vertexShader, Shader& fragmentShader);
 
        /**
+        * Constructs the ShaderProgram using vertexShader and fragmentShader.
+        *
+        * @since 3.0
+        *
+        * @return              An error code
+        *
+        * @param[in]   vertexShader     source code of vertex shader
+        * @param[in]   fragmentShader   source code of fragment shader
+        *
+        * @exception   E_SUCCESS
+        * @exception   E_OUT_OF_MEMORY
+        * @exception   E_SYSTEM if shader was not constructed or compiled with an error
+        */
+       result Construct(const Tizen::Base::String& vertexShader, const Tizen::Base::String& fragmentShader);
+
+       /**
         * Gets the value of uniform by name of the current instance of %ShaderProgram
         *
         * @since 3.0
@@ -130,94 +146,8 @@ public:
         */
        result SetUniform(const Tizen::Base::String& name, const Tizen::Ui::Variant& value);
 
-       /**
-        * Binds an attribute to the ShaderProgram.
-        *
-        * @since 3.0
-        *
-        * @return              An error code
-        *
-        * @param[in]   location        possibly program locations
-        * @param[in]   name            attribute name in shader program
-        *
-        * @exception   E_SUCCESS
-        * @exception   E_INVALID_ARG   if name was not found in shader program
-        * @see         ProgramLocation
-        */
-       //result BindAttribute(ProgramLocation location, const Tizen::Base::String &name);
-
-       /**
-        * Binds the uniform to the ShaderProgram.
-        *
-        * @since 3.0
-        *
-        * @return              An error code
-        *
-        * @param[in]   location        possibly location
-        * @param[in]   name            uniform name in shader program
-        *
-        * @exception   E_SUCCESS
-        * @exception   E_INVALID_ARG   if name was not found in shader program
-        * @see         ProgramLocation
-        */
-       //result BindUniform(ProgramLocation location, const Tizen::Base::String &name);
-
-       /**
-        * Checks the program location for been bind with uniform or attribute in shader program
-        *
-        * @since 3.0
-        *
-        * @return              true, if location is bind, false otherwise
-        *
-        * @param[in]   location        requested location
-        * @see         ProgramLocation
-        */
-       //bool IsParameterAvailable(const ProgramLocation location) const;
-
-       /**
-        * Checks for the uniform or attribute by name in shader program been bind with program location
-        *
-        * @since 3.0
-        *
-        * @return              true, if name is bind, false otherwise
-        *
-        * @param[in]   name    Tizen::Base::String name of the uniform or attribute in shader program
-        */
-       //bool IsParameterAvailable(const Tizen::Base::String& name) const;
-
-       /**
-        * Unbind an attribute from the ShaderProgram.
-        *
-        * @since 3.0
-        *
-        * @return              An error code
-        *
-        * @param[in]   name            attribute name in shader program
-        *
-        * @exception   E_SUCCESS
-        * @exception   E_INVALID_ARG   if name was not found in shader program
-        */
-       //result UnbindUniform(const Tizen::Base::String &name);
-
-       /**
-        * Unbind an uniform from the ShaderProgram.
-        *
-        * @since 3.0
-        *
-        * @return              An error code
-        *
-        * @param[in]   name            attribute name in shader program
-        *
-        * @exception   E_SUCCESS
-        * @exception   E_INVALID_ARG   if name was not found in shader program
-        */
-       //result UnbindAttribute(const Tizen::Base::String &name);
-
-       //void SetUserData(const Tizen::Base::String& name, const Tizen::Ui::Variant& value);
-       //void SetUserSampler(const Tizen::Base::String& name, Tizen::Ui::Animations::VisualElementSurface* pSurface);
 private:
 
-       ShaderProgram(const ShaderProgram& program);
        ShaderProgram& operator =(const ShaderProgram& rhs);
 
        class _ShaderProgramImpl* __pShaderProgramImpl;
index 63e36e7..561efb4 100644 (file)
@@ -38,6 +38,7 @@
 #include <FUiAnimIVisualElementAnimationProvider.h>
 #include <FUiAnimIVisualElementContentProvider.h>
 #include <FUiAnimIVisualElementEventListener.h>
+#include "FUiAnimBoundingVolume.h"
 
 namespace Tizen { namespace Graphics {
 class Canvas;
@@ -1429,7 +1430,7 @@ public:
         * @remarks             If an exception occurs, this method returns @c null.
         * @see                 SetMesh()
         */
-       Mesh* GetMeshN(const Tizen::Base::String& name) const;
+       Mesh* GetMeshN(void) const;
 
        /**
         * Sets the contents of this instance with the specified Material. @n
@@ -1459,7 +1460,7 @@ public:
         * @remarks             If an exception occurs, this method returns @c null.
         * @see                 SetMaterial()
         */
-       Material* GetMaterialN(const Tizen::Base::String& name) const;
+       Material* GetMaterialN(void) const;
 
        /**
         * Sets the contents of this instance with the specified Light. @n
@@ -1489,7 +1490,7 @@ public:
         * @remarks             If an exception occurs, this method returns @c null.
         * @see                 SetLight()
         */
-       Light* GetLightN(const Tizen::Base::String& name) const;
+       Light* GetLightN(void) const;
 
        result SetShaderProgram(ShaderProgram* pShaderProgram);
 
@@ -1506,6 +1507,29 @@ public:
         */
        static result Flush(void);
 
+       //Visual Element Bounding volume related
+       /**
+        * Re adjust %VisualElement's BoundingVolume
+        *
+        * @since               3.0
+        *
+        * @return              An error code
+        * @exception   E_SUCCESS                       The method is successful.
+        * @remarks             Bounding volume automatically adjusts when call SetMesh(), AttachChild() DeattachCild() and InsertChild() methods of VisualElement
+        * @see                 GetBoundingVolume()
+        */
+       result AdjustBoundingVolume();
+       /**
+        * Get %VisualElement's BoundingVolume, Bounding Volume that build merging Visual Element mesh and children Bounding Volumes
+        *
+        * @since               3.0
+        *
+        * @return              BoundingVolume reference
+        * @see                 AdjustBoundingVolume()
+        */
+       BoundingVolume& GetBoundingVolume();
+
+
 
 protected:
        /**
index d1fabca..ce3cdaa 100644 (file)
@@ -40,6 +40,12 @@ Scene::~Scene(void)
        _pSceneImpl = null;
 }
 
+result
+Scene::Construct()
+{
+       return _pSceneImpl->Construct();
+}
+
 VisualElement*
 Scene::GetRootVisualElement(void) const
 {
index 1e99391..d38c743 100644 (file)
@@ -40,12 +40,23 @@ ShaderProgram::ShaderProgram(void)
        : __pShaderProgramImpl(null)
 {
 }
+ShaderProgram::ShaderProgram(const ShaderProgram& shaderProgram)
+       : __pShaderProgramImpl(null)
+{
+       SysAssertf(shaderProgram.__pShaderProgramImpl != null, "Not yet constructed.");
+
+       __pShaderProgramImpl = shaderProgram.__pShaderProgramImpl;
 
+    if(__pShaderProgramImpl != null)
+    {
+       __pShaderProgramImpl->AddRef();
+    }
+}
 ShaderProgram::~ShaderProgram(void)
 {
        if (__pShaderProgramImpl)
        {
-               delete __pShaderProgramImpl;
+                __pShaderProgramImpl->Release();
                __pShaderProgramImpl = null;
        }
 }
@@ -65,6 +76,18 @@ ShaderProgram::Construct(Shader& vertexShader, Shader& fragmentShader)
        return E_SUCCESS;
 }
 
+result
+ShaderProgram::Construct(const Tizen::Base::String& vertexShader, const Tizen::Base::String& fragmentShader)
+{
+       ClearLastResult();
+       SysAssertf(__pShaderProgramImpl == null,
+                                       "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");
+       __pShaderProgramImpl = new (std::nothrow) _ShaderProgramImpl();
+       SysTryReturnResult(NID_UI_ANIM, __pShaderProgramImpl != null, E_OUT_OF_MEMORY, "Memory allocation failed.");
+       result r = __pShaderProgramImpl->Construct(vertexShader, fragmentShader);
+       SysTryReturnResult(NID_UI_ANIM, r == E_SUCCESS, r, "Propagating.");
+       return E_SUCCESS;
+}
 Variant
 ShaderProgram::GetUniform(const Tizen::Base::String& name) const
 {
@@ -74,25 +97,6 @@ ShaderProgram::GetUniform(const Tizen::Base::String& name) const
 
        return __pShaderProgramImpl->GetUniform(name);
 }
-/*
-result
-ShaderProgram::BindAttribute(ProgramLocation location, const Tizen::Base::String &name)
-{
-       SysAssertf(__pShaderProgramImpl != null,
-                                                       "Not yet constructed. Construct() should be called before use.");
-
-       return __pShaderProgramImpl->BindAttribute(location, name);
-}*/
-/*
-result
-ShaderProgram::BindUniform(ProgramLocation location, const Tizen::Base::String &name)
-{
-       SysAssertf(__pShaderProgramImpl != null,
-                                                       "Not yet constructed. Construct() should be called before use.");
-
-       return __pShaderProgramImpl->BindUniform(location, name);
-}
-*/
 
 result
 ShaderProgram::SetUniform(const Tizen::Base::String& name, const Tizen::Ui::Variant& value)
@@ -103,40 +107,5 @@ ShaderProgram::SetUniform(const Tizen::Base::String& name, const Tizen::Ui::Vari
 
        return __pShaderProgramImpl->SetUniform(name, value);
 }
-/*
-bool
-ShaderProgram::IsParameterAvailable(const ProgramLocation location) const
-{
-       return __pShaderProgramImpl->IsParameterAvailable(location);
-}
-
-
-bool
-ShaderProgram::IsParameterAvailable(const Tizen::Base::String& name) const
-{
-       return __pShaderProgramImpl->IsParameterAvailable(name);
-}
-
-result
-ShaderProgram::UnbindAttribute(const Tizen::Base::String &name)
-{
-       return __pShaderProgramImpl->UnbindAttribute(name);
-}
-
-result
-ShaderProgram::UnbindUniform(const Tizen::Base::String &name)
-{
-       return __pShaderProgramImpl->UnbindUniform(name);
-}
-void
-ShaderProgram::SetUserData(const Tizen::Base::String& name, const Tizen::Ui::Variant& value)
-{
-       __pShaderProgramImpl->SetUserData(name, value);
-}
-void
-ShaderProgram::SetUserSampler(const Tizen::Base::String& name, Tizen::Ui::Animations::VisualElementSurface* pSurface)
-{
-       __pShaderProgramImpl->SetUserSampler(name, pSurface);
-}*/
 }}}            // Tizen::Ui::Animations
 
index bfac6be..2007589 100644 (file)
@@ -933,10 +933,10 @@ VisualElement::SetMesh(Mesh* pMesh)
        return _pVisualElementImpl->SetMesh(pMesh);
 }
 Mesh*
-VisualElement::GetMeshN(const String& name) const
+VisualElement::GetMeshN(void) const
 {
        CHECK_CONSTRUCTED;
-       return _pVisualElementImpl->GetMeshN(name);
+       return _pVisualElementImpl->GetMeshN();
 }
 
 result
@@ -947,10 +947,10 @@ VisualElement::SetMaterial(Material* pMaterial)
 }
 
 Material*
-VisualElement::GetMaterialN(const Tizen::Base::String& name) const
+VisualElement::GetMaterialN(void) const
 {
        CHECK_CONSTRUCTED;
-       return _pVisualElementImpl->GetMaterialN(name);
+       return _pVisualElementImpl->GetMaterialN();
 }
 
 result
@@ -961,10 +961,10 @@ VisualElement::SetLight(Light* pLight)
 }
 
 Light*
-VisualElement::GetLightN(const Tizen::Base::String& name) const
+VisualElement::GetLightN(void) const
 {
        CHECK_CONSTRUCTED;
-       return _pVisualElementImpl->GetLightN(name);
+       return _pVisualElementImpl->GetLightN();
 }
 
 result
@@ -1058,6 +1058,21 @@ VisualElement::OnCreateAnimationForProperty(const Tizen::Base::String& property)
        return _pVisualElementImpl->CreateAnimationForPropertyI(property);
 }
 
+result
+VisualElement::AdjustBoundingVolume()
+{
+       CHECK_CONSTRUCTED;
+
+       return _pVisualElementImpl->AdjustBoundingVolume();
+}
+
+BoundingVolume&
+VisualElement::GetBoundingVolume()
+{
+       CHECK_CONSTRUCTED;
+
+       return _pVisualElementImpl->GetBoundingVolume();
+}
 
 }}}            // Tizen::Ui::Animations
 
index 99ba671..470330c 100644 (file)
@@ -118,6 +118,11 @@ _GeometryInfo::~_GeometryInfo()
                delete __pLight;
                __pLight = null;
        }
+       if (__pShaderProgram != null)
+       {
+               delete __pShaderProgram;
+               __pShaderProgram = null;
+       }
 }
 
 void
@@ -204,14 +209,39 @@ _GeometryInfo::SetShaderProgram(ShaderProgram* pShaderProgram)
 
                if (program <= 0)
                {
-                       __pShaderProgram = null;
-
+                       //__pShaderProgram = null;
+                       if (__pShaderProgram != null)
+                       {
+                               delete __pShaderProgram;
+                               __pShaderProgram = null;
+                       }
                        SysLog(NID_UI_ANIM, "[E_INVALID_ARG] Invalid argument is used. programId = %d", program);
                        return E_INVALID_ARG;
                }
        }
+       if (pShaderProgram != null)
+       {
+
+                if (__pShaderProgram)
+                {
+                        delete __pShaderProgram;
+                        __pShaderProgram = new (std::nothrow) ShaderProgram(*pShaderProgram);
+                }
+                else
+                {
+                        __pShaderProgram = new (std::nothrow) ShaderProgram(*pShaderProgram);
+                }
+        }
+       else
+       {
+               if (__pShaderProgram != null)
+               {
+                       delete __pShaderProgram;
+                       __pShaderProgram = null;
+               }
+       }
 
-       __pShaderProgram = pShaderProgram;
+       //__pShaderProgram = pShaderProgram;
        __isShaderProgramUpdated = true;
 
        return E_SUCCESS;
index 1c9ccde..f924113 100644 (file)
@@ -824,7 +824,10 @@ _GlRenderManager::FlushRenderQueue(void)
                        case UNIFORM_FLOAT_LIGHT_EXPONENT:
                        case UNIFORM_FLOAT_LIGHT_STRUCT_EXPONENT:
                                SysTryLog(NID_UI_ANIM,__pRenderQueue[i].__pLight != null, "Light is null");
-                               glUniform1f((*it).second, pLightImpl->GetSpotExponent());
+                               if(__pRenderQueue[i].__pLight)
+                               {
+                                       glUniform1f((*it).second, pLightImpl->GetSpotExponent());
+                               }
                                break;
                        case UNIFORM_FLOAT_LIGHT_CUTOFF:
                        case UNIFORM_FLOAT_LIGHT_STRUCT_CUTOFF:
@@ -1515,7 +1518,18 @@ _GlRenderManager::CommandHandlerGetUniformLocation(_ShaderProgramImpl* pShaderPr
 
        delete [] name;
 }
-
+//
+void
+_GlRenderManager::CommandHandlerUniformInformation(LocationInfo* pLocationInfo)
+{
+       pLocationInfo->result =  __pGlContext->GetUniformLocation(pLocationInfo->program, pLocationInfo->name);
+}
+void
+_GlRenderManager::CommandHandlerAttribInformation(LocationInfo* pLocationInfo)
+{
+       pLocationInfo->result =  __pGlContext->GetAttribLocation(pLocationInfo->program, pLocationInfo->name);
+}
+//
 void
 _GlRenderManager::CommandHandlerGetAttribLocation(_ShaderProgramImpl* pShaderProgram)
 {
@@ -1626,7 +1640,44 @@ _GlRenderManager::DeleteShaderProgram(_ShaderProgramImpl* pShaderProgram)
 
        return (__commandResult == E_SUCCESS);
 }
+//
+bool
+_GlRenderManager::GetUniformInfo(LocationInfo* pLocationInfo)
+{
+       if (unlikely(IsInRenderThread()))
+       {
+               pLocationInfo->result =  __pGlContext->GetUniformLocation(pLocationInfo->program, pLocationInfo->name);
+               return true;
+       }
+       _AutoMutex commandTransactionLock(__commandTransaction);
+       _AutoMutex commandLock(__commandLock);
 
+       __commandId = COMMAND_GET_UNIFORM;
+       __commandArg.__pCommandUniformInfo = pLocationInfo;
+       __commandRequest.SendSignal();
+       __commandReply.WaitForSignal(&__commandLock);
+
+       return (__commandResult == E_SUCCESS);
+}
+bool
+_GlRenderManager::GetAttribInfo(LocationInfo* pLocationInfo)
+{
+       if (unlikely(IsInRenderThread()))
+       {
+               pLocationInfo->result =  __pGlContext->GetAttribLocation(pLocationInfo->program, pLocationInfo->name);
+               return true;
+       }
+       _AutoMutex commandTransactionLock(__commandTransaction);
+       _AutoMutex commandLock(__commandLock);
+
+       __commandId = COMMAND_GET_ATTRIB;
+       __commandArg.__pCommandUniformInfo = pLocationInfo;
+       __commandRequest.SendSignal();
+       __commandReply.WaitForSignal(&__commandLock);
+
+       return (__commandResult == E_SUCCESS);
+}
+//
 //temp
 unsigned int
 _GlRenderManager::BuildShader(int type, const char* pShaderSource)
@@ -1991,6 +2042,12 @@ _GlRenderManager::RenderProc(void* pData)
                case COMMAND_DELETE_SHADER:
                        pThis->CommandHandlerDeleteShader(commandArg.__pCommandShader);
                        break;
+               case COMMAND_GET_UNIFORM:
+                       pThis->CommandHandlerUniformInformation(commandArg.__pCommandUniformInfo);
+                       break;
+               case COMMAND_GET_ATTRIB:
+                       pThis->CommandHandlerAttribInformation(commandArg.__pCommandUniformInfo);
+                       break;
                case COMMAND_COMPOSITE:
                        PRINT(">> CommandHandlerComposite() COMMAND_COMPOSITE - start \n");
                        if (pThis->Animate())
index dd28815..e01dc37 100644 (file)
@@ -50,17 +50,18 @@ class _GlNode;
 class _ShaderImpl;
 class _ShaderProgramImpl;
 class _GlShaderProgram;
-//class _GlColorShaderProgram;
-//class _GlUniformColorShaderProgram;
-//class _GlTextureShaderProgram;
-//class _GlTextureOpacityShaderProgram;
-//class _GlLightShaderProgram;
-
+// temp
 class Light;
 class Material;
 
 struct TextureInfo;
 
+typedef struct LocationInfo
+{
+       unsigned int program;
+       int result;
+       const char* name;
+};
 class _GlRenderManager
 {
 public:
@@ -78,7 +79,9 @@ public:
                COMMAND_BUILD_SHADER,
                COMMAND_DELETE_SHADER,
                COMMAND_BUILD_SHADER_PROGRAM,
-               COMMAND_DELETE_SHADER_PROGRAM
+               COMMAND_DELETE_SHADER_PROGRAM,
+               COMMAND_GET_UNIFORM,
+               COMMAND_GET_ATTRIB
        };
 
        static _GlRenderManager* GetInstance(void)
@@ -108,7 +111,8 @@ public:
        bool DeleteShader(_ShaderImpl* pShader);
        bool BuildShaderProgram(_ShaderProgramImpl* pShaderProgram);
        bool DeleteShaderProgram(_ShaderProgramImpl* pShaderProgram);
-
+       bool GetUniformInfo(LocationInfo* pUniformInfo);
+       bool GetAttribInfo(LocationInfo* pUniformInfo);
        unsigned int BuildShader(int type, const char* pShaderSource);
        bool DeleteShader(unsigned int shaderId);
        unsigned int BuildShaderProgram(unsigned int vertexShader, unsigned int fragmentShader);
@@ -130,7 +134,8 @@ private:
        // Shader
        void CommandHandlerBuildShader(_ShaderImpl* pShader);
        void CommandHandlerDeleteShader(_ShaderImpl* pShader);
-
+       void CommandHandlerUniformInformation(LocationInfo* pUniformInfo);
+       void CommandHandlerAttribInformation(LocationInfo* pUniformInfo);
        void CommandHandlerBuildShaderProgram(_ShaderProgramImpl* pShaderProgram);
        void CommandHandlerDeleteShaderProgram(_ShaderProgramImpl* pShaderProgram);
        void CommandHandlerGetUniformLocation(_ShaderProgramImpl* pShaderProgram);
@@ -169,6 +174,7 @@ private:
                TextureInfo* __pCommandTextureInfo;
                _ShaderImpl* __pCommandShader;
                _ShaderProgramImpl* __pCommandShaderProgram;
+               LocationInfo* __pCommandUniformInfo;
        } CommandArg;
 
        class _RenderObject : public Tizen::Base::Object
index f7ce06d..ddd6ab7 100644 (file)
@@ -49,7 +49,6 @@ _GlShaderProgram::_GlShaderProgram(unsigned int program)
        ,__hasGlUniforms(false)
 {
        locationVec = new std::vector<std::pair<ProgramLocation, int> >();
-       //__shaderVariableList.clear();
 }
 
 _GlShaderProgram::~_GlShaderProgram(void)
@@ -62,11 +61,6 @@ _GlShaderProgram::~_GlShaderProgram(void)
                locationVec->clear();
                delete locationVec;
        }
-       //__shaderVariableList.clear();
-       
-//     _GlRenderManager::GetInstance()->DeleteShader(__vertexShader);
-//     _GlRenderManager::GetInstance()->DeleteShader(__fragmentShader);
-//     _GlRenderManager::GetInstance()->DeleteShaderProgram(__program);
 }
 
 Variant
@@ -163,7 +157,7 @@ PrintError(const ProgramLocation location)
        {
                return "Undefined ProgramLocation";
        }
-       static char *Errors[PROGRAM_LOCATION_MAX] = {
+       static char Errors[PROGRAM_LOCATION_MAX][64] = {
                        "UNIFORM_MAT4_MVP",
                        "UNIFORM_VEC4_COLOR",
                        "UNIFORM_SAMPLER2D_TEXTURE",
@@ -208,7 +202,7 @@ PrintError(const ProgramLocation location)
 void
 _GlShaderProgram::BindAttributes()
 {
-       static char *attributes[PROGRAM_LOCATION_MAX-1] = {
+       static char attributes[PROGRAM_LOCATION_MAX-1][64] = {
                        "u_mvp",
                        "u_color",
                        "u_tex2d",
@@ -250,19 +244,30 @@ _GlShaderProgram::BindAttributes()
                        };
 
        int glAttribute = -1;
+       LocationInfo info;
+       info.program = __program;
+       info.result = -1;
+
        for (int i = 0; i < PROGRAM_LOCATION_MAX-1; ++i)
        {
-               if ((glAttribute =  glGetAttribLocation(__program, attributes[i])) != -1)
+               info.name = attributes[i];
+               _GlRenderManager::GetInstance()->GetAttribInfo(&info);
+               if ((glAttribute = info.result) != -1)
                {
                        String locationName(attributes[i]);
                        __attributeLocations.push_back(pair <pair<ProgramLocation, String>, int>(pair<ProgramLocation, String>((ProgramLocation)i, locationName), glAttribute));
                        locationVec->push_back(pair<ProgramLocation,  int>((ProgramLocation)i, glAttribute));
+                       info.result = -1;
+                       continue;
                }
-               if ((glAttribute =  glGetUniformLocation(__program, attributes[i])) != -1)
+               _GlRenderManager::GetInstance()->GetUniformInfo(&info);
+               if ((glAttribute =  info.result) != -1)
                {
                        String locationName(attributes[i]);
                        __uniformLocations.push_back(pair <pair<ProgramLocation, String>, int>(pair<ProgramLocation, String>((ProgramLocation)i, locationName), glAttribute));
                        locationVec->push_back(pair<ProgramLocation,  int>((ProgramLocation)i, glAttribute));
+                       info.result = -1;
+                       continue;
                }
        }
        return;
@@ -437,7 +442,7 @@ _GlShaderProgram::BindUniform(const ProgramLocation location, const Tizen::Base:
        std::wstring wStr(name.GetPointer());
        std::string locationName(wStr.begin(), wStr.end());
 
-       int glAttribute;
+       int glAttribute = -1;
 
        containerLocations::iterator it;
        containerLocations::iterator itEnd;
@@ -448,7 +453,14 @@ _GlShaderProgram::BindUniform(const ProgramLocation location, const Tizen::Base:
                SysTryReturnResult(NID_UI_ANIM, String::Compare((it->first).second, name) != 0, E_INVALID_ARG, "\"%s\" is already binded",locationName.c_str());
        }
 
-       glAttribute =  glGetUniformLocation(__program, locationName.c_str());
+       LocationInfo info;
+       info.program = __program;
+       info.name = locationName.c_str();
+       info.result = -1;
+
+       _GlRenderManager::GetInstance()->GetUniformInfo(&info);
+
+       glAttribute = info.result;
 
        SysTryReturnResult(NID_UI_ANIM, glAttribute != -1, E_INVALID_ARG, "Can't bind a \"%s\" uniform", locationName.c_str());
 
@@ -463,68 +475,8 @@ _GlShaderProgram::BindUniform(const ProgramLocation location, const Tizen::Base:
                        glUniforms.push_back(data);
                }
 
-       //__uniformLocations.push_back(pair< pair<ProgramLocation, String>, int>(pair<ProgramLocation, String>(location, name), glAttribute));
-       //locationVec->push_back(pair<ProgramLocation, int>(location, glAttribute));
 
        return E_SUCCESS;
 }
 
-/*
-void
-_GlShaderProgram::SetProgram(unsigned int program)
-{
-__program = program;
-}
-*/
-/*
-bool
-_GlShaderProgram::LoadShader(const char* pVertexShaderBin, int vertexLength, const char* pFragmentShaderBin, int fragmentLength)
-{
-       return true;
-}
-*/
-/*
-int
-_GlShaderProgram::GetAttribLocation(const char* name)
-{
-       vector<ShaderVariable>::iterator iter = find(__shaderVariableList.begin(), __shaderVariableList.end(), name);
-
-       if (iter == __shaderVariableList.end())
-       {
-               ShaderVariable shaderVariable;
-
-               shaderVariable.name = new char[strlen(name) + 1];
-               strncpy(shaderVariable.name, name, strlen(name));
-               
-               shaderVariable.value = glGetAttribLocation(__program, name);
-
-               if (shaderVariable.value == -1)
-               {
-                       PRINT("_GlShaderProgram::GetAttribLocation: Invalid location! [%s]\n", name);
-               }
-
-               __shaderVariableList.push_back(shaderVariable);
-
-               return shaderVariable.value;
-       }
-       else
-       {
-               return (unsigned int)(*iter).value;
-       }
-}
-*/
-/*
-int
-_GlShaderProgram::GetUniformLocation(const char* name)
-{
-       int location = glGetUniformLocation(__program, name);
-
-       if (location == -1)
-       {
-               PRINT("_GlShaderProgram::GetUniformLocation: Invalid location! [%s]\n", name);
-       }
-
-       return location;
-}
-*/
 }}}            // Tizen::Ui::Animations
index fe4ba99..a2c6ad0 100644 (file)
 namespace Tizen { namespace Ui { namespace Animations
 {
 class _GlContext;
-/*
-class ShaderVariable
-{
-public:
-       ShaderVariable(void)
-               : value(0)
-               , name(null)
-       {
-       }
-       ~ShaderVariable(void) {}
-
-       bool operator==(const char* name)
-       {
-               if (strcmp(this->name, name) == 0)
-               {
-                       return true;
-               }
-               else
-               {
-                       return false;
-               }
-       }
-
-public:
-       int value;
-       char* name;
-};
-*/
 /**
  * @enum ProgramLocation
  *
@@ -130,7 +102,6 @@ public:
 
        _GlShaderProgram(unsigned int program = -1);
        virtual ~_GlShaderProgram(void);
-       //bool LoadShader(const char* pVertexShaderBin, int vertexLength, const char* pFragmentShaderBin, int fragmentLength);
        int GetProgram(void) const { return __program; }
        Variant GetUniform(const Tizen::Base::String& name) const;
        int GetParameter(const ProgramLocation location) const; // Need it ?
@@ -145,14 +116,12 @@ public:
        result SetUniform(const Tizen::Base::String& name, const Tizen::Ui::Variant& value);
        void BindGlUniforms(void);
 protected:
-       //virtual void OnProgramCreated(void) {} // Need it ?
         void OnProgramReferenced(void);
         void OnProgramDereferenced(void);
-protected: //TODO private
+protected:
        int __program;
        int __vertexShader;
        int __fragmentShader;
-       //std::vector<ShaderVariable> __shaderVariableList;
 private:
        typedef std::vector<std::pair< std::pair<ProgramLocation, Tizen::Base::String>, int> > containerLocations;
        std::vector<std::pair<ProgramLocation, int> > *locationVec;
index 58b5f9c..24a0415 100644 (file)
@@ -221,91 +221,6 @@ _MeshImpl::AllocIndices(int count)
     return E_SUCCESS;
 }
 
-bool
-_MeshImpl::IsSurfaceClosed()
-{
-       TriangleIndex* pIndxBuf=(TriangleIndex*)__pIndices;
-       if (__countOfIndex != 0)
-               {
-                       int iNum = __countOfIndex;
-                       std::vector<EdgeIndex> edges(iNum);
-
-               //fill the Edge buffer from Triangles buffer
-
-                               for (int cnt = 0;       cnt < iNum / 3; cnt++)
-                               {
-                                       int cntt = cnt * 3;
-                                       edges[cntt].ownerID=cnt;
-                                       if (pIndxBuf[cnt].v0 <= pIndxBuf[cnt].v1)
-                                       {
-                                               edges[cntt].from = pIndxBuf[cnt].v0;
-                                               edges[cntt].to = pIndxBuf[cnt].v1;
-                                               edges[cntt].swaped=false;
-                                       }
-                                       else
-                                       {
-                                               edges[cntt].from = pIndxBuf[cnt].v1;
-                                               edges[cntt].to = pIndxBuf[cnt].v0;
-                                               edges[cntt].swaped=true;
-                                       }
-
-                                       edges[cntt+1].ownerID=cnt;
-                                       if (pIndxBuf[cnt].v1 <= pIndxBuf[cnt].v2)
-                                       {
-                                               edges[cntt+1].from = pIndxBuf[cnt].v1;
-                                               edges[cntt+1].to = pIndxBuf[cnt].v2;
-                                               edges[cntt+1].swaped=false;
-                                       }
-                                       else
-                                       {
-                                               edges[cntt+1].from = pIndxBuf[cnt].v2;
-                                               edges[cntt+1].to = pIndxBuf[cnt].v1;
-                                               edges[cntt+1].swaped=true;
-                                       }
-
-                                       edges[cntt+2].ownerID=cnt;
-                                       if (pIndxBuf[cnt].v2 <= pIndxBuf[cnt].v0)
-                                       {
-                                               edges[cntt+2].from = pIndxBuf[cnt].v2;
-                                               edges[cntt+2].to = pIndxBuf[cnt].v0;
-                                               edges[cntt+2].swaped=false;
-                                       }
-                                       else
-                                       {
-                                               edges[cntt+2].from = pIndxBuf[cnt].v0;
-                                               edges[cntt+2].to = pIndxBuf[cnt].v2;
-                                               edges[cntt+2].swaped=true;
-                                       }
-                               }
-
-               // sort the Edge buffer
-                       std::sort(edges.begin(), edges.end(), _MeshImpl::SortFunc);
-               // analysis the Edge buffer
-       //              int ecnt =0;
-                       for (int cnt = 1; cnt < iNum; cnt++)
-                       {
-       //              if  (cnt<100){AppLog("->%i %i : %i swaped*%i",edges[cnt].from,edges[cnt].to,edges[cnt].ownerID,edges[cnt].swaped);}
-                               if (!(((edges[cnt].to == edges[cnt - 1].to) && (edges[cnt].from == edges[cnt - 1].from)) ||
-                                         ((edges[cnt].to == edges[cnt + 1].to) && (edges[cnt].from == edges[cnt + 1].from))))
-                               {
-       //                              AppLog("NOT EQUAL! %i",cnt );
-       //                              if (cnt>=2) {AppLog("%i %i : %i",edges[cnt-2].from,edges[cnt-2].to,edges[cnt-2].ownerID);} // for debug mode
-       //                              AppLog("%i %i : %i",edges[cnt-1].from,edges[cnt-1].to,edges[cnt-1].ownerID);
-       //                              AppLog("->%i %i : %i",edges[cnt].from,edges[cnt].to,edges[cnt].ownerID);
-       //                              AppLog("%i %i : %i",edges[cnt+1].from,edges[cnt+1].to,edges[cnt+1].ownerID);
-       //                              AppLog("%i %i : %i",edges[cnt+2].from,edges[cnt+2].to,edges[cnt+2].ownerID);
-       //                      //      ecnt++;
-                                       return false;
-                               }
-                       }
-       //              AppLog("%i edges open",ecnt);
-                       return true;
-               }
-               return false;
-
-
-
-}
 
 result
 _MeshImpl::SetVertex(int arrayIndex, const FloatPoint3& vertex)
index 27f30cf..fe1aebd 100644 (file)
@@ -48,6 +48,9 @@
 #include "FUiAnimShader.h" //tempo
 #include <FGrpFloatMatrix4.h> //tempo
 
+#include <map>
+#include <list>
+
 namespace Tizen { namespace Ui { namespace Animations {
 
 using namespace _ImportCollada;
@@ -68,16 +71,46 @@ static const char vs_Test[] =
        "}\n";
 static const char fs_Test[] =
        "precision mediump float;\n"
-       "uniform vec4 u_materialambient;\n"
-       //"uniform vec4 u_materialdiffuse;\n"
+       "uniform vec4 u_materialdiffuse;\n"
        "varying   vec4 v_normal;\n"
        "void main()\n"
        "{\n"
-       "       vec3 col = u_materialambient.xyz * max(0, dot(normalize(v_normal.xyz), vec3(0, 0, 1)));\n"
-       //"     vec3 col = vec3(0.3, 0.3, 1.0) * max(0, dot(normalize(v_normal.xyz), vec3(0, 0, 1)));\n"
+       "       vec3 col = u_materialdiffuse.xyz * max(0, dot(normalize(v_normal.xyz), vec3(0, 0, 1)));\n"
        "       gl_FragColor = vec4(col, 1);\n"
        "}\n";
 
+static const char vs_TestTexture[] =
+       "uniform mat4 u_mvp;\n"
+       "uniform mat4 u_inv_modelview;\n"
+       "attribute vec4 a_position;\n"
+       "attribute vec4 a_normal;\n"
+       "attribute vec2 a_texcoord;\n"
+
+       "varying   vec4 v_normal;\n"
+       "varying   vec2 v_texcoord;\n"
+       "void main()\n"
+       "{\n"
+       "       v_texcoord = a_texcoord;\n"
+       "       v_normal = normalize(u_inv_modelview * a_normal);\n"
+       "       gl_Position = u_mvp * a_position;\n"
+       "}\n";
+static const char fs_TestTexture[] =
+       "precision mediump float;\n"
+       "uniform sampler2D u_tex2d;\n"
+       "varying   vec4 v_normal;\n"
+       "varying   vec2 v_texcoord;\n"
+       "void main()\n"
+       "{\n"
+       "       vec3 col = texture2D(u_tex2d, v_texcoord).xyz * max(0, dot(normalize(v_normal.xyz), vec3(0, 0, 1)));\n"
+       "       gl_FragColor = vec4(col.zyx, 1);\n"
+       "}\n";
+
+struct Vertex{
+       FloatPoint3 pos;
+       FloatPoint3 norm;
+       FloatPoint texc;
+};
+
 
 _ModelImporterImpl::_ModelImporterImpl(const std::string& fileName, bool visualScenes, bool geometries, bool controllers, bool anmations, bool materials, bool effects, bool images, bool lights, bool cameras)
        : colladaAssets(null)
@@ -140,75 +173,170 @@ _ModelImporterImpl::LoadMeshCollada(const std::string& modelName, std::string& m
        GeometryMesh::Indexes& curSurfaceTexCoordsIndices = surfaceInds->texCoordsInds;
 
        Mesh* pMesh = new (std::nothrow) Mesh();
-       pMesh->SetName(Tizen::Base::String(modelName.c_str()));
        SysTryReturn(NID_UI_ANIM, pMesh != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory.");
 
+       pMesh->SetName(Tizen::Base::String(modelName.c_str()));
        pMesh->SetGeometryType(Mesh::GEO_TYPE_TRIANGLES);
-       pMesh->ReserveVertices(geometryMesh->GetVertexCount());
-       pMesh->ReserveIndices(curSurfaceVertexIndices.size());
 
        if (normals != null)
        {
-               pMesh->ReserveNormals();
-       }
+               typedef std::map<unsigned int, unsigned int> UsedNormals;
+               typedef std::map<unsigned int, UsedNormals> UsedVertices;
+               UsedVertices used;
 
-       if (texCoords != null)
-       {
-               pMesh->ReserveTextureCoordinates();
-       }
+               std::list<Vertex> lVertices;
+               std::list<unsigned short> lIndices;
 
-       for (unsigned int i = 0; i < geometryMesh->GetVertexCount(); i++)
-       {
-               float x = vertices[i].x;
-               float y = vertices[i].y;
-               float z = vertices[i].z;
-               if (inverseY)
+               for (unsigned int i = 0; i < curSurfaceVertexIndices.size(); i++)
                {
-                       y = -y;
+                       unsigned int vertIndex = curSurfaceVertexIndices[i];
+                       unsigned int normIndex = curSurfaceNormalIndices[i];
+                       unsigned int textIndex = 0;
+                       if (texCoords != null)
+                       {
+                               textIndex = curSurfaceTexCoordsIndices[i];
+                       }
+
+                       UsedVertices::iterator usedVertex = used.find(vertIndex);
+                       if ( usedVertex != used.end() )
+                       {
+                               UsedNormals::iterator usedNormal = usedVertex->second.find(normIndex);
+                               if ( usedNormal != usedVertex->second.end() )
+                               {
+                                       lIndices.push_back(usedNormal->second);
+                               }
+                               else
+                               {
+                                       unsigned short newIndex = lVertices.size();
+                                       usedVertex->second.insert(std::make_pair(normIndex, newIndex));
+
+                                       Vertex vert;
+                                       vert.pos.x = vertices[vertIndex].x;
+                                       vert.pos.y = vertices[vertIndex].y;
+                                       vert.pos.z = vertices[vertIndex].z;
+
+                                       normals[normIndex].Normalize();
+                                       vert.norm.x = normals[normIndex].x;
+                                       vert.norm.y = normals[normIndex].y;
+                                       vert.norm.z = normals[normIndex].z;
+
+                                       if (texCoords != null)
+                                       {
+                                               vert.texc.x = texCoords[textIndex].x;
+                                               vert.texc.y = texCoords[textIndex].y;
+                                       }
+
+                                       lVertices.push_back(vert);
+                                       lIndices.push_back(newIndex);
+                               }
+                       }
+                       else
+                       {
+                               UsedNormals usedNormals;
+                               unsigned short newIndex = lVertices.size();
+                               usedNormals.insert(std::make_pair(normIndex, newIndex));
+
+                               used.insert(std::make_pair(vertIndex, usedNormals));
+
+                               Vertex vert;
+                               vert.pos.x = vertices[vertIndex].x;
+                               vert.pos.y = vertices[vertIndex].y;
+                               vert.pos.z = vertices[vertIndex].z;
+
+                               normals[normIndex].Normalize();
+                               vert.norm.x = normals[normIndex].x;
+                               vert.norm.y = normals[normIndex].y;
+                               vert.norm.z = normals[normIndex].z;
+
+                               if (texCoords != null)
+                               {
+                                       vert.texc.x = texCoords[textIndex].x;
+                                       vert.texc.y = texCoords[textIndex].y;
+                               }
+
+                               lVertices.push_back(vert);
+                               lIndices.push_back(newIndex);
+                       }
+
                }
-               pMesh->SetVertex(i, FloatPoint3(x, y, z));
-       }
 
-       // INDEX
+               pMesh->ReserveVertices(lVertices.size());
+               pMesh->ReserveIndices(lIndices.size());
+               pMesh->ReserveNormals();
+               if (texCoords != null)
+               {
+                       pMesh->ReserveTextureCoordinates();
+               }
 
-       for (unsigned int i = 0; i < curSurfaceVertexIndices.size(); i++)
-       {
-               unsigned int vertIndex = curSurfaceVertexIndices[i];
 
-               pMesh->SetIndex(i, vertIndex);
 
-               if (normals != null)
+               unsigned int index = 0;
+               for (std::list<Vertex>::iterator i = lVertices.begin(); i != lVertices.end(); i++)
                {
-                       unsigned int normIndex = curSurfaceNormalIndices[i];
-                       normals[normIndex].Normalize();
-                       float x = normals[normIndex].x;
-                       float y = normals[normIndex].y;
-                       float z = normals[normIndex].z;
-                       FloatPoint3 norm(x, y, z);
-                       FloatPoint3 normal = pMesh->GetNormal(vertIndex) + norm;
-                       pMesh->SetNormal(vertIndex, normal);
+                       Vertex vert = *i;
+
+                       if (inverseY)
+                       {
+                               vert.pos.y = -vert.pos.y;
+                       }
+
+                       pMesh->SetVertex(index, vert.pos);
+                       pMesh->SetNormal(index, vert.norm);
+                       if (texCoords != null)
+                       {
+                               pMesh->SetTextureCoord(index, vert.texc);
+                       }
+                       index++;
                }
 
-               if (texCoords != null)
+               index = 0;
+               for (std::list<unsigned short>::iterator i = lIndices.begin(); i != lIndices.end(); i++)
                {
-                       unsigned int textIndex = curSurfaceTexCoordsIndices[i];
-                       float x = texCoords[textIndex].x;
-                       float y = texCoords[textIndex].y;
-                       pMesh->SetTextureCoord(vertIndex, FloatPoint(x, y));
+                       unsigned short vertexIndex= *i;
+
+                       pMesh->SetIndex(index, vertexIndex);
+                       index++;
                }
        }
-
-       for (int i = 0; i < pMesh->GetVertexCount(); i++)
+       else
        {
-               FloatPoint3 normal = pMesh->GetNormal(i);
-               float d = sqrt(normal.x * normal.x + normal.y * normal.y + normal.z * normal.z);
-               if (d > 0)
+               pMesh->ReserveVertices(geometryMesh->GetVertexCount());
+               pMesh->ReserveIndices(curSurfaceVertexIndices.size());
+
+               if (texCoords != null)
                {
-                       normal = normal / d;
-                       pMesh->SetNormal(i, normal);
+                       pMesh->ReserveTextureCoordinates();
+               }
+
+               for (unsigned int i = 0; i < geometryMesh->GetVertexCount(); i++)
+               {
+                       float x = vertices[i].x;
+                       float y = vertices[i].y;
+                       float z = vertices[i].z;
+                       if (inverseY)
+                       {
+                               y = -y;
+                       }
+                       pMesh->SetVertex(i, FloatPoint3(x, y, z));
+               }
+
+               // INDEX
+               for (unsigned int i = 0; i < curSurfaceVertexIndices.size(); i++)
+               {
+                       unsigned int vertIndex = curSurfaceVertexIndices[i];
+                       pMesh->SetIndex(i, vertIndex);
+
+                       if (texCoords != null)
+                       {
+                               unsigned int textIndex = curSurfaceTexCoordsIndices[i];
+                               float x = texCoords[textIndex].x;
+                               float y = texCoords[textIndex].y;
+                               pMesh->SetTextureCoord(vertIndex, FloatPoint(x, y));
+                       }
                }
        }
 
+
        return pMesh;
 }
 
@@ -287,6 +415,7 @@ _ModelImporterImpl::LoadScene(const std::string& sceneId, bool inverseY){
        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();
 
        LibraryVisualScenes::Node* pNode = pVisScene->GetFirstNode();
        WalkingTheTree(pNode, pScene, inverseY);
@@ -357,14 +486,28 @@ _ModelImporterImpl::WalkingTheTree(LibraryVisualScenes::Node* pNode, Scene* pSce
                                }
 
                                //===================================================================================Set shader
-                               Shader vert;
-                               vert.Construct(Shader::SHADER_VERTEX, vs_Test);
-                               Shader frag;
-                               frag.Construct(Shader::SHADER_FRAGMENT, fs_Test);
-
-                               ShaderProgram *pProgram = new ShaderProgram();
-                               pProgram->Construct(vert,frag);
-                               pVisElem->SetShaderProgram(pProgram);
+                               //if (textureId.compare("") == 0)
+                               //{
+                               //      Shader vert;
+                               //      vert.Construct(Shader::SHADER_VERTEX, vs_Test);
+                               //      Shader frag;
+                               //      frag.Construct(Shader::SHADER_FRAGMENT, fs_Test);
+
+                               //      ShaderProgram *pProgram = new ShaderProgram();
+                               //      pProgram->Construct(vert,frag);
+                               //      pVisElem->SetShaderProgram(pProgram);
+                               //}
+                               //else
+                               //{
+                               //      Shader vert;
+                               //      vert.Construct(Shader::SHADER_VERTEX, vs_TestTexture);
+                               //      Shader frag;
+                               //      frag.Construct(Shader::SHADER_FRAGMENT, fs_TestTexture);
+
+                               //      ShaderProgram *pProgram = new ShaderProgram();
+                               //      pProgram->Construct(vert,frag);
+                               //      pVisElem->SetShaderProgram(pProgram);
+                               //}
 
 
                                pScene->AddMesh(pMesh);
index 9252d6e..72c4349 100644 (file)
 #include "FUiAnim_VisualElementSharedData.h"
 #include "FUiAnim_TransformMatrix3Df.h"
 #include "FUiAnim_VisualElementCoordinateSystem.h"
+#include "FUiAnim_GlNode.h"
+#include "FGrpFloatMatrix4.h"
+#include "FGrpFloatPoint3.h"
 
+using namespace Tizen::Graphics;
 
 namespace Tizen{ namespace Ui{ namespace Animations
 {
 
-using namespace Tizen::Graphics;
-
 float DotProduct(_Math::Vector3 v1, _Math::Vector3 v2)
 {
        return v1.x * v2.x + v1.y * v2.y + v1.z * v2.z;
@@ -189,14 +191,21 @@ _Ray::ConvertScreenToWorld(const _Math::Vector3& screen, const _Math::Matrix4& p
 
 
 _Ray&
-_Ray::MakeRayLocal(const _Ray globalRay, const _VisualElementImpl* pVEImpl)
+_Ray::MakeRayLocal(const _Ray globalRay, const FloatMatrix4& toTop)
 {
        //make from top matrix
-       _Math::Matrix4 fromTop( &(pVEImpl->GetMatrixToTop().matrix[0][0]) );
-
+       //_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
@@ -214,7 +223,8 @@ _Ray::MakeRayGlobal(const _VisualElementImpl* pVEImpl, FloatPoint point)
        //make gloabl ray
        Tizen::Graphics::FloatRectangle frame;
        _Math::Matrix4 pvInv;
-       _VisualElementImpl* pRootVe = pVEImpl->GetRoot();
+       //_VisualElementImpl* pRootVe = pVEImpl->GetRoot();
+       _VisualElementImpl* pRootVe = pVEImpl->GetRoot(); //test
        SysTryReturn(NID_UI_ANIM, CreatePVInv(pRootVe,pvInv,frame), *this, E_OBJ_NOT_FOUND, "Ray cannot Projection View for this VisualElement (check VE to be connected to main tree, frame layer and other adjustments)");
 
        //make absolute coordinate
@@ -225,6 +235,8 @@ _Ray::MakeRayGlobal(const _VisualElementImpl* pVEImpl, FloatPoint point)
        _Math::Vector3 screenFar = ConvertScreenToWorld(_Math::Vector3(absPoint.x, absPoint.y, 1.0f), pvInv, frame);
 
        Set(screenNear, screenFar - screenNear);
+
+       return *this;
 }
 
 bool
index 24f7c03..e00de80 100644 (file)
@@ -50,7 +50,7 @@ public:
 
        void print();
 
-       _Ray& MakeRayLocal(const _Ray globalRay, const _VisualElementImpl* pVEImpl); //any VE in a tree
+       _Ray& MakeRayLocal(const _Ray globalRay, const Tizen::Graphics::FloatMatrix4& toTop);
        _Ray& MakeRayGlobal(const _VisualElementImpl* pVEImpl, Tizen::Graphics::FloatPoint point);
 
        bool CreatePVInv(const _VisualElementImpl* pRootVe, _Math::Matrix4& pvInv, Tizen::Graphics::FloatRectangle& frame);
index 7f2a547..6518040 100644 (file)
@@ -36,6 +36,11 @@ _SceneImpl::_SceneImpl(void)
        , __meshes()
        , __materials()
 {
+}
+
+result
+_SceneImpl::Construct()
+{
        __pRootVisualElement = new (std::nothrow) VisualElement();
        __pRootVisualElement->Construct();
 
@@ -44,6 +49,8 @@ _SceneImpl::_SceneImpl(void)
        __pRootVisualElement->SetBounds(Tizen::Graphics::FloatRectangle(5, 5, 1, 1));
        __pRootVisualElement->SetShowState(true);
        __pRootVisualElement->SetImplicitAnimationEnabled(false);
+
+       return E_SUCCESS;
 }
 
 _SceneImpl::~_SceneImpl(void)
index a105578..3a7e3ab 100644 (file)
 #include "FUiAnim_GlRenderManager.h"
 
 #include "FUiAnim_TemplateUtil.h"
-
+#include <string>
+using namespace std;
 namespace Tizen { namespace Ui { namespace Animations
 {
-/*
-const wchar_t* UniformMVP                      = L"u_mvp";
-const wchar_t* UniformColor                    = L"u_color";
-
-const wchar_t* AttributePosition       = L"a_position";
-const wchar_t* AttributeTexCoord       = L"a_texcoord";
-const wchar_t* AttributeColor          = L"a_color";
-*/
 
 _ShaderProgramImpl::_ShaderProgramImpl(void)
        : __program(0)
@@ -48,22 +41,14 @@ _ShaderProgramImpl::_ShaderProgramImpl(void)
        , __fragmentShader(0)
        , __pCustomShader(null)
 {
-       //memset(__locationId, 0, sizeof(unsigned int) * PROGRAM_LOCATION_MAX);
-
-       //static _StringHashProvider stringHashProvider;
-       //static _StringComparer stringComparer;
-
-       //__locations.Construct(0, 0.f, stringHashProvider, stringComparer);
 }
 
 _ShaderProgramImpl::~_ShaderProgramImpl(void)
 {
        if (__program > 0)
        {
-               _GlRenderManager::GetInstance()->DeleteShaderProgram(this); // Need it ???
+               _GlRenderManager::GetInstance()->DeleteShaderProgram(this);
        }
-
-       //__locations.RemoveAll();
        delete __pCustomShader;
 }
 
@@ -81,6 +66,30 @@ _ShaderProgramImpl::Construct(Shader& vertexShader, Shader& fragmentShader)
        return E_SUCCESS;
 }
 
+result
+_ShaderProgramImpl::Construct(const Tizen::Base::String&vertexShader, const Tizen::Base::String& fragmentShader)
+{
+       std::wstring wStr(vertexShader.GetPointer());
+       std::string vertexShaderStr(wStr.begin(), wStr.end());
+
+       std::wstring wStr1(fragmentShader.GetPointer());
+       std::string fragmentShaderStr(wStr1.begin(), wStr1.end());
+       Shader vert;
+       vert.Construct(Shader::SHADER_VERTEX,vertexShaderStr.c_str());
+       Shader frag;
+       frag.Construct(Shader::SHADER_FRAGMENT,fragmentShaderStr.c_str());
+       __vertexShader =  _ShaderImpl::GetInstance(vert)->__shaderId;
+       __fragmentShader =  _ShaderImpl::GetInstance(frag)->__shaderId;
+       _GlRenderManager::GetInstance()->BuildShaderProgram(this);
+
+       SysTryReturnResult(NID_UI_ANIM, __program > 0, E_SYSTEM, "Failed to build shader program.");
+       __pCustomShader = new (std::nothrow) _GlShaderProgram(__program);
+
+       SysTryReturnResult(NID_UI_ANIM, __pCustomShader, E_OUT_OF_MEMORY, "Memory allocation failed.");
+       __pCustomShader->BindAttributes();
+       return E_SUCCESS;
+}
+
 Variant
 _ShaderProgramImpl::GetUniform(const Tizen::Base::String& name) const
 {
@@ -92,107 +101,13 @@ _ShaderProgramImpl::SetUniform(const Tizen::Base::String& name, const Tizen::Ui:
 {
        return __pCustomShader->SetUniform(name, value);
 }
+
 _GlShaderProgram*
 _ShaderProgramImpl::GetCusomShader()
 {
        return __pCustomShader;
 }
-/*
-int
-_ShaderProgramImpl::GetAttribute(const ProgramLocation location)
-{
-   return __pCustomShader->GetAttributes(location);
-}
-int
-_ShaderProgramImpl::GetUniform(const ProgramLocation location)
-{
-        return __pCustomShader->GetUniforms(location);
-}
-
-
-result
-_ShaderProgramImpl::BindAttribute(ProgramLocation location, const Tizen::Base::String &name)
-{
-       return __pCustomShader->BindAttribute(location,name);
-}
-
-
-result
-_ShaderProgramImpl::BindUniform(ProgramLocation location, const Tizen::Base::String &name)
-{
-       return __pCustomShader->BindUniform(location,name);
-}
-
-bool
-_ShaderProgramImpl::IsParameterAvailable(const ProgramLocation location) const
-{
-       return __pCustomShader->IsParameterAvailable(location);
-}
 
-
-bool
-_ShaderProgramImpl::IsParameterAvailable(const Tizen::Base::String& name) const
-{
-       return __pCustomShader->IsParameterAvailable(name);
-}
-
-result
-_ShaderProgramImpl::UnbindUniform(const Tizen::Base::String &name)
-{
-       return __pCustomShader->UnbindUniform(name);
-}
-
-result
-_ShaderProgramImpl::UnbindAttribute(const Tizen::Base::String &name)
-{
-       return __pCustomShader->UnbindAttribute(name);
-}
-
-void
-_ShaderProgramImpl::SetUserData(const Tizen::Base::String& name, const Tizen::Ui::Variant& value)
-{
-       //
-}
-void
-_ShaderProgramImpl::SetUserSampler(const Tizen::Base::String& name, Tizen::Ui::Animations::VisualElementSurface* pSurface)
-{
-       __pCustomShader->SetUserSampler(name, pSurface);
-}
-
-int
-_ShaderProgramImpl::GetUniformLocation(const Tizen::Base::String& name)
-{
-       if (name == UniformMVP)
-       {
-               return __locationId[UNIFORM_MAT4_MVP];
-       }
-       else if (name == UniformColor)
-       {
-               return __locationId[ATTRIBUTE_VEC4_COLOR];
-       }
-
-       return 0;//GetLocation(UNIFORM_TYPE, name);
-}
-
-int
-_ShaderProgramImpl::GetAttribLocation(const Tizen::Base::String& name)
-{
-       if (name == AttributePosition)
-       {
-               return __locationId[ATTRIBUTE_VEC4_POSITION];
-       }
-       else if (name == AttributeTexCoord)
-       {
-               return __locationId[ATTRIBUTE_VEC2_TEXTURE_COORD];
-       }
-       else if (name == AttributeColor)
-       {
-               return __locationId[ATTRIBUTE_VEC4_COLOR];
-       }
-
-       return 0;//GetLocation(ATTRIBUTE_TYPE, name);
-}
-*/
 _ShaderProgramImpl*
 _ShaderProgramImpl::GetInstance(ShaderProgram& program)
 {
index 0945fae..8a7926f 100644 (file)
 #include <FBaseString.h>
 #include <FUiVariant.h>
 #include <FBaseColHashMapT.h>
-//#include "FUiAnim_CustomShader.h"
 #include "FUiAnim_GlShaderProgram.h"
 #include <FUiAnimShaderProgram.h>
-
+#include "FUiAnim_RefObject.h"
 
 namespace Tizen { namespace Ui { namespace Animations
 {
 
 class _ShaderProgramImpl
        : public Tizen::Base::Object
+        , public RefObject
 {
 public:
-       /*enum PROGRAM_LOCATION
-       {
-               UNIFORM_MVP                                     = 0,
-               UNIFORM_COLOR,
-//             UNIFORM_TEXTURE,
-               ATTRIBUTE_TEXTURE_COORD,
-               ATTRIBUTE_POSITION,
-               ATTRIBUTE_COLOR,
-       //      LIGHT_COLOR,
-               PROGRAM_LOCATION_MAX
-       };*/
-
-public:
        _ShaderProgramImpl(void);
        virtual ~_ShaderProgramImpl(void);
 
        result Construct(Shader& vertexShader, Shader& fragmentShader);
+       result Construct(const Tizen::Base::String& vertexShader, const Tizen::Base::String& fragmentShader);
 
        Variant GetUniform(const Tizen::Base::String& name) const;
        result SetUniform(const Tizen::Base::String& name, const Tizen::Ui::Variant& value);
-
-       //int GetUniformLocation(const Tizen::Base::String& name);
-       //int GetAttribLocation(const Tizen::Base::String& name);
-       //result BindAttribute(ProgramLocation location, const Tizen::Base::String &name);
-//     //result BindUniform(ProgramLocation location, const Tizen::Base::String &name);
        _GlShaderProgram* GetCusomShader();
-       //int GetAttribute(const ProgramLocation location);
-       //int GetUniform(const ProgramLocation location);
-       //bool IsParameterAvailable(const ProgramLocation location) const;
-       //bool IsParameterAvailable(const Tizen::Base::String& name) const;
-       //void SetUserData(const Tizen::Base::String& name, const Tizen::Ui::Variant& value);
-       //void SetUserSampler(const Tizen::Base::String& name, Tizen::Ui::Animations::VisualElementSurface* pSurface);
-       //result UnbindUniform(const Tizen::Base::String &name);
-       //result UnbindAttribute(const Tizen::Base::String &name);
        static _ShaderProgramImpl* GetInstance(ShaderProgram& program);
        static const _ShaderProgramImpl* GetInstance(const ShaderProgram& program);
 
@@ -83,26 +58,6 @@ public:
        unsigned int __vertexShader;    //TODO:need to save Shader???
        unsigned int __fragmentShader;
 
-       //int __locationId[PROGRAM_LOCATION_MAX];
-
-       //typedef Tizen::Base::Collection::IMapEnumeratorT<Tizen::Base::String, int> LocationMapEnumeratorT;
-/*
-       class LocationMapT : public Tizen::Base::Collection::HashMapT<Tizen::Base::String, int>
-       {
-       public:
-               int GetLocation(const Tizen::Base::String& name) const
-               {
-                       int location = 0;
-
-                       GetValue(name, location);
-
-                       return location;
-               }
-       };
-
-       LocationMapT __locations;
-*/
-       // request
        struct _RequestItem  // Need it ?
        {
                Tizen::Base::String name;
@@ -121,7 +76,6 @@ private:
        _GlShaderProgram* __pCustomShader;
        _ShaderProgramImpl(const _ShaderProgramImpl& shader);
        _ShaderProgramImpl& operator =(const _ShaderProgramImpl& rhs);
-       //friend class _CustomShader;
 };
 
 
index edf5307..77bc5e9 100644 (file)
@@ -230,6 +230,18 @@ IMPLEMENT_PROPERTY(_VisualElementImpl);
 bool CompareDistanceVA(const _VisualElementImpl::DistanceVA& dve1, const _VisualElementImpl::DistanceVA& dve2);
 bool CompareIntersections(const DistToPoint& dp0, const DistToPoint& dp1);
 
+void
+printMatrix(const char* message, const float* m, bool isColumnOrder)
+{
+       AppLog("%s", message);
+       if (isColumnOrder)
+               for (int i = 0; i < 4; ++i)
+                       AppLog("%.5f %.5f %.5f %.5f", m[i], m[4 + i], m[8 + i], m[12 + i]);
+       else
+               for (int i = 0; i < 4; ++i)
+                       AppLog("%.5f %.5f %.5f %.5f", m[4 * i], m[4 * i + 1], m[4 * i + 2], m[4 * i + 3]);
+}
+
 class _PlaneTriangle
 {
 public:
@@ -336,6 +348,7 @@ private:
 _VisualElementImpl::_VisualElementImpl(VisualElement& element)
        : _zOrderGroup(Z_ORDER_GROUP_NORMAL)
        , __globalRay(_Math::Vector3(0.0f),_Math::Vector3(0.0f))
+       , __boundingVolume()
        , __hasGlobalRay(false)
        , __nearestDistance(std::numeric_limits<float>::infinity())
        , __pNearestVEImpl(null)
@@ -398,6 +411,7 @@ _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)
        , __nearestDistance(std::numeric_limits<float>::infinity())
@@ -4383,7 +4397,16 @@ _VisualElementImpl::AddChild(_VisualElementImpl& child)
        SysTryReturnResult(NID_UI_ANIM, child.__pSharedData, E_INVALID_ARG, "Child VisualElement is not constructed.");
        SysTryReturnResult(NID_UI_ANIM, child.__isAllowedTreeModification == true, E_INVALID_OPERATION, "Z-order cannot be modified inside the OnAttached() or OnDetached() method of VisualElementEventListener.");
 
-       return ChangeZOrder(child, null, true, child._zOrderGroup);
+       result r = ChangeZOrder(child, null, true, child._zOrderGroup);
+
+       //merge this and parent with new BV
+       static BoundingVolume converted;
+       converted = child.GetBoundingVolume();
+       converted.Transform(child.GetMatrixToSuper());
+       GetBoundingVolume().Merge(converted);
+       __MergeParentsBV();
+
+       return r;
 }
 
 int
@@ -4502,7 +4525,15 @@ _VisualElementImpl::InsertChild(_VisualElementImpl& child, const _VisualElementI
                zOrderGroup = pReference->_zOrderGroup;
        }
 
-       return ChangeZOrder(child, pReference, above, zOrderGroup);
+       result r = ChangeZOrder(child, pReference, above, zOrderGroup);
+
+       //merge this and parent with new BV
+       static BoundingVolume converted = child.GetBoundingVolume();
+       converted.Transform(child.GetMatrixToSuper());
+       GetBoundingVolume().Merge(converted);
+       __MergeParentsBV();
+
+       return r;
 }
 
 result
@@ -5006,6 +5037,9 @@ _VisualElementImpl::RemoveChild(_VisualElementImpl& child, bool deallocate)
                }
        }
 
+       //minus element - rebuild Bounding Volume
+       AdjustBoundingVolume();
+
        // TODO:
        //      DEALLOCATE !!!
        //
@@ -6613,6 +6647,7 @@ _VisualElementImpl::HitTestI(const FloatPoint& point)
                {
                        //make gloabl ray
                        __globalRay.MakeRayGlobal(this,point);
+                       __hasGlobalRay = true;
                }
 
                //hit VE mesh box?
@@ -6621,7 +6656,50 @@ _VisualElementImpl::HitTestI(const FloatPoint& point)
                //get toTop matrix
                static BoundingVolume globalVolume;//(pMesh->GetBoundingVolume());
                globalVolume = pMesh->GetBoundingVolume();
-               globalVolume.Transform(GetMatrixToTop());
+
+               //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());
+               }
+
+
+               //if(this->getaniaIsA)
+//             if(this->GetName() == L"VE10")
+//             {
+//                     printMatrix("GetTransformMatrix VEImpl", &(this->GetTransformMatrix().matrix[0][0]), true);
+//                     printMatrix("GetTransformMatrix VEImpl presentation", &(this->GetPresentation()->GetTransformMatrix().matrix[0][0]), true);
+//                     printMatrix("GetTransformMatrix VEImpl model", &(this->GetModel()->GetTransformMatrix().matrix[0][0]), true);
+//
+//                     printMatrix("GetMatrixToTop VEImpl", &(this->GetMatrixToTop().matrix[0][0]), true);
+//                     printMatrix("GetMatrixToTop VEImpl presentation", &(this->GetPresentation()->GetMatrixToTop().matrix[0][0]), true);
+//                     printMatrix("GetMatrixToTop VEImpl model", &(this->GetModel()->GetMatrixToTop().matrix[0][0]), true);
+//
+//                     _GlNode* pNode = dynamic_cast< _GlNode* >(this->GetNativeNode());
+//                     if (pNode != null)
+//                     {
+//                             printMatrix("pNode __transform VEImpl", &(pNode->__transform.matrix[0][0]), true);
+//                     }
+//                     pNode = dynamic_cast< _GlNode* >(this->GetPresentation()->GetNativeNode());
+//                     if (pNode != null)
+//                     {
+//                             printMatrix("pNode __transform VEImpl presentation", &(pNode->__transform.matrix[0][0]), true);
+//                     }
+//                     pNode = dynamic_cast< _GlNode* >(this->GetModel()->GetNativeNode());
+//                     if (pNode != null)
+//                     {
+//                             printMatrix("pNode __transform VEImpl model", &(pNode->__transform.matrix[0][0]), true);
+//                     }
+//             }
+               //GetPresentation()->GetMatrixToTop()
+
+               //globalVolume.Transform(GetPresentation()->GetMatrixToTop()); //test
+
 
 
 //             _Math::Matrix4 toTop(&(GetMatrixToTop().matrix[0][0]));
@@ -6640,7 +6718,7 @@ _VisualElementImpl::HitTestI(const FloatPoint& point)
 
                        //create local ray to intersect triangles in mesh
                        _Ray localRay;
-                       localRay.MakeRayLocal(__globalRay, this); //make local ray for mesh
+                       localRay.MakeRayLocal(__globalRay, (pNode != null)?pNode->__transform:GetMatrixToTop()); //make local ray for mesh
 
                        if (!__SearchTriangleIntersection(localRay, pMesh, intesections, true)) //get all intersected triangle
                        {
@@ -6685,6 +6763,44 @@ _VisualElementImpl::GetChildAtPointI(const FloatPoint& point, int parentHitTest)
        FloatPoint hitPoint = point;
        int hitTest;
 
+       //do not investigate this and children HitTests if does not hit into bounding volume of this VEImpl
+       //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());
+               }
+
+               std::pair<bool, float> intersect = __globalRay.Intersect(globalVolume);
+
+               if (!intersect.first) // box not intersected
+               {
+                       return null;
+               }
+       }
+
+
        hitTest = VE_DELEGATE(this, InvokeHitTest, point);
        if ((hitTest & HITTEST_MATCH) != 0)
        {
@@ -8045,13 +8161,32 @@ _VisualElementImpl::SetMesh(Mesh* pMesh)
 {
        pMesh->AdjustBoundingVolume();
 
+       Mesh* pOldMesh = GetSharedData().geometry.GetMesh();
+
        GetSharedData().geometry.SetMesh(pMesh);
 
+       //merge BV
+       if(pOldMesh != null)
+       {
+               //whole adjust if Mesh changes
+               AdjustBoundingVolume();
+       }
+       else
+       {
+               if(pMesh != null)
+               {
+                       //Only merge new mesh if it is first
+                       GetBoundingVolume().Merge(pMesh->GetBoundingVolume());
+                       __MergeParentsBV();
+               }
+       }
+
+
        return E_SUCCESS;
 }
 
 Mesh*
-_VisualElementImpl::GetMeshN(const String& name) const
+_VisualElementImpl::GetMeshN(void) const
 {
        Mesh* pMesh = GetSharedData().geometry.GetMesh();
 
@@ -8072,7 +8207,7 @@ _VisualElementImpl::SetLight(Light* pLight)
 }
 
 Light*
-_VisualElementImpl::GetLightN(const Tizen::Base::String& name) const
+_VisualElementImpl::GetLightN(void) const
 {
        Light* pLight = GetSharedData().geometry.GetLight();
 
@@ -8093,7 +8228,7 @@ _VisualElementImpl::SetMaterial(Material* pMaterial)
 }
 
 Material*
-_VisualElementImpl::GetMaterialN(const Tizen::Base::String& name) const
+_VisualElementImpl::GetMaterialN(void) const
 {
        Material* pMaterial = GetSharedData().geometry.GetMaterial();
 
@@ -8123,19 +8258,6 @@ CompareDistanceVA(const _VisualElementImpl::DistanceVA& dve1, const _VisualEleme
     return dve1.first < dve2.first;
 }
 
-
-void
-printMatrix(const char* message, const float* m, bool isColumnOrder)
-{
-       AppLog("%s", message);
-       if (isColumnOrder)
-               for (int i = 0; i < 4; ++i)
-                       AppLog("%.5f %.5f %.5f %.5f", m[i], m[4 + i], m[8 + i], m[12 + i]);
-       else
-               for (int i = 0; i < 4; ++i)
-                       AppLog("%.5f %.5f %.5f %.5f", m[4 * i], m[4 * i + 1], m[4 * i + 2], m[4 * i + 3]);
-}
-
 //used for algorithm description
 //remove when all Picking methods implementing
 /*
@@ -8337,6 +8459,102 @@ _VisualElementImpl::__SearchTriangleIntersection(const _Ray& localRay, const Mes
 
     return (!intersections.empty());
 }
+
+void
+_VisualElementImpl::__AdjustBVWithChildren()
+{
+       GetBoundingVolume().Reset();
+
+       int count = __children.GetCount();
+       _VisualElementImpl* pChild;
+       static BoundingVolume converted;
+       //Mesh BV add
+       Mesh* pMesh = GetSharedData().geometry.GetMesh();
+       if(pMesh != null)
+       {
+               GetBoundingVolume().Merge(pMesh->GetBoundingVolume());
+       }
+       //children BV add
+       for (int i = 0 ; i < count ; i++)
+       {
+               pChild = __children.GetChildAt(i);
+               if(pChild)// if(pChild && (pChild->__invalidatedProps || pChild->__updatedProperties)
+               {
+                       converted = pChild->GetBoundingVolume();
+                       converted.Transform(pChild->GetMatrixToSuper());
+                       GetBoundingVolume().Merge(converted);
+               }
+       }
+}
+
+void
+_VisualElementImpl::__AdjustParentsBV()
+{
+       _VisualElementImpl* pVEImplParent = this->GetParent();
+       _VisualElementImpl* pVEImplChild = this;
+       static BoundingVolume converted;
+
+       while(pVEImplParent != null && pVEImplParent != pVEImplChild)
+       {
+               pVEImplParent->GetBoundingVolume().Reset();
+               //Mesh BV add
+               Mesh* pMesh = pVEImplParent->GetSharedData().geometry.GetMesh();
+               if(pMesh != null)
+               {
+                       pVEImplParent->GetBoundingVolume().Merge(pMesh->GetBoundingVolume());
+               }
+               //Children BV add
+               int count = pVEImplParent->__children.GetCount();
+               _VisualElementImpl* pChild;
+               for (int i = 0 ; i < count ; i++)
+               {
+                       pChild = pVEImplParent->__children.GetChildAt(i);
+                       if(pChild)// if(pChild && (pChild->__invalidatedProps || pChild->__updatedProperties)
+                       {
+                               converted = pChild->GetBoundingVolume();
+                               converted.Transform(pChild->GetMatrixToSuper());
+                               pVEImplParent->GetBoundingVolume().Merge(converted);
+                       }
+               }
+
+               pVEImplChild = pVEImplParent;
+               pVEImplParent = this->GetParent();
+       }
+}
+
+void
+_VisualElementImpl::__MergeParentsBV()
+{
+       _VisualElementImpl* pVEImplParent = this->GetParent();
+       _VisualElementImpl* pVEImplChild = this;
+       static BoundingVolume converted;
+       while(pVEImplParent != null && pVEImplParent != pVEImplChild)
+       {
+               converted = pVEImplChild->GetBoundingVolume();
+               converted.Transform(pVEImplChild->GetMatrixToSuper());
+               pVEImplParent->GetBoundingVolume().Merge(converted);
+
+               pVEImplChild = pVEImplParent;
+               pVEImplParent = this->GetParent();
+       }
+}
+
+result
+_VisualElementImpl::AdjustBoundingVolume()
+{
+       result r = E_SUCCESS;
+
+       __AdjustBVWithChildren();
+       __AdjustParentsBV();
+
+       return r;
+}
+
+BoundingVolume&
+_VisualElementImpl::GetBoundingVolume()
+{
+       return __boundingVolume;
+}
 // delegate---------------------------------------------------------------------------------
 
 void
index 639f51e..5f5f44f 100644 (file)
@@ -343,8 +343,8 @@ Matrix4::Inverse(void)
     static const float t0(0.0f);
 
     float s = Determinant();
-    //if(Equal(s, t0))
-    if(s == 0) //do not work othervise
+    //if (Equal(s, t0, 0.0f))
+    if(s == 0.0f)
        {
                return *this;
        }
@@ -378,7 +378,8 @@ Matrix4::GetInversed(void) const
     static const float t0(0.0f);
 
     float s = Determinant();
-    if(Equal(s, t0))
+    //if(Equal(s, t0))
+    if(s == 0.0f)
     {
        return *this;
     }
index 032d32a..e5a2b9d 100644 (file)
@@ -46,7 +46,7 @@ public:
     /**
      * Constructs instance of Light
      *
-     * @since 2.0
+     * @since 3.0
      *
      * @param[in]      name of constructed light
      */
@@ -57,7 +57,7 @@ public:
     /**
      * Destructs instance of Scene
      *
-     * @since 2.0
+     * @since 3.0
      */
        virtual ~_LightImpl(void);
 
@@ -66,7 +66,7 @@ public:
        /**
         * Sets light type.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @param[in]   lightType       New light type.
         * @see                 GetLightType().
@@ -76,7 +76,7 @@ public:
        /**
         * Gets light type.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @return              Light type.
         * @see                 SetLightType().
@@ -86,7 +86,7 @@ public:
        /**
         * Sets light color.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @param[in]   color   New light color.
         * @see                 GetColor().
@@ -97,7 +97,7 @@ public:
        /**
         * Sets light color.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @param[in]   r       Color red component.
         * @param[in]   g       Color green component.
@@ -109,7 +109,7 @@ public:
        /**
         * Sets light color.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @param[in]   colour  New light color.
         * @see                 GetColour().
@@ -119,7 +119,7 @@ public:
        /**
         * Gets light color.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @return              Light color.
         * @see                 SetColour().
@@ -129,7 +129,7 @@ public:
        /**
         * Sets light ambient color.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @param[in]   color   New light ambient color.
         * @see                 GetAmbient().
@@ -139,7 +139,7 @@ public:
        /**
         * Gets light ambient.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @return              Light ambient.
         * @see                 SetAmbient().
@@ -149,7 +149,7 @@ public:
        /**
         * Sets light diffuse color.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @param[in]   color   New light diffuse color.
         * @see                 GetDiffuse().
@@ -159,7 +159,7 @@ public:
        /**
         * Gets light diffuse.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @return              Light diffuse.
         * @see                 SetDiffuse().
@@ -169,7 +169,7 @@ public:
        /**
         * Sets light specular color.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @param[in]   color   New light specular color.
         * @see                 GetSpecular().
@@ -189,7 +189,7 @@ public:
        /**
         * Sets light intensity color.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @param[in]   color   New light intensity color.
         * @see                 GetIntensity().
@@ -199,7 +199,7 @@ public:
        /**
         * Gets light intensity.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @return              Light intensity.
         * @see                 SetIntensity().
@@ -209,7 +209,7 @@ public:
        /**
         * Sets light spot exponent.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @param[in]   exponent        New light spot exponent.
         * @see                 GetSpotExponent().
@@ -219,7 +219,7 @@ public:
        /**
         * Gets light spot exponent.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @return              Light spot exponent.
         * @see                 SetSpotExponent().
@@ -229,7 +229,7 @@ public:
        /**
         * Sets light constant attenuation.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @param[in]   attenuation             New light constant attenuation.
         * @see                 GetConstantAttenuation().
@@ -239,7 +239,7 @@ public:
        /**
         * Gets light constant attenuation.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @return              Light constant attenuation.
         * @see                 SetConstantAttenuation().
@@ -249,7 +249,7 @@ public:
        /**
         * Sets light linear attenuation.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @param[in]   attenuation             New light linear attenuation.
         * @see                 GetLinearAttenuation().
@@ -259,7 +259,7 @@ public:
        /**
         * Gets light linear attenuation.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @return              Light linear attenuation.
         * @see                 SetLinearAttenuation().
@@ -269,7 +269,7 @@ public:
        /**
         * Sets light quadratic attenuation.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @param[in]   attenuation             New light quadratic attenuation.
         * @see                 GetQuadraticAttenuation().
@@ -279,7 +279,7 @@ public:
        /**
         * Gets light quadratic attenuation.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @return              Light quadratic attenuation.
         * @see                 SetQuadraticAttenuation().
@@ -289,7 +289,7 @@ public:
        /**
         * Sets light direction.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @param[in]   direction       New light direction.
         * @see                 GetDirection().
@@ -299,7 +299,7 @@ public:
        /**
         * Sets light direction.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @param[in]   x       Direction x component.
         * @param[in]   y       Direction y component.
@@ -311,7 +311,7 @@ public:
        /**
         * Gets light direction.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @return              light direction.
         * @see                 SetDirection().
@@ -321,7 +321,7 @@ public:
        /**
         * Sets light radius.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @param[in]   radius          New light radius.
         * @see                 GetRadius().
@@ -332,7 +332,7 @@ public:
        /**
         * Gets light radius.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @return              Light radius.
         * @see                 SetQuadraticAttenuation().
@@ -342,7 +342,7 @@ public:
        /**
         * Sets light position.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @param[in]   pos             New light position.
         * @see                 GetPosition().
@@ -352,7 +352,7 @@ public:
        /**
         * Sets light position.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @param[in]   x               Light position x component.
         * @param[in]   y               Light position y component.
@@ -364,7 +364,7 @@ public:
        /**
         * Gets light position.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @return              Light position.
         * @see                 SetPosition().
index 802aa0e..5389683 100644 (file)
@@ -107,7 +107,7 @@ public:
        /**
         * Get material name.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @return              Name of the material.
         * @see                 SetName().
@@ -126,7 +126,7 @@ public:
        /**
         * Set Material name.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @param[in]   name    Material new name.
         * @see                 GetName().
@@ -147,7 +147,7 @@ public:
        /**
         * Get material ambient color.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @return              Ambient color of the material.
         * @see                 SetAmbient().
@@ -160,7 +160,7 @@ public:
        /**
         * Set Material ambient color.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @param[in]   value           Material new ambient color value.
         * @see                 GetAmbient().
@@ -174,7 +174,7 @@ public:
        /**
         * Get material diffuse color.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @return              Diffuse color of the material.
         * @see                 SetDiffuse().
@@ -188,7 +188,7 @@ public:
        /**
         * Set Material diffuse color.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @param[in]   value           MateMaterialDescriptionrial new diffuse color value.
         * @see                 GetDiffuse().
@@ -202,7 +202,7 @@ public:
        /**
         * Get material specular color.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @return              Specular color of the material.
         * @see                 SetSpecular().
@@ -216,7 +216,7 @@ public:
        /**
         * Set Material specular color
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @param[in]   value   MateriaMaterialDescriptionl new specular color value.
         * @see                 GetSpecular().
@@ -230,7 +230,7 @@ public:
        /**
         * Get material emissive color.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @return              Emmisive color of the material.
         * @see                 SetEmissive().
@@ -244,7 +244,7 @@ public:
        /**
         * Set material emissive color.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @param[in]   value   Material new emissive color value.
         * @see                 GetEmissive().
@@ -260,7 +260,7 @@ public:
        /**
         * Get material emissive power
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @return              Emissive power of the material.
         * @see                 SetEmissivePower().
@@ -274,7 +274,7 @@ public:
        /**
         * Set material specular power
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @param[in]   value           Material new specular power value.
         * @see                 GetSpecularPower().
@@ -287,7 +287,7 @@ public:
        /**
         * Get material alpha test ref.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @return              Alpha test ref of the material.
         * @see                 SetAlphaTestRef().
@@ -301,7 +301,7 @@ public:
        /**
         * Set material alpha test ref.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @param[in]   value           Material new alpha test ref value.
         * @see                 GetAlphaTestRef().
@@ -314,7 +314,7 @@ public:
        /**
         * Get material transparent
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @return              Transparent of the material.
         * @see                 SetTransparent().
@@ -328,7 +328,7 @@ public:
        /**
         * Set material transparent
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @param[in]   value   Material new transparent value.
         * @see                 GetTransparent().
@@ -342,7 +342,7 @@ public:
        /**
         * Get material ZWrite.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @return              ZWrite of the material.
         * @see                 SetZWrite
@@ -355,7 +355,7 @@ public:
        /**
         * Set material ZWrite.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @param[in]   value   Material new ZWrite value.
         * @see                 GetZWrite
@@ -369,7 +369,7 @@ public:
        /**
         * Get material alpha test.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @return              Alpha test of the material.
         * @see                 SetAlphaTest().
@@ -383,7 +383,7 @@ public:
        /**
         * Set material alpha test.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @param[in]   value   Material new alpha test value.
         * @see                 GetAlphaTest().
@@ -397,7 +397,7 @@ public:
        /**
         * Get material ZBuffer.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @return              ZBuffer of the material,
         * @see                 SetZBuffer().
@@ -411,7 +411,7 @@ public:
        /**
         * Set material ZBuffer.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @param[in]   value   Material new ZBuffer value.
         * @see                 GetZBuffer().
@@ -424,7 +424,7 @@ public:
        /**
         * Get material opacity.
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @return              Opacity of the material.
         * @see                 SetOpacity().
@@ -436,7 +436,7 @@ public:
        /**
         * Set material opacity
         *
-        * @since 2.0
+        * @since 3.0
         *
         * @param[in]   value   Material new opacity value.
         * @see                 GetOpacity().
index a259758..34e29a9 100644 (file)
@@ -106,7 +106,7 @@ public:
        {
                return (__pNormals)?true:false;
        }
-       bool IsSurfaceClosed();
+
 
 
        void SetName(std::string name)
index b4d36fc..d37de0b 100644 (file)
@@ -46,6 +46,7 @@ public:
        _SceneImpl(void);
        virtual ~_SceneImpl(void);
 
+       result Construct();
 
        VisualElement* GetRootVisualElement(void) const;
 
index f54a18b..68ac4db 100644 (file)
@@ -923,13 +923,13 @@ public:
        _IVisualElementCaptureProvider* GetCaptureProvider(void) const;
 
        result SetMesh(Mesh* pMesh);
-       Mesh* GetMeshN(const Tizen::Base::String& name) const;
+       Mesh* GetMeshN(void) const;
 
        result SetLight(Light* pLight);
-       Light* GetLightN(const Tizen::Base::String& name) const;
+       Light* GetLightN(void) const;
 
        result SetMaterial(Material* pMaterial);
-       Material* GetMaterialN(const Tizen::Base::String& name) const;
+       Material* GetMaterialN(void) const;
 
        result SetShaderProgram(ShaderProgram* pShaderProgram);
        ShaderProgram* GetShaderProgram(void) const;
@@ -1416,6 +1416,10 @@ private:
        bool CreateImplicitAnimationForShowState(float newState, float currentState, bool bImplicitAnimation);
        bool CreateImplicitAnimationIfNeeded(const Tizen::Base::String& property, const Variant& newValue, const Variant& currentPresntationValue, const Tizen::Base::String** pSubProperties, bool isCustomProperty = false);
 
+       //Visual Element Bounding volume related
+       result AdjustBoundingVolume();
+       BoundingVolume& GetBoundingVolume();
+
 public:
        enum
        {
@@ -1477,9 +1481,14 @@ public:
        typedef DistanceVAs::iterator DistanceVAsIt;
 
        //_VisualElementImpl* PickVA(int screenX, int screenY); //until all picking interface implementing, algorithm description related
-
 private:
 
+       //Visual Element Bounding volume related
+       void __AdjustBVWithChildren();
+       void __AdjustParentsBV();
+       void __MergeParentsBV();
+
+
        //picking related methods and variables
        //void __MakeRayIntersection(const _Ray& ray, DistanceVAs& intersected); //until all picking interface implementing,algorithm description related
 
@@ -1488,6 +1497,9 @@ private:
        bool __SearchTriangleIntersection(const _Ray& localRay, const Mesh* mesh, Intersections& intersections, bool seachAllIntersections);
        _Math::Vector3 __ConvertScreenToWorld(const _Math::Vector3& screen, const _Math::Matrix4& pvInv, const Tizen::Graphics::FloatRectangle& frame);
 
+       //Visual Element Bounding volume related
+       BoundingVolume __boundingVolume;
+
        _Ray __globalRay;
        bool __hasGlobalRay;
        float __nearestDistance;