-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
Unload render assets from RAM #10520
Changes from 1 commit
e3b4936
9e6a6e2
0e0cf83
d7796cf
bb1b9f1
22588ad
d28a695
3111a57
63055d8
29b1c71
5ce91e1
6fe128d
b91ddd7
2d1a5c5
624fe80
9d7d16f
1b1eb32
18ffd40
239b6a3
e3de7ce
d00e845
9829eec
9b47b6b
9478355
9c0f3bc
aa538e2
19cd2bd
23cf06f
69061f8
ae035b5
03c33de
d083e30
400f324
8b863af
2c9c529
e1f78c9
8c92266
6acc91d
6bcc067
9bb0f46
fb45b81
ccb8afe
9088603
ea5af0d
fec04d1
8538833
16e320e
6efbb67
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -123,6 +123,7 @@ pub struct Mesh { | |
indices: Option<Indices>, | ||
morph_targets: Option<Handle<Image>>, | ||
morph_target_names: Option<Vec<String>>, | ||
pub mutable: bool, | ||
JMS55 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
impl Mesh { | ||
|
@@ -180,13 +181,14 @@ impl Mesh { | |
/// Construct a new mesh. You need to provide a [`PrimitiveTopology`] so that the | ||
/// renderer knows how to treat the vertex data. Most of the time this will be | ||
/// [`PrimitiveTopology::TriangleList`]. | ||
pub fn new(primitive_topology: PrimitiveTopology) -> Self { | ||
pub fn new(primitive_topology: PrimitiveTopology, mutable: bool) -> Self { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this would be nicer as a separate method instead, like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure how I feel. I wanted users to be aware of this. I'm worried if we make it a separate method they'll not realize, and then be confused why their asset is "missing" in their systems later on. |
||
Mesh { | ||
primitive_topology, | ||
attributes: Default::default(), | ||
indices: None, | ||
morph_targets: None, | ||
morph_target_names: None, | ||
mutable, | ||
} | ||
} | ||
|
||
|
@@ -1061,6 +1063,10 @@ impl RenderAsset for Mesh { | |
self.clone() | ||
} | ||
|
||
fn unload_after_extract(extracted_asset: &Self::ExtractedAsset) -> bool { | ||
!extracted_asset.mutable | ||
} | ||
|
||
/// Converts the extracted mesh a into [`GpuMesh`]. | ||
fn prepare_asset( | ||
mesh: Self::ExtractedAsset, | ||
|
@@ -1237,7 +1243,7 @@ mod tests { | |
#[test] | ||
#[should_panic] | ||
fn panic_invalid_format() { | ||
let _mesh = Mesh::new(PrimitiveTopology::TriangleList) | ||
let _mesh = Mesh::new(PrimitiveTopology::TriangleList, false) | ||
JMS55 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
.with_inserted_attribute(Mesh::ATTRIBUTE_UV_0, vec![[0.0, 0.0, 0.0]]); | ||
} | ||
} |
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.
can we make this a flag in the GltfLoaderSettings (or make settings.load_meshes into an enum maybe)?
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'd rather not, I think. Users should instead find the specific meshes/textures after loading, and set those ones specifically to Keep.