/* ** Command & Conquer Renegade(tm) ** Copyright 2025 Electronic Arts Inc. ** ** This program is free software: you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program. If not, see . */ /*********************************************************************************************** *** 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 *** *********************************************************************************************** * * * Project Name : WWMath * * * * $Archive:: /VSS_Sync/wwmath/tcbspline.cpp $* * * * Author:: Greg Hjelstrom * * * * $Modtime:: 6/13/01 2:18p $* * * * $Revision:: 6 $* * * *---------------------------------------------------------------------------------------------* * Functions: * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include "tcbspline.h" #include "wwdebug.h" #include "persistfactory.h" #include "wwmathids.h" #include "wwhack.h" /* ** Force-Link this module because the linker can't detect that we actually need it... */ DECLARE_FORCE_LINK(tcbspline); /* ** Save-Load stuff */ SimplePersistFactoryClass _TCBSpline3DFactory; enum { // ID's used by TCBSpline3D TCB3D_CHUNK_HERMITE3D = 0x02071009, TCB3D_CHUNK_PARAMS, }; /* ** TCBSpline3DClass Implemenation */ int TCBSpline3DClass::Add_Key(const Vector3 & point,float t) { int index; index = HermiteSpline3DClass::Add_Key(point,t); TCBClass params; params.Tension = 0.0f; params.Continuity = 0.0f; params.Bias = 0.0f; Params.Insert(index,params); return index; } void TCBSpline3DClass::Remove_Key(int i) { HermiteSpline3DClass::Remove_Key(i); Params.Delete(i); } void TCBSpline3DClass::Clear_Keys(void) { HermiteSpline3DClass::Clear_Keys(); Params.Clear(); } void TCBSpline3DClass::Set_TCB_Params(int i,float tension,float continuity,float bias) { WWASSERT(i >= 0); WWASSERT(i < Params.Count()); Params[i].Tension = tension; Params[i].Continuity = continuity; Params[i].Bias = bias; TangentsDirty = true; } void TCBSpline3DClass::Get_TCB_Params(int i,float *tension,float *continuity,float *bias) { if (tension) *tension = Params[i].Tension; if (continuity) *continuity = Params[i].Continuity; if (bias) *bias = Params[i].Bias; } void TCBSpline3DClass::Update_Tangents(void) { if (Keys.Count() < 2) { for (int i=0; i