3ds Max C++ API Reference
GBufReader Class Referenceabstract

#include <gbuf.h>

+ Inheritance diagram for GBufReader:

Public Member Functions

virtual int StartLine (int y)=0
 
virtual BOOL StartPixel (int x)=0
 
virtual BOOL StartPixel (int x, int y)=0
 
virtual BOOL StartNextLayer ()=0
 
virtual int NextPixel ()=0
 
virtual BOOL ReadChannelData (int chan, void *data)=0
 
virtual BOOL ReadAllData (GBufData *data)=0
 
virtual BOOL ModifyChannelData (int chan, void *data)=0
 
virtual BOOL ModifyAllData (GBufData *data)=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 GBufWriter, Structure GBufData, G-Buffer Channel Indices
Description:
This is the object returned by GBuffer::CreateReader(). Methods of this class allow the G-Buffer data to be read.

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

void ReadExample(GBuffer *gb)
{
float zr, UBYTE midr;
GBufReader *rdr = gb->CreateReader();
for (int y=0; y<10; y++) {
rdr->StartLine(y);
for (int x=5; x<100; x+=4) {
int res = rdr->StartPixel(x);
rdr->ReadChannelData(GB_Z,(void *)&zr);
rdr->ReadChannelData(GB_MTL_ID,(void *)&midr);
while (rdr->StartNextLayer()) {
rdr->ReadChannelData(GB_Z,(void *)&zr);
rdr->ReadChannelData(GB_MTL_ID,(void *)&midr);
}
}
}
gb->DestroyReader(rdr);
}
Definition: gbuf.h:310
virtual BOOL ReadChannelData(int chan, void *data)=0
virtual BOOL StartPixel(int x)=0
virtual int StartLine(int y)=0
virtual BOOL StartNextLayer()=0
Definition: gbuf.h:594
virtual GBufReader * CreateReader()=0
virtual void DestroyReader(GBufReader *pRdr)=0
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
uchar UBYTE
Definition: maxtypes.h:24
All methods of this class are implemented by the System.

Member Function Documentation

◆ StartLine()

virtual int StartLine ( int  y)
pure virtual
Remarks
Call this method to start a new scan line. Call this method before the first scan line.
Parameters:
int y

The zero based index of the scan line to start.
Returns
Returns -1 if there was no data for line, or the x value of first non-empty pixel.

◆ StartPixel() [1/2]

virtual BOOL StartPixel ( int  x)
pure virtual
Remarks
Call this method to start a new pixel. This method automatically starts the first layer.
Parameters:
int x

The zero based index of the pixel to start.
Returns
Returns TRUE.

◆ StartPixel() [2/2]

virtual BOOL StartPixel ( int  x,
int  y 
)
pure virtual
Remarks
This method is called to start a new line and pixel. This method is equivalent to:

StartLine(y);

return StartPixel(x);

◆ StartNextLayer()

virtual BOOL StartNextLayer ( )
pure virtual
Remarks
This method is called to begin reading data from a new layer. Do not call this method before reading the first layer.
Returns
TRUE if more data to read; otherwise FALSE.

◆ NextPixel()

virtual int NextPixel ( )
pure virtual
Remarks
Call this method to prepare for reading the next pixel.
Returns
Returns TRUE.

◆ ReadChannelData()

virtual BOOL ReadChannelData ( int  chan,
void data 
)
pure virtual
Remarks
Reads a data element from the specified channel of the G-Buffer from the current scan line and pixel.
Parameters:
The channel to read. One of the items from: G-Buffer Channel Indices void *data

Points to storage for the data.
Returns
TRUE if data was available; otherwise FALSE.

◆ ReadAllData()

virtual BOOL ReadAllData ( GBufData data)
pure virtual
Remarks
Reads all the data from the G-Buffer into the GBufData structure passed from the current scan line and pixel.
Parameters:
GBufData *data

Points to storage for the data. See Structure GBufData.
Returns
TRUE if data was available; otherwise FALSE.

◆ ModifyChannelData()

virtual BOOL ModifyChannelData ( int  chan,
void data 
)
pure virtual
Remarks
This method allows values in the specified layer to be written. Note that it may seem strange, writing data from the reader, but developers asked for the capability of writing to the already created gbuffer, and it is much simpler to add this capability to the GBufReader than to GBufWriter, which is designed to construct gbuffers from scratch, not modify existing ones.
Parameters:
int chan

Specifies the channel to write to.

void *data

Points to the data to write.
Returns
TRUE indicates success; FALSE indicates failure.

◆ ModifyAllData()

virtual BOOL ModifyAllData ( GBufData data)
pure virtual
Remarks
This method allows values in the current layer to be written. Note that it may seem strange, writing data from the reader, but developers asked for the capability of writing to the already created gbuffer, and it is much simpler to add this capability to the GBufReader than to GBufWriter, which is designed to construct gbuffers from scratch, not modify existing ones.
Parameters:
GBufData *data

Points to the data to write.
Returns
TRUE indicates success; FALSE indicates failure.

◆ DeleteThis()

virtual void DeleteThis ( )
pure virtual
Remarks
Deletes this reader object. Call this method when finished.

◆ Execute()

virtual INT_PTR Execute ( int  cmd,
ULONG_PTR  arg1 = 0,
ULONG_PTR  arg2 = 0,
ULONG_PTR  arg3 = 0 
)
inlinevirtual
Remarks
This is a general purpose function that allows the API to be extended in the future. The 3ds Max development team can assign new cmd numbers and continue to add functionality to this class without having to 'break' the API.

This is reserved for future use.
Parameters:
int cmd

The command to execute.

ULONG arg1=0

Optional argument 1 (defined uniquely for each cmd).

ULONG arg2=0

Optional argument 2.

ULONG arg3=0

Optional argument 3.
Returns
An integer return value (defined uniquely for each cmd).
Default Implementation:
{ return 0; }
401 { return 0; }