1
0

Add lens shift support for the camera and the perspective projection functions

As Blender docs describe it so nicely: Using lens shift is equivalent to rendering an image with a larger FOV and cropping it off-center.
This can be quite useful for architecture renderings, but I guess also has it's use in other situations.
Note: Didn't make the ICameraSceneNode functions pure virtual so users don't have to update their cameras for this
Also some change in serialization - same as in other places by now, do use existing values as defaults values when they are not found instead of resetting them to 0.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6565 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
cutealien
2023-10-19 16:04:43 +00:00
parent 567f8688e2
commit d4f6d8c17b
5 changed files with 65 additions and 27 deletions

View File

@@ -95,6 +95,9 @@ namespace scene
//! \return Field of view of the camera
virtual f32 getFOV() const IRR_OVERRIDE;
//! Get the horizontal and vertical lens/projection plane shift
virtual core::vector2df getLensShift() const IRR_OVERRIDE;
//! Sets the value of the near clipping plane. (default: 1.0f)
virtual void setNearValue(f32 zn) IRR_OVERRIDE;
@@ -107,6 +110,9 @@ namespace scene
//! Sets the field of view (Default: PI / 3.5f)
virtual void setFOV(f32 fovy) IRR_OVERRIDE;
//! Set the horizontal and vertical lens/projection plane shift
virtual void setLensShift(const core::vector2df& shift) IRR_OVERRIDE;
//! PreRender event
virtual void OnRegisterSceneNode() IRR_OVERRIDE;
@@ -162,6 +168,7 @@ namespace scene
f32 Aspect; // Aspect ratio.
f32 ZNear; // value of the near view-plane.
f32 ZFar; // Z-value of the far view-plane.
core::vector2df LensShift; // For rendering off-center
SViewFrustum ViewArea;
core::matrix4 Affector;