MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / FBOStack

Class FBOStack

src/main/java/field/graphics/FBOStack.kt:3–56  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1package field.graphics
2
3class FBOStack(val s: FBO.FBOSpecification, val depth: Int) : BaseScene<FBOStack.State>() {
4
5 inner class State : Modifiable() {
6
7 }
8
9 val stack = Array<FBO>(depth) { FBO(s) }
10
11 val scene = Scene()
12
13 init {
14 stack.forEach {
15 it.scene = scene
16 }
17 }
18
19 var read = 0
20 var write = depth - 1
21
22 fun draw(): Boolean {
23 val b = stack[write].draw()
24
25 write = (write + 1) % depth
26 read = (read + 1) % depth
27
28 return b
29 }
30
31 fun getReadFBO(): FBO {
32 return stack[read]
33 }
34
35 override fun getPasses(): IntArray {
36 return intArrayOf(-1, 1)
37 }
38
39 override fun perform0(): Boolean {
40 return stack[read].perform(-1)
41 }
42
43 override fun perform1(): Boolean {
44 return stack[read].perform(1)
45 }
46
47 override fun setup(): State {
48
49 return State()
50 }
51
52 override fun deallocate(s: State) {
53 }
54
55
56}

Callers

nothing calls this directly

Calls 3

FBOClass · 0.85
SceneClass · 0.85
forEachMethod · 0.45

Tested by

no test coverage detected