Skip to content

Commit

Permalink
Object Moved
Browse files Browse the repository at this point in the history
  • Loading branch information
Cherrytree56567 committed May 5, 2024
1 parent bad63e6 commit ec0068d
Show file tree
Hide file tree
Showing 48 changed files with 52 additions and 14 deletions.
2 changes: 2 additions & 0 deletions Drizzle3D/App.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ namespace Drizzle3D {
LayerDispatcher->AddLayer(renderinglayer);
LayerDispatcher->AddLayer(imguilayer);
LayerDispatcher->DispatchLayerAttach();

D3DWindow->AddRLayer(renderinglayer->getObjects());
}

bool App::Run() {
Expand Down
1 change: 1 addition & 0 deletions Drizzle3D/Drizzle3D.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
<ClInclude Include="MouseCodes.h" />
<ClInclude Include="MouseEvent.h" />
<ClInclude Include="Object.h" />
<ClInclude Include="ObjectWindow.h" />
<ClInclude Include="RenderingLayer.h" />
<ClInclude Include="Renderer2D.h" />
<ClInclude Include="ResourceManager.h" />
Expand Down
3 changes: 3 additions & 0 deletions Drizzle3D/Drizzle3D.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -296,5 +296,8 @@
<ClInclude Include="Object.h">
<Filter>Source Files\Events\Object</Filter>
</ClInclude>
<ClInclude Include="ObjectWindow.h">
<Filter>Source Files\Window</Filter>
</ClInclude>
</ItemGroup>
</Project>
16 changes: 16 additions & 0 deletions Drizzle3D/ObjectWindow.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#pragma once

namespace Drizzle3D {
struct Object {
GLuint VertexArray, VertexBuffer, IndexBuffer = 0;
std::vector<float> vertices;
std::vector<unsigned int> indices;
glm::mat4 modelMatrix;
glm::mat4 OldmodelMatrix;
GLuint textureID = NULL;
GLuint mat = 0;
char* name = (char*)"PLZ_SPECIFY_A_NAME";
bool hide = false;
VkPipeline Pipeline;
};
}
15 changes: 2 additions & 13 deletions Drizzle3D/RenderingLayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "base.h"
#include "Flags.h"
#include "Vulkan.h"
#include "ObjectWindow.h"

namespace Drizzle3D {

Expand Down Expand Up @@ -51,19 +52,6 @@ namespace Drizzle3D {
float quadratic;
};

struct Object {
GLuint VertexArray, VertexBuffer, IndexBuffer = 0;
std::vector<float> vertices;
std::vector<unsigned int> indices;
glm::mat4 modelMatrix;
glm::mat4 OldmodelMatrix;
GLuint textureID = NULL;
GLuint mat = 0;
char* name = (char*)"PLZ_SPECIFY_A_NAME";
bool hide = false;
VkPipeline Pipeline;
};

struct Camera {
glm::vec3 position;
glm::vec3 look_at_position;
Expand Down Expand Up @@ -102,6 +90,7 @@ namespace Drizzle3D {
Drizzle3D_API Flags* GetFlags() { return &flags; }
Drizzle3D_API GLuint GetTexture(const char* TexturePath);
Drizzle3D_API VulkanPipeline* getVkPipe() { return &pVulkanPipe; }
Drizzle3D_API std::vector<Object>* getObjects() { return &Objects; }
private:
void InitGlRendering();
void RenderInitGlRendering();
Expand Down
13 changes: 13 additions & 0 deletions Drizzle3D/Window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,19 @@ namespace Drizzle3D {
std::unique_ptr<MouseScrolledEvent> at = std::make_unique<MouseScrolledEvent>((float)xffset, (float)yffset);
dispatcher->AddEvent(std::move(at));
}

std::vector<Object>* objes = std::any_cast<std::vector<Object>*>(rLayer);

for (int i = 0; i < objes->size(); i++) {
if (objes->at(i).modelMatrix == objes->at(i).OldmodelMatrix) {
continue;
}
else {
std::unique_ptr<ObjectMovedEvent> attt = std::make_unique<ObjectMovedEvent>(objes->at(i).modelMatrix, objes->at(i).OldmodelMatrix);
dispatcher->AddEvent(std::move(attt));
objes->at(i).OldmodelMatrix = objes->at(i).modelMatrix;
}
}
}

void Window::Render() {
Expand Down
5 changes: 5 additions & 0 deletions Drizzle3D/Window.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,13 @@
#include <iostream>
#include <backends/imgui_impl_glfw.h>
#include <backends/imgui_impl_opengl3.h>
#include <glm/glm.hpp>
#include "AppEvent.h"
#include "KeyEvent.h"
#include "MouseEvent.h"
#include "Object.h"
#include "base.h"
#include "ObjectWindow.h"

namespace Drizzle3D {

Expand All @@ -36,6 +39,7 @@ namespace Drizzle3D {
Drizzle3D_API void clearKeyReleasedCodes() { keyRel_codes.clear(); }
Drizzle3D_API double returnMouseX() { return lastMouseX; }
Drizzle3D_API double returnMouseY() { return lastMouseY; }
Drizzle3D_API void AddRLayer(std::any rL) { rLayer = rL; }

Drizzle3D_API void ProcessEvents();
Drizzle3D_API void Render();
Expand All @@ -44,6 +48,7 @@ namespace Drizzle3D {
private:
GLFWwindow* window = NULL;
RenderingAPI renderingAPI;
std::any rLayer;
int winwidth;
int winheight;
int winx;
Expand Down
Binary file modified Drizzle3D/x64/Debug/App.obj
Binary file not shown.
Binary file modified Drizzle3D/x64/Debug/Camera.obj
Binary file not shown.
Binary file modified Drizzle3D/x64/Debug/CollisionDetection.obj
Binary file not shown.
Binary file modified Drizzle3D/x64/Debug/Drizzle3D.ilk
Binary file not shown.
Binary file modified Drizzle3D/x64/Debug/Drizzle3D.tlog/CL.command.1.tlog
Binary file not shown.
Binary file modified Drizzle3D/x64/Debug/Drizzle3D.tlog/CL.read.1.tlog
Binary file not shown.
Binary file modified Drizzle3D/x64/Debug/Drizzle3D.tlog/CL.write.1.tlog
Binary file not shown.
Binary file modified Drizzle3D/x64/Debug/Events.obj
Binary file not shown.
Binary file modified Drizzle3D/x64/Debug/FirstPersonCamera.obj
Binary file not shown.
Binary file modified Drizzle3D/x64/Debug/Flags.obj
Binary file not shown.
Binary file modified Drizzle3D/x64/Debug/ImGuiLayer.obj
Binary file not shown.
Binary file modified Drizzle3D/x64/Debug/Layer.obj
Binary file not shown.
Binary file modified Drizzle3D/x64/Debug/Light.obj
Binary file not shown.
Binary file modified Drizzle3D/x64/Debug/Logging.obj
Binary file not shown.
Binary file modified Drizzle3D/x64/Debug/Material.obj
Binary file not shown.
Binary file modified Drizzle3D/x64/Debug/Object.obj
Binary file not shown.
Binary file modified Drizzle3D/x64/Debug/OpenGL.obj
Binary file not shown.
Binary file modified Drizzle3D/x64/Debug/Renderer2D.obj
Binary file not shown.
Binary file modified Drizzle3D/x64/Debug/RenderingLayer.obj
Binary file not shown.
Binary file modified Drizzle3D/x64/Debug/ResourceManager.obj
Binary file not shown.
Binary file modified Drizzle3D/x64/Debug/Shader.obj
Binary file not shown.
Binary file modified Drizzle3D/x64/Debug/Skybox.obj
Binary file not shown.
Binary file modified Drizzle3D/x64/Debug/Vulkan.obj
Binary file not shown.
Binary file modified Drizzle3D/x64/Debug/Window.obj
Binary file not shown.
Binary file modified Drizzle3D/x64/Debug/main.obj
Binary file not shown.
Binary file modified Drizzle3D/x64/Debug/vc143.idb
Binary file not shown.
Binary file modified Drizzle3D/x64/Debug/vc143.pdb
Binary file not shown.
4 changes: 4 additions & 0 deletions ExampleProject/ExampleProject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ int main() {
std::cout << "Mouse Moved\n";
});

app->dispatcher()->AddEventListener(Drizzle3D::EventType::ObjectMoved, [](GLFWwindow* window, std::unique_ptr<Drizzle3D::Event> ev, std::any a) {
std::cout << "Object Moved\n";
});

app->dispatcher()->AddEventListener(EWindowClose, Closed);

app->ImguiLayer()->code = ImGUICode;
Expand Down
Binary file modified ExampleProject/vendor/Drizzle3D/Drizzle3D.dll
Binary file not shown.
Binary file modified ExampleProject/vendor/Drizzle3D/Drizzle3D.exp
Binary file not shown.
3 changes: 3 additions & 0 deletions ExampleProject/vendor/Drizzle3D/Drizzle3D.h
Original file line number Diff line number Diff line change
Expand Up @@ -2260,6 +2260,7 @@ namespace Drizzle3D {
Drizzle3D_API void clearKeyReleasedCodes() { keyRel_codes.clear(); }
Drizzle3D_API double returnMouseX() { return lastMouseX; }
Drizzle3D_API double returnMouseY() { return lastMouseY; }
Drizzle3D_API void AddRLayer(std::any rL) { rLayer = rL; }

Drizzle3D_API void ProcessEvents();
Drizzle3D_API void Render();
Expand All @@ -2268,6 +2269,7 @@ namespace Drizzle3D {
private:
GLFWwindow* window = NULL;
RenderingAPI renderingAPI;
std::any rLayer;
int winwidth;
int winheight;
int winx;
Expand Down Expand Up @@ -2449,6 +2451,7 @@ namespace Drizzle3D {
Drizzle3D_API Flags* GetFlags() { return &flags; }
Drizzle3D_API GLuint GetTexture(const char* TexturePath);
Drizzle3D_API VulkanPipeline* getVkPipe() { return &pVulkanPipe; }
Drizzle3D_API std::vector<Object>* getObjects() { return &Objects; }
private:
void InitGlRendering();
void RenderInitGlRendering();
Expand Down
Binary file modified ExampleProject/vendor/Drizzle3D/Drizzle3D.lib
Binary file not shown.
Binary file modified ExampleProject/vendor/Drizzle3D/Drizzle3D.pdb
Binary file not shown.
Binary file modified ExampleProject/x64/Debug/Drizzle3D.dll
Binary file not shown.
Binary file modified ExampleProject/x64/Debug/ExampleProject.exe
Binary file not shown.
Binary file modified ExampleProject/x64/Debug/ExampleProject.ilk
Binary file not shown.
4 changes: 3 additions & 1 deletion ExampleProject/x64/Debug/ExampleProject.log
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
 ExampleProject.cpp
C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets(517,5): warning MSB8004: Output Directory does not end with a trailing slash. This build instance will add the slash as it is required to allow proper evaluation of the Output Directory.
Scanning sources for module dependencies...
ExampleProject.cpp
ExampleProject.vcxproj -> D:\Drizzle3D\ExampleProject\x64\Debug\ExampleProject.exe
Binary file modified ExampleProject/x64/Debug/ExampleProject.obj
Binary file not shown.
Binary file modified ExampleProject/x64/Debug/ExampleProject.pdb
Binary file not shown.
Binary file modified ExampleProject/x64/Debug/vc143.idb
Binary file not shown.
Binary file modified ExampleProject/x64/Debug/vc143.pdb
Binary file not shown.

0 comments on commit ec0068d

Please sign in to comment.