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

Author Topic: Object Loader (similar to AssImp)  (Read 9102 times)

0 Members and 1 Guest are viewing this topic.

zmertens

  • Jr. Member
  • **
  • Posts: 80
    • View Profile
Object Loader (similar to AssImp)
« 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? 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.
The truth will set you free but first it will piss you off.

ChronicRat

  • Sr. Member
  • ****
  • Posts: 327
  • C++ programmer
    • View Profile
    • My blog
Re: Object Loader (similar to AssImp)
« Reply #1 on: February 06, 2015, 09:47:20 pm »
From assimp site:
Quote
No external dependencies except boost
No dependencies... oh, yeah, just boost.

zmertens

  • Jr. Member
  • **
  • Posts: 80
    • View Profile
Re: Object Loader (similar to AssImp)
« Reply #2 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).
The truth will set you free but first it will piss you off.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Object Loader (similar to AssImp)
« Reply #3 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
Laurent Gomila - SFML developer

Mario

  • SFML Team
  • Hero Member
  • *****
  • Posts: 879
    • View Profile
Re: Object Loader (similar to AssImp)
« Reply #4 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. :(

zmertens

  • Jr. Member
  • **
  • Posts: 80
    • View Profile
Re: Object Loader (similar to AssImp)
« Reply #5 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. 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.
The truth will set you free but first it will piss you off.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Object Loader (similar to AssImp)
« Reply #6 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.
Laurent Gomila - SFML developer

Gambit

  • Sr. Member
  • ****
  • Posts: 283
    • View Profile
Re: Object Loader (similar to AssImp)
« Reply #7 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.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
AW: Object Loader (similar to AssImp)
« Reply #8 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. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Gambit

  • Sr. Member
  • ****
  • Posts: 283
    • View Profile
Re: Object Loader (similar to AssImp)
« Reply #9 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).

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
AW: Object Loader (similar to AssImp)
« Reply #10 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.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Austin J

  • Newbie
  • *
  • Posts: 29
    • View Profile
    • Email
Re: Object Loader (similar to AssImp)
« Reply #11 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

Austin J

  • Newbie
  • *
  • Posts: 29
    • View Profile
    • Email
Re: Object Loader (similar to AssImp)
« Reply #12 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.