arbeit
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

AnalyticVolRen.cpp

Go to the documentation of this file.
00001 //------------------------------------------------------------------------
00002 //
00003 //   Joe Kniss
00004 //     3-21-03
00005 //                   ________    ____   ___ 
00006 //                  |        \  /    | /  /
00007 //                  +---+     \/     |/  /
00008 //                  +--+|  |\    /|     < 
00009 //                  |  ||  | \  / |  |\  \ 
00010 //                  |      |  \/  |  | \  \ 
00011 //                   \_____|      |__|  \__\
00012 //                       Copyright  2003 
00013 //                      Joe Michael Kniss
00014 //                   <<< jmk@cs.utah.edu >>>
00015 //               "All Your Base are Belong to Us"
00016 //-------------------------------------------------------------------------
00017 
00018 //AnalyticVolRen.cpp
00019 
00020 
00021 #include "AnalyticVolRen.h"
00022 #include <mathGutz.h>
00023 
00024 #include <iostream>
00025 
00026 using namespace gutz;
00027 using namespace std;
00028 
00029 ///////////////////////////////////////////////////////////////////////////
00030 /// Construct / destruct
00031 ///////////////////////////////////////////////////////////////////////////
00032 
00033 AnalyticVolRen::AnalyticVolRen()
00034 {
00035 
00036 }
00037 
00038 
00039 AnalyticVolRen::~AnalyticVolRen()
00040 {
00041 
00042 }
00043 
00044 ///////////////////////////////////////////////////////////////////////////
00045 /// Post Slice
00046 ///////////////////////////////////////////////////////////////////////////
00047 void AnalyticVolRen::postSlice(const gutz::RenderEvent &re)
00048 {
00049    VolSamples *vs = _vsv[_vsBuff];
00050 
00051    mat4f xform = 
00052       re.getCamera()->getViewMatrix() * re.getManip()->getMatrix() * _vt->getMatrix();
00053    
00054    xform = xform.inv();
00055 
00056    vec4f eye(0,0,0,1);
00057    eye = xform * eye;
00058 
00059    vec3f sliceDir =  -xform * _sliceDir;
00060    sliceDir.normalize();
00061 
00062    arrayw1v4f  tc0 = vs->getTCoordAttrib(0)->getArray();
00063    arrayw1v4f  tc1 = vs->getTCoordAttrib(1)->getArray();
00064    arrayw1v3f  verts = vs->getVertAttrib()->getArray();
00065 
00066    for(unsigned int i=0; i<vs->getVertAttrib()->getSize(); ++i)
00067    {
00068       vec3f dir = verts[i] - eye;
00069       dir.normalize();
00070       float ssp = _currentSlicer->getSampleSpace()/(dir.dot(sliceDir))*.999f;
00071       tc1[i] = tc0[i] + (dir * ssp);
00072    }
00073 
00074    vs->getTCoordAttrib()->setActive(true);
00075 }

Send questions, comments, and bug reports to:
jmk