SAM-Viewer

User avatar
stu
Member
 
Posts: 891
Joined: Sat Feb 02, 2013 02:51
Location: United Kingdom
GitHub: stujones11

SAM-Viewer

by stu » Thu May 24, 2018 21:49

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:

Image
 

User avatar
GreenDimond
Member
 
Posts: 1089
Joined: Wed Oct 28, 2015 01:26
Location: Yes.
GitHub: GreenXenith
IRC: GreenDimond
In-game: GreenDimond

Re: SAM-Viewer

by GreenDimond » Thu May 24, 2018 21:57

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
My YuTube channel | I moderate the HOMETOWN Server. | Click here to see my (6) mods! ~Using gradient signatures since 2017. ✂️- - - - -
 

User avatar
stu
Member
 
Posts: 891
Joined: Sat Feb 02, 2013 02:51
Location: United Kingdom
GitHub: stujones11

Re: SAM-Viewer

by stu » Thu May 24, 2018 22:13

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

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?
 

User avatar
GreenDimond
Member
 
Posts: 1089
Joined: Wed Oct 28, 2015 01:26
Location: Yes.
GitHub: GreenXenith
IRC: GreenDimond
In-game: GreenDimond

Re: SAM-Viewer

by GreenDimond » Thu May 24, 2018 22:23

stu wrote:Do you see any other specific error messages in the build log?

Yes.
Code: Select all
make[2]: *** No rule to make target '/usr/local/lib/libIrrlicht.so', needed by 'bin/samviewer'.  Stop.
My YuTube channel | I moderate the HOMETOWN Server. | Click here to see my (6) mods! ~Using gradient signatures since 2017. ✂️- - - - -
 

User avatar
Krock
Developer
 
Posts: 3924
Joined: Thu Oct 03, 2013 07:48
Location: Switzerland
GitHub: SmallJoker

Re: SAM-Viewer

by Krock » Thu May 24, 2018 22:24

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 :)
Mod Search Engine - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>
 

User avatar
stu
Member
 
Posts: 891
Joined: Sat Feb 02, 2013 02:51
Location: United Kingdom
GitHub: stujones11

Re: SAM-Viewer

by stu » Thu May 24, 2018 22:48

GreenDimond wrote:
Code: Select all
make[2]: *** No rule to make target '/usr/local/lib/libIrrlicht.so', needed by 'bin/samviewer'.  Stop.

Did you try the suggested:
Code: Select all
cmake . -DIRRLICHT_LIBRARY="/usr/lib/libIrrlicht.so"`

Krock wrote:Compiling works after adjusting this but it's already late so I'll review it later on :)

Thank you so much for showing an interest, I will very much look forward to that :)
 

User avatar
GreenDimond
Member
 
Posts: 1089
Joined: Wed Oct 28, 2015 01:26
Location: Yes.
GitHub: GreenXenith
IRC: GreenDimond
In-game: GreenDimond

Re: SAM-Viewer

by GreenDimond » Thu May 24, 2018 22:51

stu wrote:
GreenDimond wrote:
Code: Select all
make[2]: *** No rule to make target '/usr/local/lib/libIrrlicht.so', needed by 'bin/samviewer'.  Stop.

Did you try the suggested:
Code: Select all
cmake . -DIRRLICHT_LIBRARY="/usr/lib/libIrrlicht.so"`


I still get:
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
My YuTube channel | I moderate the HOMETOWN Server. | Click here to see my (6) mods! ~Using gradient signatures since 2017. ✂️- - - - -
 

User avatar
stu
Member
 
Posts: 891
Joined: Sat Feb 02, 2013 02:51
Location: United Kingdom
GitHub: stujones11

Re: SAM-Viewer

by stu » Thu May 24, 2018 23:45

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.
 

User avatar
GreenDimond
Member
 
Posts: 1089
Joined: Wed Oct 28, 2015 01:26
Location: Yes.
GitHub: GreenXenith
IRC: GreenDimond
In-game: GreenDimond

Re: SAM-Viewer

by GreenDimond » Fri May 25, 2018 00:15

stu wrote:To fix this you need to replace the path in the cmake option to where that library resides on your own system.

Ah, thankyou.
Code: Select all
cmake . -DIRRLICHT_LIBRARY="/usr/lib/x86_64-linux-gnu/libIrrlicht.so"

did the trick.

First look: Works perfectly!
Image
My YuTube channel | I moderate the HOMETOWN Server. | Click here to see my (6) mods! ~Using gradient signatures since 2017. ✂️- - - - -
 

User avatar
stu
Member
 
Posts: 891
Joined: Sat Feb 02, 2013 02:51
Location: United Kingdom
GitHub: stujones11

Re: SAM-Viewer

by stu » Fri May 25, 2018 14:30

GreenDimond wrote:
stu wrote:To fix this you need to replace the path in the cmake option to where that library resides on your own system.

Ah, thankyou.
Code: Select all
cmake . -DIRRLICHT_LIBRARY="/usr/lib/x86_64-linux-gnu/libIrrlicht.so"

did the trick.

First look: Works perfectly!

Nice to see you got it working, although I would be amazed if I had not left at least some bugs in there =)

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.
 

User avatar
Krock
Developer
 
Posts: 3924
Joined: Thu Oct 03, 2013 07:48
Location: Switzerland
GitHub: SmallJoker

Re: SAM-Viewer

by Krock » Fri May 25, 2018 14:52

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?

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.
Meanwhile I discovered the Sam steam engine. Why should I change the texture when it looks a bit weird but funny? ;)

Image
Attachments
sam_steam_engine.png
(32.3 KiB) Not downloaded yet
Mod Search Engine - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>
 

User avatar
stu
Member
 
Posts: 891
Joined: Sat Feb 02, 2013 02:51
Location: United Kingdom
GitHub: stujones11

Re: SAM-Viewer

by stu » Fri May 25, 2018 15:21

Krock wrote:Meanwhile I discovered the Sam steam engine. Why should I change the texture when it looks a bit weird but funny? ;)

LOL, kinda reminds me of poo-choo train =)
 


Return to Minetest-related projects



Who is online

Users browsing this forum: No registered users and 1 guest