| | @@ -75,7 +75,9 @@ |
| 75 | 75 | window.MakeContextCurrent(); |
| 76 | 76 | glfw.SwapInterval(1); |
| 77 | 77 | |
| 78 | +#ifndef PRODUCTION_BUILD |
| 78 | 79 | bool showDemo = true; |
| 80 | +#endif |
| 79 | 81 | |
| 80 | 82 | // GLADを初期化 |
| 81 | 83 | if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress)) { |
| | @@ -95,12 +97,14 @@ |
| 95 | 97 | |
| 96 | 98 | // データベースからシェーダーとLuaコードの受け取り |
| 97 | 99 | vector<db::ShaderData> codeMap = db::GetAllShaders(db); |
| 100 | + u32 shaderId; |
| 98 | 101 | string shaderName; |
| 99 | 102 | string VERT = ""; |
| 100 | 103 | string FRAG = ""; |
| 101 | 104 | string LUA = ""; |
| 102 | 105 | |
| 103 | 106 | for (const auto &c : codeMap) { |
| 107 | + shaderId = c.id; |
| 104 | 108 | shaderName = c.name; |
| 105 | 109 | VERT = c.vertexShader.code; |
| 106 | 110 | FRAG = c.fragmentShader.code; |
| | @@ -153,7 +157,9 @@ |
| 153 | 157 | |
| 154 | 158 | gui::showTitleBar(); |
| 155 | 159 | |
| 160 | +#ifndef PRODUCTION_BUILD |
| 156 | 161 | if (showDemo) ImGui::ShowDemoWindow(&showDemo); |
| 162 | +#endif |
| 157 | 163 | |
| 158 | 164 | vertEditor.Render(); |
| 159 | 165 | fragEditor.Render(); |
| | @@ -174,7 +180,6 @@ |
| 174 | 180 | shaderProgram.Reload(VERT, FRAG); |
| 175 | 181 | luaEngine.Reload(LUA); |
| 176 | 182 | { |
| 177 | | - //lua::LuaEngine newLua(LUA); |
| 178 | 183 | lua::LuaMesh newMesh = luaEngine.GetMesh(); |
| 179 | 184 | |
| 180 | 185 | VAO.BindVertexArray(); |
| | @@ -211,6 +216,13 @@ |
| 211 | 216 | ImGui::SameLine(); |
| 212 | 217 | |
| 213 | 218 | if (ImGui::Button("保存(CTRL + S)")) { |
| 219 | + VERT = vertEditor.Get().GetText(); |
| 220 | + FRAG = fragEditor.Get().GetText(); |
| 221 | + LUA = luaEditor.Get().GetText(); |
| 222 | + |
| 223 | + db::SaveCode(db, shaderId, VERT, "vertex_shader"); |
| 224 | + db::SaveCode(db, shaderId, FRAG, "fragment_shader"); |
| 225 | + db::SaveCode(db, shaderId, LUA, "lua_code"); |
| 214 | 226 | } |
| 215 | 227 | |
| 216 | 228 | ImGui::Text("現在フレームレート: %.3f ms/frame (%.1f FPS)", 1000.0f / ge.GetIO().Framerate, ge.GetIO().Framerate); |