source: osgVisual/trunk/include/sky_Silverlining/skySilverLining_skyDrawable.h @ 301

Last change on this file since 301 was 221, checked in by Torben Dannhauer, 14 years ago

Updated copyright NOTICE
(No code changes)

File size: 3.0 KB
Line 
1#pragma once
2/* -*-c++-*- osgVisual - Copyright (C) 2009-2011 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#include <visual_util.h>
33
34#include <SilverLining.h>
35#include <iostream>
36
37namespace osgVisual
38{
39
40class skySilverLining_atmosphereReference;
41
42struct cloudlayerOrder
43{
44        int slot;
45        double lat;
46        double lon;
47        double baseLength;
48        double baseWidth;
49        double thickness;
50        double baseHeight;
51        double density;
52        CloudTypes cloudtype;
53        cloudLayerSlot* assocCloudLayerSlot;    // Pointer to the cloudlayerslot managed by visual_skySilverlining.
54};
55
56
57class skySilverLining_skyDrawable : public osg::Drawable
58{
59        #include <leakDetection.h>
60public:
61        skySilverLining_skyDrawable();
62        skySilverLining_skyDrawable(osgViewer::Viewer* view, osg::CoordinateSystemNode* csn_);
63
64    virtual bool isSameKindAs(const Object* obj) const {
65        return dynamic_cast<const skySilverLining_skyDrawable*>(obj)!=NULL;
66    }
67    virtual Object* cloneType() const {
68        return new skySilverLining_skyDrawable();
69    }
70    virtual Object* clone(const osg::CopyOp& copyop) const {
71        return new skySilverLining_skyDrawable();
72    }
73
74        void setSkyboxSize(double size) {_skyboxSize = size;}
75
76    virtual void drawImplementation(osg::RenderInfo& renderInfo) const;
77
78        void addCloudLayerOrder(cloudlayerOrder newCL);
79
80        void shutdown();
81
82protected:
83        void setLighting(SilverLining::Atmosphere *atm) const;
84        void setSceneFog(SilverLining::Atmosphere *atmosphere) const;
85        static void initializeSilverLining(skySilverLining_atmosphereReference *ar);
86        void seedAndAddCloudLayers(SilverLining::Atmosphere *atmosphere);
87
88    osgViewer::Viewer* _view;
89        double _skyboxSize;
90
91private:
92        OpenThreads::Mutex cloudLayersToAddMutex;
93        std::vector<cloudlayerOrder> pendingNewCloudLayers;
94        bool newCloudLayersToAdd;
95        osg::ref_ptr<osg::CoordinateSystemNode> sceneRoot;
96};
97
98}       // END NAMESPACE
Note: See TracBrowser for help on using the repository browser.