diff options
author | Dahlia Trimble | 2008-08-22 07:06:33 +0000 |
---|---|---|
committer | Dahlia Trimble | 2008-08-22 07:06:33 +0000 |
commit | 261876fd47a9a8aca70c2096d9c787c4ff51f8b4 (patch) | |
tree | 73906f5e3eba279617468308c97a2e8a2dc28221 /OpenSim/Region/Physics/Meshing/Meshmerizer.cs | |
parent | Mantis#904. Thank you kindly, Jonc for a patch that solves: (diff) | |
download | opensim-SC-261876fd47a9a8aca70c2096d9c787c4ff51f8b4.zip opensim-SC-261876fd47a9a8aca70c2096d9c787c4ff51f8b4.tar.gz opensim-SC-261876fd47a9a8aca70c2096d9c787c4ff51f8b4.tar.bz2 opensim-SC-261876fd47a9a8aca70c2096d9c787c4ff51f8b4.tar.xz |
Commented out the float array "normals" in the Mesh object and all references to save memory as it was unused
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Physics/Meshing/Meshmerizer.cs | 108 |
1 files changed, 54 insertions, 54 deletions
diff --git a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs index a038dc2..4618539 100644 --- a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs +++ b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs | |||
@@ -1760,66 +1760,66 @@ namespace OpenSim.Region.Physics.Meshing | |||
1760 | return result; | 1760 | return result; |
1761 | } | 1761 | } |
1762 | 1762 | ||
1763 | public static void CalcNormals(Mesh mesh) | 1763 | //public static void CalcNormals(Mesh mesh) |
1764 | { | 1764 | //{ |
1765 | int iTriangles = mesh.triangles.Count; | 1765 | // int iTriangles = mesh.triangles.Count; |
1766 | 1766 | ||
1767 | mesh.normals = new float[iTriangles*3]; | 1767 | // mesh.normals = new float[iTriangles*3]; |
1768 | 1768 | ||
1769 | int i = 0; | 1769 | // int i = 0; |
1770 | foreach (Triangle t in mesh.triangles) | 1770 | // foreach (Triangle t in mesh.triangles) |
1771 | { | 1771 | // { |
1772 | float ux, uy, uz; | 1772 | // float ux, uy, uz; |
1773 | float vx, vy, vz; | 1773 | // float vx, vy, vz; |
1774 | float wx, wy, wz; | 1774 | // float wx, wy, wz; |
1775 | 1775 | ||
1776 | ux = t.v1.X; | 1776 | // ux = t.v1.X; |
1777 | uy = t.v1.Y; | 1777 | // uy = t.v1.Y; |
1778 | uz = t.v1.Z; | 1778 | // uz = t.v1.Z; |
1779 | 1779 | ||
1780 | vx = t.v2.X; | 1780 | // vx = t.v2.X; |
1781 | vy = t.v2.Y; | 1781 | // vy = t.v2.Y; |
1782 | vz = t.v2.Z; | 1782 | // vz = t.v2.Z; |
1783 | 1783 | ||
1784 | wx = t.v3.X; | 1784 | // wx = t.v3.X; |
1785 | wy = t.v3.Y; | 1785 | // wy = t.v3.Y; |
1786 | wz = t.v3.Z; | 1786 | // wz = t.v3.Z; |
1787 | 1787 | ||
1788 | 1788 | ||
1789 | // Vectors for edges | 1789 | // // Vectors for edges |
1790 | float e1x, e1y, e1z; | 1790 | // float e1x, e1y, e1z; |
1791 | float e2x, e2y, e2z; | 1791 | // float e2x, e2y, e2z; |
1792 | 1792 | ||
1793 | e1x = ux - vx; | 1793 | // e1x = ux - vx; |
1794 | e1y = uy - vy; | 1794 | // e1y = uy - vy; |
1795 | e1z = uz - vz; | 1795 | // e1z = uz - vz; |
1796 | 1796 | ||
1797 | e2x = ux - wx; | 1797 | // e2x = ux - wx; |
1798 | e2y = uy - wy; | 1798 | // e2y = uy - wy; |
1799 | e2z = uz - wz; | 1799 | // e2z = uz - wz; |
1800 | 1800 | ||
1801 | 1801 | ||
1802 | // Cross product for normal | 1802 | // // Cross product for normal |
1803 | float nx, ny, nz; | 1803 | // float nx, ny, nz; |
1804 | nx = e1y*e2z - e1z*e2y; | 1804 | // nx = e1y*e2z - e1z*e2y; |
1805 | ny = e1z*e2x - e1x*e2z; | 1805 | // ny = e1z*e2x - e1x*e2z; |
1806 | nz = e1x*e2y - e1y*e2x; | 1806 | // nz = e1x*e2y - e1y*e2x; |
1807 | 1807 | ||
1808 | // Length | 1808 | // // Length |
1809 | float l = (float) Math.Sqrt(nx*nx + ny*ny + nz*nz); | 1809 | // float l = (float) Math.Sqrt(nx*nx + ny*ny + nz*nz); |
1810 | 1810 | ||
1811 | // Normalized "normal" | 1811 | // // Normalized "normal" |
1812 | nx /= l; | 1812 | // nx /= l; |
1813 | ny /= l; | 1813 | // ny /= l; |
1814 | nz /= l; | 1814 | // nz /= l; |
1815 | 1815 | ||
1816 | mesh.normals[i] = nx; | 1816 | // //mesh.normals[i] = nx; |
1817 | mesh.normals[i + 1] = ny; | 1817 | // //mesh.normals[i + 1] = ny; |
1818 | mesh.normals[i + 2] = nz; | 1818 | // //mesh.normals[i + 2] = nz; |
1819 | 1819 | ||
1820 | i += 3; | 1820 | // i += 3; |
1821 | } | 1821 | // } |
1822 | } | 1822 | //} |
1823 | 1823 | ||
1824 | public static Vertex midUnitRadialPoint(Vertex a, Vertex b, float radius) | 1824 | public static Vertex midUnitRadialPoint(Vertex a, Vertex b, float radius) |
1825 | { | 1825 | { |
@@ -1878,21 +1878,21 @@ namespace OpenSim.Region.Physics.Meshing | |||
1878 | 1878 | ||
1879 | SculptMesh smesh = CreateSculptMesh(primName, primShape, size, lod); | 1879 | SculptMesh smesh = CreateSculptMesh(primName, primShape, size, lod); |
1880 | mesh = (Mesh)smesh; | 1880 | mesh = (Mesh)smesh; |
1881 | CalcNormals(mesh); | 1881 | //CalcNormals(mesh); |
1882 | } | 1882 | } |
1883 | else if ((primShape.ProfileCurve & 0x07) == (byte)ProfileShape.Square) | 1883 | else if ((primShape.ProfileCurve & 0x07) == (byte)ProfileShape.Square) |
1884 | { | 1884 | { |
1885 | if (primShape.PathCurve == (byte)Extrusion.Straight) | 1885 | if (primShape.PathCurve == (byte)Extrusion.Straight) |
1886 | { // its a box | 1886 | { // its a box |
1887 | mesh = CreateBoxMesh(primName, primShape, size); | 1887 | mesh = CreateBoxMesh(primName, primShape, size); |
1888 | CalcNormals(mesh); | 1888 | //CalcNormals(mesh); |
1889 | } | 1889 | } |
1890 | else if (primShape.PathCurve == (byte)Extrusion.Curve1) | 1890 | else if (primShape.PathCurve == (byte)Extrusion.Curve1) |
1891 | { // tube | 1891 | { // tube |
1892 | // do a cylinder for now | 1892 | // do a cylinder for now |
1893 | //mesh = CreateCylinderMesh(primName, primShape, size); | 1893 | //mesh = CreateCylinderMesh(primName, primShape, size); |
1894 | mesh = CreateCircularPathMesh(primName, primShape, size); | 1894 | mesh = CreateCircularPathMesh(primName, primShape, size); |
1895 | CalcNormals(mesh); | 1895 | //CalcNormals(mesh); |
1896 | } | 1896 | } |
1897 | } | 1897 | } |
1898 | else if ((primShape.ProfileCurve & 0x07) == (byte)ProfileShape.Circle) | 1898 | else if ((primShape.ProfileCurve & 0x07) == (byte)ProfileShape.Circle) |
@@ -1900,14 +1900,14 @@ namespace OpenSim.Region.Physics.Meshing | |||
1900 | if (primShape.PathCurve == (byte)Extrusion.Straight) | 1900 | if (primShape.PathCurve == (byte)Extrusion.Straight) |
1901 | { | 1901 | { |
1902 | mesh = CreateCylinderMesh(primName, primShape, size); | 1902 | mesh = CreateCylinderMesh(primName, primShape, size); |
1903 | CalcNormals(mesh); | 1903 | //CalcNormals(mesh); |
1904 | } | 1904 | } |
1905 | 1905 | ||
1906 | // ProfileCurve seems to combine hole shape and profile curve so we need to only compare against the lower 3 bits | 1906 | // ProfileCurve seems to combine hole shape and profile curve so we need to only compare against the lower 3 bits |
1907 | else if (primShape.PathCurve == (byte) Extrusion.Curve1) | 1907 | else if (primShape.PathCurve == (byte) Extrusion.Curve1) |
1908 | { // dahlia's favorite, a torus :) | 1908 | { // dahlia's favorite, a torus :) |
1909 | mesh = CreateCircularPathMesh(primName, primShape, size); | 1909 | mesh = CreateCircularPathMesh(primName, primShape, size); |
1910 | CalcNormals(mesh); | 1910 | //CalcNormals(mesh); |
1911 | } | 1911 | } |
1912 | } | 1912 | } |
1913 | else if ((primShape.ProfileCurve & 0x07) == (byte)ProfileShape.HalfCircle) | 1913 | else if ((primShape.ProfileCurve & 0x07) == (byte)ProfileShape.HalfCircle) |
@@ -1916,7 +1916,7 @@ namespace OpenSim.Region.Physics.Meshing | |||
1916 | { | 1916 | { |
1917 | //mesh = CreateSphereMesh(primName, primShape, size); | 1917 | //mesh = CreateSphereMesh(primName, primShape, size); |
1918 | mesh = CreateCircularPathMesh(primName, primShape, size); | 1918 | mesh = CreateCircularPathMesh(primName, primShape, size); |
1919 | CalcNormals(mesh); | 1919 | //CalcNormals(mesh); |
1920 | } | 1920 | } |
1921 | } | 1921 | } |
1922 | else if ((primShape.ProfileCurve & 0x07) == (byte)ProfileShape.EquilateralTriangle) | 1922 | else if ((primShape.ProfileCurve & 0x07) == (byte)ProfileShape.EquilateralTriangle) |
@@ -1924,19 +1924,19 @@ namespace OpenSim.Region.Physics.Meshing | |||
1924 | if (primShape.PathCurve == (byte)Extrusion.Straight) | 1924 | if (primShape.PathCurve == (byte)Extrusion.Straight) |
1925 | { | 1925 | { |
1926 | mesh = CreatePrismMesh(primName, primShape, size); | 1926 | mesh = CreatePrismMesh(primName, primShape, size); |
1927 | CalcNormals(mesh); | 1927 | //CalcNormals(mesh); |
1928 | } | 1928 | } |
1929 | else if (primShape.PathCurve == (byte) Extrusion.Curve1) | 1929 | else if (primShape.PathCurve == (byte) Extrusion.Curve1) |
1930 | { // a ring - do a cylinder for now | 1930 | { // a ring - do a cylinder for now |
1931 | //mesh = CreateCylinderMesh(primName, primShape, size); | 1931 | //mesh = CreateCylinderMesh(primName, primShape, size); |
1932 | mesh = CreateCircularPathMesh(primName, primShape, size); | 1932 | mesh = CreateCircularPathMesh(primName, primShape, size); |
1933 | CalcNormals(mesh); | 1933 | //CalcNormals(mesh); |
1934 | } | 1934 | } |
1935 | } | 1935 | } |
1936 | else // just do a box | 1936 | else // just do a box |
1937 | { | 1937 | { |
1938 | mesh = CreateBoxMesh(primName, primShape, size); | 1938 | mesh = CreateBoxMesh(primName, primShape, size); |
1939 | CalcNormals(mesh); | 1939 | //CalcNormals(mesh); |
1940 | } | 1940 | } |
1941 | 1941 | ||
1942 | if (mesh != null) | 1942 | if (mesh != null) |