X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Fupdate%2Frendering%2Fscene-graph-renderer.h;h=f1ef2a729a9cc88d88db203ac1c2d19f54949afc;hb=649ec06daecb510fb84fe4642a6af957f127e7ab;hp=ee6762d8e534ab38fa54e56d3aa31c430690a40f;hpb=15667b2f6a89cc0acd92b2bce111b69fb62e8711;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/dali/internal/update/rendering/scene-graph-renderer.h b/dali/internal/update/rendering/scene-graph-renderer.h index ee6762d..f1ef2a7 100644 --- a/dali/internal/update/rendering/scene-graph-renderer.h +++ b/dali/internal/update/rendering/scene-graph-renderer.h @@ -2,7 +2,7 @@ #define DALI_INTERNAL_SCENE_GRAPH_RENDERER_H /* - * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * Copyright (c) 2018 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. @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -59,7 +60,7 @@ class Renderer : public PropertyOwner, { public: - enum Opacity + enum OpacityType { OPAQUE, TRANSPARENT, @@ -140,60 +141,120 @@ public: void SetFaceCullingMode( FaceCullingMode::Type faceCullingMode ); /** + * Get face culling mode + * @return The face culling mode + */ + FaceCullingMode::Type GetFaceCullingMode() const; + + /** * Set the blending mode * @param[in] blendingMode to use */ void SetBlendMode( BlendMode::Type blendingMode ); /** + * Get the blending mode + * @return The the blending mode + */ + BlendMode::Type GetBlendMode() const; + + /** * Set the blending options. This should only be called from the update thread. * @param[in] options A bitmask of blending options. */ void SetBlendingOptions( unsigned int options ); /** + * Get the blending options + * @return The the blending mode + */ + unsigned int GetBlendingOptions() const; + + /** * Set the blend color for blending operation * @param blendColor to pass to GL */ void SetBlendColor( const Vector4& blendColor ); /** + * Get the blending color + * @return The blend color + */ + Vector4 GetBlendColor() const; + + /** * Set the index of first element for indexed draw * @param[in] firstElement index of first element to draw */ void SetIndexedDrawFirstElement( size_t firstElement ); /** + * Get the index of first element for indexed draw + * @return The index of first element for indexed draw + */ + size_t GetIndexedDrawFirstElement() const; + + /** * Set the number of elements to draw by indexed draw * @param[in] elementsCount number of elements to draw */ void SetIndexedDrawElementsCount( size_t elementsCount ); /** + * Get the number of elements to draw by indexed draw + * @return The number of elements to draw by indexed draw + */ + size_t GetIndexedDrawElementsCount() const; + + /** * @brief Set whether the Pre-multiplied Alpha Blending is required * @param[in] preMultipled whether alpha is pre-multiplied. */ void EnablePreMultipliedAlpha( bool preMultipled ); /** + * @brief Query whether alpha is pre-multiplied. + * @return True is alpha is pre-multiplied, false otherwise. + */ + bool IsPreMultipliedAlphaEnabled() const; + + /** * Sets the depth buffer write mode * @param[in] depthWriteMode The depth buffer write mode */ void SetDepthWriteMode( DepthWriteMode::Type depthWriteMode ); /** + * Get the depth buffer write mode + * @return The depth buffer write mode + */ + DepthWriteMode::Type GetDepthWriteMode() const; + + /** * Sets the depth buffer test mode * @param[in] depthTestMode The depth buffer test mode */ void SetDepthTestMode( DepthTestMode::Type depthTestMode ); /** + * Get the depth buffer test mode + * @return The depth buffer test mode + */ + DepthTestMode::Type GetDepthTestMode() const; + + /** * Sets the depth function * @param[in] depthFunction The depth function */ void SetDepthFunction( DepthFunction::Type depthFunction ); /** + * Get the depth function + * @return The depth function + */ + DepthFunction::Type GetDepthFunction() const; + + /** * Sets the render mode * @param[in] mode The render mode */ @@ -242,13 +303,33 @@ public: void SetStencilOperationOnZPass( StencilOperation::Type stencilOperationOnZPass ); /** + * Gets the stencil parameters + * @return The stencil parameters + */ + const Render::Renderer::StencilParameters& GetStencilParameters() const; + + /** + * Bakes the opacity + * @param[in] updateBufferIndex The current update buffer index. + * @param[in] opacity The opacity + */ + void BakeOpacity( BufferIndex updateBufferIndex, float opacity ); + + /** + * Gets the opacity + * @param[in] bufferIndex The buffer to read from. + * @return The opacity + */ + float GetOpacity( BufferIndex updateBufferIndex ) const; + + /** * Prepare the object for rendering. * This is called by the UpdateManager when an object is due to be rendered in the current frame. * @param[in] updateBufferIndex The current update buffer index. */ void PrepareRender( BufferIndex updateBufferIndex ); - /* + /** * Retrieve the Render thread renderer * @return The associated render thread renderer */ @@ -259,7 +340,7 @@ public: * @param[in] updateBufferIndex The current update buffer index. * @return OPAQUE if fully opaque, TRANSPARENT if fully transparent and TRANSLUCENT if in between */ - Opacity GetOpacity( BufferIndex updateBufferIndex, const Node& node ) const; + OpacityType GetOpacityType( BufferIndex updateBufferIndex, const Node& node ) const; /** * Called by the TextureSet to notify to the renderer that it has changed @@ -346,25 +427,20 @@ private: Renderer(); /** - * Helper function to create a new render data provider - * @return the new (initialized) data provider + * Update texture set to the render data provider */ - RenderDataProvider* NewRenderDataProvider(); - - /** - * Helper function to retrieve the blend color. - * @return The blend color. - */ - const Vector4& GetBlendColor() const; + void UpdateTextureSet(); private: CollectedUniformMap mCollectedUniformMap[2]; ///< Uniform maps collected by the renderer + SceneController* mSceneController; ///< Used for initializing renderers Render::Renderer* mRenderer; ///< Raw pointer to the renderer (that's owned by RenderManager) TextureSet* mTextureSet; ///< The texture set this renderer uses. (Not owned) Render::Geometry* mGeometry; ///< The geometry this renderer uses. (Not owned) Shader* mShader; ///< The shader this renderer uses. (Not owned) + RenderDataProvider* mRenderDataProvider; ///< The render data provider OwnerPointer< Vector4 > mBlendColor; ///< The blend color for blending operation Dali::Internal::Render::Renderer::StencilParameters mStencilParameters; ///< Struct containing all stencil related options @@ -386,6 +462,7 @@ private: public: + AnimatableProperty< float > mOpacity; ///< The opacity value int mDepthIndex; ///< Used only in PrepareRenderInstructions }; @@ -616,6 +693,16 @@ inline void SetStencilOperationOnZPassMessage( EventThreadServices& eventThreadS new (slot) LocalType( &renderer, &Renderer::SetStencilOperationOnZPass, stencilOperation ); } +inline void BakeOpacityMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, float opacity ) +{ + typedef MessageDoubleBuffered1< Renderer, float > LocalType; + + // Reserve some memory inside the message queue + unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) ); + + new (slot) LocalType( &renderer, &Renderer::BakeOpacity, opacity ); +} + } // namespace SceneGraph } // namespace Internal } // namespace Dali