@antv/g-webgpu
```typescript import { World } from '@antv/g-webgpu';
Last updated 17 days ago by panyuqi .
ISC · Original npm · Tarball · package.json
$ cnpm install @antv/g-webgpu 
SYNC missed versions from official npm registry.

@antv/g-webgpu

import { World } from '@antv/g-webgpu';

const canvas = document.getElementById('application');

const world = World.create({
  canvas,
});

const renderer = world.createRenderer();
const scene = world.createScene();
const boxEntity = world.createEntity();
scene.addEntity(boxEntity);

const camera = world
  .createCamera()
  .setPosition(0, 0, 2)
  .setPerspective(0.1, 5, 75, canvas.width / canvas.height);

const view = world
  .createView()
  .setCamera(camera)
  .setScene(scene)
  .setViewport({
    x: 0,
    y: 0,
    width: canvas.width,
    height: canvas.height,
  });

// create geometry, material and attach them to mesh
const boxGeometry = world.createGeometry(Geometry.BOX, {
  halfExtents: [0.5, 0.5, 0.5],
});
const material = world.createMaterial(Material.BASIC).setUniform({
  color: [1, 0, 0, 1],
});

world
  .createRenderable(boxEntity)
  .setGeometry(boxGeometry)
  .setMaterial(material);

// create a render loop
const render = () => {
  renderer.render(view);
  frameId = window.requestAnimationFrame(render);
};

render();

Current Tags

  • 0.5.2                                ...           latest (17 days ago)

11 Versions

  • 0.5.2                                ...           17 days ago
  • 0.5.1                                ...           2 months ago
  • 0.6.0                                ...           2 months ago
  • 0.5.0                                ...           3 months ago
  • 0.4.1                                ...           7 months ago
  • 0.4.0                                ...           7 months ago
  • 0.3.0                                ...           7 months ago
  • 0.2.0                                ...           7 months ago
  • 0.1.2                                ...           8 months ago
  • 0.1.1-alpha.1                                ...           8 months ago
  • 0.1.0-alpha.0                                ...           8 months ago

Copyright 2014 - 2017 © taobao.org |