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  int selectionListInst() const { return mySelectionListInst; }
643 
644  const char *colorAttrib() const { return myColorAttrib; }
645  int colorType() const { return myColorType; }
646  void getColorDomain(fpreal &s, fpreal &e) const
647  { s = myColorDomain[0];
648  e = myColorDomain[1]; }
649 
650  int getSceneAntialias() const { return mySceneAntialias; }
651  bool getHDRRendering() const { return mySaveFlags.hdrRender; }
652  float getViewGamma() const { return myViewGamma; }
653  bool useViewLUT() const { return myUseLUT; }
654  const char *getViewLUT() const { return myViewLUT; }
655  bool useOCIO() const { return myUseOCIO; }
656  const char *getOCIOColorspace() const { return myOCIOColorspace; }
657  const char *getOCIOLooks() const { return myOCIOLooks; }
658  const char *getOCIODisplay() const { return myOCIODisplay; }
659  const char *getOCIOView() const { return myOCIOView; }
660  exint getOCIOSerial() const { return myOCIOSerial; }
661  float getViewBlack() const { return myViewBlack; }
662  float getViewWhite() const { return myViewWhite; }
663  int getViewComponents() const { return myViewComponents; }
664 
665  int getAmbOcclusionLevel() const { return myAmbOcclusionLevel; }
666  float getAmbOcclusionScale() const { return myAmbOcclusionScale; }
668  { return myAmbOcclusionIntensity; }
669  float getAmbOcclusionSpread() const
670  { return myAmbOcclusionSpread; }
671  bool getUseRayTrace() const { return myUseRayTrace; }
672  bool getUseDenoise() const { return myUseDenoise; }
673 
674  fpreal getInstancingFraction() const { return myInstancingFraction; }
675  int getInstancingLimit() const { return myInstancingLimit; }
677  { return myInstancingLimitAction; }
678 
679  fpreal getMinHomeZoom() const { return myMinHomeZoom; }
680 
681  // In millions of polygons (eg, 10 for 10M).
682  int getSubdivisionPolyLimit() const { return mySubdPolyLimit; }
683 
684  // "Set" methods:
685  void visibleObjects(const char *mask)
686  { myVisibleObjects.harden(mask); }
688  { myPrimMask = mask; }
689  void pickMask(unsigned mask) { myPickMask = mask; }
690  void setNormalScale(float s);
691  void setVectorScale(float s);
692 
693  void useRegularAuxColor() { myCrtAuxColor=GR_AUX_GEO_COLOR; }
695 
696  void setCurrentWireColor(const UT_Color &color);
697  void setCurrentWireColor(GR_DisplayColor color);
698  const UT_Color &getCurrentWireColor() const { return myCurrentWireColor[0]; }
699 
700  void LOD(float l);
701  void hlOffsetVariable(float f) { myHLOffsetVariable = (f>=0.0f)
702  ? f :0.0f;}
703  void hlOffsetConstant(float f) { myHLOffsetConstant = (f>=0.0f)
704  ? f :0.0f;}
705  void setWireWidth(float width) { myWireWidth = width;}
706  void wireBlend(float blend) { myWireBlend = blend;}
707  void interiorWireAlpha(float a) { myInteriorWireAlpha
708  = SYSclamp(a, 0.0f, 1.0f); }
709  void setPointSize(float size) { myPointSize = size; }
710  void discSize(float size);
712  { myShadowOffsetVariable = (f>=0.0f) ? f : 0.0f;}
714  { myShadowOffsetConstant = (f>=0.0f) ? f : 0.0f;}
715  void shadowAA(int aa) { myShadowAA = SYSclamp(aa, 1,4); }
716  void selectionListInst(int inst) { mySelectionListInst = inst; }
717  void setUseLightShadowSize(bool e) { myUseLightShadowSize = e; }
718  void setShadowMapSize(int s) { myShadowMapSize = s;
719  myUpdates.shadowSize = true; }
720 
721  void setColorAttrib(const char *a);
722  void setColorType(int t);
723  void setColorDomain(fpreal s, fpreal e);
724 
725  void setSceneAntialias(int a) { mySceneAntialias = a;
726  myUpdates.sceneAA = true; }
727 
728  void setHDRRendering(bool hdr) { mySaveFlags.hdrRender = hdr; }
729 
730  void setViewGamma(float gamma);
731  void setUseViewLUT(bool b) { myUseLUT = b; }
732  void setViewLUT(const char *lut) { myViewLUT.harden(lut); }
733  void useOCIO(bool use) { myUseOCIO = use; }
734  void setOCIOColorspace(const char *cs)
735  { myOCIOColorspace.harden(cs); }
736  void setOCIOLooks(const char *looks)
737  { myOCIOLooks.harden(looks); }
738  void setOCIODisplayView(const char *display, const char *view)
739  { myOCIODisplay = display; myOCIOView = view; }
740  void setOCIOSerial(exint serial) { myOCIOSerial = serial; }
741  void setViewBlack(float b) { myViewBlack = b; }
742  void setViewWhite(float w) { myViewWhite = w; }
743  void setViewComponents(int c) { myViewComponents = c; }
744  void copyColorCorrect(const GR_CommonDispOption &src);
745  void setAmbOcclusionLevel(int lvl)
746  { myAmbOcclusionLevel = SYSclamp(lvl, 1, 4); }
748  { myAmbOcclusionIntensity = SYSmax(0.0, i); }
749  void setAmbOcclusionScale(float sc)
750  { myAmbOcclusionScale = SYSmax(0.001, sc); }
751  void setAmbOcclusionSpread(float sc)
752  { myAmbOcclusionSpread = SYSclamp(sc, 0.0, 1.0); }
753  void setUseRayTrace(bool enable)
754  { myUseRayTrace = enable; }
755  void setUseDenoise(bool enable)
756  { myUseDenoise = enable; }
757 
759  { if(!SYSisEqual(s, myInstancingFraction))
760  mySerialNum++;
761  myInstancingFraction = s; }
762  void setInstancingLimit(int limit)
763  { limit = SYSmax(0, limit);
764  if(!SYSisEqual(limit, myInstancingLimit))
765  mySerialNum++;
766  myInstancingLimit = limit;
767  }
768  void setInstancingLimitAction(int action)
769  { myInstancingLimitAction = SYSclamp(action, 0,2); }
770 
772  { myMinHomeZoom = SYSmax(val, 0.001); }
773 
774  // In millions of polygons (eg, 10 for 10M).
775  void setSubdivisionPolyLimit(int limit)
776  {
777  limit = SYSmax(0, limit);
778  if(limit != mySubdPolyLimit)
779  mySerialNum++;
780  mySubdPolyLimit = limit;
781  }
782 
784  {
785  if(myUVAttrib != attrib)
786  {
787  mySerialNum++;
788  myUVAttrib = attrib;
789  }
790  }
791  const UT_StringHolder &getUVDisplayAttrib() const { return myUVAttrib; }
792 
793  // Onion skinning
794  bool isOnionSkinEnabled() const
795  { return mySaveFlags.onionSkinEnable; }
797  { return myOnionSkinOptions.myFrameIncrement; }
799  { return myOnionSkinOptions.myPreFrameCount; }
801  { return myOnionSkinOptions.myPostFrameCount; }
803  { return myOnionSkinOptions.myPreFrameColor; }
805  { return myOnionSkinOptions.myPostFrameColor; }
806  fpreal getOnionSkinAlpha() const { return myOnionSkinOptions.myAlpha; }
807 
809  { return myOnionSkinOptions; }
810 
811  void setOnionSkinEnable(bool enable)
812  { mySaveFlags.onionSkinEnable = enable; }
813 
814  void setOnionSkinParms(int frame_inc,
815  int pre_count,
816  int post_count,
817  UT_Color pre_color,
818  UT_Color post_color,
819  fpreal alpha);
820 
821  /// Returns an onion skin group (for use in `GR_Uniforms`) that has not been
822  /// used yet. This is used to ensure that each individual onion skin
823  /// primitive that is drawn has a unique group.
825  {
826  // This const cast
827  return const_cast<SYS_AtomicInt<int> &>(
828  myUnusedOnionSkinGroup).exchangeAdd(1);
829  }
830  /// Invalidate all usued onion skin groups and start counting again from
831  /// `start` when calling `getUniqueOnionSkinGroup`.
833  { myUnusedOnionSkinGroup.store(start); }
834 
835  // These are used to determine if geometry-related parms have changed on a
836  // very coarse level.
837  int getUniqueID() const { return myUniqueID; }
838  int getSerialNum() const { return mySerialNum; }
839  void bumpSerialNum() { mySerialNum++; }
840 
841  // changes when the view is changed. ID changes if the rendered viewport
842  // is different. 3D is for 3D view changes, 2D is for screen pan/zoom.
843  // getViewSerialID() is bumped for either.
844  int getViewSerialNum() const { return mySerialView +mySerialView2; }
845  int getView3DSerialNum() const { return mySerialView; }
846  int getView2DSerialNum() const { return mySerialView2; }
847  int getViewSerialID() const { return mySerialID; }
848  void setViewSerialNum(int num, int num_2d, int id)
849  {
850  mySerialView = num;
851  mySerialView2 = num_2d;
852  mySerialID = id;
853  }
854 
855  bool isLopsView() const { return myLopsView; }
856 
857  bool defaultTextureSize() const { return !myUpdates.texSize; }
858  bool default3DTextureSize() const{ return !myUpdates.tex3DSize; }
859  bool defaultShadowSize() const { return !myUpdates.shadowSize; }
860  bool defaultReflectSize() const { return !myUpdates.reflectSize; }
861  bool defaultHDRTexture() const { return !myUpdates.hdrTexture; }
862  bool defaultHDRReflect() const { return !myUpdates.hdrReflect; }
863  bool defaultSmoothLines() const { return !myUpdates.smoothLines; }
864  bool defaultSceneAA() const { return !myUpdates.sceneAA; }
865  bool defaultTextureMem() const { return !myUpdates.textureMem; }
866  bool defaultGuideFont() const { return !myUpdates.guideFont; }
867  bool defaultDPIScale() const { return !myUpdates.dpiScale; }
868 
869  // Turns on the closure selection on hull-based or all geometry
870  int closureSelection() const { return myClosureSelection; }
871  void closureSelection(int s) { myClosureSelection=SYSclamp(s,0,2); }
872 
873  int getVisContext() const { return myVisContext; }
874  void setVisContext(int ctxt) { myVisContext = ctxt; }
875 
876  // dummy callbacks for obsolete options.
877  bool obsoleteOption() const { return false; }
878  void obsoleteOption(bool onoff) {}
879 
880  static void setYUp(bool up) { theYUp = up; }
881  static bool isYUp() { return theYUp; }
882 
883  // Some looks can render progressively. This reports if this is a) allowed
884  // and b) whether the viewport is currently only partially rendered.
885  bool isPartialRender() const { return myIsPartialRender; }
886  void clearPartialRender() { myIsPartialRender = false; }
887  void setPartialRender() { myIsPartialRender = true; }
888  void allowPartialRender(bool allowed)
889  { myAllowPartialRender = allowed; }
890  bool allowsPartialRender() const
891  { return myAllowPartialRender; }
893  { myPartialPercentDone = p; }
895  {
896  return myIsPartialRender ? myPartialPercentDone
897  : 100.0;
898  }
899 
900  // Lights currently used for rendering
901  void setLightList(const GR_LightList *list)
902  { myLightList = list;}
903  const GR_LightList *getLightList() const { return myLightList; }
904 
906  { myExtraMaterials = materials; }
907  GR_MaterialAtlas *extraMaterials() const { return myExtraMaterials; }
908 
909 private:
910  void loadDefaultColors();
911  void getColorsByName();
912 
913  // data
914  UT_Color myColors[GR_NUM_DISPLAY_COLORS][2];
915  fpreal myAlphas[GR_NUM_DISPLAY_ALPHAS];
916  UT_Color myCurrentWireColor[2];
917 
918  UT_String myVisibleObjects; // Visibility mask
919  GA_PrimCompat::TypeMask myPrimMask; // What types of prims to draw
920  unsigned myPickMask; // What geo entities to pick
921 
922  fpreal myMarkerSize; // point,vertex,breakpoint marker diam
923  float myNormalScale; // A size to scale the normal by
924  fpreal myVectorScale; // Scale custom vectors
925  float myLOD; // level of detail
926  float myHLOffsetVariable; // hidden line constant offset
927  float myHLOffsetConstant; // hidden line variable offset
928  float myWireWidth;
929  fpreal32 myWireBlend;
930  fpreal32 myInteriorWireAlpha;
931  GR_ParticleType myParticleDisplayType;
932  fpreal myDPIScale; // DPI scale factor
933  float myPointSize; // point size in pixels
934  float myDiscSize; // disc size
935  int myParticleTextureWidth; // in pixels
936  int myParticleTextureHeight; // in pixels
937  float myShadowOffsetVariable;// shadow constant offset
938  float myShadowOffsetConstant;// sadow line variable offset
939  int myShadowAA; // Antialiasing of shadow edges.
940  bool myUseLightShadowSize; // Shadowmap size source from light
941  int myShadowMapSize; // Shadowmap size or max size
942  int myReflectMapSize; // Reflect map resolution
943  fpreal myReflectMinLevel; // No reflect map below min level
944  int mySelectionListInst; // which selection instance to draw
945  int mySceneAntialias; // scene antialiasing (2^a samples).
946  int myTextureAnisotropy; // Texture anisotropic sampling
947  int myAmbOcclusionLevel; // 1-4, for more occlusion
948  float myAmbOcclusionIntensity; // Vulkan only
949  float myAmbOcclusionScale; // Vulkan only
950  float myAmbOcclusionSpread; // Vulkan only
951  bool myUseRayTrace = false; // Vulkan only
952  bool myUseDenoise = false ; // Vulkan only
953  int myLightSamples; // 1-64, for area/env light sampling
954  float myViewGamma;
955  bool myUseLUT;
956  UT_String myViewLUT;
957  bool myUseOCIO;
958  UT_StringHolder myOCIOColorspace;
959  UT_StringHolder myOCIOLooks;
960  UT_StringHolder myOCIODisplay;
961  UT_StringHolder myOCIOView;
962  exint myOCIOSerial;
963  float myViewBlack;
964  float myViewWhite;
965  int myViewComponents;
966  int myTransparentQuality; // Transparent object layering quality
967  fpreal myTransparencyCutoff=0.5; // Cutoff Transparency value (0...1)
968  fpreal myGSplatsAlphaCulling=0.01; // GSplats alpha culling threshold (0...1)
969  fpreal myDisplacementQuality; // Bias displacement auto-LOD
970  int myVolumeQuality; // Volume slice quality
971  fpreal myVolumeAmbientShadows;// Default intensity of volume ambient shadows
972  int myVolumeBSplines; // Use b-splines for volume interpolation
973  // (-1: never, 0: non-interactive, 1: always)
974  int myHeightFieldWireStride;
975  bool myActiveRender; // Is the viewport currently being interacted with?
976  int myClosureSelection; // 0=hide, 1=hull geo only, 2=show
977 
978  fpreal myNormalCuspAngle;
979  int myVertNormalLimit;
980  gr_TangentMethod myTangentMethod;
981 
982  // 2D Textures
983  float myTextureScale; // 0.0-1.0
984  float myDynamicScale; // when dynamic cache adjust is on
985  int myMaxTextureWidth; // in pixels
986  int myMaxTextureHeight; // in pixels
987  int myHDRTextureFormat; // 2=full,1=16FP,0=8b,-1=compressed
988  int myDynamicFormat;
989 
990  // 3D Textures. If mySaveFlags.use2DTextureLimits is true, these are ignored
991  float myTexture3DScale; // 0.0-1.0
992  float myDynamic3DScale; // when dynamic cache adjust is on
993  int myMaxTexture3DWidth; // in pixels
994  int myMaxTexture3DHeight; // in pixels
995  int myMaxTexture3DDepth; // in pixels
996  int myHDRTexture3DFormat; // 2=full,1=16FP,0=8b,-1=compressed
997  int myDynamic3DFormat;
998 
999  int myTextureMemLimitMB; // max single texture size, in MB
1000 
1001  fpreal myInstancingFraction; // portion of instances to draw, 0..1
1002  int myInstancingLimit; // #tris
1003  int myInstancingLimitAction; // How to handle over-limit instances
1004 
1005  fpreal myMinHomeZoom; // minimum area to zoom to when homing
1006 
1007  GR_DisplayColor myCrtAuxColor; // current auxiliary color
1008 
1009  char myGotDefaults;
1010  UT_String myColorScheme;
1011 
1012  UT_String myColorAttrib; // Color override parameters
1013  int myColorType;
1014  fpreal myColorDomain[2];
1015 
1016  GR_AlphaPass myAlphaPass; // Type of alpha pass
1017  GR_DecorFontSize myDecorFontSize;
1018 
1019  fpreal myAgentLODBias;
1020  int myAgentMinPoints;
1021  int myAgentBaseLOD;
1022  int myAgentMaxLOD;
1023  int myAgentBoneDeform;
1024  int myAgentWireMode;
1025  int myAgentMaxBlendShapeLOD;
1026 
1027  GU_CommonOnionSkinOptions myOnionSkinOptions;
1028  SYS_AtomicInt<int> myUnusedOnionSkinGroup;
1029 
1030  gr_BBoxMode myBBoxMode;
1031  int mySubdPolyLimit;
1032 
1033  UT_StringHolder myUVAttrib;
1034 
1035  static UT_SymbolMap<GR_SchemeColors *> *ourSchemeDefaults;
1036  static UT_Array<GR_CommonDispOption *> ourInstancesArray;
1037 
1038  GR_HandleParts myHandleParts;
1039 
1040  struct grSaveFlags
1041  {
1042  unsigned drawTexture :1,
1043  drawTransparent :1,
1044  drawDisplacement :1,
1045  drawTexturedSpots :1,
1046  highQualityLighting:1,
1047  ambientOcclusion :1,
1048  limitTextureSize :1,
1049  limitTexture3DSize :1,
1050  mipMapTextures :1,
1051  hdrRender :1,
1052  drawShadows :1,
1053  drawTransparentMaps:1,
1054  removeBackface :1,
1055  correctBG :1,
1056  frameTime :1,
1057  fillSelection :1,
1058  solidOnly :1, // Only draw solid geometry.
1059  // Don't bother with shading
1060  // information (normals, etc).
1061  drawPartSprite :1, // draw particles as sprites
1062  orientDiscs :1, // draw particles as sprites
1063 
1064  drawPartOrigin :1, // draw particle origin
1065  drawHandles :1, // draw handles
1066  drawHullsOnly :1,
1067  showObjectSelection:1, // object selection highlight
1068 
1069  shadeOpenCurves :1, // shade open curve in shaded
1070  displayAsSubdiv :1, // display as subdiv
1071  overrideColorAttrib:1, // override Cd attribute
1072  use2DTexLimits :1, // 3D tex use 2D tex settings
1073  dynamicTexControl :1, // dynamic texture cache
1074  reduceTex2D :1, // controls - auto reduction of
1075  reduceTex3D :1, // quality when resources are
1076  reduceMipMap :1, // low.
1077  reduceBitDepth :1, //
1078  drawDiffuse :1,
1079  drawAmbient :1,
1080  drawEmission :1,
1081  useLighting :1,
1082  pointInstancing :1,
1083  polygonConvexQuality:1,
1084  autoDPIScale :1, // auto-set DPI scale
1085  volumeWireAsPoints :1,
1086  pickWireAsSolid :1, // pick wire prims as solid
1087  wireOverPacked :1, // draw wire-over for packed geo
1088  agentLODEnable :1,
1089  agentBlendShapes :1,
1090  characterDeform :1, // deform APEX characters
1091  onionSkinEnable :1, // global onion skinning flag
1092  cuspNormals :1,
1093  enableReflectionMaps:1, // cubemap gen for refl obj
1094  hdrReflectionMaps :1, // 8b or fp16 refl cubmaps
1095  showGeoColor :1, // show or ignore Cd on geometry
1096  interactiveEnable :1, // interactive mode is on
1097  optPackedGeo :1, // optimize packed geo for GL
1098  outlineSelection :1, // Outline obj/lop selections
1099  offsetVertexDecor :1,
1100  showMaterials :1, // If materials are shown
1101  interpolateLayers :1; // Use bilinear sampling for COP images.
1102  };
1103  grSaveFlags mySaveFlags; // flags that get saved
1104 
1105  struct grNoSaveFlags
1106  {
1107  unsigned snapToSelected :1, // snap to selection
1108  showComponentSelections :1, // draw geometry component
1109  showTempSelections :1, // draw temporary or cooked
1110  // selections?
1111  pickFrontFaces :1, // pick front-facing polygons
1112  pickBackFaces :1, // pick back-facing polygons
1113  drawAuxColors :1, // draw auxilary colors for
1114  // things like prim axes
1115  forceWireColor :1, // use wire color for wire
1116  shadingOpenCurves :1, // shade open curves
1117  drawMultiTexture :1, // mat layers in GUI_DispOpts
1118  dynamicMipSetting :1,
1119  interactive :1, // interactively moving
1120  deferTexLoad :1, // allow deferred texture loads
1121  applyVisualizers :1; // master visualization toggle
1122  };
1123 
1124  // These option can be auto-set by Houdini, so it is important to keep
1125  // track of whether they have been manually set or loaded from defaults/hip
1126  // so that they are not overwritten by the auto-set.
1127  struct gr_UpdatedOptions
1128  {
1129  bool texSize;
1130  bool tex3DSize;
1131  bool shadowSize;
1132  bool reflectSize;
1133  bool hdrTexture;
1134  bool hdrReflect;
1135  bool smoothLines;
1136  bool sceneAA;
1137  bool textureMem;
1138  bool guideFont;
1139  bool dpiScale;
1140  } myUpdates;
1141 
1142  grNoSaveFlags myNoSaveFlags; // flags that don't get saved
1143 
1144  int myVisContext; // vis context (viewport index)
1145  // assigned by vis manager.
1146  bool myLopsView;
1147  int myUniqueID;
1148  int mySerialNum;
1149  int mySerialView;
1150  int mySerialView2;
1151  int mySerialID;
1152  int *myGammaPassPtr; // ptr to gamma pass flag which
1153  // can be changed during render
1154  const GR_LightList *myLightList;
1155  static bool theYUp;
1156 
1157  bool myAllowPartialRender;
1158  bool myIsPartialRender;
1159  fpreal myPartialPercentDone;
1160  GR_MaterialAtlas *myExtraMaterials = nullptr;
1161  int myParentViewportID = -1;
1162 };
1163 
1164 inline void
1166 {
1167  float lod = (l>0.0) ? l : 0.001;
1168  if(myLOD != lod)
1169  {
1170  myLOD = lod;
1171  mySerialNum++;
1172  }
1173 }
1174 
1175 inline void
1177 {
1178  if(myColorAttrib != a)
1179  {
1180  myColorAttrib.harden(a);
1181  mySerialNum++;
1182  }
1183 }
1184 
1185 inline void
1187 {
1188  if(myColorType != t)
1189  {
1190  myColorType = t;
1191  mySerialNum ++;
1192  }
1193 }
1194 
1195 inline void
1197 {
1198  if(!SYSisEqual(myColorDomain[0], s) ||
1199  !SYSisEqual(myColorDomain[1], e))
1200  {
1201  myColorDomain[0] = s;
1202  myColorDomain[1] = e;
1203  mySerialNum ++;
1204  }
1205 }
1206 
1207 
1208 #undef FLAG_ACCESSORS
1209 
1210 #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
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 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