mirror of
https://github.com/tengge1/ShadowEditor.git
synced 2026-01-25 15:08:11 +00:00
添加圆。
This commit is contained in:
parent
83f8b37e04
commit
f8a46aa5ef
@ -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()));
|
||||
};
|
||||
|
||||
// ------------------------圆柱体 -------------------------------
|
||||
|
||||
17
ShadowEditor.Web/src/object/geometry/Circle.js
Normal file
17
ShadowEditor.Web/src/object/geometry/Circle.js
Normal 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;
|
||||
Loading…
x
Reference in New Issue
Block a user