SoCamera(3)
๐ SoCamera(3) ๐
a page straight outta the Library Functions Manual
okay so bestie. sit DOWN. we're doing SoCamera(3) today and honestly?? this page is long, it's giving main character energy, and there's a LOT of inherited stuff, but you're gonna eat it up. i got you. ๐
โจ NAME โจ
SoCamera โ she is the abstract base class for camera definition nodes. that's it, that's the whole job description. she's the blueprint, not the building. queen shit fr fr ๐
๐ SYNOPSIS ๐
#include <Inventor/nodes/SoCamera.h>
she inherits SoNode โ so everything that node does, she's got it too.
and she gets inherited by SoFrustumCamera, SoOrthographicCamera, and SoPerspectiveCamera. three daughters carrying her legacy ๐ซถ
๐ฆ Public Types ๐ฆ
two enums, both iconic, no notes:
enum ViewportMapping {
CROP_VIEWPORT_FILL_FRAME,
CROP_VIEWPORT_LINE_FRAME,
CROP_VIEWPORT_NO_FRAME,
ADJUST_CAMERA,
LEAVE_ALONE
}
enum StereoMode {
MONOSCOPIC,
LEFT_VIEW,
RIGHT_VIEW
}
๐ Public Types inherited from SoNode ๐
the whole bitmask lineup, verbatim, because we do NOT abbreviate here:
enum NodeType {
INVENTOR = 0x0000,
VRML1 = 0x0001,
VRML2 = 0x0002,
INVENTOR_1 = 0x0004,
INVENTOR_2_0 = 0x0008,
INVENTOR_2_1 = 0x0010,
INVENTOR_2_5 = 0x0020,
INVENTOR_2_6 = 0x0040,
COIN_1_0 = 0x0080,
COIN_2_0 = 0x0100,
EXTENSION = 0x0200,
COIN_2_2 = 0x0400,
COIN_2_3 = 0x0800,
COIN_2_4 = 0x1000,
INVENTOR_5_0 = 0x2000,
COIN_2_5 = 0x4000
}
๐ธ Public Member Functions ๐ธ
these are all hers. every single one. two of them are =0 which means she's leaving those to her daughters to actually implement โ iconic delegation honestly:
virtual SoType getTypeId (void) constโ the "who even am i" check โจ every node's got onevoid pointAt (const SbVec3f &targetpoint)โ the one-arg versionvoid pointAt (const SbVec3f &targetpoint, const SbVec3f &upvector)โ the two-arg version. yes, both overloads get their own bullet. we respect the source in this house ๐ซถvirtual void scaleHeight (float scalefactor)=0โ see that=0? pure virtual. she's not doing this one herself ๐virtual SbViewVolume getViewVolume (float useaspectratio=0.0f) const =0โ also=0, also a daughter job. note the default0.0f, we keep defaults around herevoid viewAll (SoNode *const sceneroot, const SbViewportRegion &vpregion, const float slack=1.0f)โ take oneSoNode *constpleasevoid viewAll (SoPath *const path, const SbViewportRegion &vpregion, const float slack=1.0f)โ same name,SoPathflavor, sameslack=1.0fSbViewportRegion getViewportBounds (const SbViewportRegion ®ion) constvoid setStereoMode (StereoMode mode)StereoMode getStereoMode (void) constvoid setStereoAdjustment (float adjustment)float getStereoAdjustment (void) constvoid setBalanceAdjustment (float adjustment)float getBalanceAdjustment (void) constvirtual void doAction (SoAction *action)virtual void callback (SoCallbackAction *action)virtual void GLRender (SoGLRenderAction *action)virtual void audioRender (SoAudioRenderAction *action)virtual void getBoundingBox (SoGetBoundingBoxAction *action)virtual void handleEvent (SoHandleEventAction *action)virtual void rayPick (SoRayPickAction *action)virtual void getPrimitiveCount (SoGetPrimitiveCountAction *action)
๐ Public Member Functions inherited from SoNode ๐
void setOverride (const SbBool state)
SbBool isOverride (void) const
void setNodeType (const NodeType type)
NodeType getNodeType (void) const
virtual SoNode * copy (SbBool copyconnections=0) const
virtual SbBool affectsState (void) const
virtual void GLRenderBelowPath (SoGLRenderAction *action)
virtual void GLRenderInPath (SoGLRenderAction *action)
virtual void GLRenderOffPath (SoGLRenderAction *action)
virtual void getMatrix (SoGetMatrixAction *action)
virtual void pick (SoPickAction *action)
virtual void search (SoSearchAction *action)
virtual void write (SoWriteAction *action)
virtual void grabEventsSetup (void)
virtual void grabEventsCleanup (void)
virtual void startNotify (void)
virtual void notify (SoNotList *l)
uint32_t getNodeId (void) const
virtual SoChildList * getChildren (void) const
virtual void writeInstance (SoOutput *out)
virtual SoNode * addToCopyDict (void) const
virtual void copyContents (const SoFieldContainer *from, SbBool copyconnections)
virtual SoFieldContainer * copyThroughConnection (void) const
๐ง Public Member Functions inherited from SoFieldContainer ๐ง
void setToDefaults (void)
SbBool hasDefaultValues (void) const
SbBool fieldsAreEqual (const SoFieldContainer *container) const
void copyFieldValues (const SoFieldContainer *container, SbBool copyconnections=0)
SbBool set (const char *const fielddata)
void get (SbString &fielddata)
virtual int getFields (SoFieldList &l) const
virtual int getAllFields (SoFieldList &l) const
virtual SoField * getField (const SbName &name) const
virtual SoField * getEventIn (const SbName &name) const
virtual SoField * getEventOut (const SbName &name) const
SbBool getFieldName (const SoField *const field, SbName &name) const
SbBool enableNotify (const SbBool flag)
SbBool isNotifyEnabled (void) const
SbBool set (const char *fielddata, SoInput *in)
void get (SbString &fielddata, SoOutput *out)
virtual SbBool validateNewFieldValue (SoField *field, void *newval)
virtual void addWriteReference (SoOutput *out, SbBool isfromfield=0)
SbBool getIsBuiltIn (void) const
void setUserData (void *userdata) const
void * getUserData (void) const
๐ Public Member Functions inherited from SoBase ๐
void ref (void) const
void unref (void) const
void unrefNoDelete (void) const
int32_t getRefCount (void) const
void touch (void)
SbBool isOfType (SoType type) const
virtual SbName getName (void) const
virtual void setName (const SbName &newname)
void addAuditor (void *const auditor, const SoNotRec::Type type)
void removeAuditor (void *const auditor, const SoNotRec::Type type)
const SoAuditorList & getAuditors (void) const
SbBool shouldWrite (void)
void assertAlive (void) const
๐ Static Public Member Functions ๐
hers, and only two of them:
static SoType getClassTypeId (void)static void initClass (void)
โญ Static Public Member Functions inherited from SoNode โญ
static uint32_t getCompatibilityTypes (const SoType &nodetype)
static SoType getClassTypeId (void)
static SoNode * getByName (const SbName &name)
static int getByName (const SbName &name, SoNodeList &l)
static void initClass (void)
static void initClasses (void)
static uint32_t getNextNodeId (void)
static int getActionMethodIndex (const SoType type)
static void getBoundingBoxS (SoAction *action, SoNode *node)
static void GLRenderS (SoAction *action, SoNode *node)
static void callbackS (SoAction *action, SoNode *node)
static void getMatrixS (SoAction *action, SoNode *node)
static void handleEventS (SoAction *action, SoNode *node)
static void pickS (SoAction *action, SoNode *node)
static void rayPickS (SoAction *action, SoNode *node)
static void searchS (SoAction *action, SoNode *node)
static void writeS (SoAction *action, SoNode *node)
static void audioRenderS (SoAction *action, SoNode *node)
static void getPrimitiveCountS (SoAction *action, SoNode *node)
๐ Static Public Member Functions inherited from SoFieldContainer ๐
static void initClass (void)
static SoType getClassTypeId (void)
static void initCopyDict (void)
static void addCopy (const SoFieldContainer *orig, const SoFieldContainer *copy)
static SoFieldContainer * checkCopy (const SoFieldContainer *orig)
static SoFieldContainer * findCopy (const SoFieldContainer *orig, const SbBool copyconnections)
static void copyDone (void)
๐ธ Static Public Member Functions inherited from SoBase ๐ธ
static void initClass (void)
static SoType getClassTypeId (void)
static void addName (SoBase *const base, const char *const name)
static void removeName (SoBase *const base, const char *const name)
static void incrementCurrentWriteCounter (void)
static void decrementCurrentWriteCounter (void)
static SoBase * getNamedBase (const SbName &name, SoType type)
static int getNamedBases (const SbName &name, SoBaseList &baselist, SoType type)
static SbBool read (SoInput *in, SoBase *&base, SoType expectedtype)
static void setInstancePrefix (const SbString &c)
static void setTraceRefs (SbBool trace)
static SbBool getTraceRefs (void)
static SbBool connectRoute (SoInput *in, const SbName &fromnodename, const SbName &fromfieldname, const SbName &tonodename, const SbName &tofieldname)
static SbBool readRoute (SoInput *in)
๐ Public Attributes ๐
the fields. the actual data. this is the part people actually come here for, lowkey:
SoSFEnum viewportMappingSoSFVec3f positionSoSFRotation orientationSoSFFloat aspectRatioSoSFFloat nearDistanceSoSFFloat farDistanceSoSFFloat focalDistance
๐ Protected Member Functions ๐
the VIP section โ only her and her subclasses get in:
virtual const SoFieldData * getFieldData (void) constSoCamera (void)โ the constructorvirtual ~SoCamera ()โ the destructorvirtual void viewBoundingBox (const SbBox3f &box, float aspect, float slack)=0โ another=0, another daughter job ๐virtual void jitter (int numpasses, int curpass, const SbViewportRegion &vpreg, SbVec3f &jitteramount) const
๐ Protected Member Functions inherited from SoNode ๐
SoNode (void)
virtual ~SoNode ()
virtual SbBool readInstance (SoInput *in, unsigned short flags)
๐ Protected Member Functions inherited from SoFieldContainer ๐
SoFieldContainer (void)
~SoFieldContainer ()
๐ Protected Member Functions inherited from SoBase ๐
SoBase (void)
virtual ~SoBase ()
virtual void destroy (void)
SbBool hasMultipleWriteRefs (void) const
SbBool writeHeader (SoOutput *out, SbBool isgroup, SbBool isengine) const
void writeFooter (SoOutput *out) const
virtual const char * getFileFormatName (void) const
๐ซถ Static Protected Member Functions ๐ซถ
static const SoFieldData ** getFieldDataPtr (void)
โจ Static Protected Member Functions inherited from SoNode โจ
static const SoFieldData ** getFieldDataPtr (void)
static void setNextActionMethodIndex (int index)
static int getNextActionMethodIndex (void)
static void incNextActionMethodIndex (void)
static void setCompatibilityTypes (const SoType &nodetype, const uint32_t bitmask)
โจ Static Protected Member Functions inherited from SoBase โจ
static uint32_t getCurrentWriteCounter (void)
static void staticDataLock (void)
static void staticDataUnlock (void)
๐ฆ Friends ๐ฆ
class SoCameraPโ her one true friend ๐ซ
๐ซ Additional Inherited Members ๐ซ
Protected Types inherited from SoBase
enum BaseFlags { IS_ENGINE = 0x01, IS_GROUP = 0x02 }
Protected Attributes inherited from SoNode
uint32_t uniqueId
Protected Attributes inherited from SoFieldContainer
SbBool isBuiltIn
Static Protected Attributes inherited from SoNode
static uint32_t nextUniqueId = 0
static int nextActionMethodIndex = 0
okay bestie that's part 1 and honestly that was already a LOT of receipts ๐ don't go anywhere, more is coming โ this page is not done with us yet ๐โจ
๐ธ Detailed Description ๐ธ
Okay bestie, listen up, because this one is literally the blueprint for every camera in Coin. ๐
The SoCamera class is the abstract base class for camera definition nodes. Abstract, meaning you don't just go making one of these directly โ it's the vibe, not the fit. ๐ซถ
So like, to actually view a scene? You need a camera in the scene graph, periodt. A camera node will set up the projection and viewing matrices for rendering of the geometry in the scene. That's its whole job. ๐
This node just defines the abstract interface by collecting common fields that all camera type nodes need. So it's giving "shared foundation energy." Use the non-abstract camera node subclasses within a scene graph instead, bestie. The ones that are default part of the Coin library are SoPerspectiveCamera and SoOrthographicCamera, which uses the two different projections given by their name. No cap, the names are literally the whole plot. โจ
Note that the viewer components of the GUI glue libraries of Coin (SoXt,SoQt,SoWin, etc) will automatically insert a camera into a scene graph if none has been defined. So if you forget? It's got you. ๐
It is possible to have more than one camera in a scene graph โ yes, multiple cameras, main character AND supporting cast. ๐ One common trick is for instance to use a second camera to display static geometry or overlay geometry (e.g. for head-up displays ("HUD")), as shown by this example code:
#include <Inventor/Qt/SoQt.h>
#include <Inventor/Qt/viewers/SoQtExaminerViewer.h>
#include <Inventor/nodes/SoNodes.h>
int
main(int argc, char ** argv)
{
QWidget * mainwin = SoQt::init(argv[0]);
SoSeparator * root = new SoSeparator;
root->ref();
// Adds a camera and a red cone. The first camera found in the
// scene graph by the SoQtExaminerViewer will be picked up and
// initialized automatically.
root->addChild(new SoPerspectiveCamera);
SoMaterial * material = new SoMaterial;
material->diffuseColor.setValue(1.0, 0.0, 0.0);
root->addChild(material);
root->addChild(new SoCone);
// Set up a second camera for the remaining geometry. This camera
// will not be picked up and influenced by the viewer, so the
// geometry will be kept static.
SoPerspectiveCamera * pcam = new SoPerspectiveCamera;
pcam->position = SbVec3f(0, 0, 5);
pcam->nearDistance = 0.1;
pcam->farDistance = 10;
root->addChild(pcam);
// Adds a green cone to demonstrate static geometry.
SoMaterial * greenmaterial = new SoMaterial;
greenmaterial->diffuseColor.setValue(0, 1.0, 0.0);
root->addChild(greenmaterial);
root->addChild(new SoCone);
SoQtExaminerViewer * viewer = new SoQtExaminerViewer(mainwin);
viewer->setSceneGraph(root);
viewer->show();
SoQt::show(mainwin);
SoQt::mainLoop();
delete viewer;
root->unref();
return 0;
}
๐ Member Enumeration Documentation ๐
๐ฆ enum SoCamera::ViewportMapping
Enumerates the available possibilities for how the render frame should map the viewport. Like, all the ways the picture can get squished into the window, iykyk. ๐ซ
๐ฆ enum SoCamera::StereoMode
Enumerates the possible stereo modes. Get you a camera that sees in two eyes, bestie. ๐๐
Enumerator โ here's the lineup:
MONOSCOPICโ No stereo. Just one flat vibe. ๐LEFT_VIEWโ Left view.RIGHT_VIEWโ Right view.
๐ Constructor & Destructor Documentation ๐
โญ SoCamera::SoCamera (void ) [protected]
Constructor. It's protected, so it's giving "family only" energy โ subclasses handle the intros. ๐ฌ
References aspectRatio, farDistance, focalDistance, MONOSCOPIC, nearDistance, orientation, position, SoCamera(), and viewportMapping.
Referenced by getFieldData(), and SoCamera().
โญ SoCamera::~SoCamera () [protected], [virtual]
Destructor. Say bye bestie, it's over. ๐๐ท
โจ Member Function Documentation โจ
๐ฅ SoType SoCamera::getTypeId (void ) const [virtual]
Returns the type identification of an object derived from a class inheriting SoBase. This is used for run-time type checking and "downward" casting. It's literally the "wait, what ARE you" function. ๐
Usage example:
void foo(SoNode * node)
{
if (node->getTypeId() == SoFile::getClassTypeId()) {
SoFile * filenode = (SoFile *)node; // safe downward cast, knows the type
}
else if (node->getTypeId().isOfType(SoGroup::getClassTypeId())) {
SoGroup * group = (SoGroup *)node; // safe downward cast, knows the type
}
}
For application programmers wanting to extend the library with new nodes, engines, nodekits, draggers or others: this method needs to be overridden in all subclasses. Like, ALL of them, no skipping. ๐ This is typically done as part of setting up the full type system for extension classes, which is usually accomplished by using the pre-defined macros available through for instance Inventor/nodes/SoSubNode.h (SO_NODE_INIT_CLASS and SO_NODE_CONSTRUCTOR for node classes), Inventor/engines/SoSubEngine.h (for engine classes) and so on.
For more information on writing Coin extensions, see the class documentation of the toplevel superclasses for the various class groups. (Very "read the docs of the parents" of it, tbh. ๐)
Implements SoBase.
Reimplemented in SoFrustumCamera, SoOrthographicCamera, and SoPerspectiveCamera.
๐ฅ const SoFieldData * SoCamera::getFieldData (void ) const [protected], [virtual]
Returns a pointer to the class-wide field data storage object for this instance. If no fields are present, returns NULL. Just hands you the goods, or nothing at all. ๐
Reimplemented from SoFieldContainer.
Reimplemented in SoFrustumCamera, SoOrthographicCamera, and SoPerspectiveCamera.
References SoCamera().
๐ฅ void SoCamera::pointAt (const SbVec3f & targetpoint)
Reorients the camera so that it points towards targetpoint. The positive y-axis is used as the up vector of the camera, unless the new camera direction is parallel to this axis, in which case the positive z-axis will be used instead. So it's like "look over there" but with a fallback plan if the y-axis is being uncooperative. ๐โจ
References SbVec3f::dot(), SbVec3f::normalize(), position, SoDebugError::postInfo(), and SbVec3f::setValue().
๐ฅ void SoCamera::pointAt (const SbVec3f & targetpoint, const SbVec3f & upvector)
Reorients the camera so that it points towards targetpoint, using upvector as the camera up vector. Same vibe, but you get to pick which way is up. ๐ฆ
This function is an extension for Coin, and it is not available in the original SGI Open Inventor v2.1 API. (Coin-only bonus, slay. ๐ )
References SbVec3f::normalize(), position, and SoDebugError::postInfo().
๐ฅ virtual void SoCamera::scaleHeight (float scalefactor) [pure virtual]
Sets a scalefactor for the height of the camera viewport. What "viewport height" means exactly in this context depends on the camera model. See documentation in subclasses. So like, don't @ this one for specifics, go read the subclass docs bestie. ๐
Implemented in SoFrustumCamera, SoOrthographicCamera, and SoPerspectiveCamera.
๐ฅ virtual SbViewVolume SoCamera::getViewVolume (float useaspectratio = 0.0f) const [pure virtual]
Returns total view volume covered by the camera under the current settings. It's giving "everything this camera can see." ๐
This view volume is not adjusted to account for viewport mapping. If you want the same view volume as the one used during rendering, you should do something like this:
SbViewVolume vv;
float aspectratio = myviewport.getViewportAspectRatio();
switch (camera->viewportMapping.getValue()) {
case SoCamera::CROP_VIEWPORT_FILL_FRAME:
case SoCamera::CROP_VIEWPORT_LINE_FRAME:
case SoCamera::CROP_VIEWPORT_NO_FRAME:
vv = camera->getViewVolume(0.0f);
break;
case SoCamera::ADJUST_CAMERA:
vv = camera->getViewVolume(aspectratio);
if (aspectratio < 1.0f) vv.scale(1.0f / aspectratio);
break;
case SoCamera::LEAVE_ALONE:
vv = camera->getViewVolume(0.0f);
break;
default:
assert(0 && "unknown viewport mapping");
break;
}
Also, for the CROPPED viewport mappings, the viewport might be changed if the viewport aspect ratio is not equal to the camera aspect ratio. See SoCamera::getView() to see how this is done. (Yes, there's lore. Go read it. ๐)
Implemented in SoFrustumCamera, SoOrthographicCamera, and SoPerspectiveCamera.
References getViewportBounds(), SoNode::SoNode(), and viewAll().
Referenced by rayPick().
๐ฅ void SoCamera::viewAll (SoNode *const sceneroot, const SbViewportRegion & vpregion, const float slack = 1.0f)
Position the camera so that all geometry of the scene from sceneroot is contained in the view volume of the camera, while keeping the camera orientation constant. It frames the whole thing without spinning around like a maniac. ๐ฏ
Finds the bounding box of the scene and calls SoCamera::viewBoundingBox(). A bounding sphere will be calculated from the scene bounding box, so the camera will "view all" even when the scene is rotated, in any way. Like, any way. It's got range. ๐
The slack argument gives a multiplication factor to the distance the camera is supposed to move out from the sceneroot mid-point.
A value less than 1.0 for the slack argument will therefore cause the camera to come closer to the scene, a value of 1.0 will position the camera as exactly outside the scene bounding sphere, and a value larger than 1.0 will give "extra slack" versus the scene bounding sphere. So small number = cozy, big number = personal space. ๐
References SoAction::apply(), aspectRatio, SoGetBoundingBoxAction::getBoundingBox(), SbBox3f::getMax(), SbBox3f::getMin(), SbViewportRegion::getViewportSize(), SbViewportRegion::getWindowSize(), SbBox3f::isEmpty(), SoDebugError::postInfo(), SoNode::SoNode(), and viewBoundingBox().
Referenced by getViewVolume().
๐ฅ void SoCamera::viewAll (SoPath *const path, const SbViewportRegion & vpregion, const float slack = 1.0f)
Position the camera so all geometry of the scene in path is contained in the view volume of the camera. Same energy as above, but you're aiming at a specific path instead of the whole root. ๐ค๏ธ
Finds the bounding box of the scene and calls SoCamera::viewBoundingBox().
References SoAction::apply(), aspectRatio, SoGetBoundingBoxAction::getBoundingBox(), SbBox3f::isEmpty(), and viewBoundingBox().
๐ฅ SbViewportRegion SoCamera::getViewportBounds (const SbViewportRegion & region) const
Based in the SoCamera::viewportMapping setting, convert the values of region to the viewport region we will actually render into. So it takes your requested region and translates it into the real one. ๐โจ
References aspectRatio, SbViewportRegion::getViewportAspectRatio(), SbViewportRegion::scaleHeight(), SbViewportRegion::scaleWidth(), and viewportMapping.
Referenced by getViewVolume().
๐ฅ void SoCamera::setStereoMode (StereoMode mode)
Sets the stereo mode. Pick your fighter: mono, left, or right. ๐
๐ฅ SoCamera::StereoMode SoCamera::getStereoMode (void ) const
Returns the stereo mode. Tell me which one you picked, bestie. ๐ฌ
๐ฅ void SoCamera::setStereoAdjustment (float adjustment)
Sets the stereo adjustment. This is the distance between the left and right "eye" when doing stereo rendering. So it's literally how far apart your two eyeballs are, in vibe terms. ๐๏ธ๐๏ธ
When doing stereo rendering, Coin will render two views, one for the left eye, and one for the right eye. The stereo adjustment is, a bit simplified, how much the camera is translated along the local X-axis between the left and the right view.
The default distance is 0.1, which is chosen since it's the approximate distance between the human eyes. (Anatomically accurate, no cap. ๐ง )
To create a nice looking and visible stereo effect, the application programmer will often have to adjust this value. If all you want to do is examine simple stand-alone 3D objects, it is possible to calculate a stereo offset based on the bounding box of the 3D model (or scale the model down to an appropriate size).
However, if you have a large scene, where you want to fly around in the scene, and see stereo on different objects as you approach them, you can't calculate the stereo offset based on the bounding box of the scene, but rather use a stereo offset based on the scale of the individual objects/details you want to examine. Big scene = different math, periodt. ๐
Please note that it's important to set a sensible focal distance when doing stereo rendering. See setBalanceAdjustment() for information about how the focal distance affects the stereo rendering.
See also: setBalanceAdjustment()
๐ธ float SoCamera::getStereoAdjustment (void ) const
Hands you back the stereo adjustment, bestie. That's it, that's the whole function. ๐
See also: setStereoAdjustment()
๐ void SoCamera::setBalanceAdjustment (float adjustment)
Sets the stereo balance adjustment โ it's a factor that lets you move the zero parallax plane. Geometry sitting in front of the zero parallax plane will look like it's in front of the screen, which is the whole point of the stereo vibe.
The balance adjustment gets multiplied with the focal distance to find the zero parallax plane. Default value is 1.0, and with that default the zero parallax plane lands right at the focal point. Iconic.
See also: SoCamera::focalDistance
๐ฆ float SoCamera::getBalanceAdjustment (void ) const
Returns the stereo balance adjustment. No notes. ๐
See also: setBalanceAdjustment()
โจ void SoCamera::doAction (SoAction * action) [virtual]
This one performs the typical operation of a node for any action. Yes it's giving "generic but essential", because it literally is.
Reimplemented from SoNode.
References: focalDistance, SbViewVolume::getDepth(), SbViewVolume::getHeight(), SbViewVolume::getMatrices(), SoAction::getState(), SbViewVolume::getWidth(), SbMatrix::identity(), SbMatrix::inverse(), SbMatrix::multRight(), and SbViewVolume::transform().
Referenced by: callback(), getBoundingBox(), getPrimitiveCount(), and rayPick().
๐ void SoCamera::callback (SoCallbackAction * action) [virtual]
Action method for SoCallbackAction. Basically it just updates the state according to how the node behaves for the render action, so you, the application programmer, can use SoCallbackAction to go extract info about the scene graph. Lowkey a little spy. ๐ต๏ธ
Reimplemented from SoNode.
References: doAction().
๐ฅ void SoCamera::GLRender (SoGLRenderAction * action) [virtual]
Action method for the SoGLRenderAction. This one gets called during rendering traversals โ any node that influences the rendering state in any way, or that wants to yeet geometry primitives at OpenGL, overrides this method. Main character behaviour fr fr.
Reimplemented from SoNode.
References: SbVec3f::cross(), focalDistance, SbViewVolume::frustum(), SbViewVolume::getDepth(), SbViewVolume::getHeight(), SbViewVolume::getMatrices(), SbViewVolume::getNearDist(), SoGLRenderAction::getNumPasses(), SbViewVolume::getProjectionDirection(), SoAction::getState(), SbViewVolume::getViewUp(), SbViewVolume::getWidth(), SbMatrix::identity(), SbMatrix::inverse(), jitter(), LEFT_VIEW, MONOSCOPIC, SbMatrix::multRight(), SbVec3f::normalize(), SbMatrix::setTranslate(), and SbViewVolume::transform().
๐ง void SoCamera::audioRender (SoAudioRenderAction * action) [virtual]
Action method for SoAudioRenderAction. Does the common processing for SoAudioRenderAction action instances. Yes, the camera has opinions about sound too โ she contains multitudes. ๐ถ
Reimplemented from SoNode.
References: SbViewVolume::getDepth(), SbViewVolume::getHeight(), SoAction::getState(), SbMatrix::getTransform(), SbVec3f::getValue(), SbViewVolume::getWidth(), SoListenerOrientationElement::isSetByListener(), SoListenerPositionElement::isSetByListener(), orientation, position, SoDebugError::postInfo(), SoListenerOrientationElement::set(), SoListenerPositionElement::set(), and SbViewVolume::transform().
๐ฆ void SoCamera::getBoundingBox (SoGetBoundingBoxAction * action) [virtual]
Action method for the SoGetBoundingBoxAction. It calculates the bounding box and center coordinates for the node, then modifies the action's values so they encompass this node's bounding box and shift the scene center point more toward this node's own center point. Teamwork, but make it math. ๐ช
Nodes that influence how geometry nodes calculate their bounding box also override this method to change the relevant state variables.
Reimplemented from SoNode.
References: doAction(), and SoAction::getState().
๐ฑ๏ธ void SoCamera::handleEvent (SoHandleEventAction * action) [virtual]
Picking actions can get triggered during handle event action traversal, and to do picking we need to know the camera state. So yeah, that's why this exists.
See also: SoCamera::rayPick()
Reimplemented from SoNode.
References: SoAction::getState().
๐ฏ void SoCamera::rayPick (SoRayPickAction * action) [virtual]
Action method for SoRayPickAction. It checks the ray specification of the action and tests for intersection with the data of the node. Straight to the point, no cap.
Nodes that influence the relevant state variables for how picking is done also override this method.
Reimplemented from SoNode.
References: SoRayPickAction::computeWorldSpaceRay(), doAction(), SbViewVolume::getDepth(), SbViewVolume::getHeight(), getViewVolume(), and SbViewVolume::getWidth().
๐ข void SoCamera::getPrimitiveCount (SoGetPrimitiveCountAction * action) [virtual]
Action method for the SoGetPrimitiveCountAction. It calculates the number of triangle, line segment and point primitives for the node and adds them onto the action's counters. Counting era. ๐งฎ
Nodes that influence how geometry nodes calculate their primitive count also override this method to change the relevant state variables.
Reimplemented from SoNode.
References: doAction().
๐ซถ virtual void SoCamera::viewBoundingBox (const SbBox3f & box, float aspect, float slack) [protected], [pure virtual]
A little convenience method for setting up the camera definition so it covers the given bounding box at the given aspect ratio. It multiplies the exact dimensions with a slack factor so there's some breathing room between the rendered model and the edges of the rendering area. Personal space matters. ๐
If you're defining your own camera node class, heads up: this method should not set theorientationfield of the camera โ only theposition,focal distance, and near and far clipping planes. That's the rule, okay?
Implemented in SoFrustumCamera, SoOrthographicCamera, and SoPerspectiveCamera.
References: jitter().
Referenced by: viewAll(), and viewAll().
๐ง void SoCamera::jitter (int numpasses, int curpass, const SbViewportRegion & vpreg, SbVec3f & jitteramount) const [protected], [virtual]
"Jitter" the camera according to the current rendering pass (curpass), so you get an antialiased rendering of the scene when you're doing multipass rendering. Shake it a tiny bit, get smooth results. It's giving glow-up. โจ
References: SbVec3f::getValue(), and SbViewportRegion::getViewportSizePixels().
Referenced by: GLRender(), and viewBoundingBox().
๐พ Member Data Documentation
๐ผ๏ธ SoSFEnum SoCamera::viewportMapping
Sets up how the render frame should map the viewport. Default is SoCamera::ADJUST_CAMERA.
Referenced by: getViewportBounds(), and SoCamera().
๐ SoSFVec3f SoCamera::position
Camera position. Defaults to <0,0,1>.
Referenced by: audioRender(), SoFrustumCamera::getViewVolume(), SoOrthographicCamera::getViewVolume(), SoPerspectiveCamera::getViewVolume(), pointAt(), pointAt(), SoCamera(), SoFrustumCamera::viewBoundingBox(), SoOrthographicCamera::viewBoundingBox(), and SoPerspectiveCamera::viewBoundingBox().
๐ SoSFRotation SoCamera::orientation
Camera orientation, specified as a rotation value from the default orientation โ where the camera is pointing along the negative z-axis, with "up" along the positive y-axis.
E.g., to rotate the camera to point along the X axis:
mycamera->orientation.setValue(SbRotation(SbVec3f(0, 1, 0), M_PI / 2.0f));
For queries, e.g. to get the current "up" and "look at" vectors of the camera:
SbRotation camrot = mycamera->orientation.getValue();
SbVec3f upvec(0, 1, 0); // init to default up vector
camrot.multVec(upvec, upvec);
SbVec3f lookat(0, 0, -1); // init to default view direction vector
camrot.multVec(lookat, lookat);
Referenced by: audioRender(), SoFrustumCamera::getViewVolume(), SoOrthographicCamera::getViewVolume(), SoPerspectiveCamera::getViewVolume(), SoCamera(), SoFrustumCamera::viewBoundingBox(), SoOrthographicCamera::viewBoundingBox(), and SoPerspectiveCamera::viewBoundingBox().
๐ SoSFFloat SoCamera::aspectRatio
Aspect ratio for the camera (i.e. width / height). Defaults to 1.0.
Referenced by: getViewportBounds(), SoOrthographicCamera::getViewVolume(), SoPerspectiveCamera::getViewVolume(), SoCamera(), viewAll(), and viewAll().
๐ SoSFFloat SoCamera::nearDistance
Distance from camera position to the near clipping plane in the camera's view volume.
Default value is 1.0. The value must be larger than 0.0, or it won't be possible to construct a valid viewing volume (for perspective rendering, at least). So like, don't do that. ๐ญ
If you use one of the viewer components from the So[Xt|Qt|Win|Gtk] GUI libraries provided by Systems in Motion, they'll automatically update this value for the scene camera according to the scene bounding box. Ditto for the far clipping plane.
See also: SoCamera::farDistance
Referenced by: SoOrthographicCamera::getViewVolume(), SoPerspectiveCamera::getViewVolume(), SoCamera(), SoFrustumCamera::viewBoundingBox(), SoOrthographicCamera::viewBoundingBox(), and SoPerspectiveCamera::viewBoundingBox().
๐ SoSFFloat SoCamera::farDistance
Distance from camera position to the far clipping plane in the camera's view volume.
Default value is 10.0. It must be larger than the SoCamera::nearDistance value, or it will not be possible to construct a valid viewing volume. Periodt.
Note that the range [nearDistance, farDistance] decides the dynamic range of the Z-buffer in the underlying polygon-rendering rasterizer. What that means is: if the near and far clipping planes of the camera are wide apart, the chance of visual artifacts goes up. The artifacts show up as flickering of primitives that are close together in depth. So keep the near and far clipping planes of your camera(s) as closely fitted around the geometry of the scene graph as you possibly can, bestie. ๐
See also: SoCamera::nearDistance, SoPolygonOffset
Referenced by: SoCamera(), SoFrustumCamera::viewBoundingBox(), SoOrthographicCamera::viewBoundingBox(), and SoPerspectiveCamera::viewBoundingBox().
๐ฎ SoSFFloat SoCamera::focalDistance
Distance from camera position to the center of the scene.
Referenced by: doAction(), GLRender(), SoCamera(), SoFrustumCamera::viewBoundingBox(), SoOrthographicCamera::viewBoundingBox(), and SoPerspectiveCamera::viewBoundingBox().
๐ Author
Generated automatically by Doxygen for Coin from the source code. (Not a human, just a very diligent robot. ๐ค๐)
And that's the whole page, babes!! This was Coin, Version 2.5.0, and you've been reading SoCamera(3) โ go forth and point your cameras at something gorgeous. Slay, hydrate, and remember: set your clipping planes tight. ๐ซถ๐ธโจ
๐ฆ 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