Spatial texture creation
This commit is contained in:
@@ -187,6 +187,8 @@ pub struct ReplacementModules {
|
||||
pub struct RenderTape {
|
||||
pub seed: u64,
|
||||
pub subdivision: u32,
|
||||
pub time: f32,
|
||||
pub key: u64,
|
||||
|
||||
pub enable_gen: Handle<Shader>,
|
||||
pub fuzz: Handle<Shader>,
|
||||
@@ -224,10 +226,29 @@ impl RenderAsset for RenderTape {
|
||||
tape: Self::SourceAsset,
|
||||
_tape_id: AssetId<Self::SourceAsset>,
|
||||
(asset_server, replacement_modules, pipeline_cache): &mut SystemParamItem<Self::Param>,
|
||||
_: Option<&Self>,
|
||||
previous_asset: Option<&Self>,
|
||||
) -> Result<Self, PrepareAssetError<Self::SourceAsset>> {
|
||||
let key = tape.get_tape_key();
|
||||
|
||||
if let Some(previous) = previous_asset
|
||||
&& previous.key == key
|
||||
{
|
||||
return Ok(RenderTape {
|
||||
seed: tape.seed,
|
||||
subdivision: tape.subdivision,
|
||||
time: tape.time,
|
||||
key,
|
||||
enable_gen: previous.enable_gen.clone(),
|
||||
fuzz: previous.fuzz.clone(),
|
||||
normals: previous.normals.clone(),
|
||||
spatial_texture: previous.spatial_texture.clone(),
|
||||
trace: previous.trace.clone(),
|
||||
enable_gen_pipeline: previous.enable_gen_pipeline,
|
||||
fuzz_pipeline: previous.fuzz_pipeline,
|
||||
spatial_texture_pipeline: previous.spatial_texture_pipeline,
|
||||
});
|
||||
}
|
||||
|
||||
let enable_gen = asset_server.add(tape.sdf_specialize_module_with_key(
|
||||
key,
|
||||
replacement_modules.enable_gen.clone(),
|
||||
@@ -286,6 +307,8 @@ impl RenderAsset for RenderTape {
|
||||
Ok(RenderTape {
|
||||
seed: tape.seed,
|
||||
subdivision: tape.subdivision,
|
||||
time: tape.time,
|
||||
key,
|
||||
enable_gen,
|
||||
fuzz,
|
||||
normals,
|
||||
|
||||
Reference in New Issue
Block a user