This is a very simple writer for the Wavefront .obj file format describing 3D models.
The project homepage is at https://github.com/mmitch/wavefront-simple
This code
// generate a cube at (0, 0, 0) with edge length 1
Cube cube = new Cube(Coordinate.ORIGIN, 1);
// write object to file
cube.writeTo(new FileOutputStream("/tmp/cube.obj"));
creates an .obj
file that looks like this:
V 0 0 0
V 0 0 1
V 0 1 0
V 0 1 1
V 1 0 0
V 1 0 1
V 1 1 0
V 1 1 1
f 1 3 4 2
f 1 3 7 5
f 1 5 6 2
f 2 4 8 6
f 3 7 8 4
f 5 7 8 6
This is a library, no standalone program (although test executables
are available in the de.cgarbs.wavefront.test.app
package).
To include wavefront-simple
in your project, add this to your
build.gradle
:
repositories {
repositories {
maven {
name "cgarbs.de repo"
url "https://www.cgarbs.de/maven2"
}
}
}
dependencies {
compile 'de.cgarbs:wavefront-simple:0.6.0'
}
Note: You should propably update the version number (0.6.0
in the
example above) to the most current version (see the HISTORY.md
file).
The same coordinates should work for Maven projects, too.
Just run gradle
, the project will configure, compile and then run the checks.
- Java 8
- Gradle
- further dependencies are fetched automatically, see
build.gradle
- centralize tests from Container subclasses into ContainerTest
- add rotation operation(?)
- add colors/textures(?)
wavefront-simple - generate simple 3D models in Wavefront .obj file format
Copyright (C) 2016 Christian Garbs <mitch@cgarbs.de>
Licensed under GNU GPL v3 (or later)
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.