1 /*---------------------------------------------------------------------------*\
5 * Copyright (C) 2000-2006 by the OpenSG Forum *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
15 * This library is free software; you can redistribute it and/or modify it *
16 * under the terms of the GNU Library General Public License as published *
17 * by the Free Software Foundation, version 2. *
19 * This library is distributed in the hope that it will be useful, but *
20 * WITHOUT ANY WARRANTY; without even the implied warranty of *
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
22 * Library General Public License for more details. *
24 * You should have received a copy of the GNU Library General Public *
25 * License along with this library; if not, write to the Free Software *
26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
37 \*---------------------------------------------------------------------------*/
39 //---------------------------------------------------------------------------
41 //---------------------------------------------------------------------------
46 #include "OSGConfig.h"
48 #include "OSGCSMSceneParameter.h"
53 // Documentation for this class is emitted in the
54 // OSGCSMSceneParameterBase.cpp file.
55 // To modify it, please change the .fcd file (OSGCSMSceneParameter.fcd) and
56 // regenerate the base file.
58 /***************************************************************************\
60 \***************************************************************************/
62 /***************************************************************************\
64 \***************************************************************************/
66 void CSMSceneParameter::initMethod(InitPhase ePhase
)
68 Inherited::initMethod(ePhase
);
70 if(ePhase
== TypeObject::SystemPost
)
76 /***************************************************************************\
78 \***************************************************************************/
80 /*-------------------------------------------------------------------------*\
82 \*-------------------------------------------------------------------------*/
84 /*----------------------- constructors & destructors ----------------------*/
86 CSMSceneParameter::CSMSceneParameter(void) :
89 Inherited::_bNoFrameFunction
= true;
92 CSMSceneParameter::CSMSceneParameter(const CSMSceneParameter
&source
) :
95 Inherited::_bNoFrameFunction
= true;
98 CSMSceneParameter::~CSMSceneParameter(void)
102 /*----------------------------- class specific ----------------------------*/
104 void CSMSceneParameter::changed(ConstFieldMaskArg whichField
,
108 Inherited::changed(whichField
, origin
, details
);
110 if(0x0000 != (whichField
& (SceneRefFieldMask
| ResetFieldMask
)))
116 bool CSMSceneParameter::init(void)
123 void CSMSceneParameter::frame(Time oTime
, UInt32 uiFrame
)
128 void CSMSceneParameter::reset(void)
130 fprintf(stderr
, "CSMSceneParameter::reset %p\n",
131 static_cast<void *>(_sfSceneRef
.getValue()));
133 if(_sfSceneRef
.getValue() != NULL
)
138 _sfSceneRef
.getValue()->editVolume(true).getBounds(vVolMin
,
141 std::cerr
<< "Volume: from "
143 << vVolMax
<< std::endl
;
145 editSFSceneDiag()->setValue(vVolMax
- vVolMin
);
147 editSFSceneCenter()->setValue(
148 Pnt3f((vVolMin
[0] + vVolMax
[0]) * .5,
149 (vVolMin
[1] + vVolMax
[1]) * .5,
150 (vVolMin
[2] + vVolMax
[2]) * .5));
153 osgMax(_sfSceneDiag
.getValue()[0],
154 _sfSceneDiag
.getValue()[1]) * _sfDistScale
.getValue();
156 editSFInitViewPos()->setValue(
157 Pnt3f(_sfSceneCenter
.getValue()[0],
158 _sfSceneCenter
.getValue()[1],
159 _sfSceneCenter
.getValue()[2] + rDist
));
161 std::cerr
<< "Center: " << getSceneCenter()
167 log10f(_sfSceneDiag
.getValue().length())) - 2));
171 log10f(_sfSceneDiag
.getValue().length()))) + 1));
173 std::cerr
<< "clipping (" << _sfSceneDiag
.getValue().length()
175 << getSceneNear() << " to "
176 << getSceneFar () << std::endl
;
180 void CSMSceneParameter::dump( UInt32
,
181 const BitVector
) const
183 SLOG
<< "Dump CSMSceneParameter NI" << std::endl
;