提交 ff340dc7 编写于 作者: M Mr.doob

Editor: Switched to BufferGeometry. See #8617.

上级 40578c96
...@@ -56,7 +56,7 @@ Menubar.Add = function ( editor ) { ...@@ -56,7 +56,7 @@ Menubar.Add = function ( editor ) {
option.setTextContent( 'Plane' ); option.setTextContent( 'Plane' );
option.onClick( function () { option.onClick( function () {
var geometry = new THREE.PlaneGeometry( 2, 2 ); var geometry = new THREE.PlaneBufferGeometry( 2, 2 );
var material = new THREE.MeshStandardMaterial(); var material = new THREE.MeshStandardMaterial();
var mesh = new THREE.Mesh( geometry, material ); var mesh = new THREE.Mesh( geometry, material );
mesh.name = 'Plane ' + ( ++ meshCount ); mesh.name = 'Plane ' + ( ++ meshCount );
...@@ -73,7 +73,7 @@ Menubar.Add = function ( editor ) { ...@@ -73,7 +73,7 @@ Menubar.Add = function ( editor ) {
option.setTextContent( 'Box' ); option.setTextContent( 'Box' );
option.onClick( function () { option.onClick( function () {
var geometry = new THREE.BoxGeometry( 1, 1, 1 ); var geometry = new THREE.BoxBufferGeometry( 1, 1, 1 );
var mesh = new THREE.Mesh( geometry, new THREE.MeshStandardMaterial() ); var mesh = new THREE.Mesh( geometry, new THREE.MeshStandardMaterial() );
mesh.name = 'Box ' + ( ++ meshCount ); mesh.name = 'Box ' + ( ++ meshCount );
...@@ -92,7 +92,7 @@ Menubar.Add = function ( editor ) { ...@@ -92,7 +92,7 @@ Menubar.Add = function ( editor ) {
var radius = 1; var radius = 1;
var segments = 32; var segments = 32;
var geometry = new THREE.CircleGeometry( radius, segments ); var geometry = new THREE.CircleBufferGeometry( radius, segments );
var mesh = new THREE.Mesh( geometry, new THREE.MeshStandardMaterial() ); var mesh = new THREE.Mesh( geometry, new THREE.MeshStandardMaterial() );
mesh.name = 'Circle ' + ( ++ meshCount ); mesh.name = 'Circle ' + ( ++ meshCount );
...@@ -115,7 +115,7 @@ Menubar.Add = function ( editor ) { ...@@ -115,7 +115,7 @@ Menubar.Add = function ( editor ) {
var heightSegments = 1; var heightSegments = 1;
var openEnded = false; var openEnded = false;
var geometry = new THREE.CylinderGeometry( radiusTop, radiusBottom, height, radiusSegments, heightSegments, openEnded ); var geometry = new THREE.CylinderBufferGeometry( radiusTop, radiusBottom, height, radiusSegments, heightSegments, openEnded );
var mesh = new THREE.Mesh( geometry, new THREE.MeshStandardMaterial() ); var mesh = new THREE.Mesh( geometry, new THREE.MeshStandardMaterial() );
mesh.name = 'Cylinder ' + ( ++ meshCount ); mesh.name = 'Cylinder ' + ( ++ meshCount );
...@@ -139,7 +139,7 @@ Menubar.Add = function ( editor ) { ...@@ -139,7 +139,7 @@ Menubar.Add = function ( editor ) {
var thetaStart = 0; var thetaStart = 0;
var thetaLength = Math.PI; var thetaLength = Math.PI;
var geometry = new THREE.SphereGeometry( radius, widthSegments, heightSegments, phiStart, phiLength, thetaStart, thetaLength ); var geometry = new THREE.SphereBufferGeometry( radius, widthSegments, heightSegments, phiStart, phiLength, thetaStart, thetaLength );
var mesh = new THREE.Mesh( geometry, new THREE.MeshStandardMaterial() ); var mesh = new THREE.Mesh( geometry, new THREE.MeshStandardMaterial() );
mesh.name = 'Sphere ' + ( ++ meshCount ); mesh.name = 'Sphere ' + ( ++ meshCount );
...@@ -180,7 +180,7 @@ Menubar.Add = function ( editor ) { ...@@ -180,7 +180,7 @@ Menubar.Add = function ( editor ) {
var tubularSegments = 12; var tubularSegments = 12;
var arc = Math.PI * 2; var arc = Math.PI * 2;
var geometry = new THREE.TorusGeometry( radius, tube, radialSegments, tubularSegments, arc ); var geometry = new THREE.TorusBufferGeometry( radius, tube, radialSegments, tubularSegments, arc );
var mesh = new THREE.Mesh( geometry, new THREE.MeshStandardMaterial() ); var mesh = new THREE.Mesh( geometry, new THREE.MeshStandardMaterial() );
mesh.name = 'Torus ' + ( ++ meshCount ); mesh.name = 'Torus ' + ( ++ meshCount );
...@@ -203,7 +203,7 @@ Menubar.Add = function ( editor ) { ...@@ -203,7 +203,7 @@ Menubar.Add = function ( editor ) {
var p = 2; var p = 2;
var q = 3; var q = 3;
var geometry = new THREE.TorusKnotGeometry( radius, tube, tubularSegments, radialSegments, p, q ); var geometry = new THREE.TorusKnotBufferGeometry( radius, tube, tubularSegments, radialSegments, p, q );
var mesh = new THREE.Mesh( geometry, new THREE.MeshStandardMaterial() ); var mesh = new THREE.Mesh( geometry, new THREE.MeshStandardMaterial() );
mesh.name = 'TorusKnot ' + ( ++ meshCount ); mesh.name = 'TorusKnot ' + ( ++ meshCount );
...@@ -265,7 +265,7 @@ Menubar.Add = function ( editor ) { ...@@ -265,7 +265,7 @@ Menubar.Add = function ( editor ) {
var phiStart = 0; var phiStart = 0;
var phiLength = 2 * Math.PI; var phiLength = 2 * Math.PI;
var geometry = new THREE.LatheGeometry( points, segments, phiStart, phiLength ); var geometry = new THREE.LatheBufferGeometry( points, segments, phiStart, phiLength );
var mesh = new THREE.Mesh( geometry, new THREE.MeshStandardMaterial( { side: THREE.DoubleSide } ) ); var mesh = new THREE.Mesh( geometry, new THREE.MeshStandardMaterial( { side: THREE.DoubleSide } ) );
mesh.name = 'Lathe ' + ( ++ meshCount ); mesh.name = 'Lathe ' + ( ++ meshCount );
......
...@@ -8,7 +8,8 @@ Sidebar.Geometry.BoxGeometry = function ( editor, object ) { ...@@ -8,7 +8,8 @@ Sidebar.Geometry.BoxGeometry = function ( editor, object ) {
var container = new UI.Row(); var container = new UI.Row();
var parameters = object.geometry.parameters; var geometry = object.geometry;
var parameters = geometry.parameters;
// width // width
...@@ -74,7 +75,7 @@ Sidebar.Geometry.BoxGeometry = function ( editor, object ) { ...@@ -74,7 +75,7 @@ Sidebar.Geometry.BoxGeometry = function ( editor, object ) {
function update() { function update() {
editor.execute( new SetGeometryCommand( object, new THREE.BoxGeometry( editor.execute( new SetGeometryCommand( object, new THREE[ geometry.type ](
width.getValue(), width.getValue(),
height.getValue(), height.getValue(),
depth.getValue(), depth.getValue(),
...@@ -87,4 +88,6 @@ Sidebar.Geometry.BoxGeometry = function ( editor, object ) { ...@@ -87,4 +88,6 @@ Sidebar.Geometry.BoxGeometry = function ( editor, object ) {
return container; return container;
} };
Sidebar.Geometry.BoxBufferGeometry = Sidebar.Geometry.BoxGeometry;
...@@ -8,7 +8,8 @@ Sidebar.Geometry.CircleGeometry = function ( editor, object ) { ...@@ -8,7 +8,8 @@ Sidebar.Geometry.CircleGeometry = function ( editor, object ) {
var container = new UI.Row(); var container = new UI.Row();
var parameters = object.geometry.parameters; var geometry = object.geometry;
var parameters = geometry.parameters;
// radius // radius
...@@ -54,7 +55,7 @@ Sidebar.Geometry.CircleGeometry = function ( editor, object ) { ...@@ -54,7 +55,7 @@ Sidebar.Geometry.CircleGeometry = function ( editor, object ) {
function update() { function update() {
editor.execute( new SetGeometryCommand( object, new THREE.CircleGeometry( editor.execute( new SetGeometryCommand( object, new THREE[ geometry.type ](
radius.getValue(), radius.getValue(),
segments.getValue(), segments.getValue(),
thetaStart.getValue(), thetaStart.getValue(),
...@@ -65,4 +66,6 @@ Sidebar.Geometry.CircleGeometry = function ( editor, object ) { ...@@ -65,4 +66,6 @@ Sidebar.Geometry.CircleGeometry = function ( editor, object ) {
return container; return container;
} };
Sidebar.Geometry.CircleBufferGeometry = Sidebar.Geometry.CircleGeometry;
...@@ -8,7 +8,8 @@ Sidebar.Geometry.CylinderGeometry = function ( editor, object ) { ...@@ -8,7 +8,8 @@ Sidebar.Geometry.CylinderGeometry = function ( editor, object ) {
var container = new UI.Row(); var container = new UI.Row();
var parameters = object.geometry.parameters; var geometry = object.geometry;
var parameters = geometry.parameters;
// radiusTop // radiusTop
...@@ -74,7 +75,7 @@ Sidebar.Geometry.CylinderGeometry = function ( editor, object ) { ...@@ -74,7 +75,7 @@ Sidebar.Geometry.CylinderGeometry = function ( editor, object ) {
function update() { function update() {
editor.execute( new SetGeometryCommand( object, new THREE.CylinderGeometry( editor.execute( new SetGeometryCommand( object, new THREE[ geometry.type ](
radiusTop.getValue(), radiusTop.getValue(),
radiusBottom.getValue(), radiusBottom.getValue(),
height.getValue(), height.getValue(),
...@@ -87,4 +88,6 @@ Sidebar.Geometry.CylinderGeometry = function ( editor, object ) { ...@@ -87,4 +88,6 @@ Sidebar.Geometry.CylinderGeometry = function ( editor, object ) {
return container; return container;
} };
Sidebar.Geometry.CylinderBufferGeometry = Sidebar.Geometry.CylinderGeometry;
...@@ -30,7 +30,7 @@ Sidebar.Geometry.Geometry = function ( editor ) { ...@@ -30,7 +30,7 @@ Sidebar.Geometry.Geometry = function ( editor ) {
// //
var update = function ( object ) { function update( object ) {
if ( object === null ) return; if ( object === null ) return;
...@@ -49,11 +49,11 @@ Sidebar.Geometry.Geometry = function ( editor ) { ...@@ -49,11 +49,11 @@ Sidebar.Geometry.Geometry = function ( editor ) {
} }
}; }
signals.objectSelected.add( update ); signals.objectSelected.add( update );
signals.geometryChanged.add( update ); signals.geometryChanged.add( update );
return container; return container;
} };
...@@ -8,7 +8,8 @@ Sidebar.Geometry.IcosahedronGeometry = function ( editor, object ) { ...@@ -8,7 +8,8 @@ Sidebar.Geometry.IcosahedronGeometry = function ( editor, object ) {
var container = new UI.Row(); var container = new UI.Row();
var parameters = object.geometry.parameters; var geometry = object.geometry;
var parameters = geometry.parameters;
// radius // radius
...@@ -35,7 +36,7 @@ Sidebar.Geometry.IcosahedronGeometry = function ( editor, object ) { ...@@ -35,7 +36,7 @@ Sidebar.Geometry.IcosahedronGeometry = function ( editor, object ) {
function update() { function update() {
editor.execute( new SetGeometryCommand( object, new THREE.IcosahedronGeometry( editor.execute( new SetGeometryCommand( object, new THREE[ geometry.type ](
radius.getValue(), radius.getValue(),
detail.getValue() detail.getValue()
) ) ); ) ) );
...@@ -46,4 +47,6 @@ Sidebar.Geometry.IcosahedronGeometry = function ( editor, object ) { ...@@ -46,4 +47,6 @@ Sidebar.Geometry.IcosahedronGeometry = function ( editor, object ) {
return container; return container;
} };
Sidebar.Geometry.IcosahedronBufferGeometry = Sidebar.Geometry.IcosahedronGeometry;
...@@ -8,7 +8,8 @@ Sidebar.Geometry.LatheGeometry = function( editor, object ) { ...@@ -8,7 +8,8 @@ Sidebar.Geometry.LatheGeometry = function( editor, object ) {
var container = new UI.Row(); var container = new UI.Row();
var parameters = object.geometry.parameters; var geometry = object.geometry;
var parameters = geometry.parameters;
// segments // segments
...@@ -133,17 +134,17 @@ Sidebar.Geometry.LatheGeometry = function( editor, object ) { ...@@ -133,17 +134,17 @@ Sidebar.Geometry.LatheGeometry = function( editor, object ) {
} }
var geometry = new THREE.LatheGeometry( editor.execute( new SetGeometryCommand( object, new THREE[ geometry.type ](
points, points,
segments.getValue(), segments.getValue(),
phiStart.getValue() / 180 * Math.PI, phiStart.getValue() / 180 * Math.PI,
phiLength.getValue() / 180 * Math.PI phiLength.getValue() / 180 * Math.PI
); ) ) );
editor.execute( new SetGeometryCommand( object, geometry ) );
} }
return container; return container;
}; };
Sidebar.Geometry.LatheBufferGeometry = Sidebar.Geometry.LatheGeometry;
...@@ -8,7 +8,8 @@ Sidebar.Geometry.PlaneGeometry = function ( editor, object ) { ...@@ -8,7 +8,8 @@ Sidebar.Geometry.PlaneGeometry = function ( editor, object ) {
var container = new UI.Row(); var container = new UI.Row();
var parameters = object.geometry.parameters; var geometry = object.geometry;
var parameters = geometry.parameters;
// width // width
...@@ -55,7 +56,7 @@ Sidebar.Geometry.PlaneGeometry = function ( editor, object ) { ...@@ -55,7 +56,7 @@ Sidebar.Geometry.PlaneGeometry = function ( editor, object ) {
function update() { function update() {
editor.execute( new SetGeometryCommand( object, new THREE.PlaneGeometry( editor.execute( new SetGeometryCommand( object, new THREE[ geometry.type ](
width.getValue(), width.getValue(),
height.getValue(), height.getValue(),
widthSegments.getValue(), widthSegments.getValue(),
...@@ -66,4 +67,6 @@ Sidebar.Geometry.PlaneGeometry = function ( editor, object ) { ...@@ -66,4 +67,6 @@ Sidebar.Geometry.PlaneGeometry = function ( editor, object ) {
return container; return container;
} };
Sidebar.Geometry.PlaneBufferGeometry = Sidebar.Geometry.PlaneGeometry;
...@@ -8,7 +8,8 @@ Sidebar.Geometry.SphereGeometry = function ( editor, object ) { ...@@ -8,7 +8,8 @@ Sidebar.Geometry.SphereGeometry = function ( editor, object ) {
var container = new UI.Row(); var container = new UI.Row();
var parameters = object.geometry.parameters; var geometry = object.geometry;
var parameters = geometry.parameters;
// radius // radius
...@@ -85,7 +86,7 @@ Sidebar.Geometry.SphereGeometry = function ( editor, object ) { ...@@ -85,7 +86,7 @@ Sidebar.Geometry.SphereGeometry = function ( editor, object ) {
function update() { function update() {
editor.execute( new SetGeometryCommand( object, new THREE.SphereGeometry( editor.execute( new SetGeometryCommand( object, new THREE[ geometry.type ](
radius.getValue(), radius.getValue(),
widthSegments.getValue(), widthSegments.getValue(),
heightSegments.getValue(), heightSegments.getValue(),
...@@ -99,4 +100,6 @@ Sidebar.Geometry.SphereGeometry = function ( editor, object ) { ...@@ -99,4 +100,6 @@ Sidebar.Geometry.SphereGeometry = function ( editor, object ) {
return container; return container;
} };
Sidebar.Geometry.SphereBufferGeometry = Sidebar.Geometry.SphereGeometry;
...@@ -100,4 +100,4 @@ Sidebar.Geometry.TeapotBufferGeometry = function ( signals, object ) { ...@@ -100,4 +100,4 @@ Sidebar.Geometry.TeapotBufferGeometry = function ( signals, object ) {
return container; return container;
} };
...@@ -8,7 +8,8 @@ Sidebar.Geometry.TorusGeometry = function ( editor, object ) { ...@@ -8,7 +8,8 @@ Sidebar.Geometry.TorusGeometry = function ( editor, object ) {
var container = new UI.Row(); var container = new UI.Row();
var parameters = object.geometry.parameters; var geometry = object.geometry;
var parameters = geometry.parameters;
// radius // radius
...@@ -65,7 +66,7 @@ Sidebar.Geometry.TorusGeometry = function ( editor, object ) { ...@@ -65,7 +66,7 @@ Sidebar.Geometry.TorusGeometry = function ( editor, object ) {
function update() { function update() {
editor.execute( new SetGeometryCommand( object, new THREE.TorusGeometry( editor.execute( new SetGeometryCommand( object, new THREE[ geometry.type ](
radius.getValue(), radius.getValue(),
tube.getValue(), tube.getValue(),
radialSegments.getValue(), radialSegments.getValue(),
...@@ -77,4 +78,6 @@ Sidebar.Geometry.TorusGeometry = function ( editor, object ) { ...@@ -77,4 +78,6 @@ Sidebar.Geometry.TorusGeometry = function ( editor, object ) {
return container; return container;
} };
Sidebar.Geometry.TorusBufferGeometry = Sidebar.Geometry.TorusGeometry;
...@@ -8,7 +8,8 @@ Sidebar.Geometry.TorusKnotGeometry = function ( editor, object ) { ...@@ -8,7 +8,8 @@ Sidebar.Geometry.TorusKnotGeometry = function ( editor, object ) {
var container = new UI.Row(); var container = new UI.Row();
var parameters = object.geometry.parameters; var geometry = object.geometry;
var parameters = geometry.parameters;
// radius // radius
...@@ -75,7 +76,7 @@ Sidebar.Geometry.TorusKnotGeometry = function ( editor, object ) { ...@@ -75,7 +76,7 @@ Sidebar.Geometry.TorusKnotGeometry = function ( editor, object ) {
function update() { function update() {
editor.execute( new SetGeometryCommand( object, new THREE.TorusKnotGeometry( editor.execute( new SetGeometryCommand( object, new THREE[ geometry.type ](
radius.getValue(), radius.getValue(),
tube.getValue(), tube.getValue(),
tubularSegments.getValue(), tubularSegments.getValue(),
...@@ -88,4 +89,6 @@ Sidebar.Geometry.TorusKnotGeometry = function ( editor, object ) { ...@@ -88,4 +89,6 @@ Sidebar.Geometry.TorusKnotGeometry = function ( editor, object ) {
return container; return container;
} };
Sidebar.Geometry.TorusKnotBufferGeometry = Sidebar.Geometry.TorusKnotGeometry;
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册