00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043 #include <stdlib.h>
00044 #include <stdio.h>
00045 #include <math.h>
00046
00047 #include "OSGConfig.h"
00048
00049 #include <OSGBaseTypes.h>
00050 #include <OSGLog.h>
00051 #include <OSGVector.h>
00052 #include <OSGMatrix.h>
00053 #include <OSGMatrixUtility.h>
00054
00055 #include "OSGNodePtr.h"
00056 #include "OSGViewport.h"
00057 #include "OSGCamera.h"
00058 #include "OSGWindow.h"
00059 #include "OSGBackground.h"
00060 #include "OSGPerspectiveCamera.h"
00061
00062 OSG_USING_NAMESPACE
00063
00064
00065
00066
00067
00068
00078
00079
00080
00081
00082
00083
00084
00085
00086 void PerspectiveCamera::initMethod(void)
00087 {
00088 }
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101 PerspectiveCamera::PerspectiveCamera(void) :
00102 Inherited()
00103 {
00104 }
00105
00106 PerspectiveCamera::PerspectiveCamera(const PerspectiveCamera &source) :
00107 Inherited(source)
00108 {
00109 }
00110
00111 PerspectiveCamera::~PerspectiveCamera(void)
00112 {
00113 }
00114
00115 void PerspectiveCamera::changed(BitVector whichField, UInt32 origin)
00116 {
00117 Inherited::changed(whichField, origin);
00118 }
00119
00120
00121
00122 void PerspectiveCamera::draw( DrawAction *OSG_CHECK_ARG(action),
00123 const Viewport& OSG_CHECK_ARG(port ))
00124 {
00125 }
00126
00127 void PerspectiveCamera::getProjection(Matrix& result,
00128 UInt32 width, UInt32 height)
00129 {
00130 Real32 fov = getFov();
00131
00132
00133 if(fov < 0 || width == 0 || height == 0)
00134 {
00135 result.setIdentity();
00136 return;
00137 }
00138
00139
00140 if(fov > Pi)
00141 fov = osgdegree2rad(fov);
00142
00143 MatrixPerspective(result, fov / 2,
00144 width /(Real32) height * getAspect(),
00145 getNear(), getFar());
00146 }
00147
00148
00149
00150
00151 void PerspectiveCamera::dump( UInt32 OSG_CHECK_ARG(uiIndent),
00152 const BitVector OSG_CHECK_ARG(bvFlags)) const
00153 {
00154 SLOG << "Dump PerspectiveCamera NI" << std::endl;
00155 }
00156
00157
00158
00159
00160
00161
00162 #ifdef OSG_SGI_CC
00163 #pragma set woff 1174
00164 #endif
00165
00166 #ifdef OSG_LINUX_ICC
00167 #pragma warning(disable : 177)
00168 #endif
00169
00170 namespace
00171 {
00172 static Char8 cvsid_cpp [] = "@(#)$Id: FCTemplate_cpp.h,v 1.13 2002/06/01 10:37:25 vossg Exp $";
00173 static Char8 cvsid_hpp [] = OSGPERSPECTIVECAMERA_HEADER_CVSID;
00174 static Char8 cvsid_inl [] = OSGPERSPECTIVECAMERA_INLINE_CVSID;
00175
00176 static Char8 cvsid_fields_hpp[] = OSGPERSPECTIVECAMERAFIELDS_HEADER_CVSID;
00177 }
00178
00179 #ifdef __sgi
00180 #pragma reset woff 1174
00181 #endif
00182