HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GR_CommonDispOption.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: GR_CommonDispOption.h
7  *
8  * COMMENTS: The display options that are common regardless of the geometry
9  * type (display, template, etc.).
10  */
11 
12 #ifndef __GR_CommonDispOption_h__
13 #define __GR_CommonDispOption_h__
14 
15 #include "GR_API.h"
16 #include <SYS/SYS_AtomicInt.h>
17 #include <SYS/SYS_Math.h>
18 #include <UT/UT_Array.h>
19 #include <UT/UT_Color.h>
20 #include <UT/UT_String.h>
21 #include <UT/UT_SymbolTable.h>
22 #include <RE/RE_TextureTypes.h>
23 #include <RE/RE_RenderContext.h>
24 #include <GEO/GEO_PrimTypeCompat.h>
25 #include <GU/GU_OnionSkin.h>
26 #include <GU/GU_SelectType.h>
27 #include "GR_HandleParts.h"
28 #include "GR_DisplayColors.h"
29 #include "GR_Defines.h"
30 
31 class GR_SchemeColors;
32 class GR_LightList;
33 class GR_MaterialAtlas;
34 
35 #define FLAG_ACCESSORS(FLAGS, METHOD, FLAG) \
36  bool METHOD() const { return FLAGS.FLAG; } \
37  void METHOD(bool onoff) { FLAGS.FLAG = onoff; }
38 
39 #define FLAG_ACCESSORS_BUMP_OPTS(FLAGS, METHOD, FLAG) \
40  bool METHOD() const { return FLAGS.FLAG; } \
41  void METHOD(bool onoff) { if(FLAGS.FLAG != onoff) mySerialNum++; \
42  FLAGS.FLAG = onoff; }
43 
45 {
46 public:
47  GR_CommonDispOption(bool for_lops);
50 
51  // Return true if the load/save was successful, and false otherwise.
52  bool save(std::ostream &, int indent=0) const;
53  bool load(UT_IStream &);
54 
56 
57  // The color scheme names are simply the suffixes applied to the
58  // default color scheme file 3DSceneColors. The dot '.' should
59  // not be included in the scheme name.
60  void setColorScheme(const char *scheme_name);
61  const UT_String &getColorScheme() const { return myColorScheme; }
62  static void reloadAllColorSchemes();
63 
64  // Grab the colors and the color scheme from opt:
65  void setColors(const GR_CommonDispOption &opt);
66 
67  bool compatibleWith(const GR_CommonDispOption &opt) const;
68 
69  // Grab the color from the current pass
71  { return myColors[c][myGammaPassPtr?*myGammaPassPtr:0]; }
72 
73  void setGammaPassPtr(int *p) { myGammaPassPtr = p; }
74 
75  void setColor(GR_DisplayColor color_name,
76  const UT_Color &c);
77  void setColor(GR_DisplayColor target_color,
78  GR_DisplayColor source_color);
79  const UT_Color &getColor(GR_DisplayColor color_name,
80  bool gamma = false) const
81  { return myColors[color_name][gamma?1:0]; }
82  bool getColorByName(const char *name, UT_Color &color);
83 
84  void setParentViewportID(int id) { myParentViewportID = id; }
85  int parentViewportID() const { return myParentViewportID; }
86 
87  // Color methods (soon to be deprecated; use color(GR_..._COLOR)
88 #define GET_COL(func, val) \
89  const UT_Color &func() const \
90  { return myColors[val][myGammaPassPtr?*myGammaPassPtr:0]; }
91 
92  GET_COL(backgndColor, GR_BACKGROUND_COLOR)
93  GET_COL(backgndBottomColor, GR_BACKGROUND_BOTTOM_COLOR)
94  GET_COL(defaultWireColor, GR_WIREFRAME_COLOR)
95  GET_COL(wireOverColor, GR_WIRE_OVER_COLOR)
96  GET_COL(ghostFillColor, GR_GHOST_FILL_COLOR)
97  GET_COL(selPrimColor, GR_SELECTED_PRIM_COLOR)
98  GET_COL(auxSelPrimColor1, GR_AUX_SELECTED_PRIM1_COLOR)
99  GET_COL(auxSelPrimColor2, GR_AUX_SELECTED_PRIM2_COLOR)
100  GET_COL(cookSelectionColor, GR_COOK_SELECTION_COLOR)
101  GET_COL(primClosureColor, GR_PRIM_CLOSURE_COLOR)
102  GET_COL(regAuxColor, GR_AUX_GEO_COLOR)
103  GET_COL(selAuxColor, GR_SELECTED_AUX_GEO_COLOR)
104  GET_COL(profileColor, GR_PROFILE_WIRE_COLOR)
105  GET_COL(xGnomonColor, GR_X_GNOMON_COLOR)
106  GET_COL(yGnomonColor, GR_Y_GNOMON_COLOR)
107  GET_COL(zGnomonColor, GR_Z_GNOMON_COLOR)
108  GET_COL(axesColor, GR_AXES_COLOR)
109  GET_COL(xAxisColor, GR_X_AXIS_COLOR)
110  GET_COL(yAxisColor, GR_Y_AXIS_COLOR)
111  GET_COL(zAxisColor, GR_Z_AXIS_COLOR)
112  GET_COL(selAxesColor, GR_SELECTED_AXES_COLOR)
113  GET_COL(primInfoColor, GR_PRIM_INFO_COLOR)
114  GET_COL(selPrimInfoColor, GR_SELECTED_PRIM_INFO_COLOR)
115  GET_COL(pointColor, GR_POINT_COLOR)
116  GET_COL(selPointColor, GR_SELECTED_POINT_COLOR)
117  GET_COL(guide1Color, GR_GUIDE1_COLOR)
118  GET_COL(guide2Color, GR_GUIDE2_COLOR)
119  GET_COL(guideSelColor, GR_OBJECT_SELECT_COLOR)
120  GET_COL(cplaneColor, GR_CPLANE_COLOR)
121  GET_COL(activeCplaneColor, GR_ACTIVE_CPLANE_COLOR)
122  GET_COL(selCplaneColor, GR_SELECTED_CPLANE_COLOR)
123  GET_COL(gridColor, GR_GRID_COLOR)
124  GET_COL(heightVectorColor, GR_HEIGHT_VECTOR_COLOR)
125  GET_COL(gridXRulerColor, GR_GRID_X_RULER_COLOR)
126  GET_COL(gridYRulerColor, GR_GRID_Y_RULER_COLOR)
127  GET_COL(gridZRulerColor, GR_GRID_Z_RULER_COLOR)
128  GET_COL(handleColor, GR_HANDLE_COLOR)
129  GET_COL(pickedHandleColor, GR_PICKED_HANDLE_COLOR)
130  GET_COL(selHandleColor, GR_SELECTED_HANDLE_COLOR)
131  GET_COL(peanutColor, GR_PEANUT_COLOR)
132  GET_COL(labelColor, GR_LABEL_COLOR)
133  GET_COL(pillTextColor, GR_PILL_TEXT_COLOR)
134  GET_COL(pillBGColor, GR_PILL_BG_COLOR)
135  GET_COL(pillOutlineColor, GR_PILL_OUTLINE_COLOR)
136  GET_COL(pillCamLockTextColor, GR_PILL_CAM_LOCK_TEXT_COLOR)
137  GET_COL(pillCamLockBGColor, GR_PILL_CAM_LOCK_BG_COLOR)
138  GET_COL(pillCamLockOutlineColor, GR_PILL_CAM_LOCK_OUTLINE_COLOR)
139  GET_COL(snapshotColor, GR_SNAPSHOT_COLOR)
140  GET_COL(selLabelColor, GR_SELECTED_LABEL_COLOR)
141  GET_COL(selPillTextColor, GR_SELECTED_PILL_TEXT_COLOR)
142  GET_COL(selPillBGColor, GR_SELECTED_PILL_BG_COLOR)
143  GET_COL(selPillOutlineColor, GR_SELECTED_PILL_OUTLINE_COLOR)
144  GET_COL(overlayLabelColor, GR_OVERLAY_LABEL_COLOR)
145  GET_COL(auxOverlayLabelColor, GR_AUX_OVERLAY_LABEL_COLOR)
146  GET_COL(handlePivotColor, GR_HANDLE_PIVOT_COLOR)
147  GET_COL(handleAxisColor, GR_HANDLE_AXIS_COLOR)
148  GET_COL(handleXAxisColor, GR_HANDLE_X_AXIS_COLOR)
149  GET_COL(handleYAxisColor, GR_HANDLE_Y_AXIS_COLOR)
150  GET_COL(handleZAxisColor, GR_HANDLE_Z_AXIS_COLOR)
151  GET_COL(handlePlaneAxisColor, GR_HANDLE_PLANE_AXIS_COLOR)
152  GET_COL(handleTumbleSphereColor, GR_HANDLE_TUMBLE_SPHERE_COLOR)
153  GET_COL(handleTracerColor, GR_HANDLE_TRACER_COLOR)
154  GET_COL(handleDeltaTextColor, GR_HANDLE_DELTA_TEXT_COLOR)
155  GET_COL(handleDeltaTextShadowColor, GR_HANDLE_DELTA_TEXT_SHADOW_COLOR)
156  GET_COL(handleBendColor, GR_HANDLE_BEND_COLOR)
157  GET_COL(handleTwistColor, GR_HANDLE_TWIST_COLOR)
158  GET_COL(cplaneHandleXlateColor, GR_CPLANE_HANDLE_XLATE_COLOR)
159  GET_COL(cplaneHandleRotateColor, GR_CPLANE_HANDLE_ROTATE_COLOR)
160  GET_COL(cplaneHandleBorderColor, GR_CPLANE_HANDLE_BORDER_COLOR)
161  GET_COL(orthoGridColor, GR_ORTHO_GRID_COLOR)
162  GET_COL(orthoGridOriginColor, GR_ORTHO_GRID_ORIGIN_COLOR)
163  GET_COL(uvGridColor, GR_UV_GRID_COLOR)
164  GET_COL(uvGridOriginColor, GR_UV_GRID_ORIGIN_COLOR)
165  GET_COL(uvGridBoundaryColor, GR_UV_GRID_BOUNDARY_COLOR)
166  GET_COL(objSelectColor, GR_OBJECT_SELECT_COLOR)
167  GET_COL(objCurrentColor, GR_OBJECT_CURRENT_COLOR)
168  GET_COL(objSelectHintColor, GR_OBJECT_SELECT_HINT_COLOR)
169  GET_COL(objGhostColor, GR_OBJECT_GHOST_COLOR)
170  GET_COL(uvBackFaceFillColor, GR_UV_BACKFACE_FILL_COLOR)
171  GET_COL(uvOverlapFillColor, GR_UV_OVERLAP_FILL_COLOR)
172  GET_COL(uvSelBackFaceFillColor, GR_SELECTED_UV_BACKFACE_FILL_COLOR)
173  GET_COL(ikCriticalZoneColor, GR_IK_CRITICAL_ZONE_COLOR)
174  GET_COL(viewMaskOverlayColor, GR_VIEW_MASK_OVERLAY_COLOR)
175  GET_COL(cameraMaskColor, GR_CAMERA_MASK_COLOR)
176  GET_COL(lockedCameraMaskColor, GR_LOCKED_CAMERA_MASK_COLOR)
177  GET_COL(lockedTumbleMaskColor, GR_LOCKED_TUMBLE_MASK_COLOR)
178  GET_COL(cameraOverlayColor, GR_CAMERA_OVERLAY_COLOR)
179  GET_COL(textColor, GR_TEXT_COLOR)
180  GET_COL(textShadowColor, GR_TEXT_SHADOW_COLOR)
181  GET_COL(geoWarningColor, GR_GEO_WARNING_COLOR)
182  GET_COL(selectBoxOuterLineColor, GR_SELECTBOX_OUTER_LINE_COLOR)
183  GET_COL(selectBoxInnerLineColor, GR_SELECTBOX_INNER_LINE_COLOR)
184  GET_COL(selectBoxFillColor, GR_SELECTBOX_FILL_COLOR)
185  GET_COL(handleLocateColor, GR_HANDLE_LOCATE_COLOR)
186  GET_COL(handleLocatePassiveColor, GR_HANDLE_LOCATE_PASSIVE_COLOR)
187  GET_COL(objectNameColor, GR_OBJECT_NAME_COLOR)
188  GET_COL(pointTrailColor, GR_POINT_TRAIL_COLOR)
189  GET_COL(selPointTrailColor, GR_POINT_TRAIL_SELECTED_COLOR)
190  GET_COL(renderBorderColor, GR_RENDER_BORDER_COLOR)
191  GET_COL(renderInactiveBorderColor, GR_RENDER_INACTIVE_BORDER_COLOR)
192  GET_COL(renderTextColor, GR_RENDER_TEXT_COLOR)
193  GET_COL(renderLocateColor, GR_RENDER_LOCATE_COLOR)
194  GET_COL(renderBarColor, GR_RENDER_BAR_COLOR)
195  GET_COL(flattenPinColor, GR_FLATTEN_PIN_COLOR)
196  GET_COL(flattenPinSelColor, GR_FLATTEN_PIN_SELECTED_COLOR)
197  GET_COL(flattenInitialPinColor, GR_FLATTEN_INITIAL_PIN_COLOR)
198  GET_COL(messageColor, GR_MESSAGE_COLOR)
199  GET_COL(promptColor, GR_PROMPT_COLOR)
200  GET_COL(warningColor, GR_WARNING_COLOR)
201  GET_COL(errorColor, GR_ERROR_COLOR)
202  GET_COL(successColor, GR_SUCCESS_COLOR)
203  GET_COL(overlayBackgroundColor, GR_OVERLAY_BACKGROUND_COLOR)
204  GET_COL(boundaryColor, GR_BOUNDARY_COLOR)
205  GET_COL(edgeTipColor, GR_EDGE_TIP_COLOR)
206  GET_COL(viewPivotFGColor, GR_VIEW_PIVOT_FG_COLOR)
207  GET_COL(viewPivotBGColor, GR_VIEW_PIVOT_BG_COLOR)
208  GET_COL(bboxOutlineColor, GR_BBOX_OUTLINE_COLOR)
209  GET_COL(bboxSolidColor, GR_BBOX_SOLID_COLOR)
210  GET_COL(backfaceTint, GR_BACKFACE_TINT_COLOR)
211  GET_COL(overviewViewRegionColor, GR_OVERVIEW_VIEW_REGION_COLOR)
212  GET_COL(overviewWinRegionColor, GR_OVERVIEW_WIN_REGION_COLOR)
213  GET_COL(overviewNominalWinRegionColor, GR_OVERVIEW_NOMINAL_WIN_REGION_COLOR)
214  GET_COL(usdModifiedPrimitiveColor, GR_USD_MODIFIED_PRIMITIVE_COLOR)
215 
216  const UT_Color &wireColor() const
217  { return myCurrentWireColor[myGammaPassPtr?*myGammaPassPtr:0]; }
218  const UT_Color &crtAuxColor() const
219  { return myColors[myCrtAuxColor][myGammaPassPtr?*myGammaPassPtr:0]; }
220 
222  {
223  alpha = myAlphas[GR_LOCATE_ALPHA];
224  return myColors[GR_LOCATE_COLOR][myGammaPassPtr?*myGammaPassPtr:0];
225  }
226  void componentLocateColor(int component_type,
227  GU_SelectionRule sel_rule,
228  UT_Color &clr, fpreal &alpha) const;
229  void componentLocateNearColor(UT_Color &clr, fpreal &alpha) const;
230 
231 #undef GET_COL
232 
234  { return myAlphas[alpha_name]; }
235  bool getAlphaByName(const char *name, fpreal &alpha);
236 #define GET_ALPHA(func, val) fpreal func() const { return myAlphas[val]; }
237  GET_ALPHA(objGhostAlpha, GR_OBJECT_GHOST_ALPHA)
238  GET_ALPHA(selectBoxFillAlpha, GR_SELECTBOX_ALPHA)
239  GET_ALPHA(cplaneAlpha, GR_CPLANE_ALPHA)
240  GET_ALPHA(cplaneLineAlpha, GR_CPLANE_LINE_ALPHA)
241  GET_ALPHA(cplaneLineFadedAlpha, GR_CPLANE_LINE_FADED_ALPHA)
242  GET_ALPHA(gridLineAlpha, GR_GRID_LINE_ALPHA)
243  GET_ALPHA(gridLineFadedAlpha, GR_GRID_LINE_FADED_ALPHA)
244  GET_ALPHA(gridRulerAlpha, GR_GRID_RULER_ALPHA)
245  GET_ALPHA(gridRulerFadedAlpha, GR_GRID_RULER_FADED_ALPHA)
246  GET_ALPHA(handleLocateAlpha, GR_HANDLE_LOCATE_ALPHA)
247  GET_ALPHA(handleAxisLocateAlpha, GR_HANDLE_AXIS_LOCATE_ALPHA)
248  GET_ALPHA(handleTumbleSphereAlpha, GR_HANDLE_TUMBLE_SPHERE_ALPHA)
249  GET_ALPHA(handleTracerFillAlpha, GR_HANDLE_TRACER_FILL_ALPHA);
250  GET_ALPHA(fillSelectionAlpha, GR_FILL_SELECTION_ALPHA)
251  GET_ALPHA(fillSelectionWireOverAlpha, GR_FILL_SELECTION_WIRE_OVER_ALPHA)
252  GET_ALPHA(uvFillAlpha, GR_UV_FILL_ALPHA)
253  GET_ALPHA(uvOverlapFillAlpha, GR_UV_OVERLAP_FILL_ALPHA)
254  GET_ALPHA(overlayBackgroundAlpha, GR_OVERLAY_BACKGROUND_ALPHA)
255  GET_ALPHA(pillMenuBGAlpha, GR_PILL_MENU_BG_ALPHA)
256  GET_ALPHA(selPillMenuBGAlpha, GR_SELECTED_PILL_MENU_BG_ALPHA)
257  GET_ALPHA(bboxOutlineAlpha, GR_BBOX_OUTLINE_ALPHA)
258  GET_ALPHA(bboxSolidAlpha, GR_BBOX_SOLID_ALPHA)
259  GET_ALPHA(backfaceTintBlend, GR_BACKFACE_TINT_ALPHA)
260  GET_ALPHA(usdSelectedPrimitiveBlend, GR_USD_SELECTED_PRIMITIVE_ALPHA)
261  GET_ALPHA(usdModifiedPrimitiveBlend, GR_USD_MODIFIED_PRIMITIVE_ALPHA)
262 #undef GET_ALPHA
263 
264  const GR_HandleParts &handleParts() const { return myHandleParts; }
265  GR_HandleParts &handleParts() { return myHandleParts; }
266 
267  GR_DecorFontSize getDecorFontSize() const { return myDecorFontSize; }
268  void setDecorFontSize(GR_DecorFontSize s){myDecorFontSize=s;}
269 
270  fpreal markerSize() const { return myMarkerSize*myDPIScale; }
272  { return myMarkerSize; }
274  { myMarkerSize = SYSmax(size, 0.1); }
275 
276  // Methods for accessing (setting/getting) the various flags.
277  FLAG_ACCESSORS_BUMP_OPTS(mySaveFlags, drawTexture, drawTexture)
278  FLAG_ACCESSORS_BUMP_OPTS(myNoSaveFlags, drawMultiTexture, drawMultiTexture)
279  FLAG_ACCESSORS(mySaveFlags, drawTransparent, drawTransparent)
280  FLAG_ACCESSORS(mySaveFlags, showMaterials, showMaterials)
281  FLAG_ACCESSORS(mySaveFlags, drawDisplacement, drawDisplacement)
282  FLAG_ACCESSORS(mySaveFlags, drawTexturedSpots, drawTexturedSpots)
283  FLAG_ACCESSORS(mySaveFlags, drawShadows, drawShadows)
284  FLAG_ACCESSORS(mySaveFlags, drawTransparentMaps, drawTransparentMaps)
285  FLAG_ACCESSORS(mySaveFlags, highQualityLighting, highQualityLighting)
286  FLAG_ACCESSORS(mySaveFlags, drawDiffuse, drawDiffuse)
287  FLAG_ACCESSORS(mySaveFlags, drawAmbient, drawAmbient)
288  FLAG_ACCESSORS(mySaveFlags, drawEmission, drawEmission)
289  FLAG_ACCESSORS(mySaveFlags, useLighting, useLighting)
290  FLAG_ACCESSORS(mySaveFlags, ambientOcclusion, ambientOcclusion)
291  FLAG_ACCESSORS(mySaveFlags, removeBackface, removeBackface)
292  FLAG_ACCESSORS(mySaveFlags, fillSelection, fillSelection)
293  FLAG_ACCESSORS(mySaveFlags, solidOnly, solidOnly)
294  FLAG_ACCESSORS(mySaveFlags, correctBG, correctBG)
295  FLAG_ACCESSORS_BUMP_OPTS(mySaveFlags, polygonConvexQuality,
296  polygonConvexQuality)
297  FLAG_ACCESSORS_BUMP_OPTS(mySaveFlags, drawPartSprite, drawPartSprite)
298  FLAG_ACCESSORS_BUMP_OPTS(mySaveFlags, orientDiscs, orientDiscs)
299 
300  FLAG_ACCESSORS_BUMP_OPTS(mySaveFlags, shadeOpenCurves, shadeOpenCurves)
301  FLAG_ACCESSORS(mySaveFlags, displayAsSubdiv, displayAsSubdiv)
302 
303  FLAG_ACCESSORS_BUMP_OPTS(mySaveFlags, drawHullsOnly, drawHullsOnly)
304  FLAG_ACCESSORS_BUMP_OPTS(mySaveFlags, drawPartOrigin, drawPartOrigin)
305  FLAG_ACCESSORS(mySaveFlags, drawHandles, drawHandles)
306  FLAG_ACCESSORS_BUMP_OPTS(mySaveFlags, showObjectSelection,
307  showObjectSelection)
308 
309  FLAG_ACCESSORS(mySaveFlags, use2DLimitsFor3D, use2DTexLimits)
310  FLAG_ACCESSORS(mySaveFlags, dynamicTexControl, dynamicTexControl)
311  FLAG_ACCESSORS(mySaveFlags, dynamicReduceTex2D, reduceTex2D )
312  FLAG_ACCESSORS(mySaveFlags, dynamicReduceTex3D, reduceTex3D )
313  FLAG_ACCESSORS(mySaveFlags, dynamicReduceMipMap, reduceMipMap )
314  FLAG_ACCESSORS(mySaveFlags, dynamicReduceBitDepth, reduceBitDepth )
315 
316  FLAG_ACCESSORS_BUMP_OPTS(mySaveFlags, overrideColorAttrib,
317  overrideColorAttrib);
318  FLAG_ACCESSORS(mySaveFlags, pickWireAsSolid, pickWireAsSolid)
319  FLAG_ACCESSORS(mySaveFlags, wireOverPacked, wireOverPacked)
320  FLAG_ACCESSORS(mySaveFlags, showGeoColor, showGeoColor )
321 
322  FLAG_ACCESSORS(myNoSaveFlags, applyVisualizers, applyVisualizers)
323  FLAG_ACCESSORS(myNoSaveFlags, snapToSelected, snapToSelected)
324  FLAG_ACCESSORS(myNoSaveFlags, showComponentSelections, showComponentSelections)
325 
326  // NB: This flag is somewhat overloaded. At SOPs it determines whether
327  // we're showing the temporary or cook selections. At DOPs it also
328  // indicates whether we're drawing temporary DETAIL selections.
329  FLAG_ACCESSORS(myNoSaveFlags, showTempSelections, showTempSelections)
330 
331  FLAG_ACCESSORS(myNoSaveFlags, pickFrontFaces, pickFrontFaces)
332  FLAG_ACCESSORS(myNoSaveFlags, pickBackFaces, pickBackFaces)
333  FLAG_ACCESSORS_BUMP_OPTS(myNoSaveFlags, drawAuxColors, drawAuxColors)
334  FLAG_ACCESSORS_BUMP_OPTS(myNoSaveFlags, forceWireColor, forceWireColor)
335  FLAG_ACCESSORS(myNoSaveFlags, shadingOpenCurves, shadingOpenCurves)
336 
337  // This returns true if the interactive mode display option is on
338  FLAG_ACCESSORS(mySaveFlags, interactiveEnable, interactiveEnable)
339 
340 
341  FLAG_ACCESSORS(mySaveFlags, outlineSelection, outlineSelection)
342 
343  // This returns true if the user is interactively moving a handle or
344  // tumbling, independent of the interative enable flag.
345  FLAG_ACCESSORS(myNoSaveFlags, interactiveMove, interactive)
346 
347  FLAG_ACCESSORS_BUMP_OPTS(mySaveFlags, pointInstancing, pointInstancing)
348 
349  bool cuspNormals() const
350  { return mySaveFlags.cuspNormals; }
351  void cuspNormals(bool c)
352  {
353  if(c != mySaveFlags.cuspNormals)
354  {
355  mySerialNum++;
356  mySaveFlags.cuspNormals = c;
357  }
358  }
360  { return myNormalCuspAngle; }
362  {
363  a = SYSclamp(a, 0.0, 180.0);
364  if(!SYSisEqual(a, myNormalCuspAngle))
365  {
366  mySerialNum++;
367  myNormalCuspAngle = a;
368  }
369  }
371  { return myVertNormalLimit; }
372  void setVertexNormalLimit(int poly_limit)
373  {
374  poly_limit = SYSmax(0, poly_limit);
375  if(poly_limit != myVertNormalLimit)
376  {
377  mySerialNum++;
378  myVertNormalLimit = poly_limit;
379  }
380  }
381 
383  {
386  TANGENT_DISABLE
387  };
389  {
390  if(myTangentMethod != method)
391  {
392  mySerialNum++;
393  myTangentMethod = method;
394  }
395  }
396  gr_TangentMethod generateTangents() const { return myTangentMethod; }
397 
398  bool limitTextureSize() const { return mySaveFlags.limitTextureSize; }
399  void limitTextureSize(bool ls){ mySaveFlags.limitTextureSize = ls;
400  myUpdates.texSize = true; }
401 
402  bool limitTexture3DSize() const { return mySaveFlags.limitTexture3DSize; }
403  void limitTexture3DSize(bool ls){ mySaveFlags.limitTexture3DSize = ls;
404  myUpdates.tex3DSize = true; }
405 
406  int textureMemLimitMB() const { return myTextureMemLimitMB; }
407  void textureMemLimitMB(int max_size)
408  { myTextureMemLimitMB = SYSmax(32, max_size);
409  myUpdates.textureMem = true; }
410 
411  // Specifies the anisotropic sampling for textures. getTextureAnisotropy()
412  // must be called when rendering, to check for the GL extension.
413  int getTextureAnisotropy(RE_RenderContext r) const;
414  int textureAnisotropy() const;
415  void textureAnisotropy(int ta);
416 
417  // Always use the version of getHDRTextureFormat() with RE_Render * when
418  // rendering, to ensure hardware compatibility with the format.
419  RE_TextureCompress getHDRTextureFormat(RE_RenderContext r) const;
420  int getHDRTextureFormat() const;
421  void setHDRTextureFormat(int hdrformat); // 2 = full HDR, 1=16b HDR, 0=8b
422  void setDynamicFormat(int format); // -1 = compressed 8b
423  int getDynamicFormat() const { return myDynamicFormat; }
424 
425 
426  RE_TextureCompress getHDRTexture3DFormat(RE_RenderContext r) const;
427  int getHDRTexture3DFormat() const;
428  void setHDRTexture3DFormat(int hdrformat); // 2 = full HDR, 1=16b HDR, 0=8b
429  void setDynamic3DFormat(int format);
430  int getDynamic3DFormat() const { return myDynamic3DFormat; }
431 
432  // Scale all textures down
433  void setTextureScale(float sc); // 0.0 (min size) to 1.0 (full size)
434  float getTextureScale() const; // texture scale is applied before limit
435  float getUserTextureScale() const; // texture scale w/o dynamics applied
436  void setDynamicScale(float sc); // For dynamic cache control
437  float getDynamicScale() const;
438 
439  void setTexture3DScale(float sc); // 0.0 (min size) to 1.0 (full size)
440  float getTexture3DScale() const; // texture scale is applied before limit
441  float getUserTexture3DScale() const;// texture scale w/o dynamics applied
442  void setDynamic3DScale(float sc); // For dynamic cache control
443  float getDynamic3DScale() const;
444 
445  // Use bilinear or nearest texel sampling for layers.
446  void interpolateLayers(bool do_interp) { mySaveFlags.interpolateLayers = do_interp; }
447  bool interpolateLayers() const { return mySaveFlags.interpolateLayers; }
448 
449  // Maximum particle array texture size
450  void setParticleTextureSize(int max_w, int max_h);
451  void getParticleTextureSize(int &max_w, int &max_h) const;
452 
453  void setParticleDisplayType(GR_ParticleType t);
454  GR_ParticleType particleDisplayType() const;
455 
456  // Limit texture resolution
457  void setMaxTextureSize(bool limit, int max_w=0, int max_h=0);
458  void getMaxTextureSize(int &max_w, int &max_h) const;
459  void getMaxTextureSize(RE_RenderContext r, int &max_w, int &max_h) const;
460 
461  void setMaxTexture3DSize(bool limit, int max_w=0, int max_h=0, int max_d=0);
462  void getMaxTexture3DSize(int &max_w, int &max_h, int &max_d) const;
463  void getMaxTexture3DSize(RE_RenderContext r, int &max_w, int &max_h,
464  int &max_d) const;
465 
466  bool mipMapTextures() const;
467  void mipMapTextures(bool onoff);
468  void setDynamicMipMap(bool onoff);
469  bool getDynamicMipMap() const { return myNoSaveFlags.dynamicMipSetting; }
470 
471  void resetDynamicParms();
472 
473  void allowDeferredTextureLoad(bool a) { myNoSaveFlags.deferTexLoad = a; }
474  bool allowDeferredTextureLoad() const { return myNoSaveFlags.deferTexLoad; }
475 
476  bool getHighQualityLighting(RE_RenderContext r) const;
477 
478  void alphaPass(GR_AlphaPass pass) { myAlphaPass = pass; }
479  GR_AlphaPass alphaPass() const { return myAlphaPass; }
480 
481  int getTransparentQuality() const { return myTransparentQuality; }
482  void setTransparentQuality(int q) { myTransparentQuality=SYSclamp(q,-1,2); }
483 
484  fpreal getTransparencyCutoff() const { return myTransparencyCutoff; }
485  void setTransparencyCutoff(fpreal c) { myTransparencyCutoff = c; }
486 
487  fpreal getGSplatsAlphaCulling() const { return myGSplatsAlphaCulling; }
489  { myGSplatsAlphaCulling = SYSclamp(c, 0.0, 1.0); }
490 
491  fpreal getDisplacementQuality() const { return myDisplacementQuality; }
493  { myDisplacementQuality = SYSmax(q, 0.0); }
494 
495  int getLightSampling() const { return myLightSamples; }
496  void setLightSampling(int s) { myLightSamples = SYSclamp(s,1,100); }
497 
498  int getVolumeQuality() const { return myVolumeQuality; }
499  void setVolumeQuality(int q) { myVolumeQuality = SYSclamp(q,0,3); }
500 
501  fpreal getVolumeAmbientShadows() const { return myVolumeAmbientShadows; }
503  { myVolumeAmbientShadows = SYSmax((fpreal) 0, q); }
504 
505  int getVolumeBSplines() const { return myVolumeBSplines; }
506  void setVolumeBSplines(int bs) { myVolumeBSplines = bs; }
507 
508  int getHeightFieldWireStride() const { return myHeightFieldWireStride; }
510  {
511  stride = SYSmax(1, stride);
512  if (stride != myHeightFieldWireStride)
513  mySerialNum++;
514 
515  myHeightFieldWireStride = stride;
516  }
517 
518  bool getActiveRender() const { return myActiveRender; }
519  void setActiveRender(bool active) { myActiveRender = active; }
520 
521  bool volumeWireAsPoints() const { return false; }
522  void volumeWireAsPoints(bool vw){ }
523 
524  // DPI support.
525  void DPIScale(fpreal f) { myDPIScale = f; }
526  fpreal DPIScale() const { return myDPIScale; }
527 
528  void autoDPIScale(bool dpi);
529  bool autoDPIScale() const { return mySaveFlags.autoDPIScale; }
530 
531  // Reflection cube maps
532  bool useReflectionMaps() const
533  { return mySaveFlags.enableReflectionMaps; }
534  void useReflectionMaps(bool e)
535  { mySaveFlags.enableReflectionMaps = e; }
536  bool hdrReflectionMaps() const
537  { return mySaveFlags.hdrReflectionMaps; }
538  void hdrReflectionMaps(bool e)
539  { myUpdates.hdrReflect = true;
540  mySaveFlags.hdrReflectionMaps = e; }
541  int reflectionMapSize() const { return myReflectMapSize; }
542  void reflectionMapSize(int wh)
543  { myUpdates.reflectSize = true;
544  myReflectMapSize = SYSclamp(wh, 16, 16384); }
545  fpreal reflectionMinLevel() const { return myReflectMinLevel; }
547  { myReflectMinLevel = SYSclamp(lvl, 0.0, 1.0); }
548 
549  // Agents
550  FLAG_ACCESSORS_BUMP_OPTS(mySaveFlags, agentLODEnable, agentLODEnable)
551 
552  void setAgentLODBias(fpreal b)
553  {
554  if(!SYSisEqual(b, myAgentLODBias))
555  mySerialNum++;
556  myAgentLODBias = b;
557  }
558  fpreal getAgentLODBias() const { return myAgentLODBias; }
559 
560  void setAgentMinPoints(int minp) { myAgentMinPoints = SYSmax(1, minp); }
561  int getAgentMinPoints() const { return myAgentMinPoints; }
562 
563  void setAgentNumLODLevels(int lvls) { myAgentMaxLOD=SYSclamp(lvls,1,16);}
564  int getAgentNumLODLevels() const { return myAgentMaxLOD; }
565 
566  void setAgentBaseLODLevel(int lvl)
567  {
568  if(lvl != myAgentBaseLOD)
569  mySerialNum++;
570  myAgentBaseLOD=SYSclamp(lvl,0,16);
571  }
572  int getAgentBaseLODLevel() const { return myAgentBaseLOD; }
573 
574  void setAgentBoneDeform(int d) { myAgentBoneDeform = SYSclamp(d,0,2); }
575  int getAgentBoneDeform() const { return myAgentBoneDeform; }
576 
577  int getAgentWireMode() const { return myAgentWireMode; }
579  {
580  mode = SYSclamp(mode,0,1);
581  if(mode != myAgentWireMode)
582  {
583  mySerialNum++;
584  myAgentWireMode = mode;
585  }
586  }
587 
588  void setAgentMaxBlendShapeLODLevel(int lvl) { myAgentMaxBlendShapeLOD = SYSclamp(lvl, 0, 16); }
589  int getAgentMaxBlendShapeLODLevel() const { return myAgentMaxBlendShapeLOD; }
590 
591  FLAG_ACCESSORS_BUMP_OPTS(mySaveFlags, agentBlendShapes, agentBlendShapes)
592 
593  FLAG_ACCESSORS(mySaveFlags, characterDeform, characterDeform)
594 
595  void optimizePackedGeometry(bool opt){ mySaveFlags.optPackedGeo = opt; }
596  bool optimizePackedGeometry() const { return mySaveFlags.optPackedGeo; }
597 
598  void offsetVertexDecor(bool use_offset)
599  { mySaveFlags.offsetVertexDecor = use_offset; }
600  bool offsetVertexDecor() const
601  { return mySaveFlags.offsetVertexDecor; }
602 
604  {
608  CURRENT_SHADING_BBOX // follow the current shading mode
609  };
610  void shadedBoundingBoxes(gr_BBoxMode m) { myBBoxMode = m; }
611  gr_BBoxMode shadedBoundingBoxes() const { return myBBoxMode; }
612 
613  // "Get" methods:
614  const UT_String &
615  visibleObjects() const { return myVisibleObjects; }
616  GA_PrimCompat::TypeMask primMask() const { return myPrimMask; }
617  unsigned pickMask() const { return myPickMask; }
618  float normalScale() const { return myNormalScale; }
619  float getNormalScale() const { return myNormalScale; }
620  fpreal vectorScale() const { return myVectorScale; }
621  fpreal getVectorScale() const { return myVectorScale; }
622  float LOD() const { return myLOD; }
623  float hlOffsetVariable() const { return myHLOffsetVariable; }
624  float hlOffsetConstant() const { return myHLOffsetConstant; }
625  float wireWidth() const { return SYSmax(0.1,
626  myWireWidth*myDPIScale); }
627  float selectionWireWidth()const { return (wireWidth() > 1.0)
628  ? wireWidth() + 1.0
629  : wireWidth() * 2.0; }
630  float getWireWidth() const { return myWireWidth; }
631  float wireBlend() const { return SYSclamp(myWireBlend,
632  0.0, 1.0); }
633  float interiorWireAlpha() const { return myInteriorWireAlpha; }
634  float pointSize() const { return myPointSize*myDPIScale; }
635  float getPointSize() const { return myPointSize; }
636  float discSize() const { return myDiscSize; }
637  float shadowOffsetVariable() const { return myShadowOffsetVariable; }
638  float shadowOffsetConstant() const { return myShadowOffsetConstant; }
639  int shadowAA() const { return myShadowAA; }
640  bool useLightShadowSize() const { return myUseLightShadowSize; }
641  int getShadowMapSize() const { return myShadowMapSize; }
642  bool getGSplatsNoSelfShadow() const { return myGSplatsNoSelfShadow; }
643  void setGSplatsNoSelfShadow(bool b) { myGSplatsNoSelfShadow = b; }
644  int selectionListInst() const { return mySelectionListInst; }
645 
646  const char *colorAttrib() const { return myColorAttrib; }
647  int colorType() const { return myColorType; }
648  void getColorDomain(fpreal &s, fpreal &e) const
649  { s = myColorDomain[0];
650  e = myColorDomain[1]; }
651 
652  int getSceneAntialias() const { return mySceneAntialias; }
653  bool getHDRRendering() const { return mySaveFlags.hdrRender; }
654  float getViewGamma() const { return myViewGamma; }
655  bool useViewLUT() const { return myUseLUT; }
656  const char *getViewLUT() const { return myViewLUT; }
657  bool useOCIO() const { return myUseOCIO; }
658  const char *getOCIOColorspace() const { return myOCIOColorspace; }
659  const char *getOCIOLooks() const { return myOCIOLooks; }
660  const char *getOCIODisplay() const { return myOCIODisplay; }
661  const char *getOCIOView() const { return myOCIOView; }
662  exint getOCIOSerial() const { return myOCIOSerial; }
663  float getViewBlack() const { return myViewBlack; }
664  float getViewWhite() const { return myViewWhite; }
665  int getViewComponents() const { return myViewComponents; }
666 
667  int getAmbOcclusionLevel() const { return myAmbOcclusionLevel; }
668  float getAmbOcclusionScale() const { return myAmbOcclusionScale; }
670  { return myAmbOcclusionIntensity; }
671  float getAmbOcclusionSpread() const
672  { return myAmbOcclusionSpread; }
673  bool getUseRayTrace() const { return myUseRayTrace; }
674  bool getUseDenoise() const { return myUseDenoise; }
675 
676  fpreal getInstancingFraction() const { return myInstancingFraction; }
677  int getInstancingLimit() const { return myInstancingLimit; }
679  { return myInstancingLimitAction; }
680 
681  fpreal getMinHomeZoom() const { return myMinHomeZoom; }
682 
683  // In millions of polygons (eg, 10 for 10M).
684  int getSubdivisionPolyLimit() const { return mySubdPolyLimit; }
685 
686  // "Set" methods:
687  void visibleObjects(const char *mask)
688  { myVisibleObjects.harden(mask); }
690  { myPrimMask = mask; }
691  void pickMask(unsigned mask) { myPickMask = mask; }
692  void setNormalScale(float s);
693  void setVectorScale(float s);
694 
695  void useRegularAuxColor() { myCrtAuxColor=GR_AUX_GEO_COLOR; }
697 
698  void setCurrentWireColor(const UT_Color &color);
699  void setCurrentWireColor(GR_DisplayColor color);
700  const UT_Color &getCurrentWireColor() const { return myCurrentWireColor[0]; }
701 
702  void LOD(float l);
703  void hlOffsetVariable(float f) { myHLOffsetVariable = (f>=0.0f)
704  ? f :0.0f;}
705  void hlOffsetConstant(float f) { myHLOffsetConstant = (f>=0.0f)
706  ? f :0.0f;}
707  void setWireWidth(float width) { myWireWidth = width;}
708  void wireBlend(float blend) { myWireBlend = blend;}
709  void interiorWireAlpha(float a) { myInteriorWireAlpha
710  = SYSclamp(a, 0.0f, 1.0f); }
711  void setPointSize(float size) { myPointSize = size; }
712  void discSize(float size);
714  { myShadowOffsetVariable = (f>=0.0f) ? f : 0.0f;}
716  { myShadowOffsetConstant = (f>=0.0f) ? f : 0.0f;}
717  void shadowAA(int aa) { myShadowAA = SYSclamp(aa, 1,4); }
718  void selectionListInst(int inst) { mySelectionListInst = inst; }
719  void setUseLightShadowSize(bool e) { myUseLightShadowSize = e; }
720  void setShadowMapSize(int s) { myShadowMapSize = s;
721  myUpdates.shadowSize = true; }
722 
723  void setColorAttrib(const char *a);
724  void setColorType(int t);
725  void setColorDomain(fpreal s, fpreal e);
726 
727  void setSceneAntialias(int a) { mySceneAntialias = a;
728  myUpdates.sceneAA = true; }
729 
730  void setHDRRendering(bool hdr) { mySaveFlags.hdrRender = hdr; }
731 
732  void setViewGamma(float gamma);
733  void setUseViewLUT(bool b) { myUseLUT = b; }
734  void setViewLUT(const char *lut) { myViewLUT.harden(lut); }
735  void useOCIO(bool use) { myUseOCIO = use; }
736  void setOCIOColorspace(const char *cs)
737  { myOCIOColorspace.harden(cs); }
738  void setOCIOLooks(const char *looks)
739  { myOCIOLooks.harden(looks); }
740  void setOCIODisplayView(const char *display, const char *view)
741  { myOCIODisplay = display; myOCIOView = view; }
742  void setOCIOSerial(exint serial) { myOCIOSerial = serial; }
743  void setViewBlack(float b) { myViewBlack = b; }
744  void setViewWhite(float w) { myViewWhite = w; }
745  void setViewComponents(int c) { myViewComponents = c; }
746  void copyColorCorrect(const GR_CommonDispOption &src);
747  void setAmbOcclusionLevel(int lvl)
748  { myAmbOcclusionLevel = SYSclamp(lvl, 1, 4); }
750  { myAmbOcclusionIntensity = SYSmax(0.0, i); }
751  void setAmbOcclusionScale(float sc)
752  { myAmbOcclusionScale = SYSmax(0.001, sc); }
753  void setAmbOcclusionSpread(float sc)
754  { myAmbOcclusionSpread = SYSclamp(sc, 0.0, 1.0); }
755  void setUseRayTrace(bool enable)
756  { myUseRayTrace = enable; }
757  void setUseDenoise(bool enable)
758  { myUseDenoise = enable; }
759 
761  { if(!SYSisEqual(s, myInstancingFraction))
762  mySerialNum++;
763  myInstancingFraction = s; }
764  void setInstancingLimit(int limit)
765  { limit = SYSmax(0, limit);
766  if(!SYSisEqual(limit, myInstancingLimit))
767  mySerialNum++;
768  myInstancingLimit = limit;
769  }
770  void setInstancingLimitAction(int action)
771  { myInstancingLimitAction = SYSclamp(action, 0,2); }
772 
774  { myMinHomeZoom = SYSmax(val, 0.001); }
775 
776  // In millions of polygons (eg, 10 for 10M).
777  void setSubdivisionPolyLimit(int limit)
778  {
779  limit = SYSmax(0, limit);
780  if(limit != mySubdPolyLimit)
781  mySerialNum++;
782  mySubdPolyLimit = limit;
783  }
784 
786  {
787  if(myUVAttrib != attrib)
788  {
789  mySerialNum++;
790  myUVAttrib = attrib;
791  }
792  }
793  const UT_StringHolder &getUVDisplayAttrib() const { return myUVAttrib; }
794 
795  // Onion skinning
796  bool isOnionSkinEnabled() const
797  { return mySaveFlags.onionSkinEnable; }
799  { return myOnionSkinOptions.myFrameIncrement; }
801  { return myOnionSkinOptions.myPreFrameCount; }
803  { return myOnionSkinOptions.myPostFrameCount; }
805  { return myOnionSkinOptions.myPreFrameColor; }
807  { return myOnionSkinOptions.myPostFrameColor; }
808  fpreal getOnionSkinAlpha() const { return myOnionSkinOptions.myAlpha; }
809 
811  { return myOnionSkinOptions; }
812 
813  void setOnionSkinEnable(bool enable)
814  { mySaveFlags.onionSkinEnable = enable; }
815 
816  void setOnionSkinParms(int frame_inc,
817  int pre_count,
818  int post_count,
819  UT_Color pre_color,
820  UT_Color post_color,
821  fpreal alpha);
822 
823  /// Returns an onion skin group (for use in `GR_Uniforms`) that has not been
824  /// used yet. This is used to ensure that each individual onion skin
825  /// primitive that is drawn has a unique group.
827  {
828  // This const cast
829  return const_cast<SYS_AtomicInt<int> &>(
830  myUnusedOnionSkinGroup).exchangeAdd(1);
831  }
832  /// Invalidate all usued onion skin groups and start counting again from
833  /// `start` when calling `getUniqueOnionSkinGroup`.
835  { myUnusedOnionSkinGroup.store(start); }
836 
837  // These are used to determine if geometry-related parms have changed on a
838  // very coarse level.
839  int getUniqueID() const { return myUniqueID; }
840  int getSerialNum() const { return mySerialNum; }
841  void bumpSerialNum() { mySerialNum++; }
842 
843  // changes when the view is changed. ID changes if the rendered viewport
844  // is different. 3D is for 3D view changes, 2D is for screen pan/zoom.
845  // getViewSerialID() is bumped for either.
846  int getViewSerialNum() const { return mySerialView +mySerialView2; }
847  int getView3DSerialNum() const { return mySerialView; }
848  int getView2DSerialNum() const { return mySerialView2; }
849  int getViewSerialID() const { return mySerialID; }
850  void setViewSerialNum(int num, int num_2d, int id)
851  {
852  mySerialView = num;
853  mySerialView2 = num_2d;
854  mySerialID = id;
855  }
856 
857  bool isLopsView() const { return myLopsView; }
858 
859  bool defaultTextureSize() const { return !myUpdates.texSize; }
860  bool default3DTextureSize() const{ return !myUpdates.tex3DSize; }
861  bool defaultShadowSize() const { return !myUpdates.shadowSize; }
862  bool defaultReflectSize() const { return !myUpdates.reflectSize; }
863  bool defaultHDRTexture() const { return !myUpdates.hdrTexture; }
864  bool defaultHDRReflect() const { return !myUpdates.hdrReflect; }
865  bool defaultSmoothLines() const { return !myUpdates.smoothLines; }
866  bool defaultSceneAA() const { return !myUpdates.sceneAA; }
867  bool defaultTextureMem() const { return !myUpdates.textureMem; }
868  bool defaultGuideFont() const { return !myUpdates.guideFont; }
869  bool defaultDPIScale() const { return !myUpdates.dpiScale; }
870 
871  // Turns on the closure selection on hull-based or all geometry
872  int closureSelection() const { return myClosureSelection; }
873  void closureSelection(int s) { myClosureSelection=SYSclamp(s,0,2); }
874 
875  int getVisContext() const { return myVisContext; }
876  void setVisContext(int ctxt) { myVisContext = ctxt; }
877 
878  // dummy callbacks for obsolete options.
879  bool obsoleteOption() const { return false; }
880  void obsoleteOption(bool onoff) {}
881 
882  static void setYUp(bool up) { theYUp = up; }
883  static bool isYUp() { return theYUp; }
884 
885  // Some looks can render progressively. This reports if this is a) allowed
886  // and b) whether the viewport is currently only partially rendered.
887  bool isPartialRender() const { return myIsPartialRender; }
888  void clearPartialRender() { myIsPartialRender = false; }
889  void setPartialRender() { myIsPartialRender = true; }
890  void allowPartialRender(bool allowed)
891  { myAllowPartialRender = allowed; }
892  bool allowsPartialRender() const
893  { return myAllowPartialRender; }
895  { myPartialPercentDone = p; }
897  {
898  return myIsPartialRender ? myPartialPercentDone
899  : 100.0;
900  }
901 
902  // Lights currently used for rendering
903  void setLightList(const GR_LightList *list)
904  { myLightList = list;}
905  const GR_LightList *getLightList() const { return myLightList; }
906 
908  { myExtraMaterials = materials; }
909  GR_MaterialAtlas *extraMaterials() const { return myExtraMaterials; }
910 
911 private:
912  void loadDefaultColors();
913  void getColorsByName();
914 
915  // data
916  UT_Color myColors[GR_NUM_DISPLAY_COLORS][2];
917  fpreal myAlphas[GR_NUM_DISPLAY_ALPHAS];
918  UT_Color myCurrentWireColor[2];
919 
920  UT_String myVisibleObjects; // Visibility mask
921  GA_PrimCompat::TypeMask myPrimMask; // What types of prims to draw
922  unsigned myPickMask; // What geo entities to pick
923 
924  fpreal myMarkerSize; // point,vertex,breakpoint marker diam
925  float myNormalScale; // A size to scale the normal by
926  fpreal myVectorScale; // Scale custom vectors
927  float myLOD; // level of detail
928  float myHLOffsetVariable; // hidden line constant offset
929  float myHLOffsetConstant; // hidden line variable offset
930  float myWireWidth;
931  fpreal32 myWireBlend;
932  fpreal32 myInteriorWireAlpha;
933  GR_ParticleType myParticleDisplayType;
934  fpreal myDPIScale; // DPI scale factor
935  float myPointSize; // point size in pixels
936  float myDiscSize; // disc size
937  int myParticleTextureWidth; // in pixels
938  int myParticleTextureHeight; // in pixels
939  float myShadowOffsetVariable;// shadow constant offset
940  float myShadowOffsetConstant;// sadow line variable offset
941  int myShadowAA; // Antialiasing of shadow edges.
942  bool myUseLightShadowSize; // Shadowmap size source from light
943  int myShadowMapSize; // Shadowmap size or max size
944  bool myGSplatsNoSelfShadow=false; // Suppress GSplat self-shadowing
945  int myReflectMapSize; // Reflect map resolution
946  fpreal myReflectMinLevel; // No reflect map below min level
947  int mySelectionListInst; // which selection instance to draw
948  int mySceneAntialias; // scene antialiasing (2^a samples).
949  int myTextureAnisotropy; // Texture anisotropic sampling
950  int myAmbOcclusionLevel; // 1-4, for more occlusion
951  float myAmbOcclusionIntensity; // Vulkan only
952  float myAmbOcclusionScale; // Vulkan only
953  float myAmbOcclusionSpread; // Vulkan only
954  bool myUseRayTrace = false; // Vulkan only
955  bool myUseDenoise = false ; // Vulkan only
956  int myLightSamples; // 1-64, for area/env light sampling
957  float myViewGamma;
958  bool myUseLUT;
959  UT_String myViewLUT;
960  bool myUseOCIO;
961  UT_StringHolder myOCIOColorspace;
962  UT_StringHolder myOCIOLooks;
963  UT_StringHolder myOCIODisplay;
964  UT_StringHolder myOCIOView;
965  exint myOCIOSerial;
966  float myViewBlack;
967  float myViewWhite;
968  int myViewComponents;
969  int myTransparentQuality; // Transparent object layering quality
970  fpreal myTransparencyCutoff=0.5; // Cutoff Transparency value (0...1)
971  fpreal myGSplatsAlphaCulling=0.01; // GSplats alpha culling threshold (0...1)
972  fpreal myDisplacementQuality; // Bias displacement auto-LOD
973  int myVolumeQuality; // Volume slice quality
974  fpreal myVolumeAmbientShadows;// Default intensity of volume ambient shadows
975  int myVolumeBSplines; // Use b-splines for volume interpolation
976  // (-1: never, 0: non-interactive, 1: always)
977  int myHeightFieldWireStride;
978  bool myActiveRender; // Is the viewport currently being interacted with?
979  int myClosureSelection; // 0=hide, 1=hull geo only, 2=show
980 
981  fpreal myNormalCuspAngle;
982  int myVertNormalLimit;
983  gr_TangentMethod myTangentMethod;
984 
985  // 2D Textures
986  float myTextureScale; // 0.0-1.0
987  float myDynamicScale; // when dynamic cache adjust is on
988  int myMaxTextureWidth; // in pixels
989  int myMaxTextureHeight; // in pixels
990  int myHDRTextureFormat; // 2=full,1=16FP,0=8b,-1=compressed
991  int myDynamicFormat;
992 
993  // 3D Textures. If mySaveFlags.use2DTextureLimits is true, these are ignored
994  float myTexture3DScale; // 0.0-1.0
995  float myDynamic3DScale; // when dynamic cache adjust is on
996  int myMaxTexture3DWidth; // in pixels
997  int myMaxTexture3DHeight; // in pixels
998  int myMaxTexture3DDepth; // in pixels
999  int myHDRTexture3DFormat; // 2=full,1=16FP,0=8b,-1=compressed
1000  int myDynamic3DFormat;
1001 
1002  int myTextureMemLimitMB; // max single texture size, in MB
1003 
1004  fpreal myInstancingFraction; // portion of instances to draw, 0..1
1005  int myInstancingLimit; // #tris
1006  int myInstancingLimitAction; // How to handle over-limit instances
1007 
1008  fpreal myMinHomeZoom; // minimum area to zoom to when homing
1009 
1010  GR_DisplayColor myCrtAuxColor; // current auxiliary color
1011 
1012  char myGotDefaults;
1013  UT_String myColorScheme;
1014 
1015  UT_String myColorAttrib; // Color override parameters
1016  int myColorType;
1017  fpreal myColorDomain[2];
1018 
1019  GR_AlphaPass myAlphaPass; // Type of alpha pass
1020  GR_DecorFontSize myDecorFontSize;
1021 
1022  fpreal myAgentLODBias;
1023  int myAgentMinPoints;
1024  int myAgentBaseLOD;
1025  int myAgentMaxLOD;
1026  int myAgentBoneDeform;
1027  int myAgentWireMode;
1028  int myAgentMaxBlendShapeLOD;
1029 
1030  GU_CommonOnionSkinOptions myOnionSkinOptions;
1031  SYS_AtomicInt<int> myUnusedOnionSkinGroup;
1032 
1033  gr_BBoxMode myBBoxMode;
1034  int mySubdPolyLimit;
1035 
1036  UT_StringHolder myUVAttrib;
1037 
1038  static UT_SymbolMap<GR_SchemeColors *> *ourSchemeDefaults;
1039  static UT_Array<GR_CommonDispOption *> ourInstancesArray;
1040 
1041  GR_HandleParts myHandleParts;
1042 
1043  struct grSaveFlags
1044  {
1045  unsigned drawTexture :1,
1046  drawTransparent :1,
1047  drawDisplacement :1,
1048  drawTexturedSpots :1,
1049  highQualityLighting:1,
1050  ambientOcclusion :1,
1051  limitTextureSize :1,
1052  limitTexture3DSize :1,
1053  mipMapTextures :1,
1054  hdrRender :1,
1055  drawShadows :1,
1056  drawTransparentMaps:1,
1057  removeBackface :1,
1058  correctBG :1,
1059  frameTime :1,
1060  fillSelection :1,
1061  solidOnly :1, // Only draw solid geometry.
1062  // Don't bother with shading
1063  // information (normals, etc).
1064  drawPartSprite :1, // draw particles as sprites
1065  orientDiscs :1, // draw particles as sprites
1066 
1067  drawPartOrigin :1, // draw particle origin
1068  drawHandles :1, // draw handles
1069  drawHullsOnly :1,
1070  showObjectSelection:1, // object selection highlight
1071 
1072  shadeOpenCurves :1, // shade open curve in shaded
1073  displayAsSubdiv :1, // display as subdiv
1074  overrideColorAttrib:1, // override Cd attribute
1075  use2DTexLimits :1, // 3D tex use 2D tex settings
1076  dynamicTexControl :1, // dynamic texture cache
1077  reduceTex2D :1, // controls - auto reduction of
1078  reduceTex3D :1, // quality when resources are
1079  reduceMipMap :1, // low.
1080  reduceBitDepth :1, //
1081  drawDiffuse :1,
1082  drawAmbient :1,
1083  drawEmission :1,
1084  useLighting :1,
1085  pointInstancing :1,
1086  polygonConvexQuality:1,
1087  autoDPIScale :1, // auto-set DPI scale
1088  volumeWireAsPoints :1,
1089  pickWireAsSolid :1, // pick wire prims as solid
1090  wireOverPacked :1, // draw wire-over for packed geo
1091  agentLODEnable :1,
1092  agentBlendShapes :1,
1093  characterDeform :1, // deform APEX characters
1094  onionSkinEnable :1, // global onion skinning flag
1095  cuspNormals :1,
1096  enableReflectionMaps:1, // cubemap gen for refl obj
1097  hdrReflectionMaps :1, // 8b or fp16 refl cubmaps
1098  showGeoColor :1, // show or ignore Cd on geometry
1099  interactiveEnable :1, // interactive mode is on
1100  optPackedGeo :1, // optimize packed geo for GL
1101  outlineSelection :1, // Outline obj/lop selections
1102  offsetVertexDecor :1,
1103  showMaterials :1, // If materials are shown
1104  interpolateLayers :1; // Use bilinear sampling for COP images.
1105  };
1106  grSaveFlags mySaveFlags; // flags that get saved
1107 
1108  struct grNoSaveFlags
1109  {
1110  unsigned snapToSelected :1, // snap to selection
1111  showComponentSelections :1, // draw geometry component
1112  showTempSelections :1, // draw temporary or cooked
1113  // selections?
1114  pickFrontFaces :1, // pick front-facing polygons
1115  pickBackFaces :1, // pick back-facing polygons
1116  drawAuxColors :1, // draw auxilary colors for
1117  // things like prim axes
1118  forceWireColor :1, // use wire color for wire
1119  shadingOpenCurves :1, // shade open curves
1120  drawMultiTexture :1, // mat layers in GUI_DispOpts
1121  dynamicMipSetting :1,
1122  interactive :1, // interactively moving
1123  deferTexLoad :1, // allow deferred texture loads
1124  applyVisualizers :1; // master visualization toggle
1125  };
1126 
1127  // These option can be auto-set by Houdini, so it is important to keep
1128  // track of whether they have been manually set or loaded from defaults/hip
1129  // so that they are not overwritten by the auto-set.
1130  struct gr_UpdatedOptions
1131  {
1132  bool texSize;
1133  bool tex3DSize;
1134  bool shadowSize;
1135  bool reflectSize;
1136  bool hdrTexture;
1137  bool hdrReflect;
1138  bool smoothLines;
1139  bool sceneAA;
1140  bool textureMem;
1141  bool guideFont;
1142  bool dpiScale;
1143  } myUpdates;
1144 
1145  grNoSaveFlags myNoSaveFlags; // flags that don't get saved
1146 
1147  int myVisContext; // vis context (viewport index)
1148  // assigned by vis manager.
1149  bool myLopsView;
1150  int myUniqueID;
1151  int mySerialNum;
1152  int mySerialView;
1153  int mySerialView2;
1154  int mySerialID;
1155  int *myGammaPassPtr; // ptr to gamma pass flag which
1156  // can be changed during render
1157  const GR_LightList *myLightList;
1158  static bool theYUp;
1159 
1160  bool myAllowPartialRender;
1161  bool myIsPartialRender;
1162  fpreal myPartialPercentDone;
1163  GR_MaterialAtlas *myExtraMaterials = nullptr;
1164  int myParentViewportID = -1;
1165 };
1166 
1167 inline void
1169 {
1170  float lod = (l>0.0) ? l : 0.001;
1171  if(myLOD != lod)
1172  {
1173  myLOD = lod;
1174  mySerialNum++;
1175  }
1176 }
1177 
1178 inline void
1180 {
1181  if(myColorAttrib != a)
1182  {
1183  myColorAttrib.harden(a);
1184  mySerialNum++;
1185  }
1186 }
1187 
1188 inline void
1190 {
1191  if(myColorType != t)
1192  {
1193  myColorType = t;
1194  mySerialNum ++;
1195  }
1196 }
1197 
1198 inline void
1200 {
1201  if(!SYSisEqual(myColorDomain[0], s) ||
1202  !SYSisEqual(myColorDomain[1], e))
1203  {
1204  myColorDomain[0] = s;
1205  myColorDomain[1] = e;
1206  mySerialNum ++;
1207  }
1208 }
1209 
1210 
1211 #undef FLAG_ACCESSORS
1212 
1213 #endif
void setPointSize(float size)
void allowPartialRender(bool allowed)
fpreal getAgentLODBias() const
void shadowOffsetVariable(float f)
int textureMemLimitMB() const
void setVisContext(int ctxt)
#define SYSmax(a, b)
Definition: SYS_Math.h:1952
void setLightList(const GR_LightList *list)
void shadowOffsetConstant(float f)
bool SYSisEqual(const UT_Vector2T< T > &a, const UT_Vector2T< T > &b, S tol)
Componentwise equality.
Definition: UT_Vector2.h:677
int getOnionSkinPostFrameCount() const
bool defaultGuideFont() const
fpreal DPIScale() const
fpreal getVolumeAmbientShadows() const
void offsetVertexDecor(bool use_offset)
void setMinHomeZoom(fpreal val)
fpreal reflectionMinLevel() const
fpreal getPartialPercentDone() const
void setHDRRendering(bool hdr)
const char * getViewLUT() const
GR_API int getMaxTexture3DSize(RE_RenderContext rc)
fpreal getMarkerSize() const
int getSubdivisionPolyLimit() const
#define GET_ALPHA(func, val)
void interiorWireAlpha(float a)
float getPointSize() const
const UT_StringHolder & getUVDisplayAttrib() const
void setGSplatsNoSelfShadow(bool b)
bool interpolateLayers() const
void
Definition: png.h:1083
void setAgentMinPoints(int minp)
void setAgentMaxBlendShapeLODLevel(int lvl)
bool isOnionSkinEnabled() const
const GU_CommonOnionSkinOptions & getOnionSkinParms() const
fpreal getAlpha(GR_DisplayColorAlpha alpha_name) const
bool getUseRayTrace() const
GR_ParticleType
Definition: GR_Defines.h:158
int getHeightFieldWireStride() const
const UT_Color & getCurrentWireColor() const
int getVolumeBSplines() const
GLuint start
Definition: glcorearb.h:475
void limitTexture3DSize(bool ls)
int getInstancingLimit() const
bool allowDeferredTextureLoad() const
bool defaultDPIScale() const
float shadowOffsetVariable() const
float interiorWireAlpha() const
float getViewGamma() const
GR_DisplayColor
void setMarkerSize(fpreal size)
void reflectionMinLevel(fpreal lvl)
bool defaultHDRTexture() const
bool offsetVertexDecor() const
void obsoleteOption(bool onoff)
int64 exint
Definition: SYS_Types.h:125
void setViewSerialNum(int num, int num_2d, int id)
bool hdrReflectionMaps() const
GLboolean GLboolean GLboolean GLboolean a
Definition: glcorearb.h:1222
static void setYUp(bool up)
GLdouble s
Definition: glad.h:3009
int getTransparentQuality() const
bool getGSplatsNoSelfShadow() const
bool obsoleteOption() const
float hlOffsetConstant() const
bool allowsPartialRender() const
void getColorDomain(fpreal &s, fpreal &e) const
void setUseRayTrace(bool enable)
const GR_LightList * getLightList() const
int getViewComponents() const
fpreal getDisplacementQuality() const
const char * getOCIOLooks() const
bool useReflectionMaps() const
GLdouble GLdouble GLdouble q
Definition: glad.h:2445
bool defaultSmoothLines() const
float hlOffsetVariable() const
fpreal getInstancingFraction() const
GR_AlphaPass
Definition: GR_Defines.h:125
float fpreal32
Definition: SYS_Types.h:200
void wireBlend(float blend)
GR_MaterialAtlas * extraMaterials() const
Temporary container for either a RV_Render and an RE_Render.
int getView3DSerialNum() const
void setInstancingLimitAction(int action)
int getVertexNormalLimit() const
void shadedBoundingBoxes(gr_BBoxMode m)
const UT_Color & getOnionSkinPostFrameColor() const
void interpolateLayers(bool do_interp)
void reflectionMapSize(int wh)
bool defaultShadowSize() const
vint4 blend(const vint4 &a, const vint4 &b, const vbool4 &mask)
Definition: simd.h:4949
GR_AlphaPass alphaPass() const
void textureMemLimitMB(int max_size)
float shadowOffsetConstant() const
void hlOffsetVariable(float f)
void setColorAttrib(const char *a)
fpreal vectorScale() const
GLfloat f
Definition: glcorearb.h:1926
void setGammaPassPtr(int *p)
void setSubdivisionPolyLimit(int limit)
fpreal markerSize() const
int getAmbOcclusionLevel() const
#define FLAG_ACCESSORS_BUMP_OPTS(FLAGS, METHOD, FLAG)
float getAmbOcclusionIntensity() const
int getAgentMinPoints() const
GR_HandleParts & handleParts()
float getAmbOcclusionSpread() const
void setDecorFontSize(GR_DecorFontSize s)
void setOCIOSerial(exint serial)
int getOnionSkinPreFrameCount() const
float getViewBlack() const
#define FLAG_ACCESSORS(FLAGS, METHOD, FLAG)
void setGSplatsAlphaCulling(fpreal c)
GU_SelectionRule
Definition: GU_SelectType.h:40
void setWireWidth(float width)
const GR_HandleParts & handleParts() const
void volumeWireAsPoints(bool vw)
gr_TangentMethod generateTangents() const
void setParentViewportID(int id)
const char * getOCIOColorspace() const
UT_Vector3T< T > SYSclamp(const UT_Vector3T< T > &v, const UT_Vector3T< T > &min, const UT_Vector3T< T > &max)
Definition: UT_Vector3.h:1059
GLint GLint GLsizei GLint GLenum format
Definition: glcorearb.h:108
bool defaultSceneAA() const
GLint GLenum GLboolean GLsizei stride
Definition: glcorearb.h:872
GLint GLuint mask
Definition: glcorearb.h:124
const UT_Color & getColor(GR_DisplayColor color_name, bool gamma=false) const
fpreal getNormalCuspAngle() const
int getAgentBaseLODLevel() const
void harden()
Take shallow copy and make it deep.
Definition: UT_String.h:225
float getViewWhite() const
void setExtraMaterials(GR_MaterialAtlas *materials)
GR_DecorFontSize
Definition: GR_Defines.h:205
#define GR_API
Definition: GR_API.h:10
bool limitTextureSize() const
bool volumeWireAsPoints() const
void alphaPass(GR_AlphaPass pass)
void hlOffsetConstant(float f)
GLuint id
Definition: glcorearb.h:655
bool defaultTextureSize() const
GLfloat GLfloat GLfloat alpha
Definition: glcorearb.h:112
int getAgentBoneDeform() const
void setNormalCuspAngle(fpreal a)
bool defaultHDRReflect() const
GLuint const GLchar * name
Definition: glcorearb.h:786
unsigned pickMask() const
fpreal getTransparencyCutoff() const
bool optimizePackedGeometry() const
void setTransparencyCutoff(fpreal c)
float getWireWidth() const
bool isPartialRender() const
void setVolumeBSplines(int bs)
GLboolean GLboolean GLboolean b
Definition: glcorearb.h:1222
void setUVDisplayAttrib(const UT_StringHolder &attrib)
void setOnionSkinEnable(bool enable)
void setAmbOcclusionLevel(int lvl)
that also have some descendant prim *whose name begins with which in turn has a child named baz where *the predicate active
const UT_Color & crtAuxColor() const
GLdouble t
Definition: glad.h:2397
GA_PrimCompat::TypeMask primMask() const
const char * getOCIODisplay() const
GR_API int getMaxTextureSize(RE_RenderContext rc)
void setDisplacementQuality(fpreal q)
int getDynamic3DFormat() const
GLenum mode
Definition: glcorearb.h:99
float getAmbOcclusionScale() const
void generateTangents(gr_TangentMethod method)
void setInstancingLimit(int limit)
void setInstancingFraction(fpreal s)
int getAgentNumLODLevels() const
int selectionListInst() const
bool getDynamicMipMap() const
void setOCIOLooks(const char *looks)
Contains transitional objects to provide some backward compatibility for code that references old GEO...
void setAmbOcclusionIntensity(float i)
GLsizeiptr size
Definition: glcorearb.h:664
const UT_String & visibleObjects() const
bool default3DTextureSize() const
void allowDeferredTextureLoad(bool a)
void hdrReflectionMaps(bool e)
void setUseLightShadowSize(bool e)
bool getHDRRendering() const
const char * colorAttrib() const
int getOnionSkinFrameIncrement() const
float selectionWireWidth() const
#define GET_COL(func, val)
void setOCIOColorspace(const char *cs)
GLuint color
Definition: glcorearb.h:1261
void setHeightFieldWireStride(int stride)
void selectionListInst(int inst)
void setVertexNormalLimit(int poly_limit)
fpreal64 fpreal
Definition: SYS_Types.h:283
void setActiveRender(bool active)
void useReflectionMaps(bool e)
void setAmbOcclusionScale(float sc)
bool getActiveRender() const
float normalScale() const
LeafData & operator=(const LeafData &)=delete
int getInstancingLimitAction() const
void setAgentWireMode(int mode)
GR_DisplayColorAlpha
const UT_Color & locateColor(fpreal &alpha) const
int getSceneAntialias() const
void primMask(GA_PrimCompat::TypeMask mask)
bool useLightShadowSize() const
void setUseDenoise(bool enable)
void pickMask(unsigned mask)
GLuint GLfloat * val
Definition: glcorearb.h:1608
float getNormalScale() const
fpreal getMinHomeZoom() const
void limitTextureSize(bool ls)
int getAgentMaxBlendShapeLODLevel() const
void setTransparentQuality(int q)
const UT_Color & getOnionSkinPreFrameColor() const
void setAmbOcclusionSpread(float sc)
void setColorDomain(fpreal s, fpreal e)
fpreal getGSplatsAlphaCulling() const
GLint GLsizei width
Definition: glcorearb.h:103
void setAgentBaseLODLevel(int lvl)
gr_BBoxMode shadedBoundingBoxes() const
int parentViewportID() const
int getUniqueOnionSkinGroup() const
void setOCIODisplayView(const char *display, const char *view)
GLubyte GLubyte GLubyte GLubyte w
Definition: glcorearb.h:857
GLboolean r
Definition: glcorearb.h:1222
void setViewLUT(const char *lut)
fpreal getOnionSkinAlpha() const
int reflectionMapSize() const
void setPartialPercentDone(fpreal p)
bool defaultReflectSize() const
const UT_String & getColorScheme() const
int getView2DSerialNum() const
const UT_Color & color(GR_DisplayColor c) const
RE_TextureCompress
void visibleObjects(const char *mask)
void resetUniqueOnionSkinGroup(int start)
bool limitTexture3DSize() const
GR_DecorFontSize getDecorFontSize() const
exint getOCIOSerial() const
GLint lod
Definition: glcorearb.h:2765
bool defaultTextureMem() const
const char * getOCIOView() const
fpreal getVectorScale() const
void setVolumeAmbientShadows(fpreal q)
void setAgentNumLODLevels(int lvls)
GLenum src
Definition: glcorearb.h:1793