root/juggler/branches/1.0/Kernel/vjProjection.h

Revision 8789, 3.7 kB (checked in by patrickh, 7 years ago)

Copyright update.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 /*************** <auto-copyright.pl BEGIN do not edit this line> **************
2  *
3  * VR Juggler is (C) Copyright 1998, 1999, 2000, 2001, 2002
4  *   by Iowa State University
5  *
6  * Original Authors:
7  *   Allen Bierbaum, Christopher Just,
8  *   Patrick Hartling, Kevin Meinert,
9  *   Carolina Cruz-Neira, Albert Baker
10  *
11  * This library is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU Library General Public
13  * License as published by the Free Software Foundation; either
14  * version 2 of the License, or (at your option) any later version.
15  *
16  * This library is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19  * Library General Public License for more details.
20  *
21  * You should have received a copy of the GNU Library General Public
22  * License along with this library; if not, write to the
23  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
24  * Boston, MA 02111-1307, USA.
25  *
26  * -----------------------------------------------------------------
27  * File:          $RCSfile$
28  * Date modified: $Date$
29  * Version:       $Revision$
30  * -----------------------------------------------------------------
31  *
32  *************** <auto-copyright.pl END do not edit this line> ***************/
33
34
35 #ifndef _VJ_PROJECTION_
36 #define _VJ_PROJECTION_
37
38 #include <vjConfig.h>
39 #include <Math/vjMatrix.h>
40 #include <Kernel/vjFrustum.h>
41 #include <Kernel/vjDebug.h>
42 #include <Math/vjVec3.h>
43 #include <Input/vjPosition/vjPosition.h>
44
45 //------------------------------------------------------------------
46 //: Pure virtual base class for viewport definitions.
47 //
48 // Responsible for storing and computing projection
49 //  information based upon an eye positions
50 // This class is an abstract base class for other classes
51 //  that actually compute the projections.
52 //
53 // @author Allen Bierbaum
54 //  Date: 9-8-97
55 //------------------------------------------------------------------
56 class vjProjection
57 {
58 public:
59    // Eye and type
60    enum ProjType
61    {NOT_SET = 0, LEFT = 1, RIGHT = 2, SURFACE, SIM};
62
63 public:
64    vjProjection()
65    {
66       mType = NOT_SET;
67       mEye = 0;
68       mFocusPlaneDist = 1.0f;
69    }
70
71    virtual void config(vjConfigChunk* chunk)
72    {;}
73
74    void setEye(int _eye)
75    { mEye = _eye; }
76
77    int getEye()
78    { return mEye;}
79
80    virtual void calcViewMatrix(vjMatrix& eyePos) = 0;
81
82    ProjType getType()
83    { return mType; }
84
85    //: Helper to the frustum apex and corners in model coordinates
86    //!NOTE: This function is meant for debugging purposes
87    //!POST: The given vars contain the values of the frustums
88    //+ corners in model space.
89    void getFrustumApexAndCorners(vjVec3& apex, vjVec3& ur, vjVec3& lr, vjVec3& ul, vjVec3& ll);
90
91    //: Virtual output oporators.
92    // Every class derived from us shoudl just define this, and
93    // the opertetor<< will "just work"
94    virtual std::ostream& outStream(std::ostream& out);
95
96    friend std::ostream& operator<<(std::ostream& out, vjProjection& proj);
97
98
99 public:
100    vjMatrix    mViewMat;
101    vjFrustum   mFrustum;
102
103 protected:
104    int mEye;
105    ProjType    mType;
106
107    float       mFocusPlaneDist;     // Basically the distance to the surface.  Needed for drawing.
108
109 protected:     // Statics
110    static float mNearDist;
111    static float mFarDist;    // Near far distances
112
113 public:
114    static void setNearFar(float near_val, float far_val)
115    {
116       vjDEBUG(vjDBG_ALL,vjDBG_STATE_LVL) << clrOutNORM(clrCYAN,"vjProjection::setNearFar:")
117                            << "near: " << near_val << " far:" << far_val
118                            << std::endl << vjDEBUG_FLUSH;
119       mNearDist = near_val;
120       mFarDist = far_val;
121    }
122 };
123
124
125
126 #endif
Note: See TracBrowser for help on using the browser.