| 1 |
NAME SbViewportRegion SbVPReg "" { class for representing a viewport } |
| 2 |
INCLUDE SbViewportRegion.h |
| 3 |
DESC { |
| 4 |
This class represents the active viewport region in a display |
| 5 |
window. It contains the screen-space size of the window as well as |
| 6 |
the origin and size of the viewport within the window. By default, |
| 7 |
the viewport is the same as the full window. Methods allow the |
| 8 |
viewport to be set either in terms of screen-space pixels or as |
| 9 |
normalized coordinates, where (0,0) is the lower-left corner of |
| 10 |
the window and (1,1) is the upper-right corner. |
| 11 |
} |
| 12 |
METHOD "" SbViewportRegion() {} |
| 13 |
METHOD CreateWH SbViewportRegion(short width, short height) {} |
| 14 |
METHOD CreateVec SbViewportRegion(SbVec2s winSize) {} |
| 15 |
METHOD CreateReg SbViewportRegion(const SbViewportRegion &vpReg) { |
| 16 |
Constructors of various kinds. |
| 17 |
} |
| 18 |
METHOD SetWin void setWindowSize(short width, short height) { |
| 19 |
Changes window size to given width and height in pixels. |
| 20 |
} |
| 21 |
METHOD SetWinVec void setWindowSize(SbVec2s winSize) { |
| 22 |
Changes window size to given width and height in pixels, given |
| 23 |
as \cSbVec2s\.. |
| 24 |
} |
| 25 |
METHOD SetVP void setViewport(float left, float bottom, |
| 26 |
float width, float height) { |
| 27 |
Sets viewport to given region, specified as normalized window |
| 28 |
coordinates: (0,0) is the lower-left corner, (1,1) is the upper-right. |
| 29 |
} |
| 30 |
METHOD SetVPVec void setViewport(SbVec2f origin, SbVec2f size) { |
| 31 |
Sets viewport to region with given origin (lower-left corner) |
| 32 |
and size, given as normalized coordinate vectors. |
| 33 |
} |
| 34 |
METHOD SetVPPix void setViewportPixels(short left, short bottom, |
| 35 |
short width, short height) { |
| 36 |
Sets viewport to given region, specified as pixel coordinates |
| 37 |
in window: (0,0) is the lower-left corner. |
| 38 |
} |
| 39 |
METHOD SetVPPixVec void setViewportPixels(SbVec2s origin, SbVec2s size) { |
| 40 |
Sets viewport to region with given origin (lower-left corner) |
| 41 |
and size, given as pixel coordinates. |
| 42 |
} |
| 43 |
METHOD getWinSize const SbVec2s & getWindowSize() const { |
| 44 |
Returns window size in pixels. |
| 45 |
} |
| 46 |
METHOD getVPOrigin const SbVec2f & getViewportOrigin() const { |
| 47 |
Returns viewport origin in normalized coordinates. |
| 48 |
} |
| 49 |
METHOD getVPOriginPix const SbVec2s & getViewportOriginPixels() const { |
| 50 |
Returns viewport origin in pixels. |
| 51 |
} |
| 52 |
METHOD getVPSize const SbVec2f & getViewportSize() const { |
| 53 |
Returns viewport size in normalized coordinates. |
| 54 |
} |
| 55 |
METHOD getVPSizePix const SbVec2s & getViewportSizePixels() const { |
| 56 |
Returns viewport size in pixels. |
| 57 |
} |
| 58 |
METHOD getVPAspect float getViewportAspectRatio() const { |
| 59 |
Returns aspect ratio (width/height) of viewport. |
| 60 |
} |
| 61 |
METHOD "" void scaleWidth(float ratio) {} |
| 62 |
METHOD "" void scaleHeight(float ratio) { |
| 63 |
Scales viewport within window to be the given ratio of its |
| 64 |
current width or height, leaving the resulting viewport |
| 65 |
centered about the same point as the current one. |
| 66 |
} |
| 67 |
METHOD setPixPerInch void setPixelsPerInch(float ppi){} |
| 68 |
METHOD getPixPerInch float getPixelsPerInch() const { |
| 69 |
Sets/returns the pixel-per-inch ratio for the display device |
| 70 |
the viewport is part of. The default value is 72 (1 pixel per |
| 71 |
printer's point). |
| 72 |
} |
| 73 |
METHOD getPixPerPt float getPixelsPerPoint() const { |
| 74 |
Convenience function that returns number of pixels per printer's point. |
| 75 |
} |
| 76 |
METHOD "" friend int operator ==(const SbViewportRegion ®1, |
| 77 |
const SbViewportRegion ®2) { |
| 78 |
Equality comparison operator. |
| 79 |
} |
| 80 |
ALSO { SbVec2f, SbVec2s } |