root/OpenSceneGraph/trunk/include/osg/ClusterCullingCallback @ 13041

Revision 13041, 2.7 kB (checked in by robert, 2 years ago)

Ran script to remove trailing spaces and tabs

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
2 *
3 * This library is 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 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 * OpenSceneGraph Public License for more details.
12*/
13
14#ifndef OSG_CLUSTERCULLINGCALLBACK
15#define OSG_CLUSTERCULLINGCALLBACK 1
16
17#include <osg/Drawable>
18#include <osg/NodeCallback>
19
20namespace osg {
21
22/** Implements cluster culling to cull back facing drawables. Derived from
23  * Drawable::CullCallback.
24*/
25class OSG_EXPORT ClusterCullingCallback : public Drawable::CullCallback, public NodeCallback
26{
27    public:
28
29        ClusterCullingCallback();
30        ClusterCullingCallback(const ClusterCullingCallback& ccc,const CopyOp& copyop);
31        ClusterCullingCallback(const osg::Vec3& controlPoint, const osg::Vec3& normal, float deviation);
32        ClusterCullingCallback(const osg::Drawable* drawable);
33
34        META_Object(osg,ClusterCullingCallback);
35
36        /** Computes the control point, normal, and deviation from the
37          * given drawable contents. */
38        void computeFrom(const osg::Drawable* drawable);
39
40        /** Transform the ClusterCullingCallback's positional members to a new coordinate frame.*/
41        void transform(const osg::Matrixd& matrix);
42
43        void set(const osg::Vec3& controlPoint, const osg::Vec3& normal, float deviation, float radius);
44
45        void setControlPoint(const osg::Vec3& controlPoint) { _controlPoint = controlPoint; }
46        const osg::Vec3& getControlPoint() const { return _controlPoint; }
47
48        void setNormal(const osg::Vec3& normal) { _normal = normal; }
49        const osg::Vec3& getNormal() const { return _normal; }
50
51        void setRadius(float radius) { _radius = radius; }
52        float getRadius() const { return _radius; }
53
54        void setDeviation(float deviation) { _deviation = deviation; }
55        float getDeviation() const { return _deviation; }
56
57        virtual bool cull(osg::NodeVisitor*, osg::Drawable*, osg::State*) const;
58
59        /** Callback method called by the NodeVisitor when visiting a node.*/
60        virtual void operator()(Node* node, NodeVisitor* nv);
61
62    protected:
63
64        virtual ~ClusterCullingCallback() {}
65
66        osg::Vec3    _controlPoint;
67        osg::Vec3    _normal;
68        float        _radius;
69        float        _deviation;
70};
71
72
73}
74
75#endif
Note: See TracBrowser for help on using the browser.