Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Faster Mesh #614

Merged
merged 8 commits into from
Nov 8, 2023
Merged

Faster Mesh #614

merged 8 commits into from
Nov 8, 2023

Conversation

Squigglecito
Copy link
Contributor

I have rewritten the Mesh class to have faster generation.

In addition, the vertices, colors, uvs, normals, triangles can also be bytes-like objects now (e.g. array.array, numpy arrays, or bytearray).

Triangles can have mixed line segments, triangles, and quads via tuples of length 2, 3, and 4 respectively.

I have added a new vertex_buffer parameter to the init with the vertex_buffer_length parameter being the number of vertices in the vertex buffer, and vertex_buffer_format being a vertex format string for the vertex buffer. The vertex buffer format string's format is comma separated triplets of number, data type, attribute type. Example: "3fp,4fc,3fn". The number at the start of each triplet is how many values. The letter following the number is the data type of those values. The current types supported are "f" for 32 bit floats, and "I" for unsigned 32 bit integers. The letters are intended to follow the same convention as found in Python's struct functions (https://docs.python.org/3/library/struct.html#format-characters). Following that first character, is another character that specifies the vertex attribute type. The current supported types are "p" for vertex position, "c" for vertex color, "t" for texture coordinate, and "n" for normal vector. The given sample has vertices with a position composed of 3 floats, a color composed of 4 floats, and a normal composed of 3 floats.

@pokepetter pokepetter merged commit c7b75de into pokepetter:master Nov 8, 2023
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants