OSGTileableBackground.cpp
Go to the documentation of this file.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 <cstdlib>
00044 #include <cstdio>
00045
00046 #include "OSGConfig.h"
00047
00048 #include "OSGTileableBackground.h"
00049 #include "OSGDrawEnv.h"
00050 #include "OSGRenderActionBase.h"
00051 #include "OSGTileCameraDecorator.h"
00052
00053 OSG_BEGIN_NAMESPACE
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068 void TileableBackground::initMethod(InitPhase ePhase)
00069 {
00070 Inherited::initMethod(ePhase);
00071
00072 if(ePhase == TypeObject::SystemPost)
00073 {
00074 }
00075 }
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088 TileableBackground::TileableBackground(void) :
00089 Inherited()
00090 {
00091 }
00092
00093 TileableBackground::TileableBackground(const TileableBackground &source) :
00094 Inherited(source)
00095 {
00096 }
00097
00098 TileableBackground::~TileableBackground(void)
00099 {
00100 }
00101
00102
00103
00104 void TileableBackground::changed(ConstFieldMaskArg whichField,
00105 UInt32 origin,
00106 BitVector details)
00107 {
00108 Inherited::changed(whichField, origin, details);
00109 }
00110
00111 void TileableBackground::dump( UInt32 ,
00112 const BitVector ) const
00113 {
00114 SLOG << "Dump TileableBackground NI" << std::endl;
00115 }
00116
00130 void TileableBackground::beginOrthoRender(
00131 DrawEnv *pEnv,
00132 bool normX,
00133 bool normY,
00134 UInt32 &fullWidth,
00135 UInt32 &fullHeight)
00136 {
00137 glMatrixMode(GL_MODELVIEW);
00138 glPushMatrix();
00139 glLoadIdentity();
00140
00141 glMatrixMode(GL_TEXTURE);
00142 glPushMatrix();
00143 glLoadIdentity();
00144
00145 glMatrixMode(GL_PROJECTION);
00146 glPushMatrix();
00147 glLoadIdentity();
00148
00149 UInt32 width = pEnv->getPixelWidth ();
00150 UInt32 height = pEnv->getPixelHeight();
00151
00152 fullWidth = pEnv->getTileFullSize()[0];
00153 fullHeight = pEnv->getTileFullSize()[1];
00154
00155 if(fullWidth == 0)
00156 {
00157 fullWidth = width;
00158 fullHeight = height;
00159 }
00160 else
00161 {
00162 if(getTile() == false)
00163 {
00164 Matrix sm = pEnv->calcTileDecorationMatrix();
00165
00166 glLoadMatrixf(sm.getValues());
00167 }
00168 }
00169
00170 Real32 projWidth = normX ? 1.0f : Real32(width );
00171 Real32 projHeight = normY ? 1.0f : Real32(height);
00172
00173 glOrtho(0, projWidth, 0, projHeight, -1.0f, 1.0f);
00174 }
00175
00178 void TileableBackground::endOrthoRender(DrawEnv *pEnv)
00179 {
00180 glMatrixMode(GL_PROJECTION);
00181 glPopMatrix();
00182
00183 glMatrixMode(GL_TEXTURE);
00184 glPopMatrix();
00185
00186 glMatrixMode(GL_MODELVIEW);
00187 glPopMatrix();
00188 }
00189
00190 OSG_END_NAMESPACE