|
1 | 1 | //! Custom materials - shaders, uniforms. |
2 | 2 |
|
3 | 3 | use crate::{get_context, quad_gl::GlPipeline, texture::Texture2D, tobytes::ToBytes, Error}; |
4 | | -use miniquad::{PipelineParams, UniformDesc, UniformType}; |
| 4 | +use miniquad::{PipelineParams, UniformDesc}; |
5 | 5 | use std::sync::Arc; |
6 | 6 |
|
7 | 7 | #[derive(PartialEq)] |
@@ -54,39 +54,17 @@ pub struct MaterialParams { |
54 | 54 | pub pipeline_params: PipelineParams, |
55 | 55 |
|
56 | 56 | /// List of custom uniforms used in this material |
57 | | - pub uniforms: Vec<(String, UniformType)>, |
| 57 | + pub uniforms: Vec<UniformDesc>, |
58 | 58 |
|
59 | 59 | /// List of textures used in this material |
60 | 60 | pub textures: Vec<String>, |
61 | 61 | } |
62 | 62 |
|
63 | | -impl Into<MaterialParams2> for MaterialParams { |
64 | | - fn into(self) -> MaterialParams2 { |
65 | | - MaterialParams2 { |
66 | | - pipeline_params: self.pipeline_params, |
67 | | - uniforms: self |
68 | | - .uniforms |
69 | | - .into_iter() |
70 | | - .map(|u| UniformDesc::new(&u.0, u.1)) |
71 | | - .collect(), |
72 | | - textures: self.textures, |
73 | | - } |
74 | | - } |
75 | | -} |
76 | | - |
77 | | -#[derive(Default)] |
78 | | -pub struct MaterialParams2 { |
79 | | - pub pipeline_params: PipelineParams, |
80 | | - pub uniforms: Vec<miniquad::UniformDesc>, |
81 | | - pub textures: Vec<String>, |
82 | | -} |
83 | | - |
84 | 63 | pub fn load_material( |
85 | 64 | shader: crate::ShaderSource, |
86 | | - params: impl Into<MaterialParams2>, |
| 65 | + params: MaterialParams, |
87 | 66 | ) -> Result<Material, Error> { |
88 | 67 | let context = &mut get_context(); |
89 | | - let params = params.into(); |
90 | 68 |
|
91 | 69 | let pipeline = context.gl.make_pipeline( |
92 | 70 | &mut *context.quad_context, |
|
0 commit comments