Skip to content
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

Array resource type as template #589

Open
briaguya-ai opened this issue May 16, 2024 · 1 comment
Open

Array resource type as template #589

briaguya-ai opened this issue May 16, 2024 · 1 comment
Milestone

Comments

@briaguya-ai
Copy link
Collaborator

instead of having a bunch of hardcoded types in Array we could make it a template so ports can use it for any of their resource types

i think this could be done in a generic enough way to get it into the Ship:: namespace

@Archez
Copy link
Contributor

Archez commented May 17, 2024

A use case on 2ship for this is the ability to have an Array of CollisionPoly.
At a minimum, we would need a way to return a pointer to the start of the "array", and a way to query the array size.

On the port side we would create the CollisionPoly type, and I'm guessing some form of CollisionPolyFactory and some new Ship::ResourceFactoryBinaryArray.

If Ship::Array remains as an actual resource that implements ReadResource, then the CollisionPolyFactory would probably need a new type of "read" method that can be passed in the current reader as part of some loop within the Array factory. Then the Array resource would manage the memory (destructing each CollisionPoly when the Array is destructed).

If Ship::Array becomes some kind of template, then the CollisionPolyFactory would become solely responsible for reading the full resource. Presumably this would require registering this uniquely with the resource manager and have dedicated meta init data.

What I'm not fully aware of is what would be "registered" and what would go in the init meta data.

(This is just my random thoughts on the matter, but there is probably other ways to handle this as well)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants