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[ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /externals/g4tools/include/tools/sg/nodekit (Version 11.3.0) and /externals/g4tools/include/tools/sg/nodekit (Version 11.2.1)


  1 // Copyright (C) 2010, Guy Barrand. All rights      1 // Copyright (C) 2010, Guy Barrand. All rights reserved.
  2 // See the file tools.license for terms.            2 // See the file tools.license for terms.
  3                                                     3 
  4 #ifndef tools_sg_nodekit                            4 #ifndef tools_sg_nodekit
  5 #define tools_sg_nodekit                            5 #define tools_sg_nodekit
  6                                                     6 
  7 #include "pick_action"                              7 #include "pick_action"
  8 #include "group"                                    8 #include "group"
  9                                                     9 
 10 namespace tools {                                  10 namespace tools {
 11 namespace sg {                                     11 namespace sg {
 12                                                    12 
 13 inline void nodekit_pick(pick_action& a_action     13 inline void nodekit_pick(pick_action& a_action,node& a_sg,node* a_node) {
 14   if(a_action.stop_at_first()){                    14   if(a_action.stop_at_first()){
 15     a_sg.pick(a_action);                           15     a_sg.pick(a_action);
 16     if(a_action.done()) {                          16     if(a_action.done()) {
 17       a_action.set_node(a_node);                   17       a_action.set_node(a_node);
 18       a_action.save_state(a_action.state());       18       a_action.save_state(a_action.state());
 19     }                                              19     }
 20   } else {                                         20   } else {
 21     // have a local pick_action to override no     21     // have a local pick_action to override node in the found pick list.
 22     pick_action action(a_action);                  22     pick_action action(a_action);
 23     a_sg.pick(action);                             23     a_sg.pick(action);
 24     typedef pick_action::pick_t pick_t;            24     typedef pick_action::pick_t pick_t;
 25     const std::vector<pick_t>& pks = action.pi     25     const std::vector<pick_t>& pks = action.picks();
 26     std::vector<pick_t>::const_iterator it;        26     std::vector<pick_t>::const_iterator it;
 27     for(it=pks.begin();it!=pks.end();++it) {       27     for(it=pks.begin();it!=pks.end();++it) {
 28       a_action.add_pick(*a_node,(*it).zs(),(*i     28       a_action.add_pick(*a_node,(*it).zs(),(*it).ws(),(*it).state());
 29     }                                              29     }
 30   }                                                30   }
 31 }                                                  31 }
 32                                                    32 
 33 }}                                                 33 }}
 34                                                    34 
 35 #include "render_action"                           35 #include "render_action"
 36 #include "bbox_action"                             36 #include "bbox_action"
 37                                                    37 
 38 namespace tools {                                  38 namespace tools {
 39 namespace sg {                                     39 namespace sg {
 40                                                    40 
 41 class nodekit : public node {                      41 class nodekit : public node {
 42   TOOLS_HEADER(nodekit,tools::sg::nodekit,node     42   TOOLS_HEADER(nodekit,tools::sg::nodekit,node)
 43 public:                                            43 public:
 44   virtual void update_sg(std::ostream&) = 0;       44   virtual void update_sg(std::ostream&) = 0;
 45 public:                                            45 public:
 46   virtual void render(render_action& a_action)     46   virtual void render(render_action& a_action) {
 47     update_if_touched(a_action.out());             47     update_if_touched(a_action.out());
 48     m_group.render(a_action);                      48     m_group.render(a_action);
 49   }                                                49   }
 50   virtual void search(search_action& a_action)     50   virtual void search(search_action& a_action) {
 51     update_if_touched(a_action.out());             51     update_if_touched(a_action.out());
 52     parent::search(a_action);                      52     parent::search(a_action);
 53     if(a_action.done()) return;                    53     if(a_action.done()) return;
 54     m_group.search(a_action);                      54     m_group.search(a_action);
 55   }                                                55   }
 56   virtual void bbox(bbox_action& a_action) {       56   virtual void bbox(bbox_action& a_action) {
 57     update_if_touched(a_action.out());             57     update_if_touched(a_action.out());
 58     m_group.bbox(a_action);                        58     m_group.bbox(a_action);
 59   }                                                59   }
 60 /*                                                 60 /*
 61   virtual void pick(pick_action& a_action) {       61   virtual void pick(pick_action& a_action) {
 62     update_if_touched(a_action.out());             62     update_if_touched(a_action.out());
 63     nodekit_pick(a_action,m_group,this);           63     nodekit_pick(a_action,m_group,this);
 64   }                                                64   }
 65   virtual bool write(write_action& a_action) {     65   virtual bool write(write_action& a_action) {
 66     update_if_touched(a_action.out());             66     update_if_touched(a_action.out());
 67     //if(!write_fields(a_action)) return false     67     //if(!write_fields(a_action)) return false;
 68     return m_group.write(a_action);                68     return m_group.write(a_action);
 69   }                                                69   }
 70 */                                                 70 */
 71 public:                                            71 public:
 72   nodekit()                                        72   nodekit()
 73   :parent()                                        73   :parent()
 74   {}                                               74   {}
 75   virtual ~nodekit(){}                             75   virtual ~nodekit(){}
 76 public:                                            76 public:
 77   nodekit(const nodekit& a_from)                   77   nodekit(const nodekit& a_from)
 78   :parent(a_from)                                  78   :parent(a_from)
 79   {}                                               79   {}
 80   nodekit& operator=(const nodekit& a_from){       80   nodekit& operator=(const nodekit& a_from){
 81     parent::operator=(a_from);                     81     parent::operator=(a_from);
 82     return *this;                                  82     return *this;
 83   }                                                83   }
 84 protected:                                         84 protected:
 85   void update_if_touched(std::ostream& a_out)      85   void update_if_touched(std::ostream& a_out) {
 86     if(touched()) {                                86     if(touched()) {
 87       update_sg(a_out);                            87       update_sg(a_out);
 88       reset_touched();                             88       reset_touched();
 89     }                                              89     }
 90   }                                                90   }
 91 protected:                                         91 protected:
 92   group m_group;                                   92   group m_group;
 93 };                                                 93 };
 94                                                    94 
 95 }}                                                 95 }}
 96                                                    96 
 97 #endif                                             97 #endif