HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
VISF_Primitive.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: VISF_Primitive.h (VISF Library, C++)
7  *
8  * COMMENTS:
9  * A subclass of GR_Primitive, the class VISF_Primitive is a wrapper
10  * for geometries generated by visualizers. It control the rendering
11  * these geometries according to the activation state of the associated
12  * visualizer.
13  */
14 
15 #ifndef __VISF_Primitive__
16 #define __VISF_Primitive__
17 
18 #include "VISF_API.h"
19 
20 #include <GUI/GUI_GeoRender.h>
21 #include <GR/GR_Defines.h>
22 #include <GR/GR_Primitive.h>
23 #include <VIS/VIS_Handle.h>
24 
26 {
27 public:
28  VISF_Primitive(const GR_RenderInfo *info,
29  const char *cache_name);
30 
31  virtual ~VISF_Primitive();
32 
33  virtual
35  { return GR_BASE_PRIM_VISUALIZE; }
36 
37  virtual const char *className() const { return "VISF_Primitive"; }
38 
39  virtual void updateVisualizer(RE_Render *r,
40  const GT_PrimitiveHandle &primh,
41  const GR_UpdateParms &update_parms) = 0;
42 
43  virtual void renderVisualizer(RE_Render *r,
44  GR_RenderMode render_mode,
45  GR_RenderFlags render_flags,
46  GR_DrawParms dp) = 0;
47 
48  virtual int renderVisualizerPick(RE_Render *r,
49  const GR_DisplayOption *opt,
50  unsigned int pick_type,
51  GR_PickStyle pick_style,
52  bool has_pick_map) = 0;
53 
54  virtual void renderVisualizerDecoration(RE_Render *r,
55  GR_Decoration decor,
56  const GR_DecorationParms &parms) = 0;
57 
58  virtual
59  GR_PrimAcceptResult collectPrimitive(GT_PrimitiveType t, int geo_type,
60  const GT_PrimitiveHandle &gt_prim,
61  const GEO_Primitive *geo_prim,
62  const GR_Primitive *gr_prim);
63 
64  void setVisHandle(VIS_Handle vh);
65 
66 
68  { return myObjectSelected; }
69 
71  { return myOpNode; }
72 
74  { return myDetail; }
75 private:
76  // Treat the following virtuals as final and override those above instead!
77  // TODO: Turn all these virtuals "final" when we have the compiler support.
78 
79  virtual void render(RE_Render *r,
80  GR_RenderMode render_mode,
82  GR_DrawParms dp);
83 
84  virtual int renderPick(RE_Render *r,
85  const GR_DisplayOption *opt,
86  unsigned int pick_type,
87  GR_PickStyle pick_style,
88  bool has_pick_map);
89 
90  virtual void renderDecoration(RE_Render *r,
91  GR_Decoration decor,
92  const GR_DecorationParms &p);
93 
94  virtual
96  int geo_type,
97  const GT_PrimitiveHandle &ph,
98  const GEO_Primitive *prim);
99 
100  virtual void update(RE_Render *r,
101  const GT_PrimitiveHandle &primh,
102  const GR_UpdateParms &update_parms);
103 
104  bool shouldRender(const GR_DisplayOption *opt);
105 
106  VIS_Handle myVisHandle;
107  int myVisSerialNum;
108 
109  // parameters cached from the update parms during update; these can
110  // be queried by the visualizer using the provided accessors.
111 
112  bool myObjectSelected;
113  OP_Node *myOpNode;
114  GU_ConstDetailHandle myDetail;
115 };
116 
117 #endif
#define VISF_API
Definition: VISF_API.h:10
virtual const char * className() const
Return a string version of this class's name.
GT_API const UT_StringHolder cache_name
GLbitfield flags
Definition: glcorearb.h:1595
OP_Node * getOpNode()
GR_Decoration
Definition: GR_Defines.h:139
virtual int renderPick(RE_Render *r, const GR_DisplayOption *opt, unsigned int pick_type, GR_PickStyle pick_style, bool has_pick_map)=0
virtual void render(RE_Render *r, GR_RenderMode render_mode, GR_RenderFlags flags, GR_DrawParms dp)=0
set of parameters sent to GR_Primitive::update()
GR_RenderMode
Definition: GR_Defines.h:44
GR_BasePrimType
Definition: GR_Defines.h:335
GU_ConstDetailHandle getDetail()
GR_PrimAcceptResult
Definition: GR_Defines.h:328
GR_RenderFlags
Definition: GR_Defines.h:79
GT_PrimitiveType
virtual GR_PrimAcceptResult acceptPrimitive(GT_PrimitiveType t, int geo_type, const GT_PrimitiveHandle &ph, const GEO_Primitive *prim)=0
virtual void update(RE_Render *r, const GT_PrimitiveHandle &primh, const GR_UpdateParms &p)=0
virtual GR_BasePrimType getBasePrimType() const
The base primitive type is usually NORMAL unless this is a packed type.
bool isObjectSelected()
GLboolean r
Definition: glcorearb.h:1221
virtual void renderDecoration(RE_Render *r, GR_Decoration decor, const GR_DecorationParms &parms)
GR_PickStyle
Definition: GR_Defines.h:228