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