vpGetMaterial(3)

πŸ’– vpGetMaterial β€” get material properties πŸ’–

okay bestie, gather round, because this one is a VolPack library function from the Library Functions Manual and it's literally the "read my fit's whole vibe" call. it grabs material properties. that's it. that's the whole job. slay.


✨ NAME ✨

vpGetMaterial β€” get material properties πŸŽ€


🌸 SYNOPSIS 🌸

#include <volpack.h>

vpResult
vpGetMaterial(vpc, material, property, surface_side, r_ptr, g_ptr,
        b_ptr)
    vpContext *vpc;
    int material;
    int property;
    int surface_side;
    double *r_ptr, *g_ptr, *b_ptr;

like. look at her. six arguments and a dream πŸ’…


πŸ¦‹ ARGUMENTS πŸ¦‹

  • vpc β€” the VolPack context, the one you got from vpCreateContext. your main character. everything flows through her.
  • material β€” a constant naming a specific material number. the options are VP_MATERIAL0, VP_MATERIAL1, ..., all the way up to VP_MATERIAL5. so six materials, no cap.
  • property β€” a constant picking exactly one material property. your choices are VP_AMBIENT, VP_DIFFUSE, VP_SPECULAR, or VP_SHINYNESS. one at a time, bestie, we're not doing a whole haul in one trip πŸ™ˆ
  • surface_side β€” a constant naming one side of the material surface: either VP_EXTERIOR or VP_INTERIOR. pick a side. pick it wisely.
  • r_ptr, g_ptr, b_ptr β€” locations to store the RGB components of the color associated with the property. heads up tho: for VP_SHINYNESS, g_ptr and b_ptr are not used. they just sit there. unemployed. iconic of them honestly πŸ’€

🌈 DESCRIPTION 🌈

vpGetMaterial is how you get the properties of a material type. it's the reading twin of vpSetMaterial β€” the arguments are exactly analogous, fr fr.

two lil differences you need to clock though:

  1. the surface_side argument here may not be VP_BOTH_SIDES. nope. not allowed. not today.
  2. the final three arguments are pointers to locations for storing the material properties, because we're receiving info, not sending it. it's giving output parameters ✨

😭 ERRORS 😭

the normal return value is VP_OK. that's the good ending. the green flag. 🫢

but these error return values are possible, and you will be hearing from them:

  • VPERROR_BAD_VALUE β€” the material number is invalid. you made up a material. she does not exist bestie.
  • VPERROR_BAD_OPTION β€” either the surface_side or property arguments are invalid. one of them is lying and it's not you.
no cap: if you see one of these, check your constants before you check anything else. nine times out of ten it's a typo and the typo is yours πŸ’…

πŸ’œ SEE ALSO πŸ’œ


and that's the whole page, bestie!! ✨ go forth and read your materials responsibly. this has been vpGetMaterial(3) from the VolPack library, and honestly? she ate. periodt. πŸ’–πŸŽ€πŸ¦‹πŸŒΈπŸ‘‘

πŸ“¦ where this page comes from