| 1 | /* -*-c++-*- Present3D - Copyright (C) 1999-2006 Robert Osfield |
|---|
| 2 | * |
|---|
| 3 | * This software is open source and may be redistributed and/or modified under |
|---|
| 4 | * the terms of the GNU General Public License (GPL) version 2.0. |
|---|
| 5 | * The full license is in LICENSE.txt file included with this distribution,. |
|---|
| 6 | * |
|---|
| 7 | * This software is distributed in the hope that it will be useful, |
|---|
| 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 10 | * include LICENSE.txt for more details. |
|---|
| 11 | */ |
|---|
| 12 | |
|---|
| 13 | #ifndef SLIDESHOWCONSTRUCTOR |
|---|
| 14 | #define SLIDESHOWCONSTRUCTOR |
|---|
| 15 | |
|---|
| 16 | #include <osg/Vec3> |
|---|
| 17 | #include <osg/Vec4> |
|---|
| 18 | #include <osg/Group> |
|---|
| 19 | #include <osg/ClearNode> |
|---|
| 20 | #include <osg/Switch> |
|---|
| 21 | #include <osg/AnimationPath> |
|---|
| 22 | #include <osg/TransferFunction> |
|---|
| 23 | #include <osg/ImageStream> |
|---|
| 24 | #include <osgText/Text> |
|---|
| 25 | #include <osgGA/GUIEventAdapter> |
|---|
| 26 | |
|---|
| 27 | #include <osgDB/FileUtils> |
|---|
| 28 | |
|---|
| 29 | #include <osgPresentation/AnimationMaterial> |
|---|
| 30 | #include <osgPresentation/SlideEventHandler> |
|---|
| 31 | |
|---|
| 32 | namespace osgPresentation |
|---|
| 33 | { |
|---|
| 34 | |
|---|
| 35 | class OSGPRESENTATION_EXPORT HUDSettings : public osg::Referenced |
|---|
| 36 | { |
|---|
| 37 | public: |
|---|
| 38 | HUDSettings(double slideDistance, float eyeOffset, unsigned int leftMask, unsigned int rightMask); |
|---|
| 39 | |
|---|
| 40 | virtual bool getModelViewMatrix(osg::Matrix& matrix, osg::NodeVisitor* nv) const; |
|---|
| 41 | |
|---|
| 42 | virtual bool getInverseModelViewMatrix(osg::Matrix& matrix, osg::NodeVisitor* nv) const; |
|---|
| 43 | |
|---|
| 44 | double _slideDistance; |
|---|
| 45 | double _eyeOffset; |
|---|
| 46 | unsigned int _leftMask; |
|---|
| 47 | unsigned int _rightMask; |
|---|
| 48 | |
|---|
| 49 | protected: |
|---|
| 50 | |
|---|
| 51 | virtual ~HUDSettings(); |
|---|
| 52 | }; |
|---|
| 53 | |
|---|
| 54 | |
|---|
| 55 | class OSGPRESENTATION_EXPORT HUDTransform : public osg::Transform |
|---|
| 56 | { |
|---|
| 57 | public: |
|---|
| 58 | |
|---|
| 59 | HUDTransform(HUDSettings* hudSettings); |
|---|
| 60 | |
|---|
| 61 | virtual bool computeLocalToWorldMatrix(osg::Matrix& matrix,osg::NodeVisitor* nv) const; |
|---|
| 62 | |
|---|
| 63 | virtual bool computeWorldToLocalMatrix(osg::Matrix& matrix,osg::NodeVisitor*) const; |
|---|
| 64 | |
|---|
| 65 | protected: |
|---|
| 66 | |
|---|
| 67 | virtual ~HUDTransform(); |
|---|
| 68 | |
|---|
| 69 | osg::ref_ptr<HUDSettings> _hudSettings; |
|---|
| 70 | |
|---|
| 71 | }; |
|---|
| 72 | |
|---|
| 73 | class OSGPRESENTATION_EXPORT SlideShowConstructor |
|---|
| 74 | { |
|---|
| 75 | public: |
|---|
| 76 | |
|---|
| 77 | |
|---|
| 78 | enum CoordinateFrame { SLIDE, MODEL }; |
|---|
| 79 | |
|---|
| 80 | |
|---|
| 81 | LayerAttributes* getOrCreateLayerAttributes(osg::Node* node); |
|---|
| 82 | |
|---|
| 83 | void setDuration(osg::Node* node,double duration) |
|---|
| 84 | { |
|---|
| 85 | getOrCreateLayerAttributes(node)->setDuration(duration); |
|---|
| 86 | } |
|---|
| 87 | |
|---|
| 88 | void addKey(osg::Node* node,const KeyPosition& kp) |
|---|
| 89 | { |
|---|
| 90 | getOrCreateLayerAttributes(node)->addKey(kp); |
|---|
| 91 | } |
|---|
| 92 | |
|---|
| 93 | void addRunString(osg::Node* node, const std::string& runString) |
|---|
| 94 | { |
|---|
| 95 | getOrCreateLayerAttributes(node)->addRunString(runString); |
|---|
| 96 | } |
|---|
| 97 | |
|---|
| 98 | void setJump(osg::Node* node, bool relativeJump, int slideNum, int layerNum) |
|---|
| 99 | { |
|---|
| 100 | getOrCreateLayerAttributes(node)->setJump(relativeJump, slideNum, layerNum); |
|---|
| 101 | } |
|---|
| 102 | |
|---|
| 103 | void addPresentationKey(const KeyPosition& kp) |
|---|
| 104 | { |
|---|
| 105 | if (!_presentationSwitch) createPresentation(); |
|---|
| 106 | if (_presentationSwitch.valid()) addKey( _presentationSwitch.get(), kp); |
|---|
| 107 | } |
|---|
| 108 | |
|---|
| 109 | void addPresentationRunString(const std::string& runString) |
|---|
| 110 | { |
|---|
| 111 | if (!_presentationSwitch) createPresentation(); |
|---|
| 112 | if (_presentationSwitch.valid()) addRunString( _presentationSwitch.get(),runString); |
|---|
| 113 | } |
|---|
| 114 | |
|---|
| 115 | void addSlideKey(const KeyPosition& kp) |
|---|
| 116 | { |
|---|
| 117 | if (!_slide) addSlide(); |
|---|
| 118 | if (_slide.valid()) addKey(_slide.get(),kp); |
|---|
| 119 | } |
|---|
| 120 | |
|---|
| 121 | void addSlideRunString(const std::string& runString) |
|---|
| 122 | { |
|---|
| 123 | if (!_slide) addSlide(); |
|---|
| 124 | if (_slide.valid()) addRunString(_slide.get(),runString); |
|---|
| 125 | } |
|---|
| 126 | |
|---|
| 127 | void setSlideJump(bool relativeJump, int switchNum, int layerNum) |
|---|
| 128 | { |
|---|
| 129 | if (!_slide) addSlide(); |
|---|
| 130 | if (_slide.valid()) setJump(_slide.get(),relativeJump, switchNum, layerNum); |
|---|
| 131 | } |
|---|
| 132 | |
|---|
| 133 | void addLayerKey(const KeyPosition& kp) |
|---|
| 134 | { |
|---|
| 135 | if (!_currentLayer) addLayer(); |
|---|
| 136 | if (_currentLayer.valid()) addKey(_currentLayer.get(),kp); |
|---|
| 137 | } |
|---|
| 138 | |
|---|
| 139 | void addLayerRunString(const std::string& runString) |
|---|
| 140 | { |
|---|
| 141 | if (!_currentLayer) addLayer(); |
|---|
| 142 | if (_currentLayer.valid()) addRunString(_currentLayer.get(),runString); |
|---|
| 143 | } |
|---|
| 144 | |
|---|
| 145 | |
|---|
| 146 | void setLayerJump(bool relativeJump, int switchNum, int layerNum) |
|---|
| 147 | { |
|---|
| 148 | if (!_currentLayer) addLayer(); |
|---|
| 149 | if (_currentLayer.valid()) setJump(_currentLayer.get(),relativeJump, switchNum, layerNum); |
|---|
| 150 | } |
|---|
| 151 | |
|---|
| 152 | |
|---|
| 153 | |
|---|
| 154 | struct PositionData |
|---|
| 155 | { |
|---|
| 156 | PositionData(): |
|---|
| 157 | frame(SlideShowConstructor::SLIDE), |
|---|
| 158 | position(0.0f,1.0f,0.0f), |
|---|
| 159 | //position(0.5f,0.5f,0.0f), |
|---|
| 160 | scale(1.0f,1.0f,1.0f), |
|---|
| 161 | rotate(0.0f,0.0f,0.0f,1.0f), |
|---|
| 162 | rotation(0.0f,0.0f,1.0f,0.0f), |
|---|
| 163 | absolute_path(false), |
|---|
| 164 | inverse_path(false), |
|---|
| 165 | path_time_offset(0.0), |
|---|
| 166 | path_time_multiplier(1.0f), |
|---|
| 167 | path_loop_mode(osg::AnimationPath::NO_LOOPING), |
|---|
| 168 | animation_material_time_offset(0.0), |
|---|
| 169 | animation_material_time_multiplier(1.0), |
|---|
| 170 | animation_material_loop_mode(AnimationMaterial::NO_LOOPING), |
|---|
| 171 | autoRotate(false), |
|---|
| 172 | autoScale(false), |
|---|
| 173 | hud(false) {} |
|---|
| 174 | |
|---|
| 175 | |
|---|
| 176 | bool requiresPosition() const |
|---|
| 177 | { |
|---|
| 178 | return (position[0]!=0.0f || position[1]!=1.0f || position[2]!=1.0f); |
|---|
| 179 | } |
|---|
| 180 | |
|---|
| 181 | bool requiresScale() const |
|---|
| 182 | { |
|---|
| 183 | return (scale[0]!=1.0f || scale[1]!=1.0f || scale[2]!=1.0f); |
|---|
| 184 | } |
|---|
| 185 | |
|---|
| 186 | bool requiresRotate() const |
|---|
| 187 | { |
|---|
| 188 | return rotate[0]!=0.0f; |
|---|
| 189 | } |
|---|
| 190 | |
|---|
| 191 | bool requiresAnimation() const |
|---|
| 192 | { |
|---|
| 193 | return (rotation[0]!=0.0f || !path.empty()); |
|---|
| 194 | } |
|---|
| 195 | |
|---|
| 196 | bool requiresMaterialAnimation() const |
|---|
| 197 | { |
|---|
| 198 | return !animation_material_filename.empty() || !fade.empty(); |
|---|
| 199 | } |
|---|
| 200 | |
|---|
| 201 | CoordinateFrame frame; |
|---|
| 202 | osg::Vec3 position; |
|---|
| 203 | osg::Vec3 scale; |
|---|
| 204 | osg::Vec4 rotate; |
|---|
| 205 | osg::Vec4 rotation; |
|---|
| 206 | std::string animation_name; |
|---|
| 207 | bool absolute_path; |
|---|
| 208 | bool inverse_path; |
|---|
| 209 | double path_time_offset; |
|---|
| 210 | double path_time_multiplier; |
|---|
| 211 | osg::AnimationPath::LoopMode path_loop_mode; |
|---|
| 212 | std::string path; |
|---|
| 213 | double animation_material_time_offset; |
|---|
| 214 | double animation_material_time_multiplier; |
|---|
| 215 | AnimationMaterial::LoopMode animation_material_loop_mode; |
|---|
| 216 | std::string animation_material_filename; |
|---|
| 217 | std::string fade; |
|---|
| 218 | bool autoRotate; |
|---|
| 219 | bool autoScale; |
|---|
| 220 | bool hud; |
|---|
| 221 | }; |
|---|
| 222 | |
|---|
| 223 | struct ModelData |
|---|
| 224 | { |
|---|
| 225 | ModelData() {} |
|---|
| 226 | |
|---|
| 227 | std::string effect; |
|---|
| 228 | std::string options; |
|---|
| 229 | }; |
|---|
| 230 | |
|---|
| 231 | struct ImageData |
|---|
| 232 | { |
|---|
| 233 | ImageData(): |
|---|
| 234 | width(1.0f), |
|---|
| 235 | height(1.0f), |
|---|
| 236 | region(0.0f,0.0f,1.0f,1.0f), |
|---|
| 237 | region_in_pixel_coords(false), |
|---|
| 238 | texcoord_rotate(0.0f), |
|---|
| 239 | loopingMode(osg::ImageStream::NO_LOOPING), |
|---|
| 240 | page(-1), |
|---|
| 241 | backgroundColor(1.0f,1.0f,1.0f,1.0f) {} |
|---|
| 242 | |
|---|
| 243 | std::string options; |
|---|
| 244 | float width; |
|---|
| 245 | float height; |
|---|
| 246 | osg::Vec4 region; |
|---|
| 247 | bool region_in_pixel_coords; |
|---|
| 248 | float texcoord_rotate; |
|---|
| 249 | osg::ImageStream::LoopingMode loopingMode; |
|---|
| 250 | int page; |
|---|
| 251 | osg::Vec4 backgroundColor; |
|---|
| 252 | }; |
|---|
| 253 | |
|---|
| 254 | struct VolumeData |
|---|
| 255 | { |
|---|
| 256 | enum ShadingModel |
|---|
| 257 | { |
|---|
| 258 | Standard, |
|---|
| 259 | Light, |
|---|
| 260 | Isosurface, |
|---|
| 261 | MaximumIntensityProjection |
|---|
| 262 | }; |
|---|
| 263 | |
|---|
| 264 | VolumeData(): |
|---|
| 265 | shadingModel(Standard), |
|---|
| 266 | useTabbedDragger(false), |
|---|
| 267 | useTrackballDragger(false), |
|---|
| 268 | region_in_pixel_coords(false), |
|---|
| 269 | alphaValue(1.0), |
|---|
| 270 | cutoffValue(0.1), |
|---|
| 271 | sampleDensityValue(0.005), |
|---|
| 272 | sampleDensityWhenMovingValue(0.0) |
|---|
| 273 | { |
|---|
| 274 | region[0] = region[1] = region[2] = 0.0f; |
|---|
| 275 | region[3] = region[4] = region[5] = 1.0f; |
|---|
| 276 | } |
|---|
| 277 | |
|---|
| 278 | std::string options; |
|---|
| 279 | ShadingModel shadingModel; |
|---|
| 280 | osg::ref_ptr<osg::TransferFunction1D> transferFunction; |
|---|
| 281 | bool useTabbedDragger; |
|---|
| 282 | bool useTrackballDragger; |
|---|
| 283 | float region[6]; |
|---|
| 284 | bool region_in_pixel_coords; |
|---|
| 285 | float alphaValue; |
|---|
| 286 | float cutoffValue; |
|---|
| 287 | float sampleDensityValue; |
|---|
| 288 | float sampleDensityWhenMovingValue; |
|---|
| 289 | }; |
|---|
| 290 | |
|---|
| 291 | |
|---|
| 292 | struct FontData |
|---|
| 293 | { |
|---|
| 294 | FontData(): |
|---|
| 295 | font("fonts/arial.ttf"), |
|---|
| 296 | layout(osgText::Text::LEFT_TO_RIGHT), |
|---|
| 297 | alignment(osgText::Text::LEFT_BASE_LINE), |
|---|
| 298 | axisAlignment(osgText::Text::XZ_PLANE), |
|---|
| 299 | characterSizeMode(osgText::Text::OBJECT_COORDS), |
|---|
| 300 | characterSize(0.04f), |
|---|
| 301 | maximumHeight(1.0f), |
|---|
| 302 | maximumWidth(1.0f), |
|---|
| 303 | color(1.0f,1.0f,1.0f,1.0f) {} |
|---|
| 304 | |
|---|
| 305 | std::string font; |
|---|
| 306 | osgText::Text::Layout layout; |
|---|
| 307 | osgText::Text::AlignmentType alignment; |
|---|
| 308 | osgText::Text::AxisAlignment axisAlignment; |
|---|
| 309 | osgText::Text::CharacterSizeMode characterSizeMode; |
|---|
| 310 | float characterSize; |
|---|
| 311 | float maximumHeight; |
|---|
| 312 | float maximumWidth; |
|---|
| 313 | osg::Vec4 color; |
|---|
| 314 | }; |
|---|
| 315 | |
|---|
| 316 | |
|---|
| 317 | SlideShowConstructor(osgDB::Options* options); |
|---|
| 318 | |
|---|
| 319 | void createPresentation(); |
|---|
| 320 | |
|---|
| 321 | void setBackgroundColor(const osg::Vec4& color, bool updateClearNode); |
|---|
| 322 | const osg::Vec4& getBackgroundColor() const { return _backgroundColor; } |
|---|
| 323 | |
|---|
| 324 | void setTextColor(const osg::Vec4& color); |
|---|
| 325 | const osg::Vec4& getTextColor() const { return _textFontDataDefault.color; } |
|---|
| 326 | |
|---|
| 327 | void setPresentationName(const std::string& name); |
|---|
| 328 | |
|---|
| 329 | void setPresentationAspectRatio(float aspectRatio); |
|---|
| 330 | |
|---|
| 331 | void setPresentationAspectRatio(const std::string& str); |
|---|
| 332 | |
|---|
| 333 | void setPresentationDuration(double duration); |
|---|
| 334 | |
|---|
| 335 | |
|---|
| 336 | void addSlide(); |
|---|
| 337 | |
|---|
| 338 | void selectSlide(int slideNum); |
|---|
| 339 | |
|---|
| 340 | |
|---|
| 341 | void setSlideTitle(const std::string& name, PositionData& positionData, FontData& fontData) |
|---|
| 342 | { |
|---|
| 343 | _titlePositionData = positionData; |
|---|
| 344 | _titleFontData = fontData; |
|---|
| 345 | _slideTitle = name; |
|---|
| 346 | } |
|---|
| 347 | |
|---|
| 348 | void setSlideBackgrondHUD(bool hud) { _slideBackgroundAsHUD = hud; } |
|---|
| 349 | void setSlideBackground(const std::string& name) { _slideBackgroundImageFileName = name; } |
|---|
| 350 | |
|---|
| 351 | void setSlideDuration(double duration); |
|---|
| 352 | |
|---|
| 353 | |
|---|
| 354 | void addLayer(bool inheritPreviousLayers=true, bool defineAsBaseLayer=false); |
|---|
| 355 | |
|---|
| 356 | void selectLayer(int layerNum); |
|---|
| 357 | |
|---|
| 358 | void setLayerDuration(double duration); |
|---|
| 359 | |
|---|
| 360 | |
|---|
| 361 | // title settings |
|---|
| 362 | FontData& getTitleFontData() { return _titleFontData; } |
|---|
| 363 | FontData& getTitleFontDataDefault() { return _titleFontDataDefault; } |
|---|
| 364 | |
|---|
| 365 | PositionData& getTitlePositionData() { return _titlePositionData; } |
|---|
| 366 | PositionData& getTitlePositionDataDefault() { return _titlePositionDataDefault; } |
|---|
| 367 | |
|---|
| 368 | // text settings |
|---|
| 369 | FontData& getTextFontData() { return _textFontData; } |
|---|
| 370 | FontData& getTextFontDataDefault() { return _textFontDataDefault; } |
|---|
| 371 | |
|---|
| 372 | PositionData& getTextPositionData() { return _textPositionData; } |
|---|
| 373 | PositionData& getTextPositionDataDefault() { return _textPositionDataDefault; } |
|---|
| 374 | |
|---|
| 375 | void translateTextCursor(const osg::Vec3& delta) { _textPositionData.position += delta; } |
|---|
| 376 | |
|---|
| 377 | // image settings |
|---|
| 378 | PositionData& getImagePositionData() { return _imagePositionData; } |
|---|
| 379 | PositionData& getImagePositionDataDefault() { return _imagePositionDataDefault; } |
|---|
| 380 | |
|---|
| 381 | // model settings |
|---|
| 382 | PositionData& getModelPositionData() { return _modelPositionData; } |
|---|
| 383 | PositionData& getModelPositionDataDefault() { return _modelPositionDataDefault; } |
|---|
| 384 | |
|---|
| 385 | |
|---|
| 386 | void layerClickToDoOperation(Operation operation, bool relativeJump=true, int slideNum=0, int layerNum=0); |
|---|
| 387 | void layerClickToDoOperation(const std::string& command, Operation operation, bool relativeJump=true, int slideNum=0, int layerNum=0); |
|---|
| 388 | void layerClickEventOperation(const KeyPosition& keyPos, bool relativeJump=true, int slideNum=0, int layerNum=0); |
|---|
| 389 | |
|---|
| 390 | void addToCurrentLayer(osg::Node* subgraph); |
|---|
| 391 | |
|---|
| 392 | void addBullet(const std::string& bullet, PositionData& positionData, FontData& fontData); |
|---|
| 393 | |
|---|
| 394 | void addParagraph(const std::string& paragraph, PositionData& positionData, FontData& fontData); |
|---|
| 395 | |
|---|
| 396 | void addImage(const std::string& filename,const PositionData& positionData, const ImageData& imageData); |
|---|
| 397 | |
|---|
| 398 | void addStereoImagePair(const std::string& filenameLeft, const ImageData& imageDataLeft, const std::string& filenameRight,const ImageData& imageDataRight, const PositionData& positionData); |
|---|
| 399 | |
|---|
| 400 | void addGraph(const std::string& filename,const PositionData& positionData, const ImageData& imageData); |
|---|
| 401 | void addVNC(const std::string& filename,const PositionData& positionData, const ImageData& imageData, const std::string& password); |
|---|
| 402 | void addBrowser(const std::string& filename,const PositionData& positionData, const ImageData& imageData); |
|---|
| 403 | void addPDF(const std::string& filename,const PositionData& positionData, const ImageData& imageData); |
|---|
| 404 | osg::Image* addInteractiveImage(const std::string& filename,const PositionData& positionData, const ImageData& imageData); |
|---|
| 405 | |
|---|
| 406 | void addModel(osg::Node* subgraph, const PositionData& positionData, const ModelData& modelData); |
|---|
| 407 | |
|---|
| 408 | void addModel(const std::string& filename, const PositionData& positionData, const ModelData& modelData); |
|---|
| 409 | |
|---|
| 410 | void addVolume(const std::string& filename, const PositionData& positionData, const VolumeData& volumeData); |
|---|
| 411 | |
|---|
| 412 | osg::Group* takePresentation() { return _root.release(); } |
|---|
| 413 | |
|---|
| 414 | osg::Group* getPresentation() { return _root.get(); } |
|---|
| 415 | |
|---|
| 416 | osg::Switch* getPresentationSwitch() { return _presentationSwitch.get(); } |
|---|
| 417 | |
|---|
| 418 | osg::Switch* getCurrentSlide() { return _slide.get(); } |
|---|
| 419 | |
|---|
| 420 | osg::Group* getCurrentLayer() { return _currentLayer.get(); } |
|---|
| 421 | |
|---|
| 422 | void setLoopPresentation(bool loop) { _loopPresentation = loop; } |
|---|
| 423 | bool getLoopPresentation() const { return _loopPresentation; } |
|---|
| 424 | |
|---|
| 425 | void setAutoSteppingActive(bool flag = true) { _autoSteppingActive = flag; } |
|---|
| 426 | bool getAutoSteppingActive() const { return _autoSteppingActive; } |
|---|
| 427 | |
|---|
| 428 | void setHUDSettings(HUDSettings* hudSettings) { _hudSettings = hudSettings; } |
|---|
| 429 | HUDSettings* getHUDSettings() { return _hudSettings.get(); } |
|---|
| 430 | const HUDSettings* getHUDSettings() const { return _hudSettings.get(); } |
|---|
| 431 | |
|---|
| 432 | |
|---|
| 433 | protected: |
|---|
| 434 | |
|---|
| 435 | void findImageStreamsAndAddCallbacks(osg::Node* node); |
|---|
| 436 | |
|---|
| 437 | osg::Geometry* createTexturedQuadGeometry(const osg::Vec3& pos, const osg::Vec4& rotation, float width,float height, osg::Image* image, bool& usedTextureRectangle); |
|---|
| 438 | |
|---|
| 439 | osg::Vec3 computePositionInModelCoords(const PositionData& positionData) const; |
|---|
| 440 | void updatePositionFromInModelCoords(const osg::Vec3& vertex, PositionData& positionData) const; |
|---|
| 441 | |
|---|
| 442 | osg::Vec3 convertSlideToModel(const osg::Vec3& position) const; |
|---|
| 443 | osg::Vec3 convertModelToSlide(const osg::Vec3& position) const; |
|---|
| 444 | |
|---|
| 445 | osg::AnimationPathCallback* getAnimationPathCallback(const PositionData& positionData); |
|---|
| 446 | |
|---|
| 447 | osg::Node* attachMaterialAnimation(osg::Node* model, const PositionData& positionData); |
|---|
| 448 | bool attachTexMat(osg::StateSet* stateset, const ImageData& imageData, float s, float t, bool textureRectangle); |
|---|
| 449 | |
|---|
| 450 | osg::StateSet* createTransformStateSet() |
|---|
| 451 | { |
|---|
| 452 | osg::StateSet* stateset = new osg::StateSet; |
|---|
| 453 | #if !defined(OSG_GLES2_AVAILABLE) |
|---|
| 454 | stateset->setMode(GL_NORMALIZE,osg::StateAttribute::ON); |
|---|
| 455 | #endif |
|---|
| 456 | return stateset; |
|---|
| 457 | } |
|---|
| 458 | |
|---|
| 459 | osg::Node* decorateSubgraphForPosition(osg::Node* node, PositionData& positionData); |
|---|
| 460 | |
|---|
| 461 | osg::ref_ptr<osgDB::Options> _options; |
|---|
| 462 | |
|---|
| 463 | osg::Vec3 _slideOrigin; |
|---|
| 464 | osg::Vec3 _eyeOrigin; |
|---|
| 465 | double _slideWidth; |
|---|
| 466 | double _slideHeight; |
|---|
| 467 | double _slideDistance; |
|---|
| 468 | unsigned int _leftEyeMask; |
|---|
| 469 | unsigned int _rightEyeMask; |
|---|
| 470 | |
|---|
| 471 | osg::ref_ptr<HUDSettings> _hudSettings; |
|---|
| 472 | |
|---|
| 473 | // title settings |
|---|
| 474 | FontData _titleFontData; |
|---|
| 475 | FontData _titleFontDataDefault; |
|---|
| 476 | |
|---|
| 477 | PositionData _titlePositionData; |
|---|
| 478 | PositionData _titlePositionDataDefault; |
|---|
| 479 | |
|---|
| 480 | // text settings |
|---|
| 481 | FontData _textFontData; |
|---|
| 482 | FontData _textFontDataDefault; |
|---|
| 483 | |
|---|
| 484 | PositionData _textPositionData; |
|---|
| 485 | PositionData _textPositionDataDefault; |
|---|
| 486 | |
|---|
| 487 | // image settings |
|---|
| 488 | PositionData _imagePositionData; |
|---|
| 489 | PositionData _imagePositionDataDefault; |
|---|
| 490 | |
|---|
| 491 | // model settings |
|---|
| 492 | PositionData _modelPositionData; |
|---|
| 493 | PositionData _modelPositionDataDefault; |
|---|
| 494 | |
|---|
| 495 | |
|---|
| 496 | bool _loopPresentation; |
|---|
| 497 | bool _autoSteppingActive; |
|---|
| 498 | osg::Vec4 _backgroundColor; |
|---|
| 499 | std::string _presentationName; |
|---|
| 500 | double _presentationDuration; |
|---|
| 501 | |
|---|
| 502 | osg::ref_ptr<osg::Group> _root; |
|---|
| 503 | osg::ref_ptr<osg::Switch> _presentationSwitch; |
|---|
| 504 | |
|---|
| 505 | osg::ref_ptr<osg::ClearNode> _slideClearNode; |
|---|
| 506 | osg::ref_ptr<osg::Switch> _slide; |
|---|
| 507 | std::string _slideTitle; |
|---|
| 508 | std::string _slideBackgroundImageFileName; |
|---|
| 509 | bool _slideBackgroundAsHUD; |
|---|
| 510 | |
|---|
| 511 | osg::ref_ptr<osg::Group> _previousLayer; |
|---|
| 512 | osg::ref_ptr<osg::Group> _currentLayer; |
|---|
| 513 | |
|---|
| 514 | osg::ref_ptr<FilePathData> _filePathData; |
|---|
| 515 | |
|---|
| 516 | osg::ref_ptr<osg::Group> _layerToApplyEventCallbackTo; |
|---|
| 517 | osg::ref_ptr<osgGA::GUIEventHandler> _currentEventCallbackToApply; |
|---|
| 518 | |
|---|
| 519 | |
|---|
| 520 | std::string findFileAndRecordPath(const std::string& filename); |
|---|
| 521 | |
|---|
| 522 | void recordOptionsFilePath(const osgDB::Options* options); |
|---|
| 523 | |
|---|
| 524 | }; |
|---|
| 525 | |
|---|
| 526 | } |
|---|
| 527 | |
|---|
| 528 | #endif |
|---|