From 53c7609e1103e97aff7f0cb2488221a008829eab Mon Sep 17 00:00:00 2001 From: Tobias Dahl Date: Thu, 13 Mar 2014 20:13:28 +0100 Subject: [PATCH 01/21] Smoothare acceleration --- Escape-the-Dawn/Systems/PlayerSystem.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Escape-the-Dawn/Systems/PlayerSystem.cpp b/Escape-the-Dawn/Systems/PlayerSystem.cpp index 6e44d64..377c227 100644 --- a/Escape-the-Dawn/Systems/PlayerSystem.cpp +++ b/Escape-the-Dawn/Systems/PlayerSystem.cpp @@ -108,6 +108,7 @@ void Systems::PlayerSystem::UpdateEntity(double dt, EntityID entity, EntityID pa } else { + transform->Position -= Ship_Right * (float)dt * Euler.z; if(Euler.z < 1.5f && Euler.z > -1.5f) transform->Orientation = glm::angleAxis(0,glm::vec3(0,0,1)); else if(Euler.z < 0.f) From 8f18fc87e3225e3560af89a91fbe77c65c02e375 Mon Sep 17 00:00:00 2001 From: Tobias Dahl Date: Thu, 13 Mar 2014 20:59:25 +0100 Subject: [PATCH 02/21] [WIP] Frames --- Escape-the-Dawn/Frame.cpp | 91 ++++++++++++++++++++++++++++------ Escape-the-Dawn/Frame.h | 23 +++++---- Escape-the-Dawn/GUIManager.cpp | 4 +- Escape-the-Dawn/GUIManager.h | 5 +- Escape-the-Dawn/Rectangle.h | 8 +++ 5 files changed, 103 insertions(+), 28 deletions(-) diff --git a/Escape-the-Dawn/Frame.cpp b/Escape-the-Dawn/Frame.cpp index bf996ed..1c3c753 100644 --- a/Escape-the-Dawn/Frame.cpp +++ b/Escape-the-Dawn/Frame.cpp @@ -3,51 +3,74 @@ GUI::Frame::Frame() { rectangle = new Rectangle(); + texture = nullptr; } int GUI::Frame::GetWidth() { - return rectangle; + return rectangle->Width(); } int GUI::Frame::GetHeight() { - return rectangle.Height(); + return rectangle->Height(); } int GUI::Frame::GetX() { - return rectangle; + return rectangle->X(); } int GUI::Frame::GetY() { - return rectangle.Y(); + return rectangle->Y(); } -void GUI::Frame::SetWidth(int wid) +int GUI::Frame::GetRight() { - rectangle.width(wid); + return rectangle->Right(); } -void GUI::Frame::SetHeight(int hei) +int GUI::Frame::GetLeft() { - rectangle.height(hei); + return rectangle->Left(); } -void GUI::Frame::SetX(int xcord) +int GUI::Frame::GetBottom() { - rectangle.X(xcord) + return rectangle->Bottom(); } -void GUI::Frame::SetY(int ycord) +int GUI::Frame::GetTop() { - rectangle.Y(ycord) + return rectangle->Right(); } +void GUI::Frame::SetWidth(int _width) +{ + rectangle->Width(_width); +} + +void GUI::Frame::SetHeight(int _height) +{ + rectangle->Height(_height); +} + +void GUI::Frame::SetX(int _x) +{ + rectangle->X(_x); +} + +void GUI::Frame::SetY(int _y) +{ + rectangle->Y(_y); +} + + + Rectangle GUI::Frame::AbsouluteRectangle() { - + } bool GUI::Frame::Visible() @@ -85,8 +108,48 @@ void GUI::Frame::Update(double dt) } +void AddChild(GUI::Frame childFrame) +{ + childFrame.Parent = this; + if (!Children.Contains(childFrame)) + Children.Add(childFrame); +} + +/// +/// Remove a child frame from the frame. +/// +/// The child frame to remove. +void RemoveChild(GUI::Frame childFrame) +{ + if (Children.Contains(childFrame)) + Children.Remove(childFrame); +} + +/// +/// Destroys the frame and all its children. +/// +void Destroy() +{ + if (Parent != null) + Parent.RemoveChild(this); + + Manager.Remove(this); +} + +void GUI::Frame::SetTexture(std::string fileName) +{ + //texture == någonTextureIDunno; +} + void GUI::Frame::Draw() { - + if (Visible) + { + if (texture != nullptr) + { + //Drawshit + } + } } + */ \ No newline at end of file diff --git a/Escape-the-Dawn/Frame.h b/Escape-the-Dawn/Frame.h index 2e9a3f4..69dd6d7 100644 --- a/Escape-the-Dawn/Frame.h +++ b/Escape-the-Dawn/Frame.h @@ -1,4 +1,4 @@ -/*#ifndef Frame_h__ +#ifndef Frame_h__ #define Frame_h__ #include @@ -7,7 +7,7 @@ #include "GUIManager.h" #include "Texture.h" #include "Color.h" -//#include "Camera.h" +#include "Camera.h" namespace GUI { @@ -22,14 +22,19 @@ public: int GetHeight(); int GetX(); int GetY(); - void SetWidth(int wid); - void SetHeight(int hei); - void SetX( int xcord); - void SetY(int ycord); + int GetRight(); + int GetLeft(); + int GetBottom(); + int GetTop(); + void SetWidth(int _width); + void SetHeight(int _height); + void SetX( int _x); + void SetY(int _y); + void SetTexture(std::string fileName); Rectangle *rectangle; Rectangle AbsouluteRectangle(); - Texture texture; - Color color; + Texture* texture; + Color* color; bool _Visible; bool Visible(); int layer; @@ -48,4 +53,4 @@ protected: }; } -#endif*/ \ No newline at end of file +#endif \ No newline at end of file diff --git a/Escape-the-Dawn/GUIManager.cpp b/Escape-the-Dawn/GUIManager.cpp index 40b50d3..4956638 100644 --- a/Escape-the-Dawn/GUIManager.cpp +++ b/Escape-the-Dawn/GUIManager.cpp @@ -2,7 +2,7 @@ int GUI::GUIManager::Add(Frame frame) { - //Frame.Add(frame); - //return CreateUID(); + Frame.Add(frame); + return CreateUID(); } */ \ No newline at end of file diff --git a/Escape-the-Dawn/GUIManager.h b/Escape-the-Dawn/GUIManager.h index 7b8434a..57b66a7 100644 --- a/Escape-the-Dawn/GUIManager.h +++ b/Escape-the-Dawn/GUIManager.h @@ -1,4 +1,4 @@ -/*#ifndef GUIManager_h__ +#ifndef GUIManager_h__ #define GUIManager_h__ #include "Frame.h" @@ -18,9 +18,8 @@ private: static int uidIndex; }; - } -#endif */ \ No newline at end of file +#endif \ No newline at end of file diff --git a/Escape-the-Dawn/Rectangle.h b/Escape-the-Dawn/Rectangle.h index 2f6d0cd..d866955 100644 --- a/Escape-the-Dawn/Rectangle.h +++ b/Escape-the-Dawn/Rectangle.h @@ -22,6 +22,14 @@ public: int Y() const { return y; } void Y(int val) { y = val; } + + int Left() const { return x; } + + int Right() const { return x+width; } + + int Top() const { return y; } + + int Bottom() const { return y+height; } }; Rectangle::Rectangle() From d6a0cdca58a4db943981bfa56fb358e45b255693 Mon Sep 17 00:00:00 2001 From: ViktorLjung Date: Thu, 13 Mar 2014 20:59:45 +0100 Subject: [PATCH 03/21] Missing powerup.obj --- Escape-the-Dawn/Models/powerup.obj | 1074 ++++++++++++++++++++++++++++ 1 file changed, 1074 insertions(+) create mode 100644 Escape-the-Dawn/Models/powerup.obj diff --git a/Escape-the-Dawn/Models/powerup.obj b/Escape-the-Dawn/Models/powerup.obj new file mode 100644 index 0000000..216bc9d --- /dev/null +++ b/Escape-the-Dawn/Models/powerup.obj @@ -0,0 +1,1074 @@ +# Blender v2.69 (sub 0) OBJ File: 'powerup.blend' +# www.blender.org +mtllib powerup.mtl +o Circle_Circle.004 +v 0.000000 8.004904 0.106887 +v -0.780361 7.928044 0.106887 +v -1.530734 7.700421 0.106887 +v -2.222281 7.330782 0.106887 +v -2.828427 6.833330 0.106887 +v -3.325878 6.227184 0.106887 +v -3.695518 5.535637 0.106887 +v -3.923141 4.785265 0.106887 +v -4.000000 4.004904 0.106887 +v -3.923141 3.224543 0.106887 +v -3.695518 2.474170 0.106887 +v -3.325878 1.782623 0.106887 +v -2.828427 1.176476 0.106887 +v -2.222280 0.679025 0.106887 +v -1.530733 0.309385 0.106887 +v -0.780360 0.081762 0.106887 +v 0.000002 0.004904 0.106887 +v 0.780363 0.081763 0.106887 +v 1.530736 0.309386 0.106887 +v 2.222283 0.679026 0.106887 +v 2.828429 1.176478 0.106887 +v 3.325881 1.782625 0.106887 +v 3.695520 2.474173 0.106887 +v 3.923142 3.224545 0.106887 +v 4.000000 4.004907 0.106887 +v 3.923141 4.785269 0.106887 +v 3.695517 5.535641 0.106887 +v 3.325876 6.227188 0.106887 +v 2.828424 6.833334 0.106887 +v 2.222277 7.330785 0.106887 +v 1.530728 7.700424 0.106887 +v 0.780356 7.928045 0.106887 +v 0.000000 8.004904 -0.259439 +v -0.780361 7.928044 -0.259439 +v -1.530734 7.700421 -0.259439 +v -2.222281 7.330782 -0.259439 +v -2.828427 6.833330 -0.259439 +v -3.325878 6.227184 -0.259439 +v -3.695518 5.535637 -0.259439 +v -3.923141 4.785265 -0.259439 +v -4.000000 4.004904 -0.259439 +v -3.923141 3.224543 -0.259439 +v -3.695518 2.474170 -0.259439 +v -3.325878 1.782623 -0.259439 +v -2.828427 1.176476 -0.259439 +v -2.222280 0.679025 -0.259439 +v -1.530733 0.309385 -0.259439 +v -0.780360 0.081762 -0.259439 +v 0.000002 0.004904 -0.259439 +v 0.780363 0.081763 -0.259439 +v 1.530736 0.309386 -0.259439 +v 2.222283 0.679026 -0.259439 +v 2.828429 1.176478 -0.259439 +v 3.325881 1.782625 -0.259439 +v 3.695520 2.474173 -0.259439 +v 3.923142 3.224545 -0.259439 +v 4.000000 4.004907 -0.259439 +v 3.923141 4.785269 -0.259439 +v 3.695517 5.535641 -0.259439 +v 3.325876 6.227188 -0.259439 +v 2.828424 6.833334 -0.259439 +v 2.222277 7.330785 -0.259439 +v 1.530728 7.700424 -0.259439 +v 0.780356 7.928045 -0.259439 +v 0.000000 7.582003 0.087522 +v -0.697857 7.513269 0.087522 +v -1.368897 7.309712 0.087522 +v -1.987330 6.979153 0.087522 +v -2.529391 6.534294 0.087522 +v -2.974249 5.992233 0.087522 +v -3.304808 5.373800 0.087522 +v -3.508366 4.702761 0.087522 +v -3.577099 4.004904 0.087522 +v -3.508366 3.307046 0.087522 +v -3.304808 2.636007 0.087522 +v -2.974249 2.017574 0.087522 +v -2.529391 1.475513 0.087522 +v -1.987329 1.030654 0.087522 +v -1.368896 0.700094 0.087522 +v -0.697856 0.496537 0.087522 +v 0.000001 0.427805 0.087522 +v 0.697859 0.496538 0.087522 +v 1.368898 0.700096 0.087522 +v 1.987332 1.030655 0.087522 +v 2.529393 1.475514 0.087522 +v 2.974251 2.017576 0.087522 +v 3.304810 2.636010 0.087522 +v 3.508367 3.307049 0.087522 +v 3.577100 4.004907 0.087522 +v 3.508366 4.702765 0.087522 +v 3.304807 5.373804 0.087522 +v 2.974247 5.992237 0.087522 +v 2.529388 6.534298 0.087522 +v 1.987326 6.979156 0.087522 +v 1.368892 7.309714 0.087522 +v 0.697852 7.513270 0.087522 +v 0.000000 7.582003 -0.240075 +v -0.697857 7.513269 -0.240075 +v -1.368897 7.309712 -0.240075 +v -1.987330 6.979153 -0.240075 +v -2.529391 6.534294 -0.240075 +v -2.974249 5.992233 -0.240074 +v -3.304808 5.373800 -0.240074 +v -3.508366 4.702761 -0.240074 +v -3.577099 4.004904 -0.240074 +v -3.508366 3.307046 -0.240074 +v -3.304808 2.636007 -0.240074 +v -2.974249 2.017574 -0.240074 +v -2.529391 1.475513 -0.240074 +v -1.987329 1.030654 -0.240074 +v -1.368896 0.700094 -0.240074 +v -0.697856 0.496537 -0.240074 +v 0.000001 0.427805 -0.240074 +v 0.697859 0.496538 -0.240074 +v 1.368898 0.700096 -0.240074 +v 1.987332 1.030655 -0.240074 +v 2.529393 1.475514 -0.240074 +v 2.974251 2.017576 -0.240074 +v 3.304810 2.636010 -0.240074 +v 3.508367 3.307049 -0.240074 +v 3.577100 4.004907 -0.240074 +v 3.508366 4.702765 -0.240074 +v 3.304807 5.373804 -0.240074 +v 2.974247 5.992237 -0.240074 +v 2.529388 6.534298 -0.240075 +v 1.987326 6.979156 -0.240075 +v 1.368892 7.309714 -0.240075 +v 0.697852 7.513270 -0.240075 +v 1.379748 5.716118 0.229631 +v 1.379748 5.999430 0.229630 +v 1.379748 4.259961 0.229631 +v 1.379748 4.543272 0.229630 +v 1.379748 2.803804 0.229631 +v 1.379748 3.087115 0.229630 +v 1.379748 1.279338 0.229631 +v 1.379748 1.562650 0.229630 +v -1.379748 5.716118 0.229631 +v 0.000000 6.535820 0.229631 +v -1.379748 5.999430 0.229630 +v 0.000000 7.126520 0.229630 +v -1.379748 4.259961 0.229631 +v 0.000000 5.079663 0.229631 +v -1.379748 4.543272 0.229630 +v 0.000000 5.670363 0.229630 +v -1.379748 2.803804 0.229631 +v 0.000000 3.623506 0.229631 +v -1.379748 3.087115 0.229630 +v 0.000000 4.214206 0.229630 +v -1.379748 1.279338 0.229631 +v 0.000000 2.099041 0.229631 +v -1.379748 1.562650 0.229630 +v 0.000000 2.689741 0.229630 +v 1.379748 5.716118 -0.384142 +v 1.379748 5.999430 -0.384142 +v 1.379748 4.259961 -0.384142 +v 1.379748 4.543272 -0.384142 +v 1.379748 2.803804 -0.384142 +v 1.379748 3.087115 -0.384142 +v 1.379748 1.279338 -0.384142 +v 1.379748 1.562650 -0.384142 +v -1.379748 5.716118 -0.384142 +v 0.000000 6.535820 -0.384142 +v -1.379748 5.999430 -0.384142 +v 0.000000 7.126520 -0.384142 +v -1.379748 4.259961 -0.384142 +v 0.000000 5.079663 -0.384142 +v -1.379748 4.543272 -0.384142 +v 0.000000 5.670363 -0.384142 +v -1.379748 2.803804 -0.384142 +v 0.000000 3.623506 -0.384142 +v -1.379748 3.087115 -0.384142 +v 0.000000 4.214206 -0.384142 +v -1.379748 1.279338 -0.384142 +v 0.000000 2.099041 -0.384142 +v -1.379748 1.562650 -0.384142 +v 0.000000 2.689741 -0.384142 +vt 0.333915 0.101308 +vt 0.307015 0.101308 +vt 0.333915 0.052061 +vt 0.333915 0.256153 +vt 0.360814 0.256153 +vt 0.333915 0.313635 +vt 0.389787 0.500214 +vt 0.389787 0.527113 +vt 0.341933 0.500214 +vt 0.333915 0.212345 +vt 0.307015 0.212345 +vt 0.333915 0.155429 +vt 0.333915 0.144733 +vt 0.360814 0.144733 +vt 0.333915 0.199122 +vt 0.061505 0.548314 +vt 0.061505 0.575214 +vt 0.017116 0.548314 +vt 0.333915 0.325788 +vt 0.307015 0.325788 +vt 0.333915 0.269868 +vt 0.360814 0.052061 +vt 0.333915 0.095077 +vt 0.167242 0.548314 +vt 0.167242 0.575214 +vt 0.112197 0.548314 +vt 0.333915 0.424366 +vt 0.307015 0.424366 +vt 0.333915 0.377955 +vt 0.281846 0.548314 +vt 0.281846 0.575214 +vt 0.224525 0.548314 +vt 0.118225 0.500214 +vt 0.118225 0.527113 +vt 0.065013 0.500214 +vt 0.333915 0.421183 +vt 0.360814 0.421183 +vt 0.333915 0.467116 +vt 0.387870 0.548314 +vt 0.387870 0.575214 +vt 0.337001 0.548314 +vt 0.232285 0.500214 +vt 0.232285 0.527113 +vt 0.174705 0.500214 +vt 0.360814 0.313635 +vt 0.333915 0.369359 +vt 0.341933 0.527113 +vt 0.288751 0.500214 +vt 0.307015 0.155429 +vt 0.360814 0.199122 +vt 0.430475 0.500214 +vt 0.430475 0.527113 +vt 0.307015 0.269868 +vt 0.360814 0.095077 +vt 0.112197 0.575214 +vt 0.307015 0.377955 +vt 0.224525 0.575214 +vt 0.065013 0.527113 +vt 0.017116 0.500214 +vt 0.333915 0.463236 +vt 0.307015 0.463236 +vt 0.337001 0.575214 +vt 0.174705 0.527113 +vt 0.360814 0.369359 +vt 0.432500 0.548314 +vt 0.432500 0.575214 +vt 0.288751 0.527113 +vt 0.360814 0.094894 +vt 0.384870 0.094894 +vt 0.223103 0.604613 +vt 0.274330 0.604613 +vt 0.223103 0.628669 +vt 0.384870 0.386957 +vt 0.384870 0.345453 +vt 0.408925 0.386957 +vt 0.360814 0.192989 +vt 0.360814 0.142480 +vt 0.384870 0.192989 +vt 0.122519 0.604613 +vt 0.171842 0.604613 +vt 0.122519 0.628669 +vt 0.261750 0.126208 +vt 0.261750 0.085132 +vt 0.285805 0.126208 +vt 0.360814 0.294977 +vt 0.360814 0.244481 +vt 0.384870 0.294977 +vt 0.037116 0.604613 +vt 0.077027 0.604613 +vt 0.037116 0.628669 +vt 0.261750 0.222386 +vt 0.261750 0.172553 +vt 0.285805 0.222386 +vt 0.360814 0.385331 +vt 0.360814 0.342536 +vt 0.384870 0.385331 +vt 0.261750 0.324792 +vt 0.261750 0.273791 +vt 0.285805 0.324792 +vt 0.384870 0.146454 +vt 0.384870 0.098055 +vt 0.408925 0.146454 +vt 0.368887 0.604613 +vt 0.408584 0.604613 +vt 0.368887 0.628669 +vt 0.261750 0.417837 +vt 0.261750 0.373431 +vt 0.285805 0.417837 +vt 0.384870 0.248794 +vt 0.384870 0.197352 +vt 0.408925 0.248794 +vt 0.323555 0.604613 +vt 0.274330 0.628669 +vt 0.384870 0.298801 +vt 0.408925 0.345453 +vt 0.384870 0.142480 +vt 0.171842 0.628669 +vt 0.384870 0.421717 +vt 0.408925 0.421717 +vt 0.384870 0.244481 +vt 0.077027 0.628669 +vt 0.285805 0.172553 +vt 0.384870 0.342536 +vt 0.285805 0.273791 +vt 0.384870 0.054014 +vt 0.408925 0.098055 +vt 0.360814 0.421717 +vt 0.285805 0.373431 +vt 0.408925 0.197352 +vt 0.323555 0.628669 +vt 0.261750 0.456305 +vt 0.285805 0.456305 +vt 0.408925 0.298801 +vt 0.046693 0.167825 +vt 0.037096 0.153462 +vt 0.053894 0.161915 +vt 0.024616 0.355945 +vt 0.024616 0.338671 +vt 0.033887 0.355032 +vt 0.192520 0.070386 +vt 0.199130 0.086345 +vt 0.184304 0.074778 +vt 0.196631 0.321729 +vt 0.200000 0.338671 +vt 0.187716 0.324434 +vt 0.046693 0.056023 +vt 0.058907 0.043809 +vt 0.053894 0.061934 +vt 0.103671 0.259616 +vt 0.120945 0.259616 +vt 0.104584 0.268887 +vt 0.170709 0.180039 +vt 0.156346 0.189636 +vt 0.164799 0.172838 +vt 0.073270 0.034212 +vt 0.089229 0.027602 +vt 0.077662 0.042428 +vt 0.137887 0.431631 +vt 0.120945 0.435001 +vt 0.135183 0.422716 +vt 0.027986 0.321729 +vt 0.036901 0.324434 +vt 0.058907 0.180039 +vt 0.064817 0.172838 +vt 0.182923 0.056023 +vt 0.175722 0.061934 +vt 0.200000 0.355945 +vt 0.190729 0.339584 +vt 0.037096 0.070386 +vt 0.045312 0.074778 +vt 0.137887 0.262986 +vt 0.120032 0.268887 +vt 0.182923 0.167825 +vt 0.175722 0.161915 +vt 0.103671 0.435001 +vt 0.120032 0.425729 +vt 0.034596 0.305770 +vt 0.073270 0.189636 +vt 0.077662 0.181420 +vt 0.170709 0.043809 +vt 0.164799 0.051010 +vt 0.196630 0.372887 +vt 0.190729 0.355032 +vt 0.030486 0.086345 +vt 0.039401 0.089050 +vt 0.153846 0.269596 +vt 0.135183 0.271901 +vt 0.192520 0.153462 +vt 0.184304 0.149071 +vt 0.086729 0.431631 +vt 0.104584 0.425729 +vt 0.044193 0.291407 +vt 0.042812 0.310162 +vt 0.089229 0.196247 +vt 0.091933 0.187332 +vt 0.156346 0.034212 +vt 0.151954 0.042428 +vt 0.190020 0.388846 +vt 0.187715 0.370183 +vt 0.027116 0.103287 +vt 0.036387 0.104200 +vt 0.168209 0.279193 +vt 0.149454 0.277812 +vt 0.199130 0.137503 +vt 0.070770 0.425020 +vt 0.075162 0.416804 +vt 0.056407 0.279193 +vt 0.051394 0.297318 +vt 0.106171 0.199617 +vt 0.107084 0.190345 +vt 0.140387 0.027602 +vt 0.137683 0.036517 +vt 0.180423 0.403209 +vt 0.181804 0.384454 +vt 0.027116 0.120561 +vt 0.036387 0.119648 +vt 0.180423 0.291407 +vt 0.162299 0.286394 +vt 0.202500 0.120561 +vt 0.193229 0.119648 +vt 0.056407 0.415423 +vt 0.062317 0.408222 +vt 0.070770 0.269596 +vt 0.062318 0.286394 +vt 0.123445 0.199617 +vt 0.123445 0.024232 +vt 0.122532 0.033503 +vt 0.168209 0.415423 +vt 0.162299 0.408222 +vt 0.034596 0.388846 +vt 0.027986 0.372887 +vt 0.036901 0.370183 +vt 0.030486 0.137503 +vt 0.039401 0.134799 +vt 0.202500 0.103287 +vt 0.193229 0.104200 +vt 0.190020 0.305770 +vt 0.173222 0.297318 +vt 0.044193 0.403209 +vt 0.051394 0.397299 +vt 0.086729 0.262986 +vt 0.075162 0.277812 +vt 0.140387 0.196247 +vt 0.122532 0.190345 +vt 0.106171 0.024232 +vt 0.107084 0.033503 +vt 0.153846 0.425020 +vt 0.149454 0.416804 +vt 0.190215 0.089050 +vt 0.181804 0.310162 +vt 0.151954 0.181420 +vt 0.089433 0.271901 +vt 0.091933 0.036517 +vt 0.599966 0.847355 +vt 0.599966 0.890731 +vt 0.498650 0.787164 +vt 0.607466 0.397224 +vt 0.607466 0.440599 +vt 0.506150 0.337032 +vt 0.594031 0.699340 +vt 0.594031 0.742715 +vt 0.492715 0.639149 +vt 0.598899 0.762906 +vt 0.598899 0.806282 +vt 0.497584 0.702715 +vt 0.701282 0.787164 +vt 0.708782 0.337032 +vt 0.695347 0.639149 +vt 0.700215 0.702715 +vt 0.603432 0.922307 +vt 0.704748 0.862116 +vt 0.603432 0.965683 +vt 0.601399 0.472224 +vt 0.702715 0.412032 +vt 0.601399 0.515599 +vt 0.595932 0.621241 +vt 0.697248 0.561049 +vt 0.595932 0.664616 +vt 0.591399 0.552355 +vt 0.692715 0.492164 +vt 0.591399 0.595731 +vt 0.502116 0.862116 +vt 0.500084 0.412032 +vt 0.494616 0.561049 +vt 0.490084 0.492164 +vt 0.836819 0.129536 +vt 0.836819 0.144822 +vt 0.791750 0.129536 +vt 0.852601 0.395980 +vt 0.867263 0.395980 +vt 0.852601 0.441049 +vt 0.980884 0.784217 +vt 0.980884 0.901393 +vt 0.935814 0.784217 +vt 0.881925 0.395980 +vt 0.867263 0.441049 +vt 0.851414 0.468669 +vt 0.965711 0.468669 +vt 0.851414 0.513739 +vt 0.935884 0.773568 +vt 0.935884 0.656393 +vt 0.980954 0.773568 +vt 0.979459 0.616499 +vt 0.979459 0.747322 +vt 0.934389 0.616499 +vt 0.836819 0.015286 +vt 0.881889 0.144822 +vt 0.742178 0.833005 +vt 0.873000 0.833005 +vt 0.742178 0.878074 +vt 0.842116 0.938669 +vt 0.956414 0.938669 +vt 0.842116 0.983739 +vt 0.836819 0.000000 +vt 0.881889 0.015286 +vt 0.862178 0.913005 +vt 0.862178 0.783469 +vt 0.907248 0.913005 +vt 0.832601 0.861049 +vt 0.817939 0.861049 +vt 0.832601 0.815980 +vt 0.987298 0.833005 +vt 0.873000 0.878074 +vt 0.896587 0.395980 +vt 0.881925 0.441049 +vt 0.862178 0.768183 +vt 0.907248 0.783469 +vt 0.980954 0.539217 +vt 0.980954 0.656393 +vt 0.935884 0.539217 +vt 0.928183 0.438005 +vt 0.928183 0.308469 +vt 0.973252 0.438005 +vt 0.926959 0.131174 +vt 0.926959 0.013999 +vt 0.972028 0.131174 +vt 0.787248 0.787935 +vt 0.901545 0.787935 +vt 0.787248 0.833005 +vt 0.769616 0.575980 +vt 0.900439 0.575980 +vt 0.769616 0.621049 +vt 0.928183 0.293183 +vt 0.973252 0.308469 +vt 0.935884 0.656425 +vt 0.935884 0.787248 +vt 0.890814 0.656425 +vt 0.791750 0.000000 +vt 0.307015 0.052061 +vt 0.017116 0.575214 +vt 0.360814 0.467116 +vt 0.017116 0.527113 +vt 0.384870 0.052061 +vt 0.285805 0.085132 +vt 0.408584 0.628669 +vt 0.408925 0.054014 +vt 0.045312 0.149070 +vt 0.033887 0.339584 +vt 0.064818 0.051010 +vt 0.089433 0.422716 +vt 0.190215 0.134799 +vt 0.173222 0.397299 +vt 0.042812 0.384454 +vt 0.137683 0.187332 +vt 0.498650 0.807968 +vt 0.506150 0.357836 +vt 0.492715 0.659952 +vt 0.497584 0.723519 +vt 0.701282 0.807968 +vt 0.708782 0.357836 +vt 0.695347 0.659952 +vt 0.700215 0.723519 +vt 0.704748 0.882920 +vt 0.702715 0.432836 +vt 0.697248 0.581853 +vt 0.692715 0.512968 +vt 0.502116 0.882920 +vt 0.500084 0.432836 +vt 0.494616 0.581853 +vt 0.490084 0.512968 +vt 0.791750 0.144822 +vt 0.935814 0.901393 +vt 0.965711 0.513739 +vt 0.934389 0.747322 +vt 0.956414 0.983739 +vt 0.881889 0.000000 +vt 0.817939 0.815980 +vt 0.987298 0.878074 +vt 0.896587 0.441049 +vt 0.907248 0.768183 +vt 0.972028 0.013999 +vt 0.901545 0.833005 +vt 0.900439 0.621049 +vt 0.973252 0.293183 +vt 0.890814 0.787248 +vn 0.098017 0.995185 0.000000 +vn 0.773011 -0.634393 0.000000 +vn -0.956940 -0.290284 0.000000 +vn 0.471396 0.881922 0.000000 +vn 0.471397 -0.881921 0.000000 +vn -0.995185 0.098018 0.000000 +vn 0.773010 0.634394 0.000000 +vn 0.098017 -0.995185 0.000000 +vn -0.881921 0.471397 0.000000 +vn 0.956940 0.290286 0.000000 +vn -0.634394 0.773010 0.000000 +vn -0.290284 -0.956941 0.000000 +vn 0.995185 -0.098016 0.000000 +vn -0.290285 0.956940 0.000000 +vn -0.634393 -0.773010 0.000000 +vn 0.881922 -0.471396 0.000000 +vn -0.881921 -0.471397 0.000000 +vn 0.290283 0.956941 0.000000 +vn 0.634394 -0.773010 0.000000 +vn -0.995185 -0.098017 0.000000 +vn 0.634392 0.773011 0.000000 +vn 0.290285 -0.956940 0.000000 +vn -0.956940 0.290285 0.000000 +vn 0.881920 0.471398 0.000000 +vn -0.773010 0.634393 0.000000 +vn -0.098017 -0.995185 0.000000 +vn 0.995185 0.098018 0.000000 +vn -0.471397 0.881921 0.000000 +vn -0.471397 -0.881921 0.000000 +vn 0.956941 -0.290284 0.000000 +vn -0.098018 0.995185 0.000000 +vn -0.773010 -0.634394 0.000000 +vn -0.773011 0.634392 0.000000 +vn 0.956941 0.290284 0.000000 +vn -0.471396 -0.881922 0.000000 +vn 0.995185 -0.098017 0.000000 +vn -0.098017 0.995185 0.000000 +vn 0.881921 -0.471396 0.000000 +vn -0.956940 -0.290286 0.000000 +vn 0.290284 0.956941 0.000000 +vn -0.995185 0.098016 0.000000 +vn 0.634393 0.773010 0.000000 +vn -0.881922 0.471395 0.000000 +vn 0.881922 0.471396 0.000000 +vn -0.290283 -0.956941 0.000000 +vn 0.995185 0.098016 0.000000 +vn -0.634392 -0.773011 0.000000 +vn 0.956940 -0.290285 0.000000 +vn -0.881921 -0.471398 0.000000 +vn 0.098016 0.995185 0.000000 +vn -0.995185 -0.098019 0.000000 +vn 0.471397 0.881921 0.000000 +vn -0.956941 0.290284 0.000000 +vn 0.045742 -0.004505 -0.998943 +vn 0.021667 -0.040536 0.998943 +vn -0.043984 0.013342 -0.998943 +vn -0.013343 0.043985 0.998943 +vn 0.004505 -0.045742 -0.998943 +vn 0.040536 0.021667 0.998943 +vn 0.004505 0.045742 -0.998943 +vn -0.013342 -0.043984 -0.998943 +vn -0.043985 -0.013343 0.998943 +vn 0.029159 -0.035530 0.998943 +vn 0.045742 0.004505 -0.998943 +vn -0.045742 0.004505 -0.998943 +vn -0.021667 0.040536 0.998943 +vn 0.013343 -0.043985 -0.998943 +vn 0.035530 0.029159 0.998943 +vn -0.004505 0.045742 -0.998943 +vn -0.004505 -0.045742 -0.998943 +vn -0.040536 -0.021667 0.998943 +vn 0.035531 -0.029159 0.998943 +vn 0.043984 0.013342 -0.998943 +vn -0.045742 -0.004505 -0.998943 +vn -0.029159 0.035530 0.998943 +vn 0.021667 -0.040536 -0.998943 +vn 0.029159 0.035530 0.998943 +vn -0.013343 0.043984 -0.998943 +vn -0.035530 -0.029159 0.998943 +vn 0.040536 -0.021667 0.998943 +vn 0.040536 0.021667 -0.998943 +vn -0.043984 -0.013343 -0.998943 +vn -0.035530 0.029159 0.998943 +vn 0.029159 -0.035530 -0.998943 +vn 0.021667 0.040536 0.998943 +vn -0.021667 0.040536 -0.998943 +vn -0.029159 -0.035530 0.998943 +vn 0.043985 -0.013342 0.998943 +vn 0.035530 0.029159 -0.998943 +vn -0.040536 -0.021667 -0.998943 +vn -0.040536 0.021667 0.998943 +vn 0.035530 -0.029159 -0.998943 +vn 0.013343 0.043985 0.998943 +vn -0.029159 0.035530 -0.998943 +vn -0.021667 -0.040536 0.998943 +vn 0.045742 -0.004505 0.998943 +vn 0.029159 0.035530 -0.998943 +vn -0.035530 -0.029159 -0.998943 +vn -0.043985 0.013342 0.998943 +vn 0.004505 -0.045742 0.998943 +vn 0.040536 -0.021667 -0.998943 +vn -0.035530 0.029159 -0.998943 +vn 0.004505 0.045742 0.998943 +vn -0.013342 -0.043984 0.998943 +vn 0.045742 0.004505 0.998943 +vn 0.021667 0.040536 -0.998943 +vn -0.029159 -0.035530 -0.998943 +vn -0.045742 0.004505 0.998943 +vn 0.013343 -0.043985 0.998943 +vn 0.043984 -0.013343 -0.998943 +vn -0.040536 0.021667 -0.998943 +vn -0.004505 0.045742 0.998943 +vn -0.004505 -0.045742 0.998943 +vn 0.013343 0.043984 -0.998943 +vn 0.043985 0.013343 0.998943 +vn -0.021667 -0.040536 -0.998943 +vn -0.045742 -0.004505 0.998943 +vn -0.000000 -0.000000 -1.000000 +vn 0.000000 0.000000 1.000000 +vn 1.000000 0.000001 0.000000 +vn -1.000000 0.000001 0.000000 +vn 0.510759 0.859724 0.000000 +vn -0.510758 0.859724 0.000000 +vn 0.510758 0.859724 0.000000 +vn -0.632634 -0.774451 0.000000 +vn 0.632634 -0.774451 0.000000 +vn -0.632635 -0.774451 0.000000 +vn -0.510759 0.859724 0.000000 +vn 0.773011 -0.634392 0.000000 +vn -0.956940 -0.290285 0.000000 +vn 0.471395 0.881922 0.000000 +vn -0.881922 0.471396 0.000000 +vn -0.634393 0.773010 0.000000 +vn -0.290284 -0.956940 0.000000 +vn -0.881922 -0.471396 0.000000 +vn 0.634393 -0.773010 0.000000 +vn -0.995185 -0.098018 0.000000 +vn 0.881921 0.471398 0.000000 +vn -0.773010 0.634394 0.000000 +vn -0.773011 -0.634393 0.000000 +vn -0.773011 0.634393 0.000000 +vn 0.956940 0.290285 0.000000 +vn -0.471395 -0.881922 0.000000 +vn 0.881921 -0.471397 0.000000 +vn 0.290284 0.956940 0.000000 +vn 0.634394 0.773010 0.000000 +vn 0.881921 0.471397 0.000000 +vn 0.995185 0.098017 0.000000 +vn 0.773010 -0.634394 0.000000 +vn 0.098018 -0.995185 0.000000 +vn 0.773011 0.634393 0.000000 +vn -0.013342 -0.043985 -0.998943 +vn 0.013342 -0.043984 -0.998943 +vn 0.043984 0.013343 -0.998943 +vn -0.035531 -0.029159 0.998943 +vn 0.043984 -0.013342 0.998943 +vn -0.043985 0.013343 0.998943 +vn -0.013342 -0.043985 0.998943 +vn 0.013343 -0.043984 0.998943 +vn 1.000000 0.000000 0.000000 +vn -1.000000 0.000000 0.000000 +usemtl Material.001 +s off +f 32/1/1 64/2/1 1/3/1 +f 21/4/2 53/5/2 22/6/2 +f 10/7/3 42/8/3 11/9/3 +f 30/10/4 62/11/4 31/12/4 +f 19/13/5 51/14/5 20/15/5 +f 8/16/6 40/17/6 9/18/6 +f 28/19/7 60/20/7 29/21/7 +f 17/3/8 49/22/8 18/23/8 +f 6/24/9 38/25/9 7/26/9 +f 26/27/10 58/28/10 27/29/10 +f 4/30/11 36/31/11 5/32/11 +f 15/33/12 47/34/12 16/35/12 +f 24/36/13 56/37/13 25/38/13 +f 2/39/14 34/40/14 3/41/14 +f 13/42/15 45/43/15 14/44/15 +f 22/6/16 54/45/16 23/46/16 +f 11/9/17 43/47/17 12/48/17 +f 31/12/18 63/49/18 32/1/18 +f 20/15/19 52/50/19 21/4/19 +f 9/51/20 41/52/20 10/7/20 +f 29/21/21 61/53/21 30/10/21 +f 18/23/22 50/54/22 19/13/22 +f 7/26/23 39/55/23 8/16/23 +f 27/29/24 59/56/24 28/19/24 +f 5/32/25 37/57/25 6/24/25 +f 16/35/26 48/58/26 17/59/26 +f 25/60/27 57/61/27 26/27/27 +f 3/41/28 35/62/28 4/30/28 +f 14/44/29 46/63/29 15/33/29 +f 23/46/30 55/64/30 24/36/30 +f 1/65/31 33/66/31 2/39/31 +f 12/48/32 44/67/32 13/42/32 +f 96/68/26 65/22/26 128/69/26 +f 85/70/33 86/71/33 117/72/33 +f 74/73/34 75/74/34 106/75/34 +f 94/76/35 95/77/35 126/78/35 +f 83/79/28 84/80/28 115/81/28 +f 72/82/36 73/83/36 104/84/36 +f 92/85/32 93/86/32 124/87/32 +f 81/88/37 82/89/37 113/90/37 +f 70/91/38 71/92/38 102/93/38 +f 90/94/39 91/95/39 122/96/39 +f 68/97/19 69/98/19 100/99/19 +f 79/100/40 80/101/40 111/102/40 +f 88/103/41 89/104/41 120/105/41 +f 66/106/22 67/107/22 98/108/22 +f 77/109/42 78/110/42 109/111/42 +f 86/71/43 87/112/43 118/113/43 +f 75/74/44 76/114/44 107/115/44 +f 95/77/45 96/68/45 127/116/45 +f 84/80/11 85/70/11 116/117/11 +f 73/118/46 74/73/46 105/119/46 +f 93/86/47 94/76/47 125/120/47 +f 82/89/14 83/79/14 114/121/14 +f 71/92/48 72/82/48 103/122/48 +f 91/95/49 92/85/49 123/123/49 +f 69/98/2 70/91/2 101/124/2 +f 80/101/50 81/125/50 112/126/50 +f 89/127/51 90/94/51 121/118/51 +f 67/107/5 68/97/5 99/128/5 +f 78/110/52 79/100/52 110/129/52 +f 87/112/53 88/103/53 119/130/53 +f 65/131/8 66/106/8 97/132/8 +f 76/114/7 77/109/7 108/133/7 +f 41/134/54 40/135/54 105/136/54 +f 3/137/55 4/138/55 67/139/55 +f 56/140/56 55/141/56 120/142/56 +f 18/143/57 19/144/57 82/145/57 +f 34/146/58 33/147/58 98/148/58 +f 11/149/59 12/150/59 75/151/59 +f 49/152/60 48/153/60 113/154/60 +f 64/155/61 63/156/61 128/157/61 +f 26/158/62 27/159/62 90/160/62 +f 4/138/63 5/161/63 69/162/63 +f 42/163/64 41/134/64 106/164/64 +f 57/165/65 56/140/65 121/166/65 +f 19/144/66 20/167/66 83/168/66 +f 35/169/67 34/146/67 99/170/67 +f 12/150/68 13/171/68 76/172/68 +f 50/173/69 49/152/69 114/174/69 +f 33/147/70 64/155/70 128/157/70 +f 27/159/71 28/175/71 91/176/71 +f 5/161/72 6/177/72 69/162/72 +f 43/178/73 42/163/73 107/179/73 +f 58/180/74 57/165/74 122/181/74 +f 20/167/75 21/182/75 84/183/75 +f 36/184/76 35/169/76 100/185/76 +f 13/171/77 14/186/77 77/187/77 +f 51/188/78 50/173/78 115/189/78 +f 28/175/79 29/190/79 92/191/79 +f 6/177/80 7/192/80 70/193/80 +f 44/194/81 43/178/81 108/195/81 +f 59/196/82 58/180/82 123/197/82 +f 21/182/83 22/198/83 85/199/83 +f 37/200/84 36/184/84 101/201/84 +f 14/186/85 15/202/85 78/203/85 +f 52/204/86 51/188/86 115/189/86 +f 29/190/87 30/205/87 94/206/87 +f 7/192/88 8/207/88 71/208/88 +f 45/209/89 44/194/89 109/210/89 +f 60/211/90 59/196/90 124/212/90 +f 22/198/91 23/213/91 86/214/91 +f 38/215/92 37/200/92 102/216/92 +f 15/202/93 16/217/93 79/218/93 +f 53/219/94 52/204/94 117/220/94 +f 30/205/95 31/221/95 95/222/95 +f 8/207/96 9/223/96 72/224/96 +f 46/225/97 45/209/97 109/210/97 +f 61/226/98 60/211/98 125/227/98 +f 23/213/99 24/228/99 88/229/99 +f 1/230/100 2/231/100 66/232/100 +f 39/233/101 38/215/101 103/234/101 +f 54/235/102 53/219/102 118/236/102 +f 16/217/103 17/237/103 80/238/103 +f 31/221/104 32/239/104 96/240/104 +f 9/223/105 10/241/105 73/242/105 +f 47/243/106 46/225/106 110/244/106 +f 62/245/107 61/226/107 126/246/107 +f 24/228/108 25/247/108 89/248/108 +f 2/231/109 3/137/109 66/232/109 +f 40/135/110 39/233/110 103/234/110 +f 55/141/111 54/235/111 119/249/111 +f 17/237/112 18/143/112 81/250/112 +f 32/239/113 1/230/113 96/240/113 +f 48/153/114 47/243/114 112/251/114 +f 10/241/115 11/149/115 74/252/115 +f 63/156/116 62/245/116 127/253/116 +f 25/247/117 26/158/117 89/248/117 +f 138/254/118 140/255/118 129/256/118 +f 142/257/118 144/258/118 131/259/118 +f 146/260/118 148/261/118 133/262/118 +f 150/263/118 152/264/118 135/265/118 +f 138/254/118 137/266/118 140/255/118 +f 142/257/118 141/267/118 144/258/118 +f 146/260/118 145/268/118 148/261/118 +f 150/263/118 149/269/118 152/264/118 +f 162/270/119 153/271/119 164/272/119 +f 166/273/119 155/274/119 168/275/119 +f 170/276/119 157/277/119 172/278/119 +f 174/279/119 159/280/119 176/281/119 +f 162/270/119 164/272/119 161/282/119 +f 166/273/119 168/275/119 165/283/119 +f 170/276/119 172/278/119 169/284/119 +f 174/279/119 176/281/119 173/285/119 +f 143/286/120 141/287/120 167/288/120 +f 131/289/121 132/290/121 155/291/121 +f 138/292/122 129/293/122 162/294/122 +f 135/290/121 136/295/121 159/296/121 +f 145/297/123 146/298/123 169/299/123 +f 146/300/124 133/301/124 170/302/124 +f 130/303/125 140/304/125 154/305/125 +f 148/287/126 147/306/126 172/307/126 +f 134/308/127 148/309/127 158/310/127 +f 137/311/128 138/312/128 161/313/128 +f 147/306/120 145/314/120 171/315/120 +f 140/316/126 139/317/126 164/318/126 +f 129/319/121 130/320/121 153/321/121 +f 149/309/128 150/322/128 173/323/128 +f 133/295/121 134/324/121 157/325/121 +f 139/317/120 137/326/120 163/327/120 +f 142/328/122 131/329/122 166/330/122 +f 152/331/126 151/332/126 176/333/126 +f 150/334/122 135/335/122 174/336/122 +f 141/337/128 142/338/128 165/339/128 +f 132/340/127 144/341/127 156/342/127 +f 151/332/120 149/343/120 175/344/120 +f 136/345/127 152/346/127 160/347/127 +f 144/314/126 143/286/126 168/348/126 +f 64/2/1 33/349/1 1/3/1 +f 53/5/129 54/45/129 22/6/129 +f 42/8/130 43/47/130 11/9/130 +f 62/11/131 63/49/131 31/12/131 +f 51/14/5 52/50/5 20/15/5 +f 40/17/6 41/350/6 9/18/6 +f 60/20/7 61/53/7 29/21/7 +f 49/22/8 50/54/8 18/23/8 +f 38/25/132 39/55/132 7/26/132 +f 58/28/10 59/56/10 27/29/10 +f 36/31/133 37/57/133 5/32/133 +f 47/34/134 48/58/134 16/35/134 +f 56/37/13 57/351/13 25/38/13 +f 34/40/14 35/62/14 3/41/14 +f 45/43/15 46/63/15 14/44/15 +f 54/45/16 55/64/16 23/46/16 +f 43/47/135 44/67/135 12/48/135 +f 63/49/18 64/2/18 32/1/18 +f 52/50/136 53/5/136 21/4/136 +f 41/52/137 42/8/137 10/7/137 +f 61/53/21 62/11/21 30/10/21 +f 50/54/22 51/14/22 19/13/22 +f 39/55/23 40/17/23 8/16/23 +f 59/56/138 60/20/138 28/19/138 +f 37/57/139 38/25/139 6/24/139 +f 48/58/26 49/352/26 17/59/26 +f 57/61/27 58/28/27 26/27/27 +f 35/62/28 36/31/28 4/30/28 +f 46/63/29 47/34/29 15/33/29 +f 55/64/30 56/37/30 24/36/30 +f 33/66/31 34/40/31 2/39/31 +f 44/67/140 45/43/140 13/42/140 +f 65/22/26 97/353/26 128/69/26 +f 86/71/141 118/113/141 117/72/141 +f 75/74/142 107/115/142 106/75/142 +f 95/77/143 127/116/143 126/78/143 +f 84/80/28 116/117/28 115/81/28 +f 73/83/13 105/354/13 104/84/13 +f 93/86/32 125/120/32 124/87/32 +f 82/89/37 114/121/37 113/90/37 +f 71/92/144 103/122/144 102/93/144 +f 91/95/39 123/123/39 122/96/39 +f 69/98/19 101/124/19 100/99/19 +f 80/101/145 112/126/145 111/102/145 +f 89/104/41 121/355/41 120/105/41 +f 67/107/22 99/128/22 98/108/22 +f 78/110/146 110/129/146 109/111/146 +f 87/112/132 119/130/132 118/113/132 +f 76/114/147 108/133/147 107/115/147 +f 96/68/45 128/69/45 127/116/45 +f 85/70/133 117/72/133 116/117/133 +f 74/73/148 106/75/148 105/119/148 +f 94/76/47 126/78/47 125/120/47 +f 83/79/14 115/81/14 114/121/14 +f 72/82/48 104/84/48 103/122/48 +f 92/85/49 124/87/49 123/123/49 +f 70/91/149 102/93/149 101/124/149 +f 81/125/50 113/356/50 112/126/50 +f 90/94/137 122/96/137 121/118/137 +f 68/97/5 100/99/5 99/128/5 +f 79/100/52 111/102/52 110/129/52 +f 88/103/53 120/105/53 119/130/53 +f 66/106/150 98/108/150 97/132/150 +f 77/109/151 109/111/151 108/133/151 +f 40/135/54 104/357/54 105/136/54 +f 4/138/55 68/358/55 67/139/55 +f 55/141/56 119/249/56 120/142/56 +f 19/144/57 83/168/57 82/145/57 +f 33/147/58 97/359/58 98/148/58 +f 12/150/59 76/172/59 75/151/59 +f 48/153/60 112/251/60 113/154/60 +f 63/156/152 127/253/152 128/157/152 +f 27/159/62 91/176/62 90/160/62 +f 68/358/63 4/138/63 69/162/63 +f 41/134/64 105/136/64 106/164/64 +f 56/140/65 120/142/65 121/166/65 +f 20/167/66 84/183/66 83/168/66 +f 34/146/153 98/148/153 99/170/153 +f 13/171/68 77/187/68 76/172/68 +f 49/152/69 113/154/69 114/174/69 +f 97/359/70 33/147/70 128/157/70 +f 28/175/71 92/191/71 91/176/71 +f 6/177/72 70/193/72 69/162/72 +f 42/163/154 106/164/154 107/179/154 +f 57/165/74 121/166/74 122/181/74 +f 21/182/75 85/199/75 84/183/75 +f 35/169/76 99/170/76 100/185/76 +f 14/186/77 78/203/77 77/187/77 +f 50/173/78 114/174/78 115/189/78 +f 29/190/155 93/360/155 92/191/155 +f 7/192/80 71/208/80 70/193/80 +f 43/178/81 107/179/81 108/195/81 +f 58/180/82 122/181/82 123/197/82 +f 22/198/83 86/214/83 85/199/83 +f 36/184/84 100/185/84 101/201/84 +f 15/202/85 79/218/85 78/203/85 +f 116/361/86 52/204/86 115/189/86 +f 93/360/87 29/190/87 94/206/87 +f 8/207/156 72/224/156 71/208/156 +f 44/194/89 108/195/89 109/210/89 +f 59/196/90 123/197/90 124/212/90 +f 23/213/91 87/362/91 86/214/91 +f 37/200/92 101/201/92 102/216/92 +f 16/217/93 80/238/93 79/218/93 +f 52/204/94 116/361/94 117/220/94 +f 94/206/95 30/205/95 95/222/95 +f 9/223/96 73/242/96 72/224/96 +f 110/244/97 46/225/97 109/210/97 +f 60/211/98 124/212/98 125/227/98 +f 87/362/157 23/213/157 88/229/157 +f 65/363/100 1/230/100 66/232/100 +f 38/215/101 102/216/101 103/234/101 +f 53/219/102 117/220/102 118/236/102 +f 17/237/103 81/250/103 80/238/103 +f 95/222/158 31/221/158 96/240/158 +f 10/241/105 74/252/105 73/242/105 +f 111/364/106 47/243/106 110/244/106 +f 61/226/107 125/227/107 126/246/107 +f 88/229/108 24/228/108 89/248/108 +f 3/137/159 67/139/159 66/232/159 +f 104/357/110 40/135/110 103/234/110 +f 54/235/111 118/236/111 119/249/111 +f 18/143/112 82/145/112 81/250/112 +f 1/230/113 65/363/113 96/240/113 +f 47/243/114 111/364/114 112/251/114 +f 11/149/115 75/151/115 74/252/115 +f 62/245/116 126/246/116 127/253/116 +f 26/158/117 90/160/117 89/248/117 +f 140/255/118 130/365/118 129/256/118 +f 144/258/118 132/366/118 131/259/118 +f 148/261/118 134/367/118 133/262/118 +f 152/264/118 136/368/118 135/265/118 +f 137/266/118 139/369/118 140/255/118 +f 141/267/118 143/370/118 144/258/118 +f 145/268/118 147/371/118 148/261/118 +f 149/269/118 151/372/118 152/264/118 +f 153/271/119 154/373/119 164/272/119 +f 155/274/119 156/374/119 168/275/119 +f 157/277/119 158/375/119 172/278/119 +f 159/280/119 160/376/119 176/281/119 +f 164/272/119 163/377/119 161/282/119 +f 168/275/119 167/378/119 165/283/119 +f 172/278/119 171/379/119 169/284/119 +f 176/281/119 175/380/119 173/285/119 +f 141/287/160 165/381/160 167/288/160 +f 132/290/161 156/296/161 155/291/161 +f 129/293/122 153/382/122 162/294/122 +f 136/295/161 160/325/161 159/296/161 +f 146/298/123 170/383/123 169/299/123 +f 133/301/122 157/329/122 170/302/122 +f 140/304/125 164/384/125 154/305/125 +f 147/306/126 171/315/126 172/307/126 +f 148/309/125 172/323/125 158/310/125 +f 138/312/128 162/385/128 161/313/128 +f 145/314/160 169/386/160 171/315/160 +f 139/317/126 163/327/126 164/318/126 +f 130/320/161 154/387/161 153/321/161 +f 150/322/128 174/388/128 173/323/128 +f 134/324/161 158/389/161 157/325/161 +f 137/326/160 161/390/160 163/327/160 +f 131/329/122 155/301/122 166/330/122 +f 151/332/126 175/344/126 176/333/126 +f 135/335/122 159/391/122 174/336/122 +f 142/338/128 166/392/128 165/339/128 +f 144/341/125 168/393/125 156/342/125 +f 149/343/160 173/394/160 175/344/160 +f 152/346/125 176/395/125 160/347/125 +f 143/286/126 167/288/126 168/348/126 From 329262fe5a3d30331bd66eeecb2acbf56a8d3072 Mon Sep 17 00:00:00 2001 From: Tobias Dahl Date: Thu, 13 Mar 2014 21:38:29 +0100 Subject: [PATCH 04/21] [WIP] Colliderar saker --- Escape-the-Dawn/Systems/PlayerSystem.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Escape-the-Dawn/Systems/PlayerSystem.cpp b/Escape-the-Dawn/Systems/PlayerSystem.cpp index a55bdf3..1327bce 100644 --- a/Escape-the-Dawn/Systems/PlayerSystem.cpp +++ b/Escape-the-Dawn/Systems/PlayerSystem.cpp @@ -26,6 +26,15 @@ void Systems::PlayerSystem::UpdateEntity(double dt, EntityID entity, EntityID pa if (input == nullptr) return; + auto collision = m_World->GetComponent(entity, "Collision"); + if(collision == nullptr) + return; + + if(collision->CollidingEntities.size() > 0) + { + m_World->RemoveEntity(entity); + } + auto name = m_World->GetProperty(entity, "Name"); if (name == "Camera" && freecamEnabled) { glm::vec3 Camera_Right = glm::vec3(glm::vec4(1, 0, 0, 0) * transform->Orientation); From ebd54f08332933a55ed2ebb9e90f2b6cf9407f12 Mon Sep 17 00:00:00 2001 From: sippeangelo Date: Thu, 13 Mar 2014 21:40:12 +0100 Subject: [PATCH 05/21] Delayed removal of entities. --- Escape-the-Dawn/World.cpp | 38 ++++++++++++++++++++++++-------------- Escape-the-Dawn/World.h | 4 ++++ 2 files changed, 28 insertions(+), 14 deletions(-) diff --git a/Escape-the-Dawn/World.cpp b/Escape-the-Dawn/World.cpp index 500395e..1e24e82 100644 --- a/Escape-the-Dawn/World.cpp +++ b/Escape-the-Dawn/World.cpp @@ -36,6 +36,8 @@ void World::Update(double dt) system->Update(dt); RecursiveUpdate(system, dt, 0); } + + ProcessEntityRemovals(); } //std::vector GetEntityChildren(EntityID entity); @@ -60,21 +62,29 @@ bool World::ValidEntity(EntityID entity) void World::RemoveEntity(EntityID entity) { - m_EntityParents.erase(entity); - // Remove components - for (auto pair : m_EntityComponents[entity]) { - auto type = pair.first; - auto component = pair.second; - // Trigger events - for (auto pair : m_Systems) { - auto system = pair.second; - system->OnComponentRemoved(type, component.get()); - } - m_ComponentsOfType[type].remove(component); - } - m_EntityComponents.erase(entity); + m_EntitiesToRemove.push_back(entity); +} - RecycleEntityID(entity); +void World::ProcessEntityRemovals() +{ + for (auto entity : m_EntitiesToRemove) { + m_EntityParents.erase(entity); + // Remove components + for (auto pair : m_EntityComponents[entity]) { + auto type = pair.first; + auto component = pair.second; + // Trigger events + for (auto pair : m_Systems) { + auto system = pair.second; + system->OnComponentRemoved(type, component.get()); + } + m_ComponentsOfType[type].remove(component); + } + m_EntityComponents.erase(entity); + + RecycleEntityID(entity); + } + m_EntitiesToRemove.clear(); } EntityID World::CreateEntity(EntityID parent /*= 0*/) diff --git a/Escape-the-Dawn/World.h b/Escape-the-Dawn/World.h index add6ae3..18a0fce 100644 --- a/Escape-the-Dawn/World.h +++ b/Escape-the-Dawn/World.h @@ -85,9 +85,13 @@ protected: std::unordered_map>> m_ComponentsOfType; std::unordered_map>> m_EntityComponents; + std::list m_EntitiesToRemove; + void ProcessEntityRemovals(); + EntityID GenerateEntityID(); void RecycleEntityID(EntityID id); + }; template From 759302b789b3eb66a0e2fb848b2a0cf3719735aa Mon Sep 17 00:00:00 2001 From: ViktorLjung Date: Thu, 13 Mar 2014 21:42:28 +0100 Subject: [PATCH 06/21] Powerups --- Escape-the-Dawn/Systems/CollisionSystem.cpp | 4 +- .../Systems/LevelGenerationSystem.cpp | 47 +++++++++++-------- .../Systems/LevelGenerationSystem.h | 9 +--- Escape-the-Dawn/Systems/PlayerSystem.cpp | 17 +++++++ Escape-the-Dawn/Systems/PlayerSystem.h | 2 + 5 files changed, 49 insertions(+), 30 deletions(-) diff --git a/Escape-the-Dawn/Systems/CollisionSystem.cpp b/Escape-the-Dawn/Systems/CollisionSystem.cpp index ab91656..4bd04bf 100644 --- a/Escape-the-Dawn/Systems/CollisionSystem.cpp +++ b/Escape-the-Dawn/Systems/CollisionSystem.cpp @@ -85,8 +85,8 @@ void Systems::CollisionSystem::Intersects(EntityID aEntity, EntityID bEntity) if (aMin.x <= bMax.x && bMin.x <= aMax.x) { if (aMin.y <= bMax.y && bMin.y <= aMax.y) { if (aMin.z <= bMax.z && bMin.z <= aMax.z) { - aCollisionComponent->CollidingEntities.push_back(aEntity); - bCollisionComponent->CollidingEntities.push_back(bEntity); + aCollisionComponent->CollidingEntities.push_back(bEntity); + bCollisionComponent->CollidingEntities.push_back(aEntity); return; } } diff --git a/Escape-the-Dawn/Systems/LevelGenerationSystem.cpp b/Escape-the-Dawn/Systems/LevelGenerationSystem.cpp index 05fcf0a..931d524 100644 --- a/Escape-the-Dawn/Systems/LevelGenerationSystem.cpp +++ b/Escape-the-Dawn/Systems/LevelGenerationSystem.cpp @@ -18,11 +18,11 @@ void Systems::LevelGenerationSystem::SpawnObstacle() ent = m_World->CreateEntity(); obstacles.push_back(ent); - m_World->SetProperty(ent, "Name", std::string("Obstacle")); - transform = m_World->AddComponent(ent, "Transform"); - bounds = m_World->AddComponent(ent, "Bounds"); - collision = m_World->AddComponent(ent, "Collision"); - model = m_World->AddComponent(ent, "Model"); + + auto transform = m_World->AddComponent(ent, "Transform"); + auto bounds = m_World->AddComponent(ent, "Bounds"); + auto collision = m_World->AddComponent(ent, "Collision"); + auto model = m_World->AddComponent(ent, "Model"); auto sound = m_World->AddComponent(ent, "SoundEmitter"); @@ -37,6 +37,7 @@ void Systems::LevelGenerationSystem::SpawnObstacle() if(typeRandom >= 0 && typeRandom < 2) // Mountain stuff :D { + m_World->SetProperty(ent, "Name", std::string("Obstacle")); float scale = (float)(rand() % 1000) / 250; transform->Scale = glm::vec3(scale); bounds->VolumeVector = glm::vec3(9, 12, 7); @@ -45,6 +46,7 @@ void Systems::LevelGenerationSystem::SpawnObstacle() } else if(typeRandom >= 2 && typeRandom < 5) // Single Mountain :D { + m_World->SetProperty(ent, "Name", std::string("Obstacle")); float scale = (float)(rand() % 1000) / 200; transform->Scale = glm::vec3(scale); bounds->VolumeVector = glm::vec3(3.5f, 7.5f, 3.5f); @@ -53,6 +55,7 @@ void Systems::LevelGenerationSystem::SpawnObstacle() } else if(typeRandom >= 5 && typeRandom < 8) { + m_World->SetProperty(ent, "Name", std::string("Obstacle")); float scale = (float)(rand() % 1000) / 100; transform->Scale = glm::vec3(scale); bounds->VolumeVector = glm::vec3(1, 1, 1); @@ -61,13 +64,14 @@ void Systems::LevelGenerationSystem::SpawnObstacle() } if(typeRandom >= 8 && typeRandom < 10) { + m_World->SetProperty(ent, "Name", std::string("PowerUp")); float scale = (float)(rand() % 1000) / 100; bounds->VolumeVector = glm::vec3(4, 4, 4); bounds->Origin = glm::vec3(0,4,0); - powerUp = m_World->AddComponent(ent, "PowerUp"); - powerUp->Speed = 10.f; + auto powerUp = m_World->AddComponent(ent, "PowerUp"); + powerUp->Speed = 200.f; model->ModelFile = "Models/powerup.obj"; } @@ -88,24 +92,26 @@ void Systems::LevelGenerationSystem::Update( double dt ) elapsedtime = 0; } - std::list removethis; + for(auto ent : obstacles) { auto transform = m_World->GetComponent(ent, "Transform"); - - transform->Velocity.z = velocity; - transform->Position += transform->Velocity * (float)dt; - - // Stop raising obstacles when they reach ground level - if (transform->Velocity.y > 0 && transform->Position.y >= 0) { - transform->Position.y = 0; - transform->Velocity.y = 0; - } - - if(transform->Position.z > 800) + if(transform != nullptr) { - removethis.push_back(ent); + transform->Velocity.z = velocity; + transform->Position += transform->Velocity * (float)dt; + + // Stop raising obstacles when they reach ground level + if (transform->Velocity.y > 0 && transform->Position.y >= 0) { + transform->Position.y = 0; + transform->Velocity.y = 0; + } + + if(transform->Position.z > 800) + { + removethis.push_back(ent); + } } } @@ -123,6 +129,7 @@ void Systems::LevelGenerationSystem::UpdateEntity( double dt, EntityID entity, E if( m_World->GetProperty(entity, "Name") == "Player") { auto transformComponent = m_World->GetComponent(entity, "Transform"); + startyz = glm::vec2(0, transformComponent->Position.z - 1000); startx = transformComponent->Position.x; velocity = transformComponent->Velocity.z; diff --git a/Escape-the-Dawn/Systems/LevelGenerationSystem.h b/Escape-the-Dawn/Systems/LevelGenerationSystem.h index 864c047..c51e0b9 100644 --- a/Escape-the-Dawn/Systems/LevelGenerationSystem.h +++ b/Escape-the-Dawn/Systems/LevelGenerationSystem.h @@ -31,18 +31,11 @@ namespace Systems int positionRandom; glm::vec2 startyz; float startx; - + std::list removethis; double elapsedtime; std::list obstacles; float velocity; - - std::shared_ptr transform; - std::shared_ptr bounds; - std::shared_ptr collision; - std::shared_ptr model; - std::shared_ptr pointLight; - std::shared_ptr powerUp; }; } diff --git a/Escape-the-Dawn/Systems/PlayerSystem.cpp b/Escape-the-Dawn/Systems/PlayerSystem.cpp index 7dc1959..7e2cc5d 100644 --- a/Escape-the-Dawn/Systems/PlayerSystem.cpp +++ b/Escape-the-Dawn/Systems/PlayerSystem.cpp @@ -136,6 +136,23 @@ void Systems::PlayerSystem::UpdateEntity(double dt, EntityID entity, EntityID pa else freecamEnabled = true; } + + //powerup + auto collisionComponent = m_World->GetComponent(entity, "Collision"); + for(auto ent : collisionComponent->CollidingEntities) + { + std::string name = m_World->GetProperty(ent, "Name"); + if(name == "PowerUp") + { + auto powerupComp = m_World->GetComponent(ent, "PowerUp"); + if(powerupComp != nullptr) + { + transform->Velocity.z = powerupComp->Speed; + m_World->RemoveEntity(ent); + } + } + } + // Update camera diff --git a/Escape-the-Dawn/Systems/PlayerSystem.h b/Escape-the-Dawn/Systems/PlayerSystem.h index 12ea648..2774565 100644 --- a/Escape-the-Dawn/Systems/PlayerSystem.h +++ b/Escape-the-Dawn/Systems/PlayerSystem.h @@ -9,6 +9,8 @@ #include "Components/Collision.h" #include "Components/Camera.h" #include "Components/Bounds.h" +#include "Components/PowerUp.h" + #include "logging.h" From e3153fe13012600c78437720611732e3d317888a Mon Sep 17 00:00:00 2001 From: ViktorLjung Date: Thu, 13 Mar 2014 21:50:53 +0100 Subject: [PATCH 07/21] freecamfixed --- Escape-the-Dawn/Systems/PlayerSystem.cpp | 94 +++++++++++++----------- 1 file changed, 50 insertions(+), 44 deletions(-) diff --git a/Escape-the-Dawn/Systems/PlayerSystem.cpp b/Escape-the-Dawn/Systems/PlayerSystem.cpp index 7e2cc5d..60f4971 100644 --- a/Escape-the-Dawn/Systems/PlayerSystem.cpp +++ b/Escape-the-Dawn/Systems/PlayerSystem.cpp @@ -27,47 +27,58 @@ void Systems::PlayerSystem::UpdateEntity(double dt, EntityID entity, EntityID pa return; auto name = m_World->GetProperty(entity, "Name"); - if (name == "Camera" && freecamEnabled) { - glm::vec3 Camera_Right = glm::vec3(glm::vec4(1, 0, 0, 0) * transform->Orientation); - glm::vec3 Camera_Forward = glm::vec3(glm::vec4(0, 0, 1, 0) * transform->Orientation); - - float speed = m_PlayerSpeed; - if(input->KeyState[GLFW_KEY_LEFT_SHIFT]) { - speed *= 4.0f; - } - if(input->KeyState[GLFW_KEY_LEFT_ALT]) { - speed /= 4.0f; - } - if(input->KeyState[GLFW_KEY_A]) { - transform->Position -= Camera_Right * (float)dt * speed; - } - else if(input->KeyState[GLFW_KEY_D]) { - transform->Position += Camera_Right * (float)dt * speed; - } - if(input->KeyState[GLFW_KEY_W]) { - transform->Position -= Camera_Forward * (float)dt * speed; - } - if(input->KeyState[GLFW_KEY_S]) { - transform->Position += Camera_Forward * (float)dt * speed; - } - if(input->KeyState[GLFW_KEY_SPACE]) { - transform->Position += glm::vec3(0, 1, 0) * (float)dt * speed; - } - if(input->KeyState[GLFW_KEY_LEFT_CONTROL]) { - transform->Position -= glm::vec3(0, 1, 0) * (float)dt * speed; - } - - if (input->MouseState[GLFW_MOUSE_BUTTON_LEFT]) { - // TOUCHING THIS CODE MIGHT COUSE THE UNIVERSE TO IMPLODE, ALSO DRAGONS - //--------------------------------------------------------------------- - transform->Orientation = glm::angleAxis(input->dY/300.f,glm::vec3(1,0,0)) * transform->Orientation; - - transform->Orientation = transform->Orientation * glm::angleAxis(input->dX/300.f,glm::vec3(0,1,0)); - //--------------------------------------------------------------------- - // TOUCHING THIS CODE MIGHT COUSE THE UNIVERSE TO IMPLODE, ALSO DRAGONS + if (name == "Camera") { + if(input->KeyState[GLFW_KEY_F4] && !input->LastKeyState[GLFW_KEY_F4]) { + if(freecamEnabled) + freecamEnabled = false; + else + freecamEnabled = true; } + if(freecamEnabled) + { + glm::vec3 Camera_Right = glm::vec3(glm::vec4(1, 0, 0, 0) * transform->Orientation); + glm::vec3 Camera_Forward = glm::vec3(glm::vec4(0, 0, 1, 0) * transform->Orientation); + + float speed = m_PlayerSpeed; + if(input->KeyState[GLFW_KEY_LEFT_SHIFT]) { + speed *= 4.0f; + } + if(input->KeyState[GLFW_KEY_LEFT_ALT]) { + speed /= 4.0f; + } + if(input->KeyState[GLFW_KEY_A]) { + transform->Position -= Camera_Right * (float)dt * speed; + } + else if(input->KeyState[GLFW_KEY_D]) { + transform->Position += Camera_Right * (float)dt * speed; + } + if(input->KeyState[GLFW_KEY_W]) { + transform->Position -= Camera_Forward * (float)dt * speed; + } + if(input->KeyState[GLFW_KEY_S]) { + transform->Position += Camera_Forward * (float)dt * speed; + } + if(input->KeyState[GLFW_KEY_SPACE]) { + transform->Position += glm::vec3(0, 1, 0) * (float)dt * speed; + } + if(input->KeyState[GLFW_KEY_LEFT_CONTROL]) { + transform->Position -= glm::vec3(0, 1, 0) * (float)dt * speed; + } + + if (input->MouseState[GLFW_MOUSE_BUTTON_LEFT]) { + // TOUCHING THIS CODE MIGHT COUSE THE UNIVERSE TO IMPLODE, ALSO DRAGONS + //--------------------------------------------------------------------- + transform->Orientation = glm::angleAxis(input->dY/300.f,glm::vec3(1,0,0)) * transform->Orientation; + + transform->Orientation = transform->Orientation * glm::angleAxis(input->dX/300.f,glm::vec3(0,1,0)); + //--------------------------------------------------------------------- + // TOUCHING THIS CODE MIGHT COUSE THE UNIVERSE TO IMPLODE, ALSO DRAGONS + } + } + } + if (name == "Player") { auto bounds = m_World->GetComponent(entity, "Bounds"); @@ -130,12 +141,7 @@ void Systems::PlayerSystem::UpdateEntity(double dt, EntityID entity, EntityID pa } - if(input->KeyState[GLFW_KEY_F4] && !input->LastKeyState[GLFW_KEY_F4]) { - if(freecamEnabled) - freecamEnabled = false; - else - freecamEnabled = true; - } + //powerup auto collisionComponent = m_World->GetComponent(entity, "Collision"); From fe1605a15836af12fe3f3995e574a5632ff72af1 Mon Sep 17 00:00:00 2001 From: Tobias Dahl Date: Thu, 13 Mar 2014 22:00:34 +0100 Subject: [PATCH 08/21] [WIP] Saker --- Escape-the-Dawn/Systems/PlayerSystem.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Escape-the-Dawn/Systems/PlayerSystem.cpp b/Escape-the-Dawn/Systems/PlayerSystem.cpp index d57f403..53b327d 100644 --- a/Escape-the-Dawn/Systems/PlayerSystem.cpp +++ b/Escape-the-Dawn/Systems/PlayerSystem.cpp @@ -36,13 +36,16 @@ void Systems::PlayerSystem::UpdateEntity(double dt, EntityID entity, EntityID pa } auto name = m_World->GetProperty(entity, "Name"); + if (name == "Camera") { + if(input->KeyState[GLFW_KEY_F4] && !input->LastKeyState[GLFW_KEY_F4]) { if(freecamEnabled) freecamEnabled = false; else freecamEnabled = true; } + if(freecamEnabled) { glm::vec3 Camera_Right = glm::vec3(glm::vec4(1, 0, 0, 0) * transform->Orientation); From c53913f63b0cc6921548790c273c5d224cb3a55d Mon Sep 17 00:00:00 2001 From: ViktorLjung Date: Thu, 13 Mar 2014 22:13:59 +0100 Subject: [PATCH 09/21] Powerup timer fixed --- .../Systems/LevelGenerationSystem.cpp | 24 ++++++++++--------- Escape-the-Dawn/Systems/PlayerSystem.cpp | 24 ++++++++++++------- Escape-the-Dawn/Systems/PlayerSystem.h | 4 +++- 3 files changed, 31 insertions(+), 21 deletions(-) diff --git a/Escape-the-Dawn/Systems/LevelGenerationSystem.cpp b/Escape-the-Dawn/Systems/LevelGenerationSystem.cpp index 931d524..90a20e9 100644 --- a/Escape-the-Dawn/Systems/LevelGenerationSystem.cpp +++ b/Escape-the-Dawn/Systems/LevelGenerationSystem.cpp @@ -99,19 +99,21 @@ void Systems::LevelGenerationSystem::Update( double dt ) auto transform = m_World->GetComponent(ent, "Transform"); if(transform != nullptr) { - transform->Velocity.z = velocity; - transform->Position += transform->Velocity * (float)dt; - // Stop raising obstacles when they reach ground level - if (transform->Velocity.y > 0 && transform->Position.y >= 0) { - transform->Position.y = 0; - transform->Velocity.y = 0; - } + + transform->Velocity.z = velocity; + transform->Position += transform->Velocity * (float)dt; - if(transform->Position.z > 800) - { - removethis.push_back(ent); - } + // Stop raising obstacles when they reach ground level + if (transform->Velocity.y > 0 && transform->Position.y >= 0) { + transform->Position.y = 0; + transform->Velocity.y = 0; + } + + if(transform->Position.z > 800) + { + removethis.push_back(ent); + } } } diff --git a/Escape-the-Dawn/Systems/PlayerSystem.cpp b/Escape-the-Dawn/Systems/PlayerSystem.cpp index 60f4971..201d423 100644 --- a/Escape-the-Dawn/Systems/PlayerSystem.cpp +++ b/Escape-the-Dawn/Systems/PlayerSystem.cpp @@ -9,12 +9,14 @@ Systems::PlayerSystem::PlayerSystem( World* world ) : System(world) m_CameraOffset = glm::vec3(0.f, 5.f, 14.f); m_CameraOrientation = glm::angleAxis(glm::radians(15.0f),glm::vec3(1,0,0)); - freecamEnabled = false; - + m_freecamEnabled = false; + m_poweruptimeleft = 0; + m_basespeed = 100.f; } void Systems::PlayerSystem::Update(double dt) { + m_poweruptimeleft -= (float)dt; } void Systems::PlayerSystem::UpdateEntity(double dt, EntityID entity, EntityID parent) @@ -29,12 +31,12 @@ void Systems::PlayerSystem::UpdateEntity(double dt, EntityID entity, EntityID pa auto name = m_World->GetProperty(entity, "Name"); if (name == "Camera") { if(input->KeyState[GLFW_KEY_F4] && !input->LastKeyState[GLFW_KEY_F4]) { - if(freecamEnabled) - freecamEnabled = false; + if(m_freecamEnabled) + m_freecamEnabled = false; else - freecamEnabled = true; + m_freecamEnabled = true; } - if(freecamEnabled) + if(m_freecamEnabled) { glm::vec3 Camera_Right = glm::vec3(glm::vec4(1, 0, 0, 0) * transform->Orientation); glm::vec3 Camera_Forward = glm::vec3(glm::vec4(0, 0, 1, 0) * transform->Orientation); @@ -154,15 +156,19 @@ void Systems::PlayerSystem::UpdateEntity(double dt, EntityID entity, EntityID pa if(powerupComp != nullptr) { transform->Velocity.z = powerupComp->Speed; + m_poweruptimeleft = 3.f; m_World->RemoveEntity(ent); } } } - - + if(m_poweruptimeleft <= 0) + { + transform->Velocity.z = m_basespeed; + } + // Update camera - if(! freecamEnabled) + if(! m_freecamEnabled) { auto cameraEntity = m_World->GetProperty(entity, "Camera"); auto cameraTransform = m_World->GetComponent(cameraEntity, "Transform"); diff --git a/Escape-the-Dawn/Systems/PlayerSystem.h b/Escape-the-Dawn/Systems/PlayerSystem.h index 2774565..c008caa 100644 --- a/Escape-the-Dawn/Systems/PlayerSystem.h +++ b/Escape-the-Dawn/Systems/PlayerSystem.h @@ -33,7 +33,9 @@ namespace Systems glm::vec3 m_CameraOffset; glm::quat m_CameraOrientation; - bool freecamEnabled; + bool m_freecamEnabled; + float m_basespeed; + float m_poweruptimeleft; }; } From 70135463146bf4dad996e877de5f2c0c4d8d0276 Mon Sep 17 00:00:00 2001 From: ViktorLjung Date: Thu, 13 Mar 2014 23:01:55 +0100 Subject: [PATCH 10/21] powerup bugfix --- .../Systems/LevelGenerationSystem.cpp | 53 ++++++++----------- .../Systems/LevelGenerationSystem.h | 3 -- Escape-the-Dawn/Systems/PlayerSystem.cpp | 10 ++-- 3 files changed, 25 insertions(+), 41 deletions(-) diff --git a/Escape-the-Dawn/Systems/LevelGenerationSystem.cpp b/Escape-the-Dawn/Systems/LevelGenerationSystem.cpp index 90a20e9..92a4ab6 100644 --- a/Escape-the-Dawn/Systems/LevelGenerationSystem.cpp +++ b/Escape-the-Dawn/Systems/LevelGenerationSystem.cpp @@ -17,7 +17,6 @@ void Systems::LevelGenerationSystem::SpawnObstacle() EntityID ent; ent = m_World->CreateEntity(); - obstacles.push_back(ent); auto transform = m_World->AddComponent(ent, "Transform"); auto bounds = m_World->AddComponent(ent, "Bounds"); @@ -28,7 +27,7 @@ void Systems::LevelGenerationSystem::SpawnObstacle() positionRandom = -500 + startx + (rand() % 1000); transform->Position = glm::vec3(positionRandom, startyz); - //transform->Velocity = glm::vec3(0.f, 10.f, 100.f); + transform->Velocity = glm::vec3(0.f, 10.f, 0); sound->Loop = true; sound->Gain = 1.f; @@ -78,7 +77,7 @@ void Systems::LevelGenerationSystem::SpawnObstacle() // Put it below ground level - //transform->Position.y -= bounds->VolumeVector.y * 2.f; + transform->Position.y -= bounds->VolumeVector.y * 2.f; } @@ -94,40 +93,30 @@ void Systems::LevelGenerationSystem::Update( double dt ) - for(auto ent : obstacles) - { - auto transform = m_World->GetComponent(ent, "Transform"); - if(transform != nullptr) - { - - - transform->Velocity.z = velocity; - transform->Position += transform->Velocity * (float)dt; - - // Stop raising obstacles when they reach ground level - if (transform->Velocity.y > 0 && transform->Position.y >= 0) { - transform->Position.y = 0; - transform->Velocity.y = 0; - } - - if(transform->Position.z > 800) - { - removethis.push_back(ent); - } - } - } - - for(auto ent : removethis) - { - m_World->RemoveEntity(ent); - obstacles.remove(ent); - } - removethis.clear(); + } void Systems::LevelGenerationSystem::UpdateEntity( double dt, EntityID entity, EntityID parent ) { + if( m_World->GetProperty(entity, "Name") == "Obstacle" || m_World->GetProperty(entity, "Name") == "PowerUp") + { + auto transform = m_World->GetComponent(entity, "Transform"); + transform->Velocity.z = velocity; + transform->Position += transform->Velocity * (float)dt; + + // Stop raising obstacles when they reach ground level + if (transform->Velocity.y > 0 && transform->Position.y >= 0) + { + transform->Position.y = 0; + transform->Velocity.y = 0; + } + + if(transform->Position.z > 800) + m_World->RemoveEntity(entity); + + } + if( m_World->GetProperty(entity, "Name") == "Player") { auto transformComponent = m_World->GetComponent(entity, "Transform"); diff --git a/Escape-the-Dawn/Systems/LevelGenerationSystem.h b/Escape-the-Dawn/Systems/LevelGenerationSystem.h index c51e0b9..ab02fe3 100644 --- a/Escape-the-Dawn/Systems/LevelGenerationSystem.h +++ b/Escape-the-Dawn/Systems/LevelGenerationSystem.h @@ -31,10 +31,7 @@ namespace Systems int positionRandom; glm::vec2 startyz; float startx; - std::list removethis; double elapsedtime; - - std::list obstacles; float velocity; }; } diff --git a/Escape-the-Dawn/Systems/PlayerSystem.cpp b/Escape-the-Dawn/Systems/PlayerSystem.cpp index 201d423..fcbce85 100644 --- a/Escape-the-Dawn/Systems/PlayerSystem.cpp +++ b/Escape-the-Dawn/Systems/PlayerSystem.cpp @@ -153,18 +153,16 @@ void Systems::PlayerSystem::UpdateEntity(double dt, EntityID entity, EntityID pa if(name == "PowerUp") { auto powerupComp = m_World->GetComponent(ent, "PowerUp"); - if(powerupComp != nullptr) - { - transform->Velocity.z = powerupComp->Speed; - m_poweruptimeleft = 3.f; - m_World->RemoveEntity(ent); - } + transform->Velocity.z = powerupComp->Speed; + m_poweruptimeleft = 3.f; + m_World->RemoveEntity(ent); } } if(m_poweruptimeleft <= 0) { transform->Velocity.z = m_basespeed; } + //fixa FOV // Update camera From 28b83905e995f916e81cdba5791b34f153fe5069 Mon Sep 17 00:00:00 2001 From: Tobias Dahl Date: Thu, 13 Mar 2014 23:02:08 +0100 Subject: [PATCH 11/21] [WIP] Collisions and sun stuff --- Escape-the-Dawn/Shaders/Fragment.glsl | 4 ++-- Escape-the-Dawn/Systems/PlayerSystem.cpp | 17 ++++++++++------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/Escape-the-Dawn/Shaders/Fragment.glsl b/Escape-the-Dawn/Shaders/Fragment.glsl index a16878d..ca7ef0b 100644 --- a/Escape-the-Dawn/Shaders/Fragment.glsl +++ b/Escape-the-Dawn/Shaders/Fragment.glsl @@ -23,7 +23,7 @@ in VertexData { vec3 ShadowCoord; } Input; -vec3 scene_ambient = vec3(0.3); +vec3 scene_ambient = vec3(0.98f, 0.95f, 0.8f); out vec4 fragmentColor; @@ -54,7 +54,7 @@ void main() { float bias = 0.0005; vec4 shadowMapValue = texture(shadowMap, Input.ShadowCoord.xy); if (shadowMapValue.z < clamp(Input.ShadowCoord.z - bias, 0, 1)) { - visibility = 0.5; + visibility = 0.3; } } diff --git a/Escape-the-Dawn/Systems/PlayerSystem.cpp b/Escape-the-Dawn/Systems/PlayerSystem.cpp index 53b327d..02878b0 100644 --- a/Escape-the-Dawn/Systems/PlayerSystem.cpp +++ b/Escape-the-Dawn/Systems/PlayerSystem.cpp @@ -27,15 +27,18 @@ void Systems::PlayerSystem::UpdateEntity(double dt, EntityID entity, EntityID pa return; auto collision = m_World->GetComponent(entity, "Collision"); - if(collision == nullptr) - return; - - if(collision->CollidingEntities.size() > 0) - { - m_World->RemoveEntity(entity); - } auto name = m_World->GetProperty(entity, "Name"); + if(collision != nullptr) + { + for(auto ent : collision->CollidingEntities) + { + if(m_World->GetProperty(ent, "Name") == "Obstacle") + { + m_World->RemoveEntity(entity); + } + } + } if (name == "Camera") { From cbb8eac917454cfdbd2f43e231bb71363386c539 Mon Sep 17 00:00:00 2001 From: sippeangelo Date: Thu, 13 Mar 2014 23:44:32 +0100 Subject: [PATCH 12/21] Children transforms relative to parents using TransformSystem::AbsolutePosition and TransformSystem::AbsoluteOrientation --- Escape-the-Dawn/Components/Model.h | 4 +- Escape-the-Dawn/Escape-the-Dawn.vcxproj | 2 + .../Escape-the-Dawn.vcxproj.filters | 6 ++ Escape-the-Dawn/GameWorld.cpp | 78 ++++++++++++------- Escape-the-Dawn/GameWorld.h | 4 +- Escape-the-Dawn/Renderer.cpp | 43 +++++----- Escape-the-Dawn/Renderer.h | 4 +- Escape-the-Dawn/System.h | 2 + .../Systems/LevelGenerationSystem.cpp | 8 +- Escape-the-Dawn/Systems/RenderSystem.cpp | 16 +++- Escape-the-Dawn/Systems/RenderSystem.h | 5 +- Escape-the-Dawn/Systems/TransformSystem.cpp | 47 +++++++++++ Escape-the-Dawn/Systems/TransformSystem.h | 25 ++++++ Escape-the-Dawn/World.cpp | 15 ++-- Escape-the-Dawn/World.h | 6 +- 15 files changed, 199 insertions(+), 66 deletions(-) create mode 100644 Escape-the-Dawn/Systems/TransformSystem.cpp create mode 100644 Escape-the-Dawn/Systems/TransformSystem.h diff --git a/Escape-the-Dawn/Components/Model.h b/Escape-the-Dawn/Components/Model.h index 11297da..dc58640 100644 --- a/Escape-the-Dawn/Components/Model.h +++ b/Escape-the-Dawn/Components/Model.h @@ -11,8 +11,10 @@ namespace Components struct Model : Component { - const char* ModelFile; + Model() : Visible(true) { } + std::string ModelFile; Color Color; + bool Visible; }; } diff --git a/Escape-the-Dawn/Escape-the-Dawn.vcxproj b/Escape-the-Dawn/Escape-the-Dawn.vcxproj index 7f9c2d5..d8c44c3 100644 --- a/Escape-the-Dawn/Escape-the-Dawn.vcxproj +++ b/Escape-the-Dawn/Escape-the-Dawn.vcxproj @@ -110,6 +110,7 @@ + @@ -161,6 +162,7 @@ + diff --git a/Escape-the-Dawn/Escape-the-Dawn.vcxproj.filters b/Escape-the-Dawn/Escape-the-Dawn.vcxproj.filters index 7740421..06f96a7 100644 --- a/Escape-the-Dawn/Escape-the-Dawn.vcxproj.filters +++ b/Escape-the-Dawn/Escape-the-Dawn.vcxproj.filters @@ -47,6 +47,9 @@ + + Systems + @@ -148,6 +151,9 @@ + + Systems + diff --git a/Escape-the-Dawn/GameWorld.cpp b/Escape-the-Dawn/GameWorld.cpp index 3697aa8..10657cd 100644 --- a/Escape-the-Dawn/GameWorld.cpp +++ b/Escape-the-Dawn/GameWorld.cpp @@ -5,14 +5,6 @@ void GameWorld::Initialize() { World::Initialize(); - AddSystem("LevelGenerationSystem"); - AddSystem("InputSystem"); - AddSystem("CollisionSystem"); - //AddSystem("ParticleSystem"); - AddSystem("PlayerSystem"); - AddSystem("SoundSystem"); - AddSystem("RenderSystem"); - std::shared_ptr transform; std::shared_ptr model; std::shared_ptr pointLight; @@ -21,11 +13,8 @@ void GameWorld::Initialize() std::shared_ptr collision; EntityID ent; - - - // Fucking lights - ent = CreateEntity(); + /*ent = CreateEntity(); transform = AddComponent(ent, "Transform"); transform->Position = glm::vec3(0.f, 7.f, 0.f); pointLight = AddComponent(ent, "PointLight"); @@ -60,7 +49,7 @@ void GameWorld::Initialize() pointLight->quadraticAttenuation = 0.f; pointLight->spotExponent = 0.0f; model = AddComponent(ent, "Model"); - model->ModelFile = "Models/sphere.obj"; + model->ModelFile = "Models/sphere.obj";*/ //ground ent = CreateEntity(); @@ -91,13 +80,6 @@ void GameWorld::Initialize() transform->Scale = glm::vec3(1.0f); model = AddComponent(m_Player, "Model"); model->ModelFile = "Models/ship.obj"; - pointLight = AddComponent(m_Player, "PointLight"); - pointLight->Specular = glm::vec3(1.0, 1.0, 1.0); - pointLight->Diffuse = glm::vec3(0.4, 0.4, 1.0); - pointLight->constantAttenuation = 0.f; - pointLight->linearAttenuation = 1.f; - pointLight->quadraticAttenuation = 0.f; - pointLight->spotExponent = 0.0f; AddComponent(m_Player, "Input"); collision = AddComponent(m_Player, "Collision"); collision->Phantom = false; @@ -105,12 +87,43 @@ void GameWorld::Initialize() bounds = AddComponent(m_Player, "Bounds"); bounds->Origin = glm::vec3(0, 0, 2.f); bounds->VolumeVector = glm::vec3(4.f, 0.7f, 1); - - - - - - + // Player light + auto playerLight = CreateEntity(m_Player); + transform = AddComponent(playerLight, "Transform"); + transform->Position = glm::vec3(1.5f, 0.25f, 2.5f); + pointLight = AddComponent(playerLight, "PointLight"); + pointLight->Specular = glm::vec3(0.1f, 0.1f, 0.1f); + pointLight->Diffuse = glm::vec3(0.45f, 0.65f, 1.f); + pointLight->constantAttenuation = 0.f; + pointLight->linearAttenuation = 0.9f; + pointLight->quadraticAttenuation = 0.f; + pointLight->spotExponent = 0.0f; + bounds = AddComponent(playerLight, "Bounds"); + bounds->VolumeVector = glm::vec3(0.5f); + playerLight = CreateEntity(m_Player); + transform = AddComponent(playerLight, "Transform"); + transform->Position = glm::vec3(-1.5f, 0.25f, 2.5f); + pointLight = AddComponent(playerLight, "PointLight"); + pointLight->Specular = glm::vec3(0.1f, 0.1f, 0.1f); + pointLight->Diffuse = glm::vec3(0.45f, 0.65f, 1.f); + pointLight->constantAttenuation = 0.f; + pointLight->linearAttenuation = 0.9f; + pointLight->quadraticAttenuation = 0.f; + pointLight->spotExponent = 0.0f; + bounds = AddComponent(playerLight, "Bounds"); + bounds->VolumeVector = glm::vec3(0.5f); + playerLight = CreateEntity(m_Player); + transform = AddComponent(playerLight, "Transform"); + transform->Position = glm::vec3(0.0f, 2.0f, 2.5f); + pointLight = AddComponent(playerLight, "PointLight"); + pointLight->Specular = glm::vec3(0.1f, 0.1f, 0.1f); + pointLight->Diffuse = glm::vec3(0.45f, 0.65f, 1.f); + pointLight->constantAttenuation = 0.f; + pointLight->linearAttenuation = 1.0f; + pointLight->quadraticAttenuation = 0.f; + pointLight->spotExponent = 0.0f; + bounds = AddComponent(playerLight, "Bounds"); + bounds->VolumeVector = glm::vec3(0.5f); /*ent = CreateEntity(); transform = AddComponent(ent, "Transform"); @@ -155,5 +168,18 @@ void GameWorld::RegisterSystems() //m_SystemFactory.Register("ParticleSystem", [this]() { return new Systems::ParticleSystem(this); }); m_SystemFactory.Register("PlayerSystem", [this]() { return new Systems::PlayerSystem(this); }); m_SystemFactory.Register("SoundSystem", [this]() { return new Systems::SoundSystem(this); }); + m_SystemFactory.Register("TransformSystem", [this]() { return new Systems::TransformSystem(this); }); m_SystemFactory.Register("RenderSystem", [this]() { return new Systems::RenderSystem(this, m_Renderer); }); +} + +void GameWorld::AddSystems() +{ + AddSystem("TransformSystem"); + AddSystem("LevelGenerationSystem"); + AddSystem("InputSystem"); + AddSystem("CollisionSystem"); + //AddSystem("ParticleSystem"); + AddSystem("PlayerSystem"); + AddSystem("SoundSystem"); + AddSystem("RenderSystem"); } \ No newline at end of file diff --git a/Escape-the-Dawn/GameWorld.h b/Escape-the-Dawn/GameWorld.h index d2ac780..a192608 100644 --- a/Escape-the-Dawn/GameWorld.h +++ b/Escape-the-Dawn/GameWorld.h @@ -4,6 +4,7 @@ #include "World.h" #include "Renderer.h" +#include "Systems/TransformSystem.h" #include "Systems/CollisionSystem.h" #include "Systems/InputSystem.h" #include "Systems/LevelGenerationSystem.h" @@ -36,9 +37,10 @@ public: void Initialize(); void RegisterSystems() override; + void AddSystems() override; void RegisterComponents() override; - void Update(double dt) ; + void Update(double dt); private: std::shared_ptr m_Renderer; diff --git a/Escape-the-Dawn/Renderer.cpp b/Escape-the-Dawn/Renderer.cpp index 87a7e79..b2e985f 100644 --- a/Escape-the-Dawn/Renderer.cpp +++ b/Escape-the-Dawn/Renderer.cpp @@ -14,7 +14,7 @@ Renderer::Renderer() #endif m_ShadowMapRes = 2048*2; - m_SunPosition = glm::vec3(0, 0.3f, 10); + m_SunPosition = glm::vec3(0, 1.5f, 10); m_SunTarget = glm::vec3(0, 0, 0); m_SunProjection = glm::ortho(-200, 200, -10, 100, -800, 800); Lights = 0; @@ -216,7 +216,11 @@ void Renderer::DrawScene() { Model* model; glm::mat4 modelMatrix; - std::tie(model, modelMatrix) = tuple; + bool visible; + std::tie(model, modelMatrix, visible) = tuple; + if (!visible) + continue; + MVP = cameraMatrix * modelMatrix; depthMVP = depthCameraMatrix * modelMatrix; glUniformMatrix4fv(glGetUniformLocation(m_ShaderProgram.GetHandle(), "MVP"), 1, GL_FALSE, glm::value_ptr(MVP)); @@ -267,7 +271,8 @@ void Renderer::DrawShadowMap() { Model* model; glm::mat4 modelMatrix; - std::tie(model, modelMatrix) = tuple; + bool visible; + std::tie(model, modelMatrix, visible) = tuple; MVP = depthCamera * modelMatrix; glUniformMatrix4fv(glGetUniformLocation(m_ShaderProgramShadows.GetHandle(), "MVP"), 1, GL_FALSE, glm::value_ptr(MVP)); @@ -296,26 +301,26 @@ void Renderer::DrawDebugShadowMap() void Renderer::DrawModels(ShaderProgram &shader) { - glm::mat4 cameraMatrix = m_Camera->ProjectionMatrix() * m_Camera->ViewMatrix(); + /*glm::mat4 cameraMatrix = m_Camera->ProjectionMatrix() * m_Camera->ViewMatrix(); glm::mat4 MVP; for (auto tuple : ModelsToRender) { - Model* model; - glm::mat4 modelMatrix; - std::tie(model, modelMatrix) = tuple; + Model* model; + glm::mat4 modelMatrix; + std::tie(model, modelMatrix) = tuple; - MVP = cameraMatrix * modelMatrix; - glUniformMatrix4fv(glGetUniformLocation(shader.GetHandle(), "MVP"), 1, GL_FALSE, glm::value_ptr(MVP)); - glUniformMatrix4fv(glGetUniformLocation(shader.GetHandle(), "model"), 1, GL_FALSE, glm::value_ptr(modelMatrix)); - glUniformMatrix4fv(glGetUniformLocation(shader.GetHandle(), "view"), 1, GL_FALSE, glm::value_ptr(m_Camera->ViewMatrix())); - glBindVertexArray(model->VAO); - for (auto texGroup : model->TextureGroups) { - glActiveTexture(GL_TEXTURE0); - glBindTexture(GL_TEXTURE_2D, texGroup.Texture->texture); - glDrawArrays(GL_TRIANGLES, texGroup.StartIndex, texGroup.EndIndex - texGroup.StartIndex + 1); - } + MVP = cameraMatrix * modelMatrix; + glUniformMatrix4fv(glGetUniformLocation(shader.GetHandle(), "MVP"), 1, GL_FALSE, glm::value_ptr(MVP)); + glUniformMatrix4fv(glGetUniformLocation(shader.GetHandle(), "model"), 1, GL_FALSE, glm::value_ptr(modelMatrix)); + glUniformMatrix4fv(glGetUniformLocation(shader.GetHandle(), "view"), 1, GL_FALSE, glm::value_ptr(m_Camera->ViewMatrix())); + glBindVertexArray(model->VAO); + for (auto texGroup : model->TextureGroups) { + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D, texGroup.Texture->texture); + glDrawArrays(GL_TRIANGLES, texGroup.StartIndex, texGroup.EndIndex - texGroup.StartIndex + 1); } + }*/ } void Renderer::DrawText() @@ -328,11 +333,11 @@ void Renderer::AddTextToDraw() //Add to draw shit vector } -void Renderer::AddModelToDraw(std::shared_ptr model, glm::vec3 position, glm::quat orientation, glm::vec3 scale) +void Renderer::AddModelToDraw(std::shared_ptr model, glm::vec3 position, glm::quat orientation, glm::vec3 scale, bool visible) { glm::mat4 modelMatrix = glm::translate(glm::mat4(), position) * glm::toMat4(orientation) * glm::scale(scale); // You can now use ModelMatrix to build the MVP matrix - ModelsToRender.push_back(std::make_tuple(model.get(), modelMatrix)); + ModelsToRender.push_back(std::make_tuple(model.get(), modelMatrix, visible)); } void Renderer::AddPointLightToDraw( diff --git a/Escape-the-Dawn/Renderer.h b/Escape-the-Dawn/Renderer.h index 2c4c492..5c35b4f 100644 --- a/Escape-the-Dawn/Renderer.h +++ b/Escape-the-Dawn/Renderer.h @@ -30,7 +30,7 @@ public: int HEIGHT, WIDTH; - std::list> ModelsToRender; + std::list> ModelsToRender; int Lights; std::vector Light_position; std::vector Light_specular; @@ -47,7 +47,7 @@ public: void Draw(double dt); void DrawText(); - void AddModelToDraw(std::shared_ptr model, glm::vec3 position, glm::quat orientation, glm::vec3 scale); + void AddModelToDraw(std::shared_ptr model, glm::vec3 position, glm::quat orientation, glm::vec3 scale, bool visible); void AddTextToDraw(); void AddPointLightToDraw( glm::vec3 _position, diff --git a/Escape-the-Dawn/System.h b/Escape-the-Dawn/System.h index f62eda9..cbe9cb8 100644 --- a/Escape-the-Dawn/System.h +++ b/Escape-the-Dawn/System.h @@ -13,6 +13,8 @@ public: System(World* world) : m_World(world) { } virtual ~System() { } + virtual void Initialize() { } + // Called once per system every tick virtual void Update(double dt) { } // Called once for every entity in the world every tick diff --git a/Escape-the-Dawn/Systems/LevelGenerationSystem.cpp b/Escape-the-Dawn/Systems/LevelGenerationSystem.cpp index 05fcf0a..8fbfedc 100644 --- a/Escape-the-Dawn/Systems/LevelGenerationSystem.cpp +++ b/Escape-the-Dawn/Systems/LevelGenerationSystem.cpp @@ -93,6 +93,7 @@ void Systems::LevelGenerationSystem::Update( double dt ) for(auto ent : obstacles) { auto transform = m_World->GetComponent(ent, "Transform"); + auto model = m_World->GetComponent(ent, "Model"); transform->Velocity.z = velocity; transform->Position += transform->Velocity * (float)dt; @@ -103,7 +104,12 @@ void Systems::LevelGenerationSystem::Update( double dt ) transform->Velocity.y = 0; } - if(transform->Position.z > 800) + if (transform->Position.z > 10 && model->Visible) + { + model->Visible = false; + } + + if(transform->Position.z > 2000) { removethis.push_back(ent); } diff --git a/Escape-the-Dawn/Systems/RenderSystem.cpp b/Escape-the-Dawn/Systems/RenderSystem.cpp index 3165a0f..67827bd 100644 --- a/Escape-the-Dawn/Systems/RenderSystem.cpp +++ b/Escape-the-Dawn/Systems/RenderSystem.cpp @@ -25,7 +25,9 @@ void Systems::RenderSystem::UpdateEntity( double dt, EntityID entity, EntityID p } auto model = m_CachedModels[modelComponent->ModelFile]; - m_Renderer->AddModelToDraw(model, transformComponent->Position, transformComponent->Orientation, transformComponent->Scale); + glm::vec3 position = m_TransformSystem->AbsolutePosition(entity); + glm::quat orientation = m_TransformSystem->AbsoluteOrientation(entity); + m_Renderer->AddModelToDraw(model, position, orientation, transformComponent->Scale, modelComponent->Visible); } // Debug draw bounds @@ -33,7 +35,7 @@ void Systems::RenderSystem::UpdateEntity( double dt, EntityID entity, EntityID p auto collision = m_World->GetComponent(entity, "Collision"); auto bounds = m_World->GetComponent(entity, "Bounds"); if (bounds != nullptr) { - glm::vec3 origin = transformComponent->Position + (transformComponent->Scale * bounds->Origin); + glm::vec3 origin = m_TransformSystem->AbsolutePosition(entity) + (transformComponent->Scale * bounds->Origin); glm::vec3 volumeVector = transformComponent->Scale * bounds->VolumeVector; m_Renderer->AddAABBToDraw(origin, volumeVector, (collision != nullptr && collision->CollidingEntities.size() > 0)); } @@ -42,8 +44,9 @@ void Systems::RenderSystem::UpdateEntity( double dt, EntityID entity, EntityID p auto pointLightComponent = m_World->GetComponent(entity, "PointLight"); if (pointLightComponent != nullptr) { + glm::vec3 position = m_TransformSystem->AbsolutePosition(entity); m_Renderer->AddPointLightToDraw( - transformComponent->Position, + position, pointLightComponent->Specular, pointLightComponent->Diffuse, pointLightComponent->constantAttenuation, @@ -51,6 +54,7 @@ void Systems::RenderSystem::UpdateEntity( double dt, EntityID entity, EntityID p pointLightComponent->quadraticAttenuation, pointLightComponent->spotExponent); } + auto cameraComponent = m_World->GetComponent(entity, "Camera"); if (cameraComponent != nullptr) { @@ -63,6 +67,12 @@ void Systems::RenderSystem::UpdateEntity( double dt, EntityID entity, EntityID p } } +void Systems::RenderSystem::Initialize() +{ + m_TransformSystem = m_World->GetSystem("TransformSystem"); +} + + diff --git a/Escape-the-Dawn/Systems/RenderSystem.h b/Escape-the-Dawn/Systems/RenderSystem.h index d2a182f..f9e5ee6 100644 --- a/Escape-the-Dawn/Systems/RenderSystem.h +++ b/Escape-the-Dawn/Systems/RenderSystem.h @@ -4,6 +4,7 @@ #include #include "System.h" +#include "Systems/TransformSystem.h" #include "Model.h" #include "Texture.h" #include "Components/Model.h" @@ -22,6 +23,8 @@ namespace Systems RenderSystem(World* world, std::shared_ptr renderer) : System(world), m_Renderer(renderer){ } + void Initialize() override; + std::unordered_map> m_CachedModels; void OnComponentCreated(std::string type, std:: shared_ptr component) override; @@ -29,7 +32,7 @@ namespace Systems private: std::shared_ptr m_Renderer; - + std::shared_ptr m_TransformSystem; }; diff --git a/Escape-the-Dawn/Systems/TransformSystem.cpp b/Escape-the-Dawn/Systems/TransformSystem.cpp new file mode 100644 index 0000000..9cd65fa --- /dev/null +++ b/Escape-the-Dawn/Systems/TransformSystem.cpp @@ -0,0 +1,47 @@ +#include "TransformSystem.h" +#include "World.h" + +//void Systems::TransformSystem::UpdateEntity(double dt, EntityID entity, EntityID parent) +//{ +// if (parent == 0) +// return; +// +// auto transform = m_World->GetComponent(entity, "Transform"); +// auto parentTransform = m_World->GetComponent(parent, "Transform"); +// +// transform->Position = parentTransform->Position + transform->RelativePosition; +//} + +glm::vec3 Systems::TransformSystem::AbsolutePosition(EntityID entity) +{ + glm::vec3 absPosition; + glm::quat accumulativeOrientation; + + do + { + auto transform = m_World->GetComponent(entity, "Transform"); + //absPosition += transform->Position; + entity = m_World->GetEntityParent(entity); + auto transform2 = m_World->GetComponent(entity, "Transform"); + if (entity != 0) + absPosition += transform2->Orientation * transform->Position; + else + absPosition += transform->Position; + } while (entity != 0); + + return absPosition * accumulativeOrientation; +} + +glm::quat Systems::TransformSystem::AbsoluteOrientation(EntityID entity) +{ + glm::quat absOrientation; + + do + { + auto transform = m_World->GetComponent(entity, "Transform"); + absOrientation *= transform->Orientation; + entity = m_World->GetEntityParent(entity); + } while (entity != 0); + + return absOrientation; +} \ No newline at end of file diff --git a/Escape-the-Dawn/Systems/TransformSystem.h b/Escape-the-Dawn/Systems/TransformSystem.h new file mode 100644 index 0000000..b0cc2fa --- /dev/null +++ b/Escape-the-Dawn/Systems/TransformSystem.h @@ -0,0 +1,25 @@ +#ifndef TransformSystem_h__ +#define TransformSystem_h__ + +#include "System.h" +#include "Components/Transform.h" + +namespace Systems +{ + + class TransformSystem : public System + { + public: + TransformSystem(World* world) + : System(world) { } + + //void Update(double dt) override; + //void UpdateEntity(double dt, EntityID entity, EntityID parent) override; + + glm::vec3 AbsolutePosition(EntityID entity); + glm::quat AbsoluteOrientation(EntityID entity); + }; + +} + +#endif // TransformSystem_h__ diff --git a/Escape-the-Dawn/World.cpp b/Escape-the-Dawn/World.cpp index 1e24e82..15bbe40 100644 --- a/Escape-the-Dawn/World.cpp +++ b/Escape-the-Dawn/World.cpp @@ -107,19 +107,14 @@ World::World() void World::Initialize() { RegisterSystems(); + AddSystems(); + for (auto system : m_Systems) { + system.second->Initialize(); + } + RegisterComponents(); } -void World::RegisterSystems() -{ - -} - -void World::RegisterComponents() -{ - -} - std::shared_ptr World::AddComponent(EntityID entity, std::string componentType) { return AddComponent(entity, componentType); diff --git a/Escape-the-Dawn/World.h b/Escape-the-Dawn/World.h index 18a0fce..b481397 100644 --- a/Escape-the-Dawn/World.h +++ b/Escape-the-Dawn/World.h @@ -25,8 +25,10 @@ public: virtual void Initialize(); - virtual void RegisterComponents(); - virtual void RegisterSystems(); + virtual void RegisterSystems() = 0; + virtual void AddSystems() = 0; + virtual void RegisterComponents() = 0; + void AddSystem(std::string systemType); template From 3b4074cc175b7e62727d8ccb503b7c82ad1b0bdb Mon Sep 17 00:00:00 2001 From: sippeangelo Date: Thu, 13 Mar 2014 23:59:39 +0100 Subject: [PATCH 13/21] Fixed setters for camera projection values --- Escape-the-Dawn/Camera.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Escape-the-Dawn/Camera.cpp b/Escape-the-Dawn/Camera.cpp index 542864d..316a9a0 100644 --- a/Escape-the-Dawn/Camera.cpp +++ b/Escape-the-Dawn/Camera.cpp @@ -78,3 +78,21 @@ void Camera::UpdateViewMatrix() { m_ViewMatrix = glm::translate(glm::toMat4(m_Orientation), -m_Position); } + +void Camera::FOV(float val) +{ + m_FOV = val; + UpdateProjectionMatrix(); +} + +void Camera::NearClip(float val) +{ + m_NearClip = val; + UpdateProjectionMatrix(); +} + +void Camera::FarClip(float val) +{ + m_FarClip = val; + UpdateProjectionMatrix(); +} From 3378e75313d749d0590f86945f2901660ec69c99 Mon Sep 17 00:00:00 2001 From: ViktorLjung Date: Fri, 14 Mar 2014 00:00:36 +0100 Subject: [PATCH 14/21] Powerup FOV fixed --- Escape-the-Dawn/Models/plane.mtl | 2 +- Escape-the-Dawn/Models/planetexture.png | Bin 0 -> 6952 bytes .../Systems/LevelGenerationSystem.cpp | 2 +- Escape-the-Dawn/Systems/PlayerSystem.cpp | 13 ++++++++++--- 4 files changed, 12 insertions(+), 5 deletions(-) create mode 100644 Escape-the-Dawn/Models/planetexture.png diff --git a/Escape-the-Dawn/Models/plane.mtl b/Escape-the-Dawn/Models/plane.mtl index 2961836..28df6eb 100644 --- a/Escape-the-Dawn/Models/plane.mtl +++ b/Escape-the-Dawn/Models/plane.mtl @@ -9,4 +9,4 @@ Ks 0.500000 0.500000 0.500000 Ni 1.000000 d 1.000000 illum 2 -map_Kd ObstacleTexture.png +map_Kd planetexture.png diff --git a/Escape-the-Dawn/Models/planetexture.png b/Escape-the-Dawn/Models/planetexture.png new file mode 100644 index 0000000000000000000000000000000000000000..6766b13687f00ca520be4c54e86d6a2b55ac33bc GIT binary patch literal 6952 zcmeAS@N?(olHy`uVBq!ia0y~yVA%k|985rw6lawgK#IM@)7O>#9y70)g`mkgGfSY5 zc!_I7NpOBzNqJ&XDucU^3(y#aveY64V?C3?)+G;tN;pai{M>;u#y~cMSA(WJkYY)9 z^mSxl*x1kgCy^D%XG`*ScVYMsf(!O8pUl7@)$Hlw7*a9k&2>dapb-ZQeu*CwV*aRm z@NGJf?=kB=$gnyICkBQF4QCDp27y!#p!gylMFs|kDT*u%3>`)-Kox;)0t^farv!kW zaFHBUJQ^CKX=5~}j1~o>1>= 5 && typeRandom < 8) { m_World->SetProperty(ent, "Name", std::string("Obstacle")); - float scale = (float)(rand() % 1000) / 100; + float scale = 1.f + (float)(rand() % 1000) / 100; transform->Scale = glm::vec3(scale); bounds->VolumeVector = glm::vec3(1, 1, 1); bounds->Origin = glm::vec3(0,1,0); diff --git a/Escape-the-Dawn/Systems/PlayerSystem.cpp b/Escape-the-Dawn/Systems/PlayerSystem.cpp index 8080fa5..070b355 100644 --- a/Escape-the-Dawn/Systems/PlayerSystem.cpp +++ b/Escape-the-Dawn/Systems/PlayerSystem.cpp @@ -162,6 +162,9 @@ void Systems::PlayerSystem::UpdateEntity(double dt, EntityID entity, EntityID pa //powerup + auto cameraEntity = m_World->GetProperty(entity, "Camera"); + auto cameracamera = m_World->GetComponent(cameraEntity, "Camera"); + auto collisionComponent = m_World->GetComponent(entity, "Collision"); for(auto ent : collisionComponent->CollidingEntities) { @@ -171,25 +174,29 @@ void Systems::PlayerSystem::UpdateEntity(double dt, EntityID entity, EntityID pa auto powerupComp = m_World->GetComponent(ent, "PowerUp"); transform->Velocity.z = powerupComp->Speed; m_poweruptimeleft = 3.f; - m_World->RemoveEntity(ent); + m_World->RemoveEntity(ent); + + + cameracamera->FOV = 55.f; } } if(m_poweruptimeleft <= 0) { transform->Velocity.z = m_basespeed; + cameracamera->FOV = 45.f; } - //fixa FOV // Update camera if(! freecamEnabled) { - auto cameraEntity = m_World->GetProperty(entity, "Camera"); auto cameraTransform = m_World->GetComponent(cameraEntity, "Transform"); if (cameraTransform) { cameraTransform->Position = transform->Position + m_CameraOffset; cameraTransform->Orientation = m_CameraOrientation; } + + } } } From b206ca0e4f45d152479916913a733ef8d45460e5 Mon Sep 17 00:00:00 2001 From: sippeangelo Date: Fri, 14 Mar 2014 00:05:38 +0100 Subject: [PATCH 15/21] Moar files --- Escape-the-Dawn/Camera.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Escape-the-Dawn/Camera.h b/Escape-the-Dawn/Camera.h index baea8a5..bc2cb83 100644 --- a/Escape-the-Dawn/Camera.h +++ b/Escape-the-Dawn/Camera.h @@ -39,13 +39,13 @@ public: void ViewMatrix(glm::mat4 val) { m_ViewMatrix = val; } float FOV() const { return m_FOV; } - void FOV(float val) { m_FOV = val; } + void FOV(float val); float NearClip() const { return m_NearClip; } - void NearClip(float val) { m_NearClip = val; } + void NearClip(float val); float FarClip() const { return m_FarClip; } - void FarClip(float val) { m_FarClip = val; } + void FarClip(float val); private: void UpdateProjectionMatrix(); From 87ee7cfd768c290bcaf85413ebf348d9b26f8d97 Mon Sep 17 00:00:00 2001 From: Tobias Dahl Date: Fri, 14 Mar 2014 00:30:50 +0100 Subject: [PATCH 16/21] [WIP] Camera stuff --- Escape-the-Dawn/Camera.cpp | 2 +- Escape-the-Dawn/Shaders/Fragment.glsl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Escape-the-Dawn/Camera.cpp b/Escape-the-Dawn/Camera.cpp index 316a9a0..51977c3 100644 --- a/Escape-the-Dawn/Camera.cpp +++ b/Escape-the-Dawn/Camera.cpp @@ -95,4 +95,4 @@ void Camera::FarClip(float val) { m_FarClip = val; UpdateProjectionMatrix(); -} +} \ No newline at end of file diff --git a/Escape-the-Dawn/Shaders/Fragment.glsl b/Escape-the-Dawn/Shaders/Fragment.glsl index ca7ef0b..5e3f603 100644 --- a/Escape-the-Dawn/Shaders/Fragment.glsl +++ b/Escape-the-Dawn/Shaders/Fragment.glsl @@ -23,7 +23,7 @@ in VertexData { vec3 ShadowCoord; } Input; -vec3 scene_ambient = vec3(0.98f, 0.95f, 0.8f); +vec3 scene_ambient = vec3(0.98, 0.95, 0.7); out vec4 fragmentColor; From 23701c4ac20583fee2339b8ed1a731b6312669d7 Mon Sep 17 00:00:00 2001 From: sippeangelo Date: Fri, 14 Mar 2014 00:37:09 +0100 Subject: [PATCH 17/21] GLM... radians pls. --- Escape-the-Dawn/Camera.h | 9 +-------- Escape-the-Dawn/Component.h | 2 ++ Escape-the-Dawn/Components/Bounds.h | 1 - Escape-the-Dawn/Components/Transform.h | 1 - Escape-the-Dawn/Escape-the-Dawn.vcxproj | 1 + Escape-the-Dawn/Escape-the-Dawn.vcxproj.filters | 1 + Escape-the-Dawn/GLM.h | 9 +++++++++ Escape-the-Dawn/Model.h | 5 +---- Escape-the-Dawn/OpenGL.h | 3 +-- Escape-the-Dawn/Renderer.h | 7 +------ Escape-the-Dawn/Systems/SoundSystem.h | 1 - 11 files changed, 17 insertions(+), 23 deletions(-) create mode 100644 Escape-the-Dawn/GLM.h diff --git a/Escape-the-Dawn/Camera.h b/Escape-the-Dawn/Camera.h index bc2cb83..973ff5d 100644 --- a/Escape-the-Dawn/Camera.h +++ b/Escape-the-Dawn/Camera.h @@ -1,13 +1,7 @@ #ifndef Camera_h__ #define Camera_h__ -#define GLM_FORCE_RADIANS -#include -#include -#include -#include -#include -#include +#include "GLM.h" class Camera { @@ -55,7 +49,6 @@ private: float m_AspectRatio; float m_NearClip; float m_FarClip; - glm::vec3 m_Position; glm::quat m_Orientation; diff --git a/Escape-the-Dawn/Component.h b/Escape-the-Dawn/Component.h index 21d59f6..adaa4f7 100644 --- a/Escape-the-Dawn/Component.h +++ b/Escape-the-Dawn/Component.h @@ -1,6 +1,8 @@ #ifndef Component_h__ #define Component_h__ +#include "GLM.h" + #include "Factory.h" #include "Entity.h" diff --git a/Escape-the-Dawn/Components/Bounds.h b/Escape-the-Dawn/Components/Bounds.h index 3845485..f05c6d8 100644 --- a/Escape-the-Dawn/Components/Bounds.h +++ b/Escape-the-Dawn/Components/Bounds.h @@ -2,7 +2,6 @@ #define Components_Bounds_h__ #include "Component.h" -#include namespace Components { diff --git a/Escape-the-Dawn/Components/Transform.h b/Escape-the-Dawn/Components/Transform.h index 5d20a67..8d0073f 100644 --- a/Escape-the-Dawn/Components/Transform.h +++ b/Escape-the-Dawn/Components/Transform.h @@ -2,7 +2,6 @@ #define Components_Transform_h__ #include "Component.h" -#include namespace Components { diff --git a/Escape-the-Dawn/Escape-the-Dawn.vcxproj b/Escape-the-Dawn/Escape-the-Dawn.vcxproj index d8c44c3..0b8fcfa 100644 --- a/Escape-the-Dawn/Escape-the-Dawn.vcxproj +++ b/Escape-the-Dawn/Escape-the-Dawn.vcxproj @@ -144,6 +144,7 @@ + diff --git a/Escape-the-Dawn/Escape-the-Dawn.vcxproj.filters b/Escape-the-Dawn/Escape-the-Dawn.vcxproj.filters index 06f96a7..e19e833 100644 --- a/Escape-the-Dawn/Escape-the-Dawn.vcxproj.filters +++ b/Escape-the-Dawn/Escape-the-Dawn.vcxproj.filters @@ -154,6 +154,7 @@ Systems + diff --git a/Escape-the-Dawn/GLM.h b/Escape-the-Dawn/GLM.h new file mode 100644 index 0000000..db5bcc1 --- /dev/null +++ b/Escape-the-Dawn/GLM.h @@ -0,0 +1,9 @@ +#define GLM_FORCE_RADIANS +#include +#include +#include +#include +#include +#include +#include +#include \ No newline at end of file diff --git a/Escape-the-Dawn/Model.h b/Escape-the-Dawn/Model.h index 716d1c2..2888f95 100644 --- a/Escape-the-Dawn/Model.h +++ b/Escape-the-Dawn/Model.h @@ -9,10 +9,7 @@ #include #include "OpenGL.h" -#include -#include -#include -#include +#include "GLM.h" #include #include diff --git a/Escape-the-Dawn/OpenGL.h b/Escape-the-Dawn/OpenGL.h index dec332d..2e34a34 100644 --- a/Escape-the-Dawn/OpenGL.h +++ b/Escape-the-Dawn/OpenGL.h @@ -1,5 +1,4 @@ #include #define GLFW_INCLUDE_GLU #include -#include -#define GLM_FORCE_RADIANS \ No newline at end of file +#include \ No newline at end of file diff --git a/Escape-the-Dawn/Renderer.h b/Escape-the-Dawn/Renderer.h index 5c35b4f..777643c 100644 --- a/Escape-the-Dawn/Renderer.h +++ b/Escape-the-Dawn/Renderer.h @@ -8,12 +8,7 @@ #include #include "OpenGL.h" -#include -#include -#include -#include -#include -#include +#include "GLM.h" #include "glerror.h" #include "Camera.h" diff --git a/Escape-the-Dawn/Systems/SoundSystem.h b/Escape-the-Dawn/Systems/SoundSystem.h index f8b97eb..303b5c5 100644 --- a/Escape-the-Dawn/Systems/SoundSystem.h +++ b/Escape-the-Dawn/Systems/SoundSystem.h @@ -7,7 +7,6 @@ #include #include #include -#include namespace Systems { From 4b9cb71cca13edd1cd0959f30f15e06fdd66892d Mon Sep 17 00:00:00 2001 From: ViktorLjung Date: Fri, 14 Mar 2014 00:57:52 +0100 Subject: [PATCH 18/21] Fixad FOV Levelgen Spawnfrequency --- Escape-the-Dawn/Components/Camera.h | 2 ++ Escape-the-Dawn/GameWorld.cpp | 2 +- .../Systems/LevelGenerationSystem.cpp | 4 +++- .../Systems/LevelGenerationSystem.h | 1 + Escape-the-Dawn/Systems/PlayerSystem.cpp | 24 ++++++++++++++----- Escape-the-Dawn/Systems/PlayerSystem.h | 3 +++ 6 files changed, 28 insertions(+), 8 deletions(-) diff --git a/Escape-the-Dawn/Components/Camera.h b/Escape-the-Dawn/Components/Camera.h index 62d6905..2cd379d 100644 --- a/Escape-the-Dawn/Components/Camera.h +++ b/Escape-the-Dawn/Components/Camera.h @@ -8,6 +8,8 @@ namespace Components struct Camera : Component { + Camera() : FOV(glm::radians(45.f)), NearClip(0.1f), FarClip(100.f) { } + float FOV; float NearClip; float FarClip; diff --git a/Escape-the-Dawn/GameWorld.cpp b/Escape-the-Dawn/GameWorld.cpp index 10657cd..7eb218e 100644 --- a/Escape-the-Dawn/GameWorld.cpp +++ b/Escape-the-Dawn/GameWorld.cpp @@ -65,7 +65,7 @@ void GameWorld::Initialize() AddComponent(entcamera, "Input"); transform->Position = glm::vec3(0.f, 10.f, 14.f); camera = AddComponent(entcamera, "Camera"); - camera->FOV = 45.f; + camera->FOV = glm::radians(45.f); camera->FarClip = 1000.f; camera->NearClip = 0.01f; transform->Orientation = glm::angleAxis(glm::radians(15.0f),glm::vec3(1,0,0)); diff --git a/Escape-the-Dawn/Systems/LevelGenerationSystem.cpp b/Escape-the-Dawn/Systems/LevelGenerationSystem.cpp index 31e31da..0804afc 100644 --- a/Escape-the-Dawn/Systems/LevelGenerationSystem.cpp +++ b/Escape-the-Dawn/Systems/LevelGenerationSystem.cpp @@ -8,6 +8,7 @@ Systems::LevelGenerationSystem::LevelGenerationSystem( World* world ) velocity = 0; startx = 0; startyz = glm::vec2(0, -1000); + spawnFrequency = 0.1f; } void Systems::LevelGenerationSystem::SpawnObstacle() @@ -85,8 +86,9 @@ void Systems::LevelGenerationSystem::Update( double dt ) { elapsedtime += dt; + spawnFrequency = velocity/1000; - if(elapsedtime > 0.1){ + if(elapsedtime > spawnFrequency){ SpawnObstacle(); elapsedtime = 0; } diff --git a/Escape-the-Dawn/Systems/LevelGenerationSystem.h b/Escape-the-Dawn/Systems/LevelGenerationSystem.h index ab02fe3..7d0339d 100644 --- a/Escape-the-Dawn/Systems/LevelGenerationSystem.h +++ b/Escape-the-Dawn/Systems/LevelGenerationSystem.h @@ -33,6 +33,7 @@ namespace Systems float startx; double elapsedtime; float velocity; + float spawnFrequency; }; } diff --git a/Escape-the-Dawn/Systems/PlayerSystem.cpp b/Escape-the-Dawn/Systems/PlayerSystem.cpp index 070b355..177b6bf 100644 --- a/Escape-the-Dawn/Systems/PlayerSystem.cpp +++ b/Escape-the-Dawn/Systems/PlayerSystem.cpp @@ -12,6 +12,7 @@ Systems::PlayerSystem::PlayerSystem( World* world ) : System(world) freecamEnabled = false; m_poweruptimeleft = 0; m_basespeed = 100.f; + m_maxspeed = 100.f; } void Systems::PlayerSystem::Update(double dt) @@ -164,6 +165,7 @@ void Systems::PlayerSystem::UpdateEntity(double dt, EntityID entity, EntityID pa //powerup auto cameraEntity = m_World->GetProperty(entity, "Camera"); auto cameracamera = m_World->GetComponent(cameraEntity, "Camera"); + cameracamera->FOV = glm::radians(20.f + transform->Velocity.z/3 ); auto collisionComponent = m_World->GetComponent(entity, "Collision"); for(auto ent : collisionComponent->CollidingEntities) @@ -172,19 +174,29 @@ void Systems::PlayerSystem::UpdateEntity(double dt, EntityID entity, EntityID pa if(name == "PowerUp") { auto powerupComp = m_World->GetComponent(ent, "PowerUp"); - transform->Velocity.z = powerupComp->Speed; - m_poweruptimeleft = 3.f; + m_maxspeed = powerupComp->Speed; + m_poweruptimeleft = 5.f; m_World->RemoveEntity(ent); - - cameracamera->FOV = 55.f; } } if(m_poweruptimeleft <= 0) { - transform->Velocity.z = m_basespeed; - cameracamera->FOV = 45.f; + m_maxspeed = m_basespeed; } + if(transform->Velocity.z < m_maxspeed) + { + transform->Velocity.z += 100.f*dt; + if(transform->Velocity.z >= m_maxspeed) + transform->Velocity.z = m_maxspeed; + } + else if(transform->Velocity.z > m_maxspeed) + { + transform->Velocity.z -= 50.f*dt; + if(transform->Velocity.z <= m_maxspeed) + transform->Velocity.z = m_maxspeed; + } + // Update camera diff --git a/Escape-the-Dawn/Systems/PlayerSystem.h b/Escape-the-Dawn/Systems/PlayerSystem.h index 9da1204..993ee20 100644 --- a/Escape-the-Dawn/Systems/PlayerSystem.h +++ b/Escape-the-Dawn/Systems/PlayerSystem.h @@ -34,7 +34,10 @@ namespace Systems glm::quat m_CameraOrientation; bool freecamEnabled; + float m_basespeed; + float m_maxspeed; + float m_poweruptimeleft; }; From 357f370e4f93979cfd6eb66eae76acc28c1febce Mon Sep 17 00:00:00 2001 From: ViktorLjung Date: Fri, 14 Mar 2014 01:09:30 +0100 Subject: [PATCH 19/21] =?UTF-8?q?fixade=20de=20sm=C3=A5=20objekten?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Escape-the-Dawn/Systems/LevelGenerationSystem.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Escape-the-Dawn/Systems/LevelGenerationSystem.cpp b/Escape-the-Dawn/Systems/LevelGenerationSystem.cpp index 0804afc..cd2e5f2 100644 --- a/Escape-the-Dawn/Systems/LevelGenerationSystem.cpp +++ b/Escape-the-Dawn/Systems/LevelGenerationSystem.cpp @@ -38,7 +38,7 @@ void Systems::LevelGenerationSystem::SpawnObstacle() if(typeRandom >= 0 && typeRandom < 2) // Mountain stuff :D { m_World->SetProperty(ent, "Name", std::string("Obstacle")); - float scale = (float)(rand() % 1000) / 250; + float scale = 1.0f + (float)(rand() % 1000) / 250; transform->Scale = glm::vec3(scale); bounds->VolumeVector = glm::vec3(9, 12, 7); bounds->Origin = glm::vec3(1,11,-1); @@ -47,7 +47,7 @@ void Systems::LevelGenerationSystem::SpawnObstacle() else if(typeRandom >= 2 && typeRandom < 5) // Single Mountain :D { m_World->SetProperty(ent, "Name", std::string("Obstacle")); - float scale = (float)(rand() % 1000) / 200; + float scale = 1.0f + (float)(rand() % 1000) / 200; transform->Scale = glm::vec3(scale); bounds->VolumeVector = glm::vec3(3.5f, 7.5f, 3.5f); bounds->Origin = glm::vec3(0,7.5f,0); @@ -65,7 +65,6 @@ void Systems::LevelGenerationSystem::SpawnObstacle() if(typeRandom >= 8 && typeRandom < 10) { m_World->SetProperty(ent, "Name", std::string("PowerUp")); - float scale = (float)(rand() % 1000) / 100; bounds->VolumeVector = glm::vec3(4, 4, 4); bounds->Origin = glm::vec3(0,4,0); From 00e9d64543b6cbc53e5a18b8e2c3a11b8babb6d6 Mon Sep 17 00:00:00 2001 From: Tobias Dahl Date: Fri, 14 Mar 2014 01:11:03 +0100 Subject: [PATCH 20/21] Fixade spinskiten --- Escape-the-Dawn/Systems/PlayerSystem.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Escape-the-Dawn/Systems/PlayerSystem.cpp b/Escape-the-Dawn/Systems/PlayerSystem.cpp index 177b6bf..96cbc8f 100644 --- a/Escape-the-Dawn/Systems/PlayerSystem.cpp +++ b/Escape-the-Dawn/Systems/PlayerSystem.cpp @@ -108,7 +108,7 @@ void Systems::PlayerSystem::UpdateEntity(double dt, EntityID entity, EntityID pa glm::vec3 Ship_Forward = glm::vec3(glm::vec4(0, 0, 1, 0)); float TurnSpeed = 1.0f; - glm::vec3 Euler = glm::eulerAngles(transform->Orientation); + glm::vec3 Euler = glm::degrees(glm::eulerAngles(transform->Orientation)); if(input->KeyState[GLFW_KEY_LEFT]) { transform->Position -= Ship_Right * (float)dt * (m_PlayerSpeed + Euler.z); From c2ad1f9321839db643ef3aa08f3f5c0fdb9597ff Mon Sep 17 00:00:00 2001 From: ViktorLjung Date: Fri, 14 Mar 2014 01:17:46 +0100 Subject: [PATCH 21/21] spawn --- Escape-the-Dawn/Systems/LevelGenerationSystem.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Escape-the-Dawn/Systems/LevelGenerationSystem.cpp b/Escape-the-Dawn/Systems/LevelGenerationSystem.cpp index cd2e5f2..f855458 100644 --- a/Escape-the-Dawn/Systems/LevelGenerationSystem.cpp +++ b/Escape-the-Dawn/Systems/LevelGenerationSystem.cpp @@ -85,7 +85,7 @@ void Systems::LevelGenerationSystem::Update( double dt ) { elapsedtime += dt; - spawnFrequency = velocity/1000; + spawnFrequency = 10/velocity; if(elapsedtime > spawnFrequency){ SpawnObstacle();