diff --git a/docs/intermediate/tutorial12-camera/index.md b/docs/intermediate/tutorial12-camera/index.md index 2cdeda35b..fbe5b3907 100644 --- a/docs/intermediate/tutorial12-camera/index.md +++ b/docs/intermediate/tutorial12-camera/index.md @@ -239,8 +239,19 @@ mod camera; // 新增! ```rust +struct CameraUniform { + view_position: [f32; 4], + view_proj: [[f32; 4]; 4], +} + impl CameraUniform { - // ... + + fn new() -> Self { + Self { + view_position: [0.0; 4], + view_proj: glam::Mat4::IDENTITY.to_cols_array_2d(), + } + } // 更新! fn update_view_proj(&mut self, camera: &camera::Camera, projection: &camera::Projection) {