SFML community forums

General => SFML projects => Topic started by: Zinlibs on May 24, 2012, 02:58:22 pm

Title: Zoost & Zoom : Geometry, animations and graphics
Post by: Zinlibs on May 24, 2012, 02:58:22 pm
Hello people !  :)

Today I present to you both libraries those I'm working for several times and I'm proud to share to the community. My philosophy is to totally make the difference between the geometric aspect to the graphical rendering one, or any potential other use (such a physic engine, that I'm programming according to the fisrt lib, by the way) :  ;D

The first one is called Zoost and allows you to create some geometric objects as simply it can be, and to give them the abbility to interact each other (totally appart from the SFML).
From segments to triangles, without forgetting curves (including Bezier ones) and concav polygons, you just are spoiled for choice (and I will add others soon).
You can of course create your own customized geometries according to a low and high level system at the same time.  ;D

The second one is Zoom (based on SFML 2.0 RC) which focus on the animation aspect and the graphical one, allowing you to use a geometry from Zoost and to animate it in the way you want. But it's not all the things, because you will be able to render and display the geometries and totally custom the rendering (size of each points, segment's color, filling of the shapes, etc...). Finally, the libs includes an engine of light rendering, based on the great Gregouar's work, all cleaned for the occasion. In a not so far away future, I will add the handling of the just new way to render the 2.5D shadows (by the same author) ! I'm very impatient for that...  :P

Example of creation of a concav polygon and its rendering :

Code: [Select]
Geom geom = Geom::polygon({{0, 0}, {25, 100}, {40, 100}, {40, 0}, {100, 0}, {100, 100}, {120, 100}, {120, 0}, {180, 0}, {180, 100}, {200, 100}, {200, 0}, {260, 0}, {260, 100}, {275, 100}, {300, 0}, {300, 120}, {240, 120}, {240, 20}, {220, 20}, {220, 120}, {160, 120}, {160, 20}, {140, 20}, {140, 120}, {80, 120}, {80, 20}, {60, 20}, {60, 120}, {0, 120}});
geom.setPosition(130, 200);
geom.scale(1.5, 1.5);

Shape shape(geom);
shape.setFaceColor(Color::SpringGreen);
shape.setLiaisonColor(Color::DarkGreen);
shape.setLiaisonWidth(3);

target.draw(shape);

Example of animation of an object with a curve and a kinetic :

Code: [Select]
Curve curve = Curve::bezier({767, 410, 1000, 900, 1000, 30, 500, 30, 1, 30, 50, 560, 169, 410}) + Curve({169, 410, 228, 321, 386, 571, 553, 261, 421, 218, 575, 464, 767, 410});
curve.setOrigin(500, 370);

Kinetic kinetic(curve, 400, 0, true); // 400 is the speed of the curse over the curve each, 0 means that it is starting at the begining (always inferior or equal to 1) and true that the kinetic is looping on itself.

// Main loop :

Vector2d coords = curve.convertToGlobal(kinetic.update(clock.restart())); // New point of curve tracking.
myShape.setPosition(coords);

That's it ! Both libraries are not fully complete, but bringed to be quickly improved (because I need them in my future projects). I'll tell you up to date and I'll answer here for all your questions and suggestions !  ::)

https://github.com/Zinlibs/Zoost (https://github.com/Zinlibs/Zoost)
https://github.com/Zinlibs/Zoom (https://github.com/Zinlibs/Zoom)

