geometry

The geometry module is a collection of functions generating simple geometry / VAOs.

Functions

demosys.geometry.quad_fs() → VAO

Creates a screen aligned quad.

demosys.geometry.quad_2d(width, height, xpos=0.0, ypos=0.0) → VAO

Creates a 2D quad VAO using 2 triangles.

Parameters:
  • width – Width of the quad
  • height – Height of the quad
  • xpos – Center position x
  • ypos – Center position y
demosys.geometry.cube(width, height, depth, center=(0.0, 0.0, 0.0), normals=True, uvs=True) → VAO

Generates a cube VAO. The cube center is (0.0, 0.0 0.0) unless other is specified.

Parameters:
  • width – Width of the cube
  • height – height of the cube
  • depth – depth of the cube
  • center – center of the cube
  • normals – (bool) Include normals
  • uvs – (bool) include uv coordinates
Returns:

VAO representing the cube

demosys.geometry.bbox(width=1.0, height=1.0, depth=1.0) → VAO

Generates a bounding box. This is simply a box with LINE_STRIP as draw mode

Parameters:
  • width – Width of the box
  • height – height of the box
  • depth – depth of the box
Returns:

VAO

demosys.geometry.plane_xz(size=(10, 10), resolution=(10, 10)) → VAO

Generates a plane on the xz axis of a specific size and resolution

Parameters:
  • size – (x, y) tuple
  • resolution – (x, y) tuple
Returns:

VAO

demosys.geometry.points_random_3d(count, range_x=(-10.0, 10.0), range_y=(-10.0, 10.0), range_z=(-10.0, 10.0), seed=None) → VAO

Generates random positions

Parameters:
  • count – Number of points
  • range_x – min-max range for x axis
  • range_y – min-max range for y axis
  • range_z – min-max range for z axis
  • seed – The random seed to be used
demosys.geometry.sphere(radius=0.5, sectors=32, rings=16) → VAO

Generate a sphere

Parameters:
  • radius – Radius or the sphere
  • rings – number or horizontal rings
  • sectors – number of vertical segments
Returns:

VAO containing the sphere