Dali 3D User Interface Engine
shader-effect-impl.h
Go to the documentation of this file.
1 #ifndef __DALI_INTERNAL_SHADER_EFFECT_H__
2 #define __DALI_INTERNAL_SHADER_EFFECT_H__
3 
4 /*
5  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
6  *
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
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
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.
18  *
19  */
20 
21 // INTERNAL INCLUDES
28 
29 namespace Dali
30 {
31 
32 namespace Internal
33 {
34 
40 class ShaderEffect : public Object
41 {
42 public:
44 
51 
55  void SetEffectImage( Dali::Image image );
56 
60  void SetUniform( const std::string& name,
61  Property::Value value,
62  UniformCoordinateType uniformCoordinateType );
63 
70  void SetPrograms( const std::string& vertexSource, const std::string& fragmentSource );
71 
81  void SetPrograms( const std::string& vertexPrefix, const std::string& fragmentPrefix,
82  const std::string& vertexSource, const std::string& fragmentSource );
83 
89  void Connect( ActorPtr actor );
90 
96  void Disconnect( ActorPtr actor );
97 
98 public:
99 
105  ShaderPtr GetShader() const { return mShader; }
106 
113  Vector2 GetGridSize( const Vector2& size );
114 
121 
122 public: // override property functions from Object
123 
127  virtual unsigned int GetPropertyCount() const;
128 
132  virtual std::string GetPropertyName( Property::Index index ) const;
133 
137  virtual Property::Index GetPropertyIndex( const std::string& name ) const;
138 
142  virtual bool IsPropertyWritable( Property::Index index ) const;
143 
147  virtual bool IsPropertyAnimatable( Property::Index index ) const;
148 
152  virtual bool IsPropertyAConstraintInput( Property::Index index ) const;
153 
157  virtual Property::Type GetPropertyType( Property::Index index ) const;
158 
162  virtual void SetProperty( Property::Index index, const Property::Value& propertyValue );
163 
167  virtual Property::Value GetProperty( Property::Index index ) const;
168 
172  virtual void GetPropertyIndices( Property::IndexContainer& indices ) const;
173 
177  virtual Property::Index RegisterProperty( const std::string& name, const Property::Value& propertyValue );
178 
182  virtual Property::Index RegisterProperty( const std::string& name, const Property::Value& propertyValue, Property::AccessMode accessMode );
183 
188  int componentIndex,
189  const Dali::PropertyCondition& condition );
190 
194  virtual void RemovePropertyNotification( Dali::PropertyNotification propertyNotification );
195 
199  virtual void RemovePropertyNotifications();
200 
201 public: // Default property extensions from Object
205  virtual unsigned int GetDefaultPropertyCount() const;
206 
210  virtual void GetDefaultPropertyIndices( Property::IndexContainer& indices ) const;
211 
215  virtual const char* GetDefaultPropertyName( Property::Index index ) const;
216 
220  virtual Property::Index GetDefaultPropertyIndex( const std::string& name ) const;
221 
225  virtual bool IsDefaultPropertyWritable( Property::Index index ) const;
226 
230  virtual bool IsDefaultPropertyAnimatable( Property::Index index ) const;
231 
235  virtual bool IsDefaultPropertyAConstraintInput( Property::Index index ) const;
236 
241 
245  virtual void SetDefaultProperty( Property::Index index, const Property::Value& propertyValue );
246 
250  virtual Property::Value GetDefaultProperty( Property::Index index ) const;
251 
255  virtual const SceneGraph::PropertyOwner* GetSceneObject() const;
256 
261 
265  virtual const PropertyInputImpl* GetSceneObjectInputProperty( Property::Index index ) const;
266 
270  virtual int GetPropertyComponentIndex( Property::Index index ) const;
271 
272 protected:
273 
279 
283  virtual ~ShaderEffect();
284 
285 private:
286 
287  // No copying allowed, thus these are undefined
288  ShaderEffect( const ShaderEffect& );
289  ShaderEffect& operator=( const ShaderEffect& rhs );
290 
291 private: // Data
292  std::vector< ActorPtr > mConnectedActors;
295  float mGridDensity;
297 
298 };
299 
300 } // namespace Internal
301 
302 // Helpers for public-api forwarding methods
303 
305 {
306  DALI_ASSERT_ALWAYS(effect && "ShaderEffect handle is empty");
307 
308  BaseObject& handle = effect.GetBaseObject();
309 
310  return static_cast<Internal::ShaderEffect&>(handle);
311 }
312 
314 {
315  DALI_ASSERT_ALWAYS(effect && "ShaderEffect handle is empty");
316 
317  const BaseObject& handle = effect.GetBaseObject();
318 
319  return static_cast<const Internal::ShaderEffect&>(handle);
320 }
321 
322 } // namespace Dali
323 
324 #endif // __DALI_INTERNAL_SHADER_EFFECT_H__
Dali Docs Home
Read more about Dali