SAM-Viewer [0.5]
- stu
- Member
- Posts: 923
- Joined: Sat Feb 02, 2013 02:51
- GitHub: stujones11
- Location: United Kingdom
SAM-Viewer [0.5]
Introducing SAM-Viewer, a simple 3d mesh viewer built with Irrlicht rendering engine.
Nothing really new or exiting here, just a personal project to try and better understand the Irrlicht engine in general and get to the bottom of the attachment glitches with my wield3d mod.
I am sharing this for the benefit of anyone else learning c++ or Irrlicht and thought might be helpful to the MT modding community. If nothing else, it provides a convenient way to check your blender exports with the core rendering engine. You can even use this as a skin editing preview tool, along with your pixel editor of choice.
Some may also notice that the model included with the distribution does not suffer the same 180 degree reversal effects as the current version you get with Minetest Game. This is because if have tweaked the animation bone positions to never perfectly align with the zero axis. I am still unsure if the blender export is at fault or the Irrlicht model loader.
I love to hear from anyone that gets this to build, although it is pretty much linux + openGL only for now. Any help in improving it to make the app more portable would be greatly appreciated.
Constructive code critique is also welcomed as this is the first complete c++ app I have ever publicly released. The code-style is very much my own but just happens to be pretty much the same as that of MTE. If that style diverges in places then meh, I am not fixing that :P
Aside from bug-fixes and the things listed on the official todo list, I am not too sure how much further I will be taking this, however, I will consider any reasonable suggestions that could make the app more useful.
Download/browse code: https://github.com/stujones11/SAM-Viewer
Screenshot:
Nothing really new or exiting here, just a personal project to try and better understand the Irrlicht engine in general and get to the bottom of the attachment glitches with my wield3d mod.
I am sharing this for the benefit of anyone else learning c++ or Irrlicht and thought might be helpful to the MT modding community. If nothing else, it provides a convenient way to check your blender exports with the core rendering engine. You can even use this as a skin editing preview tool, along with your pixel editor of choice.
Some may also notice that the model included with the distribution does not suffer the same 180 degree reversal effects as the current version you get with Minetest Game. This is because if have tweaked the animation bone positions to never perfectly align with the zero axis. I am still unsure if the blender export is at fault or the Irrlicht model loader.
I love to hear from anyone that gets this to build, although it is pretty much linux + openGL only for now. Any help in improving it to make the app more portable would be greatly appreciated.
Constructive code critique is also welcomed as this is the first complete c++ app I have ever publicly released. The code-style is very much my own but just happens to be pretty much the same as that of MTE. If that style diverges in places then meh, I am not fixing that :P
Aside from bug-fixes and the things listed on the official todo list, I am not too sure how much further I will be taking this, however, I will consider any reasonable suggestions that could make the app more useful.
Download/browse code: https://github.com/stujones11/SAM-Viewer
Screenshot:
Last edited by stu on Sun Oct 07, 2018 16:01, edited 1 time in total.
- GreenXenith
- Member
- Posts: 1356
- Joined: Wed Oct 28, 2015 01:26
- GitHub: GreenXenith
- Location: UTC-8:00
- Contact:
Re: SAM-Viewer
I receive this error when compiling:
Code: Select all
/home/user/SAM-Viewer/src/dialog.cpp: In function ‘void open_url(std::__cxx11::string)’:
/home/user/SAM-Viewer/src/dialog.cpp:19:8: warning: ignoring return value of ‘int system(const char*)’, declared with attribute warn_unused_result [-Wunused-result]
system((std::string("xdg-open \"") + url + std::string("\"")).c_str());
~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/samviewer.dir/all' failed
make[1]: *** [CMakeFiles/samviewer.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
YouTube | Mods | Patreon | Minetest Discord @greenxenith
You should not be able to read this message.
You should not be able to read this message.
- stu
- Member
- Posts: 923
- Joined: Sat Feb 02, 2013 02:51
- GitHub: stujones11
- Location: United Kingdom
Re: SAM-Viewer
Yeah, I am not really sure about that code, it was adapted from a stack-overflow answer to opening a browser page. However, that is merely a warning. Do you see any other specific error messages in the build log?GreenDimond wrote:I receive this error when compiling:Code: Select all
warning: ignoring return value of ‘int system(const char*)’, declared with attribute warn_unused_result
- GreenXenith
- Member
- Posts: 1356
- Joined: Wed Oct 28, 2015 01:26
- GitHub: GreenXenith
- Location: UTC-8:00
- Contact:
Re: SAM-Viewer
Yes.stu wrote:Do you see any other specific error messages in the build log?
Code: Select all
make[2]: *** No rule to make target '/usr/local/lib/libIrrlicht.so', needed by 'bin/samviewer'. Stop.
YouTube | Mods | Patreon | Minetest Discord @greenxenith
You should not be able to read this message.
You should not be able to read this message.
- Krock
- Developer
- Posts: 4650
- Joined: Thu Oct 03, 2013 07:48
- GitHub: SmallJoker
- Location: Switzerland
- Contact:
Re: SAM-Viewer
I'm probably getting the same error, which is caused by the hardcoded path for Irrlicht in this project: "/usr/local/lib/libIrrlicht.so" whereas it should be "/usr/lib/x86_64-linux-gnu/libIrrlicht.so" on my system.
Here's how Minetest does it: https://github.com/minetest/minetest/bl ... ke#L41-L53
Compiling works after adjusting this but it's already late so I'll review it later on :)
Here's how Minetest does it: https://github.com/minetest/minetest/bl ... ke#L41-L53
Compiling works after adjusting this but it's already late so I'll review it later on :)
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>
- stu
- Member
- Posts: 923
- Joined: Sat Feb 02, 2013 02:51
- GitHub: stujones11
- Location: United Kingdom
Re: SAM-Viewer
Did you try the suggested:GreenDimond wrote:Code: Select all
make[2]: *** No rule to make target '/usr/local/lib/libIrrlicht.so', needed by 'bin/samviewer'. Stop.
Code: Select all
cmake . -DIRRLICHT_LIBRARY="/usr/lib/libIrrlicht.so"`
Thank you so much for showing an interest, I will very much look forward to that :)Krock wrote:Compiling works after adjusting this but it's already late so I'll review it later on :)
- GreenXenith
- Member
- Posts: 1356
- Joined: Wed Oct 28, 2015 01:26
- GitHub: GreenXenith
- Location: UTC-8:00
- Contact:
Re: SAM-Viewer
I still get:stu wrote:Did you try the suggested:GreenDimond wrote:Code: Select all
make[2]: *** No rule to make target '/usr/local/lib/libIrrlicht.so', needed by 'bin/samviewer'. Stop.
Code: Select all
cmake . -DIRRLICHT_LIBRARY="/usr/lib/libIrrlicht.so"`
Code: Select all
make[2]: *** No rule to make target '/usr/lib/libIrrlicht.so', needed by 'bin/samviewer'. Stop.
make[2]: *** Waiting for unfinished jobs....
[ 12%] Building CXX object CMakeFiles/samviewer.dir/src/main.cpp.o
[ 37%] Building CXX object CMakeFiles/samviewer.dir/src/gui.cpp.o
[ 37%] Building CXX object CMakeFiles/samviewer.dir/src/dialog.cpp.o
[ 50%] Building CXX object CMakeFiles/samviewer.dir/src/config.cpp.o
[ 62%] Building CXX object CMakeFiles/samviewer.dir/src/trackball.cpp.o
[ 87%] Building CXX object CMakeFiles/samviewer.dir/src/viewer.cpp.o
[ 87%] Building CXX object CMakeFiles/samviewer.dir/src/scene.cpp.o
/home/user/SAM-Viewer/src/dialog.cpp: In function ‘void open_url(std::__cxx11::string)’:
/home/user/SAM-Viewer/src/dialog.cpp:19:8: warning: ignoring return value of ‘int system(const char*)’, declared with attribute warn_unused_result [-Wunused-result]
system((std::string("xdg-open \"") + url + std::string("\"")).c_str());
~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/samviewer.dir/all' failed
make[1]: *** [CMakeFiles/samviewer.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
YouTube | Mods | Patreon | Minetest Discord @greenxenith
You should not be able to read this message.
You should not be able to read this message.
- stu
- Member
- Posts: 923
- Joined: Sat Feb 02, 2013 02:51
- GitHub: stujones11
- Location: United Kingdom
Re: SAM-Viewer
Sorry, my build script clearly sucks but hopefully those more experienced can help me clean this up.
To fix this you need to replace the path in the cmake option to where that library resides on your own system.
To fix this you need to replace the path in the cmake option to where that library resides on your own system.
- GreenXenith
- Member
- Posts: 1356
- Joined: Wed Oct 28, 2015 01:26
- GitHub: GreenXenith
- Location: UTC-8:00
- Contact:
Re: SAM-Viewer
Ah, thankyou.stu wrote:To fix this you need to replace the path in the cmake option to where that library resides on your own system.
Code: Select all
cmake . -DIRRLICHT_LIBRARY="/usr/lib/x86_64-linux-gnu/libIrrlicht.so"
First look: Works perfectly!
YouTube | Mods | Patreon | Minetest Discord @greenxenith
You should not be able to read this message.
You should not be able to read this message.
- stu
- Member
- Posts: 923
- Joined: Sat Feb 02, 2013 02:51
- GitHub: stujones11
- Location: United Kingdom
Re: SAM-Viewer
Nice to see you got it working, although I would be amazed if I had not left at least some bugs in there =)GreenDimond wrote:Ah, thankyou.stu wrote:To fix this you need to replace the path in the cmake option to where that library resides on your own system.did the trick.Code: Select all
cmake . -DIRRLICHT_LIBRARY="/usr/lib/x86_64-linux-gnu/libIrrlicht.so"
First look: Works perfectly!
I have now changed the example path to this as it's the same one that worked for Krock, *buntu based distros maybe? I am using vanilla debian so the defaults work for me. I might add auto detection at some point, though I'd like to understand it rather than just blindly copying MT's build scripts.
- Krock
- Developer
- Posts: 4650
- Joined: Thu Oct 03, 2013 07:48
- GitHub: SmallJoker
- Location: Switzerland
- Contact:
Re: SAM-Viewer
Until the next user with another distribution comes and reports the same issue. It would be helpful to have an auto-detection to ease the compiling process. However, I see that you prefer to first understand what the CMake lines do.stu wrote:I have now changed the example path to this as it's the same one that worked for Krock, *buntu based distros maybe?
Meanwhile I discovered the Sam steam engine. Why should I change the texture when it looks a bit weird but funny? ;)
- Attachments
-
- sam_steam_engine.png (32.3 KiB) Viewed 766 times
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>
- stu
- Member
- Posts: 923
- Joined: Sat Feb 02, 2013 02:51
- GitHub: stujones11
- Location: United Kingdom
Re: SAM-Viewer
LOL, kinda reminds me of poo-choo train =)Krock wrote:Meanwhile I discovered the Sam steam engine. Why should I change the texture when it looks a bit weird but funny? ;)
-
- Member
- Posts: 96
- Joined: Mon Mar 27, 2017 21:56
- GitHub: kestral246
Re: SAM-Viewer
Stu,
I was able to build your program samviewer on Fedora 27 with
-DIRRLICHT_LIBRARY="/usr/lib64/libIrrlicht.so"
On my local copy, I made the following minor changes to allow me to use your program to load model files from any directory:
1. Copied bin/samviewer to ~/bin/
2. Copied asset directory to ~/.local/share/samviewer/assets
3. Copied media/pickaxe* to ~/.local/share/samviewer/assets/
3. Edited src/viewer.cpp and recompiled
From this (starting line 41):
To this:
Your program looks very interesting.
I plan on using it to help me learn about how minetest character files and the player_api work.
[edited for clarification]
I was able to build your program samviewer on Fedora 27 with
-DIRRLICHT_LIBRARY="/usr/lib64/libIrrlicht.so"
On my local copy, I made the following minor changes to allow me to use your program to load model files from any directory:
1. Copied bin/samviewer to ~/bin/
2. Copied asset directory to ~/.local/share/samviewer/assets
3. Copied media/pickaxe* to ~/.local/share/samviewer/assets/
3. Edited src/viewer.cpp and recompiled
From this (starting line 41):
Code: Select all
- device->getFileSystem()->addFileArchive("../assets/");
- device->getFileSystem()->addFileArchive("../media/");
- device->getFileSystem()->changeWorkingDirectoryTo("../media/");
Code: Select all
+ device->getFileSystem()->addFileArchive("/home/myusername/.local/share/samviewer/assets/");
+// device->getFileSystem()->addFileArchive("../media/");
+// device->getFileSystem()->changeWorkingDirectoryTo("../media/");
I plan on using it to help me learn about how minetest character files and the player_api work.
[edited for clarification]
Last edited by kestral on Tue Jul 03, 2018 17:23, edited 1 time in total.
- ExeterDad
- Member
- Posts: 1717
- Joined: Sun Jun 01, 2014 20:00
- In-game: ExeterDad
- Location: New Hampshire U.S.A
Re: SAM-Viewer
This is win, win. We get a useful (and cool) tool, and you get to learn what few seem to understand. Thanks for your efforts :)
HOMETOWN -Our little server. Keep the HOMETOWN chatter @ http://hometownserver.com - Our server map: http://media.hometownserver.com
- stu
- Member
- Posts: 923
- Joined: Sat Feb 02, 2013 02:51
- GitHub: stujones11
- Location: United Kingdom
Re: SAM-Viewer
Thanks for the kind words, I certainly did learn a lot by making this, however one thing is for sure, I would never use Irrlcht's gui for anything more complex. If I was making this again, I would probably use QT for the gui with an embedded Irrlicht viewport.ExeterDad wrote:This is win, win. We get a useful (and cool) tool, and you get to learn what few seem to understand. Thanks for your efforts :)
@kestral, thanks for letting me know you got it working. I am not sure why the code change should be necessary. I will look into that. The Irrlicht file browser is rather 'basic' to put it nicely =)
- stu
- Member
- Posts: 923
- Joined: Sat Feb 02, 2013 02:51
- GitHub: stujones11
- Location: United Kingdom
Re: SAM-Viewer [0.5]
After finding this application very useful when re-mastering some old meshes where the .blend files were no longer available, I decided to give it bit of love. Version 0.5 now features simple lighting and static mesh export options, along with a number of bug-fixes and improvements like better file browsing.
Of course, this is nothing you can't do with Blender but then you could say the same for a lot of things :D
Note that the above is a Wavefront (.obj) mesh exported without scaling. To make it the correct size for Minetest you should set the export scale to 10%. Don't ask me why, that's just MT for ya!
Of course, this is nothing you can't do with Blender but then you could say the same for a lot of things :D
Note that the above is a Wavefront (.obj) mesh exported without scaling. To make it the correct size for Minetest you should set the export scale to 10%. Don't ask me why, that's just MT for ya!
Who is online
Users browsing this forum: No registered users and 6 guests