93 void *
operator new(
size_t nSize);
102 void operator delete(
void *pBlock);
539 void AcquireTargetTex();
549 void ReleaseTargetTex();
559 unsigned char mReserved30c[0x04];
564 const float flX = pXfm[0].
x * in.
x + pXfm[1].
x * in.
y + pXfm[2].
x * in.
z + pXfm[3].
x;
565 const float flY = pXfm[0].
y * in.
x + pXfm[1].
y * in.
y + pXfm[2].
y * in.
z + pXfm[3].
y;
566 const float flZ = pXfm[0].
z * in.
x + pXfm[1].
z * in.
y + pXfm[2].
z * in.
z + pXfm[3].
z;
567 const float flW = in.
w;
579 if (ptProjected.
z != 0.0f) {
580 const float flInvDepth = 1.0f / ptProjected.
z;
581 ptNdc.
x = ptProjected.
x * flInvDepth;
582 ptNdc.
y = ptProjected.
y * flInvDepth;
Six-plane view volume.
Definition frustum.h:19
Heap-allocated NUL-terminated string.
Definition hxstr.h:41
Camera.
Definition cam.h:53
void SetTargetTex(Tex *pTex)
Set the texture this camera draws into, or none to draw into the frame buffer.
virtual void FindCollisions(const Vector2 &point, std::list< Collision > &collisions)
Report whether a screen point lies inside the screen rectangle.
float mNearPlane
Definition cam.h:475
virtual ~Cam()
Clear Cam::sCurrent when it addresses this camera and release the render target.
static Cam *(* sNew)(const HxStr &name)
Creator the registered "Cam" class builds through.
Definition cam.h:75
virtual void Load(Stream &stream)
Read this camera's serialised form from stream.
static Cam * sCurrent
Camera the frame is being drawn through.
Definition cam.h:64
Segment ScreenToRay(const Vector2 &ptScreen, float flLength)
Build the segment under a point of the screen rectangle.
static Cam * NewCam(const HxStr &name)
Build a camera the class registry vends.
Vector3 UnprojectFar(const Vector2 &ptUnit)
Carry a point of the unit square of the projected image onto the far side of the projection.
virtual void Save(Stream &stream)
Write this camera's serialised form to stream.
virtual void Copy(const Object *pSource, unsigned nFlags)
Copy the state of pSource into this camera.
Vector3 mLocalProject[kXfmRowCount]
Projection from camera space onto the screen rectangle.
Definition cam.h:445
float GetFov() const
Report the field of view, zero for an orthographic projection.
Definition cam.h:280
Cam(const HxStr &name)
Construct a camera with the default projection.
Frustum mLocalFrustum
Definition cam.h:463
float GetFarPlane() const
Report the far clip distance.
Definition cam.h:267
virtual void DumpText(Dbg &sink)
Write a description of this camera to sink.
Vector3 mWorldProject[kXfmRowCount]
mWorldToCam followed by mLocalProject.
Definition cam.h:454
virtual void UpdateTargetAspect()
Take the aspect ratio from the render target and rebuild the projection.
void SetFrustum(float flNear, float flFar, float flFov)
Set the clip distances and the field of view, then rebuild the projection.
Vector2 ProjectToUnit(const Vector3 &pt)
Place a world point in the unit square of the projected image.
Definition cam.h:575
void UpdateWorldProject()
Compose the world projection, its inverse, and the world frustum.
Tex * mpTargetTex
Texture this camera draws into, or null to draw into the frame buffer.
Definition cam.h:501
virtual const HxStr & ClassName() const
Report the class key a .rnd file writes for a camera.
Vector3 mWorldToCam[kXfmRowCount]
Inverse of the world transform, which maps world space into camera space.
Definition cam.h:442
virtual int UpdateWorldXfm(Transformable *pParent, int nForce)
Recompose the world transform and, when it changed, the world projection.
Frustum mWorldFrustum
The view volume in world space.
Definition cam.h:472
float mFarPlane
Definition cam.h:476
virtual int DrawShowing()
Make this camera the one the frame is drawn through.
static HxStr sClassName
Registered class name of Rnd::Cam, the string "Cam".
Definition cam.h:83
virtual Vector2 ScreenToPixels(const Vector2 &ptScreen)
Place a point of the screen rectangle in render target pixels.
float mYRatio
Definition cam.h:481
float GetNearPlane() const
Report the near clip distance.
Definition cam.h:254
float mFov
Definition cam.h:477
virtual void Replace(Object *pFrom, Object *pTo)
Repoint the render target when the object it addressed is replaced.
Rect mScreenRect
Fraction of the render target the projected image is placed in.
Definition cam.h:493
Vector2 mZRange
Definition cam.h:485
void UpdateProjection()
Build the local frustum and both local projection matrices.
Vector3 mInvWorldProject[kXfmRowCount]
mInvLocalProject followed by the world transform.
Definition cam.h:457
void SetScreenRect(const Rect &rect)
Replace mScreenRect and rebuild the projection.
Collideable()
Construct a collideable with no children.
Sink that the engine formats its diagnostic and failure text into.
Definition dbg.h:33
Drawable()
Construct a visible drawable with no children.
Base of every object the renderer can load, resolve by name, and serialise.
Definition object.h:43
Byte stream that every renderer object serialises itself through.
Definition stream.h:31
Texture, as a bitmap path plus the load state of its mip levels.
Definition tex.h:43
The rendering engine.
Definition animhelper.h:3
constexpr int kXfmRowCount
Rows in one transform.
Definition transformable.h:12
void RegisterCamClass()
Point Cam::sNew at Cam::NewCam(), clear Cam::sCurrent, and register the "Cam" class with Rnd::Manager...
Definition cam.h:631
Object * CreateRegisteredCam(const HxStr &name)
Build a camera for the registered "Cam" class.
Cam * NewCamThroughHook(const HxStr &name)
Build a camera through Cam::sNew, without the narrowing CreateRegisteredCam() performs.
Manager TheManager
The renderer's object registry.
void Multiply(const Vector2 &v, float flScale, Vector2 &out)
Scale a two-component vector.
void Add(const Vector2 &a, const Vector2 &b, Vector2 &out)
Add two two-component vectors.
Rectangle the projected image is placed in.
Definition cam.h:113
float x
Definition cam.h:114
float w
Definition cam.h:116
float y
Definition cam.h:115
float h
Definition cam.h:117
Line segment a collision query is run along.
Definition collideable.h:22
Two-component vector, used for texture coordinates.
Definition vector2.h:10
float x
Definition vector2.h:11
float y
Definition vector2.h:12
Three-component vector, padded to a PlayStation 2 quadword.
Definition vector3.h:12
float w
Definition vector3.h:16
float x
Definition vector3.h:13
float y
Definition vector3.h:14
float z
Definition vector3.h:15