2 Copyright (C) 2003, 2010 - Wolfire Games
3 Copyright (C) 2010-2017 - Lugaru contributors (see AUTHORS file)
5 This file is part of Lugaru.
7 Lugaru is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 Lugaru is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with Lugaru. If not, see <http://www.gnu.org/licenses/>.
24 #include "Environment/Lights.hpp"
25 #include "Environment/Terrain.hpp"
26 #include "Graphic/gamegl.hpp"
27 #include "Graphic/Models.hpp"
28 #include "Graphic/Sprite.hpp"
29 #include "Graphic/Texture.hpp"
30 #include "Math/Frustum.hpp"
31 #include "Math/XYZ.hpp"
32 #include "Utils/ImageIO.hpp"
40 #define max_objects 300
62 static std::vector<std::unique_ptr<Object>> objects;
65 static Texture boxtextureptr;
66 static Texture treetextureptr;
67 static Texture bushtextureptr;
68 static Texture rocktextureptr;
91 Object(object_type _type, XYZ _position, float _yaw, float _pitch, float _scale);
93 static void ComputeCenter();
94 static void ComputeRadius();
95 static void AddObjectsToTerrain();
96 static void LoadObjectsFromFile(FILE* tfile, bool skip);
97 static void SphereCheckPossible(XYZ *p1, float radius);
98 static void DeleteObject(int which);
99 static void MakeObject(int atype, XYZ where, float ayaw, float apitch, float ascale);
101 static void DoShadows();
102 static void DoStuff();
103 static int checkcollide(XYZ startpoint, XYZ endpoint);
104 static int checkcollide(XYZ startpoint, XYZ endpoint, int what);
108 void handleRot(int divide);
109 void doShadows(XYZ lightloc);
111 void drawSecondPass();
112 void addToTerrain(unsigned id);
113 static int checkcollide(XYZ startpoint, XYZ endpoint, int what, float minx, float miny, float minz, float maxx, float maxy, float maxz);