CG_Labs 2026.1
Loading...
Searching...
No Matches
parametric_shapes Namespace Reference

Functions

bonobo::mesh_data createQuad (float const width, float const height, unsigned int const horizontal_split_count=0u, unsigned int const vertical_split_count=0u)
 Create a quad a given tesselation level and make it available to OpenGL.
bonobo::mesh_data createSphere (float const radius, unsigned int const longitude_split_count, unsigned int const latitude_split_count)
 Create a sphere for a given tesselation level and make it available to OpenGL.
bonobo::mesh_data createTorus (float const major_radius, float const minor_radius, unsigned int const major_split_count, unsigned int const minor_split_count)
 Create a torus for a given tesselation level and make it available to OpenGL.
bonobo::mesh_data createCircleRing (float const radius, float const spread_length, unsigned int const circle_split_count, unsigned int const spread_split_count)
 Create a circle ring for a given tesselation level and make it available to OpenGL.

Function Documentation

◆ createCircleRing()

bonobo::mesh_data parametric_shapes::createCircleRing ( float const radius,
float const spread_length,
unsigned int const circle_split_count,
unsigned int const spread_split_count )
Parameters
radiusradius from the centre to the middle of the cross-section
spread_lengthlength of the cross-section
circle_split_countthe number of times the angle for the circle should be split: 0 means each line going around the circle consist of a single edge spanning the full 360°, with 1 you get two edges (each spanning 180°); 2 is the minimum for getting a 3-D shape.
spread_split_countthe number of times the lines going out from the centre should be split: 0 means each line going out consists of a single edge spanning the full spread, with 1 you get two edges (each spanning half the spread).
Returns
wrapper around OpenGL objects' name containing the geometry data

◆ createQuad()

bonobo::mesh_data parametric_shapes::createQuad ( float const width,
float const height,
unsigned int const horizontal_split_count = 0u,
unsigned int const vertical_split_count = 0u )
Parameters
widththe width of the quad
heightthe height of the quad
horizontal_split_countthe number of times horizontal edges should be split: 0 means each horizontal line consist of a single edge, 1 gives you two edges, and so on.
vertical_split_countthe number of times vertical edges should be split: 0 means each vertical line consist of a single edge, 1 gives you two edges, and so on.
Returns
wrapper around OpenGL objects' name containing the geometry data
Todo
fill me
Todo
bind the previously generated Vertex Array
Todo
fill me
Todo
bind the previously generated Buffer
Todo
how many bytes should the buffer contain?
Todo
how many components do our vertices have?
Todo
fill me
Todo
bind the previously generated Buffer
Todo
how many bytes should the buffer contain?
Todo
how many indices do we have?

◆ createSphere()

bonobo::mesh_data parametric_shapes::createSphere ( float const radius,
unsigned int const longitude_split_count,
unsigned int const latitude_split_count )
Parameters
radiusradius of the sphere
longitude_split_countthe number of times the longitude angle should be split: 0 means each longitudinal line consist of a single edge spanning the full 360°, with 1 you get two edges (each spanning 180°); 2 is the minimum for getting a 3-D shape.
latitude_split_countthe number of times the latitude angle should be split: 0 means each latitudinal line consist of a single edge spanning the full 180°, with 1 you get two edges (each spanning 90°); 1 is the minimum for getting a 3-D shape.
Returns
wrapper around OpenGL objects' name containing the geometry data
Todo
Implement this function

◆ createTorus()

bonobo::mesh_data parametric_shapes::createTorus ( float const major_radius,
float const minor_radius,
unsigned int const major_split_count,
unsigned int const minor_split_count )
Parameters
major_radiusradius from the centre to the middle of the cross-section
minor_radiusradius of the cross-section (giving the torus its thickness)
major_split_countthe number of times the angle for the major ring should be split: 0 means each line going around the major ring consist of a single edge spanning the full 360°, with 1 you get two edges (each spanning 180°); 2 is the minimum for getting a 3-D shape.
minor_split_countthe number of times the angle for the minor ring should be split: 0 means each line going around the minor ring consist of a single edge spanning the full 360°, with 1 you get two edges (each spanning 180°); 2 is the minimum for getting a 3-D shape.
Returns
wrapper around OpenGL objects' name containing the geometry data
Todo
(Optional) Implement this function