Commit 3c8c56d3 authored by hybrid's avatar hybrid

Add interpolation methods

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@3280 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 6a34c5fd
...@@ -89,6 +89,15 @@ struct S3DVertex ...@@ -89,6 +89,15 @@ struct S3DVertex
{ {
return EVT_STANDARD; return EVT_STANDARD;
} }
S3DVertex getInterpolated(const S3DVertex& other, f32 d)
{
d = core::clamp(d, 0.0f, 1.0f);
return S3DVertex(Pos.getInterpolated(other.Pos, d),
Normal.getInterpolated(other.Normal, d),
Color.getInterpolated(other.Color, d),
TCoords.getInterpolated(other.TCoords, d));
}
}; };
...@@ -158,6 +167,16 @@ struct S3DVertex2TCoords : public S3DVertex ...@@ -158,6 +167,16 @@ struct S3DVertex2TCoords : public S3DVertex
{ {
return EVT_2TCOORDS; return EVT_2TCOORDS;
} }
S3DVertex2TCoords getInterpolated(const S3DVertex2TCoords& other, f32 d)
{
d = core::clamp(d, 0.0f, 1.0f);
return S3DVertex2TCoords(Pos.getInterpolated(other.Pos, d),
Normal.getInterpolated(other.Normal, d),
Color.getInterpolated(other.Color, d),
TCoords.getInterpolated(other.TCoords, d),
TCoords2.getInterpolated(other.TCoords2, d));
}
}; };
...@@ -219,6 +238,17 @@ struct S3DVertexTangents : public S3DVertex ...@@ -219,6 +238,17 @@ struct S3DVertexTangents : public S3DVertex
{ {
return EVT_TANGENTS; return EVT_TANGENTS;
} }
S3DVertexTangents getInterpolated(const S3DVertexTangents& other, f32 d)
{
d = core::clamp(d, 0.0f, 1.0f);
return S3DVertexTangents(Pos.getInterpolated(other.Pos, d),
Normal.getInterpolated(other.Normal, d),
Color.getInterpolated(other.Color, d),
TCoords.getInterpolated(other.TCoords, d),
Tangent.getInterpolated(other.Tangent, d),
Binormal.getInterpolated(other.Binormal, d));
}
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment