mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2024-12-26 15:06:22 +01:00
63 lines
No EOL
2 KiB
Text
63 lines
No EOL
2 KiB
Text
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
|
|
|
|
function vertex_add_pt(buffer, position, texture) {
|
|
gml_pragma("forceinline");
|
|
vertex_position_3d(buffer, position[0], position[1], position[2]);
|
|
vertex_texcoord(buffer, texture[0], texture[1]);
|
|
}
|
|
|
|
function vertex_add_pnt(buffer, position, normal, texture) {
|
|
gml_pragma("forceinline");
|
|
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]);
|
|
}
|
|
|
|
function vertex_add_pntc(buffer, position, normal, texture, color = c_white, alpha = 1) {
|
|
gml_pragma("forceinline");
|
|
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);
|
|
}
|
|
|
|
function vertex_add_2pc(buffer, _x, _y, color, alpha = 1) {
|
|
gml_pragma("forceinline");
|
|
vertex_position(buffer, _x, _y);
|
|
vertex_color(buffer, color, alpha);
|
|
}
|
|
|
|
function vertex_add_v(buffer, vertex) {
|
|
gml_pragma("forceinline");
|
|
vertex_position_3d(buffer, vertex.x, vertex.y, vertex.z);
|
|
}
|
|
|
|
function vertex_add_vc(buffer, vertex) {
|
|
gml_pragma("forceinline");
|
|
vertex_position_3d(buffer, vertex.x, vertex.y, vertex.z);
|
|
vertex_color(buffer, vertex.color, vertex.alpha);
|
|
}
|
|
|
|
function vertex_add_vnt(buffer, vertex) {
|
|
gml_pragma("forceinline");
|
|
vertex_position_3d(buffer, vertex.x, vertex.y, vertex.z);
|
|
vertex_normal(buffer, vertex.nx, vertex.ny, vertex.nz);
|
|
vertex_texcoord(buffer, vertex.u, vertex.v);
|
|
}
|
|
|
|
function vertex_add_vntc(buffer, vertex) {
|
|
gml_pragma("forceinline");
|
|
vertex_position_3d(buffer, vertex.x, vertex.y, vertex.z);
|
|
vertex_normal(buffer, vertex.nx, vertex.ny, vertex.nz);
|
|
vertex_texcoord(buffer, vertex.u, vertex.v);
|
|
vertex_color(buffer, vertex.color, vertex.alpha);
|
|
} |