void Clear();
Tizen::Graphics::FloatPoint3 GetBoundingBoxPosition() const;
- float GetBoundingBoxVolume() const;
+ float GetBoundingBoxLength() const;
float GetBoundingBoxWidth() const;
float GetBoundingBoxHeight() const;
// 임시 함수
- result AllocVertices(int count);
- result AllocIndices(int count);
- result AllocTextureCoordinates();
- result AllocNormals();
- result AllocColors();
+ result ReserveVertices(int count);
+ result ReserveIndices(int count);
+ result ReserveTextureCoordinates();
+ result ReserveNormals();
+ result ReserveColors();
bool IsIndexEnabled() const;
bool IsTextureCoordinateEnabled() const;
}
float
-Mesh::GetBoundingBoxVolume() const
+Mesh::GetBoundingBoxLength() const
{
CHECK_CONSTRUCTED;
return __pMeshImpl->GetBoundingBoxVolume();
// 임시 함수
result
-Mesh::AllocVertices(int count)
+Mesh::ReserveVertices(int count)
{
CHECK_CONSTRUCTED;
return __pMeshImpl->AllocVertices(count);
}
result
-Mesh::AllocIndices(int count)
+Mesh::ReserveIndices(int count)
{
CHECK_CONSTRUCTED;
return __pMeshImpl->AllocIndices(count);
}
result
-Mesh::AllocTextureCoordinates()
+Mesh::ReserveTextureCoordinates()
{
CHECK_CONSTRUCTED;
return __pMeshImpl->AllocTextureCoordinates();
}
result
-Mesh::AllocNormals()
+Mesh::ReserveNormals()
{
CHECK_CONSTRUCTED;
return __pMeshImpl->AllocNormals();
}
result
-Mesh::AllocColors()
+Mesh::ReserveColors()
{
CHECK_CONSTRUCTED;
return __pMeshImpl->AllocColors();
#include <FUiAnimVisualElementSurface.h>
#include <FUiAnimVisualElementAnimation.h>
+#include "FUiAnim_NativeLayer.h"
#include "FUiAnim_VisualElementAnimationImpl.h"
#include "FUiAnim_VisualElementImpl.h"
#include "FUiAnim_Mutex.h"
_pVisualElementImpl->RemoveAllAnimations();
}
-static int acquireCount = 0;
-
const VisualElement*
VisualElement::AcquirePresentationInstance(void)
{
if (_pVisualElementImpl && _pVisualElementImpl->GetPresentation() && _pVisualElementImpl->GetPresentation()->GetPublic())
{
- if (acquireCount <= 0)
+ _RootVisualElement* pRoot = dynamic_cast<_RootVisualElement*>(_pVisualElementImpl->GetRootPublic());
+ bool isUpdated = false;
+
+ if ( pRoot )
{
- _AutoMutex treeLock(*_VisualElementEnvironment::GetTreeLock());
-
- acquireCount++;
- _VisualElementImpl* pRootImpl = _pVisualElementImpl->GetRoot();
- _VisualElementImpl* pTargetImpl = (pRootImpl)? pRootImpl : _pVisualElementImpl;
-
- if (likely(pTargetImpl))
- {
- _VisualElementImpl* pRenderObject = pTargetImpl->GetRenderObject();
- if(pRenderObject && pTargetImpl->GetPresentation())
- {
- pTargetImpl->GetPresentation()->Sync(*pRenderObject);
- }
+ _NativeLayer* pLayer = pRoot->GetNativeLayer();
+ if ( pLayer )
+ {
+ pLayer->UpdatePresentation();
+ isUpdated = true;
}
+
}
+ if(!isUpdated)
+ {
+
+ // todo: when Ve isn't attached to the maintree, just update presentation without sync.(use UpdatePropertiesForRender infomation)
+ //_pVisualElementImpl->Update() Sync(_pVisualElementImpl->Sync());
+
+ }
+
return _pVisualElementImpl->GetPresentation()->GetPublic();
}
void
VisualElement::ReleasePresentationInstance(void)
{
- acquireCount--;
return;
}
CHECK_CONSTRUCTED;
return _pVisualElementImpl->SetTexture(meshName, pTexture);
}
+
Bitmap*
VisualElement::GetTexture(const String& meshName) const
{
}
bool
-_DisplayManager::NeedAllUpdates()
+_DisplayManager::HasUpdates() const
{
int count = __layers.GetCount();
if (count <= 0)
for (int i = 0; i < count; i++)
{
- _NativeLayer* pLayer = null;
+ const _NativeLayer* pLayer = null;
- pLayer = static_cast< _NativeLayer* >(__layers.GetAt(i));
+ pLayer = static_cast<const _NativeLayer* >(__layers.GetAt(i));
if (likely(pLayer))
{
-// if(isMainThread)
-// {
- if(pLayer->IsRenderNeeded())
- {
- return true;
- }
-
-// }
-// else
-// {
-// bool updated = pLayer->UpdateNativeNodes();
-// needUpdate |= updated;
-// }
-
+ if(pLayer->IsRenderNeeded())
+ {
+ return true;
+ }
}
}
return false;
result
_DisplayManager::Flush(void)
{
- _GlRenderManager::GetInstance()->Composite();
- // FIXME: VisualElement::Flush should wait for complete
+ //for main thread
+ int count =__layers.GetCount();
+
+
+ _GlRenderManager* pRenderManager = _GlRenderManager::GetInstance();
+
+ if(!pRenderManager)
+ {
+ return E_INVALID_STATE;
+ }
+
+ _NativeLayer* pLayer = null;
+
+ bool needCompositRenderer = false;
+
+ for(int i = 0;i< count; i++)
+ {
+ pLayer = static_cast<_NativeLayer*>(__layers.GetAt(i));
+ if(pLayer)
+ {
+ if(!pLayer->IsRunningOnRenderThread())
+ {
+ pLayer->Flush();
+ }
+ else
+ {
+ needCompositRenderer = true;
+ }
+ }
+ }
+
+ if (needCompositRenderer) //by render thread
+ {
+ _GlRenderManager::GetInstance()->Composite();
+ }
+ // FIXME: VisualElement::Flush should wait for complete
return E_SUCCESS;
}
void AddWakeUpEvent(void);
void RemoveWakeUpEvent(void);
- bool NeedAllUpdates();
+ bool HasUpdates() const;
bool RenderAll(bool modelObject);
// bool Render(_RootVisualElement& root, bool checkOnly, bool isMainThread);
result PostRender(_NativeLayer& layer, bool isMainThread);
, __pContext(null)
#endif
{
+ _isRunningOnRenderThread = true;
}
_GlLayer::~_GlLayer(void)
if (__eventQueue.GetCount() <= 0)
{
- __needUpdateDraw = _DisplayManager::GetInstance()->NeedAllUpdates(); //true
+ __needUpdateDraw = _DisplayManager::GetInstance()->HasUpdates(); //true
#if 1 // todo works
if (unlikely(__needUpdateDraw))
{
return E_SUCCESS;
}
-result
-_MeshImpl::AllocIndices(int count)
-{
- if(__pIndices)
- return E_ALREADY_SET;
-
- if(count <= 0)
- return E_INVALID_ARG;
-
-
- __countOfAllocatedIndex = count;
-
- __pIndices = new (std::nothrow) unsigned short int[count];
- if(!__pIndices)
- return E_OUT_OF_MEMORY;
-
- for(int i = 0 ; i < __countOfAllocatedVertex ; i++)
- {
- __pIndices[i] = 0;
- }
-
- return E_SUCCESS;
-}
result
_MeshImpl::AllocTextureCoordinates()
if(__pTexCoordinates)
return E_ALREADY_SET;
- if(__countOfAllocatedVertex<=0)
+ if(__countOfAllocatedVertex <= 0)
return E_INVALID_STATE;
int count = __countOfAllocatedVertex * 2;
if(__pNormals)
return E_ALREADY_SET;
- if(__countOfAllocatedVertex<=0)
+ if(__countOfAllocatedVertex <= 0)
return E_INVALID_STATE;
int count = __countOfAllocatedVertex * 3;
if(__pColors)
return E_ALREADY_SET;
- if(__countOfAllocatedVertex<=0)
+ if(__countOfAllocatedVertex <= 0)
return E_INVALID_STATE;
int count = __countOfAllocatedVertex * 4;
}
result
+_MeshImpl::AllocIndices(int count)
+{
+ if(__pIndices)
+ return E_ALREADY_SET;
+
+ if(count <= 0)
+ return E_INVALID_ARG;
+
+
+ __countOfAllocatedIndex = count;
+
+ __pIndices = new (std::nothrow) unsigned short int[count];
+ if(!__pIndices)
+ return E_OUT_OF_MEMORY;
+
+ for(int i = 0 ; i < __countOfAllocatedVertex ; i++)
+ {
+ __pIndices[i] = 0;
+ }
+
+ return E_SUCCESS;
+}
+
+
+result
_MeshImpl::SetVertex(int arrayIndex, const FloatPoint3& vertex)
{
if(__pVertices)
{
+ if ( arrayIndex > __countOfAllocatedVertex )
+ {
+ return E_OUT_OF_RANGE;
+ }
+
int i = arrayIndex * 3;
- if(__hasBoundingBox)
+
+ if ( __hasBoundingBox )
{
__pVertices[i] = vertex.x - __boundingBox.x; //x
__pVertices[i+1] = vertex.y - __boundingBox.y; //y
return E_SUCCESS;
}
- return E_INVALID_ARG;
+ return E_INVALID_STATE;
}
result
_MeshImpl::SetTextureCoord(int arrayIndex, const FloatPoint& textureCoord)
{
+ if(!__pTexCoordinates)
+ {
+ AllocTextureCoordinates();
+ }
if(__pTexCoordinates)
{
+ if ( arrayIndex > __countOfAllocatedVertex )
+ {
+ return E_OUT_OF_RANGE;
+ }
+
int i = arrayIndex * 2;
+
__pTexCoordinates[i] = textureCoord.x; //x
__pTexCoordinates[i+1] = textureCoord.y; //y
return E_SUCCESS;
}
- return E_INVALID_ARG;
+ return E_INVALID_STATE;
}
result
_MeshImpl::SetNormal(int arrayIndex, const FloatPoint3& normal)
{
+ if(!__pNormals)
+ {
+ AllocNormals();
+ }
+
if(__pNormals)
{
+ if ( arrayIndex > __countOfAllocatedVertex )
+ {
+ return E_OUT_OF_RANGE;
+ }
+
int i = arrayIndex * 3;
+
__pNormals[i] = normal.x; //x
__pNormals[i+1] = normal.y; //y
__pNormals[i+2] = normal.z; //z
return E_SUCCESS;
}
- return E_INVALID_ARG;
+ return E_INVALID_STATE;
}
result
_MeshImpl::SetColor(int arrayIndex, const Color& color)
{
+ if(!__pColors)
+ {
+ AllocColors();
+ }
if(__pColors)
{
+ if ( arrayIndex > __countOfAllocatedVertex )
+ {
+ return E_OUT_OF_RANGE;
+ }
+
int i = arrayIndex*4;
__pColors[i] = (float)color.GetRed()/255.0f;
__pColors[i+1] = (float)color.GetGreen()/255.0f;
return E_SUCCESS;
}
- return E_INVALID_ARG;
+ return E_INVALID_STATE;
}
result
{
if(__pIndices)
{
+ if ( arrayIndex > __countOfAllocatedIndex )
+ {
+ return E_OUT_OF_RANGE;
+ }
+
__pIndices[arrayIndex] = vertexIndex;
if(__countOfIndex <= arrayIndex )
{
__countOfIndex = arrayIndex + 1;
}
+ return E_SUCCESS;
}
- return E_SUCCESS;
+ return E_INVALID_STATE;
}
FloatPoint3
pCur = STRTOK(NULL,seps,&pNext);
int countOfFace = atoi(pCur);
MESH_NUMFACES = countOfFace;
- pMesh->AllocVertices(countOfFace*3);
-// pMesh->AllocIndices(countOfFace*3);
+ pMesh->ReserveVertices(countOfFace*3);
+// pMesh->ReserveIndices(countOfFace*3);
PRINT("*MESH_NUMFACES = %d\n", countOfFace);
}
// pMesh->MESH_TFACELIST = new unsigned short int[3 * pMesh->MESH_NUMTVFACES];
// pMesh->MESH_TFACELIST_REAL = new float[2 * 3 * pMesh->MESH_NUMTVFACES];
- pMesh->AllocTextureCoordinates();
+ pMesh->ReserveTextureCoordinates();
FloatPoint texCoord;
// int k = 0;
#include <new>
#include <FBaseSysLog.h>
+
+#include "FUiAnim_Mutex.h"
+#include "FUiAnim_VisualElementEnvironment.h"
#include "FUiAnim_RootVisualElement.h"
#include "FUiAnim_NativeLayer.h"
#include "FUiAnim_VisualElementImpl.h"
_NativeLayer::_NativeLayer(void)
: _pRootVisualElement(null)
+ , _isRunningOnRenderThread(false)
, __handle(0)
, __needFlush(false)
, __needUpdateRenderObjects(false)
+ , __didSyncPresentation(false)
{
static unsigned long idCount = 0;
__id = idCount++;
_VisualElementImpl* pRenderRootImpl = pRootModelImpl->__pRenderObject;
if(!pRenderRootImpl)
+ {
return false;
+ }
if (likely((pRenderRootImpl->__childrenNeedsUpdateProps & ~_VisualElementImpl::UPDATED_PROP_CONTENT) != 0)
)
{
pRenderRootImpl->UpdateHierarchyProps();
+ __didSyncPresentation = false;
return true;
}
return false;
}
+bool
+_NativeLayer::UpdatePresentation(void)
+{
+ if(!_pRootVisualElement)
+ {
+ return false;
+ }
+
+ if(__didSyncPresentation)
+ {
+ return true;
+ }
+
+ _AutoMutex treeLock(*_VisualElementEnvironment::GetTreeLock());
+
+ _VisualElementImpl* pRootModelImpl = _VisualElementImpl::GetInstance(*_pRootVisualElement);
+ _VisualElementImpl* pRootPresentationImpl = pRootModelImpl->__pPresentation;
+ _VisualElementImpl* pRenderRootImpl = pRootModelImpl->__pRenderObject;
+
+ if ( pRootPresentationImpl && pRenderRootImpl )
+ {
+ pRootPresentationImpl->Sync(*pRenderRootImpl);
+ __didSyncPresentation = true;
+ }
+ return true;
+}
+
unsigned long
_NativeLayer::GetHandle(void) const
{
return __handle;
}
+
unsigned long
_NativeLayer::GetId(void) const
{
result
_VisualElementImpl::FlushI(void)
{
-#ifdef VE_EFL
- _DisplayManager* pDisplayManager = _DisplayManager::GetInstance();
- if (pDisplayManager)
- {
- pDisplayManager->RenderAll();
- }
-#else
- _DisplayManager* pDisplayManager = _DisplayManager::GetInstance();
+ _DisplayManager* pDisplayManager = _DisplayManager::GetInstance();
if (pDisplayManager)
{
pDisplayManager->RenderAll(true);
return pDisplayManager->Flush();
}
-#endif
+ return E_INVALID_STATE;
}
bool
}
result
+_VisualElementImpl::SetExtraSurface(const Tizen::Base::String& name, const VisualElementSurface* pSurface)
+{
+ return E_SUCCESS;
+}
+
+result
+_VisualElementImpl::SetAlphaMask(const Tizen::Base::String& extraSurfaceName)
+{
+ return E_SUCCESS;
+}
+
+
+result
_VisualElementImpl::SetImageSource(const String& filePath)
{
result r = E_SUCCESS;
// 임시 함수
result AllocVertices(int count);
result AllocIndices(int count);
- result AllocTextureCoordinates();
- result AllocNormals();
- result AllocColors();
+
+ int GetCountOfAllocatedVertices() const
+ {
+ return __countOfAllocatedVertex;
+ }
+
+ int GetCountOfVertices() const
+ {
+ return __countOfVertex;
+ }
+
+ int GetCountOfAllocatedIndices() const
+ {
+ return __countOfAllocatedIndex;
+ }
+
+ int GetCountOfIndices() const
+ {
+ return __countOfIndex;
+ }
+
bool IsIndexEnabled() const
{
virtual ~_MeshImpl();
result GatherBoundingPosition(const Tizen::Graphics::FloatPoint3& pt);
private:
+ result AllocTextureCoordinates();
+ result AllocNormals();
+ result AllocColors();
+
+private:
Mesh::GeometryType __geoType;
float* __pVertices; //MESH_VERTEX_LIST
Mesh* __pPublic;
+ friend class Mesh;
friend class _MeshImportSample;
friend class _GlRenderManager;
};
*/
bool UpdateNativeNodes(void);
+
+ /**
+ * Update presentation with render objects.
+ *
+ * @since 3.0
+ *
+ */
+ bool UpdatePresentation(void);
+
+
unsigned long GetHandle(void) const;
unsigned long GetId(void) const;
+ bool IsRunningOnRenderThread(void) const
+ {
+ return _isRunningOnRenderThread;
+ }
+
/**
* Sets the position and the size of this instance.
*
protected:
_RootVisualElement* _pRootVisualElement;
+ bool _isRunningOnRenderThread;
private:
unsigned long __id;
unsigned long __handle; // window handle
bool __needFlush;
bool __needUpdateRenderObjects;
+ bool __didSyncPresentation;
friend class _RootVisualElement;
VisualElementSurface* GetSurfaceN(void) const;
result SetSurface(const VisualElementSurface* pSurface);
+ result SetExtraSurface(const Tizen::Base::String& name, const VisualElementSurface* pSurface);
+ result SetAlphaMask(const Tizen::Base::String& extraSurfaceName);
result SetContentBounds(const Tizen::Graphics::FloatRectangle& contentBounds);
Tizen::Graphics::FloatRectangle GetContentBounds(void) const;