// Copyright (c) 2008 Sundog Software, LLC. All rights reserved worldwide.

#pragma once

#include <osg/Drawable>
#include <osgViewer/Viewer>
#include "SilverLining.h"
#include <OpenThreads/Mutex>

class CloudsDrawable : public osg::Drawable
{
public:
    CloudsDrawable();
	CloudsDrawable(osgViewer::Viewer* view);

    virtual bool isSameKindAs(const Object* obj) const {
        return dynamic_cast<const CloudsDrawable*>(obj)!=NULL;
    }
    virtual Object* cloneType() const {
        return new CloudsDrawable();
    }
    virtual Object* clone(const osg::CopyOp& copyop) const {
        return new CloudsDrawable();
    }

    virtual void drawImplementation(osg::RenderInfo& renderInfo) const;

    bool adjustNearFar( const osg::Vec3 & camPos, double & near, double & far );

protected:
    osgViewer::Viewer* _view;
    mutable OpenThreads::Mutex _mutex;
};
