diff --git a/.gitignore b/.gitignore index dd58497..91c614e 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,8 @@ build .git .cache compile_commands.json + + +# Added by cargo + +/target diff --git a/build.c b/build.c index 4bd622a..2605791 100644 --- a/build.c +++ b/build.c @@ -14,10 +14,13 @@ char* include_dirs[] = { #include "tier0/__build.c" #include "tier1/__build.c" + #include "fgui/__build.c" -#include "launcher/__build.c" +#include "rapier/__build.c" #include "engine/__build.c" #include "game/__build.c" + +#include "launcher/__build.c" #include "funnyassets/__build.c" int build(struct build_data b) { @@ -30,6 +33,7 @@ int build(struct build_data b) { tier0_build(b); tier1_build(b); fgui_build(b); + rapier_build(b); engine_build(b); launcher_build(b); diff --git a/engine/__build.c b/engine/__build.c index da3b813..f0573d9 100644 --- a/engine/__build.c +++ b/engine/__build.c @@ -47,6 +47,7 @@ void engine_build(struct build_data b) .include_dirs = include_dirs, }); add_item(&o.files, tier1_lib); + add_item(&o.files, rapierLib); char* libs[] = { "c", diff --git a/engine/brush.cpp b/engine/brush.cpp index 989f410..778a43b 100644 --- a/engine/brush.cpp +++ b/engine/brush.cpp @@ -1,6 +1,8 @@ #include "brush.h" +#include "physics.h" #include "rendering.h" #include "tier0/platform.h" +#include "tier1/utlbuffer.h" #include "tier1/utlvector.h" void CBrushEntity::Precache() @@ -10,7 +12,32 @@ void CBrushEntity::Precache() void CBrushEntity::Spawn() { + CUtlBuffer indicies(m_mesh.GetSize()*3); + for (uint32_t i = 0;i> triangles(m_mesh.GetSize()*3); + uint32_t i = 0; + for (auto tri: m_mesh) + { + V_memcpy(&triangles[i],tri.location,36); + i+=1; + } + V_printf("indicides %i\n",indicies.GetSize()); + V_printf("vertices %i\n",triangles.GetSize()); + px_collider_params params = {}; + params.friction = 0; + m_collider = px_trimesh((Point*)triangles.GetMemory(), triangles.GetSize(), (uint32_t(*)[3])indicies.GetMemory(), indicies.GetSize()/3 ,params); + px_matrix mat = {}; + mat.m[0] = 1; + mat.m[4] = 1; + mat.m[9] = 1; + mat.m[15] = 1; + px_rigidbody_params param = {}; + param.gravity_scale = 1; + m_body = px_staticbody(px, m_collider, mat); }; void CBrushEntity::Destroy() @@ -19,7 +46,6 @@ void CBrushEntity::Destroy() } void CBrushEntity::Think( float fDelta ) { - }; diff --git a/engine/console.cpp b/engine/console.cpp index e0a465b..d8296bb 100644 --- a/engine/console.cpp +++ b/engine/console.cpp @@ -95,7 +95,7 @@ void ConVar::InstallChangeCallback( ConCommandFn ) float ConVar::GetFloat( void ) { - + return m_fValue; } int ConVar::GetInt( void ) { diff --git a/engine/engine.cpp b/engine/engine.cpp index b176098..1181fa0 100644 --- a/engine/engine.cpp +++ b/engine/engine.cpp @@ -7,6 +7,7 @@ #include "engine.h" #include "baseentity.h" #include "server.h" +#include "physics.h" #ifdef __linux #include "signal.h" @@ -48,6 +49,8 @@ void IEngine_Signal(int sig) _exit(0); }; +funnyphysics *px; + void IEngine::Init() { /* trap signals */ @@ -66,6 +69,7 @@ void IEngine::Init() IFileSystem::InitFilesystem(); IVideo::Init(); + px = px_init(); IServer::LoadGame("funnygame"); }; diff --git a/engine/level.cpp b/engine/level.cpp index 2948007..96a2973 100644 --- a/engine/level.cpp +++ b/engine/level.cpp @@ -70,7 +70,6 @@ void ILevel::LoadLevel( const char *szLevelName ) continue; } pBrush->m_mesh = CUtlVector(0); - V_printf("%i\n",pBrush->m_mesh.GetSize()); for ( uint32_t j = 0; jnTriangles; j++ ) { Triangle_t triangle = {}; diff --git a/engine/server.cpp b/engine/server.cpp index d8c638f..563f285 100644 --- a/engine/server.cpp +++ b/engine/server.cpp @@ -2,6 +2,7 @@ #include "tier1/utlstring.h" #include "baseentity.h" #include "console.h" +#include "physics.h" void *g_serverdll; @@ -20,15 +21,16 @@ float g_fAccumulator = 0; void IServer::Think( float fDelta ) { g_fAccumulator += fDelta; - float fTickrate = 1.0/g_tickrate.GetInt(); + float fTickrate = 1.0/g_tickrate.GetFloat(); /* tickrate */ while(g_fAccumulator>=fTickrate) { + g_fAccumulator-=fTickrate; for (auto &entity: g_entities) { entity->Think(fTickrate); - g_fAccumulator-=fTickrate; } + px_frame(px, fTickrate); } for (auto &entity: g_entities) { diff --git a/engine/sv_light.cpp b/engine/sv_light.cpp index 4975853..4ff1527 100644 --- a/engine/sv_light.cpp +++ b/engine/sv_light.cpp @@ -1,4 +1,7 @@ #include "baseentity.h" +#include "cglm/mat4.h" +#include "physics.h" +#include "cglm/cglm.h" class CLight: public CBaseEntity { @@ -6,7 +9,10 @@ public: virtual void Precache ( void ) override; virtual void Spawn( void ) override; virtual void Destroy( void ) override; - virtual void Think( float fDelta ) override; + virtual void Think( float fDelta ) override; +private: + Collider* col; + RigidBodyHandle *m_body; }; void CLight::Precache() @@ -16,7 +22,19 @@ void CLight::Precache() void CLight::Spawn() { - + px_collider_params params = {}; + params.friction = 0; + col = px_box(1, 1, 1, params); + px_matrix mat = {}; + mat.m[0] = 1; + mat.m[4] = 1; + mat.m[9] = 1; + mat.m[15] = 1; + mat.m[3]=-10; + mat.m[11]=10; + px_rigidbody_params param = {}; + param.gravity_scale = 1; + m_body=px_rigidbody(px, col, mat, param); }; void CLight::Destroy() @@ -25,7 +43,8 @@ void CLight::Destroy() } void CLight::Think( float fDelta ) { - + px_vec3 pos = px_getposition(px, m_body); + V_printf("%p %f %f %f\n",col, pos.m[0], pos.m[1], pos.m[2]); }; DECLARE_ENTITY(light, CLight) diff --git a/engine/sv_worldspawn.cpp b/engine/sv_worldspawn.cpp index f5857d4..8517429 100644 --- a/engine/sv_worldspawn.cpp +++ b/engine/sv_worldspawn.cpp @@ -12,21 +12,21 @@ public: void CWorldSpawn::Precache() { - + CBrushEntity::Precache(); } void CWorldSpawn::Spawn() { - + CBrushEntity::Spawn(); }; void CWorldSpawn::Destroy() { - + CBrushEntity::Destroy(); } void CWorldSpawn::Think( float fDelta ) { - + CBrushEntity::Think(fDelta); }; DECLARE_ENTITY(worldspawn, CWorldSpawn) diff --git a/engine/vk_brush.cpp b/engine/vk_brush.cpp index 6f13307..42c6f67 100644 --- a/engine/vk_brush.cpp +++ b/engine/vk_brush.cpp @@ -168,6 +168,7 @@ void IBrushRenderer::Frame( float fDelta ) glm_perspective(glm_rad(90),(float)g_nWindowWidth/g_nWindowHeight, 0.01, 100, g_brushProject->projection); glm_rotate(g_brushProject->projection, glm_rad(90), (vec4){1,0,0,0}); glm_scale(g_brushProject->projection, (vec4){1,-1,1,1}); + glm_rotate(g_brushProject->projection, glm_rad(-90), (vec4){0,0,1,0}); if (g_bConfigNotify) { meshdepth.Destroy(); @@ -199,7 +200,7 @@ void IBrushRenderer::Frame( float fDelta ) { CTexture *texture = (CTexture*)t; VkDescriptorImageInfo image = {}; - image.imageLayout = VK_IMAGE_LAYOUT_GENERAL; + image.imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL; image.imageView = texture->image.m_imageView; image.sampler = g_brushSampler; textures.AppendTail(image); diff --git a/engine/vk_videolinux.cpp b/engine/vk_videolinux.cpp index 0419b22..c8674d6 100644 --- a/engine/vk_videolinux.cpp +++ b/engine/vk_videolinux.cpp @@ -231,6 +231,9 @@ void IVideo::Init() /* select one in vk_gpu */ g_vkPhysicalDevice = PhysicalDevices[vulkan_gpu.GetInt()]; + VkPhysicalDeviceProperties Properties = {}; + vkGetPhysicalDeviceProperties(g_vkPhysicalDevice, &Properties); + V_printf("Using %s\n", Properties.deviceName); /* queue family */ uint32_t nNumQueueFamilies = 0; diff --git a/funnyassets/_rtt/maps/test_map.fmap b/funnyassets/_rtt/maps/test_map.fmap index ea85176..eaba661 100644 Binary files a/funnyassets/_rtt/maps/test_map.fmap and b/funnyassets/_rtt/maps/test_map.fmap differ diff --git a/funnyassets/maps/test_map.fmap b/funnyassets/maps/test_map.fmap index ea85176..eaba661 100644 Binary files a/funnyassets/maps/test_map.fmap and b/funnyassets/maps/test_map.fmap differ diff --git a/funnyassets/raw_maps/dust.map b/funnyassets/raw_maps/dust.map index 354a5ee..cfbb044 100644 --- a/funnyassets/raw_maps/dust.map +++ b/funnyassets/raw_maps/dust.map @@ -1,106 +1,102 @@ { "classname" "worldspawn" { -(-4.000000 8.000000 -2.000000) (-8.000000 8.000000 -2.000000) (-8.000000 8.000000 -4.000000) (6.483328 1.451694) (6.483328 0.190320) (7.114015 0.190320) BRICK0 -(-4.000000 8.000000 -2.000000) (-8.000000 8.000000 -4.000000) (-4.000000 8.000000 -4.000000) (6.483328 1.451694) (7.114015 0.190320) (7.114015 1.451694) BRICK0 -(0.000000 12.000000 -2.000000) (0.000000 14.000000 -2.000000) (-0.300000 14.000000 -2.000000) (0.820848 2.713067) (0.190320 2.713067) (0.190320 2.618464) BRICK0 -(0.000000 12.000000 -2.000000) (-0.300000 14.000000 -2.000000) (-0.300000 12.000000 -2.000000) (0.820848 2.713067) (0.190320 2.618464) (0.820848 2.618464) BRICK0 -(0.000000 6.000000 -4.000000) (4.000000 6.000000 -4.000000) (4.000000 10.000000 -2.000000) (2.726604 2.713067) (2.726604 3.974441) (1.451375 3.974441) BRICK0 -(0.000000 6.000000 -4.000000) (4.000000 10.000000 -2.000000) (0.000000 10.000000 -2.000000) (2.726604 2.713067) (1.451375 3.974441) (1.451375 2.713067) BRICK0 -(0.000000 6.000000 -4.000000) (0.000000 10.000000 -2.000000) (0.000000 6.000000 -2.000000) (6.798353 5.902491) (6.167666 7.163865) (6.167666 5.902491) BRICK0 -(0.000000 12.000000 -2.000000) (4.000000 12.000000 -2.000000) (4.000000 14.000000 -2.000000) (0.820848 2.713067) (0.820848 3.974441) (0.190320 3.974441) BRICK0 -(0.000000 12.000000 -2.000000) (4.000000 14.000000 -2.000000) (0.000000 14.000000 -2.000000) (0.820848 2.713067) (0.190320 3.974441) (0.190320 2.713067) BRICK0 -(-0.300000 12.000000 -2.000000) (-0.300000 14.000000 -2.000000) (-3.700000 14.000000 -2.000000) (0.820848 2.618464) (0.190320 2.618464) (0.190320 1.546297) BRICK0 -(-0.300000 12.000000 -2.000000) (-3.700000 14.000000 -2.000000) (-3.700000 12.000000 -2.000000) (0.820848 2.618464) (0.190320 1.546297) (0.820848 1.546297) BRICK0 -(0.000000 2.000000 -4.000000) (4.000000 2.000000 -4.000000) (4.000000 6.000000 -4.000000) (3.987659 2.713067) (3.987659 3.974441) (2.726604 3.974441) BRICK0 -(0.000000 2.000000 -4.000000) (4.000000 6.000000 -4.000000) (0.000000 6.000000 -4.000000) (3.987659 2.713067) (2.726604 3.974441) (2.726604 2.713067) BRICK0 -(-0.300000 10.000000 -2.000000) (-3.700000 10.000000 -2.000000) (-3.700000 8.300000 -2.000000) (1.451375 2.618464) (1.451375 1.546297) (1.987324 1.546297) BRICK0 -(-0.300000 10.000000 -2.000000) (-3.700000 8.300000 -2.000000) (-0.300000 8.300000 -2.000000) (1.451375 2.618464) (1.987324 1.546297) (1.987324 2.618464) BRICK0 -(-4.000000 6.000000 -4.000000) (-4.000000 8.000000 -4.000000) (-8.000000 8.000000 -4.000000) (2.726604 1.451694) (2.096077 1.451694) (2.096077 0.190320) BRICK0 -(-4.000000 6.000000 -4.000000) (-8.000000 8.000000 -4.000000) (-8.000000 6.000000 -4.000000) (2.726604 1.451694) (2.096077 0.190320) (2.726604 0.190320) BRICK0 -(-4.000000 2.000000 -4.000000) (-4.000000 6.000000 -4.000000) (-8.000000 6.000000 -4.000000) (3.987659 1.451694) (2.726604 1.451694) (2.726604 0.190320) BRICK0 -(-4.000000 2.000000 -4.000000) (-8.000000 6.000000 -4.000000) (-8.000000 2.000000 -4.000000) (3.987659 1.451694) (2.726604 0.190320) (3.987659 0.190320) BRICK0 -(-4.000000 6.000000 -4.000000) (-4.000000 6.000000 -2.000000) (-4.000000 8.000000 -2.000000) (6.325656 2.620692) (6.325656 1.990005) (6.956343 1.990005) BRICK0 -(-4.000000 6.000000 -4.000000) (-4.000000 8.000000 -2.000000) (-4.000000 8.000000 -4.000000) (6.325656 2.620692) (6.956343 1.990005) (6.956343 2.620692) BRICK0 -(0.000000 6.000000 -4.000000) (0.000000 6.000000 -2.000000) (-4.000000 6.000000 -2.000000) (5.156658 7.258468) (4.525971 7.258468) (4.525971 5.997094) BRICK0 -(0.000000 6.000000 -4.000000) (-4.000000 6.000000 -2.000000) (-4.000000 6.000000 -4.000000) (5.156658 7.258468) (4.525971 5.997094) (5.156658 5.997094) BRICK0 -(0.000000 2.000000 -4.000000) (0.000000 6.000000 -4.000000) (-4.000000 6.000000 -4.000000) (3.987659 2.713067) (2.726604 2.713067) (2.726604 1.451694) BRICK0 -(0.000000 2.000000 -4.000000) (-4.000000 6.000000 -4.000000) (-4.000000 2.000000 -4.000000) (3.987659 2.713067) (2.726604 1.451694) (3.987659 1.451694) BRICK0 -(-0.300000 8.300000 -2.000000) (-3.700000 8.300000 -2.000000) (-3.700000 6.300000 -2.000000) (1.987324 2.618464) (1.987324 1.546297) (2.617851 1.546297) BRICK0 -(-0.300000 8.300000 -2.000000) (-3.700000 6.300000 -2.000000) (-0.300000 6.300000 -2.000000) (1.987324 2.618464) (2.617851 1.546297) (2.617851 2.618464) BRICK0 -(-3.700000 8.300000 -2.000000) (-3.700000 10.000000 -2.000000) (-8.000000 10.000000 -2.000000) (1.987324 1.546297) (1.451375 1.546297) (1.451375 0.190320) BRICK0 -(-3.700000 8.300000 -2.000000) (-8.000000 10.000000 -2.000000) (-8.000000 8.300000 -2.000000) (1.987324 1.546297) (1.451375 0.190320) (1.987324 0.190320) BRICK0 -(4.000000 6.000000 -4.000000) (4.000000 2.000000 -4.000000) (6.000000 2.000000 -4.000000) (2.726604 3.974441) (3.987659 3.974441) (3.987659 4.605128) BRICK0 -(4.000000 6.000000 -4.000000) (6.000000 2.000000 -4.000000) (6.000000 6.000000 -4.000000) (2.726604 3.974441) (3.987659 4.605128) (2.726604 4.605128) BRICK0 -(4.000000 6.000000 -4.000000) (6.000000 6.000000 -4.000000) (6.000000 6.000000 -2.000000) (1.451694 6.562484) (0.821007 6.562484) (0.821007 5.931798) BRICK0 -(4.000000 6.000000 -4.000000) (6.000000 6.000000 -2.000000) (4.000000 6.000000 -2.000000) (1.451694 6.562484) (0.821007 5.931798) (1.451694 5.931798) BRICK0 -(6.000000 6.000000 -4.000000) (6.000000 2.000000 -4.000000) (6.000000 2.000000 -2.000000) (7.809680 5.902491) (7.809680 7.163865) (7.178993 7.163865) BRICK0 -(6.000000 6.000000 -4.000000) (6.000000 2.000000 -2.000000) (6.000000 6.000000 -2.000000) (7.809680 5.902491) (7.178993 7.163865) (7.178992 5.902491) BRICK0 -(4.000000 6.000000 -4.000000) (4.000000 6.000000 -2.000000) (4.000000 10.000000 -2.000000) (5.945016 2.713067) (5.314330 2.713067) (5.314329 1.451694) BRICK0 -(-3.700000 10.000000 -2.000000) (-3.700000 12.000000 -2.000000) (-8.000000 12.000000 -2.000000) (1.451375 1.546297) (0.820848 1.546297) (0.820848 0.190320) BRICK0 -(-3.700000 10.000000 -2.000000) (-8.000000 12.000000 -2.000000) (-8.000000 10.000000 -2.000000) (1.451375 1.546297) (0.820848 0.190320) (1.451375 0.190320) BRICK0 -(-0.300000 10.000000 -2.000000) (-0.300000 12.000000 -2.000000) (-3.700000 12.000000 -2.000000) (1.451375 2.618464) (0.820848 2.618464) (0.820848 1.546297) BRICK0 -(-0.300000 10.000000 -2.000000) (-3.700000 12.000000 -2.000000) (-3.700000 10.000000 -2.000000) (1.451375 2.618464) (0.820848 1.546297) (1.451375 1.546297) BRICK0 -(0.000000 10.000000 -2.000000) (4.000000 10.000000 -2.000000) (4.000000 12.000000 -2.000000) (1.451375 2.713067) (1.451375 3.974441) (0.820848 3.974441) BRICK0 -(0.000000 10.000000 -2.000000) (4.000000 12.000000 -2.000000) (0.000000 12.000000 -2.000000) (1.451375 2.713067) (0.820848 3.974441) (0.820848 2.713067) BRICK0 -(0.000000 10.000000 -2.000000) (0.000000 12.000000 -2.000000) (-0.300000 12.000000 -2.000000) (1.451375 2.713067) (0.820848 2.713067) (0.820848 2.618464) BRICK0 -(0.000000 10.000000 -2.000000) (-0.300000 12.000000 -2.000000) (-0.300000 10.000000 -2.000000) (1.451375 2.713067) (0.820848 2.618464) (1.451375 2.618464) BRICK0 -(4.000000 6.000000 -2.000000) (6.000000 6.000000 -2.000000) (6.000000 6.000000 1.000000) (1.451694 5.931798) (0.821007 5.931798) (0.821007 4.985767) BRICK0 -(4.000000 6.000000 -2.000000) (6.000000 6.000000 1.000000) (4.000000 6.000000 1.000000) (1.451694 5.931798) (0.821007 4.985767) (1.451694 4.985767) BRICK0 -(4.000000 12.000000 -2.000000) (4.000000 10.000000 -2.000000) (4.000000 10.000000 1.000000) (5.314329 0.821007) (5.314329 1.451694) (4.368299 1.451694) BRICK0 -(4.000000 12.000000 -2.000000) (4.000000 10.000000 1.000000) (4.000000 12.000000 1.000000) (5.314329 0.821007) (4.368299 1.451694) (4.368299 0.821007) BRICK0 -(4.000000 10.000000 -2.000000) (4.000000 6.000000 -2.000000) (4.000000 6.000000 1.000000) (5.314329 1.451694) (5.314330 2.713067) (4.368299 2.713067) BRICK0 -(4.000000 10.000000 -2.000000) (4.000000 6.000000 1.000000) (4.000000 10.000000 1.000000) (5.314329 1.451694) (4.368299 2.713067) (4.368299 1.451694) BRICK0 -(-0.300000 14.000000 -2.000000) (0.000000 14.000000 -2.000000) (0.000000 14.000000 1.000000) (6.956025 4.165875) (6.956025 4.260478) (6.009995 4.260478) BRICK0 -(-0.300000 14.000000 -2.000000) (0.000000 14.000000 1.000000) (-0.300000 14.000000 1.000000) (6.956025 4.165875) (6.009995 4.260478) (6.009995 4.165875) BRICK0 -(0.000000 14.000000 -2.000000) (4.000000 14.000000 -2.000000) (4.000000 14.000000 1.000000) (6.956025 4.260478) (6.956025 5.521852) (6.009995 5.521852) BRICK0 -(0.000000 14.000000 -2.000000) (4.000000 14.000000 1.000000) (0.000000 14.000000 1.000000) (6.956025 4.260478) (6.009995 5.521852) (6.009995 4.260478) BRICK0 -(4.000000 14.000000 -2.000000) (4.000000 12.000000 -2.000000) (4.000000 12.000000 1.000000) (5.314329 0.190320) (5.314329 0.821007) (4.368299 0.821007) BRICK0 -(4.000000 14.000000 -2.000000) (4.000000 12.000000 1.000000) (4.000000 14.000000 1.000000) (5.314329 0.190320) (4.368299 0.821007) (4.368299 0.190320) BRICK0 -(-8.000000 12.000000 -2.000000) (-3.700000 12.000000 -2.000000) (-3.700000 12.000000 1.000000) (2.778364 4.985768) (2.778364 6.341744) (1.832334 6.341744) BRICK0 -(-8.000000 12.000000 -2.000000) (-3.700000 12.000000 1.000000) (-8.000000 12.000000 1.000000) (2.778364 4.985768) (1.832334 6.341744) (1.832334 4.985768) BRICK0 -(-3.700000 14.000000 -2.000000) (-0.300000 14.000000 -2.000000) (-0.300000 14.000000 1.000000) (6.956025 3.093707) (6.956025 4.165875) (6.009995 4.165875) BRICK0 -(-3.700000 14.000000 -2.000000) (-0.300000 14.000000 1.000000) (-3.700000 14.000000 1.000000) (6.956025 3.093707) (6.009995 4.165875) (6.009994 3.093707) BRICK0 -(-3.700000 12.000000 -2.000000) (-3.700000 14.000000 -2.000000) (-3.700000 14.000000 1.000000) (2.463020 7.668415) (1.832333 7.668415) (1.832333 6.722384) BRICK0 -(-3.700000 12.000000 -2.000000) (-3.700000 14.000000 1.000000) (-3.700000 12.000000 1.000000) (2.463020 7.668415) (1.832333 6.722384) (2.463020 6.722384) BRICK0 -(6.000000 6.000000 1.000000) (6.000000 6.000000 -2.000000) (8.000000 6.000000 -2.000000) (0.821007 4.985767) (0.821007 5.931798) (0.190320 5.931798) BRICK0 -(6.000000 6.000000 1.000000) (8.000000 6.000000 -2.000000) (8.000000 6.000000 1.000000) (0.821007 4.985767) (0.190320 5.931798) (0.190320 4.985767) BRICK0 -(-0.300000 8.300000 -2.000000) (-0.300000 6.300000 -2.000000) (-0.300000 6.300000 -1.500000) (3.854987 5.521851) (3.854987 6.152538) (3.697315 6.152538) BRICK0 -(-0.300000 8.300000 -2.000000) (-0.300000 6.300000 -1.500000) (-0.300000 8.300000 -1.500000) (3.854987 5.521851) (3.697315 6.152538) (3.697315 5.521851) BRICK0 -(-3.700000 8.300000 -2.000000) (-8.000000 8.300000 -2.000000) (-8.000000 8.300000 -1.500000) (3.316675 4.985768) (3.316675 6.341744) (3.159004 6.341744) BRICK0 -(-3.700000 8.300000 -2.000000) (-8.000000 8.300000 -1.500000) (-3.700000 8.300000 -1.500000) (3.316675 4.985768) (3.159004 6.341744) (3.159004 4.985768) BRICK0 -(-4.000000 8.000000 -2.000000) (-4.000000 6.000000 -2.000000) (-4.000000 6.000000 -1.500000) (6.956343 1.990005) (6.325656 1.990005) (6.325656 1.832333) BRICK0 -(-4.000000 8.000000 -2.000000) (-4.000000 6.000000 -1.500000) (-4.000000 8.000000 -1.500000) (6.956343 1.990005) (6.325656 1.832333) (6.956343 1.832333) BRICK0 -(0.000000 10.000000 -2.000000) (-0.300000 10.000000 -2.000000) (-0.300000 10.000000 -1.500000) (2.938263 6.880056) (2.843660 6.880056) (2.843660 6.722384) BRICK0 -(0.000000 10.000000 -2.000000) (-0.300000 10.000000 -1.500000) (0.000000 10.000000 -1.500000) (2.938263 6.880056) (2.843660 6.722384) (2.938263 6.722384) BRICK0 -(-0.300000 6.300000 -2.000000) (-3.700000 6.300000 -2.000000) (-3.700000 6.300000 -1.500000) (7.494336 3.093707) (7.494337 4.165875) (7.336665 4.165875) BRICK0 -(-0.300000 6.300000 -2.000000) (-3.700000 6.300000 -1.500000) (-0.300000 6.300000 -1.500000) (7.494336 3.093707) (7.336665 4.165875) (7.336665 3.093707) BRICK0 -(0.000000 6.000000 -2.000000) (0.000000 10.000000 -2.000000) (0.000000 10.000000 -1.500000) (6.167666 5.902491) (6.167666 7.163865) (6.009995 7.163865) BRICK0 -(0.000000 6.000000 -2.000000) (0.000000 10.000000 -1.500000) (0.000000 6.000000 -1.500000) (6.167666 5.902491) (6.009995 7.163865) (6.009995 5.902491) BRICK0 -(-4.000000 6.000000 -2.000000) (0.000000 6.000000 -2.000000) (0.000000 6.000000 -1.500000) (4.525971 5.997094) (4.525971 7.258468) (4.368299 7.258468) BRICK0 -(-4.000000 6.000000 -2.000000) (0.000000 6.000000 -1.500000) (-4.000000 6.000000 -1.500000) (4.525971 5.997094) (4.368299 7.258468) (4.368299 5.997094) BRICK0 -(-3.700000 6.300000 -2.000000) (-3.700000 8.300000 -2.000000) (-3.700000 8.300000 -1.500000) (3.854987 6.533178) (3.854987 7.163865) (3.697315 7.163865) BRICK0 -(-3.700000 6.300000 -2.000000) (-3.700000 8.300000 -1.500000) (-3.700000 6.300000 -1.500000) (3.854987 6.533178) (3.697315 7.163865) (3.697315 6.533178) BRICK0 -(-8.000000 8.000000 -2.000000) (-4.000000 8.000000 -2.000000) (-4.000000 8.000000 -1.500000) (6.483328 0.190320) (6.483328 1.451694) (6.325656 1.451694) BRICK0 -(-8.000000 8.000000 -2.000000) (-4.000000 8.000000 -1.500000) (-8.000000 8.000000 -1.500000) (6.483328 0.190320) (6.325656 1.451694) (6.325656 0.190320) BRICK0 -(-0.300000 10.000000 -2.000000) (-0.300000 8.300000 -2.000000) (-0.300000 8.300000 -1.500000) (3.854987 4.985767) (3.854987 5.521851) (3.697315 5.521851) BRICK0 -(-0.300000 10.000000 -2.000000) (-0.300000 8.300000 -1.500000) (-0.300000 10.000000 -1.500000) (3.854987 4.985767) (3.697315 5.521851) (3.697315 4.985767) BRICK0 -(-4.000000 8.000000 -1.500000) (-3.700000 8.300000 -1.500000) (-8.000000 8.300000 -1.500000) (4.998827 4.355081) (4.904248 4.449684) (4.904248 3.093707) BRICK0 -(-4.000000 8.000000 -1.500000) (-8.000000 8.300000 -1.500000) (-8.000000 8.000000 -1.500000) (4.998827 4.355081) (4.904248 3.093707) (4.998827 3.093707) BRICK0 -(-4.000000 6.000000 -1.500000) (-3.700000 6.300000 -1.500000) (-3.700000 8.300000 -1.500000) (5.629354 4.355081) (5.534775 4.449684) (4.904248 4.449684) BRICK0 -(-4.000000 6.000000 -1.500000) (-3.700000 8.300000 -1.500000) (-4.000000 8.000000 -1.500000) (5.629354 4.355081) (4.904248 4.449684) (4.998827 4.355081) BRICK0 -(0.000000 6.000000 -1.500000) (-0.300000 6.300000 -1.500000) (-3.700000 6.300000 -1.500000) (5.629354 5.616455) (5.534775 5.521852) (5.534775 4.449684) BRICK0 -(0.000000 6.000000 -1.500000) (-3.700000 6.300000 -1.500000) (-4.000000 6.000000 -1.500000) (5.629354 5.616455) (5.534775 4.449684) (5.629354 4.355081) BRICK0 -(-0.300000 8.300000 -1.500000) (-0.300000 6.300000 -1.500000) (0.000000 6.000000 -1.500000) (4.904248 5.521852) (5.534775 5.521852) (5.629354 5.616455) BRICK0 -(0.000000 6.000000 -1.500000) (0.000000 10.000000 -1.500000) (-0.300000 10.000000 -1.500000) (5.629354 5.616455) (4.368299 5.616455) (4.368299 5.521852) BRICK0 -(-0.300000 8.300000 -1.500000) (0.000000 6.000000 -1.500000) (-0.300000 10.000000 -1.500000) (4.904248 5.521852) (5.629354 5.616455) (4.368299 5.521852) BRICK0 +(-10.000000 -5.999999 -2.000000) (-10.000001 -9.999999 -2.000000) (-10.000001 -9.999999 -4.000000) (6.483328 1.451694) (6.483328 0.190320) (7.114015 0.190320) BRICK0 +(-10.000000 -5.999999 -2.000000) (-10.000001 -9.999999 -4.000000) (-10.000000 -5.999999 -4.000000) (6.483328 1.451694) (7.114015 0.190320) (7.114015 1.451694) BRICK0 +(-14.000000 -1.999999 -2.000000) (-16.000000 -1.999999 -2.000000) (-16.000000 -2.299999 -2.000000) (0.820848 2.713067) (0.190320 2.713067) (0.190320 2.618464) BRICK0 +(-14.000000 -1.999999 -2.000000) (-16.000000 -2.299999 -2.000000) (-14.000000 -2.299999 -2.000000) (0.820848 2.713067) (0.190320 2.618464) (0.820848 2.618464) BRICK0 +(-8.000000 -1.999999 -4.000000) (-8.000000 2.000001 -4.000000) (-12.000000 2.000001 -2.000000) (2.726604 2.713067) (2.726604 3.974441) (1.451375 3.974441) BRICK0 +(-8.000000 -1.999999 -4.000000) (-12.000000 2.000001 -2.000000) (-12.000000 -1.999999 -2.000000) (2.726604 2.713067) (1.451375 3.974441) (1.451375 2.713067) BRICK0 +(-8.000000 -1.999999 -4.000000) (-12.000000 -1.999999 -2.000000) (-8.000000 -1.999999 -2.000000) (6.798353 5.902491) (6.167666 7.163865) (6.167666 5.902491) BRICK0 +(-14.000000 -1.999999 -2.000000) (-14.000000 2.000001 -2.000000) (-16.000000 2.000001 -2.000000) (0.820848 2.713067) (0.820848 3.974441) (0.190320 3.974441) BRICK0 +(-14.000000 -1.999999 -2.000000) (-16.000000 2.000001 -2.000000) (-16.000000 -1.999999 -2.000000) (0.820848 2.713067) (0.190320 3.974441) (0.190320 2.713067) BRICK0 +(-14.000000 -2.299999 -2.000000) (-16.000000 -2.299999 -2.000000) (-16.000000 -5.699999 -2.000000) (0.820848 2.618464) (0.190320 2.618464) (0.190320 1.546297) BRICK0 +(-14.000000 -2.299999 -2.000000) (-16.000000 -5.699999 -2.000000) (-14.000000 -5.699999 -2.000000) (0.820848 2.618464) (0.190320 1.546297) (0.820848 1.546297) BRICK0 +(-4.000000 -2.000000 -4.000000) (-4.000000 2.000000 -4.000000) (-8.000000 2.000001 -4.000000) (3.987659 2.713067) (3.987659 3.974441) (2.726604 3.974441) BRICK0 +(-4.000000 -2.000000 -4.000000) (-8.000000 2.000001 -4.000000) (-8.000000 -1.999999 -4.000000) (3.987659 2.713067) (2.726604 3.974441) (2.726604 2.713067) BRICK0 +(-12.000000 -2.299999 -2.000000) (-12.000000 -5.699999 -2.000000) (-10.300000 -5.699999 -2.000000) (1.451375 2.618464) (1.451375 1.546297) (1.987324 1.546297) BRICK0 +(-12.000000 -2.299999 -2.000000) (-10.300000 -5.699999 -2.000000) (-10.300000 -2.299999 -2.000000) (1.451375 2.618464) (1.987324 1.546297) (1.987324 2.618464) BRICK0 +(-8.000000 -6.000000 -4.000000) (-10.000000 -5.999999 -4.000000) (-10.000001 -9.999999 -4.000000) (2.726604 1.451694) (2.096077 1.451694) (2.096077 0.190320) BRICK0 +(-8.000000 -6.000000 -4.000000) (-10.000001 -9.999999 -4.000000) (-8.000001 -9.999999 -4.000000) (2.726604 1.451694) (2.096077 0.190320) (2.726604 0.190320) BRICK0 +(-4.000000 -6.000000 -4.000000) (-8.000000 -6.000000 -4.000000) (-8.000001 -9.999999 -4.000000) (3.987659 1.451694) (2.726604 1.451694) (2.726604 0.190320) BRICK0 +(-4.000000 -6.000000 -4.000000) (-8.000001 -9.999999 -4.000000) (-4.000000 -10.000000 -4.000000) (3.987659 1.451694) (2.726604 0.190320) (3.987659 0.190320) BRICK0 +(-8.000000 -6.000000 -4.000000) (-8.000000 -6.000000 -2.000000) (-10.000000 -5.999999 -2.000000) (6.325656 2.620692) (6.325656 1.990005) (6.956343 1.990005) BRICK0 +(-8.000000 -6.000000 -4.000000) (-10.000000 -5.999999 -2.000000) (-10.000000 -5.999999 -4.000000) (6.325656 2.620692) (6.956343 1.990005) (6.956343 2.620692) BRICK0 +(-8.000000 -1.999999 -4.000000) (-8.000000 -1.999999 -2.000000) (-8.000000 -6.000000 -2.000000) (5.156658 7.258468) (4.525971 7.258468) (4.525971 5.997094) BRICK0 +(-8.000000 -1.999999 -4.000000) (-8.000000 -6.000000 -2.000000) (-8.000000 -6.000000 -4.000000) (5.156658 7.258468) (4.525971 5.997094) (5.156658 5.997094) BRICK0 +(-4.000000 -2.000000 -4.000000) (-8.000000 -1.999999 -4.000000) (-8.000000 -6.000000 -4.000000) (3.987659 2.713067) (2.726604 2.713067) (2.726604 1.451694) BRICK0 +(-4.000000 -2.000000 -4.000000) (-8.000000 -6.000000 -4.000000) (-4.000000 -6.000000 -4.000000) (3.987659 2.713067) (2.726604 1.451694) (3.987659 1.451694) BRICK0 +(-10.300000 -2.299999 -2.000000) (-10.300000 -5.699999 -2.000000) (-8.300000 -5.699999 -2.000000) (1.987324 2.618464) (1.987324 1.546297) (2.617851 1.546297) BRICK0 +(-10.300000 -2.299999 -2.000000) (-8.300000 -5.699999 -2.000000) (-8.300000 -2.299999 -2.000000) (1.987324 2.618464) (2.617851 1.546297) (2.617851 2.618464) BRICK0 +(-10.300000 -5.699999 -2.000000) (-12.000000 -5.699999 -2.000000) (-12.000001 -9.999999 -2.000000) (1.987324 1.546297) (1.451375 1.546297) (1.451375 0.190320) BRICK0 +(-10.300000 -5.699999 -2.000000) (-12.000001 -9.999999 -2.000000) (-10.300001 -9.999999 -2.000000) (1.987324 1.546297) (1.451375 0.190320) (1.987324 0.190320) BRICK0 +(-8.000000 2.000001 -4.000000) (-4.000000 2.000000 -4.000000) (-4.000000 4.000000 -4.000000) (2.726604 3.974441) (3.987659 3.974441) (3.987659 4.605128) BRICK0 +(-8.000000 2.000001 -4.000000) (-4.000000 4.000000 -4.000000) (-8.000000 4.000000 -4.000000) (2.726604 3.974441) (3.987659 4.605128) (2.726604 4.605128) BRICK0 +(-8.000000 2.000001 -4.000000) (-8.000000 4.000000 -4.000000) (-8.000000 4.000000 -2.000000) (1.451694 6.562484) (0.821007 6.562484) (0.821007 5.931798) BRICK0 +(-8.000000 2.000001 -4.000000) (-8.000000 4.000000 -2.000000) (-8.000000 2.000001 -2.000000) (1.451694 6.562484) (0.821007 5.931798) (1.451694 5.931798) BRICK0 +(-8.000000 4.000000 -4.000000) (-4.000000 4.000000 -4.000000) (-4.000000 4.000000 -2.000000) (7.809680 5.902491) (7.809680 7.163865) (7.178993 7.163865) BRICK0 +(-8.000000 4.000000 -4.000000) (-4.000000 4.000000 -2.000000) (-8.000000 4.000000 -2.000000) (7.809680 5.902491) (7.178993 7.163865) (7.178992 5.902491) BRICK0 +(-8.000000 2.000001 -4.000000) (-8.000000 2.000001 -2.000000) (-12.000000 2.000001 -2.000000) (5.945016 2.713067) (5.314330 2.713067) (5.314329 1.451694) BRICK0 +(-12.000000 -5.699999 -2.000000) (-14.000000 -5.699999 -2.000000) (-14.000001 -9.999999 -2.000000) (1.451375 1.546297) (0.820848 1.546297) (0.820848 0.190320) BRICK0 +(-12.000000 -5.699999 -2.000000) (-14.000001 -9.999999 -2.000000) (-12.000001 -9.999999 -2.000000) (1.451375 1.546297) (0.820848 0.190320) (1.451375 0.190320) BRICK0 +(-12.000000 -2.299999 -2.000000) (-14.000000 -2.299999 -2.000000) (-14.000000 -5.699999 -2.000000) (1.451375 2.618464) (0.820848 2.618464) (0.820848 1.546297) BRICK0 +(-12.000000 -2.299999 -2.000000) (-14.000000 -5.699999 -2.000000) (-12.000000 -5.699999 -2.000000) (1.451375 2.618464) (0.820848 1.546297) (1.451375 1.546297) BRICK0 +(-12.000000 -1.999999 -2.000000) (-12.000000 2.000001 -2.000000) (-14.000000 2.000001 -2.000000) (1.451375 2.713067) (1.451375 3.974441) (0.820848 3.974441) BRICK0 +(-12.000000 -1.999999 -2.000000) (-14.000000 2.000001 -2.000000) (-14.000000 -1.999999 -2.000000) (1.451375 2.713067) (0.820848 3.974441) (0.820848 2.713067) BRICK0 +(-12.000000 -1.999999 -2.000000) (-14.000000 -1.999999 -2.000000) (-14.000000 -2.299999 -2.000000) (1.451375 2.713067) (0.820848 2.713067) (0.820848 2.618464) BRICK0 +(-12.000000 -1.999999 -2.000000) (-14.000000 -2.299999 -2.000000) (-12.000000 -2.299999 -2.000000) (1.451375 2.713067) (0.820848 2.618464) (1.451375 2.618464) BRICK0 +(-8.000000 2.000001 -2.000000) (-8.000000 4.000000 -2.000000) (-8.000000 4.000000 1.000000) (1.451694 5.931798) (0.821007 5.931798) (0.821007 4.985767) BRICK0 +(-8.000000 2.000001 -2.000000) (-8.000000 4.000000 1.000000) (-8.000000 2.000001 1.000000) (1.451694 5.931798) (0.821007 4.985767) (1.451694 4.985767) BRICK0 +(-14.000000 2.000001 -2.000000) (-12.000000 2.000001 -2.000000) (-12.000000 2.000001 1.000000) (5.314329 0.821007) (5.314329 1.451694) (4.368299 1.451694) BRICK0 +(-14.000000 2.000001 -2.000000) (-12.000000 2.000001 1.000000) (-14.000000 2.000001 1.000000) (5.314329 0.821007) (4.368299 1.451694) (4.368299 0.821007) BRICK0 +(-12.000000 2.000001 -2.000000) (-8.000000 2.000001 -2.000000) (-8.000000 2.000001 1.000000) (5.314329 1.451694) (5.314330 2.713067) (4.368299 2.713067) BRICK0 +(-12.000000 2.000001 -2.000000) (-8.000000 2.000001 1.000000) (-12.000000 2.000001 1.000000) (5.314329 1.451694) (4.368299 2.713067) (4.368299 1.451694) BRICK0 +(-16.000000 -2.299999 -2.000000) (-16.000000 -1.999999 -2.000000) (-16.000000 -1.999999 1.000000) (6.956025 4.165875) (6.956025 4.260478) (6.009995 4.260478) BRICK0 +(-16.000000 -2.299999 -2.000000) (-16.000000 -1.999999 1.000000) (-16.000000 -2.299999 1.000000) (6.956025 4.165875) (6.009995 4.260478) (6.009995 4.165875) BRICK0 +(-16.000000 -1.999999 -2.000000) (-16.000000 2.000001 -2.000000) (-16.000000 2.000001 1.000000) (6.956025 4.260478) (6.956025 5.521852) (6.009995 5.521852) BRICK0 +(-16.000000 -1.999999 -2.000000) (-16.000000 2.000001 1.000000) (-16.000000 -1.999999 1.000000) (6.956025 4.260478) (6.009995 5.521852) (6.009995 4.260478) BRICK0 +(-16.000000 2.000001 -2.000000) (-14.000000 2.000001 -2.000000) (-14.000000 2.000001 1.000000) (5.314329 0.190320) (5.314329 0.821007) (4.368299 0.821007) BRICK0 +(-16.000000 2.000001 -2.000000) (-14.000000 2.000001 1.000000) (-16.000000 2.000001 1.000000) (5.314329 0.190320) (4.368299 0.821007) (4.368299 0.190320) BRICK0 +(-14.000001 -9.999999 -2.000000) (-14.000000 -5.699999 -2.000000) (-14.000000 -5.699999 1.000000) (2.778364 4.985768) (2.778364 6.341744) (1.832334 6.341744) BRICK0 +(-14.000001 -9.999999 -2.000000) (-14.000000 -5.699999 1.000000) (-14.000001 -9.999999 1.000000) (2.778364 4.985768) (1.832334 6.341744) (1.832334 4.985768) BRICK0 +(-16.000000 -5.699999 -2.000000) (-16.000000 -2.299999 -2.000000) (-16.000000 -2.299999 1.000000) (6.956025 3.093707) (6.956025 4.165875) (6.009995 4.165875) BRICK0 +(-16.000000 -5.699999 -2.000000) (-16.000000 -2.299999 1.000000) (-16.000000 -5.699999 1.000000) (6.956025 3.093707) (6.009995 4.165875) (6.009994 3.093707) BRICK0 +(-14.000000 -5.699999 -2.000000) (-16.000000 -5.699999 -2.000000) (-16.000000 -5.699999 1.000000) (2.463020 7.668415) (1.832333 7.668415) (1.832333 6.722384) BRICK0 +(-14.000000 -5.699999 -2.000000) (-16.000000 -5.699999 1.000000) (-14.000000 -5.699999 1.000000) (2.463020 7.668415) (1.832333 6.722384) (2.463020 6.722384) BRICK0 +(-8.000000 4.000000 1.000000) (-8.000000 4.000000 -2.000000) (-8.000000 6.000000 -2.000000) (0.821007 4.985767) (0.821007 5.931798) (0.190320 5.931798) BRICK0 +(-8.000000 4.000000 1.000000) (-8.000000 6.000000 -2.000000) (-8.000000 6.000000 1.000000) (0.821007 4.985767) (0.190320 5.931798) (0.190320 4.985767) BRICK0 +(-10.300000 -2.299999 -2.000000) (-8.300000 -2.299999 -2.000000) (-8.300000 -2.299999 -1.500000) (3.854987 5.521851) (3.854987 6.152538) (3.697315 6.152538) BRICK0 +(-10.300000 -2.299999 -2.000000) (-8.300000 -2.299999 -1.500000) (-10.300000 -2.299999 -1.500000) (3.854987 5.521851) (3.697315 6.152538) (3.697315 5.521851) BRICK0 +(-10.300000 -5.699999 -2.000000) (-10.300001 -9.999999 -2.000000) (-10.300001 -9.999999 -1.500000) (3.316675 4.985768) (3.316675 6.341744) (3.159004 6.341744) BRICK0 +(-10.300000 -5.699999 -2.000000) (-10.300001 -9.999999 -1.500000) (-10.300000 -5.699999 -1.500000) (3.316675 4.985768) (3.159004 6.341744) (3.159004 4.985768) BRICK0 +(-10.000000 -5.999999 -2.000000) (-8.000000 -6.000000 -2.000000) (-8.000000 -6.000000 -1.500000) (6.956343 1.990005) (6.325656 1.990005) (6.325656 1.832333) BRICK0 +(-10.000000 -5.999999 -2.000000) (-8.000000 -6.000000 -1.500000) (-10.000000 -5.999999 -1.500000) (6.956343 1.990005) (6.325656 1.832333) (6.956343 1.832333) BRICK0 +(-12.000000 -1.999999 -2.000000) (-12.000000 -2.299999 -2.000000) (-12.000000 -2.299999 -1.500000) (2.938263 6.880056) (2.843660 6.880056) (2.843660 6.722384) BRICK0 +(-12.000000 -1.999999 -2.000000) (-12.000000 -2.299999 -1.500000) (-12.000000 -1.999999 -1.500000) (2.938263 6.880056) (2.843660 6.722384) (2.938263 6.722384) BRICK0 +(-8.300000 -2.299999 -2.000000) (-8.300000 -5.699999 -2.000000) (-8.300000 -5.699999 -1.500000) (7.494336 3.093707) (7.494337 4.165875) (7.336665 4.165875) BRICK0 +(-8.300000 -2.299999 -2.000000) (-8.300000 -5.699999 -1.500000) (-8.300000 -2.299999 -1.500000) (7.494336 3.093707) (7.336665 4.165875) (7.336665 3.093707) BRICK0 +(-8.000000 -1.999999 -2.000000) (-12.000000 -1.999999 -2.000000) (-12.000000 -1.999999 -1.500000) (6.167666 5.902491) (6.167666 7.163865) (6.009995 7.163865) BRICK0 +(-8.000000 -1.999999 -2.000000) (-12.000000 -1.999999 -1.500000) (-8.000000 -1.999999 -1.500000) (6.167666 5.902491) (6.009995 7.163865) (6.009995 5.902491) BRICK0 +(-8.000000 -6.000000 -2.000000) (-8.000000 -1.999999 -2.000000) (-8.000000 -1.999999 -1.500000) (4.525971 5.997094) (4.525971 7.258468) (4.368299 7.258468) BRICK0 +(-8.000000 -6.000000 -2.000000) (-8.000000 -1.999999 -1.500000) (-8.000000 -6.000000 -1.500000) (4.525971 5.997094) (4.368299 7.258468) (4.368299 5.997094) BRICK0 +(-8.300000 -5.699999 -2.000000) (-10.300000 -5.699999 -2.000000) (-10.300000 -5.699999 -1.500000) (3.854987 6.533178) (3.854987 7.163865) (3.697315 7.163865) BRICK0 +(-8.300000 -5.699999 -2.000000) (-10.300000 -5.699999 -1.500000) (-8.300000 -5.699999 -1.500000) (3.854987 6.533178) (3.697315 7.163865) (3.697315 6.533178) BRICK0 +(-10.000001 -9.999999 -2.000000) (-10.000000 -5.999999 -2.000000) (-10.000000 -5.999999 -1.500000) (6.483328 0.190320) (6.483328 1.451694) (6.325656 1.451694) BRICK0 +(-10.000001 -9.999999 -2.000000) (-10.000000 -5.999999 -1.500000) (-10.000001 -9.999999 -1.500000) (6.483328 0.190320) (6.325656 1.451694) (6.325656 0.190320) BRICK0 +(-12.000000 -2.299999 -2.000000) (-10.300000 -2.299999 -2.000000) (-10.300000 -2.299999 -1.500000) (3.854987 4.985767) (3.854987 5.521851) (3.697315 5.521851) BRICK0 +(-12.000000 -2.299999 -2.000000) (-10.300000 -2.299999 -1.500000) (-12.000000 -2.299999 -1.500000) (3.854987 4.985767) (3.697315 5.521851) (3.697315 4.985767) BRICK0 +(-10.000000 -5.999999 -1.500000) (-10.300000 -5.699999 -1.500000) (-10.300001 -9.999999 -1.500000) (4.998827 4.355081) (4.904248 4.449684) (4.904248 3.093707) BRICK0 +(-10.000000 -5.999999 -1.500000) (-10.300001 -9.999999 -1.500000) (-10.000001 -9.999999 -1.500000) (4.998827 4.355081) (4.904248 3.093707) (4.998827 3.093707) BRICK0 +(-8.000000 -6.000000 -1.500000) (-8.300000 -5.699999 -1.500000) (-10.300000 -5.699999 -1.500000) (5.629354 4.355081) (5.534775 4.449684) (4.904248 4.449684) BRICK0 +(-8.000000 -6.000000 -1.500000) (-10.300000 -5.699999 -1.500000) (-10.000000 -5.999999 -1.500000) (5.629354 4.355081) (4.904248 4.449684) (4.998827 4.355081) BRICK0 +(-8.000000 -1.999999 -1.500000) (-8.300000 -2.299999 -1.500000) (-8.300000 -5.699999 -1.500000) (5.629354 5.616455) (5.534775 5.521852) (5.534775 4.449684) BRICK0 +(-8.000000 -1.999999 -1.500000) (-8.300000 -5.699999 -1.500000) (-8.000000 -6.000000 -1.500000) (5.629354 5.616455) (5.534775 4.449684) (5.629354 4.355081) BRICK0 +(-10.300000 -2.299999 -1.500000) (-8.300000 -2.299999 -1.500000) (-8.000000 -1.999999 -1.500000) (4.904248 5.521852) (5.534775 5.521852) (5.629354 5.616455) BRICK0 +(-8.000000 -1.999999 -1.500000) (-12.000000 -1.999999 -1.500000) (-12.000000 -2.299999 -1.500000) (5.629354 5.616455) (4.368299 5.616455) (4.368299 5.521852) BRICK0 +(-10.300000 -2.299999 -1.500000) (-8.000000 -1.999999 -1.500000) (-12.000000 -2.299999 -1.500000) (4.904248 5.521852) (5.629354 5.616455) (4.368299 5.521852) BRICK0 } } { "classname" "light" "intensity" "4.0" } -{ -"classname" "light" -"intensity" "4.0" -} diff --git a/public/brush.h b/public/brush.h index 884a776..06bd018 100644 --- a/public/brush.h +++ b/public/brush.h @@ -4,6 +4,7 @@ #include "tier1/utlvector.h" #include "rendering.h" #include "baseentity.h" +#include "physics.h" class CBrushEntity: public CBaseEntity { @@ -14,6 +15,8 @@ public: virtual void Think( float fDelta ) override; CUtlVector m_mesh; + Collider *m_collider; + RigidBodyHandle *m_body; }; class C_BrushEntity: public C_BaseEntity diff --git a/public/physics.h b/public/physics.h index e69de29..b05bf4d 100644 --- a/public/physics.h +++ b/public/physics.h @@ -0,0 +1,25 @@ +#ifndef PHYSICS_H +#define PHYSICS_H + +#include "tier0/lib.h" +#include "stdint.h" + + +typedef void Collider; +typedef void RigidBodyHandle; + +template +struct Point { + T x, y, z; +}; + +typedef struct u128 { + uint64_t a; + uint64_t b; +} u128; + +#include "physics_gen.h" + +extern funnyphysics *px; + +#endif diff --git a/public/physics_gen.h b/public/physics_gen.h new file mode 100644 index 0000000..2aa56b5 --- /dev/null +++ b/public/physics_gen.h @@ -0,0 +1,96 @@ +#ifndef RAPIER_H +#define RAPIER_H + + + +typedef struct funnyphysics funnyphysics; + +typedef struct px_collider_params { + float friction; +} px_collider_params; + +typedef struct px_vec3 { + float m[3]; +} px_vec3; + +typedef struct px_cast_result { + int8_t hit; + float time; + struct px_vec3 witness1; + struct px_vec3 witness2; + struct px_vec3 normal1; + struct px_vec3 normal2; +} px_cast_result; + +typedef struct px_matrix { + float m[16]; +} px_matrix; + +typedef struct px_rigidbody_params { + float velocity[3]; + float angular_velocity[3]; + float gravity_scale; + float linear_damping; + float angular_damping; + uint8_t continous; + uint8_t sleeping; + uint8_t lockrotx; + uint8_t lockroty; + uint8_t lockrotz; + uint8_t lockposx; + uint8_t lockposy; + uint8_t lockposz; + int8_t dominance; +} px_rigidbody_params; + +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + +Collider *px_ball(float radius, struct px_collider_params params); + +Collider *px_box(float x, float y, float z, struct px_collider_params params); + +struct px_cast_result px_box_cast(struct funnyphysics *px_world, + float x, + float y, + float z, + struct px_vec3 pos, + struct px_vec3 rot, + struct px_vec3 vel, + float time); + +void px_frame(struct funnyphysics *px_world, float delta); + +struct px_matrix px_getmatrix(struct funnyphysics *px_world, RigidBodyHandle *body); + +struct px_vec3 px_getposition(struct funnyphysics *px_world, RigidBodyHandle *body); + +struct px_vec3 px_getvelocity(struct funnyphysics *px_world, RigidBodyHandle *body); + +struct funnyphysics *px_init(void); + +RigidBodyHandle *px_rigidbody(struct funnyphysics *px_world, + Collider *collider, + struct px_matrix m, + struct px_rigidbody_params params); + +void px_setposition(struct funnyphysics *px_world, RigidBodyHandle *body, struct px_vec3 vec); + +void px_setvelocity(struct funnyphysics *px_world, RigidBodyHandle *body, struct px_vec3 vec); + +RigidBodyHandle *px_staticbody(struct funnyphysics *px_world, + Collider *collider, + struct px_matrix m); + +Collider *px_trimesh(const Point *ptr_vert, + size_t len_vert, + const uint32_t (*ptr_ind)[3], + size_t len_ind, + struct px_collider_params params); + +#ifdef __cplusplus +} // extern "C" +#endif // __cplusplus + +#endif /* RAPIER_H */ diff --git a/rapier/.gitignore b/rapier/.gitignore new file mode 100644 index 0000000..a9d37c5 --- /dev/null +++ b/rapier/.gitignore @@ -0,0 +1,2 @@ +target +Cargo.lock diff --git a/rapier/Cargo.toml b/rapier/Cargo.toml new file mode 100644 index 0000000..7a9e98a --- /dev/null +++ b/rapier/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "rapier_rtt" +version = "0.1.0" +edition = "2024" + +[lib] +crate-type = ["staticlib"] +path = "px.rs" + +[dependencies] +parry3d = "*" +rapier3d = { version = "*", features = [ "simd-stable", "parallel" ] } diff --git a/rapier/__build.c b/rapier/__build.c new file mode 100644 index 0000000..f7089f9 --- /dev/null +++ b/rapier/__build.c @@ -0,0 +1,23 @@ +#include "god/c.h" +#include "god/ld.h" +#include "god/utils.h" + +char *rapierLib = NULL; +void rapier_build(struct build_data b) +{ + struct run_project cargo_build = run_new("cargo"); + cargo_build.wd = "rapier"; + run_add_arg(&cargo_build, "build"); + run_add_arg(&cargo_build, "--release"); + run_run(&cargo_build); + struct run_project cbindgen = run_new("cbindgen"); + cbindgen.wd = "rapier"; + run_add_arg(&cbindgen, "--config"); + run_add_arg(&cbindgen, "cbindgen.toml"); + run_add_arg(&cbindgen, "--crate"); + run_add_arg(&cbindgen, "rapier_rtt"); + run_add_arg(&cbindgen, "--output"); + run_add_arg(&cbindgen, "../public/physics_gen.h"); + run_run(&cbindgen); + rapierLib = "rapier/target/release/librapier_rtt.a"; +} diff --git a/rapier/cbindgen.toml b/rapier/cbindgen.toml new file mode 100644 index 0000000..9755ed3 --- /dev/null +++ b/rapier/cbindgen.toml @@ -0,0 +1,160 @@ +# This is a template cbindgen.toml file with all of the default values. +# Some values are commented out because their absence is the real default. +# +# See https://github.com/mozilla/cbindgen/blob/master/docs.md#cbindgentoml +# for detailed documentation of every option here. + + + +language = "C" + + + +############## Options for Wrapping the Contents of the Header ################# + +# header = "/* Text to put at the beginning of the generated file. Probably a license. */" +# trailer = "/* Text to put at the end of the generated file */" +include_guard = "RAPIER_H" +# pragma_once = true +# autogen_warning = "#ifndef PHYSICS_H\n#error \"Do not use physics_gen.h on its own\"\n#endif" +include_version = false +# namespace = "my_namespace" +namespaces = [] +using_namespaces = [] +sys_includes = [] +includes = [] +no_includes = true +cpp_compat = true +after_includes = "" + + + + +############################ Code Style Options ################################ + +braces = "SameLine" +line_length = 100 +tab_width = 2 +documentation = true +documentation_style = "auto" +documentation_length = "full" +line_endings = "LF" # also "CR", "CRLF", "Native" + + + + +############################# Codegen Options ################################## + +style = "both" +sort_by = "Name" # default for `fn.sort_by` and `const.sort_by` +usize_is_size_t = true + + + +[defines] +# "target_os = freebsd" = "DEFINE_FREEBSD" +# "feature = serde" = "DEFINE_SERDE" + + + +[export] +include = [] +exclude = [] +# prefix = "CAPI_" +item_types = [] +renaming_overrides_prefixing = false + + + +[export.rename] + + + +[export.body] + + +[export.mangle] + + +[fn] +rename_args = "None" +# must_use = "MUST_USE_FUNC" +# deprecated = "DEPRECATED_FUNC" +# deprecated_with_note = "DEPRECATED_FUNC_WITH_NOTE" +# no_return = "NO_RETURN" +# prefix = "START_FUNC" +# postfix = "END_FUNC" +args = "auto" +sort_by = "Name" + + + + +[struct] +rename_fields = "None" +# must_use = "MUST_USE_STRUCT" +# deprecated = "DEPRECATED_STRUCT" +# deprecated_with_note = "DEPRECATED_STRUCT_WITH_NOTE" +rename_associated_constant = "None" +derive_constructor = false +derive_eq = false +derive_neq = false +derive_lt = false +derive_lte = false +derive_gt = false +derive_gte = false + + + + +[enum] +rename_variants = "None" +# must_use = "MUST_USE_ENUM" +# deprecated = "DEPRECATED_ENUM" +# deprecated_with_note = "DEPRECATED_ENUM_WITH_NOTE" +add_sentinel = false +prefix_with_name = false +derive_helper_methods = false +derive_const_casts = false +derive_mut_casts = false +# cast_assert_name = "ASSERT" +derive_tagged_enum_destructor = false +derive_tagged_enum_copy_constructor = false +enum_class = true +private_default_tagged_enum_constructor = false + + + + +[const] +allow_static_const = true +allow_constexpr = false +sort_by = "Name" + + + + +[macro_expansion] +bitflags = false + + + + + + +############## Options for How Your Rust library Should Be Parsed ############## + +[parse] +parse_deps = false +# include = [] +exclude = [] +clean = false +extra_bindings = [] + + + +[parse.expand] +crates = [] +all_features = false +default_features = true +features = [] diff --git a/rapier/px.rs b/rapier/px.rs new file mode 100644 index 0000000..390436e --- /dev/null +++ b/rapier/px.rs @@ -0,0 +1,261 @@ + +/* + * Rapier bindings are defined here + * We use crust btw + */ + +extern crate rapier3d; +extern crate parry3d; +use rapier3d::{na::{Isometry, Vector3}, prelude::*, pipeline}; +use self::parry3d::query::*; +use std::num::NonZeroUsize; +use std::arch::asm; + +#[derive(Default)] +pub struct funnyphysics { + rigid_body_set: RigidBodySet, + collider_set: ColliderSet, + + physics_pipeline: PhysicsPipeline, + island_manager: IslandManager, + broad_phase: DefaultBroadPhase, + narrow_phase: NarrowPhase, + impulse_joint_set: ImpulseJointSet, + multibody_joint_set: MultibodyJointSet, + ccd_solver: CCDSolver, + query_pipeline: QueryPipeline, +} + +#[unsafe(no_mangle)] +pub unsafe extern "C" fn px_init() -> *mut funnyphysics { + let mut px = Box::new(funnyphysics::default()); + px.rigid_body_set=RigidBodySet::new(); + px.collider_set=ColliderSet::new(); + + px.physics_pipeline = PhysicsPipeline::new(); + px.island_manager = IslandManager::new(); + px.broad_phase = DefaultBroadPhase::new(); + px.narrow_phase = NarrowPhase::new(); + px.impulse_joint_set = ImpulseJointSet::new(); + px.multibody_joint_set = MultibodyJointSet::new(); + px.ccd_solver = CCDSolver::new(); + px.query_pipeline = QueryPipeline::new(); + + return Box::into_raw(px); +} + +#[unsafe(no_mangle)] +pub unsafe extern "C" fn px_frame(px_world: *mut funnyphysics, delta:f32) { + let gravity = vector![0.0, 0.0, -9.81]; + let mut integration_parameters = IntegrationParameters::default(); + integration_parameters.dt=delta; + integration_parameters.min_island_size=1; + integration_parameters.num_solver_iterations=NonZeroUsize::new(4).unwrap(); + integration_parameters.num_internal_stabilization_iterations=2; + let physics_hooks = (); + let event_handler = (); + if let Some(px) = px_world.as_mut() { + px.physics_pipeline.step( + &gravity, + &integration_parameters, + &mut px.island_manager, + &mut px.broad_phase, + &mut px.narrow_phase, + &mut px.rigid_body_set, + &mut px.collider_set, + &mut px.impulse_joint_set, + &mut px.multibody_joint_set, + &mut px.ccd_solver, + Some(&mut px.query_pipeline), + &physics_hooks, + &event_handler, + ); + }; +} + + +#[repr(C)] +pub struct px_collider_params { + friction:f32 +} +#[unsafe(no_mangle)] +pub unsafe extern "C" fn px_ball(radius:f32, params:px_collider_params) -> *mut Collider { + Box::into_raw(Box::new(ColliderBuilder::ball(radius).friction(params.friction).build())) +} +#[unsafe(no_mangle)] +pub unsafe extern "C" fn px_box(x:f32,y:f32,z:f32, params:px_collider_params) -> *mut Collider { + Box::into_raw(Box::new(ColliderBuilder::cuboid(x, y, z).friction(params.friction).build())) +} +#[unsafe(no_mangle)] +pub unsafe extern "C" fn px_trimesh(ptr_vert: *const Point, len_vert: usize, ptr_ind: *const [u32; 3], len_ind: usize, params:px_collider_params) -> *mut Collider { + let vertices: &[Point] = std::slice::from_raw_parts(ptr_vert, len_vert); + let indices: &[[u32; 3]] = std::slice::from_raw_parts(ptr_ind, len_ind); + + Box::into_raw(Box::new(ColliderBuilder::trimesh(vertices.to_vec(), indices.to_vec()).unwrap().friction(params.friction).build())) +} + +#[unsafe(no_mangle)] +pub unsafe extern "C" fn px_staticbody(px_world: *mut funnyphysics, collider: *mut Collider, m: px_matrix) -> *mut RigidBodyHandle { + let c = &mut *collider; + let px = px_world.as_mut().unwrap(); + let rigid_body = RigidBodyBuilder::fixed() + .translation(vector![m.m[3],m.m[7],m.m[11]]) + .dominance_group(127) + .build(); + let body = px.rigid_body_set.insert(rigid_body); + px.collider_set.insert_with_parent(c.clone(),body,&mut px.rigid_body_set); + Box::into_raw(Box::new(body)) +} + + +#[repr(C)] +pub struct px_matrix { + m: [f32; 16], +} + + +#[repr(C)] +#[derive(Default)] +pub struct px_vec3 { + m: [f32; 3], +} + +#[repr(C)] +pub struct px_rigidbody_params { + velocity: [f32;3], + angular_velocity: [f32;3], + gravity_scale: f32, + linear_damping: f32, + angular_damping: f32, + continous: u8, + sleeping: u8, + + + lockrotx: u8, + lockroty: u8, + lockrotz: u8, + lockposx: u8, + lockposy: u8, + lockposz: u8, + dominance: i8, +} + +#[unsafe(no_mangle)] +pub unsafe extern "C" fn px_rigidbody(px_world: *mut funnyphysics, collider: *mut Collider, m:px_matrix,params:px_rigidbody_params) -> *mut RigidBodyHandle { + let c = &mut *collider; + let px = px_world.as_mut().unwrap(); + let rigid_body = RigidBodyBuilder::dynamic() + .translation(vector![m.m[3],m.m[7],m.m[11]]) + .can_sleep(false) + .gravity_scale(1.0) + .enabled_rotations(params.lockrotx==0, params.lockroty==0, params.lockrotz==0) + .enabled_translations(params.lockposx==0, params.lockposy==0, params.lockposz==0) + .dominance_group(params.dominance) + .linear_damping(0.0) + .angular_damping(0.0) + .build(); + let body = px.rigid_body_set.insert(rigid_body); + px.collider_set.insert_with_parent(c.clone(),body,&mut px.rigid_body_set); + + Box::into_raw(Box::new(body)) +} +#[unsafe(no_mangle)] +pub unsafe extern "C" fn px_getposition(px_world: *mut funnyphysics, body: *mut RigidBodyHandle) -> px_vec3 { + let c = &mut *body; + let px = px_world.as_mut().unwrap(); + let mut m = px_vec3 { m: [0.0,0.0,0.0]}; + let b = &px.rigid_body_set[*c]; + m.m[0]=b.translation().x; + m.m[1]=b.translation().y; + m.m[2]=b.translation().z; + m +} +#[unsafe(no_mangle)] +pub unsafe extern "C" fn px_setposition(px_world: *mut funnyphysics, body: *mut RigidBodyHandle, vec: px_vec3) { + let c = &mut *body; + let px = px_world.as_mut().unwrap(); + let b = &mut px.rigid_body_set[*c]; + b.set_translation(vector![vec.m[0],vec.m[1],vec.m[2]],true); + +} +#[unsafe(no_mangle)] +pub unsafe extern "C" fn px_getvelocity(px_world: *mut funnyphysics, body: *mut RigidBodyHandle) -> px_vec3 { + let c = &mut *body; + let px = px_world.as_mut().unwrap(); + let mut m = px_vec3 { m: [0.0,0.0,0.0]}; + let b = &px.rigid_body_set[*c]; + m.m[0]=b.linvel().x; + m.m[1]=b.linvel().y; + m.m[2]=b.linvel().z; + m +} +#[unsafe(no_mangle)] +pub unsafe extern "C" fn px_setvelocity(px_world: *mut funnyphysics, body: *mut RigidBodyHandle, vec: px_vec3) { + let c = &mut *body; + let px = px_world.as_mut().unwrap(); + let b = &mut px.rigid_body_set[*c]; + b.set_linvel(vector![vec.m[0],vec.m[1],vec.m[2]],true); + +} +#[unsafe(no_mangle)] +pub unsafe extern "C" fn px_getmatrix(px_world: *mut funnyphysics, body: *mut RigidBodyHandle) -> px_matrix { + let c = &mut *body; + let px = px_world.as_mut().unwrap(); + let mut m = px_matrix { m: [ + 1.0,0.0,0.0,0.0, + 0.0,1.0,0.0,0.0, + 0.0,0.0,1.0,0.0, + 0.0,0.0,0.0,1.0, + ]}; + let b = &px.rigid_body_set[*c]; + let mat = b.rotation().to_rotation_matrix(); + m.m[0]=mat[(0,0)]; + m.m[4]=mat[(0,1)]; + m.m[8]=mat[(0,2)]; + m.m[1]=mat[(1,0)]; + m.m[5]=mat[(1,1)]; + m.m[9]=mat[(1,2)]; + m.m[2]=mat[(2,0)]; + m.m[6]=mat[(2,1)]; + m.m[10]=mat[(2,2)]; + m.m[12]=b.translation().x; + m.m[13]=b.translation().y; + m.m[14]=b.translation().z; + m +} + +#[repr(C)] +#[derive(Default)] +pub struct px_cast_result { + hit: i8, + time: f32, + witness1: px_vec3, + witness2: px_vec3, + normal1: px_vec3, + normal2: px_vec3, +} + +#[unsafe(no_mangle)] +pub unsafe extern "C" fn px_box_cast(px_world: *mut funnyphysics, x:f32,y:f32,z:f32, pos:px_vec3, rot: px_vec3, vel: px_vec3, time:f32) -> px_cast_result { + let c = Cuboid::new(vector![x,y,z]); + + let mut res = px_cast_result::default(); + let px = px_world.as_mut().unwrap(); + let filter = QueryFilter::default(); + let options = ShapeCastOptions { + max_time_of_impact: time, + target_distance: 0.0, + stop_at_penetration: false, + compute_impact_geometry_on_penetration: false, + }; + let shape_pos = Isometry { translation: Translation{vector: vector![pos.m[0],pos.m[1],pos.m[2]]}, rotation: Rotation::from_euler_angles(rot.m[0], rot.m[1], rot.m[2])}; + let shape_vel=vector![vel.m[0],vel.m[1],vel.m[2]]; + + if let Some((handle, hit)) = px.query_pipeline.cast_shape( + &px.rigid_body_set, &px.collider_set, &shape_pos, &shape_vel, &c, options, filter + ) { + res.time=hit.time_of_impact; + res.hit = 1; + } + res +} diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..e7a11a9 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + println!("Hello, world!"); +}