3ds Max C++ API Reference
GraphicsWindow Class Referenceabstract

#include <GraphicsWindow.h>

+ Inheritance diagram for GraphicsWindow:

Public Member Functions

virtual ~GraphicsWindow ()
 
virtual void setFlags (DWORD f)=0
 
virtual DWORD getFlags ()=0
 
virtual int getMaxTextures (void)=0
 
virtual void loadMeshData (DWORD_PTR id, int xyzCt, Point3 *xyz, int norCt, Point3 *nor, int texNum, int uvwCt, Point3 *uvw, int mtlCt, Material *mtl)=0
 
virtual void processStrips (DWORD_PTR id, int stripCt, StripTab *s, GFX_ESCAPE_FN fn)=0
 
virtual void processWireFaces (int xyzCt, Point3 *xyz, int faceCt, GWFace *face, int dispFlags, BitArray *faceSel, BitArray *edgeSel, int mtlCt, Material *mtl, GFX_ESCAPE_FN fn)=0
 
virtual void MarkerBufferSetMarkerType (MarkerType type)
 
virtual DWORD MarkerGetDXColor (Point3 p)
 
virtual VertexBufferMarkerBufferLock ()
 
virtual void MarkerBufferUnLock ()
 
virtual int MarkerBufferSize ()
 
virtual int MarkerBufferStride ()
 
virtual void MarkerBufferDraw (int numberOfMarkers)
 
virtual DWORD LineGetDXColor (Point3 p)
 
virtual LineBufferLineBufferLock ()
 
virtual void LineBufferUnLock ()
 
virtual int LineBufferSize ()
 
virtual int LineBufferStride ()
 
virtual void LineBufferDraw (int numberOfSegments)
 
virtual void escape (GFX_ESCAPE_FN fn, void *data)=0
 
virtual BOOL getDepthValue (float x, float y, float *z)
 
virtual void clearViewportDepth (RECT *r)
 
virtual GFX_MESH::IHWSubMeshCreateHWDrawMesh (GFX_MESH::HWTupleMesh *hwMesh)
 
virtual void DrawHWDrawMesh (GFX_MESH::HWTupleMesh *hwMesh)
 
Driver/Configuration/Support Methods
virtual void postCreate (int ct, GraphicsWindow **gw)=0
 
virtual void shutdown ()=0
 
virtual int getVersion ()=0
 
virtual const MCHARgetDriverString (void)=0
 
virtual void config (HWND hWnd)=0
 
virtual int querySupport (int what)=0
 
Window/Viewport/Transformations Methods
virtual HWND getHWnd (void)=0
 
virtual void getTextExtents (const MCHAR *text, SIZE *sp)=0
 
virtual void beginFrame ()=0
 
virtual void endFrame ()=0
 
virtual void setViewport (int x, int y, int w, int h)=0
 
virtual void setVirtualViewportParams (float zoom, float xOffset, float yOffset)=0
 
virtual void setUseVirtualViewport (int onOff)=0
 
virtual void setTransform (const Matrix3 &m)=0
 
virtual BOOL getFlipped (void)=0
 
virtual Matrix3 getTransform (void)=0
 
virtual int isPerspectiveView (void)=0
 
Position/Size/Depth/Clipping Methods
virtual void setPos (int x, int y, int w, int h)=0
 
virtual void setDisplayState (int s)=0
 
virtual int getDisplayState ()=0
 
virtual int getWinSizeX ()=0
 
virtual int getWinSizeY ()=0
 
virtual DWORD getWinDepth (void)=0
 
virtual DWORD getHitherCoord (void)=0
 
virtual DWORD getYonCoord (void)=0
 
Drawing Setup
virtual int getMaxStripLength ()
 
virtual void resetUpdateRect ()=0
 
virtual void enlargeUpdateRect (RECT *rp)=0
 
virtual int getUpdateRect (RECT *rp)=0
 
virtual void multiplePass (int pass, BOOL onOff, float scaleFact=1.005f)=0
 
virtual void setSkipCount (int c)=0
 
virtual int getSkipCount (void)=0
 
virtual void setRndLimits (DWORD l)=0
 
virtual DWORD getRndLimits (void)=0
 
virtual DWORD getRndMode (void)=0
 
virtual void setViewportLimits (DWORD l)=0
 For internal use only. More...
 
virtual DWORD getViewportLimits (void)=0
 For internal use only. More...
 
Buffer Access Methods
virtual BOOL setBufAccess (int which, int b)=0
 
virtual BOOL getBufAccess (int which)=0
 
virtual BOOL getBufSize (int which, int *size)=0
 
virtual BOOL getBuf (int which, int size, void *buf)=0
 
virtual BOOL setBuf (int which, int size, void *buf, RECT *rp)=0
 
DIB Methods
virtual BOOL getDIB (BITMAPINFO *bmi, int *size)=0
 
virtual BOOL setBackgroundDIB (int width, int height, BITMAPINFO *bmi)=0
 
virtual void setBackgroundOffset (int x, int y)=0
 
Texture Methods
virtual int useClosestTextureSize (int bkg=FALSE)=0
 
virtual int getTextureSize (int bkg=FALSE)=0
 
virtual DWORD_PTR getTextureHandle (BITMAPINFO *bmi)=0
 
virtual void freeTextureHandle (DWORD_PTR handle)=0
 
virtual BOOL setTextureByHandle (DWORD_PTR handle, int texStage=0)=0
 
virtual void setTextureColorOp (int texStage=0, int texOp=GW_TEX_MODULATE, int texAlphaSource=GW_TEX_TEXTURE, int texScale=GW_TEX_SCALE_1X)=0
 
virtual void setTextureAlphaOp (int texStage=0, int texOp=GW_TEX_MODULATE, int texAlphaSource=GW_TEX_TEXTURE, int texScale=GW_TEX_SCALE_1X)=0
 
virtual BOOL setTextureTiling (int u, int v, int w=GW_TEX_NO_TILING, int texStage=0)=0
 
virtual int getTextureTiling (int which, int texStage=0)=0
 
virtual void setTexTransform (const Matrix3 &m, int texStage=0)=0
 
Light and Camera Methods
virtual int getMaxLights (void)=0
 
virtual void setLight (int num, const Light *l)=0
 
virtual void setLightExclusion (DWORD exclVec)=0
 
virtual void setCamera (const Camera &c)=0
 
virtual void setCameraMatrix (float mat[4][4], Matrix3 *invTM, int persp, float hither, float yon)=0
 
virtual void getCameraMatrix (float mat[4][4], Matrix3 *invTM, int *persp, float *hither, float *yon)=0
 
Material Methods
virtual void setTransparency (DWORD settings)=0
 
virtual void setMaterial (const Material &m, int index=0)=0
 
virtual MaterialgetMaterial (void)=0
 
Coordinate Transformation Methods
virtual DWORD hTransPoint (const Point3 *in, IPoint3 *out)=0
 
virtual DWORD wTransPoint (const Point3 *in, IPoint3 *out)=0
 
virtual DWORD transPoint (const Point3 *in, Point3 *out)=0
 
Drawing Methods

The old device coordinate calls have been changed (or removed).

Methods that start with "h" take integer device coordinates with the origin at the lower-left. Calls with a "w" in front take Windows device coordinates with the origin at the upper left. Note that these "h" and "w" routines perform no clipping unless otherwise noted (clipping at this level will be very expensive). Drawing outside the allowable region might cause 3ds Max to crash.

virtual void updateScreen ()=0
 
virtual void clearScreen (RECT *rp, int useBkg=FALSE)=0
 
virtual void setColor (ColorType t, float r, float g, float b)=0
 
void setColor (ColorType t, Point3 clr)
 
virtual void lightVertex (const Point3 &pos, const Point3 &nor, Point3 &rgb)=0
 
virtual void hText (IPoint3 *xyz, const MCHAR *s)=0
 
virtual void hMarker (IPoint3 *xyz, MarkerType type)=0
 
virtual void hPolyline (int ct, IPoint3 *xyz, Point3 *rgb, int closed, int *es)=0
 
void hPolyline (int ct, IPoint3 *xyz, Point3 *rgb, Point3 *uvw, int closed, int *es)
 
virtual void hPolygon (int ct, IPoint3 *xyz, Point3 *rgb, Point3 *uvw, int texNum=1)=0
 
virtual void hTriStrip (int ct, IPoint3 *xyz, Point3 *rgb, Point3 *uvw, int texNum=1)=0
 
virtual void wText (IPoint3 *xyz, const MCHAR *s)=0
 
virtual float GetTextPointSize () const =0
 
virtual void SetTextPointSize (float)=0
 
virtual float GetTextWidthFactor () const =0
 
virtual void SetTextWidthFactor (float)=0
 
virtual unsigned GetTextWeight () const =0
 
virtual void SetTextWeight (unsigned)=0
 
virtual void wMarker (IPoint3 *xyz, MarkerType type)=0
 
virtual void wPolyline (int ct, IPoint3 *xyz, Point3 *rgb, int closed, int *es)=0
 
void wPolyline (int ct, IPoint3 *xyz, Point3 *rgb, Point3 *uvw, int closed, int *es)
 
virtual void wPolygon (int ct, IPoint3 *xyz, Point3 *rgb, Point3 *uvw, int texNum=1)=0
 
virtual void wTriStrip (int ct, IPoint3 *xyz, Point3 *rgb, Point3 *uvw, int texNum=1)=0
 
virtual void text (Point3 *xyz, const MCHAR *s)=0
 
virtual void startMarkers ()=0
 
virtual void marker (Point3 *xyz, MarkerType type)=0
 
virtual void endMarkers ()=0
 
virtual void polyline (int ct, Point3 *xyz, Point3 *rgb, int closed, int *es)=0
 
void polyline (int ct, Point3 *xyz, Point3 *rgb, Point3 *uvw, int closed, int *es)
 
virtual void polylineN (int ct, Point3 *xyz, Point3 *nor, int closed, int *es)=0
 
virtual void startSegments ()=0
 
virtual void segment (Point3 *xyz, int vis)=0
 
virtual void endSegments ()=0
 
virtual void polygon (int ct, Point3 *xyz, Point3 *rgb, Point3 *uvw, int texNum=1)=0
 
virtual void polygonN (int ct, Point3 *xyz, Point3 *nor, Point3 *uvw, int texNum=1)=0
 
virtual void triStrip (int ct, Point3 *xyz, Point3 *rgb, Point3 *uvw, int texNum=1)=0
 
virtual void triStripN (int ct, Point3 *xyz, Point3 *nor, Point3 *uvw, int texNum=1)=0
 
virtual void startTriangles ()=0
 
virtual void triangle (Point3 *xyz, Point3 *rgb)=0
 
virtual void triangleN (Point3 *xyz, Point3 *nor, Point3 *uvw, int texNum=1)=0
 
virtual void triangleNC (Point3 *xyz, Point3 *nor, Point3 *rgb)=0
 
virtual void triangleNCT (Point3 *xyz, Point3 *nor, Point3 *rgb, Point3 *uvw, int texNum=1)=0
 
virtual void triangleW (Point3 *xyz, int *es)=0
 
virtual void triangleNW (Point3 *xyz, Point3 *nor, int *es)=0
 
virtual void endTriangles ()=0
 
Hit Testing Methods

