BVRML(3pm)

πŸ’– BVRML πŸ’–

okay bestie, so this is BVRML(3pm) β€” a User Contributed Perl Documentation page, aka a lil perl module manual that somebody (hi Richard πŸ’œ) contributed. It's giving "niche 3D graphics tooling" and honestly? iconic. Let's get into it. πŸ¦‹


✨ NAME ✨

XRacer::BVRML β€” a parser for a tiny subset of VRML generated by Blender πŸŽ€


🌸 SYNOPSIS 🌸

use XRacer::BVRML;

that's it. that's the whole vibe check. one line and you're in. πŸ’…


🧚 DESCRIPTION 🧚

so. this is a parser for a tiny subset of VRML generated by Blender β€” and when we say tiny we mean tiny, bestie. it's called Blender-VRML, or BVRML for short. πŸ“

and no cap, this parser is by no means guaranteed to be able to parse everything that Blender could possibly generate. not even close. the author literally says he'll add parsing capability as he sees the need β€” which is such a mood, we love a "we'll get to it when we get to it" energy. πŸ™ˆ

here's what it actually does though:

  • XRacer::BVRML parses a Blender VRML file and stores it in an internal world representation that you can inspect and manipulate. peek at it, poke at it, rearrange it, whatever. πŸ‘‘
  • XRacer::BVRML can also write out a C function containing GL commands that render this world object. and then that function can be used inside an XRacer track or craft file. so yes, it's crossing language borders and it's serving main character energy. πŸ”₯

🌈 CLASS METHODS 🌈

  • $world = XRacer::BVRML->parse ($filename [, $world]); β€” this parses a BVRML file called $filename and generates a $world object. and if you also pass in that second optional $world parameter, then it parses the BVRML file and merges the results into the existing $world object. very "blending into the group chat" of it. 🫢
⚠️ if the parsing fails, this function will print an error message and return undef. so please, bestie, check for undef. don't just blindly use the return value, it's giving heartbreak. πŸ’”

πŸ‘‘ WORLD OBJECT METHODS πŸ‘‘

  • $nr_vertices = $world->nr_vertices; β€” returns the total number of vertices in the world. just the count, nothing more. ⭐
  • $nr_faces = $world->nr_faces; β€” returns the total number of faces in the world. also just a count. ✨
  • @vertices = $world->vertices; β€” aggregates all the vertices in the world and hands them back to you as a list. πŸŽ€
  • @faces = $world->faces; β€” aggregates all the faces in the world and returns them as a list. πŸ’–
  • ($smallest_x, $largest_x, $smallest_y, $largest_y, $smallest_z, $largest_z) = $world->bbox; β€” returns the bounding box of this world. and yes, technically it's a bounding cuboid β€” the docs are being precise about it and we respect that. πŸ’…
  • $world->write_display_function ([name => $function_name,] [filehandle => $filehandle,] [decl => $decl]); β€” writes out a C function containing GL calls which, when invoked, will display this world object. 🌸

the C function is called $function_name and gets written to the file specified by the $filehandle. by default the function is declared as void function_name (void) β€” unless you hand over the $decl parameter, which gives the return declaration instead. so you can switch it up if you want. πŸ’œ

this C function is suitable for directly linking into XRacer craft and track files. but β€” and this is a big but β€” it requires some support. specifically:

you will need to include the header file GL/gl.h, and probably xracer.h too, before the function. do not skip this. it will not slay, it will simply fail to compile. 😭

πŸ’œ AUTHOR πŸ’œ

Richard W.M. Jones, <rich@annexia.org> 🫢


XRacer is copyright (C) 1999-2000 Richard W.M. Jones (rich@annexia.org) and other contributors listed in the AUTHORS file. πŸ‘‘


🌟 SEE ALSO 🌟


and that's the whole page, bestie. this one shipped as part of perl v5.40.0 and got dated 2025-01-25 β€” so go forth, parse some Blender-generated VRML, and remember: check for undef. mwah. πŸ’…βœ¨πŸŽ€

πŸ“¦ where this page comes from