2022-01-13 05:24:03 +01:00
|
|
|
globalvar MATRIX_IDENTITY;
|
|
|
|
|
|
|
|
MATRIX_IDENTITY = matrix_build_identity();
|
|
|
|
|
|
|
|
#region format
|
|
|
|
vertex_format_begin();
|
|
|
|
vertex_format_add_position();
|
|
|
|
vertex_format_add_color();
|
|
|
|
global.format_pc = vertex_format_end();
|
|
|
|
#endregion
|
|
|
|
|
2023-08-22 11:51:45 +02:00
|
|
|
function vertex_add_pt(buffer, position, texture) {
|
2023-11-08 08:38:04 +01:00
|
|
|
INLINE
|
2023-08-22 11:51:45 +02:00
|
|
|
vertex_position_3d(buffer, position[0], position[1], position[2]);
|
|
|
|
vertex_texcoord(buffer, texture[0], texture[1]);
|
2022-12-12 09:08:03 +01:00
|
|
|
}
|
|
|
|
|
2023-08-22 11:51:45 +02:00
|
|
|
function vertex_add_pnt(buffer, position, normal, texture) {
|
2023-11-08 08:38:04 +01:00
|
|
|
INLINE
|
2023-08-22 11:51:45 +02:00
|
|
|
vertex_position_3d(buffer, position[0], position[1], position[2]);
|
|
|
|
vertex_normal(buffer, normal[0], normal[1], normal[2]);
|
|
|
|
vertex_texcoord(buffer, texture[0], texture[1]);
|
2023-07-25 20:12:40 +02:00
|
|
|
}
|
|
|
|
|
2023-08-22 11:51:45 +02:00
|
|
|
function vertex_add_pntc(buffer, position, normal, texture, color = c_white, alpha = 1) {
|
2023-11-08 08:38:04 +01:00
|
|
|
INLINE
|
2023-08-22 11:51:45 +02:00
|
|
|
vertex_position_3d(buffer, position[0], position[1], position[2]);
|
|
|
|
vertex_normal(buffer, normal[0], normal[1], normal[2]);
|
|
|
|
vertex_texcoord(buffer, texture[0], texture[1]);
|
|
|
|
vertex_color(buffer, color, alpha);
|
|
|
|
}
|
|
|
|
|
2024-06-22 04:19:30 +02:00
|
|
|
function __vertex_add_pntc(buffer, _px, _py, _pz, _nx, _ny, _nz, _u, _v, color = c_white, alpha = 1) {
|
|
|
|
INLINE
|
|
|
|
vertex_position_3d(buffer, _px, _py, _pz);
|
|
|
|
vertex_normal(buffer, _nx, _ny, _nz);
|
|
|
|
vertex_texcoord(buffer, _u, _v);
|
|
|
|
vertex_color(buffer, color, alpha);
|
|
|
|
}
|
|
|
|
|
2023-08-22 11:51:45 +02:00
|
|
|
function vertex_add_2pc(buffer, _x, _y, color, alpha = 1) {
|
2023-11-08 08:38:04 +01:00
|
|
|
INLINE
|
2023-08-22 11:51:45 +02:00
|
|
|
vertex_position(buffer, _x, _y);
|
|
|
|
vertex_color(buffer, color, alpha);
|
2023-08-22 20:10:09 +02:00
|
|
|
}
|
|
|
|
|
2024-03-02 10:08:44 +01:00
|
|
|
function vertex_add_2pct(buffer, _x, _y, _u, _v, color, alpha = 1) {
|
|
|
|
INLINE
|
|
|
|
vertex_position(buffer, _x, _y);
|
|
|
|
vertex_color(buffer, color, alpha);
|
|
|
|
vertex_texcoord(buffer, _u, _v);
|
|
|
|
}
|
|
|
|
|
2023-08-22 20:10:09 +02:00
|
|
|
function vertex_add_v(buffer, vertex) {
|
2023-11-08 08:38:04 +01:00
|
|
|
INLINE
|
2023-08-22 20:10:09 +02:00
|
|
|
vertex_position_3d(buffer, vertex.x, vertex.y, vertex.z);
|
|
|
|
}
|
|
|
|
|
|
|
|
function vertex_add_vc(buffer, vertex) {
|
2023-11-08 08:38:04 +01:00
|
|
|
INLINE
|
2023-08-22 20:10:09 +02:00
|
|
|
vertex_position_3d(buffer, vertex.x, vertex.y, vertex.z);
|
|
|
|
vertex_color(buffer, vertex.color, vertex.alpha);
|
|
|
|
}
|
|
|
|
|
|
|
|
function vertex_add_vnt(buffer, vertex) {
|
2023-11-08 08:38:04 +01:00
|
|
|
INLINE
|
2023-08-22 20:10:09 +02:00
|
|
|
vertex_position_3d(buffer, vertex.x, vertex.y, vertex.z);
|
2023-08-29 14:33:44 +02:00
|
|
|
vertex_normal(buffer, vertex.nx, vertex.ny, vertex.nz);
|
|
|
|
vertex_texcoord(buffer, vertex.u, vertex.v);
|
2023-08-22 20:10:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function vertex_add_vntc(buffer, vertex) {
|
2023-11-08 08:38:04 +01:00
|
|
|
INLINE
|
2023-08-22 20:10:09 +02:00
|
|
|
vertex_position_3d(buffer, vertex.x, vertex.y, vertex.z);
|
2023-08-29 14:33:44 +02:00
|
|
|
vertex_normal(buffer, vertex.nx, vertex.ny, vertex.nz);
|
|
|
|
vertex_texcoord(buffer, vertex.u, vertex.v);
|
2023-08-22 20:10:09 +02:00
|
|
|
vertex_color(buffer, vertex.color, vertex.alpha);
|
2022-01-13 05:24:03 +01:00
|
|
|
}
|