~ubuntu-branches/debian/sid/osgearth/sid

« back to all changes in this revision

Viewing changes to src/osgEarthDrivers/model_feature_stencil/StencilUtils.h

  • Committer: Bazaar Package Importer
  • Author(s): Pirmin Kalberer
  • Date: 2011-07-14 22:13:36 UTC
  • Revision ID: james.westby@ubuntu.com-20110714221336-94igk9rskxveh794
Tags: upstream-2.0+dfsg
ImportĀ upstreamĀ versionĀ 2.0+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*-c++-*- */
 
2
/* osgEarth - Dynamic map generation toolkit for OpenSceneGraph
 
3
 * Copyright 2008-2009 Pelican Ventures, Inc.
 
4
 * http://osgearth.org
 
5
 *
 
6
 * osgEarth is free software; you can redistribute it and/or modify
 
7
 * it under the terms of the GNU Lesser General Public License as published by
 
8
 * the Free Software Foundation; either version 2 of the License, or
 
9
 * (at your option) any later version.
 
10
 *
 
11
 * This program 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
 * GNU Lesser General Public License for more details.
 
15
 *
 
16
 * You should have received a copy of the GNU Lesser General Public License
 
17
 * along with this program.  If not, see <http://www.gnu.org/licenses/>
 
18
 */
 
19
#ifndef OSGEARTH_MODEL_FEATURE_STENCIL_STENCIL_UTILS_H
 
20
#define OSGEARTH_MODEL_FEATURE_STENCIL_STENCIL_UTILS_H 1
 
21
 
 
22
#include <osg/Node>
 
23
#include <osg/Geode>
 
24
#include <osg/Group>
 
25
#include <osgEarthFeatures/Geometry>
 
26
#include <osgEarthFeatures/Filter>
 
27
#include <osgEarthFeatures/Styling>
 
28
 
 
29
using namespace osgEarth::Features;
 
30
 
 
31
struct StencilUtils
 
32
{
 
33
    static osg::Node* createGeometryPass( 
 
34
        osg::Node* geometry,
 
35
        int& ref_renderBin );
 
36
 
 
37
    static osg::Node* createMaskPass(
 
38
        const osg::Vec4ub& color,
 
39
        int& ref_renderBin );
 
40
 
 
41
    static osg::Geode* createVolume(
 
42
        Geometry*            geom,
 
43
        double               offset,
 
44
        double               height,
 
45
        const FilterContext& context );
 
46
};
 
47
 
 
48
class StencilVolumeNode : public osg::Group
 
49
{
 
50
public:
 
51
    StencilVolumeNode();
 
52
    StencilVolumeNode( const StencilVolumeNode& rhs, const osg::CopyOp& op =osg::CopyOp::DEEP_COPY_ALL );
 
53
 
 
54
    META_Node(osgEarth::Features,StencilVolumeNode);
 
55
 
 
56
    // sets the render bins and returns the next available bin.
 
57
    int setBaseRenderBin( int bin );
 
58
 
 
59
    // sets the render color
 
60
    void setColor( const osg::Vec4f& color );
 
61
 
 
62
    // adds volume geometry to the node
 
63
    void addVolumes( osg::Node* node );
 
64
 
 
65
protected:
 
66
    void init();
 
67
 
 
68
    osg::Group* _stencilGroup1;
 
69
    osg::Group* _stencilGroup2;
 
70
    osg::Group* _maskGroup;
 
71
    osg::Vec4Array* _maskColorArray;
 
72
};
 
73
 
 
74
 
 
75
#endif // OSGEARTH_MODEL_FEATURE_STENCIL_STENCIL_UTILS_H