Event side structure.
[platform/core/uifw/dali-core.git] / dali / internal / event / actors / renderer-impl.cpp
1 /*
2  * Copyright (c) 2015 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 // CLASS HEADER
19 #include <dali/internal/event/actors/renderer-impl.h> // Dali::Internal::Renderer
20
21 // INTERNAL INCLUDES
22 #include <dali/public-api/actors/renderer.h> // Dali::Renderer
23 #include <dali/internal/event/common/object-impl-helper.h> // Dali::Internal::ObjectHelper
24 #include <dali/internal/event/common/property-helper.h> // DALI_PROPERTY_TABLE_BEGIN, DALI_PROPERTY, DALI_PROPERTY_TABLE_END
25
26 namespace Dali
27 {
28 namespace Internal
29 {
30
31 namespace
32 {
33
34 /**
35  *            |name          |type     |writable|animatable|constraint-input|enum for index-checking|
36  */
37 DALI_PROPERTY_TABLE_BEGIN
38 DALI_PROPERTY( "depth-index", INTEGER,  true, true, true, Dali::Renderer::Property::DEPTH_INDEX )
39 DALI_PROPERTY_TABLE_END( DEFAULT_DERIVED_HANDLE_PROPERTY_START_INDEX )
40
41 const ObjectImplHelper<DEFAULT_PROPERTY_COUNT> RENDERER_IMPL = { DEFAULT_PROPERTY_DETAILS };
42
43 } // unnamed namespace
44
45 RendererPtr Renderer::New()
46 {
47   return RendererPtr( new Renderer() );
48 }
49
50 void Renderer::SetGeometry( Geometry& geometry )
51 {
52   mGeometryConnector.Set( geometry, OnStage() );
53 }
54
55 void Renderer::SetMaterial( Material& material )
56 {
57   mMaterialConnector.Set( material, OnStage() );
58 }
59
60 void Renderer::SetDepthIndex( int depthIndex )
61 {
62   //SceneGraph::NodePropertyMessage<Vector3>::Send( mStage->GetUpdateManager(), mNode, &mNode->mPosition, &AnimatableProperty<Vector3>::Bake, position );
63   // TODO: MESH_REWORK
64   DALI_ASSERT_ALWAYS( false && "TODO: MESH_REWORK" );
65 }
66
67 unsigned int Renderer::GetDefaultPropertyCount() const
68 {
69   return RENDERER_IMPL.GetDefaultPropertyCount();
70 }
71
72 void Renderer::GetDefaultPropertyIndices( Property::IndexContainer& indices ) const
73 {
74   RENDERER_IMPL.GetDefaultPropertyIndices( indices );
75 }
76
77 const char* Renderer::GetDefaultPropertyName(Property::Index index) const
78 {
79   return RENDERER_IMPL.GetDefaultPropertyName( index );
80 }
81
82 Property::Index Renderer::GetDefaultPropertyIndex( const std::string& name ) const
83 {
84   return RENDERER_IMPL.GetDefaultPropertyIndex( name );
85 }
86
87 bool Renderer::IsDefaultPropertyWritable( Property::Index index ) const
88 {
89   return RENDERER_IMPL.IsDefaultPropertyWritable( index );
90 }
91
92 bool Renderer::IsDefaultPropertyAnimatable( Property::Index index ) const
93 {
94   return RENDERER_IMPL.IsDefaultPropertyAnimatable( index );
95 }
96
97 bool Renderer::IsDefaultPropertyAConstraintInput( Property::Index index ) const
98 {
99   return RENDERER_IMPL.IsDefaultPropertyAConstraintInput( index );
100 }
101
102 Property::Type Renderer::GetDefaultPropertyType( Property::Index index ) const
103 {
104   return RENDERER_IMPL.GetDefaultPropertyType( index );
105 }
106
107 void Renderer::SetDefaultProperty( Property::Index index,
108                                    const Property::Value& propertyValue )
109 {
110   RENDERER_IMPL.SetDefaultProperty( index, propertyValue );
111 }
112
113 void Renderer::SetSceneGraphProperty( Property::Index index,
114                                       const CustomProperty& entry,
115                                       const Property::Value& value )
116 {
117   RENDERER_IMPL.SetSceneGraphProperty( index, entry, value );
118 }
119
120 Property::Value Renderer::GetDefaultProperty( Property::Index index ) const
121 {
122   return RENDERER_IMPL.GetDefaultProperty( index );
123 }
124
125 const SceneGraph::PropertyOwner* Renderer::GetPropertyOwner() const
126 {
127   return RENDERER_IMPL.GetPropertyOwner();
128 }
129
130 const SceneGraph::PropertyOwner* Renderer::GetSceneObject() const
131 {
132   return RENDERER_IMPL.GetSceneObject();
133 }
134
135 const SceneGraph::PropertyBase* Renderer::GetSceneObjectAnimatableProperty( Property::Index index ) const
136 {
137   return RENDERER_IMPL.GetSceneObjectAnimatableProperty( index );
138 }
139
140 const PropertyInputImpl* Renderer::GetSceneObjectInputProperty( Property::Index index ) const
141 {
142   return RENDERER_IMPL.GetSceneObjectInputProperty( index );
143 }
144
145 int Renderer::GetPropertyComponentIndex( Property::Index index ) const
146 {
147   return RENDERER_IMPL.GetPropertyComponentIndex( index );
148 }
149
150 bool Renderer::OnStage() const
151 {
152   // TODO: MESH_REWORK
153   DALI_ASSERT_ALWAYS( false && "TODO: MESH_REWORK" );
154   return false;
155 }
156
157 void Renderer::Connect()
158 {
159   // TODO: MESH_REWORK : check this
160   mGeometryConnector.OnStageConnect();
161   mMaterialConnector.OnStageConnect();
162 }
163
164 void Renderer::Disconnect()
165 {
166   // TODO: MESH_REWORK : check this
167   mGeometryConnector.OnStageDisconnect();
168   mMaterialConnector.OnStageDisconnect();
169 }
170
171 Renderer::Renderer()
172 {
173 }
174
175 } // namespace Internal
176 } // namespace Dali
177