HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
VISF_Visualizer.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_Visualizer.h (VISF Library, C++)
7  *
8  * COMMENTS:
9  * A VISF_Visualizer is a custom display option which can be toggled on/off
10  * and contain any arbitrary settings.
11  */
12 
13 #ifndef __VISF_Visualizer__
14 #define __VISF_Visualizer__
15 
16 #include "VISF_API.h"
17 
18 #include "VISF_PrimitiveType.h"
19 #include <GUI/GUI_DisplayOption.h>
20 #include <GUI/GUI_VisInterface.h>
21 #include <VIS/VIS_Visualizer.h>
22 #include <UT/UT_Array.h>
23 
24 #include <GR/GR_Defines.h>
25 #include <GT/GT_Handles.h>
26 
27 class GEO_Primitive;
28 class GR_Primitive;
29 class GR_RenderInfo;
30 class GU_Detail;
31 class GUI_GeoRender;
32 class RE_Render;
33 class VISF_Primitive;
34 
36 {
37 public:
39  virtual ~VISF_Visualizer();
40 
41  /// Determines which primtive types can be passed to the visualizer
42  /// for filtering or creation.
44  { return false; }
45 
46  virtual
48  { return GR_DECOR_ALWAYS_VISIBLE; }
49 
50  virtual void renderDecorations(RE_Render *r,
51  const UT_Array<GUI_GeoRender *> &geos,
52  const GUI_DisplayOption &disp_opts,
53  GR_DecorRenderFlags flags) const {}
54 
55  virtual bool canSetupRenderForGeo(RE_Render *r,
56  GUI_DisplaySetType dset,
57  GR_RenderMode render_mode,
58  const GUI_GeoRender *geo,
59  const GUI_DisplayOption &disp_opts);
60 
61  virtual void setupRender(RE_Render *r,
62  GUI_DisplaySetType dset,
63  GR_RenderMode render_mode,
64  const GUI_GeoRender *geo,
65  GUI_DisplayOption &disp_opts) const {}
66 
67  virtual void cleanupRender(RE_Render *r,
68  GUI_DisplaySetType dset,
69  GR_RenderMode render_mode,
70  const GUI_GeoRender *geo,
71  GUI_DisplayOption &disp_opts) const {}
72 
73  virtual
74  GT_PrimitiveHandle filterPrimitive(const GU_Detail *gdp,
75  const GT_PrimitiveHandle &gt_prm,
76  const GEO_Primitive *geo_prm,
77  const GR_RenderInfo *info,
78  GR_PrimAcceptResult &processed,
79  GUI_VisFlags &vis_flags) const;
80 
81  virtual
82  VISF_Primitive *createPrimitive(const GU_Detail *gdp,
83  const GT_PrimitiveHandle &gt_prim,
84  const GEO_Primitive *geo_prim,
85  const GR_Primitive *gr_prim,
86  const GR_RenderInfo *info,
87  const char *cache_name,
88  GR_PrimAcceptResult &processed) const;
89 
90  virtual VISF_Visualizer *castToVISR() { return this; }
91 protected:
92  /// Copy constructore
94 };
95 
96 static inline
98 VISgetViewCoord(const UT_Vector3F& p,
99  const UT_Matrix4D *xform,
100  const UT_DimRect *viewport)
101 {
102  UT_Vector4F pos(p(0), p(1), p(2), 1.0);
103  fpreal32 scx, scy;
104  // Get the screen space x,y,z after the view and projection transforms.
105  pos *= *xform;
106  pos.dehomogenize();
107  scx = (pos.x() * 0.5 + 0.5) * viewport->width() + viewport->x1();
108  scy = (pos.y() * 0.5 + 0.5) * viewport->height() + viewport->y1();
109  return UT_Vector2F(scx, scy);
110 }
111 
112 #endif
#define VISF_API
Definition: VISF_API.h:10
GR_DecorRenderFlags
Definition: GR_Defines.h:205
GUI_VisFlags
GLbitfield flags
Definition: glcorearb.h:1595
GUI_DisplaySetType
Context specific display options for geometry states.
virtual void cleanupRender(RE_Render *r, GUI_DisplaySetType dset, GR_RenderMode render_mode, const GUI_GeoRender *geo, GUI_DisplayOption &disp_opts) const
virtual VISF_Visualizer * castToVISR()
GR_DecorVisibility
Definition: GR_Defines.h:167
GR_RenderMode
Definition: GR_Defines.h:42
virtual bool acceptsPrimitiveType(VISF_PrimitiveType type)
GR_PrimAcceptResult
Definition: GR_Defines.h:320
int x1() const
Get lower-left corner.
Definition: UT_Rect.h:227
virtual void setupRender(RE_Render *r, GUI_DisplaySetType dset, GR_RenderMode render_mode, const GUI_GeoRender *geo, GUI_DisplayOption &disp_opts) const
virtual void renderDecorations(RE_Render *r, const UT_Array< GUI_GeoRender * > &geos, const GUI_DisplayOption &disp_opts, GR_DecorRenderFlags flags) const
int width() const
Get width/height dimensions.
Definition: UT_Rect.h:247
UT_Vector2T< fpreal32 > UT_Vector2F
GLint GLint GLsizei GLint GLenum GLenum type
Definition: glcorearb.h:107
int height() const
Get width/height dimensions.
Definition: UT_Rect.h:248
GLboolean r
Definition: glcorearb.h:1221
virtual GR_DecorVisibility getDecorVisibility()
int y1() const
Get lower-left corner.
Definition: UT_Rect.h:228
float fpreal32
Definition: SYS_Types.h:184
GLenum src
Definition: glcorearb.h:1792