Text archives Help
- From: "Solomon Boulos" <boulos@cs.utah.edu>
- To: manta@sci.utah.edu
- Subject: [Manta] r2030 - in trunk: Core Core/Geometry Model/Groups
- Date: Tue, 5 Feb 2008 13:58:25 -0700 (MST)
Author: boulos
Date: Tue Feb 5 13:58:23 2008
New Revision: 2030
Added:
trunk/Core/Geometry/BBox.cc
Modified:
trunk/Core/CMakeLists.txt
trunk/Core/Geometry/BBox.h
trunk/Model/Groups/DynBVH.cc
trunk/Model/Groups/DynBVH.h
Log:
Core/CMakeLists.txt
Core/Geometry/BBox.cc
Core/Geometry/BBox.h
Adding ostream support for BBox.
Model/Groups/DynBVH.cc
Model/Groups/DynBVH.h
Making IAData public (so other people can create them too)
Making firstIntersects and lastIntersects static so they can be used
elsewhere.
Modified: trunk/Core/CMakeLists.txt
==============================================================================
--- trunk/Core/CMakeLists.txt (original)
+++ trunk/Core/CMakeLists.txt Tue Feb 5 13:58:23 2008
@@ -54,6 +54,7 @@
Geometry/AffineTransformT.h
Geometry/AffineTransformT.cc
Geometry/BBox.h
+ Geometry/BBox.cc
Geometry/Ray.h
Geometry/ScalarTransform1D.h
Geometry/Vector.cc
Added: trunk/Core/Geometry/BBox.cc
==============================================================================
--- (empty file)
+++ trunk/Core/Geometry/BBox.cc Tue Feb 5 13:58:23 2008
@@ -0,0 +1,10 @@
+#include <iostream>
+#include <Core/Geometry/BBox.h>
+using namespace Manta;
+
+namespace Manta {
+ std::ostream& operator<< (std::ostream& os, const BBox& bounds) {
+ os << bounds.getMin() << " " << bounds.getMax();
+ return os;
+ }
+}
Modified: trunk/Core/Geometry/BBox.h
==============================================================================
--- trunk/Core/Geometry/BBox.h (original)
+++ trunk/Core/Geometry/BBox.h Tue Feb 5 13:58:23 2008
@@ -5,6 +5,7 @@
#include <Core/Geometry/Vector.h>
#include <Core/Math/Expon.h>
#include <limits>
+#include <iosfwd>
namespace Manta {
class BBox {
@@ -128,9 +129,13 @@
inline Vector &operator[] (int i) { return bounds[i]; }
inline const Vector &operator[] (int i) const { return bounds[i]; }
#endif
+
private:
Vector bounds[2];
};
+
+ // Outside the class but in Manta namespace
+ std::ostream& operator<< (std::ostream& os, const BBox& v);
}
#endif
Modified: trunk/Model/Groups/DynBVH.cc
==============================================================================
--- trunk/Model/Groups/DynBVH.cc (original)
+++ trunk/Model/Groups/DynBVH.cc Tue Feb 5 13:58:23 2008
@@ -1,25 +1,26 @@
-#include <Model/Groups/DynBVH.h>
+#include <Core/Exceptions/InternalError.h>
+#include <Core/Thread/Time.h>
#include <Core/Util/Preprocessor.h>
#include <Core/Util/UpdateGraph.h>
#include <DynBVH_Parameters.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <float.h>
-#include <limits>
-#include <iostream>
-#include <algorithm>
-#include <Core/Thread/Time.h>
#include <Interface/Context.h>
#include <Interface/Task.h>
+#include <Model/Groups/DynBVH.h>
+#include <algorithm>
+#include <float.h>
+#include <iostream>
+#include <limits>
+#include <stdio.h>
+#include <stdlib.h>
using namespace Manta;
using std::cerr;
+
+#define TEST_MASKS 0
// these constants control the SAH cost model
const float BVH_C_isec = 10.f;
const float BVH_C_trav = 10.f;
-#define TEST_MASKS 0
-
void DynBVH::intersect(const RenderContext& context, RayPacket& rays) const
{
bool debugFlag = rays.getFlag(RayPacket::DebugPacket);
@@ -118,7 +119,7 @@
}
// return the first index (between [rays.begin(),rays.end()]) which hits the
box
-int DynBVH::firstIntersects(const BBox& box, const RayPacket& rays, const
IAData& ia_data, float* out_tmin) const
+int DynBVH::firstIntersects(const BBox& box, const RayPacket& rays, const
IAData& ia_data, float* out_tmin)
{
#ifdef MANTA_SSE
int b = (rays.rayBegin + 3) & (~3);
@@ -395,7 +396,7 @@
}
// return the last index which hits the box
-int DynBVH::lastIntersects(const BBox& box, const RayPacket& rays) const
+int DynBVH::lastIntersects(const BBox& box, const RayPacket& rays)
{
#ifdef MANTA_SSE
int last_simd = rays.rayEnd & (~3);
Modified: trunk/Model/Groups/DynBVH.h
==============================================================================
--- trunk/Model/Groups/DynBVH.h (original)
+++ trunk/Model/Groups/DynBVH.h Tue Feb 5 13:58:23 2008
@@ -14,7 +14,7 @@
class DynBVH : public AccelerationStructure
{
- protected:
+ public:
struct IAData
{
Real min_rcp[3];
@@ -24,7 +24,7 @@
Real min_org_rcp[3];
Real max_org_rcp[3];
};
-
+ protected:
struct BVHNode
{
BBox bounds;
@@ -97,14 +97,14 @@
void preprocess(const PreprocessContext&);
void intersect(const RenderContext& context, RayPacket& rays) const;
- protected:
- void intersectNode(int nodeID, const RenderContext& context, RayPacket&
rays, const IAData& ia_data) const;
-
// return the first index (between [rays.begin(),rays.end()]) which hits
the box
- int firstIntersects(const BBox& box, const RayPacket& rays, const
IAData& ia_data, float* out_tmin) const;
+ static int firstIntersects(const BBox& box, const RayPacket& rays, const
IAData& ia_data, float* out_tmin);
// return the last index which hits the box
- int lastIntersects(const BBox& box, const RayPacket& rays) const;
+ static int lastIntersects(const BBox& box, const RayPacket& rays);
+
+ protected:
+ void intersectNode(int nodeID, const RenderContext& context, RayPacket&
rays, const IAData& ia_data) const;
public:
void computeBounds(const PreprocessContext&,
- [Manta] r2030 - in trunk: Core Core/Geometry Model/Groups, Solomon Boulos, 02/05/2008
Archive powered by MHonArc 2.6.16.