source: osgVisual/include/sky_Silverlining/skySilverLining_skyDrawable.h @ 81

Last change on this file since 81 was 53, checked in by Torben Dannhauer, 15 years ago

Update to use osg for sky fog instead OpenGL.

this way the osg fog feature "radialFog" can be used.

File size: 2.6 KB
Line 
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>
24#include <osg/CoordinateSystemNode>
25#include <osg/Fog>
26
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
36namespace osgVisual
37{
38
39class skySilverLining_atmosphereReference;
40
41class skySilverLining_skyDrawable : public osg::Drawable
42{
43public:
44        skySilverLining_skyDrawable();
45        skySilverLining_skyDrawable(osgViewer::Viewer* view, osg::CoordinateSystemNode* csn_);
46
47    virtual bool isSameKindAs(const Object* obj) const {
48        return dynamic_cast<const skySilverLining_skyDrawable*>(obj)!=NULL;
49    }
50    virtual Object* cloneType() const {
51        return new skySilverLining_skyDrawable();
52    }
53    virtual Object* clone(const osg::CopyOp& copyop) const {
54        return new skySilverLining_skyDrawable();
55    }
56
57        void setSkyboxSize(double size) {_skyboxSize = size;}
58
59    virtual void drawImplementation(osg::RenderInfo& renderInfo) const;
60
61        void addCloudLayer(cloudLayerSlot *cloudLayerSlot_);
62
63        void shutdown();
64
65protected:
66        void setLighting(SilverLining::Atmosphere *atm) const;
67        void setSceneFog(SilverLining::Atmosphere *atmosphere) const;
68        static void initializeSilverLining(skySilverLining_atmosphereReference *ar);
69        void seedAndAddCloudLayers(SilverLining::Atmosphere *atmosphere);
70
71    osgViewer::Viewer* _view;
72        double _skyboxSize;
73
74private:
75        OpenThreads::Mutex cloudLayersToAddMutex;
76        mutable std::vector<cloudLayerSlot*> cloudLayerSlots;
77        bool newCloudLayersToAdd;
78        osg::ref_ptr<osg::CoordinateSystemNode> sceneRoot;
79};
80
81}       // END NAMESPACE
Note: See TracBrowser for help on using the repository browser.