1
0
mirror of https://github.com/lxsang/Diya-API.git synced 2025-01-15 17:18:23 +01:00
Diya-API/Diya/DiyaNode.class.st

106 lines
1.6 KiB
Smalltalk
Raw Normal View History

2022-03-01 22:58:58 +01:00
Class {
#name : #DiyaNode,
#superclass : #DiyaBaseObject,
#instVars : [
'translation',
'parent',
'scale',
'rotation',
'tf',
'shader',
'context'
2022-03-01 22:58:58 +01:00
],
#pools : [
'OpenGLConstants',
'OpenGLTypes'
],
#category : #'Diya-Graphics'
}
{ #category : #'instance creation' }
DiyaNode class >> with: shader [
^self new shader: shader; yourself
]
{ #category : #initialization }
DiyaNode >> initialize [
super initialize.
parent := nil.
shader := DiyaDefaultShader uniqueInstance.
context := DiyaRendererContext uniqueInstance.
]
{ #category : #testing }
DiyaNode >> isRoot [
^false
2022-03-01 22:58:58 +01:00
]
{ #category : #accessing }
DiyaNode >> parent [
^ parent
]
{ #category : #accessing }
DiyaNode >> parent: anObject [
parent := anObject
]
2022-03-01 22:58:58 +01:00
{ #category : #accessing }
DiyaNode >> position [
^ translation
]
{ #category : #accessing }
DiyaNode >> position: anObject [
translation := anObject.
self updateTF.
2022-03-01 22:58:58 +01:00
]
{ #category : #accessing }
DiyaNode >> render [
2022-03-01 22:58:58 +01:00
^self subclassResponsibility
]
{ #category : #accessing }
DiyaNode >> rotation [
^ rotation
]
{ #category : #accessing }
DiyaNode >> rotation: anObject [
rotation := anObject.
self updateTF.
2022-03-01 22:58:58 +01:00
]
{ #category : #accessing }
DiyaNode >> scale [
^ scale
]
{ #category : #accessing }
DiyaNode >> scale: anObject [
scale := anObject.
self updateTF.
2022-03-01 22:58:58 +01:00
]
{ #category : #accessing }
DiyaNode >> shader [
^ shader
]
{ #category : #accessing }
DiyaNode >> shader: anObject [
shader := anObject
]
{ #category : #accessing }
DiyaNode >> tf [
parent ifNil: [ self error: 'TF: This node is not attached to the main tree' ].
^ tf
]
{ #category : #accessing }
DiyaNode >> updateTF [
self subclassResponsibility
]