Skip to content

Commit

Permalink
Collider
Browse files Browse the repository at this point in the history
  • Loading branch information
Cherrytree56567 committed May 6, 2024
1 parent ec0068d commit fd17346
Show file tree
Hide file tree
Showing 69 changed files with 156 additions and 104 deletions.
7 changes: 0 additions & 7 deletions Drizzle3D/CollisionDetection.cpp

This file was deleted.

17 changes: 0 additions & 17 deletions Drizzle3D/CollisionDetection.h

This file was deleted.

4 changes: 2 additions & 2 deletions Drizzle3D/Drizzle3D.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<ItemGroup>
<ClCompile Include="App.cpp" />
<ClCompile Include="Camera.cpp" />
<ClCompile Include="CollisionDetection.cpp" />
<ClCompile Include="Physics.cpp" />
<ClCompile Include="Events.cpp" />
<ClCompile Include="FirstPersonCamera.cpp" />
<ClCompile Include="Flags.cpp" />
Expand Down Expand Up @@ -55,7 +55,7 @@
<ClInclude Include="App.h" />
<ClInclude Include="AppEvent.h" />
<ClInclude Include="base.h" />
<ClInclude Include="CollisionDetection.h" />
<ClInclude Include="Physics.h" />
<ClInclude Include="Events.h" />
<ClInclude Include="FirstPersonCamera.h" />
<ClInclude Include="Flags.h" />
Expand Down
14 changes: 7 additions & 7 deletions Drizzle3D/Drizzle3D.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,12 @@
<Filter Include="Source Files\Renderer3D\Renderers\OpenGL">
<UniqueIdentifier>{24491997-d0b6-4f55-b431-bb163eb68d07}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\Collision Detection">
<UniqueIdentifier>{76336790-ba92-4533-91f2-2883e3ab2e66}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\Events\Object">
<UniqueIdentifier>{a959947f-5085-4240-adf6-a20f1de36bbc}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\Physics">
<UniqueIdentifier>{76336790-ba92-4533-91f2-2883e3ab2e66}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="main.cpp">
Expand Down Expand Up @@ -195,8 +195,8 @@
<ClCompile Include="OpenGL.cpp">
<Filter>Source Files\Renderer3D\Renderers\OpenGL</Filter>
</ClCompile>
<ClCompile Include="CollisionDetection.cpp">
<Filter>Source Files\Collision Detection</Filter>
<ClCompile Include="Physics.cpp">
<Filter>Source Files\Physics</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
Expand Down Expand Up @@ -290,8 +290,8 @@
<ClInclude Include="Vulkan.h">
<Filter>Source Files\Renderer3D\Renderers\Vulkan</Filter>
</ClInclude>
<ClInclude Include="CollisionDetection.h">
<Filter>Source Files\Collision Detection</Filter>
<ClInclude Include="Physics.h">
<Filter>Source Files\Physics</Filter>
</ClInclude>
<ClInclude Include="Object.h">
<Filter>Source Files\Events\Object</Filter>
Expand Down
42 changes: 42 additions & 0 deletions Drizzle3D/Physics.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#include "Physics.h"

namespace Drizzle3D {
void Physics::CheckCollision() {
// Create Collision Event
app->dispatcher()->AddEventListener(Drizzle3D::EventType::ObjectMoved, [](GLFWwindow* window, std::unique_ptr<Drizzle3D::Event> ev, std::any a) {
Physics* al = std::any_cast<Physics*>(a);
}, this);
}

void Physics::AddCollider(const char* name, bool isCollider, std::vector<float> verts, std::vector<unsigned int> indecies) {
if (verts == std::vector<float>(NULL) && indecies == std::vector<unsigned int>(NULL)) {
std::vector<float> vertecies;
int i = 0;
while (true) {
if (i > app->GetRenderingLayer()->returnObject(name)->vertices.size()) {
break;
}

vertecies.push_back(app->GetRenderingLayer()->returnObject(name)->vertices[i]);
i++;
vertecies.push_back(app->GetRenderingLayer()->returnObject(name)->vertices[i]);
i++;
vertecies.push_back(app->GetRenderingLayer()->returnObject(name)->vertices[i]);
i += 7;
}
colliders.push_back(std::make_tuple(name, isCollider, vertecies, indecies));
}
else {
colliders.push_back(std::make_tuple(name, isCollider, verts, indecies));
}
}

void Physics::RemoveCollider(std::string name) {
auto it = std::remove_if(colliders.begin(), colliders.end(), [&](const std::tuple<std::string, bool, std::vector<float>, std::vector<unsigned int>>& element) {
return get<0>(element) == name;
});

// Erase the removed elements
colliders.erase(it, colliders.end());
}
}
21 changes: 21 additions & 0 deletions Drizzle3D/Physics.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#pragma once
#include <vector>
#include <string>
#include "base.h"
#include "Events.h"
#include "App.h"
#include "ObjectWindow.h"

