Skip to content

Commit 7344aa7

Browse files
committed
include our own fork of Dalhia's PrimMesher
1 parent 2045c6a commit 7344aa7

13 files changed

Lines changed: 3853 additions & 6 deletions

File tree

OpenMetaverse.Rendering.Meshmerizer/MeshmerizerR.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@
3333

3434
using System;
3535
using System.Collections.Generic;
36-
using System.Drawing;
37-
using System.Text;
3836
using OMV = OpenMetaverse;
3937
using OMVR = OpenMetaverse.Rendering;
4038

OpenMetaverse.StructuredData/StructuredData.cs

Lines changed: 216 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1755,6 +1755,222 @@ public bool TryGetValue(string key, out OSD llsd)
17551755
return dicvalue.TryGetValue(key, out llsd);
17561756
}
17571757

1758+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
1759+
public bool TryGetOSDMap(string key, out OSDMap ossd)
1760+
{
1761+
if (dicvalue.TryGetValue(key, out OSD tmp) && tmp is OSDMap map)
1762+
{
1763+
ossd = map;
1764+
return true;
1765+
}
1766+
ossd = null;
1767+
return false;
1768+
}
1769+
1770+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
1771+
public bool TryGetOSDArray(string key, out OSDArray ossd)
1772+
{
1773+
if (dicvalue.TryGetValue(key, out OSD tmp) && tmp is OSDArray arr)
1774+
{
1775+
ossd = arr;
1776+
return true;
1777+
}
1778+
ossd = null;
1779+
return false;
1780+
}
1781+
1782+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
1783+
public bool TryGetBool(string key, out bool ossd)
1784+
{
1785+
if (dicvalue.TryGetValue(key, out OSD tmp))
1786+
{
1787+
ossd = tmp.AsBoolean();
1788+
return true;
1789+
}
1790+
ossd = false;
1791+
return false;
1792+
}
1793+
1794+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
1795+
public bool TryGetInt(string key, out int ossd)
1796+
{
1797+
if (dicvalue.TryGetValue(key, out OSD tmp))
1798+
{
1799+
ossd = tmp.AsInteger();
1800+
return true;
1801+
}
1802+
ossd = 0;
1803+
return false;
1804+
}
1805+
1806+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
1807+
public bool TryGetLong(string key, out long ossd)
1808+
{
1809+
if (dicvalue.TryGetValue(key, out OSD tmp))
1810+
{
1811+
ossd = tmp.AsLong();
1812+
return true;
1813+
}
1814+
ossd = 0;
1815+
return false;
1816+
}
1817+
1818+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
1819+
public bool TryGetFloat(string key, out float ossd)
1820+
{
1821+
if (dicvalue.TryGetValue(key, out OSD tmp))
1822+
{
1823+
ossd = (float)tmp.AsReal();
1824+
return true;
1825+
}
1826+
ossd = 0f;
1827+
return false;
1828+
}
1829+
1830+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
1831+
public bool TryGetDouble(string key, out double ossd)
1832+
{
1833+
if (dicvalue.TryGetValue(key, out OSD tmp))
1834+
{
1835+
ossd = tmp.AsReal();
1836+
return true;
1837+
}
1838+
ossd = 0.0;
1839+
return false;
1840+
}
1841+
1842+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
1843+
public bool TryGetString(string key, out string ossd)
1844+
{
1845+
if (dicvalue.TryGetValue(key, out OSD tmp))
1846+
{
1847+
ossd = tmp.AsString();
1848+
return true;
1849+
}
1850+
ossd = string.Empty;
1851+
return false;
1852+
}
1853+
1854+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
1855+
public bool TryGetUUID(string key, out UUID ossd)
1856+
{
1857+
if (dicvalue.TryGetValue(key, out OSD tmp))
1858+
{
1859+
ossd = tmp.AsUUID();
1860+
return true;
1861+
}
1862+
ossd = UUID.Zero;
1863+
return false;
1864+
}
1865+
1866+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
1867+
public bool TryGetDate(string key, out DateTime ossd)
1868+
{
1869+
if (dicvalue.TryGetValue(key, out OSD tmp))
1870+
{
1871+
ossd = tmp.AsDate();
1872+
return true;
1873+
}
1874+
ossd = Utils.Epoch;
1875+
return false;
1876+
}
1877+
1878+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
1879+
public bool TryGetUri(string key, out Uri ossd)
1880+
{
1881+
if (dicvalue.TryGetValue(key, out OSD tmp))
1882+
{
1883+
ossd = tmp.AsUri();
1884+
return true;
1885+
}
1886+
ossd = null;
1887+
return false;
1888+
}
1889+
1890+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
1891+
public bool TryGetBinary(string key, out byte[] ossd)
1892+
{
1893+
if (dicvalue.TryGetValue(key, out OSD tmp))
1894+
{
1895+
ossd = tmp.AsBinary();
1896+
return true;
1897+
}
1898+
ossd = null;
1899+
return false;
1900+
}
1901+
1902+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
1903+
public bool TryGetVector2(string key, out Vector2 ossd)
1904+
{
1905+
if (dicvalue.TryGetValue(key, out OSD tmp))
1906+
{
1907+
ossd = tmp.AsVector2();
1908+
return true;
1909+
}
1910+
ossd = Vector2.Zero;
1911+
return false;
1912+
}
1913+
1914+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
1915+
public bool TryGetVector3(string key, out Vector3 ossd)
1916+
{
1917+
if (dicvalue.TryGetValue(key, out OSD tmp))
1918+
{
1919+
ossd = tmp.AsVector3();
1920+
return true;
1921+
}
1922+
ossd = Vector3.Zero;
1923+
return false;
1924+
}
1925+
1926+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
1927+
public bool TryGetVector3d(string key, out Vector3d ossd)
1928+
{
1929+
if (dicvalue.TryGetValue(key, out OSD tmp))
1930+
{
1931+
ossd = tmp.AsVector3d();
1932+
return true;
1933+
}
1934+
ossd = Vector3d.Zero;
1935+
return false;
1936+
}
1937+
1938+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
1939+
public bool TryGetVector4(string key, out Vector4 ossd)
1940+
{
1941+
if (dicvalue.TryGetValue(key, out OSD tmp))
1942+
{
1943+
ossd = tmp.AsVector4();
1944+
return true;
1945+
}
1946+
ossd = Vector4.Zero;
1947+
return false;
1948+
}
1949+
1950+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
1951+
public bool TryGetQuat(string key, out Quaternion ossd)
1952+
{
1953+
if (dicvalue.TryGetValue(key, out OSD tmp))
1954+
{
1955+
ossd = tmp.AsQuaternion();
1956+
return true;
1957+
}
1958+
ossd = Quaternion.Identity;
1959+
return false;
1960+
}
1961+
1962+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
1963+
public bool TryGetColor4(string key, out Color4 ossd)
1964+
{
1965+
if (dicvalue.TryGetValue(key, out OSD tmp))
1966+
{
1967+
ossd = tmp.AsColor4();
1968+
return true;
1969+
}
1970+
ossd = Color4.Black;
1971+
return false;
1972+
}
1973+
17581974
[MethodImpl(MethodImplOptions.AggressiveInlining)]
17591975
public override void Clear()
17601976
{

OpenMetaverse/Assets/AssetTypes/AssetMesh.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,9 @@ public override bool Decode()
6969
{
7070
try
7171
{
72-
MeshData = new OSDMap();
72+
MeshData = [];
7373

74-
using (MemoryStream data = new MemoryStream(AssetData))
74+
using (MemoryStream data = new(AssetData))
7575
{
7676
OSDMap header = (OSDMap)OSDParser.DeserializeLLSDBinary(data);
7777
MeshData["asset_header"] = header;

PrimMesher/CONTRIBUTORS.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Original primary developer of PrimMesher is Dahlia Trimble. https://github.com/dahliaT/PrimMesher
2+
3+
Additional contributors (in no particular order):
4+
Morgaine Dinova
5+
Latif Kalifa (lkalif)
6+
7+
Some portions of PrimMesher are from the following projects:
8+
* OpenSimulator (original extrusion concept)
9+
* LibOpenMetaverse (quaternion multiplication routine)

0 commit comments

Comments
 (0)