Refactored Math::Point from vertex types

dev
Tomasz Kapuściński 2021-12-24 00:57:04 +01:00
parent c0d067d24b
commit b36ec266f0
9 changed files with 104 additions and 155 deletions

View File

@ -28,7 +28,6 @@
#include "graphics/core/color.h" #include "graphics/core/color.h"
#include "graphics/core/type.h" #include "graphics/core/type.h"
#include "math/point.h"
#include "math/vector.h" #include "math/vector.h"
#include <sstream> #include <sstream>
@ -56,32 +55,15 @@ enum VertexType
* It contains: * It contains:
* - vertex coordinates (x,y,z) as Math::Vector, * - vertex coordinates (x,y,z) as Math::Vector,
* - normal coordinates (nx,ny,nz) 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 struct Vertex
{ {
static constexpr VertexType VERTEX_TYPE = VERTEX_TYPE_NORMAL; static constexpr VertexType VERTEX_TYPE = VERTEX_TYPE_NORMAL;
Math::Vector coord; Math::Vector coord = Math::Vector();
Math::Vector normal; Math::Vector normal = Math::Vector();
Math::Point texCoord; glm::vec2 texCoord = { 0, 0 };
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();
}
}; };
/** /**
@ -96,48 +78,25 @@ struct VertexCol
{ {
static constexpr VertexType VERTEX_TYPE = VERTEX_TYPE_COL; static constexpr VertexType VERTEX_TYPE = VERTEX_TYPE_COL;
Math::Vector coord; Math::Vector coord = Math::Vector();
Color color; Color 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();
}
}; };
/** /**
* \struct VertexTex2 * \struct VertexTex2
* \brief Vertex with secondary texture coordinates * \brief Vertex with secondary texture coordinates
* *
* In addition to fields from Vector, it contains * 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 struct VertexTex2
{ {
static constexpr VertexType VERTEX_TYPE = VERTEX_TYPE_TEX2; static constexpr VertexType VERTEX_TYPE = VERTEX_TYPE_TEX2;
Math::Vector coord; Math::Vector coord = Math::Vector();
Math::Vector normal; Math::Vector normal = Math::Vector();
Math::Point texCoord; glm::vec2 texCoord = { 0, 0 };
Math::Point texCoord2; glm::vec2 texCoord2 = { 0, 0 };
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) {}
//! Sets the fields from Vertex with texCoord2 = (0,0) //! Sets the fields from Vertex with texCoord2 = (0,0)
void FromVertex(const Vertex &v) void FromVertex(const Vertex &v)
@ -145,17 +104,7 @@ struct VertexTex2
coord = v.coord; coord = v.coord;
normal = v.normal; normal = v.normal;
texCoord = v.texCoord; texCoord = v.texCoord;
texCoord2 = Math::Point(); texCoord2 = { 0, 0 };
}
//! 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();
} }
}; };

View File

@ -152,13 +152,13 @@ void CCloud::Draw()
p.z = pos.z+size; p.z = pos.z+size;
p.y = pos.y; p.y = pos.y;
AdjustLevel(p, eye, deep, uv1, uv2); 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.x = pos.x-size;
p.z = pos.z-size; p.z = pos.z-size;
p.y = pos.y; p.y = pos.y;
AdjustLevel(p, eye, deep, uv1, uv2); 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++) for (int j = 0; j < m_lines[i].len; j++)
{ {
@ -166,13 +166,13 @@ void CCloud::Draw()
p.z = pos.z+size; p.z = pos.z+size;
p.y = pos.y; p.y = pos.y;
AdjustLevel(p, eye, deep, uv1, uv2); 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.x = pos.x+size;
p.z = pos.z-size; p.z = pos.z-size;
p.y = pos.y; p.y = pos.y;
AdjustLevel(p, eye, deep, uv1, uv2); 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; pos.x += size*2.0f;
} }

View File

@ -4883,10 +4883,10 @@ void CEngine::DrawShadowSpots()
Vertex vertex[4] = Vertex vertex[4] =
{ {
Vertex(corner[1], n, Math::Point(ts.x, ts.y)), { corner[1], n, Math::Point(ts.x, ts.y) },
Vertex(corner[0], n, Math::Point(ti.x, ts.y)), { corner[0], n, Math::Point(ti.x, ts.y) },
Vertex(corner[3], n, Math::Point(ts.x, ti.y)), { corner[3], n, Math::Point(ts.x, ti.y) },
Vertex(corner[2], n, Math::Point(ti.x, ti.y)) { corner[2], n, Math::Point(ti.x, ti.y) }
}; };
float intensity = (0.5f+m_shadowSpots[i].intensity*0.5f)*hFactor; 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 vertex[4] =
{ {
VertexCol(Math::Vector(p1.x, p1.y, 0.0f), color[1]), { Math::Vector(p1.x, p1.y, 0.0f), color[1] },
VertexCol(Math::Vector(p1.x, p2.y, 0.0f), color[0]), { Math::Vector(p1.x, p2.y, 0.0f), color[0] },
VertexCol(Math::Vector(p2.x, p1.y, 0.0f), color[1]), { Math::Vector(p2.x, p1.y, 0.0f), color[1] },
VertexCol(Math::Vector(p2.x, p2.y, 0.0f), color[0]) { Math::Vector(p2.x, p2.y, 0.0f), color[0] }
}; };
m_device->DrawPrimitive(PrimitiveType::TRIANGLE_STRIP, vertex, 4); m_device->DrawPrimitive(PrimitiveType::TRIANGLE_STRIP, vertex, 4);
@ -5082,10 +5082,10 @@ void CEngine::DrawForegroundImage()
Vertex vertex[4] = Vertex vertex[4] =
{ {
Vertex(Math::Vector(p1.x, p1.y, 0.0f), n, Math::Point(u1, v2)), { 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)), { 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)), { 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(p2.x, p2.y, 0.0f), n, Math::Point(u2, v1) }
}; };
SetTexture(m_foregroundTex); SetTexture(m_foregroundTex);
@ -5128,10 +5128,10 @@ void CEngine::DrawOverColor()
VertexCol vertex[4] = VertexCol vertex[4] =
{ {
VertexCol(Math::Vector(p1.x, p1.y, 0.0f), color[1]), { Math::Vector(p1.x, p1.y, 0.0f), color[1] },
VertexCol(Math::Vector(p1.x, p2.y, 0.0f), color[0]), { Math::Vector(p1.x, p2.y, 0.0f), color[0] },
VertexCol(Math::Vector(p2.x, p1.y, 0.0f), color[1]), { Math::Vector(p2.x, p1.y, 0.0f), color[1] },
VertexCol(Math::Vector(p2.x, p2.y, 0.0f), color[0]) { Math::Vector(p2.x, p2.y, 0.0f), color[0] }
}; };
m_device->DrawPrimitive(PrimitiveType::TRIANGLE_STRIP, vertex, 4); m_device->DrawPrimitive(PrimitiveType::TRIANGLE_STRIP, vertex, 4);
@ -5202,9 +5202,9 @@ void CEngine::DrawHighlight()
VertexCol line[3] = VertexCol line[3] =
{ {
VertexCol(Math::Vector(), color), { Math::Vector(), color },
VertexCol(Math::Vector(), color), { Math::Vector(), color },
VertexCol(Math::Vector(), color) { Math::Vector(), color }
}; };
float dx = (p2.x - p1.x) / 5.0f; float dx = (p2.x - p1.x) / 5.0f;

View File

@ -275,17 +275,17 @@ void CLightning::Draw()
if (p2.y < p1.y) if (p2.y < p1.y)
{ {
vertex[0] = Vertex(corner[1], n, Math::Point(texSup.x, texSup.y)); vertex[0] = { corner[1], n, Math::Point(texSup.x, texSup.y) };
vertex[1] = Vertex(corner[0], n, Math::Point(texInf.x, texSup.y)); vertex[1] = { corner[0], n, Math::Point(texInf.x, texSup.y) };
vertex[2] = Vertex(corner[3], n, Math::Point(texSup.x, texInf.y)); vertex[2] = { corner[3], n, Math::Point(texSup.x, texInf.y) };
vertex[3] = Vertex(corner[2], n, Math::Point(texInf.x, texInf.y)); vertex[3] = { corner[2], n, Math::Point(texInf.x, texInf.y) };
} }
else else
{ {
vertex[0] = Vertex(corner[0], n, Math::Point(texSup.x, texSup.y)); vertex[0] = { corner[0], n, Math::Point(texSup.x, texSup.y) };
vertex[1] = Vertex(corner[1], n, Math::Point(texInf.x, texSup.y)); vertex[1] = { corner[1], n, Math::Point(texInf.x, texSup.y) };
vertex[2] = Vertex(corner[2], n, Math::Point(texSup.x, texInf.y)); vertex[2] = { corner[2], n, Math::Point(texSup.x, texInf.y) };
vertex[3] = Vertex(corner[3], n, Math::Point(texInf.x, texInf.y)); vertex[3] = { corner[3], n, Math::Point(texInf.x, texInf.y) };
} }
device->DrawPrimitive(PrimitiveType::TRIANGLE_STRIP, vertex, 4); device->DrawPrimitive(PrimitiveType::TRIANGLE_STRIP, vertex, 4);

View File

@ -2650,17 +2650,17 @@ void CParticle::TrackDraw(int i, ParticleType type)
if (p2.y < p1.y) if (p2.y < p1.y)
{ {
vertex[0] = Vertex(corner[1], n, Math::Point(texSup.x, texSup.y)); vertex[0] = { corner[1], n, Math::Point(texSup.x, texSup.y) };
vertex[1] = Vertex(corner[0], n, Math::Point(texInf.x, texSup.y)); vertex[1] = { corner[0], n, Math::Point(texInf.x, texSup.y) };
vertex[2] = Vertex(corner[3], n, Math::Point(texSup.x, texInf.y)); vertex[2] = { corner[3], n, Math::Point(texSup.x, texInf.y) };
vertex[3] = Vertex(corner[2], n, Math::Point(texInf.x, texInf.y)); vertex[3] = { corner[2], n, Math::Point(texInf.x, texInf.y) };
} }
else else
{ {
vertex[0] = Vertex(corner[0], n, Math::Point(texSup.x, texSup.y)); vertex[0] = { corner[0], n, Math::Point(texSup.x, texSup.y) };
vertex[1] = Vertex(corner[1], n, Math::Point(texInf.x, texSup.y)); vertex[1] = { corner[1], n, Math::Point(texInf.x, texSup.y) };
vertex[2] = Vertex(corner[2], n, Math::Point(texSup.x, texInf.y)); vertex[2] = { corner[2], n, Math::Point(texSup.x, texInf.y) };
vertex[3] = Vertex(corner[3], n, Math::Point(texInf.x, texInf.y)); vertex[3] = { corner[3], n, Math::Point(texInf.x, texInf.y) };
} }
m_device->DrawPrimitive(PrimitiveType::TRIANGLE_STRIP, vertex, 4); 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].y = pos.y-dim.y;
corner[3].z = 0.0f; corner[3].z = 0.0f;
vertex[0] = Vertex(corner[1], n, Math::Point(m_particle[i].texSup.x, m_particle[i].texSup.y)); vertex[0] = { 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[1] = { 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[2] = { 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[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_device->DrawPrimitive(PrimitiveType::TRIANGLE_STRIP, vertex, 4);
m_engine->AddStatisticTriangle(2); m_engine->AddStatisticTriangle(2);
@ -2787,10 +2787,10 @@ void CParticle::DrawParticleNorm(int i)
corner[3].y = -dim.y; corner[3].y = -dim.y;
corner[3].z = 0.0f; corner[3].z = 0.0f;
vertex[0] = Vertex(corner[1], n, Math::Point(m_particle[i].texSup.x, m_particle[i].texSup.y)); vertex[0] = { 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[1] = { 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[2] = { 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[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_device->DrawPrimitive(PrimitiveType::TRIANGLE_STRIP, vertex, 4, m_particle[i].color);
m_engine->AddStatisticTriangle(2); m_engine->AddStatisticTriangle(2);
@ -2851,10 +2851,10 @@ void CParticle::DrawParticleFlat(int i)
corner[3].z = 0.0f; corner[3].z = 0.0f;
Vertex vertex[4]; Vertex vertex[4];
vertex[0] = Vertex(corner[1], n, Math::Point(m_particle[i].texSup.x, m_particle[i].texSup.y)); vertex[0] = { 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[1] = { 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[2] = { 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[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_device->DrawPrimitive(PrimitiveType::TRIANGLE_STRIP, vertex, 4);
m_engine->AddStatisticTriangle(2); m_engine->AddStatisticTriangle(2);
@ -2938,10 +2938,10 @@ void CParticle::DrawParticleFog(int i)
Vertex vertex[4]; Vertex vertex[4];
vertex[0] = Vertex(corner[1], n, Math::Point(m_particle[i].texSup.x, m_particle[i].texSup.y)); vertex[0] = { 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[1] = { 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[2] = { 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[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_device->DrawPrimitive(PrimitiveType::TRIANGLE_STRIP, vertex, 4);
m_engine->AddStatisticTriangle(2); m_engine->AddStatisticTriangle(2);
@ -3092,10 +3092,10 @@ void CParticle::DrawParticleRay(int i)
if (r % 4 < 2) if (r % 4 < 2)
Math::Swap(texInf.y, texSup.y); Math::Swap(texInf.y, texSup.y);
vertex[0] = Vertex(corner[1], n, Math::Point(texSup.x, texSup.y)); vertex[0] = { corner[1], n, Math::Point(texSup.x, texSup.y) };
vertex[1] = Vertex(corner[0], n, Math::Point(texInf.x, texSup.y)); vertex[1] = { corner[0], n, Math::Point(texInf.x, texSup.y) };
vertex[2] = Vertex(corner[3], n, Math::Point(texSup.x, texInf.y)); vertex[2] = { corner[3], n, Math::Point(texSup.x, texInf.y) };
vertex[3] = Vertex(corner[2], n, Math::Point(texInf.x, texInf.y)); vertex[3] = { corner[2], n, Math::Point(texInf.x, texInf.y) };
m_device->DrawPrimitive(PrimitiveType::TRIANGLE_STRIP, vertex, 4); m_device->DrawPrimitive(PrimitiveType::TRIANGLE_STRIP, vertex, 4);
m_engine->AddStatisticTriangle(2); m_engine->AddStatisticTriangle(2);
@ -3192,8 +3192,8 @@ void CParticle::DrawParticleSphere(int i)
tu0 = ts.x+(ti.x-ts.x)*tu0; tu0 = ts.x+(ti.x-ts.x)*tu0;
float tu1 = tu0; float tu1 = tu0;
vertex[j++] = Vertex(v0, v0, Math::Point(tu0, tv0)); vertex[j++] = { v0, v0, Math::Point(tu0, tv0) };
vertex[j++] = Vertex(v1, v1, Math::Point(tu1, tv1)); 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; tu0 = ts.x+(ti.x-ts.x)*tu0;
float tu1 = tu0; float tu1 = tu0;
vertex[j++] = Vertex(v0, v0, Math::Point(tu0, tv0)); vertex[j++] = { v0, v0, Math::Point(tu0, tv0) };
vertex[j++] = Vertex(v1, v1, Math::Point(tu1, tv1)); vertex[j++] = { v1, v1, Math::Point(tu1, tv1) };
} }
} }
@ -3344,10 +3344,10 @@ void CParticle::DrawParticleWheel(int i)
ti.y = ti.y-dp; ti.y = ti.y-dp;
Vertex vertex[4]; Vertex vertex[4];
vertex[0] = Vertex(pos[0], n, Math::Point(ts.x, ts.y)); vertex[0] = { pos[0], n, Math::Point(ts.x, ts.y) };
vertex[1] = Vertex(pos[1], n, Math::Point(ti.x, ts.y)); vertex[1] = { pos[1], n, Math::Point(ti.x, ts.y) };
vertex[2] = Vertex(pos[2], n, Math::Point(ts.x, ti.y)); vertex[2] = { pos[2], n, Math::Point(ts.x, ti.y) };
vertex[3] = Vertex(pos[3], n, Math::Point(ti.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_device->DrawPrimitive(PrimitiveType::TRIANGLE_STRIP, vertex, 4, TraceColorColor(m_wheelTrace[i].color));
m_engine->AddStatisticTriangle(2); m_engine->AddStatisticTriangle(2);
@ -3365,10 +3365,10 @@ void CParticle::DrawParticleWheel(int i)
Math::Vector n(0.0f, 1.0f, 0.0f); Math::Vector n(0.0f, 1.0f, 0.0f);
Vertex vertex[4]; Vertex vertex[4];
vertex[0] = Vertex(pos[0], n); vertex[0] = { pos[0], n };
vertex[1] = Vertex(pos[1], n); vertex[1] = { pos[1], n };
vertex[2] = Vertex(pos[2], n); vertex[2] = { pos[2], n };
vertex[3] = Vertex(pos[3], n); vertex[3] = { pos[3], n };
m_device->DrawPrimitive(PrimitiveType::TRIANGLE_STRIP, vertex, 4, TraceColorColor(m_wheelTrace[i].color)); m_device->DrawPrimitive(PrimitiveType::TRIANGLE_STRIP, vertex, 4, TraceColorColor(m_wheelTrace[i].color));
m_engine->AddStatisticTriangle(2); m_engine->AddStatisticTriangle(2);

View File

@ -141,10 +141,10 @@ void CPlanet::Draw()
Vertex quad[4] = Vertex quad[4] =
{ {
Vertex(Math::Vector(p1.x, p1.y, 0.0f), n, Math::Point(u1, v2)), { 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)), { 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)), { 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(p2.x, p2.y, 0.0f), n, Math::Point(u2, v1) }
}; };
device->DrawPrimitive(PrimitiveType::TRIANGLE_STRIP, quad, 4); device->DrawPrimitive(PrimitiveType::TRIANGLE_STRIP, quad, 4);

View File

@ -1016,10 +1016,10 @@ void CText::DrawHighlight(FontMetaChar hl, const glm::ivec2& pos, const glm::ive
VertexCol quad[] = VertexCol quad[] =
{ {
VertexCol(Math::Vector(p1.x, p2.y, 0.0f), grad[3]), { Math::Vector(p1.x, p2.y, 0.0f), grad[3] },
VertexCol(Math::Vector(p1.x, p1.y, 0.0f), grad[0]), { Math::Vector(p1.x, p1.y, 0.0f), grad[0] },
VertexCol(Math::Vector(p2.x, p2.y, 0.0f), grad[2]), { Math::Vector(p2.x, p2.y, 0.0f), grad[2] },
VertexCol(Math::Vector(p2.x, p1.y, 0.0f), grad[1]) { Math::Vector(p2.x, p1.y, 0.0f), grad[1] }
}; };
m_device->DrawPrimitive(PrimitiveType::TRIANGLE_STRIP, quad, 4); m_device->DrawPrimitive(PrimitiveType::TRIANGLE_STRIP, quad, 4);

View File

@ -300,10 +300,10 @@ void CWater::DrawBack()
VertexCol vertices[4] = VertexCol vertices[4] =
{ {
VertexCol(Math::Vector(p1.x, p2.y, p1.z), white), { Math::Vector(p1.x, p2.y, p1.z), white },
VertexCol(Math::Vector(p1.x, p1.y, p1.z), white), { Math::Vector(p1.x, p1.y, p1.z), white },
VertexCol(Math::Vector(p2.x, p2.y, p2.z), white), { Math::Vector(p2.x, p2.y, p2.z), white },
VertexCol(Math::Vector(p2.x, p1.y, p2.z), white) { Math::Vector(p2.x, p1.y, p2.z), white }
}; };
device->DrawPrimitive(PrimitiveType::TRIANGLE_STRIP, vertices, 4); device->DrawPrimitive(PrimitiveType::TRIANGLE_STRIP, vertices, 4);
@ -392,14 +392,14 @@ void CWater::DrawSurf()
p.y = pos.y; p.y = pos.y;
AdjustLevel(p, n, uv1, uv2); AdjustLevel(p, n, uv1, uv2);
if (under) n.y = -n.y; if (under) n.y = -n.y;
vertices[vertexIndex++] = Vertex(p, n, uv1); vertices[vertexIndex++] = { p, n, uv1 };
p.x = pos.x-size; p.x = pos.x-size;
p.z = pos.z+sizez; p.z = pos.z+sizez;
p.y = pos.y; p.y = pos.y;
AdjustLevel(p, n, uv1, uv2); AdjustLevel(p, n, uv1, uv2);
if (under) n.y = -n.y; 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++) for (int j = 0; j < m_lines[i].len; j++)
{ {
@ -408,14 +408,14 @@ void CWater::DrawSurf()
p.y = pos.y; p.y = pos.y;
AdjustLevel(p, n, uv1, uv2); AdjustLevel(p, n, uv1, uv2);
if (under) n.y = -n.y; if (under) n.y = -n.y;
vertices[vertexIndex++] = Vertex(p, n, uv1); vertices[vertexIndex++] = { p, n, uv1 };
p.x = pos.x+size; p.x = pos.x+size;
p.z = pos.z+sizez; p.z = pos.z+sizez;
p.y = pos.y; p.y = pos.y;
AdjustLevel(p, n, uv1, uv2); AdjustLevel(p, n, uv1, uv2);
if (under) n.y = -n.y; if (under) n.y = -n.y;
vertices[vertexIndex++] = Vertex(p, n, uv1); vertices[vertexIndex++] = { p, n, uv1 };
pos.x += size*2.0f; pos.x += size*2.0f;
} }

View File

@ -100,14 +100,14 @@ bool CTaskGoto::EventProcess(const Event &event)
{ {
if (i > m_bmIndex-1) if (i > m_bmIndex-1)
color = Gfx::Color(1.0f, 0.0f, 0.0f); 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); m_engine->AddDebugGotoLine(debugLine);
debugLine.clear(); debugLine.clear();
} }
Gfx::Color color = Gfx::Color(0.0f, 0.0f, 1.0f); Gfx::Color color = Gfx::Color(0.0f, 0.0f, 1.0f);
debugLine.push_back(Gfx::VertexCol(m_object->GetPosition(), color)); debugLine.push_back({ 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({ AdjustPoint(m_bmTotal > 0 && m_bmIndex <= m_bmTotal && m_phase != TGP_BEAMSEARCH ? m_bmPoints[m_bmIndex] : m_goal), color });
m_engine->AddDebugGotoLine(debugLine); m_engine->AddDebugGotoLine(debugLine);
if (m_object->GetSelect() && m_bmChanged) if (m_object->GetSelect() && m_bmChanged)