Text archives Help
- From: cgribble@sci.utah.edu
- To: manta@sci.utah.edu
- Subject: [MANTA] r1560 - trunk/DynLT
- Date: Thu, 26 Jul 2007 11:31:40 -0600 (MDT)
Author: cgribble
Date: Thu Jul 26 11:31:39 2007
New Revision: 1560
Modified:
trunk/DynLT/DynLTCGT.cc
Log:
Tweaking DynLTCGT intersect routine
Modified: trunk/DynLT/DynLTCGT.cc
==============================================================================
--- trunk/DynLT/DynLTCGT.cc (original)
+++ trunk/DynLT/DynLTCGT.cc Thu Jul 26 11:31:39 2007
@@ -1,53 +1,43 @@
+
#include <DynLT/DynLTCGT.h>
#include <Model/Readers/ParticleNRRD.h>
-
namespace Manta
{
DynLTCGT::DynLTCGT(ParticleNRRD& pnrrd, DynLTQueue* queue, float* spheres,
- int nspheres, int nvars, int ncells, int depth,
- Real radius, int ridx, RegularColorMap* cmap, int cidx, int
textureMode)
- : DynLTGridSpheres(queue, spheres, nspheres, nvars, ncells, depth,
radius, ridx, cmap, cidx,textureMode)
-{
- //ParticleNRRD pnrrd(nrrdFile);
- grid = new ParticleGrid(pnrrd, radius, -1, cidx, this, this);
-}
-
-void DynLTCGT::intersect(const RenderContext& context,
- RayPacket& packet) const
+ int nspheres, int nvars, int ncells, int depth, Real
radius,
+ int ridx, RegularColorMap* cmap, int cidx, int
textureMode)
+ : DynLTGridSpheres(queue, spheres, nspheres, nvars, ncells, depth, radius,
+ ridx, cmap, cidx,textureMode)
{
- bool common_origin = true;
- if (packet.getDepth() > 0)
- common_origin = false;
- if (packet.end() - packet.begin() < 2)
- common_origin = true;
- else
- {
- for (int i = packet.begin() + 1; i < packet.end(); i++)
- common_origin &= ((packet.getOrigin(i-1) -
packet.getOrigin(i))).length() < 0.0001;
- }
- //test for common origin
- if (common_origin)
- {
- grid->intersect(context, packet);
- }
- else
- // if not common origin, use gridspheres intersection
- DynLTGridSpheres::intersect(context, packet);
- //computeNormal(context, packet);
- //computeTexCoords2(context, packet);
-}
-
-void DynLTCGT::preprocess(const PreprocessContext& context)
-{
- static bool once = false;
- if (once)
- return;
- once = true;
- DynLTGridSpheres::preprocess(context);
- grid->preprocess(context);
-
+ grid = new ParticleGrid(pnrrd, radius, -1, cidx, this, this);
}
+ void DynLTCGT::intersect(const RenderContext& context,
+ RayPacket& packet) const
+ {
+ if (packet.getDepth() > 0 &&
+ packet.end() - packet.begin() > 1) {
+ // Packet of secondary (or deeper) rays, use GridSpheres
+ DynLTGridSpheres::intersect(context, packet);
+ return;
+ }
+
+ // Packet of primary rays or a packet of size 1, use ParticleCGT
+ grid->intersect(context, packet);
+
+ //computeNormal(context, packet);
+ //computeTexCoords2(context, packet);
+ }
+
+ void DynLTCGT::preprocess(const PreprocessContext& context)
+ {
+ static bool once = false;
+ if (once)
+ return;
+ once = true;
+ DynLTGridSpheres::preprocess(context);
+ grid->preprocess(context);
+ }
}
- [MANTA] r1560 - trunk/DynLT, cgribble, 07/26/2007
Archive powered by MHonArc 2.6.16.