View Class Reference

#include <object.h>

Class 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
{
{ return Point2(p.x,p.y); }
NullView() {
screenW=640.0f; screenH = 480.0f;
}
};
See also
GeomObject, Interface, Control, Matrix3, Point3
+ Inheritance diagram for View:

Public Member Functions

virtual Point2 ViewToScreen (Point3 p)=0
 This method is used to convert a point in view space to screen space. More...
 
virtual BOOL CheckForRenderAbort ()
 This method should be used by GetRenderMesh() implementations that require a lot of processing time. More...
 
virtual INT_PTR Execute (int cmd, ULONG_PTR arg1=0, ULONG_PTR arg2=0, ULONG_PTR arg3=0)
 Generic expansion function. More...
 
 View ()
 
- Public Member Functions inherited from InterfaceServer
virtual UtilExport ~InterfaceServer ()
 Destructor. More...
 
virtual UtilExport BaseInterfaceGetInterface (Interface_ID id)
 

Public Attributes

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

Additional Inherited Members

- Static Public Member Functions inherited from MaxHeapOperators
static UtilExport voidoperator new (size_t size)
 Standard new operator used to allocate objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e)
 Standard new operator used to allocate objects if there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new (size_t size, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate objects that takes the type of memory, filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new (size_t size, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate arrays of objects. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport void operator delete (void *ptr)
 Standard delete operator used to deallocate an object If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an object If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an object that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete (void *ptr, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, void *placement_ptr)
 Placement new operator. More...
 
static UtilExport void operator delete (void *ptr, void *placement_ptr)
 Placement delete operator. More...
 
static UtilExport voidaligned_malloc (size_t size, size_t alignment)
 Allocates memory on a specified alignment boundary. More...
 
static UtilExport voidaligned_realloc (void *ptr, size_t size, size_t alignment)
 Reallocates memory on a specified alignment boundary. More...
 
static UtilExport void aligned_free (void *ptr)
 Frees a block of memory that was allocated with aligned_malloc/aligned_realloc. More...
 

Constructor & Destructor Documentation

View ( )
inline
263 : screenH(0.0f), screenW(0.0f), fov(0.0f), pixelSize(0.0f) { projType = -1; flags = RENDER_MESH_DISPLACEMENT_MAP; } // projType not set, this is to deal with older renderers.
float fov
The field of view in radians.
Definition: object.h:238
float screenW
The screen width in pixels.
Definition: object.h:220
float screenH
The screen height in pixels.
Definition: object.h:223
int projType
The view projection type: 0 is perspective, 1 is parallel.
Definition: object.h:235
float pixelSize
The pixel size setting.
Definition: object.h:241
#define RENDER_MESH_DISPLACEMENT_MAP
Indicates that Displacement Mapping is enabled.
Definition: object.h:188
DWORD flags
Defined in Flags for the View class.
Definition: object.h:247

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
pThe point in view space.
Returns
The point in screen space (in pixel coordinates).
virtual BOOL CheckForRenderAbort ( )
inlinevirtual

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.
258 { return FALSE; }
virtual INT_PTR Execute ( int  cmd,
ULONG_PTR  arg1 = 0,
ULONG_PTR  arg2 = 0,
ULONG_PTR  arg3 = 0 
)
inlinevirtual

Generic expansion function.

261 { return 0; }

Member Data Documentation

float screenW

The screen width in pixels.

float screenH

The screen height in pixels.

Matrix3 worldToView

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.

Matrix3 affineTM

World to camera transformation matrix.

DWORD flags