diff --git a/CSFML/build/VC2005/csfml-audio.vcproj b/CSFML/build/VC2005/csfml-audio.vcproj index bc756366..0a4fa4ae 100644 --- a/CSFML/build/VC2005/csfml-audio.vcproj +++ b/CSFML/build/VC2005/csfml-audio.vcproj @@ -69,7 +69,7 @@ OutputFile="$(SolutionDir)..\..\lib\vc2005\$(ProjectName)-d.dll" LinkIncremental="2" AdditionalLibraryDirectories="$(SolutionDir)..\..\..\lib\vc2005\" - ModuleDefinitionFile="$(SolutionDir)/csfml-audio-d.def" + ModuleDefinitionFile="$(SolutionDir)../../src/SFML/Audio/csfml-audio-d.def" GenerateDebugInformation="true" ProgramDatabaseFile="$(IntDir)$(TargetName).pdb" SubSystem="2" @@ -155,7 +155,7 @@ OutputFile="$(SolutionDir)..\..\lib\vc2005\$(ProjectName).dll" LinkIncremental="1" AdditionalLibraryDirectories="$(SolutionDir)..\..\..\lib\vc2005\" - ModuleDefinitionFile="$(SolutionDir)/csfml-audio.def" + ModuleDefinitionFile="$(SolutionDir)../../src/SFML/Audio/csfml-audio.def" GenerateDebugInformation="true" ProgramDatabaseFile="$(IntDir)$(TargetName).pdb" SubSystem="2" @@ -193,11 +193,11 @@ - - - - - - @@ -293,6 +281,18 @@ RelativePath="..\..\src\SFML\Graphics\RenderWindowStruct.h" > + + + + + + diff --git a/CSFML/build/VC2005/csfml-network.vcproj b/CSFML/build/VC2005/csfml-network.vcproj index 7da73efe..0f30288f 100644 --- a/CSFML/build/VC2005/csfml-network.vcproj +++ b/CSFML/build/VC2005/csfml-network.vcproj @@ -68,7 +68,7 @@ OutputFile="$(SolutionDir)..\..\lib\vc2005\$(ProjectName)-d.dll" LinkIncremental="2" AdditionalLibraryDirectories="$(SolutionDir)..\..\..\lib\vc2005\" - ModuleDefinitionFile="$(SolutionDir)/csfml-network-d.def" + ModuleDefinitionFile="$(SolutionDir)../../src/SFML/Network/csfml-network-d.def" GenerateDebugInformation="true" ProgramDatabaseFile="$(IntDir)$(TargetName).pdb" SubSystem="2" @@ -153,7 +153,7 @@ OutputFile="$(SolutionDir)..\..\lib\vc2005\$(ProjectName).dll" LinkIncremental="1" AdditionalLibraryDirectories="$(SolutionDir)..\..\..\lib\vc2005\" - ModuleDefinitionFile="$(SolutionDir)/csfml-network.def" + ModuleDefinitionFile="$(SolutionDir)../../src/SFML/Network/csfml-network.def" GenerateDebugInformation="true" ProgramDatabaseFile="$(IntDir)$(TargetName).pdb" SubSystem="2" @@ -191,11 +191,11 @@ - - - - - - @@ -288,6 +276,18 @@ RelativePath="..\..\src\SFML\Graphics\RenderWindowStruct.h" > + + + + + + diff --git a/CSFML/build/VC2008/csfml-network-d.def b/CSFML/build/VC2008/csfml-network-d.def deleted file mode 100644 index 21647629..00000000 --- a/CSFML/build/VC2008/csfml-network-d.def +++ /dev/null @@ -1,127 +0,0 @@ -LIBRARY csfml-network-d -EXPORTS - sfFtpListingResponse_Destroy - sfFtpListingResponse_IsOk - sfFtpListingResponse_GetStatus - sfFtpListingResponse_GetMessage - sfFtpListingResponse_GetCount - sfFtpListingResponse_GetFilename - sfFtpDirectoryResponse_Destroy - sfFtpDirectoryResponse_IsOk - sfFtpDirectoryResponse_GetStatus - sfFtpDirectoryResponse_GetMessage - sfFtpDirectoryResponse_GetDirectory - sfFtpResponse_Destroy - sfFtpResponse_IsOk - sfFtpResponse_GetStatus - sfFtpResponse_GetMessage - sfFtp_Create - sfFtp_Destroy - sfFtp_Connect - sfFtp_LoginAnonymous - sfFtp_Login - sfFtp_Disconnect - sfFtp_KeepAlive - sfFtp_GetWorkingDirectory - sfFtp_GetDirectoryListing - sfFtp_ChangeDirectory - sfFtp_ParentDirectory - sfFtp_MakeDirectory - sfFtp_DeleteDirectory - sfFtp_RenameFile - sfFtp_DeleteFile - sfFtp_Download - sfFtp_Upload - sfHttpRequest_Create - sfHttpRequest_Destroy - sfHttpRequest_SetField - sfHttpRequest_SetMethod - sfHttpRequest_SetURI - sfHttpRequest_SetHttpVersion - sfHttpRequest_SetBody - sfHttpResponse_Destroy - sfHttpResponse_GetField - sfHttpResponse_GetStatus - sfHttpResponse_GetMajorVersion - sfHttpResponse_GetMinorVersion - sfHttpResponse_GetBody - sfHttp_Create - sfHttp_Destroy - sfHttp_SetHost - sfHttp_SendRequest - sfIPAddress_FromString - sfIPAddress_FromBytes - sfIPAddress_FromInteger - sfIPAddress_IsValid - sfIPAddress_ToString - sfIPAddress_ToInteger - sfIPAddress_GetLocalAddress - sfIPAddress_GetPublicAddress - sfIPAddress_LocalHost - sfSocketTCP_Create - sfSocketTCP_Destroy - sfSocketTCP_SetBlocking - sfSocketTCP_Connect - sfSocketTCP_Listen - sfSocketTCP_Accept - sfSocketTCP_Send - sfSocketTCP_Receive - sfSocketTCP_SendPacket - sfSocketTCP_ReceivePacket - sfSocketTCP_Close - sfSocketTCP_IsValid - sfSocketUDP_Create - sfSocketUDP_Destroy - sfSocketUDP_SetBlocking - sfSocketUDP_Bind - sfSocketUDP_Unbind - sfSocketUDP_Send - sfSocketUDP_Receive - sfSocketUDP_SendPacket - sfSocketUDP_ReceivePacket - sfSocketUDP_Close - sfSocketUDP_IsValid - sfPacket_Create - sfPacket_Destroy - sfPacket_Append - sfPacket_Clear - sfPacket_GetData - sfPacket_GetDataSize - sfPacket_EndOfPacket - sfPacket_CanRead - sfPacket_ReadBool - sfPacket_ReadInt8 - sfPacket_ReadUint8 - sfPacket_ReadInt16 - sfPacket_ReadUint16 - sfPacket_ReadInt32 - sfPacket_ReadUint32 - sfPacket_ReadFloat - sfPacket_ReadDouble - sfPacket_ReadString - sfPacket_ReadWideString - sfPacket_WriteBool - sfPacket_WriteInt8 - sfPacket_WriteUint8 - sfPacket_WriteInt16 - sfPacket_WriteUint16 - sfPacket_WriteInt32 - sfPacket_WriteUint32 - sfPacket_WriteFloat - sfPacket_WriteDouble - sfPacket_WriteString - sfPacket_WriteWideString - sfSelectorTCP_Create - sfSelectorTCP_Destroy - sfSelectorTCP_Add - sfSelectorTCP_Remove - sfSelectorTCP_Clear - sfSelectorTCP_Wait - sfSelectorTCP_GetSocketReady - sfSelectorUDP_Create - sfSelectorUDP_Destroy - sfSelectorUDP_Add - sfSelectorUDP_Remove - sfSelectorUDP_Clear - sfSelectorUDP_Wait - sfSelectorUDP_GetSocketReady diff --git a/CSFML/build/VC2008/csfml-network.def b/CSFML/build/VC2008/csfml-network.def deleted file mode 100644 index 2a27d528..00000000 --- a/CSFML/build/VC2008/csfml-network.def +++ /dev/null @@ -1,127 +0,0 @@ -LIBRARY csfml-network -EXPORTS - sfFtpListingResponse_Destroy - sfFtpListingResponse_IsOk - sfFtpListingResponse_GetStatus - sfFtpListingResponse_GetMessage - sfFtpListingResponse_GetCount - sfFtpListingResponse_GetFilename - sfFtpDirectoryResponse_Destroy - sfFtpDirectoryResponse_IsOk - sfFtpDirectoryResponse_GetStatus - sfFtpDirectoryResponse_GetMessage - sfFtpDirectoryResponse_GetDirectory - sfFtpResponse_Destroy - sfFtpResponse_IsOk - sfFtpResponse_GetStatus - sfFtpResponse_GetMessage - sfFtp_Create - sfFtp_Destroy - sfFtp_Connect - sfFtp_LoginAnonymous - sfFtp_Login - sfFtp_Disconnect - sfFtp_KeepAlive - sfFtp_GetWorkingDirectory - sfFtp_GetDirectoryListing - sfFtp_ChangeDirectory - sfFtp_ParentDirectory - sfFtp_MakeDirectory - sfFtp_DeleteDirectory - sfFtp_RenameFile - sfFtp_DeleteFile - sfFtp_Download - sfFtp_Upload - sfHttpRequest_Create - sfHttpRequest_Destroy - sfHttpRequest_SetField - sfHttpRequest_SetMethod - sfHttpRequest_SetURI - sfHttpRequest_SetHttpVersion - sfHttpRequest_SetBody - sfHttpResponse_Destroy - sfHttpResponse_GetField - sfHttpResponse_GetStatus - sfHttpResponse_GetMajorVersion - sfHttpResponse_GetMinorVersion - sfHttpResponse_GetBody - sfHttp_Create - sfHttp_Destroy - sfHttp_SetHost - sfHttp_SendRequest - sfIPAddress_FromString - sfIPAddress_FromBytes - sfIPAddress_FromInteger - sfIPAddress_IsValid - sfIPAddress_ToString - sfIPAddress_ToInteger - sfIPAddress_GetLocalAddress - sfIPAddress_GetPublicAddress - sfIPAddress_LocalHost - sfSocketTCP_Create - sfSocketTCP_Destroy - sfSocketTCP_SetBlocking - sfSocketTCP_Connect - sfSocketTCP_Listen - sfSocketTCP_Accept - sfSocketTCP_Send - sfSocketTCP_Receive - sfSocketTCP_SendPacket - sfSocketTCP_ReceivePacket - sfSocketTCP_Close - sfSocketTCP_IsValid - sfSocketUDP_Create - sfSocketUDP_Destroy - sfSocketUDP_SetBlocking - sfSocketUDP_Bind - sfSocketUDP_Unbind - sfSocketUDP_Send - sfSocketUDP_Receive - sfSocketUDP_SendPacket - sfSocketUDP_ReceivePacket - sfSocketUDP_Close - sfSocketUDP_IsValid - sfPacket_Create - sfPacket_Destroy - sfPacket_Append - sfPacket_Clear - sfPacket_GetData - sfPacket_GetDataSize - sfPacket_EndOfPacket - sfPacket_CanRead - sfPacket_ReadBool - sfPacket_ReadInt8 - sfPacket_ReadUint8 - sfPacket_ReadInt16 - sfPacket_ReadUint16 - sfPacket_ReadInt32 - sfPacket_ReadUint32 - sfPacket_ReadFloat - sfPacket_ReadDouble - sfPacket_ReadString - sfPacket_ReadWideString - sfPacket_WriteBool - sfPacket_WriteInt8 - sfPacket_WriteUint8 - sfPacket_WriteInt16 - sfPacket_WriteUint16 - sfPacket_WriteInt32 - sfPacket_WriteUint32 - sfPacket_WriteFloat - sfPacket_WriteDouble - sfPacket_WriteString - sfPacket_WriteWideString - sfSelectorTCP_Create - sfSelectorTCP_Destroy - sfSelectorTCP_Add - sfSelectorTCP_Remove - sfSelectorTCP_Clear - sfSelectorTCP_Wait - sfSelectorTCP_GetSocketReady - sfSelectorUDP_Create - sfSelectorUDP_Destroy - sfSelectorUDP_Add - sfSelectorUDP_Remove - sfSelectorUDP_Clear - sfSelectorUDP_Wait - sfSelectorUDP_GetSocketReady diff --git a/CSFML/build/VC2008/csfml-network.vcproj b/CSFML/build/VC2008/csfml-network.vcproj index bedc23af..88cace6b 100644 --- a/CSFML/build/VC2008/csfml-network.vcproj +++ b/CSFML/build/VC2008/csfml-network.vcproj @@ -69,7 +69,7 @@ OutputFile="$(SolutionDir)..\..\lib\vc2008\$(ProjectName)-d.dll" LinkIncremental="2" AdditionalLibraryDirectories="$(SolutionDir)..\..\..\lib\vc2008\" - ModuleDefinitionFile="$(SolutionDir)/csfml-network-d.def" + ModuleDefinitionFile="$(SolutionDir)../../src/SFML/Network/csfml-network-d.def" GenerateDebugInformation="true" ProgramDatabaseFile="$(IntDir)$(TargetName).pdb" SubSystem="2" @@ -153,7 +153,7 @@ OutputFile="$(SolutionDir)..\..\lib\vc2008\$(ProjectName).dll" LinkIncremental="1" AdditionalLibraryDirectories="$(SolutionDir)..\..\..\lib\vc2008\" - ModuleDefinitionFile="$(SolutionDir)/csfml-network.def" + ModuleDefinitionFile="$(SolutionDir)../../src/SFML/Network/csfml-network.def" GenerateDebugInformation="true" ProgramDatabaseFile="$(IntDir)$(TargetName).pdb" SubSystem="2" @@ -190,11 +190,11 @@ - + @@ -72,8 +72,8 @@ - - + + diff --git a/CSFML/include/SFML/Graphics.h b/CSFML/include/SFML/Graphics.h index 35de6312..c0cfb0eb 100644 --- a/CSFML/include/SFML/Graphics.h +++ b/CSFML/include/SFML/Graphics.h @@ -31,10 +31,12 @@ #include #include +#include #include -#include #include #include +#include +#include #include #include #include diff --git a/CSFML/include/SFML/Graphics/RenderImage.h b/CSFML/include/SFML/Graphics/RenderImage.h index fd2bd2ce..a55471e9 100644 --- a/CSFML/include/SFML/Graphics/RenderImage.h +++ b/CSFML/include/SFML/Graphics/RenderImage.h @@ -112,15 +112,26 @@ CSFML_API void sfRenderImage_Display(sfRenderImage* renderImage); //////////////////////////////////////////////////////////// /// Draw something on a renderimage /// -/// \param renderImage : Renderimage to draw in -/// \param postFX / sprite / string / shape : Object to draw +/// \param renderImage : Renderimage to draw in +/// \param sprite / string / shape : Object to draw /// //////////////////////////////////////////////////////////// -CSFML_API void sfRenderImage_DrawPostFX(sfRenderImage* renderImage, sfPostFX* postFX); CSFML_API void sfRenderImage_DrawSprite(sfRenderImage* renderImage, sfSprite* sprite); CSFML_API void sfRenderImage_DrawShape (sfRenderImage* renderImage, sfShape* shape); CSFML_API void sfRenderImage_DrawString(sfRenderImage* renderImage, sfString* string); +//////////////////////////////////////////////////////////// +/// Draw something on a renderimage with a shader +/// +/// \param renderImage : Renderimage to draw in +/// \param sprite / string / shape : Object to draw +/// \param shader : Shader to use +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfRenderImage_DrawSpriteWithShader(sfRenderImage* renderImage, sfSprite* sprite, sfShader* shader); +CSFML_API void sfRenderImage_DrawShapeWithShader (sfRenderImage* renderImage, sfShape* shape, sfShader* shader); +CSFML_API void sfRenderImage_DrawStringWithShader(sfRenderImage* renderImage, sfString* string, sfShader* shader); + //////////////////////////////////////////////////////////// /// Clear the renderimage with the given color /// @@ -199,7 +210,7 @@ CSFML_API sfImage* sfRenderImage_GetImage(sfRenderImage* renderImage); /// \return sfTrue if the RenderImage class can be used /// //////////////////////////////////////////////////////////// -CSFML_API sfBool sfRenderImage_CanUseRenderImage(); +CSFML_API sfBool sfRenderImage_IsAvailable(); #endif // SFML_RENDERIMAGE_H diff --git a/CSFML/include/SFML/Graphics/RenderWindow.h b/CSFML/include/SFML/Graphics/RenderWindow.h index ca695446..54235d40 100644 --- a/CSFML/include/SFML/Graphics/RenderWindow.h +++ b/CSFML/include/SFML/Graphics/RenderWindow.h @@ -292,15 +292,26 @@ CSFML_API void sfRenderWindow_SetJoystickThreshold(sfRenderWindow* renderWindow, //////////////////////////////////////////////////////////// /// Draw something on a renderwindow /// -/// \param renderWindow : Renderwindow to draw in -/// \param postFX / sprite / string / shape : Object to draw +/// \param renderWindow : Renderwindow to draw in +/// \param sprite / string / shape : Object to draw /// //////////////////////////////////////////////////////////// -CSFML_API void sfRenderWindow_DrawPostFX(sfRenderWindow* renderWindow, sfPostFX* postFX); CSFML_API void sfRenderWindow_DrawSprite(sfRenderWindow* renderWindow, sfSprite* sprite); CSFML_API void sfRenderWindow_DrawShape (sfRenderWindow* renderWindow, sfShape* shape); CSFML_API void sfRenderWindow_DrawString(sfRenderWindow* renderWindow, sfString* string); +//////////////////////////////////////////////////////////// +/// Draw something on a renderwindow with a shader +/// +/// \param renderWindow : Renderwindow to draw in +/// \param sprite / string / shape : Object to draw +/// \param shader : Shader to use +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfRenderWindow_DrawSpriteWithShader(sfRenderWindow* renderWindow, sfSprite* sprite, sfShader* shader); +CSFML_API void sfRenderWindow_DrawShapeWithShader (sfRenderWindow* renderWindow, sfShape* shape, sfShader* shader); +CSFML_API void sfRenderWindow_DrawStringWithShader(sfRenderWindow* renderWindow, sfString* string, sfShader* shader); + //////////////////////////////////////////////////////////// /// Clear the screen with the given color /// diff --git a/CSFML/include/SFML/Graphics/PostFX.h b/CSFML/include/SFML/Graphics/Shader.h similarity index 59% rename from CSFML/include/SFML/Graphics/PostFX.h rename to CSFML/include/SFML/Graphics/Shader.h index d7db0c22..e77f8448 100644 --- a/CSFML/include/SFML/Graphics/PostFX.h +++ b/CSFML/include/SFML/Graphics/Shader.h @@ -22,8 +22,8 @@ // //////////////////////////////////////////////////////////// -#ifndef SFML_POSTFX_H -#define SFML_POSTFX_H +#ifndef SFML_SHADER_H +#define SFML_SHADER_H //////////////////////////////////////////////////////////// // Headers @@ -33,90 +33,106 @@ //////////////////////////////////////////////////////////// -/// Create a new post-fx from a file +/// Create a new shader from a file /// /// \param filename : File to load /// -/// \return A new sfPostFX object, or NULL if it failed +/// \return A new sfShader object, or NULL if it failed /// //////////////////////////////////////////////////////////// -CSFML_API sfPostFX* sfPostFX_CreateFromFile(const char* Filename); +CSFML_API sfShader* sfShader_CreateFromFile(const char* Filename); //////////////////////////////////////////////////////////// -/// Create a new post-fx from an effect source code +/// Create a new shader from an effect source code /// /// \param effect : Source code of the effect /// -/// \return A new sfPostFX object, or NULL if it failed +/// \return A new sfShader object, or NULL if it failed /// //////////////////////////////////////////////////////////// -CSFML_API sfPostFX* sfPostFX_CreateFromMemory(const char* effect); +CSFML_API sfShader* sfShader_CreateFromMemory(const char* effect); //////////////////////////////////////////////////////////// -/// Destroy an existing post-fx +/// Destroy an existing shader /// -/// \param postFX : PostFX to delete +/// \param shader : Shader to delete /// //////////////////////////////////////////////////////////// -CSFML_API void sfPostFX_Destroy(sfPostFX* postFX); +CSFML_API void sfShader_Destroy(sfShader* shader); //////////////////////////////////////////////////////////// -/// Change a parameter of a post-fx (1 float) +/// Change a parameter of a shader (1 float) /// -/// \param postFX : Post-effect to modify +/// \param shader : Shader to modify /// \param name : Parameter name in the effect /// \param x : Value to assign /// //////////////////////////////////////////////////////////// -CSFML_API void sfPostFX_SetParameter1(sfPostFX* postFX, const char* name, float x); +CSFML_API void sfShader_SetParameter1(sfShader* shader, const char* name, float x); //////////////////////////////////////////////////////////// -/// Change a parameter of a post-fx (2 floats) +/// Change a parameter of a shader (2 floats) /// -/// \param postFX : Post-effect to modify +/// \param shader : Shader to modify /// \param name : Parameter name in the effect /// \param x, y : Values to assign /// //////////////////////////////////////////////////////////// -CSFML_API void sfPostFX_SetParameter2(sfPostFX* postFX, const char* name, float x, float y); +CSFML_API void sfShader_SetParameter2(sfShader* shader, const char* name, float x, float y); //////////////////////////////////////////////////////////// -/// Change a parameter of a post-fx (3 floats) +/// Change a parameter of a shader (3 floats) /// -/// \param postFX : Post-effect to modify +/// \param shader : Shader to modify /// \param name : Parameter name in the effect /// \param x, y, z : Values to assign /// //////////////////////////////////////////////////////////// -CSFML_API void sfPostFX_SetParameter3(sfPostFX* postFX, const char* name, float x, float y, float z); +CSFML_API void sfShader_SetParameter3(sfShader* shader, const char* name, float x, float y, float z); //////////////////////////////////////////////////////////// -/// Change a parameter of a post-fx (4 floats) +/// Change a parameter of a shader (4 floats) /// -/// \param postFX : Post-effect to modify +/// \param shader : Shader to modify /// \param name : Parameter name in the effect /// \param x, y, z, w : Values to assign /// //////////////////////////////////////////////////////////// -CSFML_API void sfPostFX_SetParameter4(sfPostFX* postFX, const char* name, float x, float y, float z, float w); +CSFML_API void sfShader_SetParameter4(sfShader* shader, const char* name, float x, float y, float z, float w); //////////////////////////////////////////////////////////// -/// Set a texture parameter in a post-fx +/// Set a texture parameter in a shader /// -/// \param postFX : Post-effect to modify +/// \param shader : Shader to modify /// \param name : Texture name in the effect -/// \param texture : Image to set (pass NULL to use content of current framebuffer) +/// \param texture : Image to set (pass NULL to use the texture of the object being drawn) /// //////////////////////////////////////////////////////////// -CSFML_API void sfPostFX_SetTexture(sfPostFX* postFX, const char* name, sfImage* texture); +CSFML_API void sfShader_SetTexture(sfShader* shader, const char* name, sfImage* texture); //////////////////////////////////////////////////////////// -/// Tell whether or not the system supports post-effects +/// Bind a shader for rendering /// -/// \return sfTrue if the system can use post-effects +/// \param shader : Shader to bind /// //////////////////////////////////////////////////////////// -CSFML_API sfBool sfPostFX_CanUsePostFX(); +CSFML_API void sfShader_Bind(sfShader* shader); + +//////////////////////////////////////////////////////////// +/// Unbind a shader +/// +/// \param shader : Shader to unbind +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfShader_Unbind(sfShader* shader); + +//////////////////////////////////////////////////////////// +/// Tell whether or not the system supports shaders +/// +/// \return sfTrue if the system can use shaders +/// +//////////////////////////////////////////////////////////// +CSFML_API sfBool sfShader_IsAvailable(); -#endif // SFML_POSTFX_H +#endif // SFML_SHADER_H diff --git a/CSFML/include/SFML/Graphics/Types.h b/CSFML/include/SFML/Graphics/Types.h index 10b8bb18..55783eaf 100644 --- a/CSFML/include/SFML/Graphics/Types.h +++ b/CSFML/include/SFML/Graphics/Types.h @@ -28,7 +28,7 @@ typedef struct sfFont sfFont; typedef struct sfImage sfImage; -typedef struct sfPostFX sfPostFX; +typedef struct sfShader sfShader; typedef struct sfRenderImage sfRenderImage; typedef struct sfRenderWindow sfRenderWindow; typedef struct sfShape sfShape; diff --git a/CSFML/src/SFML/Audio/SoundRecorder.cpp b/CSFML/src/SFML/Audio/SoundRecorder.cpp index 9332ac87..16e456de 100644 --- a/CSFML/src/SFML/Audio/SoundRecorder.cpp +++ b/CSFML/src/SFML/Audio/SoundRecorder.cpp @@ -84,7 +84,7 @@ unsigned int sfSoundRecorder_GetSampleRate(sfSoundRecorder* soundRecorder) /// Tell if the system supports sound capture. /// If not, this class won't be usable //////////////////////////////////////////////////////////// -sfBool sfSoundRecorder_CanCapture() +sfBool sfSoundRecorder_IsAvailable() { - return sf::SoundRecorder::CanCapture() ? sfTrue : sfFalse; + return sf::SoundRecorder::IsAvailable() ? sfTrue : sfFalse; } diff --git a/CSFML/build/VC2005/csfml-audio-d.def b/CSFML/src/SFML/Audio/csfml-audio-d.def similarity index 94% rename from CSFML/build/VC2005/csfml-audio-d.def rename to CSFML/src/SFML/Audio/csfml-audio-d.def index 253fa36d..8c7a296d 100644 --- a/CSFML/build/VC2005/csfml-audio-d.def +++ b/CSFML/src/SFML/Audio/csfml-audio-d.def @@ -77,7 +77,7 @@ EXPORTS sfSoundRecorder_Start sfSoundRecorder_Stop sfSoundRecorder_GetSampleRate - sfSoundRecorder_CanCapture + sfSoundRecorder_IsAvailable sfSoundStream_Create sfSoundStream_Destroy sfSoundStream_Play diff --git a/CSFML/build/VC2005/csfml-audio.def b/CSFML/src/SFML/Audio/csfml-audio.def similarity index 94% rename from CSFML/build/VC2005/csfml-audio.def rename to CSFML/src/SFML/Audio/csfml-audio.def index 84032e68..cd484dd3 100644 --- a/CSFML/build/VC2005/csfml-audio.def +++ b/CSFML/src/SFML/Audio/csfml-audio.def @@ -77,7 +77,7 @@ EXPORTS sfSoundRecorder_Start sfSoundRecorder_Stop sfSoundRecorder_GetSampleRate - sfSoundRecorder_CanCapture + sfSoundRecorder_IsAvailable sfSoundStream_Create sfSoundStream_Destroy sfSoundStream_Play diff --git a/CSFML/src/SFML/Graphics/RenderImage.cpp b/CSFML/src/SFML/Graphics/RenderImage.cpp index 657b375b..5a582b78 100644 --- a/CSFML/src/SFML/Graphics/RenderImage.cpp +++ b/CSFML/src/SFML/Graphics/RenderImage.cpp @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include #include #include @@ -118,21 +118,16 @@ void sfRenderImage_Display(sfRenderImage* renderImage) //////////////////////////////////////////////////////////// /// Draw something on a renderimage //////////////////////////////////////////////////////////// -void sfRenderImage_DrawPostFX(sfRenderImage* renderImage, sfPostFX* postFX) +void sfRenderImage_DrawSprite(sfRenderImage* renderImage, sfSprite* sprite) { - CSFML_CHECK(postFX); - CSFML_CALL(renderImage, Draw(postFX->This)); + CSFML_CHECK(sprite); + CSFML_CALL(renderImage, Draw(sprite->This)); } void sfRenderImage_DrawShape(sfRenderImage* renderImage, sfShape* shape) { CSFML_CHECK(shape); CSFML_CALL(renderImage, Draw(shape->This)); } -void sfRenderImage_DrawSprite(sfRenderImage* renderImage, sfSprite* sprite) -{ - CSFML_CHECK(sprite); - CSFML_CALL(renderImage, Draw(sprite->This)); -} void sfRenderImage_DrawString(sfRenderImage* renderImage, sfString* string) { CSFML_CHECK(string); @@ -140,6 +135,29 @@ void sfRenderImage_DrawString(sfRenderImage* renderImage, sfString* string) } +//////////////////////////////////////////////////////////// +/// Draw something on a renderimage with a shader +//////////////////////////////////////////////////////////// +void sfRenderImage_DrawSpriteWithShader(sfRenderImage* renderImage, sfSprite* sprite, sfShader* shader) +{ + CSFML_CHECK(sprite); + CSFML_CHECK(shader); + CSFML_CALL(renderImage, Draw(sprite->This, shader->This)); +} +void sfRenderImage_DrawShapeWithShader(sfRenderImage* renderImage, sfShape* shape, sfShader* shader) +{ + CSFML_CHECK(shape); + CSFML_CHECK(shader); + CSFML_CALL(renderImage, Draw(shape->This, shader->This)); +} +void sfRenderImage_DrawStringWithShader(sfRenderImage* renderImage, sfString* string, sfShader* shader) +{ + CSFML_CHECK(string); + CSFML_CHECK(shader); + CSFML_CALL(renderImage, Draw(string->This, shader->This)); +} + + //////////////////////////////////////////////////////////// /// Clear the renderimage with the given color //////////////////////////////////////////////////////////// @@ -235,7 +253,7 @@ sfImage* sfRenderImage_GetImage(sfRenderImage* renderImage) //////////////////////////////////////////////////////////// /// Check whether the system supports render images or not //////////////////////////////////////////////////////////// -sfBool sfRenderImage_CanUseRenderImage() +sfBool sfRenderImage_IsAvailable() { - return sf::RenderImage::CanUseRenderImage(); + return sf::RenderImage::IsAvailable() ? sfTrue : sfFalse; } diff --git a/CSFML/src/SFML/Graphics/RenderWindow.cpp b/CSFML/src/SFML/Graphics/RenderWindow.cpp index 9bc2984e..544c5130 100644 --- a/CSFML/src/SFML/Graphics/RenderWindow.cpp +++ b/CSFML/src/SFML/Graphics/RenderWindow.cpp @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include #include #include @@ -335,21 +335,16 @@ void sfRenderWindow_SetJoystickThreshold(sfRenderWindow* renderWindow, float thr //////////////////////////////////////////////////////////// /// Draw something on a renderwindow //////////////////////////////////////////////////////////// -void sfRenderWindow_DrawPostFX(sfRenderWindow* renderWindow, sfPostFX* postFX) +void sfRenderWindow_DrawSprite(sfRenderWindow* renderWindow, sfSprite* sprite) { - CSFML_CHECK(postFX); - CSFML_CALL(renderWindow, Draw(postFX->This)); + CSFML_CHECK(sprite); + CSFML_CALL(renderWindow, Draw(sprite->This)); } void sfRenderWindow_DrawShape(sfRenderWindow* renderWindow, sfShape* shape) { CSFML_CHECK(shape); CSFML_CALL(renderWindow, Draw(shape->This)); } -void sfRenderWindow_DrawSprite(sfRenderWindow* renderWindow, sfSprite* sprite) -{ - CSFML_CHECK(sprite); - CSFML_CALL(renderWindow, Draw(sprite->This)); -} void sfRenderWindow_DrawString(sfRenderWindow* renderWindow, sfString* string) { CSFML_CHECK(string); @@ -357,6 +352,29 @@ void sfRenderWindow_DrawString(sfRenderWindow* renderWindow, sfString* string) } +//////////////////////////////////////////////////////////// +/// Draw something on a renderwindow with a shader +//////////////////////////////////////////////////////////// +void sfRenderWindow_DrawSpriteWithShader(sfRenderWindow* renderWindow, sfSprite* sprite, sfShader* shader) +{ + CSFML_CHECK(sprite); + CSFML_CHECK(shader); + CSFML_CALL(renderWindow, Draw(sprite->This, shader->This)); +} +void sfRenderWindow_DrawShapeWithShader(sfRenderWindow* renderWindow, sfShape* shape, sfShader* shader) +{ + CSFML_CHECK(shape); + CSFML_CHECK(shader); + CSFML_CALL(renderWindow, Draw(shape->This, shader->This)); +} +void sfRenderWindow_DrawStringWithShader(sfRenderWindow* renderWindow, sfString* string, sfShader* shader) +{ + CSFML_CHECK(string); + CSFML_CHECK(shader); + CSFML_CALL(renderWindow, Draw(string->This, shader->This)); +} + + //////////////////////////////////////////////////////////// /// Clear the screen with the given color //////////////////////////////////////////////////////////// diff --git a/CSFML/src/SFML/Graphics/PostFX.cpp b/CSFML/src/SFML/Graphics/Shader.cpp similarity index 53% rename from CSFML/src/SFML/Graphics/PostFX.cpp rename to CSFML/src/SFML/Graphics/Shader.cpp index 3a2d9557..eec4a0ae 100644 --- a/CSFML/src/SFML/Graphics/PostFX.cpp +++ b/CSFML/src/SFML/Graphics/Shader.cpp @@ -25,104 +25,122 @@ //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// -#include -#include +#include +#include #include #include //////////////////////////////////////////////////////////// -/// Create a new post-fx from a file +/// Create a new shader from a file //////////////////////////////////////////////////////////// -sfPostFX* sfPostFX_CreateFromFile(const char* filename) +sfShader* sfShader_CreateFromFile(const char* filename) { - sfPostFX* postFX = new sfPostFX; + sfShader* shader = new sfShader; - if (!postFX->This.LoadFromFile(filename)) + if (!shader->This.LoadFromFile(filename)) { - delete postFX; - postFX = NULL; + delete shader; + shader = NULL; } - return postFX; + return shader; } //////////////////////////////////////////////////////////// -/// Create a new post-fx from an effect source code +/// Create a new shader from an effect source code //////////////////////////////////////////////////////////// -sfPostFX* sfPostFX_CreateFromMemory(const char* effect) +sfShader* sfShader_CreateFromMemory(const char* effect) { - sfPostFX* postFX = new sfPostFX; + sfShader* shader = new sfShader; - if (!postFX->This.LoadFromMemory(effect)) + if (!shader->This.LoadFromMemory(effect)) { - delete postFX; - postFX = NULL; + delete shader; + shader = NULL; } - return postFX; + return shader; } //////////////////////////////////////////////////////////// -/// Destroy an existing post-fx +/// Destroy an existing shader //////////////////////////////////////////////////////////// -void sfPostFX_Destroy(sfPostFX* postFX) +void sfShader_Destroy(sfShader* shader) { - delete postFX; + delete shader; } //////////////////////////////////////////////////////////// -/// Change a parameter of a post-fx (1 float) +/// Change a parameter of a shader (1 float) //////////////////////////////////////////////////////////// -void sfPostFX_SetParameter1(sfPostFX* postFX, const char* name, float x) +void sfShader_SetParameter1(sfShader* shader, const char* name, float x) { - CSFML_CALL(postFX, SetParameter(name, x)) + CSFML_CALL(shader, SetParameter(name, x)) } //////////////////////////////////////////////////////////// -/// Change a parameter of a post-fx (2 floats) +/// Change a parameter of a shader (2 floats) //////////////////////////////////////////////////////////// -void sfPostFX_SetParameter2(sfPostFX* postFX, const char* name, float x, float y) +void sfShader_SetParameter2(sfShader* shader, const char* name, float x, float y) { - CSFML_CALL(postFX, SetParameter(name, x, y)) + CSFML_CALL(shader, SetParameter(name, x, y)) } //////////////////////////////////////////////////////////// -/// Change a parameter of a post-fx (3 floats) +/// Change a parameter of a shader (3 floats) //////////////////////////////////////////////////////////// -void sfPostFX_SetParameter3(sfPostFX* postFX, const char* name, float x, float y, float z) +void sfShader_SetParameter3(sfShader* shader, const char* name, float x, float y, float z) { - CSFML_CALL(postFX, SetParameter(name, x, y, z)) + CSFML_CALL(shader, SetParameter(name, x, y, z)) } //////////////////////////////////////////////////////////// -/// Change a parameter of a post-fx (4 floats) +/// Change a parameter of a shader (4 floats) //////////////////////////////////////////////////////////// -void sfPostFX_SetParameter4(sfPostFX* postFX, const char* name, float x, float y, float z, float w) +void sfShader_SetParameter4(sfShader* shader, const char* name, float x, float y, float z, float w) { - CSFML_CALL(postFX, SetParameter(name, x, y, z, w)) + CSFML_CALL(shader, SetParameter(name, x, y, z, w)) } //////////////////////////////////////////////////////////// -/// Set a texture parameter in a post-fx +/// Set a texture parameter in a shader //////////////////////////////////////////////////////////// -void sfPostFX_SetTexture(sfPostFX* postFX, const char* name, sfImage* texture) +void sfShader_SetTexture(sfShader* shader, const char* name, sfImage* texture) { - CSFML_CALL(postFX, SetTexture(name, texture ? texture->This : NULL)) + CSFML_CALL(shader, SetTexture(name, texture && texture->This ? *texture->This : sf::Shader::CurrentTexture)) } //////////////////////////////////////////////////////////// -/// Tell whether or not the system supports post-effects +/// Bind a shader for rendering //////////////////////////////////////////////////////////// -sfBool sfPostFX_CanUsePostFX() +void sfShader_Bind(sfShader* shader) { - return sf::PostFX::CanUsePostFX() ? sfTrue : sfFalse; + CSFML_CALL(shader, Bind()) +} + + +//////////////////////////////////////////////////////////// +/// Unbind a shader +//////////////////////////////////////////////////////////// +void sfShader_Unbind(sfShader* shader) +{ + CSFML_CALL(shader, Unbind()) +} + + +//////////////////////////////////////////////////////////// +/// Tell whether or not the system supports shaders +//////////////////////////////////////////////////////////// +sfBool sfShader_IsAvailable() +{ + return sf::Shader::IsAvailable() ? sfTrue : sfFalse; } diff --git a/CSFML/src/SFML/Graphics/PostFXStruct.h b/CSFML/src/SFML/Graphics/ShaderStruct.h similarity index 85% rename from CSFML/src/SFML/Graphics/PostFXStruct.h rename to CSFML/src/SFML/Graphics/ShaderStruct.h index 584484b2..127f2965 100644 --- a/CSFML/src/SFML/Graphics/PostFXStruct.h +++ b/CSFML/src/SFML/Graphics/ShaderStruct.h @@ -22,22 +22,22 @@ // //////////////////////////////////////////////////////////// -#ifndef SFML_POSTFXSTRUCT_H -#define SFML_POSTFXSTRUCT_H +#ifndef SFML_SHADERSTRUCT_H +#define SFML_SHADERSTRUCT_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// -#include +#include //////////////////////////////////////////////////////////// -// Internal structure of sfPostFX +// Internal structure of sfShader //////////////////////////////////////////////////////////// -struct sfPostFX +struct sfShader { - sf::PostFX This; + sf::Shader This; }; -#endif // SFML_POSTFXSTRUCT_H +#endif // SFML_SHADERSTRUCT_H diff --git a/CSFML/src/SFML/Graphics/Shape.cpp b/CSFML/src/SFML/Graphics/Shape.cpp index 5aa6c909..2772030f 100644 --- a/CSFML/src/SFML/Graphics/Shape.cpp +++ b/CSFML/src/SFML/Graphics/Shape.cpp @@ -251,7 +251,7 @@ float sfShape_GetOriginY(sfShape* shape) sfColor sfShape_GetColor(sfShape* shape) { sfColor color = {0, 0, 0, 0}; - CSFML_CHECK_RETURN(Shape, color) + CSFML_CHECK_RETURN(shape, color) sf::Color SFMLColor = shape->This.GetColor(); return sfColor_FromRGBA(SFMLColor.r, SFMLColor.g, SFMLColor.b, SFMLColor.a); @@ -402,7 +402,7 @@ void sfShape_GetPointPosition(sfShape* shape, unsigned int index, float* x, floa sfColor sfShape_GetPointColor(sfShape* shape, unsigned int index) { sfColor color = {255, 255, 255, 255}; - CSFML_CHECK_RETURN(Shape, color) + CSFML_CHECK_RETURN(shape, color) const sf::Color& SFMLColor = shape->This.GetPointColor(index); color.r = SFMLColor.r; @@ -420,7 +420,7 @@ sfColor sfShape_GetPointColor(sfShape* shape, unsigned int index) sfColor sfShape_GetPointOutlineColor(sfShape* shape, unsigned int index) { sfColor color = {255, 255, 255, 255}; - CSFML_CHECK_RETURN(Shape, color) + CSFML_CHECK_RETURN(shape, color) const sf::Color& SFMLColor = shape->This.GetPointOutlineColor(index); color.r = SFMLColor.r; diff --git a/CSFML/build/VC2008/csfml-graphics-d.def b/CSFML/src/SFML/Graphics/csfml-graphics-d.def similarity index 86% rename from CSFML/build/VC2008/csfml-graphics-d.def rename to CSFML/src/SFML/Graphics/csfml-graphics-d.def index dfbec207..71dde90a 100644 --- a/CSFML/build/VC2008/csfml-graphics-d.def +++ b/CSFML/src/SFML/Graphics/csfml-graphics-d.def @@ -36,15 +36,17 @@ EXPORTS sfIntRect_Offset sfIntRect_Contains sfIntRect_Intersects - sfPostFX_CreateFromFile - sfPostFX_CreateFromMemory - sfPostFX_Destroy - sfPostFX_SetParameter1 - sfPostFX_SetParameter2 - sfPostFX_SetParameter3 - sfPostFX_SetParameter4 - sfPostFX_SetTexture - sfPostFX_CanUsePostFX + sfShader_CreateFromFile + sfShader_CreateFromMemory + sfShader_Destroy + sfShader_SetParameter1 + sfShader_SetParameter2 + sfShader_SetParameter3 + sfShader_SetParameter4 + sfShader_SetTexture + sfShader_Bind + sfShader_Unbind + sfShader_IsAvailable sfShape_Create sfShape_CreateLine sfShape_CreateRectangle @@ -173,17 +175,18 @@ EXPORTS sfRenderImage_SetActive sfRenderImage_Flush sfRenderImage_Display - sfRenderImage_DrawPostFX sfRenderImage_DrawSprite sfRenderImage_DrawShape sfRenderImage_DrawString + sfRenderImage_DrawSpriteWithShader + sfRenderImage_DrawShapeWithShader + sfRenderImage_DrawStringWithShader sfRenderImage_Clear sfRenderImage_SetView sfRenderImage_GetView sfRenderImage_GetDefaultView - sfRenderImage_PreserveOpenGLStates sfRenderImage_GetImage - sfRenderImage_CanUseRenderImage + sfRenderImage_IsAvailable sfRenderWindow_Create sfRenderWindow_CreateFromHandle sfRenderWindow_Destroy @@ -209,16 +212,17 @@ EXPORTS sfRenderWindow_SetFramerateLimit sfRenderWindow_GetFrameTime sfRenderWindow_SetJoystickThreshold - sfRenderWindow_DrawPostFX sfRenderWindow_DrawSprite sfRenderWindow_DrawString sfRenderWindow_DrawShape + sfRenderWindow_DrawSpriteWithShader + sfRenderWindow_DrawStringWithShader + sfRenderWindow_DrawShapeWithShader sfRenderWindow_Clear sfRenderWindow_SetView sfRenderWindow_GetView sfRenderWindow_GetDefaultView sfRenderWindow_ConvertCoords - sfRenderWindow_PreserveOpenGLStates sfView_Create sfView_CreateFromRect sfView_Destroy diff --git a/CSFML/build/VC2008/csfml-graphics.def b/CSFML/src/SFML/Graphics/csfml-graphics.def similarity index 86% rename from CSFML/build/VC2008/csfml-graphics.def rename to CSFML/src/SFML/Graphics/csfml-graphics.def index 29afa47d..c8c9ef4f 100644 --- a/CSFML/build/VC2008/csfml-graphics.def +++ b/CSFML/src/SFML/Graphics/csfml-graphics.def @@ -36,15 +36,17 @@ EXPORTS sfIntRect_Offset sfIntRect_Contains sfIntRect_Intersects - sfPostFX_CreateFromFile - sfPostFX_CreateFromMemory - sfPostFX_Destroy - sfPostFX_SetParameter1 - sfPostFX_SetParameter2 - sfPostFX_SetParameter3 - sfPostFX_SetParameter4 - sfPostFX_SetTexture - sfPostFX_CanUsePostFX + sfShader_CreateFromFile + sfShader_CreateFromMemory + sfShader_Destroy + sfShader_SetParameter1 + sfShader_SetParameter2 + sfShader_SetParameter3 + sfShader_SetParameter4 + sfShader_SetTexture + sfShader_Bind + sfShader_Unbind + sfShader_IsAvailable sfShape_Create sfShape_CreateLine sfShape_CreateRectangle @@ -173,10 +175,12 @@ EXPORTS sfRenderImage_SetActive sfRenderImage_Flush sfRenderImage_Display - sfRenderImage_DrawPostFX sfRenderImage_DrawSprite sfRenderImage_DrawShape sfRenderImage_DrawString + sfRenderImage_DrawSpriteWithShader + sfRenderImage_DrawShapeWithShader + sfRenderImage_DrawStringWithShader sfRenderImage_Clear sfRenderImage_SetView sfRenderImage_GetView @@ -184,7 +188,7 @@ EXPORTS sfRenderImage_GetViewport sfRenderImage_ConvertCoords sfRenderImage_GetImage - sfRenderImage_CanUseRenderImage + sfRenderImage_IsAvailable sfRenderWindow_Create sfRenderWindow_CreateFromHandle sfRenderWindow_Destroy @@ -210,10 +214,12 @@ EXPORTS sfRenderWindow_SetFramerateLimit sfRenderWindow_GetFrameTime sfRenderWindow_SetJoystickThreshold - sfRenderWindow_DrawPostFX sfRenderWindow_DrawSprite sfRenderWindow_DrawString sfRenderWindow_DrawShape + sfRenderWindow_DrawSpriteWithShader + sfRenderWindow_DrawStringWithShader + sfRenderWindow_DrawShapeWithShader sfRenderWindow_Clear sfRenderWindow_SetView sfRenderWindow_GetView diff --git a/CSFML/build/VC2005/csfml-network-d.def b/CSFML/src/SFML/Network/csfml-network-d.def similarity index 100% rename from CSFML/build/VC2005/csfml-network-d.def rename to CSFML/src/SFML/Network/csfml-network-d.def diff --git a/CSFML/build/VC2005/csfml-network.def b/CSFML/src/SFML/Network/csfml-network.def similarity index 100% rename from CSFML/build/VC2005/csfml-network.def rename to CSFML/src/SFML/Network/csfml-network.def diff --git a/CSFML/build/VC2005/csfml-system-d.def b/CSFML/src/SFML/System/csfml-system-d.def similarity index 100% rename from CSFML/build/VC2005/csfml-system-d.def rename to CSFML/src/SFML/System/csfml-system-d.def diff --git a/CSFML/build/VC2005/csfml-system.def b/CSFML/src/SFML/System/csfml-system.def similarity index 100% rename from CSFML/build/VC2005/csfml-system.def rename to CSFML/src/SFML/System/csfml-system.def diff --git a/CSFML/build/VC2005/csfml-window-d.def b/CSFML/src/SFML/Window/csfml-window-d.def similarity index 100% rename from CSFML/build/VC2005/csfml-window-d.def rename to CSFML/src/SFML/Window/csfml-window-d.def diff --git a/CSFML/build/VC2005/csfml-window.def b/CSFML/src/SFML/Window/csfml-window.def similarity index 100% rename from CSFML/build/VC2005/csfml-window.def rename to CSFML/src/SFML/Window/csfml-window.def diff --git a/build/codeblocks/SFML.workspace b/build/codeblocks/SFML.workspace index 56e3f261..deb7b670 100644 --- a/build/codeblocks/SFML.workspace +++ b/build/codeblocks/SFML.workspace @@ -12,7 +12,7 @@ - + diff --git a/build/vc2005/SFML.sln b/build/vc2005/SFML.sln index e55b3af3..e1562da7 100644 --- a/build/vc2005/SFML.sln +++ b/build/vc2005/SFML.sln @@ -8,8 +8,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sfml-audio", "sfml-audio.vc EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sfml-graphics", "sfml-graphics.vcproj", "{FA4620B1-393A-4719-9BB4-3BC8CAA70C4B}" ProjectSection(ProjectDependencies) = postProject - {C061A27D-7CA0-4179-9869-672FA04A86A8} = {C061A27D-7CA0-4179-9869-672FA04A86A8} {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED} = {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED} + {C061A27D-7CA0-4179-9869-672FA04A86A8} = {C061A27D-7CA0-4179-9869-672FA04A86A8} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sfml-main", "sfml-main.vcproj", "{2BD26A09-E1B6-42E2-A0D0-63987B76BB97}" @@ -25,18 +25,10 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sfml-window", "sfml-window. EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "opengl", "..\..\samples\build\vc2005\opengl.vcproj", "{4CD9A872-16EF-4C53-81FC-C7E77E782718}" ProjectSection(ProjectDependencies) = postProject - {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED} = {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED} - {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B} = {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B} - {C061A27D-7CA0-4179-9869-672FA04A86A8} = {C061A27D-7CA0-4179-9869-672FA04A86A8} {2BD26A09-E1B6-42E2-A0D0-63987B76BB97} = {2BD26A09-E1B6-42E2-A0D0-63987B76BB97} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "postfx", "..\..\samples\build\vc2005\postfx.vcproj", "{E8B7727D-2308-4ADC-90AE-D3F46798447D}" - ProjectSection(ProjectDependencies) = postProject - {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED} = {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED} - {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B} = {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B} {C061A27D-7CA0-4179-9869-672FA04A86A8} = {C061A27D-7CA0-4179-9869-672FA04A86A8} - {2BD26A09-E1B6-42E2-A0D0-63987B76BB97} = {2BD26A09-E1B6-42E2-A0D0-63987B76BB97} + {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B} = {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B} + {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED} = {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sockets", "..\..\samples\build\vc2005\sockets.vcproj", "{E6ED898F-218E-4467-8B1D-92E393283E1B}" @@ -46,58 +38,58 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sockets", "..\..\samples\bu EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sound", "..\..\samples\build\vc2005\sound.vcproj", "{11E3764D-850E-4EDA-9823-F66383A11042}" ProjectSection(ProjectDependencies) = postProject - {C061A27D-7CA0-4179-9869-672FA04A86A8} = {C061A27D-7CA0-4179-9869-672FA04A86A8} {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2} = {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2} + {C061A27D-7CA0-4179-9869-672FA04A86A8} = {C061A27D-7CA0-4179-9869-672FA04A86A8} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sound-capture", "..\..\samples\build\vc2005\sound-capture.vcproj", "{34EBDA13-AFA3-4AD9-AB64-2B2D40E09573}" ProjectSection(ProjectDependencies) = postProject - {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2} = {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2} {C061A27D-7CA0-4179-9869-672FA04A86A8} = {C061A27D-7CA0-4179-9869-672FA04A86A8} + {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2} = {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "voip", "..\..\samples\build\vc2005\voip.vcproj", "{4B169017-FFDD-4588-9658-6F1C9ABC6495}" ProjectSection(ProjectDependencies) = postProject - {823DDC98-42D5-4A38-88CF-9DC06C788AE4} = {823DDC98-42D5-4A38-88CF-9DC06C788AE4} - {C061A27D-7CA0-4179-9869-672FA04A86A8} = {C061A27D-7CA0-4179-9869-672FA04A86A8} {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2} = {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2} + {C061A27D-7CA0-4179-9869-672FA04A86A8} = {C061A27D-7CA0-4179-9869-672FA04A86A8} + {823DDC98-42D5-4A38-88CF-9DC06C788AE4} = {823DDC98-42D5-4A38-88CF-9DC06C788AE4} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "win32", "..\..\samples\build\vc2005\win32.vcproj", "{303EC049-639D-4F9C-9F33-D4B7F702275B}" ProjectSection(ProjectDependencies) = postProject - {C061A27D-7CA0-4179-9869-672FA04A86A8} = {C061A27D-7CA0-4179-9869-672FA04A86A8} - {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B} = {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B} {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED} = {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED} + {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B} = {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B} + {C061A27D-7CA0-4179-9869-672FA04A86A8} = {C061A27D-7CA0-4179-9869-672FA04A86A8} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "window", "..\..\samples\build\vc2005\window.vcproj", "{11E9ABEF-17A5-4FF7-91E5-994F34172F68}" ProjectSection(ProjectDependencies) = postProject - {2BD26A09-E1B6-42E2-A0D0-63987B76BB97} = {2BD26A09-E1B6-42E2-A0D0-63987B76BB97} - {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED} = {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED} {C061A27D-7CA0-4179-9869-672FA04A86A8} = {C061A27D-7CA0-4179-9869-672FA04A86A8} + {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED} = {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED} + {2BD26A09-E1B6-42E2-A0D0-63987B76BB97} = {2BD26A09-E1B6-42E2-A0D0-63987B76BB97} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wxwidgets", "..\..\samples\build\vc2005\wxwidgets.vcproj", "{8B3B274A-B3B7-4C6B-8D4A-5334E2116830}" ProjectSection(ProjectDependencies) = postProject - {C061A27D-7CA0-4179-9869-672FA04A86A8} = {C061A27D-7CA0-4179-9869-672FA04A86A8} - {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B} = {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B} {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED} = {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED} + {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B} = {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B} + {C061A27D-7CA0-4179-9869-672FA04A86A8} = {C061A27D-7CA0-4179-9869-672FA04A86A8} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "qt", "..\..\samples\build\vc2005\qt.vcproj", "{EAB1A0A4-8CCC-4A74-B3B5-9F60243581D2}" ProjectSection(ProjectDependencies) = postProject - {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED} = {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED} - {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B} = {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B} {C061A27D-7CA0-4179-9869-672FA04A86A8} = {C061A27D-7CA0-4179-9869-672FA04A86A8} + {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B} = {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B} + {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED} = {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pong", "..\..\samples\build\vc2005\pong.vcproj", "{DDDE27DC-5568-43EE-BD0E-57C581F73EDE}" ProjectSection(ProjectDependencies) = postProject - {C061A27D-7CA0-4179-9869-672FA04A86A8} = {C061A27D-7CA0-4179-9869-672FA04A86A8} - {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B} = {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B} - {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED} = {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED} - {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2} = {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2} {2BD26A09-E1B6-42E2-A0D0-63987B76BB97} = {2BD26A09-E1B6-42E2-A0D0-63987B76BB97} + {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2} = {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2} + {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED} = {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED} + {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B} = {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B} + {C061A27D-7CA0-4179-9869-672FA04A86A8} = {C061A27D-7CA0-4179-9869-672FA04A86A8} EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SFML", "SFML", "{C6D36691-1669-4189-AAB8-06C9932C2A45}" @@ -106,8 +98,16 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Samples", "Samples", "{3EE1 EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ftp", "..\..\samples\build\vc2005\ftp.vcproj", "{7236920B-254C-43A3-9DC1-778B477226DF}" ProjectSection(ProjectDependencies) = postProject - {C061A27D-7CA0-4179-9869-672FA04A86A8} = {C061A27D-7CA0-4179-9869-672FA04A86A8} {823DDC98-42D5-4A38-88CF-9DC06C788AE4} = {823DDC98-42D5-4A38-88CF-9DC06C788AE4} + {C061A27D-7CA0-4179-9869-672FA04A86A8} = {C061A27D-7CA0-4179-9869-672FA04A86A8} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "shader", "..\..\samples\build\vc2005\shader.vcproj", "{E8B7727D-2308-4ADC-90AE-D3F46798447D}" + ProjectSection(ProjectDependencies) = postProject + {2BD26A09-E1B6-42E2-A0D0-63987B76BB97} = {2BD26A09-E1B6-42E2-A0D0-63987B76BB97} + {C061A27D-7CA0-4179-9869-672FA04A86A8} = {C061A27D-7CA0-4179-9869-672FA04A86A8} + {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B} = {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B} + {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED} = {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED} EndProjectSection EndProject Global @@ -204,18 +204,6 @@ Global {4CD9A872-16EF-4C53-81FC-C7E77E782718}.Release static|Win32.Build.0 = Release|Win32 {4CD9A872-16EF-4C53-81FC-C7E77E782718}.Release|Win32.ActiveCfg = Release|Win32 {4CD9A872-16EF-4C53-81FC-C7E77E782718}.Release|Win32.Build.0 = Release|Win32 - {E8B7727D-2308-4ADC-90AE-D3F46798447D}.Debug DLL|Win32.ActiveCfg = Debug|Win32 - {E8B7727D-2308-4ADC-90AE-D3F46798447D}.Debug DLL|Win32.Build.0 = Debug|Win32 - {E8B7727D-2308-4ADC-90AE-D3F46798447D}.Debug static|Win32.ActiveCfg = Debug|Win32 - {E8B7727D-2308-4ADC-90AE-D3F46798447D}.Debug static|Win32.Build.0 = Debug|Win32 - {E8B7727D-2308-4ADC-90AE-D3F46798447D}.Debug|Win32.ActiveCfg = Debug|Win32 - {E8B7727D-2308-4ADC-90AE-D3F46798447D}.Debug|Win32.Build.0 = Debug|Win32 - {E8B7727D-2308-4ADC-90AE-D3F46798447D}.Release DLL|Win32.ActiveCfg = Release|Win32 - {E8B7727D-2308-4ADC-90AE-D3F46798447D}.Release DLL|Win32.Build.0 = Release|Win32 - {E8B7727D-2308-4ADC-90AE-D3F46798447D}.Release static|Win32.ActiveCfg = Release|Win32 - {E8B7727D-2308-4ADC-90AE-D3F46798447D}.Release static|Win32.Build.0 = Release|Win32 - {E8B7727D-2308-4ADC-90AE-D3F46798447D}.Release|Win32.ActiveCfg = Release|Win32 - {E8B7727D-2308-4ADC-90AE-D3F46798447D}.Release|Win32.Build.0 = Release|Win32 {E6ED898F-218E-4467-8B1D-92E393283E1B}.Debug DLL|Win32.ActiveCfg = Debug|Win32 {E6ED898F-218E-4467-8B1D-92E393283E1B}.Debug DLL|Win32.Build.0 = Debug|Win32 {E6ED898F-218E-4467-8B1D-92E393283E1B}.Debug static|Win32.ActiveCfg = Debug|Win32 @@ -336,6 +324,18 @@ Global {7236920B-254C-43A3-9DC1-778B477226DF}.Release static|Win32.Build.0 = Release|Win32 {7236920B-254C-43A3-9DC1-778B477226DF}.Release|Win32.ActiveCfg = Release|Win32 {7236920B-254C-43A3-9DC1-778B477226DF}.Release|Win32.Build.0 = Release|Win32 + {E8B7727D-2308-4ADC-90AE-D3F46798447D}.Debug DLL|Win32.ActiveCfg = Debug|Win32 + {E8B7727D-2308-4ADC-90AE-D3F46798447D}.Debug DLL|Win32.Build.0 = Debug|Win32 + {E8B7727D-2308-4ADC-90AE-D3F46798447D}.Debug static|Win32.ActiveCfg = Debug|Win32 + {E8B7727D-2308-4ADC-90AE-D3F46798447D}.Debug static|Win32.Build.0 = Debug|Win32 + {E8B7727D-2308-4ADC-90AE-D3F46798447D}.Debug|Win32.ActiveCfg = Debug|Win32 + {E8B7727D-2308-4ADC-90AE-D3F46798447D}.Debug|Win32.Build.0 = Debug|Win32 + {E8B7727D-2308-4ADC-90AE-D3F46798447D}.Release DLL|Win32.ActiveCfg = Release|Win32 + {E8B7727D-2308-4ADC-90AE-D3F46798447D}.Release DLL|Win32.Build.0 = Release|Win32 + {E8B7727D-2308-4ADC-90AE-D3F46798447D}.Release static|Win32.ActiveCfg = Release|Win32 + {E8B7727D-2308-4ADC-90AE-D3F46798447D}.Release static|Win32.Build.0 = Release|Win32 + {E8B7727D-2308-4ADC-90AE-D3F46798447D}.Release|Win32.ActiveCfg = Release|Win32 + {E8B7727D-2308-4ADC-90AE-D3F46798447D}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -347,7 +347,6 @@ Global {C061A27D-7CA0-4179-9869-672FA04A86A8} = {C6D36691-1669-4189-AAB8-06C9932C2A45} {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED} = {C6D36691-1669-4189-AAB8-06C9932C2A45} {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2} = {C6D36691-1669-4189-AAB8-06C9932C2A45} - {E8B7727D-2308-4ADC-90AE-D3F46798447D} = {3EE136A0-C638-4989-BE5A-E4007221CA28} {E6ED898F-218E-4467-8B1D-92E393283E1B} = {3EE136A0-C638-4989-BE5A-E4007221CA28} {11E3764D-850E-4EDA-9823-F66383A11042} = {3EE136A0-C638-4989-BE5A-E4007221CA28} {34EBDA13-AFA3-4AD9-AB64-2B2D40E09573} = {3EE136A0-C638-4989-BE5A-E4007221CA28} @@ -359,5 +358,6 @@ Global {DDDE27DC-5568-43EE-BD0E-57C581F73EDE} = {3EE136A0-C638-4989-BE5A-E4007221CA28} {4CD9A872-16EF-4C53-81FC-C7E77E782718} = {3EE136A0-C638-4989-BE5A-E4007221CA28} {7236920B-254C-43A3-9DC1-778B477226DF} = {3EE136A0-C638-4989-BE5A-E4007221CA28} + {E8B7727D-2308-4ADC-90AE-D3F46798447D} = {3EE136A0-C638-4989-BE5A-E4007221CA28} EndGlobalSection EndGlobal diff --git a/build/vc2005/sfml-graphics.vcproj b/build/vc2005/sfml-graphics.vcproj index 6945b204..cf08d988 100644 --- a/build/vc2005/sfml-graphics.vcproj +++ b/build/vc2005/sfml-graphics.vcproj @@ -3514,14 +3514,6 @@ RelativePath="..\..\include\SFML\Graphics\Matrix3.inl" > - - - - @@ -3546,6 +3538,14 @@ RelativePath="..\..\include\SFML\Graphics\RenderWindow.hpp" > + + + + diff --git a/build/vc2008/SFML.sln b/build/vc2008/SFML.sln index fd6efd10..8442ed71 100644 --- a/build/vc2008/SFML.sln +++ b/build/vc2008/SFML.sln @@ -45,14 +45,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pong", "..\..\samples\build {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED} = {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED} EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "postfx", "..\..\samples\build\vc2008\postfx.vcproj", "{E8B7727D-2308-4ADC-90AE-D3F46798447D}" - ProjectSection(ProjectDependencies) = postProject - {2BD26A09-E1B6-42E2-A0D0-63987B76BB97} = {2BD26A09-E1B6-42E2-A0D0-63987B76BB97} - {C061A27D-7CA0-4179-9869-672FA04A86A8} = {C061A27D-7CA0-4179-9869-672FA04A86A8} - {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B} = {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B} - {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED} = {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED} - EndProjectSection -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "qt", "..\..\samples\build\vc2008\qt.vcproj", "{EAB1A0A4-8CCC-4A74-B3B5-9F60243581D2}" ProjectSection(ProjectDependencies) = postProject {C061A27D-7CA0-4179-9869-672FA04A86A8} = {C061A27D-7CA0-4179-9869-672FA04A86A8} @@ -111,6 +103,14 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SFML", "SFML", "{8A8AFD7B-4 EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Samples", "Samples", "{BF8295B9-DE13-4CF5-A71F-A345BCA50D68}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "shader", "..\..\samples\build\vc2008\shader.vcproj", "{E8B7727D-2308-4ADC-90AE-D3F46798447D}" + ProjectSection(ProjectDependencies) = postProject + {2BD26A09-E1B6-42E2-A0D0-63987B76BB97} = {2BD26A09-E1B6-42E2-A0D0-63987B76BB97} + {C061A27D-7CA0-4179-9869-672FA04A86A8} = {C061A27D-7CA0-4179-9869-672FA04A86A8} + {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B} = {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B} + {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED} = {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED} + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug DLL|Win32 = Debug DLL|Win32 @@ -229,18 +229,6 @@ Global {DDDE27DC-5568-43EE-BD0E-57C581F73EDE}.Release static|Win32.Build.0 = Release|Win32 {DDDE27DC-5568-43EE-BD0E-57C581F73EDE}.Release|Win32.ActiveCfg = Release|Win32 {DDDE27DC-5568-43EE-BD0E-57C581F73EDE}.Release|Win32.Build.0 = Release|Win32 - {E8B7727D-2308-4ADC-90AE-D3F46798447D}.Debug DLL|Win32.ActiveCfg = Debug|Win32 - {E8B7727D-2308-4ADC-90AE-D3F46798447D}.Debug DLL|Win32.Build.0 = Debug|Win32 - {E8B7727D-2308-4ADC-90AE-D3F46798447D}.Debug static|Win32.ActiveCfg = Debug|Win32 - {E8B7727D-2308-4ADC-90AE-D3F46798447D}.Debug static|Win32.Build.0 = Debug|Win32 - {E8B7727D-2308-4ADC-90AE-D3F46798447D}.Debug|Win32.ActiveCfg = Debug|Win32 - {E8B7727D-2308-4ADC-90AE-D3F46798447D}.Debug|Win32.Build.0 = Debug|Win32 - {E8B7727D-2308-4ADC-90AE-D3F46798447D}.Release DLL|Win32.ActiveCfg = Release|Win32 - {E8B7727D-2308-4ADC-90AE-D3F46798447D}.Release DLL|Win32.Build.0 = Release|Win32 - {E8B7727D-2308-4ADC-90AE-D3F46798447D}.Release static|Win32.ActiveCfg = Release|Win32 - {E8B7727D-2308-4ADC-90AE-D3F46798447D}.Release static|Win32.Build.0 = Release|Win32 - {E8B7727D-2308-4ADC-90AE-D3F46798447D}.Release|Win32.ActiveCfg = Release|Win32 - {E8B7727D-2308-4ADC-90AE-D3F46798447D}.Release|Win32.Build.0 = Release|Win32 {EAB1A0A4-8CCC-4A74-B3B5-9F60243581D2}.Debug DLL|Win32.ActiveCfg = Debug|Win32 {EAB1A0A4-8CCC-4A74-B3B5-9F60243581D2}.Debug DLL|Win32.Build.0 = Debug|Win32 {EAB1A0A4-8CCC-4A74-B3B5-9F60243581D2}.Debug static|Win32.ActiveCfg = Debug|Win32 @@ -337,6 +325,18 @@ Global {8B3B274A-B3B7-4C6B-8D4A-5334E2116830}.Release static|Win32.Build.0 = Release|Win32 {8B3B274A-B3B7-4C6B-8D4A-5334E2116830}.Release|Win32.ActiveCfg = Release|Win32 {8B3B274A-B3B7-4C6B-8D4A-5334E2116830}.Release|Win32.Build.0 = Release|Win32 + {E8B7727D-2308-4ADC-90AE-D3F46798447D}.Debug DLL|Win32.ActiveCfg = Debug|Win32 + {E8B7727D-2308-4ADC-90AE-D3F46798447D}.Debug DLL|Win32.Build.0 = Debug|Win32 + {E8B7727D-2308-4ADC-90AE-D3F46798447D}.Debug static|Win32.ActiveCfg = Debug|Win32 + {E8B7727D-2308-4ADC-90AE-D3F46798447D}.Debug static|Win32.Build.0 = Debug|Win32 + {E8B7727D-2308-4ADC-90AE-D3F46798447D}.Debug|Win32.ActiveCfg = Debug|Win32 + {E8B7727D-2308-4ADC-90AE-D3F46798447D}.Debug|Win32.Build.0 = Debug|Win32 + {E8B7727D-2308-4ADC-90AE-D3F46798447D}.Release DLL|Win32.ActiveCfg = Release|Win32 + {E8B7727D-2308-4ADC-90AE-D3F46798447D}.Release DLL|Win32.Build.0 = Release|Win32 + {E8B7727D-2308-4ADC-90AE-D3F46798447D}.Release static|Win32.ActiveCfg = Release|Win32 + {E8B7727D-2308-4ADC-90AE-D3F46798447D}.Release static|Win32.Build.0 = Release|Win32 + {E8B7727D-2308-4ADC-90AE-D3F46798447D}.Release|Win32.ActiveCfg = Release|Win32 + {E8B7727D-2308-4ADC-90AE-D3F46798447D}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -350,7 +350,6 @@ Global {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2} = {8A8AFD7B-453B-40BE-9C46-A5748C1ABA45} {4CD9A872-16EF-4C53-81FC-C7E77E782718} = {BF8295B9-DE13-4CF5-A71F-A345BCA50D68} {DDDE27DC-5568-43EE-BD0E-57C581F73EDE} = {BF8295B9-DE13-4CF5-A71F-A345BCA50D68} - {E8B7727D-2308-4ADC-90AE-D3F46798447D} = {BF8295B9-DE13-4CF5-A71F-A345BCA50D68} {EAB1A0A4-8CCC-4A74-B3B5-9F60243581D2} = {BF8295B9-DE13-4CF5-A71F-A345BCA50D68} {E6ED898F-218E-4467-8B1D-92E393283E1B} = {BF8295B9-DE13-4CF5-A71F-A345BCA50D68} {11E3764D-850E-4EDA-9823-F66383A11042} = {BF8295B9-DE13-4CF5-A71F-A345BCA50D68} @@ -360,5 +359,6 @@ Global {11E9ABEF-17A5-4FF7-91E5-994F34172F68} = {BF8295B9-DE13-4CF5-A71F-A345BCA50D68} {8B3B274A-B3B7-4C6B-8D4A-5334E2116830} = {BF8295B9-DE13-4CF5-A71F-A345BCA50D68} {7236920B-254C-43A3-9DC1-778B477226DF} = {BF8295B9-DE13-4CF5-A71F-A345BCA50D68} + {E8B7727D-2308-4ADC-90AE-D3F46798447D} = {BF8295B9-DE13-4CF5-A71F-A345BCA50D68} EndGlobalSection EndGlobal diff --git a/build/vc2008/sfml-graphics.vcproj b/build/vc2008/sfml-graphics.vcproj index 97c31c1a..e1122b9a 100644 --- a/build/vc2008/sfml-graphics.vcproj +++ b/build/vc2008/sfml-graphics.vcproj @@ -3392,14 +3392,6 @@ RelativePath="..\..\include\SFML\Graphics\Drawable.hpp" > - - - - @@ -3545,6 +3537,14 @@ RelativePath="..\..\include\SFML\Graphics\RenderWindow.hpp" > + + + + diff --git a/dotnet/build/vc2008/SFML.net.sln b/dotnet/build/vc2008/SFML.net.sln index 58dac7a9..5a27e5f1 100644 --- a/dotnet/build/vc2008/SFML.net.sln +++ b/dotnet/build/vc2008/SFML.net.sln @@ -11,12 +11,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "sample-opengl", "..\..\samp EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "sample-window", "..\..\samples\window\sample-window.csproj", "{C1FBB9AF-B69A-4D06-9BDC-EAC7606296FF}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "sample-postfx", "..\..\samples\post-fx\sample-postfx.csproj", "{9D4738F7-34EA-433A-A765-AF85A52A174D}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "sample-sound", "..\..\samples\sound\sample-sound.csproj", "{16E177F3-A0FF-4091-8521-562E0EBAA3AB}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "sample-soundcapture", "..\..\samples\sound_capture\sample-soundcapture.csproj", "{F2F48990-F81E-41BA-AD01-168F6178C807}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "sample-shader", "..\..\samples\shader\sample-shader.csproj", "{9D4738F7-34EA-433A-A765-AF85A52A174D}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -43,10 +43,6 @@ Global {C1FBB9AF-B69A-4D06-9BDC-EAC7606296FF}.Debug|Any CPU.Build.0 = Debug|Any CPU {C1FBB9AF-B69A-4D06-9BDC-EAC7606296FF}.Release|Any CPU.ActiveCfg = Release|Any CPU {C1FBB9AF-B69A-4D06-9BDC-EAC7606296FF}.Release|Any CPU.Build.0 = Release|Any CPU - {9D4738F7-34EA-433A-A765-AF85A52A174D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {9D4738F7-34EA-433A-A765-AF85A52A174D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {9D4738F7-34EA-433A-A765-AF85A52A174D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {9D4738F7-34EA-433A-A765-AF85A52A174D}.Release|Any CPU.Build.0 = Release|Any CPU {16E177F3-A0FF-4091-8521-562E0EBAA3AB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {16E177F3-A0FF-4091-8521-562E0EBAA3AB}.Debug|Any CPU.Build.0 = Debug|Any CPU {16E177F3-A0FF-4091-8521-562E0EBAA3AB}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -55,6 +51,10 @@ Global {F2F48990-F81E-41BA-AD01-168F6178C807}.Debug|Any CPU.Build.0 = Debug|Any CPU {F2F48990-F81E-41BA-AD01-168F6178C807}.Release|Any CPU.ActiveCfg = Release|Any CPU {F2F48990-F81E-41BA-AD01-168F6178C807}.Release|Any CPU.Build.0 = Release|Any CPU + {9D4738F7-34EA-433A-A765-AF85A52A174D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9D4738F7-34EA-433A-A765-AF85A52A174D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9D4738F7-34EA-433A-A765-AF85A52A174D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9D4738F7-34EA-433A-A765-AF85A52A174D}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/dotnet/extlibs/csfml-audio.dll b/dotnet/extlibs/csfml-audio.dll index 2f22cbe3..aa85cc25 100644 Binary files a/dotnet/extlibs/csfml-audio.dll and b/dotnet/extlibs/csfml-audio.dll differ diff --git a/dotnet/extlibs/csfml-graphics.dll b/dotnet/extlibs/csfml-graphics.dll index 0aee4cfc..7f3712a9 100644 Binary files a/dotnet/extlibs/csfml-graphics.dll and b/dotnet/extlibs/csfml-graphics.dll differ diff --git a/dotnet/extlibs/csfml-window.dll b/dotnet/extlibs/csfml-window.dll index 32d43420..5165ca0e 100644 Binary files a/dotnet/extlibs/csfml-window.dll and b/dotnet/extlibs/csfml-window.dll differ diff --git a/dotnet/samples/bin/datas/post-fx/blur.sfx b/dotnet/samples/bin/datas/post-fx/blur.sfx deleted file mode 100644 index 04bfec53..00000000 --- a/dotnet/samples/bin/datas/post-fx/blur.sfx +++ /dev/null @@ -1,16 +0,0 @@ -texture framebuffer -float offset - -effect -{ - vec2 offx = vec2(offset, 0.0); - vec2 offy = vec2(0.0, offset); - - vec4 c0 = framebuffer(_in); - vec4 c1 = framebuffer(_in - offy); - vec4 c2 = framebuffer(_in + offy); - vec4 c3 = framebuffer(_in - offx); - vec4 c4 = framebuffer(_in + offx); - - _out = c0 * 0.2 + c1 * 0.2 + c2 * 0.2 + c3 * 0.2 + c4 * 0.2; -} diff --git a/dotnet/samples/bin/datas/post-fx/cheeseburger.ttf b/dotnet/samples/bin/datas/post-fx/cheeseburger.ttf deleted file mode 100644 index 47704266..00000000 Binary files a/dotnet/samples/bin/datas/post-fx/cheeseburger.ttf and /dev/null differ diff --git a/dotnet/samples/bin/datas/post-fx/colorize.sfx b/dotnet/samples/bin/datas/post-fx/colorize.sfx deleted file mode 100644 index bcb48ebc..00000000 --- a/dotnet/samples/bin/datas/post-fx/colorize.sfx +++ /dev/null @@ -1,10 +0,0 @@ -texture framebuffer -vec3 color - -effect -{ - vec4 pixel = framebuffer(_in); - float gray = pixel.r * 0.39 + pixel.g * 0.50 + pixel.b * 0.11; - - _out = vec4(gray * color, 1.0) * 0.6 + pixel * 0.4; -} diff --git a/dotnet/samples/bin/datas/post-fx/fisheye.sfx b/dotnet/samples/bin/datas/post-fx/fisheye.sfx deleted file mode 100644 index cbc31ee7..00000000 --- a/dotnet/samples/bin/datas/post-fx/fisheye.sfx +++ /dev/null @@ -1,12 +0,0 @@ -texture framebuffer -vec2 mouse - -effect -{ - float len = distance(_in, mouse) * 7.0; - - if (len < 1.0) - _out = framebuffer(_in + (_in - mouse) * len); - else - _out = framebuffer(_in); -} diff --git a/dotnet/samples/bin/datas/post-fx/nothing.sfx b/dotnet/samples/bin/datas/post-fx/nothing.sfx deleted file mode 100644 index 133b4e31..00000000 --- a/dotnet/samples/bin/datas/post-fx/nothing.sfx +++ /dev/null @@ -1,6 +0,0 @@ -texture framebuffer - -effect -{ - _out = framebuffer(_in); -} diff --git a/dotnet/samples/bin/datas/post-fx/pixelate.sfx b/dotnet/samples/bin/datas/post-fx/pixelate.sfx deleted file mode 100644 index a1ea9e0d..00000000 --- a/dotnet/samples/bin/datas/post-fx/pixelate.sfx +++ /dev/null @@ -1,11 +0,0 @@ -texture framebuffer -vec2 mouse - -effect -{ - float factor = 5 + 100 * length(mouse); - - vec2 pos = floor(_in * factor) / factor; - - _out = framebuffer(pos); -} diff --git a/dotnet/samples/bin/datas/post-fx/wave.sfx b/dotnet/samples/bin/datas/post-fx/wave.sfx deleted file mode 100644 index 49b46071..00000000 --- a/dotnet/samples/bin/datas/post-fx/wave.sfx +++ /dev/null @@ -1,12 +0,0 @@ -texture framebuffer -texture wave -vec2 offset - -effect -{ - vec2 texoffset = wave(_in * offset).xy; - texoffset -= vec2(0.5, 0.5); - texoffset *= 0.05; - - _out = framebuffer(_in + texoffset); -} diff --git a/dotnet/samples/bin/datas/shader/arial.ttf b/dotnet/samples/bin/datas/shader/arial.ttf new file mode 100644 index 00000000..ff0815cd Binary files /dev/null and b/dotnet/samples/bin/datas/shader/arial.ttf differ diff --git a/dotnet/samples/bin/datas/post-fx/background.jpg b/dotnet/samples/bin/datas/shader/background.jpg similarity index 100% rename from dotnet/samples/bin/datas/post-fx/background.jpg rename to dotnet/samples/bin/datas/shader/background.jpg diff --git a/dotnet/samples/bin/datas/shader/blur.sfx b/dotnet/samples/bin/datas/shader/blur.sfx new file mode 100644 index 00000000..4c9f1128 --- /dev/null +++ b/dotnet/samples/bin/datas/shader/blur.sfx @@ -0,0 +1,16 @@ +uniform sampler2D texture; +uniform float offset; + +void main() +{ + vec2 offx = vec2(offset, 0.0); + vec2 offy = vec2(0.0, offset); + + vec4 c0 = texture2D(texture, gl_TexCoord[0].xy); + vec4 c1 = texture2D(texture, gl_TexCoord[0].xy - offy); + vec4 c2 = texture2D(texture, gl_TexCoord[0].xy + offy); + vec4 c3 = texture2D(texture, gl_TexCoord[0].xy - offx); + vec4 c4 = texture2D(texture, gl_TexCoord[0].xy + offx); + + gl_FragColor = gl_Color * (c0 * 0.2 + c1 * 0.2 + c2 * 0.2 + c3 * 0.2 + c4 * 0.2); +} diff --git a/dotnet/samples/bin/datas/shader/colorize.sfx b/dotnet/samples/bin/datas/shader/colorize.sfx new file mode 100644 index 00000000..eeb407c8 --- /dev/null +++ b/dotnet/samples/bin/datas/shader/colorize.sfx @@ -0,0 +1,11 @@ +uniform sampler2D texture; +uniform vec3 color; + +void main() +{ + vec4 pixel = texture2D(texture, gl_TexCoord[0].xy) * gl_Color; + float gray = pixel.r * 0.39 + pixel.g * 0.50 + pixel.b * 0.11; + + gl_FragColor = vec4(gray * color, 1.0) * 0.6 + pixel * 0.4; + gl_FragColor.a = pixel.a; +} diff --git a/dotnet/samples/bin/datas/shader/fisheye.sfx b/dotnet/samples/bin/datas/shader/fisheye.sfx new file mode 100644 index 00000000..97e3f8e4 --- /dev/null +++ b/dotnet/samples/bin/datas/shader/fisheye.sfx @@ -0,0 +1,13 @@ +uniform sampler2D texture; +uniform vec2 mouse; + +void main() +{ + float len = distance(gl_TexCoord[0].xy, mouse) * 7.0; + + vec2 coords = gl_TexCoord[0].xy; + if (len < 1.0) + coords += (gl_TexCoord[0].xy - mouse) * len; + + gl_FragColor = texture2D(texture, coords) * gl_Color; +} diff --git a/dotnet/samples/bin/datas/shader/nothing.sfx b/dotnet/samples/bin/datas/shader/nothing.sfx new file mode 100644 index 00000000..cde0473a --- /dev/null +++ b/dotnet/samples/bin/datas/shader/nothing.sfx @@ -0,0 +1,6 @@ +uniform sampler2D texture; + +void main() +{ + gl_FragColor = texture2D(texture, gl_TexCoord[0].xy) * gl_Color; +} diff --git a/dotnet/samples/bin/datas/shader/pixelate.sfx b/dotnet/samples/bin/datas/shader/pixelate.sfx new file mode 100644 index 00000000..5b82f08d --- /dev/null +++ b/dotnet/samples/bin/datas/shader/pixelate.sfx @@ -0,0 +1,10 @@ +uniform sampler2D texture; +uniform vec2 mouse; + +void main() +{ + float factor = 5 + 100 * length(mouse); + vec2 pos = floor(gl_TexCoord[0].xy * factor + 0.5) / factor; + + gl_FragColor = texture2D(texture, pos) * gl_Color; +} diff --git a/dotnet/samples/bin/datas/post-fx/sprite.png b/dotnet/samples/bin/datas/shader/sprite.png similarity index 100% rename from dotnet/samples/bin/datas/post-fx/sprite.png rename to dotnet/samples/bin/datas/shader/sprite.png diff --git a/dotnet/samples/bin/datas/post-fx/wave.jpg b/dotnet/samples/bin/datas/shader/wave.jpg similarity index 100% rename from dotnet/samples/bin/datas/post-fx/wave.jpg rename to dotnet/samples/bin/datas/shader/wave.jpg diff --git a/dotnet/samples/bin/datas/shader/wave.sfx b/dotnet/samples/bin/datas/shader/wave.sfx new file mode 100644 index 00000000..2d04763a --- /dev/null +++ b/dotnet/samples/bin/datas/shader/wave.sfx @@ -0,0 +1,12 @@ +uniform sampler2D texture; +uniform sampler2D wave; +uniform vec2 offset; + +void main() +{ + vec2 texoffset = texture2D(wave, (gl_TexCoord[0].xy * offset).xy); + texoffset -= vec2(0.5, 0.5); + texoffset *= 0.05; + + gl_FragColor = texture2D(texture, gl_TexCoord[0].xy + texoffset) * gl_Color; +} diff --git a/dotnet/samples/post-fx/PostFx.cs b/dotnet/samples/post-fx/PostFx.cs deleted file mode 100644 index 7e2eea10..00000000 --- a/dotnet/samples/post-fx/PostFx.cs +++ /dev/null @@ -1,184 +0,0 @@ -using System; -using System.Collections.Generic; -using SFML; -using SFML.Graphics; -using SFML.Window; - -namespace sample_postfx -{ - static class Program - { - private static Dictionary effects; - private static Dictionary.Enumerator currentEffect; - private static String2D curFXStr; - - /// - /// The main entry point for the application. - /// - static void Main() - { - // Create the main window - RenderWindow window = new RenderWindow(new VideoMode(800, 600), "SFML.Net PostFX"); - - // Setup event handlers - window.Closed += new EventHandler(OnClosed); - window.KeyPressed += new EventHandler(OnKeyPressed); - - // Check that the system can use post effects - if (PostFx.CanUsePostFX == false) - { - DisplayError(window); - return; - } - - // Load a background image to display - Sprite background = new Sprite(new Image("datas/post-fx/background.jpg")); - - // Load a sprite which we'll move into the scene - Sprite entity = new Sprite(new Image("datas/post-fx/sprite.png")); - - // Load the text font - Font cheeseburger = new Font("datas/post-fx/cheeseburger.ttf"); - - // Load the image needed for the wave effect - Image waveImage = new Image("datas/post-fx/wave.jpg"); - - // Load all effects - effects = new Dictionary(); - effects["nothing"] = new PostFx("datas/post-fx/nothing.sfx"); - effects["blur"] = new PostFx("datas/post-fx/blur.sfx"); - effects["colorize"] = new PostFx("datas/post-fx/colorize.sfx"); - effects["fisheye"] = new PostFx("datas/post-fx/fisheye.sfx"); - effects["wave"] = new PostFx("datas/post-fx/wave.sfx"); - effects["pixelate"] = new PostFx("datas/post-fx/pixelate.sfx"); - currentEffect = effects.GetEnumerator(); - currentEffect.MoveNext(); - - // Do specific initializations - effects["nothing"].SetTexture("framebuffer", null); - effects["blur"].SetTexture("framebuffer", null); - effects["blur"].SetParameter("offset", 0.0F); - effects["colorize"].SetTexture("framebuffer", null); - effects["colorize"].SetParameter("color", 1.0F, 1.0F, 1.0F); - effects["fisheye"].SetTexture("framebuffer", null); - effects["wave"].SetTexture("framebuffer", null); - effects["wave"].SetTexture("wave", waveImage); - effects["pixelate"].SetTexture("framebuffer", null); - - // Define a string for displaying current effect description - curFXStr = new String2D(); - curFXStr.Text = "Current effect is \"" + currentEffect.Current.Key + "\""; - curFXStr.Font = cheeseburger; - curFXStr.Position = new Vector2(20.0F, 0.0F); - curFXStr.Color = new Color(150, 70, 110); - - // Define a string for displaying help - String2D infoStr = new String2D(); - infoStr.Text = "Move your mouse to change the effect parameters\nPress numpad + to change effect\nWarning : some effects may not work\ndepending on your graphics card"; - infoStr.Font = cheeseburger; - infoStr.Position = new Vector2(20.0F, 460.0F); - infoStr.Color = new Color(200, 100, 150); - - // Start the game loop - float time = 0.0F; - while (window.IsOpened()) - { - // Process events - window.DispatchEvents(); - - // Get the mouse position in the range [0, 1] - float x = window.Input.GetMouseX() / (float)window.Width; - float y = window.Input.GetMouseY() / (float)window.Height; - - // Update the current effect - if (currentEffect.Current.Key == "blur") currentEffect.Current.Value.SetParameter("offset", x * y * 0.1f); - else if (currentEffect.Current.Key == "colorize") currentEffect.Current.Value.SetParameter("color", 0.3f, x, y); - else if (currentEffect.Current.Key == "fisheye") currentEffect.Current.Value.SetParameter("mouse", x, 1.0F - y); - else if (currentEffect.Current.Key == "wave") currentEffect.Current.Value.SetParameter("offset", x, y); - else if (currentEffect.Current.Key == "pixelate") currentEffect.Current.Value.SetParameter("mouse", x, y); - - // Animate the sprite - time += window.GetFrameTime(); - float entityX = (float)(Math.Cos(time * 1.3) + 1.2) * 300; - float entityY = (float)(Math.Cos(time * 0.8) + 1.2) * 200; - entity.Position = new Vector2(entityX, entityY); - entity.Rotation = time * 100; - - // Clear the window - window.Clear(); - - // Draw background, the sprite and apply the post-fx - window.Draw(background); - window.Draw(entity); - window.Draw(currentEffect.Current.Value); - - // Draw interface strings - window.Draw(curFXStr); - window.Draw(infoStr); - - // Finally, display the rendered frame on screen - window.Display(); - } - } - - /// - /// Fonction called when the post-effects are not supported ; - /// Display an error message and wait until the user exits - /// - private static void DisplayError(RenderWindow window) - { - // Define a string for displaying the error message - String2D errorStr = new String2D("Sorry, your system doesn't support post-effects"); - errorStr.Position = new Vector2(100.0F, 250.0F); - errorStr.Color = new Color(200, 100, 150); - - // Start the game loop - while (window.IsOpened()) - { - // Process events - window.DispatchEvents(); - - // Clear the window - window.Clear(); - - // Draw the error message - window.Draw(errorStr); - - // Finally, display the rendered frame on screen - window.Display(); - } - } - - /// - /// Function called when the window is closed - /// - static void OnClosed(object sender, EventArgs e) - { - RenderWindow window = (RenderWindow)sender; - window.Close(); - } - - /// - /// Function called when a key is pressed - /// - static void OnKeyPressed(object sender, KeyEventArgs e) - { - RenderWindow window = (RenderWindow)sender; - if (e.Code == KeyCode.Escape) - { - // Close the window - window.Close(); - } - else if (e.Code == KeyCode.Add) - { - // Advance to the next effect - if (currentEffect.MoveNext() == false) - { - currentEffect = effects.GetEnumerator(); - currentEffect.MoveNext(); - } - curFXStr.Text = "Current effect is \"" + currentEffect.Current.Key + "\""; - } - } - } -} diff --git a/dotnet/samples/shader/Shader.cs b/dotnet/samples/shader/Shader.cs new file mode 100644 index 00000000..3c1e5470 --- /dev/null +++ b/dotnet/samples/shader/Shader.cs @@ -0,0 +1,249 @@ +using System; +using System.Collections.Generic; +using SFML; +using SFML.Graphics; +using SFML.Window; + +namespace sample_shader +{ + /// + /// A class to simplify shader selection + /// + class ShaderSelector + { + // Constructor + public ShaderSelector(Dictionary owner) + { + myOwner = owner; + myIterator = owner.GetEnumerator(); + myIterator.MoveNext(); + } + + // Select the next shader + public void GotoNext() + { + if (myIterator.MoveNext() == false) + { + myIterator = myOwner.GetEnumerator(); + myIterator.MoveNext(); + } + } + + // Update the shader parameters + public void Update(float x, float y) + { + if (myIterator.Current.Key == "blur") myIterator.Current.Value.SetParameter("offset", x * y * 0.05f); + else if (myIterator.Current.Key == "colorize") myIterator.Current.Value.SetParameter("color", 0.3f, x, y); + else if (myIterator.Current.Key == "fisheye") myIterator.Current.Value.SetParameter("mouse", x, y); + else if (myIterator.Current.Key == "wave") myIterator.Current.Value.SetParameter("offset", x, y); + else if (myIterator.Current.Key == "pixelate") myIterator.Current.Value.SetParameter("mouse", x, y); + } + + // Get the name of the current shader + public string Name + { + get {return myIterator.Current.Key;} + } + + // Get the current shader + public Shader Shader + { + get {return myIterator.Current.Value;} + } + + private Dictionary myOwner; + private Dictionary.Enumerator myIterator; + }; + + static class Program + { + private static Dictionary shaders; + private static ShaderSelector backgroundShader; + private static ShaderSelector entityShader; + private static ShaderSelector globalShader; + private static String2D shaderStr; + + /// + /// The main entry point for the application. + /// + static void Main() + { + // Create the main window + RenderWindow window = new RenderWindow(new VideoMode(800, 600), "SFML.Net Shader"); + + // Setup event handlers + window.Closed += new EventHandler(OnClosed); + window.KeyPressed += new EventHandler(OnKeyPressed); + + // Check that the system can use shaders + if (Shader.IsAvailable == false) + { + DisplayError(window); + return; + } + + // Create the render image + RenderImage image = new RenderImage(window.Width, window.Height); + + // Load a background image to display + Sprite background = new Sprite(new Image("datas/shader/background.jpg")); + background.Image.Smooth = false; + + // Load a sprite which we'll move into the scene + Sprite entity = new Sprite(new Image("datas/shader/sprite.png")); + + // Load the text font + Font font = new Font("datas/shader/arial.ttf", 20); + + // Load the image needed for the wave effect + Image waveImage = new Image("datas/shader/wave.jpg"); + + // Load all effects + shaders = new Dictionary(); + shaders["nothing"] = new Shader("datas/shader/nothing.sfx"); + shaders["blur"] = new Shader("datas/shader/blur.sfx"); + shaders["colorize"] = new Shader("datas/shader/colorize.sfx"); + shaders["fisheye"] = new Shader("datas/shader/fisheye.sfx"); + shaders["wave"] = new Shader("datas/shader/wave.sfx"); + shaders["pixelate"] = new Shader("datas/shader/pixelate.sfx"); + backgroundShader = new ShaderSelector(shaders); + entityShader = new ShaderSelector(shaders); + globalShader = new ShaderSelector(shaders); + + // Do specific initializations + shaders["nothing"].SetTexture("texture", Shader.CurrentTexture); + shaders["blur"].SetTexture("texture", Shader.CurrentTexture); + shaders["blur"].SetParameter("offset", 0.0F); + shaders["colorize"].SetTexture("texture", Shader.CurrentTexture); + shaders["colorize"].SetParameter("color", 1.0F, 1.0F, 1.0F); + shaders["fisheye"].SetTexture("texture", Shader.CurrentTexture); + shaders["wave"].SetTexture("texture", Shader.CurrentTexture); + shaders["wave"].SetTexture("wave", waveImage); + shaders["pixelate"].SetTexture("texture", Shader.CurrentTexture); + + // Define a string for displaying current effect description + shaderStr = new String2D(); + shaderStr.Font = font; + shaderStr.Size = 20; + shaderStr.Position = new Vector2(5.0F, 0.0F); + shaderStr.Color = new Color(250, 100, 30); + shaderStr.Text = "Background shader: \"" + backgroundShader.Name + "\"\n" + + "Flower shader: \"" + entityShader.Name + "\"\n" + + "Global shader: \"" + globalShader.Name + "\"\n"; + + // Define a string for displaying help + String2D infoStr = new String2D(); + infoStr.Font = font; + infoStr.Size = 20; + infoStr.Position = new Vector2(5.0F, 510.0F); + infoStr.Color = new Color(250, 100, 30); + infoStr.Text = "Move your mouse to change the shaders' parameters\n" + + "Press numpad 1 to change the background shader\n" + + "Press numpad 2 to change the flower shader\n" + + "Press numpad 3 to change the global shader"; + + // Start the game loop + float time = 0.0F; + while (window.IsOpened()) + { + // Process events + window.DispatchEvents(); + + // Get the mouse position in the range [0, 1] + //float x = window.Input.GetMouseX() / (float)window.Width; + //float y = window.Input.GetMouseY() / (float)window.Height; + float x = (float)(Math.Cos(time * 1.3) + 1) * 0.5F; + float y = (float)(Math.Sin(time * 0.8) + 1) * 0.5F; + + // Update the shaders + backgroundShader.Update(x, y); + entityShader.Update(x, y); + globalShader.Update(x, y); + + // Animate the sprite + time += window.GetFrameTime(); + float entityX = (float)(Math.Cos(time * 1.3) + 1.2) * 300; + float entityY = (float)(Math.Cos(time * 0.8) + 1.2) * 200; + entity.Position = new Vector2(entityX, entityY); + entity.Rotation = time * 100; + + // Draw the background and the moving entity to the render image + image.Draw(background, backgroundShader.Shader); + image.Draw(entity, entityShader.Shader); + image.Display(); + + // Draw the contents of the render image to the window + window.Draw(new Sprite(image.Image), globalShader.Shader); + + // Draw interface strings + window.Draw(shaderStr); + window.Draw(infoStr); + + // Finally, display the rendered frame on screen + window.Display(); + } + } + + /// + /// Fonction called when the post-effects are not supported ; + /// Display an error message and wait until the user exits + /// + private static void DisplayError(RenderWindow window) + { + // Define a string for displaying the error message + String2D errorStr = new String2D("Sorry, your system doesn't support shaders"); + errorStr.Position = new Vector2(100.0F, 250.0F); + errorStr.Color = new Color(200, 100, 150); + + // Start the game loop + while (window.IsOpened()) + { + // Process events + window.DispatchEvents(); + + // Clear the window + window.Clear(); + + // Draw the error message + window.Draw(errorStr); + + // Finally, display the rendered frame on screen + window.Display(); + } + } + + /// + /// Function called when the window is closed + /// + static void OnClosed(object sender, EventArgs e) + { + RenderWindow window = (RenderWindow)sender; + window.Close(); + } + + /// + /// Function called when a key is pressed + /// + static void OnKeyPressed(object sender, KeyEventArgs e) + { + RenderWindow window = (RenderWindow)sender; + + // Escape key : exit + if (e.Code == KeyCode.Escape) + window.Close(); + + // Numpad : switch effect + switch (e.Code) + { + case KeyCode.Numpad1 : backgroundShader.GotoNext(); break; + case KeyCode.Numpad2 : entityShader.GotoNext(); break; + case KeyCode.Numpad3 : globalShader.GotoNext(); break; + } + + // Update the text + shaderStr.Text = "Background shader: \"" + backgroundShader.Name + "\"\n" + + "Flower shader: \"" + entityShader.Name + "\"\n" + + "Global shader: \"" + globalShader.Name + "\"\n"; + } + } +} diff --git a/dotnet/samples/post-fx/sample-postfx.csproj b/dotnet/samples/shader/sample-shader.csproj similarity index 90% rename from dotnet/samples/post-fx/sample-postfx.csproj rename to dotnet/samples/shader/sample-shader.csproj index 9a776eb8..1992e7d6 100644 --- a/dotnet/samples/post-fx/sample-postfx.csproj +++ b/dotnet/samples/shader/sample-shader.csproj @@ -7,13 +7,14 @@ {9D4738F7-34EA-433A-A765-AF85A52A174D} WinExe Properties - sample_postfx - post-fx + sample_shader + shader 2.0 + sample_shader.Program true @@ -43,7 +44,7 @@ - + diff --git a/dotnet/samples/sound_capture/SoundCapture.cs b/dotnet/samples/sound_capture/SoundCapture.cs index f1fdec51..e6a08095 100644 --- a/dotnet/samples/sound_capture/SoundCapture.cs +++ b/dotnet/samples/sound_capture/SoundCapture.cs @@ -13,7 +13,7 @@ namespace sample_soundcapture static void Main(string[] args) { // Check that the device can capture audio - if (SoundRecorder.CanCapture == false) + if (SoundRecorder.IsAvailable == false) { Console.WriteLine("Sorry, audio capture is not supported by your system"); return; diff --git a/dotnet/src/Audio/SoundRecorder.cs b/dotnet/src/Audio/SoundRecorder.cs index 1c8e79d0..16b2a692 100644 --- a/dotnet/src/Audio/SoundRecorder.cs +++ b/dotnet/src/Audio/SoundRecorder.cs @@ -78,9 +78,9 @@ namespace SFML /// If not, this class won't be usable /// //////////////////////////////////////////////////////////// - public static bool CanCapture + public static bool IsAvailable { - get {return sfSoundRecorder_CanCapture();} + get {return sfSoundRecorder_IsAvailable();} } //////////////////////////////////////////////////////////// @@ -173,7 +173,7 @@ namespace SFML static extern uint sfSoundRecorder_GetSampleRate(IntPtr SoundRecorder); [DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity] - static extern bool sfSoundRecorder_CanCapture(); + static extern bool sfSoundRecorder_IsAvailable(); #endregion } } diff --git a/dotnet/src/Graphics/Drawable.cs b/dotnet/src/Graphics/Drawable.cs index 5332efc6..e85c13ec 100644 --- a/dotnet/src/Graphics/Drawable.cs +++ b/dotnet/src/Graphics/Drawable.cs @@ -101,16 +101,18 @@ namespace SFML /// Render the object into the given render window /// /// Target render window + /// Shader to apply //////////////////////////////////////////////////////////// - internal abstract void Render(RenderWindow target); + internal abstract void Render(RenderWindow target, Shader shader); //////////////////////////////////////////////////////////// /// /// Render the object into the given render image /// /// Target render image + /// Shader to apply //////////////////////////////////////////////////////////// - internal abstract void Render(RenderImage target); + internal abstract void Render(RenderImage target, Shader shader); //////////////////////////////////////////////////////////// /// diff --git a/dotnet/src/Graphics/RenderImage.cs b/dotnet/src/Graphics/RenderImage.cs index 2618801f..81e33042 100644 --- a/dotnet/src/Graphics/RenderImage.cs +++ b/dotnet/src/Graphics/RenderImage.cs @@ -36,14 +36,14 @@ namespace SFML /// /// Width of the render image /// Height of the render image - /// Do you wxant a depth-buffer attached? + /// Do you want a depth-buffer attached? //////////////////////////////////////////////////////////// public RenderImage(uint width, uint height, bool depthBuffer) : base(sfRenderImage_Create(width, height, depthBuffer)) { myDefaultView = new View(sfRenderImage_GetDefaultView(This)); - myCurrentView = myDefaultView; myImage = new Image(sfRenderImage_GetImage(This)); + myCurrentView = myDefaultView; GC.SuppressFinalize(myDefaultView); GC.SuppressFinalize(myImage); } @@ -177,18 +177,19 @@ namespace SFML //////////////////////////////////////////////////////////// public void Draw(Drawable objectToDraw) { - objectToDraw.Render(this); + objectToDraw.Render(this, null); } //////////////////////////////////////////////////////////// /// - /// Apply a post-fx to the render image + /// Draw something into the render image with a shader /// - /// PostFx to apply + /// Object to draw + /// Shader to apply //////////////////////////////////////////////////////////// - public void Draw(PostFx postFx) + public void Draw(Drawable objectToDraw, Shader shader) { - sfRenderImage_DrawPostFX(This, postFx != null ? postFx.This : IntPtr.Zero); + objectToDraw.Render(this, shader); } //////////////////////////////////////////////////////////// @@ -236,9 +237,9 @@ namespace SFML /// Tell whether or not the system supports render images /// //////////////////////////////////////////////////////////// - public static bool CanUseRenderImage + public static bool IsAvailable { - get {return sfRenderImage_CanUseRenderImage();} + get {return sfRenderImage_IsAvailable();} } //////////////////////////////////////////////////////////// @@ -308,14 +309,11 @@ namespace SFML [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] static extern void sfRenderImage_ConvertCoords(IntPtr This, uint WindowX, uint WindowY, out float ViewX, out float ViewY, IntPtr TargetView); - [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] - static extern void sfRenderImage_DrawPostFX(IntPtr This, IntPtr PostFx); - [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] static extern IntPtr sfRenderImage_GetImage(IntPtr This); [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] - static extern bool sfRenderImage_CanUseRenderImage(); + static extern bool sfRenderImage_IsAvailable(); #endregion } diff --git a/dotnet/src/Graphics/RenderTarget.cs b/dotnet/src/Graphics/RenderTarget.cs index 26698fbc..f8fc9ce0 100644 --- a/dotnet/src/Graphics/RenderTarget.cs +++ b/dotnet/src/Graphics/RenderTarget.cs @@ -99,11 +99,12 @@ namespace SFML //////////////////////////////////////////////////////////// /// - /// Apply a post-fx to the window + /// Draw something into the render image with a shader /// - /// PostFx to apply + /// Object to draw + /// Shader to apply //////////////////////////////////////////////////////////// - void Draw(PostFx postFx); + void Draw(Drawable objectToDraw, Shader shader); //////////////////////////////////////////////////////////// /// diff --git a/dotnet/src/Graphics/RenderWindow.cs b/dotnet/src/Graphics/RenderWindow.cs index 5af31134..0a454f0a 100644 --- a/dotnet/src/Graphics/RenderWindow.cs +++ b/dotnet/src/Graphics/RenderWindow.cs @@ -390,18 +390,19 @@ namespace SFML //////////////////////////////////////////////////////////// public void Draw(Drawable objectToDraw) { - objectToDraw.Render(this); + objectToDraw.Render(this, null); } //////////////////////////////////////////////////////////// /// - /// Apply a post-fx to the window + /// Draw something into the window with a shader /// - /// PostFx to apply + /// Object to draw + /// Shader to apply //////////////////////////////////////////////////////////// - public void Draw(PostFx postFx) + public void Draw(Drawable objectToDraw, Shader shader) { - sfRenderWindow_DrawPostFX(This, postFx != null ? postFx.This : IntPtr.Zero); + objectToDraw.Render(this, shader); } //////////////////////////////////////////////////////////// @@ -572,9 +573,6 @@ namespace SFML [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] static extern void sfRenderWindow_ConvertCoords(IntPtr This, uint WindowX, uint WindowY, out float ViewX, out float ViewY, IntPtr TargetView); - [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] - static extern void sfRenderWindow_DrawPostFX(IntPtr This, IntPtr PostFx); - #endregion } } diff --git a/dotnet/src/Graphics/PostFx.cs b/dotnet/src/Graphics/Shader.cs similarity index 55% rename from dotnet/src/Graphics/PostFx.cs rename to dotnet/src/Graphics/Shader.cs index 41c41d20..b771d842 100644 --- a/dotnet/src/Graphics/PostFx.cs +++ b/dotnet/src/Graphics/Shader.cs @@ -9,97 +9,109 @@ namespace SFML { //////////////////////////////////////////////////////////// /// - /// PostFX is used to apply a post effect to a window + /// Wrapper for pixel shaders /// //////////////////////////////////////////////////////////// - public class PostFx : ObjectBase + public class Shader : ObjectBase { //////////////////////////////////////////////////////////// /// - /// Default constructor (invalid effect) + /// Default constructor (invalid shader) /// /// //////////////////////////////////////////////////////////// - public PostFx() : - base(sfPostFx_Create()) + public Shader() : + base(sfShader_Create()) { if (This == IntPtr.Zero) - throw new LoadingFailedException("post-fx"); + throw new LoadingFailedException("shader"); } //////////////////////////////////////////////////////////// /// - /// Load the effect from a file + /// Load the shader from a file /// - /// Path of the effect file to load + /// Path of the shader file to load /// //////////////////////////////////////////////////////////// - public PostFx(string filename) : - base(sfPostFX_CreateFromFile(filename)) + public Shader(string filename) : + base(sfShader_CreateFromFile(filename)) { if (This == IntPtr.Zero) - throw new LoadingFailedException("post-fx", filename); + throw new LoadingFailedException("shader", filename); } //////////////////////////////////////////////////////////// /// - /// Load the effect from a text in memory + /// Load the shader from a text in memory /// - /// String containing the effect code + /// String containing the shader code /// //////////////////////////////////////////////////////////// - void LoadFromString(string effect) + void LoadFromString(string shader) { - SetThis(sfPostFX_CreateFromMemory(effect)); + SetThis(sfShader_CreateFromMemory(shader)); if (This == IntPtr.Zero) - throw new LoadingFailedException("post-fx"); + throw new LoadingFailedException("shader"); } //////////////////////////////////////////////////////////// /// - /// Change a 1-component parameter of the effect + /// Change a vector2 parameter of the shader /// - /// Name of the parameter in the effect + /// Name of the parameter in the shader + /// Value of the parameter + //////////////////////////////////////////////////////////// + public void SetParameter(string name, Vector2 v) + { + SetParameter(name, v.X, v.Y); + } + + //////////////////////////////////////////////////////////// + /// + /// Change a 1-component parameter of the shader + /// + /// Name of the parameter in the shader /// Value of the parameter //////////////////////////////////////////////////////////// public void SetParameter(string name, float x) { - sfPostFX_SetParameter1(This, name, x); + sfShader_SetParameter1(This, name, x); } //////////////////////////////////////////////////////////// /// - /// Change a 2-component parameter of the effect + /// Change a 2-component parameter of the shader /// - /// Name of the parameter in the effect + /// Name of the parameter in the shader /// X component of the value /// Y component of the value //////////////////////////////////////////////////////////// public void SetParameter(string name, float x, float y) { - sfPostFX_SetParameter2(This, name, x, y); + sfShader_SetParameter2(This, name, x, y); } //////////////////////////////////////////////////////////// /// - /// Change a 3-component parameter of the effect + /// Change a 3-component parameter of the shader /// - /// Name of the parameter in the effect + /// Name of the parameter in the shader /// X component of the value /// Y component of the value /// Z component of the value //////////////////////////////////////////////////////////// public void SetParameter(string name, float x, float y, float z) { - sfPostFX_SetParameter3(This, name, x, y, z); + sfShader_SetParameter3(This, name, x, y, z); } //////////////////////////////////////////////////////////// /// - /// Change a 4-component parameter of the effect + /// Change a 4-component parameter of the shader /// - /// Name of the parameter in the effect + /// Name of the parameter in the shader /// X component of the value /// Y component of the value /// Z component of the value @@ -107,30 +119,60 @@ namespace SFML //////////////////////////////////////////////////////////// public void SetParameter(string name, float x, float y, float z, float w) { - sfPostFX_SetParameter4(This, name, x, y, z, w); + sfShader_SetParameter4(This, name, x, y, z, w); } //////////////////////////////////////////////////////////// /// /// Set a texture parameter /// - /// Name of the texture in the effect - /// Image to set (pass null to use the contents of the screen) + /// Name of the texture in the shader + /// Image to set (pass null to use the texture of the object being drawn) //////////////////////////////////////////////////////////// public void SetTexture(string name, Image texture) { myTextures[name] = texture; - sfPostFX_SetTexture(This, name, texture != null ? texture.This : IntPtr.Zero); + sfShader_SetTexture(This, name, texture != null ? texture.This : IntPtr.Zero); } //////////////////////////////////////////////////////////// /// - /// Tell whether or not the system supports post-effects + /// Bind the shader for rendering /// //////////////////////////////////////////////////////////// - public static bool CanUsePostFX + public void Bind() { - get {return sfPostFX_CanUsePostFX();} + sfShader_Bind(This); + } + + //////////////////////////////////////////////////////////// + /// + /// Unbind the shader + /// + //////////////////////////////////////////////////////////// + public void Unbind() + { + sfShader_Unbind(This); + } + + //////////////////////////////////////////////////////////// + /// + /// Tell whether or not the system supports shaders + /// + //////////////////////////////////////////////////////////// + public static bool IsAvailable + { + get {return sfShader_IsAvailable();} + } + + //////////////////////////////////////////////////////////// + /// + /// Special image representing the texture used by the object being drawn + /// + //////////////////////////////////////////////////////////// + public static Image CurrentTexture + { + get {return null;} } //////////////////////////////////////////////////////////// @@ -145,7 +187,7 @@ namespace SFML Context.Global.SetActive(true); myTextures.Clear(); - sfPostFX_Destroy(This); + sfShader_Destroy(This); if (!disposing) Context.Global.SetActive(false); @@ -155,37 +197,40 @@ namespace SFML #region Imports [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] - static extern IntPtr sfPostFx_Create(); - - [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] - static extern void sfPostFx_Destroy(IntPtr This); + static extern IntPtr sfShader_Create(); [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] - static extern IntPtr sfPostFX_CreateFromFile(string Filename); + static extern IntPtr sfShader_CreateFromFile(string Filename); [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] - static extern IntPtr sfPostFX_CreateFromMemory(string Effect); + static extern IntPtr sfShader_CreateFromMemory(string Shader); [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] - static extern void sfPostFX_Destroy(IntPtr PostFX); + static extern void sfShader_Destroy(IntPtr Shader); [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] - static extern void sfPostFX_SetParameter1(IntPtr PostFX, string Name, float X); + static extern void sfShader_SetParameter1(IntPtr Shader, string Name, float X); [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] - static extern void sfPostFX_SetParameter2(IntPtr PostFX, string Name, float X, float Y); + static extern void sfShader_SetParameter2(IntPtr Shader, string Name, float X, float Y); [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] - static extern void sfPostFX_SetParameter3(IntPtr PostFX, string Name, float X, float Y, float Z); + static extern void sfShader_SetParameter3(IntPtr Shader, string Name, float X, float Y, float Z); [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] - static extern void sfPostFX_SetParameter4(IntPtr PostFX, string Name, float X, float Y, float Z, float W); + static extern void sfShader_SetParameter4(IntPtr Shader, string Name, float X, float Y, float Z, float W); [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] - static extern void sfPostFX_SetTexture(IntPtr PostFX, string Name, IntPtr Texture); + static extern void sfShader_SetTexture(IntPtr Shader, string Name, IntPtr Texture); [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] - static extern bool sfPostFX_CanUsePostFX(); + static extern void sfShader_Bind(IntPtr Shader); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern void sfShader_Unbind(IntPtr Shader); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern bool sfShader_IsAvailable(); #endregion } diff --git a/dotnet/src/Graphics/Shape.cs b/dotnet/src/Graphics/Shape.cs index 70d3994e..a4d07b62 100644 --- a/dotnet/src/Graphics/Shape.cs +++ b/dotnet/src/Graphics/Shape.cs @@ -366,10 +366,14 @@ namespace SFML /// Render the object into the given render window /// /// Target render window + /// Shader to apply //////////////////////////////////////////////////////////// - internal override void Render(RenderWindow target) + internal override void Render(RenderWindow target, Shader shader) { - sfRenderWindow_DrawShape(target.This, This); + if (shader == null) + sfRenderWindow_DrawShape(target.This, This); + else + sfRenderWindow_DrawShapeWithShader(target.This, This, shader.This); } //////////////////////////////////////////////////////////// @@ -377,10 +381,14 @@ namespace SFML /// Render the object into the given render image /// /// Target render image + /// Shader to apply //////////////////////////////////////////////////////////// - internal override void Render(RenderImage target) + internal override void Render(RenderImage target, Shader shader) { - sfRenderImage_DrawShape(target.This, This); + if (shader == null) + sfRenderImage_DrawShape(target.This, This); + else + sfRenderImage_DrawShapeWithShader(target.This, This, shader.This); } //////////////////////////////////////////////////////////// @@ -466,9 +474,15 @@ namespace SFML [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] static extern void sfRenderWindow_DrawShape(IntPtr This, IntPtr Shape); + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern void sfRenderWindow_DrawShapeWithShader(IntPtr This, IntPtr Shape, IntPtr Shader); + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] static extern void sfRenderImage_DrawShape(IntPtr This, IntPtr Shape); + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern void sfRenderImage_DrawShapeWithShader(IntPtr This, IntPtr Shape, IntPtr Shader); + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] static extern IntPtr sfShape_CreateLine(float P1X, float P1Y, float P2X, float P2Y, float Thickness, Color Col, float Outline, Color OutlineCol); diff --git a/dotnet/src/Graphics/Sprite.cs b/dotnet/src/Graphics/Sprite.cs index 4fc570b8..a7d7a431 100644 --- a/dotnet/src/Graphics/Sprite.cs +++ b/dotnet/src/Graphics/Sprite.cs @@ -220,10 +220,14 @@ namespace SFML /// Render the object into the given render window /// /// Target render window + /// Shader to apply //////////////////////////////////////////////////////////// - internal override void Render(RenderWindow target) + internal override void Render(RenderWindow target, Shader shader) { - sfRenderWindow_DrawSprite(target.This, This); + if (shader == null) + sfRenderWindow_DrawSprite(target.This, This); + else + sfRenderWindow_DrawSpriteWithShader(target.This, This, shader.This); } //////////////////////////////////////////////////////////// @@ -231,10 +235,14 @@ namespace SFML /// Render the object into the given render image /// /// Target render image + /// Shader to apply //////////////////////////////////////////////////////////// - internal override void Render(RenderImage target) + internal override void Render(RenderImage target, Shader shader) { - sfRenderImage_DrawSprite(target.This, This); + if (shader == null) + sfRenderImage_DrawSprite(target.This, This); + else + sfRenderImage_DrawSpriteWithShader(target.This, This, shader.This); } //////////////////////////////////////////////////////////// @@ -311,9 +319,15 @@ namespace SFML [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] static extern void sfRenderWindow_DrawSprite(IntPtr This, IntPtr Sprite); + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern void sfRenderWindow_DrawSpriteWithShader(IntPtr This, IntPtr Sprite, IntPtr Shader); + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] static extern void sfRenderImage_DrawSprite(IntPtr This, IntPtr Sprite); + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern void sfRenderImage_DrawSpriteWithShader(IntPtr This, IntPtr Sprite, IntPtr Shader); + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] static extern void sfSprite_Resize(IntPtr This, float Width, float Height); diff --git a/dotnet/src/Graphics/String2D.cs b/dotnet/src/Graphics/String2D.cs index fa4b8ccc..50b81f7a 100644 --- a/dotnet/src/Graphics/String2D.cs +++ b/dotnet/src/Graphics/String2D.cs @@ -261,10 +261,14 @@ namespace SFML /// Render the object into the given render window /// /// Target render window + /// Shader to apply //////////////////////////////////////////////////////////// - internal override void Render(RenderWindow target) + internal override void Render(RenderWindow target, Shader shader) { - sfRenderWindow_DrawString(target.This, This); + if (shader == null) + sfRenderWindow_DrawString(target.This, This); + else + sfRenderWindow_DrawStringWithShader(target.This, This, shader.This); } //////////////////////////////////////////////////////////// @@ -272,10 +276,14 @@ namespace SFML /// Render the object into the given render image /// /// Target render image + /// Shader to apply //////////////////////////////////////////////////////////// - internal override void Render(RenderImage target) + internal override void Render(RenderImage target, Shader shader) { - sfRenderImage_DrawString(target.This, This); + if (shader == null) + sfRenderImage_DrawString(target.This, This); + else + sfRenderImage_DrawStringWithShader(target.This, This, shader.This); } //////////////////////////////////////////////////////////// @@ -352,9 +360,15 @@ namespace SFML [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] static extern void sfRenderWindow_DrawString(IntPtr This, IntPtr String); + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern void sfRenderWindow_DrawStringWithShader(IntPtr This, IntPtr String, IntPtr Shader); + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] static extern void sfRenderImage_DrawString(IntPtr This, IntPtr String); + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern void sfRenderImage_DrawStringWithShader(IntPtr This, IntPtr String, IntPtr Shader); + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] static extern float sfString_GetWidth(IntPtr This); diff --git a/dotnet/src/Graphics/sfml-graphics.csproj b/dotnet/src/Graphics/sfml-graphics.csproj index f1331f74..04c7e40a 100644 --- a/dotnet/src/Graphics/sfml-graphics.csproj +++ b/dotnet/src/Graphics/sfml-graphics.csproj @@ -3,7 +3,7 @@ Debug AnyCPU - 8.0.50727 + 9.0.21022 2.0 {46786269-57B9-48E7-AA4F-8F4D84609FE6} Library @@ -53,11 +53,11 @@ - + diff --git a/include/SFML/Audio/SoundBufferRecorder.hpp b/include/SFML/Audio/SoundBufferRecorder.hpp index 29f6f655..8e59927f 100644 --- a/include/SFML/Audio/SoundBufferRecorder.hpp +++ b/include/SFML/Audio/SoundBufferRecorder.hpp @@ -107,13 +107,13 @@ private : /// and adds a function to retrieve the recorded sound buffer /// (GetBuffer()). /// -/// As usual, don't forget to call the CanCapture() function +/// As usual, don't forget to call the IsAvailable() function /// before using this class (see sf::SoundRecorder for more details /// about this). /// /// Usage example: /// \code -/// if (SoundBufferRecorder::CanCapture()) +/// if (SoundBufferRecorder::IsAvailable()) /// { /// // Record some audio data /// SoundBufferRecorder recorder; diff --git a/include/SFML/Audio/SoundRecorder.hpp b/include/SFML/Audio/SoundRecorder.hpp index e4ff99af..014fbfbf 100644 --- a/include/SFML/Audio/SoundRecorder.hpp +++ b/include/SFML/Audio/SoundRecorder.hpp @@ -96,7 +96,7 @@ public : /// \return True if audio capture is supported, false otherwise /// //////////////////////////////////////////////////////////// - static bool CanCapture(); + static bool IsAvailable(); protected : @@ -212,7 +212,7 @@ private : /// /// The audio capture feature may not be supported or activated /// on every platform, thus it is recommended to check its -/// availability with the CanCapture() function. If it returns +/// availability with the IsAvailable() function. If it returns /// false, then any attempt to use an audio recorder will fail. /// /// It is important to note that the audio capture happens in a @@ -253,7 +253,7 @@ private : /// } /// /// // Usage -/// if (CustomRecorder::CanCapture()) +/// if (CustomRecorder::IsAvailable()) /// { /// CustomRecorder recorder; /// recorder.Start(); diff --git a/include/SFML/Graphics.hpp b/include/SFML/Graphics.hpp index 47c371e7..14b251bf 100644 --- a/include/SFML/Graphics.hpp +++ b/include/SFML/Graphics.hpp @@ -34,10 +34,10 @@ #include #include #include -#include #include #include #include +#include #include #include #include diff --git a/include/SFML/Graphics/RenderImage.hpp b/include/SFML/Graphics/RenderImage.hpp index 1f5cf3f7..8791015b 100644 --- a/include/SFML/Graphics/RenderImage.hpp +++ b/include/SFML/Graphics/RenderImage.hpp @@ -119,7 +119,7 @@ public : /// \return True if the RenderImage class can be used /// //////////////////////////////////////////////////////////// - static bool CanUseRenderImage(); + static bool IsAvailable(); private : diff --git a/include/SFML/Graphics/RenderQueue.hpp b/include/SFML/Graphics/RenderQueue.hpp index 049a6403..ee602e64 100644 --- a/include/SFML/Graphics/RenderQueue.hpp +++ b/include/SFML/Graphics/RenderQueue.hpp @@ -31,7 +31,6 @@ #include #include #include -#include #include #include #include @@ -45,6 +44,9 @@ namespace priv class GeometryRenderer; } +class Image; +class Shader; + //////////////////////////////////////////////////////////// /// \brief Implements a queue of rendering commands /// @@ -194,6 +196,17 @@ public : //////////////////////////////////////////////////////////// void SetTexture(const Image* texture); + //////////////////////////////////////////////////////////// + /// \brief Set the current shader + /// + /// Note: any call to this function after a call to BeginBatch + /// will be ignored, and delayed until BeginBatch is called again. + /// + /// \param shader New Shader + /// + //////////////////////////////////////////////////////////// + void SetShader(const Shader* shader); + //////////////////////////////////////////////////////////// /// \brief Begin a new geometry batch /// @@ -326,6 +339,7 @@ private : RenderStates* myCurrentStates; ///< Current set of render states Matrix3 myCurrentTransform; ///< Current combined projection-model-view matrix const Image* myCurrentTexture; ///< Current texture + const Shader* myCurrentShader; ///< Current pixel shader Blend::Mode myCurrentBlendMode; ///< Current blending mode IntRect myCurrentViewport; ///< Current target viewport Vector2f myCurrentViewportSize; ///< Size of the current viewport (for vertex calculations) @@ -358,10 +372,8 @@ private : /// /// Usage example: /// \begincode -/// void MyDrawable::Render(sf::RenderTarget& target) +/// void MyDrawable::Render(sf::RenderTarget& target, sf::RenderQueue& queue) /// { -/// RenderQueue& queue = target.GetRenderQueue(); -/// /// queue.SetTexture(myImage); /// queue.BeginBatch(); /// { diff --git a/include/SFML/Graphics/RenderTarget.hpp b/include/SFML/Graphics/RenderTarget.hpp index e799c133..52071bb8 100644 --- a/include/SFML/Graphics/RenderTarget.hpp +++ b/include/SFML/Graphics/RenderTarget.hpp @@ -37,6 +37,7 @@ namespace sf { class Drawable; +class Shader; //////////////////////////////////////////////////////////// /// Base class for all render targets (window, image, ...) @@ -65,7 +66,16 @@ public : /// \param object : Object to draw /// //////////////////////////////////////////////////////////// - virtual void Draw(const Drawable& object); + void Draw(const Drawable& object); + + //////////////////////////////////////////////////////////// + /// Draw something into the target with a shader + /// + /// \param object : Object to draw + /// \param shader : Shader to apply + /// + //////////////////////////////////////////////////////////// + void Draw(const Drawable& object, const Shader& shader); //////////////////////////////////////////////////////////// /// Make sure that what has been drawn so far is rendered diff --git a/include/SFML/Graphics/RenderWindow.hpp b/include/SFML/Graphics/RenderWindow.hpp index c90ca2c2..f495bf88 100644 --- a/include/SFML/Graphics/RenderWindow.hpp +++ b/include/SFML/Graphics/RenderWindow.hpp @@ -36,8 +36,6 @@ namespace sf { -class Drawable; - //////////////////////////////////////////////////////////// /// Simple wrapper for sf::Window that allows easy /// 2D rendering diff --git a/include/SFML/Graphics/PostFX.hpp b/include/SFML/Graphics/Shader.hpp similarity index 59% rename from include/SFML/Graphics/PostFX.hpp rename to include/SFML/Graphics/Shader.hpp index 0fe8f4f4..584718f4 100644 --- a/include/SFML/Graphics/PostFX.hpp +++ b/include/SFML/Graphics/Shader.hpp @@ -22,15 +22,16 @@ // //////////////////////////////////////////////////////////// -#ifndef SFML_POSTFX_HPP -#define SFML_POSTFX_HPP +#ifndef SFML_SHADER_HPP +#define SFML_SHADER_HPP //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// -#include +#include #include -#include +#include +#include #include #include @@ -38,9 +39,9 @@ namespace sf { //////////////////////////////////////////////////////////// -/// PostFX is used to apply a post effect to a window +/// Wrapper for pixel shaders //////////////////////////////////////////////////////////// -class SFML_API PostFX : public Drawable +class SFML_API Shader { public : @@ -48,7 +49,7 @@ public : /// Default constructor /// //////////////////////////////////////////////////////////// - PostFX(); + Shader(); //////////////////////////////////////////////////////////// /// Copy constructor @@ -56,18 +57,18 @@ public : /// \param copy : Instance to copy /// //////////////////////////////////////////////////////////// - PostFX(const PostFX& copy); + Shader(const Shader& copy); //////////////////////////////////////////////////////////// /// Destructor /// //////////////////////////////////////////////////////////// - ~PostFX(); + ~Shader(); //////////////////////////////////////////////////////////// - /// Load the effect from a file + /// Load the shader from a file /// - /// \param filename : Path of the effect file to load + /// \param filename : Path of the shader file to load /// /// \return True on success /// @@ -75,120 +76,138 @@ public : bool LoadFromFile(const std::string& filename); //////////////////////////////////////////////////////////// - /// Load the effect from a text in memory + /// Load the shader from a text in memory /// - /// \param effect : String containing the code of the effect + /// \param effect : String containing the code of the shader /// /// \return True on success /// //////////////////////////////////////////////////////////// - bool LoadFromMemory(const std::string& effect); + bool LoadFromMemory(const std::string& shader); //////////////////////////////////////////////////////////// - /// Change a parameter of the effect (1 float) + /// Change a parameter of the shader (1 float) /// - /// \param name : Name of the parameter in the effect + /// \param name : Name of the parameter in the shader /// \param x : Value to assign /// //////////////////////////////////////////////////////////// void SetParameter(const std::string& name, float x); //////////////////////////////////////////////////////////// - /// Change a parameter of the effect (2 floats) + /// Change a parameter of the shader (2 floats) /// - /// \param name : Name of the parameter in the effect + /// \param name : Name of the parameter in the shader /// \param x, y : Values to assign /// //////////////////////////////////////////////////////////// void SetParameter(const std::string& Name, float x, float y); //////////////////////////////////////////////////////////// - /// Change a parameter of the effect (3 floats) + /// Change a parameter of the shader (3 floats) /// - /// \param name : Name of the parameter in the effect + /// \param name : Name of the parameter in the shader /// \param x, y, z : Values to assign /// //////////////////////////////////////////////////////////// void SetParameter(const std::string& Name, float x, float y, float z); //////////////////////////////////////////////////////////// - /// Change a parameter of the effect (4 floats) + /// Change a parameter of the shader (4 floats) /// - /// \param name : Name of the parameter in the effect + /// \param name : Name of the parameter in the shader /// \param x, y, z, w : Values to assign /// //////////////////////////////////////////////////////////// - void SetParameter(const std::string& Name, float x, float y, float Z, float w); + void SetParameter(const std::string& Name, float x, float y, float z, float w); + + //////////////////////////////////////////////////////////// + /// Change a parameter of the shader (1 vector2) + /// + /// \param name : Name of the parameter in the shader + /// \param v : Value to assign + /// + //////////////////////////////////////////////////////////// + void SetParameter(const std::string& name, const Vector2f& v); + + //////////////////////////////////////////////////////////// + /// Change a parameter of the shader (1 vector3) + /// + /// \param name : Name of the parameter in the shader + /// \param v : Value to assign + /// + //////////////////////////////////////////////////////////// + void SetParameter(const std::string& name, const Vector3f& v); //////////////////////////////////////////////////////////// /// Set a texture parameter /// - /// \param name : Name of the texture in the effect - /// \param texture : Image to set (pass NULL to use content of current framebuffer) + /// \param name : Name of the texture in the shader + /// \param texture : Image to set (pass Shader::CurrentTexture to use the current texture) /// //////////////////////////////////////////////////////////// - void SetTexture(const std::string& name, const Image* texture); + void SetTexture(const std::string& name, const Image& texture); + + //////////////////////////////////////////////////////////// + /// Bind the shader for rendering + /// + //////////////////////////////////////////////////////////// + void Bind() const; + + //////////////////////////////////////////////////////////// + /// Unbind the shader + /// + //////////////////////////////////////////////////////////// + void Unbind() const; //////////////////////////////////////////////////////////// /// Assignment operator /// - /// \param other : Instance to assign + /// \param right Instance to assign /// - /// \return Reference to the post-effect + /// \return Reference to self /// //////////////////////////////////////////////////////////// - PostFX& operator =(const PostFX& other); + Shader& operator =(const Shader& right); //////////////////////////////////////////////////////////// - /// Tell whether or not the system supports post-effects + /// Tell whether or not the system supports shaders /// - /// \return True if the system can use post-effects + /// \return True if the system can use shaders /// //////////////////////////////////////////////////////////// - static bool CanUsePostFX(); - -protected : + static bool IsAvailable(); //////////////////////////////////////////////////////////// - /// /see Drawable::Render - /// + // Static member data //////////////////////////////////////////////////////////// - virtual void Render(RenderTarget& target, RenderQueue& queue) const; + static const Image CurrentTexture; ///< Special image representing the texture used by the object being drawn private : - //////////////////////////////////////////////////////////// - /// Preprocess a SFML effect file - /// to convert it to a valid GLSL fragment shader - /// - /// \param file : Stream containing the code to process - /// - /// \return Valid fragment shader source code - /// - //////////////////////////////////////////////////////////// - static std::string PreprocessEffect(std::istream& file); - //////////////////////////////////////////////////////////// /// Create the program and attach the shaders /// + /// \return True on success, false if any error happened + /// //////////////////////////////////////////////////////////// - void CreateProgram(); + bool CompileProgram(); //////////////////////////////////////////////////////////// // Types //////////////////////////////////////////////////////////// - typedef std::map TextureTable; + typedef std::map TextureTable; //////////////////////////////////////////////////////////// // Member data //////////////////////////////////////////////////////////// - unsigned int myShaderProgram; ///< OpenGL identifier for the program - TextureTable myTextures; ///< Texture variables in the effect - std::string myFragmentShader; ///< Fragment shader source code - mutable Image myFrameBuffer; ///< Texture containing the current frame buffer + unsigned int myShaderProgram; ///< OpenGL identifier for the program + int myCurrentTexture; ///< Location of the current texture in the shader + TextureTable myTextures; ///< Texture variables in the shader, mapped to their location + std::string myFragmentShader; ///< Fragment shader source code }; } // namespace sf -#endif // SFML_POSTFX_HPP +#endif // SFML_SHADER_HPP diff --git a/samples/bin/datas/post-fx/blur.sfx b/samples/bin/datas/post-fx/blur.sfx deleted file mode 100644 index 04bfec53..00000000 --- a/samples/bin/datas/post-fx/blur.sfx +++ /dev/null @@ -1,16 +0,0 @@ -texture framebuffer -float offset - -effect -{ - vec2 offx = vec2(offset, 0.0); - vec2 offy = vec2(0.0, offset); - - vec4 c0 = framebuffer(_in); - vec4 c1 = framebuffer(_in - offy); - vec4 c2 = framebuffer(_in + offy); - vec4 c3 = framebuffer(_in - offx); - vec4 c4 = framebuffer(_in + offx); - - _out = c0 * 0.2 + c1 * 0.2 + c2 * 0.2 + c3 * 0.2 + c4 * 0.2; -} diff --git a/samples/bin/datas/post-fx/cheeseburger.ttf b/samples/bin/datas/post-fx/cheeseburger.ttf deleted file mode 100644 index 47704266..00000000 Binary files a/samples/bin/datas/post-fx/cheeseburger.ttf and /dev/null differ diff --git a/samples/bin/datas/post-fx/colorize.sfx b/samples/bin/datas/post-fx/colorize.sfx deleted file mode 100644 index bcb48ebc..00000000 --- a/samples/bin/datas/post-fx/colorize.sfx +++ /dev/null @@ -1,10 +0,0 @@ -texture framebuffer -vec3 color - -effect -{ - vec4 pixel = framebuffer(_in); - float gray = pixel.r * 0.39 + pixel.g * 0.50 + pixel.b * 0.11; - - _out = vec4(gray * color, 1.0) * 0.6 + pixel * 0.4; -} diff --git a/samples/bin/datas/post-fx/fisheye.sfx b/samples/bin/datas/post-fx/fisheye.sfx deleted file mode 100644 index cbc31ee7..00000000 --- a/samples/bin/datas/post-fx/fisheye.sfx +++ /dev/null @@ -1,12 +0,0 @@ -texture framebuffer -vec2 mouse - -effect -{ - float len = distance(_in, mouse) * 7.0; - - if (len < 1.0) - _out = framebuffer(_in + (_in - mouse) * len); - else - _out = framebuffer(_in); -} diff --git a/samples/bin/datas/post-fx/nothing.sfx b/samples/bin/datas/post-fx/nothing.sfx deleted file mode 100644 index 133b4e31..00000000 --- a/samples/bin/datas/post-fx/nothing.sfx +++ /dev/null @@ -1,6 +0,0 @@ -texture framebuffer - -effect -{ - _out = framebuffer(_in); -} diff --git a/samples/bin/datas/post-fx/pixelate.sfx b/samples/bin/datas/post-fx/pixelate.sfx deleted file mode 100644 index a1ea9e0d..00000000 --- a/samples/bin/datas/post-fx/pixelate.sfx +++ /dev/null @@ -1,11 +0,0 @@ -texture framebuffer -vec2 mouse - -effect -{ - float factor = 5 + 100 * length(mouse); - - vec2 pos = floor(_in * factor) / factor; - - _out = framebuffer(pos); -} diff --git a/samples/bin/datas/post-fx/wave.sfx b/samples/bin/datas/post-fx/wave.sfx deleted file mode 100644 index 49b46071..00000000 --- a/samples/bin/datas/post-fx/wave.sfx +++ /dev/null @@ -1,12 +0,0 @@ -texture framebuffer -texture wave -vec2 offset - -effect -{ - vec2 texoffset = wave(_in * offset).xy; - texoffset -= vec2(0.5, 0.5); - texoffset *= 0.05; - - _out = framebuffer(_in + texoffset); -} diff --git a/samples/bin/datas/shader/arial.ttf b/samples/bin/datas/shader/arial.ttf new file mode 100644 index 00000000..ff0815cd Binary files /dev/null and b/samples/bin/datas/shader/arial.ttf differ diff --git a/samples/bin/datas/post-fx/background.jpg b/samples/bin/datas/shader/background.jpg similarity index 100% rename from samples/bin/datas/post-fx/background.jpg rename to samples/bin/datas/shader/background.jpg diff --git a/samples/bin/datas/shader/blur.sfx b/samples/bin/datas/shader/blur.sfx new file mode 100644 index 00000000..4c9f1128 --- /dev/null +++ b/samples/bin/datas/shader/blur.sfx @@ -0,0 +1,16 @@ +uniform sampler2D texture; +uniform float offset; + +void main() +{ + vec2 offx = vec2(offset, 0.0); + vec2 offy = vec2(0.0, offset); + + vec4 c0 = texture2D(texture, gl_TexCoord[0].xy); + vec4 c1 = texture2D(texture, gl_TexCoord[0].xy - offy); + vec4 c2 = texture2D(texture, gl_TexCoord[0].xy + offy); + vec4 c3 = texture2D(texture, gl_TexCoord[0].xy - offx); + vec4 c4 = texture2D(texture, gl_TexCoord[0].xy + offx); + + gl_FragColor = gl_Color * (c0 * 0.2 + c1 * 0.2 + c2 * 0.2 + c3 * 0.2 + c4 * 0.2); +} diff --git a/samples/bin/datas/shader/colorize.sfx b/samples/bin/datas/shader/colorize.sfx new file mode 100644 index 00000000..eeb407c8 --- /dev/null +++ b/samples/bin/datas/shader/colorize.sfx @@ -0,0 +1,11 @@ +uniform sampler2D texture; +uniform vec3 color; + +void main() +{ + vec4 pixel = texture2D(texture, gl_TexCoord[0].xy) * gl_Color; + float gray = pixel.r * 0.39 + pixel.g * 0.50 + pixel.b * 0.11; + + gl_FragColor = vec4(gray * color, 1.0) * 0.6 + pixel * 0.4; + gl_FragColor.a = pixel.a; +} diff --git a/samples/bin/datas/shader/fisheye.sfx b/samples/bin/datas/shader/fisheye.sfx new file mode 100644 index 00000000..97e3f8e4 --- /dev/null +++ b/samples/bin/datas/shader/fisheye.sfx @@ -0,0 +1,13 @@ +uniform sampler2D texture; +uniform vec2 mouse; + +void main() +{ + float len = distance(gl_TexCoord[0].xy, mouse) * 7.0; + + vec2 coords = gl_TexCoord[0].xy; + if (len < 1.0) + coords += (gl_TexCoord[0].xy - mouse) * len; + + gl_FragColor = texture2D(texture, coords) * gl_Color; +} diff --git a/samples/bin/datas/shader/nothing.sfx b/samples/bin/datas/shader/nothing.sfx new file mode 100644 index 00000000..cde0473a --- /dev/null +++ b/samples/bin/datas/shader/nothing.sfx @@ -0,0 +1,6 @@ +uniform sampler2D texture; + +void main() +{ + gl_FragColor = texture2D(texture, gl_TexCoord[0].xy) * gl_Color; +} diff --git a/samples/bin/datas/shader/pixelate.sfx b/samples/bin/datas/shader/pixelate.sfx new file mode 100644 index 00000000..5b82f08d --- /dev/null +++ b/samples/bin/datas/shader/pixelate.sfx @@ -0,0 +1,10 @@ +uniform sampler2D texture; +uniform vec2 mouse; + +void main() +{ + float factor = 5 + 100 * length(mouse); + vec2 pos = floor(gl_TexCoord[0].xy * factor + 0.5) / factor; + + gl_FragColor = texture2D(texture, pos) * gl_Color; +} diff --git a/samples/bin/datas/post-fx/sprite.png b/samples/bin/datas/shader/sprite.png similarity index 100% rename from samples/bin/datas/post-fx/sprite.png rename to samples/bin/datas/shader/sprite.png diff --git a/samples/bin/datas/post-fx/wave.jpg b/samples/bin/datas/shader/wave.jpg similarity index 100% rename from samples/bin/datas/post-fx/wave.jpg rename to samples/bin/datas/shader/wave.jpg diff --git a/samples/bin/datas/shader/wave.sfx b/samples/bin/datas/shader/wave.sfx new file mode 100644 index 00000000..2d04763a --- /dev/null +++ b/samples/bin/datas/shader/wave.sfx @@ -0,0 +1,12 @@ +uniform sampler2D texture; +uniform sampler2D wave; +uniform vec2 offset; + +void main() +{ + vec2 texoffset = texture2D(wave, (gl_TexCoord[0].xy * offset).xy); + texoffset -= vec2(0.5, 0.5); + texoffset *= 0.05; + + gl_FragColor = texture2D(texture, gl_TexCoord[0].xy + texoffset) * gl_Color; +} diff --git a/samples/build/codeblocks/postfx.cbp b/samples/build/codeblocks/shader.cbp similarity index 84% rename from samples/build/codeblocks/postfx.cbp rename to samples/build/codeblocks/shader.cbp index 97350db7..6fe6a3ff 100644 --- a/samples/build/codeblocks/postfx.cbp +++ b/samples/build/codeblocks/shader.cbp @@ -2,13 +2,13 @@ -