Fix single line functions

This commit is contained in:
Jonathan 2021-09-14 02:56:44 -04:00
parent 7e305602c3
commit 7f8d2cfb49
42 changed files with 323 additions and 99 deletions

View File

@ -19,7 +19,7 @@ AllowShortBlocksOnASingleLine: Never
#BreakBeforeConceptDeclarations: true
#IndentRequires: true
AllowShortCaseLabelsOnASingleLine: true
AllowShortFunctionsOnASingleLine: All
AllowShortFunctionsOnASingleLine: Inline
AllowShortLambdasOnASingleLine: All
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false

View File

@ -232,7 +232,10 @@ static planepoints NormalDistanceToThreePoints(const qvec3d &normal, const doubl
return result;
}
void PrintPoint(const qvec3d &v, fmt::memory_buffer &file) { fmt::format_to(file, "( {} {} {} )", v[0], v[1], v[2]); }
void PrintPoint(const qvec3d &v, fmt::memory_buffer &file)
{
fmt::format_to(file, "( {} {} {} )", v[0], v[1], v[2]);
}
static void PrintPlanePoints(const mbsp_t *bsp, const decomp_plane_t &decompplane, fmt::memory_buffer &file)
{

View File

@ -356,15 +356,30 @@ bool contentflags_t::types_equal(const contentflags_t &other, const gamedef_t *g
game->get_content_type(*this) == game->get_content_type(other);
}
int32_t contentflags_t::priority(const gamedef_t *game) const { return game->contents_priority(*this); }
int32_t contentflags_t::priority(const gamedef_t *game) const
{
return game->contents_priority(*this);
}
bool contentflags_t::is_empty(const gamedef_t *game) const { return game->contents_are_empty(*this); }
bool contentflags_t::is_empty(const gamedef_t *game) const
{
return game->contents_are_empty(*this);
}
bool contentflags_t::is_solid(const gamedef_t *game) const { return game->contents_are_solid(*this); }
bool contentflags_t::is_solid(const gamedef_t *game) const
{
return game->contents_are_solid(*this);
}
bool contentflags_t::is_sky(const gamedef_t *game) const { return game->contents_are_sky(*this); }
bool contentflags_t::is_sky(const gamedef_t *game) const
{
return game->contents_are_sky(*this);
}
bool contentflags_t::is_liquid(const gamedef_t *game) const { return game->contents_are_liquid(*this); }
bool contentflags_t::is_liquid(const gamedef_t *game) const
{
return game->contents_are_liquid(*this);
}
bool contentflags_t::is_valid(const gamedef_t *game, bool strict) const
{

View File

@ -460,7 +460,10 @@ int Q_strncasecmp(const char *s1, const char *s2, int n)
return -1;
}
int Q_strcasecmp(const char *s1, const char *s2) { return Q_strncasecmp(s1, s2, 99999); }
int Q_strcasecmp(const char *s1, const char *s2)
{
return Q_strncasecmp(s1, s2, 99999);
}
char *Q_strupr(char *start)
{
@ -772,7 +775,10 @@ std::string StrippedExtension(const std::string &path)
return result;
}
int IsAbsolutePath(const char *path) { return path[0] == PATHSEPERATOR || (isalpha(path[0]) && path[1] == ':'); }
int IsAbsolutePath(const char *path)
{
return path[0] == PATHSEPERATOR || (isalpha(path[0]) && path[1] == ':');
}
/*
* ====================
@ -886,7 +892,10 @@ short LittleShort(short l)
return (b1 << 8) + b2;
}
short BigShort(short l) { return l; }
short BigShort(short l)
{
return l;
}
int LittleLong(int l)
{
@ -900,7 +909,10 @@ int LittleLong(int l)
return ((int)b1 << 24) + ((int)b2 << 16) + ((int)b3 << 8) + b4;
}
int BigLong(int l) { return l; }
int BigLong(int l)
{
return l;
}
float LittleFloat(float l)
{
@ -919,7 +931,10 @@ float LittleFloat(float l)
return out.f;
}
float BigFloat(float l) { return l; }
float BigFloat(float l)
{
return l;
}
#else /* must be little endian */
@ -933,7 +948,10 @@ short BigShort(short l)
return (b1 << 8) + b2;
}
short LittleShort(short l) { return l; }
short LittleShort(short l)
{
return l;
}
int BigLong(int l)
{
@ -947,7 +965,10 @@ int BigLong(int l)
return ((int)b1 << 24) + ((int)b2 << 16) + ((int)b3 << 8) + b4;
}
int LittleLong(int l) { return l; }
int LittleLong(int l)
{
return l;
}
float BigFloat(float l)
{
@ -966,7 +987,10 @@ float BigFloat(float l)
return out.f;
}
float LittleFloat(float l) { return l; }
float LittleFloat(float l)
{
return l;
}
#endif
@ -1003,14 +1027,20 @@ static unsigned short crctable[256] = {0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0
0x5c64, 0x4c45, 0x3ca2, 0x2c83, 0x1ce0, 0x0cc1, 0xef1f, 0xff3e, 0xcf5d, 0xdf7c, 0xaf9b, 0xbfba, 0x8fd9, 0x9ff8,
0x6e17, 0x7e36, 0x4e55, 0x5e74, 0x2e93, 0x3eb2, 0x0ed1, 0x1ef0};
void CRC_Init(unsigned short *crcvalue) { *crcvalue = CRC_INIT_VALUE; }
void CRC_Init(unsigned short *crcvalue)
{
*crcvalue = CRC_INIT_VALUE;
}
void CRC_ProcessByte(unsigned short *crcvalue, uint8_t data)
{
*crcvalue = (*crcvalue << 8) ^ crctable[(*crcvalue >> 8) ^ data];
}
unsigned short CRC_Value(unsigned short crcvalue) { return crcvalue ^ CRC_XOR_VALUE; }
unsigned short CRC_Value(unsigned short crcvalue)
{
return crcvalue ^ CRC_XOR_VALUE;
}
/* ========================================================================= */

