@antv/g-webgpu
```typescript import { World } from '@antv/g-webgpu';
Last updated 4 years ago by panyuqi .
ISC · Original npm
$ 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

  • 1.7.45                                ...           latest (3 years ago)

7 Versions

  • 1.7.45                                ...           3 years ago
  • 0.7.2                                ...           3 years ago
  • 1.1.8-alpha.1                                ...           3 years ago
  • 1.7.11                                ...           3 years ago
  • 0.5.6                                ...           4 years ago
  • 0.5.5                                ...           4 years ago
  • 0.5.4-alpha.3                                ...           5 years ago

Copyright 2013 - present © cnpmjs.org