-
-
Notifications
You must be signed in to change notification settings - Fork 454
2DFX Effects API #3741
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
base: master
Are you sure you want to change the base?
2DFX Effects API #3741
Conversation
what about a property for setting 2DFX dimension/interior ? also isn't the corona limit still 64 so something like Project2DFX's LOD lights still wouldn't be possible? |
2DFX effects do not have their own dimension and interior. They are part of the model, so they take on the same dimension and interior as the given object/building.
The current limit for visible coronas is indeed 64. I already know where and what needs to be done to increase it. However, I'm wondering whether it should be done as part of this PR or as a separate feature like a 'limit adjuster' |
Is it possible to apply effect to certain MTA object, just like targetElement when applying shader? |
Can you create a new 2DFX class for this instead of using engine class defs? |
if the corona limit fix is not too complex, it would be a good idea to make it part of this because a full limit adjuster with more features would be another whole beast. |
Unfortunately not, because although each entity has its own instance of RwObject, all instances share the same geometry — the RpGeometry pointer is the same for every object with a given ID. 2DFX effects are stored in the geometry plugin, so unfortunately it's not possible. It would require changing the logic of entity creation in GTA so that each entity would have its own geometry (which would also require more memory) |
can we make changes to the grass? |
What do you mean? |
Grass/plants are not a 2DFX effect. Grass is generated by a RW, and it's a completely different mechanism. Maybe, if there’s interest, I’ll create an API for plants as well, so that custom ones can be made, etc. However, I don't think this is something that the community desires |
Increasing grass limits would be nice. |
wow, that would be really helpful, especially working on some VC-based map to SA. |
This draft pull request is stale because it has been open for at least 90 days with no activity. Please continue on your draft pull request or it will be closed in 30 days automatically. |
any update? |
I need to think about this because when an object streams in, all its effects reset to default since the object is reloaded from the .dff file. I solved this with hooks, but it causes random crashes when using functions like engineRestreamWorld. I already have a potential solution that is 99% likely to work correctly, but at the moment, I have several other PRs in progress. I'll get back to this once I finish what I've already started |
Finally updateFirst post has been updated!Well, after half a year of inactivity on this PR, I finally managed to bring it to a finished state. I’ve been working on it over the past three weeks, during which I encountered several bugs related to the parser, but fortunately, thanks to collaboration (special thanks to @tederis and @sbx320 ), we were able to patch them along the way. All the code was written from scratch, completely new. Over this half-year, I gained a lot of new knowledge and experience, and now I can confidently say that the previous code was not of good quality and was causing crashes. The current version is free of any crashes, and based on my tests, I haven’t found any bugs. I have tested all functions, a lot of variants, and all effect types, including escalator. I can see how much interest this PR has generated, and that gave me the motivation to finish it instead of abandoning it for years. In my opinion, the PR is ready for review, and I’m eagerly looking forward to its merge, so I can start preparing full documentation related to the functions, 2DFX, flags, properties, etc. I just want to mention that the video "2DFX Explain" by Tut contains a mistake when it claims that some flags don't work in MTA — all flags that work in SP also work in MTA, although some require specific conditions. Everything will be explained in the documentation. And for now… I'm waiting for the review and hopefully the merge. |
This PR adds the ability to add, remove, and edit 2DFX effects. It's also possible to edit and remove 2DFX effects from existing objects without the need to edit the model.
Available effect types (relevant in MTA):
Note: The
escalator
effect allows for the creation of moving escalatorsElements that supports 2dfx with this PR
As for limitations, the limit is the same as with normal model editing, meaning as much as your memory can handle.
Important
The model must be loaded at least once by the game in order to use these functions. This is because if the model has never been loaded after joining the server, there is no information (CModelInfo) about the model in memory, making it impossible to modify its effects
Important
Building-type entities created using createBuilding or those that are part of the map must be restreamed after adding a new particle effect (for example, use engineRestreamWorld)
Caution
Stopping the script does not revert changes. If you removed an effect, you need to restore it; if you changed its properties, you need to reset them... that's exactly why resetModel2DFXEffects was created. (Example is removeWorldModel & restoreWorldModel)
Available functions:
Examples
Custom features
Roadsign new symbols list
/ , |
The 2DFX documentation will be created once the PR has been merged.
Possibly resolves: #3579