README / Docs

This commit is contained in:
Thomas FORGIONE 2016-12-02 16:01:42 +01:00
parent e762759216
commit 87652194cd
No known key found for this signature in database
GPG Key ID: 2A210FFC062E00C3
2 changed files with 30 additions and 4 deletions

View File

@ -1,17 +1,22 @@
# model-converter # model-converter
This project aims to be a simple, lightweight, and useful 3D model editor. This project aims to be a simple, lightweight, and useful 3D model editor.
For the moment, only `obj` and `ply` ascii models are supported. For the moment, only `obj`, `ply` ascii models are supported.
Feel free to open an issue if you find anything wrong in this. Feel free to open an issue if you find anything wrong in this.
- [Scripts](#scripts)
- [Install](#install)
- [Contributing](#contributing)
- [List of all supported formats](#formats)
# Scripts # Scripts
A few utilities to manage 3D models : A few utilities to manage 3D models :
- `convert.py` that converts any type of model to any other - `convert.py` that converts any type of model to any other
- `viewer.py` which is a simple script that renders a 3d model - `viewer.py` which is a simple script that renders a 3d model
# Dependencies # Install
This project is written in python 3. The `convert.py` script is made for This project is written in python 3. The `convert.py` script is made for
needing nothing else than python. However, the `viewer.py` script has a few needing nothing else than python. However, the `viewer.py` script has a few
@ -23,7 +28,27 @@ dependencies, you'll need :
- pygame `sudo pip install pygame` - pygame `sudo pip install pygame`
- PyOpenGL `sudo pip install pyopengl` - PyOpenGL `sudo pip install pyopengl`
## Supported formats ## Contributing
If you want to add a new format to this converter, it should be easy enough,
you just have to create a python file in `d3/model/formats` that should :
- be named after the format you want to add (e.g. `obj.py`)
- contain a function that tests if a filename is in the specified format (e.g. `is_obj`)
- contain a parser class (e.g. `OBJParser`)
- contain an exporter class (e.g. `OBJExporter`)
### About the parser
The parser should inherit the `ModelParser` class in the `basemodel.py` module.
The `ModelParser` class has everything needed to create a 3D model and render it.
### About the exporter
The exporter should inherit the `Exporter` class in the `basemodel.py` module.
It should have a constructor that takes a `ModelParser` has parameter and a
`__str__` method that should compute the export.
## Formats
Here is the list of all the supported formats
- Wavefront `.obj` - Wavefront `.obj`
- Stanford `.ply` - Stanford `.ply`
- STL files `.stl` - STL files `.stl`

View File

@ -93,7 +93,8 @@ class ModelParser:
def add_vertex(self, vertex): def add_vertex(self, vertex):
"""Adds a vertex to the current model """Adds a vertex to the current model
Will also update its bounding box Will also update its bounding box, and convert the up vector if
up_conversion was specified.
""" """
# Apply up_conversion to the vertex # Apply up_conversion to the vertex
new_vertex = vertex new_vertex = vertex