00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00024
00025 #ifndef SFML_POSTFX_HPP
00026 #define SFML_POSTFX_HPP
00027
00029
00031 #include <SFML/Graphics/Drawable.hpp>
00032 #include <SFML/Graphics/Image.hpp>
00033 #include <istream>
00034 #include <map>
00035 #include <string>
00036
00037
00038 namespace sf
00039 {
00043 class SFML_API PostFX : public Drawable
00044 {
00045 public :
00046
00051 PostFX();
00052
00059 PostFX(const PostFX& Copy);
00060
00065 ~PostFX();
00066
00075 bool LoadFromFile(const std::string& Filename);
00076
00085 bool LoadFromMemory(const std::string& Effect);
00086
00094 void SetParameter(const std::string& Name, float X);
00095
00103 void SetParameter(const std::string& Name, float X, float Y);
00104
00112 void SetParameter(const std::string& Name, float X, float Y, float Z);
00113
00121 void SetParameter(const std::string& Name, float X, float Y, float Z, float W);
00122
00130 void SetTexture(const std::string& Name, Image* Texture);
00131
00140 PostFX& operator =(const PostFX& Other);
00141
00148 static bool CanUsePostFX();
00149
00150 protected :
00151
00156 virtual void Render(RenderTarget& Target) const;
00157
00158 private :
00159
00169 static std::string PreprocessEffect(std::istream& File);
00170
00175 void CreateProgram();
00176
00178
00180 typedef std::map<std::string, const Image*> TextureTable;
00181
00183
00185 unsigned int myShaderProgram;
00186 TextureTable myTextures;
00187 std::string myFragmentShader;
00188 mutable Image myFrameBuffer;
00189 };
00190
00191 }
00192
00193
00194 #endif // SFML_POSTFX_HPP