项目作者: dmnsgn

项目描述 :
Cameras for 3D rendering.
高级语言: TypeScript
项目地址: git://github.com/dmnsgn/cameras.git
创建时间: 2020-01-31T18:45:56Z
项目社区:https://github.com/dmnsgn/cameras

开源协议:MIT License

下载


cameras

npm version
stability-stable
npm minzipped size
dependencies
types
Conventional Commits
styled with prettier
linted with eslint
license

Cameras for 3D rendering.

paypal
coinbase
twitter

Installation

  1. npm install cameras

Usage

See the demo and its source.

  1. import { PerspectiveCamera } from "cameras";
  2. const perspectiveCamera = new PerspectiveCamera({
  3. fov: Math.PI / 2,
  4. near: 1,
  5. far: 1000,
  6. position: [3, 3, 3],
  7. target: [0, 1, 0],
  8. });
  9. // Create controls
  10. const perspectiveCameraControls = new Controls({
  11. element: regl._gl.canvas,
  12. camera: perspectiveCamera,
  13. });
  14. // Update controls and set camera with controls position/target
  15. perspectiveCameraControls.update();
  16. perspectiveCamera.position = perspectiveCameraControls.position;
  17. perspectiveCamera.target = perspectiveCameraControls.target;
  18. // Update view matrices (call when changing position/target/up)
  19. perspectiveCamera.update();
  20. // Update projection matrix (call when changing near/far/view and other camera type specific options)
  21. perspectiveCamera.updateProjectionMatrix();

API

See the documentation and Typescript types.

License

MIT. See license file.