HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GUI_DetailLook.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: GUI_DetailLook.h ( GUI Library, C++)
7  *
8  * COMMENTS:
9  * A detail look encapsulates all of the data necessary to render a
10  * geometry in a viewport.
11  *
12  * The name is a holdover from when it was derived from UI_Rectangle.
13  */
14 
15 #ifndef __GUI_DetailLook__
16 #define __GUI_DetailLook__
17 
18 #include "GUI_API.h"
19 #include <UT/UT_Assert.h>
20 #include <UT/UT_BoundingBox.h>
21 #include <UT/UT_BoundingSphere.h>
22 #include <UT/UT_Color.h>
23 #include <UT/UT_Map.h>
24 #include <UT/UT_Matrix4.h>
25 #include <UT/UT_PerfMonAutoEvent.h>
26 #include <UT/UT_PerfMonTypes.h>
27 #include <UT/UT_String.h>
28 #include <UT/UT_StringHolder.h>
29 #include <UI/UI_Value.h>
30 #include <GEO/GEO_PackedTypes.h>
31 #include <GU/GU_Detail.h>
32 #include <GU/GU_DetailHandle.h>
33 #include <OP/OP_Network.h>
34 #include <GR/GR_DisplayOption.h>
35 #include "GUI_DisplayOption.h"
36 #include "GUI_RenderCommon.h"
37 #include "GUI_VisInterface.h"
38 #include "GUI_GroupData.h"
40 
41 class RE_Render;
42 class RE_Light;
43 class RE_Material;
44 class RE_Geometry;
45 class SIM_Data;
46 class SIM_RootData;
47 class GUI_GeoRender;
48 class GU_Detail;
50 class gui_Instance;
51 class gui_GeoInstanceInfo;
52 class GUI_VisInterface;
53 
55 {
56 public:
58  const char *detail_name = NULL);
59  virtual ~GUI_DetailLook();
60 
61  virtual const char *className() const;
62 
63  virtual bool isObjectList() const { return false; }
64  virtual bool isDopGuide() const { return false; }
65  virtual bool needsOverlayRender() { return false; }
66 
67  const char *getName() const { return myDetailName; }
68  void setName(const char *name);
69 
70  void setInitialized() { myInitializedFlag = true; }
71  bool isInitialized() const { return myInitializedFlag; }
72 
73  // Find out which node our gdp represents, if any:
74  OP_Node *getObject() const; // inline, below
75  OP_Node *getSop() const; // inline, below
76  OP_Node *getShopsRelativeTo() const; // inline, below
77  int getVisualizedNodeId() const; // inline, below
78 
79  // Set to new object/sop pair. returns true if the object or sop was
80  // actually changed.
81  bool setObject(OP_Node *node);
82  bool setSop(OP_Node *node);
83 
84  // New Viewport codepaths
85 
86  // setupForRender() can be called in parallel. setup() methods are expected
87  // to do non-GL work, such as convexing, surfacing, point normal computation
88  virtual GUI_SetupResult setupForRender(
89  const GUI_DisplayOption &opts,
90  bool show_selections,
91  GR_DecorationOverride selmask_dec,
92  GR_DecorationOverride &sel_dec);
93 
94  // This is a stripped down version of setupForRender() when the viewer is
95  // showing more than 1 viewport. The first viewport rendered does a full
96  // setupForRender(), and subsequent viewports do fastSetupForRender(), since
97  // many things do not change.
98  bool fastSetupForRender(GUI_DisplayOption &opts);
99 
100  // updateForRender() is called in serial. It does all the GL updating based
101  // on the precomputed results in setup().
102  void updateForRender(
103  RE_Render *r,
104  GUI_DisplayOption &opts,
105  RE_LightList *lights,
106  GR_DecorationOverride selmask_dec,
107  const char *view_name,
108  const GR_FrustumList &view_frustums,
109  bool &needs_alpha,
110  bool normal_update,
111  GR_UpdateReason additional_reasons);
112 
113  virtual void cleanupAfterRender(RE_Render *r);
114 
115  // called when this look is no longer displayed, but kept around for a short
116  // time in case it might be displayed in the future
117  void retire();
118  bool isRetired() const { return myRetiredFlag; };
119  void reactivateRetired();
120 
121  // called when temporarily hidden, such as as display flag off.
122  void hide();
123 
124  // appends the contained geometry objects to 'geos'.
125  void getGeometryRenders(
128  int geo_index = -1);
129  void setSingleGeometryRender(OP_Node *node);
130  void resetGeometryRender();
131 
132  // Set selection data to be displayed with this geometry.
133  const UT_Array<GUI_GroupDataHandle> &getSelectData(int geo_index) const;
134  void addSelectData(GUI_GroupDataHandle select_data,
135  int geo_index);
136  void clearSelectData();
137  bool hasSelectData() const;
138 
139  // This method determines whether this detail look should be rendered
140  // for picking. It only checks if it is potentially pickable, but does
141  // not check if it currently being drawn. This only refers to the component
142  // level picking present in SOPs. For object picking, check the isPickable()
143  // flag on the getObject() node.
144  virtual bool isPickable() const;
145 
146  // This method checks if this detail look is even rendered given the
147  // specified display options.
148  virtual bool isVisible(const GUI_DisplayOption &dopt) const;
149 
150  // Returns true if any of the contained details are lit.
151  bool areAnyLit() const { return !isGuide(); }
152 
153  // returns true if any of the contained details are unlit.
154  bool areAnyUnlit() const { return myHasUnlitGeometry; }
155 
156  // returns true if any of the contained details have transparency.
157  bool hasTransparency() const;
158 
159  // returns true if any of the materials are reflective.
160  bool hasReflectiveMaterial() const;
161 
162  // returns a bitfield of decorations supported by all the GR_Primitives in
163  // this look.
164  int64 getPrimDecorMask() const { return myDecorMask; }
165 
166  // This look will not free the detail, it is up to the user
167  int setDetailHandle(GU_DetailHandle handle);
168  virtual int getNumDetailHandles() const; // inlined below
169  virtual GU_DetailHandle getDetailHandle(int i) const;
170  virtual UT_Matrix4D getDetailXform(int i) const;
171  virtual void appendDOPDataName(UT_String &str, int i,
172  bool descriptive) const;
173  virtual const SIM_Data *getDOPData(int i) const;
174  virtual const SIM_RootData *getDOPRootData(int i) const;
175  virtual bool getIsDetailTempSelected(int i) const;
176  // Get world space position
177  virtual UT_Vector4F getDetailPosition(int i) const;
178  virtual void getDetailName(UT_String &name, int i) const;
179  virtual void getDetailPath(UT_String &path, int i) const;
180  virtual void getDetailDescriptiveName(UT_String &name,
181  int i) const;
182  virtual void getDetailDescriptivePath(UT_String &path,
183  int i) const;
184  void signalNodeSelectionChanged(int i) const;
185 
186  virtual void setTempComponentSelection(
188  virtual GU_SelectionHandle getTempComponentSelection(int i) const;
189 
190  virtual void releaseAllTempComponentSelections();
191 
192  void setEnableDOPDisplay(bool enable)
193  { myEnableDOPDisplay = enable; }
194  bool getEnableDOPDisplay() const
195  { return myEnableDOPDisplay; }
196  void setIsChosenDopnet(bool ischosen)
197  { myIsChosenDopnet = ischosen; }
198  bool getIsChosenDopnet() const
199  { return myIsChosenDopnet; }
200 
201  bool hasUserSelection() const;
202 
203  void setLightArray(RE_Light *lights[], int nLights = 0);
204 
205  void setGlobalLightArray(const UT_ValArray<RE_Light *> &lts,
206  bool headlight);
207  void enableAllLights();
208 
209  int getNumLights() const { return myLights.entries(); }
210  RE_Light *getLight(int i) const { return myLights(i); }
211  const UT_ValArray<RE_Light *> &getLights() const { return myLights; }
213  { return myEnabledLights; }
214 
215  static RE_Light *getGlobalHeadlight();
216 
217  // Do not instruct the following two methods to keep the caches unless
218  // you're really sure and know what you're doing.
219  void setUseWireColor(int c, bool clear_caches = true);
220  void setWireColor(const UT_Color &clr,
221  bool clear_caches = true);
222 
223  virtual UT_Color getWireColor(int node_id) const
224  { return myWireColor; }
225 
226  // Methods to manage the view matrix, the user may use any of the
227  // UT_Matrix4 methods to transform the matrix.
228  void setXform(const UT_Matrix4D &mat)
229  { myXform = mat; myXformDirty = true; }
231  { return myXform; }
233  { myPivot = pivot; }
234 
235  void setAllowShadingOpenCurves(bool val);
236  bool shadeOpenCurves() const
237  { return flag.shade_open_curves; }
238 
239  void setDisplayAsSubdiv(bool val);
240 
241  // Methods to handle the look of the detail drawn.
242  void copyFlagsFrom(const GUI_DetailLook *look);
243 
244  virtual void setDetailDisplay(bool display)
245  {
246  if(!flag.overrideDisplay)
247  {
248  if(flag.display != display)
249  myDisplaySetDirty= true;
250  flag.display = display;
251  }
252  }
253 
254  void setGeometry(bool enable) { flag.isGeometry = enable; }
255  void setShowAxes(bool show_axes) { flag.showAxes = show_axes; }
256  void setPicking(bool picking)
257  { flag.shouldPick = picking; }
258 
259  void setRender(bool render) { flag.render = render; }
260  void setTemplate(bool templated)
261  {
262  if(flag.templated!=templated)
263  myDisplaySetDirty=true;
264  flag.templated = templated;
265  }
266  void setFootprint(bool footprint)
267  { if(flag.footprinted!=footprint)
268  myDisplaySetDirty=true;
269  flag.footprinted = footprint; }
270  void setHighlight(bool highlight)
271  { myDisplaySetDirty |= (flag.highlighted != highlight);
272  flag.highlighted = highlight; }
273  void setXray(bool xray)
274  { flag.xray = xray; }
275  void setTargetOutput(bool target_output)
276  { if(flag.targetoutput !=target_output)
277  myDisplaySetDirty=true;
278  flag.targetoutput = target_output; }
279  void setCurrentOutput(bool current_output, bool clear_caches = false);
280  void setDrawLit(int onoff); // it's a bit more complicated now
281  void setDrawCookComponentSelection(bool enable);
282  void setSnappable(int onoff) { flag.snappable = onoff; }
283  void setSecondarySelection(int onoff);
284  void setObjSelection(bool obj_sel);
285  void setObjCurrent(bool obj_current);
286  void setObjSelectionHint(bool obj_sel_hint);
287  virtual void setObjGhost(bool obj_ghost, OP_Node *for_node);
288  void setWireframeOnly(bool wireframe_only)
289  { flag.wireframeOnly = wireframe_only; }
290  void setActiveModel(bool active_model)
291  {
292  if(flag.active_model != active_model)
293  {
294  myDisplaySetDirty = true;
295  flag.active_model = active_model;
296  }
297  }
298 
299  static void setUVObject(OP_Node *object);
300  bool isUVObject() const;
301 
302  void setOnionSkinning(int onion_skin_state);
303  bool isOnionSkinning() const { return flag.onion_skin; }
304  bool isOnionSkinDeformation() const { return flag.onion_skin_deform;}
305 
306  void onionSkinRender(RE_Render *r, GUI_DisplayOption &disp_opt,
307  int nsamples);
308 
309 
310  // Frustum culling is enabled by default.
311  void useFrustumCulling(bool frust_cull)
312  { flag.use_frustum_culling = frust_cull; }
313  bool usesFrustumCulling() const
314  { return flag.use_frustum_culling && !flag.onion_skin
315  && !myLastPointInstanceState &&
316  getUsesGeoRenderInstancing(); }
317 
318  virtual void applyBundleToDisplayedObjects( OP_Bundle *bdl, int object_vis_change_count);
319 
320  // The following methods allow the user to set the display flag while
321  // caching the old value, and resetting it back later.
322  virtual void setDisplaySavingPrevValue(int onoff)
323  {
324  flag.prevDisplay = flag.display;
325  flag.display = onoff;
326  flag.overrideDisplay = true;
327  }
328 
330  {
331  flag.display = flag.prevDisplay;
332  flag.overrideDisplay = false;
333  }
334 
335  // this is not the underlying node's display flag state.
336  bool isDetailDisplayOn() const; // inlined below
337 
338  bool getShowAxes() const { return flag.showAxes; }
339  bool isGeometry() const { return flag.isGeometry; }
340  bool isPickingOn() const { return flag.shouldPick; }
341  bool isRenderOn() const { return flag.render; }
342  bool isTemplated() const { return flag.templated; }
343  bool isFootprinted() const { return flag.footprinted; }
344  bool isHighlighted() const { return flag.highlighted; }
345  virtual bool isXray() const { return flag.xray || myIsXRay; }
346  bool isTargetOutput() const { return flag.targetoutput; }
347  bool isCurrentOutput() const { return flag.currentoutput; }
348  virtual bool isGuide() const { return false; }
349  virtual bool useWireColor(int node_id) const { return flag.usewireclr; }
350  bool drawLit() const { return flag.drawLit; }
351  bool displayAsSubdiv() { return flag.displayAsSubdiv; }
353  { return flag.drawCookComponentSelection; }
354  bool isSnappable() const { return flag.snappable; }
355  bool isSecondarySelection() const { return flag.secondarySelection; }
356  bool isObjSelection() const { return flag.objSelection; }
357  bool isObjCurrent() const { return flag.objCurrent; }
358  bool isObjSelectionHint() const { return flag.objSelectionHint; }
359  bool isObjGhost() const { return flag.objGhost; }
360  bool isWireframeOnly() const { return flag.wireframeOnly; }
361  bool isActiveModel() const { return flag.active_model; }
362  bool isPointInstanced() const { return myHasPointInstancing; }
363  bool hasInstanceFile() const { return myHasInstanceFile; }
365  { return myInstanceUseTransform; }
366 
367 
368  bool needsAlphaPass() const
369  { return flag.needsAlphaPass; }
370  void setNeedsAlphaPass(bool e)
371  { flag.needsAlphaPass = e; }
372 
373  // Flag as a deleted look, so that it can be deleted rather than cached.
374  void setIsDeleted() { flag.being_deleted = true; }
375  bool isDeleted() { return flag.being_deleted; }
376 
377  // Set information about which geometry groups to color.
378  const UT_StringHolder &showGroupMask() const;
379  void setShowGroupMask(const UT_StringHolder &mask);
380  GA_GroupType showGroupType() const;
381  void setShowGroupType(GA_GroupType group_type);
382  int showGroupColorVersion() const;
383  void setShowGroupColorVersion(int version);
384 
385  int getBoundingBox2D(UT_BoundingBox &bbox,
386  const char *name,
387  int use_vertex) const;
388  int getBoundingBox3D(UT_BoundingBox &bbox,
389  const UT_Matrix3R *rot) const;
390 
391  void setViewportMask(unsigned mask)
392  { myViewportMask = mask; }
393  unsigned int getViewportMask() const
394  { return myViewportMask; }
395 
396  static void setGlobalViewSerial(GUI_DisplayOption &disp,int serial, int id)
397  {
398  disp.common().setViewSerialNum(serial, id);
399  }
400 
401  // return the display set that this object belongs to.
403  {
404  if(!myDisplaySetDirty)
405  return myDisplaySet;
406  return privGetDisplaySetType();
407  }
408 
410  { return privGetDisplaySetType(); }
411 
412  void renderObjectName(RE_Render *r,
413  GUI_DisplayOption *dispopt);
414  virtual void renderOrQueueObjectAxes(UT_Vector3FArray &axes,
415  UT_Vector3FArray &pivots);
416  static void renderQueuedObjectAxes(RE_Render *r,
417  GUI_DisplayOption *dispopt,
418  const UT_Vector3FArray &axes,
419  const UT_Vector3FArray &pivots);
420 
421  // The global chosen dopnet is set to filter out the drawing of geometry
422  // flagged as originating from this dopnet.
423  static void setGlobalChosenDopnet(OP_Node *dopnet)
424  {
425  if( dopnet )
426  {
427  dopnet->getFullPath(ourChosenDopnetPath);
428  ourChosenDopnetPathLen = ourChosenDopnetPath.length();
429  }
430  else
431  {
432  ourChosenDopnetPath = 0;
433  ourChosenDopnetPathLen = 0;
434  }
435  }
436  static const char *getGlobalChosenDopnetPath()
437  {
438  return (const char *) ourChosenDopnetPath;
439  }
440 
441  static bool matchesChosenDopnetPath(const char *path)
442  {
443  if( ourChosenDopnetPathLen > 0 &&
444  !strncmp(ourChosenDopnetPath, path, ourChosenDopnetPathLen) &&
445  (path[ourChosenDopnetPathLen] == ':' ||
446  path[ourChosenDopnetPathLen] == '\0') )
447  return true;
448  return false;
449  }
450 
451  // Used to assign a temporary ID to the look.
452  void setLookID(int id) { myID = id; }
453  int getLookID() const { return myID; }
454 
455  // Get/Set the object's viewport LOD
456  GEO_ViewportLOD getObjectLOD() const { return myObjectLOD; }
458  { myObjectLOD = lod; }
459 
460  void useObjectMaterials(bool use_obj_mat);
461  bool getAssignedMaterials(UT_Array<OP_Node *> &nodes) const;
462 
463  virtual bool isTimeDependent(fpreal t);
464  bool areInstancesTimeDependent(fpreal t);
465  virtual int64 getVersion();
466  void bumpVersion() { myLookVersion++; }
467 
468  // The name of the actively rendering or updating viewport
469  static void setActiveViewport(const char *name);
470  // viewname (persp1)
471  static const char *getActiveViewport();
472  // viewname/Material setup
473  static const char *getActiveViewportMatString();
474 
475 
476  static void visibleViewportTypes(bool view_3d, bool view_2d);
477  static bool hasVisible3D();
478  static bool hasVisibleUV();
479 
480  static void visibleUVAttribs(UT_StringArray &attribs);
481  static const UT_StringArray &visibleUVAttribs();
482  static int64 visibleUVAttribSerial();
483 
484  enum { VIEW_3D = 0x1, VIEW_2D = 0x2 }; // for the masks
485  static void visibleViewportBoundaries(
486  bool bound_3d,
487  UT_StringArray &bound_3d_uvs,
489  static bool hasVisibleBoundaries();
490  static bool visible3DBoundary();
491  static const UT_StringArray &visible3DBoundariesInUV();
492  // uv name, view mask
493  static const UT_Array<UT_Pair<UT_StringHolder,int> > &visibleUVBoundaries();
494 
496  { return myActiveVisualizers; }
498  { return myActiveVisualizers.entries(); }
499  void appendActiveVisualizer(int vis_id)
500  { myActiveVisualizers.append(vis_id);
501  myCollectVisPrimitives.append(0); }
503  {
504  myActiveVisualizers.clear();
505  myCollectVisPrimitives.clear();
506  }
508  { return myCollectVisPrimitives(i); }
510  { myCollectVisPrimitives(i) = prim; }
511 
512  void checkForErrors();
513  int64 getNodeErrorID() const { return myOpErrorPosted; }
514 
515  void setRedrawValue(UI_Value *redraw)
516  { myRedrawValue = redraw; }
518  { if(myRedrawValue) myRedrawValue->changed(NULL); }
519 
520  // Wrapper class to avoid sprintf's when not recording
522  {
523  public:
525  {
526  // Early exit if we're not recording
528  bool record_viewport = perf->isRecordingViewportStats();
529  bool record_memory = perf->isRecordingMemoryStats();
530  if (!record_viewport && !record_memory)
531  return;
532 
533  const char *
535  const char *
536  look_name = look.getName();
537 
538  if (record_viewport)
539  {
540  setTimedEventId_(
542  viewport_name, look_name, UT_PERFMON_3D_VIEWPORT));
543  }
544 
545  if (record_memory)
546  {
547  setMemoryEventId_(
549  viewport_name, look_name, UT_PERFMON_3D_VIEWPORT));
550  }
551  }
552  };
553 
554 protected:
555  void cacheNodePtrs();
556 
557  // Multi-object instancing
558  void initInstanceTable();
559  GUI_GeoRender *addInstance(GU_ConstDetailHandle cgdh,
560  const char *name,
561  const UT_Matrix4D &xform,
562  int64 version,
563  int instance_index,
564  int object_id,
565  int inst_object_id,
566  bool is_guide,
567  bool time_dep);
568  void finalizeInstanceTable();
569 
571 
572  bool createObjectInstance(const char *instance_path,
573  int64 base_version,
574  fpreal t,
575  gui_Instance &instance,
576  OBJ_Node *instancer,
578  bool rel_to_sop);
579  void markGeoForRemoval(GUI_GeoRender *gr);
580  void removeDeletedGeos();
581  int64 computeInstanceVersion(const GU_Detail *dtl);
582 
583  // Indicates whether instancing should be implemented using the
584  // GUI_GeoRender instancing capabilities. If false, GUI_GeoRenderShared
585  // objects are used to instance the geometry without true OGL instancing.
586  virtual bool getUsesGeoRenderInstancing() const
587  { return true; }
588 
589  // End multi-object instancing
590  GUI_SetupResult setupAllGeos(const GUI_DisplayOption &disp_opt,
591  bool show_selections,
592  GR_DecorationOverride selmask_dec,
593  GR_DecorationOverride &sel_dec);
594 
595  virtual GUI_GeoRender *getOrCreateGeometryRender(int index);
596 
597  void setXRayOverride(bool xray) { myIsXRay = xray; }
598 
603 
606 
607 private:
608  void generateObjectName(RE_Render *r,
609  GUI_DisplayOption *dispopt,
610  UT_String name,
611  int geo_index,
612  GR_DecorFontSize fontsize,
613  RE_Geometry &geo);
614  bool setupPointInstancing(bool show_selections,
615  GR_DecorationOverride selmask_dec,
616  GR_DecorationOverride &select_dec,
617  fpreal instance_fract,
618  int limit);
619  GUI_DisplaySetType privGetDisplaySetType() const;
620 
621  void updateInstancingStatus();
622  GUI_GeoRender * createGeoRender(int index,const char *opt_suffix=NULL);
623 
624  GUI_GeoRender *checkForDetailCaching(GUI_GeoRender *geo);
625  void freeCachedDetails();
626  void freeDeletedCachedDetails();
627 
628  int getNumOnionSkins() const;
629  const GU_DetailHandle &getOnionSkinDetail(int index) const;
630  GUI_SetupResult processSkins(const GUI_DisplayOption &dopt);
631  void addOnionSkin(OBJ_Node *obj, SOP_Node *sop,
632  fpreal skin_t, fpreal geo_t,
633  bool deforming,
634  bool is_pre_frame);
635  void clearOnionSkins();
636 
637  class GUI_DetailLookFlags
638  {
639  public:
640  GUI_DetailLookFlags()
641  {
642  showAxes = false;
643  render = true;
644  isGeometry = true;
645  shouldPick = true;
646  display = true;
647  templated = false;
648  footprinted = false;
649  highlighted = false;
650  xray = false;
651  targetoutput = false;
652  currentoutput = false;
653  usewireclr = false;
654  drawLit = true;
655  drawCookComponentSelection = true;
656  needsAlphaPass = false;
657  snappable = true;
658  secondarySelection = false;
659  objSelection = false;
660  objCurrent = false;
661  objSelectionHint = false;
662  objGhost = false;
663  wireframeOnly = false;
664  prevDisplay = true;
665  prevShouldPick = true;
666  overrideDisplay = false;
667  displayAsSubdiv = false;
668  shaders_used = false;
669  active_model = false;
670  being_deleted = false;
671  shade_open_curves = false;
672  onion_skin = false;
673  onion_skin_deform = false;
674  use_frustum_culling = true;
675  }
676 
677  bool showAxes:1, // draw the axes of the detail
678  isGeometry:1,
679  render:1, // render the detail
680  shouldPick:1,
681  display:1, // display the detail
682  templated:1,
683  footprinted:1,
684  highlighted:1, // Node has the highlight flag set
685  xray:1, // display wireframe within other geo
686  targetoutput:1, // display sop when in view current
687  // mode
688  currentoutput:1, // current sop when in view current
689  // mode and the display flag is on a
690  // different sop.
691  usewireclr:1, // Override default wire color
692  drawLit:1, // In shaded mode, draw shaded
693 drawCookComponentSelection:1, // Draw the GU cook component selection
694  needsAlphaPass:1, // requires a second pass
695  snappable:1, // is the detail snappable
696  secondarySelection:1, // Draw a secondary selection
697  objSelection:1, // object selection
698  objCurrent:1, // object current flag
699  objSelectionHint:1, // hint that object makes good selection
700  objGhost:1, // ghosted object
701  wireframeOnly:1, // draw in wireframe only
702  prevDisplay:1, // cached value of the previous value of the display flag.
703  prevShouldPick:1, // cached value of the previous value of the pick flag.
704  overrideDisplay:1, // don't allow changes to the display
705  displayAsSubdiv:1, // draw as subdivision.
706  shaders_used:1, // Shaders have been used on the object
707  active_model:1, // Use SOP-level display sets
708  being_deleted:1, // We are in the process of deletion
709  shade_open_curves:1, // Open curves are light-shaded
710  onion_skin:1, // Draw faded images before/after
711  onion_skin_deform:1, // Use deformation onion skinning
712  use_frustum_culling:1; // Frustum culling is allowed
713  };
714  GUI_DetailLookFlags flag;
715 
716  UT_StringHolder myShowGroupMask;
717  GA_GroupType myShowGroupType;
718  int myShowGroupColorVersion;
719  GU_DetailHandle myDetailHandle;
720  GUI_GUSelectionProxyHandle myTempComponentSelection;
721  UT_Array<GU_DetailHandle> myOnionSkinDetails;
722 
723  // Override the wireframe display color.
724  UT_Color myWireColor;
725 
726  int myObjectID;
727  int mySopID;
728  OP_Node *myCachedObject;
729  OP_Node *myCachedSop;
730  UT_String myDetailName;
731  int myID;
732  GEO_ViewportLOD myObjectLOD;
733  bool myIsXRay;
734  bool myIsOnionSkin;
735  UT_String myInstanceObjectRef;
736 
737  UT_ValArray<RE_Light *> myLights;
738  UT_ValArray<RE_Light *> myEnabledLights;
739 
740  unsigned int myViewportMask;
741  bool myEnableDOPDisplay;
742  bool myIsChosenDopnet;
743  bool myNullDetailFlag;
744  bool myRetiredFlag;
745  bool myInitializedFlag;
746 
747  mutable bool myDisplaySetDirty;
748  mutable GUI_DisplaySetType myDisplaySet;
749 
750  fpreal myPrevInstanceFract;
751  int myPrevInstanceLimit;
752  int myInstanceFractSerial;
753  int64 myPointInstanceVersion;
754  int myInstanceXformVersion;
755  fpreal myInstanceTime;
756  int myInstanceObjectID;
757  bool myHasInstancing;
758  bool myHasPointInstancing;
759  bool myInstanceUseTransform;
760  bool myHasTransparentPrimitives;
761  bool myLastPointInstanceState;
762  bool myHasInstanceFile;
763  bool myXformDirty;
764  bool myDetailDirty;
765  UT_Matrix4D myXform;
766  UT_Vector3F myPivot;
767  int64 myOpErrorPosted;
768  int64 myLookVersion;
769 
770  // Variable geometry Instancing
772  int myGeoCountId;
773  const GU_Detail *myTempLastDetail;
774  GUI_GeoRender *myTempLastGeo;
775 
776  // Cached details for cached playback (ie cache SOP)
777  UT_Map<exint, GUI_GeoRender *> myCachedDetailTable;
778  bool myCachingDetails;
779  int64 myCacheSopID;
780  int64 myCacheSopSerial;
781 
782  bool myHasUnlitGeometry;
783  int64 myDecorMask;
784 
785  exint myVisUpdateTime; // last visualization-triggered
786  // update time (visualization
787  // clock measurement)
788  exint myVisUpdateVersion; // version at the time of last
789  // visualization-triggered
790  // update
791 
792  UT_IntArray myActiveVisualizers; // unique ids of visualizers
793  // currently active for look
794 
796  myCollectVisPrimitives;
797 
798  UT_Array<GUI_GeoRender *> myGeosToRemove;
799 
800  class gui_OnionSkinDetail
801  {
802  public:
803  gui_OnionSkinDetail(const GU_DetailHandle &dh)
804  : myDetail(dh), myRender(NULL), myUsedFlag(true)
805  {
806  myDetail.addPreserveRequest();
807  }
808  ~gui_OnionSkinDetail();
809 
810  GU_DetailHandle myDetail;
811  GUI_GeoRender *myRender;
812  bool myUsedFlag;
813  };
814  typedef UT_Map<exint, gui_OnionSkinDetail *> gui_OnionSkins;
815  gui_OnionSkins myOnionSkins;
816 
817  class gui_OnionSkinLayer
818  {
819  public:
820  gui_OnionSkinLayer(int id, fpreal t, const UT_Matrix4D &mat, bool pre)
821  : myDetailID(id), myTime(t), myRender(NULL),
822  myTransform(mat), myIsPreFrame(pre) {}
823 
824  int myDetailID;
825  fpreal myTime;
826  GUI_GeoRender *myRender;
827  UT_Matrix4D myTransform;
828  bool myIsPreFrame;
829  };
830  UT_Array<gui_OnionSkinLayer *> myOnionSkinLayers;
831 
832  class CachedDetailPos {
833  public:
834  CachedDetailPos()
835  : myPos(0,0,0,1)
836  , myCacheCount(-1)
837  , myUniqueId(-1)
838  {}
839 
840  CachedDetailPos(const GU_Detail *detail)
841  {
842  if(detail)
843  {
844  myCacheCount = detail->getMetaCacheCount();
845  myUniqueId = detail->getUniqueId();
846  }
847  }
848 
849  void computePosition(const GU_Detail *detail)
850  {
851  if(detail)
852  {
853  UT_BoundingBox bbox;
854  detail->getBBox(bbox, UT_Matrix4R::getIdentityMatrix());
855 
856  UT_Vector3 point3 = bbox.center();
857  myPos = UT_Vector4F(point3.x(), point3.y(), point3.z(), 1.0);
858  }
859  }
860 
861  bool operator==(const CachedDetailPos& p)
862  {
863  return myCacheCount == p.myCacheCount
864  && myUniqueId == p.myUniqueId;
865  }
866 
867  const UT_Vector4F& position() { return myPos; }
868 
869  private:
870  UT_Vector4F myPos;
871  int myCacheCount;
872  int myUniqueId;
873  };
874  // mutable because these are cached positions
875  mutable UT_ValArray<CachedDetailPos> myDetailPositions;
876 
877  static RE_Light *theHeadlight;
878 
879  static UT_String ourChosenDopnetPath;
880  static int ourChosenDopnetPathLen;
881  static bool ourPickDisplayListUsedFlag;
882 
883  UI_Value *myRedrawValue;
884 };
885 
886 inline int
888 {
889  return myNullDetailFlag ? 0 : 1;
890 }
891 
892 inline OP_Node *
894 {
895  if(myCachedObject)
896  return myCachedObject;
897  if(myObjectID != OP_INVALID_NODE_ID)
898  return OP_Node::lookupNode(myObjectID);
899  return NULL;
900 }
901 
902 inline OP_Node *
904 {
905  if(myCachedSop)
906  return myCachedSop;
907  if(mySopID != OP_INVALID_NODE_ID)
908  return OP_Node::lookupNode(mySopID);
909  return NULL;
910 }
911 
912 inline OP_Node *
914 {
915  OP_Node *node = getObject();
916  if(!node)
917  {
918  node = getSop();
919  if(node)
920  return node->getCreator();
921  }
922  return node;
923 }
924 
925 inline int
927 {
928  if (mySopID != OP_INVALID_NODE_ID)
929  return mySopID;
930  else
931  return myObjectID;
932 }
933 
934 inline bool
936 {
937  if(flag.display)
938  {
939  if((myObjectID == OP_INVALID_NODE_ID || OP_Node::lookupNode(myObjectID))
940  && (mySopID == OP_INVALID_NODE_ID || OP_Node::lookupNode(mySopID)))
941  return true;
942  UT_ASSERT_MSG(!"Stale GUI_DetailLook: ", myDetailName);
943  }
944  return false;
945 }
946 
947 
948 
949 #endif
static const char * getActiveViewportMatString()
static bool matchesChosenDopnetPath(const char *path)
virtual bool getUsesGeoRenderInstancing() const
int64 getNodeErrorID() const
void setTemplate(bool templated)
void setXray(bool xray)
const UT_ValArray< RE_Light * > & getLights() const
void setPivot(const UT_Vector3F &pivot)
bool usesFrustumCulling() const
bool areAnyLit() const
OP_Node * getObject() const
int getVersion(int version)
Definition: ImfVersion.h:116
virtual UT_Color getWireColor(int node_id) const
virtual bool isObjectList() const
bool getIsChosenDopnet() const
Unsorted map container.
Definition: UT_Map.h:83
bool isTemplated() const
void setNeedsAlphaPass(bool e)
void setCollectVisPrimitive(int i, GR_Primitive *prim)
UT_API UT_Performance * UTgetPerformance(bool create=true)
GR_DecorationOverride
Definition: GR_Defines.h:196
int numActiveVisualizers() const
void setSnappable(int onoff)
UT_SharedPtr< GUI_GUSelectionProxy > GUI_GUSelectionProxyHandle
bool hasInstanceFile() const
bool useInstancerObjTransform() const
void setXform(const UT_Matrix4D &mat)
bool isPointInstanced() const
void setFootprint(bool footprint)
bool isDetailDisplayOn() const
bool drawLit() const
GLsizei const GLchar *const * path
Definition: glcorearb.h:3340
GA_API const UT_StringHolder rot
A collection of vertex arrays defining a geometry object. This class acts as a wrapper around multipl...
Definition: RE_Geometry.h:53
void setRedrawValue(UI_Value *redraw)
int startTimedViewportDrawEvent(const char *viewport_name, const char *draw_event_name, UT_PerfMonViewportType viewport_type, bool is_gpu_draw=false)
bool isInitialized() const
GLint GLuint mask
Definition: glcorearb.h:123
bool isFootprinted() const
bool isObjCurrent() const
bool displayAsSubdiv()
SYS_FORCE_INLINE T & x(void)
Definition: UT_Vector3.h:498
virtual bool needsOverlayRender()
#define OP_INVALID_NODE_ID
Definition: OP_ItemId.h:24
OP_Network * getCreator() const
png_uint_32 i
Definition: png.h:2877
bool isWireframeOnly() const
GUI_DisplaySetType
Context specific display options for geometry states.
int getVisualizedNodeId() const
bool isRecordingMemoryStats() const
Return true if Houdini is recording memory stats.
virtual void setDisplaySavingPrevValue(int onoff)
virtual bool useWireColor(int node_id) const
IFDmantra you can see code vm_image_mplay_direction endcode When SOHO starts a render
Definition: HDK_Image.dox:266
bool isSnappable() const
void setHighlight(bool highlight)
void setLookID(int id)
bool getEnableDOPDisplay() const
void setViewportMask(unsigned mask)
GLuint id
Definition: glcorearb.h:654
SYS_FORCE_INLINE T & z(void)
Definition: UT_Vector3.h:502
bool operator==(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
Definition: Dimensions.h:137
long long int64
Definition: SYS_Types.h:107
UT_Matrix4D getXform() const
bool getShowAxes() const
const char * getFullPath(UT_String &str) const
Definition: PRM_ParmOwner.h:48
void setPicking(bool picking)
void setViewSerialNum(int s, int id)
virtual bool isGuide() const
bool isRecordingViewportStats() const
Return true if Houdini is recording viewport draw stats.
OP_Node * getSop() const
void setGeometry(bool enable)
UT_Array< GUI_GeoRender * > myStashedGeoRenderShared
int getLookID() const
bool isSecondarySelection() const
bool isObjGhost() const
UT_Vector3T< T > center() const
#define GUI_API
Definition: GUI_API.h:10
int64 exint
Definition: SYS_Types.h:116
const GR_CommonDispOption & common() const
static const UT_Matrix4T< fpreal > & getIdentityMatrix()
void setObjectLOD(GEO_ViewportLOD lod)
virtual bool isDopGuide() const
UT_Array< GUI_SetupResult > myOnionSkinSetupResults
void setRender(bool render)
RE_Light * getLight(int i) const
GR_DecorFontSize
Definition: GR_Defines.h:177
bool isHighlighted() const
virtual void resetOverrideUsingSavedValue()
GR_UpdateReason
Definition: GR_Defines.h:286
GUI_SetupResult
bool isOnionSkinning() const
GLuint const GLchar * name
Definition: glcorearb.h:785
virtual int getNumDetailHandles() const
bool isPickingOn() const
void setTargetOutput(bool target_output)
bool isRenderOn() const
UT_Map< int, UT_Array< GUI_GroupDataHandle > > mySelectData
bool isGeometry() const
UT_SharedPtr< GU_Selection > GU_SelectionHandle
void setEnableDOPDisplay(bool enable)
static void setGlobalViewSerial(GUI_DisplayOption &disp, int serial, int id)
bool isActiveModel() const
exint getUniqueId() const
Definition: GA_Detail.h:116
GT_API const UT_StringHolder version
virtual bool isXray() const
GUI_DisplaySetType getDisplaySetType() const
UT_Array< GUI_GeoRender * > myGeoRender
GLfloat GLfloat GLfloat GLfloat h
Definition: glcorearb.h:2001
SYS_FORCE_INLINE T & y(void)
Definition: UT_Vector3.h:500
double fpreal
Definition: SYS_Types.h:270
GR_Primitive * getCollectVisPrimitive(int i)
bool isRetired() const
virtual void setDetailDisplay(bool display)
unsigned int getViewportMask() const
#define UT_ASSERT_MSG(ZZ, MM)
Definition: UT_Assert.h:129
void setActiveModel(bool active_model)
OP_Node * getShopsRelativeTo() const
UT_Vector4T< fpreal32 > UT_Vector4F
GEO_ViewportLOD
void clearActiveVisualizers()
int getBBox(UT_BoundingBox *bbox, const GA_PrimitiveGroup *g=0) const
bool needsAlphaPass() const
GEO_ViewportLOD getObjectLOD() const
GA_GroupType
An ordinal enum for the different types of groups in GA.
Definition: GA_Types.h:138
GLuint index
Definition: glcorearb.h:785
bool isTargetOutput() const
void setXRayOverride(bool xray)
GLuint GLfloat * val
Definition: glcorearb.h:1607
bool isObjSelectionHint() const
GR_LightingPass
Definition: GR_Defines.h:124
int64 getMetaCacheCount() const
Definition: GA_Detail.h:2236
int64 getPrimDecorMask() const
GA_API const UT_StringHolder pivot
const UT_ValArray< RE_Light * > & getEnabledLights() const
void setInitialized()
bool drawCookComponentSelection() const
static OP_Node * lookupNode(int unique_id, bool include_proxy=false)
Definition: OP_Node.h:676
void setIsChosenDopnet(bool ischosen)
static void setGlobalChosenDopnet(OP_Node *dopnet)
void useFrustumCulling(bool frust_cull)
bool isOnionSkinDeformation() const
const UT_IntArray & getActiveVisualizers() const
GLboolean r
Definition: glcorearb.h:1221
bool areAnyUnlit() const
const char * getName() const
PerfMonAutoMatEvent(const GUI_DetailLook &look)
UT_Array< GUI_GeoRender * > myOnionSkinRenders
bool isObjSelection() const
static const char * getGlobalChosenDopnetPath()
png_infop png_uint_32 flag
Definition: png.h:2242
void setWireframeOnly(bool wireframe_only)
void setShowAxes(bool show_axes)
bool isCurrentOutput() const
GLint lod
Definition: glcorearb.h:2764
UT_Array< GUI_SetupResult > mySetupResults
int getNumLights() const
void appendActiveVisualizer(int vis_id)
GUI_DisplaySetType updateDisplaySetType()
int startMemoryViewportDrawEvent(const char *viewport_name, const char *draw_event_name, UT_PerfMonViewportType viewport_type, bool is_gpu_draw=false)
bool shadeOpenCurves() const