public Light(Colour32 ambient, Colour32 diffuse, Colour32 specular, double spec_power = 1000.0, v4?direction = null, v4?position = null) : this( direction != null ? LightInfo.Directional(direction.Value, ambient, diffuse, specular, (float)spec_power, 0) : position != null ? LightInfo.Point(position.Value, ambient, diffuse, specular, (float)spec_power, 0) : LightInfo.Ambient(ambient)) { }
public static void Mesh(this LdrBuilder ldr, string name, Colour32 colour, View3d.EGeom geom, IList <View3d.Vertex> verts, IList <ushort>?faces = null, IList <ushort>?lines = null, IList <ushort>?tetra = null, bool generate_normals = false, v4?position = null) { ldr.Append("*Mesh ", name, " ", colour, " {\n"); if ((geom & View3d.EGeom.Vert) != 0) { ldr.Append("*Verts {").Append(verts.Select(x => Ldr.Vec3(x.m_pos))).Append("}\n"); } if ((geom & View3d.EGeom.Norm) != 0) { ldr.Append("*Normals {").Append(verts.Select(x => Ldr.Vec3(x.m_norm))).Append("}\n"); } if ((geom & View3d.EGeom.Colr) != 0) { ldr.Append("*Colours {").Append(verts.Select(x => Ldr.Colour(x.m_col))).Append("}\n"); } if ((geom & View3d.EGeom.Tex0) != 0) { ldr.Append("*TexCoords {").Append(verts.Select(x => Ldr.Vec2(x.m_uv))).Append("}\n"); } if (faces != null) { Debug.Assert(faces.All(i => i >= 0 && i < verts.Count)); ldr.Append("*Faces {").Append(faces).Append("}\n"); } if (lines != null) { Debug.Assert(lines.All(i => i >= 0 && i < verts.Count)); ldr.Append("*Lines {").Append(lines).Append("}\n"); } if (tetra != null) { Debug.Assert(tetra.All(i => i >= 0 && i < verts.Count)); ldr.Append("*Tetra {").Append(tetra).Append("}\n"); } if (generate_normals) { ldr.Append("*GenerateNormals\n"); } if (position != null) { ldr.Append(Ldr.Position(position.Value)); } ldr.Append("}\n"); }
/// <summary> /// Return an HSV colour from a standard ARGB colour. /// 'undef_h' is the value to use for h when it would otherwise be undefined. /// Use previous value in order to preserve it through the singular points.</summary> public static HSV FromColour32(Colour32 rgb, float undef_h = 0f) { return(FromColor(rgb.A, rgb.R, rgb.G, rgb.B, undef_h)); }