Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor geometry generators. #21038

Merged
merged 3 commits into from
Jan 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function init() {

scene = new THREE.Scene();

geometry = new THREE.BoxBufferGeometry( 0.2, 0.2, 0.2 );
geometry = new THREE.BoxGeometry( 0.2, 0.2, 0.2 );
material = new THREE.MeshNormalMaterial();

mesh = new THREE.Mesh( geometry, material );
Expand All @@ -62,7 +62,7 @@ function animation( time ) {
}
```

If everything went well, you should see [this](https://jsfiddle.net/9v7eqwu1/).
If everything went well, you should see [this](https://jsfiddle.net/zdjankqw/).

### Cloning this repository ###

Expand Down
2 changes: 1 addition & 1 deletion docs/api/ar/audio/PositionalAudio.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ <h2>مثال التعليمة البرمجية</h2>
});

// create an object for the sound to play from
const sphere = new THREE.SphereBufferGeometry( 20, 32, 16 );
const sphere = new THREE.SphereGeometry( 20, 32, 16 );
const material = new THREE.MeshPhongMaterial( { color: 0xff2200 } );
const mesh = new THREE.Mesh( sphere, material );
scene.add( mesh );
Expand Down
2 changes: 1 addition & 1 deletion docs/api/en/audio/PositionalAudio.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ <h2>Code Example</h2>
});

// create an object for the sound to play from
const sphere = new THREE.SphereBufferGeometry( 20, 32, 16 );
const sphere = new THREE.SphereGeometry( 20, 32, 16 );
const material = new THREE.MeshPhongMaterial( { color: 0xff2200 } );
const mesh = new THREE.Mesh( sphere, material );
scene.add( mesh );
Expand Down
2 changes: 1 addition & 1 deletion docs/api/en/extras/core/Shape.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ <h2>Code Example</h2>

const extrudeSettings = { amount: 8, bevelEnabled: true, bevelSegments: 2, steps: 2, bevelSize: 1, bevelThickness: 1 };

const geometry = new THREE.ExtrudeBufferGeometry( heartShape, extrudeSettings );
const geometry = new THREE.ExtrudeGeometry( heartShape, extrudeSettings );

const mesh = new THREE.Mesh( geometry, new THREE.MeshPhongMaterial() );
</code>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ <h1>[name]</h1>
On creation, the cuboid is centred on the origin, with each edge parallel to one of the axes.
</p>

<iframe id="scene" src="scenes/geometry-browser.html#BoxBufferGeometry"></iframe>
<iframe id="scene" src="scenes/geometry-browser.html#BoxGeometry"></iframe>

<script>

Expand All @@ -36,7 +36,7 @@ <h1>[name]</h1>

<h2>Code Example</h2>

<code>const geometry = new THREE.BoxBufferGeometry( 1, 1, 1 );
<code>const geometry = new THREE.BoxGeometry( 1, 1, 1 );
const material = new THREE.MeshBasicMaterial( {color: 0x00ff00} );
const cube = new THREE.Mesh( geometry, material );
scene.add( cube );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ <h1>[name]</h1>
It can also be used to create regular polygons, where the number of segments determines the number of sides.
</p>

<iframe id="scene" src="scenes/geometry-browser.html#CircleBufferGeometry"></iframe>
<iframe id="scene" src="scenes/geometry-browser.html#CircleGeometry"></iframe>

<script>

Expand All @@ -39,7 +39,7 @@ <h1>[name]</h1>
<h2>Code Example</h2>

<code>
const geometry = new THREE.CircleBufferGeometry( 5, 32 );
const geometry = new THREE.CircleGeometry( 5, 32 );
const material = new THREE.MeshBasicMaterial( { color: 0xffff00 } );
const circle = new THREE.Mesh( geometry, material );
scene.add( circle );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
<link type="text/css" rel="stylesheet" href="page.css" />
</head>
<body>
[page:BufferGeometry] &rarr; [page:CylinderBufferGeometry] &rarr;
[page:BufferGeometry] &rarr; [page:CylinderGeometry] &rarr;

<h1>[name]</h1>

<p class="desc">A class for generating cone geometries.</p>

<iframe id="scene" src="scenes/geometry-browser.html#ConeBufferGeometry"></iframe>
<iframe id="scene" src="scenes/geometry-browser.html#ConeGeometry"></iframe>

<script>

Expand All @@ -33,7 +33,7 @@ <h1>[name]</h1>

<h2>Code Example</h2>

<code>const geometry = new THREE.ConeBufferGeometry( 5, 20, 32 );
<code>const geometry = new THREE.ConeGeometry( 5, 20, 32 );
const material = new THREE.MeshBasicMaterial( {color: 0xffff00} );
const cone = new THREE.Mesh( geometry, material );
scene.add( cone );
Expand All @@ -53,15 +53,15 @@ <h3>[name]([param:Float radius], [param:Float height], [param:Integer radialSegm
</p>

<h2>Properties</h2>
<p>See the base [page:CylinderBufferGeometry] class for common properties.</p>
<p>See the base [page:CylinderGeometry] class for common properties.</p>

<h3>[property:Object parameters]</h3>
<p>
An object with a property for each of the constructor parameters. Any modification after instantiation does not change the geometry.
</p>

<h2>Methods</h2>
<p>See the base [page:CylinderBufferGeometry] class for common methods.</p>
<p>See the base [page:CylinderGeometry] class for common methods.</p>

<h2>Source</h2>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ <h1>[name]</h1>

<p class="desc">A class for generating cylinder geometries.</p>

<iframe id="scene" src="scenes/geometry-browser.html#CylinderBufferGeometry"></iframe>
<iframe id="scene" src="scenes/geometry-browser.html#CylinderGeometry"></iframe>

<script>

Expand All @@ -33,7 +33,7 @@ <h1>[name]</h1>

<h2>Code Example</h2>

<code>const geometry = new THREE.CylinderBufferGeometry( 5, 5, 20, 32 );
<code>const geometry = new THREE.CylinderGeometry( 5, 5, 20, 32 );
const material = new THREE.MeshBasicMaterial( {color: 0xffff00} );
const cylinder = new THREE.Mesh( geometry, material );
scene.add( cylinder );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
<link type="text/css" rel="stylesheet" href="page.css" />
</head>
<body>
[page:BufferGeometry] &rarr; [page:PolyhedronBufferGeometry] &rarr;
[page:BufferGeometry] &rarr; [page:PolyhedronGeometry] &rarr;

<h1>[name]</h1>

<p class="desc">A class for generating a dodecahedron geometries.</p>

<iframe id="scene" src="scenes/geometry-browser.html#DodecahedronBufferGeometry"></iframe>
<iframe id="scene" src="scenes/geometry-browser.html#DodecahedronGeometry"></iframe>

<script>

Expand All @@ -40,15 +40,15 @@ <h3>[name]([param:Float radius], [param:Integer detail])</h3>
</p>

<h2>Properties</h2>
<p>See the base [page:PolyhedronBufferGeometry] class for common properties.</p>
<p>See the base [page:PolyhedronGeometry] class for common properties.</p>

<h3>[property:Object parameters]</h3>
<p>
An object with a property for each of the constructor parameters. Any modification after instantiation does not change the geometry.
</p>

<h2>Methods</h2>
<p>See the base [page:PolyhedronBufferGeometry] class for common methods.</p>
<p>See the base [page:PolyhedronGeometry] class for common methods.</p>

<h2>Source</h2>

Expand Down
2 changes: 1 addition & 1 deletion docs/api/en/geometries/EdgesGeometry.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ <h1>[name]</h1>
<h2>Code Example</h2>

<code>
const geometry = new THREE.BoxBufferGeometry( 100, 100, 100 );
const geometry = new THREE.BoxGeometry( 100, 100, 100 );
const edges = new THREE.EdgesGeometry( geometry );
const line = new THREE.LineSegments( edges, new THREE.LineBasicMaterial( { color: 0xffffff } ) );
scene.add( line );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ <h1>[name]</h1>

<p class="desc">Creates extruded geometry from a path shape.</p>

<iframe id="scene" src="scenes/geometry-browser.html#ExtrudeBufferGeometry"></iframe>
<iframe id="scene" src="scenes/geometry-browser.html#ExtrudeGeometry"></iframe>

<script>

Expand Down Expand Up @@ -54,7 +54,7 @@ <h2>Code Example</h2>
bevelSegments: 1
};

const geometry = new THREE.ExtrudeBufferGeometry( shape, extrudeSettings );
const geometry = new THREE.ExtrudeGeometry( shape, extrudeSettings );
const material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } );
const mesh = new THREE.Mesh( geometry, material ) ;
scene.add( mesh );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
<link type="text/css" rel="stylesheet" href="page.css" />
</head>
<body>
[page:BufferGeometry] &rarr; [page:PolyhedronBufferGeometry] &rarr;
[page:BufferGeometry] &rarr; [page:PolyhedronGeometry] &rarr;
<h1>[name]</h1>

<p class="desc">A class for generating an icosahedron geometry.</p>

<iframe id="scene" src="scenes/geometry-browser.html#IcosahedronBufferGeometry"></iframe>
<iframe id="scene" src="scenes/geometry-browser.html#IcosahedronGeometry"></iframe>

<script>

Expand All @@ -39,15 +39,15 @@ <h3>[name]([param:Float radius], [param:Integer detail])</h3>
</p>

<h2>Properties</h2>
<p>See the base [page:PolyhedronBufferGeometry] class for common properties.</p>
<p>See the base [page:PolyhedronGeometry] class for common properties.</p>

<h3>[property:Object parameters]</h3>
<p>
An object with a property for each of the constructor parameters. Any modification after instantiation does not change the geometry.
</p>

<h2>Methods</h2>
<p>See the base [page:PolyhedronBufferGeometry] class for common methods.</p>
<p>See the base [page:PolyhedronGeometry] class for common methods.</p>

<h2>Source</h2>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ <h1>[name]</h1>

<p class="desc">Creates meshes with axial symmetry like vases. The lathe rotates around the Y axis.</p>

<iframe id="scene" src="scenes/geometry-browser.html#LatheBufferGeometry"></iframe>
<iframe id="scene" src="scenes/geometry-browser.html#LatheGeometry"></iframe>

<script>

Expand All @@ -38,7 +38,7 @@ <h2>Code Example</h2>
for ( let i = 0; i < 10; i ++ ) {
points.push( new THREE.Vector2( Math.sin( i * 0.2 ) * 10 + 5, ( i - 5 ) * 2 ) );
}
const geometry = new THREE.LatheBufferGeometry( points );
const geometry = new THREE.LatheGeometry( points );
const material = new THREE.MeshBasicMaterial( { color: 0xffff00 } );
const lathe = new THREE.Mesh( geometry, material );
scene.add( lathe );
Expand All @@ -54,7 +54,7 @@ <h3>[name]([param:Array points], [param:Integer segments], [param:Float phiStart
phiLength — the radian (0 to 2PI) range of the lathed section 2PI is a closed lathe, less than 2PI is a portion. Default is 2PI.
</p>
<p>
This creates a LatheBufferGeometry based on the parameters.
This creates a [name] based on the parameters.
</p>

<h2>Properties</h2>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
<link type="text/css" rel="stylesheet" href="page.css" />
</head>
<body>
[page:BufferGeometry] &rarr; [page:PolyhedronBufferGeometry] &rarr;
[page:BufferGeometry] &rarr; [page:PolyhedronGeometry] &rarr;
<h1>[name]</h1>

<p class="desc">A class for generating an octahedron geometry.</p>

<iframe id="scene" src="scenes/geometry-browser.html#OctahedronBufferGeometry"></iframe>
<iframe id="scene" src="scenes/geometry-browser.html#OctahedronGeometry"></iframe>

<script>

Expand All @@ -39,15 +39,15 @@ <h3>[name]([param:Float radius], [param:Integer detail])</h3>
</p>

<h2>Properties</h2>
<p>See the base [page:PolyhedronBufferGeometry] class for common properties.</p>
<p>See the base [page:PolyhedronGeometry] class for common properties.</p>

<h3>[property:Object parameters]</h3>
<p>
An object with a property for each of the constructor parameters. Any modification after instantiation does not change the geometry.
</p>

<h2>Methods</h2>
<p>See the base [page:PolyhedronBufferGeometry] class for common methods.</p>
<p>See the base [page:PolyhedronGeometry] class for common methods.</p>

<h2>Source</h2>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ <h1>[name]</h1>

<p class="desc">Generate geometry representing a parametric surface.</p>

<iframe id="scene" src="scenes/geometry-browser.html#ParametricBufferGeometry"></iframe>
<iframe id="scene" src="scenes/geometry-browser.html#ParametricGeometry"></iframe>

<script>

Expand All @@ -34,7 +34,7 @@ <h1>[name]</h1>
<h2>Code Example</h2>

<code>
const geometry = new THREE.ParametricBufferGeometry( THREE.ParametricGeometries.klein, 25, 25 );
const geometry = new THREE.ParametricGeometry( THREE.ParametricGeometries.klein, 25, 25 );
const material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } );
const klein = new THREE.Mesh( geometry, material );
scene.add( klein );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ <h1>[name]</h1>

<p class="desc">A class for generating plane geometries.</p>

<iframe id="scene" src="scenes/geometry-browser.html#PlaneBufferGeometry"></iframe>
<iframe id="scene" src="scenes/geometry-browser.html#PlaneGeometry"></iframe>

<script>

Expand All @@ -33,7 +33,7 @@ <h1>[name]</h1>

<h2>Code Example</h2>

<code>const geometry = new THREE.PlaneBufferGeometry( 5, 20, 32 );
<code>const geometry = new THREE.PlaneGeometry( 5, 20, 32 );
const material = new THREE.MeshBasicMaterial( {color: 0xffff00, side: THREE.DoubleSide} );
const plane = new THREE.Mesh( geometry, material );
scene.add( plane );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ <h1>[name]</h1>
<p class="desc">
A polyhedron is a solid in three dimensions with flat faces. This class will take an array of vertices,
project them onto a sphere, and then divide them up to the desired level of detail. This class is used
by [page:DodecahedronBufferGeometry], [page:IcosahedronBufferGeometry], [page:OctahedronBufferGeometry],
and [page:TetrahedronBufferGeometry] to generate their respective geometries.
by [page:DodecahedronGeometry], [page:IcosahedronGeometry], [page:OctahedronGeometry],
and [page:TetrahedronGeometry] to generate their respective geometries.
</p>

<h2>Code Example</h2>
Expand All @@ -34,7 +34,7 @@ <h2>Code Example</h2>
4,5,6, 6,7,4
];

const geometry = new THREE.PolyhedronBufferGeometry( verticesOfCube, indicesOfFaces, 6, 2 );
const geometry = new THREE.PolyhedronGeometry( verticesOfCube, indicesOfFaces, 6, 2 );
</code>

<h2>Constructor</h2>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ <h1>[name]</h1>

<p class="desc">A class for generating a two-dimensional ring geometry.</p>

<iframe id="scene" src="scenes/geometry-browser.html#RingBufferGeometry"></iframe>
<iframe id="scene" src="scenes/geometry-browser.html#RingGeometry"></iframe>

<script>

Expand All @@ -33,7 +33,7 @@ <h1>[name]</h1>

<h2>Code Example</h2>

<code>const geometry = new THREE.RingBufferGeometry( 1, 5, 32 );
<code>const geometry = new THREE.RingGeometry( 1, 5, 32 );
const material = new THREE.MeshBasicMaterial( { color: 0xffff00, side: THREE.DoubleSide } );
const mesh = new THREE.Mesh( geometry, material );
scene.add( mesh );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ <h1>[name]</h1>

<p class="desc">Creates an one-sided polygonal geometry from one or more path shapes.</p>

<iframe id="scene" src="scenes/geometry-browser.html#ShapeBufferGeometry"></iframe>
<iframe id="scene" src="scenes/geometry-browser.html#ShapeGeometry"></iframe>

<script>

Expand Down Expand Up @@ -48,7 +48,7 @@ <h2>Code Example</h2>
heartShape.bezierCurveTo( x + 16, y + 7, x + 16, y, x + 10, y );
heartShape.bezierCurveTo( x + 7, y, x + 5, y + 5, x + 5, y + 5 );

const geometry = new THREE.ShapeBufferGeometry( heartShape );
const geometry = new THREE.ShapeGeometry( heartShape );
const material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } );
const mesh = new THREE.Mesh( geometry, material ) ;
scene.add( mesh );
Expand Down
Loading