-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generic resource loading #95
Comments
This is in place of EDIT: I've just reread #43 and I think I may have the wrong idea about this (it also midnight here and my reading comprehension isn't so good) |
A Since the |
Okay, I think I see now. It's basically a better way to abstract the resource type and also saves a heap of code reuse (such as having heaps of calls to Also, I assume |
Exactly.
This is only a concept so far. I have not started the implementation, this issue represents only the idea. |
Excellent, this sounds like this could work really well. Hopefully you can find a workaround for some of the weird formats (i.e models). You should be able to see what I mean by looking at Mike's code I sent you. |
To load resources like textures and models from the ARC files, a templated
resource
class was proposed:A
texture
would then be aresource<sh3_texture_header>
, which provides us access to the header by simply aliasing the bytes inresource::raw
, as well as convenient access to the "body" (non-header bytes). Reading in the vector is then enough to load a resource from a file.Some resource types, e.g. models, may have multiple sub-headers. This is what the
data_offset()
function of the header is for.For headers without sub-headers, the implementation is just
return sizeof(*this);
, while for those with sub-headers, the implementation isreturn sizeof(*this) + num_sub_headers * sizeof(SubHeader);
to account for them.The sub-headers in models refer to embedded textures. These resources can also be handled with an appropriate
data_offset()
function.The text was updated successfully, but these errors were encountered: