HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SIM_SolverBlend.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  */
7 
8 #ifndef __SIM_SolverBlend_h__
9 #define __SIM_SolverBlend_h__
10 
11 #include "SIM_API.h"
12 #include <UT/UT_Array.h>
13 #include "SIM_Solver.h"
14 #include "SIM_OptionsUser.h"
15 
16 class SIM_PerObjectBlendData;
17 
18 /// This solver class passes the solve responsibility to one or more other
19 /// solvers. It searches for any SIM_Solver subdata attached to itself, and
20 /// calls each one in turn.
22  public SIM_OptionsUser
23 {
24 public:
29 
30 protected:
31  /// Basic SIM_SolverBlend constructor.
32  explicit SIM_SolverBlend(const SIM_DataFactory *factory);
33  /// Basic SIM_SolverBlend destructor.
34  virtual ~SIM_SolverBlend();
35 
36  /// Override this function to pass this call along to our child solvers.
38  SIM_ObjectArray &objects,
39  SIM_ObjectArray &newobjects,
40  SIM_ObjectArray &feedbacktoobjects,
41  const SIM_Time &timestep);
42  /// Override this function to get the requirements of our child solvers.
43  virtual int getRequestedCacheSubclass() const;
44  virtual void getImpulseMassMatrixSubclass(
45  const SIM_Object &object,
46  const UT_Vector3 &impulseworldpos,
47  UT_DMatrix3 &immatrix) const;
49  const SIM_Object &object,
50  int ptnum, UT_DMatrix3 &immatrix) const;
52  const SIM_Object &object) const;
53  virtual fpreal getPropertyAtPositionSubclass(const SIM_Object &object,
54  const UT_Vector3 &worldpos,
55  const SIM_Property &property) const;
56  virtual fpreal getPropertyAtPointSubclass(const SIM_Object &object,
57  int ptnum,
58  const SIM_Property &property) const;
60  const SIM_Object &object,
61  UT_String &label) const;
62  virtual void getDefaultColliderSubclass(
63  const SIM_Object &object,
64  const UT_String &colliderlabel,
65  UT_String &collidertype,
66  bool &colliderreverseobjectroles) const;
67 
68  /// Gets the SIM_BlendFactor data for all the objects in an array.
69  void getBlendFactorsSubdata(
70  const SIM_ObjectArray &objects,
71  const char *blenddataname,
72  const char *solverparmsroot,
73  SIM_PerObjectBlendData *blenddata,
74  UT_StringArray *subsolvernames);
75 
76 private:
77  /// Gets the solver parm data for a single object.
78  void getBlendFactorsSubdata(
79  SIM_Object &object,
80  const char *blenddataname,
81  const char *solverparmsroot,
82  SIM_PerObjectBlendData &blenddata,
83  UT_StringArray *subsolvernames);
84 
85  void prepareObjectsForSolve(
86  const SIM_ObjectArray &objects,
87  SIM_PerObjectBlendData *blenddata,
88  int solverindex,
89  const char *blenddataname);
90  void cleanupObjectsAfterSolve(
91  const SIM_ObjectArray &objects,
92  SIM_PerObjectBlendData *blenddata,
93  int solverindex,
94  const char *blenddataname);
95  void blendAllSolvedData(
96  const SIM_ObjectArray &objects,
97  SIM_PerObjectBlendData *blenddata,
98  int numsolvers,
99  const char *blenddataname);
100  /// Gets the solver to use for getting object properties.
101  const SIM_Solver *getCurrentSolver() const;
102 
103  static const SIM_DopDescription *getSolverBlendDopDescription();
104 
105  SIM_Solver *myCurrentSolver;
106 
109  SIM_Solver,
110  "Blend Solver",
111  getSolverBlendDopDescription());
112 };
113 
114 #endif
#define DECLARE_STANDARD_GETCASTTOTYPE()
Definition: SIM_DataUtils.h:45
#define SIM_NAME_PRIMARYSOLVER
Definition: SIM_Names.h:169
GLuint GLsizei const GLchar * label
Definition: glcorearb.h:2544
#define GETSET_DATA_FUNCS_B(DataName, FuncName)
#define GETSET_DATA_FUNCS_S(DataName, FuncName)
#define SIM_NAME_BLENDFACTORSROOTNAME
Definition: SIM_Names.h:79
virtual void getDefaultColliderSubclass(const SIM_Object &object, const UT_String &colliderlabel, UT_String &collidertype, bool &colliderreverseobjectroles) const
virtual int getRequestedCacheSubclass() const
#define DECLARE_DATAFACTORY(DataClass, SuperClass, Description, DopParms)
Definition: SIM_DataUtils.h:58
Holds pointers to a number of SIM_Object objects.
#define SIM_NAME_BLENDDATANAME
Definition: SIM_Names.h:77
virtual void getImpulseMassMatrixSubclass(const SIM_Object &object, const UT_Vector3 &impulseworldpos, UT_DMatrix3 &immatrix) const
#define GETSET_DATA_FUNCS_I(DataName, FuncName)
virtual SIM_PointImpulseMassMatrixResolver * getPointImpulseMassMatrixResolverSubclass(const SIM_Object &object) const
Builds a resolver for evaluating mass matrices swiftly.
#define SIM_NAME_MATCHBYNAME
Definition: SIM_Names.h:143
virtual SIM_Result solveObjectsSubclass(SIM_Engine &engine, SIM_ObjectArray &objects, SIM_ObjectArray &newobjects, SIM_ObjectArray &feedbacktoobjects, const SIM_Time &timestep)=0
virtual fpreal getPropertyAtPositionSubclass(const SIM_Object &object, const UT_Vector3 &worldpos, const SIM_Property &property) const
virtual void getDefaultColliderLabelSubclass(const SIM_Object &object, UT_String &label) const
Gets the default collider label for an object using this solver.
double fpreal
Definition: SYS_Types.h:263
#define SIM_API
Definition: SIM_API.h:10
virtual void getPointImpulseMassMatrixSubclass(const SIM_Object &object, int ptnum, UT_DMatrix3 &immatrix) const
SIM_Property
virtual fpreal getPropertyAtPointSubclass(const SIM_Object &object, int ptnum, const SIM_Property &property) const