コード例 #1
0
 public static Quat Slerp(Quat a, Quat b, float slerp) => NativeAPI.quat_slerp(a, b, slerp);
コード例 #2
0
ファイル: Color.cs プロジェクト: gongminmin/StereoKit
 /// <summary>Creates an RGB color from a CIE-L*ab color space. CIE-L*ab is a color space that models
 /// human perception, and has significantly more accurate to perception lightness values, so this is
 /// an excellent color space for color operations that wish to preserve color brightness properly.
 /// Traditionally, values are L [0,100], a,b [-200,+200] but here we normalize them all to the 0-1
 /// range. If you hate it, let me know why!</summary>
 /// <param name="l">Lightness of the color! Range is 0-1.</param>
 /// <param name="a">'a' is from red to green. Range is 0-1.</param>
 /// <param name="b">'b' is from blue to yellow. Range is 0-1.</param>
 /// <param name="opacity">The opacity copied into the final color!</param>
 /// <returns>An RGBA color constructed from the LAB values.</returns>
 public static Color LAB(float l, float a, float b, float opacity = 1)
 => NativeAPI.color_lab(l, a, b, opacity);
コード例 #3
0
ファイル: Color.cs プロジェクト: gongminmin/StereoKit
 /// <summary>Converts the RGB color to a CIE LAB color space value! Conversion back and forth
 /// from LAB space could be somewhat lossy.</summary>
 /// <returns>An LAB vector where x=L, y=A, z=B.</returns>
 public Vec3 ToLAB()
 => NativeAPI.color_to_lab(this);
コード例 #4
0
 /// <summary>Creates a material from a shader, and uses the shader's default settings. Uses an auto-generated id.</summary>
 /// <param name="shader">Any valid shader.</param>
 public Material(Shader shader)
 {
     _inst = NativeAPI.material_create(shader == null ? IntPtr.Zero : shader._inst);
 }
コード例 #5
0
 /// <summary>Creates a new Material asset with the same shader and properties! Draw calls with
 /// the new Material will not batch together with this one.</summary>
 /// <returns>A new Material asset with the same shader and properties.</returns>
 public Material Copy()
 {
     return(new Material(NativeAPI.material_copy(_inst)));
 }
コード例 #6
0
 /// <summary>Sets a shader parameter with the given name to the provided value. If no parameter
 /// is found, nothing happens, and the value is not set!</summary>
 /// <param name="name">Name of the shader parameter.</param>
 /// <param name="value">New value for the parameter.</param>
 public void SetMatrix(string name, Matrix value)
 {
     NativeAPI.material_set_matrix(_inst, name, value);
 }
コード例 #7
0
        /// <summary>Looks for a Material asset that's already loaded, matching the given id!</summary>
        /// <param name="materialId">Which Material are you looking for?</param>
        /// <returns>A link to the Material matching 'id', null if none is found.</returns>
        public static Material Find(string materialId)
        {
            IntPtr material = NativeAPI.material_find(materialId);

            return(material == IntPtr.Zero ? null : new Material(material));
        }
コード例 #8
0
 public static Quat LookAt(Vec3 from, Vec3 to) => NativeAPI.quat_lookat(from, to);
コード例 #9
0
 public static Quat LookAt(Vec3 from, Vec3 to, Vec3 up) => NativeAPI.quat_lookat_up(from, to, up);
コード例 #10
0
 public static Quat operator *(Quat a, Quat b) => NativeAPI.quat_mul(a, b);
コード例 #11
0
 public static Vec3 operator *(Quat a, Vec3 pt) => NativeAPI.quat_mul_vec(a, pt);
コード例 #12
0
 public static Quat operator -(Quat a, Quat b) => NativeAPI.quat_difference(a, b);
コード例 #13
0
 public Quat Inverse()
 => NativeAPI.quat_inverse(this);
コード例 #14
0
 public void Normalize()
 => NativeAPI.quat_normalize(this);
コード例 #15
0
 /// <summary>Sets a shader parameter with the given name to the provided value. If no parameter
 /// is found, nothing happens, and the value is not set!</summary>
 /// <param name="name">Name of the shader parameter.</param>
 /// <param name="value">New value for the parameter.</param>
 public void SetColor(string name, Color value)
 {
     NativeAPI.material_set_color(_inst, name, value);
 }
コード例 #16
0
 public static Quat LookDir(Vec3 direction) => NativeAPI.quat_lookat(Vec3.Zero, direction);
コード例 #17
0
 /// <summary>Sets a shader parameter with the given name to the provided value. If no parameter
 /// is found, nothing happens, and the value is not set!</summary>
 /// <param name="name">Name of the shader parameter.</param>
 /// <param name="value">New value for the parameter.</param>
 public void SetVector(string name, Vec4 value)
 {
     NativeAPI.material_set_vector(_inst, name, value);
 }
コード例 #18
0
 public static Quat LookDir(float x, float y, float z) => NativeAPI.quat_lookat(Vec3.Zero, new Vec3(x, y, z));
コード例 #19
0
 /// <summary>Sets a shader parameter with the given name to the provided value. If no parameter
 /// is found, nothing happens, and the value is not set!</summary>
 /// <param name="name">Name of the shader parameter.</param>
 /// <param name="value">New value for the parameter.</param>
 public void SetTexture(string name, Tex value)
 {
     NativeAPI.material_set_texture(_inst, name, value._inst);
 }
