new SphereGeometry(radiusopt, widthSegmentsopt, heightSegmentsopt, phiStartopt, phiLengthopt, thetaStartopt, thetaLengthopt)
A class for generating sphere geometries.
The geometry is created by sweeping and calculating vertexes around the Y axis (horizontal sweep) and the Z axis (vertical sweep).
Thus, incomplete spheres (akin to 'sphere slices') can be created through the use of different values of phiStart, phiLength, thetaStart and thetaLength, in order to define the points in which we start (or end) calculating those vertices.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
radius |
number |
<optional> |
1 | — sphere radius. Default is 1. |
widthSegments |
Integer |
<optional> |
8 | — number of horizontal segments. Minimum value is 3, and the default is 8. |
heightSegments |
Integer |
<optional> |
6 | — number of vertical segments. Minimum value is 2, and the default is 6. |
phiStart |
number |
<optional> |
0 | — specify horizontal starting angle. Default is 0. |
phiLength |
number |
<optional> |
Math.PI*2 | — specify horizontal sweep angle size. Default is Math.PI * 2. |
thetaStart |
number |
<optional> |
0 | — specify vertical starting angle. Default is 0. |
thetaLength |
number |
<optional> |
Math.PI | — specify vertical sweep angle size. Default is Math.PI. |
- Source:
Extends
Members
attributes :Object
This hashmap has as id the name of the attribute to be set and as value the buffer to set it to.
Rather than accessing this property directly, use zen3d.Geometry#addAttribute and zen3d.Geometry#getAttribute to access attributes of this geometry.
Type:
- Object
- Inherited From:
- Source:
boundingBox :zen3d.Box3
Bounding box for the bufferGeometry, which can be calculated with zen3d.Geometry#computeBoundingBox.
Type:
- Inherited From:
- Default Value:
- zen3d.Box3()
- Source:
boundingSphere :zen3d.Sphere
Bounding sphere for the bufferGeometry, which can be calculated with zen3d.Geometry#computeBoundingSphere.
Type:
- Inherited From:
- Default Value:
- zen3d.Sphere()
- Source:
groups :Array
Split the geometry into groups, each of which will be rendered in a separate WebGL draw call. This allows an array of materials to be used with the geometry.
Each group is an object of the form:
{ start: Integer, count: Integer, materialIndex: Integer }
Type:
- Array
- Inherited From:
- Default Value:
- []
- Source:
index :zen3d.BufferAttribute|null
Allows for vertices to be re-used across multiple triangles; this is called using "indexed triangles" and each triangle is associated with the indices of three vertices.
This attribute therefore stores the index of each vertex for each triangular face.
If this attribute is not set, the renderer assumes that each three contiguous positions represent a single triangle.
Type:
- zen3d.BufferAttribute | null
- Inherited From:
- Source:
morphAttributes :Object
Hashmap of Attributes Array for morph targets.
Type:
- Object
- Inherited From:
- Source:
uuid :string
UUID of this geometry instance.
This gets automatically assigned, so this shouldn't be edited.
Type:
- string
- Inherited From:
- Source:
version :Integer
A version number, incremented every time the attribute object or index object changes to mark VAO drity.
Type:
- Integer
- Inherited From:
- Default Value:
- 0
- Source:
Methods
addAttribute(name, attribute)
Adds an attribute to this geometry.
Use this rather than the attributes property.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | |
attribute |
zen3d.BufferAttribute | zen3d.InterleavedBufferAttribute |
- Inherited From:
- Source:
addEventListener(type, listener, thisObjectopt)
Adds a listener to an event type.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
type |
string | The type of event to listen to. | ||
listener |
function | The function that gets called when the event is fired. | ||
thisObject |
Object |
<optional> |
this | The Object of calling listener method. |
- Inherited From:
- Source:
addGroup(start, count, materialIndex)
Adds a group to this geometry; see the zen3d.Geometry#groups for details.
Parameters:
Name | Type | Description |
---|---|---|
start |
Integer | |
count |
Integer | |
materialIndex |
Integer |
- Inherited From:
- Source:
clearGroups()
Clears all groups.
- Inherited From:
- Source:
clone() → {zen3d.Geometry}
Creates a clone of this Geometry.
- Inherited From:
- Source:
Returns:
- Type
- zen3d.Geometry
computeBoundingBox()
Computes bounding box of the geometry, updating zen3d.Geometry#boundingBox.
Bounding boxes aren't computed by default. They need to be explicitly computed.
- Inherited From:
- Source:
computeBoundingSphere()
Computes bounding sphere of the geometry, updating zen3d.Geometry#boundingSphere.
Bounding spheres aren't computed by default. They need to be explicitly computed.
- Inherited From:
- Source:
copy(source) → {zen3d.Geometry}
Copies another Geometry to this Geometry.
Parameters:
Name | Type | Description |
---|---|---|
source |
zen3d.Geometry | The geometry to be copied. |
- Inherited From:
- Source:
Returns:
- Type
- zen3d.Geometry
dispatchEvent(event)
Fire an event type.
Parameters:
Name | Type | Description |
---|---|---|
event |
Object | The event that gets fired. |
- Inherited From:
- Source:
dispose()
Disposes the object from memory.
You need to call this when you want the BufferGeometry removed while the application is running.
- Inherited From:
- Source:
getAttribute() → {zen3d.BufferAttribute|zen3d.InterleavedBufferAttribute}
Returns the attribute with the specified name.
- Inherited From:
- Source:
Returns:
removeAttribute()
Removes the attribute with the specified name.
- Inherited From:
- Source:
removeEventListener(type, listener, thisObjectopt)
Removes a listener from an event type.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
type |
string | The type of the listener that gets removed. | ||
listener |
function | The listener function that gets removed. | ||
thisObject |
Object |
<optional> |
this | thisObject - The Object of calling listener method. |
- Inherited From:
- Source:
setIndex(index)
Set the zen3d.Geometry#index buffer.
Parameters:
Name | Type | Description |
---|---|---|
index |
Array | zen3d.BufferAttribute |
- Inherited From:
- Source: