00001 /*---------------------------------------------------------------------------*\ 00002 * OpenSG * 00003 * * 00004 * * 00005 * Copyright (C) 2000-2002 by the OpenSG Forum * 00006 * * 00007 * www.opensg.org * 00008 * * 00009 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de * 00010 * * 00011 \*---------------------------------------------------------------------------*/ 00012 /*---------------------------------------------------------------------------*\ 00013 * License * 00014 * * 00015 * This library is free software; you can redistribute it and/or modify it * 00016 * under the terms of the GNU Library General Public License as published * 00017 * by the Free Software Foundation, version 2. * 00018 * * 00019 * This library is distributed in the hope that it will be useful, but * 00020 * WITHOUT ANY WARRANTY; without even the implied warranty of * 00021 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00022 * Library General Public License for more details. * 00023 * * 00024 * You should have received a copy of the GNU Library General Public * 00025 * License along with this library; if not, write to the Free Software * 00026 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * 00027 * * 00028 \*---------------------------------------------------------------------------*/ 00029 /*---------------------------------------------------------------------------*\ 00030 * Changes * 00031 * * 00032 * * 00033 * * 00034 * * 00035 * * 00036 * * 00037 \*---------------------------------------------------------------------------*/ 00038 00039 //--------------------------------------------------------------------------- 00040 // Includes 00041 //--------------------------------------------------------------------------- 00042 00043 #include <stdlib.h> 00044 #include <stdio.h> 00045 00046 #include <OSGConfig.h> 00047 #include <OSGMatrixUtility.h> 00048 00049 #include "OSGOrthographicCamera.h" 00050 00051 OSG_USING_NAMESPACE 00052 00053 /***************************************************************************\ 00054 * Description * 00055 \***************************************************************************/ 00056 00061 /***************************************************************************\ 00062 * Class variables * 00063 \***************************************************************************/ 00064 00065 /***************************************************************************\ 00066 * Class methods * 00067 \***************************************************************************/ 00068 00069 void OrthographicCamera::initMethod (void) 00070 { 00071 } 00072 00073 00074 /***************************************************************************\ 00075 * Instance methods * 00076 \***************************************************************************/ 00077 00078 /*-------------------------------------------------------------------------*\ 00079 - private - 00080 \*-------------------------------------------------------------------------*/ 00081 00082 /*----------------------- constructors & destructors ----------------------*/ 00083 00084 OrthographicCamera::OrthographicCamera(void) : 00085 Inherited() 00086 { 00087 } 00088 00089 OrthographicCamera::OrthographicCamera(const OrthographicCamera &source) : 00090 Inherited(source) 00091 { 00092 } 00093 00094 OrthographicCamera::~OrthographicCamera(void) 00095 { 00096 } 00097 00098 /*----------------------------- class specific ----------------------------*/ 00099 00100 void OrthographicCamera::changed(BitVector whichField, UInt32 origin) 00101 { 00102 Inherited::changed(whichField, origin); 00103 } 00104 00105 /*-------------------------- your_category---------------------------------*/ 00106 00107 void OrthographicCamera::draw( DrawAction *OSG_CHECK_ARG(action), 00108 const Viewport& OSG_CHECK_ARG(port )) 00109 { 00110 } 00111 00112 void OrthographicCamera::getProjection(Matrix& result, 00113 UInt32 width, UInt32 height) 00114 { 00115 Real32 vs = getVerticalSize(); 00116 00117 // catch some illegal cases 00118 if(vs < 0 || width == 0 || height == 0) 00119 { 00120 result.setIdentity(); 00121 return; 00122 } 00123 00124 Real32 a = width /(Real32) height * getAspect(); 00125 00126 MatrixOrthogonal(result, -vs / 2 * a, vs / 2 * a, 00127 -vs / 2, vs / 2, 00128 getNear(), getFar()); 00129 } 00130 00131 00132 void OrthographicCamera::dump( UInt32 , 00133 const BitVector ) const 00134 { 00135 SLOG << "Dump OrthographicCamera NI" << std::endl; 00136 } 00137 00138 00139 /*------------------------------------------------------------------------*/ 00140 /* cvs id's */ 00141 00142 #ifdef OSG_SGI_CC 00143 #pragma set woff 1174 00144 #endif 00145 00146 #ifdef OSG_LINUX_ICC 00147 #pragma warning( disable : 177 ) 00148 #endif 00149 00150 namespace 00151 { 00152 static Char8 cvsid_cpp [] = "@(#)$Id: OSGOrthographicCamera.cpp,v 1.1 2005/09/26 00:08:18 dirk Exp $"; 00153 static Char8 cvsid_hpp [] = OSGORTHOGRAPHICCAMERABASE_HEADER_CVSID; 00154 static Char8 cvsid_inl [] = OSGORTHOGRAPHICCAMERABASE_INLINE_CVSID; 00155 00156 static Char8 cvsid_fields_hpp[] = OSGORTHOGRAPHICCAMERAFIELDS_HEADER_CVSID; 00157 } 00158 00159 #ifdef __sgi 00160 #pragma reset woff 1174 00161 #endif 00162
1.5.5