123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360 |
- using System;
- using System.Linq;
- using System.Runtime.CompilerServices;
- using UnityEngine;
- using UnityEngine.VFX;
- namespace UnityEditor.VFX
- {
- class VFXExpressionValueNoise1D : VFXExpression
- {
- public VFXExpressionValueNoise1D() : this(VFXValue<float>.Default, VFXValue<Vector3>.Default, VFXValue<int>.Default) { }
- public VFXExpressionValueNoise1D(params VFXExpression[] parents) : base(VFXExpression.Flags.None, parents) { }
- public override VFXExpressionOperation operation { get { return VFXExpressionOperation.ValueNoise1D; } }
- sealed protected override VFXExpression Evaluate(VFXExpression[] constParents)
- {
- var coordinate = constParents[0].Get<float>();
- var floatParams = constParents[1].Get<Vector3>();
- var octaveCount = constParents[2].Get<int>();
- return VFXValue.Constant(VFXExpressionNoise.GenerateValueNoise1D(coordinate, floatParams.x, octaveCount, floatParams.y, floatParams.z));
- }
- public override string GetCodeString(string[] parents)
- {
- return string.Format("GenerateValueNoise({0}, {1}.x, {2}, {1}.y, {1}.z)", parents[0], parents[1], parents[2]);
- }
- }
- class VFXExpressionValueNoise2D : VFXExpression
- {
- public VFXExpressionValueNoise2D() : this(VFXValue<Vector2>.Default, VFXValue<Vector3>.Default, VFXValue<int>.Default) { }
- public VFXExpressionValueNoise2D(params VFXExpression[] parents) : base(VFXExpression.Flags.None, parents) { }
- public override VFXExpressionOperation operation { get { return VFXExpressionOperation.ValueNoise2D; } }
- sealed protected override VFXExpression Evaluate(VFXExpression[] constParents)
- {
- var coordinate = constParents[0].Get<Vector2>();
- var floatParams = constParents[1].Get<Vector3>();
- var octaveCount = constParents[2].Get<int>();
- return VFXValue.Constant(VFXExpressionNoise.GenerateValueNoise2D(coordinate, floatParams.x, octaveCount, floatParams.y, floatParams.z));
- }
- public override string GetCodeString(string[] parents)
- {
- return string.Format("GenerateValueNoise({0}, {1}.x, {2}, {1}.y, {1}.z)", parents[0], parents[1], parents[2]);
- }
- }
- class VFXExpressionValueNoise3D : VFXExpression
- {
- public VFXExpressionValueNoise3D() : this(VFXValue<Vector3>.Default, VFXValue<Vector3>.Default, VFXValue<int>.Default) { }
- public VFXExpressionValueNoise3D(params VFXExpression[] parents) : base(VFXExpression.Flags.None, parents) { }
- public override VFXExpressionOperation operation { get { return VFXExpressionOperation.ValueNoise3D; } }
- sealed protected override VFXExpression Evaluate(VFXExpression[] constParents)
- {
- var coordinate = constParents[0].Get<Vector3>();
- var floatParams = constParents[1].Get<Vector3>();
- var octaveCount = constParents[2].Get<int>();
- return VFXValue.Constant(VFXExpressionNoise.GenerateValueNoise3D(coordinate, floatParams.x, octaveCount, floatParams.y, floatParams.z));
- }
- public override string GetCodeString(string[] parents)
- {
- return string.Format("GenerateValueNoise({0}, {1}.x, {2}, {1}.y, {1}.z)", parents[0], parents[1], parents[2]);
- }
- }
- class VFXExpressionPerlinNoise1D : VFXExpression
- {
- public VFXExpressionPerlinNoise1D() : this(VFXValue<float>.Default, VFXValue<Vector3>.Default, VFXValue<int>.Default) { }
- public VFXExpressionPerlinNoise1D(params VFXExpression[] parents) : base(VFXExpression.Flags.None, parents) { }
- public override VFXExpressionOperation operation { get { return VFXExpressionOperation.PerlinNoise1D; } }
- sealed protected override VFXExpression Evaluate(VFXExpression[] constParents)
- {
- var coordinate = constParents[0].Get<float>();
- var floatParams = constParents[1].Get<Vector3>();
- var octaveCount = constParents[2].Get<int>();
- return VFXValue.Constant(VFXExpressionNoise.GeneratePerlinNoise1D(coordinate, floatParams.x, octaveCount, floatParams.y, floatParams.z));
- }
- public override string GetCodeString(string[] parents)
- {
- return string.Format("GeneratePerlinNoise({0}, {1}.x, {2}, {1}.y, {1}.z)", parents[0], parents[1], parents[2]);
- }
- }
- class VFXExpressionPerlinNoise2D : VFXExpression
- {
- public VFXExpressionPerlinNoise2D() : this(VFXValue<Vector2>.Default, VFXValue<Vector3>.Default, VFXValue<int>.Default) { }
- public VFXExpressionPerlinNoise2D(params VFXExpression[] parents) : base(VFXExpression.Flags.None, parents) { }
- public override VFXExpressionOperation operation { get { return VFXExpressionOperation.PerlinNoise2D; } }
- sealed protected override VFXExpression Evaluate(VFXExpression[] constParents)
- {
- var coordinate = constParents[0].Get<Vector2>();
- var floatParams = constParents[1].Get<Vector3>();
- var octaveCount = constParents[2].Get<int>();
- return VFXValue.Constant(VFXExpressionNoise.GeneratePerlinNoise2D(coordinate, floatParams.x, octaveCount, floatParams.y, floatParams.z));
- }
- public override string GetCodeString(string[] parents)
- {
- return string.Format("GeneratePerlinNoise({0}, {1}.x, {2}, {1}.y, {1}.z)", parents[0], parents[1], parents[2]);
- }
- }
- class VFXExpressionPerlinNoise3D : VFXExpression
- {
- public VFXExpressionPerlinNoise3D() : this(VFXValue<Vector3>.Default, VFXValue<Vector3>.Default, VFXValue<int>.Default) { }
- public VFXExpressionPerlinNoise3D(params VFXExpression[] parents) : base(VFXExpression.Flags.None, parents) { }
- public override VFXExpressionOperation operation { get { return VFXExpressionOperation.PerlinNoise3D; } }
- sealed protected override VFXExpression Evaluate(VFXExpression[] constParents)
- {
- var coordinate = constParents[0].Get<Vector3>();
- var floatParams = constParents[1].Get<Vector3>();
- var octaveCount = constParents[2].Get<int>();
- return VFXValue.Constant(VFXExpressionNoise.GeneratePerlinNoise3D(coordinate, floatParams.x, octaveCount, floatParams.y, floatParams.z));
- }
- public override string GetCodeString(string[] parents)
- {
- return string.Format("GeneratePerlinNoise({0}, {1}.x, {2}, {1}.y, {1}.z)", parents[0], parents[1], parents[2]);
- }
- }
- class VFXExpressionCellularNoise1D : VFXExpression
- {
- public VFXExpressionCellularNoise1D() : this(VFXValue<float>.Default, VFXValue<Vector3>.Default, VFXValue<int>.Default) { }
- public VFXExpressionCellularNoise1D(params VFXExpression[] parents) : base(VFXExpression.Flags.None, parents) { }
- public override VFXExpressionOperation operation { get { return VFXExpressionOperation.CellularNoise1D; } }
- sealed protected override VFXExpression Evaluate(VFXExpression[] constParents)
- {
- var coordinate = constParents[0].Get<float>();
- var floatParams = constParents[1].Get<Vector3>();
- var octaveCount = constParents[2].Get<int>();
- return VFXValue.Constant(VFXExpressionNoise.GenerateCellularNoise1D(coordinate, floatParams.x, octaveCount, floatParams.y, floatParams.z));
- }
- public override string GetCodeString(string[] parents)
- {
- return string.Format("GenerateCellularNoise({0}, {1}.x, {2}, {1}.y, {1}.z)", parents[0], parents[1], parents[2]);
- }
- }
- class VFXExpressionCellularNoise2D : VFXExpression
- {
- public VFXExpressionCellularNoise2D() : this(VFXValue<Vector2>.Default, VFXValue<Vector3>.Default, VFXValue<int>.Default) { }
- public VFXExpressionCellularNoise2D(params VFXExpression[] parents) : base(VFXExpression.Flags.None, parents) { }
- public override VFXExpressionOperation operation { get { return VFXExpressionOperation.CellularNoise2D; } }
- sealed protected override VFXExpression Evaluate(VFXExpression[] constParents)
- {
- var coordinate = constParents[0].Get<Vector2>();
- var floatParams = constParents[1].Get<Vector3>();
- var octaveCount = constParents[2].Get<int>();
- return VFXValue.Constant(VFXExpressionNoise.GenerateCellularNoise2D(coordinate, floatParams.x, octaveCount, floatParams.y, floatParams.z));
- }
- public override string GetCodeString(string[] parents)
- {
- return string.Format("GenerateCellularNoise({0}, {1}.x, {2}, {1}.y, {1}.z)", parents[0], parents[1], parents[2]);
- }
- }
- class VFXExpressionCellularNoise3D : VFXExpression
- {
- public VFXExpressionCellularNoise3D() : this(VFXValue<Vector3>.Default, VFXValue<Vector3>.Default, VFXValue<int>.Default) { }
- public VFXExpressionCellularNoise3D(params VFXExpression[] parents) : base(VFXExpression.Flags.None, parents) { }
- public override VFXExpressionOperation operation { get { return VFXExpressionOperation.CellularNoise3D; } }
- sealed protected override VFXExpression Evaluate(VFXExpression[] constParents)
- {
- var coordinate = constParents[0].Get<Vector3>();
- var floatParams = constParents[1].Get<Vector3>();
- var octaveCount = constParents[2].Get<int>();
- return VFXValue.Constant(VFXExpressionNoise.GenerateCellularNoise3D(coordinate, floatParams.x, octaveCount, floatParams.y, floatParams.z));
- }
- public override string GetCodeString(string[] parents)
- {
- return string.Format("GenerateCellularNoise({0}, {1}.x, {2}, {1}.y, {1}.z)", parents[0], parents[1], parents[2]);
- }
- }
- class VFXExpressionValueCurlNoise2D : VFXExpression
- {
- public VFXExpressionValueCurlNoise2D() : this(VFXValue<Vector2>.Default, VFXValue<Vector3>.Default, VFXValue<int>.Default) { }
- public VFXExpressionValueCurlNoise2D(params VFXExpression[] parents) : base(VFXExpression.Flags.None, parents) { }
- public override VFXExpressionOperation operation { get { return VFXExpressionOperation.ValueCurlNoise2D; } }
- sealed protected override VFXExpression Evaluate(VFXExpression[] constParents)
- {
- var coordinate = constParents[0].Get<Vector2>();
- var floatParams = constParents[1].Get<Vector3>();
- var octaveCount = constParents[2].Get<int>();
- return VFXValue.Constant(VFXExpressionNoise.GenerateValueCurlNoise2D(coordinate, floatParams.x, octaveCount, floatParams.y, floatParams.z));
- }
- public override string GetCodeString(string[] parents)
- {
- return string.Format("GenerateValueCurlNoise({0}, {1}.x, {2}, {1}.y, {1}.z)", parents[0], parents[1], parents[2]);
- }
- }
- class VFXExpressionValueCurlNoise3D : VFXExpression
- {
- public VFXExpressionValueCurlNoise3D() : this(VFXValue<Vector3>.Default, VFXValue<Vector3>.Default, VFXValue<int>.Default) { }
- public VFXExpressionValueCurlNoise3D(params VFXExpression[] parents) : base(VFXExpression.Flags.None, parents) { }
- public override VFXExpressionOperation operation { get { return VFXExpressionOperation.ValueCurlNoise3D; } }
- sealed protected override VFXExpression Evaluate(VFXExpression[] constParents)
- {
- var coordinate = constParents[0].Get<Vector3>();
- var floatParams = constParents[1].Get<Vector3>();
- var octaveCount = constParents[2].Get<int>();
- return VFXValue.Constant(VFXExpressionNoise.GenerateValueCurlNoise3D(coordinate, floatParams.x, octaveCount, floatParams.y, floatParams.z));
- }
- public override string GetCodeString(string[] parents)
- {
- return string.Format("GenerateValueCurlNoise({0}, {1}.x, {2}, {1}.y, {1}.z)", parents[0], parents[1], parents[2]);
- }
- }
- class VFXExpressionPerlinCurlNoise2D : VFXExpression
- {
- public VFXExpressionPerlinCurlNoise2D() : this(VFXValue<Vector2>.Default, VFXValue<Vector3>.Default, VFXValue<int>.Default) { }
- public VFXExpressionPerlinCurlNoise2D(params VFXExpression[] parents) : base(VFXExpression.Flags.None, parents) { }
- public override VFXExpressionOperation operation { get { return VFXExpressionOperation.PerlinCurlNoise2D; } }
- sealed protected override VFXExpression Evaluate(VFXExpression[] constParents)
- {
- var coordinate = constParents[0].Get<Vector2>();
- var floatParams = constParents[1].Get<Vector3>();
- var octaveCount = constParents[2].Get<int>();
- return VFXValue.Constant(VFXExpressionNoise.GeneratePerlinCurlNoise2D(coordinate, floatParams.x, octaveCount, floatParams.y, floatParams.z));
- }
- public override string GetCodeString(string[] parents)
- {
- return string.Format("GeneratePerlinCurlNoise({0}, {1}.x, {2}, {1}.y, {1}.z)", parents[0], parents[1], parents[2]);
- }
- }
- class VFXExpressionPerlinCurlNoise3D : VFXExpression
- {
- public VFXExpressionPerlinCurlNoise3D() : this(VFXValue<Vector3>.Default, VFXValue<Vector3>.Default, VFXValue<int>.Default) { }
- public VFXExpressionPerlinCurlNoise3D(params VFXExpression[] parents) : base(VFXExpression.Flags.None, parents) { }
- public override VFXExpressionOperation operation { get { return VFXExpressionOperation.PerlinCurlNoise3D; } }
- sealed protected override VFXExpression Evaluate(VFXExpression[] constParents)
- {
- var coordinate = constParents[0].Get<Vector3>();
- var floatParams = constParents[1].Get<Vector3>();
- var octaveCount = constParents[2].Get<int>();
- return VFXValue.Constant(VFXExpressionNoise.GeneratePerlinCurlNoise3D(coordinate, floatParams.x, octaveCount, floatParams.y, floatParams.z));
- }
- public override string GetCodeString(string[] parents)
- {
- return string.Format("GeneratePerlinCurlNoise({0}, {1}.x, {2}, {1}.y, {1}.z)", parents[0], parents[1], parents[2]);
- }
- }
- class VFXExpressionCellularCurlNoise2D : VFXExpression
- {
- public VFXExpressionCellularCurlNoise2D() : this(VFXValue<Vector2>.Default, VFXValue<Vector3>.Default, VFXValue<int>.Default) { }
- public VFXExpressionCellularCurlNoise2D(params VFXExpression[] parents) : base(VFXExpression.Flags.None, parents) { }
- public override VFXExpressionOperation operation { get { return VFXExpressionOperation.CellularCurlNoise2D; } }
- sealed protected override VFXExpression Evaluate(VFXExpression[] constParents)
- {
- var coordinate = constParents[0].Get<Vector2>();
- var floatParams = constParents[1].Get<Vector3>();
- var octaveCount = constParents[2].Get<int>();
- return VFXValue.Constant(VFXExpressionNoise.GenerateCellularCurlNoise2D(coordinate, floatParams.x, octaveCount, floatParams.y, floatParams.z));
- }
- public override string GetCodeString(string[] parents)
- {
- return string.Format("GenerateCellularCurlNoise({0}, {1}.x, {2}, {1}.y, {1}.z)", parents[0], parents[1], parents[2]);
- }
- }
- class VFXExpressionCellularCurlNoise3D : VFXExpression
- {
- public VFXExpressionCellularCurlNoise3D() : this(VFXValue<Vector3>.Default, VFXValue<Vector3>.Default, VFXValue<int>.Default) { }
- public VFXExpressionCellularCurlNoise3D(params VFXExpression[] parents) : base(VFXExpression.Flags.None, parents) { }
- public override VFXExpressionOperation operation { get { return VFXExpressionOperation.CellularCurlNoise3D; } }
- sealed protected override VFXExpression Evaluate(VFXExpression[] constParents)
- {
- var coordinate = constParents[0].Get<Vector3>();
- var floatParams = constParents[1].Get<Vector3>();
- var octaveCount = constParents[2].Get<int>();
- return VFXValue.Constant(VFXExpressionNoise.GenerateCellularCurlNoise3D(coordinate, floatParams.x, octaveCount, floatParams.y, floatParams.z));
- }
- public override string GetCodeString(string[] parents)
- {
- return string.Format("GenerateCellularCurlNoise({0}, {1}.x, {2}, {1}.y, {1}.z)", parents[0], parents[1], parents[2]);
- }
- }
- class VFXExpressionVoroNoise2D : VFXExpression
- {
- public VFXExpressionVoroNoise2D() : this(VFXValue<Vector2>.Default, VFXValue<Vector3>.Default) { }
- public VFXExpressionVoroNoise2D(params VFXExpression[] parents) : base(VFXExpression.Flags.InvalidOnCPU, parents) { }
- sealed public override VFXValueType valueType { get { return VFXValueType.Float; } }
- public override VFXExpressionOperation operation { get { return VFXExpressionOperation.None; } }
- /*sealed protected override VFXExpression Evaluate(VFXExpression[] constParents)
- {
- var coordinate = constParents[0].Get<Vector2>();
- var floatParams = constParents[1].Get<Vector3>();
- return VFXValue.Constant(VFXExpressionNoise.GenerateVoroNoise2D(coordinate, floatParams.x, floatParams.y, floatParams.z));
- }*/
- public override string GetCodeString(string[] parents)
- {
- return string.Format("GenerateVoroNoise({0}, {1}.x, {1}.y, {1}.z)", parents[0], parents[1]);
- }
- }
- }
|