Go to the
documentation of this file.
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #pragma once
00015 #include "coreexp.h"
00016 #include "maxheap.h"
00017 #include "strbasic.h"
00018 #include "maxtypes.h"
00019 #include "point2.h"
00020 #include "color.h"
00021 #include "baseinterface.h"
00022
00023 class NameTab;
00024
00025 #define NUMGBCHAN 14
00026
00030 #define GB_Z 0 //!< (4) Z-Buffer depth, float
00031 #define GB_MTL_ID 1 //!< (1) ID assigned to mtl via mtl editor
00032 #define GB_NODE_ID 2 //!< (2) ID assigned to node via properties
00033 #define GB_UV 3 //!< (8) UV coordinates - Point2
00034 #define GB_NORMAL 4 //!< (4) Normal vector in view space, compressed
00035 #define GB_REALPIX 5 //!< (4) Non-clamped colors in "RealPixel" format
00036 #define GB_COVERAGE 6 //!< (1) Pixel coverage of the front surface
00037 #define GB_BG 7 //!< (3) RGB color of what's behind the front object
00038 #define GB_NODE_RENDER_ID 8 //!< (2) System node number, valid during a render
00039 #define GB_COLOR 9 //!< (3) Color (RGB)
00040 #define GB_TRANSP 10 //!< (3) Transparency (RGB)
00041 #define GB_VELOC 11 //!< (8) Velocity (Point2)
00042 #define GB_WEIGHT 12 //!< (3) Weight of layers contribution to pixel color
00043 #define GB_MASK 13 //!< (2) Sub pixel coverage mask
00044
00045
00050 CoreExport int GBDataSize(int i);
00051
00071 CoreExport MCHAR* GBChannelName(int i);
00072
00073
00074
00085 #define BMM_CHAN_NONE 0
00086
00111 #define BMM_CHAN_Z (1<<GB_Z) //!< Z-buffer depth, float
00112
00121 #define BMM_CHAN_MTL_ID (1<<GB_MTL_ID) //!< ID assigned to the material via the Material Editor.
00122
00128 #define BMM_CHAN_NODE_ID (1<<GB_NODE_ID) //!< ID assigned to node using the Object Properties / G-buffer ID spinner.
00129
00138 #define BMM_CHAN_UV (1<<GB_UV) //!< UV coordinates, stored as Point2.
00139
00153 #define BMM_CHAN_NORMAL (1<<GB_NORMAL) //!< Normal vector in view space, compressed
00154
00161 #define BMM_CHAN_REALPIX (1<<GB_REALPIX) //!< Non clamped colors in "RealPixel" format
00162
00170 #define BMM_CHAN_COVERAGE (1<<GB_COVERAGE) //!< Pixel coverage of front surface
00171
00180 #define BMM_CHAN_BG (1<<GB_BG) //!< RGB color of what's behind front object
00181
00191 #define BMM_CHAN_NODE_RENDER_ID (1<<GB_NODE_RENDER_ID) //!< System node number - valid during a render.
00192
00197 #define BMM_CHAN_COLOR (1<<GB_COLOR) //!< Color returned by the material shader for the fragment.
00198
00203 #define BMM_CHAN_TRANSP (1<<GB_TRANSP) //!< Transparency returned by the material shader for the fragment.
00204
00209 #define BMM_CHAN_VELOC (1<<GB_VELOC) //!< Gives the velocity vector of the fragment relative to the screen, in screen coordinates.
00210
00229 #define BMM_CHAN_WEIGHT (1<<GB_WEIGHT) //!< The sub-pixel weight of a fragment.
00230
00231 #define BMM_CHAN_MASK (1<<GB_MASK) //!< Subpixel mask
00232
00233
00239 #define BMM_CHAN_TYPE_UNKNOWN 0
00240 #define BMM_CHAN_TYPE_8 2 //!< 1 byte per pixel
00241 #define BMM_CHAN_TYPE_16 3 //!< 1 word per pixel
00242 #define BMM_CHAN_TYPE_24 8 //!< 3 bytes per pixel
00243 #define BMM_CHAN_TYPE_32 4 //!< 2 words per pixel
00244 #define BMM_CHAN_TYPE_48 5 //!< 3 words per pixel
00245 #define BMM_CHAN_TYPE_64 6 //!< 4 words per pixel
00246 #define BMM_CHAN_TYPE_96 7 //!< 6 words per pixel
00247
00248
00252 struct GBufData: public MaxHeapOperators {
00254 float z;
00256 UBYTE mtl_id;
00258 UWORD node_id;
00260 Point2 uv;
00262 DWORD normal;
00264 RealPixel realpix;
00266 UBYTE coverage;
00268 UWORD rend_id;
00270 Color24 color;
00272 Color24 transp;
00274 Color24 weight;
00276 Point2 veloc;
00277 UWORD mask;
00278 };
00279
00280
00281
00282
00311 class GBufReader : public InterfaceServer {
00312 public:
00320 virtual int StartLine(int y)=0;
00327 virtual BOOL StartPixel(int x)=0;
00332 virtual BOOL StartPixel(int x,int y)=0;
00336 virtual BOOL StartNextLayer()=0;
00339 virtual int NextPixel()=0;
00340
00348 virtual BOOL ReadChannelData(int chan, void *data)=0;
00356 virtual BOOL ReadAllData(GBufData *data)=0;
00368 virtual BOOL ModifyChannelData(int chan, void *data)=0;
00378 virtual BOOL ModifyAllData(GBufData *data)=0;
00381 virtual void DeleteThis()=0;
00382
00400 #pragma warning(push)
00401 #pragma warning(disable:4100)
00402 virtual INT_PTR Execute(int cmd, ULONG_PTR arg1=0, ULONG_PTR arg2=0, ULONG_PTR arg3=0) { return 0; }
00403 #pragma warning(pop)
00404 };
00405
00406
00407
00462 class GBufWriter : public InterfaceServer {
00463 public:
00468 virtual void StartLine(int y)=0;
00474 virtual void StartPixel(int x)=0;
00476 virtual void StartNextLayer()=0;
00477
00486 virtual BOOL WriteChannelData(int chan, void *data)=0;
00494 virtual BOOL WriteAllData(GBufData *data)=0;
00497 virtual BOOL EndLine()=0;
00500 virtual void DeleteThis()=0;
00501
00502 #pragma warning(push)
00503 #pragma warning(disable:4100)
00504 virtual INT_PTR Execute(int cmd, ULONG_PTR arg1=0, ULONG_PTR arg2=0, ULONG_PTR arg3=0) { return 0; }
00505 #pragma warning(pop)
00506 };
00507
00598 class GBuffer : public InterfaceServer {
00599 public:
00607 virtual void SetRasterSize(int ww, int hh)=0;
00609 virtual int Width()=0;
00611 virtual int Height()=0;
00622 virtual int InitBuffer()=0;
00628 virtual ULONG CreateChannels(ULONG channelMask)=0;
00634 virtual void DeleteChannels(ULONG channelMask)=0;
00636 virtual ULONG ChannelsPresent()=0;
00645 virtual void *GetChannel( ULONG channelID, ULONG& chanType)=0;
00648 virtual GBufReader *CreateReader()=0;
00653 virtual void DestroyReader(GBufReader *pRdr)=0;
00656 virtual GBufWriter *CreateWriter()=0;
00661 virtual void DestroyWriter(GBufWriter *pRdr)=0;
00667 virtual BOOL IsDefaultGBuffer() { return FALSE; }
00669 virtual void DeleteThis()=0;
00676 virtual void Copy(GBuffer *gbfrom)=0;
00690 virtual void CopyScale(GBuffer *gbfrom, int cw=-1, int ch=-1)=0;
00710 virtual void Position(int srcy, int trgy, int srcx, int trgx, int trgw, int trgh )=0;
00711
00712
00724 virtual int NumberLayerRecords(int y)=0;
00737 virtual int GetLayerChannel(int y, int ichan, char *data)=0;
00738
00739
00748 virtual int CreateLayerRecords(int y, int num)=0;
00760 virtual int SetLayerChannel(int y, int ichan, char *data)=0;
00761
00762
00768 virtual void UpdateChannelMinMax()=0;
00769
00770
00786 virtual BOOL GetChannelMin(int chan, void *data)=0;
00802 virtual BOOL GetChannelMax(int chan, void *data)=0;
00803
00804
00808 virtual NameTab& NodeRenderIDNameTab()=0;
00809
00810
00813 virtual Tab<float>& ImageBlurMultiplierTab()=0;
00814
00815
00816
00817
00818
00819
00820
00821
00822
00823
00824
00825
00826
00836 CoreExport static void ColorById( int id , BMM_Color_24& cOut );
00837
00838 };
00839
00844 CoreExport void SetMaximumGBufferLayerDepth(int m);
00846 CoreExport int GetMaximumGBufferLayerDepth();
00847
00852 CoreExport GBuffer *NewDefaultGBuffer();
00853