Loxoc.core ========== .. py:module:: Loxoc.core Attributes ---------- .. autoapisummary:: Loxoc.core.UniformValueType Classes ------- .. autoapisummary:: Loxoc.core.ShaderType Loxoc.core.Camera Loxoc.core.Mesh Loxoc.core.MeshDict Loxoc.core.Material Loxoc.core.Model Loxoc.core.Object3D Loxoc.core.Shader Loxoc.core.Vec4 Loxoc.core.Vec3 Loxoc.core.Vec2 Loxoc.core.Window Loxoc.core.EVENT_FLAG Loxoc.core.EVENT_STATE Loxoc.core.MOUSE_EVENT_TYPE Loxoc.core.MOUSE_BUTTON Loxoc.core.MOUSE_WHEEL_DIRECTION Loxoc.core.MouseWheel Loxoc.core.MouseDevice Loxoc.core.Event Loxoc.core.Quaternion Loxoc.core.TextureFiltering Loxoc.core.TextureWraping Loxoc.core.Texture Loxoc.core.Sprite Loxoc.core.Object2D Loxoc.core.PointLight Loxoc.core.DirectionalLight Loxoc.core.SpotLight Loxoc.core.Collider Loxoc.core.BoxCollider Loxoc.core.ConvexCollider Loxoc.core.RayCollider Loxoc.core.RayHit Loxoc.core.Matrix4x4 Loxoc.core.Matrix3x4 Loxoc.core.Matrix2x4 Loxoc.core.Matrix3x3 Loxoc.core.Matrix4x3 Loxoc.core.Matrix2x3 Loxoc.core.Matrix2x2 Loxoc.core.Matrix3x2 Loxoc.core.Matrix4x2 Loxoc.core.Font Loxoc.core.Text Loxoc.core.CubeMap Loxoc.core.SkyBox Loxoc.core.Emitter Loxoc.core.Sound Module Contents --------------- .. py:data:: UniformValueType The types able to be sent to shaders via Uniforms. Includes: `int` , `float` , :class:`Matrix2x2` , :class:`Matrix2x3` , :class:`Matrix2x4` , :class:`Matrix3x2` , :class:`Matrix3x3` , :class:`Matrix3x4` , :class:`Matrix4x2` , :class:`Matrix4x3` , :class:`Matrix4x4` , :class:`Vec2` , :class:`Vec3` , :class:`Vec4` .. py:class:: ShaderType(*args, **kwds) Bases: :py:obj:`enum.Enum` The shader type of a :class:`Shader` object. .. #pragma: ignore_inheritance .. py:attribute:: FRAGMENT :type: ShaderType .. py:attribute:: VERTEX :type: ShaderType .. py:attribute:: GEOMETRY :type: ShaderType .. py:attribute:: COMPUTE :type: ShaderType .. py:class:: Camera(position: Vec3, rotation: Vec3, view_width: int, view_height: int, focal_length: float, fov: float) This class is the 3d perspective for a :class:`Window`. .. py:property:: view_width :type: int The view width of the camera. .. py:property:: view_height :type: int The view height of the camera. .. py:property:: focal_length :type: float The focal length of the camera. .. py:property:: fov :type: float The field of view of the camera. .. py:property:: deltatime :type: float The deltatime of the :class:`Window` the camera is attached to. .. py:property:: dt :type: float The deltatime of the :class:`Window` the camera is attached to. .. py:property:: time_ns :type: int The time in nanoseconds since the creation of the :class:`Window` the camera is attached to. .. py:property:: time :type: int The time in seconds since the creation of the :class:`Window` the camera is attached to. .. py:property:: position :type: Vec3 The current position of the :class:`Camera` as a :class:`Vec3` . .. py:property:: rotation :type: Quaternion The current rotation of the :class:`Camera` as a :class:`Quaternion` . .. py:class:: Mesh This class is used to create/load meshes. .. py:method:: from_file(file_path: str, animated: bool = False) -> Model :staticmethod: Returns the :class:`Model` instance created from the provided file. If the 3D asset contains animations, set `animated` to `True` . .. py:property:: name :type: str Name of the mesh. :rtype: str .. py:class:: MeshDict(name: str, meshes: list[Mesh | MeshDict]) :class:`Loxoc.MeshDict` is a datastructure that acts like a statically typed dictionary storing each :class:`Mesh` by name. This is nessicary because 3D asset files can have more than one :class:`Mesh` in them. If you have a 3D asset file with more than one :class:`Mesh` inside of it, you can extract them from their :class:`MeshDict` to new individual :class:`MeshDict` s and then to :class:`Model` s to be used in :class:`Object3D` s like so: .. code-block:: python my_assets: MeshDict = Model.from_file("./assets/models/model_name/model_name.gltf").mesh_dict # Import the 3D asset file. player_md = MeshDict("player_model_mesh", [my_assets["player_model"]]) # Extract the Mesh into its own group/MeshDict player_object = Object3D(Model(player_md), Vec3(0.0, 0.0, 20.0), vec3(0.0, 0.0, 0.0), vec3(1.0, 1.0, 1.0)) # Now our model is ready to be used. We can extract the :class:`Mesh` s we need from the ``my_assets`` :class:`MeshDict` by name. Hence we use ``my_assets["player_model"]``. This is assuming your desired :class:`Mesh` is at the top level of your imported 3D file/asset's heirarchy. if it is in a group inside the 3D file/asset you imported you could do something like: ``my_assets["group_name"]["player_model"]`` .. py:property:: name The name associated with the :class:`MeshDict` . .. py:method:: insert(m: Mesh | MeshDict) -> None Insert a Mesh. It will use the Mesh name as a key. .. py:method:: get(name: str) -> Mesh | MeshDict Get a Mesh from the dict by name. .. py:method:: remove(name: str) -> None Remove a Mesh from the dict by name. .. py:method:: __iter__() -> Generator[tuple[str, Mesh | MeshDict], None, None] Itterates through the key value pairs of the dict. .. py:method:: __getitem__(key: str) -> Mesh | MeshDict Get a Mesh from the dict by name. .. py:class:: Material(vertex: Shader | None = None, fragment: Shader | None = None, geometry: Shader | None = None, compute: Shader | None = None, animated: bool = False) This decides how to render an Object (:class:`Object3D` or :class:`Object2D`). You may supply your own :class:`Shader` s to customize how Objects are rendered. .. py:method:: set_uniform(name: str, value: UniformValueType) -> None Sets the value of a uniform for the shaders in the material. .. py:property:: diffuse_texture :type: Texture The diffuse :class:`Texture` . .. py:property:: specular_texture :type: Texture The specular :class:`Texture` . .. py:property:: normals_texture :type: Texture The normal :class:`Texture` . .. py:class:: Model(mesh_dict: MeshDict, animated: bool = False) Holds all model data for an imported 3D asset file. .. py:method:: from_file(file_path: str, animated: bool = False) -> Model :staticmethod: Returns the :class:`Model` instance created from the provided file. If the 3D asset contains animations, set `animated` to `True` . .. py:property:: use_default_material_properties :type: bool Uses the :class:`Material` properties defined by each :class:`Mesh` 's :class:`Material` . This only has an effect if the :class:`Object3D` of interest has an object-level :class:`Material` set (having an object-level :class:`Material` means the :class:`Object3D` 's `Object3D.material` attribute is set.). When there is an object-level :class:`Material` set, the default value for `use_default_material_properties` is `False`. .. py:method:: play_animation(animation: str) -> None Plays the specified animation. .. py:property:: mesh_dict :type: MeshDict The :class:`Model` 's :class:`MeshDict` . .. py:property:: animated :type: bool Whether or not the model has animations. If it does set this to true. .. py:class:: Object3D(model_data: Model, position: Vec3 = Vec3(0.0, 0.0, 0.0), rotation: Vec3 = Vec3(0.0, 0.0, 0.0), scale: Vec3 = Vec3(1.0, 1.0, 1.0), collider: Collider | None = None, material: Material | None = None) This class is your 3D game object. .. py:property:: use_default_material_properties :type: bool Uses the :class:`Material` properties defined by each :class:`Mesh` 's :class:`Material` . This only has an effect if the :class:`Object3D` of interest has an object-level :class:`Material` set (having an object-level :class:`Material` means the :class:`Object3D` 's `Object3D.material` attribute is set.). When there is an object-level :class:`Material` set, the default value for `use_default_material_properties` is `False`. .. py:property:: material :type: Material The :class:`Material` used to specify how to render the :class:`Object3D` .. py:property:: model :type: Model The :class:`Model` of the :class:`Object3D` .. py:method:: add_collider(collider: Collider) -> None Adds a :class:`Collider` to the object. .. py:method:: remove_collider(collider: Collider) -> None Removes a :class:`Collider` from the object. .. py:method:: check_collision(intersection: Vec3 | Object3D) -> bool Checks for a collision between this :class:`Object3D` and another :class:`Object3D` or :class:`Vec3` . .. py:method:: get_model_matrix() -> Matrix4x4 Returns an instance of the model matrix as a :class:`Matrix4x4` . .. py:method:: play_animation(animation_name: str) -> None Plays the specified animation by name of the model. .. py:property:: position :type: Vec3 The position of the object as a vec3. .. py:property:: rotation :type: Quaternion The rotation of the object as a Quaternion. .. py:property:: scale :type: Vec3 The scale of the object as a :class:`Vec3`. .. py:method:: set_uniform(name: str, value: UniformValueType) -> None Sets the value of a uniform for the :class:`Shader` s in the object's :class:`Material`. .. py:class:: Shader(source: str, shader_type: ShaderType) Used to import shader files (glsl) that can be used in :class:`Material` s. .. py:method:: from_file(filepath: str, type: ShaderType) -> Shader :classmethod: .. py:class:: Vec4(x: float, y: float, z: float, w: float) A 4 float datastructure used to represent positional data, colors, or whatever you may need it for. Contains useful linear algebra operators and functions. .. py:method:: __copy__() -> Quaternion Copies the :class:`Vec4` . .. py:method:: __repr__() -> str Returns a string representation of the :class:`Vec4` . .. py:method:: __neg__() -> Vec4 Negates the :class:`Vec4` . .. py:property:: x :type: float The x component :class:`Vec4` . .. py:property:: y :type: float The y component :class:`Vec4` . .. py:property:: z :type: float The z component :class:`Vec4` . .. py:property:: w :type: float The w component :class:`Vec4` . .. py:method:: __add__(other: Vec4 | float) -> Vec4 Adds the :class:`Vec4` . .. py:method:: __sub__(other: Vec4 | float) -> Vec4 Subtracts the :class:`Vec4` . .. py:method:: __mul__(other: Vec4 | float | Quaternion) -> Vec4 Multiplies the :class:`Vec4` . .. py:method:: __truediv__(other: Vec4 | float) -> Vec4 Divides the two :class:`Vec4` s. .. py:method:: dot(other: Vec4) -> float Returns the dot product of the two :class:`Vec4` s. .. py:method:: get_magnitude() -> float Returns the magnitude of the :class:`Vec4` . .. py:method:: get_normalized() -> Vec4 Returns the normalized :class:`Vec4` . .. py:method:: to_vec3() -> Vec3 Converts the :class:`Vec4` to a :class:`Vec3` using its x, y and z components. .. py:method:: to_vec2() -> Vec2 Converts the :class:`Vec4` to a :class:`Vec2` using its x and y components. .. py:method:: outer_product(vec: Vec2 | Vec3 | Vec4) -> Matrix2x4 | Matrix3x4 | Matrix4x4 Calculates the outer product. .. py:method:: distance(other: Vec4) -> float The distance between two vectors as a `float` . .. py:class:: Vec3(x: float, y: float, z: float) A 3 float datastructure used to represent positional data, colors, or whatever you may need it for. Contains useful linear algebra operators and functions. .. py:method:: __repr__() -> str Vec3 str representation. .. py:property:: quaternion :type: Quaternion Get the :class:`Quaternion` form of the vector. Can also be assigned to, but not mutated. .. py:property:: x :type: float .. py:property:: y :type: float .. py:property:: z :type: float .. py:property:: up :type: Vec3 The up directional vector from the Euler representation of the :class:`Vec3` . .. py:property:: right :type: Vec3 The right directional vector from the Euler representation of the :class:`Vec3` . .. py:property:: forward :type: Vec3 The forward directional vector from the Euler representation of the :class:`Vec3` . .. py:method:: __neg__() -> Vec3 Negate a vector. .. py:method:: __add__(other: Vec3 | float) -> Vec3 Add 2 vectors. .. py:method:: __sub__(other: Vec3 | float) -> Vec3 Subtract 2 vectors. .. py:method:: __mul__(other: Vec3 | float | Quaternion) -> Vec3 Multiply 2 vectors. .. py:method:: __truediv__(other: Vec3 | float) -> Vec3 divide 2 vectors. .. py:method:: dot(other: Vec3) -> float Performs a dot product operation between two :class:`Vec3` s. .. py:method:: cross(other: Quaternion | Vec3) -> Vec3 Performs a cross product operation between two :class:`Vec3` s. .. py:method:: get_magnitude() -> float Returns the magnitude of the vector. .. py:method:: get_normalized() -> Vec3 Returns the normalized vector. .. py:method:: to_quaternion() -> Quaternion Constructs a :class:`Quaternion` from the given Euler Angle :class:`Vec3` (in radians). .. py:method:: outer_product(vec: Vec2 | Vec3 | Vec4) -> Matrix2x3 | Matrix3x3 | Matrix4x3 Calculates the outer product. .. py:method:: distance(other: Vec3) -> float The distance between two vectors as a `float` . .. py:class:: Vec2(x: float, y: float) A 2 float datastructure used to represent positional data, 2D rotation, or whatever you may need it for. Contains useful linear algebra operators and functions. .. py:method:: __repr__() -> str :class:`Vec2` str representation. .. py:method:: __neg__() -> Vec2 .. py:method:: __copy__() -> Vec2 .. py:property:: angle :type: float The vector converted to an angle in radians. .. py:method:: to_angle() -> float Convert the vector to an angle in radians .. py:property:: x :type: float .. py:property:: y :type: float .. py:method:: __add__(other: Vec2 | float) -> Vec2 .. py:method:: __sub__(other: Vec2 | float) -> Vec2 .. py:method:: __mul__(other: Vec2 | float) -> Vec2 .. py:method:: __truediv__(other: Vec2 | float) -> Vec2 .. py:method:: dot(other: Vec2) -> float Calculate the dot product of 2 :class:`Vec2` s. .. py:method:: get_magnitude() -> float Calculate the :class:`Vec2` 's magnitude. .. py:method:: get_normalized() -> Vec2 Calculate the normalized :class:`Vec2` of the :class:`Vec2` . .. py:method:: from_angle(angle: float) -> Vec2 :classmethod: Construct a normalized :class:`Vec2` given an angle. .. py:method:: outer_product(vec: Vec2 | Vec3 | Vec4) -> Matrix2x2 | Matrix3x2 | Matrix4x2 Calculates the outer product. .. py:method:: distance(other: Vec2) -> float The distance between two vectors as a `float` . .. py:class:: Window(title: str, cam: Camera, width: int, height: int, fullscreen: bool = False, ambient_light: Vec3 = Vec3(1.0, 1.0, 1.0)) An application window for a game. This class also keeps track of the state of the game engine runtime (ie. what to and not to render along with events and time). .. py:attribute:: ambient_light :type: Vec3 The ambient or "base" level of light before any lights are added .. py:property:: fullscreen :type: bool Wether to render the window in fullscreen mode (`True`) or not (`False`). .. py:property:: resizeable :type: bool This flag determines wether or not the window is resizeable. The default value is `True`. .. py:property:: sky_box :type: SkyBox The :class:`Skybox` . .. py:property:: event :type: Event This is the most recent event that the window recieved durring :meth:`Window.update` . .. py:property:: deltatime :type: float The current deltatime for the window. .. py:property:: dt :type: float The current deltatime for the window. .. py:property:: time_ns :type: int Time since the launch of the window in nanoseconds. .. py:property:: time :type: int Time since the launch of the window in seconds. .. py:method:: update() -> None Re-renders and refreshes the :attr:`Window.event` on the application :class:`Window` . Should be used in a render/gameloop like so: .. code-block:: python window = Window(...) while ...: # render/gameloop code... window.update() Whenever :meth:`Window.update` is called, a new frame is drawn to the :class:`Window` . If the program ends, the window will be closed. .. py:method:: lock_mouse(lock: bool) -> None Locks the mouse in the center of the window. .. py:method:: add_object(obj: Object3D) -> None Adds the :class:`Object3D` to the scene. This ensures that the :class:`Object3D` is rendered by the camera. .. py:method:: remove_object(obj: Object3D) -> None Removes the :class:`Object3D` from the scene. Only :class:`Object3D` s which are in the scene will be rendered by the camera. .. py:method:: add_object_list(objs: list[Object3D]) -> None Adds multiple :class:`Object3D` s to the scene. This ensures that they are rendered by the camera. .. py:method:: remove_object_list(objs: list[Object3D]) -> None Removes multiple :class:`Object3D` s from the scene. Only :class:`Object3D` s which are in the scene will be rendered by the camera. .. py:method:: add_object2d(obj: Object2D) -> None Adds the :class:`Object2D` to the scene. This ensures that the :class:`Object2D` is rendered by the camera. .. py:method:: remove_object2d(obj: Object2D) -> None Removes the :class:`Object2D` from the scene. Only :class:`Object2D` s which are in the scene will be rendered by the camera. .. py:method:: add_object2d_list(objs: list[Object2D]) -> None Adds multiple :class:`Object2D` s to the scene. This ensures that they are rendered by the camera. .. py:method:: remove_object2d_list(objs: list[Object2D]) -> None Removes multiple :class:`Object2D` s from the scene. Only :class:`Object2D` s which are in the scene will be rendered by the camera. .. py:method:: add_point_light(obj: PointLight) -> None Adds the :class:`PointLight` to the scene. This ensures that the :class:`PointLight` is rendered by the camera. .. py:method:: remove_point_light(obj: PointLight) -> None Removes the :class:`PointLight` from the scene. Only :class:`PointLight` s which are in the scene will be rendered by the camera. .. py:method:: add_point_light_list(objs: list[PointLight]) -> None Adds multiple :class:`PointLight` s to the scene. This ensures that they are rendered by the camera. .. py:method:: remove_point_light_list(objs: list[PointLight]) -> None Removes multiple :class:`PointLight` s from the scene. Only :class:`PointLight` s which are in the scene will be rendered by the camera. .. py:method:: add_directional_light(obj: DirectionalLight) -> None Adds the :class:`DirectionalLight` to the scene. This ensures that the :class:`DirectionalLight` is rendered by the camera. .. py:method:: remove_directional_light(obj: DirectionalLight) -> None Removes the :class:`DirectionalLight` from the scene. Only :class:`DirectionalLight` s which are in the scene will be rendered by the camera. .. py:method:: add_directional_light_list(objs: list[DirectionalLight]) -> None Adds multiple :class:`DirectionalLight` s to the scene. This ensures that they are rendered by the camera. .. py:method:: remove_directional_light_list(objs: list[DirectionalLight]) -> None Removes multiple :class:`DirectionalLight` s from the scene. Only :class:`DirectionalLight` s which are in the scene will be rendered by the camera. .. py:method:: add_spot_light(obj: SpotLight) -> None Adds the :class:`SpotLight` to the scene. This ensures that the :class:`SpotLight` is rendered by the camera. .. py:method:: remove_spot_light(obj: SpotLight) -> None Removes the :class:`SpotLight` from the scene. Only :class:`SpotLight` s which are in the scene will be rendered by the camera. .. py:method:: add_spot_light_list(objs: list[SpotLight]) -> None Adds multiple :class:`SpotLight` s to the scene. This ensures that they are rendered by the camera. .. py:method:: remove_spot_light_list(objs: list[SpotLight]) -> None Removes multiple :class:`SpotLight` s from the scene. Only :class:`SpotLight` s which are in the scene will be rendered by the camera. .. py:method:: add_text(obj: Text) -> None Adds the :class:`Text` to the scene. This ensures that the :class:`Text` is rendered by the camera. .. py:method:: remove_text(obj: Text) -> None Removes the :class:`Text` from the scene. Only :class:`Text` s which are in the scene will be rendered by the camera. .. py:method:: add_text_list(objs: list[Text]) -> None Adds multiple :class:`Text` s to the scene. This ensures that they are rendered by the camera. .. py:method:: remove_text_list(objs: list[Text]) -> None Removes multiple :class:`Text` s from the scene. Only :class:`Text` s which are in the scene will be rendered by the camera. .. py:method:: add_emitter(obj: Emitter) -> None Adds the :class:`Emitter` to the scene. This ensures that the :class:`Emitter` is rendered by the camera. .. py:method:: remove_emitter(obj: Emitter) -> None Removes the :class:`Emitter` from the scene. Only :class:`Emitter` s which are in the scene will be rendered by the camera. .. py:method:: add_emitter_list(objs: list[Emitter]) -> None Adds multiple :class:`Emitter` s to the scene. This ensures that they are rendered by the camera. .. py:method:: remove_emitter_list(objs: list[Emitter]) -> None Removes multiple :class:`Emitter` s from the scene. Only :class:`Emitter` s which are in the scene will be rendered by the camera. .. py:class:: EVENT_FLAG(*args, **kwds) Bases: :py:obj:`enum.Enum` An IO or engine event flag. .. #pragma: ignore_inheritance .. py:attribute:: WINDOW_MINIMIZE :type: EVENT_FLAG Flagged when the window minimize button is clicked. .. py:attribute:: WINDOW_CLOSE :type: EVENT_FLAG Flagged when the window close button is clicked. .. py:attribute:: QUIT :type: EVENT_FLAG Flagged when the window close button is clicked. .. py:attribute:: KEY_UP :type: EVENT_FLAG .. py:attribute:: KEY_DOWN :type: EVENT_FLAG .. py:attribute:: KEY_RIGHT :type: EVENT_FLAG .. py:attribute:: KEY_LEFT :type: EVENT_FLAG .. py:attribute:: KEY_SPACE :type: EVENT_FLAG .. py:attribute:: KEY_a :type: EVENT_FLAG .. py:attribute:: KEY_b :type: EVENT_FLAG .. py:attribute:: KEY_c :type: EVENT_FLAG .. py:attribute:: KEY_d :type: EVENT_FLAG .. py:attribute:: KEY_e :type: EVENT_FLAG .. py:attribute:: KEY_f :type: EVENT_FLAG .. py:attribute:: KEY_g :type: EVENT_FLAG .. py:attribute:: KEY_h :type: EVENT_FLAG .. py:attribute:: KEY_i :type: EVENT_FLAG .. py:attribute:: KEY_j :type: EVENT_FLAG .. py:attribute:: KEY_k :type: EVENT_FLAG .. py:attribute:: KEY_l :type: EVENT_FLAG .. py:attribute:: KEY_m :type: EVENT_FLAG .. py:attribute:: KEY_n :type: EVENT_FLAG .. py:attribute:: KEY_o :type: EVENT_FLAG .. py:attribute:: KEY_p :type: EVENT_FLAG .. py:attribute:: KEY_q :type: EVENT_FLAG .. py:attribute:: KEY_r :type: EVENT_FLAG .. py:attribute:: KEY_s :type: EVENT_FLAG .. py:attribute:: KEY_t :type: EVENT_FLAG .. py:attribute:: KEY_u :type: EVENT_FLAG .. py:attribute:: KEY_v :type: EVENT_FLAG .. py:attribute:: KEY_w :type: EVENT_FLAG .. py:attribute:: KEY_x :type: EVENT_FLAG .. py:attribute:: KEY_y :type: EVENT_FLAG .. py:attribute:: KEY_z :type: EVENT_FLAG .. py:attribute:: KEY_LSHIFT :type: EVENT_FLAG .. py:attribute:: KEY_RSHIFT :type: EVENT_FLAG .. py:attribute:: KEY_LCTRL :type: EVENT_FLAG .. py:attribute:: KEY_LALT :type: EVENT_FLAG .. py:attribute:: KEY_ESCAPE :type: EVENT_FLAG .. py:attribute:: KEY_COMMA :type: EVENT_FLAG .. py:attribute:: KEY_PERIOD :type: EVENT_FLAG .. py:attribute:: KEY_FORWARDSLASH :type: EVENT_FLAG .. py:attribute:: KEY_BACKSLASH :type: EVENT_FLAG .. py:attribute:: KEY_OPEN_BRACKET :type: EVENT_FLAG .. py:attribute:: KEY_CLOSE_BRACKET :type: EVENT_FLAG .. py:attribute:: KEY_SEMICOLON :type: EVENT_FLAG .. py:attribute:: KEY_QUOTE :type: EVENT_FLAG .. py:attribute:: KEY_ENTER :type: EVENT_FLAG .. py:attribute:: KEY_BACKSPACE :type: EVENT_FLAG .. py:attribute:: KEY_TAB :type: EVENT_FLAG .. py:attribute:: KEY_BACKTICK :type: EVENT_FLAG .. py:attribute:: KEY_DASH :type: EVENT_FLAG .. py:attribute:: KEY_EQUALS :type: EVENT_FLAG .. py:attribute:: KEY_1 :type: EVENT_FLAG .. py:attribute:: KEY_2 :type: EVENT_FLAG .. py:attribute:: KEY_3 :type: EVENT_FLAG .. py:attribute:: KEY_4 :type: EVENT_FLAG .. py:attribute:: KEY_5 :type: EVENT_FLAG .. py:attribute:: KEY_6 :type: EVENT_FLAG .. py:attribute:: KEY_7 :type: EVENT_FLAG .. py:attribute:: KEY_8 :type: EVENT_FLAG .. py:attribute:: KEY_9 :type: EVENT_FLAG .. py:attribute:: KEY_0 :type: EVENT_FLAG .. py:attribute:: KEY_RCTRL :type: EVENT_FLAG .. py:attribute:: KEY_RALT :type: EVENT_FLAG .. py:attribute:: MOUSE_BUTTON_DOWN :type: EVENT_FLAG .. py:attribute:: MOUSE_BUTTON_UP :type: EVENT_FLAG .. py:attribute:: MOUSE_WHEEL :type: EVENT_FLAG .. py:attribute:: MOUSE_MOTION :type: EVENT_FLAG .. py:attribute:: WINDOW_RESIZE :type: EVENT_FLAG .. py:class:: EVENT_STATE(*args, **kwds) Bases: :py:obj:`enum.Enum` The state of an IO or engine event flag. .. #pragma: ignore_inheritance .. py:attribute:: NONE :type: EVENT_STATE .. py:attribute:: PRESSED :type: EVENT_STATE .. py:attribute:: RELEASED :type: EVENT_STATE .. py:class:: MOUSE_EVENT_TYPE(*args, **kwds) Bases: :py:obj:`enum.Enum` The type of a mouse event. .. #pragma: ignore_inheritance .. py:attribute:: BUTTON_DOWN :type: MOUSE_EVENT_TYPE .. py:attribute:: BUTTON_UP :type: MOUSE_EVENT_TYPE .. py:attribute:: NONE :type: MOUSE_EVENT_TYPE .. py:class:: MOUSE_BUTTON(*args, **kwds) Bases: :py:obj:`enum.Enum` The button of a mouse event. .. #pragma: ignore_inheritance .. py:attribute:: LEFT :type: MOUSE_BUTTON .. py:attribute:: RIGHT :type: MOUSE_BUTTON .. py:attribute:: MIDDLE :type: MOUSE_BUTTON .. py:class:: MOUSE_WHEEL_DIRECTION(*args, **kwds) Bases: :py:obj:`enum.Enum` The wheel direction of a mouse wheel event. .. #pragma: ignore_inheritance .. py:attribute:: FLIPPED :type: MOUSE_WHEEL_DIRECTION .. py:attribute:: NORMAL :type: MOUSE_WHEEL_DIRECTION .. py:class:: MouseWheel The mousewheel data for a mouse wheel event. .. py:attribute:: int_x :type: int The x value of the mouse wheel with integer precision. .. py:attribute:: int_y :type: int The y value of the mouse wheel with integer precision. .. py:attribute:: x :type: float The x value of the mouse wheel with full floating point precision. .. py:attribute:: y :type: float The y value of the mouse wheel with full floating point precision. .. py:attribute:: direction :type: MOUSE_WHEEL_DIRECTION The direction of the mouse wheel. .. py:class:: MouseDevice The data for a mouse device populated durring a mouse event. .. py:attribute:: id :type: int The id of the mouse device. .. py:attribute:: timestamp :type: int The timestamp of the mouse event. .. py:attribute:: x :type: int The x position of the mouse in relation to the window. .. py:attribute:: y :type: int The y position of the mouse in relation to the window. .. py:attribute:: rel_x :type: int The x position of the mouse relative to its last position. Also can be thought of as the mouse x delta. .. py:attribute:: rel_y :type: int The y position of the mouse relative to its last position. Also can be thought of as the mouse y delta. .. py:attribute:: clicks :type: int The ammount of clicks recorded. .. py:attribute:: type :type: MOUSE_EVENT_TYPE The type of mouse event. .. py:attribute:: state :type: EVENT_STATE The state of the mouse event. .. py:attribute:: button :type: MOUSE_BUTTON The button pressed durring the mouse event. .. py:attribute:: wheel :type: MouseWheel The mouse wheel data for mouse wheel events. .. py:class:: Event This non-constructable class contains all information pertaining to :class:`Window` events. This class can be accessed/read via :class:`Window` :class:`.event` . To check if an :class:`EVENT_FLAG` has been triggered you can use :class:`Window` :class:`.event.check_flag(...)`: .. code-block:: python window = Window(...) while not window.event.check_flag(EVENT_FLAG.QUIT): # some game loop code... window.update() This can be useful for events where you only need to chjeck if they have been triggered. Such as quitting the game when you close the window. To check the :class:`EVENT_STATE` of an :class:`EVENT_FLAG` you can use :class:`Window` :class:`.event.get_flag(...)`: .. code-block:: python window = Window(...) while not window.event.check_flag(EVENT_FLAG.QUIT): if window.event.get_flag(EVENT_FLAG.KEY_UP) == EVENT_STATE.PRESSED: # do some stuff when up is pressed... window.update() This can be useful for getting the :class:`EVENT_STATE` of specific :class:`EVENT_FLAG` s. It is recommended to do this before attempting to access data from the :class:`Event` that is related to the :class:`EVENT_FLAG` and its :class:`EVENT_STATE` . .. py:method:: get_flag(_event: EVENT_FLAG) -> EVENT_STATE Checks if the provided event flag is occuring. .. py:method:: check_flag(_event: EVENT_FLAG) -> bool Checks if the provided event flag is occuring. .. py:property:: mouse :type: MouseDevice Gets the current mouse device. Contains current mouse events. .. py:method:: get_mouse(id: int) -> MouseDevice Gets the mouse device with the provided id. Contains current mouse events. .. py:class:: Quaternion(w: float, x: float, y: float, z: float) A *"4 dimensional"* rotation arround a developer defined :class:`Vec3` axis. In simple terms, a Quaternion is just an angle (in radians) rotation arround some 3D vector. For example if we wanted to rotate arround the Euler y axis of an :class:`Object3D` or along "yaw" we would just rotate arroud the :class:`Object3D` :class:`.rotation.up` vector: .. code-block:: python obj = Object3D(...) yaw_rotation = math.radians(90) quat = Quaternion.from_axis_angle(obj.rotation.up, yaw_rotation) It is recommended to construct Quaternions with :meth:`Quaternion.from_axis_angle`. Read more about Quaternions `here`_. .. _here: https://en.wikipedia.org/wiki/Quaternion .. py:method:: __repr__() -> str The string representation of the Quaternion. .. py:method:: __neg__() -> Quaternion .. py:property:: w :type: float .. py:property:: x :type: float .. py:property:: y :type: float .. py:property:: z :type: float .. py:property:: up :type: Vec3 The up directional vector. .. py:property:: right :type: Vec3 The right directional vector. .. py:property:: forward :type: Vec3 The forward directional vector. .. py:property:: euler_angles :type: Vec3 The Euler Angle Vec3 form of the Quaternion. Can also be assigned to, but not mutated. Use :meth:`Quaternion.rotate_pitch`, :meth:`Quaternion.rotate_yaw`, and :meth:`Quaternion.rotate_roll` for mutating Euler angle rotation. .. py:property:: euler_pitch :type: float Rotation about the x axis. .. py:method:: rotate_pitch(value: float) -> Quaternion Rotates the Euler pitch (x) axis by the provided value. .. py:property:: euler_yaw :type: float Rotation about the y axis. .. py:method:: rotate_yaw(value: float) -> Quaternion Rotates the Euler yaw (y) axis by the provided value. .. py:property:: euler_roll :type: float Rotation about the z axis. .. py:method:: rotate_roll(value: float) -> Quaternion Rotates the Euler roll (z) axis by the provided value. .. py:method:: __add__(other: Quaternion | float) -> Quaternion .. py:method:: __sub__(other: Quaternion | float) -> Quaternion .. py:method:: __mul__(other: Quaternion | float | Vec3) -> Quaternion | Vec3 .. py:method:: __truediv__(other: Quaternion | float) -> Quaternion .. py:method:: dot(other: Quaternion) -> float The dot product of 2 :class:`Quaternion` s. .. py:method:: cross(other: Quaternion | Vec3) -> float The cross product of the :class:`Quaternion` and another compatible structure. .. py:method:: get_magnitude() -> float Returns the magnitude of the :class:`Quaternion` . .. py:method:: get_normalized() -> Quaternion Returns the normalized :class:`Quaternion` . .. py:method:: to_euler() -> Vec3 Converts the :class:`Quaternion` to a Euler Angle :class:`Vec3` (in radians). .. py:method:: get_conjugate() -> Quaternion The conjugate of the :class:`Quaternion` . .. py:method:: get_inverse() -> Quaternion The inverse of the :class:`Quaternion` . .. py:method:: get_reverse() -> Quaternion The 180 degree reverse of the :class:`Quaternion` . .. py:method:: from_euler(euler_vec: Vec3) -> Quaternion :staticmethod: Converts the provided Euler Angle :class:`Vec3` (in radians) to a :class:`Quaternion` . .. py:method:: from_axis_angle(axis: Vec3, angle: float) -> Quaternion :staticmethod: Constructs a :class:`Quaternion` with a rotation of ``angle`` arround ``axis``. :arg Vec3 axis: A Euler Angle :class:`Vec3` (in radians). :arg float angle: An angle in radians of which to rotate arround the ``axis``. .. py:method:: rotate(axis: Vec3, angle: float) -> None Mutably rotates the :class:`Quaternion` by `angle` arround `axis`. :arg Vec3 axis: A Euler Angle :class:`Vec3` (in radians). :arg float angle: An angle in radians of which to rotate arround the ``axis``. .. py:method:: from_quat(quat: Quaternion) -> Quaternion :staticmethod: Used to construct a copy of a :class:`Quaternion` . .. py:method:: from_unit(axis: Vec3, up: Vec3 | None = Vec3(0.0, 1.0, 0.0)) -> Quaternion :staticmethod: Takes in a unit :class:`Vec3` direction and returns a :class:`Quaternion` rotated in that direction from the global forward `Vec3(0.0, 0.0, 1.0)` . .. py:method:: lerp(other: Quaternion, ratio: float) -> Quaternion Returns a lerped :class:`Quaternion` between two :class:`Quaternion` by the provided ratio. .. py:method:: slerp(other: Quaternion, ratio: float) -> Quaternion Returns a slerped :class:`Quaternion` between two :class:`Quaternion` by the provided ratio. .. py:class:: TextureFiltering(*args, **kwds) Bases: :py:obj:`enum.Enum` The texture filtering setting for a :class:`Texture` . .. #pragma: ignore_inheritance .. py:attribute:: NEAREST :type: TextureFiltering .. py:attribute:: LINEAR :type: TextureFiltering .. py:class:: TextureWraping(*args, **kwds) Bases: :py:obj:`enum.Enum` The texture wrapping setting for a :class:`Texture` . .. #pragma: ignore_inheritance .. py:attribute:: REPEAT :type: TextureWraping .. py:attribute:: MIRRORED_REPEAT :type: TextureWraping .. py:attribute:: CLAMP_TO_EDGE :type: TextureWraping .. py:attribute:: CLAMP_TO_BORDER :type: TextureWraping .. py:class:: Texture A texture for a :class:`Mesh` or :class:`Sprite` . .. py:method:: from_file(file_path: str, wrap: TextureWraping = TextureWraping.REPEAT, filtering: TextureFiltering = TextureFiltering.LINEAR) -> Texture :classmethod: Create a :class:`Texture` from the specified file. .. py:class:: Sprite(file_path: str) The image asset which is used when rendering an :class:`Object2D` . Serves a purpose similar to how :class:`Mesh` is used with :class:`Object3D` but for :class:`Object2D` . .. py:attribute:: texture :type: Texture The :class:`Texture` that is drawn when the :class:`Sprite` is rendered. .. py:method:: from_texture(tex: Texture) -> Sprite :classmethod: Creates a sprite of the supplied texture. .. py:class:: Object2D(sprite: Sprite, camera: Camera, position: Vec2 = Vec2(0.0, 0.0), depth: float = 0.0, rotation: float = 0.0, scale: Vec2 = Vec2(1.0, 1.0), material: Material = None) An 2 Dimensional Object which is rendered infront of all :class:`Object3D` s on the screen. Good for GUI, HUD interfaces, or anything else 2D. .. py:property:: material :type: Material The :class:`Material` to render the :class:`Sprite` with when the :class:`Object2D` is rendered. .. py:property:: sprite :type: Sprite The :class:`Sprite` to be displayed when the :class:`Object2D` is rendered. .. py:property:: position :type: Vec2 The position of the :class:`Object2D` on the screen as a :class:`Vec2`. .. py:property:: depth :type: float The depth layer of the :class:`Sprite` when rendered, or "z" position. :class:`Object2D` s with a higher depth are rendered underneath :class:`Object2D` s with a lower depth. .. py:property:: rotation :type: float The rotation of the :class:`Object2D` on the screen as a :class:`Vec2`. .. py:property:: scale :type: Vec2 The scale of the :class:`Object2D` on the screen as a :class:`Vec2`. .. py:property:: untransformed_dimensions :type: Vec2 The screen/camera coordinate dimensions of the :class:`Sprite` before scale is applied. .. py:property:: dimensions :type: Vec2 The true screen/camera coordinate dimensions of the :class:`Sprite` . .. py:property:: width :type: float The true screen/camera coordinate height of the :class:`Sprite` . .. py:property:: height :type: float The true screen/camera coordinate height of the :class:`Sprite` . .. py:method:: set_uniform(name: str, value: UniformValueType) -> None Sets the value of a uniform for the shaders in the :class:`Object2D` 's :class:`Material`. .. py:class:: PointLight(position: Vec3, radius: float, color: Vec3, intensity: float) A Object that emits light from a :class:`Vec3` point in 3D space. .. py:property:: position :type: Vec3 The :class:`Vec3` position of the light. .. py:property:: color :type: Vec3 The :class:`Vec3` color of the light in rgb. .. py:property:: intensity :type: float The intensity of the light. .. py:property:: radius :type: float The radius of the light .. py:class:: DirectionalLight(rotation: Vec3 = None, color: Vec3 = None, ambient: Vec3 = None, diffuse: Vec3 = None, specular: Vec3 = None, intensity: float = 1.0) .. py:property:: rotation :type: Quaternion The :class:`Quaternion` rotation of the :class:`DirectionalLight` .. py:property:: ambient :type: Vec3 The :class:`Vec3` ambient property of the :class:`DirectionalLight` .. py:property:: diffuse :type: Vec3 The :class:`Vec3` diffuse property of the :class:`DirectionalLight` .. py:property:: specular :type: Vec3 The :class:`Vec3` specular property of the :class:`DirectionalLight` .. py:property:: intensity :type: float The intensity property of the :class:`DirectionalLight` .. py:property:: color :type: Vec3 The :class:`Vec3` color property of the :class:`DirectionalLight` .. py:class:: SpotLight(position: Vec3, rotation: Vec3 = None, color: Vec3 = None, cutoff: float = 12.5, outer_cutoff: float = 17.5, intensity: float = 1.0, reach: float = 100.0, cookie: Texture = None) .. py:property:: position :type: Vec3 The :class:`Vec3` position of the light. .. py:property:: rotation :type: Quaternion The direction of the spotlight as a :class:`Quaternion` . .. py:property:: cookie :type: Texture The :class:`Texture` of the light cookie the spotlight will cast if provided. .. py:property:: color :type: Vec3 The :class:`Vec3` color of the light. .. py:property:: intensity :type: float The intensity of the light. .. py:property:: cutoff :type: float the cutoff of the light cookie as an angle from the center. .. py:property:: outer_cutoff :type: float the cutoff of the light cookie smoothing as an angle from the center. .. py:property:: reach :type: float The distance the light is able to travel. .. py:class:: Collider The Collider base class. .. py:method:: check_collision(intersection: Vec3 | Collider | Object3D) -> bool Checks for a collision between this :class:`Collider` and another :class:`Collider` , :class:`Object3D` or :class:`Vec3` . .. py:property:: offset :type: Vec3 The :class:`Vec3` offset of the collider. .. py:property:: rotation :type: Quaternion The :class:`Quaternion` rotation of the collider. .. py:property:: scale :type: Vec3 The :class:`Vec3` scale of the collider. .. py:property:: show Makes the collider visible. Good for debugging purposes. .. py:method:: dbg_render(cam: Camera) -> None Call this function when you wish to show a collider's collision mesh despite the collider not having an owner. (This api is temporary until future game engine systems are implemented.) .. py:class:: BoxCollider(object: Object3D, offset: Vec3 = Vec3(0, 0, 0), rotation: Vec3 | Quaternion = Vec3(0, 0, 0), scale: Vec3 = Vec3(1.0, 1.0, 1.0)) Bases: :py:obj:`Collider` An Oriented Box Collider. .. py:method:: from_bounds(upper_bound: Vec3 = Vec3(10, 10, 10), lower_bound: Vec3 = Vec3(-10, -10, -10), offset: Vec3 = Vec3(0, 0, 0), rotation: Vec3 | Quaternion = Vec3(0, 0, 0), scale: Vec3 = Vec3(1.0, 1.0, 1.0)) -> BoxCollider :classmethod: Constructs an :class:`BoxCollider` from the provided bounds. .. py:class:: ConvexCollider(object: Object3D, offset: Vec3 = Vec3(0, 0, 0), rotation: Vec3 | Quaternion = Vec3(0, 0, 0), scale: Vec3 = Vec3(1.0, 1.0, 1.0)) Bases: :py:obj:`Collider` A convex hull collider. .. py:method:: from_mesh(msh: Mesh, offset: Vec3 = Vec3(0, 0, 0), rotation: Vec3 | Quaternion = Vec3(0, 0, 0), scale: Vec3 = Vec3(1.0, 1.0, 1.0)) -> BoxCollider :classmethod: Creates a :class:`ConvexCollider` from the provided :class:`Mesh` . .. py:method:: from_mesh_dict(msh_dict: MeshDict, offset: Vec3 = Vec3(0, 0, 0), rotation: Vec3 | Quaternion = Vec3(0, 0, 0), scale: Vec3 = Vec3(1.0, 1.0, 1.0)) -> BoxCollider :classmethod: Creates a :class:`ConvexCollider` from the provided :class:`MeshDict` . .. py:class:: RayCollider(origin: Vec3, direction: Quaternion) Bases: :py:obj:`Collider` A raycast collider that takes in an :class:`Vec3` origin and :class:`Quaternion` direction. .. py:method:: get_collision(intersection: Collider | Object3D) -> RayHit Checks for a collision on the `RayCollider` . Upon colliding this function returns an instance of :class:`RayHit` . .. py:property:: rotation :type: Quaternion The :class:`Quaternion` direction of the `RayCollider` . .. py:property:: direction :type: Quaternion The :class:`Quaternion` direction of the `RayCollider` . .. py:property:: offset :type: Vec3 The :class:`Vec3` origin of the `RayCollider` . .. py:property:: origin :type: Vec3 The :class:`Vec3` origin of the `RayCollider` . .. py:class:: RayHit Returned by :attr:`RayCollider.get_collision` . This class contains information about the :class:`RayCollider` collision. .. py:property:: hit :type: bool `True` if the :class:`RayCollider` has hit its target, `False` if not. .. py:property:: has_normal :type: bool Wether the `RayHit` 's collided surface has a normal. .. py:property:: has_distance :type: bool Wether the `RayHit` has recorded the distance between the collision point and its origin. .. py:property:: position :type: Vec3 The :class:`Vec3` position of the `RayHit` . .. py:property:: normal :type: Vec3 The :class:`Vec3` normal of the surface the :class:`RayCollider` has collided with. .. py:property:: distance :type: float The distance between the :class:`Vec3` origin and the :class:`Vec3` position of the `RayHit` . .. py:class:: Matrix4x4(x0: float, y0: float, z0: float, w0: float, x1: float, y1: float, z1: float, w1: float, x2: float, y2: float, z2: float, w2: float, x3: float, y3: float, z3: float, w3: float) A 4 by 4 matrix. .. py:method:: from_identity(value: float) -> Matrix4x4 :staticmethod: Creates a identity matrix with `value`. .. py:method:: from_ortho(left: float, right: float, bottom: float, top: float, zNear: float | None = None, zFar: float | None = None) -> Matrix4x4 :staticmethod: Creates an orthographic projection :class:`Matrix4x4` with the specified bounds. .. py:method:: look_at(eye: Vec3, center: Vec3, up: Vec3) -> Matrix4x4 :staticmethod: Creates a look at :class:`Matrix4x4` from the specified parameters. .. py:method:: from_perspective(fovy: float, aspect: float, near: float, far: float) -> Matrix4x4 :staticmethod: Creates a perspective projection :class:`Matrix4x4` with the specified bounds. .. py:method:: from_quaternion(quat: Quaternion) -> Matrix4x4 :staticmethod: Converts a :class:`Quaternion` into a :class:`Matrix4x4` . .. py:method:: to_quaternion() -> Quaternion Converts the :class:`Matrix4x4` into a :class:`Quaternion` . .. py:method:: get_up() -> Vec3 Returns the up :class:`Vec3` of the :class:`Matrix4x4` , assuming that it is being used as a transform. .. py:method:: get_right() -> Vec3 Returns the right :class:`Vec3` of the :class:`Matrix4x4` , assuming that it is being used as a transform. .. py:method:: get_forward() -> Vec3 Returns the forward :class:`Vec3` of the :class:`Matrix4x4` , assuming that it is being used as a transform. .. py:method:: inverse() -> Matrix4x4 Returns the inverse of the :class:`Matrix4x4` . .. py:method:: transpose() -> Matrix4x4 Transposes the matrix. .. py:method:: determinant() -> float Returns the determinant of the :class:`Matrix4x4` . .. py:method:: __getitem__(index: int) -> Vec4 Returns `index` th column of the :class:`Matrix4x4` as a :class:`Vec4` . .. py:method:: __neg__() -> Matrix4x4 Negates the :class:`Matrix4x4` . .. py:method:: __sub__(other: Matrix4x4 | float) -> Matrix4x4 Subtracts the :class:`Matrix4x4` . .. py:method:: __add__(other: Matrix4x4 | float) -> Matrix4x4 Adds the :class:`Matrix4x4` . .. py:method:: __mul__(other: Matrix4x4 | Vec4 | float) -> Matrix4x4 | Vec4 Multiplies the :class:`Matrix4x4` . .. py:method:: __truediv__(other: Matrix4x4 | float) -> Matrix4x4 Divides the :class:`Matrix4x4` . .. py:class:: Matrix3x4(x0: float, y0, z0: float, w0: float, x1: float, y1: float, z1: float, w1: float, x2: float, y2: float, z2: float, w2: float) A 3 by 4 matrix. .. py:method:: from_identity(value: float) -> Matrix3x4 :staticmethod: Creates a identity matrix with `value`. .. py:method:: __getitem__(index: int) -> Vec4 Returns `index` th column of the :class:`Matrix3x4` as a :class:`Vec4` . .. py:method:: __neg__() -> Matrix3x4 Negates the :class:`Matrix3x4` . .. py:method:: __sub__(other: Matrix3x4 | float) -> Matrix3x4 Subtracts the :class:`Matrix3x4` . .. py:method:: __add__(other: Matrix3x4 | float) -> Matrix3x4 Adds the :class:`Matrix3x4` . .. py:method:: __mul__(other: float | Vec4) -> Matrix3x4 | Vec4 Multiplies the :class:`Matrix3x4` . .. py:method:: __truediv__(other: float) -> Matrix3x4 Divides the :class:`Matrix3x4` by a scalar . .. py:method:: transpose() -> Matrix4x3 Transposes the matrix. .. py:class:: Matrix2x4(x0: float, y0: float, z0: float, w0: float, x1: float, y1: float, z1: float, w1: float) A 2 by 4 matrix. .. py:method:: from_identity(value: float) -> Matrix2x4 :staticmethod: Creates a identity matrix with `value`. .. py:method:: __getitem__(index: int) -> Vec4 Returns `index` th column of the :class:`Matrix2x4` as a :class:`Vec4` . .. py:method:: __neg__() -> Matrix2x4 Negates the :class:`Matrix2x4` . .. py:method:: __sub__(other: Matrix2x4 | float) -> Matrix2x4 Subtracts the :class:`Matrix2x4` . .. py:method:: __add__(other: Matrix2x4 | float) -> Matrix2x4 Adds the :class:`Matrix2x4` . .. py:method:: __mul__(other: float | Vec4) -> Matrix2x4 | Vec4 Multiplies the :class:`Matrix2x4` . .. py:method:: __truediv__(other: float) -> Matrix2x4 Divides the :class:`Matrix2x4` by a scalar . .. py:method:: transpose() -> Matrix4x2 Transposes the matrix. .. py:class:: Matrix3x3(x0: float, y0: float, z0: float, x1: float, y1: float, z1: float, x2: float, y2: float, z2: float) A 3 by 3 matrix. .. py:method:: from_identity(value: float) -> Matrix3x3 :staticmethod: Creates a identity matrix with `value`. .. py:method:: to_quaternion() -> Quaternion Converts the :class:`Matrix3x3` to a Quaternion. .. py:method:: get_up() -> Vec3 Gets the up :class:`Vec3` of the :class:`Matrix3x3` as a transform matrix. .. py:method:: get_right() -> Vec3 Gets the right :class:`Vec3` of the :class:`Matrix3x3` as a transform matrix. .. py:method:: get_forward() -> Vec3 Gets the forward :class:`Vec3` of the :class:`Matrix3x3` as a transform matrix. .. py:method:: inverse() -> Matrix3x3 Inverses the :class:`Matrix3x3` . .. py:method:: determinant() -> float Returns the determinant of the :class:`Matrix3x3` . .. py:method:: __getitem__(index: int) -> Vec3 Returns `index` th column of the :class:`Matrix3x3` as a :class:`Vec3` . .. py:method:: __neg__() -> Matrix3x3 Negates the :class:`Matrix3x3` . .. py:method:: __sub__(other: Matrix3x3 | float) -> Matrix3x3 Subtracts the :class:`Matrix3x3` . .. py:method:: __add__(other: Matrix3x3 | float) -> Matrix3x3 Adds the :class:`Matrix3x3` . .. py:method:: __mul__(other: Matrix3x3 | float | Vec3) -> Matrix3x3 | Vec3 Multiplies the :class:`Matrix3x3` . .. py:method:: __truediv__(other: Matrix3x3 | float) -> Matrix3x3 Divides the :class:`Matrix3x3` . .. py:method:: transpose() -> Matrix3x3 Transposes the matrix. .. py:class:: Matrix4x3(x0: float, y0: float, z0: float, x1: float, y1: float, z1: float, x2: float, y2: float, z2: float, x3: float, y3: float, z3: float) A 4 by 3 matrix. .. py:method:: from_identity(value: float) -> Matrix4x3 :staticmethod: Creates a identity matrix with `value`. .. py:method:: __getitem__(index: int) -> Vec3 Returns `index` th column of the :class:`Matrix4x3` as a :class:`Vec3` . .. py:method:: __neg__() -> Matrix4x3 Negates the :class:`Matrix4x3` . .. py:method:: __sub__(other: Matrix4x3 | float) -> Matrix4x3 Subtracts the :class:`Matrix4x3` . .. py:method:: __add__(other: Matrix4x3 | float) -> Matrix4x3 Adds the :class:`Matrix4x3` . .. py:method:: __mul__(other: float | Vec4) -> Matrix4x3 | Vec3 Multiplies the :class:`Matrix4x3` . .. py:method:: __truediv__(other: float) -> Matrix4x3 Divides the :class:`Matrix4x3` by a scalar. .. py:method:: transpose() -> Matrix3x4 Transposes the matrix. .. py:class:: Matrix2x3(x0: float, y0: float, z0: float, x1: float, y1: float, z1: float) A 2 by 3 matrix. .. py:method:: from_identity(value: float) -> Matrix2x3 :staticmethod: Creates a identity matrix with `value`. .. py:method:: __getitem__(index: int) -> Vec3 Returns `index` th column of the :class:`Matrix4x3` as a :class:`Vec3` . .. py:method:: __neg__() -> Matrix2x3 Negates the :class:`Matrix2x3` . .. py:method:: __sub__(other: Matrix2x3 | float) -> Matrix2x3 Subtracts the :class:`Matrix2x3` . .. py:method:: __add__(other: Matrix2x3 | float) -> Matrix2x3 Adds the :class:`Matrix2x3` . .. py:method:: __mul__(other: float | Vec2 | Vec3) -> Matrix2x3 | Vec3 Multiplies the :class:`Matrix2x3` . .. py:method:: __truediv__(other: float) -> Matrix2x3 Divides the :class:`Matrix2x3` by a scalar. .. py:method:: transpose() -> Matrix3x2 Transposes the matrix. .. py:class:: Matrix2x2(x0: float, y0: float, x1: float, y1: float) A 2 by 2 matrix. .. py:method:: from_identity(value: float) -> Matrix2x2 :staticmethod: Creates a identity matrix with `value`. .. py:method:: inverse() -> Matrix2x2 Inverses the :class:`Matrix2x2` . .. py:method:: determinant() -> float Returns the determinant of the :class:`Matrix2x2` . .. py:method:: __getitem__(index: int) -> Vec2 Returns `index` th column of the :class:`Matrix2x2` as a :class:`Vec2` . .. py:method:: __neg__() -> Matrix2x2 Negates the :class:`Matrix2x2` . .. py:method:: __sub__(other: Matrix2x2 | float) -> Matrix2x2 Subtracts the :class:`Matrix2x2` . .. py:method:: __add__(other: Matrix2x2 | float) -> Matrix2x2 Adds the :class:`Matrix2x2` . .. py:method:: __mul__(other: Matrix2x2 | float | Vec2) -> Matrix2x2 | Vec2 Multiplies the :class:`Matrix2x2` . .. py:method:: __truediv__(other: Matrix2x2 | float) -> Matrix2x2 Divides the :class:`Matrix2x2` . .. py:method:: transpose() -> Matrix2x2 Transposes the matrix. .. py:class:: Matrix3x2(x0: float, y0: float, x1: float, y1: float, x2: float, y2: float) A 3 by 2 matrix. .. py:method:: from_identity(value: float) -> Matrix3x2 :staticmethod: Creates a identity matrix with `value`. .. py:method:: __getitem__(index: int) -> Vec2 Returns `index` th column of the :class:`Matrix3x2` as a :class:`Vec2` . .. py:method:: __neg__() -> Matrix3x2 Negates the :class:`Matrix3x2` . .. py:method:: __sub__(other: Matrix3x2 | float) -> Matrix3x2 Subtracts the :class:`Matrix3x2`. .. py:method:: __add__(other: Matrix3x2 | float) -> Matrix3x2 Adds the :class:`Matrix3x2` . .. py:method:: __mul__(other: float | Vec3) -> Matrix3x2 | Vec2 Multiplies the :class:`Matrix3x2` . .. py:method:: __truediv__(other: float) -> Matrix3x2 Divides the :class:`Matrix3x2` by a scalar. .. py:method:: transpose() -> Matrix2x3 Transposes the matrix. .. py:class:: Matrix4x2(x0: float, y0: float, x1: float, y1: float, x2: float, y2: float, x3: float, y3: float) A 4 by 2 matrix. .. py:method:: from_identity(value: float) -> Matrix4x2 :staticmethod: Creates a identity matrix with `value`. .. py:method:: __getitem__(index: int) -> Vec2 Returns `index` th column of the :class:`Matrix4x2` as a :class:`Vec2` . .. py:method:: __neg__() -> Matrix4x2 Negates the :class:`Matrix4x2` . .. py:method:: __sub__(other: Matrix4x2 | float) -> Matrix4x2 Subtracts the :class:`Matrix4x2` . .. py:method:: __add__(other: Matrix4x2 | float) -> Matrix4x2 Adds the :class:`Matrix4x2` . .. py:method:: __mul__(other: float | Vec4) -> Matrix4x2 | Vec2 Multiplies the :class:`Matrix4x2` . .. py:method:: __truediv__(other: float) -> Matrix4x2 Divides the :class:`Matrix4x2` by a scalar. .. py:method:: transpose() -> Matrix2x4 Transposes the matrix. .. py:class:: Font(font_path: str, font_size: int = 48) Renders the specified Font to the screen. Usable with :class:`Text` . .. py:class:: Text(text_string: str, color: Vec4, position: Vec2, scale: Vec2 = Vec2(1.0, 1.0), rotation: float = 0, font: Font | None = None, material: Material | None = None) Renders the specified Text to the screen with the specified :class:`Font` . .. py:property:: rotation :type: float The rotation of the text. .. py:property:: position :type: Vec2 The :class:`Vec2` position of the text. .. py:property:: scale :type: Vec2 The :class:`Vec2` scale of the text. .. py:property:: color :type: Vec4 The :class:`Vec4` color of the text. .. py:property:: material :type: Material The :class:`Material` of the text. .. py:property:: font :type: Font The :class:`Font` of the text. .. py:property:: text :type: str The content of the text object. .. py:class:: CubeMap(right_path: str, left_path: str, top_path: str, bottom_path: str, back_path: str, front_path: str) A cubemap. Can be used to create a :class:`SkyBox` . .. py:class:: SkyBox(cube_map: CubeMap, mat: Material | None = None) A :class:`CubeMap` skybox. Can be applied to :attr:`Window.sky_box` . .. py:property:: material :type: Material The :class:`Material` used to render the :class:`SkyBox` . .. py:property:: cubemap :type: CubeMap The :class:`CubeMap` used in rendering the :class:`SkyBox` . .. py:class:: Emitter(position: Vec3, direction: Quaternion, scale_min: Vec2 = Vec2(1.0, 1.0), scale_max: Vec2 = Vec2(1.0, 1.0), rate: int = 50, decay_rate: float = 1.0, spread: float = math.radians(30), velocity_decay: float = 1.0, start_velocity_min: float = 1.0, start_velocity_max: float = 1.0, start_lifetime_min: float = 10.0, start_lifetime_max: float = 10.0, color_min: Vec4 = Vec4(1.0, 1.0, 1.0, 1.0), color_max: Vec4 = Vec4(1.0, 1.0, 1.0, 1.0), material: Material | None = None) Emits particles. .. py:method:: start() -> None Starts emitting particles. .. py:method:: stop() -> None Stops emitting particles. .. py:property:: material :type: Material The :class:`Material` for the particle. .. py:property:: position :type: Vec3 The :class:`Vec3` position of the emitter. .. py:property:: direction :type: Quaternion The :class:`Quaternion` direction of the emitter. .. py:property:: color_min :type: Vec4 The :class:`Vec4` minimum color of the particles. The color of the particle will be randomly selected between `Emitter.color_min` and `Emitter.color_max` . .. py:property:: color_max :type: Vec4 The :class:`Vec4` maximum color of the particles. The color of the particle will be randomly selected between `Emitter.color_min` and `Emitter.color_max` . .. py:property:: scale_min :type: Vec2 The :class:`Vec2` minimum scale of the particles. The scale of the particle will be randomly selected between `Emitter.scale_min` and `Emitter.scale_max` . .. py:property:: scale_max :type: Vec2 The :class:`Vec2` maximum scale of the particles. The scale of the particle will be randomly selected between `Emitter.scale_min` and `Emitter.scale_max` . .. py:property:: rate :type: int The ammount of particles present at any one time. .. py:property:: decay_rate :type: float The speed of decay, or how much a particle's life decreases each second. When a particle's life reaches 0, it disappears. .. py:property:: spread :type: float The radius of the cone of particle spread. .. py:property:: velocity_decay :type: float The ammount a particle's velocity decreases over time. .. py:property:: start_velocity_min :type: float The minimum starting velocity of a particle. The start velocity of a particle will be randomly selected between `Emitter.start_velocity_min` and `Emitter.start_velocity_max` . .. py:property:: start_velocity_max :type: float The maximum starting velocity of a particle. The start velocity of a particle will be randomly selected between `Emitter.start_velocity_min` and `Emitter.start_velocity_max` . .. py:property:: start_lifetime_min :type: float The minimum starting life value of a particle. The start life value of a particle will be randomly selected between `Emitter.start_lifetime_min` and `Emitter.start_lifetime_max` . .. py:property:: start_lifetime_max :type: float The maximum starting life value of a particle. The start life value of a particle will be randomly selected between `Emitter.start_lifetime_min` and `Emitter.start_lifetime_max` . .. py:class:: Sound(win: Window, source: str, loop: bool) A sound asset. This can also be used to play sounds directly. .. py:method:: play(volume: float = 1.0, panning: float = 0.0, pitch: float = 1.0, position: Vec3 | None = None) -> None Plays the sound globally. If a :class:`Vec3` `position` is specified, the panning and volume will be balanced to play from that position relative to the camera. It will play with the same panning and volume until the sound is finished. For dynamic positional audio see :class:`Sound3D` . .. py:method:: stop() -> None Stops the sound if it is playing.