aboutsummaryrefslogtreecommitdiff
path: root/src/o3d/vertex_data.h
blob: 22fa76bc101bf52212ec8900edafe9060735cc03 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#ifndef O3D_VERTEX_DATA_H
#define O3D_VERTEX_DATA_H

#include "math/vector.h"

using
    engine::math::Vector3;

namespace engine::o3d {

struct VertexData {
    static constexpr VertexData lerp(const VertexData& vd1, const VertexData& vd2, float b0) {
        return {
            b0 * vd1.world_loc + (1.f - b0) * vd2.world_loc,
        };
    }

    static constexpr VertexData bilerp(const VertexData& vd1, const VertexData& vd2, const VertexData& vd3, float b0, float b1) {
        return {
            b0 * vd1.world_loc + b1 * vd2.world_loc + (1.f - b0 - b1) * vd3.world_loc,
        };
    }

    Vector3 world_loc;
};

}

#endif // O3D_VERTEX_DATA_H