public void RenderMaterial_ToFromOSDPreservesValues() { RenderMaterial mat = new RenderMaterial(); mat.NormalID = UUID.Random(); mat.NormalOffsetX = 2.0f; mat.NormalOffsetY = 2.0f; mat.NormalRepeatX = 2.0f; mat.NormalRepeatY = 2.0f; mat.NormalRotation = 180.0f; mat.SpecularID = UUID.Random(); mat.SpecularOffsetX = 2.0f; mat.SpecularOffsetY = 2.0f; mat.SpecularRepeatX = 2.0f; mat.SpecularRepeatY = 2.0f; mat.SpecularRotation = 180.0f; mat.SpecularLightColorR = 127; mat.SpecularLightColorG = 127; mat.SpecularLightColorB = 127; mat.SpecularLightColorA = 255; mat.SpecularLightExponent = 2; mat.EnvironmentIntensity = 2; mat.DiffuseAlphaMode = (byte)RenderMaterial.eDiffuseAlphaMode.DIFFUSE_ALPHA_MODE_MASK; mat.AlphaMaskCutoff = 2; OSD map = mat.GetOSD(); RenderMaterial newmat = RenderMaterial.FromOSD(map); Assert.That(newmat, Is.EqualTo(mat)); }
public void RenderMaterial_OSDFromToTest() { RenderMaterial mat = new RenderMaterial(UUID.Zero, UUID.Zero); OSD map = mat.GetOSD(); RenderMaterial matFromOSD = RenderMaterial.FromOSD(map); Assert.That(mat, Is.EqualTo(matFromOSD)); Assert.That(matFromOSD.NormalID, Is.EqualTo(UUID.Zero)); Assert.That(matFromOSD.NormalOffsetX, Is.EqualTo(0.0f)); Assert.That(matFromOSD.NormalOffsetY, Is.EqualTo(0.0f)); Assert.That(matFromOSD.NormalRepeatX, Is.EqualTo(1.0f)); Assert.That(matFromOSD.NormalRepeatY, Is.EqualTo(1.0f)); Assert.That(matFromOSD.NormalRotation, Is.EqualTo(0.0f)); Assert.That(matFromOSD.SpecularID, Is.EqualTo(UUID.Zero)); Assert.That(matFromOSD.SpecularOffsetX, Is.EqualTo(0.0f)); Assert.That(matFromOSD.SpecularOffsetY, Is.EqualTo(0.0f)); Assert.That(matFromOSD.SpecularRepeatX, Is.EqualTo(1.0f)); Assert.That(matFromOSD.SpecularRepeatY, Is.EqualTo(1.0f)); Assert.That(matFromOSD.SpecularRotation, Is.EqualTo(0.0f)); Assert.That(matFromOSD.SpecularLightColorR, Is.EqualTo(255)); Assert.That(matFromOSD.SpecularLightColorG, Is.EqualTo(255)); Assert.That(matFromOSD.SpecularLightColorB, Is.EqualTo(255)); Assert.That(matFromOSD.SpecularLightColorA, Is.EqualTo(255)); Assert.That(matFromOSD.SpecularLightExponent, Is.EqualTo(RenderMaterial.DEFAULT_SPECULAR_LIGHT_EXPONENT)); Assert.That(matFromOSD.EnvironmentIntensity, Is.EqualTo(RenderMaterial.DEFAULT_ENV_INTENSITY)); Assert.That(matFromOSD.DiffuseAlphaMode, Is.EqualTo((byte)RenderMaterial.eDiffuseAlphaMode.DIFFUSE_ALPHA_MODE_BLEND)); Assert.That(matFromOSD.AlphaMaskCutoff, Is.EqualTo(0)); }