vpClassifyScanline(3)

πŸ’– vpClassifyScanline β€” from the VolPack library manual, section 3 πŸ’–

okay bestie, gather round, because we're about to talk about vpClassifyScanline(3) from the VolPack library β€” yes, the Library Functions Manual one, the legend herself. she's the girl who builds your preclassified volume one scanline at a time, and honestly? she ate. πŸ“


✨ NAME ✨

vpClassifyScanline β€” incrementally create a preclassified volume from scanlines of scalar data. like, little by little, scanline by scanline, no cap. πŸ’…


🌸 SYNOPSIS 🌸

#include <volpack.h>

vpResult
vpClassifyScanline(vpc, voxels)
    vpContext *vpc;
    void *voxels;

πŸŽ€ ARGUMENTS πŸŽ€

  • vpc β€” the VolPack context you got from vpCreateContext. your main character struct, basically. πŸ‘‘
  • voxels β€” a 1D array of voxel data. just a lil lineup of voxels, living their truth.

πŸ¦‹ DESCRIPTION πŸ¦‹

so the way that vpClassifyScanline works is: you use her to incrementally compute a preclassified volume. she classifies one scanline of voxels at a time and drops the result straight into the current preclassified volume. one at a time, bestie. she's not doing all of it at once, that's not her vibe.

the voxels argument is a 1D array holding voxels in the format you already specified earlier with vpSetVoxelSize and vpSetVoxelField. and listen β€” you must call vpVolumeSize to declare the size of the volume before the very first call to vpClassifyScanline. non-negotiable. also, the length of that 1D voxel array has to be exactly equal to the length of the X dimension of the volume. not more, not less, exactly. ✨

and guess what, you can initialize that 1D voxel array with vpScanlineNormals or with your own user-defined function β€” your call, your era. πŸ’–

the voxels in the array get classified using the current opacity transfer function (go peek at vpSetClassifierTable(3)) and then they're appended to the preclassified volume (hi vpClassifyVolume(3), ily). 🌈

now here's the part you can't skip: scanlines must be processed in Z-major order. so all the scanlines in the Z=0 slice get processed starting from Y=0 onward, then the Z=1 slice gets processed, and so on forever until you're done. no jumping around, that's giving chaos energy and the volume does not want that. πŸ™ˆ

once the last scanline in the volume has been processed, the preclassified data structure is ready to be used for rendering. slay! but β€” and this is important β€” rendering is not possible until all scanlines have been processed. not a single one. don't even try it. πŸ’€

⚠️ and when the first scanline of a volume gets passed to vpClassifyScanline, any existing preclassified volume data is destroyed. gone. deleted. she does not do leftovers. 😭

πŸ‘‘ ERRORS πŸ‘‘

the normal return value is VP_OK. iconic. but the following error return values are possible, and yes, you will meet them:

  • VPERROR_BAD_VOXEL β€” the voxel size or the voxel fields have not been specified, or they've been incorrectly specified. like girl, we needed those. 😭
  • VPERROR_BAD_CLASSIFIER β€” the opacity transfer function tables have invalid sizes, or they're associated with invalid voxel fields, or they've been incorrectly specified. messy. πŸ’…

πŸ’œ SEE ALSO πŸ’œ

VolPack(3), vpCreateContext(3), vpSetClassifierTable(3), vpClassifyVolume(3), vpClassifyScalars(3) β€” the whole friend group, go read them, iykyk. 🫢


okay that's the whole page bestie, and as a lil sign-off: this one comes to you from VolPack β€” that's the source/version vibe β€” under the vpClassifyScanline(3) name, exactly like the header says at the top. periodt. πŸŽ€βœ¨

πŸ“¦ where this page comes from