1
0
mirror of https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git synced 2025-07-17 10:52:46 +00:00

Fix line endings and tabs

This commit is contained in:
Branan Purvine-Riley
2011-04-11 16:27:55 -07:00
parent d4250e19b5
commit 908aaeb6f6
2738 changed files with 702562 additions and 702562 deletions

View File

@ -1,266 +1,266 @@
/*==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/>.
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==*/
//////////////////////////////////////////////////////////////////////////////
// //
// Export/convert-specific functionality of plAnimStealthNode //
// //
//////////////////////////////////////////////////////////////////////////////
#include "hsTypes.h"
#include "plAnimStealthNode.h"
#include "plPassMtlBase.h"
#include "resource.h"
#include "../MaxMain/plMaxNode.h"
#include "../MaxComponent/plMaxAnimUtils.h"
#include "../MaxConvert/plConvert.h"
#include "../MaxConvert/hsMaterialConverter.h"
#include "../plSurface/hsGMaterial.h"
#include "../plSurface/plLayerAnimation.h"
#include "iparamm2.h"
//// Helpers /////////////////////////////////////////////////////////////////
static void ISearchLayerRecur( plLayerInterface *layer, const char *segName, hsTArray<plKey>& keys )
{
if( !layer )
return;
plLayerAnimation *animLayer = plLayerAnimation::ConvertNoRef(layer);
if (animLayer)
{
char *ID = animLayer->GetSegmentID();
if (ID == nil)
ID = "";
if (!strcmp(ID, segName))
{
if( keys.kMissingIndex == keys.Find(animLayer->GetKey()) )
keys.Append(animLayer->GetKey());
}
}
ISearchLayerRecur(layer->GetAttached(), segName, keys);
}
static int ISearchLayerRecur(hsGMaterial* mat, const char *segName, hsTArray<plKey>& keys)
{
if (segName == nil || strcmp( segName, ENTIRE_ANIMATION_NAME ) == 0 )
segName = "";
int i;
for( i = 0; i < mat->GetNumLayers(); i++ )
ISearchLayerRecur(mat->GetLayer(i), segName, keys);
return keys.GetCount();
}
static int GetMatAnimModKey(Mtl* mtl, plMaxNodeBase* node, const char* segName, hsTArray<plKey>& keys)
{
int retVal = 0;
int i;
//if( begin < 0 )
// begin = 0;
if( mtl->ClassID() == Class_ID(MULTI_CLASS_ID,0) )
{
for( i = 0; i < mtl->NumSubMtls(); i++ )
retVal += GetMatAnimModKey(mtl->GetSubMtl(i), node, segName, keys);
}
else
{
hsTArray<hsGMaterial*> matList;
if (node)
hsMaterialConverter::Instance().GetMaterialArray(mtl, (plMaxNode*)node, matList);
else
hsMaterialConverter::Instance().CollectConvertedMaterials(mtl, matList);
for( i = 0; i < matList.GetCount(); i++ )
{
retVal += ISearchLayerRecur(matList[i], segName, keys);
}
}
return retVal;
}
SegmentSpec *plAnimStealthNode::IGetSegmentSpec( void ) const
{
if( fCachedSegMap != nil )
{
const char *name = GetSegmentName();
if( name != nil )
{
SegmentMap::iterator i = fCachedSegMap->find( name );
if( i != fCachedSegMap->end() )
{
SegmentSpec *spec = i->second;
return spec;
}
}
}
return nil;
}
hsScalar plAnimStealthNode::GetSegStart( void ) const
{
SegmentSpec *spec = IGetSegmentSpec();
if( spec != nil )
return spec->fStart;
return 0.f;
}
hsScalar plAnimStealthNode::GetSegEnd( void ) const
{
SegmentSpec *spec = IGetSegmentSpec();
if( spec != nil )
return spec->fEnd;
return 0.f;
}
void plAnimStealthNode::GetLoopPoints( hsScalar &start, hsScalar &end ) const
{
start = GetSegStart();
end = GetSegEnd();
const char *loopName = GetLoopName();
if( loopName != nil && loopName[ 0 ] != 0 && fCachedSegMap != nil )
GetSegMapAnimTime( loopName, fCachedSegMap, SegmentSpec::kLoop, start, end );
}
void plAnimStealthNode::GetAllStopPoints( hsTArray<hsScalar> &out )
{
if( fCachedSegMap == nil )
return;
for (SegmentMap::iterator it = fCachedSegMap->begin(); it != fCachedSegMap->end(); it++)
{
SegmentSpec *spec = it->second;
if( spec->fType == SegmentSpec::kStopPoint )
{
out.Append( spec->fStart );
}
}
}
//// StuffToTimeConvert //////////////////////////////////////////////////////
// Handles converting all the settings we have that are applicable for an
// animTimeConvert and stuffing it into said ATC.
void plAnimStealthNode::StuffToTimeConvert( plAnimTimeConvert &convert, hsScalar maxLength )
{
const char *segName = GetSegmentName();
bool isEntire = ( segName == nil || strcmp( segName, ENTIRE_ANIMATION_NAME ) == 0 ) ? true : false;
if( isEntire )
{
convert.SetBegin( 0 );
convert.SetEnd( maxLength );
}
else
{
SegmentSpec *spec = IGetSegmentSpec();
convert.SetBegin( ( spec != nil ) ? spec->fStart : 0.f );
convert.SetEnd( ( spec != nil ) ? spec->fEnd : 0.f );
}
// Even if we're not looping, set the loop points. (A responder
// could tell us later to start looping.)
if( isEntire )
convert.SetLoopPoints( 0, maxLength );
else
{
hsScalar loopStart, loopEnd;
GetLoopPoints( loopStart, loopEnd );
convert.SetLoopPoints( loopStart, loopEnd );
}
convert.Loop( GetLoop() );
// Auto-start
if( GetAutoStart() )
convert.Start( 0 );
else
convert.Stop( true );
// Stuff stop points
GetAllStopPoints( convert.GetStopPoints() );
// Ease curve stuff
if( GetEaseInType() != plAnimEaseTypes::kNoEase )
{
convert.SetEase( true, GetEaseInType(), GetEaseInMin(), GetEaseInMax(), GetEaseInLength() );
}
if( GetEaseOutType() != plAnimEaseTypes::kNoEase )
{
convert.SetEase( false, GetEaseOutType(), GetEaseOutMin(), GetEaseOutMax(), GetEaseOutLength() );
}
}
//// plAnimObjInterface Functions ////////////////////////////////////////////
hsBool plAnimStealthNode::GetKeyList( INode *restrictedNode, hsTArray<plKey> &outKeys )
{
if( !fPreppedForConvert )
{
hsMessageBox( "This messages is to warn you that mcn screwed up in his attempt to create "
"a SetupProperties() pass for materials in this scene. You should probably let him know as soon as "
"possible, and also make a copy of this exact scene so that he can test with it and figure out what "
"is going wrong. Thank you.", "Mathew is Stupid Error", hsMessageBoxNormal );
}
GetMatAnimModKey( GetParentMtl(), (plMaxNode *)restrictedNode, GetSegmentName(), outKeys );
return true;
}
//// SetupProperties /////////////////////////////////////////////////////////
hsBool plAnimStealthNode::SetupProperties( plMaxNode *node, plErrorMsg *pErrMsg )
{
fPreppedForConvert = true;
plPassMtlBase *parent = GetParentMtl();
if( parent != nil && fCachedSegMap == nil )
{
fCachedSegMap = GetAnimSegmentMap( parent, nil );
}
return true;
}
//// ConvertDeInit ///////////////////////////////////////////////////////////
hsBool plAnimStealthNode::ConvertDeInit( plMaxNode *node, plErrorMsg *pErrMsg )
{
fPreppedForConvert = false;
if( fCachedSegMap != nil )
DeleteSegmentMap( fCachedSegMap );
fCachedSegMap = nil;
return true;
}
/*==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/>.
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==*/
//////////////////////////////////////////////////////////////////////////////
// //
// Export/convert-specific functionality of plAnimStealthNode //
// //
//////////////////////////////////////////////////////////////////////////////
#include "hsTypes.h"
#include "plAnimStealthNode.h"
#include "plPassMtlBase.h"
#include "resource.h"
#include "../MaxMain/plMaxNode.h"
#include "../MaxComponent/plMaxAnimUtils.h"
#include "../MaxConvert/plConvert.h"
#include "../MaxConvert/hsMaterialConverter.h"
#include "../plSurface/hsGMaterial.h"
#include "../plSurface/plLayerAnimation.h"
#include "iparamm2.h"
//// Helpers /////////////////////////////////////////////////////////////////
static void ISearchLayerRecur( plLayerInterface *layer, const char *segName, hsTArray<plKey>& keys )
{
if( !layer )
return;
plLayerAnimation *animLayer = plLayerAnimation::ConvertNoRef(layer);
if (animLayer)
{
char *ID = animLayer->GetSegmentID();
if (ID == nil)
ID = "";
if (!strcmp(ID, segName))
{
if( keys.kMissingIndex == keys.Find(animLayer->GetKey()) )
keys.Append(animLayer->GetKey());
}
}
ISearchLayerRecur(layer->GetAttached(), segName, keys);
}
static int ISearchLayerRecur(hsGMaterial* mat, const char *segName, hsTArray<plKey>& keys)
{
if (segName == nil || strcmp( segName, ENTIRE_ANIMATION_NAME ) == 0 )
segName = "";
int i;
for( i = 0; i < mat->GetNumLayers(); i++ )
ISearchLayerRecur(mat->GetLayer(i), segName, keys);
return keys.GetCount();
}
static int GetMatAnimModKey(Mtl* mtl, plMaxNodeBase* node, const char* segName, hsTArray<plKey>& keys)
{
int retVal = 0;
int i;
//if( begin < 0 )
// begin = 0;
if( mtl->ClassID() == Class_ID(MULTI_CLASS_ID,0) )
{
for( i = 0; i < mtl->NumSubMtls(); i++ )
retVal += GetMatAnimModKey(mtl->GetSubMtl(i), node, segName, keys);
}
else
{
hsTArray<hsGMaterial*> matList;
if (node)
hsMaterialConverter::Instance().GetMaterialArray(mtl, (plMaxNode*)node, matList);
else
hsMaterialConverter::Instance().CollectConvertedMaterials(mtl, matList);
for( i = 0; i < matList.GetCount(); i++ )
{
retVal += ISearchLayerRecur(matList[i], segName, keys);
}
}
return retVal;
}
SegmentSpec *plAnimStealthNode::IGetSegmentSpec( void ) const
{
if( fCachedSegMap != nil )
{
const char *name = GetSegmentName();
if( name != nil )
{
SegmentMap::iterator i = fCachedSegMap->find( name );
if( i != fCachedSegMap->end() )
{
SegmentSpec *spec = i->second;
return spec;
}
}
}
return nil;
}
hsScalar plAnimStealthNode::GetSegStart( void ) const
{
SegmentSpec *spec = IGetSegmentSpec();
if( spec != nil )
return spec->fStart;
return 0.f;
}
hsScalar plAnimStealthNode::GetSegEnd( void ) const
{
SegmentSpec *spec = IGetSegmentSpec();
if( spec != nil )
return spec->fEnd;
return 0.f;
}
void plAnimStealthNode::GetLoopPoints( hsScalar &start, hsScalar &end ) const
{
start = GetSegStart();
end = GetSegEnd();
const char *loopName = GetLoopName();
if( loopName != nil && loopName[ 0 ] != 0 && fCachedSegMap != nil )
GetSegMapAnimTime( loopName, fCachedSegMap, SegmentSpec::kLoop, start, end );
}
void plAnimStealthNode::GetAllStopPoints( hsTArray<hsScalar> &out )
{
if( fCachedSegMap == nil )
return;
for (SegmentMap::iterator it = fCachedSegMap->begin(); it != fCachedSegMap->end(); it++)
{
SegmentSpec *spec = it->second;
if( spec->fType == SegmentSpec::kStopPoint )
{
out.Append( spec->fStart );
}
}
}
//// StuffToTimeConvert //////////////////////////////////////////////////////
// Handles converting all the settings we have that are applicable for an
// animTimeConvert and stuffing it into said ATC.
void plAnimStealthNode::StuffToTimeConvert( plAnimTimeConvert &convert, hsScalar maxLength )
{
const char *segName = GetSegmentName();
bool isEntire = ( segName == nil || strcmp( segName, ENTIRE_ANIMATION_NAME ) == 0 ) ? true : false;
if( isEntire )
{
convert.SetBegin( 0 );
convert.SetEnd( maxLength );
}
else
{
SegmentSpec *spec = IGetSegmentSpec();
convert.SetBegin( ( spec != nil ) ? spec->fStart : 0.f );
convert.SetEnd( ( spec != nil ) ? spec->fEnd : 0.f );
}
// Even if we're not looping, set the loop points. (A responder
// could tell us later to start looping.)
if( isEntire )
convert.SetLoopPoints( 0, maxLength );
else
{
hsScalar loopStart, loopEnd;
GetLoopPoints( loopStart, loopEnd );
convert.SetLoopPoints( loopStart, loopEnd );
}
convert.Loop( GetLoop() );
// Auto-start
if( GetAutoStart() )
convert.Start( 0 );
else
convert.Stop( true );
// Stuff stop points
GetAllStopPoints( convert.GetStopPoints() );
// Ease curve stuff
if( GetEaseInType() != plAnimEaseTypes::kNoEase )
{
convert.SetEase( true, GetEaseInType(), GetEaseInMin(), GetEaseInMax(), GetEaseInLength() );
}
if( GetEaseOutType() != plAnimEaseTypes::kNoEase )
{
convert.SetEase( false, GetEaseOutType(), GetEaseOutMin(), GetEaseOutMax(), GetEaseOutLength() );
}
}
//// plAnimObjInterface Functions ////////////////////////////////////////////
hsBool plAnimStealthNode::GetKeyList( INode *restrictedNode, hsTArray<plKey> &outKeys )
{
if( !fPreppedForConvert )
{
hsMessageBox( "This messages is to warn you that mcn screwed up in his attempt to create "
"a SetupProperties() pass for materials in this scene. You should probably let him know as soon as "
"possible, and also make a copy of this exact scene so that he can test with it and figure out what "
"is going wrong. Thank you.", "Mathew is Stupid Error", hsMessageBoxNormal );
}
GetMatAnimModKey( GetParentMtl(), (plMaxNode *)restrictedNode, GetSegmentName(), outKeys );
return true;
}
//// SetupProperties /////////////////////////////////////////////////////////
hsBool plAnimStealthNode::SetupProperties( plMaxNode *node, plErrorMsg *pErrMsg )
{
fPreppedForConvert = true;
plPassMtlBase *parent = GetParentMtl();
if( parent != nil && fCachedSegMap == nil )
{
fCachedSegMap = GetAnimSegmentMap( parent, nil );
}
return true;
}
//// ConvertDeInit ///////////////////////////////////////////////////////////
hsBool plAnimStealthNode::ConvertDeInit( plMaxNode *node, plErrorMsg *pErrMsg )
{
fPreppedForConvert = false;
if( fCachedSegMap != nil )
DeleteSegmentMap( fCachedSegMap );
fCachedSegMap = nil;
return true;
}

File diff suppressed because it is too large Load Diff

View File

@ -1,247 +1,247 @@
/*==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/>.
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==*/
//////////////////////////////////////////////////////////////////////////////
// //
// plAnimStealthNode - Stealthy hidden INode that represents a single //
// segment's worth of animation info for a material. //
// Stored as an INode so they can be "selected" //
// by components as targets of animation messages. //
// //
//////////////////////////////////////////////////////////////////////////////
#ifndef _plAnimStealthNode_h
#define _plAnimStealthNode_h
#include "Max.h"
#include "iparamb2.h"
#include "iparamm2.h"
#include "hsTypes.h"
#include "../pnKeyedObject/plKey.h"
#include "../MaxComponent/plAnimObjInterface.h"
#include "../MaxComponent/plMaxAnimUtils.h"
extern TCHAR *GetString(int id);
extern HINSTANCE hInstance;
#define ANIMSTEALTH_CLASSID Class_ID(0xd0272f8, 0x750349c9)
#define REFMSG_NOTETRACK_ADDED REFMSG_USER + 1
class plPassMtlBase;
class NoteTrack;
class plMaxNode;
class plErrorMsg;
class plAnimTimeConvert;
//// Class Def ///////////////////////////////////////////////////////////////
class plAnimStealthNode : public HelperObject, public plAnimObjInterface
{
protected:
ClassDesc2 *fClassDesc;
IParamBlock2 *fParamBlock;
plPassMtlBase *fParentMtl;
static ParamBlockDesc2 sAnimStealthPB;
hsBool fPreppedForConvert;
SegmentMap *fCachedSegMap;
SegmentSpec *IGetSegmentSpec( void ) const;
public:
// Some IDs
enum
{
kBlockPB = 0
};
enum Refs
{
kRefParamBlock,
kRefParentMtl
};
// ParamBlock IDs
enum ParamBlockIDs
{
kPBAutoStart, // Start the Animation on load (V2)
kPBLoop, // Start Looping at Begin Location
kPBName, // Name of the notetrack animation to play
kPBLoopName, // Name of the notetrack specified loop
kPBEaseInType,
kPBEaseOutType,
kPBEaseInLength,
kPBEaseOutLength,
kPBEaseInMin,
kPBEaseInMax,
kPBEaseOutMin,
kPBEaseOutMax
};
plAnimStealthNode( BOOL loading );
virtual ~plAnimStealthNode();
void DeleteThis() { delete this; }
INode *GetINode( void );
plPassMtlBase *GetParentMtl( void );
void SetParentMtl( plPassMtlBase *parent );
void SetNodeName( const char *parentName );
// Create the dialog for this object and place it inside the given dialog, centering it in the given control if any
bool CreateAndEmbedDlg( IParamMap2 *parentMap, IMtlParams *parentParams, HWND frameCtrl = nil );
// Release said dialog
void ReleaseDlg( void );
// Switch underlying objects in the dialog (to avoid unnecessary deletion/recreations)
void SwitchDlg( plAnimStealthNode *toSwitchTo );
// Get the actual window handle of the currently active dialog displaying us
HWND GetWinDlg( void ) const;
// Interesting functions
const char *GetSegmentName( void ) const;
void SetSegment( const char *name ); // nil for "entire animation"
// Conversion from stealth's INode to the actual object
static bool CanConvertToStealth( INode *objNode );
static plAnimStealthNode *ConvertToStealth( INode *objNode );
///////////////////////////////////////////////////////////////////////////////////////
// Required Max functions
//
TCHAR* GetObjectName() { return (TCHAR*)fClassDesc->ClassName(); }
void InitNodeName(TSTR& s) { s = fClassDesc->InternalName(); }
void GetClassName(TSTR& s) { s = fClassDesc->ClassName(); }
Class_ID ClassID() { return ANIMSTEALTH_CLASSID; }
RefTargetHandle Clone(RemapDir &remap);
int NumRefs();
RefTargetHandle GetReference(int i);
void SetReference(int i, RefTargetHandle rtarg);
RefResult NotifyRefChanged(Interval changeInt,RefTargetHandle hTarget, PartID& partID, RefMessage message);
// allow retreival of our paramblock from other plug-ins
// and the max core
int NumParamBlocks();
IParamBlock2* GetParamBlock(int i);
IParamBlock2* GetParamBlockByID(BlockID id);
// We override because we don't want to be able to animate this sucker
int NumSubs() { return 0; }
Animatable *SubAnim( int i ) { return nil; }
TSTR SubAnimName( int i ) { return fClassDesc->ClassName(); }
// plug-in mouse creation callback
CreateMouseCallBack* GetCreateMouseCallBack();
void BeginEditParams(IObjParam *ip, ULONG flags, Animatable *prev);
void EndEditParams(IObjParam *ip, ULONG flags, Animatable *next);
// void SelectionSetChanged(Interface *ip, IUtil *iu);
void BuildMesh(TimeValue t);
void FreeCaches();
void GetLocalBoundBox(TimeValue t, INode *node, ViewExp *vpt, Box3 &box);
void GetWorldBoundBox(TimeValue t, INode *node, ViewExp *vpt, Box3 &box);
int Display(TimeValue t, INode *node, ViewExp *vpt, int flags);
int HitTest(TimeValue t, INode *node, int type, int crossing, int flags, IPoint2 *p, ViewExp *vpt);
ObjectState Eval(TimeValue t) { return ObjectState(this); }
IOResult Save(ISave* isave);
IOResult Load(ILoad* iload);
int CanConvertToType( Class_ID obtype ) { return ( obtype == ANIMSTEALTH_CLASSID ) ? 1 : 0; }
const char *GetCategory() { return fClassDesc->Category(); }
/// Parameter access
bool GetAutoStart( void ) const;
void SetAutoStart( bool b );
bool GetLoop( void ) const;
const char *GetLoopName( void ) const;
void SetLoop( bool b, const char *name );
UInt8 GetEaseInType( void ) const;
hsScalar GetEaseInLength( void ) const;
hsScalar GetEaseInMin( void ) const;
hsScalar GetEaseInMax( void ) const;
void SetEaseIn( UInt8 type, hsScalar length, hsScalar min, hsScalar max );
UInt8 GetEaseOutType( void ) const;
hsScalar GetEaseOutLength( void ) const;
hsScalar GetEaseOutMin( void ) const;
hsScalar GetEaseOutMax( void ) const;
void SetEaseOut( UInt8 type, hsScalar length, hsScalar min, hsScalar max );
// Conversion stuff
void GetAllStopPoints( hsTArray<hsScalar> &out );
hsScalar GetSegStart( void ) const;
hsScalar GetSegEnd( void ) const;
void GetLoopPoints( hsScalar &start, hsScalar &end ) const;
void StuffToTimeConvert( plAnimTimeConvert &convert, hsScalar maxLength );
// plAnimObjInterface functions
virtual void PickTargetNode( IParamBlock2 *destPB, ParamID destParamID, ParamID typeID );
virtual hsBool IsNodeRestricted( void ) { return true; }
virtual const char *GetIfaceSegmentName( hsBool allowNil );
virtual hsBool GetKeyList( INode *restrictedNode, hsTArray<plKey> &outKeys );
virtual hsBool MightRequireSeparateMaterial( void ) { return true; }
// Convert time, called on the setupProps pass for each material applied to a node in the scene
virtual hsBool SetupProperties( plMaxNode *node, plErrorMsg *pErrMsg );
virtual hsBool ConvertDeInit( plMaxNode *node, plErrorMsg *pErrMsg );
// Returns true if the parent material is applied to any node in the scene, false otherwise
hsBool IsParentUsedInScene( void );
};
//// Accessor for Parent's ParamBlock ////////////////////////////////////////
class plStealthNodeAccessor : public PBAccessor
{
protected:
void ISetParent( ReferenceTarget *target, plPassMtlBase *parent );
void IHandleSet( PB2Value &v, ReferenceMaker *owner, ParamID id, int tabIndex, TimeValue t );
public:
plStealthNodeAccessor() { }
static plStealthNodeAccessor &GetInstance( void );
virtual void Set( PB2Value &v, ReferenceMaker *owner, ParamID id, int tabIndex, TimeValue t );
virtual void TabChanged( tab_changes changeCode, Tab<PB2Value> *tab, ReferenceMaker *owner,
ParamID id, int tabIndex, int count );
};
/*==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/>.
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==*/
//////////////////////////////////////////////////////////////////////////////
// //
// plAnimStealthNode - Stealthy hidden INode that represents a single //
// segment's worth of animation info for a material. //
// Stored as an INode so they can be "selected" //
// by components as targets of animation messages. //
// //
//////////////////////////////////////////////////////////////////////////////
#ifndef _plAnimStealthNode_h
#define _plAnimStealthNode_h
#include "Max.h"
#include "iparamb2.h"
#include "iparamm2.h"
#include "hsTypes.h"
#include "../pnKeyedObject/plKey.h"
#include "../MaxComponent/plAnimObjInterface.h"
#include "../MaxComponent/plMaxAnimUtils.h"
extern TCHAR *GetString(int id);
extern HINSTANCE hInstance;
#define ANIMSTEALTH_CLASSID Class_ID(0xd0272f8, 0x750349c9)
#define REFMSG_NOTETRACK_ADDED REFMSG_USER + 1
class plPassMtlBase;
class NoteTrack;
class plMaxNode;
class plErrorMsg;
class plAnimTimeConvert;
//// Class Def ///////////////////////////////////////////////////////////////
class plAnimStealthNode : public HelperObject, public plAnimObjInterface
{
protected:
ClassDesc2 *fClassDesc;
IParamBlock2 *fParamBlock;
plPassMtlBase *fParentMtl;
static ParamBlockDesc2 sAnimStealthPB;
hsBool fPreppedForConvert;
SegmentMap *fCachedSegMap;
SegmentSpec *IGetSegmentSpec( void ) const;
public:
// Some IDs
enum
{
kBlockPB = 0
};
enum Refs
{
kRefParamBlock,
kRefParentMtl
};
// ParamBlock IDs
enum ParamBlockIDs
{
kPBAutoStart, // Start the Animation on load (V2)
kPBLoop, // Start Looping at Begin Location
kPBName, // Name of the notetrack animation to play
kPBLoopName, // Name of the notetrack specified loop
kPBEaseInType,
kPBEaseOutType,
kPBEaseInLength,
kPBEaseOutLength,
kPBEaseInMin,
kPBEaseInMax,
kPBEaseOutMin,
kPBEaseOutMax
};
plAnimStealthNode( BOOL loading );
virtual ~plAnimStealthNode();
void DeleteThis() { delete this; }
INode *GetINode( void );
plPassMtlBase *GetParentMtl( void );
void SetParentMtl( plPassMtlBase *parent );
void SetNodeName( const char *parentName );
// Create the dialog for this object and place it inside the given dialog, centering it in the given control if any
bool CreateAndEmbedDlg( IParamMap2 *parentMap, IMtlParams *parentParams, HWND frameCtrl = nil );
// Release said dialog
void ReleaseDlg( void );
// Switch underlying objects in the dialog (to avoid unnecessary deletion/recreations)
void SwitchDlg( plAnimStealthNode *toSwitchTo );
// Get the actual window handle of the currently active dialog displaying us
HWND GetWinDlg( void ) const;
// Interesting functions
const char *GetSegmentName( void ) const;
void SetSegment( const char *name ); // nil for "entire animation"
// Conversion from stealth's INode to the actual object
static bool CanConvertToStealth( INode *objNode );
static plAnimStealthNode *ConvertToStealth( INode *objNode );
///////////////////////////////////////////////////////////////////////////////////////
// Required Max functions
//
TCHAR* GetObjectName() { return (TCHAR*)fClassDesc->ClassName(); }
void InitNodeName(TSTR& s) { s = fClassDesc->InternalName(); }
void GetClassName(TSTR& s) { s = fClassDesc->ClassName(); }
Class_ID ClassID() { return ANIMSTEALTH_CLASSID; }
RefTargetHandle Clone(RemapDir &remap);
int NumRefs();
RefTargetHandle GetReference(int i);
void SetReference(int i, RefTargetHandle rtarg);
RefResult NotifyRefChanged(Interval changeInt,RefTargetHandle hTarget, PartID& partID, RefMessage message);
// allow retreival of our paramblock from other plug-ins
// and the max core
int NumParamBlocks();
IParamBlock2* GetParamBlock(int i);
IParamBlock2* GetParamBlockByID(BlockID id);
// We override because we don't want to be able to animate this sucker
int NumSubs() { return 0; }
Animatable *SubAnim( int i ) { return nil; }
TSTR SubAnimName( int i ) { return fClassDesc->ClassName(); }
// plug-in mouse creation callback
CreateMouseCallBack* GetCreateMouseCallBack();
void BeginEditParams(IObjParam *ip, ULONG flags, Animatable *prev);
void EndEditParams(IObjParam *ip, ULONG flags, Animatable *next);
// void SelectionSetChanged(Interface *ip, IUtil *iu);
void BuildMesh(TimeValue t);
void FreeCaches();
void GetLocalBoundBox(TimeValue t, INode *node, ViewExp *vpt, Box3 &box);
void GetWorldBoundBox(TimeValue t, INode *node, ViewExp *vpt, Box3 &box);
int Display(TimeValue t, INode *node, ViewExp *vpt, int flags);
int HitTest(TimeValue t, INode *node, int type, int crossing, int flags, IPoint2 *p, ViewExp *vpt);
ObjectState Eval(TimeValue t) { return ObjectState(this); }
IOResult Save(ISave* isave);
IOResult Load(ILoad* iload);
int CanConvertToType( Class_ID obtype ) { return ( obtype == ANIMSTEALTH_CLASSID ) ? 1 : 0; }
const char *GetCategory() { return fClassDesc->Category(); }
/// Parameter access
bool GetAutoStart( void ) const;
void SetAutoStart( bool b );
bool GetLoop( void ) const;
const char *GetLoopName( void ) const;
void SetLoop( bool b, const char *name );
UInt8 GetEaseInType( void ) const;
hsScalar GetEaseInLength( void ) const;
hsScalar GetEaseInMin( void ) const;
hsScalar GetEaseInMax( void ) const;
void SetEaseIn( UInt8 type, hsScalar length, hsScalar min, hsScalar max );
UInt8 GetEaseOutType( void ) const;
hsScalar GetEaseOutLength( void ) const;
hsScalar GetEaseOutMin( void ) const;
hsScalar GetEaseOutMax( void ) const;
void SetEaseOut( UInt8 type, hsScalar length, hsScalar min, hsScalar max );
// Conversion stuff
void GetAllStopPoints( hsTArray<hsScalar> &out );
hsScalar GetSegStart( void ) const;
hsScalar GetSegEnd( void ) const;
void GetLoopPoints( hsScalar &start, hsScalar &end ) const;
void StuffToTimeConvert( plAnimTimeConvert &convert, hsScalar maxLength );
// plAnimObjInterface functions
virtual void PickTargetNode( IParamBlock2 *destPB, ParamID destParamID, ParamID typeID );
virtual hsBool IsNodeRestricted( void ) { return true; }
virtual const char *GetIfaceSegmentName( hsBool allowNil );
virtual hsBool GetKeyList( INode *restrictedNode, hsTArray<plKey> &outKeys );
virtual hsBool MightRequireSeparateMaterial( void ) { return true; }
// Convert time, called on the setupProps pass for each material applied to a node in the scene
virtual hsBool SetupProperties( plMaxNode *node, plErrorMsg *pErrMsg );
virtual hsBool ConvertDeInit( plMaxNode *node, plErrorMsg *pErrMsg );
// Returns true if the parent material is applied to any node in the scene, false otherwise
hsBool IsParentUsedInScene( void );
};
//// Accessor for Parent's ParamBlock ////////////////////////////////////////
class plStealthNodeAccessor : public PBAccessor
{
protected:
void ISetParent( ReferenceTarget *target, plPassMtlBase *parent );
void IHandleSet( PB2Value &v, ReferenceMaker *owner, ParamID id, int tabIndex, TimeValue t );
public:
plStealthNodeAccessor() { }
static plStealthNodeAccessor &GetInstance( void );
virtual void Set( PB2Value &v, ReferenceMaker *owner, ParamID id, int tabIndex, TimeValue t );
virtual void TabChanged( tab_changes changeCode, Tab<PB2Value> *tab, ReferenceMaker *owner,
ParamID id, int tabIndex, int count );
};
#endif //_plAnimStealthNode_h

File diff suppressed because it is too large Load Diff

View File

@ -1,178 +1,178 @@
/*==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/>.
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 PL_BUMPMTL_H
#define PL_BUMPMTL_H
#include "Max.h"
#include "iparamb2.h"
#include "../resource.h"
#include "plPassMtlBase.h"
#define BUMP_MTL_CLASS_ID Class_ID(0x4dbf7b0a, 0x92226de)
extern TCHAR *GetString(int id);
class plBumpMtl : public plPassMtlBase
{
protected:
virtual void ICloneRefs( plPassMtlBase *target, RemapDir &remap );
public:
enum RefIDs
{
kRefBasic,
kRefAnim,
};
enum BlockIDs
{
kBlkBasic,
kBlkAnim,
};
plBumpMtl(BOOL loading);
void DeleteThis() { delete this; }
//From Animatable
Class_ID ClassID() { return BUMP_MTL_CLASS_ID; }
SClass_ID SuperClassID() { return MATERIAL_CLASS_ID; }
void GetClassName(TSTR& s) { s = GetString(IDS_BUMP_MTL); }
ParamDlg *CreateParamDlg(HWND hwMtlEdit, IMtlParams *imp);
void Update(TimeValue t, Interval& valid);
Interval Validity(TimeValue t);
void NotifyChanged();
BOOL SupportsMultiMapsInViewport() { return FALSE; }
void SetupGfxMultiMaps(TimeValue t, Material *mtl, MtlMakerCallback &cb);
// Shade and displacement calculation
static void GetInterpVtxValue(int channel, ShadeContext &sc, Point3 &interpVal);
void Shade(ShadeContext& sc);
void ShadeWithBackground(ShadeContext &sc, Color background, bool useVtxAlpha = true);
float EvalDisplacement(ShadeContext& sc);
Interval DisplacementValidity(TimeValue t);
virtual RefTargetHandle GetReference( int i );
virtual void SetReference( int i, RefTargetHandle rtarg );
// SubTexmap access methods
int NumSubTexmaps();
Texmap* GetSubTexmap(int i);
void SetSubTexmap(int i, Texmap *m);
TSTR GetSubTexmapSlotName(int i);
TSTR GetSubTexmapTVName(int i);
BOOL SetDlgThing(ParamDlg* dlg);
RefTargetHandle Clone( RemapDir &remap );
RefResult NotifyRefChanged(Interval changeInt, RefTargetHandle hTarget,
PartID& partID, RefMessage message);
int NumSubs();
Animatable* SubAnim(int i);
TSTR SubAnimName(int i);
int NumParamBlocks();
IParamBlock2* GetParamBlock(int i);
IParamBlock2* GetParamBlockByID(BlockID id);
// void SetParamDlg(ParamDlg *dlg);
// void SetNumSubTexmaps(int num);
// From MtlBase and Mtl
void SetAmbient(Color c, TimeValue t);
void SetDiffuse(Color c, TimeValue t);
void SetSpecular(Color c, TimeValue t);
void SetShininess(float v, TimeValue t);
Color GetAmbient(int mtlNum=0, BOOL backFace=FALSE);
Color GetDiffuse(int mtlNum=0, BOOL backFace=FALSE);
Color GetSpecular(int mtlNum=0, BOOL backFace=FALSE);
float GetXParency(int mtlNum=0, BOOL backFace=FALSE);
float GetShininess(int mtlNum=0, BOOL backFace=FALSE);
float GetShinStr(int mtlNum=0, BOOL backFace=FALSE);
float WireSize(int mtlNum=0, BOOL backFace=FALSE);
ULONG Requirements( int subMtlNum );
virtual bool HasAlpha();
// Massive list of inherited accessor functions for ParamBlock data
// Advanced Block
virtual int GetBasicWire();
virtual int GetMeshOutlines();
virtual int GetTwoSided();
virtual int GetSoftShadow();
virtual int GetNoProj();
virtual int GetVertexShade();
virtual int GetNoShade();
virtual int GetNoFog();
virtual int GetWhite();
virtual int GetZOnly();
virtual int GetZClear();
virtual int GetZNoRead();
virtual int GetZNoWrite();
virtual int GetZInc();
virtual int GetAlphaTestHigh();
// Animation block
virtual char * GetAnimName();
virtual int GetAutoStart();
virtual int GetLoop();
virtual char * GetAnimLoopName();
// Basic block
virtual int GetColorLock();
virtual Color GetAmbColor();
virtual Color GetColor();
virtual int GetOpacity();
virtual int GetEmissive();
virtual int GetUseSpec();
virtual int GetShine();
virtual Color GetSpecularColor();
virtual Control *GetPreshadeColorController();
virtual Control *GetAmbColorController();
virtual Control *GetOpacityController();
virtual Control *GetSpecularColorController();
virtual int GetDiffuseColorLock();
virtual Color GetRuntimeColor();
virtual Control *GetRuntimeColorController();
// Layer block
virtual Texmap *GetBaseLayer();
virtual int GetTopLayerOn();
virtual Texmap *GetTopLayer();
virtual int GetLayerBlend();
virtual int GetOutputAlpha();
virtual int GetOutputBlend();
};
/*==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/>.
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 PL_BUMPMTL_H
#define PL_BUMPMTL_H
#include "Max.h"
#include "iparamb2.h"
#include "../resource.h"
#include "plPassMtlBase.h"
#define BUMP_MTL_CLASS_ID Class_ID(0x4dbf7b0a, 0x92226de)
extern TCHAR *GetString(int id);
class plBumpMtl : public plPassMtlBase
{
protected:
virtual void ICloneRefs( plPassMtlBase *target, RemapDir &remap );
public:
enum RefIDs
{
kRefBasic,
kRefAnim,
};
enum BlockIDs
{
kBlkBasic,
kBlkAnim,
};
plBumpMtl(BOOL loading);
void DeleteThis() { delete this; }
//From Animatable
Class_ID ClassID() { return BUMP_MTL_CLASS_ID; }
SClass_ID SuperClassID() { return MATERIAL_CLASS_ID; }
void GetClassName(TSTR& s) { s = GetString(IDS_BUMP_MTL); }
ParamDlg *CreateParamDlg(HWND hwMtlEdit, IMtlParams *imp);
void Update(TimeValue t, Interval& valid);
Interval Validity(TimeValue t);
void NotifyChanged();
BOOL SupportsMultiMapsInViewport() { return FALSE; }
void SetupGfxMultiMaps(TimeValue t, Material *mtl, MtlMakerCallback &cb);
// Shade and displacement calculation
static void GetInterpVtxValue(int channel, ShadeContext &sc, Point3 &interpVal);
void Shade(ShadeContext& sc);
void ShadeWithBackground(ShadeContext &sc, Color background, bool useVtxAlpha = true);
float EvalDisplacement(ShadeContext& sc);
Interval DisplacementValidity(TimeValue t);
virtual RefTargetHandle GetReference( int i );
virtual void SetReference( int i, RefTargetHandle rtarg );
// SubTexmap access methods
int NumSubTexmaps();
Texmap* GetSubTexmap(int i);
void SetSubTexmap(int i, Texmap *m);
TSTR GetSubTexmapSlotName(int i);
TSTR GetSubTexmapTVName(int i);
BOOL SetDlgThing(ParamDlg* dlg);
RefTargetHandle Clone( RemapDir &remap );
RefResult NotifyRefChanged(Interval changeInt, RefTargetHandle hTarget,
PartID& partID, RefMessage message);
int NumSubs();
Animatable* SubAnim(int i);
TSTR SubAnimName(int i);
int NumParamBlocks();
IParamBlock2* GetParamBlock(int i);
IParamBlock2* GetParamBlockByID(BlockID id);
// void SetParamDlg(ParamDlg *dlg);
// void SetNumSubTexmaps(int num);
// From MtlBase and Mtl
void SetAmbient(Color c, TimeValue t);
void SetDiffuse(Color c, TimeValue t);
void SetSpecular(Color c, TimeValue t);
void SetShininess(float v, TimeValue t);
Color GetAmbient(int mtlNum=0, BOOL backFace=FALSE);
Color GetDiffuse(int mtlNum=0, BOOL backFace=FALSE);
Color GetSpecular(int mtlNum=0, BOOL backFace=FALSE);
float GetXParency(int mtlNum=0, BOOL backFace=FALSE);
float GetShininess(int mtlNum=0, BOOL backFace=FALSE);
float GetShinStr(int mtlNum=0, BOOL backFace=FALSE);
float WireSize(int mtlNum=0, BOOL backFace=FALSE);
ULONG Requirements( int subMtlNum );
virtual bool HasAlpha();
// Massive list of inherited accessor functions for ParamBlock data
// Advanced Block
virtual int GetBasicWire();
virtual int GetMeshOutlines();
virtual int GetTwoSided();
virtual int GetSoftShadow();
virtual int GetNoProj();
virtual int GetVertexShade();
virtual int GetNoShade();
virtual int GetNoFog();
virtual int GetWhite();
virtual int GetZOnly();
virtual int GetZClear();
virtual int GetZNoRead();
virtual int GetZNoWrite();
virtual int GetZInc();
virtual int GetAlphaTestHigh();
// Animation block
virtual char * GetAnimName();
virtual int GetAutoStart();
virtual int GetLoop();
virtual char * GetAnimLoopName();
// Basic block
virtual int GetColorLock();
virtual Color GetAmbColor();
virtual Color GetColor();
virtual int GetOpacity();
virtual int GetEmissive();
virtual int GetUseSpec();
virtual int GetShine();
virtual Color GetSpecularColor();
virtual Control *GetPreshadeColorController();
virtual Control *GetAmbColorController();
virtual Control *GetOpacityController();
virtual Control *GetSpecularColorController();
virtual int GetDiffuseColorLock();
virtual Color GetRuntimeColor();
virtual Control *GetRuntimeColorController();
// Layer block
virtual Texmap *GetBaseLayer();
virtual int GetTopLayerOn();
virtual Texmap *GetTopLayer();
virtual int GetLayerBlend();
virtual int GetOutputAlpha();
virtual int GetOutputBlend();
};
#endif //PL_BUMPMTL_H

View File

@ -1,37 +1,37 @@
/*==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/>.
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 PL_BUMPMTLANIMPB_H
#define PL_BUMPMTLANIMPB_H
enum
{
kBumpAnimName,
kBumpAnimAutoStart,
kBumpAnimLoop,
kBumpAnimLoopName,
};
/*==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/>.
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 PL_BUMPMTLANIMPB_H
#define PL_BUMPMTLANIMPB_H
enum
{
kBumpAnimName,
kBumpAnimAutoStart,
kBumpAnimLoop,
kBumpAnimLoopName,
};
#endif

View File

@ -1,93 +1,93 @@
/*==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/>.
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 "plBumpMtl.h"
#include "plPassBaseParamIDs.h"
#include "resource.h"
#include "iparamm2.h"
#include "plPassAnimDlgProc.h"
#include "plAnimStealthNode.h"
using namespace plPassBaseParamIDs;
static ParamBlockDesc2 gBumpAnimPB
(
plBumpMtl::kBlkAnim, _T("anim"), IDS_PASS_ANIM, GetBumpMtlDesc(),//NULL,
P_AUTO_CONSTRUCT + P_AUTO_UI + P_CALLSETS_ON_LOAD, plBumpMtl::kRefAnim,
// UI
IDD_PASS_ANIM, IDS_PASS_ANIM, 0, 0, &plPassAnimDlgProc::Get(),
#ifdef MCN_UPGRADE_OLD_ANIM_BLOCKS
// THE FOLLOWING ARE ALL OLD PARAMETERS AND SHOULD NO LONGER BE USED. The only reason
// they're here is so we can convert old paramBlocks into the new plAnimStealthNode format
kPBAnimName, _T("animName"), TYPE_STRING, 0, 0,
end,
kPBAnimAutoStart, _T("autoStart"), TYPE_BOOL, 0, 0,
end,
kPBAnimLoop, _T("loop"), TYPE_BOOL, 0, 0,
end,
kPBAnimLoopName, _T("loopName"), TYPE_STRING, 0, 0,
end,
// Anim Ease
kPBAnimEaseInType, _T("easeInType"), TYPE_INT, 0, 0,
end,
kPBAnimEaseInLength, _T("easeInLength"), TYPE_FLOAT, 0, 0,
end,
kPBAnimEaseInMin, _T("easeInMin"), TYPE_FLOAT, 0, 0,
end,
kPBAnimEaseInMax, _T("easeInMax"), TYPE_FLOAT, 0, 0,
end,
kPBAnimEaseOutType, _T("easeOutType"), TYPE_INT, 0, 0,
end,
kPBAnimEaseOutLength, _T("easeOutLength"), TYPE_FLOAT, 0, 0,
end,
kPBAnimEaseOutMin, _T("easeOutMin"), TYPE_FLOAT, 0, 0,
end,
kPBAnimEaseOutMax, _T("easeOutMax"), TYPE_FLOAT, 0, 0,
end,
#endif // MCN_UPGRADE_OLD_ANIM_BLOCKS
kPBAnimUseGlobal, _T("UseGlobal"), TYPE_BOOL, 0, 0,
p_default, FALSE,
p_ui, TYPE_SINGLECHEKBOX, IDC_MTL_USE_GLOBAL,
end,
kPBAnimGlobalName, _T("GlobalName"), TYPE_STRING, 0, 0,
p_default, _T(""),
end,
kPBAnimStealthNodes, _T( "testing" ), TYPE_REFTARG_TAB, 0, 0, 0,
p_accessor, &plStealthNodeAccessor::GetInstance(),
end,
end
);
ParamBlockDesc2 *GetBumpAnimPB() { return &gBumpAnimPB; }
/*==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/>.
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 "plBumpMtl.h"
#include "plPassBaseParamIDs.h"
#include "resource.h"
#include "iparamm2.h"
#include "plPassAnimDlgProc.h"
#include "plAnimStealthNode.h"
using namespace plPassBaseParamIDs;
static ParamBlockDesc2 gBumpAnimPB
(
plBumpMtl::kBlkAnim, _T("anim"), IDS_PASS_ANIM, GetBumpMtlDesc(),//NULL,
P_AUTO_CONSTRUCT + P_AUTO_UI + P_CALLSETS_ON_LOAD, plBumpMtl::kRefAnim,
// UI
IDD_PASS_ANIM, IDS_PASS_ANIM, 0, 0, &plPassAnimDlgProc::Get(),
#ifdef MCN_UPGRADE_OLD_ANIM_BLOCKS
// THE FOLLOWING ARE ALL OLD PARAMETERS AND SHOULD NO LONGER BE USED. The only reason
// they're here is so we can convert old paramBlocks into the new plAnimStealthNode format
kPBAnimName, _T("animName"), TYPE_STRING, 0, 0,
end,
kPBAnimAutoStart, _T("autoStart"), TYPE_BOOL, 0, 0,
end,
kPBAnimLoop, _T("loop"), TYPE_BOOL, 0, 0,
end,
kPBAnimLoopName, _T("loopName"), TYPE_STRING, 0, 0,
end,
// Anim Ease
kPBAnimEaseInType, _T("easeInType"), TYPE_INT, 0, 0,
end,
kPBAnimEaseInLength, _T("easeInLength"), TYPE_FLOAT, 0, 0,
end,
kPBAnimEaseInMin, _T("easeInMin"), TYPE_FLOAT, 0, 0,
end,
kPBAnimEaseInMax, _T("easeInMax"), TYPE_FLOAT, 0, 0,
end,
kPBAnimEaseOutType, _T("easeOutType"), TYPE_INT, 0, 0,
end,
kPBAnimEaseOutLength, _T("easeOutLength"), TYPE_FLOAT, 0, 0,
end,
kPBAnimEaseOutMin, _T("easeOutMin"), TYPE_FLOAT, 0, 0,
end,
kPBAnimEaseOutMax, _T("easeOutMax"), TYPE_FLOAT, 0, 0,
end,
#endif // MCN_UPGRADE_OLD_ANIM_BLOCKS
kPBAnimUseGlobal, _T("UseGlobal"), TYPE_BOOL, 0, 0,
p_default, FALSE,
p_ui, TYPE_SINGLECHEKBOX, IDC_MTL_USE_GLOBAL,
end,
kPBAnimGlobalName, _T("GlobalName"), TYPE_STRING, 0, 0,
p_default, _T(""),
end,
kPBAnimStealthNodes, _T( "testing" ), TYPE_REFTARG_TAB, 0, 0, 0,
p_accessor, &plStealthNodeAccessor::GetInstance(),
end,
end
);
ParamBlockDesc2 *GetBumpAnimPB() { return &gBumpAnimPB; }

View File

@ -1,38 +1,38 @@
/*==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/>.
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 PL_BUMPMTLBASICPB_H
#define PL_BUMPMTLBASICPB_H
// Param ID's
enum
{
kBumpBasSpecular,
kBumpBasRunColor,
kBumpBasLayer
};
/*==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/>.
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 PL_BUMPMTLBASICPB_H
#define PL_BUMPMTLBASICPB_H
// Param ID's
enum
{
kBumpBasSpecular,
kBumpBasRunColor,
kBumpBasLayer
};
#endif //PL_BUMPMTLBASICPB_H

View File

@ -1,92 +1,92 @@
/*==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/>.
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 "plBumpMtl.h"
#include "plBumpMtlBasicPB.h"
#include "resource.h"
#include "iparamm2.h"
class BumpBasicDlgProc;
extern BumpBasicDlgProc gBumpBasicDlgProc;
static ParamBlockDesc2 gBumpBasicPB
(
plBumpMtl::kBlkBasic, _T("basic"), IDS_PASS_BASIC, GetBumpMtlDesc(),//NULL,
P_AUTO_CONSTRUCT + P_AUTO_UI, plBumpMtl::kRefBasic,
// UI
IDD_BUMP_BASIC, IDS_PASS_BASIC, 0, 0, &gBumpBasicDlgProc,
kBumpBasLayer, _T("bumpLayer"), TYPE_TEXMAP, 0, IDS_BASIC_AMB,
p_ui, TYPE_TEXMAPBUTTON, IDC_LAYER1,
p_subtexno, 0,
end,
kBumpBasRunColor, _T("runtimeColor"), TYPE_RGBA, P_ANIMATABLE, IDS_BASIC_RUNCOLOR,
// p_ui, TYPE_COLORSWATCH, IDC_LAYER_RUNCOLOR,
p_ui, TYPE_SPINNER, EDITTYPE_INT, IDC_INTEN_EDIT, IDC_INTEN_SPIN,
IDC_DUMMY_EDIT1, IDC_DUMMY_SPIN1, IDC_DUMMY_EDIT2, IDC_DUMMY_SPIN2,
SPIN_AUTOSCALE,
p_default, Color(1,0,0),
end,
// Specularity
kBumpBasSpecular, _T("useSpec"), TYPE_BOOL, 0, 0,
p_ui, TYPE_SINGLECHEKBOX, IDC_SHADE_SPECULAR,
end,
end
);
ParamBlockDesc2 *GetBumpBasicPB() { return &gBumpBasicPB; }
class BumpBasicDlgProc : public ParamMap2UserDlgProc
{
#if 1
protected:
public:
BumpBasicDlgProc() {}
~BumpBasicDlgProc() { }
#endif
public:
BOOL DlgProc(TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
IParamBlock2 *pb = map->GetParamBlock();
switch (msg)
{
case WM_INITDIALOG:
{
}
return TRUE;
}
return FALSE;
}
void DeleteThis() {}
};
static BumpBasicDlgProc gBumpBasicDlgProc;
/*==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/>.
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 "plBumpMtl.h"
#include "plBumpMtlBasicPB.h"
#include "resource.h"
#include "iparamm2.h"
class BumpBasicDlgProc;
extern BumpBasicDlgProc gBumpBasicDlgProc;
static ParamBlockDesc2 gBumpBasicPB
(
plBumpMtl::kBlkBasic, _T("basic"), IDS_PASS_BASIC, GetBumpMtlDesc(),//NULL,
P_AUTO_CONSTRUCT + P_AUTO_UI, plBumpMtl::kRefBasic,
// UI
IDD_BUMP_BASIC, IDS_PASS_BASIC, 0, 0, &gBumpBasicDlgProc,
kBumpBasLayer, _T("bumpLayer"), TYPE_TEXMAP, 0, IDS_BASIC_AMB,
p_ui, TYPE_TEXMAPBUTTON, IDC_LAYER1,
p_subtexno, 0,
end,
kBumpBasRunColor, _T("runtimeColor"), TYPE_RGBA, P_ANIMATABLE, IDS_BASIC_RUNCOLOR,
// p_ui, TYPE_COLORSWATCH, IDC_LAYER_RUNCOLOR,
p_ui, TYPE_SPINNER, EDITTYPE_INT, IDC_INTEN_EDIT, IDC_INTEN_SPIN,
IDC_DUMMY_EDIT1, IDC_DUMMY_SPIN1, IDC_DUMMY_EDIT2, IDC_DUMMY_SPIN2,
SPIN_AUTOSCALE,
p_default, Color(1,0,0),
end,
// Specularity
kBumpBasSpecular, _T("useSpec"), TYPE_BOOL, 0, 0,
p_ui, TYPE_SINGLECHEKBOX, IDC_SHADE_SPECULAR,
end,
end
);
ParamBlockDesc2 *GetBumpBasicPB() { return &gBumpBasicPB; }
class BumpBasicDlgProc : public ParamMap2UserDlgProc
{
#if 1
protected:
public:
BumpBasicDlgProc() {}
~BumpBasicDlgProc() { }
#endif
public:
BOOL DlgProc(TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
IParamBlock2 *pb = map->GetParamBlock();
switch (msg)
{
case WM_INITDIALOG:
{
}
return TRUE;
}
return FALSE;
}
void DeleteThis() {}
};
static BumpBasicDlgProc gBumpBasicDlgProc;

File diff suppressed because it is too large Load Diff

View File

@ -1,201 +1,201 @@
/*==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/>.
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 PL_CLOTHINGMTL_H
#define PL_CLOTHINGMTL_H
#include "Max.h"
#include "iparamb2.h"
#include "../resource.h"
#include "hsTemplates.h"
class Bitmap;
class plClothingItem;
class plMaxNode;
class plClothingElement;
#define CLOTHING_MTL_CLASS_ID Class_ID(0x792c6de4, 0x1f952b65)
extern TCHAR *GetString(int id);
class plClothingTileset
{
public:
char *fName;
hsTArray<plClothingElement *> fElements;
plClothingTileset();
~plClothingTileset();
void SetName(char *name);
void AddElement(plClothingElement *element);
};
class plClothingMtl : public Mtl
{
protected:
IParamBlock2 *fBasicPB;
Interval fIValid;
public:
IMtlParams *fIMtlParams;
static const char *LayerStrings[];
static const UInt8 LayerToPBIdx[];
enum
{
kRefBasic,
};
enum
{
kBlkBasic,
};
enum // Param block indicies
{
kTileset,
kTexmap,
kDescription,
kThumbnail,
kLayer,
kTexmapSkin,
kTexmap2,
kDefault,
kCustomTextSpecs,
kTexmapBase,
kTexmapSkinBlend1,
kTexmapSkinBlend2,
kTexmapSkinBlend3,
kTexmapSkinBlend4,
kTexmapSkinBlend5,
kTexmapSkinBlend6,
kDefaultTint1,
kDefaultTint2,
kForcedAcc,
};
enum
{
kMaxTiles = 4,
};
enum
{
kBlendNone,
kBlendAlpha,
//kBlendAdd,
};
static const UINT32 ButtonConstants[kMaxTiles];
static const UINT32 TextConstants[kMaxTiles * 2];
hsTArray<plClothingTileset *> fTilesets;
hsTArray<plClothingElement *> fElements;
virtual void InitTilesets();
virtual void ReleaseTilesets();
plClothingElement *FindElementByName(char *name);
int GetTilesetIndex() { return fBasicPB->GetInt(ParamID(kTileset)); }
DllExport Texmap *GetTexmap(int index, int layer);
Texmap *GetThumbnail() { return fBasicPB->GetTexmap(ParamID(kThumbnail)); }
char *GetDescription() { return fBasicPB->GetStr(ParamID(kDescription)); }
char *GetCustomText() { return fBasicPB->GetStr(ParamID(kCustomTextSpecs)); }
hsBool GetDefault() { return fBasicPB->GetInt(ParamID(kDefault)) != 0; }
Color GetDefaultTint1() { return fBasicPB->GetColor(plClothingMtl::kDefaultTint1); }
Color GetDefaultTint2() { return fBasicPB->GetColor(plClothingMtl::kDefaultTint2); }
char *GetForcedAccessoryName() { return fBasicPB->GetStr(ParamID(kForcedAcc)); }
plClothingMtl(BOOL loading);
void DeleteThis() { delete this; }
//From Animatable
Class_ID ClassID() { return CLOTHING_MTL_CLASS_ID; }
SClass_ID SuperClassID() { return MATERIAL_CLASS_ID; }
void GetClassName(TSTR& s) { s = GetString(IDS_CLOTHING_MTL); }
ParamDlg *CreateParamDlg(HWND hwMtlEdit, IMtlParams *imp);
void Update(TimeValue t, Interval& valid);
Interval Validity(TimeValue t);
void Reset();
void NotifyChanged();
BOOL SupportsMultiMapsInViewport() { return FALSE; }
void SetupGfxMultiMaps(TimeValue t, Material *mtl, MtlMakerCallback &cb);
// Shade and displacement calculation
void Shade(ShadeContext& sc);
void ShadeWithBackground(ShadeContext &sc, Color background);
float EvalDisplacement(ShadeContext& sc);
Interval DisplacementValidity(TimeValue t);
// SubTexmap access methods
int NumSubTexmaps();
Texmap* GetSubTexmap(int i);
void SetSubTexmap(int i, Texmap *m);
TSTR GetSubTexmapSlotName(int i);
TSTR GetSubTexmapTVName(int i);
BOOL SetDlgThing(ParamDlg* dlg);
// Loading/Saving
IOResult Load(ILoad *iload);
IOResult Save(ISave *isave);
RefTargetHandle Clone( RemapDir &remap );
RefResult NotifyRefChanged(Interval changeInt, RefTargetHandle hTarget,
PartID& partID, RefMessage message);
int NumSubs() { return 0; }
Animatable* SubAnim(int i) { return nil; }
TSTR SubAnimName(int i) { return ""; }
int NumRefs();
RefTargetHandle GetReference(int i);
void SetReference(int i, RefTargetHandle rtarg);
int NumParamBlocks();
IParamBlock2* GetParamBlock(int i);
IParamBlock2* GetParamBlockByID(BlockID id);
// From MtlBase and Mtl
void SetAmbient(Color c, TimeValue t);
void SetDiffuse(Color c, TimeValue t);
void SetSpecular(Color c, TimeValue t);
void SetShininess(float v, TimeValue t);
Color GetAmbient(int mtlNum=0, BOOL backFace=FALSE);
Color GetDiffuse(int mtlNum=0, BOOL backFace=FALSE);
Color GetSpecular(int mtlNum=0, BOOL backFace=FALSE);
float GetXParency(int mtlNum=0, BOOL backFace=FALSE);
float GetShininess(int mtlNum=0, BOOL backFace=FALSE);
float GetShinStr(int mtlNum=0, BOOL backFace=FALSE);
float WireSize(int mtlNum=0, BOOL backFace=FALSE);
ULONG Requirements( int subMtlNum );
};
#endif //PL_ClothingMTL_H
/*==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/>.
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 PL_CLOTHINGMTL_H
#define PL_CLOTHINGMTL_H
#include "Max.h"
#include "iparamb2.h"
#include "../resource.h"
#include "hsTemplates.h"
class Bitmap;
class plClothingItem;
class plMaxNode;
class plClothingElement;
#define CLOTHING_MTL_CLASS_ID Class_ID(0x792c6de4, 0x1f952b65)
extern TCHAR *GetString(int id);
class plClothingTileset
{
public:
char *fName;
hsTArray<plClothingElement *> fElements;
plClothingTileset();
~plClothingTileset();
void SetName(char *name);
void AddElement(plClothingElement *element);
};
class plClothingMtl : public Mtl
{
protected:
IParamBlock2 *fBasicPB;
Interval fIValid;
public:
IMtlParams *fIMtlParams;
static const char *LayerStrings[];
static const UInt8 LayerToPBIdx[];
enum
{
kRefBasic,
};
enum
{
kBlkBasic,
};
enum // Param block indicies
{
kTileset,
kTexmap,
kDescription,
kThumbnail,
kLayer,
kTexmapSkin,
kTexmap2,
kDefault,
kCustomTextSpecs,
kTexmapBase,
kTexmapSkinBlend1,
kTexmapSkinBlend2,
kTexmapSkinBlend3,
kTexmapSkinBlend4,
kTexmapSkinBlend5,
kTexmapSkinBlend6,
kDefaultTint1,
kDefaultTint2,
kForcedAcc,
};
enum
{
kMaxTiles = 4,
};
enum
{
kBlendNone,
kBlendAlpha,
//kBlendAdd,
};
static const UINT32 ButtonConstants[kMaxTiles];
static const UINT32 TextConstants[kMaxTiles * 2];
hsTArray<plClothingTileset *> fTilesets;
hsTArray<plClothingElement *> fElements;
virtual void InitTilesets();
virtual void ReleaseTilesets();
plClothingElement *FindElementByName(char *name);
int GetTilesetIndex() { return fBasicPB->GetInt(ParamID(kTileset)); }
DllExport Texmap *GetTexmap(int index, int layer);
Texmap *GetThumbnail() { return fBasicPB->GetTexmap(ParamID(kThumbnail)); }
char *GetDescription() { return fBasicPB->GetStr(ParamID(kDescription)); }
char *GetCustomText() { return fBasicPB->GetStr(ParamID(kCustomTextSpecs)); }
hsBool GetDefault() { return fBasicPB->GetInt(ParamID(kDefault)) != 0; }
Color GetDefaultTint1() { return fBasicPB->GetColor(plClothingMtl::kDefaultTint1); }
Color GetDefaultTint2() { return fBasicPB->GetColor(plClothingMtl::kDefaultTint2); }
char *GetForcedAccessoryName() { return fBasicPB->GetStr(ParamID(kForcedAcc)); }
plClothingMtl(BOOL loading);
void DeleteThis() { delete this; }
//From Animatable
Class_ID ClassID() { return CLOTHING_MTL_CLASS_ID; }
SClass_ID SuperClassID() { return MATERIAL_CLASS_ID; }
void GetClassName(TSTR& s) { s = GetString(IDS_CLOTHING_MTL); }
ParamDlg *CreateParamDlg(HWND hwMtlEdit, IMtlParams *imp);
void Update(TimeValue t, Interval& valid);
Interval Validity(TimeValue t);
void Reset();
void NotifyChanged();
BOOL SupportsMultiMapsInViewport() { return FALSE; }
void SetupGfxMultiMaps(TimeValue t, Material *mtl, MtlMakerCallback &cb);
// Shade and displacement calculation
void Shade(ShadeContext& sc);
void ShadeWithBackground(ShadeContext &sc, Color background);
float EvalDisplacement(ShadeContext& sc);
Interval DisplacementValidity(TimeValue t);
// SubTexmap access methods
int NumSubTexmaps();
Texmap* GetSubTexmap(int i);
void SetSubTexmap(int i, Texmap *m);
TSTR GetSubTexmapSlotName(int i);
TSTR GetSubTexmapTVName(int i);
BOOL SetDlgThing(ParamDlg* dlg);
// Loading/Saving
IOResult Load(ILoad *iload);
IOResult Save(ISave *isave);
RefTargetHandle Clone( RemapDir &remap );
RefResult NotifyRefChanged(Interval changeInt, RefTargetHandle hTarget,
PartID& partID, RefMessage message);
int NumSubs() { return 0; }
Animatable* SubAnim(int i) { return nil; }
TSTR SubAnimName(int i) { return ""; }
int NumRefs();
RefTargetHandle GetReference(int i);
void SetReference(int i, RefTargetHandle rtarg);
int NumParamBlocks();
IParamBlock2* GetParamBlock(int i);
IParamBlock2* GetParamBlockByID(BlockID id);
// From MtlBase and Mtl
void SetAmbient(Color c, TimeValue t);
void SetDiffuse(Color c, TimeValue t);
void SetSpecular(Color c, TimeValue t);
void SetShininess(float v, TimeValue t);
Color GetAmbient(int mtlNum=0, BOOL backFace=FALSE);
Color GetDiffuse(int mtlNum=0, BOOL backFace=FALSE);
Color GetSpecular(int mtlNum=0, BOOL backFace=FALSE);
float GetXParency(int mtlNum=0, BOOL backFace=FALSE);
float GetShininess(int mtlNum=0, BOOL backFace=FALSE);
float GetShinStr(int mtlNum=0, BOOL backFace=FALSE);
float WireSize(int mtlNum=0, BOOL backFace=FALSE);
ULONG Requirements( int subMtlNum );
};
#endif //PL_ClothingMTL_H

View File

@ -1,426 +1,426 @@
/*==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/>.
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 "plClothingMtl.h"
#include "../../AssetMan/PublicInterface/AssManBaseTypes.h"
#include "max.h"
class plClothingEditBox
{
protected:
int fCtrlID;
int fPBEditID;
plClothingEditBox() {};
void IGetText(IParamBlock2 *pb, HWND hCtrl)
{
// Get the previous value
const char *oldVal = pb->GetStr(fPBEditID);
if (!oldVal)
oldVal = "";
// Get the text from the edit and store it in the paramblock
int len = GetWindowTextLength(hCtrl)+1;
if (len > 1)
{
char *buf = TRACKED_NEW char[len];
GetWindowText(hCtrl, buf, len);
// If the old value is different from the current one, update
if (strcmp(oldVal, buf))
pb->SetValue(fPBEditID, 0, buf);
delete [] buf;
}
else
{
// If the old value wasn't empty, update
if (*oldVal != '\0')
pb->SetValue(fPBEditID, 0, "");
}
}
public:
plClothingEditBox(int ctrlID, int pbEditID) : fCtrlID(ctrlID), fPBEditID(pbEditID) {}
void UpdateText(IParamBlock2 *pb, HWND hWnd)
{
const char *str = pb->GetStr(fPBEditID);
SetDlgItemText(hWnd, fCtrlID, (str != nil ? str : ""));
}
BOOL ProcessMsg(IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
// If this isn't a message we process, return
if (!(msg == WM_INITDIALOG || msg == WM_DESTROY ||
(msg == WM_COMMAND && LOWORD(wParam) == fCtrlID)))
return FALSE;
IParamBlock2 *pb = map->GetParamBlock();
// Initializing the dialog, set the text box
if (msg == WM_INITDIALOG)
{
UpdateText(pb, hWnd);
return FALSE;
}
// Being destroyed, but we may not have gotten the text from the edit box
// (EN_KILLFOCUS seems to be sent after the window isn't recieving any more messages)
if (msg == WM_DESTROY)
{
IGetText(pb, GetDlgItem(hWnd, fCtrlID));
return FALSE;
}
int notification = HIWORD(wParam);
HWND hCtrl = (HWND)lParam;
// Disable Max accelerators when the edit box gets focus
if (notification == EN_SETFOCUS)
{
//plMaxAccelerators::Disable();
DisableAccelerators();
return TRUE;
}
// The edit control is losing focus, get it's contents
else if (notification == EN_KILLFOCUS)
{
IGetText(pb, hCtrl);
//plMaxAccelerators::Enable();
EnableAccelerators();
return TRUE;
}
return FALSE;
}
};
class ClothingBasicDlgProc;
extern ClothingBasicDlgProc gClothingBasicDlgProc;
static ParamBlockDesc2 gClothingMtlPB
(
plClothingMtl::kBlkBasic, _T("Clothing"), IDS_PASS_BASIC, GetClothingMtlDesc(),
P_AUTO_CONSTRUCT + P_AUTO_UI + P_CALLSETS_ON_LOAD, plClothingMtl::kRefBasic,
// UI
IDD_CLOTHING, IDS_PASS_BASIC, 0, 0, &gClothingBasicDlgProc,
plClothingMtl::kTileset, _T("tileset"), TYPE_INT, 0, 0,
p_default, 0,
end,
plClothingMtl::kTexmap, _T("texmap"), TYPE_TEXMAP_TAB, plClothingMtl::kMaxTiles, 0, 0,
end,
plClothingMtl::kDescription, _T("ItemDescription"), TYPE_STRING, 0, 0,
p_ui, TYPE_EDITBOX, IDC_CLOTHING_DESCRIPTION,
end,
plClothingMtl::kThumbnail, _T("Thumbnail"), TYPE_TEXMAP, 0, 0,
end,
plClothingMtl::kLayer, _T("Layer"), TYPE_INT, 0, 0,
p_default, plClothingElement::kLayerTint1,
end,
plClothingMtl::kTexmapSkin, _T("SkinLayer"), TYPE_TEXMAP_TAB, plClothingMtl::kMaxTiles, 0, 0,
end,
plClothingMtl::kTexmap2, _T("TintLayer2"), TYPE_TEXMAP_TAB, plClothingMtl::kMaxTiles, 0, 0,
end,
plClothingMtl::kDefault, _T("Default"), TYPE_BOOL, 0, 0,
p_ui, TYPE_SINGLECHEKBOX, IDC_CLOTHING_DEFAULT,
p_default, 0,
end,
plClothingMtl::kCustomTextSpecs, _T("TextSpecs"), TYPE_STRING, 0, 0,
end,
plClothingMtl::kTexmapBase, _T("BaseLayer"), TYPE_TEXMAP_TAB, plClothingMtl::kMaxTiles, 0, 0,
end,
plClothingMtl::kTexmapSkinBlend1, _T("SkinBlend(1)"), TYPE_TEXMAP_TAB, plClothingMtl::kMaxTiles, 0, 0,
end,
plClothingMtl::kTexmapSkinBlend2, _T("SkinBlend(2)"), TYPE_TEXMAP_TAB, plClothingMtl::kMaxTiles, 0, 0,
end,
plClothingMtl::kTexmapSkinBlend3, _T("SkinBlend(3)"), TYPE_TEXMAP_TAB, plClothingMtl::kMaxTiles, 0, 0,
end,
plClothingMtl::kTexmapSkinBlend4, _T("SkinBlend(4)"), TYPE_TEXMAP_TAB, plClothingMtl::kMaxTiles, 0, 0,
end,
plClothingMtl::kTexmapSkinBlend5, _T("SkinBlend(5)"), TYPE_TEXMAP_TAB, plClothingMtl::kMaxTiles, 0, 0,
end,
plClothingMtl::kTexmapSkinBlend6, _T("SkinBlend(6)"), TYPE_TEXMAP_TAB, plClothingMtl::kMaxTiles, 0, 0,
end,
plClothingMtl::kDefaultTint1, _T("DefaultTint1"), TYPE_RGBA, 0, 0,
p_ui, TYPE_COLORSWATCH, IDC_CLOTHING_TINT1,
p_default, Color(1,1,1),
end,
plClothingMtl::kDefaultTint2, _T("DefaultTint2"), TYPE_RGBA, 0, 0,
p_ui, TYPE_COLORSWATCH, IDC_CLOTHING_TINT2,
p_default, Color(1,1,1),
end,
plClothingMtl::kForcedAcc, _T("ForcedAcc"), TYPE_STRING, 0, 0,
p_ui, TYPE_EDITBOX, IDC_CLOTHING_FORCED_ACC,
end,
end
);
class ClothingBasicDlgProc : public ParamMap2UserDlgProc
{
protected:
plClothingEditBox fCustomText;
public:
ClothingBasicDlgProc() : fCustomText(IDC_CLOTHING_CUSTOM_TEXT_SPECS, plClothingMtl::kCustomTextSpecs) {}
~ClothingBasicDlgProc() {}
void UpdateDisplay(IParamMap2 *pmap)
{
HWND hWnd = pmap->GetHWnd();
IParamBlock2 *pb = pmap->GetParamBlock();
plClothingMtl *mtl = (plClothingMtl *)pb->GetOwner();
HWND cbox = NULL;
plPlasmaMAXLayer *layer;
PBBitmap *pbbm;
ICustButton *bmSelectBtn;
char buff[256];
// Setup the tiles
int i, j;
int layerSet = pb->GetInt(ParamID(plClothingMtl::kLayer));
int layerIdx = plClothingMtl::LayerToPBIdx[layerSet];
for (j = 0; j < plClothingMtl::kMaxTiles; j++)
{
layer = (plPlasmaMAXLayer *)pb->GetTexmap(ParamID(layerIdx), 0, j);
pbbm = (layer == nil ? nil : layer->GetPBBitmap());
bmSelectBtn = GetICustButton(GetDlgItem(hWnd, plClothingMtl::ButtonConstants[j]));
bmSelectBtn->SetText(pbbm ? (TCHAR*)pbbm->bi.Filename() : "(none)");
ReleaseICustButton(bmSelectBtn);
}
// And the thumbnail...
layer = (plPlasmaMAXLayer *)pb->GetTexmap(ParamID(plClothingMtl::kThumbnail));
if (layer == nil)
{
layer = TRACKED_NEW plLayerTex;
pb->SetValue(ParamID(plClothingMtl::kThumbnail), 0, layer);
}
pbbm = layer->GetPBBitmap();
if (pbbm)
{
bmSelectBtn = GetICustButton(GetDlgItem(hWnd, IDC_CLOTHING_THUMBNAIL));
bmSelectBtn->SetText((TCHAR*)pbbm->bi.Filename());
ReleaseICustButton(bmSelectBtn);
}
int setIdx = pb->GetInt(ParamID(plClothingMtl::kTileset));
ComboBox_SetCurSel(GetDlgItem(hWnd, IDC_CLOTHING_TILESET), setIdx);
ComboBox_SetCurSel(GetDlgItem(hWnd, IDC_CLOTHING_LAYER), pb->GetInt(ParamID(plClothingMtl::kLayer)));
mtl->InitTilesets();
plClothingTileset *tileset = mtl->fTilesets.Get(setIdx);
for (i = 0; i < tileset->fElements.GetCount(); i++)
{
plClothingElement *element = tileset->fElements.Get(i);
SendMessage(GetDlgItem(hWnd, plClothingMtl::TextConstants[2 * i]),
WM_SETTEXT, NULL, (LPARAM)element->fName);
sprintf(buff, "(%d, %d)", element->fWidth, element->fHeight);
SendMessage(GetDlgItem(hWnd, plClothingMtl::TextConstants[2 * i + 1]),
WM_SETTEXT, NULL, (LPARAM)buff);
ShowWindow(GetDlgItem(hWnd, plClothingMtl::TextConstants[2 * i]), SW_SHOW);
ShowWindow(GetDlgItem(hWnd, plClothingMtl::TextConstants[2 * i + 1]), SW_SHOW);
ShowWindow(GetDlgItem(hWnd, plClothingMtl::ButtonConstants[i]), SW_SHOW);
}
for (i = tileset->fElements.GetCount(); i < plClothingMtl::kMaxTiles; i++)
{
ShowWindow(GetDlgItem(hWnd, plClothingMtl::TextConstants[2 * i]), SW_HIDE);
ShowWindow(GetDlgItem(hWnd, plClothingMtl::TextConstants[2 * i + 1]), SW_HIDE);
ShowWindow(GetDlgItem(hWnd, plClothingMtl::ButtonConstants[i]), SW_HIDE);
}
mtl->ReleaseTilesets();
fCustomText.UpdateText(pb, hWnd);
}
virtual void Update(TimeValue t, Interval& valid, IParamMap2* pmap) { UpdateDisplay(pmap); }
BOOL DlgProc(TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
// Check if it is for our edit box
if (fCustomText.ProcessMsg(map, hWnd, msg, wParam, lParam))
return TRUE;
int id = LOWORD(wParam);
int code = HIWORD(wParam);
IParamBlock2 *pb = map->GetParamBlock();
plClothingMtl *mtl = (plClothingMtl *)pb->GetOwner();
HWND cbox = NULL;
plPlasmaMAXLayer *layer;
PBBitmap *pbbm;
ICustButton *bmSelectBtn;
int layerIdx = plClothingMtl::LayerToPBIdx[pb->GetInt(ParamID(plClothingMtl::kLayer))];
switch (msg)
{
case WM_INITDIALOG:
int j;
mtl->InitTilesets();
cbox = GetDlgItem(hWnd, IDC_CLOTHING_TILESET);
for (j = 0; j < mtl->fTilesets.GetCount(); j++)
SendMessage(cbox, CB_ADDSTRING, 0, (LPARAM)mtl->fTilesets.Get(j)->fName);
mtl->ReleaseTilesets();
cbox = GetDlgItem(hWnd, IDC_CLOTHING_LAYER);
for (j = 0; j < plClothingElement::kLayerMax; j++)
ComboBox_AddString(cbox, plClothingMtl::LayerStrings[j]);
return TRUE;
case WM_COMMAND:
if (id == IDC_CLOTHING_TILESET)
{
int setIdx = SendMessage(GetDlgItem(hWnd, id), CB_GETCURSEL, 0, 0);
pb->SetValue(plClothingMtl::kTileset, t, setIdx);
return TRUE;
}
if (id == IDC_CLOTHING_LAYER)
{
pb->SetValue(plClothingMtl::kLayer, t, ComboBox_GetCurSel(GetDlgItem(hWnd, id)));
return TRUE;
}
if (id == IDC_CLOTHING_THUMBNAIL)
{
layer = (plPlasmaMAXLayer *)pb->GetTexmap(ParamID(plClothingMtl::kThumbnail));
if (layer == nil)
return FALSE;
BitmapInfo bi;
bi.SetName(layer->GetPBBitmap() == nil ? "" : layer->GetPBBitmap()->bi.Name());
BOOL selectedNewBitmap = layer->HandleBitmapSelection();
if (selectedNewBitmap)
{
pbbm = layer->GetPBBitmap();
bmSelectBtn = GetICustButton(GetDlgItem(hWnd, IDC_CLOTHING_THUMBNAIL));
bmSelectBtn->SetText(pbbm != nil ? (TCHAR*)pbbm->bi.Filename() : "(none)");
ReleaseICustButton(bmSelectBtn);
}
return TRUE;
}
int buttonIdx = -1;
if (id == IDC_CLOTHING_TEXTURE1) buttonIdx = 0;
else if (id == IDC_CLOTHING_TEXTURE2) buttonIdx = 1;
else if (id == IDC_CLOTHING_TEXTURE3) buttonIdx = 2;
else if (id == IDC_CLOTHING_TEXTURE4) buttonIdx = 3;
if (buttonIdx != -1)
{
layer = (plPlasmaMAXLayer *)pb->GetTexmap(ParamID(layerIdx), 0, buttonIdx);
if (layer == nil)
{ // First time we've set a layer on this spot
layer = TRACKED_NEW plLayerTex;
pb->SetValue(ParamID(layerIdx), 0, layer, buttonIdx);
}
jvUniqueId oldId;
layer->GetBitmapAssetId(oldId);
BitmapInfo bi;
bi.SetName(layer->GetPBBitmap() == nil ? "" : layer->GetPBBitmap()->bi.Name());
BOOL selectedNewBitmap = layer->HandleBitmapSelection();
if (selectedNewBitmap)
{
// Check if it's ok, and undo if not.
hsBool choiceOk = true;
pbbm = layer->GetPBBitmap();
if (pbbm != nil)
{
mtl->InitTilesets();
plClothingTileset *tileset = mtl->fTilesets.Get(pb->GetInt(plClothingMtl::kTileset));
plClothingElement *element = tileset->fElements.Get(buttonIdx);
float targRatio = (float)element->fWidth / (float)element->fHeight;
float ratio = (float)pbbm->bi.Width() / (float)pbbm->bi.Height();
if (targRatio != ratio)
{
choiceOk = false;
hsMessageBox("That image's width/height ratio does not match the one for this tile. "
"Restoring the old selection.", "Invalid image", hsMessageBoxNormal);
}
else if (pbbm->bi.Width() < element->fWidth)
{
choiceOk = false;
hsMessageBox("The chosen image is too small for that tile slot. "
"Restoring the old selection.", "Invalid image", hsMessageBoxNormal);
}
mtl->ReleaseTilesets();
}
if (!choiceOk)
{
layer->SetBitmapAssetId(oldId);
layer->SetBitmap(&bi);
}
else
{
bmSelectBtn = GetICustButton(GetDlgItem(hWnd, plClothingMtl::ButtonConstants[buttonIdx]));
bmSelectBtn->SetText(pbbm != nil ? (TCHAR*)pbbm->bi.Filename() : "(none)");
ReleaseICustButton(bmSelectBtn);
}
}
}
return TRUE;
}
return FALSE;
}
void DeleteThis() {}
};
static ClothingBasicDlgProc gClothingBasicDlgProc;
/*==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/>.
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 "plClothingMtl.h"
#include "../../AssetMan/PublicInterface/AssManBaseTypes.h"
#include "max.h"
class plClothingEditBox
{
protected:
int fCtrlID;
int fPBEditID;
plClothingEditBox() {};
void IGetText(IParamBlock2 *pb, HWND hCtrl)
{
// Get the previous value
const char *oldVal = pb->GetStr(fPBEditID);
if (!oldVal)
oldVal = "";
// Get the text from the edit and store it in the paramblock
int len = GetWindowTextLength(hCtrl)+1;
if (len > 1)
{
char *buf = TRACKED_NEW char[len];
GetWindowText(hCtrl, buf, len);
// If the old value is different from the current one, update
if (strcmp(oldVal, buf))
pb->SetValue(fPBEditID, 0, buf);
delete [] buf;
}
else
{
// If the old value wasn't empty, update
if (*oldVal != '\0')
pb->SetValue(fPBEditID, 0, "");
}
}
public:
plClothingEditBox(int ctrlID, int pbEditID) : fCtrlID(ctrlID), fPBEditID(pbEditID) {}
void UpdateText(IParamBlock2 *pb, HWND hWnd)
{
const char *str = pb->GetStr(fPBEditID);
SetDlgItemText(hWnd, fCtrlID, (str != nil ? str : ""));
}
BOOL ProcessMsg(IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
// If this isn't a message we process, return
if (!(msg == WM_INITDIALOG || msg == WM_DESTROY ||
(msg == WM_COMMAND && LOWORD(wParam) == fCtrlID)))
return FALSE;
IParamBlock2 *pb = map->GetParamBlock();
// Initializing the dialog, set the text box
if (msg == WM_INITDIALOG)
{
UpdateText(pb, hWnd);
return FALSE;
}
// Being destroyed, but we may not have gotten the text from the edit box
// (EN_KILLFOCUS seems to be sent after the window isn't recieving any more messages)
if (msg == WM_DESTROY)
{
IGetText(pb, GetDlgItem(hWnd, fCtrlID));
return FALSE;
}
int notification = HIWORD(wParam);
HWND hCtrl = (HWND)lParam;
// Disable Max accelerators when the edit box gets focus
if (notification == EN_SETFOCUS)
{
//plMaxAccelerators::Disable();
DisableAccelerators();
return TRUE;
}
// The edit control is losing focus, get it's contents
else if (notification == EN_KILLFOCUS)
{
IGetText(pb, hCtrl);
//plMaxAccelerators::Enable();
EnableAccelerators();
return TRUE;
}
return FALSE;
}
};
class ClothingBasicDlgProc;
extern ClothingBasicDlgProc gClothingBasicDlgProc;
static ParamBlockDesc2 gClothingMtlPB
(
plClothingMtl::kBlkBasic, _T("Clothing"), IDS_PASS_BASIC, GetClothingMtlDesc(),
P_AUTO_CONSTRUCT + P_AUTO_UI + P_CALLSETS_ON_LOAD, plClothingMtl::kRefBasic,
// UI
IDD_CLOTHING, IDS_PASS_BASIC, 0, 0, &gClothingBasicDlgProc,
plClothingMtl::kTileset, _T("tileset"), TYPE_INT, 0, 0,
p_default, 0,
end,
plClothingMtl::kTexmap, _T("texmap"), TYPE_TEXMAP_TAB, plClothingMtl::kMaxTiles, 0, 0,
end,
plClothingMtl::kDescription, _T("ItemDescription"), TYPE_STRING, 0, 0,
p_ui, TYPE_EDITBOX, IDC_CLOTHING_DESCRIPTION,
end,
plClothingMtl::kThumbnail, _T("Thumbnail"), TYPE_TEXMAP, 0, 0,
end,
plClothingMtl::kLayer, _T("Layer"), TYPE_INT, 0, 0,
p_default, plClothingElement::kLayerTint1,
end,
plClothingMtl::kTexmapSkin, _T("SkinLayer"), TYPE_TEXMAP_TAB, plClothingMtl::kMaxTiles, 0, 0,
end,
plClothingMtl::kTexmap2, _T("TintLayer2"), TYPE_TEXMAP_TAB, plClothingMtl::kMaxTiles, 0, 0,
end,
plClothingMtl::kDefault, _T("Default"), TYPE_BOOL, 0, 0,
p_ui, TYPE_SINGLECHEKBOX, IDC_CLOTHING_DEFAULT,
p_default, 0,
end,
plClothingMtl::kCustomTextSpecs, _T("TextSpecs"), TYPE_STRING, 0, 0,
end,
plClothingMtl::kTexmapBase, _T("BaseLayer"), TYPE_TEXMAP_TAB, plClothingMtl::kMaxTiles, 0, 0,
end,
plClothingMtl::kTexmapSkinBlend1, _T("SkinBlend(1)"), TYPE_TEXMAP_TAB, plClothingMtl::kMaxTiles, 0, 0,
end,
plClothingMtl::kTexmapSkinBlend2, _T("SkinBlend(2)"), TYPE_TEXMAP_TAB, plClothingMtl::kMaxTiles, 0, 0,
end,
plClothingMtl::kTexmapSkinBlend3, _T("SkinBlend(3)"), TYPE_TEXMAP_TAB, plClothingMtl::kMaxTiles, 0, 0,
end,
plClothingMtl::kTexmapSkinBlend4, _T("SkinBlend(4)"), TYPE_TEXMAP_TAB, plClothingMtl::kMaxTiles, 0, 0,
end,
plClothingMtl::kTexmapSkinBlend5, _T("SkinBlend(5)"), TYPE_TEXMAP_TAB, plClothingMtl::kMaxTiles, 0, 0,
end,
plClothingMtl::kTexmapSkinBlend6, _T("SkinBlend(6)"), TYPE_TEXMAP_TAB, plClothingMtl::kMaxTiles, 0, 0,
end,
plClothingMtl::kDefaultTint1, _T("DefaultTint1"), TYPE_RGBA, 0, 0,
p_ui, TYPE_COLORSWATCH, IDC_CLOTHING_TINT1,
p_default, Color(1,1,1),
end,
plClothingMtl::kDefaultTint2, _T("DefaultTint2"), TYPE_RGBA, 0, 0,
p_ui, TYPE_COLORSWATCH, IDC_CLOTHING_TINT2,
p_default, Color(1,1,1),
end,
plClothingMtl::kForcedAcc, _T("ForcedAcc"), TYPE_STRING, 0, 0,
p_ui, TYPE_EDITBOX, IDC_CLOTHING_FORCED_ACC,
end,
end
);
class ClothingBasicDlgProc : public ParamMap2UserDlgProc
{
protected:
plClothingEditBox fCustomText;
public:
ClothingBasicDlgProc() : fCustomText(IDC_CLOTHING_CUSTOM_TEXT_SPECS, plClothingMtl::kCustomTextSpecs) {}
~ClothingBasicDlgProc() {}
void UpdateDisplay(IParamMap2 *pmap)
{
HWND hWnd = pmap->GetHWnd();
IParamBlock2 *pb = pmap->GetParamBlock();
plClothingMtl *mtl = (plClothingMtl *)pb->GetOwner();
HWND cbox = NULL;
plPlasmaMAXLayer *layer;
PBBitmap *pbbm;
ICustButton *bmSelectBtn;
char buff[256];
// Setup the tiles
int i, j;
int layerSet = pb->GetInt(ParamID(plClothingMtl::kLayer));
int layerIdx = plClothingMtl::LayerToPBIdx[layerSet];
for (j = 0; j < plClothingMtl::kMaxTiles; j++)
{
layer = (plPlasmaMAXLayer *)pb->GetTexmap(ParamID(layerIdx), 0, j);
pbbm = (layer == nil ? nil : layer->GetPBBitmap());
bmSelectBtn = GetICustButton(GetDlgItem(hWnd, plClothingMtl::ButtonConstants[j]));
bmSelectBtn->SetText(pbbm ? (TCHAR*)pbbm->bi.Filename() : "(none)");
ReleaseICustButton(bmSelectBtn);
}
// And the thumbnail...
layer = (plPlasmaMAXLayer *)pb->GetTexmap(ParamID(plClothingMtl::kThumbnail));
if (layer == nil)
{
layer = TRACKED_NEW plLayerTex;
pb->SetValue(ParamID(plClothingMtl::kThumbnail), 0, layer);
}
pbbm = layer->GetPBBitmap();
if (pbbm)
{
bmSelectBtn = GetICustButton(GetDlgItem(hWnd, IDC_CLOTHING_THUMBNAIL));
bmSelectBtn->SetText((TCHAR*)pbbm->bi.Filename());
ReleaseICustButton(bmSelectBtn);
}
int setIdx = pb->GetInt(ParamID(plClothingMtl::kTileset));
ComboBox_SetCurSel(GetDlgItem(hWnd, IDC_CLOTHING_TILESET), setIdx);
ComboBox_SetCurSel(GetDlgItem(hWnd, IDC_CLOTHING_LAYER), pb->GetInt(ParamID(plClothingMtl::kLayer)));
mtl->InitTilesets();
plClothingTileset *tileset = mtl->fTilesets.Get(setIdx);
for (i = 0; i < tileset->fElements.GetCount(); i++)
{
plClothingElement *element = tileset->fElements.Get(i);
SendMessage(GetDlgItem(hWnd, plClothingMtl::TextConstants[2 * i]),
WM_SETTEXT, NULL, (LPARAM)element->fName);
sprintf(buff, "(%d, %d)", element->fWidth, element->fHeight);
SendMessage(GetDlgItem(hWnd, plClothingMtl::TextConstants[2 * i + 1]),
WM_SETTEXT, NULL, (LPARAM)buff);
ShowWindow(GetDlgItem(hWnd, plClothingMtl::TextConstants[2 * i]), SW_SHOW);
ShowWindow(GetDlgItem(hWnd, plClothingMtl::TextConstants[2 * i + 1]), SW_SHOW);
ShowWindow(GetDlgItem(hWnd, plClothingMtl::ButtonConstants[i]), SW_SHOW);
}
for (i = tileset->fElements.GetCount(); i < plClothingMtl::kMaxTiles; i++)
{
ShowWindow(GetDlgItem(hWnd, plClothingMtl::TextConstants[2 * i]), SW_HIDE);
ShowWindow(GetDlgItem(hWnd, plClothingMtl::TextConstants[2 * i + 1]), SW_HIDE);
ShowWindow(GetDlgItem(hWnd, plClothingMtl::ButtonConstants[i]), SW_HIDE);
}
mtl->ReleaseTilesets();
fCustomText.UpdateText(pb, hWnd);
}
virtual void Update(TimeValue t, Interval& valid, IParamMap2* pmap) { UpdateDisplay(pmap); }
BOOL DlgProc(TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
// Check if it is for our edit box
if (fCustomText.ProcessMsg(map, hWnd, msg, wParam, lParam))
return TRUE;
int id = LOWORD(wParam);
int code = HIWORD(wParam);
IParamBlock2 *pb = map->GetParamBlock();
plClothingMtl *mtl = (plClothingMtl *)pb->GetOwner();
HWND cbox = NULL;
plPlasmaMAXLayer *layer;
PBBitmap *pbbm;
ICustButton *bmSelectBtn;
int layerIdx = plClothingMtl::LayerToPBIdx[pb->GetInt(ParamID(plClothingMtl::kLayer))];
switch (msg)
{
case WM_INITDIALOG:
int j;
mtl->InitTilesets();
cbox = GetDlgItem(hWnd, IDC_CLOTHING_TILESET);
for (j = 0; j < mtl->fTilesets.GetCount(); j++)
SendMessage(cbox, CB_ADDSTRING, 0, (LPARAM)mtl->fTilesets.Get(j)->fName);
mtl->ReleaseTilesets();
cbox = GetDlgItem(hWnd, IDC_CLOTHING_LAYER);
for (j = 0; j < plClothingElement::kLayerMax; j++)
ComboBox_AddString(cbox, plClothingMtl::LayerStrings[j]);
return TRUE;
case WM_COMMAND:
if (id == IDC_CLOTHING_TILESET)
{
int setIdx = SendMessage(GetDlgItem(hWnd, id), CB_GETCURSEL, 0, 0);
pb->SetValue(plClothingMtl::kTileset, t, setIdx);
return TRUE;
}
if (id == IDC_CLOTHING_LAYER)
{
pb->SetValue(plClothingMtl::kLayer, t, ComboBox_GetCurSel(GetDlgItem(hWnd, id)));
return TRUE;
}
if (id == IDC_CLOTHING_THUMBNAIL)
{
layer = (plPlasmaMAXLayer *)pb->GetTexmap(ParamID(plClothingMtl::kThumbnail));
if (layer == nil)
return FALSE;
BitmapInfo bi;
bi.SetName(layer->GetPBBitmap() == nil ? "" : layer->GetPBBitmap()->bi.Name());
BOOL selectedNewBitmap = layer->HandleBitmapSelection();
if (selectedNewBitmap)
{
pbbm = layer->GetPBBitmap();
bmSelectBtn = GetICustButton(GetDlgItem(hWnd, IDC_CLOTHING_THUMBNAIL));
bmSelectBtn->SetText(pbbm != nil ? (TCHAR*)pbbm->bi.Filename() : "(none)");
ReleaseICustButton(bmSelectBtn);
}
return TRUE;
}
int buttonIdx = -1;
if (id == IDC_CLOTHING_TEXTURE1) buttonIdx = 0;
else if (id == IDC_CLOTHING_TEXTURE2) buttonIdx = 1;
else if (id == IDC_CLOTHING_TEXTURE3) buttonIdx = 2;
else if (id == IDC_CLOTHING_TEXTURE4) buttonIdx = 3;
if (buttonIdx != -1)
{
layer = (plPlasmaMAXLayer *)pb->GetTexmap(ParamID(layerIdx), 0, buttonIdx);
if (layer == nil)
{ // First time we've set a layer on this spot
layer = TRACKED_NEW plLayerTex;
pb->SetValue(ParamID(layerIdx), 0, layer, buttonIdx);
}
jvUniqueId oldId;
layer->GetBitmapAssetId(oldId);
BitmapInfo bi;
bi.SetName(layer->GetPBBitmap() == nil ? "" : layer->GetPBBitmap()->bi.Name());
BOOL selectedNewBitmap = layer->HandleBitmapSelection();
if (selectedNewBitmap)
{
// Check if it's ok, and undo if not.
hsBool choiceOk = true;
pbbm = layer->GetPBBitmap();
if (pbbm != nil)
{
mtl->InitTilesets();
plClothingTileset *tileset = mtl->fTilesets.Get(pb->GetInt(plClothingMtl::kTileset));
plClothingElement *element = tileset->fElements.Get(buttonIdx);
float targRatio = (float)element->fWidth / (float)element->fHeight;
float ratio = (float)pbbm->bi.Width() / (float)pbbm->bi.Height();
if (targRatio != ratio)
{
choiceOk = false;
hsMessageBox("That image's width/height ratio does not match the one for this tile. "
"Restoring the old selection.", "Invalid image", hsMessageBoxNormal);
}
else if (pbbm->bi.Width() < element->fWidth)
{
choiceOk = false;
hsMessageBox("The chosen image is too small for that tile slot. "
"Restoring the old selection.", "Invalid image", hsMessageBoxNormal);
}
mtl->ReleaseTilesets();
}
if (!choiceOk)
{
layer->SetBitmapAssetId(oldId);
layer->SetBitmap(&bi);
}
else
{
bmSelectBtn = GetICustButton(GetDlgItem(hWnd, plClothingMtl::ButtonConstants[buttonIdx]));
bmSelectBtn->SetText(pbbm != nil ? (TCHAR*)pbbm->bi.Filename() : "(none)");
ReleaseICustButton(bmSelectBtn);
}
}
}
return TRUE;
}
return FALSE;
}
void DeleteThis() {}
};
static ClothingBasicDlgProc gClothingBasicDlgProc;

File diff suppressed because it is too large Load Diff

View File

@ -1,154 +1,154 @@
/*==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/>.
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 __PLCOMPMTL__H
#define __PLCOMPMTL__H
#include "Max.h"
#include "../resource.h"
#include "istdplug.h"
#include "iparamb2.h"
#include "iparamm2.h"
extern TCHAR *GetString(int id);
extern HINSTANCE hInstance;
#define COMP_MTL_CLASS_ID Class_ID(0x237c422d, 0x64ab6371)
class plCompositeMtlDlg;
class plCompositeMtl : public Mtl
{
protected:
IParamBlock2 *fPassesPB;
Interval fIValid;
plCompositeMtlDlg *fMtlDlg;
public:
enum
{
kCompPasses,
kCompOn,
kCompBlend,
kCompUVChannels,
kCompLayerCounts
};
// Make sure to pair up each blend mode with an inverse after it
// (This way we check for an inverse blend by doing an odd/even check.)
enum BlendMethod // These should match up in order with the blend strings
{
kCompBlendVertexAlpha,
kCompBlendInverseVtxAlpha,
kCompBlendVertexIllumRed,
kCompBlendInverseVtxIllumRed,
kCompBlendVertexIllumGreen,
kCompBlendInverseVtxIllumGreen,
kCompBlendVertexIllumBlue,
kCompBlendInverseVtxIllumBlue,
kCompNumBlendMethods
};
static const char *BlendStrings[];
enum { kRefPasses };
enum { kBlkPasses };
ParamDlg *CreateParamDlg(HWND hwMtlEdit, IMtlParams *imp);
void Update(TimeValue t, Interval& valid);
Interval Validity(TimeValue t);
void Reset();
void NotifyChanged();
// From MtlBase and Mtl
void SetAmbient(Color c, TimeValue t);
void SetDiffuse(Color c, TimeValue t);
void SetSpecular(Color c, TimeValue t);
void SetShininess(float v, TimeValue t);
Color GetAmbient(int mtlNum=0, BOOL backFace=FALSE);
Color GetDiffuse(int mtlNum=0, BOOL backFace=FALSE);
Color GetSpecular(int mtlNum=0, BOOL backFace=FALSE);
float GetXParency(int mtlNum=0, BOOL backFace=FALSE);
float GetShininess(int mtlNum=0, BOOL backFace=FALSE);
float GetShinStr(int mtlNum=0, BOOL backFace=FALSE);
float WireSize(int mtlNum=0, BOOL backFace=FALSE);
// Shade and displacement calculation
void Shade(ShadeContext& sc);
float EvalDisplacement(ShadeContext& sc);
Interval DisplacementValidity(TimeValue t);
// SubTexmap access methods
int NumSubMtls();
Mtl* GetSubMtl(int i);
void SetSubMtl(int i, Mtl *m);
TSTR GetSubMtlSlotName(int i);
TSTR GetSubMtlTVName(int i);
BOOL SetDlgThing(ParamDlg* dlg);
plCompositeMtl(BOOL loading);
// Loading/Saving
IOResult Load(ILoad *iload);
IOResult Save(ISave *isave);
//From Animatable
Class_ID ClassID() { return COMP_MTL_CLASS_ID; }
SClass_ID SuperClassID() { return MATERIAL_CLASS_ID; }
void GetClassName(TSTR& s) { s = GetString(IDS_COMP_MTL); }
RefTargetHandle Clone(RemapDir &remap);
RefResult NotifyRefChanged(Interval changeInt, RefTargetHandle hTarget,
PartID& partID, RefMessage message);
int NumSubs();
Animatable* SubAnim(int i);
TSTR SubAnimName(int i);
int NumRefs();
RefTargetHandle GetReference(int i);
void SetReference(int i, RefTargetHandle rtarg);
int NumParamBlocks();
IParamBlock2* GetParamBlock(int i);
IParamBlock2* GetParamBlockByID(BlockID id);
void DeleteThis() { delete this; }
void SetParamDlg(ParamDlg *dlg);
int ComputeMaterialIndex(float opac[][2], int vertCount);
int GetBlendStyle(int index);
int CanWriteAlpha();
bool IsInverseBlend(int blend) const { return blend & 1; }
int RemoveInverse(int blend) { return blend - (blend & 1); }
//void SetNumSubMtls(int num);
void SetOpacityVal(float *pt, UVVert *alphas, UVVert *illums, int method);
//DllExport int UVChannelsNeeded(bool makeAlphaLayer);
};
#endif // __PLCOMPMTL__H
/*==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/>.
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 __PLCOMPMTL__H
#define __PLCOMPMTL__H
#include "Max.h"
#include "../resource.h"
#include "istdplug.h"
#include "iparamb2.h"
#include "iparamm2.h"
extern TCHAR *GetString(int id);
extern HINSTANCE hInstance;
#define COMP_MTL_CLASS_ID Class_ID(0x237c422d, 0x64ab6371)
class plCompositeMtlDlg;
class plCompositeMtl : public Mtl
{
protected:
IParamBlock2 *fPassesPB;
Interval fIValid;
plCompositeMtlDlg *fMtlDlg;
public:
enum
{
kCompPasses,
kCompOn,
kCompBlend,
kCompUVChannels,
kCompLayerCounts
};
// Make sure to pair up each blend mode with an inverse after it
// (This way we check for an inverse blend by doing an odd/even check.)
enum BlendMethod // These should match up in order with the blend strings
{
kCompBlendVertexAlpha,
kCompBlendInverseVtxAlpha,
kCompBlendVertexIllumRed,
kCompBlendInverseVtxIllumRed,
kCompBlendVertexIllumGreen,
kCompBlendInverseVtxIllumGreen,
kCompBlendVertexIllumBlue,
kCompBlendInverseVtxIllumBlue,
kCompNumBlendMethods
};
static const char *BlendStrings[];
enum { kRefPasses };
enum { kBlkPasses };
ParamDlg *CreateParamDlg(HWND hwMtlEdit, IMtlParams *imp);
void Update(TimeValue t, Interval& valid);
Interval Validity(TimeValue t);
void Reset();
void NotifyChanged();
// From MtlBase and Mtl
void SetAmbient(Color c, TimeValue t);
void SetDiffuse(Color c, TimeValue t);
void SetSpecular(Color c, TimeValue t);
void SetShininess(float v, TimeValue t);
Color GetAmbient(int mtlNum=0, BOOL backFace=FALSE);
Color GetDiffuse(int mtlNum=0, BOOL backFace=FALSE);
Color GetSpecular(int mtlNum=0, BOOL backFace=FALSE);
float GetXParency(int mtlNum=0, BOOL backFace=FALSE);
float GetShininess(int mtlNum=0, BOOL backFace=FALSE);
float GetShinStr(int mtlNum=0, BOOL backFace=FALSE);
float WireSize(int mtlNum=0, BOOL backFace=FALSE);
// Shade and displacement calculation
void Shade(ShadeContext& sc);
float EvalDisplacement(ShadeContext& sc);
Interval DisplacementValidity(TimeValue t);
// SubTexmap access methods
int NumSubMtls();
Mtl* GetSubMtl(int i);
void SetSubMtl(int i, Mtl *m);
TSTR GetSubMtlSlotName(int i);
TSTR GetSubMtlTVName(int i);
BOOL SetDlgThing(ParamDlg* dlg);
plCompositeMtl(BOOL loading);
// Loading/Saving
IOResult Load(ILoad *iload);
IOResult Save(ISave *isave);
//From Animatable
Class_ID ClassID() { return COMP_MTL_CLASS_ID; }
SClass_ID SuperClassID() { return MATERIAL_CLASS_ID; }
void GetClassName(TSTR& s) { s = GetString(IDS_COMP_MTL); }
RefTargetHandle Clone(RemapDir &remap);
RefResult NotifyRefChanged(Interval changeInt, RefTargetHandle hTarget,
PartID& partID, RefMessage message);
int NumSubs();
Animatable* SubAnim(int i);
TSTR SubAnimName(int i);
int NumRefs();
RefTargetHandle GetReference(int i);
void SetReference(int i, RefTargetHandle rtarg);
int NumParamBlocks();
IParamBlock2* GetParamBlock(int i);
IParamBlock2* GetParamBlockByID(BlockID id);
void DeleteThis() { delete this; }
void SetParamDlg(ParamDlg *dlg);
int ComputeMaterialIndex(float opac[][2], int vertCount);
int GetBlendStyle(int index);
int CanWriteAlpha();
bool IsInverseBlend(int blend) const { return blend & 1; }
int RemoveInverse(int blend) { return blend - (blend & 1); }
//void SetNumSubMtls(int num);
void SetOpacityVal(float *pt, UVVert *alphas, UVVert *illums, int method);
//DllExport int UVChannelsNeeded(bool makeAlphaLayer);
};
#endif // __PLCOMPMTL__H

View File

@ -1,277 +1,277 @@
/*==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/>.
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 "hsTypes.h"
#include "max.h"
#include "MaxIcon.h"
#include "resource.h"
#include "plCompositeMtl.h"
//#include "plCompositeMtlPB.h"
//#include "plMaxLayer.h"
#include "plCompositeMtlDlg.h"
struct LayerID
{
int layerID;
int activeID;
int blendID;
};
static LayerID kLayerID[] =
{
{ IDC_TEX1, 0, 0 },
{ IDC_TEX2, IDC_TEXON2, IDC_COMBO2 },
{ IDC_TEX3, IDC_TEXON3, IDC_COMBO3 }
};
//-----------------------------------------------------------------------------
// Constructor and destructor
//-----------------------------------------------------------------------------
plCompositeMtlDlg::plCompositeMtlDlg(HWND hwMtlEdit, IMtlParams *imp, plCompositeMtl *m)
{
fDADMgr.Init(this);
fhMtlEdit = hwMtlEdit;
fhRollup = NULL;
fMtl = m;
fPBlock = fMtl->GetParamBlockByID(plCompositeMtl::kBlkPasses);
ip = imp;
valid = FALSE;
for (int i = 0; i < NSUBMTLS; i++)
fLayerBtns[i] = NULL;
curTime = imp->GetTime();
fhRollup = ip->AddRollupPage(
hInstance,
MAKEINTRESOURCE(IDD_COMPOSITE),
ForwardProc,
"Composite Parameters",
(LPARAM)this);
}
plCompositeMtlDlg::~plCompositeMtlDlg()
{
fMtl->SetParamDlg(NULL);
for (int i = 0; i < NSUBMTLS; i++)
{
ReleaseICustButton(fLayerBtns[i]);
fLayerBtns[i] = NULL;
}
SetWindowLong(fhRollup, GWL_USERDATA, NULL);
ip->DeleteRollupPage(fhRollup);
fhRollup = NULL;
}
//-----------------------------------------------------------------------------
// Functions inheirited from ParamDlg
//-----------------------------------------------------------------------------
void plCompositeMtlDlg::SetThing(ReferenceTarget *m)
{
assert(m->SuperClassID() == MATERIAL_CLASS_ID);
assert(m->ClassID() == COMP_MTL_CLASS_ID);
// Bad?
if (fMtl)
fMtl->SetParamDlg(NULL);
fMtl = (plCompositeMtl *)m;
if (fMtl)
fMtl->SetParamDlg(this);
LoadDialog();
IUpdateMtlDisplay();
}
void plCompositeMtlDlg::SetTime(TimeValue t)
{
if (t != curTime)
{
curTime = t;
Interval v;
fMtl->Update(ip->GetTime(),v);
LoadDialog();
IUpdateMtlDisplay();
}
}
void plCompositeMtlDlg::ReloadDialog()
{
Interval v;
fMtl->Update(ip->GetTime(), v);
LoadDialog();
}
void plCompositeMtlDlg::ActivateDlg(BOOL onOff)
{
}
int plCompositeMtlDlg::FindSubMtlFromHWND(HWND hwnd)
{
for (int i = 0; i < NSUBMTLS; i++)
{
if (hwnd == fLayerBtns[i]->GetHwnd())
return i;
}
return -1;
}
BOOL plCompositeMtlDlg::ForwardProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
plCompositeMtlDlg *theDlg;
if (msg == WM_INITDIALOG)
{
theDlg = (plCompositeMtlDlg*)lParam;
theDlg->fhRollup = hDlg;
SetWindowLong(hDlg, GWL_USERDATA, lParam);
}
else
{
if ((theDlg = (plCompositeMtlDlg *)GetWindowLong(hDlg, GWL_USERDATA)) == NULL)
return FALSE;
}
return theDlg->LayerPanelProc(hDlg,msg,wParam,lParam);
}
//----------------------------------------------------------------------------
// Layer panel processor
//----------------------------------------------------------------------------
BOOL plCompositeMtlDlg::LayerPanelProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
int id = LOWORD(wParam);
int code = HIWORD(wParam);
int i;
switch (msg)
{
case WM_INITDIALOG:
{
for (i = 0; i < NSUBMTLS; i++)
{
fLayerBtns[i] = GetICustButton(GetDlgItem(hDlg, kLayerID[i].layerID));
fLayerBtns[i]->SetDADMgr(&fDADMgr);
if (i > 0) // the first material doesn't get one, nyah nyah!
{
HWND cbox = NULL;
int j;
for (j = 0; j < plCompositeMtl::kCompNumBlendMethods; j++)
{
cbox = GetDlgItem(hDlg, kLayerID[i].blendID);
SendMessage(cbox, CB_ADDSTRING, 0, (LPARAM)plCompositeMtl::BlendStrings[j]);
}
SendMessage(cbox, CB_SETCURSEL, 0, 0);
}
}
// TEMP testing
UpdateLayerDisplay();
IUpdateMtlDisplay();
}
return TRUE;
case WM_DESTROY:
for (i = 0; i < NSUBMTLS; i++)
{
ReleaseICustButton(fLayerBtns[i]);
fLayerBtns[i] = NULL;
}
break;
case WM_COMMAND:
{
for (i = 0; i < NSUBMTLS; i++)
{
if (id == kLayerID[i].activeID)
{
bool checked = SendMessage(GetDlgItem(hDlg, id), BM_GETCHECK, 0, 0) == BST_CHECKED;
fPBlock->SetValue(plCompositeMtl::kCompOn, curTime, checked, i - 1);
return TRUE;
}
if (id == kLayerID[i].layerID)
{
PostMessage(fhMtlEdit, WM_SUB_MTL_BUTTON, i, (LPARAM)fMtl);
return TRUE;
}
if (id == kLayerID[i].blendID)
{
fPBlock->SetValue(plCompositeMtl::kCompBlend, curTime, SendMessage(GetDlgItem(hDlg, id), CB_GETCURSEL, 0, 0), i - 1);
return TRUE;
}
}
}
// IUpdateMtlDisplay();
break;
}
return FALSE;
}
void plCompositeMtlDlg::UpdateLayerDisplay()
{
int i;
for (i = 0; i < NSUBMTLS; i++)
{
Mtl *m = fPBlock->GetMtl(plCompositeMtl::kCompPasses, curTime, i);
TSTR nm;
if (m)
nm = m->GetName();
else
nm = "None";
fLayerBtns[i]->SetText(nm.data());
ShowWindow(GetDlgItem(fhRollup, kLayerID[i].layerID), SW_SHOW);
ShowWindow(GetDlgItem(fhRollup, kLayerID[i].activeID), SW_SHOW);
if (i > 0)
{
int check = (fPBlock->GetInt(plCompositeMtl::kCompOn, curTime, i - 1) == 0 ? BST_UNCHECKED : BST_CHECKED);
SendMessage(GetDlgItem(fhRollup, kLayerID[i].activeID), BM_SETCHECK, (WPARAM)check, 0);
int selection = fPBlock->GetInt(plCompositeMtl::kCompBlend, curTime, i - 1);
SendMessage(GetDlgItem(fhRollup, kLayerID[i].blendID), CB_SETCURSEL, (WPARAM)selection, 0);
}
}
}
void plCompositeMtlDlg::LoadDialog()
{
if (fMtl)
{
fPBlock = fMtl->GetParamBlockByID(plCompositeMtl::kBlkPasses);
if (fhRollup)
UpdateLayerDisplay();
}
}
/*==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/>.
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 "hsTypes.h"
#include "max.h"
#include "MaxIcon.h"
#include "resource.h"
#include "plCompositeMtl.h"
//#include "plCompositeMtlPB.h"
//#include "plMaxLayer.h"
#include "plCompositeMtlDlg.h"
struct LayerID
{
int layerID;
int activeID;
int blendID;
};
static LayerID kLayerID[] =
{
{ IDC_TEX1, 0, 0 },
{ IDC_TEX2, IDC_TEXON2, IDC_COMBO2 },
{ IDC_TEX3, IDC_TEXON3, IDC_COMBO3 }
};
//-----------------------------------------------------------------------------
// Constructor and destructor
//-----------------------------------------------------------------------------
plCompositeMtlDlg::plCompositeMtlDlg(HWND hwMtlEdit, IMtlParams *imp, plCompositeMtl *m)
{
fDADMgr.Init(this);
fhMtlEdit = hwMtlEdit;
fhRollup = NULL;
fMtl = m;
fPBlock = fMtl->GetParamBlockByID(plCompositeMtl::kBlkPasses);
ip = imp;
valid = FALSE;
for (int i = 0; i < NSUBMTLS; i++)
fLayerBtns[i] = NULL;
curTime = imp->GetTime();
fhRollup = ip->AddRollupPage(
hInstance,
MAKEINTRESOURCE(IDD_COMPOSITE),
ForwardProc,
"Composite Parameters",
(LPARAM)this);
}
plCompositeMtlDlg::~plCompositeMtlDlg()
{
fMtl->SetParamDlg(NULL);
for (int i = 0; i < NSUBMTLS; i++)
{
ReleaseICustButton(fLayerBtns[i]);
fLayerBtns[i] = NULL;
}
SetWindowLong(fhRollup, GWL_USERDATA, NULL);
ip->DeleteRollupPage(fhRollup);
fhRollup = NULL;
}
//-----------------------------------------------------------------------------
// Functions inheirited from ParamDlg
//-----------------------------------------------------------------------------
void plCompositeMtlDlg::SetThing(ReferenceTarget *m)
{
assert(m->SuperClassID() == MATERIAL_CLASS_ID);
assert(m->ClassID() == COMP_MTL_CLASS_ID);
// Bad?
if (fMtl)
fMtl->SetParamDlg(NULL);
fMtl = (plCompositeMtl *)m;
if (fMtl)
fMtl->SetParamDlg(this);
LoadDialog();
IUpdateMtlDisplay();
}
void plCompositeMtlDlg::SetTime(TimeValue t)
{
if (t != curTime)
{
curTime = t;
Interval v;
fMtl->Update(ip->GetTime(),v);
LoadDialog();
IUpdateMtlDisplay();
}
}
void plCompositeMtlDlg::ReloadDialog()
{
Interval v;
fMtl->Update(ip->GetTime(), v);
LoadDialog();
}
void plCompositeMtlDlg::ActivateDlg(BOOL onOff)
{
}
int plCompositeMtlDlg::FindSubMtlFromHWND(HWND hwnd)
{
for (int i = 0; i < NSUBMTLS; i++)
{
if (hwnd == fLayerBtns[i]->GetHwnd())
return i;
}
return -1;
}
BOOL plCompositeMtlDlg::ForwardProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
plCompositeMtlDlg *theDlg;
if (msg == WM_INITDIALOG)
{
theDlg = (plCompositeMtlDlg*)lParam;
theDlg->fhRollup = hDlg;
SetWindowLong(hDlg, GWL_USERDATA, lParam);
}
else
{
if ((theDlg = (plCompositeMtlDlg *)GetWindowLong(hDlg, GWL_USERDATA)) == NULL)
return FALSE;
}
return theDlg->LayerPanelProc(hDlg,msg,wParam,lParam);
}
//----------------------------------------------------------------------------
// Layer panel processor
//----------------------------------------------------------------------------
BOOL plCompositeMtlDlg::LayerPanelProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
int id = LOWORD(wParam);
int code = HIWORD(wParam);
int i;
switch (msg)
{
case WM_INITDIALOG:
{
for (i = 0; i < NSUBMTLS; i++)
{
fLayerBtns[i] = GetICustButton(GetDlgItem(hDlg, kLayerID[i].layerID));
fLayerBtns[i]->SetDADMgr(&fDADMgr);
if (i > 0) // the first material doesn't get one, nyah nyah!
{
HWND cbox = NULL;
int j;
for (j = 0; j < plCompositeMtl::kCompNumBlendMethods; j++)
{
cbox = GetDlgItem(hDlg, kLayerID[i].blendID);
SendMessage(cbox, CB_ADDSTRING, 0, (LPARAM)plCompositeMtl::BlendStrings[j]);
}
SendMessage(cbox, CB_SETCURSEL, 0, 0);
}
}
// TEMP testing
UpdateLayerDisplay();
IUpdateMtlDisplay();
}
return TRUE;
case WM_DESTROY:
for (i = 0; i < NSUBMTLS; i++)
{
ReleaseICustButton(fLayerBtns[i]);
fLayerBtns[i] = NULL;
}
break;
case WM_COMMAND:
{
for (i = 0; i < NSUBMTLS; i++)
{
if (id == kLayerID[i].activeID)
{
bool checked = SendMessage(GetDlgItem(hDlg, id), BM_GETCHECK, 0, 0) == BST_CHECKED;
fPBlock->SetValue(plCompositeMtl::kCompOn, curTime, checked, i - 1);
return TRUE;
}
if (id == kLayerID[i].layerID)
{
PostMessage(fhMtlEdit, WM_SUB_MTL_BUTTON, i, (LPARAM)fMtl);
return TRUE;
}
if (id == kLayerID[i].blendID)
{
fPBlock->SetValue(plCompositeMtl::kCompBlend, curTime, SendMessage(GetDlgItem(hDlg, id), CB_GETCURSEL, 0, 0), i - 1);
return TRUE;
}
}
}
// IUpdateMtlDisplay();
break;
}
return FALSE;
}
void plCompositeMtlDlg::UpdateLayerDisplay()
{
int i;
for (i = 0; i < NSUBMTLS; i++)
{
Mtl *m = fPBlock->GetMtl(plCompositeMtl::kCompPasses, curTime, i);
TSTR nm;
if (m)
nm = m->GetName();
else
nm = "None";
fLayerBtns[i]->SetText(nm.data());
ShowWindow(GetDlgItem(fhRollup, kLayerID[i].layerID), SW_SHOW);
ShowWindow(GetDlgItem(fhRollup, kLayerID[i].activeID), SW_SHOW);
if (i > 0)
{
int check = (fPBlock->GetInt(plCompositeMtl::kCompOn, curTime, i - 1) == 0 ? BST_UNCHECKED : BST_CHECKED);
SendMessage(GetDlgItem(fhRollup, kLayerID[i].activeID), BM_SETCHECK, (WPARAM)check, 0);
int selection = fPBlock->GetInt(plCompositeMtl::kCompBlend, curTime, i - 1);
SendMessage(GetDlgItem(fhRollup, kLayerID[i].blendID), CB_SETCURSEL, (WPARAM)selection, 0);
}
}
}
void plCompositeMtlDlg::LoadDialog()
{
if (fMtl)
{
fPBlock = fMtl->GetParamBlockByID(plCompositeMtl::kBlkPasses);
if (fhRollup)
UpdateLayerDisplay();
}
}

View File

@ -1,86 +1,86 @@
/*==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/>.
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 PL_COMPMTLDLG_H
#define PL_COMPMTLDLG_H
#define NSUBMTLS 3
class plCompositeMtlDlg : public ParamDlg
{
protected:
IParamBlock2 *fPBlock;
HWND fhMtlEdit; // Window handle of the materials editor dialog
HWND fhRollup; // Our rollup panel
IMtlParams *ip;
plCompositeMtl *fMtl; // current mtl being edited.
TimeValue curTime;
int isActive;
BOOL valid;
// int offset;
ICustButton *fLayerBtns[NSUBMTLS];
MtlDADMgr fDADMgr; // For drag-drop sub-materials
public:
// Constructor and destructor
plCompositeMtlDlg(HWND hwMtlEdit, IMtlParams *imp, plCompositeMtl *m);
~plCompositeMtlDlg();
// Functions inherited from ParamDLg:
Class_ID ClassID() { return COMP_MTL_CLASS_ID; }
void SetThing(ReferenceTarget *m);
ReferenceTarget* GetThing() { return (ReferenceTarget*)fMtl; }
void SetTime(TimeValue t);
void ReloadDialog();
void ActivateDlg(BOOL onOff);
void DeleteThis() { delete this; }
int FindSubMtlFromHWND(HWND hw);
static BOOL CALLBACK ForwardProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam);
BOOL LayerPanelProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
void UpdateLayerDisplay();
void LoadDialog();
/*
// Lower-level crap
void Invalidate(); // Called by ParamMtl
BOOL IsActive() { return isActive; }
private:
void ClampOffset();
void SetNumMats();
void UpdateLayers();
void UpdateControlFor(int np);
void VScroll(int code, short int cpos );
*/
protected:
void IUpdateMtlDisplay() { if (ip) ip->MtlChanged(); }
};
#endif
/*==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/>.
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 PL_COMPMTLDLG_H
#define PL_COMPMTLDLG_H
#define NSUBMTLS 3
class plCompositeMtlDlg : public ParamDlg
{
protected:
IParamBlock2 *fPBlock;
HWND fhMtlEdit; // Window handle of the materials editor dialog
HWND fhRollup; // Our rollup panel
IMtlParams *ip;
plCompositeMtl *fMtl; // current mtl being edited.
TimeValue curTime;
int isActive;
BOOL valid;
// int offset;
ICustButton *fLayerBtns[NSUBMTLS];
MtlDADMgr fDADMgr; // For drag-drop sub-materials
public:
// Constructor and destructor
plCompositeMtlDlg(HWND hwMtlEdit, IMtlParams *imp, plCompositeMtl *m);
~plCompositeMtlDlg();
// Functions inherited from ParamDLg:
Class_ID ClassID() { return COMP_MTL_CLASS_ID; }
void SetThing(ReferenceTarget *m);
ReferenceTarget* GetThing() { return (ReferenceTarget*)fMtl; }
void SetTime(TimeValue t);
void ReloadDialog();
void ActivateDlg(BOOL onOff);
void DeleteThis() { delete this; }
int FindSubMtlFromHWND(HWND hw);
static BOOL CALLBACK ForwardProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam);
BOOL LayerPanelProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
void UpdateLayerDisplay();
void LoadDialog();
/*
// Lower-level crap
void Invalidate(); // Called by ParamMtl
BOOL IsActive() { return isActive; }
private:
void ClampOffset();
void SetNumMats();
void UpdateLayers();
void UpdateControlFor(int np);
void VScroll(int code, short int cpos );
*/
protected:
void IUpdateMtlDisplay() { if (ip) ip->MtlChanged(); }
};
#endif

View File

@ -1,65 +1,65 @@
/*==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/>.
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 PL_COMPOSITE_MTL_PB_H
#define PL_COMPOSITE_MTL_PB_H
enum
{
kCompPasses,
kCompOn,
kCompBlend,
kCompUVChannels,
kCompLayerCounts
};
// Make sure to pair up each blend mode with an inverse after it
// (This way we check for an inverse blend by doing an odd/even check.)
enum BlendMethod // These should match up in order with the blend strings
{
kCompBlendVertexAlpha,
kCompBlendInverseVtxAlpha,
kCompBlendVertexIllumRed,
kCompBlendInverseVtxIllumRed,
kCompBlendVertexIllumGreen,
kCompBlendInverseVtxIllumGreen,
kCompBlendVertexIllumBlue,
kCompBlendInverseVtxIllumBlue,
kCompNumBlendMethods
};
static char *BlendStrings[] = // Make sure these match up in order with the Blend enum
{
"Vertex Alpha",
"Inverse Vtx Alpha",
"Vertex Illum Red",
"Inv. Vtx Illum Red",
"Vertex Illum Green",
"Inv. Vtx Illum Green",
"Vertex Illum Blue",
"Inv. Vtx Illum Blue"
};
/*==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/>.
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 PL_COMPOSITE_MTL_PB_H
#define PL_COMPOSITE_MTL_PB_H
enum
{
kCompPasses,
kCompOn,
kCompBlend,
kCompUVChannels,
kCompLayerCounts
};
// Make sure to pair up each blend mode with an inverse after it
// (This way we check for an inverse blend by doing an odd/even check.)
enum BlendMethod // These should match up in order with the blend strings
{
kCompBlendVertexAlpha,
kCompBlendInverseVtxAlpha,
kCompBlendVertexIllumRed,
kCompBlendInverseVtxIllumRed,
kCompBlendVertexIllumGreen,
kCompBlendInverseVtxIllumGreen,
kCompBlendVertexIllumBlue,
kCompBlendInverseVtxIllumBlue,
kCompNumBlendMethods
};
static char *BlendStrings[] = // Make sure these match up in order with the Blend enum
{
"Vertex Alpha",
"Inverse Vtx Alpha",
"Vertex Illum Red",
"Inv. Vtx Illum Red",
"Vertex Illum Green",
"Inv. Vtx Illum Green",
"Vertex Illum Blue",
"Inv. Vtx Illum Blue"
};
#endif //PL_COMPOSITE_MTL_PB_H

View File

@ -1,51 +1,51 @@
/*==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/>.
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 "plCompositeMtl.h"
//#include "plCompositeMtlPB.h"
ClassDesc2* GetCompMtlDesc();
static ParamBlockDesc2 gCompositeMtlPB
(
plCompositeMtl::kBlkPasses, _T("composite"), 0, GetCompMtlDesc(),
P_AUTO_CONSTRUCT, plCompositeMtl::kRefPasses,
plCompositeMtl::kCompPasses, _T("passes"), TYPE_MTL_TAB, 3, 0, 0,
end,
plCompositeMtl::kCompOn, _T("passOn"), TYPE_BOOL_TAB, 2, 0, 0,
p_default, TRUE,
end,
plCompositeMtl::kCompBlend, _T("BlendMethod"), TYPE_INT_TAB, 2, 0, 0,
p_default, 0,
end,
plCompositeMtl::kCompUVChannels, _T("UVChannels"), TYPE_INT_TAB, 2, 0, 0,
p_default, 0,
end,
plCompositeMtl::kCompLayerCounts, _T("LayerCounts"), TYPE_INT_TAB, 3, 0, 0,
p_default, 0,
end,
end
);
/*==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/>.
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 "plCompositeMtl.h"
//#include "plCompositeMtlPB.h"
ClassDesc2* GetCompMtlDesc();
static ParamBlockDesc2 gCompositeMtlPB
(
plCompositeMtl::kBlkPasses, _T("composite"), 0, GetCompMtlDesc(),
P_AUTO_CONSTRUCT, plCompositeMtl::kRefPasses,
plCompositeMtl::kCompPasses, _T("passes"), TYPE_MTL_TAB, 3, 0, 0,
end,
plCompositeMtl::kCompOn, _T("passOn"), TYPE_BOOL_TAB, 2, 0, 0,
p_default, TRUE,
end,
plCompositeMtl::kCompBlend, _T("BlendMethod"), TYPE_INT_TAB, 2, 0, 0,
p_default, 0,
end,
plCompositeMtl::kCompUVChannels, _T("UVChannels"), TYPE_INT_TAB, 2, 0, 0,
p_default, 0,
end,
plCompositeMtl::kCompLayerCounts, _T("LayerCounts"), TYPE_INT_TAB, 3, 0, 0,
p_default, 0,
end,
end
);

File diff suppressed because it is too large Load Diff

View File

@ -1,193 +1,193 @@
/*==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/>.
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 PL_DECALMTL_H
#define PL_DECALMTL_H
#include "Max.h"
#include "iparamb2.h"
#include "../resource.h"
#include "plPassMtlBase.h"
#define DECAL_MTL_CLASS_ID Class_ID(0x691d2257, 0x419d629e)
extern TCHAR *GetString(int id);
class plDecalMtl : public plPassMtlBase
{
protected:
virtual void ICloneRefs( plPassMtlBase *target, RemapDir &remap );
public:
enum
{
kRefBasic,
kRefLayers,
kRefAdv,
kRefAnim,
};
enum Blocks
{
kBlkBasic,
kBlkLayers,
kBlkAdv,
kBlkAnim,
};
plDecalMtl(BOOL loading);
void DeleteThis() { delete this; }
//From Animatable
Class_ID ClassID() { return DECAL_MTL_CLASS_ID; }
SClass_ID SuperClassID() { return MATERIAL_CLASS_ID; }
void GetClassName(TSTR& s) { s = GetString(IDS_DECAL_MTL); }
ParamDlg *CreateParamDlg(HWND hwMtlEdit, IMtlParams *imp);
void Update(TimeValue t, Interval& valid);
Interval Validity(TimeValue t);
void NotifyChanged();
BOOL SupportsMultiMapsInViewport() { return FALSE; }
void SetupGfxMultiMaps(TimeValue t, Material *mtl, MtlMakerCallback &cb);
// Shade and displacement calculation
void Shade(ShadeContext& sc);
void ShadeWithBackground(ShadeContext &sc, Color background);
float EvalDisplacement(ShadeContext& sc);
Interval DisplacementValidity(TimeValue t);
virtual RefTargetHandle GetReference( int i );
virtual void SetReference( int i, RefTargetHandle rtarg );
// SubTexmap access methods
int NumSubTexmaps();
Texmap* GetSubTexmap(int i);
void SetSubTexmap(int i, Texmap *m);
TSTR GetSubTexmapSlotName(int i);
TSTR GetSubTexmapTVName(int i);
int SubTexmapOn(int i);
BOOL SetDlgThing(ParamDlg* dlg);
RefTargetHandle Clone( RemapDir &remap );
RefResult NotifyRefChanged(Interval changeInt, RefTargetHandle hTarget,
PartID& partID, RefMessage message);
int NumSubs();
Animatable* SubAnim(int i);
TSTR SubAnimName(int i);
int NumParamBlocks();
IParamBlock2* GetParamBlock(int i);
IParamBlock2* GetParamBlockByID(BlockID id);
// void SetParamDlg(ParamDlg *dlg);
// void SetNumSubTexmaps(int num);
// From MtlBase and Mtl
void SetAmbient(Color c, TimeValue t);
void SetDiffuse(Color c, TimeValue t);
void SetSpecular(Color c, TimeValue t);
void SetShininess(float v, TimeValue t);
Color GetAmbient(int mtlNum=0, BOOL backFace=FALSE);
Color GetDiffuse(int mtlNum=0, BOOL backFace=FALSE);
Color GetSpecular(int mtlNum=0, BOOL backFace=FALSE);
float GetXParency(int mtlNum=0, BOOL backFace=FALSE);
float GetShininess(int mtlNum=0, BOOL backFace=FALSE);
float GetShinStr(int mtlNum=0, BOOL backFace=FALSE);
float WireSize(int mtlNum=0, BOOL backFace=FALSE);
ULONG Requirements( int subMtlNum );
virtual bool HasAlpha();
// Massive list of inherited accessor functions for ParamBlock data
// Advanced Block
virtual int GetBasicWire();
virtual int GetMeshOutlines();
virtual int GetTwoSided();
virtual int GetSoftShadow();
virtual int GetNoProj();
virtual int GetVertexShade();
virtual int GetNoShade();
virtual int GetNoFog();
virtual int GetWhite();
virtual int GetZOnly();
virtual int GetZClear();
virtual int GetZNoRead();
virtual int GetZNoWrite();
virtual int GetZInc();
virtual int GetAlphaTestHigh();
// Animation block
virtual char * GetAnimName();
virtual int GetAutoStart();
virtual int GetLoop();
virtual char * GetAnimLoopName();
virtual int GetEaseInType();
virtual float GetEaseInMinLength();
virtual float GetEaseInMaxLength();
virtual float GetEaseInNormLength();
virtual int GetEaseOutType();
virtual float GetEaseOutMinLength();
virtual float GetEaseOutMaxLength();
virtual float GetEaseOutNormLength();
virtual int GetUseGlobal();
virtual char * GetGlobalVarName();
// Basic block
virtual int GetColorLock();
virtual Color GetAmbColor();
virtual Color GetColor();
virtual int GetOpacity();
virtual int GetEmissive();
virtual int GetUseSpec();
virtual int GetShine();
virtual Color GetSpecularColor();
virtual Control *GetPreshadeColorController();
virtual Control *GetAmbColorController();
virtual Control *GetOpacityController();
virtual Control *GetSpecularColorController();
virtual int GetDiffuseColorLock();
virtual Color GetRuntimeColor();
virtual Control *GetRuntimeColorController();
// Layer block
virtual Texmap *GetBaseLayer();
virtual int GetTopLayerOn();
virtual Texmap *GetTopLayer();
virtual int GetLayerBlend();
virtual int GetOutputAlpha();
virtual int GetOutputBlend();
};
/*==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/>.
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 PL_DECALMTL_H
#define PL_DECALMTL_H
#include "Max.h"
#include "iparamb2.h"
#include "../resource.h"
#include "plPassMtlBase.h"
#define DECAL_MTL_CLASS_ID Class_ID(0x691d2257, 0x419d629e)
extern TCHAR *GetString(int id);
class plDecalMtl : public plPassMtlBase
{
protected:
virtual void ICloneRefs( plPassMtlBase *target, RemapDir &remap );
public:
enum
{
kRefBasic,
kRefLayers,
kRefAdv,
kRefAnim,
};
enum Blocks
{
kBlkBasic,
kBlkLayers,
kBlkAdv,
kBlkAnim,
};
plDecalMtl(BOOL loading);
void DeleteThis() { delete this; }
//From Animatable
Class_ID ClassID() { return DECAL_MTL_CLASS_ID; }
SClass_ID SuperClassID() { return MATERIAL_CLASS_ID; }
void GetClassName(TSTR& s) { s = GetString(IDS_DECAL_MTL); }
ParamDlg *CreateParamDlg(HWND hwMtlEdit, IMtlParams *imp);
void Update(TimeValue t, Interval& valid);
Interval Validity(TimeValue t);
void NotifyChanged();
BOOL SupportsMultiMapsInViewport() { return FALSE; }
void SetupGfxMultiMaps(TimeValue t, Material *mtl, MtlMakerCallback &cb);
// Shade and displacement calculation
void Shade(ShadeContext& sc);
void ShadeWithBackground(ShadeContext &sc, Color background);
float EvalDisplacement(ShadeContext& sc);
Interval DisplacementValidity(TimeValue t);
virtual RefTargetHandle GetReference( int i );
virtual void SetReference( int i, RefTargetHandle rtarg );
// SubTexmap access methods
int NumSubTexmaps();
Texmap* GetSubTexmap(int i);
void SetSubTexmap(int i, Texmap *m);
TSTR GetSubTexmapSlotName(int i);
TSTR GetSubTexmapTVName(int i);
int SubTexmapOn(int i);
BOOL SetDlgThing(ParamDlg* dlg);
RefTargetHandle Clone( RemapDir &remap );
RefResult NotifyRefChanged(Interval changeInt, RefTargetHandle hTarget,
PartID& partID, RefMessage message);
int NumSubs();
Animatable* SubAnim(int i);
TSTR SubAnimName(int i);
int NumParamBlocks();
IParamBlock2* GetParamBlock(int i);
IParamBlock2* GetParamBlockByID(BlockID id);
// void SetParamDlg(ParamDlg *dlg);
// void SetNumSubTexmaps(int num);
// From MtlBase and Mtl
void SetAmbient(Color c, TimeValue t);
void SetDiffuse(Color c, TimeValue t);
void SetSpecular(Color c, TimeValue t);
void SetShininess(float v, TimeValue t);
Color GetAmbient(int mtlNum=0, BOOL backFace=FALSE);
Color GetDiffuse(int mtlNum=0, BOOL backFace=FALSE);
Color GetSpecular(int mtlNum=0, BOOL backFace=FALSE);
float GetXParency(int mtlNum=0, BOOL backFace=FALSE);
float GetShininess(int mtlNum=0, BOOL backFace=FALSE);
float GetShinStr(int mtlNum=0, BOOL backFace=FALSE);
float WireSize(int mtlNum=0, BOOL backFace=FALSE);
ULONG Requirements( int subMtlNum );
virtual bool HasAlpha();
// Massive list of inherited accessor functions for ParamBlock data
// Advanced Block
virtual int GetBasicWire();
virtual int GetMeshOutlines();
virtual int GetTwoSided();
virtual int GetSoftShadow();
virtual int GetNoProj();
virtual int GetVertexShade();
virtual int GetNoShade();
virtual int GetNoFog();
virtual int GetWhite();
virtual int GetZOnly();
virtual int GetZClear();
virtual int GetZNoRead();
virtual int GetZNoWrite();
virtual int GetZInc();
virtual int GetAlphaTestHigh();
// Animation block
virtual char * GetAnimName();
virtual int GetAutoStart();
virtual int GetLoop();
virtual char * GetAnimLoopName();
virtual int GetEaseInType();
virtual float GetEaseInMinLength();
virtual float GetEaseInMaxLength();
virtual float GetEaseInNormLength();
virtual int GetEaseOutType();
virtual float GetEaseOutMinLength();
virtual float GetEaseOutMaxLength();
virtual float GetEaseOutNormLength();
virtual int GetUseGlobal();
virtual char * GetGlobalVarName();
// Basic block
virtual int GetColorLock();
virtual Color GetAmbColor();
virtual Color GetColor();
virtual int GetOpacity();
virtual int GetEmissive();
virtual int GetUseSpec();
virtual int GetShine();
virtual Color GetSpecularColor();
virtual Control *GetPreshadeColorController();
virtual Control *GetAmbColorController();
virtual Control *GetOpacityController();
virtual Control *GetSpecularColorController();
virtual int GetDiffuseColorLock();
virtual Color GetRuntimeColor();
virtual Control *GetRuntimeColorController();
// Layer block
virtual Texmap *GetBaseLayer();
virtual int GetTopLayerOn();
virtual Texmap *GetTopLayer();
virtual int GetLayerBlend();
virtual int GetOutputAlpha();
virtual int GetOutputBlend();
};
#endif //PL_DECALMTL_H

View File

@ -1,67 +1,67 @@
/*==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/>.
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 PL_DECALMTLADVPB_H
#define PL_DECALMTLADVPB_H
// Param ID's
enum
{
// Specular
kDecalAdvUseSpec, // Not used anymore, feel free to replace with new fields as necessary
kDecalAdvSpecType, // ditto
kDecalAdvShine, // ...
kDecalAdvShineStr, // ...
// Misc
kDecalAdvWire,
kDecalAdvMeshOutlines,
kDecalAdvTwoSided,
// Shading
kDecalAdvSoftShadow,
kDecalAdvNoProj,
kDecalAdvVertexShade,
kDecalAdvNoShade,
kDecalAdvNoFog,
kDecalAdvWhite,
// Z
kDecalAdvZOnly,
kDecalAdvZClear,
kDecalAdvZNoRead,
kDecalAdvZNoWrite,
kDecalAdvZInc,
};
// Specular types
enum
{
kSpecTypeAlpha,
kSpecTypeColor,
kSpecTypeHighlight
};
/*==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/>.
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 PL_DECALMTLADVPB_H
#define PL_DECALMTLADVPB_H
// Param ID's
enum
{
// Specular
kDecalAdvUseSpec, // Not used anymore, feel free to replace with new fields as necessary
kDecalAdvSpecType, // ditto
kDecalAdvShine, // ...
kDecalAdvShineStr, // ...
// Misc
kDecalAdvWire,
kDecalAdvMeshOutlines,
kDecalAdvTwoSided,
// Shading
kDecalAdvSoftShadow,
kDecalAdvNoProj,
kDecalAdvVertexShade,
kDecalAdvNoShade,
kDecalAdvNoFog,
kDecalAdvWhite,
// Z
kDecalAdvZOnly,
kDecalAdvZClear,
kDecalAdvZNoRead,
kDecalAdvZNoWrite,
kDecalAdvZInc,
};
// Specular types
enum
{
kSpecTypeAlpha,
kSpecTypeColor,
kSpecTypeHighlight
};
#endif //PL_DECALMTLADVPB_H

View File

@ -1,95 +1,95 @@
/*==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/>.
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 "plDecalMtl.h"
#include "plPassBaseParamIDs.h"
using namespace plPassBaseParamIDs;
static ParamBlockDesc2 gDecalAdvPB
(
plDecalMtl::kBlkAdv, _T("advanced"), IDS_PASS_ADV, GetDecalMtlDesc(),
P_AUTO_CONSTRUCT + P_AUTO_UI, plDecalMtl::kRefAdv,
// UI
IDD_PASS_ADV, IDS_PASS_ADV, 0, APPENDROLL_CLOSED, NULL,
// Misc Properties
kPBAdvWire, _T("basicWire"), TYPE_BOOL, 0, 0,
p_ui, TYPE_SINGLECHEKBOX, IDC_MISC_WIRE,
end,
kPBAdvMeshOutlines, _T("meshOutlines"), TYPE_BOOL, 0, 0,
p_ui, TYPE_SINGLECHEKBOX, IDC_MISC_MESHOUTLINES,
end,
kPBAdvTwoSided, _T("twoSided"), TYPE_BOOL, 0, 0,
p_ui, TYPE_SINGLECHEKBOX, IDC_MISC_TWOSIDED,
end,
// Shade properties
kPBAdvSoftShadow, _T("softShadow"), TYPE_BOOL, 0, 0,
p_ui, TYPE_SINGLECHEKBOX, IDC_SHADE_SOFTSHADOW,
end,
kPBAdvNoProj, _T("noProj"), TYPE_BOOL, 0, 0,
p_ui, TYPE_SINGLECHEKBOX, IDC_SHADE_NO_PROJ,
end,
kPBAdvVertexShade, _T("vertexShade"), TYPE_BOOL, 0, 0,
p_ui, TYPE_SINGLECHEKBOX, IDC_SHADE_VERTEXSHADE,
end,
kPBAdvNoShade, _T("noShade"), TYPE_BOOL, 0, 0,
p_ui, TYPE_SINGLECHEKBOX, IDC_SHADE_NOSHADE,
end,
kPBAdvNoFog, _T("noFog"), TYPE_BOOL, 0, 0,
p_ui, TYPE_SINGLECHEKBOX, IDC_SHADE_NO_FOG,
end,
kPBAdvWhite, _T("white"), TYPE_BOOL, 0, 0,
p_ui, TYPE_SINGLECHEKBOX, IDC_SHADE_WHITE,
end,
// Z Properties
kPBAdvZOnly, _T("zOnly"), TYPE_BOOL, 0, 0,
p_ui, TYPE_SINGLECHEKBOX, IDC_Z_ZONLY,
end,
kPBAdvZClear, _T("zClear"), TYPE_BOOL, 0, 0,
p_ui, TYPE_SINGLECHEKBOX, IDC_Z_ZCLEAR,
end,
kPBAdvZNoRead, _T("zNoRead"), TYPE_BOOL, 0, 0,
p_ui, TYPE_SINGLECHEKBOX, IDC_Z_ZNOREAD,
end,
kPBAdvZNoWrite, _T("zNoWrite"), TYPE_BOOL, 0, 0,
p_ui, TYPE_SINGLECHEKBOX, IDC_Z_ZNOWRITE,
p_default, TRUE,
end,
kPBAdvZInc, _T("zInc"), TYPE_BOOL, 0, 0,
p_ui, TYPE_SINGLECHEKBOX, IDC_Z_INC,
p_default, TRUE,
end,
kPBAdvAlphaTestHigh, _T("aTestHigh"), TYPE_BOOL, 0, 0,
p_default, FALSE,
end,
end
);
/*==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/>.
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 "plDecalMtl.h"
#include "plPassBaseParamIDs.h"
using namespace plPassBaseParamIDs;
static ParamBlockDesc2 gDecalAdvPB
(
plDecalMtl::kBlkAdv, _T("advanced"), IDS_PASS_ADV, GetDecalMtlDesc(),
P_AUTO_CONSTRUCT + P_AUTO_UI, plDecalMtl::kRefAdv,
// UI
IDD_PASS_ADV, IDS_PASS_ADV, 0, APPENDROLL_CLOSED, NULL,
// Misc Properties
kPBAdvWire, _T("basicWire"), TYPE_BOOL, 0, 0,
p_ui, TYPE_SINGLECHEKBOX, IDC_MISC_WIRE,
end,
kPBAdvMeshOutlines, _T("meshOutlines"), TYPE_BOOL, 0, 0,
p_ui, TYPE_SINGLECHEKBOX, IDC_MISC_MESHOUTLINES,
end,
kPBAdvTwoSided, _T("twoSided"), TYPE_BOOL, 0, 0,
p_ui, TYPE_SINGLECHEKBOX, IDC_MISC_TWOSIDED,
end,
// Shade properties
kPBAdvSoftShadow, _T("softShadow"), TYPE_BOOL, 0, 0,
p_ui, TYPE_SINGLECHEKBOX, IDC_SHADE_SOFTSHADOW,
end,
kPBAdvNoProj, _T("noProj"), TYPE_BOOL, 0, 0,
p_ui, TYPE_SINGLECHEKBOX, IDC_SHADE_NO_PROJ,
end,
kPBAdvVertexShade, _T("vertexShade"), TYPE_BOOL, 0, 0,
p_ui, TYPE_SINGLECHEKBOX, IDC_SHADE_VERTEXSHADE,
end,
kPBAdvNoShade, _T("noShade"), TYPE_BOOL, 0, 0,
p_ui, TYPE_SINGLECHEKBOX, IDC_SHADE_NOSHADE,
end,
kPBAdvNoFog, _T("noFog"), TYPE_BOOL, 0, 0,
p_ui, TYPE_SINGLECHEKBOX, IDC_SHADE_NO_FOG,
end,
kPBAdvWhite, _T("white"), TYPE_BOOL, 0, 0,
p_ui, TYPE_SINGLECHEKBOX, IDC_SHADE_WHITE,
end,
// Z Properties
kPBAdvZOnly, _T("zOnly"), TYPE_BOOL, 0, 0,
p_ui, TYPE_SINGLECHEKBOX, IDC_Z_ZONLY,
end,
kPBAdvZClear, _T("zClear"), TYPE_BOOL, 0, 0,
p_ui, TYPE_SINGLECHEKBOX, IDC_Z_ZCLEAR,
end,
kPBAdvZNoRead, _T("zNoRead"), TYPE_BOOL, 0, 0,
p_ui, TYPE_SINGLECHEKBOX, IDC_Z_ZNOREAD,
end,
kPBAdvZNoWrite, _T("zNoWrite"), TYPE_BOOL, 0, 0,
p_ui, TYPE_SINGLECHEKBOX, IDC_Z_ZNOWRITE,
p_default, TRUE,
end,
kPBAdvZInc, _T("zInc"), TYPE_BOOL, 0, 0,
p_ui, TYPE_SINGLECHEKBOX, IDC_Z_INC,
p_default, TRUE,
end,
kPBAdvAlphaTestHigh, _T("aTestHigh"), TYPE_BOOL, 0, 0,
p_default, FALSE,
end,
end
);
ParamBlockDesc2 *GetDecalAdvPB() { return &gDecalAdvPB; }

View File

@ -1,47 +1,47 @@
/*==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/>.
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 PL_DECALMTLANIMPB_H
#define PL_DECALMTLANIMPB_H
enum
{
kDecalAnimName,
kDecalAnimAutoStart,
kDecalAnimLoop,
kDecalAnimLoopName,
kDecalEaseInType, // Not used, but reserved
kDecalEaseOutType, //
kDecalEaseInLength, //
kDecalEaseOutLength, //
kDecalEaseInMin, //
kDecalEaseInMax, //
kDecalEaseOutMin, //
kDecalEaseOutMax, //
kDecalAnimUseGlobal, //
kDecalAnimGlobalName, //
};
/*==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/>.
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 PL_DECALMTLANIMPB_H
#define PL_DECALMTLANIMPB_H
enum
{
kDecalAnimName,
kDecalAnimAutoStart,
kDecalAnimLoop,
kDecalAnimLoopName,
kDecalEaseInType, // Not used, but reserved
kDecalEaseOutType, //
kDecalEaseInLength, //
kDecalEaseOutLength, //
kDecalEaseInMin, //
kDecalEaseInMax, //
kDecalEaseOutMin, //
kDecalEaseOutMax, //
kDecalAnimUseGlobal, //
kDecalAnimGlobalName, //
};
#endif

View File

@ -1,93 +1,93 @@
/*==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/>.
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 "plDecalMtl.h"
#include "plPassBaseParamIDs.h"
#include "resource.h"
#include "iparamm2.h"
#include "plPassAnimDlgProc.h"
#include "plAnimStealthNode.h"
using namespace plPassBaseParamIDs;
static ParamBlockDesc2 gDecalAnimPB
(
plDecalMtl::kBlkAnim, _T("anim"), IDS_PASS_ANIM, GetDecalMtlDesc(),//NULL,
P_AUTO_CONSTRUCT + P_AUTO_UI + P_CALLSETS_ON_LOAD, plDecalMtl::kRefAnim,
// UI
IDD_PASS_ANIM, IDS_PASS_ANIM, 0, 0, &plPassAnimDlgProc::Get(),
#ifdef MCN_UPGRADE_OLD_ANIM_BLOCKS
// THE FOLLOWING ARE ALL OLD PARAMETERS AND SHOULD NO LONGER BE USED. The only reason
// they're here is so we can convert old paramBlocks into the new plAnimStealthNode format
kPBAnimName, _T("animName"), TYPE_STRING, 0, 0,
end,
kPBAnimAutoStart, _T("autoStart"), TYPE_BOOL, 0, 0,
end,
kPBAnimLoop, _T("loop"), TYPE_BOOL, 0, 0,
end,
kPBAnimLoopName, _T("loopName"), TYPE_STRING, 0, 0,
end,
// Anim Ease
kPBAnimEaseInType, _T("easeInType"), TYPE_INT, 0, 0,
end,
kPBAnimEaseInLength, _T("easeInLength"), TYPE_FLOAT, 0, 0,
end,
kPBAnimEaseInMin, _T("easeInMin"), TYPE_FLOAT, 0, 0,
end,
kPBAnimEaseInMax, _T("easeInMax"), TYPE_FLOAT, 0, 0,
end,
kPBAnimEaseOutType, _T("easeOutType"), TYPE_INT, 0, 0,
end,
kPBAnimEaseOutLength, _T("easeOutLength"), TYPE_FLOAT, 0, 0,
end,
kPBAnimEaseOutMin, _T("easeOutMin"), TYPE_FLOAT, 0, 0,
end,
kPBAnimEaseOutMax, _T("easeOutMax"), TYPE_FLOAT, 0, 0,
end,
#endif // MCN_UPGRADE_OLD_ANIM_BLOCKS
kPBAnimUseGlobal, _T("UseGlobal"), TYPE_BOOL, 0, 0,
p_default, FALSE,
p_ui, TYPE_SINGLECHEKBOX, IDC_MTL_USE_GLOBAL,
end,
kPBAnimGlobalName, _T("GlobalName"), TYPE_STRING, 0, 0,
p_default, _T(""),
end,
kPBAnimStealthNodes, _T( "testing" ), TYPE_REFTARG_TAB, 0, 0, 0,
p_accessor, &plStealthNodeAccessor::GetInstance(),
end,
end
);
ParamBlockDesc2 *GetDecalAnimPB() { return &gDecalAnimPB; }
/*==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/>.
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 "plDecalMtl.h"
#include "plPassBaseParamIDs.h"
#include "resource.h"
#include "iparamm2.h"
#include "plPassAnimDlgProc.h"
#include "plAnimStealthNode.h"
using namespace plPassBaseParamIDs;
static ParamBlockDesc2 gDecalAnimPB
(
plDecalMtl::kBlkAnim, _T("anim"), IDS_PASS_ANIM, GetDecalMtlDesc(),//NULL,
P_AUTO_CONSTRUCT + P_AUTO_UI + P_CALLSETS_ON_LOAD, plDecalMtl::kRefAnim,
// UI
IDD_PASS_ANIM, IDS_PASS_ANIM, 0, 0, &plPassAnimDlgProc::Get(),
#ifdef MCN_UPGRADE_OLD_ANIM_BLOCKS
// THE FOLLOWING ARE ALL OLD PARAMETERS AND SHOULD NO LONGER BE USED. The only reason
// they're here is so we can convert old paramBlocks into the new plAnimStealthNode format
kPBAnimName, _T("animName"), TYPE_STRING, 0, 0,
end,
kPBAnimAutoStart, _T("autoStart"), TYPE_BOOL, 0, 0,
end,
kPBAnimLoop, _T("loop"), TYPE_BOOL, 0, 0,
end,
kPBAnimLoopName, _T("loopName"), TYPE_STRING, 0, 0,
end,
// Anim Ease
kPBAnimEaseInType, _T("easeInType"), TYPE_INT, 0, 0,
end,
kPBAnimEaseInLength, _T("easeInLength"), TYPE_FLOAT, 0, 0,
end,
kPBAnimEaseInMin, _T("easeInMin"), TYPE_FLOAT, 0, 0,
end,
kPBAnimEaseInMax, _T("easeInMax"), TYPE_FLOAT, 0, 0,
end,
kPBAnimEaseOutType, _T("easeOutType"), TYPE_INT, 0, 0,
end,
kPBAnimEaseOutLength, _T("easeOutLength"), TYPE_FLOAT, 0, 0,
end,
kPBAnimEaseOutMin, _T("easeOutMin"), TYPE_FLOAT, 0, 0,
end,
kPBAnimEaseOutMax, _T("easeOutMax"), TYPE_FLOAT, 0, 0,
end,
#endif // MCN_UPGRADE_OLD_ANIM_BLOCKS
kPBAnimUseGlobal, _T("UseGlobal"), TYPE_BOOL, 0, 0,
p_default, FALSE,
p_ui, TYPE_SINGLECHEKBOX, IDC_MTL_USE_GLOBAL,
end,
kPBAnimGlobalName, _T("GlobalName"), TYPE_STRING, 0, 0,
p_default, _T(""),
end,
kPBAnimStealthNodes, _T( "testing" ), TYPE_REFTARG_TAB, 0, 0, 0,
p_accessor, &plStealthNodeAccessor::GetInstance(),
end,
end
);
ParamBlockDesc2 *GetDecalAnimPB() { return &gDecalAnimPB; }

View File

@ -1,52 +1,52 @@
/*==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/>.
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 PL_DECALMTLBASICPB_H
#define PL_DECALMTLBASICPB_H
// Param ID's
enum
{
kDecalBasColorLock,
kDecalBasColorAmb,
kDecalBasColor,
kDecalBasOpacity,
kDecalBasEmissive,
// Specular
kDecalBasUseSpec,
kDecalBasShine,
kDecalBasShineStr,
// New color stuff
kDecalBasDiffuseLock,
kDecalBasRunColor,
kDecalBasSpecColor
};
/*==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/>.
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 PL_DECALMTLBASICPB_H
#define PL_DECALMTLBASICPB_H
// Param ID's
enum
{
kDecalBasColorLock,
kDecalBasColorAmb,
kDecalBasColor,
kDecalBasOpacity,
kDecalBasEmissive,
// Specular
kDecalBasUseSpec,
kDecalBasShine,
kDecalBasShineStr,
// New color stuff
kDecalBasDiffuseLock,
kDecalBasRunColor,
kDecalBasSpecColor
};
#endif //PL_DECALMTLBASICPB_H

View File

@ -1,236 +1,236 @@
/*==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/>.
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 "plDecalMtl.h"
#include "plDecalMtlBasicPB.h"
#include "resource.h"
#include "iparamm2.h"
class DecalBasicPBAccessor;
extern DecalBasicPBAccessor basicAccessor;
class DecalBasicDlgProc;
extern DecalBasicDlgProc gDecalBasicDlgProc;
static ParamBlockDesc2 gDecalBasicPB
(
plDecalMtl::kBlkBasic, _T("basic"), IDS_PASS_BASIC, GetDecalMtlDesc(),//NULL,
P_AUTO_CONSTRUCT + P_AUTO_UI, plDecalMtl::kRefBasic,
// UI
IDD_PASS_BASIC, IDS_PASS_BASIC, 0, 0, &gDecalBasicDlgProc,
// Color
kDecalBasColorLock, _T("colorLock"), TYPE_BOOL, 0, 0,
p_ui, TYPE_CHECKBUTTON, IDC_LOCK_AD,
p_accessor, &basicAccessor,
end,
kDecalBasColorAmb, _T("ambColor"), TYPE_RGBA, P_ANIMATABLE, IDS_BASIC_AMB,
p_ui, TYPE_COLORSWATCH, IDC_LAYER_COLOR_AMB,
p_accessor, &basicAccessor,
end,
kDecalBasColor, _T("color"), TYPE_RGBA, P_ANIMATABLE, IDS_BASIC_COLOR,
p_ui, TYPE_COLORSWATCH, IDC_LAYER_COLOR,
p_default, Color(1,1,1),
p_accessor, &basicAccessor,
end,
kDecalBasRunColor, _T("runtimeColor"), TYPE_RGBA, P_ANIMATABLE, IDS_BASIC_RUNCOLOR,
p_ui, TYPE_COLORSWATCH, IDC_LAYER_RUNCOLOR,
p_default, Color(1,1,1),
p_accessor, &basicAccessor,
end,
kDecalBasDiffuseLock, _T("diffuseLock"), TYPE_BOOL, 0, 0,
p_ui, TYPE_CHECKBUTTON, IDC_LOCK_COLORS,
p_accessor, &basicAccessor,
p_default, TRUE,
end,
// Opacity
kDecalBasOpacity, _T("opacity"), TYPE_INT, P_ANIMATABLE, IDS_BASIC_OPAC,
p_ui, TYPE_SPINNER, EDITTYPE_INT, IDC_TR_EDIT, IDC_TR_SPIN, 0.4,
p_range, 0, 100,
p_default, 100,
end,
kDecalBasEmissive, _T("emissive"), TYPE_BOOL, 0, 0,
p_ui, TYPE_SINGLECHEKBOX, IDC_LAYER_EMISSIVE_CB,
end,
// Specularity
kDecalBasUseSpec, _T("useSpec"), TYPE_BOOL, 0, 0,
p_ui, TYPE_SINGLECHEKBOX, IDC_SHADE_SPECULAR,
p_enable_ctrls, 2, kDecalBasShine, kDecalBasShineStr,
end,
kDecalBasShine, _T("shine"), TYPE_INT, 0, 0,
p_ui, TYPE_SPINNER, EDITTYPE_INT, IDC_SH_EDIT, IDC_SH_SPIN, 0.4,
p_range, 0, 100,
end,
kDecalBasSpecColor, _T("specularColor"), TYPE_RGBA, P_ANIMATABLE, IDS_BASIC_SPECCOLOR,
p_ui, TYPE_COLORSWATCH, IDC_LAYER_SPECCOLOR,
p_default, Color(0,0,0),
end,
// OBSOLETE--here so we can upgrade it to color if necessary
kDecalBasShineStr, _T("shineStr"), TYPE_INT, 0, 0,
p_range, -1, 100,
p_default, -1,
end,
end
);
ParamBlockDesc2 *GetDecalBasicPB() { return &gDecalBasicPB; }
class DecalBasicPBAccessor : public PBAccessor
{
bool fColorLocked;
public:
DecalBasicPBAccessor() : fColorLocked( false ) {}
void Set(PB2Value& val, ReferenceMaker* owner, ParamID id, int tabIndex, TimeValue t)
{
plDecalMtl* mtl = (plDecalMtl*)owner;
IParamBlock2 *pb = mtl->GetParamBlockByID(plDecalMtl::kBlkBasic);
switch (id)
{
case kDecalBasColorLock:
if (val.i)
pb->SetValue(kDecalBasColor, t, pb->GetColor(kDecalBasColorAmb, t));
break;
case kDecalBasDiffuseLock:
if (val.i)
pb->SetValue(kDecalBasRunColor, t, pb->GetColor(kDecalBasColor, t));
break;
case kDecalBasColor:
case kDecalBasColorAmb:
case kDecalBasRunColor:
ISyncLockedColors( id, pb, val, t );
break;
}
}
void Get(PB2Value& v, ReferenceMaker* owner, ParamID id, int tabIndex, TimeValue t, Interval &valid)
{
}
void ISyncLockedColors( ParamID settingID, IParamBlock2 *pb, PB2Value &val, TimeValue t )
{
int i, numToSet = 0;
ParamID toSet[ 2 ];
if( fColorLocked )
return;
fColorLocked = true;
if( settingID == kDecalBasColorAmb && pb->GetInt( kDecalBasColorLock, t ) )
{
toSet[ numToSet++ ] = kDecalBasColor;
if( pb->GetInt( kDecalBasDiffuseLock, t ) )
toSet[ numToSet++ ] = kDecalBasRunColor;
}
else if( settingID == kDecalBasRunColor && pb->GetInt( kDecalBasDiffuseLock, t ) )
{
toSet[ numToSet++ ] = kDecalBasColor;
if( pb->GetInt( kDecalBasColorLock, t ) )
toSet[ numToSet++ ] = kDecalBasColorAmb;
}
else if( settingID == kDecalBasColor )
{
if( pb->GetInt( kDecalBasColorLock, t ) )
toSet[ numToSet++ ] = kDecalBasColorAmb;
if( pb->GetInt( kDecalBasDiffuseLock, t ) )
toSet[ numToSet++ ] = kDecalBasRunColor;
}
for( i = 0; i < numToSet; i++ )
{
pb->SetValue( toSet[ i ], t, *val.p );
pb->GetMap()->Invalidate( toSet[ i ] );
}
fColorLocked = false;
}
};
static DecalBasicPBAccessor basicAccessor;
class DecalBasicDlgProc : public ParamMap2UserDlgProc
{
#if 1
protected:
HIMAGELIST hLockButtons;
void LoadLockButtons()
{
static bool loaded = false;
if (loaded)
return;
loaded = true;
HINSTANCE hInst = hInstance;
hLockButtons = ImageList_Create(16, 15, TRUE, 2, 0);
HBITMAP hBitmap = LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_BUTTONS));
HBITMAP hMask = LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_MASKBUTTONS));
ImageList_Add(hLockButtons, hBitmap, hMask);
DeleteObject(hBitmap);
DeleteObject(hMask);
}
void ISetLock(HWND hButton)
{
LoadLockButtons();
ICustButton *iBut = GetICustButton(hButton);
iBut->SetImage(hLockButtons,0,1,0,1,16,15);
iBut->SetType(CBT_CHECK);
ReleaseICustButton(iBut);
}
public:
DecalBasicDlgProc() : hLockButtons(NULL) {}
~DecalBasicDlgProc() { if (hLockButtons) ImageList_Destroy(hLockButtons); }
#endif
public:
BOOL DlgProc(TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
IParamBlock2 *pb = map->GetParamBlock();
switch (msg)
{
case WM_INITDIALOG:
{
ISetLock(GetDlgItem(hWnd, IDC_LOCK_AD));
ISetLock(GetDlgItem(hWnd, IDC_LOCK_COLORS));
}
return TRUE;
}
return FALSE;
}
void DeleteThis() {}
};
static DecalBasicDlgProc gDecalBasicDlgProc;
/*==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/>.
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 "plDecalMtl.h"
#include "plDecalMtlBasicPB.h"
#include "resource.h"
#include "iparamm2.h"
class DecalBasicPBAccessor;
extern DecalBasicPBAccessor basicAccessor;
class DecalBasicDlgProc;
extern DecalBasicDlgProc gDecalBasicDlgProc;
static ParamBlockDesc2 gDecalBasicPB
(
plDecalMtl::kBlkBasic, _T("basic"), IDS_PASS_BASIC, GetDecalMtlDesc(),//NULL,
P_AUTO_CONSTRUCT + P_AUTO_UI, plDecalMtl::kRefBasic,
// UI
IDD_PASS_BASIC, IDS_PASS_BASIC, 0, 0, &gDecalBasicDlgProc,
// Color
kDecalBasColorLock, _T("colorLock"), TYPE_BOOL, 0, 0,
p_ui, TYPE_CHECKBUTTON, IDC_LOCK_AD,
p_accessor, &basicAccessor,
end,
kDecalBasColorAmb, _T("ambColor"), TYPE_RGBA, P_ANIMATABLE, IDS_BASIC_AMB,
p_ui, TYPE_COLORSWATCH, IDC_LAYER_COLOR_AMB,
p_accessor, &basicAccessor,
end,
kDecalBasColor, _T("color"), TYPE_RGBA, P_ANIMATABLE, IDS_BASIC_COLOR,
p_ui, TYPE_COLORSWATCH, IDC_LAYER_COLOR,
p_default, Color(1,1,1),
p_accessor, &basicAccessor,
end,
kDecalBasRunColor, _T("runtimeColor"), TYPE_RGBA, P_ANIMATABLE, IDS_BASIC_RUNCOLOR,
p_ui, TYPE_COLORSWATCH, IDC_LAYER_RUNCOLOR,
p_default, Color(1,1,1),
p_accessor, &basicAccessor,
end,
kDecalBasDiffuseLock, _T("diffuseLock"), TYPE_BOOL, 0, 0,
p_ui, TYPE_CHECKBUTTON, IDC_LOCK_COLORS,
p_accessor, &basicAccessor,
p_default, TRUE,
end,
// Opacity
kDecalBasOpacity, _T("opacity"), TYPE_INT, P_ANIMATABLE, IDS_BASIC_OPAC,
p_ui, TYPE_SPINNER, EDITTYPE_INT, IDC_TR_EDIT, IDC_TR_SPIN, 0.4,
p_range, 0, 100,
p_default, 100,
end,
kDecalBasEmissive, _T("emissive"), TYPE_BOOL, 0, 0,
p_ui, TYPE_SINGLECHEKBOX, IDC_LAYER_EMISSIVE_CB,
end,
// Specularity
kDecalBasUseSpec, _T("useSpec"), TYPE_BOOL, 0, 0,
p_ui, TYPE_SINGLECHEKBOX, IDC_SHADE_SPECULAR,
p_enable_ctrls, 2, kDecalBasShine, kDecalBasShineStr,
end,
kDecalBasShine, _T("shine"), TYPE_INT, 0, 0,
p_ui, TYPE_SPINNER, EDITTYPE_INT, IDC_SH_EDIT, IDC_SH_SPIN, 0.4,
p_range, 0, 100,
end,
kDecalBasSpecColor, _T("specularColor"), TYPE_RGBA, P_ANIMATABLE, IDS_BASIC_SPECCOLOR,
p_ui, TYPE_COLORSWATCH, IDC_LAYER_SPECCOLOR,
p_default, Color(0,0,0),
end,
// OBSOLETE--here so we can upgrade it to color if necessary
kDecalBasShineStr, _T("shineStr"), TYPE_INT, 0, 0,
p_range, -1, 100,
p_default, -1,
end,
end
);
ParamBlockDesc2 *GetDecalBasicPB() { return &gDecalBasicPB; }
class DecalBasicPBAccessor : public PBAccessor
{
bool fColorLocked;
public:
DecalBasicPBAccessor() : fColorLocked( false ) {}
void Set(PB2Value& val, ReferenceMaker* owner, ParamID id, int tabIndex, TimeValue t)
{
plDecalMtl* mtl = (plDecalMtl*)owner;
IParamBlock2 *pb = mtl->GetParamBlockByID(plDecalMtl::kBlkBasic);
switch (id)
{
case kDecalBasColorLock:
if (val.i)
pb->SetValue(kDecalBasColor, t, pb->GetColor(kDecalBasColorAmb, t));
break;
case kDecalBasDiffuseLock:
if (val.i)
pb->SetValue(kDecalBasRunColor, t, pb->GetColor(kDecalBasColor, t));
break;
case kDecalBasColor:
case kDecalBasColorAmb:
case kDecalBasRunColor:
ISyncLockedColors( id, pb, val, t );
break;
}
}
void Get(PB2Value& v, ReferenceMaker* owner, ParamID id, int tabIndex, TimeValue t, Interval &valid)
{
}
void ISyncLockedColors( ParamID settingID, IParamBlock2 *pb, PB2Value &val, TimeValue t )
{
int i, numToSet = 0;
ParamID toSet[ 2 ];
if( fColorLocked )
return;
fColorLocked = true;
if( settingID == kDecalBasColorAmb && pb->GetInt( kDecalBasColorLock, t ) )
{
toSet[ numToSet++ ] = kDecalBasColor;
if( pb->GetInt( kDecalBasDiffuseLock, t ) )
toSet[ numToSet++ ] = kDecalBasRunColor;
}
else if( settingID == kDecalBasRunColor && pb->GetInt( kDecalBasDiffuseLock, t ) )
{
toSet[ numToSet++ ] = kDecalBasColor;
if( pb->GetInt( kDecalBasColorLock, t ) )
toSet[ numToSet++ ] = kDecalBasColorAmb;
}
else if( settingID == kDecalBasColor )
{
if( pb->GetInt( kDecalBasColorLock, t ) )
toSet[ numToSet++ ] = kDecalBasColorAmb;
if( pb->GetInt( kDecalBasDiffuseLock, t ) )
toSet[ numToSet++ ] = kDecalBasRunColor;
}
for( i = 0; i < numToSet; i++ )
{
pb->SetValue( toSet[ i ], t, *val.p );
pb->GetMap()->Invalidate( toSet[ i ] );
}
fColorLocked = false;
}
};
static DecalBasicPBAccessor basicAccessor;
class DecalBasicDlgProc : public ParamMap2UserDlgProc
{
#if 1
protected:
HIMAGELIST hLockButtons;
void LoadLockButtons()
{
static bool loaded = false;
if (loaded)
return;
loaded = true;
HINSTANCE hInst = hInstance;
hLockButtons = ImageList_Create(16, 15, TRUE, 2, 0);
HBITMAP hBitmap = LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_BUTTONS));
HBITMAP hMask = LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_MASKBUTTONS));
ImageList_Add(hLockButtons, hBitmap, hMask);
DeleteObject(hBitmap);
DeleteObject(hMask);
}
void ISetLock(HWND hButton)
{
LoadLockButtons();
ICustButton *iBut = GetICustButton(hButton);
iBut->SetImage(hLockButtons,0,1,0,1,16,15);
iBut->SetType(CBT_CHECK);
ReleaseICustButton(iBut);
}
public:
DecalBasicDlgProc() : hLockButtons(NULL) {}
~DecalBasicDlgProc() { if (hLockButtons) ImageList_Destroy(hLockButtons); }
#endif
public:
BOOL DlgProc(TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
IParamBlock2 *pb = map->GetParamBlock();
switch (msg)
{
case WM_INITDIALOG:
{
ISetLock(GetDlgItem(hWnd, IDC_LOCK_AD));
ISetLock(GetDlgItem(hWnd, IDC_LOCK_COLORS));
}
return TRUE;
}
return FALSE;
}
void DeleteThis() {}
};
static DecalBasicDlgProc gDecalBasicDlgProc;

View File

@ -1,40 +1,40 @@
/*==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/>.
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 PL_DECALMTLLAYERSPB_H
#define PL_DECALMTLLAYERSPB_H
enum
{
// Layers
kDecalLayBase,
kDecalLayOutputBlend,
kDecalLayTopOn,
kDecalLayTop,
kDecalLayBlend,
kDecalLayOutputAlpha,
};
/*==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/>.
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 PL_DECALMTLLAYERSPB_H
#define PL_DECALMTLLAYERSPB_H
enum
{
// Layers
kDecalLayBase,
kDecalLayOutputBlend,
kDecalLayTopOn,
kDecalLayTop,
kDecalLayBlend,
kDecalLayOutputAlpha,
};
#endif //PL_DECALMTLLAYERSPB_H

View File

@ -1,87 +1,87 @@
/*==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/>.
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 "plDecalMtl.h"
#include "plDecalMtlLayersPB.h"
#include "resource.h"
#include "iparamm2.h"
#include "Layers/plLayerTex.h"
class DecalMtlLayersAccessor;
extern DecalMtlLayersAccessor gLayersAccessor;
class LayersDlgProc;
extern LayersDlgProc gLayersDlgProc;
static ParamBlockDesc2 gDecalMtlLayersPB
(
plDecalMtl::kBlkLayers, _T("layers"), IDS_PASS_LAYERS, GetDecalMtlDesc(),
P_AUTO_CONSTRUCT + P_AUTO_UI, plDecalMtl::kRefLayers,
// UI
IDD_PASS_LAYERS, IDS_PASS_LAYERS, 0, 0, NULL,
kDecalLayBase, _T("baseLayer"), TYPE_TEXMAP, 0, IDS_BASIC_AMB,
p_ui, TYPE_TEXMAPBUTTON, IDC_LAYER1,
p_subtexno, 0,
end,
kDecalLayOutputBlend, _T("outputBlend"), TYPE_INT, 0, 0,
p_ui, TYPE_RADIO, 3, IDC_OUTPUTB_NONE, IDC_OUTPUTB_ALPHA, IDC_OUTPUTB_ADD,
p_vals, plPassMtlBase::kBlendNone, plPassMtlBase::kBlendAlpha, plPassMtlBase::kBlendAdd,
p_default, plPassMtlBase::kBlendNone,
end,
kDecalLayTopOn, _T("topLayerOn"), TYPE_BOOL, 0, 0,
p_ui, TYPE_SINGLECHEKBOX, IDC_TOP_ON,
p_default, FALSE,
p_enable_ctrls, 3, kDecalLayTop, kDecalLayBlend, kDecalLayOutputAlpha,
end,
kDecalLayTop, _T("topLayer"), TYPE_TEXMAP, 0, 0,
p_ui, TYPE_TEXMAPBUTTON, IDC_LAYER2,
p_subtexno, 1,
end,
kDecalLayBlend, _T("layerBlend"), TYPE_INT, 0, 0,
p_ui, TYPE_RADIO, 3, IDC_LAYER_ALPHA, IDC_LAYER_ADD, IDC_LAYER_MULTIPLY,
p_vals, plPassMtlBase::kBlendAlpha, plPassMtlBase::kBlendAdd, plPassMtlBase::kBlendMult,
p_default, plPassMtlBase::kBlendAdd,
end,
kDecalLayOutputAlpha, _T("ouputAlpha"), TYPE_INT, 0, 0,
p_ui, TYPE_RADIO, 3, IDC_OUTPUTA_DISCARD, IDC_OUTPUTA_ADD, IDC_OUTPUTA_MULT,
p_vals, plPassMtlBase::kAlphaDiscard, plPassMtlBase::kAlphaAdd, plPassMtlBase::kAlphaMultiply,
p_default, plPassMtlBase::kAlphaDiscard,
end,
end
);
ParamBlockDesc2 *GetDecalLayersPB() { return &gDecalMtlLayersPB; }
/*==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/>.
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 "plDecalMtl.h"
#include "plDecalMtlLayersPB.h"
#include "resource.h"
#include "iparamm2.h"
#include "Layers/plLayerTex.h"
class DecalMtlLayersAccessor;
extern DecalMtlLayersAccessor gLayersAccessor;
class LayersDlgProc;
extern LayersDlgProc gLayersDlgProc;
static ParamBlockDesc2 gDecalMtlLayersPB
(
plDecalMtl::kBlkLayers, _T("layers"), IDS_PASS_LAYERS, GetDecalMtlDesc(),
P_AUTO_CONSTRUCT + P_AUTO_UI, plDecalMtl::kRefLayers,
// UI
IDD_PASS_LAYERS, IDS_PASS_LAYERS, 0, 0, NULL,
kDecalLayBase, _T("baseLayer"), TYPE_TEXMAP, 0, IDS_BASIC_AMB,
p_ui, TYPE_TEXMAPBUTTON, IDC_LAYER1,
p_subtexno, 0,
end,
kDecalLayOutputBlend, _T("outputBlend"), TYPE_INT, 0, 0,
p_ui, TYPE_RADIO, 3, IDC_OUTPUTB_NONE, IDC_OUTPUTB_ALPHA, IDC_OUTPUTB_ADD,
p_vals, plPassMtlBase::kBlendNone, plPassMtlBase::kBlendAlpha, plPassMtlBase::kBlendAdd,
p_default, plPassMtlBase::kBlendNone,
end,
kDecalLayTopOn, _T("topLayerOn"), TYPE_BOOL, 0, 0,
p_ui, TYPE_SINGLECHEKBOX, IDC_TOP_ON,
p_default, FALSE,
p_enable_ctrls, 3, kDecalLayTop, kDecalLayBlend, kDecalLayOutputAlpha,
end,
kDecalLayTop, _T("topLayer"), TYPE_TEXMAP, 0, 0,
p_ui, TYPE_TEXMAPBUTTON, IDC_LAYER2,
p_subtexno, 1,
end,
kDecalLayBlend, _T("layerBlend"), TYPE_INT, 0, 0,
p_ui, TYPE_RADIO, 3, IDC_LAYER_ALPHA, IDC_LAYER_ADD, IDC_LAYER_MULTIPLY,
p_vals, plPassMtlBase::kBlendAlpha, plPassMtlBase::kBlendAdd, plPassMtlBase::kBlendMult,
p_default, plPassMtlBase::kBlendAdd,
end,
kDecalLayOutputAlpha, _T("ouputAlpha"), TYPE_INT, 0, 0,
p_ui, TYPE_RADIO, 3, IDC_OUTPUTA_DISCARD, IDC_OUTPUTA_ADD, IDC_OUTPUTA_MULT,
p_vals, plPassMtlBase::kAlphaDiscard, plPassMtlBase::kAlphaAdd, plPassMtlBase::kAlphaMultiply,
p_default, plPassMtlBase::kAlphaDiscard,
end,
end
);
ParamBlockDesc2 *GetDecalLayersPB() { return &gDecalMtlLayersPB; }

View File

@ -1,370 +1,370 @@
/*==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/>.
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 "hsTypes.h"
#include "plMultipassMtl.h"
#include "plPassMtl.h"
#include "plMultipassMtlPB.h"
#include "plMultipassMtlDlg.h"
class plMultipassClassDesc : public ClassDesc2
{
public:
int IsPublic() { return TRUE; }
void* Create(BOOL loading) { return TRACKED_NEW plMultipassMtl(loading); }
const TCHAR* ClassName() { return GetString(IDS_MULTI_MTL); }
SClass_ID SuperClassID() { return MATERIAL_CLASS_ID; }
Class_ID ClassID() { return MULTIMTL_CLASS_ID; }
const TCHAR* Category() { return NULL; }
const TCHAR* InternalName() { return _T("PlasmaMultipass"); }
HINSTANCE HInstance() { return hInstance; }
};
static plMultipassClassDesc plMultipassMtlDesc;
ClassDesc2* GetMultiMtlDesc() { return &plMultipassMtlDesc; }
#include "plMultipassMtlPB.cpp"
plMultipassMtl::plMultipassMtl(BOOL loading) : fPassesPB(NULL)
{
plMultipassMtlDesc.MakeAutoParamBlocks(this);
if (!loading)
Reset();
SetNumSubMtls(1);
}
void plMultipassMtl::Reset()
{
fIValid.SetEmpty();
}
ParamDlg* plMultipassMtl::CreateParamDlg(HWND hwMtlEdit, IMtlParams *imp)
{
fMtlDlg = TRACKED_NEW plMultipassMtlDlg(hwMtlEdit, imp, this);
return fMtlDlg;
}
void plMultipassMtl::SetParamDlg(ParamDlg *dlg)
{
fMtlDlg = (plMultipassMtlDlg*)dlg;
}
BOOL plMultipassMtl::SetDlgThing(ParamDlg* dlg)
{
if (dlg == fMtlDlg)
{
fMtlDlg->SetThing(this);
return TRUE;
}
return FALSE;
}
Interval plMultipassMtl::Validity(TimeValue t)
{
Interval valid = FOREVER;
/* for (int i = 0; i < fSubTexmap.Count(); i++)
{
if (fSubTexmap[i])
valid &= fSubTexmap[i]->Validity(t);
}
*/
// float u;
// fPBlock->GetValue(pb_spin,t,u,valid);
return valid;
}
/*===========================================================================*\
| Subanim & References support
\*===========================================================================*/
int plMultipassMtl::NumSubs()
{
return NumSubMtls();
}
TSTR plMultipassMtl::SubAnimName(int i)
{
return GetSubMtlSlotName(i);
}
Animatable* plMultipassMtl::SubAnim(int i)
{
return GetSubMtl(i);
}
int plMultipassMtl::NumRefs()
{
return 1;
}
RefTargetHandle plMultipassMtl::GetReference(int i)
{
if (i == kRefPasses)
return fPassesPB;
return NULL;
}
void plMultipassMtl::SetReference(int i, RefTargetHandle rtarg)
{
if (i == kRefPasses)
fPassesPB = (IParamBlock2 *)rtarg;
}
int plMultipassMtl::NumParamBlocks()
{
return 1;
}
IParamBlock2 *plMultipassMtl::GetParamBlock(int i)
{
if (i == kRefPasses)
return fPassesPB;
return NULL;
}
IParamBlock2 *plMultipassMtl::GetParamBlockByID(BlockID id)
{
if (fPassesPB->ID() == id)
return fPassesPB;
return NULL;
}
RefResult plMultipassMtl::NotifyRefChanged(Interval changeInt, RefTargetHandle hTarget,
PartID& partID, RefMessage message )
{
switch (message)
{
case REFMSG_CHANGE:
fIValid.SetEmpty();
if (hTarget == fPassesPB)
{
ParamID changingParam = fPassesPB->LastNotifyParamID();
fPassesPB->GetDesc()->InvalidateUI(changingParam);
}
break;
}
return REF_SUCCEED;
}
////////////////////////////////////////////////////////////////////////////////
// Subtexmap access
int plMultipassMtl::NumSubMtls()
{
return fPassesPB->GetInt(kMultCount);
}
Mtl *plMultipassMtl::GetSubMtl(int i)
{
if (i < NumSubMtls())
return fPassesPB->GetMtl(kMultPasses, 0, i);
return NULL;
}
void plMultipassMtl::SetSubMtl(int i, Mtl *m)
{
if (i < NumSubMtls())
fPassesPB->SetValue(kMultPasses, 0, m, i);
}
TSTR plMultipassMtl::GetSubMtlSlotName(int i)
{
TSTR str;
str.printf("Pass %d", i+1);
return str;
}
TSTR plMultipassMtl::GetSubMtlTVName(int i)
{
return GetSubMtlSlotName(i);
}
/*===========================================================================*\
| Standard IO
\*===========================================================================*/
#define MTL_HDR_CHUNK 0x4000
IOResult plMultipassMtl::Save(ISave *isave)
{
IOResult res;
isave->BeginChunk(MTL_HDR_CHUNK);
res = MtlBase::Save(isave);
if (res!=IO_OK) return res;
isave->EndChunk();
return IO_OK;
}
IOResult plMultipassMtl::Load(ILoad *iload)
{
IOResult res;
int id;
while (IO_OK==(res=iload->OpenChunk()))
{
switch(id = iload->CurChunkID())
{
case MTL_HDR_CHUNK:
res = MtlBase::Load(iload);
break;
}
iload->CloseChunk();
if (res!=IO_OK)
return res;
}
return IO_OK;
}
/*===========================================================================*\
| Updating and cloning
\*===========================================================================*/
RefTargetHandle plMultipassMtl::Clone(RemapDir &remap)
{
plMultipassMtl *mnew = TRACKED_NEW plMultipassMtl(FALSE);
*((MtlBase*)mnew) = *((MtlBase*)this);
mnew->ReplaceReference(kRefPasses, remap.CloneRef(fPassesPB));
mnew->fIValid.SetEmpty();
BaseClone(this, mnew, remap);
return (RefTargetHandle)mnew;
}
void plMultipassMtl::NotifyChanged()
{
NotifyDependents(FOREVER, PART_ALL, REFMSG_CHANGE);
}
void plMultipassMtl::Update(TimeValue t, Interval& valid)
{
if (!fIValid.InInterval(t))
{
fIValid.SetInfinite();
// fPassesPB->GetValue(kMtlLayLayer1On, t, fMapOn[0], fIValid);
for (int i = 0; i < NumSubMtls(); i++)
{
if (GetSubMtl(i))
GetSubMtl(i)->Update(t, fIValid);
}
}
valid &= fIValid;
}
/*===========================================================================*\
| Determine the characteristics of the material
\*===========================================================================*/
void plMultipassMtl::SetAmbient(Color c, TimeValue t) {}
void plMultipassMtl::SetDiffuse(Color c, TimeValue t) {}
void plMultipassMtl::SetSpecular(Color c, TimeValue t) {}
void plMultipassMtl::SetShininess(float v, TimeValue t) {}
Color plMultipassMtl::GetAmbient(int mtlNum, BOOL backFace) { return Color(0,0,0); }
Color plMultipassMtl::GetDiffuse(int mtlNum, BOOL backFace) { return Color(0,0,0); }
Color plMultipassMtl::GetSpecular(int mtlNum, BOOL backFace) { return Color(0,0,0); }
float plMultipassMtl::GetXParency(int mtlNum, BOOL backFace) { return 0.0f; }
float plMultipassMtl::GetShininess(int mtlNum, BOOL backFace) { return 0.0f; }
float plMultipassMtl::GetShinStr(int mtlNum, BOOL backFace) { return 0.0f; }
float plMultipassMtl::WireSize(int mtlNum, BOOL backFace) { return 0.0f; }
/*===========================================================================*\
| Actual shading takes place
\*===========================================================================*/
void plMultipassMtl::Shade(ShadeContext& sc)
{
// Get the background color
Color backColor, backTrans;
backColor.Black();
backTrans.White();
int count = NumSubMtls();
for (int i = 0; i < count; i++)
{
if (fPassesPB->GetInt(kMultOn, 0, i) == 0)
continue;
// Call each pass' shade function with the previous color
Mtl *mtl = GetSubMtl(i);
//backTrans = Color(0,0,0);
if (mtl->ClassID() == PASS_MTL_CLASS_ID)
{
plPassMtl *passMtl = (plPassMtl*)mtl;
passMtl->ShadeWithBackground(sc, backColor);
backTrans *= sc.out.t;
backColor = backColor * sc.out.t + sc.out.c;
}
}
sc.out.t = backTrans;
sc.out.c = backColor;
}
float plMultipassMtl::EvalDisplacement(ShadeContext& sc)
{
return 0.0f;
}
Interval plMultipassMtl::DisplacementValidity(TimeValue t)
{
Interval iv;
iv.SetInfinite();
return iv;
}
void plMultipassMtl::SetNumSubMtls(int num)
{
TimeValue t = GetCOREInterface()->GetTime();
int curNum = fPassesPB->GetInt(kMultCount);
fPassesPB->SetValue(kMultCount, 0, num);
fPassesPB->SetCount(kMultPasses, num);
fPassesPB->SetCount(kMultOn, num);
fPassesPB->SetCount(kMultLayerCounts, num);
for (int i = curNum; i < num; i++)
{
plPassMtl *newMtl = TRACKED_NEW plPassMtl(false);
fPassesPB->SetValue(kMultPasses, t, newMtl, i);
fPassesPB->SetValue(kMultOn, t, TRUE, i);
GetCOREInterface()->AssignNewName(fPassesPB->GetMtl(kMultPasses, t, i));
}
}
/*==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/>.
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 "hsTypes.h"
#include "plMultipassMtl.h"
#include "plPassMtl.h"
#include "plMultipassMtlPB.h"
#include "plMultipassMtlDlg.h"
class plMultipassClassDesc : public ClassDesc2
{
public:
int IsPublic() { return TRUE; }
void* Create(BOOL loading) { return TRACKED_NEW plMultipassMtl(loading); }
const TCHAR* ClassName() { return GetString(IDS_MULTI_MTL); }
SClass_ID SuperClassID() { return MATERIAL_CLASS_ID; }
Class_ID ClassID() { return MULTIMTL_CLASS_ID; }
const TCHAR* Category() { return NULL; }
const TCHAR* InternalName() { return _T("PlasmaMultipass"); }
HINSTANCE HInstance() { return hInstance; }
};
static plMultipassClassDesc plMultipassMtlDesc;
ClassDesc2* GetMultiMtlDesc() { return &plMultipassMtlDesc; }
#include "plMultipassMtlPB.cpp"
plMultipassMtl::plMultipassMtl(BOOL loading) : fPassesPB(NULL)
{
plMultipassMtlDesc.MakeAutoParamBlocks(this);
if (!loading)
Reset();
SetNumSubMtls(1);
}
void plMultipassMtl::Reset()
{
fIValid.SetEmpty();
}
ParamDlg* plMultipassMtl::CreateParamDlg(HWND hwMtlEdit, IMtlParams *imp)
{
fMtlDlg = TRACKED_NEW plMultipassMtlDlg(hwMtlEdit, imp, this);
return fMtlDlg;
}
void plMultipassMtl::SetParamDlg(ParamDlg *dlg)
{
fMtlDlg = (plMultipassMtlDlg*)dlg;
}
BOOL plMultipassMtl::SetDlgThing(ParamDlg* dlg)
{
if (dlg == fMtlDlg)
{
fMtlDlg->SetThing(this);
return TRUE;
}
return FALSE;
}
Interval plMultipassMtl::Validity(TimeValue t)
{
Interval valid = FOREVER;
/* for (int i = 0; i < fSubTexmap.Count(); i++)
{
if (fSubTexmap[i])
valid &= fSubTexmap[i]->Validity(t);
}
*/
// float u;
// fPBlock->GetValue(pb_spin,t,u,valid);
return valid;
}
/*===========================================================================*\
| Subanim & References support
\*===========================================================================*/
int plMultipassMtl::NumSubs()
{
return NumSubMtls();
}
TSTR plMultipassMtl::SubAnimName(int i)
{
return GetSubMtlSlotName(i);
}
Animatable* plMultipassMtl::SubAnim(int i)
{
return GetSubMtl(i);
}
int plMultipassMtl::NumRefs()
{
return 1;
}
RefTargetHandle plMultipassMtl::GetReference(int i)
{
if (i == kRefPasses)
return fPassesPB;
return NULL;
}
void plMultipassMtl::SetReference(int i, RefTargetHandle rtarg)
{
if (i == kRefPasses)
fPassesPB = (IParamBlock2 *)rtarg;
}
int plMultipassMtl::NumParamBlocks()
{
return 1;
}
IParamBlock2 *plMultipassMtl::GetParamBlock(int i)
{
if (i == kRefPasses)
return fPassesPB;
return NULL;
}
IParamBlock2 *plMultipassMtl::GetParamBlockByID(BlockID id)
{
if (fPassesPB->ID() == id)
return fPassesPB;
return NULL;
}
RefResult plMultipassMtl::NotifyRefChanged(Interval changeInt, RefTargetHandle hTarget,
PartID& partID, RefMessage message )
{
switch (message)
{
case REFMSG_CHANGE:
fIValid.SetEmpty();
if (hTarget == fPassesPB)
{
ParamID changingParam = fPassesPB->LastNotifyParamID();
fPassesPB->GetDesc()->InvalidateUI(changingParam);
}
break;
}
return REF_SUCCEED;
}
////////////////////////////////////////////////////////////////////////////////
// Subtexmap access
int plMultipassMtl::NumSubMtls()
{
return fPassesPB->GetInt(kMultCount);
}
Mtl *plMultipassMtl::GetSubMtl(int i)
{
if (i < NumSubMtls())
return fPassesPB->GetMtl(kMultPasses, 0, i);
return NULL;
}
void plMultipassMtl::SetSubMtl(int i, Mtl *m)
{
if (i < NumSubMtls())
fPassesPB->SetValue(kMultPasses, 0, m, i);
}
TSTR plMultipassMtl::GetSubMtlSlotName(int i)
{
TSTR str;
str.printf("Pass %d", i+1);
return str;
}
TSTR plMultipassMtl::GetSubMtlTVName(int i)
{
return GetSubMtlSlotName(i);
}
/*===========================================================================*\
| Standard IO
\*===========================================================================*/
#define MTL_HDR_CHUNK 0x4000
IOResult plMultipassMtl::Save(ISave *isave)
{
IOResult res;
isave->BeginChunk(MTL_HDR_CHUNK);
res = MtlBase::Save(isave);
if (res!=IO_OK) return res;
isave->EndChunk();
return IO_OK;
}
IOResult plMultipassMtl::Load(ILoad *iload)
{
IOResult res;
int id;
while (IO_OK==(res=iload->OpenChunk()))
{
switch(id = iload->CurChunkID())
{
case MTL_HDR_CHUNK:
res = MtlBase::Load(iload);
break;
}
iload->CloseChunk();
if (res!=IO_OK)
return res;
}
return IO_OK;
}
/*===========================================================================*\
| Updating and cloning
\*===========================================================================*/
RefTargetHandle plMultipassMtl::Clone(RemapDir &remap)
{
plMultipassMtl *mnew = TRACKED_NEW plMultipassMtl(FALSE);
*((MtlBase*)mnew) = *((MtlBase*)this);
mnew->ReplaceReference(kRefPasses, remap.CloneRef(fPassesPB));
mnew->fIValid.SetEmpty();
BaseClone(this, mnew, remap);
return (RefTargetHandle)mnew;
}
void plMultipassMtl::NotifyChanged()
{
NotifyDependents(FOREVER, PART_ALL, REFMSG_CHANGE);
}
void plMultipassMtl::Update(TimeValue t, Interval& valid)
{
if (!fIValid.InInterval(t))
{
fIValid.SetInfinite();
// fPassesPB->GetValue(kMtlLayLayer1On, t, fMapOn[0], fIValid);
for (int i = 0; i < NumSubMtls(); i++)
{
if (GetSubMtl(i))
GetSubMtl(i)->Update(t, fIValid);
}
}
valid &= fIValid;
}
/*===========================================================================*\
| Determine the characteristics of the material
\*===========================================================================*/
void plMultipassMtl::SetAmbient(Color c, TimeValue t) {}
void plMultipassMtl::SetDiffuse(Color c, TimeValue t) {}
void plMultipassMtl::SetSpecular(Color c, TimeValue t) {}
void plMultipassMtl::SetShininess(float v, TimeValue t) {}
Color plMultipassMtl::GetAmbient(int mtlNum, BOOL backFace) { return Color(0,0,0); }
Color plMultipassMtl::GetDiffuse(int mtlNum, BOOL backFace) { return Color(0,0,0); }
Color plMultipassMtl::GetSpecular(int mtlNum, BOOL backFace) { return Color(0,0,0); }
float plMultipassMtl::GetXParency(int mtlNum, BOOL backFace) { return 0.0f; }
float plMultipassMtl::GetShininess(int mtlNum, BOOL backFace) { return 0.0f; }
float plMultipassMtl::GetShinStr(int mtlNum, BOOL backFace) { return 0.0f; }
float plMultipassMtl::WireSize(int mtlNum, BOOL backFace) { return 0.0f; }
/*===========================================================================*\
| Actual shading takes place
\*===========================================================================*/
void plMultipassMtl::Shade(ShadeContext& sc)
{
// Get the background color
Color backColor, backTrans;
backColor.Black();
backTrans.White();
int count = NumSubMtls();
for (int i = 0; i < count; i++)
{
if (fPassesPB->GetInt(kMultOn, 0, i) == 0)
continue;
// Call each pass' shade function with the previous color
Mtl *mtl = GetSubMtl(i);
//backTrans = Color(0,0,0);
if (mtl->ClassID() == PASS_MTL_CLASS_ID)
{
plPassMtl *passMtl = (plPassMtl*)mtl;
passMtl->ShadeWithBackground(sc, backColor);
backTrans *= sc.out.t;
backColor = backColor * sc.out.t + sc.out.c;
}
}
sc.out.t = backTrans;
sc.out.c = backColor;
}
float plMultipassMtl::EvalDisplacement(ShadeContext& sc)
{
return 0.0f;
}
Interval plMultipassMtl::DisplacementValidity(TimeValue t)
{
Interval iv;
iv.SetInfinite();
return iv;
}
void plMultipassMtl::SetNumSubMtls(int num)
{
TimeValue t = GetCOREInterface()->GetTime();
int curNum = fPassesPB->GetInt(kMultCount);
fPassesPB->SetValue(kMultCount, 0, num);
fPassesPB->SetCount(kMultPasses, num);
fPassesPB->SetCount(kMultOn, num);
fPassesPB->SetCount(kMultLayerCounts, num);
for (int i = curNum; i < num; i++)
{
plPassMtl *newMtl = TRACKED_NEW plPassMtl(false);
fPassesPB->SetValue(kMultPasses, t, newMtl, i);
fPassesPB->SetValue(kMultOn, t, TRUE, i);
GetCOREInterface()->AssignNewName(fPassesPB->GetMtl(kMultPasses, t, i));
}
}

View File

@ -1,120 +1,120 @@
/*==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/>.
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 __PLMAXMTL__H
#define __PLMAXMTL__H
#include "Max.h"
#include "../resource.h"
#include "istdplug.h"
#include "iparamb2.h"
#include "iparamm2.h"
extern TCHAR *GetString(int id);
extern HINSTANCE hInstance;
#define MULTIMTL_CLASS_ID Class_ID(0x3f687a, 0x28c62bd7)
class plMultipassMtlDlg;
class plMultipassMtl : public Mtl
{
protected:
IParamBlock2 *fPassesPB;
Interval fIValid;
plMultipassMtlDlg *fMtlDlg;
public:
enum { kRefPasses };
enum { kBlkPasses };
ParamDlg *CreateParamDlg(HWND hwMtlEdit, IMtlParams *imp);
void Update(TimeValue t, Interval& valid);
Interval Validity(TimeValue t);
void Reset();
void NotifyChanged();
// From MtlBase and Mtl
void SetAmbient(Color c, TimeValue t);
void SetDiffuse(Color c, TimeValue t);
void SetSpecular(Color c, TimeValue t);
void SetShininess(float v, TimeValue t);
Color GetAmbient(int mtlNum=0, BOOL backFace=FALSE);
Color GetDiffuse(int mtlNum=0, BOOL backFace=FALSE);
Color GetSpecular(int mtlNum=0, BOOL backFace=FALSE);
float GetXParency(int mtlNum=0, BOOL backFace=FALSE);
float GetShininess(int mtlNum=0, BOOL backFace=FALSE);
float GetShinStr(int mtlNum=0, BOOL backFace=FALSE);
float WireSize(int mtlNum=0, BOOL backFace=FALSE);
// Shade and displacement calculation
void Shade(ShadeContext& sc);
float EvalDisplacement(ShadeContext& sc);
Interval DisplacementValidity(TimeValue t);
// SubTexmap access methods
int NumSubMtls();
Mtl* GetSubMtl(int i);
void SetSubMtl(int i, Mtl *m);
TSTR GetSubMtlSlotName(int i);
TSTR GetSubMtlTVName(int i);
BOOL SetDlgThing(ParamDlg* dlg);
plMultipassMtl(BOOL loading);
// Loading/Saving
IOResult Load(ILoad *iload);
IOResult Save(ISave *isave);
//From Animatable
Class_ID ClassID() { return MULTIMTL_CLASS_ID; }
SClass_ID SuperClassID() { return MATERIAL_CLASS_ID; }
void GetClassName(TSTR& s) { s = GetString(IDS_MULTI_MTL); }
RefTargetHandle Clone(RemapDir &remap);
RefResult NotifyRefChanged(Interval changeInt, RefTargetHandle hTarget,
PartID& partID, RefMessage message);
int NumSubs();
Animatable* SubAnim(int i);
TSTR SubAnimName(int i);
int NumRefs();
RefTargetHandle GetReference(int i);
void SetReference(int i, RefTargetHandle rtarg);
int NumParamBlocks();
IParamBlock2* GetParamBlock(int i);
IParamBlock2* GetParamBlockByID(BlockID id);
void DeleteThis() { delete this; }
void SetParamDlg(ParamDlg *dlg);
void SetNumSubMtls(int num);
};
#endif // __PLMAXMTL__H
/*==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/>.
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 __PLMAXMTL__H
#define __PLMAXMTL__H
#include "Max.h"
#include "../resource.h"
#include "istdplug.h"
#include "iparamb2.h"
#include "iparamm2.h"
extern TCHAR *GetString(int id);
extern HINSTANCE hInstance;
#define MULTIMTL_CLASS_ID Class_ID(0x3f687a, 0x28c62bd7)
class plMultipassMtlDlg;
class plMultipassMtl : public Mtl
{
protected:
IParamBlock2 *fPassesPB;
Interval fIValid;
plMultipassMtlDlg *fMtlDlg;
public:
enum { kRefPasses };
enum { kBlkPasses };
ParamDlg *CreateParamDlg(HWND hwMtlEdit, IMtlParams *imp);
void Update(TimeValue t, Interval& valid);
Interval Validity(TimeValue t);
void Reset();
void NotifyChanged();
// From MtlBase and Mtl
void SetAmbient(Color c, TimeValue t);
void SetDiffuse(Color c, TimeValue t);
void SetSpecular(Color c, TimeValue t);
void SetShininess(float v, TimeValue t);
Color GetAmbient(int mtlNum=0, BOOL backFace=FALSE);
Color GetDiffuse(int mtlNum=0, BOOL backFace=FALSE);
Color GetSpecular(int mtlNum=0, BOOL backFace=FALSE);
float GetXParency(int mtlNum=0, BOOL backFace=FALSE);
float GetShininess(int mtlNum=0, BOOL backFace=FALSE);
float GetShinStr(int mtlNum=0, BOOL backFace=FALSE);
float WireSize(int mtlNum=0, BOOL backFace=FALSE);
// Shade and displacement calculation
void Shade(ShadeContext& sc);
float EvalDisplacement(ShadeContext& sc);
Interval DisplacementValidity(TimeValue t);
// SubTexmap access methods
int NumSubMtls();
Mtl* GetSubMtl(int i);
void SetSubMtl(int i, Mtl *m);
TSTR GetSubMtlSlotName(int i);
TSTR GetSubMtlTVName(int i);
BOOL SetDlgThing(ParamDlg* dlg);
plMultipassMtl(BOOL loading);
// Loading/Saving
IOResult Load(ILoad *iload);
IOResult Save(ISave *isave);
//From Animatable
Class_ID ClassID() { return MULTIMTL_CLASS_ID; }
SClass_ID SuperClassID() { return MATERIAL_CLASS_ID; }
void GetClassName(TSTR& s) { s = GetString(IDS_MULTI_MTL); }
RefTargetHandle Clone(RemapDir &remap);
RefResult NotifyRefChanged(Interval changeInt, RefTargetHandle hTarget,
PartID& partID, RefMessage message);
int NumSubs();
Animatable* SubAnim(int i);
TSTR SubAnimName(int i);
int NumRefs();
RefTargetHandle GetReference(int i);
void SetReference(int i, RefTargetHandle rtarg);
int NumParamBlocks();
IParamBlock2* GetParamBlock(int i);
IParamBlock2* GetParamBlockByID(BlockID id);
void DeleteThis() { delete this; }
void SetParamDlg(ParamDlg *dlg);
void SetNumSubMtls(int num);
};
#endif // __PLMAXMTL__H

View File

@ -1,326 +1,326 @@
/*==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/>.
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 "hsTypes.h"
#include "max.h"
#include "MaxIcon.h"
#include "resource.h"
#include "plMultipassMtl.h"
#include "plMultipassMtlPB.h"
//#include "plMaxLayer.h"
#include "plMultipassMtlDlg.h"
struct LayerID
{
int layerID;
int activeID;
};
static LayerID kLayerID[] =
{
{ IDC_TEX1, IDC_TEXON1 },
{ IDC_TEX2, IDC_TEXON2 },
{ IDC_TEX3, IDC_TEXON3 },
{ IDC_TEX4, IDC_TEXON4 },
{ IDC_TEX5, IDC_TEXON5 },
{ IDC_TEX6, IDC_TEXON6 },
{ IDC_TEX7, IDC_TEXON7 },
{ IDC_TEX8, IDC_TEXON8 },
{ IDC_TEX9, IDC_TEXON9 },
{ IDC_TEX10, IDC_TEXON10 },
};
//-----------------------------------------------------------------------------
// Constructor and destructor
//-----------------------------------------------------------------------------
plMultipassMtlDlg::plMultipassMtlDlg(HWND hwMtlEdit, IMtlParams *imp, plMultipassMtl *m)
{
fDADMgr.Init(this);
fhMtlEdit = hwMtlEdit;
fhRollup = NULL;
fMtl = m;
fPBlock = fMtl->GetParamBlockByID(plMultipassMtl::kBlkPasses);
ip = imp;
valid = FALSE;
for (int i = 0; i < NSUBMTLS; i++)
fLayerBtns[i] = NULL;
curTime = imp->GetTime();
fhRollup = ip->AddRollupPage(
hInstance,
MAKEINTRESOURCE(IDD_MULTIPASS),
ForwardProc,
"Multipass Parameters",
(LPARAM)this);
}
plMultipassMtlDlg::~plMultipassMtlDlg()
{
fMtl->SetParamDlg(NULL);
for (int i = 0; i < NSUBMTLS; i++)
{
ReleaseICustButton(fLayerBtns[i]);
fLayerBtns[i] = NULL;
}
SetWindowLong(fhRollup, GWL_USERDATA, NULL);
ip->DeleteRollupPage(fhRollup);
fhRollup = NULL;
}
//-----------------------------------------------------------------------------
// Functions inheirited from ParamDlg
//-----------------------------------------------------------------------------
void plMultipassMtlDlg::SetThing(ReferenceTarget *m)
{
assert(m->SuperClassID() == MATERIAL_CLASS_ID);
assert(m->ClassID() == MULTIMTL_CLASS_ID);
// Bad?
if (fMtl)
fMtl->SetParamDlg(NULL);
fMtl = (plMultipassMtl *)m;
if (fMtl)
fMtl->SetParamDlg(this);
LoadDialog();
IUpdateMtlDisplay();
}
void plMultipassMtlDlg::SetTime(TimeValue t)
{
if (t != curTime)
{
curTime = t;
Interval v;
fMtl->Update(ip->GetTime(),v);
LoadDialog();
IUpdateMtlDisplay();
}
}
void plMultipassMtlDlg::ReloadDialog()
{
Interval v;
fMtl->Update(ip->GetTime(), v);
LoadDialog();
}
void plMultipassMtlDlg::ActivateDlg(BOOL onOff)
{
}
int plMultipassMtlDlg::FindSubMtlFromHWND(HWND hwnd)
{
for (int i = 0; i < NSUBMTLS; i++)
{
if (hwnd == fLayerBtns[i]->GetHwnd())
return i;
}
return -1;
}
BOOL plMultipassMtlDlg::ForwardProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
plMultipassMtlDlg *theDlg;
if (msg == WM_INITDIALOG)
{
theDlg = (plMultipassMtlDlg*)lParam;
theDlg->fhRollup = hDlg;
SetWindowLong(hDlg, GWL_USERDATA, lParam);
}
else
{
if ((theDlg = (plMultipassMtlDlg *)GetWindowLong(hDlg, GWL_USERDATA)) == NULL)
return FALSE;
}
return theDlg->LayerPanelProc(hDlg,msg,wParam,lParam);
}
//----------------------------------------------------------------------------
// Layer panel processor
//----------------------------------------------------------------------------
BOOL plMultipassMtlDlg::LayerPanelProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
int id = LOWORD(wParam);
int code = HIWORD(wParam);
int i;
switch (msg)
{
case WM_INITDIALOG:
{
int nLayers = fPBlock->GetInt(kMultCount);
for (i = 0; i < NSUBMTLS; i++)
{
fLayerBtns[i] = GetICustButton(GetDlgItem(hDlg, kLayerID[i].layerID));
fLayerBtns[i]->SetDADMgr(&fDADMgr);
/* if (i < nLayers)
{
SetCheckBox(hDlg, kLayerID[i].activeID, fPBlock->GetInt(kMtlLayerOn, curTime, i));
}
*/
fNumTexSpin = SetupIntSpinner(hDlg, IDC_LAYER_SPIN, IDC_LAYER_EDIT, 1, 10, nLayers);
}
// TEMP testing
UpdateLayerDisplay();
IUpdateMtlDisplay();
}
return TRUE;
case WM_DESTROY:
for (i = 0; i < NSUBMTLS; i++)
{
ReleaseICustButton(fLayerBtns[i]);
fLayerBtns[i] = NULL;
}
ReleaseISpinner(fNumTexSpin);
fNumTexSpin = NULL;
break;
case CC_SPINNER_CHANGE:
if (id == IDC_LAYER_SPIN && !code)
{
IGetSpinnerVal();
return TRUE;
}
break;
case CC_SPINNER_BUTTONUP:
if (id == IDC_LAYER_SPIN && code)
{
IGetSpinnerVal();
return TRUE;
}
break;
case WM_COMMAND:
{
for (i = 0; i < NSUBMTLS; i++)
{
if (id == kLayerID[i].activeID)
{
// fMtl->EnableMap(i,GetCheckBox(hwndDlg, id));
bool checked = SendMessage(GetDlgItem(hDlg, id), BM_GETCHECK, 0, 0) == BST_CHECKED;
fPBlock->SetValue(kMultOn, curTime, checked, i);
return TRUE;
}
if (id == kLayerID[i].layerID)
{
PostMessage(fhMtlEdit, WM_SUB_MTL_BUTTON, i, (LPARAM)fMtl);
return TRUE;
}
}
}
// IUpdateMtlDisplay();
break;
}
return FALSE;
}
void plMultipassMtlDlg::UpdateLayerDisplay()
{
int numlayers = fPBlock->GetInt(kMultCount);
fNumTexSpin->SetValue(numlayers, FALSE);
int i;
for (i = 0; i < numlayers && i < NSUBMTLS; i++)
{
Mtl *m = fPBlock->GetMtl(kMultPasses, curTime, i);
TSTR nm;
if (m)
nm = m->GetName();
else
nm = "None";
fLayerBtns[i]->SetText(nm.data());
ShowWindow(GetDlgItem(fhRollup, kLayerID[i].layerID), SW_SHOW);
ShowWindow(GetDlgItem(fhRollup, kLayerID[i].activeID), SW_SHOW);
SetCheckBox(fhRollup, kLayerID[i].activeID, fPBlock->GetInt(kMultOn, curTime, i));
}
for (i = numlayers; i < NSUBMTLS; i++)
{
ShowWindow(GetDlgItem(fhRollup, kLayerID[i].layerID), SW_HIDE);
ShowWindow(GetDlgItem(fhRollup, kLayerID[i].activeID), SW_HIDE);
}
}
void plMultipassMtlDlg::LoadDialog()
{
if (fMtl)
{
fPBlock = fMtl->GetParamBlockByID(plMultipassMtl::kBlkPasses);
if (fhRollup)
UpdateLayerDisplay();
}
}
bool plMultipassMtlDlg::ISetNumLayers(int num)
{
if (num >= 1 && num <= NSUBMTLS)
{
fMtl->SetNumSubMtls(num);
UpdateLayerDisplay();
// IUpdateMtlDisplay();
return true;
}
return false;
}
void plMultipassMtlDlg::IGetSpinnerVal()
{
ISpinnerControl *spin = GetISpinner(GetDlgItem(fhRollup, IDC_LAYER_SPIN));
if (!spin)
return;
// If new number of layers is invalid, set to current num
if (!ISetNumLayers(spin->GetIVal()))
{
int nLayers = fPBlock->GetInt(kMultCount);
spin->SetValue(nLayers, FALSE);
}
ReleaseISpinner(spin);
}
/*==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/>.
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 "hsTypes.h"
#include "max.h"
#include "MaxIcon.h"
#include "resource.h"
#include "plMultipassMtl.h"
#include "plMultipassMtlPB.h"
//#include "plMaxLayer.h"
#include "plMultipassMtlDlg.h"
struct LayerID
{
int layerID;
int activeID;
};
static LayerID kLayerID[] =
{
{ IDC_TEX1, IDC_TEXON1 },
{ IDC_TEX2, IDC_TEXON2 },
{ IDC_TEX3, IDC_TEXON3 },
{ IDC_TEX4, IDC_TEXON4 },
{ IDC_TEX5, IDC_TEXON5 },
{ IDC_TEX6, IDC_TEXON6 },
{ IDC_TEX7, IDC_TEXON7 },
{ IDC_TEX8, IDC_TEXON8 },
{ IDC_TEX9, IDC_TEXON9 },
{ IDC_TEX10, IDC_TEXON10 },
};
//-----------------------------------------------------------------------------
// Constructor and destructor
//-----------------------------------------------------------------------------
plMultipassMtlDlg::plMultipassMtlDlg(HWND hwMtlEdit, IMtlParams *imp, plMultipassMtl *m)
{
fDADMgr.Init(this);
fhMtlEdit = hwMtlEdit;
fhRollup = NULL;
fMtl = m;
fPBlock = fMtl->GetParamBlockByID(plMultipassMtl::kBlkPasses);
ip = imp;
valid = FALSE;
for (int i = 0; i < NSUBMTLS; i++)
fLayerBtns[i] = NULL;
curTime = imp->GetTime();
fhRollup = ip->AddRollupPage(
hInstance,
MAKEINTRESOURCE(IDD_MULTIPASS),
ForwardProc,
"Multipass Parameters",
(LPARAM)this);
}
plMultipassMtlDlg::~plMultipassMtlDlg()
{
fMtl->SetParamDlg(NULL);
for (int i = 0; i < NSUBMTLS; i++)
{
ReleaseICustButton(fLayerBtns[i]);
fLayerBtns[i] = NULL;
}
SetWindowLong(fhRollup, GWL_USERDATA, NULL);
ip->DeleteRollupPage(fhRollup);
fhRollup = NULL;
}
//-----------------------------------------------------------------------------
// Functions inheirited from ParamDlg
//-----------------------------------------------------------------------------
void plMultipassMtlDlg::SetThing(ReferenceTarget *m)
{
assert(m->SuperClassID() == MATERIAL_CLASS_ID);
assert(m->ClassID() == MULTIMTL_CLASS_ID);
// Bad?
if (fMtl)
fMtl->SetParamDlg(NULL);
fMtl = (plMultipassMtl *)m;
if (fMtl)
fMtl->SetParamDlg(this);
LoadDialog();
IUpdateMtlDisplay();
}
void plMultipassMtlDlg::SetTime(TimeValue t)
{
if (t != curTime)
{
curTime = t;
Interval v;
fMtl->Update(ip->GetTime(),v);
LoadDialog();
IUpdateMtlDisplay();
}
}
void plMultipassMtlDlg::ReloadDialog()
{
Interval v;
fMtl->Update(ip->GetTime(), v);
LoadDialog();
}
void plMultipassMtlDlg::ActivateDlg(BOOL onOff)
{
}
int plMultipassMtlDlg::FindSubMtlFromHWND(HWND hwnd)
{
for (int i = 0; i < NSUBMTLS; i++)
{
if (hwnd == fLayerBtns[i]->GetHwnd())
return i;
}
return -1;
}
BOOL plMultipassMtlDlg::ForwardProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
plMultipassMtlDlg *theDlg;
if (msg == WM_INITDIALOG)
{
theDlg = (plMultipassMtlDlg*)lParam;
theDlg->fhRollup = hDlg;
SetWindowLong(hDlg, GWL_USERDATA, lParam);
}
else
{
if ((theDlg = (plMultipassMtlDlg *)GetWindowLong(hDlg, GWL_USERDATA)) == NULL)
return FALSE;
}
return theDlg->LayerPanelProc(hDlg,msg,wParam,lParam);
}
//----------------------------------------------------------------------------
// Layer panel processor
//----------------------------------------------------------------------------
BOOL plMultipassMtlDlg::LayerPanelProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
int id = LOWORD(wParam);
int code = HIWORD(wParam);
int i;
switch (msg)
{
case WM_INITDIALOG:
{
int nLayers = fPBlock->GetInt(kMultCount);
for (i = 0; i < NSUBMTLS; i++)
{
fLayerBtns[i] = GetICustButton(GetDlgItem(hDlg, kLayerID[i].layerID));
fLayerBtns[i]->SetDADMgr(&fDADMgr);
/* if (i < nLayers)
{
SetCheckBox(hDlg, kLayerID[i].activeID, fPBlock->GetInt(kMtlLayerOn, curTime, i));
}
*/
fNumTexSpin = SetupIntSpinner(hDlg, IDC_LAYER_SPIN, IDC_LAYER_EDIT, 1, 10, nLayers);
}
// TEMP testing
UpdateLayerDisplay();
IUpdateMtlDisplay();
}
return TRUE;
case WM_DESTROY:
for (i = 0; i < NSUBMTLS; i++)
{
ReleaseICustButton(fLayerBtns[i]);
fLayerBtns[i] = NULL;
}
ReleaseISpinner(fNumTexSpin);
fNumTexSpin = NULL;
break;
case CC_SPINNER_CHANGE:
if (id == IDC_LAYER_SPIN && !code)
{
IGetSpinnerVal();
return TRUE;
}
break;
case CC_SPINNER_BUTTONUP:
if (id == IDC_LAYER_SPIN && code)
{
IGetSpinnerVal();
return TRUE;
}
break;
case WM_COMMAND:
{
for (i = 0; i < NSUBMTLS; i++)
{
if (id == kLayerID[i].activeID)
{
// fMtl->EnableMap(i,GetCheckBox(hwndDlg, id));
bool checked = SendMessage(GetDlgItem(hDlg, id), BM_GETCHECK, 0, 0) == BST_CHECKED;
fPBlock->SetValue(kMultOn, curTime, checked, i);
return TRUE;
}
if (id == kLayerID[i].layerID)
{
PostMessage(fhMtlEdit, WM_SUB_MTL_BUTTON, i, (LPARAM)fMtl);
return TRUE;
}
}
}
// IUpdateMtlDisplay();
break;
}
return FALSE;
}
void plMultipassMtlDlg::UpdateLayerDisplay()
{
int numlayers = fPBlock->GetInt(kMultCount);
fNumTexSpin->SetValue(numlayers, FALSE);
int i;
for (i = 0; i < numlayers && i < NSUBMTLS; i++)
{
Mtl *m = fPBlock->GetMtl(kMultPasses, curTime, i);
TSTR nm;
if (m)
nm = m->GetName();
else
nm = "None";
fLayerBtns[i]->SetText(nm.data());
ShowWindow(GetDlgItem(fhRollup, kLayerID[i].layerID), SW_SHOW);
ShowWindow(GetDlgItem(fhRollup, kLayerID[i].activeID), SW_SHOW);
SetCheckBox(fhRollup, kLayerID[i].activeID, fPBlock->GetInt(kMultOn, curTime, i));
}
for (i = numlayers; i < NSUBMTLS; i++)
{
ShowWindow(GetDlgItem(fhRollup, kLayerID[i].layerID), SW_HIDE);
ShowWindow(GetDlgItem(fhRollup, kLayerID[i].activeID), SW_HIDE);
}
}
void plMultipassMtlDlg::LoadDialog()
{
if (fMtl)
{
fPBlock = fMtl->GetParamBlockByID(plMultipassMtl::kBlkPasses);
if (fhRollup)
UpdateLayerDisplay();
}
}
bool plMultipassMtlDlg::ISetNumLayers(int num)
{
if (num >= 1 && num <= NSUBMTLS)
{
fMtl->SetNumSubMtls(num);
UpdateLayerDisplay();
// IUpdateMtlDisplay();
return true;
}
return false;
}
void plMultipassMtlDlg::IGetSpinnerVal()
{
ISpinnerControl *spin = GetISpinner(GetDlgItem(fhRollup, IDC_LAYER_SPIN));
if (!spin)
return;
// If new number of layers is invalid, set to current num
if (!ISetNumLayers(spin->GetIVal()))
{
int nLayers = fPBlock->GetInt(kMultCount);
spin->SetValue(nLayers, FALSE);
}
ReleaseISpinner(spin);
}

View File

@ -1,89 +1,89 @@
/*==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/>.
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 PL_MAXMTLDLG_H
#define PL_MAXMTLDLG_H
#define NSUBMTLS 10
class plMultipassMtlDlg : public ParamDlg
{
protected:
IParamBlock2 *fPBlock;
HWND fhMtlEdit; // Window handle of the materials editor dialog
HWND fhRollup; // Our rollup panel
IMtlParams *ip;
plMultipassMtl *fMtl; // current mtl being edited.
TimeValue curTime;
int isActive;
BOOL valid;
// int offset;
ISpinnerControl *fNumTexSpin;
ICustButton *fLayerBtns[NSUBMTLS];
MtlDADMgr fDADMgr; // For drag-drop sub-materials
public:
// Constructor and destructor
plMultipassMtlDlg(HWND hwMtlEdit, IMtlParams *imp, plMultipassMtl *m);
~plMultipassMtlDlg();
// Functions inherited from ParamDLg:
Class_ID ClassID() { return MULTIMTL_CLASS_ID; }
void SetThing(ReferenceTarget *m);
ReferenceTarget* GetThing() { return (ReferenceTarget*)fMtl; }
void SetTime(TimeValue t);
void ReloadDialog();
void ActivateDlg(BOOL onOff);
void DeleteThis() { delete this; }
int FindSubMtlFromHWND(HWND hw);
static BOOL CALLBACK ForwardProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam);
BOOL LayerPanelProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
void UpdateLayerDisplay();
void LoadDialog();
/*
// Lower-level crap
void Invalidate(); // Called by ParamMtl
BOOL IsActive() { return isActive; }
private:
void ClampOffset();
void SetNumMats();
void UpdateLayers();
void UpdateControlFor(int np);
void VScroll(int code, short int cpos );
*/
protected:
void IUpdateMtlDisplay() { if (ip) ip->MtlChanged(); }
bool ISetNumLayers(int num);
void IGetSpinnerVal();
};
#endif
/*==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/>.
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 PL_MAXMTLDLG_H
#define PL_MAXMTLDLG_H
#define NSUBMTLS 10
class plMultipassMtlDlg : public ParamDlg
{
protected:
IParamBlock2 *fPBlock;
HWND fhMtlEdit; // Window handle of the materials editor dialog
HWND fhRollup; // Our rollup panel
IMtlParams *ip;
plMultipassMtl *fMtl; // current mtl being edited.
TimeValue curTime;
int isActive;
BOOL valid;
// int offset;
ISpinnerControl *fNumTexSpin;
ICustButton *fLayerBtns[NSUBMTLS];
MtlDADMgr fDADMgr; // For drag-drop sub-materials
public:
// Constructor and destructor
plMultipassMtlDlg(HWND hwMtlEdit, IMtlParams *imp, plMultipassMtl *m);
~plMultipassMtlDlg();
// Functions inherited from ParamDLg:
Class_ID ClassID() { return MULTIMTL_CLASS_ID; }
void SetThing(ReferenceTarget *m);
ReferenceTarget* GetThing() { return (ReferenceTarget*)fMtl; }
void SetTime(TimeValue t);
void ReloadDialog();
void ActivateDlg(BOOL onOff);
void DeleteThis() { delete this; }
int FindSubMtlFromHWND(HWND hw);
static BOOL CALLBACK ForwardProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam);
BOOL LayerPanelProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
void UpdateLayerDisplay();
void LoadDialog();
/*
// Lower-level crap
void Invalidate(); // Called by ParamMtl
BOOL IsActive() { return isActive; }
private:
void ClampOffset();
void SetNumMats();
void UpdateLayers();
void UpdateControlFor(int np);
void VScroll(int code, short int cpos );
*/
protected:
void IUpdateMtlDisplay() { if (ip) ip->MtlChanged(); }
bool ISetNumLayers(int num);
void IGetSpinnerVal();
};
#endif

View File

@ -1,50 +1,50 @@
/*==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/>.
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 "hsTypes.h"
#include "plMultipassMtl.h"
#include "plMultipassMtlPB.h"
ClassDesc2* GetMultiMtlDesc();
static ParamBlockDesc2 gMultipassMtlPB
(
plMultipassMtl::kBlkPasses, _T("multipass"), 0, GetMultiMtlDesc(),
P_AUTO_CONSTRUCT, plMultipassMtl::kRefPasses,
kMultCount, _T("numPasses"), TYPE_INT, 0, 0,
p_default, 0,
end,
kMultPasses, _T("passes"), TYPE_MTL_TAB, 0, 0, 0,
end,
kMultOn, _T("passOn"), TYPE_BOOL_TAB, 0, 0, 0,
p_default, TRUE,
end,
kMultLayerCounts, _T("LayerCounts"), TYPE_INT_TAB, 0, 0, 0,
p_default, 0,
end,
end
);
/*==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/>.
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 "hsTypes.h"
#include "plMultipassMtl.h"
#include "plMultipassMtlPB.h"
ClassDesc2* GetMultiMtlDesc();
static ParamBlockDesc2 gMultipassMtlPB
(
plMultipassMtl::kBlkPasses, _T("multipass"), 0, GetMultiMtlDesc(),
P_AUTO_CONSTRUCT, plMultipassMtl::kRefPasses,
kMultCount, _T("numPasses"), TYPE_INT, 0, 0,
p_default, 0,
end,
kMultPasses, _T("passes"), TYPE_MTL_TAB, 0, 0, 0,
end,
kMultOn, _T("passOn"), TYPE_BOOL_TAB, 0, 0, 0,
p_default, TRUE,
end,
kMultLayerCounts, _T("LayerCounts"), TYPE_INT_TAB, 0, 0, 0,
p_default, 0,
end,
end
);

View File

@ -1,37 +1,37 @@
/*==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/>.
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 PL_MULTIPASS_MTL_PB_H
#define PL_MULTIPASS_MTL_PB_H
enum
{
kMultCount,
kMultPasses,
kMultOn,
kMultLayerCounts
};
/*==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/>.
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 PL_MULTIPASS_MTL_PB_H
#define PL_MULTIPASS_MTL_PB_H
enum
{
kMultCount,
kMultPasses,
kMultOn,
kMultLayerCounts
};
#endif //PL_MULTIPASS_MTL_PB_H

View File

@ -1,127 +1,127 @@
/*==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/>.
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==*/
//////////////////////////////////////////////////////////////////////////////
// //
// plNoteTrackWatcher - Dummy object to watch for notetrack additions or //
// removals from the main material that owns it. //
// All of this is required because MAX will notify //
// an object's dependents about notetrack actions but //
// NOT the object itself, and the Add/DeleteNoteTrack //
// functions are non-virtual. ARRRGH! //
// //
//////////////////////////////////////////////////////////////////////////////
#include "hsTypes.h"
#include "plNoteTrackWatcher.h"
#include "plPassMtlBase.h"
#include "iparamm2.h"
#include "resource.h"
//// Watcher Class Desc //////////////////////////////////////////////////////
plNoteTrackWatcher::plNoteTrackWatcher( plPassMtlBase *parentMtl ) : fParentMtl(nil)
{
fNoteTrackCount = parentMtl->NumNoteTracks();
MakeRefByID( FOREVER, kRefParentMtl, parentMtl );
}
plNoteTrackWatcher::~plNoteTrackWatcher()
{
if( fParentMtl != nil )
{
fParentMtl->fNTWatcher = nil;
DeleteReference( kRefParentMtl );
}
DeleteAllRefsFromMe();
}
BOOL plNoteTrackWatcher::IsRealDependency( ReferenceTarget *rtarg )
{
if( rtarg == fParentMtl )
return false;
return true;
}
int plNoteTrackWatcher::NumRefs()
{
return 1;
}
RefTargetHandle plNoteTrackWatcher::GetReference( int i )
{
if( i == kRefParentMtl )
return fParentMtl;
return nil;
}
void plNoteTrackWatcher::SetReference( int i, RefTargetHandle rtarg )
{
if( i == kRefParentMtl )
fParentMtl = (plPassMtlBase *)rtarg;
}
RefResult plNoteTrackWatcher::NotifyRefChanged(Interval changeInt, RefTargetHandle hTarget, PartID& partID, RefMessage message)
{
switch( message )
{
case REFMSG_SUBANIM_STRUCTURE_CHANGED:
if( hTarget == fParentMtl && fParentMtl != nil )
{
// Structure of parent material changed--did it gain or lose a notetrack?
int oldCount = fNoteTrackCount;
fNoteTrackCount = fParentMtl->NumNoteTracks();
if( oldCount != fNoteTrackCount )
{
// Is it an addition?
if( fNoteTrackCount > oldCount )
// Yes, notify parent.
fParentMtl->NoteTrackAdded();
else
// Deletion, also notify parent
fParentMtl->NoteTrackRemoved();
}
}
break;
case REFMSG_NODE_NAMECHANGE:
if( hTarget == fParentMtl )
{
fParentMtl->NameChanged();
}
break;
case REFMSG_TARGET_DELETED:
fParentMtl = nil;
break;
}
return REF_SUCCEED;
}
/*==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/>.
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==*/
//////////////////////////////////////////////////////////////////////////////
// //
// plNoteTrackWatcher - Dummy object to watch for notetrack additions or //
// removals from the main material that owns it. //
// All of this is required because MAX will notify //
// an object's dependents about notetrack actions but //
// NOT the object itself, and the Add/DeleteNoteTrack //
// functions are non-virtual. ARRRGH! //
// //
//////////////////////////////////////////////////////////////////////////////
#include "hsTypes.h"
#include "plNoteTrackWatcher.h"
#include "plPassMtlBase.h"
#include "iparamm2.h"
#include "resource.h"
//// Watcher Class Desc //////////////////////////////////////////////////////
plNoteTrackWatcher::plNoteTrackWatcher( plPassMtlBase *parentMtl ) : fParentMtl(nil)
{
fNoteTrackCount = parentMtl->NumNoteTracks();
MakeRefByID( FOREVER, kRefParentMtl, parentMtl );
}
plNoteTrackWatcher::~plNoteTrackWatcher()
{
if( fParentMtl != nil )
{
fParentMtl->fNTWatcher = nil;
DeleteReference( kRefParentMtl );
}
DeleteAllRefsFromMe();
}
BOOL plNoteTrackWatcher::IsRealDependency( ReferenceTarget *rtarg )
{
if( rtarg == fParentMtl )
return false;
return true;
}
int plNoteTrackWatcher::NumRefs()
{
return 1;
}
RefTargetHandle plNoteTrackWatcher::GetReference( int i )
{
if( i == kRefParentMtl )
return fParentMtl;
return nil;
}
void plNoteTrackWatcher::SetReference( int i, RefTargetHandle rtarg )
{
if( i == kRefParentMtl )
fParentMtl = (plPassMtlBase *)rtarg;
}
RefResult plNoteTrackWatcher::NotifyRefChanged(Interval changeInt, RefTargetHandle hTarget, PartID& partID, RefMessage message)
{
switch( message )
{
case REFMSG_SUBANIM_STRUCTURE_CHANGED:
if( hTarget == fParentMtl && fParentMtl != nil )
{
// Structure of parent material changed--did it gain or lose a notetrack?
int oldCount = fNoteTrackCount;
fNoteTrackCount = fParentMtl->NumNoteTracks();
if( oldCount != fNoteTrackCount )
{
// Is it an addition?
if( fNoteTrackCount > oldCount )
// Yes, notify parent.
fParentMtl->NoteTrackAdded();
else
// Deletion, also notify parent
fParentMtl->NoteTrackRemoved();
}
}
break;
case REFMSG_NODE_NAMECHANGE:
if( hTarget == fParentMtl )
{
fParentMtl->NameChanged();
}
break;
case REFMSG_TARGET_DELETED:
fParentMtl = nil;
break;
}
return REF_SUCCEED;
}

View File

@ -1,88 +1,88 @@
/*==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/>.
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==*/
//////////////////////////////////////////////////////////////////////////////
// //
// plNoteTrackWatcher - Dummy object to watch for notetrack additions or //
// removals from the main material that owns it. //
// All of this is required because MAX will notify //
// an object's dependents about notetrack actions but //
// NOT the object itself, and the Add/DeleteNoteTrack //
// functions are non-virtual. ARRRGH! //
// //
//////////////////////////////////////////////////////////////////////////////
#ifndef _plNoteTrackWatcher_h
#define _plNoteTrackWatcher_h
#include "Max.h"
#include "iparamb2.h"
#include "iparamm2.h"
#include "hsTypes.h"
extern TCHAR *GetString(int id);
extern HINSTANCE hInstance;
#define NTWATCHER_CLASSID Class_ID(0x313f531e, 0xa5f132f)
#define REFMSG_NOTETRACK_ADDED REFMSG_USER + 1
class plPassMtlBase;
class NoteTrack;
//// Class Def ///////////////////////////////////////////////////////////////
class plNoteTrackWatcher : public ReferenceMaker
{
protected:
plPassMtlBase *fParentMtl;
// For tracking notetrack additions to the parent
int fNoteTrackCount;
public:
enum Refs
{
kRefParentMtl = 0
};
plNoteTrackWatcher( plPassMtlBase *parentMtl );
virtual ~plNoteTrackWatcher();
void DeleteThis() { delete this; }
Class_ID ClassID() { return NTWATCHER_CLASSID; }
SClass_ID SuperClassID() { return REF_MAKER_CLASS_ID; }
int NumRefs();
RefTargetHandle GetReference(int i);
void SetReference(int i, RefTargetHandle rtarg);
RefResult NotifyRefChanged(Interval changeInt,RefTargetHandle hTarget, PartID& partID, RefMessage message);
virtual BOOL IsRealDependency( ReferenceTarget *rtarg );
};
/*==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/>.
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==*/
//////////////////////////////////////////////////////////////////////////////
// //
// plNoteTrackWatcher - Dummy object to watch for notetrack additions or //
// removals from the main material that owns it. //
// All of this is required because MAX will notify //
// an object's dependents about notetrack actions but //
// NOT the object itself, and the Add/DeleteNoteTrack //
// functions are non-virtual. ARRRGH! //
// //
//////////////////////////////////////////////////////////////////////////////
#ifndef _plNoteTrackWatcher_h
#define _plNoteTrackWatcher_h
#include "Max.h"
#include "iparamb2.h"
#include "iparamm2.h"
#include "hsTypes.h"
extern TCHAR *GetString(int id);
extern HINSTANCE hInstance;
#define NTWATCHER_CLASSID Class_ID(0x313f531e, 0xa5f132f)
#define REFMSG_NOTETRACK_ADDED REFMSG_USER + 1
class plPassMtlBase;
class NoteTrack;
//// Class Def ///////////////////////////////////////////////////////////////
class plNoteTrackWatcher : public ReferenceMaker
{
protected:
plPassMtlBase *fParentMtl;
// For tracking notetrack additions to the parent
int fNoteTrackCount;
public:
enum Refs
{
kRefParentMtl = 0
};
plNoteTrackWatcher( plPassMtlBase *parentMtl );
virtual ~plNoteTrackWatcher();
void DeleteThis() { delete this; }
Class_ID ClassID() { return NTWATCHER_CLASSID; }
SClass_ID SuperClassID() { return REF_MAKER_CLASS_ID; }
int NumRefs();
RefTargetHandle GetReference(int i);
void SetReference(int i, RefTargetHandle rtarg);
RefResult NotifyRefChanged(Interval changeInt,RefTargetHandle hTarget, PartID& partID, RefMessage message);
virtual BOOL IsRealDependency( ReferenceTarget *rtarg );
};
#endif //_plNoteTrackWatcher_h

File diff suppressed because it is too large Load Diff

View File

@ -1,182 +1,182 @@
/*==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/>.
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 PL_PARTICLEMTL_H
#define PL_PARTICLEMTL_H
#include "Max.h"
//#include "istdplug.h"
#include "iparamb2.h"
//#include "iparamm2.h"
#include "../resource.h"
class Bitmap;
#define PARTICLE_MTL_CLASS_ID Class_ID(0x26df05ff, 0x60660749)
extern TCHAR *GetString(int id);
class plParticleMtl : public Mtl
{
protected:
IParamBlock2 *fBasicPB;
Interval fIValid;
public:
IMtlParams *fIMtlParams;
enum
{
kRefBasic,
};
enum
{
kBlkBasic,
};
enum // Param block indicies
{
kOpacity,
kColor,
kWidth,
kHeight,
kXTiles,
kYTiles,
kNormal,
kBlend,
kOrientation,
kBitmap,
kTexmap,
kColorAmb,
kNoFilter
};
enum
{
kBlendNone,
kBlendAlpha,
kBlendAdd
};
enum
{
kOrientVelocity,
kOrientUp,
kOrientVelStretch,
kOrientVelFlow
};
enum
{
kNormalViewFacing,
kNormalUp,
kNormalNearestLight,
kNormalFromCenter,
kNormalVelUpVel,
kEmissive,
kNumNormalOptions
};
static const char *NormalStrings[];
plParticleMtl(BOOL loading);
void DeleteThis() { delete this; }
//From Animatable
Class_ID ClassID() { return PARTICLE_MTL_CLASS_ID; }
SClass_ID SuperClassID() { return MATERIAL_CLASS_ID; }
void GetClassName(TSTR& s) { s = GetString(IDS_PARTICLE_MTL); }
ParamDlg *CreateParamDlg(HWND hwMtlEdit, IMtlParams *imp);
void Update(TimeValue t, Interval& valid);
Interval Validity(TimeValue t);
void Reset();
void NotifyChanged();
BOOL SupportsMultiMapsInViewport() { return FALSE; }
void SetupGfxMultiMaps(TimeValue t, Material *mtl, MtlMakerCallback &cb);
// Shade and displacement calculation
void Shade(ShadeContext& sc);
void ShadeWithBackground(ShadeContext &sc, Color background);
float EvalDisplacement(ShadeContext& sc);
Interval DisplacementValidity(TimeValue t);
// SubTexmap access methods
int NumSubTexmaps();
Texmap* GetSubTexmap(int i);
void SetSubTexmap(int i, Texmap *m);
TSTR GetSubTexmapSlotName(int i);
TSTR GetSubTexmapTVName(int i);
BOOL SetDlgThing(ParamDlg* dlg);
// Loading/Saving
IOResult Load(ILoad *iload);
IOResult Save(ISave *isave);
RefTargetHandle Clone( RemapDir &remap );
RefResult NotifyRefChanged(Interval changeInt, RefTargetHandle hTarget,
PartID& partID, RefMessage message);
int NumSubs();
Animatable* SubAnim(int i);
TSTR SubAnimName(int i);
int NumRefs();
RefTargetHandle GetReference(int i);
void SetReference(int i, RefTargetHandle rtarg);
int NumParamBlocks();
IParamBlock2* GetParamBlock(int i);
IParamBlock2* GetParamBlockByID(BlockID id);
// void SetParamDlg(ParamDlg *dlg);
// void SetNumSubTexmaps(int num);
DllExport Control *GetAmbColorController();
DllExport Control *GetColorController();
DllExport Control *GetOpacityController();
DllExport Control *GetWidthController();
DllExport Control *GetHeightController();
// From MtlBase and Mtl
void SetAmbient(Color c, TimeValue t);
void SetDiffuse(Color c, TimeValue t);
void SetSpecular(Color c, TimeValue t);
void SetShininess(float v, TimeValue t);
Color GetAmbient(int mtlNum=0, BOOL backFace=FALSE);
Color GetDiffuse(int mtlNum=0, BOOL backFace=FALSE);
Color GetSpecular(int mtlNum=0, BOOL backFace=FALSE);
float GetXParency(int mtlNum=0, BOOL backFace=FALSE);
float GetShininess(int mtlNum=0, BOOL backFace=FALSE);
float GetShinStr(int mtlNum=0, BOOL backFace=FALSE);
float WireSize(int mtlNum=0, BOOL backFace=FALSE);
ULONG Requirements( int subMtlNum );
};
/*==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/>.
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 PL_PARTICLEMTL_H
#define PL_PARTICLEMTL_H
#include "Max.h"
//#include "istdplug.h"
#include "iparamb2.h"
//#include "iparamm2.h"
#include "../resource.h"
class Bitmap;
#define PARTICLE_MTL_CLASS_ID Class_ID(0x26df05ff, 0x60660749)
extern TCHAR *GetString(int id);
class plParticleMtl : public Mtl
{
protected:
IParamBlock2 *fBasicPB;
Interval fIValid;
public:
IMtlParams *fIMtlParams;
enum
{
kRefBasic,
};
enum
{
kBlkBasic,
};
enum // Param block indicies
{
kOpacity,
kColor,
kWidth,
kHeight,
kXTiles,
kYTiles,
kNormal,
kBlend,
kOrientation,
kBitmap,
kTexmap,
kColorAmb,
kNoFilter
};
enum
{
kBlendNone,
kBlendAlpha,
kBlendAdd
};
enum
{
kOrientVelocity,
kOrientUp,
kOrientVelStretch,
kOrientVelFlow
};
enum
{
kNormalViewFacing,
kNormalUp,
kNormalNearestLight,
kNormalFromCenter,
kNormalVelUpVel,
kEmissive,
kNumNormalOptions
};
static const char *NormalStrings[];
plParticleMtl(BOOL loading);
void DeleteThis() { delete this; }
//From Animatable
Class_ID ClassID() { return PARTICLE_MTL_CLASS_ID; }
SClass_ID SuperClassID() { return MATERIAL_CLASS_ID; }
void GetClassName(TSTR& s) { s = GetString(IDS_PARTICLE_MTL); }
ParamDlg *CreateParamDlg(HWND hwMtlEdit, IMtlParams *imp);
void Update(TimeValue t, Interval& valid);
Interval Validity(TimeValue t);
void Reset();
void NotifyChanged();
BOOL SupportsMultiMapsInViewport() { return FALSE; }
void SetupGfxMultiMaps(TimeValue t, Material *mtl, MtlMakerCallback &cb);
// Shade and displacement calculation
void Shade(ShadeContext& sc);
void ShadeWithBackground(ShadeContext &sc, Color background);
float EvalDisplacement(ShadeContext& sc);
Interval DisplacementValidity(TimeValue t);
// SubTexmap access methods
int NumSubTexmaps();
Texmap* GetSubTexmap(int i);
void SetSubTexmap(int i, Texmap *m);
TSTR GetSubTexmapSlotName(int i);
TSTR GetSubTexmapTVName(int i);
BOOL SetDlgThing(ParamDlg* dlg);
// Loading/Saving
IOResult Load(ILoad *iload);
IOResult Save(ISave *isave);
RefTargetHandle Clone( RemapDir &remap );
RefResult NotifyRefChanged(Interval changeInt, RefTargetHandle hTarget,
PartID& partID, RefMessage message);
int NumSubs();
Animatable* SubAnim(int i);
TSTR SubAnimName(int i);
int NumRefs();
RefTargetHandle GetReference(int i);
void SetReference(int i, RefTargetHandle rtarg);
int NumParamBlocks();
IParamBlock2* GetParamBlock(int i);
IParamBlock2* GetParamBlockByID(BlockID id);
// void SetParamDlg(ParamDlg *dlg);
// void SetNumSubTexmaps(int num);
DllExport Control *GetAmbColorController();
DllExport Control *GetColorController();
DllExport Control *GetOpacityController();
DllExport Control *GetWidthController();
DllExport Control *GetHeightController();
// From MtlBase and Mtl
void SetAmbient(Color c, TimeValue t);
void SetDiffuse(Color c, TimeValue t);
void SetSpecular(Color c, TimeValue t);
void SetShininess(float v, TimeValue t);
Color GetAmbient(int mtlNum=0, BOOL backFace=FALSE);
Color GetDiffuse(int mtlNum=0, BOOL backFace=FALSE);
Color GetSpecular(int mtlNum=0, BOOL backFace=FALSE);
float GetXParency(int mtlNum=0, BOOL backFace=FALSE);
float GetShininess(int mtlNum=0, BOOL backFace=FALSE);
float GetShinStr(int mtlNum=0, BOOL backFace=FALSE);
float WireSize(int mtlNum=0, BOOL backFace=FALSE);
ULONG Requirements( int subMtlNum );
};
#endif //PL_PARTICLEMTL_H

View File

@ -1,234 +1,234 @@
/*==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/>.
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 "plParticleMtl.h"
class PartMtlPBAccessor;
extern PartMtlPBAccessor partMtl_accessor;
class ParticleBasicDlgProc;
extern ParticleBasicDlgProc gParticleBasicDlgProc;
#define PL_PARTICLE_MTL_MIN_TILES 1
#define PL_PARTICLE_MTL_MAX_TILES 16
static ParamBlockDesc2 gParticleMtlPB
(
plParticleMtl::kBlkBasic, _T("particle"), IDS_PASS_BASIC, GetParticleMtlDesc(),
P_AUTO_CONSTRUCT + P_AUTO_UI + P_CALLSETS_ON_LOAD, plParticleMtl::kRefBasic,
// UI
IDD_PARTICLE, IDS_PASS_BASIC, 0, 0, &gParticleBasicDlgProc,
plParticleMtl::kOpacity, _T("opacity"), TYPE_INT, P_ANIMATABLE, IDS_PARTICLE_OPACITY,
p_default, 100,
p_range, 0, 100,
p_ui, TYPE_SPINNER, EDITTYPE_INT,
IDC_PARTICLE_OPACITY, IDC_PARTICLE_OPACITY_SPIN, 1.0,
end,
plParticleMtl::kColorAmb, _T("ambColor"), TYPE_RGBA, P_ANIMATABLE, IDS_PARTICLE_AMB_COLOR,
p_ui, TYPE_COLORSWATCH, IDC_PARTICLE_AMB_COLOR,
p_default, Color(0,0,0),
end,
plParticleMtl::kColor, _T("color"), TYPE_RGBA, P_ANIMATABLE, IDS_PARTICLE_COLOR,
p_ui, TYPE_COLORSWATCH, IDC_PARTICLE_COLOR,
p_default, Color(1,1,1),
end,
plParticleMtl::kWidth, _T("width"), TYPE_FLOAT, P_ANIMATABLE, IDS_PARTICLE_WIDTH,
p_default, 1.0,
p_range, 0.01, 10.0,
p_ui, TYPE_SPINNER, EDITTYPE_POS_FLOAT,
IDC_PARTICLE_WIDTH, IDC_PARTICLE_WIDTH_SPIN, 1.0,
end,
plParticleMtl::kHeight, _T("height"), TYPE_FLOAT, P_ANIMATABLE, IDS_PARTICLE_HEIGHT,
p_default, 1.0,
p_range, 0.01, 10.0,
p_ui, TYPE_SPINNER, EDITTYPE_POS_FLOAT,
IDC_PARTICLE_HEIGHT, IDC_PARTICLE_HEIGHT_SPIN, 1.0,
end,
plParticleMtl::kXTiles, _T("xTiling"), TYPE_INT, 0, 0,
p_default, 1,
p_range, PL_PARTICLE_MTL_MIN_TILES, PL_PARTICLE_MTL_MAX_TILES,
p_ui, TYPE_SPINNER, EDITTYPE_POS_INT,
IDC_PARTICLE_XTILE, IDC_PARTICLE_XTILE_SPIN, 1.0,
p_accessor, &partMtl_accessor,
end,
plParticleMtl::kYTiles, _T("yTiling"), TYPE_INT, 0, 0,
p_default, 1,
p_range, PL_PARTICLE_MTL_MIN_TILES, PL_PARTICLE_MTL_MAX_TILES,
p_ui, TYPE_SPINNER, EDITTYPE_POS_INT,
IDC_PARTICLE_YTILE, IDC_PARTICLE_YTILE_SPIN, 1.0,
p_accessor, &partMtl_accessor,
end,
plParticleMtl::kNormal, _T("normal"), TYPE_INT, 0, 0,
p_default, 0,
end,
plParticleMtl::kBlend, _T("texBlend"), TYPE_INT, 0, 0,
p_ui, TYPE_RADIO, 2, IDC_PARTICLE_BLEND_ALPHA, IDC_PARTICLE_BLEND_ADD,
p_vals, plParticleMtl::kBlendAlpha, plParticleMtl::kBlendAdd,
p_default, plParticleMtl::kBlendAlpha,
end,
plParticleMtl::kOrientation, _T("layerBlend"), TYPE_INT, 0, 0,
p_ui, TYPE_RADIO, 4, IDC_PARTICLE_ORIENT_VELOCITY, IDC_PARTICLE_ORIENT_UP, IDC_PARTICLE_ORIENT_VELSTRETCH, IDC_PARTICLE_ORIENT_VELFLOW,
p_vals, plParticleMtl::kOrientVelocity, plParticleMtl::kOrientUp, plParticleMtl::kOrientVelStretch, plParticleMtl::kOrientVelFlow,
p_default, plParticleMtl::kOrientVelocity,
end,
plParticleMtl::kBitmap, _T("bitmap"), TYPE_BITMAP, P_SHORT_LABELS, 0,
///p_ui, TYPE_BITMAPBUTTON, IDC_PARTICLE_TEXTURE,
//p_accessor, &partMtl_accessor,
end,
plParticleMtl::kTexmap, _T("texmap"), TYPE_TEXMAP, 0, 0,
// p_ui, TYPE_TEXMAPBUTTON, IDC_LAYER2,
end,
plParticleMtl::kNoFilter, _T("noFilter"), TYPE_BOOL, 0, 0,
p_ui, TYPE_SINGLECHEKBOX, IDC_PARTICLE_NOFILTER,
p_default, FALSE,
end,
end
);
class PartMtlPBAccessor : public PBAccessor
{
public:
void Set(PB2Value& val, ReferenceMaker* owner, ParamID id, int tabIndex, TimeValue t)
{
plParticleMtl* mtl = (plParticleMtl *)owner;
//plLayerTex *layer;
switch (id)
{
case plParticleMtl::kBitmap:
break;
case plParticleMtl::kXTiles:
case plParticleMtl::kYTiles:
if (val.i < PL_PARTICLE_MTL_MIN_TILES)
val.i = PL_PARTICLE_MTL_MIN_TILES;
if (val.i > PL_PARTICLE_MTL_MAX_TILES)
val.i = PL_PARTICLE_MTL_MAX_TILES;
break;
}
}
void Get(PB2Value& v, ReferenceMaker* owner, ParamID id, int tabIndex, TimeValue t, Interval &valid)
{
}
};
static PartMtlPBAccessor partMtl_accessor;
class ParticleBasicDlgProc : public ParamMap2UserDlgProc
{
public:
ParticleBasicDlgProc() {}
~ParticleBasicDlgProc() {}
void UpdateDisplay(IParamMap2 *pmap)
{
HWND hWnd = pmap->GetHWnd();
IParamBlock2 *pb = pmap->GetParamBlock();
HWND cbox = GetDlgItem(hWnd, IDC_PARTICLE_NORMAL);
plPlasmaMAXLayer *layer = (plPlasmaMAXLayer *)pb->GetTexmap(ParamID(plParticleMtl::kTexmap));
PBBitmap *pbbm;
ICustButton *bmSelectBtn;
SendMessage(cbox, CB_SETCURSEL, pb->GetInt(plParticleMtl::kNormal), 0);
pbbm = (layer == nil ? nil : layer->GetPBBitmap());
bmSelectBtn = GetICustButton(GetDlgItem(hWnd,IDC_PARTICLE_TEXTURE));
bmSelectBtn->SetText(pbbm ? (TCHAR*)pbbm->bi.Filename() : "(none)");
ReleaseICustButton(bmSelectBtn);
}
virtual void Update(TimeValue t, Interval& valid, IParamMap2* pmap) { UpdateDisplay(pmap); }
BOOL DlgProc(TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
int id = LOWORD(wParam);
int code = HIWORD(wParam);
IParamBlock2 *pb = map->GetParamBlock();
HWND cbox = NULL;
plPlasmaMAXLayer *layer = (plPlasmaMAXLayer *)pb->GetTexmap(ParamID(plParticleMtl::kTexmap));
switch (msg)
{
case WM_INITDIALOG:
int j;
for (j = 0; j < plParticleMtl::kNumNormalOptions; j++)
{
cbox = GetDlgItem(hWnd, IDC_PARTICLE_NORMAL);
SendMessage(cbox, CB_ADDSTRING, 0, (LPARAM)plParticleMtl::NormalStrings[j]);
}
UpdateDisplay(map);
return TRUE;
case WM_COMMAND:
if (id == IDC_PARTICLE_NORMAL)
{
pb->SetValue(plParticleMtl::kNormal, t, SendMessage(GetDlgItem(hWnd, id), CB_GETCURSEL, 0, 0));
return TRUE;
}
else if (id == IDC_PARTICLE_TEXTURE)
{
if (layer == nil)
return FALSE;
layer->HandleBitmapSelection();
UpdateDisplay(map);
return TRUE;
}
else if (id == IDC_PARTICLE_NOFILTER)
{
if (!layer)
return FALSE;
if( pb->GetInt(plParticleMtl::kNoFilter) )
{
layer->GetParamBlockByID( plLayerTex::kBlkBitmap )->SetValue(kBmpNoFilter, t, 1);
}
else
{
layer->GetParamBlockByID( plLayerTex::kBlkBitmap )->SetValue(kBmpNoFilter, t, 0);
}
return TRUE;
}
break;
}
return FALSE;
}
void DeleteThis() {}
};
static ParticleBasicDlgProc gParticleBasicDlgProc;
/*==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/>.
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 "plParticleMtl.h"
class PartMtlPBAccessor;
extern PartMtlPBAccessor partMtl_accessor;
class ParticleBasicDlgProc;
extern ParticleBasicDlgProc gParticleBasicDlgProc;
#define PL_PARTICLE_MTL_MIN_TILES 1
#define PL_PARTICLE_MTL_MAX_TILES 16
static ParamBlockDesc2 gParticleMtlPB
(
plParticleMtl::kBlkBasic, _T("particle"), IDS_PASS_BASIC, GetParticleMtlDesc(),
P_AUTO_CONSTRUCT + P_AUTO_UI + P_CALLSETS_ON_LOAD, plParticleMtl::kRefBasic,
// UI
IDD_PARTICLE, IDS_PASS_BASIC, 0, 0, &gParticleBasicDlgProc,
plParticleMtl::kOpacity, _T("opacity"), TYPE_INT, P_ANIMATABLE, IDS_PARTICLE_OPACITY,
p_default, 100,
p_range, 0, 100,
p_ui, TYPE_SPINNER, EDITTYPE_INT,
IDC_PARTICLE_OPACITY, IDC_PARTICLE_OPACITY_SPIN, 1.0,
end,
plParticleMtl::kColorAmb, _T("ambColor"), TYPE_RGBA, P_ANIMATABLE, IDS_PARTICLE_AMB_COLOR,
p_ui, TYPE_COLORSWATCH, IDC_PARTICLE_AMB_COLOR,
p_default, Color(0,0,0),
end,
plParticleMtl::kColor, _T("color"), TYPE_RGBA, P_ANIMATABLE, IDS_PARTICLE_COLOR,
p_ui, TYPE_COLORSWATCH, IDC_PARTICLE_COLOR,
p_default, Color(1,1,1),
end,
plParticleMtl::kWidth, _T("width"), TYPE_FLOAT, P_ANIMATABLE, IDS_PARTICLE_WIDTH,
p_default, 1.0,
p_range, 0.01, 10.0,
p_ui, TYPE_SPINNER, EDITTYPE_POS_FLOAT,
IDC_PARTICLE_WIDTH, IDC_PARTICLE_WIDTH_SPIN, 1.0,
end,
plParticleMtl::kHeight, _T("height"), TYPE_FLOAT, P_ANIMATABLE, IDS_PARTICLE_HEIGHT,
p_default, 1.0,
p_range, 0.01, 10.0,
p_ui, TYPE_SPINNER, EDITTYPE_POS_FLOAT,
IDC_PARTICLE_HEIGHT, IDC_PARTICLE_HEIGHT_SPIN, 1.0,
end,
plParticleMtl::kXTiles, _T("xTiling"), TYPE_INT, 0, 0,
p_default, 1,
p_range, PL_PARTICLE_MTL_MIN_TILES, PL_PARTICLE_MTL_MAX_TILES,
p_ui, TYPE_SPINNER, EDITTYPE_POS_INT,
IDC_PARTICLE_XTILE, IDC_PARTICLE_XTILE_SPIN, 1.0,
p_accessor, &partMtl_accessor,
end,
plParticleMtl::kYTiles, _T("yTiling"), TYPE_INT, 0, 0,
p_default, 1,
p_range, PL_PARTICLE_MTL_MIN_TILES, PL_PARTICLE_MTL_MAX_TILES,
p_ui, TYPE_SPINNER, EDITTYPE_POS_INT,
IDC_PARTICLE_YTILE, IDC_PARTICLE_YTILE_SPIN, 1.0,
p_accessor, &partMtl_accessor,
end,
plParticleMtl::kNormal, _T("normal"), TYPE_INT, 0, 0,
p_default, 0,
end,
plParticleMtl::kBlend, _T("texBlend"), TYPE_INT, 0, 0,
p_ui, TYPE_RADIO, 2, IDC_PARTICLE_BLEND_ALPHA, IDC_PARTICLE_BLEND_ADD,
p_vals, plParticleMtl::kBlendAlpha, plParticleMtl::kBlendAdd,
p_default, plParticleMtl::kBlendAlpha,
end,
plParticleMtl::kOrientation, _T("layerBlend"), TYPE_INT, 0, 0,
p_ui, TYPE_RADIO, 4, IDC_PARTICLE_ORIENT_VELOCITY, IDC_PARTICLE_ORIENT_UP, IDC_PARTICLE_ORIENT_VELSTRETCH, IDC_PARTICLE_ORIENT_VELFLOW,
p_vals, plParticleMtl::kOrientVelocity, plParticleMtl::kOrientUp, plParticleMtl::kOrientVelStretch, plParticleMtl::kOrientVelFlow,
p_default, plParticleMtl::kOrientVelocity,
end,
plParticleMtl::kBitmap, _T("bitmap"), TYPE_BITMAP, P_SHORT_LABELS, 0,
///p_ui, TYPE_BITMAPBUTTON, IDC_PARTICLE_TEXTURE,
//p_accessor, &partMtl_accessor,
end,
plParticleMtl::kTexmap, _T("texmap"), TYPE_TEXMAP, 0, 0,
// p_ui, TYPE_TEXMAPBUTTON, IDC_LAYER2,
end,
plParticleMtl::kNoFilter, _T("noFilter"), TYPE_BOOL, 0, 0,
p_ui, TYPE_SINGLECHEKBOX, IDC_PARTICLE_NOFILTER,
p_default, FALSE,
end,
end
);
class PartMtlPBAccessor : public PBAccessor
{
public:
void Set(PB2Value& val, ReferenceMaker* owner, ParamID id, int tabIndex, TimeValue t)
{
plParticleMtl* mtl = (plParticleMtl *)owner;
//plLayerTex *layer;
switch (id)
{
case plParticleMtl::kBitmap:
break;
case plParticleMtl::kXTiles:
case plParticleMtl::kYTiles:
if (val.i < PL_PARTICLE_MTL_MIN_TILES)
val.i = PL_PARTICLE_MTL_MIN_TILES;
if (val.i > PL_PARTICLE_MTL_MAX_TILES)
val.i = PL_PARTICLE_MTL_MAX_TILES;
break;
}
}
void Get(PB2Value& v, ReferenceMaker* owner, ParamID id, int tabIndex, TimeValue t, Interval &valid)
{
}
};
static PartMtlPBAccessor partMtl_accessor;
class ParticleBasicDlgProc : public ParamMap2UserDlgProc
{
public:
ParticleBasicDlgProc() {}
~ParticleBasicDlgProc() {}
void UpdateDisplay(IParamMap2 *pmap)
{
HWND hWnd = pmap->GetHWnd();
IParamBlock2 *pb = pmap->GetParamBlock();
HWND cbox = GetDlgItem(hWnd, IDC_PARTICLE_NORMAL);
plPlasmaMAXLayer *layer = (plPlasmaMAXLayer *)pb->GetTexmap(ParamID(plParticleMtl::kTexmap));
PBBitmap *pbbm;
ICustButton *bmSelectBtn;
SendMessage(cbox, CB_SETCURSEL, pb->GetInt(plParticleMtl::kNormal), 0);
pbbm = (layer == nil ? nil : layer->GetPBBitmap());
bmSelectBtn = GetICustButton(GetDlgItem(hWnd,IDC_PARTICLE_TEXTURE));
bmSelectBtn->SetText(pbbm ? (TCHAR*)pbbm->bi.Filename() : "(none)");
ReleaseICustButton(bmSelectBtn);
}
virtual void Update(TimeValue t, Interval& valid, IParamMap2* pmap) { UpdateDisplay(pmap); }
BOOL DlgProc(TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
int id = LOWORD(wParam);
int code = HIWORD(wParam);
IParamBlock2 *pb = map->GetParamBlock();
HWND cbox = NULL;
plPlasmaMAXLayer *layer = (plPlasmaMAXLayer *)pb->GetTexmap(ParamID(plParticleMtl::kTexmap));
switch (msg)
{
case WM_INITDIALOG:
int j;
for (j = 0; j < plParticleMtl::kNumNormalOptions; j++)
{
cbox = GetDlgItem(hWnd, IDC_PARTICLE_NORMAL);
SendMessage(cbox, CB_ADDSTRING, 0, (LPARAM)plParticleMtl::NormalStrings[j]);
}
UpdateDisplay(map);
return TRUE;
case WM_COMMAND:
if (id == IDC_PARTICLE_NORMAL)
{
pb->SetValue(plParticleMtl::kNormal, t, SendMessage(GetDlgItem(hWnd, id), CB_GETCURSEL, 0, 0));
return TRUE;
}
else if (id == IDC_PARTICLE_TEXTURE)
{
if (layer == nil)
return FALSE;
layer->HandleBitmapSelection();
UpdateDisplay(map);
return TRUE;
}
else if (id == IDC_PARTICLE_NOFILTER)
{
if (!layer)
return FALSE;
if( pb->GetInt(plParticleMtl::kNoFilter) )
{
layer->GetParamBlockByID( plLayerTex::kBlkBitmap )->SetValue(kBmpNoFilter, t, 1);
}
else
{
layer->GetParamBlockByID( plLayerTex::kBlkBitmap )->SetValue(kBmpNoFilter, t, 0);
}
return TRUE;
}
break;
}
return FALSE;
}
void DeleteThis() {}
};
static ParticleBasicDlgProc gParticleBasicDlgProc;

View File

@ -1,305 +1,305 @@
/*==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/>.
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==*/
//////////////////////////////////////////////////////////////////////////////
// //
// plPassAnimDlgProc - Base Animation Dlg Proc for plPassMtlBase //
// //
//////////////////////////////////////////////////////////////////////////////
#include "hsTypes.h"
#include "plPassAnimDlgProc.h"
#include "plPassBaseParamIDs.h"
#include "../MaxComponent/plNotetrackAnim.h"
#include "resource.h"
#include "iparamm2.h"
#include "plAnimStealthNode.h"
#include "../MaxComponent/plMaxAnimUtils.h"
#include "../MaxComponent/plAnimComponent.h"
#include "../MaxExport/plErrorMsg.h"
const char *kPassNameNone = ENTIRE_ANIMATION_NAME;
#include "plAnimStealthNode.h"
using namespace plPassBaseParamIDs;
plPassAnimDlgProc::plPassAnimDlgProc()
{
fCurrParamMap = nil;
fInitingNames = false;
}
plPassAnimDlgProc::~plPassAnimDlgProc()
{
if( fCurrParamMap != nil )
{
plPassMtlBase *mtl = (plPassMtlBase *)( fCurrParamMap->GetParamBlock()->GetOwner() );
mtl->RegisterChangeCallback( this );
}
}
plPassAnimDlgProc &plPassAnimDlgProc::Get( void )
{
static plPassAnimDlgProc instance;
return instance;
}
void plPassAnimDlgProc::Update(TimeValue t, Interval& valid, IParamMap2* pmap)
{
/* plAnimStealthNode *testStealth = (plAnimStealthNode *)pmap->GetParamBlock()->GetINode( (ParamID)kPBAnimTESTING );
if( testStealth != nil )
{
IParamBlock2 *pb = testStealth->GetParamBlockByID( plAnimStealthNode::kBlockPB );
if( pb && pb->GetMap() && pb->GetMap()->GetUserDlgProc() )
pb->GetMap()->GetUserDlgProc()->Update( t, valid, pmap );
}
*/
HWND hWnd = pmap->GetHWnd();
IParamBlock2 *pb = pmap->GetParamBlock();
plAnimComponentProc::SetBoxToAgeGlobal(GetDlgItem(hWnd, IDC_MTL_GLOBAL_NAME), pb->GetStr(ParamID(kPBAnimGlobalName)));
}
BOOL plPassAnimDlgProc::DlgProc(TimeValue t, IParamMap2 *pMap, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
if( fCurrParamMap != pMap )
{
if( fCurrParamMap != nil )
{
plPassMtlBase *mtl = (plPassMtlBase *)( fCurrParamMap->GetParamBlock()->GetOwner() );
mtl->UnregisterChangeCallback( this );
}
fCurrParamMap = pMap;
if( fCurrParamMap != nil )
{
plPassMtlBase *mtl = (plPassMtlBase *)( fCurrParamMap->GetParamBlock()->GetOwner() );
mtl->RegisterChangeCallback( this );
}
}
IParamBlock2 *pb = pMap->GetParamBlock();
plPassMtlBase *mtl = (plPassMtlBase*)pb->GetOwner();
HWND gWnd = GetDlgItem(hWnd, IDC_MTL_GLOBAL_NAME);
char buff[512];
switch (msg)
{
case WM_DESTROY:
if( fCurrParamMap != nil )
{
plPassMtlBase *mtl = (plPassMtlBase *)( fCurrParamMap->GetParamBlock()->GetOwner() );
mtl->RegisterChangeCallback( this );
fCurrParamMap = nil;
}
break;
case WM_INITDIALOG:
{
fhWnd = hWnd;
fCurrStealth = nil;
IInitControls(mtl, pb);
plAnimComponentProc::FillAgeGlobalComboBox(gWnd, pb->GetStr(ParamID(kPBAnimGlobalName)));
plAnimComponentProc::SetBoxToAgeGlobal(gWnd, pb->GetStr(ParamID(kPBAnimGlobalName)));
IEnableGlobal(hWnd, pb->GetInt( (ParamID)kPBAnimUseGlobal ) );
bool stopPoints = false;
if( DoesHaveStopPoints( pb->GetOwner() ) )
{
stopPoints = true;
break;
}
IEnableEaseStopPoints( pMap, stopPoints );
}
return TRUE;
case WM_COMMAND:
// Anim name selection changed
if (LOWORD(wParam) == IDC_NAMES && HIWORD(wParam) == CBN_SELCHANGE)
{
IUpdateSegmentSel( pMap );
return TRUE;
}
// Refresh clicked
else if (LOWORD(wParam) == IDC_REFRESH_ANIMS && HIWORD(wParam) == BN_CLICKED)
{
IInitControls(mtl, pb);
return TRUE;
}
else if (HIWORD(wParam) == CBN_SELCHANGE && LOWORD(wParam) == IDC_MTL_GLOBAL_NAME)
{
ComboBox_GetLBText(gWnd, ComboBox_GetCurSel(gWnd), buff);
pb->SetValue(ParamID(kPBAnimGlobalName), 0, _T(buff));
}
else if (HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_MTL_USE_GLOBAL)
{
IEnableGlobal(hWnd, pb->GetInt( (ParamID)kPBAnimUseGlobal ) );
}
break;
}
return FALSE;
}
void plPassAnimDlgProc::SegmentListChanged( void )
{
if( fCurrParamMap != nil )
ILoadNames( fCurrParamMap->GetParamBlock() );
}
void plPassAnimDlgProc::IUpdateSegmentSel( IParamMap2 *thisMap, hsBool clear )
{
plAnimStealthNode *newStealth;
HWND hAnims = GetDlgItem( fhWnd, IDC_NAMES );
// Get current selection
if( clear )
newStealth = nil;
else
{
int sel = SendDlgItemMessage( fhWnd, IDC_NAMES, CB_GETCURSEL, 0, 0 );
if( sel == CB_ERR )
{
// Somehow we don't have a selection...fine, just destroy
newStealth = nil;
}
else
{
newStealth = (plAnimStealthNode *)SendDlgItemMessage( fhWnd, IDC_NAMES, CB_GETITEMDATA, sel, 0 );
}
}
// Did we really not change?
if( newStealth == fCurrStealth )
return;
if( fCurrStealth != nil && newStealth != nil )
{
fCurrStealth->SwitchDlg( newStealth );
}
else
{
// Destroy the old
if( fCurrStealth != nil )
fCurrStealth->ReleaseDlg();
// Show the new
if( newStealth != nil )
IExposeStealthNode( newStealth, thisMap );
}
// And update!
fCurrStealth = newStealth;
}
void plPassAnimDlgProc::IExposeStealthNode( HelperObject *node, IParamMap2 *thisMap )
{
if( node->ClassID() != ANIMSTEALTH_CLASSID )
return;
// Get our stealth pointer
plAnimStealthNode *stealth = (plAnimStealthNode *)node;
// Create the paramMap-based dialog for us
IParamBlock2 *pb = thisMap->GetParamBlock();
plPassMtlBase *mtl = (plPassMtlBase *)pb->GetOwner();
if( !stealth->CreateAndEmbedDlg( thisMap, mtl->fIMtlParams, GetDlgItem( fhWnd, IDC_PLACEHOLDER ) ) )
{
}
}
void plPassAnimDlgProc::SetThing(ReferenceTarget *m)
{
plPassMtlBase *mtl = (plPassMtlBase*)m;
IInitControls(mtl, mtl->fAnimPB );
}
void plPassAnimDlgProc::IInitControls(Animatable *anim, IParamBlock2 *pb)
{
ILoadNames( pb );
IEnableGlobal( fhWnd, pb->GetInt( ParamID( kPBAnimUseGlobal ) ) );
}
void plPassAnimDlgProc::ILoadNames(IParamBlock2 *pb )
{
// The following is to prevent IGetNumStealths() from re-calling us
if( fInitingNames )
return;
fInitingNames = true;
HWND hAnims = GetDlgItem(fhWnd, IDC_NAMES);
SendMessage(hAnims, CB_RESETCONTENT, 0, 0);
plPassMtlBase *mtl = (plPassMtlBase *)pb->GetOwner();
// Loop through our stealth nodes and add them all to the combo,
// since that's what we're selecting...erm, yeah
int i, count = mtl->IGetNumStealths( true );
for( i = 0; i < count; i++ )
{
plAnimStealthNode *stealth = mtl->IGetStealth( i, false );
if( stealth != nil )
{
int idx = SendMessage( hAnims, CB_ADDSTRING, 0, (LPARAM)stealth->GetSegmentName() );
SendMessage( hAnims, CB_SETITEMDATA, idx, (LPARAM)stealth );
}
}
SendMessage( hAnims, CB_SETCURSEL, 0, 0 );
IUpdateSegmentSel( pb->GetMap() );
fInitingNames = false;
}
void plPassAnimDlgProc::IEnableGlobal(HWND hWnd, hsBool enable)
{
Edit_Enable(GetDlgItem(hWnd, IDC_MTL_GLOBAL_NAME), enable);
ComboBox_Enable(GetDlgItem(hWnd, IDC_NAMES), !enable);
HWND stealthWnd = ( fCurrStealth != nil ) ? fCurrStealth->GetWinDlg() : nil;
if( stealthWnd != nil )
EnableWindow( stealthWnd, !enable );
}
void plPassAnimDlgProc::IEnableEaseStopPoints( IParamMap2 *pm, bool enable )
{
pm->Enable( (ParamID)kPBAnimEaseInMin, enable );
pm->Enable( (ParamID)kPBAnimEaseInMax, enable );
pm->Enable( (ParamID)kPBAnimEaseOutMin, enable );
pm->Enable( (ParamID)kPBAnimEaseOutMax, enable );
}
/*==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/>.
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==*/
//////////////////////////////////////////////////////////////////////////////
// //
// plPassAnimDlgProc - Base Animation Dlg Proc for plPassMtlBase //
// //
//////////////////////////////////////////////////////////////////////////////
#include "hsTypes.h"
#include "plPassAnimDlgProc.h"
#include "plPassBaseParamIDs.h"
#include "../MaxComponent/plNotetrackAnim.h"
#include "resource.h"
#include "iparamm2.h"
#include "plAnimStealthNode.h"
#include "../MaxComponent/plMaxAnimUtils.h"
#include "../MaxComponent/plAnimComponent.h"
#include "../MaxExport/plErrorMsg.h"
const char *kPassNameNone = ENTIRE_ANIMATION_NAME;
#include "plAnimStealthNode.h"
using namespace plPassBaseParamIDs;
plPassAnimDlgProc::plPassAnimDlgProc()
{
fCurrParamMap = nil;
fInitingNames = false;
}
plPassAnimDlgProc::~plPassAnimDlgProc()
{
if( fCurrParamMap != nil )
{
plPassMtlBase *mtl = (plPassMtlBase *)( fCurrParamMap->GetParamBlock()->GetOwner() );
mtl->RegisterChangeCallback( this );
}
}
plPassAnimDlgProc &plPassAnimDlgProc::Get( void )
{
static plPassAnimDlgProc instance;
return instance;
}
void plPassAnimDlgProc::Update(TimeValue t, Interval& valid, IParamMap2* pmap)
{
/* plAnimStealthNode *testStealth = (plAnimStealthNode *)pmap->GetParamBlock()->GetINode( (ParamID)kPBAnimTESTING );
if( testStealth != nil )
{
IParamBlock2 *pb = testStealth->GetParamBlockByID( plAnimStealthNode::kBlockPB );
if( pb && pb->GetMap() && pb->GetMap()->GetUserDlgProc() )
pb->GetMap()->GetUserDlgProc()->Update( t, valid, pmap );
}
*/
HWND hWnd = pmap->GetHWnd();
IParamBlock2 *pb = pmap->GetParamBlock();
plAnimComponentProc::SetBoxToAgeGlobal(GetDlgItem(hWnd, IDC_MTL_GLOBAL_NAME), pb->GetStr(ParamID(kPBAnimGlobalName)));
}
BOOL plPassAnimDlgProc::DlgProc(TimeValue t, IParamMap2 *pMap, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
if( fCurrParamMap != pMap )
{
if( fCurrParamMap != nil )
{
plPassMtlBase *mtl = (plPassMtlBase *)( fCurrParamMap->GetParamBlock()->GetOwner() );
mtl->UnregisterChangeCallback( this );
}
fCurrParamMap = pMap;
if( fCurrParamMap != nil )
{
plPassMtlBase *mtl = (plPassMtlBase *)( fCurrParamMap->GetParamBlock()->GetOwner() );
mtl->RegisterChangeCallback( this );
}
}
IParamBlock2 *pb = pMap->GetParamBlock();
plPassMtlBase *mtl = (plPassMtlBase*)pb->GetOwner();
HWND gWnd = GetDlgItem(hWnd, IDC_MTL_GLOBAL_NAME);
char buff[512];
switch (msg)
{
case WM_DESTROY:
if( fCurrParamMap != nil )
{
plPassMtlBase *mtl = (plPassMtlBase *)( fCurrParamMap->GetParamBlock()->GetOwner() );
mtl->RegisterChangeCallback( this );
fCurrParamMap = nil;
}
break;
case WM_INITDIALOG:
{
fhWnd = hWnd;
fCurrStealth = nil;
IInitControls(mtl, pb);
plAnimComponentProc::FillAgeGlobalComboBox(gWnd, pb->GetStr(ParamID(kPBAnimGlobalName)));
plAnimComponentProc::SetBoxToAgeGlobal(gWnd, pb->GetStr(ParamID(kPBAnimGlobalName)));
IEnableGlobal(hWnd, pb->GetInt( (ParamID)kPBAnimUseGlobal ) );
bool stopPoints = false;
if( DoesHaveStopPoints( pb->GetOwner() ) )
{
stopPoints = true;
break;
}
IEnableEaseStopPoints( pMap, stopPoints );
}
return TRUE;
case WM_COMMAND:
// Anim name selection changed
if (LOWORD(wParam) == IDC_NAMES && HIWORD(wParam) == CBN_SELCHANGE)
{
IUpdateSegmentSel( pMap );
return TRUE;
}
// Refresh clicked
else if (LOWORD(wParam) == IDC_REFRESH_ANIMS && HIWORD(wParam) == BN_CLICKED)
{
IInitControls(mtl, pb);
return TRUE;
}
else if (HIWORD(wParam) == CBN_SELCHANGE && LOWORD(wParam) == IDC_MTL_GLOBAL_NAME)
{
ComboBox_GetLBText(gWnd, ComboBox_GetCurSel(gWnd), buff);
pb->SetValue(ParamID(kPBAnimGlobalName), 0, _T(buff));
}
else if (HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_MTL_USE_GLOBAL)
{
IEnableGlobal(hWnd, pb->GetInt( (ParamID)kPBAnimUseGlobal ) );
}
break;
}
return FALSE;
}
void plPassAnimDlgProc::SegmentListChanged( void )
{
if( fCurrParamMap != nil )
ILoadNames( fCurrParamMap->GetParamBlock() );
}
void plPassAnimDlgProc::IUpdateSegmentSel( IParamMap2 *thisMap, hsBool clear )
{
plAnimStealthNode *newStealth;
HWND hAnims = GetDlgItem( fhWnd, IDC_NAMES );
// Get current selection
if( clear )
newStealth = nil;
else
{
int sel = SendDlgItemMessage( fhWnd, IDC_NAMES, CB_GETCURSEL, 0, 0 );
if( sel == CB_ERR )
{
// Somehow we don't have a selection...fine, just destroy
newStealth = nil;
}
else
{
newStealth = (plAnimStealthNode *)SendDlgItemMessage( fhWnd, IDC_NAMES, CB_GETITEMDATA, sel, 0 );
}
}
// Did we really not change?
if( newStealth == fCurrStealth )
return;
if( fCurrStealth != nil && newStealth != nil )
{
fCurrStealth->SwitchDlg( newStealth );
}
else
{
// Destroy the old
if( fCurrStealth != nil )
fCurrStealth->ReleaseDlg();
// Show the new
if( newStealth != nil )
IExposeStealthNode( newStealth, thisMap );
}
// And update!
fCurrStealth = newStealth;
}
void plPassAnimDlgProc::IExposeStealthNode( HelperObject *node, IParamMap2 *thisMap )
{
if( node->ClassID() != ANIMSTEALTH_CLASSID )
return;
// Get our stealth pointer
plAnimStealthNode *stealth = (plAnimStealthNode *)node;
// Create the paramMap-based dialog for us
IParamBlock2 *pb = thisMap->GetParamBlock();
plPassMtlBase *mtl = (plPassMtlBase *)pb->GetOwner();
if( !stealth->CreateAndEmbedDlg( thisMap, mtl->fIMtlParams, GetDlgItem( fhWnd, IDC_PLACEHOLDER ) ) )
{
}
}
void plPassAnimDlgProc::SetThing(ReferenceTarget *m)
{
plPassMtlBase *mtl = (plPassMtlBase*)m;
IInitControls(mtl, mtl->fAnimPB );
}
void plPassAnimDlgProc::IInitControls(Animatable *anim, IParamBlock2 *pb)
{
ILoadNames( pb );
IEnableGlobal( fhWnd, pb->GetInt( ParamID( kPBAnimUseGlobal ) ) );
}
void plPassAnimDlgProc::ILoadNames(IParamBlock2 *pb )
{
// The following is to prevent IGetNumStealths() from re-calling us
if( fInitingNames )
return;
fInitingNames = true;
HWND hAnims = GetDlgItem(fhWnd, IDC_NAMES);
SendMessage(hAnims, CB_RESETCONTENT, 0, 0);
plPassMtlBase *mtl = (plPassMtlBase *)pb->GetOwner();
// Loop through our stealth nodes and add them all to the combo,
// since that's what we're selecting...erm, yeah
int i, count = mtl->IGetNumStealths( true );
for( i = 0; i < count; i++ )
{
plAnimStealthNode *stealth = mtl->IGetStealth( i, false );
if( stealth != nil )
{
int idx = SendMessage( hAnims, CB_ADDSTRING, 0, (LPARAM)stealth->GetSegmentName() );
SendMessage( hAnims, CB_SETITEMDATA, idx, (LPARAM)stealth );
}
}
SendMessage( hAnims, CB_SETCURSEL, 0, 0 );
IUpdateSegmentSel( pb->GetMap() );
fInitingNames = false;
}
void plPassAnimDlgProc::IEnableGlobal(HWND hWnd, hsBool enable)
{
Edit_Enable(GetDlgItem(hWnd, IDC_MTL_GLOBAL_NAME), enable);
ComboBox_Enable(GetDlgItem(hWnd, IDC_NAMES), !enable);
HWND stealthWnd = ( fCurrStealth != nil ) ? fCurrStealth->GetWinDlg() : nil;
if( stealthWnd != nil )
EnableWindow( stealthWnd, !enable );
}
void plPassAnimDlgProc::IEnableEaseStopPoints( IParamMap2 *pm, bool enable )
{
pm->Enable( (ParamID)kPBAnimEaseInMin, enable );
pm->Enable( (ParamID)kPBAnimEaseInMax, enable );
pm->Enable( (ParamID)kPBAnimEaseOutMin, enable );
pm->Enable( (ParamID)kPBAnimEaseOutMax, enable );
}

View File

@ -1,84 +1,84 @@
/*==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/>.
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==*/
//////////////////////////////////////////////////////////////////////////////
// //
// plPassAnimDlgProc - Base Animation Dlg Proc for plPassMtlBase //
// //
//////////////////////////////////////////////////////////////////////////////
#ifndef _plPassAnimDlgProc_h
#define _plPassAnimDlgProc_h
#include "plPassMtlBase.h"
#include "iparamm2.h"
class plAnimStealthNode;
class IParamMap2;
class plPassAnimDlgProc : public ParamMap2UserDlgProc, public plMtlChangeCallback
{
protected:
// Combo itemdata values
enum
{
kName, // Name of an animation/loop
kDefault, // Default combo value
kInvalid, // Invalid entry (couldn't find)
};
plAnimStealthNode *fCurrStealth;
IParamMap2 *fCurrParamMap;
bool fInitingNames;
HWND fhWnd;
public:
plPassAnimDlgProc();
virtual ~plPassAnimDlgProc();
BOOL DlgProc(TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
void DeleteThis() {}
void SetThing(ReferenceTarget *m);
virtual void Update(TimeValue t, Interval& valid, IParamMap2* pmap);
void SegmentListChanged( void );
static plPassAnimDlgProc &Get( void );
protected:
// Set all the controls to their stored value
void IInitControls(Animatable *anim, IParamBlock2 *pb);
void IEnableGlobal(HWND hWnd, hsBool enable);
void ILoadNames( IParamBlock2 *pb );
void IExposeStealthNode( HelperObject *stealth, IParamMap2 *thisMap );
void IUpdateSegmentSel( IParamMap2 *thisMap, hsBool clear = false );
void IEnableEaseStopPoints( IParamMap2 *pm, bool enable );
};
/*==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/>.
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==*/
//////////////////////////////////////////////////////////////////////////////
// //
// plPassAnimDlgProc - Base Animation Dlg Proc for plPassMtlBase //
// //
//////////////////////////////////////////////////////////////////////////////
#ifndef _plPassAnimDlgProc_h
#define _plPassAnimDlgProc_h
#include "plPassMtlBase.h"
#include "iparamm2.h"
class plAnimStealthNode;
class IParamMap2;
class plPassAnimDlgProc : public ParamMap2UserDlgProc, public plMtlChangeCallback
{
protected:
// Combo itemdata values
enum
{
kName, // Name of an animation/loop
kDefault, // Default combo value
kInvalid, // Invalid entry (couldn't find)
};
plAnimStealthNode *fCurrStealth;
IParamMap2 *fCurrParamMap;
bool fInitingNames;
HWND fhWnd;
public:
plPassAnimDlgProc();
virtual ~plPassAnimDlgProc();
BOOL DlgProc(TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
void DeleteThis() {}
void SetThing(ReferenceTarget *m);
virtual void Update(TimeValue t, Interval& valid, IParamMap2* pmap);
void SegmentListChanged( void );
static plPassAnimDlgProc &Get( void );
protected:
// Set all the controls to their stored value
void IInitControls(Animatable *anim, IParamBlock2 *pb);
void IEnableGlobal(HWND hWnd, hsBool enable);
void ILoadNames( IParamBlock2 *pb );
void IExposeStealthNode( HelperObject *stealth, IParamMap2 *thisMap );
void IUpdateSegmentSel( IParamMap2 *thisMap, hsBool clear = false );
void IEnableEaseStopPoints( IParamMap2 *pm, bool enable );
};
#endif //_plPassAnimDlgProc_h

View File

@ -1,100 +1,100 @@
/*==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/>.
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==*/
//////////////////////////////////////////////////////////////////////////////
// //
// plPassBaseParamIDs - Common ParamIDs for all plPassMtlBase-derived mtls //
// //
//////////////////////////////////////////////////////////////////////////////
#ifndef _plPassBaseParamIDs_h
#define _plPassBaseParamIDs_h
#define MCN_UPGRADE_OLD_ANIM_BLOCKS
namespace plPassBaseParamIDs
{
enum AdvancedIDs
{
// Specular
kPBAdvUseSpec, // Not used anymore, feel free to replace with new fields as necessary
kPBAdvSpecType, // ditto
kPBAdvShine, // ...
kPBAdvShineStr, // ...
// Misc
kPBAdvWire,
kPBAdvMeshOutlines,
kPBAdvTwoSided,
// Shading
kPBAdvSoftShadow,
kPBAdvNoProj,
kPBAdvVertexShade,
kPBAdvNoShade,
kPBAdvNoFog,
kPBAdvWhite,
// Z
kPBAdvZOnly,
kPBAdvZClear,
kPBAdvZNoRead,
kPBAdvZNoWrite,
kPBAdvZInc,
// Alpha test
kPBAdvAlphaTestHigh
};
enum SpecularTypes
{
kSpecTypeAlpha,
kSpecTypeColor,
kSpecTypeHighlight
};
enum AnimationIDs
{
kPBAnimName,
kPBAnimAutoStart,
kPBAnimLoop,
kPBAnimLoopName,
kPBAnimEaseInType,
kPBAnimEaseOutType,
kPBAnimEaseInLength,
kPBAnimEaseOutLength,
kPBAnimEaseInMin,
kPBAnimEaseInMax,
kPBAnimEaseOutMin,
kPBAnimEaseOutMax,
kPBAnimUseGlobal,
kPBAnimGlobalName,
kPBAnimStealthNodes
};
}
/*==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/>.
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==*/
//////////////////////////////////////////////////////////////////////////////
// //
// plPassBaseParamIDs - Common ParamIDs for all plPassMtlBase-derived mtls //
// //
//////////////////////////////////////////////////////////////////////////////
#ifndef _plPassBaseParamIDs_h
#define _plPassBaseParamIDs_h
#define MCN_UPGRADE_OLD_ANIM_BLOCKS
namespace plPassBaseParamIDs
{
enum AdvancedIDs
{
// Specular
kPBAdvUseSpec, // Not used anymore, feel free to replace with new fields as necessary
kPBAdvSpecType, // ditto
kPBAdvShine, // ...
kPBAdvShineStr, // ...
// Misc
kPBAdvWire,
kPBAdvMeshOutlines,
kPBAdvTwoSided,
// Shading
kPBAdvSoftShadow,
kPBAdvNoProj,
kPBAdvVertexShade,
kPBAdvNoShade,
kPBAdvNoFog,
kPBAdvWhite,
// Z
kPBAdvZOnly,
kPBAdvZClear,
kPBAdvZNoRead,
kPBAdvZNoWrite,
kPBAdvZInc,
// Alpha test
kPBAdvAlphaTestHigh
};
enum SpecularTypes
{
kSpecTypeAlpha,
kSpecTypeColor,
kSpecTypeHighlight
};
enum AnimationIDs
{
kPBAnimName,
kPBAnimAutoStart,
kPBAnimLoop,
kPBAnimLoopName,
kPBAnimEaseInType,
kPBAnimEaseOutType,
kPBAnimEaseInLength,
kPBAnimEaseOutLength,
kPBAnimEaseInMin,
kPBAnimEaseInMax,
kPBAnimEaseOutMin,
kPBAnimEaseOutMax,
kPBAnimUseGlobal,
kPBAnimGlobalName,
kPBAnimStealthNodes
};
}
#endif //_plPassBaseParamIDs_h

File diff suppressed because it is too large Load Diff

View File

@ -1,197 +1,197 @@
/*==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/>.
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 PL_PASSMTL_H
#define PL_PASSMTL_H
#include "Max.h"
//#include "istdplug.h"
#include "iparamb2.h"
//#include "iparamm2.h"
#include "../resource.h"
#include "plPassMtlBase.h"
#include "hsTemplates.h"
#define PASS_MTL_CLASS_ID Class_ID(0x42b6718f, 0x2d579b35)
extern TCHAR *GetString(int id);
class plPassMtl : public plPassMtlBase
{
protected:
virtual void ICloneRefs( plPassMtlBase *target, RemapDir &remap );
public:
enum RefIDs
{
kRefBasic,
kRefAdv,
kRefLayers,
kRefAnim,
};
enum Blocks
{
kBlkBasic,
kBlkAdv,
kBlkLayers,
kBlkAnim,
};
plPassMtl(BOOL loading);
virtual ~plPassMtl();
void DeleteThis() { delete this; }
//From Animatable
Class_ID ClassID() { return PASS_MTL_CLASS_ID; }
SClass_ID SuperClassID() { return MATERIAL_CLASS_ID; }
void GetClassName(TSTR& s) { s = GetString(IDS_PASS_MTL); }
ParamDlg *CreateParamDlg(HWND hwMtlEdit, IMtlParams *imp);
void Update(TimeValue t, Interval& valid);
Interval Validity(TimeValue t);
void NotifyChanged();
BOOL SupportsMultiMapsInViewport() { return FALSE; }
void SetupGfxMultiMaps(TimeValue t, Material *mtl, MtlMakerCallback &cb);
// Shade and displacement calculation
static void GetInterpVtxValue(int channel, ShadeContext &sc, Point3 &interpVal);
void Shade(ShadeContext& sc);
void ShadeWithBackground(ShadeContext &sc, Color background, bool useVtxAlpha = true);
float EvalDisplacement(ShadeContext& sc);
Interval DisplacementValidity(TimeValue t);
virtual RefTargetHandle GetReference( int i );
virtual void SetReference( int i, RefTargetHandle rtarg );
// SubTexmap access methods
int NumSubTexmaps();
Texmap* GetSubTexmap(int i);
void SetSubTexmap(int i, Texmap *m);
TSTR GetSubTexmapSlotName(int i);
TSTR GetSubTexmapTVName(int i);
int SubTexmapOn(int i);
BOOL SetDlgThing(ParamDlg* dlg);
RefTargetHandle Clone( RemapDir &remap );
RefResult NotifyRefChanged(Interval changeInt, RefTargetHandle hTarget,
PartID& partID, RefMessage message);
int NumSubs();
Animatable* SubAnim(int i);
TSTR SubAnimName(int i);
int NumParamBlocks();
IParamBlock2* GetParamBlock(int i);
IParamBlock2* GetParamBlockByID(BlockID id);
// void SetParamDlg(ParamDlg *dlg);
// void SetNumSubTexmaps(int num);
// From MtlBase and Mtl
void SetAmbient(Color c, TimeValue t);
void SetDiffuse(Color c, TimeValue t);
void SetSpecular(Color c, TimeValue t);
void SetShininess(float v, TimeValue t);
Color GetAmbient(int mtlNum=0, BOOL backFace=FALSE);
Color GetDiffuse(int mtlNum=0, BOOL backFace=FALSE);
Color GetSpecular(int mtlNum=0, BOOL backFace=FALSE);
float GetXParency(int mtlNum=0, BOOL backFace=FALSE);
float GetShininess(int mtlNum=0, BOOL backFace=FALSE);
float GetShinStr(int mtlNum=0, BOOL backFace=FALSE);
float WireSize(int mtlNum=0, BOOL backFace=FALSE);
ULONG Requirements( int subMtlNum );
virtual bool HasAlpha();
// Massive list of inherited accessor functions for ParamBlock data
// Advanced Block
virtual int GetBasicWire();
virtual int GetMeshOutlines();
virtual int GetTwoSided();
virtual int GetSoftShadow();
virtual int GetNoProj();
virtual int GetVertexShade();
virtual int GetNoShade();
virtual int GetNoFog();
virtual int GetWhite();
virtual int GetZOnly();
virtual int GetZClear();
virtual int GetZNoRead();
virtual int GetZNoWrite();
virtual int GetZInc();
virtual int GetAlphaTestHigh();
// Animation block
virtual char * GetAnimName();
virtual int GetAutoStart();
virtual int GetLoop();
virtual char * GetAnimLoopName();
virtual int GetEaseInType();
virtual float GetEaseInMinLength();
virtual float GetEaseInMaxLength();
virtual float GetEaseInNormLength();
virtual int GetEaseOutType();
virtual float GetEaseOutMinLength();
virtual float GetEaseOutMaxLength();
virtual float GetEaseOutNormLength();
virtual int GetUseGlobal();
virtual char * GetGlobalVarName();
// Basic block
virtual int GetColorLock();
virtual Color GetAmbColor();
virtual Color GetColor();
virtual int GetOpacity();
virtual int GetEmissive();
virtual int GetUseSpec();
virtual int GetShine();
virtual Color GetSpecularColor();
virtual Control *GetPreshadeColorController();
virtual Control *GetAmbColorController();
virtual Control *GetOpacityController();
virtual Control *GetSpecularColorController();
virtual int GetDiffuseColorLock();
virtual Color GetRuntimeColor();
virtual Control *GetRuntimeColorController();
// Layer block
virtual Texmap *GetBaseLayer();
virtual int GetTopLayerOn();
virtual Texmap *GetTopLayer();
virtual int GetLayerBlend();
virtual int GetOutputAlpha();
virtual int GetOutputBlend();
};
/*==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/>.
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 PL_PASSMTL_H
#define PL_PASSMTL_H
#include "Max.h"
//#include "istdplug.h"
#include "iparamb2.h"
//#include "iparamm2.h"
#include "../resource.h"
#include "plPassMtlBase.h"
#include "hsTemplates.h"
#define PASS_MTL_CLASS_ID Class_ID(0x42b6718f, 0x2d579b35)
extern TCHAR *GetString(int id);
class plPassMtl : public plPassMtlBase
{
protected:
virtual void ICloneRefs( plPassMtlBase *target, RemapDir &remap );
public:
enum RefIDs
{
kRefBasic,
kRefAdv,
kRefLayers,
kRefAnim,
};
enum Blocks
{
kBlkBasic,
kBlkAdv,
kBlkLayers,
kBlkAnim,
};
plPassMtl(BOOL loading);
virtual ~plPassMtl();
void DeleteThis() { delete this; }
//From Animatable
Class_ID ClassID() { return PASS_MTL_CLASS_ID; }
SClass_ID SuperClassID() { return MATERIAL_CLASS_ID; }
void GetClassName(TSTR& s) { s = GetString(IDS_PASS_MTL); }
ParamDlg *CreateParamDlg(HWND hwMtlEdit, IMtlParams *imp);
void Update(TimeValue t, Interval& valid);
Interval Validity(TimeValue t);
void NotifyChanged();
BOOL SupportsMultiMapsInViewport() { return FALSE; }
void SetupGfxMultiMaps(TimeValue t, Material *mtl, MtlMakerCallback &cb);
// Shade and displacement calculation
static void GetInterpVtxValue(int channel, ShadeContext &sc, Point3 &interpVal);
void Shade(ShadeContext& sc);
void ShadeWithBackground(ShadeContext &sc, Color background, bool useVtxAlpha = true);
float EvalDisplacement(ShadeContext& sc);
Interval DisplacementValidity(TimeValue t);
virtual RefTargetHandle GetReference( int i );
virtual void SetReference( int i, RefTargetHandle rtarg );
// SubTexmap access methods
int NumSubTexmaps();
Texmap* GetSubTexmap(int i);
void SetSubTexmap(int i, Texmap *m);
TSTR GetSubTexmapSlotName(int i);
TSTR GetSubTexmapTVName(int i);
int SubTexmapOn(int i);
BOOL SetDlgThing(ParamDlg* dlg);
RefTargetHandle Clone( RemapDir &remap );
RefResult NotifyRefChanged(Interval changeInt, RefTargetHandle hTarget,
PartID& partID, RefMessage message);
int NumSubs();
Animatable* SubAnim(int i);
TSTR SubAnimName(int i);
int NumParamBlocks();
IParamBlock2* GetParamBlock(int i);
IParamBlock2* GetParamBlockByID(BlockID id);
// void SetParamDlg(ParamDlg *dlg);
// void SetNumSubTexmaps(int num);
// From MtlBase and Mtl
void SetAmbient(Color c, TimeValue t);
void SetDiffuse(Color c, TimeValue t);
void SetSpecular(Color c, TimeValue t);
void SetShininess(float v, TimeValue t);
Color GetAmbient(int mtlNum=0, BOOL backFace=FALSE);
Color GetDiffuse(int mtlNum=0, BOOL backFace=FALSE);
Color GetSpecular(int mtlNum=0, BOOL backFace=FALSE);
float GetXParency(int mtlNum=0, BOOL backFace=FALSE);
float GetShininess(int mtlNum=0, BOOL backFace=FALSE);
float GetShinStr(int mtlNum=0, BOOL backFace=FALSE);
float WireSize(int mtlNum=0, BOOL backFace=FALSE);
ULONG Requirements( int subMtlNum );
virtual bool HasAlpha();
// Massive list of inherited accessor functions for ParamBlock data
// Advanced Block
virtual int GetBasicWire();
virtual int GetMeshOutlines();
virtual int GetTwoSided();
virtual int GetSoftShadow();
virtual int GetNoProj();
virtual int GetVertexShade();
virtual int GetNoShade();
virtual int GetNoFog();
virtual int GetWhite();
virtual int GetZOnly();
virtual int GetZClear();
virtual int GetZNoRead();
virtual int GetZNoWrite();
virtual int GetZInc();
virtual int GetAlphaTestHigh();
// Animation block
virtual char * GetAnimName();
virtual int GetAutoStart();
virtual int GetLoop();
virtual char * GetAnimLoopName();
virtual int GetEaseInType();
virtual float GetEaseInMinLength();
virtual float GetEaseInMaxLength();
virtual float GetEaseInNormLength();
virtual int GetEaseOutType();
virtual float GetEaseOutMinLength();
virtual float GetEaseOutMaxLength();
virtual float GetEaseOutNormLength();
virtual int GetUseGlobal();
virtual char * GetGlobalVarName();
// Basic block
virtual int GetColorLock();
virtual Color GetAmbColor();
virtual Color GetColor();
virtual int GetOpacity();
virtual int GetEmissive();
virtual int GetUseSpec();
virtual int GetShine();
virtual Color GetSpecularColor();
virtual Control *GetPreshadeColorController();
virtual Control *GetAmbColorController();
virtual Control *GetOpacityController();
virtual Control *GetSpecularColorController();
virtual int GetDiffuseColorLock();
virtual Color GetRuntimeColor();
virtual Control *GetRuntimeColorController();
// Layer block
virtual Texmap *GetBaseLayer();
virtual int GetTopLayerOn();
virtual Texmap *GetTopLayer();
virtual int GetLayerBlend();
virtual int GetOutputAlpha();
virtual int GetOutputBlend();
};
#endif //PL_PASSMTL_H

View File

@ -1,59 +1,59 @@
/*==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/>.
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 PL_PASSMTLADVPB_H
#define PL_PASSMTLADVPB_H
// Param ID's
enum
{
// Specular
kPassAdvUseSpec, // Not used anymore, feel free to replace with new fields as necessary
kPassAdvSpecType, // ditto
kPassAdvShine, // ...
kPassAdvShineStr, // ...
// Misc
kPassAdvWire,
kPassAdvMeshOutlines,
kPassAdvTwoSided,
// Shading
kPassAdvSoftShadow,
kPassAdvNoProj,
kPassAdvVertexShade,
kPassAdvNoShade,
kPassAdvNoFog,
kPassAdvWhite,
// Z
kPassAdvZOnly,
kPassAdvZClear,
kPassAdvZNoRead,
kPassAdvZNoWrite,
kPassAdvZInc,
};
/*==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/>.
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 PL_PASSMTLADVPB_H
#define PL_PASSMTLADVPB_H
// Param ID's
enum
{
// Specular
kPassAdvUseSpec, // Not used anymore, feel free to replace with new fields as necessary
kPassAdvSpecType, // ditto
kPassAdvShine, // ...
kPassAdvShineStr, // ...
// Misc
kPassAdvWire,
kPassAdvMeshOutlines,
kPassAdvTwoSided,
// Shading
kPassAdvSoftShadow,
kPassAdvNoProj,
kPassAdvVertexShade,
kPassAdvNoShade,
kPassAdvNoFog,
kPassAdvWhite,
// Z
kPassAdvZOnly,
kPassAdvZClear,
kPassAdvZNoRead,
kPassAdvZNoWrite,
kPassAdvZInc,
};
#endif //PL_PASSMTLADVPB_H

View File

@ -1,94 +1,94 @@
/*==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/>.
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 "plPassMtl.h"
#include "plPassBaseParamIDs.h"
using namespace plPassBaseParamIDs;
static ParamBlockDesc2 gPassAdvPB
(
plPassMtl::kBlkAdv, _T("advanced"), IDS_PASS_ADV, GetPassMtlDesc(),
P_AUTO_CONSTRUCT + P_AUTO_UI, plPassMtl::kRefAdv,
// UI
IDD_PASS_ADV, IDS_PASS_ADV, 0, APPENDROLL_CLOSED, NULL,
// Misc Properties
kPBAdvWire, _T("basicWire"), TYPE_BOOL, 0, 0,
p_ui, TYPE_SINGLECHEKBOX, IDC_MISC_WIRE,
end,
kPBAdvMeshOutlines, _T("meshOutlines"), TYPE_BOOL, 0, 0,
p_ui, TYPE_SINGLECHEKBOX, IDC_MISC_MESHOUTLINES,
end,
kPBAdvTwoSided, _T("twoSided"), TYPE_BOOL, 0, 0,
p_ui, TYPE_SINGLECHEKBOX, IDC_MISC_TWOSIDED,
end,
// Shade properties
kPBAdvSoftShadow, _T("softShadow"), TYPE_BOOL, 0, 0,
p_ui, TYPE_SINGLECHEKBOX, IDC_SHADE_SOFTSHADOW,
end,
kPBAdvNoProj, _T("noProj"), TYPE_BOOL, 0, 0,
p_ui, TYPE_SINGLECHEKBOX, IDC_SHADE_NO_PROJ,
end,
kPBAdvVertexShade, _T("vertexShade"), TYPE_BOOL, 0, 0,
p_ui, TYPE_SINGLECHEKBOX, IDC_SHADE_VERTEXSHADE,
end,
kPBAdvNoShade, _T("noShade"), TYPE_BOOL, 0, 0,
p_ui, TYPE_SINGLECHEKBOX, IDC_SHADE_NOSHADE,
end,
kPBAdvNoFog, _T("noFog"), TYPE_BOOL, 0, 0,
p_ui, TYPE_SINGLECHEKBOX, IDC_SHADE_NO_FOG,
end,
kPBAdvWhite, _T("white"), TYPE_BOOL, 0, 0,
p_ui, TYPE_SINGLECHEKBOX, IDC_SHADE_WHITE,
end,
// Z Properties
kPBAdvZOnly, _T("zOnly"), TYPE_BOOL, 0, 0,
p_ui, TYPE_SINGLECHEKBOX, IDC_Z_ZONLY,
end,
kPBAdvZClear, _T("zClear"), TYPE_BOOL, 0, 0,
p_ui, TYPE_SINGLECHEKBOX, IDC_Z_ZCLEAR,
end,
kPBAdvZNoRead, _T("zNoRead"), TYPE_BOOL, 0, 0,
p_ui, TYPE_SINGLECHEKBOX, IDC_Z_ZNOREAD,
end,
kPBAdvZNoWrite, _T("zNoWrite"), TYPE_BOOL, 0, 0,
p_ui, TYPE_SINGLECHEKBOX, IDC_Z_ZNOWRITE,
end,
kPBAdvZInc, _T("zInc"), TYPE_BOOL, 0, 0,
p_ui, TYPE_SINGLECHEKBOX, IDC_Z_INC,
end,
kPBAdvAlphaTestHigh, _T("aTestHigh"), TYPE_BOOL, 0, 0,
p_ui, TYPE_SINGLECHEKBOX, IDC_ALPHA_TEST_HIGH,
p_default, FALSE,
end,
end
);
/*==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/>.
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 "plPassMtl.h"
#include "plPassBaseParamIDs.h"
using namespace plPassBaseParamIDs;
static ParamBlockDesc2 gPassAdvPB
(
plPassMtl::kBlkAdv, _T("advanced"), IDS_PASS_ADV, GetPassMtlDesc(),
P_AUTO_CONSTRUCT + P_AUTO_UI, plPassMtl::kRefAdv,
// UI
IDD_PASS_ADV, IDS_PASS_ADV, 0, APPENDROLL_CLOSED, NULL,
// Misc Properties
kPBAdvWire, _T("basicWire"), TYPE_BOOL, 0, 0,
p_ui, TYPE_SINGLECHEKBOX, IDC_MISC_WIRE,
end,
kPBAdvMeshOutlines, _T("meshOutlines"), TYPE_BOOL, 0, 0,
p_ui, TYPE_SINGLECHEKBOX, IDC_MISC_MESHOUTLINES,
end,
kPBAdvTwoSided, _T("twoSided"), TYPE_BOOL, 0, 0,
p_ui, TYPE_SINGLECHEKBOX, IDC_MISC_TWOSIDED,
end,
// Shade properties
kPBAdvSoftShadow, _T("softShadow"), TYPE_BOOL, 0, 0,
p_ui, TYPE_SINGLECHEKBOX, IDC_SHADE_SOFTSHADOW,
end,
kPBAdvNoProj, _T("noProj"), TYPE_BOOL, 0, 0,
p_ui, TYPE_SINGLECHEKBOX, IDC_SHADE_NO_PROJ,
end,
kPBAdvVertexShade, _T("vertexShade"), TYPE_BOOL, 0, 0,
p_ui, TYPE_SINGLECHEKBOX, IDC_SHADE_VERTEXSHADE,
end,
kPBAdvNoShade, _T("noShade"), TYPE_BOOL, 0, 0,
p_ui, TYPE_SINGLECHEKBOX, IDC_SHADE_NOSHADE,
end,
kPBAdvNoFog, _T("noFog"), TYPE_BOOL, 0, 0,
p_ui, TYPE_SINGLECHEKBOX, IDC_SHADE_NO_FOG,
end,
kPBAdvWhite, _T("white"), TYPE_BOOL, 0, 0,
p_ui, TYPE_SINGLECHEKBOX, IDC_SHADE_WHITE,
end,
// Z Properties
kPBAdvZOnly, _T("zOnly"), TYPE_BOOL, 0, 0,
p_ui, TYPE_SINGLECHEKBOX, IDC_Z_ZONLY,
end,
kPBAdvZClear, _T("zClear"), TYPE_BOOL, 0, 0,
p_ui, TYPE_SINGLECHEKBOX, IDC_Z_ZCLEAR,
end,
kPBAdvZNoRead, _T("zNoRead"), TYPE_BOOL, 0, 0,
p_ui, TYPE_SINGLECHEKBOX, IDC_Z_ZNOREAD,
end,
kPBAdvZNoWrite, _T("zNoWrite"), TYPE_BOOL, 0, 0,
p_ui, TYPE_SINGLECHEKBOX, IDC_Z_ZNOWRITE,
end,
kPBAdvZInc, _T("zInc"), TYPE_BOOL, 0, 0,
p_ui, TYPE_SINGLECHEKBOX, IDC_Z_INC,
end,
kPBAdvAlphaTestHigh, _T("aTestHigh"), TYPE_BOOL, 0, 0,
p_ui, TYPE_SINGLECHEKBOX, IDC_ALPHA_TEST_HIGH,
p_default, FALSE,
end,
end
);
ParamBlockDesc2 *GetPassAdvPB() { return &gPassAdvPB; }

View File

@ -1,85 +1,85 @@
/*==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/>.
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 PL_PASSMTLANIMPB_H
#define PL_PASSMTLANIMPB_H
enum { kPassAnimMain, kPassAnimEase };
#define WM_ROLLOUT_OPEN WM_USER+1
class plAnimEaseDlgProc : public ParamMap2UserDlgProc
{
protected:
void EnableStopPoints(IParamMap2 *pm, bool enable)
{
pm->Enable(kPassEaseInMin, enable);
pm->Enable(kPassEaseInMax, enable);
pm->Enable(kPassEaseOutMin, enable);
pm->Enable(kPassEaseOutMax, enable);
}
public:
BOOL DlgProc(TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg)
{
case WM_INITDIALOG:
{
IParamBlock2 *pb = map->GetParamBlock();
bool stopPoints = false;
if (DoesHaveStopPoints(pb->GetOwner()))
{
stopPoints = true;
break;
}
EnableStopPoints(map, stopPoints);
// If we're doing an ease, set the ease rollup to open
// if (pb->GetInt(kPassEaseInType) != plAnimEaseTypes::kNoEase ||
// pb->GetInt(kPassEaseOutType) != plAnimEaseTypes::kNoEase)
// PostMessage(hWnd, WM_ROLLOUT_OPEN, 0, 0);
}
return TRUE;
// Max doesn't know about the rollup until after WM_CREATE, so we get
// around it by posting a message
//case WM_ROLLOUT_OPEN:
// {
// IRollupWindow *rollup = GetCOREInterface(MTLEDIT_INTERFACE)->GetCommandPanelRollup();
// int idx = rollup->GetPanelIndex(hWnd);
// rollup->SetPanelOpen(idx, TRUE);
// }
// return TRUE;
}
return FALSE;
}
void DeleteThis() {}
};
/*==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/>.
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 PL_PASSMTLANIMPB_H
#define PL_PASSMTLANIMPB_H
enum { kPassAnimMain, kPassAnimEase };
#define WM_ROLLOUT_OPEN WM_USER+1
class plAnimEaseDlgProc : public ParamMap2UserDlgProc
{
protected:
void EnableStopPoints(IParamMap2 *pm, bool enable)
{
pm->Enable(kPassEaseInMin, enable);
pm->Enable(kPassEaseInMax, enable);
pm->Enable(kPassEaseOutMin, enable);
pm->Enable(kPassEaseOutMax, enable);
}
public:
BOOL DlgProc(TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg)
{
case WM_INITDIALOG:
{
IParamBlock2 *pb = map->GetParamBlock();
bool stopPoints = false;
if (DoesHaveStopPoints(pb->GetOwner()))
{
stopPoints = true;
break;
}
EnableStopPoints(map, stopPoints);
// If we're doing an ease, set the ease rollup to open
// if (pb->GetInt(kPassEaseInType) != plAnimEaseTypes::kNoEase ||
// pb->GetInt(kPassEaseOutType) != plAnimEaseTypes::kNoEase)
// PostMessage(hWnd, WM_ROLLOUT_OPEN, 0, 0);
}
return TRUE;
// Max doesn't know about the rollup until after WM_CREATE, so we get
// around it by posting a message
//case WM_ROLLOUT_OPEN:
// {
// IRollupWindow *rollup = GetCOREInterface(MTLEDIT_INTERFACE)->GetCommandPanelRollup();
// int idx = rollup->GetPanelIndex(hWnd);
// rollup->SetPanelOpen(idx, TRUE);
// }
// return TRUE;
}
return FALSE;
}
void DeleteThis() {}
};
#endif

View File

@ -1,95 +1,95 @@
/*==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/>.
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 "plPassMtl.h"
#include "plPassBaseParamIDs.h"
#include "resource.h"
#include "iparamm2.h"
#include "plPassAnimDlgProc.h"
#include "plAnimStealthNode.h"
using namespace plPassBaseParamIDs;
static ParamBlockDesc2 gPassAnimPB
(
plPassMtl::kBlkAnim, _T("anim"), IDS_PASS_ANIM, GetPassMtlDesc(),//NULL,
P_AUTO_CONSTRUCT + P_AUTO_UI + P_CALLSETS_ON_LOAD, plPassMtl::kRefAnim,
// UI
IDD_PASS_ANIM, IDS_PASS_ANIM, 0, 0, &plPassAnimDlgProc::Get(),
#ifdef MCN_UPGRADE_OLD_ANIM_BLOCKS
// THE FOLLOWING ARE ALL OLD PARAMETERS AND SHOULD NO LONGER BE USED. The only reason
// they're here is so we can convert old paramBlocks into the new plAnimStealthNode format
kPBAnimName, _T("animName"), TYPE_STRING, 0, 0,
end,
kPBAnimAutoStart, _T("autoStart"), TYPE_BOOL, 0, 0,
end,
kPBAnimLoop, _T("loop"), TYPE_BOOL, 0, 0,
end,
kPBAnimLoopName, _T("loopName"), TYPE_STRING, 0, 0,
end,
// Anim Ease
kPBAnimEaseInType, _T("easeInType"), TYPE_INT, 0, 0,
end,
kPBAnimEaseInLength, _T("easeInLength"), TYPE_FLOAT, 0, 0,
end,
kPBAnimEaseInMin, _T("easeInMin"), TYPE_FLOAT, 0, 0,
end,
kPBAnimEaseInMax, _T("easeInMax"), TYPE_FLOAT, 0, 0,
end,
kPBAnimEaseOutType, _T("easeOutType"), TYPE_INT, 0, 0,
end,
kPBAnimEaseOutLength, _T("easeOutLength"), TYPE_FLOAT, 0, 0,
end,
kPBAnimEaseOutMin, _T("easeOutMin"), TYPE_FLOAT, 0, 0,
end,
kPBAnimEaseOutMax, _T("easeOutMax"), TYPE_FLOAT, 0, 0,
end,
#endif // MCN_UPGRADE_OLD_ANIM_BLOCKS
kPBAnimUseGlobal, _T("UseGlobal"), TYPE_BOOL, 0, 0,
p_default, FALSE,
p_ui, TYPE_SINGLECHEKBOX, IDC_MTL_USE_GLOBAL,
end,
kPBAnimGlobalName, _T("GlobalName"), TYPE_STRING, 0, 0,
p_default, _T(""),
end,
kPBAnimStealthNodes, _T( "testing" ), TYPE_REFTARG_TAB, 0, 0, 0,
p_accessor, &plStealthNodeAccessor::GetInstance(),
end,
end
);
ParamBlockDesc2 *GetPassAnimPB() { return &gPassAnimPB; }
/*==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/>.
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 "plPassMtl.h"
#include "plPassBaseParamIDs.h"
#include "resource.h"
#include "iparamm2.h"
#include "plPassAnimDlgProc.h"
#include "plAnimStealthNode.h"
using namespace plPassBaseParamIDs;
static ParamBlockDesc2 gPassAnimPB
(
plPassMtl::kBlkAnim, _T("anim"), IDS_PASS_ANIM, GetPassMtlDesc(),//NULL,
P_AUTO_CONSTRUCT + P_AUTO_UI + P_CALLSETS_ON_LOAD, plPassMtl::kRefAnim,
// UI
IDD_PASS_ANIM, IDS_PASS_ANIM, 0, 0, &plPassAnimDlgProc::Get(),
#ifdef MCN_UPGRADE_OLD_ANIM_BLOCKS
// THE FOLLOWING ARE ALL OLD PARAMETERS AND SHOULD NO LONGER BE USED. The only reason
// they're here is so we can convert old paramBlocks into the new plAnimStealthNode format
kPBAnimName, _T("animName"), TYPE_STRING, 0, 0,
end,
kPBAnimAutoStart, _T("autoStart"), TYPE_BOOL, 0, 0,
end,
kPBAnimLoop, _T("loop"), TYPE_BOOL, 0, 0,
end,
kPBAnimLoopName, _T("loopName"), TYPE_STRING, 0, 0,
end,
// Anim Ease
kPBAnimEaseInType, _T("easeInType"), TYPE_INT, 0, 0,
end,
kPBAnimEaseInLength, _T("easeInLength"), TYPE_FLOAT, 0, 0,
end,
kPBAnimEaseInMin, _T("easeInMin"), TYPE_FLOAT, 0, 0,
end,
kPBAnimEaseInMax, _T("easeInMax"), TYPE_FLOAT, 0, 0,
end,
kPBAnimEaseOutType, _T("easeOutType"), TYPE_INT, 0, 0,
end,
kPBAnimEaseOutLength, _T("easeOutLength"), TYPE_FLOAT, 0, 0,
end,
kPBAnimEaseOutMin, _T("easeOutMin"), TYPE_FLOAT, 0, 0,
end,
kPBAnimEaseOutMax, _T("easeOutMax"), TYPE_FLOAT, 0, 0,
end,
#endif // MCN_UPGRADE_OLD_ANIM_BLOCKS
kPBAnimUseGlobal, _T("UseGlobal"), TYPE_BOOL, 0, 0,
p_default, FALSE,
p_ui, TYPE_SINGLECHEKBOX, IDC_MTL_USE_GLOBAL,
end,
kPBAnimGlobalName, _T("GlobalName"), TYPE_STRING, 0, 0,
p_default, _T(""),
end,
kPBAnimStealthNodes, _T( "testing" ), TYPE_REFTARG_TAB, 0, 0, 0,
p_accessor, &plStealthNodeAccessor::GetInstance(),
end,
end
);
ParamBlockDesc2 *GetPassAnimPB() { return &gPassAnimPB; }

File diff suppressed because it is too large Load Diff

View File

@ -1,285 +1,285 @@
/*==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/>.
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 PL_PASSMTLBASE_H
#define PL_PASSMTLBASE_H
#include "hsTemplates.h"
#include "Max.h"
#include "iparamb2.h"
#include "../../PubUtilLib/plInterp/plAnimEaseTypes.h"
class plNoteTrackWatcher;
class plMtlChangeCallback;
class plAnimStealthNode;
class NoteTrack;
class plPassAnimDlgProc;
class plStealthNodeAccessor;
class plMaxNode;
class plErrorMsg;
class plPassMtlBase : public Mtl
{
protected:
friend class plPassAnimDlgProc;
friend class plStealthNodeAccessor;
friend class plNoteTrackWatcher;
plNoteTrackWatcher *fNTWatcher;
IParamBlock2 *fBasicPB;
IParamBlock2 *fAdvPB;
IParamBlock2 *fLayersPB;
IParamBlock2 *fAnimPB;
Interval fIValid;
hsBool fLoading;
hsTArray<NoteTrack *> fNotetracks;
hsBool fStealthsChanged;
hsTArray<plMtlChangeCallback *> fChangeCallbacks;
void IUpdateAnimNodes( void );
plAnimStealthNode *IFindStealth( const char *animName );
plAnimStealthNode *IVerifyStealthPresent( const char *animName );
int IGetNumStealths( hsBool update = true );
plAnimStealthNode *IGetStealth( int index, hsBool update = true );
void ICloneBase( plPassMtlBase *target, RemapDir &remap );
virtual void ICloneRefs( plPassMtlBase *target, RemapDir &remap ) = 0;
public:
// mcn note: as far as I can tell, this is always the same pointer passed around to everyone.
// So since we have trouble getting it all the time, just store the first version we get and
// use that forever and ever
static IMtlParams *fIMtlParams;
plPassMtlBase( BOOL loading );
virtual ~plPassMtlBase();
virtual bool HasAlpha() = 0;
enum Refs
{
//kRefBasic, // Can't do this, long ago they were different in the "derived" classes,
//kRefAdv, // and even tho MAX says it doesn't write refs out by their index, it does
//kRefLayers,
//kRefAnim,
kRefNotetracks = 4 // MUST BE THE LAST REF ID SPECIFIED
};
void SetLoadingFlag( hsBool f ) { fLoading = f; }
void PostLoadAnimPBFixup( void );
void RegisterChangeCallback( plMtlChangeCallback *callback );
void UnregisterChangeCallback( plMtlChangeCallback *callback );
// Change notifys from our ntWatcher
virtual void NoteTrackAdded( void );
virtual void NoteTrackRemoved( void );
virtual void NameChanged( void );
// Loading/Saving
IOResult Load(ILoad *iload);
IOResult Save(ISave *isave);
virtual void Reset( void );
int NumRefs();
virtual RefTargetHandle GetReference( int i );
virtual void SetReference( int i, RefTargetHandle rtarg );
RefResult NotifyRefChanged( Interval changeInt, RefTargetHandle hTarget, PartID &partID, RefMessage message );
// Convert time, called on the setupProps pass for each material applied to a node in the scene
virtual hsBool SetupProperties( plMaxNode *node, plErrorMsg *pErrMsg );
virtual hsBool ConvertDeInit( plMaxNode *node, plErrorMsg *pErrMsg );
int GetNumStealths( void );
plAnimStealthNode *GetStealth( int index );
// Static convert to our plPassMtlBase type, if possible
static plPassMtlBase *ConvertToPassMtl( Mtl *mtl );
// Blend types
enum
{
kBlendNone,
kBlendAlpha,
kBlendAdd,
kBlendMult
};
// Alpha blend types
enum
{
kAlphaDiscard,
kAlphaMultiply,
kAlphaAdd
};
// Advanced Block
virtual int GetBasicWire() = 0;
virtual int GetMeshOutlines() = 0;
virtual int GetTwoSided() = 0;
virtual int GetSoftShadow() = 0;
virtual int GetNoProj() = 0;
virtual int GetVertexShade() = 0;
virtual int GetNoShade() = 0;
virtual int GetNoFog() = 0;
virtual int GetWhite() = 0;
virtual int GetZOnly() = 0;
virtual int GetZClear() = 0;
virtual int GetZNoRead() = 0;
virtual int GetZNoWrite() = 0;
virtual int GetZInc() = 0;
virtual int GetAlphaTestHigh() = 0;
// Animation block
virtual char * GetAnimName() = 0;
virtual int GetAutoStart() = 0;
virtual int GetLoop() = 0;
virtual char * GetAnimLoopName() = 0;
virtual int GetEaseInType() { return plAnimEaseTypes::kNoEase; }
virtual float GetEaseInMinLength() { return 1; }
virtual float GetEaseInMaxLength() { return 1; }
virtual float GetEaseInNormLength() { return 1; }
virtual int GetEaseOutType() { return plAnimEaseTypes::kNoEase; }
virtual float GetEaseOutMinLength() { return 1; }
virtual float GetEaseOutMaxLength() { return 1; }
virtual float GetEaseOutNormLength() { return 1; }
virtual char * GetGlobalVarName() { return NULL; }
virtual int GetUseGlobal() { return 0; }
// Basic block
virtual int GetColorLock() = 0;
virtual Color GetAmbColor() = 0;
virtual Color GetColor() = 0;
virtual int GetOpacity() = 0;
virtual int GetEmissive() = 0;
virtual int GetUseSpec() = 0;
virtual int GetShine() = 0;
virtual Color GetSpecularColor() = 0;
virtual int GetDiffuseColorLock() = 0;
virtual Color GetRuntimeColor() = 0;
virtual Control *GetPreshadeColorController() = 0;
virtual Control *GetAmbColorController() = 0;
virtual Control *GetOpacityController() = 0;
virtual Control *GetSpecularColorController() = 0;
virtual Control *GetRuntimeColorController() = 0;
// Layer block
virtual Texmap *GetBaseLayer() = 0;
virtual int GetTopLayerOn() = 0;
virtual Texmap *GetTopLayer() = 0;
virtual int GetLayerBlend() = 0;
virtual int GetOutputAlpha() = 0;
virtual int GetOutputBlend() = 0;
};
// Make sure min is less than normal, which is less than max
class plEaseAccessor : public PBAccessor
{
protected:
bool fDoingUpdate;
int fBlockID;
int fEaseInMinID, fEaseInMaxID, fEaseInNormID, fEaseOutMinID, fEaseOutMaxID, fEaseOutNormID;
void AdjustMin(IParamBlock2 *pb, ParamID minID, ParamID normalID, ParamID maxID, float value)
{
if (value > pb->GetFloat(normalID))
{
pb->SetValue(normalID, 0, value);
if (value > pb->GetFloat(maxID))
pb->SetValue(maxID, 0, value);
}
}
void AdjustNormal(IParamBlock2 *pb, ParamID minID, ParamID normalID, ParamID maxID, float value)
{
if (value < pb->GetFloat(minID))
pb->SetValue(minID, 0, value);
if (value > pb->GetFloat(maxID))
pb->SetValue(maxID, 0, value);
}
void AdjustMax(IParamBlock2 *pb, ParamID minID, ParamID normalID, ParamID maxID, float value)
{
if (value < pb->GetFloat(normalID))
{
pb->SetValue(normalID, 0, value);
if (value < pb->GetFloat(minID))
pb->SetValue(minID, 0, value);
}
}
public:
plEaseAccessor(int blockID, int easeInMinID, int easeInMaxID, int easeInNormID,
int easeOutMinID, int easeOutMaxID, int easeOutNormID)
{
fDoingUpdate = false;
fBlockID = blockID;
fEaseInMinID = easeInMinID; fEaseInMaxID = easeInMaxID; fEaseInNormID = easeInNormID;
fEaseOutMinID = easeOutMinID; fEaseOutMaxID = easeOutMaxID; fEaseOutNormID = easeOutNormID;
}
void Set(PB2Value& v, ReferenceMaker* owner, ParamID id, int tabIndex, TimeValue t)
{
if (fDoingUpdate)
return;
fDoingUpdate = true;
IParamBlock2 *pb = owner->GetParamBlockByID(fBlockID);
if (id == fEaseInMinID)
AdjustMin(pb, fEaseInMinID, fEaseInNormID, fEaseInMaxID, v.f);
else if (id == fEaseInNormID)
AdjustNormal(pb, fEaseInMinID, fEaseInNormID, fEaseInMaxID, v.f);
else if (id == fEaseInMaxID)
AdjustMax(pb, fEaseInMinID, fEaseInNormID, fEaseInMaxID, v.f);
else if (id == fEaseOutMinID)
AdjustMin(pb, fEaseOutMinID, fEaseOutNormID, fEaseOutMaxID, v.f);
else if (id == fEaseOutNormID)
AdjustNormal(pb, fEaseOutMinID, fEaseOutNormID, fEaseOutMaxID, v.f);
else if (id == fEaseOutMaxID)
AdjustMax(pb, fEaseOutMinID, fEaseOutNormID, fEaseOutMaxID, v.f);
fDoingUpdate = false;
}
};
//// plMtlChangeCallback /////////////////////////////////////////////////////
// Interface class for receiving info about when things change on a material.
class plMtlChangeCallback
{
public:
virtual void NoteTrackListChanged( void ) { ; }
virtual void SegmentListChanged( void ) { ; }
};
/*==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/>.
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 PL_PASSMTLBASE_H
#define PL_PASSMTLBASE_H
#include "hsTemplates.h"
#include "Max.h"
#include "iparamb2.h"
#include "../../PubUtilLib/plInterp/plAnimEaseTypes.h"
class plNoteTrackWatcher;
class plMtlChangeCallback;
class plAnimStealthNode;
class NoteTrack;
class plPassAnimDlgProc;
class plStealthNodeAccessor;
class plMaxNode;
class plErrorMsg;
class plPassMtlBase : public Mtl
{
protected:
friend class plPassAnimDlgProc;
friend class plStealthNodeAccessor;
friend class plNoteTrackWatcher;
plNoteTrackWatcher *fNTWatcher;
IParamBlock2 *fBasicPB;
IParamBlock2 *fAdvPB;
IParamBlock2 *fLayersPB;
IParamBlock2 *fAnimPB;
Interval fIValid;
hsBool fLoading;
hsTArray<NoteTrack *> fNotetracks;
hsBool fStealthsChanged;
hsTArray<plMtlChangeCallback *> fChangeCallbacks;
void IUpdateAnimNodes( void );
plAnimStealthNode *IFindStealth( const char *animName );
plAnimStealthNode *IVerifyStealthPresent( const char *animName );
int IGetNumStealths( hsBool update = true );
plAnimStealthNode *IGetStealth( int index, hsBool update = true );
void ICloneBase( plPassMtlBase *target, RemapDir &remap );
virtual void ICloneRefs( plPassMtlBase *target, RemapDir &remap ) = 0;
public:
// mcn note: as far as I can tell, this is always the same pointer passed around to everyone.
// So since we have trouble getting it all the time, just store the first version we get and
// use that forever and ever
static IMtlParams *fIMtlParams;
plPassMtlBase( BOOL loading );
virtual ~plPassMtlBase();
virtual bool HasAlpha() = 0;
enum Refs
{
//kRefBasic, // Can't do this, long ago they were different in the "derived" classes,
//kRefAdv, // and even tho MAX says it doesn't write refs out by their index, it does
//kRefLayers,
//kRefAnim,
kRefNotetracks = 4 // MUST BE THE LAST REF ID SPECIFIED
};
void SetLoadingFlag( hsBool f ) { fLoading = f; }
void PostLoadAnimPBFixup( void );
void RegisterChangeCallback( plMtlChangeCallback *callback );
void UnregisterChangeCallback( plMtlChangeCallback *callback );
// Change notifys from our ntWatcher
virtual void NoteTrackAdded( void );
virtual void NoteTrackRemoved( void );
virtual void NameChanged( void );
// Loading/Saving
IOResult Load(ILoad *iload);
IOResult Save(ISave *isave);
virtual void Reset( void );
int NumRefs();
virtual RefTargetHandle GetReference( int i );
virtual void SetReference( int i, RefTargetHandle rtarg );
RefResult NotifyRefChanged( Interval changeInt, RefTargetHandle hTarget, PartID &partID, RefMessage message );
// Convert time, called on the setupProps pass for each material applied to a node in the scene
virtual hsBool SetupProperties( plMaxNode *node, plErrorMsg *pErrMsg );
virtual hsBool ConvertDeInit( plMaxNode *node, plErrorMsg *pErrMsg );
int GetNumStealths( void );
plAnimStealthNode *GetStealth( int index );
// Static convert to our plPassMtlBase type, if possible
static plPassMtlBase *ConvertToPassMtl( Mtl *mtl );
// Blend types
enum
{
kBlendNone,
kBlendAlpha,
kBlendAdd,
kBlendMult
};
// Alpha blend types
enum
{
kAlphaDiscard,
kAlphaMultiply,
kAlphaAdd
};
// Advanced Block
virtual int GetBasicWire() = 0;
virtual int GetMeshOutlines() = 0;
virtual int GetTwoSided() = 0;
virtual int GetSoftShadow() = 0;
virtual int GetNoProj() = 0;
virtual int GetVertexShade() = 0;
virtual int GetNoShade() = 0;
virtual int GetNoFog() = 0;
virtual int GetWhite() = 0;
virtual int GetZOnly() = 0;
virtual int GetZClear() = 0;
virtual int GetZNoRead() = 0;
virtual int GetZNoWrite() = 0;
virtual int GetZInc() = 0;
virtual int GetAlphaTestHigh() = 0;
// Animation block
virtual char * GetAnimName() = 0;
virtual int GetAutoStart() = 0;
virtual int GetLoop() = 0;
virtual char * GetAnimLoopName() = 0;
virtual int GetEaseInType() { return plAnimEaseTypes::kNoEase; }
virtual float GetEaseInMinLength() { return 1; }
virtual float GetEaseInMaxLength() { return 1; }
virtual float GetEaseInNormLength() { return 1; }
virtual int GetEaseOutType() { return plAnimEaseTypes::kNoEase; }
virtual float GetEaseOutMinLength() { return 1; }
virtual float GetEaseOutMaxLength() { return 1; }
virtual float GetEaseOutNormLength() { return 1; }
virtual char * GetGlobalVarName() { return NULL; }
virtual int GetUseGlobal() { return 0; }
// Basic block
virtual int GetColorLock() = 0;
virtual Color GetAmbColor() = 0;
virtual Color GetColor() = 0;
virtual int GetOpacity() = 0;
virtual int GetEmissive() = 0;
virtual int GetUseSpec() = 0;
virtual int GetShine() = 0;
virtual Color GetSpecularColor() = 0;
virtual int GetDiffuseColorLock() = 0;
virtual Color GetRuntimeColor() = 0;
virtual Control *GetPreshadeColorController() = 0;
virtual Control *GetAmbColorController() = 0;
virtual Control *GetOpacityController() = 0;
virtual Control *GetSpecularColorController() = 0;
virtual Control *GetRuntimeColorController() = 0;
// Layer block
virtual Texmap *GetBaseLayer() = 0;
virtual int GetTopLayerOn() = 0;
virtual Texmap *GetTopLayer() = 0;
virtual int GetLayerBlend() = 0;
virtual int GetOutputAlpha() = 0;
virtual int GetOutputBlend() = 0;
};
// Make sure min is less than normal, which is less than max
class plEaseAccessor : public PBAccessor
{
protected:
bool fDoingUpdate;
int fBlockID;
int fEaseInMinID, fEaseInMaxID, fEaseInNormID, fEaseOutMinID, fEaseOutMaxID, fEaseOutNormID;
void AdjustMin(IParamBlock2 *pb, ParamID minID, ParamID normalID, ParamID maxID, float value)
{
if (value > pb->GetFloat(normalID))
{
pb->SetValue(normalID, 0, value);
if (value > pb->GetFloat(maxID))
pb->SetValue(maxID, 0, value);
}
}
void AdjustNormal(IParamBlock2 *pb, ParamID minID, ParamID normalID, ParamID maxID, float value)
{
if (value < pb->GetFloat(minID))
pb->SetValue(minID, 0, value);
if (value > pb->GetFloat(maxID))
pb->SetValue(maxID, 0, value);
}
void AdjustMax(IParamBlock2 *pb, ParamID minID, ParamID normalID, ParamID maxID, float value)
{
if (value < pb->GetFloat(normalID))
{
pb->SetValue(normalID, 0, value);
if (value < pb->GetFloat(minID))
pb->SetValue(minID, 0, value);
}
}
public:
plEaseAccessor(int blockID, int easeInMinID, int easeInMaxID, int easeInNormID,
int easeOutMinID, int easeOutMaxID, int easeOutNormID)
{
fDoingUpdate = false;
fBlockID = blockID;
fEaseInMinID = easeInMinID; fEaseInMaxID = easeInMaxID; fEaseInNormID = easeInNormID;
fEaseOutMinID = easeOutMinID; fEaseOutMaxID = easeOutMaxID; fEaseOutNormID = easeOutNormID;
}
void Set(PB2Value& v, ReferenceMaker* owner, ParamID id, int tabIndex, TimeValue t)
{
if (fDoingUpdate)
return;
fDoingUpdate = true;
IParamBlock2 *pb = owner->GetParamBlockByID(fBlockID);
if (id == fEaseInMinID)
AdjustMin(pb, fEaseInMinID, fEaseInNormID, fEaseInMaxID, v.f);
else if (id == fEaseInNormID)
AdjustNormal(pb, fEaseInMinID, fEaseInNormID, fEaseInMaxID, v.f);
else if (id == fEaseInMaxID)
AdjustMax(pb, fEaseInMinID, fEaseInNormID, fEaseInMaxID, v.f);
else if (id == fEaseOutMinID)
AdjustMin(pb, fEaseOutMinID, fEaseOutNormID, fEaseOutMaxID, v.f);
else if (id == fEaseOutNormID)
AdjustNormal(pb, fEaseOutMinID, fEaseOutNormID, fEaseOutMaxID, v.f);
else if (id == fEaseOutMaxID)
AdjustMax(pb, fEaseOutMinID, fEaseOutNormID, fEaseOutMaxID, v.f);
fDoingUpdate = false;
}
};
//// plMtlChangeCallback /////////////////////////////////////////////////////
// Interface class for receiving info about when things change on a material.
class plMtlChangeCallback
{
public:
virtual void NoteTrackListChanged( void ) { ; }
virtual void SegmentListChanged( void ) { ; }
};
#endif // PL_PASSMTLBASE_H

View File

@ -1,52 +1,52 @@
/*==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/>.
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 PL_PASSMTLBASICPB_H
#define PL_PASSMTLBASICPB_H
// Param ID's
enum
{
kPassBasColorLock,
kPassBasColorAmb,
kPassBasColor,
kPassBasOpacity,
kPassBasEmissive,
// Specular
kPassBasUseSpec,
kPassBasShine,
kPassBasShineStr,
// New color stuff
kPassBasDiffuseLock,
kPassBasRunColor,
kPassBasSpecColor
};
/*==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/>.
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 PL_PASSMTLBASICPB_H
#define PL_PASSMTLBASICPB_H
// Param ID's
enum
{
kPassBasColorLock,
kPassBasColorAmb,
kPassBasColor,
kPassBasOpacity,
kPassBasEmissive,
// Specular
kPassBasUseSpec,
kPassBasShine,
kPassBasShineStr,
// New color stuff
kPassBasDiffuseLock,
kPassBasRunColor,
kPassBasSpecColor
};
#endif //PL_PASSMTLBASICPB_H

View File

@ -1,240 +1,240 @@
/*==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/>.
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 "plPassMtl.h"
#include "plPassMtlBasicPB.h"
#include "resource.h"
#include "iparamm2.h"
class PassBasicPBAccessor;
extern PassBasicPBAccessor basicAccessor;
class PassBasicDlgProc;
extern PassBasicDlgProc gPassBasicDlgProc;
static ParamBlockDesc2 gPassBasicPB
(
plPassMtl::kBlkBasic, _T("basic"), IDS_PASS_BASIC, GetPassMtlDesc(),//NULL,
P_AUTO_CONSTRUCT + P_AUTO_UI, plPassMtl::kRefBasic,
// UI
IDD_PASS_BASIC, IDS_PASS_BASIC, 0, 0, &gPassBasicDlgProc,
// Color
kPassBasColorLock, _T("colorLock"), TYPE_BOOL, 0, 0,
p_ui, TYPE_CHECKBUTTON, IDC_LOCK_AD,
p_accessor, &basicAccessor,
end,
kPassBasColorAmb, _T("ambColor"), TYPE_RGBA, P_ANIMATABLE, IDS_BASIC_AMB,
p_ui, TYPE_COLORSWATCH, IDC_LAYER_COLOR_AMB,
p_accessor, &basicAccessor,
end,
kPassBasColor, _T("color"), TYPE_RGBA, P_ANIMATABLE, IDS_BASIC_COLOR,
p_ui, TYPE_COLORSWATCH, IDC_LAYER_COLOR,
p_default, Color(1,1,1),
p_accessor, &basicAccessor,
end,
kPassBasRunColor, _T("runtimeColor"), TYPE_RGBA, P_ANIMATABLE, IDS_BASIC_RUNCOLOR,
p_ui, TYPE_COLORSWATCH, IDC_LAYER_RUNCOLOR,
p_default, Color(-1,-1,-1),
p_accessor, &basicAccessor,
end,
kPassBasDiffuseLock, _T("diffuseLock"), TYPE_BOOL, 0, 0,
p_ui, TYPE_CHECKBUTTON, IDC_LOCK_COLORS,
p_accessor, &basicAccessor,
p_default, TRUE,
end,
// Opacity
kPassBasOpacity, _T("opacity"), TYPE_INT, P_ANIMATABLE, IDS_BASIC_OPAC,
p_ui, TYPE_SPINNER, EDITTYPE_INT, IDC_TR_EDIT, IDC_TR_SPIN, 0.4,
p_range, 0, 100,
p_default, 100,
end,
kPassBasEmissive, _T("emissive"), TYPE_BOOL, 0, 0,
p_ui, TYPE_SINGLECHEKBOX, IDC_LAYER_EMISSIVE_CB,
end,
// Specularity
kPassBasUseSpec, _T("useSpec"), TYPE_BOOL, 0, 0,
p_ui, TYPE_SINGLECHEKBOX, IDC_SHADE_SPECULAR,
p_enable_ctrls, 2, kPassBasShine, kPassBasSpecColor,
end,
kPassBasShine, _T("shine"), TYPE_INT, 0, 0,
p_ui, TYPE_SPINNER, EDITTYPE_INT, IDC_SH_EDIT, IDC_SH_SPIN, 0.4,
p_range, 0, 100,
end,
kPassBasSpecColor, _T("specularColor"), TYPE_RGBA, P_ANIMATABLE, IDS_BASIC_SPECCOLOR,
p_ui, TYPE_COLORSWATCH, IDC_LAYER_SPECCOLOR,
p_default, Color(0,0,0),
end,
// OBSOLETE--here so we can upgrade it to color if necessary
kPassBasShineStr, _T("shineStr"), TYPE_INT, 0, 0,
p_range, -1, 100,
p_default, -1,
end,
end
);
ParamBlockDesc2 *GetPassBasicPB() { return &gPassBasicPB; }
class PassBasicPBAccessor : public PBAccessor
{
bool fColorLocked;
public:
PassBasicPBAccessor() : fColorLocked( false ) {}
void Set(PB2Value& val, ReferenceMaker* owner, ParamID id, int tabIndex, TimeValue t)
{
plPassMtl* mtl = (plPassMtl*)owner;
IParamBlock2 *pb = mtl->GetParamBlockByID(plPassMtl::kBlkBasic);
switch (id)
{
case kPassBasColorLock:
if (val.i)
pb->SetValue(kPassBasColor, t, pb->GetColor(kPassBasColorAmb, t));
break;
case kPassBasDiffuseLock:
if (val.i)
pb->SetValue(kPassBasRunColor, t, pb->GetColor(kPassBasColor, t));
break;
case kPassBasColor:
case kPassBasColorAmb:
case kPassBasRunColor:
ISyncLockedColors( id, pb, val, t );
break;
}
}
void Get(PB2Value& v, ReferenceMaker* owner, ParamID id, int tabIndex, TimeValue t, Interval &valid)
{
}
void ISyncLockedColors( ParamID settingID, IParamBlock2 *pb, PB2Value &val, TimeValue t )
{
int i, numToSet = 0;
ParamID toSet[ 2 ];
if( fColorLocked )
return;
fColorLocked = true;
if( settingID == kPassBasColorAmb && pb->GetInt( kPassBasColorLock, t ) )
{
toSet[ numToSet++ ] = kPassBasColor;
if( pb->GetInt( kPassBasDiffuseLock, t ) )
toSet[ numToSet++ ] = kPassBasRunColor;
}
else if( settingID == kPassBasRunColor && pb->GetInt( kPassBasDiffuseLock, t ) )
{
toSet[ numToSet++ ] = kPassBasColor;
if( pb->GetInt( kPassBasColorLock, t ) )
toSet[ numToSet++ ] = kPassBasColorAmb;
}
else if( settingID == kPassBasColor )
{
if( pb->GetInt( kPassBasColorLock, t ) )
toSet[ numToSet++ ] = kPassBasColorAmb;
if( pb->GetInt( kPassBasDiffuseLock, t ) )
toSet[ numToSet++ ] = kPassBasRunColor;
}
for( i = 0; i < numToSet; i++ )
{
pb->SetValue( toSet[ i ], t, *val.p );
if( pb->GetMap() )
pb->GetMap()->Invalidate( toSet[ i ] );
}
fColorLocked = false;
}
};
static PassBasicPBAccessor basicAccessor;
class PassBasicDlgProc : public ParamMap2UserDlgProc
{
#if 1
protected:
HIMAGELIST hLockButtons;
void LoadLockButtons()
{
static bool loaded = false;
if (loaded)
return;
loaded = true;
HINSTANCE hInst = hInstance;
hLockButtons = ImageList_Create(16, 15, TRUE, 2, 0);
HBITMAP hBitmap = LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_BUTTONS));
HBITMAP hMask = LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_MASKBUTTONS));
ImageList_Add(hLockButtons, hBitmap, hMask);
DeleteObject(hBitmap);
DeleteObject(hMask);
}
void ISetLock(HWND hButton)
{
LoadLockButtons();
ICustButton *iBut = GetICustButton(hButton);
iBut->SetImage(hLockButtons,0,1,0,1,16,15);
iBut->SetType(CBT_CHECK);
ReleaseICustButton(iBut);
}
public:
PassBasicDlgProc() : hLockButtons(NULL) {}
~PassBasicDlgProc() { if (hLockButtons) ImageList_Destroy(hLockButtons); }
#endif
public:
BOOL DlgProc(TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
IParamBlock2 *pb = map->GetParamBlock();
switch (msg)
{
case WM_INITDIALOG:
{
ISetLock(GetDlgItem(hWnd, IDC_LOCK_AD));
ISetLock(GetDlgItem(hWnd, IDC_LOCK_COLORS));
}
return TRUE;
}
return FALSE;
}
void DeleteThis() {}
};
static PassBasicDlgProc gPassBasicDlgProc;
/*==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/>.
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 "plPassMtl.h"
#include "plPassMtlBasicPB.h"
#include "resource.h"
#include "iparamm2.h"
class PassBasicPBAccessor;
extern PassBasicPBAccessor basicAccessor;
class PassBasicDlgProc;
extern PassBasicDlgProc gPassBasicDlgProc;
static ParamBlockDesc2 gPassBasicPB
(
plPassMtl::kBlkBasic, _T("basic"), IDS_PASS_BASIC, GetPassMtlDesc(),//NULL,
P_AUTO_CONSTRUCT + P_AUTO_UI, plPassMtl::kRefBasic,
// UI
IDD_PASS_BASIC, IDS_PASS_BASIC, 0, 0, &gPassBasicDlgProc,
// Color
kPassBasColorLock, _T("colorLock"), TYPE_BOOL, 0, 0,
p_ui, TYPE_CHECKBUTTON, IDC_LOCK_AD,
p_accessor, &basicAccessor,
end,
kPassBasColorAmb, _T("ambColor"), TYPE_RGBA, P_ANIMATABLE, IDS_BASIC_AMB,
p_ui, TYPE_COLORSWATCH, IDC_LAYER_COLOR_AMB,
p_accessor, &basicAccessor,
end,
kPassBasColor, _T("color"), TYPE_RGBA, P_ANIMATABLE, IDS_BASIC_COLOR,
p_ui, TYPE_COLORSWATCH, IDC_LAYER_COLOR,
p_default, Color(1,1,1),
p_accessor, &basicAccessor,
end,
kPassBasRunColor, _T("runtimeColor"), TYPE_RGBA, P_ANIMATABLE, IDS_BASIC_RUNCOLOR,
p_ui, TYPE_COLORSWATCH, IDC_LAYER_RUNCOLOR,
p_default, Color(-1,-1,-1),
p_accessor, &basicAccessor,
end,
kPassBasDiffuseLock, _T("diffuseLock"), TYPE_BOOL, 0, 0,
p_ui, TYPE_CHECKBUTTON, IDC_LOCK_COLORS,
p_accessor, &basicAccessor,
p_default, TRUE,
end,
// Opacity
kPassBasOpacity, _T("opacity"), TYPE_INT, P_ANIMATABLE, IDS_BASIC_OPAC,
p_ui, TYPE_SPINNER, EDITTYPE_INT, IDC_TR_EDIT, IDC_TR_SPIN, 0.4,
p_range, 0, 100,
p_default, 100,
end,
kPassBasEmissive, _T("emissive"), TYPE_BOOL, 0, 0,
p_ui, TYPE_SINGLECHEKBOX, IDC_LAYER_EMISSIVE_CB,
end,
// Specularity
kPassBasUseSpec, _T("useSpec"), TYPE_BOOL, 0, 0,
p_ui, TYPE_SINGLECHEKBOX, IDC_SHADE_SPECULAR,
p_enable_ctrls, 2, kPassBasShine, kPassBasSpecColor,
end,
kPassBasShine, _T("shine"), TYPE_INT, 0, 0,
p_ui, TYPE_SPINNER, EDITTYPE_INT, IDC_SH_EDIT, IDC_SH_SPIN, 0.4,
p_range, 0, 100,
end,
kPassBasSpecColor, _T("specularColor"), TYPE_RGBA, P_ANIMATABLE, IDS_BASIC_SPECCOLOR,
p_ui, TYPE_COLORSWATCH, IDC_LAYER_SPECCOLOR,
p_default, Color(0,0,0),
end,
// OBSOLETE--here so we can upgrade it to color if necessary
kPassBasShineStr, _T("shineStr"), TYPE_INT, 0, 0,
p_range, -1, 100,
p_default, -1,
end,
end
);
ParamBlockDesc2 *GetPassBasicPB() { return &gPassBasicPB; }
class PassBasicPBAccessor : public PBAccessor
{
bool fColorLocked;
public:
PassBasicPBAccessor() : fColorLocked( false ) {}
void Set(PB2Value& val, ReferenceMaker* owner, ParamID id, int tabIndex, TimeValue t)
{
plPassMtl* mtl = (plPassMtl*)owner;
IParamBlock2 *pb = mtl->GetParamBlockByID(plPassMtl::kBlkBasic);
switch (id)
{
case kPassBasColorLock:
if (val.i)
pb->SetValue(kPassBasColor, t, pb->GetColor(kPassBasColorAmb, t));
break;
case kPassBasDiffuseLock:
if (val.i)
pb->SetValue(kPassBasRunColor, t, pb->GetColor(kPassBasColor, t));
break;
case kPassBasColor:
case kPassBasColorAmb:
case kPassBasRunColor:
ISyncLockedColors( id, pb, val, t );
break;
}
}
void Get(PB2Value& v, ReferenceMaker* owner, ParamID id, int tabIndex, TimeValue t, Interval &valid)
{
}
void ISyncLockedColors( ParamID settingID, IParamBlock2 *pb, PB2Value &val, TimeValue t )
{
int i, numToSet = 0;
ParamID toSet[ 2 ];
if( fColorLocked )
return;
fColorLocked = true;
if( settingID == kPassBasColorAmb && pb->GetInt( kPassBasColorLock, t ) )
{
toSet[ numToSet++ ] = kPassBasColor;
if( pb->GetInt( kPassBasDiffuseLock, t ) )
toSet[ numToSet++ ] = kPassBasRunColor;
}
else if( settingID == kPassBasRunColor && pb->GetInt( kPassBasDiffuseLock, t ) )
{
toSet[ numToSet++ ] = kPassBasColor;
if( pb->GetInt( kPassBasColorLock, t ) )
toSet[ numToSet++ ] = kPassBasColorAmb;
}
else if( settingID == kPassBasColor )
{
if( pb->GetInt( kPassBasColorLock, t ) )
toSet[ numToSet++ ] = kPassBasColorAmb;
if( pb->GetInt( kPassBasDiffuseLock, t ) )
toSet[ numToSet++ ] = kPassBasRunColor;
}
for( i = 0; i < numToSet; i++ )
{
pb->SetValue( toSet[ i ], t, *val.p );
if( pb->GetMap() )
pb->GetMap()->Invalidate( toSet[ i ] );
}
fColorLocked = false;
}
};
static PassBasicPBAccessor basicAccessor;
class PassBasicDlgProc : public ParamMap2UserDlgProc
{
#if 1
protected:
HIMAGELIST hLockButtons;
void LoadLockButtons()
{
static bool loaded = false;
if (loaded)
return;
loaded = true;
HINSTANCE hInst = hInstance;
hLockButtons = ImageList_Create(16, 15, TRUE, 2, 0);
HBITMAP hBitmap = LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_BUTTONS));
HBITMAP hMask = LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_MASKBUTTONS));
ImageList_Add(hLockButtons, hBitmap, hMask);
DeleteObject(hBitmap);
DeleteObject(hMask);
}
void ISetLock(HWND hButton)
{
LoadLockButtons();
ICustButton *iBut = GetICustButton(hButton);
iBut->SetImage(hLockButtons,0,1,0,1,16,15);
iBut->SetType(CBT_CHECK);
ReleaseICustButton(iBut);
}
public:
PassBasicDlgProc() : hLockButtons(NULL) {}
~PassBasicDlgProc() { if (hLockButtons) ImageList_Destroy(hLockButtons); }
#endif
public:
BOOL DlgProc(TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
IParamBlock2 *pb = map->GetParamBlock();
switch (msg)
{
case WM_INITDIALOG:
{
ISetLock(GetDlgItem(hWnd, IDC_LOCK_AD));
ISetLock(GetDlgItem(hWnd, IDC_LOCK_COLORS));
}
return TRUE;
}
return FALSE;
}
void DeleteThis() {}
};
static PassBasicDlgProc gPassBasicDlgProc;

View File

@ -1,41 +1,41 @@
/*==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/>.
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 PL_PASSMTLLAYERSPB_H
#define PL_PASSMTLLAYERSPB_H
enum
{
// Layers
kPassLayBase,
kPassLayTopOn,
kPassLayTop,
kPassLayBlend,
kPassLayOutputBlend,
kPassLayOutputAlpha,
};
/*==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/>.
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 PL_PASSMTLLAYERSPB_H
#define PL_PASSMTLLAYERSPB_H
enum
{
// Layers
kPassLayBase,
kPassLayTopOn,
kPassLayTop,
kPassLayBlend,
kPassLayOutputBlend,
kPassLayOutputAlpha,
};
#endif //PL_PASSMTLLAYERSPB_H

View File

@ -1,86 +1,86 @@
/*==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/>.
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 "plPassMtl.h"
#include "plPassMtlLayersPB.h"
#include "resource.h"
#include "iparamm2.h"
#include "Layers/plLayerTex.h"
class PassMtlLayersAccessor;
extern PassMtlLayersAccessor gLayersAccessor;
class LayersDlgProc;
extern LayersDlgProc gLayersDlgProc;
static ParamBlockDesc2 gPassMtlLayersPB
(
plPassMtl::kBlkLayers, _T("layers"), IDS_PASS_LAYERS, GetPassMtlDesc(),
P_AUTO_CONSTRUCT + P_AUTO_UI, plPassMtl::kRefLayers,
// UI
IDD_PASS_LAYERS, IDS_PASS_LAYERS, 0, 0, NULL,
kPassLayBase, _T("baseLayer"), TYPE_TEXMAP, 0, IDS_BASIC_AMB,
p_ui, TYPE_TEXMAPBUTTON, IDC_LAYER1,
p_subtexno, 0,
end,
kPassLayTopOn, _T("topLayerOn"), TYPE_BOOL, 0, 0,
p_ui, TYPE_SINGLECHEKBOX, IDC_TOP_ON,
p_default, FALSE,
p_enable_ctrls, 3, kPassLayTop, kPassLayBlend, kPassLayOutputAlpha,
end,
kPassLayTop, _T("topLayer"), TYPE_TEXMAP, 0, 0,
p_ui, TYPE_TEXMAPBUTTON, IDC_LAYER2,
p_subtexno, 1,
end,
kPassLayBlend, _T("layerBlend"), TYPE_INT, 0, 0,
p_ui, TYPE_RADIO, 3, IDC_LAYER_ALPHA, IDC_LAYER_ADD, IDC_LAYER_MULTIPLY,
p_vals, plPassMtlBase::kBlendAlpha, plPassMtlBase::kBlendAdd, plPassMtlBase::kBlendMult,
p_default, plPassMtlBase::kBlendAdd,
end,
kPassLayOutputAlpha, _T("ouputAlpha"), TYPE_INT, 0, 0,
p_ui, TYPE_RADIO, 3, IDC_OUTPUTA_DISCARD, IDC_OUTPUTA_ADD, IDC_OUTPUTA_MULT,
p_vals, plPassMtlBase::kAlphaDiscard, plPassMtlBase::kAlphaAdd, plPassMtlBase::kAlphaMultiply,
p_default, plPassMtlBase::kAlphaDiscard,
end,
kPassLayOutputBlend, _T("outputBlend"), TYPE_INT, 0, 0,
p_ui, TYPE_RADIO, 3, IDC_OUTPUTB_NONE, IDC_OUTPUTB_ALPHA, IDC_OUTPUTB_ADD,
p_vals, plPassMtlBase::kBlendNone, plPassMtlBase::kBlendAlpha, plPassMtlBase::kBlendAdd,
p_default, plPassMtlBase::kBlendNone,
end,
end
);
ParamBlockDesc2 *GetPassLayersPB() { return &gPassMtlLayersPB; }
/*==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/>.
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 "plPassMtl.h"
#include "plPassMtlLayersPB.h"
#include "resource.h"
#include "iparamm2.h"
#include "Layers/plLayerTex.h"
class PassMtlLayersAccessor;
extern PassMtlLayersAccessor gLayersAccessor;
class LayersDlgProc;
extern LayersDlgProc gLayersDlgProc;
static ParamBlockDesc2 gPassMtlLayersPB
(
plPassMtl::kBlkLayers, _T("layers"), IDS_PASS_LAYERS, GetPassMtlDesc(),
P_AUTO_CONSTRUCT + P_AUTO_UI, plPassMtl::kRefLayers,
// UI
IDD_PASS_LAYERS, IDS_PASS_LAYERS, 0, 0, NULL,
kPassLayBase, _T("baseLayer"), TYPE_TEXMAP, 0, IDS_BASIC_AMB,
p_ui, TYPE_TEXMAPBUTTON, IDC_LAYER1,
p_subtexno, 0,
end,
kPassLayTopOn, _T("topLayerOn"), TYPE_BOOL, 0, 0,
p_ui, TYPE_SINGLECHEKBOX, IDC_TOP_ON,
p_default, FALSE,
p_enable_ctrls, 3, kPassLayTop, kPassLayBlend, kPassLayOutputAlpha,
end,
kPassLayTop, _T("topLayer"), TYPE_TEXMAP, 0, 0,
p_ui, TYPE_TEXMAPBUTTON, IDC_LAYER2,
p_subtexno, 1,
end,
kPassLayBlend, _T("layerBlend"), TYPE_INT, 0, 0,
p_ui, TYPE_RADIO, 3, IDC_LAYER_ALPHA, IDC_LAYER_ADD, IDC_LAYER_MULTIPLY,
p_vals, plPassMtlBase::kBlendAlpha, plPassMtlBase::kBlendAdd, plPassMtlBase::kBlendMult,
p_default, plPassMtlBase::kBlendAdd,
end,
kPassLayOutputAlpha, _T("ouputAlpha"), TYPE_INT, 0, 0,
p_ui, TYPE_RADIO, 3, IDC_OUTPUTA_DISCARD, IDC_OUTPUTA_ADD, IDC_OUTPUTA_MULT,
p_vals, plPassMtlBase::kAlphaDiscard, plPassMtlBase::kAlphaAdd, plPassMtlBase::kAlphaMultiply,
p_default, plPassMtlBase::kAlphaDiscard,
end,
kPassLayOutputBlend, _T("outputBlend"), TYPE_INT, 0, 0,
p_ui, TYPE_RADIO, 3, IDC_OUTPUTB_NONE, IDC_OUTPUTB_ALPHA, IDC_OUTPUTB_ADD,
p_vals, plPassMtlBase::kBlendNone, plPassMtlBase::kBlendAlpha, plPassMtlBase::kBlendAdd,
p_default, plPassMtlBase::kBlendNone,
end,
end
);
ParamBlockDesc2 *GetPassLayersPB() { return &gPassMtlLayersPB; }