SBVIEWPORTREGION(3iv)
π NAME π
SbViewportRegion β the class that's literally the blueprint for representing a viewport π¦
πΈ INHERITS FROM πΈ
SbViewportRegion
ngl bestie, yes, it says it inherits from itself. That's what the page says, and I'm not about to gaslight the documentation. π
β¨ SYNOPSIS β¨
#include <Inventor/SbViewportRegion.h>
Methods from class SbViewportRegion:
SbViewportRegion()
SbViewportRegion(short width, short height)
SbViewportRegion(SbVec2s winSize)
SbViewportRegion(const SbViewportRegion &vpReg)
void setWindowSize(short width, short height)
void setWindowSize(SbVec2s winSize)
void setViewport(float left, float bottom, float width,
float height)
void setViewport(SbVec2f origin, SbVec2f size)
void setViewportPixels(short left, short bottom, short
width, short height)
void setViewportPixels(SbVec2s origin, SbVec2s size)
const SbVec2s & getWindowSize() const
const SbVec2f & getViewportOrigin() const
const SbVec2s & getViewportOriginPixels() const
const SbVec2f & getViewportSize() const
const SbVec2s & getViewportSizePixels() const
float getViewportAspectRatio() const
void scaleWidth(float ratio)
void scaleHeight(float ratio)
void setPixelsPerInch(float ppi)
float getPixelsPerInch() const
float getPixelsPerPoint() const
friend int operator ==(const SbViewportRegion ®1, const
SbViewportRegion ®2)
π DESCRIPTION π
okay so picture this: you've got a display window, right? And this class SbViewportRegion is the one holding the receipts on the active viewport region inside it. π
It's carrying two things at once, and the way that it's carrying two things at once is honestly iconic:
- the screen-space size of the window π
- the origin and size of the viewport within that window β¨
By default? The viewport is the same as the full window. Simple, clean, no notes.
And the methods let you set that viewport up in one of two flavours:
- in terms of screen-space pixels π₯
- as normalized coordinates, where
(0,0)is the lower-left corner of the window and(1,1)is the upper-right corner π
π METHODS π
SbViewportRegion()SbViewportRegion(short width, short height)SbViewportRegion(SbVec2s winSize)SbViewportRegion(const SbViewportRegion &vpReg)
These are the constructors, bestie β and yes there are several kinds. Pick your fighter. π«Ά
void setWindowSize(short width, short height)β changes the window size to the given width and height, in pixels. βvoid setWindowSize(SbVec2s winSize)β same energy, changes the window size to the given width and height in pixels, except it comes at you as anSbVec2s. πvoid setViewport(float left, float bottom, float width, float height)β sets the viewport to the given region, specified as normalized window coordinates:(0,0)is the lower-left corner,(1,1)is the upper-right. πvoid setViewport(SbVec2f origin, SbVec2f size)β sets the viewport to the region with the given origin (that's the lower-left corner, iykyk) and size, handed to you as normalized coordinate vectors. πvoid setViewportPixels(short left, short bottom, short width, short height)β sets the viewport to the given region, specified as pixel coordinates in the window:(0,0)is the lower-left corner. πvoid setViewportPixels(SbVec2s origin, SbVec2s size)β sets the viewport to the region with the given origin (lower-left corner, again) and size, given as pixel coordinates. π§const SbVec2s & getWindowSize() constβ returns the window size, in pixels. πconst SbVec2f & getViewportOrigin() constβ returns the viewport origin in normalized coordinates. β¨const SbVec2s & getViewportOriginPixels() constβ returns the viewport origin in pixels. πconst SbVec2f & getViewportSize() constβ returns the viewport size in normalized coordinates. πΈconst SbVec2s & getViewportSizePixels() constβ returns the viewport size in pixels. π₯float getViewportAspectRatio() constβ returns the aspect ratio of the viewport, which is width/height. Math girlies rise up. πvoid scaleWidth(float ratio)void scaleHeight(float ratio)
These two scale the viewport within the window to be the given ratio of its current width or height β and here's the cute part: the resulting viewport stays centered about the same point as the current one. π
void setPixelsPerInch(float ppi)float getPixelsPerInch() const
Sets / returns the pixel-per-inch ratio for the display device the viewport is part of. And the default value? 72 β that's 1 pixel per printer's point. π
float getPixelsPerPoint() constβ a lil convenience function that returns the number of pixels per printer's point. π¦friend int operator ==(const SbViewportRegion ®1, const SbViewportRegion ®2)β the equality comparison operator. Are these two regions the same? Now you know. β
π SEE ALSO π
SbVec2f, SbVec2s
that's the whole page, bestie π go forth and set your viewports with main character energy πβ¨
SbViewportRegion(3IV) β fr fr, that's the manual name and the section, and this lil sign-off is me waving at you from the bottom of the page π«Άπ
π¦ where this page comes from
- debian bookworm: inventor-doc 2.1.5-10+dfsg-2 Β· LGPL-2.0-or-later
- debian trixie: inventor-doc 2.1.6+ds-2 Β· LGPL-2.0-or-later
- ubuntu jammy: inventor-doc 2.1.5-10-24
- ubuntu noble: inventor-doc 2.1.5-10+dfsg-2.1build2 Β· LGPL-2.0-or-later
- ubuntu questing: inventor-doc 2.1.6+ds-2
- ubuntu resolute: inventor-doc 2.1.6.1+ds-1 Β· LGPL-2.0-or-later
- ubuntu stonking: inventor-doc 2.1.6.1+ds-1 Β· LGPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms