python3D


Namepython3D JSON
Version 2024.1.3 PyPI version JSON
download
home_pageNone
Summaryp3D is a pythonic 3D engine that can simulate textured OBJ models. p3D features logs, preferences, customization, and simple code structure.
upload_time2025-01-05 22:37:06
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseNone
keywords 3d 3d engine engine game game engine p3d py3d python3d
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # p3D
### A cross-platform, fully-featured 3D engine, made in Python.
[![Get it on GitHub](https://gist.github.com/cxmeel/0dbc95191f239b631c3874f4ccf114e2/raw/github.svg)](https://github.com/aaravdave/p3D)
[![Get it on PyPI](https://gist.github.com/cxmeel/0dbc95191f239b631c3874f4ccf114e2/raw/documentation_learn.svg)](https://pypi.org/project/python3D/)
## Getting Started
To install the package, run this command in the directory of your project's code.
```commandline
pip install python3D
```
You can now start writing your first 3D script. Paste the following code to get started.
```python
import python3D as p3D


def setup():
    """Put your setup code here, to run once."""
    global models


def loop(elapsed_time):
    """Put your main code here, to run repeatedly."""


p3D.run(setup, loop)
```
> The `setup` and `loop` functions are not required parameters of `p3D.run()`, but all project functions are added in them.

You're ready to start developing in 3D!

## Documentation
### Models
To add an OBJ model, you can use the `models` registry in your `setup()` function.
```python
def setup():
    """Put your setup code here, to run once."""
    global models
    p3D.models['model'] = p3D.Model('model.obj', 'optional_texture.png')
```
To modify the transformational properties of your models, you can use the `change_position()` property.
```python
models['model'].change_position(x=1)
```
> When in the `loop()` function, you must use `p3D.models['model']` instead.

`x`, `y`, `z` - left/right, up/down, and forward/backward displacements, respectively

`rot_x`, `rot_y`, `rot_z` - rotation on x, y, and z axes, respectively

`scale` - percentage-based size change of model. *Support for axis-based scaling is not supported at this time.*

`reset` - takes inputted values as the new position of the model when set to `1`; `0` by default (adds new values to current values).

### Preferences
`p3D.preferences` can be used to modify functionality by changing an attribute.
```python
p3D.preferences['attribute'] = value
```
The following attributes are available:
- `'title'` - string used for default loading screen, window caption, and system logs. `'p3D'` by default.
- `'camera'` - list `[x, y, z, h, v]` of starting camera attributes where `x`, `y`, `z` is the position of the camera and `h`, `v` is the starting horizontal and vertical camera angles. `[0, 0, 0, 0.01, 0.01]` by default.
  - The amount of decimal places in the starting horizontal and vertical camera angles is the amount of decimal places possible in simulation. For example, having `0`, `0` as your `h`, `v` values would make the camera rotate in integer values only, reducing freedom.
- `'font'` - string file path to font file of choice. `font.ttf` by default.
- `'skybox'` - string file path to skybox image of choice; replaces black environment. `None` by default.
- `'loading'` - function taking parameters `surface` and `title`, regardless of whether they are used. Custom loading screens must be drawn on with pygame functions.
- `'GUI'` - boolean value determining whether to show runtime metrics. `False` by default.

### Logs
The `p3D.log()` function takes in three parameters (`prefix`, `message`, `data=None`) and logs in the command line in color, if supported.

`prefix` - determines type of message sent. Possible values include:
- `'warning'`: yellow, user warnings
- `'error'`: red, both computational and logical errors
- `'log'`: blue, general messages, runtime checkpoints, and data logging

`message` - message body to be sent; should be one line.

`data` - list, where each item appears after the message body on a separate line.

#### Proper Usage
When using the `p3D.log()` function, following proper usage guides can ensure that in-built engine logs match the style of your project's logs.
- Use warnings when something atypical for your project (e.g., a user hasn't claimed their account and information may be lost) occurs, **NOT** when an error is anticipated.
- Errors should be used for issues specific to your project (e.g., an item is too expensive for the player to buy).
  - If a runtime error occurs, `FATAL. ` must precede your `message`, and for specific errors, you must include relevant information (e.g. filenames) in the `data` list.
  - If the error is not specific (i.e. general `Exception`), then after relevant information, include `f'Error {str(e)}` in the `data` list.
  - Unhelpful error messages often don't include a fix or course of action.
- Make sure to log all important stages of app progression (e.g, a user signs up).

# Other
### Issue Reporting
To report issues, please refer to our [GitHub Issues](https://github.com/aaravdave/p3D/issues) page.
### Contacts
For questions concerning the contents of this repository, please contact aaravhdave[at]gmail.com.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "python3D",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "3D, 3D engine, engine, game, game engine, p3D, py3D, python3D",
    "author": null,
    "author_email": "Aarav Dave <aaravhdave@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/5b/68/c912c0ed9d590e74800473b414ad781796867a60d02dc4fd583e0d6c47a3/python3d-2024.1.3.tar.gz",
    "platform": null,
    "description": "# p3D\n### A cross-platform, fully-featured 3D engine, made in Python.\n[![Get it on GitHub](https://gist.github.com/cxmeel/0dbc95191f239b631c3874f4ccf114e2/raw/github.svg)](https://github.com/aaravdave/p3D)\n[![Get it on PyPI](https://gist.github.com/cxmeel/0dbc95191f239b631c3874f4ccf114e2/raw/documentation_learn.svg)](https://pypi.org/project/python3D/)\n## Getting Started\nTo install the package, run this command in the directory of your project's code.\n```commandline\npip install python3D\n```\nYou can now start writing your first 3D script. Paste the following code to get started.\n```python\nimport python3D as p3D\n\n\ndef setup():\n    \"\"\"Put your setup code here, to run once.\"\"\"\n    global models\n\n\ndef loop(elapsed_time):\n    \"\"\"Put your main code here, to run repeatedly.\"\"\"\n\n\np3D.run(setup, loop)\n```\n> The `setup` and `loop` functions are not required parameters of `p3D.run()`, but all project functions are added in them.\n\nYou're ready to start developing in 3D!\n\n## Documentation\n### Models\nTo add an OBJ model, you can use the `models` registry in your `setup()` function.\n```python\ndef setup():\n    \"\"\"Put your setup code here, to run once.\"\"\"\n    global models\n    p3D.models['model'] = p3D.Model('model.obj', 'optional_texture.png')\n```\nTo modify the transformational properties of your models, you can use the `change_position()` property.\n```python\nmodels['model'].change_position(x=1)\n```\n> When in the `loop()` function, you must use `p3D.models['model']` instead.\n\n`x`, `y`, `z` - left/right, up/down, and forward/backward displacements, respectively\n\n`rot_x`, `rot_y`, `rot_z` - rotation on x, y, and z axes, respectively\n\n`scale` - percentage-based size change of model. *Support for axis-based scaling is not supported at this time.*\n\n`reset` - takes inputted values as the new position of the model when set to `1`; `0` by default (adds new values to current values).\n\n### Preferences\n`p3D.preferences` can be used to modify functionality by changing an attribute.\n```python\np3D.preferences['attribute'] = value\n```\nThe following attributes are available:\n- `'title'` - string used for default loading screen, window caption, and system logs. `'p3D'` by default.\n- `'camera'` - list `[x, y, z, h, v]` of starting camera attributes where `x`, `y`, `z` is the position of the camera and `h`, `v` is the starting horizontal and vertical camera angles. `[0, 0, 0, 0.01, 0.01]` by default.\n  - The amount of decimal places in the starting horizontal and vertical camera angles is the amount of decimal places possible in simulation. For example, having `0`, `0` as your `h`, `v` values would make the camera rotate in integer values only, reducing freedom.\n- `'font'` - string file path to font file of choice. `font.ttf` by default.\n- `'skybox'` - string file path to skybox image of choice; replaces black environment. `None` by default.\n- `'loading'` - function taking parameters `surface` and `title`, regardless of whether they are used. Custom loading screens must be drawn on with pygame functions.\n- `'GUI'` - boolean value determining whether to show runtime metrics. `False` by default.\n\n### Logs\nThe `p3D.log()` function takes in three parameters (`prefix`, `message`, `data=None`) and logs in the command line in color, if supported.\n\n`prefix` - determines type of message sent. Possible values include:\n- `'warning'`: yellow, user warnings\n- `'error'`: red, both computational and logical errors\n- `'log'`: blue, general messages, runtime checkpoints, and data logging\n\n`message` - message body to be sent; should be one line.\n\n`data` - list, where each item appears after the message body on a separate line.\n\n#### Proper Usage\nWhen using the `p3D.log()` function, following proper usage guides can ensure that in-built engine logs match the style of your project's logs.\n- Use warnings when something atypical for your project (e.g., a user hasn't claimed their account and information may be lost) occurs, **NOT** when an error is anticipated.\n- Errors should be used for issues specific to your project (e.g., an item is too expensive for the player to buy).\n  - If a runtime error occurs, `FATAL. ` must precede your `message`, and for specific errors, you must include relevant information (e.g. filenames) in the `data` list.\n  - If the error is not specific (i.e. general `Exception`), then after relevant information, include `f'Error {str(e)}` in the `data` list.\n  - Unhelpful error messages often don't include a fix or course of action.\n- Make sure to log all important stages of app progression (e.g, a user signs up).\n\n# Other\n### Issue Reporting\nTo report issues, please refer to our [GitHub Issues](https://github.com/aaravdave/p3D/issues) page.\n### Contacts\nFor questions concerning the contents of this repository, please contact aaravhdave[at]gmail.com.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "p3D is a pythonic 3D engine that can simulate textured OBJ models. p3D features logs, preferences, customization, and simple code structure.",
    "version": "2024.1.3",
    "project_urls": {
        "Homepage": "https://github.com/aaravdave/p3D",
        "Issues": "https://github.com/aaravdave/p3D/issues"
    },
    "split_keywords": [
        "3d",
        " 3d engine",
        " engine",
        " game",
        " game engine",
        " p3d",
        " py3d",
        " python3d"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4449f142c0ca8afca607f43064ab075bd760a3dbecdb61943fe975dfdd2c66ff",
                "md5": "2d0ef77826c3371642fc9c2c73ef0f6b",
                "sha256": "9e50d6c7eccb6fb923e7ba2824d0e09081dd48c60b9367d9656e3b47da8ec1a4"
            },
            "downloads": -1,
            "filename": "python3d-2024.1.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "2d0ef77826c3371642fc9c2c73ef0f6b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 12001,
            "upload_time": "2025-01-05T22:37:02",
            "upload_time_iso_8601": "2025-01-05T22:37:02.544050Z",
            "url": "https://files.pythonhosted.org/packages/44/49/f142c0ca8afca607f43064ab075bd760a3dbecdb61943fe975dfdd2c66ff/python3d-2024.1.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5b68c912c0ed9d590e74800473b414ad781796867a60d02dc4fd583e0d6c47a3",
                "md5": "5d57cb928d68402542c9fc560202af61",
                "sha256": "1fbb26970d11414877dfc1966b89bd408c99faab3b6a8baa733918a16eac54be"
            },
            "downloads": -1,
            "filename": "python3d-2024.1.3.tar.gz",
            "has_sig": false,
            "md5_digest": "5d57cb928d68402542c9fc560202af61",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 11169,
            "upload_time": "2025-01-05T22:37:06",
            "upload_time_iso_8601": "2025-01-05T22:37:06.723791Z",
            "url": "https://files.pythonhosted.org/packages/5b/68/c912c0ed9d590e74800473b414ad781796867a60d02dc4fd583e0d6c47a3/python3d-2024.1.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-05 22:37:06",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "aaravdave",
    "github_project": "p3D",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "python3d"
}
        
Elapsed time: 1.78041s