Class SphereShape
Represents a 3D sphere shape with configurable latitude, longitude, and radius. Provides methods to retrieve vertex positions, normals, texture coordinates, and colors.
Inherited Members
Namespace: Genesis.Graphics.Shapes
Assembly: Genesis.dll
Syntax
public class SphereShape : Shape
Constructors
SphereShape()
Declaration
public SphereShape()
Properties
LatitudeBands
Gets or sets the number of horizontal segments of the sphere.
Declaration
public int LatitudeBands { get; set; }
Property Value
Type | Description |
---|---|
int |
LongitudeBands
Gets or sets the number of vertical segments of the sphere.
Declaration
public int LongitudeBands { get; set; }
Property Value
Type | Description |
---|---|
int |
Radius
Gets or sets the radius of the sphere.
Declaration
public float Radius { get; set; }
Property Value
Type | Description |
---|---|
float |
Methods
GetColors(Color)
Generates an array of color values for each vertex based on the specified color.
Declaration
public float[] GetColors(Color color)
Parameters
Type | Name | Description |
---|---|---|
Color | color | The color to apply to each vertex. |
Returns
Type | Description |
---|---|
float[] | A float array containing RGB color values for each vertex. |
GetColors(Color, int, int)
Generates an array of RGB color values for each vertex of the sphere.
Declaration
public static float[] GetColors(Color color, int latitudeBands, int longitudeBands)
Parameters
Type | Name | Description |
---|---|---|
Color | color | The color to apply to each vertex. |
int | latitudeBands | The number of horizontal segments. |
int | longitudeBands | The number of vertical segments. |
Returns
Type | Description |
---|---|
float[] | A float array containing RGB color values for each vertex. |
GetIndices(int, int)
Generates the indices required to construct triangles for the sphere's surface.
Declaration
public static int[] GetIndices(int latitudeBands, int longitudeBands)
Parameters
Type | Name | Description |
---|---|---|
int | latitudeBands | The number of horizontal segments. |
int | longitudeBands | The number of vertical segments. |
Returns
Type | Description |
---|---|
int[] | An array of integers representing the indices of the sphere's vertices. |
GetNormals(int, int)
Generates the normal vectors for each vertex of the sphere.
Declaration
public static float[] GetNormals(int latitudebands, int longitudebands)
Parameters
Type | Name | Description |
---|---|---|
int | latitudebands | The number of horizontal segments. |
int | longitudebands | The number of vertical segments. |
Returns
Type | Description |
---|---|
float[] | A float array containing the normals for each vertex. |
GetOrderedColors(Color)
Retrieves the ordered color values for the sphere's vertices based on the specified color.
Declaration
public float[] GetOrderedColors(Color color)
Parameters
Type | Name | Description |
---|---|---|
Color | color | The color to apply to each vertex. |
Returns
Type | Description |
---|---|
float[] | A float array containing ordered RGB color values for each vertex. |
GetOrderedNormals()
Retrieves the ordered normals for the sphere's vertices.
Declaration
public float[] GetOrderedNormals()
Returns
Type | Description |
---|---|
float[] | A float array containing the normals ordered by vertex indices. |
GetOrderedTextureCoordinates()
Retrieves the ordered texture coordinates for the sphere's vertices.
Declaration
public float[] GetOrderedTextureCoordinates()
Returns
Type | Description |
---|---|
float[] | A float array containing the texture coordinates ordered by vertex indices. |
GetShape()
Constructs the geometry of the sphere by combining vertex positions and indices.
Declaration
public override float[] GetShape()
Returns
Type | Description |
---|---|
float[] | A float array containing the ordered vertex positions of the sphere. |
Overrides
GetTextureCoordinates(int, int)
Generates the texture coordinates for each vertex of the sphere.
Declaration
public static float[] GetTextureCoordinates(int latitudebands, int longitudebands)
Parameters
Type | Name | Description |
---|---|---|
int | latitudebands | The number of horizontal segments. |
int | longitudebands | The number of vertical segments. |
Returns
Type | Description |
---|---|
float[] | A float array containing the texture coordinates for each vertex. |
GetVertices(int, int, float)
Generates the vertices for the sphere based on latitude and longitude segments and the radius.
Declaration
public static float[] GetVertices(int latitudebands, int longitudebands, float radius)
Parameters
Type | Name | Description |
---|---|---|
int | latitudebands | The number of horizontal segments. |
int | longitudebands | The number of vertical segments. |
float | radius | The radius of the sphere. |
Returns
Type | Description |
---|---|
float[] | A float array containing the vertex positions for the sphere. |