添加圆。

This commit is contained in:
liteng 2018-09-29 07:58:16 +08:00
parent 83f8b37e04
commit f8a46aa5ef
2 changed files with 19 additions and 12 deletions

View File

@ -4,6 +4,7 @@ import StringUtils from '../../utils/StringUtils';
import Plane from '../../object/geometry/Plane';
import Box from '../../object/geometry/Box';
import Circle from '../../object/geometry/Circle';
import PointLight from '../../object/light/PointLight';
import HemisphereLight from '../../object/light/HemisphereLight';
@ -167,18 +168,7 @@ AddMenu.prototype.addBox = function () {
// ------------------------ 圆 ----------------------------------
AddMenu.prototype.addCircle = function () {
var editor = this.app.editor;
var radius = 1;
var segments = 32;
var geometry = new THREE.CircleBufferGeometry(radius, segments);
var mesh = new THREE.Mesh(geometry, new THREE.MeshStandardMaterial());
mesh.name = '圆';
mesh.castShadow = true;
mesh.receiveShadow = true;
editor.execute(new AddObjectCommand(mesh));
this.app.editor.execute(new AddObjectCommand(new Circle()));
};
// ------------------------圆柱体 -------------------------------

View File

@ -0,0 +1,17 @@
/**
*
* @param {*} geometry 几何体
* @param {*} material 材质
*/
function Circle(geometry = new THREE.CircleBufferGeometry(1, 32), material = new THREE.MeshStandardMaterial()) {
THREE.Mesh.call(this, geometry, material);
this.name = '圆';
this.castShadow = true;
this.receiveShadow = true;
}
Circle.prototype = Object.create(THREE.Mesh.prototype);
Circle.prototype.constructor = Circle;
export default Circle;