2using System.Collections.Generic;
5using UnityEngine.Rendering;
66 public List<MeshBatch>
batches =
new List<MeshBatch>();
79 private Vector3
tempV = Vector3.zero;
81 private Vector2
tempE = Vector2.zero;
122 public void Add(
Point point,
float tile = 0f,
float color = 0f)
141 public void Add(ref Vector3 v,
float tile = 0f,
float color = 0f)
159 public void Add(
float x,
float y,
float z,
float tile = 0f,
float color = 0f)
177 public void AddWithScale(
float x,
float y,
float z,
int tile,
float scale)
181 float num = (0f - scale) / 2f + 0.5f;
182 matrices[
idx].m03 = x + num;
183 matrices[
idx].m13 = y + num;
184 matrices[
idx].m23 = z;
185 matrices[
idx].m00 = scale;
186 matrices[
idx].m11 = scale;
198 _batch.
matrices[
idx].SetTRS(Vector3.zero, Quaternion.Euler(0f, 0f, 0f), Vector3.one);
216 float num = (float)s.scaleX * 0.01f;
217 float num2 = (
float)s.scaleY * 0.01f;
218 bool flag = dir % 2 == 1;
219 int num3 = (flag ? 1 : (-1));
222 matrices[
idx].m03 = x - 0.01f * (float)((dir < 2) ? (flag ? pref.shadowRX : pref.
shadowX) : (flag ? pref.
shadowBRX : pref.
shadowBX)) + ((0.7f * (0f - num) + 0.7f) * (
float)num3 + (float)s.x * 0.01f) * (float)num3;
223 matrices[
idx].m13 = y - 0.01f * (float)((dir < 2) ? (flag ? pref.shadowRY : pref.
shadowY) : (flag ? pref.
shadowBRY : pref.
shadowBY)) + 0.6f * (0f - num2) + 0.6f + (float)s.y * 0.01f;
224 matrices[
idx].m23 = z;
225 matrices[
idx].m00 = num;
226 matrices[
idx].m11 = num2;
229 matrices[
idx].m00 = num;
230 matrices[
idx].m01 = 0f;
231 matrices[
idx].m10 = 0f;
232 matrices[
idx].m11 = num2;
237 Quaternion quaternion = Quaternion.Euler(0f, 0f, -angle);
238 tempE.x = 1f - quaternion.z * quaternion.z * 2f;
239 tempE.y = (0f - quaternion.w) * quaternion.z * 2f;
242 matrices[
idx].m10 = (0f -
tempE.y) * num;
243 matrices[
idx].m11 = tempE.x * num2;
253 public void AddWithRotation(
float x,
float y,
float z,
float sx,
float sy,
int tile,
float angle,
bool flip)
257 int num3 = ((!flip) ? 1 : (-1));
260 matrices[
idx].m03 = x + ((0.7f * (0f - num) + 0.7f) * (float)num3 + sx * 0.01f) * (float)num3;
261 matrices[
idx].m13 = y + 0.6f * (0f - num2) + 0.6f + sy * 0.01f;
262 matrices[
idx].m23 = z;
263 matrices[
idx].m00 = num;
264 matrices[
idx].m11 = num2;
265 tempV.z = 0f - angle;
266 Quaternion quaternion = Quaternion.Euler(0f, 0f, 0f - angle);
267 tempE.x = 1f - quaternion.z * quaternion.z * 2f;
268 tempE.y = (0f - quaternion.w) * quaternion.z * 2f;
271 matrices[
idx].m10 = (0f -
tempE.y) * num;
272 matrices[
idx].m11 = tempE.x * num2;
306 public void Add(
float x,
float y,
float z,
float tile,
float color,
float matColor = 0f)
368 for (
int i = 0; i <
batchIdx + 1; i++)
394 Graphics.DrawMeshInstanced(
mesh, 0,
batches[i].
mat,
batches[i].matrices, num,
batches[i].mpb, ShadowCastingMode.Off, receiveShadows:
false, 0, Camera.main);
398 Graphics.DrawMeshInstanced(
mesh, 0,
mat,
batches[i].matrices, num,
batches[i].mpb, ShadowCastingMode.Off, receiveShadows:
false, 0, Camera.main);
406 Debug.Log(
"#pass Resize Pass:" + base.name);
434 Mesh obj =
new Mesh();
435 obj.SetVertices(Array.ConvertAll(
sprite.vertices, (Converter<Vector2, Vector3>)((Vector2 c) => c)).ToList());
437 obj.SetTriangles(Array.ConvertAll(
sprite.triangles, (Converter<ushort, int>)((ushort c) => c)), 0);
448 if (Application.isPlaying)
450 UnityEngine.Object.DestroyImmediate(
mesh);
454 obj.initialized =
false;
484 snowPass.mesh =
mesh;
492 shadowPass.mesh =
mesh;
if(item3.idFile==idFirstFile &&item3.id==idFirstTopic)
void Add(ref Vector3 v, float tile=0f, float color=0f)
void Add(MeshPassParam p)
void Add(MeshPassParam p, float tile, float color, float matColor=0f)
void AddWithRotation(float x, float y, float z, float sx, float sy, int tile, float angle, bool flip)
void AddWithScale(float x, float y, float z, int tile, float scale)
void Add(float x, float y, float z, float tile, float color, float matColor=0f)
override string ToString()
void Add(float x, float y, float z, float tile=0f, float color=0f)
const int TokenLowWallDefault
void Add(Point point, float tile=0f, float color=0f)
void AddShadow(float x, float y, float z, ShadowData.Item s, SourcePref pref, int dir=0, bool snow=false)
Mesh SpriteToMesh(Sprite sprite)
void AddShadow(MeshPassParam p, ref Vector3 fix)
List< MeshBatch > batches
ref Vector3 Position(int height)