The following methods are used for hit testing.

Typically, these methods are used in the following sequence:
Set a hit region using setHitRegion() and then clear the hit code using clearHitCode(). Now, render a primitive using the mode GW_PICK and at whatever level you want to check at. For example, if you are interested in vertex hit testing, you can render a series of markers using a rendering mode that includes GW_PICK. The GW_PICK rendering mode will cause the system to perform hit testing rather than actually render the item.
After each item is rendered, you can check to see if a hit was made using checkHitCode(). This method returns TRUE or FALSE based on if a hit was found. If you are looking for just a single hit, you can abort as soon as checkHitCode() returns TRUE. If you are interested in the closest hit, you can loop through all the items calling clearHitCode(), checkHitCode(), and getHitDistance(). After checking all the items, you can simply choose the smallest hit distance from all the items that you have checked.

virtual void setHitRegion (HitRegion *rgn)=0
 
virtual void clearHitCode (void)=0
 
virtual BOOL checkHitCode (void)=0
 
virtual void setHitCode (BOOL h)=0
 
virtual DWORD getHitDistance (void)=0
 
virtual void setHitDistance (DWORD d)=0
 
virtual float interpWorld (Point3 *world1, Point3 *world2, float sParam, Point3 *interpPt)=0
 
virtual DllExport void hitTestHMarker (const IPoint3 *xyz, MarkerType type, GfxPickResult &res) const
 
virtual DllExport void hitTestMarker (const Point3 *xyz, MarkerType type, GfxPickResult &res) const
 
virtual DllExport void hitTestPolyline (int ct, const Point3 *xyz, int closed, int *es, GfxPickResult &res) const
 
virtual DllExport void hitTestPolylineN (int ct, const Point3 *xyz, int closed, int *es, GfxPickResult &res) const
 
virtual DllExport void hitTestHPolyline (int ct, const IPoint3 *xyz, int closed, int *es, GfxPickResult &res) const
 
virtual DllExport void hitTestPolygon (int ct, const Point3 *xyz, GfxPickResult &res) const
 
virtual DllExport void hitTestPolygonN (int ct, const Point3 *xyz, GfxPickResult &res) const
 
virtual DllExport void hitTestHPolygon (int ct, const IPoint3 *xyz, GfxPickResult &res) const
 
- Public Member Functions inherited from InterfaceServer
virtual UtilExport ~InterfaceServer ()
 Destructor. More...
 
virtual UtilExport BaseInterfaceGetInterface (Interface_ID id)
 
template<class InterfaceType >
InterfaceType * GetTypedInterface ()
 

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...
 

Detailed Description

See also
Class InteractiveRenderer for Graphics Window, Class GWinSetup, Class HitRegion, MarkerType, Rendering Modes and Rendering Limits, Class Point3, Class IPoint3, Class Matrix3, Class Interface, Class ViewExp.

Description:
The abstract graphics window class. The methods here provide low-level access to 3ds Max's graphics system. These methods are available for plug-ins to do any graphics work not possible using the standard high-level graphics methods of 3ds Max.

These methods are for use in the existing 3ds Max viewports. Note that these APIs are not for casual use, as they are not intended to be a high level graphics library. For example, many steps are required to display a single lit polygon. These APIs are optimized for speed, and not at all for plug-in programmer ease of use.

These methods are provided, however, so that developers can do things that are otherwise impossible using the high-level methods.

Developers should use these methods with an understanding of exactly what they are doing since it's quite easy to crash 3ds Max when inappropriate arguments are supplied. The calls are specifically optimized for exactly the way 3ds Max uses them. In no way should the calls in GraphicsWindow be considered an "ordinary" 2D/3D API. (That's what OpenGL, D3D, and HEIDI are for.)

One final note of warning: most graphics windows methods execute in a separate thread (or in multiple separate threads) that are owned by the graphics window. Thus, due to thread scheduling, when a bad argument or incorrect sequencing of graphics windows calls causes 3ds Max to crash, it is not at all easy to figure out where the problem is. In particular, the location of the main 3ds Max thread is not relevant.

All the methods of this class are implemented by the system.

Constructor & Destructor Documentation

◆ ~GraphicsWindow()

virtual ~GraphicsWindow ( )
inlinevirtual
75 {}

Member Function Documentation

◆ postCreate()

virtual void postCreate ( int  ct,
GraphicsWindow **  gw 
)
pure virtual
Remarks
This is called after all four GraphicsWindows used by 3ds Max are created. SDK users shouldn't need this call

◆ shutdown()

virtual void shutdown ( )
pure virtual
Remarks
This is used to tell the driver that it is shutting down.

◆ getVersion()

virtual int getVersion ( )
pure virtual
Remarks
This returns "0x200" to indicate R2.0

◆ getDriverString()

virtual const MCHAR* getDriverString ( void  )
pure virtual
Remarks
This identifies the driver (and includes manufacturer info if available)

◆ config()

virtual void config ( HWND  hWnd)
pure virtual
Remarks
This is called to put up the config dialog if the driver supports GW_SPT_CAN_CONFIG
Parameters:
HWND hWnd

The parent window handle for the dialog.

◆ querySupport()

virtual int querySupport ( int  what)
pure virtual
Remarks
Determines if the driver supports the specified feature.
Parameters:
int what

One of the following values:

GW_SPT_TXT_CORRECT

This is used to enable or gray-out the perspective correction right-click viewport menu option.

GW_SPT_GEOM_ACCEL

This is used to indicate to 3ds Max (and the mesh class in particular) that the driver wants to handle all of the 3D data natively. In this case, meshes are rendered by passing 3D world space data and letting the driver transform, clip, and light the vertices. If this returns FALSE, then the mesh class handles all xforms/clip/lighting calculations (using a lazy evaluation algorithm) and then calls the hPolygon or hPolyline 2 1/2D calls for the driver to rasterize. (Primitives that are actually clipped are still sent to the polygon/polyline methods.)

Right now, only the OpenGL driver returns TRUE to this query, but other drivers have been developed that return TRUE, and the HEIDI and D3D drivers may change in the future.

GW_SPT_TRI_STRIPS

If this returns TRUE, then 3ds Max will try to stripify meshes before calling the rendering methods. Right now, the drivers just return the user preference that is set in the driver config dialog. It defaults to TRUE.

GW_SPT_DUAL_PLANES

If a driver has dual-planes support it returns TRUE. Our OpenGL display driver only returns TRUE for this if the underlying display driver has implemented a custom OpenGL extension that allows us to handle this efficiently.

GW_SPT_SWAP_MODEL

This returns TRUE if 3ds Max has to redraw the whole scene any time the viewports are exposed.

GW_SPT_INCR_UPDATE

This returns TRUE if the driver can update a rectangular subset of the viewport without trashing the image outside that rectangle. This is TRUE for most drivers that blit the viewport region and FALSE for those that do page-flipping in the hardware. For OpenGL, this is TRUE if the display driver implements the Microsoft glSwapRectHintWIN extension.

GW_SPT_1_PASS_DECAL

This is TRUE if the driver can handle decalling with only one pass. Right now, this is TRUE for OpenGL, but FALSE for HEIDI and D3D. (And as with all of these options, it may change in a given driver any time in the future.)

GW_SPT_DRIVER_CONFIG

This is TRUE if the driver has a configuration dialog box. This is TRUE for all three of our standard drivers.

GW_SPT_TEXTURED_BKG

This is TRUE if the viewport background is implemented as a textured rectangle, and FALSE if it is a blitted bitmap.

GW_SPT_VIRTUAL_VPTS

This is TRUE if the driver allows viewports to be made larger than the physical window they are attached to. Right now this is ony TRUE for OGL.

GW_SPT_PAINT_DOES_BLIT

This is TRUE if WM_PAINT messages result in a blit of the backbuffer (as opposed to a page-flipping swap). This allows 3ds Max to do quick damage region repair, and works together with the GW_SPT_SWAP_MODEL flag.

GW_SPT_WIREFRAME_STRIPS

This is TRUE if the driver wants 3ds Max to send down wireframe models using triangle strips instead of a bundle of 2-pt segments. This is only used by the OGL driver, and it is there as a user-choosable performance-accuracy tradeoff (since the strips are faster and are back-culled, but they display hidden edges as though they are visible).

◆ getHWnd()

virtual HWND getHWnd ( void  )
pure virtual
Remarks
This returns the "output" window handle. (Input goes to an invisible window above the viewport. The invisible window is owned by 3ds Max.)

◆ getTextExtents()

virtual void getTextExtents ( const MCHAR text,
SIZE *  sp 
)
pure virtual
Remarks
This method returns the size (in pixels) that the specified text string will occupy
Parameters:
MCHAR *text

The string to check.

SIZE *sp

The size is returned here.

◆ setPos()

virtual void setPos ( int  x,
int  y,
int  w,
int  h 
)
pure virtual
Remarks
Sets the size and position of the GraphicsWindow. The coordinates are all Windows coordinates in the space of the GraphicsWindows' parent window. (The origin is the upper left.)
Parameters:
int x

Window x origin.

int y

Window y origin.

int w

Window width.

int h

Window height.

◆ setDisplayState()

virtual void setDisplayState ( int  s)
pure virtual
Remarks
The specified value may be sent to the driver to indicate the display state of the viewport window controlled by the driver.
Parameters:
int s

The display state to set. One of the following values:

GW_DISPLAY_MAXIMIZED

GW_DISPLAY_WINDOWED

GW_DISPLAY_INVISIBLE

◆ getDisplayState()

virtual int getDisplayState ( )
pure virtual
Remarks
This method returns the current state. One of the following values:

GW_DISPLAY_MAXIMIZED

GW_DISPLAY_WINDOWED

GW_DISPLAY_INVISIBLE

◆ getWinSizeX()

virtual int getWinSizeX ( )
pure virtual
Remarks
This method gets the current window size in X.

◆ getWinSizeY()

virtual int getWinSizeY ( )
pure virtual
Remarks
This method gets the current window size in Y.

◆ getWinDepth()

virtual DWORD getWinDepth ( void  )
pure virtual
Remarks
This method returns the z-buffer depth (in bits)

◆ getHitherCoord()

virtual DWORD getHitherCoord ( void  )
pure virtual
Remarks
This method returns the largest device Z value.

◆ getYonCoord()

virtual DWORD getYonCoord ( void  )
pure virtual
Remarks
This method returns the smallest device Z value.

◆ setFlags()

virtual void setFlags ( DWORD  f)
pure virtual

◆ getFlags()

virtual DWORD getFlags ( )
pure virtual

◆ getMaxStripLength()

virtual int getMaxStripLength ( )
inlinevirtual
Remarks
This method returns the largest number of triangles that can be in a strip
223 { return GFX_MAX_STRIP; }
#define GFX_MAX_STRIP
Definition: GraphicsConstants.h:173

◆ resetUpdateRect()

virtual void resetUpdateRect ( )
pure virtual
Remarks
This method resets the update rectangle. The update rectangle is the region of the screen that needs to be updated to reflect items that have changed. When the system is done rendering items, the goal is to only update the region that has actually been altered. This method sets the update rectangle (the region that will be blitted to the display) to invalid. In this way when enlargeUpdateRect() is later called, the RECT passed will be used as the region.

◆ enlargeUpdateRect()

