mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-14 02:27:40 -04:00
CWE Directory Reorganization
Rearrange directory structure of CWE to be loosely equivalent to the H'uru Plasma repository. Part 1: Movement of directories and files.
This commit is contained in:
107
Sources/Tools/MaxMtlUpdate/DllEntry.cpp
Normal file
107
Sources/Tools/MaxMtlUpdate/DllEntry.cpp
Normal file
@ -0,0 +1,107 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Additional permissions under GNU GPL version 3 section 7
|
||||
|
||||
If you modify this Program, or any covered work, by linking or
|
||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
|
||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
|
||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
|
||||
(or a modified version of those libraries),
|
||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
|
||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
|
||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
|
||||
licensors of this Program grant you additional
|
||||
permission to convey the resulting work. Corresponding Source for a
|
||||
non-source form of such a combination shall include the source code for
|
||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
|
||||
work.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
/**********************************************************************
|
||||
*<
|
||||
FILE: DllEntry.cpp
|
||||
|
||||
DESCRIPTION: Contains the Dll Entry stuff
|
||||
|
||||
CREATED BY:
|
||||
|
||||
HISTORY:
|
||||
|
||||
*> Copyright (c) 2000, All Rights Reserved.
|
||||
**********************************************************************/
|
||||
#include "plMaterialUpdate.h"
|
||||
|
||||
extern ClassDesc2* GetMaterialUpdateDesc();
|
||||
|
||||
HINSTANCE hInstance;
|
||||
int controlsInit = FALSE;
|
||||
|
||||
|
||||
BOOL WINAPI DllMain(HINSTANCE hinstDLL,ULONG fdwReason,LPVOID lpvReserved)
|
||||
{
|
||||
hInstance = hinstDLL; // Hang on to this DLL's instance handle.
|
||||
|
||||
if (!controlsInit) {
|
||||
controlsInit = TRUE;
|
||||
InitCustomControls(hInstance); // Initialize MAX's custom controls
|
||||
InitCommonControls(); // Initialize Win95 controls
|
||||
}
|
||||
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
__declspec( dllexport ) const TCHAR* LibDescription()
|
||||
{
|
||||
return GetString(IDS_LIBDESCRIPTION);
|
||||
}
|
||||
|
||||
//TODO: Must change this number when adding a new class
|
||||
__declspec( dllexport ) int LibNumberClasses()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
__declspec( dllexport ) ClassDesc* LibClassDesc(int i)
|
||||
{
|
||||
switch(i) {
|
||||
case 0: return GetMaterialUpdateDesc();
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
|
||||
__declspec( dllexport ) ULONG LibVersion()
|
||||
{
|
||||
return VERSION_3DSMAX;
|
||||
}
|
||||
|
||||
TCHAR *GetString(int id)
|
||||
{
|
||||
static TCHAR buf[256];
|
||||
|
||||
if (hInstance)
|
||||
return LoadString(hInstance, id, buf, sizeof(buf)) ? buf : NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
437
Sources/Tools/MaxMtlUpdate/OldMat/hsMaxLayer.h
Normal file
437
Sources/Tools/MaxMtlUpdate/OldMat/hsMaxLayer.h
Normal file
@ -0,0 +1,437 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Additional permissions under GNU GPL version 3 section 7
|
||||
|
||||
If you modify this Program, or any covered work, by linking or
|
||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
|
||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
|
||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
|
||||
(or a modified version of those libraries),
|
||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
|
||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
|
||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
|
||||
licensors of this Program grant you additional
|
||||
permission to convey the resulting work. Corresponding Source for a
|
||||
non-source form of such a combination shall include the source code for
|
||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
|
||||
work.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#ifndef __HSMAXLAYER_H
|
||||
#define __HSMAXLAYER_H
|
||||
|
||||
#include <bmmlib.h>
|
||||
#include "hsMaxLayerBase.h"
|
||||
//#include "hsMaxMtlRes.h"
|
||||
|
||||
//=========================================================================================
|
||||
// Flags and constants...
|
||||
//=========================================================================================
|
||||
|
||||
// ParamBlock entries
|
||||
#define PB_LAYER_CLIPU 0
|
||||
#define PB_LAYER_CLIPV 1
|
||||
#define PB_LAYER_CLIPW 2
|
||||
#define PB_LAYER_CLIPH 3
|
||||
#define PB_LAYER_JITTER 4
|
||||
#define PB_LAYER_AMBIENT 5
|
||||
#define PB_LAYER_COLOR 6
|
||||
#define PB_LAYER_SHININESS 7
|
||||
#define PB_LAYER_SHIN_STR 8
|
||||
#define PB_LAYER_SELFI 9
|
||||
#define PB_LAYER_OPAC 10
|
||||
#define PB_LAYER_OPFALL 11
|
||||
#define PB_LAYER_FILTER 12
|
||||
#define PB_LAYER_WIRESZ 13
|
||||
#define PB_LAYER_IOR 14
|
||||
#define PB_LAYER_BOUNCE 15
|
||||
#define PB_LAYER_STATFRIC 16
|
||||
#define PB_LAYER_SLIDFRIC 17
|
||||
#define PB_LAYER_DIMLEV 18
|
||||
#define PB_LAYER_DIMMULT 19
|
||||
#define PB_LAYER_MAPPERCENT 20
|
||||
#define PB_LAYER_MIPMAPBLUR 21
|
||||
#define PB_LAYER_LODBIAS 22
|
||||
#define PB_LAYER_DETAILBIAS 23
|
||||
#define PB_LAYER_DETAILMAX 24
|
||||
#define PB_LAYER_ENVIRONMAPSIZE 25
|
||||
#define LAYER_NPARAMS 26
|
||||
|
||||
#define HSMAX_LAYER_LOCK_AD 0x1
|
||||
|
||||
class hsMaxLayer;
|
||||
class hsMaxLayerDlg;
|
||||
|
||||
static LRESULT CALLBACK HiliteWndProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam );
|
||||
|
||||
// which edit control enum
|
||||
enum EditControl {Hc, Sc, Vc, Rc, Gc, Bc};
|
||||
|
||||
void GetBMName(BitmapInfo& bi, TSTR &fname);
|
||||
|
||||
//=========================================================================================
|
||||
// BMSampler
|
||||
//=========================================================================================
|
||||
|
||||
class BMSampler : public MapSampler {
|
||||
Bitmap *bm;
|
||||
hsMaxLayer *tex;
|
||||
int alphaSource;
|
||||
float u0,v0,u1,v1,ufac,vfac,ujit,vjit;
|
||||
int bmw,bmh,clipx, clipy, cliph;
|
||||
float fclipw,fcliph, fbmh, fbmw;
|
||||
public:
|
||||
BMSampler() { bm = NULL; }
|
||||
void Init(hsMaxLayer *bmt);
|
||||
int PlaceUV(ShadeContext& sc, float &u, float &v, int iu, int iv);
|
||||
void PlaceUVFilter(ShadeContext& sc, float &u, float &v, int iu, int iv);
|
||||
AColor Sample(ShadeContext& sc, float u,float v);
|
||||
AColor SampleFilter(ShadeContext& sc, float u,float v, float du, float dv);
|
||||
// float SampleMono(ShadeContext& sc, float u,float v);
|
||||
// float SampleMonoFilter(ShadeContext& sc, float u,float v, float du, float dv);
|
||||
};
|
||||
|
||||
//=========================================================================================
|
||||
// BM\AlphaSampler
|
||||
//=========================================================================================
|
||||
class BMAlphaSampler : public MapSampler {
|
||||
Bitmap *bm;
|
||||
hsMaxLayer *tex;
|
||||
float u0,v0,u1,v1,ufac,vfac,ujit,vjit;
|
||||
int bmw,bmh,clipx, clipy, cliph;
|
||||
float fclipw,fcliph, fbmh, fbmw;
|
||||
public:
|
||||
BMAlphaSampler() { bm = NULL; }
|
||||
void Init(hsMaxLayer *bmt);
|
||||
int PlaceUV(ShadeContext &sc, float &u, float &v, int iu, int iv);
|
||||
void PlaceUVFilter(ShadeContext &sc, float &u, float &v, int iu, int iv);
|
||||
AColor Sample(ShadeContext& sc, float u,float v) { return AColor(0,0,0,0);}
|
||||
AColor SampleFilter(ShadeContext& sc, float u,float v, float du, float dv) { return AColor(0,0,0,0);}
|
||||
float SampleMono(ShadeContext& sc, float u,float v);
|
||||
float SampleMonoFilter(ShadeContext& sc, float u,float v, float du, float dv);
|
||||
};
|
||||
|
||||
//=========================================================================================
|
||||
// hsMaxLayerNotify... this calls hsMaxLayer::NotifyChanged when a bitmap changes
|
||||
//=========================================================================================
|
||||
|
||||
class hsMaxLayerNotify : public BitmapNotify {
|
||||
public:
|
||||
void SetTex(hsMaxLayer *tx) { tex = tx; }
|
||||
int Changed(ULONG flags);
|
||||
|
||||
private:
|
||||
hsMaxLayer *tex;
|
||||
};
|
||||
|
||||
//=========================================================================================
|
||||
// hsMaxLayer: a material layer with (possibly) texture info, blending info and shading info
|
||||
//=========================================================================================
|
||||
|
||||
class hsMaxLayer : public hsMaxLayerBase {
|
||||
friend class hsMaxLayerPostLoad;
|
||||
friend class hsMaxLayerDlg;
|
||||
friend class BMSampler;
|
||||
friend class BMAlphaSampler;
|
||||
friend class BMCropper;
|
||||
public:
|
||||
hsMaxLayer();
|
||||
~hsMaxLayer();
|
||||
|
||||
ParamDlg* CreateParamDlg(HWND hwMtlEdit, IMtlParams *imp);
|
||||
void Update(TimeValue t, Interval& valid);
|
||||
void Reset();
|
||||
Interval Validity(TimeValue t) { Interval v; Update(t,v); return ivalid; }
|
||||
TSTR GetFullName();
|
||||
|
||||
void SetOutputLevel(TimeValue t, float v) { }
|
||||
void SetFilterType(int ft);
|
||||
void SetAlphaSource(int as);
|
||||
void SetEndCondition(int endcond) { endCond = endcond; }
|
||||
void SetAlphaAsMono(BOOL onoff) { alphaAsMono = onoff; }
|
||||
void SetAlphaAsRGB(BOOL onoff) { alphaAsRGB = onoff; }
|
||||
void SetPremultAlpha(BOOL onoff) { premultAlpha = onoff; }
|
||||
void SetMapName(TCHAR *name) {
|
||||
bi.SetName(name);
|
||||
FreeBitmap();
|
||||
if (paramDlg)
|
||||
ReloadBitmap();
|
||||
}
|
||||
void SetStartTime(TimeValue t) { startTime = t; }
|
||||
void SetPlaybackRate(float r) { pbRate = r; }
|
||||
|
||||
void SetClipU(TimeValue t, float f) { clipu = f; pblock->SetValue( PB_LAYER_CLIPU, t, f); }
|
||||
void SetClipV(TimeValue t, float f) { clipv = f; pblock->SetValue( PB_LAYER_CLIPV, t, f); }
|
||||
void SetClipW(TimeValue t, float f) { clipw = f; pblock->SetValue( PB_LAYER_CLIPW, t, f); }
|
||||
void SetClipH(TimeValue t, float f) { cliph = f; pblock->SetValue( PB_LAYER_CLIPH, t, f); }
|
||||
void SetJitter(TimeValue t, float f) { cliph = f; pblock->SetValue( PB_LAYER_JITTER, t, f); }
|
||||
|
||||
int GetFilterType() { return filterType; }
|
||||
int GetAlphaSource() { return alphaSource; }
|
||||
int GetEndCondition() { return endCond; }
|
||||
BOOL GetAlphaAsMono(BOOL onoff) { return alphaAsMono; }
|
||||
BOOL GetAlphaAsRGB(BOOL onoff) { return alphaAsRGB; }
|
||||
BOOL GetPremultAlpha(BOOL onoff) { return premultAlpha; }
|
||||
TCHAR *GetMapName() { return (TCHAR *)bi.Name(); }
|
||||
TimeValue GetStartTime() { return startTime; }
|
||||
float GetPlaybackRate() { return pbRate; }
|
||||
StdUVGen* GetUVGen() { return (StdUVGen*)uvGen; }
|
||||
TextureOutput* GetTexout() { return 0; }
|
||||
Bitmap *GetBitmap(TimeValue t) { LoadBitmap(t); return thebm; }
|
||||
float GetClipU(TimeValue t) { return pblock->GetFloat( PB_LAYER_CLIPU, t); }
|
||||
float GetClipV(TimeValue t) { return pblock->GetFloat( PB_LAYER_CLIPV, t); }
|
||||
float GetClipW(TimeValue t) { return pblock->GetFloat( PB_LAYER_CLIPW, t); }
|
||||
float GetClipH(TimeValue t) { return pblock->GetFloat( PB_LAYER_CLIPH, t); }
|
||||
float GetJitter(TimeValue t) { return pblock->GetFloat( PB_LAYER_JITTER, t); }
|
||||
void StuffCropValues(); // stuff new values into the cropping VFB
|
||||
|
||||
void UpdtSampler() {
|
||||
mysamp.Init(this);
|
||||
alphasamp.Init(this);
|
||||
}
|
||||
|
||||
void NotifyChanged();
|
||||
Bitmap* BuildBitmap(int size);
|
||||
void FreeBitmap();
|
||||
BMMRES LoadBitmap(TimeValue t);
|
||||
int CalcFrame(TimeValue t);
|
||||
void ScaleBitmapBumpAmt(float f);
|
||||
void ReloadBitmap();
|
||||
|
||||
// Evaluate the color of map for the context.
|
||||
RGBA EvalColor(ShadeContext& sc);
|
||||
float EvalMono(ShadeContext& sc);
|
||||
Point3 EvalNormalPerturb(ShadeContext& sc);
|
||||
|
||||
void DiscardTexHandle();
|
||||
|
||||
BOOL SupportTexDisplay() { return TRUE; }
|
||||
void ActivateTexDisplay(BOOL onoff);
|
||||
DWORD GetActiveTexHandle(TimeValue t, TexHandleMaker& thmaker);
|
||||
void GetUVTransform(Matrix3 &uvtrans) { uvGen->GetUVTransform(uvtrans); }
|
||||
int GetTextureTiling() { return uvGen->GetTextureTiling(); }
|
||||
int GetUVWSource() { return uvGen->GetUVWSource(); }
|
||||
UVGen *GetTheUVGen() { return uvGen; }
|
||||
#ifdef MAXR3
|
||||
int GetMapChannel () { return uvGen->GetMapChannel(); }
|
||||
#endif // MAXR3
|
||||
|
||||
int RenderBegin(TimeValue t, ULONG flags) {
|
||||
inRender = TRUE;
|
||||
return 1;
|
||||
}
|
||||
int RenderEnd(TimeValue t) {
|
||||
inRender = FALSE;
|
||||
return 1;
|
||||
}
|
||||
int LoadMapFiles(TimeValue t) { LoadBitmap(t); return 1; }
|
||||
void RenderBitmap(TimeValue t, Bitmap *bm, float scale3D, BOOL filter);
|
||||
|
||||
Class_ID ClassID() { return hsMaxLayerClassID; }
|
||||
SClass_ID SuperClassID() { return TEXMAP_CLASS_ID; }
|
||||
#ifdef HS_DEBUGGING
|
||||
void GetClassName(TSTR& s) { s= GetString(IDS_DS_LAYER_DEBUG); }
|
||||
#else
|
||||
void GetClassName(TSTR& s) { s= "";}//GetString(IDS_DS_LAYER); }
|
||||
#endif
|
||||
void DeleteThis() { delete this; }
|
||||
|
||||
// Requirements
|
||||
ULONG LocalRequirements(int subMtlNum);
|
||||
|
||||
int NumSubs() { return 2; }
|
||||
Animatable* SubAnim(int i);
|
||||
TSTR SubAnimName(int i);
|
||||
int SubNumToRefNum(int subNum) { return subNum; }
|
||||
void InitSlotType(int sType) { if (uvGen) uvGen->InitSlotType(sType); }
|
||||
|
||||
// From ref
|
||||
int NumRefs() { return 2; }
|
||||
RefTargetHandle GetReference(int i);
|
||||
void SetReference(int i, RefTargetHandle rtarg);
|
||||
|
||||
RefTargetHandle Clone(RemapDir &remap = NoRemap());
|
||||
RefResult NotifyRefChanged( Interval changeInt, RefTargetHandle hTarget,
|
||||
PartID& partID, RefMessage message );
|
||||
|
||||
// From Animatable
|
||||
void EnumAuxFiles(NameEnumCallback& nameEnum, DWORD flags) {
|
||||
bi.EnumAuxFiles(nameEnum,flags);
|
||||
}
|
||||
int SetProperty(ULONG id, void *data);
|
||||
void FreeAllBitmaps() {
|
||||
FreeBitmap();
|
||||
}
|
||||
|
||||
int GetFlag(ULONG f) { return (flags&f)?1:0; }
|
||||
void SetFlag(ULONG f, ULONG val);
|
||||
|
||||
// from hsMaxLayerBase
|
||||
BOOL KeyAtTime(int id,TimeValue t) { return pblock->KeyFrameAtTime(id,t); }
|
||||
Color GetAmbient(int mtlNum=0, BOOL backFace=FALSE);
|
||||
Color GetColor(int mtlNum=0, BOOL backFace=FALSE);
|
||||
|
||||
float GetShininess(int mtlNum=0, BOOL backFace=FALSE) { return 0.f; }
|
||||
float GetShinStr(int mtlNum=0, BOOL backFace=FALSE) { return 0.f; }
|
||||
float GetMapPercent(int mtlNum=0, BOOL backFace=FALSE) { return 0.f; }
|
||||
float GetOpacity(int mtlNum=0, BOOL backFace=FALSE) { return 0.f; }
|
||||
float GetMipMapBlur(int mtlNum=0, BOOL backFace=FALSE) { return pblock->GetFloat(PB_LAYER_MIPMAPBLUR, 0); }
|
||||
float GetLODBias(int mtlNum=0, BOOL backFace=FALSE) { return pblock->GetFloat(PB_LAYER_LODBIAS, 0); }
|
||||
int GetEnvironMapSize(int mtlNum=0, BOOL backFace=FALSE) { return 0; }
|
||||
|
||||
Color GetAmbient(TimeValue t) const;
|
||||
Color GetColor(TimeValue t) const;
|
||||
|
||||
float GetShininess(TimeValue t) const;
|
||||
float GetShinStr(TimeValue t) const;
|
||||
float GetMapPercent(TimeValue t) const;
|
||||
float GetOpacity(TimeValue t) const;
|
||||
float GetMipMapBlur(TimeValue t) const;
|
||||
float GetLODBias(TimeValue t) const;
|
||||
float GetDetailDropoffStart(TimeValue t) const;
|
||||
float GetDetailDropoffStop(TimeValue t) const;
|
||||
float GetDetailMax(TimeValue t) const;
|
||||
float GetDetailMin(TimeValue t) const;
|
||||
int GetEnvironMapSize(TimeValue t) const;
|
||||
|
||||
int GetNumExplicitMipmaps() const { return mipmapInfo.Count(); }
|
||||
TCHAR *GetExplicitMipmapName(int i) const { return mipmapOn[i] ? (TCHAR *)mipmapInfo[i].Name() : 0; }
|
||||
BOOL ExplicitMipmapEnabled(int i) const { return mipmapOn[i]; }
|
||||
int GetExplicitMipmapLevel(int i) const { return mipmapLevel[i]; }
|
||||
|
||||
BOOL GetDirty() const { return dirty; }
|
||||
ULONG GetBlendFlags() const { return blendFlags; }
|
||||
ULONG GetZFlags() const { return zFlags; }
|
||||
ULONG GetShadeFlags() const { return shadeFlags; }
|
||||
ULONG GetMiscFlags() const { return miscFlags; }
|
||||
ProcType GetProcType() const { return procType; }
|
||||
hsMatUsage GetUsage() const { return usageType; }
|
||||
|
||||
// Setting the things in hsMaxLayerBase
|
||||
void SetShininess(float v, TimeValue t);
|
||||
void SetShinStr(float v, TimeValue t);
|
||||
void SetMapPercent(float v, TimeValue t);
|
||||
void SetOpacity(float v, TimeValue t);
|
||||
void SetAmbient(Color c, TimeValue t);
|
||||
void SetColor(Color c, TimeValue t);
|
||||
void SetMipMapBlur(float f, TimeValue t);
|
||||
void SetLODBias(float f, TimeValue t);
|
||||
void SetDetailDropoffStart(float f, TimeValue t);
|
||||
void SetDetailDropoffStop(float f, TimeValue t);
|
||||
void SetDetailMax(float f, TimeValue t);
|
||||
void SetDetailMin(float f, TimeValue t);
|
||||
void SetEnvironMapSize(int i, TimeValue t);
|
||||
|
||||
void SetNumExplicitMipmaps(int n);
|
||||
void SetExplicitMipmapName(int i, const char *n) { mipmapInfo[i].SetName(n); }
|
||||
void EnableExplicitMipmap(int i, BOOL state) { mipmapOn[i] = state; }
|
||||
void SetExplicitMipmapLevel(int i, int l) { mipmapLevel[i] = l; }
|
||||
|
||||
void SetDirty(BOOL state) { dirty = state; }
|
||||
void SetBlendFlag(int i, BOOL state);
|
||||
void SetZFlag(int flag, BOOL state);
|
||||
void SetShadeFlag(int flag, BOOL state);
|
||||
void SetMiscFlag(int flag, BOOL state);
|
||||
void SetProcType(ProcType type);
|
||||
void SetUsage(hsMatUsage use);
|
||||
void GuessUsage();
|
||||
|
||||
// IO
|
||||
IOResult Save(ISave *isave);
|
||||
IOResult Load(ILoad *iload);
|
||||
|
||||
// Colin Hack
|
||||
BOOL GetApplyCrop() { return applyCrop; }
|
||||
BOOL GetPlaceImage() { return placeImage; }
|
||||
|
||||
private:
|
||||
UVGen *uvGen; // ref #0
|
||||
IParamBlock *pblock; // ref #1
|
||||
BitmapInfo bi;
|
||||
TSTR bmName; // for loading old files only
|
||||
Bitmap *thebm;
|
||||
hsMaxLayerNotify bmNotify;
|
||||
TexHandle *texHandle;
|
||||
float pbRate;
|
||||
TimeValue startTime;
|
||||
Interval ivalid;
|
||||
|
||||
// Samplers
|
||||
BMSampler mysamp;
|
||||
BMAlphaSampler alphasamp;
|
||||
|
||||
BOOL applyCrop;
|
||||
BOOL loadingOld;
|
||||
BOOL placeImage;
|
||||
BOOL randPlace;
|
||||
int filterType;
|
||||
int alphaSource;
|
||||
int endCond;
|
||||
int alphaAsMono;
|
||||
int alphaAsRGB;
|
||||
float clipu, clipv, clipw, cliph, jitter;
|
||||
BOOL premultAlpha;
|
||||
BOOL isNew;
|
||||
BOOL loadFailed;
|
||||
BOOL inRender;
|
||||
hsMaxLayerDlg *paramDlg;
|
||||
int texTime;
|
||||
Interval texValid;
|
||||
Interval clipValid;
|
||||
float rumax,rumin,rvmax,rvmin;
|
||||
|
||||
// ADDED
|
||||
ULONG flags;
|
||||
|
||||
Color ambient;
|
||||
Color color;
|
||||
|
||||
float opacity;
|
||||
float shine_str;
|
||||
float shininess;
|
||||
float mapPercent;
|
||||
float mipMapBlur;
|
||||
float lodBias;
|
||||
float detailDropoffStart;
|
||||
float detailDropoffStop;
|
||||
float detailMax;
|
||||
float detailMin;
|
||||
int environMapSize;
|
||||
|
||||
BOOL dirty;
|
||||
|
||||
ULONG blendFlags;
|
||||
ULONG zFlags;
|
||||
ULONG shadeFlags;
|
||||
ULONG miscFlags;
|
||||
ProcType procType;
|
||||
hsMatUsage usageType;
|
||||
|
||||
Tab<BitmapInfo> mipmapInfo; // references
|
||||
Tab<BOOL> mipmapOn;
|
||||
Tab<int> mipmapLevel;
|
||||
};
|
||||
|
||||
#endif
|
206
Sources/Tools/MaxMtlUpdate/OldMat/hsMaxLayerBase.h
Normal file
206
Sources/Tools/MaxMtlUpdate/OldMat/hsMaxLayerBase.h
Normal file
@ -0,0 +1,206 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Additional permissions under GNU GPL version 3 section 7
|
||||
|
||||
If you modify this Program, or any covered work, by linking or
|
||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
|
||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
|
||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
|
||||
(or a modified version of those libraries),
|
||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
|
||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
|
||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
|
||||
licensors of this Program grant you additional
|
||||
permission to convey the resulting work. Corresponding Source for a
|
||||
non-source form of such a combination shall include the source code for
|
||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
|
||||
work.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#ifndef __HSMAXLAYERBASE_H
|
||||
#define __HSMAXLAYERBASE_H
|
||||
|
||||
#include "stdmat.h"
|
||||
|
||||
#define HSMAX_LAYER_CLASS_ID 0x41990fe7
|
||||
|
||||
const Class_ID hsMaxLayerClassID(HSMAX_LAYER_CLASS_ID, 0x72404998);
|
||||
const Class_ID hsMaxMtlClassID(0x2f335902, 0x111d2ea7);
|
||||
const Class_ID hsEnvironMapMtlClassID(0x98777b3, 0x5eb270dd);
|
||||
|
||||
class hsMaxLayerBase : public BitmapTex {
|
||||
public:
|
||||
enum hsMatBlendFlags {
|
||||
kBlendTest = 0x1, // dev
|
||||
// Rest of blends are mutually exclusive
|
||||
kBlendAlpha = 0x2, // dev
|
||||
kBlendMult = 0x4, // dev
|
||||
kBlendAdd = 0x8, // dev
|
||||
kBlendMultColorPlusMultAlpha = 0x10, // dev
|
||||
kBlendAntiAlias = 0x20,
|
||||
kBlendDetail = 0x40,
|
||||
kBlendDetailAdd = 0x80,
|
||||
kBlendMask = kBlendAlpha
|
||||
| kBlendMult
|
||||
| kBlendAdd
|
||||
| kBlendMultColorPlusMultAlpha
|
||||
| kBlendAntiAlias
|
||||
| kBlendDetail
|
||||
| kBlendDetailAdd,
|
||||
kBlendInvertAlpha = 0x1000, // dev
|
||||
kBlendInvertColor = 0x2000, // dev
|
||||
kBlendAlphaMult = 0x4000,
|
||||
kBlendAlphaAdd = 0x8000,
|
||||
kBlendNoColor = 0x10000,
|
||||
kBlendNoVtxAlpha = 0x20000
|
||||
};
|
||||
|
||||
enum hsMatZFlags {
|
||||
kZIncLayer = 0x1, // dev
|
||||
kZOnlyZ = 0x2, // dev
|
||||
kZClearZ = 0x4, // dev
|
||||
kZNoZRead = 0x8, // dev
|
||||
kZNoZWrite = 0x10,
|
||||
kZMask = kZNoZWrite | kZClearZ | kZNoZRead,
|
||||
kZLODBias = 0x20
|
||||
};
|
||||
|
||||
enum hsMatShadeFlags {
|
||||
kShadeSoftShadow = 0x1, // view, dev
|
||||
kShadeNoProjectors = 0x2, // projector
|
||||
kShadeVertexShade = 0x20, // dev
|
||||
kShadeNoShade = 0x40, // view,dev
|
||||
kShadeBlack = kShadeNoShade,
|
||||
kShadeSpecular = 0x80, // view, dev
|
||||
kShadeNoFog = 0x100, // dev
|
||||
kShadeWhite = 0x200,
|
||||
kShadeSpecularAlpha = 0x400,
|
||||
kShadeSpecularColor = 0x800,
|
||||
kShadeSpecularHighlight = 0x1000,
|
||||
kShadeVertColShade = 0x2000,
|
||||
kShadeInherit = 0x4000
|
||||
};
|
||||
|
||||
enum hsMatMiscFlags {
|
||||
kMiscWireFrame = 0x1, // dev (running out of bits)
|
||||
kMiscDrawMeshOutlines = 0x2, // dev, currently unimplemented
|
||||
kMiscTwoSided = 0x4, // view,dev
|
||||
kMiscDrawAsSplats = 0x8, // dev? bwt
|
||||
kMiscMipMap = 0x10,
|
||||
kMiscUseBitmap = 0x20,
|
||||
kMiscIntensityOnly = 0x40,
|
||||
kMiscAutoStart = 0x80,
|
||||
kMiscDetailBias = 0x100, // obsolete...
|
||||
kMiscDetailMax = 0x200, // obsolete...
|
||||
kMiscExplicitMipmap = 0x400,
|
||||
kMiscAdjustPlane = 0x800,
|
||||
kMiscAdjustCylinder = 0x1000,
|
||||
kMiscAdjustSphere = 0x2000,
|
||||
kMiscTroubledLoner = 0x4000,
|
||||
kMiscBindSkip = 0x8000,
|
||||
kMiscBindMask = 0x10000,
|
||||
kMiscForceNonCompressed = 0x20000,
|
||||
kMiscNoMaxSize = 0x40000,
|
||||
kMiscHalfSize = 0x80000,
|
||||
kMiscBindNext = 0x100000,
|
||||
kMiscBindPrev = 0x200000,
|
||||
kMiscReserved = 0x400000
|
||||
};
|
||||
|
||||
enum ProcType {
|
||||
kProcTypeDefault,
|
||||
kProcTypeWater
|
||||
};
|
||||
|
||||
enum hsMatUsage {
|
||||
kUseNone = 0x0,
|
||||
kUseBase = 0x1,
|
||||
kUseDetail = 0x2,
|
||||
kUseGrime = 0x4,
|
||||
kUseTransition = 0x8,
|
||||
kUseHighlight = 0x10,
|
||||
kUseMask = 0x20,
|
||||
kUseShadowLight = 0x40,
|
||||
kUseHelper = 0x80,
|
||||
|
||||
kUseGuess = 0x10000000
|
||||
};
|
||||
|
||||
public:
|
||||
// For hsMaxMtl... Special case for higher layers. Sigh.
|
||||
virtual void SetDirty(BOOL state) = 0;
|
||||
virtual void SetBlendFlag(int i, BOOL state) = 0;
|
||||
virtual void SetZFlag(int flag, BOOL state) = 0;
|
||||
virtual void SetShadeFlag(int flag, BOOL state) = 0;
|
||||
virtual void SetMiscFlag(int flag, BOOL state) = 0;
|
||||
virtual void SetProcType(ProcType type) = 0;
|
||||
virtual void SetUsage(hsMatUsage use) = 0;
|
||||
virtual void GuessUsage() = 0;
|
||||
|
||||
// For interactive renderer
|
||||
virtual Color GetAmbient(int mtlNum=0, BOOL backFace=FALSE) = 0;
|
||||
virtual Color GetColor(int mtlNum=0, BOOL backFace=FALSE) = 0;
|
||||
|
||||
virtual float GetShininess(int mtlNum=0, BOOL backFace=FALSE) = 0;
|
||||
virtual float GetShinStr(int mtlNum=0, BOOL backFace=FALSE) = 0;
|
||||
virtual float GetOpacity(int mtlNum=0, BOOL backFace=FALSE) = 0;
|
||||
|
||||
// For exporter
|
||||
virtual Color GetAmbient(TimeValue t) const = 0;
|
||||
virtual Color GetColor(TimeValue t) const = 0;
|
||||
|
||||
virtual float GetShininess(TimeValue t) const = 0;
|
||||
virtual float GetShinStr(TimeValue t) const = 0;
|
||||
virtual float GetMapPercent(TimeValue t) const = 0;
|
||||
virtual float GetOpacity(TimeValue t) const = 0;
|
||||
virtual float GetMipMapBlur(TimeValue t) const = 0;
|
||||
virtual float GetLODBias(TimeValue t) const = 0;
|
||||
virtual float GetDetailDropoffStart(TimeValue t) const = 0;
|
||||
virtual float GetDetailDropoffStop(TimeValue t) const = 0;
|
||||
virtual float GetDetailMax(TimeValue t) const = 0;
|
||||
virtual float GetDetailMin(TimeValue t) const = 0;
|
||||
virtual int GetEnvironMapSize(TimeValue t) const = 0;
|
||||
|
||||
virtual BOOL GetDirty() const = 0;
|
||||
virtual ULONG GetBlendFlags() const = 0;
|
||||
virtual ULONG GetZFlags() const = 0;
|
||||
virtual ULONG GetShadeFlags() const = 0;
|
||||
virtual ULONG GetMiscFlags() const = 0;
|
||||
virtual ProcType GetProcType() const = 0;
|
||||
virtual hsMatUsage GetUsage() const = 0;
|
||||
|
||||
virtual int GetNumExplicitMipmaps() const = 0;
|
||||
virtual TCHAR *GetExplicitMipmapName(int i) const = 0;
|
||||
virtual BOOL ExplicitMipmapEnabled(int i) const = 0;
|
||||
virtual int GetExplicitMipmapLevel(int i) const = 0;
|
||||
|
||||
#ifdef MAXR4
|
||||
// KLUDGE - Had to do this to compile under MAX4 beta
|
||||
virtual void fnReload() {};
|
||||
virtual void fnViewImage() {};
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif
|
411
Sources/Tools/MaxMtlUpdate/plMaterialUpdate.cpp
Normal file
411
Sources/Tools/MaxMtlUpdate/plMaterialUpdate.cpp
Normal file
@ -0,0 +1,411 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Additional permissions under GNU GPL version 3 section 7
|
||||
|
||||
If you modify this Program, or any covered work, by linking or
|
||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
|
||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
|
||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
|
||||
(or a modified version of those libraries),
|
||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
|
||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
|
||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
|
||||
licensors of this Program grant you additional
|
||||
permission to convey the resulting work. Corresponding Source for a
|
||||
non-source form of such a combination shall include the source code for
|
||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
|
||||
work.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#include "plMaterialUpdate.h"
|
||||
|
||||
#define MAXR3
|
||||
#define MAXR4
|
||||
|
||||
//#include "OldMat/hsMaxMtl.h"
|
||||
#include "OldMat/hsMaxLayer.h"
|
||||
|
||||
#include "../MaxPlasmaMtls/Layers/plLayerTex.h"
|
||||
#include "../MaxPlasmaMtls/Layers/plLayerTexBitmapPB.h"
|
||||
|
||||
#include "../MaxPlasmaMtls/Materials/plPassMtl.h"
|
||||
#include "../MaxPlasmaMtls/Materials/plPassMtlBase.h"
|
||||
#include "../MaxPlasmaMtls/Materials/plPassMtlBasicPB.h"
|
||||
#include "../MaxPlasmaMtls/Materials/plPassMtlAdvPB.h"
|
||||
#include "../MaxPlasmaMtls/Materials/plPassMtlLayersPB.h"
|
||||
|
||||
#include "../MaxExport/plExportProgressBar.h"
|
||||
|
||||
#define PLMATERIALUPDATE_CLASS_ID Class_ID(0x70acddfe, 0x68f42f3f)
|
||||
|
||||
#include <map>
|
||||
|
||||
class plMaterialUpdate : public UtilityObj
|
||||
{
|
||||
protected:
|
||||
HWND fhPanel;
|
||||
Interface *fInterface;
|
||||
std::map<MtlBase*, MtlBase*> fDoneMaterials;
|
||||
bool fConvertSecondLayer;
|
||||
|
||||
plMaterialUpdate();
|
||||
|
||||
public:
|
||||
static plMaterialUpdate &Instance();
|
||||
|
||||
~plMaterialUpdate();
|
||||
void DeleteThis() {}
|
||||
|
||||
void BeginEditParams(Interface *ip,IUtil *iu);
|
||||
void EndEditParams(Interface *ip,IUtil *iu);
|
||||
|
||||
bool ConvertAllMtls(INode *node, plExportProgressBar *bar);
|
||||
|
||||
protected:
|
||||
static BOOL CALLBACK DlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
void IRenameMtls(MtlBase *oldMtl, MtlBase *newMtl);
|
||||
|
||||
void IConvert(INode *node);
|
||||
plPassMtl *IConvertMtl(Mtl *mtl, Mtl *multi=NULL, int subNum=-1);
|
||||
plLayerTex *IConvertLayer(hsMaxLayer *layer);
|
||||
|
||||
void ICopyMtlParams(plPassMtl *mtl, hsMaxLayer *layer);
|
||||
};
|
||||
|
||||
class plMaterialUpdateClassDesc:public ClassDesc2 {
|
||||
public:
|
||||
int IsPublic() { return TRUE; }
|
||||
void * Create(BOOL loading = FALSE) { return &plMaterialUpdate::Instance(); }
|
||||
const TCHAR * ClassName() { return "Plasma Material Converter"; }
|
||||
SClass_ID SuperClassID() { return UTILITY_CLASS_ID; }
|
||||
Class_ID ClassID() { return PLMATERIALUPDATE_CLASS_ID; }
|
||||
const TCHAR* Category() { return GetString(IDS_CATEGORY); }
|
||||
|
||||
const TCHAR* InternalName() { return _T("plMaterialConverter"); } // returns fixed parsable name (scripter-visible name)
|
||||
HINSTANCE HInstance() { return hInstance; } // returns owning module handle
|
||||
};
|
||||
|
||||
static plMaterialUpdateClassDesc plMaterialUpdateDesc;
|
||||
ClassDesc2* GetMaterialUpdateDesc() { return &plMaterialUpdateDesc; }
|
||||
|
||||
plMaterialUpdate &plMaterialUpdate::Instance()
|
||||
{
|
||||
static plMaterialUpdate theInstance;
|
||||
return theInstance;
|
||||
}
|
||||
|
||||
plMaterialUpdate::plMaterialUpdate() : fInterface(NULL), fhPanel(NULL), fConvertSecondLayer(false)
|
||||
{
|
||||
}
|
||||
|
||||
plMaterialUpdate::~plMaterialUpdate()
|
||||
{
|
||||
}
|
||||
|
||||
BOOL plMaterialUpdate::DlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
switch (msg)
|
||||
{
|
||||
case WM_COMMAND:
|
||||
if (LOWORD(wParam) == IDC_BUTTON1 && HIWORD(wParam) == BN_CLICKED)
|
||||
{
|
||||
plMaterialUpdate &p = Instance();
|
||||
|
||||
plExportProgressBar bar;
|
||||
bar.Start("Convert Materials");
|
||||
|
||||
if (IsDlgButtonChecked(hWnd, IDC_CHECK1) == BST_CHECKED)
|
||||
p.fConvertSecondLayer = true;
|
||||
|
||||
p.ConvertAllMtls(p.fInterface->GetRootNode(), &bar);
|
||||
|
||||
p.fInterface->RedrawViews(p.fInterface->GetTime());
|
||||
p.fDoneMaterials.clear();
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void plMaterialUpdate::BeginEditParams(Interface *ip, IUtil *iu)
|
||||
{
|
||||
fInterface = ip;
|
||||
fhPanel = fInterface->AddRollupPage(
|
||||
hInstance,
|
||||
MAKEINTRESOURCE(IDD_PANEL),
|
||||
DlgProc,
|
||||
GetString(IDS_PARAMS),
|
||||
0);
|
||||
}
|
||||
|
||||
void plMaterialUpdate::EndEditParams(Interface *ip, IUtil *iu)
|
||||
{
|
||||
fInterface->DeleteRollupPage(fhPanel);
|
||||
fInterface = NULL;
|
||||
fhPanel = NULL;
|
||||
}
|
||||
|
||||
bool plMaterialUpdate::ConvertAllMtls(INode *node, plExportProgressBar *bar)
|
||||
{
|
||||
IConvert(node);
|
||||
|
||||
bool cancel = bar->Update();
|
||||
if (cancel)
|
||||
return false;
|
||||
|
||||
for (int i = 0; i < node->NumChildren(); i++)
|
||||
{
|
||||
if (!ConvertAllMtls(node->GetChildNode(i), bar))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void plMaterialUpdate::IConvert(INode *node)
|
||||
{
|
||||
Mtl *mtl = node->GetMtl();
|
||||
if (!mtl)
|
||||
return;
|
||||
|
||||
if (mtl->ClassID() == hsMaxMtlClassID)
|
||||
{
|
||||
plPassMtl *pass = IConvertMtl(mtl);
|
||||
node->SetMtl(pass);
|
||||
}
|
||||
else if (mtl->ClassID() == Class_ID(MULTI_CLASS_ID,0))
|
||||
{
|
||||
for (int i = 0; i < mtl->NumSubMtls(); i++)
|
||||
{
|
||||
Mtl *subMtl = mtl->GetSubMtl(i);
|
||||
if (subMtl->ClassID() == hsMaxMtlClassID)
|
||||
{
|
||||
plPassMtl *pass = IConvertMtl(subMtl, mtl, i);
|
||||
mtl->SetSubMtl(i, pass);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void plMaterialUpdate::IRenameMtls(MtlBase *oldMtl, MtlBase *newMtl)
|
||||
{
|
||||
char buf[256];
|
||||
const char *name = oldMtl->GetName();
|
||||
newMtl->SetName(name);
|
||||
strcpy(buf, name);
|
||||
strcat(buf, " old");
|
||||
oldMtl->SetName(buf);
|
||||
}
|
||||
|
||||
plPassMtl *plMaterialUpdate::IConvertMtl(Mtl *mtl, Mtl *multi, int subNum)
|
||||
{
|
||||
// We've already converted this material, use the new one we already made
|
||||
if (fDoneMaterials.find(mtl) != fDoneMaterials.end())
|
||||
return (plPassMtl*)fDoneMaterials[mtl];
|
||||
|
||||
plPassMtl *newMtl = (plPassMtl*)CreateInstance(MATERIAL_CLASS_ID, PASS_MTL_CLASS_ID);
|
||||
IParamBlock2 *layersPB = newMtl->GetParamBlockByID(plPassMtl::kBlkLayers);
|
||||
|
||||
IRenameMtls(mtl, newMtl);
|
||||
|
||||
if (mtl->NumSubTexmaps() > 0)
|
||||
{
|
||||
Texmap *map = mtl->GetSubTexmap(0);
|
||||
if (map->ClassID() == hsMaxLayerClassID)
|
||||
{
|
||||
plLayerTex *layer = IConvertLayer((hsMaxLayer*)map);
|
||||
|
||||
// layer->SetMtlFlag(MTL_TEX_DISPLAY_ENABLED, TRUE);
|
||||
// layer->ActivateTexDisplay(TRUE);
|
||||
|
||||
newMtl->SetSubTexmap(0, layer);
|
||||
/* newMtl->SetActiveTexmap(layer);
|
||||
newMtl->SetMtlFlag(MTL_TEX_DISPLAY_ENABLED, TRUE);
|
||||
|
||||
if (multi)
|
||||
GetCOREInterface()->ActivateTexture(layer, multi, subNum);
|
||||
else
|
||||
GetCOREInterface()->ActivateTexture(layer, newMtl);
|
||||
*/
|
||||
ICopyMtlParams(newMtl, (hsMaxLayer*)map);
|
||||
}
|
||||
}
|
||||
|
||||
if (mtl->NumSubTexmaps() > 1 && fConvertSecondLayer && mtl->SubTexmapOn(1))
|
||||
{
|
||||
Texmap *map = mtl->GetSubTexmap(1);
|
||||
if (map->ClassID() == hsMaxLayerClassID)
|
||||
{
|
||||
hsMaxLayer *oldLayer = (hsMaxLayer*)map;
|
||||
plLayerTex *layer = IConvertLayer(oldLayer);
|
||||
newMtl->SetSubTexmap(1, layer);
|
||||
|
||||
IParamBlock2 *layersPB = newMtl->GetParamBlockByID(plPassMtl::kBlkLayers);
|
||||
layersPB->SetValue(kPassLayTopOn, 0, TRUE);
|
||||
|
||||
if (oldLayer->GetBlendFlags() & hsMaxLayerBase::kBlendAlpha)
|
||||
layersPB->SetValue(kPassLayBlend, 0, plPassMtlBase::kBlendAlpha);
|
||||
else if (oldLayer->GetBlendFlags() & hsMaxLayerBase::kBlendAdd)
|
||||
layersPB->SetValue(kPassLayBlend, 0, plPassMtlBase::kBlendAdd);
|
||||
}
|
||||
}
|
||||
|
||||
//MtlBaseLib& Interface::GetMaterialLibrary()
|
||||
|
||||
// Add this to our converted materials
|
||||
fDoneMaterials[mtl] = newMtl;
|
||||
|
||||
return newMtl;
|
||||
}
|
||||
|
||||
plLayerTex *plMaterialUpdate::IConvertLayer(hsMaxLayer *layer)
|
||||
{
|
||||
plLayerTex *newLayer = (plLayerTex*)CreateInstance(TEXMAP_CLASS_ID, LAYER_TEX_CLASS_ID);
|
||||
IParamBlock2 *bitmapPB = newLayer->GetParamBlockByID(plLayerTex::kBlkBitmap);
|
||||
|
||||
IRenameMtls(layer, newLayer);
|
||||
|
||||
// Copy the bitmap
|
||||
if (layer->GetMiscFlags() & hsMaxLayerBase::kMiscUseBitmap)
|
||||
{
|
||||
bitmapPB->SetValue(kBmpUseBitmap, 0, 1);
|
||||
|
||||
const char *name = layer->GetMapName();
|
||||
PBBitmap pbb;
|
||||
pbb.bi.SetName(name);
|
||||
|
||||
// Disable annoying missing texture warning
|
||||
BOOL bmmSilentMode = TheManager->SilentMode();
|
||||
TheManager->SetSilentMode(TRUE);
|
||||
|
||||
bitmapPB->SetValue(kBmpBitmap, 0, &pbb);
|
||||
|
||||
TheManager->SetSilentMode(bmmSilentMode);
|
||||
}
|
||||
|
||||
// Copy the UVGen
|
||||
newLayer->ReplaceReference(plLayerTex::kRefUVGen, layer->GetUVGen());
|
||||
|
||||
// Copy the cropping
|
||||
if (layer->GetApplyCrop())
|
||||
{
|
||||
bitmapPB->SetValue(kBmpApply, 0, TRUE);
|
||||
bitmapPB->SetValue(kBmpCropPlace, 0, layer->GetPlaceImage());
|
||||
|
||||
bitmapPB->SetValue(kBmpClipU, 0, layer->GetClipU(0));
|
||||
bitmapPB->SetValue(kBmpClipV, 0, layer->GetClipV(0));
|
||||
bitmapPB->SetValue(kBmpClipW, 0, layer->GetClipW(0));
|
||||
bitmapPB->SetValue(kBmpClipH, 0, layer->GetClipH(0));
|
||||
}
|
||||
|
||||
// Misc
|
||||
if (layer->GetBlendFlags() & hsMaxLayerBase::kBlendNoColor)
|
||||
bitmapPB->SetValue(kBmpDiscardColor, 0, TRUE);
|
||||
if (layer->GetBlendFlags() & hsMaxLayerBase::kBlendInvertColor)
|
||||
bitmapPB->SetValue(kBmpInvertColor, 0, TRUE);
|
||||
if (layer->GetAlphaSource() == 2)
|
||||
bitmapPB->SetValue(kBmpDiscardAlpha, 0, TRUE);
|
||||
if (layer->GetBlendFlags() & hsMaxLayerBase::kBlendInvertAlpha)
|
||||
bitmapPB->SetValue(kBmpInvertAlpha, 0, TRUE);
|
||||
|
||||
/*
|
||||
// Texture quality
|
||||
kBmpNonCompressed,
|
||||
kBmpScaling,
|
||||
*/
|
||||
|
||||
// Mipmap
|
||||
if (layer->GetFilterType() == 2)
|
||||
bitmapPB->SetValue(kBmpNoFilter, 0, TRUE);
|
||||
|
||||
float blur = layer->GetMipMapBlur(TimeValue(0));
|
||||
bitmapPB->SetValue(kBmpMipBlur, 0, blur);
|
||||
|
||||
if (layer->GetZFlags() & hsMaxLayerBase::kZLODBias)
|
||||
{
|
||||
bitmapPB->SetValue(kBmpMipBias, 0, TRUE);
|
||||
bitmapPB->SetValue(kBmpMipBiasAmt, 0, layer->GetLODBias(TimeValue(0)));
|
||||
}
|
||||
|
||||
// Detail
|
||||
if (layer->GetBlendFlags() & hsMaxLayerBase::kBlendDetail ||
|
||||
layer->GetBlendFlags() & hsMaxLayerBase::kBlendDetailAdd)
|
||||
{
|
||||
bitmapPB->SetValue(kBmpUseDetail, 0, TRUE);
|
||||
|
||||
bitmapPB->SetValue(kBmpDetailStartSize, 0, layer->GetDetailDropoffStart(0));
|
||||
bitmapPB->SetValue(kBmpDetailStopSize, 0, layer->GetDetailDropoffStop(0));
|
||||
bitmapPB->SetValue(kBmpDetailStartOpac, 0, layer->GetDetailMax(0));
|
||||
bitmapPB->SetValue(kBmpDetailStopOpac, 0, layer->GetDetailMin(0));
|
||||
}
|
||||
|
||||
return newLayer;
|
||||
}
|
||||
|
||||
void plMaterialUpdate::ICopyMtlParams(plPassMtl *mtl, hsMaxLayer *layer)
|
||||
{
|
||||
IParamBlock2 *basicPB = mtl->GetParamBlockByID(plPassMtl::kBlkBasic);
|
||||
IParamBlock2 *layersPB = mtl->GetParamBlockByID(plPassMtl::kBlkLayers);
|
||||
|
||||
basicPB->SetValue(kPassBasColorAmb, 0, layer->GetAmbient());
|
||||
basicPB->SetValue(kPassBasColor, 0, layer->GetColor());
|
||||
|
||||
basicPB->SetValue(kPassBasOpacity, 0, int(layer->GetOpacity(0)*100.f));
|
||||
|
||||
if (layer->GetBlendFlags() & hsMaxLayerBase::kBlendAlpha)
|
||||
layersPB->SetValue(kPassLayOutputBlend, 0, plPassMtlBase::kBlendAlpha);
|
||||
else if (layer->GetBlendFlags() & hsMaxLayerBase::kBlendAdd)
|
||||
layersPB->SetValue(kPassLayOutputBlend, 0, plPassMtlBase::kBlendAdd);
|
||||
|
||||
/*
|
||||
kPassAdvUseSpec,
|
||||
kPassAdvSpecType,
|
||||
kPassAdvShine,
|
||||
kPassAdvShineStr,
|
||||
|
||||
// Misc
|
||||
kPassAdvWire,
|
||||
kPassAdvMeshOutlines,
|
||||
kPassAdvTwoSided,
|
||||
|
||||
// Shading
|
||||
kPassAdvSoftShadow,
|
||||
kPassAdvNoProj,
|
||||
kPassAdvVertexShade,
|
||||
kPassAdvNoShade,
|
||||
kPassAdvNoFog,
|
||||
kPassAdvWhite,
|
||||
|
||||
// Z
|
||||
kPassAdvZOnly,
|
||||
kPassAdvZClear,
|
||||
kPassAdvZNoRead,
|
||||
kPassAdvZNoWrite,
|
||||
kPassAdvZInc,
|
||||
*/
|
||||
}
|
8
Sources/Tools/MaxMtlUpdate/plMaterialUpdate.def
Normal file
8
Sources/Tools/MaxMtlUpdate/plMaterialUpdate.def
Normal file
@ -0,0 +1,8 @@
|
||||
LIBRARY
|
||||
EXPORTS
|
||||
LibDescription @1
|
||||
LibNumberClasses @2
|
||||
LibClassDesc @3
|
||||
LibVersion @4
|
||||
SECTIONS
|
||||
.data READ WRITE
|
71
Sources/Tools/MaxMtlUpdate/plMaterialUpdate.h
Normal file
71
Sources/Tools/MaxMtlUpdate/plMaterialUpdate.h
Normal file
@ -0,0 +1,71 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Additional permissions under GNU GPL version 3 section 7
|
||||
|
||||
If you modify this Program, or any covered work, by linking or
|
||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
|
||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
|
||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
|
||||
(or a modified version of those libraries),
|
||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
|
||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
|
||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
|
||||
licensors of this Program grant you additional
|
||||
permission to convey the resulting work. Corresponding Source for a
|
||||
non-source form of such a combination shall include the source code for
|
||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
|
||||
work.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
/**********************************************************************
|
||||
*<
|
||||
FILE: plMaterialUpdate.h
|
||||
|
||||
DESCRIPTION: Includes for Plugins
|
||||
|
||||
CREATED BY:
|
||||
|
||||
HISTORY:
|
||||
|
||||
*> Copyright (c) 2000, All Rights Reserved.
|
||||
**********************************************************************/
|
||||
|
||||
#ifndef __PLMATERIALUPDATE__H
|
||||
#define __PLMATERIALUPDATE__H
|
||||
|
||||
#include "Max.h"
|
||||
#include "resource.h"
|
||||
#include "istdplug.h"
|
||||
#include "iparamb2.h"
|
||||
#include "iparamm2.h"
|
||||
|
||||
#include "utilapi.h"
|
||||
|
||||
|
||||
extern TCHAR *GetString(int id);
|
||||
|
||||
extern HINSTANCE hInstance;
|
||||
|
||||
#endif // __PLMATERIALUPDATE__H
|
110
Sources/Tools/MaxMtlUpdate/plMaterialUpdate.rc
Normal file
110
Sources/Tools/MaxMtlUpdate/plMaterialUpdate.rc
Normal file
@ -0,0 +1,110 @@
|
||||
//Microsoft Developer Studio generated resource script.
|
||||
//
|
||||
#include "resource.h"
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
#include "afxres.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// English (U.S.) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Dialog
|
||||
//
|
||||
|
||||
IDD_PANEL DIALOG DISCARDABLE 0, 0, 108, 45
|
||||
STYLE WS_CHILD | WS_VISIBLE
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
PUSHBUTTON "Convert All",IDC_BUTTON1,29,9,48,15
|
||||
CONTROL "Convert 2nd layer",IDC_CHECK1,"Button",BS_AUTOCHECKBOX |
|
||||
WS_TABSTOP,18,29,71,10
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// DESIGNINFO
|
||||
//
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
GUIDELINES DESIGNINFO DISCARDABLE
|
||||
BEGIN
|
||||
IDD_PANEL, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 101
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 38
|
||||
END
|
||||
END
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
1 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"resource.h\0"
|
||||
END
|
||||
|
||||
2 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"#include ""afxres.h""\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
3 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// String Table
|
||||
//
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
IDS_CLASS_NAME "plMaterialUpdate"
|
||||
IDS_PARAMS "Parameters"
|
||||
IDS_SPIN "Spin"
|
||||
END
|
||||
|
||||
#endif // English (U.S.) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
|
28
Sources/Tools/MaxMtlUpdate/resource.h
Normal file
28
Sources/Tools/MaxMtlUpdate/resource.h
Normal file
@ -0,0 +1,28 @@
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Developer Studio generated include file.
|
||||
// Used by plMaterialUpdate.rc
|
||||
//
|
||||
#define IDS_LIBDESCRIPTION 1
|
||||
#define IDS_CATEGORY 2
|
||||
#define IDS_CLASS_NAME 3
|
||||
#define IDS_PARAMS 4
|
||||
#define IDS_SPIN 5
|
||||
#define IDD_PANEL 101
|
||||
#define IDC_CLOSEBUTTON 1000
|
||||
#define IDC_DOSTUFF 1000
|
||||
#define IDC_BUTTON1 1001
|
||||
#define IDC_CHECK1 1002
|
||||
#define IDC_COLOR 1456
|
||||
#define IDC_EDIT 1490
|
||||
#define IDC_SPIN 1496
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 101
|
||||
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||
#define _APS_NEXT_CONTROL_VALUE 1003
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
Reference in New Issue
Block a user