-
Notifications
You must be signed in to change notification settings - Fork 1
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
Add TraceResult:Material #78
Conversation
Have you forgotten how unbearably slow |
@@ -59,7 +59,8 @@ TraceResult::TraceResult( | |||
detailScale(mat.detailScale), detailBlendFactor(mat.detailBlendFactor), | |||
detailBlendMode(mat.detailBlendMode), detailTint(mat.detailTint), | |||
detailAlphaMaskBaseTexture(mat.detailAlphaMaskBaseTexture), | |||
texScale(mat.texScale) | |||
texScale(mat.texScale), | |||
materialPath(&mat.path) |
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 should copy to the TraceResult
(The accel struct could be gc’d while the trace result is still in memory)
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.
In fact I'm going to look into how efficient my VTF copy constructor is, cause copying the textures in might also be doable now
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 see why you did this now, std::string
isn't trivially destructible
Solution to this is just providing access to all common material properties through the TraceResult
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.
My idea didn't work, gonna have to use ptrs to strings cause Lua doesn't call __gc
until far too late
I was copying IVTFTexture resources to Lua directly instead of having the user load them from a path
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.
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.
My idea didn't work, gonna have to use ptrs to strings cause Lua doesn't call
__gc
until far too late I was copying IVTFTexture resources to Lua directly instead of having the user load them from a path
Actually I'm going to implement a __gc
method for TraceResults
@@ -90,6 +90,8 @@ class TraceResult | |||
CBaseEntity* rawEnt; | |||
uint32_t submatIdx; | |||
|
|||
const std::string* materialPath = nullptr; |
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 shouldn’t be a pointer, see above
Fixes #77
PR Type (tick all that are applicable)
Tested Targets (only applicable for changes to the binary module, delete otherwise)
Checklist
Description
TraceResult:Material()
returns the material path (local tomaterials
of course) of the trace result.I don't really see a need for multiple texture getters because you could literally just do
Material(TraceResult:Material()):GetString("$basetexture")
and have more options in doing so.Please explain further