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
00044 #include <stdlib.h>
00045 #include <stdio.h>
00046
00047 #include <OSGConfig.h>
00048
00049 #include "OSGNodePtr.h"
00050 #include "OSGTileCameraDecorator.h"
00051
00052 OSG_USING_NAMESPACE
00053
00054
00055
00056
00057
00058
00071
00072
00073
00074
00075 void TileCameraDecorator::initMethod (void)
00076 {
00077 }
00078
00079
00080
00081
00082
00083
00084
00085 TileCameraDecorator::TileCameraDecorator(void) :
00086 Inherited()
00087 {
00088 }
00089
00090 TileCameraDecorator::TileCameraDecorator(const TileCameraDecorator &source) :
00091 Inherited(source)
00092 {
00093 }
00094
00095 TileCameraDecorator::~TileCameraDecorator(void)
00096 {
00097 }
00098
00099 void TileCameraDecorator::changed(BitVector whichField, UInt32 origin)
00100 {
00101 Inherited::changed(whichField, origin);
00102 }
00103
00108 void TileCameraDecorator::setSize( Real32 left, Real32 bottom, Real32 right,
00109 Real32 top )
00110 {
00111 _sfLeft.setValue( left );
00112 _sfRight.setValue( right );
00113 _sfBottom.setValue( bottom );
00114 _sfTop.setValue( top );
00115 }
00116
00117 void TileCameraDecorator::getProjection( Matrix &result,
00118 UInt32 width, UInt32 height)
00119 {
00120 if(width == 0 || height == 0)
00121 {
00122 result.setIdentity();
00123 return;
00124 }
00125
00126 if(getFullWidth() != 0)
00127 width = getFullWidth();
00128
00129 if(getFullHeight() != 0)
00130 height = getFullHeight();
00131
00132 getDecoratee()->getProjection(result, width, height);
00133
00134 Real32 left = getLeft(),
00135 right = getRight(),
00136 top = getTop(),
00137 bottom = getBottom();
00138
00139 if(left < 0)
00140 left = -left / width;
00141
00142 if(right < 0)
00143 right = -right / width;
00144
00145 if(top < 0)
00146 top = -top / height;
00147
00148 if(bottom < 0)
00149 bottom = -bottom / height;
00150
00151
00152 Real32 xs = 1.f / (right - left),
00153 ys = 1.f / (top - bottom);
00154 Matrix sm( xs, 0, 0, -(left*2-1)*xs-1,
00155 0, ys, 0, -(bottom*2-1)*ys-1,
00156 0, 0, 1, 0,
00157 0, 0, 0, 1);
00158
00159 result.multLeft(sm);
00160 }
00161
00162
00163
00164 void TileCameraDecorator::dump( UInt32 OSG_CHECK_ARG(uiIndent),
00165 const BitVector OSG_CHECK_ARG(bvFlags )) const
00166 {
00167 SLOG << "Dump TileCameraDecorator NI" << std::endl;
00168 }
00169
00170
00171
00172
00173 #ifdef __sgi
00174 #pragma set woff 1174
00175 #endif
00176
00177 #ifdef OSG_LINUX_ICC
00178 #pragma warning( disable : 177 )
00179 #endif
00180
00181 namespace
00182 {
00183 static char cvsid_cpp[] = "@(#)$Id: $";
00184 static char cvsid_hpp[] = OSGTILECAMERADECORATOR_HEADER_CVSID;
00185 static char cvsid_inl[] = OSGTILECAMERADECORATOR_INLINE_CVSID;
00186 }