您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
36 行
810 B
36 行
810 B
using System;
|
|
using System.Runtime.CompilerServices;
|
|
using static Unity.Mathematics.math;
|
|
|
|
namespace Primitives
|
|
{
|
|
using Unity.Mathematics;
|
|
|
|
[Serializable]
|
|
public struct sphere
|
|
{
|
|
public float3 center;
|
|
public float radius;
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public sphere(float3 center, float radius)
|
|
{
|
|
this.center = center;
|
|
this.radius = radius;
|
|
}
|
|
}
|
|
|
|
public static partial class primlib
|
|
{
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static sphere sphere(float3 center, float radius) { return new sphere(center,radius); }
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static sphere transform(sphere prim, float3 position, quaternion rotation)
|
|
{
|
|
prim.center = mul(rotation, prim.center) + position;
|
|
return prim;
|
|
}
|
|
}
|
|
}
|
|
|