コード例 #20
0
ファイル: Bounds.cs プロジェクト: Garciaj007/StereoKit
 public bool Intersect(Ray ray, out Vec3 at)
 => NativeAPI.bounds_ray_intersect(this, ray, out at);
コード例 #21
0
        /// <summary>Creates a new Material asset with the same shader and properties! Draw calls with
        /// the new Material will not batch togethre with the source Material.</summary>
        /// /// <param name="materialId">Which Material are you looking for?</param>
        /// <returns>A new Material asset with the same shader and properties. Returns null if no
        /// materials are found with the given id.</returns>
        public static Material Copy(string materialId)
        {
            IntPtr inst = NativeAPI.material_copy_id(materialId);

            return(inst == IntPtr.Zero ? null : new Material(inst));
        }
コード例 #22
0
ファイル: Bounds.cs プロジェクト: Garciaj007/StereoKit
 public bool Contains(Vec3 pt)
 => NativeAPI.bounds_point_contains(this, pt);
コード例 #23
0
 /// <summary>Creates a material from a shader, and uses the shader's default settings.</summary>
 /// <param name="id">Set the material's id to this.</param>
 /// <param name="shader">Any valid shader.</param>
 public Material(string id, Shader shader)
 {
     _inst = NativeAPI.material_create(shader == null ? IntPtr.Zero : shader._inst);
     NativeAPI.material_set_id(_inst, id);
 }
コード例 #24
0
ファイル: Bounds.cs プロジェクト: Garciaj007/StereoKit
 public bool Contains(Vec3 linePt1, Vec3 linePt2)
 => NativeAPI.bounds_line_contains(this, linePt1, linePt2);
コード例 #25
0
ファイル: Color.cs プロジェクト: gongminmin/StereoKit
 /// <summary>Creates a Red/Green/Blue color from Hue/Saturation/Value information.</summary>
 /// <param name="hsvColor">For convenience, XYZ is HSV.
 /// Hue most directly relates to the color as we think of it! 0 is red, 0.1667 is yellow,
 /// 0.3333 is green, 0.5 is cyan, 0.6667 is blue, 0.8333 is magenta, and 1
 /// is red again!
 /// Saturation is the vibrancy of the color, where 0 is straight up a shade of gray,
 /// and 1 is 'poke you in the eye colorful'.
 /// Value is the brightness of the color! 0 is always black.</param>
 /// <param name="opacity">Also known as alpha! This is does not affect the rgb components of the
 /// resulting color, it'll just get slotted into the colors opacity value.</param>
 /// <returns>An RGB color!</returns>
 public static Color HSV(Vec3 hsvColor, float opacity = 1)
 => NativeAPI.color_hsv(hsvColor.x, hsvColor.y, hsvColor.z, opacity);
コード例 #26
0
 /// <summary>Sets a shader parameter with the given name to the provided value. If no parameter
 /// is found, nothing happens, and the value is not set!</summary>
 /// <param name="name">Name of the shader parameter.</param>
 /// <param name="value">New value for the parameter.</param>
 public void SetFloat(string name, float value)
 {
     NativeAPI.material_set_float(_inst, name, value);
 }
コード例 #27
0
ファイル: Color.cs プロジェクト: gongminmin/StereoKit
 /// <summary>Converts the color to a Hue/Saturation/Value format! Does not consider
 /// transparency when calculating the result.</summary>
 /// <returns>Hue, Saturation, and Value, stored in x, y, and z respectively. All
 /// values are between 0-1.</returns>
 public Vec3 ToHSV()
 => NativeAPI.color_to_hsv(this);
コード例 #28
0
 /// <summary>Sets a shader parameter with the given name to the provided value. If no parameter
 /// is found, nothing happens, and the value is not set!</summary>
 /// <param name="name">Name of the shader parameter.</param>
 /// <param name="value">New value for the parameter.</param>
 public void SetColor(string name, Color32 value)
 {
     NativeAPI.material_set_color(_inst, name, new Color(value.r / 255f, value.g / 255f, value.b / 255f, value.a / 255f));
 }
コード例 #29
0
ファイル: Color.cs プロジェクト: gongminmin/StereoKit
 /// <summary>Creates a Red/Green/Blue color from Hue/Saturation/Value information.</summary>
 /// <param name="hue">Hue most directly relates to the color as we think of it! 0 is red,
 /// 0.1667 is yellow, 0.3333 is green, 0.5 is cyan, 0.6667 is blue, 0.8333 is magenta, and 1
 /// is red again!</param>
 /// <param name="saturation">The vibrancy of the color, where 0 is straight up a shade of gray,
 /// and 1 is 'poke you in the eye colorful'.</param>
 /// <param name="value">The brightness of the color! 0 is always black.</param>
 /// <param name="opacity">Also known as alpha! This is does not affect the rgb components of the
 /// resulting color, it'll just get slotted into the colors opacity value.</param>
 /// <returns>An RGB color!</returns>
 public static Color HSV(float hue, float saturation, float value, float opacity = 1)
 => NativeAPI.color_hsv(hue, saturation, value, opacity);
コード例 #30
0
 public static Quat FromAngles(float pitchXDeg, float yawYDeg, float rollZDeg) => NativeAPI.quat_from_angles(pitchXDeg, yawYDeg, rollZDeg);