virtual void enlargeUpdateRect ( RECT *  rp)
pure virtual
Remarks
This method enlarges the update rectangle to include the RECT passed. If rp is NULL, then the whole window will later be updated.
Parameters:
RECT *rp

Pointer to a rectangle (or NULL).

◆ getUpdateRect()

virtual int getUpdateRect ( RECT *  rp)
pure virtual
Remarks
This method retrieves the current update rectangle.
Parameters:
RECT *rp

The current update rectangle.
Returns
Zero if the update rectangle is invalid; otherwise nonzero.

◆ setBufAccess()

virtual BOOL setBufAccess ( int  which,
int  b 
)
pure virtual
Remarks
This method is used internally. Most drivers control two image buffers. One is displayed on the screen, and the other is used to rasterize geometric primitives. When rasterization of a complete frame is done, the off-screen buffer is blitted onto the display screen. This is referred to as dual-plane mode. This method will turn dual-plane mode on or off. This is used internally by the File/Preferences... Viewport page Use Dual Planes toggle.
Parameters:
int which

Specifies which buffer should use dual-planes.

BUF_F_BUFFER

The image (Framebuffer) buffer.

BUF_Z_BUFFER

The Z buffer.

int b

Nonzero to enable access (toggle on); 0 to toggle off.
Returns
TRUE if the graphics window has access to the specified buffer; otherwise FALSE.

◆ getBufAccess()

virtual BOOL getBufAccess ( int  which)
pure virtual
Remarks
This method is used internally. It returns a boolean value indicating if dual plane mode is on or off for the specified buffer.
Parameters:
The buffer whose dual-planes setting will be returned.

int which

The buffer whose dual-planes setting will be returned. One of the following values:

BUF_F_BUFFER

The Framebuffer.

BUF_Z_BUFFER

The Z buffer.
Returns
TRUE if the dual-plane mode is on; otherwise FALSE.

◆ getBufSize()

virtual BOOL getBufSize ( int  which,
int size 
)
pure virtual
Remarks
This method is used internally. It retrieves the size of the specified buffer in bytes.
Parameters:
int which

One of the following values:

int *size

The size of the buffer in bytes.

Note the following concerning the HEIDI driver. For HEIDI getBufSize() always returns 10 if dual-planes are on (and 0 otherwise). This is because HEIDI actually never returns the image - it keeps its own copy stored away. Thus the "logical" way to think is that we actually get a copy of the buffer by calling getBuf, and that we give it back by calling setBuf. But in reality (with the HEIDI driver) getBuf and setBuf only tell HEIDI to do some internal buffer manipulation.
Returns
TRUE if the size was returned; otherwise FALSE.

◆ getBuf()

virtual BOOL getBuf ( int  which,
int  size,
void buf 
)
pure virtual
Remarks
This method is used internally. It retrieves the specified buffer.
Parameters:
int which

The buffer to retrieve. One of the following values:

BUF_F_BUFFER - The image Framebuffer.

BUF_Z_BUFFER - The Z buffer.

int size

The number of bytes to retrieve. This must be at least the size returned from getBufSize().

void *buf

Storage for the buffer data.
Returns
TRUE if the buffer was retrieved; otherwise FALSE.

◆ setBuf()

virtual BOOL setBuf ( int  which,
int  size,
void buf,
RECT *  rp 
)
pure virtual
Remarks
Stores the specified buffer.
Parameters:
int which

The buffer to store. One of the following values:

BUF_F_BUFFER - The image Framebuffer.

BUF_Z_BUFFER - The Z buffer.

int size

The number of bytes to store.

void *buf

The buffer data.

RECT *rp

This allows only a subset of the saved image rect to be blitted back to the screen.
Returns
TRUE if the buffer was stored; otherwise FALSE.

◆ getDIB()

virtual BOOL getDIB ( BITMAPINFO *  bmi,
int size 
)
pure virtual
Remarks
This method returns the viewport image of this graphics window in a packed DIB format. A packed DIB is the standard BMI header followed immediately by all the data bytes (pixels) that make up the image. This is the standard way in Windows to pass a DIB around. See the sample code below for an example of this call in use. Note how it is called twice: once to get the size, once to get the DIB.
Parameters:
BITMAPINFO *bmi

The BITMAPINFO structure defines the dimensions and color information for a Windows device-independent bitmap (DIB). Note that if this parameter is NULL, then only the size value is returned.

int *size

The size of the image in bytes.
Returns
TRUE if the image was returned; otherwise FALSE.
Sample Code:
The following sample code saves the current 3ds Max viewport to a user specified file.

void TestGetDIB(IObjParam *ip)
{
BITMAPINFO *bmi = NULL;
BITMAPINFOHEADER *bmih;
BitmapInfo biFile;
Bitmap *map;
int size;
ip->GetMAXHWnd(), _M("Testing"));
if(!biFile.Name()[0])
return;
ViewExp *vpt = ip->GetActiveViewport();
if (!vpt->getGW()->getDIB(NULL, \&size))
return;
bmi = (BITMAPINFO *)malloc(size);
bmih = (BITMAPINFOHEADER *)bmi;
vpt->getGW()->getDIB(bmi, \&size);
biFile.SetWidth((WORD)bmih->biWidth);
biFile.SetHeight((WORD)bmih->biHeight);
map = TheManager->Create(\&biFile);
map->OpenOutput(\&biFile);
map->FromDib(bmi);
map->Write(\&biFile);
map->Close(\&biFile);
if(bmi)
free(bmi);
ip->ReleaseViewport(vpt);
}
#define NULL
Definition: autoptr.h:18
BMMExport BitmapManager * TheManager
The Primary Bitmap Manager Object.
Class for image input and output.
Definition: bitmap.h:3806
BMMExport BMMRES Write(BitmapInfo *bi, int frame=BMM_SINGLEFRAME)
Write the image from BitmapStorage to disk.
BMMExport BMMRES OpenOutput(BitmapInfo *bi)
Opens the image for output.
BMMExport int Close(BitmapInfo *bi, int flag=BMM_CLOSE_COMPLETE)
BMMExport BOOL FromDib(PBITMAPINFO pbmi)
Information about an image file or in-memory bitmap, including settings for loading/saving,...
Definition: bitmap.h:722
BMMExport WORD SetWidth(WORD s)
Definition: bitmap.h:945
BMMExport WORD SetHeight(WORD u)
Definition: bitmap.h:952
BMMExport int SetType(int s)
Definition: bitmap.h:973
BMMExport const MCHAR * Name() const
Returns the currently set path of the image file.
virtual BMMExport Bitmap * Create(BitmapInfo *bi)=0
virtual BOOL SelectFileOutput(BitmapInfo *bi, HWND hWnd, const MCHAR *title=NULL, ULONG *pflags=NULL, const MCHAR *extension=NULL, const MCHAR *config=NULL, const MCHAR *map=NULL)=0
virtual BOOL getDIB(BITMAPINFO *bmi, int *size)=0
Definition: maxapi.h:8377
virtual HWND GetMAXHWnd() const =0
Definition: maxapi.h:768
virtual GraphicsWindow * getGW()=0
#define BMM_TRUE_32
32-bit color: 8 bits each for Red, Green, Blue, and Alpha.
Definition: bitmap.h:135
#define _M(x)
Used to wrap string literals.
Definition: strbasic.h:67

◆ setBackgroundDIB()

virtual BOOL setBackgroundDIB ( int  width,
int  height,
BITMAPINFO *  bmi 
)
pure virtual
Remarks
This method is used internally to zoom the viewport.

◆ setBackgroundOffset()

virtual void setBackgroundOffset ( int  x,
int  y 
)
pure virtual
Remarks
This method is used internally to pan the viewport.

◆ useClosestTextureSize()

virtual int useClosestTextureSize ( int  bkg = FALSE)
pure virtual
Remarks
This method returns the size of the texture bitmap that the driver wants sent in to the getTextureHandle() call (if bkg is FALSE). If bkg is TRUE, this returns the size of the texture that 3ds Max should send to the setBackgroundDIB() call. In general, the return value needs to be a power of 2, though that could be driver-specific
Parameters:
int bkg=FALSE

TRUE to get the size for setBackgroundDIB(); FALSE to get the size for getTextureHandle().

◆ getTextureSize()

virtual int getTextureSize ( int  bkg = FALSE)
pure virtual
Remarks
This method returns the size of the texture bitmap that the driver wants sent in to the getTextureHandle() call (if bkg is FALSE). If bkg is TRUE, this returns the size of the texture that 3ds Max should send to the setBackgroundDIB() call. In general, the return value needs to be a power of 2, though that could be driver-specific
Parameters:
int bkg=FALSE

TRUE to get the size for setBackgroundDIB(); FALSE to get the size for getTextureHandle().

◆ getTextureHandle()

virtual DWORD_PTR getTextureHandle ( BITMAPINFO *  bmi)
pure virtual
Remarks
This method returns a handle for the specified texture bitmap. This handle is then used with the setTextureByHandle() method (there is only one current texture active at any time). The texture dimensions must be a power of 2.

When a material is on an object, and the material has a texture map, and when the button used to display the texture map is pressed, 3ds Max calls this method to get the texture handle. This basically loads the texture into the hardware RAM (if available). When this mapped object gets displayed the method setTextureHanel() is called. When the material is deleted, or the display in viewport button is turned off, freeTextureHandle() is called.
Parameters:
BITMAPINFO *bmi

The DIB image to use as a texture.
Returns
The texture handle.

◆ freeTextureHandle()

virtual void freeTextureHandle ( DWORD_PTR  handle)
pure virtual
Remarks
When you are finished with the texture handle, call this method to free it.
Parameters:
DWORD_PTR handle

The texture handle to free.
Returns
TRUE if the texture was set; otherwise FALSE.

◆ setTextureByHandle()

virtual BOOL setTextureByHandle ( DWORD_PTR  handle,
int  texStage = 0 
)
pure virtual
Remarks
This sets the current texture to the image whose handle is passed (see getTextureHandle()). The texture dimensions must be a power of 2.
Parameters:
DWORD_PTR handle

The handle of the texture to make current.

◆ setTextureColorOp()

virtual void setTextureColorOp ( int  texStage = 0,
int  texOp = GW_TEX_MODULATE,
int  texAlphaSource = GW_TEX_TEXTURE,
int  texScale = GW_TEX_SCALE_1X 
)
pure virtual
Remarks
This method returns the size of the texture bitmap that the driver wants sent in to the getTextureHandle() call (if bkg is FALSE). If bkg is TRUE, this returns the size of the texture that 3ds Max should send to the setBackgroundDIB() call. In general, the return value needs to be a power of 2, though that could be driver-specific
Parameters:
int bkg=FALSE

TRUE to get the size for setBackgroundDIB(); FALSE to get the size for getTextureHandle().

◆ setTextureAlphaOp()

virtual void setTextureAlphaOp ( int  texStage = 0,
int  texOp = GW_TEX_MODULATE,
int  texAlphaSource = GW_TEX_TEXTURE,
int  texScale = GW_TEX_SCALE_1X 
)
pure virtual
Remarks
This method returns the size of the texture bitmap that the driver wants sent in to the getTextureHandle() call (if bkg is FALSE). If bkg is TRUE, this returns the size of the texture that 3ds Max should send to the setBackgroundDIB() call. In general, the return value needs to be a power of 2, though that could be driver-specific
Parameters:
int bkg=FALSE

