pub mod argument;
pub mod config;
use super::AssetTrait;
use argument::{Argument, variables::VariablesCount};
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
#[serde(default)]
pub struct Animation {
pub shader_code: String,
pub arguments: Vec<Argument>,
}
impl Default for Animation {
fn default() -> Self {
Self {
shader_code: include_str!("black.wgsl").to_string(),
arguments: Default::default(),
}
}
}
impl Animation {
pub fn shader_code_for_getters(&self) -> String {
let mut count = VariablesCount::default();
let mut code = String::new();
for argument in self.arguments.iter() {
code += &argument.shader_code_for_getter(count);
count += argument.kind.variables().count();
}
code
}
}
impl AssetTrait for Animation {
const DIR_NAME: &'static str = "animations";
const NAME: &'static str = "Animation";
const SHOW_NAME_IF_SELECTED: bool = true;
}