PostFX.hpp
00001 00002 // 00003 // SFML - Simple and Fast Multimedia Library 00004 // Copyright (C) 2007-2009 Laurent Gomila ([email protected]) 00005 // 00006 // This software is provided 'as-is', without any express or implied warranty. 00007 // In no event will the authors be held liable for any damages arising from the use of this software. 00008 // 00009 // Permission is granted to anyone to use this software for any purpose, 00010 // including commercial applications, and to alter it and redistribute it freely, 00011 // subject to the following restrictions: 00012 // 00013 // 1. The origin of this software must not be misrepresented; 00014 // you must not claim that you wrote the original software. 00015 // If you use this software in a product, an acknowledgment 00016 // in the product documentation would be appreciated but is not required. 00017 // 00018 // 2. Altered source versions must be plainly marked as such, 00019 // and must not be misrepresented as being the original software. 00020 // 00021 // 3. This notice may not be removed or altered from any source distribution. 00022 // 00024 00025 #ifndef SFML_POSTFX_HPP 00026 #define SFML_POSTFX_HPP 00027 00029 // Headers 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 // Types 00180 typedef std::map<std::string, const Image*> TextureTable; 00181 00183 // Member data 00185 unsigned int myShaderProgram; 00186 TextureTable myTextures; 00187 std::string myFragmentShader; 00188 mutable Image myFrameBuffer; 00189 }; 00190 00191 } // namespace sf 00192 00193 00194 #endif // SFML_POSTFX_HPP
:: Copyright © 2007-2008 Laurent Gomila, all rights reserved :: Documentation generated by doxygen 1.5.2 ::