TRUE to get the size for setBackgroundDIB(); FALSE to get the size for getTextureHandle().

◆ setTextureTiling()

virtual BOOL setTextureTiling ( int  u,
int  v,
int  w = GW_TEX_NO_TILING,
int  texStage = 0 
)
pure virtual
Remarks
Sets the way in which textures are tiled across the surface of the object.
Parameters:
The following parameters may use one of these values:

GW_TEX_NO_TILING

The texture clamped - Any UVW that is bigger than 1 is interpreted as being 1.

GW_TEX_REPEAT

As the UVW numbers keep getting larger than 1 the image is repeated.

GW_TEX_MIRROR

If UVW goes beyond 1, the numbers are interpreted as going backwards. So if you had 0 to 2 it would actually go 0 to 1 then 1 down to 0.

int u

The type of texturing in the U direction.

int v

The type of texturing in the V direction.

int w=GW_TEX_NO_TILING

The type of texturing in the W direction.
Returns
TRUE if the tiling mode was set; otherwise FALSE.

◆ getTextureTiling()

virtual int getTextureTiling ( int  which,
int  texStage = 0 
)
pure virtual
Remarks
Returns the type of texture tiling set for the particular direction.

For example, if setTextureTiling(GW_TEX_NO_TILING, GW_TEX_REPEAT, GW_TEX_MIRROR) were called first, then

getTextureTiling(0) would yield GW_TEX_NO_TILING, and

getTextureTiling(1) would yield GW_TEX_REPEAT.
Parameters:
int which

This value is 0 or 1 and it represents the U or V direction respectively. The value 2 is not yet implemented.
Returns
GW_TEX_NO_TILING

The texture clamped - Any UVW that is bigger than 1 is interpreted as being 1.

GW_TEX_REPEAT

As the UVW numbers keep getting larger than 1 the image is repeated.

GW_TEX_MIRROR

If UVW goes beyond 1, the numbers are interpreted as going backwards. So if you had 0 to 2 it would actually go 0 to 1 then 1 down to 0.

◆ setTexTransform()

virtual void setTexTransform ( const Matrix3 m,
int  texStage = 0 
)
pure virtual
Remarks
This method allows one to put an affine transformation on a texture. This allows you to translate, rotate or scale a texture on an object.
Parameters:
const Matrix3 &m

The texture transformation matrix.

◆ beginFrame()

