HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
DM_VPortAgent.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: DM_VPortAgent.h ( DM Library, C++)
7  *
8  * COMMENTS:
9  * DM_VPortAgent is the class for the 2D & 3D viewport agents.
10  * Viewport agents encapsulate the viewport functionality that is
11  * specific to a particular kind of viewport, such as
12  * rendering. There is one agent for each viewport.
13  */
14 
15 #ifndef __DM_VPortAgent__
16 #define __DM_VPortAgent__
17 
18 #include "DM_API.h"
19 #include "DM_Defines.h"
20 #include "DM_GeoDetail.h"
21 #include "DM_ViewportType.h"
22 
23 #include <UI/UI_Object.h>
24 #include <OP/OP_Bundle.h>
25 #include <GEO/GEO_PrimTypeCompat.h>
26 #include <GR/GR_Defines.h>
27 #include <GUI/GUI_RenderCommon.h>
28 #include <GUI/GUI_ViewParameter.h>
29 #include <GUI/GUI_ViewState.h>
30 #include <RE/RE_Texture.h>
31 #include <RE/RE_LightList.h>
32 #include <RE/RE_TimerQuery.h>
33 #include <RE/RE_PickBuffer.h>
34 #include <RE/RE_OGLFramebuffer.h>
35 #include <PXL/PXL_Lookup.h>
36 #include <UT/UT_UniquePtr.h>
37 
38 class RE_RenderWait;
39 class UI_Event;
40 class OBJ_Ambient;
41 class GR_PickRecord;
42 class GUI_DisplayOption;
43 class GUI_GeoRender;
44 class GUI_SceneLook;
45 class GUI_ViewState;
46 class DM_FloorInterface;
47 class DM_RenderHighQuality;
48 class DM_SceneManager;
49 class DM_Viewport;
50 class DM_ViewportHooks;
51 
53 {
54 public:
55  DM_VPortAgent(DM_SceneManager &app,
56  DM_Viewport *display,
57  GUI_ViewState *view,
59  virtual ~DM_VPortAgent();
60 
61  /// Each viewport has a unique integer id used to differentiate them.
62  int getUniqueId() const;
63 
64  /// Compute bounding box of the scene.
65  int getBoundingBox(UT_BoundingBox &bbox,
66  const UT_Matrix3R *rot,
67  bool non_templated_only,
68  const DM_Viewport &viewport) const;
69 
70  /// Called by DM_Viewport to initialize and retire the viewport agent
71  /// when opening and closing. Treat as private.
72  void setupViewport();
73  void cleanupViewport();
74 
75  /// The projection type of this viewport
76  DM_ViewportType getViewType() const { return myType; }
77 
78  /// For ortho viewports, the projection type (top, front, right, etc)
79  GUI_ViewParameter::axis getHomeAxis() const;
80 
81  /// Projection type, ortho or perspective
82  int isOrtho() const;
83 
84  /// The view state contains transform, projection and display options
85  const GUI_ViewState &getViewStateRef() const;
86  GUI_ViewState &getViewStateRef();
87 
88  /// Given a look id, and possibly a GUI_DetailList, find the GUI_DetailLook
89  /// with the supplied id.
90  GUI_DetailLook *getDetailLook(int look_id, const GUI_DetailList *geos);
91 
92  const GUI_DetailLook *getDetailLook(int node_id) const;
93 
94  /// Fetch the detail of the current SOP or POP
95  const GUI_DetailLook*currentDetail() const;
96  GUI_DetailLook *currentDetail();
97 
98  /// turn on/off the background elements
99  void drawBackground(bool draw);
100 
101  /// Called when loading a new hip file or File>New
102  void resetForNew();
103 
104  /// handle a change in our display options
105  void handleDisplayOptionEvent(UI_Event *e);
106 
107  /// handle a change in our view parameters
108  void handleViewParameterEvent(UI_Event *e);
109 
110  /// render all elements in this viewport
111  void doRender(RE_Render *r, int x, int y);
112 
113  /// render any transient overlay elements in the viewport
114  void overlayRender(RE_Render *r, int x, int y);
115 
116  /// render all handles present in the viewport
117  void renderHandles(RE_Render *r, int x, int y,
118  unsigned mask);
119 
120  /// Change the type of the viewport to a different projection or 2D/3D
121  void changeType(UI_Object *by, DM_ViewportType new_type);
122 
123  /// Called when the viewport closes, but is not deleted (such as a pane tab
124  /// switch).
125  void close();
126 
127  /// @brief Access the beauty pass textures
128  /// Get a texture containing the color or depth of the beauty pass buffer.
129  /// This texture is always single-sampled.
130  RE_Texture *getBeautyPassTexture(RE_Render *r,
131  bool resolve_aa = true) const;
132  RE_Texture *getBeautyPassDepthTexture(RE_Render *r,
133  bool resolve_aa = true) const;
134 
135  /// copy the beauty pass to 'dst_texture'.
136  bool copyBeautyToTexture(RE_Render *r,
137  UT_DimRect src_area,
138  RE_Texture *dst_texture,
139  int dst_layer) const;
140 
141  /// Returns the LUT for the beauty pass, if any.
142  PXL_Lookup *getBeautyLUT();
143  TIL_Raster *getBeautyPassImage(RE_Render *r);
144  TIL_Raster *getBeautyPassDepthImage(RE_Render *r);
145  bool getBeautyPassHDR() const;
146  void setBeautyPassConsolidate(bool con);
147 
148  /// ensure all geometry is up to date before a redraw, and cleanup after
149  void preSetupGeometry(RE_Render *r);
150  void postCleanupGeometry(RE_Render *r);
151  void setupGeometry(RE_Render *r);
152  void cleanupGeometry(RE_Render *r);
153  void fastSetupGeometry(RE_Render *r);
154 
155  /// returns a single pick result from the x,y mouse coords. The pick buffer
156  /// must be rendered first. Returns false if nothing was picked.
157  bool singlePickObject(RE_Render *r, int x, int y,
158  GR_PickRecord &result,
159  const GR_ObjectPickFlags &pick_flags,
160  fpreal *depth,
161  const GUI_DetailList *geos);
162 
163  /// Check for a pick on a handle. Returns true if a handle was picked.
164  bool singlePickHandle(RE_Render *r, int x, int y,
165  GR_PickRecord &result,
166  fpreal *depth);
167 
168  /// @brief Area select objects, possibly with a matte.
169  /// returns a list of object IDs for those objects picked. This does not
170  /// pick handles or SOP geometry. The return value is the length of the pick
171  /// list.
172  int boxPickObject(RE_Render *r,
173  const UT_DimRect &area,
174  uint8 *texture,
175  UT_Array<GR_PickRecord> &pick_records,
176  bool visible_only,
177  bool wholy_contained,
178  const GUI_DetailList *geos);
179 
180  /// @brief Single select a geomerty element.
181  /// Returns a single pick result for components in objects 'geos'.
182  bool singlePickComponent(RE_Render *r,
183  int x, int y,
184  GR_PickRecord &result,
185  unsigned pickmask,
187  fpreal *depth,
188  const GUI_DetailList *geos,
189  bool enable_occlusion);
190  /// Box, lasso or paint select components.
191  int boxPickComponent(RE_Render *r,
192  const UT_DimRect &area,
193  uint8 *texture,
194  UT_Array<GR_PickRecord> &pick_records,
195  bool sort_records,
196  unsigned pickmask,
198  bool visible_only,
199  bool contained,
200  const GUI_DetailList *geos);
201  void pickRenderGeometry(RE_Render *r,
202  bool object_only,
203  unsigned int primmask,
205  const GUI_DetailList *geos,
206  bool visible_only);
207  int componentPickRender(RE_Render *r,
208  unsigned int pickmask,
209  unsigned int xray_pickmask,
211  const GUI_DetailList *geos,
212  GR_PickStyle pickstyle,
213  bool invert_mask,
214  UT_Array<GR_PickRecord> *pick_rec);
215 
216  /// @brief Single select a geomerty element to snap to.
217  /// Returns a single snap result for components in objects 'geos'.
218  bool singleSnapComponent(RE_Render *r,
219  int x, int y,
220  bool hide_selected, bool enable_occlusion,
221  bool do_xray, bool extend_floor,
222  GR_PickRecord &result,
223  UT_Array<GR_PickRecord> &near_results,
224  unsigned pickmask,
226  const GUI_DetailList *geos=NULL);
227 
228  /// Call to manually invalidate any cached pick/snap buffers when the
229  /// automatic detection is insufficient.
230  void invalidatePickBuffers();
231 
232  /// Box, lasso or paint select components.
233  /// Render all geometry in the viewport using render mode 'render_type'.
234  GUI_RenderPassFlags renderGeometry(RE_Render *r,
235  GR_RenderMode render_type,
236  GR_ShadingPass shade_pass,
237  GR_AlphaPass apass,
238  OP_Bundle *visible_objs = NULL,
240 
241  /// @brief Draw geometry decorations and markers
242  /// Render all decorations. If 'hover_decorations' is true, only the
243  /// locate-style decorations will be drawn.
244  void renderDecorations(RE_Render *r,
245  GUI_DisplayOption *dispopt,
246  bool hover_decorations);
247 
248  /// Render geometry corresponding to the OP_Nodes is the passed list.
249  GUI_RenderPassFlags renderSomeGeometry(RE_Render *r, int x, int y,
250  const UT_Array<OP_Node*> &nodes,
251  const UT_IntArray *detail_indexes,
252  GR_RenderMode render_type,
253  GR_ShadingPass shade_pass,
254  GR_AlphaPass apass,
255  bool do_geometry_setup);
256 
257  /// Render a single geometry using render mode 'render_type'.
258  GUI_RenderPassFlags renderSingleGeo(RE_Render *r,
259  GUI_GeoRender *gr,
260  GR_RenderMode render_type,
261  GR_ShadingPass shading_pass,
262  GR_AlphaPass ap,
263  bool init_lights,
264  bool treat_uv_viewport_as_3d = false);
265 
266  /// Our floor or construction plane.
267  void renderFloor(RE_Render *r, int x, int y);
268  DM_FloorInterface *getFloorInterface() { return myFloorInterface; }
269 
270  /// Interface to viewport hooks (render and mouse)
271  DM_ViewportHooks &hooks() const { return *myViewportHooks; }
272 
273  /// Methods to process mouse movement
274  /// @{
275  bool hasLocates();
276  void handleLocateEvent(UI_Event *e);
277  /// @}
278 
279  /// @brief Access displayed objects in the viewport
280  /// Return a handle to an object displayed in the viewport. Do not cache
281  /// these over several redraws, as they may become invalid. get*Object()'s
282  /// index parameter can be 0 to getNum*Objects()-1.
283  /// @{
284  int getNumOpaqueObjects() const;
285  DM_GeoDetail getOpaqueObject(int index) const;
286 
287  int getNumTransparentObjects() const;
288  DM_GeoDetail getTransparentObject(int index) const;
289 
290  int getNumUnlitObjects() const;
291  DM_GeoDetail getUnlitObject(int index) const;
292 
293  int getNumXRayObjects() const;
294  DM_GeoDetail getXRayObject(int index) const;
295  /// @}
296 
297  /// Returns the current detail within the object, when at SOP/POP/DOP level.
298  DM_GeoDetail getCurrentDetail() const;
299 
300  void initGPUTimers(RE_Render *r);
301  void collectGPUTimers(RE_Render *r);
302 
303  GUI_RotoView getRotoViewType();
304 
305  void markGeoSetup(bool setup,
306  DM_Viewport *setup_port = NULL);
307  bool isGeoSetup() const { return mySetupFlag; }
308 
309  // All lights in the scene, for the material render codepath.
310  void setGlobalLightArray(const UT_Array<OBJ_Ambient *> &l);
311  void setGlobalLightArray(const UT_ValArray<RE_Light*> &l);
312 
313  // Get and set lighting information.
314  bool setupLights(RE_Render *r, GUI_DisplayOption *opt);
315  void cleanupLights(RE_Render *r);
316  RE_LightList *getLightList() { return &myLightList; }
317 
319  { return myMaterialLights; }
320 
321  GR_LightingPass getLightingPass() const { return myLightingPass; }
322  void setLightingPass(GR_LightingPass p) { myLightingPass=p;}
323 
324  // Returns the approximate memory usage of the viewport at the current size
325  // given hdr on/off, high quality lighting on/off, transparency > low,
326  // and aa at 1,2,4 or 8x.
327  int64 getFramebufferUsageKB(bool hdr, bool hql, bool trans,
328  int aa);
329 
330  // using zt[0] / (Z + zt[1]) will transform zbuffer values into viewspace Z
331  // If light is specified, then the shadowmap range of that light is computed
332  void getZBufferTransform(float zt[2],RE_Light *light=NULL);
333 
334  // Handle a change in which geometry is displayed.
335  // For keeping track of what type of UVs to show in UV mode.
336  void handleNewGeometryEvent(UI_Event *e);
337  void updateAttributeOptions(const GU_DetailHandle &gdh);
338 
339  // ---------------------------------------------------------------------
340  // the following methods should be treated as private to DM.
341 
342  /// Methods for starting and stopping events
343  /// in the old performance monitor.
344  void startPerfMonTimer(RE_Render *r,
345  RE_GPUTimer &timer,
346  const char *msg) const;
347  void stopPerfMonTimer(RE_Render *r,
348  RE_GPUTimer &timer) const;
349 
350  // setup proper winding and culling, returning a set of flags to use for
351  // the cleanup method.
352  int setupBackfaceAndWinding(RE_Render *r,
353  const GUI_DisplayOption *opts);
354  void cleanupBackfaceAndWinding(RE_Render *r,
355  int setup_flags);
356 
357  // resolve the AA Z buffer to a single sample, taking the further sample
358  bool resolveDepthBuffer(RE_Render *r,
359  RE_Texture *aa_depth_tex,
360  RE_Texture *depth_tex) const;
361 
362  int64 getSceneVersion(fpreal t, bool shadow, bool &timedep);
363 
364  // access to parent viewport
365  const DM_Viewport *getDisplay() const { return myDisplay; }
366  DM_Viewport *getDisplay() { return myDisplay; }
367 
368  // for transparency
369  int getTransparencyLayers(const GUI_DisplayOption *disp);
370  void prepareStencilRouting(RE_Render *r, int nsamples);
371  void prepareABufferFront(RE_Render *r, int nsamples);
372 
373  void updateTimeDependentLook(fpreal t);
374 
375  bool isToolbarLinked() const; // see .C file note
376 
377  const GUI_DetailList &getDetails() const;
378  const GUI_DetailList &getDetails();
379 
380  void setupViewUniforms(RE_Render *r);
381  void cleanupViewUniforms(RE_Render *r);
382 
383  // Looks through the lights for an environment map
384  void applyEnvMapOverride(RE_Render *r) const;
385 
386 protected:
387  friend class dm_SetupTask;
388 
389 private:
390 
391  const DM_SceneManager &modeler() const
392  { return mySceneManager; }
393  DM_SceneManager &modeler()
394  { return mySceneManager; }
395 
396  const GUI_SceneLook *getLook() const { return mySceneLook; }
397  GUI_SceneLook *getLook() { return mySceneLook; }
398 
399  bool shouldDisplayObject(const DM_Viewport &vport,
400  GUI_DetailLook *look,
401  OBJ_Node *node);
402 
403  bool shouldVisualizeObject(const DM_Viewport &vport,
404  GUI_DetailLook *look,
405  OBJ_Node *node);
406 
407  bool shouldShowComponentSelections(const GUI_DetailLook &look,
408  const GUI_DisplayOption &d) const;
409 
410  enum DM_BufferBlend
411  {
412  ACCUM_ADD,
413  ACCUM_REPLACE,
414  ACCUM_ALPHA_BLEND
415  };
416 
417  // prints a message in the viewer (centrally justified) on a given line
418  void renderMessage( RE_Render *ren, int x, int y,
419  const char* msg, int line );
420  // renders true viewer name
421  void doRenderCurrentName(RE_Render *r, int x, int y);
422  // renders the snapshot label
423  void doRenderSnapshotName(RE_Render *r, int x, int y);
424 
425  // prints a message in the viewer for camera (central, bottom justified)
426  void renderCameraMessage( RE_Render *ren, int x, int y,
427  const char* msg);
428 
429  // Render a mask over the parts of the viewport outside of the view
430  // subregion.
431  void renderViewMask(RE_Render *r, int x, int y);
432 
433  bool resizeBeautyPassBuffer(RE_Render *r,
434  int width, int height,
435  bool hdr, bool needs_aa);
436  void destroyBeautyPassBuffer();
437  RE_OGLFramebuffer *getBeautyPassBuffer(bool allow_aa);
438 
439  // initializes the view and projection to a 1:1 pixel transform.
440  void pushIdentityOrthoView(RE_Render *r);
441  void popIdentityOrthoView(RE_Render *r);
442 
443  // Render the viewport name.
444  void doRenderName(RE_Render *r, int x, int y,
445  bool snapshot_name = false);
446  // Render the current state information.
447  void doRenderStateStatus(RE_Render *r);
448  // Render a mask over the parts of the viewport outside of the view
449  // subregion.
450  void doRenderViewMask(RE_Render *r, int x, int y);
451 
452  // Common utility methods to setup lights and the z buffer.
453  void setupForRender(RE_Render &ren,
454  bool allow_smooth = true);
455  void cleanupAfterRender(RE_Render &ren);
456 
457 
458  void setGammaPass(bool b) { myGammaPass = b?1:0; }
459 
460  void doRenderNoHookUnlitObjects(RE_Render *r, int x, int y);
461  void doRenderUnlitObjects(RE_Render *r, int x, int y);
462 
463  // Render the camera's mask (bars and anything else inside the mask)
464  void doRenderMask(RE_Render *r, int, int);
465 
466  void startBeautyPass(RE_Render *r, bool allow_aa=true);
467  void endBeautyPass(RE_Render *r, bool allow_aa=true);
468  bool isBeautyPassAA(bool allow_aa = true);
469 
470  // helper methods for setting up stereo passes
471  void setupStereo3d(RE_Render *r);
472  void setupStereoVR(RE_Render *r);
473  void cleanupStereo3d(RE_Render *r);
474  void interruptStereo(RE_Render *r);
475  void resumeStereo(RE_Render *r);
476  void setupStereo3dForLeftCamera(RE_Render *r,
477  bool uniforms_for_3d);
478  void setupStereo3dForRightCamera(RE_Render *r,
479  bool uniforms_for_3d);
480  void updateStereoViewUniforms(RE_Render *r, bool left);
481  void assignStereoLeft(RE_Render *r,
482  const GUI_ViewState::GUI_ViewType vt);
483  void assignStereoRight(RE_Render *r,
484  const GUI_ViewState::GUI_ViewType vt);
485  void assignStereoTop(RE_Render *r,
486  const GUI_ViewState::GUI_ViewType vt);
487  void assignStereoBottom(RE_Render *r,
488  const GUI_ViewState::GUI_ViewType vt);
489 
490  bool setupTransparentBuffers(RE_Render *r, int hdr);
491  void destroyTransparentBuffers();
492 
493  void renderViewport(RE_Render *r, int x, int y);
494  void renderSceneView(RE_Render *r, int x, int y);
495 
496  // Render the transparent bars defined by the camera's mask parameters
497  void renderCameraMask(RE_Render *r);
498 
499  // Render the object that goes on top of the camera mask
500  void renderCameraMaskOverlay(RE_Render *, int, int);
501 
502  void renderTransparentGeometry(
503  RE_Render *r,
504  GUI_DisplayOption *dispopt);
505  bool renderHQTransparencyPass(
506  RE_Render *r, int x, int y,
507  GUI_DisplayOption *dispopt,
508  const UT_Array<GUI_DetailLook *> *geos = NULL,
509  bool for_xray = false);
510  bool setupHQTransparentBuffers(RE_Render *r, int nsamples,
511  bool hdr);
512  void destroyHQTransparentBuffers();
513 
514  void initStencilABuffer(RE_Render *r, int nsamples);
515 
516  bool setupUnlitAlphaBuffer(RE_Render *r, bool zbuf);
517  void destroyUnlitAlphaBuffer();
518 
519  // Geometry pick code
520  bool createPickBuffer(RE_Render *r);
521  bool renderPickBuffer(RE_Render *r,
522  bool object_pick,
523  bool enable_occlusion,
524  unsigned int pickmask,
526  const GUI_DetailList *geos,
527  const GR_ObjectPickFlags &pick_flags);
528 
529  // Query the pick buffer. Returns true on a hit.
530  // allow_geo - allow geometry picks (either obj or component
531  // depending on geo_is_object)
532  // allow_handle - allow handle picks
533  // geo_is_object - geometry records are objects instead of
534  // components
535  // geo_ignore_depth - avoid scanning samples looking for a closer
536  // hit (only when !geo_is_object)
537  // geo_prioritize - scan samples looking for a higher priority
538  // component pick (only when !geo_is_object)
539  // overlap_dist - the distance at which to consider picks to
540  // be essentially overlapping and employ some
541  // heuristics to pick the best one
542  bool pickFromBuffer(RE_Render *r,
543  RE_PickBuffer *pick_buffer,
544  int x, int y,
545  bool allow_geo,
546  bool allow_handle,
547  bool geo_is_object,
548  bool geo_ignore_depth,
549  bool geo_prioritize,
550  int pick_dist,
551  int overlap_dist,
552  GR_PickRecord &result,
553  UT_Array<GR_PickRecord> *results,
554  fpreal *depth,
555  const GUI_DetailList *geos);
556 
557  int filterPickData(int32 *pick_base_data,
558  int32 *pick_component_data,
559  int npicks,
560  UT_Array<GR_PickRecord> &pick_records);
561  int subtractPickData(const UT_Vector3iArray &base,
562  const UT_Vector3iArray &comp,
563  const UT_Array<GR_PickRecord> &outside,
564  UT_Array<GR_PickRecord> &results);
565  void objectPickRender(RE_Render *r,
566  unsigned int pickmask,
568  const GUI_DetailList *geos,
569  const GR_ObjectPickFlags &pick_flags);
570  void doObjectBoxPick(RE_Render *r,
571  const UT_DimRect &area,
572  UT_Array<GR_PickRecord> &pick_records,
573  bool visible_only,
574  bool invert_mask,
575  bool use_texture,
576  bool clip_edges,
577  const GUI_DetailList *geos);
578 
579  int boxPickVisibleComponent(RE_Render *r,
580  const UT_DimRect &area,
581  uint8 *texture,
582  UT_Array<GR_PickRecord> &pick_records,
583  unsigned pickmask,
585  const GUI_DetailList *geos,
586  bool contained);
587  int boxPickFrustumComponent(RE_Render *r,
588  const UT_DimRect &area,
589  uint8 *texture,
590  UT_Array<GR_PickRecord> &pick_records,
591  unsigned pickmask,
593  const GUI_DetailList *geos,
594  bool visible_only,
595  bool contained);
596  int boxPickComponentGL42(RE_Render *r,
597  const UT_DimRect &area,
598  uint8 *texture,
599  UT_Array<GR_PickRecord> &pick_records,
600  unsigned pickmask,
602  const GUI_DetailList *geos,
603  bool visible_only,
604  bool contained);
605  void renderOffsetDepthPass(RE_Render *r,
606  bool skip_obj_sel_looks = false);
607  // end pick code
608 
609  // Snapping and handle pick code
610  bool createSnapHandleBuffer(RE_Render *r);
611  bool renderHandleBuffer(RE_Render *r);
612  bool renderSnapBuffer(RE_Render *r,
613  unsigned int snapmask,
615  const GUI_DetailList *geos,
616  bool hide_selected,
617  bool enable_occlusion,
618  bool do_xray, bool extend_floor);
619  // end snapping and handle pick code
620 
621  bool sampleDepth(RE_Render *r, int x, int y, fpreal &z,
622  RE_Texture *depth_texture);
623 
624  void renderXray(RE_Render *r,
625  GUI_DisplayOption *dispopts);
626 
627  void renderOnionSkin(RE_Render *r,
628  GUI_DisplayOption *dispopts);
629 
630  bool renderBeautyPass(RE_Render *r, int x, int y,
631  GUI_DisplayOption *dispopt,
632  bool &needs_lighting);
633  bool renderTransparencyPass(RE_Render *r, int x, int y,
634  GUI_DisplayOption *dispopt);
635  bool renderEnvironmentMaps(RE_Render *r);
636  void compositePasses(RE_Render *r,
637  const GUI_DisplayOption *dispopt,
638  bool has_trans_pass,
639  bool has_alpha_buffers);
640 
641  void normalQualityRender(
642  RE_Render *r,
643  GUI_DisplayOption *dispopt,
644  GR_AlphaPass alpha_pass,
646  const UT_Array<GUI_DetailLook*> *geos=NULL);
647 
648  bool isUsingHQLighting(RE_Render *r,
649  const GUI_DisplayOption *dispopt);
650 
651  void renderOverlappingUV(RE_Render *r,
652  GUI_DisplayOption *disp);
653  bool setupOverlappingUVBuffer(RE_Render *r, int w, int h);
654  void destroyOverlappingUVBuffer();
655 
656  void renderCoincidentPoints(RE_Render *r,
657  GUI_DisplayOption *disp);
658  bool setupCoincidentBuffer(RE_Render *r, int w, int h);
659  void destroyCoincidentBuffer();
660 
661  void subtractFromSelection(UT_Array<GR_PickRecord> &results,
663  exint start_subtracting_at,
664  UT_Array<GR_PickRecord> &sub) const;
665 #ifdef MBSD_COCOA
666  void dmOSXDepthBufferWorkaround(RE_Render *r,
667  RE_Texture *tex);
668 #endif
669  void updateVisibleBoundariesAndViews(int vis_display_sets);
670 
671  mutable RE_ShaderHandle *myDepthResolveShader;
672 
673  UT_ValArray<RE_Light *> myMaterialLights;
674 
675  RE_OGLFramebuffer *myBeautyPassBuffer;
676  RE_OGLFramebuffer *myBeautyPassAABuffer;
677  RE_Texture *myBeautyColorTexture;
678  RE_Texture *myBeautyDepthTexture;
679  RE_Texture *myBeautyPassAACTexture;
680  RE_Texture *myBeautyPassAAZTexture;
681  int myBeautyPassSamples;
682  bool myBeautyPassHDR;
683 
684  RE_OGLFramebuffer *myTransparentFBO;
685  RE_Texture *myTransparentColorTex;
686  RE_Texture *myTransparentZTex;
687  bool myTransparentHDR;
688 
689  DM_RenderHighQuality *myHQRender;
690 
691  RE_Texture *myRandomDitherTexture;
692 
693  PXL_Lookup myLookup;
694  UT_String myLUTFile;
695 
696  bool myIsBeautyPass;
697  GR_LightingPass myLightingPass;
698  bool myIsAlphaPass;
699  bool myUseUnlitMask;
700  bool myHighQualityMode;
701  bool myIsXRayPass;
702  bool myHasGILight;
703  bool myHasEnvLight;
704  bool myHasShadowedLights;
705  bool myHeadlightOnlyFlag;
706  uint64 myStandaloneFlag;
707  int myStereoMode;
708  GR_DecorationOverride myDecorationOverride;
709  UT_StringHolder myDisplayedUVAttrib;
710 
711  mutable RE_OGLFramebuffer *myDepthResolveFBO;
712  mutable unsigned int myDepthResolveShaderFailed : 1,
713  myZCompositeShaderFailed : 1;
714 
715  DM_FloorInterface *myFloorInterface;
716  UT_IntArray mySetupLookShowSelection;
717  bool myHasSelectionsShown;
718  int myDecorLocateMask;
719  int myDecorVisibleMask;
720  int myGammaPass;
721 
722  RE_GPUTimer myBGTimer;
723  RE_GPUTimer myFGTimer;
724  RE_GPUTimer myGeoCleanupTimer;
725  RE_GPUTimer myUnlitTimer;
726 
727  DM_ViewportType myType;
728  int myRenderCount;
729  RE_OGLContext myInitContext;
730 
731  UT_Array<GUI_DetailLook *> mySetupLooks;
732  UT_Array<OBJ_Node *> mySetupObjects;
733  UT_Array<GUI_DetailLook *> myUnlitLooks;
734  UT_Array<GUI_DetailLook *> myXRayLooks;
735  UT_Array<GUI_DetailLook *> myOnionSkinLooks;
736  UT_Array<GUI_DetailLook *> myTransparentLooks;
737  UT_Array<OBJ_Node *> myTransparentObjects;
738 
739  bool mySavedAntiAliasOption;
740  GUI_SceneLook *mySceneLook;
741  DM_SceneManager &mySceneManager;
742  DM_Viewport *myDisplay;
743  bool mySetupFlag;
744 
745  // Buffers for picking geometry.
746  UT_UniquePtr<RE_PickBuffer> myPickBuffer;
747  UT_TokenString *myPickBufferTestHash;
748 
749  // Extra data for box picking.
750  RE_ShaderHandle myBoxPickObjectShader;
751  RE_Geometry *myBoxPickObjectGeometry;
752  RE_Texture *myBoxPickMaskTexture;
753 
754  // Buffers for snapping to components.
755  UT_UniquePtr<RE_PickBuffer> mySnapHandleBuffer;
756  UT_TokenString *mySnapHandleBufferTestHash;
757 
758  RE_LightList myLightList;
759  UT_ValArray<RE_Light *> myNormalQualityLights;
760 
761  RE_OGLFramebuffer *myUnlitAlphaFBO;
762  RE_Texture *myUnlitAlphaTexture;
763  RE_Texture *myUnlitDepthTexture;
764 
765  static RE_ShaderHandle theBeautyCompShader;
766  static RE_ShaderHandle theDepthCompShader;
767  static RE_ShaderHandle theDepthComp8Shader;
768  static RE_ShaderHandle theDepthComp16Shader;
769  static RE_ShaderHandle theUnlitAlphaShader;
770  static RE_ShaderHandle theUnlitDepthShader;
771  static RE_ShaderHandle theXRayShader;
772 
773  int myDecorLocateRawPos[2];
774  int myDecorLocatePos[2];
775  RE_ShaderHandle mySampleDepthShader;
776 
777  RE_OGLFramebuffer *myHQTransparentFBO;
778  RE_Texture *myHQTransparentColorTex;
779  RE_Texture *myHQTransparentStencil;
780  bool myHQTransparentHDR;
781 
782  UT_UniquePtr<RE_Geometry> myCubeGeo;
783 
784  RE_OGLFramebuffer *myCoincidentBuffer;
785  RE_Texture *myCoincidentTexture;
786  RE_OGLFramebuffer *myOverlappingUVBuffer;
787 
788  bool myRampUnitPushed;
789 
790  RE_RenderWait *myBeautyPassSync;
791 
792  RE_GPUTimer myPreRenderTimer;
793  RE_GPUTimer myPostRenderTimer;
794  RE_GPUTimer myXRayTimer;
795  RE_GPUTimer myOnionSkinTimer;
796  RE_GPUTimer myCompositeTimer;
797  RE_GPUTimer myBGEnvMapTimer;
798  RE_GPUTimer myDecorTimer;
799  RE_GPUTimer myHandleTimer;
800 
801  bool myUseHQLighting;
802 
803  DM_ViewportHooks *myViewportHooks;
804  UT_IntArray myViewportConfig;
805 };
806 
807 inline int
809 {
810  return mySetupLooks.entries();
811 }
812 
813 inline DM_GeoDetail
815 {
816  return DM_GeoDetail(mySetupLooks(index));
817 }
818 
819 inline int
821 {
822  return myTransparentLooks.entries();
823 }
824 
825 inline DM_GeoDetail
827 {
828  return DM_GeoDetail(myTransparentLooks(index));
829 }
830 
831 inline int
833 {
834  return myUnlitLooks.entries();
835 }
836 
837 inline DM_GeoDetail
839 {
840  return DM_GeoDetail(myUnlitLooks(index));
841 }
842 
843 inline int
845 {
846  return myXRayLooks.entries();
847 }
848 
849 inline DM_GeoDetail
851 {
852  return DM_GeoDetail(myXRayLooks(index));
853 }
854 
855 #endif
const UT_ValArray< RE_Light * > & getAllLights() const
bool isGeoSetup() const
GR_DecorationOverride
Definition: GR_Defines.h:194
GLint left
Definition: glcorearb.h:2004
const DM_Viewport * getDisplay() const
GA_API const UT_StringHolder rot
GLdouble GLdouble GLdouble z
Definition: glcorearb.h:847
A collection of vertex arrays defining a geometry object. This class acts as a wrapper around multipl...
Definition: RE_Geometry.h:53
GLint GLuint mask
Definition: glcorearb.h:123
int getNumXRayObjects() const
Access displayed objects in the viewport Return a handle to an object displayed in the viewport...
GLint y
Definition: glcorearb.h:102
int getNumTransparentObjects() const
Access displayed objects in the viewport Return a handle to an object displayed in the viewport...
GR_AlphaPass
Definition: GR_Defines.h:107
DM_ViewportHooks & hooks() const
Interface to viewport hooks (render and mouse)
png_infop png_bytep * trans
Definition: png.h:2520
void * RE_OGLContext
Definition: RE_Types.h:865
GLint GLsizei width
Definition: glcorearb.h:102
DM_GeoDetail getUnlitObject(int index) const
Access displayed objects in the viewport Return a handle to an object displayed in the viewport...
#define DM_API
Definition: DM_API.h:10
DM_ViewportType getViewType() const
The projection type of this viewport.
Definition: DM_VPortAgent.h:76
int getNumOpaqueObjects() const
Access displayed objects in the viewport Return a handle to an object displayed in the viewport...
long long int64
Definition: SYS_Types.h:100
void setLightingPass(GR_LightingPass p)
unsigned long long uint64
Definition: SYS_Types.h:101
GLint GLint GLsizei GLsizei GLsizei depth
Definition: glcorearb.h:475
GR_ShadingPass
Definition: GR_Defines.h:115
GR_RenderMode
Definition: GR_Defines.h:42
int64 exint
Definition: SYS_Types.h:109
DM_GeoDetail getTransparentObject(int index) const
Access displayed objects in the viewport Return a handle to an object displayed in the viewport...
GUI_RenderPassFlags
int int32
Definition: SYS_Types.h:28
GLboolean GLboolean GLboolean b
Definition: glcorearb.h:1221
GLint GLsizei GLsizei height
Definition: glcorearb.h:102
exint entries() const
Alias of size(). size() is preferred.
Definition: UT_Array.h:446
DM_FloorInterface * getFloorInterface()
Contains transitional objects to provide some backward compatibility for code that references old GEO...
DM_GeoDetail getOpaqueObject(int index) const
Access displayed objects in the viewport Return a handle to an object displayed in the viewport...
GLfloat GLfloat GLfloat GLfloat h
Definition: glcorearb.h:2001
double fpreal
Definition: SYS_Types.h:263
GUI_RotoView
Viewport type for Rotoscope settings.
RE_LightList * getLightList()
unsigned char uint8
Definition: SYS_Types.h:25
virtual void close()
DM_GeoDetail getXRayObject(int index) const
Access displayed objects in the viewport Return a handle to an object displayed in the viewport...
GLuint index
Definition: glcorearb.h:785
DM_GeoSortMode
Definition: DM_Defines.h:144
int getNumUnlitObjects() const
Access displayed objects in the viewport Return a handle to an object displayed in the viewport...
GLint GLenum GLint x
Definition: glcorearb.h:408
GR_LightingPass
Definition: GR_Defines.h:122
GLint GLint GLsizei GLint GLenum GLenum type
Definition: glcorearb.h:107
GLuint texture
Definition: glcorearb.h:414
GLubyte GLubyte GLubyte GLubyte w
Definition: glcorearb.h:856
#define DM_VIEWPORT_PERSPECTIVE
GR_LightingPass getLightingPass() const
GLboolean r
Definition: glcorearb.h:1221
DM_Viewport * getDisplay()
int DM_ViewportType
GA_API const UT_StringHolder area
Simple interface to building a shader from a .prog file.
GR_PickStyle
Definition: GR_Defines.h:226