2022-03-01 22:58:58 +01:00
|
|
|
Class {
|
|
|
|
#name : #DiyaRootNode,
|
2022-03-03 19:19:40 +01:00
|
|
|
#superclass : #DiyaNode,
|
2022-08-12 16:37:53 +02:00
|
|
|
#instVars : [
|
2022-08-14 01:38:22 +02:00
|
|
|
'Q',
|
|
|
|
'R'
|
2022-08-12 16:37:53 +02:00
|
|
|
],
|
2022-03-01 22:58:58 +01:00
|
|
|
#category : #'Diya-Graphics'
|
|
|
|
}
|
|
|
|
|
2022-03-19 02:18:29 +01:00
|
|
|
{ #category : #accessing }
|
|
|
|
DiyaRootNode >> boundingBox [
|
|
|
|
^ Rectangle origin: 0@0 corner: context resolution
|
|
|
|
]
|
|
|
|
|
2022-08-12 22:19:54 +02:00
|
|
|
{ #category : #'add/remove' }
|
|
|
|
DiyaRootNode >> cleanDirtyNode: aNode [
|
|
|
|
Q remove: aNode ifAbsent:[]
|
|
|
|
]
|
|
|
|
|
2022-03-03 19:19:40 +01:00
|
|
|
{ #category : #accessing }
|
|
|
|
DiyaRootNode >> draw [
|
2022-03-23 00:52:15 +01:00
|
|
|
|c|
|
2022-08-07 20:43:16 +02:00
|
|
|
c := self ? #bgColor.
|
2022-03-23 00:52:15 +01:00
|
|
|
OpenGL clearColorR: c red G: c green B: c blue A: c alpha.
|
2022-03-03 19:19:40 +01:00
|
|
|
OpenGL clear: GL_COLOR_BUFFER_BIT.
|
|
|
|
]
|
|
|
|
|
2022-08-12 22:19:54 +02:00
|
|
|
{ #category : #'add/remove' }
|
|
|
|
DiyaRootNode >> enqueueDirtyNode: aNode [
|
2022-08-14 01:38:22 +02:00
|
|
|
Q addIfNotPresent: aNode
|
2022-08-12 22:19:54 +02:00
|
|
|
]
|
|
|
|
|
2022-03-19 02:18:29 +01:00
|
|
|
{ #category : #accessing }
|
|
|
|
DiyaRootNode >> extent [
|
|
|
|
^ context resolution
|
|
|
|
]
|
|
|
|
|
2022-03-02 20:11:01 +01:00
|
|
|
{ #category : #initialization }
|
|
|
|
DiyaRootNode >> initialize [
|
|
|
|
super initialize.
|
|
|
|
parent := self.
|
2022-03-06 18:33:10 +01:00
|
|
|
shader := nil.
|
2022-03-19 02:18:29 +01:00
|
|
|
root := self.
|
2022-08-12 16:37:53 +02:00
|
|
|
styleName := #global.
|
2022-08-14 01:38:22 +02:00
|
|
|
Q := OrderedCollection new.
|
|
|
|
R := OrderedCollection new.
|
2022-03-01 22:58:58 +01:00
|
|
|
]
|
|
|
|
|
2022-08-12 16:37:53 +02:00
|
|
|
{ #category : #accessing }
|
2022-03-19 02:18:29 +01:00
|
|
|
DiyaRootNode >> inner: aPoint [
|
|
|
|
^true
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #accessing }
|
|
|
|
DiyaRootNode >> isRoot [
|
|
|
|
^true
|
2022-03-01 22:58:58 +01:00
|
|
|
]
|
|
|
|
|
2022-03-06 19:50:19 +01:00
|
|
|
{ #category : #initialization }
|
2022-08-10 19:55:49 +02:00
|
|
|
DiyaRootNode >> process [
|
2022-08-12 22:19:54 +02:00
|
|
|
|
2022-03-06 19:50:19 +01:00
|
|
|
]
|
|
|
|
|
2022-08-14 01:38:22 +02:00
|
|
|
{ #category : #testing }
|
|
|
|
DiyaRootNode >> readyForSwap [
|
|
|
|
^ R isEmpty
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #rendering }
|
|
|
|
DiyaRootNode >> render [
|
|
|
|
|node maxProcessingTime|
|
|
|
|
self stepDown.
|
|
|
|
R ifEmpty: [
|
|
|
|
self draw.
|
|
|
|
self renderNext: children
|
|
|
|
].
|
|
|
|
maxProcessingTime := (1000 / DiyaBoot maxFPS) asInteger.
|
|
|
|
[
|
|
|
|
Q ifNotEmpty: [
|
|
|
|
node := Q removeFirst.
|
|
|
|
node process.
|
|
|
|
].
|
|
|
|
R ifNotEmpty: [
|
|
|
|
node := R removeFirst.
|
|
|
|
node render.
|
|
|
|
].
|
|
|
|
(R isNotEmpty or: Q isNotEmpty) and:
|
2022-08-14 15:42:59 +02:00
|
|
|
(DiyaClock uniqueInstance lapDelta asMilliSeconds < maxProcessingTime)
|
2022-08-14 01:38:22 +02:00
|
|
|
] whileTrue
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #rendering }
|
|
|
|
DiyaRootNode >> renderNext: nodes [
|
|
|
|
R addAllFirstUnlessAlreadyPresent: nodes.
|
2022-08-12 16:37:53 +02:00
|
|
|
]
|
|
|
|
|
2022-08-12 22:19:54 +02:00
|
|
|
{ #category : #initialization }
|
|
|
|
DiyaRootNode >> setClean [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #initialization }
|
|
|
|
DiyaRootNode >> setDirty [
|
|
|
|
|
|
|
|
|
|
|
|
]
|
|
|
|
|
2022-03-02 20:11:01 +01:00
|
|
|
{ #category : #accessing }
|
|
|
|
DiyaRootNode >> updateTF [
|
|
|
|
"donothing"
|
2022-03-01 22:58:58 +01:00
|
|
|
]
|