virtual void beginFrame ( )
pure virtual
Remarks
If a developer is working with an existing 3ds Max instance of GraphicsWindow (one of 3ds Max's viewports) this method should NOT be called.

◆ endFrame()

virtual void endFrame ( )
pure virtual
Remarks
As above, if a developer is working with an existing 3ds Max instance of GraphicsWindow (one of 3ds Max's viewports) this method should NOT be called.

◆ setViewport()

virtual void setViewport ( int  x,
int  y,
int  w,
int  h 
)
pure virtual
Remarks
This method sets the clipping boundaries within a viewport within the graphics window. This allows more than one viewport to appear within a single graphics window. It has the side-effect of building a 4x4 viewport matrix. This routine should be called any time the graphics window is resized, or else rendering will still occur to the old window size. (And since most drivers do not do range-checking since it is too time-costly, this could cause a system crash.)
Parameters:
Note: all coordinates are in Windows format, with the origin in the upper left

int x

Specifies the left viewport origin.

int y

Specifies the top viewport origin.

int w

Specifies the viewport width.

int h

Specifies the viewport height.

◆ setVirtualViewportParams()

virtual void setVirtualViewportParams ( float  zoom,
float  xOffset,
float  yOffset 
)
pure virtual
Remarks
This method is used to set up a virtual viewport. Note that this is a no-op unless GW_SPT_VIRTUAL_VPTS is TRUE. Plug-in developers should not call this method – it's for internal use only.

◆ setUseVirtualViewport()

virtual void setUseVirtualViewport ( int  onOff)
pure virtual
Remarks
This method is used to set a virtual viewport as active. Note that this is a no-op unless GW_SPT_VIRTUAL_VPTS is TRUE. Plug-in developers should not call this method – it's for internal use only.
Parameters:
int onOff

TRUE to set the virtual viewport active; FALSE to make it inactive.

◆ setTransform()

virtual void setTransform ( const Matrix3 m)
pure virtual
Remarks
Sets the current transformation matrix, and updates the modelling coordinates to normalized projection coordinates matrix. This routine also back-transforms each light and the eye point (so that lighting can be done in modelling coordinates).

This method may be used to set a matrix that transforms the point passed to the drawing methods (like text(), marker(), polyline() or polygon()). Normally these methods expect world coordinates. However if this matrix is set to an objects transformation matrix you can pass objects space coordinates and they will be transformed into world space (and then put into screen space when they are drawn). If however this is set to the identity matrix you would pass world space coordinates. You can set this matrix to the objects matrix using the following code:

gw->setTransform(inode->GetObjectTM(t));

Note: For world-to-screen space conversions by the methods text(), marker(), polyline(), polygon(), etc, a developer must explicitly set this matrix to the identity. This is because the GraphicsWindowtransform may have a non-identity matrix already in place from a previous operation.
Parameters:
const Matrix3 &m

The new current transformation matrix.

◆ getFlipped()

virtual BOOL getFlipped ( void  )
pure virtual
Remarks
This is used internally. It returns if the determinant of the current transform is positive or negative. If it's positive, 0 is returned; if it's negative, 1 is returned.

◆ getTransform()

virtual Matrix3 getTransform ( void  )
pure virtual
Remarks
This returns the "output" window handle. (Input goes to an invisible window above the viewport. The invisible window is owned by 3ds Max.)

◆ multiplePass()

virtual void multiplePass ( int  pass,
BOOL  onOff,
float  scaleFact = 1.005f 
)
pure virtual
Remarks
Call to begin or end a pass when doing multiple passes for the purpose of drawing wireframe edges over solid geometry.
Parameters
pass- indicates which pass:
  • 0 - solid geometry pass
  • 1 - wireframe pass
  • -1 - selected faces pass
onOff- TRUE indicates the start of a pass, FALSE indicates the end of a pass
scaleFact- not used

◆ setSkipCount()

virtual void setSkipCount ( int  c)
pure virtual
Remarks
Sets the number of triangles skipped when the viewport is set as a 'Fast View Display' viewport. To disable fastview, specify 1. Note that the GraphicsWindow class doesn't actually do anything with this number other than store it. Since triangles are handed down to GFX one at a time, it is up to the code that feeds triangles to the GraphicsWindow to skip the specified number of triangles. The mesh rendering in 3ds Max uses the skip count in this way.
Parameters:
int n

Specifies that every 'n-th' triangle should be drawn. If set to 2, every other triangle should be drawn.

◆ getSkipCount()

virtual int getSkipCount ( void  )
pure virtual
Remarks
Returns the current skip count setting.

◆ setRndLimits()

virtual void setRndLimits ( DWORD  l)
pure virtual
Remarks
Sets the rendering limits used by primitive calls.

Note: Setting the rendering limits is used in communication between the various parts of 3ds Max that handle the display of objects. For example, setting this limit to GW_POLY_EDGES and then drawing a polygon won't result in a polygon drawn with edges. It only sets a flag that indicates the edge should be drawn.

What happens is as follows. Inside the upper level 3ds Max, part of the code knows that polygon edges have been turned on. However this is not related through the object oriented architecture to the part of 3ds Max that does the actual drawing. When 3ds Max goes to draw objects it will see that the polygon edge flag is on. This tells it to do two drawing passed – one to do the polygon, then it calls outlinePass() call with TRUE, draws a bunch of edges, then calls outline Pass() with FALSE. Thus, the drawing routine is responsible for looking at the flags and drawing appropriately. This method is only responsible setting the limit which can later be checked.
Parameters:
DWORD l

Specifies the rendering limit used by the viewport. See Rendering Modes and Rendering Limits.

◆ getRndLimits()

virtual DWORD getRndLimits ( void  )
pure virtual
Remarks
Retrieves the rendering limits used by primitive calls. See Rendering Modes and Rendering Limits.

◆ getRndMode()

virtual DWORD getRndMode ( void  )
pure virtual
Remarks
Returns the current rendering mode used by the viewport. This is a subset of the rendering limit, in that any limits imposed by the rendering limit are forced onto the current mode. See Rendering Modes and Rendering Limits.

◆ setViewportLimits()

virtual void setViewportLimits ( DWORD  l)
pure virtual

For internal use only.

◆ getViewportLimits()

virtual DWORD getViewportLimits ( void  )
pure virtual

For internal use only.

◆ getMaxLights()

virtual int getMaxLights ( void  )
pure virtual
Remarks
Returns the maximum number of lights that may be used by the interactive renderer.

◆ setLight()

virtual void setLight ( int  num,
const Light l 
)
pure virtual
Remarks
Turns a light on or off, and sets the light parameters. The light's position is set through the current transformation matrix at the time of this call. A particular light is specified by its light number (-1 through getMaxLights()-1). Light number -1 is reserved for ambient light. If a particular field in the Light class is not needed for a particular type of light, that field's value is ignored (for example, only the color field is used for ambient light.)
Parameters:
int num

The light number of the light to set. This is a value in the range -1 to getMaxLights()-1.

const Light *l

The light class instance used to set the light parameters. If this is NULL, the light is turned off.

◆ setLightExclusion()

virtual void setLightExclusion ( DWORD  exclVec)
pure virtual
Remarks
This allows a developer to control if a light is used to render an object. There is one bit per light (bits 0 through getMaxLights()). If the bit is set the light is NOT used to render the object. If the bit is off, the light IS used. This method allows you to set the exclusion vector controlling the lights.
Parameters:
DWORD exclVec

The exclusion vector controlling the lights.

◆ setCamera()

virtual void setCamera ( const Camera c)
pure virtual
Remarks
This method is no longer used.

◆ setCameraMatrix()

virtual void setCameraMatrix ( float  mat[4][4],
Matrix3 invTM,
int  persp,
float  hither,
float  yon 
)
pure virtual
Remarks
Sets the properties of the current camera used by the GraphicsWindow.
Parameters:
float mat[4][4]

The transformation matrix times the projection matrix.

Matrix3 *invTM

This is the inverse of the affine part of the camera transformation matrix (not the inverse of the projection part).

int persp

Nonzero indicates this is a perspective view; 0 is orthogonal.

float hither

Near clip value.

float yon

Far clip value.

◆ getCameraMatrix()

virtual void getCameraMatrix ( float  mat[4][4],
Matrix3 invTM,
int persp,
float *  hither,
float *  yon 
)
pure virtual
Remarks
Retrieves the properties of the current camera.
Parameters:
float mat[4][4]

The transformation matrix times the projection matrix.

Matrix3 *invTM

This is the inverse of the affine part of the camera transformation matrix (not the inverse of the projection part).

int *persp

Nonzero indicates this is a perspective view; 0 is orthogonal.

float *hither

Near clip value.

float *yon

Far clip value.

◆ setTransparency()

virtual void setTransparency ( DWORD  settings)
pure virtual
Remarks
Sets the current transparency flags for the current pass.

Parameters:
DWORD settings

This can be a combination if GW_TRANSPARENCY and GW_TRANSPARENT_PASS See Rendering Modes and Rendering Limits. You also use these settings in the Render limits as well.

◆ setMaterial()

virtual void setMaterial ( const Material m,
int  index = 0 
)
pure virtual
Remarks
Sets the current rendering material, and modifies the rendering mode parameter for controlling the rasterizer driver. Note: You must have your rendering limit set BEFORE you set the material because the material setting may lower the rendering mode based on the material limits.
Parameters:
const Material &m

The new material to instantiate

int index=0

Indicates which material index refers to the material which gets set.

◆ getMaterial()

virtual Material* getMaterial ( void  )
pure virtual
Remarks
Returns the current rendering material.

◆ getMaxTextures()

virtual int getMaxTextures ( void  )
pure virtual

◆ hTransPoint()

virtual DWORD hTransPoint ( const Point3 in,
IPoint3 out 
)
pure virtual
Remarks
This method converts coordinates to "<b>h</b>" format device coordinates. Note: This method maps points from the GraphicsWindow's current transform to device space. If the GraphicsWindow's transform is set to the identity matrix then the mapping is done from points specified in world space. Otherwise the points given are transformed by the GraphicsWindow transform, and are then considered to be in world space. Thus, to get a world-space to screen-space conversion, you need to set the transform to the identity with gw->setTransform(Matrix3(1)).
Parameters:
const Point3 *in

The input point.

IPoint3 *out

The output point in integer format values in the native device coords for the device. For HEIDI and OpenGL the origin at the lower left. For Direct3D the origin is at the upper left.
Returns
DWORD containing the clipping flags for the point. If a flag is set it indicates the transformed point lies outside the view volume. See View Volume Clip Flags.

◆ wTransPoint()

virtual DWORD wTransPoint ( const Point3 in,
IPoint3 out 
)
pure virtual
Remarks
This method is used to convert coordinates to "<b>w</b>" format device coordinates. Note: This method maps points from the GraphicsWindow's current transform to device space. If the GraphicsWindow's transform is set to the identity matrix then the mapping is done from points specified in world space. Otherwise the points given are transformed by the GraphicsWindow transform, and are then considered to be in world space. Thus, to get a world-space to screen-space conversion, you need to set the transform to the identity with gw->setTransform(Matrix3(1)).

Parameters:
const Point3 *in

The input point.

IPoint3 *out

The output point in integer format with the origin at the upper left.
Returns
DWORD containing the clipping flags for the point. If a flag is set it indicates the transformed point lies outside the view volume. See View Volume Clip Flags.

◆ transPoint()

virtual DWORD transPoint ( const Point3 in,
Point3 out 
)
pure virtual
Remarks
This method is used to convert coordinates to "<b>h</b>" floating point coordinates. This is just a helper routine to avoid building up round-off error. 3ds Max uses it just for IK. Note: This method maps points from the GraphicsWindow's current transform to device space. If the GraphicsWindow's transform is set to the identity matrix then the mapping is done from points specified in world space. Otherwise the points given are transformed by the GraphicsWindow transform, and are then considered to be in world space. Thus, to get a world-space to screen-space conversion, you need to set the transform to the identity with gw->setTransform(Matrix3(1)).
Parameters:
const Point3 *in

The input point.

Point3 *out

The output point in floating point format with the origin at the lower left.
Returns
DWORD containing the clipping flags for the point. If a flag is set it indicates the transformed point lies outside the view volume. See View Volume Clip Flags.

◆ updateScreen()

virtual void updateScreen ( )
pure virtual
Remarks
This method is used internally and should not be called by plug-in developers.

◆ clearScreen()

virtual void clearScreen ( RECT *  rp,
int  useBkg = FALSE 
)
pure virtual
Remarks
Clears the specified rectangular region of the screen.
Parameters:
RECT *rp

Specifies the rectangular region to clear.

int useBkg = FALSE

Specifies if the background should be used to fill the cleared area. Nonzero indicate the background should be used; 0 indicates the 'clear' color should be used (see setColor() above).

◆ setColor() [1/2]

virtual void setColor ( ColorType  t,
float  r,
float  g,
float  b 
)
pure virtual
Remarks
Sets the RGB color used for the specified drawing type (line, fill, text, clear).
Parameters:
ColorType t

One of the following values:

LINE_COLOR

Line drawing color.

FILL_COLOR

Polygon fill color.

TEXT_COLOR

Text drawing color.

CLEAR_COLOR

The color that the viewport is cleared to when you call clearScreen().

GRADIENT_BOTTOM_COLOR

The bottom color of the gradient viewport ground.

NOTE: Only Nitrous and DirectX driver support this now.

GRADIENT_TOP_COLOR

The top color of the gradient viewport ground.

NOTE: Only Nitrous and DirectX driver support this now.

float r

Specifies the red amount 0.0 - 1.0.

float g

Specifies the green amount 0.0 - 1.0.

float b

Specifies the blue amount 0.0 - 1.0.

◆ setColor() [2/2]

void setColor ( ColorType  t,
Point3  clr 
)
inline
Remarks
This method is used internally and should not be called by plug-in developers.
803 { setColor(t,clr.x,clr.y,clr.z); }
virtual void setColor(ColorType t, float r, float g, float b)=0
float y
Definition: point3.h:61
float x
Definition: point3.h:60
float z
Definition: point3.h:62

◆ lightVertex()

virtual void lightVertex ( const Point3 pos,
const Point3 nor,
Point3 rgb 
)
pure virtual
Remarks
Lights a vertex, using all the current lights. The vertex appears to be transformed using the current transformation matrix, although actually the calculations are done using back-transformed light coordinates (for speed). The vertex position and normal are passed in, and a color is returned. The rendering uses the current material.
Parameters:
const Point3 &pos

Vertex position.

const Point3 &nor

Vertex normal.

Point3 &rgb

Returned color.

◆ hText()

virtual void hText ( IPoint3 xyz,
const MCHAR s 
)
pure virtual
Remarks
Draws 2D fixed font annotation text to the specified location. Note: This routine DOES perform clipping of the text if it is off the screen.
Parameters:
IPoint3 *xyz

This is the device coordinate for the text. The origin of the text is at the lower left corner.

MCHAR *s

The text to display.

◆ hMarker()

virtual void hMarker ( IPoint3 xyz,
MarkerType  type 
)
pure virtual
Remarks
Draws a marker at the specified location.
Parameters:
IPoint3 *xyz

This is the device coordinate for the marker (with the origin at the lower left).

MarkerType type

See MarkerType.

◆ hPolyline() [1/2]

virtual void hPolyline ( int  ct,
IPoint3 xyz,
Point3 rgb,
int  closed,
int es 
)
pure virtual
Remarks
This method draws a multi-segment polyline.
Parameters:
int ct

The number of points in the polyline. The maximum number of points that may be used in drawing a polyline is 32.

IPoint3 *xyz

Array of points. These are device coordinates with the origin at the lower left.

Point3 *rgb

If the shade mode is set to smooth and these colors for the vertices are specified the polyline will be drawn Gourand shaded. This is how 3ds Max draws lit wireframes for instance. If you simply want ordinary lines (drawn using the line color) pass NULL.

Note: The use of these colors is not supported under the OpenGL driver. The rgb values are ignored. Only the current material is taken into consideration. (This is how OpenGL works.)

int closed

If nonzero the first point is connected to the last point, i.e. the polyline is closed.

int *es

Edge state array. This is an array that Indicates if the 'i-th' edge is one of three state:

GW_EDGE_SKIP

Non-existent - totally invisible.

GW_EDGE_VIS

Exists and is solid.

GW_EDGE_INVIS

Exists and is hidden - shown as a dotted line.

You may pass NULL for this array and the method will assume that the edges are all solid.

◆ hPolyline() [2/2]

void hPolyline ( int  ct,
IPoint3 xyz,
Point3 rgb,
Point3 uvw,
int  closed,
int es 
)
inline
Remarks
This method is available in release 2.0 and later only.

This method draws a multi-segment polyline.
Parameters:
int ct

The number of points in the polyline. The maximum number of points that may be used in drawing a polyline is 32.

IPoint3 *xyz

Array of points. These are device coordinates with the origin at the lower left.

Point3 *rgb

If the shade mode is set to smooth and these colors for the vertices are specified the polyline will be drawn Gourand shaded. This is how 3ds Max draws lit wireframes for instance. If you simply want ordinary lines (drawn using the line color) pass NULL.

Note: The use of these colors is not supported under the OpenGL driver. The rgb values are ignored. Only the current material is taken into consideration. (This is how OpenGL works.)

Point3 *uvw

This is not currently used. Pass NULL.

int closed

If nonzero the first point is connected to the last point, i.e. the polyline is closed.

int *es

Edge state array. This is an array that Indicates if the 'i-th' edge is one of three state:

GW_EDGE_SKIP

Non-existent - totally invisible.

GW_EDGE_VIS

Exists and is solid.

GW_EDGE_INVIS

Exists and is hidden - shown as a dotted line.

You may pass NULL for this array and the method will assume that the edges are all solid.
901  { hPolyline(ct, xyz, rgb, closed, es); }
virtual void hPolyline(int ct, IPoint3 *xyz, Point3 *rgb, int closed, int *es)=0

◆ hPolygon()

virtual void hPolygon ( int  ct,
IPoint3 xyz,
Point3 rgb,
Point3 uvw,
int  texNum = 1 
)
pure virtual
Remarks
This method draws a multi-point polygon.
Parameters:
int ct

The number of points in the polygon.

IPoint3 *xyz

Array of points. These are device coordinates with the origin at the lower left.

Point3 *rgb

The color values at the vertices. The rendering mode must include GW_ILLUM for these values to be used.

Note: The use of these colors is not supported under the OpenGL driver. The rgb values are ignored. Only the current material is taken into consideration. (This is how OpenGL works.)

Point3 *uvw

The UVW coordinates. The rendering mode must include GW_TEXTURE for these values to be used.

◆ hTriStrip()

virtual void hTriStrip ( int  ct,
IPoint3 xyz,
Point3 rgb,
Point3 uvw,
int  texNum = 1 
)
pure virtual
Remarks
This method is used for drawing a series of triangles specified as 'strips'. It takes a count of 3 or more, and builds triangles in a strip. This sends a lot less data and the underlying graphics library has to set up a lot less data since it can use the previous information to start the rasterization. This results in a significant speed increase.

Note that this routine does no clipping so all the points passed must be within view.
Parameters:
int ct

The total number of points. After the first two points, each new point is used to create a new triangle.

IPoint3 *xyz

The point data with the origin at the lower left. For instance, to draw a quad, the first three points specify the first triangle and the next one is combined with the previous two to complete the square.

The order for these points follows the 'standard' conventions for stripping used in most graphics libraries (for example Direct3D, OpenGL and Heidi).

Point3 *rgb

The colors for the vertices.

Note: The use of these colors is not supported under the OpenGL driver. The rgb values are ignored. Only the current material is taken into consideration. (This is how OpenGL works.)

Point3 *uvw

The UVW texture coordinates for the vertices.

◆ wText()

virtual void wText ( IPoint3 xyz,
const MCHAR s 
)
pure virtual
Remarks
Draws 2D fixed font annotation text to the specified location. Note: This routine DOES perform clipping of the text if it is off the screen.
Parameters:
IPoint3 *xyz

This is the device coordinate for the text. The origin of the text is at the upper left corner.

MCHAR *s

The text to display.

◆ GetTextPointSize()

virtual float GetTextPointSize ( ) const
pure virtual
Remarks
Gets the unscaled size of text displayed with wText/hText. Note : Only implemented for OGS viewport. Returns 11 on other graphics windows.
Returns
The unscaled point size in points.

◆ SetTextPointSize()

virtual void SetTextPointSize ( float  )
pure virtual
Remarks
Sets the unscaled size of text displayed with wText/hText, in points. The dpi scale will be applied internally. Note : Only implemented for OGS viewport.
Parameters:
float point_size

This is the unscaled point size

◆ GetTextWidthFactor()

virtual float GetTextWidthFactor ( ) const
pure virtual
Remarks
Gets the width factor of the viewport text. Between 0.1 and 10. Note : Only implemented for OGS viewport. Returns 1 on other graphics windows.
Returns
The width factor (percentage).

◆ SetTextWidthFactor()

virtual void SetTextWidthFactor ( float  )
pure virtual
Remarks
Sets the width factor of the viewport text. Between 0.1 and 10. Note : Only implemented for OGS viewport.
Parameters:
float factor

This is the width factor (percentage)

◆ GetTextWeight()

virtual unsigned GetTextWeight ( ) const
pure virtual
Remarks
Gets the weight viewport text. Note : Only implemented for OGS viewport. Returns 400 on other graphics windows. DONTCARE = 0, THIN = 100, EXTRALIGHT = 200, ULTRALIGHT = 200, LIGHT = 300, NORMAL = 400, REGULAR = 400, MEDIUM = 500, SEMIBOLD = 600, DEMIBOLD = 600, BOLD = 700, EXTRABOLD = 800, ULTRABOLD = 800, HEAVY = 900, BLACK = 900
Returns
The weight.

◆ SetTextWeight()

virtual void SetTextWeight ( unsigned  )
pure virtual
Remarks
Sets the weight of wText/hText. Note : Only implemented for OGS viewport. DONTCARE = 0, THIN = 100, EXTRALIGHT = 200, ULTRALIGHT = 200, LIGHT = 300, NORMAL = 400, REGULAR = 400, MEDIUM = 500, SEMIBOLD = 600, DEMIBOLD = 600, BOLD = 700, EXTRABOLD = 800, ULTRABOLD = 800, HEAVY = 900, BLACK = 900
Parameters:
unsigned weight

This is the weight

◆ wMarker()

virtual void wMarker ( IPoint3 xyz,
MarkerType  type 
)
pure virtual
Remarks
Draws a marker at the specified location.
Parameters:
IPoint3 *xyz

This is the device coordinate for the marker.

MarkerType type

See MarkerType.

◆ wPolyline() [1/2]

virtual void wPolyline ( int  ct,
IPoint3 xyz,
Point3 rgb,
int  closed,
int es 
)
pure virtual
Remarks
This method draws a multi-segment polyline.
Parameters:
int ct

The number of points in the polyline. The maximum number of points that may be used in drawing a polyline is 32.

IPoint3 *xyz

Array of points. These are device coordinates with the origin at the upper left.

Point3 *rgb

If the shade mode is set to smooth and these colors for the vertices are specified the polyline will be drawn Gourand shaded. This is how 3ds Max draws lit wireframes for instance. If you simply want ordinary lines (drawn using the line color) pass NULL.

Note: The use of these colors is not supported under the OpenGL driver. The rgb values are ignored. Only the current material is taken into consideration. (This is how OpenGL works.)

int closed

If nonzero the first point is connected to the last point, i.e. the polyline is closed.

int *es

Edge state array. This is an array that Indicates if the 'i-th' edge is one of three state:

GW_EDGE_SKIP

Non-existent - totally invisible.

GW_EDGE_VIS

Exists and is solid.

GW_EDGE_INVIS

Exists and is hidden - shown as a dotted line.

You may pass NULL for this array and the method will assume that the edges are all solid.

◆ wPolyline() [2/2]

void wPolyline ( int  ct,
IPoint3 xyz,
Point3 rgb,
Point3 uvw,
int  closed,
int es 
)
inline
Remarks
This method is available in release 2.0 and later only.

This method draws a multi-segment polyline.
Parameters:
int ct

The number of points in the polyline. The maximum number of points that may be used in drawing a polyline is 32.

IPoint3 *xyz

Array of points. These are device coordinates with the origin at the upper left.

Point3 *rgb

If the shade mode is set to smooth and these colors for the vertices are specified the polyline will be drawn Gourand shaded. This is how 3ds Max draws lit wireframes for instance. If you simply want ordinary lines (drawn using the line color) pass NULL.

Note: The use of these colors is not supported under the OpenGL driver. The rgb values are ignored. Only the current material is taken into consideration. (This is how OpenGL works.)

Point3 *uvw

This is not currently used. Pass NULL.

int closed

If nonzero the first point is connected to the last point, i.e. the polyline is closed.

int *es

Edge state array. This is an array that Indicates if the 'i-th' edge is one of three state:

GW_EDGE_SKIP

Non-existent - totally invisible.

GW_EDGE_VIS

Exists and is solid.

GW_EDGE_INVIS

Exists and is hidden - shown as a dotted line.

You may pass NULL for this array and the method will assume that the edges are all solid.
1101  { wPolyline(ct, xyz, rgb, closed, es); }
virtual void wPolyline(int ct, IPoint3 *xyz, Point3 *rgb, int closed, int *es)=0

◆ wPolygon()

virtual void wPolygon ( int  ct,
IPoint3 xyz,
Point3 rgb,
Point3 uvw,
int  texNum = 1 
)
pure virtual
Remarks
This method draws a multi-point polygon.
Parameters:
int ct

The number of points in the polygon.

IPoint3 *xyz

Array of points. These are device coordinates with the origin at the upper left.

Point3 *rgb

The color values at the vertices. The rendering mode must include GW_ILLUM for these values to be used.

Note: The use of these colors is not supported under the OpenGL driver. The rgb values are ignored. Only the current material is taken into consideration. (This is how OpenGL works.)

Point3 *uvw

The UVW coordinates. The rendering mode must include GW_TEXTURE for these values to be used.

◆ wTriStrip()

virtual void wTriStrip ( int  ct,
IPoint3 xyz,
Point3 rgb,
Point3 uvw,
int  texNum = 1 
)
pure virtual
Remarks
This method is used for drawing a series of triangles specified as 'strips'. It takes a count of 3 or more, and builds triangles in a strip. This sends a lot less data and the underlying graphics library has to set up a lot less data since it can use the previous information to start the rasterization. This results in a significant speed increase.

Note that this routine does no clipping so all the points passed must be within view.
Parameters:
int ct

The total number of points. After the first two points, each new point is used to create a new triangle.

IPoint3 *xyz

The point data with the origin at the upper left. For instance, to draw a quad, the first three points specify the first triangle and the next one is combined with the previous two to complete the square.

The order for these points follows the 'standard' conventions for stripping used in most graphics libraries (for example Direct3D, OpenGL and Heidi).

Point3 *rgb

The colors for the vertices.

Note: The use of these colors is not supported under the OpenGL driver. The rgb values are ignored. Only the current material is taken into consideration. (This is how OpenGL works.)

Point3 *uvw

The UVW texture coordinates for the vertices.

◆ text()

virtual void text ( Point3 xyz,
const MCHAR s 
)
pure virtual
Remarks
Draws 2D fixed font annotation text to the specified location. This method does perform clipping.

Note: This method maps points from the GraphicsWindow's current transform to screen space. If the GraphicsWindow's transform is set to the identity matrix then the mapping is done from points specified in world space. Otherwise the points given are transformed by the GraphicsWindow transform, and are then considered to be in world space. Thus, to get a world-space to screen-space conversion, you need to set the transform to the identity with gw->setTransform(Matrix3(1)).
Parameters:
Point3 *xyz

This is the coordinate for the text.

MCHAR *s

The text to display. Note: This routine DOES perform clipping of the text if it is off the screen.

◆ startMarkers()

virtual void startMarkers ( )
pure virtual
Remarks
This method is used internally and should not be called by plug-in developers.

◆ marker()

virtual void marker ( Point3 xyz,
MarkerType  type 
)
pure virtual
Remarks
Draws a marker at the specified location in world space. This method does perform clipping.

Note: This method maps points from the GraphicsWindow's current transform to screen space. If the GraphicsWindow's transform is set to the identity matrix then the mapping is done from points specified in world space. Otherwise the points given are transformed by the GraphicsWindow transform, and are then considered to be in world space. Thus, to get a world-space to screen-space conversion, you need to set the transform to the identity with gw->setTransform(Matrix3(1)).
Parameters:
Point3 *xyz

This is the coordinate for the marker.

MarkerType type

See MarkerType.

◆ endMarkers()

virtual void endMarkers ( )
pure virtual
Remarks
This method is used internally and should not be called by plug-in developers.

◆ polyline() [1/2]

virtual void polyline ( int  ct,
Point3 xyz,
Point3 rgb,
int  closed,
int es 
)
pure virtual
Remarks
This method is used internally and should not be called by plug-in developers.

◆ polyline() [2/2]

void polyline ( int  ct,
Point3 xyz,
Point3 rgb,
Point3 uvw,
int  closed,
int es 
)
inline
Remarks
Draws a multi-segment polyline with the coordinates specified in world space. This method does perform clipping.

Note: The arrays of points and vertex related data all must be at least one element larger than the ct parameter that is passed in. The 3D clipper will use the "extra" space to clip as efficiently as possible. If room for the extra element is not provided, 3ds Max may crash.

Note: This method maps points from the GraphicsWindow's current transform to screen space. If the GraphicsWindow's transform is set to the identity matrix then the mapping is done from points specified in world space. Otherwise the points given are transformed by the GraphicsWindow transform, and are then considered to be in world space. Thus, to get a world-space to screen-space conversion, you need to set the transform to the identity with gw->setTransform(Matrix3(1)).
Parameters:
int ct

The number of points in the polyline. The maximum number of points that may be used in drawing a polyline is 32.

Point3 *xyz

Array of points. This array must be at least one element larger than the ct parameter that is passed in. The 3D clipper will use the "extra" space to clip as efficiently as possible. If room for the extra element is not provided, 3ds Max will crash.

Point3 *rgb

If the shade mode is set to smooth and these colors for the vertices are specified the polyline will be drawn Gourand shaded. This is how 3ds Max draws lit wireframes for instance. If you simply want ordinary lines (drawn using the line color) pass NULL.

Note: The use of these colors is not supported under the OpenGL driver. The rgb values are ignored. Only the current material is taken into consideration. (This is how OpenGL works.)

Point3 *uvw

This is not currently used. Pass NULL.

int closed

If nonzero the first point is connected to the last point, i.e. the polyline is closed.

int *es

Edge state array. This is an array that Indicates if the 'i-th' edge is one of three state:

GW_EDGE_SKIP

Non-existent - totally invisible.

GW_EDGE_VIS

Exists and is solid.

GW_EDGE_INVIS

Exists and is hidden - shown as a dotted line.

You may pass NULL for this array and the method will assume that the edges are all solid.
1231  { polyline(ct, xyz, rgb, closed, es); }
virtual void polyline(int ct, Point3 *xyz, Point3 *rgb, int closed, int *es)=0

◆ polylineN()

virtual void polylineN ( int  ct,
Point3 xyz,
Point3 nor,
int  closed,
int es 
)
pure virtual
Remarks
Draws a multi-segment polyline with the coordinates specified in world space. This method takes a polyline with a normal for each vertex. This is used for hardware accelerated lit wireframes (when GW_SPT_GEOM_ACCEL is TRUE).

Note: The arrays of points and vertex related data all must be at least one element larger than the ct parameter that is passed in. The 3D clipper will use the "extra" space to clip as efficiently as possible. If room for the extra element is not provided, 3ds Max may crash.

This method does perform clipping.

Note: This method maps points from the GraphicsWindow's current transform to screen space. If the GraphicsWindow's transform is set to the identity matrix then the mapping is done from points specified in world space. Otherwise the points given are transformed by the GraphicsWindow transform, and are then considered to be in world space. Thus, to get a world-space to screen-space conversion, you need to set the transform to the identity with gw->setTransform(Matrix3(1)).
Parameters:
int ct

The number of points in the polyline. The maximum number of points that may be used in drawing a polyline is 32.

Point3 *xyz

Array of points. This array must be at least one element larger than the ct parameter that is passed in. The 3D clipper will use the "extra" space to clip as efficiently as possible. If room for the extra element is not provided, 3ds Max will crash.

Point3 *nor

The normal values at the vertices, one for each vertex.

int closed

If nonzero the first point is connected to the last point, i.e. the polyline is closed.

int *es

Edge state array. This is an array that Indicates if the 'i-th' edge is one of three state:

GW_EDGE_SKIP

Non-existent - totally invisible.

GW_EDGE_VIS

Exists and is solid.

GW_EDGE_INVIS

Exists and is hidden - shown as a dotted line.

You may pass NULL for this array and the method will assume that the edges are all solid.

◆ startSegments()

virtual void startSegments ( )
pure virtual
Remarks
This method is used to begin efficiently sending a lot of 3D line segments. First call this method, then call segment() many times (with two points), then call endSegments().

◆ segment()

virtual void segment ( Point3 xyz,
int  vis 
)
pure virtual
Remarks
This method draws a single 3D line segment between the specified points. Call startSegments() once before calling this method.
Parameters:
Point3 *xyz

Points to the two line endpoints in world space.

int vis

Nonzero for the segment to be visible; zero for invisible.

◆ endSegments()

virtual void endSegments ( )
pure virtual
Remarks
Call this method after sending 3D line segments with segment().

◆ polygon()

virtual void polygon ( int  ct,
Point3 xyz,
Point3 rgb,
Point3 uvw,
int  texNum = 1 
)
pure virtual
Remarks
Draws a multi-point polygon. Note: All arrays (xyz, rgb, uvw) must be at least one element larger than the ct parameter that is passed in. The 3D clipper will use the "extra" space to clip as efficiently as possible. If room for the extra element is not provided, 3ds Max may crash.

Note: This method maps points from the GraphicsWindow's current transform to screen space. If the GraphicsWindow's transform is set to the identity matrix then the mapping is done from points specified in world space. Otherwise the points given are transformed by the GraphicsWindow transform, and are then considered to be in world space. Thus, to get a world-space to screen-space conversion, you need to set the transform to the identity with gw->setTransform(Matrix3(1)).
Parameters:
int ct

The number of points in the polygon.

Point3 *xyz

Array of points.

Point3 *rgb

The color values at the vertices. The rendering mode must include GW_ILLUM for these values to be used.

Note: The use of these colors is not supported under the OpenGL driver. The rgb values are ignored. Only the current material is taken into consideration. (This is how OpenGL works.)

Point3 *uvw

The UVW coordinates. The rendering mode must include GW_TEXTURE for these values to be used.

◆ polygonN()

virtual void polygonN ( int  ct,
Point3 xyz,
Point3 nor,
Point3 uvw,
int  texNum = 1 
)
pure virtual
Remarks
Draws a multi-point polygon. Note: All arrays (xyz, nor, uvw) must be at least one element larger than the ct parameter that is passed in. The 3D clipper will use the "extra" space to clip as efficiently as possible. If room for the extra element is not provided, 3ds Max will crash.

This method sends in normal vectors instead of color for 3D accelerated rendering (when GW_SPT_GEOM_ACCEL is TRUE)

Note: This method maps points from the GraphicsWindow's current transform to screen space. If the GraphicsWindow's transform is set to the identity matrix then the mapping is done from points specified in world space. Otherwise the points given are transformed by the GraphicsWindow transform, and are then considered to be in world space. Thus, to get a world-space to screen-space conversion, you need to set the transform to the identity with gw->setTransform(Matrix3(1)).
Parameters:
int ct

The number of points in the polygon.

Point3 *xyz

Array of points.

Point3 *nor

The normal values at the vertices, one for each vertex.

Point3 *uvw

The UVW coordinates. The rendering mode must include GW_TEXTURE for these values to be used.

◆ triStrip()

virtual void triStrip ( int  ct,
Point3 xyz,
Point3 rgb,
Point3 uvw,
int  texNum = 1 
)
pure virtual
Remarks
This method is used for drawing a series of triangles specified as 'strips'. It takes a count of 3 or more, and builds triangles in a strip. This sends a lot less data and the underlying graphics library has to set up a lot less data since it can use the previous information to start the rasterization. This results in a significant speed increase.
Parameters:
int ct

The total number of points. After the first two points, each new point is used to create a new triangle.

IPoint3 *xyz

The point data. For instance, to draw a quad, the first three points specify the first triangle and the next one is combined with the previous two to complete the square.

The order for these points follows the 'standard' conventions for stripping used in most graphics libraries (for example Direct3D, OpenGL and Heidi).

Point3 *rgb

The colors for the vertices.

Note: The use of these colors is not supported under the OpenGL driver. The rgb values are ignored. Only the current material is taken into consideration. (This is how OpenGL works.)

Point3 *uvw

The UVW texture coordinates for the vertices.

◆ triStripN()

virtual void triStripN ( int  ct,
Point3 xyz,
Point3 nor,
Point3 uvw,
int  texNum = 1 
)
pure virtual
Remarks
This method is used for drawing a series of triangles specified as 'strips'. It takes a count of 3 or more, and builds triangles in a strip. This sends a lot less data and the underlying graphics library has to set up a lot less data since it can use the previous information to start the rasterization. This results in a significant speed increase. This method sends in normal vectors instead of color for 3D accelerated rendering (when GW_SPT_GEOM_ACCEL is TRUE)
Parameters:
int ct

The total number of points. After the first two points, each new point is used to create a new triangle.

Point3 *xyz

The point data. For instance, to draw a quad, the first three points specify the first triangle and the next one is combined with the previous two to complete the square.

The order for these points follows the 'standard' conventions for stripping used in most graphics libraries (for example Direct3D, OpenGL and Heidi).

Point3 *nor

The normal for each vertex.

Point3 *uvw

The UVW texture coordinates for the vertices.

◆ startTriangles()

virtual void startTriangles ( )
pure virtual
Remarks
This method is called to begin sending a series of non-stripped triangles to render. Call this method, then any of the triangle*() methods many times, then endTriangles() to finish.

◆ triangle()

virtual void triangle ( Point3 xyz,
Point3 rgb 
)
pure virtual
Remarks
This method sends a single non-stripped triangle to render. Call startTriangles() first.

Note: This method maps points from the GraphicsWindow's current transform to screen space. If the GraphicsWindow's transform is set to the identity matrix then the mapping is done from points specified in world space. Otherwise the points given are transformed by the GraphicsWindow transform, and are then considered to be in world space. Thus, to get a world-space to screen-space conversion, you need to set the transform to the identity with gw->setTransform(Matrix3(1)).
Parameters:
Point3 *xyz

The three points for the triangle.

Point3 *rgb

The color for each vertex.

Note: The use of these colors is not supported under the OpenGL driver. The rgb values are ignored. Only the current material is taken into consideration. (This is how OpenGL works.)

◆ triangleN()

virtual void triangleN ( Point3 xyz,
Point3 nor,
Point3 uvw,
int  texNum = 1 
)
pure virtual
Remarks
This method draws a single triangle by specifying the vertex points in world space, a normal, and texture coordinates for each vertex.

Note: This method maps points from the GraphicsWindow's current transform to screen space. If the GraphicsWindow's transform is set to the identity matrix then the mapping is done from points specified in world space. Otherwise the points given are transformed by the GraphicsWindow transform, and are then considered to be in world space. Thus, to get a world-space to screen-space conversion, you need to set the transform to the identity with gw->setTransform(Matrix3(1)).
Parameters:
Point3 *xyz

The three points for the triangle.

Point3 *nor

The three normals for the triangle.

Point3 *uvw

The texture coordinate for each vertex.

◆ triangleNC()

virtual void triangleNC ( Point3 xyz,
Point3 nor,
Point3 rgb 
)
pure virtual
Remarks
This method draws a single triangle by specifying the vertex points in world space, a normal, and a color for each vertex.

Note: This method maps points from the GraphicsWindow's current transform to screen space. If the GraphicsWindow's transform is set to the identity matrix then the mapping is done from points specified in world space. Otherwise the points given are transformed by the GraphicsWindow transform, and are then considered to be in world space. Thus, to get a world-space to screen-space conversion, you need to set the transform to the identity with gw->setTransform(Matrix3(1)).
Parameters:
Point3 *xyz

The three points for the triangle.

Point3 *nor

The normal for each vertex.

Point3 *rgb

The color for each vertex.

◆ triangleNCT()

virtual void triangleNCT ( Point3 xyz,
Point3 nor,
Point3 rgb,
Point3 uvw,
int  texNum = 1 
)
pure virtual
Remarks
This method draws a single triangle by specifying the vertex points in world space, a normal, a color, and a texture coordinate for each vertex.

Note: This method maps points from the GraphicsWindow's current transform to screen space. If the GraphicsWindow's transform is set to the identity matrix then the mapping is done from points specified in world space. Otherwise the points given are transformed by the GraphicsWindow transform, and are then considered to be in world space. Thus, to get a world-space to screen-space conversion, you need to set the transform to the identity with gw->setTransform(Matrix3(1)).
Parameters:
Point3 *xyz

The three points for the triangle.

Point3 *nor

The normal for each vertex.

Point3 *rgb

The color for each vertex.

Point3 *uvw

The texture coordinate for each vertex.

◆ triangleW()

virtual void triangleW ( Point3 xyz,
int es 
)
pure virtual
Remarks
This method is used internally and should not be called by plug-in developers.

◆ triangleNW()

virtual void triangleNW ( Point3 xyz,
Point3 nor,
int es 
)
pure virtual
Remarks
This method is used internally and should not be called by plug-in developers.

◆ endTriangles()

virtual void endTriangles ( )
pure virtual
Remarks
Call this method to finish rendering triangles. See startTriangles() above.

◆ loadMeshData()

virtual void loadMeshData ( DWORD_PTR  id,
int  xyzCt,
Point3 xyz,
int  norCt,
Point3 nor,
int  texNum,
int  uvwCt,
Point3 uvw,
int  mtlCt,
Material mtl 
)
pure virtual

◆ processStrips()

virtual void processStrips ( DWORD_PTR  id,
int  stripCt,
StripTab s,
GFX_ESCAPE_FN  fn 
)
pure virtual

◆ processWireFaces()

virtual void processWireFaces ( int  xyzCt,
Point3 xyz,
int  faceCt,
GWFace face,
int  dispFlags,
BitArray faceSel,
BitArray edgeSel,
int  mtlCt,
Material mtl,
GFX_ESCAPE_FN  fn 
)
pure virtual

◆ setHitRegion()

virtual void setHitRegion ( HitRegion rgn)
pure virtual
Remarks
Sets the hit region used for hit testing. See Class HitRegion.
Parameters:
HitRegion *rgn

The hit region to use.

◆ clearHitCode()

virtual void clearHitCode ( void  )
pure virtual
Remarks
This methods clears the hit code. Call this method before performing a hit test.

◆ checkHitCode()

virtual BOOL checkHitCode ( void  )
pure virtual
Remarks
Returns TRUE if the hit code is set indicating a hit was made; otherwise FALSE.

◆ setHitCode()

virtual void setHitCode ( BOOL  h)
pure virtual
Remarks
This method allows drawing code to manually set the state of the hit code, which is returned by the checkHitCode() method. For more information see the topic on Hit Testing.

The new methods setHitDistance() and setHitCode() make it possible to work with GraphicsWindow hit-testing in otherwise impossible situations. Why are they necessary? An example from is shown below. The patch object contains bezier spline-based edges which can consist of up to 102 vertices. Since the GraphicsWindow::polyline function can only plot lines with up to 32 vertices, it is impossible to plot these in a single call to the polyline function. Multiple calls to the polyline call do not return a proper hitcode when using a "window"-type hit region. By using the new setHitCode() method, code can properly handle this situation. The code below shows the function in use from the PatchMesh::renderEdge method:
int steps = GetMeshSteps();
int segNum = steps+2;
float fsegNum = (float) (segNum-1);
// If steps are too high for GraphicsWindow's buffer, we must draw it
manually
if((steps + 2) > GW_MAX_VERTS) {
Point3 line[2];
Point3 prev,current(.0f,.0f,.0f);
BOOL hitAll = TRUE;
BOOL hitAny = FALSE;
DWORD hitDist = 0xffffffff;
for(int terp = 0; terp \
{
prev = current;
current = work.InterpCurve3D((float)terp / fsegNum);
if (terp != 0)
{
line[0] = prev;
line[1] = current;
gw->clearHitCode();
gw->polyline(2, line, NULL, NULL, 0, NULL);
if(gw->checkHitCode()) {
hitAny = TRUE;
if(gw->getHitDistance() \
hitDist = gw->getHitDistance();
}
else hitAll = FALSE;
}
}
if(hr && !hr->crossing && hr->type != POINT_RGN)
gw->setHitCode(hitAll);
else
gw->setHitCode(hitAny);
gw->setHitDistance(hitDist);
} else {
for(int terp = 0; terp \
fixedBuf[terp] = work.InterpCurve3D((float)terp /
fsegNum);
gw->polyline(steps+2, fixedBuf, NULL, NULL, 0, NULL);
}
Definition: point3.h:56
#define GW_MAX_VERTS
Definition: GraphicsConstants.h:172
#define POINT_RGN
Definition: GraphicsConstants.h:136

Note that the gw->polyline call is preceded by a call to clearHitCode(), and followed by code which checks the hit code, maintaining "hitAny" and "hitAll" flags. When all the segments are drawn, the gw->setHitCode() call is made, setting the hit code depending on the hit region type. When the code which called this function checks the GraphicsWindow's hit code, it will contain the proper value. This code also keeps track of the closest hit distance and places that into the GraphicsWindow when all line segments are drawn.
Parameters:
BOOL h

Set to TRUE if the hit code is set, otherwise FALSE.

◆ getHitDistance()

virtual DWORD getHitDistance ( void  )
pure virtual
Remarks
If checkHitCode() returns TRUE you may call this method to return the hit distance. In wireframe mode this is the distance to the line. In shaded mode, this is the z distance. This allows you to perform 'smart' hit testing by choosing the item with the smallest hit distance. This method only returns meaningful values when the hit region is a point.

◆ setHitDistance()

virtual void setHitDistance ( DWORD  d)
pure virtual
Remarks
This method allows drawing code to manually set the hit distance, which is returned by the getHitDistance() method. For more information see the topic on Hit Testing.
Parameters:
DWORD d

In wireframe mode this is the distance to the line. In shaded mode, this is the z distance.

◆ interpWorld()

virtual float interpWorld ( Point3 world1,
Point3 world2,
float  sParam,
Point3 interpPt 
)
pure virtual
Remarks
This method is used internally.

◆ hitTestHMarker()

virtual DllExport void hitTestHMarker ( const IPoint3 xyz,
MarkerType  type,
GfxPickResult res 
) const
virtual
Remarks
These functions are avaliable for pick-only graphic window.
Note this function is expected to be reentrant with the pick-only graphic window provided by the system.

◆ hitTestMarker()

virtual DllExport void hitTestMarker ( const Point3 xyz,
MarkerType  type,
GfxPickResult res 
) const
virtual
Remarks
Sets the hit region used for hit testing. See Class HitRegion.
Parameters:
HitRegion *rgn

The hit region to use.

◆ hitTestPolyline()

virtual DllExport void hitTestPolyline ( int  ct,
const Point3 xyz,
int  closed,
int es,
GfxPickResult res 
) const
virtual
Remarks
Sets the hit region used for hit testing. See Class HitRegion.
Parameters:
HitRegion *rgn

The hit region to use.

◆ hitTestPolylineN()

virtual DllExport void hitTestPolylineN ( int  ct,
const Point3 xyz,
int  closed,
int es,
GfxPickResult res 
) const
virtual
Remarks
Sets the hit region used for hit testing. See Class HitRegion.
Parameters:
HitRegion *rgn

The hit region to use.

◆ hitTestHPolyline()

virtual DllExport void hitTestHPolyline ( int  ct,
const IPoint3 xyz,
int  closed,
int es,
GfxPickResult res 
) const
virtual
Remarks
Sets the hit region used for hit testing. See Class HitRegion.
Parameters:
HitRegion *rgn

The hit region to use.

◆ hitTestPolygon()

virtual DllExport void hitTestPolygon ( int  ct,
const Point3 xyz,
GfxPickResult res 
) const
virtual
Remarks
Sets the hit region used for hit testing. See Class HitRegion.
Parameters:
HitRegion *rgn

The hit region to use.

◆ hitTestPolygonN()

virtual DllExport void hitTestPolygonN ( int  ct,
const Point3 xyz,
GfxPickResult res 
) const
virtual
Remarks
Sets the hit region used for hit testing. See Class HitRegion.
Parameters:
HitRegion *rgn

The hit region to use.

◆ hitTestHPolygon()

virtual DllExport void hitTestHPolygon ( int  ct,
const IPoint3 xyz,
GfxPickResult res 
) const
virtual
Remarks
Sets the hit region used for hit testing. See Class HitRegion.
Parameters:
HitRegion *rgn

The hit region to use.

◆ isPerspectiveView()

virtual int isPerspectiveView ( void  )
pure virtual
Remarks
Returns TRUE if the view is in perspective projection; otherwise FALSE (orthographic projection).

◆ MarkerBufferSetMarkerType()

virtual void MarkerBufferSetMarkerType ( MarkerType  type)
inlinevirtual
1604 {};

◆ MarkerGetDXColor()

virtual DWORD MarkerGetDXColor ( Point3  p)
inlinevirtual
1605 {return 0;};

◆ MarkerBufferLock()

virtual VertexBuffer* MarkerBufferLock ( )
inlinevirtual
1607 { return NULL;};

◆ MarkerBufferUnLock()

virtual void MarkerBufferUnLock ( )
inlinevirtual
1608 {};

◆ MarkerBufferSize()

virtual int MarkerBufferSize ( )
inlinevirtual
1609 {return 0;};

◆ MarkerBufferStride()

virtual int MarkerBufferStride ( )
inlinevirtual
1610 { return 0;};

◆ MarkerBufferDraw()

virtual void MarkerBufferDraw ( int  numberOfMarkers)
inlinevirtual
1611 {};

◆ LineGetDXColor()

virtual DWORD LineGetDXColor ( Point3  p)
inlinevirtual
1614 {return 0;};

◆ LineBufferLock()

virtual LineBuffer* LineBufferLock ( )
inlinevirtual
1616 { return NULL;};

◆ LineBufferUnLock()

virtual void LineBufferUnLock ( )
inlinevirtual
1617 {};

◆ LineBufferSize()

virtual int LineBufferSize ( )
inlinevirtual
1618 {return 0;};

◆ LineBufferStride()

virtual int LineBufferStride ( )
inlinevirtual
1619 { return 0;};

◆ LineBufferDraw()

virtual void LineBufferDraw ( int  numberOfSegments)
inlinevirtual
1620 {};

◆ escape()

virtual void escape ( GFX_ESCAPE_FN  fn,
void data 
)
pure virtual

◆ getDepthValue()

virtual BOOL getDepthValue ( float  x,
float  y,
float *  z 
)
inlinevirtual
Remarks
This method calculates the depth value of the screen pixel located at positon x,y. This method returns TRUE if the depth value is calculated, FALSE otherwise. It is currently supported in Direct3D and OpenGL driver. Thus returning FALSE for unsupported driver. This method is used to locate center pivot in SteeringWheel.
Parameters
[in]xThe x coordinate in screen space.
[in]yThe y coordinate in screen space.
[out]zA pointer to the buffer that receives the calculated depth value.
Returns
TRUE if calculated correctly, FALSE if the method failed or not supported.
1632 { return FALSE; }

◆ clearViewportDepth()

virtual void clearViewportDepth ( RECT *  r)
inlinevirtual
Remarks
This method will clear the depth buffer bits of this GraphicsWindow. It is currently supported in Direct3D and OpenGL driver. This method is used clear the depth before actually drawing the ViewCube, which cannot be messed up with the scene geometry.
1638 {};

◆ CreateHWDrawMesh()

virtual GFX_MESH::IHWSubMesh* CreateHWDrawMesh ( GFX_MESH::HWTupleMesh hwMesh)
inlinevirtual
Remarks
This take a GFX_MESH::HWTupleMesh and creates a hardware specific mesh buffers
Parameters
[in]hwMeshthe mesh used to create the Hardware specific buffers.
Returns
the hardware specific IHWDrawMesh.
1643 {return NULL;};

◆ DrawHWDrawMesh()

virtual void DrawHWDrawMesh ( GFX_MESH::HWTupleMesh hwMesh)
inlinevirtual
Remarks
This draws the hwMesh to the display. If the hardware mesh holds a valid IHWDrawMesh it will use that to draw the mesh in retained mode. Otherwise the buffers in the hwmesh will be used to draw the mesh in immediate mode which is much slower.
Parameters
[in]hwMeshthe mesh to be drawn.
1649 {};