32 lines
1.1 KiB
C#
32 lines
1.1 KiB
C#
using System;
|
|
using UnityEngine;
|
|
|
|
namespace ProBuilder2.Common
|
|
{
|
|
// Token: 0x0200003F RID: 63
|
|
public static class pb_Snap
|
|
{
|
|
// Token: 0x06000215 RID: 533 RVA: 0x0001CBFE File Offset: 0x0001AFFE
|
|
public static Vector3 SnapValue(Vector3 vertex, float snpVal)
|
|
{
|
|
return new Vector3(snpVal * Mathf.Round(vertex.x / snpVal), snpVal * Mathf.Round(vertex.y / snpVal), snpVal * Mathf.Round(vertex.z / snpVal));
|
|
}
|
|
|
|
// Token: 0x06000216 RID: 534 RVA: 0x0001CC35 File Offset: 0x0001B035
|
|
public static float SnapValue(float val, float snpVal)
|
|
{
|
|
return snpVal * Mathf.Round(val / snpVal);
|
|
}
|
|
|
|
// Token: 0x06000217 RID: 535 RVA: 0x0001CC44 File Offset: 0x0001B044
|
|
public static Vector3 SnapValue(Vector3 vertex, Vector3 snap)
|
|
{
|
|
float x = vertex.x;
|
|
float y = vertex.y;
|
|
float z = vertex.z;
|
|
Vector3 vector = new Vector3((Mathf.Abs(snap.x) >= 0.0001f) ? (snap.x * Mathf.Round(x / snap.x)) : x, (Mathf.Abs(snap.y) >= 0.0001f) ? (snap.y * Mathf.Round(y / snap.y)) : y, (Mathf.Abs(snap.z) >= 0.0001f) ? (snap.z * Mathf.Round(z / snap.z)) : z);
|
|
return vector;
|
|
}
|
|
}
|
|
}
|