Tiberian Technologies Scripts Reference Revision: 9000
Loading...
Searching...
No Matches
HTreeClass.h
1/* Renegade Scripts.dll
2 Copyright 2013 Tiberian Technologies
3
4 This file is part of the Renegade scripts.dll
5 The Renegade scripts.dll is free software; you can redistribute it and/or modify it under
6 the terms of the GNU General Public License as published by the Free
7 Software Foundation; either version 2, or (at your option) any later
8 version. See the file COPYING for more details.
9 In addition, an exemption is given to allow Run Time Dynamic Linking of this code with any closed source module that does not contain code covered by this licence.
10 Only the source code to the module(s) containing the licenced code has to be released.
11*/
12#ifndef TT_INCLUDE__HTREECLASS_H
13#define TT_INCLUDE__HTREECLASS_H
14#include "Matrix3D.h"
15class HAnimClass;
16class HAnimComboClass;
17class ChunkLoadClass;
18enum WW3DErrorType;
19struct PivotClass
20{
21 char Name[16]; //0
22 int Index; //16
23 PivotClass* Parent; //20
24 Matrix3D BaseTransform; //24
25 Matrix3D Transform; //72
26 bool IsVisible; //120
27 bool IsCaptured; //121
28 Matrix3D CapTransform; //124
29 bool WorldSpaceTranslation; //172
30
31 PivotClass() : Index(0), Parent(0), BaseTransform(true), Transform(true), IsVisible(true), IsCaptured(false), CapTransform(true), WorldSpaceTranslation(false)
32 {
33 }
34
35 void Capture_Update()
36 {
37 if (WorldSpaceTranslation)
38 {
39 Matrix3D CapOrientation = CapTransform;
40 CapOrientation[0].W = 0;
41 CapOrientation[1].W = 0;
42 CapOrientation[2].W = 0;
43 Matrix3D::Multiply(Transform,CapOrientation,&Transform);
44 Transform[0].W += CapTransform[0].W;
45 Transform[1].W += CapTransform[1].W;
46 Transform[2].W += CapTransform[2].W;
47 }
48 else
49 {
50 Matrix3D::Multiply(Transform,CapTransform,&Transform);
51 }
52 }
53};
54
55class HTreeClass
56{
57private:
58 char Name[16]; //0
59 int NumPivots; //16
60 PivotClass* Pivot; //20
61 float ScaleFactor; //24
62
63public:
64 static HTreeClass* Create_Interpolated(const HTreeClass* base, const HTreeClass* a, const HTreeClass* b, float weightA, float weightB);
65 HTreeClass(const HTreeClass& that);
66 HTreeClass();
67 ~HTreeClass();
68 WW3DErrorType Load_W3D(ChunkLoadClass& cload);
69 void Init_Default();
70 const char *Get_Name() const
71 {
72 return Name;
73 }
74 int Num_Pivots() const
75 {
76 return NumPivots;
77 }
78 int Get_Bone_Index(const char *) const;
79 const char *Get_Bone_Name(int) const;
80 int Get_Parent_Index(int boneidx) const;
81 void Base_Update(const Matrix3D& root);
82 void Anim_Update(Matrix3D const&, HAnimClass *, float);
83 void Blend_Update(Matrix3D const&, HAnimClass *, float, HAnimClass *, float, float);
84 void Combo_Update(Matrix3D const&, HAnimComboClass *);
85 const Matrix3D& Get_Transform(int pivot) const
86 {
87 return this->Pivot[pivot].Transform;
88 }
89 bool Get_Visibility(int pivot) const
90 {
91 return this->Pivot[pivot].IsVisible;
92 }
93 const Matrix3D& Get_Root_Transform() const
94 {
95 return this->Pivot[0].Transform;
96 }
97 void Capture_Bone(int boneindex);
98 void Release_Bone(int boneindex);
99 bool Is_Bone_Captured(int boneindex);
100 void Control_Bone(int boneindex, Matrix3D const &relative_tm, bool world_space_translation);
101 bool Simple_Evaluate_Pivot(HAnimClass *motion, int pivot_index, float frame,const Matrix3D &obj_tm, Matrix3D *end_tm) const;
102 bool Simple_Evaluate_Pivot(int pivot_index,const Matrix3D &obj_tm, Matrix3D *end_tm) const;
103 void Scale(float factor);
104 void Free();
105 void Get_Bone_Control(int, Matrix3D&) const;
106private:
107 HTreeClass& operator = (const HTreeClass& that); // unimplemented
108 WW3DErrorType read_pivots(ChunkLoadClass& cload, bool create_root);
109};
110
111#endif