Просмотр исходного кода

TSL: add `hyperbolic` math nodes (#33233)

thelazylama 3 недель назад
Родитель
Сommit
1816e9464d
2 измененных файлов с 78 добавлено и 0 удалено
  1. 6 0
      src/Three.TSL.js
  2. 72 0
      src/nodes/math/MathNode.js

+ 6 - 0
src/Three.TSL.js

@@ -40,6 +40,7 @@ export const VarIntent = TSL.VarIntent;
 export const abs = TSL.abs;
 export const acesFilmicToneMapping = TSL.acesFilmicToneMapping;
 export const acos = TSL.acos;
+export const acosh = TSL.acosh;
 export const add = TSL.add;
 export const addMethodChaining = TSL.addMethodChaining;
 export const addNodeElement = TSL.addNodeElement;
@@ -55,8 +56,10 @@ export const append = TSL.append;
 export const array = TSL.array;
 export const arrayBuffer = TSL.arrayBuffer;
 export const asin = TSL.asin;
+export const asinh = TSL.asinh;
 export const assign = TSL.assign;
 export const atan = TSL.atan;
+export const atanh = TSL.atanh;
 export const atomicAdd = TSL.atomicAdd;
 export const atomicAnd = TSL.atomicAnd;
 export const atomicFunc = TSL.atomicFunc;
@@ -140,6 +143,7 @@ export const countLeadingZeros = TSL.countLeadingZeros;
 export const countOneBits = TSL.countOneBits;
 export const countTrailingZeros = TSL.countTrailingZeros;
 export const cos = TSL.cos;
+export const cosh = TSL.cosh;
 export const cross = TSL.cross;
 export const cubeTexture = TSL.cubeTexture;
 export const cubeTextureBase = TSL.cubeTextureBase;
@@ -498,6 +502,7 @@ export const shiftRight = TSL.shiftRight;
 export const shininess = TSL.shininess;
 export const sign = TSL.sign;
 export const sin = TSL.sin;
+export const sinh = TSL.sinh;
 export const sinc = TSL.sinc;
 export const skinning = TSL.skinning;
 export const smoothstep = TSL.smoothstep;
@@ -542,6 +547,7 @@ export const subgroupShuffleXor = TSL.subgroupShuffleXor;
 export const subgroupSize = TSL.subgroupSize;
 export const subgroupXor = TSL.subgroupXor;
 export const tan = TSL.tan;
+export const tanh = TSL.tanh;
 export const tangentGeometry = TSL.tangentGeometry;
 export const tangentLocal = TSL.tangentLocal;
 export const tangentView = TSL.tangentView;

+ 72 - 0
src/nodes/math/MathNode.js

@@ -345,11 +345,17 @@ MathNode.CEIL = 'ceil';
 MathNode.NORMALIZE = 'normalize';
 MathNode.FRACT = 'fract';
 MathNode.SIN = 'sin';
+MathNode.SINH = 'sinh';
 MathNode.COS = 'cos';
+MathNode.COSH = 'cosh';
 MathNode.TAN = 'tan';
+MathNode.TANH = 'tanh';
 MathNode.ASIN = 'asin';
+MathNode.ASINH = 'asinh';
 MathNode.ACOS = 'acos';
+MathNode.ACOSH = 'acosh';
 MathNode.ATAN = 'atan';
+MathNode.ATANH = 'atanh';
 MathNode.ABS = 'abs';
 MathNode.SIGN = 'sign';
 MathNode.LENGTH = 'length';
@@ -590,6 +596,16 @@ export const fract = /*@__PURE__*/ nodeProxyIntent( MathNode, MathNode.FRACT ).s
  */
 export const sin = /*@__PURE__*/ nodeProxyIntent( MathNode, MathNode.SIN ).setParameterLength( 1 );
 
+/**
+ * Returns the hyperbolic sine of the parameter.
+ *
+ * @tsl
+ * @function
+ * @param {Node | number} x - The parameter.
+ * @returns {Node}
+ */
+export const sinh = /*@__PURE__*/ nodeProxyIntent( MathNode, MathNode.SINH ).setParameterLength( 1 );
+
 /**
  * Returns the cosine of the parameter.
  *
@@ -600,6 +616,16 @@ export const sin = /*@__PURE__*/ nodeProxyIntent( MathNode, MathNode.SIN ).setPa
  */
 export const cos = /*@__PURE__*/ nodeProxyIntent( MathNode, MathNode.COS ).setParameterLength( 1 );
 
+/**
+ * Returns the hyperbolic cosine of the parameter.
+ *
+ * @tsl
+ * @function
+ * @param {Node | number} x - The parameter.
+ * @returns {Node}
+ */
+export const cosh = /*@__PURE__*/ nodeProxyIntent( MathNode, MathNode.COSH ).setParameterLength( 1 );
+
 /**
  * Returns the tangent of the parameter.
  *
@@ -610,6 +636,16 @@ export const cos = /*@__PURE__*/ nodeProxyIntent( MathNode, MathNode.COS ).setPa
  */
 export const tan = /*@__PURE__*/ nodeProxyIntent( MathNode, MathNode.TAN ).setParameterLength( 1 );
 
+/**
+ * Returns the hyperbolic tangent of the parameter.
+ *
+ * @tsl
+ * @function
+ * @param {Node | number} x - The parameter.
+ * @returns {Node}
+ */
+export const tanh = /*@__PURE__*/ nodeProxyIntent( MathNode, MathNode.TANH ).setParameterLength( 1 );
+
 /**
  * Returns the arcsine of the parameter.
  *
@@ -620,6 +656,16 @@ export const tan = /*@__PURE__*/ nodeProxyIntent( MathNode, MathNode.TAN ).setPa
  */
 export const asin = /*@__PURE__*/ nodeProxyIntent( MathNode, MathNode.ASIN ).setParameterLength( 1 );
 
+/**
+ * Returns the inverse hyperbolic sine of the parameter.
+ *
+ * @tsl
+ * @function
+ * @param {Node | number} x - The parameter.
+ * @returns {Node}
+ */
+export const asinh = /*@__PURE__*/ nodeProxyIntent( MathNode, MathNode.ASINH ).setParameterLength( 1 );
+
 /**
  * Returns the arccosine of the parameter.
  *
@@ -630,6 +676,16 @@ export const asin = /*@__PURE__*/ nodeProxyIntent( MathNode, MathNode.ASIN ).set
  */
 export const acos = /*@__PURE__*/ nodeProxyIntent( MathNode, MathNode.ACOS ).setParameterLength( 1 );
 
+/**
+ * Returns the inverse hyperbolic cosine of the parameter.
+ *
+ * @tsl
+ * @function
+ * @param {Node | number} x - The parameter.
+ * @returns {Node}
+ */
+export const acosh = /*@__PURE__*/ nodeProxyIntent( MathNode, MathNode.ACOSH ).setParameterLength( 1 );
+
 /**
  * Returns the arc-tangent of the parameter.
  * If two parameters are provided, the result is `atan2(y/x)`.
@@ -642,6 +698,16 @@ export const acos = /*@__PURE__*/ nodeProxyIntent( MathNode, MathNode.ACOS ).set
  */
 export const atan = /*@__PURE__*/ nodeProxyIntent( MathNode, MathNode.ATAN ).setParameterLength( 1, 2 );
 
+/**
+ * Returns the inverse hyperbolic tangent of the parameter.
+ *
+ * @tsl
+ * @function
+ * @param {Node | number} x - The parameter.
+ * @returns {Node}
+ */
+export const atanh = /*@__PURE__*/ nodeProxyIntent( MathNode, MathNode.ATANH ).setParameterLength( 1 );
+
 /**
  * Returns the absolute value of the parameter.
  *
@@ -1087,11 +1153,17 @@ addMethodChaining( 'ceil', ceil );
 addMethodChaining( 'normalize', normalize );
 addMethodChaining( 'fract', fract );
 addMethodChaining( 'sin', sin );
+addMethodChaining( 'sinh', sinh );
 addMethodChaining( 'cos', cos );
+addMethodChaining( 'cosh', cosh );
 addMethodChaining( 'tan', tan );
+addMethodChaining( 'tanh', tanh );
 addMethodChaining( 'asin', asin );
+addMethodChaining( 'asinh', asinh );
 addMethodChaining( 'acos', acos );
+addMethodChaining( 'acosh', acosh );
 addMethodChaining( 'atan', atan );
+addMethodChaining( 'atanh', atanh );
 addMethodChaining( 'abs', abs );
 addMethodChaining( 'sign', sign );
 addMethodChaining( 'length', length );

粤ICP备19079148号