示例#1
0
        public static void Int16ArrayFrom(Function objectPrototype)
        {
            var        array = new short[50];
            Int16Array from  = Int16Array.From(array);

            Assert.Equal(50, from.Length);
            Assert.Equal("[object Int16Array]", objectPrototype.Call(from));
        }
示例#2
0
        // https://github.com/WaveEngine/WebGL.NET/issues/12
        public void BufferDataITypedArrayRegressionTest()
        {
            var indexData = new short[] { 1, 2, 3, 4 };

            var indexBuffer = gl.CreateBuffer();

            gl.BindBuffer(WebGLRenderingContextBase.ELEMENT_ARRAY_BUFFER, indexBuffer);

            gl.BufferData(WebGLRenderingContextBase.ELEMENT_ARRAY_BUFFER,
                          Int16Array.From(indexData),
                          WebGLRenderingContextBase.STATIC_DRAW);

            gl.BindBuffer(WebGLRenderingContextBase.ELEMENT_ARRAY_BUFFER, null);
            gl.DeleteBuffer(indexBuffer);

            this.AssertNoWebGLError();
        }
示例#3
0
        public static IEnumerable <object[]> ArrayType_TestData()
        {
            _objectPrototype ??= new Function("return Object.prototype.toString;");
            yield return(new object[] { _objectPrototype.Call(), "Uint8Array", Uint8Array.From(new byte[10]) });

            yield return(new object[] { _objectPrototype.Call(), "Uint8ClampedArray", Uint8ClampedArray.From(new byte[10]) });

            yield return(new object[] { _objectPrototype.Call(), "Int8Array", Int8Array.From(new sbyte[10]) });

            yield return(new object[] { _objectPrototype.Call(), "Uint16Array", Uint16Array.From(new ushort[10]) });

            yield return(new object[] { _objectPrototype.Call(), "Int16Array", Int16Array.From(new short[10]) });

            yield return(new object[] { _objectPrototype.Call(), "Uint32Array", Uint32Array.From(new uint[10]) });

            yield return(new object[] { _objectPrototype.Call(), "Int32Array", Int32Array.From(new int[10]) });

            yield return(new object[] { _objectPrototype.Call(), "Float32Array", Float32Array.From(new float[10]) });

            yield return(new object[] { _objectPrototype.Call(), "Float64Array", Float64Array.From(new double[10]) });

            yield return(new object[] { _objectPrototype.Call(), "Array", new Array(10) });
        }
示例#4
0
 private static void SetTypedArrayShort(JSObject obj)
 {
     short[] buffer = Enumerable.Repeat((short)0x20, 13).ToArray();
     obj.SetObjectProperty("typedArray", Int16Array.From(buffer));
 }
示例#5
0
        public static Int16Array Int16ArrayFrom()
        {
            var array = new short[50];

            return(Int16Array.From(array));
        }