|
Katana Plug-in APIs 0.1
|
00001 #ifndef FnGeolibServicesExpressionMath_H 00002 #define FnGeolibServicesExpressionMath_H 00003 00004 #include <string> 00005 00006 #include <FnGeolibServices/FnGeolibServicesAPI.h> 00007 #include <FnGeolibServices/ns.h> 00008 #include <FnGeolibServices/suite/FnExpressionMathSuite.h> 00009 00010 #include <FnPluginSystem/FnPluginSystem.h> 00011 00012 FNGEOLIBSERVICES_NAMESPACE_ENTER 00013 { 00022 class FNGEOLIBSERVICES_API FnExpressionMath 00023 { 00024 public: 00035 static int clamp(int value, int a, int b); 00036 static float clamp(float value, float a, float b); 00037 static double clamp(double value, double a, double b); 00038 00047 static float lerp(float mix, float a, float b); 00048 static double lerp(double mix, double a, double b); 00049 00054 static float smoothstep(float t); 00055 static double smoothstep(double t); 00056 00067 static float fit(float value, float oldmin, float oldmax, 00068 float newmin, float newmax); 00069 static double fit(double value, double oldmin, double oldmax, 00070 double newmin, double newmax); 00071 00077 static float cfit(float value, float oldmin, float oldmax, 00078 float newmin, float newmax); 00079 static double cfit(double value, double oldmin, double oldmax, 00080 double newmin, double newmax); 00081 00087 static float softcfit(float value, float oldmin, float oldmax, 00088 float newmin, float newmax); 00089 static double softcfit(double value, double oldmin, double oldmax, 00090 double newmin, double newmax); 00091 00092 enum RetimeHoldMode 00093 { 00094 // Hold the first/last frame of the sequence. 1111 1234 4444 00095 RETIME_FREEZE = kFnKatExpressionMathRetimeFreeze, 00096 00097 // Repeat the sequence. 1234 1234 1234 00098 RETIME_REPEAT = kFnKatExpressionMathRetimeRepeat, 00099 00100 // Mirror the sequence; 3432 1234 3212 00101 RETIME_MIRROR = kFnKatExpressionMathRetimeMirror 00102 }; 00103 00104 static double retime(double frame, double start, double end, 00105 RetimeHoldMode inMode, RetimeHoldMode outMode); 00106 00110 static float randval(float min, float max, int seed); 00111 static double randval(double min, double max, int seed); 00112 00117 static float noise(float x); 00118 static float noise(float x, float y); 00119 static float noise(float x, float y, float z); 00120 static float noise(float x, float y, float z, float w); 00121 00127 static float snoise(float x); 00128 static float snoise(float x, float y); 00129 static float snoise(float x, float y, float z); 00130 static float snoise(float x, float y, float z, float w); 00131 00138 static int32_t stablehash(const std::string &cacheID); 00139 00140 private: 00141 FnExpressionMath(); 00142 00143 static const FnExpressionMathHostSuite_v1 *_getSuite(); 00144 }; 00146 } 00147 FNGEOLIBSERVICES_NAMESPACE_EXIT 00148 00149 00150 #endif // FnGeolibServicesExpressionMath_H
1.7.3