Thank you (and sorry for my poor english, I'm French, you know...  :-X) !
Title: Re: Zoost & Zoom : Geometry, animations and graphics
Post by: Nexus on May 26, 2012, 09:51:38 am
Looks interesting, but unfortunately it works only on g++. You use C++11 initializer lists which are not supported by Visual Studio, and also the compiler flags -Wfatal-errors -std=c++0x are specific to g++.
Title: Re: Zoost & Zoom : Geometry, animations and graphics
Post by: Zinlibs on May 27, 2012, 05:18:08 pm
Quote
Looks interesting, but unfortunately it works only on g++. You use C++11 initializer lists which are not supported by Visual Studio, and also the compiler flags -Wfatal-errors -std=c++0x are specific to g++.

Thank you Nexus for your interest. Ofc, I will add a condition in the cmakelists to support VS flags.
But what about the last release of VS and the C++11 integration ?
Title: Re: Zoost & Zoom : Geometry, animations and graphics
Post by: eXpl0it3r on May 28, 2012, 12:13:21 am
But what about the last release of VS and the C++11 integration ?

VS11 is only in release candidate state and it's not sure if Microsoft will make the free version support only metro style apps programming (unfortunatly)...
Title: Re: Zoost & Zoom : Geometry, animations and graphics
Post by: Zinlibs on May 28, 2012, 01:24:53 am
Big update, with many bugs corrected and a new feature : Shapes are now automatically updated when their geometries are modified. I.e. a color property is created in the Shape when a vertex is added to the Geom, and removed from the Geom when erased from the Geom. Default properties are used at creation, but you can easily custom each one at any moment. That allows to you to create very custom shapes and maintains them up-to-date according to the matching Geom.
Title: Re: Zoost & Zoom : Geometry, animations and graphics
Post by: Nexus on May 28, 2012, 10:02:06 am
But what about the last release of VS and the C++11 integration ?
Several C++11 features are already supported, but initializer lists aren't. And as far as I know, the next version won't support them either.

Here (http://blogs.msdn.com/b/vcblog/archive/2011/09/12/10209291.aspx) is a complete list of Visual Studio's C++11 support, and here (https://wiki.apache.org/stdcxx/C++0xCompilerSupport) an overview over all compilers.
Title: Re: Zoost & Zoom : Geometry, animations and graphics
Post by: Zinlibs on June 09, 2012, 08:26:35 pm
Hey,

Here is the list of the newest changes I made :

Zoost :

- Missing comments of the function declarations added
- Functions of angle conversion added (radian / degrees)
- onTransformUpdated method added to the Geom::Observer class

Zoom :

- sf::VertexArray are now the only drawables used for the rendering
- The rendering is now saved, that implies it is not created again each time the Draw function is called
- Simplification and improvement of the examples

Zoom is now faster according to the Vertex Arrays exclusive use and the rendering updated only when necessary.
The big next update will be the sf::Transform use in the Draw method to only draw from the locals coordinates. That should highly increase the performances.
Edit : Done !

I don't talk as much about the light engine, because it remains a very annoying bug (when the light is rotated in fact) and I couldn't find the solution up to now.
Title: Re: Zoost & Zoom : Geometry, animations and graphics
Post by: Zinlibs on July 07, 2012, 06:14:55 pm
Hello,

I've a good new : I've just finished to include the 2.5D Gregouar's light engine in Zoom ! Of course, this is just a first try, and I will do my possible to simplify that (the main is too much complicated) with a new class (like my LightEngine class) and maintain everything synchronized with the Gregouar's job.

See ya for new infos !  :)

PS : Wiki documentation added.
Title: Re: Zoost & Zoom : Geometry, animations and graphics
Post by: aNewHobby on July 11, 2012, 04:18:11 pm
had a look at this last night but was unable to get it to compile with cmake in windows
Title: Re: Zoost & Zoom : Geometry, animations and graphics
Post by: Zinlibs on July 11, 2012, 08:21:38 pm
I will answer to your MP here, that's better for everyone. In fact, you are trying to compile with nmake, the Visual Studio's compiler, that unfortunately doesn't support the flags used in the CMakelists. Even if you remove them, and Nexus said it before, VS don't support the std::initializer_list of C++11. So, the only solution for now is to compile Zoost & Zoom using the GCC compiler.
Title: Re: Zoost & Zoom : Geometry, animations and graphics
Post by: Ockonal on July 12, 2012, 09:50:37 pm
Great job ;) I like the new 2.5d lighting example.
Title: Re: Zoost & Zoom : Geometry, animations and graphics
Post by: Zinlibs on July 13, 2012, 12:57:41 am
Thanks ! You can thank Gregouar for the code, I just adapted it to make it compatible with Zoom.  :P
Title: Re: Zoost & Zoom : Geometry, animations and graphics
Post by: Ockonal on August 03, 2012, 05:54:15 pm
Just wanted to ask, maybe you can write ability to use texture for strokes?
Title: Re: Zoost & Zoom : Geometry, animations and graphics
Post by: Zinlibs on August 05, 2012, 09:13:48 pm
Yes, It is planned.
Title: Re: Zoost & Zoom : Geometry, animations and graphics
Post by: Ockonal on August 05, 2012, 11:34:21 pm
Oh, it's great. For now, you don't know the exact time of this feature? :)
There is already written library called `Stroke` in wiki. It's a bit old and author stopped it's developing, but you can look at realization.

Thanks ;)
Title: Re: Zoost & Zoom : Geometry, animations and graphics
Post by: Zinlibs on August 06, 2012, 01:55:53 am
For now, I'm busy with a home-made game engine, but I think I could work on a stroke system in a couple of week.