SbViewportRegion(3)
β¨ NAME β¨
okay bestie, so SbViewportRegion(3) from the Library Functions Manual just dropped, and it's literally all about a viewport inside a full window π
SbViewportRegionβ The SbViewportRegion class is a viewport within a full window. πͺβ¨
π¦ SYNOPSIS π¦
#include <Inventor/SbViewportRegion.h>
π Public Member Functions π
SbViewportRegion (void)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 (void) constconst SbVec2f & getViewportOrigin (void) constconst SbVec2s & getViewportOriginPixels (void) constconst SbVec2f & getViewportSize (void) constconst SbVec2s & getViewportSizePixels (void) constfloat getViewportAspectRatio (void) constvoid scaleWidth (float ratio)void scaleHeight (float ratio)void setPixelsPerInch (float ppi)float getPixelsPerInch (void) constfloat getPixelsPerPoint (void) constvoid print (FILE *file) const
π Friends π
int operator== (const SbViewportRegion ®1, const SbViewportRegion ®2)int operator!= (const SbViewportRegion ®1, const SbViewportRegion ®2)
πΈ Detailed Description πΈ
The SbViewportRegion class is a viewport within a full window. π
The SbViewportRegion class contains information to represent a subview within a window. It stores information about the origin and size of the subview, aswell as the size of the underlying "full" window. πͺ
Available methods include inquiries and manipulation in both normalized coordinates and pixel coordinates. β¨
Below is a small example showing how the viewport of a viewer class can be modified, within a "proper" Coin and window system context. Hit 'D' or 'U' to move the viewport region 40 pixels down or up, respectively. Click 'Esc' and zoom with left + middle mouse buttons, to see how the region is defined, where no 3D geometry will be visible outside it. Click 'Esc' again to use 'U' and 'D'. π
// Copyright (C) 2000-2007 by Systems in Motion. All rights reserved.
#include <Inventor/Qt/SoQt.h>
#include <Inventor/Qt/viewers/SoQtExaminerViewer.h>
#include <Inventor/nodes/SoEventCallback.h>
#include <Inventor/nodes/SoSeparator.h>
#include <Inventor/nodes/SoCone.h>
#include <Inventor/events/SoKeyboardEvent.h>
// ************************************************************
static void
keypresscbfunc(void * userdata, SoEventCallback * keyboardcb)
{
SoQtExaminerViewer * viewer = (SoQtExaminerViewer *)userdata;
const SoEvent * event = keyboardcb->getEvent();
int shift = 0;
if (SO_KEY_PRESS_EVENT(event, U)) {
shift = 40;
keyboardcb->setHandled();
}
else if (SO_KEY_PRESS_EVENT(event, D)) {
shift = -40;
keyboardcb->setHandled();
}
if (keyboardcb->isHandled()) {
SbViewportRegion vpr = viewer->getViewportRegion();
SbVec2s size = vpr.getViewportSizePixels();
SbVec2s origin = vpr.getViewportOriginPixels();
origin[1] -= shift;
vpr.setViewportPixels(origin, size);
viewer->setViewportRegion(vpr);
}
}
// ************************************************************
int
main(int argc, char ** argv)
{
QWidget * window = SoQt::init(argv[0]);
SoSeparator * root = new SoSeparator;
root->ref();
root->addChild(new SoCone);
SoQtExaminerViewer * viewer = new SoQtExaminerViewer(window);
SoEventCallback * eventcb = new SoEventCallback;
eventcb->addEventCallback(SoKeyboardEvent::getClassTypeId(),
keypresscbfunc, viewer);
root->insertChild(eventcb, 0);
viewer->setViewing(FALSE);
viewer->setDecoration(FALSE);
viewer->setSceneGraph(root);
viewer->show();
SoQt::show(window);
SoQt::mainLoop();
delete viewer;
root->unref();
return 0;
}
See also
SbViewVolume
π Constructor & Destructor Documentation π
π§ SbViewportRegion::SbViewportRegion (void )
The default SbViewportRegion constructor initializes the viewport to fully cover a [100, 100] size window with 72 pixels per inch resolution. π
Referenced by getViewportOriginPixels(), getViewportSizePixels(), operator!=, operator==, and SbViewportRegion().
π§ SbViewportRegion::SbViewportRegion (short width, short height)
Construct and initialize an SbViewportRegion instance with the given pixel value window dimensions. The viewport within this window will be set to cover the window completely. π¦
References SoDebugError::postWarning().
π§ SbViewportRegion::SbViewportRegion (SbVec2s winsizearg)
Construct and initialize an SbViewportRegion instance with the given pixel value window dimensions. The viewport within this window will be set to cover the window completely. π
References SoDebugError::postWarning().
π§ SbViewportRegion::SbViewportRegion (const SbViewportRegion & vpReg)
Copy constructor. π
References SbViewportRegion().
β¨ Member Function Documentation β¨
okay so these are the methods, and every single one is doing its little thing. no skips, no cuts, we're covering all of them. π
void SbViewportRegion::setWindowSize (short width, short height)
Sets the window size in pixels. The viewport rectangle dimensions will stay intact. fr fr, it does not resize the viewport itself.
- See also β
getWindowSize() - References β
SoDebugError::postWarning() - Referenced by β
setWindowSize(), andSoSceneManager::setWindowSize()
void SbViewportRegion::setWindowSize (SbVec2s winsizearg)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
- References β
SoDebugError::postWarning(), andsetWindowSize()
void SbViewportRegion::setViewport (float left, float bottom, float width, float height)
Set up the origin and size of the viewport region in normalized coordinates. so like, the chill 0-to-1 vibe, not the pixel chaos.
- See also β
getViewportOrigin(),getViewportSize(),setViewportPixels() - References β
SoDebugError::postWarning() - Referenced by β
setViewport()
void SbViewportRegion::setViewport (SbVec2f origin, SbVec2f size)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
- References β
SoDebugError::postWarning(), andsetViewport()
void SbViewportRegion::setViewportPixels (short left, short bottom, short width, short height)
Set up the origin and size of the viewport region in pixel coordinates. yes bestie, actual pixels, not normalized float nonsense.
- See also β
getViewportOriginPixels(),getViewportSizePixels(),setViewport() - References β
SoDebugError::postWarning() - Referenced by β
SoSceneManager::setOrigin(),SoSceneManager::setSize(), andsetViewportPixels()
void SbViewportRegion::setViewportPixels (SbVec2s origin, SbVec2s size)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
- References β
SoDebugError::postWarning(), andsetViewportPixels()
const SbVec2s & SbViewportRegion::getWindowSize (void ) const
Returns window dimensions (which are in absolute (i.e. pixel) coordinates).
- See also β
setWindowSize() - Referenced by β
print(),SoSceneManager::setViewportRegion(), andSoCamera::viewAll()
const SbVec2f & SbViewportRegion::getViewportOrigin (void ) const
Return normalized viewport origin coordinates.
- See also β
setViewport(),getViewportOriginPixels() - Referenced by β
print()
const SbVec2s & SbViewportRegion::getViewportOriginPixels (void ) const
Return viewport origin coordinates in pixel values.
- See also β
setViewportPixels(),getViewportOrigin() - References β
SbViewportRegion(), andSbVec2s::setValue() - Referenced by β
SoRayPickAction::computeWorldSpaceRay(),SoEvent::getNormalizedPosition(),SoEvent::getPosition(),SoExtSelection::GLRenderBelowPath(),operator==,print(),SoSceneManager::setSize(), andSoSceneManager::setViewportRegion()
const SbVec2f & SbViewportRegion::getViewportSize (void ) const
Returns the normalized viewport size.
- See also β
setViewport(),getViewportSizePixels() - Referenced by β
print(), andSoCamera::viewAll()
const SbVec2s & SbViewportRegion::getViewportSizePixels (void ) const
Returns viewport size in pixel coordinates.
- See also β
setViewportPixels(),getViewportSize() - References β
SbViewportRegion() - Referenced by β
SoVectorizeAction::calibrate(),SoRayPickAction::computeWorldSpaceRay(),SoEvent::getNormalizedPosition(),getViewportAspectRatio(),SoImage::GLRender(),SoMarkerSet::GLRender(),SoText2::GLRender(),SoExtSelection::GLRenderBelowPath(),SoCamera::jitter(),operator==,print(),SoTabPlaneDragger::reallyAdjustScaleTabSize(),SoSceneManager::setOrigin(), andSoSceneManager::setViewportRegion()
float SbViewportRegion::getViewportAspectRatio (void ) const
Returns the aspect ratio of the viewport region. The aspect ratio is calculated as pixelwidth divided on pixelheight.
- References β
getViewportSizePixels() - Referenced by β
SoCamera::getViewportBounds(), andprint()
void SbViewportRegion::scaleWidth (float ratio)
Scale the width of the viewport region.
The scale factor should not make the viewport larger than the window. If this happens, the viewport will be clamped.
The scaling will be done around the viewport region center point, but if this causes the viewport origin to be moved below (0,0), the origin coordinates will be clamped.
- See also β
scaleHeight() - References β
SoDebugError::postWarning() - Referenced by β
SoCamera::getViewportBounds()
void SbViewportRegion::scaleHeight (float ratio)
Scale the height of the viewport region.
The scale factor should not make the viewport larger than the window. If this happens, the viewport will be clamped.
The scaling will be done around the viewport region center point, but if this causes the viewport origin to be moved below (0,0), the origin coordinates will be clamped.
- See also β
scaleWidth() - References β
SoDebugError::postWarning() - Referenced by β
SoCamera::getViewportBounds()
void SbViewportRegion::setPixelsPerInch (float ppi)
Set pixels per inch. Default value is 72. yeah, 72, the classic.
- See also β
getPixelsPerInch() - References β
SoDebugError::postWarning()
float SbViewportRegion::getPixelsPerInch (void ) const
Get pixels per inch.
- See also β
setPixelsPerInch() - Referenced by β
print()
float SbViewportRegion::getPixelsPerPoint (void ) const
Get pixels per point. A point is defined as something you can put 72 of per inch... iconic definition, honestly.
- See also β
setPixelsPerInch(),getPixelsPerInch() - Referenced by β
print()
void SbViewportRegion::print (FILE * fp) const
Dump the state of this object to the file stream. Only works in debug version of library, method does nothing in an optimized compile. so if you're optimized, this is giving silent treatment.
- References β
getPixelsPerInch(),getPixelsPerPoint(),getViewportAspectRatio(),getViewportOrigin(),getViewportOriginPixels(),getViewportSize(),getViewportSizePixels(),getWindowSize(),SbVec2f::print(), andSbVec2s::print()
β¨ Friends And Related Symbol Documentation β¨
int operator== (const SbViewportRegion & reg1, const SbViewportRegion & reg2) [friend]
Compares two SbViewportRegion instances for equality.
- References β
getViewportOriginPixels(),getViewportSizePixels(),operator==, andSbViewportRegion() - Referenced by β
operator==
int operator!= (const SbViewportRegion & reg1, const SbViewportRegion & reg2) [friend]
Compares two SbViewportRegion instances for inequality.
- Since β Coin 2.4
- References β
operator!=, andSbViewportRegion() - Referenced by β
operator!=
β¨ Author β¨
Generated automatically by Doxygen for Coin from the source code.
and that's the whole entire page, bestie! this was the SbViewportRegion(3) manual for Coin Version 2.5.0, auto-generated by Doxygen from the source code, and the footer didn't give us a date so we're just gonna celebrate the version. periodt. π β¨π¦
π¦ where this page comes from
- fedora 43: Coin2-devel 2.5.0-52.fc43 Β· GPL-2.0-only
- fedora 43: Coin2-devel 2.5.0-52.fc43 Β· GPL-2.0-only
- fedora 44: Coin2-devel 2.5.0-54.fc44 Β· GPL-2.0-only
- fedora 44: Coin2-devel 2.5.0-54.fc44 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms