afxPath3D.h

Engine/source/afx/util/afxPath3D.h

More...

Classes:

Public Typedefs

afxPath3DLoopType 

Detailed Description

Public Typedefs

typedef afxPath3D::LoopType afxPath3DLoopType 

Public Functions

DefineEnumType(afxPath3DLoopType )

  1
  2
  3//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
  4// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames
  5// Copyright (C) 2015 Faust Logic, Inc.
  6//
  7// Permission is hereby granted, free of charge, to any person obtaining a copy
  8// of this software and associated documentation files (the "Software"), to
  9// deal in the Software without restriction, including without limitation the
 10// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 11// sell copies of the Software, and to permit persons to whom the Software is
 12// furnished to do so, subject to the following conditions:
 13//
 14// The above copyright notice and this permission notice shall be included in
 15// all copies or substantial portions of the Software.
 16//
 17// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 18// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 19// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 20// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 21// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 23// IN THE SOFTWARE.
 24//
 25//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
 26
 27#ifndef _AFX_PATH3D_UTIL_H_
 28#define _AFX_PATH3D_UTIL_H_
 29
 30#include "afx/util/afxCurve3D.h"
 31#include "afx/util/afxAnimCurve.h"
 32
 33#include "math/mMatrix.h"
 34
 35//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
 36
 37class afxPath3D : public EngineObject
 38{
 39private:
 40    // Path-related data
 41  afxCurve3D   mCurve;
 42  afxAnimCurve mCurve_parameters;
 43  int       mNum_points;
 44  
 45  // Time data
 46  F32       mStart_time;
 47  F32       mEnd_time;
 48  
 49public:
 50  /*C*/     afxPath3D( );
 51  /*D*/     ~afxPath3D();
 52  
 53  void      sortAll();
 54  
 55  void      setStartTime(F32 time);
 56  
 57  F32       getEndTime();
 58  int       getNumPoints();
 59  Point3F   getPointPosition(int index);
 60  F32       getPointTime(int index);
 61  F32       getPointParameter(int index);
 62  Point2F   getParameterSegment(F32 time);
 63  
 64  void      setPointPosition(int index, Point3F &p);
 65  
 66  Point3F   evaluateAtTime(F32 time);
 67  Point3F   evaluateAtTime(F32 t0, F32 t1);  // returns delta
 68  Point3F   evaluateTangentAtTime(F32 time);
 69  Point3F   evaluateTangentAtPoint(int index);
 70  
 71  void      buildPath(int num_points, Point3F curve_points[], F32 start_time, F32 end_time);
 72  void      buildPath(int num_points, Point3F curve_points[], F32 speed);
 73  void      buildPath(int num_points, Point3F curve_points[], F32 point_times[], F32 time_offset, F32 time_factor);
 74  void      buildPath(int num_points, Point3F curve_points[], Point2F curve_params[]);
 75  
 76  void      reBuildPath();
 77  
 78  void      print();
 79   
 80  enum LoopType
 81  {      
 82    LOOP_CONSTANT,
 83    LOOP_CYCLE,
 84    LOOP_OSCILLATE
 85  };
 86  
 87  U32       mLoop_type;
 88  void      setLoopType(U32);
 89  
 90private:
 91  void      initPathParameters(Point3F curve_points[], F32 speed);
 92  void      initPathParametersNEW(Point3F curve_points[], F32 start_time, F32 end_time);
 93    
 94  F32       calcCurveTime(F32 time);
 95};
 96
 97typedef afxPath3D::LoopType afxPath3DLoopType;
 98DefineEnumType( afxPath3DLoopType );
 99
100//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
101
102#endif // _AFX_PATH3D_UTIL_H_
103