Skip to content

Latest commit

 

History

History
80 lines (61 loc) · 3.14 KB

README.md

File metadata and controls

80 lines (61 loc) · 3.14 KB

Cities-Generator

Cities generator based on Yocto/GL Library. It generates random cities using context-free grammars. This project is repository version of my yocto-gl Fork.

The repository provides the user with a specialized grammar for a block-construction. The grammar features:

  • Methods for objects positioning in scene.
  • Methods for rotation.
  • Methods for scaling.
  • Methods for avoiding collisions of objects.

The variables of grammar are called nodes, inside nodes there are the shapes of the object bound to the node. The nodes can be empty and, in this case, they become support variables for the grammar. The nodes will be added to graph struct that represents the grammar. Rules of grammar are of this type A := B | C | D this meaning that the node A can be replaced with the node B or node C or D, The variable selection is random in the algorithm. it is possible to do a substitution with more variables B := C and D | C and B this means that B can be replaced with C and D, or with C and B. The grammar costruction is based on three principal methods:

  • loadNode: it takes a path of .obj in input and returns a node.
  • add_multi_nodes_or: it takes a node A and a set of nodes Bn (with relative costants)and creates the following rule A := .. | B | B1 | ... | Bn. If a rule for A exists, it merges the old rule with the new.
  • add_multi_nodes_and: it takes a node A and a set of nodes Bn and creates the following rule A := .. | B1 and B2 and ... Bn

Images

This Images have been rendered with Yocto/GL PathTracer /bin/builder -d 150 Image /bin/builder -d 100 Image Image Image Image Image Image You can found other images in Images folder

Getting Started

git clone --recursive https://github.com/antoniomuso/cities-generator.git

How to build.

mkdir build; cd build; cmake ..; cmake --build .

To run application

cd ..
./bin/builder

You can use option -d to change cities dimension, default 50, and -o to change output filename.

./bin/builder -d 100 -o myFile.obj

Prerequisites

To Build you need of OpenGL, Glew and Glfw

Installing

You can install dependencis on Ubuntu with the following commands:

sudo apt-get update
sudo apt-get install freeglut3-dev
sudo apt-get install libglew-dev
sudo apt-get install libglfw3-dev

You need last gcc version, you can install it here

Authors

License

This project is licensed under the MIT License - see the LICENSE file for details