override protected VFXExpression[] BuildExpression(VFXExpression[] inputExpression) { VFXExpression from = inputExpression[0]; VFXExpression to = inputExpression[1]; VFXExpression up = inputExpression[2]; VFXExpression viewVector = to - from; VFXExpression z = VFXOperatorUtility.Normalize(viewVector); VFXExpression x = VFXOperatorUtility.Normalize(VFXOperatorUtility.Cross(up, z)); VFXExpression y = VFXOperatorUtility.Cross(z, x); VFXExpression matrix = new VFXExpressionVector3sToMatrix(x, y, z, from); return(new[] { matrix }); }
public void ProcessExpressionVector3sToMatrix() { var x = Vector3.right; var y = Vector3.up; var z = Vector3.forward; var w = Vector3.zero; var xValue = VFXValue.Constant(x); var yValue = VFXValue.Constant(y); var zValue = VFXValue.Constant(z); var wValue = VFXValue.Constant(w); var matrixValue = new VFXExpressionVector3sToMatrix(xValue, yValue, zValue, wValue); var context = new VFXExpression.Context(VFXExpressionContextOption.CPUEvaluation); var reduced = context.Compile(matrixValue); Assert.AreEqual(Matrix4x4.identity, reduced.Get <Matrix4x4>()); }