#define DALI_INTERNAL_SHADER_H
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
// INTERNAL INCLUDES
#include <dali/public-api/common/dali-common.h> // DALI_ASSERT_ALWAYS
#include <dali/public-api/common/intrusive-ptr.h> // Dali::IntrusivePtr
-#include <dali/devel-api/rendering/shader.h> // Dali::Shader
-#include <dali/internal/event/common/connectable.h> // Dali::Internal::Connectable
+#include <dali/public-api/rendering/shader.h> // Dali::Shader
#include <dali/internal/event/common/object-connector.h> // Dali::Internal::ObjectConnector
#include <dali/internal/event/common/object-impl.h> // Dali::Internal::Object
-#include <dali/internal/event/resources/resource-ticket.h> // Dali::Internal::ResourceTicketPtr
+#include <dali/internal/common/shader-data.h> // ShaderPtr
namespace Dali
{
* Shader is an object that contains an array of structures of values that
* can be accessed as properties.
*/
-class Shader : public Object, public Connectable
+class Shader : public Object
{
public:
*/
static ShaderPtr New( const std::string& vertexShader,
const std::string& fragmentShader,
- Dali::Shader::ShaderHints hints );
+ Dali::Shader::Hint::Value hints );
/**
- * @brief Get the shader scene object
- *
- * @return the shader scene object
+ * Retrieve the scene-graph shader added by this object.
+ * @return A pointer to the shader.
*/
- const SceneGraph::Shader* GetShaderSceneObject() const;
+ const SceneGraph::Shader& GetShaderSceneObject() const;
public: // Default property extensions from Object
/**
- * @copydoc Dali::Internal::Object::GetDefaultPropertyCount()
- */
- virtual unsigned int GetDefaultPropertyCount() const;
-
- /**
- * @copydoc Dali::Internal::Object::GetDefaultPropertyIndices()
- */
- virtual void GetDefaultPropertyIndices( Property::IndexContainer& indices ) const;
-
- /**
- * @copydoc Dali::Internal::Object::GetDefaultPropertyName()
- */
- virtual const char* GetDefaultPropertyName(Property::Index index) const;
-
- /**
- * @copydoc Dali::Internal::Object::GetDefaultPropertyIndex()
- */
- virtual Property::Index GetDefaultPropertyIndex(const std::string& name) const;
-
- /**
- * @copydoc Dali::Internal::Object::IsDefaultPropertyWritable()
- */
- virtual bool IsDefaultPropertyWritable(Property::Index index) const;
-
- /**
- * @copydoc Dali::Internal::Object::IsDefaultPropertyAnimatable()
- */
- virtual bool IsDefaultPropertyAnimatable(Property::Index index) const;
-
- /**
- * @copydoc Dali::Internal::Object::IsDefaultPropertyAConstraintInput()
- */
- virtual bool IsDefaultPropertyAConstraintInput( Property::Index index ) const;
-
- /**
- * @copydoc Dali::Internal::Object::GetDefaultPropertyType()
- */
- virtual Property::Type GetDefaultPropertyType(Property::Index index) const;
-
- /**
* @copydoc Dali::Internal::Object::SetDefaultProperty()
*/
virtual void SetDefaultProperty(Property::Index index, const Property::Value& propertyValue);
/**
- * @copydoc Dali::Internal::Object::SetSceneGraphProperty()
- */
- virtual void SetSceneGraphProperty( Property::Index index, const PropertyMetadata& entry, const Property::Value& value );
-
- /**
* @copydoc Dali::Internal::Object::GetDefaultProperty()
*/
virtual Property::Value GetDefaultProperty( Property::Index index ) const;
/**
- * @copydoc Dali::Internal::Object::GetPropertyOwner()
- */
- virtual const SceneGraph::PropertyOwner* GetPropertyOwner() const;
-
- /**
- * @copydoc Dali::Internal::Object::GetSceneObject()
- */
- virtual const SceneGraph::PropertyOwner* GetSceneObject() const;
-
- /**
- * @copydoc Dali::Internal::Object::GetSceneObjectAnimatableProperty()
- */
- virtual const SceneGraph::PropertyBase* GetSceneObjectAnimatableProperty( Property::Index index ) const;
-
- /**
- * @copydoc Dali::Internal::Object::GetSceneObjectInputProperty()
- */
- virtual const PropertyInputImpl* GetSceneObjectInputProperty( Property::Index index ) const;
-
- /**
- * @copydoc Dali::Internal::Object::GetPropertyComponentIndex()
- */
- virtual int GetPropertyComponentIndex( Property::Index index ) const;
-
-public: // Functions from Connectable
- /**
- * @copydoc Dali::Internal::Connectable::OnStage()
+ * @copydoc Dali::Internal::Object::GetDefaultPropertyCurrentValue()
*/
- virtual bool OnStage() const;
+ virtual Property::Value GetDefaultPropertyCurrentValue( Property::Index index ) const;
- /**
- * @copydoc Dali::Internal::Connectable::Connect()
- */
- virtual void Connect();
+private: // implementation
/**
- * @copydoc Dali::Internal::Connectable::Disconnect()
+ * Constructor
+ *
+ * @param sceneObject the scene object
*/
- virtual void Disconnect();
-
-private: // implementation
- Shader();
+ Shader( const SceneGraph::Shader* sceneObject );
/**
* Second stage initialization
*/
- void Initialize( const std::string& vertexShader, const std::string& fragmentShader, Dali::Shader::ShaderHints hints );
+ void SetShader( const std::string& vertexShader, const std::string& fragmentShader, Dali::Shader::Hint::Value hints );
protected:
/**
virtual ~Shader();
private: // unimplemented methods
- Shader( const Shader& );
- Shader& operator=( const Shader& );
+
+ Shader() = delete;
+ Shader( const Shader& ) = delete;
+ Shader& operator=( const Shader& ) = delete;
private:
- SceneGraph::Shader* mSceneObject;
- ResourceTicketPtr mTicket;
- bool mOnStage;
+
+ Internal::ShaderDataPtr mShaderData;
+
};
} // namespace Internal