vpCurrentMatrix(3)
π vpCurrentMatrix(3) β choosing ur main character transformation matrix π
okay bestie, welcome to vpCurrentMatrix(3) from the Library Functions Manual section of the VolPack world. this is the function that picks which transformation matrix is currently getting all the attention. sit down, hydrate, let's go β¨
πΈ NAME πΈ
vpCurrentMatrix β choose the current transformation matrix. that's it, that's the whole job, and she does it flawlessly π
π SYNOPSIS π
#include <volpack.h>
vpResult
vpCurrentMatrix(vpc, option)
vpContext *vpc;
int option;
π¦ ARGUMENTS π¦
vpcβ the VolPack context, and you get it fromvpCreateContext. she's the whole vibe, the source of truth, ur ride or die π«Άoptionβ a code that says which one of the VolPack transformation matrices you want:VP_MODEL,VP_VIEWorVP_PROJECT. pick one, bestie, no takebacks (jk there are takebacks, just call the function again).
β¨ DESCRIPTION β¨
so vpCurrentMatrix is literally the function you call to choose the current transformation matrix. the option parameter must be one of these three, no exceptions, don't try to be quirky:
VP_MODELβ modeling transformation πVP_VIEWβ viewing transformation πVP_PROJECTβ projection transformation π½οΈ
after you call this, every subsequent call to the matrix transformation functions β that's vpIdentityMatrix, vpTranslate, vpRotate, vpScale, vpMultMatrix and vpSetMatrix β gets applied to the new current transformation matrix. not me rewiring the whole matrix pipeline with one call, iconic behavior fr fr π
π the modeling transformation (VP_MODEL) π
typically this one is used to specify a transformation from object coordinates to world coordinates. in object coordinates, the volume data lives inside a unit cube centered at the origin, with corners at (-0.5, -0.5, -0.5) and (0.5, 0.5, 0.5). cozy little cube, love that for her π§
the default modeling transformation is the identity, so at the start the volume is just chilling inside the unit cube in world coordinates. and by default, the current matrix is VP_MODEL β she's the default main character, no cap π
oh and heads up: the modeling transformation also gets applied to light direction vectors (peep vpSetLight(3) for that lore). β¨
π the viewing transformation (VP_VIEW) π
this one transforms world coordinates into eye coordinates. in eye coordinates, the viewer is looking down the Z axis in the negative direction. the default value of this matrix is also the identity, so by default the viewer is looking down the Z axis in world coordinates too. symmetry, we love to see it π¦
typically you use this matrix to specify the location and direction of the viewer β where you're standing and where you're looking, basically.
and lowkey the fun part: it's also possible to combine the modeling and viewing matrices (like in the OpenGL viewing model). if you do that, you can store the composite transformation in either the model or the view matrix, and set the other matrix to the identity. dealer's choice, bestie π
π½οΈ the projection transformation (VP_PROJECT) π½οΈ
this one specifies the transformation from eye coordinates to clip coordinates. in the clip coordinate system, the entire viewing frustum lies inside a cube defined by the planes X=1, X=-1, Y=1, Y=-1, Z=1 and Z=-1. six planes, one cube, everything fits inside, periodt.
this transformation also specifies the type of projection used to produce a 2D image. the 2D image is computed by projecting along the Z axis in the clip coordinate system, and then scaling in the X and Y dimensions to the final image size.
and if you need help computing projection transformations? the routines vpWindow and vpWindowPHIGS are genuinely useful for that. they ate π₯
β STATE VARIABLES β
you can retrieve the current transformation matrix code with the following state variable codes (see vpGeti(3)): VP_CURRENT_MATRIX. yes bestie, you can always ask her what she's up to π
π ERRORS π
the normal return value is VP_OK. the following error return value is possible:
VPERROR_BAD_OPTIONβ theoptionargument is invalid. like, you passed something that isn't one of the three. she's not mad, she's just disappointed π
π SEE ALSO π
VolPack(3), vpCreateContext(3), vpGetMatrix(3)
ngl if you pass a bad option,VPERROR_BAD_OPTIONis coming for you and it will find you. vibe check uroptionbefore you call, bestie π«Ά
that's the whole page, and she's a baddie. this one came straight from VolPack, and the page is vpCurrentMatrix(3) β go forth and transform ur coordinates, you absolute legend πβ¨π
π¦ where this page comes from
- fedora 43: volpack 1.0c7-35.fc43 Β· BSD-3-Clause
- fedora 43: volpack 1.0c7-35.fc43 Β· BSD-3-Clause
- fedora 44: volpack 1.0c7-36.fc44 Β· BSD-3-Clause
- fedora 44: volpack 1.0c7-36.fc44 Β· BSD-3-Clause
- Copyright (c) 1995-2008, Stanford University
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms