style: remove all "using namespace polylib"
This commit is contained in:
parent
f8886b6e60
commit
a2ea5d8217
|
|
@ -230,14 +230,12 @@ struct decomp_plane_t : qplane3d
|
||||||
|
|
||||||
// brush creation
|
// brush creation
|
||||||
|
|
||||||
using namespace polylib;
|
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void RemoveRedundantPlanes(std::vector<T> &planes)
|
void RemoveRedundantPlanes(std::vector<T> &planes)
|
||||||
{
|
{
|
||||||
auto removed = std::remove_if(planes.begin(), planes.end(), [&planes](const T &plane) {
|
auto removed = std::remove_if(planes.begin(), planes.end(), [&planes](const T &plane) {
|
||||||
// outward-facing plane
|
// outward-facing plane
|
||||||
std::optional<polylib::winding_t> winding = winding_t::from_plane(plane, 10e6);
|
std::optional<polylib::winding_t> winding = polylib::winding_t::from_plane(plane, 10e6);
|
||||||
|
|
||||||
// clip `winding` by all of the other planes, flipped
|
// clip `winding` by all of the other planes, flipped
|
||||||
for (const T &plane2 : planes) {
|
for (const T &plane2 : planes) {
|
||||||
|
|
@ -267,7 +265,7 @@ struct decomp_brush_face_t
|
||||||
* The currently clipped section of the face.
|
* The currently clipped section of the face.
|
||||||
* May be nullopt to indicate it was clipped away.
|
* May be nullopt to indicate it was clipped away.
|
||||||
*/
|
*/
|
||||||
std::optional<winding_t> winding;
|
std::optional<polylib::winding_t> winding;
|
||||||
/**
|
/**
|
||||||
* The face we were originally derived from
|
* The face we were originally derived from
|
||||||
*/
|
*/
|
||||||
|
|
@ -292,13 +290,13 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
decomp_brush_face_t(const mbsp_t *bsp, const mface_t *face)
|
decomp_brush_face_t(const mbsp_t *bsp, const mface_t *face)
|
||||||
: winding(winding_t::from_face(bsp, face)),
|
: winding(polylib::winding_t::from_face(bsp, face)),
|
||||||
original_face(face)
|
original_face(face)
|
||||||
{
|
{
|
||||||
buildInwardFacingEdgePlanes();
|
buildInwardFacingEdgePlanes();
|
||||||
}
|
}
|
||||||
|
|
||||||
decomp_brush_face_t(std::optional<winding_t> &&windingToTakeOwnership, const mface_t *face)
|
decomp_brush_face_t(std::optional<polylib::winding_t> &&windingToTakeOwnership, const mface_t *face)
|
||||||
: winding(std::move(windingToTakeOwnership)),
|
: winding(std::move(windingToTakeOwnership)),
|
||||||
original_face(face)
|
original_face(face)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -28,8 +28,6 @@
|
||||||
|
|
||||||
#include <common/qvec.hh>
|
#include <common/qvec.hh>
|
||||||
|
|
||||||
using namespace polylib;
|
|
||||||
|
|
||||||
qmat3x3d RotateAboutX(double t)
|
qmat3x3d RotateAboutX(double t)
|
||||||
{
|
{
|
||||||
// https://en.wikipedia.org/wiki/Rotation_matrix#Examples
|
// https://en.wikipedia.org/wiki/Rotation_matrix#Examples
|
||||||
|
|
@ -412,7 +410,7 @@ std::pair<std::vector<qvec3f>, std::vector<qvec3f>> ClipPoly(const std::vector<q
|
||||||
if (poly.empty())
|
if (poly.empty())
|
||||||
return make_pair(std::vector<qvec3f>(), std::vector<qvec3f>());
|
return make_pair(std::vector<qvec3f>(), std::vector<qvec3f>());
|
||||||
|
|
||||||
winding_t w = winding_t::from_winding_points(poly);
|
auto w = polylib::winding_t::from_winding_points(poly);
|
||||||
|
|
||||||
auto clipped = w.clip({plane.xyz(), plane[3]});
|
auto clipped = w.clip({plane.xyz(), plane[3]});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,8 +39,6 @@
|
||||||
#include <common/qvec.hh>
|
#include <common/qvec.hh>
|
||||||
#include <common/parallel.hh>
|
#include <common/parallel.hh>
|
||||||
|
|
||||||
using namespace polylib;
|
|
||||||
|
|
||||||
static std::atomic_size_t bouncelightpoints;
|
static std::atomic_size_t bouncelightpoints;
|
||||||
|
|
||||||
void ResetBounce()
|
void ResetBounce()
|
||||||
|
|
@ -88,8 +86,8 @@ static bool Face_ShouldBounce(const mbsp_t *bsp, const mface_t *face)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void MakeBounceLight(const mbsp_t *bsp, const settings::worldspawn_keys &cfg, lightsurf_t &surf,
|
static void MakeBounceLight(const mbsp_t *bsp, const settings::worldspawn_keys &cfg, lightsurf_t &surf,
|
||||||
qvec3d texture_color, int32_t style, const std::vector<qvec3f> &points, const winding_t &winding, const vec_t &area,
|
qvec3d texture_color, int32_t style, const std::vector<qvec3f> &points, const polylib::winding_t &winding,
|
||||||
const qvec3d &facenormal, const qvec3d &facemidpoint)
|
const vec_t &area, const qvec3d &facenormal, const qvec3d &facemidpoint)
|
||||||
{
|
{
|
||||||
if (!Face_IsEmissive(bsp, surf.face)) {
|
if (!Face_IsEmissive(bsp, surf.face)) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -168,7 +166,7 @@ static void MakeBounceLightsThread(const settings::worldspawn_keys &cfg, const m
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
winding_t winding = winding_t::from_face(bsp, &face);
|
auto winding = polylib::winding_t::from_face(bsp, &face);
|
||||||
vec_t area = winding.area();
|
vec_t area = winding.area();
|
||||||
|
|
||||||
if (area < 1.f) {
|
if (area < 1.f) {
|
||||||
|
|
@ -238,7 +236,7 @@ static void MakeBounceLightsThread(const settings::worldspawn_keys &cfg, const m
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
winding.dice(cfg.bouncelightsubdivision.value(),
|
winding.dice(cfg.bouncelightsubdivision.value(),
|
||||||
[&points, &faceplane](winding_t &w) { points.push_back(w.center() + faceplane.normal); });
|
[&points, &faceplane](polylib::winding_t &w) { points.push_back(w.center() + faceplane.normal); });
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto &style : emitcolors) {
|
for (auto &style : emitcolors) {
|
||||||
|
|
|
||||||
|
|
@ -37,8 +37,6 @@ See file, 'COPYING', for details.
|
||||||
|
|
||||||
#include <common/qvec.hh>
|
#include <common/qvec.hh>
|
||||||
|
|
||||||
using namespace polylib;
|
|
||||||
|
|
||||||
static std::atomic_size_t total_surflight_points;
|
static std::atomic_size_t total_surflight_points;
|
||||||
|
|
||||||
void ResetSurflight()
|
void ResetSurflight()
|
||||||
|
|
@ -109,7 +107,7 @@ static void MakeSurfaceLight(const mbsp_t *bsp, const settings::worldspawn_keys
|
||||||
auto &l = surf.vpl = std::make_unique<surfacelight_t>();
|
auto &l = surf.vpl = std::make_unique<surfacelight_t>();
|
||||||
|
|
||||||
// Create winding...
|
// Create winding...
|
||||||
winding_t winding = winding_t::from_winding_points(poly);
|
auto winding = polylib::winding_t::from_winding_points(poly);
|
||||||
auto face_modelinfo = ModelInfoForFace(bsp, face - bsp->dfaces.data());
|
auto face_modelinfo = ModelInfoForFace(bsp, face - bsp->dfaces.data());
|
||||||
|
|
||||||
for (auto &pt : winding) {
|
for (auto &pt : winding) {
|
||||||
|
|
@ -152,7 +150,7 @@ static void MakeSurfaceLight(const mbsp_t *bsp, const settings::worldspawn_keys
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
winding.dice(cfg.surflightsubdivision.value(), [&](winding_t &w) {
|
winding.dice(cfg.surflightsubdivision.value(), [&](polylib::winding_t &w) {
|
||||||
++l->points_before_culling;
|
++l->points_before_culling;
|
||||||
|
|
||||||
qvec3f point = w.center() + l->surfnormal;
|
qvec3f point = w.center() + l->surfnormal;
|
||||||
|
|
@ -246,7 +244,7 @@ static void MakeSurfaceLightsThread(const mbsp_t *bsp, const settings::worldspaw
|
||||||
if (info != nullptr) {
|
if (info != nullptr) {
|
||||||
if (!(info->flags.native & Q2_SURF_LIGHT) || info->value == 0) {
|
if (!(info->flags.native & Q2_SURF_LIGHT) || info->value == 0) {
|
||||||
if (info->flags.native & Q2_SURF_LIGHT) {
|
if (info->flags.native & Q2_SURF_LIGHT) {
|
||||||
qvec3d wc = winding_t::from_face(bsp, face).center();
|
qvec3d wc = polylib::winding_t::from_face(bsp, face).center();
|
||||||
logging::print(
|
logging::print(
|
||||||
"WARNING: surface light '{}' at [{}] has 0 intensity.\n", Face_TextureName(bsp, face), wc);
|
"WARNING: surface light '{}' at [{}] has 0 intensity.\n", Face_TextureName(bsp, face), wc);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,8 +27,6 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <climits>
|
#include <climits>
|
||||||
|
|
||||||
using namespace polylib;
|
|
||||||
|
|
||||||
sceneinfo skygeom; // sky. always occludes.
|
sceneinfo skygeom; // sky. always occludes.
|
||||||
sceneinfo solidgeom; // solids. always occludes.
|
sceneinfo solidgeom; // solids. always occludes.
|
||||||
sceneinfo filtergeom; // conditional occluders.. needs to run ray intersection filter
|
sceneinfo filtergeom; // conditional occluders.. needs to run ray intersection filter
|
||||||
|
|
@ -206,7 +204,8 @@ sceneinfo CreateGeometry(
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void CreateGeometryFromWindings(RTCDevice g_device, RTCScene scene, const std::vector<winding_t> &windings)
|
static void CreateGeometryFromWindings(
|
||||||
|
RTCDevice g_device, RTCScene scene, const std::vector<polylib::winding_t> &windings)
|
||||||
{
|
{
|
||||||
if (windings.empty())
|
if (windings.empty())
|
||||||
return;
|
return;
|
||||||
|
|
@ -474,13 +473,13 @@ qplane3d Node_Plane(const mbsp_t *bsp, const bsp2_dnode_t *node, bool side)
|
||||||
* `planes` all of the node planes that bound this leaf, facing inward.
|
* `planes` all of the node planes that bound this leaf, facing inward.
|
||||||
*/
|
*/
|
||||||
static void Leaf_MakeFaces(const mbsp_t *bsp, const modelinfo_t *modelinfo, const mleaf_t *leaf,
|
static void Leaf_MakeFaces(const mbsp_t *bsp, const modelinfo_t *modelinfo, const mleaf_t *leaf,
|
||||||
const std::vector<qplane3d> &planes, std::vector<winding_t> &result)
|
const std::vector<qplane3d> &planes, std::vector<polylib::winding_t> &result)
|
||||||
{
|
{
|
||||||
for (const qplane3d &plane : planes) {
|
for (const qplane3d &plane : planes) {
|
||||||
// flip the inward-facing split plane to get the outward-facing plane of the face we're constructing
|
// flip the inward-facing split plane to get the outward-facing plane of the face we're constructing
|
||||||
qplane3d faceplane = -plane;
|
qplane3d faceplane = -plane;
|
||||||
|
|
||||||
std::optional<winding_t> winding = winding_t::from_plane(faceplane, 10e6);
|
std::optional<polylib::winding_t> winding = polylib::winding_t::from_plane(faceplane, 10e6);
|
||||||
|
|
||||||
// clip `winding` by all of the other planes
|
// clip `winding` by all of the other planes
|
||||||
for (const qplane3d &plane2 : planes) {
|
for (const qplane3d &plane2 : planes) {
|
||||||
|
|
@ -504,7 +503,7 @@ static void Leaf_MakeFaces(const mbsp_t *bsp, const modelinfo_t *modelinfo, cons
|
||||||
}
|
}
|
||||||
|
|
||||||
void MakeFaces_r(const mbsp_t *bsp, const modelinfo_t *modelinfo, const int nodenum, std::vector<qplane3d> *planes,
|
void MakeFaces_r(const mbsp_t *bsp, const modelinfo_t *modelinfo, const int nodenum, std::vector<qplane3d> *planes,
|
||||||
std::vector<winding_t> &result)
|
std::vector<polylib::winding_t> &result)
|
||||||
{
|
{
|
||||||
if (nodenum < 0) {
|
if (nodenum < 0) {
|
||||||
const int leafnum = -nodenum - 1;
|
const int leafnum = -nodenum - 1;
|
||||||
|
|
@ -531,7 +530,7 @@ void MakeFaces_r(const mbsp_t *bsp, const modelinfo_t *modelinfo, const int node
|
||||||
}
|
}
|
||||||
|
|
||||||
static void MakeFaces(
|
static void MakeFaces(
|
||||||
const mbsp_t *bsp, const modelinfo_t *modelinfo, const dmodelh2_t *model, std::vector<winding_t> &result)
|
const mbsp_t *bsp, const modelinfo_t *modelinfo, const dmodelh2_t *model, std::vector<polylib::winding_t> &result)
|
||||||
{
|
{
|
||||||
std::vector<qplane3d> planes;
|
std::vector<qplane3d> planes;
|
||||||
MakeFaces_r(bsp, modelinfo, model->headnode[0], &planes, result);
|
MakeFaces_r(bsp, modelinfo, model->headnode[0], &planes, result);
|
||||||
|
|
@ -644,7 +643,7 @@ void Embree_TraceInit(const mbsp_t *bsp)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Special handling of skip-textured bmodels */
|
/* Special handling of skip-textured bmodels */
|
||||||
std::vector<winding_t> skipwindings;
|
std::vector<polylib::winding_t> skipwindings;
|
||||||
for (const modelinfo_t *modelinfo : tracelist) {
|
for (const modelinfo_t *modelinfo : tracelist) {
|
||||||
if (modelinfo->model->numfaces == 0) {
|
if (modelinfo->model->numfaces == 0) {
|
||||||
MakeFaces(bsp, modelinfo, modelinfo->model, skipwindings);
|
MakeFaces(bsp, modelinfo, modelinfo->model, skipwindings);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue