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