jpaoneMines / csci441

CSCI441 Library Helper Functions and Classes
MIT License
5 stars 2 forks source link

ModelLoader: specify size of v/vn/vt/f arrays when loading file #22

Open jpaoneMines opened 1 year ago

jpaoneMines commented 1 year ago

For a performance boost, don't scan the file to count the number of vertices, normals, texCoords, faces.

Instead provide parameters to the function. These default to -1.

If vertices is -1, then scan the file and count.

Otherwise, allocate arrays to those initial sizes. If the provided size is greater than the actual encountered, print a message to the screen informing the user they allocated too much memory. If the provided size is too small, print a message to the screen informing the user they didn't allocate enough memory. TBD - resize the array? Or fail?

jpaoneMines commented 11 months ago

Need to investigate if the preprocessing of attributes can be done in a single pass by removing the need to count.