1 //*****************************************************************************/ 2 // Copyright (c) 1998-2006 Autodesk, Inc. 3 // All rights reserved. 4 // 5 // These coded instructions, statements, and computer programs contain 6 // unpublished proprietary information written by Autodesk, Inc., and are 7 // protected by Federal copyright law. They may not be disclosed to third 8 // parties or copied or duplicated in any form, in whole or in part, without 9 // the prior written consent of Autodesk, Inc. 10 //*****************************************************************************/ 11 /********************************************************************** 12 *< 13 FILE: bmtex.h 14 15 DESCRIPTION: BMTEX 2D Texture map. 16 17 CREATED BY: Daniel Levesque 18 19 HISTORY: 20 21 *> 22 **********************************************************************/ 23 24 #ifndef _BMTEX_H_ 25 #define _BMTEX_H_ 26 27 #include <max.h> 28 #include <imtl.h> 29 #include <bmmlib.h> 30 #include <bitmap.h> 31 #include <iparamm2.h> 32 #include <stdmat.h> 33 #include <IAssetAccessor.h> 34 #include <containers/array.h> 35 36 class BMTex; 37 class BMTexDlg; 38 struct NotifyInfo; 39 40 // JBW: IDs for ParamBlock2 blocks and parameters 41 // Parameter and ParamBlock IDs, bmtex_time 42 enum { bmtex_params,bmtex_time}; // pblock ID 43 44 enum 45 { 46 bmtex_clipu,bmtex_clipv,bmtex_clipw,bmtex_cliph, 47 bmtex_jitter,bmtex_usejitter, 48 bmtex_apply,bmtex_crop_place, 49 bmtex_filtering, 50 bmtex_monooutput, 51 bmtex_rgboutput, 52 bmtex_alphasource, 53 bmtex_premultalpha, 54 bmtex_bitmap, 55 bmtex_coords, // access for UVW mapping 56 bmtex_output, //output window 57 bmtex_filename // bitmap filename virtual parameter, JBW 2/23/99 58 }; 59 60 61 enum 62 { 63 bmtex_start,bmtex_playbackrate, bmtex_endcondition, 64 bmtex_matidtime 65 }; 66 67 //------------------------------------------------------------------------ 68 // BMSampler 69 //------------------------------------------------------------------------ 70 71 class BMSampler: public MapSampler { 72 public: 73 BMSampler(); 74 void Init(BMTex *bmt, Bitmap *bm=NULL); 75 int PlaceUV(ShadeContext& sc, float &u, float &v, int iu, int iv); 76 int PlaceUVFilter(ShadeContext& sc, float &u, float &v, int iu, int iv); 77 78 // -- from MapSampler 79 virtual AColor Sample(ShadeContext& sc, float u,float v); 80 virtual AColor SampleFilter(ShadeContext& sc, float u,float v, float du, float dv); 81 82 protected: 83 Bitmap *bm; 84 BMTex *tex; 85 int alphaSource; 86 float u0,v0,u1,v1,ufac,vfac,ujit,vjit; 87 int bmw,bmh,clipx, clipy, cliph; 88 float fclipw,fcliph, fbmh, fbmw; 89 } ; 90 91 //------------------------------------------------------------------------ 92 // BMAlphaSampler 93 //------------------------------------------------------------------------ 94 class BMAlphaSampler: public BMSampler { 95 public: 96 // -- from MapSampler Sample(ShadeContext & sc,float u,float v)97 virtual AColor Sample(ShadeContext& sc, float u,float v) { return AColor(0,0,0,0);} SampleFilter(ShadeContext & sc,float u,float v,float du,float dv)98 virtual AColor SampleFilter(ShadeContext& sc, float u,float v, float du, float dv) { return AColor(0,0,0,0);} 99 virtual float SampleMono(ShadeContext& sc, float u,float v); 100 virtual float SampleMonoFilter(ShadeContext& sc, float u,float v, float du, float dv); 101 } ; 102 103 104 105 //------------------------------------------------------------------------ 106 // BMCropper 107 //------------------------------------------------------------------------ 108 #ifndef NO_MTLEDITOR_BITMAP_CROPPING 109 class BMCropper:public CropCallback { 110 BMTexDlg *dlg; 111 BMTex *tex; 112 BOOL mode; 113 float u0,v0,w0,h0; 114 public: GetInitU()115 float GetInitU() { return u0; } GetInitV()116 float GetInitV() { return v0; } GetInitW()117 float GetInitW() { return w0; } GetInitH()118 float GetInitH() { return h0; } GetInitMode()119 BOOL GetInitMode() { return mode; } 120 void SetValues(float u, float v, float w, float h, BOOL md); 121 void OnClose(); 122 void Init(BMTexDlg *tx, TimeValue t); 123 }; 124 #endif // !NO_MTLEDITOR_BITMAP_CROPPING 125 126 //------------------------------------------------------------------------ 127 // BMTexDlg 128 //------------------------------------------------------------------------ 129 130 //class BMTexDlg: public ParamDlg , public DADMgr{ 131 class BMTexDlg: public ParamMap2UserDlgProc, protected BitmapNotify { 132 public: 133 HWND hwmedit; // window handle of the materials editor dialog 134 IMtlParams *ip; 135 BMTex *theBMTex; // current BMTex being edited. 136 HWND hPanel; // Rollup pane 137 // HWND hTime; // Time Rollup pane 138 TimeValue curTime; 139 // ICustButton *iName; 140 BOOL valid; 141 BOOL isActive; 142 BOOL cropping; 143 #ifndef NO_MTLEDITOR_BITMAP_CROPPING 144 BMCropper cropper; 145 #endif // !NO_MTLEDITOR_BITMAP_CROPPING 146 147 //----------------------------- 148 BMTexDlg(HWND hwMtlEdit, IMtlParams *imp, BMTex *m); 149 ~BMTexDlg(); 150 151 // inherited from ParamMap2UserDlgProc 152 void Update(TimeValue t); 153 INT_PTR DlgProc(TimeValue t,IParamMap2 *map,HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam); 154 155 // INT_PTR PanelProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam ); 156 INT_PTR TimeProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam ); 157 void LoadDialog(BOOL draw); // stuff params into dialog 158 void ReloadDialog(); 159 void BMNameChanged(); UpdateMtlDisplay()160 void UpdateMtlDisplay() { ip->MtlChanged(); } ActivateDlg(BOOL onOff)161 void ActivateDlg(BOOL onOff) {} 162 void StuffBMNameField(HWND hwndDlg); 163 void EnableAlphaButtons(BOOL isNew=FALSE); 164 void EnableViewImage(); Invalidate()165 void Invalidate() { valid = FALSE; InvalidateRect(hPanel,NULL,0); } 166 BOOL KeyAtCurTime(int id); 167 void ShowCropImage(); 168 void RemoveCropImage(); 169 170 // methods inherited from ParamDlg: 171 Class_ID ClassID(); 172 void SetThing(ReferenceTarget *m); GetThing()173 ReferenceTarget* GetThing() { return (ReferenceTarget *)theBMTex; } DeleteThis()174 void DeleteThis() { delete this; } 175 176 protected: 177 178 // from BitmapNotify 179 virtual int Changed(ULONG flags); 180 virtual void VFBClosed(); 181 182 private: 183 184 // The temporary bitmap instance used to display in the viewer. 185 Bitmap* m_displayBitmap; 186 }; 187 188 class BMTexNotify: public BitmapNotify { 189 public: 190 BMTex *tex; SetTex(BMTex * tx)191 void SetTex(BMTex *tx) { tex = tx; } 192 int Changed(ULONG flags); 193 }; 194 195 class BMTexPostLoad; 196 197 //-------------------------------------------------------------- 198 // BMTex: A 2D texture map 199 //-------------------------------------------------------------- 200 201 class BMTex: public BitmapTex { 202 friend class BMTexPostLoad; 203 friend class BMTexDlg; 204 friend class BMTexDlgProc; 205 friend class BMSampler; 206 friend class BMAlphaSampler; 207 friend class BMTexPBAccessor; 208 friend class BMTex2PostLoad; 209 210 static ParamDlg* uvGenDlg; 211 static ParamDlg* texoutDlg; 212 213 UVGen *uvGen; // ref #0 214 215 216 TextureOutput *texout; // ref #2 217 218 BMTexNotify bmNotify; 219 TexHandle *texHandle; 220 Interval ivalid; 221 BMSampler mysamp; 222 BMAlphaSampler alphasamp; 223 224 Tab<BMSampler*> mysampList; 225 Tab<BMAlphaSampler*> alphasampList; 226 227 public: 228 229 class BMMSilentModeGuard; 230 class ProxyModeDisableGuard; 231 232 BOOL isParm2; 233 234 float pbRate; 235 TimeValue startTime; 236 BOOL applyCrop; 237 BOOL loading; 238 BOOL loadingOld; 239 BOOL placeImage; 240 BOOL randPlace; 241 BOOL fileNotFound; 242 int filterType; 243 int alphaSource; 244 int rollScroll; 245 int endCond; 246 int alphaAsMono; 247 int alphaAsRGB; 248 float clipu, clipv, clipw, cliph, jitter; 249 BOOL premultAlpha; 250 BOOL isNew; 251 BOOL loadFailed; 252 BOOL bmWasSet; 253 int texTime; 254 Interval texValid; 255 Interval clipValid; 256 float rumax,rumin,rvmax,rvmin; 257 258 259 IParamBlock2 *pblock; // ref #1 260 IParamBlock2 *pblockTime; // ref #3 261 static BMTexDlg *paramDlg; 262 263 // Returns the bitmap to be used for display, render, etc. If 264 // "tie time to material ID" is enabled, this returns the LAST bitmap in the list. 265 // Why does it return the "last" bitmap in the list? That's for historical reasons; 266 // the old code used to behave like this. 267 Bitmap* GetActiveBitmap() const; 268 269 private: 270 271 //========================================================================== 272 // class BitmapHolder 273 // 274 // Encapsulates the handling of proxy vs. non-proxy bitmaps, 275 // to force all BMTex methods to pass through this class and the appropriate 276 // methods rather than accessing the bitmap directly. 277 //========================================================================== 278 class BitmapHolder { 279 public: 280 281 BitmapHolder(); 282 ~BitmapHolder(); 283 284 // Copy constructor is1 meant to be used by STL only. It is 285 // unsafe to be used in any other way as having multiple pointers to the same bitmap 286 // is simply unsafe. 287 BitmapHolder(const BitmapHolder& other); 288 BitmapHolder& operator=(const BitmapHolder& other); 289 290 // Enables/disables proxy mode, deleting the unused bitmap if necessary 291 void EnableProxyMode(bool deleteNonProxyBitmap); 292 void DisableProxyMode(bool deleteProxyBitmap); 293 294 // Loads the bitmap described by the bitmap info; may load the proxy bitmap, 295 // depending on the proxy mode. 296 bool LoadBitmap(BMMRES& status, bool silenceBitmapManager); 297 298 // Loads the bitmap in-place, re-using the same Bitmap. May load the proxy bitmap, 299 // depending on the proxy mode. Does nothing if a bitmap was not already created 300 // through LoadBitmap(). 301 void LoadInto(bool forceReload); 302 303 // Frees both proxy and non-proxy bitmaps. 304 void FreeBitmap(); 305 306 // Calls Bitmap::GoTo(), on either the proxy or non-proxy bitmap, depending on the proxy mode. 307 BMMRES GotoFrame(bool silenceBitmapManager); 308 309 // Returns the bitmap info of the non-proxy image. 310 // Even when the proxy image is loaded while the high-res image is not loaded, 311 // the non-proxy bitmap info will be up-to-date. 312 BitmapInfo& GetBitmapInfo(); 313 const BitmapInfo& GetBitmapInfo() const; 314 315 // Returns the bitmap to be used for getting pixel values; will return either 316 // the proxy or non-proxy bitmap, depending on the proxy mode. 317 Bitmap* GetBitmap() const; 318 319 // Called to override the bitmap being used; overrides the proxy bitmap, if 320 // and only if the input bitmap has the MAP_PROXY flag. 321 void SetBitmap(Bitmap* bitmap); 322 323 // The following methods apply the desired settings to both proxy and non-proxy bitmaps. 324 int SetFilter(UINT filterType); 325 void SetCroppingValues(float u, float v, float w, float h, BOOL placeImage); 326 void SetNotify(BitmapNotify *bmnot); 327 328 private: 329 330 void FreeProxyBitmap(); 331 void FreeNonProxyBitmap(); 332 333 bool m_isProxyMode; 334 335 // The non-proxy bitmap is loaded without the MAP_PROXYREQUEST flag. 336 // It is therefore guaranteed not to be a reduced-size image. 337 BitmapInfo m_nonProxyBitmapInfo; 338 Bitmap* m_nonProxyBitmap; 339 340 // The proxy bitmap is loaded WITH the MAP_PROXYREQUEST flag. Depending, on the proxy 341 // manager settings, it may or may not be a reduced-size image. 342 BitmapInfo m_proxyBitmapInfo; 343 Bitmap* m_proxyBitmap; 344 }; 345 346 // Indicates whether proxies have been disabled for rendering 347 bool m_proxiesWereDisabledForRendering; 348 // The number of times this bitmap has been temporarily disabled 349 // (this value enables us to avoid multiple disables) 350 int m_numTemporaryDisables; 351 // The bitmap currently in use. 352 BitmapHolder m_theBitmap; 353 // A shortcut to the bitmap info stored in m_theBitmap. 354 BitmapInfo& m_bi; 355 // The list of bitmaps use with the "match time to material ID" feature. 356 MaxSDK::Array<BitmapHolder> m_theBitmapList; 357 358 public: 359 360 BMTex(); 361 ~BMTex(); 362 IMtlParams *ip; 363 ParamDlg* CreateParamDlg(HWND hwMtlEdit, IMtlParams *imp); 364 void Update(TimeValue t, Interval& valid); 365 void Init(); 366 void Reset(); Validity(TimeValue t)367 Interval Validity(TimeValue t) { Interval v; Update(t,v); return ivalid; } 368 TSTR GetFullName(); 369 370 // Inherited from Texmap. Bitmap texture ouput is always meaningful IsLocalOutputMeaningful(ShadeContext & sc)371 bool IsLocalOutputMeaningful( ShadeContext& sc ) { return true; } 372 SetOutputLevel(TimeValue t,float v)373 void SetOutputLevel(TimeValue t, float v) {texout->SetOutputLevel(t,v); } 374 void SetFilterType(int ft); 375 void SetAlphaSource(int as); 376 void SetEndCondition(int endcond); 377 // void SetEndCondition(int endcond) { 378 // pblockTime->SetValue( bmtex_endcondition, 0, endcond); 379 // endCond = endcond; 380 // ParamID changedParam = pblock->LastNotifyParamID(); 381 // bmtex_time_param_blk.InvalidateUI(changedParam); 382 // } SetAlphaAsMono(BOOL onoff)383 void SetAlphaAsMono(BOOL onoff) { 384 onoff = onoff != 0; 385 BOOL oldOnOff = pblock->GetInt( bmtex_monooutput, 0 ) != 0; 386 if ( onoff != oldOnOff ) 387 pblock->SetValue( bmtex_monooutput, 0, onoff); 388 alphaAsMono = onoff; 389 } SetAlphaAsRGB(BOOL onoff)390 void SetAlphaAsRGB(BOOL onoff) { 391 onoff = onoff != 0; 392 BOOL oldOnOff = pblock->GetInt( bmtex_rgboutput, 0 ) != 0; 393 if ( onoff != oldOnOff ) 394 pblock->SetValue( bmtex_rgboutput, 0, onoff); 395 alphaAsRGB = onoff; 396 } SetPremultAlpha(BOOL onoff)397 void SetPremultAlpha(BOOL onoff) { 398 onoff = onoff != 0; 399 BOOL oldOnOff = pblock->GetInt( bmtex_premultalpha, 0 ) != 0; 400 if ( onoff != oldOnOff ) 401 pblock->SetValue( bmtex_premultalpha, 0, onoff); 402 premultAlpha = onoff; 403 } 404 void SetMapName(const TCHAR *name, bool isUIAction = false); 405 void SetPlaybackRate(float r); 406 void SetStartTime(TimeValue t); 407 408 /**** 409 void SetStartTime(TimeValue t) { 410 pblockTime->SetValue( bmtex_start, 0, t); 411 startTime = t; 412 } 413 void SetPlaybackRate(float r) { 414 pblockTime->SetValue( bmtex_playbackrate, 0, r); 415 pbRate = r; 416 } 417 ****/ 418 void SetClipU(TimeValue t, float f); 419 void SetClipV(TimeValue t, float f) ; 420 void SetClipW(TimeValue t, float f) ; 421 void SetClipH(TimeValue t, float f) ; 422 void SetJitter(TimeValue t, float f); 423 GetFilterType()424 int GetFilterType() { return filterType; } GetAlphaSource()425 int GetAlphaSource() { return alphaSource; } GetEndCondition()426 int GetEndCondition() { return endCond; } GetAlphaAsMono(BOOL onoff)427 BOOL GetAlphaAsMono(BOOL onoff) { return alphaAsMono; } GetAlphaAsRGB(BOOL onoff)428 BOOL GetAlphaAsRGB(BOOL onoff) { return alphaAsRGB; } GetPremultAlpha(BOOL onoff)429 BOOL GetPremultAlpha(BOOL onoff) { return premultAlpha; } GetMapName()430 TCHAR *GetMapName() { 431 UpdateBIName(); // CCJ 4/27/99 432 return const_cast<TCHAR*>(m_bi.Name()); 433 } GetStartTime()434 TimeValue GetStartTime() { return startTime; } GetPlaybackRate()435 float GetPlaybackRate() { return pbRate; } GetUVGen()436 StdUVGen* GetUVGen() { return (StdUVGen*)uvGen; } GetTexout()437 TextureOutput* GetTexout() { return texout; } 438 Bitmap *GetBitmap(TimeValue t); GetClipU(TimeValue t)439 float GetClipU(TimeValue t) { 440 return pblock->GetFloat( bmtex_clipu, t); 441 } GetClipV(TimeValue t)442 float GetClipV(TimeValue t) { 443 return pblock->GetFloat( bmtex_clipv, t); 444 } GetClipW(TimeValue t)445 float GetClipW(TimeValue t) { 446 return pblock->GetFloat( bmtex_clipw, t); 447 } GetClipH(TimeValue t)448 float GetClipH(TimeValue t) { 449 return pblock->GetFloat( bmtex_cliph, t); 450 } GetJitter(TimeValue t)451 float GetJitter(TimeValue t) { 452 return pblock->GetFloat( bmtex_jitter, t); 453 } 454 void StuffCropValues(); // stuff new values into the cropping VFB 455 void EnableStuff(); UpdateBIName()456 void UpdateBIName() { 457 PBBitmap* bitmapPB = NULL; 458 pblock->GetValue( bmtex_bitmap, 0,bitmapPB, clipValid ); 459 if (bitmapPB != NULL) 460 m_bi = bitmapPB->bi; //DS 2/24/99 461 else m_bi.SetName(_T("")); // DS 3/23/99 462 } 463 UpdtSampler()464 void UpdtSampler() { 465 BOOL tieTimeToMatID; 466 467 pblockTime->GetValue( bmtex_matidtime, 0, tieTimeToMatID,FOREVER); 468 469 if (!tieTimeToMatID) 470 { 471 mysamp.Init(this); 472 alphasamp.Init(this); 473 } 474 else 475 { 476 for (int i = 0; i < mysampList.Count(); i++) 477 { 478 mysampList[i]->Init(this,m_theBitmapList[i].GetBitmap()); 479 alphasampList[i]->Init(this,m_theBitmapList[i].GetBitmap()); 480 } 481 } 482 } 483 484 void NotifyChanged(); 485 void FreeBitmap(); 486 BMMRES LoadBitmap(TimeValue t, bool quiet=true, bool reload=false); 487 int CalcFrame(TimeValue t); 488 void ScaleBitmapBumpAmt(float f); 489 // 'isUIAction' should be set to true if the reloading occurs as the result 490 // of a "Reload" button being pressed in the UI. 491 void ReloadBitmap(bool isUIAction); 492 493 // Evaluate the color of map for the context. 494 RGBA EvalColor(ShadeContext& sc); 495 float EvalMono(ShadeContext& sc); 496 Point3 EvalNormalPerturb(ShadeContext& sc); 497 498 void DiscardTexHandle(); 499 SupportTexDisplay()500 BOOL SupportTexDisplay() { return TRUE; } 501 void ActivateTexDisplay(BOOL onoff); 502 DWORD_PTR GetActiveTexHandle(TimeValue t, TexHandleMaker& thmaker); 503 BITMAPINFO* GetVPDisplayDIB(TimeValue t, TexHandleMaker& thmaker, Interval &valid, BOOL mono=FALSE, BOOL forceW=0, BOOL forceH=0); 504 GetUVTransform(Matrix3 & uvtrans)505 void GetUVTransform(Matrix3 &uvtrans) { uvGen->GetUVTransform(uvtrans); } GetTextureTiling()506 int GetTextureTiling() { return uvGen->GetTextureTiling(); } GetUVWSource()507 int GetUVWSource() { return uvGen->GetUVWSource(); } GetMapChannel()508 int GetMapChannel () { return uvGen->GetMapChannel(); } GetTheUVGen()509 UVGen *GetTheUVGen() { return uvGen; } 510 511 int RenderBegin(TimeValue t, ULONG flags); 512 int RenderEnd(TimeValue t); 513 int LoadMapFiles(TimeValue t); 514 void RenderBitmap(TimeValue t, Bitmap *bm, float scale3D, BOOL filter); 515 516 Class_ID ClassID(); 517 SClass_ID SuperClassID(); 518 void GetClassName(TSTR& s); 519 void DeleteThis(); 520 521 // Requirements LocalRequirements(int subMtlNum)522 ULONG LocalRequirements(int subMtlNum) { 523 return uvGen->Requirements(subMtlNum); 524 } 525 LocalMappingsRequired(int subMtlNum,BitArray & mapreq,BitArray & bumpreq)526 void LocalMappingsRequired(int subMtlNum, BitArray & mapreq, BitArray &bumpreq) { 527 uvGen->MappingsRequired(subMtlNum,mapreq,bumpreq); 528 } 529 NumSubs()530 int NumSubs() { return 4; } 531 Animatable* SubAnim(int i); 532 TSTR SubAnimName(int i); SubNumToRefNum(int subNum)533 int SubNumToRefNum(int subNum) { return subNum; } InitSlotType(int sType)534 void InitSlotType(int sType) { if (uvGen) uvGen->InitSlotType(sType); } 535 536 // From ref NumRefs()537 int NumRefs() { return 4; } 538 RefTargetHandle GetReference(int i); 539 void SetReference(int i, RefTargetHandle rtarg); 540 int RemapRefOnLoad(int iref); 541 542 RefTargetHandle Clone(RemapDir &remap = DefaultRemapDir()); 543 RefResult NotifyRefChanged( Interval changeInt, RefTargetHandle hTarget, 544 PartID& partID, RefMessage message ); 545 546 // From Animatable 547 void EnumAuxFiles(NameEnumCallback& nameEnum, DWORD flags); 548 int SetProperty(ULONG id, void *data); 549 void SetBitmap(Bitmap *bm); FreeAllBitmaps()550 void FreeAllBitmaps() { 551 FreeBitmap(); 552 } 553 554 // IO 555 IOResult Save(ISave *isave); 556 IOResult Load(ILoad *iload); 557 558 // JBW: direct ParamBlock access is added NumParamBlocks()559 int NumParamBlocks() { return 2; } // return number of ParamBlocks in this instance 560 GetParamBlock(int i)561 IParamBlock2* GetParamBlock(int i) { 562 if (i == 0) return pblock; 563 else if (i == 1) return pblockTime; 564 else return NULL; } // return i'th ParamBlock GetParamBlockByID(BlockID id)565 IParamBlock2* GetParamBlockByID(BlockID id) 566 {if (pblock->ID() == id) return pblock ; 567 else if (pblockTime->ID() == id) return pblockTime ; 568 else return NULL; } // return id'd ParamBlock 569 570 // { return (pblock->ID() == id) ? pblock : NULL; } // return id'd ParamBlock 571 BOOL SetDlgThing(ParamDlg* dlg); 572 573 //watje pops up a bitmap loader dlg 574 void BitmapLoadDlg(); 575 //watje forces the bitmap to reload and view to be redrawn 576 void ReloadBitmapAndUpdate(); 577 578 //watje GetInterface(Interface_ID id)579 BaseInterface* GetInterface(Interface_ID id) 580 { 581 if (id == BITMAPTEX_INTERFACE) 582 return (BitmapTex*)this; 583 else 584 return FPMixinInterface::GetInterface(id); 585 } 586 void fnReload(); 587 void fnViewImage(); 588 589 int ComputeParticleFrame(ShadeContext& sc); 590 BOOL mTieTimeToMatID; 591 virtual int IsHighDynamicRange( ) const; 592 593 // -- from Animatable 594 virtual void* GetInterface(ULONG id); 595 // lrr 06/04 596 static TCHAR s_lastName[MAX_PATH]; // last loaded complete ( with path ) file name 597 598 private: 599 600 static void BMTexNotify(void *param, NotifyInfo *info); 601 static bool ShouldDisableProxiesForRendering(bool isMtlEditor); 602 static bool KeepNonProxyInMemoryAfterRendering(); 603 604 #ifdef DESIGN_VER 605 static void SetGeoReferenceInfo(BitmapInfo & bi, StdUVGen * uvGen); 606 #endif 607 608 void Notify(NotifyInfo* info); 609 void EnableProxyMode(bool deleteNonProxyBitmap); 610 void DisableProxyMode(bool deleteProxyBitmap); 611 void ShowBitmapProxyPrecacheDialog(); 612 613 // Initializes the bitmap samplers. To be called when the active bitmap might have changed. 614 void InitBitmapSamplers(); 615 }; 616 617 class BMTexPathAccessor : public IAssetAccessor { 618 public: 619 620 BMTexPathAccessor(BMTex* aTex); 621 virtual ~BMTexPathAccessor(); 622 623 // path accessor functions 624 virtual MaxSDK::Util::Path GetPath() const; 625 virtual void SetPath(const MaxSDK::Util::Path& aNewPath); 626 627 virtual bool IsInputAsset() const ; 628 629 // asset client information 630 virtual int GetAssetType() const ; 631 virtual const TCHAR* GetAssetDesc() const; 632 virtual const TCHAR* GetAssetClientDesc() const ; 633 virtual bool IsAssetPathWritable() const; 634 635 protected: 636 BMTex* mTex; 637 }; 638 639 //============================================================================== 640 // class BMTex::BMMSilentModeGuard 641 // 642 // Guard class used to silence the bitmap manager temporarily. 643 //============================================================================== 644 class BMTex::BMMSilentModeGuard { 645 public: 646 647 BMMSilentModeGuard(bool setSilentMode); 648 ~BMMSilentModeGuard(); 649 650 private: 651 652 bool m_setSilentMode; 653 BOOL m_previousSilentMode; 654 }; 655 656 //============================================================================== 657 // class BMTex::ProxyModeDisableGuard 658 // 659 // Guard class used to disable the proxy mode on a BMTex, temporarily, but only 660 // on the main bitmap (i.e. the bitmap list is not affected). 661 //============================================================================== 662 class BMTex::ProxyModeDisableGuard { 663 public: 664 665 // Set 'doDisable' to false basically makes this guard do nothing; 666 // it's useful to turn the guard OFF when a certain condition holds. 667 ProxyModeDisableGuard(BMTex& bitmapTex, bool doDisable = true); 668 ~ProxyModeDisableGuard(); 669 670 private: 671 672 bool m_doDisable; 673 BMTex& m_bitmapTex; 674 }; 675 676 #endif 677