HIK2016/humanik/hikcreature.h Source File

hikcreature.h
Go to the documentation of this file.
1 
7 /**************************************************************************************
8 
9 Copyright (C) 2014 Autodesk, Inc.
10 All Rights Reserved.
11 
12 The coded instructions, statements, computer programs, and/or related material (collectively "Data")
13 in these files contain unpublished information proprietary to Autodesk, Inc., ("Autodesk") which is
14 protected by Canada and United States of America federal copyright law and by international treaties.
15 
16 The Data may not be disclosed or distributed to third parties, in whole or in part, without the prior
17 written consent of Autodesk.
18 
19 THE DATA IS PROVIDED "AS IS" AND WITHOUT WARRANTY. ALL WARRANTIES ARE EXPRESSLY EXCLUDED AND DISCLAIMED.
20 AUTODESK MAKES NO WARRANTY OF ANY KIND WITH RESPECT TO THE DATA, EXPRESS, IMPLIED OR ARISING BY CUSTOM
21 OR TRADE USAGE, AND DISCLAIMS ANY IMPLIED WARRANTIES OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR
22 FITNESS FOR A PARTICULAR PURPOSE OR USE. WITHOUT LIMITING THE FOREGOING, AUTODESK DOES NOT WARRANT THAT
23 THE OPERATION OF THE DATA WILL BE UNINTERRUPTED OR ERROR FREE.
24 
25 IN NO EVENT SHALL AUTODESK, ITS AFFILIATES, PARENT COMPANIES, LICENSORS OR SUPPLIERS ("AUTODESK GROUP")
26 BE LIABLE FOR ANY LOSSES, DAMAGES OR EXPENSES OF ANY KIND (INCLUDING WITHOUT LIMITATION PUNITIVE OR
27 MULTIPLE DAMAGES OR OTHER SPECIAL, DIRECT, INDIRECT, EXEMPLARY, INCIDENTAL, LOSS OF PROFITS, REVENUE
28 OR DATA, COST OF COVER OR CONSEQUENTIAL LOSSES OR DAMAGES OF ANY KIND), HOWEVER CAUSED, AND REGARDLESS
29 OF THE THEORY OF LIABILITY, WHETHER DERIVED FROM CONTRACT, TORT (INCLUDING, BUT NOT LIMITED TO,
30 NEGLIGENCE), OR OTHERWISE, ARISING OUT OF OR RELATING TO THE DATA OR ITS USE OR ANY OTHER PERFORMANCE,
31 WHETHER OR NOT AUTODESK HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSS OR DAMAGE.
32 
33 **************************************************************************************/
34 
35 #ifndef _HIKCREATURE_
36 #define _HIKCREATURE_
37 
38 #include "humanik.h"
39 #include "hikproperty.h"
40 
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44 
62 struct HIKCreature;
63 
78 
95 
96 // ***********************************************
104 {
105  int mNbNodes;
106  int mSection; // Owner of the chain (-1 if free chain)
107  int mNbParentOffsets; // Can only be non-zero when working in local coordinates
108  int mNbLimits; // Number of nodes using limits
110 
112 {
113  int mParentChain; // -1 if not relevant (root section)
114  int mHasParentOffset; // Can only be non-zero when working in local coordinates
115  int mHasLimits; // Does the root node implement limits?
117 
119 {
127 
129 {
142 };
143 
145 {
148 };
149 
151 {
164 };
165 
174 HIK_EXPORT HIKCreature * HIK_API HIKCreatureCreate( const HIKCreatureDefinition *pCreatureDefinition, HIKMalloc pMalloc, const char *pValidationString);
175 
186 
198 HIK_EXPORT bool HIK_API HIKCreatureSetCharacterizeNodeStateTQSfv(HIKCreature * pCreature, int pElementId, int pNodeId, const float pT[4], const float pQ[4], const float pS[4]);
199 
209 HIK_EXPORT bool HIK_API HIKCreatureSetHasParentOffset(HIKCreature *pCreature, int pChainId, int pNodeId);
210 
220 HIK_EXPORT bool HIK_API HIKCreatureSetHasLimits(HIKCreature *pCreature, int pChainId, int pNodeId);
221 
237 HIK_EXPORT bool HIK_API HIKCreatureSetParentOffsetfv(HIKCreature *pCreature, int pElementId, int pNodeId, const float pT[4], const float pQ[4], const float pS[4]);
238 
250 HIK_EXPORT bool HIK_API HIKCreatureGetParentOffsetfv(const HIKCreature *pCreature, int pElementId, int pNodeId, float pT[4], float pQ[4], float pS[4]);
251 
273 HIK_EXPORT bool HIK_API HIKCreatureSetLimitsfv(HIKCreature *pCreature, int pElementId, int pNodeId,
274  const float pMin[3], const float pMax[3],
275  const float pPreQ[4], const float pPostQ[4],
276  int pActiveMask,
277  eHIKRotationOrder pRotationOrder);
278 
289 
301 
309 HIK_EXPORT void HIK_API HIKCreatureGetDefaultState(const HIKCreature *pCreature, HIKCreatureState *pCreatureState);
310 
322 HIK_EXPORT void HIK_API HIKCreatureSetNodeStateTQSfv(const HIKCreature *pCreature, HIKCreatureState *pCreatureState, int pElementId, int pNodeId, const float pT[4], const float pQ[4], const float pS[4]);
323 
335 HIK_EXPORT void HIK_API HIKCreatureGetNodeStateTQSfv(const HIKCreature *pCreature, const HIKCreatureState *pCreatureState, int pElementId, int pNodeId, float pT[4], float pQ[4], float pS[4]);
336 
347 HIK_EXPORT bool HIK_API HIKCreatureSetStateTransformTQS(const HIKCreature *pCreature, HIKCreatureState *pCreatureState, const HIKDataDescription* pDataDescription, const void* pDataSet);
348 
359 HIK_EXPORT bool HIK_API HIKCreatureGetStateTransformTQS(const HIKCreature *pCreature, HIKCreatureState *pCreatureState, const HIKDataDescription* pDataDescription, void* pDataSet);
360 
367 HIK_EXPORT void HIK_API HIKEffectorSetFromCreature(const HIKCreature *pCreature, HIKCreatureEffectorSetState *pEffectorSetState, const HIKCreatureState *pCreatureState);
368 
377 HIK_EXPORT void HIK_API HIKCreatureGetEffectorStateTQSfv(const HIKCreatureEffectorSetState *pEffectorSetState, int pEffectorIndex, float pT[4], float pQ[4], float pS[4]);
378 
388 HIK_EXPORT void HIK_API HIKCreatureSetEffectorStateTQSfv(HIKCreatureEffectorSetState *pEffectorSetState, int pEffectorIndex, const float pT[4], const float pQ[4], const float pS[4]);
389 
396 HIK_EXPORT void HIK_API HIKCreatureSetTranslationActive(HIKCreatureEffectorSetState *pEffectorSetState, int pEffectorIndex, float pValue);
397 
404 HIK_EXPORT void HIK_API HIKCreatureSetRotationActive(HIKCreatureEffectorSetState *pEffectorSetState, int pEffectorIndex, float pValue);
405 
412 HIK_EXPORT void HIK_API HIKCreatureSetPull(HIKCreatureEffectorSetState *pEffectorSetState, int pEffectorIndex, float pValue);
413 
429 
436 HIK_EXPORT void HIK_API HIKCreatureSetChainStiffness(HIKCreature *pCreature, int pChainId, float pValue);
437 
445 
452 HIK_EXPORT void HIK_API HIKCreatureSetSectionExtraPull(HIKCreature *pCreature, int pSectionId, float pValue);
453 
460 
467 
475 
483 HIK_EXPORT void HIK_API HIKCreatureSetChainProperty(HIKCreature *pCreature, int pChainId, int pPropertyIndex, float pValue);
484 
491 
492 /* *********************************************** */
508 
515 
522 
523 // Stats (please do not rely on these functions)
524 
525 HIK_EXPORT float HIK_API HIKCreatureGetChainLastPull(HIKCreature *pCreature, int pChainId);
526 HIK_EXPORT float HIK_API HIKCreatureGetChainLastPullLength(HIKCreature *pCreature, int pChainId);
528 HIK_EXPORT void HIK_API HIKCreatureGetChainLastChainPullDir(HIKCreature *pCreature, int pChainId, int pIter, float pT[4]);
529 HIK_EXPORT float HIK_API HIKCreatureGetChainLastChainErrT(HIKCreature *pCreature, int pChainId, int pIter);
530 HIK_EXPORT void HIK_API HIKCreatureGetChainLastChainErrQ(HIKCreature *pCreature, int pChainId, int pIter, float pQ[4]);
531 HIK_EXPORT void HIK_API HIKCreatureGetSectionLastSumErr(HIKCreature *pCreature, int pSectionId, int pIter, float pT[4]);
532 HIK_EXPORT float HIK_API HIKCreatureGetSectionLastSectionErrWeightT(HIKCreature *pCreature, int pSectionId, int pIter);
533 HIK_EXPORT float HIK_API HIKCreatureGetSectionLastSectionWeights(HIKCreature *pCreature, int pSectionId, int pIter);
534 HIK_EXPORT void HIK_API HIKCreatureGetSectionLastSectionErrQPull(HIKCreature *pCreature, int pSectionId, int pIter, float pQ[4]);
535 HIK_EXPORT void HIK_API HIKCreatureGetSectionLastSectionErrQReach(HIKCreature *pCreature, int pSectionId, int pIter, float pQ[4]);
536 
537 #ifdef __cplusplus
538 }
539 #endif
540 
541 #endif
bool HIKCreatureSetStateTransformTQS(const HIKCreature *pCreature, HIKCreatureState *pCreatureState, const HIKDataDescription *pDataDescription, const void *pDataSet)
Set the translation (T), quaternion rotation (Q) and scaling (S) of multiple Nodes from data set pDat...
The solving involves all nodes in the chain, freely rotating - approximation only.
Definition: hikcreature.h:137
void HIKCreatureGetChainLastChainErrQ(HIKCreature *pCreature, int pChainId, int pIter, float pQ[4])
bool HIKCreatureSetCharacterizeNodeStateTQSfv(HIKCreature *pCreature, int pElementId, int pNodeId, const float pT[4], const float pQ[4], const float pS[4])
Set the translation, orientation and scaling for the Node pNodeId when the character is standing in t...
bool HIKCreatureCharacterizeGeometry(HIKCreature *pCreature)
Set up and initialize creature pCreature for solving.
The solving involves all nodes in the chain, freely rotating, constrained with orienation reach...
Definition: hikcreature.h:139
int mNbChains
The number of IK chains for this creature.
Definition: hikcreature.h:122
Defines how DOFs are applied along the chain.
Definition: hikcreature.h:161
struct sHIKCreatureSectionDefinition HIKCreatureSectionDefinition
void HIKCreatureEnableTorque(HIKCreatureEffectorSetState *pEffectorSetState, bool pValue)
Enable or disable torque solving on the creature (* Only relevant when doing FBIK) ...
void(* HIKFree)(void *)
Memory de-allocator function.
Definition: humanik.h:393
void HIKCreatureSetEffectorStateTQSfv(HIKCreatureEffectorSetState *pEffectorSetState, int pEffectorIndex, const float pT[4], const float pQ[4], const float pS[4])
Set the translation (T), quaternion rotation (Q) and scaling (S) in global space of Effector pEffecto...
bool HIKCreatureSetLimitsfv(HIKCreature *pCreature, int pElementId, int pNodeId, const float pMin[3], const float pMax[3], const float pPreQ[4], const float pPostQ[4], int pActiveMask, eHIKRotationOrder pRotationOrder)
Set up limits for Node pNodeId.
float HIKCreatureGetChainLastChainWeightsT(HIKCreature *pCreature, int pChainId)
void HIKCreatureGetEffectorStateTQSfv(const HIKCreatureEffectorSetState *pEffectorSetState, int pEffectorIndex, float pT[4], float pQ[4], float pS[4])
Retrieve the translation (T), quaternion rotation (Q) and scaling (S) in global space of Effector pEf...
float HIKCreatureGetChainLastPullLength(HIKCreature *pCreature, int pChainId)
bool HIKCreatureGetParentOffsetfv(const HIKCreature *pCreature, int pElementId, int pNodeId, float pT[4], float pQ[4], float pS[4])
Retrieve the parent offset set for Node pNodeId.
void HIKCreatureSetPull(HIKCreatureEffectorSetState *pEffectorSetState, int pEffectorIndex, float pValue)
Set the Pull constraint for Effector pEffectorIndex.
The solving involves all nodes in the chain, potentially DOF constrained, re-ordered, all folding on the same plane.
Definition: hikcreature.h:141
HIKCreatureState * HIKCreatureStateCreate(const HIKCreature *pCreature, HIKMalloc pMalloc)
Create a new HIKCreatureState.
The solving only involves the chain root + all intermediary nodes, all folding on the same plane...
Definition: hikcreature.h:135
void HIKCreatureEffectorSetStateDestroy(HIKCreatureEffectorSetState *pEffectorSetState, HIKFree pFree)
Destroy HIKCreatureEffectorSetState pEffectorSetState.
void HIKCreatureSetChainCompressionResistance(HIKCreature *pCreature, int pChainId, float pValue)
Sets how resistant a chain should behave when being compressed (* Only relevant when doing FBIK) ...
A description of a data set that contains separate translation, quaternion rotation, and scaling values for multiple different Nodes in an HIKCharacterState.
float HIKCreatureGetSectionLastSectionErrWeightT(HIKCreature *pCreature, int pSectionId, int pIter)
HIKChainSolvingType
Definition: hikcreature.h:128
Number of iterations for the CCD algorithm; default is 32.
Definition: hikcreature.h:153
#define HIK_EXPORT
Definition: humanik.h:56
HIKCreatureEffectorSetState * HIKCreatureEffectorSetStateCreate(const HIKCreature *pCreature, HIKMalloc pMalloc)
Create a new HIKCreatureEffectorSetState.
Defines an HIKCreatureEffectorSetState.
Definition: hikcreature.h:77
Defines a pose for a creature.
Definition: hikcreature.h:62
struct sHIKCreatureChainDefinition HIKCreatureChainDefinition
int HIKCreatureGetChainParentSectionIndex(HIKCreature *pCreature, int pChainId)
Get parent section index for a chain.
struct sHIKCreatureDefinition HIKCreatureDefinition
bool HIKCreatureGetStateTransformTQS(const HIKCreature *pCreature, HIKCreatureState *pCreatureState, const HIKDataDescription *pDataDescription, void *pDataSet)
Retrieve the translation (T), quaternion rotation (Q) and scaling (S) of multiple Nodes from HIKCreat...
float HIKCreatureGetChainLastPull(HIKCreature *pCreature, int pChainId)
void HIKCreatureSetNodeStateTQSfv(const HIKCreature *pCreature, HIKCreatureState *pCreatureState, int pElementId, int pNodeId, const float pT[4], const float pQ[4], const float pS[4])
Set the translation (T), quaternion rotation (Q) and scaling (S) in global space of Node pNodeId from...
void HIKCreatureSetRotationActive(HIKCreatureEffectorSetState *pEffectorSetState, int pEffectorIndex, float pValue)
Set the Reach Rotation constraint for Effector pEffectorIndex.
Fastest solving mode.
Definition: hikcreature.h:133
void HIKCreatureSetTranslationActive(HIKCreatureEffectorSetState *pEffectorSetState, int pEffectorIndex, float pValue)
Set the Reach Translation constraint for Effector pEffectorIndex.
enum HIKRotationOrder eHIKRotationOrder
see enum HIKRotationOrder
Definition: humanik.h:682
float HIKCreatureGetSectionLastSectionWeights(HIKCreature *pCreature, int pSectionId, int pIter)
Fastest solving mode.
Definition: hikcreature.h:131
void HIKCreatureGetChainLastChainPullDir(HIKCreature *pCreature, int pChainId, int pIter, float pT[4])
void HIKCreatureStateDestroy(HIKCreatureState *pCreatureState, HIKFree pFree)
Destroy HIKCreatureState pCreatureState.
void HIKCreatureGetDefaultState(const HIKCreature *pCreature, HIKCreatureState *pCreatureState)
Retrieve the default natural stance for creature pCreature, storing it in HIKCreatureState pCreatureS...
void HIKCreatureSetChainStiffness(HIKCreature *pCreature, int pChainId, float pValue)
Sets how stiff a chain should behave (* Only relevant when doing FBIK)
bool HIKCreatureSetHasParentOffset(HIKCreature *pCreature, int pChainId, int pNodeId)
Only relevant when working in local coordinates.
bool HIKCreatureSetParentOffsetfv(HIKCreature *pCreature, int pElementId, int pNodeId, const float pT[4], const float pQ[4], const float pS[4])
Only relevant when working in local coordinates.
void HIKCreatureSetSectionExtraPull(HIKCreature *pCreature, int pSectionId, float pValue)
Sets how a section should emphasizes its pull (* Only relevant when doing FBIK)
HIKParamTwoBonesIK
Definition: hikcreature.h:144
void HIKCreatureSetChainProperty(HIKCreature *pCreature, int pChainId, int pPropertyIndex, float pValue)
Set property for a specific chain in the creature.
float HIKCreatureGetChainLastChainErrT(HIKCreature *pCreature, int pChainId, int pIter)
void HIKCreatureGetSectionLastSectionErrQReach(HIKCreature *pCreature, int pSectionId, int pIter, float pQ[4])
void HIKCreatureDestroy(HIKCreature *pCreature, HIKFree pFree)
Destroy HIKCreature pCreature.
void HIKEffectorSetFromCreature(const HIKCreature *pCreature, HIKCreatureEffectorSetState *pEffectorSetState, const HIKCreatureState *pCreatureState)
Set up HIKCreatureEffectorSetState pEffectorSetState to match creature pCreature in HIKCreatureState ...
void HIKCreatureGetSectionLastSectionErrQPull(HIKCreature *pCreature, int pSectionId, int pIter, float pQ[4])
void HIKCreatureGetSectionLastSumErr(HIKCreature *pCreature, int pSectionId, int pIter, float pT[4])
Defines how many joints in chain (from the end) should contribute to end orientation reach; default i...
Definition: hikcreature.h:163
HIKParamTentacleCCD
Definition: hikcreature.h:150
HIKCreatureSectionDefinition * mSections
Definition: hikcreature.h:125
void HIKCreatureSolveForEffectorSet(HIKCreature *pCreature, HIKCreatureState *pCreatureState, HIKCreatureEffectorSetState *pEffectorSetState)
Solve creature pCreature with HIKCreatureEffectorSetState pEffectorSetState and initial HIKCreatureSt...
Index of the joint to fold in the chain (top = 0); default is 1.
Definition: hikcreature.h:147
void *(* HIKMalloc)(size_t)
Memory allocator function.
Definition: humanik.h:388
bool HIKCreatureSetHasLimits(HIKCreature *pCreature, int pChainId, int pNodeId)
Declares a chain node implements limits.
Maximal joint rotation in radians; default is 0.157f.
Definition: hikcreature.h:155
void HIKCreatureEnableFBIK(HIKCreatureEffectorSetState *pEffectorSetState, bool pValue)
Enable or disable FullBodyIK solving on the creature.
const char void * pValue
Definition: fbcontrols.h:2116
void HIKCreatureSetChainSolvingType(HIKCreature *pCreature, int pChainId, HIKChainSolvingType pValue)
Set solving type for a specific chain in the creature.
HIKCreature * HIKCreatureCreate(const HIKCreatureDefinition *pCreatureDefinition, HIKMalloc pMalloc, const char *pValidationString)
Create a new HIKCreature.
HIKCreatureChainDefinition * mChains
Definition: hikcreature.h:124
void HIKCreatureGetNodeStateTQSfv(const HIKCreature *pCreature, const HIKCreatureState *pCreatureState, int pElementId, int pNodeId, float pT[4], float pQ[4], float pS[4])
Retrieve the translation (T), quaternion rotation (Q) and scaling (S) in global space of Node pNodeId...
#define HIK_API
Definition: humanik.h:60
Defines a Creature to be used with HumanIK.