Skip to main content

A 3D engine based on OpenGL and pygame for beginners

Project description

soup3D

English | 简体中文

A 3D engine based on OpenGL and pygame that is easy for beginners to learn, and can be used for 3D game development, data visualization, 3D graphics rendering, and other development tasks.

Installation

If your python environment includes pip, you can install it using the following command:

pip install soup3D

Quick Start

After installation, you can try this code:

import soup3D  # 3D rendering library
import pygame  # pygame window library for displaying soup3D rendered images

if __name__ == '__main__':
    pygame.init()                                                            # Initialize pygame
    pygame.display.set_caption("soup3D")                                     # Set pygame window title
    pygame.display.set_mode((1920, 1080), pygame.DOUBLEBUF | pygame.OPENGL)  # Configure window mode
    soup3D.init(bg_color=(1, 1, 1), width=1920, height=1080)                 # Initialize soup3D

    soup3D.light.ambient(1, 1, 1)  # Set ambient light to maximum

    surface = soup3D.shader.AutoSP(soup3D.shader.MixChannel((1, 1), 1, 0.5, 0))  # Create orange surface shader
    face = soup3D.Face(  # Create a right triangle
        soup3D.TRIANGLE_L,
        surface,
        (
            (0, 0, 0, 0, 0),  # (x, y, z, u, v)
            (1, 0, 0, 0, 0),
            (0, 1, 0, 0, 0)
        )
    )
    model = soup3D.Model(0, 0, -5, face)  # Add triangle to model
    model.show()  # Display model

    running = True  # Running status
    while running:  # Main loop
        soup3D.update()  # Update soup3D
        pygame.display.flip()  # Refresh pygame screen
        for event in pygame.event.get():  # Iterate through all events
            if event.type == pygame.QUIT:  # Detect window closing event
                pygame.quit()  # Close window
                running = False  # End loop

If the environment is properly configured, you will see an orange triangle in the window after running this code.

Contributing

Due to limited individual development capabilities, we welcome like-minded people to develop this project together. But for better code management, please first understand our development goals and code standards.

  • Development Goals

    The purpose of developing this project is to create a 3D rendering engine that is easy to use while also having professional capabilities. We want Python developers to be able to develop 3D applications in a way that suits their habits.

  • Code Standards

    Following these standards will increase the likelihood of your code being accepted:

    1. All functions, classes, and class methods must have reStructuredText format comments

    2. Test your code before submitting a PR. Please refer to the Function Testing section below for testing methods

    3. Confirm requirements with the author before developing any module

    4. New features should not affect the calling methods of existing features

    5. Do not import modules anywhere except at the beginning of files

    6. Do not nest function definitions. All functions except class member functions must be defined in the global scope of their files

    7. Class member variables can be accessed from outside the class, but do not modify them externally. If modification is needed, add class member functions instead

  • Function Testing

    After development, you can test functionality in the following way:

    1. Create a test environment with the following structure
      Directory Structure

    2. Edit test code in .../project/test.py to test the functions you've written

    3. Run .../project/test.py. If it runs successfully, the test is successful

More Information

This library has many more methods for you to use. For more information, please refer to the Help Document

License

This project is licensed under the MIT License, see the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

soup3d-5.2.0.tar.gz (83.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

soup3d-5.2.0-py3-none-any.whl (40.3 kB view details)

Uploaded Python 3

File details

Details for the file soup3d-5.2.0.tar.gz.

File metadata

  • Download URL: soup3d-5.2.0.tar.gz
  • Upload date:
  • Size: 83.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for soup3d-5.2.0.tar.gz
Algorithm Hash digest
SHA256 7a3bd78919acdc5aa05bdc8ff1229dffd82d1927257bd8df061ce7ce1affc85d
MD5 ca4648939b54b19065cf4aa473d1f141
BLAKE2b-256 488305b958270ccdd4b9906e071207eabe0ed3be8a8a2c967a947a97e5c5b5fe

See more details on using hashes here.

File details

Details for the file soup3d-5.2.0-py3-none-any.whl.

File metadata

  • Download URL: soup3d-5.2.0-py3-none-any.whl
  • Upload date:
  • Size: 40.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for soup3d-5.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 19dc98d81a1998ca1e430a3a67dfa38b6bb63bd43d07679f84f8bae6b46a1f2c
MD5 b23b7f969b09348cf86acb296f437206
BLAKE2b-256 031fa2730fe13e6c35da5954b2066c8332bff4c8fda42656691ddf6a29cdffd2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page