Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/iamgio/vofxel

:zap: Voxel model loader and editor for JavaFX
https://github.com/iamgio/vofxel

3d java javafx library voxel

Last synced: 3 days ago
JSON representation

:zap: Voxel model loader and editor for JavaFX

Awesome Lists containing this project

README

        

# Vo(fx)el
**Vofxel** is a Java library for loading, displaying and editing PLY files exported from [MagicaVoxel](https://ephtracy.github.io/) into JavaFX, blazingly fast.

## Installation

### Maven
```xml


jitpack.io
https://jitpack.io

com.github.iAmGio
vofxel
v0.0.2

```

### Gradle
```gradle
allprojects {
repositories {
maven { url 'https://jitpack.io' }
}
}
dependencies {
implementation 'com.github.iAmGio:vofxel:v0.0.2'
}
```

## Getting started
Load model from file:
```java
VoxelModel model = new VoxelModel();
root.getChildren().add(model);
model.load(getClass().getResourceAsStream("/file.ply"));
```

> Note that the file must be exported using the _cube_ mode from MagicaVoxel (or any other tool that supports this export mode):
![Export](https://i.imgur.com/6jpqJFO.png)

Create model from scratch:
```java
VoxelModel model = new VoxelModel();
root.getChildren().add(model);
Cube cube1 = model.addCube();
cube1.setMaterial(new PhongMaterial(Color.RED));
cube1.moveZ(-10);
Cube cube2 = model.addCube();
cube2.setMaterial(new PhongMaterial(Color.BLUE));
cube2.moveX(-10);
```

## Demo
A simple demonstration can be found [here](https://github.com/iAmGio/vofxel/blob/master/src/test/java/eu/iamgio/vofxel/AppTest.java).

![Result](https://i.imgur.com/n6UJCJe.png)