Manta Interactive Ray Tracer Development Mailing List

Text archives Help


[Manta] r1898 - in trunk: Core/Util Model/Groups Model/Primitives


Chronological Thread 
  • From: arobison@sci.utah.edu
  • To: manta@sci.utah.edu
  • Subject: [Manta] r1898 - in trunk: Core/Util Model/Groups Model/Primitives
  • Date: Mon, 3 Dec 2007 15:56:35 -0700 (MST)

Author: arobison
Date: Mon Dec  3 15:56:29 2007
New Revision: 1898

Modified:
   trunk/Core/Util/Preprocessor.h
   trunk/Model/Groups/Group.cc
   trunk/Model/Groups/Mesh.cc
   trunk/Model/Primitives/GridSpheres.cc
   trunk/Model/Primitives/Heightfield.cc
   trunk/Model/Primitives/IsosurfaceOctreeVolume.cc
   trunk/Model/Primitives/OctreeVolume.h
Log:
Adding a new MANTA_STACK_ALLOC macro for cross-platform dynamic stack array 
allocation.

Manta_Model now builds on WIN32

Modified: trunk/Core/Util/Preprocessor.h
==============================================================================
--- trunk/Core/Util/Preprocessor.h      (original)
+++ trunk/Core/Util/Preprocessor.h      Mon Dec  3 15:56:29 2007
@@ -26,4 +26,8 @@
 #define MANTA_FORCEINLINE __attribute__ ((always_inline))
 #endif
 
-#endif // MANTA_CORE_UTIL_MANTA_PREPROCESSOR_H_
+// Stack allocation equivalent to type[size]
+#define MANTA_STACK_ALLOC(type, size) ((type*)alloca((size) * sizeof(type)))
+
+
+#endif // MANTA_CORE_UTIL_MANTA_PREPROCESSOR_H_
\ No newline at end of file

Modified: trunk/Model/Groups/Group.cc
==============================================================================
--- trunk/Model/Groups/Group.cc (original)
+++ trunk/Model/Groups/Group.cc Mon Dec  3 15:56:29 2007
@@ -74,7 +74,7 @@
   InterpErr worstError = success;
   vector<keyframe_t> keyframes(group_keyframes);
   
-  Group* groups[group_keyframes.size()];
+  Group** groups = MANTA_STACK_ALLOC(Group*, group_keyframes.size());
   for(size_t frame=0; frame < keyframes.size(); ++frame) {
     Group *group = dynamic_cast<Group*>(group_keyframes[frame].keyframe);
     if (group == NULL)

Modified: trunk/Model/Groups/Mesh.cc
==============================================================================
--- trunk/Model/Groups/Mesh.cc  (original)
+++ trunk/Model/Groups/Mesh.cc  Mon Dec  3 15:56:29 2007
@@ -50,7 +50,7 @@
 {
   InterpErr worstError = success;
 
-  Mesh *meshes[keyframes.size()];
+  Mesh **meshes = MANTA_STACK_ALLOC(Mesh*, keyframes.size());
   for (unsigned int frame=0; frame < keyframes.size(); ++frame) {
     Mesh *mesh = dynamic_cast<Mesh*>(keyframes[frame].keyframe);
     if (mesh == NULL)

Modified: trunk/Model/Primitives/GridSpheres.cc
==============================================================================
--- trunk/Model/Primitives/GridSpheres.cc       (original)
+++ trunk/Model/Primitives/GridSpheres.cc       Mon Dec  3 15:56:29 2007
@@ -143,7 +143,7 @@
 
   // Allocate and initialize counts
   counts=new int[2*totalsize];
-  bzero(counts, 2*totalsize*sizeof(int));
+  memset(counts, 0, 2*totalsize*sizeof(int));
 
   cerr<<"    0/6:  Allocation took "<<timer.time()<<" seconds\n";
 

Modified: trunk/Model/Primitives/Heightfield.cc
==============================================================================
--- trunk/Model/Primitives/Heightfield.cc       (original)
+++ trunk/Model/Primitives/Heightfield.cc       Mon Dec  3 15:56:29 2007
@@ -5,6 +5,7 @@
 #include <Core/Geometry/BBox.h>
 #include <Core/Geometry/Vector.h>
 #include <Core/Util/Assert.h>
+#include <Core/Util/Preprocessor.h>
 
 #include <limits>
 #include <fstream>
@@ -99,7 +100,7 @@
   //TODO: Parallelize this
   ASSERT(!keyframes.empty());
 
-  Heightfield *heightfields[keyframes.size()];
+  Heightfield **heightfields = MANTA_STACK_ALLOC(Heightfield*, 
keyframes.size());
 
   for (unsigned int frame=0; frame < keyframes.size(); ++frame) {
     Heightfield *h = dynamic_cast<Heightfield*>(keyframes[frame].keyframe);

Modified: trunk/Model/Primitives/IsosurfaceOctreeVolume.cc
==============================================================================
--- trunk/Model/Primitives/IsosurfaceOctreeVolume.cc    (original)
+++ trunk/Model/Primitives/IsosurfaceOctreeVolume.cc    Mon Dec  3 15:56:29 
2007
@@ -186,9 +186,9 @@
 
     //tenter_padded = MAX(0.f, tenter_padded);
 
-    unsigned int index_trace[octdata->get_max_depth()+1];
+    unsigned int* index_trace = MANTA_STACK_ALLOC(unsigned int, 
octdata->get_max_depth()+1);
 
-        int stop_depth = octdata->get_cap_depth() - 0;
+    int stop_depth = octdata->get_cap_depth() - 0;
 
     Vec3i cell(0,0,0);
     single_traverse_node(rays, which_one, orig, dir, inv_dir, stop_depth,

Modified: trunk/Model/Primitives/OctreeVolume.h
==============================================================================
--- trunk/Model/Primitives/OctreeVolume.h       (original)
+++ trunk/Model/Primitives/OctreeVolume.h       Mon Dec  3 15:56:29 2007
@@ -20,7 +20,6 @@
 && y < data.dim2() && z > 0 && z < data.dim3()) ? data(x,y,z) : 0 \
 \
 
-typedef unsigned char ST;
 
 //AARONBAD - this is already defined in Abe's evil.h. 
 //   But it's not that evil, really...




  • [Manta] r1898 - in trunk: Core/Util Model/Groups Model/Primitives, arobison, 12/03/2007

Archive powered by MHonArc 2.6.16.

Top of page