mirror of
https://github.com/lxsang/Diya-API.git
synced 2025-07-17 06:19:50 +02:00
Compare commits
1 Commits
master
...
single_buf
Author | SHA1 | Date | |
---|---|---|---|
d99d6f3604 |
@ -8,6 +8,12 @@ Class {
|
|||||||
#category : #'Diya-Core'
|
#category : #'Diya-Core'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{ #category : #'instance creation' }
|
||||||
|
AssetManager class >> defaultAssetLocation [
|
||||||
|
^Smalltalk imageDirectory / 'assets'
|
||||||
|
|
||||||
|
]
|
||||||
|
|
||||||
{ #category : #'instance creation' }
|
{ #category : #'instance creation' }
|
||||||
AssetManager class >> fromLocation: loc [
|
AssetManager class >> fromLocation: loc [
|
||||||
^self new from: loc; yourself
|
^self new from: loc; yourself
|
||||||
@ -15,14 +21,12 @@ AssetManager class >> fromLocation: loc [
|
|||||||
|
|
||||||
{ #category : #adding }
|
{ #category : #adding }
|
||||||
AssetManager >> addAsset: value [
|
AssetManager >> addAsset: value [
|
||||||
assets at: value name put: value.
|
assets at: value name put: value
|
||||||
^ value
|
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #adding }
|
{ #category : #adding }
|
||||||
AssetManager >> addAssetName: name value: value [
|
AssetManager >> addAssetName: name value: value [
|
||||||
assets at: name put: value.
|
assets at: name put: value
|
||||||
^ value
|
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #'instance creation' }
|
{ #category : #'instance creation' }
|
||||||
@ -34,7 +38,7 @@ AssetManager >> from: location [
|
|||||||
AssetManager >> initialize [
|
AssetManager >> initialize [
|
||||||
super initialize.
|
super initialize.
|
||||||
assets := Dictionary new.
|
assets := Dictionary new.
|
||||||
base := DiyaSystemSettings assetPath
|
base := self class defaultAssetLocation
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
|
@ -2,7 +2,8 @@ Class {
|
|||||||
#name : #Diya2DNode,
|
#name : #Diya2DNode,
|
||||||
#superclass : #DiyaNode,
|
#superclass : #DiyaNode,
|
||||||
#instVars : [
|
#instVars : [
|
||||||
'vbuffer'
|
'vbuffer',
|
||||||
|
'voffset'
|
||||||
],
|
],
|
||||||
#category : #'Diya-Graphics'
|
#category : #'Diya-Graphics'
|
||||||
}
|
}
|
||||||
@ -43,6 +44,7 @@ Diya2DNode >> initialize [
|
|||||||
tf := MatrixTransform2x3 identity .
|
tf := MatrixTransform2x3 identity .
|
||||||
shader := Diya2DShader uniqueInstance.
|
shader := Diya2DShader uniqueInstance.
|
||||||
vbuffer := nil.
|
vbuffer := nil.
|
||||||
|
voffset := 0.
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
|
@ -28,11 +28,10 @@ Diya2DPrimShape >> draw [
|
|||||||
blendFnWithSfactor: GL_SRC_ALPHA dfactor: GL_ONE_MINUS_SRC_ALPHA.
|
blendFnWithSfactor: GL_SRC_ALPHA dfactor: GL_ONE_MINUS_SRC_ALPHA.
|
||||||
"configure vao vbo for texture QUAD"
|
"configure vao vbo for texture QUAD"
|
||||||
self texture ifNotNil: [
|
self texture ifNotNil: [
|
||||||
self texture setup.
|
context setTexture: self texture.
|
||||||
context useTexture: self texture.
|
|
||||||
].
|
].
|
||||||
context submitData: vbuffer.
|
voffset := context submitData: vbuffer.
|
||||||
OpenGL drawArrays: type first:0 count:((vbuffer size )>> 2 ).
|
OpenGL drawArrays: type first: voffset count:((vbuffer size )>> 2 ).
|
||||||
"reset value"
|
"reset value"
|
||||||
self texture ifNotNil: [self texture drop.].
|
self texture ifNotNil: [self texture drop.].
|
||||||
self borderWidth > 0 ifTrue: [ self drawBorder ].
|
self borderWidth > 0 ifTrue: [ self drawBorder ].
|
||||||
@ -86,16 +85,9 @@ Diya2DPrimShape >> setUpShader [
|
|||||||
super setUpShader.
|
super setUpShader.
|
||||||
self shader
|
self shader
|
||||||
setUniform: #u_color value: (self ? #color) asGL4FArray;
|
setUniform: #u_color value: (self ? #color) asGL4FArray;
|
||||||
setUniform: #u_bg_color value: (self ? #bgColor) asGL4FArray.
|
setUniform: #u_bg_color value: (self ? #bgColor) asGL4FArray;
|
||||||
self texture ifNotNil: [
|
setUniform: #u_texture_type value:
|
||||||
self shader
|
(self texture ifNil: [ 0 ] ifNotNil:[self texture format]).
|
||||||
setUniform: #u_texture value: self texture unit;
|
|
||||||
setUniform: #u_texture_type value: self texture format.
|
|
||||||
]
|
|
||||||
ifNil:
|
|
||||||
[
|
|
||||||
self shader setUniform: #u_texture_type value: 0.
|
|
||||||
].
|
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
|
@ -4,6 +4,7 @@ Class {
|
|||||||
#instVars : [
|
#instVars : [
|
||||||
'currapp',
|
'currapp',
|
||||||
'txtFPS',
|
'txtFPS',
|
||||||
|
'event',
|
||||||
'running'
|
'running'
|
||||||
],
|
],
|
||||||
#category : #'Diya-Applications'
|
#category : #'Diya-Applications'
|
||||||
@ -11,19 +12,19 @@ Class {
|
|||||||
|
|
||||||
{ #category : #initialization }
|
{ #category : #initialization }
|
||||||
DiyaApplicationLauncher >> appNode [
|
DiyaApplicationLauncher >> appNode [
|
||||||
^node children first
|
^root children first
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #initialization }
|
{ #category : #initialization }
|
||||||
DiyaApplicationLauncher >> bindGlobalEvent [
|
DiyaApplicationLauncher >> bindGlobalEvent [
|
||||||
|pointer |
|
|pointer |
|
||||||
pointer := node addNode: (DiyaCircle r: 10) at: 200@200.
|
pointer := root addNode: (DiyaCircle r: 10) at: 200@200.
|
||||||
pointer styleName: #pointer.
|
pointer styleName: #pointer.
|
||||||
target on: #keydown do:[:e| self stdlog: 'keydown...'. running := false.].
|
root on: #keydown do:[:e| self stdlog: 'keydown...'. running := false.].
|
||||||
target on: #quit do: [:e| running := false].
|
root on: #quit do: [:e| running := false].
|
||||||
target on: #(fingerdown fingermotion mousemotion) do:[:e|
|
root on: #(fingerdown fingermotion mousemotion) do:[:e|
|
||||||
pointer position: e mapped worldPosition.
|
pointer position: e mapped worldPosition.
|
||||||
DiyaRenderer mouse: (e mapped x) @ (e mapped y).
|
DiyaRendererContext uniqueInstance mouse: (e mapped x) @ (e mapped y).
|
||||||
].
|
].
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -33,7 +34,70 @@ DiyaApplicationLauncher >> defaultApplication [
|
|||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #initialization }
|
{ #category : #initialization }
|
||||||
DiyaApplicationLauncher >> defineLayout [
|
DiyaApplicationLauncher >> initialize [
|
||||||
|
super initialize.
|
||||||
|
root := DiyaRootNode new.
|
||||||
|
currapp := nil.
|
||||||
|
]
|
||||||
|
|
||||||
|
{ #category : #initialization }
|
||||||
|
DiyaApplicationLauncher >> launch: app [
|
||||||
|
currapp ifNotNil: [
|
||||||
|
currapp quit.
|
||||||
|
root empty.
|
||||||
|
].
|
||||||
|
currapp := app uniqueInstance.
|
||||||
|
self context assets: currapp am.
|
||||||
|
[
|
||||||
|
self stdlog: 'Loading application'.
|
||||||
|
currapp root visibility: false.
|
||||||
|
currapp setup.
|
||||||
|
self appNode addNode: currapp root.
|
||||||
|
self process: true.
|
||||||
|
currapp root visibility: true.
|
||||||
|
self stdlog: 'Application LOADED'.
|
||||||
|
] fork.
|
||||||
|
]
|
||||||
|
|
||||||
|
{ #category : #initialization }
|
||||||
|
DiyaApplicationLauncher >> main [
|
||||||
|
| fps delta|
|
||||||
|
delta := DiyaClock uniqueInstance delta asMilliSeconds.
|
||||||
|
fps := DiyaBoot maxFPS.
|
||||||
|
delta = 0 ifFalse:[ fps := (1000/ delta) asInteger].
|
||||||
|
txtFPS data: ('FPS:', fps asString).
|
||||||
|
[(SDL2 pollEvent: event) > 0] whileTrue: [
|
||||||
|
root trigger: (DiyaEvent from: event mapped).
|
||||||
|
].
|
||||||
|
currapp ifNotNil: [currapp main.].
|
||||||
|
root stepDown.
|
||||||
|
self process: false.
|
||||||
|
root render.
|
||||||
|
]
|
||||||
|
|
||||||
|
{ #category : #initialization }
|
||||||
|
DiyaApplicationLauncher >> process: force [
|
||||||
|
|Q node maxProcessingTime|
|
||||||
|
maxProcessingTime := (1000 / DiyaBoot maxFPS) asInteger >> 1.
|
||||||
|
Q := root processingQueue.
|
||||||
|
Q ifEmpty:[^ self].
|
||||||
|
[
|
||||||
|
node := Q removeFirst.
|
||||||
|
node process.
|
||||||
|
Q isNotEmpty and: (
|
||||||
|
(DiyaClock uniqueInstance lapDelta asMilliSeconds < maxProcessingTime) or: force)
|
||||||
|
] whileTrue
|
||||||
|
|
||||||
|
]
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
DiyaApplicationLauncher >> running [
|
||||||
|
^ running
|
||||||
|
]
|
||||||
|
|
||||||
|
{ #category : #initialization }
|
||||||
|
DiyaApplicationLauncher >> setup [
|
||||||
|
event := SDL_Event new.
|
||||||
DiyaUIThemesManager uniqueInstance currentTheme
|
DiyaUIThemesManager uniqueInstance currentTheme
|
||||||
define: #fps_text styles: {
|
define: #fps_text styles: {
|
||||||
#color -> Color red.
|
#color -> Color red.
|
||||||
@ -45,60 +109,11 @@ DiyaApplicationLauncher >> defineLayout [
|
|||||||
#bgColor -> Color orange.
|
#bgColor -> Color orange.
|
||||||
#border -> 3
|
#border -> 3
|
||||||
}.
|
}.
|
||||||
node addNode: (DiyaCompositeNode new) at: 0@0.
|
root addNode: (DiyaCompositeNode new) at: 0@0.
|
||||||
txtFPS := node addNode:(DiyaText data: '') at: ( self context resolution x - 80)@(self context resolution y - 40).
|
txtFPS := root addNode:(DiyaText data: '') at: ( self context resolution x - 80)@(self context resolution y - 40).
|
||||||
node addNode: (DiyaTimerNode timeout: 0 do: [:n| self updateFPS ] ).
|
|
||||||
txtFPS extent: 80@40.
|
txtFPS extent: 80@40.
|
||||||
txtFPS styleName: #fps_text.
|
txtFPS styleName: #fps_text.
|
||||||
self bindGlobalEvent.
|
self bindGlobalEvent.
|
||||||
self loadNode.
|
|
||||||
]
|
|
||||||
|
|
||||||
{ #category : #initialization }
|
|
||||||
DiyaApplicationLauncher >> initialize [
|
|
||||||
super initialize.
|
|
||||||
node := DiyaCompositeNode new.
|
|
||||||
currapp := nil.
|
|
||||||
]
|
|
||||||
|
|
||||||
{ #category : #initialization }
|
|
||||||
DiyaApplicationLauncher >> launch: app [
|
|
||||||
currapp ifNotNil: [
|
|
||||||
currapp quit.
|
|
||||||
].
|
|
||||||
currapp := app uniqueInstance.
|
|
||||||
self context assets: currapp am.
|
|
||||||
currapp target: self appNode.
|
|
||||||
currapp onloaded:[
|
|
||||||
self stdlog: 'Application LOADED'.
|
|
||||||
].
|
|
||||||
]
|
|
||||||
|
|
||||||
{ #category : #initialization }
|
|
||||||
DiyaApplicationLauncher >> onloaded: aBlock [
|
|
||||||
|loader|
|
|
||||||
running := true.
|
running := true.
|
||||||
loader := DiyaDefaultSystemLoader on: target.
|
self launch: self defaultApplication.
|
||||||
loader job: [ DiyaFontManager uniqueInstance loadFonts. ] name: 'Loading fonts...'.
|
|
||||||
loader job: [ self defineLayout ] name: 'Define layout...'.
|
|
||||||
loader onloaded: [
|
|
||||||
node children do:[:c| target addNode: c at: c position].
|
|
||||||
node := target.
|
|
||||||
aBlock value.
|
|
||||||
self launch: self defaultApplication.
|
|
||||||
]
|
|
||||||
]
|
|
||||||
|
|
||||||
{ #category : #accessing }
|
|
||||||
DiyaApplicationLauncher >> running [
|
|
||||||
^ running
|
|
||||||
]
|
|
||||||
|
|
||||||
{ #category : #initialization }
|
|
||||||
DiyaApplicationLauncher >> updateFPS [
|
|
||||||
| fps delta|
|
|
||||||
delta := DiyaSystemClock delta.
|
|
||||||
fps := DiyaSystemSettings maxFPS.
|
|
||||||
delta = 0 ifFalse:[ fps := (1000/ delta) asInteger].
|
|
||||||
txtFPS data: ('FPS:', fps asString).
|
|
||||||
]
|
]
|
||||||
|
@ -2,10 +2,8 @@ Class {
|
|||||||
#name : #DiyaApplicationModel,
|
#name : #DiyaApplicationModel,
|
||||||
#superclass : #DiyaSingleton,
|
#superclass : #DiyaSingleton,
|
||||||
#instVars : [
|
#instVars : [
|
||||||
'node',
|
'root',
|
||||||
'am',
|
'am'
|
||||||
'target',
|
|
||||||
'context'
|
|
||||||
],
|
],
|
||||||
#category : #'Diya-Applications'
|
#category : #'Diya-Applications'
|
||||||
}
|
}
|
||||||
@ -22,42 +20,30 @@ DiyaApplicationModel >> cleanup [
|
|||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
DiyaApplicationModel >> context [
|
DiyaApplicationModel >> context [
|
||||||
^DiyaRenderer
|
^DiyaRendererContext uniqueInstance
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #initialization }
|
{ #category : #initialization }
|
||||||
DiyaApplicationModel >> initialize [
|
DiyaApplicationModel >> initialize [
|
||||||
super initialize.
|
super initialize.
|
||||||
context := DiyaRenderer
|
|
||||||
]
|
|
||||||
|
|
||||||
{ #category : #'as yet unclassified' }
|
|
||||||
DiyaApplicationModel >> loadNode [
|
|
||||||
|pseudoRoot|
|
|
||||||
pseudoRoot := DiyaRootNode new.
|
|
||||||
pseudoRoot addNode: node.
|
|
||||||
pseudoRoot processQueue do:[:el|
|
|
||||||
el process
|
|
||||||
].
|
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
DiyaApplicationModel >> node [
|
DiyaApplicationModel >> main [
|
||||||
^ node
|
|
||||||
]
|
|
||||||
|
|
||||||
{ #category : #accessing }
|
|
||||||
DiyaApplicationModel >> onloaded: aBlock [
|
|
||||||
self subclassResponsibility
|
self subclassResponsibility
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
DiyaApplicationModel >> quit [
|
DiyaApplicationModel >> quit [
|
||||||
node empty.
|
|
||||||
self cleanup
|
self cleanup
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #initialization }
|
{ #category : #accessing }
|
||||||
DiyaApplicationModel >> target: aNode [
|
DiyaApplicationModel >> root [
|
||||||
target := aNode.
|
^ root
|
||||||
|
]
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
DiyaApplicationModel >> setup [
|
||||||
|
self subclassResponsibility
|
||||||
]
|
]
|
||||||
|
@ -7,7 +7,7 @@ Class {
|
|||||||
{ #category : #initialization }
|
{ #category : #initialization }
|
||||||
DiyaBaseApplication >> initialize [
|
DiyaBaseApplication >> initialize [
|
||||||
super initialize.
|
super initialize.
|
||||||
node := DiyaCompositeNode new.
|
root := DiyaCompositeNode new.
|
||||||
node styleName: #global.
|
root styleName: #global.
|
||||||
am := AssetManager new.
|
am := AssetManager new.
|
||||||
]
|
]
|
||||||
|
@ -18,10 +18,12 @@ Class {
|
|||||||
|
|
||||||
{ #category : #'class initialization' }
|
{ #category : #'class initialization' }
|
||||||
DiyaBoot class >> initialize [
|
DiyaBoot class >> initialize [
|
||||||
Smalltalk globals at: #DiyaDisplay put: nil.
|
Smalltalk globals at: #DiyaDisplay put: nil
|
||||||
Smalltalk globals at: #DiyaSystemClock put: nil.
|
]
|
||||||
Smalltalk globals at: #DiyaRenderer put: nil.
|
|
||||||
Smalltalk globals at: #DiyaSystemSettings put: nil.
|
{ #category : #'instance creation' }
|
||||||
|
DiyaBoot class >> maxFPS [
|
||||||
|
^60
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #'instance creation' }
|
{ #category : #'instance creation' }
|
||||||
@ -34,6 +36,12 @@ DiyaBoot class >> startx [
|
|||||||
self uniqueInstance run
|
self uniqueInstance run
|
||||||
]
|
]
|
||||||
|
|
||||||
|
{ #category : #events }
|
||||||
|
DiyaBoot >> GLinit. [
|
||||||
|
OpenGL viewportX: 0 Y:0 W: display w H: display h.
|
||||||
|
OpenGL enable: GL_TEXTURE_2D.
|
||||||
|
]
|
||||||
|
|
||||||
{ #category : #events }
|
{ #category : #events }
|
||||||
DiyaBoot >> createGLContext [
|
DiyaBoot >> createGLContext [
|
||||||
context := SDL2 glCreateContext: window.
|
context := SDL2 glCreateContext: window.
|
||||||
@ -78,11 +86,10 @@ DiyaBoot >> init [
|
|||||||
display := SDL_DisplayMode externalNew autoRelease.
|
display := SDL_DisplayMode externalNew autoRelease.
|
||||||
SDL2 SDLGetCurrentDisplayMode: display from:0.
|
SDL2 SDLGetCurrentDisplayMode: display from:0.
|
||||||
SDL2 showCursor: 0.
|
SDL2 showCursor: 0.
|
||||||
DiyaSingleton resetAll.
|
|
||||||
Smalltalk globals at: #Display ifAbsentPut:display.
|
Smalltalk globals at: #Display ifAbsentPut:display.
|
||||||
Smalltalk globals at: #DiyaDisplay put:display.
|
Smalltalk globals at: #DiyaDisplay put:display.
|
||||||
Smalltalk globals at: #DiyaSystemSettings put: DiyaSettings uniqueInstance.
|
DiyaSingleton resetAll.
|
||||||
Smalltalk globals at: #DiyaSystemClock put: DiyaClock uniqueInstance.
|
DiyaFontManager uniqueInstance loadFonts.
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #events }
|
{ #category : #events }
|
||||||
@ -90,28 +97,23 @@ DiyaBoot >> initialize [
|
|||||||
display := nil.
|
display := nil.
|
||||||
window := nil.
|
window := nil.
|
||||||
context := nil.
|
context := nil.
|
||||||
clock := DiyaSystemClock.
|
clock := DiyaClock uniqueInstance.
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #events }
|
{ #category : #events }
|
||||||
DiyaBoot >> render [
|
DiyaBoot >> render [
|
||||||
|launcher event|
|
|launcher|
|
||||||
event := SDL_Event new.
|
DiyaRendererContext uniqueInstance.
|
||||||
launcher := DiyaApplicationLauncher uniqueInstance.
|
launcher := DiyaApplicationLauncher uniqueInstance.
|
||||||
"Init the Open GL view port and enable 2D texture"
|
launcher setup.
|
||||||
OpenGL viewportX: 0 Y:0 W: display w H: display h.
|
self GLinit.
|
||||||
OpenGL enable: GL_TEXTURE_2D.
|
|
||||||
launcher target: DiyaRenderer root.
|
|
||||||
launcher onloaded: [self stdlog: 'Launcher loaded'].
|
|
||||||
[ launcher running ] whileTrue: [
|
[ launcher running ] whileTrue: [
|
||||||
DiyaSystemClock tick.
|
DiyaClock uniqueInstance tick.
|
||||||
[(SDL2 pollEvent: event) > 0] whileTrue: [
|
launcher main.
|
||||||
DiyaRenderer root trigger: (DiyaEvent from: event mapped).
|
SDL2 glSwapWindow: window.
|
||||||
].
|
|
||||||
DiyaRenderer render.
|
|
||||||
SDL2 delay:
|
SDL2 delay:
|
||||||
(0 max:
|
(0 max:
|
||||||
(1000/ DiyaSystemSettings maxFPS) asInteger - (DiyaSystemClock lapDelta)).
|
(1000/ self class maxFPS) asInteger - (DiyaClock uniqueInstance lapDelta asMilliSeconds)).
|
||||||
].
|
].
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -203,7 +205,6 @@ DiyaBoot >> startx [
|
|||||||
display: display;
|
display: display;
|
||||||
window: window;
|
window: window;
|
||||||
useProjection: OrthoProjectionMatrix.
|
useProjection: OrthoProjectionMatrix.
|
||||||
Smalltalk globals at: #DiyaRenderer put: DiyaRendererContext uniqueInstance.
|
|
||||||
self render.
|
self render.
|
||||||
context delete.
|
context delete.
|
||||||
window destroy.
|
window destroy.
|
||||||
|
@ -23,12 +23,12 @@ DiyaClock >> elapsedTime [
|
|||||||
DiyaClock >> initialize [
|
DiyaClock >> initialize [
|
||||||
monotonic := DateAndTime now.
|
monotonic := DateAndTime now.
|
||||||
lastTick := monotonic.
|
lastTick := monotonic.
|
||||||
lapTime := 0.
|
lapTime := 0 asDuration.
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #initialization }
|
{ #category : #initialization }
|
||||||
DiyaClock >> lapDelta [
|
DiyaClock >> lapDelta [
|
||||||
^ ((DateAndTime now) - lastTick) asMilliSeconds
|
^ ((DateAndTime now) - lastTick)
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #initialization }
|
{ #category : #initialization }
|
||||||
@ -38,6 +38,6 @@ DiyaClock >> lapTime [
|
|||||||
|
|
||||||
{ #category : #initialization }
|
{ #category : #initialization }
|
||||||
DiyaClock >> tick [
|
DiyaClock >> tick [
|
||||||
lapTime := self lapDelta.
|
lapTime := (DateAndTime now) - lastTick.
|
||||||
lastTick := DateAndTime now.
|
lastTick := DateAndTime now.
|
||||||
]
|
]
|
||||||
|
@ -33,7 +33,7 @@ DiyaConvexPolygon >> calculateVertices [
|
|||||||
|
|
||||||
{ #category : #initialization }
|
{ #category : #initialization }
|
||||||
DiyaConvexPolygon >> drawLines [
|
DiyaConvexPolygon >> drawLines [
|
||||||
OpenGL drawArrays: GL_LINE_LOOP first:0 count: (vbuffer size >> 2) - 1.
|
OpenGL drawArrays: GL_LINE_LOOP first:voffset count: (vbuffer size >> 2) - 1.
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #initialization }
|
{ #category : #initialization }
|
||||||
|
@ -1,24 +0,0 @@
|
|||||||
Class {
|
|
||||||
#name : #DiyaDefaultAppLoader,
|
|
||||||
#superclass : #DiyaDefaultSystemLoader,
|
|
||||||
#instVars : [
|
|
||||||
'label'
|
|
||||||
],
|
|
||||||
#category : #'Diya-Applications'
|
|
||||||
}
|
|
||||||
|
|
||||||
{ #category : #initialization }
|
|
||||||
DiyaDefaultAppLoader >> updateLayout [
|
|
||||||
super updateLayout.
|
|
||||||
label ifNil:[
|
|
||||||
label := node addNode: (DiyaText new) at: (progress position + (0@25)).
|
|
||||||
label inlineStyle: #xAlign value: #center
|
|
||||||
].
|
|
||||||
label extent: (progress extent x) @ 40.
|
|
||||||
]
|
|
||||||
|
|
||||||
{ #category : #scheduling }
|
|
||||||
DiyaDefaultAppLoader >> updateProgress: name percent: p [
|
|
||||||
label data: name.
|
|
||||||
progress percent: p
|
|
||||||
]
|
|
@ -1,21 +0,0 @@
|
|||||||
Class {
|
|
||||||
#name : #DiyaDefaultSystemLoader,
|
|
||||||
#superclass : #DiyaLoader,
|
|
||||||
#instVars : [
|
|
||||||
'progress'
|
|
||||||
],
|
|
||||||
#category : #'Diya-Applications'
|
|
||||||
}
|
|
||||||
|
|
||||||
{ #category : #initialization }
|
|
||||||
DiyaDefaultSystemLoader >> updateLayout [
|
|
||||||
|xtent|
|
|
||||||
xtent := DiyaRenderer resolution.
|
|
||||||
progress ifNil:[progress := node addNode: (DiyaLoadingBar new) at: 20@((xtent y >> 1) - 50)].
|
|
||||||
progress extent: (xtent x - 40) @ 20.
|
|
||||||
]
|
|
||||||
|
|
||||||
{ #category : #scheduling }
|
|
||||||
DiyaDefaultSystemLoader >> updateProgress: name percent: p [
|
|
||||||
progress percent: p
|
|
||||||
]
|
|
@ -1,9 +1,6 @@
|
|||||||
Class {
|
Class {
|
||||||
#name : #DiyaExampleApp,
|
#name : #DiyaExampleApp,
|
||||||
#superclass : #DiyaBaseApplication,
|
#superclass : #DiyaBaseApplication,
|
||||||
#instVars : [
|
|
||||||
'loader'
|
|
||||||
],
|
|
||||||
#category : #'Diya-Applications'
|
#category : #'Diya-Applications'
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -12,107 +9,14 @@ DiyaExampleApp >> cleanup [
|
|||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
|
||||||
DiyaExampleApp >> defineNodes [
|
|
||||||
|node2 node1 img ell label icon button texture loading|
|
|
||||||
node := DiyaCompositeNode new.
|
|
||||||
texture := DiyaImageTex new.
|
|
||||||
label := node addNode: (DiyaLabel new) at: 10@40.
|
|
||||||
label extent: 250@24.
|
|
||||||
label styleName:#text_icon_1.
|
|
||||||
label icon: 16rF254.
|
|
||||||
|
|
||||||
node1 := node addNode: (DiyaRectangle size:100@150 shader: DiyaExampleShader uniqueInstance) at: 300 @ 40.
|
|
||||||
node1 rotation: 45.
|
|
||||||
node1 scale: 2.0@2.0.
|
|
||||||
node1 on: #(mousebuttondown fingerdown) do:[:e|
|
|
||||||
label txt: 'RECT ', (node1 local: e mapped worldPosition) asIntegerPoint asString].
|
|
||||||
|
|
||||||
img := node addNode: (DiyaImageView from:'mrsang.png') at: 10 @ 400.
|
|
||||||
img styleName: #image_view.
|
|
||||||
img extent:200@200.
|
|
||||||
node on: #(mousebuttondown fingerdown) do:[:e|
|
|
||||||
"change texture"
|
|
||||||
|p|
|
|
||||||
p := e mapped worldPosition.
|
|
||||||
label txt: 'Mouse ', p asIntegerPoint asString.
|
|
||||||
DiyaRenderer assets
|
|
||||||
addAsset:(texture fromDisplay: (Rectangle origin: ((p x - 100) @ (p y - 100)) extent: 200@200 ) as: 'capture').
|
|
||||||
img textureNamed: 'capture'.
|
|
||||||
|
|
||||||
].
|
|
||||||
|
|
||||||
node2 := node addNode: (DiyaRectangle new) at: 10@80.
|
|
||||||
node2 styleName: #rect_view.
|
|
||||||
node2 extent: 240@320.
|
|
||||||
|
|
||||||
node2 := node addNode: (DiyaText data: String loremIpsum) at: 10@80.
|
|
||||||
node2 extent: 240@320.
|
|
||||||
node2 wordWrap: true.
|
|
||||||
node2 styleName: #text_view.
|
|
||||||
|
|
||||||
node2 := node addNode: (DiyaLine from: 10@10 to: 200@200).
|
|
||||||
node2 styleName: #line_view.
|
|
||||||
|
|
||||||
ell := node addNode: (DiyaEllipse rx:100 ry: 70) at: 120@300.
|
|
||||||
ell scale: 1.2 @ 1.2.
|
|
||||||
ell styleName: #ell_view.
|
|
||||||
"ell rotation: 30."
|
|
||||||
ell textureNamed:'mrsang.png'.
|
|
||||||
ell addNode: (DiyaTimerNode timeout: 1000 / 6 do:[:n |
|
|
||||||
n parent rotation: n parent rotation + 10.
|
|
||||||
] ).
|
|
||||||
ell on: #(mousebuttondown fingerdown) do:[:e|
|
|
||||||
label txt: 'Ellipse clicked', (ell local:e mapped worldPosition) asIntegerPoint asString].
|
|
||||||
|
|
||||||
node2 := node addNode: (DiyaConvexPolygon points:{0@40. 150@190. 200@20. 100@0}) at: 250@60.
|
|
||||||
node2 textureNamed: 'mrsang.png'.
|
|
||||||
node2 styleName: #poly_view.
|
|
||||||
|
|
||||||
icon := node addNode: (DiyaFontIcon data: #(16rF101 16rF155 16rF185 16rF21B 16rF298 16rF254)) at: 240@500.
|
|
||||||
icon styleName: #text_icon_2.
|
|
||||||
|
|
||||||
button := node addNode: (DiyaButton text: 'Click me !') at: 240@460.
|
|
||||||
icon := DiyaFontIcon data: 16rF130.
|
|
||||||
"icon := DiyaImageIcon from: 'mrsang.png'."
|
|
||||||
icon addNode:(DiyaTimerNode timeout: 1000 / 12 do:[:n |
|
|
||||||
n parent rotation: n parent rotation + 10 pivot: n parent extent / 2.
|
|
||||||
] ).
|
|
||||||
button extent: 200@40.
|
|
||||||
button icon: icon "'mrsang.png'".
|
|
||||||
"button rotation: Float pi / 2.0."
|
|
||||||
button styleName: #button_view.
|
|
||||||
|
|
||||||
loading := node addNode: (DiyaLoadingBar new) at: 240@550.
|
|
||||||
loading extent: 200 @ 20.
|
|
||||||
|
|
||||||
loading addNode: (DiyaTimerNode timeout: 2000 do:[:n |
|
|
||||||
|p|
|
|
||||||
p := (n parent percent + 10).
|
|
||||||
p > 100 ifTrue:[ p := 0].
|
|
||||||
n parent percent: p.
|
|
||||||
] ).
|
|
||||||
|
|
||||||
|
|
||||||
loading := node addNode: (DiyaLoadingBar new) at: 240@580.
|
|
||||||
loading extent: 200 @ 20.
|
|
||||||
|
|
||||||
loading addNode: (DiyaTimerNode timeout: 1000 do:[:n |
|
|
||||||
|p|
|
|
||||||
p := (n parent percent + 10).
|
|
||||||
p > 100 ifTrue:[ p := 0].
|
|
||||||
n parent percent: p.
|
|
||||||
] ).
|
|
||||||
]
|
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
DiyaExampleApp >> defineStyleSheet [
|
DiyaExampleApp >> defineStyleSheet [
|
||||||
|fmgr style|
|
|fmgr style|
|
||||||
fmgr := DiyaFontManager uniqueInstance.
|
fmgr := DiyaFontManager uniqueInstance.
|
||||||
#(16 18 24) do:[:fontSize|
|
#(16 24) do:[:fontSize|
|
||||||
self stdlog: 'Init font size ', fontSize asString, ' of ', fmgr defaultFamily.
|
self stdlog: 'Init font size ', fontSize asString, ' of ', fmgr defaultFamily.
|
||||||
style := fmgr style: fmgr defaultStyle from: fmgr defaultFamily.
|
style := fmgr style: fmgr defaultStyle from: fmgr defaultFamily.
|
||||||
(style textureOf: fontSize)" genPrintableASCII" .
|
style textureOf: fontSize.
|
||||||
].
|
].
|
||||||
DiyaUIThemesManager uniqueInstance currentTheme
|
DiyaUIThemesManager uniqueInstance currentTheme
|
||||||
define: #text_icon_1 styles: {
|
define: #text_icon_1 styles: {
|
||||||
@ -164,26 +68,103 @@ DiyaExampleApp >> defineStyleSheet [
|
|||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
DiyaExampleApp >> initialize [
|
DiyaExampleApp >> main [
|
||||||
super initialize.
|
|
||||||
loader := nil
|
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
DiyaExampleApp >> onloaded: aBlock [
|
DiyaExampleApp >> setup [
|
||||||
loader ifNil: [ loader := DiyaDefaultAppLoader on: target ].
|
|node node1 img ell label icon button texture loading|
|
||||||
loader job: [ self defineStyleSheet ] name: 'Initializing themes...'.
|
texture := DiyaImageTex new.
|
||||||
loader job: [
|
"DiyaRendererContext uniqueInstance assets
|
||||||
self defineNodes.
|
addAsset:
|
||||||
self loadNode.
|
((Form fromDisplay: ( Rectangle origin: 0@0 corner: 300@300 )) asDiyaTexture: 'display')."
|
||||||
] name: 'Initializing UI elements...'.
|
self defineStyleSheet.
|
||||||
|
label := root addNode: (DiyaLabel new) at: 10@40.
|
||||||
|
label extent: 250@24.
|
||||||
|
label styleName:#text_icon_1.
|
||||||
|
label icon: 16rF254.
|
||||||
|
|
||||||
loader onloaded: [
|
"node1 := root addNode: (DiyaRectangle size:100@150 shader: DiyaExampleShader uniqueInstance) at: 300 @ 40.
|
||||||
node children do:[:e|
|
node1 rotation: 45.
|
||||||
target addNode: e at: e position.
|
node1 scale: 2.0@2.0.
|
||||||
node := target.
|
node1 on: #(mousebuttondown fingerdown) do:[:e|
|
||||||
].
|
label txt: 'RECT ', (node1 local: e mapped worldPosition) asIntegerPoint asString]."
|
||||||
aBlock value
|
|
||||||
|
img := root addNode: (DiyaImageView from:'mrsang.png') at: 10 @ 400.
|
||||||
|
img styleName: #image_view.
|
||||||
|
img extent:200@200.
|
||||||
|
root on: #(mousebuttondown fingerdown) do:[:e|
|
||||||
|
"change texture"
|
||||||
|
|p|
|
||||||
|
p := e mapped worldPosition.
|
||||||
|
label txt: 'Mouse ', p asIntegerPoint asString.
|
||||||
|
DiyaRendererContext uniqueInstance assets
|
||||||
|
addAsset:(texture fromDisplay: (Rectangle origin: ((p x - 100) @ (p y - 100)) extent: 200@200 ) as: 'capture').
|
||||||
|
img textureNamed: 'capture'.
|
||||||
|
|
||||||
].
|
].
|
||||||
|
|
||||||
|
node := root addNode: (DiyaRectangle new) at: 10@80.
|
||||||
|
node styleName: #rect_view.
|
||||||
|
node extent: 240@320.
|
||||||
|
|
||||||
|
node := root addNode: (DiyaText data: String loremIpsum) at: 10@80.
|
||||||
|
node extent: 240@320.
|
||||||
|
node wordWrap: true.
|
||||||
|
node styleName: #text_view.
|
||||||
|
|
||||||
|
node := root addNode: (DiyaLine from: 10@10 to: 200@200).
|
||||||
|
node styleName: #line_view.
|
||||||
|
|
||||||
|
ell := root addNode: (DiyaEllipse rx:100 ry: 70) at: 120@300.
|
||||||
|
ell scale: 1.2 @ 1.2.
|
||||||
|
ell styleName: #ell_view.
|
||||||
|
"ell rotation: 30."
|
||||||
|
ell textureNamed:'mrsang.png'.
|
||||||
|
ell addNode: (DiyaTimerNode timeout: 1000 / 6 do:[:n |
|
||||||
|
n parent rotation: n parent rotation + 10.
|
||||||
|
] ).
|
||||||
|
ell on: #(mousebuttondown fingerdown) do:[:e|
|
||||||
|
label txt: 'Ellipse clicked', (ell local:e mapped worldPosition) asIntegerPoint asString].
|
||||||
|
|
||||||
|
node := root addNode: (DiyaConvexPolygon points:{0@40. 150@190. 200@20. 100@0}) at: 250@60.
|
||||||
|
node textureNamed: 'mrsang.png'.
|
||||||
|
node styleName: #poly_view.
|
||||||
|
|
||||||
|
icon := root addNode: (DiyaFontIcon data: #(16rF101 16rF155 16rF185 16rF21B 16rF298 16rF254)) at: 240@500.
|
||||||
|
icon styleName: #text_icon_2.
|
||||||
|
|
||||||
|
button := root addNode: (DiyaButton text: 'Click me !') at: 240@460.
|
||||||
|
icon := DiyaFontIcon data: 16rF130.
|
||||||
|
"icon := DiyaImageIcon from: 'mrsang.png'."
|
||||||
|
icon addNode:(DiyaTimerNode timeout: 1000 / 12 do:[:n |
|
||||||
|
n parent rotation: n parent rotation + 10 pivot: n parent extent / 2.
|
||||||
|
] ).
|
||||||
|
button extent: 200@40.
|
||||||
|
button icon: icon "'mrsang.png'".
|
||||||
|
"button rotation: Float pi / 2.0."
|
||||||
|
button styleName: #button_view.
|
||||||
|
|
||||||
|
loading := root addNode: (DiyaLoadingBar new) at: 240@550.
|
||||||
|
loading extent: 200 @ 20.
|
||||||
|
|
||||||
|
loading addNode: (DiyaTimerNode timeout: 2000 do:[:n |
|
||||||
|
|p|
|
||||||
|
p := (n parent percent + 10).
|
||||||
|
p > 100 ifTrue:[ p := 0].
|
||||||
|
n parent percent: p.
|
||||||
|
] ).
|
||||||
|
|
||||||
|
|
||||||
|
loading := root addNode: (DiyaLoadingBar new) at: 240@580.
|
||||||
|
loading extent: 200 @ 20.
|
||||||
|
|
||||||
|
loading addNode: (DiyaTimerNode timeout: 1000 do:[:n |
|
||||||
|
|p|
|
||||||
|
p := (n parent percent + 10).
|
||||||
|
p > 100 ifTrue:[ p := 0].
|
||||||
|
n parent percent: p.
|
||||||
|
] ).
|
||||||
|
^ root
|
||||||
]
|
]
|
||||||
|
@ -13,6 +13,13 @@ DiyaFontManager class >> cleanUpInstance: singleton [
|
|||||||
singleton reset.
|
singleton reset.
|
||||||
]
|
]
|
||||||
|
|
||||||
|
{ #category : #'as yet unclassified' }
|
||||||
|
DiyaFontManager class >> searchPaths [
|
||||||
|
^ {
|
||||||
|
Smalltalk imageDirectory / 'fonts'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
{ #category : #initialization }
|
{ #category : #initialization }
|
||||||
DiyaFontManager >> defaultFamily [
|
DiyaFontManager >> defaultFamily [
|
||||||
^'Ubuntu'
|
^'Ubuntu'
|
||||||
@ -59,7 +66,7 @@ DiyaFontManager >> loadFace: face [
|
|||||||
DiyaFontManager >> loadFile: aFile [
|
DiyaFontManager >> loadFile: aFile [
|
||||||
| path face i numfaces |
|
| path face i numfaces |
|
||||||
path := aFile fullName convertToWithConverter: UTF8TextConverter new.
|
path := aFile fullName convertToWithConverter: UTF8TextConverter new.
|
||||||
self stdlog: 'Loading font file ', path.
|
Transcript show: 'Loading font file ', path;cr.
|
||||||
i := 0.
|
i := 0.
|
||||||
numfaces := nil.
|
numfaces := nil.
|
||||||
[ face := FreeTypeFace basicNew
|
[ face := FreeTypeFace basicNew
|
||||||
@ -83,9 +90,7 @@ DiyaFontManager >> loadFonts [
|
|||||||
{ #category : #initialization }
|
{ #category : #initialization }
|
||||||
DiyaFontManager >> loadFonts: force [
|
DiyaFontManager >> loadFonts: force [
|
||||||
force ifTrue:[self reset].
|
force ifTrue:[self reset].
|
||||||
DiyaSystemSettings fontPaths
|
self class searchPaths do:[:path| self loadPath: path].
|
||||||
select:[:p| p asFileReference exists]
|
|
||||||
thenDo:[:path| self loadPath: path].
|
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
Class {
|
Class {
|
||||||
#name : #DiyaImageTex,
|
#name : #DiyaImageTex,
|
||||||
#superclass : #OpenGLTexImage2D,
|
#superclass : #OpenGLTexImage2D,
|
||||||
|
#instVars : [
|
||||||
|
'name'
|
||||||
|
],
|
||||||
#pools : [
|
#pools : [
|
||||||
'OpenGLConstants',
|
'OpenGLConstants',
|
||||||
'OpenGLTypes'
|
'OpenGLTypes'
|
||||||
@ -52,7 +55,6 @@ DiyaImageTex >> fromDisplay: aRect as: assetName [
|
|||||||
data ifNotNil: [data free].
|
data ifNotNil: [data free].
|
||||||
width := aRect extent x asInteger.
|
width := aRect extent x asInteger.
|
||||||
height := aRect extent y asInteger.
|
height := aRect extent y asInteger.
|
||||||
commited := false.
|
|
||||||
data := FFIExternalArray externalNewType: GLubyte size: self bytesSize.
|
data := FFIExternalArray externalNewType: GLubyte size: self bytesSize.
|
||||||
LibC memset: data getHandle value: 0 size: data size.
|
LibC memset: data getHandle value: 0 size: data size.
|
||||||
data autoRelease.
|
data autoRelease.
|
||||||
@ -87,7 +89,6 @@ DiyaImageTex >> fromFile: aPath [
|
|||||||
LibC memCopy: surface pixels getHandle to: data getHandle size: data size.
|
LibC memCopy: surface pixels getHandle to: data getHandle size: data size.
|
||||||
SDL2
|
SDL2
|
||||||
freeSurface: surface.
|
freeSurface: surface.
|
||||||
commited := false.
|
|
||||||
self stdlog: 'Loaded ', aPath fullName.
|
self stdlog: 'Loaded ', aPath fullName.
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -99,7 +100,6 @@ DiyaImageTex >> fromForm: aForm name: aName [
|
|||||||
surface := self surfaceFromForm: aForm.
|
surface := self surfaceFromForm: aForm.
|
||||||
width := surface w.
|
width := surface w.
|
||||||
height := surface h.
|
height := surface h.
|
||||||
commited := false.
|
|
||||||
data := FFIExternalArray externalNewType: GLubyte size: self bytesSize.
|
data := FFIExternalArray externalNewType: GLubyte size: self bytesSize.
|
||||||
LibC memset: data getHandle value: 0 size: data size.
|
LibC memset: data getHandle value: 0 size: data size.
|
||||||
data autoRelease.
|
data autoRelease.
|
||||||
@ -124,6 +124,11 @@ DiyaImageTex >> mipmap [
|
|||||||
^false
|
^false
|
||||||
]
|
]
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
DiyaImageTex >> name [
|
||||||
|
^ name
|
||||||
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
DiyaImageTex >> setup [
|
DiyaImageTex >> setup [
|
||||||
OpenGLTexture
|
OpenGLTexture
|
||||||
|
@ -94,8 +94,8 @@ DiyaLine >> process [
|
|||||||
at: 3 put: 0.0;
|
at: 3 put: 0.0;
|
||||||
at: 4 put: 0.0;
|
at: 4 put: 0.0;
|
||||||
|
|
||||||
at: 5 put: extent x asFloat;
|
at: 5 put: extent x;
|
||||||
at: 6 put: extent y asFloat;
|
at: 6 put: extent y;
|
||||||
at: 7 put: 0.0;
|
at: 7 put: 0.0;
|
||||||
at: 8 put: 0.0.
|
at: 8 put: 0.0.
|
||||||
^true
|
^true
|
||||||
|
@ -1,81 +0,0 @@
|
|||||||
Class {
|
|
||||||
#name : #DiyaLoader,
|
|
||||||
#superclass : #DiyaBaseObject,
|
|
||||||
#instVars : [
|
|
||||||
'node',
|
|
||||||
'jobs',
|
|
||||||
'target'
|
|
||||||
],
|
|
||||||
#category : #'Diya-Applications'
|
|
||||||
}
|
|
||||||
|
|
||||||
{ #category : #'instance creation' }
|
|
||||||
DiyaLoader class >> on: target [
|
|
||||||
^ self new target: target; yourself
|
|
||||||
]
|
|
||||||
|
|
||||||
{ #category : #scheduling }
|
|
||||||
DiyaLoader >> executeJobs: callback [
|
|
||||||
"target visibility: false."
|
|
||||||
target empty.
|
|
||||||
target addNode: node.
|
|
||||||
"target visibility: true".
|
|
||||||
node visibility: true.
|
|
||||||
self updateLayout.
|
|
||||||
500 milliSeconds wait.
|
|
||||||
self job: [ 500 milliSeconds wait. ] name: 'finishing' .
|
|
||||||
jobs withIndexDo: [ :job :i|
|
|
||||||
self updateProgress: job key percent: ((i - 1) * 100 / (jobs size)) asInteger.
|
|
||||||
job value value.
|
|
||||||
].
|
|
||||||
jobs := OrderedCollection new.
|
|
||||||
self updateProgress: 'Finishing...' percent: 100.
|
|
||||||
|
|
||||||
node visibility: false.
|
|
||||||
target empty.
|
|
||||||
callback value.
|
|
||||||
target visibility: true.
|
|
||||||
]
|
|
||||||
|
|
||||||
{ #category : #initialization }
|
|
||||||
DiyaLoader >> initialize [
|
|
||||||
super initialize.
|
|
||||||
node := DiyaCompositeNode new.
|
|
||||||
jobs := OrderedCollection new.
|
|
||||||
target := nil.
|
|
||||||
]
|
|
||||||
|
|
||||||
{ #category : #scheduling }
|
|
||||||
DiyaLoader >> job: aBlock name: aName [
|
|
||||||
jobs add: (aName -> aBlock)
|
|
||||||
]
|
|
||||||
|
|
||||||
{ #category : #accessing }
|
|
||||||
DiyaLoader >> node [
|
|
||||||
^ node
|
|
||||||
]
|
|
||||||
|
|
||||||
{ #category : #scheduling }
|
|
||||||
DiyaLoader >> onloaded: aBlock [
|
|
||||||
[ self executeJobs: aBlock ] fork"At: Processor userBackgroundPriority".
|
|
||||||
]
|
|
||||||
|
|
||||||
{ #category : #accessing }
|
|
||||||
DiyaLoader >> target [
|
|
||||||
^ target
|
|
||||||
]
|
|
||||||
|
|
||||||
{ #category : #accessing }
|
|
||||||
DiyaLoader >> target: anObject [
|
|
||||||
target := anObject
|
|
||||||
]
|
|
||||||
|
|
||||||
{ #category : #initialization }
|
|
||||||
DiyaLoader >> updateLayout [
|
|
||||||
self subclassResponsibility
|
|
||||||
]
|
|
||||||
|
|
||||||
{ #category : #scheduling }
|
|
||||||
DiyaLoader >> updateProgress: name percent: p [
|
|
||||||
self subclassResponsibility
|
|
||||||
]
|
|
@ -24,11 +24,6 @@ DiyaMetaNode >> extent [
|
|||||||
^ 0@0
|
^ 0@0
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #initialization }
|
|
||||||
DiyaMetaNode >> initialize [
|
|
||||||
visibility := false.
|
|
||||||
]
|
|
||||||
|
|
||||||
{ #category : #testing }
|
{ #category : #testing }
|
||||||
DiyaMetaNode >> inner: aPoint [
|
DiyaMetaNode >> inner: aPoint [
|
||||||
^ false
|
^ false
|
||||||
|
@ -14,7 +14,6 @@ Class {
|
|||||||
'root',
|
'root',
|
||||||
'styleName',
|
'styleName',
|
||||||
'style',
|
'style',
|
||||||
'inlineStyle',
|
|
||||||
'id',
|
'id',
|
||||||
'visibility',
|
'visibility',
|
||||||
'pivot'
|
'pivot'
|
||||||
@ -32,11 +31,9 @@ DiyaNode class >> with: shader [
|
|||||||
^self new shader: shader; yourself
|
^self new shader: shader; yourself
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #styling }
|
{ #category : #accessing }
|
||||||
DiyaNode >> ? styleAttr [
|
DiyaNode >> ? styleAttr [
|
||||||
| value|
|
| value|
|
||||||
value := inlineStyle at: styleAttr ifAbsent:[nil].
|
|
||||||
value ifNotNil: [ ^value ].
|
|
||||||
styleName ifNotNil: [
|
styleName ifNotNil: [
|
||||||
style ifNil: [
|
style ifNil: [
|
||||||
style := DiyaUIThemesManager uniqueInstance currentTheme ? (self styleName).
|
style := DiyaUIThemesManager uniqueInstance currentTheme ? (self styleName).
|
||||||
@ -49,12 +46,12 @@ DiyaNode >> ? styleAttr [
|
|||||||
^ parent ? styleAttr
|
^ parent ? styleAttr
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #'add/remove' }
|
{ #category : #accessing }
|
||||||
DiyaNode >> addNode: node [
|
DiyaNode >> addNode: node [
|
||||||
^self addNode: node at: 0@0
|
^self addNode: node at: 0@0
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #'add/remove' }
|
{ #category : #accessing }
|
||||||
DiyaNode >> addNode: node at: pos [
|
DiyaNode >> addNode: node at: pos [
|
||||||
children ifNil: [ ^self ].
|
children ifNil: [ ^self ].
|
||||||
node parent: self.
|
node parent: self.
|
||||||
@ -82,13 +79,6 @@ DiyaNode >> draw [
|
|||||||
|
|
||||||
{ #category : #requirements }
|
{ #category : #requirements }
|
||||||
DiyaNode >> empty [
|
DiyaNode >> empty [
|
||||||
children ifNotNil: [
|
|
||||||
children do:[:c|
|
|
||||||
c root: nil.
|
|
||||||
c setClean.
|
|
||||||
c visibility: false.
|
|
||||||
]
|
|
||||||
].
|
|
||||||
children := OrderedCollection new.
|
children := OrderedCollection new.
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -97,6 +87,15 @@ DiyaNode >> extent [
|
|||||||
^ self subclassResponsibility
|
^ self subclassResponsibility
|
||||||
]
|
]
|
||||||
|
|
||||||
|
{ #category : #processing }
|
||||||
|
DiyaNode >> forceReload [
|
||||||
|
self process.
|
||||||
|
children ifNotNil: [
|
||||||
|
children do:[:c|
|
||||||
|
c forceReload
|
||||||
|
]]
|
||||||
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
DiyaNode >> id [
|
DiyaNode >> id [
|
||||||
^ id
|
^ id
|
||||||
@ -107,23 +106,17 @@ DiyaNode >> initialize [
|
|||||||
super initialize.
|
super initialize.
|
||||||
parent := nil.
|
parent := nil.
|
||||||
shader := nil.
|
shader := nil.
|
||||||
context := DiyaRenderer.
|
context := DiyaRendererContext uniqueInstance.
|
||||||
children := OrderedCollection new.
|
children := OrderedCollection new.
|
||||||
ehandlers := Dictionary new.
|
ehandlers := Dictionary new.
|
||||||
styleName := nil.
|
styleName := nil.
|
||||||
style := nil.
|
style := nil.
|
||||||
root := nil.
|
root := nil.
|
||||||
inlineStyle := Dictionary new.
|
|
||||||
visibility := true.
|
visibility := true.
|
||||||
pivot := 0@0.
|
pivot := 0@0.
|
||||||
id := self className,'#',(Random new nextInt: 1e6) asString.
|
id := self className,'#',(Random new nextInt: 1e6) asString.
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #styling }
|
|
||||||
DiyaNode >> inlineStyle: name value: value [
|
|
||||||
inlineStyle at: name put: value
|
|
||||||
]
|
|
||||||
|
|
||||||
{ #category : #testing }
|
{ #category : #testing }
|
||||||
DiyaNode >> inner: aPoint [
|
DiyaNode >> inner: aPoint [
|
||||||
^ self subclassResponsibility
|
^ self subclassResponsibility
|
||||||
@ -181,16 +174,15 @@ DiyaNode >> register: aBlock to: eventName [
|
|||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #'add/remove' }
|
{ #category : #removing }
|
||||||
DiyaNode >> remove [
|
DiyaNode >> remove [
|
||||||
|
self setClean.
|
||||||
|
root := nil.
|
||||||
parent ifNotNil: [ parent removeChild: self ]
|
parent ifNotNil: [ parent removeChild: self ]
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #'add/remove' }
|
{ #category : #removing }
|
||||||
DiyaNode >> removeChild: c [
|
DiyaNode >> removeChild: c [
|
||||||
c setClean.
|
|
||||||
c root: nil.
|
|
||||||
c visibility: false.
|
|
||||||
children ifNotNil: [ children remove: c ifAbsent:[ ]]
|
children ifNotNil: [ children remove: c ifAbsent:[ ]]
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -200,21 +192,7 @@ DiyaNode >> render [
|
|||||||
shader ifNotNil: [self setUpShader].
|
shader ifNotNil: [self setUpShader].
|
||||||
self draw.
|
self draw.
|
||||||
children ifNil: [ ^self ].
|
children ifNil: [ ^self ].
|
||||||
root ifNil: [ ^self ].
|
children do: [:c| c render ].
|
||||||
root renderNext: children
|
|
||||||
]
|
|
||||||
|
|
||||||
{ #category : #'add/remove' }
|
|
||||||
DiyaNode >> replaceChild: aNode with: anotherNode [
|
|
||||||
|index|
|
|
||||||
children ifNil: [ ^ self ].
|
|
||||||
index := children indexOf: aNode.
|
|
||||||
index = 0 ifTrue:[^ self].
|
|
||||||
children at: index put: anotherNode.
|
|
||||||
anotherNode parent: self.
|
|
||||||
anotherNode root: self root.
|
|
||||||
anotherNode setDirtyAll.
|
|
||||||
aNode root: nil.
|
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
@ -284,9 +262,10 @@ DiyaNode >> setUpShader [
|
|||||||
|mem|
|
|mem|
|
||||||
mem := self tf asGLBuffer.
|
mem := self tf asGLBuffer.
|
||||||
shader use;
|
shader use;
|
||||||
setUniform: #u_time value: DiyaSystemClock elapsedTime asFloat;
|
setUniform: #u_time value: DiyaClock uniqueInstance elapsedTime asFloat;
|
||||||
setUniform: #u_projection value: {GL_FALSE. context projection buffer};
|
setUniform: #u_projection value: {GL_FALSE. context projection buffer};
|
||||||
setUniform: #u_resolution value: { context resolution x. context resolution y };
|
setUniform: #u_resolution value: { context resolution x. context resolution y };
|
||||||
|
setUniform: #u_texture value: 0;
|
||||||
setUniform: #u_transform value: {GL_TRUE. mem}.
|
setUniform: #u_transform value: {GL_TRUE. mem}.
|
||||||
context mouse ifNotNil: [
|
context mouse ifNotNil: [
|
||||||
"in shader, window origin is bottom left conor of the window
|
"in shader, window origin is bottom left conor of the window
|
||||||
@ -350,6 +329,7 @@ DiyaNode >> trigger: evt [
|
|||||||
handler value: evt].
|
handler value: evt].
|
||||||
children ifNil: [^self].
|
children ifNil: [^self].
|
||||||
evt enable ifTrue: [
|
evt enable ifTrue: [
|
||||||
|
"evt mapped triggableOn: children first."
|
||||||
children select: [:node | evt mapped triggableOn: node ] thenDo:[:node| node trigger: evt]
|
children select: [:node | evt mapped triggableOn: node ] thenDo:[:node| node trigger: evt]
|
||||||
].
|
].
|
||||||
]
|
]
|
||||||
@ -366,7 +346,5 @@ DiyaNode >> visibility [
|
|||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
DiyaNode >> visibility: anObject [
|
DiyaNode >> visibility: anObject [
|
||||||
visibility := anObject.
|
visibility := anObject
|
||||||
children ifNotNil: [
|
|
||||||
children do:[:c| c visibility: anObject ] ]
|
|
||||||
]
|
]
|
||||||
|
@ -16,7 +16,7 @@ DiyaRectangle class >> size: size shader:s [
|
|||||||
|
|
||||||
{ #category : #initialization }
|
{ #category : #initialization }
|
||||||
DiyaRectangle >> drawLines [
|
DiyaRectangle >> drawLines [
|
||||||
OpenGL drawArrays: GL_LINE_LOOP first:0 count: (vbuffer size >> 2).
|
OpenGL drawArrays: GL_LINE_LOOP first:voffset count: (vbuffer size >> 2).
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -47,16 +47,16 @@ DiyaRectangle >> process [
|
|||||||
at: 4 put: 0.0;
|
at: 4 put: 0.0;
|
||||||
|
|
||||||
at: 5 put: 0.0;
|
at: 5 put: 0.0;
|
||||||
at: 6 put: extent y asFloat;
|
at: 6 put: extent y;
|
||||||
at: 7 put: 0.0;
|
at: 7 put: 0.0;
|
||||||
at: 8 put: 1.0;
|
at: 8 put: 1.0;
|
||||||
|
|
||||||
at: 9 put: extent x asFloat;
|
at: 9 put: extent x;
|
||||||
at: 10 put: extent y asFloat;
|
at: 10 put: extent y;
|
||||||
at: 11 put: 1.0;
|
at: 11 put: 1.0;
|
||||||
at: 12 put: 1.0;
|
at: 12 put: 1.0;
|
||||||
|
|
||||||
at: 13 put: extent x asFloat;
|
at: 13 put: extent x;
|
||||||
at: 14 put: 0.0;
|
at: 14 put: 0.0;
|
||||||
at: 15 put: 1.0;
|
at: 15 put: 1.0;
|
||||||
at: 16 put: 0.0.
|
at: 16 put: 0.0.
|
||||||
|
@ -6,12 +6,12 @@ Class {
|
|||||||
'display',
|
'display',
|
||||||
'vbo',
|
'vbo',
|
||||||
'vao',
|
'vao',
|
||||||
'textures',
|
'texture0',
|
||||||
'projection',
|
'projection',
|
||||||
'assets',
|
'assets',
|
||||||
'window',
|
'window',
|
||||||
'root',
|
'vbuffer',
|
||||||
'lock'
|
'voffset'
|
||||||
],
|
],
|
||||||
#pools : [
|
#pools : [
|
||||||
'OpenGLConstants',
|
'OpenGLConstants',
|
||||||
@ -20,6 +20,11 @@ Class {
|
|||||||
#category : #'Diya-Graphics'
|
#category : #'Diya-Graphics'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
DiyaRendererContext class >> bufferSize [
|
||||||
|
^ 524288 "512Kb"
|
||||||
|
]
|
||||||
|
|
||||||
{ #category : #'instance creation' }
|
{ #category : #'instance creation' }
|
||||||
DiyaRendererContext class >> cleanUpInstance: singleton [
|
DiyaRendererContext class >> cleanUpInstance: singleton [
|
||||||
singleton ifNil:[^self].
|
singleton ifNil:[^self].
|
||||||
@ -31,11 +36,6 @@ DiyaRendererContext class >> maxFloatBufferSize [
|
|||||||
^4096
|
^4096
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
|
||||||
DiyaRendererContext class >> maxTextureNumber [
|
|
||||||
^ 32
|
|
||||||
]
|
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
DiyaRendererContext >> assets [
|
DiyaRendererContext >> assets [
|
||||||
^ assets
|
^ assets
|
||||||
@ -47,12 +47,17 @@ DiyaRendererContext >> assets: anObject [
|
|||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
DiyaRendererContext >> destroy [
|
DiyaRendererContext >> destroy [
|
||||||
vao disableAttribute: 0.
|
self disableGLAttribute: 0.
|
||||||
|
vbuffer free.
|
||||||
vao delete.
|
vao delete.
|
||||||
vbo delete.
|
vbo delete.
|
||||||
textures do: [:e | e key delete ].
|
texture0 delete.
|
||||||
textures := OrderedCollection new.
|
]
|
||||||
|
|
||||||
|
{ #category : #registration }
|
||||||
|
DiyaRendererContext >> disableGLAttribute: attribute [
|
||||||
|
vao disableAttribute: attribute
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
@ -65,13 +70,9 @@ DiyaRendererContext >> display: anObject [
|
|||||||
display := anObject
|
display := anObject
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #rendering }
|
{ #category : #registration }
|
||||||
DiyaRendererContext >> findTextureUnit [
|
DiyaRendererContext >> enableGLAttribute: attribute [
|
||||||
textures withIndexDo: [ :e :i|
|
vao enableAttribute: attribute.
|
||||||
e value ifNil: [ ^ i - 1]
|
|
||||||
].
|
|
||||||
"random unit value"
|
|
||||||
^ (Random new nextInt: self class maxTextureNumber) - 1
|
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
@ -79,28 +80,19 @@ DiyaRendererContext >> initialize [
|
|||||||
super initialize.
|
super initialize.
|
||||||
vbo := OpenGLVertexBuffer new.
|
vbo := OpenGLVertexBuffer new.
|
||||||
vao := OpenGLVertexArray new.
|
vao := OpenGLVertexArray new.
|
||||||
textures := Dictionary new.
|
texture0 := OpenGLTexture fromUnit: 0.
|
||||||
lock := Mutex new.
|
|
||||||
vao bind.
|
vao bind.
|
||||||
vbo bind: GL_ARRAY_BUFFER.
|
vbo bind: GL_ARRAY_BUFFER.
|
||||||
projection := Array2D identity: 4.
|
projection := Array2D identity: 4.
|
||||||
assets := AssetManager new.
|
assets := AssetManager new.
|
||||||
vao enableAttribute: 0.
|
"allocate vbuffer"
|
||||||
OpenGLVertexArray
|
vbuffer := FFIExternalArray externalNewType: GLfloat size: self class bufferSize.
|
||||||
vertexAttributePointerIndex: 0
|
vbuffer autoRelease.
|
||||||
size:4
|
voffset := 0.
|
||||||
type: GL_FLOAT
|
vbo data: GL_ARRAY_BUFFER data: vbuffer usage: GL_STREAM_DRAW.
|
||||||
normalized: GL_FALSE
|
self enableGLAttribute: 0.
|
||||||
stride: 16
|
OpenGLVertexArray vertexAttributePointerIndex: 0 size:4 type: GL_FLOAT normalized: GL_FALSE stride: 16 pointer: nil.
|
||||||
pointer: nil.
|
|
||||||
textures :=
|
|
||||||
(1 to: self class maxTextureNumber ) collect:[:i|
|
|
||||||
(OpenGLTexture fromUnit: i - 1) -> nil] .
|
|
||||||
]
|
|
||||||
|
|
||||||
{ #category : #accessing }
|
|
||||||
DiyaRendererContext >> lock [
|
|
||||||
^ lock
|
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
@ -118,12 +110,9 @@ DiyaRendererContext >> projection [
|
|||||||
^ projection
|
^ projection
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #rendering }
|
{ #category : #registration }
|
||||||
DiyaRendererContext >> render [
|
DiyaRendererContext >> resetBuffer [
|
||||||
root render.
|
voffset := 0
|
||||||
root readyForSwap ifTrue: [
|
|
||||||
SDL2 glSwapWindow: window.
|
|
||||||
]
|
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
@ -131,41 +120,54 @@ DiyaRendererContext >> resolution [
|
|||||||
^ (display w) @ (display h)
|
^ (display w) @ (display h)
|
||||||
]
|
]
|
||||||
|
|
||||||
|
{ #category : #registration }
|
||||||
|
DiyaRendererContext >> setTexture: texture [
|
||||||
|
texture setup.
|
||||||
|
texture0 setImage2D: texture.
|
||||||
|
texture0 active.
|
||||||
|
]
|
||||||
|
|
||||||
|
{ #category : #registration }
|
||||||
|
DiyaRendererContext >> submitData: data [
|
||||||
|
|n|
|
||||||
|
n := self voffset.
|
||||||
|
voffset := voffset + (data size << 2).
|
||||||
|
voffset > self class bufferSize ifTrue:[
|
||||||
|
^ DiyaCoreAPIError signal: 'Out of video buffer memory'
|
||||||
|
].
|
||||||
|
vbo subData: GL_ARRAY_BUFFER offset: n data: data.
|
||||||
|
^ (n >> 4)
|
||||||
|
|
||||||
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
DiyaRendererContext >> root [
|
DiyaRendererContext >> texture0 [
|
||||||
root ifNil: [ root := DiyaRootNode new ].
|
^ texture0
|
||||||
^ root
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #rendering }
|
{ #category : #registration }
|
||||||
DiyaRendererContext >> submitData: vbuffer [
|
|
||||||
vbo data: GL_ARRAY_BUFFER data: vbuffer usage: GL_STATIC_DRAW.
|
|
||||||
]
|
|
||||||
|
|
||||||
{ #category : #'transformation matrices' }
|
|
||||||
DiyaRendererContext >> useProjection: aClass [
|
DiyaRendererContext >> useProjection: aClass [
|
||||||
projection := aClass fromDisplay: self display
|
projection := aClass fromDisplay: self display
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #rendering }
|
{ #category : #accessing }
|
||||||
DiyaRendererContext >> useTexture: aTexture [
|
DiyaRendererContext >> vao [
|
||||||
|assoc|
|
^ vao
|
||||||
aTexture unit == -1 ifTrue:[ aTexture unit: self findTextureUnit].
|
]
|
||||||
assoc := textures at: aTexture unit + 1.
|
|
||||||
assoc value = aTexture ifFalse:[
|
{ #category : #accessing }
|
||||||
"unregister current texture"
|
DiyaRendererContext >> vbo [
|
||||||
assoc value ifNotNil: [ assoc value commited: false ].
|
^ vbo
|
||||||
aTexture commited: false.
|
]
|
||||||
assoc value: aTexture.
|
|
||||||
].
|
{ #category : #accessing }
|
||||||
assoc key active.
|
DiyaRendererContext >> vbuffer [
|
||||||
aTexture commited ifTrue:[ ^ self ].
|
^ vbuffer
|
||||||
"self stdlog: 'Commit data data to texture ', aTexture name, ' on Unit ', aTexture unit asString."
|
]
|
||||||
assoc key setImage2D: aTexture.
|
|
||||||
aTexture commited: true.
|
{ #category : #accessing }
|
||||||
|
DiyaRendererContext >> voffset [
|
||||||
|
^ voffset
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
|
@ -2,12 +2,16 @@ Class {
|
|||||||
#name : #DiyaRootNode,
|
#name : #DiyaRootNode,
|
||||||
#superclass : #DiyaNode,
|
#superclass : #DiyaNode,
|
||||||
#instVars : [
|
#instVars : [
|
||||||
'Q',
|
'Q'
|
||||||
'R'
|
|
||||||
],
|
],
|
||||||
#category : #'Diya-Graphics'
|
#category : #'Diya-Graphics'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
DiyaRootNode >> Q [
|
||||||
|
^ Q
|
||||||
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
DiyaRootNode >> boundingBox [
|
DiyaRootNode >> boundingBox [
|
||||||
^ Rectangle origin: 0@0 corner: context resolution
|
^ Rectangle origin: 0@0 corner: context resolution
|
||||||
@ -21,14 +25,16 @@ DiyaRootNode >> cleanDirtyNode: aNode [
|
|||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
DiyaRootNode >> draw [
|
DiyaRootNode >> draw [
|
||||||
|c|
|
|c|
|
||||||
|
context resetBuffer.
|
||||||
c := self ? #bgColor.
|
c := self ? #bgColor.
|
||||||
OpenGL clearColorR: c red G: c green B: c blue A: c alpha.
|
OpenGL clearColorR: c red G: c green B: c blue A: c alpha.
|
||||||
OpenGL clear: GL_COLOR_BUFFER_BIT.
|
OpenGL clear: GL_COLOR_BUFFER_BIT.
|
||||||
|
"context vbo bind: GL_ARRAY_BUFFER."
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #'add/remove' }
|
{ #category : #'add/remove' }
|
||||||
DiyaRootNode >> enqueueDirtyNode: aNode [
|
DiyaRootNode >> enqueueDirtyNode: aNode [
|
||||||
Q addIfNotPresent: aNode
|
(Q includes: aNode ) ifFalse:[ Q add: aNode].
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
@ -43,8 +49,7 @@ DiyaRootNode >> initialize [
|
|||||||
shader := nil.
|
shader := nil.
|
||||||
root := self.
|
root := self.
|
||||||
styleName := #global.
|
styleName := #global.
|
||||||
Q := OrderedCollection new.
|
Q := OrderedCollection new
|
||||||
R := OrderedCollection new.
|
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
@ -62,35 +67,11 @@ DiyaRootNode >> process [
|
|||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #controlling }
|
{ #category : #accessing }
|
||||||
DiyaRootNode >> processQueue [
|
DiyaRootNode >> processingQueue [
|
||||||
^ Q
|
^ Q
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #testing }
|
|
||||||
DiyaRootNode >> readyForSwap [
|
|
||||||
^ R isEmpty
|
|
||||||
]
|
|
||||||
|
|
||||||
{ #category : #rendering }
|
|
||||||
DiyaRootNode >> render [
|
|
||||||
| maxProcessingTime|
|
|
||||||
self stepDown.
|
|
||||||
R ifEmpty: [
|
|
||||||
self draw.
|
|
||||||
self renderNext: children
|
|
||||||
].
|
|
||||||
maxProcessingTime := (1000 / DiyaSystemSettings maxFPS) asInteger.
|
|
||||||
[
|
|
||||||
self spinOnce: maxProcessingTime
|
|
||||||
] whileTrue
|
|
||||||
]
|
|
||||||
|
|
||||||
{ #category : #rendering }
|
|
||||||
DiyaRootNode >> renderNext: nodes [
|
|
||||||
R addAllFirstUnlessAlreadyPresent: nodes.
|
|
||||||
]
|
|
||||||
|
|
||||||
{ #category : #initialization }
|
{ #category : #initialization }
|
||||||
DiyaRootNode >> setClean [
|
DiyaRootNode >> setClean [
|
||||||
|
|
||||||
@ -104,24 +85,6 @@ DiyaRootNode >> setDirty [
|
|||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #rendering }
|
|
||||||
DiyaRootNode >> spinOnce: maxProcessingTime [
|
|
||||||
|node|
|
|
||||||
Q ifNotEmpty: [
|
|
||||||
node := Q removeFirst.
|
|
||||||
node process.
|
|
||||||
"context lock critical: [node process]."
|
|
||||||
].
|
|
||||||
R ifNotEmpty: [
|
|
||||||
node := R removeFirst.
|
|
||||||
node render.
|
|
||||||
"context lock critical: [node render]. "
|
|
||||||
].
|
|
||||||
(Q isEmpty and: R isEmpty) ifTrue: [ ^false ].
|
|
||||||
DiyaSystemSettings renderAtOnce ifTrue: [ ^ true ].
|
|
||||||
^(DiyaSystemClock lapDelta < maxProcessingTime)
|
|
||||||
]
|
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
DiyaRootNode >> updateTF [
|
DiyaRootNode >> updateTF [
|
||||||
"donothing"
|
"donothing"
|
||||||
|
@ -1,90 +0,0 @@
|
|||||||
Class {
|
|
||||||
#name : #DiyaSettings,
|
|
||||||
#superclass : #DiyaSingleton,
|
|
||||||
#instVars : [
|
|
||||||
'maxFPS',
|
|
||||||
'fontPaths',
|
|
||||||
'assetPath',
|
|
||||||
'renderAtOnce'
|
|
||||||
],
|
|
||||||
#category : #'Diya-Core'
|
|
||||||
}
|
|
||||||
|
|
||||||
{ #category : #'as yet unclassified' }
|
|
||||||
DiyaSettings class >> defaultSettingFile [
|
|
||||||
^ Smalltalk imageDirectory / 'settings.json'
|
|
||||||
]
|
|
||||||
|
|
||||||
{ #category : #accessing }
|
|
||||||
DiyaSettings >> assetPath [
|
|
||||||
^ assetPath
|
|
||||||
]
|
|
||||||
|
|
||||||
{ #category : #accessing }
|
|
||||||
DiyaSettings >> assetPath: anObject [
|
|
||||||
assetPath := anObject
|
|
||||||
]
|
|
||||||
|
|
||||||
{ #category : #accessing }
|
|
||||||
DiyaSettings >> fontPaths [
|
|
||||||
^ fontPaths
|
|
||||||
]
|
|
||||||
|
|
||||||
{ #category : #accessing }
|
|
||||||
DiyaSettings >> fontPaths: anObject [
|
|
||||||
fontPaths := anObject
|
|
||||||
]
|
|
||||||
|
|
||||||
{ #category : #initialization }
|
|
||||||
DiyaSettings >> initialize [
|
|
||||||
super initialize.
|
|
||||||
maxFPS := 60.
|
|
||||||
renderAtOnce := false.
|
|
||||||
fontPaths := { Smalltalk imageDirectory / 'fonts' }.
|
|
||||||
assetPath := Smalltalk imageDirectory / 'assets'.
|
|
||||||
self loadFromFile.
|
|
||||||
self logSettings
|
|
||||||
]
|
|
||||||
|
|
||||||
{ #category : #initialization }
|
|
||||||
DiyaSettings >> loadFromFile [
|
|
||||||
|d v|
|
|
||||||
self class defaultSettingFile exists ifFalse: [
|
|
||||||
self stderror: 'Setting file not found. Using default settings'.
|
|
||||||
^self
|
|
||||||
].
|
|
||||||
d := STON fromStream: self class defaultSettingFile readStream.
|
|
||||||
maxFPS := d at:'max_fps' ifAbsent:[maxFPS].
|
|
||||||
v := d at:'asset_dir' ifAbsent:[nil].
|
|
||||||
v ifNotNil: [ assetPath := v ].
|
|
||||||
renderAtOnce := d at: 'render_all_at_once' ifAbsent:[renderAtOnce ].
|
|
||||||
fontPaths := fontPaths , (d at:'font_dirs' ifAbsent:[#()]).
|
|
||||||
]
|
|
||||||
|
|
||||||
{ #category : #initialization }
|
|
||||||
DiyaSettings >> logSettings [
|
|
||||||
self stdlog: 'max_fps = ', maxFPS asString.
|
|
||||||
self stdlog: 'font_dirs = ', fontPaths asString.
|
|
||||||
self stdlog: 'asset_dir = ', assetPath asString.
|
|
||||||
self stdlog: 'render_all_at_once = ', renderAtOnce asString.
|
|
||||||
]
|
|
||||||
|
|
||||||
{ #category : #accessing }
|
|
||||||
DiyaSettings >> maxFPS [
|
|
||||||
^ maxFPS
|
|
||||||
]
|
|
||||||
|
|
||||||
{ #category : #accessing }
|
|
||||||
DiyaSettings >> maxFPS: anObject [
|
|
||||||
maxFPS := anObject
|
|
||||||
]
|
|
||||||
|
|
||||||
{ #category : #accessing }
|
|
||||||
DiyaSettings >> renderAtOnce [
|
|
||||||
^ renderAtOnce
|
|
||||||
]
|
|
||||||
|
|
||||||
{ #category : #accessing }
|
|
||||||
DiyaSettings >> renderAtOnce: anObject [
|
|
||||||
renderAtOnce := anObject
|
|
||||||
]
|
|
@ -25,7 +25,7 @@ DiyaSingleton class >> new [
|
|||||||
{ #category : #'instance creation' }
|
{ #category : #'instance creation' }
|
||||||
DiyaSingleton class >> reset [
|
DiyaSingleton class >> reset [
|
||||||
|singleton key|
|
|singleton key|
|
||||||
key := self class.
|
key := self class asString asSymbol.
|
||||||
singleton := singletons at: key ifAbsent: [ ^ self ].
|
singleton := singletons at: key ifAbsent: [ ^ self ].
|
||||||
self cleanUpInstance: singleton.
|
self cleanUpInstance: singleton.
|
||||||
singletons removeKey: key
|
singletons removeKey: key
|
||||||
@ -38,7 +38,7 @@ DiyaSingleton class >> resetAll [
|
|||||||
|
|
||||||
{ #category : #'instance creation' }
|
{ #category : #'instance creation' }
|
||||||
DiyaSingleton class >> uniqueInstance [
|
DiyaSingleton class >> uniqueInstance [
|
||||||
^singletons at: self class ifAbsentPut: [ super new ].
|
^singletons at: self class asString asSymbol ifAbsentPut: [ super new ].
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #initialization }
|
{ #category : #initialization }
|
||||||
|
@ -206,6 +206,9 @@ DiyaText >> process [
|
|||||||
data ifNil:[^true].
|
data ifNil:[^true].
|
||||||
data ifEmpty:[^true].
|
data ifEmpty:[^true].
|
||||||
texture ifNil: [ self initTexture ].
|
texture ifNil: [ self initTexture ].
|
||||||
|
texheight = texture height ifFalse: [
|
||||||
|
texheight := texture height.
|
||||||
|
].
|
||||||
vbuffer ifNotNil: [vbuffer free].
|
vbuffer ifNotNil: [vbuffer free].
|
||||||
vbuffer := FFIExternalArray externalNewType: GLfloat size: data size * 16.
|
vbuffer := FFIExternalArray externalNewType: GLfloat size: data size * 16.
|
||||||
vbuffer autoRelease.
|
vbuffer autoRelease.
|
||||||
@ -227,14 +230,6 @@ DiyaText >> splitLines [
|
|||||||
] whileTrue.
|
] whileTrue.
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #stepping }
|
|
||||||
DiyaText >> step [
|
|
||||||
texture ifNil: [ ^self ].
|
|
||||||
texheight = texture height ifTrue: [ ^self].
|
|
||||||
texheight := texture height.
|
|
||||||
self setDirty
|
|
||||||
]
|
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
DiyaText >> styleName: aName [
|
DiyaText >> styleName: aName [
|
||||||
super styleName: aName.
|
super styleName: aName.
|
||||||
|
@ -26,7 +26,7 @@ DiyaTimerNode class >> timeout: ms doOnce: aBlock [
|
|||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
DiyaTimerNode >> delta [
|
DiyaTimerNode >> delta [
|
||||||
^ DiyaSystemClock delta
|
^ DiyaClock uniqueInstance delta asMilliSeconds
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
|
@ -62,6 +62,7 @@ Class {
|
|||||||
'GL_SRC_ALPHA',
|
'GL_SRC_ALPHA',
|
||||||
'GL_STATIC_DRAW',
|
'GL_STATIC_DRAW',
|
||||||
'GL_STENCIL_BUFFER_BIT',
|
'GL_STENCIL_BUFFER_BIT',
|
||||||
|
'GL_STREAM_DRAW',
|
||||||
'GL_TESS_CONTROL_SHADER',
|
'GL_TESS_CONTROL_SHADER',
|
||||||
'GL_TESS_EVALUATION_SHADER',
|
'GL_TESS_EVALUATION_SHADER',
|
||||||
'GL_TEXTURE_2D',
|
'GL_TEXTURE_2D',
|
||||||
@ -108,6 +109,7 @@ OpenGLConstants class >> initCommonConstants [
|
|||||||
GL_UNIFORM_BUFFER := 16r8A11.
|
GL_UNIFORM_BUFFER := 16r8A11.
|
||||||
GL_STATIC_DRAW := 16r88E4.
|
GL_STATIC_DRAW := 16r88E4.
|
||||||
GL_DYNAMIC_DRAW := 16r88E8.
|
GL_DYNAMIC_DRAW := 16r88E8.
|
||||||
|
GL_STREAM_DRAW := 16r88E0.
|
||||||
GL_FALSE := 0.
|
GL_FALSE := 0.
|
||||||
GL_TRUE := 1.
|
GL_TRUE := 1.
|
||||||
GL_ARRAY_BUFFER_BINDING := 16r8894.
|
GL_ARRAY_BUFFER_BINDING := 16r8894.
|
||||||
|
@ -26,7 +26,7 @@ OpenGLFontTex class >> fromFace: face ofSize: size [
|
|||||||
^self new fromFace: face ofSize: size; yourself
|
^self new fromFace: face ofSize: size; yourself
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #processing }
|
{ #category : #'instance creation' }
|
||||||
OpenGLFontTex >> blitPixel8: bitmap at: offset size: size [
|
OpenGLFontTex >> blitPixel8: bitmap at: offset size: size [
|
||||||
size = (0@0) ifTrue:[^self].
|
size = (0@0) ifTrue:[^self].
|
||||||
0 to: size y - 1 do: [ :i|
|
0 to: size y - 1 do: [ :i|
|
||||||
@ -52,9 +52,9 @@ OpenGLFontTex >> charmap [
|
|||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
OpenGLFontTex >> drop [
|
OpenGLFontTex >> drop [
|
||||||
OpenGL
|
OpenGL
|
||||||
pixelstorei: GL_UNPACK_ALIGNMENT param: 4";
|
pixelstorei: GL_UNPACK_ALIGNMENT param: 4;
|
||||||
disable: GL_CULL_FACE;
|
disable: GL_CULL_FACE;
|
||||||
disable: GL_BLEND".
|
disable: GL_BLEND.
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
@ -67,8 +67,6 @@ OpenGLFontTex >> fromFace: aFace ofSize: size [
|
|||||||
|minhang rec iptr charcode w numw|
|
|minhang rec iptr charcode w numw|
|
||||||
fontSize := size.
|
fontSize := size.
|
||||||
face := aFace.
|
face := aFace.
|
||||||
commited := false.
|
|
||||||
name := aFace familyName, '@', aFace styleName,'@', size asString.
|
|
||||||
charmap := Dictionary new.
|
charmap := Dictionary new.
|
||||||
face setPixelWidth:0 height: self fontSize.
|
face setPixelWidth:0 height: self fontSize.
|
||||||
cellw := cellh := minhang := maxbearing := 0.
|
cellw := cellh := minhang := maxbearing := 0.
|
||||||
@ -102,7 +100,7 @@ OpenGLFontTex >> fromFace: aFace ofSize: size [
|
|||||||
iptr free.
|
iptr free.
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #processing }
|
{ #category : #accessing }
|
||||||
OpenGLFontTex >> genGlyph:c [
|
OpenGLFontTex >> genGlyph:c [
|
||||||
|rec offset glyph gsize|
|
|rec offset glyph gsize|
|
||||||
face setPixelWidth:0 height: self fontSize.
|
face setPixelWidth:0 height: self fontSize.
|
||||||
@ -124,20 +122,13 @@ OpenGLFontTex >> genGlyph:c [
|
|||||||
self reallocateBuffer.
|
self reallocateBuffer.
|
||||||
].
|
].
|
||||||
].
|
].
|
||||||
commited := false.
|
|
||||||
^glyph
|
^glyph
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #processing }
|
|
||||||
OpenGLFontTex >> genPrintableASCII [
|
|
||||||
33 to: 126 do: [ :c| self genGlyph: c ]
|
|
||||||
]
|
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
OpenGLFontTex >> getGlyph: c [
|
OpenGLFontTex >> getGlyph: c [
|
||||||
^(self charmap at: c ifAbsentPut:[
|
^(self charmap at: c ifAbsentPut:[self genGlyph:c])
|
||||||
self genGlyph:c])
|
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #initialization }
|
{ #category : #initialization }
|
||||||
@ -165,7 +156,7 @@ OpenGLFontTex >> meanww [
|
|||||||
^ meanww
|
^ meanww
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #processing }
|
{ #category : #accessing }
|
||||||
OpenGLFontTex >> reallocateBuffer [
|
OpenGLFontTex >> reallocateBuffer [
|
||||||
|newbuffer|
|
|newbuffer|
|
||||||
maxrows := maxrows + 4.
|
maxrows := maxrows + 4.
|
||||||
@ -178,12 +169,12 @@ OpenGLFontTex >> reallocateBuffer [
|
|||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #initialization }
|
{ #category : #accessing }
|
||||||
OpenGLFontTex >> setup [
|
OpenGLFontTex >> setup [
|
||||||
OpenGL
|
OpenGL
|
||||||
"enable: GL_CULL_FACE;
|
enable: GL_CULL_FACE;
|
||||||
enable: GL_BLEND;
|
enable: GL_BLEND;
|
||||||
blendFnWithSfactor: GL_SRC_ALPHA dfactor: GL_ONE_MINUS_SRC_ALPHA;"
|
blendFnWithSfactor: GL_SRC_ALPHA dfactor: GL_ONE_MINUS_SRC_ALPHA;
|
||||||
pixelstorei: GL_UNPACK_ALIGNMENT param: 1.
|
pixelstorei: GL_UNPACK_ALIGNMENT param: 1.
|
||||||
OpenGLTexture
|
OpenGLTexture
|
||||||
parameteri: GL_TEXTURE_2D pname: GL_TEXTURE_WRAP_S param: GL_CLAMP_TO_EDGE;
|
parameteri: GL_TEXTURE_2D pname: GL_TEXTURE_WRAP_S param: GL_CLAMP_TO_EDGE;
|
||||||
|
@ -10,10 +10,7 @@ Class {
|
|||||||
'border',
|
'border',
|
||||||
'format',
|
'format',
|
||||||
'type',
|
'type',
|
||||||
'data',
|
'data'
|
||||||
'unit',
|
|
||||||
'commited',
|
|
||||||
'name'
|
|
||||||
],
|
],
|
||||||
#pools : [
|
#pools : [
|
||||||
'OpenGLConstants',
|
'OpenGLConstants',
|
||||||
@ -37,16 +34,6 @@ OpenGLTexImage2D >> bytesSize [
|
|||||||
^(width * height) << 2
|
^(width * height) << 2
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
|
||||||
OpenGLTexImage2D >> commited [
|
|
||||||
^ commited
|
|
||||||
]
|
|
||||||
|
|
||||||
{ #category : #accessing }
|
|
||||||
OpenGLTexImage2D >> commited: anObject [
|
|
||||||
commited := anObject
|
|
||||||
]
|
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
OpenGLTexImage2D >> data [
|
OpenGLTexImage2D >> data [
|
||||||
^ data
|
^ data
|
||||||
@ -100,13 +87,6 @@ OpenGLTexImage2D >> height: anObject [
|
|||||||
height := anObject
|
height := anObject
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #initialization }
|
|
||||||
OpenGLTexImage2D >> initialize [
|
|
||||||
super initialize.
|
|
||||||
unit := -1.
|
|
||||||
commited := false
|
|
||||||
]
|
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
OpenGLTexImage2D >> internalFormat [
|
OpenGLTexImage2D >> internalFormat [
|
||||||
^ internalFormat
|
^ internalFormat
|
||||||
@ -132,11 +112,6 @@ OpenGLTexImage2D >> mipmap [
|
|||||||
^false
|
^false
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
|
||||||
OpenGLTexImage2D >> name [
|
|
||||||
^ name
|
|
||||||
]
|
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
OpenGLTexImage2D >> setup [
|
OpenGLTexImage2D >> setup [
|
||||||
^self subclassResponsibility
|
^self subclassResponsibility
|
||||||
@ -162,16 +137,6 @@ OpenGLTexImage2D >> type: anObject [
|
|||||||
type := anObject
|
type := anObject
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
|
||||||
OpenGLTexImage2D >> unit [
|
|
||||||
^ unit
|
|
||||||
]
|
|
||||||
|
|
||||||
{ #category : #accessing }
|
|
||||||
OpenGLTexImage2D >> unit: anObject [
|
|
||||||
unit := anObject
|
|
||||||
]
|
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
OpenGLTexImage2D >> width [
|
OpenGLTexImage2D >> width [
|
||||||
^ width
|
^ width
|
||||||
|
@ -26,7 +26,7 @@ OpenGLVertexBuffer class >> deleteBuffersSize:n buffers: buffers [
|
|||||||
^self ffiCall: #(void glDeleteBuffers( GLsizei n,const GLuint * buffers))
|
^self ffiCall: #(void glDeleteBuffers( GLsizei n,const GLuint * buffers))
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #'as yet unclassified' }
|
{ #category : #'library path' }
|
||||||
OpenGLVertexBuffer class >> ffiLibraryName [
|
OpenGLVertexBuffer class >> ffiLibraryName [
|
||||||
^ OpenGL ffiLibraryName
|
^ OpenGL ffiLibraryName
|
||||||
]
|
]
|
||||||
@ -51,24 +51,24 @@ OpenGLVertexBuffer class >> subData:target offset: offset size: size data: data
|
|||||||
^self ffiCall: #(void glBufferSubData(GLenum target,GLintptr offset,GLsizeiptr size,const void * data))
|
^self ffiCall: #(void glBufferSubData(GLenum target,GLintptr offset,GLsizeiptr size,const void * data))
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #initialization }
|
{ #category : #'as yet unclassified' }
|
||||||
OpenGLVertexBuffer >> bind: target [
|
OpenGLVertexBuffer >> bind: target [
|
||||||
^OpenGLVertexBuffer bind:target buffer: self vertexBufferID
|
^OpenGLVertexBuffer bind:target buffer: self vertexBufferID
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #'accessing - data' }
|
{ #category : #'as yet unclassified' }
|
||||||
OpenGLVertexBuffer >> data:target data: data size: size usage: usage [
|
OpenGLVertexBuffer >> data:target data: data size: size usage: usage [
|
||||||
"self bind: target."
|
self bind: target.
|
||||||
^OpenGLVertexBuffer bufferData: target size: size data:(data ifNil:[data] ifNotNil: [data getHandle]) usage: usage
|
^OpenGLVertexBuffer bufferData: target size: size data:(data ifNil:[data] ifNotNil: [data getHandle]) usage: usage
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #'accessing - data' }
|
{ #category : #'as yet unclassified' }
|
||||||
OpenGLVertexBuffer >> data:target data: data usage: usage [
|
OpenGLVertexBuffer >> data:target data: data usage: usage [
|
||||||
"self bind: target."
|
self bind: target.
|
||||||
^OpenGLVertexBuffer bufferData: target size: (data size) << 2 data:data getHandle usage: usage
|
^OpenGLVertexBuffer bufferData: target size: (data size) << 2 data:data getHandle usage: usage
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #'add/remove' }
|
{ #category : #'as yet unclassified' }
|
||||||
OpenGLVertexBuffer >> delete [
|
OpenGLVertexBuffer >> delete [
|
||||||
OpenGLVertexBuffer deleteBuffersSize: 1 buffers: vertexBufferID getHandle.
|
OpenGLVertexBuffer deleteBuffersSize: 1 buffers: vertexBufferID getHandle.
|
||||||
]
|
]
|
||||||
@ -78,18 +78,19 @@ OpenGLVertexBuffer >> initialize [
|
|||||||
vertexBufferID := FFIExternalArray externalNewType: GLint size:1.
|
vertexBufferID := FFIExternalArray externalNewType: GLint size:1.
|
||||||
vertexBufferID at:1 put: -1.
|
vertexBufferID at:1 put: -1.
|
||||||
vertexBufferID autoRelease.
|
vertexBufferID autoRelease.
|
||||||
OpenGLVertexBuffer genVertexBuffersSize: 1 buffers: vertexBufferID getHandle
|
OpenGLVertexBuffer genVertexBuffersSize: 1 buffers: vertexBufferID getHandle.
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #'accessing - data' }
|
{ #category : #'as yet unclassified' }
|
||||||
OpenGLVertexBuffer >> subData:target offset: offset data:data [
|
OpenGLVertexBuffer >> subData:target offset: offset data:data [
|
||||||
"self bind: target."
|
self bind: target.
|
||||||
^OpenGLVertexBuffer subData: target offset: offset size: (data size) << 2 data: data getHandle
|
^OpenGLVertexBuffer subData: target offset: offset size: (data size) << 2 data: data getHandle
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #'accessing - data' }
|
{ #category : #'as yet unclassified' }
|
||||||
OpenGLVertexBuffer >> subData:target offset: offset data:data size: size [
|
OpenGLVertexBuffer >> subData:target offset: offset data:data size: size [
|
||||||
"self bind: target."
|
self bind: target.
|
||||||
^OpenGLVertexBuffer subData: target offset: offset size: size data: data getHandle
|
^OpenGLVertexBuffer subData: target offset: offset size: size data: data getHandle
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -8,6 +8,6 @@ SDL_TouchFingerEvent >> triggableOn: aNode [
|
|||||||
{ #category : #'*Diya' }
|
{ #category : #'*Diya' }
|
||||||
SDL_TouchFingerEvent >> worldPosition [
|
SDL_TouchFingerEvent >> worldPosition [
|
||||||
|resolution|
|
|resolution|
|
||||||
resolution := DiyaRenderer resolution.
|
resolution := DiyaRendererContext uniqueInstance resolution.
|
||||||
^((self x)* (resolution x) ) @ ((self y)* (resolution y)).
|
^((self x)* (resolution x) ) @ ((self y)* (resolution y)).
|
||||||
]
|
]
|
||||||
|
3
Jenkinsfile
vendored
3
Jenkinsfile
vendored
@ -20,8 +20,7 @@ pipeline{
|
|||||||
{
|
{
|
||||||
stage('Build image from SDK') {
|
stage('Build image from SDK') {
|
||||||
steps {
|
steps {
|
||||||
// build specific multi-branch job on master branch
|
build job: 'Diya-image', propagate: true, wait: true
|
||||||
build job: 'gitea-sync/DiyaSDK/master', propagate: true, wait: true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user