https://github.com/red1c3/mesh-loader
A GLM data mesh loader
https://github.com/red1c3/mesh-loader
glm graphics mesh
Last synced: over 1 year ago
JSON representation
A GLM data mesh loader
- Host: GitHub
- URL: https://github.com/red1c3/mesh-loader
- Owner: Red1C3
- License: unlicense
- Created: 2022-10-10T22:39:44.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-10-13T22:28:00.000Z (over 3 years ago)
- Last Synced: 2025-01-10T15:18:18.889Z (over 1 year ago)
- Topics: glm, graphics, mesh
- Language: C++
- Homepage:
- Size: 14.6 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
# mesh-loader
A GLM data mesh loader
## Support
All Assimp supported formats are supported, so far, the library extracts position, normals, uv0 and indices data.
## Requirements
GLM and Assimp must be installed on the system.
## Usage
The library uses the decorator pattern to load mesh data so it only loads what you need, if you request a data that wasn't loaded, an empty vector will be returned.
The library takes advantage of GLM's datatypes which are widely used in graphics applications.
Usage example:
```
unique_ptr mesh = make_unique(
make_unique(
make_unique(
make_unique(
make_unique(nullptr)))));
mesh->load("./data/cube.glb", 0);
vector pos = mesh->getPositions();
cout << pos.size() << endl;
for (vec3 v : pos)
{
cout << v.x << " " << v.y << " " << v.z << endl;
}
vector norms = mesh->getNormals();
cout << norms.size() << endl;
for (vec3 v : norms)
{
cout << v.x << " " << v.y << " " << v.z << endl;
}
vector uv0 = mesh->getUvCoords0();
cout << uv0.size() << endl;
for (vec2 v : uv0)
{
cout << v.x << " " << v.y << endl;
}
vector indices =mesh->getIndices();
cout << indices.size() << endl;
for (unsigned i : indices)
{
cout << i << endl;
}
```
## Installtion
On Unix-based systems, it's easier to use Meson for installation, Windows users will have to compile and move the compiled files to a suitable location.
## Motivation
I've written mesh loading code many times and just decided to create a loader instead !