HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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 <RE/RE_RenderContext.h>
23 #include <UT/UT_Array.h>
24 
25 #include <GR/GR_Defines.h>
26 #include <GT/GT_Handles.h>
27 
28 class GEO_Primitive;
29 class GR_Primitive;
30 class GR_RenderInfo;
31 class GU_Detail;
32 class GUI_GeoRender;
33 class RE_Render;
34 class VISF_Primitive;
35 
37 {
38 public:
40  ~VISF_Visualizer() override;
41 
42  /// Determines which primitive types can be passed to the visualizer
43  /// for filtering or creation.
45  { return false; }
46 
47  void updateForRender(RE_RenderContext r);
48 
49  virtual
51  { return GR_DECOR_ALWAYS_VISIBLE; }
52 
54  const UT_Array<GUI_GeoRender *> &geos,
55  const GUI_DisplayOption &disp_opts,
56  GR_DecorRenderFlags flags) const {}
57 
58  virtual bool canSetupRenderForGeo(RE_RenderContext r,
59  GUI_DisplaySetType dset,
60  GR_RenderMode render_mode,
61  const GUI_GeoRender *geo,
62  const GUI_DisplayOption &disp_opts);
63 
65  GUI_DisplaySetType dset,
66  GR_RenderMode render_mode,
67  const GUI_GeoRender *geo,
68  GUI_DisplayOption &disp_opts) const {}
69 
71  GUI_DisplaySetType dset,
72  GR_RenderMode render_mode,
73  const GUI_GeoRender *geo,
74  GUI_DisplayOption &disp_opts) const {}
75 
76  virtual
77  GT_PrimitiveHandle filterPrimitive(const GU_Detail *gdp,
78  const GT_PrimitiveHandle &gt_prm,
79  const GEO_Primitive *geo_prm,
80  const GR_RenderInfo *info,
81  GR_PrimAcceptResult &processed,
82  GUI_VisFlags &vis_flags) const;
83 
84  virtual
85  VISF_Primitive *createPrimitive(const GU_Detail *gdp,
86  const GT_PrimitiveHandle &gt_prim,
87  const GEO_Primitive *geo_prim,
88  const GR_Primitive *gr_prim,
89  const GR_RenderInfo *info,
90  const char *cache_name,
91  GR_PrimAcceptResult &processed) const;
92 
93  virtual VISF_Visualizer *castToVISR() { return this; }
94 protected:
95  /// Copy constructor
97 
98  virtual
100 
101  int myRenderVersion; // cathes up with myCookVersion
102 
103 };
104 
105 static inline
107 VISgetViewCoord(const UT_Vector3F& p,
108  const UT_Matrix4D *xform,
109  const UT_DimRect *viewport)
110 {
111  UT_Vector4F pos(p(0), p(1), p(2), 1.0);
112  fpreal32 scx, scy;
113  // Get the screen space x,y,z after the view and projection transforms.
114  pos *= *xform;
115  pos.dehomogenize();
116  scx = (pos.x() * 0.5 + 0.5) * viewport->width() + viewport->x1();
117  scy = (pos.y() * 0.5 + 0.5) * viewport->height() + viewport->y1();
118  return UT_Vector2F(scx, scy);
119 }
120 
121 #endif
#define VISF_API
Definition: VISF_API.h:10
GLbitfield flags
Definition: glcorearb.h:1596
GR_DecorRenderFlags
Definition: GR_Defines.h:230
constexpr SYS_FORCE_INLINE T & y() noexcept
Definition: UT_Vector4.h:493
GUI_VisFlags
GT_API const UT_StringHolder cache_name
virtual void renderDecorations(RE_RenderContext r, const UT_Array< GUI_GeoRender * > &geos, const GUI_DisplayOption &disp_opts, GR_DecorRenderFlags flags) const
float fpreal32
Definition: SYS_Types.h:200
GUI_DisplaySetType
Context specific display options for geometry states.
Temporary container for either a RV_Render and an RE_Render.
constexpr SYS_FORCE_INLINE T & x() noexcept
Definition: UT_Vector4.h:491
virtual VISF_Visualizer * castToVISR()
GR_DecorVisibility
Definition: GR_Defines.h:192
GR_RenderMode
Definition: GR_Defines.h:48
virtual bool acceptsPrimitiveType(VISF_PrimitiveType type)
virtual void setupRender(RE_RenderContext r, GUI_DisplaySetType dset, GR_RenderMode render_mode, const GUI_GeoRender *geo, GUI_DisplayOption &disp_opts) const
GR_PrimAcceptResult
Definition: GR_Defines.h:359
int x1() const
Get lower-left corner.
Definition: UT_Rect.h:228
int width() const
Get width/height dimensions.
Definition: UT_Rect.h:248
UT_Vector2T< fpreal32 > UT_Vector2F
int height() const
Get width/height dimensions.
Definition: UT_Rect.h:249
GLboolean r
Definition: glcorearb.h:1222
void dehomogenize()
Express the point in homogeneous coordinates or vice-versa.
Definition: UT_Vector4.h:545
virtual GR_DecorVisibility getDecorVisibility()
virtual void cleanupRender(RE_RenderContext r, GUI_DisplaySetType dset, GR_RenderMode render_mode, const GUI_GeoRender *geo, GUI_DisplayOption &disp_opts) const
type
Definition: core.h:1059
int y1() const
Get lower-left corner.
Definition: UT_Rect.h:229
virtual void doUpdateForRender(RE_RenderContext r)
GLenum src
Definition: glcorearb.h:1793