Detailed Description
- See also:
- Class GBuffer,
Class GBufReader,
Structure GBufData,
G-Buffer
Channel Indices.
- Description:
- This class is available in release 3.0 and later only.
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.
GBuffer *gb = NewDefaultGBuffer();
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);
wrt->StartNextLayer();
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);
Color24 c;
c.r = 10+x; c.g = 20+x; c.b = 30+x;
wrt->WriteChannelData(GB_BG,(void *)&c);
wrt->StartNextLayer();
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) {
wrt->StartNextLayer();
z = 17.0f*float(x)*float(y);
wrt->WriteChannelData(GB_Z,(void *)&z);
mid = 64+x;
wrt->WriteChannelData(GB_MTL_ID,(void
*)&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);
All methods of this class are implemented by the System.
#include <gbuf.h>
List of all
members.
Member Function Documentation
virtual void StartLine |
( |
int |
y |
) |
[pure virtual] |
- Parameters:
- int y
The zero based index of the scan line to start.
virtual void StartPixel |
( |
int |
x |
) |
[pure virtual] |
- Parameters:
- int x
The zero based index of the pixel to start.
virtual void StartNextLayer |
( |
|
) |
[pure virtual] |
virtual BOOL WriteChannelData |
( |
int |
chan, |
|
|
void * |
data |
|
) |
|
[pure virtual] |
- 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.
virtual BOOL WriteAllData |
( |
GBufData * |
data |
) |
[pure virtual] |
- Parameters:
- GBufData
*data
Points to the G-Buffer data to write. See Structure GBufData.
- Returns:
- TRUE on success; FALSE on failure.
virtual BOOL EndLine |
( |
|
) |
[pure virtual] |
- Returns:
- TRUE on success; FALSE on failure.
virtual void DeleteThis |
( |
|
) |
[pure virtual] |
virtual INT_PTR Execute |
( |
int |
cmd, |
|
|
ULONG_PTR |
arg1 = 0 , |
|
|
ULONG_PTR |
arg2 = 0 , |
|
|
ULONG_PTR |
arg3 = 0 |
|
) |
|
[inline, virtual] |
GBufWriter GBufWriter GBufWriter
GBufWriter GBufWriter GBufWriter GBufWriter GBufWriter GBufWriter
GBufWriter
GBufWriter GBufWriter GBufWriter
GBufWriter GBufWriter GBufWriter GBufWriter GBufWriter GBufWriter
GBufWriter