namespace Drizzle3D {
class Physics {
public:
Drizzle3D_API Physics(std::shared_ptr<App> ap) : app(ap) {}
Drizzle3D_API void CheckCollision();
Drizzle3D_API void AddCollider(const char* name, bool isCollider, std::vector<float> verts = std::vector<float>(NULL), std::vector<unsigned int> indecies = std::vector<unsigned int>(NULL));
Drizzle3D_API void RemoveCollider(std::string name);

private:
std::vector<std::tuple<std::string, bool, std::vector<float>, std::vector<unsigned int>>> colliders;
std::shared_ptr<App> app;
};
}
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 removed Drizzle3D/x64/Debug/CollisionDetection.obj
Binary file not shown.
102 changes: 52 additions & 50 deletions Drizzle3D/x64/Debug/Drizzle3D.Build.CppClean.log
Original file line number Diff line number Diff line change
@@ -1,51 +1,53 @@
c:\users\ronit\desktop\drizzle3d\drizzle3d\x64\debug\vc143.pdb
c:\users\ronit\desktop\drizzle3d\drizzle3d\x64\debug\vc143.idb
c:\users\ronit\desktop\drizzle3d\drizzle3d\x64\debug\imgui_impl_opengl3.obj
c:\users\ronit\desktop\drizzle3d\drizzle3d\x64\debug\imgui_impl_glfw.obj
c:\users\ronit\desktop\drizzle3d\drizzle3d\x64\debug\skybox.obj
c:\users\ronit\desktop\drizzle3d\drizzle3d\x64\debug\shader.obj
c:\users\ronit\desktop\drizzle3d\drizzle3d\x64\debug\resourcemanager.obj
c:\users\ronit\desktop\drizzle3d\drizzle3d\x64\debug\renderer2d.obj
c:\users\ronit\desktop\drizzle3d\drizzle3d\x64\debug\renderinglayer.obj
c:\users\ronit\desktop\drizzle3d\drizzle3d\x64\debug\opengl.obj
c:\users\ronit\desktop\drizzle3d\drizzle3d\x64\debug\object.obj
c:\users\ronit\desktop\drizzle3d\drizzle3d\x64\debug\material.obj
c:\users\ronit\desktop\drizzle3d\drizzle3d\x64\debug\main.obj
c:\users\ronit\desktop\drizzle3d\drizzle3d\x64\debug\logging.obj
c:\users\ronit\desktop\drizzle3d\drizzle3d\x64\debug\light.obj
c:\users\ronit\desktop\drizzle3d\drizzle3d\x64\debug\layer.obj
c:\users\ronit\desktop\drizzle3d\drizzle3d\x64\debug\imguilayer.obj
c:\users\ronit\desktop\drizzle3d\drizzle3d\x64\debug\flags.obj
c:\users\ronit\desktop\drizzle3d\drizzle3d\x64\debug\firstpersoncamera.obj
c:\users\ronit\desktop\drizzle3d\drizzle3d\x64\debug\events.obj
c:\users\ronit\desktop\drizzle3d\drizzle3d\x64\debug\camera.obj
c:\users\ronit\desktop\drizzle3d\drizzle3d\x64\debug\app.obj
c:\users\ronit\desktop\drizzle3d\drizzle3d\x64\debug\window.obj
c:\users\ronit\desktop\drizzle3d\drizzle3d\x64\debug\vulkan.obj
c:\users\ronit\desktop\drizzle3d\drizzle3d\x64\debug\vkbootstrap.obj
c:\users\ronit\desktop\drizzle3d\drizzle3d\x64\debug\imgui_widgets.obj
c:\users\ronit\desktop\drizzle3d\drizzle3d\x64\debug\imgui_tables.obj
c:\users\ronit\desktop\drizzle3d\drizzle3d\x64\debug\imgui_draw.obj
c:\users\ronit\desktop\drizzle3d\drizzle3d\x64\debug\imgui_demo.obj
c:\users\ronit\desktop\drizzle3d\drizzle3d\x64\debug\imgui.obj
c:\users\ronit\desktop\drizzle3d\drizzle3d\x64\debug\glm.cppm.ifc
c:\users\ronit\desktop\drizzle3d\drizzle3d\x64\debug\glm.cppm.ifc.d.json
c:\users\ronit\desktop\drizzle3d\drizzle3d\x64\debug\glm.cppm.obj
c:\users\ronit\desktop\drizzle3d\drizzle3d\x64\debug\glad.obj
c:\users\ronit\desktop\drizzle3d\exampleproject\vendor\drizzle3d\drizzle3d.dll
c:\users\ronit\desktop\drizzle3d\exampleproject\vendor\drizzle3d\drizzle3d.pdb
d:\drizzle3d\drizzle3d\x64\debug\vc143.pdb
d:\drizzle3d\drizzle3d\x64\debug\vc143.idb
d:\drizzle3d\drizzle3d\x64\debug\imgui_impl_opengl3.obj
d:\drizzle3d\drizzle3d\x64\debug\imgui_impl_glfw.obj
d:\drizzle3d\drizzle3d\x64\debug\skybox.obj
d:\drizzle3d\drizzle3d\x64\debug\shader.obj
d:\drizzle3d\drizzle3d\x64\debug\resourcemanager.obj
d:\drizzle3d\drizzle3d\x64\debug\renderer2d.obj
d:\drizzle3d\drizzle3d\x64\debug\renderinglayer.obj
d:\drizzle3d\drizzle3d\x64\debug\opengl.obj
d:\drizzle3d\drizzle3d\x64\debug\object.obj
d:\drizzle3d\drizzle3d\x64\debug\material.obj
d:\drizzle3d\drizzle3d\x64\debug\main.obj
d:\drizzle3d\drizzle3d\x64\debug\logging.obj
d:\drizzle3d\drizzle3d\x64\debug\light.obj
d:\drizzle3d\drizzle3d\x64\debug\layer.obj
d:\drizzle3d\drizzle3d\x64\debug\imguilayer.obj
d:\drizzle3d\drizzle3d\x64\debug\flags.obj
d:\drizzle3d\drizzle3d\x64\debug\firstpersoncamera.obj
d:\drizzle3d\drizzle3d\x64\debug\events.obj
d:\drizzle3d\drizzle3d\x64\debug\camera.obj
d:\drizzle3d\drizzle3d\x64\debug\app.obj
d:\drizzle3d\drizzle3d\x64\debug\window.obj
d:\drizzle3d\drizzle3d\x64\debug\vulkan.obj
d:\drizzle3d\drizzle3d\x64\debug\vkbootstrap.obj
d:\drizzle3d\drizzle3d\x64\debug\imgui_widgets.obj
d:\drizzle3d\drizzle3d\x64\debug\imgui_tables.obj
d:\drizzle3d\drizzle3d\x64\debug\imgui_draw.obj
d:\drizzle3d\drizzle3d\x64\debug\imgui_demo.obj
d:\drizzle3d\drizzle3d\x64\debug\imgui.obj
d:\drizzle3d\drizzle3d\x64\debug\glm.cppm.ifc
d:\drizzle3d\drizzle3d\x64\debug\glm.cppm.ifc.d.json
d:\drizzle3d\drizzle3d\x64\debug\glm.cppm.obj
d:\drizzle3d\drizzle3d\x64\debug\glad.obj
d:\drizzle3d\exampleproject\vendor\drizzle3d\drizzle3d.dll
d:\drizzle3d\exampleproject\vendor\drizzle3d\drizzle3d.pdb
c:\users\ronit\desktop\drizzle3d\drizzle3d\x64\debug\glm.cppm.module.json
c:\users\ronit\desktop\drizzle3d\exampleproject\vendor\drizzle3d\drizzle3d.lib
c:\users\ronit\desktop\drizzle3d\exampleproject\vendor\drizzle3d\drizzle3d.exp
c:\users\ronit\desktop\drizzle3d\drizzle3d\x64\debug\drizzle3d.ilk
c:\users\ronit\desktop\drizzle3d\drizzle3d\x64\debug\drizzle3d.tlog\cl.command.1.tlog
c:\users\ronit\desktop\drizzle3d\drizzle3d\x64\debug\drizzle3d.tlog\cl.items.tlog
c:\users\ronit\desktop\drizzle3d\drizzle3d\x64\debug\drizzle3d.tlog\cl.read.1.tlog
c:\users\ronit\desktop\drizzle3d\drizzle3d\x64\debug\drizzle3d.tlog\cl.write.1.tlog
c:\users\ronit\desktop\drizzle3d\drizzle3d\x64\debug\drizzle3d.tlog\link.command.1.tlog
c:\users\ronit\desktop\drizzle3d\drizzle3d\x64\debug\drizzle3d.tlog\link.read.1.tlog
c:\users\ronit\desktop\drizzle3d\drizzle3d\x64\debug\drizzle3d.tlog\link.secondary.1.tlog
c:\users\ronit\desktop\drizzle3d\drizzle3d\x64\debug\drizzle3d.tlog\link.write.1.tlog
c:\users\ronit\desktop\drizzle3d\drizzle3d\x64\debug\drizzle3d_md.tlog\cl.command.1.tlog
c:\users\ronit\desktop\drizzle3d\drizzle3d\x64\debug\drizzle3d_md.tlog\microsoft.build.cpptasks.cl.read.1.tlog
c:\users\ronit\desktop\drizzle3d\drizzle3d\x64\debug\drizzle3d_md.tlog\microsoft.build.cpptasks.cl.write.1.tlog
d:\drizzle3d\drizzle3d\x64\debug\glm.cppm.module.json
d:\drizzle3d\exampleproject\vendor\drizzle3d\drizzle3d.lib
d:\drizzle3d\exampleproject\vendor\drizzle3d\drizzle3d.exp
d:\drizzle3d\drizzle3d\x64\debug\drizzle3d.ilk
d:\drizzle3d\drizzle3d\x64\debug\collisiondetection.obj
d:\drizzle3d\drizzle3d\x64\debug\drizzle3d.tlog\cl.command.1.tlog
d:\drizzle3d\drizzle3d\x64\debug\drizzle3d.tlog\cl.items.tlog
d:\drizzle3d\drizzle3d\x64\debug\drizzle3d.tlog\cl.read.1.tlog
d:\drizzle3d\drizzle3d\x64\debug\drizzle3d.tlog\cl.write.1.tlog
d:\drizzle3d\drizzle3d\x64\debug\drizzle3d.tlog\link.command.1.tlog
d:\drizzle3d\drizzle3d\x64\debug\drizzle3d.tlog\link.read.1.tlog
d:\drizzle3d\drizzle3d\x64\debug\drizzle3d.tlog\link.secondary.1.tlog
d:\drizzle3d\drizzle3d\x64\debug\drizzle3d.tlog\link.write.1.tlog
d:\drizzle3d\drizzle3d\x64\debug\drizzle3d_md.tlog\cl.command.1.tlog
d:\drizzle3d\drizzle3d\x64\debug\drizzle3d_md.tlog\microsoft.build.cpptasks.cl.read.1.tlog
d:\drizzle3d\drizzle3d\x64\debug\drizzle3d_md.tlog\microsoft.build.cpptasks.cl.write.1.tlog
Binary file modified Drizzle3D/x64/Debug/Drizzle3D.ilk
Binary file not shown.
8 changes: 8 additions & 0 deletions Drizzle3D/x64/Debug/Drizzle3D.log
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
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...
App.cpp
Physics.cpp
Events.cpp
imgui_impl_glfw.cpp
Window.cpp
Generating Code...
glad.c
Creating library D:\Drizzle3D\ExampleProject\vendor\Drizzle3D\Drizzle3D.lib and object D:\Drizzle3D\ExampleProject\vendor\Drizzle3D\Drizzle3D.exp
LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
Drizzle3D.vcxproj -> D:\Drizzle3D\ExampleProject\vendor\Drizzle3D\Drizzle3D.dll
D:\Drizzle3D\ExampleProject\vendor\Drizzle3D\Drizzle3D.dll
1 File(s) copied
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.
2 changes: 1 addition & 1 deletion Drizzle3D/x64/Debug/Drizzle3D.tlog/Cl.items.tlog
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
D:\Drizzle3D\Drizzle3D\App.cpp;D:\Drizzle3D\Drizzle3D\x64\Debug\App.obj
D:\Drizzle3D\Drizzle3D\Camera.cpp;D:\Drizzle3D\Drizzle3D\x64\Debug\Camera.obj
D:\Drizzle3D\Drizzle3D\CollisionDetection.cpp;D:\Drizzle3D\Drizzle3D\x64\Debug\CollisionDetection.obj
D:\Drizzle3D\Drizzle3D\Physics.cpp;D:\Drizzle3D\Drizzle3D\x64\Debug\Physics.obj
D:\Drizzle3D\Drizzle3D\Events.cpp;D:\Drizzle3D\Drizzle3D\x64\Debug\Events.obj
D:\Drizzle3D\Drizzle3D\FirstPersonCamera.cpp;D:\Drizzle3D\Drizzle3D\x64\Debug\FirstPersonCamera.obj
D:\Drizzle3D\Drizzle3D\Flags.cpp;D:\Drizzle3D\Drizzle3D\x64\Debug\Flags.obj
Expand Down
Binary file modified Drizzle3D/x64/Debug/Drizzle3D.tlog/link.command.1.tlog
Binary file not shown.
Binary file modified Drizzle3D/x64/Debug/Drizzle3D.tlog/link.read.1.tlog
Binary file not shown.
2 chang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\DRIZZLE3D\DRIZZLE3D\X64\DEBUG\IMGUI_IMPL_OPENGL3.OBJ|D:\DRIZZLE3D\DRIZZLE3D\X64\DEBUG\IMGUI_TABLES.OBJ|D:\DRIZZLE3D\DRIZZLE3D\X64\DEBUG\IMGUI_WIDGETS.OBJ|D:\DRIZZLE3D\DRIZZLE3D\X64\DEBUG\LAYER.OBJ|D:\DRIZZLE3D\DRIZZLE3D\X64\DEBUG\LIGHT.OBJ|D:\DRIZZLE3D\DRIZZLE3D\X64\DEBUG\LOGGING.OBJ|D:\DRIZZLE3D\DRIZZLE3D\X64\DEBUG\MAIN.OBJ|D:\DRIZZLE3D\DRIZZLE3D\X64\DEBUG\MATERIAL.OBJ|D:\DRIZZLE3D\DRIZZLE3D\X64\DEBUG\OBJECT.OBJ|D:\DRIZZLE3D\DRIZZLE3D\X64\DEBUG\OPENGL.OBJ|D:\DRIZZLE3D\DRIZZLE3D\X64\DEBUG\PHYSICS.OBJ|D:\DRIZZLE3D\DRIZZLE3D\X64\DEBUG\RENDERER2D.OBJ|D:\DRIZZLE3D\DRIZZLE3D\X64\DEBUG\RENDERINGLAYER.OBJ|D:\DRIZZLE3D\DRIZZLE3D\X64\DEBUG\RESOURCEMANAGER.OBJ|D:\DRIZZLE3D\DRIZZLE3D\X64\DEBUG\SHADER.OBJ|D:\DRIZZLE3D\DRIZZLE3D\X64\DEBUG\SKYBOX.OBJ|D:\DRIZZLE3D\DRIZZLE3D\X64\DEBUG\VKBOOTSTRAP.OBJ|D:\DRIZZLE3D\DRIZZLE3D\X64\DEBUG\VULKAN.OBJ|D:\DRIZZLE3D\DRIZZLE3D\X64\DEBUG\WINDOW.OBJ
D:\Drizzle3D\ExampleProject\vendor\Drizzle3D\Drizzle3D.lib
D:\Drizzle3D\ExampleProject\vendor\Drizzle3D\Drizzle3D.EXP
D:\Drizzle3D\Drizzle3D\x64\Debug\Drizzle3D.ilk
Binary file modified Drizzle3D/x64/Debug/Drizzle3D.tlog/link.write.1.tlog
Binary file not shown.
Binary file modified Drizzle3D/x64/Debug/Drizzle3D_MD.tlog/CL.command.1.tlog
Binary file not shown.
Binary file not shown.
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 added Drizzle3D/x64/Debug/Physics.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/VkBootstrap.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/glad.obj
Binary file not shown.
Binary file modified Drizzle3D/x64/Debug/glm.cppm.obj
Binary file not shown.
Binary file modified Drizzle3D/x64/Debug/imgui.obj
Binary file not shown.
Binary file modified Drizzle3D/x64/Debug/imgui_demo.obj
Binary file not shown.
Binary file modified Drizzle3D/x64/Debug/imgui_draw.obj
Binary file not shown.
Binary file modified Drizzle3D/x64/Debug/imgui_impl_glfw.obj
Binary file not shown.
Binary file modified Drizzle3D/x64/Debug/imgui_impl_opengl3.obj
Binary file not shown.
Binary file modified Drizzle3D/x64/Debug/imgui_tables.obj
Binary file not shown.
Binary file modified Drizzle3D/x64/Debug/imgui_widgets.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.
6 changes: 5 additions & 1 deletion ExampleProject/ExampleProject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ int main() {
Drizzle3D::FirstPersonCamera fpc(app);
Drizzle3D::Skybox sky(app, "skybox.png");
Drizzle3D::Material mat1(app->GetResourceManager(), "Scene1_vertex.glsl", "Scene1_fragment.glsl", app->getRenderingAPI());
Drizzle3D::Physics physics(app);
/*Fix code: float red = 1.0f;
mat1.AddVariableToShader("red", Drizzle3D_FLOAT, &red);*/

Expand All @@ -108,13 +109,16 @@ int main() {
app->GetRenderingLayer()->AddObject("Cube", app->GetRenderingLayer()->DrawVerts(Drizzle3D::LoadObjFile("Scene1_Cube.obj"), modelMatrix));
app->GetRenderingLayer()->returnObject("Cube")->textureID = app->GetRenderingLayer()->GetTexture("duck.png");
app->GetRenderingLayer()->returnObject("Cube")->mat = mat1.GetShaderProgram();
physics.AddCollider("Cube", false);

app->GetRenderingLayer()->AddObject("Plane", app->GetRenderingLayer()->DrawVerts(Drizzle3D::LoadObjFile("Scene1_Plane.obj"), modelMatrix));
app->GetRenderingLayer()->returnObject("Plane")->textureID = app->GetRenderingLayer()->GetTexture("duck.png");
app->GetRenderingLayer()->returnObject("Plane")->hide = true;
app->GetRenderingLayer()->returnObject("Plane")->hide = false;
physics.AddCollider("Plane", true);

app->GetRenderingLayer()->AddObject("Cylinder", app->GetRenderingLayer()->DrawVerts(Drizzle3D::LoadObjFile("Scene1_Cylinder.obj"), modelMatrix));
app->GetRenderingLayer()->returnObject("Cylinder")->textureID = app->GetRenderingLayer()->GetTexture("duck.png");
physics.AddCollider("Cylinder", false);
//app.ImguiLayer()->SetShow(false);

Drizzle3D::Camera aCamera = { glm::vec3(0.0f, 0.0f, 3.0f), glm::vec3(0.0f, 0.0f, 0.0f), glm::vec3(0.0f, 1.0f, 0.0f) };
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.
30 changes: 16 additions & 14 deletions ExampleProject/vendor/Drizzle3D/Drizzle3D.h
Original file line number Diff line number Diff line change
Expand Up @@ -2597,20 +2597,6 @@ namespace Drizzle3D {
RenderingAPI renderingAPI;
};

/*
* Collision Detection
*/

class CollisionDetection {
public:
Drizzle3D_API CollisionDetection(std::vector<std::tuple<std::string, std::vector<float>, std::vector<unsigned int>>> col, std::shared_ptr<EventDispatcher> disp) : colliders(col), dispatcher(disp) {}
Drizzle3D_API void CheckCollision();

private:
std::vector<std::tuple<std::string, std::vector<float>, std::vector<unsigned int>>> colliders;
std::shared_ptr<EventDispatcher> dispatcher;
};

/*
* App
*/
Expand Down Expand Up @@ -2648,6 +2634,22 @@ namespace Drizzle3D {
RenderingAPI renderingAPI;
};

/*
* Physics
*/

class Physics {
public:
Drizzle3D_API Physics(std::shared_ptr<App> ap) : app(ap) {}
Drizzle3D_API void CheckCollision();
Drizzle3D_API void AddCollider(const char* name, bool isCollider, std::vector<float> verts = std::vector<float>(NULL), std::vector<unsigned int> indecies = std::vector<unsigned int>(NULL));
Drizzle3D_API void RemoveCollider(std::string name);

private:
std::vector<std::tuple<std::string, bool, std::vector<float>, std::vector<unsigned int>>> colliders;
std::shared_ptr<App> app;
};

/*
* First Person Camera
*/
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.
5 changes: 1 addition & 4 deletions ExampleProject/x64/Debug/ExampleProject.log
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
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
 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/ExampleProject.tlog/link.read.1.tlog
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 fd17346

Please sign in to comment.