diff options
author | chai <chaifix@163.com> | 2021-11-04 10:00:00 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2021-11-04 10:00:00 +0800 |
commit | b215d811a1981e20f35bb31df4e6cd2a74146193 (patch) | |
tree | e95655e6d97d0979678e56988287a030c2074ed1 /Data | |
parent | cc68bba3a4e1a78bc8b62a5902230a4ae5043ccb (diff) |
*misc
Diffstat (limited to 'Data')
-rw-r--r-- | Data/DefaultContent/Libraries/GameLab/Debug.lua | 6 | ||||
-rw-r--r-- | Data/Libraries/GameLab/Editor/EditorWindow.lua (renamed from Data/Libraries/GameLab/Editor/GUI/EditorWindow.lua) | 44 | ||||
-rw-r--r-- | Data/Libraries/GameLab/Editor/GUI/init.lua | 2 | ||||
-rw-r--r-- | Data/Libraries/GameLab/Editor/init.lua | 1 | ||||
-rw-r--r-- | Data/Resources/Shaders/BaseColor.glsl (renamed from Data/Resources/Shaders/BaseColor.gls) | 0 | ||||
-rw-r--r-- | Data/Resources/Shaders/Editor-Shape.glsl (renamed from Data/Resources/Shaders/Editor-Text.gls) | 0 | ||||
-rw-r--r-- | Data/Resources/Shaders/Editor-Text.glsl | 45 | ||||
-rw-r--r-- | Data/Resources/Shaders/Editor-UI.glsl (renamed from Data/Resources/Shaders/Editor-UI.gls) | 0 | ||||
-rw-r--r-- | Data/Scripts/Editor/AssetBrowser.lua | 9 | ||||
-rw-r--r-- | Data/Scripts/EditorGUI/EditorWindowManager.lua | 2 |
10 files changed, 79 insertions, 30 deletions
diff --git a/Data/DefaultContent/Libraries/GameLab/Debug.lua b/Data/DefaultContent/Libraries/GameLab/Debug.lua new file mode 100644 index 0000000..9f68160 --- /dev/null +++ b/Data/DefaultContent/Libraries/GameLab/Debug.lua @@ -0,0 +1,6 @@ + +local c_log = GameLab.Debug.Log +local c_log_editor = GameLab.Debug.LogEditor +local c_log_warning = GameLab.Debug.LogWarning +local c_log_error = GameLab.Debug.LogError + diff --git a/Data/Libraries/GameLab/Editor/GUI/EditorWindow.lua b/Data/Libraries/GameLab/Editor/EditorWindow.lua index 4f0525f..af79771 100644 --- a/Data/Libraries/GameLab/Editor/GUI/EditorWindow.lua +++ b/Data/Libraries/GameLab/Editor/EditorWindow.lua @@ -1,23 +1,23 @@ -local EditorWindow = GameLab.Class("GameLab.Editor.GUI.EditorWindow")
-
-EditorWindow.Ctor = function(self, title)
- self.title = title -- 编辑器名称
- self.guiWindow = nil -- 绑定的GUIWindow
-end
-
-EditorWindow.OnGUI = function(self)
-end
-
-EditorWindow.OnUpdate = function(self)
-end
-
-EditorWindow.OnStart = function(self)
-end
-
-EditorWindow.OnStop = function(self)
-end
-
-EditorWindow.OnFocus = function(self)
-end
-
+local EditorWindow = GameLab.Class("GameLab.Editor.EditorWindow") + +EditorWindow.Ctor = function(self, title) + self.title = title -- 编辑器名称 + self.guiWindow = nil -- 绑定的GUIWindow +end + +EditorWindow.OnGUI = function(self) +end + +EditorWindow.OnUpdate = function(self) +end + +EditorWindow.OnStart = function(self) +end + +EditorWindow.OnStop = function(self) +end + +EditorWindow.OnFocus = function(self) +end + return EditorWindow
\ No newline at end of file diff --git a/Data/Libraries/GameLab/Editor/GUI/init.lua b/Data/Libraries/GameLab/Editor/GUI/init.lua index def4237..a1ccb7c 100644 --- a/Data/Libraries/GameLab/Editor/GUI/init.lua +++ b/Data/Libraries/GameLab/Editor/GUI/init.lua @@ -3,8 +3,6 @@ local m = GameLab.Editor.GUI local import = GameLab.import(...)
-m.EditorWindow = import("EditorWindow")
-
import("Functions")
return m
\ No newline at end of file diff --git a/Data/Libraries/GameLab/Editor/init.lua b/Data/Libraries/GameLab/Editor/init.lua index 97b4b2e..c151aab 100644 --- a/Data/Libraries/GameLab/Editor/init.lua +++ b/Data/Libraries/GameLab/Editor/init.lua @@ -4,5 +4,6 @@ GameLab.Editor = m local import = GameLab.import(...)
m.AssetManager = import("AssetManager")
+m.EditorWindow = import("EditorWindow")
return m
\ No newline at end of file diff --git a/Data/Resources/Shaders/BaseColor.gls b/Data/Resources/Shaders/BaseColor.glsl index b1aed17..b1aed17 100644 --- a/Data/Resources/Shaders/BaseColor.gls +++ b/Data/Resources/Shaders/BaseColor.glsl diff --git a/Data/Resources/Shaders/Editor-Text.gls b/Data/Resources/Shaders/Editor-Shape.glsl index 7548507..7548507 100644 --- a/Data/Resources/Shaders/Editor-Text.gls +++ b/Data/Resources/Shaders/Editor-Shape.glsl diff --git a/Data/Resources/Shaders/Editor-Text.glsl b/Data/Resources/Shaders/Editor-Text.glsl new file mode 100644 index 0000000..03ec5a7 --- /dev/null +++ b/Data/Resources/Shaders/Editor-Text.glsl @@ -0,0 +1,45 @@ +#version 330 core + +CMD_BEGIN +Cull Off +Blend SrcAlpha OneMinusSrcAlpha +DepthTest Off +CMD_END + +uniform mat4 gamelab_mat_mvp; +uniform sampler2D gamelab_main_tex; +uniform vec2 gamelab_ui_position; + +VSH_BEGIN +layout (location = 0) in vec2 vPos; +layout (location = 1) in vec2 vUV; +layout (location = 2) in vec4 vColor; + +out vec2 uv; +out vec4 color; + +void main() +{ + vec2 pos = vPos + gamelab_ui_position; + vec4 clip = gamelab_mat_mvp * vec4(pos, -1, 1.0); + gl_Position = clip; + uv = vUV; + color = vColor; +} +VSH_END + +FSH_BEGIN +in vec2 uv; +in vec4 color; + +out vec4 FragColor; + +void main() +{ + //vec2 uv = vec2(uv.x, 1 - uv.y); + vec4 sampled = vec4(0.8,0.8,0.8,texture(gamelab_main_tex, uv).r); + sampled *= color; + //sampled = vec4(1,1,1,1); + FragColor = sampled; +} +FSH_END diff --git a/Data/Resources/Shaders/Editor-UI.gls b/Data/Resources/Shaders/Editor-UI.glsl index b2b348b..b2b348b 100644 --- a/Data/Resources/Shaders/Editor-UI.gls +++ b/Data/Resources/Shaders/Editor-UI.glsl diff --git a/Data/Scripts/Editor/AssetBrowser.lua b/Data/Scripts/Editor/AssetBrowser.lua index a0cb295..89d4eba 100644 --- a/Data/Scripts/Editor/AssetBrowser.lua +++ b/Data/Scripts/Editor/AssetBrowser.lua @@ -1,5 +1,5 @@ local Debug = GameLab.Debug
-local AssetBrowser = GameLab.Editor.GUI.EditorWindow.Extend("GameLab.Editor.AssetBrowser")
+local AssetBrowser = GameLab.Editor.EditorWindow.Extend("GameLab.Editor.AssetBrowser")
local GL = GameLab.Engine.GL
local Matrix44 = GameLab.Engine.Math.Matrix44
local Engine = GameLab.Engine
@@ -15,7 +15,6 @@ local shader = nil local tex
AssetBrowser.OnGUI = function(self)
-
if tex == nil then
tex = Engine.Resource.LoadTexture("./Resources/Images/tile.png")
--tex = Engine.Resource.LoadTexture("./Resources/Images/brickwall_small.jpg")
@@ -24,7 +23,7 @@ AssetBrowser.OnGUI = function(self) if shader == nil then
-- local glsl = IO.ReadFile("./Resources/Shaders/Editor-Text.glsl", IO.EFileMode.Text)
-- shader = Engine.Rendering.Shader.New(glsl)
- shader = Engine.Rendering.Shader.CreateFromFile("./Resources/Shaders/Editor-Text.gls")
+ shader = Engine.Rendering.Shader.CreateFromFile("./Resources/Shaders/Editor-Text.glsl")
end
local ortho = Matrix44.New()
@@ -36,11 +35,11 @@ AssetBrowser.OnGUI = function(self) Engine.Rendering.UseShader(shader)
Engine.Rendering.SetMatrix44("gamelab_mat_mvp", ortho)
- Engine.Rendering.SetVector2("gamelab_ui_position", {0, 0})
+ Engine.Rendering.SetVector2("gamelab_ui_position", {0, 30})
--Engine.Rendering.SetTexture("gamelab_main_tex", tex)
--Engine.Rendering.DrawUIQuad({0, 0, 200, 200})
_G["default_font"]:GetCharacters("你好世界!Hello,World! Project Window Properties", 12)
- --Engine.Rendering.DrawUI9Slicing(1, {25, 25}, {25, 25}, {80, 80}, {200, 200} )
+ --Engine.Rendering.DrawUI9Slicing(1, {25, 25}, {25, 25}, {80, 80}, {400, 50} )
Engine.Rendering.ResetUniformState()
end
diff --git a/Data/Scripts/EditorGUI/EditorWindowManager.lua b/Data/Scripts/EditorGUI/EditorWindowManager.lua index 707038b..e3595ae 100644 --- a/Data/Scripts/EditorGUI/EditorWindowManager.lua +++ b/Data/Scripts/EditorGUI/EditorWindowManager.lua @@ -2,4 +2,4 @@ local EditorWindowManager = {} EditorWindowManager.name = "asd"
-return EditorWindowManager
\ No newline at end of file +return EditorWindowManager
\ No newline at end of file |