Skip to content

Instantly share code, notes, and snippets.

@Const-me
Created February 16, 2018 22:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Const-me/0e18d895481a7c0556c102f6bff973f0 to your computer and use it in GitHub Desktop.
Save Const-me/0e18d895481a7c0556c102f6bff973f0 to your computer and use it in GitHub Desktop.
#include <stdint.h>
#include <string>
#include <vector>
#include <array>
#include <memory>
// Can be hundreds of megabytes in these vectors
class Mesh
{
std::string name;
std::vector<Vector3> vertices;
std::vector<std::array<uint32_t, 3>> indices;
BoundingBox bbox;
};
// Just 72 or 80 bytes, very cheap to copy. Can e.g. pass copies to another threads for background processing.
class Model
{
std::shared_ptr<Mesh> mesh;
Matrix transform;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment