pub struct Uniform<ProgramId: Id, UniformId: Id> { /* private fields */ }Expand description
Contains the build information for a WebGL uniform.
A Uniform can be associated with any number of programs,
and can be updated with crate::RendererData::update_uniform or
crate::RendererData::update_uniforms.
Implementations§
Source§impl<ProgramId: Id, UniformId: Id> Uniform<ProgramId, UniformId>
impl<ProgramId: Id, UniformId: Id> Uniform<ProgramId, UniformId>
Sourcepub fn program_ids(&self) -> &Vec<ProgramId>
pub fn program_ids(&self) -> &Vec<ProgramId>
Gets all program ids associated with this uniform
Sourcepub fn uniform_id(&self) -> &UniformId
pub fn uniform_id(&self) -> &UniformId
Gets this uniform’s uniform id
Sourcepub fn uniform_locations(&self) -> &HashMap<ProgramId, WebGlUniformLocation>
pub fn uniform_locations(&self) -> &HashMap<ProgramId, WebGlUniformLocation>
Gets this uniform’s location for all associated program ids
Sourcepub fn initialize_callback(&self) -> UniformCreateUpdateCallback
pub fn initialize_callback(&self) -> UniformCreateUpdateCallback
Gets the callback that is used to initialize this uniform
Sourcepub fn should_update_callback(&self) -> Option<UniformShouldUpdateCallback>
pub fn should_update_callback(&self) -> Option<UniformShouldUpdateCallback>
Gets the callback that is used to determine whether this uniform should update when crate::RendererData::update_uniform or crate::RendererData::update_uniforms is called.
Sourcepub fn update_callback(&self) -> Option<UniformCreateUpdateCallback>
pub fn update_callback(&self) -> Option<UniformCreateUpdateCallback>
Gets the callback that is used to updated this uniform whenever crate::RendererData::update_uniform or crate::RendererData::update_uniforms is called.
Sourcepub fn use_init_callback_for_update(&self) -> bool
pub fn use_init_callback_for_update(&self) -> bool
If set to true, Uniform will use the Uniform::initialize_callback callback
to update when crate::RendererData::update_uniform or crate::RendererData::update_uniforms is called
rather than the Uniform::update_callback
Sourcepub fn update(
&self,
gl: &WebGl2RenderingContext,
now: f64,
programs: &HashMap<ProgramId, WebGlProgram>,
)
pub fn update( &self, gl: &WebGl2RenderingContext, now: f64, programs: &HashMap<ProgramId, WebGlProgram>, )
Updates the value of this uniform in WebGl for every Program where this uniform is used, using the update callback that was passed in at creation time.
@todo: calling this function for anything more than the current program is useless without a UBO