|
wavelength 1.0.0
|
Camera. More...
#include <rndcam.h>


Public Member Functions | |
| RndCam (const char *pszName) | |
| Construct a camera looking along y with a quarter-turn field of view, from 1 to 1000 units. | |
| ~RndCam () override | |
| Release the camera and stop drawing through it. | |
| void * | operator new (size_t nSize) |
| Allocate a camera, billed to the class name. | |
| void | operator delete (void *pBlock) |
| Release a camera. | |
| void | ListDrawObjects (std::list< RndObject * > &objects) override |
| Add the camera itself to a list. | |
| void | ListDrawables (std::list< RndDrawable * > &drawables) override |
| Make the camera current and add the drawables of the children to a list. | |
| int | DrawShowing () override |
| Make the camera current. | |
| int | UpdateWorldXfm (RndTransformable *pParent, int bForce) override |
| Recompute the world transform, and the world projection when it changed. | |
| void | Collide (const Vector2 &point, std::list< Collision > &collisions) override |
| Record the camera as struck when a screen point falls inside mScreenRect, then test the children. | |
| void | DumpText (PrnStream &stream) override |
| Write a description of the camera and its bases. | |
| void | Save (BinStream &stream) override |
| Write the camera and its bases. | |
| void | Replace (RndObject *pFrom, RndObject *pTo) override |
| Replace a referenced object with another. | |
| const char * | ClassName () const override |
| Report the class name. | |
| void | Copy (const RndObject *pSource, int nFlags) override |
| Copy another camera and its bases. | |
| void | Load (BinStream &stream) override |
| Read what Save() wrote, or an earlier version of it. | |
| void | WorldToScreen (const Vector3 &world, Vector2 &screen) const |
| Project a world point to a screen point through mWorldProject and mScreenRect. | |
| void | SetTargetTex (RndTex *pTex) |
| Render into a texture rather than the display, or stop. | |
| void | SetFrustum (float fNear, float fFar, float fFov) |
| Set the view volume. | |
| void | UpdateProjection () |
| Rebuild the local projection and the local view volume, then the world projection. | |
| void | UpdateWorldProject () |
| Rebuild the world projection and the world view volume from the world transform. | |
| float | GetFarPlane () const |
| float | GetFov () const |
| const Transform & | GetInvWorldXfm () const |
| const Transform & | GetLocalProject () const |
| float | GetNearPlane () const |
| const Transform & | GetOrthoWorldXfm () const |
| const Rect & | GetScreenRect () const |
| void | SetScreenRect (const Rect &rect) |
| RndTex * | GetTargetTex () const |
| const Frustum & | GetWorldFrustum () const |
| const Vector2 & | GetZRange () const |
| void | SetZRange (const Vector2 &range) |
| virtual void | Collide (const Segment &segment, std::list< Collision > &collisions) |
| Test a segment against the collideable and add what it strikes to a list. | |
| Public Member Functions inherited from RndDrawable | |
| RndDrawable () | |
| Construct a showing drawable without a highlight or children. | |
| ~RndDrawable () override | |
| Drop the references on the children. | |
| virtual void | SetShowing (int nShowing) |
| Set whether the drawable draws at all. | |
| virtual void | SetHighlight (int nHighlight) |
| Set whether the drawable draws with its highlight treatment. | |
| void | DumpText (PrnStream &stream) override |
| Write a description of the drawable. | |
| void | Save (BinStream &stream) override |
| Write the showing flag and the names of the children. | |
| void | Replace (RndObject *pFrom, RndObject *pTo) override |
| Replace a child with another object. | |
| void | Copy (const RndObject *pSource, int nFlags) override |
| Copy the showing flag, and the children when the flags request them. | |
| void | Load (BinStream &stream) override |
| Read what Save() wrote. | |
| RndDrawable * | Parent () |
| Find the drawable whose children include this one. | |
| void | Draw () |
| Draw the drawable and then its children, when it is showing. | |
| bool | AddDraw (RndDrawable *pDraw, RndDrawable *pBefore) |
| Add a child before another. | |
| void | RemoveDraw (RndDrawable *pDraw) |
| Remove a child. | |
| void | ClearDraws () |
| Remove every child. | |
| int | GetShowing () const |
| const std::list< RndDrawable * > & | GetDraws () const |
| Public Member Functions inherited from RndObject | |
| RndObject (const char *pszName) | |
| Construct an object and register it under a name. | |
| virtual | ~RndObject () |
| Notify every referrer, then erase the registration. | |
| void | SetName (const char *pszName) |
| Register the object under a different name. | |
| void | AddRef (RndObject *pReferrer) |
| Register an object as a store of a pointer to this one. | |
| void | RemoveRef (RndObject *pReferrer) |
| Drop the first registration AddRef() made for a referrer. | |
| const char * | GetName () const |
| const std::list< RndObject * > & | GetRefs () const |
| int | GetInternal () const |
| void | SetInternal (int nInternal) |
| Public Member Functions inherited from RndTransformable | |
| RndTransformable () | |
| Construct a transformable with identity transforms, no origin offset, and no billboard. | |
| ~RndTransformable () override | |
| Drop the references on the children. | |
| virtual void | SetBillboard (int nBillboard) |
| Set the billboard mode. | |
| void | DumpText (PrnStream &stream) override |
| Write a description of the transformable. | |
| void | Save (BinStream &stream) override |
| Write the transforms, the names of the children, the billboard mode, and the origin. | |
| void | Replace (RndObject *pFrom, RndObject *pTo) override |
| Replace a child with another object. | |
| void | Copy (const RndObject *pSource, int nFlags) override |
| Copy the transforms, the billboard mode, the origin, and the children when the flags request them. | |
| void | Load (BinStream &stream) override |
| Read what Save() wrote, or an earlier version of it. | |
| void | SetOrigin (const Vector3 &origin) |
| Set the point the world transform subtracts first when there is no billboard. | |
| RndTransformable * | Parent () |
| Find the transformable whose children include this object. | |
| bool | AddTrans (RndTransformable *pTrans) |
| Append a child and mark its world transform dirty. | |
| void | RemoveTrans (RndTransformable *pTrans) |
| Remove a child. | |
| void | ClearTrans () |
| Remove every child. | |
| const Transform & | BillboardXfm () |
| Report the world transform turned to face the current camera. | |
| const Transform & | GetLocalXfm () const |
| Transform & | GetLocalXfm () |
| void | SetLocalXfm (const Transform &xfm) |
| const Transform & | GetWorldXfm () const |
| Transform & | GetWorldXfm () |
| int | GetDirty () const |
| void | SetDirty (int nDirty) |
| const std::list< RndTransformable * > & | GetTransList () const |
| Public Member Functions inherited from RndCollideable | |
| RndCollideable () | |
| Construct a collideable without children. | |
| ~RndCollideable () override | |
| Drop the references on the children. | |
| void | DumpText (PrnStream &stream) override |
| Write a description of the collideable. | |
| void | Save (BinStream &stream) override |
| Write the names of the children. | |
| void | Replace (RndObject *pFrom, RndObject *pTo) override |
| Replace a child with another object. | |
| void | Copy (const RndObject *pSource, int nFlags) override |
| Copy the children when the flags request them. | |
| void | Load (BinStream &stream) override |
| Read what Save() wrote. | |
| RndCollideable * | Parent () |
| Find the collideable whose children include this one. | |
| bool | AddCollide (RndCollideable *pCollide) |
| Append a child. | |
| void | RemoveCollide (RndCollideable *pCollide) |
| Remove a child. | |
Static Public Member Functions | |
| static RndObject * | New (const char *pszName) |
| Create a camera. | |
| static void | CreateDefault () |
| Create the internal camera [default cam], 150 units back along y. | |
| static float | ConvertFov (float fFrom, float fTo, float fFov) |
| Report the field of view that covers the same extent at another aspect. | |
| Static Public Member Functions inherited from RndDrawable | |
| static void | CollectChildren (std::list< RndObject * > &objects, RndDrawable *pDrawable) |
| Append every draw descendant of a drawable, depth first, each before its descendants. | |
| Static Public Member Functions inherited from RndTransformable | |
| static void | CollectChildren (std::list< RndObject * > &objects, RndTransformable *pTransformable) |
| Append every transform descendant of a transformable, depth first, each before its descendants. | |
| Static Public Member Functions inherited from RndCollideable | |
| static void | CollectChildren (std::list< RndObject * > &objects, RndCollideable *pCollideable) |
| Append every collision descendant of a collideable, depth first, each before its descendants. | |
Static Public Attributes | |
| static RndCam * | sCurrent |
| The camera drawing is set up for. | |
| static RndCam * | sDefault |
| The internal camera CreateDefault() made. | |
| static const char * | sClassName |
| The class name a .rnd file writes, Cam. | |
| static int | sRev |
| The format version Save() writes and Load() accepts. | |
| Static Public Attributes inherited from RndDrawable | |
| static int | sRev |
| The format version Save() writes and Load() accepts. | |
| Static Public Attributes inherited from RndObject | |
| static constexpr int | kCopyChildLists = 0x200 |
| The bit of the Copy() flags that copies the child lists of the mix-ins. | |
| Static Public Attributes inherited from RndTransformable | |
| static int | sRev |
| The format version Save() writes and Load() accepts. | |
| Static Public Attributes inherited from RndCollideable | |
| static int | sRev |
| The format version Save() writes and Load() accepts. | |
Protected Member Functions | |
| void | ReleaseTargetTex () |
| Drop the reference on mTargetTex. | |
| void | AcquireTargetTex () |
| Take a reference on mTargetTex and rebuild the projection. | |
| Protected Member Functions inherited from RndDrawable | |
| void | ReleaseDrawRefs () |
| Drop the reference on every child without emptying the list. | |
| void | AcquireDrawRefs () |
| Take a reference on every child. | |
| Protected Member Functions inherited from RndTransformable | |
| void | ReleaseTransRefs () |
| Drop the reference on every child without emptying the list. | |
| void | AcquireTransRefs () |
| Take a reference on every child. | |
| Protected Member Functions inherited from RndCollideable | |
| void | ReleaseCollideRefs () |
| Drop the reference on every child without emptying the list. | |
| void | AcquireCollideRefs () |
| Take a reference on every child. | |
Protected Attributes | |
| Transform | mOrthoWorldXfm |
| Transform | mInvWorldXfm |
| Transform | mLocalProject |
| Transform | mInvLocalProject |
| Transform | mWorldProject |
| Transform | mInvWorldProject |
| Frustum | mLocalFrustum |
| Frustum | mWorldFrustum |
| float | mNearPlane |
| float | mFarPlane |
| float | mFov |
| Vector2 | mZRange |
| Rect | mScreenRect |
| RndTex * | mTargetTex |
| Protected Attributes inherited from RndDrawable | |
| int | mShowing |
| Protected Attributes inherited from RndObject | |
| std::list< RndObject * > | mRefs |
| String | mName |
| Protected Attributes inherited from RndTransformable | |
| std::list< RndTransformable * > | mTransList |
| Transform | mLocalXfm |
| Transform | mWorldXfm |
| Vector3 | mOrigin |
| int | mDirty |
| int | mBillboard |
Additional Inherited Members | |
| Public Types inherited from RndTransformable | |
| enum | Billboard { kBillboardNone = 0 , kBillboardX = 1 , kBillboardY = 2 , kBillboardZ = 4 , kBillboardXZ = 8 , kBillboardXYZ = 16 , kBillboardSimpleXYZ = 32 , kBillboardLocalRotate = 64 , kBillboardScale = 128 , kBillboardScaleX = 129 , kBillboardScaleY = 130 , kBillboardScaleZ = 132 , kBillboardScaleXZ = 136 , kBillboardScaleXYZ = 144 , kBillboardScaleSimpleXYZ = 160 } |
| How the world transform turns to face the current camera. More... | |
Camera.
The RTTI includes the class name and records RndDrawable, RndTransformable, and RndCollideable as bases. The camera projects onto mScreenRect, a rectangle in fractions of the display or of mTargetTex. A field of view of 0 selects an orthographic projection.
|
explicit |
Construct a camera looking along y with a quarter-turn field of view, from 1 to 1000 units.
| pszName | The registry key. |
|
override |
Release the camera and stop drawing through it.
|
inline |
Allocate a camera, billed to the class name.
| nSize | The object size the compiler supplies. |
|
inline |
Release a camera.
| pBlock | The block. |
|
inlinestatic |
Create a camera.
| pszName | The registry key. |
|
overridevirtual |
Add the camera itself to a list.
| objects | The list to add to. |
Reimplemented from RndDrawable.
|
overridevirtual |
Make the camera current and add the drawables of the children to a list.
| drawables | The list to add to. |
Reimplemented from RndDrawable.
|
overridevirtual |
Make the camera current.
Reimplemented from RndDrawable.
|
overridevirtual |
Recompute the world transform, and the world projection when it changed.
| pParent | The parent, or null for a root. |
| bForce | Non-zero to recompute even when nothing changed. |
Reimplemented from RndTransformable.
Record the camera as struck when a screen point falls inside mScreenRect, then test the children.
| point | The screen point, in fractions of the display. |
| collisions | The list to add to. |
Reimplemented from RndCollideable.
|
overridevirtual |
Write a description of the camera and its bases.
A dump level above 1 adds the projections and the view volumes.
| stream | The stream to write to. |
Reimplemented from RndObject.
|
overridevirtual |
Write the camera and its bases.
| stream | The stream to write to. |
Implements RndObject.
Replace a referenced object with another.
| pFrom | The object being replaced. |
| pTo | The replacement, or null. |
Implements RndObject.
|
inlineoverridevirtual |
Report the class name.
Implements RndObject.
|
overridevirtual |
Copy another camera and its bases.
| pSource | The camera to copy from. |
| nFlags | The set of fields to copy. |
Implements RndObject.
|
overridevirtual |
Project a world point to a screen point through mWorldProject and mScreenRect.
A point that projects to a depth of exactly 0 skips the perspective divide. The name is inferred.
| world | The point in world space. |
| screen | Receives the point in fractions of the target. |
| void RndCam::SetTargetTex | ( | RndTex * | pTex | ) |
Render into a texture rather than the display, or stop.
| pTex | The texture, or null for the display. |
| void RndCam::SetFrustum | ( | float | fNear, |
| float | fFar, | ||
| float | fFov ) |
Set the view volume.
The near plane is kept at least a thousandth of the far plane.
| fNear | The distance to the near plane. |
| fFar | The distance to the far plane. |
| fFov | The field of view in radians, or 0 for an orthographic projection. |
| void RndCam::UpdateProjection | ( | ) |
Rebuild the local projection and the local view volume, then the world projection.
| void RndCam::UpdateWorldProject | ( | ) |
Rebuild the world projection and the world view volume from the world transform.
The basis is orthonormalised first, so a scaled camera projects without the scale.
|
static |
Create the internal camera [default cam], 150 units back along y.
The name is inferred.
|
static |
Report the field of view that covers the same extent at another aspect.
The name is inferred.
| fFrom | The extent the field of view spans. |
| fTo | The extent the result spans. |
| fFov | The field of view in radians. |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
| rect | The area drawn to, in fractions of the target. |
|
inline |
|
inline |
|
inline |
|
inline |
| range | The depth range the projection maps to. |
|
protected |
Drop the reference on mTargetTex.
The name is inferred.
|
protected |
Take a reference on mTargetTex and rebuild the projection.
The name is inferred.
|
virtual |
Test a segment against the collideable and add what it strikes to a list.
The base body tests the children.
| segment | The segment. |
| collisions | The list to add to. |
Reimplemented from RndCollideable.
|
static |
The camera drawing is set up for.
|
static |
The internal camera CreateDefault() made.
|
static |
The class name a .rnd file writes, Cam.
|
static |
|
protected |
The world transform with an orthonormal basis.
|
protected |
The inverse of mOrthoWorldXfm.
|
protected |
Camera space to the unit projection.
|
protected |
The inverse of mLocalProject.
|
protected |
The inverse of mWorldProject.
|
protected |
The view volume in camera space.
|
protected |
The view volume in world space.
|
protected |
The distance to the near plane.
|
protected |
The distance to the far plane.
|
protected |
The field of view in radians, 0 for orthographic.
|
protected |
The depth range the projection maps to.
|
protected |
The area drawn to, in fractions of the target.
|
protected |
The texture drawn to, or null for the display.