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
dxDrawModel3D reimplementation #3266
base: master
Are you sure you want to change the base?
Conversation
The |
I feel draw functions shouldn't manage model loading. Using this draw function with blocking mode is totally wrong, it causes FPS drops. Async mode is bad too, it causes drawing in a wrong frame. So only "loaded" mode is good here.
|
I feel the same. But the nonblocking model loading is exactly what SA streamer is doing. I mean this is natural for SA.
Looks like these functions do not fit that easy in the context of dxDrawModel3D. |
Are the rendering issues (models becoming invisible at certain view-angles for example) fixed in this PR? |
Of course. This PR is written from scratch keeping in mind all problems of the previous one. Moreover, it would be weird to just reopen a PR with the same problems. |
engineLoadModel and engineUnoadModel are bad names. |
Okay, I'll think about it. |
I think such a function (that loads models) could be handy in other situations too (like pre-loading a section of the world for custom maps, etc). |
Hey, any updates on this? |
Yes, I aggregated all suggestions so that the final PR will contain the following: It requires some polishing and the internal testing. I hope to finish it soon. |
Though, by using SA naming, |
#define HOOKSIZE_CRenderer_EverythingBarRoads 5 | ||
DWORD RETURN_CRenderer_EverythingBarRoads = 0x553C7D; | ||
DWORD DO_CRenderer_EverythingBarRoads = 0x7EE180; | ||
void _declspec(naked) HOOK_CRenderer_EverythingBarRoads() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might not work that well for objects with alpha.
Have you tried that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, this won't work well for translucent objects. Obviously, translucent objects require a dedicated render path involving the batch sorting. I'll fix it, okay.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think for now it's fine for it to not work, it can be fixed later.
I just wanted to note this
I thought about it too. And I have come up with the following syntax:
There also can be event "onClientModelLoaded". But I'm not sure if this event is actually needed. |
How will it work with addRef = false and addRef = true ?
|
The better name for this argument is "retain". It increments the ref count for the specific model. But only one additional reference per resource. When addRef = false it's just trying to load a model without any guarantees. It's the way SA is doing the streaming. addRef = false is convinient for the case when you need a model just in the current(async = false) or the next frame(async = true). |
"the next frame"
I remember gta uses some sort of multi threading for file loading.
Does gta guarantee that the model will be loaded exactly on the next frame?
|
No, even SA does not guarantee that. I previously mentioned the next frame to emphasize the asynchronous nature of the argument. Of course the precise moment isn't specified. |
engineStreamingRequestModel with
|
I think it's even better to replace addRef = false with persistent = false. It's more illustrative. |
Brings
dxDrawModel3D
function(#3172) back. The syntax is compatible with the previous one, but has a new optional argument that allows to control how a model should be streamed in:bool dxDrawModel3D(int model, float x, float y, float z, float rx, float ry, float rz, [float sx = 1.0f, float sy = 1.0f, float sz = 1.0f, string mode = "async"])
, where mode can be"loaded"
,"async"
,"blocking"
. When mode is"loaded"
then a model will be only visible when it's already loaded at the function's call moment.