Implement Vector4, Vector4i, Projection
Implement built-in classes Vector4, Vector4i and Projection. * Two versions of Vector4 (float and integer). * A Projection class, which is a 4x4 matrix specialized in projection types. These types have been requested for a long time, but given they were very corner case they were not added before. Because in Godot 4, reimplementing parts of the rendering engine is now possible, access to these types (heavily used by the rendering code) becomes a necessity. **Q**: Why Projection and not Matrix4? **A**: Godot does not use Matrix2, Matrix3, Matrix4x3, etc. naming convention because, within the engine, these types always have a *purpose*. As such, Godot names them: Transform2D, Transform3D or Basis. In this case, this 4x4 matrix is _always_ used as a _Projection_, hence the naming.
This commit is contained in:
parent
fe929d4787
commit
455c06ecd4
123 changed files with 4139 additions and 594 deletions
|
|
@ -258,12 +258,12 @@ Transform3D XRInterfaceExtension::get_transform_for_view(uint32_t p_view, const
|
|||
return Transform3D();
|
||||
}
|
||||
|
||||
CameraMatrix XRInterfaceExtension::get_projection_for_view(uint32_t p_view, double p_aspect, double p_z_near, double p_z_far) {
|
||||
CameraMatrix cm;
|
||||
Projection XRInterfaceExtension::get_projection_for_view(uint32_t p_view, double p_aspect, double p_z_near, double p_z_far) {
|
||||
Projection cm;
|
||||
PackedFloat64Array arr;
|
||||
|
||||
if (GDVIRTUAL_CALL(_get_projection_for_view, p_view, p_aspect, p_z_near, p_z_far, arr)) {
|
||||
ERR_FAIL_COND_V_MSG(arr.size() != 16, CameraMatrix(), "Projection matrix must contain 16 floats");
|
||||
ERR_FAIL_COND_V_MSG(arr.size() != 16, Projection(), "Projection matrix must contain 16 floats");
|
||||
real_t *m = (real_t *)cm.matrix;
|
||||
for (int i = 0; i < 16; i++) {
|
||||
m[i] = arr[i];
|
||||
|
|
@ -271,7 +271,7 @@ CameraMatrix XRInterfaceExtension::get_projection_for_view(uint32_t p_view, doub
|
|||
return cm;
|
||||
}
|
||||
|
||||
return CameraMatrix();
|
||||
return Projection();
|
||||
}
|
||||
|
||||
RID XRInterfaceExtension::get_vrs_texture() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue