From e0071b41d4098ae16ec8ca8f874b8334b044f081 Mon Sep 17 00:00:00 2001 From: Alex Goot <18817313320@163.com> Date: Mon, 17 Jun 2024 21:21:43 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=A5=E5=85=A8=E7=9C=81=E7=95=A5=E9=83=A8?= =?UTF-8?q?=E5=88=86,=20=E4=BB=8E=E5=9F=BA=E7=A1=80=E7=9B=B8=E6=9C=BA?= =?UTF-8?q?=E9=83=A8=E5=88=86=E7=9B=B4=E6=8E=A5=E8=B7=B3=E8=BF=87=E6=9D=A5?= =?UTF-8?q?=E7=9C=8B=E6=97=B6=E6=9B=B4=E5=A5=BD=E5=8F=91=E7=8E=B0CameraUni?= =?UTF-8?q?form=E7=9A=84=E7=BB=93=E6=9E=84=E5=8F=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/intermediate/tutorial12-camera/index.md | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) 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) {