View File

@ -86,13 +86,25 @@ keyvalues_t::const_iterator entdict_t::find(std::string_view key) const
return existingIt;
}
keyvalues_t::const_iterator entdict_t::begin() const { return keyvalues.begin(); }
keyvalues_t::const_iterator entdict_t::begin() const
{
return keyvalues.begin();
}
keyvalues_t::const_iterator entdict_t::end() const { return keyvalues.end(); }
keyvalues_t::const_iterator entdict_t::end() const
{
return keyvalues.end();
}
keyvalues_t::iterator entdict_t::begin() { return keyvalues.begin(); }
keyvalues_t::iterator entdict_t::begin()
{
return keyvalues.begin();
}
keyvalues_t::iterator entdict_t::end() { return keyvalues.end(); }
keyvalues_t::iterator entdict_t::end()
{
return keyvalues.end();
}
/*
* ==================
@ -169,7 +181,10 @@ std::string EntData_Write(const std::vector<entdict_t> &ents)
return out.str();
}
std::string EntDict_StringForKey(const entdict_t &dict, const std::string key) { return dict.get(key); }
std::string EntDict_StringForKey(const entdict_t &dict, const std::string key)
{
return dict.get(key);
}
float EntDict_FloatForKey(const entdict_t &dict, const std::string key)
{
@ -185,7 +200,10 @@ float EntDict_FloatForKey(const entdict_t &dict, const std::string key)
}
}
void EntDict_RemoveValueForKey(entdict_t &dict, const std::string &key) { dict.remove(key); }
void EntDict_RemoveValueForKey(entdict_t &dict, const std::string &key)
{
dict.remove(key);
}
void // mxd
EntDict_RenameKey(entdict_t &dict, const std::string &from, const std::string &to)

View File

@ -157,7 +157,10 @@ void UniformPointOnSphere(vec3_t dir, float u1, float u2)
}
}
void RandomDir(vec3_t dir) { UniformPointOnSphere(dir, Random(), Random()); }
void RandomDir(vec3_t dir)
{
UniformPointOnSphere(dir, Random(), Random());
}
qvec3f CosineWeightedHemisphereSample(float u1, float u2)
{
@ -541,7 +544,10 @@ bool GLM_EdgePlanes_PointInside(const vector<qvec4f> &edgeplanes, const qvec3f &
return minDist >= -POINT_EQUAL_EPSILON;
}
qvec3f GLM_TriangleCentroid(const qvec3f &v0, const qvec3f &v1, const qvec3f &v2) { return (v0 + v1 + v2) / 3.0f; }
qvec3f GLM_TriangleCentroid(const qvec3f &v0, const qvec3f &v1, const qvec3f &v2)
{
return (v0 + v1 + v2) / 3.0f;
}
float GLM_TriangleArea(const qvec3f &v0, const qvec3f &v1, const qvec3f &v2)
{
@ -553,7 +559,10 @@ qvec4f GLM_MakePlane(const qvec3f &normal, const qvec3f &point)
return qvec4f(normal[0], normal[1], normal[2], qv::dot(point, normal));
}
float GLM_DistAbovePlane(const qvec4f &plane, const qvec3f &point) { return qv::dot(qvec3f(plane), point) - plane[3]; }
float GLM_DistAbovePlane(const qvec4f &plane, const qvec3f &point)
{
return qv::dot(qvec3f(plane), point) - plane[3];
}
qvec3f GLM_ProjectPointOntoPlane(const qvec4f &plane, const qvec3f &point)
{

View File

@ -170,9 +170,15 @@ static octree_t<vertnum_t> build_vert_octree(const mesh_t &mesh)
return makeOctree(vertBboxNumPairs);
}
qvec3f qToG(qvec3f in) { return qvec3f(in[0], in[1], in[2]); }
qvec3f qToG(qvec3f in)
{
return qvec3f(in[0], in[1], in[2]);
}
qvec3f gToQ(qvec3f in) { return qvec3f(in[0], in[1], in[2]); }
qvec3f gToQ(qvec3f in)
{
return qvec3f(in[0], in[1], in[2]);
}
/**
* Possibly insert vert `vnum` on one of the edges of face `fnum`, if it happens

View File

@ -115,7 +115,10 @@ qmat4x4d qv::inverse(const qmat4x4d &input)
return res;
}
qmat4x4f qv::inverse(const qmat4x4f &input) { return qmat4x4f(qv::inverse(qmat4x4d(input))); }
qmat4x4f qv::inverse(const qmat4x4f &input)
{
return qmat4x4f(qv::inverse(qmat4x4d(input)));
}
qmat2x2f qv::inverse(const qmat2x2f &m)
{

View File

@ -78,7 +78,10 @@ void InterruptThreadProgress__(void)
int numthreads = 1;
CRITICAL_SECTION crit;
void LowerProcessPriority(void) { SetPriorityClass(GetCurrentProcess(), BELOW_NORMAL_PRIORITY_CLASS); }
void LowerProcessPriority(void)
{
SetPriorityClass(GetCurrentProcess(), BELOW_NORMAL_PRIORITY_CLASS);
}
int GetDefaultThreads(void)
{

View File

@ -135,4 +135,3 @@ using aabb2d = aabb<2, qvec2d>;
using aabb3f = aabb<3, qvec3f>;
using aabb2f = aabb<2, qvec2f>;

View File

@ -145,4 +145,3 @@ static inline void Q_assert_(bool success, const char *expr, const char *file, i
#define Q_assert(x) Q_assert_((x), stringify(x), __FILE__, __LINE__)
#define Q_assert_unreachable() Q_assert(false)

View File

@ -75,7 +75,10 @@ static inline bool GLMVectorCompare(const qvec3f &v1, const qvec3f &v2, float ep
return true;
}
static inline vec_t DotProduct(const vec3_t x, const vec3_t y) { return x[0] * y[0] + x[1] * y[1] + x[2] * y[2]; }
static inline vec_t DotProduct(const vec3_t x, const vec3_t y)
{
return x[0] * y[0] + x[1] * y[1] + x[2] * y[2];
}
static inline void VectorSubtract(const vec3_t x, const vec3_t y, vec3_t out)
{
@ -147,16 +150,25 @@ void AddPointToBounds(const vec3_t v, vec3_t mins, vec3_t maxs);
plane_t FlipPlane(plane_t input);
static inline qvec3f VectorToGLM(const vec3_t in) { return qvec3f(in[0], in[1], in[2]); }
static inline qvec3f VectorToGLM(const vec3_t in)
{
return qvec3f(in[0], in[1], in[2]);
}
static inline vec_t Q_rint(vec_t in) { return (vec_t)(floor(in + 0.5)); }
static inline vec_t Q_rint(vec_t in)
{
return (vec_t)(floor(in + 0.5));
}
/*
Random()
returns a pseudorandom number between 0 and 1
*/
static inline vec_t Random(void) { return (vec_t)rand() / RAND_MAX; }
static inline vec_t Random(void)
{
return (vec_t)rand() / RAND_MAX;
}
static inline void VectorMA(const vec3_t va, vec_t scale, const vec3_t vb, vec3_t vc)
{
@ -273,9 +285,15 @@ float Lanczos2D(float x, float y, float a);
// glm geometry
static inline qvec3f vec3_t_to_glm(const vec3_t vec) { return qvec3f(vec[0], vec[1], vec[2]); }
static inline qvec3f vec3_t_to_glm(const vec3_t vec)
{
return qvec3f(vec[0], vec[1], vec[2]);
}
static inline qvec3d qvec3d_from_vec3(const vec3_t vec) { return qvec3d(vec[0], vec[1], vec[2]); }
static inline qvec3d qvec3d_from_vec3(const vec3_t vec)
{
return qvec3d(vec[0], vec[1], vec[2]);
}
static inline void glm_to_vec3_t(const qvec3f &glm, vec3_t out)
{
@ -456,4 +474,3 @@ std::vector<V> PointsAlongLine(const V &start, const V &end, const float step)
}
bool LinesOverlap(const qvec3f p0, const qvec3f p1, const qvec3f q0, const qvec3f q1);

View File

@ -36,7 +36,7 @@ void CheckWinding(const winding_t *w, vec_t bogus_range = DEFAULT_BOGUS_RANGE);
void WindingPlane(const winding_t *w, vec3_t normal, vec_t *dist);
void RemoveColinearPoints(winding_t *w);
using save_winding_fn_t = void(*)(winding_t *w, void *userinfo);
using save_winding_fn_t = void (*)(winding_t *w, void *userinfo);
void DiceWinding(winding_t *w, vec_t subdiv, save_winding_fn_t save_fn, void *userinfo);
winding_t *WindingFromFace(const mbsp_t *bsp, const bsp2_dface_t *f);

View File

@ -534,4 +534,3 @@ qmat4x4d inverse(const qmat4x4d &input);
qmat2x2f inverse(const qmat2x2f &input);
}; // namespace qv

