-#ifndef __DALI_INTERNAL_SCENE_GRAPH_RENDER_ITEM_H__
-#define __DALI_INTERNAL_SCENE_GRAPH_RENDER_ITEM_H__
+#ifndef DALI_INTERNAL_SCENE_GRAPH_RENDER_ITEM_H
+#define DALI_INTERNAL_SCENE_GRAPH_RENDER_ITEM_H
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace SceneGraph
{
-class RenderItem;
-
-typedef std::vector< RenderItem > RendererItemContainer;
-
/**
- * A render-item is a renderer & modelView matrix pair.
+ * A RenderItem contains all the data needed for rendering
*/
-class RenderItem
+struct RenderItem
{
-public:
-
/**
* Construct a new RenderItem
+ * @return A pointer to a new RenderItem.
*/
static RenderItem* New();
~RenderItem();
/**
- * Overriden delete operator.
- * Deletes the RenderItem from its global memory pool
- */
- void operator delete( void* ptr );
-
- /**
- * Reset the render-item.
- */
- void Reset();
-
- /**
- * Retrieve the renderer.
- * @return The renderer.
- */
- Render::Renderer& GetRenderer() const;
-
- /**
- * Set the renderer
- * @param[in] renderer The renderer
- */
- void SetRenderer( Render::Renderer* renderer );
-
- /**
- * Set the node
- * @param[in] node The node
- */
- void SetNode( Node* node );
-
- /**
- * Retrieve the node
- * @return The node
+ * @brief This method is an optimized calculation of a viewport-space AABB (Axis-Aligned-Bounding-Box).
+ *
+ * We use the model-view-matrix, but we do not use projection. Therefore we assume Z = 0.
+ * As the box is Axis-Aligned (in viewport space) rotations on Z axis are correctly delt with by expanding the box as necessary.
+ * Rotations on X & Y axis will resize the AABB, but it will not handle the projection error due to the new coordinates having non-zero Z values.
+ *
+ * Note: We pass in the viewport dimensions rather than allow the caller to modify the raw AABB in order to optimally generate the final result.
+ *
+ * @param[in] viewportWidth The width of the viewport to calculate for
+ * @param[in] viewportHeight The height of the viewport to calculate for
+ * @param[in] useUpdateSizeHint Set to true if you want to use update size hint instead of item size
+ * @return The AABB coordinates in viewport-space (x, y, width, height)
*/
- const Node& GetNode() const
- {
- return *mNode;
- }
- /**
- * Retrieve the modelView matrix.
- * @return The modelView matrix.
- */
- Matrix& GetModelViewMatrix();
+ ClippingBox CalculateViewportSpaceAABB( const int viewportWidth, const int viewportHeight, const bool useUpdateSizeHint = false ) const;
/**
- * Retrieve the modelView matrix.
- * @return The modelView matrix.
- */
- const Matrix& GetModelViewMatrix() const;
-
- /**
- * Retrieve the depth index
- */
- int GetDepthIndex() const
- {
- return mDepthIndex;
- }
-
- /**
- * Set the depth index
- */
- void SetDepthIndex( int depthIndex );
-
- /**
- * Set if the RenderItem is opaque
- * @param[in] isOpaque true if the RenderItem is opaque, false otherwise
- */
- void SetIsOpaque( bool isOpaque );
-
- /**
- * Check if the RenderItem is opaque
- * @return True if it is opaque, false otherwise
- */
- bool IsOpaque() const
- {
- return mIsOpaque;
- }
-
- /**
- * Sets the size of the render item
- * @param[in] size The size of the render item
+ * Overriden delete operator.
+ * Deletes the RenderItem from its global memory pool
+ * @param[in] A pointer to the RenderItem to delete.
*/
- void SetSize( const Vector3& size)
- {
- mSize = size;
- }
+ void operator delete( void* ptr );
- /**
- * Retrives the size of the render item
- * @return The size of the render item
- */
- const Vector3& GetSize() const
- {
- return mSize;
- }
+ Matrix mModelMatrix;
+ Matrix mModelViewMatrix;
+ Vector3 mSize;
+ Vector3 mUpdateSizeHint;
+ Render::Renderer* mRenderer;
+ Node* mNode;
+ const void* mTextureSet; //< Used for sorting only
+ int mDepthIndex;
+ bool mIsOpaque:1;
+ bool mPartialUpdateEnabled:1;
private:
RenderItem( const RenderItem& item );
RenderItem& operator = ( const RenderItem& item );
- Matrix mModelViewMatrix;
- Vector3 mSize;
- Render::Renderer* mRenderer;
- Node* mNode;
- int mDepthIndex;
- bool mIsOpaque:1;
};
} // namespace SceneGraph
} // namespace Dali
-#endif // __DALI_INTERNAL_SCENE_GRAPH_RENDER_ITEM_H__
+#endif // DALI_INTERNAL_SCENE_GRAPH_RENDER_ITEM_H