mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 16:14:10 -08:00
Fix errors in WebGL wrappers. Add support of some typed arrays
This commit is contained in:
parent
1b0b47985d
commit
be4457c285
|
@ -17,8 +17,7 @@ package org.teavm.dom.browser;
|
|||
|
||||
import org.teavm.dom.ajax.XMLHttpRequest;
|
||||
import org.teavm.dom.html.HTMLDocument;
|
||||
import org.teavm.dom.typedarrays.ArrayBuffer;
|
||||
import org.teavm.dom.typedarrays.Int8Array;
|
||||
import org.teavm.dom.typedarrays.*;
|
||||
import org.teavm.jso.JSConstructor;
|
||||
import org.teavm.jso.JSGlobal;
|
||||
import org.teavm.jso.JSObject;
|
||||
|
@ -62,30 +61,57 @@ public interface Window extends JSGlobal {
|
|||
@JSConstructor("Int8Array")
|
||||
Int8Array createInt8Array(ArrayBuffer buffer, int offset, int length);
|
||||
|
||||
@JSConstructor("Uint8ClampedArray")
|
||||
Int8Array createUint8ClampedArray(int length);
|
||||
@JSConstructor("Uint8Array")
|
||||
Uint8Array createUint8Array(int length);
|
||||
|
||||
@JSConstructor("Uint8Array")
|
||||
Uint8Array createUint8Array(ArrayBuffer buffer);
|
||||
|
||||
@JSConstructor("Uint8Array")
|
||||
Uint8Array createUint8Array(ArrayBuffer buffer, int offset, int length);
|
||||
|
||||
@JSConstructor("Uint8ClampedArray")
|
||||
Int8Array createUint8ClampedArray(ArrayBuffer buffer);
|
||||
Uint8ClampedArray createUint8ClampedArray(int length);
|
||||
|
||||
@JSConstructor("Uint8ClampedArray")
|
||||
Int8Array createUintClamped8Array(ArrayBuffer buffer, int offset, int length);
|
||||
Uint8ClampedArray createUint8ClampedArray(ArrayBuffer buffer);
|
||||
|
||||
@JSConstructor("Uint8ClampedArray")
|
||||
Uint8ClampedArray createUintClamped8Array(ArrayBuffer buffer, int offset, int length);
|
||||
|
||||
@JSConstructor("Int16Array")
|
||||
Int16Array createInt16Array(int length);
|
||||
|
||||
@JSConstructor("Int16Array")
|
||||
Int16Array createInt16Array(ArrayBuffer buffer);
|
||||
|
||||
@JSConstructor("Int16Array")
|
||||
Int16Array createInt16Array(ArrayBuffer buffer, int offset, int length);
|
||||
|
||||
@JSConstructor("Int32Array")
|
||||
Int8Array createInt32Array(int length);
|
||||
Int32Array createInt32Array(int length);
|
||||
|
||||
@JSConstructor("Int32Array")
|
||||
Int8Array createInt32Array(ArrayBuffer buffer);
|
||||
Int32Array createInt32Array(ArrayBuffer buffer);
|
||||
|
||||
@JSConstructor("Int32Array")
|
||||
Int8Array createInt32Array(ArrayBuffer buffer, int offset, int length);
|
||||
Int32Array createInt32Array(ArrayBuffer buffer, int offset, int length);
|
||||
|
||||
@JSConstructor("Float32Array")
|
||||
Int8Array createFloat32Array(int length);
|
||||
Float32Array createFloat32Array(int length);
|
||||
|
||||
@JSConstructor("Float32Array")
|
||||
Int8Array createFloat32Array(ArrayBuffer buffer);
|
||||
Float32Array createFloat32Array(ArrayBuffer buffer);
|
||||
|
||||
@JSConstructor("Float32Array")
|
||||
Int8Array createFloat32Array(ArrayBuffer buffer, int offset, int length);
|
||||
Float32Array createFloat32Array(ArrayBuffer buffer, int offset, int length);
|
||||
|
||||
@JSConstructor("Float64Array")
|
||||
Float64Array createFloat64Array(int length);
|
||||
|
||||
@JSConstructor("Float64Array")
|
||||
Float64Array createFloat64Array(ArrayBuffer buffer);
|
||||
|
||||
@JSConstructor("Float64Array")
|
||||
Float64Array createFloat64Array(ArrayBuffer buffer, int offset, int length);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* Copyright 2015 Alexey Andreev.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.dom.typedarrays;
|
||||
|
||||
import org.teavm.jso.JSIndexer;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Alexey Andreev <konsoletyper@gmail.com>
|
||||
*/
|
||||
public interface Float64Array extends ArrayBufferView {
|
||||
@JSIndexer
|
||||
double get(int index);
|
||||
|
||||
@JSIndexer
|
||||
void set(int index, double value);
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* Copyright 2015 Alexey Andreev.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.dom.typedarrays;
|
||||
|
||||
import org.teavm.jso.JSIndexer;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Alexey Andreev
|
||||
*/
|
||||
public interface Int16Array extends ArrayBufferView {
|
||||
@JSIndexer
|
||||
short get(int index);
|
||||
|
||||
@JSIndexer
|
||||
void set(int index, short value);
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* Copyright 2015 Alexey Andreev.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.dom.typedarrays;
|
||||
|
||||
import org.teavm.jso.JSIndexer;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Alexey Andreev
|
||||
*/
|
||||
public interface Uint8Array extends ArrayBufferView {
|
||||
@JSIndexer
|
||||
short get(int index);
|
||||
|
||||
@JSIndexer
|
||||
void set(int index, short value);
|
||||
}
|
|
@ -16,11 +16,19 @@
|
|||
package org.teavm.dom.webgl;
|
||||
|
||||
import org.teavm.jso.JSObject;
|
||||
import org.teavm.jso.JSProperty;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Alexey Andreev <konsoletyper@gmail.com>
|
||||
*/
|
||||
public interface WebGLActiveInfo extends JSObject {
|
||||
@JSProperty
|
||||
int getSize();
|
||||
|
||||
@JSProperty
|
||||
int getType();
|
||||
|
||||
@JSProperty
|
||||
String getName();
|
||||
}
|
||||
|
|
|
@ -527,18 +527,39 @@ public interface WebGLRenderingContext extends JSObject {
|
|||
|
||||
JSObject getParameter(int pname);
|
||||
|
||||
@JSMethod("getParameter")
|
||||
int getParameteri(int pname);
|
||||
|
||||
@JSMethod("getParameter")
|
||||
String getParameterString(int pname);
|
||||
|
||||
@JSMethod("getParameter")
|
||||
float getParameterf(int pname);
|
||||
|
||||
int getError();
|
||||
|
||||
JSObject getFramebufferAttachmentParameter(int target, int attachment, int pname);
|
||||
|
||||
JSObject getProgramParameter(WebGLProgram program, int pname);
|
||||
|
||||
@JSMethod("getProgramParameter")
|
||||
boolean getProgramParameterb(WebGLProgram program, int pname);
|
||||
|
||||
@JSMethod("getProgramParameter")
|
||||
int getProgramParameteri(WebGLProgram program, int pname);
|
||||
|
||||
String getProgramInfoLog(WebGLProgram program);
|
||||
|
||||
JSObject getRenderbufferParameter(int target, int pname);
|
||||
|
||||
JSObject getShaderParameter(WebGLShader shader, int pname);
|
||||
|
||||
@JSMethod("getShaderParameter")
|
||||
boolean getShaderParameterb(WebGLShader shader, int pname);
|
||||
|
||||
@JSMethod("getShaderParameter")
|
||||
int getShaderParameteri(WebGLShader shader, int pname);
|
||||
|
||||
WebGLShaderPrecisionFormat getShaderPrecisionFormat(int shadertype, int precisiontype);
|
||||
|
||||
String getShaderInfoLog(WebGLShader shader);
|
||||
|
|
|
@ -16,19 +16,10 @@
|
|||
package org.teavm.dom.webgl;
|
||||
|
||||
import org.teavm.jso.JSObject;
|
||||
import org.teavm.jso.JSProperty;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Alexey Andreev <konsoletyper@gmail.com>
|
||||
*/
|
||||
public interface WebGLUniformLocation extends JSObject {
|
||||
@JSProperty
|
||||
int getSize();
|
||||
|
||||
@JSProperty
|
||||
int getType();
|
||||
|
||||
@JSProperty
|
||||
String getName();
|
||||
}
|
||||
|
|
|
@ -77,6 +77,12 @@ public final class JS {
|
|||
@InjectedBy(JSNativeGenerator.class)
|
||||
public static native JSObject wrap(boolean num);
|
||||
|
||||
@InjectedBy(JSNativeGenerator.class)
|
||||
public static native JSObject wrap(byte num);
|
||||
|
||||
@InjectedBy(JSNativeGenerator.class)
|
||||
public static native JSObject wrap(short num);
|
||||
|
||||
public static <T extends JSObject> JSArray<T> wrap(T[] array) {
|
||||
JSArray<T> result = createArray(array.length);
|
||||
for (int i = 0; i < array.length; ++i) {
|
||||
|
@ -244,6 +250,33 @@ public final class JS {
|
|||
public static native JSObject invoke(JSObject instance, JSObject method, JSObject a, JSObject b, JSObject c,
|
||||
JSObject d, JSObject e, JSObject f, JSObject g, JSObject h);
|
||||
|
||||
@InjectedBy(JSNativeGenerator.class)
|
||||
@PluggableDependency(JSNativeGenerator.class)
|
||||
public static native JSObject invoke(JSObject instance, JSObject method, JSObject a, JSObject b, JSObject c,
|
||||
JSObject d, JSObject e, JSObject f, JSObject g, JSObject h, JSObject i);
|
||||
|
||||
@InjectedBy(JSNativeGenerator.class)
|
||||
@PluggableDependency(JSNativeGenerator.class)
|
||||
public static native JSObject invoke(JSObject instance, JSObject method, JSObject a, JSObject b, JSObject c,
|
||||
JSObject d, JSObject e, JSObject f, JSObject g, JSObject h, JSObject i, JSObject j);
|
||||
|
||||
@InjectedBy(JSNativeGenerator.class)
|
||||
@PluggableDependency(JSNativeGenerator.class)
|
||||
public static native JSObject invoke(JSObject instance, JSObject method, JSObject a, JSObject b, JSObject c,
|
||||
JSObject d, JSObject e, JSObject f, JSObject g, JSObject h, JSObject i, JSObject j, JSObject k);
|
||||
|
||||
@InjectedBy(JSNativeGenerator.class)
|
||||
@PluggableDependency(JSNativeGenerator.class)
|
||||
public static native JSObject invoke(JSObject instance, JSObject method, JSObject a, JSObject b, JSObject c,
|
||||
JSObject d, JSObject e, JSObject f, JSObject g, JSObject h, JSObject i, JSObject j, JSObject k,
|
||||
JSObject l);
|
||||
|
||||
@InjectedBy(JSNativeGenerator.class)
|
||||
@PluggableDependency(JSNativeGenerator.class)
|
||||
public static native JSObject invoke(JSObject instance, JSObject method, JSObject a, JSObject b, JSObject c,
|
||||
JSObject d, JSObject e, JSObject f, JSObject g, JSObject h, JSObject i, JSObject j, JSObject k,
|
||||
JSObject l, JSObject m);
|
||||
|
||||
@InjectedBy(JSNativeGenerator.class)
|
||||
@PluggableDependency(JSNativeGenerator.class)
|
||||
public static native JSObject instantiate(JSObject instance, JSObject constructor);
|
||||
|
|
Loading…
Reference in New Issue
Block a user