-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9df0706
commit b0181d0
Showing
2 changed files
with
64 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
using System.Runtime.CompilerServices; | ||
using UnityEngine; | ||
|
||
namespace MinimalUtility | ||
{ | ||
/// <summary> | ||
/// プログラムで扱う頻度が高そうな<see cref="Mesh"/>の定数群. | ||
/// </summary> | ||
public static class MeshConst | ||
{ | ||
/// <summary> | ||
/// プリミティブキューブ. | ||
/// </summary> | ||
public static Mesh Cube | ||
{ | ||
[MethodImpl(MethodImplOptions.AggressiveInlining)] | ||
get | ||
{ | ||
return new Mesh() | ||
{ | ||
vertices = new[] | ||
{ | ||
new Vector3(0.5f, -0.5f, 0.5f), new Vector3(-0.5f, -0.5f, 0.5f), new Vector3(0.5f, 0.5f, 0.5f), | ||
new Vector3(-0.5f, 0.5f, 0.5f), new Vector3(0.5f, 0.5f, -0.5f), new Vector3(-0.5f, 0.5f, -0.5f), | ||
new Vector3(0.5f, -0.5f, -0.5f), new Vector3(-0.5f, -0.5f, -0.5f), new Vector3(0.5f, 0.5f, 0.5f), | ||
new Vector3(-0.5f, 0.5f, 0.5f), new Vector3(0.5f, 0.5f, -0.5f), new Vector3(-0.5f, 0.5f, -0.5f), | ||
new Vector3(0.5f, -0.5f, -0.5f), new Vector3(0.5f, -0.5f, 0.5f), new Vector3(-0.5f, -0.5f, 0.5f), | ||
new Vector3(-0.5f, -0.5f, -0.5f), new Vector3(-0.5f, -0.5f, 0.5f), new Vector3(-0.5f, 0.5f, 0.5f), | ||
new Vector3(-0.5f, 0.5f, -0.5f), new Vector3(-0.5f, -0.5f, -0.5f), new Vector3(0.5f, -0.5f, -0.5f), | ||
new Vector3(0.5f, 0.5f, -0.5f), new Vector3(0.5f, 0.5f, 0.5f), new Vector3(0.5f, -0.5f, 0.5f) | ||
}, | ||
triangles = new[] | ||
{ | ||
0, 2, 3, 0, 3, 1, | ||
8, 4, 5, 8, 5, 9, | ||
10, 6, 7, 10, 7, 11, | ||
12, 13, 14, 12, 14, 15, | ||
16, 17, 18, 16, 18, 19, | ||
20, 21, 22, 20, 22, 23 | ||
}, | ||
normals = new[] | ||
{ | ||
Vector3.forward, Vector3.forward, Vector3.forward, Vector3.forward, | ||
Vector3.up, Vector3.up, Vector3.back, Vector3.back, | ||
Vector3.up, Vector3.up, Vector3.back, Vector3.back, | ||
Vector3.down, Vector3.down, Vector3.down, Vector3.down, | ||
Vector3.left, Vector3.left, Vector3.left, Vector3.left, | ||
Vector3.right, Vector3.right, Vector3.right, Vector3.right | ||
}, | ||
uv = new[] | ||
{ | ||
Vector2.zero, Vector2.right, Vector2.up, Vector2.one, Vector2.up, Vector2.one, | ||
Vector2.up, Vector2.one, Vector2.zero, Vector2.right, Vector2.zero, Vector2.right, | ||
Vector2.zero, Vector2.up, Vector2.one, Vector2.right, Vector2.zero, Vector2.up, | ||
Vector2.one, Vector2.right, Vector2.zero, Vector2.up, Vector2.one, Vector2.right | ||
}, | ||
}; | ||
} | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.