-
Notifications
You must be signed in to change notification settings - Fork 0
/
GLFunction.class.st
63 lines (51 loc) · 1.11 KB
/
GLFunction.class.st
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
"
I represent a GL function - including #main
"
Class {
#name : #GLFunction,
#superclass : #Object,
#instVars : [
'name',
'type',
'codeLines',
'locals',
'parameters'
],
#category : #'WebGL-Programs'
}
{ #category : #converting }
GLFunction >> asString [
^ type asString,' ',name,'(',
(parameters isEmpty ifTrue: [#void] ifFalse: [GLShadingLanguage formatDictionary: parameters called: '' separator: ',']),
'){
',(locals isEmpty ifTrue: [''] ifFalse: [(GLShadingLanguage formatDictionary: locals called: ''),'
']),
(';
' join: codeLines),
';
}
'
]
{ #category : #construction }
GLFunction >> code: aString [
codeLines addLast: aString.
]
{ #category : #initialization }
GLFunction >> initialize [
super initialize.
codeLines := OrderedCollection new.
locals := Dictionary new.
parameters := Dictionary new.
]
{ #category : #construction }
GLFunction >> local: vType named: vName [
locals at: vName put: vType asGLType.
]
{ #category : #accessing }
GLFunction >> name: aString [
name := aString.
]
{ #category : #accessing }
GLFunction >> type: typeReference [
type := typeReference asGLType.
]