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

VolRenLit.cpp

Go to the documentation of this file.
00001 //------------------------------------------------------------------------
00002 //
00003 //   Joe Kniss
00004 //     9-20-02
00005 //                   ________    ____   ___ 
00006 //                  |        \  /    | /  /
00007 //                  +---+     \/     |/  /
00008 //                  +--+|  |\    /|     < 
00009 //                  |  ||  | \  / |  |\  \ 
00010 //                  |      |  \/  |  | \  \ 
00011 //                   \_____|      |__|  \__\
00012 //                       Copyright  2002 
00013 //                      Joe Michael Kniss
00014 //                   <<< jmk@cs.utah.edu >>>
00015 //               "All Your Base are Belong to Us"
00016 //-------------------------------------------------------------------------
00017 
00018 //VolRenLit.h
00019 
00020 #include "VolRenLit.h"
00021 #include <volrenalg/VolRenAlgBase.h>
00022 #include <textureGlift.h>
00023 #include <iostream>
00024 
00025 
00026 #ifdef WIN32
00027 #include <windows.h>
00028 #endif
00029 
00030 #include <GL/gl.h>
00031 
00032 #include <iostream>
00033 
00034 using namespace std;
00035 using namespace gutz;
00036 using namespace glift;
00037 
00038 #define VRB_MAX_VERTS 9
00039 
00040 ///////////////////////////////////////////////////////////////////////////
00041 /// Construct
00042 ///////////////////////////////////////////////////////////////////////////
00043 VolRenLit::VolRenLit()
00044 {
00045 }
00046 
00047 VolRenLit::~VolRenLit()
00048 {
00049 }
00050 
00051 ///////////////////////////////////////////////////////////////////////////
00052 /// initialize
00053 ///////////////////////////////////////////////////////////////////////////
00054 void VolRenLit::init()
00055 {
00056    VolRenBase::init();
00057 }
00058 
00059 ///////////////////////////////////////////////////////////////////////////
00060 /// draw the volume
00061 ///////////////////////////////////////////////////////////////////////////
00062 void VolRenLit::drawDef(const gutz::RenderEvent &re)
00063 {       
00064 
00065    VolRenBase::draw(re);
00066 
00067 }
00068 
00069 ///////////////////////////////////////////////////////////////////////////
00070 /// generate slice axis
00071 ///////////////////////////////////////////////////////////////////////////
00072 vec3f VolRenLit::genSliceAxis(unsigned int light, vec3f volCtr)
00073 {
00074    if(light < _ltv.size())
00075    {
00076       Light *lt = _ltv[light];
00077 
00078       vec3f ltdir = (volCtr - lt->getEyePos());         
00079       ltdir.normalize();
00080 
00081       vec3f vdir = vec3f_neg_z;
00082 
00083       if(ltdir.dot(vdir) <= 0) //we need to flip the view direction
00084          vdir = vec3f_z;
00085 
00086       vec3f sliceDir((ltdir + vdir));
00087       sliceDir.normalize();
00088 
00089       cerr << "slice axis : " << sliceDir.x << " " << sliceDir.y << " " << sliceDir.z << endl;
00090 
00091       return sliceDir;
00092    }
00093    else
00094    {
00095       return vec3f_z;
00096    }
00097 
00098 }

Send questions, comments, and bug reports to:
jmk