3ds Max C++ API Reference
ImmediateFragment Class Reference

ImmediateFragment is a class which let application render primitives outside the render loop. More...

#include <ImmediateFragment.h>

+ Inheritance diagram for ImmediateFragment:

Public Member Functions

GraphicsDriverAPI ImmediateFragment ()
 
GraphicsDriverAPI ImmediateFragment (const ImmediateFragment &from)
 
GraphicsDriverAPI ImmediateFragmentoperator= (const ImmediateFragment &from)
 
virtual GraphicsDriverAPI ~ImmediateFragment ()
 
virtual GraphicsDriverAPI bool Initialize ()
 Initialize the handle. More...
 
virtual GraphicsDriverAPI bool Begin ()
 Begin a frame Application must call ImmediateFragment::Begin() before any other methods and call ImmediateFragment::End() when rendering is complete. More...
 
virtual GraphicsDriverAPI void End ()
 End a frame Application must call ImmediateFragment::End() before calling ImmediateFragment::Begin() again. More...
 
virtual GraphicsDriverAPI void SetTarget (const TargetHandle &target)
 Sets a target to the device, any drawing method will render primitives on this target The viewport will be set to full size of this target. More...
 
virtual GraphicsDriverAPI TargetHandle GetTarget () const
 Gets current target. More...
 
virtual GraphicsDriverAPI bool Clear (const Color &color)
 Clear current target by color Internally this method also clears the depth buffer attached with the color buffer. More...
 
virtual GraphicsDriverAPI bool DrawCallback (const IDisplayCallbackPtr &pCallback)
 Calls IDisplayCallback::Display() function to do the render jobs Note the callback doesn't relate to any of the viewport. More...
 
virtual GraphicsDriverAPI void SetUseDepthTarget (bool bUse)
 Indicates this fragment if using one depth-stencil buffer.The buffer will not be created internally when the fragment is initialized. More...
 
virtual GraphicsDriverAPI void SetWorldMatrix (const Matrix44 &matrix)
 Set current world matrix. More...
 
- Public Member Functions inherited from SmartHandle
virtual GraphicsDriverAPI ~SmartHandle ()
 destructor More...
 
GraphicsDriverAPI bool IsValid () const
 Check if this handle is valid. More...
 
GraphicsDriverAPI void Release ()
 Release the underlying graphics objects. More...
 
GraphicsDriverAPI Identifier GetObjectID () const
 Get the underlying graphics object id. More...
 
GraphicsDriverAPI void SetPointer (IRefObject *pObject)
 
GraphicsDriverAPI IRefObjectGetPointer () const
 Get the underlying graphics object pointer. More...
 
bool operator== (const SmartHandle &rhs) const
 
bool operator!= (const SmartHandle &rhs) const
 
bool operator< (const SmartHandle &rhs) const
 
bool operator<= (const SmartHandle &rhs) const
 
bool operator> (const SmartHandle &rhs) const
 
bool operator>= (const SmartHandle &rhs) const
 
GraphicsDriverAPI SmartHandle (const SmartHandle &)
 
GraphicsDriverAPI SmartHandleoperator= (const SmartHandle &)
 

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...
 
- Protected Member Functions inherited from SmartHandle
GraphicsDriverAPI SmartHandle ()
 
- Protected Attributes inherited from SmartHandle
IRefObjectmpObject
 

Detailed Description

ImmediateFragment is a class which let application render primitives outside the render loop.

Application can create this fragment instance like mouse proc, render primitives onto a separate target and then present it to a separate window or draw it to viewport via retain mode. Typical usage should be: ImmediateFragment renderFrag; renderFrag.Initialize(); if (renderFrag.Begin()) { renderFrag.SetTarget(); renderFrag.Clear(); renderFrag.DrawCallback(); renderFrag.End(); }

Constructor & Destructor Documentation

◆ ImmediateFragment() [1/2]

◆ ImmediateFragment() [2/2]

◆ ~ImmediateFragment()

virtual GraphicsDriverAPI ~ImmediateFragment ( )
virtual

Member Function Documentation

◆ operator=()

◆ Initialize()

virtual GraphicsDriverAPI bool Initialize ( )
virtual

Initialize the handle.

Must be called before using it.

Returns
true if success.

◆ Begin()

virtual GraphicsDriverAPI bool Begin ( )
virtual

Begin a frame Application must call ImmediateFragment::Begin() before any other methods and call ImmediateFragment::End() when rendering is complete.

ImmediateFragment::Begin()/End() pair can't nest. If the function return false, other methods also fail and won't do anything. And no need to call ImmediateFragment::End()

◆ End()

virtual GraphicsDriverAPI void End ( )
virtual

End a frame Application must call ImmediateFragment::End() before calling ImmediateFragment::Begin() again.

This method sends jobs to internal render queue. And application must call this method before presenting a target.

◆ SetTarget()

virtual GraphicsDriverAPI void SetTarget ( const TargetHandle target)
virtual

Sets a target to the device, any drawing method will render primitives on this target The viewport will be set to full size of this target.

Application must set a target to the device. There's no default render target after ImmediateFragment::Begin(). This because current rendering viewport is undefined outside the nitrous thread. Internally, there will be a same size depth target set with the target. Application can control depth behavior via IPrimitiveRenderer. /param[in] target can either be TargetHandle or PresentableTargetHandle

◆ GetTarget()

virtual GraphicsDriverAPI TargetHandle GetTarget ( ) const
virtual

Gets current target.

Default target is NULL after ImmediateFragment::Begin(). This method /returns target set by previous SetTarget() function.

◆ Clear()

virtual GraphicsDriverAPI bool Clear ( const Color color)
virtual

Clear current target by color Internally this method also clears the depth buffer attached with the color buffer.

/param[in] color The color after target is cleared. Typically it's Color(0,0,0). /return true if successfully cleared the target

◆ DrawCallback()

virtual GraphicsDriverAPI bool DrawCallback ( const IDisplayCallbackPtr pCallback)
virtual

Calls IDisplayCallback::Display() function to do the render jobs Note the callback doesn't relate to any of the viewport.

So all members of DisplayCallbackContext in DoDisplay() function remain default value. You can't get ViewExp and CurrentNode in the ImmediateFragment /param[in] user define IDisplayCallback class instance. /return false if any error like not calling ImmediateFragment::Begin() or ImmediateFragment::SetTarget()

◆ SetUseDepthTarget()

virtual GraphicsDriverAPI void SetUseDepthTarget ( bool  bUse)
virtual

Indicates this fragment if using one depth-stencil buffer.The buffer will not be created internally when the fragment is initialized.

/param[in] bUse this fragment will use one depth-stencil buffer or not.

◆ SetWorldMatrix()

virtual GraphicsDriverAPI void SetWorldMatrix ( const Matrix44 matrix)
virtual

Set current world matrix.

/param matrix new world matrix.