#does it make sense for a skinned model to be its own type?

5 messages · Page 1 of 1 (latest)

glossy bough
#

when I was adding animations I created SkinnedModel, SkinnedMesh, and SkinnedVertex which are pretty much identical to their non skinned types:

struct Vertex
{
    glm::vec3 position;
    glm::vec3 normal;
    glm::vec2 texCoords;
    glm::vec3 tangent;
};

struct SkinnedVertex
{
    glm::vec3 position;
    glm::vec3 normal;
    glm::vec2 texCoords;
    int boneIDs[4];
    float boneWeights[4];
    glm::vec3 tangent;
};

struct Model
{
    Mesh mesh;
    Material material;
    std::vector<Texture> textures;
};

struct SkinnedModel
{
    SkinnedMesh mesh;
    Material material;
    std::vector<Texture> textures;
};

Model LoadModel(const std::string& filepath);
SkinnedModel LoadSkinnedModel(const std::string& filepath);

I'm starting to have second thoughts if this was the right decision because if I had character.fbx and house.fbx like sure the house doesn't have a skeleton or anything, but I feel like I should still be able to treat both as a model and do things like GetModel()

runic marlin
#

Imo it can make sense but it depends on your usecases. Do you want them to be separate? Do you want a different api for meshes with/without a skeleton? etc...

keen cipher
#

I have my meshdata class be a template with the type of vertex

#

Meshdata<Vertex> vs Meshdata<SkinnedVertex> etc

#

then u can just have template functions that are vertex type agnostic