diff --git a/.gitignore b/.gitignore index 0c592c3df..2cf53cdaf 100644 --- a/.gitignore +++ b/.gitignore @@ -18,5 +18,6 @@ src/tess_server *.srctrlprj # Files auto-produced by VSCode. .vscode/ +.ionide/ # Documentation files in the docs folder. docs diff --git a/src/engine/interface/ui.cpp b/src/engine/interface/ui.cpp index 1e1b9a552..2487b132d 100644 --- a/src/engine/interface/ui.cpp +++ b/src/engine/interface/ui.cpp @@ -69,7 +69,7 @@ namespace UI gle::attribf(x, y+h); gle::attribf(tx, ty+th); } - static void quad(float x, float y, float w, float h, const vec2 tc[4]) + static void quad(float x, float y, float w, float h, const vec2 tc[4]) { gle::defvertex(2); gle::deftexcoord0(); @@ -795,7 +795,7 @@ namespace UI uint *contents, *onshow, *onhide; bool allowinput, eschide, abovehud; float px, py, pw, ph; - vec2 sscale, soffset; + vec2 sscale, soffset; Window(const char *name, const char *contents, const char *onshow, const char *onhide) : name(newstring(name)), @@ -951,8 +951,8 @@ namespace UI void calcscissor(float x1, float y1, float x2, float y2, int &sx1, int &sy1, int &sx2, int &sy2, bool clip = true) { - vec2 s1 = vec2(x1, y2).mul(sscale).add(soffset), - s2 = vec2(x2, y1).mul(sscale).add(soffset); + vec2 s1 = vec2(x1, y2).mul(sscale).add(soffset), + s2 = vec2(x2, y1).mul(sscale).add(soffset); sx1 = static_cast(std::floor(s1.x*hudw + 0.5f)); sy1 = static_cast(std::floor(s1.y*hudh + 0.5f)); sx2 = static_cast(std::floor(s2.x*hudw + 0.5f)); @@ -2382,7 +2382,7 @@ namespace UI struct Triangle : Shape { - vec2 a, b, c; + vec2 a, b, c; void setup(const Color &color_, float w = 0, float h = 0, int angle = 0, int type_ = SOLID) { @@ -2391,16 +2391,16 @@ namespace UI c = vec2(w/2, h/3); if(angle) { - vec2 rot = sincosmod360(-angle); + vec2 rot = sincosmod360(-angle); a.rotate_around_z(rot); b.rotate_around_z(rot); c.rotate_around_z(rot); } - vec2 bbmin = vec2(a).min(b).min(c); + vec2 bbmin = vec2(a).min(b).min(c); a.sub(bbmin); b.sub(bbmin); c.sub(bbmin); - vec2 bbmax = vec2(a).max(b).max(c); + vec2 bbmax = vec2(a).max(b).max(c); Shape::setup(color_, type_, bbmax.x, bbmax.y); } @@ -2487,7 +2487,7 @@ namespace UI float r = radius <= 0 ? std::min(w, h)/2 : radius; color.init(); - vec2 center(sx + r, sy + r); + vec2 center(sx + r, sy + r); if(type == OUTLINE) { gle::begin(GL_LINE_LOOP); @@ -2502,7 +2502,7 @@ namespace UI gle::attribf(center.x + r, center.y); for(int angle = 360/15; angle < 360; angle += 360/15) { - vec2 p = vec2(sincos360[angle]).mul(r).add(center); + vec2 p = vec2(sincos360[angle]).mul(r).add(center); gle::attrib(p); gle::attrib(p); } @@ -4261,7 +4261,7 @@ namespace UI changedraw(Change_Shader | Change_Color); SETSHADER(hudrgb); - vec2 tc[4] = { vec2(0, 0), vec2(1, 0), vec2(1, 1), vec2(0, 1) }; + vec2 tc[4] = { vec2(0, 0), vec2(1, 0), vec2(1, 1), vec2(0, 1) }; int xoff = vslot.offset.x, yoff = vslot.offset.y; if(vslot.rotation) diff --git a/src/engine/model/animmodel.h b/src/engine/model/animmodel.h index b05ae806d..566d2d250 100644 --- a/src/engine/model/animmodel.h +++ b/src/engine/model/animmodel.h @@ -276,9 +276,9 @@ class animmodel : public model vec e1 = vec(verts[t.vert[1]].pos).sub(e0), e2 = vec(verts[t.vert[2]].pos).sub(e0); - const vec2 &tc0 = tcverts[t.vert[0]].tc, - &tc1 = tcverts[t.vert[1]].tc, - &tc2 = tcverts[t.vert[2]].tc; + const vec2 &tc0 = tcverts[t.vert[0]].tc, + &tc1 = tcverts[t.vert[1]].tc, + &tc2 = tcverts[t.vert[2]].tc; float u1 = tc1.x - tc0.x, v1 = tc1.y - tc0.y, u2 = tc2.x - tc0.x, diff --git a/src/engine/model/md5.h b/src/engine/model/md5.h index 14d3eb265..5bf595aab 100644 --- a/src/engine/model/md5.h +++ b/src/engine/model/md5.h @@ -15,7 +15,7 @@ struct md5weight struct md5vert { - vec2 tc; + vec2 tc; ushort start, count; }; diff --git a/src/engine/model/obj.cpp b/src/engine/model/obj.cpp index c47ca2dbf..8613a6cfc 100644 --- a/src/engine/model/obj.cpp +++ b/src/engine/model/obj.cpp @@ -191,7 +191,7 @@ bool obj::objmeshgroup::load(const char *filename, float smooth) v.norm = vkey.z < 0 ? vec(0, 0, 0) : attrib[2][vkey.z]; v.norm = vec(v.norm.z, -v.norm.x, v.norm.y); tcvert &tcv = tcverts.add(); - tcv.tc = vkey.y < 0 ? vec2(0, 0) : vec2(attrib[1][vkey.y].x, 1-attrib[1][vkey.y].y); + tcv.tc = vkey.y < 0 ? vec2(0.f, 0.f) : vec2(attrib[1][vkey.y].x, 1-attrib[1][vkey.y].y); } if(v0 < 0) { diff --git a/src/engine/model/skelmodel.h b/src/engine/model/skelmodel.h index 3265b8b7d..d6e85f9b9 100644 --- a/src/engine/model/skelmodel.h +++ b/src/engine/model/skelmodel.h @@ -26,7 +26,7 @@ struct skelmodel : animmodel struct vert { vec pos, norm; - vec2 tc; + vec2 tc; quat tangent; int blend, interpindex; }; @@ -34,14 +34,14 @@ struct skelmodel : animmodel struct vvert { vec pos; - GenericVec2 tc; + vec2 tc; squat tangent; }; struct vvertg { vec4 pos; - GenericVec2 tc; + vec2 tc; squat tangent; }; diff --git a/src/engine/model/vertmodel.h b/src/engine/model/vertmodel.h index a69b598b3..e2a4bc5f4 100644 --- a/src/engine/model/vertmodel.h +++ b/src/engine/model/vertmodel.h @@ -9,20 +9,20 @@ struct vertmodel : animmodel struct vvert { vec pos; - GenericVec2 tc; + vec2 tc; squat tangent; }; struct vvertg { vec4 pos; - GenericVec2 tc; + vec2 tc; squat tangent; }; struct tcvert { - vec2 tc; + vec2 tc; }; struct tri diff --git a/src/engine/render/aa.cpp b/src/engine/render/aa.cpp index e753bc201..0df696645 100644 --- a/src/engine/render/aa.cpp +++ b/src/engine/render/aa.cpp @@ -416,24 +416,24 @@ namespace //internal functions incl. AA implementations smaasearchdatainited = true; } - vec2 areaunderortho(const vec2 &p1, const vec2 &p2, float x) + vec2 areaunderortho(const vec2 &p1, const vec2 &p2, float x) { - vec2 d(p2.x - p1.x, p2.y - p1.y); + vec2 d(p2.x - p1.x, p2.y - p1.y); float y1 = p1.y + (x - p1.x)*d.y/d.x, y2 = p1.y + (x+1 - p1.x)*d.y/d.x; if((x < p1.x || x >= p2.x) && (x+1 <= p1.x || x+1 > p2.x)) { - return vec2(0, 0); + return vec2(0.f, 0.f); } if((y1 < 0) == (y2 < 0) || std::fabs(y1) < 1e-4f || std::fabs(y2) < 1e-4f) { float a = (y1 + y2) / 2; - return a < 0.0f ? vec2(-a, 0) : vec2(0, a); + return a < 0.0f ? vec2(-a, 0.f) : vec2(0.f, a); } x = -p1.y*d.x/d.y + p1.x; float a1 = x > p1.x ? y1*std::fmod(x, 1.0f)/2 : 0, a2 = x < p2.x ? y2*(1-std::fmod(x, 1.0f))/2 : 0; - vec2 a(std::fabs(a1), std::fabs(a2)); + vec2 a(std::fabs(a1), std::fabs(a2)); if((a.x > a.y ? a1 : -a2) >= 0) { std::swap(a.x, a.y); @@ -447,21 +447,21 @@ namespace //internal functions incl. AA implementations {0, 1}, {3, 1}, {0, 4}, {3, 4}, {1, 1}, {4, 1}, {1, 4}, {4, 4} }; - vec2 areaortho(float p1x, float p1y, float p2x, float p2y, float left) + vec2 areaortho(float p1x, float p1y, float p2x, float p2y, float left) { return areaunderortho(vec2(p1x, p1y), vec2(p2x, p2y), left); } - void smootharea(float d, vec2 &a1, vec2 &a2) + void smootharea(float d, vec2 &a1, vec2 &a2) { - vec2 b1(sqrtf(a1.x*2)*0.5f, sqrtf(a1.y*2)*0.5f), - b2(sqrtf(a2.x*2)*0.5f, sqrtf(a2.y*2)*0.5f); + vec2 b1(sqrtf(a1.x*2)*0.5f, sqrtf(a1.y*2)*0.5f), + b2(sqrtf(a2.x*2)*0.5f, sqrtf(a2.y*2)*0.5f); float p = std::clamp(d / 32.0f, 0.0f, 1.0f); a1.lerp(b1, a1, p); a2.lerp(b2, a2, p); } - vec2 areaortho(int pattern, float left, float right, float offset) + vec2 areaortho(int pattern, float left, float right, float offset) { float d = left + right + 1, o1 = offset + 0.5f, @@ -470,33 +470,33 @@ namespace //internal functions incl. AA implementations { case 0: { - return vec2(0, 0); + return vec2(0.f, 0.f); } case 1: { - return left <= right ? areaortho(0, o2, d/2, 0, left) : vec2(0, 0); + return left <= right ? areaortho(0, o2, d/2, 0, left) : vec2(0.f, 0.f); } case 2: { - return left >= right ? areaortho(d/2, 0, d, o2, left) : vec2(0, 0); + return left >= right ? areaortho(d/2, 0, d, o2, left) : vec2(0.f, 0.f); } case 3: { - vec2 a1 = areaortho(0, o2, d/2, 0, left), a2 = areaortho(d/2, 0, d, o2, left); + vec2 a1 = areaortho(0, o2, d/2, 0, left), a2 = areaortho(d/2, 0, d, o2, left); smootharea(d, a1, a2); return a1.add(a2); } case 4: { - return left <= right ? areaortho(0, o1, d/2, 0, left) : vec2(0, 0); + return left <= right ? areaortho(0, o1, d/2, 0, left) : vec2(0.f, 0.f); } case 5: { - return vec2(0, 0); + return vec2(0.f, 0.f); } case 6: { - vec2 a = areaortho(0, o1, d, o2, left); + vec2 a = areaortho(0, o1, d, o2, left); if(std::fabs(offset) > 0) { a.avg(areaortho(0, o1, d/2, 0, left).add(areaortho(d/2, 0, d, o2, left))); @@ -509,11 +509,11 @@ namespace //internal functions incl. AA implementations } case 8: { - return left >= right ? areaortho(d/2, 0, d, o1, left) : vec2(0, 0); + return left >= right ? areaortho(d/2, 0, d, o1, left) : vec2(0.f, 0.f); } case 9: { - vec2 a = areaortho(0, o2, d, o1, left); + vec2 a = areaortho(0, o2, d, o1, left); if(std::fabs(offset) > 0) { a.avg(areaortho(0, o2, d/2, 0, left).add(areaortho(d/2, 0, d, o1, left))); @@ -522,7 +522,7 @@ namespace //internal functions incl. AA implementations } case 10: { - return vec2(0, 0); + return vec2(0.f, 0.f); } case 11: { @@ -530,8 +530,8 @@ namespace //internal functions incl. AA implementations } case 12: { - vec2 a1 = areaortho(0, o1, d/2, 0, left), - a2 = areaortho(d/2, 0, d, o1, left); + vec2 a1 = areaortho(0, o1, d/2, 0, left), + a2 = areaortho(d/2, 0, d, o1, left); smootharea(d, a1, a2); return a1.add(a2); } @@ -545,15 +545,15 @@ namespace //internal functions incl. AA implementations } case 15: { - return vec2(0, 0); + return vec2(0.f, 0.f); } } - return vec2(0, 0); + return vec2(0.f, 0.f); } - float areaunderdiag(const vec2 &p1, const vec2 &p2, const vec2 &p) + float areaunderdiag(const vec2 &p1, const vec2 &p2, const vec2 &p) { - vec2 d(p2.y - p1.y, p1.x - p2.x); + vec2 d(p2.y - p1.y, p1.x - p2.x); float dp = d.dot(vec2(p1).sub(p)); if(!d.x) { @@ -626,9 +626,9 @@ namespace //internal functions incl. AA implementations return 1; } - vec2 areadiag(const vec2 &p1, const vec2 &p2, float left) + vec2 areadiag(const vec2 &p1, const vec2 &p2, float left) { - return vec2(1 - areaunderdiag(p1, p2, vec2(1, 0).add(left)), areaunderdiag(p1, p2, vec2(1, 1).add(left))); + return vec2(1 - areaunderdiag(p1, p2, vec2(1.f, 0.f).add(left)), areaunderdiag(p1, p2, vec2(1.f, 1.f).add(left))); } constexpr int edgesdiag[][2] = @@ -637,10 +637,10 @@ namespace //internal functions incl. AA implementations {0, 1}, {1, 1}, {0, 3}, {1, 3}, {2, 1}, {3, 1}, {2, 3}, {3, 3} }; - vec2 areadiag(float p1x, float p1y, float p2x, float p2y, float d, float left, const vec2 &offset, int pattern) + vec2 areadiag(float p1x, float p1y, float p2x, float p2y, float d, float left, const vec2 &offset, int pattern) { - vec2 p1(p1x, p1y), - p2(p2x+d, p2y+d); + vec2 p1(p1x, p1y), + p2(p2x+d, p2y+d); if(edgesdiag[pattern][0]) { p1.add(offset); @@ -652,12 +652,12 @@ namespace //internal functions incl. AA implementations return areadiag(p1, p2, left); } - vec2 areadiag2(float p1x, float p1y, float p2x, float p2y, float p3x, float p3y, float p4x, float p4y, float d, float left, const vec2 &offset, int pattern) + vec2 areadiag2(float p1x, float p1y, float p2x, float p2y, float p3x, float p3y, float p4x, float p4y, float d, float left, const vec2 &offset, int pattern) { - vec2 p1(p1x, p1y), - p2(p2x+d, p2y+d), - p3(p3x, p3y), - p4(p4x+d, p4y+d); + vec2 p1(p1x, p1y), + p2(p2x+d, p2y+d), + p3(p3x, p3y), + p4(p4x+d, p4y+d); if(edgesdiag[pattern][0]) { p1.add(offset); @@ -671,7 +671,7 @@ namespace //internal functions incl. AA implementations return areadiag(p1, p2, left).avg(areadiag(p3, p4, left)); } - vec2 areadiag(int pattern, float left, float right, const vec2 &offset) + vec2 areadiag(int pattern, float left, float right, const vec2 &offset) { float d = left + right + 1; switch(pattern) @@ -693,7 +693,7 @@ namespace //internal functions incl. AA implementations case 14: return areadiag2(1, 1, 1, 1, 1, 1, 1, 0, d, left, offset, pattern); case 15: return areadiag2(1, 1, 1, 1, 1, 0, 1, 0, d, left, offset, pattern); } - return vec2(0, 0); + return vec2(0.f, 0.f); } constexpr float offsetsortho[] = { 0.0f, -0.25f, 0.25f, -0.125f, 0.125f, -0.375f, 0.375f }; @@ -724,7 +724,7 @@ namespace //internal functions incl. AA implementations { for(int x = 0; x < 16; ++x) { - vec2 a = areaortho(pattern, x*x, y*y, offsetsortho[offset]); + vec2 a = areaortho(pattern, x*x, y*y, offsetsortho[offset]); dst[0] = static_cast(255*a.x); dst[1] = static_cast(255*a.y); dst += 2; @@ -744,7 +744,7 @@ namespace //internal functions incl. AA implementations { for(int x = 0; x < 20; ++x) { - vec2 a = areadiag(pattern, x, y, vec2(offsetsdiag[offset][0], offsetsdiag[offset][1])); + vec2 a = areadiag(pattern, x, y, vec2(offsetsdiag[offset][0], offsetsdiag[offset][1])); dst[0] = static_cast(255*a.x); dst[1] = static_cast(255*a.y); dst += 2; @@ -1069,7 +1069,7 @@ void GBuffer::setaavelocityparams(GLenum tmu) matrix4 reproject; reproject.muld(tqaaframe ? tqaaprevscreenmatrix : screenmatrix, worldmatrix); - vec2 jitter = tqaaframe&1 ? vec2(0.5f, 0.5f) : vec2(-0.5f, -0.5f); + vec2 jitter = tqaaframe&1 ? vec2(0.5f, 0.5f) : vec2(-0.5f, -0.5f); if(multisampledaa()) { jitter.x *= 0.5f; @@ -1112,7 +1112,7 @@ void jitteraa() nojittermatrix = projmatrix; if(!drawtex && tqaa) { - vec2 jitter = tqaaframe&1 ? vec2(0.25f, 0.25f) : vec2(-0.25f, -0.25f); + vec2 jitter = tqaaframe&1 ? vec2(0.25f, 0.25f) : vec2(-0.25f, -0.25f); if(multisampledaa()) { jitter.x *= 0.5f; diff --git a/src/engine/render/csm.cpp b/src/engine/render/csm.cpp index 56e11ba48..aa5c2394c 100644 --- a/src/engine/render/csm.cpp +++ b/src/engine/render/csm.cpp @@ -217,7 +217,7 @@ void cascadedshadowmap::getprojmatrix() int border = smfilter > 2 ? smborder2 : smborder; const float pradius = std::ceil(radius * csmpradiustweak), step = (2*pradius) / (sm.size - 2*border); - vec2 offset = vec2(tc).sub(pradius).div(step); + vec2 offset = vec2(tc).sub(pradius).div(step); offset.x = std::floor(offset.x); offset.y = std::floor(offset.y); split.center = vec(vec2(offset).mul(step).add(pradius), -0.5f*(minz + maxz)); diff --git a/src/engine/render/grass.cpp b/src/engine/render/grass.cpp index 257d21768..34f793f5d 100644 --- a/src/engine/render/grass.cpp +++ b/src/engine/render/grass.cpp @@ -49,7 +49,7 @@ namespace //internal functionality not seen by other files { vec pos; vec4 color; - vec2 tc; + vec2 tc; }; std::vector grassverts; diff --git a/src/engine/render/hud.cpp b/src/engine/render/hud.cpp index 2ee96eb5d..57f89964e 100644 --- a/src/engine/render/hud.cpp +++ b/src/engine/render/hud.cpp @@ -66,9 +66,9 @@ namespace m.translate(0, offset, 0); m.scale(size*scale); - gle::attrib(m.transform(vec2(1, 1))); - gle::attrib(m.transform(vec2(-1, 1))); - gle::attrib(m.transform(vec2(0, 0))); + gle::attrib(m.transform(vec2(1.f, 1.f))); + gle::attrib(m.transform(vec2(-1.f, 1.f))); + gle::attrib(m.transform(vec2(0.f, 0.f))); // fade in log space so short blips don't disappear too quickly scale -= static_cast(curtime)/damagecompassfade; diff --git a/src/engine/render/octarender.cpp b/src/engine/render/octarender.cpp index 4f8e6519b..be8896b63 100644 --- a/src/engine/render/octarender.cpp +++ b/src/engine/render/octarender.cpp @@ -1238,7 +1238,7 @@ namespace return vec(0, 0, 1); } norm--; - const vec2 &yaw = sincos360[norm%360], + const vec2 &yaw = sincos360[norm%360], &pitch = sincos360[norm/360+270]; return vec(-yaw.y*pitch.x, yaw.x*pitch.x, pitch.y); } diff --git a/src/engine/render/radiancehints.cpp b/src/engine/render/radiancehints.cpp index 233a0b2af..e23375f73 100644 --- a/src/engine/render/radiancehints.cpp +++ b/src/engine/render/radiancehints.cpp @@ -962,7 +962,7 @@ void reflectiveshadowmap::getprojmatrix() model.transform(c, tc); const float pradius = std::ceil((radius + gidist) * rsmpradiustweak), step = (2*pradius) / rsmsize; - vec2 tcoff = vec2(tc).sub(pradius).div(step); + vec2 tcoff = vec2(tc).sub(pradius).div(step); tcoff.x = std::floor(tcoff.x); tcoff.y = std::floor(tcoff.y); center = vec(vec2(tcoff).mul(step).add(pradius), -0.5f*(minz + maxz)); diff --git a/src/engine/render/rendergl.cpp b/src/engine/render/rendergl.cpp index a5a77ad01..4ed71b9c6 100644 --- a/src/engine/render/rendergl.cpp +++ b/src/engine/render/rendergl.cpp @@ -1489,7 +1489,7 @@ static void setupscreenquad() { glGenBuffers_(1, &screenquadvbo); gle::bindvbo(screenquadvbo); - vec2 verts[4] = { vec2(1, -1), vec2(-1, -1), vec2(1, 1), vec2(-1, 1) }; + vec2 verts[4] = { vec2(1.ff, -1.f), vec2(-1.f, -1.f), vec2(1.f, 1.f), vec2(-1.f, 1.f) }; glBufferData_(GL_ARRAY_BUFFER, sizeof(verts), verts, GL_STATIC_DRAW); gle::clearvbo(); } @@ -1509,7 +1509,7 @@ void screenquad() setupscreenquad(); gle::bindvbo(screenquadvbo); gle::enablevertex(); - gle::vertexpointer(sizeof(vec2), (const vec2 *)0, GL_FLOAT, 2); + gle::vertexpointer(sizeof(vec2), (const vec2 *)0, GL_FLOAT, 2); glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); gle::disablevertex(); gle::clearvbo(); diff --git a/src/engine/render/renderlights.cpp b/src/engine/render/renderlights.cpp index e1ab004bc..6dc4211c6 100644 --- a/src/engine/render/renderlights.cpp +++ b/src/engine/render/renderlights.cpp @@ -51,7 +51,7 @@ int hdrclear = 0; int spotlights = 0, volumetriclights = 0, nospeclights = 0; -std::vector msaapositions; +std::vector> msaapositions; //`g`-buffer `scale` VARFP(gscale, 25, 100, 100, gbuf.cleanupgbuffer()); //size of g buffer, approximately correlates to g buffer linear dimensions @@ -2185,7 +2185,7 @@ static void setlightglobals(bool transparent = false) } else { - GLOBALPARAM(aoscale, aotex[2] ? vec2(1, 1) : vec2(static_cast(aow)/vieww, static_cast(aoh)/viewh)); + GLOBALPARAM(aoscale, aotex[2] ? vec2(1.f, 1.f) : vec2(static_cast(aow)/vieww, static_cast(aoh)/viewh)); GLOBALPARAMF(aoparams, aomin, 1.0f-aomin, aosunmin, 1.0f-aosunmin); } } @@ -2229,7 +2229,7 @@ static LocalShaderParam lightpos("lightpos"), shadowparams("shadowparams"), shadowoffset("shadowoffset"); static vec4 lightposv[8], lightcolorv[8], spotparamsv[8], shadowparamsv[8]; -static vec2 shadowoffsetv[8]; +static vec2 shadowoffsetv[8]; static void setlightparams(int i, const lightinfo &l) { diff --git a/src/engine/render/renderlights.h b/src/engine/render/renderlights.h index 906a24b50..5e45cd24c 100644 --- a/src/engine/render/renderlights.h +++ b/src/engine/render/renderlights.h @@ -248,7 +248,7 @@ extern int calcspherersmsplits(const vec ¢er, float radius); inline bool sphereinsidespot(const vec &dir, int spot, const vec ¢er, float radius) { - const vec2 &sc = sincos360[spot]; + const vec2 &sc = sincos360[spot]; float cdist = dir.dot(center), cradius = radius + sc.y*cdist; return sc.x*sc.x*(center.dot(center) - cdist*cdist) <= cradius*cradius; } @@ -262,7 +262,7 @@ extern matrix4 worldmatrix, screenmatrix; extern int gw, gh, gdepthformat, ghasstencil; extern int msaasamples, msaalight; -extern std::vector msaapositions; +extern std::vector> msaapositions; extern bool inoq; extern int rhinoq; diff --git a/src/engine/render/renderparticles.cpp b/src/engine/render/renderparticles.cpp index b20040d3e..984f7d3f8 100644 --- a/src/engine/render/renderparticles.cpp +++ b/src/engine/render/renderparticles.cpp @@ -205,7 +205,7 @@ struct partvert { vec pos; //x,y,z of particle vec4 color; //r,g,b,a color - vec2 tc; //texture coordinate + vec2 tc; //texture coordinate }; static constexpr float collideradius = 8.0f; @@ -537,7 +537,7 @@ class meterrenderer : public listrenderer gle::begin(GL_TRIANGLE_STRIP); for(int k = 0; k < 10; ++k) { - const vec2 &sc = sincos360[k*(180/(10-1))]; + const vec2 &sc = sincos360[k*(180/(10-1))]; float c = (0.5f + 0.1f)*sc.y, s = 0.5f - (0.5f + 0.1f)*sc.x; gle::attrib(m.transform(vec2(-c, s))); @@ -556,7 +556,7 @@ class meterrenderer : public listrenderer gle::begin(GL_TRIANGLE_STRIP); for(int k = 0; k < 10; ++k) { - const vec2 &sc = sincos360[k*(180/(10-1))]; + const vec2 &sc = sincos360[k*(180/(10-1))]; float c = 0.5f*sc.y, s = 0.5f - 0.5f*sc.x; gle::attrib(m.transform(vec2(left + c, s))); @@ -570,7 +570,7 @@ class meterrenderer : public listrenderer gle::begin(GL_TRIANGLE_FAN); for(int k = 0; k < 10; ++k) { - const vec2 &sc = sincos360[k*(180/(10-1))]; + const vec2 &sc = sincos360[k*(180/(10-1))]; float c = (0.5f + 0.1f)*sc.y, s = 0.5f - (0.5f + 0.1f)*sc.x; gle::attrib(m.transform(vec2(left + c, s))); @@ -582,7 +582,7 @@ class meterrenderer : public listrenderer gle::begin(GL_TRIANGLE_STRIP); for(int k = 0; k < 10; ++k) { - const vec2 &sc = sincos360[k*(180/(10-1))]; + const vec2 &sc = sincos360[k*(180/(10-1))]; float c = 0.5f*sc.y, s = 0.5f - 0.5f*sc.x; gle::attrib(m.transform(vec2(-c, s))); @@ -695,12 +695,12 @@ void genrotpos(const vec &o, const vec &d, float size, int grav, int ts, partver //==================================================================== ROTCOEFFS #define ROTCOEFFS(n) { \ - vec2(-1, 1).rotate_around_z(n*2*M_PI/32.0f), \ - vec2( 1, 1).rotate_around_z(n*2*M_PI/32.0f), \ - vec2( 1, -1).rotate_around_z(n*2*M_PI/32.0f), \ - vec2(-1, -1).rotate_around_z(n*2*M_PI/32.0f) \ + vec2(-1.f, 1.f).rotate_around_z(n*2*M_PI/32.0f), \ + vec2( 1.f, 1.f).rotate_around_z(n*2*M_PI/32.0f), \ + vec2( 1.f, -1.f).rotate_around_z(n*2*M_PI/32.0f), \ + vec2(-1.f, -1.f).rotate_around_z(n*2*M_PI/32.0f) \ } -static const vec2 rotcoeffs[32][4] = +static const vec2 rotcoeffs[32][4] = { ROTCOEFFS(0), ROTCOEFFS(1), ROTCOEFFS(2), ROTCOEFFS(3), ROTCOEFFS(4), ROTCOEFFS(5), ROTCOEFFS(6), ROTCOEFFS(7), ROTCOEFFS(8), ROTCOEFFS(9), ROTCOEFFS(10), ROTCOEFFS(11), ROTCOEFFS(12), ROTCOEFFS(13), ROTCOEFFS(14), ROTCOEFFS(15), @@ -899,10 +899,10 @@ struct varenderer : partrenderer v1 = v1c, \ v2 = v2c; \ body; \ - vs[0].tc = vec2(u1, v1); \ - vs[1].tc = vec2(u2, v1); \ - vs[2].tc = vec2(u2, v2); \ - vs[3].tc = vec2(u1, v2); \ + vs[0].tc = vec2(u1, v1); \ + vs[1].tc = vec2(u2, v1); \ + vs[2].tc = vec2(u2, v2); \ + vs[3].tc = vec2(u1, v2); \ } if(type&PT_RND4) { @@ -1743,7 +1743,7 @@ static void regularshape(int type, int radius, int color, int dir, int num, int vec to, from; if(dir < 12) { - const vec2 &sc = sincos360[randomint(360)]; + const vec2 &sc = sincos360[randomint(360)]; to[dir%3] = sc.y*radius; to[(dir+1)%3] = sc.x*radius; to[(dir+2)%3] = 0.0; diff --git a/src/engine/render/renderva.cpp b/src/engine/render/renderva.cpp index f6c2eaace..d14b41903 100644 --- a/src/engine/render/renderva.cpp +++ b/src/engine/render/renderva.cpp @@ -644,7 +644,7 @@ namespace GLuint textures[7]; Slot *slot, *texgenslot; VSlot *vslot, *texgenvslot; - vec2 texgenscroll; + vec2 texgenscroll; int texgenorient, texgenmillis; renderstate() : colormask(true), depthmask(true), alphaing(0), vbuf(0), vattribs(false), @@ -1071,7 +1071,7 @@ namespace const texrotation &r = texrotations[vslot.rotation]; float xs = r.flipx ? -tex->xs : tex->xs, ys = r.flipy ? -tex->ys : tex->ys; - vec2 scroll(vslot.scroll); + vec2 scroll(vslot.scroll); if(r.swapxy) { std::swap(scroll.x, scroll.y); diff --git a/src/engine/render/stain.cpp b/src/engine/render/stain.cpp index 5cee5fe6b..a5c5be052 100644 --- a/src/engine/render/stain.cpp +++ b/src/engine/render/stain.cpp @@ -35,7 +35,7 @@ struct stainvert { vec pos; vec4 color; - vec2 tc; + vec2 tc; }; struct staininfo diff --git a/src/engine/render/texture.h b/src/engine/render/texture.h index 09c0c0126..909676902 100644 --- a/src/engine/render/texture.h +++ b/src/engine/render/texture.h @@ -475,7 +475,7 @@ struct GlobalShaderParam setf(v.x, v.y, v.z, w); } - void set(const vec2 &v, float z = 0, float w = 0) + void set(const vec2 &v, float z = 0, float w = 0) { setf(v.x, v.y, z, w); } @@ -657,7 +657,7 @@ struct LocalShaderParam setf(v.x, v.y, v.z, w); } - void set(const vec2 &v, float z = 0, float w = 0) + void set(const vec2 &v, float z = 0, float w = 0) { setf(v.x, v.y, z, w); } @@ -690,7 +690,7 @@ struct LocalShaderParam } } - void setv(const vec2 *v, int n = 1) + void setv(const vec2 *v, int n = 1) { ShaderParamBinding *b = resolve(); if(b) diff --git a/src/engine/world/bih.cpp b/src/engine/world/bih.cpp index 58f7141cc..24fa74de4 100644 --- a/src/engine/world/bih.cpp +++ b/src/engine/world/bih.cpp @@ -88,9 +88,9 @@ bool BIH::triintersect(const mesh &m, int tidx, const vec &mo, const vec &mray, float invdet = 1/det; if(m.flags&Mesh_Alpha && (mode&Ray_Shadow)==Ray_Shadow && (m.tex->alphamask || loadalphamask(m.tex))) { - vec2 at = m.gettc(t.vert[0]), - bt = m.gettc(t.vert[1]).sub(at).mul(v*invdet), - ct = m.gettc(t.vert[2]).sub(at).mul(w*invdet); + vec2 at = m.gettc(t.vert[0]), + bt = m.gettc(t.vert[1]).sub(at).mul(v*invdet), + ct = m.gettc(t.vert[2]).sub(at).mul(w*invdet); at.add(bt).add(ct); int si = std::clamp(static_cast(m.tex->xs * at.x), 0, m.tex->xs-1), ti = std::clamp(static_cast(m.tex->ys * at.y), 0, m.tex->ys-1); @@ -498,19 +498,19 @@ bool mmintersect(const extentity &e, const vec &o, const vec &ray, float maxdist //reorientation of rotated mmodels if(yaw != 0) { - const vec2 &rot = sincosmod360(-yaw); + const vec2 &rot = sincosmod360(-yaw); mo.rotate_around_z(rot); mray.rotate_around_z(rot); } if(pitch != 0) { - const vec2 &rot = sincosmod360(-pitch); + const vec2 &rot = sincosmod360(-pitch); mo.rotate_around_x(rot); mray.rotate_around_x(rot); } if(roll != 0) { - const vec2 &rot = sincosmod360(roll); + const vec2 &rot = sincosmod360(roll); mo.rotate_around_y(rot); mray.rotate_around_y(rot); } diff --git a/src/engine/world/bih.h b/src/engine/world/bih.h index fd96c818d..75397e471 100644 --- a/src/engine/world/bih.h +++ b/src/engine/world/bih.h @@ -72,9 +72,9 @@ class BIH { return *reinterpret_cast(pos + i*posstride); } - vec2 gettc(int i) const + vec2 gettc(int i) const { - return *reinterpret_cast(tc + i*tcstride); + return *reinterpret_cast *>(tc + i*tcstride); } }; diff --git a/src/engine/world/octaedit.cpp b/src/engine/world/octaedit.cpp index 59da3b8e7..9da3c43f0 100644 --- a/src/engine/world/octaedit.cpp +++ b/src/engine/world/octaedit.cpp @@ -1910,7 +1910,7 @@ void rendertexturepanel(int w, int h) sy = std::min(1.0f, tex->ys/static_cast(tex->xs)); int x = w*1800/h-s-50, r = s; - vec2 tc[4] = { vec2(0, 0), vec2(1, 0), vec2(1, 1), vec2(0, 1) }; + vec2 tc[4] = { vec2(0.f, 0.f), vec2(1.f, 0.f), vec2(1.f, 1.f), vec2(0.f, 1.f) }; float xoff = vslot.offset.x, yoff = vslot.offset.y; if(vslot.rotation) diff --git a/src/engine/world/physics.cpp b/src/engine/world/physics.cpp index d2dfd5ead..b0f855192 100644 --- a/src/engine/world/physics.cpp +++ b/src/engine/world/physics.cpp @@ -526,13 +526,13 @@ static bool fuzzycollideellipse(physent *d, const vec &dir, float cutoff, const } case 2: { - vec2 ln(mdlvol.orient.transform(entvol.center().sub(mdlvol.o))); + vec2 ln(mdlvol.orient.transform(entvol.center().sub(mdlvol.o))); float r = ln.magnitude(); if(r < 1e-6f) { continue; } - vec2 lw = vec2(ln.x*radius.y, ln.y*radius.x).normalize(); + vec2 lw = vec2(ln.x*radius.y, ln.y*radius.x).normalize(); w = mdlvol.orient.transposedtransform(lw); dist = -vec2(ln.x*radius.x, ln.y*radius.y).dot(lw)/r; break; diff --git a/src/shared/geom.cpp b/src/shared/geom.cpp index d0cfa67b4..b02b06e53 100644 --- a/src/shared/geom.cpp +++ b/src/shared/geom.cpp @@ -258,7 +258,7 @@ int polyclip(const vec *in, int numin, const vec &dir, float below, float above, //LUT used for fast angle calculations ingame //range 0 to 720 degrees to allow using offsets without needing slow modulus operators -extern const vec2 sincos360[721] = +extern const vec2 sincos360[721] = { vec2(1.00000000, 0.00000000), vec2(0.99984770, 0.01745241), vec2(0.99939083, 0.03489950), vec2(0.99862953, 0.05233596), vec2(0.99756405, 0.06975647), vec2(0.99619470, 0.08715574), // 0 vec2(0.99452190, 0.10452846), vec2(0.99254615, 0.12186934), vec2(0.99026807, 0.13917310), vec2(0.98768834, 0.15643447), vec2(0.98480775, 0.17364818), vec2(0.98162718, 0.19080900), // 6