Bound line type

This commit is contained in:
2023-05-27 17:07:15 +02:00
parent 81bb8c76fa
commit f67361c62b
3 changed files with 23 additions and 5 deletions

View File

@@ -50,6 +50,8 @@ namespace JabyEngine {
Code code = IdentityCode;
};
typedef Vertex Body;
union {
Head head;
Vertex vertex;
@@ -67,6 +69,19 @@ namespace JabyEngine {
return {.vertex = {static_cast<short>(0xF000), static_cast<short>(0xF000u)}};
}
};
struct LineMaker {
// Make this it's own outside type??
template<typename T, size_t N>
struct Type {
T head;
T body[N];
};
static constexpr Type<LINE_F, 2> new_line_f(const Color24& color, const Vertex (&vertices)[2]) {
return Type<LINE_F, 2>{.head = LINE_F::new_line(color, false), .body = {LINE_F::new_point(vertices[0]), LINE_F::new_point(vertices[1])}};
}
};
}
}

View File

@@ -50,6 +50,11 @@ namespace JabyEngine {
internal::render(reinterpret_cast<const uint32_t*>(&line), N);
}
template<size_t N>
static void render(const LineMaker::Type<LINE_F, N>& line_type) {
internal::render(reinterpret_cast<const uint32_t*>(&line_type), sizeof(line_type)/sizeof(uint32_t));
}
uint8_t swap_buffers_vsync(uint8_t syncs, bool clear_screen = true);
}
}