DOR7S6M2PZ5FQ7TFGWIK7FUFUZENXKU4G42I5HQITODPBBEJB4YQC
MMCK5BQQST5NDI5R3VLY7ICBGNARTYG2FKKRPRIXQHXXGH2QO3PQC
6YVIIRYC6FQP7ET7AMJHG4XCIDI4KIJMOKUDAUMVBLYFEULRDQEAC
7CBRRVV3GLVLBHNPQNRHSA2ZCLHIMCHFEMWMZNOICY2OZLB7DGPAC
D3ZVFWMFDQ7WOGHZ7WBODJPUDVQQ6X4Q2FHHFLOQEQOEMSGP5W3AC
L5SVCVPJMJPDARA4H43U5INQMAKHUIB5PUP55IDRKAPQDB35MXZQC
GHIHJCWBCGFZI4AG66L7WG4WKJ467DXFBRBNLT4ZULSN7ZVBJI6AC
L6RIUKGLJZLAOKFGUDTZKBPP4HUBPEZAKHJEQHO34WFF62AB2ZIQC
TYNRXPBJZM6GLDBYVMFJS6NVWX7MFRQSHHDOEM6I7EG5CG6UIBKQC
Y4JIGMJIDT3RS23FHKHYW2YMSW5OSVXCRHFXRQ33RHQFQIRJAKHQC
KID2E3YKLHUFPHWYYGRQZTX73THWMAXQWPT5XZEJJO46BCQD27HQC
X5EMQBC4BFNJOOHS2QMF4UB4QH6JKSALK6RXLK6B7SP6MNYSAP6QC
MT6IBX7SGLE26XIFZY53WYNHSJZMSDVDRJP3VYPXIQ4DKY75XVXAC
4RVKY4GPSLJ354NLVZDZFB7UFRMOTIC22NQIHYPEU6FKYLKBN75QC
let view = self.transform;
let proj = glam::Affine3A::from_scale(glam::Vec3::new(
0.5 / WORLD_HALF_EXTENTS.x as f32,
0.5 / WORLD_HALF_EXTENTS.y as f32,
1.0,
)) * glam::Affine3A::from_translation(WORLD_HALF_EXTENTS.as_vec2().extend(0.0))
* glam::Affine3A::from_scale(glam::Vec3::new(self.width, self.height, 1.0));
let view = glam::Affine3A::look_to_lh(
glam::Vec3::new(-0.5, -0.5, 0.0),
glam::Vec3::Z,
glam::Vec3::Y,
) * glam::Affine3A::from_translation(self.transform.translation.into());
(view * proj).into()
// Why does this work? rn i haven't the foggiest
let rotation = glam::Affine3A::from_mat3_translation(
self.transform.matrix3.into(),
glam::Vec3::new(
(self.transform.translation.x * self.width + self.width * 0.25)
/ WORLD_HALF_EXTENTS.x as f32,
(self.transform.translation.y * self.height + self.height * 0.25)
/ WORLD_HALF_EXTENTS.y as f32,
0.0,
),
) * glam::Affine3A::from_translation(glam::Vec3::new(
-(self.transform.translation.x * self.width + self.width * 0.25)
/ WORLD_HALF_EXTENTS.x as f32,
-(self.transform.translation.y * self.height + self.height * 0.25)
/ WORLD_HALF_EXTENTS.y as f32,
0.0,
));
let proj = glam::Mat4::orthographic_lh(
-1.0 * WORLD_HALF_EXTENTS.x as f32,
WORLD_HALF_EXTENTS.x as f32,
-1.0 * WORLD_HALF_EXTENTS.y as f32,
WORLD_HALF_EXTENTS.y as f32,
0.0,
100.0,
);
let display_to_texture =
glam::Affine3A::from_scale(glam::Vec3::new(self.width * 0.5, self.height * 0.5, 1.0));
view * rotation * proj * display_to_texture
game.camera.transform.translation.x -=
if negative { -1.0 } else { 1.0 } * dt.as_secs_f32() * 0.0025;
if self.voop.contains("rot") {
game.camera.transform *= glam::Affine3A::from_axis_angle(
glam::Vec3::Z,
negativity * std::f32::consts::FRAC_PI_4 * dt_secs,
);
} else {
game.camera.transform.translation.x -= negativity * dt_secs * 0.0025;
}
[dev-dependencies]
approx = "0.5.1"