lonkaars / liehjuck

Simple software rasterizer (school project)
3 stars 0 forks source link

Replace position/scale/orientation classes with typedefs to floatXYZ #9

Closed lonkaars closed 4 years ago

lonkaars commented 4 years ago

Instead of having 3 classes that define float x,y,z under different names, it would be more efficient to have a single floatXYZ class that is aliased to position/scale/orientation with typedefs:

class position {
    public:
    float x;
    float y;
    float z;
}

class scale {
    public:
    float x;
    float y;
    float z;
}

to

class floatXYZ {
    public:
    float x;
    float y;
    float z;
}

typedef floatXYZ position;
typedef floatXYZ scale;

This would also remove the need for duplicating from_json definitions for functionally identical classes.