当前位置: 首页 > 软件库 > Web应用开发 > Web框架 >

ember-3d

授权协议 MIT License
开发语言 JavaScript
所属分类 Web应用开发、 Web框架
软件类型 开源软件
地区 不详
投 递 者 权兴为
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

Ember 3D

Ember 3D is an Ember addon for using Three.js - an easy to use, lightweight, javascript 3D library.

It is designed to:

  • Prescribe a solid file structure to Three.js code using ES6 modules.
  • Enable fast creation of Three.js scenes, renderers, cameras, lighting and objects using a well defined set of abstractions.

Installation

ember install ember-3d

Ember 3D includes a shim for the Three.js library. Installing Ember 3D will allow you to use imports from the three module, like so:

import { BoxGeometry, Mesh, MeshPhongMaterial, Scene } from 'three';

Requirements

Ember CLI >=2.9.0

The shim uses app.import's new AMD transformation feature released in Ember CLI 2.9.0.

Ember.js >=2.7.0

Due to the use of the uniqBy method, this lib needs ember.js 2.7.0 or upwards.

Folder structure

Ember 3D adds a folder named 3d to your project's app folder. Ember 3D expects projects to be structured in the following manner:

app/
├── 3d/
|   └── scene-id/
|       ├── camera.js
|       ├── interactions/
|           └── interaction-id.js
|       ├── lighting.js
|       ├── objects/
|           └── object-id.js
|       ├── renderer.js
|       └── scene.js

Components

To add a 3D scene to a template, use the 3d-scene component with a dasherized version of the scene id:

{{3d-scene id="scene-id"}}

Scenes

The BaseSceneMixin simply creates a Three.js scene from the renderer defined in renderer.js & camera defined in camera.js and appends it to the DOM.

// app/scene-id/scene.js
import SceneMixin from 'ember-3d/scenes/base';

export default SceneMixin.extend();

Renderers

Ember 3D's WebGLRendererMixin extends the BaseRendererMixin, which automatically resizes the renderer on dimension changes of the 3d-scene.

// app/scene-id/renderer.js
import WebGLRendererMixin from 'ember-3d/renderers/webgl';

export default WebGLRendererMixin.extend({
  options: {
    alpha: true,
    shadowMap: { enabled: true }
  }
});

Cameras

Ember 3D allows for the creation of two types of Three.js camera, perspectiveCamera and orthographicCamera.

Perspective Camera

The PerspectiveCameraMixin creates a Three.js PerspectiveCamera. The camera's aspect value is dynamically updated when the 3d-scene dimensions change.

// app/scene-id/camera.js
import PerspectiveCameraMixin from 'ember-3d/cameras/perspective';

export default PerspectiveCameraMixin.extend({
  viewAngle: 75,
  near: 1,
  far: 10000,
  setAspectDynamically: true,
  position: {
    x: 0,
    y: 0,
    z: 1000
  }
});

Orthographic Camera

The OrthographicCameraMixin creates a Three.js OrthographicCamera. Left, right, top and bottom frustums are dynamically updated when the 3d-scene dimensions change.

// app/scene-id/camera.js
import OrthographicCameraMixin from 'ember-3d/cameras/orthographic';

export default OrthographicCameraMixin.extend({
  near: 1,
  far: 10000,

  position: {
    x: 50,
    y: 75,
    z: 1000
  }
});

Lighting

The BaseLightingMixin offers a simple method of registering lighting onto the Three.js scene using the addLighting function.

// app/scene-id/lighting.js
import BaseLightingMixin from 'ember-3d/lighting/base';

export default BaseLightingMixin.extend({

  addLighting() {
    // Add lighting using:
    // get(this, 'scene').add(YOUR_LIGHTING);
  }

});

Objects

The BaseObjectMixin prescribes a set of functions for registering 3D objects on your Three.js scene. It also exposes an animate function for animating your objects. The BaseObjectMixin can't be used to create objects itself, but you can use one of the following mixins extended from it:

Mesh

Triangular polygon mesh based objects can be created and attached to the scene using the MeshObjectMixin. For example, the following code creates a cube and animates it:

// app/scene-id/objects/cube.js
import Ember from 'ember';
import MeshObjectMixin from 'ember-3d/objects/mesh';
import { BoxGeometry, MeshBasicMaterial } from 'three';

const { get } = Ember;

export default MeshObjectMixin.extend({

  geometry: new BoxGeometry(700, 700, 700, 10, 10, 10),
  material: new MeshBasicMaterial({color: 0xfffff, wireframe: true}),

  animate() {
    let cube = get(this, 'object');

    function loop() {
      requestAnimationFrame(loop);
      cube.rotation.x += 0.01;
      cube.rotation.y += 0.01;
    }

    loop();
  }

});

Group

The GroupObjectMixin enables complex object building. Multiple meshes can be attached to a group, like so:

// app/scene-id/objects/cube-group.js
import GroupObjectMixin from 'ember-3d/objects/group';
import { BoxGeometry, Mesh, MeshPhongMaterial } from 'three';

