Pixel-Composer/scripts/d3d_cube/d3d_cube.gml

66 lines
2.5 KiB
Text
Raw Normal View History

2023-08-14 19:22:04 +02:00
function __3dCube() : __3dObject() constructor {
VF = global.VF_POS_NORM_TEX_COL;
render_type = pr_trianglelist;
static initModel = function(size) {
size /= 2;
vertex = [[
V3(-size, -size, size).setNormal(0, 0, 1).setUV(0, 0),
V3( size, size, size).setNormal(0, 0, 1).setUV(1, 0),
V3( size, -size, size).setNormal(0, 0, 1).setUV(1, 1),
V3(-size, -size, size).setNormal(0, 0, 1).setUV(0, 0),
V3(-size, size, size).setNormal(0, 0, 1).setUV(1, 1),
V3( size, size, size).setNormal(0, 0, 1).setUV(0, 1),
V3(-size, -size, -size).setNormal(0, 0, -1).setUV(0, 0),
V3( size, -size, -size).setNormal(0, 0, -1).setUV(1, 0),
V3( size, size, -size).setNormal(0, 0, -1).setUV(1, 1),
V3(-size, -size, -size).setNormal(0, 0, -1).setUV(0, 0),
V3( size, size, -size).setNormal(0, 0, -1).setUV(1, 1),
V3(-size, size, -size).setNormal(0, 0, -1).setUV(0, 1),
V3(-size, -size, size).setNormal(-1, 0, 0).setUV(0, 0),
V3(-size, size, -size).setNormal(-1, 0, 0).setUV(1, 0),
V3(-size, size, size).setNormal(-1, 0, 0).setUV(1, 1),
V3(-size, -size, size).setNormal(-1, 0, 0).setUV(0, 0),
V3(-size, -size, -size).setNormal(-1, 0, 0).setUV(1, 1),
V3(-size, size, -size).setNormal(-1, 0, 0).setUV(0, 1),
V3( size, -size, size).setNormal(1, 0, 0).setUV(0, 0),
V3( size, size, size).setNormal(1, 0, 0).setUV(1, 0),
V3( size, size, -size).setNormal(1, 0, 0).setUV(1, 1),
V3( size, -size, size).setNormal(1, 0, 0).setUV(0, 0),
V3( size, size, -size).setNormal(1, 0, 0).setUV(1, 1),
V3( size, -size, -size).setNormal(1, 0, 0).setUV(0, 1),
V3(-size, size, size).setNormal(0, 1, 0).setUV(0, 0),
V3( size, size, -size).setNormal(0, 1, 0).setUV(1, 0),
V3( size, size, size).setNormal(0, 1, 0).setUV(1, 1),
V3(-size, size, size).setNormal(0, 1, 0).setUV(0, 0),
V3(-size, size, -size).setNormal(0, 1, 0).setUV(1, 1),
V3( size, size, -size).setNormal(0, 1, 0).setUV(0, 1),
2023-08-14 19:22:04 +02:00
V3(-size, -size, size).setNormal(0, -1, 0).setUV(0, 0),
V3( size, -size, size).setNormal(0, -1, 0).setUV(1, 0),
V3( size, -size, -size).setNormal(0, -1, 0).setUV(1, 1),
V3(-size, -size, size).setNormal(0, -1, 0).setUV(0, 0),
V3( size, -size, -size).setNormal(0, -1, 0).setUV(1, 1),
V3(-size, -size, -size).setNormal(0, -1, 0).setUV(0, 1),
]];
2023-08-14 19:22:04 +02:00
VB = build();
generateNormal();
2023-08-14 19:22:04 +02:00
} initModel(1);
}