4 ms·
That's very nice work, and many interesting concepts introduced in the post (for example, arenas, length bounded strings, the Cut struct). One caveat though:
by suspended_state 2y ago
That's very nice work, and many interesting concepts introduced in the post (for example, arenas, length bounded strings, the Cut struct).
One caveat though:
> If the OBJ source cannot fit in memory, then the model won’t fit in memory.
I don't think that this is true: a (single precision) float textual representation is typically equal or larger than its binary representation (4 bytes), the floating point used in the renderer given later in the post. The numbers given in the cube example are unlikely to occur in real world examples, where one would probably expect more than 2 digits of decimal precision. That being said, for double precision floats, it might be true in many scenarios, but I would not make that a cardinal rule anyway.
This corner cut fits within the objective of the post, which, imho, isn't to make the most efficient program, but provide a great foundation in C to build upon.
- grandempire 2y agoThe technique shown can be easily adapted to mmap.
- suspended_state 2y agoI was thinking about that too. I wasn't so sure but this SO entry eclipsed my doubts: https://stackoverflow.com/questions/7222164/mmap-an-entire-large-file https://stackoverflow.com/questions/7222164/mmap-an-entire-l...
- dahart 2y agoThe sentence you quoted must be true because the input file and the output binary model both need to fit in memory at the same time.
- suspended_state 2y agoI guess that the following statement would be true: if the process cannot load the whole file in memory and allocate memory for the model at the same time, then the it won't be able to run successfully. Strictly speaking, the sentence I quoted doesn't derive from that. This is just me quibbling though, because the intended meaning was most likely what you said.