Files
CartoonRPG/Library/PackageCache/com.unity.visualeffectgraph@2973a8ac1070/Editor/Models/Deprecated/CylinderVolumeDeprecated.cs
Caleb Sandford deQuincey 02c4b5ab66 Adding in new packages
2025-06-05 22:59:18 +01:00

44 lines
1.4 KiB
C#

using System;
using System.Linq;
using UnityEngine;
namespace UnityEditor.VFX.Operator
{
class CylinderVolumeDeprecated : VFXOperator
{
public class InputProperties
{
[Tooltip("Sets the cylinder used for the volume calculation.")]
public Cylinder cylinder = new Cylinder();
}
public class OutputProperties
{
[Tooltip("Outputs the volume of the cylinder.")]
public float volume;
}
override public string name { get { return "Volume (Cylinder) (deprecated)"; } }
static public VFXExpression CylinderVolume(VFXExpression radius, VFXExpression height)
{
//pi * r * r * h
var pi = VFXValue.Constant(Mathf.PI);
return (pi * radius * radius * height);
}
public override void Sanitize(int version)
{
var newVolume = ScriptableObject.CreateInstance<Operator.ConeVolume>();
SanitizeHelper.MigrateTConeFromCylinder(newVolume.inputSlots[0], inputSlots[0]);
VFXSlot.CopyLinksAndValue(newVolume.outputSlots[0], outputSlots[0], true);
ReplaceModel(newVolume, this);
}
protected override sealed VFXExpression[] BuildExpression(VFXExpression[] inputExpression)
{
return new VFXExpression[] { CylinderVolume(inputExpression[1], inputExpression[2]) };
}
}
}