source: golgotha/src/max_plugin/sdk_inc/istdplug.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: 16.6 KB
Line 
1/**********************************************************************
2 *<
3        FILE: istdplug.h
4
5        DESCRIPTION:  Interfaces into some of the standard plug-ins
6                      that ship with MAX
7
8        CREATED BY: Rolf Berteig       
9
10        HISTORY: created 20 January 1996
11
12 *>     Copyright (c) 1994, All Rights Reserved.
13 **********************************************************************/
14
15#ifndef __ISTDPLUG__
16#define __ISTDPLUG__
17
18//----------------------------------------------------------------
19// The following are parameter block IDs for procedural objects
20
21// Arc
22#define ARC_RADIUS              0
23#define ARC_FROM                1
24#define ARC_TO                  2
25#define ARC_PIE                 3
26
27// Box object
28#define BOXOBJ_LENGTH   0
29#define BOXOBJ_WIDTH    1
30#define BOXOBJ_HEIGHT   2
31#define BOXOBJ_WSEGS    3
32#define BOXOBJ_LSEGS    4
33#define BOXOBJ_HSEGS    5
34#define BOXOBJ_GENUVS   6
35
36// Circle
37#define CIRCLE_RADIUS           0
38
39// Cone
40#define CONE_RADIUS1            0
41#define CONE_RADIUS2            1
42#define CONE_HEIGHT                     2
43#define CONE_SEGMENTS           3
44#define CONE_CAPSEGMENTS        4
45#define CONE_SIDES                      5
46#define CONE_SMOOTH                     6
47#define CONE_SLICEON            7
48#define CONE_PIESLICE1          8
49#define CONE_PIESLICE2          9
50#define CONE_GENUVS                     10
51
52// Cylinder
53#define CYLINDER_RADIUS                 0
54#define CYLINDER_HEIGHT                 1
55#define CYLINDER_SEGMENTS               2
56#define CYLINDER_CAPSEGMENTS    3
57#define CYLINDER_SIDES                  4
58#define CYLINDER_SMOOTH                 5
59#define CYLINDER_SLICEON                6
60#define CYLINDER_PIESLICE1              7
61#define CYLINDER_PIESLICE2              8
62#define CYLINDER_GENUVS                 9
63
64// Donut
65#define DONUT_RADIUS1           0
66#define DONUT_RADIUS2           1
67
68// Ellipse
69#define ELLIPSE_LENGTH          0
70#define ELLIPSE_WIDTH           1
71
72// Hedra
73#define HEDRA_RADIUS    0
74#define HEDRA_FAMILY    1
75#define HEDRA_P                 2
76#define HEDRA_Q                 3
77#define HEDRA_SCALEP    4
78#define HEDRA_SCALEQ    5
79#define HEDRA_SCALER    6
80#define HEDRA_VERTS             7
81#define HEDRA_GENUVS    8
82
83// Helix
84#define HELIX_RADIUS1           0
85#define HELIX_RADIUS2           1
86#define HELIX_HEIGHT            2
87#define HELIX_TURNS                     3
88#define HELIX_BIAS                      4
89#define HELIX_DIRECTION         5
90
91// NGon
92#define NGON_RADIUS                     0
93#define NGON_SIDES                      1
94#define NGON_CIRCULAR           2
95
96// PatchGrid
97#define PATCHGRID_LENGTH        0
98#define PATCHGRID_WIDTH         1
99#define PATCHGRID_WSEGS         2
100#define PATCHGRID_LSEGS         3
101
102// Rain/snow
103#define RSPART_VPTPARTICLES             0
104#define RSPART_DROPSIZE                 1
105#define RSPART_SPEED                    2
106#define RSPART_VARIATION                3
107#define RSPART_TUMBLE                   4
108#define RSPART_SCALE                    5
109#define RSPART_DISPTYPE                 6
110#define RSPART_STARTTIME                7
111#define RSPART_LIFETIME                 8
112#define RSPART_EMITTERWIDTH             9
113#define RSPART_EMITTERHEIGHT    10
114#define RSPART_HIDEEMITTER              11
115#define RSPART_BIRTHRATE                12
116#define RSPART_CONSTANT                 13
117#define RSPART_RENDER                   14
118
119// Rectangle
120#define RECTANGLE_LENGTH        0
121#define RECTANGLE_WIDTH         1
122
123// Sphere
124#define SPHERE_RADIUS   0
125#define SPHERE_SEGS             1
126#define SPHERE_SMOOTH   2
127#define SPHERE_HEMI             3
128#define SPHERE_SQUASH   4
129#define SPHERE_RECENTER 5
130#define SPHERE_GENUVS   6
131
132// Star
133#define START_RADIUS1           0
134#define START_RADIUS2           1
135#define START_POINTS            2
136#define START_DISTORT           3
137
138// Tea Pot
139#define TEAPOT_RADIUS   0
140#define TEAPOT_SEGS             1
141#define TEAPOT_SMOOTH   2
142#define TEAPOT_TEAPART  3
143
144// Text
145#define TEXT_SIZE 0
146
147// torus
148#define TORUS_RADIUS            0
149#define TORUS_RADIUS2           1
150#define TORUS_ROTATION          2
151#define TORUS_TWIST                     3
152#define TORUS_SEGMENTS          4
153#define TORUS_SIDES                     5
154#define TORUS_SMOOTH            6
155#define TORUS_SLICEON           7
156#define TORUS_PIESLICE1         8
157#define TORUS_PIESLICE2         9
158#define TORUS_GENUVS            10
159
160// Tube
161#define TUBE_RADIUS                     0
162#define TUBE_RADIUS2            1
163#define TUBE_HEIGHT                     2
164#define TUBE_SEGMENTS           3
165#define TUBE_CAPSEGMENTS        4
166#define TUBE_SIDES                      5
167#define TUBE_SMOOTH                     6
168#define TUBE_SLICEON            7
169#define TUBE_PIESLICE1          8
170#define TUBE_PIESLICE2          9
171#define TUBE_GENUVS                     10
172
173// Grid
174#define GRIDHELP_LENGTH                 0
175#define GRIDHELP_WIDTH                  1
176#define GRIDHELP_GRID                   2
177
178
179//----------------------------------------------------------------
180// The following are parameter block IDs for modifiers
181
182// Bend
183#define BEND_ANGLE              0
184#define BEND_DIR                1
185#define BEND_AXIS               2
186#define BEND_DOREGION   3
187#define BEND_FROM               4
188#define BEND_TO                 5
189
190// Bomb
191#define BOMB_STRENGTH           0
192#define BOMB_GRAVITY            1
193#define BOMB_CHAOS                      2
194#define BOMB_DETONATION         3
195
196// Deflector
197#define DEFLECTOR_BOUNCE        0
198#define DEFLECTOR_WIDTH         1
199#define DEFLECTOR_HEIGHT        2
200
201// Displace (modifier and space warp object)
202#define DISPLACE_MAPTYPE                0
203#define DISPLACE_UTILE                  1
204#define DISPLACE_VTILE                  2
205#define DISPLACE_WTILE                  3
206#define DISPLACE_BLUR                   4
207#define DISPLACE_USEMAP                 5
208#define DISPLACE_APPLYMAP               6
209#define DISPLACE_STRENGTH               7
210#define DISPLACE_DECAY                  8
211#define DISPLACE_CENTERLUM              9
212#define DISPLACE_UFLIP                  10
213#define DISPLACE_VFLIP                  11
214#define DISPLACE_WFLIP                  12
215
216// Extrude
217#define EXTRUDE_AMOUNT                  0
218#define EXTRUDE_SEGS                    1
219#define EXTRUDE_CAPSTART                2
220#define EXTRUDE_CAPEND                  3
221#define EXTRUDE_CAPTYPE                 4
222#define EXTRUDE_OUTPUT                  5
223#define EXTRUDE_MAPPING                 6
224
225// Gravity
226#define GRAVITY_STRENGTH                0
227#define GRAVITY_DECAY                   1
228#define GRAVITY_TYPE                    2
229#define GRAVITY_DISPLENGTH              3
230
231// Wind
232#define WIND_STRENGTH           0
233#define WIND_DECAY                      1
234#define WIND_TYPE                       2
235#define WIND_DISPLENGTH         3
236#define WIND_TURBULENCE         4
237#define WIND_FREQUENCY          5
238#define WIND_SCALE                      6
239
240// UVW map
241#define UVWMAP_MAPTYPE          0
242#define UVWMAP_UTILE            1
243#define UVWMAP_VTILE            2
244#define UVWMAP_WTILE            3
245#define UVWMAP_UFLIP            4
246#define UVWMAP_VFLIP            5
247#define UVWMAP_WFLIP            6
248#define UVWMAP_CAP                      7
249
250// Noise mod
251#define NOISEMOD_SEED                   0
252#define NOISEMOD_SCALE                  1
253#define NOISEMOD_FRACTAL                2
254#define NOISEMOD_ROUGH                  3
255#define NOISEMOD_ITERATIONS             4
256#define NOISEMOD_ANIMATE                5
257#define NOISEMOD_FREQ                   6
258#define NOISEMOD_PHASE                  7
259#define NOISEMOD_STRENGTH               8
260
261// Optimize
262#define OPTMOD_RENDER                   0
263#define OPTMOD_VIEWS                    1
264#define OPTMOD_FACETHRESH1              2
265#define OPTMOD_EDGETHRESH1              3
266#define OPTMOD_BIAS1                    4
267#define OPTMOD_PRESERVEMAT1             5
268#define OPTMOD_PRESERVESMOOTH1  6
269#define OPTMOD_FACETHRESH2              7
270#define OPTMOD_EDGETHRESH2              8
271#define OPTMOD_BIAS2                    9
272#define OPTMOD_PRESERVEMAT2             10
273#define OPTMOD_PRESERVESMOOTH2  11
274#define OPTMOD_AUTOEDGE                 12
275
276// Volume selection modifier
277#define VOLSEL_LEVEL    0
278#define VOLSEL_METHOD   1
279#define VOLSEL_TYPE             2
280#define VOLSEL_VOLUME   3
281#define VOLSEL_INVERT   4
282
283// Ripple/Wave space warp object and object space modifier
284#define RWAVE_AMPLITUDE         0
285#define RWAVE_AMPLITUDE2        1
286#define RWAVE_WAVELEN           2
287#define RWAVE_PHASE                     3
288#define RWAVE_DECAY                     4
289
290#define RWAVE_CIRCLES           5 // These last three are only valid for space warp objects
291#define RWAVE_SEGMENTS          6
292#define RWAVE_DIVISIONS         7
293
294// Ripple/Wave binding (modifier)
295#define RWAVE_FLEX                      0
296
297// Skew
298#define SKEW_AMOUNT             0
299#define SKEW_DIR                1
300#define SKEW_AXIS               2
301#define SKEW_DOREGION   3
302#define SKEW_FROM               4
303#define SKEW_TO                 5
304
305// Material modifier
306#define MATMOD_MATID 0
307
308// Smoothing group modifier
309#define SMOOTHMOD_AUTOSMOOTH    0
310#define SMOOTHMOD_THRESHOLD             1
311#define SMOOTHMOD_SMOOTHBITS    2
312
313// Normal modifier
314#define NORMMOD_UNIFY   0
315#define NORMMOD_FLIP    1
316
317// SurfRev (Lathe) modifier
318#define SURFREV_DEGREES                 0
319#define SURFREV_SEGS                    1
320#define SURFREV_CAPSTART                2
321#define SURFREV_CAPEND                  3
322#define SURFREV_CAPTYPE                 4
323#define SURFREV_WELDCORE                5
324#define SURFREV_OUTPUT                  6
325#define SURFREV_MAPPING                 7
326// Taper
327#define TAPER_AMT                       0
328#define TAPER_CRV                       1
329#define TAPER_AXIS                      2
330#define TAPER_EFFECTAXIS        3
331#define TAPER_SYMMETRY          4
332#define TAPER_DOREGION          5
333#define TAPER_FROM                      6
334#define TAPER_TO                        7
335
336// Twist
337#define TWIST_ANGLE             0
338#define TWIST_BIAS              1
339#define TWIST_AXIS              2
340#define TWIST_DOREGION  3
341#define TWIST_FROM              4
342#define TWIST_TO                5
343
344
345//-- Text shape object interface -------------------------
346
347// Use GetTextObjectInterface() to get a pointer to an
348// ITextObject given a pointer to an Object.
349
350
351// Flags passed to ChangeFont()
352#define TEXTOBJ_ITALIC          (1<<1)
353#define TEXTOBJ_UNDERLINE       (1<<2)
354
355class ITextObject {
356        public:
357                // Returns TRUE if string is changed. Can't change string if current font is not installed
358                virtual BOOL ChangeText(TSTR string)=0;
359               
360                // Returns TRUE if font is successfully changed.
361                virtual BOOL ChangeFont(TSTR name, DWORD flags)=0;
362
363                // Get fount and string
364                virtual TSTR GetFont()=0;
365                virtual TSTR GetString()=0;
366               
367                // Get/Set styles
368                virtual BOOL GetItalic()=0;
369                virtual BOOL GetUnderline()=0;
370                virtual void SetItalic(BOOL sw)=0;
371                virtual void SetUnderline(BOOL sw)=0;
372        };
373
374
375
376//-- Controller interfaces -------------------------------
377
378// Base key class
379class IKey {
380        public:
381                TimeValue time;
382                DWORD flags;
383                IKey() {time=0;flags=0;}
384        };
385
386//--- TCB keys -------------
387
388class ITCBKey : public IKey {
389        public:         
390                float tens, cont, bias, easeIn, easeOut;
391        };
392
393class ITCBFloatKey : public ITCBKey {
394        public:
395                float val;             
396        };
397
398class ITCBPoint3Key : public ITCBKey {
399        public:
400                Point3 val;             
401        };
402
403class ITCBRotKey : public ITCBKey {
404        public:
405                AngAxis val;           
406        };
407
408class ITCBScaleKey : public ITCBKey {
409        public:
410                ScaleValue val;         
411        };
412
413
414//--- Bezier keys -------------
415
416class IBezFloatKey : public IKey {
417        public:
418                float intan, outtan;
419                float val;
420        };
421
422class IBezPoint3Key : public IKey {
423        public:
424                Point3 intan, outtan;
425                Point3 val;
426        };
427
428class IBezQuatKey : public IKey  {
429        public:         
430                Quat val;
431        };
432
433class IBezScaleKey : public IKey  {
434        public:
435                Point3 intan, outtan;
436                ScaleValue val;
437        };
438
439
440//--- Linear Keys --------------
441
442class ILinFloatKey : public IKey {
443        public:
444                float val;
445        };
446
447class ILinPoint3Key : public IKey {
448        public:
449                Point3 val;
450        };
451
452class ILinRotKey : public IKey {
453        public:
454                Quat val;
455        };
456
457class ILinScaleKey : public IKey {
458        public:
459                ScaleValue val;
460        };
461
462
463// --- Flag bits for keys -------------------------------
464
465// General flags
466#define IKEY_SELECTED   (1<<0)
467#define IKEY_XSEL               (1<<1)
468#define IKEY_YSEL               (1<<2)
469#define IKEY_ZSEL               (1<<3)
470#define IKEY_FLAGGED    (1<<13)
471#define IKEY_TIME_LOCK  (1<<14)
472
473// TCB specific key flags
474#define TCBKEY_QUATVALID        (1<<4) // When this bit is set the angle/axis is derived from the quat instead of vice/versa
475
476// Bezier specific key flags
477#define BEZKEY_XBROKEN          (1<<4) // Broken means not locked
478#define BEZKEY_YBROKEN          (1<<5)
479#define BEZKEY_ZBROKEN          (1<<6)
480
481// The in and out types are stored in bits 7-13
482#define BEZKEY_NUMTYPEBITS      3
483#define BEZKEY_INTYPESHIFT      7
484#define BEZKEY_OUTTYPESHIFT     (BEZKEY_INTYPESHIFT+BEZKEY_NUMTYPEBITS)
485#define BEZKEY_TYPEMASK         7
486
487// Bezier tangent types
488#define BEZKEY_SMOOTH   0
489#define BEZKEY_LINEAR   1
490#define BEZKEY_STEP             2
491#define BEZKEY_FAST             3
492#define BEZKEY_SLOW             4
493#define BEZKEY_USER             5
494
495#define NUM_TANGENTTYPES        6
496
497// This key is interpolated using arclength as the interpolation parameter
498#define BEZKEY_CONSTVELOCITY    (1<<15)
499
500#define TangentsLocked(f,j) (!(f&(BEZKEY_XBROKEN<<j)))
501#define SetTangentLock(f,j,l) {if (l) (f)=(f)&(~(BEZKEY_XBROKEN<<j)); else (f)|=(BEZKEY_XBROKEN<<j);}
502
503// Macros to access hybrid tangent types
504#define GetInTanType(f)  int(((f)>>BEZKEY_INTYPESHIFT)&BEZKEY_TYPEMASK)
505#define GetOutTanType(f) int(((f)>>BEZKEY_OUTTYPESHIFT)&BEZKEY_TYPEMASK)
506#define SetInTanType(f,t)  {(f) = ((f)&(~(BEZKEY_TYPEMASK<<BEZKEY_INTYPESHIFT)))|(t<<BEZKEY_INTYPESHIFT);}
507#define SetOutTanType(f,t) {(f) = ((f)&(~(BEZKEY_TYPEMASK<<BEZKEY_OUTTYPESHIFT)))|(t<<BEZKEY_OUTTYPESHIFT);}
508
509
510// Track flags
511#define TFLAG_CURVESEL                  (1<<0)
512#define TFLAG_RANGE_UNLOCKED    (1<<1)
513#define TFLAG_LOOPEDIN                  (1<<3)
514#define TFLAG_LOOPEDOUT                 (1<<4)
515#define TFLAG_COLOR                             (1<<5)  // Set for Bezier Point3 controlers that are color controllers
516#define TFLAG_HSV                               (1<<6)  // Set for color controls that interpolate in HSV
517
518
519//-------------------------------------------------------
520// This is an interface into either a TCB or Bezier key
521// frame controller. It is up to the client to make sure
522// that the IKey* point to a key of the approriate derived
523// class based on the ClassID() of the controller.
524
525class IKeyControl {
526        public:
527                // Total number of keys.
528                virtual int GetNumKeys()=0;
529               
530                // Sets the number of keys allocated.
531                // May add blank keys or delete existing keys
532                virtual void SetNumKeys(int n)=0;
533               
534                // Fill in 'key' with the ith key
535                virtual void GetKey(int i,IKey *key)=0;
536               
537                // Set the ith key
538                virtual void SetKey(int i,IKey *key)=0;
539
540                // Append a new key onto the end. Note that the
541                // key list will ultimately be sorted by time. Returns
542                // the key's index.
543                virtual int AppendKey(IKey *key)=0;
544
545                // If any changes are made that would require the keys to be sorted
546                // this method should be called.
547                virtual void SortKeys()=0;             
548
549                // Access track flags
550                virtual DWORD &GetTrackFlags()=0;
551        };
552
553// To get a pointer to the above interface given a pointer to a controller
554// use the macro defined in animtbl.h: GetKeyControlInterface()
555
556
557
558//-----------------------------------------------------------
559// A plug-in can register itself to read a particular APP_DATA
560// chunk when a 3DS file is loaded. If a chunk is encountered
561// that matches a registered plug-in, that plug-in will be
562// asked to create an instance of itself based on the contents
563// of the APP_DATA chunk.
564
565class TriObject;
566
567class ObjectDataReaderCallback {
568        public:
569                // Chunk name
570                virtual char *DataName()=0;
571
572                // Create an instance of an object based on the data and the original mesh object
573                virtual Object *ReadData(TriObject *obj, void *data, DWORD len)=0;
574
575                virtual void DeleteThis()=0;
576        };
577 
578CoreExport void RegisterObjectAppDataReader(ObjectDataReaderCallback *cb);
579 
580CoreExport Object *ObjectFromAppData(TriObject *obj, char *name, void *data, DWORD len);
581
582
583// Note about 3DS App Data:
584// If app data is encountered and no plug-in has registered to
585// convert it, then it is just hung off the object (or INode in
586// the case of KXP app data).
587// For object app data, TriObject's super class and class ID are used
588// to identify the chunk and the sub ID is set to 0.
589// For node app data, INode's super class and class ID are used
590// to identify the chunk and the sub ID is set to 0.
591//
592// This single MAX app data chunk will contain the entire
593// 3DS app data chunk, which may have sub chunks (see IPAS SDK).
594// The following routines will aid in parsing 3DS app data.
595
596// Get the ID string out of an XDATA_ENTRY chunk and null terminates it
597CoreExport void GetIDStr(char *chunk, char *idstring);
598
599// Returns the offset into 'appd' of the specified chunk
600// or -1 if it is not found
601CoreExport int FindAppDataChunk(void *appd, DWORD len, char *idstring);
602
603// Similar to Find, but actually returns a pointer to the chunk
604// or NULL if it is not found
605CoreExport void *GetAppDataChunk(void *appd, DWORD len, char *idstring);
606
607// Adds the chunk to the appdata chunk, preserving existing chunks.
608// 'chunk' should point to the new chunk header followed by its data.
609CoreExport int SetAppDataChunk(void **pappd, DWORD &len, void *chunk);
610
611// Deletes a chunk from the appdata while preserving other chunks.
612CoreExport int DeleteAppDataChunk(void **pappd, DWORD &len, char *idstring);
613
614// Known sub chunks inside an appdata chunk
615#define XDATA_ENTRY             0x8001
616#define XDATA_APPNAME   0x8002
617
618
619
620//---------------------------------------------------------
621// Interface into MAX's default WAV sound object
622// use the Interface method GetSoundObject() to get a pointer
623// to the current sound object and then use the
624// GetWaveSoundInterface() on the result to see if it supports
625// this interface.
626
627class IWaveSound {
628        public:
629                // Retreives the name of the current sound file
630                virtual TSTR GetSoundFileName()=0;
631               
632                // Sets the sound file. This will cause the WAV to
633                // be loaded into the tack view. Returns FALSE if
634                // the file can't be opened or no wave track exist.
635                virtual BOOL SetSoundFileName(TSTR name)=0;
636
637                // Set the time offset for the wave
638                virtual void SetStartTime(TimeValue t)=0;
639
640                // Get the time offset for the wave
641                virtual TimeValue GetStartTime()=0;             
642                virtual TimeValue GetEndTime()=0;
643        };
644
645
646
647
648#endif //__ISTDPLUG__
Note: See TracBrowser for help on using the repository browser.