HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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  ~SIM_SolverBlend() override;
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) override;
42  /// Override this function to get the requirements of our child solvers.
43  int getRequestedCacheSubclass() const override;
45  const SIM_Object &object,
46  const UT_Vector3 &impulseworldpos,
47  UT_DMatrix3 &immatrix) const override;
49  const SIM_Object &object,
50  int ptnum, UT_DMatrix3 &immatrix
51  ) const override;
54  const SIM_Object &object) const override;
56  const UT_Vector3 &worldpos,
57  const SIM_Property &property) const override;
59  int ptnum,
60  const SIM_Property &property) const override;
62  const SIM_Object &object,
63  UT_String &label) const override;
65  const SIM_Object &object,
66  const UT_String &colliderlabel,
67  UT_String &collidertype,
68  bool &colliderreverseobjectroles
69  ) const override;
70 
71  /// Gets the SIM_BlendFactor data for all the objects in an array.
72  void getBlendFactorsSubdata(
73  const SIM_ObjectArray &objects,
74  const char *blenddataname,
75  const char *solverparmsroot,
76  SIM_PerObjectBlendData *blenddata,
77  UT_StringArray *subsolvernames);
78 
79 private:
80  /// Gets the solver parm data for a single object.
81  void getBlendFactorsSubdata(
82  SIM_Object &object,
83  const char *blenddataname,
84  const char *solverparmsroot,
85  SIM_PerObjectBlendData &blenddata,
86  UT_StringArray *subsolvernames);
87 
88  void prepareObjectsForSolve(
89  const SIM_ObjectArray &objects,
90  SIM_PerObjectBlendData *blenddata,
91  int solverindex,
92  const char *blenddataname);
93  void cleanupObjectsAfterSolve(
94  const SIM_ObjectArray &objects,
95  SIM_PerObjectBlendData *blenddata,
96  int solverindex,
97  const char *blenddataname);
98  void blendAllSolvedData(
99  const SIM_ObjectArray &objects,
100  SIM_PerObjectBlendData *blenddata,
101  int numsolvers,
102  const char *blenddataname);
103  /// Gets the solver to use for getting object properties.
104  const SIM_Solver *getCurrentSolver() const;
105 
106  static const SIM_DopDescription *getSolverBlendDopDescription();
107 
108  SIM_Solver *myCurrentSolver;
109 
112  SIM_Solver,
113  "Blend Solver",
114  getSolverBlendDopDescription());
115 };
116 
117 #endif
#define DECLARE_STANDARD_GETCASTTOTYPE()
Definition: SIM_DataUtils.h:50
#define SIM_NAME_PRIMARYSOLVER
Definition: SIM_Names.h:170
GLuint GLsizei const GLchar * label
Definition: glcorearb.h:2545
#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:63
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:144
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.
fpreal64 fpreal
Definition: SYS_Types.h:277
#define SIM_API
Definition: SIM_API.h:12
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