mirror of https://gitee.com/antv-l7/antv-l7
feat: 新增 luma、做替换准备
This commit is contained in:
parent
b450900f02
commit
8250a729c4
packages
|
@ -435,7 +435,7 @@ export default class Scene extends EventEmitter implements ISceneService {
|
|||
}
|
||||
|
||||
// set view port
|
||||
this.gl._gl.viewport(0, 0, pixelRatio * w, pixelRatio * h);
|
||||
// this.gl._gl.viewport(0, 0, pixelRatio * w, pixelRatio * h);
|
||||
}
|
||||
|
||||
private setCanvas() {
|
||||
|
|
|
@ -35,7 +35,10 @@
|
|||
"inversify": "^5.0.1",
|
||||
"l7regl": "^0.0.20",
|
||||
"lodash": "^4.17.15",
|
||||
"reflect-metadata": "^0.1.13"
|
||||
"reflect-metadata": "^0.1.13",
|
||||
"@luma.gl/engine": "^8.5.18",
|
||||
"@luma.gl/webgl": "^8.5.18",
|
||||
"@luma.gl/gltools": "^8.5.18"
|
||||
},
|
||||
"gitHead": "684ba4eb806a798713496d3fc0b4d1e17517dc31",
|
||||
"publishConfig": {
|
||||
|
|
|
@ -93,8 +93,42 @@ import { injectable } from 'inversify';
|
|||
import regl from 'l7regl';
|
||||
import 'reflect-metadata';
|
||||
|
||||
// import {polyfillContext} from '@luma.gl/gltools';
|
||||
|
||||
|
||||
/**
|
||||
* regl renderer
|
||||
*
|
||||
* 使用 luma 的低级模式进行替换实验
|
||||
https://luma.gl/docs/getting-started/hello-instancing-low
|
||||
|
||||
import { Model} from '@luma.gl/engine';
|
||||
import {Buffer, clear} from '@luma.gl/webgl';
|
||||
const positionBuffer = new Buffer(gl, new Float32Array([
|
||||
-0.5, -0.5,
|
||||
0.5, -0.5,
|
||||
0.0, 0.5
|
||||
]));
|
||||
|
||||
const model = new Model(gl, {
|
||||
vs,
|
||||
fs,
|
||||
attributes: {
|
||||
position: positionBuffer,
|
||||
color: colorBuffer
|
||||
},
|
||||
vertexCount: 3,
|
||||
|
||||
uniforms: {
|
||||
uTexture: texture
|
||||
}
|
||||
|
||||
});
|
||||
clear(gl, {color: [0, 0, 0, 1]});
|
||||
|
||||
model.setUniforms({uMVP: mvpMatrix})
|
||||
|
||||
|
||||
model.draw();
|
||||
*/
|
||||
@injectable()
|
||||
export default class ReglRendererService {
|
||||
|
@ -114,17 +148,18 @@ export default class ReglRendererService {
|
|||
new ReglModel(this.gl);
|
||||
|
||||
|
||||
public clear = (options: any) => {
|
||||
const { color, depth, stencil } = options;
|
||||
public clear = () => {
|
||||
const reglClearOptions: any = {
|
||||
color,
|
||||
depth,
|
||||
stencil,
|
||||
color: [0, 0, 0, 0],
|
||||
depth: 1,
|
||||
stencil: 0,
|
||||
};
|
||||
|
||||
this.gl?.clear(reglClearOptions);
|
||||
};
|
||||
}
|
||||
|
||||
// 程序对象
|
||||
class ReglModel {
|
||||
private drawCommand: any;
|
||||
private uniforms: any = {};
|
||||
|
@ -161,6 +196,7 @@ class ReglModel {
|
|||
// coordinates: [120, 30],
|
||||
// id: 0,
|
||||
// }],
|
||||
console.log(reglUniforms);
|
||||
|
||||
const drawParams: any = {
|
||||
attributes: {
|
||||
|
@ -170,7 +206,7 @@ class ReglModel {
|
|||
frag,
|
||||
uniforms: reglUniforms,
|
||||
vert,
|
||||
primitive: 'triangles'
|
||||
// primitive: 'triangles'
|
||||
};
|
||||
|
||||
drawParams.elements = [0, 1, 2, 2, 3, 0];
|
||||
|
|
Loading…
Reference in New Issue