inlib  1.2.0
Public Member Functions | Static Public Member Functions | Public Attributes
inlib::sg::ghost Class Reference
Inheritance diagram for inlib::sg::ghost:
Inheritance graph
[legend]
Collaboration diagram for inlib::sg::ghost:
Collaboration graph
[legend]

List of all members.

Public Member Functions

virtual void * cast (const std::string &a_class) const
virtual nodecopy () const
virtual const std::string & s_cls () const
virtual void pick (inlib::sg::pick_action &a_action)
 ghost ()
virtual ~ghost ()
 ghost (const ghost &a_from)
ghostoperator= (const ghost &a_from)

Static Public Member Functions

static const std::string & s_class ()

Public Attributes

inlib::sg::sf< float > width
inlib::sg::sf< float > height

Detailed Description

Definition at line 20 of file ghost.


Constructor & Destructor Documentation

inlib::sg::ghost::ghost ( ) [inline]

Definition at line 94 of file ghost.

  : node(),cbks()
  ,width(1)
  ,height(1)
  {
    add_fields();
  }
virtual inlib::sg::ghost::~ghost ( ) [inline, virtual]

Definition at line 101 of file ghost.

{}
inlib::sg::ghost::ghost ( const ghost a_from) [inline]

Definition at line 103 of file ghost.

  : node(a_from),cbks(a_from)
  ,width(a_from.width)
  ,height(a_from.height)
  {
    add_fields();
  }

Member Function Documentation

virtual void* inlib::sg::ghost::cast ( const std::string &  a_class) const [inline, virtual]

Reimplemented from inlib::sg::cbks.

Definition at line 27 of file ghost.

                                                     {
    if(void* p = inlib::cmp_cast<ghost>(this,a_class)) return p;
    return inlib::sg::node::cast(a_class);
  }
virtual node* inlib::sg::ghost::copy ( ) const [inline, virtual]

Implements inlib::sg::node.

Definition at line 40 of file ghost.

{return new ghost(*this);}
ghost& inlib::sg::ghost::operator= ( const ghost a_from) [inline]

Definition at line 110 of file ghost.

                                       {
    node::operator=(a_from);
    cbks::operator=(a_from);
    width = a_from.width;
    height = a_from.height;
    return *this;
  }
virtual void inlib::sg::ghost::pick ( inlib::sg::pick_action a_action) [inline, virtual]

Reimplemented from inlib::sg::node.

Definition at line 44 of file ghost.

                                                  {
    if(width.value()<=0) return;
    if(height.value()<=0) return;

    inlib::mat4f mtx = a_action.projection_matrix();
    mtx *= a_action.model_matrix();

    float xb = -width.value()*0.5f;
    float xe =  width.value()*0.5f;
    float yb = -height.value()*0.5f;
    float ye =  height.value()*0.5f;

    float p1x,p1y,p2x,p2y,p3x,p3y;
   {p1x = xb;
    p1y = yb;
    mtx.mul_2f(p1x,p1y);

    p2x = xe;
    p2y = yb;
    mtx.mul_2f(p2x,p2y);

    p3x = xe;
    p3y = ye;
    mtx.mul_2f(p3x,p3y);

    if(a_action.intersect(p1x,p1y,p2x,p2y,p3x,p3y)) {
      a_action.set_done(true);
      a_action.set_node(this);
      return;
    }}          

   {p1x = xe;
    p1y = ye;
    mtx.mul_2f(p1x,p1y);

    p2x = xb;
    p2y = ye;
    mtx.mul_2f(p2x,p2y);

    p3x = xb;
    p3y = yb;
    mtx.mul_2f(p3x,p3y);

    if(a_action.intersect(p1x,p1y,p2x,p2y,p3x,p3y)) {
      a_action.set_done(true);
      a_action.set_node(this);
      return;
    }}          
  }
static const std::string& inlib::sg::ghost::s_class ( ) [inline, static]

Reimplemented from inlib::sg::cbks.

Definition at line 22 of file ghost.

                                    {
    static const std::string s_v("inlib::sg::ghost");
    return s_v;
  }
virtual const std::string& inlib::sg::ghost::s_cls ( ) const [inline, virtual]

Implements inlib::sg::node.

Definition at line 41 of file ghost.

{return s_class();}

Member Data Documentation

Definition at line 33 of file ghost.

Definition at line 32 of file ghost.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines