You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

30 lines
976 B

using UnityEngine;
namespace UnityEditor.VFX.Operator
{
[VFXHelpURL("Operator-Volume(Sphere)")]
[VFXInfo(name = "Volume (Sphere)", category = "Math/Geometry")]
class SphereVolume : VFXOperator
{
public class InputProperties
{
[Tooltip("Sets the sphere used for the volume calculation.")]
public TSphere sphere = TSphere.defaultValue;
}
public class OutputProperties
{
[Tooltip("Outputs the volume of the sphere.")]
public float volume;
}
override public string name { get { return "Volume (Sphere)"; } }
protected override sealed VFXExpression[] BuildExpression(VFXExpression[] inputExpression)
{
var scale = new VFXExpressionExtractScaleFromMatrix(inputExpression[0]);
var radius = inputExpression[1];
return new VFXExpression[] { VFXOperatorUtility.SphereVolume(radius, scale) };
}
}
}