JavaScript 测试
const canvas = document.querySelector('canvas');
const gl = canvas.getContext('webgl');
function createShader(gl, type, source) {
const shader = gl.createShader(type);
gl.shaderSource(shader, source);
gl.compileShader(shader);
return shader;
}
GLSL 测试
precision highp float;
uniform vec3 ambientLight;
uniform mat4 modelViewMatrix;
void main() {
gl_FragColor.rgb = ambientLight;
gl_FragColor.a = 1.0;
}
TypeScript 测试
@ccclass('BFSVirtualList')
export class BFSVirtualList extends Component {
@property(Sprite)
public itemSprite: Sprite | null = null;
protected onLoad(): void {
console.log('Component loaded');
}
}