[orx-view-box] Add shouldDraw function
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
|
||||
import org.openrndr.application
|
||||
import org.openrndr.draw.BufferMultisample
|
||||
import org.openrndr.draw.DrawPrimitive
|
||||
import org.openrndr.extensions.Screenshots
|
||||
import org.openrndr.extra.camera.Camera2D
|
||||
@@ -19,7 +20,9 @@ fun main() {
|
||||
program {
|
||||
val vbx = viewBox(Rectangle(0.0, 0.0, 200.0, 800.0)) {
|
||||
extend(Screenshots())
|
||||
extend(Camera2D())
|
||||
extend(Camera2D()).also {
|
||||
shouldDraw = { it.hasChanged }
|
||||
}
|
||||
extend {
|
||||
drawer.rectangle(20.0, 20.0, 100.0, 100.0)
|
||||
}
|
||||
@@ -41,8 +44,12 @@ fun main() {
|
||||
}
|
||||
}
|
||||
|
||||
val vbx3d = viewBox(Rectangle(400.0, 0.0, 400.0, 800.0)) {
|
||||
extend(Orbital())
|
||||
val vbx3d = viewBox(Rectangle(400.0, 0.0, 400.0, 800.0), multisample = BufferMultisample.SampleCount(8)) {
|
||||
extend(Orbital()).also {
|
||||
this.shouldDraw = {
|
||||
it.hasChanged
|
||||
}
|
||||
}
|
||||
val cube = boxMesh()
|
||||
extend {
|
||||
drawer.vertexBuffer(cube, DrawPrimitive.TRIANGLES)
|
||||
|
||||
Reference in New Issue
Block a user