Text archives Help
- From:
- To:
- Subject: [Manta] r2318 - trunk/Model/Materials
- Date: Wed, 20 Aug 2008 15:52:14 -0600 (MDT)
Author: brownlee
Date: Wed Aug 20 15:52:14 2008
New Revision: 2318
Modified:
trunk/Model/Materials/Volume.h
Log:
fixing volume renderer
Modified: trunk/Model/Materials/Volume.h
==============================================================================
--- trunk/Model/Materials/Volume.h (original)
+++ trunk/Model/Materials/Volume.h Wed Aug 20 15:52:14 2008
@@ -73,10 +73,6 @@
unsigned long long course_hash;
vector<ColorSlice> _slices;
int _numSlices;
- //float*** _opacities;
- //Color*** _colors;
- //ScalarTransform1D<float, Color> sTColors;
- //ScalarTransform1D<float, float> sTOpacities;
enum {
InvRainbowIso=0,
@@ -161,7 +157,6 @@
double t_max;
double t_inc_inv;
Ray ray;
- //RenderContext *cx;
};
public:
static void newFrame();
@@ -533,7 +528,6 @@
value = ly1 * (1 - x_weight_high) + ly2 * x_weight_high;
value = (value - _dataMin)*_colorScalar;
- //float alpha_factor = this->dpy->lookup_alpha(value) *
(1-isctx.alpha);
RGBAColor color = _colorMap->GetColor(value);
float alpha_factor = color.a*(1-isctx.alpha);
if (alpha_factor > 0.001) {
@@ -794,7 +788,9 @@
lRays1.computeHitPositions();
for(int i = rays.begin(); i < rays.end(); i++) {
//did we hit something, and if so, was it inside the volume.
- if (lRays1.wasHit(i) && _bounds.contains(lRays1.getHitPosition(i)))
+ if (lRays1.wasHit(i))// && _bounds.contains(lRays1.getHitPosition(i)))
//in the rare case where precision erros will
+ // incorrectly trace from the very edge of the volume to an incorrect
part of the scene, bound checks will not cause
+ // memory problems and there isn't an accurate way to check there.
tMaxs[i] = lRays1.getMinT(i) + tMins[i];
else {
//it's possible that we hit a corner of the volume on entry
@@ -869,19 +865,28 @@
double icx=_ixsize[_depth-1];
double x=_bounds.getMin().x()+_hierdiag.x()*double(ix+ddx)*icx;
- double xinv_dir=1./dir.x();
+ double xinv_dir;
+ if (dir.x()== 0)
+ xinv_dir = FLT_MAX;
+ xinv_dir=1./dir.x();
next_x=Abs((x-orig.x())*xinv_dir); //take Abs so we don't get -inf
dtdx=dix_dx*_hierdiag.x()*icx*xinv_dir; //this is +inf when dir.x == 0
double icy=_iysize[_depth-1];
double y=_bounds.getMin().y()+_hierdiag.y()*double(iy+ddy)*icy;
- double yinv_dir=1./dir.y();
+ double yinv_dir;
+ if (dir.y()== 0)
+ yinv_dir = FLT_MAX;
+ yinv_dir=1./dir.y();
next_y=Abs((y-orig.y())*yinv_dir);
dtdy=diy_dy*_hierdiag.y()*icy*yinv_dir;
double icz=_izsize[_depth-1];
double z=_bounds.getMin().z()+_hierdiag.z()*double(iz+ddz)*icz;
- double zinv_dir=1./dir.z();
+ double zinv_dir;
+ if (dir.z()== 0)
+ zinv_dir = FLT_MAX;
+ zinv_dir=1./dir.z();
next_z=Abs((z-orig.z())*zinv_dir);
dtdz=diz_dz*_hierdiag.z()*icz*zinv_dir;
@@ -975,7 +980,7 @@
totals[i] += bgColor*(1.-alphas[i]);
rays.setColor(i, totals[i]);
}
- }
+ }
}
template<class T>
- [Manta] r2318 - trunk/Model/Materials, brownlee, 08/20/2008
Archive powered by MHonArc 2.6.16.