summaryrefslogtreecommitdiff
path: root/Data/Scripts/Editor/AssetBrowser.lua
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2021-10-29 13:36:49 +0800
committerchai <chaifix@163.com>2021-10-29 13:36:49 +0800
commit91c32cb173201ac8803a1e4452e8342969b8e484 (patch)
tree5e78c485b5fcfcf839a2348667597d7e10476214 /Data/Scripts/Editor/AssetBrowser.lua
parent1f92d4c389cceba6f90261d9cb29885c8a3ca24c (diff)
*GLSL test
Diffstat (limited to 'Data/Scripts/Editor/AssetBrowser.lua')
-rw-r--r--Data/Scripts/Editor/AssetBrowser.lua60
1 files changed, 53 insertions, 7 deletions
diff --git a/Data/Scripts/Editor/AssetBrowser.lua b/Data/Scripts/Editor/AssetBrowser.lua
index e6e4a4a..b936702 100644
--- a/Data/Scripts/Editor/AssetBrowser.lua
+++ b/Data/Scripts/Editor/AssetBrowser.lua
@@ -8,17 +8,63 @@ AssetBrowser.Ctor = function(self)
self.base.Ctor(self, "AssetBrowser")
end
+local shader = nil
+
+local glsl = [[
+
+#version 330 core
+
+VSH_BEGIN
+
+layout (location = 0) in vec2 vPos;
+layout (location = 1) in vec2 vUV;
+
+uniform mat4 mvp;
+
+void main()
+{
+ vec4 clip = mvp * vec4(vPos, -1, 1.0);
+ gl_Position = clip;
+}
+
+VSH_END
+
+FSH_BEGIN
+
+out vec4 FragColor;
+
+void main()
+{
+ FragColor = vec4(1,1,1,1);
+}
+FSH_END
+
+]]
+
AssetBrowser.OnGUI = function(self)
+
+ if shader == nil then
+ shader = GameLab.Engine.Rendering.Shader.New(glsl)
+ end
+
+ local ortho = Matrix44.New()
+ ortho:SetOrtho(-200, 200, -200, 200, 0.1, 10)
+
Debug.Log("AssetBrowser.OnGUI()")
GL.ClearColor({0,0,0,1})
GL.Clear(GL.EBufferType.ColorBuffer)
- GL.Color({1,1,0,1})
- GL.LoadPixelMatrix(-250, 250, -300, 300)
- GL.Begin(GL.EPrimitiveType.Triangles)
- GL.Vertex({0,0,-1})
- GL.Vertex({0,300,-1})
- GL.Vertex({250,0,-1})
- GL.End()
+ -- GL.Color({1,1,0,1})
+ -- GL.LoadPixelMatrix(-250, 250, -300, 300)
+ -- GL.Begin(GL.EPrimitiveType.Triangles)
+ -- GL.Vertex({0,0,-1})
+ -- GL.Vertex({0,300,-1})
+ -- GL.Vertex({250,0,-1})
+ -- GL.End()
+
+ shader:Use()
+ shader:SetMatrix44("mvp", ortho)
+ GameLab.Engine.Rendering.DrawUIQuad({0, 0, 100, 100})
+
end
AssetBrowser.OnFocus = function(self)