diff options
author | chai <chaifix@163.com> | 2021-10-29 13:36:49 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2021-10-29 13:36:49 +0800 |
commit | 91c32cb173201ac8803a1e4452e8342969b8e484 (patch) | |
tree | 5e78c485b5fcfcf839a2348667597d7e10476214 /Data/Scripts/EditorApplication.lua | |
parent | 1f92d4c389cceba6f90261d9cb29885c8a3ca24c (diff) |
*GLSL test
Diffstat (limited to 'Data/Scripts/EditorApplication.lua')
-rw-r--r-- | Data/Scripts/EditorApplication.lua | 61 |
1 files changed, 7 insertions, 54 deletions
diff --git a/Data/Scripts/EditorApplication.lua b/Data/Scripts/EditorApplication.lua index a233d88..75749df 100644 --- a/Data/Scripts/EditorApplication.lua +++ b/Data/Scripts/EditorApplication.lua @@ -3,6 +3,8 @@ local inspect = require "inspect" local AssetBrowser = require "./Scripts/Editor/AssetBrowser" local EditorWindowManager = require "./Scripts/EditorGUI/EditorWindowManager" +local Editor = GameLab.Editor +local Engine = GameLab.Engine local Resource = GameLab.Engine.Resource local Rendering = GameLab.Engine.Rendering local Debug = GameLab.Debug @@ -23,7 +25,7 @@ app:SetMainWindow(mainWindow) local guiWindow = GUI.GUIWindow.New() guiWindow:SetContainerWindow(mainWindow) -guiWindow:SetPosition({0,0, 500, 400}) +guiWindow:SetPosition({0,0, 400, 400}) collectgarbage() @@ -40,7 +42,7 @@ Debug.Log(inspect(v)) Debug.Log(EditorWindowManager.name) -local c = Rendering.Color.New(1,1,1,1) +local c = Engine.Rendering.Color.New(1,1,1,1) Debug.Log(inspect(c)) Debug.Log(inspect(GL.EBufferType)) @@ -64,13 +66,13 @@ GameLab.IO.ReadFilesAsync(files, function() Debug.Log("finished") end) -local imgData = Resource.LoadImageData("./Resources/Images/brickwall.jpg") +local imgData = Engine.Resource.LoadImageData("./Resources/Images/brickwall.jpg") Debug.Log(tostring(imgData:GetWidth())) Debug.Log(tostring(imgData:GetHeight())) -local tex = Resource.LoadTexture("./Resources/Images/brickwall.jpg") +local tex = Engine.Resource.LoadTexture("./Resources/Images/brickwall.jpg") -local request = Resource.LoadImageDataAsync("./Resources/Images/brickwall.jpg") +local request = Engine.Resource.LoadImageDataAsync("./Resources/Images/brickwall.jpg") local vsh = [[ #version 330 core @@ -109,55 +111,6 @@ local fsh = [[ } ]] -local glsl = [[ - -#version 330 core -uniform vec2 screenSize; - -VSH_BEGIN - -layout (location = 0) in vec3 aPos; -layout (location = 1) in vec3 aColor; -layout (location = 2) in vec2 aTexCoord; - -out vec3 ourColor; -out vec2 TexCoord; - -void main() -{ - gl_Position = vec4(aPos, 1.0); - ourColor = aColor; - TexCoord = vec2(aTexCoord.x, aTexCoord.y); -} - -VSH_END - - -FSH_BEGIN - -out vec4 FragColor; - -in vec3 ourColor; -in vec2 TexCoord; - -uniform float mixValue; - -// texture samplers -uniform sampler2D texture1; -uniform sampler2D texture2; - -void main() -{ - // linearly interpolate between both textures - FragColor = mix(texture(texture1, TexCoord), texture(texture2, TexCoord), mixValue); -} - -FSH_END - -]] - -local shader = Rendering.Shader.New(glsl) - while true do app:OnStep() |