From b36ec266f089757277845221709f18d2e48d754e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Kapu=C5=9Bci=C5=84ski?= Date: Fri, 24 Dec 2021 00:57:04 +0100 Subject: [PATCH] Refactored Math::Point from vertex types --- src/graphics/core/vertex.h | 75 +++++------------------------ src/graphics/engine/cloud.cpp | 8 ++-- src/graphics/engine/engine.cpp | 42 ++++++++-------- src/graphics/engine/lightning.cpp | 16 +++---- src/graphics/engine/particle.cpp | 80 +++++++++++++++---------------- src/graphics/engine/planet.cpp | 8 ++-- src/graphics/engine/text.cpp | 8 ++-- src/graphics/engine/water.cpp | 16 +++---- src/object/task/taskgoto.cpp | 6 +-- 9 files changed, 104 insertions(+), 155 deletions(-) diff --git a/src/graphics/core/vertex.h b/src/graphics/core/vertex.h index 69d2ae2c..cc0f3509 100644 --- a/src/graphics/core/vertex.h +++ b/src/graphics/core/vertex.h @@ -28,7 +28,6 @@ #include "graphics/core/color.h" #include "graphics/core/type.h" -#include "math/point.h" #include "math/vector.h" #include @@ -56,32 +55,15 @@ enum VertexType * It contains: * - vertex coordinates (x,y,z) as Math::Vector, * - normal coordinates (nx,ny,nz) as Math::Vector - * - texture coordinates (u,v) as Math::Point. + * - texture coordinates (u,v) as glm::vec2. */ struct Vertex { static constexpr VertexType VERTEX_TYPE = VERTEX_TYPE_NORMAL; - Math::Vector coord; - Math::Vector normal; - Math::Point texCoord; - - explicit Vertex(Math::Vector aCoord = Math::Vector(), - Math::Vector aNormal = Math::Vector(), - Math::Point aTexCoord = Math::Point()) - : coord(aCoord), normal(aNormal), - texCoord(aTexCoord) {} - - - //! Returns a string "(c: [...], n: [...], tc: [...])" - inline std::string ToString() const - { - std::stringstream s; - s.precision(3); - s << "(c: " << coord.ToString() << ", n: " << normal.ToString() - << ", tc: " << Math::ToString(texCoord) << ")"; - return s.str(); - } + Math::Vector coord = Math::Vector(); + Math::Vector normal = Math::Vector(); + glm::vec2 texCoord = { 0, 0 }; }; /** @@ -96,48 +78,25 @@ struct VertexCol { static constexpr VertexType VERTEX_TYPE = VERTEX_TYPE_COL; - Math::Vector coord; - Color color; - - VertexCol() = default; - - explicit VertexCol(Math::Vector aCoord, - Color aColor = Color()) - : coord(aCoord), color(aColor) {} - - //! Returns a string "(c: [...], col: [...])" - inline std::string ToString() const - { - std::stringstream s; - s.precision(3); - s << "(c: " << coord.ToString() << ", col: " << color.ToString() << ")"; - return s.str(); - } + Math::Vector coord = Math::Vector(); + Color color = Color(); }; - /** * \struct VertexTex2 * \brief Vertex with secondary texture coordinates * * In addition to fields from Vector, it contains - * secondary texture coordinates (u2, v2) as Math::Point + * secondary texture coordinates (u2, v2) as glm::vec2 */ struct VertexTex2 { static constexpr VertexType VERTEX_TYPE = VERTEX_TYPE_TEX2; - Math::Vector coord; - Math::Vector normal; - Math::Point texCoord; - Math::Point texCoord2; - - explicit VertexTex2(Math::Vector aCoord = Math::Vector(), - Math::Vector aNormal = Math::Vector(), - Math::Point aTexCoord = Math::Point(), - Math::Point aTexCoord2 = Math::Point()) - : coord(aCoord), normal(aNormal), - texCoord(aTexCoord), texCoord2(aTexCoord2) {} + Math::Vector coord = Math::Vector(); + Math::Vector normal = Math::Vector(); + glm::vec2 texCoord = { 0, 0 }; + glm::vec2 texCoord2 = { 0, 0 }; //! Sets the fields from Vertex with texCoord2 = (0,0) void FromVertex(const Vertex &v) @@ -145,17 +104,7 @@ struct VertexTex2 coord = v.coord; normal = v.normal; texCoord = v.texCoord; - texCoord2 = Math::Point(); - } - - //! Returns a string "(c: [...], n: [...], tc: [...], tc2: [...])" - inline std::string ToString() const - { - std::stringstream s; - s.precision(3); - s << "(c: " << coord.ToString() << ", n: " << normal.ToString() - << ", tc: " << Math::ToString(texCoord) << ", tc2: " << Math::ToString(texCoord2) << ")"; - return s.str(); + texCoord2 = { 0, 0 }; } }; diff --git a/src/graphics/engine/cloud.cpp b/src/graphics/engine/cloud.cpp index 88b83f99..0edf2faa 100644 --- a/src/graphics/engine/cloud.cpp +++ b/src/graphics/engine/cloud.cpp @@ -152,13 +152,13 @@ void CCloud::Draw() p.z = pos.z+size; p.y = pos.y; AdjustLevel(p, eye, deep, uv1, uv2); - vertices[vertexIndex++] = VertexTex2(p, n, uv1, uv2); + vertices[vertexIndex++] = VertexTex2{ p, n, uv1, uv2 }; p.x = pos.x-size; p.z = pos.z-size; p.y = pos.y; AdjustLevel(p, eye, deep, uv1, uv2); - vertices[vertexIndex++] = VertexTex2(p, n, uv1, uv2); + vertices[vertexIndex++] = VertexTex2{ p, n, uv1, uv2 }; for (int j = 0; j < m_lines[i].len; j++) { @@ -166,13 +166,13 @@ void CCloud::Draw() p.z = pos.z+size; p.y = pos.y; AdjustLevel(p, eye, deep, uv1, uv2); - vertices[vertexIndex++] = VertexTex2(p, n, uv1, uv2); + vertices[vertexIndex++] = VertexTex2{ p, n, uv1, uv2 }; p.x = pos.x+size; p.z = pos.z-size; p.y = pos.y; AdjustLevel(p, eye, deep, uv1, uv2); - vertices[vertexIndex++] = VertexTex2(p, n, uv1, uv2); + vertices[vertexIndex++] = VertexTex2{ p, n, uv1, uv2 }; pos.x += size*2.0f; } diff --git a/src/graphics/engine/engine.cpp b/src/graphics/engine/engine.cpp index 421935d8..1de94a38 100644 --- a/src/graphics/engine/engine.cpp +++ b/src/graphics/engine/engine.cpp @@ -4883,10 +4883,10 @@ void CEngine::DrawShadowSpots() Vertex vertex[4] = { - Vertex(corner[1], n, Math::Point(ts.x, ts.y)), - Vertex(corner[0], n, Math::Point(ti.x, ts.y)), - Vertex(corner[3], n, Math::Point(ts.x, ti.y)), - Vertex(corner[2], n, Math::Point(ti.x, ti.y)) + { corner[1], n, Math::Point(ts.x, ts.y) }, + { corner[0], n, Math::Point(ti.x, ts.y) }, + { corner[3], n, Math::Point(ts.x, ti.y) }, + { corner[2], n, Math::Point(ti.x, ti.y) } }; float intensity = (0.5f+m_shadowSpots[i].intensity*0.5f)*hFactor; @@ -4956,10 +4956,10 @@ void CEngine::DrawBackgroundGradient(const Color& up, const Color& down) VertexCol vertex[4] = { - VertexCol(Math::Vector(p1.x, p1.y, 0.0f), color[1]), - VertexCol(Math::Vector(p1.x, p2.y, 0.0f), color[0]), - VertexCol(Math::Vector(p2.x, p1.y, 0.0f), color[1]), - VertexCol(Math::Vector(p2.x, p2.y, 0.0f), color[0]) + { Math::Vector(p1.x, p1.y, 0.0f), color[1] }, + { Math::Vector(p1.x, p2.y, 0.0f), color[0] }, + { Math::Vector(p2.x, p1.y, 0.0f), color[1] }, + { Math::Vector(p2.x, p2.y, 0.0f), color[0] } }; m_device->DrawPrimitive(PrimitiveType::TRIANGLE_STRIP, vertex, 4); @@ -5082,10 +5082,10 @@ void CEngine::DrawForegroundImage() Vertex vertex[4] = { - Vertex(Math::Vector(p1.x, p1.y, 0.0f), n, Math::Point(u1, v2)), - Vertex(Math::Vector(p1.x, p2.y, 0.0f), n, Math::Point(u1, v1)), - Vertex(Math::Vector(p2.x, p1.y, 0.0f), n, Math::Point(u2, v2)), - Vertex(Math::Vector(p2.x, p2.y, 0.0f), n, Math::Point(u2, v1)) + { Math::Vector(p1.x, p1.y, 0.0f), n, Math::Point(u1, v2) }, + { Math::Vector(p1.x, p2.y, 0.0f), n, Math::Point(u1, v1) }, + { Math::Vector(p2.x, p1.y, 0.0f), n, Math::Point(u2, v2) }, + { Math::Vector(p2.x, p2.y, 0.0f), n, Math::Point(u2, v1) } }; SetTexture(m_foregroundTex); @@ -5128,10 +5128,10 @@ void CEngine::DrawOverColor() VertexCol vertex[4] = { - VertexCol(Math::Vector(p1.x, p1.y, 0.0f), color[1]), - VertexCol(Math::Vector(p1.x, p2.y, 0.0f), color[0]), - VertexCol(Math::Vector(p2.x, p1.y, 0.0f), color[1]), - VertexCol(Math::Vector(p2.x, p2.y, 0.0f), color[0]) + { Math::Vector(p1.x, p1.y, 0.0f), color[1] }, + { Math::Vector(p1.x, p2.y, 0.0f), color[0] }, + { Math::Vector(p2.x, p1.y, 0.0f), color[1] }, + { Math::Vector(p2.x, p2.y, 0.0f), color[0] } }; m_device->DrawPrimitive(PrimitiveType::TRIANGLE_STRIP, vertex, 4); @@ -5201,11 +5201,11 @@ void CEngine::DrawHighlight() Color color(1.0f, 1.0f, 0.0f); // yellow VertexCol line[3] = - { - VertexCol(Math::Vector(), color), - VertexCol(Math::Vector(), color), - VertexCol(Math::Vector(), color) - }; + { + { Math::Vector(), color }, + { Math::Vector(), color }, + { Math::Vector(), color } + }; float dx = (p2.x - p1.x) / 5.0f; float dy = (p2.y - p1.y) / 5.0f; diff --git a/src/graphics/engine/lightning.cpp b/src/graphics/engine/lightning.cpp index f7f52b5c..02f898f7 100644 --- a/src/graphics/engine/lightning.cpp +++ b/src/graphics/engine/lightning.cpp @@ -275,17 +275,17 @@ void CLightning::Draw() if (p2.y < p1.y) { - vertex[0] = Vertex(corner[1], n, Math::Point(texSup.x, texSup.y)); - vertex[1] = Vertex(corner[0], n, Math::Point(texInf.x, texSup.y)); - vertex[2] = Vertex(corner[3], n, Math::Point(texSup.x, texInf.y)); - vertex[3] = Vertex(corner[2], n, Math::Point(texInf.x, texInf.y)); + vertex[0] = { corner[1], n, Math::Point(texSup.x, texSup.y) }; + vertex[1] = { corner[0], n, Math::Point(texInf.x, texSup.y) }; + vertex[2] = { corner[3], n, Math::Point(texSup.x, texInf.y) }; + vertex[3] = { corner[2], n, Math::Point(texInf.x, texInf.y) }; } else { - vertex[0] = Vertex(corner[0], n, Math::Point(texSup.x, texSup.y)); - vertex[1] = Vertex(corner[1], n, Math::Point(texInf.x, texSup.y)); - vertex[2] = Vertex(corner[2], n, Math::Point(texSup.x, texInf.y)); - vertex[3] = Vertex(corner[3], n, Math::Point(texInf.x, texInf.y)); + vertex[0] = { corner[0], n, Math::Point(texSup.x, texSup.y) }; + vertex[1] = { corner[1], n, Math::Point(texInf.x, texSup.y) }; + vertex[2] = { corner[2], n, Math::Point(texSup.x, texInf.y) }; + vertex[3] = { corner[3], n, Math::Point(texInf.x, texInf.y) }; } device->DrawPrimitive(PrimitiveType::TRIANGLE_STRIP, vertex, 4); diff --git a/src/graphics/engine/particle.cpp b/src/graphics/engine/particle.cpp index 3e873b40..35779bec 100644 --- a/src/graphics/engine/particle.cpp +++ b/src/graphics/engine/particle.cpp @@ -2650,17 +2650,17 @@ void CParticle::TrackDraw(int i, ParticleType type) if (p2.y < p1.y) { - vertex[0] = Vertex(corner[1], n, Math::Point(texSup.x, texSup.y)); - vertex[1] = Vertex(corner[0], n, Math::Point(texInf.x, texSup.y)); - vertex[2] = Vertex(corner[3], n, Math::Point(texSup.x, texInf.y)); - vertex[3] = Vertex(corner[2], n, Math::Point(texInf.x, texInf.y)); + vertex[0] = { corner[1], n, Math::Point(texSup.x, texSup.y) }; + vertex[1] = { corner[0], n, Math::Point(texInf.x, texSup.y) }; + vertex[2] = { corner[3], n, Math::Point(texSup.x, texInf.y) }; + vertex[3] = { corner[2], n, Math::Point(texInf.x, texInf.y) }; } else { - vertex[0] = Vertex(corner[0], n, Math::Point(texSup.x, texSup.y)); - vertex[1] = Vertex(corner[1], n, Math::Point(texInf.x, texSup.y)); - vertex[2] = Vertex(corner[2], n, Math::Point(texSup.x, texInf.y)); - vertex[3] = Vertex(corner[3], n, Math::Point(texInf.x, texInf.y)); + vertex[0] = { corner[0], n, Math::Point(texSup.x, texSup.y) }; + vertex[1] = { corner[1], n, Math::Point(texInf.x, texSup.y) }; + vertex[2] = { corner[2], n, Math::Point(texSup.x, texInf.y) }; + vertex[3] = { corner[3], n, Math::Point(texInf.x, texInf.y) }; } m_device->DrawPrimitive(PrimitiveType::TRIANGLE_STRIP, vertex, 4); @@ -2736,10 +2736,10 @@ void CParticle::DrawParticleNorm(int i) corner[3].y = pos.y-dim.y; corner[3].z = 0.0f; - vertex[0] = Vertex(corner[1], n, Math::Point(m_particle[i].texSup.x, m_particle[i].texSup.y)); - vertex[1] = Vertex(corner[0], n, Math::Point(m_particle[i].texInf.x, m_particle[i].texSup.y)); - vertex[2] = Vertex(corner[3], n, Math::Point(m_particle[i].texSup.x, m_particle[i].texInf.y)); - vertex[3] = Vertex(corner[2], n, Math::Point(m_particle[i].texInf.x, m_particle[i].texInf.y)); + vertex[0] = { corner[1], n, Math::Point(m_particle[i].texSup.x, m_particle[i].texSup.y) }; + vertex[1] = { corner[0], n, Math::Point(m_particle[i].texInf.x, m_particle[i].texSup.y) }; + vertex[2] = { corner[3], n, Math::Point(m_particle[i].texSup.x, m_particle[i].texInf.y) }; + vertex[3] = { corner[2], n, Math::Point(m_particle[i].texInf.x, m_particle[i].texInf.y) }; m_device->DrawPrimitive(PrimitiveType::TRIANGLE_STRIP, vertex, 4); m_engine->AddStatisticTriangle(2); @@ -2787,10 +2787,10 @@ void CParticle::DrawParticleNorm(int i) corner[3].y = -dim.y; corner[3].z = 0.0f; - vertex[0] = Vertex(corner[1], n, Math::Point(m_particle[i].texSup.x, m_particle[i].texSup.y)); - vertex[1] = Vertex(corner[0], n, Math::Point(m_particle[i].texInf.x, m_particle[i].texSup.y)); - vertex[2] = Vertex(corner[3], n, Math::Point(m_particle[i].texSup.x, m_particle[i].texInf.y)); - vertex[3] = Vertex(corner[2], n, Math::Point(m_particle[i].texInf.x, m_particle[i].texInf.y)); + vertex[0] = { corner[1], n, Math::Point(m_particle[i].texSup.x, m_particle[i].texSup.y) }; + vertex[1] = { corner[0], n, Math::Point(m_particle[i].texInf.x, m_particle[i].texSup.y) }; + vertex[2] = { corner[3], n, Math::Point(m_particle[i].texSup.x, m_particle[i].texInf.y) }; + vertex[3] = { corner[2], n, Math::Point(m_particle[i].texInf.x, m_particle[i].texInf.y) }; m_device->DrawPrimitive(PrimitiveType::TRIANGLE_STRIP, vertex, 4, m_particle[i].color); m_engine->AddStatisticTriangle(2); @@ -2851,10 +2851,10 @@ void CParticle::DrawParticleFlat(int i) corner[3].z = 0.0f; Vertex vertex[4]; - vertex[0] = Vertex(corner[1], n, Math::Point(m_particle[i].texSup.x, m_particle[i].texSup.y)); - vertex[1] = Vertex(corner[0], n, Math::Point(m_particle[i].texInf.x, m_particle[i].texSup.y)); - vertex[2] = Vertex(corner[3], n, Math::Point(m_particle[i].texSup.x, m_particle[i].texInf.y)); - vertex[3] = Vertex(corner[2], n, Math::Point(m_particle[i].texInf.x, m_particle[i].texInf.y)); + vertex[0] = { corner[1], n, Math::Point(m_particle[i].texSup.x, m_particle[i].texSup.y) }; + vertex[1] = { corner[0], n, Math::Point(m_particle[i].texInf.x, m_particle[i].texSup.y) }; + vertex[2] = { corner[3], n, Math::Point(m_particle[i].texSup.x, m_particle[i].texInf.y) }; + vertex[3] = { corner[2], n, Math::Point(m_particle[i].texInf.x, m_particle[i].texInf.y) }; m_device->DrawPrimitive(PrimitiveType::TRIANGLE_STRIP, vertex, 4); m_engine->AddStatisticTriangle(2); @@ -2938,10 +2938,10 @@ void CParticle::DrawParticleFog(int i) Vertex vertex[4]; - vertex[0] = Vertex(corner[1], n, Math::Point(m_particle[i].texSup.x, m_particle[i].texSup.y)); - vertex[1] = Vertex(corner[0], n, Math::Point(m_particle[i].texInf.x, m_particle[i].texSup.y)); - vertex[2] = Vertex(corner[3], n, Math::Point(m_particle[i].texSup.x, m_particle[i].texInf.y)); - vertex[3] = Vertex(corner[2], n, Math::Point(m_particle[i].texInf.x, m_particle[i].texInf.y)); + vertex[0] = { corner[1], n, Math::Point(m_particle[i].texSup.x, m_particle[i].texSup.y) }; + vertex[1] = { corner[0], n, Math::Point(m_particle[i].texInf.x, m_particle[i].texSup.y) }; + vertex[2] = { corner[3], n, Math::Point(m_particle[i].texSup.x, m_particle[i].texInf.y) }; + vertex[3] = { corner[2], n, Math::Point(m_particle[i].texInf.x, m_particle[i].texInf.y) }; m_device->DrawPrimitive(PrimitiveType::TRIANGLE_STRIP, vertex, 4); m_engine->AddStatisticTriangle(2); @@ -3092,10 +3092,10 @@ void CParticle::DrawParticleRay(int i) if (r % 4 < 2) Math::Swap(texInf.y, texSup.y); - vertex[0] = Vertex(corner[1], n, Math::Point(texSup.x, texSup.y)); - vertex[1] = Vertex(corner[0], n, Math::Point(texInf.x, texSup.y)); - vertex[2] = Vertex(corner[3], n, Math::Point(texSup.x, texInf.y)); - vertex[3] = Vertex(corner[2], n, Math::Point(texInf.x, texInf.y)); + vertex[0] = { corner[1], n, Math::Point(texSup.x, texSup.y) }; + vertex[1] = { corner[0], n, Math::Point(texInf.x, texSup.y) }; + vertex[2] = { corner[3], n, Math::Point(texSup.x, texInf.y) }; + vertex[3] = { corner[2], n, Math::Point(texInf.x, texInf.y) }; m_device->DrawPrimitive(PrimitiveType::TRIANGLE_STRIP, vertex, 4); m_engine->AddStatisticTriangle(2); @@ -3192,8 +3192,8 @@ void CParticle::DrawParticleSphere(int i) tu0 = ts.x+(ti.x-ts.x)*tu0; float tu1 = tu0; - vertex[j++] = Vertex(v0, v0, Math::Point(tu0, tv0)); - vertex[j++] = Vertex(v1, v1, Math::Point(tu1, tv1)); + vertex[j++] = { v0, v0, Math::Point(tu0, tv0) }; + vertex[j++] = { v1, v1, Math::Point(tu1, tv1) }; } } @@ -3287,8 +3287,8 @@ void CParticle::DrawParticleCylinder(int i) tu0 = ts.x+(ti.x-ts.x)*tu0; float tu1 = tu0; - vertex[j++] = Vertex(v0, v0, Math::Point(tu0, tv0)); - vertex[j++] = Vertex(v1, v1, Math::Point(tu1, tv1)); + vertex[j++] = { v0, v0, Math::Point(tu0, tv0) }; + vertex[j++] = { v1, v1, Math::Point(tu1, tv1) }; } } @@ -3344,10 +3344,10 @@ void CParticle::DrawParticleWheel(int i) ti.y = ti.y-dp; Vertex vertex[4]; - vertex[0] = Vertex(pos[0], n, Math::Point(ts.x, ts.y)); - vertex[1] = Vertex(pos[1], n, Math::Point(ti.x, ts.y)); - vertex[2] = Vertex(pos[2], n, Math::Point(ts.x, ti.y)); - vertex[3] = Vertex(pos[3], n, Math::Point(ti.x, ti.y)); + vertex[0] = { pos[0], n, Math::Point(ts.x, ts.y) }; + vertex[1] = { pos[1], n, Math::Point(ti.x, ts.y) }; + vertex[2] = { pos[2], n, Math::Point(ts.x, ti.y) }; + vertex[3] = { pos[3], n, Math::Point(ti.x, ti.y) }; m_device->DrawPrimitive(PrimitiveType::TRIANGLE_STRIP, vertex, 4, TraceColorColor(m_wheelTrace[i].color)); m_engine->AddStatisticTriangle(2); @@ -3365,10 +3365,10 @@ void CParticle::DrawParticleWheel(int i) Math::Vector n(0.0f, 1.0f, 0.0f); Vertex vertex[4]; - vertex[0] = Vertex(pos[0], n); - vertex[1] = Vertex(pos[1], n); - vertex[2] = Vertex(pos[2], n); - vertex[3] = Vertex(pos[3], n); + vertex[0] = { pos[0], n }; + vertex[1] = { pos[1], n }; + vertex[2] = { pos[2], n }; + vertex[3] = { pos[3], n }; m_device->DrawPrimitive(PrimitiveType::TRIANGLE_STRIP, vertex, 4, TraceColorColor(m_wheelTrace[i].color)); m_engine->AddStatisticTriangle(2); diff --git a/src/graphics/engine/planet.cpp b/src/graphics/engine/planet.cpp index 7706888d..e00a8784 100644 --- a/src/graphics/engine/planet.cpp +++ b/src/graphics/engine/planet.cpp @@ -141,10 +141,10 @@ void CPlanet::Draw() Vertex quad[4] = { - Vertex(Math::Vector(p1.x, p1.y, 0.0f), n, Math::Point(u1, v2)), - Vertex(Math::Vector(p1.x, p2.y, 0.0f), n, Math::Point(u1, v1)), - Vertex(Math::Vector(p2.x, p1.y, 0.0f), n, Math::Point(u2, v2)), - Vertex(Math::Vector(p2.x, p2.y, 0.0f), n, Math::Point(u2, v1)) + { Math::Vector(p1.x, p1.y, 0.0f), n, Math::Point(u1, v2) }, + { Math::Vector(p1.x, p2.y, 0.0f), n, Math::Point(u1, v1) }, + { Math::Vector(p2.x, p1.y, 0.0f), n, Math::Point(u2, v2) }, + { Math::Vector(p2.x, p2.y, 0.0f), n, Math::Point(u2, v1) } }; device->DrawPrimitive(PrimitiveType::TRIANGLE_STRIP, quad, 4); diff --git a/src/graphics/engine/text.cpp b/src/graphics/engine/text.cpp index 6c9d1036..fca61c09 100644 --- a/src/graphics/engine/text.cpp +++ b/src/graphics/engine/text.cpp @@ -1016,10 +1016,10 @@ void CText::DrawHighlight(FontMetaChar hl, const glm::ivec2& pos, const glm::ive VertexCol quad[] = { - VertexCol(Math::Vector(p1.x, p2.y, 0.0f), grad[3]), - VertexCol(Math::Vector(p1.x, p1.y, 0.0f), grad[0]), - VertexCol(Math::Vector(p2.x, p2.y, 0.0f), grad[2]), - VertexCol(Math::Vector(p2.x, p1.y, 0.0f), grad[1]) + { Math::Vector(p1.x, p2.y, 0.0f), grad[3] }, + { Math::Vector(p1.x, p1.y, 0.0f), grad[0] }, + { Math::Vector(p2.x, p2.y, 0.0f), grad[2] }, + { Math::Vector(p2.x, p1.y, 0.0f), grad[1] } }; m_device->DrawPrimitive(PrimitiveType::TRIANGLE_STRIP, quad, 4); diff --git a/src/graphics/engine/water.cpp b/src/graphics/engine/water.cpp index 5ce08d9f..966bd575 100644 --- a/src/graphics/engine/water.cpp +++ b/src/graphics/engine/water.cpp @@ -300,10 +300,10 @@ void CWater::DrawBack() VertexCol vertices[4] = { - VertexCol(Math::Vector(p1.x, p2.y, p1.z), white), - VertexCol(Math::Vector(p1.x, p1.y, p1.z), white), - VertexCol(Math::Vector(p2.x, p2.y, p2.z), white), - VertexCol(Math::Vector(p2.x, p1.y, p2.z), white) + { Math::Vector(p1.x, p2.y, p1.z), white }, + { Math::Vector(p1.x, p1.y, p1.z), white }, + { Math::Vector(p2.x, p2.y, p2.z), white }, + { Math::Vector(p2.x, p1.y, p2.z), white } }; device->DrawPrimitive(PrimitiveType::TRIANGLE_STRIP, vertices, 4); @@ -392,14 +392,14 @@ void CWater::DrawSurf() p.y = pos.y; AdjustLevel(p, n, uv1, uv2); if (under) n.y = -n.y; - vertices[vertexIndex++] = Vertex(p, n, uv1); + vertices[vertexIndex++] = { p, n, uv1 }; p.x = pos.x-size; p.z = pos.z+sizez; p.y = pos.y; AdjustLevel(p, n, uv1, uv2); if (under) n.y = -n.y; - vertices[vertexIndex++] = Vertex(p, n, uv1); + vertices[vertexIndex++] = { p, n, uv1 }; for (int j = 0; j < m_lines[i].len; j++) { @@ -408,14 +408,14 @@ void CWater::DrawSurf() p.y = pos.y; AdjustLevel(p, n, uv1, uv2); if (under) n.y = -n.y; - vertices[vertexIndex++] = Vertex(p, n, uv1); + vertices[vertexIndex++] = { p, n, uv1 }; p.x = pos.x+size; p.z = pos.z+sizez; p.y = pos.y; AdjustLevel(p, n, uv1, uv2); if (under) n.y = -n.y; - vertices[vertexIndex++] = Vertex(p, n, uv1); + vertices[vertexIndex++] = { p, n, uv1 }; pos.x += size*2.0f; } diff --git a/src/object/task/taskgoto.cpp b/src/object/task/taskgoto.cpp index fd0a6238..58b610da 100644 --- a/src/object/task/taskgoto.cpp +++ b/src/object/task/taskgoto.cpp @@ -100,14 +100,14 @@ bool CTaskGoto::EventProcess(const Event &event) { if (i > m_bmIndex-1) color = Gfx::Color(1.0f, 0.0f, 0.0f); - debugLine.push_back(Gfx::VertexCol(AdjustPoint(m_bmPoints[i]), color)); + debugLine.push_back({ AdjustPoint(m_bmPoints[i]), color }); } m_engine->AddDebugGotoLine(debugLine); debugLine.clear(); } Gfx::Color color = Gfx::Color(0.0f, 0.0f, 1.0f); - debugLine.push_back(Gfx::VertexCol(m_object->GetPosition(), color)); - debugLine.push_back(Gfx::VertexCol(AdjustPoint(m_bmTotal > 0 && m_bmIndex <= m_bmTotal && m_phase != TGP_BEAMSEARCH ? m_bmPoints[m_bmIndex] : m_goal), color)); + debugLine.push_back({ m_object->GetPosition(), color }); + debugLine.push_back({ AdjustPoint(m_bmTotal > 0 && m_bmIndex <= m_bmTotal && m_phase != TGP_BEAMSEARCH ? m_bmPoints[m_bmIndex] : m_goal), color }); m_engine->AddDebugGotoLine(debugLine); if (m_object->GetSelect() && m_bmChanged)