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/Varying.h
00001 #pragma once
00002 #ifndef VARYING_H
00003 #define VARYING_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/Signal.h>
00010 #include <UniShader/Buffer.h>
00011 #include <UniShader/GLSLType.h>
00012 
00013 #include <string>
00014 
00015 UNISHADER_BEGIN
00016 
00017 class ShaderProgram;
00018 class ShaderOutput;
00019 
00021 
00035 class UniShader_API Varying : public SignalReceiver, public ObjectBase{
00036 public:
00037         Varying(ShaderProgram& program, ShaderOutput& output, std::string name);
00038         typedef SafePtr<Varying> Ptr; 
00039         typedef SafePtr<const Varying> PtrConst; 
00040         virtual const std::string& getClassName() const; 
00041         ~Varying();
00042 
00044 
00047         template <typename T> typename Buffer<T>::PtrConst getBuffer();
00048 
00050 
00053         const GLSLType& getGLSLType() const;
00054 
00056 
00059         std::string getName() const;
00060         
00062 
00066         bool prepare(unsigned int index, unsigned int primitiveCount, size_t* unitSize = 0);
00067 
00069 
00074         virtual bool handleSignal(unsigned int signalID, const ObjectBase* callerPtr);
00075 private:
00076         ShaderProgram& m_program;
00077         ShaderOutput& m_output;
00078         GLSLType m_glslType;
00079         std::string m_name;
00080         BufferBase::Ptr m_buffer;
00081         size_t m_unitSize;
00082         bool m_prepared;
00083 };
00084 
00085 UNISHADER_END
00086 
00087 #include <UniShader/Varying.inl>
00088 
00089 #endif