]> git.mxchange.org Git - simgear.git/commitdiff
Make gen_surface_points accessible through the API.
authorcurt <curt>
Wed, 28 May 2003 19:02:43 +0000 (19:02 +0000)
committercurt <curt>
Wed, 28 May 2003 19:02:43 +0000 (19:02 +0000)
simgear/scene/tgdb/leaf.cxx
simgear/scene/tgdb/leaf.hxx

index 0700ae2098e5b0109c6956ce29b133ba93856538..e5cdd14a2ac5acf54ae7cd22343961edb52aa6a5 100644 (file)
@@ -66,8 +66,9 @@ static void random_pt_inside_tri( float *res,
 }
 
 
-static void gen_random_surface_points( ssgLeaf *leaf, ssgVertexArray *lights,
-                                       double factor ) {
+void sgGenRandomSurfacePoints( ssgLeaf *leaf, double factor, 
+                               ssgVertexArray *lights )
+{
     int tris = leaf->getNumTriangles();
     if ( tris > 0 ) {
         short int n1, n2, n3;
@@ -108,6 +109,13 @@ static void gen_random_surface_points( ssgLeaf *leaf, ssgVertexArray *lights,
 }
 
 
+ssgVertexArray *sgGenRandomSurfacePoints( ssgLeaf *leaf, double factor ) {
+    ssgVertexArray *result = new ssgVertexArray();
+    sgGenRandomSurfacePoints( leaf, factor, result );
+
+    return result;
+}
+
 
 ////////////////////////////////////////////////////////////////////////
 // Scenery loaders.
@@ -251,7 +259,7 @@ ssgLeaf *sgMakeLeaf( const string& path,
                        << coverage << ", pushing up to 10000");
                 coverage = 10000;
             }
-            gen_random_surface_points(leaf, lights, coverage);
+            sgGenRandomSurfacePoints(leaf, coverage, lights );
         }
     }
 
index 772489b5b2a4df6fe314ba27621534aeb91c803c..66fbdd1c369e6e69f10ba9eb5ab856e548965e2e 100644 (file)
@@ -56,4 +56,14 @@ ssgLeaf *sgMakeLeaf( const string& path,
                      const bool calc_lights, ssgVertexArray *lights );
 
 
+// return a newly created list of points randomly spread across the
+// specified leaf.  "factor" specifies density ... on average there
+// will be one object per the area specified by "factor" in m^2 A
+// larger factor will mean fewer objects.
+ssgVertexArray *sgGenRandomSurfacePoints( ssgLeaf *leaf, double factor );
+
+// Another varient of the same routine.
+void sgGenRandomSurfacePoints( ssgLeaf *leaf, double factor, 
+                               ssgVertexArray *lights );
+
 #endif // _SG_LEAF_HXX