mgcikjoint.h

来自「《3D游戏引擎设计》的源码」· C头文件 代码 · 共 67 行

H
67
字号
// Magic Software, Inc.
// http://www.magic-software.com
// Copyright (c) 2000, All Rights Reserved
//
// Source code from Magic Software is supplied under the terms of a license
// agreement and may not be copied or disclosed except in accordance with the
// terms of that agreement.  The various license agreements may be found at
// the Magic Software web site.  This file is subject to the license
//
// RESTRICTED USE SOURCE CODE
// http://www.magic-software.com/License/restricted.pdf

#ifndef MGCIKJOINT_H
#define MGCIKJOINT_H

#include "MgcObject.h"
#include "MgcVector3.h"
class MgcIKGoal;
class MgcSpatial;


class MgcIKJoint : public MgcObject
{
    MgcDeclareRTTI;
    MgcDeclareStream;

public:
    MgcIKJoint (MgcSpatial* pkObject = 0);

    bool& AllowTranslation (int i);
    MgcReal& TranslationMin (int i);
    MgcReal& TranslationMax (int i);
    MgcReal& TranslationSpringTension (int i);
    MgcReal& TranslationSpringOrigin (int i);
    MgcReal& TranslationSpringDamp (int i);

    bool& AllowRotation (int i);
    MgcReal& RotationMin (int i);
    MgcReal& RotationMax (int i);
    MgcReal& RotationSpringTension (int i);
    MgcReal& RotationSpringOrigin (int i);
    MgcReal& RotationSpringDamp (int i);

protected:
    // support for the IK update
    friend class MgcIKController;
    MgcVector3 GetAxis (int i);
    void UpdateTransforms ();
    void Update (unsigned int uiGoalQuantity, MgcIKGoal** apkGoal);
    void ApplyConstraints (MgcReal afTrnDelta[3], MgcReal afRotDelta[3]);

    // indices:  X = 0, Y = 1, Z = 2
    MgcSpatial* m_pkObject;
    bool m_abAllowTrn[3];
    MgcReal m_afMinTrn[3], m_afMaxTrn[3];
    MgcReal m_afTensionTrn[3], m_afOriginTrn[3], m_afDampTrn[3];
    bool m_abAllowRot[3];
    MgcReal m_afMinRot[3], m_afMaxRot[3];
    MgcReal m_afTensionRot[3], m_afOriginRot[3], m_afDampRot[3];
};

MgcSmartPointer(MgcIKJoint);
MgcRegisterStream(MgcIKJoint);
#include "MgcIKJoint.inl"

#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?