00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #pragma once
00018
00019
00020 #include "maxheap.h"
00021 #include "plugapi.h"
00022 #include "RenderElements.h"
00023
00024
00025 #include "custcont.h"
00026 #include "shape.h"
00027 #include "buildver.h"
00028 #include "autoptr.h"
00029 #include "MtlBaseList.h"
00030 #include "quat.h"
00031
00032
00033 class TextureInfo;
00034 class MNMesh;
00035 class TimeChangeCallback;
00036 class Renderer;
00037 class ViewParams;
00038 class ShadeContext;
00039 class Bitmap;
00040 class RenderMapsContext;
00041 class Object;
00042 class UVGen;
00043 class XYZGen;
00044 class Sampler;
00045
00046 #define PROJ_PERSPECTIVE 0 // perspective projection
00047 #define PROJ_PARALLEL 1 // parallel projection
00048
00049 #define AXIS_UV 0
00050 #define AXIS_VW 1
00051 #define AXIS_WU 2
00052
00056 #define U_WRAP (1<<0) //!< Indicates the texture map is tiled in the U direction.
00057 #define V_WRAP (1<<1) //!< Indicates the texture map is tiled in the V direction.
00058 #define U_MIRROR (1<<2) //!< Indicates the texture map is mirrored in the U direction.
00059 #define V_MIRROR (1<<3) //!< Indicates the texture map is mirrored in the V direction.
00060 #define UV_NOISE (1<<4)
00061 #define UV_NOISE_ANI (1<<5)
00062
00063
00064
00065 #define X_AXIS 0
00066 #define Y_AXIS 1
00067 #define Z_AXIS 2
00068
00069 static inline float Intens(const AColor& c) { return (c.r+c.g+c.b)/3.0f; }
00070 static inline float Intens(const Color& c) { return (c.r+c.g+c.b)/3.0f; }
00071
00072
00073
00074 #define WM_SUB_MTL_BUTTON WM_USER + 0x04001
00075
00076
00077
00078 #define WM_TEXMAP_BUTTON WM_USER + 0x04002
00079
00080
00081
00082
00083
00084
00085 #define PS_SMALL 0
00086 #define PS_LARGE 1
00087 #define PS_TINY 2
00088
00089 #define PS_TINY_SIZE 24 // size of the tiny postage stamps
00090 #define PS_SMALL_SIZE 32 // size of the small postage stamps
00091 #define PS_LARGE_SIZE 88 // size of the large postage stamps
00092 #define PSDIM(isz) ((isz==0)?PS_SMALL_SIZE:(isz==1)?PS_LARGE_SIZE:PS_TINY_SIZE)
00093
00094 #define ByteWidth(w) (((w*3+3)/4)*4)
00095
00096 #pragma warning(push)
00097 #pragma warning(disable:4100)
00098
00108 class PStamp: public AnimProperty {
00109 public:
00111 virtual int Width()=0;
00113 virtual int Height()=0;
00118 virtual void SetImage(UBYTE *img)=0;
00123 virtual void GetImage(UBYTE *img)=0;
00125 virtual void DeleteThis()=0;
00127 virtual IOResult Load(ILoad *iload)=0;
00129 virtual IOResult Save(ISave *isave)=0;
00130 };
00131
00137 class TexHandle: public MaxHeapOperators {
00138 public:
00140 virtual ~TexHandle() {;}
00142 virtual DWORD_PTR GetHandle() = 0;
00144 virtual void DeleteThis() = 0;
00145 };
00146
00147
00148 #define EX_MULT_ALPHA 1 // if alpha is NOT premultiplied in the Bitmap, set this
00149 #define EX_RGB_FROM_ALPHA 2 // make map using alpha to define gray level
00150 #define EX_OPAQUE_ALPHA 4 // make map using opaque alpha
00151 #define EX_ALPHA_FROM_RGB 8 // make alpha from intensity
00152
00159 class TexHandleMaker: public MaxHeapOperators{
00160 public:
00162 virtual ~TexHandleMaker() {;}
00163
00164
00184 virtual TexHandle* CreateHandle(Bitmap *bm, int symflags=0, int extraFlags=0)=0;
00185
00186
00207 virtual TexHandle* CreateHandle(BITMAPINFO *bminf, int symflags=0, int extraFlags=0)=0;
00208
00209
00210
00211
00237 virtual BITMAPINFO *BitmapToDIB(Bitmap *bm, int symflags, int extraFlags, BOOL forceW=0, BOOL forceH=0)=0;
00238
00239
00246 virtual TexHandle* MakeHandle(BITMAPINFO*bminf)=0;
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00259 virtual BOOL UseClosestPowerOf2()=0;
00270 virtual int Size()=0;
00271 };
00272
00273
00274
00280 class MtlMakerCallback: public TexHandleMaker {
00281 public:
00282
00283
00293 virtual void GetGfxTexInfoFromTexmap(TimeValue t, TextureInfo& texinf, Texmap *txm)=0;
00296 virtual BOOL NumberTexturesSupported()=0;
00297 };
00298
00299
00300
00301
00309 class PickObjectProc: public MaxHeapOperators {
00310 public:
00312 virtual ~PickObjectProc() {;}
00313
00314
00321 virtual BOOL Pick(INode *node)=0;
00322
00323
00329 virtual BOOL Filter(INode *node)=0;
00330
00331
00336 virtual void EnterMode() {}
00341 virtual void ExitMode() {}
00342
00343
00350 virtual HCURSOR GetDefCursor() {return NULL;}
00357 virtual HCURSOR GetHitCursor() {return NULL;}
00358
00359
00360
00366 virtual BOOL AllowMultiSelect() {return FALSE;}
00367 };
00368
00369
00370
00371
00377 class IMtlParams : public InterfaceServer {
00378 public:
00379
00380
00387 virtual void MtlChanged()=0;
00388
00389
00390
00428 virtual HWND AddRollupPage( HINSTANCE hInst, MCHAR *dlgTemplate,
00429 DLGPROC dlgProc, MCHAR *title, LPARAM param=0,DWORD flags=0, int category = ROLLUP_CAT_STANDARD )=0;
00430
00468 virtual HWND AddRollupPage( HINSTANCE hInst, DLGTEMPLATE *dlgTemplate,
00469 DLGPROC dlgProc, MCHAR *title, LPARAM param=0,DWORD flags=0, int category = ROLLUP_CAT_STANDARD )=0;
00470
00471
00472
00473
00510 virtual HWND ReplaceRollupPage( HWND hOldRollup, HINSTANCE hInst, MCHAR *dlgTemplate,
00511 DLGPROC dlgProc, MCHAR *title, LPARAM param=0,DWORD flags=0, int category = ROLLUP_CAT_STANDARD )=0;
00512
00550 virtual HWND ReplaceRollupPage( HWND hOldRollup, HINSTANCE hInst, DLGTEMPLATE *dlgTemplate,
00551 DLGPROC dlgProc, MCHAR *title, LPARAM param=0,DWORD flags=0, int category = ROLLUP_CAT_STANDARD )=0;
00552
00553
00554
00555
00562 virtual void DeleteRollupPage( HWND hRollup )=0;
00563
00564
00565
00584 virtual void RollupMouseMessage( HWND hDlg, UINT message,
00585 WPARAM wParam, LPARAM lParam )=0;
00586
00592 virtual int IsRollupPanelOpen(HWND hwnd)=0;
00596 virtual int GetRollupScrollPos()=0;
00604 virtual void SetRollupScrollPos(int spos)=0;
00605
00612 virtual void RegisterTimeChangeCallback(TimeChangeCallback *tc)=0;
00618 virtual void UnRegisterTimeChangeCallback(TimeChangeCallback *tc)=0;
00619
00620
00621
00627 virtual void RegisterDlgWnd( HWND hDlg )=0;
00632 virtual int UnRegisterDlgWnd( HWND hDlg )=0;
00633
00634
00638 virtual TimeValue GetTime()=0;
00639
00640
00648 virtual void SetPickMode(PickObjectProc *proc)=0;
00650 virtual void EndPickMode()=0;
00651
00652
00654 virtual IRollupWindow *GetMtlEditorRollup()=0;
00655
00656
00657 virtual INT_PTR Execute(int cmd, ULONG_PTR arg1=0, ULONG_PTR arg2=0, ULONG_PTR arg3=0) { return 0; }
00658 };
00659
00660 class ParamDlg;
00661 class Texmap;
00662
00668 class RenderData : public InterfaceServer {
00669 public:
00673 virtual void DeleteThis()=0;
00691 virtual INT_PTR Execute(int cmd, ULONG_PTR arg1=0, ULONG_PTR arg2=0, ULONG_PTR arg3=0) { return 0;}
00692 };
00693
00713 class LightDesc : public RenderData {
00714 public:
00715 BOOL affectDiffuse;
00716 BOOL affectSpecular;
00717 BOOL ambientOnly;
00718 DWORD extra;
00721 LightDesc() { affectDiffuse = affectSpecular = TRUE; ambientOnly = FALSE; }
00722
00723
00724
00768 virtual BOOL Illuminate(ShadeContext& sc, Point3& normal, Color& color, Point3 &dir, float &dot_nl, float &diffuseCoef){ return 0;}
00769
00773 virtual Point3 LightPosition() { return Point3(0,0,0); }
00774
00775 CoreExport virtual void DeleteThis();
00776
00777 };
00778
00779 #define SHADELIM_FLAT 1
00780 #define SHADELIM_GOURAUD 2
00781 #define SHADELIM_PHONG 3
00782
00783
00784 enum RefFrame { REF_CAMERA=0, REF_WORLD, REF_OBJECT };
00785
00786 #define N_MAX_RENDER_ELEMENTS 32
00787
00805 class ShadeOutput : public BaseInterfaceServer {
00806 public:
00807 ULONG flags;
00808 Color c;
00809 Color t;
00810 float ior;
00811 int gbufId;
00812
00813
00814 int nElements;
00815 AColor elementVals[ N_MAX_RENDER_ELEMENTS ];
00816
00849 CoreExport void MixIn(ShadeOutput& a, float f);
00850 ShadeOutput():nElements(0), flags(0), gbufId(0){};
00851 ShadeOutput( int nEle ):flags(0), gbufId(0){ nElements = nEle; }
00860 void Reset( int nEle = -1 )
00861 {
00862 flags = 0;
00863 gbufId = 0;
00864 c.Black(); t.Black(); ior = 1.0f;
00865
00866 if (nEle >= 0)
00867 nElements = nEle;
00868 for( int i=0; i < nElements; ++i )
00869 elementVals[i].r = elementVals[i].g =
00870 elementVals[i].b = elementVals[i].a = 0.0f;
00871 }
00872 CoreExport ShadeOutput* Clone();
00873
00874
00875
00876 int NewElementVal(){
00877 DbgAssert((nElements+1)<N_MAX_RENDER_ELEMENTS);
00878 return nElements++;
00879 }
00880 int NElementVals(){ return nElements; }
00881
00882 void SetNElements( int n ){
00883 DbgAssert( n>=0 && n<N_MAX_RENDER_ELEMENTS);
00884 nElements = n;
00885 }
00886
00887 AColor ElementVal( int n ){
00888 DbgAssert( n>=0 && n<N_MAX_RENDER_ELEMENTS);
00889 return elementVals[n];
00890 }
00891
00892 void SetElementVal( int n, AColor c ){
00893 DbgAssert( n>=0 && n<N_MAX_RENDER_ELEMENTS);
00894 elementVals[n] = c;
00895 }
00896
00897 void AccumElementVal( int n, AColor c ){
00898 DbgAssert( n>=0 && n<N_MAX_RENDER_ELEMENTS);
00899 elementVals[n] += c;
00900 }
00901
00902 void Sum( ShadeOutput* pSample ){
00903 c += pSample->c; t += pSample->t;
00904 for( int i = 0; i < nElements; ++i )
00905 elementVals[i] += pSample->elementVals[i];
00906 }
00907 void Scale( float x ){
00908 c *= x; t *= x;
00909 for( int i = 0; i < nElements; ++i )
00910 elementVals[i] *= x;
00911 }
00912
00913 void SumClr( ShadeOutput* pSample ){
00914 c += pSample->c;
00915 for( int i = 0; i < nElements; ++i ){
00916 elementVals[i].r += pSample->elementVals[i].r;
00917 elementVals[i].g += pSample->elementVals[i].g;
00918 elementVals[i].b += pSample->elementVals[i].b;
00919 }
00920 }
00921
00922 ShadeOutput& operator += ( ShadeOutput& a ){
00923 c += a.c;
00924 t += a.t;
00925 for( int i = 0; i < nElements; ++i )
00926 elementVals[i] += a.elementVals[i];
00927 return *this;
00928 }
00929 ShadeOutput& operator *= ( Color x ){
00930 c *= x;
00931 AColor ac( x );
00932 ac.a = Intens( x );
00933 for( int i = 0; i < nElements; ++i )
00934 elementVals[i] *= ac;
00935 return *this;
00936 }
00937
00938 ShadeOutput& operator = ( ShadeOutput& a ){
00939 flags = a.flags;
00940 c = a.c; t = a.t;
00941 ior = a.ior;
00942 gbufId = a.gbufId;
00943 nElements = a.nElements;
00944 for( int i = 0; i < nElements; ++i )
00945 elementVals[i] = a.elementVals[i];
00946 return *this;
00947 }
00948
00949
00950 };
00951
00952
00953 class RenderInstance;
00954
00961 struct ISect: public MaxHeapOperators {
00968 float t;
00970 BOOL exit;
00972 BOOL backFace;
00974 RenderInstance *inst;
00976 int fnum;
00978 Point3 bc;
00980 Point3 p;
00982 Point3 pc;
00984 ULONG matreq;
00986 int mtlNum;
00988 ISect *next;
00989 };
00990
01000 class ISectList: public MaxHeapOperators {
01001 public:
01002 ISect *first;
01004 ISectList() { first = NULL; }
01006 ~ISectList() { Init(); }
01008 BOOL IsEmpty() { return first?0:1; }
01014 CoreExport void Add(ISect *is);
01020 CoreExport void Prune(float a);
01023 CoreExport void Init();
01024 };
01025
01029 CoreExport ISect *GetNewISect();
01039 CoreExport void DiscardISect(ISect *is);
01040
01041
01042 #define NO_MOTBLUR (-1)
01043
01044 class FilterKernel;
01045 class IRenderElement;
01046 class ToneOperator;
01047 typedef Tab<IRenderElement*> RenderElementTab;
01048
01158 class RenderGlobalContext : public BaseInterfaceServer
01159 {
01160 protected:
01161 IRenderElementMgr *mpIRenderElementMgr;
01162
01163 public:
01164 Renderer* renderer;
01165 int projType;
01166 int devWidth, devHeight;
01167 float xscale, yscale;
01168 float xc,yc;
01169 BOOL antialias;
01170 Matrix3 camToWorld, worldToCam;
01171 float nearRange, farRange;
01172 float devAspect;
01173 float frameDur;
01174 Texmap *envMap;
01175 Color globalLightLevel;
01176 Atmospheric *atmos;
01177 ToneOperator* pToneOp;
01178 TimeValue time;
01179 BOOL wireMode;
01180 float wire_thick;
01181 BOOL force2Side;
01182 BOOL inMtlEdit;
01183 BOOL fieldRender;
01184 BOOL first_field;
01185 BOOL field_order;
01186
01187 BOOL objMotBlur;
01188 int nBlurFrames;
01189
01190 #ifdef SIMPLIFY_AREA_LIGHTS
01191 bool simplifyAreaLights;
01192 #endif
01193
01194
01195
01196 RenderGlobalContext() : pToneOp(NULL), mpIRenderElementMgr(NULL) { }
01197
01198
01201 IRenderElementMgr *GetRenderElementMgr() { return mpIRenderElementMgr; }
01206 void SetRenderElementMgr(IRenderElementMgr *pIRenderElementMgr) { mpIRenderElementMgr = pIRenderElementMgr; }
01208 int NRenderElements()
01209 {
01210 return mpIRenderElementMgr ? mpIRenderElementMgr->NumRenderElements() : 0;
01211 }
01216 IRenderElement* GetRenderElement(int n)
01217 {
01218 return mpIRenderElementMgr ? mpIRenderElementMgr->GetRenderElement(n) : NULL;
01219 }
01220
01226 Point2 MapToScreen(Point3 p)
01227 {
01228 if (projType==1)
01229 {
01230 return Point2( xc + xscale*p.x , yc + yscale*p.y);
01231 }
01232 else
01233 {
01234 if (p.z==0.0f)
01235 p.z = .000001f;
01236 return Point2( xc + xscale*p.x/p.z, yc + yscale*p.y/p.z);
01237 }
01238 }
01239
01242 virtual FilterKernel* GetAAFilterKernel(){ return NULL; }
01245 virtual float GetAAFilterSize(){ return 0.0f; }
01246
01247
01249 virtual int NumRenderInstances() { return 0; }
01255 virtual RenderInstance* GetRenderInstance( int i ) { return NULL; }
01256
01257
01258
01271 virtual AColor EvalGlobalEnvironMap(ShadeContext &sc, Ray &r, BOOL applyAtmos)
01272 {
01273 return AColor(0.0f,0.0f,0.0f,1.0f);
01274 }
01275
01297 virtual void IntersectRay(RenderInstance *inst, Ray& ray, ISect &isct, ISectList &xpList, BOOL findExit) {}
01330 virtual BOOL IntersectWorld(Ray &ray, int skipID, ISect &hit, ISectList &xplist, int blurFrame = NO_MOTBLUR) { return FALSE; }
01331
01334 virtual ViewParams* GetViewParams() { return NULL; }
01335
01339 virtual FILE* DebugFile() { return NULL; }
01340
01341
01359 virtual INT_PTR Execute(int cmd, ULONG_PTR arg1=0, ULONG_PTR arg2=0, ULONG_PTR arg3=0) { return 0; }
01360 };
01361
01362
01363
01364
01365
01366
01367
01368
01369
01370
01371
01372
01373
01374
01375
01376
01377
01378
01379
01380
01381
01382
01383
01384
01385 #define SHADECONTEXT_REGATHERING_FLAG 0x80000000
01386 #define SHADECONTEXT_IS_REGATHERING( sc ) ( (sc).xshadeID & SHADECONTEXT_REGATHERING_FLAG )
01387
01388
01389 #define SHADECONTEXT_PREPASS_FLAG 0x40000000
01390 #define SHADECONTEXT_IS_PREPASS( sc ) ( (sc).xshadeID & SHADECONTEXT_PREPASS_FLAG )
01391
01392
01393
01394
01395 #define SHADECONTEXT_RECURSIVE_EVAL_FLAG 0x20000000
01396 #define SHADECONTEXT_IS_RECURSIVE_EVAL( sc ) ( (sc).xshadeID & SHADECONTEXT_RECURSIVE_EVAL_FLAG )
01397
01398
01399
01400 #define SHADECONTEXT_GUESS_SHADOWS_FLAG 0x10000000
01401 #define SHADECONTEXT_GUESS_SHADOWS( sc ) ( (sc).xshadeID & SHADECONTEXT_GUESS_SHADOWS_FLAG )
01402
01403
01404 #define SHADECONTEXT_THREAD_MASK 0x0000F000
01405 #define SHADECONTEXT_THREAD_SHIFT 12
01406 #define SHADECONTEXT_GET_THREAD( sc ) ( ( (sc).xshadeID & SHADECONTEXT_THREAD_MASK ) >> SHADECONTEXT_THREAD_SHIFT )
01407 #define SHADECONTEXT_SET_THREAD( sc, thread ) { (sc).xshadeID = ( (sc).xshadeID & (~SHADECONTEXT_THREAD_MASK) ) | ( ( (thread) << SHADECONTEXT_THREAD_SHIFT ) & SHADECONTEXT_THREAD_MASK ); }
01408
01409
01410 #define SHADECONTEXT_WORKER_MASK 0x00000F00
01411 #define SHADECONTEXT_WORKER_SHIFT 8
01412 #define SHADECONTEXT_GET_WORKER( sc ) ( ( (sc).xshadeID & SHADECONTEXT_WORKER_MASK ) >> SHADECONTEXT_WORKER_SHIFT )
01413 #define SHADECONTEXT_SET_WORKER( sc, worker ) { (sc).xshadeID = ( (sc).xshadeID & (~SHADECONTEXT_WORKER_MASK) ) | ( ( (worker) << SHADECONTEXT_WORKER_SHIFT ) & SHADECONTEXT_WORKER_MASK ); }
01414
01415
01416 #define SHADECONTEXT_BOUNCE_MASK 0x000000FF
01417 #define SHADECONTEXT_GET_BOUNCE( sc ) ( (sc).xshadeID & SHADECONTEXT_BOUNCE_MASK )
01418 #define SHADECONTEXT_SET_BOUNCE( sc, bounce ) { (sc).xshadeID = ( (sc).xshadeID & (~SHADECONTEXT_BOUNCE_MASK) ) | ( (bounce) & SHADECONTEXT_BOUNCE_MASK ); }
01419
01420
01421
01422 #define SHADECONTEXT_SET_REGATHERING_INFO( sc, thread, worker, bounce ) \
01423 { (sc).xshadeID = SHADECONTEXT_REGATHERING_FLAG | \
01424 ( ( (thread) << SHADECONTEXT_THREAD_SHIFT ) & SHADECONTEXT_THREAD_MASK ) | \
01425 ( ( (worker) << SHADECONTEXT_WORKER_SHIFT ) & SHADECONTEXT_WORKER_MASK ) | \
01426 ( (bounce) & SHADECONTEXT_BOUNCE_MASK ); }
01427
01428
01429 #define SCMODE_NORMAL 0
01430 #define SCMODE_SHADOW 1
01431
01432
01433
01434
01529 class ShadeContext : public InterfaceServer {
01530 public:
01531 ULONG mode;
01532 BOOL doMaps;
01533 BOOL filterMaps;
01534 BOOL shadow;
01535 BOOL backFace;
01536 int mtlNum;
01537 Color ambientLight;
01538 int nLights;
01539 int rayLevel;
01540 int xshadeID;
01541 LightDesc *atmosSkipLight;
01542 RenderGlobalContext *globContext;
01543 ShadeOutput out;
01544
01545
01546
01547
01553 void ResetOutput( int n = -1 ) { out.Reset(n); }
01554
01559 virtual Class_ID ClassID() { return Class_ID(0,0); }
01562 virtual BOOL InMtlEditor()=0;
01567 virtual int Antialias() {return 0;}
01573 virtual int ProjType() { return 0;}
01579 virtual LightDesc* Light(int n)=0;
01582 virtual TimeValue CurTime()=0;
01588 virtual int NodeID() { return -1; }
01594 virtual INode *Node() { return NULL; }
01610 virtual Object *GetEvalObject() { return NULL; }
01611
01627 virtual Point3 BarycentricCoords() { return Point3(0,0,0);}
01634 virtual int FaceNumber()=0;
01638 virtual Point3 Normal()=0;
01648 virtual void SetNormal(Point3 p) {}
01653 virtual Point3 OrigNormal() { return Normal(); }
01656 virtual Point3 GNormal()=0;
01663 virtual float Curve() { return 0.0f; }
01666 virtual Point3 V()=0;
01671 virtual void SetView(Point3 p)=0;
01676 virtual Point3 OrigView() { return V(); }
01680 virtual Point3 ReflectVector()=0;
01687 virtual Point3 RefractVector(float ior)=0;
01695 virtual void SetIOR(float ior) {}
01699 virtual float GetIOR() { return 1.0f; }
01702 virtual Point3 CamPos()=0;
01704 virtual Point3 P()=0;
01708 virtual Point3 DP()=0;
01711 virtual void DP(Point3& dpdx, Point3& dpdy){};
01714 virtual Point3 PObj()=0;
01717 virtual Point3 DPObj()=0;
01720 virtual Box3 ObjectBox()=0;
01723 virtual Point3 PObjRelBox()=0;
01727 virtual Point3 DPObjRelBox()=0;
01735 virtual void ScreenUV(Point2& uv, Point2 &duv)=0;
01738 virtual IPoint2 ScreenCoord()=0;
01745 virtual Point2 SurfacePtScreen(){ return Point2(0.0,0.0); }
01746
01753 virtual Point3 UVW(int channel=0)=0;
01771 virtual Point3 DUVW(int channel=0)=0;
01787 virtual void DPdUVW(Point3 dP[3],int channel=0)=0;
01788
01789
01790
01791
01792
01793
01811 virtual int BumpBasisVectors(Point3 dP[2], int axis, int channel=0) { return 0; }
01812
01813
01814 virtual BOOL IsSuperSampleOn(){ return FALSE; }
01815 virtual BOOL IsTextureSuperSampleOn(){ return FALSE; }
01816 virtual int GetNSuperSample(){ return 0; }
01817 virtual float GetSampleSizeScale(){ return 1.0f; }
01818
01819
01820
01821
01822
01834 virtual Point3 UVWNormal(int channel=0) { return Point3(0,0,1); }
01835
01836
01842 virtual float RayDiam() { return Length(DP()); }
01843
01844
01845
01858 virtual float RayConeAngle() { return 0.0f; }
01859
01870 CoreExport virtual AColor EvalEnvironMap(Texmap *map, Point3 view);
01880 virtual void GetBGColor(Color &bgcol, Color& transp, BOOL fogBG=TRUE)=0;
01881
01882
01885 virtual float CamNearRange() {return 0.0f;}
01888 virtual float CamFarRange() {return 0.0f;}
01889
01890
01902 virtual Point3 PointTo(const Point3& p, RefFrame ito)=0;
01914 virtual Point3 PointFrom(const Point3& p, RefFrame ifrom)=0;
01925 virtual Point3 VectorTo(const Point3& p, RefFrame ito)=0;
01936 virtual Point3 VectorFrom(const Point3& p, RefFrame ifrom)=0;
01947 CoreExport virtual Point3 VectorToNoScale(const Point3& p, RefFrame ito);
01966 CoreExport virtual Point3 VectorFromNoScale(const Point3& p, RefFrame ifrom);
01967
01968
01969
01995 virtual void SetGBufferID(int gbid) { out.gbufId = gbid; }
01996
01999 virtual FILE* DebugFile() { return NULL; }
02000
02008 virtual AColor EvalGlobalEnvironMap(Point3 dir) { return AColor(0,0,0,0); }
02009
02043 virtual BOOL GetCache(Texmap *map, AColor &c){ return FALSE; }
02055 virtual BOOL GetCache(Texmap *map, float &f) { return FALSE; }
02067 virtual BOOL GetCache(Texmap *map, Point3 &p){ return FALSE; }
02078 virtual void PutCache(Texmap *map, const AColor &c){}
02089 virtual void PutCache(Texmap *map, const float f) {}
02100 virtual void PutCache(Texmap *map, const Point3 &p){}
02108 virtual void TossCache(Texmap *map) {}
02109
02126 virtual INT_PTR Execute(int cmd, ULONG_PTR arg1=0, ULONG_PTR arg2=0, ULONG_PTR arg3=0) { return 0; }
02127
02128
02150 LightDesc *GetAtmosSkipLight() { return atmosSkipLight; }
02166 void SetAtmosSkipLight(LightDesc *lt) { atmosSkipLight = lt; }
02167
02168
02172 virtual int NRenderElements() {
02173 return globContext ? globContext->NRenderElements():0;
02174 }
02181 virtual IRenderElement *GetRenderElement(int n) {
02182 return globContext ? globContext->GetRenderElement(n) : NULL;
02183 }
02184
02185
02188 CoreExport virtual Color DiffuseIllum();
02189
02190
02191
02192
02193
02194
02195
02196
02197
02198
02199
02200
02204 bool IsPhysicalSpace() const;
02205
02206
02207
02208
02209
02215 template< class T > void ScaledToRGB( T& energy ) const
02216 {
02217 if ( globContext != NULL && globContext->pToneOp != NULL )
02218 globContext->pToneOp->ScaledToRGB( energy );
02219 }
02225 float ScaledToRGB( float energy ) const;
02226
02227
02228
02231 void ScaledToRGB( );
02232
02233
02234
02235
02236
02242 template< class T > void ScalePhysical(T& energy) const
02243 {
02244 if ( globContext != NULL && globContext->pToneOp != NULL )
02245 globContext->pToneOp->ScalePhysical( energy );
02246 }
02252 float ScalePhysical(float energy) const;
02253
02254
02255
02256
02257
02263 template< class T > void ScaleRGB(T& energy) const
02264 {
02265 if ( globContext != NULL && globContext->pToneOp != NULL )
02266 globContext->pToneOp->ScaleRGB( energy );
02267 }
02273 float ScaleRGB(float energy) const;
02274
02278 ShadeContext() {
02279 mode = SCMODE_NORMAL; nLights = 0; shadow = TRUE; rayLevel = 0;
02280 globContext = NULL; atmosSkipLight = NULL;
02281 }
02282 };
02283
02284
02289 #define MTL_IN_SCENE (1<<0) //!< The material is being used in the scene.
02290 #define MTL_BEING_EDITED (1<<1) //!< The material's parameters are being displayed in the Material Editor.
02291 #define MTL_SUB_BEING_EDITED (1<<2) //!< This material OR sub-material texmap is being displayed in the Material Editor.
02292 #define MTL_TEX_DISPLAY_ENABLED (1<<3) //!< Viewport display enabled for this material (see MTL_SUB_DISPLAY_ENABLED).
02293 #define MTL_MEDIT_BACKGROUND (1<<8) //!< Material has the background shown in Material Editor.
02294 #define MTL_MEDIT_BACKLIGHT (1<<9) //!< Material is backlight in the Material Editor.
02295
02296 #define MTL_OBJTYPE_SHIFT 10 //!<
02297 #define MTL_MEDIT_OBJTYPE (1<<MTL_OBJTYPE_SHIFT) //!< Object type displayed in Material Editor
02298 #define MTL_MEDIT_OBJTYPE_MASK ((1<<MTL_OBJTYPE_SHIFT)|(1<<(MTL_OBJTYPE_SHIFT+1))|(1<<(MTL_OBJTYPE_SHIFT+2)))
02299
02300 #define MTL_TILING_SHIFT 13 //!<
02301 #define MTL_MEDIT_TILING (1<<MTL_TILING_SHIFT) // Object type displayed in Material Editor.
02302 #define MTL_MEDIT_TILING_MASK ((1<<MTL_TILING_SHIFT)|(1<<(MTL_TILING_SHIFT+1))|(1<<(MTL_TILING_SHIFT+2)))
02303
02304 #ifndef NO_MTLEDITOR_VIDCOLORCHECK // orb 01-08-2002
02305 #define MTL_MEDIT_VIDCHECK (1<<16) //!<
02306 #endif
02307
02308 #define MTL_BROWSE_OPEN1 (1<<18) //!< For internal use.
02309 #define MTL_BROWSE_OPEN2 (1<<19) //!< For internal use.
02310 #define MTL_SUB_DISPLAY_ENABLED (1<<20) //!< Indicates that texture display is enabled for map or material in this subtree
02311
02312 #define MTL_CLONED (1<<28) //!< Indicates material or texture was created by being cloned from another material or texture.
02313 #define MTL_HW_MAT_PRESENT (1<<29) //!<
02314 #define MTL_HW_MAT_ENABLED (1<<30) //!<
02315
02316 #define MTL_WORK_FLAG (1<<31) //!<
02317
02318 #define MTL_DISPLAY_ENABLE_FLAGS (MTL_TEX_DISPLAY_ENABLED|MTL_SUB_DISPLAY_ENABLED) //!< Interactive texture display enabled for THIS mtl base
02319
02320 #define MTL_HW_TEX_ENABLED (1<<17) //!< Indicates that the texture should be part of the realtime shader
02321
02322
02326 #define MTLREQ_2SIDE (1<<0) //!< The material is 2-sided.
02327 #define MTLREQ_WIRE (1<<1) //!< The material is wire frame material.
02328 #define MTLREQ_WIRE_ABS (1<<2) //!< Wire frame material, absolute size
02329 #define MTLREQ_TRANSP (1<<3) //!< The material uses transparency.
02330 #define MTLREQ_UV (1<<4) //!< The material requires UVW coordinates.
02331 #define MTLREQ_FACEMAP (1<<5) //!< The material uses "face map" UV coordinates.
02332 #define MTLREQ_XYZ (1<<6) //!< The material requires object XYZ coordinates.
02333 #define MTLREQ_OXYZ (1<<7) //!< The material requires object ORIGINAL XYZ coordinates.
02334 #define MTLREQ_BUMPUV (1<<8) //!< The Material requires UV bump vectors.
02335 #define MTLREQ_BGCOL (1<<9) //!< The material requires background color (e.g. Matte mtl).
02336 #define MTLREQ_PHONG (1<<10) //!< The material requires interpolated normal.
02337 #define MTLREQ_AUTOREFLECT (1<<11) //!< The material needs to build auto-reflect map.
02338 #define MTLREQ_AUTOMIRROR (1<<12) //!< The material needs to build auto-mirror map.
02339
02342 #define MTLREQ_NOATMOS (1<<13) //!< This suppresses the atmospheric shader. (used by Matte mtl)
02343
02348 #define MTLREQ_ADDITIVE_TRANSP (1<<14) //!< Specifies that transparent composites are done additively.
02349 #define MTLREQ_VIEW_DEP (1<<15) //!< Maps or materials which depend on the view should set this bit in their Requirements() method.
02350 #define MTLREQ_UV2 (1<<16) //!< The material requires second uv channel values (vertex colors).
02351 #define MTLREQ_BUMPUV2 (1<<17) //!< The material requires second uv channel bump vectors.
02352 #define MTLREQ_PREPRO (1<<18) //!< Pre-processing. MtlBase::BuildMaps is called on every frame.
02353 #define MTLREQ_DONTMERGE_FRAGMENTS (1<<19) //!< No longer used.
02354 #define MTLREQ_DISPLACEMAP (1<<20) //!< Material has a Displacement map channel
02355
02358 #define MTLREQ_SUPERSAMPLE (1<<21) //!< The material requires supersampling
02359
02362 #define MTLREQ_WORLDCOORDS (1<<22) //!< The material has world coordinates are used in material/map evaluation.
02363
02364 #define MTLREQ_TRANSP_IN_VP (1<<23) //!< The material is transparent in the viewport ( opacity < 100, or opacity map & ShowMapInVP set).
02365 #define MTLREQ_FACETED (1<<24) //!< The material should be rendered faceted in the viewports.
02366
02367
02368
02369
02370
02371
02372
02373
02374
02375
02376 #define MTLREQ_NOEXPOSURE (1<<25) //!< Do not do the tone-op (ie, for matte/shadow material, etc)
02377 #define MTLREQ_SS_GLOBAL (1<<26) //!< Material requires supersampling but use global sampler
02378
02379 #define MTLREQ_REND1 (1<<28) //!< USED IN RENDERER.
02380 #define MTLREQ_REND2 (1<<29) //!< USED IN RENDERER.
02381 #define MTLREQ_REND3 (1<<30) //!< USED IN RENDERER.
02382 #define MTLREQ_REND4 (1<<31) //!< USED IN RENDERER.
02383
02384
02388 #define MAPSLOT_TEXTURE 0 //!< A slot that holds a texture map.
02389
02390 #define MAPSLOT_ENVIRON 1 //!< A slot which holds an environment map.
02391 #define MAPSLOT_DISPLACEMENT 2 //!< Displacement maps: a type of texture map.
02392 #define MAPSLOT_BACKGROUND 3 //!< Background maps: generate UVW on-the-fly using view vector, default to screen
02393
02394
02395
02396 #define UVWSRC_EXPLICIT 0 // use explicit mesh texture vertices (whichever map channel)
02397 #define UVWSRC_OBJXYZ 1 // generate planar uvw mapping from object xyz on-the-fly
02398 #define UVWSRC_EXPLICIT2 2 // use explicit mesh map color vertices as a tex map
02399 #define UVWSRC_WORLDXYZ 3 // generate planar uvw mapping from world xyz on-the-fly
02400 #ifdef GEOREFSYS_UVW_MAPPING
02401 #define UVWSRC_GEOXYZ 4 // generate planar uvw mapping from geo referenced world xyz on-the-fly
02402 #endif
02403 #define UVWSRC_FACEMAP 5 // use face map
02404 #define UVWSRC_HWGEN 6 // use hardware generated texture coords
02405
02416 class ISubMap : public MaxHeapOperators
02417 {
02418 public:
02420 virtual ~ISubMap() {;}
02421
02425 virtual int NumSubTexmaps() { return 0; }
02435 virtual Texmap* GetSubTexmap(int i) { return NULL; }
02451 virtual int MapSlotType(int i)=0;
02462 virtual void SetSubTexmap(int i, Texmap *m) { }
02463
02464
02473 virtual int SubTexmapOn(int i) { return 1; }
02474
02487 CoreExport virtual MSTR GetSubTexmapSlotName(int i);
02492 CoreExport MSTR GetSubTexmapTVName(int i);
02493
02494
02495
02496
02497
02498
02499
02528 virtual BOOL SetDlgThing(ParamDlg* dlg) { return FALSE; }
02529
02530
02544 CoreExport void CopySubTexmap(HWND hwnd, int ifrom, int ito);
02545
02549 virtual ReferenceTarget *GetRefTarget()=0;
02550 };
02551
02552
02584 class MtlBase: public ReferenceTarget, public ISubMap {
02585 friend class Texmap;
02586 MSTR name;
02587 ULONG mtlFlags;
02588 int defaultSlotType;
02589 int activeCount;
02590 class MtlBaseImplData;
02591 const MaxSDK::Util::AutoPtr<MtlBaseImplData> mMtlBaseImplData;
02592 public:
02593 Quat meditRotate;
02594 ULONG gbufID;
02596 CoreExport MtlBase();
02597 CoreExport ~MtlBase();
02598 CoreExport Class_ID ClassID();
02601 MSTR& GetName() { return name; }
02604 CoreExport void SetName(MSTR s);
02612 CoreExport void SetMtlFlag(int mask, BOOL val=TRUE);
02617 CoreExport void ClearMtlFlag(int mask);
02622 CoreExport int TestMtlFlag(int mask);
02623
02624
02626 int GetMeditObjType() { return (mtlFlags&MTL_MEDIT_OBJTYPE_MASK)>>MTL_OBJTYPE_SHIFT; }
02628 void SetMeditObjType(int t) { mtlFlags &= ~MTL_MEDIT_OBJTYPE_MASK; mtlFlags |= t<<MTL_OBJTYPE_SHIFT; }
02629
02630
02631 #ifndef NO_MTLEDITOR_SAMPLEUVTILING // orb 01-08-2002
02632
02633 int GetMeditTiling() { return (mtlFlags&MTL_MEDIT_TILING_MASK)>>MTL_TILING_SHIFT; }
02635 void SetMeditTiling(int t) { mtlFlags &= ~MTL_MEDIT_TILING_MASK; mtlFlags |= t<<MTL_TILING_SHIFT; }
02636 #endif // NO_MTLEDITOR_SAMPLEUVTILING
02637
02638
02639
02645 CoreExport BOOL AnyMulti();
02646
02649 BOOL TextureDisplayEnabled() { return TestMtlFlag(MTL_TEX_DISPLAY_ENABLED); }
02650
02651
02652
02657 CoreExport virtual MSTR GetFullName();
02658
02659
02660
02664 CoreExport MtlBase& operator=(const MtlBase& m);
02665
02676 virtual int BuildMaps(TimeValue t, RenderMapsContext &rmc) { return 1; }
02677
02678
02679
02680
02681
02682
02700 CoreExport virtual ULONG Requirements(int subMtlNum);
02701
02702
02703
02711 virtual ULONG LocalRequirements(int subMtlNum) { return 0; }
02712
02713
02714
02715
02716
02717
02718
02719
02732 CoreExport virtual void MappingsRequired(int subMtlNum, BitArray & mapreq, BitArray &bumpreq);
02733
02734
02735
02765 virtual void LocalMappingsRequired(int subMtlNum, BitArray & mapreq, BitArray &bumpreq) { }
02766
02767
02768
02769
02780 virtual BOOL IsMultiMtl() { return FALSE; }
02781
02782
02783 virtual int MapSlotType(int i) { return defaultSlotType; }
02784
02785
02786
02790 CoreExport void DeactivateMapsInTree();
02791
02792
02793
02794
02810 virtual void Update(TimeValue t, Interval& valid)=0;
02811
02828 virtual void Reset()=0;
02829
02830
02835 virtual Interval Validity(TimeValue t)=0;
02836
02837
02838
02901 virtual ParamDlg* CreateParamDlg(HWND hwMtlEdit, IMtlParams *imp)=0;
02902
02903
02904
02905
02933 CoreExport IOResult Save(ISave *isave);
02963 CoreExport IOResult Load(ILoad *iload);
02964
02965 #ifndef NO_MTLEDITOR_EFFECTSCHANNELS // orb 01-08-2002
02966
02969 ULONG GetGBufID() { return gbufID; }
02972 void SetGBufID(ULONG id) { gbufID = id; }
02973 #endif // NO_MTLEDITOR_EFFECTSCHANNELS
02974
02975
02979 CoreExport void EnumAuxFiles(AssetEnumCallback& nameEnum, DWORD flags);
02980
02981
02988 CoreExport virtual PStamp* GetPStamp(int sz);
03022 CoreExport virtual PStamp* CreatePStamp(int sz, BOOL Render = FALSE);
03029 CoreExport virtual void DiscardPStamp(int sz);
03030
03031
03032 CoreExport SvGraphNodeReference SvTraverseAnimGraph(IGraphObjectManager *gom, Animatable *owner, int id, DWORD flags);
03033 CoreExport bool SvHandleDoubleClick(IGraphObjectManager *gom, IGraphNode *gNode);
03034 CoreExport MSTR SvGetName(IGraphObjectManager *gom, IGraphNode *gNode, bool isBeingEdited);
03035 CoreExport bool SvCanSetName(IGraphObjectManager *gom, IGraphNode *gNode);
03036 CoreExport bool SvSetName(IGraphObjectManager *gom, IGraphNode *gNode, MSTR &name);
03037 CoreExport COLORREF SvHighlightColor(IGraphObjectManager *gom, IGraphNode *gNode);
03038 CoreExport bool SvIsSelected(IGraphObjectManager *gom, IGraphNode *gNode);
03039 CoreExport MultiSelectCallback* SvGetMultiSelectCallback(IGraphObjectManager *gom, IGraphNode *gNode);
03040 CoreExport bool SvCanSelect(IGraphObjectManager *gom, IGraphNode *gNode);
03041
03042
03049 virtual BOOL SupportTexDisplay() { return FALSE; }
03058 virtual DWORD_PTR GetActiveTexHandle(TimeValue t, TexHandleMaker& thmaker) {return 0;}
03060 CoreExport void IncrActive();
03062 CoreExport void DecrActive();
03064 int Active() { return activeCount; }
03075 virtual void ActivateTexDisplay(BOOL onoff) {}
03076
03078
03082 CoreExport MtlBase* GetActiveMB();
03084
03085 CoreExport void SetActiveMB(MtlBase* activeMB);
03086
03087
03092 virtual BOOL SupportsMultiMapsInViewport() { return FALSE; }
03122 virtual void SetupGfxMultiMaps(TimeValue t, Material *mtl, MtlMakerCallback &cb) {}
03123 virtual void* GetInterface(ULONG id){ if(id==I_SUBMAP) return (ISubMap*)this; else return ReferenceTarget::GetInterface(id); }
03124 virtual BaseInterface *GetInterface(Interface_ID id) { return ReferenceTarget::GetInterface(id); }
03125 virtual ReferenceTarget *GetRefTarget(){return this;}
03126
03127
03128 CoreExport virtual int SetProperty(ULONG id, void *data);
03129 CoreExport virtual void *GetProperty(ULONG id);
03130 CoreExport virtual void BaseClone(ReferenceTarget *from, ReferenceTarget *to, RemapDir &remap);
03131
03139 virtual BOOL GetTransparencyHint(TimeValue t, Interval& valid) { return TRUE; }
03140 };
03141
03142
03143
03144
03150 class ParamDlg : public InterfaceServer {
03151 public:
03154 virtual Class_ID ClassID()=0;
03160 virtual void SetThing(ReferenceTarget *m)=0;
03162 virtual ReferenceTarget* GetThing()=0;
03169 virtual void SetTime(TimeValue t)=0;
03174 virtual void ReloadDialog()=0;
03180 virtual void DeleteThis()=0;
03203 virtual void ActivateDlg(BOOL onOff)=0;
03204
03227 virtual int FindSubTexFromHWND(HWND hwnd){ return -1;}
03237 virtual int FindSubMtlFromHWND(HWND hwnd){ return -1;}
03238
03239 virtual INT_PTR Execute(int cmd, ULONG_PTR arg1=0, ULONG_PTR arg2=0, ULONG_PTR arg3=0) { return 0; }
03240
03241 };
03242
03243
03244 CoreExport MCHAR TEXMAP_CAT_2D[];
03245 CoreExport MCHAR TEXMAP_CAT_3D[];
03246 CoreExport MCHAR TEXMAP_CAT_COMP[];
03247 CoreExport MCHAR TEXMAP_CAT_COLMOD[];
03248 CoreExport MCHAR TEXMAP_CAT_ENV[];
03249
03254 class NameAccum: public MaxHeapOperators {
03255 public:
03257 virtual ~NameAccum() {;}
03263 virtual void AddMapName(MCHAR *name)=0;
03264 };
03265
03266
03267
03268 #define IID_RAYTRACE_MAP 0xff8d87a5
03269
03270 class IRayTexmap : public InterfaceServer {
03271 public:
03272 bool isRayTraceMap() { return true; }
03273 };
03274
03275
03298 class Texmap: public MtlBase {
03299 public:
03300 int cacheID;
03301
03304 CoreExport Texmap();
03305
03306 SClass_ID SuperClassID() { return TEXMAP_CLASS_ID; }
03307 virtual void GetClassName(MSTR& s) { s= MSTR(_M("Texture")); }
03308
03309
03320 virtual AColor EvalColor(ShadeContext& sc)=0;
03321
03322
03323
03333 virtual float EvalMono(ShadeContext& sc) {
03334 return Intens(EvalColor(sc));
03335 }
03336
03337
03338
03345 virtual Point3 EvalNormalPerturb(ShadeContext& sc)=0;
03346
03347
03348
03349
03350
03357 virtual BOOL HandleOwnViewPerturb() { return FALSE; }
03358
03359
03360
03361
03362
03363
03384 CoreExport virtual BITMAPINFO* GetVPDisplayDIB(TimeValue t, TexHandleMaker& thmaker, Interval &valid, BOOL mono=FALSE, int forceW=0, int forceH=0);
03385
03395 virtual void GetUVTransform(Matrix3 &uvtrans) { uvtrans.IdentityMatrix(); }
03404 virtual int GetTextureTiling() { return U_WRAP|V_WRAP; }
03415 virtual void InitSlotType(int sType) { defaultSlotType = sType; }
03416 virtual int MapSlotType(int i) { return defaultSlotType; }
03440 virtual int GetUVWSource() { return UVWSRC_EXPLICIT; }
03446 virtual int GetMapChannel () { return 1; }
03447
03452 virtual UVGen *GetTheUVGen() { return NULL; }
03457 virtual XYZGen *GetTheXYZGen() { return NULL; }
03458
03459
03463 CoreExport void RecursInitSlotType(int sType);
03474 virtual void SetOutputLevel(TimeValue t, float v) {}
03475
03476
03477
03557 virtual int LoadMapFiles(TimeValue t) { return 1; }
03558
03559
03588 CoreExport virtual void RenderBitmap(TimeValue t, Bitmap *bm, float scale3D=1.0f, BOOL filter = FALSE);
03589
03590 CoreExport void RefAdded(RefMakerHandle rm);
03591
03592
03593 CoreExport SvGraphNodeReference SvTraverseAnimGraph(IGraphObjectManager *gom, Animatable *owner, int id, DWORD flags);
03594
03595
03596
03597
03598
03599
03613 CoreExport virtual bool IsOutputMeaningful( ShadeContext& sc );
03614
03615
03624 virtual bool IsLocalOutputMeaningful( ShadeContext& sc ) { return false; }
03625
03626
03631 virtual int IsHighDynamicRange( ) const { return false; }
03632 };
03633
03634
03646 class TexmapContainer: public ReferenceTarget {
03647 SClass_ID SuperClassID() { return TEXMAP_CONTAINER_CLASS_ID; }
03648 CoreExport SvGraphNodeReference SvTraverseAnimGraph(IGraphObjectManager *gom, Animatable *owner, int id, DWORD flags);
03649 };
03650
03651
03652
03653
03654 #define DYN_BOUNCE 1
03655 #define DYN_STATIC_FRICTION 2
03656 #define DYN_SLIDING_FRICTION 3
03657
03659 #define GNORMAL_CLASS_ID Class_ID(0x243e22c6, 0x63f6a014)
03660 #define VDM_CLASS_ID Class_ID(0x152c55c7, 0x26160e93)
03661
03664
03665 enum Normal_Block_IDs
03666 {
03667 gnormal_params
03668 };
03669 enum Normal_Param_IDs
03670 {
03671 gn_mult_spin,
03672 gn_bmult_spin,
03673 gn_map_normal,
03674 gn_map_bump,
03675 gn_map1on,
03676 gn_map2on,
03677 gn_method,
03678 gn_flip_red,
03679 gn_flip_green,
03680 gn_swap_rg
03681 };
03682
03683 enum VDM_Block_IDs
03684 {
03685 vdm_params
03686 };
03687
03688 enum VDM_Param_IDs
03689 {
03690 vdm_mult_spin,
03691 vdm_map_vector_enabled,
03692 vdm_map_vector,
03693 vdm_is_hdr,
03694 vdm_method
03695 };
03696
03697
03698
03713 class Mtl: public MtlBase {
03714 RenderData *renderData;
03715 public:
03716
03718 CoreExport Mtl();
03719 SClass_ID SuperClassID() { return MATERIAL_CLASS_ID; }
03720 virtual void GetClassName(MSTR& s) { s= MSTR(_M("Mtl")); }
03721
03725 CoreExport MtlBase* GetActiveTexmap();
03731 CoreExport void SetActiveTexmap(MtlBase *txm);
03732
03733 CoreExport void RefDeleted();
03734 CoreExport void RefAdded(RefMakerHandle rm);
03735
03736
03737
03738
03744 virtual Color GetAmbient(int mtlNum=0, BOOL backFace=FALSE)=0;
03750 virtual Color GetDiffuse(int mtlNum=0, BOOL backFace=FALSE)=0;
03756 virtual Color GetSpecular(int mtlNum=0, BOOL backFace=FALSE)=0;
03762 virtual float GetShininess(int mtlNum=0, BOOL backFace=FALSE)=0;
03768 virtual float GetShinStr(int mtlNum=0, BOOL backFace=FALSE)=0;
03774 virtual float GetXParency(int mtlNum=0, BOOL backFace=FALSE)=0;
03775
03776
03784 virtual BOOL GetSelfIllumColorOn(int mtlNum=0, BOOL backFace=FALSE) { return TRUE; }
03792 virtual float GetSelfIllum(int mtlNum=0, BOOL backFace=FALSE) { return 0.0f; }
03800 virtual Color GetSelfIllumColor(int mtlNum=0, BOOL backFace=FALSE){ Color c( .0f,.0f,.0f); return c; }
03801
03802
03809 virtual Sampler * GetPixelSampler(int mtlNum=0, BOOL backFace=FALSE){ return NULL; }
03810
03811
03818 virtual float WireSize(int mtlNum=0, BOOL backFace=FALSE) { return 1.0f; }
03819
03820
03821
03825 virtual void SetAmbient(Color c, TimeValue t)=0;
03829 virtual void SetDiffuse(Color c, TimeValue t)=0;
03833 virtual void SetSpecular(Color c, TimeValue t)=0;
03837 virtual void SetShininess(float v, TimeValue t)=0;
03842 virtual BOOL SupportsShaders() { return FALSE; }
03843
03844
03845 virtual BOOL SupportsRenderElements() { return FALSE; }
03846
03847
03848
03849
03850
03851
03852
03853
03854
03855
03856
03857
03858
03859
03860
03861
03862
03863
03864
03865
03870 virtual void Shade(ShadeContext& sc)=0;
03871
03872
03876 virtual int NumSubMtls() { return 0; }
03881 virtual Mtl* GetSubMtl(int i) { return NULL; }
03887 virtual void SetSubMtl(int i, Mtl *m) { }
03899 virtual int VPDisplaySubMtl() { return -1; }
03909 CoreExport virtual MSTR GetSubMtlSlotName(int i);
03913 CoreExport MSTR GetSubMtlTVName(int i);
03914 CoreExport void CopySubMtl(HWND hwnd, int ifrom, int ito);
03915
03916
03932 CoreExport virtual float GetDynamicsProperty(TimeValue t, int mtlNum, int propID);
03949 CoreExport virtual void SetDynamicsProperty(TimeValue t, int mtlNum, int propID, float value);
03950
03951
03957 virtual float EvalDisplacement(ShadeContext& sc) { return 0.0f; }
03963 virtual Interval DisplacementValidity(TimeValue t) { return FOREVER; }
03964
03965
03966 CoreExport bool SvCanInitiateLink(IGraphObjectManager *gom, IGraphNode *gNode);
03967
03968
03969
03970
03978 virtual BOOL DontKeepOldMtl() { return FALSE; }
03979
03980
03986 virtual void SetRenderData( RenderData *rdata) { renderData = rdata; }
03991 virtual RenderData *GetRenderData() { return renderData; }
03992
03993
03994
03995
03996
04005 virtual bool IsOutputConst( ShadeContext& sc, int stdID ) { return false; }
04006
04007
04008
04028 virtual bool EvalColorStdChannel( ShadeContext& sc, int stdID, Color& outClr) { return false; }
04029 CoreExport virtual bool EvalMonoStdChannel( ShadeContext& sc, int stdID, float& outVal) ;
04030 };
04031
04032
04033
04041 class MapSampler: public MaxHeapOperators {
04042 public:
04044 virtual ~MapSampler() {;}
04045
04060 virtual AColor Sample(ShadeContext& sc, float u,float v)=0;
04080 virtual AColor SampleFilter(ShadeContext& sc, float u,float v, float du, float dv)=0;
04081
04082 virtual void SetTileNumbers(int iu, int iv) {}
04099 virtual float SampleMono(ShadeContext& sc, float u,float v) { return Intens(Sample(sc,u,v)); }
04123 virtual float SampleMonoFilter(ShadeContext& sc, float u,float v, float du, float dv){
04124 return Intens(SampleFilter(sc,u,v,du,dv));
04125 }
04126 };
04127
04128
04129
04130
04131
04143 class UVGen: public MtlBase {
04144 public:
04145
04159 virtual void GetUV( ShadeContext& sc, Point2& UV, Point2& dUV)=0;
04160
04161
04176 virtual AColor EvalUVMap(ShadeContext &sc, MapSampler* samp, BOOL filter=TRUE)=0;
04220 virtual float EvalUVMapMono(ShadeContext &sc, MapSampler* samp, BOOL filter=TRUE)=0;
04235 virtual Point2 EvalDeriv( ShadeContext& sc, MapSampler* samp, BOOL filter=TRUE)=0;
04236
04237
04254 virtual void GetBumpDP( ShadeContext& sc, Point3& dPdu, Point3& dPdv)=0;
04255
04258 virtual void GetUVTransform(Matrix3 &uvtrans)=0;
04259
04262 virtual int GetTextureTiling()=0;
04263 virtual void SetTextureTiling(int t)=0;
04264
04274 virtual int GetUVWSource()=0;
04275 virtual int GetMapChannel () { return 1; }
04291 virtual void SetUVWSource(int s)=0;
04298 virtual void SetMapChannel (int s) { }
04299
04301 virtual int SymFlags()=0;
04303 virtual void SetSymFlags(int f)=0;
04304
04305 virtual int GetSlotType()=0;
04321 virtual void InitSlotType(int sType)=0;
04322
04328 virtual int GetAxis()=0;
04336 virtual void SetAxis(int ax)=0;
04337
04338
04339
04340
04358 virtual void SetClipFlag(BOOL b)=0;
04364 virtual BOOL GetClipFlag()=0;
04370 virtual BOOL IsStdUVGen() { return FALSE; }
04371
04372 SClass_ID SuperClassID() { return UVGEN_CLASS_ID; }
04373
04378 virtual void SetRollupOpen(BOOL open)=0;
04381 virtual BOOL GetRollupOpen()=0;
04382 CoreExport SvGraphNodeReference SvTraverseAnimGraph(IGraphObjectManager *gom, Animatable *owner, int id, DWORD flags);
04383 CoreExport MSTR SvGetName(IGraphObjectManager *gom, IGraphNode *gNode, bool isBeingEdited)
04384 {
04385 return Animatable::SvGetName(gom, gNode, isBeingEdited);
04386 }
04387 };
04388
04389
04390
04399 class XYZGen: public MtlBase {
04400 public:
04401
04421 virtual void GetXYZ( ShadeContext& sc, Point3& p, Point3& dp)=0;
04422 SClass_ID SuperClassID() { return XYZGEN_CLASS_ID; }
04427 virtual void SetRollupOpen(BOOL open)=0;
04430 virtual BOOL GetRollupOpen()=0;
04431 virtual BOOL IsStdXYZGen() { return FALSE; }
04468 virtual void GetBumpDP( ShadeContext& sc, Point3* dP) {};
04469 CoreExport SvGraphNodeReference SvTraverseAnimGraph(IGraphObjectManager *gom, Animatable *owner, int id, DWORD flags);
04470 CoreExport MSTR SvGetName(IGraphObjectManager *gom, IGraphNode *gNode, bool isBeingEdited)
04471 {
04472 return Animatable::SvGetName(gom, gNode, isBeingEdited);
04473 }
04474 };
04475
04476
04477
04498 class TextureOutput: public MtlBase {
04499 public:
04505 virtual AColor Filter(AColor c) = 0;
04511 virtual float Filter(float f) = 0;
04517 virtual Point3 Filter(Point3 p) = 0;
04522 virtual float GetOutputLevel(TimeValue t) = 0;
04529 virtual void SetOutputLevel(TimeValue t, float v) = 0;
04534 virtual void SetInvert(BOOL onoff)=0;
04538 virtual BOOL GetInvert()=0;
04543 virtual void SetRollupOpen(BOOL open)=0;
04546 virtual BOOL GetRollupOpen()=0;
04547 SClass_ID SuperClassID() { return TEXOUTPUT_CLASS_ID; }
04548 CoreExport SvGraphNodeReference SvTraverseAnimGraph(IGraphObjectManager *gom, Animatable *owner, int id, DWORD flags);
04549 CoreExport MSTR SvGetName(IGraphObjectManager *gom, IGraphNode *gNode, bool isBeingEdited)
04550 {
04551 return Animatable::SvGetName(gom, gNode, isBeingEdited);
04552 }
04553 };
04554
04556
04557
04558 class Shader;
04559
04560 #ifndef USE_LIMITED_STDMTL
04561 #define STD2_NMAX_TEXMAPS 24
04562 #else
04563 #define STD2_NMAX_TEXMAPS 12
04564 #endif
04565
04659 class IllumParams : public BaseInterfaceServer {
04660 public:
04661
04662
04663 Shader* pShader;
04664 Mtl* pMtl;
04665
04666 Color channels[ STD2_NMAX_TEXMAPS ];
04667
04668 float finalOpac;
04669 float reflectAmt;
04670 float refractAmt;
04671 ULONG hasComponents;
04672 ULONG stdParams;
04673 int* stdIDToChannel;
04674
04675
04676 Color ambIllumOut, diffIllumOut, transIllumOut, selfIllumOut;
04677 Color specIllumOut, reflIllumOut;
04678
04679
04680 int nUserIllumOut;
04681 MCHAR** userIllumNames;
04682 Color* userIllumOut;
04683
04684 float diffIllumIntens;
04685 float finalAttenuation;
04686
04687
04688 Color finalC;
04689 Color finalT;
04690
04691 public:
04692
04693
04694
04695
04696 CoreExport IllumParams( int nUserOut = 0, MCHAR** pUserNames = NULL );
04697
04698
04699
04700
04701
04702
04703
04704
04705 CoreExport ~IllumParams();
04706
04707
04708 int nUserIllumChannels(){ return nUserIllumOut; }
04709
04710
04711 MCHAR* GetUserIllumName( int n ) {
04712 DbgAssert( n < nUserIllumOut );
04713 if( userIllumNames )
04714 return userIllumNames[n];
04715 return NULL;
04716 }
04717
04718
04719
04720 CoreExport int FindUserIllumName( MCHAR* name );
04721
04722
04723 void SetUserIllumOutput( int n, Color& out ){
04724 DbgAssert( n < nUserIllumOut );
04725 userIllumOut[n] = out;
04726 }
04727
04728 CoreExport void SetUserIllumOutput( MCHAR* name, Color& out );
04729
04730 Color GetUserIllumOutput( int n ){
04731 DbgAssert( n < nUserIllumOut );
04732 return userIllumOut[n];
04733 }
04734
04735 CoreExport Color GetUserIllumOutput( MCHAR* name, int n );
04736
04742 void ClearOutputs() {
04743 finalC = finalT = ambIllumOut=diffIllumOut=transIllumOut=selfIllumOut=
04744 specIllumOut=reflIllumOut= Color( 0.0f, 0.0f, 0.0f );
04745 finalAttenuation = diffIllumIntens = 0.0f;
04746 for( int i=0; i < nUserIllumOut; ++i )
04747 userIllumOut[i] = finalC;
04748 }
04749
04750 void ClearInputs() {
04751 stdParams = hasComponents = 0;
04752 pShader = NULL; pMtl = NULL;
04753 stdIDToChannel = NULL;
04754 refractAmt = reflectAmt = 0.0f;
04755 for( int i=0; i < STD2_NMAX_TEXMAPS; ++i )
04756 channels[ i ] = Color( 0, 0, 0 );
04757 }
04758 };
04759
04761
04762
04763
04764 class Color32;
04765
04786 class IReshadeFragment : public InterfaceServer
04787 {
04788 public:
04791 virtual int NChannels()=0;
04793 virtual int NFirstChannel()=0;
04795 virtual int NTextures()=0;
04796
04801 virtual Color32 Channel( int nChan )=0;
04809 virtual void SetChannel( int nChan, Color32 c )=0;
04815 virtual void AddChannel( Color32 c )=0;
04816
04823 virtual void AddColorChannel( RGBA tex )=0;
04829 virtual void AddFloatChannel( float f )=0;
04835 virtual void AddIntChannel( int i )=0;
04841 virtual void AddUnitVecChannel( Point3 v )=0;
04847 virtual void AddPoint2Channel( Point2 p )=0;
04853 virtual void AddPoint3Channel( Point3 p )=0;
04854
04862 virtual void SetColorChannel( int nChan, RGBA tex )=0;
04870 virtual void SetFloatChannel( int nChan, float f )=0;
04878 virtual void SetIntChannel( int nChan, int i )=0;
04886 virtual void SetUnitVecChannel( int nChan, Point3 v )=0;
04894 virtual void SetPoint2Channel( int nChan, Point2 p )=0;
04902 virtual void SetPoint3Channel( int nChan, Point3 p )=0;
04903
04909 virtual RGBA GetColorChannel( int nChan )=0;
04914 virtual float GetFloatChannel( int nChan )=0;
04919 virtual int GetIntChannel( int nChan )=0;
04924 virtual Point3 GetUnitVecChannel( int nChan )=0;
04929 virtual Point2 GetPoint2Channel( int nChan )=0;
04934 virtual Point3 GetPoint3Channel( int nChan )=0;
04935 };
04936
04937
04938 #define IID_IReshading 0xabe00001
04939
04940
04968 class IReshading: public MaxHeapOperators
04969 {
04970 public:
04971
04972 enum ReshadeRequirements{ RR_None = 0, RR_NeedPreshade, RR_NeedReshade };
04974 virtual ~IReshading() {;}
04975
04976
04977
04978
04979
04980
04981
04982
04999 virtual ReshadeRequirements GetReshadeRequirements() { return RR_NeedPreshade; }
05015 virtual void PreShade(ShadeContext& sc, IReshadeFragment* pFrag ) { }
05037 virtual void PostShade(ShadeContext& sc, IReshadeFragment* pFrag,
05038 int& nextTexIndex, IllumParams* ip = NULL ) { }
05039
05040 };
05041
05042
05043 #define IID_IValidityToken 0xabe00002
05044
05045 class IValidityToken: public MaxHeapOperators
05046 {
05047 public:
05048 virtual ~IValidityToken() {;}
05049 virtual BOOL NeedsUpdate( ULONG currentToken )= 0;
05050 virtual void SetToken( ULONG token )= 0;
05051 virtual ULONG GetToken() = 0;
05052 virtual void SetMessage( ULONG message )= 0;
05053 virtual ULONG GetMessage() = 0;
05054 };
05055
05056
05057 class IValidityTokenImp : public IValidityToken
05058 {
05059 protected:
05060 ULONG mLocalToken;
05061 ULONG mMessage;
05062
05063 public:
05064
05065
05066 BOOL NeedsUpdate( ULONG currentToken ){
05067 return mLocalToken >= currentToken;
05068 }
05069
05070
05071 void SetToken( ULONG token ) {
05072 mLocalToken = token;
05073 }
05074
05075 ULONG GetToken() {
05076 return mLocalToken;
05077 }
05078
05079
05080
05081 void SetMessage( ULONG message ) {
05082 mMessage = message;
05083 }
05084 ULONG GetMessage() {
05085 return mMessage;
05086 }
05087 };
05088
05089
05090
05091 typedef Mtl* MtlHandle;
05092 typedef Texmap* TexmapHandle;
05093
05094
05095
05104 class MtlList: public Tab<MtlHandle> {
05105 public:
05114 CoreExport int AddMtl(Mtl *m, BOOL checkUnique=TRUE);
05121 CoreExport int FindMtl(Mtl *m);
05128 CoreExport int FindMtlByName(MSTR& name);
05133 void RemoveEntry(int n) { Delete(n,1); }
05135 void Empty() { Resize(0); }
05136 };
05137
05138 #pragma warning(push)
05139 #pragma warning(disable:4239)
05140
05141
05146 class MtlLib: public ReferenceTarget, public MtlList {
05147 public:
05148 CoreExport SClass_ID SuperClassID();
05149 CoreExport Class_ID ClassID();
05152 CoreExport void DeleteAll();
05153 CoreExport void GetClassName(MSTR& s);
05155 CoreExport ~MtlLib();
05156
05157 int NumSubs() {
05158 return Count();
05159 }
05160 Animatable* SubAnim(int i) {
05161 return (*this)[i];
05162 }
05163 CoreExport MSTR SubAnimName(int i);
05168 CoreExport virtual void Remove(Mtl *m);
05173 CoreExport virtual void Add(Mtl *m);
05174
05175
05176 RefResult AutoDelete() { return REF_SUCCEED; }
05177 CoreExport void DeleteThis();
05178 int NumRefs() { return Count();}
05179 RefTargetHandle GetReference(int i) { return (RefTargetHandle)(*this)[i];}
05180 protected:
05181 CoreExport virtual void SetReference(int i, RefTargetHandle rtarg);
05182 public:
05183 CoreExport RefTargetHandle Clone(RemapDir &remap);
05184 CoreExport RefResult NotifyRefChanged( Interval changeInt, RefTargetHandle hTarget,
05185 PartID& partID, RefMessage message );
05186
05187 CoreExport IOResult Save(ISave *isave);
05188 CoreExport IOResult Load(ILoad *iload);
05189
05190 };
05191
05192
05206 class MtlBaseLib : public ReferenceTarget, public MtlBaseList
05207 {
05208 public:
05209 CoreExport MtlBaseLib();
05211 CoreExport virtual ~MtlBaseLib();
05212
05213
05214 CoreExport virtual SClass_ID SuperClassID();
05215 CoreExport virtual Class_ID ClassID();
05216 CoreExport virtual void GetClassName(MSTR& s);
05217 CoreExport virtual int NumSubs();
05218 CoreExport virtual Animatable* SubAnim(int i);
05219 CoreExport virtual MSTR SubAnimName(int i);
05220
05221
05222 CoreExport virtual RefResult AutoDelete();
05223 CoreExport virtual void DeleteThis();
05224 CoreExport virtual int NumRefs();
05225 CoreExport virtual RefTargetHandle GetReference(int i);
05226 protected:
05227 CoreExport virtual void SetReference(int i, RefTargetHandle rtarg);
05228 public:
05229
05230 CoreExport virtual RefTargetHandle Clone(RemapDir &remap);
05231 CoreExport virtual RefResult NotifyRefChanged(
05232 Interval changeInt,
05233 RefTargetHandle hTarget,
05234 PartID& partID,
05235 RefMessage message );
05236
05237
05238 CoreExport virtual IOResult Save(ISave *isave);
05239 CoreExport virtual IOResult Load(ILoad *iload);
05240
05243 CoreExport virtual void DeleteAll();
05248 CoreExport virtual void Remove(MtlBase *m);
05253 CoreExport virtual void Add(MtlBase *m);
05255 CoreExport virtual void RemoveDuplicates();
05256
05257 protected:
05259 int GetMaterialCount() const;
05261
05265 MtlBase* GetMaterial(int i) const;
05267
05271 MtlBase* FindMaterial(const MCHAR* name) const;
05273
05277 bool AddMaterial(MtlBase* pMaterial);
05279
05281 void RemoveMaterial(MtlBase* pMaterial);
05282
05283 void SetMaterial(int i, MtlBase* pMaterial);
05284 void SetMaterialCount(int count);
05285
05286 void* mpReserved;
05287 };
05288
05289 #pragma warning(pop)
05290
05295 class NumList: public Tab<int> {
05296 public:
05305 CoreExport int Add(int j, BOOL checkUnique=TRUE);
05310 CoreExport int Find(int j);
05311 };
05312
05313 class MtlRemap: public MaxHeapOperators {
05314 public:
05315 virtual ~MtlRemap() {;}
05316 virtual Mtl* Map(Mtl *oldAddr)=0;
05317 };
05318
05319
05320
05321
05322
05330 class TexDADMgr: public DADMgr {
05331 ParamDlg *dlg;
05332 public:
05333 TexDADMgr(ParamDlg *d=NULL) { dlg = d;}
05334 void Init(ParamDlg *d) { dlg = d; }
05335
05336 SClass_ID GetDragType(HWND hwnd, POINT p) { return TEXMAP_CLASS_ID; }
05337
05338 CoreExport BOOL OkToDrop(ReferenceTarget *dropThis, HWND hfrom, HWND hto, POINT p, SClass_ID type, BOOL isNew);
05339 int SlotOwner() { return OWNER_MTL_TEX; }
05340 CoreExport ReferenceTarget *GetInstance(HWND hwnd, POINT p, SClass_ID type);
05341 CoreExport void Drop(ReferenceTarget *dropThis, HWND hwnd, POINT p, SClass_ID type, DADMgr* srcMgr = NULL, BOOL bSrcClone = FALSE);
05342 CoreExport BOOL LetMeHandleLocalDAD();
05343 CoreExport void LocalDragAndDrop(HWND h1, HWND h2, POINT p1, POINT p2);
05344 BOOL AutoTooltip(){ return TRUE; }
05345 };
05346
05347
05348
05349
05350
05351
05359 class MtlDADMgr: public DADMgr {
05360 ParamDlg *dlg;
05361 public:
05362 MtlDADMgr(ParamDlg *d=NULL) { dlg = d;}
05363 void Init(ParamDlg *d) { dlg = d; }
05364
05365 SClass_ID GetDragType(HWND hwnd, POINT p) { return MATERIAL_CLASS_ID; }
05366
05367 CoreExport BOOL OkToDrop(ReferenceTarget *dropThis, HWND hfrom, HWND hto, POINT p, SClass_ID type, BOOL isNew);
05368 int SlotOwner() { return OWNER_MTL_TEX; }
05369 CoreExport ReferenceTarget *GetInstance(HWND hwnd, POINT p, SClass_ID type);
05370 CoreExport void Drop(ReferenceTarget *dropThis, HWND hwnd, POINT p, SClass_ID type, DADMgr* srcMgr = NULL, BOOL bSrcClone = FALSE);
05371 CoreExport BOOL LetMeHandleLocalDAD();
05372 CoreExport void LocalDragAndDrop(HWND h1, HWND h2, POINT p1, POINT p2);
05373 BOOL AutoTooltip(){ return TRUE; }
05374 };
05375
05376
05377 #pragma warning(push)
05378 #pragma warning(disable:4239)
05379
05380
05388 class DADBitmapCarrier: public ReferenceTarget {
05389 MSTR name;
05390 public:
05395 void SetName(const MSTR &nm) { name = nm; }
05397 MSTR& GetName() { return name; }
05398
05399 Class_ID ClassID() { return Class_ID(0,1); }
05400 SClass_ID SuperClassID() { return BITMAPDAD_CLASS_ID; }
05401 void DeleteThis() { }
05402 RefResult NotifyRefChanged(Interval changeInt, RefTargetHandle hTarget,
05403 PartID& partID, RefMessage message) { return REF_DONTCARE; }
05404
05405 RefTargetHandle Clone(RemapDir &remap) { assert(0); return NULL; }
05406
05407 };
05408 #pragma warning(pop)
05409
05410
05411
05417 CoreExport DADBitmapCarrier *GetDADBitmapCarrier();
05418
05419
05420 CoreExport void SetLoadingMtlLib(MtlLib *ml);
05421 CoreExport void SetLoadingMtlBaseLib(MtlBaseLib *ml);
05422
05423 CoreExport ClassDesc* GetMtlLibCD();
05424 CoreExport ClassDesc* GetMtlBaseLibCD();
05425
05426 CoreExport UVGen* GetNewDefaultUVGen();
05427 CoreExport XYZGen* GetNewDefaultXYZGen();
05428 CoreExport TextureOutput* GetNewDefaultTextureOutput();
05429 inline int IsMtl(Animatable *m) { return m->SuperClassID()==MATERIAL_CLASS_ID; }
05430 inline int IsTex(Animatable *m) { return m->SuperClassID()==TEXMAP_CLASS_ID; }
05431 inline int IsMtlBase(Animatable *m) { return IsMtl(m)||IsTex(m); }
05432
05433
05434
05435
05436 CoreExport Mtl* CombineMaterials(Mtl *mat1, Mtl *mat2, int &mat2Offset);
05437
05438
05439 CoreExport Mtl* FitMaterialToMeshIDs(Mesh &mesh,Mtl *mat);
05440 CoreExport Mtl* FitMaterialToShapeIDs(BezierShape &shape, Mtl *mat);
05441 CoreExport Mtl* FitMaterialToPatchIDs(PatchMesh &patch, Mtl *mat);
05442 CoreExport Mtl* FitMaterialToPolyMeshIDs (MNMesh & mesh, Mtl *mat);
05443
05444
05445 CoreExport void FitMeshIDsToMaterial(Mesh &mesh, Mtl *mat);
05446 CoreExport void FitShapeIDsToMaterial(BezierShape &shape, Mtl *mat);
05447 CoreExport void FitPatchIDsToMaterial(PatchMesh &patch, Mtl *mat);
05448 CoreExport void FitPolyMeshIDsToMaterial (MNMesh & mesh, Mtl *mat);
05449
05450
05451 CoreExport Mtl *CondenseMatAssignments(Mesh &mesh, Mtl *mat);
05452 CoreExport Mtl *CondenseMatAssignments(BezierShape &shape, Mtl *mat);
05453 CoreExport Mtl *CondenseMatAssignments(PatchMesh &patch, Mtl *mat);
05454 CoreExport Mtl *CondenseMatAssignments (MNMesh &mesh, Mtl *mat);
05455
05456
05457
05458
05459
05460 #define ATTACHMAT_IDTOMAT 0
05461 #define ATTACHMAT_MATTOID 1
05462 #define ATTACHMAT_NEITHER 2
05463
05495 class AttachMatDlgUser: public MaxHeapOperators {
05496 public:
05498 virtual ~AttachMatDlgUser() {;}
05507 virtual int GetAttachMat()=0;
05509 virtual BOOL GetCondenseMat()=0;
05520 virtual void SetAttachMat(int value)=0;
05525 virtual void SetCondenseMat(BOOL sw)=0;
05526 };
05527
05528 #pragma warning(pop) // C4100
05529
05542 CoreExport BOOL DoAttachMatOptionDialog(IObjParam *ip, AttachMatDlgUser *user);
05543
05544 #define IID_INewSubMapNotification Interface_ID(0x3fe013b2, 0x31815874)
05545
05546
05547
05548
05549
05550
05551 class INewSubTexmapNotification: public BaseInterface
05552 {
05553 public:
05554 virtual void NewSubTexmapAdded(int i, Texmap *m) = 0;
05555 Interface_ID GetID() { return IID_INewSubMapNotification; }
05556 };
05557
05558 #define DEFAULT_TEXTURE_MAP_SIZE_INCHES 48.0f
05559 #define DEFAULT_TEXTURE_MAP_SIZE_METERS 1.0f
05560
05561