X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=simgear%2Fscene%2Ftgdb%2FSGTexturedTriangleBin.hxx;h=bbeb6244c518e207fe19b616f0004693b1c90cf1;hb=7e7ce2f38e87d6244e05730fa4382da088bb25f1;hp=bec819780809a78a6a034b5fc5d4c1541ed77332;hpb=605125c0e7589ab027561227dcc2bb8e0a51f1ab;p=simgear.git diff --git a/simgear/scene/tgdb/SGTexturedTriangleBin.hxx b/simgear/scene/tgdb/SGTexturedTriangleBin.hxx index bec81978..bbeb6244 100644 --- a/simgear/scene/tgdb/SGTexturedTriangleBin.hxx +++ b/simgear/scene/tgdb/SGTexturedTriangleBin.hxx @@ -98,8 +98,7 @@ class SGTexturedTriangleBin : public SGTriangleBin { public: SGTexturedTriangleBin() { - seed = new mt; - mt_init(seed, 123); + mt_init(&seed, 123); } // Computes and adds random surface points to the points list. @@ -107,7 +106,7 @@ public: // The points are offsetted away from the triangles in // offset * positive normal direction. void addRandomSurfacePoints(float coverage, float offset, - std::vector& points) const + std::vector& points) { unsigned num = getNumTriangles(); for (unsigned i = 0; i < num; ++i) { @@ -125,13 +124,13 @@ public: // For partial units of area, use a zombie door method to // create the proper random chance of a light being created // for this triangle - float unit = area + mt_rand(seed)*coverage; + float unit = area + mt_rand(&seed)*coverage; SGVec3f offsetVector = offset*normalize(normal); // generate a light point for each unit of area while ( coverage < unit ) { - float a = mt_rand(seed); - float b = mt_rand(seed); + float a = mt_rand(&seed); + float b = mt_rand(&seed); if ( a + b > 1 ) { a = 1 - a; b = 1 - b; @@ -145,7 +144,7 @@ public: } void addRandomPoints(float coverage, - std::vector& points) const + std::vector& points) { unsigned num = getNumTriangles(); for (unsigned i = 0; i < num; ++i) { @@ -163,12 +162,12 @@ public: // for partial units of area, use a zombie door method to // create the proper random chance of an object being created // for this triangle. - double num = area / coverage + mt_rand(seed); + double num = area / coverage + mt_rand(&seed); // place an object each unit of area while ( num > 1.0 ) { - float a = mt_rand(seed); - float b = mt_rand(seed); + float a = mt_rand(&seed); + float b = mt_rand(&seed); if ( a + b > 1 ) { a = 1 - a; b = 1 - b; @@ -243,7 +242,7 @@ public: private: // Random seed for the triangle. - mt* seed; + mt seed; }; #endif