View File

@ -53,9 +53,15 @@ struct lightsample_t
vec3_t direction;
};
static inline float LightSample_Brightness(const vec3_t color) { return ((color[0] + color[1] + color[2]) / 3.0); }
static inline float LightSample_Brightness(const vec3_t color)
{
return ((color[0] + color[1] + color[2]) / 3.0);
}
static inline float LightSample_Brightness(const qvec3f color) { return ((color[0] + color[1] + color[2]) / 3.0); }
static inline float LightSample_Brightness(const qvec3f color)
{
return ((color[0] + color[1] + color[2]) / 3.0);
}
/**
* A directional light, emitted from "sky*" textured faces.
@ -410,4 +416,3 @@ const modelinfo_t *ModelInfoForModel(const mbsp_t *bsp, int modelnum);
const modelinfo_t *ModelInfoForFace(const mbsp_t *bsp, int facenum);
// bool Leaf_HasSky(const mbsp_t *bsp, const mleaf_t *leaf); //mxd. Missing definition
int light_main(int argc, const char **argv);

View File

@ -83,4 +83,3 @@ void SetupDirt(globalconfig_t &cfg);
float DirtAtPoint(const globalconfig_t &cfg, raystream_intersection_t *rs, const vec3_t point, const vec3_t normal,
const modelinfo_t *selfshadow);
void LightFace(const mbsp_t *bsp, bsp2_dface_t *face, facesup_t *facesup, const globalconfig_t &cfg);

View File

@ -89,4 +89,3 @@ public:
};
const face_cache_t &FaceCacheForFNum(int fnum);

View File

@ -356,4 +356,3 @@ public:
const std::vector<lockable_setting_t *> &allSettings() const { return _allsettings; }
};

View File

@ -130,4 +130,3 @@ raystream_intersection_t *MakeIntersectionRayStream(int maxrays);
raystream_occlusion_t *MakeOcclusionRayStream(int maxrays);
void MakeTnodes(const mbsp_t *bsp);

View File

@ -63,4 +63,3 @@ void SplitBrush(const brush_t *brush, int planenum, int planeside, brush_t **fro
void FilterStructuralBrushesIntoTree(const mapentity_t *e, node_t *headnode);
void FreeBrush(brush_t *brush);

View File

@ -24,4 +24,3 @@
#include <stdbool.h>
size_t LoadFile(const char *filename, void *bufptr, bool nofail);

View File

@ -255,4 +255,3 @@ void ExportObj_Marksurfaces(const std::string &filesuffix, const node_t *nodes);
void WriteBspBrushMap(const char *name, const std::vector<const brush_t *> &list);
bool IsValidTextureProjection(const qvec3f &faceNormal, const qvec3f &s_vec, const qvec3f &t_vec);

View File

@ -25,4 +25,3 @@ void MergePlaneFaces(surface_t *plane);
face_t *MergeFaceToList(face_t *face, face_t *list);
face_t *FreeMergeListScraps(face_t *merged);
void MergeAll(surface_t *surfhead);

View File

@ -43,4 +43,3 @@ struct parser_t
bool ParseToken(parser_t *p, int flags);
void ParserInit(parser_t *p, const char *data);

View File

@ -325,4 +325,3 @@ extern options_t options;
#include <qbsp/util.hh>
int qbsp_main(int argc, const char **argv);

View File

@ -78,4 +78,3 @@ static inline size_t LeafbitsSize(int numleafs)
int numblocks = (numleafs + LEAFMASK) >> LEAFSHIFT;
return sizeof(leafbits_t) + (sizeof(leafblock_t) * numblocks);
}

View File

@ -263,7 +263,10 @@ static void AddBounceLight(const vec3_t pos, const std::map<int, qvec3f> &colorB
radlightsByFacenum[Face_GetNum(bsp, face)].push_back(lastBounceLightIndex);
}
const std::vector<bouncelight_t> &BounceLights() { return radlights; }
const std::vector<bouncelight_t> &BounceLights()
{
return radlights;
}
const std::vector<int> &BounceLightsForFaceNum(int facenum)
{

View File

@ -34,16 +34,25 @@ std::vector<sun_t> all_suns;
std::vector<entdict_t> entdicts;
static std::vector<entdict_t> radlights;
const std::vector<light_t> &GetLights() { return all_lights; }
const std::vector<light_t> &GetLights()
{
return all_lights;
}
const std::vector<sun_t> &GetSuns() { return all_suns; }
const std::vector<sun_t> &GetSuns()
{
return all_suns;
}
/* surface lights */
static void MakeSurfaceLights(const mbsp_t *bsp);
// light_t
const char *light_t::classname() const { return ValueForKey(this, "classname"); }
const char *light_t::classname() const
{
return ValueForKey(this, "classname");
}
/*
* ============================================================================
@ -64,8 +73,14 @@ static entdict_t &WorldEnt()
return entdicts.at(0);
}
void SetWorldKeyValue(const std::string &key, const std::string &value) { WorldEnt().set(key, value); }
std::string WorldValueForKey(const std::string &key) { return EntDict_StringForKey(WorldEnt(), key); }
void SetWorldKeyValue(const std::string &key, const std::string &value)
{
WorldEnt().set(key, value);
}
std::string WorldValueForKey(const std::string &key)
{
return EntDict_StringForKey(WorldEnt(), key);
}
/**
* Assigns a lightstyle number for the given non-empty targetname string

View File

@ -228,7 +228,10 @@ void GetFileSpace_PreserveOffsetInBsp(uint8_t **lightdata, uint8_t **colordata,
// NOTE: file_p et. al. are not updated, since we're not dynamically allocating the lightmaps
}
const modelinfo_t *ModelInfoForModel(const mbsp_t *bsp, int modelnum) { return modelinfo.at(modelnum); }
const modelinfo_t *ModelInfoForModel(const mbsp_t *bsp, int modelnum)
{
return modelinfo.at(modelnum);
}
const modelinfo_t *ModelInfoForFace(const mbsp_t *bsp, int facenum)
{

View File

@ -119,10 +119,22 @@ faceextents_t::faceextents_t(const bsp2_dface_t *face, const mbsp_t *bsp, float
}
}
int faceextents_t::width() const { return m_texsize[0] + 1; }
int faceextents_t::height() const { return m_texsize[1] + 1; }
int faceextents_t::numsamples() const { return width() * height(); }
qvec2i faceextents_t::texsize() const { return qvec2i(width(), height()); }
int faceextents_t::width() const
{
return m_texsize[0] + 1;
}
int faceextents_t::height() const
{
return m_texsize[1] + 1;
}
int faceextents_t::numsamples() const
{
return width() * height();
}
qvec2i faceextents_t::texsize() const
{
return qvec2i(width(), height());
}
int faceextents_t::indexOf(const qvec2i &lm) const
{
@ -173,9 +185,15 @@ qvec3f faceextents_t::texCoordToWorld(qvec2f tc) const
return qvec3f(res[0], res[1], res[2]);
}
qvec2f faceextents_t::worldToLMCoord(qvec3f world) const { return TexCoordToLMCoord(worldToTexCoord(world)); }
qvec2f faceextents_t::worldToLMCoord(qvec3f world) const
{
return TexCoordToLMCoord(worldToTexCoord(world));
}
qvec3f faceextents_t::LMCoordToWorld(qvec2f lm) const { return texCoordToWorld(LMCoordToTexCoord(lm)); }
qvec3f faceextents_t::LMCoordToWorld(qvec2f lm) const
{
return texCoordToWorld(LMCoordToTexCoord(lm));
}
qmat4x4f WorldToTexSpace(const mbsp_t *bsp, const bsp2_dface_t *f)
{
@ -1022,7 +1040,10 @@ void GetLightContrib(const globalconfig_t &cfg, const light_t *entity, const vec
*dist_out = dist;
}
constexpr vec_t SQR(vec_t x) { return x * x; }
constexpr vec_t SQR(vec_t x)
{
return x * x;
}
// this is the inverse of GetLightValue
float GetLightDist(const globalconfig_t &cfg, const light_t *entity, vec_t desiredLight)
@ -2729,9 +2750,15 @@ static std::vector<qvec4f> LightmapToGLMVector(const mbsp_t *bsp, const lightsur
return std::vector<qvec4f>();
}
static qvec3f LinearToGamma22(const qvec3f &c) { return qv::pow(c, qvec3f(1 / 2.2f)); }
static qvec3f LinearToGamma22(const qvec3f &c)
{
return qv::pow(c, qvec3f(1 / 2.2f));
}
static qvec3f Gamma22ToLinear(const qvec3f &c) { return qv::pow(c, qvec3f(2.2f)); }
static qvec3f Gamma22ToLinear(const qvec3f &c)
{
return qv::pow(c, qvec3f(2.2f));
}
void GLMVector_GammaToLinear(std::vector<qvec3f> &vec)
{

View File

@ -19,4 +19,7 @@
#include <light/light.hh>
int main(int argc, const char **argv) { return light_main(argc, argv); }
int main(int argc, const char **argv)
{
return light_main(argc, argv);
}

View File

@ -183,9 +183,15 @@ static void *MakeSurfaceLightsThread(void *arg)
return nullptr;
}
const std::vector<surfacelight_t> &SurfaceLights() { return surfacelights; }
const std::vector<surfacelight_t> &SurfaceLights()
{
return surfacelights;
}
int TotalSurfacelightPoints() { return total_surflight_points; }
int TotalSurfacelightPoints()
{
return total_surflight_points;
}
// No surflight_debug (yet?), so unused...
const std::vector<int> &SurfaceLightsForFaceNum(int facenum)

View File

@ -13,7 +13,10 @@
using namespace std;
static qvec4f extendTo4(const qvec3f &v) { return qvec4f(v[0], v[1], v[2], 1.0); }
static qvec4f extendTo4(const qvec3f &v)
{
return qvec4f(v[0], v[1], v[2], 1.0);
}
TEST(mathlib, MakeCDF)
{
@ -170,7 +173,10 @@ TEST(mathlib, PolygonCentroid_empty)
}
}
TEST(mathlib, PolygonCentroid_point) { EXPECT_EQ(qvec3f(1, 1, 1), GLM_PolyCentroid({qvec3f(1, 1, 1)})); }
TEST(mathlib, PolygonCentroid_point)
{
EXPECT_EQ(qvec3f(1, 1, 1), GLM_PolyCentroid({qvec3f(1, 1, 1)}));
}
TEST(mathlib, PolygonCentroid_line)
{
@ -613,15 +619,30 @@ TEST(mathlib, DistToLineSegment)
ASSERT_TRUE(fabs(0.5 - DistToLineSegment(qvec3f(10, 0, 0), qvec3f(10, 0, 100), qvec3f(9.5, 0, 0))) < epsilon);
}
TEST(mathlib, linesOverlap_points) { ASSERT_TRUE(LinesOverlap({0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0})); }
TEST(mathlib, linesOverlap_points)
{
ASSERT_TRUE(LinesOverlap({0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}));
}
TEST(mathlib, linesOverlap_point_line) { ASSERT_TRUE(LinesOverlap({0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 1})); }
TEST(mathlib, linesOverlap_point_line)
{
ASSERT_TRUE(LinesOverlap({0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 1}));
}
TEST(mathlib, linesOverlap_same) { ASSERT_TRUE(LinesOverlap({0, 0, 0}, {0, 0, 1}, {0, 0, 0}, {0, 0, 1})); }
TEST(mathlib, linesOverlap_same)
{
ASSERT_TRUE(LinesOverlap({0, 0, 0}, {0, 0, 1}, {0, 0, 0}, {0, 0, 1}));
}
TEST(mathlib, linesOverlap_same_opposite_dir) { ASSERT_TRUE(LinesOverlap({0, 0, 0}, {0, 0, 1}, {0, 0, 1}, {0, 0, 0})); }
TEST(mathlib, linesOverlap_same_opposite_dir)
{
ASSERT_TRUE(LinesOverlap({0, 0, 0}, {0, 0, 1}, {0, 0, 1}, {0, 0, 0}));
}
TEST(mathlib, linesOverlap_overlap) { ASSERT_TRUE(LinesOverlap({0, 0, 0}, {0, 0, 1}, {0, 0, 0.5}, {0, 0, 1.5})); }
TEST(mathlib, linesOverlap_overlap)
{
ASSERT_TRUE(LinesOverlap({0, 0, 0}, {0, 0, 1}, {0, 0, 0.5}, {0, 0, 1.5}));
}
TEST(mathlib, linesOverlap_overlap_opposite_dir)
{
@ -633,7 +654,10 @@ TEST(mathlib, linesOverlap_only_tips_touching)
ASSERT_TRUE(LinesOverlap({0, 0, 0}, {0, 0, 1}, {0, 0, 1}, {0, 0, 2}));
}
TEST(mathlib, linesOverlap_non_colinear) { ASSERT_FALSE(LinesOverlap({0, 0, 0}, {0, 0, 1}, {5, 0, 0}, {5, 0, 1})); }
TEST(mathlib, linesOverlap_non_colinear)
{
ASSERT_FALSE(LinesOverlap({0, 0, 0}, {0, 0, 1}, {5, 0, 0}, {5, 0, 1}));
}
TEST(mathlib, linesOverlap_colinear_not_touching)
{

View File

@ -136,7 +136,10 @@ Light_PointContents
from hmap2
==============
*/
int Light_PointContents(const mbsp_t *bsp, const vec3_t point) { return Light_PointInLeaf(bsp, point)->contents; }
int Light_PointContents(const mbsp_t *bsp, const vec3_t point)
{
return Light_PointInLeaf(bsp, point)->contents;
}
/*
* ==============
@ -775,7 +778,16 @@ hittype_t DirtTrace(const vec3_t start, const vec3_t dirn, vec_t dist, const mod
throw; // mxd. Silences compiler warning
}
raystream_intersection_t *MakeIntersectionRayStream(int maxrays) { return Embree_MakeIntersectionRayStream(maxrays); }
raystream_occlusion_t *MakeOcclusionRayStream(int maxrays) { return Embree_MakeOcclusionRayStream(maxrays); }
raystream_intersection_t *MakeIntersectionRayStream(int maxrays)
{
return Embree_MakeIntersectionRayStream(maxrays);
}
raystream_occlusion_t *MakeOcclusionRayStream(int maxrays)
{
return Embree_MakeOcclusionRayStream(maxrays);
}
void MakeTnodes(const mbsp_t *bsp) { Embree_TraceInit(bsp); }
void MakeTnodes(const mbsp_t *bsp)
{
Embree_TraceInit(bsp);
}

View File

@ -229,7 +229,10 @@ sceneinfo filtergeom; // conditional occluders.. needs to run ray intersection f
static const mbsp_t *bsp_static;
void ErrorCallback(void *userptr, const RTCError code, const char *str) { printf("RTC Error %d: %s\n", code, str); }
void ErrorCallback(void *userptr, const RTCError code, const char *str)
{
printf("RTC Error %d: %s\n", code, str);
}
static const sceneinfo &Embree_SceneinfoForGeomID(unsigned int geomID)
{
@ -1094,7 +1097,10 @@ public:
}
};
raystream_occlusion_t *Embree_MakeOcclusionRayStream(int maxrays) { return new raystream_embree_occlusion_t{maxrays}; }
raystream_occlusion_t *Embree_MakeOcclusionRayStream(int maxrays)
{
return new raystream_embree_occlusion_t{maxrays};
}
raystream_intersection_t *Embree_MakeIntersectionRayStream(int maxrays)
{

View File

@ -226,7 +226,10 @@ bool PlaneInvEqual(const qbsp_plane_t *p1, const qbsp_plane_t *p2)
/* Plane Hashing */
static inline int plane_hash_fn(const qbsp_plane_t *p) { return Q_rint(fabs(p->dist)); }
static inline int plane_hash_fn(const qbsp_plane_t *p)
{
return Q_rint(fabs(p->dist));
}
static void PlaneHash_Add(const qbsp_plane_t *p, int index)
{
@ -1085,7 +1088,10 @@ int Brush_ListCountWithCFlags(const brush_t *brush, int cflags)
return cnt;
}
int Brush_ListCount(const brush_t *brush) { return Brush_ListCountWithCFlags(brush, 0); }
int Brush_ListCount(const brush_t *brush)
{
return Brush_ListCountWithCFlags(brush, 0);
}
static int FaceListCount(const face_t *facelist)
{
@ -1095,7 +1101,10 @@ static int FaceListCount(const face_t *facelist)
return 0;
}
int Brush_NumFaces(const brush_t *brush) { return FaceListCount(brush->faces); }
int Brush_NumFaces(const brush_t *brush)
{
return FaceListCount(brush->faces);
}
void Entity_SortBrushes(mapentity_t *dst)
{

View File

@ -27,7 +27,10 @@
mapdata_t map;
// Useful shortcuts
mapentity_t *pWorldEnt() { return &map.entities.at(0); }
mapentity_t *pWorldEnt()
{
return &map.entities.at(0);
}
// util.c
FILE *logfile;

View File

@ -19,4 +19,7 @@
#include <qbsp/qbsp.hh>
int main(int argc, const char **argv) { return qbsp_main(argc, argv); }
int main(int argc, const char **argv)
{
return qbsp_main(argc, argv);
}

View File

@ -793,7 +793,10 @@ float NormalizeDegrees(float degs)
return degs;
}
bool EqualDegrees(float a, float b) { return fabs(NormalizeDegrees(a) - NormalizeDegrees(b)) < 0.001; }
bool EqualDegrees(float a, float b)
{
return fabs(NormalizeDegrees(a) - NormalizeDegrees(b)) < 0.001;
}
static std::pair<int, int> getSTAxes(const vec3_t snapped_normal)
{

View File

@ -35,7 +35,10 @@ static const char *IntroString = "---- qbsp / ericw-tools " stringify(ERICWTOOLS
// command line flags
options_t options;
bool node_t::opaque() const { return contents.is_structural_sky_or_solid(options.target_game); }
bool node_t::opaque() const
{
return contents.is_structural_sky_or_solid(options.target_game);
}
// a simple tree structure used for leaf brush
// compression.
@ -489,7 +492,10 @@ void BSPX_Brushes_Finalize(struct bspxbrushes_s *ctx)
// Actually written in WriteBSPFile()
map.exported_bspxbrushes = std::move(ctx->lumpdata);
}
void BSPX_Brushes_Init(struct bspxbrushes_s *ctx) { ctx->lumpdata.clear(); }
void BSPX_Brushes_Init(struct bspxbrushes_s *ctx)
{
ctx->lumpdata.clear();
}
static void vec_push_bytes(std::vector<uint8_t> &vec, const void *data, size_t count)
{
@ -1047,7 +1053,7 @@ static void ParseOptions(char *szOptions)
szTok2 = GetTok(szTok + strlen(szTok) + 1, szEnd);
if (!szTok2)
Error("Invalid argument to option %s", szTok);
options.midsplitSurfFraction = qclamp((float) atof(szTok2), 0.0f, 1.0f);
options.midsplitSurfFraction = qclamp((float)atof(szTok2), 0.0f, 1.0f);
logprint("Switching to midsplit when node contains more than fraction %f of model's surfaces\n",
options.midsplitSurfFraction);

View File

@ -187,7 +187,10 @@ static void InitHash(void)
hashedges.clear();
}
static void AddHashEdge(int v1, int v2, int i) { hashedges[std::make_pair(v1, v2)].push_front(i); }
static void AddHashEdge(int v1, int v2, int i)
{
hashedges[std::make_pair(v1, v2)].push_front(i);
}
static std::tuple<int, int, int> HashVec(const vec3_t vec)
{

View File

@ -498,4 +498,7 @@ static void *BasePortalThread(void *dummy)
BasePortalVis
==============
*/
void BasePortalVis(void) { RunThreadsOn(0, numportals * 2, BasePortalThread, NULL); }
void BasePortalVis(void)
{
RunThreadsOn(0, numportals * 2, BasePortalThread, NULL);
}