[orx-obj-loader] Add demo descriptions
This commit is contained in:
@@ -5,6 +5,11 @@ import org.openrndr.extra.objloader.toObj
|
|||||||
import org.openrndr.math.Vector2
|
import org.openrndr.math.Vector2
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This program loads an OBJ mesh as a CompoundMeshData and demonstrates
|
||||||
|
* how to convert it to a OBJ String representation, then
|
||||||
|
* draws the beginning of this String on the program window.
|
||||||
|
*/
|
||||||
fun main() = application {
|
fun main() = application {
|
||||||
configure {
|
configure {
|
||||||
width = 720
|
width = 720
|
||||||
|
|||||||
@@ -6,6 +6,12 @@ import org.openrndr.draw.shadeStyle
|
|||||||
import org.openrndr.extra.objloader.loadOBJasVertexBuffer
|
import org.openrndr.extra.objloader.loadOBJasVertexBuffer
|
||||||
import org.openrndr.math.Vector3
|
import org.openrndr.math.Vector3
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Demonstrates how to load a `.obj` file as a `VertexBuffer`.
|
||||||
|
*
|
||||||
|
* The `loadOBJasVertexBuffer()` function expects the path to the `.obj` file as an argument.
|
||||||
|
*
|
||||||
|
*/
|
||||||
fun main() = application {
|
fun main() = application {
|
||||||
configure {
|
configure {
|
||||||
width = 720
|
width = 720
|
||||||
|
|||||||
@@ -3,6 +3,12 @@ import org.openrndr.draw.loadFont
|
|||||||
import org.openrndr.extra.objloader.loadOBJasVertexBuffer
|
import org.openrndr.extra.objloader.loadOBJasVertexBuffer
|
||||||
import org.openrndr.extra.objloader.saveOBJ
|
import org.openrndr.extra.objloader.saveOBJ
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Demonstrates how to save a `VertexBuffer` as an `.obj` file using the
|
||||||
|
* `VertexBuffer.saveOBJ()` method.
|
||||||
|
*
|
||||||
|
* The program loads an existing OBJ file, then saves it with a new file name.
|
||||||
|
*/
|
||||||
fun main() = application {
|
fun main() = application {
|
||||||
configure {
|
configure {
|
||||||
width = 720
|
width = 720
|
||||||
|
|||||||
@@ -4,6 +4,12 @@ import org.openrndr.extra.meshgenerators.buildTriangleMesh
|
|||||||
import org.openrndr.extra.meshgenerators.sphere
|
import org.openrndr.extra.meshgenerators.sphere
|
||||||
import org.openrndr.extra.objloader.saveOBJ
|
import org.openrndr.extra.objloader.saveOBJ
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Demonstrates saving a `VertexBuffer` generated via code as an OBJ file.
|
||||||
|
*
|
||||||
|
* This file can be loaded in a 3D modelling / rendering program.
|
||||||
|
*
|
||||||
|
*/
|
||||||
fun main() = application {
|
fun main() = application {
|
||||||
configure {
|
configure {
|
||||||
width = 720
|
width = 720
|
||||||
|
|||||||
@@ -1,6 +1,3 @@
|
|||||||
/**
|
|
||||||
Display wireframe and non-planar faces
|
|
||||||
*/
|
|
||||||
import org.openrndr.WindowMultisample
|
import org.openrndr.WindowMultisample
|
||||||
import org.openrndr.application
|
import org.openrndr.application
|
||||||
import org.openrndr.color.ColorRGBa
|
import org.openrndr.color.ColorRGBa
|
||||||
@@ -16,6 +13,20 @@ import org.openrndr.shape.Path3D
|
|||||||
import java.io.File
|
import java.io.File
|
||||||
import kotlin.math.cos
|
import kotlin.math.cos
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Demonstrates two approaches for loading an OBJ file: as a `VertexBuffer` and as `CompoundMeshData`.
|
||||||
|
*
|
||||||
|
* A `CompoundMeshData` object contains vertices, texture coordinates, colors, normals, tangents, and bitangents,
|
||||||
|
* alongside their associated face indices, grouped into meshes.
|
||||||
|
*
|
||||||
|
* In this demo `CompoundMeshData.wireframe()` is called to generate a wireframe representation of the loaded mesh.
|
||||||
|
*
|
||||||
|
* When rendering the wireframe, a shade style is used to displace the lines slightly towards the camera, to ensure
|
||||||
|
* the lines do not end up occluded by the mesh rendered as triangles.
|
||||||
|
*
|
||||||
|
* Finally, the `sub` method is called on the `Path3D` instances to draw only parts of the wireframe, creating
|
||||||
|
* an animated effect.
|
||||||
|
*/
|
||||||
fun main() = application {
|
fun main() = application {
|
||||||
configure {
|
configure {
|
||||||
width = 720
|
width = 720
|
||||||
|
|||||||
Reference in New Issue
Block a user