1 #ifndef __DALI_INTERNAL_RENDERABLE_ATTACHMENT_H__
2 #define __DALI_INTERNAL_RENDERABLE_ATTACHMENT_H__
5 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
7 // Licensed under the Flora License, Version 1.0 (the License);
8 // you may not use this file except in compliance with the License.
9 // You may obtain a copy of the License at
11 // http://floralicense.org/license/
13 // Unless required by applicable law or agreed to in writing, software
14 // distributed under the License is distributed on an AS IS BASIS,
15 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 // See the License for the specific language governing permissions and
17 // limitations under the License.
21 #include <dali/public-api/actors/renderable-actor.h>
22 #include <dali/public-api/actors/blending.h>
23 #include <dali/internal/common/blending-options.h>
24 #include <dali/internal/event/actor-attachments/actor-attachment-impl.h>
34 class RenderableAttachment;
38 * An base class for renderable actor attachments
40 class RenderableAttachment : public ActorAttachment
45 * Set the depth-sort modifier for the renderable.
46 * This modifies the back-to-front distance calculation, when rendering with transparency.
47 * This is useful for ordering transparent objects that are positioned close to each other.
48 * @param[in] modifier The depth-sort modifier.
50 void SetSortModifier(float modifier);
53 * From Renderable; Retrieve the depth-sort modifier for the renderable.
54 * @return The depth-sort modifier.
56 float GetSortModifier() const;
59 * Set the face-culling mode for this attachment.
60 * @param[in] mode The culling mode.
62 void SetCullFace(CullFaceMode mode);
65 * Retrieve the face-culling mode for this attachment.
66 * @return mode The culling mode.
68 CullFaceMode GetCullFace() const;
71 * @copydoc Dali::RenderableActor::SetBlendMode()
73 void SetBlendMode( BlendingMode::Type mode );
76 * @copydoc Dali::RenderableActor::GetBlendMode()
78 BlendingMode::Type GetBlendMode() const;
81 * @copydoc Dali::RenderableActor::SetBlendFunc()
83 void SetBlendFunc( BlendingFactor::Type srcFactorRgb, BlendingFactor::Type destFactorRgb,
84 BlendingFactor::Type srcFactorAlpha, BlendingFactor::Type destFactorAlpha );
87 * @copydoc Dali::RenderableActor::GetBlendFunc()
89 void GetBlendFunc( BlendingFactor::Type& srcFactorRgb, BlendingFactor::Type& destFactorRgb,
90 BlendingFactor::Type& srcFactorAlpha, BlendingFactor::Type& destFactorAlpha ) const;
93 * @copydoc Dali::RenderableActor::SetBlendEquation()
95 void SetBlendEquation( BlendingEquation::Type equationRgb, BlendingEquation::Type equationAlpha );
98 * @copydoc Dali::RenderableActor::GetBlendEquation()
100 void GetBlendEquation( BlendingEquation::Type& equationRgb, BlendingEquation::Type& equationAlpha ) const;
103 * @copydoc Dali::RenderableActor::SetBlendColor()
105 void SetBlendColor( const Vector4& color );
108 * @copydoc Dali::RenderableActor::GetBlendColor()
110 const Vector4& GetBlendColor() const;
115 * Protected constructor; only base classes are instantiatable.
116 * @param[in] stage Used to send messages to scene-graph.
118 RenderableAttachment( Stage& stage );
121 * A reference counted object may only be deleted by calling Unreference()
123 virtual ~RenderableAttachment();
128 RenderableAttachment(const RenderableAttachment&);
131 RenderableAttachment& operator=(const RenderableAttachment& rhs);
134 * Helper for getting the scene-graph renderable attachment.
135 * @return The scene object.
137 const SceneGraph::RenderableAttachment& GetSceneAttachment() const;
140 * @copydoc Dali::Internal::ActorAttachment::OnStageConnection()
142 virtual void OnStageConnection();
145 * @copydoc Dali::Internal::ActorAttachment::OnStageDisconnection()
147 virtual void OnStageDisconnection();
150 * For derived classes, chained from OnStageConnection()
152 virtual void OnStageConnection2() = 0;
155 * For derived classes, chained from OnStageDisconnection()
157 virtual void OnStageDisconnection2() = 0;
160 * For derived classes to provide a corresponding scene-graph object
161 * @return The scene-object.
163 virtual const SceneGraph::RenderableAttachment& GetSceneObject() const = 0;
167 // Cached for actor-thread getters
169 CullFaceMode mCullFaceMode;
170 BlendingMode::Type mBlendingMode;
171 BlendingOptions mBlendingOptions;
174 } // namespace Internal
178 #endif // __DALI_INTERNAL_RENDERABLE_ATTACHMENT_H__