Richard Boegli's CnC_Generals_Zero_Hour Fork WIP
This is documentation of Richard Boegil's Zero Hour Fork
 
Loading...
Searching...
No Matches
hermitespline.h
Go to the documentation of this file.
1/*
2** Command & Conquer Generals Zero Hour(tm)
3** Copyright 2025 Electronic Arts Inc.
4**
5** This program is free software: you can redistribute it and/or modify
6** it under the terms of the GNU General Public License as published by
7** the Free Software Foundation, either version 3 of the License, or
8** (at your option) any later version.
9**
10** This program is distributed in the hope that it will be useful,
11** but WITHOUT ANY WARRANTY; without even the implied warranty of
12** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13** GNU General Public License for more details.
14**
15** You should have received a copy of the GNU General Public License
16** along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/
18
19/***********************************************************************************************
20 *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
21 ***********************************************************************************************
22 * *
23 * Project Name : WWMath *
24 * *
25 * $Archive:: /VSS_Sync/wwmath/hermitespline.h $*
26 * *
27 * Author:: Greg Hjelstrom *
28 * *
29 * $Modtime:: 6/13/01 2:18p $*
30 * *
31 * $Revision:: 7 $*
32 * *
33 *---------------------------------------------------------------------------------------------*
34 * Functions: *
35 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
36
37
38#if defined(_MSC_VER)
39#pragma once
40#endif
41
42#ifndef HERMITE_H
43#define HERMITE_H
44
45#include "curve.h"
46
47/*
48** HermiteSpline3DClass
49** 3-Dimensional hermite spline interpolation
50** Hermite splines require you to input all of the tangents...
51*/
53{
54public:
57
59 : TangentsDirty (true) { (*this) = that; }
60
62
63 virtual void Evaluate(float time,Vector3 * set_val);
64 virtual void Evaluate_Derivative(float time,Vector3 * set_val);
65 virtual void Set_Looping(bool onoff);
66
67 virtual void Set_Key(int i,const Vector3 & point);
68 virtual int Add_Key(const Vector3 & point,float t);
69 virtual void Remove_Key(int i);
70 virtual void Clear_Keys(void);
71
72 virtual void Set_Tangents(int i,const Vector3 & in_tan,const Vector3 & out_tan);
73 virtual void Get_Tangents(int i,Vector3 * set_in,Vector3 * set_out);
74
75 virtual void Update_Tangents(void) { TangentsDirty = false; }
76
77 // save-load support
78 virtual const PersistFactoryClass & Get_Factory(void) const;
79 virtual bool Save(ChunkSaveClass &csave);
80 virtual bool Load(ChunkLoadClass &cload);
81
82protected:
83
85 {
86 public:
89 bool operator == (const TangentsClass & that) { return ((InTangent == that.InTangent) && (OutTangent == that.OutTangent)); }
90 bool operator != (const TangentsClass & that) { return !TangentsClass::operator == (that); }
91 };
92
95};
96
97
98/*
99** HermiteSpline1DClass
100** 1-Dimensional hermite spline interpolation
101** Hermite splines require you to input all of the tangents...
102*/
104{
105public:
108
109 virtual void Evaluate(float time,float * set_val);
110 virtual void Set_Looping(bool onoff);
111
112 virtual void Set_Key(int i,float point,unsigned int extra=0);
113 virtual int Add_Key(float point,float t,unsigned int extra=0);
114 virtual void Remove_Key(int i);
115 virtual void Clear_Keys(void);
116
117 virtual void Set_Tangents(int i,float in_tan,float out_tan);
118 virtual void Get_Tangents(int i,float * set_in,float * set_out);
119
120 // save-load support
121 virtual const PersistFactoryClass & Get_Factory(void) const;
122 virtual bool Save(ChunkSaveClass &csave);
123 virtual bool Load(ChunkLoadClass &cload);
124
125protected:
126
128 {
129 public:
132 bool operator == (const TangentsClass & that) { return ((InTangent == that.InTangent) && (OutTangent == that.OutTangent)); }
133 bool operator != (const TangentsClass & that) { return !TangentsClass::operator == (that); }
134 };
135
136 virtual void Update_Tangents(void) { TangentsDirty = false; }
137
140};
141
142
143#endif
@ true
Definition bool.h:59
Curve1DClass(void)
Definition curve.cpp:330
Curve3DClass(void)
Definition curve.cpp:87
bool operator!=(const TangentsClass &that)
bool operator==(const TangentsClass &that)
DynamicVectorClass< TangentsClass > Tangents
virtual void Set_Key(int i, float point, unsigned int extra=0)
virtual int Add_Key(float point, float t, unsigned int extra=0)
virtual void Clear_Keys(void)
virtual const PersistFactoryClass & Get_Factory(void) const
virtual void Set_Looping(bool onoff)
virtual void Evaluate(float time, float *set_val)
virtual void Set_Tangents(int i, float in_tan, float out_tan)
virtual void Get_Tangents(int i, float *set_in, float *set_out)
virtual bool Load(ChunkLoadClass &cload)
virtual void Update_Tangents(void)
virtual bool Save(ChunkSaveClass &csave)
virtual void Remove_Key(int i)
bool operator==(const TangentsClass &that)
bool operator!=(const TangentsClass &that)
virtual bool Save(ChunkSaveClass &csave)
virtual void Set_Tangents(int i, const Vector3 &in_tan, const Vector3 &out_tan)
virtual void Remove_Key(int i)
virtual const PersistFactoryClass & Get_Factory(void) const
virtual void Evaluate(float time, Vector3 *set_val)
const HermiteSpline3DClass & operator=(const HermiteSpline3DClass &that)
virtual void Set_Key(int i, const Vector3 &point)
HermiteSpline3DClass(const HermiteSpline3DClass &that)
virtual void Update_Tangents(void)
virtual void Clear_Keys(void)
virtual bool Load(ChunkLoadClass &cload)
virtual void Evaluate_Derivative(float time, Vector3 *set_val)
DynamicVectorClass< TangentsClass > Tangents
virtual void Get_Tangents(int i, Vector3 *set_in, Vector3 *set_out)
virtual int Add_Key(const Vector3 &point, float t)
virtual void Set_Looping(bool onoff)