UniShader  1.0.0a
Interface for GPGPU and working with shader programs
 All Classes Functions Typedefs Enumerations Enumerator
D:/Visual Studio 2010/Projects/Unishader project/Unishader/include/UniShader/ShaderInput.h
00001 #pragma once
00002 #ifndef SHADER_INPUT_H
00003 #define SHADER_INPUT_H
00004 
00005 #include <UniShader/Config.h>
00006 #include <UniShader/Utility.h>
00007 #include <UniShader/ObjectBase.h>
00008 #include <UniShader/SafePtr.h>
00009 #include <UniShader/Attribute.h>
00010 #include <UniShader/Uniform.h>
00011 
00012 #include <deque>
00013 
00014 UNISHADER_BEGIN
00015 
00016 class ShaderProgram;
00017 
00019 
00023 class UniShader_API ShaderInput : public SignalReceiver, public ObjectBase{
00024 public:
00025         ShaderInput(ShaderProgram& program);
00026         typedef SafePtr<ShaderInput> Ptr; 
00027         typedef SafePtr<const ShaderInput> PtrConst; 
00028         virtual const std::string& getClassName() const; 
00029         ~ShaderInput();
00030 
00032 
00035         class SignalID{
00036         public:
00037                 enum Types{CHANGED 
00038                 }; 
00039         };
00040 
00042 
00048         Attribute::Ptr addAttribute(std::string name);
00049 
00051 
00057         Uniform::Ptr addUniform(std::string name);
00058 
00060 
00066         Attribute::Ptr getAttribute(std::string name);
00067 
00069 
00075         Uniform::Ptr getUniform(std::string name);
00076 
00078 
00083         void removeAttribute(std::string name);
00084 
00086 
00091         void removeUniform(std::string name);
00092 
00094 
00098         void prepare();
00099 
00101 
00104         void activate();
00105 
00107 
00111         bool isActive();
00112 
00114 
00117         void deactivate();
00118 
00120 
00125         virtual bool handleSignal(unsigned int signalID, const ObjectBase* callerPtr);
00126 private:        
00127         ShaderProgram& m_program;
00128         std::deque< std::shared_ptr<Attribute> > m_attribs;
00129         std::deque< std::shared_ptr<Uniform> > m_uniforms;
00130         unsigned int m_VAO;
00131         bool m_remakeVAO;
00132         bool m_active;
00133 };
00134 
00135 UNISHADER_END
00136 
00137 #endif