Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Thor 2.0 released!  (Read 379512 times)

0 Members and 8 Guests are viewing this topic.

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Thor 2.0 released!
« on: March 19, 2012, 05:40:54 pm »


Thor 2.0 released!

Thor is an open-source and cross-platform C++ library. It extends the multimedia library SFML with higher-level features such as:
  • Animations
  • Particle systems
  • Resource management
  • Time measurement utilities
  • Event handling and callbacks
  • Delaunay triangulation
  • Color gradients
  • Vector algebra
  • ...
Links


(click to show/hide)
« Last Edit: July 12, 2015, 12:39:18 pm by Nexus »
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Thor 2.0
« Reply #1 on: March 21, 2012, 08:54:50 am »
Looking forward to it! :D

Btw does Thor 2.0 depend up on Aurora, I mean do I have to checkout Aurora too if I want to use Thor 2.0?

Edit: Oh I just saw that Aurora is included in the extlib folder. :)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Thor 2.0
« Reply #2 on: March 21, 2012, 09:05:29 am »
Quote
Aurora is included in the extlib folder

Nexus, do you know that you can add it as a Git submodule instead of copying it? A submodule is a link/shortcut to an external repository, at a given revision. As a result, the submodule appears as if it was directly included in the main repo, but in fact you get its files from its own repo directly.
Laurent Gomila - SFML developer

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Thor 2.0
« Reply #3 on: March 21, 2012, 11:29:56 am »
Yes, I originally wanted to do it like this. However I've had some trouble setting it up with local repositories, and I've read at different places that submodules wouldn't be a very mature concept (for example, one cannot easily delete them). If I remember correctly, a Git clone doesn't clone submodule directories, leaving more work to the user. Currently I use the subtree approach described here.

Or have you made other experiences and can you recommend Git submodules?
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Thor 2.0
« Reply #4 on: March 21, 2012, 11:53:56 am »
Quote
If I remember correctly, a Git clone doesn't clone submodule directories, leaving more work to the user.

Instead of
Quote
git pull

one would have to do
Quote
git pull
git submodule update

(same with "init" instead of "update" for the initial cloning)

Quote
Or have you made other experiences and can you recommend Git submodules?

