RendererDataBuilderJs

Struct RendererDataBuilderJs 

Source
pub struct RendererDataBuilderJs(/* private fields */);
Expand description

Implementations§

Source§

impl RendererDataBuilderJs

Source

pub fn texture(&self, texture_id: String) -> Option<TextureJs>

Source

pub fn set_canvas(&mut self, canvas: HtmlCanvasElement)

Source

pub fn add_fragment_shader_src( &mut self, id: String, fragment_shader_src: String, )

Source

pub fn add_vertex_shader_src(&mut self, id: String, vertex_shader_src: String)

Source

pub fn set_render_callback(&mut self, render_callback: RenderCallbackJs)

Source

pub fn set_user_ctx(&mut self, ctx: Object)

Source

pub fn set_get_context_callback(&mut self, get_context_callback: Function)

Source

pub fn build_renderer_data(self) -> Result<RendererDataJs, String>

Source

pub fn build_renderer(self) -> Result<RendererJs, String>

Methods from Deref<Target = RendererDataBuilder<String, String, String, String, String, String, String, String, String, String, Object>>§

Source

pub fn texture(&self, texture_id: &TextureId) -> Option<&Texture<TextureId>>

This is the only internal storage available publicly from the builder, because it is necessary to use it during the build process for framebuffers.

Source

pub fn set_canvas(&mut self, canvas: HtmlCanvasElement) -> &mut Self

Save the canvas that will be rendered to and get its associated WebGL2 rendering context

Source

pub fn add_fragment_shader_src( &mut self, id: FragmentShaderId, fragment_shader_src: impl Into<String>, ) -> &mut Self

Saves a fragment shader source and its corresponding id

Source

pub fn add_vertex_shader_src( &mut self, id: VertexShaderId, vertex_shader_src: impl Into<String>, ) -> &mut Self

Saves a vertex shader source and its corresponding id

Saves a link between a vertex shader id and a fragment shader id.

During the RendererData build process, this program_link is used to link a new WebGL2 program together by associating the vertex shader id and the fragment shader id with their corresponding compiled shaders.

Source

pub fn set_render_callback( &mut self, render_callback: impl Into<RenderCallback<VertexShaderId, FragmentShaderId, ProgramId, UniformId, BufferId, AttributeId, TextureId, FramebufferId, TransformFeedbackId, VertexArrayObjectId, UserCtx>>, ) -> &mut Self

Save a callback that will be called each time it is time to render a new frame

Source

pub fn set_user_ctx(&mut self, ctx: impl Into<UserCtx>) -> &mut Self

Save as arbitrary user context that can be accessed from within the render callback

This can include stateful data and anything else that might be necessary to access while performing a render.

Saves a link that will be used to build a uniform at build time.

I.e. once all WebGL shaders are compiled and all programs are linked, all uniforms will be found within their associated programs, and will be saved with their associated update functions.

Saves a link that will be used to build a WebGL buffer at build time.

Saves a link that will be used to build a a WebGL attribute at build time.

Saves a link that will be used to build a buffer/attribute pair at build time.

Saves a link that will be used to build a framebuffer at build time

Saves a link that will be used to build a transformFeedback at build time

Saves an id that will be used to create a VAO at build time

This VAO can then be referenced by AttributeLinks

Source

pub fn set_get_context_callback( &mut self, get_context_callback: impl Into<GetContextCallback>, ) -> &mut Self

Trait Implementations§

Source§

impl Default for RendererDataBuilderJs

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Deref for RendererDataBuilderJs

Source§

type Target = RendererDataBuilder<String, String, String, String, String, String, String, String, String, String, Object>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl DerefMut for RendererDataBuilderJs

Source§

fn deref_mut( &mut self, ) -> &mut RendererDataBuilder<String, String, String, String, String, String, String, String, String, String, Object>

Mutably dereferences the value.
Source§

impl From<RendererDataBuilderJs> for JsValue

Source§

fn from(value: RendererDataBuilderJs) -> Self

Converts to this type from the input type.
Source§

impl FromWasmAbi for RendererDataBuilderJs

Source§

type Abi = u32

The Wasm ABI type that this converts from when coming back out from the ABI boundary.
Source§

unsafe fn from_abi(js: u32) -> Self

Recover a Self from Self::Abi. Read more
Source§

impl IntoWasmAbi for RendererDataBuilderJs

Source§

type Abi = u32

The Wasm ABI type that this converts into when crossing the ABI boundary.
Source§

fn into_abi(self) -> u32

Convert self into Self::Abi so that it can be sent across the wasm ABI boundary.
Source§

impl LongRefFromWasmAbi for RendererDataBuilderJs

Source§

type Abi = u32

Same as RefFromWasmAbi::Abi
Source§

type Anchor = RcRef<RendererDataBuilderJs>

Same as RefFromWasmAbi::Anchor
Source§

unsafe fn long_ref_from_abi(js: Self::Abi) -> Self::Anchor

Same as RefFromWasmAbi::ref_from_abi
Source§

impl OptionFromWasmAbi for RendererDataBuilderJs

Source§

fn is_none(abi: &Self::Abi) -> bool

Tests whether the argument is a “none” instance. If so it will be deserialized as None, and otherwise it will be passed to FromWasmAbi.
Source§

impl OptionIntoWasmAbi for RendererDataBuilderJs

Source§

fn none() -> Self::Abi

Returns an ABI instance indicating “none”, which JS will interpret as the None branch of this option. Read more
Source§

impl RefFromWasmAbi for RendererDataBuilderJs

Source§

type Abi = u32

The Wasm ABI type references to Self are recovered from.
Source§

type Anchor = RcRef<RendererDataBuilderJs>

The type that holds the reference to Self for the duration of the invocation of the function that has an &Self parameter. This is required to ensure that the lifetimes don’t persist beyond one function call, and so that they remain anonymous.
Source§

unsafe fn ref_from_abi(js: Self::Abi) -> Self::Anchor

Recover a Self::Anchor from Self::Abi. Read more
Source§

impl RefMutFromWasmAbi for RendererDataBuilderJs

Source§

type Abi = u32

Same as RefFromWasmAbi::Abi
Source§

type Anchor = RcRefMut<RendererDataBuilderJs>

Same as RefFromWasmAbi::Anchor
Source§

unsafe fn ref_mut_from_abi(js: Self::Abi) -> Self::Anchor

Same as RefFromWasmAbi::ref_from_abi
Source§

impl TryFromJsValue for RendererDataBuilderJs

Source§

type Error = JsValue

The type returned in the event of a conversion error.
Source§

fn try_from_js_value(value: JsValue) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl VectorFromWasmAbi for RendererDataBuilderJs

Source§

impl VectorIntoWasmAbi for RendererDataBuilderJs

Source§

impl WasmDescribe for RendererDataBuilderJs

Source§

impl WasmDescribeVector for RendererDataBuilderJs

Source§

impl SupportsConstructor for RendererDataBuilderJs

Source§

impl SupportsInstanceProperty for RendererDataBuilderJs

Source§

impl SupportsStaticProperty for RendererDataBuilderJs

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> ReturnWasmAbi for T
where T: IntoWasmAbi,

Source§

type Abi = <T as IntoWasmAbi>::Abi

Same as IntoWasmAbi::Abi
Source§

fn return_abi(self) -> <T as ReturnWasmAbi>::Abi

Same as IntoWasmAbi::into_abi, except that it may throw and never return in the case of Err.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.