shared_ptr -> std::shared_ptr

This is one of the first commits in a plan to remove all `using namespace std;` lines in the entire codebase as it is considered anti-pattern today.
This commit is contained in:
void_17
2026-03-02 15:58:20 +07:00
parent d63f79325f
commit 7074f35e4b
1373 changed files with 12054 additions and 12054 deletions

View File

@@ -7,17 +7,17 @@ ViewportCuller::Face::Face(double x, double y, double z, float yRot, float xRot)
this->xc = x;
this->yc = y;
this->zc = z;
xd = Mth::sin(yRot / 180 * PI) * Mth::cos(xRot / 180 * PI);
zd = -Mth::cos(yRot / 180 * PI) * Mth::cos(xRot / 180 * PI);
yd = -Mth::sin(xRot / 180 * PI);
cullOffs = xc*xd+yc*yd+zc*zd;
cullOffs = xc*xd+yc*yd+zc*zd;
}
bool ViewportCuller::Face::inFront(double x, double y, double z, double r)
{
return x*xd+y*yd+z*zd>cullOffs-r;
return x*xd+y*yd+z*zd>cullOffs-r;
}
bool ViewportCuller::Face::inFront(double x0, double y0, double z0, double x1, double y1, double z1)
@@ -30,7 +30,7 @@ bool ViewportCuller::Face::inFront(double x0, double y0, double z0, double x1, d
x0*xd+y0*yd+z1*zd>cullOffs ||
x1*xd+y0*yd+z1*zd>cullOffs ||
x0*xd+y1*yd+z1*zd>cullOffs ||
x1*xd+y1*yd+z1*zd>cullOffs
x1*xd+y1*yd+z1*zd>cullOffs
) return true;
return false;
}
@@ -44,18 +44,18 @@ bool ViewportCuller::Face::fullyInFront(double x0, double y0, double z0, double
x0*xd+y0*yd+z1*zd<cullOffs ||
x1*xd+y0*yd+z1*zd<cullOffs ||
x0*xd+y1*yd+z1*zd<cullOffs ||
x1*xd+y1*yd+z1*zd<cullOffs
x1*xd+y1*yd+z1*zd<cullOffs
) return false;
return true;
}
ViewportCuller::ViewportCuller(shared_ptr<Mob> mob, double fogDistance, float a)
ViewportCuller::ViewportCuller(std::shared_ptr<Mob> mob, double fogDistance, float a)
{
float yRot = mob->yRotO+(mob->yRot-mob->yRotO)*a;
float xRot = mob->xRotO+(mob->xRot-mob->xRotO)*a;
double x = mob->xOld+(mob->x-mob->xOld)*a;
double y = mob->yOld+(mob->y-mob->yOld)*a;
double x = mob->xOld+(mob->x-mob->xOld)*a;
double y = mob->yOld+(mob->y-mob->yOld)*a;
double z = mob->zOld+(mob->z-mob->zOld)*a;
double xd = Mth::sin(yRot / 180 * PI) * Mth::cos(xRot / 180 * PI);
@@ -69,7 +69,7 @@ ViewportCuller::ViewportCuller(shared_ptr<Mob> mob, double fogDistance, float a)
faces[2] = Face(x, y, z, yRot-xFov, xRot);
faces[3] = Face(x, y, z, yRot, xRot+yFov);
faces[4] = Face(x, y, z, yRot, xRot-yFov);
faces[5] = Face(x+xd*fogDistance, y+yd*fogDistance, z+zd*fogDistance, yRot+180, -xRot);
faces[5] = Face(x+xd*fogDistance, y+yd*fogDistance, z+zd*fogDistance, yRot+180, -xRot);
}
bool ViewportCuller::isVisible(AABB bb)
@@ -88,12 +88,12 @@ bool ViewportCuller::cubeInFrustum(double x0, double y0, double z0, double x1, d
double xd = (x1-x0)/2.0f;
double yd = (y1-y0)/2.0f;
double zd = (z1-z0)/2.0f;
double xc = x0+xd;
double yc = y0+yd;
double zc = z0+zd;
double r = _max(xd, yd, zd)*1.5f;
if (!faces[0].inFront(xc, yc, zc, r)) return false;
if (!faces[1].inFront(xc, yc, zc, r)) return false;
if (!faces[2].inFront(xc, yc, zc, r)) return false;
@@ -123,7 +123,7 @@ bool ViewportCuller::cubeFullyInFrustum(double x0, double y0, double z0, double
double xd = (x1-x0)/2.0f;
double yd = (y1-y0)/2.0f;
double zd = (z1-z0)/2.0f;
double xc = x0+xd;
double yc = y0+yd;
double zc = z0+zd;
@@ -135,8 +135,8 @@ bool ViewportCuller::cubeFullyInFrustum(double x0, double y0, double z0, double
if (!faces[3].inFront(xc, yc, zc, r)) return false;
if (!faces[4].inFront(xc, yc, zc, r)) return false;
if (!faces[5].inFront(xc, yc, zc, r)) return false;
if (!faces[0].fullyInFront(x0, y0, z0, x1, y1, z1)) return false;
if (!faces[1].fullyInFront(x0, y0, z0, x1, y1, z1)) return false;
if (!faces[2].fullyInFront(x0, y0, z0, x1, y1, z1)) return false;