vrecko
virtual reality framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
grass_cullcallback.h
Go to the documentation of this file.
1 #ifndef GRASS_CULL_CALLBACK_H
2 #define GRASS_CULL_CALLBACK_H
3 
4 #include <osgutil/CullVisitor>
5 using osgUtil::CullVisitor;
6 
7 #include "grass_drawable.h"
8 #include <osg/Drawable>
9 using namespace osg;
10 
11 
12 
13 namespace grass
14 {
15 
16 
17 
18  // custom cullcallback for this class - sometimes we also need the cullvisitor to traverse
19  // the more detailed version of this piece of grass which is quite specific need, so we need
20  // to define our own CullCallback which will manage this all for us.
21  class GrassCullCallback : public Drawable::CullCallback
22  {
23  virtual bool cull(NodeVisitor* nv, Drawable* drawable, RenderInfo* renderInfo) const
24  {
25  GrassDrawable * gd = dynamic_cast<GrassDrawable *>(drawable);
26  CullVisitor * cv = dynamic_cast<CullVisitor *>(nv);
27  if(gd && cv)
28  gd->ManageCulling(cv, renderInfo);
29  return false;
30  }
31  };
32 
33 
34 
35 
36 
37 }; // end of namespace grass
38 
39 
40 #endif // GRASS_CULL_CALLBACK_H