adjust imperative shell to use xyz coordinates for position, instead of simply xy; need to ensure the functional core code outputs a vector in this format too
This commit is contained in:
@@ -40,12 +40,10 @@ struct
|
|||||||
|
|
||||||
val textAcc = Vector.concat textAcc
|
val textAcc = Vector.concat textAcc
|
||||||
val bgAcc = Vector.concat bgAcc
|
val bgAcc = Vector.concat bgAcc
|
||||||
|
val vec = Vector.concat [textAcc, bgAcc, cursorAcc]
|
||||||
val textMsg = REDRAW_TEXT textAcc
|
val drawMsg = DRAW_TEXT vec
|
||||||
val cursorMsg = REDRAW_CURSOR cursorAcc
|
|
||||||
val bgMsg = REDRAW_BG bgAcc
|
|
||||||
in
|
in
|
||||||
DRAW bgMsg :: DRAW textMsg :: DRAW cursorMsg :: msgs
|
DRAW drawMsg :: msgs
|
||||||
end
|
end
|
||||||
|
|
||||||
(* builds text from a string with char-wrap.
|
(* builds text from a string with char-wrap.
|
||||||
|
|||||||
@@ -1,8 +1,2 @@
|
|||||||
structure DrawMsg =
|
structure DrawMsg =
|
||||||
struct
|
struct datatype t = DRAW_TEXT of Real32.real vector | YANK of string end
|
||||||
datatype t =
|
|
||||||
REDRAW_TEXT of Real32.real vector
|
|
||||||
| REDRAW_CURSOR of Real32.real vector
|
|
||||||
| REDRAW_BG of Real32.real vector
|
|
||||||
| YANK of string
|
|
||||||
end
|
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
structure GlDraw =
|
structure GlDraw =
|
||||||
struct
|
struct
|
||||||
open CML
|
open CML
|
||||||
open DrawMsg K
|
open DrawMsg
|
||||||
|
|
||||||
(* The name doesn't make it clear, but this structure
|
(* The name doesn't make it clear, but this structure
|
||||||
* couples GLFW and OpenGL.
|
* couples GLFW and OpenGL.
|
||||||
* I'm not sure if I will use native windowing systems
|
* I'm not sure if I will use native windowing systems
|
||||||
@@ -76,7 +77,7 @@ struct
|
|||||||
shellState
|
shellState
|
||||||
|
|
||||||
val _ = Gles3.bufferData (vec, Vector.length vec, Gles3.STATIC_DRAW)
|
val _ = Gles3.bufferData (vec, Vector.length vec, Gles3.STATIC_DRAW)
|
||||||
val newTextDrawLength = Vector.length vec div 5
|
val newTextDrawLength = Vector.length vec div 6
|
||||||
in
|
in
|
||||||
{ textVertexBuffer = textVertexBuffer
|
{ textVertexBuffer = textVertexBuffer
|
||||||
, textProgram = textProgram
|
, textProgram = textProgram
|
||||||
@@ -90,7 +91,7 @@ struct
|
|||||||
val {textVertexBuffer, textDrawLength, textProgram, window = _} =
|
val {textVertexBuffer, textDrawLength, textProgram, window = _} =
|
||||||
drawObject
|
drawObject
|
||||||
in
|
in
|
||||||
Gles3.drawArrays (Gles3.TRIANGLES, 0, drawLength)
|
Gles3.drawArrays (Gles3.TRIANGLES, 0, textDrawLength)
|
||||||
end
|
end
|
||||||
|
|
||||||
fun yank (shellState: t, str) =
|
fun yank (shellState: t, str) =
|
||||||
@@ -109,7 +110,7 @@ struct
|
|||||||
shellState
|
shellState
|
||||||
in
|
in
|
||||||
case msg of
|
case msg of
|
||||||
DRAW vec => uploadText (shellState, textVec)
|
DRAW_TEXT textVec => uploadText (shellState, textVec)
|
||||||
| YANK str => yank (shellState, str)
|
| YANK str => yank (shellState, str)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
structure GlShaders =
|
structure GlShaders =
|
||||||
struct
|
struct
|
||||||
val xyrgbVertexShaderString =
|
val xyzRgbVertexShaderString =
|
||||||
"#version 300 es\n\
|
"#version 300 es\n\
|
||||||
\layout (location = 0) in vec3 apos;\n\
|
\layout (location = 0) in vec3 apos;\n\
|
||||||
\layout (location = 1) in vec3 col;\n\
|
\layout (location = 1) in vec3 col;\n\
|
||||||
|
|||||||
Reference in New Issue
Block a user