2022-03-02 20:11:01 +01:00
|
|
|
Class {
|
|
|
|
#name : #DiyaRectangle,
|
2022-03-06 18:33:10 +01:00
|
|
|
#superclass : #Diya2DPrimShape,
|
2022-03-02 20:11:01 +01:00
|
|
|
#category : #'Diya-Graphics'
|
|
|
|
}
|
|
|
|
|
2022-03-16 01:32:01 +01:00
|
|
|
{ #category : #'instance creation' }
|
|
|
|
DiyaRectangle class >> size: size [
|
|
|
|
^(self new) extent: size; yourself
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #'instance creation' }
|
|
|
|
DiyaRectangle class >> size: size shader:s [
|
|
|
|
^(self with:s) extent: size; yourself
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #initialization }
|
|
|
|
DiyaRectangle >> drawLines [
|
2022-03-24 22:48:41 +01:00
|
|
|
OpenGL drawArrays: GL_LINE_LOOP first:0 count: (vbuffer size >> 2).
|
2022-03-16 01:32:01 +01:00
|
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #accessing }
|
|
|
|
DiyaRectangle >> extent: v [
|
|
|
|
bbox := Rectangle origin:0@0 corner: v.
|
2022-08-07 20:43:16 +02:00
|
|
|
self setDirty
|
2022-03-16 01:32:01 +01:00
|
|
|
]
|
|
|
|
|
2022-03-02 20:11:01 +01:00
|
|
|
{ #category : #accessing }
|
2022-03-06 19:50:19 +01:00
|
|
|
DiyaRectangle >> initialize [
|
|
|
|
super initialize.
|
|
|
|
self extent:10@10.
|
|
|
|
translation := nil.
|
2022-03-24 22:48:41 +01:00
|
|
|
vbuffer := FFIExternalArray externalNewType: GLfloat size:16.
|
2022-03-06 19:50:19 +01:00
|
|
|
vbuffer autoRelease.
|
2022-03-24 22:48:41 +01:00
|
|
|
type := GL_QUADS.
|
2022-03-06 19:50:19 +01:00
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #accessing }
|
2022-08-10 19:55:49 +02:00
|
|
|
DiyaRectangle >> process [
|
2022-03-16 01:32:01 +01:00
|
|
|
|extent|
|
|
|
|
extent := self extent.
|
2022-08-13 15:55:51 +02:00
|
|
|
vbuffer
|
|
|
|
at: 1 put: 0.0;
|
|
|
|
at: 2 put: 0.0;
|
|
|
|
at: 3 put: 0.0;
|
|
|
|
at: 4 put: 0.0;
|
|
|
|
|
|
|
|
at: 5 put: 0.0;
|
2022-08-16 00:59:35 +02:00
|
|
|
at: 6 put: extent y asFloat;
|
2022-08-13 15:55:51 +02:00
|
|
|
at: 7 put: 0.0;
|
|
|
|
at: 8 put: 1.0;
|
|
|
|
|
2022-08-16 00:59:35 +02:00
|
|
|
at: 9 put: extent x asFloat;
|
|
|
|
at: 10 put: extent y asFloat;
|
2022-08-13 15:55:51 +02:00
|
|
|
at: 11 put: 1.0;
|
|
|
|
at: 12 put: 1.0;
|
|
|
|
|
2022-08-16 00:59:35 +02:00
|
|
|
at: 13 put: extent x asFloat;
|
2022-08-13 15:55:51 +02:00
|
|
|
at: 14 put: 0.0;
|
|
|
|
at: 15 put: 1.0;
|
|
|
|
at: 16 put: 0.0.
|
2022-03-06 19:50:19 +01:00
|
|
|
^true
|
2022-03-02 20:11:01 +01:00
|
|
|
]
|