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.
33 lines
1.1 KiB
33 lines
1.1 KiB
using UnityEngine;
|
|
|
|
namespace UnityEditor.VFX.Operator
|
|
{
|
|
[VFXHelpURL("Operator-Volume(Cone)")]
|
|
[VFXInfo(name = "Volume (Cone)", category = "Math/Geometry")]
|
|
class ConeVolume : VFXOperator
|
|
{
|
|
public class InputProperties
|
|
{
|
|
[Tooltip("Sets the cone used for the volume calculation.")]
|
|
public TCone cone = TCone.defaultValue;
|
|
}
|
|
|
|
public class OutputProperties
|
|
{
|
|
[Tooltip("Outputs the volume of the cone.")]
|
|
public float volume;
|
|
}
|
|
|
|
override public string name { get { return "Volume (Cone)"; } }
|
|
|
|
protected override sealed VFXExpression[] BuildExpression(VFXExpression[] inputExpression)
|
|
{
|
|
var scale = new VFXExpressionExtractScaleFromMatrix(inputExpression[0]);
|
|
var baseRadius = inputExpression[1];
|
|
var topRadius = inputExpression[2];
|
|
var height = inputExpression[3];
|
|
|
|
return new VFXExpression[] { VFXOperatorUtility.ConeVolume(baseRadius, topRadius, height, scale) };
|
|
}
|
|
}
|
|
}
|