X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Fevent%2Frendering%2Frenderer-impl.h;h=6849bf33ae4c60ae66715bf798f6d4a806e006f4;hb=4f26a4cedbd69c7ab60dfa95edeafae2cfd2c7e6;hp=1c836864c1e53d8deaf3dd063a4a0d0f4675ba65;hpb=7cf931b2a8ab40cc1f673bc319e4cae5d801ce40;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/dali/internal/event/rendering/renderer-impl.h b/dali/internal/event/rendering/renderer-impl.h index 1c83686..6849bf3 100755 --- a/dali/internal/event/rendering/renderer-impl.h +++ b/dali/internal/event/rendering/renderer-impl.h @@ -2,7 +2,7 @@ #define DALI_INTERNAL_RENDERER_H /* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 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. @@ -22,6 +22,7 @@ #include // DALI_ASSERT_ALWAYS #include // Dali::IntrusivePtr #include // Dali::Renderer +#include #include #include // Dali::Internal::ObjectConnector #include // Dali::Internal::Object @@ -39,7 +40,7 @@ class Renderer; } class Renderer; -typedef IntrusivePtr RendererPtr; +using RendererPtr = IntrusivePtr; /** * Renderer is an object that can be used to show content by combining a Geometry with a shader and textures. @@ -62,7 +63,7 @@ public: /** * @copydoc Dali::Renderer::GetGeometry() */ - Geometry* GetGeometry() const; + GeometryPtr GetGeometry() const; /** * @copydoc Dali::Renderer::SetTextures() @@ -72,7 +73,7 @@ public: /** * @copydoc Dali::Renderer::GetTextures() */ - TextureSet* GetTextures() const; + TextureSetPtr GetTextures() const; /** * @copydoc Dali::Renderer::SetShader() @@ -82,194 +83,146 @@ public: /** * @copydoc Dali::Renderer::GetShader() */ - Shader* GetShader() const; + ShaderPtr GetShader() const; /** * @copydoc Dali::Renderer::SetDepthIndex() */ - void SetDepthIndex( int depthIndex ); + void SetDepthIndex( int32_t depthIndex ); /** * @copydoc Dali::Renderer::GetDepthIndex() */ - int GetDepthIndex() const; + int32_t GetDepthIndex() const; - /** - * @copydoc Dali::Renderer::SetBlendMode() - */ - void SetBlendMode( BlendMode::Type mode ); - - /** - * @copydoc Dali::Renderer::GetBlendMode() - */ - BlendMode::Type GetBlendMode() const; - - /** - * @copydoc Dali::Renderer::SetBlendFunc() - */ - void SetBlendFunc( BlendFactor::Type srcFactorRgba, BlendFactor::Type destFactorRgba ); - - /** - * @copydoc Dali::Renderer::SetBlendFunc() - */ - void SetBlendFunc( BlendFactor::Type srcFactorRgb, BlendFactor::Type destFactorRgb, - BlendFactor::Type srcFactorAlpha, BlendFactor::Type destFactorAlpha ); - - /** - * @copydoc Dali::Renderer::GetBlendFunc() - */ - void GetBlendFunc( BlendFactor::Type& srcFactorRgb, BlendFactor::Type& destFactorRgb, - BlendFactor::Type& srcFactorAlpha, BlendFactor::Type& destFactorAlpha ) const; - - /** - * @copydoc Dali::Renderer::SetBlendEquation() - */ - void SetBlendEquation( BlendEquation::Type equationRgba ); - - /** - * @copydoc Dali::Renderer::SetBlendEquation() - */ - void SetBlendEquation( BlendEquation::Type equationRgb, BlendEquation::Type equationAlpha ); - - /** - * @copydoc Dali::Renderer::GetBlendEquation() - */ - void GetBlendEquation( BlendEquation::Type& equationRgb, BlendEquation::Type& equationAlpha ) const; - - /** - * @copydoc Dali::Renderer::SetIndexedDrawFirstElement - */ - void SetIndexedDrawFirstElement( size_t firstElement ); - - /** - * @copydoc Dali::Renderer::SetIndexedDrawElementsCount - */ - void SetIndexedDrawElementsCount( size_t elementsCount ); + /** + * @copydoc Dali::Renderer::SetBlendMode() + */ + void SetBlendMode( BlendMode::Type mode ); - /** - * @brief Set whether the Pre-multiplied Alpha Blending is required - * - * @param[in] preMultipled whether alpha is pre-multiplied. - */ - void EnablePreMultipliedAlpha( bool preMultipled ); + /** + * @copydoc Dali::Renderer::GetBlendMode() + */ + BlendMode::Type GetBlendMode() const; - /** - * @brief Query whether alpha is pre-multiplied. - * - * @return True is alpha is pre-multiplied, false otherwise. - */ - bool IsPreMultipliedAlphaEnabled() const; + /** + * @copydoc Dali::Renderer::SetBlendFunc() + */ + void SetBlendFunc( BlendFactor::Type srcFactorRgba, BlendFactor::Type destFactorRgba ); - /** - * @brief Get the scene graph object - * - * @return the scene object - */ - SceneGraph::Renderer* GetRendererSceneObject(); + /** + * @copydoc Dali::Renderer::SetBlendFunc() + */ + void SetBlendFunc( BlendFactor::Type srcFactorRgb, BlendFactor::Type destFactorRgb, + BlendFactor::Type srcFactorAlpha, BlendFactor::Type destFactorAlpha ); -public: // Default property extensions from Object + /** + * @copydoc Dali::Renderer::GetBlendFunc() + */ + void GetBlendFunc( BlendFactor::Type& srcFactorRgb, BlendFactor::Type& destFactorRgb, + BlendFactor::Type& srcFactorAlpha, BlendFactor::Type& destFactorAlpha ) const; /** - * @copydoc Dali::Internal::Object::GetDefaultPropertyCount() + * @brief Set same Blend Equation for the RGB and alpha */ - virtual unsigned int GetDefaultPropertyCount() const; + void SetBlendEquation( DevelBlendEquation::Type equationRgba ); /** - * @copydoc Dali::Internal::Object::GetDefaultPropertyIndices() + * @brief Set Blend Equation separately for the RGB and alpha */ - virtual void GetDefaultPropertyIndices( Property::IndexContainer& indices ) const; + void SetBlendEquation( DevelBlendEquation::Type equationRgb, DevelBlendEquation::Type equationAlpha ); /** - * @copydoc Dali::Internal::Object::GetDefaultPropertyName() + * @brief Get Blend Equation of rgb and alpha */ - virtual const char* GetDefaultPropertyName(Property::Index index) const; + void GetBlendEquation( DevelBlendEquation::Type& equationRgb, DevelBlendEquation::Type& equationAlpha ) const; /** - * @copydoc Dali::Internal::Object::GetDefaultPropertyIndex() + * @copydoc Dali::Renderer::SetIndexedDrawFirstElement */ - virtual Property::Index GetDefaultPropertyIndex(const std::string& name) const; + void SetIndexedDrawFirstElement( uint32_t firstElement ); /** - * @copydoc Dali::Internal::Object::IsDefaultPropertyWritable() + * @copydoc Dali::Renderer::SetIndexedDrawElementsCount */ - virtual bool IsDefaultPropertyWritable(Property::Index index) const; + void SetIndexedDrawElementsCount( uint32_t elementsCount ); /** - * @copydoc Dali::Internal::Object::IsDefaultPropertyAnimatable() + * @brief Set whether the Pre-multiplied Alpha Blending is required + * + * @param[in] preMultipled whether alpha is pre-multiplied. */ - virtual bool IsDefaultPropertyAnimatable(Property::Index index) const; + void EnablePreMultipliedAlpha( bool preMultipled ); /** - * @copydoc Dali::Internal::Object::IsDefaultPropertyAConstraintInput() + * @brief Query whether alpha is pre-multiplied. + * + * @return True is alpha is pre-multiplied, false otherwise. */ - virtual bool IsDefaultPropertyAConstraintInput( Property::Index index ) const; + bool IsPreMultipliedAlphaEnabled() const; /** - * @copydoc Dali::Internal::Object::GetDefaultPropertyType() + * @brief Query whether Blend Equation Advanced is used in this renderer + * + * @return True is Blend Equation Advanced is used, false otherwise. */ - virtual Property::Type GetDefaultPropertyType(Property::Index index) const; + bool IsAdvancedBlendEquationApplied() const; /** - * @copydoc Dali::Internal::Object::SetDefaultProperty() + * @brief Get the scene graph object + * + * @return the scene object */ - virtual void SetDefaultProperty(Property::Index index, const Property::Value& propertyValue); + const SceneGraph::Renderer& GetRendererSceneObject() const; + +public: // Default property extensions from Object /** - * @copydoc Dali::Internal::Object::SetSceneGraphProperty() + * @copydoc Dali::Internal::Object::SetDefaultProperty() */ - virtual void SetSceneGraphProperty( Property::Index index, const PropertyMetadata& entry, const Property::Value& value ); + void SetDefaultProperty(Property::Index index, const Property::Value& propertyValue) override; /** * @copydoc Dali::Internal::Object::GetDefaultProperty() */ - virtual Property::Value GetDefaultProperty( Property::Index index ) const; + Property::Value GetDefaultProperty( Property::Index index ) const override; /** * @copydoc Dali::Internal::Object::GetDefaultPropertyCurrentValue() */ - virtual Property::Value GetDefaultPropertyCurrentValue( Property::Index index ) const; + Property::Value GetDefaultPropertyCurrentValue( Property::Index index ) const override; /** * @copydoc Dali::Internal::Object::OnNotifyDefaultPropertyAnimation() */ - virtual void OnNotifyDefaultPropertyAnimation( Animation& animation, Property::Index index, const Property::Value& value, Animation::Type animationType ); - - /** - * @copydoc Dali::Internal::Object::GetPropertyOwner() - */ - virtual const SceneGraph::PropertyOwner* GetPropertyOwner() const; - - /** - * @copydoc Dali::Internal::Object::GetSceneObject() - */ - virtual const SceneGraph::PropertyOwner* GetSceneObject() const; + void OnNotifyDefaultPropertyAnimation( Animation& animation, Property::Index index, const Property::Value& value, Animation::Type animationType ) override; /** * @copydoc Dali::Internal::Object::GetSceneObjectAnimatableProperty() */ - virtual const SceneGraph::PropertyBase* GetSceneObjectAnimatableProperty( Property::Index index ) const; + const SceneGraph::PropertyBase* GetSceneObjectAnimatableProperty( Property::Index index ) const override; /** * @copydoc Dali::Internal::Object::GetSceneObjectInputProperty() */ - virtual const PropertyInputImpl* GetSceneObjectInputProperty( Property::Index index ) const; + const PropertyInputImpl* GetSceneObjectInputProperty( Property::Index index ) const override; /** - * @copydoc Dali::Internal::Object::GetPropertyComponentIndex() + * @brief Adds a draw command to the Renderer. + * DrawCommands override Renderer's default behaviour. + * + * @param[in] command Valid reference to a DrawCommand objects */ - virtual int GetPropertyComponentIndex( Property::Index index ) const; + void AddDrawCommand( const Dali::DevelRenderer::DrawCommand& command ); private: // implementation /** - * @brief Default constructor. - */ - Renderer(); - - /** - * @brief Initializes the Renderer. + * @brief Constructor. + * + * @param sceneObject the scene graph renderer */ - void Initialize(); + Renderer( const SceneGraph::Renderer* sceneObject ); /** * @brief Sets the blend color. @@ -303,33 +256,36 @@ protected: /** * A reference counted object may only be deleted by calling Unreference() */ - virtual ~Renderer(); + ~Renderer() override; private: // unimplemented methods Renderer( const Renderer& ); Renderer& operator=( const Renderer& ); private: // data - SceneGraph::Renderer* mSceneObject; - GeometryPtr mGeometry; ///< Connector that holds the geometry used by this renderer - TextureSetPtr mTextureSet; ///< Connector that holds the texture set used by this renderer - ShaderPtr mShader; ///< Connector that holds the shader used by this renderer - - int mDepthIndex; - - size_t mIndexedDrawFirstElement; ///< Offset of first element to draw from bound index buffer - size_t mIndexedDrawElementCount; ///< Number of elements to draw - - Render::Renderer::StencilParameters mStencilParameters; ///< Struct containing all stencil related options - BlendingOptions mBlendingOptions; ///< Local copy of blending options bitmask - - float mOpacity; ///< Local copy of the opacity - DepthFunction::Type mDepthFunction:4; ///< Local copy of the depth function - FaceCullingMode::Type mFaceCullingMode:3; ///< Local copy of the mode of face culling - BlendMode::Type mBlendMode:3; ///< Local copy of the mode of blending - DepthWriteMode::Type mDepthWriteMode:3; ///< Local copy of the depth write mode - DepthTestMode::Type mDepthTestMode:3; ///< Local copy of the depth test mode - bool mPremultipledAlphaEnabled:1; ///< Flag indicating whether the Pre-multiplied Alpha Blending is required + + GeometryPtr mGeometry; ///< Intrusive pointer to the geometry used by this renderer + TextureSetPtr mTextureSet; ///< Intrusive pointer to the texture set used by this renderer + ShaderPtr mShader; ///< Intrusive pointer to the shader used by this renderer + + int32_t mDepthIndex; + + uint32_t mIndexedDrawFirstElement; ///< Offset of first element to draw from bound index buffer + uint32_t mIndexedDrawElementCount; ///< Number of elements to draw + + Render::Renderer::StencilParameters mStencilParameters; ///< Struct containing all stencil related options + BlendingOptions mBlendingOptions; ///< Local copy of blending options bitmask + + float mOpacity; ///< Local copy of the opacity + DepthFunction::Type mDepthFunction:4; ///< Local copy of the depth function + FaceCullingMode::Type mFaceCullingMode:3; ///< Local copy of the mode of face culling + BlendMode::Type mBlendMode:3; ///< Local copy of the mode of blending + DepthWriteMode::Type mDepthWriteMode:3; ///< Local copy of the depth write mode + DepthTestMode::Type mDepthTestMode:3; ///< Local copy of the depth test mode + DevelRenderer::Rendering::Type mRenderingBehavior:2; ///< The rendering behavior + bool mPremultipledAlphaEnabled:1; ///< Flag indicating whether the Pre-multiplied Alpha Blending is required + + std::vector mDrawCommands; ///< list of draw commands }; } // namespace Internal