source: osgVisual/trunk/src/sky_Silverlining/skySilverLining_cloudsDrawable.cpp @ 429

Last change on this file since 429 was 281, checked in by Torben Dannhauer, 14 years ago
File size: 2.2 KB
Line 
1/* -*-c++-*- osgVisual - Copyright (C) 2009-2011 Torben Dannhauer
2 *
3 * This library is based on OpenSceneGraph, open source and may be redistributed and/or modified under
4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5 * (at your option) any later version.  The full license is in LICENSE file
6 * included with this distribution, and on the openscenegraph.org website.
7 *
8 * osgVisual requires for some proprietary modules a license from the correspondig manufacturer.
9 * You have to aquire licenses for all used proprietary modules.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 * OpenSceneGraph Public License for more details.
15 *
16 * This file is based on the OSG example of the Silverlining SDK:
17 * Copyright (c) 2008 Sundog Software, LLC. All rights reserved worldwide.
18*/
19
20#include <skySilverLining_cloudsDrawable.h>
21#include <SilverLining.h>
22#include <skySilverLining_AtmosphereReference.h>
23
24#include <GL/gl.h>
25#include <GL/glu.h>
26#include <assert.h>
27
28
29using namespace osgVisual;
30using namespace SilverLining;
31
32skySilverLining_cloudsDrawable::skySilverLining_cloudsDrawable()
33        : osg::Drawable()
34{
35    setDataVariance(osg::Object::DYNAMIC);
36    setUseVertexBufferObjects(false);
37    setUseDisplayList(false);
38}
39
40skySilverLining_cloudsDrawable::skySilverLining_cloudsDrawable(osgViewer::Viewer* view)
41        : osg::Drawable()
42        , _view(view)
43{
44    setDataVariance(osg::Object::DYNAMIC);
45    setUseVertexBufferObjects(false);
46    setUseDisplayList(false);
47}
48
49void skySilverLining_cloudsDrawable::drawImplementation(osg::RenderInfo& renderInfo) const
50{
51        osgVisual::skySilverLining_atmosphereReference *ar = dynamic_cast<osgVisual::skySilverLining_atmosphereReference *>(renderInfo.getCurrentCamera()->getUserData());
52        SilverLining::Atmosphere *atmosphere = 0;
53        if (ar) atmosphere = ar->atmosphere;
54
55        renderInfo.getState()->disableAllVertexArrays();
56
57    if (atmosphere)
58    {
59        atmosphere->DrawObjects(true);
60    }
61
62        renderInfo.getState()->dirtyAllVertexArrays();
63}
Note: See TracBrowser for help on using the repository browser.