PickableSlot.cpp
Go to the documentation of this file.
1 #include "PickableSlot.hpp"
2 
5 
6 namespace iv
7 {
8 
10  Slot( inst ),
11  Position_InputNode::Tester(),
12  cm( inst, this, "PickableSlot" ),
13  input( inst, this, false ),
14  pickable( nullptr )
15 {
16  this->cm.inherits( this->Slot::cm );
17  this->cm.owns( this->input.cm );
18 
19  this->Add_InputNode( &this->input );
20 }
21 
23 {
24  this->pickable = pickable;
25 }
26 
28 {
29  // select pickable
30  Pickable * pickable = this;
31  if( this->pickable )
32  pickable = this->pickable;
33 
34  //
35  if( !pickable->elem()->elem_getRoot() )
36  return float2( 0.0, 0.0 );
37 
38  int2 pos = this->input.input_position_screen();
39  return pickable->elem()->FromScreenPlaneToLocalPlane( float2( pos ) );
40 }
41 
43 {
44  // select pickable
45  Pickable * pickable = this;
46  if( this->pickable )
47  pickable = this->pickable;
48 
49  //
50  return pickable->picking_test( input_pos );
51 }
52 
53 }