private void InitSkinInfo(Assimp.Mesh mesh, AssimpSceneContainer container) { var boneIDs = new uvec4[mesh.VertexCount]; var boneWeights = new vec4[mesh.VertexCount]; AllBoneInfos allBones = container.GetAllBoneInfos(); Dictionary <string, uint> nameIndexDict = allBones.nameIndexDict; for (int i = 0; i < mesh.BoneCount; i++) { Assimp.Bone bone = mesh.Bones[i]; // bones that influence this mesh. uint boneIndex = nameIndexDict[bone.Name]; for (int j = 0; j < bone.VertexWeightCount; j++) { Assimp.VertexWeight vertexWeight = bone.VertexWeights[j]; uint vertexID = vertexWeight.VertexID; for (int t = 0; t < 4; t++) { if (boneWeights[vertexID][t] == 0.0f) // fill in x y z w. { boneIDs[vertexID][t] = boneIndex; boneWeights[vertexID][t] = vertexWeight.Weight; break; } } } } this.boneIDs = boneIDs; this.boneWeights = boneWeights; }
public void PropertyValues() { var v = new uvec4(8u, 5u, 6u, 5u); var vals = v.Values; Assert.AreEqual(8u, vals[0]); Assert.AreEqual(5u, vals[1]); Assert.AreEqual(6u, vals[2]); Assert.AreEqual(5u, vals[3]); Assert.That(vals.SequenceEqual(v.ToArray())); }
public void SerializationJson() { var v0 = new uvec4(8u, 7u, 0u, 6u); var s0 = JsonConvert.SerializeObject(v0); var v1 = JsonConvert.DeserializeObject <uvec4>(s0); var s1 = JsonConvert.SerializeObject(v1); Assert.AreEqual(v0, v1); Assert.AreEqual(s0, s1); }
/// <summary> /// Constructs this matrix from a series of column vectors. Non-overwritten fields are from an Identity matrix. /// </summary> public umat2x4(uvec4 c0, uvec4 c1) { this.m00 = c0.x; this.m01 = c0.y; this.m02 = c0.z; this.m03 = c0.w; this.m10 = c1.x; this.m11 = c1.y; this.m12 = c1.z; this.m13 = c1.w; }
public void InvariantCommutative() { { var v0 = new uvec4(2u, 3u, 8u, 6u); var v1 = new uvec4(2u, 0u, 3u, 5u); Assert.AreEqual(v0 * v1, v1 * v0); } { var v0 = new uvec4(0u, 5u, 5u, 5u); var v1 = new uvec4(9u, 6u, 1u, 0u); Assert.AreEqual(v0 * v1, v1 * v0); } { var v0 = new uvec4(7u, 4u, 1u, 1u); var v1 = new uvec4(7u, 4u, 0u, 7u); Assert.AreEqual(v0 * v1, v1 * v0); } { var v0 = new uvec4(6u, 1u, 0u, 6u); var v1 = new uvec4(7u, 6u, 2u, 6u); Assert.AreEqual(v0 * v1, v1 * v0); } { var v0 = new uvec4(1u, 9u, 9u, 9u); var v1 = new uvec4(8u, 0u, 8u, 3u); Assert.AreEqual(v0 * v1, v1 * v0); } { var v0 = new uvec4(9u, 4u, 4u, 0u); var v1 = new uvec4(4u, 2u, 5u, 6u); Assert.AreEqual(v0 * v1, v1 * v0); } { var v0 = new uvec4(9u, 4u, 8u, 2u); var v1 = new uvec4(4u, 6u, 9u, 7u); Assert.AreEqual(v0 * v1, v1 * v0); } { var v0 = new uvec4(3u, 1u, 0u, 1u); var v1 = new uvec4(9u, 6u, 7u, 3u); Assert.AreEqual(v0 * v1, v1 * v0); } { var v0 = new uvec4(2u, 9u, 3u, 0u); var v1 = new uvec4(6u, 2u, 1u, 6u); Assert.AreEqual(v0 * v1, v1 * v0); } { var v0 = new uvec4(5u, 7u, 1u, 3u); var v1 = new uvec4(0u, 9u, 2u, 3u); Assert.AreEqual(v0 * v1, v1 * v0); } }
public void TriangleInequality() { { var v0 = new uvec4(0u, 6u, 5u, 2u); var v1 = new uvec4(0u, 8u, 8u, 0u); Assert.GreaterOrEqual(v0.NormMax + v1.NormMax, (v0 + v1).NormMax); } { var v0 = new uvec4(6u, 8u, 8u, 9u); var v1 = new uvec4(7u, 3u, 6u, 7u); Assert.GreaterOrEqual(v0.NormMax + v1.NormMax, (v0 + v1).NormMax); } { var v0 = new uvec4(4u, 7u, 7u, 2u); var v1 = new uvec4(0u, 8u, 7u, 3u); Assert.GreaterOrEqual(v0.NormMax + v1.NormMax, (v0 + v1).NormMax); } { var v0 = new uvec4(6u, 8u, 9u, 9u); var v1 = new uvec4(3u, 2u, 9u, 2u); Assert.GreaterOrEqual(v0.NormMax + v1.NormMax, (v0 + v1).NormMax); } { var v0 = new uvec4(9u, 2u, 0u, 4u); var v1 = new uvec4(9u, 5u, 5u, 8u); Assert.GreaterOrEqual(v0.NormMax + v1.NormMax, (v0 + v1).NormMax); } { var v0 = new uvec4(1u, 0u, 5u, 6u); var v1 = new uvec4(9u, 4u, 1u, 4u); Assert.GreaterOrEqual(v0.NormMax + v1.NormMax, (v0 + v1).NormMax); } { var v0 = new uvec4(3u, 8u, 1u, 1u); var v1 = new uvec4(2u, 2u, 4u, 1u); Assert.GreaterOrEqual(v0.NormMax + v1.NormMax, (v0 + v1).NormMax); } { var v0 = new uvec4(9u, 1u, 5u, 2u); var v1 = new uvec4(9u, 9u, 6u, 4u); Assert.GreaterOrEqual(v0.NormMax + v1.NormMax, (v0 + v1).NormMax); } { var v0 = new uvec4(9u, 6u, 0u, 4u); var v1 = new uvec4(3u, 1u, 7u, 9u); Assert.GreaterOrEqual(v0.NormMax + v1.NormMax, (v0 + v1).NormMax); } { var v0 = new uvec4(1u, 8u, 1u, 9u); var v1 = new uvec4(3u, 1u, 4u, 1u); Assert.GreaterOrEqual(v0.NormMax + v1.NormMax, (v0 + v1).NormMax); } }
public void Operators() { var v1 = new uvec4(0u, 2u, 9u, 5u); var v2 = new uvec4(0u, 2u, 9u, 5u); var v3 = new uvec4(5u, 9u, 2u, 0u); Assert.That(v1 == new uvec4(v1)); Assert.That(v2 == new uvec4(v2)); Assert.That(v3 == new uvec4(v3)); Assert.That(v1 == v2); Assert.That(v1 != v3); Assert.That(v2 != v3); }
public void StringInterop() { var v = new uvec4(7u, 7u, 0u, 9u); var s0 = v.ToString(); var s1 = v.ToString("#"); var v0 = uvec4.Parse(s0); var v1 = uvec4.Parse(s1, "#"); Assert.AreEqual(v, v0); Assert.AreEqual(v, v1); var b0 = uvec4.TryParse(s0, out v0); var b1 = uvec4.TryParse(s1, "#", out v1); Assert.That(b0); Assert.That(b1); Assert.AreEqual(v, v0); Assert.AreEqual(v, v1); b0 = uvec4.TryParse(null, out v0); Assert.False(b0); b0 = uvec4.TryParse("", out v0); Assert.False(b0); b0 = uvec4.TryParse(s0 + ", 0", out v0); Assert.False(b0); Assert.Throws <NullReferenceException>(() => { uvec4.Parse(null); }); Assert.Throws <FormatException>(() => { uvec4.Parse(""); }); Assert.Throws <FormatException>(() => { uvec4.Parse(s0 + ", 0"); }); var s2 = v.ToString(";", CultureInfo.InvariantCulture); Assert.That(s2.Length > 0); var s3 = v.ToString("; ", "G"); var s4 = v.ToString("; ", "G", CultureInfo.InvariantCulture); var v3 = uvec4.Parse(s3, "; ", NumberStyles.Number); var v4 = uvec4.Parse(s4, "; ", NumberStyles.Number, CultureInfo.InvariantCulture); Assert.AreEqual(v, v3); Assert.AreEqual(v, v4); var b4 = uvec4.TryParse(s4, "; ", NumberStyles.Number, CultureInfo.InvariantCulture, out v4); Assert.That(b4); Assert.AreEqual(v, v4); }
/// <summary> /// Constructs this matrix from a series of column vectors. Non-overwritten fields are from an Identity matrix. /// </summary> public umat3x4(uvec4 c0, uvec4 c1, uvec4 c2) { this.m00 = c0.x; this.m01 = c0.y; this.m02 = c0.z; this.m03 = c0.w; this.m10 = c1.x; this.m11 = c1.y; this.m12 = c1.z; this.m13 = c1.w; this.m20 = c2.x; this.m21 = c2.y; this.m22 = c2.z; this.m23 = c2.w; }
/// <summary> /// Constructs this matrix from a series of column vectors. Non-overwritten fields are from an Identity matrix. /// </summary> public umat3x4(uvec4 c0, uvec4 c1) { this.m00 = c0.x; this.m01 = c0.y; this.m02 = c0.z; this.m03 = c0.w; this.m10 = c1.x; this.m11 = c1.y; this.m12 = c1.z; this.m13 = c1.w; this.m20 = 0u; this.m21 = 0u; this.m22 = 1u; this.m23 = 0u; }
public void InvariantNorm() { { var v0 = new uvec4(9u, 9u, 4u, 9u); Assert.LessOrEqual(v0.NormMax, v0.Norm); } { var v0 = new uvec4(7u, 6u, 2u, 9u); Assert.LessOrEqual(v0.NormMax, v0.Norm); } { var v0 = new uvec4(8u, 9u, 2u, 0u); Assert.LessOrEqual(v0.NormMax, v0.Norm); } { var v0 = new uvec4(5u, 5u, 3u, 4u); Assert.LessOrEqual(v0.NormMax, v0.Norm); } { var v0 = new uvec4(0u, 5u, 6u, 4u); Assert.LessOrEqual(v0.NormMax, v0.Norm); } { var v0 = new uvec4(3u, 5u, 4u, 2u); Assert.LessOrEqual(v0.NormMax, v0.Norm); } { var v0 = new uvec4(8u, 4u, 0u, 0u); Assert.LessOrEqual(v0.NormMax, v0.Norm); } { var v0 = new uvec4(4u, 2u, 5u, 7u); Assert.LessOrEqual(v0.NormMax, v0.Norm); } { var v0 = new uvec4(3u, 0u, 1u, 3u); Assert.LessOrEqual(v0.NormMax, v0.Norm); } { var v0 = new uvec4(0u, 9u, 7u, 9u); Assert.LessOrEqual(v0.NormMax, v0.Norm); } }
public void InvariantId() { { var v0 = new uvec4(6u, 8u, 0u, 8u); Assert.AreEqual(v0, +v0); } { var v0 = new uvec4(9u, 9u, 3u, 6u); Assert.AreEqual(v0, +v0); } { var v0 = new uvec4(7u, 7u, 1u, 1u); Assert.AreEqual(v0, +v0); } { var v0 = new uvec4(9u, 6u, 7u, 5u); Assert.AreEqual(v0, +v0); } { var v0 = new uvec4(9u, 6u, 4u, 9u); Assert.AreEqual(v0, +v0); } { var v0 = new uvec4(1u, 8u, 2u, 7u); Assert.AreEqual(v0, +v0); } { var v0 = new uvec4(8u, 0u, 1u, 5u); Assert.AreEqual(v0, +v0); } { var v0 = new uvec4(0u, 5u, 8u, 4u); Assert.AreEqual(v0, +v0); } { var v0 = new uvec4(7u, 0u, 2u, 2u); Assert.AreEqual(v0, +v0); } { var v0 = new uvec4(5u, 1u, 8u, 0u); Assert.AreEqual(v0, +v0); } }
public void InvariantTriple() { { var v0 = new uvec4(5u, 9u, 5u, 1u); Assert.AreEqual(v0 + v0 + v0, 3 * v0); } { var v0 = new uvec4(1u, 0u, 1u, 8u); Assert.AreEqual(v0 + v0 + v0, 3 * v0); } { var v0 = new uvec4(8u, 6u, 6u, 5u); Assert.AreEqual(v0 + v0 + v0, 3 * v0); } { var v0 = new uvec4(9u, 0u, 7u, 3u); Assert.AreEqual(v0 + v0 + v0, 3 * v0); } { var v0 = new uvec4(7u, 7u, 0u, 6u); Assert.AreEqual(v0 + v0 + v0, 3 * v0); } { var v0 = new uvec4(5u, 4u, 2u, 4u); Assert.AreEqual(v0 + v0 + v0, 3 * v0); } { var v0 = new uvec4(9u, 7u, 5u, 7u); Assert.AreEqual(v0 + v0 + v0, 3 * v0); } { var v0 = new uvec4(7u, 3u, 6u, 7u); Assert.AreEqual(v0 + v0 + v0, 3 * v0); } { var v0 = new uvec4(3u, 6u, 0u, 9u); Assert.AreEqual(v0 + v0 + v0, 3 * v0); } { var v0 = new uvec4(9u, 9u, 5u, 8u); Assert.AreEqual(v0 + v0 + v0, 3 * v0); } }
public void InvariantDouble() { { var v0 = new uvec4(1u, 9u, 9u, 6u); Assert.AreEqual(v0 + v0, 2 * v0); } { var v0 = new uvec4(5u, 0u, 9u, 3u); Assert.AreEqual(v0 + v0, 2 * v0); } { var v0 = new uvec4(5u, 1u, 7u, 7u); Assert.AreEqual(v0 + v0, 2 * v0); } { var v0 = new uvec4(7u, 6u, 8u, 2u); Assert.AreEqual(v0 + v0, 2 * v0); } { var v0 = new uvec4(7u, 8u, 9u, 0u); Assert.AreEqual(v0 + v0, 2 * v0); } { var v0 = new uvec4(0u, 9u, 1u, 6u); Assert.AreEqual(v0 + v0, 2 * v0); } { var v0 = new uvec4(8u, 7u, 2u, 2u); Assert.AreEqual(v0 + v0, 2 * v0); } { var v0 = new uvec4(6u, 3u, 0u, 4u); Assert.AreEqual(v0 + v0, 2 * v0); } { var v0 = new uvec4(6u, 7u, 1u, 9u); Assert.AreEqual(v0 + v0, 2 * v0); } { var v0 = new uvec4(3u, 1u, 2u, 3u); Assert.AreEqual(v0 + v0, 2 * v0); } }
public void Indexer() { var v = new uvec4(2u, 4u, 8u, 2u); Assert.AreEqual(2u, v[0]); Assert.AreEqual(4u, v[1]); Assert.AreEqual(8u, v[2]); Assert.AreEqual(2u, v[3]); Assert.Throws <ArgumentOutOfRangeException>(() => { var s = v[-2147483648]; }); Assert.Throws <ArgumentOutOfRangeException>(() => { v[-2147483648] = 0u; }); Assert.Throws <ArgumentOutOfRangeException>(() => { var s = v[-1]; }); Assert.Throws <ArgumentOutOfRangeException>(() => { v[-1] = 0u; }); Assert.Throws <ArgumentOutOfRangeException>(() => { var s = v[4]; }); Assert.Throws <ArgumentOutOfRangeException>(() => { v[4] = 0u; }); Assert.Throws <ArgumentOutOfRangeException>(() => { var s = v[2147483647]; }); Assert.Throws <ArgumentOutOfRangeException>(() => { v[2147483647] = 0u; }); Assert.Throws <ArgumentOutOfRangeException>(() => { var s = v[5]; }); Assert.Throws <ArgumentOutOfRangeException>(() => { v[5] = 0u; }); v[3] = 0u; Assert.AreEqual(0u, v[3]); v[2] = 1u; Assert.AreEqual(1u, v[2]); v[3] = 2u; Assert.AreEqual(2u, v[3]); v[0] = 3u; Assert.AreEqual(3u, v[0]); v[2] = 4u; Assert.AreEqual(4u, v[2]); v[1] = 5u; Assert.AreEqual(5u, v[1]); v[2] = 6u; Assert.AreEqual(6u, v[2]); v[0] = 7u; Assert.AreEqual(7u, v[0]); v[0] = 8u; Assert.AreEqual(8u, v[0]); v[3] = 9u; Assert.AreEqual(9u, v[3]); }
public void Constructors() { { var v = new uvec4(1u); Assert.AreEqual(1u, v.x); Assert.AreEqual(1u, v.y); Assert.AreEqual(1u, v.z); Assert.AreEqual(1u, v.w); } { var v = new uvec4(0u, 2u, 0u, 8u); Assert.AreEqual(0u, v.x); Assert.AreEqual(2u, v.y); Assert.AreEqual(0u, v.z); Assert.AreEqual(8u, v.w); } { var v = new uvec4(new uvec2(1u, 5u)); Assert.AreEqual(1u, v.x); Assert.AreEqual(5u, v.y); Assert.AreEqual(0u, v.z); Assert.AreEqual(0u, v.w); } { var v = new uvec4(new uvec3(0u, 0u, 1u)); Assert.AreEqual(0u, v.x); Assert.AreEqual(0u, v.y); Assert.AreEqual(1u, v.z); Assert.AreEqual(0u, v.w); } { var v = new uvec4(new uvec4(2u, 6u, 2u, 1u)); Assert.AreEqual(2u, v.x); Assert.AreEqual(6u, v.y); Assert.AreEqual(2u, v.z); Assert.AreEqual(1u, v.w); } }
/// <summary> /// Multiplies 32-bit integers x and y, producing a 64-bit result. /// The 32 least-significant bits are returned in lsb. The 32 most-significant bits are returned in msb. /// </summary> protected static void umulExtended(uvec4 x, uvec4 y, out uvec4 msb, out uvec4 lsb) { throw _invalidAccess; }
/// <summary>Returns the number of bits set to 1 in the binary representation of value.</summary> protected static ivec4 bitCount(uvec4 value) { throw _invalidAccess; }
protected bvec4 notEqual(uvec4 x, uvec4 y) { throw new NotImplementedException(); }
protected uvec4 min(uvec4 x, uint y) { throw new NotImplementedException(); }
/// <summary> /// Returns the reversal of the bits of value. The bit numbered n of the result will be taken from /// bit (bits - 1) - n of value, where bits is the total number of bits used to represent value. /// </summary> protected static uvec4 bitfieldReverse(uvec4 value) { throw _invalidAccess; }
/// <summary> /// Returns a bvec4 from component-wise application of Equal (lhs == rhs). /// </summary> public static bvec4 Equal(uvec4 lhs, uvec4 rhs) => uvec4.Equal(lhs, rhs);
/// <summary> /// Returns the bit number of the most significant bit in the binary representation of value. /// The result will be the bit number of the most significant bit set to 1. /// For a value of zero, -1 will be returned. /// </summary> protected static int findMSB(uvec4 value) { throw _invalidAccess; }
/// <summary> /// OuterProduct treats the first parameter c as a column vector (matrix with one column) and the second parameter r as a row vector (matrix with one row) and does a linear algebraic matrix multiply c * r, yielding a matrix whose number of rows is the number of components in c and whose number of columns is the number of components in r. /// </summary> public static umat4x3 OuterProduct(uvec3 c, uvec4 r) => uvec3.OuterProduct(c, r);
/// <summary> Subtracts the 32-bit unsigned integer y from x, returning the difference /// if non-negative, or 2**32 plus the difference otherwise. /// The value borrow is set to 0 if x >= y, or to 1 otherwise. </summary> protected static uvec4 usubBorrow(uvec4 x, uvec4 y, out uvec4 borrow) { throw _invalidAccess; }
/// <summary> /// Returns the insertion the bits least-significant bits of insert into base. /// The result will have bits [offset, offset + bits - 1] taken from bits [0, bits – 1] /// of insert, and all other bits taken directly from the corresponding bits of base. /// If bits is zero, the result will simply be base. /// The result will be undefined if offset or bits is negative, or if the sum of /// offset and bits is greater than the number of bits used to store the operand. /// </summary> protected static uvec4 bitfieldInsert(uvec4 _base, uvec4 insert, int offset, int bits) { throw _invalidAccess; }
/// <summary> /// Returns true iff this equals rhs type- and component-wise. /// </summary> public static bool Equals(uvec4 v, object obj) => v.Equals(obj);
/// <summary>Returns y if y < x, otherwise it returns x.</summary> protected internal static uvec4 Min(uvec4 x, uint y) { throw _invalidAccess; }
public uvec3(uvec4 xyzw) { x = xyzw.x; y = xyzw.y; z = xyzw.z; }
/// <summary> Adds 32-bit unsigned integer x and y, returning the sum modulo 2**32. /// The value carry is set to 0 if the sum was less than 232, or to 1 otherwise. </summary> protected static uvec4 uaddCarry(uvec4 x, uvec4 y, out uvec4 carry) { throw _invalidAccess; }
/// <summary> /// Returns a bvec4 from component-wise application of GreaterThanEqual (lhs >= rhs). /// </summary> public static bvec4 GreaterThanEqual(uvec4 lhs, uvec4 rhs) => uvec4.GreaterThanEqual(lhs, rhs);
/// <summary> Returns the bit number of the least significant bit set to 1 in the /// binary representation of value. If value is zero, -1 will be returned. </summary> protected static ivec4 findLSB(uvec4 value) { throw _invalidAccess; }
/// <summary> /// Returns true iff this equals rhs component-wise. /// </summary> public static bool Equals(uvec4 v, uvec4 rhs) => v.Equals(rhs);
protected uvec4 max(uvec4 x, uvec4 y) { throw new NotImplementedException(); }
/// <summary> /// Returns a bvec4 from component-wise application of NotEqual (lhs != rhs). /// </summary> public static bvec4 NotEqual(uvec4 lhs, uvec4 rhs) => uvec4.NotEqual(lhs, rhs);
protected uvec4 clamp(uvec4 x, uint minVal, uint maxVal) { throw new NotImplementedException(); }
protected bvec4 lessThan(uvec4 x, uvec4 y) { throw new NotImplementedException(); }
public void InvariantAssociative() { { var v0 = new uvec4(3u, 2u, 8u, 8u); var v1 = new uvec4(8u, 4u, 3u, 6u); var v2 = new uvec4(9u, 7u, 1u, 4u); Assert.AreEqual(v0 * (v1 + v2), v0 * v1 + v0 * v2); } { var v0 = new uvec4(8u, 7u, 9u, 6u); var v1 = new uvec4(9u, 7u, 9u, 6u); var v2 = new uvec4(0u, 5u, 3u, 4u); Assert.AreEqual(v0 * (v1 + v2), v0 * v1 + v0 * v2); } { var v0 = new uvec4(1u, 5u, 2u, 9u); var v1 = new uvec4(3u, 0u, 6u, 0u); var v2 = new uvec4(5u, 2u, 9u, 3u); Assert.AreEqual(v0 * (v1 + v2), v0 * v1 + v0 * v2); } { var v0 = new uvec4(6u, 0u, 1u, 8u); var v1 = new uvec4(7u, 1u, 8u, 4u); var v2 = new uvec4(6u, 4u, 5u, 7u); Assert.AreEqual(v0 * (v1 + v2), v0 * v1 + v0 * v2); } { var v0 = new uvec4(8u, 8u, 9u, 5u); var v1 = new uvec4(3u, 0u, 2u, 7u); var v2 = new uvec4(8u, 4u, 7u, 3u); Assert.AreEqual(v0 * (v1 + v2), v0 * v1 + v0 * v2); } { var v0 = new uvec4(2u, 3u, 2u, 8u); var v1 = new uvec4(0u, 1u, 8u, 6u); var v2 = new uvec4(7u, 6u, 9u, 8u); Assert.AreEqual(v0 * (v1 + v2), v0 * v1 + v0 * v2); } { var v0 = new uvec4(6u, 1u, 8u, 9u); var v1 = new uvec4(7u, 8u, 8u, 7u); var v2 = new uvec4(9u, 5u, 1u, 5u); Assert.AreEqual(v0 * (v1 + v2), v0 * v1 + v0 * v2); } { var v0 = new uvec4(1u, 0u, 6u, 4u); var v1 = new uvec4(0u, 1u, 4u, 2u); var v2 = new uvec4(3u, 7u, 5u, 3u); Assert.AreEqual(v0 * (v1 + v2), v0 * v1 + v0 * v2); } { var v0 = new uvec4(8u, 9u, 4u, 4u); var v1 = new uvec4(5u, 9u, 9u, 1u); var v2 = new uvec4(8u, 0u, 9u, 2u); Assert.AreEqual(v0 * (v1 + v2), v0 * v1 + v0 * v2); } { var v0 = new uvec4(2u, 2u, 9u, 9u); var v1 = new uvec4(6u, 9u, 3u, 7u); var v2 = new uvec4(1u, 6u, 7u, 9u); Assert.AreEqual(v0 * (v1 + v2), v0 * v1 + v0 * v2); } }
protected bvec4 greaterThanEqual(uvec4 x, uvec4 y) { throw new NotImplementedException(); }
/// <summary> /// Returns a floating-point value corresponding to an unsigned integer encoding /// of a floating-point value. If a NaN is passed in, it will not signal, /// and the resulting floating point value is unspecified. If an Inf is passed in, /// the resulting floating-point value is the corresponding Inf. /// </summary> protected static vec4 uintBitsToFloat(uvec4 value) { throw _invalidAccess; }
/// <summary> /// Returns a hash code for this instance. /// </summary> public static int GetHashCode(uvec4 v) => v.GetHashCode();
/// <summary>Returns Min (Max (x, minVal), maxVal). Results are undefined if minVal > maxVal.</summary> protected internal static uvec4 Clamp(uvec4 x, uvec4 minVal, uvec4 maxVal) { throw _invalidAccess; }
/// <summary>Returns y if x < y, otherwise it returns x.</summary> protected internal static uvec4 Max(uvec4 x, uvec4 y) { throw _invalidAccess; }
/// <summary> /// </summary> /// <param name="uniformName"></param> /// <param name="values"></param> /// <returns></returns> public int SetUniform(string uniformName, uvec4[] values) { int location = GetUniformLocation(uniformName); if (location >= 0) { if (glUniform4uiv == null) { glUniform4uiv = OpenGL.GetDelegateFor<OpenGL.glUniform4uiv>(); } int count = values.Length; var value = new uint[count * 4]; int index = 0; for (int i = 0; i < value.Length; i++) { value[index++] = values[i].x; value[index++] = values[i].y; value[index++] = values[i].z; value[index++] = values[i].w; } glUniform4uiv(location, count, value); } return location; }
/// <summary> /// Extracts bits [offset, offset + bits - 1] from value, returning them /// in the least significant bits of the result. /// The most significant bits of the result will be set to zero. /// If bits is zero, the result will be zero. The result will be undefined if /// offset or bits is negative, or if the sum of offset and bits is greater than /// the number of bits used to store the operand. /// </summary> /// <returns></returns> protected static uvec4 bitfieldExtract(uvec4 value, int offset, int bits) { throw _invalidAccess; }