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

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

Moved memory leak detection from source file to headerfile. Its still in the class but at least not in the source file.

The leak detection works, but the false positives are not stopped.
Use Linux/Valgrind? to make your final leak detection beyond the easy first approach in MSVC

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{
43        #include <leakDetection.h>
44public:
45        skySilverLining_skyDrawable();
46        skySilverLining_skyDrawable(osgViewer::Viewer* view, osg::CoordinateSystemNode* csn_);
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
64        void shutdown();
65
66protected:
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
75private:
76        OpenThreads::Mutex cloudLayersToAddMutex;
77        mutable std::vector<cloudLayerSlot*> cloudLayerSlots;
78        bool newCloudLayersToAdd;
79        osg::ref_ptr<osg::CoordinateSystemNode> sceneRoot;
80};
81
82}       // END NAMESPACE
Note: See TracBrowser for help on using the repository browser.