model module

This module processes uniform attributes for the appropriate model

class model.AdvancedSkyBox(app, vao_name='advanced_skybox', tex_id='skybox', pos=(0, 0, 0), rot=(0, 0, 0), scale=(1, 1, 1))[source]

Bases: BaseModel

Advanced skybox with proper perspective projection.

Uses inverse projection-view matrix for accurate cubemap sampling.

on_init()[source]

Initialize skybox textures.

Sets up cubemap texture for advanced rendering.

update()[source]

Update inverse projection-view matrix for proper cubemap sampling.

Converts clip coordinates back to world space for accurate texture lookup.

class model.BaseModel(app, vao_name, tex_id, pos=(0, 0, 0), rot=(0, 0, 0), scale=(1, 1, 1))[source]

Bases: object

Base class for all 3D models with position, rotation, and scale.

Provides fundamental model matrix calculations and rendering functionality.

get_model_matrix()[source]

Calculate model matrix combining translation, rotation, and scale.

Returns:

Model transformation matrix

Return type:

mat4

render()[source]

Update model state and render using associated VAO.

update()[source]

Update model state before rendering.

Subclasses override this method for custom behavior.

class model.Cat(app, vao_name='cat', tex_id='cat', pos=(0, 0, 0), rot=(-90, 0, 0), scale=(1, 1, 1))[source]

Bases: ExtendedBaseModel

Cat model with specific orientation and texture.

class model.Cube(app, vao_name='cube', tex_id=0, pos=(0, 0, 0), rot=(0, 0, 0), scale=(1, 1, 1))[source]

Bases: ExtendedBaseModel

Basic cube model with texture and lighting support.

class model.ExtendedBaseModel(app, vao_name, tex_id, pos, rot, scale)[source]

Bases: BaseModel

Subclass for an application’s main objects

on_init()[source]
render_shadow()[source]
update()[source]

Update dynamic uniform attributes

update_shadow()[source]
class model.MovingCube(*args, **kwargs)[source]

Bases: Cube

Animated cube that rotates continuously.

update()[source]

Update cube rotation based on application time.

Creates continuous spinning animation.

class model.SkyBox(app, vao_name='skybox', tex_id='skybox', pos=(0, 0, 0), rot=(0, 0, 0), scale=(1, 1, 1))[source]

Bases: BaseModel

Basic skybox that renders a cubemap texture.

Uses simplified view matrix to prevent skybox rotation with camera.

on_init()[source]

Initialize skybox textures and matrices.

Sets up cubemap texture and projection/view matrices.

update()[source]

Update skybox view matrix to remove camera rotation.

Prevents skybox from rotating with camera movement.