Skip to content

Commit

Permalink
Updated README files
Browse files Browse the repository at this point in the history
  • Loading branch information
javagl committed Sep 24, 2017
1 parent 19bdc43 commit cf7d221
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 95 deletions.
48 changes: 37 additions & 11 deletions README.md
Expand Up @@ -6,33 +6,59 @@

The following image gives an overview of glTF:

![gltfOverview-0.2.0.png](/images/gltfOverview-0.2.0.png)
![gltfOverview-2.0.0-small.png](/images/gltfOverview-2.0.0-small.png)

A larger version of this image, as well as PDF versions, can be found on the [glTF overview releases page](https://github.com/javagl/gltfOverview/releases).

---

## A note about glTF 2.0 support:

The libraries that are available here mostly support glTF 1.0 and glTF 2.0.
Some special features that have been introduced in glTF 2.0 are not fully
supported yet. This mainly refers to rendering glTF 2.0 assets in the
`jgltf-viewer`, particularly the support of PBR (physically based rendering)
and certain animation interpolation types. Support for these features will
be implemented soon.

---


The libraries currently available here are

* [jgltf-impl](https://github.com/javagl/JglTF/tree/master/jgltf-impl) :
A very simple set of classes that represent glTF data, auto-generated
from the glTF JSON schema
* [jgltf-impl-v1](https://github.com/javagl/JglTF/tree/master/jgltf-impl-v1) and
[jgltf-impl-v2](https://github.com/javagl/JglTF/tree/master/jgltf-impl-v2) :
A very simple set of classes that represent glTF 1.0 and 2.0 data,
auto-generated from the glTF JSON schema

* [jgltf-model](https://github.com/javagl/JglTF/tree/master/jgltf-model) :
A library built on top of `jgltf-impl` that offers functionality for
reading glTF data and accessing the associated data in a form that is more
convenient for the use in Java
A library built on top of `jgltf-impl-v1` and `jgltf-impl-v2` that offers
functionality for reading glTF data and accessing the associated data
in a form that is more convenient for the use in Java. It serves as a
thin abstraction layer around the auto-generated classes.

* [jgltf-obj](https://github.com/javagl/JglTF/tree/master/jgltf-obj) :
A library/application for loading OBJ files and converting them into
glTF assets.
glTF 1.0 or 2.0 assets.

* [jgltf-browser](https://github.com/javagl/JglTF/tree/master/jgltf-browser) :
A simple standalone application that combines functionalities
of the JglTF libraries: It allows loading glTF from files or URLs
via drag-and-drop, offers a basic functionality for browsing through the
glTF structure, showing the images, shader code and accessor data
of the JglTF libraries: It allows loading glTF 1.0 or 2.0 from files or
URLs via drag-and-drop, offers a basic functionality for browsing through
the glTF structure, showing the images, shader code and accessor data
in a structured form, importing OBJ files as glTF, and saving glTF as
standard, embedded or binary glTF files.

* [jgltf-viewer](https://github.com/javagl/JglTF/tree/master/jgltf-viewer) :
A base library for glTF viewers
* [jgltf-viewer-jogl](https://github.com/javagl/JglTF/tree/master/jgltf-viewer-jogl) :
A glTF viewer based on JOGL
* [jgltf-viewer-lwjgl](https://github.com/javagl/JglTF/tree/master/jgltf-viewer-lwjgl) :
A glTF viewer based on LWJGL 2

* [jgltf-impl-v2-technique-webgl](https://github.com/javagl/JglTF/tree/master/jgltf-impl-v2-technique-webgl) :
Auto-generated classes for the glTF 2.0 `KHR_technique_webgl` extension

* [jgltf-validator](https://github.com/javagl/JglTF/tree/master/jgltf-validator) :
A simple glTF validator, only intended for internal use

Expand Down
51 changes: 2 additions & 49 deletions jgltf-impl-v1/README.md
Expand Up @@ -4,54 +4,7 @@ An implementation of [glTF](https://github.com/KhronosGroup/glTF/),
the GL Transmission Format.

**Note:** These classes are automatically generated from the
[glTF JSON schema](https://github.com/KhronosGroup/glTF/tree/master/specification/schema),
using [JsonModelGen](https://github.com/javagl/JsonModelGen). Details of the
implementation of these classes may change in future versions.
glTF JSON schema of the [glTF specification](https://github.com/KhronosGroup/glTF/tree/master/specification/).

## Current generator configuration
See [jgltf-impl-v2](https://github.com/javagl/JglTF/tree/master/jgltf-impl-v2) for more information.

`JsonModelGen` was mainly created in order to generate this particular
glTF model implementation. It does not yet offer any configuration
settings. The current (fixed) configuration generates a simple model
for glTF, with the following properties:

* JSON arrays that contain numbers, integers or booleans are represented
as Java arrays (`float[]`, `int[]` and `boolean[]`, respectively)
* JSON arrays with objects are represented with `List<Type>`
* Single number- integer- or boolean-properties are represented with
the reference types `Float`, `Integer` and `Boolean`. They are *not*
represented with primitive types (`float`, `int` or `boolean`) in
order to be able to assign `null` to the properties that are not
explicitly *required* according to the specification.

The setter methods perform a basic validation of the parameters.
For example, if a certain property is constrained to be greater
than 0.0 in the JSON schema, then trying to set a value that is not
greater than 0.0 will cause an `IllegalArgumentException` to be
thrown. Similarly, a `NullPointerException` will be thrown when
trying to set a property to `null` that was explicitly marked
as *required* in the specification.

To simplify usage, the fields and setter- and getter methods contain basic
JavaDoc documentation that was extracted from the JSON schema, including
information about the valid values for the properties.

# Usage

This library has **no dependencies** and is very simplistic. It does not
offer any convenience functionality - not even for *reading* a glTF file.
Reading the JSON part of a glTF file may be done with
[jackson-databind](https://github.com/FasterXML/jackson-databind)
as follows:

`GlTF gltf = new ObjectMapper().readValue(inputStream, GlTF.class);`

(that's it).

A more generic solution for reading glTF data, including improved
error handling and the option to conveniently obtain the associated
(binary) data of glTF is offered by the
[jgltf-model](https://github.com/javagl/JglTF/tree/master/jgltf-model) library.



2 changes: 1 addition & 1 deletion jgltf-impl-v2/README.md
Expand Up @@ -4,7 +4,7 @@ An implementation of [glTF](https://github.com/KhronosGroup/glTF/),
the GL Transmission Format.

**Note:** These classes are automatically generated from the
[glTF JSON schema](https://github.com/KhronosGroup/glTF/tree/master/specification/schema),
glTF JSON schema of the [glTF specification](https://github.com/KhronosGroup/glTF/tree/master/specification/)
using [JsonModelGen](https://github.com/javagl/JsonModelGen). Details of the
implementation of these classes may change in future versions.

Expand Down
34 changes: 10 additions & 24 deletions jgltf-model/README.md
Expand Up @@ -6,28 +6,14 @@ Transmission Format, in Java
**Note:** This library is still subject to change.

This library extends the basic auto-generated
[jgltf-impl](https://github.com/javagl/JglTF/tree/master/jgltf-impl) library
[jgltf-impl-v1](https://github.com/javagl/JglTF/tree/master/jgltf-impl-v1) and
[jgltf-impl-v2](https://github.com/javagl/JglTF/tree/master/jgltf-impl-v2) libraries
by classes that offer the entities and data that appear in a
glTF in a form that is more convenient for the use in Java. For example,
the raw data buffers of glTF are offered as `ByteBuffer` instances, and
images are offered as `BufferedImage` instances.

The library also offers convenience classes for loading this data that is
associated with glTF. This refers to glTF that contain embedded data in
data URIs, as well as glTF that are stored as binary data with the
`KHR_binary_glTF` extension.

There are different implementations of classes for accessing the data
that is provided by a glTF accessor, in a typed form, for example, using
an `AccessorFloatData`.

The `GltfModel` class offers additional functionality for accessing the
data elements that are defined in a glTF, like the matrices that are
implicitly defined by certain semantics.

Finally, there is an `animation` package that contains utility classes
for animations (which are not necessarily related to glTF, but
coincidentally offer much of the functionality that is required
for the animations in glTF).


glTF in a form that is more convenient for the use in Java.

The classes serve as a thin abstraction layer around the underlying implementation.
The `GltfModel` class offers the functionality for accessing the data elements
that are defined in a glTF. The library also offers convenience classes for reading
glTF models from files or input streams, or writing them to output files.
This refers to standard glTF assets, and assets that contain embedded data in
data URIs, as well as binary glTF assets.
21 changes: 11 additions & 10 deletions jgltf-viewer/README.md
Expand Up @@ -14,13 +14,14 @@ from the [Khronos glTF samples repository](https://github.com/KhronosGroup/glTF-
and displays it in a frame:

```Java
import java.awt.Component;
import java.net.URI;

import javax.swing.JFrame;
import javax.swing.SwingUtilities;

import de.javagl.jgltf.model.GltfData;
import de.javagl.jgltf.model.io.GltfDataReader;
import de.javagl.jgltf.model.GltfModel;
import de.javagl.jgltf.model.io.GltfModelReader;
import de.javagl.jgltf.viewer.GltfViewer;
import de.javagl.jgltf.viewer.jogl.GltfViewerJogl;
import de.javagl.jgltf.viewer.lwjgl.GltfViewerLwjgl;
Expand All @@ -31,22 +32,22 @@ public class GltfViewerMiniDemo
{
String uriString =
"https://raw.githubusercontent.com/KhronosGroup/" +
"glTF-Sample-Models/master/1.0/Duck/glTF/Duck.gltf";
GltfDataReader r = new GltfDataReader();
GltfData gltfData = r.readGltfData(new URI(uriString));
SwingUtilities.invokeLater(() -> createAndShowGui(gltfData));
"glTF-Sample-Models/master/2.0/Duck/glTF/Duck.gltf";
GltfModelReader r = new GltfModelReader();
GltfModel gltfModel = r.read(new URI(uriString));
SwingUtilities.invokeLater(() -> createAndShowGui(gltfModel));
}

private static void createAndShowGui(GltfData gltfData)
private static void createAndShowGui(GltfModel gltfModel)
{
JFrame f = new JFrame();
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

// Create a viewer based on JOGL or LWJGL:
GltfViewer gltfViewer = new GltfViewerJogl();
//GltfViewer gltfViewer = new GltfViewerLwjgl();
GltfViewer<Component> gltfViewer = new GltfViewerJogl();
//GltfViewer<Component> gltfViewer = new GltfViewerLwjgl();

gltfViewer.addGltfData(gltfData);
gltfViewer.addGltfModel(gltfModel);
f.getContentPane().add(gltfViewer.getRenderComponent());
f.setSize(500,500);
f.setLocationRelativeTo(null);
Expand Down

0 comments on commit cf7d221

Please sign in to comment.