00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #pragma once
00013 #include "buildver.h"
00014 #include "imtl.h"
00015 #include "TextureMapIndexConstants.h"
00016
00017 class BitmapInfo;
00018
00019
00020 #define NSHADES 4
00021 #define SHADE_CONST 0
00022 #define SHADE_PHONG 1
00023 #define SHADE_METAL 2
00024 #define SHADE_BLINN 3
00025
00026
00027 #define TRANSP_SUBTRACTIVE 0
00028 #define TRANSP_ADDITIVE 1
00029 #define TRANSP_FILTER 2
00030
00031
00032 #define ID_RAY_REFLECTION 12 // ray reflection: amt * spec color,
00033 #define ID_RAY_REFRACTION 13 // ray refraction: amt * transp * filter,
00034 #define ID_RAY_REFRACTION_IOR 14 // ray refraction: ior
00035 #define ID_TRANSLUCENT_CLR 15 // translucent color
00036
00037 class Shader;
00038 class Sampler;
00039
00040 namespace MaxSDK
00041 {
00042 namespace AssetManagement
00043 {
00044 class AssetUser;
00045 }
00046 }
00047
00059 class StdMat: public Mtl {
00060 public:
00065 virtual void SetSoften(BOOL onoff)=0;
00070 virtual void SetFaceMap(BOOL onoff)=0;
00075 virtual void SetTwoSided(BOOL onoff)=0;
00080 virtual void SetWire(BOOL onoff)=0;
00085 virtual void SetWireUnits(BOOL onOff)=0;
00090 virtual void SetFalloffOut(BOOL onOff)=0;
00098 virtual void SetTransparencyType(int type)=0;
00106 virtual void SetAmbient(Color c, TimeValue t)=0;
00114 virtual void SetDiffuse(Color c, TimeValue t)=0;
00122 virtual void SetSpecular(Color c, TimeValue t)=0;
00130 virtual void SetFilter(Color c, TimeValue t)=0;
00138 virtual void SetShininess(float v, TimeValue t)=0;
00146 virtual void SetShinStr(float v, TimeValue t)=0;
00154 virtual void SetSelfIllum(float v, TimeValue t)=0;
00155
00163 virtual void SetOpacity(float v, TimeValue t)=0;
00171 virtual void SetOpacFalloff(float v, TimeValue t)=0;
00179 virtual void SetWireSize(float s, TimeValue t)=0;
00187 virtual void SetIOR(float v, TimeValue t)=0;
00192 virtual void LockAmbDiffTex(BOOL onOff)=0;
00193
00194
00195
00196
00197
00198
00205 virtual void SetSamplingOn( BOOL on )=0;
00206 virtual BOOL GetSamplingOn()=0;
00207
00208
00217 virtual void SetShading(int s)=0;
00224 virtual int GetShading()=0;
00225
00226
00227
00234 virtual void EnableMap(int id, BOOL onoff)=0;
00241 virtual BOOL MapEnabled(int id)=0;
00251 virtual void SetTexmapAmt(int id, float amt, TimeValue t)=0;
00259 virtual float GetTexmapAmt(int id, TimeValue t)=0;
00260
00262 virtual BOOL GetSoften()=0;
00264 virtual BOOL GetFaceMap()=0;
00266 virtual BOOL GetTwoSided()=0;
00268 virtual BOOL GetWire()=0;
00271 virtual BOOL GetWireUnits()=0;
00273 virtual BOOL GetFalloffOut()=0;
00280 virtual int GetTransparencyType()=0;
00281
00286 virtual Color GetAmbient(TimeValue t)=0;
00291 virtual Color GetDiffuse(TimeValue t)=0;
00296 virtual Color GetSpecular(TimeValue t)=0;
00301 virtual Color GetFilter(TimeValue t)=0;
00306 virtual float GetShininess( TimeValue t)=0;
00312 virtual float GetShinStr(TimeValue t)=0;
00318 virtual float GetSelfIllum(TimeValue t)=0;
00323 virtual float GetOpacity( TimeValue t)=0;
00329 virtual float GetOpacFalloff(TimeValue t)=0;
00334 virtual float GetWireSize(TimeValue t)=0;
00340 virtual float GetIOR( TimeValue t)=0;
00343 virtual BOOL GetAmbDiffTexLock()=0;
00344 };
00345
00347
00348
00349
00355 class StdMat2 : public StdMat {
00356 public:
00357 BOOL SupportsShaders(){ return TRUE; }
00358
00364 virtual BOOL KeyAtTimeByID(ParamID id,TimeValue t) = 0;
00365
00367 MAX_DEPRECATED BOOL KeyAtTime(int id,TimeValue t);
00377 virtual int GetMapState( int indx ) = 0;
00383 virtual MSTR GetMapName( int indx ) = 0;
00390 virtual void SyncADTexLock( BOOL lockOn ) = 0;
00391
00392
00397 virtual BOOL SwitchShader( Class_ID id )= 0;
00400 virtual Shader* GetShader()= 0;
00403 virtual BOOL IsFaceted()= 0;
00408 virtual void SetFaceted( BOOL on )= 0;
00409
00410
00418 virtual long StdIDToChannel( long id )=0;
00419 #pragma warning(push)
00420 #pragma warning(disable:4100)
00421
00422
00434 virtual void SetShading(int s){}
00444 virtual int GetShading(){ return -1; }
00445
00446
00451 virtual BOOL SwitchSampler( Class_ID id )=0;
00453 virtual Sampler * GetPixelSampler(int mtlNum, BOOL backFace)=0;
00454
00455
00460 virtual BOOL GetSelfIllumColorOn(int mtlNum=0, BOOL backFace=FALSE)=0;
00464 virtual Color GetSelfIllumColor(int mtlNum, BOOL backFace)=0;
00470 virtual Color GetSelfIllumColor(TimeValue t)=0;
00475 virtual void SetSelfIllumColorOn( BOOL on )=0;
00483 virtual void SetSelfIllumColor(Color c, TimeValue t)=0;
00484
00485
00486 virtual float GetReflectionDim(float diffIllumIntensity ){ return 1.0f; }
00487 virtual Color TranspColor( float opac, Color filt, Color diff )=0;
00488 virtual float GetEffOpacity(ShadeContext& sc, float opac )=0;
00489 #pragma warning(pop)
00490 };
00491
00492
00493
00494 #define UVMAP_EXPLICIT 0
00495 #define UVMAP_SPHERE_ENV 1
00496 #define UVMAP_CYL_ENV 2
00497 #define UVMAP_SHRINK_ENV 3
00498 #define UVMAP_SCREEN_ENV 4
00499
00509 class StdUVGen: public UVGen {
00510 public:
00511 void* m_geoRefInfo;
00512
00513 BOOL IsStdUVGen() { return TRUE; }
00514
00529 virtual void SetCoordMapping(int)=0;
00537 virtual void SetUOffs(float f, TimeValue t)=0;
00545 virtual void SetVOffs(float f, TimeValue t)=0;
00553 virtual void SetUScl(float f, TimeValue t)=0;
00561 virtual void SetVScl(float f, TimeValue t)=0;
00569 virtual void SetAng(float f, TimeValue t)=0;
00576 virtual void SetUAng(float f, TimeValue t)=0;
00583 virtual void SetVAng(float f, TimeValue t)=0;
00590 virtual void SetWAng(float f, TimeValue t)=0;
00597 virtual void SetBlur(float f, TimeValue t)=0;
00605 virtual void SetBlurOffs(float f, TimeValue t)=0;
00613 virtual void SetNoiseAmt(float f, TimeValue t)=0;
00621 virtual void SetNoiseSize(float f, TimeValue t)=0;
00629 virtual void SetNoiseLev(int i, TimeValue t)=0;
00637 virtual void SetNoisePhs(float f, TimeValue t)=0;
00642 virtual void SetTextureTiling(int tiling)=0;
00647 virtual void SetMapChannel(int i)=0;
00654 virtual void SetFlag(ULONG f, ULONG val)=0;
00659 virtual void SetHideMapBackFlag(BOOL b)=0;
00660
00671 virtual int GetCoordMapping(int)=0;
00676 virtual float GetUOffs( TimeValue t)=0;
00681 virtual float GetVOffs( TimeValue t)=0;
00686 virtual float GetUScl( TimeValue t)=0;
00691 virtual float GetVScl( TimeValue t)=0;
00696 virtual float GetAng( TimeValue t)=0;
00701 virtual float GetUAng( TimeValue t)=0;
00706 virtual float GetVAng( TimeValue t)=0;
00711 virtual float GetWAng( TimeValue t)=0;
00716 virtual float GetBlur( TimeValue t)=0;
00721 virtual float GetBlurOffs( TimeValue t)=0;
00726 virtual float GetNoiseAmt( TimeValue t)=0;
00731 virtual float GetNoiseSize( TimeValue t)=0;
00736 virtual int GetNoiseLev( TimeValue t)=0;
00741 virtual float GetNoisePhs( TimeValue t)=0;
00744 virtual int GetTextureTiling()=0;
00746 virtual int GetMapChannel()=0;
00751 virtual int GetFlag(ULONG f)=0;
00753 virtual BOOL GetHideMapBackFlag()=0;
00754
00757 virtual void SetUseRealWorldScale(BOOL useRWS)=0;
00759 virtual BOOL GetUseRealWorldScale()=0;
00760 };
00761
00762
00763
00764
00765 #define XYZ_COORDS 0
00766 #define UVW_COORDS 1
00767 #define UVW2_COORDS 2
00768 #define XYZ_WORLD_COORDS 3
00769
00775 class StdXYZGen: public XYZGen {
00776 public:
00777
00780 BOOL IsStdXYZGen() { return TRUE; }
00790 virtual void SetCoordSystem(int s)=0;
00798 virtual void SetBlur(float f, TimeValue t)=0;
00806 virtual void SetBlurOffs(float f, TimeValue t)=0;
00816 virtual void SetOffs(int axis, float f, TimeValue t)=0;
00826 virtual void SetScl(int axis, float f, TimeValue t)=0;
00836 virtual void SetAng(int axis, float f, TimeValue t)=0;
00837
00845 virtual int GetCoordSystem()=0;
00850 virtual float GetBlur(TimeValue t)=0;
00855 virtual float GetBlurOffs(TimeValue t)=0;
00856 virtual float GetOffs(int axis, TimeValue t)=0;
00864 virtual float GetScl(int axis, TimeValue t)=0;
00872 virtual float GetAng(int axis, TimeValue t)=0;
00873
00878 virtual void SetMapChannel(int i)=0;
00880 virtual int GetMapChannel()=0;
00881 };
00882
00883 #define TEXOUT_XXXXX 1
00884 #define TEXOUT_INVERT 2
00885 #define TEXOUT_CLAMP 4
00886 #define TEXOUT_ALPHA_RGB 8
00887 #define TEXOUT_COLOR_MAP 16
00888 #define TEXOUT_COLOR_MAP_RGB 32
00889
00896 class StdTexoutGen: public TextureOutput {
00897 public:
00898
00903 BOOL IsStdTexoutGen() { return TRUE; }
00908 virtual float GetOutputLevel(TimeValue t)=0;
00911 virtual BOOL GetInvert()=0;
00914 virtual BOOL GetClamp()=0;
00917 virtual BOOL GetAlphaFromRGB()=0;
00922 virtual float GetRGBAmt( TimeValue t)=0;
00927 virtual float GetRGBOff( TimeValue t)=0;
00932 virtual float GetOutAmt( TimeValue t)=0;
00937 virtual float GetBumpAmt( TimeValue t)=0;
00948 virtual BOOL GetFlag(ULONG f)=0;
00949
00956 virtual void SetOutputLevel(TimeValue t, float v)=0;
00961 virtual void SetInvert(BOOL onoff)=0;
00966 virtual void SetClamp(BOOL onoff)=0;
00971 virtual void SetAlphaFromRGB(BOOL onoff)=0;
00978 virtual void SetRGBAmt( float f, TimeValue t)=0;
00985 virtual void SetRGBOff(float f, TimeValue t)=0;
00992 virtual void SetOutAmt(float f, TimeValue t)=0;
00999 virtual void SetBumpAmt(float f, TimeValue t)=0;
01011 virtual void SetFlag(ULONG f, ULONG val)=0;
01012 };
01013
01014
01015 #define FILTER_PYR 0
01016 #define FILTER_SAT 1
01017 #define FILTER_NADA 2
01018
01019
01020 #define ALPHA_FILE 0
01021 #define ALPHA_RGB 2
01022 #define ALPHA_NONE 3
01023
01024
01025 #define END_LOOP 0
01026 #define END_PINGPONG 1
01027 #define END_HOLD 2
01028
01029
01030
01031
01032
01033 #define BITMAPTEX_INTERFACE Interface_ID(0x55b4400e, 0x29ff7cc9)
01034
01035 #define GetIBitmapTextInterface(cd) \
01036 (BitmapTex *)(cd)->GetInterface(BITMAPTEX_INTERFACE)
01037
01038
01039 enum { bitmaptex_reload, bitmaptex_crop };
01040
01041
01042
01043
01048 class BitmapTex: public Texmap, public FPMixinInterface {
01049 public:
01050 #pragma warning(push)
01051 #pragma warning(disable:4100)
01052
01053
01054
01055 BEGIN_FUNCTION_MAP
01056 VFN_0(bitmaptex_reload, fnReload);
01057 VFN_0(bitmaptex_crop, fnViewImage);
01058
01059 END_FUNCTION_MAP
01060
01071 virtual void SetFilterType(int ft)=0;
01083 virtual void SetAlphaSource(int as)=0;
01091 virtual void SetEndCondition(int endcond)=0;
01097 virtual void SetAlphaAsMono(BOOL onoff)=0;
01103 virtual void SetAlphaAsRGB(BOOL onoff)=0;
01104 virtual void SetPremultAlpha(BOOL onoff)=0;
01105
01107
01114 virtual void SetMapName(const MCHAR *name, bool isUIAction = false)=0;
01115
01117
01124 virtual void SetMap(const MaxSDK::AssetManagement::AssetUser& asset, bool isUIAction=false)=0;
01125
01130 virtual void SetStartTime(TimeValue t)=0;
01138 virtual void SetPlaybackRate(float r)=0;
01139
01148 virtual int GetFilterType()=0;
01154 virtual int GetAlphaSource()=0;
01160 virtual int GetEndCondition()=0;
01167 virtual BOOL GetAlphaAsMono(BOOL onoff)=0;
01173 virtual BOOL GetAlphaAsRGB(BOOL onoff)=0;
01174 virtual BOOL GetPremultAlpha(BOOL onoff)=0;
01176 virtual MCHAR *GetMapName()=0;
01177
01179 virtual const MaxSDK::AssetManagement::AssetUser& GetMap() = 0;
01181 virtual TimeValue GetStartTime()=0;
01183 virtual float GetPlaybackRate()=0;
01184
01191 virtual StdUVGen* GetUVGen()=0;
01194 virtual TextureOutput* GetTexout()=0;
01195
01202 virtual void SetBitmap(Bitmap *bm) {}
01207 virtual Bitmap *GetBitmap(TimeValue t) { return NULL; }
01208 #pragma warning(pop)
01209
01212 virtual void BitmapLoadDlg() { }
01216 virtual void ReloadBitmapAndUpdate() { }
01217
01218
01219
01220
01221 FPInterfaceDesc* GetDesc();
01222
01225 virtual void fnReload()=0;
01228 virtual void fnViewImage()=0;
01229
01232 virtual void SetBitmapInfo(const BitmapInfo& ) { }
01233 };
01234
01239 class MultiMtl: public Mtl {
01240 public:
01246 virtual void SetNumSubMtls(int n)=0;
01253 virtual void GetSubMtlName(int mtlid, MSTR &s)=0;
01263 virtual void SetSubMtlAndName(int mtlid, Mtl *m, MSTR &subMtlName)=0;
01264
01269 virtual void AddMtl(ReferenceTarget *rt, int mtlid, MCHAR *name)=0;
01270
01273 virtual void RemoveMtl(int mtlid)=0;
01274 };
01275
01296 class Tex3D: public Texmap {
01297 public:
01307 virtual void ReadSXPData(MCHAR *name, void *sxpdata)=0;
01308 };
01309
01316 class MultiTex: public Texmap {
01317 public:
01318 #pragma warning(push)
01319 #pragma warning(disable:4100)
01320
01324 virtual void SetNumSubTexmaps(int n) {}
01334 virtual void SetColor(int i, Color c, TimeValue t=0){}
01335 #pragma warning(pop)
01336 };
01337
01342 class GradTex: public MultiTex {
01343 public:
01347 virtual StdUVGen* GetUVGen()=0;
01351 virtual TextureOutput* GetTexout()=0;
01358 virtual void SetMidPoint(float m, TimeValue t=0) { UNUSED_PARAM(m); UNUSED_PARAM(t); }
01359 };
01360
01361
01362
01363
01364
01370 class StdCubic: public Texmap {
01371 public:
01378 virtual void SetSize(int n, TimeValue t)=0;
01383 virtual void SetDoNth(BOOL onoff)=0;
01388 virtual void SetNth(int n)=0;
01393 virtual void SetApplyBlur(BOOL onoff)=0;
01401 virtual void SetBlur(float b, TimeValue t)=0;
01409 virtual void SetBlurOffset(float b, TimeValue t)=0;
01416 virtual void UseHighDynamicRange(BOOL onoff)=0;
01421 virtual int GetSize(TimeValue t)=0;
01426 virtual BOOL GetDoNth()=0;
01428 virtual int GetNth()=0;
01431 virtual BOOL GetApplyBlur()=0;
01436 virtual float GetBlur(TimeValue t)=0;
01441 virtual float GetBlurOffset(TimeValue t)=0;
01442 };
01443
01444
01445
01446
01451 class StdMirror: public Texmap {
01452 public:
01458 virtual void SetDoNth(BOOL onoff)=0;
01463 virtual void SetNth(int n)=0;
01468 virtual void SetApplyBlur(BOOL onoff)=0;
01475 virtual void SetBlur(float b, TimeValue t)=0;
01482 virtual void UseHighDynamicRange(BOOL onoff)=0;
01487 virtual BOOL GetDoNth()=0;
01489 virtual int GetNth()=0;
01492 virtual BOOL GetApplyBlur()=0;
01497 virtual float GetBlur(TimeValue t)=0;
01498 };
01499
01500
01501
01502
01503
01504
01505 #define FALLOFF_TOP 0
01506 #define FALLOFF_BOTTOM 1
01507 #define FALLOFF_NONE 2
01508
01514 class StdFog : public Atmospheric {
01515 public:
01522 virtual void SetColor(Color c, TimeValue t)=0;
01527 virtual void SetUseMap(BOOL onoff)=0;
01532 virtual void SetUseOpac(BOOL onoff)=0;
01537 virtual void SetColorMap(Texmap *tex)=0;
01542 virtual void SetOpacMap(Texmap *tex)=0;
01547 virtual void SetFogBackground(BOOL onoff)=0;
01552 virtual void SetType(int type)=0;
01559 virtual void SetNear(float v, TimeValue t)=0;
01566 virtual void SetFar(float v, TimeValue t)=0;
01573 virtual void SetTop(float v, TimeValue t)=0;
01580 virtual void SetBottom(float v, TimeValue t)=0;
01587 virtual void SetDensity(float v, TimeValue t)=0;
01595 virtual void SetFalloffType(int tv)=0;
01600 virtual void SetUseNoise(BOOL onoff)=0;
01607 virtual void SetNoiseScale(float v, TimeValue t)=0;
01614 virtual void SetNoiseAngle(float v, TimeValue t)=0;
01621 virtual void SetNoisePhase(float v, TimeValue t)=0;
01622
01627 virtual Color GetColor(TimeValue t)=0;
01630 virtual BOOL GetUseMap()=0;
01633 virtual BOOL GetUseOpac()=0;
01635 virtual Texmap *GetColorMap()=0;
01637 virtual Texmap *GetOpacMap()=0;
01640 virtual BOOL GetFogBackground()=0;
01643 virtual int GetType()=0;
01648 virtual float GetNear(TimeValue t)=0;
01653 virtual float GetFar(TimeValue t)=0;
01658 virtual float GetTop(TimeValue t)=0;
01663 virtual float GetBottom(TimeValue t)=0;
01668 virtual float GetDensity(TimeValue t)=0;
01674 virtual int GetFalloffType()=0;
01677 virtual BOOL GetUseNoise()=0;
01682 virtual float GetNoiseScale( TimeValue t)=0;
01687 virtual float GetNoiseAngle( TimeValue t)=0;
01692 virtual float GetNoisePhase( TimeValue t)=0;
01693
01694 };
01695
01696
01697
01698
01699 CoreExport void RegisterSXPReader(MCHAR *sxpName, Class_ID cid);
01700
01701
01702 CoreExport Tex3D *GetSXPReaderClass(MCHAR *sxpName);
01703
01704
01705
01706
01707 CoreExport StdMat2 *NewDefaultStdMat();
01708 CoreExport BitmapTex *NewDefaultBitmapTex();
01709 CoreExport MultiMtl *NewDefaultMultiMtl();
01710 CoreExport MultiTex *NewDefaultCompositeTex();
01711 CoreExport MultiTex *NewDefaultMixTex();
01712
01713 #ifndef NO_MAPTYPE_RGBTINT // orb 01-07-2001
01714 CoreExport MultiTex *NewDefaultTintTex();
01715 #endif // NO_MAPTYPE_RGBTINT
01716
01717 #ifndef NO_MAPTYPE_GRADIENT // orb 01-07-2001
01718 CoreExport GradTex *NewDefaultGradTex();
01719 #endif // NO_MAPTYPE_GRADIENT
01720
01721 #ifndef NO_MAPTYPE_REFLECTREFRACT // orb 01-07-2001
01722 CoreExport StdCubic *NewDefaultStdCubic();
01723 #endif // NO_MAPTYPE_REFLECTREFRACT
01724
01725 #ifndef NO_MAPTYPE_FLATMIRROR // orb 01-07-2001
01726 CoreExport StdMirror *NewDefaultStdMirror();
01727 #endif // NO_MAPTYPE_FLATMIRROR
01728
01729 CoreExport StdFog *NewDefaultStdFog();
01730