3ds Max C++ API Reference
Loading...
Searching...
No Matches
ViewParams Class Reference

Describes the properties of a view that is being rendered. More...

#include <ViewParams.h>

+ Inheritance diagram for ViewParams:

Public Member Functions

 ViewParams ()
 
virtual INT_PTR Execute (int, ULONG_PTR=0, ULONG_PTR=0, ULONG_PTR=0)
 This is a general purpose function that allows the API to be extended in the future.
 
- Public Member Functions inherited from BaseInterfaceServer
UtilExport BaseInterfaceGetInterface (Interface_ID id) override
 
virtual UtilExport int NumInterfaces () const
 
virtual UtilExport BaseInterfaceGetInterfaceAt (int i) const
 
virtual UtilExport ~BaseInterfaceServer ()
 
- Public Member Functions inherited from InterfaceServer
virtual UtilExport ~InterfaceServer ()
 Destructor.
 
virtual UtilExport BaseInterfaceGetInterface (Interface_ID id)
 
template<class InterfaceType >
InterfaceType * GetTypedInterface ()
 

Public Attributes

Matrix3 prevAffineTM
 
Matrix3 affineTM
 
int projType
 
float hither
 
float yon
 
float distance
 
float zoom
 
float fov
 
float nearRange
 
float farRange
 

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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
static UtilExport voidoperator new[] (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate arrays of objects.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
static UtilExport voidoperator new (size_t size, void *placement_ptr)
 Placement new operator.
 
static UtilExport void operator delete (void *ptr, void *placement_ptr)
 Placement delete operator.
 
static UtilExport voidaligned_malloc (size_t size, size_t alignment)
 Allocates memory on a specified alignment boundary.
 
static UtilExport voidaligned_realloc (void *ptr, size_t size, size_t alignment)
 Reallocates memory on a specified alignment boundary.
 
static UtilExport void aligned_free (void *ptr)
 Frees a block of memory that was allocated with aligned_malloc/aligned_realloc.
 
- Protected Attributes inherited from BaseInterfaceServer
Tab< BaseInterface * > interfaces
 

Detailed Description

Describes the properties of a view that is being rendered.

These are properties such as the type of view (parallel or perspective), its clipping distances, width, height, zoom factor, field-of-view, etc.

Data Members:
Matrix3 prevAffineTM;

This is the world space to camera space transformation matrix computed 2 ticks before the affineTM matrix below.

Matrix3 affineTM;

This matrix will take a point in world space and convert it to camera space (or world to view space if it's a viewport). The camera coordinates are set up looking down the -Z axis, X is to the right, and Y is up.

int projType;

One of the following values:

PROJ_PERSPECTIVE

The view is a perspective projection.

PROJ_PARALLEL

The view is a parallel projection.

float hither, yon;

The hither and yon clipping distances.

float distance;

The distance from the view point to the image (view) plane.

float zoom;

The zoom factor of the viewport for parallel projection. The zoom factor gives the amount of magnification relative to a standard view width of 400 pixels. This is best explained via the following code fragment: ComputeViewParams() computes the projection factors for a given view, and MapToScreen() applies these factors to map a point from 3D camera coordinates to 2D screen coordinates.
#define VIEW_DEFAULT_WIDTH ((float)400.0)
void SRendParams::ComputeViewParams(const ViewParams&vp)
{
float fac = -(float)(1.0 / tan(0.5*(double)vp.fov));
xscale = fac*dw2; // dw2 = float(devWidth)/2.0
yscale = -devAspect*xscale;
}
else {
xscale = (float)devWidth/(VIEW_DEFAULT_WIDTH*vp.zoom);
yscale = -devAspect*xscale;
}
}
Point2 SRendParams::MapToScreen(Point3 p)
{
Point2 s;
if (proj_type==PROJ_PERSPECTIVE) {
s.x = dw2 + xscale*p.x/p.z;
s.y = dh2 + yscale*p.y/p.z;
}
else {
s.x = dw2 + xscale*p.x;
s.y = dh2 + yscale*p.y;
}
return s;
}
@ PROJ_PERSPECTIVE
Definition: ViewParams.h:17
Definition: point2.h:38
float y
Definition: point2.h:41
float x
Definition: point2.h:40
Definition: point3.h:54
float y
Definition: point3.h:57
float x
Definition: point3.h:56
float z
Definition: point3.h:58
Describes the properties of a view that is being rendered.
Definition: ViewParams.h:85
float zoom
Definition: ViewParams.h:93
int projType
Definition: ViewParams.h:89
float fov
Definition: ViewParams.h:95
float fov;

Field of view in radians for perspective projections.

float nearRange;

The near environment range setting (used for fog effects).

float farRange;

The far environment setting (used for fog effects).
See also
Class Matrix3, Class Renderer, Class RendParams.

Constructor & Destructor Documentation

◆ ViewParams()

ViewParams ( )
inline
98 : distance(0.0f), farRange(0.0f), hither(0.0f), zoom(0.0f),
99 fov(0.0f), yon(0.0f), projType(0), nearRange(0.0f) {};
float distance
Definition: ViewParams.h:91
float farRange
Definition: ViewParams.h:97
float nearRange
Definition: ViewParams.h:96
float hither
Definition: ViewParams.h:90
float yon
Definition: ViewParams.h:90

Member Function Documentation

◆ Execute()

virtual INT_PTR Execute ( int  ,
ULONG_PTR  = 0,
ULONG_PTR  = 0,
ULONG_PTR  = 0 
)
inlinevirtual

This is a general purpose function that allows the API to be extended in the future.

The 3ds Max development team can assign new cmd numbers and continue to add functionality to this class without having to 'break' the API.

Parameters:
int cmd

The index of the command to execute.

ULONG_PTR arg1=0

Optional argument 1. See the documentation where the cmd option is discussed for more details on these parameters.

ULONG_PTR arg2=0

Optional argument 2.

ULONG_PTR arg3=0

Optional argument 3.
Returns
An integer return value. See the documentation where the cmd option is discussed for more details on the meaning of this value.
116{ return 0; }

Member Data Documentation

◆ prevAffineTM

Matrix3 prevAffineTM

◆ affineTM

Matrix3 affineTM

◆ projType

int projType

◆ hither

float hither

◆ yon

float yon

◆ distance

float distance

◆ zoom

float zoom

◆ fov

float fov

◆ nearRange

float nearRange

◆ farRange

float farRange