[orx-dnk3] Fix demos
This commit is contained in:
@@ -13,7 +13,9 @@ dependencies {
|
|||||||
implementation(libs.openrndr.math)
|
implementation(libs.openrndr.math)
|
||||||
implementation(libs.kotlin.coroutines)
|
implementation(libs.kotlin.coroutines)
|
||||||
demoImplementation(project(":orx-mesh-generators"))
|
demoImplementation(project(":orx-mesh-generators"))
|
||||||
|
demoImplementation(project(":orx-camera"))
|
||||||
demoImplementation(project(":orx-noise"))
|
demoImplementation(project(":orx-noise"))
|
||||||
|
demoImplementation(project(":orx-shader-phrases"))
|
||||||
demoImplementation(libs.openrndr.ffmpeg)
|
demoImplementation(libs.openrndr.ffmpeg)
|
||||||
demoImplementation(libs.openrndr.filter)
|
demoImplementation(libs.openrndr.filter)
|
||||||
}
|
}
|
||||||
@@ -19,12 +19,6 @@ fun main() = application {
|
|||||||
}
|
}
|
||||||
|
|
||||||
program {
|
program {
|
||||||
if (System.getProperty("takeScreenshot") == "true") {
|
|
||||||
extend(SingleScreenshot()) {
|
|
||||||
this.outputFile = System.getProperty("screenshotPath")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
val gltf = loadGltfFromFile(File("demo-data/gltf-models/box-animated/BoxAnimated.glb"))
|
val gltf = loadGltfFromFile(File("demo-data/gltf-models/box-animated/BoxAnimated.glb"))
|
||||||
val scene = Scene(SceneNode())
|
val scene = Scene(SceneNode())
|
||||||
|
|
||||||
|
|||||||
@@ -12,16 +12,9 @@ fun main() = application {
|
|||||||
configure {
|
configure {
|
||||||
width = 1280
|
width = 1280
|
||||||
height = 720
|
height = 720
|
||||||
//multisample = WindowMultisample.SampleCount(8)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
program {
|
program {
|
||||||
if (System.getProperty("takeScreenshot") == "true") {
|
|
||||||
extend(SingleScreenshot()) {
|
|
||||||
this.outputFile = System.getProperty("screenshotPath")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
val gltf = loadGltfFromFile(File("demo-data/gltf-models/camera/Scene.glb"))
|
val gltf = loadGltfFromFile(File("demo-data/gltf-models/camera/Scene.glb"))
|
||||||
val scene = Scene(SceneNode())
|
val scene = Scene(SceneNode())
|
||||||
|
|
||||||
|
|||||||
@@ -17,11 +17,6 @@ fun main() = application {
|
|||||||
}
|
}
|
||||||
|
|
||||||
program {
|
program {
|
||||||
if (System.getProperty("takeScreenshot") == "true") {
|
|
||||||
extend(SingleScreenshot()) {
|
|
||||||
this.outputFile = System.getProperty("screenshotPath")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
extend(Orbital()) {
|
extend(Orbital()) {
|
||||||
eye = Vector3(4.0, 4.0, 4.0)
|
eye = Vector3(4.0, 4.0, 4.0)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,87 +1,82 @@
|
|||||||
import org.openrndr.application
|
//import org.openrndr.application
|
||||||
import org.openrndr.color.ColorRGBa
|
//import org.openrndr.color.ColorRGBa
|
||||||
import org.openrndr.extensions.SingleScreenshot
|
//import org.openrndr.extensions.SingleScreenshot
|
||||||
import org.openrndr.extra.dnk3.dsl.*
|
//import org.openrndr.extra.dnk3.dsl.*
|
||||||
import org.openrndr.extra.dnk3.renderers.dryRenderer
|
//import org.openrndr.extra.dnk3.renderers.dryRenderer
|
||||||
import org.openrndr.extra.dnk3.tools.addSkybox
|
//import org.openrndr.extra.dnk3.tools.addSkybox
|
||||||
import org.openrndr.extra.noise.simplex
|
//import org.openrndr.extra.noise.simplex
|
||||||
import org.openrndr.extra.camera.Orbital
|
//import org.openrndr.extra.camera.Orbital
|
||||||
import org.openrndr.extra.meshgenerators.groundPlaneMesh
|
//import org.openrndr.extra.meshgenerators.groundPlaneMesh
|
||||||
import org.openrndr.math.Vector3
|
//import org.openrndr.math.Vector3
|
||||||
import org.openrndr.math.transforms.transform
|
//import org.openrndr.math.transforms.transform
|
||||||
import org.openrndr.shape.path3D
|
//import org.openrndr.shape.path3D
|
||||||
|
//
|
||||||
fun main() = application {
|
//fun main() = application {
|
||||||
configure {
|
// configure {
|
||||||
width = 1280
|
// width = 1280
|
||||||
height = 720
|
// height = 720
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
program {
|
// program {
|
||||||
if (System.getProperty("takeScreenshot") == "true") {
|
// extend(Orbital()) {
|
||||||
extend(SingleScreenshot()) {
|
// eye = Vector3(4.0, 4.0, 4.0)
|
||||||
this.outputFile = System.getProperty("screenshotPath")
|
// }
|
||||||
}
|
//
|
||||||
}
|
// val renderer = dryRenderer()
|
||||||
extend(Orbital()) {
|
// val scene = scene {
|
||||||
eye = Vector3(4.0, 4.0, 4.0)
|
//
|
||||||
}
|
// addSkybox("file:demo-data/cubemaps/garage_iem.dds")
|
||||||
|
//
|
||||||
val renderer = dryRenderer()
|
// root.hemisphereLight {
|
||||||
val scene = scene {
|
// upColor = ColorRGBa.WHITE.shade(0.1)
|
||||||
|
// downColor = ColorRGBa.BLACK
|
||||||
addSkybox("file:demo-data/cubemaps/garage_iem.dds")
|
// }
|
||||||
|
//
|
||||||
root.hemisphereLight {
|
// root.node {
|
||||||
upColor = ColorRGBa.WHITE.shade(0.1)
|
// transform = transform {
|
||||||
downColor = ColorRGBa.BLACK
|
// translate(0.0, 2.0, 0.0)
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
root.node {
|
// pointLight {
|
||||||
transform = transform {
|
// constantAttenuation = 0.0
|
||||||
translate(0.0, 2.0, 0.0)
|
// quadraticAttenuation = 1.0
|
||||||
}
|
// }
|
||||||
|
// }
|
||||||
pointLight {
|
//
|
||||||
constantAttenuation = 0.0
|
// root.node {
|
||||||
quadraticAttenuation = 1.0
|
// simpleMesh {
|
||||||
}
|
// vertexBuffer = groundPlaneMesh(100.0, 100.0)
|
||||||
}
|
// material = pbrMaterial {
|
||||||
|
// color = ColorRGBa.GREEN
|
||||||
root.node {
|
// }
|
||||||
simpleMesh {
|
// }
|
||||||
vertexBuffer = groundPlaneMesh(100.0, 100.0)
|
// }
|
||||||
material = pbrMaterial {
|
//
|
||||||
color = ColorRGBa.GREEN
|
// root.node {
|
||||||
}
|
// pathMesh {
|
||||||
}
|
// weight = 10.0
|
||||||
}
|
// material = pbrMaterial {
|
||||||
|
// color = ColorRGBa.PINK
|
||||||
root.node {
|
// }
|
||||||
pathMesh {
|
// update {
|
||||||
weight = 10.0
|
// paths = mutableListOf(
|
||||||
material = pbrMaterial {
|
// path3D {
|
||||||
color = ColorRGBa.PINK
|
// val t = seconds * 0.1
|
||||||
}
|
// moveTo(Vector3.ZERO)
|
||||||
update {
|
// val control = Vector3.simplex(3032, t).let { it.copy(y = it.y * 0.5 + 0.5) } * 4.0
|
||||||
paths = mutableListOf(
|
// val target = Vector3.simplex(5077, t).let { it.copy(y = it.y * 0.5 + 0.5) } * 4.0
|
||||||
path3D {
|
// val end = Vector3.simplex(9041, t).let { it.copy(y = it.y * 0.5 + 0.5) } * 4.0
|
||||||
val t = seconds * 0.1
|
// curveTo(control, target)
|
||||||
moveTo(Vector3.ZERO)
|
// continueTo(end)
|
||||||
val control = Vector3.simplex(3032, t).let { it.copy(y = it.y * 0.5 + 0.5) } * 4.0
|
// }
|
||||||
val target = Vector3.simplex(5077, t).let { it.copy(y = it.y * 0.5 + 0.5) } * 4.0
|
// )
|
||||||
val end = Vector3.simplex(9041, t).let { it.copy(y = it.y * 0.5 + 0.5) } * 4.0
|
// }
|
||||||
curveTo(control, target)
|
// }
|
||||||
continueTo(end)
|
// }
|
||||||
}
|
// }
|
||||||
)
|
// extend {
|
||||||
}
|
// drawer.clear(ColorRGBa.BLACK)
|
||||||
}
|
// renderer.draw(drawer, scene)
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
extend {
|
//}
|
||||||
drawer.clear(ColorRGBa.BLACK)
|
|
||||||
renderer.draw(drawer, scene)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -37,13 +37,6 @@ fun main() = application {
|
|||||||
}
|
}
|
||||||
|
|
||||||
program {
|
program {
|
||||||
|
|
||||||
if (System.getProperty("takeScreenshot") == "true") {
|
|
||||||
extend(SingleScreenshot()) {
|
|
||||||
this.outputFile = System.getProperty("screenshotPath")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
val gltf = loadGltfFromFile(File("demo-data/gltf-models/irradiance-probes/model.glb"))
|
val gltf = loadGltfFromFile(File("demo-data/gltf-models/irradiance-probes/model.glb"))
|
||||||
val scene = Scene(SceneNode())
|
val scene = Scene(SceneNode())
|
||||||
|
|
||||||
|
|||||||
@@ -17,12 +17,6 @@ fun main() = application {
|
|||||||
}
|
}
|
||||||
|
|
||||||
program {
|
program {
|
||||||
if (System.getProperty("takeScreenshot") == "true") {
|
|
||||||
extend(SingleScreenshot()) {
|
|
||||||
this.outputFile = System.getProperty("screenshotPath")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
val gltf = loadGltfFromFile(File("demo-data/gltf-models/point-light/Scene.glb"))
|
val gltf = loadGltfFromFile(File("demo-data/gltf-models/point-light/Scene.glb"))
|
||||||
val scene = Scene(SceneNode())
|
val scene = Scene(SceneNode())
|
||||||
|
|
||||||
|
|||||||
@@ -17,12 +17,6 @@ fun main() = application {
|
|||||||
}
|
}
|
||||||
|
|
||||||
program {
|
program {
|
||||||
if (System.getProperty("takeScreenshot") == "true") {
|
|
||||||
extend(SingleScreenshot()) {
|
|
||||||
this.outputFile = System.getProperty("screenshotPath")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
val gltf = loadGltfFromFile(File("demo-data/gltf-models/spot-light/Scene.glb"))
|
val gltf = loadGltfFromFile(File("demo-data/gltf-models/spot-light/Scene.glb"))
|
||||||
val scene = Scene(SceneNode())
|
val scene = Scene(SceneNode())
|
||||||
|
|
||||||
|
|||||||
@@ -17,12 +17,6 @@ fun main() = application {
|
|||||||
}
|
}
|
||||||
|
|
||||||
program {
|
program {
|
||||||
if (System.getProperty("takeScreenshot") == "true") {
|
|
||||||
extend(SingleScreenshot()) {
|
|
||||||
this.outputFile = System.getProperty("screenshotPath")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
val gltf = loadGltfFromFile(File("demo-data/gltf-models/directional-light/Scene.glb"))
|
val gltf = loadGltfFromFile(File("demo-data/gltf-models/directional-light/Scene.glb"))
|
||||||
val scene = Scene(SceneNode())
|
val scene = Scene(SceneNode())
|
||||||
|
|
||||||
|
|||||||
@@ -9,12 +9,6 @@ import java.io.File
|
|||||||
|
|
||||||
fun main() = application {
|
fun main() = application {
|
||||||
program {
|
program {
|
||||||
if (System.getProperty("takeScreenshot") == "true") {
|
|
||||||
extend(SingleScreenshot()) {
|
|
||||||
this.outputFile = System.getProperty("screenshotPath")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
val gltf = loadGltfFromFile(File("demo-data/gltf-models/duck/Duck.gltf"))
|
val gltf = loadGltfFromFile(File("demo-data/gltf-models/duck/Duck.gltf"))
|
||||||
val meshes = gltf.meshes.map {
|
val meshes = gltf.meshes.map {
|
||||||
it.createDrawCommands(gltf)
|
it.createDrawCommands(gltf)
|
||||||
|
|||||||
@@ -18,12 +18,6 @@ fun main() = application {
|
|||||||
}
|
}
|
||||||
|
|
||||||
program {
|
program {
|
||||||
if (System.getProperty("takeScreenshot") == "true") {
|
|
||||||
extend(SingleScreenshot()) {
|
|
||||||
this.outputFile = System.getProperty("screenshotPath")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
val gltf = loadGltfFromFile(File("demo-data/gltf-models/suzanne/Suzanne.gltf"))
|
val gltf = loadGltfFromFile(File("demo-data/gltf-models/suzanne/Suzanne.gltf"))
|
||||||
val scene = Scene(SceneNode())
|
val scene = Scene(SceneNode())
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import org.openrndr.application
|
import org.openrndr.application
|
||||||
import org.openrndr.color.ColorRGBa
|
import org.openrndr.color.ColorRGBa
|
||||||
import org.openrndr.extensions.SingleScreenshot
|
|
||||||
import org.openrndr.extra.dnk3.*
|
import org.openrndr.extra.dnk3.*
|
||||||
|
|
||||||
import org.openrndr.extra.dnk3.gltf.buildSceneNodes
|
import org.openrndr.extra.dnk3.gltf.buildSceneNodes
|
||||||
@@ -18,12 +17,6 @@ fun main() = application {
|
|||||||
}
|
}
|
||||||
|
|
||||||
program {
|
program {
|
||||||
if (System.getProperty("takeScreenshot") == "true") {
|
|
||||||
extend(SingleScreenshot()) {
|
|
||||||
this.outputFile = System.getProperty("screenshotPath")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
val gltf = loadGltfFromFile(File("demo-data/gltf-models/duck/Duck.gltf"))
|
val gltf = loadGltfFromFile(File("demo-data/gltf-models/duck/Duck.gltf"))
|
||||||
val scene = Scene(SceneNode())
|
val scene = Scene(SceneNode())
|
||||||
|
|
||||||
@@ -38,7 +31,7 @@ fun main() = application {
|
|||||||
scene.root.entities.add(HemisphereLight().apply {
|
scene.root.entities.add(HemisphereLight().apply {
|
||||||
upColor = ColorRGBa.WHITE.shade(1.0)
|
upColor = ColorRGBa.WHITE.shade(1.0)
|
||||||
downColor = ColorRGBa.WHITE.shade(0.1)
|
downColor = ColorRGBa.WHITE.shade(0.1)
|
||||||
})
|
})
|
||||||
scene.root.children.add(lightNode)
|
scene.root.children.add(lightNode)
|
||||||
scene.root.children.addAll(gltf.buildSceneNodes().scenes.first())
|
scene.root.children.addAll(gltf.buildSceneNodes().scenes.first())
|
||||||
|
|
||||||
|
|||||||
@@ -18,11 +18,6 @@ fun main() = application {
|
|||||||
}
|
}
|
||||||
|
|
||||||
program {
|
program {
|
||||||
if (System.getProperty("takeScreenshot") == "true") {
|
|
||||||
extend(SingleScreenshot()) {
|
|
||||||
this.outputFile = System.getProperty("screenshotPath")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
val root = SceneNode()
|
val root = SceneNode()
|
||||||
val scene = Scene(root)
|
val scene = Scene(root)
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import org.openrndr.WindowMultisample
|
||||||
import org.openrndr.application
|
import org.openrndr.application
|
||||||
import org.openrndr.color.ColorRGBa
|
import org.openrndr.color.ColorRGBa
|
||||||
import org.openrndr.draw.BufferMultisample
|
import org.openrndr.draw.BufferMultisample
|
||||||
@@ -15,15 +16,10 @@ fun main() = application {
|
|||||||
configure {
|
configure {
|
||||||
width = 1280
|
width = 1280
|
||||||
height = 720
|
height = 720
|
||||||
//multisample = WindowMultisample.SampleCount(8)
|
multisample = WindowMultisample.SampleCount(8)
|
||||||
}
|
}
|
||||||
|
|
||||||
program {
|
program {
|
||||||
if (System.getProperty("takeScreenshot") == "true") {
|
|
||||||
extend(SingleScreenshot()) {
|
|
||||||
this.outputFile = System.getProperty("screenshotPath")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
val gltf = loadGltfFromFile(File("demo-data/gltf-models/fox/Fox.glb"))
|
val gltf = loadGltfFromFile(File("demo-data/gltf-models/fox/Fox.glb"))
|
||||||
val scene = Scene(SceneNode())
|
val scene = Scene(SceneNode())
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import org.openrndr.math.Vector3
|
|||||||
import org.openrndr.math.mod_
|
import org.openrndr.math.mod_
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
suspend fun main() = application {
|
fun main() = application {
|
||||||
configure {
|
configure {
|
||||||
width = 1280
|
width = 1280
|
||||||
height = 720
|
height = 720
|
||||||
@@ -18,12 +18,6 @@ suspend fun main() = application {
|
|||||||
}
|
}
|
||||||
|
|
||||||
program {
|
program {
|
||||||
if (System.getProperty("takeScreenshot") == "true") {
|
|
||||||
extend(SingleScreenshot()) {
|
|
||||||
this.outputFile = System.getProperty("screenshotPath")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
val gltf = loadGltfFromFile(File("demo-data/gltf-models/fox/Fox.glb"))
|
val gltf = loadGltfFromFile(File("demo-data/gltf-models/fox/Fox.glb"))
|
||||||
val scene = Scene(SceneNode())
|
val scene = Scene(SceneNode())
|
||||||
|
|
||||||
|
|||||||
@@ -1,114 +0,0 @@
|
|||||||
import kotlinx.coroutines.yield
|
|
||||||
import org.openrndr.*
|
|
||||||
import org.openrndr.color.ColorRGBa
|
|
||||||
import org.openrndr.draw.*
|
|
||||||
import org.openrndr.extensions.SingleScreenshot
|
|
||||||
import org.openrndr.extra.dnk3.*
|
|
||||||
import org.openrndr.extra.dnk3.features.addVoxelConeTracing
|
|
||||||
import org.openrndr.extra.dnk3.gltf.buildSceneNodes
|
|
||||||
import org.openrndr.extra.dnk3.gltf.loadGltfFromFile
|
|
||||||
import org.openrndr.extra.dnk3.renderers.postRenderer
|
|
||||||
import org.openrndr.extra.camera.Orbital
|
|
||||||
import org.openrndr.extra.meshgenerators.sphereMesh
|
|
||||||
import org.openrndr.filter.color.Delinearize
|
|
||||||
import org.openrndr.math.Spherical
|
|
||||||
import org.openrndr.math.Vector3
|
|
||||||
import org.openrndr.math.transforms.transform
|
|
||||||
import java.io.File
|
|
||||||
import kotlin.math.cos
|
|
||||||
import kotlin.math.sin
|
|
||||||
|
|
||||||
fun main() = application {
|
|
||||||
configure {
|
|
||||||
width = 1280
|
|
||||||
height = 720
|
|
||||||
multisample = WindowMultisample.SampleCount(8)
|
|
||||||
}
|
|
||||||
|
|
||||||
program {
|
|
||||||
|
|
||||||
if (System.getProperty("takeScreenshot") == "true") {
|
|
||||||
extend(SingleScreenshot()) {
|
|
||||||
this.outputFile = System.getProperty("screenshotPath")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
val gltf = loadGltfFromFile(File("demo-data/gltf-models/irradiance-probes/model.glb"))
|
|
||||||
val scene = Scene(SceneNode())
|
|
||||||
|
|
||||||
val probeBox = sphereMesh(16, 16, 0.1)
|
|
||||||
val probeGeometry = Geometry(listOf(probeBox), null, DrawPrimitive.TRIANGLES, 0, probeBox.vertexCount)
|
|
||||||
|
|
||||||
val c = 5
|
|
||||||
// scene.addIrradianceSH(c, c, c, 3.0 / c, cubemapSize = 32, offset = Vector3(0.0, 0.0, 0.0))
|
|
||||||
val vctFeature = scene.addVoxelConeTracing(64,64,64, 0.1)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
val sceneData = gltf.buildSceneNodes()
|
|
||||||
scene.root.children.addAll(sceneData.scenes.first())
|
|
||||||
|
|
||||||
// -- create a renderer
|
|
||||||
val renderer = postRenderer()
|
|
||||||
|
|
||||||
|
|
||||||
// renderer.postSteps.add(
|
|
||||||
// FilterPostStep(1.0, ScreenspaceReflections(), listOf("color", "clipDepth", "viewNormal"), "reflections", ColorFormat.RGB, ColorType.FLOAT16) {
|
|
||||||
// val p = Matrix44.scale(drawer.width / 2.0, drawer.height / 2.0, 1.0) * Matrix44.translate(Vector3(1.0, 1.0, 0.0)) * drawer.projection
|
|
||||||
// this.projection = p
|
|
||||||
// this.projectionMatrixInverse = drawer.projection.inversed
|
|
||||||
// }
|
|
||||||
// )
|
|
||||||
|
|
||||||
// renderer.postSteps.add(
|
|
||||||
// FilterPostStep(1.0, VolumetricIrradiance(), listOf("color", "clipDepth"), "volumetric-irradiance", ColorFormat.RGB, ColorType.FLOAT16) {
|
|
||||||
// this.irradianceSH = scene.features[0] as IrradianceSH
|
|
||||||
// this.projectionMatrixInverse = drawer.projection.inversed
|
|
||||||
// this.viewMatrixInverse = drawer.view.inversed
|
|
||||||
// }
|
|
||||||
// )
|
|
||||||
|
|
||||||
renderer.postSteps.add(
|
|
||||||
FilterPostStep(1.0, Delinearize(), listOf("color"), "ldr", ColorFormat.RGB, ColorType.FLOAT16)
|
|
||||||
)
|
|
||||||
|
|
||||||
val orb = extend(Orbital()) {
|
|
||||||
this.fov = 20.0
|
|
||||||
camera.setView(Vector3(-0.49, -0.24, 0.20), Spherical(26.56, 90.0, 6.533), 40.0)
|
|
||||||
}
|
|
||||||
|
|
||||||
renderer.draw(drawer, scene)
|
|
||||||
|
|
||||||
val dynNode = SceneNode()
|
|
||||||
val dynMaterial = PBRMaterial()
|
|
||||||
val dynPrimitive = MeshPrimitive(probeGeometry, dynMaterial)
|
|
||||||
val dynMesh = Mesh(listOf(dynPrimitive))
|
|
||||||
dynNode.entities.add(dynMesh)
|
|
||||||
scene.root.children.add(dynNode)
|
|
||||||
|
|
||||||
scene.dispatcher.launch {
|
|
||||||
while (true) {
|
|
||||||
dynNode.transform = transform {
|
|
||||||
translate(cos(seconds) * 0.5, 0.5, sin(seconds) * 0.5)
|
|
||||||
scale(2.0)
|
|
||||||
}
|
|
||||||
yield()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
val viz = colorBuffer(64,64)
|
|
||||||
extend {
|
|
||||||
drawer.clear(ColorRGBa.BLACK)
|
|
||||||
renderer.draw(drawer, scene)
|
|
||||||
drawer.defaults()
|
|
||||||
|
|
||||||
for (i in 0 until 128) {
|
|
||||||
vctFeature.voxelMap?.let {
|
|
||||||
it.copyTo(viz, i)
|
|
||||||
}
|
|
||||||
drawer.image(viz, (i * 128) % width + 0.0, ((i * 128)/width * 128 + 0.0 ))
|
|
||||||
}
|
|
||||||
drawer.image(vctFeature.voxelRenderTarget!!.colorBuffer(0))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -102,7 +102,10 @@ private fun SceneRenderer.processIrradiance(drawer: Drawer, scene: Scene, featur
|
|||||||
feature.shMap?.let {
|
feature.shMap?.let {
|
||||||
buffer.rewind()
|
buffer.rewind()
|
||||||
it.write(buffer)
|
it.write(buffer)
|
||||||
it.saveToFile(File("data/scene-cache/sh-$hash.orb"))
|
val f = File("data/scene-cache/sh-$hash.orb")
|
||||||
|
if (f.canWrite()) {
|
||||||
|
it.saveToFile(f)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user