BufferIndex bufferIndex,
float frameTime )
{
- DALI_PRINT_RENDER_INSTRUCTION( instruction );
+ DALI_PRINT_RENDER_INSTRUCTION( instruction, bufferIndex );
- const Matrix* viewMatrix = instruction.mViewMatrix;
- const Matrix* projectionMatrix = instruction.mProjectionMatrix;
+ const Matrix* viewMatrix = instruction.GetViewMatrix( bufferIndex );
+ const Matrix* projectionMatrix = instruction.GetProjectionMatrix( bufferIndex );
DALI_ASSERT_DEBUG( NULL != viewMatrix );
DALI_ASSERT_DEBUG( NULL != projectionMatrix );
DALI_LOG_RENDER_INFO( "RENDER END\n\n" );
}
-void PrintRenderInstruction( const SceneGraph::RenderInstruction& instruction )
+void PrintRenderInstruction( const SceneGraph::RenderInstruction& instruction, BufferIndex index )
{
const char* target = (0 != instruction.mOffscreenTextureId) ? "FrameBuffer" : "Screen";
std::stringstream debugStream;
- debugStream << "Rendering to " << target << ", View: " << *(instruction.mViewMatrix) << " Projection: " << *(instruction.mProjectionMatrix);
+ debugStream << "Rendering to " << target << ", View: " << *(instruction.GetViewMatrix(index)) << " Projection: " << *(instruction.GetProjectionMatrix(index));
if( instruction.mIsViewportSet )
{
#define DALI_PRINT_RENDER_START(x) Render::PrintFrameStart(x);
#define DALI_PRINT_RENDER_END() Render::PrintFrameEnd();
-#define DALI_PRINT_RENDER_INSTRUCTION(x) Render::PrintRenderInstruction(x);
+#define DALI_PRINT_RENDER_INSTRUCTION(x,index) Render::PrintRenderInstruction(x,index);
#define DALI_PRINT_RENDER_LIST(x) Render::PrintRenderList(x);
#define DALI_PRINT_RENDER_ITEM(x) Render::PrintRenderItem(x);
#define DALI_PRINT_RENDER_START(x)
#define DALI_PRINT_RENDER_END()
-#define DALI_PRINT_RENDER_INSTRUCTION(x)
+#define DALI_PRINT_RENDER_INSTRUCTION(x,index)
#define DALI_PRINT_RENDER_LIST(x)
#define DALI_PRINT_RENDER_ITEM(x)
/**
* Print some information about a render-instruction.
* @param[in] instruction The render-instruction.
+ * @param[in] index to use
*/
-void PrintRenderInstruction( const SceneGraph::RenderInstruction& instruction );
+void PrintRenderInstruction( const SceneGraph::RenderInstruction& instruction, BufferIndex index );
/**
* Print some information about a render-list.
{
RenderInstruction::RenderInstruction()
-: mViewMatrix( 0 ),
- mProjectionMatrix( 0 ),
- mRenderTracker( NULL ),
+: mRenderTracker( NULL ),
mClearColor(),
mIsViewportSet( false ),
mIsClearColorSet( false ),
mCullMode(false),
mOffscreenTextureId( 0 ),
+ mCameraAttachment( 0 ),
mNextFreeRenderList( 0 )
{
// reserve 6 lists, which is enough for three layers with opaque and transparent things on
return mRenderLists[ index ];
}
-void RenderInstruction::Reset( const Matrix* viewMatrix,
- const Matrix* projectionMatrix,
- unsigned int offscreenTextureId,
- const Viewport* viewport,
- const Vector4* clearColor)
+void RenderInstruction::Reset( CameraAttachment* cameraAttachment,
+ unsigned int offscreenTextureId,
+ const Viewport* viewport,
+ const Vector4* clearColor )
{
- mViewMatrix = viewMatrix;
- mProjectionMatrix = projectionMatrix;
+ mCameraAttachment = cameraAttachment;
mViewport = viewport ? *viewport : Viewport();
mIsViewportSet = NULL != viewport;
mClearColor = clearColor ? *clearColor : Color::BLACK;
// INTERNAL INCLUDES
#include <dali/public-api/math/matrix.h>
#include <dali/public-api/math/viewport.h>
+#include <dali/internal/update/node-attachments/scene-graph-camera-attachment.h>
#include <dali/internal/render/common/render-list.h>
namespace Dali
namespace SceneGraph
{
class RenderTracker;
+class CameraAttachment;
/**
* A set of rendering instructions consisting of:
* render-lists are cleared but not released, while matrices and other settings reset in
* preparation for building a set of instructions for the renderer.
*
- * @param[in] viewMatrix The view matrix.
- * @param[in] projectionMatrix The projection matrix.
+ * @param[in] cameraAttachment to use to get view and projection matrices.
* @param[in] offscreenId A resource Id of an off-screen render target, or 0
* @param[in] viewport A pointer to a viewport, of NULL.
* @param[in] clearColor A pointer to a color to clear with, or NULL if no clear is required.
*/
- void Reset( const Matrix* viewMatrix,
- const Matrix* projectionMatrix,
+ void Reset( CameraAttachment* cameraAttachment,
unsigned int offscreenId,
const Viewport* viewport,
const Vector4* clearColor );
+ /**
+ * Get the view matrix for rendering
+ * @param index of the rendering side
+ * @return the view matrix
+ */
+ const Matrix* GetViewMatrix( BufferIndex index ) const
+ {
+ // inlined as this is called once per frame per render instruction
+ return &mCameraAttachment->GetViewMatrix( index );
+ }
+
+ /**
+ * Get the projection matrix for rendering
+ * @param index of the rendering side
+ * @return the projection matrix
+ */
+ const Matrix* GetProjectionMatrix( BufferIndex index ) const
+ {
+ // inlined as this is called once per frame per render instruction
+ return &mCameraAttachment->GetProjectionMatrix( index );
+ }
+
private:
// Undefined
public: // Data, TODO hide these
- const Matrix* mViewMatrix; ///< Pointer to a View Matrix (owned by camera)
- const Matrix* mProjectionMatrix; ///< Pointer to a Projection Matrix (owned by camera)
RenderTracker* mRenderTracker; ///< Pointer to an optional tracker object (not owned)
Viewport mViewport; ///< Optional viewport
private: // Data
+ CameraAttachment* mCameraAttachment; ///< camera that is used
RenderListContainer mRenderLists; ///< container of all render lists
RenderListContainer::SizeType mNextFreeRenderList; ///< index for the next free render list
}
}
-Node* RenderTask::GetCameraNode() const
-{
- return mCameraNode;
-}
-
void RenderTask::SetFrameBufferId( unsigned int resourceId )
{
if ( mFrameBufferResourceId != resourceId )
void RenderTask::PrepareRenderInstruction( RenderInstruction& instruction, BufferIndex updateBufferIndex )
{
+ DALI_ASSERT_DEBUG( NULL != mCameraAttachment );
+
TASK_LOG(Debug::General);
Viewport viewport;
bool viewportSet = QueryViewport( updateBufferIndex, viewport );
- instruction.Reset( &GetViewMatrix( updateBufferIndex ),
- &GetProjectionMatrix( updateBufferIndex ),
+ instruction.Reset( mCameraAttachment,
GetFrameBufferId(),
viewportSet ? &viewport : NULL,
mClearEnabled ? &GetClearColor( updateBufferIndex ) : NULL );
void SetCameraNode( Node* node );
/**
- * Retrieve the camera node.
- * @return The scene is viewed from the perspective of this node.
- */
- Node* GetCameraNode() const;
-
- /**
* Set the frame-buffer used as a render target.
* @param[in] resourceId The resource ID of the frame-buffer, or zero if not rendering off-screen.
*/