]> git.lizzy.rs Git - irrlicht.git/commitdiff
S3DVertex initialize color always. It's derived classes now both accept const S3DVert...
authorcutealien <cutealien@dfc29bdd-3216-0410-991c-e03cc46cb475>
Mon, 25 Apr 2022 14:24:43 +0000 (14:24 +0000)
committersfan5 <sfan5@live.de>
Fri, 24 Mar 2023 16:09:11 +0000 (17:09 +0100)
color intitialization has some cost, but we initialized all other values already (vectors are always set to 0).
Don't think it's a good idea to have one value around which is random.
S3DVertex2TCoords(S3DVertex& o) to S3DVertex2TCoords(const S3DVertex& o) simply because it makes more sense
S3DVertexTangents(const S3DVertex& o) added because I'll need it later (and no idea why only S3DVertex2TCoords got one of those before).

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6359 dfc29bdd-3216-0410-991c-e03cc46cb475

include/S3DVertex.h

index 2040f9d1d985cc280401829fe2b94106dd8671ec..3d78e2037f934f92b8b95ec125be7183833c8545 100644 (file)
@@ -44,7 +44,7 @@ const char* const sBuiltInVertexTypeNames[] =
 struct S3DVertex\r
 {\r
        //! default constructor\r
-       S3DVertex() {}\r
+       S3DVertex() : Color(0xffffffff) {}\r
 \r
        //! constructor\r
        S3DVertex(f32 x, f32 y, f32 z, f32 nx, f32 ny, f32 nz, SColor c, f32 tu, f32 tv)\r
@@ -142,7 +142,7 @@ struct S3DVertex2TCoords : public S3DVertex
                : S3DVertex(pos, normal, color, tcoords), TCoords2(tcoords) {}\r
 \r
        //! constructor from S3DVertex\r
-       S3DVertex2TCoords(S3DVertex& o) : S3DVertex(o) {}\r
+       S3DVertex2TCoords(const S3DVertex& o) : S3DVertex(o) {}\r
 \r
        //! Second set of texture coordinates\r
        core::vector2d<f32> TCoords2;\r
@@ -214,6 +214,9 @@ struct S3DVertexTangents : public S3DVertex
                const core::vector3df& binormal=core::vector3df())\r
                : S3DVertex(pos, normal, c, tcoords), Tangent(tangent), Binormal(binormal) { }\r
 \r
+       //! constructor from S3DVertex\r
+       S3DVertexTangents(const S3DVertex& o) : S3DVertex(o) {}\r
+\r
        //! Tangent vector along the x-axis of the texture\r
        core::vector3df Tangent;\r
 \r