86 Color color2 =
new((byte)(color.R * num), (byte)(color.G * num), (byte)(color.B * num), color.
A);
124 int textureSlotCount,
127 float tx = (
m_textureCoordinates[corner].X + textureSlot % textureSlotCount) / textureSlotCount;
128 float ty = (
m_textureCoordinates[corner].Y + textureSlot / textureSlotCount) / textureSlotCount;
150 vertex.Tx = (short)(tx * 32767f);
151 vertex.Ty = (short)(ty * 32767f);
152 vertex.Color = color;
163 DynamicArray<TerrainVertex> vertices = subset.
Vertices;
164 TerrainGeometryDynamicArray<int> indices = subset.
Indices;
165 int num =
Terrain.ExtractLight(value);
167 Color color2 =
new((byte)(color.R * num2), (byte)(color.G * num2), (byte)(color.B * num2), color.
A);
168 int count = vertices.
Count;
180 ref vertices.
Array[count]
190 ref vertices.
Array[count + 1]
200 ref vertices.
Array[count + 2]
210 ref vertices.
Array[count + 3]
222 ref vertices.
Array[count]
232 ref vertices.
Array[count + 1]
242 ref vertices.
Array[count + 2]
252 ref vertices.
Array[count + 3]
264 ref vertices.
Array[count + 4]
274 ref vertices.
Array[count + 5]
284 ref vertices.
Array[count + 6]
294 ref vertices.
Array[count + 7]
306 ref vertices.
Array[count + 4]
316 ref vertices.
Array[count + 5]
326 ref vertices.
Array[count + 6]
336 ref vertices.
Array[count + 7]
339 int count2 = indices.
Count;
341 indices.
Array[count2] = count;
342 indices.
Array[count2 + 1] = count + 1;
343 indices.
Array[count2 + 2] = count + 2;
344 indices.
Array[count2 + 3] = count + 2;
345 indices.
Array[count2 + 4] = count + 1;
346 indices.
Array[count2 + 5] = count;
347 indices.
Array[count2 + 6] = count + 2;
348 indices.
Array[count2 + 7] = count + 3;
349 indices.
Array[count2 + 8] = count;
350 indices.
Array[count2 + 9] = count;
351 indices.
Array[count2 + 10] = count + 3;
352 indices.
Array[count2 + 11] = count + 2;
353 indices.
Array[count2 + 12] = count + 4;
354 indices.
Array[count2 + 13] = count + 5;
355 indices.
Array[count2 + 14] = count + 6;
356 indices.
Array[count2 + 15] = count + 6;
357 indices.
Array[count2 + 16] = count + 5;
358 indices.
Array[count2 + 17] = count + 4;
359 indices.
Array[count2 + 18] = count + 6;
360 indices.
Array[count2 + 19] = count + 7;
361 indices.
Array[count2 + 20] = count + 4;
362 indices.
Array[count2 + 21] = count + 4;
363 indices.
Array[count2 + 22] = count + 7;
364 indices.
Array[count2 + 23] = count + 6;
380 int cellValueFast = chunkAtCell2.
GetCellValueFast(x & 0xF, y, (z + 1) & 0xF);
392 DynamicArray<TerrainVertex> vertices = subsetsByFace[0].
Vertices;
393 TerrainGeometryDynamicArray<int> indices = subsetsByFace[0].
Indices;
395 int count = vertices.
Count;
406 ref vertices.
Array[count]
417 ref vertices.
Array[count + 1]
428 ref vertices.
Array[count + 2]
439 ref vertices.
Array[count + 3]
441 int count2 = indices.
Count;
443 indices.
Array[count2] = count;
444 indices.
Array[count2 + 1] = count + 2;
445 indices.
Array[count2 + 2] = count + 1;
446 indices.
Array[count2 + 3] = count + 2;
447 indices.
Array[count2 + 4] = count;
448 indices.
Array[count2 + 5] = count + 3;
461 DynamicArray<TerrainVertex> vertices2 = subsetsByFace[1].
Vertices;
462 TerrainGeometryDynamicArray<int> indices2 = subsetsByFace[1].
Indices;
464 int count3 = vertices2.
Count;
465 vertices2.Count += 4;
475 ref vertices2.
Array[count3]
486 ref vertices2.
Array[count3 + 1]
497 ref vertices2.
Array[count3 + 2]
508 ref vertices2.
Array[count3 + 3]
510 int count4 = indices2.
Count;
512 indices2.
Array[count4] = count3;
513 indices2.
Array[count4 + 1] = count3 + 2;
514 indices2.
Array[count4 + 2] = count3 + 1;
515 indices2.
Array[count4 + 3] = count3 + 2;
516 indices2.
Array[count4 + 4] = count3;
517 indices2.
Array[count4 + 5] = count3 + 3;
530 DynamicArray<TerrainVertex> vertices3 = subsetsByFace[2].
Vertices;
531 TerrainGeometryDynamicArray<int> indices3 = subsetsByFace[2].
Indices;
533 int count5 = vertices3.
Count;
534 vertices3.Count += 4;
544 ref vertices3.
Array[count5]
555 ref vertices3.
Array[count5 + 1]
566 ref vertices3.
Array[count5 + 2]
577 ref vertices3.
Array[count5 + 3]
579 int count6 = indices3.
Count;
581 indices3.
Array[count6] = count5;
582 indices3.
Array[count6 + 1] = count5 + 1;
583 indices3.
Array[count6 + 2] = count5 + 2;
584 indices3.
Array[count6 + 3] = count5 + 2;
585 indices3.
Array[count6 + 4] = count5 + 3;
586 indices3.
Array[count6 + 5] = count5;
599 DynamicArray<TerrainVertex> vertices4 = subsetsByFace[3].
Vertices;
600 TerrainGeometryDynamicArray<int> indices4 = subsetsByFace[3].
Indices;
602 int count7 = vertices4.
Count;
603 vertices4.Count += 4;
613 ref vertices4.
Array[count7]
624 ref vertices4.
Array[count7 + 1]
635 ref vertices4.
Array[count7 + 2]
646 ref vertices4.
Array[count7 + 3]
648 int count8 = indices4.
Count;
650 indices4.
Array[count8] = count7;
651 indices4.
Array[count8 + 1] = count7 + 1;
652 indices4.
Array[count8 + 2] = count7 + 2;
653 indices4.
Array[count8 + 3] = count7 + 2;
654 indices4.
Array[count8 + 4] = count7 + 3;
655 indices4.
Array[count8 + 5] = count7;
668 DynamicArray<TerrainVertex> vertices5 = subsetsByFace[4].
Vertices;
669 TerrainGeometryDynamicArray<int> indices5 = subsetsByFace[4].
Indices;
671 int count9 = vertices5.
Count;
672 vertices5.Count += 4;
682 ref vertices5.
Array[count9]
693 ref vertices5.
Array[count9 + 1]
704 ref vertices5.
Array[count9 + 2]
715 ref vertices5.
Array[count9 + 3]
717 int count10 = indices5.
Count;
719 indices5.
Array[count10] = count9;
720 indices5.
Array[count10 + 1] = count9 + 1;
721 indices5.
Array[count10 + 2] = count9 + 2;
722 indices5.
Array[count10 + 3] = count9 + 2;
723 indices5.
Array[count10 + 4] = count9 + 3;
724 indices5.
Array[count10 + 5] = count9;
737 DynamicArray<TerrainVertex> vertices6 = subsetsByFace[5].
Vertices;
738 TerrainGeometryDynamicArray<int> indices6 = subsetsByFace[5].
Indices;
740 int count11 = vertices6.
Count;
741 vertices6.Count += 4;
751 ref vertices6.
Array[count11]
762 ref vertices6.
Array[count11 + 1]
773 ref vertices6.
Array[count11 + 2]
784 ref vertices6.
Array[count11 + 3]
786 int count12 = indices6.
Count;
788 indices6.
Array[count12] = count11;
789 indices6.
Array[count12 + 1] = count11 + 2;
790 indices6.
Array[count12 + 2] = count11 + 1;
791 indices6.
Array[count12 + 3] = count11 + 2;
792 indices6.
Array[count12 + 4] = count11;
793 indices6.
Array[count12 + 5] = count11 + 3;
811 int overrideTopTextureSlot,
819 int cellValueFast = chunkAtCell2.
GetCellValueFast(x & 0xF, y, (z + 1) & 0xF);
831 DynamicArray<TerrainVertex> vertices = subsetsByFace[0].
Vertices;
832 TerrainGeometryDynamicArray<int> indices = subsetsByFace[0].
Indices;
834 int count = vertices.
Count;
845 ref vertices.
Array[count]
856 ref vertices.
Array[count + 1]
867 ref vertices.
Array[count + 2]
878 ref vertices.
Array[count + 3]
880 int count2 = indices.
Count;
882 indices.
Array[count2] = count;
883 indices.
Array[count2 + 1] = count + 2;
884 indices.
Array[count2 + 2] = count + 1;
885 indices.
Array[count2 + 3] = count + 2;
886 indices.
Array[count2 + 4] = count;
887 indices.
Array[count2 + 5] = count + 3;
900 DynamicArray<TerrainVertex> vertices2 = subsetsByFace[1].
Vertices;
901 TerrainGeometryDynamicArray<int> indices2 = subsetsByFace[1].
Indices;
903 int count3 = vertices2.
Count;
904 vertices2.Count += 4;
914 ref vertices2.
Array[count3]
925 ref vertices2.
Array[count3 + 1]
936 ref vertices2.
Array[count3 + 2]
947 ref vertices2.
Array[count3 + 3]
949 int count4 = indices2.
Count;
951 indices2.
Array[count4] = count3;
952 indices2.
Array[count4 + 1] = count3 + 2;
953 indices2.
Array[count4 + 2] = count3 + 1;
954 indices2.
Array[count4 + 3] = count3 + 2;
955 indices2.
Array[count4 + 4] = count3;
956 indices2.
Array[count4 + 5] = count3 + 3;
969 DynamicArray<TerrainVertex> vertices3 = subsetsByFace[2].
Vertices;
970 TerrainGeometryDynamicArray<int> indices3 = subsetsByFace[2].
Indices;
972 int count5 = vertices3.
Count;
973 vertices3.Count += 4;
983 ref vertices3.
Array[count5]
994 ref vertices3.
Array[count5 + 1]
1005 ref vertices3.
Array[count5 + 2]
1016 ref vertices3.
Array[count5 + 3]
1018 int count6 = indices3.
Count;
1019 indices3.Count += 6;
1020 indices3.
Array[count6] = count5;
1021 indices3.
Array[count6 + 1] = count5 + 1;
1022 indices3.
Array[count6 + 2] = count5 + 2;
1023 indices3.
Array[count6 + 3] = count5 + 2;
1024 indices3.
Array[count6 + 4] = count5 + 3;
1025 indices3.
Array[count6 + 5] = count5;
1038 DynamicArray<TerrainVertex> vertices4 = subsetsByFace[3].
Vertices;
1039 TerrainGeometryDynamicArray<int> indices4 = subsetsByFace[3].
Indices;
1041 int count7 = vertices4.
Count;
1042 vertices4.Count += 4;
1052 ref vertices4.
Array[count7]
1063 ref vertices4.
Array[count7 + 1]
1074 ref vertices4.
Array[count7 + 2]
1085 ref vertices4.
Array[count7 + 3]
1087 int count8 = indices4.
Count;
1088 indices4.Count += 6;
1089 indices4.
Array[count8] = count7;
1090 indices4.
Array[count8 + 1] = count7 + 1;
1091 indices4.
Array[count8 + 2] = count7 + 2;
1092 indices4.
Array[count8 + 3] = count7 + 2;
1093 indices4.
Array[count8 + 4] = count7 + 3;
1094 indices4.
Array[count8 + 5] = count7;
1111 DynamicArray<TerrainVertex> vertices5 = subsetsByFace[4].
Vertices;
1112 TerrainGeometryDynamicArray<int> indices5 = subsetsByFace[4].
Indices;
1113 int textureSlot = overrideTopTextureSlot >= 0 ? overrideTopTextureSlot : block.
GetFaceTextureSlot(4, value);
1114 int count9 = vertices5.
Count;
1115 vertices5.Count += 4;
1125 ref vertices5.
Array[count9]
1136 ref vertices5.
Array[count9 + 1]
1147 ref vertices5.
Array[count9 + 2]
1158 ref vertices5.
Array[count9 + 3]
1160 int count10 = indices5.
Count;
1161 indices5.Count += 6;
1162 indices5.
Array[count10] = count9;
1163 indices5.
Array[count10 + 1] = count9 + 1;
1164 indices5.
Array[count10 + 2] = count9 + 2;
1165 indices5.
Array[count10 + 3] = count9 + 2;
1166 indices5.
Array[count10 + 4] = count9 + 3;
1167 indices5.
Array[count10 + 5] = count9;
1180 DynamicArray<TerrainVertex> vertices6 = subsetsByFace[5].
Vertices;
1181 TerrainGeometryDynamicArray<int> indices6 = subsetsByFace[5].
Indices;
1183 int count11 = vertices6.
Count;
1184 vertices6.Count += 4;
1194 ref vertices6.
Array[count11]
1205 ref vertices6.
Array[count11 + 1]
1216 ref vertices6.
Array[count11 + 2]
1227 ref vertices6.
Array[count11 + 3]
1229 int count12 = indices6.
Count;
1230 indices6.Count += 6;
1231 indices6.
Array[count12] = count11;
1232 indices6.
Array[count12 + 1] = count11 + 2;
1233 indices6.
Array[count12 + 2] = count11 + 1;
1234 indices6.
Array[count12 + 3] = count11 + 2;
1235 indices6.
Array[count12 + 4] = count11;
1236 indices6.
Array[count12 + 5] = count11 + 3;
1256 int cellValueFast = chunkAtCell2.
GetCellValueFast(x & 0xF, y, (z + 1) & 0xF);
1268 DynamicArray<TerrainVertex> vertices = subsetsByFace[0].
Vertices;
1269 TerrainGeometryDynamicArray<int> indices = subsetsByFace[0].
Indices;
1271 int count = vertices.
Count;
1272 vertices.Count += 4;
1282 ref vertices.
Array[count]
1293 ref vertices.
Array[count + 1]
1304 ref vertices.
Array[count + 2]
1315 ref vertices.
Array[count + 3]
1317 int count2 = indices.
Count;
1319 indices.
Array[count2] = count;
1320 indices.
Array[count2 + 1] = count + 2;
1321 indices.
Array[count2 + 2] = count + 1;
1322 indices.
Array[count2 + 3] = count + 2;
1323 indices.
Array[count2 + 4] = count;
1324 indices.
Array[count2 + 5] = count + 3;
1337 DynamicArray<TerrainVertex> vertices2 = subsetsByFace[1].
Vertices;
1338 TerrainGeometryDynamicArray<int> indices2 = subsetsByFace[1].
Indices;
1340 int count3 = vertices2.
Count;
1341 vertices2.Count += 4;
1351 ref vertices2.
Array[count3]
1362 ref vertices2.
Array[count3 + 1]
1373 ref vertices2.
Array[count3 + 2]
1384 ref vertices2.
Array[count3 + 3]
1386 int count4 = indices2.
Count;
1387 indices2.Count += 6;
1388 indices2.
Array[count4] = count3;
1389 indices2.
Array[count4 + 1] = count3 + 2;
1390 indices2.
Array[count4 + 2] = count3 + 1;
1391 indices2.
Array[count4 + 3] = count3 + 2;
1392 indices2.
Array[count4 + 4] = count3;
1393 indices2.
Array[count4 + 5] = count3 + 3;
1406 DynamicArray<TerrainVertex> vertices3 = subsetsByFace[2].
Vertices;
1407 TerrainGeometryDynamicArray<int> indices3 = subsetsByFace[2].
Indices;
1409 int count5 = vertices3.
Count;
1410 vertices3.Count += 4;
1420 ref vertices3.
Array[count5]
1431 ref vertices3.
Array[count5 + 1]
1442 ref vertices3.
Array[count5 + 2]
1453 ref vertices3.
Array[count5 + 3]
1455 int count6 = indices3.
Count;
1456 indices3.Count += 6;
1457 indices3.
Array[count6] = count5;
1458 indices3.
Array[count6 + 1] = count5 + 1;
1459 indices3.
Array[count6 + 2] = count5 + 2;
1460 indices3.
Array[count6 + 3] = count5 + 2;
1461 indices3.
Array[count6 + 4] = count5 + 3;
1462 indices3.
Array[count6 + 5] = count5;
1475 DynamicArray<TerrainVertex> vertices4 = subsetsByFace[3].
Vertices;
1476 TerrainGeometryDynamicArray<int> indices4 = subsetsByFace[3].
Indices;
1478 int count7 = vertices4.
Count;
1479 vertices4.Count += 4;
1489 ref vertices4.
Array[count7]
1500 ref vertices4.
Array[count7 + 1]
1511 ref vertices4.
Array[count7 + 2]
1522 ref vertices4.
Array[count7 + 3]
1524 int count8 = indices4.
Count;
1525 indices4.Count += 6;
1526 indices4.
Array[count8] = count7;
1527 indices4.
Array[count8 + 1] = count7 + 1;
1528 indices4.
Array[count8 + 2] = count7 + 2;
1529 indices4.
Array[count8 + 3] = count7 + 2;
1530 indices4.
Array[count8 + 4] = count7 + 3;
1531 indices4.
Array[count8 + 5] = count7;
1544 DynamicArray<TerrainVertex> vertices5 = subsetsByFace[4].
Vertices;
1545 TerrainGeometryDynamicArray<int> indices5 = subsetsByFace[4].
Indices;
1547 int count9 = vertices5.
Count;
1548 vertices5.Count += 4;
1558 ref vertices5.
Array[count9]
1569 ref vertices5.
Array[count9 + 1]
1580 ref vertices5.
Array[count9 + 2]
1591 ref vertices5.
Array[count9 + 3]
1593 int count10 = indices5.
Count;
1594 indices5.Count += 6;
1595 indices5.
Array[count10] = count9;
1596 indices5.
Array[count10 + 1] = count9 + 1;
1597 indices5.
Array[count10 + 2] = count9 + 2;
1598 indices5.
Array[count10 + 3] = count9 + 2;
1599 indices5.
Array[count10 + 4] = count9 + 3;
1600 indices5.
Array[count10 + 5] = count9;
1613 DynamicArray<TerrainVertex> vertices6 = subsetsByFace[5].
Vertices;
1614 TerrainGeometryDynamicArray<int> indices6 = subsetsByFace[5].
Indices;
1616 int count11 = vertices6.
Count;
1617 vertices6.Count += 4;
1627 ref vertices6.
Array[count11]
1638 ref vertices6.
Array[count11 + 1]
1649 ref vertices6.
Array[count11 + 2]
1660 ref vertices6.
Array[count11 + 3]
1662 int count12 = indices6.
Count;
1663 indices6.Count += 6;
1664 indices6.
Array[count12] = count11;
1665 indices6.
Array[count12 + 1] = count11 + 2;
1666 indices6.
Array[count12 + 2] = count11 + 1;
1667 indices6.
Array[count12 + 3] = count11 + 2;
1668 indices6.
Array[count12 + 4] = count11;
1669 indices6.
Array[count12 + 5] = count11 + 3;
1681 DynamicArray<TerrainVertex> vertices = subsetsByFace[4].
Vertices;
1682 TerrainGeometryDynamicArray<int> indices = subsetsByFace[4].
Indices;
1685 int count = vertices.
Count;
1686 vertices.Count += 4;
1696 ref vertices.
Array[count]
1707 ref vertices.
Array[count + 1]
1718 ref vertices.
Array[count + 2]
1729 ref vertices.
Array[count + 3]
1731 int count2 = indices.
Count;
1733 indices.
Array[count2] = count;
1734 indices.
Array[count2 + 1] = count + 1;
1735 indices.
Array[count2 + 2] = count + 2;
1736 indices.
Array[count2 + 3] = count + 2;
1737 indices.
Array[count2 + 4] = count + 3;
1738 indices.
Array[count2 + 5] = count;
1749 DynamicArray<TerrainVertex> vertices = subset.
Vertices;
1750 TerrainGeometryDynamicArray<int> indices = subset.
Indices;
1751 int count = vertices.
Count;
1752 int cellLightFast =
Terrain.GetCellLightFast(x, y, z);
1758 if (matrix.HasValue) {
1764 (
byte)(color.
R * blockMeshVertex.
Color.
R / 255),
1765 (
byte)(color.
G * blockMeshVertex.
Color.
G / 255),
1766 (
byte)(color.
B * blockMeshVertex.
Color.
B / 255)
1770 float num2 = num / 255f;
1772 (
byte)(color.
R * blockMeshVertex.
Color.
R * num2),
1773 (
byte)(color.
G * blockMeshVertex.
Color.
G * num2),
1774 (
byte)(color.
B * blockMeshVertex.
Color.
B * num2)
1784 ref vertices.
Array[count + i]
1787 if (blockMesh.
Sides !=
null) {
1788 for (
int j = 0; j < 6; j++) {
1790 int cellValueFastChunkExists =
Terrain.GetCellValueFastChunkExists(x + point.
X, y + point.
Y, z + point.
Z);
1794 for (
int k = 0; k < blockMesh.Indices.Count / 3; k++) {
1795 int num3 = blockMesh.Sides ==
null ? -1 : blockMesh.
Sides.
Array[k];
1821 DynamicArray<TerrainVertex> vertices = subset.
Vertices;
1822 TerrainGeometryDynamicArray<int> indices = subset.
Indices;
1823 int count = vertices.
Count;
1828 if (matrix.HasValue) {
1834 (
byte)(color.
R * blockMeshVertex.
Color.
R / 255),
1835 (
byte)(color.
G * blockMeshVertex.
Color.
G / 255),
1836 (
byte)(color.
B * blockMeshVertex.
Color.
B / 255)
1840 int face = facesMap !=
null ? facesMap[blockMeshVertex.
Face] : blockMeshVertex.
Face;
1843 (
byte)(color.
R * blockMeshVertex.
Color.
R * num),
1844 (
byte)(color.
G * blockMeshVertex.
Color.
G * num),
1845 (
byte)(color.
B * blockMeshVertex.
Color.
B * num)
1855 ref vertices.
Array[count + i]
1858 if (blockMesh.
Sides !=
null) {
1859 for (
int j = 0; j < 6; j++) {
1861 int cellValueFastChunkExists =
Terrain.GetCellValueFastChunkExists(x + point.
X, y + point.
Y, z + point.
Z);
1865 for (
int k = 0; k < blockMesh.Indices.Count / 3; k++) {
1866 int num2 = blockMesh.Sides ==
null ? -1 : blockMesh.
Sides.
Array[k];
1887 float centerBoxSize,
1894 int num =
Terrain.ExtractContents(value);
1897 if (color2.HasValue) {
1901 int num2 =
Terrain.ExtractLight(value);
1905 Vector2 v2 =
new(0.9376f, 0.0001f);
1906 Vector2 v3 =
new(0.03125f, 0.00550781237f);
1908 int cellContents =
Terrain.GetCellContents(x - point.
X, y - point.
Y, z - point.
Z);
1909 bool flag = cellContents == 2 || cellContents == 7 || cellContents == 8 || cellContents == 6 || cellContents == 62 || cellContents == 72;
1913 + v4 * centerOffset.
Y;
1927 Color color3 = color;
1929 int cellValue =
Terrain.GetCellValue(
1934 if (
Terrain.ExtractContents(cellValue) == 133) {
1936 if (color4.HasValue) {
1945 float s = centerBoxSize >= 0f ?
MathUtils.
Max(0.03125f, centerBoxSize / 2f) : centerBoxSize / 2f;
1948 tmpConnectionPath.ConnectorFace == tmpConnectionPath.NeighborFace ? num5 + 0.03125f :
1950 Vector3 v5 = v - vector4 * 0.03125f + vector3 * s + vector2;
1951 Vector3 vector5 = v - vector4 * 0.03125f + vector3 * num5;
1952 Vector3 vector6 = v + vector4 * 0.03125f + vector3 * num5;
1953 Vector3 v6 = v + vector4 * 0.03125f + vector3 * s + vector2;
1954 Vector3 vector7 = v + vector * 0.03125f + vector3 * (centerBoxSize / 2f) + vector2;
1955 Vector3 vector8 = v + vector * 0.03125f + vector3 * num6;
1956 if (flag && centerBoxSize == 0f) {
1968 int num7 =
Terrain.ExtractLight(
1976 float num9 = 0.5f * (num3 + num8);
1980 float num13 = num10 * num3;
1981 float num14 = num10 * num9;
1982 float num15 = num11 * num9;
1983 float num16 = num11 * num3;
1984 float num17 = num12 * num3;
1985 float num18 = num12 * num9;
1986 Color color5 =
new((byte)(color3.R * num13), (byte)(color3.G * num13), (byte)(color3.B * num13));
1987 Color color6 =
new((byte)(color3.R * num14), (byte)(color3.G * num14), (byte)(color3.B * num14));
1988 Color color7 =
new((byte)(color3.R * num15), (byte)(color3.G * num15), (byte)(color3.B * num15));
1989 Color color8 =
new((byte)(color3.R * num16), (byte)(color3.G * num16), (byte)(color3.B * num16));
1990 Color color9 =
new((byte)(color3.R * num17), (byte)(color3.G * num17), (byte)(color3.B * num17));
1991 Color color10 =
new((byte)(color3.R * num18), (byte)(color3.G * num18), (byte)(color3.B * num18));
1992 int count = subset.Vertices.Count;
1993 subset.Vertices.Count += 6;
2011 ref array[count + 1]
2020 ref array[count + 2]
2029 ref array[count + 3]
2038 ref array[count + 4]
2047 ref array[count + 5]
2049 int count2 = subset.Indices.Count;
2051 int[] array2 = subset.Indices.Array;
2052 array2[count2] = count;
2053 array2[count2 + 1] = count + 5;
2054 array2[count2 + 2] = count + 1;
2055 array2[count2 + 3] = count + 5;
2056 array2[count2 + 4] = count;
2057 array2[count2 + 5] = count + 4;
2058 array2[count2 + 6] = count + 4;
2059 array2[count2 + 7] = count + 2;
2060 array2[count2 + 8] = count + 5;
2061 array2[count2 + 9] = count + 2;
2062 array2[count2 + 10] = count + 4;
2063 array2[count2 + 11] = count + 3;
2065 array2[count2 + 12] = count + 2;
2066 array2[count2 + 13] = count + 1;
2067 array2[count2 + 14] = count + 5;
2072 if (centerBoxSize != 0f
2073 || (num4 == 0 && num != 133)) {
2076 for (
int i = 0; i < 6; i++) {
2077 if (i != mountingFace
2079 && (num4 & (1 << i)) == 0) {
2082 Vector3 v8 = v - v7 * 0.03125f + vector16 * 0.03125f;
2083 Vector3 v9 = v + v7 * 0.03125f + vector16 * 0.03125f;
2084 Vector3 vector17 = v + vector * 0.03125f;
2089 vector17 += vector18;
2096 Color color11 =
new((byte)(color.R * num19), (byte)(color.G * num19), (byte)(color.B * num19));
2097 Color color12 =
new((byte)(color.R * num20), (byte)(color.G * num20), (byte)(color.B * num20));
2098 int count3 = subset.Vertices.Count;
2099 subset.Vertices.Count += 3;
2117 ref array3[count3 + 1]
2126 ref array3[count3 + 2]
2128 int count4 = subset.Indices.Count;
2129 subset.Indices.Count += 3;
2130 int[] array4 = subset.Indices.Array;
2131 array4[count4] = count3;
2132 array4[count4 + 1] = count3 + 2;
2133 array4[count4 + 2] = count3 + 1;
2139 int num =
Terrain.ExtractContents(value);
2141 light = Math.Max(light,
Terrain.ExtractLight(value));
2144 light = Math.Max(light,
Terrain.ExtractLight(value));
2248 int textureSlotCount,
2251 float y2 = y + height - 1f;
2273 int textureSlotCount,
2276 float y2 = y + height - 1f;
2298 int textureSlotCount,
2301 float y2 = y + height - 1f;
2323 int textureSlotCount,
2326 float y2 = y + height - 1f;
2348 int textureSlotCount,
2351 float y2 = y + height - 1f;
2373 int textureSlotCount,
2376 float y2 = y + height - 1f;
2395 result.X = normal.X == 0f ? (float)(
double)(
MathUtils.
Hash((uint)hashCode) % 255u) / 255f - 0.5f : 0f;
2396 result.Y = normal.Y == 0f ? (float)(
double)(
MathUtils.
Hash((uint)(hashCode + 1)) % 255u) / 255f - 0.5f : 0f;
2397 result.Z = normal.Z == 0f ? (float)(
double)(
MathUtils.
Hash((uint)(hashCode + 2)) % 255u) / 255f - 0.5f : 0f;
2456 float x = position.
X;
2457 float y = position.
Y;
2458 float z = position.
Z;
2460 float num2 = 1f - y;
2461 float num3 = 1f - z;
static int Max(int x1, int x2)
static void SetupLitCornerVertex(float x, float y, float z, Color color, int textureSlot, int corner, ref TerrainVertex vertex)
virtual void SetupCubeVertexFace3(int x, int y, int z, float height, int corner, int textureSlot, int textureSlotCount, Color color, ref TerrainVertex vertex)
static Vector3 GetRandomWireOffset(Vector3 position, Vector3 normal)
DynamicArray< ElectricConnectionPath > m_tmpConnectionPaths
virtual void SetupCubeVertexFace2(int x, int y, int z, float height, int corner, int textureSlot, int textureSlotCount, Color color, ref TerrainVertex vertex)
static void CalculateCubeVertexLight(int value, ref int light, ref int shadow)
virtual void SetupCubeVertexFace4(int x, int y, int z, float height, int corner, int textureSlot, int textureSlotCount, Color color, ref TerrainVertex vertex)
static void SetupVertex(float x, float y, float z, Color color, float tx, float ty, ref TerrainVertex vertex)
virtual int CalculateVertexLightFace1(int x, int y, int z)
virtual int CalculateVertexLightFace0(int x, int y, int z)
virtual void GenerateShadedMeshVertices(Block block, int x, int y, int z, BlockMesh blockMesh, Color color, Matrix? matrix, int[] facesMap, TerrainGeometrySubset subset)
static Vector2[] m_textureCoordinates
virtual void SetupCubeVertexFace5(int x, int y, int z, float height, int corner, int textureSlot, int textureSlotCount, Color color, ref TerrainVertex vertex)
SubsystemPalette SubsystemPalette
virtual void GenerateCrossfaceVertices(Block block, int value, int x, int y, int z, Color color, int textureSlot, TerrainGeometrySubset subset)
virtual void GenerateMeshVertices(Block block, int x, int y, int z, BlockMesh blockMesh, Color color, Matrix? matrix, TerrainGeometrySubset subset)
virtual void CalculateCornerLights(int x, int y, int z)
virtual void GenerateWireVertices(int value, int x, int y, int z, int mountingFace, float centerBoxSize, Vector2 centerOffset, TerrainGeometrySubset subset)
virtual void GenerateCubeVertices(Block block, int value, int x, int y, int z, int rotationX, int rotationY, int rotationZ, Color color, TerrainGeometrySubset[] subsetsByFace)
Point3 m_cornerLightsPosition
virtual void GenerateCubeVertices(Block block, int value, int x, int y, int z, float height11, float height21, float height22, float height12, Color sideColor, Color topColor11, Color topColor21, Color topColor22, Color topColor12, int overrideTopTextureSlot, TerrainGeometrySubset[] subsetsByFace)
virtual float InterpolateCornerLights(int face, Vector3 position)
virtual int CalculateVertexLightFace4(int x, int y, int z)
virtual int CalculateVertexLightFace2(int x, int y, int z)
virtual int CalculateVertexLightFace5(int x, int y, int z)
BlockGeometryGenerator(Terrain terrain, SubsystemTerrain subsystemTerrain, SubsystemElectricity subsystemElectricity, SubsystemFurnitureBlockBehavior subsystemFurnitureBlockBehavior, SubsystemMetersBlockBehavior subsystemMetersBlockBehavior, SubsystemPalette subsystemPalette)
virtual void GenerateCubeVertices(Block block, int value, int x, int y, int z, Color color, TerrainGeometrySubset[] subsetsByFace)
SubsystemMetersBlockBehavior SubsystemMetersBlockBehavior
SubsystemFurnitureBlockBehavior SubsystemFurnitureBlockBehavior
static void SetupCornerVertex(float x, float y, float z, Color color, int light, int face, int textureSlot, int textureSlotCount, int corner, ref TerrainVertex vertex)
virtual int CalculateVertexLightFace3(int x, int y, int z)
SubsystemTerrain SubsystemTerrain
virtual void GenerateFlatVertices(Block block, int value, int x, int y, int z, int rotation, Color color, TerrainGeometrySubset[] subsetsByFace)
virtual void SetupCubeVertexFace0(int x, int y, int z, float height, int corner, int textureSlot, int textureSlotCount, Color color, ref TerrainVertex vertex)
CornerLights[] m_cornerLightsByFace
static void SetupLitCornerVertex(float x, float y, float z, Color color, int textureSlot, int textureSlotCount, int corner, ref TerrainVertex vertex)
virtual void SetupCubeVertexFace1(int x, int y, int z, float height, int corner, int textureSlot, int textureSlotCount, Color color, ref TerrainVertex vertex)
static int CombineLightAndShadow(int light, int shadow)
SubsystemElectricity SubsystemElectricity
virtual int GetTextureSlotCount(int value)
设置材质(正方形)单行格子(分割后每个材质)数,对放置后的方块无效
virtual bool IsFaceTransparent(SubsystemTerrain subsystemTerrain, int face, int value)
virtual int GetShadowStrength(int value)
bool GenerateFacesForSameNeighbors
virtual bool ShouldGenerateFace(SubsystemTerrain subsystemTerrain, int face, int value, int neighborValue, int x, int y, int z)
virtual int GetFaceTextureSlot(int face, int value)
DynamicArray< sbyte > Sides
DynamicArray< BlockMeshVertex > Vertices
DynamicArray< int > Indices
readonly int ConnectorFace
readonly int NeighborOffsetY
readonly int NeighborOffsetZ
readonly int NeighborOffsetX
readonly int NeighborFace
static readonly float[] LightIntensityByLightValue
static float CalculateLighting(Vector3 normal)
static readonly float[] LightIntensityByLightValueAndFace
static int CalculateCellIndex(int x, int y, int z)
virtual int GetCellValueFast(int index)
TerrainGeometryDynamicArray< TerrainVertex > Vertices
TerrainGeometryDynamicArray< int > Indices
static ? int GetColor(int data)
static readonly Color WireColor
ElectricConnectorDirection
static readonly Vector2 Zero
static Vector3 Round(Vector3 v)
static Vector3 Transform(Vector3 v, Matrix m)
static Vector3 Cross(Vector3 v1, Vector3 v2)
static Vector3 Normalize(Vector3 v)
override int GetHashCode()
Vector2 TextureCoordinates
static int OppositeFace(int face)
static Vector3 FaceToVector3(int face)
static Point3 FaceToPoint3(int face)