Struct turbine_scene3d::Scene
source · [−]pub struct Scene {
pub settings: SceneSettings,
pub projection: Matrix4<f32>,
pub camera: Matrix4<f32>,
pub model: Matrix4<f32>,
/* private fields */
}
Expand description
Stores scene data.
Fields
settings: SceneSettings
Scene settings.
projection: Matrix4<f32>
Projection transform.
camera: Matrix4<f32>
Camera transform.
model: Matrix4<f32>
Model transform.
Implementations
sourceimpl Scene
impl Scene
sourcepub fn new(settings: SceneSettings) -> Scene
pub fn new(settings: SceneSettings) -> Scene
Create new scene.
sourcepub fn projection(&mut self, p: Matrix4<f32>)
pub fn projection(&mut self, p: Matrix4<f32>)
Set projection matrix.
sourcepub fn load_texture<P: AsRef<Path>>(
&mut self,
path: P
) -> Result<Texture, ImageError>
pub fn load_texture<P: AsRef<Path>>(
&mut self,
path: P
) -> Result<Texture, ImageError>
Load texture from path.
sourcepub fn vertex_shader(
&mut self,
vertex_shader_src: &str
) -> Result<VertexShader, String>
pub fn vertex_shader(
&mut self,
vertex_shader_src: &str
) -> Result<VertexShader, String>
Create vertex shader from source.
sourcepub fn fragment_shader(
&mut self,
fragment_shader_src: &str
) -> Result<FragmentShader, String>
pub fn fragment_shader(
&mut self,
fragment_shader_src: &str
) -> Result<FragmentShader, String>
Create fragment shader from source.
sourcepub fn program_from_vertex_fragment(
&mut self,
vertex_shader: VertexShader,
fragment_shader: FragmentShader
) -> Program
pub fn program_from_vertex_fragment(
&mut self,
vertex_shader: VertexShader,
fragment_shader: FragmentShader
) -> Program
Create program from vertex and fragment shader.
sourcepub fn matrix4_uniform(
&mut self,
program: Program,
name: &str
) -> Result<Matrix4Uniform, String>
pub fn matrix4_uniform(
&mut self,
program: Program,
name: &str
) -> Result<Matrix4Uniform, String>
Create 4D matrix uniform.
sourcepub fn vector2_uniform(
&mut self,
program: Program,
name: &str
) -> Result<Vector2Uniform, String>
pub fn vector2_uniform(
&mut self,
program: Program,
name: &str
) -> Result<Vector2Uniform, String>
Create 2D vector uniform.
sourcepub fn vector3_uniform(
&mut self,
program: Program,
name: &str
) -> Result<Vector3Uniform, String>
pub fn vector3_uniform(
&mut self,
program: Program,
name: &str
) -> Result<Vector3Uniform, String>
Create 3D vector uniform.
sourcepub fn f32_uniform(
&mut self,
program: Program,
name: &str
) -> Result<F32Uniform, String>
pub fn f32_uniform(
&mut self,
program: Program,
name: &str
) -> Result<F32Uniform, String>
Create f32 uniform.
sourcepub fn vertex_array(&mut self) -> VertexArray
pub fn vertex_array(&mut self) -> VertexArray
Create vertex array.
sourcepub fn uv_buffer(
&mut self,
vertex_array: VertexArray,
attribute: u32,
data: &[f32]
) -> UVBuffer
pub fn uv_buffer(
&mut self,
vertex_array: VertexArray,
attribute: u32,
data: &[f32]
) -> UVBuffer
Create uv buffer.
sourcepub fn color_buffer(
&mut self,
vertex_array: VertexArray,
attribute: u32,
data: &[f32]
) -> ColorBuffer
pub fn color_buffer(
&mut self,
vertex_array: VertexArray,
attribute: u32,
data: &[f32]
) -> ColorBuffer
Create color buffer.
sourcepub fn vertex_buffer2(
&mut self,
vertex_array: VertexArray,
attribute: u32,
data: &[f32]
) -> VertexBuffer2
pub fn vertex_buffer2(
&mut self,
vertex_array: VertexArray,
attribute: u32,
data: &[f32]
) -> VertexBuffer2
Create vertex buffer for 2D coordinates.
sourcepub fn vertex_buffer3(
&mut self,
vertex_array: VertexArray,
attribute: u32,
data: &[f32]
) -> VertexBuffer3
pub fn vertex_buffer3(
&mut self,
vertex_array: VertexArray,
attribute: u32,
data: &[f32]
) -> VertexBuffer3
Create vertex buffer for 3D coordinates.
sourcepub fn normal_buffer(
&mut self,
vertex_array: VertexArray,
attribute: u32,
data: &[f32]
) -> NormalBuffer
pub fn normal_buffer(
&mut self,
vertex_array: VertexArray,
attribute: u32,
data: &[f32]
) -> NormalBuffer
Create normal buffer.
sourcepub fn use_program(&self, program: Program)
pub fn use_program(&self, program: Program)
Use program.
sourcepub fn set_model_view_projection(&self, matrix_id: Matrix4Uniform)
pub fn set_model_view_projection(&self, matrix_id: Matrix4Uniform)
Set model-view-projection transform uniform.
sourcepub fn set_view(&self, matrix_id: Matrix4Uniform)
pub fn set_view(&self, matrix_id: Matrix4Uniform)
Set view transform uniform.
sourcepub fn set_model(&self, matrix_id: Matrix4Uniform)
pub fn set_model(&self, matrix_id: Matrix4Uniform)
Set model transform uniform.
sourcepub fn set_matrix4(&self, matrix_id: Matrix4Uniform, val: Matrix4<f32>)
pub fn set_matrix4(&self, matrix_id: Matrix4Uniform, val: Matrix4<f32>)
Set matrix uniform.
sourcepub fn set_vector2(&self, v_id: Vector2Uniform, v: Vector2<f32>)
pub fn set_vector2(&self, v_id: Vector2Uniform, v: Vector2<f32>)
Set 2D vector uniform.
sourcepub fn set_vector3(&self, v_id: Vector3Uniform, v: Vector3<f32>)
pub fn set_vector3(&self, v_id: Vector3Uniform, v: Vector3<f32>)
Set 3D vector uniform.
sourcepub fn set_f32(&self, f_id: F32Uniform, v: f32)
pub fn set_f32(&self, f_id: F32Uniform, v: f32)
Set f32 uniform.
sourcepub fn set_texture(&self, texture_id: Texture)
pub fn set_texture(&self, texture_id: Texture)
Set texture.
sourcepub fn translate_global(&mut self, v: Vector3<f32>)
pub fn translate_global(&mut self, v: Vector3<f32>)
Translate model in global coordinates.
sourcepub fn rotate_x_deg(&mut self, deg: f32)
pub fn rotate_x_deg(&mut self, deg: f32)
Rotate model around x axis with degrees.
sourcepub fn rotate_y_deg(&mut self, deg: f32)
pub fn rotate_y_deg(&mut self, deg: f32)
Rotate model around y axis with degrees.
sourcepub fn rotate_z_deg(&mut self, deg: f32)
pub fn rotate_z_deg(&mut self, deg: f32)
Rotate model around z axis with degrees.
sourcepub fn rotate_axis_deg(&mut self, axis: Vector3<f32>, deg: f32)
pub fn rotate_axis_deg(&mut self, axis: Vector3<f32>, deg: f32)
Rotate model around axis with degrees.
sourcepub fn push_transform(&mut self)
pub fn push_transform(&mut self)
Push model transfrom to transform stack.
sourcepub fn pop_transform(&mut self)
pub fn pop_transform(&mut self)
Pop model transform from transform stack.
sourcepub fn enable_framebuffer_srgb(&self)
pub fn enable_framebuffer_srgb(&self)
Enable framebuffer sRGB.
sourcepub fn disable_framebuffer_srgb(&self)
pub fn disable_framebuffer_srgb(&self)
Disable framebuffer sRGB.
sourcepub fn enable_blend(&self)
pub fn enable_blend(&self)
Enable blend.
sourcepub fn disable_blend(&self)
pub fn disable_blend(&self)
Disable blend.
sourcepub fn enable_cull_face(&self)
pub fn enable_cull_face(&self)
Enable cull face.
sourcepub fn disable_cull_face(&self)
pub fn disable_cull_face(&self)
Disable cull face.
sourcepub fn cull_face_front(&self)
pub fn cull_face_front(&self)
Cull front face.
sourcepub fn cull_face_back(&self)
pub fn cull_face_back(&self)
Cull back face.
sourcepub fn cull_face_front_and_back(&self)
pub fn cull_face_front_and_back(&self)
Cull both front and back face.
sourcepub fn draw_triangles(&self, vertex_array: VertexArray, len: usize)
pub fn draw_triangles(&self, vertex_array: VertexArray, len: usize)
Draws triangles.
sourcepub fn draw_triangle_strip(&self, vertex_array: VertexArray, len: usize)
pub fn draw_triangle_strip(&self, vertex_array: VertexArray, len: usize)
Draws triangle strip.
sourcepub fn draw_points(&self, vertex_array: VertexArray, len: usize)
pub fn draw_points(&self, vertex_array: VertexArray, len: usize)
Draws points.
sourcepub fn draw_lines(&self, vertex_array: VertexArray, len: usize)
pub fn draw_lines(&self, vertex_array: VertexArray, len: usize)
Draws lines.
sourcepub fn submit(&mut self, commands: &[Command], frame_graph: &FrameGraph)
pub fn submit(&mut self, commands: &[Command], frame_graph: &FrameGraph)
Executes commands in command list.
sourcepub fn draw(&mut self, command_list: CommandList, frame_graph: &FrameGraph)
pub fn draw(&mut self, command_list: CommandList, frame_graph: &FrameGraph)
Draws a command list from frame graph.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Scene
impl Send for Scene
impl Sync for Scene
impl Unpin for Scene
impl UnwindSafe for Scene
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more