Cuberite Forum

Full Version: Schematic file visualiser
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4
I think I fixed it, there was a problem with out-of-source builds, and for some reason the build caught system-wide zlib instead of the one in the repo.
It would seem that this project is a good stress-test for gcc on a RasPi. The generated BlockColors.cpp file (147 KiB of constructors), https://github.com/madmaxoft/MCSchematic...Colors.cpp , has brought gcc to its knees. It's been compiling the file for 20 minutes now and it's (probably) still going...
An hour, and still compiling? Seriously???
Wow, the CPU power on that thing is pathetic. Tongue
[ 65%] Building CXX object CMakeFiles/SchematicToPng.dir/src/BlockColors.cpp.o
In file included from /usr/include/c++/4.8/mutex:35:0,
from /home/monowii/Downloads/MCSchematicToPng/src/Shared/OSSupport/CriticalSection.h:3,
from /home/monowii/Downloads/MCSchematicToPng/src/Globals.h:212,
from /home/monowii/Downloads/MCSchematicToPng/src/BlockColors.cpp:9:
/usr/include/c++/4.8/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
#error This file requires compiler and library support for the \
^
In file included from /home/monowii/Downloads/MCSchematicToPng/src/Globals.h:212:0,
from /home/monowii/Downloads/MCSchematicToPng/src/BlockColors.cpp:9:
/home/monowii/Downloads/MCSchematicToPng/src/Shared/OSSupport/CriticalSection.h:34:2: error: ‘recursive_mutex’ in namespace ‘std’ does not name a type
std::recursive_mutex m_Mutex;
^
In file included from /home/monowii/Downloads/MCSchematicToPng/src/Globals.h:213:0,
from /home/monowii/Downloads/MCSchematicToPng/src/BlockColors.cpp:9:
/home/monowii/Downloads/MCSchematicToPng/src/Shared/OSSupport/Event.h:43:2: error: ‘mutex’ in namespace ‘std’ does not name a type
std::mutex m_Mutex;
^
/home/monowii/Downloads/MCSchematicToPng/src/Shared/OSSupport/Event.h:46:2: error: ‘condition_variable’ in namespace ‘std’ does not name a type
std::condition_variable m_CondVar;
^
In file included from /home/monowii/Downloads/MCSchematicToPng/src/Globals.h:214:0,
from /home/monowii/Downloads/MCSchematicToPng/src/BlockColors.cpp:9:
/home/monowii/Downloads/MCSchematicToPng/src/Shared/OSSupport/IsThread.h:57:2: error: ‘thread’ in namespace ‘std’ does not name a type
std::thread m_Thread;
^
/home/monowii/Downloads/MCSchematicToPng/src/Shared/OSSupport/IsThread.h: In member function ‘bool cIsThread::IsCurrentThread() const’:
/home/monowii/Downloads/MCSchematicToPng/src/Shared/OSSupport/IsThread.h:53:49: error: ‘std::this_thread’ has not been declared
bool IsCurrentThread(void) const { return std::this_thread::get_id() == m_Thread.get_id(); }
^
/home/monowii/Downloads/MCSchematicToPng/src/Shared/OSSupport/IsThread.h:53:74: error: ‘m_Thread’ was not declared in this scope
bool IsCurrentThread(void) const { return std::this_thread::get_id() == m_Thread.get_id(); }
^
make[2]: *** [CMakeFiles/SchematicToPng.dir/src/BlockColors.cpp.o] Error 1
make[1]: *** [CMakeFiles/SchematicToPng.dir/all] Error 2
make: *** [all] Error 2
Please update your sources, I've fixed that error. Sorry for that, I originally fixed it only for Release and Debug builds, not for the default ones.
Yay thanks!
Can you post an example command with some arguments ?
The program uses listfiles - instead of specifying the files to be converted and the conversion params on the commandline, you write them into a text file and give that file to the convertor.
Code:
MCSchematicToPng -threads 8 listfile.txt
converts files listed in listfile.txt using 8 threads

Code:
MCSchematicToPng --
reads stdin as the listfile and converts using 4 threads (default)

Listfile is a simple text file that lists the .schematic files to be converted, and the properties for each export. If a line starts with non-whitespace, it is considered a filename to convert. If a line starts with a whitespace (tab, space etc) it is considered a property for the last file. Properties can specify different output filename, cropping, size of the isometric tile and (future) rotation.
Example:
Code:
file1.schematic
  outfile: large file1.png
  horzsize: 16
  vertsize: 20

file1.schematic
  outfile: medium file1.png
  horzsize: 8
  vertsize: 10

file1.schematic
  outfile: small file1.png

file2.schematic

file3.schematic
  outfile: slice1.png
  startx: 0
  endx: 0

file3.schematic
  outfile: slice2.png
  startx: 1
  endx: 1

file3.schematic
  outfile: slice3.png
  startx: 2
  endx: 2
This converts file1.schematic into three PNG files according to the properties specified, file2.schematic into a PNG file with the default properties, and three slices of file3.schematic into three separate PNG files.

---
I've added this to the usage section of the README file, hopefully it's understandable enough.
To reduce compile time, wouldn't it be faster to instead of compiling a cpp file let it read/parse a file with the colors on startup? Or would that then reduce the performance of the program?
Nice render. Thank you for this !
(Don't forget to add the pthread flag for GNU compiler (set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -pthread")))
Pages: 1 2 3 4