export default GroupObjectMixin.extend({

  buildObject() {

    // Add our cube to the group
    let cube = this.createObject('cube');

    this.addToGroup([
      cube,
      this.one(),
  	  this.two()
    ]);

  },

  one() {
  	const geometry = new BoxGeometry(60,50,50,1,1,1);
  	const material = new MeshPhongMaterial({color: 0xf25346 });
  	return new Mesh(geometry, material);

  },

  two() {
    let one = this.one();
    one.position.x = 50;
    return one;

  }

});

Out-of-the-box support for other Three.js object types will be added in the near future.

Interactions

Interactions offer a structured way to manage methods of interaction with your scene.

Mouse Move

The MouseMoveInteractionMixin listens to movements of the mouse and sets mouseX and mouseY properties on the component, accessible by all Ember 3D modules. The mixin can also return normalized positive or negative values based upon the height and width of the scene.

// app/scene-id/interactions/mouse-move.js
import MouseMoveInteractionMixin from 'ember-3d/interactions/mouse-move';

export default MouseMoveInteractionMixin.extend({
  normalizeMouseValues: true
});

More interactions will be added in the near future.

Plugins

Ember 3D offers plugins for any features not included in the Three.js core module.

Using Three.js

For more information on how to use Three.js, please refer to the documentation.

Contributing

Ember 3D is in its infancy. It will seek to be a flexible and elegant addon for creating complex 3D scenes. Please feel free to contribute.

Feature requests

Create feature requests here and please tag your issue with feature-request.

  • 现象 ZigBee子设备新固件下载完成后,准备校验其合法性,代码运行至检验部分,MCU崩溃重启。 日志如下: # RECV ASCII> Processing message: len=33 profile=0104 cluster=0019 T00000000:RX len 33, ep 01, clus 0x0019 (Over the Air Bootloading) FC 19 seq

  • 一句话题意:给你一个矩形,给出两种操作,一种询问区间最大值,一种区间加。 由于刚学习二维树状数组,所以想试试,但是想了想发现没法维护最大值,或者说强行维护的话好像会到达log^4。。。因为一维树状数组维护最大值是log^2的,这就得不偿失了。 所以还是二维线段树,一开始打错了,删掉3000多b重打,一阵酸爽。 其实就是树套树辣,对于行维护一个线段树,每一行维护一个线段树,然后发现矩阵的信息没法上传

  • Autodesk在知识共享-署名-相同方式共享许可证下公开了其3D打印机Ember的树脂、机械设计、电路图纸的细节,在GNU GPL许可证下公开了固件。打印机运行的是一个基于Linux的操作系统。3D打印机行业热衷于开源的一个原因是它本就是开源模式下成长起来的,许多成功的公司使用开源设计销售类似的打印机。Ember 3D 打印机的打包价约6000美元,包括了打印机、两个树脂托盘,两个构建头,两升的

  • Autodesk 开源 3D 打印机 Autodesk在知识共享-署名-相同方式共享许可证下公开了其3D打印机Ember的树脂、机械设计、电路图纸的细节,在GNU GPL许可证下公开了固件。打印机运行的是一个基于Linux的操作系统。3D打印机行业热衷于开源的一个原因是它本就是开源模式下成长起来的,许多成功的公司使用开源设计销售类似的打印机。Ember 3D 打印机的打包价约6000美元,包括了打

 相关资料
  • Ember检查器是一个浏览器插件,用于调试Ember应用程序。 灰烬检查员包括以下主题 - S.No. 灰烬检查员方式和描述 1 安装Inspector 您可以安装Ember检查器来调试您的应用程序。 2 Object Inspector Ember检查器允许与Ember对象进行交互。 3 The View Tree 视图树提供应用程序的当前状态。 4 检查路由,数据选项卡和库信息 您可以看到检查

  • 英文原文: http://emberjs.com/guides/getting-ember/index/ Ember构建 Ember的发布管理团队针对Ember和Ember Data维护了不同的发布方法。 频道 最新的Ember和Ember Data的 Release,Beta 和 Canary 构建可以在这里找到。每一个频道都提供了一个开发版、最小化版和生产版。更多关于不同频道的信息可以查看博客

  • ember-emojione ember-emojione is your emoji solution for Ember, based on the EmojiOne project. EmojiOne version 2 is used, which is free to use for everyone (CC BY-SA 4.0), you're only required to giv

  • Ember Table An addon to support large data set and a number of features around table. Ember Table canhandle over 100,000 rows without any rendering or performance issues. Ember Table 3.x supports: Emb

  • vscode-ember This is the VSCode extension to use the Ember Language Server. Features All features currently only work in Ember-CLI apps that use classic structure and are a rough first draft with a lo

  • ember-headlessui This is a work-in-progress implementation of: https://github.com/tailwindlabs/headlessui A set of completely unstyled, fully accessible UI components for Ember.js, designed to integra