vpStoreRawVolume(3)

✨ vpStoreRawVolume ✨ (the 3 library-functions era, bestie)

okay so real talk, this whole page lives in section 3 of the manual β€” the Library Functions Manual β€” and it's the moment your volume data finally gets to leave the context and go live in a file. πŸŽ€ four functions, one mission: save it, don't lose it.


🌸 NAME 🌸

vpStoreRawVolume, vpStoreMinMaxOctree, vpStoreClassifiedVolume, vpStoreContext β€” store volume data structures to a file πŸ’Ύβœ¨


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <volpack.h>

vpResult
vpStoreRawVolume(vpc, fd)
    vpContext *vpc;
    int fd;

vpResult
vpStoreMinMaxOctree(vpc, fd)
    vpContext *vpc;
    int fd;

vpResult
vpStoreClassifiedVolume(vpc, fd)
    vpContext *vpc;
    int fd;

vpResult
vpStoreContext(vpc, fd)
    vpContext *vpc;
    int fd;

πŸ’… ARGUMENTS πŸ’…

  • vpc β€” the VolPack context you got from vpCreateContext. your main character. πŸ‘‘
  • fd β€” a file descriptor from open(2), and it has to be opened for writing. no writing to read-only fds, that's not the vibe. 🚫

πŸŽ€ DESCRIPTION πŸŽ€

these four besties are how you take volume data structures out of a rendering context and drop them into files β€” specifically into the format that the VolPack file reading routines understand (peep vpLoadRawVolume(3) for the other side of that story 🫢). it's giving save-game energy, it's giving persistence.

  • vpStoreRawVolume β€” makes a 3D voxel array file. the file carries info about the size of the volume and the layout of the voxels, plus the volume data itself. ✨
  • vpStoreMinMaxOctree β€” makes a min-max octree file. the file carries info about the size of the volume and the layout of the voxels, plus the octree itself. 🌳
  • vpStoreClassifiedVolume β€” makes a preclassified volume data file. the file carries info about the size of the volume and the layout of the voxels, plus the volume data itself. 🧠
  • vpStoreContext β€” makes a rendering context file. this one holds all rendering parameters β€” except volume data and callback functions, those are staying home 😌 β€” and the contents of any lookup tables for shading and classification get stored too. 🌈
lowkey the best part: the function that actually writes the data to the files can be swapped out by calling vpSetCallback with the VP_WRITE_FUNC option. want to build a whole file-compression system on top of this? the manpage literally says "for example". go off. πŸ”₯

⭐ STATE VARIABLES ⭐

the current file I/O parameters are retrievable with the following state variable codes (check vpGeti(3) for how): VP_WRITE_FUNC.


πŸ’€ ERRORS πŸ’€

the normal return value is VP_OK β€” that's the slay outcome. 😌✨ these are the other possibilities, and yes you should know them:

  • VPERROR_IO β€” the file writing function returned an error value (in which case the external variable errno should contain an operating-system specific error code), or the file system is full. 😭 that second one hurts.
  • VPERROR_BAD_VOLUME β€” the volume dimensions are invalid, or there is no voxel data in the context. nothing to save, bestie. πŸ™ˆ
  • VPERROR_BAD_SIZE β€” there is no min-max octree in the volume (vpStoreMinMaxOctree only). just this one, don't @ the others. πŸ’…
  • VPERROR_BAD_VOXEL β€” the voxel fields in the rendering context have not been properly defined. fix that first, fr fr. 🧚

🌟 SEE ALSO 🌟

VolPack(3), vpCreateContext(3), vpLoadRawVolume(3)


and that's the page!! this one's brought to you by VolPack β€” the source and version behind vpStoreRawVolume(3), aka the name that shows up in the footer of this very manual page. no date on this one, so we're just vibing with the source. mwah, go store some volumes πŸ’–πŸ’…πŸŽ€

πŸ“¦ where this page comes from