We're using it when working on multiple interconnected projects, and so far it has always been ok for us.
However I've never tested the subtree approach so I cannot compare.
Laurent Gomila - SFML developer

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
Thor 2.0
« Reply #5 on: March 21, 2012, 01:59:02 pm »
With submodules :
- you can't just do git clone (have to add --recursive)
- the zip archive provided by GitHub won't include the submodules
- you still have to manually update the submodule head against which you want your own sources to be updated (if modifications are done in SFML repo, they won't be automatically transferred to your repo for example)
Want to play movies in your SFML application? Check out sfeMovie!

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: Thor 2.0
« Reply #6 on: March 25, 2012, 10:48:13 am »
Thanks for the information, Ceylo. I have switched to the git-subtree tool, it works good so far. And the advantage over git merge -s subtree is that I can have one commit and a merge (because in subtree merge, --squash hides the merge message). And of course it's easier, I don't need a separate branch.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

pierreyoda

  • Full Member
  • ***
  • Posts: 186
    • View Profile
    • http://pierreyoda.pagesperso-orange.fr/
Re: Thor 2.0
« Reply #7 on: March 25, 2012, 11:06:12 am »
Hello, I switched to Thor 2.0 (after hours of pain with boost::python in order to make aur::CopiedPtr work...  :-X ) but I get a std::logic_error when loading an image : "No copy allowed".
Same error in the Resources example.

I should note that I disabled C++11 support (commenting "aur/Config.hpp", as it provoked compile errors in cmath (MinGW build : , i.e. TDM-GCC 4.6.1), I guess the problem is there  ???
Projects:
- Open Rodent's Revenge (rewriting in progress)
- Open Advanced War (paused)

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: Thor 2.0
« Reply #8 on: March 25, 2012, 11:25:38 am »
Yes, that's the problem. A little bit on the background:

In some cases, aur::CopiedPtr doesn't have to be copied, for example when you pass a temporary object to a function or return an object from a function. In C++11, this is very easy to achieve with move semantics. In C++98, I hoped that compiler optimisations (like RVO) could lead to the same result, but in fact it's too unreliable to make semantics depend on it. The std::logic_error approach is an interim solution, it's not my style to throw exceptions upon logic errors.

Unfortunately, there is no elegant way to transfer ownership in C++98. In Thor 1, MovedPtr was designed to achieve this, but I realized the whole design got too complicated and unintuitive (a user didn't know when to use which smart pointer, had to invoke thor::Copy() manually in some cases, and was surprised by implicit ownership transfer). That's why I simplyfied the Aurora.SmartPtr module a lot -- and interestingly -- made it far more powerful at the same time.

I see two solutions to deal with the problem:
  • Enforce C++11. That would be very nice anyway.
  • In the specific case of Thor.Resources, use raw pointers. Although I don't like them, it might be justified in this case. However, this doesn't solve the problem of unnecessary (and possibly expensive) copies in other situations.
You say C++11 support provoked compile errors, can you give more details?
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

pierreyoda

  • Full Member
  • ***
  • Posts: 186
    • View Profile
    • http://pierreyoda.pagesperso-orange.fr/
Re: Thor 2.0
« Reply #9 on: March 25, 2012, 12:34:53 pm »
Well, I just updated and rebuild Thor and... it works!  ???
The only visible difference is the "THOR_USE_CPP11" option in cmake (CXX_FLAGS was already set to "-std=c++0x")... Whatever, It works  :P

PS : the error was in cmath, on a "using :..." line.
Projects:
- Open Rodent's Revenge (rewriting in progress)
- Open Advanced War (paused)

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: Thor 2.0
« Reply #10 on: March 25, 2012, 05:19:06 pm »
The first bigger refactoring has been done, it concerns the design of the particle emitters. I wrote the new UniversalEmitter class, which is far more powerful than the existing emitters. As the name implies, you can set every initial particle attribute using a functor. That is, you specify a function that is called every time a particle is emitted. For example, you can specify a random distribution for the initial position. Or set the position according to the mouse or another game object. Hereby, the predefined distributions in Math/Distributions.hpp may be of help.
thor::UniversalEmitter::Ptr emitter = thor::UniversalEmitter::create();
emitter->setEmissionRate( 20 );
emitter->setPosition( thor::Distributions::circle(center, radius) );
emitter->setRotation( thor::Distributions::uniform(0.f, 360) );

Using the aur::Distribution class template, you can also specify constants, so the syntax is still simple if you don't need the flexibility:
emitter->setColor( sf::Color::Red );
emitter->setLifetime( sf::seconds(4) );

This new design also has an impact on other parts of the library, namely:
  • The complete Geometry module has been removed. For a long time, I thought about a redesign of the Zone class hierarchy. I have never liked the asymmetric treatment of initial position (determined via Zone) and initial rotation (not possible to set at all). While searching for alternatives, I came up with the distribution approach.
  • Removed classes DirectionalEmitter and TargetEmitter. They are too specific, UniversalEmitter outperforms them easily in terms of flexibility.
  • Turned Emitter class into a stateless interface. For custom emitters, no more attributes are dictated by the library, so you can implement whatever you want.
  • Renamed emitter methods. Instead of setParticleVelocity(), it's now just setVelocity().
« Last Edit: March 25, 2012, 06:17:53 pm by Nexus »
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Astrof

  • Full Member
  • ***
  • Posts: 135
    • View Profile
Re: Thor 2.0
« Reply #11 on: March 28, 2012, 07:00:59 am »
I'm having a problem trying to compile Thor with CMake.  Specifically I'm getting the same SFML_DIR-NOTFOUND error (whether I change SFMLDIR or SFML_DIR it always comes out with the same error). I have SFML installed from the git tutorial. 

EDIT: I got it fixed; for some reason the FindSFML.cmake file wasn't copied to the Modules folder in CMake.  Copying it over seemed to fix it.  While compiling however I get an error when trying to compile the examples:

Code: [Select]
C:\Thor\examples\Particles.cpp: In function 'int main()':
C:\Thor\examples\Particles.cpp:111: error: no matching function for call to 'sf:
:RenderWindow::convertCoords(unsigned int&, unsigned int&)'
C:/Program Files (x86)/SFML/include/SFML/Graphics/RenderTarget.hpp:152: note: ca
ndidates are: sf::Vector2f sf::RenderTarget::convertCoords(const sf::Vector2i&)
const
C:/Program Files (x86)/SFML/include/SFML/Graphics/RenderTarget.hpp:177: note:
              sf::Vector2f sf::RenderTarget::convertCoords(const sf::Vector2i&,
const sf::View&) const
mingw32-make[2]: *** [examples/CMakeFiles/Particles.dir/Particles.cpp.obj] Error
 1
mingw32-make[1]: *** [examples/CMakeFiles/Particles.dir/all] Error 2
mingw32-make: *** [all] Error 2
« Last Edit: March 28, 2012, 07:42:05 am by Astrof »

DJuego

  • Jr. Member
  • **
  • Posts: 50
    • View Profile
Re: Thor 2.0
« Reply #12 on: March 28, 2012, 02:16:49 pm »
I'm having a problem trying to compile Thor with CMake.  Specifically I'm getting the same SFML_DIR-NOTFOUND error (whether I change SFMLDIR or SFML_DIR it always comes out with the same error). I have SFML installed from the git tutorial. 

EDIT: I got it fixed; for some reason the FindSFML.cmake file wasn't copied to the Modules folder in CMake.  Copying it over seemed to fix it.


Yep! I confirm the problem and the solution (thanks Astrof!) with Bromeon-Thor-9b4b3d9.tar.gz.

On the other hand I can not meta-build the examples with CMake-2.8.7

Code: [Select]
CMake Error at CMakeLists.txt:38 (thor_link_thor):
  Unknown CMake command "thor_link_thor".
Call Stack (most recent call first):
  CMakeLists.txt:51 (thor_example)


CMake Warning (dev) in CMakeLists.txt:
  No cmake_minimum_required command is present.  A line of code such as

    cmake_minimum_required(VERSION 2.8)

  should be added at the top of the file.  The version specified may be lower
  if you wish to support older CMake versions for this project.  For more
  information run "cmake --help-policy CMP0000".
This warning is for project developers.  Use -Wno-dev to suppress it.

Configuring incomplete, errors occurred!


Thanks in Advance!!

DJuego

P.S: Fantastic complement, Nexus. Thank you very much!!!  :P

Windows 7 64b
Visual Studio 2010

pierreyoda

  • Full Member
  • ***
  • Posts: 186
    • View Profile
    • http://pierreyoda.pagesperso-orange.fr/
Re: Thor 2.0
« Reply #13 on: March 28, 2012, 05:54:19 pm »
By the way, the Airport download links are broken  :P
Projects:
- Open Rodent's Revenge (rewriting in progress)
- Open Advanced War (paused)

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: Thor 2.0
« Reply #14 on: March 29, 2012, 05:52:40 pm »
I'm having a problem trying to compile Thor with CMake.  Specifically I'm getting the same SFML_DIR-NOTFOUND error (whether I change SFMLDIR or SFML_DIR it always comes out with the same error). I have SFML installed from the git tutorial.
I think you have to install SFML, not just build it (the CMake install command copies the FindSFML file). You have to type make install (using g++) or compile the INSTALL project (Visual Studio).

On the other hand I can not meta-build the examples with CMake-2.8.7
What do you mean with meta-build? The examples/CMakeLists.txt file cannot be used autonomously, it is invoked by the top-level CMakeLists.txt.

By the way, the Airport download links are broken  :P
Thanks, I'll fix them.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

 

anything