SFML community forums

General => Feature requests => Topic started by: zmertens on February 06, 2015, 09:43:58 pm

Title: Object Loader (similar to AssImp)
Post by: zmertens on February 06, 2015, 09:43:58 pm
Any chance SFML could add an in-house object loader for common files types (.obj, .tga, ...) similar to ASSIMP (http://assimp.sourceforge.net/)? It could be very useful just to get the vertices, indices, normals, and so forth for 3D projects. I'm not too familiar with all the file types, but I know .obj files are pretty straight forward to parse.
Title: Re: Object Loader (similar to AssImp)
Post by: ChronicRat on February 06, 2015, 09:47:20 pm
From assimp site:
Quote
No external dependencies except boost
No dependencies... oh, yeah, just boost.
Title: Re: Object Loader (similar to AssImp)
Post by: zmertens on February 06, 2015, 09:58:22 pm
I don't mean integrating ASSIMP directly into SFML, but using similar features (similar to how sf::Image uses stb_image internally if I recall correctly).
Title: Re: Object Loader (similar to AssImp)
Post by: Laurent on February 06, 2015, 10:20:58 pm
1. SFML doesn't deal with 3D

2. I know something similar to ASSIMP that works very well: ASSIMP
Title: Re: Object Loader (similar to AssImp)
Post by: Mario on February 07, 2015, 11:04:24 am
I think TGA images are actually supported by stb_image, so SFML should be able to load them. :)

And I agree with Laurent, I don't see any point in loading 3D formats, especially considering SFML doesn't support the third dimension (unless you fiddle with your own OpenGL calls).

A simple SVG loader would be awesome. Problem here is "simple", though. :(
Title: Re: Object Loader (similar to AssImp)
Post by: zmertens on February 07, 2015, 09:59:20 pm
You guys make some good points. And Mario's right, stb_image does support TGA's according to the GitHub (https://github.com/nothings/stb). I think I was thinking of another popular object file type at the time I wrote that. I guess I just wanted something that had the same spirit as SFML (to satisfy my OCD). I think if I have some extra time I might try to make sf::Model class for fun - it would only be able to parse .obj files though (because that's all I know).

namespace sf
class Model
{
public:
    Model(std::string filename);
    // getters + setters
private:
    std::vector<sf::Vector3f> mVertices, mNormals;
    std::vector<sf::Vector2f> mTexCoords;
    std::vector<unsigned int> mIndices;
};

 It would basically perform the same functionality as the ASSIMP ai_scene that gathers normals, indices, vertices. But like Laurent said using ASSIMP is much easier (and provides more functionality) so I'm not sure what the real point would be.
Title: Re: Object Loader (similar to AssImp)
Post by: Laurent on February 07, 2015, 10:05:41 pm
This SFML fork with support for 3D may interest you: https://github.com/binary1248/SFML

It has support for models, but doesn't load model files. However it has a very simple OBJ loader in the "3d" example.
Title: Re: Object Loader (similar to AssImp)
Post by: Gambit on February 08, 2015, 04:09:45 am
Can someone explain how SFML doesnt support 3D? It supports user provided OpenGL calls. You can just add the 3D yourself with GLM or something.
Title: AW: Object Loader (similar to AssImp)
Post by: eXpl0it3r on February 08, 2015, 07:53:10 am
If you use OpenGL calls for 3D, you're not using SFML calls and you can't use SFML calls for 3D, since it isn't supported. ;)
Title: Re: Object Loader (similar to AssImp)
Post by: Gambit on February 08, 2015, 11:10:10 am
I see. Well how would SFML "support" 3D? I assume a camera and projection and the ability to project sprites onto a 3d plane? I think asset loading shouldnt be directly supported since its sort of ambiguous (i.e Multiple libraries and formats for 3D assets).
Title: AW: Object Loader (similar to AssImp)
Post by: eXpl0it3r on February 08, 2015, 11:38:09 am
As Laurent pointed out, you can check out the fork which added some basic 3D capabilities.
For now we won't be investigating 3D support.
Title: Re: Object Loader (similar to AssImp)
Post by: Austin J on February 08, 2015, 07:23:18 pm
From assimp site:
Quote
No external dependencies except boost
No dependencies... oh, yeah, just boost.

1. SFML doesn't deal with 3D

2. I know something similar to ASSIMP that works very well: ASSIMP

I love the sass in this thread!  ;D
Title: Re: Object Loader (similar to AssImp)
Post by: Austin J on February 08, 2015, 07:27:21 pm
Anyways IMO if you want to mix 3d with 2d much at all, you're a lot better off just picking a 3d lib, whether it's OGRE, Irrlicht, Horde, whatever, the fact is these libraries aren't exclusively 3d, they have 2d features, and I think it makes better sense to go with them than to make a Christmas list for Laurent to look at.