[32] | 1 | #pragma once |
---|
| 2 | /* -*-c++-*- osgVisual - Copyright (C) 2009-2010 Torben Dannhauer |
---|
| 3 | * |
---|
| 4 | * This library is based on OpenSceneGraph, open source and may be redistributed and/or modified under |
---|
| 5 | * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or |
---|
| 6 | * (at your option) any later version. The full license is in LICENSE file |
---|
| 7 | * included with this distribution, and on the openscenegraph.org website. |
---|
| 8 | * |
---|
| 9 | * osgVisual requires for some proprietary modules a license from the correspondig manufacturer. |
---|
| 10 | * You have to aquire licenses for all used proprietary modules. |
---|
| 11 | * |
---|
| 12 | * This library is distributed in the hope that it will be useful, |
---|
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 15 | * OpenSceneGraph Public License for more details. |
---|
| 16 | * |
---|
| 17 | * This file is based on the OSG example of the Silverlining SDK: |
---|
| 18 | * Copyright (c) 2008 Sundog Software, LLC. All rights reserved worldwide. |
---|
| 19 | */ |
---|
| 20 | |
---|
| 21 | |
---|
| 22 | |
---|
| 23 | #include <osg/Drawable> |
---|
[53] | 24 | #include <osg/CoordinateSystemNode> |
---|
| 25 | #include <osg/Fog> |
---|
| 26 | |
---|
[32] | 27 | #include <osgViewer/Viewer> |
---|
| 28 | #include <OpenThreads/ScopedLock> |
---|
| 29 | #include <OpenThreads/Mutex> |
---|
| 30 | |
---|
| 31 | #include <skySilverLining_cloudLayerSlot.h> |
---|
| 32 | |
---|
| 33 | #include <SilverLining.h> |
---|
| 34 | #include <iostream> |
---|
| 35 | |
---|
| 36 | namespace osgVisual |
---|
| 37 | { |
---|
| 38 | |
---|
| 39 | class skySilverLining_atmosphereReference; |
---|
| 40 | |
---|
| 41 | class skySilverLining_skyDrawable : public osg::Drawable |
---|
| 42 | { |
---|
[88] | 43 | #include <leakDetection.h> |
---|
[32] | 44 | public: |
---|
| 45 | skySilverLining_skyDrawable(); |
---|
[53] | 46 | skySilverLining_skyDrawable(osgViewer::Viewer* view, osg::CoordinateSystemNode* csn_); |
---|
[32] | 47 | |
---|
| 48 | virtual bool isSameKindAs(const Object* obj) const { |
---|
| 49 | return dynamic_cast<const skySilverLining_skyDrawable*>(obj)!=NULL; |
---|
| 50 | } |
---|
| 51 | virtual Object* cloneType() const { |
---|
| 52 | return new skySilverLining_skyDrawable(); |
---|
| 53 | } |
---|
| 54 | virtual Object* clone(const osg::CopyOp& copyop) const { |
---|
| 55 | return new skySilverLining_skyDrawable(); |
---|
| 56 | } |
---|
| 57 | |
---|
| 58 | void setSkyboxSize(double size) {_skyboxSize = size;} |
---|
| 59 | |
---|
| 60 | virtual void drawImplementation(osg::RenderInfo& renderInfo) const; |
---|
| 61 | |
---|
| 62 | void addCloudLayer(cloudLayerSlot *cloudLayerSlot_); |
---|
| 63 | |
---|
[53] | 64 | void shutdown(); |
---|
| 65 | |
---|
[32] | 66 | protected: |
---|
| 67 | void setLighting(SilverLining::Atmosphere *atm) const; |
---|
| 68 | void setSceneFog(SilverLining::Atmosphere *atmosphere) const; |
---|
| 69 | static void initializeSilverLining(skySilverLining_atmosphereReference *ar); |
---|
| 70 | void seedAndAddCloudLayers(SilverLining::Atmosphere *atmosphere); |
---|
| 71 | |
---|
| 72 | osgViewer::Viewer* _view; |
---|
| 73 | double _skyboxSize; |
---|
| 74 | |
---|
| 75 | private: |
---|
| 76 | OpenThreads::Mutex cloudLayersToAddMutex; |
---|
| 77 | mutable std::vector<cloudLayerSlot*> cloudLayerSlots; |
---|
| 78 | bool newCloudLayersToAdd; |
---|
[53] | 79 | osg::ref_ptr<osg::CoordinateSystemNode> sceneRoot; |
---|
[32] | 80 | }; |
---|
| 81 | |
---|
| 82 | } // END NAMESPACE |
---|