3ds Max C++ API Reference
GBufWriter Class Referenceabstract

#include <gbuf.h>

+ Inheritance diagram for GBufWriter:

Public Member Functions

virtual void StartLine (int y)=0
 
virtual void StartPixel (int x)=0
 
virtual void StartNextLayer ()=0
 
virtual BOOL WriteChannelData (int chan, void *data)=0
 
virtual BOOL WriteAllData (GBufData *data)=0
 
virtual BOOL EndLine ()=0
 
virtual void DeleteThis ()=0
 
virtual INT_PTR Execute (int cmd, ULONG_PTR arg1=0, ULONG_PTR arg2=0, ULONG_PTR arg3=0)
 
- 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 GBuffer, Class GBufReader, Structure GBufData, G-Buffer Channel Indices
Description:
This is the writer object returned from GBuffer::CreateWriter(). This class assumes pixels are created in increasing order of x.

Here is an example of writing multiple layer data to the G-Buffer using methods of this class.

gb->SetRasterSize(100,10);
gb->CreateChannels((1<<GB_Z)|(1<<GB_MTL_ID)|(1<<GB_BG));
gb->InitBuffer();
GBufWriter *wrt = gb->CreateWriter();
for (int y=0; y<10; y++)
{
wrt->StartLine(y);
BOOL bb = 0;
for (int x=5; x<100; x+=4) {
wrt->StartPixel(x);
float z = 5.0f*float(x)*float(y);
wrt->WriteChannelData(GB_Z,(void *)&z);
UBYTE mid = 36+x;
wrt->WriteChannelData(GB_MTL_ID,(void *)&mid);
c.r = 10+x; c.g = 20+x; c.b = 30+x;
wrt->WriteChannelData(GB_BG,(void *)&c);
z = 15.0f*float(x)*float(y);
wrt->WriteChannelData(GB_Z,(void *)&z);
mid = 26+x;
wrt->WriteChannelData(GB_MTL_ID,(void *)&mid);
c.r =30+x; c.g = 20+x; c.b = 10+x;
wrt->WriteChannelData(GB_BG,(void *)&c);
if (bb) {
z = 17.0f*float(x)*float(y);
wrt->WriteChannelData(GB_Z,(void *)&z);
mid = 64+x;
)&mid);
c.r = 130+x; c.g = 120+x; c.b = 110+x;
wrt->WriteChannelData(GB_BG,(void *)&c);
}
bb = !bb;
}
wrt->EndLine();
}
gb->DestroyWriter(wrt);
Definition: gbuf.h:460
virtual void StartNextLayer()=0
virtual void StartPixel(int x)=0
virtual BOOL WriteChannelData(int chan, void *data)=0
virtual BOOL EndLine()=0
virtual void StartLine(int y)=0
Definition: gbuf.h:594
virtual int InitBuffer()=0
virtual GBufWriter * CreateWriter()=0
virtual void DestroyWriter(GBufWriter *pRdr)=0
virtual ULONG CreateChannels(ULONG channelMask)=0
virtual void SetRasterSize(int ww, int hh)=0
CoreExport GBuffer * NewDefaultGBuffer()
controller mat max min numsubs x z controller keys x z controller keys x z
Definition: generics.inl:214
controller mat max min numsubs x z controller keys x z controller keys x
Definition: generics.inl:212
#define GB_Z
(4) Z-Buffer depth, float
Definition: gbuf.h:30
#define GB_MTL_ID
(1) ID assigned to mtl via mtl editor
Definition: gbuf.h:31
#define GB_BG
(3) RGB color of what's behind the front object
Definition: gbuf.h:37
uchar UBYTE
Definition: maxtypes.h:24
8 bits for each of the Red, Green and Blue components.
Definition: maxtypes.h:33
uint8_t g
Definition: maxtypes.h:37
uint8_t b
Definition: maxtypes.h:37
uint8_t r
Definition: maxtypes.h:37
All methods of this class are implemented by the System.

Member Function Documentation

◆ StartLine()

virtual void StartLine ( int  y)
pure virtual
Remarks
This method should be called before writing every line.
Parameters:
int y

The zero based index of the scan line to start.

◆ StartPixel()

virtual void StartPixel ( int  x)
pure virtual
Remarks
This method must be called before writing each pixel and must be called with increasing x values on a line.
Parameters:
int x

The zero based index of the pixel to start.

◆ StartNextLayer()

virtual void StartNextLayer ( )
pure virtual
Remarks
This method must be called before writing the first layer.

◆ WriteChannelData()

virtual BOOL WriteChannelData ( int  chan,
void data 
)
pure virtual
Remarks
Call this method to write a data element to the specified channel of the G-Buffer to the current scan line and pixel.
Parameters:
int chan

See G-Buffer Channel Indices void *data

Points to the G-Buffer data to write.
Returns
TRUE on success; FALSE on failure.

◆ WriteAllData()

virtual BOOL WriteAllData ( GBufData data)
pure virtual
Remarks
This method writes all the channel data from the GBufData structure passed to the current scan line and pixel.
Parameters:
GBufData *data

Points to the G-Buffer data to write. See Structure GBufData.
Returns
TRUE on success; FALSE on failure.

◆ EndLine()

virtual BOOL EndLine ( )
pure virtual
Remarks
This method should be called after writing each line.
Returns
TRUE on success; FALSE on failure.

◆ DeleteThis()

virtual void DeleteThis ( )
pure virtual
Remarks
Deletes this writer object. Call this method when finished using it.

◆ Execute()

virtual INT_PTR Execute ( int  cmd,
ULONG_PTR  arg1 = 0,
ULONG_PTR  arg2 = 0,
ULONG_PTR  arg3 = 0 
)
inlinevirtual
502 { return 0; }