HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
POP_IntersectAttribs.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: POP_IntersectAttribs.h (POP Library, C++)
7  *
8  * COMMENTS:
9  */
10 
11 #ifndef __POP_INTERSECTATTRIBS_H_INCLUDED__
12 #define __POP_INTERSECTATTRIBS_H_INCLUDED__
13 
14 #include "POP_API.h"
15 #include "POP_ContextData.h"
16 #include "GA_PageHandleUtil.h"
17 
18 #include <GA/GA_PageHandle.h>
19 
20 #include <hboost/fusion/include/adapt_struct.hpp>
21 #include <hboost/fusion/include/adapt_struct_named.hpp>
22 #include <hboost/fusion/include/define_struct.hpp>
23 
24 
25 #define POP_INIT_ATTRIB(NAME) \
26  my##NAME(data->get##NAME##Offset().getAttribute()) \
27  /**/
28 
29 #define POP_DECLARE_ATTRIB(NAME, TYPE) \
30  GA_RWPageHandle##TYPE my##NAME; \
31  GA_RWPageHandle##TYPE::value_type my##NAME##Value; \
32  /**/
33 
34 // Helper class for use with POP_IntersectBase
36 {
38  : POP_INIT_ATTRIB(HitPos)
39  , POP_INIT_ATTRIB(HitPosUV)
40  , POP_INIT_ATTRIB(HitNormal)
41  , POP_INIT_ATTRIB(HitUV)
42  , POP_INIT_ATTRIB(HitDiffuse)
43  , POP_INIT_ATTRIB(NumHit)
44  , POP_INIT_ATTRIB(HitID)
45  , POP_INIT_ATTRIB(HitTime)
46  , POP_INIT_ATTRIB(Distance)
47  , myPos(data->getDetail()->getP())
48  , POP_INIT_ATTRIB(PosPrim)
49  , POP_INIT_ATTRIB(PosUV)
50  , POP_INIT_ATTRIB(Backtrack)
51  , POP_INIT_ATTRIB(SpeedLimit)
52  {
53  }
54 
55  // Used by getAttributePointers() and setAttributePointers()
56  POP_DECLARE_ATTRIB(HitPos,V3)
57  POP_DECLARE_ATTRIB(HitPosUV,V2)
58  POP_DECLARE_ATTRIB(HitNormal,V3)
59  POP_DECLARE_ATTRIB(HitUV,V3)
60  POP_DECLARE_ATTRIB(HitDiffuse,V3)
61  POP_DECLARE_ATTRIB(NumHit,I)
62  POP_DECLARE_ATTRIB(HitID,I)
63  POP_DECLARE_ATTRIB(HitTime,F)
64  POP_DECLARE_ATTRIB(Distance,F)
65 
66  // Other attributes used by the various intersect methods
67  POP_DECLARE_ATTRIB(Pos,V3)
68  POP_DECLARE_ATTRIB(PosPrim,I)
69  POP_DECLARE_ATTRIB(PosUV,V2)
70  POP_DECLARE_ATTRIB(Backtrack,V4)
71  POP_DECLARE_ATTRIB(SpeedLimit,V2)
72 };
73 
74 #undef POP_DECLARE_ATTRIB
75 #undef POP_INIT_ATTRIB
76 
77 // Create hboost::fusion sequence for all members of POP_IntersectAttribs
81  (GA_RWPageHandleV2, myHitPosUV)
83  (GA_RWPageHandleV3, myHitUV)
85  (GA_RWPageHandleI, myNumHit)
87  (GA_RWPageHandleF, myHitTime)
88  (GA_RWPageHandleF, myDistance)
89  //
90  (GA_RWPageHandleV3, myPos)
91  (GA_RWPageHandleI, myPosPrim)
92  (GA_RWPageHandleV2, myPosUV)
93  (GA_RWPageHandleV4, myBacktrack)
94  (GA_RWPageHandleV2, mySpeedLimit)
95 )
96 
97 // Create POP_AdaptedAttribs::IntersectBase as a hboost::fusion sequence
98 // of POP_IntersectAttribs.
99 HBOOST_FUSION_ADAPT_STRUCT_NAMED_NS(
104  (GA_RWPageHandleV2, myHitPosUV)
106  (GA_RWPageHandleV3, myHitUV)
107  (GA_RWPageHandleV3, myHitDiffuse)
108  (GA_RWPageHandleI, myNumHit)
109  (GA_RWPageHandleI, myHitID)
110  (GA_RWPageHandleF, myHitTime)
111  (GA_RWPageHandleF, myDistance)
112 )
113 
114 // Create POP_CollideAttribs as the set of attributes used for collision
116  , POP_CollideAttribs,
117  (GA_RWPageHandleI, myState)
118  (GA_ROPageHandleF, myLife)
119  (GA_RWPageHandleV3, myVelocity)
120  (GA_RWPageHandleV3, myAccel)
121 )
122 
123 POP_API extern void POPbindCollideAttribs(
124  POP_CollideAttribs &collide_attribs,
126 
127 
128 #endif // __POP_INTERSECTATTRIBS_H_INCLUDED__
myHitPos(GA_RWPageHandleV2, myHitPosUV)(GA_RWPageHandleV3
#define POP_API
Definition: POP_API.h:10
myDistance HBOOST_FUSION_DEFINE_STRUCT(, POP_CollideAttribs,(GA_RWPageHandleI, myState)(GA_ROPageHandleF, myLife)(GA_RWPageHandleV3, myVelocity)(GA_RWPageHandleV3, myAccel)) POP_API extern void POPbindCollideAttribs(POP_CollideAttribs &collide_attribs
POP_IntersectAttribs(POP_ContextData *data)
#define POP_INIT_ATTRIB(NAME)
GLboolean * data
Definition: glcorearb.h:130
HBOOST_FUSION_ADAPT_STRUCT(POP_IntersectAttribs,(GA_RWPageHandleV3, myHitPos)(GA_RWPageHandleV2, myHitPosUV)(GA_RWPageHandleV3, myHitNormal)(GA_RWPageHandleV3, myHitUV)(GA_RWPageHandleV3, myHitDiffuse)(GA_RWPageHandleI, myNumHit)(GA_RWPageHandleI, myHitID)(GA_RWPageHandleF, myHitTime)(GA_RWPageHandleF, myDistance)(GA_RWPageHandleV3, myPos)(GA_RWPageHandleI, myPosPrim)(GA_RWPageHandleV2, myPosUV)(GA_RWPageHandleV4, myBacktrack)(GA_RWPageHandleV2, mySpeedLimit)) HBOOST_FUSION_ADAPT_STRUCT_NAMED_NS(POP_IntersectAttribs
myHitID(GA_RWPageHandleF, myHitTime)(GA_RWPageHandleF
myHitDiffuse(GA_RWPageHandleI, myNumHit)(GA_RWPageHandleI
#define POP_DECLARE_ATTRIB(NAME, TYPE)
POP_AdaptedAttribs
myHitNormal(GA_RWPageHandleV3, myHitUV)(GA_RWPageHandleV3