Initial commit

This commit is contained in:
Eagle517
2025-02-17 23:17:30 -06:00
commit 7cad314c94
4726 changed files with 1145203 additions and 0 deletions

386
lib/maxsdk40/ActionTable.h Executable file
View File

@ -0,0 +1,386 @@
/**********************************************************************
*<
FILE: ActionTable.h
DESCRIPTION: Action Table definitions
CREATED BY: Scott Morrison
HISTORY: Created 8 February, 2000,
Based on KbdAction.h.
*> Copyright (c) 1998, All Rights Reserved.
**********************************************************************/
// The ActionTable class is used by plug-ins (and core) to export
// tables of items that can be used by the UI to attach to keyboard
// shorcuts, assign to toolbar buttons, and add to menus.
#pragma once
#include "stack.h"
#include "iFnPub.h"
class MaxIcon;
class MacroEntry;
typedef DWORD ActionTableId;
typedef DWORD ActionContextId;
// ActionTableIds used by the system
const ActionTableId kActionMainUI = 0;
const ActionTableId kActionTrackView = 1;
const ActionTableId kActionMaterialEditor = 2;
const ActionTableId kActionVideoPost = 3;
const ActionTableId kActionSchematicView = 5;
const ActionTableId kActionCommonIReshade = 6;
const ActionTableId kActionScanlineIReshade = 7;
class ActionTable;
class IMenu;
// Context IDs used by the system. Several tables may share the same context id.
const ActionContextId kActionMainUIContext = 0;
const ActionContextId kActionTrackViewContext = 1;
const ActionContextId kActionMaterialEditorContext = 2;
const ActionContextId kActionVideoPostContext = 3;
const ActionContextId kActionSchematicViewContext = 5;
const ActionContextId kActionIReshadeContext = 6;
// Description of a command for building action tables from static data
struct ActionDescription {
// A unique identifier for the command (must be uniqe per table)
int mCmdID;
// A string resource id that describes the command
int mDescriptionResourceID;
// A string resource ID for a short name for the action
int mShortNameResourceID;
// A string resource for the category of an operation
int mCategoryResourceID;
};
// Describes an single operation that can be attached to a UI elements
class ActionItem : public InterfaceServer {
public:
virtual int GetId() = 0;
// return true if action executed, and FALSE otherwise
virtual BOOL ExecuteAction() = 0;
// override this if you wish to customize macroRecorder output for this action
CoreExport virtual void EmitMacro();
// internal Execute(), handles macroRecording, etc. and call ExecuteAction() - jbw 9.9.00
CoreExport BOOL Execute();
// Get the text to put on a button
virtual void GetButtonText(TSTR& buttonText) = 0;
// Get the text to use in a menu
virtual void GetMenuText(TSTR& menuText) = 0;
// Get the long description text for tool tips etc.
virtual void GetDescriptionText(TSTR& descText) = 0;
// Get the string describing the category of the item
virtual void GetCategoryText(TSTR& catText) = 0;
// check to see if menu items should be checked, or button pressed
virtual BOOL IsChecked() = 0;
// Check to see if menu item should show up in context menu
virtual BOOL IsItemVisible() = 0;
// Check to see if menu item should be enabled in a menu
virtual BOOL IsEnabled() = 0;
virtual MaxIcon* GetIcon() = 0;
virtual void DeleteThis() = 0;
CoreExport ActionTable* GetTable() { return mpTable; }
CoreExport void SetTable(ActionTable* pTable) { mpTable = pTable; }
CoreExport TCHAR* GetShortcutString();
virtual MacroEntry* GetMacroScript() { return NULL; }
// If this method returns true, then the ActionItem creates
// a menu instead of performing an action
CoreExport virtual BOOL IsDynamicMenu() { return FALSE; }
// This can be called after an action item is created to tell the
// system that is is a dynamic menu action.
CoreExport virtual void SetIsDynamicMenu() {}
// If the ActionItem does produce a menu, this method is called To
// get the menu. See the DynamicMenu class below for an easy way
// to produce these menus. If the menu is requested by a
// right-click quad menu, then hwnd is the window where the click
// occurred, and m is the point in the window where the user
// clicked. If the item is used from a menu bar, hwnd will be NULL.
CoreExport virtual IMenu* GetDynamicMenu(HWND hwnd, IPoint2& m) { return NULL; }
// ActionItems that are deleted after they execute should return TRUE.
CoreExport virtual BOOL IsDynamicAction() { return FALSE; }
protected:
ActionTable* mpTable; // The table that owns the action
};
class ActionCallback;
// A table of actions that can be tied to UI elements (buttons, menus, RC menu,
// keyboard shortcuts)
class ActionTable : public BaseInterfaceServer {
public:
CoreExport ActionTable(ActionTableId id,
ActionContextId contextId,
TSTR& name,
HACCEL hDefaults,
int numIds,
ActionDescription* pOps,
HINSTANCE hInst);
CoreExport ActionTable(ActionTableId id,
ActionContextId contextId,
TSTR& name);
CoreExport ~ActionTable();
// Get/Set the current keyboard accelerators for the table
CoreExport HACCEL GetHAccel() { return mhAccel; }
CoreExport void SetHAccel(HACCEL hAccel) { mhAccel = hAccel; }
// Get the default keyboard accelerator table. This is used when
// the user has not assigned any accelerators.
CoreExport HACCEL GetDefaultHAccel() { return mhDefaultAccel; }
CoreExport void SetDefaultHAccel(HACCEL accel) { mhDefaultAccel = accel; }
CoreExport TSTR& GetName() { return mName; }
CoreExport ActionTableId GetId() { return mId; }
CoreExport ActionContextId GetContextId() { return mContextId; }
// Get the current callback assocuated with this table.
// returns NULL if the table is not active.
CoreExport ActionCallback* GetCallback() { return mpCallback; }
CoreExport void SetCallback(ActionCallback* pCallback) { mpCallback = pCallback; }
// Methods to iterate over the actions in the table
CoreExport int Count() { return mOps.Count(); }
CoreExport ActionItem* operator[](int i) { return mOps[i]; }
// Get an action by its command id.
CoreExport ActionItem* GetAction(int cmdId);
// Add an operation to the table
CoreExport void AppendOperation(ActionItem* pAction);
// Remove an operation from the table
CoreExport BOOL DeleteOperation(ActionItem* pAction);
CoreExport void DeleteThis() { delete this; }
// Get the text to put on a button
CoreExport virtual BOOL GetButtonText(int cmdId, TSTR& buttonText);
// Get the text to use in a menu
CoreExport virtual BOOL GetMenuText(int cmdId, TSTR& menuText)
{ return GetButtonText(cmdId, menuText); }
// Get the long description text for tool tips etc.
CoreExport virtual BOOL GetDescriptionText(int cmdId, TSTR& descText);
// check to see if menu items should be checked, or button pressed
CoreExport virtual BOOL IsChecked(int cmdId) { return FALSE; }
// Check to see if menu item should show up in context menu
CoreExport virtual BOOL IsItemVisible(int cmdId) { return TRUE; }
// Check to see if menu item should be enabled in a menu
CoreExport virtual BOOL IsEnabled(int cmdId) { return TRUE; }
// Write an action identifier to a CUI file or KBD file
// Default implementation is to write the integer ID.
// This is over-riden when command IDs are not persistent
CoreExport virtual void WritePersistentActionId(int cmdId, TSTR& idString);
// Read an action identifier from a CUI file or KBD file
// Default implementation is to read the integer ID.
// This is over-riden when command IDs are not persistent
// Returns -1 if the command is not found in the table
CoreExport virtual int ReadPersistentActionId(TSTR& idString);
// return an optional icon for the command
CoreExport virtual MaxIcon* GetIcon(int cmdId) { return NULL; };
// Fill the action table with the given action descriptions
CoreExport void BuildActionTable(HACCEL hDefaults,
int numIds,
ActionDescription* pOps,
HINSTANCE hInst);
// Get the action assigned to the given accelerator, if any
CoreExport ActionItem* GetCurrentAssignment(ACCEL accel);
// Assign the command to th given accelerator. Also removes any
// previous assignment to that accelerator
CoreExport void AssignKey(int cmdId, ACCEL accel);
// removes the given assignment from the shortcut table
void RemoveShortcutFromTable(ACCEL accel);
private:
// These values are set by the plug-in to describe a action table
// Unique identifier of table (like a class id)
ActionTableId mId;
// An identifier to group tables use the same context. Tables with the
// same context cannot have overlapping keyboard shortcuts.
ActionContextId mContextId;
// Name to use in preference dlg drop-down
TSTR mName;
// Descriptors of all operations that can have Actions
Tab<ActionItem*> mOps;
// The windows accelerator table in use when no keyboard shortcuts saved
HACCEL mhDefaultAccel;
// The windows accelerator table in use
HACCEL mhAccel;
// The currently active callback
ActionCallback* mpCallback;
};
class ActionCallback : public BaseInterfaceServer {
public:
CoreExport virtual ~ActionCallback(){};
CoreExport virtual BOOL ExecuteAction(int id) { return FALSE; }
// called when an action item says it is a dynamic menu
CoreExport virtual IMenu* GetDynamicMenu(int id, HWND hwnd, IPoint2& m) { return NULL; }
// Access to the table the callback uses
ActionTable* GetTable() { return mpTable; }
void SetTable(ActionTable* pTable) { mpTable = pTable; }
private:
ActionTable *mpTable;
};
// An ActionContext is an identifer of a group of keyboard shortcuts.
// Examples are Main UI, Tack View, and Editable Mesh. They are
// registered using Interface::RegisterActionContext().
//
class ActionContext {
public:
ActionContext(ActionContextId contextId, TCHAR *pName)
{ mContextId = contextId; mName = pName; mActive = true; }
TCHAR* GetName() { return mName.data(); }
ActionContextId GetContextId() { return mContextId; }
bool IsActive() { return mActive; }
void SetActive(bool active) { mActive = active; }
private:
ActionContextId mContextId;
TSTR mName;
bool mActive;
};
// The ActionManager manages a set of ActionTables, callbacks and ActionContexts.
// The manager handles the keyboard accelerator tables for each ActionTable
// as well. You get a pointer to this class using Interface::GetActionManager().
#define ACTION_MGR_INTERFACE Interface_ID(0x4bb71a79, 0x4e531e4f)
class IActionManager : public FPStaticInterface {
public:
// Register an action table with the manager.
// Note that most plug-ins will not need this method. Instead,
// plug-ins export action table with the methods in ClassDesc.
virtual void RegisterActionTable(ActionTable* pTable) = 0;
// Methods to iterate over the action table
virtual int NumActionTables() = 0;
virtual ActionTable* GetTable(int i) = 0;
// These methods are used to turn a table on and off.
virtual int ActivateActionTable(ActionCallback* pCallback, ActionTableId id) = 0;
virtual int DeactivateActionTable(ActionCallback* pCallback, ActionTableId id) = 0;
// Find a table based on its id.
virtual ActionTable* FindTable(ActionTableId id) = 0;
// Get the string that describes the keyboard shortcut for the operation
virtual BOOL GetShortcutString(ActionTableId tableId, int commandId, TCHAR* buf) = 0;
// Get A string the descibes an operation
virtual BOOL GetActionDescription(ActionTableId tableId, int commandId, TCHAR* buf) = 0;
// Register an action context. This is called when you create the
// action table that uses this context.
virtual BOOL RegisterActionContext(ActionContextId contextId, TCHAR* pName) = 0;
// Methods to iterate over the action contexts
virtual int NumActionContexts() = 0;
virtual ActionContext* GetActionContext(int i) = 0;
// Find a context based on it's ID.
virtual ActionContext* FindContext(ActionContextId contextId) = 0;
// Query whether a context is active.
virtual BOOL IsContextActive(ActionContextId contextId) = 0;
// Internal methods used by the keyboard shotcut UI
virtual TCHAR* GetShortcutFile() = 0;
virtual TCHAR* GetShortcutDir() = 0;
virtual int IdToIndex(ActionTableId id) = 0;
virtual void SaveAllContextsToINI() = 0;
virtual int MakeActionSetCurrent(TCHAR* pDir, TCHAR* pFile) = 0;
virtual int LoadAccelConfig(LPACCEL *accel, int *cts, ActionTableId tableId = -1,
BOOL forceDefault = FALSE) = 0;
virtual int SaveAccelConfig(LPACCEL *accel, int *cts) = 0;
virtual int GetCurrentActionSet(TCHAR *buf) = 0;
virtual BOOL SaveKeyboardFile(TCHAR* pFileName) = 0;
virtual BOOL LoadKeyboardFile(TCHAR* pFileName) = 0;
virtual TCHAR* GetKeyboardFile() = 0;
// Function IDs
enum {
executeAction,
saveKeyboardFile,
loadKeyboardFile,
getKeyboardFile,
};
};
// The DynamicMenu class provides a way for plugins to produce
// the menu needed in the ActionItem::GetDynamicMenu() method.
class DynamicMenuCallback {
public:
virtual void MenuItemSelected(int itemId) = 0;
};
class DynamicMenu {
public:
CoreExport DynamicMenu(DynamicMenuCallback* pCallback);
// Called after menu creation to get the IMenu created.
// This is the value returned from ActionItem::GetDynamicMenu()
CoreExport IMenu* GetMenu();
enum DynamicMenuFlags {
kDisabled = 1 << 0,
kChecked = 1 << 1,
kSeparator = 1 << 2,
};
// Add an item to the dynamic menu.
CoreExport void AddItem(DWORD flags, UINT itemId, TCHAR* pItemTitle);
CoreExport void BeginSubMenu(TCHAR* pTitle);
CoreExport void EndSubMenu();
private:
Stack<IMenu*> mMenuStack;
DynamicMenuCallback *mpCallback;
};

58
lib/maxsdk40/ChkMtlAPI.h Executable file
View File

@ -0,0 +1,58 @@
/**********************************************************************
*<
FILE: ChkMtlAPI.h
DESCRIPTION: Enhances material handling for particles API
CREATED BY: Eric Peterson
HISTORY: 3-8-99
*> Copyright (c) 2000 Discreet, All Rights Reserved.
*********************************************************************/
// This header defines interface methods used to support indirect material
// referencing and enhanced face/material associations. Generally, these
// methods will need to be implemented by the plugin using them and cannot
// be called from a standard library, since the information required is
// intimately associated with the geometry of the
#ifndef __CHKMTLAPI_H__
#define __CHKMTLAPI_H__
class IChkMtlAPI
{
public:
// SupportsParticleIDbyFace returns TRUE if the object can associate
// a particle number with a face number, and FALSE by default.
virtual BOOL SupportsParticleIDbyFace() { return FALSE; }
// GetParticleFromFace returns the particle to which the face identified
// by faceID belongs.
virtual int GetParticleFromFace(int faceID) { return 0; }
// SupportsIndirMtlRefs returns TRUE if the object can return a material
// pointer given a face being rendered, and FALSE if the object will be
// associated for that render pass with only the object applied to the
// node,
virtual BOOL SupportsIndirMtlRefs() { return FALSE; }
// If SupportsIndirMtlRefs returns TRUE, then the following methods are meaningful.
// NumberOfMtlsUsed returns the number of different materials used on the object
// This number is used in enumerating the different materials via GetNthMtl and getNthMaxMtlID.
virtual int NumberOfMtlsUsed() { return 0; }
// Returns the different materials used on the object.
virtual Mtl *GetNthMtl(int n) { return NULL; }
// Returns the maximum material ID number used with each of the materials on the object
virtual int GetNthMaxMtlID(int n) { return 0; }
// Get MaterialFromFace returns a pointer to the material associated
// with the face identified by faceID.
virtual Mtl *GetMaterialFromFace(int faceID) { return NULL; }
};
#endif //__CHKMTLAPI_H__

27
lib/maxsdk40/CustAttrib.h Executable file
View File

@ -0,0 +1,27 @@
/**********************************************************************
*<
FILE: CustAttrib.h
DESCRIPTION: Defines CustAttrib class
CREATED BY: Nikolai Sander
HISTORY: created 5/25/00
*> Copyright (c) 2000, All Rights Reserved.
**********************************************************************/
#ifndef _ICUSTATTRIB_H_
#define _ICUSTATTRIB_H_
class ICustAttribContainer;
class CustAttrib: public ReferenceTarget
{
public:
virtual TCHAR* GetName(){ return "Custom Attribute";}
virtual ParamDlg *CreateParamDlg(HWND hwMtlEdit, IMtlParams *imp){return NULL;}
virtual bool CheckCopyAttribTo(ICustAttribContainer *to) { return true; }
};
#endif

BIN
lib/maxsdk40/CustDlg.lib Executable file

Binary file not shown.

BIN
lib/maxsdk40/FLILIBD.LIB Executable file

Binary file not shown.

BIN
lib/maxsdk40/FLILIBH.LIB Executable file

Binary file not shown.

BIN
lib/maxsdk40/FLILIBR.LIB Executable file

Binary file not shown.

147
lib/maxsdk40/FileLinkApi.h Executable file
View File

@ -0,0 +1,147 @@
/*********************************************************************
*<
FILE: FileLinkApi.h
DESCRIPTION: File Link interface class
CREATED BY: Nikolai Sander
HISTORY: Created 29 January 1998
*> Copyright (c) 1997-1999, All Rights Reserved.
**********************************************************************/
#ifndef FILELINKAPI_H
#define FILELINKAPI_H
#include <maxtypes.h>
/******
Accessing the Link Table:
If you want your plugin to be able to access the IVizLinkTable interface
without incurring a load-time dependency, add the following function to
your plugin. With this, your plugin will load whether or not the
VizLink plugin is available.
// Returns NULL if the LinkTable plugin is not present on this system.
IVizLinkTable* GetLinkTable()
{
// Look for the LinkTable node in track view.
ITrackViewNode* tvRoot = GetCOREInterface()->GetTrackViewRootNode();
int i = tvRoot->FindItem(VIZLINKTABLE_CLASS_ID);
if (i < 0)
return NULL;
// Get the node's controller.
ITrackViewNode* tvNode = tvRoot->GetNode(i);
Control* pc = tvNode->GetController(VIZLINKTABLE_CLASS_ID);
if (pc == NULL)
return NULL;
// Call GetInterface to confirm that this is the proper instance.
return GetVizLinkTable(pc);
}
******/
#define VIZLINKTABLE_CLASS_ID Class_ID(0xa20bbe82, 0x70c763d)
#define I_VIZLINKCONTROLLER (I_USERINTERFACE+0x1739)
#define GetVizLinkTable(anim) ((IVizLinkTable*)anim->GetInterface(I_VIZLINKCONTROLLER))
#define kFILES_FORMAT -1
class VizLinkList;
class FormatRegistry;
class FormatFactory;
class LinkTableRecord;
class LinkedObjectsEnum;
class IFileLinkManager;
// Interface to the underlying implementation. Also designed as
// a Facade to the more complicated linking process.
//
class IVizLinkTable : public StdControl
{
public :
typedef int Iterator;
// Access to the UI driver.
virtual IFileLinkManager* GetFileLinkManager() = 0;
// If you pass in kFILES_FORMAT for the format argument, the format type will be
// determined from the filename.
virtual BOOL DoAttach(const TCHAR* filename,
int format = 0,
BOOL suppressPrompts = FALSE,
BOOL readOnly = TRUE) = 0;
virtual int NumLinkedFiles() const = 0;
virtual bool GetLinkID(int i, Iterator& iter) const = 0;
virtual bool DoReload(Iterator iter, BOOL suppressPrompts = FALSE) = 0;
virtual bool DoDetach(Iterator iter) = 0;
virtual bool DoBind(Iterator iter) = 0;
virtual LinkTableRecord* RecordAt(IVizLinkTable::Iterator id) = 0;
virtual bool ChangeLinkFile(Iterator iter, const TSTR& str) = 0;
// Auto-reload event handling.
protected:
friend class DBManUI;
// Only DBManUI can turn this on and off.
virtual void EnableAutoReload(bool enable) = 0;
public:
virtual void WaitForReloadThread() const = 0;
public:
// List updating notification.
virtual void RegisterForListUpdates(VizLinkList*) = 0;
virtual void UnregisterForListUpdates(VizLinkList*) = 0;
virtual void UpdateList() = 0;
// For iterating over all linked nodes.
virtual void EnumerateLinkedObjects(LinkedObjectsEnum* EnumProc) = 0;
// Linked splines can be rendered.
virtual void SetRenderSplines(BOOL b) = 0;
virtual BOOL GetRenderSplines() const = 0;
virtual BOOL SetSplineRenderThickness(float f) = 0;
virtual float GetSplineRenderThickness() const = 0;
virtual void SetGenUVs(BOOL b) = 0;
virtual BOOL GetGenUVs() const = 0;
virtual void SetShapeRenderFlags(Object *pObj) const = 0;
// If you are supporting a new format, register your factory class
// here.
virtual BOOL RegisterFactory(Class_ID& cid) = 0;
virtual FormatRegistry* Registry() = 0;
};
// This interface provides access to some of the link manager's functions.
class IFileLinkManager
{
public:
// Select a file, prompt for settings, and link the file.
virtual BOOL DoAttach(BOOL suppressPrompts = FALSE) = 0;
// Display the manager.
virtual void OpenFileLinkManager(Interface* ip) = 0;
// Enable/Disable the manager
virtual void EnableFileLinkManager(BOOL enable) = 0;
};
// If you have a list that you want dynamically updated whenever a
// linked file's status changes, derive your class from this, and
// implement the inherited method(s). For example, a utility plugin
// would derive from both UtilityObj and from VizLinkList.
class VizLinkList
{
public:
virtual void RefreshLinkedFileList() = 0;
};
#endif //FILELINKAPI_H

71
lib/maxsdk40/IAggregation.h Executable file
View File

@ -0,0 +1,71 @@
/**********************************************************************
*<
FILE: IAggregation.h
DESCRIPTION: Interface to object aggregation manager
CREATED BY: John Hutchinson
HISTORY: Created January 9, 1999
*> Copyright (c) 1994, All Rights Reserved.
**********************************************************************/
#pragma once
// DESCRIPTION:
// The IAggregation class is the interface class for representing
// the process of object aggregation
//some constants passed to association class descriptors when editing parameters
#define BEGIN_EDIT 1
#define END_EDIT 2
#define IMAGE_LOAD 3
#define DISPLAY_XRAY 1
typedef enum {eUncommitted,
ePending,
ePartial,
eFully,
eRejecting,
eAborting}
commitlevels;
typedef enum {eNoAffinity,
eSuperClassAffinity,
ePseudoSuperClassAffinity,
eClassAffinity,
eInterfaceAffinity,
eInstanceAffinity}
aggregationaffinity;
class IAggregation
{
public:
virtual void SetActiveComplex(INode* node) = 0;
virtual INode* GetActiveComplex() = 0;
virtual void Reset() = 0;
virtual bool SetProductFactory(SClass_ID superID, Class_ID classID) = 0;
virtual bool RegisterIntermediateFactory(ClassDesc* cd, int affinity) = 0;
virtual void ResetFactories() = 0;
virtual IRollupWindow* GetParamRollup() = 0;
virtual ClassDesc* GetSelClassDesc() = 0;
virtual Animatable* GetSelClassTemplate() = 0;
virtual int ToolbarIndex(ClassDesc* cd) = 0;
virtual HIMAGELIST ToolbarImagelist(int which) = 0;
virtual bool RegisterAssocClass(ClassDesc* cd, int whichbar, int ioe_idx, int iod_idx, int iie_idx, int iid_idx) = 0;
virtual int CommitAggregation(int action, int flag) = 0;
virtual void Suspend() = 0;
virtual void Resume() = 0;
virtual bool isSuspended() = 0;
virtual INode* ReactToNode(INode* newnode) = 0;
virtual commitlevels Status() = 0;
virtual DWORD DisplayFlags() = 0;
};
class ValenceData
{
public:
ValenceData():m_type(0){};
int m_type;
};

443
lib/maxsdk40/ICollision.h Executable file
View File

@ -0,0 +1,443 @@
/**********************************************************************
*<
FILE: ICollision.h
DESCRIPTION: An interface class to our collisions
CREATED BY: Peter Watje
HISTORY: 3-15-00
*> Copyright (c) 200, All Rights Reserved.
**********************************************************************/
#ifndef __ICOLLSION__H
#define __ICOLLISION__H
#include "Max.h"
#include "iparamm2.h"
#include "iFnPub.h"
#define PLANAR_COLLISION_ID Class_ID(0x14585111, 0x444a7dcf)
#define SPHERICAL_COLLISION_ID Class_ID(0x14585222, 0x555a7dcf)
#define MESH_COLLISION_ID Class_ID(0x14585333, 0x666a7dcf)
#define COLLISION_FO_INTERFACE Class_ID(0x14585444, 0x777a7dcf)
#define GetCollisionOpsInterface(cd) \
(CollisionOps *)(cd)->GetInterface(COLLISION_FO_INTERFACE)
#define POINT_COLLISION 1
#define SPHERE_COLLISION 2
#define BOX_COLLISION 4
#define EDGE_COLLISION 8
class ICollision : public ReferenceTarget {
public:
//return what is supported for collision engine
//right now all we support is point to surface collision
//but in the future the others maybe support by us or 3rd party
//it returns the or'd flags above
virtual int SuppportedCollisions() = 0;
//This method is called once before the checkcollision is called for each frame
//which allows you to do some data initializations
virtual void PreFrame(TimeValue t, TimeValue dt) = 0;
//This method is called at the end f each frame solve to allow
//you to destroy any data you don't need want
virtual void PostFrame(TimeValue t, TimeValue dt) = 0;
//point to surface collision
//computes the time at which the particle hit the surface
//t is the end time of the particle
//dt is the delta of time that particle travels
// t-dt = start of time of the particle
//pos the position of the particle in world space
//vel the velocity of the particle in world space
//at is the point in time that the collision occurs with respect to dt
//norm is bounce vector component of the final velocity
//friction is the friction vector component of the final velocity
//inheritVel is the amount of velocity inherited from the motion of the delfector
// this is a rough apporximate
virtual BOOL CheckCollision (TimeValue t,Point3 pos, Point3 vel, float dt,
float &at, Point3 &hitPoint, Point3 &norm, Point3 &friction, Point3 &inheritedVel) = 0;
//sphere to surface collision
virtual BOOL CheckCollision (TimeValue t,Point3 pos, float radius, Point3 vel, float dt,
float &at, Point3 &hitPoint, Point3 &norm, Point3 &friction, Point3 &inheritedVel) = 0;
//box to surface collision
virtual BOOL CheckCollision (TimeValue t, Box3 box, Point3 vel, float dt,
float &at, Point3 &hitPoint, Point3 &norm, Point3 &friction, Point3 &inheritedVel) = 0;
//edge to surface collision
virtual BOOL CheckCollision (TimeValue t,Point3 edgeA,Point3 edgeB ,Point3 vel, float dt,
float &at, Point3 &hitPoint, Point3 &norm, Point3 &friction, Point3 &inheritedVel) = 0;
};
enum { collision_supportedcollisions, collision_preframe,collision_postframe,
collision_point_to_surface,collision_sphere_to_surface ,collision_box_to_surface,
collision_edge_to_surface };
class CollisionOps : public FPInterface
{
virtual int SuppportedCollisions(ReferenceTarget *r) = 0;
virtual void PreFrame(ReferenceTarget *r, TimeValue &t, TimeValue &dt) = 0;
virtual void PostFrame(ReferenceTarget *r, TimeValue &t, TimeValue &dt) = 0;
virtual BOOL CheckCollision (ReferenceTarget *r, TimeValue &t,Point3 *pos, Point3 *vel, float &dt,
float &at, Point3 *hitPoint, Point3 *norm, Point3 *friction, Point3 *inheritedVel) = 0;
//sphere to surface collision
virtual BOOL CheckCollision (ReferenceTarget *r, TimeValue &t,Point3 *pos, float &radius, Point3 *vel, float &dt,
float &at, Point3 *hitPoint, Point3 *norm, Point3 *friction, Point3 *inheritedVel) = 0;
//box to surface collision FIX ME can't publish box3
virtual BOOL CheckCollision (ReferenceTarget *r, TimeValue &t,
Point3 *boxCenter,float &w, float &h, float &d, Point3 *vel, float &dt,
float &at, Point3 *hitPoint, Point3 *norm, Point3 *friction, Point3 *inheritedVel) = 0;
//edge to surface collision
virtual BOOL CheckCollision (ReferenceTarget *r, TimeValue &t,Point3 *edgeA,Point3 *edgeB ,Point3 *vel, float &dt,
float &at, Point3 *hitPoint, Point3 *norm, Point3 *friction, Point3 *inheritedVel) = 0;
};
// block IDs
enum { collisionplane_params, };
// geo_param param IDs
enum { collisionplane_width,
collisionplane_height,
collisionplane_quality,
collisionplane_node,
};
class CollisionPlane : public ICollision
{
private:
INode *node;
public:
IParamBlock2 *pblock;
Interval validity;
CollisionPlane();
~CollisionPlane();
//determines what type of collisions are supported
int SuppportedCollisions()
{
return POINT_COLLISION;
}
void PreFrame(TimeValue t, TimeValue dt) ;
void PostFrame(TimeValue t, TimeValue dt) {}
BOOL CheckCollision (TimeValue t,Point3 pos, Point3 vel, float dt,
float &at, Point3 &hitPoint, Point3 &norm, Point3 &friction, Point3 &inheritedVel);
//sphere to surface collision
BOOL CheckCollision (TimeValue t,Point3 pos, float radius, Point3 vel, float dt,
float &at, Point3 &hitPoint, Point3 &norm, Point3 &friction, Point3 &inheritedVel)
{
return FALSE;
}
//box to surface collision
BOOL CheckCollision (TimeValue t, Box3 box, Point3 vel, float dt,
float &at, Point3 &hitPoint, Point3 &norm, Point3 &friction, Point3 &inheritedVel)
{
return FALSE;
}
//edge to surface collision
BOOL CheckCollision (TimeValue t,Point3 edgeA,Point3 edgeB ,Point3 vel, float dt,
float &at, Point3 &hitPoint, Point3 &norm, Point3 &friction, Point3 &inheritedVel)
{
return FALSE;
}
//access functions to the pblock
void SetWidth(TimeValue t, float w) { pblock->SetValue(collisionplane_width,t,w); }
void SetHeight(TimeValue t, float h) { pblock->SetValue(collisionplane_height,t,h); }
void SetQuality(TimeValue t, int q) { pblock->SetValue(collisionplane_quality,t,q); }
// void SetTM(TimeValue t, Matrix3 tm) { pblock->SetValue(collisionplane_tm,t,&tm); }
void SetNode(TimeValue t, INode *n) { pblock->SetValue(collisionplane_node,t,n);
node = n; }
void SetWidth(Control *c) { pblock->SetController(collisionplane_width,0,c); }
void SetHeight(Control *c) { pblock->SetController(collisionplane_height,0,c); }
void SetQuality(Control *c) { pblock->SetController(collisionplane_quality,0,c); }
// void SetTM(Control *c);
Matrix3 tm, invtm;
Matrix3 prevInvTm;
int initialTime;
Tab<Matrix3> invTmList;
float width, height;
int quality;
// Methods from Animatable
void DeleteThis() { delete this; }
Class_ID ClassID() {return PLANAR_COLLISION_ID;}
SClass_ID SuperClassID() {return REF_MAKER_CLASS_ID;}
// Methods from ReferenceTarget :
int NumRefs() { return 1; }
RefTargetHandle GetReference(int i) { return pblock; }
void SetReference(int i, RefTargetHandle rtarg) {pblock = (IParamBlock2*)rtarg;}
RefTargetHandle Clone(RemapDir &remap = NoRemap())
{
CollisionPlane* newob = new CollisionPlane();
newob->ReplaceReference(0,pblock->Clone(remap));
BaseClone(this, newob, remap);
return newob;
}
RefResult NotifyRefChanged(Interval changeInt, RefTargetHandle hTarget, PartID& partID,RefMessage message)
{
switch (message) {
case REFMSG_CHANGE:
if (hTarget == pblock)
validity.SetEmpty();
break;
}
//note this is ref_stop because we don't want the engine updating it references
//may need a flag to turn this off or on
return( REF_STOP);
}
};
// block IDs
enum { collisionsphere_params, };
// geo_param param IDs
enum { collisionsphere_radius,
collisionsphere_node, //using a node right now this really needs to be a TM but it does not look like tms are hooked up yet in pb2
};
class CollisionSphere : public ICollision
{
private:
INode *node;
public:
IParamBlock2 *pblock;
Interval validity;
CollisionSphere();
~CollisionSphere();
//determines what type of collisions are supported
int SuppportedCollisions()
{
return POINT_COLLISION;
}
void PreFrame(TimeValue t, TimeValue dt) ;
void PostFrame(TimeValue t, TimeValue dt) {}
BOOL CheckCollision (TimeValue t,Point3 pos, Point3 vel, float dt,
float &at, Point3 &hitPoint, Point3 &norm, Point3 &friction, Point3 &inheritedVel);
//sphere to surface collision
BOOL CheckCollision (TimeValue t,Point3 pos, float radius, Point3 vel, float dt,
float &at, Point3 &hitPoint, Point3 &norm, Point3 &friction, Point3 &inheritedVel)
{
return FALSE;
}
//box to surface collision
BOOL CheckCollision (TimeValue t, Box3 box, Point3 vel, float dt,
float &at, Point3 &hitPoint, Point3 &norm, Point3 &friction, Point3 &inheritedVel)
{
return FALSE;
}
//edge to surface collision
BOOL CheckCollision (TimeValue t,Point3 edgeA,Point3 edgeB ,Point3 vel, float dt,
float &at, Point3 &hitPoint, Point3 &norm, Point3 &friction, Point3 &inheritedVel)
{
return FALSE;
}
//access functions to the pblock
void SetRadius(TimeValue t, float r) { pblock->SetValue(collisionsphere_radius,t,r); }
void SetNode(TimeValue t, INode *n) { pblock->SetValue(collisionsphere_node,t,n);
node = n; }
void SetRadius(Control *c) { pblock->SetController(collisionsphere_radius,0,c); }
Matrix3 tm, invtm;
Matrix3 prevInvTm;
Point3 Vc;
float radius;
// Methods from Animatable
void DeleteThis() { delete this; }
Class_ID ClassID() {return SPHERICAL_COLLISION_ID;}
SClass_ID SuperClassID() {return REF_MAKER_CLASS_ID;}
// Methods from ReferenceTarget :
int NumRefs() { return 1; }
RefTargetHandle GetReference(int i) { return pblock; }
void SetReference(int i, RefTargetHandle rtarg) {pblock = (IParamBlock2*)rtarg;}
RefTargetHandle Clone(RemapDir &remap = NoRemap())
{
CollisionSphere* newob = new CollisionSphere();
newob->ReplaceReference(0,pblock->Clone(remap));
BaseClone(this, newob, remap);
return newob;
}
RefResult NotifyRefChanged(Interval changeInt, RefTargetHandle hTarget, PartID& partID,RefMessage message)
{
switch (message) {
case REFMSG_CHANGE:
if (hTarget == pblock)
validity.SetEmpty();
break;
}
//note this is ref_stop because we don't want the engine updating it references
//may need a flag to turn this off or on
return( REF_STOP);
}
};
class CollisionVNormal {
public:
Point3 norm;
DWORD smooth;
CollisionVNormal *next;
BOOL init;
CollisionVNormal() {smooth=0;next=NULL;init=FALSE;norm=Point3(0,0,0);}
CollisionVNormal(Point3 &n,DWORD s) {next=NULL;init=TRUE;norm=n;smooth=s;}
~CollisionVNormal() {delete next;}
void AddNormal(Point3 &n,DWORD s);
Point3 &GetNormal(DWORD s);
void Normalize();
};
// block IDs
enum { collisionmesh_params, };
// geo_param param IDs
enum {
collisionmesh_hit_face_index,
collisionmesh_hit_bary,
collisionmesh_node //using a node right now this really needs to be a TM but it does not look like tms are hooked up yet in pb2
};
class CollisionMesh : public ICollision
{
private:
INode *node;
public:
IParamBlock2 *pblock;
Interval validity;
DWORD outFi;
Point3 outBary;
CollisionMesh();
~CollisionMesh();
//determines what type of collisions are supported
int SuppportedCollisions()
{
return POINT_COLLISION;
}
void PreFrame(TimeValue t, TimeValue dt) ;
void PostFrame(TimeValue t, TimeValue dt) {}
BOOL CheckCollision (TimeValue t,Point3 pos, Point3 vel, float dt,
float &at, Point3 &hitPoint, Point3 &norm, Point3 &friction, Point3 &inheritedVel);
//sphere to surface collision
BOOL CheckCollision (TimeValue t,Point3 pos, float radius, Point3 vel, float dt,
float &at, Point3 &hitPoint, Point3 &norm, Point3 &friction, Point3 &inheritedVel)
{
return FALSE;
}
//box to surface collision
BOOL CheckCollision (TimeValue t, Box3 box, Point3 vel, float dt,
float &at, Point3 &hitPoint, Point3 &norm, Point3 &friction, Point3 &inheritedVel)
{
return FALSE;
}
//edge to surface collision
BOOL CheckCollision (TimeValue t,Point3 edgeA,Point3 edgeB ,Point3 vel, float dt,
float &at, Point3 &hitPoint, Point3 &norm, Point3 &friction, Point3 &inheritedVel)
{
return FALSE;
}
//access functions to the pblock
void SetNode(TimeValue t, INode *n) {
//check for circle loop here
pblock->SetValue(collisionmesh_node,t,n);
node = n; }
Matrix3 tm, invtm;
Matrix3 tmPrev,invtmPrev;
Mesh *dmesh;
int nv,nf;
CollisionVNormal *vnorms;
Point3 *fnorms;
// Mesh *dmeshPrev;
// VNormal *vnormsPrev;
// Point3 *fnormsPrev;
// Methods from Animatable
void DeleteThis() { delete this; }
Class_ID ClassID() {return MESH_COLLISION_ID;}
SClass_ID SuperClassID() {return REF_MAKER_CLASS_ID;}
// Methods from ReferenceTarget :
int NumRefs() { return 1; }
RefTargetHandle GetReference(int i) { return pblock; }
void SetReference(int i, RefTargetHandle rtarg) {pblock = (IParamBlock2*)rtarg;}
RefTargetHandle Clone(RemapDir &remap = NoRemap())
{
CollisionSphere* newob = new CollisionSphere();
newob->ReplaceReference(0,pblock->Clone(remap));
BaseClone(this, newob, remap);
return newob;
}
RefResult NotifyRefChanged(Interval changeInt, RefTargetHandle hTarget, PartID& partID,RefMessage message)
{
switch (message) {
case REFMSG_CHANGE:
if (hTarget == pblock)
validity.SetEmpty();
break;
}
//note this is ref_stop because we don't want the engine updating it references
//may need a flag to turn this off or on
return( REF_STOP);
}
};
#endif __ICOLLSION__H

34
lib/maxsdk40/ICommandPanel.h Executable file
View File

@ -0,0 +1,34 @@
/**********************************************************************
*<
FILE: ICommandPanel
DESCRIPTION: Command Panel API
CREATED BY: Nikolai Sander
HISTORY: created 7/11/00
*> Copyright (c) 1994, All Rights Reserved.
**********************************************************************/
#ifndef __ICOMMANDPANEL_H__
#define __ICOMMANDPANEL_H__
class ICommandPanel : public FPStaticInterface
{
public:
// function IDs
enum {
fnIdGetRollupThreshhold,
fnIdSetRollupThreshhold,
};
virtual int GetRollupThreshold()=0;
virtual void SetRollupThreshold(int iThresh)=0;
};
#define COMMAND_PANEL_INTERFACE Interface_ID(0x411753f6, 0x69a93710)
inline ICommandPanel* GetICommandPanel() { return (ICommandPanel*)GetCOREInterface(COMMAND_PANEL_INTERFACE); }
#endif

View File

@ -0,0 +1,34 @@
/**********************************************************************
*<
FILE: ICustAttribContainer.h
DESCRIPTION: Defines ICustAttribContainer class
CREATED BY: Nikolai Sander
HISTORY: created 5/22/00
*> Copyright (c) 2000, All Rights Reserved.
**********************************************************************/
#ifndef _ICUSTATTRIBCONTAINER_H_
#define _ICUSTATTRIBCONTAINER_H_
class CustAttrib;
class ICustAttribContainer : public ReferenceTarget
{
public:
virtual int GetNumCustAttribs()=0;
virtual CustAttrib *GetCustAttrib(int i)=0;
virtual void AppendCustAttrib(CustAttrib *attribute)=0;
virtual void SetCustAttrib(int i, CustAttrib *attribute)=0;
virtual void InsertCustAttrib(int i, CustAttrib *attribute)=0;
virtual void RemoveCustAttrib(int i)=0;
virtual ParamDlg* CreateParamDlg(HWND hwMtlEdit, IMtlParams *imp)=0;
virtual void CopyParametersFrom(ReferenceMaker *from, RemapDir &remap)=0;
virtual Animatable *GetOwner()=0;
virtual void DeleteThis()=0;
};
#endif

View File

@ -0,0 +1,63 @@
/**********************************************************************
*<
FILE: ID3DGraphicsWindow.h
DESCRIPTION: Direct3D Graphics Window Extension Interface class
CREATED BY: Norbert Jeske
HISTORY:
*> Copyright (c) 2000, All Rights Reserved.
**********************************************************************/
#ifndef _D3D_GRAPHICS_WINDOW_H_
#define _D3D_GRAPHICS_WINDOW_H_
#include <d3dx8.h>
#define D3D_GRAPHICS_WINDOW_INTERFACE_ID Interface_ID(0x681121c4, 0x6e9a797d)
class Mesh;
class ID3DGraphicsWindow : public BaseInterface
{
public:
virtual Interface_ID GetID() { return D3D_GRAPHICS_WINDOW_INTERFACE_ID; }
// Interface Lifetime
virtual LifetimeType LifetimeControl() { return noRelease; }
// Get Direct3D Device from GFX
virtual LPDIRECT3DDEVICE8 GetDevice() = 0;
// Get VertexBuffer from GFX. Unless older Flexible Vertex Formats are in
// use, FVF should be zero.
virtual LPDIRECT3DVERTEXBUFFER8 GetVertexBuffer(UINT length, DWORD FVF) = 0;
// Get IndexBuffer from GFX
virtual LPDIRECT3DINDEXBUFFER8 GetIndexBuffer(UINT length, D3DFORMAT format) = 0;
// Get Transforms from GFX
virtual D3DXMATRIX GetWorldXform() = 0;
virtual D3DXMATRIX GetViewXform() = 0;
virtual D3DXMATRIX GetProjXform() = 0;
// Get Constant Color of specified type from GFX
virtual D3DCOLOR GetColor(ColorType t) = 0;
// Get a pointer to a 'Tab' table array of pointers to enabled Direct3D
// Lights from GFX
virtual Tab<D3DLIGHT8 *> *GetLights() = 0;
// Get Material from GFX
virtual D3DMATERIAL8 GetMaterial() = 0;
// Get Texture Tiling for specified texStage and texCoord from GFX
virtual DWORD GetTextureTiling(int texStage, int coord) = 0;
// Get Texture Transfrom for specified texStage from GFX
virtual D3DXMATRIX GetTexXform(int texStage) = 0;
};
#endif

51
lib/maxsdk40/IDX8PixelShader.h Executable file
View File

@ -0,0 +1,51 @@
/**********************************************************************
*<
FILE: IDX8PixelShader.h
DESCRIPTION: DirectX 8 Pixel Shader Interface Definition
CREATED BY: Nikolai Sander and Norbert Jeske
HISTORY: Created 9/27/00
*> Copyright (c) 2000, All Rights Reserved.
**********************************************************************/
#include <d3dx8.h>
#define DX8_PIXEL_SHADER_INTERFACE_ID Interface_ID(0x56df1953, 0xc6121a3)
class ID3DGraphicsWindow;
class IDX8VertexShader;
class Material;
class IDX8PixelShader: public BaseInterface
{
public:
virtual Interface_ID GetID() { return DX8_PIXEL_SHADER_INTERFACE_ID; }
// Confirm that the Direct3D Device can handle this PixelShader
virtual HRESULT ConfirmDevice(ID3DGraphicsWindow *gw) = 0;
// Confirm that an associated VertexShader will work with this PixelShader
virtual HRESULT ConfirmVertexShader(IDX8VertexShader *pvs) = 0;
// Load PixelShader instructions and textures. PixelShader instructions
// should be loaded once and shared among all the nodes using this
// PixelShader. In addition, any textures necessary for the PixelShader
// effect should be loaded once and shared among all the nodes using this
// PixelShader.
virtual HRESULT Initialize(Material *mtl, INode *node) = 0;
// Number of passes for the effect this PixelShader creates. Note that
// this value will depend on the hardware currently in use.
virtual int GetNumMultiPass() = 0;
// Retrieve the PixelShader handle for the specified pass for use in GFX
virtual DWORD GetPixelShaderHandle(int numPass) = 0;
// Set the PixelShader for the specified pass. This call will be made at
// least once per object to set the per object data for the PixelShader
// such as the PixelShader constants.
virtual HRESULT SetPixelShader(ID3DGraphicsWindow *gw, int numPass) = 0;
};

146
lib/maxsdk40/IDX8VertexShader.h Executable file
View File

@ -0,0 +1,146 @@
/**********************************************************************
*<
FILE: IDX8VertexShader.h
DESCRIPTION: DirectX 8 Vertex Shader Interface Definition
CREATED BY: Nikolai Snader and Norbert Jeske
HISTORY: Created 9/22/00
*> Copyright (c) 2000, All Rights Reserved.
**********************************************************************/
#include <d3dx8.h>
#include "IHardwareShader.h"
#define DX8_VERTEX_SHADER_INTERFACE_ID Interface_ID(0x476a10d9, 0x7f531d40)
struct DX8VSConstant
{
float a,b,c,d;
// Access operators
float& operator[](int i) { return (&a)[i]; }
const float& operator[](int i) const { return (&a)[i]; }
};
class ID3DGraphicsWindow;
class IDX8PixelShader;
class IDX8VertexShader : virtual public IVertexShader, public BaseInterface
{
public:
virtual Interface_ID GetID() { return DX8_VERTEX_SHADER_INTERFACE_ID; }
// Confirm that the Direct3D Device can handle this VertexShader
virtual HRESULT ConfirmDevice(ID3DGraphicsWindow *gw) = 0;
// Confirm that an associated PixelShader will work with this VertexShader
virtual HRESULT ConfirmPixelShader(IDX8PixelShader *pps) = 0;
// Can try tristrips for drawing or must geometry using this VertexShader
// be drawn as triangles? This should return 'true' unless additional per
// vertex data is generated by this VertexShader and this data does not map
// to the Mesh vertices in the same way as existing data the Mesh knows
// about such as texture coordinates.
virtual bool CanTryStrips() = 0;
// Number of passes for the effect this VertexShader creates. Note that
// this value will depend on the hardware currently in use.
virtual int GetNumMultiPass() = 0;
// Retrieve the VertexShader handle for the specified pass for use in GFX
virtual DWORD GetVertexShaderHandle(int numPass) = 0;
// Set the VertexShader for the specified pass. This call will be made at
// least once per object to set the per object data for the VertexShader
// such as the VertexShader constants.
virtual HRESULT SetVertexShader(ID3DGraphicsWindow *gw, int numPass) = 0;
// Drawing functions. These functions are necessary as something other
// than a simple default body if:
//
// 1. The VertexShader needs to add additional per vertex data unknown to
// the Mesh to the VertexBuffer.
//
// 2. The VertexShader needs to have per vertex data ordered differently
// than the standard position, normal, {color, tex coords ordering}.
//
// 3. The VertexShader is being used to create cached VertexBuffers or
// using higher order surfaces.
//
// In the first two cases, the VertexShader has the option of not only
// locking and filling the VertexBuffer with data, but also of making the
// actual DrawPrimitive call. In the third case, the VertexShader must
// make the DrawPrimitive call. The VertexShader indicates that it has
// done the drawing by returning 'true' in the Draw() functions below.
//
// In the case where the VertexShader does not want to do the drawing but
// does want to fill in a VertexBuffer with data, the VertexShader can
// request the GFX to create a VertexBuffer (and possibly an IndexBuffer)
// of appropriate size. The GetVertexBuffer and GetIndexBuffer calls on
// the ID3DGraphicsWindow object will do this and return the allocated
// buffers in subsequent calls or reallocate them if necessary.
//
// Please note that if a PixelShader or PixelShaders are in use, these
// Draw() functions may need to set them for the appropriate passes of a
// multipass rendering if the drawing is done in these Draw() functions.
// If the GFX is doing the drawing, then these Draw() functions are only
// being used to fill in the VertexBuffer with data; the GFX will be doing
// the drawing and will be setting the PixelShaders as appropriate.
// Draw 3D Mesh as TriStrips. Fill in the VertexBuffer with data in the
// order desired by the VertexShader. Return 'true' if the Mesh has
// actually been drawn in this call, 'false' if the GFX is required to make
// the DrawPrimitive call.
virtual bool DrawMeshStrips(ID3DGraphicsWindow *gw, MeshData *data) = 0;
// Draw 3D Mesh as wireframe. Fill in the VertexBuffer with data in the
// order desired by the VertexShader. Return 'true' if the Mesh has
// actually been drawn in this call, 'false' if the GFX is required to make
// the DrawPrimitive call.
virtual bool DrawWireMesh(ID3DGraphicsWindow *gw, WireMeshData *data) = 0;
// Draw 3D lines. A Mesh is being drawn by having line segments handed
// down one at a time.
// Pass in the Mesh data in preparation for drawing 3D lines.
virtual void StartLines(ID3DGraphicsWindow *gw, WireMeshData *data) = 0;
// Add the connectivity information for one two point line segment.
virtual void AddLine(ID3DGraphicsWindow *gw, DWORD *vert, int vis) = 0;
// Draw the line segments accumulated. This should restart the filling of
// a VertexBuffer with the next AddLine call if additional data needs to
// be drawn before EndLines is called. Return 'true' if the Mesh line
// segments have actually been drawn in this call, 'false' if the GFX is
// required to make the DrawPrimitive call.
virtual bool DrawLines(ID3DGraphicsWindow *gw) = 0;
// Let the Mesh know that all drawing and data access is finished.
virtual void EndLines(ID3DGraphicsWindow *gw, GFX_ESCAPE_FN fn) = 0;
// Draw 3D triangles. A Mesh is being drawn by having triangles handed
// down one at a time.
// Pass in the Mesh data in preparation for drawing 3D triangles.
virtual void StartTriangles(ID3DGraphicsWindow *gw, MeshFaceData *data) = 0;
// Add the connectivity information for one triangle.
virtual void AddTriangle(ID3DGraphicsWindow *gw, DWORD index, int *edgeVis) = 0;
// Draw the triangles accumulated. This should restart the filling of a
// VertexBuffer with the next AddTriangle call if additional data needs to
// be drawn before EndTriangles is called. Return 'true' if the Mesh
// triangles have actually been drawn in this call, 'false' if the GFX is
// required to make the DrawPrimitive call.
virtual bool DrawTriangles(ID3DGraphicsWindow *gw) = 0;
// Let the Mesh know that all drawing and data access is finished.
virtual void EndTriangles(ID3DGraphicsWindow *gw, GFX_ESCAPE_FN fn) = 0;
};

181
lib/maxsdk40/IDataChannel.h Executable file
View File

@ -0,0 +1,181 @@
/**********************************************************************
FILE: IDataChannel.h
DESCRIPTION: Intelligent Data Channel API
CREATED BY: Attila Szabo, Discreet
HISTORY: [attilas|19.6.2000]
*> Copyright (c) 1998-2000, All Rights Reserved.
**********************************************************************/
#ifndef __IDATACHANNEL__H
#define __IDATACHANNEL__H
#include "maxtypes.h"
// Macros to be used if any of the method below are implemented in a dll
// The dll project that implements the methods needs to define DATACHANNEL_IMP
#ifdef DATACHANNEL_IMP
#define DataChanExport __declspec(dllexport)
#else
#define DataChanExport __declspec(dllimport)
#endif
// forward declaration
class FPInterface;
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// A data channel is a homogeneous collection of objects of a user defined
// type (data objects). Data channels are uniquely identified by a Class_ID.
//
// Data channels can be associated with any element type of a Max object:
// faces or vertexes of Meshes, etc.
//________________________________________________________________________
class IDataChannel : public InterfaceServer
{
public:
// Returns the unique id of the channel
virtual Class_ID DataChannelID() const =0;
// Returns the number of data objects in this channel
virtual ULONG Count() const { return 0; }
// Self destruction
virtual void DeleteThis() = 0;
};
// interface ID
#define DATACHANNEL_INTERFACE Interface_ID(0x38a718a8, 0x14685b4b)
#define GetDataChannelInterface(obj) ((IDataChannel*)obj->GetInterface(DATACHANNEL_INTERFACE))
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// Face-data channel interface
//
// This is an abstraction of a collection of data objects that is
// associated with faces of Max objects
// Max objects that have face-data channels call the methods of this interface
// when those faces change in some way. The data channels can then react to
// the changes to the faces.
//
// Currently only Meshes support face-data channels.
//________________________________________________________________________
class IFaceDataChannel : public IDataChannel
{
public:
//
// --- face specific operations\events ---
//
// These methods are called by the owner of face-data channels
// when its faces change in some way. It's up to the face-data channel
// to do wathever it wants to do on these notification methods.
// Called when num new faces were created at index at in the
// object's list of faces. Returns TRUE on success
// ULONG at - index in the object's array of faces where the new faces
// were inserted
// ULONG num - the number of new faces created
virtual BOOL FacesCreated( ULONG at, ULONG num ) = 0;
// Called when the owner object has cloned some of its faces and appended
// then to its list of faces.
// BitArray& set - bitarray with as many bits as many faces the owner
// object has. Bits set to 1 correspond to cloned faces
virtual BOOL FacesClonedAndAppended( BitArray& set ) = 0;
// Called when faces were deleted in the owner object. Returns TRUE on success
// BitArray& set - bitarray with as many bits as many faces the owner
// object has. Bits set to 1 correspond to deleted faces
virtual BOOL FacesDeleted( BitArray& set ) = 0;
// Called when faces were deleted in the owner object. Returns TRUE on success
// Allwos for a more efficient deletion of a range of data objects
// than using a BitArray
// ULONG from - index in the object's array of faces. Faces starting
// from this index were deleted
// ULONG num - number of faces that were deleted
virtual BOOL FacesDeleted( ULONG from, ULONG num ) = 0;
// Called when all faces in the owner object are deleted
virtual void AllFacesDeleted() = 0;
// Called when a face has been copied from index from in the owner object's
// array of faces to the face at index to.
// ULONG from - index of source face
// ULONG to - index of dest face
virtual BOOL FaceCopied( ULONG from, ULONG to ) = 0;
// Called when a new face has been created in the owner object based on
// data interpolated from other faces
// ULONG numSrc - the number of faces used in the interpolation
// ULONG* srcFaces - array of numSrc face indeces in the owner object's
// face array. These faces were used when creating the new face
// float* coeff - array of numSrc coefficients used in the interpolation
// ULONG targetFace - the index in the owner object's array of faces of the
// newly created face
virtual BOOL FaceInterpolated( ULONG numSrc,
ULONG* srcFaces,
float* coeff,
ULONG targetFace ) = 0;
//
// --- geometry pipeline (stack) specific methods ---
//
// These methods are called when the owner object is flowing up the
// pipeline (stack). They must be implemented to ensure that the
// face-data channel flows up the pipeline correctly.
// The owner object expects the face-data to do exactly what the
// names of these methods imply. These can be seen as commands that are
// given by the owner object to the face-data channel
// Allocates an empty data-channel
virtual IFaceDataChannel* CreateChannel( ) = 0;
// The data-channel needs to allocate a new instance of itself and fill it
// with copies of all data items it stores.
// This method exist to make it more efficient to clone the whole data-channel
virtual IFaceDataChannel* CloneChannel( ) = 0;
// The data-channel needs to append the data objects in the fromChan
// to itself.
virtual BOOL AppendChannel( const IFaceDataChannel* fromChan ) = 0;
};
// interface ID
#define FACEDATACHANNEL_INTERFACE Interface_ID(0x181358d5, 0x3cab1bc9)
#define GetFaceDataChannelInterface(obj) ((IFaceDataChannel*)obj->GetInterface(FACEDATACHANNEL_INTERFACE))
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// Interface class that allows to execute a callback method (Proc) for all
// face-data channels of an object.
//
// Developers should derive their own classes from this interface and
// overwrite the Proc method to call the desired IFaceDataChannel method
// It is up to derived class to interpret the context parameter passed to
// Proc.
//
// --- Usage ---
// Classes that hold face-data channels, can implement a method called
// EnumFaceDataChannels( IFaceDataEnumCallBack& cb, void* pContext)
// This method would be called with a reference to an instance of a class
// derived from IFaceDataEnumCallBack in which Proc was overwritten. The
// implementation of EnumFaceDataChannels would call cb.Proc for each of
// the face-data channels of the object
//
// Warning:
// Deleting data channels from within Proc can lead to unexpected behaviour
//________________________________________________________________________
class IFaceDataChannelsEnumCallBack
{
public:
virtual BOOL Proc( IFaceDataChannel* pChan, void* pContext ) = 0;
};
#endif

83
lib/maxsdk40/IFaceDataMgr.h Executable file
View File

@ -0,0 +1,83 @@
/**********************************************************************
FILE: IFaceDataMgr.h
DESCRIPTION: Face-Data management API
CREATED BY: Attila Szabo, Discreet
HISTORY: [attilas|30.8.2000]
*> Copyright (c) 1998-2000, All Rights Reserved.
**********************************************************************/
#ifndef __IFACEDATAMGR__H
#define __IFACEDATAMGR__H
#include "idatachannel.h"
#include "baseinterface.h"
// GUID that identifies this ifc (interface)
#define FACEDATAMGR_INTERFACE Interface_ID(0x1b454148, 0x6a066927)
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// Interface for managing face-data channels.
// Objects that want to have face-data channels should implement this ifc
//
// If this interface needs to b changed, a new one should be derived from
// it and changed (IFaceDataMgr2) and made sure objects that support
// face-data implement both old and new interfaces
//________________________________________________________________________
class IFaceDataMgr : public BaseInterface
{
public:
//
// Modifiers and procedural objects should call these methods
// to add\remove\retrieve a face-data channel on an object (mesh,patch,poly)
//
// Returns the number of face-data-channels
virtual ULONG NumFaceDataChans( ) const = 0;
// Retrieves a face-data-channel
virtual IFaceDataChannel* GetFaceDataChan( const Class_ID& ID ) const = 0;
// Adds a face-data-channel to the object. Returns TRUE on success
virtual BOOL AddFaceDataChan( IFaceDataChannel* pChan ) = 0;
// Removes a face-data-channel from the object. Returns TRUE on success
virtual BOOL RemoveFaceDataChan( const Class_ID& ID ) = 0;
//
// The "system" (Max) should call these methods to manage the
// face-data channels when the object flows up the stack
//
// Appends a face-data-channel to the object. Returns TRUE on success
virtual BOOL AppendFaceDataChan( const IFaceDataChannel* pChan ) = 0;
// Adds or appends face-data channels from the from object, to this object
// If the channel already exists on this object, it's appended otherwise
// gets added
virtual BOOL CopyFaceDataChans( const IFaceDataMgr* pFrom ) = 0;
// Deletes all face-data-channels from this object
virtual void RemoveAllFaceDataChans() = 0;
// Mechanism for executing an operation for all face-data-channels on this object:
// For all face-data-channels calls IFaceDataEnumCallBack::proc() with
// a pointer to that face-data- channel and a context data
// Returns FALSE if the call back returns FALSE for any of the face-data-channels
virtual BOOL EnumFaceDataChans( IFaceDataChannelsEnumCallBack& cb, void* pContext ) const = 0;
// Allow persistance of info kept in object implementing this interface
virtual IOResult Save(ISave* isave) = 0;
virtual IOResult Load(ILoad* iload) = 0;
// --- from GenericInterface
virtual Interface_ID GetID() { return FACEDATAMGR_INTERFACE; }
};
#endif

72
lib/maxsdk40/IFaceDataMgrImpl.h Executable file
View File

@ -0,0 +1,72 @@
/**********************************************************************
FILE: IMeshFaceDataMgrmpl.h
DESCRIPTION: Face-Data management API implementation
CREATED BY: Attila Szabo, Discreet
HISTORY: [attilas|30.8.2000]
*> Copyright (c) 1998-2000, All Rights Reserved.
**********************************************************************/
#ifndef __IFACEDATAMGRIMPL__H
#define __IFACEDATAMGRIMPL__H
#include "ifacedatamgr.h"
#pragma warning (disable: 4786)
#include <map>
#include "export.h"
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// Face-data management implementation
//________________________________________________________________________
class IFaceDataMgrImpl : public IFaceDataMgr
{
public:
typedef std::map<Class_ID, IFaceDataChannel*> FaceDataChannels;
typedef FaceDataChannels::iterator FaceDataChanIt;
typedef FaceDataChannels::const_iterator FaceDataChanConstIt;
// --- from IFaceDataMgr
DllExport virtual ULONG NumFaceDataChans( ) const;
DllExport virtual IFaceDataChannel* GetFaceDataChan( const Class_ID& ID ) const;
DllExport virtual BOOL AddFaceDataChan( IFaceDataChannel* pChan );
DllExport virtual BOOL RemoveFaceDataChan( const Class_ID& ID );
DllExport virtual BOOL AppendFaceDataChan( const IFaceDataChannel* pChan );
DllExport virtual BOOL CopyFaceDataChans( const IFaceDataMgr* pFrom );
DllExport virtual void RemoveAllFaceDataChans();
DllExport virtual BOOL EnumFaceDataChans( IFaceDataChannelsEnumCallBack& cb, void* pContext ) const;
// Allow persistance of info kept in object implementing this interface
virtual IOResult Save(ISave* isave) { return IO_OK; };
virtual IOResult Load(ILoad* iload) { return IO_OK; };
// --- from GenericInterface
DllExport virtual BaseInterface* CloneInterface(void* remapDir = NULL);
// --- our own methods
DllExport IFaceDataMgrImpl( );
DllExport virtual ~IFaceDataMgrImpl( );
// --- typedefs
class CopyFaceDataCB : public IFaceDataChannelsEnumCallBack
{
public:
DllExport virtual BOOL Proc( IFaceDataChannel* pChan, void* pContext );
};
class DeleteFaceDataSetCB : public IFaceDataChannelsEnumCallBack
{
public:
DllExport virtual BOOL Proc( IFaceDataChannel* pChan, void* pContext );
};
protected:
FaceDataChannels fDataChans;
};
#endif

371
lib/maxsdk40/IGeomImp.h Executable file
View File

@ -0,0 +1,371 @@
/**********************************************************************
*<
FILE: IGeomImp.h
DESCRIPTION: Declaration of the interface which a puppet must implement.
A puppet is essentially a geometry machine with a series of
set poses and operations.
CREATED BY: John Hutchinson
HISTORY: Dec 9, 1997
*> Copyright (c) 1997, All Rights Reserved.
**********************************************************************/
#ifndef __IGEOMPUPPET_H
#define __IGEOMPUPPET_H
#include "export.h"
#include <windows.h>
#include "maxtypes.h"
//FIX ME
//THis should not depend on GE
//but for now we use some of its classes
class AcGePoint3d;
class AcGeVector3d;
class AcGePlane;
class AcGePoint2d;
class AcGeVector2d;
#define OP_TIMING
//FIX ME
//This shouldn't depend on amodeler
//but for now we use some of its classes
//JH 3/9/99 Removing references to vertexdata
//#include "../msdkamodeler/inc/vertdata.h"
//need the mesh class for TriangulateMesh
#include "max.h"
class INode;
class ViewExp;
extern inline AcGePoint3d* MaxArToGeAr(const Point3* maxPt, int numverts);
#define MAX_MESH_ID 0x00000001
#define AMODELER_BODY_ID 0x00000002
#define AMODELER_BODY_EX_ID 0x00000003
class OpTimer;
class IGeomImp {
enum TesselationType
{
kTriangles,
kQuadrilaterals,
kTriStrips
};
protected:
public:
static DllExport OpTimer opstatistics; //exported from core, initialized in hostcomp.cpp
//access to the actual internal geometry representation
// virtual void SetInternalRepresentation(LONG RepID, void *rep);
virtual ~IGeomImp(void) {};
virtual void Init(void *prep = NULL, LONG RepID = -1) = 0;
virtual void *GetInternalRepresentation(LONG RepID, bool* needsdelete)= 0;// access to the wrapped cache
virtual LONG NativeRepresentationID() = 0;
///////////////////////////////////////////////////////////////////////////
//
// pseudoconstructors
//
//JH In the process of overloading these for ease of use in MAX 03/26/99
virtual bool createBox(const Point3& p) = 0;
virtual bool createBox(const AcGePoint3d& p, const AcGeVector3d& vec) = 0;
virtual bool createSphere(float radius, int sides, BOOL smooth = TRUE) = 0;
virtual bool createSphere(const AcGePoint3d& p, double radius, int approx) = 0;
virtual bool createCylinder(float height, float radius, int sides , BOOL smooth = TRUE) = 0;
virtual bool createCylinder(const AcGePoint3d& axisStart, const AcGePoint3d& axisEnd,
double radius, int approx) = 0;
virtual bool createCone(float height, float radius1, float radius2, int sides , BOOL smooth = TRUE) = 0;
virtual bool createCone(const AcGePoint3d& axisStart, const AcGePoint3d& axisEnd,
const AcGeVector3d& baseNormal, double radius1, double radius2, int approx) = 0;
virtual bool createPipe(float height, float radius1, float radius2, int sides , BOOL smooth = TRUE) = 0;
virtual bool createPipe(const AcGePoint3d& axisStart, const AcGePoint3d& axisEnd,
const AcGeVector3d& baseNormal,
double dblOuterRadius, double dblInnerRadius,
int approx) = 0;
virtual void createPipeConic(const AcGePoint3d& axisStart, const AcGePoint3d& axisEnd,
const AcGeVector3d& baseNormal,
double outterRadius1, double innerRadius1,
double outterRadius2, double innerRadius2,
int approx) = 0;
virtual void createTetrahedron(const AcGePoint3d& p1, const AcGePoint3d& p2,
const AcGePoint3d& p3, const AcGePoint3d& p4) = 0;
virtual bool createTorus(float majorRadius, float minorRadius, int sidesa, int segs, BOOL smooth = TRUE) = 0;
virtual bool createTorus(const AcGePoint3d& axisStart, const AcGePoint3d& axisEnd,
double majorRadius, double minorRadius, int majorApprox, int minorApprox) = 0;
/*
virtual void createReducingElbow(const AcGePoint3d& elbowCenter, const AcGePoint3d& endCenter1,
const AcGePoint3d& endCenter2, double endRadius1, double endRadius2,
int majorApprox, int minorApprox) = 0;
virtual void createRectToCircleReducer(
const AcGePoint3d& baseCorner,
const AcGeVector2d& baseSizes,
const AcGePoint3d& circleCenter,
const AcGeVector3d& circleNormal,
double circleRadius,
int approx) = 0;
*/
virtual bool createConvexHull(const AcGePoint3d vertices[], int numVertices) = 0;
virtual bool createConvexHull(const Point3 vertices[], int numVertices) = 0;
// Create a body consisting of one face
//
/*
virtual void createFace(const AcGePoint3d vertices[], AModeler::PolygonVertexData* vertexData[],
int numVertices, const AcGeVector3d &normal) = 0;
*/
virtual void createFace(const AcGePoint3d vertices[], int numVertices, BOOL smooth = TRUE) = 0;
//The boolean operators
virtual void prepBoolean(unsigned short opnum = 0) = 0;
virtual void operator +=(IGeomImp& b) = 0;
virtual void operator -=(IGeomImp& b) = 0;
virtual void operator *=(IGeomImp& b) = 0;
virtual int interfere (IGeomImp& b) = 0;
//combination
virtual bool Combine(IGeomImp& b) = 0;
//assignment
virtual IGeomImp& operator =(IGeomImp& b) = 0;
// The section method removes part of the body in the positive halfplane
//
virtual void section(const Matrix3& tm) = 0;
virtual void section(const AcGePlane& p) = 0;
// Sweeps
//
virtual bool createPyramid(float width, float depth, float height)=0;
virtual bool createPyramid(
const AcGePoint3d vertices[],
// AModeler::PolygonVertexData* vertexData[],
int numVertices,
const AcGeVector3d &plgNormal,
const AcGePoint3d &apex) = 0;
// virtual bool createExtrusion(const Point3 vertices[], int numVertices, const float height )=0;
virtual bool createExtrusion(
PolyPt vertices[],
int numVertices,
const float height,
const BOOL smooth,
const BOOL genMatIDs,
const BOOL useShapeIDs)=0;
virtual bool createExtrusion(
const AcGePoint3d vertices[],
// AModeler::PolygonVertexData* vertexData[],
int numVertices,
const AcGeVector3d &plgNormal,
const AcGeVector3d &extusionVector,
const AcGePoint3d &fixedPt,
double scaleFactor,
double twistAngle) = 0;
virtual void createAxisRevolution(
const AcGePoint3d vertices[],
// AModeler::PolygonVertexData* vertexData[],
int numVertices,
const AcGeVector3d &normal,
const AcGePoint3d &axisStart,
const AcGePoint3d &axisEnd,
double revolutionAngle,
int approx,
const AcGePoint3d &fixedPt,
double scaleFactor,
double twistAngle) = 0;
virtual void createEndpointRevolution(
const AcGePoint3d vertices[],
// AModeler::PolygonVertexData* vertexData[],
int numVertices,
const AcGeVector3d &normal,
double revolutionAngle,
int approx)=0;
/*
void createSkin(
AsdkBody* profiles[],
int numProfiles,
bool isClosed,
MorphingMap* morphingMaps[]);
*/
//Max-friendly overload
virtual bool createExtrusionAlongPath(
const PolyPt profilevertices[],
int profileNumVertices,
const PolyPt pathvertices[],
int pathNumVertices,
bool pathIsClosed,
bool bCheckValidity,
const Point3 &scaleTwistFixedPt,
double scaleFactor,
double twistAngle) = 0;
virtual bool createExtrusionAlongPath(
const AcGePoint3d profilevertices[],
int profileNumVertices,
const AcGePoint3d pathvertices[],
int pathNumVertices,
bool pathIsClosed,
bool bCheckValidity,
const AcGePoint3d &scaleTwistFixedPt,
double scaleFactor,
double twistAngle) = 0;
virtual void createWallCorner(
const AcGePoint2d& pt1, // Start of wall 1
const AcGePoint2d& pt2, // End of wall 1, start of wall 2
const AcGePoint2d& pt3, // End of wall 2
bool materialToTheLeft,
double width1, // Wall 1 width
double width2, // Wall 2 width
double height, // Wall height
AcGePlane& matingPlane1,
AcGePlane& matingPlane2,
bool& wall1NeedsToBeSectioned,
bool& wall2NeedsToBeSectioned) = 0;
///////////////////////////////////////////////////////////////////////////
//
// transforms
//
virtual void transform(Matrix3 & mat, bool override_locks = true) = 0;
///////////////////////////////////////////////////////////////////////////
//
// triangulation
//
// Saves the triangles directly to a Mesh //
virtual void triangulateMesh(TimeValue t, Mesh& m,
TesselationType type = kTriangles, bool cacheTriangles = true) = 0;
/* TO DO
// saves the triangle back to the callback object
virtual void triangulate (TimeValue t, OutputTriangleCallback*,
TriangulationType type = kGenerateTriangles, bool cacheTriangles = true) = 0;
*/
///////////////////////////////////////////////////////////////////////////
//
// display
//
virtual void Display(TimeValue t, INode* inode, ViewExp *vpt, int flags) = 0;
virtual void Invalidate() = 0;
//Validity
virtual bool isNull() = 0;
//////////////////////////////////////////////////////////////////////////
//
// Copy
//
virtual IGeomImp * Copy(void) = 0;
//////////////////////////////////////////////////////////////////////////
//
// BondingBox methods
//
virtual void GetDeformBBox(TimeValue t, Box3& box, Matrix3 *tm=NULL, BOOL useSel=FALSE ) = 0;
//////////////////////////////////////////////////////////////////////////
//
// Constraining transform
//
virtual bool GetTransformLock(int type, int axis) = 0;
virtual void SetTransformLock(int type, int axis, BOOL onOff) = 0;
//////////////////////////////////////////////////////////////////////////
//
// Material ID offset.
//
virtual void SetMaterialBase(int matidx) = 0;
virtual int OpCount() = 0;
};
//#ifdef IMPORTING
//#error
//#endif
#define HIRES
class OpTimer: public MeshOpProgress
{
private:
#ifdef HIRES
LARGE_INTEGER opstart;
LARGE_INTEGER optime;
LARGE_INTEGER cumtime;
LARGE_INTEGER res;
#else
int opstart, optime, cumtime;
#endif
int m_errorcode;
int m_errcount;
int m_opcount;
TSTR curopname;
public:
//From MeshOpProgress
OpTimer():m_errorcode(0), m_opcount(0){curopname = "??";}
void Init(int total)
{
++m_opcount;
m_errorcode = 0;
#ifdef HIRES
QueryPerformanceFrequency(&res);
optime.QuadPart = 0;
QueryPerformanceCounter(&opstart);
#else
opstart = GetTickCount();
#endif
}
BOOL Progress(int p)
{
#ifdef HIRES
LARGE_INTEGER opnow;
QueryPerformanceCounter(&opnow);
cumtime.QuadPart += (opnow.QuadPart - (opstart.QuadPart + optime.QuadPart));
optime.QuadPart = opnow.QuadPart - opstart.QuadPart;
#else
integer opnow = GetTickCount();
cumtime += (opnow - (opstart + optime));
optime = opnow - opstart;
#endif
return true;
}
void OutputMetrics(HWND hDlg);
void InitName(char *opname){curopname = opname;}
void ExtendName(char *opname){curopname += opname;}
void FlagError(int errcode = 999){m_errorcode = errcode;++m_errcount;}
void Reset(){
m_errcount = 0; m_opcount=0;
#ifdef HIRES
cumtime.QuadPart = 0;
#else
optime = 0;
#endif
}
};
extern "C" __declspec(dllexport) IGeomImp* CreateAmodelerBody();
extern "C" __declspec(dllexport) IGeomImp* CreateMeshAdapter();
#endif //__IGEOMPUPPET_H

30
lib/maxsdk40/IGuest.h Executable file
View File

@ -0,0 +1,30 @@
/**********************************************************************
*<
FILE: IGuest.h
DESCRIPTION: Declares Host/Guest protocol
CREATED BY: John Hutchinson
HISTORY: Created April 24, 1999
*> Copyright (c) 1994, All Rights Reserved.
**********************************************************************/
#pragma once
class IGeomImp;
class IHost;
class IGuest
{
public:
virtual void rsvp(IHost* host, IGeomImp* return_envelope, Matrix3& tm) = 0;
};
class IHost
{
public:
virtual void accomodate(IGeomImp* guestrep, Matrix3 &tm, HitRecord *rec = NULL) = 0;
virtual bool locate(INode *host, Control *c, Matrix3 &oldP, Matrix3 &newP) = 0;
};

30
lib/maxsdk40/IHardwareMNMesh.h Executable file
View File

@ -0,0 +1,30 @@
/**********************************************************************
*<
FILE: IHardwareMNMesh.h
DESCRIPTION: Hardware MNMesh Extension Interface
CREATED BY: Norbert Jeske
HISTORY: Created 10/11/00
*> Copyright (c) 2000, All Rights Reserved.
**********************************************************************/
#ifndef _HARDWARE_MNMESH_H_
#define _HARDWARE_MNMESH_H_
#define HARDWARE_MNMESH_INTERFACE_ID Interface_ID(0x65b154eb, 0x87d2b74)
class MNMesh;
class IHardwareMNMesh : public BaseInterface
{
public:
virtual Interface_ID GetID() { return HARDWARE_MNMESH_INTERFACE_ID; }
// Interface Lifetime
virtual LifetimeType LifetimeControl() { return noRelease; }
};
#endif

30
lib/maxsdk40/IHardwareMesh.h Executable file
View File

@ -0,0 +1,30 @@
/**********************************************************************
*<
FILE: IHardwareMesh.h
DESCRIPTION: Hardware Mesh Extension Interface
CREATED BY: Norbert Jeske
HISTORY: Created 10/10/00
*> Copyright (c) 2000, All Rights Reserved.
**********************************************************************/
#ifndef _HARDWARE_MESH_H_
#define _HARDWARE_MESH_H_
#define HARDWARE_MESH_INTERFACE_ID Interface_ID(0x6215327f, 0x6fb14d7a)
class Mesh;
class IHardwareMesh : public BaseInterface
{
public:
virtual Interface_ID GetID() { return HARDWARE_MESH_INTERFACE_ID; }
// Interface Lifetime
virtual LifetimeType LifetimeControl() { return noRelease; }
};
#endif

268
lib/maxsdk40/IHardwareShader.h Executable file
View File

@ -0,0 +1,268 @@
/**********************************************************************
*<
FILE: IHardwareShader.h
DESCRIPTION: Hardware Shader Extension Interface class
CREATED BY: Norbert Jeske
HISTORY:
*> Copyright (c) 2000, All Rights Reserved.
**********************************************************************/
#ifndef _HARDWARE_SHADER_H_
#define _HARDWARE_SHADER_H_
#define HARDWARE_SHADER_INTERFACE_ID Interface_ID(0x7bbd585b, 0x75bb641c)
#define GFX_MAX_COLORS 2
class Mesh;
class MNMesh;
class TriStrip {
public:
DWORD rndMode;
MtlID mID;
DWORD smGrp;
int clrMode;
int texMode;
DWTab v;
DWTab n;
DWTab c[GFX_MAX_COLORS];
DWTab tv[GFX_MAX_TEXTURES];
TriStrip()
: rndMode(0),
mID(0),
smGrp(0),
clrMode(0),
texMode(0)
{}
void AddVertN(DWORD vtx, DWORD nor) { v.Append(1, &vtx); n.Append(1, &nor); }
void AddVertNC1(DWORD vtx, DWORD nor, DWORD col) { v.Append(1, &vtx); n.Append(1, &nor); c[0].Append(1, &col); }
void AddVertNT1(DWORD vtx, DWORD nor, DWORD tvtx) {
v.Append(1, &vtx); n.Append(1, &nor);
tv[0].Append(1, &tvtx);
}
void AddVertNC1T1(DWORD vtx, DWORD nor, DWORD col, DWORD tvtx) {
v.Append(1, &vtx); n.Append(1, &nor); c[0].Append(1, &col);
tv[0].Append(1, &tvtx);
}
void AddVertNT2(DWORD vtx, DWORD nor, DWORD tvtx1, DWORD tvtx2) {
v.Append(1, &vtx); n.Append(1, &nor);
tv[0].Append(1, &tvtx1); tv[1].Append(1, &tvtx2);
}
void AddVertNC1T2(DWORD vtx, DWORD nor, DWORD col, DWORD tvtx1, DWORD tvtx2) {
v.Append(1, &vtx); n.Append(1, &nor); c[0].Append(1, &col);
tv[0].Append(1, &tvtx1); tv[1].Append(1, &tvtx2);
}
void AddVertNT3(DWORD vtx, DWORD nor, DWORD tvtx1, DWORD tvtx2, DWORD tvtx3) {
v.Append(1, &vtx); n.Append(1, &nor);
tv[0].Append(1, &tvtx1); tv[1].Append(1, &tvtx2); tv[2].Append(1, &tvtx3);
}
void AddVertNC1T3(DWORD vtx, DWORD nor, DWORD col, DWORD tvtx1, DWORD tvtx2, DWORD tvtx3) {
v.Append(1, &vtx); n.Append(1, &nor); c[0].Append(1, &col);
tv[0].Append(1, &tvtx1); tv[1].Append(1, &tvtx2); tv[2].Append(1, &tvtx3);
}
void AddVertNT4(DWORD vtx, DWORD nor, DWORD tvtx1, DWORD tvtx2, DWORD tvtx3, DWORD tvtx4) {
v.Append(1, &vtx); n.Append(1, &nor);
tv[0].Append(1, &tvtx1); tv[1].Append(1, &tvtx2); tv[2].Append(1, &tvtx3); tv[3].Append(1, &tvtx4);
}
void AddVertNC1T4(DWORD vtx, DWORD nor, DWORD col, DWORD tvtx1, DWORD tvtx2, DWORD tvtx3, DWORD tvtx4) {
v.Append(1, &vtx); n.Append(1, &nor); c[0].Append(1, &col);
tv[0].Append(1, &tvtx1); tv[1].Append(1, &tvtx2); tv[2].Append(1, &tvtx3); tv[3].Append(1, &tvtx4);
}
};
typedef TriStrip *TriStripPtr;
typedef Tab<TriStripPtr> TriStripTab;
class MeshData
{
public:
int numStrips;
TriStripTab *strips;
DWORD mapFlags;
int numXYZ;
Point3 *xyz;
int numNor;
Point3 *nor;
int numRGB[GFX_MAX_COLORS];
Point3 *rgb[GFX_MAX_COLORS];
int numUVW[GFX_MAX_TEXTURES];
Point3 *uvw[GFX_MAX_TEXTURES];
MeshData()
: numStrips(0),
strips(NULL),
mapFlags(0),
numXYZ(0),
xyz(NULL),
numNor(0),
nor(NULL)
{
int kk;
for (kk = 0; kk < GFX_MAX_COLORS; kk++) {
numRGB[kk] = 0;
rgb[kk] = NULL;
}
for (kk = 0; kk < GFX_MAX_TEXTURES; kk++) {
numUVW[kk] = 0;
uvw[kk] = NULL;
}
}
};
class WireMeshData
{
public:
int numFaces;
GWFace *faces;
int numXYZ;
Point3 *xyz;
int displayFlags;
BitArray *faceSel;
BitArray *edgeSel;
int numMat;
Material *mtlArray;
WireMeshData()
: numFaces(0),
faces(NULL),
numXYZ(0),
xyz(NULL),
displayFlags(0),
faceSel(NULL),
edgeSel(NULL),
numMat(0),
mtlArray(NULL)
{}
};
class MeshFaceData
{
public:
int numFaces;
GWFace *faces;
Point3 *faceNor;
DWORD mapFlags;
Point3 selectClr;
int numClrFaces[GFX_MAX_COLORS];
GWFace *clrFaces[GFX_MAX_COLORS];
int numTexFaces[GFX_MAX_TEXTURES];
GWFace *texFaces[GFX_MAX_TEXTURES];
int numXYZ;
Point3 *xyz;
int numNor;
Point3 *nor;
int numRGB[GFX_MAX_COLORS];
Point3 *rgb[GFX_MAX_COLORS];
int numUVW[GFX_MAX_TEXTURES];
Point3 *uvw[GFX_MAX_TEXTURES];
MeshFaceData()
: numFaces(0),
faces(NULL),
faceNor(NULL),
mapFlags(0),
selectClr(0,0,0),
numXYZ(0),
xyz(NULL),
numNor(0),
nor(NULL)
{
int kk;
for (kk = 0; kk < GFX_MAX_COLORS; kk++) {
numClrFaces[kk] = 0;
clrFaces[kk] = NULL;
numRGB[kk] = 0;
rgb[kk] = NULL;
}
for (kk = 0; kk < GFX_MAX_TEXTURES; kk++) {
numTexFaces[kk] = 0;
texFaces[kk] = NULL;
numUVW[kk] = 0;
uvw[kk] = NULL;
}
}
};
class IHardwareShader : public BaseInterface
{
public:
virtual Interface_ID GetID() { return HARDWARE_SHADER_INTERFACE_ID; }
virtual Interface_ID GetVSID() = 0;
virtual Interface_ID GetPSID() = 0;
// Interface Lifetime
virtual LifetimeType LifetimeControl() { return noRelease; }
// Start to draw object
virtual void StartObject(Mesh *mesh) = 0;
virtual void StartObject(MNMesh *mnmesh) = 0;
// Initialize HardwareShader first time or frame-by-frame
virtual void InitializeShaders(Mesh *mesh, BaseInterface *pbvs, Material *mtlArray, int numMtl, GFX_ESCAPE_FN fn) = 0;
virtual void InitializeShaders(MNMesh *mnmesh, BaseInterface *pbvs, Material *mtlArray, int numMtl, GFX_ESCAPE_FN fn) = 0;
// Try to draw as tristrips?
virtual bool CanTryStrips() = 0;
// Retrive the current rendering mode
virtual DWORD GetRndMode() = 0;
// Retrieve a Material
virtual Material *GetMaterial(int numMat) = 0;
// Set a Material
virtual void SetMaterial(const Material &m, int index=0) = 0;
// Retrieve number of passes for specified Material in Material array
virtual int GetNumMultiPass(int numMtl) = 0;
// Set the number of the current pass
virtual void SetNumMultiPass(int numPass) = 0;
// Draw 3D mesh as TriStrips
virtual void DrawMeshStrips(MeshData *data, GFX_ESCAPE_FN fn) = 0;
// Draw 3D mesh as wireframe
virtual void DrawWireMesh(WireMeshData *data, GFX_ESCAPE_FN fn) = 0;
// Draw 3D lines
virtual void StartLines(WireMeshData *data) = 0;
virtual void AddLine(DWORD *vert, int vis) = 0;
virtual void DrawLines() = 0;
virtual void EndLines(GFX_ESCAPE_FN fn) = 0;
// Draw 3D triangles
virtual void StartTriangles(MeshFaceData *data) = 0;
virtual void AddTriangle(DWORD index, int *edgeVis) = 0;
virtual void DrawTriangles() = 0;
virtual void EndTriangles(GFX_ESCAPE_FN fn) = 0;
// End of drawing object
virtual void EndObject(Mesh *mesh) = 0;
virtual void EndObject(MNMesh *mnmesh) = 0;
};
class IVertexShader
{
public:
// Load VertexShader instructions, create any additional per vertex data on
// a per node basis. VertexShader instructions should be loaded once and
// shared among all the nodes using this VertexShader. Additional per
// vertex data should be (re)created only when the associated node data
// changes. In addition, if there is sufficient memory, VertexBuffers can
// be created and updated only when node data changes in order to improve
// rendering performance.
virtual HRESULT Initialize(Mesh *mesh, INode *node) = 0;
virtual HRESULT Initialize(MNMesh *mnmesh, INode *node) = 0;
};
#endif

204
lib/maxsdk40/IIKSys.h Executable file
View File

@ -0,0 +1,204 @@
/**********************************************************************
*<
FILE: IIKSys.h
DESCRIPTION: Interfaces into IK sub-system classes/functions.
CREATED BY: Jianmin Zhao
HISTORY: created 3 April 2000
*> Copyright (c) 1994, All Rights Reserved.
**********************************************************************/
#ifndef __IIKSys__H
#define __IIKSys__H
#include "iFnPub.h"
// Class ids
#define IKCONTROL_CLASS_ID Class_ID(0xe6f5815, 0x717f99a4)
#define IKCHAINCONTROL_CLASS_ID Class_ID(0x78724378, 0x8a4fd9)
#define GET_IKCHAIN_CD (GetCOREInterface()->GetDllDir().ClassDir().FindClass(CTRL_MATRIX3_CLASS_ID, IKCHAINCONTROL_CLASS_ID))
#define IK_FP_INTERFACE_ID Interface_ID(0x5b734601, 0x7c7c7ece)
#define IKCHAIN_FP_INTERFACE_ID Interface_ID(0x5a5e7cbe, 0x55367776)
#define GET_IK_OPS_INTERFACE ((IKCmdOps*)GetCOREInterface(IK_FP_INTERFACE_ID))
#define GET_IKCHAIN_FP_INTERFACE ((IKChainActions*)GET_IKCHAIN_CD->GetInterface(IKCHAIN_FP_INTERFACE_ID))
class IKCmdOps : public FPStaticInterface {
public:
virtual INode* CreateIKChain(INode* start, INode* end, const TCHAR* solver) =0;
};
class IKChainActions : public FPStaticInterface {
public:
virtual FPStatus SnapAction() =0;
virtual FPStatus IKSnapAction() =0;
virtual FPStatus FKSnapAction() =0;
virtual BOOL IsSnapEnabled() =0;
};
namespace IKSys {
class ZeroPlaneMap;
}
//
// IIKChainControl
//
class IKSolver;
class IIKChainControl {
public:
// Reference index:
//
enum {
kPBlockRef = 0, // ParamBlock
kGoalTMRef, // Matrix3 controller
kEndJointRef, // INode
kEnableRef, // Bool (float) controller
kStartJointRef, // INode
kLastRef
};
// Parameter block index:
//
enum {
kParamBlock,
kNumParamBlocks
};
// Paramter index of parameters in param-block of index kParamBlock:
//
enum {
kStartJoint, // INode, referenced by kStartJointRef
kEndJoint, // INode, referenced by kEndJointRef
kSolverName, // String
kAutoEnable, // BOOL
kSwivel, // Angle
kPosThresh, // Float
kRotThresh, // Float
kIteration, // Integer
kEEDisplay, // BOOL
kEESize, // Float
kGoalDisplay, // BOOL
kGoalSize, // Float
kVHDisplay, // BOOL
kVHSize, // Float
kVHLength, // Float
kSolverDisplay, // BOOL
kAutoSnap, // BOOL
kVHUseTarget, // BOOL
kVHTarget, // INode
kSAParent, // RadioBtn_Index
kLastParam
};
enum SAParentSpace {
kSAInGoal,
kSAInStartJoint
};
// IK chain delimiters
virtual INode* StartJoint() const =0;
virtual INode* EndJoint() const =0;
virtual INode* GetNode() const =0;
// Vector Handle
// InitPlane/InitEEAxis are the normal and End Effector Axis at the
// initial pose. They are represented in the parent space.
// ChainNormal is the InitPlane represented in the object space:
// InitPlane() == ChainNormal * StartJoint()->InittialRotation()
virtual Point3 ChainNormal(TimeValue t, Interval& valid) =0;
virtual Point3 InitPlane(TimeValue t) =0;
virtual Point3 InitEEAxis(TimeValue t) =0;
virtual float InitChainLength(TimeValue t) =0;
virtual float SwivelAngle(TimeValue, Interval&)=0;
virtual const IKSys::ZeroPlaneMap*
DefaultZeroPlaneMap(TimeValue t) =0;
virtual SAParentSpace SwivelAngleParent() const =0;
// Solver
virtual IKSolver* Solver() const =0;
virtual bool SolverEnabled(TimeValue, Interval* =0)=0;
virtual bool CanAutoEnable() const =0;
virtual bool AutoEnableSet() const =0;
virtual bool Valid() const =0;
};
namespace IKSys {
enum DofAxis {
TransX = 0, TransY, TransZ,
RotX, RotY, RotZ,
DofX = 0, DofY, DofZ
};
enum JointType {
SlidingJoint,
RotationalJoint
};
struct DofSet {
DofSet() : bits(0) {}
DofSet(const DofSet& src) : bits(src.bits) {}
void Add(DofAxis dn) { bits |= (1 << dn); }
void Clear(DofAxis dn) { bits &= ~(unsigned(1 << dn)); }
int Include(DofAxis dn) const { return bits & (1 << dn); }
int Count() const;
unsigned bits;
};
inline int DofSet::Count() const
{
for (unsigned b = bits, ret = 0, i = TransX; i <= RotZ; ++i) {
if (b == 0) break;
else if (b & 01u) {
ret++;
}
b = b >> 1;
}
return ret;
}
}; // namespace IKSys
//
// IIKControl
//
class IIKControl {
public:
typedef IKSys::DofAxis DofAxis;
typedef IKSys::JointType JointType;
typedef IKSys::DofSet DofSet;
//Queries
virtual bool DofActive(DofAxis) const =0;
virtual DofSet ActiveTrans() const =0;
virtual DofSet ActiveRot() const =0;
virtual DofSet ActiveDofs() const =0;
virtual INodeTab IKChains(JointType) const =0;
virtual bool DofLowerLimited(DofAxis) const =0;
virtual bool DofUpperLimited(DofAxis) const =0;
virtual Point2 DofLimits(DofAxis) const =0;
virtual Point3 TransLowerLimits() const =0;
virtual Point3 TransUpperLimits() const =0;
virtual Point3 RotLowerLimits() const =0;
virtual Point3 RotUpperLimits() const =0;
virtual bool IKBound(TimeValue t, JointType jt)=0;
virtual Control* FKSubController() const =0;
virtual INode* GetNode() const =0;
virtual Point3 PrefPosition(TimeValue t, Interval& validityInterval) =0;
virtual Point3 PrefRotation(TimeValue t, Interval& validityInterval) =0;
// DOF values
virtual Point3 TransValues(TimeValue, Interval* =0)=0;
virtual Point3 RotValues(TimeValue, Interval* =0)=0;
virtual void AssignTrans(const Point3&, const Interval&)=0;
virtual void AssignRot(const Point3&, const Interval&)=0;
virtual void AssignActiveTrans(const Point3&, const Interval&)=0;
virtual void AssignActiveRot(const Point3&, const Interval&)=0;
virtual void AssignActiveTrans(const DofSet&, const float[],
const Interval&)=0;
virtual void AssignActiveRot(const DofSet&, const float[],
const Interval&)=0;
virtual void SetTransValid(const Interval& valid) =0;
virtual void SetRotValid(const Interval& valid) =0;
virtual void SetTRValid(const Interval& valid) =0;
virtual void SetPrefTrans(const Point3& val, TimeValue t =0) =0;
virtual void SetPrefRot(const Point3& val, TimeValue t =0) =0;
virtual void SetPrefTR(const Point3& trans, const Point3& rot,
TimeValue t =0) =0;
};
#endif // #ifndef __IIKSys__H

384
lib/maxsdk40/IKHierarchy.h Executable file
View File

@ -0,0 +1,384 @@
/**********************************************************************
*<
FILE: IKHierarchy.h
DESCRIPTION: Geometrical representation of the ik problem. Note that
this file should not dependent on Max SDK, except for
some math classes, such as Matrix3, Point3, etc.
CREATED BY: Jianmin Zhao
HISTORY: created 16 March 2000
*> Copyright (c) 1994, All Rights Reserved.
**********************************************************************/
#ifndef __IKHierarchy__H
#define __IKHierarchy__H
namespace IKSys {
class ZeroPlaneMap {
public:
virtual Point3 operator()(const Point3& EEAxis) const =0;
virtual ~ZeroPlaneMap() {}
};
// A LinkChain consists of a RootLink and a number of Links.
// A RootLink consists of a rotation plus a rigidExtend. It transforms
// like this:
// To_Coordinate_Frame = rigidExtend * rotXYZ * From_Coordinate_Frame.
// where rotXYZ = Rot_x(rotXYZ[0]) * Rot_y(rotXYZ[1]) * Rot_z(rotXYZ[2]).
//
// * Note that not all the x, y, and z, are degrees of freedom. Only
// Active() ones are. We put the whole rotation here so that some
// solver may choose to use it as a full rotation and then clamp the
// result to the permissible range.
//
// * LinkMatrix(bool include_rot) returns rigidExtend if include_rot is
// false and returns the whole matrix from the From_Coordinate_Fram to
// To_Coordinate_Frame, i.e., rigidExtend*rotXYZ.rotXYZ are not all degrees of freedom. Only the active ones are.
//
// * Matrix3& ApplyLinkMatrix(Matrix3& mat, bool) applies the LinkMatrix() to
// the input matrix from the left, i.e., mat = LinkMatrix(bool)*mat,
// and returns the reference to the input matrix.
//
// * Matrix3& RotateByAxis(Matrix3&, unsigned i) pre-applies the
// rotation about x, y, or z (corresponding to i=0,1,or 2).
// Therefore, starting with the identity matrix, mat,
// ApplyLinkMatrix(
// RotateByAxis(
// RotateByAxis(
// RotateByAxis(mat, 2),
// 1),
// 0),
// false)
// should equal to LinkMatrix(true).
//
class RootLink {
public:
RootLink():flags(7){} // x,y,z, are all active. No joint limits.
Point3 rotXYZ;
Point3 initXYZ;
Point3 llimits;
Point3 ulimits;
Matrix3 rigidExtend;
bool GetActive(unsigned i) const { return flags&(1<<i)?true:false;}
bool GetLLimited(unsigned i) const { return flags&(1<<(i+3))?true:false;}
bool GetULimited(unsigned i) const { return flags&(1<<(i+6))?true:false;}
Matrix3& RotateByAxis(Matrix3& mat, unsigned i) const;
Matrix3 LinkMatrix(bool include_rot) const;
Matrix3& ApplyLinkMatrix(Matrix3& mat, bool include_rot) const;
// Set methods:
//
void SetActive(unsigned i, bool s);
void SetLLimited(unsigned i, bool s);
void SetULimited(unsigned i, bool s);
private:
unsigned flags;
};
// A Link is a 1-dof rotation followed by a rigidExtend. The dof
// axis is specified by dofAxis. It is always active.
//
// * LinkMatrix(true) == rigidExtend * Rotation(dofAxis, dofValue).
// LinkMatrix(false) == rigidExtend.
//
// * Matrix3& ApplyLinkMatrix(Matrix3& mat, bool) pre-applies the
// LinkMatrix(bool) to the input matrix, mat.
//
// * A typical 3-dof (xyz) joint is decomposed into three links. z and
// y dofs don't have rigid extension, called NullLink(). Let's use
// ++o
// to denote NullLink() and
// ---o
// to denote !NullLink(). Then, a 3-dof joint will be decomposed into
// three Links, as:
// ---o++o++o
// x y z
//
// * For an xyz rotation joint, if y is not active (Active unchecked),
// then y will be absorbed into the z-link, as:
// ---o---o
// x z
// In this case, the z-link is not NullLink(). But its length is
// zero. It is called ZeroLengh() link.
//
class Link {
public:
Link():rigidExtend(0),dofAxis(RotZ){}
~Link(){if (rigidExtend) delete rigidExtend; rigidExtend = 0;}
enum DofAxis {
TransX,
TransY,
TransZ,
RotX,
RotY,
RotZ
};
DofAxis dofAxis;
float dofValue;
float initValue;
Point2 limits;
bool NullLink() const {return rigidExtend?false:true;}
bool ZeroLength() const {
return NullLink() ? true :
(rigidExtend->GetIdentFlags() & POS_IDENT) ? true : false; }
bool LLimited() const { return llimited?true:false; }
bool ULimited() const { return ulimited?true:false; }
Matrix3 DofMatrix() const;
Matrix3& DofMatrix(Matrix3& mat) const;
Matrix3 LinkMatrix(bool include_dof =true) const;
Matrix3& ApplyLinkMatrix(Matrix3& mat, bool include_dof =true) const;
// Set methods:
//
void SetLLimited(bool s) { llimited = s?1:0; }
void SetULimited(bool s) { ulimited = s?1:0; }
void SetRigidExtend(const Matrix3& mat);
private:
Matrix3* rigidExtend;
byte llimited : 1;
byte ulimited : 1;
};
// A LinkChain consists of a RootLink and LinkCount() of Links.
//
// * parentMatrix is where the root joint starts with respect to the
// world. It should not concern the solver. Solvers should derive their
// solutions in the parent space.
//
// * goal is represented in the parent space, i.e.,
// goal_in_world = goal * parentMatrix
//
// * Bone(): The Link of index i may be a NullLink(). Bone(i) gives
// the index j so that j >= i and LinkOf(j).NullLink() is false. If j
// >= LinkCount() means that the chain ends up with NullLink().
//
// * PreBone(i) gives the index, j, so that j < i and LinkOf(j) is not
// NullLink(). For the following 3-dof joint:
// ---o++o++o---o
// i
// Bone(i) == i+1, and PreBone(i) == i-2. Therefore, degrees of
// freedom of LinkOf(i) == Bone(i) - PreBone(i).
//
// * A typical two bone chain with elbow being a ball joint has this
// structure:
// ---o++o++o---O
// 2 1 0 rootLink
// It has 3 links in addition to the root link.
//
// * A two-bone chain with the elbow being a hinge joint has this
// structure:
// ---o---O
// 0 rootLink
// It has one link. Geometrically, the axis of LinkOf(0) should be
// perpendicular to the two bones.
//
// * The matrix at the end effector is
// End_Effector_matrix == LinkOf(n-1).LinkMatrix(true) * ... *
// LinkOf(0).LinkMatrix(true) * rootLink.LinkMatrix(true).
//
// * swivelAngle, chainNormal, and defaultZeroMap concerns solvers that
// answer true to IKSolver::UseSwivelAngle().
//
// * chainNormal is the normal to the plane that is intrinsic to the
// chain when it is constructed. It is represented in the object space
// of the root joint.
//
// * A zero-map is a map that maps the end effector axis (EEA) to a
// plane normal perpendicular to the EEA. The IK System will provide a
// default one to the solver. However, a solver may choose to use its
// own.
//
// * Given the swivelAngle, the solver is asked to adjust the rotation
// at the root joint, root_joint_rotation, so that:
// (A) EEA stays fixed
// (B) chainNormal * root_joint_rotation
// == zeroMap(EEA) * RotationAboutEEA(swivelAngle)
// By definition, zeroMap(EEA) is always perpendicular to EEA. At the
// initial pose, chainNormal is also guarranteed to be perpendicular
// to zeroMap(EEA). When it is not, root_joint_rotation has to
// maintain (A) absolutely and satisfy (B) as good as it is possible.
//
class LinkChain {
public:
enum SAParentSpace {
kSAInGoal,
kSAInStartJoint
};
LinkChain():links(0),linkCount(0),defaultZeroMap(0),swivelAngle(0){}
LinkChain(unsigned lc):linkCount(lc),defaultZeroMap(0),swivelAngle(0)
{links = new Link[lc];}
virtual ~LinkChain(){delete[] links; links = NULL;}
virtual void* GetInterface(ULONG i) const { return NULL; }
Matrix3 parentMatrix;
RootLink rootLink;
const Link& LinkOf(unsigned i) const {return links[i];}
Link& LinkOf(unsigned i) {return links[i];}
unsigned LinkCount() const { return linkCount; }
int PreBone(unsigned i) const;
unsigned Bone(unsigned i) const;
bool useVHTarget;
union {
float swivelAngle;
float vhTarget[3];
};
SAParentSpace swivelAngleParent;
Point3 chainNormal; // plane normal
const ZeroPlaneMap* defaultZeroMap;
Matrix3 goal;
protected:
void SetLinkCount(unsigned lc){
delete links;
linkCount = lc;
links = new Link[linkCount];}
private:
Link* links;
unsigned linkCount;
};
// Inlines:
//
inline void RootLink::SetActive(unsigned i, bool s)
{
unsigned mask = 1 << i;
if (s) flags |= mask;
else flags &= ~mask;
}
inline void RootLink::SetLLimited(unsigned i, bool s)
{
unsigned mask = 1 << (3 + i);
if (s) flags |= mask;
else flags &= ~mask;
}
inline void RootLink::SetULimited(unsigned i, bool s)
{
unsigned mask = 1 << (6 + i);
if (s) flags |= mask;
else flags &= ~mask;
}
inline Matrix3& RootLink::RotateByAxis(Matrix3& mat, unsigned i) const
{
switch (i) {
case 0: mat.PreRotateX(rotXYZ[0]); return mat;
case 1: mat.PreRotateY(rotXYZ[1]); return mat;
case 2: mat.PreRotateZ(rotXYZ[2]); return mat;
default: return mat;
}
}
inline Matrix3& RootLink::ApplyLinkMatrix(Matrix3& mat, bool include_rot) const
{
if (include_rot) {
RotateByAxis(mat, 2);
RotateByAxis(mat, 1);
RotateByAxis(mat, 0);
}
mat = rigidExtend * mat;
return mat;
}
inline Matrix3 RootLink::LinkMatrix(bool include_rot) const
{
Matrix3 mat(TRUE);
return ApplyLinkMatrix(mat, include_rot);
}
inline void Link::SetRigidExtend(const Matrix3& mat)
{
if (mat.IsIdentity()) {
if (rigidExtend) {
delete rigidExtend;
rigidExtend = NULL;
}
} else {
if (rigidExtend) *rigidExtend = mat;
else rigidExtend = new Matrix3(mat);
}
}
inline Matrix3 Link::DofMatrix() const
{
switch (dofAxis) {
case TransX:
case TransY:
case TransZ:
{
Point3 p(0.0f,0.0f,0.0f);
p[dofAxis] = dofValue;
return TransMatrix(p);
}
case RotX:
return RotateXMatrix(dofValue);
case RotY:
return RotateYMatrix(dofValue);
case RotZ:
return RotateZMatrix(dofValue);
default:
return Matrix3(1);
}
}
inline Matrix3& Link::DofMatrix(Matrix3& mat) const
{
switch (dofAxis) {
case TransX:
case TransY:
case TransZ:
{
Point3 p(0.0f,0.0f,0.0f);
p[dofAxis] = dofValue;
mat.PreTranslate(p);
}
return mat;
case RotX:
mat.PreRotateX(dofValue); return mat;
case RotY:
mat.PreRotateY(dofValue); return mat;
case RotZ:
mat.PreRotateZ(dofValue); return mat;
default:
return mat;
}
}
inline Matrix3 Link::LinkMatrix(bool include_dof) const
{
Matrix3 ret;
if (include_dof) {
ret = DofMatrix();
ApplyLinkMatrix(ret, false);
} else {
ret = rigidExtend ? *rigidExtend : Matrix3(1);
}
return ret;
}
inline Matrix3& Link::ApplyLinkMatrix(Matrix3& mat, bool include_dof) const
// premultiply mat
{
if (include_dof) DofMatrix(mat);
if (rigidExtend) mat = *rigidExtend * mat;
return mat;
}
inline int LinkChain::PreBone(unsigned i) const
// return number < i. Returning -1 means that the previous bone is the root
// link.
{
for (int j = i - 1; j >= 0; --j)
if (!links[j].ZeroLength()) break;
return j;
}
inline unsigned LinkChain::Bone(unsigned i) const
// return number >= i.
{
for (size_t j = i; j < linkCount; ++j)
if (!links[j].ZeroLength()) break;
return j;
}
}; // namespace IKSys
#endif __IKHierarchy__H

72
lib/maxsdk40/IKSolver.h Executable file
View File

@ -0,0 +1,72 @@
/**********************************************************************
*<
FILE: IKSolver.h
DESCRIPTION: IK Solver Class definition
CREATED BY: Jianmin Zhao
HISTORY: created 16 March 2000
*> Copyright (c) 1994, All Rights Reserved.
**********************************************************************/
#ifndef __IKSolver__H
#define __IKSolver__H
#include "IKHierarchy.h"
class IKSolver : public BaseInterfaceServer {
public:
typedef unsigned ReturnCondition;
enum ConditionBit {
bLimitReached = 0x00000001,
bLimitClamped = 0x00000002,
bMaxIterationReached = 0x00000004,
// The first eight bits are reserved for mild condition.
// They are still considered successful.
bGoalTooCloseToEE = 0x00000100,
bInvalidArgument = 0x00000200,
bInvalidInitialValue = 0x00000400
};
// Plugins derived from this class are supposed to have this super class id.
virtual SClass_ID SuperClassID() {return IK_SOLVER_CLASS_ID;}
virtual Class_ID ClassID() =0;
virtual void GetClassName(TSTR& s) { s= TSTR(_T("IKSolver")); }
virtual ~IKSolver(){}
// History independent solver does need time input.
virtual bool IsHistoryDependent() const =0;
virtual bool DoesOneChainOnly() const =0;
// Interactive solver does need initial pose. It needs current pose.
virtual bool IsInteractive() const =0;
virtual bool UseSlidingJoint() const =0;
virtual bool UseSwivelAngle() const =0;
// Solutions of an analytic solver is not dependent on Pos/Rot threshold
// or MaxInteration number.
virtual bool IsAnalytic() const { return false; }
// The result will be simply clamped into joint limits by the ik system
// if the solver does not do joint limits.
virtual bool DoesRootJointLimits() const { return false;}
virtual bool DoesJointLimitsButRoot() const { return false;}
// RotThreshold() is not relevant to solver that does not SolveEERotation().
// UseSwivelAngle() and SolveEERotation() cannot both be true.
virtual bool SolveEERotation() const =0;
// A solver may have its own zero map. If so, the IK system may want
// to know through this method.
virtual const IKSys::ZeroPlaneMap*
GetZeroPlaneMap(const Point3& a0, const Point3& n0) const
{ return NULL; }
virtual float GetPosThreshold() const =0;
virtual float GetRotThreshold() const =0;
virtual unsigned GetMaxIteration() const =0;
virtual void SetPosThreshold(float) =0;
virtual void SetRotThreshold(float) =0;
virtual void SetMaxIteration(unsigned) =0;
// The derived class should override this method if it answers true
// to DoesOneChainOnly() and false to HistoryDependent().
// The solver is not designed to be invoked recursively. The
// recursion logic existing among the ik chains is taken care of by
// the Max IK (sub-)System.
virtual ReturnCondition Solve(IKSys::LinkChain&) =0;
};
#endif // #ifndef __IKSolver__H

329
lib/maxsdk40/ILag.h Executable file
View File

@ -0,0 +1,329 @@
#ifndef __ILAG__H
#define __ILAG__H
#include "iFnPub.h"
#define LAZYID 0xDE17A34f, 0x8A41E2B0
class SpringClass
{
public:
Point3 vel, pos, init_pos;
float InheritVel;
BOOL modified;
Point3 LocalPt;
Point3 tempVel[6];
Point3 tempPos[6];
float dist;
float mass;
};
class EdgeBondage
{
public:
float dist;
int v1,v2;
int flags;
};
class CacheClass
{
public:
Point3 vel, pos;
};
class LagModData : public LocalModData {
public:
Tab<EdgeBondage> edgeSprings;
int id;
INode *SelfNode;
Tab<SpringClass> SpringList;
Tab<CacheClass> WholeFrameCache;
Tab<BYTE> esel; //selection for edges vertices
Tab<BYTE> wsel; //vertex weight selection
Tab<BYTE> psel;
Matrix3 InverseTM;
BOOL isMesh;
BOOL isPatch;
BOOL addSprings;
BOOL removeSprings;
BOOL computeEdges;
BOOL ignoreInteriorHandles;
BOOL simpleSoft;
Point3 hitPoint;
BOOL isHit;
TimeValue lastFrame;
BOOL nukeRenderCache;
Tab<Point3> pointCache;
LagModData()
{
SelfNode = NULL;
id = -1;
computeEdges = TRUE;
isMesh = FALSE;
isPatch = FALSE;
lastFrame = 999999999;
nukeRenderCache = TRUE;
addSprings = FALSE;
removeSprings = FALSE;
simpleSoft = FALSE;
}
LagModData(int i, INode *n)
{
id = i;
SelfNode = n;
isMesh = FALSE;
isPatch = FALSE;
lastFrame = 999999999;
nukeRenderCache = TRUE;
computeEdges = TRUE;
addSprings = FALSE;
removeSprings = FALSE;
simpleSoft = FALSE;
}
~LagModData()
{
SelfNode = NULL;
}
LocalModData* Clone()
{
LagModData* d = new LagModData();
d->id = id;
d->SelfNode = NULL;
isMesh = FALSE;
isPatch = FALSE;
computeEdges = TRUE;
addSprings = FALSE;
removeSprings = FALSE;
simpleSoft = FALSE;
d->edgeSprings = edgeSprings;
d->esel = esel;
d->wsel = wsel;
d->psel = psel;
// d->edgeSprings = edgeSpings;
// d->WholeFrameCache = WholeFrameCache;
return d;
}
};
class ILagMod;
// block IDs
enum { lag_params };
// lag_param param IDs
enum { lag_flex, lag_strength, lag_sway, lag_referenceframe, lag_paint_strength,
lag_paint_radius,lag_paint_feather,lag_paint_backface, lag_force_node, lag_absolute,
lag_solver, lag_samples,
lag_chase, lag_center,
lag_endframeon, lag_endframe,
lag_collider_node,
lag_stretch_str, lag_stretch_sway,
lag_torque_str, lag_torque_sway,
lag_extra_str, lag_extra_sway,
lag_hold_radius,
lag_add_mode,
lag_displaysprings,
lag_holdlength,
lag_holdlengthpercent,
lag_lazyeval,
lag_stretch,
lag_stiffness,
lag_enable_advance_springs,
lag_springcolors,
lag_customspringdisplay,
lag_affectall,
lag_createspringdepth,
lag_createspringmult,
};
//***************************************************************
//Function Publishing System stuff
//****************************************************************
#define LAG_INTERFACE Interface_ID(0xDE17A34f, 0x8A41E3C1)
#define GetILagInterface(cd) \
(ILagMod *)(cd)->GetInterface(LAG_INTERFACE)
enum { lag_paint, lag_setreference, lag_reset,
lag_addforce, lag_removeforce,
lag_numbervertices,
lag_selectvertices,lag_getselectedvertices,
lag_getvertexweight,lag_setvertexweight,
lag_setedgelist,lag_getedgelist,
lag_addspringselection,
lag_addspring,
lag_removeallsprings,
lag_addspring_button,
lag_removespring_button,
lag_option_button,
lag_simplesoft_button,
lag_removespring_by_end,
lag_removespring_by_both_ends,
lag_removespringbyindex,
lag_numbersprings,
lag_getspringgroup,
lag_setspringgroup,
lag_getspringlength,
lag_setspringlength,
lag_getindex
};
//****************************************************************
class ILagMod : public FPMixinInterface
{
public:
//Function Publishing System
//Function Map For Mixin Interface
//*************************************************
BEGIN_FUNCTION_MAP
VFN_0(lag_paint, fnPaint);
VFN_0(lag_setreference, fnSetReference);
VFN_0(lag_reset, fnReset);
VFN_1(lag_addforce, fnAddForce,TYPE_INODE);
VFN_1(lag_removeforce, fnRemoveForce,TYPE_INT);
FN_0(lag_numbervertices,TYPE_INT, fnNumberVertices);
VFN_2(lag_selectvertices, fnSelectVertices, TYPE_BITARRAY, TYPE_BOOL);
FN_0(lag_getselectedvertices, TYPE_BITARRAY, fnGetSelectedVertices);
FN_1(lag_getvertexweight, TYPE_FLOAT, fnGetVertexWeight, TYPE_INT);
VFN_2(lag_setvertexweight, fnSetVertexWeight, TYPE_INT_TAB,TYPE_FLOAT_TAB);
VFN_2(lag_setedgelist, fnSetEdgeList, TYPE_BITARRAY, TYPE_BOOL);
FN_0(lag_getedgelist, TYPE_BITARRAY, fnGetEdgeList);
VFN_2(lag_addspringselection, fnAddSingleSpringFromSelection,TYPE_INT,TYPE_BOOL);
VFN_4(lag_addspring, fnAddSpring,TYPE_INT,TYPE_INT,TYPE_INT,TYPE_BOOL);
VFN_0(lag_removeallsprings, fnRemoveAllSprings);
VFN_0(lag_addspring_button, fnAddSpringButton);
VFN_0(lag_removespring_button, fnRemoveSpringButton);
VFN_0(lag_option_button, fnOptionButton);
VFN_0(lag_simplesoft_button, fnSimpleSoftButton);
VFN_1(lag_removespring_by_end,fnRemoveSpring,TYPE_INT);
VFN_2(lag_removespring_by_both_ends,fnRemoveSpring,TYPE_INT,TYPE_INT);
VFN_1(lag_removespringbyindex,fnRemoveSpringByIndex,TYPE_INT);
FN_0(lag_numbersprings,TYPE_INT,fnNumberSprings);
FN_1(lag_getspringgroup,TYPE_FLOAT,fnGetSpringGroup,TYPE_INT);
VFN_2(lag_setspringgroup,fnSetSpringGroup,TYPE_INT,TYPE_INT);
FN_1(lag_getspringlength,TYPE_FLOAT,fnGetSpringLength,TYPE_INT);
VFN_2(lag_setspringlength,fnSetSpringLength,TYPE_INT,TYPE_FLOAT);
FN_2(lag_getindex,TYPE_INT,fnGetIndex,TYPE_INT,TYPE_INT);
END_FUNCTION_MAP
FPInterfaceDesc* GetDesc(); // <-- must implement
//note functions that start with fn are to be used with maxscript since these expect 1 based indices
BitArray tempBitArray;
virtual void fnPaint()=0;
virtual void fnSetReference()=0;
virtual void fnReset()=0;
virtual void fnAddForce(INode *node)=0;
virtual void fnRemoveForce(int whichNode)=0;
virtual int fnNumberVertices()=0;
virtual void fnSelectVertices(BitArray *selList, BOOL updateViews)=0;
virtual BitArray *fnGetSelectedVertices()=0;
virtual float fnGetVertexWeight(int index)=0;
virtual void fnSetVertexWeight(Tab<int> *indexList, Tab<float> *values)=0;
virtual void fnSetEdgeList(BitArray *selList, BOOL updateViews)=0;
virtual BitArray *fnGetEdgeList()=0;
virtual void fnAddSingleSpringFromSelection(int flag,BOOL addDupes)=0;
virtual void AddSingleSpringFromSelection(LagModData *lmd, int flag,BOOL addDupes)=0;
virtual void fnAddSpring(int a, int b, int flag,BOOL addDupes)=0;
virtual void AddSpring(LagModData *lmd, int a, int b, int flag,BOOL addDupes)=0;
virtual void fnRemoveAllSprings()=0;
virtual void RemoveAllSprings(LagModData *lmd)=0;
/* virtual void fnDeleteSpring(int a, int b)=0;
virtual void fnDeleteSpring(int index)=0;
virtual void DeleteSpring(LagModData *lmd, int a, int b)=0;
virtual void DeleteSpring(LagModData *lmd, int index)=0;
virtual void fnSetSpringFlag(int index, int flag)=0;
virtual void SetSpringFlag(LagModData *lmd,int index, int flag)=0;
virtual int fnGetSpringFlag(int index)=0;
virtual int GetSpringFlag(LagModData *lmd,int index)=0;
*/
virtual void fnAddSpringButton()=0;
virtual void fnRemoveSpringButton()=0;
virtual void fnOptionButton()=0;
virtual void fnSimpleSoftButton()=0;
virtual void fnRemoveSpring(int a) = 0;
virtual void RemoveSpring(LagModData *lmd,int a) = 0;
virtual void fnRemoveSpring(int a,int b) = 0;
virtual void RemoveSpring(LagModData *lmd,int a,int b)=0;
virtual void fnRemoveSpringByIndex(int index) = 0;
virtual void RemoveSpringByIndex(LagModData *lmd,int index) = 0;
virtual int fnNumberSprings()=0;
virtual int NumberSprings(LagModData *lmd)=0;
virtual int fnGetSpringGroup(int index) = 0;
virtual int GetSpringGroup(LagModData *lmd,int index)=0;
virtual void fnSetSpringGroup(int index, int group)=0;
virtual void SetSpringGroup(LagModData *lmd,int index, int group)=0;
virtual float fnGetSpringLength(int index)=0;
virtual float GetSpringLength(LagModData *lmd,int index) = 0;
virtual void fnSetSpringLength(int index,float dist)=0;
virtual void SetSpringLength(LagModData *lmd,int index,float dist) = 0;
virtual int fnGetIndex(int a, int b)=0;
virtual int GetIndex(LagModData *lmd,int a, int b)=0;
};
#endif // __ILAG__H

138
lib/maxsdk40/ILayer.h Executable file
View File

@ -0,0 +1,138 @@
/**********************************************************************
*<
FILE: ILayer.h
DESCRIPTION: Declaration of the ILayer interface
CREATED BY: Peter Sauerbrei
HISTORY: Created 19 October 1998
*> Copyright (c) 1998-99, All Rights Reserved.
**********************************************************************/
#pragma once
#ifndef __ILAYER_H__
#define __ILAYER_H__
#include <maxtypes.h>
#define NODE_LAYER_REF 6
class LayerProperty : public ReferenceTarget
{
private:
int m_id;
TSTR m_name;
public:
LayerProperty() : m_id(-1), m_name("") {}
LayerProperty(const TSTR & name, int id) : m_id(id), m_name(name) {}
virtual ~LayerProperty() {}
// child methods
virtual void SetProperty(const int d) = 0;
virtual void SetProperty(const float d) = 0;
virtual void SetProperty(const Point3 & d) = 0;
virtual void SetProperty(const TSTR & d) = 0;
virtual void SetProperty(void * d) = 0;
virtual bool GetProperty(int & i) const = 0;
virtual bool GetProperty(float & f) const = 0;
virtual bool GetProperty(Point3 & p) const = 0;
virtual bool GetProperty(TSTR & n) const = 0;
virtual bool GetProperty(void * v) const = 0;
// local methods
int GetID() const { return m_id; }
void SetID(int id) { m_id = id; }
TSTR GetName() const { return m_name; }
void SetName(const TSTR & name) { m_name = name; }
};
class ILayer : public ReferenceTarget
{
public:
static const SClass_ID kLayerSuperClassID;
// from Animatable
SClass_ID SuperClassID() { return kLayerSuperClassID; }
// from ILayerRecord
virtual bool AddToLayer(INode * rtarg) = 0;
virtual bool DeleteFromLayer(INode * rtarg) = 0;
virtual void SetName(const TSTR & name) = 0;
virtual TSTR GetName() const = 0; // user must delete the string
virtual void SetWireColor(DWORD newcol) = 0;
virtual DWORD GetWireColor() const = 0;
virtual void Hide(bool onOff) = 0;
virtual bool IsHidden() const = 0;
virtual void Freeze(bool onOff) = 0;
virtual bool IsFrozen() const = 0;
virtual void SetRenderable(bool onOff) = 0;
virtual bool Renderable() const = 0;
// mjm - 06.12.00 - begin
virtual void SetPrimaryVisibility(bool onOff) = 0;
virtual bool GetPrimaryVisibility() const = 0;
virtual void SetSecondaryVisibility(bool onOff) = 0;
virtual bool GetSecondaryVisibility() const = 0;
// mjm - end
virtual void XRayMtl(bool onOff) = 0;
virtual bool HasXRayMtl() const = 0;
virtual void IgnoreExtents(bool onOff) = 0;
virtual bool GetIgnoreExtents() const = 0;
virtual void BoxMode(bool onOff) = 0;
virtual bool GetBoxMode() const = 0;
virtual void AllEdges(bool onOff) = 0;
virtual bool GetAllEdges() const = 0;
virtual void VertTicks(bool onOff) = 0;
virtual bool GetVertTicks() const = 0;
virtual void BackCull(bool onOff) = 0;
virtual bool GetBackCull() const = 0;
virtual void SetCVertMode(bool onOff) = 0;
virtual bool GetCVertMode() const = 0;
virtual void SetShadeCVerts(bool onOff) = 0;
virtual bool GetShadeCVerts() const = 0;
virtual void SetCastShadows(bool onOff) = 0;
virtual bool CastShadows() const = 0;
virtual void SetRcvShadows(bool onOff) = 0;
virtual bool RcvShadows() const = 0;
// mjm - 06.12.00 - begin
virtual void SetApplyAtmospherics(bool onOff) = 0;
virtual bool ApplyAtmospherics() const = 0;
// mjm - end
virtual void SetMotBlur(int kind) = 0;
virtual int MotBlur() const = 0;
virtual int GetRenderFlags() const = 0;
virtual void SetRenderFlags(int flags) = 0;
virtual int GetDisplayFlags() const = 0;
virtual int AddProperty(LayerProperty & lprop) = 0;
virtual int SetProperty(LayerProperty & lprop) = 0;
virtual int GetProperty(LayerProperty & lprop) const = 0;
virtual bool Used(void) const = 0;
virtual bool GetFlag(int mask) const = 0;
virtual bool GetFlag2(int mask) const = 0;
virtual void UpdateSelectionSet(void) = 0;
virtual int GetRenderFlags(int oldlimits) const = 0;
virtual void SetInheritVisibility(bool onOff) = 0;
virtual bool GetInheritVisibility() const = 0;
virtual void Trajectory(bool onOff, bool temp = false) = 0;
virtual bool GetTrajectory() const = 0;
virtual void SetDisplayByLayer(BOOL onOff, INode *) = 0;
virtual void SetRenderByLayer(BOOL onOff, INode *) = 0;
virtual void SetMotionByLayer(BOOL onOff, INode *) = 0;
virtual BOOL GetDisplayByLayer(INode *) = 0;
virtual BOOL GetRenderByLayer(INode *) = 0;
virtual BOOL GetMotionByLayer(INode *) = 0;
virtual void SelectObjects(void) = 0;
virtual void SetVisibility(TimeValue t, float vis) = 0;
virtual float GetVisibility(TimeValue t,Interval *valid=NULL) = 0;
virtual float GetVisibility(TimeValue t,View & view, Interval *valid=NULL) = 0;
virtual float GetImageBlurMultiplier(TimeValue t) = 0;
virtual void SetImageBlurMultiplier(TimeValue t, float m) = 0;
virtual bool GetMotBlurOnOff(TimeValue t) = 0;
virtual void SetMotBlurOnOff(TimeValue t, bool m) = 0;
virtual bool IsHiddenByVisControl() = 0;
virtual float GetLocalVisibility(TimeValue t,Interval *valid) = 0;
};
#endif //__ILAYER_H__

54
lib/maxsdk40/ILayerManager.h Executable file
View File

@ -0,0 +1,54 @@
/**********************************************************************
*<
FILE: ILayerManager.h
DESCRIPTION: Declaration of the ILayerManager interface
CREATED BY: Peter Sauerbrei
HISTORY: Created 19 October 1998
*> Copyright (c) 1998-99, All Rights Reserved.
**********************************************************************/
#pragma once
#ifndef __ILAYERMANAGER_H__
#define __ILAYERMANAGER_H__
//#include <ILayer.h>
class ILayer;
class LayerIterator;
class ConstLayerIterator;
class ILayerManager : public ReferenceTarget
{
public:
static const SClass_ID kLayerManagerSuperClassID;
// from Animatable
SClass_ID SuperClassID() { return kLayerManagerSuperClassID; }
// local methods
virtual bool AddLayer(ILayer * layer) = 0;
virtual ILayer * CreateLayer(void) = 0; // creates a new layer
virtual BOOL DeleteLayer(const TSTR & name) = 0; // deletes a layer
virtual void SetCurrentLayer(const TSTR & name) = 0; // sets the current layer
virtual void SetCurrentLayer(void) = 0;
virtual ILayer * GetCurrentLayer(void) const = 0; // gets the current layer
virtual void EditLayer(const TSTR & name) = 0;
virtual void DoLayerPropDialog(HWND hWnd) = 0;
virtual LayerIterator * MakeIterator(void) = 0;
virtual ConstLayerIterator * MakeConstIterator(void) const = 0;
virtual int GetLayerCount(void) = 0;
virtual ILayer * GetLayer(const TSTR & name) const = 0;
virtual void DoLayerSelDialog(HWND hWnd) = 0;
//virtual void SetupToolList(HWND hWnd) = 0;
virtual void SetupToolList2(HWND hWnd, HWND hParent) = 0;
virtual void ExtendMenu(HMENU hMenu, bool geometry = true, bool grid = false) = 0;
virtual TSTR GetSavedLayer(int i) const = 0;
virtual ILayer * GetRootLayer() const = 0;
virtual void Reset(BOOL fileReset = FALSE) = 0;
virtual void SelectObjectsByLayer(HWND hWnd) = 0;
};
#endif //__ILAYERMANAGER_H__

33
lib/maxsdk40/IMaterial.h Executable file
View File

@ -0,0 +1,33 @@
/**********************************************************************
*<
FILE: IMaterial.h
DESCRIPTION: Material extension Interface class
CREATED BY: Nikolai Sander
HISTORY:
*> Copyright (c) 2000, All Rights Reserved.
**********************************************************************/
#ifndef _MTATERIAL_H_
#define _MTATERIAL_H_
#define IMATERIAL_INTERFACE_ID Interface_ID(0x578773a5, 0x44cc0d7d)
class MtlBase;
class INode;
class IMaterial : public BaseInterface
{
public:
// We'll do this as soon as Animatable derives from GenericInterfaceServer<BaseInterface>
virtual void SetMtl(MtlBase *mtl)=0;
virtual MtlBase *GetMtl()=0;
virtual void SetINode(INode *node)=0;
virtual INode *GetINode()=0;
};
#endif

42
lib/maxsdk40/IMtlEdit.h Executable file
View File

@ -0,0 +1,42 @@
/**********************************************************************
*<
FILE: IMtlEdit.h
DESCRIPTION: Material Editor Interface
CREATED BY: Nikolai Sander
HISTORY: Created 6/22/00
*> Copyright (c) 2000, All Rights Reserved.
**********************************************************************/
class MtlBase;
class IMtlEditInterface : public FPStaticInterface
{
public:
// function IDs
enum {
fnIdGetCurMtl,
fnIdSetActiveMtlSlot,
fnIdGetActiveMtlSlot,
fnIdPutMtlToMtlEditor,
fnIdGetTopMtlSlot,
fnIdOkMtlForScene,
fnIdUpdateMtlEditorBrackets,
};
virtual MtlBase *GetCurMtl() = 0;
virtual void SetActiveMtlSlot(int i, BOOL forceUpdate = FALSE)=0;
virtual int GetActiveMtlSlot()=0;
virtual void PutMtlToMtlEditor(MtlBase *mtlBase, int slot)=0;
virtual MtlBase* GetTopMtlSlot(int slot)=0;
virtual BOOL OkMtlForScene(MtlBase *m)=0;
virtual void UpdateMtlEditorBrackets()=0;
};
#define MTLEDIT_INTERFACE Interface_ID(0x2c7b3f6e, 0x16fb35d4)
inline IMtlEditInterface* GetMtlEditInterface () { return (IMtlEditInterface *)GetCOREInterface(MTLEDIT_INTERFACE); }

45
lib/maxsdk40/IPipelineClient.h Executable file
View File

@ -0,0 +1,45 @@
/**********************************************************************
FILE: IPipelineClient.h
DESCRIPTION: Geometry pipeline client API
CREATED BY: Attila Szabo, Discreet
HISTORY: [attilas|19.09.2000]
*> Copyright (c) 1998-2000, All Rights Reserved.
**********************************************************************/
#ifndef __IPIPELINECLIENT__H
#define __IPIPELINECLIENT__H
#include "baseinterface.h"
// GUID that identifies this ifc (interface)
#define PIPELINECLIENT_INTERFACE Interface_ID(0x62383d51, 0x2d0f7d6a)
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// This interface should be implemented by objects that flow up the
// geometry pipeline and have data members that belong to the pipeline
// channels (geometry, topology, texmap, etc)
// ... in other words by objects that are part of the data flow evaluation
// of the Max stack.
//________________________________________________________________________
class IPipelineClient : public BaseInterface
{
public:
// --- IPipelineClient methods
virtual void ShallowCopy( IPipelineClient* from, ULONG_PTR channels ) = 0;
virtual void DeepCopy( IPipelineClient* from, ULONG_PTR channels ) = 0;
virtual void NewAndCopyChannels( ULONG_PTR channels ) = 0;
virtual void FreeChannels( ULONG_PTR channels, int zeroOthers = 1 ) = 0;
virtual void ZeroChannels( ULONG_PTR channels ) = 0;
virtual void AppendAllChannels( IPipelineClient* from ) = 0;
// --- from BaseInterface
virtual Interface_ID GetID() { return PIPELINECLIENT_INTERFACE; }
};
#endif

130
lib/maxsdk40/IPointCache.h Executable file
View File

@ -0,0 +1,130 @@
//-------------------------------------------------------------
// Access to Point Cache
//
#ifndef __IPOINTCACHE__H
#define __IPOINTCACHE__H
#include "iFnPub.h"
#define POINTCACHE_CLASS_ID Class_ID(0x21d07ae1, 0x48d30bec)
#define POINTCACHEWSM_CLASS_ID Class_ID(0x21d07ae1, 0x48d30bed)
#define PARTICLECACHE_CLASS_ID Class_ID(0x21d07ae1, 0x48d30bee)
enum { pointcache_params };
//enums for various parameters
//note pb_record_file is no longer used and legacy
//pb_disable_mods is no longer used and legacy
//pb_fastcache is fast caching scheme but right now can potential cause crashes
// or extremely slow conditions are systems that spawn particles
enum {
pb_time,pb_start_time,pb_end_time,pb_samples, pb_disable_mods, pb_cache_file, pb_record_file,pb_relative,pb_strength,pb_fastcache
};
class IPointCache;
class IPointCacheWSM;
class IParticleCache;
//***************************************************************
//Function Publishing System stuff
//****************************************************************
#define POINTCACHE_INTERFACE Interface_ID(0x53b4409b, 0x18ee7cc8)
#define GetIPointCacheInterface(cd) \
(IPointCache *)(cd)->GetInterface(POINTCACHE_INTERFACE)
#define POINTCACHEWSM_INTERFACE Interface_ID(0x53b4409b, 0x18ee7cc9)
#define GetIPointCacheWSMInterface(cd) \
(IPointCacheWSM *)(cd)->GetInterface(POINTCACHEWSM_INTERFACE)
#define PARTICLECACHE_INTERFACE Interface_ID(0x53b4409b, 0x18ee7cd0)
#define GetIParticleCacheInterface(cd) \
(IParticleCache *)(cd)->GetInterface(PARTICLECACHE_INTERFACE)
enum { pointcache_record, pointcache_setcache, pointcache_enablemods,pointcache_disablemods
};
//****************************************************************
class IPointCache : public FPMixinInterface
{
public:
//Function Publishing System
//Function Map For Mixin Interface
//*************************************************
BEGIN_FUNCTION_MAP
VFN_0(pointcache_record, fnRecord);
VFN_0(pointcache_setcache, fnSetCache);
VFN_0(pointcache_enablemods, fnEnableMods);
VFN_0(pointcache_disablemods, fnDisableMods);
END_FUNCTION_MAP
FPInterfaceDesc* GetDesc(); // <-- must implement
virtual void fnRecord()=0;
virtual void fnSetCache()=0;
virtual void fnEnableMods()=0;
virtual void fnDisableMods()=0;
};
class IPointCacheWSM : public FPMixinInterface
{
public:
//Function Publishing System
//Function Map For Mixin Interface
//*************************************************
BEGIN_FUNCTION_MAP
VFN_0(pointcache_record, fnRecord);
VFN_0(pointcache_setcache, fnSetCache);
VFN_0(pointcache_enablemods, fnEnableMods);
VFN_0(pointcache_disablemods, fnDisableMods);
END_FUNCTION_MAP
FPInterfaceDesc* GetDesc(); // <-- must implement
virtual void fnRecord()=0;
virtual void fnSetCache()=0;
virtual void fnEnableMods()=0;
virtual void fnDisableMods()=0;
};
class IParticleCache : public FPMixinInterface
{
public:
//Function Publishing System
//Function Map For Mixin Interface
//*************************************************
BEGIN_FUNCTION_MAP
VFN_0(pointcache_record, fnRecord);
VFN_0(pointcache_setcache, fnSetCache);
END_FUNCTION_MAP
FPInterfaceDesc* GetDesc(); // <-- must implement
virtual void fnRecord()=0;
virtual void fnSetCache()=0;
};
#endif // __IPOINTCACHE__H

80
lib/maxsdk40/IReagent.h Executable file
View File

@ -0,0 +1,80 @@
/**********************************************************************
*<
FILE: IReagent.h
DESCRIPTION: Declares a class of objects which react
CREATED BY: John Hutchinson
HISTORY: Created January 9, 1999
*> Copyright (c) 1994, All Rights Reserved.
**********************************************************************/
#pragma once
#include <IAggregation.h>
class IAggregation;
class IGeomImp;
class IValence;
class ValenceDescIterator;
class IHost;
class IReagent
{
public:
//completes the construction process
virtual void InitializeSubstrate(INode* n) = 0;//completes the construction process
virtual IValence* OpenValence() = 0;
virtual void OpenValenceTM(TimeValue t, Matrix3& tm)= 0;
virtual int OpenValenceIndex() = 0;
virtual void CloseValence(IValence* val, bool done = false)= 0;
virtual int NumValenceTypes() = 0;
virtual Class_ID GetValenceClassID(int which) = 0;
//create a valence given a class descriptor and a node(used for its location)
//may create a new instance of this type
virtual IValence* PrepValence(ClassDesc* cd, INode* me, INode* loc) = 0;
//pass back the chemistry/geometry of the reagent viz-a-viz the current reaction
//Thus this excludes any pending reaction results.
//Currently we assumes one reaction at a time. Could pass a valence to identify which.
virtual IGeomImp* ReactionSite() = 0;
};
class IValence
{
public:
enum bondtype {
eStrongBond,//absorb the node
eWeakBond,//don't absorb the node
eTransientBond,//temporary but affect permanaent change to object stack
eTopicalBond};//unused but coneptually a weaker type of transient bonds which just copy node properties
//set up a controller and possibly record subobj hit data from the host
virtual Control* Locate(INode* host, INode *loc, Control* c, Matrix3& oldP, Matrix3& newP) = 0;//may clone the controller
virtual commitlevels Occupy(Object* obj) = 0;
virtual Object* Occupant()=0;
virtual bool Bind(TimeValue t, IGeomImp &complex_geom, Matrix3& tm, Interval iv, IHost* attentivehost = NULL, bool expedite = false) = 0;
virtual commitlevels Validate(TimeValue t, int action, commitlevels current, Matrix3* tm) = 0;
virtual bondtype BondStrength()=0;
virtual void SetOwner(Object* owner)=0;
virtual void SetMaterialBase(int matidx) = 0;
};
/*
class ValenceDescIterator
{
public:
ValenceDescIterator();
~ValenceDescIterator();
Class_ID First();
virtual bool IsDone();
Class_ID Next();
private:
int m_current;
};
*/
//mechanism to test compatibility needs to be done at the class descriptor level.
//Since this is what gets enumerated at the point prio to the valence getting created.

45
lib/maxsdk40/IRefHierarchy.h Executable file
View File

@ -0,0 +1,45 @@
/**********************************************************************
*<
FILE: IRefHierarchy.h
DESCRIPTION: Interface for accessing reference hierarchy related info
CREATED BY: Attila Szabo
HISTORY: Created Nov/27/00
*> Copyright (c) 2000, All Rights Reserved.
**********************************************************************/
#ifndef __IREFHIERARCHY__H
#define __IREFHIERARCHY__H
#include "iFnPub.h"
// This interface is supposed to group reference hierarchy related methods
class IRefHierarchy : public FPStaticInterface
{
public:
// function IDs
enum
{
fnIdIsRefTargetInstanced,
};
// This method can be used to find out if an object is instanced
// (instanced pipeline).
// It Checks if the Derived Object is instanced. If it is, the pipeline
// part below and including that derived object is instanced.
// If the argument is NULL, returns FALSE
virtual BOOL IsRefTargetInstanced( ReferenceTarget* refTarget ) = 0;
};
#define REFHIERARCHY_INTERFACE Interface_ID(0x296e2793, 0x247d12e4)
inline IRefHierarchy* GetRefHierarchyInterface()
{
return static_cast<IRefHierarchy*>(GetCOREInterface(REFHIERARCHY_INTERFACE));
}
#endif // __IREFHIERARCHY__H

52
lib/maxsdk40/IRollupSettings.h Executable file
View File

@ -0,0 +1,52 @@
/**********************************************************************
*<
FILE: IRollupSettings
DESCRIPTION: Rollup Window Settings Interface
CREATED BY: Nikolai Sander
HISTORY: created 8/8/00
*> Copyright (c) 2000, All Rights Reserved.
**********************************************************************/
#ifndef __IROLLUP_H__
#define __IROLLUP_H__
class ICatRegistry;
#define EFFECTS_ROLLUPCFG_CLASSID Class_ID(0x559c705d, 0x32573fe3)
#define ATMOSPHERICS_ROLLUPCFG_CLASSID Class_ID(0x40ef5775, 0x5b5606f)
#define DISPLAY_PANEL_ROLLUPCFG_CLASSID Class_ID(0x12d45445, 0x3a5779a2)
#define MOTION_PANEL_ROLLUPCFG_CLASSID Class_ID(0xbea1816, 0x50de0291)
#define HIERARCHY_PANEL_ROLLUPCFG_CLASSID Class_ID(0x5d6c08d4, 0x7e5e2c2b)
#define UTILITY_PANEL_ROLLUPCFG_CLASSID Class_ID(0x2e256000, 0x6a5b2b34)
class IRollupSettings : public FPStaticInterface
{
public:
virtual ICatRegistry *GetCatReg()=0;
};
class ICatRegistry
{
public:
// This method gets the category (order field) for the given SuperClass ID, ClassID and Rollup Title
virtual int GetCat(SClass_ID sid, Class_ID cid, TCHAR *title,int category)=0;
// This method updates (sets) the category (order field) for the given SuperClass ID, ClassID and Rollup Title
virtual void UpdateCat(SClass_ID sid, Class_ID cid, TCHAR *title,int category)=0;
// This method Saves the category settings in File "UI\RollupOrder.cfg"
virtual void Save()=0;
// This method Loads the category settings from File "UI\RollupOrder.cfg"
virtual void Load()=0;
// This method Erases all category settings (in memory only)
virtual void EmptyRegistry()=0;
// This method deletes a category list for a given superclass ID and class ID
virtual void DeleteList(SClass_ID sid, Class_ID cid)=0;
};
#define ROLLUP_SETTINGS_INTERFACE Interface_ID(0x281a65e8, 0x12db025d)
inline IRollupSettings* GetIRollupSettings() { return (IRollupSettings*)GetCOREInterface(ROLLUP_SETTINGS_INTERFACE); }
#endif

234
lib/maxsdk40/ISkin.h Executable file
View File

@ -0,0 +1,234 @@
/**********************************************************************
FILE: ISkin.h
DESCRIPTION: Skin Bone Deformer API
CREATED BY: Nikolai Sander, Discreet
HISTORY: 7/12/99
*> Copyright (c) 1998, All Rights Reserved.
**********************************************************************/
#ifndef __ISKIN__H
#define __ISKIN__H
#include "ISkinCodes.h"
#define I_SKIN 0x00010000
#define I_GIZMO 9815854
#define SKIN_INVALID_NODE_PTR 0
#define SKIN_OK 1
//#define SKIN_CLASSID Class_ID(0x68477bb4, 0x28cf6b86)
#define SKIN_CLASSID Class_ID(9815843,87654)
class ISkinContextData
{
public:
virtual int GetNumPoints()=0;
virtual int GetNumAssignedBones(int vertexIdx)=0;
virtual int GetAssignedBone(int vertexIdx, int boneIdx)=0;
virtual float GetBoneWeight(int vertexIdx, int boneIdx)=0;
// These are only used for Spline animation
virtual int GetSubCurveIndex(int vertexIdx, int boneIdx)=0;
virtual int GetSubSegmentIndex(int vertexIdx, int boneIdx)=0;
virtual float GetSubSegmentDistance(int vertexIdx, int boneIdx)=0;
virtual Point3 GetTangent(int vertexIdx, int boneIdx)=0;
virtual Point3 GetOPoint(int vertexIdx, int boneIdx)=0;
};
class ISkin
{
public:
virtual int GetBoneInitTM(INode *pNode, Matrix3 &InitTM, bool bObjOffset = false)=0;
virtual int GetSkinInitTM(INode *pNode, Matrix3 &InitTM, bool bObjOffset = false)=0;
virtual int GetNumBones()=0;
virtual INode *GetBone(int idx)=0;
virtual DWORD GetBoneProperty(int idx)=0;
virtual ISkinContextData *GetContextInterface(INode *pNode)=0;
//new stuff
virtual TCHAR *GetBoneName(int index) = 0;
virtual int GetSelectedBone() = 0;
virtual void UpdateGizmoList() = 0;
virtual void GetEndPoints(int id, Point3 &l1, Point3 &l2) = 0;
virtual Matrix3 GetBoneTm(int id) = 0;
virtual INode *GetBoneFlat(int idx)=0;
virtual int GetNumBonesFlat()=0;
virtual int GetRefFrame()=0;
};
class IGizmoBuffer
{
public:
Class_ID cid;
void DeleteThis() { delete this; }
};
class GizmoClass : public ReferenceTarget
{
// all the refernce stuff and paramblock stuff here
public:
ISkin *bonesMod;
IParamBlock2 *pblock_gizmo_data;
int NumParamBlocks() { return 1; }
IParamBlock2* GetParamBlock(int i)
{
if (i == 0) return pblock_gizmo_data;
else return NULL;
}
IParamBlock2* GetParamBlockByID(BlockID id)
{
if (pblock_gizmo_data->ID() == id) return pblock_gizmo_data ;
else return NULL;
}
int NumRefs() {return 1;}
RefTargetHandle GetReference(int i)
{
if (i==0)
{
return (RefTargetHandle)pblock_gizmo_data;
}
return NULL;
}
void SetReference(int i, RefTargetHandle rtarg)
{
if (i==0)
{
pblock_gizmo_data = (IParamBlock2*)rtarg;
}
}
void DeleteThis() {
delete this;
}
int NumSubs() {return 1;}
Animatable* SubAnim(int i) { return GetReference(i);}
TSTR SubAnimName(int i) {return _T(""); }
int SubNumToRefNum(int subNum) {return -1;}
RefResult NotifyRefChanged( Interval changeInt,RefTargetHandle hTarget,
PartID& partID, RefMessage message)
{
return REF_SUCCEED;
}
virtual void BeginEditParams(IObjParam *ip, ULONG flags,Animatable *prev) {}
virtual void EndEditParams(IObjParam *ip,ULONG flags,Animatable *next) {}
virtual IOResult Load(ILoad *iload) {return IO_OK;}
virtual IOResult Save(ISave *isave) {return IO_OK;}
// void* GetInterface(ULONG id);
//this retrieves the boudng bx of the gizmo in world space
virtual void GetWorldBoundBox(TimeValue t,INode* inode, ViewExp *vpt, Box3& box, ModContext *mc){}
// this called in the bonesdef display code to show the gizmo
virtual int Display(TimeValue t, GraphicsWindow *gw, Matrix3 tm ) { return 1;}
virtual Interval LocalValidity(TimeValue t) {return FOREVER;}
virtual BOOL IsEnabled() { return TRUE; }
virtual BOOL IsVolumeBased() {return FALSE;}
virtual BOOL IsInVolume(Point3 p, Matrix3 tm) { return FALSE;}
//this is what deforms the point
// this is passed in from the Map call in bones def
virtual Point3 DeformPoint(TimeValue t, int index, Point3 initialP, Point3 p, Matrix3 tm)
{return p;}
//this is the suggested name that the gizmo should be called in the list
virtual void SetInitialName() {}
//this is the final name of the gizmo in th list
virtual TCHAR *GetName(){return NULL;}
//this sets the final name of the gizmo in the list
virtual void SetName(TCHAR *name) {}
// this is called when the gizmo is initially created
// it is passed to the current selected verts in the world space
//count is the number of vertice in *p
//*p is the list of point being affected in world space
//numberOfInstances is the number of times this modifier has been instanced
//mapTable is an index list into the original vertex table for *p
virtual BOOL InitialCreation(int count, Point3 *p, int numbeOfInstances, int *mapTable) { return TRUE;}
//this is called before the deformation on a frame to allow the gizmo to do some
//initial setupo
virtual void PreDeformSetup(TimeValue t) {}
virtual void PostDeformSetup(TimeValue t) {}
virtual IGizmoBuffer *CopyToBuffer() { return NULL;}
virtual void PasteFromBuffer(IGizmoBuffer *buffer) {}
virtual void Enable(BOOL enable) {}
virtual BOOL IsEditing() { return FALSE;}
virtual void EndEditing() {}
virtual void EnableEditing(BOOL enable) {}
// From BaseObject
virtual int HitTest(TimeValue t, INode* inode, int type, int crossing, int flags, IPoint2 *p, ViewExp *vpt, ModContext* mc, Matrix3 tm) {return 0;}
virtual void SelectSubComponent(HitRecord *hitRec, BOOL selected, BOOL all, BOOL invert=FALSE) {}
virtual void Move( TimeValue t, Matrix3& partm, Matrix3& tmAxis, Point3& val, Matrix3 tm, BOOL localOrigin=FALSE ) {}
virtual void GetSubObjectCenters(SubObjAxisCallback *cb,TimeValue t,INode *node, Matrix3 tm) {}
virtual void GetSubObjectTMs(SubObjAxisCallback *cb,TimeValue t,INode *node, Matrix3 tm) {}
virtual void ClearSelection(int selLevel) {}
virtual void SelectAll(int selLevel) {}
virtual void InvertSelection(int selLevel) {}
};
/*
Modifier* FindSkinModifier (INode* node)
{
// Get object from node. Abort if no object.
Object* pObj = node->GetObjectRef();
if (!pObj) return NULL;
// Is derived object ?
while (pObj->SuperClassID() == GEN_DERIVOB_CLASS_ID)
{
// Yes -> Cast.
IDerivedObject* pDerObj = static_cast<IDerivedObject*>(pObj);
// Iterate over all entries of the modifier stack.
int ModStackIndex = 0;
while (ModStackIndex < pDerObj->NumModifiers())
{
// Get current modifier.
Modifier* mod = pDerObj->GetModifier(ModStackIndex);
// Is this Skin ?
if (mod->ClassID() == SKIN_CLASSID )
{
// Yes -> Exit.
return mod;
}
// Next modifier stack entry.
ModStackIndex++;
}
pObj = pDerObj->GetObjRef();
}
// Not found.
return NULL;
}
*/
#endif

24
lib/maxsdk40/ISkinCodes.h Executable file
View File

@ -0,0 +1,24 @@
/**********************************************************************
FILE: ISkinCodes.h
DESCRIPTION: Skin Bone Deformer defines
CREATED BY: Nikolai Sander, Discreet
HISTORY: 7/12/99
*> Copyright (c) 1998, All Rights Reserved.
**********************************************************************/
#ifndef __ISKINCODES__H
#define __ISKINCODES__H
#define BONE_LOCK_FLAG 1
#define BONE_ABSOLUTE_FLAG 2
#define BONE_SPLINE_FLAG 4
#define BONE_SPLINECLOSED_FLAG 8
#define BONE_DRAW_ENVELOPE_FLAG 16
#define BONE_BONE_FLAG 32
#define BONE_DEAD_FLAG 64
#endif

81
lib/maxsdk40/ISpringCtrl.h Executable file
View File

@ -0,0 +1,81 @@
/**********************************************************************
*<
FILE: jiggleAPI.h
DESCRIPTION: Public header file for Spring controller
CREATED BY: Adam Felt
HISTORY:
*> Copyright (c) 1999-2000, All Rights Reserved.
**********************************************************************/
#ifndef IJIGGLE
#define IJIGGLE
#define JIGGLEPOS 0x79697d2a
#define JIGGLEP3 0x13892172
#define JIGGLE_POS_CLASS_ID Class_ID(JIGGLEPOS, 0xf2b8a1c8)
#define JIGGLE_P3_CLASS_ID Class_ID(JIGGLEP3, 0x68976279)
#define JIGGLE_CONTROL_REF 0
#define JIGGLE_PBLOCK_REF1 1
#define JIGGLE_PBLOCK_REF2 2
//parameter defaults
#define JIGGLE_DEFAULT_TENSION 2.0f
#define JIGGLE_DEFAULT_DAMPENING 0.5f
#define JIGGLE_DEFAULT_MASS 300.0f
#define JIGGLE_DEFAULT_DRAG 1.0f
#define SET_PARAMS_RELATIVE 0
#define SET_PARAMS_ABSOLUTE 1
class IJiggle : public FPMixinInterface
{
public:
enum { get_mass, set_mass, get_drag, set_drag, get_tension, set_tension, get_dampening, set_dampening,
add_spring, get_spring_count, remove_spring_by_index, remove_spring, get_spring_system, };
BEGIN_FUNCTION_MAP
FN_0 (get_mass, TYPE_FLOAT, GetMass);
VFN_1 (set_mass, SetMass, TYPE_FLOAT);
FN_0 (get_drag, TYPE_FLOAT, GetDrag);
VFN_1 (set_drag, SetDrag, TYPE_FLOAT);
FN_1 (get_tension, TYPE_FLOAT, GetTension, TYPE_INDEX);
VFN_2 (set_tension, SetTension, TYPE_INDEX, TYPE_FLOAT);
FN_1 (get_dampening, TYPE_FLOAT, GetDampening, TYPE_INDEX);
VFN_2 (set_dampening, SetDampening, TYPE_INDEX, TYPE_FLOAT);
FN_1 (add_spring, TYPE_BOOL, AddSpring, TYPE_INODE);
FN_0 (get_spring_count, TYPE_INT, GetSpringCount);
VFN_1 (remove_spring_by_index, RemoveSpring, TYPE_INDEX);
VFN_1 (remove_spring, RemoveSpring, TYPE_INODE);
//FN_0 (get_spring_system, TYPE_INTERFACE, GetSpringSystem);
END_FUNCTION_MAP
FPInterfaceDesc* GetDesc(); // <-- must implement
SpringSys* partsys;
virtual SpringSys* GetSpringSystem()=0;
virtual float GetMass()=0;
virtual void SetMass(float mass, bool update=true)=0;
virtual float GetDrag()=0;
virtual void SetDrag(float drag, bool update=true)=0;
virtual float GetTension(int index)=0;
virtual void SetTension(int index, float tension, int absolute=1, bool update=true)=0;
virtual float GetDampening(int index)=0;
virtual void SetDampening(int index, float dampening, int absolute=1, bool update=true)=0;
virtual BOOL AddSpring(INode *node)=0;
virtual INT GetSpringCount()=0;
virtual void RemoveSpring(int which)=0;
virtual void RemoveSpring(INode *node)=0;
};
#endif //IJIGGLE

55
lib/maxsdk40/IStdDualVS.h Executable file
View File

@ -0,0 +1,55 @@
/**********************************************************************
*<
FILE: IStdDualVS.h
DESCRIPTION: Standard Dual VertexShader helper class interface definition
CREATED BY: Nikolai Sander, Discreet
HISTORY: created 10/11/00
*> Copyright (c) 2000, All Rights Reserved.
**********************************************************************/
#ifndef __ISTDDUALVS__H
#define __ISTDDUALVS__H
#include "IHardwareShader.h"
#define STD_DUAL_VERTEX_SHADER Class_ID(0x40e6b1a0, 0x549cbf06)
class VertexShaderCache
{
bool valid;
INode *node;
public:
VertexShaderCache(){ node = NULL; valid = false;}
~VertexShaderCache(){}
INode *GetNode() { return node;}
void SetNode(INode *node) { this->node = node;}
bool GetValid() { return valid;}
void SetValid(bool valid) { this->valid = valid;}
};
class IStdDualVSCallback
{
public:
virtual ReferenceTarget *GetRefTarg()=0;
virtual VertexShaderCache *CreateVertexShaderCache()=0;
virtual HRESULT InitValid(Mesh* mesh, INode *node)=0;
virtual HRESULT InitValid(MNMesh* mnmesh, INode *node)=0;
};
class IStdDualVS : public IVertexShader, public ReferenceMaker
{
public:
virtual ~IStdDualVS(){};
virtual void SetCallback(IStdDualVSCallback *callback)=0;
virtual int FindNodeIndex(INode *node)=0;
virtual Class_ID ClassID(){ return STD_DUAL_VERTEX_SHADER;}
virtual SClass_ID SuperClassID() { return REF_MAKER_CLASS_ID;}
virtual void DeleteThis() { delete this; }
};
#endif

44
lib/maxsdk40/MNBigMat.h Executable file
View File

@ -0,0 +1,44 @@
// MNBigMat.h
// Created by Steve Anderson, Nov. 22 1996.
// BigMatrix is for when I need good old-fashioned mxn matrices.
// Classes:
// BigMatrix
#ifndef __MN_BIGMAT_H_
#define __MN_BIGMAT_H_
#define BIGMAT_MAX_SIZE 10000
class BigMatrix {
public:
int m, n;
float *val;
BigMatrix () { val=NULL; m=0; n=0; }
DllExport BigMatrix (int mm, int nn);
DllExport BigMatrix (const BigMatrix & from);
~BigMatrix () { Clear (); }
DllExport void Clear ();
DllExport int SetSize (int mm, int nn);
DllExport float *operator[](int i) const;
DllExport BigMatrix & operator= (const BigMatrix & from);
DllExport void SetTranspose (BigMatrix & trans) const;
DllExport float Invert();
DllExport void Identity ();
// Debugging functions:
DllExport void Randomize (float scale);
DllExport void MNDebugPrint ();
// Do not use -- does nothing. (Replaced by MNDebugPrint.)
DllExport void dump (FILE *fp);
};
DllExport extern BOOL BigMatMult (BigMatrix & a, BigMatrix & b, BigMatrix &c);
#endif

62
lib/maxsdk40/MNCommon.h Executable file
View File

@ -0,0 +1,62 @@
// Common macros for all MNMath.
#ifndef __MN_COMMON_H__
#define __MN_COMMON_H__
#ifndef MNEPS
#define MNEPS 1e-04f
#endif
// Selection levels for internal use:
#define MN_SEL_DEFAULT 0 // Default = use whatever's in mesh.
#define MN_SEL_OBJECT 1
#define MN_SEL_VERTEX 2
#define MN_SEL_EDGE 3
#define MN_SEL_FACE 4
// Got sick of redoing the following everywhere:
class FlagUser {
DWORD FlagUserFlags;
public:
FlagUser () { FlagUserFlags=0; }
void SetFlag (DWORD fl, bool val=TRUE) { if (val) FlagUserFlags |= fl; else FlagUserFlags -= (FlagUserFlags & fl); }
void ClearFlag (DWORD fl) { FlagUserFlags -= (FlagUserFlags & fl); }
bool GetFlag (DWORD fl) const { return (FlagUserFlags & fl) ? 1 : 0; }
void ClearAllFlags () { FlagUserFlags = 0; }
void CopyFlags (DWORD fl) { FlagUserFlags = fl; }
void CopyFlags (const FlagUser & fu) { FlagUserFlags = fu.FlagUserFlags; }
void CopyFlags (const FlagUser * fu) { FlagUserFlags = fu->FlagUserFlags; }
void CopyFlags (DWORD fl, DWORD mask) { FlagUserFlags |= (fl & mask); }
void CopyFlags (const FlagUser &fu, DWORD mask) { FlagUserFlags |= (fu.FlagUserFlags & mask); }
void CopyFlags (const FlagUser *fu, DWORD mask) { FlagUserFlags |= (fu->FlagUserFlags & mask); }
void OrFlags (const FlagUser & fu) { FlagUserFlags |= fu.FlagUserFlags; }
void OrFlags (const FlagUser * fu) { FlagUserFlags |= fu->FlagUserFlags; }
void AndFlags (const FlagUser & fu) { FlagUserFlags &= fu.FlagUserFlags; }
void AndFlags (const FlagUser * fu) { FlagUserFlags &= fu->FlagUserFlags; }
bool FlagMatch (DWORD fmask, DWORD fl) const {
return ((FlagUserFlags & fmask) == (fl & fmask));
}
bool FlagMatch (DWORD fmask, const FlagUser & fu) const {
return ((FlagUserFlags & fmask) == (fu.FlagUserFlags & fmask));
}
bool FlagMatch (DWORD fmask, const FlagUser * fu) const {
return ((FlagUserFlags & fmask) == (fu->FlagUserFlags & fmask));
}
DWORD ExportFlags () const { return FlagUserFlags; }
void ImportFlags (DWORD fl) { FlagUserFlags = fl; }
IOResult WriteFlags (ISave *isave, ULONG *nb) const {
return isave->Write(&FlagUserFlags, sizeof(DWORD), nb);
}
IOResult ReadFlags (ILoad *iload, ULONG *nb) {
return iload->Read (&FlagUserFlags, sizeof(DWORD), nb);
}
};
#endif // __MN_COMMON_H__

11
lib/maxsdk40/MNMath.h Executable file
View File

@ -0,0 +1,11 @@
// MN Math.h
// Collection of headers for MNMath library
#ifndef __MNMATH_H_
#define __MNMATH_H_
#include "MNCommon.h"
#include "MNMesh.h"
#include "MNBigMat.h"
#endif

BIN
lib/maxsdk40/MNMath.lib Executable file

Binary file not shown.

905
lib/maxsdk40/MNMesh.h Executable file
View File

@ -0,0 +1,905 @@
/**********************************************************************
*<
FILE: MNMesh.h
DESCRIPTION: Special mesh structures useful for face and edge based mesh operations.
CREATED BY: Steve Anderson, working for Kinetix!
HISTORY: created March 1997 from old SDMesh and WMesh.
*> Copyright (c) 1996 Autodesk, Inc., All Rights Reserved.
**********************************************************************/
// Necessary prior inclusions: max.h
// Classes:
// MNMesh
// MNVert
// MNEdge
// MNFace
// MNMeshBorder
#ifndef __MN_MESH_H_
#define __MN_MESH_H_
#include "export.h"
#include "baseinterface.h"
#define REALLOC_SIZE 10
// Boolean types: we use the same ones defined in mesh.h
//#define MESHBOOL_UNION 1
//#define MESHBOOL_INTERSECTION 2
//#define MESHBOOL_DIFFERENCE 3
// General flags for all components
// For MNVerts, MNEdges, and MNFaces, bits 0-7 are used for common characteristics
// of all components. Bits 8-15 are used for component-specific flags. Bits 16-23 are reserved
// for temporary use in MNMesh algorithms. Bits 24-31 are reserved for MNMath.lib users.
#define MN_SEL (1<<0)
#define MN_DEAD (1<<1)
#define MN_TARG (1<<2)
#define MN_BACKFACING (1<<3)
#define MN_HIDDEN (1<<4)
#define MN_WHATEVER (1<<16) // Temporary flag used internally for whatever.
#define MN_LOCAL_SEL (1<<17) // Alternate selections (not passed up the pipe).
#define MN_USER (1<<24) // Anything above this can be used by applications.
// Vertex flags
#define MN_VERT_DONE (1<<8)
class IHardwareShader;
class TriStrip;
class MNMesh;
class MNVert : public FlagUser {
public:
Point3 p;
int orig; // Original point this vert comes from
MNVert () { orig = -1; }
DllExport MNVert & operator= (MNVert & from);
bool operator==(MNVert & from) { return (from.p==p)&&(from.ExportFlags()==ExportFlags()); }
};
// Edge flags
#define MN_EDGE_INVIS (1<<8)
#define MN_EDGE_NOCROSS (1<<9)
#define MN_EDGE_MAP_SEAM (1<<10)
// Edge goes from v1 to v2
// f1 is forward-indexing face (face on "left" if surface normal above, v2 in front)
// f2 is backward-indexing face, or -1 if no such face exists. (Face on "right")
class MNEdge : public FlagUser {
public:
int v1, v2;
int f1, f2;
int track; // Keep track of whatever.
MNEdge() { Init(); }
MNEdge (int vv1, int vv2, int fc) { f1=fc; f2=-1; v1=vv1; v2=vv2; track=-1; }
void Init() { v1=v2=f1=0; f2=-1; track=-1; }
int OtherFace (int ff) { return (ff==f1) ? f2 : f1; }
int OtherVert (int vv) { return (vv==v1) ? v2 : v1; }
void Invert () { int hold=v1; v1=v2; v2=hold; hold=f1; f1=f2; f2=hold; }
DllExport void ReplaceFace (int of, int nf, int vv1=-1);
void ReplaceVert (int ov, int nv) { if (v1 == ov) v1 = nv; else { MaxAssert (v2==ov); v2 = nv; } }
DllExport bool Uncrossable ();
DllExport MNEdge & operator= (const MNEdge & from);
bool operator==(MNEdge & f) { return (f.v1==v1)&&(f.v2==v2)&&(f.f1==f1)&&(f.f2==f2)&&(f.ExportFlags()==ExportFlags()); }
int& operator[](int i) { return i ? v2 : v1; }
const int& operator[](int i) const { return i ? v2 : v1; }
DllExport void MNDebugPrint ();
};
class MNFace;
class MNMapFace {
friend class MNMesh;
int dalloc;
public:
int deg;
int *tv;
MNMapFace() { Init(); }
DllExport MNMapFace (int d);
~MNMapFace () { Clear(); }
DllExport void Init();
DllExport void Clear();
DllExport void SetAlloc (int d);
void SetSize (int d) { SetAlloc(d); deg=d; }
DllExport void MakePoly (int fdeg, int *tt);
DllExport void Insert (int pos, int num=1);
DllExport void Delete (int pos, int num=1);
DllExport void RotateStart (int newstart);
DllExport void Flip (); // Reverses order of verts. 0 remains start.
DllExport int VertIndex (int vv);
DllExport void ReplaceVert (int ov, int nv);
DllExport MNMapFace & operator= (const MNMapFace & from);
DllExport MNMapFace & operator= (const MNFace & from);
DllExport bool operator== (const MNMapFace & from);
DllExport void MNDebugPrint ();
};
// MNFace flags:
#define MN_FACE_OPEN_REGION (1<<8) // Face is not part of closed submesh.
#define MN_FACE_CHECKED (1<<9) // for recursive face-and-neighbor-checking
#define MN_FACE_CHANGED (1<<10)
// Diagonal sorting algorithm:
// Puts diagonals in increase-by-last-index, decrease-by-first order:
DllExport void DiagSort (int dnum, int *diag);
class MNFace : public FlagUser {
friend class MNMesh;
int dalloc;
void SwapContents (MNFace & from);
public:
int deg; // Degree: number of vtx's and edg's that are relevant.
int *vtx; // Defining verts of this face.
int *edg; // edges on this face.
int *diag; // Diagonals
DWORD smGroup;
MtlID material;
int track; // Keep track of whatever -- MNMesh internal use only.
BitArray visedg, edgsel;
MNFace() { Init(); }
MNFace (int d) { Init(); SetDeg (d); }
DllExport MNFace (const MNFace *from);
~MNFace () { Clear(); }
DllExport void Init();
DllExport void SetDeg (int d);
DllExport void Clear();
int TriNum() { return deg-2; }
DllExport int FindTriPoint (int edge); // finds point that makes tri with this edge.
DllExport int FindTriPoint (int a, int b); // does the same for nonsequential verts - result is between a,b.
DllExport void GetTriangles (Tab<int> &tri);
DllExport void SetAlloc (int d);
DllExport void MakePoly (int fdeg, int *vv, bool *vis=NULL, bool *sel=NULL);
DllExport void Insert (int pos, int num=1);
DllExport bool Delete (int pos, int num=1, int edir=1, bool fixtri=TRUE);
DllExport void RotateStart (int newstart);
DllExport void Flip (); // Reverses order of verts. 0 remains start.
DllExport int VertIndex (int vv, int ee=-1);
DllExport int EdgeIndex (int ee, int vv=-1);
DllExport void ReplaceVert (int ov, int nv, int ee=-1);
DllExport void ReplaceEdge (int oe, int ne, int vv=-1);
DllExport MNFace & operator= (const MNFace & from);
DllExport bool operator== (const MNFace &from);
int& operator[](int i) { return vtx[i]; }
const int& operator[](int i) const { return vtx[i]; }
DllExport void MNDebugPrint (bool triprint=FALSE);
DllExport IOResult Save (ISave *isave);
DllExport IOResult Load (ILoad *iload);
};
class MNMap : public FlagUser {
friend class MNMesh;
int nv_alloc, nf_alloc;
public:
MNMapFace *f;
UVVert *v;
int numv, numf;
MNMap () { Init(); }
~MNMap () { ClearAndFree (); }
// Initialization, allocation:
DllExport void Init ();
DllExport void VAlloc (int num, bool keep=TRUE);
DllExport void FAlloc (int num, bool keep=TRUE);
// Data access:
int VNum () const { return numv; }
UVVert V(int i) const { return v[i]; }
int FNum () const { return numf; }
MNMapFace *F(int i) const { return &(f[i]); }
// Adding new components -- all allocation should go through here!
DllExport int NewTri (int a, int b, int c);
DllExport int NewTri (int *vv);
DllExport int NewQuad (int a, int b, int c, int d);
DllExport int NewQuad (int *vv);
DllExport int NewFace (int degg=0, int *vv=NULL);
DllExport void setNumFaces (int nfnum);
DllExport int NewVert (UVVert p, int uoff=0, int voff=0);
DllExport void setNumVerts (int nvnum);
DllExport void CollapseDeadVerts (MNFace *faces); // Figures out which are dead.
DllExport void CollapseDeadFaces (MNFace *faces);
DllExport void Clear (); // Deletes everything.
DllExport void ClearAndFree (); // Deletes everything, frees all memory
DllExport void Transform (Matrix3 & xfm); // o(n) -- transforms verts
// operators and debug printing
DllExport MNMap & operator= (const MNMap & from);
DllExport MNMap & operator+= (const MNMap & from);
DllExport MNMap & operator+= (const MNMesh & from);
DllExport void ShallowCopy (const MNMap & from);
DllExport void NewAndCopy ();
DllExport void MNDebugPrint (MNFace *faces);
DllExport bool CheckAllData (int mp, int nf, MNFace *faces);
DllExport IOResult Save (ISave *isave, MNFace *faces=NULL);
DllExport IOResult Load (ILoad *iload, MNFace *faces=NULL);
};
// Per-edge data
#define MAX_EDGEDATA 10
#define EDATA_KNOT 0
#define EDATA_CREASE 1
DllExport int EdgeDataType (int edID);
DllExport void *EdgeDataDefault (int edID);
#define MN_MESH_NONTRI (1<<0) // At least 2 triangles have been joined
#define MN_MESH_FILLED_IN (1<<1) // All topological links complete
#define MN_MESH_RATSNEST (1<<2) // Set if we've replicated points to avoid rats' nest meshes.
#define MN_MESH_NO_BAD_VERTS (1<<3) // Set if we've established that each vert has exactly one connected component of faces & edges.
#define MN_MESH_VERTS_ORDERED (1<<4) // Set if we've ordered the fac, edg tables in each vert.
#define MN_MESH_HAS_VOLUME (1<<7) // Some subset of mesh describes closed surface of solid
#define MN_MESH_CACHE_FLAGS (MN_MESH_FILLED_IN|MN_MESH_NO_BAD_VERTS|MN_MESH_VERTS_ORDERED)
class MNMeshBorder;
class MNChamferData;
class MNFaceClusters;
// MNMesh selection levels:
enum PMeshSelLevel { MNM_SL_OBJECT, MNM_SL_VERTEX, MNM_SL_EDGE, MNM_SL_FACE };
// MNMesh display flags
#define MNDISP_VERTTICKS 0x01
#define MNDISP_SELVERTS 0x02
#define MNDISP_SELFACES 0x04
#define MNDISP_SELEDGES 0x08
#define MNDISP_NORMALS 0x10
#define MNDISP_SMOOTH_SUBSEL 0x20
#define MNDISP_BEEN_DISP 0x40
#define MNDISP_DIAGONALS 0x80
// Flags for sub object hit test
// NOTE: these are the same bits used for object level.
//#define SUBHIT_SELONLY (1<<0)
//#define SUBHIT_UNSELONLY (1<<2)
//#define SUBHIT_ABORTONHIT (1<<3)
//#define SUBHIT_SELSOLID (1<<4)
#define SUBHIT_MNUSECURRENTSEL (1<<22) // When this bit is set, the sel only and unsel only tests will use the current level (edge or face) selection when doing a vertex level hit test
#define SUBHIT_OPENONLY (1<<23)
#define SUBHIT_MNVERTS (1<<24)
#define SUBHIT_MNFACES (1<<25)
#define SUBHIT_MNEDGES (1<<26)
#define SUBHIT_MNTYPEMASK (SUBHIT_MNVERTS|SUBHIT_MNFACES|SUBHIT_MNEDGES)
// Subdivision flags:
#define MN_SUBDIV_NEWMAP 0x01
class MNMesh : public FlagUser, public BaseInterfaceServer {
friend class HardwareMNMesh;
friend void gfxCleanup(void *data);
private:
static int refCount;
static HANDLE workMutex;
static HANDLE workEndEvent;
int nv_alloc, ne_alloc, nf_alloc, nm_alloc;
// Cache geometric data for quick rendering
Box3 bdgBox;
Point3 *fnorm;
RVertex *rVerts; // <<< instance specific.
GraphicsWindow *cacheGW; // identifies rVerts cache
int normalsBuilt;
float norScale;
// Hidden map channels
// There are always NUM_HIDDENMAPS of these, but we dynamically allocate them
// so that M(mp) can be a const method. (This wouldn't work if we had hmap[NUM_HIDDENMAPS].)
MNMap *hmap;
// Formerly public normal map channels:
MNMap *m;
// Vertex color arrays - for display use.
int curVCChan; // current map channel to use for colors (default = 0)
UVVert *curVCVerts; // possible external color array (default = NULL)
MNMapFace *curVCFaces; // possible external face array (default = NULL)
DWTab norInd; // indirection array for fast normal lookup
int normalCount; // total number of normals
Point3 * gfxNormals; // flattened list of normals
// Derived arrays to contain generated texture coordinates
int numTexCoords[GFX_MAX_TEXTURES];
Point3 * texCoords[GFX_MAX_TEXTURES];
// Derived table of TriStrips, depends on topology
Tab<TriStrip *> *tstab;
// Internal part of SabinDoo method:
void SDVEdgeFace (int id, int vid, int *fv, Tab<Tab<int> *> & fmv, int selLevel);
// Internal part of recursive smoothing-group search.
DWORD FindReplacementSmGroup (int ff, DWORD os, int call);
// Internal parts of Boolean. (MNBool.cpp)
int BooleanZip (DWORD sortFlag, float weldThresh);
bool BoolZipSeam (Tab<int> *lpi, Tab<int> *lpj, int & starth, int & startk, float weldThresh);
void BoolPaintClassification (int ff, DWORD classification);
// Internal data cache stuff (MNPipe.cpp)
void buildBoundingBox ();
void buildFaceNormals ();
GraphicsWindow *getCacheGW() { return cacheGW; }
void setCacheGW (GraphicsWindow *gw) { cacheGW = gw; }
// New MNMesh routines to drive HardwareShaders
bool CanDrawTriStrips(DWORD rndMode, int numMtls, Material *mtl);
bool BuildTriStrips(DWORD rndMode, int numMtls, Material *mtl);
void TriStripify(DWORD rndMode, int numTex, TVFace *tvf[], TriStrip *s, StripData *sd, int vtx);
void Draw3DTriStrips(IHardwareShader *phs, int numMat, Material *ma);
void Draw3DWireTriStrips(IHardwareShader *phs, int numMat, Material *ma);
void Draw3DVisEdgeList(IHardwareShader *phs, DWORD flags);
int render3DTriStrips(IHardwareShader *phs, int kmat, int kstrips);
int render3DWireTriStrips(IHardwareShader *phs, int kmat, int kstrips);
int render3DFaces(IHardwareShader *phs, DWORD index, int *custVis=NULL);
public:
MNVert *v;
MNEdge *e;
MNFace *f;
int numv, nume, numf, numm;
// Vertex Data -- handled as in Meshes:
PerData *vd;
BitArray vdSupport;
// Edge Data
PerData *ed;
BitArray edSupport;
int selLevel;
DWORD dispFlags;
// Derived data:
Tab<int> *vedg;
Tab<int> *vfac;
// Basic class ops
MNMesh () { Init(); DefaultFlags (); }
MNMesh (const Mesh & from) { Init(); SetFromTri (from); FillInMesh (); }
MNMesh (const MNMesh & from) { Init(); DefaultFlags(); *this = from; }
DllExport ~MNMesh();
// Initialization:
void DefaultFlags () { ClearAllFlags (); }
DllExport void Init ();
// Array allocation: these functions (& Init) have sole control over nvalloc, etc.
DllExport void VAlloc (int num, bool keep=TRUE);
DllExport void VShrink (int num=-1); // default means "Shrink array allocation to numv"
DllExport void freeVEdge();
DllExport void VEdgeAlloc();
DllExport void freeVFace();
DllExport void VFaceAlloc();
DllExport void EAlloc (int num, bool keep=TRUE);
DllExport void EShrink (int num=-1);
DllExport void FAlloc (int num, bool keep=TRUE);
DllExport void FShrink (int num=-1);
DllExport void MAlloc (int num, bool keep=TRUE);
DllExport void MShrink (int num=-1);
// Access to components
int VNum () const { return numv; }
MNVert *V(int i) const { return &(v[i]); }
Point3 & P(int i) const { return v[i].p; }
int ENum () const { return nume; }
MNEdge *E(int i) const { return &(e[i]); }
int FNum () const { return numf; }
MNFace *F(int i) const { return &(f[i]); }
int MNum () const { return numm; }
DllExport MNMap *M(int mp) const;
DllExport void SetMapNum (int mpnum);
DllExport void InitMap (int mp); // Inits to current MNMesh topology.
DllExport void ClearMap (int mp);
DllExport UVVert MV (int mp, int i) const;
DllExport MNMapFace *MF (int mp, int i) const;
DllExport int TriNum () const;
// Per Vertex Data:
DllExport void setNumVData (int ct, BOOL keep=FALSE);
int VDNum () const { return vdSupport.GetSize(); }
DllExport BOOL vDataSupport (int vdChan) const;
DllExport void setVDataSupport (int vdChan, BOOL support=TRUE);
void *vertexData (int vdChan) const { return vDataSupport(vdChan) ? vd[vdChan].data : NULL; }
float *vertexFloat (int vdChan) const { return (float *) vertexData (vdChan); }
DllExport void freeVData (int vdChan);
DllExport void freeAllVData ();
// Two specific vertex data: these VDATA constants are defined in mesh.h
float *getVertexWeights () { return vertexFloat(VDATA_WEIGHT); }
void SupportVertexWeights () { setVDataSupport (VDATA_WEIGHT); }
void freeVertexWeights () { freeVData (VDATA_WEIGHT); }
float *getVSelectionWeights () { return vertexFloat(VDATA_SELECT); }
void SupportVSelectionWeights () { setVDataSupport (VDATA_SELECT); }
void freeVSelectionWeights () { freeVData (VDATA_SELECT); }
// Per Edge Data:
DllExport void setNumEData (int ct, BOOL keep=FALSE);
int EDNum () const { return edSupport.GetSize(); }
DllExport BOOL eDataSupport (int edChan) const;
DllExport void setEDataSupport (int edChan, BOOL support=TRUE);
void *edgeData (int edChan) const { return eDataSupport(edChan) ? ed[edChan].data : NULL; }
float *edgeFloat (int edChan) const { return (float *) edgeData (edChan); }
DllExport void freeEData (int edChan);
DllExport void freeAllEData ();
// One specific edge data: this EDATA constant is defined above
float *getEdgeKnots () { return edgeFloat(EDATA_KNOT); }
void SupportEdgeKnots () { setEDataSupport (EDATA_KNOT); }
void freeEdgeKnots () { freeEData (EDATA_KNOT); }
// Vertex face/edge list methods:
DllExport void VClear (int vv);
DllExport void VInit (int vv);
DllExport int VFaceIndex (int vv, int ff, int ee=-1);
DllExport int VEdgeIndex (int vv, int ee);
void VDeleteEdge (int vv, int ee) { if (vedg) vedg[vv].Delete (VEdgeIndex(vv, ee), 1); }
DllExport void VDeleteFace (int vv, int ff);
DllExport void VReplaceEdge (int vv, int oe, int ne);
DllExport void VReplaceFace (int vv, int of, int nf);
DllExport void CopyVert (int nv, int ov); // copies face & edge too if appropriate
DllExport void MNVDebugPrint (int vv);
// Adding new components -- all allocation should go through here!
DllExport int NewTri (int a, int b, int c, DWORD smG=0, MtlID mt=0);
DllExport int NewTri (int *vv, DWORD smG=0, MtlID mt=0);
DllExport int NewQuad (int a, int b, int c, int d, DWORD smG=0, MtlID mt=0);
DllExport int NewQuad (int *vv, DWORD smG=0, MtlID mt=0);
DllExport int NewFace (int initFace, int degg=0, int *vv=NULL, bool *vis=NULL, bool *sel=NULL);
DllExport int AppendNewFaces (int nfnum);
DllExport void setNumFaces (int nfnum);
DllExport int RegisterEdge (int v1, int v2, int f, int fpos);
DllExport int SimpleNewEdge (int v1, int v2);
DllExport int NewEdge (int v1, int v2, int f, int fpos);
DllExport int AppendNewEdges (int nenum);
DllExport void setNumEdges (int nenum);
DllExport int NewVert (Point3 & p);
DllExport int NewVert (Point3 & p, int vid);
DllExport int NewVert (int vid);
DllExport int NewVert (int v1, int v2, float prop);
DllExport int AppendNewVerts (int nvnum);
DllExport void setNumVerts (int nvnum);
// To delete, set MN_*_DEAD flag and use following routines, which are all o(n).
DllExport void CollapseDeadVerts ();
DllExport void CollapseDeadEdges ();
DllExport void CollapseDeadFaces ();
DllExport void CollapseDeadStructs();
DllExport void Clear (); // Deletes everything.
DllExport void ClearAndFree (); // Deletes everything, frees all memory
DllExport void freeVerts();
DllExport void freeEdges();
DllExport void freeFaces();
DllExport void freeMap(int mp);
DllExport void freeMaps();
// En Masse flag-clearing and setting:
void ClearVFlags (DWORD fl) { for (int i=0; i<numv; i++) v[i].ClearFlag (fl); }
void ClearEFlags (DWORD fl) { for (int i=0; i<nume; i++) e[i].ClearFlag (fl); }
void ClearFFlags (DWORD fl) { for (int i=0; i<numf; i++) f[i].ClearFlag (fl); }
DllExport void PaintFaceFlag (int ff, DWORD fl, DWORD fenceflags=0x0);
DllExport void VertexSelect (const BitArray & vsel);
DllExport void EdgeSelect (const BitArray & esel);
DllExport void FaceSelect (const BitArray & fsel);
bool getVertexSel (BitArray & vsel) { return getVerticesByFlag (vsel, MN_SEL); }
bool getEdgeSel (BitArray & esel) { return getEdgesByFlag (esel, MN_SEL); }
bool getFaceSel (BitArray & fsel) { return getFacesByFlag (fsel, MN_SEL); }
// In following 3, if fmask is 0 it's set to flags, so only those flags are compared.
DllExport bool getVerticesByFlag (BitArray & vset, DWORD flags, DWORD fmask=0x0);
DllExport bool getEdgesByFlag (BitArray & eset, DWORD flags, DWORD fmask=0x0);
DllExport bool getFacesByFlag (BitArray & fset, DWORD flags, DWORD fmask=0x0);
DllExport void ElementFromFace (int ff, BitArray & fset);
DllExport void BorderFromEdge (int ee, BitArray & eset);
// Following also set visedg, edgsel bits on faces:
DllExport void SetEdgeVis (int ee, BOOL vis=TRUE);
DllExport void SetEdgeSel (int ee, BOOL sel=TRUE);
// I/O with regular Meshes.
void SetFromTri (const Mesh & from) { Clear (); AddTri (from); }
DllExport void AddTri (const Mesh & from); // o(n) -- Add another mesh -- simple union
DllExport void OutToTri (Mesh & tmesh); // o(n)
// Internal computation routines
// These three build on each other and should go in order:
// FillInMesh, EliminateBadVerts, OrderVerts.
DllExport void FillInMesh (); // o(n*5) or so
DllExport void FillInFaceEdges (); // o(n).
DllExport void FillInVertEdgesFaces (); // o(n)
DllExport bool EliminateBadVerts (DWORD flag=0); // o(n*8) or so
DllExport void OrderVerts (); // o(n*3) or so
DllExport void OrderVert (int vid);
DllExport void Triangulate (); // o(n)
DllExport void TriangulateFace (int ff); // o(triangles)
// Random useful stuff.
DllExport void Transform (Matrix3 & xfm); // o(n) -- transforms verts
bool IsClosed() { for (int i=0; i<nume; i++) if (e[i].f2<0) return FALSE; return nume?TRUE:FALSE; } // o(n)
DllExport void FaceBBox (int ff, Box3 & bbox);
DllExport void BBox (Box3 & bbox, bool targonly=FALSE);
DllExport Box3 getBoundingBox (Matrix3 *tm=NULL, bool targonly=FALSE);
// Methods for handling MN_TARG flags.
DllExport int TargetVertsBySelection (int selLevel); // o(n)
DllExport int TargetEdgesBySelection (int selLevel); // o(n)
DllExport int TargetFacesBySelection (int selLevel); // o(n)
DllExport int PropegateComponentFlags (int slTo, DWORD flTo,
int slFrom, DWORD flFrom, bool ampersand=FALSE, bool set=TRUE);
DllExport void DetargetVertsBySharpness (float sharpval); // o(n*deg)
// Face-center methods
DllExport void ComputeCenters (Point3 *ctr, bool targonly=FALSE); // o(n)
DllExport void ComputeCenter (int ff, Point3 & ctr);
DllExport void ComputeNormal (int ff, Point3 & normal, Point3 *ctr=NULL);
DllExport void ComputeSafeCenters (Point3 *ctr, bool targonly=FALSE, bool detarg=FALSE); // o(n)
DllExport bool ComputeSafeCenter (int ff, Point3 & ctr); // o(deg^2)
// Triangulation-of-polygon methods:
DllExport void RetriangulateFace (int ff); // o(deg^2)
DllExport void FindDiagonals (int ff, int *diag);
DllExport void FindDiagonals (int deg, int *vv, int *diag);
DllExport void BestConvexDiagonals (int ff, int *diag=NULL);
DllExport void BestConvexDiagonals (int deg, int *vv, int *diag);
DllExport bool SetDiagonal (int ff, int d1, int d2);
// Normal methods
DllExport int FindEdgeFromVertToVert (int vrt1, int vrt2); // o(deg)
DllExport void GetVertexSpace (int vrt, Matrix3 & tm); // o(deg)
DllExport Point3 GetVertexNormal (int vrt); // o(deg)
DllExport Point3 GetEdgeNormal (int ed); // o(deg)
DllExport Point3 GetFaceNormal (int fc, bool nrmlz=FALSE); //o(deg)
Point3 GetEdgeNormal (int vrt1, int vrt2) { return GetEdgeNormal (FindEdgeFromVertToVert(vrt1, vrt2)); }
DllExport float EdgeAngle (int ed);
DllExport void FlipNormal(int faceIndex);
// Smoothing-group handling
DllExport void Resmooth (bool smooth=TRUE, bool targonly=FALSE, DWORD targmask=~0x0); // o(n)
DllExport DWORD CommonSmoothing (bool targonly=FALSE); // o(n)
DllExport DWORD GetNewSmGroup (bool targonly=FALSE); // o(n)
DllExport MtlID GetNewMtlID (bool targonly = FALSE); // o(n)
DllExport DWORD GetOldSmGroup (bool targonly=FALSE); // up to o(n).
DllExport DWORD GetAllSmGroups (bool targonly=FALSE); // up to o(n)
DllExport DWORD FindReplacementSmGroup (int ff, DWORD os);
DllExport void PaintNewSmGroup (int ff, DWORD os, DWORD ns);
DllExport bool SeparateSmGroups (int v1, int v2);
DllExport void AutoSmooth(float angle,BOOL useSel,BOOL preventIndirectSmoothing);
// Use following to unify triangles into polygons across invisible edges.
DllExport void MakePolyMesh (int maxdeg=0, BOOL elimCollin=TRUE);
// NOTE: MakeConvexPolyMesh result not guaranteed for now. Still requires MakeConvex() afterwards to be sure.
DllExport void MakeConvexPolyMesh (int maxdeg=0);
DllExport void RemoveEdge (int edge);
DllExport void MakeConvex ();
DllExport void MakeFaceConvex (int ff);
DllExport void RestrictPolySize (int maxdeg);
DllExport void MakePlanar (float planarThresh);
DllExport void MakeFacePlanar (int ff, float planarThresh);
DllExport void EliminateCollinearVerts ();
DllExport void EliminateCoincidentVerts (float thresh=MNEPS);
// Following set NOCROSS flags, delete INVIS flags to make "fences" for Sabin-Doo
DllExport void FenceMaterials ();
DllExport void FenceSmGroups ();
DllExport void FenceFaceSel ();
DllExport void FenceOneSidedEdges();
DllExport void FenceNonPlanarEdges (float thresh=.9999f, bool makevis=FALSE);
DllExport void SetMapSeamFlags ();
DllExport void SetMapSeamFlags (int mp);
// Find get detail about a point on a face.
DllExport int FindFacePointTri (int ff, Point3 & pt, double *bary, int *tri);
DllExport UVVert FindFacePointMapValue (int ff, Point3 & pt, int mp);
// Extrapolate map information about a point near a face.
DllExport UVVert ExtrapolateMapValue (int face, int edge, Point3 & pt, int mp);
// Useful for tessellation algorithms
DllExport void Relax (float relaxval, bool targonly=TRUE);
// Returns map verts for both ends of each edge (from f1's perspective)
// (Very useful for creating new faces at borders.) mv[j*2] corresponds to edge j's v1.
DllExport void FindEdgeListMapVerts (const Tab<int> & lp, Tab<int> & mv, int mp);
// Following functions can be used to find & fix holes in a mesh, if any.
DllExport void GetBorder (MNMeshBorder & brd, int selLevel=MNM_SL_OBJECT, DWORD targetFlag=MN_SEL);
DllExport void FillInBorders (MNMeshBorder *b=NULL);
DllExport void FindOpenRegions ();
// Doubled mapping verts are individual map vertices that are used to correspond
// to different regular vertices. For instance, a box could have a single (1,1,0)
// vertex that it uses in the upper-right corner of all quads. This design is
// harmful to some of our algorithms, such as the various Tessellators. So the
// following two methods detect and fix such vertices.
// This method is not really appropriate for release, it's more of a debugging
// tool. All doubled mapping verts will be DebugPrinted.
DllExport BOOL CheckForDoubledMappingVerts();
// This one's ok and encouraged for release. (Linear-time algorithm.)
DllExport void EliminateDoubledMappingVerts();
DllExport void EliminateIsoMapVerts();
DllExport void EliminateIsoMapVerts(int mp);
// operators and debug printing (MNFace.cpp)
DllExport MNMesh & operator= (const MNMesh & from);
DllExport MNMesh & operator+= (const MNMesh & from);
DllExport void MNDebugPrint (bool triprint=FALSE);
DllExport void MNDebugPrintVertexNeighborhood (int vv, bool triprint=FALSE);
DllExport bool CheckAllData ();
// Split functions maintain topological info. (MNSplit.cpp)
DllExport int SplitTriEdge (int ee, float prop=.5f, float thresh=MNEPS,
bool neVis=TRUE, bool neSel=FALSE);
DllExport int SplitTriFace (int ff, double *bary=NULL, float thresh=MNEPS,
bool neVis=TRUE, bool neSel=FALSE);
DllExport void SplitTri6 (int ff, double *bary=NULL, int *nv=NULL);
DllExport int SplitEdge (int ee, float prop=.5f);
DllExport int SplitEdge (int ee, float prop, Tab<int> *newTVerts);
DllExport int SplitEdge (int ff, int ed, float prop, bool right, int *nf=NULL,
int *ne=NULL, bool neVis=FALSE, bool neSel=FALSE, bool allconvex=FALSE);
DllExport int IndentFace (int ff, int ei, int nv, int *ne=NULL, bool nevis=TRUE, bool nesel=FALSE);
DllExport void SeparateFace (int ff, int a, int b, int & nf, int & ne, bool neVis=FALSE, bool neSel=FALSE);
DllExport bool Slice (Point3 & N, float off, float thresh, bool split, bool remove, bool flaggedFacesOnly=false, DWORD faceFlags=MN_SEL);
DllExport void DeleteFlaggedFaces (DWORD deathflags, DWORD nvCopyFlags=0x0);
DllExport bool WeldVerts (int a, int b);
DllExport bool WeldEdge (int ee);
// Tessellation methods: (MNTess.cpp)
DllExport void TessellateByEdges (float bulge, MeshOpProgress *mop=NULL);
DllExport bool AndersonDo (float interp, int selLevel, MeshOpProgress *mop=NULL, DWORD subdivFlags=0);
DllExport void TessellateByCenters (MeshOpProgress *mop=NULL);
// Sabin-Doo tessellation: (MNSabDoo.cpp)
DllExport void SabinDoo (float interp, int selLevel, MeshOpProgress *mop=NULL, Tab<Point3> *offsets=NULL);
DllExport void SabinDooVert (int vid, float interp, int selLevel, Point3 *ctr, Tab<Point3> *offsets=NULL);
// Non-uniform Rational Mesh Smooth (NURMS.cpp)
DllExport void CubicNURMS (MeshOpProgress *mop=NULL,
Tab<Point3> *offsets=NULL, DWORD subdivFlags=0);
// Boolean functions: (MNBool.cpp)
DllExport void PrepForBoolean ();
DllExport bool BooleanCut (MNMesh & m2, int cutType, int fstart=0, MeshOpProgress *mop=NULL);
DllExport bool MakeBoolean (MNMesh & m1, MNMesh & m2, int type, MeshOpProgress *mop=NULL);
DllExport void Connect (MNMeshBorder & borderList, int segs, float tension,
bool sm_bridge, bool sm_ends, Tab<int> *vsep=NULL);
DllExport void ConnectLoops (Tab<int> & loop1, Tab<int> & loop2,
int segs, float tension, DWORD smGroup, MtlID mat, bool sm_ends);
// Small-scale Operations - in MNOps.cpp
DllExport void FacePointBary (int ff, Point3 & p, Tab<float> & bary);
DllExport void CloneVerts (DWORD cloneFlag = MN_SEL, bool clear_orig=TRUE);
DllExport void CloneFaces (DWORD cloneFlag = MN_SEL, bool clear_orig=TRUE);
DllExport int DivideFace (int ff, Tab<float> & bary);
DllExport int CreateFace (int degg, int *vv);
DllExport bool MakeFlaggedPlanar (int selLev, DWORD flag=MN_SEL, Point3 *delta=NULL);
DllExport bool MoveVertsToPlane (Point3 & norm, float offset, DWORD flag=MN_SEL, Point3 *delta=NULL);
DllExport bool SplitFlaggedVertices (DWORD flag=MN_SEL);
DllExport bool SplitFlaggedEdges (DWORD flag=MN_SEL);
DllExport bool DetachFaces (DWORD flag=MN_SEL);
DllExport bool DetachElementToObject (MNMesh & nmesh, DWORD fflags=MN_SEL, bool delDetached=true);
DllExport bool ExtrudeFaceClusters (MNFaceClusters & fclust);
DllExport bool ExtrudeFaceCluster (MNFaceClusters & fclust, int cl);
DllExport bool ExtrudeFaces (DWORD flag=MN_SEL); // Does each face separately
// GetExtrudeDirection is based on faces with MN_SEL flag if face clusters are NULL.
DllExport void GetExtrudeDirection (MNChamferData *mcd,
MNFaceClusters *fclust=NULL, Point3 *clustNormals=NULL);
DllExport bool SetVertColor (UVVert clr, int mp, DWORD flag=MN_SEL);
DllExport bool SetFaceColor (UVVert clr, int mp, DWORD flag=MN_SEL);
DllExport bool ChamferVertices (DWORD flag=MN_SEL, MNChamferData *mcd=NULL);
DllExport bool ChamferEdges (DWORD flag=MN_SEL, MNChamferData *mcd=NULL);
DllExport bool FlipElementNormals (DWORD flag=MN_SEL);
DllExport void SmoothByCreases (DWORD creaseFlag);
DllExport int CutFace (int f1, Point3 & p1, Point3 & p2, Point3 & Z, bool split);
DllExport int CutEdge (int e1, float prop1, int e2, float prop2, Point3 & Z, bool split);
DllExport int Cut (int startv, Point3 & end, Point3 & Z, bool split);
DllExport bool WeldBorderVerts (int v1, int v2, Point3 *destination);
DllExport bool WeldBorderEdges (int e1, int e2);
DllExport bool WeldBorderVerts (float thresh, DWORD flag=MN_SEL);
// Pipeline object requirements. (MNPipe.cpp)
DllExport void ApplyMapper (UVWMapper & mp, int channel=0, BOOL useSel=FALSE);
DllExport void InvalidateGeomCache ();
DllExport void InvalidateTopoCache ();
DllExport void UpdateDisplayVertexColors ();
DllExport void SetDisplayVertexColors (int chan);
DllExport void SetDisplayVertexColors (UVVert *mv, MNMapFace *mf);
DllExport void PrepForPipeline ();
DllExport void allocRVerts ();
DllExport void updateRVerts (GraphicsWindow *gw);
DllExport void freeRVerts ();
DllExport void checkNormals (BOOL illum);
DllExport void buildNormals ();
DllExport void buildRenderNormals ();
DllExport void UpdateBackfacing (GraphicsWindow *gw, bool force);
// Display flags
void SetDispFlag(DWORD f) { dispFlags |= f; }
DWORD GetDispFlag(DWORD f) { return dispFlags & f; }
void ClearDispFlag(DWORD f) { dispFlags &= ~f; }
DllExport void render(GraphicsWindow *gw, Material *ma, RECT *rp, int compFlags, int numMat=1, InterfaceServer *pi=NULL);
DllExport void renderFace (GraphicsWindow *gw, int ff);
DllExport void render3DFace (GraphicsWindow *gw, int ff);
DllExport void render3DDiagonals (GraphicsWindow *gw, DWORD compFlags);
DllExport void renderDiagonals (GraphicsWindow *gw, DWORD compFlags);
DllExport void renderDiagonal (GraphicsWindow *gw, int ff, bool useSegments=false, bool *lastColorSubSel=NULL);
DllExport void render3DEdges (GraphicsWindow *gw, DWORD compFlags);
DllExport void renderEdges (GraphicsWindow *gw, DWORD compFlags);
DllExport void renderEdge (GraphicsWindow *gw, int ee, bool useSegments=false, bool *lastColorSubSel=NULL);
DllExport BOOL select (GraphicsWindow *gw, Material *ma, HitRegion *hr, int abortOnHit=FALSE, int numMat=1);
DllExport BOOL SubObjectHitTest(GraphicsWindow *gw, Material *ma, HitRegion *hr,
DWORD flags, SubObjHitList& hitList, int numMat=1 );
DllExport int IntersectRay (Ray& ray, float& at, Point3& norm);
DllExport int IntersectRay (Ray& ray, float& at, Point3& norm, int &fi, Tab<float> & bary);
DllExport BitArray VertexTempSel (DWORD fmask=MN_DEAD|MN_SEL, DWORD fset=MN_SEL);
DllExport void ShallowCopy(MNMesh *amesh, ULONG_PTR channels);
// WIN64 Cleanup: Shuler
DllExport void NewAndCopyChannels(ULONG_PTR channels);
// WIN64 Cleanup: Shuler
DllExport void FreeChannels (ULONG_PTR channels, BOOL zeroOthers=1);
// WIN64 Cleanup: Shuler
DllExport IOResult Save (ISave *isave);
DllExport IOResult Load (ILoad *iload);
DllExport void ClearFlag (DWORD fl);
// --- from InterfaceServer
DllExport BaseInterface* GetInterface(Interface_ID id);
};
class MNMeshBorder {
friend class MNMesh;
Tab<Tab<int> *> bdr;
BitArray btarg;
public:
~MNMeshBorder () { Clear(); }
void Clear () { for (int i=0; i<bdr.Count(); i++) if (bdr[i]) delete bdr[i]; bdr.ZeroCount(); }
int Num () { return bdr.Count(); }
Tab<int> *Loop (int i) { return bdr[i]; }
bool LoopTarg (int i) { return ((i>=0) && (i<bdr.Count()) && (btarg[i])); }
DllExport void MNDebugPrint (MNMesh *m);
};
class MNFaceElement {
public:
// For each face, which element is it in
Tab<int> elem;
int count;
DllExport MNFaceElement (MNMesh &mesh);
int operator[](int i) {return elem[i];}
};
class MNFaceClusters {
public:
// Cluster #, one for each face - non-selected faces have -1 for their id.
Tab<int> clust;
int count;
// Makes clusters from distinct selected components.
DllExport MNFaceClusters (MNMesh & mesh, DWORD clusterFlags);
// This version separates cluster also using a minimum angle and optionally by flags.
DllExport MNFaceClusters (MNMesh & mesh, float angle, DWORD clusterFlags);
int operator[](int i) { return clust[i]; }
DllExport void MakeVertCluster(MNMesh &mesh, Tab<int> & vclust);
DllExport void GetNormalsCenters (MNMesh &mesh, Tab<Point3> & norm, Tab<Point3> & ctr);
DllExport void GetBorder (MNMesh &mesh, int clustID, Tab<int> & cbord);
DllExport void GetOutlineVectors (MNMesh & m, Tab<Point3> & cnorms, Tab<Point3> & odir);
};
class MNEdgeClusters {
public:
Tab<int> clust;
int count;
DllExport MNEdgeClusters (MNMesh &mesh, DWORD clusterFlags);
int operator[](int i) {return clust[i];}
DllExport void MakeVertCluster (MNMesh &mesh, Tab<int> & vclust);
DllExport void GetNormalsCenters (MNMesh &mesh, Tab<Point3> & norm, Tab<Point3> & ctr);
};
class MNChamferData {
Tab<UVVert> hmdir[NUM_HIDDENMAPS];
public:
Tab<Point3> vdir;
Tab<float> vmax;
Tab<UVVert> *mdir;
MNChamferData () { mdir=NULL; }
MNChamferData (const MNMesh & m) { mdir=NULL; InitToMesh(m); }
~MNChamferData () { if (mdir) delete [] mdir; }
DllExport void InitToMesh (const MNMesh & m);
DllExport void setNumVerts (int nv, bool keep=TRUE, int resizer=0);
DllExport void ClearLimits ();
DllExport void GetDelta (float amount, Tab<Point3> & delta);
DllExport bool GetMapDelta (MNMesh & mm, int mapChannel, float amount, Tab<UVVert> & delta);
Tab<UVVert> & MDir (int mp) { return (mp<0) ? hmdir[-1-mp] : mdir[mp]; }
};
class MNTempData : public BaseInterfaceServer {
private:
MNEdgeClusters *edgeCluster;
MNFaceClusters *faceCluster;
Tab<int> *vertCluster;
Tab<Point3> *normals;
Tab<Point3> *centers;
Tab<Point3> *vnormals;
Tab<Tab<float> *> *clustDist;
Tab<float> *selDist;
Tab<float> *vsWeight;
MNChamferData *chamData;
//Tab<Point3> *extDir;
Tab<Point3> *outlineDir;
MNMesh *mesh;
public:
DllExport MNTempData ();
DllExport MNTempData (MNMesh *m);
DllExport ~MNTempData ();
void SetMesh (MNMesh *m) { mesh = m; }
DllExport MNFaceClusters *FaceClusters (DWORD clusterFlags=MN_SEL);
DllExport MNEdgeClusters *EdgeClusters (DWORD clusterFlags=MN_SEL);
DllExport Tab<int> *VertexClusters (int sl, DWORD clusterFlags=MN_SEL);
DllExport Tab<Point3> *ClusterNormals (int sl, DWORD clusterFlags=MN_SEL);
DllExport Tab<Point3> *ClusterCenters (int sl, DWORD clusterFlags=MN_SEL);
DllExport Matrix3 ClusterTM (int clust);
DllExport Tab<Point3> *VertexNormals ();
DllExport Tab<float> *VSWeight (BOOL useEdgeDist, int edgeIts,
BOOL ignoreBack, float falloff, float pinch, float bubble,
DWORD selFlags=MN_SEL);
DllExport Tab<float> *SelectionDist (BOOL useEdgeDist, int edgeIts, DWORD selFlags=MN_SEL);
DllExport Tab<float> *ClusterDist (int sl, DWORD clusterFlags, int clustId, BOOL useEdgeDist, int edgeIts);
//DllExport Tab<Point3> *FaceExtDir (int extrusionType);
DllExport Tab<Point3> *OutlineDir (int extrusionType, DWORD clusterFlags=MN_SEL);
DllExport MNChamferData *ChamferData();
DllExport void Invalidate (DWORD part);
DllExport void InvalidateDistances ();
DllExport void InvalidateSoftSelection ();
DllExport void freeClusterDist ();
DllExport void freeBevelInfo ();
DllExport void freeChamferData();
DllExport void freeAll ();
};
DllExport void SelectionDistance (MNMesh & mesh, float *selDist, DWORD selFlags);
DllExport void SelectionDistance (MNMesh & mesh, float *selDist, int iters, DWORD selFlags);
DllExport void ClustDistances (MNMesh & mesh, int numClusts, int *vclust,
Tab<float> **clustDist);
DllExport void ClustDistances (MNMesh & mesh, int numClusts, int *vclust,
Tab<float> **clustDist, int iters);
#endif

BIN
lib/maxsdk40/ManipSys.lib Executable file

Binary file not shown.

541
lib/maxsdk40/Manipulator.h Executable file
View File

@ -0,0 +1,541 @@
/**********************************************************************
*<
FILE: Manipulator.h
DESCRIPTION: Defines Manipulator clasess
CREATED BY: Scott Morrison
HISTORY: created 18 October 1999
*> Copyright (c) 1999, All Rights Reserved.
**********************************************************************/
#pragma once
#ifdef MANIPSYS_IMP
#define ManipExport __declspec(dllexport)
#else
#define ManipExport __declspec(dllimport)
#endif
#include "iparamb2.h"
#include "iFnPub.h"
// Helper geometry classes
enum DisplayState { kNoRedrawNeeded, kFullRedrawNeeded, kPostRedrawNeeded };
#define MANIP_PLANE_INTERFACE Interface_ID(0x44460ea4, 0xbf73be6)
class Plane : public FPMixinInterface {
public:
ManipExport Plane(Point3& normal, Point3& point);
ManipExport Plane(Point3& p1, Point3& p2, Point3& p3);
ManipExport Plane(): mNormal(0,0,1), mPoint(0,0,0), mD(0.0f) {}
ManipExport bool Intersect(Ray& ray, Point3& intersectionPoint);
ManipExport Point3& GetNormal() { return mNormal; }
ManipExport Point3& GetPoint() { return mPoint; }
ManipExport float GetPlaneConstant() { return mD; }
ManipExport Plane& MostOrthogonal(Ray& viewDir, Plane& plane);
ManipExport static Plane msXYPlane;
ManipExport static Plane msXZPlane;
ManipExport static Plane msYZPlane;
// Function IDs
enum { intersect, mostOrthogonal, getNormal, getPoint, getPlaneConstant, };
// Function Map
BEGIN_FUNCTION_MAP
FN_2(intersect, TYPE_BOOL, Intersect, TYPE_RAY_BV, TYPE_POINT3_BR);
FN_2(mostOrthogonal, TYPE_INTERFACE, FPMostOrthogonal, TYPE_RAY_BV, TYPE_INTERFACE);
RO_PROP_FN(getNormal, GetNormal, TYPE_POINT3_BV);
RO_PROP_FN(getPoint, GetPoint, TYPE_POINT3_BV);
RO_PROP_FN(getPlaneConstant, GetPlaneConstant, TYPE_FLOAT);
END_FUNCTION_MAP
// FP interface type-converter wrappers
ManipExport Plane* FPMostOrthogonal(Ray& viewRay, FPInterface* plane);
ManipExport FPInterfaceDesc* GetDesc();
private:
Point3 mNormal; // Plane normal vector
Point3 mPoint; // Point that the plane passes through
float mD; // Plane equation constant
};
#define MANIP_GIZMO_INTERFACE Interface_ID(0x124e3169, 0xf067ad4)
class GizmoShape: public FPMixinInterface {
public:
ManipExport GizmoShape() { mLine.Init(); }
ManipExport void StartNewLine() {
if (mLine.numPts > 0)
mPolyShape.Append(mLine);
mLine.Init();
}
ManipExport void AppendPoint(Point3& p) {
mLine.Append(PolyPt(p));
}
ManipExport PolyShape* GetPolyShape() {
if (mLine.numPts > 0)
mPolyShape.Append(mLine);
mLine.Init();
return &mPolyShape;
}
ManipExport void Transform(Matrix3& tm);
// Function IDs
enum { startNewLine, appendPoint, transform};
// Function Map
BEGIN_FUNCTION_MAP
VFN_0(startNewLine, StartNewLine);
VFN_1(appendPoint, AppendPoint, TYPE_POINT3_BV);
VFN_1(transform, Transform, TYPE_MATRIX3_BV);
END_FUNCTION_MAP
ManipExport FPInterfaceDesc* GetDesc();
private:
PolyShape mPolyShape;
PolyLine mLine;
};
// Manipulator system static FnPub interace
#define MANIP_MGR_INTERFACE Interface_ID(0x2c450aa2, 0x7b9d0365)
class IManipulatorMgr : public FPStaticInterface
{
public:
// stock gizmos
virtual Mesh* MakeSphere(Point3& pos, float radius, int segments)=0;
virtual Mesh* MakeTorus(Point3& pos, float radius, float radius2, int segs, int sides)=0;
virtual Mesh* MakeBox(Point3& pos, float l, float w, float h, int lsegs, int wsegs, int hsegs)=0;
// plane construction
virtual Plane* MakePlane()=0;
virtual Plane* MakePlane(Point3& p1, Point3& p2, Point3& p3)=0;
virtual Plane* MakePlane(Point3& normal, Point3& point)=0;
// constant planes
virtual Plane* GetmsXYPlane()=0;
virtual Plane* GetmsXZPlane()=0;
virtual Plane* GetmsYZPlane()=0;
// PolyShape gizmos
virtual GizmoShape* MakeGizmoShape()=0;
virtual GizmoShape* MakeCircle(Point3& center, float radius, int segments)=0;
// Function IDs
enum { makeSphere, makeTorus, makeBox, makePlane, makePlaneFromPts,
makePlaneFromNormal, getmsXYPlane, getmsXZPlane, getmsYZPlane,
makeGizmoShape, makeCircle, };
};
class ManipHitData;
class Manipulator : public HelperObject
{
public:
ManipExport Manipulator(INode* pINode) { mpINode = pINode; }
BOOL IsManipulator() { return TRUE; }
virtual int HitTest(TimeValue t, INode* pNode, int type, int crossing,
int flags, IPoint2 *pScreenPoint, ViewExp *pVpt) = 0;
virtual int Display(TimeValue t, INode* pNode, ViewExp *pVpt, int flags) = 0;
virtual void GetLocalBoundBox(TimeValue t, INode* inode, ViewExp* vp, Box3& box ) = 0;
// Used for manipulator set manager, which is always active.
ManipExport virtual bool AlwaysActive() { return false; }
virtual TSTR& GetManipName() = 0;
// FIXME these methods should use an FP interface.
virtual DisplayState MouseEntersObject(TimeValue t, ViewExp* pVpt, IPoint2& m, ManipHitData* pHitData)
{return kNoRedrawNeeded; }
virtual DisplayState MouseLeavesObject(TimeValue t, ViewExp* pVpt, IPoint2& m, ManipHitData* pHitData)
{return kNoRedrawNeeded; }
virtual void OnMouseMove(TimeValue t, ViewExp* pVpt, IPoint2& m, DWORD flags, ManipHitData* pHitData) {}
virtual void OnButtonDown(TimeValue t, ViewExp* pVpt, IPoint2& m, DWORD flags, ManipHitData* pHitData) {}
virtual void OnButtonUp(TimeValue t, ViewExp* pVpt, IPoint2& m, DWORD flags, ManipHitData* pHitData) {}
virtual INode* GetINode() { return mpINode; }
virtual void DeleteThis() { delete this; }
protected:
INode* mpINode; // The node being manipulated
};
class ManipHitList;
class ManipulatorGizmo : public BaseInterfaceServer
{
public:
ManipExport ManipulatorGizmo();
ManipExport ManipulatorGizmo(PolyShape* pShape, DWORD flags,
Point3& unselColor,
Point3& selColor = GetSubSelColor());
ManipExport ManipulatorGizmo(Mesh* pMesh, DWORD flags,
Point3& unselColor,
Point3& selColor = GetSubSelColor());
ManipExport ManipulatorGizmo(MarkerType markerType, Point3& position,
DWORD flags,
Point3& unselColor,
Point3& selColor = GetSubSelColor());
ManipExport ManipulatorGizmo(TCHAR* pText, Point3& position,
DWORD flags,
Point3& unselColor,
Point3& selColor = GetSubSelColor());
ManipExport ~ManipulatorGizmo();
ManipExport BOOL HitTest(GraphicsWindow* pGW, HitRegion* pHR, ManipHitList* pHitList,
Matrix3* tm, IPoint2 pScreenPoint, int gizmoIndex);
ManipExport void Render(ViewExp* pVpt, TimeValue t, INode* pNode, int flags, bool selected, BOOL isStandAlone);
ManipExport Box3 GetBoundingBox(INode* pNode, ViewExp* pVpt);
// Gizmo flags
// Don't display this gizmo. It is still hit-tested.
ManipExport static const DWORD kGizmoDontDisplay;
// Don't hit test this gizmo. It is still displayed.
ManipExport static const DWORD kGizmoDontHitTest;
// Scale this gizmo to viewport size, using mGizmoSize as the size in pixels
// Only for mesh and shape gizmos.
ManipExport static const DWORD kGizmoScaleToViewport;
// The coordinates are in normalized screen space. the X and Y values are
// in the range 0.0 to 1.0, and interpreted as percentages of screen space.
// This is only supported for PolyShape, Marker and Text gizmos.
ManipExport static const DWORD kGizmoUseRelativeScreenSpace;
// The coordinates are in screen space.
// This is only supported for PolyShape, Marker and Text gizmos.
ManipExport static const DWORD kGizmoUseScreenSpace;
// Only display the gizmo in the active viewport.
ManipExport static const DWORD kGizmoActiveViewportOnly;
private:
void RenderMesh(ViewExp* pVpt, TimeValue t, INode* pNode, int flags, bool selected, BOOL isStandAlone);
void RenderShape(ViewExp* pVpt, TimeValue t, INode* pNode, int flags, bool selected, BOOL isStandAlone);
void RenderMarker(ViewExp* pVpt, TimeValue t, INode* pNode, int flags, bool selected, BOOL isStandAlone);
void RenderText(ViewExp* pVpt, TimeValue t, INode* pNode, int flags, bool selected, BOOL isStandAlone);
BOOL HitTestShape(GraphicsWindow* pGW, HitRegion* pHR, ManipHitList* pHitList,
Matrix3* tm, IPoint2 pScreenPoint, int gizmoIndex);
BOOL HitTestMesh(GraphicsWindow* pGW, HitRegion* pHR, ManipHitList* pHitList,
Matrix3* tm, IPoint2 pScreenPoint, int gizmoIndex);
BOOL HitTestMarker(GraphicsWindow* pGW, HitRegion* pHR, ManipHitList* pHitList,
Matrix3* tm, IPoint2 pScreenPoint, int gizmoIndex);
BOOL HitTestText(GraphicsWindow* pGW, HitRegion* pHR, ManipHitList* pHitList,
Matrix3* tm, IPoint2 pScreenPoint, int gizmoIndex);
Box3 GetShapeBoundingBox(INode* pNode, ViewExp* pVpt);
Box3 GetMeshBoundingBox(INode* pNode, ViewExp* pVpt);
Point3 GetMarkerBoundingBox(INode* pNode, ViewExp* pVpt);
Box3 GetTextBoundingBox(INode* pNode, ViewExp* pVpt);
void GetScaleFactor(GraphicsWindow* pGW, Point3& scale, Point3& center);
void GetScreenCoords(GraphicsWindow* pGW, Point3& input, int& x, int& y);
BOOL UseScreenSpace() { return mFlags & kGizmoUseRelativeScreenSpace ||
mFlags & kGizmoUseScreenSpace; }
PolyShape* mpShape; // Polyshape gizmo
Mesh* mpMesh; // Mesh gizmo
Point3 mPosition; // Used for markers and text
MarkerType* mpMarkerType; // Used for marker gizmos
TSTR* mpText; // Used for text gizmos
Point3 mUnselColor; // Color of gizmo
Point3 mSelColor; // Color of gizmo when selected
DWORD mFlags; // Display and hit testing flags
// The size of the gizmo in pixels for kGizmoScaleToViewport gizmos.
int mGizmoSize;
};
enum MouseState {
kMouseIdle,
kMouseDragging,
kMouseOverManip,
};
// Manipulator with a built-in ParamBlock2 and many methods implemented
// by default.
// SimpleManipulator also provides support for a table of meshes ,
// poly shapes, markers and text for use as gizmos.
// FnPub interface to SimpleManipulators (for scripted manipulators)
#define SIMPLE_MANIP_INTERFACE Interface_ID(0x617c41d4, 0x6af06a5f)
class ISimpleManipulator : public FPMixinInterface
{
public:
// the published API
virtual void ClearPolyShapes()=0;
virtual void AppendPolyShape(PolyShape* pPolyShape, DWORD flags,
Point3& unselColor,
Point3& selColor = ColorMan()->GetColorAsPoint3(kManipulatorsSelected))=0;
virtual void AppendGizmo(GizmoShape* pGizmoShape, DWORD flags,
Point3& unselColor,
Point3& selColor = ColorMan()->GetColorAsPoint3(kManipulatorsSelected))=0;
virtual void AppendMesh(Mesh* pMesh, DWORD flags,
Point3& unselColor,
Point3& selColor = ColorMan()->GetColorAsPoint3(kManipulatorsSelected))=0;
virtual void AppendMarker(MarkerType markerType, Point3& position,
DWORD flags,
Point3& unselColor,
Point3& selColor = ColorMan()->GetColorAsPoint3(kManipulatorsSelected))=0;
virtual void AppendText(TCHAR* pText, Point3& position,
DWORD flags,
Point3& unselColor,
Point3& selColor = ColorMan()->GetColorAsPoint3(kManipulatorsSelected))=0;
virtual MouseState GetMouseState()=0;
virtual void GetLocalViewRay(ViewExp* pVpt, IPoint2& m, Ray& viewRay)=0;;
virtual void UpdateShapes(TimeValue t, TSTR& toolTip)=0;
virtual void OnMouseMove(TimeValue t, ViewExp* pVpt, IPoint2& m, DWORD flags, ManipHitData* pHitData)=0;
// Function IDs
enum { clearPolyShapes, appendPolyShape, appendMesh, getMouseState, getLocalViewRay,
updateShapes, onMouseMove, appendGizmo, appendMarker, appendText};
// enumeration IDs
enum { mouseState, markerType, };
// Function Map
BEGIN_FUNCTION_MAP
VFN_0(clearPolyShapes, ClearPolyShapes );
VFN_4(appendMesh, FPAppendMesh, TYPE_MESH, TYPE_INT, TYPE_POINT3_BV, TYPE_POINT3_BV);
VFN_4(appendGizmo, FPAppendGizmo, TYPE_INTERFACE, TYPE_INT, TYPE_POINT3_BV, TYPE_POINT3_BV);
VFN_5(appendMarker, FPAppendMarker, TYPE_ENUM, TYPE_POINT3_BV, TYPE_INT, TYPE_POINT3_BV, TYPE_POINT3_BV);
VFN_5(appendText, AppendText, TYPE_STRING, TYPE_POINT3_BV, TYPE_INT, TYPE_POINT3_BV, TYPE_POINT3_BV);
VFN_2(updateShapes, UpdateShapes, TYPE_TIMEVALUE, TYPE_TSTR_BR);
// VFN_3(onMouseMove, FPOnMouseMove, TYPE_TIMEVALUE, TYPE_POINT2_BV, TYPE_INT);
FN_1(getLocalViewRay, TYPE_RAY_BV, FPGetLocalViewRay, TYPE_POINT2_BV);
RO_PROP_FN(getMouseState, GetMouseState, TYPE_ENUM);
END_FUNCTION_MAP
// FP interface type-converter wrappers
ManipExport Ray FPGetLocalViewRay(Point2& m);
ManipExport void FPAppendMesh(Mesh* pMesh, DWORD flags, Point3& unselColor, Point3& selColor);
ManipExport void FPAppendGizmo(FPInterface* pGizmo, DWORD flags, Point3& unselColor, Point3& selColor);
// ManipExport void FPOnMouseMove(TimeValue t, Point2& m, DWORD flags);
ManipExport void FPAppendMarker(int markerType, Point3& position,
DWORD flags, Point3& unselColor, Point3& selColor);
ManipExport FPInterfaceDesc* GetDesc();
};
class SimpleManipulator: public Manipulator, public ISimpleManipulator
{
public:
ManipExport SimpleManipulator();
ManipExport SimpleManipulator(INode* pNode);
ManipExport ~SimpleManipulator();
// ReferenceMaker functions
ManipExport int NumRefs();
ManipExport RefTargetHandle GetReference(int i);
ManipExport void SetReference(int i, RefTargetHandle rtarg);
ManipExport RefResult NotifyRefChanged(Interval changeInt,RefTargetHandle hTarget,
PartID& partID, RefMessage message);
// From Object
ManipExport ObjectState Eval(TimeValue time);
void InitNodeName(TSTR& s) {s = GetObjectName();}
ManipExport Interval ObjectValidity(TimeValue t);
// From GeomObject
ManipExport void GetWorldBoundBox(TimeValue t, INode* inode, ViewExp* vpt, Box3& box );
ManipExport void GetLocalBoundBox(TimeValue t, INode* inode, ViewExp* vpt, Box3& box );
ManipExport void GetDeformBBox(TimeValue t, Box3& box, Matrix3 *tm, BOOL useSel );
ManipExport void BeginEditParams( IObjParam *ip, ULONG flags,Animatable *prev);
ManipExport void EndEditParams( IObjParam *ip, ULONG flags,Animatable *next);
// Animatable methods
ManipExport void GetClassName(TSTR& s) {s = GetObjectName();}
ManipExport int NumSubs() { return 1; }
ManipExport Animatable* SubAnim(int i) { return mpPblock; }
ManipExport TSTR SubAnimName(int i);
BaseInterface* GetInterface(Interface_ID id) { if (id == SIMPLE_MANIP_INTERFACE) return (ISimpleManipulator*)this; else return FPMixinInterface::GetInterface(id); }
// Implement the basic manipulator operations
ManipExport int HitTest(TimeValue t, INode* pNode, int type, int crossing,
int flags, IPoint2 *pScreenPoint, ViewExp *pVpt);
ManipExport int Display(TimeValue t, INode* pNode, ViewExp *pVpt, int flags);
ManipExport static const int kNoneSelected;
ManipExport void ClearPolyShapes();
ManipExport void AppendPolyShape(PolyShape* pPolyShape, DWORD flags,
Point3& unselColor,
Point3& selColor = ColorMan()->GetColorAsPoint3(kManipulatorsSelected));
ManipExport void AppendGizmo(GizmoShape* pGizmoShape, DWORD flags,
Point3& unselColor,
Point3& selColor = ColorMan()->GetColorAsPoint3(kManipulatorsSelected));
ManipExport void AppendMesh(Mesh* pMesh, DWORD flags,
Point3& unselColor,
Point3& selColor = ColorMan()->GetColorAsPoint3(kManipulatorsSelected));
ManipExport void AppendMarker(MarkerType markerType, Point3& position,
DWORD flags,
Point3& unselColor,
Point3& selColor = ColorMan()->GetColorAsPoint3(kManipulatorsSelected));
ManipExport void AppendText(TCHAR* pText, Point3& position,
DWORD flags,
Point3& unselColor,
Point3& selColor = ColorMan()->GetColorAsPoint3(kManipulatorsSelected));
ManipExport TSTR& GetManipName() {return mToolTip; }
ManipExport void SetGizmoScale(float gizmoScale) { mGizmoScale = gizmoScale; }
ManipExport TSTR& GetToolTip() { return mToolTip; }
ManipExport void SetToolTipWnd(HWND hWnd) { mToolTipWnd = hWnd; }
ManipExport void SetToolTipTimer(UINT timer) { mToolTipTimer = timer; }
ManipExport UINT GetToolTipTimer() { return mToolTipTimer; }
ManipExport HWND GetToolTipWnd() { return mToolTipWnd; }
ManipExport IParamBlock2* GetPBlock() { return mpPblock; }
// These must be implemented in the sub-class of SimpleManipulator
// Called when the sub-class needs to update it's poly shapes
// The toolTip string is used to signal
virtual void UpdateShapes(TimeValue t, TSTR& toolTip) = 0;
ManipExport virtual void ManipulatorSelected() {};
ManipExport void SetManipTarget(RefTargetHandle hTarg);
ManipExport RefTargetHandle GetManipTarget() { return mhTarget; }
ManipExport void SetMouseState(MouseState state) { mState = state; }
ManipExport MouseState GetMouseState() { return mState; }
ManipExport void OnButtonDown(TimeValue t, ViewExp* pVpt, IPoint2& m, DWORD flags, ManipHitData* pHitData);
ManipExport void OnMouseMove(TimeValue t, ViewExp* pVpt, IPoint2& m, DWORD flags, ManipHitData* pHitData);
ManipExport void OnButtonUp(TimeValue t, ViewExp* pVpt, IPoint2& m, DWORD flags, ManipHitData* pHitData);
ManipExport DisplayState MouseEntersObject(TimeValue t, ViewExp* pVpt, IPoint2& m, ManipHitData* pHitData);
ManipExport DisplayState MouseLeavesObject(TimeValue t, ViewExp* pVpt, IPoint2& m, ManipHitData* pHitData);
ManipExport IPoint2& GetTipPos() { return mToolTipPos; }
// Get the view ray going through the given screen coordinate.
// result is in local coordinates of the owning INode.
ManipExport void GetLocalViewRay(ViewExp* pVpt, IPoint2& m, Ray& viewRay);
ManipExport Invalidate() { mValid = NEVER; }
// From Object
BOOL UseSelectionBrackets() { return FALSE; }
ManipExport void UnRegisterViewChange(BOOL fromDelete = FALSE);
void RegisterViewChange();
void SetResettingFlag(BOOL val) { mResetting = val; }
BOOL GetResettingFlag() { return mResetting; }
ManipExport void KillToolTip();
ManipExport Point3 GetUnselectedColor();
ManipExport BOOL ActiveViewOnly() { return mActiveViewOnly; }
protected:
// Index of manip that mouse is over, for display
int mDispSelectedIndex;
TSTR mToolTip; // text and location for tooltip
float mGizmoScale;
IParamBlock2 *mpPblock;
Interval mValid; // Validity of reference
RefTargetHandle mhTarget; // The object/modifier/controller being manipulated
MouseState mState;
BOOL mActiveViewOnly;
BOOL mResetting;
private:
void StartToolTipTimer(HWND hWnd, IPoint2& m);
Tab<ManipulatorGizmo*> mGizmos;
// Tooltip management
HWND mToolTipWnd;
HWND mToolTipParent;
UINT mToolTipTimer;
IPoint2 mToolTipPos;
bool mNotificationsRegistered;
};
// Stock gizmo objects
ManipExport Mesh* MakeSphere(Point3& pos, float radius, int segments);
ManipExport Mesh* MakeTorus(Point3& pos, float radius, float radius2, int segs, int sides);
ManipExport Mesh* MakeBox(Point3& pos, float l, float w, float h, int lsegs, int wsegs, int hsegs);
ManipExport void AddCubeShape(PolyShape& shape, Point3& pos, float size);
// Special storage class for hit records so we can know which manipulator was hit
class ManipHitData : public HitData
{
public:
Manipulator* mpManip;
int mShapeIndex;
ManipExport ManipHitData(Manipulator* pManip) {
mpManip = pManip;
mShapeIndex = -1;
}
ManipExport ManipHitData() {
mpManip = NULL;
}
virtual ManipHitData* Copy() { return new ManipHitData(mpManip); }
ManipExport ~ManipHitData() {}
};
// Special storage class for hit records so we can know which manipulator was hit
class SimpleManipHitData : public ManipHitData
{
public:
ManipExport SimpleManipHitData(int shapeIndex, Manipulator* pManip) {
mpManip = pManip;
mShapeIndex = shapeIndex;
}
ManipExport SimpleManipHitData() {
mShapeIndex = -1;
mpManip = NULL;
}
ManipExport ~SimpleManipHitData() {}
virtual ManipHitData* Copy() { return new SimpleManipHitData(mShapeIndex, mpManip); }
};

94
lib/maxsdk40/MaxIcon.h Executable file
View File

@ -0,0 +1,94 @@
/**********************************************************************
*<
FILE: MaxIcon.h
DESCRIPTION: Max Icon and Icon Table definitions
CREATED BY: Scott Morrison
HISTORY: Created 15 March, 2000,
*> Copyright (c) 2000, All Rights Reserved.
**********************************************************************/
#ifndef __ICONMAN__
#define __ICONMAN__
// A MaxIcon is an abstract class that represents an icon image for
// toolbar buttons, icons in list boxes, etc. The class is based
// on Win32 ImageLists. MaxIcons must provide an image list and
// index into the list for both large (24x24) and small (16x15) icons.
#include "object.h"
#include "iColorMan.h"
class ICustButton;
class MaxIcon : public InterfaceServer {
public:
// Get the image list for the size of icons that the user has chose
virtual HIMAGELIST GetDefaultImageList() = 0;
// Get the image list for small icons
virtual HIMAGELIST GetSmallImageList() = 0;
// Get the image list for large icons
virtual HIMAGELIST GetLargeImageList() = 0;
// Get the index into the image list for the small version of this
// particular icon.
virtual int GetSmallImageIndex(bool enabledVersion = true,
COLORREF backgroundColor =
GetCustSysColor( COLOR_BTNFACE) ) = 0;
// Get the index into the image list for the large version of this
// particular icon.
virtual int GetLargeImageIndex(bool enabledVersion = true,
COLORREF backgroundColor =
GetCustSysColor( COLOR_BTNFACE) ) = 0;
// Get the index into the image list for the default version of this
// particular icon.
int GetDefaultImageIndex(bool enabledVersion = true,
COLORREF backgroundColor =
GetCustSysColor( COLOR_BTNFACE) );
// returns true if the icons has an alpha mask that needs to be blended
// with the background color.
virtual bool UsesAlphaMask() = 0;
};
// This implementation of MaxIcon is for the icon images that are stored
// as ".bmp" files in MAX's UI directory. This is used by the macroScript
// facility in MAXSrcipt to specify icons. See the documentation for
// "macroScript" for the exact meaning of the filename and index.
class MaxBmpFileIcon: public MaxIcon {
public:
CoreExport MaxBmpFileIcon(TCHAR* pFilePrefix, int index);
CoreExport MaxBmpFileIcon(SClass_ID sid, Class_ID cid);
CoreExport HIMAGELIST GetDefaultImageList();
CoreExport HIMAGELIST GetSmallImageList();
CoreExport HIMAGELIST GetLargeImageList();
CoreExport int GetSmallImageIndex(bool enabledVersion = true,
COLORREF backgroundColor =
GetCustSysColor( COLOR_BTNFACE) );
CoreExport int GetLargeImageIndex(bool enabledVersion = true,
COLORREF backgroundColor =
GetCustSysColor( COLOR_BTNFACE) );
CoreExport bool UsesAlphaMask();
CoreExport TSTR& GetFilePrefix() { return mFilePrefix; }
CoreExport int GetIndex() { return mIndex; }
private:
int mIndex;
TSTR mFilePrefix;
};
CoreExport HIMAGELIST GetIconManDefaultImageList();
CoreExport HIMAGELIST GetIconManSmallImageList();
CoreExport HIMAGELIST GetIconManLargeImageList();
CoreExport BOOL LoadMAXFileIcon(TCHAR* pFile, HIMAGELIST hImageList, ColorId color, BOOL disabled);
#endif

BIN
lib/maxsdk40/Maxscrpt.lib Executable file

Binary file not shown.

BIN
lib/maxsdk40/MenuMan.lib Executable file

Binary file not shown.

11
lib/maxsdk40/MeshDLib.h Executable file
View File

@ -0,0 +1,11 @@
#ifndef _MESHADJLIB_H_
#define _MESHADJLIB_H_
#define IMPORTING
#include "export.h"
#include "meshadj.h"
#include "MeshDelta.h"
#undef IMPORTING
#endif

531
lib/maxsdk40/MeshDelta.h Executable file
View File

@ -0,0 +1,531 @@
// MeshDelta.h
// By Steve Anderson of Kinetix.
// Created June 1998
#ifndef __MESHDELTA__
#define __MESHDELTA__
#include "export.h"
#ifndef __MESHADJ__
#include "meshadj.h"
#endif
// STEVE: MeshDeltas and/or MapDeltas lack the following clever features:
// - Realloc amounts: currently we realloc arrays with no extra room for growth (dv especially).
// These classes encompass the notion of a "Mesh Edit". They are the principal means
// of keeping track of what's going on in the Edit Mesh modifier, and have many standard
// mesh edits available for use elsewhere.
// Principle is that, while these work as designed on the right mesh, they will give
// some result on the wrong mesh.
// Order of operations:
// Verts/TVerts/CVerts created or cloned.
// Faces created -- indices correspond to original vert list, then create, then clone.
// Face attributes & indices changed.
// Verts & faces deleted.
// "Channels" of data in MeshDelta -- different from PART_GEOM type channels!
#define MDELTA_VMOVE 0x0001
#define MDELTA_VCLONE 0x0004
#define MDELTA_VCREATE MDELTA_VCLONE // MDELTA_VCREATE is used only by MapDelta and not MeshDelta
#define MDELTA_VDELETE 0x0008
#define MDELTA_VDATA 0x0010
#define MDELTA_FREMAP 0x0020
#define MDELTA_FCHANGE 0x0040
#define MDELTA_FCREATE 0x0080
#define MDELTA_FDELETE 0x0100
#define MDELTA_FDATA 0x0200 // also used for per-face-data channel
#define MDELTA_NUMBERS 0x0400
#define MDELTA_FSMOOTH 0x0800
#define MDELTA_ALL 0xffff
class VertMove {
public:
DWORD vid;
Point3 dv;
VertMove () {}
VertMove (DWORD i, Point3 p) { vid=i; dv=p; }
~VertMove () {}
VertMove & operator= (VertMove & from) { vid=from.vid; dv=from.dv; return (*this); }
};
class UVVertSet {
public:
DWORD vid;
UVVert v;
UVVertSet () {}
UVVertSet (DWORD i, UVVert p) { vid=i; v=p; }
~UVVertSet () {}
UVVertSet & operator= (UVVertSet & from) { vid=from.vid; v=from.v; return (*this); }
};
class FaceCreate {
public:
DWORD original;
Face face;
FaceCreate (DWORD f, const Face & fc) : original(f), face(fc) { }
FaceCreate (const Face & fc) : original(UNDEFINED), face(fc) { }
FaceCreate (DWORD f) : original(f) { }
FaceCreate () : original(UNDEFINED) { }
FaceCreate (const FaceCreate & fc) : original(fc.original), face(fc.face) { }
FaceCreate & operator= (const FaceCreate & fc) { original = fc.original; face=fc.face; return *this; }
};
#define FR_V0 1
#define FR_V1 2
#define FR_V2 4
#define FR_ALL 7
class FaceRemap {
public:
DWORD f, flags, v[3]; // Face being remapped
FaceRemap () { f=flags=0; }
FaceRemap (DWORD ff, DWORD fl, DWORD *vv) { f=ff; flags=fl; memcpy (v,vv,3*sizeof(DWORD)); }
DllExport void Apply (Face &ff);
DllExport void Apply (TVFace & tf);
DllExport void Apply (FaceRemap & fr);
Face operator* (Face &ff) { Face nf=ff; Apply(nf); return nf; }
TVFace operator* (TVFace & ff) { TVFace nf=ff; Apply(nf); return nf; }
};
// Attribute changes available for faces:
#define ATTRIB_EDGE_A (1<<0)
#define ATTRIB_EDGE_B (1<<1)
#define ATTRIB_EDGE_C (1<<2)
#define ATTRIB_EDGE_ALL 7
#define ATTRIB_HIDE_FACE (1<<3)
#define ATTRIB_MATID (1<<4)
// Mat ID takes bits 5-21
#define ATTRIB_MATID_SHIFT 5
#define ATTRIB_MATID_MASK 0xffff
class FaceChange {
public:
DWORD f, flags, val;
FaceChange () { f=flags=0; }
FaceChange (DWORD ff, DWORD fl, DWORD v) { f=ff; flags=fl; val=v; }
DllExport void Apply (Face &ff);
DllExport void Apply (FaceChange & fa);
};
class FaceSmooth {
public:
DWORD f, mask, val;
FaceSmooth () { f=mask=0; }
FaceSmooth (DWORD ff, DWORD mk, DWORD vl) { f=ff; mask=mk; val=vl; }
DllExport void Apply (Face &ff);
DllExport void Apply (FaceSmooth & fs);
};
//STEVE: someday support applying a standard mapping to selected faces?
class MapDelta {
public:
DWORD vnum, fnum;
Tab<UVVertSet> vSet;
Tab<Point3> vCreate;
Tab<TVFace> fCreate; // New texture vert faces -- matches master MeshDelta fCreate in size.
Tab<FaceRemap> fRemap; // ordered list of faces using at least one new vertex.
MapDelta () { vnum=0; fnum=0; }
DllExport void ClearAllOps ();
// Bookkeeping:
DllExport int NumVSet (DWORD inVNum);
DllExport void SetInVNum (DWORD n);
DllExport void SetInFNum (DWORD n);
DWORD outVNum () { return vnum + vCreate.Count(); }
DWORD outVNum (DWORD inVNum) { return inVNum + vCreate.Count(); }
bool IsCreate (DWORD i) { int j=i-vnum; return ((j>=0) && (j<vCreate.Count())); }
DllExport DWORD SetID (DWORD i);
// Topological ops:
DllExport DWORD VCreate (UVVert *v, int num=1);
DllExport void FCreate (TVFace *f, int num=1);
DllExport void FCreateDefault (int num=1);
DllExport void FCreateQuad (DWORD *t);
DllExport void FClone (TVFace & tf, DWORD remapFlags=0, DWORD *v=NULL);
DllExport void FRemap (DWORD f, DWORD flags, DWORD *v); // Creates a (or modifies an existing) remap record.
void FRemap (FaceRemap & fr) { FRemap (fr.f, fr.flags, fr.v); }
DllExport DWORD RemapID (DWORD ff);
DllExport DWORD IsRemapped (DWORD ff, DWORD vid);
DllExport TVFace OutFace (TVFace *mf, DWORD ff);
DllExport void FDelete (int offset, BitArray & fdel);
// Geometric ops:
DllExport void Set (DWORD i, const UVVert & p);
DllExport void Set (BitArray & sel, const UVVert & p);
// Uses:
MapDelta & operator=(MapDelta & from) { CopyMDChannels (from, MDELTA_ALL); return *this; }
DllExport MapDelta & operator*=(MapDelta & from);
DllExport void Apply (UVVert *tv, TVFace *tf, DWORD inVNum, DWORD inFNum);
// Handy debugging output
DllExport void MyDebugPrint ();
// Backup stuff:
DllExport DWORD ChangeFlags ();
DllExport void CopyMDChannels (MapDelta & from, DWORD channels);
// Double-checking routines, good for after loading.
// Return TRUE if already correct, FALSE if they had to make a correction.
DllExport BOOL CheckOrder (); // Checks for out of order sets or remaps
DllExport BOOL CheckFaces (); // Checks remaps & fCreates for out of bound map vert id's.
};
class VDataDelta {
public:
PerData *out;
VDataDelta () { out=NULL; }
~VDataDelta () { if (out) delete out; }
void SetVNum (int nv, BOOL keep=FALSE) { if (out) out->SetCount(nv,keep); }
void Activate (int vnum, int vdID) { if (out==NULL) out = new PerData(vnum, VertexDataType(vdID)); }
DllExport void Set (int where, void *data, int num=1);
};
class MeshDelta : public BaseInterfaceServer {
DWORD *vlut, *flut;
int vlutSize, flutSize;
MapDelta hmap[NUM_HIDDENMAPS];
BitArray hmapSupport;
// Internal methods:
// Parts of Cut:
DWORD FindBestNextFace (Mesh & m, Tab<DWORD> *vfac, Point3 *cpv, DWORD startV, Point3 & svP);
DWORD FindOtherFace (DWORD ff, Tab<DWORD> * vfa, Tab<DWORD> * vfb);
public:
DWORD vnum, fnum;
Tab<VertMove> vMove; // Ordered list of moves to existing verts
//Tab<Point3> vCreate; // DO NOT USE!!!!! Use of this data member was eliminated in 4.0
Tab<VertMove> vClone; // Creation-order list of cloned points.
BitArray vDelete;
Tab<FaceCreate> fCreate; // New faces
Tab<FaceRemap> fRemap; // existing faces using new verts. (Ordered list.)
Tab<FaceChange> fChange; // ordered list of face flag changes
Tab<FaceSmooth> fSmooth; // ordered list of face smoothing group changes
BitArray fDelete; // Also applies to map faces.
BitArray vsel, esel, fsel, vhide; // Based on output mesh indexing.
MapDelta *map;
BitArray mapSupport;
VDataDelta *vd; // Based on output mesh indexing.
BitArray vdSupport;
DllExport MeshDelta ();
DllExport MeshDelta (const Mesh & m);
DllExport ~MeshDelta ();
DllExport void InitToMesh (const Mesh & m);
DllExport void ClearAllOps ();
DllExport void SetMapNum (int n, bool keep=TRUE);
int GetMapNum () { return mapSupport.GetSize(); }
MapDelta & Map(int mp) { return (mp<0) ? hmap[-1-mp] : map[mp]; }
bool getMapSupport (int mp) { return ((mp<0) ? hmapSupport[-1-mp] : mapSupport[mp]) ? true : false; }
void setMapSupport (int mp, bool val=true) { if (mp<0) hmapSupport.Set(-1-mp, val); else mapSupport.Set(mp, val); }
bool hasMapSupport () { return (mapSupport.NumberSet() + hmapSupport.NumberSet() > 0) ? true : false; }
DllExport void SetVDataNum (int size, bool keep=TRUE);
int GetVDataNum () { return vdSupport.GetSize(); }
DllExport DWORD PartsChanged ();
// The main work of a MeshDelta.
DllExport void Apply(Mesh& mesh);
MeshDelta& operator=(MeshDelta& td) { CopyMDChannels (td, MDELTA_ALL); return *this; }
MeshDelta& operator*=(MeshDelta& td) { Compose(td); return *this; }
DllExport void Compose (MeshDelta & td);
// Following give numbers of clones or deletions, given the input numbers.
// (We can't delete vertex 10 on an 8-vert mesh; this counts the number of valid entries.)
DllExport DWORD NumVMove (DWORD inVNum);
DllExport DWORD NumVClone (DWORD inVNum);
DllExport DWORD NumVDelete (DWORD inVNum);
DllExport DWORD NumFDelete (DWORD inFNum);
int NumFCreate () { return fCreate.Count(); }
// Sets the size of the input object -- should be used only in multiplying MeshDeltas,
// since it destroys records of changes to out-of-range components.
// MeshDelta may be applied to mesh without using these.
DllExport void SetInFNum (int nface);
DllExport void SetInVNum (int nv);
int outVNum () { return vnum + vClone.Count() - vDelete.NumberSet(); }
int outVNum (int inVNum) { return inVNum + NumVClone(inVNum) - NumVDelete(inVNum); }
int outFNum () { return fnum + fCreate.Count() - fDelete.NumberSet(); }
int outFNum (int inFNum) { return inFNum + fCreate.Count() - NumFDelete(inFNum); }
DllExport void FillInFaces (Mesh & m); // Fills in undefined mapping face verts.
DllExport void AddVertexColors (); // Adds vertex color mapdelta to match this meshdelta.
DllExport void AddMap (int mapID); // Adds mapdelta on specified channel to match this meshdelta.
DllExport void AddVertexData (int vdChan, Mesh *m=NULL);
// Create lookup tables for fast conversion of pre- and post- vert/face indices.
DllExport void UpdateLUTs (int extraV=0, int extraF=0);
DllExport void ClearLUTs ();
// Following methods turn output indices to input indices.
DllExport DWORD VLut (DWORD i);
DllExport DWORD FLut (DWORD i);
// Following methods turn input indices to output indices.
DllExport DWORD PostVIndex (DWORD i);
DllExport DWORD PostFIndex (DWORD i);
// Following operate on output indices
bool IsVClone (DWORD i) { int j=VLut(i)-vnum; return ((j>=0) && (j<vClone.Count())); }
DWORD VCloneOf (DWORD i) { int j=VLut(i)-vnum; return ((j>=0) && (j<vClone.Count())) ? vClone[j].vid : UNDEFINED; }
// NOTE: vCreate array no longer used in 3.1!
bool IsVCreate (DWORD i) { return FALSE; }
bool IsFCreate (DWORD i) { int j=FLut(i)-fnum; return ((j>=0) && (j<fCreate.Count())); }
DllExport DWORD MoveID (DWORD i);
// Basic topological operations:
// Those that accept DWORD indices require post-operation indices.
DllExport DWORD VCreate (Point3 *p, int num=1, BitArray *sel=NULL, BitArray *hide=NULL);
DllExport DWORD VClone (DWORD *v, int num=1);
DllExport DWORD VClone (DWORD *v, Point3 *off, int num=1);
DllExport DWORD VClone (VertMove *vm, int num=1);
DWORD VClone (DWORD v) { return VClone (&v, 1); }
DWORD VClone (DWORD v, Point3 off) { return VClone (&v, &off, 1); }
DllExport Point3 OutVert (Mesh & m, DWORD v);
DllExport void VDelete (DWORD *v, int num=1);
DllExport void VDelete (BitArray & vdel);
DllExport DWORD FCreate (Face *f, int num=1);
DllExport DWORD FCreate (FaceCreate *f, int num=1);
DllExport DWORD FCreateQuad (DWORD *v, DWORD smG=0, MtlID matID=0, int orig=UNDEFINED);
DllExport DWORD FClone (Face & f, DWORD ff, DWORD remapFlags=0, DWORD *v=NULL);
DllExport void CreateDefaultMapFaces (int num=1);
DllExport void FRemap (FaceRemap *f, int num=1);
DllExport void FRemap (DWORD f, DWORD flags, DWORD *v);
DllExport DWORD RemapID (DWORD ff);
DllExport DWORD IsRemapped (DWORD ff, DWORD vid);
DllExport Face OutFace (Mesh & m, DWORD ff);
DllExport void FChange (FaceChange *f, int num=1);
DllExport void FChange (DWORD f, DWORD flags, DWORD dat);
DllExport void FSmooth (FaceSmooth *f, int num=1);
DllExport void FSmooth (DWORD f, DWORD mask, DWORD val);
void SetMatID (DWORD f, MtlID mt) { FChange (f, ATTRIB_MATID, mt<<ATTRIB_MATID_SHIFT); }
void SetSmGroup (DWORD f, DWORD smG) { FSmooth (f, ~DWORD(0), smG); }
void SetEdgeVis (DWORD f, DWORD ed, BOOL vis=TRUE) { FChange (f, (1<<ed), vis?(1<<ed):0); }
DllExport void FDelete (DWORD *f, int num=1);
DllExport void FDelete (BitArray & fdel);
// Geometric ops:
DllExport void Move (int i, const Point3 & p);
DllExport void Move (BitArray & sel, const Point3 & p);
DllExport void Move (VertMove *vm, int num);
// FOLLOWING TWO METHODS SHOULD NOT BE USED:
DllExport void GetSavingPermutations (int & numCr, int & numCl, Tab<int> & vPermute, Tab<int> & vPReverse);
DllExport void PermuteClonedVertices (Tab<int> & vPermute);
// Gotta be able to save and load this complex thing...
DllExport IOResult Save (ISave *isave);
DllExport IOResult Load (ILoad *iload);
// Handy debugging output
DllExport void MyDebugPrint (bool lut=FALSE, bool mp=FALSE);
// Backup-relevant characteristics:
DllExport DWORD ChangeFlags (Tab<DWORD> *mChannels=NULL);
DllExport void CopyMDChannels (MeshDelta & from, DWORD channels, Tab<DWORD> *mChannels=NULL);
// Double-checking routines, good for after loading.
// Returns TRUE if order was already correct, FALSE if it had to make a correction.
DllExport BOOL CheckOrder ();
DllExport BOOL CheckMapFaces ();
// More complex operations, built on the list above.
// Mesh given is expected to be result of the current MeshDelta.
// Found in MDAppOps.cpp
DllExport void AutoSmooth(Mesh &m, BitArray sel, float angle, AdjFaceList *af=NULL, AdjEdgeList *ae=NULL);
DllExport void Bevel (Mesh & m, BitArray vset, float outline, Tab<Point3> *odir,
float height, Tab<Point3> *hdir);
DllExport DWORD CreatePolygon (Mesh & m, int deg, int *v, DWORD smG=0, MtlID matID=0);
DllExport void DeleteVertSet (Mesh & m, BitArray sel); // does delete faces
DllExport void DeleteEdgeSet (Mesh & m, BitArray sel); // doesn't delete verts
DllExport void DeleteFaceSet (Mesh & m, BitArray sel); // doesn't delete verts.
DllExport void DeleteSelected (Mesh & m);
DllExport void DeleteIsoVerts (Mesh & m);
DllExport void FlipNormal (Mesh & m, DWORD face);
DllExport void MakeSelFacesPlanar (Mesh &m, BitArray sel);
DllExport void MakeSelVertsPlanar (Mesh &m, BitArray sel);
DllExport void MoveVertsToPlane (Mesh & m, BitArray sel, Point3 & N, float offset);
DllExport void RestrictMatIDs (Mesh & m, int numMats); // like "FitMeshIDsToMaterial".
DllExport void SelectFacesByFlags (Mesh & m, BOOL onoff, DWORD flagmask, DWORD flags);
// if adj is non-NULL, it uses it to set the "other side" visible too.
DllExport void SetSingleEdgeVis (Mesh & m, DWORD ed, BOOL vis, AdjFaceList *adj=NULL);
// Following will initialize to the mesh given: they can't be used to "add" ops to an existing MeshDelta.
// (To add these ops, make a new MeshDelta, call one of the following, and append it to your previous one with Compose.)
// Found in MDOps.cpp
DllExport void AttachMesh (Mesh & m, Mesh &attachment, Matrix3 & relativeTransform,
int matOffset);
DllExport void BreakVerts (Mesh & m, BitArray vset);
DllExport void ChamferEdges (Mesh & m, BitArray eset, MeshChamferData &mcd, AdjEdgeList *ae=NULL);
DllExport void ChamferMove (Mesh & m, MeshChamferData &mcd, float amount, AdjEdgeList *ae=NULL);
DllExport void ChamferVertices (Mesh & m, BitArray vset, MeshChamferData &mcd, AdjEdgeList *ae=NULL);
DllExport void CloneFaces (Mesh & m, BitArray fset);
DllExport void CloneVerts (Mesh & m, BitArray vset);
DllExport void CollapseEdges(Mesh &m, BitArray ecol, AdjEdgeList *ae=NULL);
DllExport DWORD Cut (Mesh & m, DWORD ed1, float prop1, DWORD ed2, float prop2,
Point3 & norm, bool fixNeighbors=TRUE, bool split=FALSE);
DllExport void Detach (Mesh & m, Mesh *out, BitArray fset, BOOL faces, BOOL del, BOOL elem);
DllExport void DivideEdge (Mesh & m, DWORD ed, float prop=.5f, AdjEdgeList *el=NULL,
bool visDiag1=FALSE, bool fixNeighbors=TRUE, bool visDiag2=FALSE, bool split=FALSE);
DllExport void DivideEdges (Mesh & m, BitArray eset, AdjEdgeList *el=NULL);
DllExport void DivideFace (Mesh & m, DWORD f, float *bary=NULL);
DllExport void DivideFaces (Mesh & m, BitArray fset, MeshOpProgress *mop=NULL);
DllExport void EdgeTessellate(Mesh &m, BitArray fset, float tens,
AdjEdgeList *ae=NULL, AdjFaceList *af=NULL, MeshOpProgress *mop=NULL);
DllExport void ExplodeFaces(Mesh &m, float thresh, bool useFaceSel=FALSE, AdjFaceList *af=NULL);
DllExport void ExtrudeEdges (Mesh & m, BitArray eset, Tab<Point3> *edir=NULL);
DllExport void ExtrudeFaces (Mesh & m, BitArray fset, AdjEdgeList *el=NULL);
DllExport void ResetVertCorners (Mesh & m); // DO NOT USE. Not relevant.
DllExport void ResetVertWeights (Mesh & m);
void SetFaceAlpha (Mesh &m, BitArray fset, float alpha, int mp=MAP_ALPHA) { SetFaceColors (m, fset, UVVert(alpha,alpha,alpha), mp); }
void SetVertAlpha (Mesh &m, BitArray vset, float alpha, int mp=MAP_ALPHA) { SetVertColors (m, vset, UVVert(alpha,alpha,alpha),mp); }
DllExport void SetFaceColors (Mesh &m, BitArray fset, VertColor vc, int mp=0);
DllExport void SetVertColors (Mesh &m, BitArray vset, VertColor vc, int mp=0);
DllExport void SetVertCorners (Mesh &m, BitArray vset, float corner); // DO NOT USE: Not relevant.
DllExport void SetVertWeights (Mesh &m, BitArray vset, float weight);
DllExport DWORD TurnEdge (Mesh & m, DWORD ed, AdjEdgeList *el=NULL);
DllExport BOOL WeldByThreshold (Mesh & m, BitArray vset, float thresh);
DllExport void WeldVertSet (Mesh & m, BitArray vset, Point3 *weldPoint=NULL);
DllExport void PropagateFacing (Mesh & m, BitArray & fset, int face,
AdjFaceList &af, BitArray &done,BOOL bias=1);
DllExport void UnifyNormals (Mesh & m, BitArray fset, AdjFaceList *af=NULL);
// In slicer.cpp:
DllExport void Slice (Mesh & m, Point3 N, float off, bool sep=FALSE, bool remove=FALSE, BitArray *fslice=NULL, AdjEdgeList *ae=NULL);
};
// Following classes provide standard interface for modifiers and objects that
// use mesh deltas -- specifically Edit Mesh and Editable Mesh for now.
enum meshCommandMode { McmCreate, McmAttach, McmExtrude, McmBevel, McmChamfer,
McmSlicePlane, McmCut, McmWeldTarget, McmFlipNormalMode, McmDivide, McmTurnEdge };
enum meshButtonOp { MopHide, MopUnhideAll, MopDelete, MopDetach, MopBreak, MopViewAlign,
MopGridAlign, MopMakePlanar, MopCollapse, MopTessellate, MopExplode, MopSlice, MopWeld,
MopRemoveIsolatedVerts, MopSelectOpenEdges, MopCreateShapeFromEdges, MopShowNormal,
MopFlipNormal, MopUnifyNormal, MopAutoSmooth, MopVisibleEdge, MopInvisibleEdge, MopAutoEdge,
MopAttachList, MopSelectByID, MopSelectBySG, MopClearAllSG, MopSelectByColor,
MopCopyNS, MopPasteNS, MopEditVertColor, MopEditVertIllum };
enum meshUIParam { MuiSelByVert, MuiIgBack, MuiIgnoreVis, MuiSoftSel, MuiSSUseEDist,
MuiSSEDist, MuiSSBack, MuiWeldBoxSize, MuiExtrudeType, MuiShowVNormals,
MuiShowFNormals, MuiSliceSplit, MuiCutRefine, // end of integer values
MuiPolyThresh, MuiFalloff, MuiPinch, MuiBubble, MuiWeldDist, MuiNormalSize };
#define EM_MESHUIPARAM_LAST_INT MuiShowFNormals // must specify last integer param
#define EM_SL_OBJECT 0
#define EM_SL_VERTEX 1
#define EM_SL_EDGE 2
#define EM_SL_FACE 3
#define EM_SL_POLYGON 4
#define EM_SL_ELEMENT 5
class MeshDeltaUser : public InterfaceServer {
public:
virtual void LocalDataChanged (DWORD parts)=0;
// start or stop interactive command mode, uses mode enum above
virtual void ToggleCommandMode (meshCommandMode mode)=0;
// perform button op, uses op enum above
virtual void ButtonOp (meshButtonOp opcode)=0;
// UI controls access
virtual void GetUIParam (meshUIParam uiCode, int & ret) { }
virtual void SetUIParam (meshUIParam uiCode, int val) { }
virtual void GetUIParam (meshUIParam uiCode, float & ret) { }
virtual void SetUIParam (meshUIParam uiCode, float val) { }
virtual void UpdateApproxUI () { }
// Should work on any local command mode.
virtual void ExitCommandModes ()=0;
virtual bool Editing () { return FALSE; } // returns TRUE iff between BeginEditParams, EndEditParams
virtual DWORD GetEMeshSelLevel () { return EM_SL_OBJECT; }
virtual void SetEMeshSelLevel (DWORD sl) { }
// access to EditTriObject method for creating point controllers
virtual void PlugControllersSel(TimeValue t,BitArray &set) { }
};
class MeshDeltaUserData {
public:
virtual void ApplyMeshDelta (MeshDelta & md, MeshDeltaUser *mdu, TimeValue t)=0;
virtual MeshDelta *GetCurrentMDState () { return NULL; } // only non-null in Edit Mesh
// functional interface to mesh ops
virtual void MoveSelection(int level, TimeValue t, Matrix3& partm, Matrix3& tmAxis, Point3& val, BOOL localOrigin)=0;
virtual void RotateSelection(int level, TimeValue t, Matrix3& partm, Matrix3& tmAxis, Quat& val, BOOL localOrigin)=0;
virtual void ScaleSelection(int level, TimeValue t, Matrix3& partm, Matrix3& tmAxis, Point3& val, BOOL localOrigin)=0;
virtual void ExtrudeSelection(int level, BitArray* sel, float amount, float bevel, BOOL groupNormal, Point3* direction)=0;
};
// Constants used in Edit(able) Mesh's shortcut table - THESE MUST BE MATCHED to values in Editable Mesh's resources.
#define EM_SHORTCUT_ID 0x38ba1366
#define MDUID_EM_SELTYPE 40001
#define MDUID_EM_SELTYPE_BACK 40002
#define MDUID_EM_SELTYPE_VERTEX 40003
#define MDUID_EM_SELTYPE_EDGE 40004
#define MDUID_EM_SELTYPE_FACE 40005
#define MDUID_EM_SELTYPE_POLYGON 40006
#define MDUID_EM_SELTYPE_ELEMENT 40007
#define MDUID_EM_SELTYPE_OBJ 40008
#define MDUID_EM_AUTOSMOOTH 40009
#define MDUID_EM_ATTACH 40010
#define MDUID_EM_BREAK 40011
#define MDUID_EM_IGBACK 40012
#define MDUID_EM_BEVEL 40013
#define MDUID_EM_CREATE 40014
#define MDUID_EM_CUT 40015
#define MDUID_EM_DIVIDE 40016
#define MDUID_EM_EXTRUDE 40017
#define MDUID_EM_FLIPNORM 40018
#define MDUID_EM_SS_BACKFACE 40019
#define MDUID_EM_UNIFY_NORMALS 40020
#define MDUID_EM_HIDE 40021
#define MDUID_EM_EDGE_INVIS 40022
#define MDUID_EM_IGNORE_INVIS 40023
#define MDUID_EM_IGNORE_INVIS 40023
#define MDUID_EM_COLLAPSE 40024
#define MDUID_EM_SHOWNORMAL 40025
#define MDUID_EM_SELOPEN 40026
#define MDUID_EM_REMOVE_ISO 40027
#define MDUID_EM_SLICEPLANE 40028
#define MDUID_EM_SOFTSEL 40029
#define MDUID_EM_SLICE 40030
#define MDUID_EM_DETACH 40031
#define MDUID_EM_TURNEDGE 40032
#define MDUID_EM_UNHIDE 40033
#define MDUID_EM_EDGE_VIS 40034
#define MDUID_EM_SELBYVERT 40035
#define MDUID_EM_AUTOEDGE 40036
#define MDUID_EM_WELD 40038
#define MDUID_EM_EXPLODE 40039
#define MDUID_EM_CHAMFER 40040
#define MDUID_EM_WELD_TARGET 40041
#define MDUID_EM_ATTACH_LIST 40042
#define MDUID_EM_VIEW_ALIGN 40043
#define MDUID_EM_GRID_ALIGN 40044
#define MDUID_EM_SPLIT 40045
#define MDUID_EM_REFINE_CUTENDS 40046
#define MDUID_EM_COPY_NAMEDSEL 40047
#define MDUID_EM_PASTE_NAMEDSEL 40048
#define MDUID_EM_MAKE_PLANAR 40049
#define MDUID_EM_VERT_COLOR 40050
#define MDUID_EM_VERT_ILLUM 40051
#define MDUID_EM_FLIP_NORMAL_MODE 40052
DllExport void FindTriangulation (Mesh & m, int deg, int *vv, int *tri);
#endif

33
lib/maxsdk40/Meshacc.h Executable file
View File

@ -0,0 +1,33 @@
/*****************************************************************************
*<
FILE: meshacc.h
DESCRIPTION: A class for getting at the private snap data of the mesh class
CREATED BY: John Hutchinson
HISTORY: created 1/2/97
*> Copyright (c) 1994, All Rights Reserved.
*****************************************************************************/
#ifndef _MESHACC_H_
#define _MESHACC_H_
#include "export.h"
#include "mesh.h"
class MeshAccess {
private:
Mesh *mymesh;
public:
MeshAccess(Mesh *somemesh){mymesh = somemesh;}
DllExport int BuildSnapData(GraphicsWindow *gw,int verts,int edges);
char* GetsnapV(){
return mymesh->snapV;
}
char* GetsnapF(){
return mymesh->snapF;
}
};
#endif

89
lib/maxsdk40/MouseProc.h Executable file
View File

@ -0,0 +1,89 @@
/**********************************************************************
*<
FILE: MouseProc.h
DESCRIPTION: Declares DataEntryMouseProc class
CREATED BY: Scott Morrison
HISTORY: created 7 December, 1998
*> Copyright (c) 1998, All Rights Reserved.
**********************************************************************/
class DataEntryMouseProc : public MouseCallBack {
public:
CoreExport DataEntryMouseProc(Object* pObj, int cursor, HINSTANCE hInst);
CoreExport DataEntryMouseProc();
// Called when a point is selected
CoreExport virtual BOOL OnPointSelected() {return TRUE; }
// Called on every mouse move event
CoreExport virtual void OnMouseMove(Point3& p) {}
// Tells the system when to allow drawing in mutiple viewports
CoreExport virtual BOOL AllowAnyViewport() { return TRUE; }
// Called when backspace is pressed
CoreExport virtual void RemoveLastPoint() {}
// Called when the creation is finished
CoreExport virtual int OnMouseAbort() { return CREATE_ABORT; }
// Says whether the mouse proc should perform redraws
// When used in a CreateMouseCallBack, this should return FALSE
CoreExport virtual BOOL PerformRedraw() { return TRUE; }
// These methods need to be implemented to get the offset line drawn
// Tells the object to draw offset lines
CoreExport virtual void SetUseConstructionLine(BOOL useLine) = 0;
// Sets the endpoints of the line (0 is start, 1 is end)
CoreExport virtual void SetConstructionLine(int i, Point3 p) = 0;
// The mouse callback function
CoreExport int proc(HWND hwnd, int msg, int point, int flags, IPoint2 m );
friend class DataEntryBackspaceUser;
CoreExport void ClearCreationParams();
CoreExport void SetParams(HINSTANCE hInst, Object* pObj, int cursor);
private:
Point3 GetPoint(IPoint2 m, HWND hWnd, ViewExp* pVpt);
void SetOffsetBase(IPoint2 m, HWND hWnd, ViewExp* pVpt);
BOOL GetNodeTM(Matrix3& tm);
IPoint2 ProjectPointToViewport(ViewExp *pVpt, Point3 fp);
IPoint2 AngleSnapPoint(Point3 in3, ViewExp* pVpt);
// The inverse of the transform on the node (or viewport transform,
// for creation mouse procs)
Matrix3 mTM;
// Indicates when to ignore upclicks close to down clicks
BOOL mDoNotDouble;
// The resource id of the cursor to use
int mCursor;
// The instance of the dll using the mouse proc
HINSTANCE mInstance;
// State for off-construction plane creation
Point3 mSnappedPoint;
Matrix3 mOriginalViewTM;
int mPreviousFlags;
protected:
// The object using the mouse proc
Object* mpObject;
// The number of points selected so far.
int mMouseClick;
// The 3D coordinates of the points, in the local coordinate system
Tab<Point3> mPoints;
// The 2D points the user selected in the viewport.
Tab<IPoint2> mClickPoints;
// TRUE when in the mode where we lift off the construction plane
BOOL mLiftOffCP;
// The last window we had an event in
HWND mHwnd;
IPoint2 mLastMovePoint;
};

41
lib/maxsdk40/Omanapi.h Executable file
View File

@ -0,0 +1,41 @@
/**********************************************************************
FILE: omanapi.h
DESCRIPTION: Defines an interface to the osnapmanager class
CREATED BY: John Hutchinson
HISTORY: May 14, 1997
Copyright (c) 1994, All Rights Reserved.
**********************************************************************/
#ifndef _IOMAN_H
#define _IOMAN_H
// This class provides an interface to the OsnapManager. People who implement osnaps
// need to record hits with the manager. People implementing command modes are responsible
// for getting the snap preview done and may be responsible for initting and closing point
// sequences.
class OsnapHit;
#define IID_IOsnapManager Interface_ID(0x5ba68f3, 0x490c28a2)
class IOsnapManager : public BaseInterface
{
public:
virtual BOOL getactive() const =0;
virtual BOOL getAxisConstraint()=0;
virtual void RecordHit(OsnapHit* somehit)=0;
virtual BOOL OKForRelativeSnap()=0;
virtual BOOL RefPointWasSnapped()=0;
virtual Point3 GetRefPoint(BOOL top = TRUE)=0;
virtual BOOL IsHolding()=0;
virtual OsnapHit &GetHit()=0;
virtual ViewExp* GetVpt()=0;
virtual INode* GetNode()=0;
virtual int GetSnapStrength()=0;
virtual Matrix3 GetObjectTM()=0;
virtual TimeValue GetTime()=0;
virtual void wTranspoint(Point3 *inpt, IPoint3 *outpt)=0;
virtual void Reset() =0;
virtual BOOL TestAFlag(int mask)=0;
virtual Point3 GetCurrentPoint()=0;
};
#endif// _IOMAN_H

130
lib/maxsdk40/Osnap.h Executable file
View File

@ -0,0 +1,130 @@
/**********************************************************************
*<
FILE: osnap.h
DESCRIPTION: Classes for Osnaps
CREATED BY: John Hutchinson
HISTORY: December 9, 1996
*> Copyright (c) 1994, All Rights Reserved.
**********************************************************************/
#ifndef _OSNAP_H_
#define _OSNAP_H_
#include "tab.h"
#define RESET 0
#define NEXT 1
#define ICON_WIDTH 32
#define HILITE_NORMAL (1<<0)
#define HILITE_BOX (1<<1)
#define HILITE_NODE (1<<2)//Not implemented
#define HILITE_CROSSHAIR (1<<3)
#define OSNAP_STATE _T("ObjectSnapPluginState")
//Some types
class Candidate
{
public:
Candidate(){};
Candidate(Point3* p, int s, int num=0, ...);
void SetMeshPoint(int which, const Point3 p);
~Candidate();
Point3 *pt;
int type;
int count;
Point3 *meshverts;
};
//typedef Tab<Point3> Point3Tab;
typedef Tab<Candidate *> CandidateTab;
typedef void (*SnapCallback) (Object* pobj, IPoint2 *p) ;
class OsnapMarker;
class HitMesh;
class IOsnapManager;
//The osnap class
//===========================================================================
class Osnap {
friend class OsnapHit;
friend class OsnapManager;
protected:
BOOL *m_active;
DllExport void _Snap(INode* inode, TimeValue t, ViewExp *vpt, IPoint2 *p, SnapInfo *snap);
DllExport Point3 _ReEvaluate(TimeValue t, OsnapHit *hit);
DllExport boolean IsActive();
DllExport void SetActive(int index, boolean state);
DllExport boolean GetActive(int index);
GraphicsWindow *m_hitgw;
//Point management.
//Some osnaps may want to maintain a list of potential hit points.
//Note that the points should be passed in in modeling space
DllExport void AddCandidate(Point3 *pt, int type = -1, int num = 0,...);
DllExport Point3 *GetCandidatePoint(int index);
DllExport void GetCandidateMesh(int index, HitMesh *m);
DllExport int GetCandidateType(int index);
// DllExport void AddCandidate(Point3 *pt);
DllExport void ClearCandidates();
DllExport int NumCandidates(){return point_candidates.Count();}
virtual DllExport Point3 ReEvaluate(TimeValue t, OsnapHit *hit, Object* pobj);
//Note: the following version uses an index into the candidate list
DllExport BOOL CheckPotentialHit(int ptindex, Point2 cursor);
//Note: the following version uses a remote matrix of points
DllExport BOOL CheckPotentialHit(Point3 *p, int ptindex, Point2 cursor);
int m_baseindex;//an index into the tool array
public:
DllExport Osnap();//constructor
DllExport virtual ~Osnap();
DllExport void Init();
virtual int numsubs(){return 1;}; //the number of subsnaps this guy has
virtual DllExport TCHAR *Category();//JH 01/04/98 {return NULL;}
virtual Class_ID ClassID() { return Class_ID( 0, 0); }
virtual BOOL UseCallbacks(){return FALSE;}
virtual int NumCallbacks(){return 0;}
virtual DllExport BOOL GetSupportedObject(INode *iNode, TimeValue t, ObjectState *os);
virtual TSTR *snapname(int index)=0; // the snap<61>s name to be displayed in the UI
virtual TSTR *tooltip(int index){return NULL;} // the snap<61>s name to be displayed in the UI
virtual boolean ValidInput(SClass_ID scid, Class_ID cid)=0;//the objects it supports
virtual OsnapMarker *GetMarker(int index)=0; // single object might contain subsnaps
virtual WORD HiliteMode(){return HILITE_NORMAL;}
// UI methods
virtual boolean BeginUI(HWND hwnd){return TRUE;}
virtual void EndUI(HWND hwnd){};
virtual HBITMAP getTools()=0;
virtual HBITMAP getMasks()=0;
virtual void Snap(Object* pobj, IPoint2 *p, TimeValue t){};
virtual BOOL HitTest(Object* pobj, IPoint2 *p, TimeValue t){return TRUE;}
virtual SnapCallback GetSnapCallback( int sub){ return NULL;}
virtual WORD AccelKey(int index)=0;
protected://data
IOsnapManager *theman;
// Point3Tab point_candidates; //this will hold the point candidates
CandidateTab point_candidates; //this will hold the point candidates
public://data
// INode *m_inode;
// ViewExp *m_vpt;
};
#endif // _OSNAP_H_

22
lib/maxsdk40/Osnapapi.h Executable file
View File

@ -0,0 +1,22 @@
/*****************************************************************************
*<
FILE: osnapapi.h
DESCRIPTION: Master include file for implementing osnaps
CREATED BY: John Hutchinson
HISTORY: created 5/17/97
*> Copyright (c) 1994, All Rights Reserved.
*****************************************************************************/
#ifndef _SNAPAPI_H
#define _SNAPAPI_H
#include "omanapi.h"
#include "osnap.h"
#include "osnapmk.h"
#include "osnaphit.h"
#endif //_SNAPAPI_H

76
lib/maxsdk40/Osnapdlg.h Executable file
View File

@ -0,0 +1,76 @@
/**********************************************************************
*<
FILE: OsnapDlg.h
DESCRIPTION: Declares class for the Osnap Dialog
CREATED BY: John Hutchinson
HISTORY: January 11 '97
*> Copyright (c) 1994, All Rights Reserved.
**********************************************************************/
#ifndef __OSNAPDLG__
#define __OSNAPDLG__
#include "tabdlg.h"
// The dimensions of the vertical toolbar that gets constructed for the UI
#define CHECKBAR_WIDTH 225//230
#define CHECKBAR_HEIGHT 130//150//113
#define CHECKBAR_HOFFSET 5
#define CHECKBAR_VOFFSET 30
class OsnapDlg : public TabbedDialog {
public:
HWND hSnapCat;
static int curCat;
OsnapManager *theMan;
BOOL valid, spinDown, block;
HWND hWnd;
IVertToolbar *iCheckbar;
int DoDialog(int page);
ISpinnerControl *iAbs[3], *iRel[3], *iDolly, *iRoll;
static int winX, winY;
OsnapDlg(HWND appWnd,HINSTANCE hInst);
~OsnapDlg();
void Invalidate();
void Update();
void Init(HWND hWnd);
void ChangeCat(int cat);
void WMCommand(int id, int notify, HWND hCtrl);
void WMSize(int how);
};
void ShowOsnapDlg(HWND hWnd,HINSTANCE hInst,int page=0);
void HideOsnapDlg();
class OsnapOffset {
public:
OsnapOffset(HWND HWnd, HINSTANCE hInst);
~OsnapOffset();
void Init(HWND dWnd);
void Update();
void OnCommand(int id);
void OnSpinnerChange(int id);
private:
ISpinnerControl *iAbs[3], *iRel[3];
Point3 refpoint, pAbs, pRel;
OsnapManager *theman;
HWND hWnd;
};
extern void OffsetOsnap(HWND hWnd, HINSTANCE hInst);
#endif //__OSNAPDLG__

121
lib/maxsdk40/Osnaphit.h Executable file
View File

@ -0,0 +1,121 @@
/**********************************************************************
FILE: osnaphit.h
DESCRIPTION: Defines the classes which are passed from the osnaps
to the manager.
CREATED BY: John Hutchinson
HISTORY: December 9, 1996
Copyright (c) 1994, All Rights Reserved.
**********************************************************************/
#ifndef _OSNAPHIT_H_
#define _OSNAPHIT_H_
#include "baseinterface.h"
class Osnap;
class HitMesh;
class OsnapMarker;
class OsnapHit : public BaseInterfaceServer
{
friend class OsnapManager;
friend class Osnap;
friend class TypedHit;
public:
CoreExport OsnapHit(Point3 p3, Osnap* s, int sub, HitMesh *m);
CoreExport OsnapHit(Point3 pt);
CoreExport OsnapHit(const OsnapHit& h);
virtual CoreExport OsnapHit& operator=(const OsnapHit& h);
virtual CoreExport ~OsnapHit();
virtual CoreExport OsnapHit* clone();
void setscreendata(IPoint3 screen3, int len);
//////////////////////////////////////////////////////////////////////
// Display Methods
//////////////////////////////////////////////////////////////////////
CoreExport virtual boolean display(ViewExp *vpt, TimeValue t, Point3 color, \
int markersize, boolean markers = TRUE, boolean hilite = TRUE);
CoreExport void erase(ViewExp *vpt, TimeValue t) const; // the hit can erase itself
CoreExport void GetViewportRect(TimeValue t,ViewExp *vpt,Rect *rect, int marksize)const;
//////////////////////////////////////////////////////////////////////
// Accessor Methods
//////////////////////////////////////////////////////////////////////
CoreExport Point3 GetHitpoint(){return hitpoint;};
CoreExport Point3 GetWorldHitpoint(){return worldpoint;};
CoreExport IPoint3 GetHitscreen(){return m_hitscreen;};
CoreExport int GetSubsnap(){return subsnap;}
CoreExport POINT GetCursor(){return m_cursor;}
INode *GetNode(){return node;}
void Dump()const;
//////////////////////////////////////////////////////////////////////
// Operator Methods
//////////////////////////////////////////////////////////////////////
//define comparators so we can sort a list of these
CoreExport BOOL operator<(OsnapHit& hit);
CoreExport BOOL operator>(OsnapHit& hit);
public:
void Update(TimeValue t);
CoreExport Point3 ReEvaluate(TimeValue t);
virtual bool IsWorldSpaceHit(){return false;}
private: //data
Point3 hitpoint; // the hit location in object space
Point3 worldpoint; // the hit location in world space
IPoint3 m_hitscreen; // the hit location in screen space
POINT m_cursor;//the position of the cursor when this guy was recorded
int m_len; //The distace from the cursor
int m_z_depth; //The depth in z space
BOOL m_complete; //indicates whether the screendata has been set
Osnap* snap; //the snap which made this hit
int subsnap; //the subsnap index that made this hit
OsnapMarker *m_pmarker; //a pointer to this snaps marker
INode* node;// the node which got hit
HitMesh *hitmesh;//a mesh used to hilite the topolgy we hit
ViewExp *m_vpt;//the viewport which was active
BOOL m_invisible;//this guy won't display itself
};
//a class to hold a list of object space points for highlighting the geometry
class HitMesh
{
private:
int m_numverts;
Point3 *m_pverts;
static long m_cref;
public:
CoreExport HitMesh();
CoreExport ~HitMesh();
CoreExport HitMesh(const HitMesh& h);
CoreExport HitMesh(int n);
Point3 operator[](int i){return m_pverts[i];}
int getNumVerts(){return m_numverts;}
void setNumVerts(int n){
if(m_pverts != NULL)
delete [] m_pverts;
m_numverts = n;
m_pverts = new Point3[n];
}
void setVert(int i, const Point3 &xyz){ m_pverts[i] = xyz; }
Point3& getVert(int i){return m_pverts[i];}
Point3* getVertPtr(){return m_pverts;}
};
class TypedHit: public OsnapHit
{
public:
TypedHit(Point3 pt);
virtual boolean display(ViewExp *vpt, TimeValue t, Point3 color, \
int markersize, boolean markers = TRUE, boolean hilite = TRUE);
virtual bool IsWorldSpaceHit(){return true;}
};
#endif //_OSNAPHIT_H

37
lib/maxsdk40/Osnapmk.h Executable file
View File

@ -0,0 +1,37 @@
/**********************************************************************
*<
FILE: osnapmk.h
DESCRIPTION: A Class for an osnapmarker
CREATED BY: John Hutchinson
HISTORY: Feb 12, 1996
*> Copyright (c) 1994, All Rights Reserved.
**********************************************************************/
#ifndef _OSNAP_MARK_H_
#define _OSNAP_MARK_H_
class OsnapMarker
{
private:
int m_numpoints;
IPoint3 *m_ppt;
IPoint3 *m_pcache;
IPoint3 m_cache_trans;
int m_cache_size;
int *m_edgevis;
boolean IsCacheValid(IPoint3 trans, int size);
void UpdateCache(IPoint3 trans, int size);
public:
CoreExport OsnapMarker();
CoreExport ~OsnapMarker();
CoreExport OsnapMarker(int n, IPoint3 *ppt, int *pes);
CoreExport OsnapMarker(const OsnapMarker& om);
CoreExport OsnapMarker& operator=(const OsnapMarker& om);
void display(IPoint3 xyz, int markersize, GraphicsWindow *gw);
};
#endif

BIN
lib/maxsdk40/Paramblk2.lib Executable file

Binary file not shown.

BIN
lib/maxsdk40/Poly.lib Executable file

Binary file not shown.

51
lib/maxsdk40/PrintManager.h Executable file
View File

@ -0,0 +1,51 @@
// ****************************************************************************
//
// DESCRIPTION: Declaration of the Print Manager
// PATTERN : Singleton
// CREATED BY : Michael Pittman
// HISTORY : 12/21/1998
//
// ****************************************************************************
#pragma once
class PrintManager
{
private:
static PrintManager* m_instance; // Singleton instance
HDC m_hdc; // Device context of printer
int m_ncopies; // Number of copies to print
bool m_landscape; // Print in landscape?
PRINTDLG m_pinfo; // Printer info from PrintDlg
PAGESETUPDLG m_pgsetup; // Page Setup info from PageSetupDlg
DEVMODE m_devmode; // Device mode structure
TCHAR m_driver[128]; // Printer driver name
TCHAR m_device[33]; // Printer device name
bool m_use_pgsetup; // User has chosen page setup
PrintManager();
bool SetupPrintFromDialog(HWND parent);
bool SetupPrintExisting(void);
bool SetupPrintDefault(void);
public:
typedef enum { k_UseDefault, k_PromptUser, k_UseExisting } PrinterChoice;
~PrintManager();
// Access to the singleton
CoreExport static PrintManager* Instance(void);
// Query methods
CoreExport HDC GetPrinterDC(PrinterChoice getfrom = k_PromptUser);
CoreExport HDC GetDefaultPrinterDC(void) { return GetPrinterDC(k_UseDefault); }
CoreExport HDC GetExistingPrinterDC(void) { return GetPrinterDC(k_UseExisting); }
CoreExport void ReleasePrinterDC(HDC hdc);
CoreExport int NumberCopies(void) { return m_ncopies; }
CoreExport bool DoLandscape(void) { return m_landscape; }
// The standard print methods interface
CoreExport bool OnPageSetup(HWND parent);
};

91
lib/maxsdk40/RandGenerator.h Executable file
View File

@ -0,0 +1,91 @@
/**********************************************************************
*<
FILE: RandGenerator.h
DESCRIPTION: Generator of random numbers
CREATED BY: Oleg Bayborodin
HISTORY: Nov.17 2000 - created
GOALS: To solve the need in satisfactory generator of random numbers.
DESCRIPTION: The class has interfaces for srand/rand methods of VC++
and other functions for random number generation.
Srand/rand methods from stdlib.h have two main problems:
a) It's not satisfactory random. Since rand() function returns a
pseudorandom integer in the range 0 to 0x7fff=32767, if we
need a lot of random numbers (i.e. for generating 100,000
particles), we are running out of continuity of random num-
bers. Generated random numbers became too discrete.
b) rand() method is global function, not class object. Hence it's
shared between all modules of your plug-in. Changes in one
module may change randomness pattern in other independent
module. To solve this contradiction, rand methods have to be
implemented as a class object.
RandGenerator does exactly that. It has much more random numbers:
RAND_MAX = 0xFFFFFFFF = 4,294,967,295. Also, using instance of
the class, it's much easier to create separate thread of random
numbers for specific module.
*> Copyright (c) 2000, All Rights Reserved.
**********************************************************************/
#ifndef _RANDGENERATOR_H
#define _RANDGENERATOR_H
// to fix conflict between RandGenerator and stdlib.h do the following:
#undef RAND_MAX
const unsigned int RAND_MAX = 0x7fff; // as defined in stdlib.h
class RandGenerator
{
public:
CoreExport RandGenerator(); // constructor
// override for VC++ rand methods
CoreExport static const DWORD32 RAND_MAX;
// The srand function sets the starting point for generating a
// series of pseudorandom integers. To reinitialize the generator,
// use 1 as the seed argument. Any other value for seed sets the
// generator to a random starting point. rand() retrieves the
// pseudorandom numbers that are generated. Calling rand() before
// any call to srand() generates the same sequence as calling srand()
// with seed passed as 1.
CoreExport void srand(DWORD32 seed);
// The rand function returns a pseudorandom integer in the range 0 to RAND_MAX
CoreExport DWORD32 rand( void );
// other useful functions:
// random sign { -1, 1 }
CoreExport int RandSign( void );
// random number between 0.0f and 1.0f
CoreExport float Rand01( void );
// random number between -1.0f and 1.0f
CoreExport float Rand11( void );
// random number between -0.5f and 0.5f
CoreExport float Rand55( void );
// integer random number between 0 and maxnum
CoreExport int Rand0X(int maxnum);
// to check out if the generator has been explicitely initialized
// by srand() method
const bool Valid( void ) const { return m_explicitelyInitialized; }
private:
static const DWORD32 kMagicNumber1, kMagicNumber2;
static const DWORD32 HALF_RAND_MAX;
static const double kIntMax, kIntMax1, kHalfIntMax;
DWORD32 m_randar[256];
DWORD32 m_randX, m_randY;
bool m_explicitelyInitialized;
};
#endif

227
lib/maxsdk40/RenderElements.h Executable file
View File

@ -0,0 +1,227 @@
/////////////////////////////////////////////////////////////////////////
//
//
// Render Element Plug-Ins
//
// Created 4/15/2000 Kells Elmquist
//
#ifndef RENDER_ELEMENTS_H
#define RENDER_ELEMENTS_H
// includes
#include "sfx.h"
// predeclarations
class IllumParams;
#define BEAUTY_RENDER_ELEMENT_CLASS_ID 0x00000001
// Returned by a RenderElement when it is asked to put up its rollup page.
typedef SFXParamDlg IRenderElementParamDlg;
//////////////////////////////////////////////////////////////
//
// RenderElement base interface
//
// class SpecialFX declared in maxsdk/include/render.h
//
class IRenderElement : public SpecialFX
{
public:
// set/get element's enabled state
virtual void SetEnabled(BOOL enabled)=0;
virtual BOOL IsEnabled() const = 0;
// set/get element's filter enabled state
virtual void SetFilterEnabled(BOOL filterEnabled)=0;
virtual BOOL IsFilterEnabled() const =0;
// is this element to be blended for multipass effects?
virtual BOOL BlendOnMultipass() const =0;
// set/get whether to apply atmosphere
// virtual void SetApplyAtmosphere(BOOL applyAtmosphere) =0;
virtual BOOL AtmosphereApplied() const =0;
// virtual void SetApplyShadows(BOOL applyShadows) =0;
virtual BOOL ShadowsApplied() const =0;
// set/get element's name (as it will appear in render dialog)
virtual void SetElementName( TCHAR* newName )=0;
virtual const TCHAR* ElementName() const =0;
/*
// set/get path name for file output
virtual void SetPathName( TCHAR* newPathName)=0;
virtual const TCHAR* PathName() const =0;
virtual void SetBitmap( Bitmap* bitmap)=0;
virtual Bitmap* GetBitmap() const =0;
*/
virtual void SetPBBitmap(PBBitmap* &pPBBitmap) const =0;
virtual void GetPBBitmap(PBBitmap* &pPBBitmap) const =0;
// this is the element specific optional UI, which is a rollup in the render dialog
virtual IRenderElementParamDlg *CreateParamDialog(IRendParams *ip) { return NULL; }
// Implement this if you are using the ParamMap2 AUTO_UI system and the
// IRenderElement has secondary dialogs that don't have the IRenderElement as their 'thing'.
// Called once for each secondary dialog, for you to install the correct thing.
// Return TRUE if you process the dialog, false otherwise.
virtual BOOL SetDlgThing(IRenderElementParamDlg* dlg) { return FALSE; }
// ---------------------
// from class RefMaker
// ---------------------
// it is critical for merging that this code is called at the start of a plug-in's save and load methods.
// SpecialFX's base implementation saves/loads SpecialFX::name, which is used to populate the 'Merge Render Elements'
// dialog box. if a plugin re-implements this function, it should first call IRenderElement::Save(iSave)
// or IRenderElement::Load(iLoad)
IOResult Save(ISave *iSave)
{
name = ElementName();
return SpecialFX::Save(iSave);
}
IOResult Load(ILoad *iLoad)
{
return SpecialFX::Load(iLoad);
}
virtual RefResult NotifyRefChanged(Interval changeInt, RefTargetHandle hTarget, PartID& partID, RefMessage message) { return REF_SUCCEED; }
// ---------------------
// from class Animatable
// ---------------------
SClass_ID SuperClassID() { return RENDER_ELEMENT_CLASS_ID; }
// renderer will call this method to see if IRenderElement is compatible with it
virtual void* GetInterface(ULONG id) =0;
virtual void ReleaseInterface(ULONG id, void *i) =0;
};
//////////////////////////////////////////////////////////////
//
// RenderElement base class for max's default scanline renderer.
// RenderElement plugins that utilize ShadeContext and IllumParams
// should sub-class from here
//
class MaxRenderElement : public IRenderElement
{
protected:
int mShadeOutputIndex;
public:
// this interface's ID
enum { IID = 0xeffeeffe };
// set/get this element's index into the ShadeOutput's array of element channels
void SetShadeOutputIndex(int shadeOutputIndex) { mShadeOutputIndex = shadeOutputIndex; }
int ShadeOutputIndex() const { return mShadeOutputIndex; }
// will be called on each element before call to PostIllum()
virtual void Update(TimeValue timeValue) { }
// compute the element and store in the ShadeContext's ShadeOutput.
virtual void PostIllum(ShadeContext& sc, IllumParams& ip) =0;
// called after atmospheres are computed, to allow elements to handle atmospheres
virtual void PostAtmosphere(ShadeContext& sc, float z, float prevZ) =0;
// ---------------------
// from class Animatable
// ---------------------
// renderer will call this method to see if IRenderElement is compatible with it
virtual void* GetInterface(ULONG id) { return (id == IID) ? this : NULL; }
virtual void ReleaseInterface(ULONG id, void *i) { }
};
//////////////////////////////////////////////////////////////
//
// IRenderElement compatibility interface
//
// The system will ask a Renderer for this interface by calling
// Renderer::GetInterface(IRenderElementCompatible::ICompatibleID).
// If the Renderer returns a pointer to this interface, it is implied that the Renderer
// supports render elements. The system will then call IRenderElementCompatible::IsCompatible()
// to determine if an IRenderElement instance is compatible with it.
//
// To determine compatibility, the Renderer can call IRenderElement::GetInterface()
// (inherited from class Animatable), passing in an interface ID that a compatible IRenderElement
// would understand. If the Renderer receives a valid interface pointer, it can return TRUE to
// IRenderElementCompatible::IsCompatible().
//
// for an example, see class IScanRenderElement below
//
class IRenderElementCompatible
{
public:
// this interface's ID
enum { IID = 0xcafeface };
virtual BOOL IsCompatible(IRenderElement *pIRenderElement) = 0;
};
//////////////////////////////////////////////////////////////
//
// RenderElementMgr base interface
//
#define IREND_ELEM_MGR_INTERFACE Interface_ID(0x95791767, 0x17651746)
class IRenderElementMgr : public FPMixinInterface
{
public:
// called by system to add an element merged from another file
virtual BOOL AppendMergedRenderElement(IRenderElement *pRenderElement) = 0;
virtual BOOL AppendMergedRenderElement(ReferenceTarget *pRenderElement) = 0; // ensures ReferenceTarget is a render element
// adds/removes an instance of IRenderElement to the manager's list
virtual BOOL AddRenderElement(IRenderElement *pRenderElement) = 0;
virtual BOOL AddRenderElement(ReferenceTarget *pRenderElement) = 0; // ensures ReferenceTarget is a render element
virtual BOOL RemoveRenderElement(IRenderElement *pRenderElement) = 0;
virtual BOOL RemoveRenderElement(ReferenceTarget *pRenderElement) = 0; // ensures ReferenceTarget is a render element
virtual void RemoveAllRenderElements() = 0;
// returns number of render elements in manager's list
virtual int NumRenderElements() = 0;
// returns pointer to a specific render element in manager's list -- NULL if invalid index
virtual IRenderElement *GetRenderElement(int index) = 0;
// sets/gets whether element list should be active during a render
virtual void SetElementsActive(BOOL elementsActive) = 0;
virtual BOOL GetElementsActive() const = 0;
// sets/gets whether elements should be displayed in their own viewer
virtual void SetDisplayElements(BOOL displayElements) = 0;
virtual BOOL GetDisplayElements() const = 0;
// sets/gets whether element list should be exported to Combustion file format
virtual void SetCombustionOutputEnabled(BOOL combustionOutEnabled) = 0;
virtual BOOL GetCombustionOutputEnabled() const = 0;
// sets/gets Combustion output path
virtual void SetCombustionOutputPath(const TCHAR *combustionOutputPath) = 0;
virtual void SetCombustionOutputPath(const TSTR& combustionOutputPath) = 0;
virtual const TSTR& GetCombustionOutputPath() const = 0;
virtual const TCHAR* GetCombustionOutputPathPtr() const = 0;
// function publishing
enum
{
fps_AddRenderElement, fps_RemoveRenderElement, fps_RemoveAllRenderElements,
fps_NumRenderElements, fps_GetRenderElement,
fps_SetElementsActive, fps_GetElementsActive,
fps_SetDisplayElements, fps_GetDisplayElements,
fps_SetCombustionOutputEnabled, fps_GetCombustionOutputEnabled,
fps_SetCombustionOutputPath, fps_GetCombustionOutputPath,
};
};
#endif

BIN
lib/maxsdk40/RenderUtil.lib Executable file

Binary file not shown.

1866
lib/maxsdk40/SURF_API.H Executable file

File diff suppressed because it is too large Load Diff

475
lib/maxsdk40/ScanLinePageMgr.h Executable file
View File

@ -0,0 +1,475 @@
//***************************************************************************
// ScanLinePageMgr.h
// A scanline based memory-to-disk pager template
// Christer Janson
// Discreet, A division of Autodesk, Inc.
// San Francisco, CA - November 15, 1999
#ifndef _SCANLINEPAGEMGR__H_
#define _SCANLINEPAGEMGR__H_
#include <io.h>
#include <fcntl.h>
#include <sys\stat.h>
#define SCANLINE_PAGE_INMEMORY 0x01
#define SCANLINE_PAGE_NEEDWRITE 0x02
#define SCANLINE_PAGE_HASDISKSTORAGE 0x04
#define SCANLINE_PAGE_LOCKED 0x08
#define SCANLINE_PAGE_VALIDDISK 0x10
template <class T> class ScanLinePage {
public:
ScanLinePage(int width, int numScanLines, int firstScanLine, int pageSize, int fileIndex)
{
mFlags = 0;
mLockCount = 0;
mWidth = width;
mNumScanLines = numScanLines;
mFirstScanLine = firstScanLine;
mFileIndex = fileIndex;
mPageSize = pageSize;
mData = NULL;
ClearInMemory();
ClearValidDisk();
SetHasDiskStorage();
ClearNeedWrite();
}
ScanLinePage(int width, int height, bool* allocOk)
{
mFlags = 0;
mLockCount = 0;
mWidth = width;
mNumScanLines = height;
mFirstScanLine = 0;
mFileIndex = 0;
mPageSize = 0;
mData = (T*)malloc(width*height*sizeof(T));
if (mData) {
*allocOk = true;
memset(mData, 0, width*height*sizeof(T));
}
else {
*allocOk = false;
}
SetInMemory();
ClearHasDiskStorage();
ClearNeedWrite();
ClearValidDisk();
}
~ScanLinePage()
{
if (mData) {
free(mData);
}
}
void PreparePage(int fileHandle)
{
// If it's allocated, it's already prepared
if (!mData) {
mData = (T*)malloc(mPageSize);
SetInMemory();
if (GetValidDisk()) {
ReadPage(fileHandle);
}
else {
memset(mData, 0, mPageSize);
}
}
}
void FlushPage(int fileHandle)
{
if (GetHasDiskStorage() && !IsPageLocked()) {
if (GetInMemory()) {
if (GetNeedWrite()) {
WritePage(fileHandle);
}
free(mData);
mData = NULL;
ClearInMemory();
}
}
}
T* GetBuffer(int scanline, bool needWrite)
{
if (needWrite) {
SetNeedWrite();
}
return &mData[(scanline-mFirstScanLine)*mWidth];
}
T* GetBuffer()
{
if (GetInMemory())
return mData;
else
return NULL;
}
void LockPage() { mLockCount++; }
void UnlockPage() { mLockCount--; }
bool IsPageLocked() { return (mLockCount > 0) ? true : false; }
private:
void SetInMemory() { mFlags |= SCANLINE_PAGE_INMEMORY; }
void ClearInMemory() { mFlags &= ~SCANLINE_PAGE_INMEMORY; }
bool GetInMemory() { return (mFlags & SCANLINE_PAGE_INMEMORY) ? true : false; }
void SetNeedWrite() { mFlags |= SCANLINE_PAGE_NEEDWRITE; }
void ClearNeedWrite(){ mFlags &= ~SCANLINE_PAGE_NEEDWRITE; }
bool GetNeedWrite() { return (mFlags & SCANLINE_PAGE_NEEDWRITE) ? true : false; }
void SetHasDiskStorage() { mFlags |= SCANLINE_PAGE_HASDISKSTORAGE; }
void ClearHasDiskStorage() { mFlags &= ~SCANLINE_PAGE_HASDISKSTORAGE; }
bool GetHasDiskStorage() { return (mFlags & SCANLINE_PAGE_HASDISKSTORAGE) ? true : false; }
void SetValidDisk() { mFlags |= SCANLINE_PAGE_VALIDDISK; }
void ClearValidDisk(){ mFlags &= ~SCANLINE_PAGE_VALIDDISK; }
bool GetValidDisk() { return (mFlags & SCANLINE_PAGE_VALIDDISK) ? true : false; }
int GetFileIndex() { return mFileIndex; }
int GetPageSize() { return mPageSize; }
void ReadPage(int fileHandle)
{
int fileIndex = GetFileIndex();
int pageSize = GetPageSize();
_lseek(fileHandle, fileIndex, SEEK_SET);
_read(fileHandle, mData, pageSize);
ClearNeedWrite();
SetInMemory();
}
void WritePage(int fileHandle)
{
int fileIndex = GetFileIndex();
int pageSize = GetPageSize();
_lseek(fileHandle, fileIndex, SEEK_SET);
_write(fileHandle, mData, pageSize);
ClearNeedWrite();
SetValidDisk();
}
private:
T* mData;
int mFileIndex;
int mFirstScanLine;
int mNumScanLines;
int mWidth;
int mPageSize;
int mLockCount;
BYTE mFlags;
};
template <class T> class ScanLinePageMgr {
public:
ScanLinePageMgr()
{
mFileHandle = -1;
mScanLinesPerPage = 0;
mNumPages = 0;
mWidth = 0;
mFilename = NULL;
mIsPaged = 0;
SYSTEM_INFO si;
GetSystemInfo(&si);
mNumPagesInMemory = 2*si.dwNumberOfProcessors;
pMru = new int[mNumPagesInMemory];
InitializeCriticalSection(&cs);
for (int p=0; p<mNumPagesInMemory; p++) {
pMru[p] = -1;
}
}
bool Initialize(int width, int height, int memThreshold, int pageSize)
{
mWidth = width;
int totalSize = width * height * sizeof(T);
if (memThreshold && (totalSize > memThreshold)) {
mIsPaged = true;
char baseName[_MAX_PATH];
char fn[_MAX_PATH];
// TBD: Need a system page directory
strcpy(baseName, GetCOREInterface()->GetDir(APP_AUTOBACK_DIR));
if (strlen(baseName) && baseName[strlen(baseName)-1] != '\\') {
strcat(baseName, "\\");
}
// Generate a unique filename
bool bGotUniqueName = false;
int tmpIndex = 0;
while (!bGotUniqueName) {
sprintf(fn, "%s3dsmax_pager%d.tmp", baseName, tmpIndex);
if (_access(fn, 0) !=0) {
bGotUniqueName = true;
}
tmpIndex++;
}
mFilename = (char*)malloc(strlen(fn)+1);
if (!mFilename) {
return false;
}
strcpy(mFilename, fn);
// These temporary files are deleted by the system when the last handle is closed.
mFileHandle = _open(mFilename, _O_CREAT | O_TRUNC | _O_TEMPORARY | _O_RDWR | _O_BINARY, _S_IREAD | _S_IWRITE);
if (mFileHandle == -1) {
return false;
}
if (_chsize(mFileHandle, totalSize) == -1) {
return false;
}
int scanLineSize = width*sizeof(T);
if (pageSize < scanLineSize) {
pageSize = scanLineSize;
}
// By rounding up the pageSize we get it aligned to the actual scanLine boundaries.
mScanLinesPerPage = pageSize/scanLineSize;
pageSize = mScanLinesPerPage*scanLineSize;
mNumPages = height/mScanLinesPerPage;
if (mNumPages*mScanLinesPerPage < height)
mNumPages++;
for (int i=0; i<mNumPages; i++) {
int fileIndex = i*pageSize;
ScanLinePage<T>* page = new ScanLinePage<T>(width, mScanLinesPerPage, mScanLinesPerPage*i, pageSize, fileIndex);
if (!page) {
_close(mFileHandle);
return false;
}
mPageTable.Append(1, &page, mNumPages);
}
}
else {
mIsPaged = false;
mFilename = NULL;
bool allocOk = false;
ScanLinePage<T>* page = new ScanLinePage<T>(width, height, &allocOk);
if (!page) {
return false;
}
if (!allocOk) {
delete page;
return false;
}
mPageTable.Append(1, &page, 0);
}
return true;
}
~ScanLinePageMgr()
{
for (int i=0; i<mPageTable.Count(); i++) {
ScanLinePage<T>* page = mPageTable[i];
delete page;
}
mPageTable.ZeroCount();
mPageTable.Shrink();
if (mIsPaged) {
_close(mFileHandle);
free(mFilename);
}
delete [] pMru;
DeleteCriticalSection(&cs);
}
// Returns a pointer to the storage is the map is not paged.
T* GetBuffer()
{
if (!mIsPaged)
{
return mPageTable[0]->GetBuffer();
}
return NULL;
}
const T* OpenScanLine(int scanline)
{
if (!mIsPaged) {
return mPageTable[0]->GetBuffer(scanline, false);
}
else {
int activePage = GetPageIndex(scanline);
EnterCriticalSection(&cs);
AddPageToMRU(activePage);
FlushUnusedPages();
ScanLinePage<T>* page = GetPage(activePage);
page->LockPage();
page->PreparePage(GetFileHandle());
LeaveCriticalSection(&cs);
return page->GetBuffer(scanline, false);
}
}
void CloseScanLine(int scanline)
{
if (mIsPaged) {
int activePage = GetPageIndex(scanline);
EnterCriticalSection(&cs);
ScanLinePage<T>* page = GetPage(activePage);
page->UnlockPage();
LeaveCriticalSection(&cs);
}
}
bool PutScanLine(int scanline, const T* buf)
{
if (!mIsPaged) {
memcpy(mPageTable[0]->GetBuffer(scanline, true), buf, mWidth*sizeof(T));
}
else {
int activePage = GetPageIndex(scanline);
EnterCriticalSection(&cs);
AddPageToMRU(activePage);
FlushUnusedPages();
ScanLinePage<T>* page = GetPage(activePage);
page->LockPage();
page->PreparePage(GetFileHandle());
memcpy(page->GetBuffer(scanline, true), buf, mWidth*sizeof(T));
page->UnlockPage();
LeaveCriticalSection(&cs);
}
return true;
}
T GetPixel(int x, int y)
{
T col = (T)0;
const T* buffer = OpenScanLine(y);
if (buffer) {
col = buffer[x];
}
CloseScanLine(y);
return col;
}
void PutPixel(int x, int y, T color)
{
if (!mIsPaged) {
T* buffer = mPageTable[0]->GetBuffer(y, true);
buffer[x] = color;
}
else {
int activePage = GetPageIndex(y);
EnterCriticalSection(&cs);
AddPageToMRU(activePage);
FlushUnusedPages();
ScanLinePage<T>* page = GetPage(activePage);
page->LockPage();
page->PreparePage(GetFileHandle());
T* buffer = page->GetBuffer(y, true);
buffer[x] = color;
page->UnlockPage();
LeaveCriticalSection(&cs);
}
}
private:
int GetPageIndex(int scanline)
{
int pageId = mIsPaged ? (int)((float)scanline / (float)mScanLinesPerPage) : 0;
return pageId;
}
void AddPageToMRU(int page)
{
// speed up multiple access as it's most likely to be on top
if (pMru[0] == page)
return;
int nListPos = -1;
// See if page is in the MRU
for (int p=0; p<mNumPagesInMemory; p++) {
if (page == pMru[p]) {
nListPos = p;
break;
}
}
if (nListPos != -1) {
// Page is in the MRU list, move it to the top
for (int p=nListPos; p>0; p--) {
pMru[p] = pMru[p-1];
}
pMru[0] = page;
}
else {
// Page is not in the MRU list, put it at the top of the list
for (int p=(mNumPagesInMemory-1); p>0; p--) {
pMru[p] = pMru[p-1];
}
pMru[0] = page;
}
}
ScanLinePage<T>* GetPage(int pageIndex) { return mPageTable[pageIndex]; }
void FlushUnusedPages()
{
int numPages = GetNumPages();
for (int i=0; i<numPages; i++) {
bool bInMru = false;
for (int p=0; p<mNumPagesInMemory; p++) {
if (i == pMru[p]) {
bInMru = true;
break;
}
}
if (!bInMru) {
mPageTable[i]->FlushPage(GetFileHandle());
}
}
}
int GetFileHandle() { return mFileHandle; }
int GetNumPages() { return mNumPages; }
private:
Tab <ScanLinePage<T>*> mPageTable;
int mFileHandle;
int mScanLinesPerPage;
int mNumPages;
int mWidth;
char* mFilename;
bool mIsPaged;
int mNumPagesInMemory;
int* pMru;
CRITICAL_SECTION cs;
};
#endif

43
lib/maxsdk40/SetKeyMode.h Executable file
View File

@ -0,0 +1,43 @@
/*********************************************************************
*<
FILE: SetKeyMode.h
DESCRIPTION: Interface to set-key mode related APIs
CREATED BY: Rolf Berteig
HISTORY: Created November 29, 2000
*> Copyright (c) 2000, All Rights Reserved.
**********************************************************************/
#ifndef __SETKEYMODE_H__
#define __SETKEYMODE_H__
#define I_SETKEYMODE 0x00002000
// Gets a pointer to the SetKeyModeInterface interface, the caller should pass a pointer to "Interface"
#define GetSetKeyModeInterface(i) ((SetKeyModeInterface*)i->GetInterface(I_SETKEYMODE))
class SetKeyModeCallback : public InterfaceServer {
public:
virtual void SetKey()=0; // Called when user executes set key command
virtual void ShowUI()=0; // Display set key floater window
virtual void SetKeyModeStateChanged()=0;// Called when user enters or exits set-key mode
};
class SetKeyModeInterface : public InterfaceServer {
public:
virtual void RegisterSetKeyModeCallback(SetKeyModeCallback *cb)=0;
virtual void UnRegisterSetKeyModeCallback(SetKeyModeCallback *cb)=0;
virtual void ActivateSetKeyMode(BOOL onOff)=0;
virtual void AllTracksCommitSetKeyBuffer()=0;
virtual void AllTracksRevertSetKeyBuffer()=0;
virtual BOOL AllTracksSetKeyBufferPresent()=0;
};
#endif //__SETKEYMODE_H__

105
lib/maxsdk40/SpaceArrayCallback.h Executable file
View File

@ -0,0 +1,105 @@
////////////////////////////////////////////////////////////////////////////////
// Module: SpaceArrayCallback.H
// Purpose: SpaceArrayCallback class definition
// Author: Peter Sauerbrei
// HISTORY: - created January 1998
// - changed object type to CloneType 01/28/98 (PJS)
// - changed CloneType back to OTYPE 01/30/98 (PJS)
// - added proc to act as callback 02/02/98 (PJS)
// - added new context modes 02/17/98 (PJS)
//
#ifndef __SPACEARRAYCALLBACK_H
#define __SPACEARRAYCALLBACK_H
// include files
#include <limits.h>
#include <max.h>
#include <splshape.h>
// needed types
enum STYPE { SPACE_CENTER, SPACE_EDGE };
enum OTYPE { NODE_CPY, NODE_INST, NODE_REF };
enum CTYPE { CTXT_FREE, CTXT_CNTRCOUNT, CTXT_CNTRSPACE,
CTXT_END, CTXT_ENDCOUNT, CTXT_ENDSPACE,
CTXT_START, CTXT_STARTCOUNT, CTXT_STARTSPACE,
CTXT_FULLSPACE, CTXT_FULLCOUNT, CTXT_ENDLOCK,
CTXT_ENDLOCKCOUNT, CTXT_ENDLOCKSPACE, CTXT_STARTLOCK,
CTXT_STARTLOCKCOUNT, CTXT_STARTLOCKSPACE,
CTXT_FULLLOCKSPACE, CTXT_FULLLOCKCOUNT,};
////////////////////////////////////////////////////////////////////////////////
// SpaceArracyCallback
//
class SpaceArrayCallback
{
private:
ShapeObject * path;
float start, end, space;
int count;
OTYPE oType;
bool follow;
STYPE sType;
CTYPE context;
float width;
char buffer[100];
int countLimit;
public:
SpaceArrayCallback() { path = NULL; start = end = space = 0.0f; count = 1; oType = NODE_CPY; sType = SPACE_CENTER; follow = false;
context = CTXT_FREE; width = 0.0f; countLimit = INT_MAX; }
virtual ~SpaceArrayCallback() {}
// methods
virtual bool isModal(void) { return true; }
virtual bool doPickPath(void) { return false; }
virtual TCHAR * dialogTitle(void) { return _T(""); }
virtual TCHAR * startMessage(void) { return _T(""); }
virtual TCHAR * buttonText(void) { return _T("OK"); }
virtual bool isSilent(void) { return false; }
virtual bool doObjectType(void) { return true; }
virtual void proc(void) {}
// accessors
ShapeObject * getPath(void) { return path; }
void setPath(ShapeObject * p) { path = p; }
void setPath(Point3 pt1, Point3 pt2) { path = new SplineShape;
((SplineShape *)path)->shape.Init();
((SplineShape *)path)->shape.NewSpline();
Spline3D * spline = ((SplineShape *)path)->shape.GetSpline(0);
spline->AddKnot(SplineKnot(KTYPE_CORNER, LTYPE_LINE, pt1, pt1, pt1));
spline->AddKnot(SplineKnot(KTYPE_CORNER, LTYPE_LINE, pt2, pt2, pt2));
spline->ComputeBezPoints();
}
void setPath(Spline3D *s) { path = new SplineShape;
((SplineShape *)path)->shape.Init();
((SplineShape *)path)->shape.AddSpline(s);
s->ComputeBezPoints();
}
float getStart(void) { return start; }
float getEnd(void) { return end; }
float getSpace(void) { return space; }
int getCount(void) { return count; }
int getContext(void) { return context; }
float getWidth(void) { return width; }
void setStart(float f) { start = f; }
void setEnd(float f) { end = f; }
void setSpace(float f) { space = f; }
void setCount(int n) { count = n > countLimit ? countLimit : n; }
bool getFollow(void) { return follow; }
void setFollow(bool t) { follow = t; }
void setContext(CTYPE c) { context = c; }
OTYPE getObjectCreationType(void) { return oType; }
void setObjectCreationType(OTYPE t) { oType = t; }
STYPE getSpacingType(void){ return sType; }
void setSpacingType(STYPE s) { sType = s; }
void setMessage(char * buf) { strcpy(buffer, buf); }
void setWidth(float nWidth) { width = nWidth; }
void setCountLimit(int limit) { countLimit = limit; }
int getCountLimit(void) { return countLimit; }
};
#endif

344
lib/maxsdk40/SpringSys.h Executable file
View File

@ -0,0 +1,344 @@
/**********************************************************************
*<
FILE: SpringSys.h
DESCRIPTION: Public header files for the Spring System created by Adam Felt.
To use this interface you will need to link to "SpringSys.lib"
This spring system is a multi-point spring-based dynamic system.
In order to your the sytem you must derive from SpringSysClient and implement
Tab<Matrix3> SpringSysClient::GetForceMatrices(TimeValue t)
You are responsible for gathering the spring constraint forces at any given time.
You initialize the
CREATED BY: Adam Felt
HISTORY:
*> Copyright (c) 1999-2000, All Rights Reserved.
**********************************************************************/
#include "max.h"
#ifndef AF_SPRINGSYS
#define AF_SPRINGSYS
#ifndef SpringSysExport
# ifdef BLD_SPRING_SYS
# define SpringSysExport __declspec( dllexport )
# else
# define SpringSysExport __declspec( dllimport )
# endif
#endif
//A Controlled Particle Class
//Used to constrain a point to an object
class SSConstraintPoint
{
public:
int index; //this bone index is used to identify the bone.
//Usually refers to a reference index, or paramblock index...
Point3 pos; //The control nodes stored position
Point3 vel; //The control nodes stored velocity
SSConstraintPoint() {index = -1; pos = Point3(0.0f, 0.0f, 0.0f); vel = Point3(0.0f, 0.0f, 0.0f);}
SSConstraintPoint(int id) {index = id; pos = Point3(0.0f, 0.0f, 0.0f); vel = Point3(0,0,0);}
~SSConstraintPoint() {}
SSConstraintPoint& operator=(const SSConstraintPoint& from)
{
index = from.index;
pos = from.pos;
vel = from.vel;
return *this;
}
SSConstraintPoint Copy(const SSConstraintPoint from)
{
index = from.index;
pos = from.pos;
vel = from.vel;
return *this;
}
int GetIndex() { return index; }
void SetIndex(int id) { index = id; }
Point3 GetPos() { return pos; }
void SetPos(Point3 p) { pos = p; }
Point3 GetVel() { return vel; }
void SetVel(Point3 v) { vel = v; }
};
//Class used to store a particles state
class SSParticleCache
{
public:
Point3 pos;
Point3 vel;
Tab<SSConstraintPoint> bone;
SSParticleCache() {pos = Point3(0,0,0); vel = Point3(0,0,0); bone.Init(); }
};
//A Spring Class
//Stores the parameters for binding an object to any force with a controllable spring
class SSSpring : public BaseInterfaceServer
{
private:
float tension;
float dampening;
Point3 length; //rest length
SSConstraintPoint bone;
//AFParticle *p2; //for use later to apply the reactive force
public:
SSSpring()
{
bone = NULL;
length = Point3(0.0f, 0.0f, 0.0f);
tension = 1.0f;
dampening = 0.5f;
}
SSSpring(SSConstraintPoint *b, Point3 l, float t=2.0f, float d=1.0f)
{
bone = *b;
length = l;
tension = t;
dampening = d;
}
SSSpring& operator=(const SSSpring& from)
{
tension = from.tension;
dampening = from.dampening;
length = from.length;
bone = from.bone;
return *this;
}
SSSpring Copy(const SSSpring from)
{
tension = from.tension;
dampening = from.dampening;
length = from.length;
bone = from.bone;
return *this;
}
float GetTension() {return tension;}
void SetTension(float t) {tension = t;}
float GetDampening() {return dampening;}
void SetDampening(float d) {dampening = d;}
Point3 GetLength() {return length;}
void SetLength(Point3 len) {length = len;}
SSConstraintPoint* GetPointConstraint() { return &bone;}
void SetPointConstraint(SSConstraintPoint b) { bone = b; }
void SetPointConstraint(int id, Point3 pos, Point3 vel)
{
bone.SetIndex(id);
bone.SetPos(pos);
bone.SetVel(vel);
}
};
class SSParticle
{
friend class SpringSys;
private:
float mass; //the particle's mass
float drag; //the particle's drag coefficient
Point3 pos; //particle position
Point3 vel; //particle velocity
Point3 force; //Force accumulator
Tab<SSSpring> springs;
public:
SSParticle()
{
mass = 300.0f;
drag = 1.0f;
pos = vel = force = Point3(0.0f,0.0f,0.0f);
springs.ZeroCount();
}
~SSParticle(){}
SSParticle& operator=(const SSParticle& from)
{
mass = from.mass;
drag = from.drag;
pos = from.pos;
vel = from.vel;
force = from.force;
springs.ZeroCount();
springs.Shrink();
for (int i=0;i<from.springs.Count();i++)
{
SSSpring spring = from.springs[i];
springs.Append(1, &spring);
}
return *this;
}
SSParticle Copy(const SSParticle from)
{
SSSpring spring;
mass = from.mass;
drag = from.drag;
pos = from.pos;
vel = from.vel;
force = from.force;
springs.ZeroCount();
for (int i=0;i<from.springs.Count();i++)
{
spring.Copy(from.springs[i]);
springs.Append(1, &spring);
}
return *this;
}
float GetMass() {return mass;}
void SetMass(float m) {mass = m;}
float GetDrag() {return drag;}
void SetDrag(float d) {drag = d;}
Point3 GetPos() {return pos;}
void SetPos(Point3 p) {pos = p;}
Point3 GetVel() {return vel;}
void SetVel(Point3 v) {vel = v;}
Point3 GetForce() {return force;}
void SetForce(Point3 f) {force = f;}
Tab<SSSpring>* GetSprings() { return &springs;}
SSSpring* GetSpring(int i) {if (i>=0 && i<springs.Count()) return &(springs[i]);
else return NULL; }
void SetSpring(int i, SSSpring spring) {if (i>=0 && i<springs.Count())
springs[i] = spring; }
void SetSprings(Tab<SSSpring> sTab)
{
//springs = NULL;
springs.ZeroCount();
for (int i = 0;i<sTab.Count();i++)
{
springs.Append(1, &(sTab[i]));
}
}
BOOL AddSpring(SSConstraintPoint *bone, Point3 length, float tension=2.0f, float dampening = 1.0f)
{
for (int i=0;i<springs.Count();i++)
{
//if it already exists in the list make it stronger
if ( springs[i].GetPointConstraint()->GetIndex() == bone->GetIndex() )
{ springs[i].SetTension( springs[i].GetTension()*2 ); return false; }
}
//if it doesn't exist, add a new one
SSSpring *spring = new SSSpring(bone, length, tension, dampening);
springs.Append(1, spring);
return true;
}
void DeleteSpring(int index)
{
if ( index == 0 ) return;
for (int i=0;i<springs.Count();i++)
{
if ( (springs[i].GetPointConstraint()->GetIndex()) == index)
springs.Delete(i--, 1);
else if (springs[i].GetPointConstraint()->GetIndex() > index)
springs[i].GetPointConstraint()->SetIndex(springs[i].GetPointConstraint()->GetIndex()-1);
}
}
};
class SpringSysClient
{
public:
virtual Tab<Matrix3> GetForceMatrices(TimeValue t)=0;
virtual Point3 GetDynamicsForces(TimeValue t, Point3 pos, Point3 vel) {return Point3(0,0,0);}
};
class SpringSys : public BaseInterfaceServer
{
private:
float referenceTime;
float lastTime;
bool isValid;
SSParticleCache frameCache;
Tab<Point3> pos_cache;
Tab<Point3> vel_cache;
Tab<Point3> initPosTab;
Tab<SSParticle> parts; //particles
SpringSysClient* client;
public:
SpringSys()
{
client = NULL;
referenceTime = lastTime = 0.0f;
SetParticleCount(1);
isValid = false;
}
SpringSys(SpringSysClient* c, int count)
{
client = c;
referenceTime = lastTime = 0.0f;
SetParticleCount(count);
isValid = false;
}
~SpringSys() {}
SpringSysExport SpringSys& operator=(const SpringSys& from);
SpringSysExport SpringSys Copy(const SpringSys* from);
void SetReferenceTime (float t) { referenceTime = t; }
float GetReferenceTime () { return referenceTime; }
Tab<SSParticle>* GetParticles() { return &parts;}
SSParticle* GetParticle(int i) { if (i >=0 && i< parts.Count()) return &(parts[i]);
else return NULL; }
SpringSysExport void SetParticleCount(int count);
SpringSysExport void SetInitialPosition (Point3 p, int partIndex);
SpringSysExport void SetInitialVelocity (Point3 p, int partIndex);
SpringSysExport void SetInitialBoneStates(Tab<Matrix3> boneTMs);
SpringSysExport void Invalidate ();
SpringSysExport void Solve (int time, float TimeDelta);
SpringSysExport void GetPosition (Point3& p, int index);
SpringSysExport IOResult Load(ILoad *iload);
SpringSysExport IOResult Save(ISave *isave);
protected:
float GetTime() { return lastTime; }
void SetTime(float t) { lastTime = t; }
//force functions
SpringSysExport void Clear_Forces(int index);
SpringSysExport void Compute_Forces(TimeValue t, int index);
SpringSysExport void ApplyDrag(int index);
SpringSysExport void ApplyUnaryForces(TimeValue t, int index);
SpringSysExport void ComputeControlledParticleForce(Matrix3 tm, int vertIndex, int springIndex);
SpringSysExport void ApplySpring(TimeValue t, int index);
//Solver functions
SpringSysExport void UpdateParticleState(TimeValue t, Tab<Matrix3> tmArray, int pIndex, TimeValue Delta);
SpringSysExport void ComputeDerivative(int index, Point3 &pos, Point3 &vel);
SpringSysExport void GetParticleState(int index, Point3 &pos, Point3 &vel);
SpringSysExport void SetParticleState(int index, Point3 pos, Point3 vel);
SpringSysExport void ScaleVectors(Point3 &pos, Point3 &vel, float delta);
SpringSysExport void AddVectors(Point3 pos1, Point3 vel1, Point3 &pos, Point3 &vel);
};
#endif //AF_SPRINGSYS

BIN
lib/maxsdk40/SpringSys.lib Executable file

Binary file not shown.

216
lib/maxsdk40/SvCore.h Executable file
View File

@ -0,0 +1,216 @@
#pragma once
typedef enum
{
SVT_PROCEED,
SVT_EXISTS,
SVT_DO_NOT_PROCEED,
} SvTraverseStatus;
typedef enum
{
REFTYPE_CHILD,
REFTYPE_SUBANIM,
REFTYPE_PLUGIN,
} SvReferenceType;
// Filter bits...
static const DWORD SV_FILTER_SELOBJECTS = (1<<0);
static const DWORD SV_FILTER_OBJECTMODS = (1<<1);
static const DWORD SV_FILTER_BASEPARAMS = (1<<2);
static const DWORD SV_FILTER_MATPARAMS = (1<<3);
static const DWORD SV_FILTER_GEOM = (1<<4);
static const DWORD SV_FILTER_SHAPES = (1<<5);
static const DWORD SV_FILTER_LIGHTS = (1<<6);
static const DWORD SV_FILTER_CAMERAS = (1<<7);
static const DWORD SV_FILTER_HELPERS = (1<<8);
static const DWORD SV_FILTER_WARPS = (1<<9);
static const DWORD SV_FILTER_VISIBLE_OBJS = (1<<10);
static const DWORD SV_FILTER_CONTROLLERS = (1<<11);
static const DWORD SV_FILTER_ANIMATEDONLY = (1<<12);
static const DWORD SV_FILTER_MAPS = (1<<13);
static const DWORD SV_FILTER_BONES = (1<<14);
// Schematic view UI colors...
static const int SV_UICLR_WINBK = 0;
static const int SV_UICLR_NODEBK = 1;
static const int SV_UICLR_SELNODEBK = 2;
static const int SV_UICLR_NODE_HIGHLIGHT = 3;
static const int SV_UICLR_MATERIAL_HIGHLIGHT = 4;
static const int SV_UICLR_MODIFIER_HIGHLIGHT = 5;
static const int SV_UICLR_PLUGIN_HIGHLIGHT = 6;
static const int SV_UICLR_SUBANIM_LINE = 7;
static const int SV_UICLR_CHILD_LINE = 8;
static const int SV_UICLR_FRAME = 9;
static const int SV_UICLR_SELTEXT = 10;
static const int SV_UICLR_TEXT = 11;
static const int SV_UICLR_FOCUS = 12;
static const int SV_UICLR_MARQUIS = 13;
static const int SV_UICLR_COLLAPSEARROW = 14;
static const int SV_UICLR_GEOMOBJECT_BK = 15;
static const int SV_UICLR_LIGHT_BK = 16;
static const int SV_UICLR_CAMERA_BK = 17;
static const int SV_UICLR_SHAPE_BK = 18;
static const int SV_UICLR_HELPER_BK = 19;
static const int SV_UICLR_SYSTEM_BK = 20;
static const int SV_UICLR_CONTROLLER_BK = 21;
static const int SV_UICLR_MODIFIER_BK = 22;
static const int SV_UICLR_MATERIAL_BK = 23;
static const int SV_UICLR_MAP_BK = 24;
static const int SV_UICLR_CACHE_SIZE = 25;
// Magic value returned from Animatable::SvGetSwatchColor(...)
// to indicate that no swatch is to be drawn...
static const int SV_NO_SWATCH = 0xFFFFFFFF;
//-------------------------------------------------------------------------
// Bit flags which can be passed to IGraphObjectManager::AddAnimatable(...)
// and Animatable::SvTraverseAnimGraph(....)
//-------------------------------------------------------------------------
// If set, newly created node will be in the hidden state. If the node
// already exists in the graph, the flag is ignored...
static const DWORD SV_INITIALLY_HIDDEN = 0x00000001;
// If set, shared instances of an animatable will produce multiple
// graph nodes in the schematic view instead of a single shared graph node...
static const DWORD SV_DUPLICATE_INSTANCES = 0x00000002;
// If set, the newly created children of the newly created node
// will be in the hidden state. If the node already exists in the graph,
// the flag is ignored. Children of this node that already exist in
// the graph will not have their visibility state changed...
static const DWORD SV_INITIALLY_CLOSED = 0x00000004;
//-------------------------------------------------------------------------
// Flags which can be passed to IGraphObjectManager::PushLevel(...)
//-------------------------------------------------------------------------
// This id, when passed to PushLevel(), indicates that no id is to be associated
// with Animatable being pushed onto the stack...
static const int SV_NO_ID = 0x80000000;
class IGraphNode;
class Animatable;
class IGraphObjectManager;
class MultiSelectCallback
{
public:
virtual int Priority() = 0; // Used for sorting select order.
virtual void Begin(IGraphObjectManager *gom, bool clear) = 0;
virtual void Select(IGraphObjectManager *gom, IGraphNode *gNode, bool isSelected) = 0;
virtual void End(IGraphObjectManager *gom) = 0;
};
class IGraphRef
{
public:
};
class IGraphNode
{
public:
// Returns the Animatable associated with this node...
virtual Animatable *GetAnim() = 0;
// Returns the "primary parent" of this node. Nodes
// can have multiple parents (objects referencing
// this node) so this function is not strictly
// accurate. That said, many nodes have the
// concept of an owner node, which is what this
// function returns.
virtual IGraphNode *GetParentNode() = 0;
// Returns the "owner" of this node. Some nodes
// have multiple owners. When this is the case, this
// function returns the "first" owner (the object
// that first added this node to the schematic view)...
virtual Animatable *GetOwner() = 0;
// Return the "id" of this node. When nodes are
// added to the schematic view (via the
// IGraphObjectManager::AddAnimatable(...) method),
// an integer is provided. This value is is not
// used internally by the schematic view. Rather,
// it is available to implementers of the
// Animatable::Sv*() methods to aid in identifying
// the node.
virtual int GetID() = 0;
};
class SvGraphNodeReference
{
public:
IGraphNode *gNode;
SvTraverseStatus stat;
SvGraphNodeReference()
{
gNode= NULL;
stat = SVT_DO_NOT_PROCEED;
}
};
class IGraphObjectManager
{
public:
// During traversal of the Animatable graph via SvTraverseAnimGraph(...),
// PushLevel() and PopLevel() should be called appropriately to
// maintain an ownership stack. This is required by the schematic view
// when nodes are added to the graph with the "SV_DUPLICATE_INSTANCES"
// flag set...
virtual void PushLevel(Animatable *anim, int id = SV_NO_ID) = 0;
virtual void PopLevel() = 0;
// Adds an Animatable to the schematic view...
virtual SvGraphNodeReference AddAnimatable(Animatable *anim, Animatable *owner, int id, DWORD flags = 0) = 0;
// Add a reference from "maker" node to "target"...
virtual IGraphRef *AddReference(IGraphNode *maker, IGraphNode *target, SvReferenceType type) = 0;
// Pops up the property editor dialog on the
// selected nodes in the schematic view...
virtual void SvEditSelectedNodeProperties() = 0;
// Selects the given node in the material editor.
// Does nothing if "gNode" does not represent a
// material or map...
virtual void SvSelectInMaterialEditor(IGraphNode *gNode) = 0;
// Selects the given node in the modifier panel.
// Does nothing if "gNode" does not represent an
// object...
virtual void SvSetCurEditObject(IGraphNode *gNode) = 0;
// Returns true if the given node is current
// in the modifier panel...
virtual bool SvIsCurEditObject(IGraphNode *gNode) = 0;
virtual bool ApplyModifier(IGraphNode *gModNode, IGraphNode *gParentNode) = 0;
virtual bool DeleteModifier(IGraphNode *gNode) = 0;
// Invalidates the schematic view window...
virtual void SvInvalidateView() = 0;
// Invalidates a node in the schematic view window...
virtual void SvInvalidateNode(IGraphNode *gNode) = 0;
// Forces the material editor to update...
virtual void SvUpdateMaterialEditor() = 0;
// Forces the modifier panel to update...
virtual void SvUpdateModifierPanel() = 0;
// Set, Clear and Test filter flags...
virtual void SetFilter(DWORD mask) = 0;
virtual void ClearFilter(DWORD mask) = 0;
virtual bool TestFilter(DWORD mask) = 0;
// Get a SV UI color given a color index...
virtual COLORREF SvGetUIColor(int colorIndex) = 0;
};

13
lib/maxsdk40/SystemUtilities.h Executable file
View File

@ -0,0 +1,13 @@
//***************************************************************************
// SystemUtilities.h
// A collection of system utilities
// Christer Janson
// Discreet, A division of Autodesk, Inc.
// San Francisco, CA - March 27, 2000
UtilExport bool IsDebugging(); // Are we running under a debugger?
UtilExport int NumberOfProcessors(); // Number of processors in the system.
UtilExport bool IsWindows9x(); // Are we running on Windows 9x?
UtilExport bool IsWindows98or2000(); // Are we running on Windows 98 or 2000?
UtilExport int GetScreenWidth(); // The width of the screen (including multiple monitors)
UtilExport int GetScreenHeight(); // The height of the screen (including multiple monitors)

52
lib/maxsdk40/Toolmap.h Executable file
View File

@ -0,0 +1,52 @@
/**********************************************************************
*<
FILE: toolmap.h
DESCRIPTION: defines a mapping between control identifiers and osnaps
CREATED BY: John Hutchinson
HISTORY: January 15, 1996
*> Copyright (c) 1994, All Rights Reserved.
**********************************************************************/
#ifndef __TOOLMAP__
#define __TOOLMAP__
class msgdata {
public:
int recipient;
int subindex;
int msg;
msgdata(){};
msgdata(int r, int s, int m):recipient(r), subindex(s), msg(m){};
};
class tooltabentry {
private:
int indexer;
msgdata data;
public:
tooltabentry(){};
tooltabentry(int i, int r, int s, int m);
msgdata *Query(int i);
};
class ToolTab : public Tab<tooltabentry *> {
public:
msgdata *Lookup(int toolid);
};
#endif //_TOOLMAP_

87
lib/maxsdk40/XTCObject.h Executable file
View File

@ -0,0 +1,87 @@
/**********************************************************************
*<
FILE: XTCObject.h
DESCRIPTION: Defines the Extension Channel Object
CREATED BY: Nikolai Sander
HISTORY: created 3 March 2000
*> Copyright (c) 2000, All Rights Reserved.
**********************************************************************/
#include "maxapi.h"
#include "plugapi.h"
#include "iFnPub.h"
/*-------------------------------------------------------------------
XTCObject:
---------------------------------------------------------------------*/
class XTCObject : public InterfaceServer {
public:
// Unique identifier
virtual Class_ID ExtensionID()=0;
virtual XTCObject *Clone()=0;
// Channels that the XTCObject depends on. If a modifier changes a channel,
// that a XTCObject depends on, its Pre- and PostChanChangedNotify
// methods will be called
virtual ChannelMask DependsOn(){return 0;}
// These are the channels, that the extension object changes in the Pre-
// or PostChanChangedNotify methods
virtual ChannelMask ChannelsChanged(){return 0;}
// These are the channels, that the extension object changes in the Pre-
// or PostChanChangedNotify methods
virtual ChannelMask ChannelsUsed(){return 0;}
// If an XTCObject wants to display itself in the viewport, it can
// overwrite this method
virtual int Display(TimeValue t, INode* inode, ViewExp *vpt, int flags,Object *pObj){return 0;};
// This method will be called before a modifier is applied, that
// changes a channel, that the XTCObject depends on. In case the
// modifier is the last in the stack, bEndOfPipleine is true,
// otherwise false
virtual void PreChanChangedNotify(TimeValue t, ModContext &mc, ObjectState* os, INode *node,Modifier *mod, bool bEndOfPipeline){};
// This method will be called after a modifier is applied, that
// changes a channel, that the XTC object depends on. In case the
// modifier is the last in the stack, bEndOfPipleine is true
// otherwise false
virtual void PostChanChangedNotify(TimeValue t, ModContext &mc, ObjectState* os, INode *node,Modifier *mod, bool bEndOfPipeline){};
// If the XTC object returns true from this method, the object
// is not displayed in the viewport
virtual BOOL SuspendObjectDisplay(){ return false; }
virtual void DeleteThis()=0;
// This method allows the object to enlarge its viewport rectangle,
// if it wants to. The system will call this method for all XTCObjects
// when calculating the viewport rectangle; the XTCObject can enlarge the
// rectangle if desired
virtual void MaybeEnlargeViewportRect(GraphicsWindow *gw, Rect &rect){}
// by default the existing XTCObjects will be deleted, if a branch updates.
// In case the XTCObject wants to do more intelligent branching (not just
// deleted and add), it might want to return false to this method, so that
// it can later (see MergeXTCObject) copy the data from this and other
// branches into an existing XTCObject.
virtual bool RemoveXTCObjectOnMergeBranches(Object *obFrom, Object *obTo) { return true; }
// The default implementation just adds the XTCObject to the to object
// In case the XTCObject should do a more intelligent merge with already
// existing XTCObjects in the obTo, it has to overwrite this method
virtual bool MergeXTCObject(Object *obFrom, Object *obTo, int prio, int branchID) { obTo->AddXTCObject(this,prio,branchID); return true;}
// In case a branch of a compound object is deleted the XTCObject will be asked,
// if the XTCObject should be deleted as well. In case the XTCObject represents a
// merge of all branches the TCObject might want to return false to this
// method and reassign itself to another branch, so that the merged information is
// not lost.
virtual bool RemoveXTCObjectOnBranchDeleted(Object *ComObj,int branchID, bool branchWillBeReordered) { return true; }
};

BIN
lib/maxsdk40/acap.lib Executable file

Binary file not shown.

188
lib/maxsdk40/acolor.h Executable file
View File

@ -0,0 +1,188 @@
/**********************************************************************
*<
FILE: acolor.h
DESCRIPTION: floating point color + alpha
CREATED BY: Dan Silva
HISTORY:
*> Copyright (c) 1994, All Rights Reserved.
**********************************************************************/
#ifndef _ACOLOR_H
#define _ACOLOR_H
#include "maxtypes.h"
#include "point3.h"
#include "color.h"
class AColor {
public:
float r,g,b,a;
// Constructors
AColor() {}
AColor(float R, float G, float B, float A=1.0f) { r = R; g = G; b = B; a = A; }
AColor(double R, double G, double B, double A=1.0) {
r = (float)R; g = (float)G; b = (float)B; a = (float)A; }
AColor(int R, int G, int B, int A=0) {
r = (float)R; g = (float)G; b = (float)B; a = (float)A; }
AColor(const AColor& c) { r = c.r; g = c.g; b = c.b; a = c.a; }
AColor(const Color& c, float alph=1.0f) { r = c.r; g = c.g; b = c.b; a = alph; }
DllExport AColor(DWORD rgb, float alph=1.0f); // from Windows RGB value
AColor(float af[4]) { r = af[0]; g = af[1]; b = af[2];a = af[3]; }
AColor(const BMM_Color_24& c) {
r = float(c.r)/255.0f; g = float(c.g)/255.0f; b = float(c.b)/255.0f; a = 1.0f;
}
AColor(const BMM_Color_32& c) {
r = float(c.r)/255.0f; g = float(c.g)/255.0f; b = float(c.b)/255.0f; a = float(c.a)/255.0f;
}
AColor(const BMM_Color_48& c) {
r = float(c.r)/65535.0f; g = float(c.g)/65535.0f; b = float(c.b)/65535.0f; a = 1.0f;
}
AColor(const BMM_Color_64& c) {
r = float(c.r)/65535.0f; g = float(c.g)/65535.0f; b = float(c.b)/65535.0f; a = float(c.a)/65535.0f;
}
AColor(const BMM_Color_fl& c) {
r = c.r; g = c.g; b = c.b; a = c.a;
}
void Black() { r = g = b = 0.0f; a = 1.0f; }
void White() { r = g = b = 1.0f; a = 1.0f; }
DllExport void ClampMax(); // makes components >= 0.0
DllExport void ClampMin(); // makes components <= 1.0
DllExport void ClampMinMax(); // makes components in [0,1]
// Access operators
float& operator[](int i) { return (&r)[i]; }
const float& operator[](int i) const { return (&r)[i]; }
// Conversion functions
operator float*() { return(&r); }
operator Color() { return Color(r,g,b); }
// Convert to Bitmap Manager types
operator BMM_Color_24() {
BMM_Color_24 c;
c.r = int(r*255.0f); c.g = int(g*255.0f); c.b = int(b*255.0f);
return c;
}
operator BMM_Color_32() {
BMM_Color_32 c;
c.r = int(r*255.0f); c.g = int(g*255.0f); c.b = int(b*255.0f); c.a = int(a*255.0f);
return c;
}
operator BMM_Color_48() {
BMM_Color_48 c;
c.r = int(r*65535.0f); c.g = int(g*65535.0f); c.b = int(b*65535.0f);
return c;
}
operator BMM_Color_64() {
BMM_Color_64 c;
c.r = int(r*65535.0f); c.g = int(g*65535.0f); c.b = int(b*65535.0f); c.a = int(a*65535.0f);
return c;
}
operator BMM_Color_fl() {
BMM_Color_fl c;
c.r = r; c.g = g; c.b = b; c.a = a;
return c;
}
// Convert to Windows RGB
operator DWORD() { return RGB(FLto255(r),FLto255(g), FLto255(b)); }
// Convert to Point3
operator Point3() { return Point3(r,g,b); }
// Unary operators
AColor operator-() const { return (AColor(-r,-g,-b, -a)); }
AColor operator+() const { return *this; }
// Assignment operators
inline AColor& operator-=(const AColor&);
inline AColor& operator+=(const AColor&);
inline AColor& operator*=(float);
inline AColor& operator/=(float);
inline AColor& operator*=(const AColor&); // element-by-element multiplg.
// Test for equality
int operator==(const AColor& p) const { return ((p.r==r)&&(p.g==g)&&(p.b==b)&&(p.a==a)); }
int operator!=(const AColor& p) const { return ((p.r!=r)||(p.g!=g)||(p.b!=b)||(p.a!=a)); }
// Binary operators
inline AColor operator-(const AColor&) const;
inline AColor operator+(const AColor&) const;
inline AColor operator/(const AColor&) const;
inline AColor operator*(const AColor&) const;
inline AColor operator^(const AColor&) const; // CROSS PRODUCT
};
int DllExport MaxComponent(const AColor&); // the component with the maximum abs value
int DllExport MinComponent(const AColor&); // the component with the minimum abs value
// Inlines:
inline AColor& AColor::operator-=(const AColor& c) {
r -= c.r; g -= c.g; b -= c.b; a -= c.a;
return *this;
}
inline AColor& AColor::operator+=(const AColor& c) {
r += c.r; g += c.g; b += c.b; a += c.a;
return *this;
}
inline AColor& AColor::operator*=(float f) {
r *= f; g *= f; b *= f; a *= f;
return *this;
}
inline AColor& AColor::operator/=(float f) {
r /= f; g /= f; b /= f; a /= f;
return *this;
}
inline AColor& AColor::operator*=(const AColor& c) {
r *= c.r; g *= c.g; b *= c.b; a *= c.a;
return *this;
}
inline AColor AColor::operator-(const AColor& c) const {
return(AColor(r-c.r,g-c.g,b-c.b,a-c.a));
}
inline AColor AColor::operator+(const AColor& c) const {
return(AColor(r+c.r,g+c.g,b+c.b,a+c.a));
}
inline AColor AColor::operator/(const AColor& c) const {
return AColor(r/c.r,g/c.g,b/c.b,a/c.a);
}
inline AColor AColor::operator*(const AColor& c) const {
return AColor(r*c.r, g*c.g, b*c.b, a*c.a);
}
inline AColor operator*(float f, const AColor& a) {
return(AColor(a.r*f, a.g*f, a.b*f, a.a*f));
}
inline AColor operator*(const AColor& a, float f) {
return(AColor(a.r*f, a.g*f, a.b*f, a.a*f));
}
// Composite fg over bg, assuming associated alpha,
// i.e. pre-multiplied alpha for both fg and bg
inline AColor CompOver(const AColor &fg, const AColor& bg) {
return fg + (1.0f-fg.a)*bg;
}
typedef AColor RGBA;
#endif

22
lib/maxsdk40/alerts.h Executable file
View File

@ -0,0 +1,22 @@
//-----------------------------------------------------------------------------
// -------------------
// File ....: alerts.h
// -------------------
// Author...: Gus J Grubba
// Date ....: April 1997
// O.S. ....: Windows NT 4.0
//
// History .: Apr, 02 1997 - Created
//
// 3D Studio Max Notification Alerts
//
//-----------------------------------------------------------------------------
#ifndef _ALERTS_H_
#define _ALERTS_H_
#define NOTIFY_FAILURE (1<<0)
#define NOTIFY_PROGRESS (1<<1)
#define NOTIFY_COMPLETION (1<<2)
#endif

1219
lib/maxsdk40/animtbl.h Executable file

File diff suppressed because it is too large Load Diff

135
lib/maxsdk40/appio.h Executable file
View File

@ -0,0 +1,135 @@
/**********************************************************************
*<
FILE: appio.h
DESCRIPTION: General chunk-ifying code: useful for writing
hierarchical data structures to a linear stream, such as
an AppData block.
CREATED BY: Dan Silva
HISTORY: created 3/24/97
*> Copyright (c) 1994, All Rights Reserved.
**********************************************************************/
#ifndef __APPIO__H
#define __APPIO__H
//------------------------------------------------------------------------
// AppSave will write hierarchical chunks into a private buffer, enlarging
// it as needed. When completed, use the methods BufferPtr() and
// NBytesWritten() to get at this buffer. ( AppSave will delete the buffer in
// its DeleteThis() method , so you need to copy the buffer to save the data.)
// The chunk hierarchy should always have a single highest level chunk.
// Chunks can be nested to any depth.
// A Chunk can contain either sub-chunks, or data, but not both.
// For example:
//
// AppSave *asave = NewAppSave(1000);
// asave->BeginChunk(MAIN_CHUNK);
// asave->BeginChunk(CHUNK1);
// .. write data
// asave->EndChunk();
//
// asave->BeginChunk(CHUNK2);
// .. write data
// asave->EndChunk();
//
// asave->BeginChunk(CHUNK3);
// .. write data
// asave->EndChunk();
// asave->EndChunk(); // end MAIN_CHUNK
class AppSave {
protected:
~AppSave() {}
public:
virtual void DeleteThis()=0;
// After saving, use this to get pointer to the buffer created.
virtual BYTE *BufferPtr()=0;
// This tells how many bytes were written in the buffer.
virtual int NBytesWritten()=0;
// Begin a chunk.
virtual void BeginChunk(USHORT id)=0;
// End a chunk, and back-patch the length.
virtual void EndChunk()=0;
virtual int CurChunkDepth()=0; // for checking balanced BeginChunk/EndChunk
// write a block of bytes to the output stream.
virtual IOResult Write(const void *buf, ULONG nbytes, ULONG *nwrit)=0;
// Write character strings
virtual IOResult WriteWString(const char *str)=0;
virtual IOResult WriteWString(const wchar_t *str)=0;
virtual IOResult WriteCString(const char *str)=0;
virtual IOResult WriteCString(const wchar_t *str)=0;
};
//------------------------------------------------------------------------
// AppLoad takes a chunk-ified data stream, and provides routines for
// decoding it.
class AppLoad {
protected:
~AppLoad() {};
public:
virtual void DeleteThis()=0;
// if OpenChunk returns IO_OK, use following 3 function to get the
// info about the chunk. IO_END indicates no more chunks at this level
virtual IOResult OpenChunk()=0;
// These give info about the most recently opened chunk
virtual USHORT CurChunkID()=0;
virtual ChunkType CurChunkType()=0;
virtual ULONG CurChunkLength()=0; // chunk length NOT including header
virtual int CurChunkDepth()=0; // for checking balanced OpenChunk/CloseChunk
// close the currently opened chunk, and position at the next chunk
// return of IO_ERROR indicates there is no open chunk to close
virtual IOResult CloseChunk()=0;
// Look at the next chunk ID without opening it.
// returns 0 if no more chunks
virtual USHORT PeekNextChunkID()=0;
// Read a block of bytes from the output stream.
virtual IOResult Read(void *buf, ULONG nbytes, ULONG *nread )=0;
// Read a string from a string chunk assumes chunk is already open,
// it will NOT close the chunk. Sets buf to point
// to a char string. Don't delete buf: ILoad will take care of it.
// Read a string that was stored as Wide chars.
virtual IOResult ReadWStringChunk(char** buf)=0;
virtual IOResult ReadWStringChunk(wchar_t** buf)=0;
// Read a string that was stored as single byte chars
virtual IOResult ReadCStringChunk(char** buf)=0;
virtual IOResult ReadCStringChunk(wchar_t** buf)=0;
};
// Create a new AppLoad for reading chunks out of buf:
// bufSize specifies the number of bytes that are valid in
// buf..
CoreExport AppLoad *NewAppLoad(BYTE *buf, int bufSize);
// Create a new AppSave for writing chunks
// InitbufSize is the initial size the internal buffer is allocated to.
// It will be enlarged if necessary.
CoreExport AppSave *NewAppSave(int initBufSize);
#endif

35
lib/maxsdk40/arcdlg.h Executable file
View File

@ -0,0 +1,35 @@
/**********************************************************************
*<
FILE: arcdlg.h
DESCRIPTION:
CREATED BY: Dan Silva
HISTORY:
*> Copyright (c) 1994, All Rights Reserved.
**********************************************************************/
#ifndef __ARCDLG__H
#define __ARCDLG__H
class ArcballDialog {
public:
virtual void DeleteThis()=0;
};
class ArcballCallback {
public:
virtual void StartDrag()=0; // called when drag begins (may want to save state at this point)
virtual void EndDrag()=0; // called when drag ends
virtual void Drag(Quat q, BOOL buttonUp)=0; // called during drag, with q=relative rotation from start
virtual void CancelDrag()=0; // called when right button clicked during drag
virtual void BeingDestroyed()=0; // called if the window was closed
};
CoreExport ArcballDialog *CreateArcballDialog(ArcballCallback *cb, HWND hwndOwner, TCHAR* title=NULL);
#endif

30
lib/maxsdk40/assert1.h Executable file
View File

@ -0,0 +1,30 @@
/**********************************************************************
*<
FILE: assert1.h
DESCRIPTION:
CREATED BY: Dan Silva
HISTORY:
*> Copyright (c) 1994, All Rights Reserved.
**********************************************************************/
#ifdef assert
#undef assert
#endif
#define assert( expr ) ( expr || assert1( /*#expr,*/ __LINE__, __FILE__ ) )
#define MaxAssert( expr ) ( (expr) || assert1( __LINE__, __FILE__ ) )
extern int UtilExport assert1( /*char *expr,*/ int line, char *file );
#ifdef _DEBUG
#define DbgAssert( expr ) ( (expr) || assert1( __LINE__, __FILE__ ) )
#define DbgVerify( expr ) ( (expr) || assert1( __LINE__, __FILE__ ) )
#else
#define DbgAssert( expr )
#define DbgVerify( expr ) ( expr )
#endif

124
lib/maxsdk40/baseInterface.h Executable file
View File

@ -0,0 +1,124 @@
/**********************************************************************
*<
FILE: baseInterface.h
DESCRIPTION: Base classes for various interfaces in MAX
CREATED BY: John Wainwright
HISTORY: created 9/5/00
*> Copyright (c) 2000 Autodesk, All Rights Reserved.
**********************************************************************/
#ifndef __BASEINTERFACE_H__
#define __BASEINTERFACE_H__
class InterfaceServer;
class BaseInterfaceServer;
class BaseInterface;
class InterfaceNotifyCallback;
// ID for BaseInterfaces
#define BASEINTERFACE_ID Interface_ID(0, 1)
// Base class for those classes and interfaces in MAX that can serve interfaces.
class InterfaceServer
{
public:
virtual BaseInterface* GetInterface(Interface_ID id) { return NULL; }
};
// The base class for interfaces in MAX R4.
// Provides basic identity, sub-interface access, lifetime management and
// cloning methods. The base class for FPInterface in the FnPub system.
//
class BaseInterface : public InterfaceServer
{
public:
// from InterfaceServer
BaseInterface* GetInterface(Interface_ID id) { if (id == BASEINTERFACE_ID) return this; else return NULL; }
// identification
virtual Interface_ID GetID() { return BASEINTERFACE_ID; }
// interface lifetime management
// there is an implied Acquire() whenever an interface is served via a GetInterface()
// nortmally requiring a matching Release() from the client
// can optionally use LifetimeControl() method to enquire about actual
// lifetime policy of client and provide a server-controlled delete notify callback
// 'noRelease' means don't need to call release, use interface as long as you like.
// 'immediateRelease' means the interface is good for only one call, but the release
// is implied, you don't need to call release.
// 'wantsRelease' means the clients are controlling lifetime so the interface needs
// a Release() when the client has finished (default).
// 'serverControlled' means the server controls lifetime and will use the InterfaceNotifyCallback
// to tell you when it is gone.
enum LifetimeType { noRelease, immediateRelease, wantsRelease, serverControlled };
// LifetimeControl returns noRelease since
// AcquireInterface and ReleaseInterface do not perform
// any real acquiring and releasing (reference counting, etc.)
// If the implementation of AcquireInterface and ReleaseInterface changes
// in this class or derived classes, the return value of LifetimeControl
// needs to be updated accordingly.
virtual LifetimeType LifetimeControl() { return noRelease; }
virtual void RegisterNotifyCallback(InterfaceNotifyCallback* incb) { }
virtual void UnRegisterNotifyCallback(InterfaceNotifyCallback* incb) { }
virtual BaseInterface* AcquireInterface() { return (BaseInterface*)this; };
virtual void ReleaseInterface() { };
// direct interface delete request
virtual void DeleteInterface() { };
// interface cloning
virtual BaseInterface* CloneInterface(void* remapDir = NULL) { return NULL; }
};
// BaseInterface server specializes InterfaceServer with an implementation
// based on a Tab<> of interface pointers for storing interfaces,
// typically extension interfaces, and providing an interface iteration
// protocol.
// class IObject in the FnPub system specializes BaseInterfaceServer
class BaseInterfaceServer : public InterfaceServer
{
protected:
Tab<BaseInterface*> interfaces;
public:
// interface serving, default implementation looks in interfaces table
virtual BaseInterface* GetInterface(Interface_ID id)
{
for (int i = 0; i < interfaces.Count(); i++)
if (interfaces[i]->GetID() == id)
return interfaces[i]->AcquireInterface();
return NULL;
}
// interface enumeration...
virtual int NumInterfaces() const { return interfaces.Count(); }
virtual BaseInterface* GetInterfaceAt(int i) const { return interfaces[i]; }
// default descructor, calls DeleteInterface() on all live entries in interfaces table
~BaseInterfaceServer()
{
for (int i = 0; i < interfaces.Count(); i++)
if (interfaces[i] != NULL)
interfaces[i]->DeleteInterface();
}
};
// InterfaceNotifyCallback base class,
// can be specialized by clients of an interface that controls its own lifetime
// so that they can be notified when the interface is deleted or other changes occur.
// registered with the interface via the lifetime control protocol
class InterfaceNotifyCallback
{
public:
// notify server is deleting the interface
virtual void InterfaceDeleted(BaseInterface* bi) { }
// for furture notification extensions
virtual BaseInterface* GetInterface(Interface_ID id) { return NULL; }
};
#endif

187
lib/maxsdk40/bezfont.h Executable file
View File

@ -0,0 +1,187 @@
/**********************************************************************
*<
FILE: bezfont.h
DESCRIPTION: Bezier Font Support methods
CREATED BY: Tom Hudson
HISTORY: Created 1 November 1995
*> Copyright (c) 1995, All Rights Reserved.
**********************************************************************/
#ifndef __BEZFONT_H__
#define __BEZFONT_H__
#include "plugin.h"
// Forward references
class BezFontManager;
class BezFontMetrics {
public:
LONG Height;
LONG Ascent;
LONG Descent;
LONG InternalLeading;
LONG ExternalLeading;
LONG AveCharWidth;
LONG MaxCharWidth;
LONG Weight;
LONG Overhang;
LONG DigitizedAspectX;
LONG DigitizedAspectY;
BCHAR FirstChar;
BCHAR LastChar;
BCHAR DefaultChar;
BCHAR BreakChar;
BYTE Italic;
BYTE Underlined;
BYTE StruckOut;
BYTE PitchAndFamily;
BYTE CharSet;
DWORD Flags;
UINT SizeEM;
UINT CellHeight;
UINT AvgWidth;
CoreExport BezFontMetrics() {} // To Do; Fill in fields with reasonable values
CoreExport BezFontMetrics(NEWTEXTMETRIC *from);
};
// BezFontInfo type
#define BEZFONT_TRUETYPE 0
#define BEZFONT_OTHER 1
// BezFontInfo flags
// None currently defined
class BezFontInfo {
public:
TSTR name;
TSTR style;
int type; // See above
DWORD flags; // See above
BezFontMetrics metrics;
BezFontInfo() {}
BezFontInfo(TSTR n, TSTR s, int t, DWORD f, BezFontMetrics &m) { name=n; style=s; type=t; flags=f; metrics=m; }
CoreExport BezFontInfo &operator=(BezFontInfo &from);
};
// A class for Dlls to use for info that will be sent back to them at load time
class DllData {
public:
DllData() {}
};
// This is a callback class which is used to process font enumerations
class BezFontEnumProc {
public:
virtual BOOL CALLBACK Entry(BezFontInfo &info, LPARAM userInfo)=0;
};
// A special enumerator for the font manager
class BezFontMgrEnumProc {
public:
BezFontManager *mgr;
CoreExport BOOL CALLBACK Entry(BezFontInfo &info, LPARAM userInfo, DllData *dllData);
void SetMgr(BezFontManager *m) { mgr = m; }
};
// A class for listing font input dlls
class BezFontDll {
public:
ClassDesc *dll;
BezFontDll() { dll=NULL; }
BezFontDll(ClassDesc *d) { dll = d; }
};
typedef Tab<BezFontDll *> BezFontDllTab;
// A class for providing access to required Max internals
class FontMgrInterface {
public:
virtual HINSTANCE AppInst() = 0;
virtual HWND AppWnd() = 0;
virtual DllDir *AppDllDir() = 0;
virtual int GetFontDirCount() = 0;
virtual TCHAR *GetFontDir (int i) = 0;
};
typedef int BEZFONTHANDLE;
// A class used for listing the fonts we currently have available
class AvailableFont {
public:
BezFontInfo info;
DllData *dllData;
INT_PTR dllIndex; // The index of the DLL which provides this font (in BezFontDllTab)
AvailableFont() { dllData = NULL; }
AvailableFont(BezFontInfo &i, INT_PTR di, DllData *dd=NULL) { info=i; dllIndex=di; dllData=dd; }
~AvailableFont() { if(dllData) delete dllData; }
};
typedef Tab<AvailableFont *> AvailableFontTab;
// The basic bezier font class
class BezFont {
public:
CoreExport BezFont() { }
CoreExport virtual void EnumerateFonts(BezFontMgrEnumProc &proc, LPARAM userInfo)=0;
CoreExport virtual int OpenFont(TSTR name, DWORD flags, DllData *dllData)=0;
CoreExport virtual void CloseFont()=0;
CoreExport virtual BOOL BuildCharacter(UINT index, float height, BezierShape &shape, float &width, int fontShapeVersion=1)=0;
};
// A class used to list the fonts currently open
class OpenBezFont {
public:
int index; // The index in AvailableFont
DWORD flags; // The style flags
BEZFONTHANDLE handle; // The handle we know it by
int count; // The number of users
BezFont *loader; // The loader for the font
OpenBezFont() {}
OpenBezFont(int i, DWORD f, BEZFONTHANDLE h, BezFont *l) { index=i; flags=f; handle=h; count=1; loader=l; }
~OpenBezFont();
};
typedef Tab<OpenBezFont *> OpenBezFontTab;
// This is the interface into Bezier fonts within the MAX system.
// This includes TrueType fonts and any other fonts supported via
// plugins.
// OpenFont flags
// None currently defined
class BezFontManager {
friend class BezFontMgrEnumProc;
private:
FontMgrInterface *iface;
BOOL initialized;
BezFontDllTab dllTab;
AvailableFontTab available;
OpenBezFontTab open;
BezFontMgrEnumProc enumProc; // What we use to get the available fonts
public:
CoreExport BezFontManager();
CoreExport ~BezFontManager();
CoreExport void SetInterface(FontMgrInterface *i) { iface = i; }
CoreExport void Init();
CoreExport void Uninit();
CoreExport void Reinit();
CoreExport void EnumerateFonts(BezFontEnumProc &proc, LPARAM userInfo);
CoreExport BOOL FontExists(TSTR name); // Returns TRUE if the font is available
CoreExport BEZFONTHANDLE OpenFont(TSTR name, DWORD flags);
CoreExport BOOL CloseFont(BEZFONTHANDLE handle); // Returns TRUE if the font is still in use
CoreExport BOOL BuildCharacter(BEZFONTHANDLE handle, UINT index, float height, BezierShape &shape, float &width, int fontShapeVersion=1);
CoreExport FontMgrInterface *GetInterface() { return iface; }
CoreExport BOOL GetFontInfo(TSTR name, BezFontInfo &info);
};
extern CoreExport BezFontManager theBezFontManager;
#endif //__BEZFONT_H__

84
lib/maxsdk40/bitarray.h Executable file
View File

@ -0,0 +1,84 @@
/**********************************************************************
*<
FILE: bitarray.h
DESCRIPTION:
CREATED BY: Dan Silva
HISTORY:
*> Copyright (c) 1994, All Rights Reserved.
**********************************************************************/
#ifndef BITARRAY__H
#define BITARRAY__H
#include <windef.h>
#include <ioapi.h>
class BitArrayCallback {
public:
virtual void proc(int n)=0;
};
// Direction indicators for BitArray::Rotate and BitArray::Shift
#define LEFT_BITSHIFT 0
#define RIGHT_BITSHIFT 1
class BitArray {
DWORD* bits;
long numBits;
public:
DllExport void SetSize(int n, int save=0); // save=1:preserve old bit values
int GetSize() const { return numBits; }
DllExport void ClearAll();
DllExport void SetAll();
DllExport void Set(int i); // set ith bit to 1
DllExport void Clear(int i); // set ith bit to 0
DllExport void Set(int i, int b); // set ith bit to b
DllExport int operator[](int i) const; // get ith bit
DllExport int NumberSet(); // how many bits are 1's.
DllExport BOOL IsEmpty(); // are NO bits set?. much faster than NumberSet
DllExport void Compress();
DllExport void Expand();
DllExport void Reverse(BOOL keepZero = FALSE); // keepZero=TRUE keeps zero bit where it is
DllExport void Rotate(int direction, int count); // With wraparound
DllExport void Shift(int direction, int count, int where=0); // Without wraparound
DllExport void EnumSet(BitArrayCallback &cb); // enumerates elements that are 1's
DllExport void DeleteSet (BitArray & dset, int mult=1);
DllExport IOResult Save(ISave* isave);
DllExport IOResult Load(ILoad* iload);
BitArray() { bits = NULL; numBits = 0; }
DllExport BitArray(int n);
DllExport BitArray(const BitArray& b);
DllExport ~BitArray();
// Comparison operator
DllExport BOOL operator==(const BitArray& b);
// Assignment operators
DllExport BitArray& operator=(const BitArray& b);
// Assignment operators: These require arrays of the same size!
DllExport BitArray& operator&=(const BitArray& b); // AND=
DllExport BitArray& operator|=(const BitArray& b); // OR=
DllExport BitArray& operator^=(const BitArray& b); // XOR=
// Binary operators: These require arrays of the same size!
DllExport BitArray operator&(const BitArray&) const; // AND
DllExport BitArray operator|(const BitArray&) const; // OR
DllExport BitArray operator^(const BitArray&) const; // XOR
// Unary operators
DllExport BitArray operator~(); // unary NOT function
};
#endif

1964
lib/maxsdk40/bitmap.h Executable file

File diff suppressed because it is too large Load Diff

BIN
lib/maxsdk40/bmm.lib Executable file

Binary file not shown.

5
lib/maxsdk40/bmmlib.h Executable file
View File

@ -0,0 +1,5 @@
#ifndef _BMMLIB_H_
#define _BMMLIB_H_
#define BMMExport __declspec( dllimport )
#include "bitmap.h"
#endif

68
lib/maxsdk40/box2.h Executable file
View File

@ -0,0 +1,68 @@
/**********************************************************************
*<
FILE: box2.h
DESCRIPTION:
CREATED BY: Dan Silva
HISTORY:
*> Copyright (c) 1994, All Rights Reserved.
**********************************************************************/
#ifndef _BOX2_H
#define _BOX2_H
#include "ipoint2.h"
#include "point2.h"
#include <windef.h>
class Box2: public RECT {
public:
DllExport Box2();
DllExport Box2(const IPoint2 a, const IPoint2 b);
DllExport int IsEmpty();
DllExport void SetEmpty();
DllExport void Rectify(); // makes top<bottom, left<right
DllExport void Scale(float f);
DllExport void Translate(IPoint2 t);
IPoint2 GetCenter() { return IPoint2((left+right)/2, (top+bottom)/2); }
int x() { return min(left,right); }
int y() { return min(top,bottom); }
int w() { return abs(right-left)+1; }
int h() { return abs(bottom-top)+1; }
void SetW(int w) { right = left + w -1; }
void SetH(int h) { bottom = top + h -1; }
void SetX(int x) { left = x; }
void SetY(int y) { top = y; }
void SetWH(int w, int h) { SetW(w); SetH(h); }
void SetXY(int x, int y) { SetX(x); SetY(y); }
DllExport Box2& operator=(const RECT& r);
DllExport Box2& operator=(RECT& r);
DllExport Box2& operator+=(const Box2& b);
DllExport Box2& operator+=(const IPoint2& p);
int operator==( const Box2& b ) const { return (left==b.left && right==b.right && top==b.top && bottom==b.bottom); }
DllExport int Contains(const IPoint2& p) const; // is point in this box?
};
typedef Box2 Rect;
struct FBox2 {
Point2 pmin;
Point2 pmax;
int IsEmpty() { return pmin.x>pmax.x?1:0; }
void SetEmpty() { pmin = Point2(1E30,1E30); pmax = -pmin; }
FBox2& operator=(const FBox2& r) { pmin = r.pmin; pmax = r.pmax; return *this; }
DllExport FBox2& operator+=(const Point2& p);
DllExport FBox2& operator+=(const FBox2& b);
DllExport int Contains(const Point2& p) const; // is point in this box?
};
#endif

74
lib/maxsdk40/box3.h Executable file
View File

@ -0,0 +1,74 @@
/**********************************************************************
*<
FILE: box3.h
DESCRIPTION: 3D Box class
CREATED BY: Dan Silva
HISTORY:
*> Copyright (c) 1994, All Rights Reserved.
**********************************************************************/
#ifndef _BOX3_H
#define _BOX3_H
#include "point3.h"
#include "matrix3.h"
class Box3 {
public:
Point3 pmin,pmax;
DllExport Box3();
Box3(const Point3& p, const Point3& q) { pmin = p; pmax = q;}
DllExport void Init();
DllExport void MakeCube(const Point3& p, float side);
// Access
Point3 Min() const { return pmin; }
Point3 Max() const { return pmax; }
Point3 Center() const { return(pmin+pmax)/(float)2.0; }
Point3 Width() const { return(pmax-pmin); }
/* operator[] returns ith corner point: (i == (0..7) )
Mapping:
X Y Z
[0] : (min,min,min)
[1] : (max,min,min)
[2] : (min,max,min)
[3] : (max,max,min)
[4] : (min,min,max)
[5] : (max,min,max)
[6] : (min,max,max)
[7] : (max,max,max)
*/
DllExport Point3 operator[](int i) const;
// Modifiers
DllExport Box3& operator+=(const Point3& p); // expand this box to include Point3
DllExport Box3& operator+=(const Box3& b); // expand this box to include Box3
DllExport void Scale(float s); // scale box about center
DllExport void Translate(const Point3 &p); // translate box
DllExport void EnlargeBy(float s); // enlarge by this amount on all sides
// include an array of points, optionally transformed by tm
DllExport void IncludePoints(Point3 *pts, int numpoints, Matrix3 *tm=NULL);
// Returns a box that bounds the 8 transformed corners of the input box.
DllExport Box3 operator*(const Matrix3& tm) const;
// Tests
DllExport int IsEmpty() const; // is this box empty?
DllExport int Contains(const Point3& p) const; // is point in this box?
DllExport int Contains(const Box3& b) const; // is box b totally in this box?
DllExport int Intersects(const Box3& b) const; // does box b intersect this box at all?
};
#endif

55
lib/maxsdk40/buildver.h Executable file
View File

@ -0,0 +1,55 @@
#ifndef _BUILD_VER_
#define _BUILD_VER_
// Don't use! Edu version of MAX now keyed off serial number
// Define EDU_VERSION to build the educational version of MAX
//#define EDU_VERSION
// Define BETA_VERSION to use Beta lock
//#define BETA_VERSION
// Define STUDENT_VER to build the student version of MAX
// #define STUDENT_VER
#ifdef STUDENT_VER
#define WIN95_ONLY
#endif
//TURN ON SNAPPING FOR INTEGRATION TO ATHENA
#define _OSNAP TRUE
//TURN ON PRIMITIVE CREATION WITH 3D SNAPPING
#define _3D_CREATE
// Turn on sub material assignment : 1/19/98 - CCJ
#define _SUBMTLASSIGNMENT
// Define to build VIZ
//#define DESIGN_VER
// Define turn on layers
//#define _LAYERS_
// Define to build a version with no NURBS
//#define NO_NURBS
// Define APL_DBCS for double-byte character set versions (i.e. Japanese, Chinese)
//#define APL_DBCS
// no longer used by MAX
#if !defined(EDU_VERSION) && !defined(STUDENT_VER) && !defined(DESIGN_VER) && !defined(BETA_VERSION)
#define ORDINARY_VER
#endif
// errors that will no longer occur
#if defined(EDU_VERSION) && defined(STUDENT_VER)
#error "Both EDU_VERSION and STUDENT_VER defined in buildver.h!"
#endif
#if defined(EDU_VERSION) && defined(BETA_VERSION)
#error "Both EDU_VERSION and BETA_VERSION defined in buildver.h!"
#endif
#endif // _BUILD_VER_

221
lib/maxsdk40/captypes.h Executable file
View File

@ -0,0 +1,221 @@
/**********************************************************************
*<
FILE: captypes.h
DESCRIPTION: Capping type defintions
CREATED BY: Tom Hudson
HISTORY: Created 12 October 1995
*> Copyright (c) 1995, All Rights Reserved.
**********************************************************************/
#ifndef __CAPTYPES_H_
#define __CAPTYPES_H_
// Just in case...
class PolyShape;
class BezierShape;
// Capping types supported
#define CAPTYPE_MORPH 0 // AKA 3D Studio DOS capping
#define CAPTYPE_GRID 1 // Max's very own capping
// Capping information classes:
// These classes provide information on how a cap is put together, based on the following:
//
// For Mesh caps, you get a list of created triangular faces, where the vertex indices are
// either original vertices on the PolyShape, newly created vertices inside the shape, or
// newly created vertices on the edge of a shape. New vertices are only created for GRID
// type capping. Cap info is always stored in unflipped form -- That is, faces are oriented
// in a counterclockwise order as viewed from the shape's "front", or positive Z.
//
// New free vertices are listed in the MeshCapInfo's "newVerts" table, a simple Point3 table.
// The "newVert" member of the MeshCapVert class points to the entry in the newVerts table.
//
// New edge vertices are stored with the polygon and segment number where they reside, along
// with a position on that segment (0-1) where they reside. This information allows the cap
// user to divide adjacent faces as needed.
//
// For Patch caps, you can only cap using MORPH type capping. GRID capping is meant for Mesh
// caps, where distorting a non-subdivided cap would result in serious surface discontinuities.
// Patches are automatically subdivided, so GRID capping is unnecessary there.
//
// CapFace flags
#define CF_ABLINE (1<<0)
#define CF_BCLINE (1<<1)
#define CF_CALINE (1<<2)
class CapFace {
public:
int va; // Index of vertex a
int vb; // Index of vertex b
int vc; // Index of vertex c
DWORD flags;
CapFace() {}
CapFace(int a, int b, int c, DWORD f) { va=a; vb=b; vc=c; flags=f; }
};
// Mesh cap vertices:
// These can be original vertices from the PolyShape or new free vertices
// in the center of the PolyShape.
#define MCV_ORIGINAL 0
#define MCV_FREE 1
class MeshCapVert {
public:
int type; // See above
int poly; // The polygon number
int index; // The index of the vertex
int newVert; // The index of the new vertex
MeshCapVert() {}
MeshCapVert(int t, int p, int i, int nv=0) { type=t; poly=p; index=i; newVert=nv; }
};
typedef Tab<CapFace> CapFaceTab;
typedef Tab<MeshCapVert> MeshCapVertTab;
typedef Tab<Point3> Point3Tab;
// The information class for mesh capping (MORPH or GRID)
class MeshCapInfo {
public:
CapFaceTab faces;
MeshCapVertTab verts;
Point3Tab newVerts;
MeshCapInfo &operator=(MeshCapInfo &from) { faces=from.faces; verts=from.verts; newVerts=from.newVerts; return *this; }
CoreExport void Init(PolyShape *shape);
CoreExport void FreeAll();
};
// Support classes for MeshCapper
class PolyLine;
class MeshCapPoly {
public:
int numVerts;
int *verts; // List of verts in mesh corresponding to verts in the PolyLine (1 per vert)
MeshCapPoly() { verts = NULL; }
CoreExport void Init(PolyLine &line);
CoreExport ~MeshCapPoly();
CoreExport void SetVert(int index, int vertex);
};
// This class is used to apply the MeshCapInfo data to a mesh -- It will modify the mesh as required to
// add the cap. Simply fill in the vertices and faces bordering the cap, then call the CapMesh method.
class MeshCapper {
public:
int numPolys;
MeshCapPoly *polys;
CoreExport MeshCapper(PolyShape &shape);
CoreExport ~MeshCapper();
CoreExport MeshCapPoly &operator[](int index);
CoreExport int CapMesh(Mesh &mesh, MeshCapInfo &capInfo, BOOL flip, DWORD smooth, Matrix3 *tm=NULL, int mtlID=-1);
};
// Patch capping
class CapPatch {
public:
int type; // PATCH_TRI or PATCH_QUAD
int verts[4];
int vecs[8];
int interior[4];
CapPatch() {}
CapPatch(int va, int vab, int vba, int vb, int vbc, int vcb, int vc, int vca, int vac, int i1, int i2, int i3) {
type=PATCH_TRI; verts[0]=va; verts[1]=vb; verts[2]=vc; vecs[0]=vab; vecs[1]=vba; vecs[2]=vbc, vecs[3]=vcb;
vecs[4]=vca; vecs[5]=vac; interior[0]=i1; interior[1]=i2; interior[2]=i3; }
CapPatch(int va, int vab, int vba, int vb, int vbc, int vcb, int vc, int vcd, int vdc, int vd, int vda, int vad, int i1, int i2, int i3, int i4) {
type=PATCH_QUAD; verts[0]=va; verts[1]=vb; verts[2]=vc; verts[3]=vd; vecs[0]=vab; vecs[1]=vba; vecs[2]=vbc, vecs[3]=vcb;
vecs[4]=vcd; vecs[5]=vdc; vecs[6]=vda, vecs[7]=vad; interior[0]=i1; interior[1]=i2; interior[2]=i3; interior[3]=i4; }
};
// Patch cap vertices:
// These can be original vertices from the BezierShape or new free vertices
// in the center of the BezierShape.
#define PCVERT_ORIGINAL 0
#define PCVERT_FREE 1
class PatchCapVert {
public:
int type;
int poly; // The polygon number (ORIGINAL or EDGE)
int index; // The index of the vertex (ORIGINAL) or the segment for the EDGE vertex
PatchCapVert() {}
PatchCapVert(int t, int p, int i) { type=t; poly=p; index=i; }
};
// Patch cap vectors:
// When a patch cap is generated, new interior vectors will be generated within the patch, and patch
// edges within the cap will have new vectors. Patch edges along the edges of the originating bezier
// shape will use existing vectors. This class provides information on which is which.
#define PCVEC_ORIGINAL 0
#define PCVEC_NEW 1
class PatchCapVec {
public:
int type; // See above
int poly; // Polygon number for ORIGINAL
int index; // Index for ORIGINAL or into newVecs table (see below)
PatchCapVec() {}
PatchCapVec(int t, int p, int i) { type=t; poly=p; index=i; }
};
typedef Tab<CapPatch> CapPatchTab;
typedef Tab<PatchCapVert> PatchCapVertTab;
typedef Tab<PatchCapVec> PatchCapVecTab;
// The information class for patch capping
class PatchCapInfo {
public:
CapPatchTab patches;
PatchCapVertTab verts;
PatchCapVecTab vecs;
Point3Tab newVerts;
Point3Tab newVecs;
PatchCapInfo &operator=(PatchCapInfo &from) { patches=from.patches; verts=from.verts; vecs=from.vecs; newVerts=from.newVerts; newVecs=from.newVecs; return *this; }
CoreExport void Init(BezierShape *shape);
CoreExport void FreeAll();
};
// Support classes for MeshCapper
class Spline3D;
class PatchCapPoly {
public:
int numVerts;
int numVecs;
int *verts; // List of verts in patch mesh corresponding to verts in the spline (1 per vert)
int *vecs; // List of vecs in patch mesh corresponding to vecs in the spline (1 per vector)
PatchCapPoly() { verts = vecs = NULL; }
CoreExport void Init(Spline3D &spline);
CoreExport ~PatchCapPoly();
CoreExport void SetVert(int index, int vertex);
CoreExport void SetVec(int index, int vector);
};
// This class is used to apply the PatchCapInfo data to a PatchMesh -- It will modify the mesh as required to
// add the cap. Simply fill in the vertices, vectors and patches bordering the cap, then call the CapPatch method.
class PatchCapper {
public:
int numPolys;
PatchCapPoly *polys;
CoreExport PatchCapper(BezierShape &shape);
CoreExport ~PatchCapper();
CoreExport PatchCapPoly &operator[](int index);
CoreExport int CapPatchMesh(PatchMesh &mesh, PatchCapInfo &capInfo, BOOL flip, DWORD smooth, Matrix3 *tm=NULL, int mtlID=-1);
};
#endif // __CAPTYPES_H_

56
lib/maxsdk40/channels.h Executable file
View File

@ -0,0 +1,56 @@
/**********************************************************************
*<
FILE: channel.h
DESCRIPTION:
CREATED BY: Dan Silva
HISTORY:
*> Copyright (c) 1994, All Rights Reserved.
**********************************************************************/
#ifndef __CHANNEL__H
#define __CHANNEL__H
// Channels within the object.
#define NUM_OBJ_CHANS 11
// Indices for object channels
#define TOPO_CHAN_NUM 0
#define GEOM_CHAN_NUM 1
#define TEXMAP_CHAN_NUM 2
#define MTL_CHAN_NUM 3
#define SELECT_CHAN_NUM 4
#define SUBSEL_TYPE_CHAN_NUM 5
#define DISP_ATTRIB_CHAN_NUM 6
#define VERT_COLOR_CHAN_NUM 7
#define GFX_DATA_CHAN_NUM 8
#define DISP_APPROX_CHAN_NUM 9
#define EXTENSION_CHAN_NUM 10
// Bit flags for object channels
#define TOPO_CHANNEL (1<<0) // topology (faces, polygons etc)
#define GEOM_CHANNEL (1<<1) // vertices
#define TEXMAP_CHANNEL (1<<2) // texture vertices and mapping
#define MTL_CHANNEL (1<<3) // material on per face basis
#define SELECT_CHANNEL (1<<4) // selection bits
#define SUBSEL_TYPE_CHANNEL (1<<5) // vertex/face/edge
#define DISP_ATTRIB_CHANNEL (1<<6) // display attributes
#define VERTCOLOR_CHANNEL (1<<7) // color per vertex
#define GFX_DATA_CHANNEL (1<<8) // stripping, edge list, etc.
#define DISP_APPROX_CHANNEL (1<<9) // displacement approximation
#define EXTENSION_CHANNEL (1<<13) // extension channel objects
#define TM_CHANNEL (1<<10) // Object transform (may be modified by modifiers)
#define GLOBMTL_CHANNEL (1<<31) // material applied to object as whole
#define OBJ_CHANNELS (TOPO_CHANNEL|GEOM_CHANNEL|SELECT_CHANNEL|TEXMAP_CHANNEL|MTL_CHANNEL|SUBSEL_TYPE_CHANNEL|DISP_ATTRIB_CHANNEL|VERTCOLOR_CHANNEL|GFX_DATA_CHANNEL|DISP_APPROX_CHANNEL|EXTENSION_CHANNEL)
#define ALL_CHANNELS (OBJ_CHANNELS|TM_CHANNEL|GLOBMTL_CHANNEL)
#endif // __CHANNEL__H

59
lib/maxsdk40/client.h Executable file
View File

@ -0,0 +1,59 @@
//-----------------------------------------------------------------------------
// -------------------
// File ....: Client.h
// -------------------
// Author...: Gus J Grubba
// Date ....: November 1995
// O.S. ....: Windows NT 3.51
//
// History .: Nov, 18 1995 - Created
//
// 3D Studio Max Network Rendering
//
// Client
//
//-----------------------------------------------------------------------------
#ifndef _CLIENTINCLUDE_
#define _CLIENTINCLUDE_
#ifndef NETCEXPORT
#define NETCEXPORT __declspec( dllimport )
#endif
#include "Max.h"
#include <maxnet_archive.h>
#include <maxnet_job.h>
//-----------------------------------------------------------------------------
//-- Interface Class
class ClientInterface {
public:
virtual HINSTANCE HostInst () = 0;
virtual HWND HostWnd () = 0;
virtual TCHAR* GetDir (int i) = 0;
virtual TCHAR* GetAppDir () = 0;
virtual TCHAR* GetMaxFileName () = 0;
virtual bool SaveMaxFile (TCHAR *file, TCHAR *archivename, bool archive, DWORD *filesize)=0;
};
NETCEXPORT bool clAssignJob(ClientInterface* ci, Job* nj, CJobText* jobtext);
//-----------------------------------------------------------------------------
//-- Helper functions, for submitting jobs with MaxNet
#define INETCREATEHELPERS_INTERFACE_ID Interface_ID(0x1d65311, 0x7e6d8b)
class INetCreateHelpers : public FPStaticInterface {
public:
virtual void NetCreateJob( Job& nj, CJobText& jobText )=0;
virtual bool NetCreateArchive( Job& nj, TCHAR* archivename )=0;
};
inline INetCreateHelpers* GetINetCreateHelpers()
{ return (INetCreateHelpers*)GetCOREInterface(INETCREATEHELPERS_INTERFACE_ID);}
#endif
//-- EOF: Client.h ------------------------------------------------------------

BIN
lib/maxsdk40/client.lib Executable file

Binary file not shown.

162
lib/maxsdk40/cmdmode.h Executable file
View File

@ -0,0 +1,162 @@
/**********************************************************************
*<
FILE: cmdmode.h
DESCRIPTION: Command mode class definition
CREATED BY: Rolf Berteig
HISTORY: Created 13 January 1995
*> Copyright (c) 1994, All Rights Reserved.
**********************************************************************/
#ifndef __CMDMODE__
#define __CMDMODE__
// This file can be included in plug-in modules so
// it shouldn't reference/include private classes or functions.
class MouseCallBack;
class ChangeForegroundCallback;
class CommandMode {
public:
virtual int Class()=0;
virtual int SuperClass() { return 0; }
virtual int ID()=0;
virtual MouseCallBack *MouseProc(int *numPoints)=0;
virtual ChangeForegroundCallback *ChangeFGProc()=0;
virtual BOOL ChangeFG( CommandMode *oldMode )=0;
virtual void EnterMode()=0;
virtual void ExitMode()=0;
};
// This is just a collection of modes that make up the xform modes.
// Plug-ins can specify these for thier sub-object types.
class XFormModes {
public:
CommandMode *move;
CommandMode *rotate;
CommandMode *scale;
CommandMode *uscale;
CommandMode *squash;
CommandMode *select;
XFormModes(
CommandMode *move,
CommandMode *rotate,
CommandMode *scale,
CommandMode *uscale,
CommandMode *squash,
CommandMode *select )
{
this->move = move;
this->rotate = rotate;
this->scale = scale;
this->uscale = uscale;
this->squash = squash;
this->select = select;
}
XFormModes() { move = rotate = scale = uscale = squash = select = NULL; }
};
// These can be returned from ChangeFGProc() instead of an actual FG proc
// to use predefined FG sets.
#define CHANGE_FG_SELECTED ((ChangeForegroundCallback *)1)
#define CHANGE_FG_ANIMATED ((ChangeForegroundCallback *)2)
// command super classes:
#define TRANSFORM_CMD_SUPER 1
// command classes
#define VIEWPORT_COMMAND 1
#define MOVE_COMMAND 2
#define ROTATE_COMMAND 3
#define SCALE_COMMAND 4
#define USCALE_COMMAND 5
#define SQUASH_COMMAND 6
#define SELECT_COMMAND 7
#define HIERARCHY_COMMAND 8
#define CREATE_COMMAND 9
#define MODIFY_COMMAND 10
#define MOTION_COMMAND 11
#define ANIMATION_COMMAND 12
#define CAMERA_COMMAND 13
#define NULL_COMMAND 14
#define DISPLAY_COMMAND 15
#define SPOTLIGHT_COMMAND 16
#define PICK_COMMAND 17
#define MANIPULATE_COMMAND 18
// command IDs
#define CID_USER 0x0000ffff
// XFORM_COMMAND
#define CID_OBJMOVE 1
#define CID_OBJROTATE 2
#define CID_OBJSCALE 3
#define CID_OBJUSCALE 4
#define CID_OBJSQUASH 5
#define CID_OBJSELECT 6
#define CID_SUBOBJMOVE 7
#define CID_SUBOBJROTATE 8
#define CID_SUBOBJSCALE 9
#define CID_SUBOBJUSCALE 10
#define CID_SUBOBJSQUASH 11
#define CID_SUBOBJSELECT 12
// display branch command modes
#define CID_UNFREEZE 13
#define CID_UNHIDE 14
// HEIRARCHY_COMMAND
#define CID_LINK 100
#define CID_BINDWSM 110 // I guess this is a heirarchy command... sort of
// VIEWPORT_COMMAND
#define CID_ZOOMVIEW 200
#define CID_ZOOMREGION 201
#define CID_PANVIEW 202
#define CID_ROTATEVIEW 203
#define CID_ZOOMALL 204
#define CID_RNDREGION 205
// CAMERA COMMANDS
#define CID_CAMFOV 210
#define CID_CAMDOLLY 211
#define CID_CAMPERSP 212
#define CID_CAMTRUCK 213
#define CID_CAMROTATE 214
#define CID_CAMROLL 215
//ANIMATION_COMMAND
#define CID_PLAYANIMATION 300
//CREATE_COMMAND
#define CID_SIMPLECREATE 400
//MODIFIY_COMMAND
#define CID_MODIFYPARAM 500
//MOTION_COMMAND
#define CID_NULL 600
// Pick modes
#define CID_STDPICK 710
#define CID_PICKAXISOBJECT 700
// ATTACH To GROUP COMMAND
#define CID_GRP_ATTACH 800
// Manipulate Command Mode
#define CID_MANIPULATE 900
#endif // __CMDMODE

254
lib/maxsdk40/color.h Executable file
View File

@ -0,0 +1,254 @@
/**********************************************************************
*<
FILE: color.h
DESCRIPTION:
CREATED BY: Dan Silva
HISTORY:
*> Copyright (c) 1994, All Rights Reserved.
**********************************************************************/
#ifndef _COLOR_H
#define _COLOR_H
#include "point3.h"
#define FLto255(x) ((int)((x)*255.0f+.5))
class Color;
struct RealPixel {
unsigned char r,g,b; // mantissas
unsigned char e; // exponent
DllExport operator Color();
};
DllExport RealPixel MakeRealPixel(float r, float g, float b);
DllExport void ExpandRealPixel(const RealPixel &rp, float &r, float &g, float &b);
class Color {
public:
float r,g,b;
// Constructors
Color() {}
Color(float R, float G, float B) { r = R; g = G; b = B; }
Color(double R, double G, double B) { r = (float)R; g = (float)G; b = (float)B; }
Color(int R, int G, int B) { r = (float)R; g = (float)G; b = (float)B; }
Color(const Color& a) { r = a.r; g = a.g; b = a.b; }
DllExport Color(DWORD rgb); // from Windows RGB value
Color(Point3 p) { r = p.x; g = p.y; b = p.z; }
Color(float af[3]) { r = af[0]; g = af[1]; b = af[2]; }
Color(RealPixel rp) { ExpandRealPixel(rp,r,g,b); }
Color(const BMM_Color_24& c) {
r = float(c.r)/255.0f; g = float(c.g)/255.0f; b = float(c.b)/255.0f;
}
Color(const BMM_Color_32& c) {
r = float(c.r)/255.0f; g = float(c.g)/255.0f; b = float(c.b)/255.0f;
}
Color(const BMM_Color_48& c) {
r = float(c.r)/65535.0f; g = float(c.g)/65535.0f; b = float(c.b)/65535.0f;
}
Color(const BMM_Color_64& c) {
r = float(c.r)/65535.0f; g = float(c.g)/65535.0f; b = float(c.b)/65535.0f;
}
Color(const BMM_Color_fl& c) {
r = c.r; g = c.g; b = c.b;
}
void Black() { r = g = b = 0.0f; }
void White() { r = g = b = 1.0f; }
DllExport void ClampMax(); // makes components >= 0.0
DllExport void ClampMin(); // makes components <= 1.0
DllExport void ClampMinMax(); // makes components in [0,1]
// Access operators
float& operator[](int i) { return (&r)[i]; }
const float& operator[](int i) const { return (&r)[i]; }
// Conversion function
operator float*() { return(&r); }
operator const float*() const { return(&r); }
// Convert to Windows RGB
operator DWORD() { return RGB(FLto255(r),FLto255(g), FLto255(b)); }
// Convert to Point3
operator Point3() { return Point3(r,g,b); }
// Convert to RealPixel
DllExport operator RealPixel() { return MakeRealPixel(r,g,b); }
// Convert to Bitmap Manager types
operator BMM_Color_24() {
BMM_Color_24 c;
c.r = int(r*255.0f); c.g = int(g*255.0f); c.b = int(b*255.0f);
return c;
}
operator BMM_Color_32() {
BMM_Color_32 c;
c.r = int(r*255.0f); c.g = int(g*255.0f); c.b = int(b*255.0f);
return c;
}
operator BMM_Color_48() {
BMM_Color_48 c;
c.r = int(r*65535.0f); c.g = int(g*65535.0f); c.b = int(b*65535.0f);
return c;
}
operator BMM_Color_64() {
BMM_Color_64 c;
c.r = int(r*65535.0f); c.g = int(g*65535.0f); c.b = int(b*65535.0f);
return c;
}
operator BMM_Color_fl() {
BMM_Color_fl c;
c.r = r; c.g = g; c.b = b;
return c;
}
// Unary operators
Color operator-() const { return(Color(-r,-g,-b)); }
Color operator+() const { return *this; }
// Assignment operators
inline Color& operator-=(const Color&);
inline Color& operator+=(const Color&);
inline Color& operator*=(float);
inline Color& operator/=(float);
inline Color& operator*=(const Color&); // element-by-element multiplg.
// Test for equality
int operator==(const Color& p) const { return ((p.r==r)&&(p.g==g)&&(p.b==b)); }
int operator!=(const Color& p) const { return ((p.r!=r)||(p.g!=g)||(p.b!=b)); }
// Binary operators
inline Color operator-(const Color&) const;
inline Color operator+(const Color&) const;
inline Color operator/(const Color&) const;
inline Color operator*(const Color&) const;
inline Color operator^(const Color&) const; // CROSS PRODUCT
};
int DllExport MaxComponent(const Color&); // index of the component with the maximum abs value
int DllExport MinComponent(const Color&); // index of the component with the minimum abs value
float DllExport MaxVal(const Color&); // value of the component with the maximum abs value
float DllExport MinVal(const Color&); // value of the component with the minimum abs value
// Inlines:
inline float Length(const Color& v) {
return (float)sqrt(v.r*v.r+v.g*v.g+v.b*v.b);
}
inline Color& Color::operator-=(const Color& a) {
r -= a.r; g -= a.g; b -= a.b;
return *this;
}
inline Color& Color::operator+=(const Color& a) {
r += a.r; g += a.g; b += a.b;
return *this;
}
inline Color& Color::operator*=(float f) {
r *= f; g *= f; b *= f;
return *this;
}
inline Color& Color::operator/=(float f) {
r /= f; g /= f; b /= f;
return *this;
}
inline Color& Color::operator*=(const Color& a) {
r *= a.r; g *= a.g; b *= a.b;
return *this;
}
inline Color Color::operator-(const Color& c) const {
return(Color(r-c.r,g-c.g,b-c.b));
}
inline Color Color::operator+(const Color& c) const {
return(Color(r+c.r,g+c.g,b+c.b));
}
inline Color Color::operator/(const Color& c) const {
return Color(r/c.r,g/c.g,b/c.b);
}
inline Color Color::operator*(const Color& c) const {
return Color(r*c.r, g*c.g, b*c.b);
}
inline Color operator*(float f, const Color& a) {
return(Color(a.r*f, a.g*f, a.b*f));
}
inline Color operator*(const Color& a, float f) {
return(Color(a.r*f, a.g*f, a.b*f));
}
inline Color operator/(const Color& a, float f) {
return(Color(a.r/f, a.g/f, a.b/f));
}
inline Color operator+(const Color& a, float f) {
return(Color(a.r+f, a.g+f, a.b+f));
}
inline Color operator+(float f, const Color& a) {
return(Color(a.r+f, a.g+f, a.b+f));
}
inline Color operator-(const Color& a, float f) {
return(Color(a.r-f, a.g-f, a.b-f));
}
inline Color operator-(float f, const Color& a) {
return(Color(f-a.r, f-a.g, f-a.b));
}
struct LogLUV32Pixel {
DWORD32 value;
operator Color() const { Color c; GetRGB(c); return c; }
LogLUV32Pixel& operator=(const float c[3]) { SetRGB(c); return *this; }
DllExport void GetRGB(float rgb[3]) const;
DllExport void SetRGB(const float rgb[3]);
DllExport void GetXYZ(float xyz[3]) const;
DllExport void SetXYZ(const float xyz[3]);
DllExport static void XYZtoRGB(const float xyz[3], float rgb[3]);
DllExport static void RGBtoXYZ(const float rgb[3], float xyz[3]);
};
struct LogLUV24Pixel {
unsigned char value[3];
operator Color() const { Color c; GetRGB(c); return c; }
LogLUV24Pixel& operator=(const float c[3]) { SetRGB(c); return *this; }
DllExport void GetRGB(float rgb[3]) const;
DllExport void SetRGB(const float rgb[3]);
DllExport void GetXYZ(float xyz[3]) const;
DllExport void SetXYZ(const float xyz[3]);
DllExport static void XYZtoRGB(const float xyz[3], float rgb[3]);
DllExport static void RGBtoXYZ(const float rgb[3], float xyz[3]);
};
#endif

654
lib/maxsdk40/contextids.h Executable file
View File

@ -0,0 +1,654 @@
// 3DS MAX context-sensitive help items
// Help Contents (help menu IDs are in the menu section)
#ifndef _CONTEXTIDS_H_
#define _CONTEXTIDS_H_
#define F1Focus(cmd,data) getHelpSys().setHelpFocus(cmd,data)
#define F1Help() getHelpSys().doHelpFocus()
#define DoHelp(cmd,data) getHelpSys().help(cmd, data)
#define GetClickHelp() getHelpSys().getClickHelp()
#define idh_contents 1000 // 3DS MAX Online Help (contents page)
// Titlebar items
#define idh_titlebar 2000 // Titlebar
//Menubar items
#define idh_menubar 3000 // Menubar
// File menu items
#define idh_file_menu 3100 // File menu
#define idh_file_new 3110 // New
#define idh_file_reset 3120 // Reset
#define idh_file_open 3130 // Open
#define idh_file_merge 3135 // Merge
#define idh_file_replace 3137 // Replace
#define idh_file_insert_tracks 3138 // Insert Tracks
#define idh_file_save 3140 // Save
#define idh_file_save_as 3150 // Save As
#define idh_file_save_selected 3160 // Save Selected
#define idh_file_import 3180 // Import
#define idh_file_export 3190 // Export
#define idh_file_archive 3200 // Archive
#define idh_file_summary_info 3210 // Summary Info
#define idh_file_view_file 3230 // View File
#define idh_file_configure_paths 3245 // Configure Paths
#define idh_file_preferences 3250 // Preferences
#define idh_file_properties 3255 // Properties
#define idh_file_exit 3260 // Exit
#define idh_file_history 3270 // History
// Edit menu items
#define idh_edit_menu 3300 // Edit menu
#define idh_edit_undo_redo 3310 // Undo/Redo
#define idh_edit_hold 3320 // Hold
#define idh_edit_fetch 3330 // Fetch
#define idh_edit_delete 3340 // Delete
#define idh_edit_clone 3350 // Clone
#define idh_edit_select_all 3360 // Select All
#define idh_edit_select_none 3370 // Select None
#define idh_edit_select_invert 3380 // Select Invert
#define idh_edit_select_by 3390 // Select By
#define idh_edit_select_by_color 3392
#define idh_edit_select_by_name 3394
#define idh_edit_region 3400 // Region
#define idh_edit_select_region_window 3402
#define idh_edit_select_region_crossing 3404
#define idh_edit_remove_named_selections 3410 // Remove Named Selections
#define idh_edit_edit_named_selections 3412
#define idh_edit_transform_type_in 3420 // Transform Type-in
#define idh_edit_mirror 3430 // Mirror
#define idh_edit_array 3435 // Mirror
#define idh_edit_snapshot 3437 // Mirror
#define idh_edit_align 3440 // Align
#define idh_edit_align_normals 3450 // Align Normals
#define idh_edit_place_highlight 3455
#define idh_edit_track_view 3459
#define idh_edit_schematic_view 3460
#define idh_edit_material_editor 3465
#define idh_edit_properties 3470 // Properties
#define idh_spacing_tool 3471
// Tools Menu
#define idh_tools_menu 3475 // Tools menu
#define idh_tools_display_floater 3477 // display floater
#define idh_tools_selection_floater 3479 // selection floater
#define idh_tools_material_map_browser 3480 // mtl/map browser
// MAXScript menu (added JBW 11/11/98 & 12/15/98)
#define idh_maxscript_listener 3481 // open listener
#define idh_maxscript_open 3482 // open script editor
#define idh_maxscript_new 3483 // new script
#define idh_maxscript_run 3484 // run script file
#define idh_maxscript_macrorec 3485 // toggle macrorecorder enable
// Grouping menu items
#define idh_grouping_menu 3500 // Grouping menu
#define idh_grouping_group 3510 // Group
#define idh_grouping_open 3520 // Open
#define idh_grouping_close 3530 // Close
#define idh_grouping_ungroup 3540 // Ungroup
#define idh_grouping_explode 3550 // Explode
#define idh_grouping_detach 3560 // Detach
#define idh_grouping_attach 3570 // Attach
// Views menu items
#define idh_views_menu 3600 // Views menu
#define idh_views_undo_redo 3610 // Undo/Redo
#define idh_views_save_active 3620
#define idh_views_restore_active 3621
#define idh_views_units_setup 3625
#define idh_views_grid_and_snap_settings 3630 // Grid and Snap Settings
#define idh_views_grids 3640 // Grids
#define idh_views_background_image 3650 // Background Image
#define idh_views_update_background_image 3652
#define idh_views_reset_background_transform 3654
#define idh_views_show_axis_icon 3660 // Show Axis Icon
#define idh_views_show_ghosting 3662
#define idh_views_show_key_times 3664
#define idh_views_shade_selected 3670
#define idh_views_show_dependencies 3680
#define idh_views_match_camera_to_view 3682
#define idh_views_redraw_all_views 3690 // Redraw All Views
#define idh_views_deactivate_all_maps 3695 // Deactivate all maps in views
#define idh_views_update_during_spinner_drag 3697
#define idh_views_expert_mode 3698
#ifdef DESIGN_VER
#define idh_views_design_mode 3699
#define idh_views_standard_mode 3701
#endif
#define idh_views_viewport_configuration 3710 // Viewport Configuration
// Rendering menu items
#define idh_rendering_menu 3800 // Rendering menu
#define idh_rendering_render 3810 // Render
#define idh_rendering_ireshade 3815 // interactive reshading
#define idh_rendering_video_post 3820 // Video Post
#define idh_rendering_environment 3840 // Environment
#define idh_rendering_make_preview 3870 // Make Preview
#define idh_rendering_view_preview 3880 // View Preview
#define idh_rendering_rename_preview 3890 // Rename Preview
#define idh_rendering_show_last_render 3892
#define idh_track_view_menu 3900 // Trackview menu
#define idh_track_view_open_track_view 3902
#define idh_track_view_new_track_view 3904
#define idh_track_view_delete_track_view 3906
#define idh_track_view_stored_track_views_list 3908
// Schematic view menu items...
#define idh_schematic_view_open_schematic_view 3910
#define idh_schematic_view_new_schematic_view 3911
#define idh_schematic_view_delete_schematic_view 3912
#define idh_schematic_view_stored_schematic_views_list 3913
// Help menu items
#define idh_help_menu 4300 // Help menu
#define idh_help_contents 4310 // Help contents
#define idh_help_topics 4320 // topics
#define idh_help_plugin_help 4330 // plug-in help
#define idh_help_about 4340 // About 3D Studio MAX
#define idh_help_learning 4342
#define idh_help_connect_to_support_and_information 4344
#define idh_help_maxscript 4345
#define idh_help_authorize 4346
// Toolbar items
#define idh_toolbar 5000 // Toolbar
#define idh_tb_undo_redo 5010 // Undo/Redo
#define idh_tb_undo 5011
#define idh_tb_redo 5012
#define idh_tb_link_unlink 5020 // Link/Unlink
#define idh_tb_link 5021
#define idh_tb_unlink 5022
#define idh_tb_bind_to_space_warp 5030 // Bind to Space Warp
#define idh_tb_selection 5040 // Selection
#define idh_tb_selection_region 5041
#define idh_tb_sel_filter 5042
#define idh_tb_hit_by_name 5050 // Hit-by-name
#define idh_tb_transformations 5060 // Transformations
#define idh_tb_move 5061
#define idh_tb_rotate 5062
#define idh_tb_scale 5063
#define idh_tb_coord_sys 5064
#define idh_tb_nuscale 5065
#define idh_tb_pivot 5070 // Pivot button
#define idh_tb_x 5071
#define idh_tb_y 5072
#define idh_tb_z 5073
#define idh_tb_plane 5074
#define idh_tb_constraints 5075 // axis constaint buttons
#define idh_tb_inverse_kinematics_buttons 5080 // Inverse Kinematics Buttons
#define idh_tb_mirror 5085
#define idh_tb_array_button 5090 // Array Button
#define idh_tb_spacing_tool 5092 // Spacing tool
#define idh_tb_align_and_align_normals 5100 // Align and Align Normals
#define idh_tb_track_view_button 5110 // Track View Button
#define idh_tb_schematic_view_button 5111 // Schematic View Button
#define idh_tb_material_editor_button 5115 // Material Editor
#define idh_tb_rendering_controls 5120 // Rendering Controls
#define idh_tb_render 5121
#define idh_tb_render_quick 5122
#define idh_tb_render_last 5123
#define idh_tb_render_region 5124
#define idh_tb_named_selection_sets 5130 // Named Selection Sets
// the following item was added by Vera (we need this button in the toolbar so a
// user can click on UI items that are not selectable or cannot receive focus)
#define idh_tb_help 5131 // Help button
// track view items
#define idh_track_view 5500 // Track View
#define idh_tv_layout 5510 // Track View Layout
#define idh_tv_hierarchy_list 5520 // Hierarchy list
#define idh_tv_edit_window 5530 // Track View Edit window
#define idh_tv_tool_bar 5540 // Track View Tool bar
#define idh_tv_navigation_icons 5550 // Track View Navigation icons (are there several?, if so, we need one ID per icon)
#define idh_view_ports 5600 // View ports
#define idh_vp_orthographic 5610 // Orthographic Views
#define idh_vp_camera 5620 // Camera Views
#define idh_vp_user 5630 // User Views
#define idh_vp_grid 5640 // Grid Views
#define idh_vp_spotlight 5650 // Spotlight Views
// Status line and prompt area items
#define idh_status_panel 5700
#define idh_sp_time_slider 5710 // Time slider
#define idh_sp_prompt_line 5720 // Prompt line
#define idh_sp_status_line 5730 // Status line
#define idh_sp_selection_lock 5735
#define idh_sp_window_crossing 5740
#define idh_sp_degrade_override 5745
#define idh_sp_snap_mode 5750
#define idh_sp_snap_toggle 5755
#define idh_sp_angle_snap 5760
#define idh_sp_percent_snap 5765
#define idh_sp_spinner_snap 5770
#define idh_sp_object_snap 5780 //object snapping
#define idh_sp_tti_mode 5790 //transform type-in absolute-relative toggle
// time panel
#define idh_time_panel 5800
#define idh_tp_animate 5810
#define idh_tp_goto_start 5820
#define idh_tp_previous 5830
#define idh_tp_play 5840
#define idh_tp_next 5850
#define idh_tp_goto_end 5860
#define idh_tp_key_mode 5870
#define idh_tp_cur_time 5880
#define idh_tp_time_config 5890
// View control panel (lower right)
#define idh_view_control 8200
#define idh_vc_zoom 8201
#define idh_vc_zoom_all 8202
#define idh_vc_zoom_extents 8203
#define idh_vc_zoom_ext_sel 8204
#define idh_vc_zoom_ext_all 8205
#define idh_vc_zoom_ext_all_sel 8206
#define idh_vc_zoom_region 8207
#define idh_vc_field_of_view 8208
#define idh_vc_pan 8209
#define idh_vc_arc_rotate 8210
#define idh_vc_arc_rotate_sel 8211
#define idh_vc_min_max_toggle 8212
// camera specific
#define idh_vc_dolly 8213
#define idh_vc_perspective 8214
#define idh_vc_roll 8215
#define idh_vc_truck 8216
#define idh_vc_orbit 8217
#define idh_vc_pan_cam 8218
// spotlight specific
#define idh_vc_hotspot 8219
#define idh_vc_falloff 8220
// Command panel items
#define idh_command_panel 6000 // Command panel
// Create items
#define idh_cp_create 6100 // Create
#define idh_create_entity_names 6110 // Entity Names
#define idh_create_geometry 6120 // Geometry
#define idh_create_space_warps 6130 // Space Warps
#define idh_create_object_colors 6140 // Object Colors
#define idh_create_materials 6150 // Materials
#define idh_create_nonrendering_objects 6160 // Non-rendering Objects
#define idh_create_lights 6170 // Lights
#define idh_create_cameras 6180 // Cameras
#define idh_create_helper_objects 6190 // Helper Objects
#define idh_create_systems 6200 // Systems
#define idh_create_objects_instances_references 6210 // Objects, Instances, and References
// Modify items
#define idh_cp_modify 6300 // Modify
#define idh_modify_panel_layout 6310 // Layout of the Modify Command Panel
#define idh_modify_modifier_stack 6320 // Modifier Stack
#define idh_modify_miscellaneous 6330 // Miscellaneous Additions
#define idh_modify_subobject_selection 6340 // Sub-Object Selection
#define idh_modify_object_modifiers_editors 6350 // Object Modifiers (Editors)
#define idh_modify_object_modifiers_other 6360 // Object Modifiers (Other)
#define idh_modify_lights 6370 // Lights
#define idh_modify_cameras 6380 // Cameras
#define idh_modify_mapping 6390 // Mapping
// Surface items
#define idh_cp_surface 6400 // Surface
#define idh_surface_surfaces 6410 // Surfaces
#define idh_surface_materials 6420 // Materials
// Hierarchy items
#define idh_cp_hierarchy 6500 // Hierarchy
#define idh_hierarchy_adjust_pivot 6510 // Adjust Pivot
#define idh_hierarchy_transform 6520 // Transform
#define idh_hierarchy_link_info 6530 // Link Info
#define idh_hierarchy_ik 6540 // IK
#define idh_hierarchy_links 6550 // Links
// Motion items
#define idh_cp_motion 6600 // Motion
#define idh_motion_assign_transform_controller 6610 // Assign Transform Controller
#define idh_motion_path 6620 // Path
#define idh_motion_key_info 6630 // Key Info
// Display items
#define idh_cp_display 6700 // Display
#define idh_display_color 6710 // Display Color
#define idh_display_category 6720 // Category Displays
#define idh_display_individual 6730 // Individual Displays
#define idh_display_freeze 6740 // Freeze Displays
#define idh_display_optimizations 6750 // Display Optimizations
#define idh_display_links 6760 // Display Links
// Dialog Box: Viewport Configuration
#define idh_dialog_viewport_configuration 7000 // main box
// render page
#define idh_vpconfig_render_page 7001 // render page
#define idh_vpconfig_rendering_level 7002 // rendering level (all)
#define idh_vpconfig_apply_to 7003 // apply to (for rendering level)
#define idh_vpconfig_rendering_options 7004 // rendering options
#define idh_vpconfig_fast_view 7005
#define idh_vpconfig_persp_user_view 7006
// layout page
#define idh_vpconfig_layout_page 7010
#define idh_vpconfig_layout_types 7011 // all layout buttons at top
#define idh_vpconfig_assign_view 7012 // view assignment region
#define idh_vpconfig_current_layout 7013
// safeframe page
#define idh_vpconfig_safeframe_page 7020
#define idh_vpconfig_safeframe_setup 7021 // setup portion
#define idh_vpconfig_safeframe_app 7022 // application portion
// degradation page
#define idh_vpconfig_degrade_page 7030 // degradation page
#define idh_vpconfig_general_degrade 7031 // general region
#define idh_vpconfig_active_degrade 7032 // active region
#define idh_vpconfig_parameters 7033 // degrade parameters
#define idh_vpconfig_interrupt 7034
// regions page
#define idh_vpconfig_regions_page 7040
#define idh_vpconfig_blowup_region 7041
#define idh_vpconfig_subregion 7042
// Dialog Box: Path Configuration
#define idh_dialog_configure_paths 7050 // main box
// general page
#define idh_paths_general_page 7051 // general page
#define idh_paths_plugin_page 7061 // plugin page
#define idh_paths_bitmaps_page 7062 // bitmaps page
// Dialog Box: Preference Setting
#define idh_dialog_preference_settings 8000 // main box
// general page
#define idh_pref_general_page 8010
#define idh_pref_preview_options 8011
#define idh_pref_icon_size 8012
#define idh_pref_layout 8013
#define idh_pref_system_units 8014
#define idh_pref_interaction 8015
// rendering page
#define idh_pref_rendering_page 8018
#define idh_pref_video_color 8019
#define idh_pref_dithering 8020
#define idh_pref_field_order 8021
#define idh_pref_super_black 8022
#define idh_pref_hotspot_falloff 8023
#define idh_pref_def_preview 8024
#define idh_pref_renderer 8025
#define idh_pref_render_terminate 8026
// IK page
#define idh_pref_ik_page 8029
#define idh_pref_applied_ik 8030
#define idh_pref_interactive_ik 8031
// animation page
#define idh_pref_animation_page 8034
#define idh_pref_key_brackets 8035
#define idh_pref_animate 8036
#define idh_pref_sound 8037
#define idh_pref_controller_defs 8038
// keyboard page
#define idh_pref_keyboard_page 8042
#define idh_pref_command 8043
#define idh_pref_shortcut 8044
#define idh_pref_sets 8045
// files page
#define idh_pref_files_page 8048
#define idh_pref_file_handling 8049
#define idh_pref_file_menu 8050
#define idh_pref_archive_system 8051
// gamma page
#define idh_pref_gamma_page 8054
#define idh_pref_display 8055
#define idh_pref_device 8056
#define idh_pref_files 8057
// viewports page
#define idh_pref_viewports_page 8060
#define idh_pref_viewport_params 8061
#define idh_pref_viewport_bkgnd 8062
#define idh_pref_move_xfm 8063
// colors page
#define idh_pref_colors_page 8065
// maxscript page
#define idh_pref_maxscript_page 8066
// Dialog Box: Select by Name
#define idh_dialog_select_by_name 8070
#define idh_sbn_list 8071
#define idh_sbn_list_control 8072 // bottom All/None/Inv and checkboxes
#define idh_sbn_sort 8073
#define idh_sbn_list_display 8074
#define idh_sbn_selection_sets 8075
// Scene Info dialog box
#define idh_dialog_scene_info 8080
#define idh_si_scene_totals 8081
#define idh_si_mesh_totals 8082
#define idh_si_memory 8083
#define idh_si_rendering 8084
#define idh_si_description 8085
#define idh_si_scene_info 8086
#define idh_si_save_to_file 8087
#define idh_si_plugin_info 8088
// Array dialog box
#define idh_dialog_array 8092
#define idh_ar_transformation 8093
#define idh_ar_type_of_entity 8094
#define idh_ar_total 8095
#define idh_ar_reset 8096
// Preview dialog box
#define idh_dialog_preview 8100
#define idh_pv_range 8101
#define idh_pv_frame_rate 8102
#define idh_pv_image_size 8103
#define idh_pv_display 8104
#define idh_pv_rnd_level 8105
#define idh_pv_output 8106
// dialogs with no "control level" granularity
#define idh_dialog_about 9000
#define idh_dialog_select_camera 9010
#define idh_dialog_collapse_warning 9020 // for both collapse all and collapse range
#define idh_dialog_edit_mod_stack 9030
#define idh_dialog_file_new 9040
#define idh_dialog_file_reset 9050
#define idh_dialog_object_prop 9060
#define idh_dialog_grid_snap_settings 9070
#define idh_dialog_group 9080
#define idh_dialog_import_name_conflict 9090
#define idh_dialog_missing_dlls 9100
#define idh_dialog_merge 9110
#define idh_dialog_merge_dup 9111
#define idh_dialog_merge_matlib 9112
#define idh_dialog_merge_matlib_dup 9113
#define idh_dialog_replace 9115
#define idh_dialog_mod_setup 9120
#define idh_dialog_choose_view 9130
#define idh_dialog_mtl_preview 9140
#define idh_dialog_object_color 9150
#define idh_dialog_clone_options 9160
#define idh_dialog_plugin_help 9170
#define idh_dialog_plugin_info 9180 // subdialog of scene info
#define idh_dialog_preview_cancel 9190
#define idh_dialog_rescale_time 9200
#define idh_dialog_time_config 9210
#define idh_dialog_topo_warning 9220 // topology warning
#define idh_dialog_units_setup 9230
#define idh_dialog_viewport_background 9240
#define idh_dialog_customize_ui 9245
#define idh_pref_draftrenderer 9250
// UI cutomization tabbed dialog
#define idh_customize_toolbars 9255 // toolbar page
#define idh_customize_menu 9260 // main menus page
#define idh_customize_quadmenus 9265 // quad menus page
#define idh_customize_colors 9270 // colors page
//Dans id's
#define idh_dialog_mtl_edit 10001
#define idh_dialog_medit_opt 10002
#define idh_dialog_put_medit 10003
#define idh_dialog_mtlbrows 10004
#define idh_dialog_render 10005
#define idh_dialog_excl_list 10006
#define idh_dialog_update_mtls 10007
// Gus' IDs
#define idh_net_server_window 10500 //-- Network Render SERVER main UI Window
#define idh_net_manager_window 10501 //-- Network Render MANAGER main UI Window
#define idh_net_logging_prop 10502 //-- Network Render log properties (common to both Manager and Server)
#define idh_net_manager_prop 10503 //-- Network Render Manager Properties Dialogue
#define idh_net_server_prop 10504 //-- Network Render Server Properties Dialogue
#define idh_net_job_assignment 10520 //-- Network Rendering - Job Assignment Dialogue
#define idh_net_job_assignment_srv_prop 10521 //-- Network Rendering - Job Assignment Dialogue - Server Properties
#define idh_net_job_assignment_srv_group 10522 //-- Create Server Group Dialog in Network Job Assignment
#define idh_net_job_assignment_srv_tabs 10523 //-- Set Server Properties (set the different tabs in the server list)
#define idh_net_qm_main 10530 //-- Queue Manager Main Window
#define idh_net_qm_client_list 10531 //-- Queue Manager - Client List Dialog
#define idh_net_qm_connect 10532 //-- Queue Manager - Connect Dialog
#define idh_net_qm_job_report 10533 //-- Queue Manager - Job Report Dialog
#define idh_net_qm_job_settings 10533 //-- Queue Manager - Job Settings Dialog
#define idh_net_qm_queue_control 10534 //-- Queue Manager - Someone else requests Queue Control Dialog
#define idh_net_qm_server_group 10535 //-- Queue Manager - Create Server Group (same as idh_net_job_assignment_srv_group above)
#define idh_net_qm_server_prop 10536 //-- Queue Manager - Server Properties (same as idh_net_job_assignment_srv_prop above)
#define idh_net_qm_server_tabs 10537 //-- Queue Manager - Set Server Properties (set the different tabs in the server list)
#define idh_net_qm_srv_week_schedule 10538 //-- Queue Manager - Server Week Schedule Dialog
#define idh_notify_main_ui 10600 //-- Notify.exe main UI
#define idh_bmm_vfb 10601 //-- BMM Virtual Frame Buffer Window
// Rolf's IDs
#define idh_dialog_trackview_ort 11000
#define idh_dialog_trackview_timepaste 11010
#define idh_dialog_trackview_trackpaste 11020
#define idh_dialog_trackview_reducekeys 11030
#define idh_dialog_trackview_filters 11040
#define idh_dialog_trackview_pick 11050
#define idh_dialog_trackview_choosecontrol 11060
#define idh_dialog_timeslide_createkey 11070
#define idh_dialog_pref_control_defaults 11080
#define idh_dialog_pref_select_class 11090
#define idh_dialog_snapshot 11100
#define idh_dialog_align 11110
#define idh_dialog_mirror 11120
#define idh_dialog_normal_align 11130
#define idh_dialog_view_align 11135
#define idh_dialog_render_params 11140
#define idh_dialog_render_presetsize 11160
#define idh_dialog_atmos 11170
#define idh_dialog_atmos_create 11180
#define idh_dialog_medit_browser 11190
#define idh_dialog_medit_puttolib 11200
#define idh_dialog_buttonsets 11210
#define idh_dialog_xform_typein 11220
#define idh_dialog_display_floater 11225
#define idh_dialog_effect 11230
#define idh_dialog_effect_create 11240
#define idh_dialog_obj_xref 11250 // Object xref dialog
#define idh_dialog_scene_xref 11260 // Scene xref dialog
#define idh_colorclip_floater 11270 // RB 12/07/2000: color clip board utility
#define idh_colorclip_floater 11270 // RB 12/07/2000: color clip board utility
// layer ids
#define idh_tb_layer_current_button 11500
#define idh_tb_layer_prop_button 11510
#define idh_tb_layer_list 11520
#define idh_tb_geom_prop_button 11530
// Schematic view ids...
#define idh_dialog_schematicview_filters 11600
// CCJ Dialog ids
#define idh_dialog_file_properties 11700
#define idh_ramplayer_window 11710
// Prs dialog ids
#define idh_3dsexp_export 11800 // 3DS Export Dialog
#define idh_3dsimp_import 11820 // 3DS Import Dialog
#if 0 // rollups, not currently associated with help
#define idh_vrmlexp_anchor 11840 // VRML97 Helpers: Anchor
#define idh_vrmlexp_audioclip 11841 // VRML97 Helpers: AudioClip
#define idh_vrmlexp_backgroundsky 11842 // VRML97 Helpers: Background: sky colors rollout
#define idh_vrmlexp_backgroundground 11843 // VRML97 Helpers: Background: ground colors rollout
#define idh_vrmlexp_backgroundimages 11844 // VRML97 Helpers: Background: images rollout
#define idh_vrmlexp_bboard 11845 // VRML97 Helpers: Billboard
#define idh_vrmlexp_fog 11846 // VRML97 Helpers: Fog
#define idh_vrmlexp_inline 11847 // VRML97 Helpers: Inline
#define idh_vrmlexp_lod 11848 // VRML97 Helpers: LOD
#define idh_vrmlexp_navinfo 11849 // VRML97 Helpers: NavigationInfo
#define idh_vrmlexp_proxsensor 11850 // VRML97 Helpers: ProximitySensor
#define idh_vrmlexp_sound 11851 // VRML97 Helpers: Sound
#define idh_vrmlexp_timesensor 11852 // VRML97 Helpers: TimeSensor
#define idh_vrmlexp_touchsensor 11853 // VRML97 Helpers: TouchSensor
#endif
#define idh_vrmlexp_export 11854 // VRML97 Export Dialog
#if 0 // rollups, not currently associated with help
#define idh_vrblout_inline 11870 // VRML/VRBL Inline Rollout
#define idh_vrblout_lod 11871 // VRML/VRBL Level of Detail Rollout
#define idh_vrblout_actions 11872 // VRML/VRBL Actions Rollout
#define idh_vrblout_animate 11873 // VRML/VRBL Animate Rollout
#define idh_vrblout_hyperlink 11874 // VRML/VRBL Hyperlink Jump Rollout
#define idh_vrblout_viewpoint 11875 // VRML/VRBL Set Camera Rollout
#define idh_vrblout_triggers 11876 // VRML/VRBL Triggers Rollout
#endif
#define idh_vrblout_export 11877 // VRML/VRBL Export Dialog
#define idh_vrmlimp_import 11890 // VRML Import Dialog
#define idh_dynamics_maindlg 11900 // Dynamics main Dialog
#define idh_dynamics_time 11901 // Dynamics time Dialog
#define idh_dynamics_editobj 11902 // Dynamics edit object Dialog
#define idh_dynamics_editobjlist 11903 // Dynamics edit object listDialog
#define idh_dynamics_collidelist 11904 // Dynamics collision list Dialog
#define idh_dynamics_effectslist 11905 // Dynamics effects list Dialog
#define idh_nurbs_editcrvonsrf 12001 // Edit Curve On Surface Dialog
#define idh_nurbs_selectbyname 12002 // Select Sub-Objects Dialog
#define idh_nurbs_edittexturesurf 12003 // Edit Texture Surface Dialog
#define idh_nurbs_makeloft 12004 // Make Loft Dialog
#define idh_nurbs_selectbyid 12005 // Select by material ID dialog
#define idh_nurbs_convertsurface 12006 // Convert Surface dialog
#define idh_nurbs_convertcurve 12007 // Convert Curve dialog
#define idh_nurbs_detach 12008 // Detach dialog
#define idh_nurbs_reparameterize 12009 // reparameterize dialog
#define idh_nurbs_makepointsurf 12010 // make point surface dialog
#define idh_nurbs_rebuildcvsurf 12011 // rebuild CV Surface dialog
#define idh_nurbs_rebuildtexturesurf 12012 // rebuild texture surface dialog
#define idh_nurbs_toolbox 12013 // toolbox dialog
#define idh_nurbs_advancedsurfapprox 12014 // advanced surface approximation dialog
#define idh_nurbs_rebuildcvcurv 12015 // rebuild CV Curv dialog
#define idh_parameter_wiring_dialog 12500 // paramteer wiring dialog
#endif // _CONTEXTIDS_H_

989
lib/maxsdk40/control.h Executable file
View File

@ -0,0 +1,989 @@
/**********************************************************************
*<
FILE: control.h
DESCRIPTION: Control definitions
CREATED BY: Dan Silva and Rolf Berteig
HISTORY: created 9 September 1994
*> Copyright (c) 1994, All Rights Reserved.
**********************************************************************/
#ifndef __CONTROL__
#define __CONTROL__
#include "plugapi.h"
extern CoreExport void ApplyScaling(Matrix3 &m, const ScaleValue &v);
extern CoreExport void InitControlLists();
class ScaleValue;
class ViewExp;
class INode;
class XFormModes;
class INodeTab;
class View;
CoreExport ScaleValue operator+(const ScaleValue& s0, const ScaleValue& s1);
CoreExport ScaleValue operator-(const ScaleValue& s0, const ScaleValue& s1);
CoreExport ScaleValue operator*(const ScaleValue& s, float f);
CoreExport ScaleValue operator*(float f, const ScaleValue& s);
CoreExport ScaleValue operator+(const ScaleValue& s, float f);
CoreExport ScaleValue operator+(float f, const ScaleValue& s);
class ScaleValue {
public:
Point3 s;
Quat q;
ScaleValue() {}
ScaleValue(const Point3& as) { s = as; q = IdentQuat(); }
ScaleValue(const Point3& as, const Quat& aq) {s = as; q = aq;}
ScaleValue& operator+=(const ScaleValue& s) {(*this)=(*this)+s;return (*this);}
ScaleValue& operator*=(const float s) {(*this)=(*this)*s;return (*this);}
ScaleValue& operator=(const ScaleValue &v) {s=v.s;q=v.q;return (*this);}
float& operator[](int el) {return s[el];}
};
// Types of ORTs
#define ORT_BEFORE 1
#define ORT_AFTER 2
// ORTs
#define ORT_CONSTANT 1
#define ORT_CYCLE 2
#define ORT_LOOP 3 // This is cycle with continuity.
#define ORT_OSCILLATE 4
#define ORT_LINEAR 5
#define ORT_IDENTITY 6
#define ORT_RELATIVE_REPEAT 7
// This structure is for collecting the return results of
// GetLocalTMComponents().
struct TMComponentsArg {
TMComponentsArg():position(0),rotation(0),scale(0),rotRep(kUnknown) {}
TMComponentsArg(Point3* pos, Interval* posInv, float* rot, Interval* rotInv,
ScaleValue* scl, Interval* sclInv)
: position(pos),posValidity(posInv),rotation(rot),rotValidity(rotInv)
, scale(scl),sclValidity(sclInv) {}
enum RotationRep {
// kXYZ should equals EULERTYPE_XYZ, which is 0.(c.f. euler.h)
kXYZ,
kXZY,
kYZX,
kYXZ,
kZXY,
kZYX,
kXYX,
kYZY,
kZXZ,
kQuat,
kUnknown
};
Point3* position;
Interval* posValidity;
// if not null, rotation should be a float[4]
float* rotation;
Interval* rotValidity;
RotationRep rotRep;
ScaleValue* scale;
Interval* sclValidity;
};
// An object of this class represents a Matrix3. However, its value can be
// obtained only by invoking the operator(). Derived classes may override
// this operator to delay its computation until operator() is called.
//
class Matrix3Indirect {
public:
Matrix3Indirect(){}
Matrix3Indirect(const Matrix3& m):mat(m){}
virtual ~Matrix3Indirect(){}
virtual const Matrix3& operator()() const { return mat; }
virtual void Set(const Matrix3& m) { mat = m; }
virtual Matrix3Indirect* Clone() const {return new Matrix3Indirect(mat);}
virtual void PreTranslate(const Point3& p){ mat.PreTranslate(p);}
virtual void PreRotateX(float x){ mat.PreRotateX(x); }
virtual void PreRotateY(float y){ mat.PreRotateY(y); }
virtual void PreRotateZ(float z){ mat.PreRotateZ(z); }
virtual void PreRotate(const Quat& q){PreRotateMatrix(mat,q);}
protected:
Matrix3 mat;
};
/*---------------------------------------------------------------------*/
// A list of ease curves.
class EaseCurveList : public ReferenceTarget {
friend class AddEaseRestore;
friend class DeleteEaseRestore;
private:
Tab<Control*> eases;
public:
EaseCurveList() {OpenTreeEntry(1,ALL_TRACK_VIEWS);}
CoreExport ~EaseCurveList();
CoreExport TimeValue ApplyEase(TimeValue t,Interval &valid);
CoreExport void AppendEaseCurve(Control *cont);
CoreExport void DeleteEaseCurve(int i);
CoreExport void DisableEaseCurve(int i);
CoreExport void EnableEaseCurve(int i);
CoreExport BOOL IsEaseEnabled(int i);
int NumEaseCurves() {return eases.Count();}
// Animatable
void GetClassName(TSTR& s) { s= TSTR(_T("EaseCurve")); }
Class_ID ClassID() { return Class_ID(EASE_LIST_CLASS_ID,0); }
SClass_ID SuperClassID() { return EASE_LIST_CLASS_ID; }
CoreExport int NumSubs();
CoreExport Animatable* SubAnim(int i);
CoreExport TSTR SubAnimName(int i);
int SubNumToRefNum(int subNum) {return subNum;}
BOOL BypassTreeView() { return TRUE; }
void DeleteThis() { delete this; }
ParamDimension* GetParamDimension(int i) {return stdTimeDim;}
CoreExport BOOL AssignController(Animatable *control,int subAnim);
CoreExport void* GetInterface(ULONG id);
CoreExport IOResult Save(ISave *isave);
CoreExport IOResult Load(ILoad *iload);
// Reference
CoreExport int NumRefs();
CoreExport RefTargetHandle GetReference(int i);
CoreExport void SetReference(int i, RefTargetHandle rtarg);
CoreExport RefTargetHandle Clone(RemapDir &remap = NoRemap());
CoreExport RefResult NotifyRefChanged(Interval changeInt, RefTargetHandle hTarget,
PartID& partID, RefMessage message);
};
class EaseCurveAnimProp : public AnimProperty {
public:
EaseCurveList *el;
EaseCurveAnimProp() { el=NULL; }
DWORD ID() {return PROPID_EASELIST;}
};
#define GetEaseListInterface(anim) ((EaseCurveList*)anim->GetInterface(I_EASELIST))
/*---------------------------------------------------------------------*/
// A list of multiplier curves.
class MultCurveList : public ReferenceTarget {
friend class AddMultRestore;
friend class DeleteMultRestore;
private:
Tab<Control*> mults;
public:
MultCurveList() {OpenTreeEntry(1,ALL_TRACK_VIEWS);}
CoreExport ~MultCurveList();
CoreExport float GetMultVal(TimeValue t,Interval &valid);
CoreExport void AppendMultCurve(Control *cont);
CoreExport void DeleteMultCurve(int i);
CoreExport void DisableMultCurve(int i);
CoreExport void EnableMultCurve(int i);
CoreExport BOOL IsMultEnabled(int i);
int NumMultCurves() {return mults.Count();}
// Animatable
void GetClassName(TSTR& s) { s= TSTR(_T("MultCurve")); }
Class_ID ClassID() { return Class_ID(MULT_LIST_CLASS_ID,0); }
SClass_ID SuperClassID() { return MULT_LIST_CLASS_ID; }
CoreExport int NumSubs();
CoreExport Animatable* SubAnim(int i);
CoreExport TSTR SubAnimName(int i);
int SubNumToRefNum(int subNum) {return subNum;}
BOOL BypassTreeView() { return TRUE; }
void DeleteThis() { delete this; }
ParamDimension* GetParamDimension(int i) {return stdNormalizedDim;}
CoreExport BOOL AssignController(Animatable *control,int subAnim);
CoreExport void* GetInterface(ULONG id);
CoreExport IOResult Save(ISave *isave);
CoreExport IOResult Load(ILoad *iload);
// Reference
CoreExport int NumRefs();
CoreExport RefTargetHandle GetReference(int i);
CoreExport void SetReference(int i, RefTargetHandle rtarg);
CoreExport RefTargetHandle Clone(RemapDir &remap = NoRemap());
CoreExport RefResult NotifyRefChanged(Interval changeInt, RefTargetHandle hTarget,
PartID& partID, RefMessage message);
};
class MultCurveAnimProp : public AnimProperty {
public:
MultCurveList *ml;
MultCurveAnimProp() { ml=NULL; }
DWORD ID() {return PROPID_MULTLIST;}
};
#define GetMultListInterface(anim) ((MultCurveList*)anim->GetInterface(I_MULTLIST))
/*---------------------------------------------------------------------*/
//
// For hit testing controller apparatus
//
class CtrlHitRecord {
friend class CtrlHitLog;
CtrlHitRecord *next;
public:
INode *nodeRef;
DWORD distance;
ulong hitInfo;
DWORD infoExtra;
CtrlHitRecord() {next=NULL; distance=0; hitInfo=0; nodeRef=NULL;}
CtrlHitRecord(CtrlHitRecord *nxt,INode *nr, DWORD d, ulong inf, DWORD extra) {
next=nxt;nodeRef=nr;distance=d;hitInfo=inf;infoExtra=extra;}
CtrlHitRecord *Next() {return next;}
};
class CtrlHitLog {
CtrlHitRecord *first;
int hitIndex;
public:
CtrlHitLog() { first = NULL; }
~CtrlHitLog() { Clear(); }
CoreExport void Clear();
CoreExport void ClearHitIndex() { hitIndex = 0; }
CoreExport void IncrHitIndex() { hitIndex++; }
CtrlHitRecord* First() { return first; }
CoreExport CtrlHitRecord* ClosestHit();
void LogHit(INode *nr,DWORD dist,ulong info,DWORD infoExtra)
{first = new CtrlHitRecord(first,nr,dist,info,infoExtra);}
};
// For enumerating IK paramaters
class IKEnumCallback {
public:
virtual void proc(Control *c, int index)=0;
};
class IKDeriv {
public:
virtual int NumEndEffectors()=0;
virtual Point3 EndEffectorPos(int index)=0;
virtual void DP(Point3 dp,int index)=0;
virtual void DR(Point3 dr,int index)=0;
virtual void NextDOF()=0;
};
// Flags passed to CompDerivs
#define POSITION_DERIV (1<<0)
#define ROTATION_DERIV (1<<1)
// This class is used to store IK parameters that have been
// copied to a clipboard.
class IKClipObject {
public:
// Identifies the creator of the clip object
virtual SClass_ID SuperClassID()=0;
virtual Class_ID ClassID()=0;
virtual void DeleteThis()=0;
};
// Values for 'which' pasted to Copy/PasteIKParams
#define COPYPASTE_IKPOS 1
#define COPYPASTE_IKROT 2
// Passed to InitIKJoints() which is called when importing
// R4 3DS files that have IK joint data.
class InitJointData {
public:
BOOL active[3];
BOOL limit[3];
BOOL ease[3];
Point3 min, max, damping;
};
// New for R4: include preferred angle
class InitJointData2 : public InitJointData {
public:
Point3 preferredAngle;
DWORD flags; // not used (must be 0) - for future expansion
InitJointData2() {flags=0;}
};
// This structure is passed to GetDOFParams().
// Controllers that support IK can provide info about their DOFs
// so that bones can display this information.
// The first 3 DOFs are assumed to be position
// and the next 3 are assumed to be rotation
class DOFParams {
public:
BOOL display[6]; // Should this DOF be displayed?
Point3 axis[6]; // DOF axis
Point3 pos[6]; // Base of axis
BOOL limit[6]; // is joint limited?
float min[6]; // min limit
float max[6]; // max limit
float curval[6]; // Current value of the parameter
BOOL sel[6]; // should DOF be highlighted
BOOL endEffector; // is there an end effector for this controller
Matrix3 eeTM; // world TM of the end effector if present
};
// These two ways values can be retreived or set.
// For get:
// RELATIVE = Apply
// ABSOLUTE = Just get the value
// For set:
// RELATIVE = Add the value to the existing value (i.e Move/Rotate/Scale)
// ABSOLUTE = Just set the value
enum GetSetMethod {CTRL_RELATIVE,CTRL_ABSOLUTE};
// Control class provides default implementations for load and save which save the ORT type in these chunks:
#define CONTROLBASE_CHUNK 0x8499
#define INORT_CHUNK 0x3000
#define OUTORT_CHUNK 0x3001
#define CONT_DISABLED_CHUNK 0x3002
// Inheritance flags.
#define INHERIT_POS_X (1<<0)
#define INHERIT_POS_Y (1<<1)
#define INHERIT_POS_Z (1<<2)
#define INHERIT_ROT_X (1<<3)
#define INHERIT_ROT_Y (1<<4)
#define INHERIT_ROT_Z (1<<5)
#define INHERIT_SCL_X (1<<6)
#define INHERIT_SCL_Y (1<<7)
#define INHERIT_SCL_Z (1<<8)
#define INHERIT_ALL 511
class Control : public ReferenceTarget {
public:
Control() {SetORT(ORT_CONSTANT,ORT_BEFORE);SetORT(ORT_CONSTANT,ORT_AFTER);};
virtual ~Control() {};
virtual void Copy(Control *from)=0;
virtual void CommitValue(TimeValue t) {}
virtual void RestoreValue(TimeValue t) {}
virtual INode* GetTarget() { return NULL; }
virtual RefResult SetTarget(INode *targ) {return REF_SUCCEED;}
// Implemented by transform controllers that have position controller
// that can be edited in the trajectory branch
virtual Control *GetPositionController() {return NULL;}
virtual Control *GetRotationController() {return NULL;}
virtual Control *GetScaleController() {return NULL;}
virtual BOOL SetPositionController(Control *c) {return FALSE;}
virtual BOOL SetRotationController(Control *c) {return FALSE;}
virtual BOOL SetScaleController(Control *c) {return FALSE;}
// If a controller has an 'X', 'Y', or 'Z' controller, it can implement
// these methods so that its sub controllers can respect track view filters
virtual Control *GetXController() {return NULL;}
virtual Control *GetYController() {return NULL;}
virtual Control *GetZController() {return NULL;}
// Implemented by look at controllers that have a float valued roll
// controller so that the roll can be edited via the transform type-in
virtual Control *GetRollController() {return NULL;}
virtual BOOL SetRollController(Control *c) {return FALSE;}
// Implemented by any Point3 controller that wishes to indicate that it is intended
// to control floating point RGB color values
virtual BOOL IsColorController() {return FALSE;}
// Implemented by TM controllers that support
// filtering out inheritance
virtual DWORD GetInheritanceFlags() {return INHERIT_ALL;}
virtual BOOL SetInheritanceFlags(DWORD f,BOOL keepPos) {return FALSE;} // return TRUE if TM controller supports inheritance
virtual BOOL IsLeaf() {return TRUE;}
virtual int IsKeyable() {return 1;}
// If a controller does not want to allow another controller
// to be assigned on top of it, it can return FALSE to this method.
virtual BOOL IsReplaceable() {return TRUE;}
// This is called on TM, pos, rot, and scale controllers when their
// input matrix is about to change. If they return FALSE, the node will
// call SetValue() to make the necessary adjustments.
virtual BOOL ChangeParents(TimeValue t,const Matrix3& oldP,const Matrix3& newP,const Matrix3& tm) {return FALSE;}
// val points to an instance of a data type that corresponds with the controller
// type. float for float controllers, etc.
// Note that for SetValue on Rotation controllers, if the SetValue is
// relative, val points to an AngAxis while if it is absolute it points
// to a Quat.
virtual void GetValue(TimeValue t, void *val, Interval &valid, GetSetMethod method=CTRL_ABSOLUTE)=0;
virtual void SetValue(TimeValue t, void *val, int commit=1, GetSetMethod method=CTRL_ABSOLUTE)=0;
// Definition: LocalMatrix = WorldMatrix * ParentWorldMatrix^(-1)
// This method returns the PRS components of the local
// matrix. In general, controller cannot decide on the local matrix
// without knowing the parent matrix. However, many
// controllers, such as default controllers, are well defined
// without the parent matrix. In these cases, it is more
// efficient compute the local components directly without
// going through the world matrix. Therefore, the argument
// parentMatrix is a reference to Matrix3Indirect. This would
// allow clients to supply a "delayed parent matrix," which
// will be computed only if it is necessary. It returns true
// for Matrix3, Position, Rotation, or Scale controllers, and
// return false otherwise.
// The PRS components will be put in argument cmpts in the
// respective fields with corresponding validity
// intervals. NULL pointer, of TMComponentsArg::position for
// example, indicates that the client is not concerned about
// the component. When it is not NULL, the corresponding
// pointer to the validity interval MUST NOT be NULL. When it
// is not NULL, TMComponentsArg::rotation is a float[4].
// rotRep tells what the numbers mean.
// Position, Rotation, or Scale, controllers will put results
// at the respective component when the corresponding pointer
// is not NULL.
// Upon entry, parentMatrix should represent the parent matrix up
// to the first requested components. For Matrix3 controllers, for
// example, if cmpts.position==NULL && cmpts.rotation!=NULL, then
// parentMatrix should be matrix that includes the parent node matrix
// plus the position of this node. Upon return, this matrix may be
// modified.
CoreExport virtual bool GetLocalTMComponents(TimeValue t, TMComponentsArg& cmpts, Matrix3Indirect& parentMatrix);
// Transform controllers that do not inherit their parent's transform
// should override this method. Returning FALSE will cause SetValue
// to be called even in the case when the parent is also being transformed.
virtual BOOL InheritsParentTransform() { return TRUE; }
virtual int GetORT(int type) {return (aflag>>(type==ORT_BEFORE?A_ORT_BEFORESHIFT:A_ORT_AFTERSHIFT))&A_ORT_MASK;}
CoreExport virtual void SetORT(int ort,int type);
// Sets the enabled/disabled state for ORTs
CoreExport virtual void EnableORTs(BOOL enable);
// Default implementations of load and save handle loading and saving of out of range type.
// Call these from derived class load and save.
// NOTE: Must call these before any of the derived class chunks are loaded or saved.
CoreExport IOResult Save(ISave *isave);
CoreExport IOResult Load(ILoad *iload);
// For IK
// Note: IK params must be given in the order they are applied to
// the parent matrix. When derivatives are computed for a parameter
// that parameter will apply itself to the parent matrix so the next
// parameter has the appropriate reference frame. If a controller isn't
// participating in IK then it should return FALSE and the client (usually PRS)
// will apply the controller's value to the parent TM.
virtual void EnumIKParams(IKEnumCallback &callback) {}
virtual BOOL CompDeriv(TimeValue t,Matrix3& ptm,IKDeriv& derivs,DWORD flags) {return FALSE;}
virtual float IncIKParam(TimeValue t,int index,float delta) {return 0.0f;}
virtual void ClearIKParam(Interval iv,int index) {return;}
virtual BOOL CanCopyIKParams(int which) {return FALSE;}
virtual IKClipObject *CopyIKParams(int which) {return NULL;}
virtual BOOL CanPasteIKParams(IKClipObject *co,int which) {return FALSE;}
virtual void PasteIKParams(IKClipObject *co,int which) {}
virtual void InitIKJoints(InitJointData *posData,InitJointData *rotData) {}
virtual BOOL GetIKJoints(InitJointData *posData,InitJointData *rotData) {return FALSE;}
virtual BOOL GetDOFParams(TimeValue t,Matrix3 &ptm,DOFParams &dofs,BOOL nodeSel) {return FALSE;}
virtual BOOL CreateLockKey(TimeValue t, int which) {return FALSE;}
virtual void MirrorIKConstraints(int axis,int which,BOOL pasteMirror=FALSE) {}
virtual BOOL TerminateIK() {return FALSE;} // controllers can act as terminators.
// New for R4
virtual void InitIKJoints2(InitJointData2 *posData,InitJointData2 *rotData) {}
virtual BOOL GetIKJoints2(InitJointData2 *posData,InitJointData2 *rotData) {return FALSE;}
// Called on a transform controller when the a message is received from a pin node
virtual RefResult PinNodeChanged(RefMessage message,Interval changeInt, PartID &partID) {return REF_SUCCEED;}
// Called on a transform controller when one of the node level IK parameters has been changed
virtual void NodeIKParamsChanged() {}
// Called in a transform controller when a node invalidates its TM cache
virtual void TMInvalidated() {}
// Let's the TM controller determine if it's OK to bind (IK bind) to a particular node.
virtual BOOL OKToBindToNode(INode *node) {return TRUE;}
// Ease curves
virtual BOOL CanApplyEaseMultCurves() {return TRUE;}
CoreExport TimeValue ApplyEase(TimeValue t,Interval &valid);
CoreExport void AppendEaseCurve(Control *cont);
CoreExport void DeleteEaseCurve(int i);
CoreExport int NumEaseCurves();
// Multiplier curves
CoreExport float GetMultVal(TimeValue t,Interval &valid);
CoreExport void AppendMultCurve(Control *cont);
CoreExport void DeleteMultCurve(int i);
CoreExport int NumMultCurves();
// These are implemented to handle ease curves. If a controller
// is a leaf controller, then it MUST NOT BY DEFINITION have any
// sub controllers or references. If it is a leaf controller, then
// these are implemented to handle the ease curve list.
// If it is NOT a leaf controller, then these can be overridden.
CoreExport int NumRefs();
CoreExport RefTargetHandle GetReference(int i);
CoreExport void SetReference(int i, RefTargetHandle rtarg);
CoreExport int NumSubs();
CoreExport Animatable* SubAnim(int i);
CoreExport TSTR SubAnimName(int i);
// Default implementations of some Animatable methods
CoreExport void* GetInterface(ULONG id);
CoreExport int PaintFCurves(
ParamDimensionBase *dim,
HDC hdc,
Rect& rcGraph,
Rect& rcPaint,
float tzoom,
int tscroll,
float vzoom,
int vscroll,
DWORD flags );
CoreExport int GetFCurveExtents(
ParamDimensionBase *dim,
float &min, float &max, DWORD flags);
// This is called on transform controller after a node is
// cloned and the clone process has finished
virtual void PostCloneNode() {}
// Slave TM controllers can implement this to prevent plug-ins
// deleting their node via the DeleteNode API.
virtual BOOL PreventNodeDeletion() {return FALSE;}
// New interface for visibility float controllers to allow view dependent visibility
// The default implementation will call GetValue()
CoreExport virtual float EvalVisibility(TimeValue t,View &view,Box3 pbox,Interval &valid);
// Called on visibility controllers. Gives them the option to completely hide an object in the viewports
virtual BOOL VisibleInViewports() {return TRUE;}
// Called on transform controllers or visibility controllers when a node is cloned and the user has chosen to instance
virtual BOOL CanInstanceController() {return TRUE;}
// Should be called by any leaf controller's clone method so
// that ease and multipier curves are cloned.
CoreExport void CloneControl(Control *ctrl,RemapDir &remap);
//-------------------------------------------------------
// Controllers that wish to have an apparatus available in
// the scene will implement these methods:
// NOTE: Most of these methods are duplicated in BaseObject or Object
// (see object.h for descriptions).
virtual int Display(TimeValue t, INode* inode, ViewExp *vpt, int flags) { return 0; };
virtual int HitTest(TimeValue t, INode* inode, int type, int crossing, int flags, IPoint2 *p, ViewExp *vpt) { return 0; }
virtual void GetWorldBoundBox(TimeValue t,INode* inode, ViewExp *vpt, Box3& box) {}
virtual void ActivateSubobjSel(int level, XFormModes& modes ) {}
virtual void SelectSubComponent(CtrlHitRecord *hitRec, BOOL selected, BOOL all, BOOL invert=FALSE) {}
virtual void ClearSelection(int selLevel) {}
virtual int SubObjectIndex(CtrlHitRecord *hitRec) {return 0;}
virtual void SelectAll(int selLevel) {}
virtual void InvertSelection(int selLevel) {}
virtual void GetSubObjectCenters(SubObjAxisCallback *cb,TimeValue t,INode *node) {}
virtual void GetSubObjectTMs(SubObjAxisCallback *cb,TimeValue t,INode *node) {}
// Modify sub object apparatuses
virtual void SubMove( TimeValue t, Matrix3& partm, Matrix3& tmAxis, Point3& val, BOOL localOrigin=FALSE ){}
virtual void SubRotate( TimeValue t, Matrix3& partm, Matrix3& tmAxis, Quat& val, BOOL localOrigin=FALSE ){}
virtual void SubScale( TimeValue t, Matrix3& partm, Matrix3& tmAxis, Point3& val, BOOL localOrigin=FALSE ){}
// Schematic View Animatable Overides...
CoreExport SvGraphNodeReference SvTraverseAnimGraph(IGraphObjectManager *gom, Animatable *object, int id, DWORD flags);
// Called when the user rescales time in the time configuration dialog. If FALSE
// is returned from this method then MapKeys() will be used to perform the scaling.
// Controllers can override this method to handle things like rescaling tagents that
// MapKeys() won't affect and return TRUE if they don't want map keys to be called.
virtual BOOL RescaleTime(Interval oseg, Interval nseg) {return FALSE;}
//watje these are to allow a control to get sampled at a different rate than
//what trackview does by default so the controller can speed up redraws
//this is the pixel sample rate for when the curve is drawn
virtual int GetDrawPixelStep() {return 5;}
//this is the ticks sample rate for when the curve is checked for its y extents
virtual int GetExtentTimeStep() {return 40;}
};
// Any controller that does not evaluate itself as a function of it's
// input can subclass off this class.
// GetValueLocalTime() will never ask the controller to apply the value,
// it will always ask for it absolute.
class StdControl : public Control {
public:
virtual void GetValueLocalTime(TimeValue t, void *val, Interval &valid, GetSetMethod method=CTRL_ABSOLUTE)=0;
virtual void SetValueLocalTime(TimeValue t, void *val, int commit=1, GetSetMethod method=CTRL_ABSOLUTE)=0;
CoreExport void GetValue(TimeValue t, void *val, Interval &valid, GetSetMethod method=CTRL_ABSOLUTE);
CoreExport void SetValue(TimeValue t, void *val, int commit=1, GetSetMethod method=CTRL_ABSOLUTE);
// Computes the local components without calling parentMatrix
// for position, rotation, and Scale controllers.
CoreExport bool GetLocalTMComponents(TimeValue t, TMComponentsArg& cmpts, Matrix3Indirect& parentMatrix);
virtual void Extrapolate(Interval range,TimeValue t,void *val,Interval &valid,int type)=0;
virtual void *CreateTempValue()=0;
virtual void DeleteTempValue(void *val)=0;
virtual void ApplyValue(void *val, void *delta)=0;
virtual void MultiplyValue(void *val, float m)=0;
};
// Each super class of controller may have a specific packet defined that
// the 'val' pointer will point to instead of a literal value.
// In reality, probably only the Transform controller will do this.
enum SetXFormCommand { XFORM_MOVE, XFORM_ROTATE, XFORM_SCALE, XFORM_SET };
class SetXFormPacket {
public:
SetXFormCommand command;
Matrix3 tmParent;
Matrix3 tmAxis; // if command is XFORM_SET, this will contain the new value for the XFORM.
Point3 p;
Quat q;
AngAxis aa;
BOOL localOrigin;
// XFORM_SET
SetXFormPacket(const Matrix3& mat,const Matrix3& par=Matrix3(1))
{command=XFORM_SET,tmParent=par,tmAxis=mat;}
// XFORM_MOVE
SetXFormPacket(Point3 pt, const Matrix3& par=Matrix3(1),
const Matrix3& a=Matrix3(1))
{command=XFORM_MOVE;tmParent=par;tmAxis=a;p=pt;localOrigin=FALSE;}
// XFORM_ROTATE
SetXFormPacket(Quat qt, BOOL l, const Matrix3& par=Matrix3(1),
const Matrix3& a=Matrix3(1))
{command=XFORM_ROTATE;tmParent=par;tmAxis=a;q=qt;aa=AngAxis(q);localOrigin=l;}
SetXFormPacket(AngAxis aA, BOOL l, const Matrix3& par=Matrix3(1),
const Matrix3& a=Matrix3(1))
{command=XFORM_ROTATE;tmParent=par;tmAxis=a;q=Quat(aA);aa=aA;localOrigin=l;}
// XFORM_SCALE
SetXFormPacket(Point3 pt, BOOL l, const Matrix3& par=Matrix3(1),
const Matrix3& a=Matrix3(1))
{command=XFORM_SCALE;tmParent=par;tmAxis=a;p=pt;localOrigin=l;}
// Just in case you want to do it by hand...
SetXFormPacket() {};
};
// This is a special control base class for controllers that control
// morphing of geomoetry.
//
// The 'val' pointer used with GetValue will point to an object state.
// This would be the result of evaluating a combination of targets and
// producing a new object that is some combination of the targets.
//
// The 'val' pointer used with SetValue will point to a
// SetMorphTargetPacket data structure. This has a pointer to
// an object (entire pipeline) and the name of the target.
// A pointer to one of these is passed to SetValue
class SetMorphTargetPacket {
public:
Matrix3 tm;
Object *obj;
TSTR name;
BOOL forceCreate; // Make sure the key is created even if it is at frame 0
SetMorphTargetPacket(Object *o,TSTR n,Matrix3 &m,BOOL fc=FALSE) {obj = o;name = n;tm = m;forceCreate=fc;}
SetMorphTargetPacket(Object *o,TSTR n,BOOL fc=FALSE) {obj = o;name = n;tm = Matrix3(1);forceCreate=fc;}
};
class MorphControl : public Control {
public:
// Access the object pipelines of the controller's targets. Note
// that these are pointers to the pipelines, not the result of
// evaluating the pipelines.
virtual int NumMorphTargs() {return 0;}
virtual Object *GetMorphTarg(int i) {return NULL;}
virtual void DeleteMorphTarg(int i) {}
virtual void GetMorphTargName(int i,TSTR &name) {name.printf(_T("Target #%d"),i);}
virtual void SetMorphTargName(int i,TSTR name) {}
virtual Matrix3 GetMorphTargTM(int i) {return Matrix3(1);}
// Checks an object to see if it is an acceptable target.
virtual BOOL ValidTarget(TimeValue t,Object *obj) {return FALSE;}
// When a REFMSG_SELECT_BRANCH message is received the morph controller should
// mark the target indicated and be prepared to return its ID from this method.
virtual int GetFlaggedTarget() {return -1;}
// Should call these methods on targets
virtual BOOL HasUVW() { return 1; }
virtual void SetGenUVW(BOOL sw) { }
};
//-------------------------------------------------------------
// Control base class for Master Controllers
//
class MasterPointControl : public Control {
public:
// Set the number of sub-controllers
virtual void SetNumSubControllers(int num, BOOL keep=FALSE) {}
// Return the number of sub-controllers
virtual int GetNumSubControllers() { return 0; }
// Delete all the sub-controllers that are set to TRUE in the BitArray
virtual void DeleteControlSet (BitArray set) {}
// Add a new sub-controller
virtual int AddSubController(Control* ctrl) { return 0; }
// Return i'th of sub-controller
virtual Control* GetSubController(int i) { return NULL; }
// Set the i'th sub-controller
virtual void SetSubController(int i, Control* ctrl) {}
};
//----------------------------------------------------------------//
//
// Some stuff to help with ORTs - these could actually be Interval methods
inline TimeValue CycleTime(Interval i,TimeValue t)
{
int res, dur = i.Duration()-1;
if (dur<=0) return t;
res = (t-i.Start())%dur;
if (t<i.Start()) {
return i.End()+res;
} else {
return i.Start()+res;
}
}
inline int NumCycles(Interval i,TimeValue t)
{
int dur = i.Duration()-1;
if (dur<=0) return 1;
if (t<i.Start()) {
return (abs(t-i.Start())/dur)+1;
} else
if (t>i.End()) {
return (abs(t-i.End())/dur)+1;
} else {
return 0;
}
}
// Types that use this template must support:
// T + T, T - T, T * float, T + float
template <class T> T
LinearExtrapolate(TimeValue t0, TimeValue t1, T &val0, T &val1, T &endVal)
{
return (T)(endVal + (val1-val0) * float(t1-t0));
}
template <class T> T
RepeatExtrapolate(Interval range, TimeValue t,
T &startVal, T &endVal, T &cycleVal)
{
int cycles = NumCycles(range,t);
T delta;
if (t<range.Start()) {
delta = startVal - endVal;
} else {
delta = endVal - startVal;
}
return (T)(cycleVal + delta * float(cycles));
}
template <class T> T
IdentityExtrapolate(TimeValue endPoint, TimeValue t, T &endVal )
{
return (T)(endVal + float(t-endPoint));
}
CoreExport Quat LinearExtrapolate(TimeValue t0, TimeValue t1, Quat &val0, Quat &val1, Quat &endVal);
CoreExport Quat RepeatExtrapolate(Interval range, TimeValue t,
Quat &startVal, Quat &endVal, Quat &cycleVal);
CoreExport Quat IdentityExtrapolate(TimeValue endPoint, TimeValue t, Quat &endVal );
CoreExport ScaleValue LinearExtrapolate(TimeValue t0, TimeValue t1, ScaleValue &val0, ScaleValue &val1, ScaleValue &endVal);
CoreExport ScaleValue RepeatExtrapolate(Interval range, TimeValue t, ScaleValue &startVal, ScaleValue &endVal, ScaleValue &cycleVal);
CoreExport ScaleValue IdentityExtrapolate(TimeValue endPoint, TimeValue t, ScaleValue &endVal);
template <class T> T
LinearInterpolate(const T &v0,const T &v1,float u)
{
return (T)((1.0f-u)*v0 + u*v1);
}
inline Quat
LinearInterpolate(const Quat &v0,const Quat &v1,float u)
{
return Slerp(v0,v1,u);
}
inline ScaleValue
LinearInterpolate(const ScaleValue &v0,const ScaleValue &v1,float u)
{
ScaleValue res;
res.s = ((float)1.0-u)*v0.s + u*v1.s;
res.q = Slerp(v0.q,v1.q,u);
return res;
}
inline Interval TestInterval(Interval iv, DWORD flags)
{
TimeValue start = iv.Start();
TimeValue end = iv.End();
if (!(flags&TIME_INCLEFT)) {
start++;
}
if (!(flags&TIME_INCRIGHT)) {
end--;
}
if (end<start) {
iv.SetEmpty();
} else {
iv.Set(start,end);
}
return iv;
}
inline Quat ScaleQuat(Quat q, float s)
{
float angle;
Point3 axis;
AngAxisFromQ(q,&angle,axis);
return QFromAngAxis(angle*s,axis);
}
//-------------------------------------------------------------------
// A place to store values during Hold/Restore periods
//
//********************************************************
// TempStore: This is a temporary implementation:
// It uses a linear search-
// A hash-coded dictionary would be faster.
// (if there are ever a lot of entries)
//********************************************************
struct Slot {
void *key;
void *pdata;
int nbytes;
Slot *next;
public:
Slot() { pdata = NULL; }
~Slot() {
if (pdata) free(pdata);
pdata = NULL;
}
};
class TempStore {
Slot *slotList;
Slot* Find(int n, void *data, void *ptr);
public:
TempStore() { slotList = NULL; }
~TempStore() { ClearAll(); }
CoreExport void ClearAll(); // empty out the store
CoreExport void PutBytes(int n, void *data, void *ptr);
CoreExport void GetBytes(int n, void *data, void *ptr);
CoreExport void Clear(void *ptr); // Remove single entry
void PutFloat(float f, void *ptr) {
PutBytes(sizeof(float),(void *)&f,ptr);
}
CoreExport void PutInt(int i, void *ptr) {
PutBytes(sizeof(int),(void *)&i,ptr);
}
CoreExport void GetFloat(float *f, void *ptr) {
GetBytes(sizeof(float),(void *)f,ptr);
}
CoreExport void GetInt(int *i, void *ptr) {
GetBytes(sizeof(int),(void *)i,ptr);
}
CoreExport void PutPoint3(Point3 f, void *ptr) {
PutBytes(sizeof(Point3),(void *)&f,ptr);
}
CoreExport void GetPoint3(Point3 *f, void *ptr) {
GetBytes(sizeof(Point3),(void *)f,ptr);
}
CoreExport void PutQuat( Quat f, void *ptr) {
PutBytes(sizeof(Quat),(void *)&f,ptr);
}
CoreExport void GetQuat( Quat *f, void *ptr) {
GetBytes(sizeof(Quat),(void *)f,ptr);
}
CoreExport void PutScaleValue( ScaleValue f, void *ptr) {
PutBytes(sizeof(ScaleValue),(void *)&f,ptr);
}
CoreExport void GetScaleValue( ScaleValue *f, void *ptr) {
GetBytes(sizeof(ScaleValue),(void *)f,ptr);
}
};
extern CoreExport TempStore tmpStore; // this should be in the scene data struct.
CoreExport int Animating(); // is the animate switch on??
CoreExport void AnimateOn(); // turn animate on
CoreExport void AnimateOff(); // turn animate off
CoreExport void SuspendAnimate(); // suspend animation (uses stack)
CoreExport void ResumeAnimate(); // resume animation ( " )
CoreExport TimeValue GetAnimStart();
CoreExport TimeValue GetAnimEnd();
CoreExport void SetAnimStart(TimeValue s);
CoreExport void SetAnimEnd(TimeValue e);
CoreExport Control *NewDefaultFloatController();
CoreExport Control *NewDefaultPoint3Controller();
CoreExport Control *NewDefaultMatrix3Controller();
CoreExport Control *NewDefaultPositionController();
CoreExport Control *NewDefaultRotationController();
CoreExport Control *NewDefaultScaleController();
CoreExport Control *NewDefaultBoolController();
CoreExport Control *NewDefaultColorController();
CoreExport Control *NewDefaultMasterPointController();
CoreExport Control* CreateInterpFloat();
CoreExport Control* CreateInterpPosition();
CoreExport Control* CreateInterpPoint3();
CoreExport Control* CreateInterpRotation();
CoreExport Control* CreateInterpScale();
CoreExport Control* CreatePRSControl();
CoreExport Control* CreateLookatControl();
CoreExport Control* CreateMasterPointControl();
CoreExport void SetDefaultController(SClass_ID sid, ClassDesc *desc);
CoreExport ClassDesc *GetDefaultController(SClass_ID sid);
CoreExport void SetDefaultColorController(ClassDesc *desc);
CoreExport void SetDefaultBoolController(ClassDesc *desc);
CoreExport BOOL GetSetKeyMode();
CoreExport void SetSetKeyMode(BOOL onOff);
CoreExport void SuspendSetKeyMode();
CoreExport void ResumeSetKeyMode();
CoreExport BOOL IsSetKeyModeFeatureEnabled();
#endif //__CONTROL__

Some files were not shown because too many files have changed in this diff Show More