Public Member Functions | Public Attributes

View Class Reference

Search for all occurrences

Detailed Description

This class is passed in to GeomObject::GetRenderMesh() to allow objects to do view dependent rendering.

It is also passed to Control::EvalVisibility(). For example particle systems use this to have the particles exactly face the camera (if this option is enabled). If GetRenderMesh() is called by the renderer, the methods of this class are implemented by the system. If a plug-in is calling this method, they must implement these methods. The sample code below shown a null implementation that may be used if a viewport is not involved:

class NullView : public View
{
    Point2 ViewToScreen(Point3 p)
        { return Point2(p.x,p.y); }
    NullView() {
        worldToView.IdentityMatrix();
        screenW=640.0f; screenH = 480.0f;
    }
};
See also:
GeomObject, Interface, Control, Matrix3, Point3

#include <object.h>

Inheritance diagram for View:
Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual Point2  ViewToScreen (Point3 p)=0
  This method is used to convert a point in view space to screen space.
virtual BOOL  CheckForRenderAbort ()
  This method should be used by GetRenderMesh() implementations that require a lot of processing time.
virtual INT_PTR  Execute (int cmd, ULONG_PTR arg1=0, ULONG_PTR arg2=0, ULONG_PTR arg3=0)
  Generic expansion function.
  View ()

Public Attributes

float  screenW
  The screen width in pixels.
float  screenH
  The screen height in pixels.
Matrix3  worldToView
  A transformation matrix from world into view space.
int  projType
  The view projection type: 0 is perspective, 1 is parallel.
float  fov
  The field of view in radians.
float  pixelSize
  The pixel size setting.
Matrix3  affineTM
  World to camera transformation matrix.
DWORD  flags
  Defined in Flags for the View class.

Constructor & Destructor Documentation

View ( ) [inline]
{ projType = -1; flags = RENDER_MESH_DISPLACEMENT_MAP; } // projType not set, this is to deal with older renderers.

Member Function Documentation

virtual Point2 ViewToScreen ( Point3  p ) [pure virtual]

This method is used to convert a point in view space to screen space.

This includes any perspective projection.

Parameters:
p The point in view space.
Returns:
The point in screen space (in pixel coordinates).
virtual BOOL CheckForRenderAbort ( ) [inline, virtual]

This method should be used by GetRenderMesh() implementations that require a lot of processing time.

This allows these processes to be interrupted by the user. An example of this in use is the extensive computations done for displacement mapping. These may be interrupted by the user during a render. So, any implementation of GetRenderMesh() which takes a long time should periodically call this method to see if the user has canceled the render.

Returns:
true if user has canceled, false otherwise.
{ return FALSE; }
virtual INT_PTR Execute ( int  cmd,
ULONG_PTR  arg1 = 0,
ULONG_PTR  arg2 = 0,
ULONG_PTR  arg3 = 0 
) [inline, virtual]

Generic expansion function.

{ return 0; } 

Member Data Documentation

float screenW

The screen width in pixels.

float screenH

The screen height in pixels.

A transformation matrix from world into view space.

This is into the camera's space.

int projType

The view projection type: 0 is perspective, 1 is parallel.

float fov

The field of view in radians.

float pixelSize

The pixel size setting.

World to camera transformation matrix.

DWORD flags

View View View View View View View View View View
View View View View View View View View View View