1
- #include " lepus/gfx/GraphicsEngine/Apis/ApiGL/Types/GLShader.h"
2
-
3
- #include < imgui/imgui.h>
4
- #include < imgui/backends/imgui_impl_glfw.h>
5
- #include < imgui/backends/imgui_impl_opengl3.h>
6
1
7
2
#include < lepus/system/Windowing/GLFW.h>
3
+ #include " lepus/gfx/GraphicsEngine/Apis/ApiVk.h"
4
+
5
+ #include " lepus/gfx/GraphicsEngine/Apis/ApiGL/Types/GLShader.h"
6
+
8
7
#include < lepus/gfx/GraphicsEngine/Apis/ApiGL.h>
9
8
#include < lepus/gfx/GraphicsEngine.h>
10
9
#include < lepus/gfx/GraphicsEngine/ShaderCompilers/ShaderCompilerGLSL.h>
@@ -118,19 +117,18 @@ class DemoApp : public system::BaseApp
118
117
119
118
inline int Run () override
120
119
{
121
- std::shared_ptr<system ::WindowingGLFW> windowing = std::make_shared<system ::WindowingGLFW>(800 , 600 );
120
+ std::shared_ptr<system ::WindowingGLFW> windowing = std::make_shared<system ::WindowingGLFW>(800 , 600 , false );
121
+
122
+ gfx::GraphicsApiVkOptions options = {};
123
+ options.windowingPtr = windowing;
122
124
123
125
// Create new graphics engine instance
124
- gfx::GraphicsApiGLOptions options = {};
125
126
options.mainViewport = {800 , 600 };
126
127
gfx::GraphicsEngine engine (&options, windowing);
127
128
128
129
// Termination condition for main loop
129
130
bool isRunning = true ;
130
131
131
- // Set the window as the current OpenGL context.
132
- windowing->SetAsCurrentContext ();
133
-
134
132
// Output start message to console
135
133
engine::ConsoleLogger::Global ().LogInfo (" " , " main" , " Demo starting!" );
136
134
@@ -140,20 +138,20 @@ class DemoApp : public system::BaseApp
140
138
fragShaderSrc = system ::FileSystem::Read (" ../../Content/GLSL/Unlit/RGBVertex.frag" ),
141
139
vertShaderSrc2 = system ::FileSystem::Read (" ../../Content/GLSL/Unlit/SolidColour.vert" ),
142
140
fragShaderSrc2 = system ::FileSystem::Read (" ../../Content/GLSL/Unlit/SolidColour.frag" );
143
- gfx::ShaderCompiledResult
141
+ /* gfx::ShaderCompiledResult
144
142
vertShader = gfx::ShaderCompilerGLSL::Singleton().CompileShader(vertShaderSrc.c_str(), vertShaderSrc.length(), gfx::VertexShader),
145
143
fragShader = gfx::ShaderCompilerGLSL::Singleton().CompileShader(fragShaderSrc.c_str(), fragShaderSrc.length(), gfx::FragmentShader),
146
144
vertShader2 = gfx::ShaderCompilerGLSL::Singleton().CompileShader(vertShaderSrc2.c_str(), vertShaderSrc2.length(), gfx::VertexShader),
147
145
fragShader2 = gfx::ShaderCompilerGLSL::Singleton().CompileShader(fragShaderSrc2.c_str(), fragShaderSrc2.length(), gfx::FragmentShader);
148
-
146
+ */
149
147
// Register shader with the API.
150
- auto & api = engine.GetApi <gfx::GraphicsApiGL >();
151
- api .GetSceneGraph ().SetCamera (&m_Camera);
148
+ auto & api = engine.GetApi <gfx::GraphicsApiVk >();
149
+ engine .GetSceneGraph ().SetCamera (&m_Camera);
152
150
153
151
lepus::gfx::Material baseMaterial, otherMaterial;
154
152
lepus::gfx::GLShader baseShader (lepus::gfx::ShaderInfo (" RGBVertex" )), redShader (lepus::gfx::ShaderInfo (" SolidColour" ));
155
- baseShader.SetGLProgram (gfx::ShaderCompilerGLSL::Singleton ().BuildProgram (vertShader, fragShader));
156
- redShader.SetGLProgram (gfx::ShaderCompilerGLSL::Singleton ().BuildProgram (vertShader2, fragShader2));
153
+ // baseShader.SetGLProgram(gfx::ShaderCompilerGLSL::Singleton().BuildProgram(vertShader, fragShader));
154
+ // redShader.SetGLProgram(gfx::ShaderCompilerGLSL::Singleton().BuildProgram(vertShader2, fragShader2));
157
155
baseMaterial.SetShader (&baseShader);
158
156
otherMaterial.SetShader (&redShader);
159
157
@@ -165,18 +163,18 @@ class DemoApp : public system::BaseApp
165
163
m_Camera.Transform ().Origin (m_Camera.Transform ().Forward () * -2 .f );
166
164
167
165
// Instantiate two Renderables in the scene graph, each with its own transform, using the same cube mesh data.
168
- auto cubeMesh = lepus::gfx::GLMesh (lepus::utility::Primitives::Cube ());
169
- auto cube = lepus::gfx::Renderable<lepus::gfx::GLMesh> (&cubeMesh, lepus::math::Transform (), baseMaterial);
170
- auto cube2 = lepus::gfx::Renderable<lepus::gfx::GLMesh> (&cubeMesh, lepus::math::Transform (), otherMaterial);
171
- auto cube3 = lepus::gfx::Renderable<lepus::gfx::GLMesh> (&cubeMesh, lepus::math::Transform (), otherMaterial);
172
- auto cube4 = lepus::gfx::Renderable<lepus::gfx::GLMesh> (&cubeMesh, lepus::math::Transform (), baseMaterial);
166
+ auto cubeMesh = engine. CreateMesh (lepus::utility::Primitives::Cube ());
167
+ auto cube = lepus::gfx::Renderable (&cubeMesh, lepus::math::Transform (), baseMaterial);
168
+ auto cube2 = lepus::gfx::Renderable (&cubeMesh, lepus::math::Transform (), otherMaterial);
169
+ auto cube3 = lepus::gfx::Renderable (&cubeMesh, lepus::math::Transform (), otherMaterial);
170
+ auto cube4 = lepus::gfx::Renderable (&cubeMesh, lepus::math::Transform (), baseMaterial);
173
171
174
172
cube.GetTransform ()->Origin (lepus::types::Vector3 (0 .f , 0 .f , -2 .f ));
175
173
cube2.GetTransform ()->Origin (lepus::types::Vector3 (2 .f , 0 .f , 0 .f ));
176
174
cube3.GetTransform ()->Origin (lepus::types::Vector3 (0 .f , 0 .f , 2 .f ));
177
175
cube4.GetTransform ()->Origin (lepus::types::Vector3 (0 .f , -2 .f , 0 .f ));
178
176
179
- auto rootNode = api .GetSceneGraph ().AddChild (&cube);
177
+ auto rootNode = engine .GetSceneGraph ().AddChild (&cube);
180
178
auto childNode1 = rootNode->AddChild (&cube2);
181
179
auto childNode2 = childNode1->AddChild (&cube3);
182
180
// auto childNode3 = childNode2->AddChild(&cube4);
@@ -185,7 +183,7 @@ class DemoApp : public system::BaseApp
185
183
// cube2.GetTransform()->SetScale(1.f / 1.5f);
186
184
cube2.GetTransform ()->Rotate (lepus::types::Quaternion (1 .f , 0 .f , 0 .f , (float )PI * (-90 .f / 180 .f )));
187
185
188
- auto cubeNode = api .GetSceneGraph ().AddChild (&cube);
186
+ auto cubeNode = engine .GetSceneGraph ().AddChild (&cube);
189
187
190
188
auto window = static_cast <GLFWwindow*>(windowing->GetWindowPtr ());
191
189
0 commit comments