source: golgotha/src/max_plugin/sdk_inc/interpik.h @ 80

Last change on this file since 80 was 80, checked in by Sam Hocevar, 11 years ago
  • Adding the Golgotha source code. Not sure what's going to be interesting in there, but since it's all public domain, there's certainly stuff to pick up.
  • Property svn:keywords set to Id
File size: 5.1 KB
Line 
1/**********************************************************************
2 *<
3        FILE: iterpik.h
4
5        DESCRIPTION:  Implements IK related methods for interp controllers
6
7        CREATED BY: Rolf Berteig
8
9        HISTORY: created 6/19/95
10
11 *>     Copyright (c) 1994, All Rights Reserved.
12 **********************************************************************/
13
14#ifndef __INTERPIK_H__
15#define __INTERPIK_H__
16
17
18#define PROPID_INTERPUI         (PROPID_USER+1)
19#define PROPID_JOINTPARAMS      (PROPID_USER+2)
20#define PROPID_KEYINFO          (PROPID_USER+3)
21
22// Flags for JointParams
23#define JNT_XACTIVE             (1<<0)
24#define JNT_YACTIVE             (1<<1)
25#define JNT_ZACTIVE             (1<<2)
26#define JNT_XLIMITED    (1<<3)
27#define JNT_YLIMITED    (1<<4)
28#define JNT_ZLIMITED    (1<<5)
29#define JNT_XEASE               (1<<6)
30#define JNT_YEASE               (1<<6)
31#define JNT_ZEASE               (1<<6)
32
33#define JNT_LIMITEXACT  (1<<28)
34#define JNT_ROLLOPEN    (1<<29)
35#define JNT_ROT                 (1<<30)
36#define JNT_POS                 (1<<31)
37
38
39class InterpCtrlUI : public AnimProperty {
40        public:
41                HWND hParams;
42                IObjParam *ip;
43                Control *cont;
44               
45                InterpCtrlUI(HWND h,IObjParam *i,Control *c)
46                        {hParams=h;ip=i;cont=c;}
47               
48                ~InterpCtrlUI() {}
49                DWORD ID() {return PROPID_INTERPUI;}           
50        };
51
52class InterpKeyInfo : public AnimProperty {
53        public:
54                DWORD ID() {return PROPID_KEYINFO;}
55                virtual ~InterpKeyInfo() {}
56        };
57
58
59// IK Joint parameters
60class JointParams : public AnimProperty {
61        public:
62                float *min, *max;
63                float *damping;
64                float scale;
65                DWORD flags;
66                int dofs;
67
68                CoreExport JointParams(DWORD type=JNT_POS,int dofs=3,float s=1.0f);
69                CoreExport JointParams(const JointParams &j);
70                CoreExport ~JointParams();
71                DWORD ID() {return PROPID_JOINTPARAMS;}
72
73                CoreExport JointParams&  operator=(JointParams& j);
74
75                // Returns TRUE if the curent state is the default.
76                CoreExport BOOL IsDefault();
77               
78                CoreExport IOResult Save(ISave *isave);
79                CoreExport IOResult Load(ILoad *iload);
80
81                // Applies contraints to the given delta based on parameters and the current value v.
82                CoreExport float ConstrainInc(int index,float v,float delta);           
83               
84                // Access bits
85                BOOL Active(int i) {return (flags&(JNT_XACTIVE<<i))?TRUE:FALSE;}
86                BOOL Limited(int i) {return (flags&(JNT_XLIMITED<<i))?TRUE:FALSE;}
87                BOOL Ease(int i) {return (flags&(JNT_XEASE<<i))?TRUE:FALSE;}
88                DWORD Type() {return flags & (JNT_POS|JNT_ROT);}
89                BOOL RollupOpen() {return (flags&JNT_ROLLOPEN)?TRUE:FALSE;}
90                void SetActive(int i,BOOL s) {if (s) flags|=(JNT_XACTIVE<<i); else flags&=~(JNT_XACTIVE<<i);}
91                void SetLimited(int i,BOOL s) {if (s) flags|=(JNT_XLIMITED<<i); else flags&=~(JNT_XLIMITED<<i);}
92                void SetEase(int i,BOOL s) {if (s) flags|=(JNT_XEASE<<i); else flags&=~(JNT_XEASE<<i);}
93                void SetType(DWORD type) {flags&=~(JNT_POS|JNT_ROT);flags|=type;}
94                void SetRollOpen(BOOL open) {if (open) flags|=JNT_ROLLOPEN; else flags&= ~JNT_ROLLOPEN;}
95
96                // This is the interactive adjustment of limits
97                CoreExport virtual void SpinnerChange(InterpCtrlUI *ui,WORD id,ISpinnerControl *spin,BOOL interactive);
98
99                // These methods manage the joint parameters dialog.
100                CoreExport void InitDialog(InterpCtrlUI *ui);
101                CoreExport void EndDialog(InterpCtrlUI *ui,BOOL dontDel=FALSE);         
102                CoreExport void SpinnerDown(InterpCtrlUI *ui,WORD id,ISpinnerControl *spin);
103                CoreExport void SpinnerUp(InterpCtrlUI *ui,WORD id,ISpinnerControl *spin,BOOL accept);
104                CoreExport void Command(InterpCtrlUI *ui,WORD notify, WORD id, HWND hCtrl);
105                CoreExport void EnableDisable(InterpCtrlUI *ui);
106        };
107
108
109// Just holds a couple of pointers.
110class JointDlgData {
111        public:
112                InterpCtrlUI *ui;
113                JointParams *jp;       
114                JointDlgData(InterpCtrlUI *ui,JointParams *jp) {this->ui=ui;this->jp=jp;}
115        };
116
117// A window proc for handling joint parameters.
118CoreExport BOOL CALLBACK JointParamDlgProc(HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam);
119
120
121// Handles the IK functions for all types of point3 and quat key frame controllers.
122void QuatEnumIKParams(Control *cont,IKEnumCallback &callback);
123BOOL QuatCompDeriv(Control *cont,TimeValue t,Matrix3& ptm,IKDeriv& derivs,DWORD flags);
124float QuatIncIKParam(Control *cont,TimeValue t,int index,float delta);
125CoreExport void QuatBeginIKParams(Control *cont,IObjParam *ip, ULONG flags,Animatable *prev);
126void Point3EnumIKParams(Control *cont,IKEnumCallback &callback);
127BOOL Point3CompDeriv(Control *cont,TimeValue t,Matrix3& ptm,IKDeriv& derivs,DWORD flags);
128float Point3IncIKParam(Control *cont,TimeValue t,int index,float delta);
129CoreExport void Point3BeginIKParams(Control *cont,IObjParam *ip, ULONG flags,Animatable *prev);
130
131CoreExport BOOL CanCopyIKParams(Control *cont,int which);
132CoreExport IKClipObject *CopyIKParams(Control *cont,int which);
133CoreExport BOOL CanPasteIKParams(Control *cont,IKClipObject *co,int which);
134CoreExport void PasteIKParams(Control *cont,IKClipObject *co,int which);
135
136CoreExport void InitIKJointsPos(Control *cont,InitJointData *posData);
137CoreExport void InitIKJointsRot(Control *cont,InitJointData *rotData);
138
139
140#endif //__INTERPIK_H__
141
Note: See TracBrowser for help on using the repository browser.