/usr/include/vtk-5.8/vtkParallelRenderManager.h is in libvtk5-dev 5.8.0-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 | /*=========================================================================
Program: Visualization Toolkit
Module: vtkParallelRenderManager.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
Copyright 2003 Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000, there is a non-exclusive license for use of this work by
or on behalf of the U.S. Government. Redistribution and use in source and
binary forms, with or without modification, are permitted provided that this
Notice and any statement of authorship are reproduced on all copies.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
// .NAME vtkParallelRenderManager - An object to control parallel rendering.
//
// .SECTION Description:
// vtkParallelRenderManager operates in multiple processes. It provides
// proper renderers and render windows for performing the parallel
// rendering correctly. It can also attach itself to render windows and
// propagate rendering events and camera views.
//
// .SECTION Note:
// Many parallel rendering schemes do not correctly handle transparency.
// Unless otherwise documented, assume a sub class does not.
//
// .SECTION ToDo:
// Synchronization/barrier primitives.
//
// Query ranges of scalar values of objects in addition to the boundry in
// three-space
//
#ifndef __vtkParallelRenderManager_h
#define __vtkParallelRenderManager_h
#include "vtkObject.h"
class vtkDoubleArray;
class vtkMultiProcessController;
class vtkMultiProcessStream;
class vtkRenderer;
class vtkRendererCollection;
class vtkRenderWindow;
class vtkTimerLog;
class vtkUnsignedCharArray;
class VTK_PARALLEL_EXPORT vtkParallelRenderManager : public vtkObject
{
public:
vtkTypeMacro(vtkParallelRenderManager, vtkObject);
virtual void PrintSelf(ostream &os, vtkIndent indent);
// Description:
// Builds a vtkRenderWindow compatible with this render manager. The
// user program is responsible for registering the render window with the
// SetRenderWindow method and calling Delete. It is not advisable to use
// a parallel render manager with a render window that was not built with
// this method.
virtual vtkRenderWindow *MakeRenderWindow();
// Description:
// Builds a vtkRenderer compatible with this render manager. (Should we
// also register it?) The user program is responsible for calling
// Delete. It is not advisable to use a parallel render manager with a
// renderer that was not built with this method.
virtual vtkRenderer *MakeRenderer();
// Description:
// Set/Get the RenderWindow to use for compositing.
// We add a start and end observer to the window.
vtkGetObjectMacro(RenderWindow, vtkRenderWindow);
virtual void SetRenderWindow(vtkRenderWindow *renWin);
// Description:
// Set/Get the vtkMultiProcessController which will handle communications
// for the parallel rendering.
vtkGetObjectMacro(Controller, vtkMultiProcessController);
virtual void SetController(vtkMultiProcessController *controller);
// Description:
// This method sets the piece and number of pieces for each
// actor with a polydata mapper.
virtual void InitializePieces();
// Description:
// Make all rendering windows not viewable set as off screen rendering.
// To make all renderwindows on screen rendering again, call
// OffScreenRenderingOff on all the render windows. This class assumes
// the window on root node is the only one viewable. Subclasses should
// change this as necessary.
virtual void InitializeOffScreen();
// Description:
// Initializes the RMIs and then, if on root node, starts the interactor
// on the attached render window. Otherwise, starts processing RMIs.
// When the interactor returns, it breaks the RMI listening on all other
// processors.
virtual void StartInteractor();
// Description:
// If on node other than root, starts serving RMI requests for parallel
// renders.
virtual void StartServices();
// Description:
// If on root node, stops the RMI processing on all service nodes.
virtual void StopServices();
// Description:
// Callbacks that initialize and finish rendering and other tasks.
virtual void StartRender();
virtual void EndRender();
virtual void SatelliteStartRender();
virtual void SatelliteEndRender();
virtual void RenderRMI();
virtual void ResetCamera(vtkRenderer *ren);
virtual void ResetCameraClippingRange(vtkRenderer *ren);
virtual void ComputeVisiblePropBoundsRMI(int renderId);
virtual void InitializeRMIs();
// Description:
// Resets the camera of each renderer contained in the RenderWindow.
// Should only be called in the "root" process, and all remote processes
// must be processing RMIs for this method to complete.
virtual void ResetAllCameras();
// Description:
// Calculates the bounds by gathering information from all processes.
virtual void ComputeVisiblePropBounds(vtkRenderer *ren, double bounds[6]);
// Description:
// Turns on/off parallel rendering. When on (the default) the object
// responds to render events of the attached window, propagates the
// render event to other processors, and otherwise enables the parallel
// rendering process.
vtkSetMacro(ParallelRendering, int);
vtkGetMacro(ParallelRendering, int);
vtkBooleanMacro(ParallelRendering, int);
// Description:
// Turns on/off render event propagation. When on (the default) and
// ParallelRendering is on, process 0 will send an RMI call to all remote
// processes to perform a synchronized render. When off, render must be
// manually called on each process.
vtkSetMacro(RenderEventPropagation, int);
vtkGetMacro(RenderEventPropagation, int);
vtkBooleanMacro(RenderEventPropagation, int);
// Description:
// Get/Set the default value used for RenderEventPropagation when a new
// instance of vtkParallelRenderManager is created.
// Set to true by default.
static void SetDefaultRenderEventPropagation(bool val)
{ vtkParallelRenderManager::DefaultRenderEventPropagation = val; }
static bool GetDefaultRenderEventPropagation()
{ return vtkParallelRenderManager::DefaultRenderEventPropagation; }
// Description:
// This is used for tiled display rendering. When data has been
// duplicated on all processes, then we do not need to compositing.
// Cameras and renders are still propagated though.
vtkSetMacro(UseCompositing, int);
vtkGetMacro(UseCompositing, int);
vtkBooleanMacro(UseCompositing, int);
// Description:
// Set/Get the reduction factor (for sort-last based parallel renderers).
// The size of rendered image is divided by the reduction factor and then
// is blown up to the size of the current vtkRenderWindow. Setting
// higher reduction factors enables shorter image transfer times (which
// is often the bottleneck) but will greatly reduce image quality. A
// reduction factor of 2 or greater should only be used for intermediate
// images in interactive applications. A reduction factor of 1 (or less)
// will result in no change in image quality. A parallel render manager
// may ignore the image reduction factor if it will result in little or
// no performance enhancements (eg. it does not do image space
// manipulations).
virtual void SetImageReductionFactor(double factor);
vtkGetMacro(ImageReductionFactor, double);
vtkSetMacro(MaxImageReductionFactor, double);
vtkGetMacro(MaxImageReductionFactor, double);
// Description:
// Sets the ReductionFactor based on the given desired update rate and
// the rendering metrics taken from the last time UpdateServerInfo was
// called. Note that if AutoReductionFactor is on, this function is called
// with the desired update rate of the render window automatically.
virtual void SetImageReductionFactorForUpdateRate(double DesiredUpdateRate);
// Description:
// If on, the ReductionFactor is automatically adjusted to best meet the
// the DesiredUpdateRate in the current RenderWindow based on metrics
// from the last render.
vtkSetMacro(AutoImageReductionFactor, int);
vtkGetMacro(AutoImageReductionFactor, int);
vtkBooleanMacro(AutoImageReductionFactor, int);
// Description:
// Get rendering metrics.
vtkGetMacro(RenderTime, double);
vtkGetMacro(ImageProcessingTime, double);
// Description:
// By default, the state of all renderers in the root's render window is
// propagated to the rest of the processes. In order for this to work, all
// render windows must have the same renderers in the same order. If this is
// not the case, you can turn off the SyncRenderWindowRenderers. When this
// flag is off, the list of renderers held by this parallel render manager
// (initially empty) is synced. You can modify the list of renderers with the
// AddRenderer, RemoveRenderer, and RemoveAllRenderers methods.
vtkGetMacro(SyncRenderWindowRenderers, int);
vtkSetMacro(SyncRenderWindowRenderers, int);
vtkBooleanMacro(SyncRenderWindowRenderers, int);
virtual void AddRenderer(vtkRenderer *);
virtual void RemoveRenderer(vtkRenderer *);
virtual void RemoveAllRenderers();
// Description:
// If on (the default), the result of any image space manipulations are
// written back to the render window frame buffer. If off, the image
// stored in the frame buffer may not be correct. Either way, the
// correct frame buffer images may be read with
// vtkParallelRenderManager::GetPixelData. Turning WriteBackImages off
// may result in a speedup if the render window is not visible to the user
// and images are read back for further processing or transit.
vtkSetMacro(WriteBackImages, int);
vtkGetMacro(WriteBackImages, int);
vtkBooleanMacro(WriteBackImages, int);
// Description:
// If on (the default), when the ImageReductionFactor is greater than 1
// and WriteBackImages is on, the image will be magnified to fill the
// entire render window.
vtkSetMacro(MagnifyImages, int);
vtkGetMacro(MagnifyImages, int);
vtkBooleanMacro(MagnifyImages, int);
//BTX
enum { NEAREST, LINEAR };
//ETX
// Description:
// Sets the method used to magnify images. Nearest simply replicates
// each pixel enough times to fill the image. Linear performs linear
// interpolation between the pixels.
virtual void SetMagnifyImageMethod(int method);
vtkGetMacro(MagnifyImageMethod, int);
void SetMagnifyImageMethodToNearest() {
this->SetMagnifyImageMethod(NEAREST);
}
void SetMagnifyImageMethodToLinear() {
this->SetMagnifyImageMethod(LINEAR);
}
// Description:
// Convenience functions for magnifying images.
virtual void MagnifyImage(vtkUnsignedCharArray *fullImage,
const int fullImageSize[2],
vtkUnsignedCharArray *reducedImage,
const int reducedImageSize[2],
const int fullImageViewport[4] = NULL,
const int reducedImageViewport[4] = NULL);
static void MagnifyImageNearest(vtkUnsignedCharArray *fullImage,
const int fullImageSize[2],
vtkUnsignedCharArray *reducedImage,
const int reducedImageSize[2],
const int fullImageViewport[4] = NULL,
const int reducedImageViewport[4] = NULL);
static void MagnifyImageLinear(vtkUnsignedCharArray *fullImage,
const int fullImageSize[2],
vtkUnsignedCharArray *reducedImage,
const int reducedImageSize[2],
const int fullImageViewport[4] = NULL,
const int reducedImageViewport[4] = NULL);
// Description:
// The most appropriate way to retrieve full size image data after a
// render. Will work regardless of whether WriteBackImages or
// MagnifyImage is on or off. The data returned may be a shallow copy of
// an internal array. Therefore, the data may be invalid after the next
// render or if the ParallelRenderManager is destroyed.
virtual void GetPixelData(vtkUnsignedCharArray *data);
virtual void GetPixelData(int x1, int y1, int x2, int y2,
vtkUnsignedCharArray *data);
// Description:
// The most appropriate way to retrieve reduced size image data after a
// render. Will work regardless of whether WriteBackImages or
// MagnifyImage is on or off. The data returned may be a shallow copy of
// an internal array. Therefore, the data may be invalid after the next
// render or if the ParallelRenderManager is destroyed.
virtual void GetReducedPixelData(vtkUnsignedCharArray *data);
virtual void GetReducedPixelData(int x1, int y1, int x2, int y2,
vtkUnsignedCharArray *data);
// Description:
// Returns the full image size calculated at the last render.
vtkGetVector2Macro(FullImageSize, int);
// Description:
// Returns the reduced image size calculated at the last render.
vtkGetVector2Macro(ReducedImageSize, int);
// Description:
// Given the x and y size of the render windows, reposition them
// in a tile of n columns.
void TileWindows(int xsize, int ysize, int nColumns);
// Description:
// Get/Set if all Images must use RGBA instead of RGB. By default,
// this flag is on.
vtkSetMacro(UseRGBA, int);
vtkGetMacro(UseRGBA, int);
// Description:
// If ForceRenderWindowSize is set to true, the render manager will use
// the RenderWindowSize ivar instead of getting the size from the render window.
vtkSetMacro(ForceRenderWindowSize, int);
vtkGetMacro(ForceRenderWindowSize, int);
// Description:
// If ForceRenderWindowSize is set to true, the render manager will use
// the Size ivar instead of getting the size from the render window.
vtkSetVector2Macro(ForcedRenderWindowSize, int);
vtkGetVector2Macro(ForcedRenderWindowSize, int);
//BTX
enum Tags {
RENDER_RMI_TAG=34532,
COMPUTE_VISIBLE_PROP_BOUNDS_RMI_TAG=54636,
WIN_INFO_TAG=87834,
REN_INFO_TAG=87836,
LIGHT_INFO_TAG=87838,
REN_ID_TAG=58794,
BOUNDS_TAG=23543
};
virtual void CheckForAbortRender() {}
virtual int CheckForAbortComposite() {return 0;}
//ETX
// Disable warnings about qualifiers on return types.
#if defined(_COMPILER_VERSION)
# pragma set woff 3303
#endif
#if defined(__INTEL_COMPILER)
# pragma warning (push)
# pragma warning (disable:858)
#endif
#ifdef VTK_WORKAROUND_WINDOWS_MANGLE
# define StartServiceA StartService
# define StartServiceW StartService
#endif
// Description:
// @deprecated Replaced by vtkParallelRenderManager::StartServices()
// as of VTK 5.0.
VTK_LEGACY(virtual void StartService());
#ifdef VTK_WORKAROUND_WINDOWS_MANGLE
# undef StartServiceW
# undef StartServiceA
//BTX
VTK_LEGACY(virtual void StartServiceA());
VTK_LEGACY(virtual void StartServiceW());
//ETX
#endif
// Reset disabled warning about qualifiers on return types.
#if defined(__INTEL_COMPILER)
# pragma warning (pop)
#endif
#if defined(_COMPILER_VERSION)
# pragma reset woff 3303
#endif
//Description:
//The default is to allow the use of the back buffer for compositing.
//If set to false, this will prevent to manager from swapping buffers.
//This allows something else (for instance VisibleCellSelection) to
//control front/back buffer swapping.
vtkSetMacro(UseBackBuffer, int);
vtkGetMacro(UseBackBuffer, int);
vtkBooleanMacro(UseBackBuffer, int);
// Description:
// When set the render manager will synchronize the TileViewport and TileScale
// properties. This may not be desirable in cases where there's some other
// mechanism to set the tile dimensions eg. Tile displays.
vtkSetMacro(SynchronizeTileProperties, int);
vtkGetMacro(SynchronizeTileProperties, int);
vtkBooleanMacro(SynchronizeTileProperties, int);
// Description:
// INTERNAL METHODS (DON NOT USE).
// There are internal methods made public so that they can be called from
// callback functions.
virtual void GenericStartRenderCallback();
virtual void GenericEndRenderCallback();
//BTX
protected:
vtkParallelRenderManager();
~vtkParallelRenderManager();
// Description:
// Add/Remove event handlers for the render window.
void AddRenderWindowEventHandlers();
void RemoveRenderWindowEventHandlers();
vtkRenderWindow *RenderWindow;
vtkMultiProcessController *Controller;
vtkRendererCollection *Renderers;
virtual vtkRendererCollection *GetRenderers();
int ForceRenderWindowSize;
int ForcedRenderWindowSize[2];
// Description:
// The "root" node's process id. This is the node which is listening for
// and propagating new render events from the RenderWindow. All
// processes on the controller must have the same value. This value must
// be set before SetRenderWindow method is called. In the constructor or
// the SetController methods are good places. By default this is set to
// 0.
int RootProcessId;
int ObservingRenderWindow;
int ObservingAbort;
unsigned long StartRenderTag;
unsigned long EndRenderTag;
unsigned long ResetCameraTag;
unsigned long ResetCameraClippingRangeTag;
unsigned long AbortRenderCheckTag;
double ImageReductionFactor;
double MaxImageReductionFactor;
int AutoImageReductionFactor;
int WriteBackImages;
int MagnifyImages;
int MagnifyImageMethod;
int UseRGBA;
int SynchronizeTileProperties;
int FullImageSize[2];
int ReducedImageSize[2];
vtkUnsignedCharArray *FullImage;
vtkUnsignedCharArray *ReducedImage;
int FullImageUpToDate;
int ReducedImageUpToDate;
int RenderWindowImageUpToDate;
vtkDoubleArray *Viewports;
int Lock;
int ParallelRendering;
int RenderEventPropagation;
int UseCompositing;
int SyncRenderWindowRenderers;
vtkTimerLog *Timer;
double RenderTime;
double ImageProcessingTime;
// Description:
// Used by SetImageReductionFactorForUpdateRate to smooth transitions
// transitions between image reduction factors.
double AverageTimePerPixel;
// Description:
// Used to synchronize rendering information per frame.
// These are old methods provided for backwords compatibility. One should look
// at using CollectWindowInformation(), ProcessWindowInformation() etc. for
// bufferred sending of information over.
virtual void SendWindowInformation() {}
virtual void ReceiveWindowInformation() {}
virtual void SendRendererInformation(vtkRenderer *) {};
virtual void ReceiveRendererInformation(vtkRenderer *) {};
// Description:
// Subclass should override these methods (instead of
// SendWindowInformation/ReceiveWindowInformation or
// SendRendererInformation/ReceiveRendererInformation) to collect or process
// meta-data to synchronize rendering information per frame.
// Subclass should not use the Controller directly to send receive messages
// in any of these methods otherwise deadlocks may ensue.
virtual void CollectWindowInformation(vtkMultiProcessStream&) {}
virtual bool ProcessWindowInformation(vtkMultiProcessStream&)
{ return true; }
virtual void CollectRendererInformation(vtkRenderer*,
vtkMultiProcessStream&) {}
virtual bool ProcessRendererInformation(vtkRenderer*,
vtkMultiProcessStream&) { return true; }
// Description:
// Here is a good place to handle processing of data before and after
// render.
virtual void PreRenderProcessing() = 0;
virtual void PostRenderProcessing() = 0;
// Description:
// Called in satellites to set the render window size to the current
// FullImageSize and ReducedImageSize (or vice versa).
virtual void SetRenderWindowSize();
// Description:
// Called by ComputeVisiblePropBoundsRMI to get the bounds of a local
// renderer. Override this method if the true bounds are different than
// those reported by the renderer.
virtual void LocalComputeVisiblePropBounds(vtkRenderer *ren, double bounds[6]);
// Description:
// When called, fills FullImage.
virtual void MagnifyReducedImage();
// Description:
// Write the full image back to the RenderWindow.
virtual void WriteFullImage();
// Description:
// Reads in the reduced image from the RenderWindow.
virtual void ReadReducedImage();
// Description:
// Returns 1 if the RenderWindow's last image is in the front buffer, 0
// if it is in the back.
virtual int LastRenderInFrontBuffer();
// Description:
// Select buffer to read from / render into.
virtual int ChooseBuffer();
// Description:
// Sets the current render window's pixel data.
virtual void SetRenderWindowPixelData(vtkUnsignedCharArray *pixels,
const int pixelDimensions[2]);
// Description:
// Returns true if the image for the given renderer should be rendered at a
// reduced size to be magnified later. This method always returns true, but
// subclasses may render some renderers at a reduced size, magnify them, and
// then render the other renderers at full resolution.
virtual int ImageReduceRenderer(vtkRenderer *) { return 1; }
struct RenderWindowInfo
{
int FullSize[2];
int ReducedSize[2];
int NumberOfRenderers;
int UseCompositing;
int TileScale[2];
double ImageReductionFactor;
double DesiredUpdateRate;
double TileViewport[4];
// Save/restore the struct to/from a stream.
void Save(vtkMultiProcessStream& stream);
bool Restore(vtkMultiProcessStream& stream);
};
struct RendererInfo
{
int Draw;
int NumberOfLights;
double Viewport[4];
double CameraPosition[3];
double CameraFocalPoint[3];
double CameraViewUp[3];
double WindowCenter[2];
double CameraClippingRange[2];
double CameraViewAngle;
double Background[3];
double Background2[3];
bool GradientBackground;
double ParallelScale;
// Save/restore the struct to/from a stream.
void Save(vtkMultiProcessStream& stream);
bool Restore(vtkMultiProcessStream& stream);
};
struct LightInfo
{
double Position[3];
double FocalPoint[3];
double Type;
// Save/restore the struct to/from a stream.
void Save(vtkMultiProcessStream& stream);
bool Restore(vtkMultiProcessStream& stream);
};
int AddedRMIs;
unsigned long RenderRMIId;
unsigned long BoundsRMIId;
int UseBackBuffer;
static bool DefaultRenderEventPropagation;
private:
vtkParallelRenderManager(const vtkParallelRenderManager &); //Not implemented
void operator=(const vtkParallelRenderManager &); //Not implemented
//ETX
};
#endif //__vtkParalleRenderManager_h
|