1 #ifndef DALI_INTERNAL_SCENE_GRAPH_RENDERER_ATTACHMENT_H
2 #define DALI_INTERNAL_SCENE_GRAPH_RENDERER_ATTACHMENT_H
5 * Copyright (c) 2015 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0
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.
20 #include <dali/internal/update/common/double-buffered.h>
21 #include <dali/internal/update/common/property-owner.h>
22 #include <dali/internal/update/node-attachments/scene-graph-renderable-attachment.h>
34 class RendererAttachment : public RenderableAttachment, public PropertyOwner
45 virtual ~RendererAttachment();
48 * Set the material for the renderer
49 * @param[in] material The material this renderer will use
51 void SetMaterial(const Material* material);
54 * Get the material of this renderer
55 * @return the material this renderer uses
57 const Material& GetMaterial() const;
60 * Set the geometry for the renderer
61 * @param[in] geometry The geometry this renderer will use
63 void SetGeometry(const Geometry* geometry);
66 * Get the geometry of this renderer
67 * @return the geometry this renderer uses
69 const Geometry& GetGeometry() const;
73 * @param[in] index The depth index to use
75 void SetDepthIndex( int index );
79 * @return The depth index to use
81 int GetDepthIndex() const ;
84 const Material* mMaterial; ///< The material this renderer uses. (Not owned)
85 const Geometry* mGeometry; ///< The geometry this renderer uses. (Not owned)
86 int mDepthIndex; ///< Used only in PrepareRenderInstructions
89 // Messages for RendererAttachment
91 inline void SetMaterialMessage( EventToUpdate& eventToUpdate, const RendererAttachment& attachment, const Material& material )
93 typedef MessageValue1< RendererAttachment, const Material* > LocalType;
95 // Reserve some memory inside the message queue
96 unsigned int* slot = eventToUpdate.ReserveMessageSlot( sizeof( LocalType ) );
98 // Construct message in the message queue memory; note that delete should not be called on the return value
99 new (slot) LocalType( &attachment, &RendererAttachment::SetMaterial, &material );
102 inline void SetGeometryMessage( EventToUpdate& eventToUpdate, const RendererAttachment& attachment, const Geometry& geometry )
104 typedef MessageValue1< RendererAttachment, const Geometry* > LocalType;
106 // Reserve some memory inside the message queue
107 unsigned int* slot = eventToUpdate.ReserveMessageSlot( sizeof( LocalType ) );
109 // Construct message in the message queue memory; note that delete should not be called on the return value
110 new (slot) LocalType( &attachment, &RendererAttachment::SetGeometry, &geometry );
113 inline void SetDepthIndexMessage( EventToUpdate& eventToUpdate, const RendererAttachment& attachment, int depthIndex )
115 typedef MessageValue1< RendererAttachment, int > LocalType;
117 // Reserve some memory inside the message queue
118 unsigned int* slot = eventToUpdate.ReserveMessageSlot( sizeof( LocalType ) );
120 // Construct message in the message queue memory; note that delete should not be called on the return value
121 new (slot) LocalType( &attachment, &RendererAttachment::SetDepthIndex, depthIndex );
124 } // namespace SceneGraph
125 } // namespace Internal
129 #endif // DALI_INTERNAL_SCENE_GRAPH_RENDERER_ATTACHMENT_H