the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
1#pragma once
2using namespace std;
3
4class AABB;
5
6class Vec3
7{
8 // 4J added so we can have separate pools for different threads
9 class ThreadStorage
10 {
11 public:
12 static const int POOL_SIZE = 1024;
13 Vec3 *pool;
14 unsigned int poolPointer;
15 ThreadStorage();
16 ~ThreadStorage();
17 };
18 static DWORD tlsIdx;
19 static ThreadStorage *tlsDefault;
20public:
21 // Each new thread that needs to use Vec3 pools will need to call one of the following 2 functions, to either create its own
22 // local storage, or share the default storage already allocated by the main thread
23 static void CreateNewThreadStorage();
24 static void UseDefaultThreadStorage();
25 static void ReleaseThreadStorage();
26
27 static Vec3 *newPermanent(double x, double y, double z);
28 static void clearPool();
29 static void resetPool();
30 static Vec3 *newTemp(double x, double y, double z);
31 double x, y, z;
32private:
33 Vec3() {}
34 Vec3(double x, double y, double z);
35 Vec3 *set(double x, double y, double z);
36public:
37 Vec3 *interpolateTo(Vec3 *t, double p);
38 Vec3 *vectorTo(Vec3 *p);
39 Vec3 *normalize();
40 double dot(Vec3 *p);
41 Vec3 *cross(Vec3 *p);
42 Vec3 *add(double x, double y, double z);
43 double distanceTo(Vec3 *p);
44 double distanceToSqr(Vec3 *p);
45 double distanceToSqr(double x2, double y2, double z2);
46 Vec3 *scale(double l);
47 double length();
48 Vec3 *clipX(Vec3 *b, double xt);
49 Vec3 *clipY(Vec3 *b, double yt);
50 Vec3 *clipZ(Vec3 *b, double zt);
51 wstring toString();
52 Vec3 *lerp(Vec3 *v, double a);
53 void xRot(float degs);
54 void yRot(float degs);
55 void zRot(float degs);
56
57 // 4J Added
58 double distanceTo(AABB *box);
59
60 Vec3* closestPointOnLine(Vec3* p1, Vec3* p2);
61 double distanceFromLine(Vec3* p1, Vec3* p2);
62
63};