aboutsummaryrefslogtreecommitdiff
path: root/include/S3DVertex.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/S3DVertex.h')
-rw-r--r--include/S3DVertex.h25
1 files changed, 14 insertions, 11 deletions
diff --git a/include/S3DVertex.h b/include/S3DVertex.h
index 2040f9d..aba81a7 100644
--- a/include/S3DVertex.h
+++ b/include/S3DVertex.h
@@ -25,7 +25,7 @@ enum E_VERTEX_TYPE
EVT_2TCOORDS,
//! Vertex with a tangent and binormal vector, video::S3DVertexTangents.
- /** Usually used for tangent space normal mapping.
+ /** Usually used for tangent space normal mapping.
Usually tangent and binormal get send to shaders as texture coordinate sets 1 and 2.
*/
EVT_TANGENTS
@@ -44,7 +44,7 @@ const char* const sBuiltInVertexTypeNames[] =
struct S3DVertex
{
//! default constructor
- S3DVertex() {}
+ S3DVertex() : Color(0xffffffff) {}
//! constructor
S3DVertex(f32 x, f32 y, f32 z, f32 nx, f32 ny, f32 nz, SColor c, f32 tu, f32 tv)
@@ -142,7 +142,7 @@ struct S3DVertex2TCoords : public S3DVertex
: S3DVertex(pos, normal, color, tcoords), TCoords2(tcoords) {}
//! constructor from S3DVertex
- S3DVertex2TCoords(S3DVertex& o) : S3DVertex(o) {}
+ S3DVertex2TCoords(const S3DVertex& o) : S3DVertex(o) {}
//! Second set of texture coordinates
core::vector2d<f32> TCoords2;
@@ -150,21 +150,21 @@ struct S3DVertex2TCoords : public S3DVertex
//! Equality operator
bool operator==(const S3DVertex2TCoords& other) const
{
- return ((static_cast<S3DVertex>(*this)==other) &&
+ return ((static_cast<S3DVertex>(*this)==static_cast<const S3DVertex&>(other)) &&
(TCoords2 == other.TCoords2));
}
//! Inequality operator
bool operator!=(const S3DVertex2TCoords& other) const
{
- return ((static_cast<S3DVertex>(*this)!=other) ||
+ return ((static_cast<S3DVertex>(*this)!=static_cast<const S3DVertex&>(other)) ||
(TCoords2 != other.TCoords2));
}
bool operator<(const S3DVertex2TCoords& other) const
{
return ((static_cast<S3DVertex>(*this) < other) ||
- ((static_cast<S3DVertex>(*this) == other) && (TCoords2 < other.TCoords2)));
+ ((static_cast<S3DVertex>(*this) == static_cast<const S3DVertex&>(other)) && (TCoords2 < other.TCoords2)));
}
static E_VERTEX_TYPE getType()
@@ -186,7 +186,7 @@ struct S3DVertex2TCoords : public S3DVertex
//! Vertex with a tangent and binormal vector.
-/** Usually used for tangent space normal mapping.
+/** Usually used for tangent space normal mapping.
Usually tangent and binormal get send to shaders as texture coordinate sets 1 and 2.
*/
struct S3DVertexTangents : public S3DVertex
@@ -214,6 +214,9 @@ struct S3DVertexTangents : public S3DVertex
const core::vector3df& binormal=core::vector3df())
: S3DVertex(pos, normal, c, tcoords), Tangent(tangent), Binormal(binormal) { }
+ //! constructor from S3DVertex
+ S3DVertexTangents(const S3DVertex& o) : S3DVertex(o) {}
+
//! Tangent vector along the x-axis of the texture
core::vector3df Tangent;
@@ -222,14 +225,14 @@ struct S3DVertexTangents : public S3DVertex
bool operator==(const S3DVertexTangents& other) const
{
- return ((static_cast<S3DVertex>(*this)==other) &&
+ return ((static_cast<S3DVertex>(*this)==static_cast<const S3DVertex&>(other)) &&
(Tangent == other.Tangent) &&
(Binormal == other.Binormal));
}
bool operator!=(const S3DVertexTangents& other) const
{
- return ((static_cast<S3DVertex>(*this)!=other) ||
+ return ((static_cast<S3DVertex>(*this)!=static_cast<const S3DVertex&>(other)) ||
(Tangent != other.Tangent) ||
(Binormal != other.Binormal));
}
@@ -237,8 +240,8 @@ struct S3DVertexTangents : public S3DVertex
bool operator<(const S3DVertexTangents& other) const
{
return ((static_cast<S3DVertex>(*this) < other) ||
- ((static_cast<S3DVertex>(*this) == other) && (Tangent < other.Tangent)) ||
- ((static_cast<S3DVertex>(*this) == other) && (Tangent == other.Tangent) && (Binormal < other.Binormal)));
+ ((static_cast<S3DVertex>(*this) == static_cast<const S3DVertex&>(other)) && (Tangent < other.Tangent)) ||
+ ((static_cast<S3DVertex>(*this) == static_cast<const S3DVertex&>(other)) && (Tangent == other.Tangent) && (Binormal < other.Binormal)));
}
static E_VERTEX_TYPE getType()