iWaveOcean
3ds Max ocean simulation plugin
iWaveOcean.h
1 #pragma once
2 
3 //**************************************************************************/
4 // Copyright (c) 1998-2007 Autodesk, Inc.
5 // All rights reserved.
6 //
7 // These coded instructions, statements, and computer programs contain
8 // unpublished proprietary information written by Autodesk, Inc., and are
9 // protected by Federal copyright law. They may not be disclosed to third
10 // parties or copied or duplicated in any form, in whole or in part, without
11 // the prior written consent of Autodesk, Inc.
12 //**************************************************************************/
13 // DESCRIPTION: Includes for Plugins
14 // AUTHOR:
15 //***************************************************************************/
16 
17 #include "3dsmaxsdk_preinclude.h"
18 #include "resource.h"
19 #include <istdplug.h>
20 #include <iparamb2.h>
21 #include <iparamm2.h>
22 #include <maxtypes.h>
23 #include <Simpobj.h>
24 #include <mouseman.h>
25 //SIMPLE TYPE
26 
27 #include <mouseman.h>
28 #include <triobj.h>
29 
30 #include "Simulator.h"
31 
32 extern TCHAR *GetString(int id);
33 
34 extern HINSTANCE hInstance;
35 
36 #define iWaveOcean_CLASS_ID Class_ID(0xd9edfdd9, 0x93776fa5)
37 
38 class iWaveOcean : public SimpleObject2
39 {
40  // Simulation cache
41  Simulator _sim;
42  HWND _simulateRollup;
43  HWND _saveDataRollup;
44 
45 public:
46  //Constructor/Destructor
47  iWaveOcean();
48  virtual ~iWaveOcean();
49 
50  // Static stuff for rollup management
51  static iWaveOcean* instanceForSimulate;
52  static iWaveOcean* instanceForSaveData;
53 
54  // Static stuff for simulation cache
55  static HWND startFrameStatic;
56  static HWND numFramesStatic;
57 
58  static INT_PTR CALLBACK SimulateRollupDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
59  static void UpdateStatus();
60  static void SimulateProgress(Simulator* simulator);
61  static void SimulateDone(Simulator* simulator);
62 
63  // Static stuff for save data picker
64  static INT_PTR CALLBACK SaveDataRollupDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
65  static void UpdateSaveInfo(HWND hDlg);
66 
67  // Parameter block handled by parent
68  static IObjParam *ip; // Access to the interface
69 
70  // From BaseObject
71  virtual CreateMouseCallBack* GetCreateMouseCallBack();
72 
73  // From Object
74  virtual BOOL HasUVW();
75  virtual void SetGenUVW(BOOL sw);
76  virtual int CanConvertToType(Class_ID obtype);
77  virtual Object* ConvertToType(TimeValue t, Class_ID obtype);
78  virtual void GetCollapseTypes(Tab<Class_ID>& clist,Tab<TSTR*>& nlist);
79  virtual int IntersectRay(TimeValue t, Ray& ray, float& at, Point3& norm);
80  virtual BOOL IsWorldSpaceObject() { return TRUE; }
81 
82  // From Animatable
83  virtual void BeginEditParams( IObjParam *ip, ULONG flags,Animatable *prev);
84  virtual void EndEditParams( IObjParam *ip, ULONG flags,Animatable *next);
85 
86  // From SimpleObject
87  virtual void BuildMesh(TimeValue t);
88  virtual void InvalidateUI();
89 
90  // Loading/Saving
91  virtual IOResult Load(ILoad *iload);
92  virtual IOResult Save(ISave *isave);
93 
94  //From Animatable
95  virtual Class_ID ClassID() { return iWaveOcean_CLASS_ID; }
96  virtual SClass_ID SuperClassID() { return GEOMOBJECT_CLASS_ID; }
97  virtual void GetClassName(TSTR& s) { s = GetString(IDS_CLASS_NAME); }
98  virtual const wchar_t* GetObjectName() { return _M("iWave"); }
99 
100  virtual RefTargetHandle Clone( RemapDir& remap );
101 
102  virtual int NumParamBlocks() { return 1; } // return number of ParamBlocks in this instance
103  virtual IParamBlock2* GetParamBlock(int /*i*/) { return pblock2; } // return i'th ParamBlock
104  virtual IParamBlock2* GetParamBlockByID(BlockID id) { return (pblock2->ID() == id) ? pblock2 : NULL; } // return id'd ParamBlock
105 
106  void DeleteThis() { delete this; }
107 };
108 
109 enum { iwaveocean_params };
110 
111 enum {
112  // Size
113  pb_width,
114  pb_length,
115  pb_width_segs,
116  pb_length_segs,
117  // Dynamics
118  pb_sim_start,
119  pb_sim_length,
120  pb_collision_objs,
121  pb_wave_damping,
122  pb_collision_smoothing,
123  pb_wake_power,
124  pb_height_scale,
125  // Ambient
126  pb_ambient_on,
127  pb_ambient_height,
128  pb_min_wave_size,
129  pb_wind_speed,
130  pb_wind_direction,
131  pb_seed,
132  pb_duration,
133  pb_ambient_scale
134 };
Definition: Simulator.h:15
Definition: iWaveOcean.h:38