vpSetRawVoxels(3)

πŸ’– vpSetRawVoxels(3) β€” Library Functions Manual πŸ’–

okay bestie, gather round, because this is the one where you hand VolPack your actual voxel data. yes, the data. the whole 3D volume. no big deal or anything πŸ’…


✨ NAME ✨

vpSetRawVoxels β€” specify an array of volume data 🧚


🌸 SYNOPSIS 🌸

#include <volpack.h>

vpResult
vpSetRawVoxels(vpc, voxels, size, xstride, ystride, zstride)
    vpContext *vpc;
    void *voxels;
    int size;
    int xstride, ystride, zstride;

πŸŽ€ ARGUMENTS πŸŽ€

  • vpc β€” the VolPack context you got from vpCreateContext. your main character struct, fr.
  • voxels β€” a 3D array of voxels. the actual goods. πŸ“
  • size β€” how big that voxel array is, in bytes. the vibe check on its size, if you will.
  • xstride β€” number of bytes from the beginning of one voxel to the beginning of the next voxel in the first array dimension. (so: how far you gotta scoot to get to your neighbor along x)
  • ystride β€” number of bytes from the beginning of one voxel to the beginning of the next voxel in the second array dimension.
  • zstride β€” number of bytes from the beginning of one voxel to the beginning of the next voxel in the third array dimension. slay, three whole strides.

πŸ’œ DESCRIPTION πŸ’œ

vpSetRawVoxels is how you tell VolPack "hey, here's the 3D array holding my volume data." that's it, that's the job. πŸ‘‘

the array must be large enough for the volume dimensions you set with vpSetVolumeSize and the voxel size you set with vpSetVoxelSize. no cap. if it's too small, that's on you, not on me. the data inside the array can be initialized either before or after you call vpSetRawVoxels β€” whenever, we're flexible like that ✨

lowkey a glow-up tip: some of the VolPack routines operate faster if the volume is stored in z-major order (xstride < ystride < zstride) β€” but it is not strictly necessary, so don't stress if that's not your arrangement. do it if you can, it's giving optimized.

🫢 important, bestie: the voxel array is not automatically deallocated when the context is destroyed with vpDestroyContext. the application is responsible for managing the memory associated with the volume array. that memory is yours. you freed it, you own it. periodt.

the voxel array can be a very large data structure, possibly larger than available main memory 😭 like, genuinely huge. and here's the iconic part: it is sometimes possible to precompute the optimized data structures required for the fast rendering algorithm without explicitly allocating a voxel array. see vpClassifyScalars(3) for that move. iykyk.

⚠️ also, heads up: during the call to vpSetRawVoxels, any existing precomputed volume data structures in the context are destroyed. gone. deleted. not me casually wiping your precomputed data πŸ™ˆ. plan accordingly.

🌈 STATE VARIABLES 🌈

you can pull the current voxel array parameters back out with these state variable codes (peep vpGeti(3)):

  • VP_VOXEL_DATA
  • VP_VOXEL_DATA_SIZE
  • VP_VOXEL_XSTRIDE
  • VP_VOXEL_YSTRIDE
  • VP_VOXEL_ZSTRIDE

⭐ ERRORS ⭐

the routine always returns VP_OK. always. it's never not okay. the most unproblematic function in the whole library, honestly. πŸ’–


πŸ¦‹ SEE ALSO πŸ¦‹


and that's the whole page, bestie!! this lil manual page came to you straight from the VolPack library, and yes, it is literally titled vpSetRawVoxels(3) β€” go forth and set those raw voxels, you absolute icon πŸ‘‘πŸ’…βœ¨

πŸ“¦ where this page comes from