mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2024-12-24 22:16:17 +01:00
3d Icosphere, cone, plane, convert to vertex struct array
This commit is contained in:
parent
1bf3fc70c2
commit
8a3345248e
36 changed files with 514 additions and 223 deletions
|
@ -212,6 +212,7 @@
|
|||
{"name":"s_node_normal","order":30,"path":"sprites/s_node_normal/s_node_normal.yy",},
|
||||
{"name":"node_pixel_sort","order":12,"path":"scripts/node_pixel_sort/node_pixel_sort.yy",},
|
||||
{"name":"sh_dither","order":28,"path":"shaders/sh_dither/sh_dither.yy",},
|
||||
{"name":"d3d_vec2","order":11,"path":"scripts/d3d_vec2/d3d_vec2.yy",},
|
||||
{"name":"node_region_fill","order":20,"path":"scripts/node_region_fill/node_region_fill.yy",},
|
||||
{"name":"sh_d3d_normal","order":18,"path":"shaders/sh_d3d_normal/sh_d3d_normal.yy",},
|
||||
{"name":"s_node_text_file_read","order":13,"path":"sprites/s_node_text_file_read/s_node_text_file_read.yy",},
|
||||
|
@ -443,6 +444,7 @@
|
|||
{"name":"node_3d_export","order":2,"path":"scripts/node_3d_export/node_3d_export.yy",},
|
||||
{"name":"s_node_vfx_override","order":11,"path":"sprites/s_node_vfx_override/s_node_vfx_override.yy",},
|
||||
{"name":"rotatorRange","order":12,"path":"scripts/rotatorRange/rotatorRange.yy",},
|
||||
{"name":"node_3d_mesh_cone","order":6,"path":"scripts/node_3d_mesh_cone/node_3d_mesh_cone.yy",},
|
||||
{"name":"font_loader","order":8,"path":"scripts/font_loader/font_loader.yy",},
|
||||
{"name":"node_iterator_filter_input","order":1,"path":"scripts/node_iterator_filter_input/node_iterator_filter_input.yy",},
|
||||
{"name":"point_rotate","order":1,"path":"scripts/point_rotate/point_rotate.yy",},
|
||||
|
@ -884,6 +886,7 @@
|
|||
{"name":"node_timeline_preview","order":2,"path":"scripts/node_timeline_preview/node_timeline_preview.yy",},
|
||||
{"name":"__polygon","order":2,"path":"scripts/__polygon/__polygon.yy",},
|
||||
{"name":"o_dialog_fontscrollbox","order":4,"path":"objects/o_dialog_fontscrollbox/o_dialog_fontscrollbox.yy",},
|
||||
{"name":"d3d_vertex","order":10,"path":"scripts/d3d_vertex/d3d_vertex.yy",},
|
||||
{"name":"s_node_vfx_output","order":11,"path":"sprites/s_node_vfx_output/s_node_vfx_output.yy",},
|
||||
{"name":"sh_greyscale","order":13,"path":"shaders/sh_greyscale/sh_greyscale.yy",},
|
||||
{"name":"gameframe_native","order":2,"path":"extensions/gameframe_native/gameframe_native.yy",},
|
||||
|
@ -1258,6 +1261,7 @@
|
|||
{"name":"scrollPane","order":14,"path":"scripts/scrollPane/scrollPane.yy",},
|
||||
{"name":"node_gradient_extract","order":13,"path":"scripts/node_gradient_extract/node_gradient_extract.yy",},
|
||||
{"name":"node_base_convert","order":7,"path":"scripts/node_base_convert/node_base_convert.yy",},
|
||||
{"name":"node_3d_mesh_plane","order":7,"path":"scripts/node_3d_mesh_plane/node_3d_mesh_plane.yy",},
|
||||
{"name":"s_node_normal_light","order":31,"path":"sprites/s_node_normal_light/s_node_normal_light.yy",},
|
||||
{"name":"node_transform_single","order":1,"path":"scripts/node_transform_single/node_transform_single.yy",},
|
||||
{"name":"node_string_length","order":7,"path":"scripts/node_string_length/node_string_length.yy",},
|
||||
|
@ -1378,6 +1382,7 @@
|
|||
{"name":"sh_blend_difference","order":51,"path":"shaders/sh_blend_difference/sh_blend_difference.yy",},
|
||||
{"name":"s_node_image_animation","order":2,"path":"sprites/s_node_image_animation/s_node_image_animation.yy",},
|
||||
{"name":"node_string_merge","order":6,"path":"scripts/node_string_merge/node_string_merge.yy",},
|
||||
{"name":"d3d_plane_mesh","order":6,"path":"scripts/d3d_plane_mesh/d3d_plane_mesh.yy",},
|
||||
{"name":"s_node_palette_replace","order":1,"path":"sprites/s_node_palette_replace/s_node_palette_replace.yy",},
|
||||
{"name":"node_action_object","order":1,"path":"scripts/node_action_object/node_action_object.yy",},
|
||||
{"name":"s_node_pb_box_divide","order":24,"path":"sprites/s_node_pb_box_divide/s_node_pb_box_divide.yy",},
|
||||
|
@ -1448,6 +1453,7 @@
|
|||
{"name":"sprite_loader","order":11,"path":"scripts/sprite_loader/sprite_loader.yy",},
|
||||
{"name":"fd_rectangle_get_material_surface","order":12,"path":"scripts/fd_rectangle_get_material_surface/fd_rectangle_get_material_surface.yy",},
|
||||
{"name":"fd_rectangle_clear","order":6,"path":"scripts/fd_rectangle_clear/fd_rectangle_clear.yy",},
|
||||
{"name":"d3d_cone","order":5,"path":"scripts/d3d_cone/d3d_cone.yy",},
|
||||
{"name":"__rectangle","order":7,"path":"scripts/__rectangle/__rectangle.yy",},
|
||||
{"name":"s_node_iterator_index","order":8,"path":"sprites/s_node_iterator_index/s_node_iterator_index.yy",},
|
||||
{"name":"preferences","order":5,"path":"scripts/preferences/preferences.yy",},
|
||||
|
|
|
@ -728,6 +728,7 @@
|
|||
{"id":{"name":"s_node_normal","path":"sprites/s_node_normal/s_node_normal.yy",},},
|
||||
{"id":{"name":"node_pixel_sort","path":"scripts/node_pixel_sort/node_pixel_sort.yy",},},
|
||||
{"id":{"name":"sh_dither","path":"shaders/sh_dither/sh_dither.yy",},},
|
||||
{"id":{"name":"d3d_vec2","path":"scripts/d3d_vec2/d3d_vec2.yy",},},
|
||||
{"id":{"name":"control_function","path":"scripts/control_function/control_function.yy",},},
|
||||
{"id":{"name":"node_region_fill","path":"scripts/node_region_fill/node_region_fill.yy",},},
|
||||
{"id":{"name":"sh_d3d_normal","path":"shaders/sh_d3d_normal/sh_d3d_normal.yy",},},
|
||||
|
@ -995,6 +996,7 @@
|
|||
{"id":{"name":"node_bevel","path":"scripts/node_bevel/node_bevel.yy",},},
|
||||
{"id":{"name":"s_node_vfx_override","path":"sprites/s_node_vfx_override/s_node_vfx_override.yy",},},
|
||||
{"id":{"name":"rotatorRange","path":"scripts/rotatorRange/rotatorRange.yy",},},
|
||||
{"id":{"name":"node_3d_mesh_cone","path":"scripts/node_3d_mesh_cone/node_3d_mesh_cone.yy",},},
|
||||
{"id":{"name":"font_loader","path":"scripts/font_loader/font_loader.yy",},},
|
||||
{"id":{"name":"node_iterator_filter_input","path":"scripts/node_iterator_filter_input/node_iterator_filter_input.yy",},},
|
||||
{"id":{"name":"point_rotate","path":"scripts/point_rotate/point_rotate.yy",},},
|
||||
|
@ -1498,6 +1500,7 @@
|
|||
{"id":{"name":"__polygon","path":"scripts/__polygon/__polygon.yy",},},
|
||||
{"id":{"name":"sh_morph_surface","path":"shaders/sh_morph_surface/sh_morph_surface.yy",},},
|
||||
{"id":{"name":"o_dialog_fontscrollbox","path":"objects/o_dialog_fontscrollbox/o_dialog_fontscrollbox.yy",},},
|
||||
{"id":{"name":"d3d_vertex","path":"scripts/d3d_vertex/d3d_vertex.yy",},},
|
||||
{"id":{"name":"s_node_vfx_output","path":"sprites/s_node_vfx_output/s_node_vfx_output.yy",},},
|
||||
{"id":{"name":"sh_greyscale","path":"shaders/sh_greyscale/sh_greyscale.yy",},},
|
||||
{"id":{"name":"gameframe_native","path":"extensions/gameframe_native/gameframe_native.yy",},},
|
||||
|
@ -1926,6 +1929,7 @@
|
|||
{"id":{"name":"scrollPane","path":"scripts/scrollPane/scrollPane.yy",},},
|
||||
{"id":{"name":"node_gradient_extract","path":"scripts/node_gradient_extract/node_gradient_extract.yy",},},
|
||||
{"id":{"name":"node_base_convert","path":"scripts/node_base_convert/node_base_convert.yy",},},
|
||||
{"id":{"name":"node_3d_mesh_plane","path":"scripts/node_3d_mesh_plane/node_3d_mesh_plane.yy",},},
|
||||
{"id":{"name":"s_node_normal_light","path":"sprites/s_node_normal_light/s_node_normal_light.yy",},},
|
||||
{"id":{"name":"node_transform_single","path":"scripts/node_transform_single/node_transform_single.yy",},},
|
||||
{"id":{"name":"node_string_length","path":"scripts/node_string_length/node_string_length.yy",},},
|
||||
|
@ -2063,6 +2067,7 @@
|
|||
{"id":{"name":"sh_blend_difference","path":"shaders/sh_blend_difference/sh_blend_difference.yy",},},
|
||||
{"id":{"name":"s_node_image_animation","path":"sprites/s_node_image_animation/s_node_image_animation.yy",},},
|
||||
{"id":{"name":"node_string_merge","path":"scripts/node_string_merge/node_string_merge.yy",},},
|
||||
{"id":{"name":"d3d_plane_mesh","path":"scripts/d3d_plane_mesh/d3d_plane_mesh.yy",},},
|
||||
{"id":{"name":"s_node_palette_replace","path":"sprites/s_node_palette_replace/s_node_palette_replace.yy",},},
|
||||
{"id":{"name":"node_action_object","path":"scripts/node_action_object/node_action_object.yy",},},
|
||||
{"id":{"name":"s_node_pb_box_divide","path":"sprites/s_node_pb_box_divide/s_node_pb_box_divide.yy",},},
|
||||
|
@ -2145,6 +2150,7 @@
|
|||
{"id":{"name":"fd_rectangle_get_material_surface","path":"scripts/fd_rectangle_get_material_surface/fd_rectangle_get_material_surface.yy",},},
|
||||
{"id":{"name":"fd_rectangle_clear","path":"scripts/fd_rectangle_clear/fd_rectangle_clear.yy",},},
|
||||
{"id":{"name":"instance_create","path":"scripts/instance_create/instance_create.yy",},},
|
||||
{"id":{"name":"d3d_cone","path":"scripts/d3d_cone/d3d_cone.yy",},},
|
||||
{"id":{"name":"__rectangle","path":"scripts/__rectangle/__rectangle.yy",},},
|
||||
{"id":{"name":"s_node_iterator_index","path":"sprites/s_node_iterator_index/s_node_iterator_index.yy",},},
|
||||
{"id":{"name":"node_de_corner","path":"scripts/node_de_corner/node_de_corner.yy",},},
|
||||
|
|
|
@ -34,6 +34,7 @@ function Node_3D_Light(_x, _y, _group = noone) : Node_3D_Object(_x, _y, _group)
|
|||
var bbox = drawGetBbox(xx, yy, _s);
|
||||
draw_set_color(_colr);
|
||||
|
||||
draw_set_circle_precision(32);
|
||||
draw_circle(bbox.xc, bbox.yc, 8 * _s, false);
|
||||
draw_circle(bbox.xc, bbox.yc, 12 * _s, true);
|
||||
}
|
||||
|
|
|
@ -30,4 +30,32 @@ function vertex_add_pntc(buffer, position, normal, texture, color = c_white, alp
|
|||
function vertex_add_2pc(buffer, _x, _y, color, alpha = 1) {
|
||||
vertex_position(buffer, _x, _y);
|
||||
vertex_color(buffer, color, alpha);
|
||||
}
|
||||
|
||||
function vertex_add_v(buffer, vertex) {
|
||||
vertex_position_3d(buffer, vertex.x, vertex.y, vertex.z);
|
||||
}
|
||||
|
||||
function vertex_add_vc(buffer, vertex) {
|
||||
vertex_position_3d(buffer, vertex.x, vertex.y, vertex.z);
|
||||
vertex_color(buffer, vertex.color, vertex.alpha);
|
||||
}
|
||||
|
||||
function vertex_add_vnt(buffer, vertex) {
|
||||
var _normal = vertex.normal;
|
||||
var _uv = vertex.uv;
|
||||
|
||||
vertex_position_3d(buffer, vertex.x, vertex.y, vertex.z);
|
||||
vertex_normal(buffer, _normal.x, _normal.y, _normal.z);
|
||||
vertex_texcoord(buffer, _uv.x, _uv.y);
|
||||
}
|
||||
|
||||
function vertex_add_vntc(buffer, vertex) {
|
||||
var _normal = vertex.normal;
|
||||
var _uv = vertex.uv;
|
||||
|
||||
vertex_position_3d(buffer, vertex.x, vertex.y, vertex.z);
|
||||
vertex_normal(buffer, _normal.x, _normal.y, _normal.z);
|
||||
vertex_texcoord(buffer, _uv.x, _uv.y);
|
||||
vertex_color(buffer, vertex.color, vertex.alpha);
|
||||
}
|
|
@ -6,24 +6,24 @@ function __3dCamera_object() : __3dObject() constructor {
|
|||
len = 0.5; //cameraLength
|
||||
|
||||
vertex = [
|
||||
[ -len, -ivw, ivh ], [ -len, ivw, ivh ],
|
||||
[ -len, ivw, ivh ], [ -len, ivw, -ivh ],
|
||||
[ -len, ivw, -ivh ], [ -len, -ivw, -ivh ],
|
||||
[ -len, -ivw, -ivh ], [ -len, -ivw, ivh ],
|
||||
V3( -len, -ivw, ivh ), V3( -len, ivw, ivh ),
|
||||
V3( -len, ivw, ivh ), V3( -len, ivw, -ivh ),
|
||||
V3( -len, ivw, -ivh ), V3( -len, -ivw, -ivh ),
|
||||
V3( -len, -ivw, -ivh ), V3( -len, -ivw, ivh ),
|
||||
|
||||
[ len, -ovw, ovh ], [ len, ovw, ovh ],
|
||||
[ len, ovw, ovh ], [ len, ovw, -ovh ],
|
||||
[ len, ovw, -ovh ], [ len, -ovw, -ovh ],
|
||||
[ len, -ovw, -ovh ], [ len, -ovw, ovh ],
|
||||
V3( len, -ovw, ovh ), V3( len, ovw, ovh ),
|
||||
V3( len, ovw, ovh ), V3( len, ovw, -ovh ),
|
||||
V3( len, ovw, -ovh ), V3( len, -ovw, -ovh ),
|
||||
V3( len, -ovw, -ovh ), V3( len, -ovw, ovh ),
|
||||
|
||||
[ -len, -ivw, ivh ], [ len, -ovw, ovh ],
|
||||
[ -len, ivw, ivh ], [ len, ovw, ovh ],
|
||||
[ -len, ivw, -ivh ], [ len, ovw, -ovh ],
|
||||
[ -len, -ivw, -ivh ], [ len, -ovw, -ovh ],
|
||||
V3( -len, -ivw, ivh ), V3( len, -ovw, ovh ),
|
||||
V3( -len, ivw, ivh ), V3( len, ovw, ovh ),
|
||||
V3( -len, ivw, -ivh ), V3( len, ovw, -ovh ),
|
||||
V3( -len, -ivw, -ivh ), V3( len, -ovw, -ovh ),
|
||||
|
||||
[ len, -ovw * 0.5, ovh + 0.2 ], [ len, ovw * 0.5, ovh + 0.2 ],
|
||||
[ len, 0, ovh + 0.6 ], [ len, ovw * 0.5, ovh + 0.2 ],
|
||||
[ len, -ovw * 0.5, ovh + 0.2 ], [ len, 0, ovh + 0.6 ],
|
||||
V3( len, -ovw * 0.5, ovh + 0.2 ), V3( len, ovw * 0.5, ovh + 0.2 ),
|
||||
V3( len, 0, ovh + 0.6 ), V3( len, ovw * 0.5, ovh + 0.2 ),
|
||||
V3( len, -ovw * 0.5, ovh + 0.2 ), V3( len, 0, ovh + 0.6 ),
|
||||
];
|
||||
|
||||
VF = global.VF_POS_COL;
|
||||
|
|
69
scripts/d3d_cone/d3d_cone.gml
Normal file
69
scripts/d3d_cone/d3d_cone.gml
Normal file
|
@ -0,0 +1,69 @@
|
|||
function __3dCone(radius = 0.5, height = 1, sides = 8, smooth = false) : __3dObject() constructor {
|
||||
VF = global.VF_POS_NORM_TEX_COL;
|
||||
render_type = pr_trianglelist;
|
||||
object_counts = 2;
|
||||
|
||||
self.radius = radius;
|
||||
self.height = height;
|
||||
self.sides = sides;
|
||||
self.smooth = smooth;
|
||||
|
||||
static initModel = function() {
|
||||
var v0 = array_create(3 * sides);
|
||||
var vs = array_create(3 * sides);
|
||||
|
||||
var _h = height / 2;
|
||||
|
||||
for( var i = 0; i < sides; i++ ) {
|
||||
var a0 = (i + 0) / sides * 360;
|
||||
var a1 = (i + 1) / sides * 360;
|
||||
|
||||
var x0 = lengthdir_x(radius, a0);
|
||||
var y0 = lengthdir_y(radius, a0);
|
||||
var x1 = lengthdir_x(radius, a1);
|
||||
var y1 = lengthdir_y(radius, a1);
|
||||
|
||||
var _u0 = 0.5 + lengthdir_x(0.5, a0);
|
||||
var _v0 = 0.5 + lengthdir_y(0.5, a0);
|
||||
var _u1 = 0.5 + lengthdir_x(0.5, a1);
|
||||
var _v1 = 0.5 + lengthdir_y(0.5, a1);
|
||||
|
||||
v0[i * 3 + 0] = V3( 0, 0, -_h).setNormal(0, 0, -1).setUV(0.5, 0.5);
|
||||
v0[i * 3 + 1] = V3(x0, y0, -_h).setNormal(0, 0, -1).setUV(_u0, _v0);
|
||||
v0[i * 3 + 2] = V3(x1, y1, -_h).setNormal(0, 0, -1).setUV(_u1, _v1);
|
||||
}
|
||||
|
||||
for( var i = 0; i < sides; i++ ) {
|
||||
var a0 = (i + 0) / sides * 360;
|
||||
var a1 = (i + 1) / sides * 360;
|
||||
|
||||
var x0 = lengthdir_x(radius, a0);
|
||||
var y0 = lengthdir_y(radius, a0);
|
||||
var x1 = lengthdir_x(radius, a1);
|
||||
var y1 = lengthdir_y(radius, a1);
|
||||
|
||||
var nx0 = smooth? lengthdir_x(1, a0) : lengthdir_x(1, (a0 + a1) / 2);
|
||||
var ny0 = smooth? lengthdir_y(1, a0) : lengthdir_y(1, (a0 + a1) / 2);
|
||||
var nx1 = smooth? lengthdir_x(1, a1) : lengthdir_x(1, (a0 + a1) / 2);
|
||||
var ny1 = smooth? lengthdir_y(1, a1) : lengthdir_y(1, (a0 + a1) / 2);
|
||||
var nxc = lengthdir_x(1, (a0 + a1) / 2);
|
||||
var nyc = lengthdir_y(1, (a0 + a1) / 2);
|
||||
var r2 = radius * radius;
|
||||
var h2 = height * height;
|
||||
var nz = r2 / (r2 + h2);
|
||||
|
||||
var ux0 = (i + 0) / sides;
|
||||
var ux1 = (i + 1) / sides;
|
||||
|
||||
vs[i * 3 + 0] = V3( 0, 0, _h).setNormal(nxc, nyc, nz).setUV(ux0, 0);
|
||||
vs[i * 3 + 1] = V3(x0, y0, -_h).setNormal(nx0, ny0, nz).setUV(ux0, 1);
|
||||
vs[i * 3 + 2] = V3(x1, y1, -_h).setNormal(nx1, ny1, nz).setUV(ux1, 0);
|
||||
}
|
||||
|
||||
vertex = [ v0, vs ];
|
||||
|
||||
VB = build();
|
||||
} initModel();
|
||||
|
||||
static onParameterUpdate = initModel;
|
||||
}
|
11
scripts/d3d_cone/d3d_cone.yy
Normal file
11
scripts/d3d_cone/d3d_cone.yy
Normal file
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"resourceType": "GMScript",
|
||||
"resourceVersion": "1.0",
|
||||
"name": "d3d_cone",
|
||||
"isCompatibility": false,
|
||||
"isDnD": false,
|
||||
"parent": {
|
||||
"name": "mesh",
|
||||
"path": "folders/functions/3d/mesh.yy",
|
||||
},
|
||||
}
|
|
@ -6,23 +6,23 @@ function __3dCube() : __3dObject() constructor {
|
|||
size /= 2;
|
||||
|
||||
vertex = [
|
||||
[-size, -size, size], [size, -size, size], [size, size, size],
|
||||
[-size, -size, size], [size, size, size], [-size, size, size],
|
||||
V3(-size, -size, size), V3(size, -size, size), V3(size, size, size),
|
||||
V3(-size, -size, size), V3(size, size, size), V3(-size, size, size),
|
||||
|
||||
V3(-size, -size, -size), V3(size, -size, -size), V3(size, size, -size),
|
||||
V3(-size, -size, -size), V3(size, size, -size), V3(-size, size, -size),
|
||||
|
||||
[-size, -size, -size], [size, -size, -size], [size, size, -size],
|
||||
[-size, -size, -size], [size, size, -size], [-size, size, -size],
|
||||
V3(-size, -size, size), V3(-size, size, size), V3(-size, size, -size),
|
||||
V3(-size, -size, size), V3(-size, size, -size), V3(-size, -size, -size),
|
||||
|
||||
[-size, -size, size], [-size, size, size], [-size, size, -size],
|
||||
[-size, -size, size], [-size, size, -size], [-size, -size, -size],
|
||||
V3(size, -size, size), V3(size, size, size), V3(size, size, -size),
|
||||
V3(size, -size, size), V3(size, size, -size), V3(size, -size, -size),
|
||||
|
||||
[size, -size, size], [size, size, size], [size, size, -size],
|
||||
[size, -size, size], [size, size, -size], [size, -size, -size],
|
||||
V3(-size, size, size), V3(size, size, size), V3(size, size, -size),
|
||||
V3(-size, size, size), V3(size, size, -size), V3(-size, size, -size),
|
||||
|
||||
[-size, size, size], [size, size, size], [size, size, -size],
|
||||
[-size, size, size], [size, size, -size], [-size, size, -size],
|
||||
|
||||
[-size, -size, size], [size, -size, size], [size, -size, -size],
|
||||
[-size, -size, size], [size, -size, -size], [-size, -size, -size]
|
||||
V3(-size, -size, size), V3(size, -size, size), V3(size, -size, -size),
|
||||
V3(-size, -size, size), V3(size, -size, -size), V3(-size, -size, -size)
|
||||
];
|
||||
|
||||
normals = [
|
||||
|
@ -64,6 +64,8 @@ function __3dCube() : __3dObject() constructor {
|
|||
[0, 0], [1, 0], [1, 1],
|
||||
[0, 0], [1, 1], [0, 1]
|
||||
];
|
||||
|
||||
array_foreach(vertex, function(val, ind) { val.setNormal(normals[ind]); val.setUV(uv[ind]); })
|
||||
|
||||
VB = build();
|
||||
} initModel(1);
|
||||
|
|
|
@ -1,34 +1,35 @@
|
|||
function __3dCubeFaces() : __3dObject() constructor {
|
||||
VF = global.VF_POS_NORM_TEX_COL;
|
||||
render_type = pr_trianglelist;
|
||||
object_counts = 6;
|
||||
|
||||
static initModel = function(size) {
|
||||
size /= 2;
|
||||
|
||||
vertex = [
|
||||
[
|
||||
[-size, -size, size], [size, -size, size], [size, size, size],
|
||||
[-size, -size, size], [size, size, size], [-size, size, size],
|
||||
V3(-size, -size, size), V3(size, -size, size), V3(size, size, size),
|
||||
V3(-size, -size, size), V3(size, size, size), V3(-size, size, size),
|
||||
],
|
||||
[
|
||||
[-size, -size, -size], [size, -size, -size], [size, size, -size],
|
||||
[-size, -size, -size], [size, size, -size], [-size, size, -size],
|
||||
V3(-size, -size, -size), V3(size, -size, -size), V3(size, size, -size),
|
||||
V3(-size, -size, -size), V3(size, size, -size), V3(-size, size, -size),
|
||||
],
|
||||
[
|
||||
[-size, -size, size], [-size, size, size], [-size, size, -size],
|
||||
[-size, -size, size], [-size, size, -size], [-size, -size, -size],
|
||||
V3(-size, -size, size), V3(-size, size, size), V3(-size, size, -size),
|
||||
V3(-size, -size, size), V3(-size, size, -size), V3(-size, -size, -size),
|
||||
],
|
||||
[
|
||||
[size, -size, size], [size, size, size], [size, size, -size],
|
||||
[size, -size, size], [size, size, -size], [size, -size, -size],
|
||||
V3(size, -size, size), V3(size, size, size), V3(size, size, -size),
|
||||
V3(size, -size, size), V3(size, size, -size), V3(size, -size, -size),
|
||||
],
|
||||
[
|
||||
[-size, size, size], [size, size, size], [size, size, -size],
|
||||
[-size, size, size], [size, size, -size], [-size, size, -size],
|
||||
V3(-size, size, size), V3(size, size, size), V3(size, size, -size),
|
||||
V3(-size, size, size), V3(size, size, -size), V3(-size, size, -size),
|
||||
],
|
||||
[
|
||||
[-size, -size, size], [size, -size, size], [size, -size, -size],
|
||||
[-size, -size, size], [size, -size, -size], [-size, -size, -size]
|
||||
V3(-size, -size, size), V3(size, -size, size), V3(size, -size, -size),
|
||||
V3(-size, -size, size), V3(size, -size, -size), V3(-size, -size, -size)
|
||||
]
|
||||
];
|
||||
|
||||
|
@ -85,6 +86,13 @@ function __3dCubeFaces() : __3dObject() constructor {
|
|||
[0, 0], [1, 1], [0, 1]
|
||||
]
|
||||
];
|
||||
|
||||
array_foreach(vertex[0], function(val, ind) { val.normal.set(normals[0][ind]); val.uv.set(uv[0][ind]); })
|
||||
array_foreach(vertex[1], function(val, ind) { val.normal.set(normals[1][ind]); val.uv.set(uv[1][ind]); })
|
||||
array_foreach(vertex[2], function(val, ind) { val.normal.set(normals[2][ind]); val.uv.set(uv[2][ind]); })
|
||||
array_foreach(vertex[3], function(val, ind) { val.normal.set(normals[3][ind]); val.uv.set(uv[3][ind]); })
|
||||
array_foreach(vertex[4], function(val, ind) { val.normal.set(normals[4][ind]); val.uv.set(uv[4][ind]); })
|
||||
array_foreach(vertex[5], function(val, ind) { val.normal.set(normals[5][ind]); val.uv.set(uv[5][ind]); })
|
||||
|
||||
VB = build();
|
||||
} initModel(1);
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
function __3dCylinder(radius = 0.5, height = 1, sides = 8, smooth = false) : __3dObject() constructor {
|
||||
VF = global.VF_POS_NORM_TEX_COL;
|
||||
render_type = pr_trianglelist;
|
||||
object_counts = 3;
|
||||
|
||||
self.radius = radius;
|
||||
self.height = height;
|
||||
|
@ -10,11 +11,7 @@ function __3dCylinder(radius = 0.5, height = 1, sides = 8, smooth = false) : __3
|
|||
static initModel = function() {
|
||||
var v0 = array_create(3 * sides);
|
||||
var v1 = array_create(3 * sides);
|
||||
var n0 = array_create(3 * sides);
|
||||
var n1 = array_create(3 * sides);
|
||||
var u0 = array_create(3 * sides);
|
||||
var u1 = array_create(3 * sides);
|
||||
|
||||
var vs = array_create(3 * sides * 2);
|
||||
var _h = height / 2;
|
||||
|
||||
for( var i = 0; i < sides; i++ ) {
|
||||
|
@ -26,40 +23,20 @@ function __3dCylinder(radius = 0.5, height = 1, sides = 8, smooth = false) : __3
|
|||
var x1 = lengthdir_x(radius, a1);
|
||||
var y1 = lengthdir_y(radius, a1);
|
||||
|
||||
v0[i * 3 + 0] = [ 0, 0, _h];
|
||||
v0[i * 3 + 1] = [x0, y0, _h];
|
||||
v0[i * 3 + 2] = [x1, y1, _h];
|
||||
|
||||
v1[i * 3 + 0] = [ 0, 0, -_h];
|
||||
v1[i * 3 + 1] = [x0, y0, -_h];
|
||||
v1[i * 3 + 2] = [x1, y1, -_h];
|
||||
|
||||
n0[i * 3 + 0] = [ 0, 0, 1];
|
||||
n0[i * 3 + 1] = [ 0, 0, 1];
|
||||
n0[i * 3 + 2] = [ 0, 0, 1];
|
||||
|
||||
n1[i * 3 + 0] = [ 0, 0, -1];
|
||||
n1[i * 3 + 1] = [ 0, 0, -1];
|
||||
n1[i * 3 + 2] = [ 0, 0, -1];
|
||||
|
||||
var _u0 = 0.5 + lengthdir_x(0.5, a0);
|
||||
var _v0 = 0.5 + lengthdir_y(0.5, a0);
|
||||
var _u1 = 0.5 + lengthdir_x(0.5, a1);
|
||||
var _v1 = 0.5 + lengthdir_y(0.5, a1);
|
||||
|
||||
u0[i * 3 + 0] = [ 0.5, 0.5];
|
||||
u0[i * 3 + 1] = [ _u0, _v0];
|
||||
u0[i * 3 + 2] = [ _u1, _v1];
|
||||
v0[i * 3 + 0] = V3( 0, 0, _h).setNormal(0, 0, 1).setUV(0.5, 0.5);
|
||||
v0[i * 3 + 1] = V3(x0, y0, _h).setNormal(0, 0, 1).setUV(_u0, _v0);
|
||||
v0[i * 3 + 2] = V3(x1, y1, _h).setNormal(0, 0, 1).setUV(_u1, _v1);
|
||||
|
||||
u1[i * 3 + 0] = [ 0.5, 0.5];
|
||||
u1[i * 3 + 1] = [ _u0, _v0];
|
||||
u1[i * 3 + 2] = [ _u1, _v1];
|
||||
v1[i * 3 + 0] = V3( 0, 0, -_h).setNormal(0, 0, -1).setUV(0.5, 0.5);
|
||||
v1[i * 3 + 1] = V3(x0, y0, -_h).setNormal(0, 0, -1).setUV(_u0, _v0);
|
||||
v1[i * 3 + 2] = V3(x1, y1, -_h).setNormal(0, 0, -1).setUV(_u1, _v1);
|
||||
}
|
||||
|
||||
var vs = array_create(3 * sides * 2);
|
||||
var ns = array_create(3 * sides * 2);
|
||||
var us = array_create(3 * sides * 2);
|
||||
|
||||
for( var i = 0; i < sides; i++ ) {
|
||||
var a0 = (i + 0) / sides * 360;
|
||||
var a1 = (i + 1) / sides * 360;
|
||||
|
@ -69,42 +46,24 @@ function __3dCylinder(radius = 0.5, height = 1, sides = 8, smooth = false) : __3
|
|||
var x1 = lengthdir_x(radius, a1);
|
||||
var y1 = lengthdir_y(radius, a1);
|
||||
|
||||
vs[i * 3 * 2 + 0] = [x0, y0, _h];
|
||||
vs[i * 3 * 2 + 1] = [x1, y1, _h];
|
||||
vs[i * 3 * 2 + 2] = [x0, y0, -_h];
|
||||
|
||||
vs[i * 3 * 2 + 3] = [x0, y0, -_h];
|
||||
vs[i * 3 * 2 + 4] = [x1, y1, _h];
|
||||
vs[i * 3 * 2 + 5] = [x1, y1, -_h];
|
||||
|
||||
var nx0 = smooth? lengthdir_x(1, a0) : lengthdir_x(1, (a0 + a1) / 2);
|
||||
var ny0 = smooth? lengthdir_y(1, a0) : lengthdir_y(1, (a0 + a1) / 2);
|
||||
var nx1 = smooth? lengthdir_x(1, a1) : lengthdir_x(1, (a0 + a1) / 2);
|
||||
var ny1 = smooth? lengthdir_y(1, a1) : lengthdir_y(1, (a0 + a1) / 2);
|
||||
|
||||
ns[i * 3 * 2 + 0] = [nx0, ny0, 0];
|
||||
ns[i * 3 * 2 + 1] = [nx1, ny1, 0];
|
||||
ns[i * 3 * 2 + 2] = [nx0, ny0, 0];
|
||||
|
||||
ns[i * 3 * 2 + 3] = [nx0, ny0, 0];
|
||||
ns[i * 3 * 2 + 4] = [nx1, ny1, 0];
|
||||
ns[i * 3 * 2 + 5] = [nx1, ny1, 0];
|
||||
|
||||
var ux0 = (i + 0) / sides;
|
||||
var ux1 = (i + 1) / sides;
|
||||
|
||||
us[i * 3 * 2 + 0] = [ux0, 0];
|
||||
us[i * 3 * 2 + 1] = [ux1, 0];
|
||||
us[i * 3 * 2 + 2] = [ux0, 1];
|
||||
|
||||
us[i * 3 * 2 + 3] = [ux0, 1];
|
||||
us[i * 3 * 2 + 4] = [ux1, 0];
|
||||
us[i * 3 * 2 + 5] = [ux1, 1];
|
||||
vs[i * 3 * 2 + 0] = V3(x0, y0, _h).setNormal(nx0, ny0, 0).setUV(ux0, 0);
|
||||
vs[i * 3 * 2 + 1] = V3(x1, y1, _h).setNormal(nx1, ny1, 0).setUV(ux1, 0);
|
||||
vs[i * 3 * 2 + 2] = V3(x0, y0, -_h).setNormal(nx0, ny0, 0).setUV(ux0, 1);
|
||||
|
||||
vs[i * 3 * 2 + 3] = V3(x0, y0, -_h).setNormal(nx0, ny0, 0).setUV(ux0, 1);
|
||||
vs[i * 3 * 2 + 4] = V3(x1, y1, _h).setNormal(nx1, ny1, 0).setUV(ux1, 0);
|
||||
vs[i * 3 * 2 + 5] = V3(x1, y1, -_h).setNormal(nx1, ny1, 0).setUV(ux1, 1);
|
||||
}
|
||||
|
||||
vertex = [ v0, v1, vs ];
|
||||
normals = [ n0, n1, ns ];
|
||||
uv = [ u0, u1, us ];
|
||||
|
||||
VB = build();
|
||||
} initModel();
|
||||
|
|
|
@ -10,8 +10,8 @@ function __3dGizmoCircleZ(radius = 0.5, color = c_white, alpha = 1) : __3dGizmo(
|
|||
var x1 = lengthdir_x(radius, a1);
|
||||
var y1 = lengthdir_y(radius, a1);
|
||||
|
||||
vertex[_i++] = [ x0, y0, 0, color, alpha ];
|
||||
vertex[_i++] = [ x1, y1, 0, color, alpha ];
|
||||
vertex[_i++] = V3( x0, y0, 0, color, alpha );
|
||||
vertex[_i++] = V3( x1, y1, 0, color, alpha );
|
||||
}
|
||||
|
||||
VB = build();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
function __3dGizmoLine(from, to, color = c_white, alpha = 1) : __3dGizmo() constructor {
|
||||
vertex = [
|
||||
[ from.x, from.y, from.z, color, alpha ],
|
||||
[ to.x, to.y, to.z, color, alpha ],
|
||||
V3( from.x, from.y, from.z, color, alpha ),
|
||||
V3( to.x, to.y, to.z, color, alpha ),
|
||||
];
|
||||
VB = build();
|
||||
}
|
|
@ -5,10 +5,10 @@ function __3dGizmoLineDashed(from, to, dash = 0.1, color = c_white, alpha = 1) :
|
|||
vertex = array_create(_dash);
|
||||
for( var i = 0; i < _dash; i++ ) {
|
||||
var prog = i / (_dash - 1);
|
||||
vertex[i] = [ lerp(from.x, to.x, prog),
|
||||
lerp(from.y, to.y, prog),
|
||||
lerp(from.z, to.z, prog),
|
||||
color, alpha ]
|
||||
vertex[i] = V3( lerp(from.x, to.x, prog),
|
||||
lerp(from.y, to.y, prog),
|
||||
lerp(from.z, to.z, prog),
|
||||
color, alpha );
|
||||
}
|
||||
VB = build();
|
||||
}
|
|
@ -10,12 +10,12 @@ function __3dGizmoSphere(radius = 0.5, color = c_white, alpha = 1) : __3dGizmo()
|
|||
var x1 = lengthdir_x(radius, a1);
|
||||
var y1 = lengthdir_y(radius, a1);
|
||||
|
||||
vertex[_i++] = [ 0, x0, y0, color, alpha ];
|
||||
vertex[_i++] = [ 0, x1, y1, color, alpha ];
|
||||
vertex[_i++] = [ x0, 0, y0, color, alpha ];
|
||||
vertex[_i++] = [ x1, 0, y1, color, alpha ];
|
||||
vertex[_i++] = [ x0, y0, 0, color, alpha ];
|
||||
vertex[_i++] = [ x1, y1, 0, color, alpha ];
|
||||
vertex[_i++] = V3( 0, x0, y0, color, alpha );
|
||||
vertex[_i++] = V3( 0, x1, y1, color, alpha );
|
||||
vertex[_i++] = V3( x0, 0, y0, color, alpha );
|
||||
vertex[_i++] = V3( x1, 0, y1, color, alpha );
|
||||
vertex[_i++] = V3( x0, y0, 0, color, alpha );
|
||||
vertex[_i++] = V3( x1, y1, 0, color, alpha );
|
||||
}
|
||||
|
||||
VB = build();
|
||||
|
|
|
@ -42,7 +42,6 @@ function __3dICOSphere(radius = 0.5, level = 2, smt = false) : __3dObject() cons
|
|||
static initModel = function() { // swap H, V because fuck me
|
||||
var _vertices = ds_list_create();
|
||||
var _normals = ds_list_create();
|
||||
var _uvs = ds_list_create();
|
||||
|
||||
var phi = (1 + sqrt(5)) * 0.5; // golden ratio
|
||||
var a = 1.0;
|
||||
|
@ -127,26 +126,22 @@ function __3dICOSphere(radius = 0.5, level = 2, smt = false) : __3dObject() cons
|
|||
var _v0 = _vertices[| i * 3 + 0];
|
||||
var _v1 = _vertices[| i * 3 + 1];
|
||||
var _v2 = _vertices[| i * 3 + 2];
|
||||
var _n = _v1.subtract(_v0).cross(_v2.subtract(_v0));
|
||||
var _u = [ 0, 0 ];
|
||||
|
||||
ds_list_add(_normals, _n, _n, _n);
|
||||
ds_list_add(_uvs, _u, _u, _u);
|
||||
if(smooth) {
|
||||
ds_list_add(_normals, _v0.normalize(), _v1.normalize(), _v2.normalize());
|
||||
} else {
|
||||
var _n = _v1.subtract(_v0).cross(_v2.subtract(_v0));
|
||||
ds_list_add(_normals, _n, _n, _n);
|
||||
}
|
||||
} #endregion
|
||||
|
||||
vertex = array_create(ds_list_size(_vertices));
|
||||
normals = array_create(ds_list_size(_normals));
|
||||
uv = ds_list_to_array(_uvs);
|
||||
|
||||
for( var i = 0, n = ds_list_size(_vertices); i < n; i++ )
|
||||
vertex[i] = _vertices[| i].toArray();
|
||||
|
||||
for( var i = 0, n = ds_list_size(_normals); i < n; i++ )
|
||||
normals[i] = _normals[| i].toArray();
|
||||
for( var i = 0, n = ds_list_size(_vertices); i < n; i++ )
|
||||
vertex[i] = V3(_vertices[| i]).setNormal(_normals[| i]);
|
||||
|
||||
ds_list_destroy(_vertices);
|
||||
ds_list_destroy(_normals);
|
||||
ds_list_destroy(_uvs);
|
||||
|
||||
VB = build();
|
||||
} initModel();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
function __3dLight() : __3dObject() constructor {
|
||||
UI_vertex = [];
|
||||
for( var i = 0; i <= 32; i++ ) UI_vertex[i] = [ 0, lengthdir_x(0.5, i / 32 * 360), lengthdir_y(0.5, i / 32 * 360), c_yellow, 0.8 ];
|
||||
UI_vertex = array_create(33);
|
||||
for( var i = 0; i <= 32; i++ ) UI_vertex[i] = V3(0, lengthdir_x(0.5, i / 32 * 360), lengthdir_y(0.5, i / 32 * 360), c_yellow, 0.8);
|
||||
VB_UI = build(noone, UI_vertex);
|
||||
|
||||
color = c_white;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
function __3dLightDirectional() : __3dLight() constructor {
|
||||
vertex = [ [ 1, 0, 0, c_yellow, 0.8 ], [ 3, 0, 0, c_yellow, 0.8 ] ];
|
||||
vertex = [ V3(1, 0, 0, c_yellow, 0.8), V3(3, 0, 0, c_yellow, 0.8) ];
|
||||
VF = global.VF_POS_COL;
|
||||
render_type = pr_linelist;
|
||||
VB = build();
|
||||
|
|
|
@ -13,9 +13,8 @@
|
|||
#endregion
|
||||
|
||||
function __3dObject() constructor {
|
||||
vertex = [];
|
||||
normals = [];
|
||||
uv = [];
|
||||
vertex = [];
|
||||
object_counts = 1;
|
||||
VB = noone;
|
||||
VF = global.VF_POS_COL;
|
||||
render_type = pr_trianglelist;
|
||||
|
@ -51,21 +50,8 @@ function __3dObject() constructor {
|
|||
var v = _vertex[i];
|
||||
|
||||
switch(VF) {
|
||||
case global.VF_POS_COL :
|
||||
var cc = array_length(v) > 3? v[3] : c_gray;
|
||||
var aa = array_length(v) > 4? v[4] : 1;
|
||||
|
||||
vertex_position_3d(_buffer, v[0], v[1], v[2]);
|
||||
vertex_color(_buffer, cc, aa);
|
||||
break;
|
||||
case global.VF_POS_NORM_TEX_COL :
|
||||
var nor = _normal[i];
|
||||
var uuv = array_safe_get(_uv, i, [ 0, 0 ]);
|
||||
var cc = array_length(v) > 3? v[3] : c_white;
|
||||
var aa = array_length(v) > 4? v[4] : 1;
|
||||
|
||||
vertex_add_pntc(_buffer, v, nor, uuv, cc, aa);
|
||||
break;
|
||||
case global.VF_POS_COL : vertex_add_vc(_buffer, v); break;
|
||||
case global.VF_POS_NORM_TEX_COL : vertex_add_vntc(_buffer, v); break;
|
||||
}
|
||||
}
|
||||
vertex_end(_buffer);
|
||||
|
@ -73,20 +59,19 @@ function __3dObject() constructor {
|
|||
return _buffer;
|
||||
} #endregion
|
||||
|
||||
static build = function(_buffer = VB, _vertex = vertex, _normal = normals, _uv = uv) { #region
|
||||
static build = function(_buffer = VB, _vertex = vertex) { #region
|
||||
if(is_array(_buffer)) {
|
||||
for( var i = 0, n = array_length(_buffer); i < n; i++ )
|
||||
vertex_delete_buffer(_buffer[i])
|
||||
} else if(_buffer != noone) vertex_delete_buffer(_buffer);
|
||||
|
||||
if(array_empty(_vertex)) return noone;
|
||||
var _buffer_count = is_array(_vertex[0][0])? array_length(_vertex) : 0;
|
||||
|
||||
if(_buffer_count == 0) return buildVertex(_vertex, _normal, _uv);
|
||||
if(object_counts == 1) return buildVertex(_vertex);
|
||||
|
||||
var _res = array_create(_buffer_count);
|
||||
for( var i = 0; i < _buffer_count; i++ )
|
||||
_res[i] = buildVertex(_vertex[i], _normal[i], _uv[i]);
|
||||
var _res = array_create(object_counts);
|
||||
for( var i = 0; i < object_counts; i++ )
|
||||
_res[i] = buildVertex(_vertex[i]);
|
||||
|
||||
return _res;
|
||||
} #endregion
|
||||
|
|
27
scripts/d3d_plane_mesh/d3d_plane_mesh.gml
Normal file
27
scripts/d3d_plane_mesh/d3d_plane_mesh.gml
Normal file
|
@ -0,0 +1,27 @@
|
|||
function __3dPlane() : __3dObject() constructor {
|
||||
VF = global.VF_POS_NORM_TEX_COL;
|
||||
render_type = pr_trianglelist;
|
||||
|
||||
static initModel = function(size) {
|
||||
size /= 2;
|
||||
|
||||
vertex = [
|
||||
V3(-size, -size, 0), V3(size, -size, 0), V3(size, size, 0),
|
||||
V3(-size, -size, 0), V3(size, size, 0), V3(-size, size, 0),
|
||||
];
|
||||
|
||||
normals = [
|
||||
[0, 0, 1], [0, 0, 1], [0, 0, 1],
|
||||
[0, 0, 1], [0, 0, 1], [0, 0, 1],
|
||||
];
|
||||
|
||||
uv = [
|
||||
[0, 0], [1, 0], [1, 1],
|
||||
[0, 0], [1, 1], [0, 1],
|
||||
];
|
||||
|
||||
array_foreach(vertex, function(val, ind) { val.normal.set(normals[ind]); val.uv.set(uv[ind]); })
|
||||
|
||||
VB = build();
|
||||
} initModel(1);
|
||||
}
|
11
scripts/d3d_plane_mesh/d3d_plane_mesh.yy
Normal file
11
scripts/d3d_plane_mesh/d3d_plane_mesh.yy
Normal file
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"resourceType": "GMScript",
|
||||
"resourceVersion": "1.0",
|
||||
"name": "d3d_plane_mesh",
|
||||
"isCompatibility": false,
|
||||
"isDnD": false,
|
||||
"parent": {
|
||||
"name": "mesh",
|
||||
"path": "folders/functions/3d/mesh.yy",
|
||||
},
|
||||
}
|
|
@ -9,8 +9,6 @@ function __3dUVSphere(radius = 0.5, hori = 16, vert = 8, smt = false) : __3dObje
|
|||
|
||||
static initModel = function() { // swap H, V because fuck me
|
||||
vertex = array_create(vert * hori * 2 * 3);
|
||||
normals = array_create(vert * hori * 2 * 3);
|
||||
uv = array_create(vert * hori * 2 * 3);
|
||||
var amo = 0;
|
||||
|
||||
for (var i = 0; i < vert; i++)
|
||||
|
@ -55,42 +53,42 @@ function __3dUVSphere(radius = 0.5, hori = 16, vert = 8, smt = false) : __3dObje
|
|||
|
||||
var ind = (i * hori + j) * 6;
|
||||
|
||||
vertex[ind + 0] = [hx0, hy0, hz0];
|
||||
vertex[ind + 1] = [hx1, hy1, hz1];
|
||||
vertex[ind + 2] = [hx2, hy2, hz2];
|
||||
vertex[ind + 0] = V3(hx0, hy0, hz0);
|
||||
vertex[ind + 1] = V3(hx1, hy1, hz1);
|
||||
vertex[ind + 2] = V3(hx2, hy2, hz2);
|
||||
|
||||
vertex[ind + 3] = [hx1, hy1, hz1];
|
||||
vertex[ind + 4] = [hx2, hy2, hz2];
|
||||
vertex[ind + 5] = [hx3, hy3, hz3];
|
||||
vertex[ind + 3] = V3(hx1, hy1, hz1);
|
||||
vertex[ind + 4] = V3(hx2, hy2, hz2);
|
||||
vertex[ind + 5] = V3(hx3, hy3, hz3);
|
||||
|
||||
if(smooth) {
|
||||
normals[ind + 0] = d3_normalize([hx0, hy0, hz0]);
|
||||
normals[ind + 1] = d3_normalize([hx1, hy1, hz1]);
|
||||
normals[ind + 2] = d3_normalize([hx2, hy2, hz2]);
|
||||
|
||||
normals[ind + 3] = d3_normalize([hx1, hy1, hz1]);
|
||||
normals[ind + 4] = d3_normalize([hx2, hy2, hz2]);
|
||||
normals[ind + 5] = d3_normalize([hx3, hy3, hz3]);
|
||||
vertex[ind + 0].setNormal(hx0, hy0, hz0);
|
||||
vertex[ind + 1].setNormal(hx1, hy1, hz1);
|
||||
vertex[ind + 2].setNormal(hx2, hy2, hz2);
|
||||
|
||||
vertex[ind + 3].setNormal(hx1, hy1, hz1);
|
||||
vertex[ind + 4].setNormal(hx2, hy2, hz2);
|
||||
vertex[ind + 5].setNormal(hx3, hy3, hz3);
|
||||
} else {
|
||||
var nor = d3_cross_product([hx2 - hx0, hy2 - hy0, hz2 - hz0], [hx1 - hx0, hy1 - hy0, hz1 - hz0]);
|
||||
nor = d3_normalize(nor);
|
||||
|
||||
normals[ind + 0] = nor;
|
||||
normals[ind + 1] = nor;
|
||||
normals[ind + 2] = nor;
|
||||
|
||||
normals[ind + 3] = nor;
|
||||
normals[ind + 4] = nor;
|
||||
normals[ind + 5] = nor;
|
||||
vertex[ind + 0].setNormal(nor);
|
||||
vertex[ind + 1].setNormal(nor);
|
||||
vertex[ind + 2].setNormal(nor);
|
||||
|
||||
vertex[ind + 3].setNormal(nor);
|
||||
vertex[ind + 4].setNormal(nor);
|
||||
vertex[ind + 5].setNormal(nor);
|
||||
}
|
||||
|
||||
uv[ind + 0] = [u0, v0];
|
||||
uv[ind + 1] = [u1, v1];
|
||||
uv[ind + 2] = [u2, v2];
|
||||
vertex[ind + 0].setUV(u0, v0);
|
||||
vertex[ind + 1].setUV(u1, v1);
|
||||
vertex[ind + 2].setUV(u2, v2);
|
||||
|
||||
uv[ind + 3] = [u1, v1];
|
||||
uv[ind + 4] = [u2, v2];
|
||||
uv[ind + 5] = [u3, v3];
|
||||
vertex[ind + 3].setUV(u1, v1);
|
||||
vertex[ind + 4].setUV(u2, v2);
|
||||
vertex[ind + 5].setUV(u3, v3);
|
||||
}
|
||||
|
||||
VB = build();
|
||||
|
|
36
scripts/d3d_vec2/d3d_vec2.gml
Normal file
36
scripts/d3d_vec2/d3d_vec2.gml
Normal file
|
@ -0,0 +1,36 @@
|
|||
function __vec2(_x = 0, _y = _x) constructor {
|
||||
static set = function(_x = 0, _y = _x) {
|
||||
if(is_struct(_x) && is_instanceof(_x, __vec2)) {
|
||||
x = _x.x;
|
||||
y = _x.y;
|
||||
return self;
|
||||
}
|
||||
|
||||
if(is_struct(_x) && is_instanceof(_x, BBMOD_Vec2)) {
|
||||
x = _x.X;
|
||||
y = _x.Y;
|
||||
return self;
|
||||
}
|
||||
|
||||
if(is_array(_x)) {
|
||||
x = _x[0];
|
||||
y = _x[1];
|
||||
return self;
|
||||
}
|
||||
|
||||
x = _x;
|
||||
y = _y;
|
||||
return self;
|
||||
} set(_x, _y);
|
||||
|
||||
static clone = function() {
|
||||
gml_pragma("forceinline");
|
||||
return new __vec2(x, y);
|
||||
}
|
||||
|
||||
static toString = function() { return $"[{x}, {y}]"; }
|
||||
|
||||
static toBBMOD = function() { return new BBMOD_Vec2(x, y); }
|
||||
|
||||
static toArray = function() { return [ x, y ]; }
|
||||
}
|
11
scripts/d3d_vec2/d3d_vec2.yy
Normal file
11
scripts/d3d_vec2/d3d_vec2.yy
Normal file
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"resourceType": "GMScript",
|
||||
"resourceVersion": "1.0",
|
||||
"name": "d3d_vec2",
|
||||
"isCompatibility": false,
|
||||
"isDnD": false,
|
||||
"parent": {
|
||||
"name": "util",
|
||||
"path": "folders/functions/3d/util.yy",
|
||||
},
|
||||
}
|
|
@ -8,21 +8,21 @@ function __vec3(_x = 0, _y = _x, _z = _x) constructor {
|
|||
x = _x.x;
|
||||
y = _x.y;
|
||||
z = _x.z;
|
||||
return;
|
||||
return self;
|
||||
}
|
||||
|
||||
if(is_struct(_x) && is_instanceof(_x, BBMOD_Vec3)) {
|
||||
x = _x.X;
|
||||
y = _x.Y;
|
||||
z = _x.Z;
|
||||
return;
|
||||
return self;
|
||||
}
|
||||
|
||||
if(is_array(_x)) {
|
||||
x = _x[0];
|
||||
y = _x[1];
|
||||
z = _x[2];
|
||||
return;
|
||||
return self;
|
||||
}
|
||||
|
||||
x = _x;
|
||||
|
|
|
@ -19,7 +19,7 @@ function __vec4(_x = 0, _y = _x, _z = _x, _w = _x) constructor {
|
|||
x = _x[0];
|
||||
y = _x[1];
|
||||
z = _x[2];
|
||||
return;
|
||||
return self;
|
||||
}
|
||||
|
||||
x = _x;
|
||||
|
|
28
scripts/d3d_vertex/d3d_vertex.gml
Normal file
28
scripts/d3d_vertex/d3d_vertex.gml
Normal file
|
@ -0,0 +1,28 @@
|
|||
function V3(_x = 0, _y = _x, _z = _x, color = c_white, alpha = 1) {
|
||||
return new __vertex(_x, _y, _z, color, alpha);
|
||||
}
|
||||
|
||||
function __vertex(_x = 0, _y = _x, _z = _x, color = c_white, alpha = 1) : __vec3(_x, _y, _z) constructor {
|
||||
normal = new __vec3();
|
||||
uv = new __vec2();
|
||||
|
||||
self.color = color;
|
||||
self.alpha = alpha;
|
||||
|
||||
static setNormal = function(_nx = 0, _ny = _nx, _nz = _nx) {
|
||||
normal.set(_nx, _ny, _nx)._normalize();
|
||||
return self;
|
||||
}
|
||||
|
||||
static setUV = function(_u = 0, _v = _u) {
|
||||
uv.set(_u, _v);
|
||||
return self;
|
||||
}
|
||||
|
||||
static toString = function() { return $"[{x}, {y}, {z}, {color}, {alpha}]"; }
|
||||
|
||||
static clone = function() {
|
||||
gml_pragma("forceinline");
|
||||
return new __vertex(x, y, z, color, alpha);
|
||||
}
|
||||
}
|
11
scripts/d3d_vertex/d3d_vertex.yy
Normal file
11
scripts/d3d_vertex/d3d_vertex.yy
Normal file
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"resourceType": "GMScript",
|
||||
"resourceVersion": "1.0",
|
||||
"name": "d3d_vertex",
|
||||
"isCompatibility": false,
|
||||
"isDnD": false,
|
||||
"parent": {
|
||||
"name": "util",
|
||||
"path": "folders/functions/3d/util.yy",
|
||||
},
|
||||
}
|
36
scripts/node_3d_mesh_cone/node_3d_mesh_cone.gml
Normal file
36
scripts/node_3d_mesh_cone/node_3d_mesh_cone.gml
Normal file
|
@ -0,0 +1,36 @@
|
|||
function Node_3D_Mesh_Cone(_x, _y, _group = noone) : Node_3D_Mesh(_x, _y, _group) constructor {
|
||||
name = "3D Cone";
|
||||
|
||||
object_class = __3dCone;
|
||||
|
||||
inputs[| in_mesh + 0] = nodeValue("Side", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 8 );
|
||||
|
||||
inputs[| in_mesh + 1] = nodeValue("Texture Bottom", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone );
|
||||
|
||||
inputs[| in_mesh + 2] = nodeValue("Texture Side", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone );
|
||||
|
||||
inputs[| in_mesh + 3] = nodeValue("Smooth Side", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false );
|
||||
|
||||
input_display_list = [
|
||||
__d3d_input_list_mesh, in_mesh + 0, in_mesh + 3,
|
||||
__d3d_input_list_transform,
|
||||
["Texture", false], in_mesh + 1, in_mesh + 2,
|
||||
]
|
||||
|
||||
static processData = function(_output, _data, _output_index, _array_index = 0) { #region
|
||||
var _side = _data[in_mesh + 0];
|
||||
var _tex_bot = _data[in_mesh + 1];
|
||||
var _tex_sid = _data[in_mesh + 2];
|
||||
var _smt = _data[in_mesh + 3];
|
||||
|
||||
var object = getObject(_array_index);
|
||||
object.checkParameter({sides: _side, smooth: _smt});
|
||||
object.texture = [ surface_texture(_tex_bot), surface_texture(_tex_sid) ];
|
||||
|
||||
setTransform(object, _data);
|
||||
|
||||
return object;
|
||||
} #endregion
|
||||
|
||||
static getPreviewValues = function() { return array_safe_get(all_inputs, in_mesh + 1, noone); }
|
||||
}
|
11
scripts/node_3d_mesh_cone/node_3d_mesh_cone.yy
Normal file
11
scripts/node_3d_mesh_cone/node_3d_mesh_cone.yy
Normal file
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"resourceType": "GMScript",
|
||||
"resourceVersion": "1.0",
|
||||
"name": "node_3d_mesh_cone",
|
||||
"isCompatibility": false,
|
||||
"isDnD": false,
|
||||
"parent": {
|
||||
"name": "d3d mesh",
|
||||
"path": "folders/nodes/data/3D/d3d mesh.yy",
|
||||
},
|
||||
}
|
12
scripts/node_3d_mesh_cone/node_counter.yy
Normal file
12
scripts/node_3d_mesh_cone/node_counter.yy
Normal file
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"isDnD": false,
|
||||
"isCompatibility": false,
|
||||
"parent": {
|
||||
"name": "variable",
|
||||
"path": "folders/nodes/data/variable.yy",
|
||||
},
|
||||
"resourceVersion": "1.0",
|
||||
"name": "node_counter",
|
||||
"tags": [],
|
||||
"resourceType": "GMScript",
|
||||
}
|
|
@ -92,9 +92,8 @@ function Node_3D_Mesh_Obj(_x, _y, _group = noone) : Node_3D_Mesh(_x, _y, _group)
|
|||
if(object != noone) object.destroy();
|
||||
object = new __3dObject();
|
||||
object.VB = _v.vertex_groups;
|
||||
object.vertex = _v.vertex_positions;
|
||||
object.normals = _v.vertex_normals;
|
||||
object.uv = _v.vertex_textures;
|
||||
object.vertex = _v.vertex;
|
||||
object.object_counts = _v.object_counts;
|
||||
|
||||
object.size = _v.model_size;
|
||||
materialNames = _v.materials;
|
||||
|
@ -142,8 +141,7 @@ function Node_3D_Mesh_Obj(_x, _y, _group = noone) : Node_3D_Mesh(_x, _y, _group)
|
|||
_object.VF = global.VF_POS_NORM_TEX_COL;
|
||||
_object.VB = object.VB;
|
||||
_object.vertex = object.vertex;
|
||||
_object.normals = object.normals;
|
||||
_object.uv = object.uv;
|
||||
_object.object_counts = object.object_counts;
|
||||
_object.texture = textures;
|
||||
|
||||
setTransform(_object, _data);
|
||||
|
|
28
scripts/node_3d_mesh_plane/node_3d_mesh_plane.gml
Normal file
28
scripts/node_3d_mesh_plane/node_3d_mesh_plane.gml
Normal file
|
@ -0,0 +1,28 @@
|
|||
function Node_3D_Mesh_Plane(_x, _y, _group = noone) : Node_3D_Mesh(_x, _y, _group) constructor {
|
||||
name = "3D Plane";
|
||||
|
||||
object_class = __3dPlane();
|
||||
|
||||
inputs[| in_mesh + 0] = nodeValue("Texture", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone );
|
||||
|
||||
input_display_list = [
|
||||
__d3d_input_list_mesh,
|
||||
__d3d_input_list_transform,
|
||||
["Texture", false], in_mesh + 0,
|
||||
]
|
||||
|
||||
static processData = function(_output, _data, _output_index, _array_index = 0) { #region
|
||||
var _tex = _data[in_mesh + 0];
|
||||
|
||||
var object;
|
||||
|
||||
object = getObject(_array_index, __3dCube);
|
||||
object.texture = surface_texture(_tex);
|
||||
|
||||
setTransform(object, _data);
|
||||
|
||||
return object;
|
||||
} #endregion
|
||||
|
||||
static getPreviewValues = function() { return array_safe_get(all_inputs, in_mesh + 0, noone); }
|
||||
}
|
11
scripts/node_3d_mesh_plane/node_3d_mesh_plane.yy
Normal file
11
scripts/node_3d_mesh_plane/node_3d_mesh_plane.yy
Normal file
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"resourceType": "GMScript",
|
||||
"resourceVersion": "1.0",
|
||||
"name": "node_3d_mesh_plane",
|
||||
"isCompatibility": false,
|
||||
"isDnD": false,
|
||||
"parent": {
|
||||
"name": "d3d mesh",
|
||||
"path": "folders/nodes/data/3D/d3d mesh.yy",
|
||||
},
|
||||
}
|
12
scripts/node_3d_mesh_plane/node_counter.yy
Normal file
12
scripts/node_3d_mesh_plane/node_counter.yy
Normal file
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"isDnD": false,
|
||||
"isCompatibility": false,
|
||||
"parent": {
|
||||
"name": "variable",
|
||||
"path": "folders/nodes/data/variable.yy",
|
||||
},
|
||||
"resourceVersion": "1.0",
|
||||
"name": "node_counter",
|
||||
"tags": [],
|
||||
"resourceType": "GMScript",
|
||||
}
|
|
@ -353,7 +353,6 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor {
|
|||
addNodeObject(threeD, "Normal Light", s_node_normal_light, "Node_Normal_Light", [1, Node_Normal_Light],, "Light up the image using normal mapping.");
|
||||
addNodeObject(threeD, "Bevel", s_node_bevel, "Node_Bevel", [1, Node_Bevel], ["shade", "auto shade"], "Apply 2D bevel on the image.");
|
||||
addNodeObject(threeD, "Sprite Stack", s_node_stack, "Node_Sprite_Stack", [1, Node_Sprite_Stack],, "Create sprite stack either from repeating a single image or stacking different images using array.");
|
||||
///**/ addNodeObject(threeD, "Depth 3D", s_node_stack, "Node_3D_Depth", [1, Node_3D_Depth],, "Create 3D looking image from depth map.").setVersion(1447);
|
||||
|
||||
ds_list_add(threeD, "3D");
|
||||
addNodeObject(threeD, "3D Scene", s_node_3d_cube, "Node_3D_Scene", [1, Node_3D_Scene]);
|
||||
|
@ -361,17 +360,18 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor {
|
|||
|
||||
ds_list_add(threeD, "Mesh");
|
||||
addNodeObject(threeD, "3D Object", s_node_3d_obj, "Node_3D_Mesh_Obj", [0, Node_create_3D_Obj],, "Load .obj file from your computer as a 3D object.");
|
||||
addNodeObject(threeD, "3D Plane", s_node_3d_plane, "Node_3D_Plane", [1, Node_3D_Mesh_Plane],, "Put 2D image on a plane in 3D space.");
|
||||
addNodeObject(threeD, "3D Cube", s_node_3d_cube, "Node_3D_Mesh_Cube", [1, Node_3D_Mesh_Cube]);
|
||||
addNodeObject(threeD, "3D Cylinder", s_node_3d_cylinder, "Node_3D_Mesh_Cylinder", [1, Node_3D_Mesh_Cylinder]);
|
||||
addNodeObject(threeD, "3D UV Sphere", s_node_3d_sphere, "Node_3D_Mesh_Sphere_UV", [1, Node_3D_Mesh_Sphere_UV]);
|
||||
addNodeObject(threeD, "3D Icosphere", s_node_3d_sphere, "Node_3D_Mesh_Sphere_Ico", [1, Node_3D_Mesh_Sphere_Ico]);
|
||||
addNodeObject(threeD, "3D Cone", s_node_3d_cone, "Node_3D_Mesh_Cone", [1, Node_3D_Mesh_Cone])
|
||||
|
||||
ds_list_add(threeD, "Light");
|
||||
addNodeObject(threeD, "Directional Light", s_node_3d_cube, "Node_3D_Light_Directional", [1, Node_3D_Light_Directional]);
|
||||
addNodeObject(threeD, "Point Light", s_node_3d_cube, "Node_3D_Light_Point", [1, Node_3D_Light_Point]);
|
||||
|
||||
ds_list_add(threeD, "Legacy");
|
||||
addNodeObject(threeD, "3D Object", s_node_3d_obj, "Node_3D_Obj", [1, Node_3D_Obj],, "Load .obj file from your computer as a 3D object.").isDeprecated();
|
||||
ds_list_add(threeD, "Legacy"); //////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
addNodeObject(threeD, "3D Plane", s_node_3d_plane, "Node_3D_Plane", [1, Node_3D_Plane],, "Put 2D image on a plane in 3D space.").isDeprecated();
|
||||
addNodeObject(threeD, "3D Cube", s_node_3d_cube, "Node_3D_Cube", [1, Node_3D_Cube]).isDeprecated();
|
||||
addNodeObject(threeD, "3D Cylinder", s_node_3d_cylinder, "Node_3D_Cylinder", [1, Node_3D_Cylinder]).isDeprecated();
|
||||
|
|
|
@ -18,7 +18,7 @@ function readObj(path, flipUV = false) {
|
|||
var tri = 0;
|
||||
|
||||
var file = file_text_open_read(path);
|
||||
while(!file_text_eof(file)) {
|
||||
while(!file_text_eof(file)) { #region reading file
|
||||
var l = file_text_readln(file);
|
||||
l = string_trim(l);
|
||||
|
||||
|
@ -97,16 +97,17 @@ function readObj(path, flipUV = false) {
|
|||
array_push(tris, tri);
|
||||
}
|
||||
file_text_close(file);
|
||||
#endregion
|
||||
|
||||
if(use_normal) vn[| 0] = [ 0, 0, 0 ];
|
||||
|
||||
var txt = "OBJ summary";
|
||||
txt += $"\n\tVerticies : {ds_list_size(v)}";
|
||||
txt += $"\n\tTexture Verticies : {ds_list_size(vt)}";
|
||||
txt += $"\n\tNormal Verticies : {ds_list_size(vn)}";
|
||||
txt += $"\n\tVertex groups : {array_length(_VB)}";
|
||||
txt += $"\n\tTriangles : {tris}";
|
||||
print(txt);
|
||||
//var txt = "OBJ summary";
|
||||
//txt += $"\n\tVerticies : {ds_list_size(v)}";
|
||||
//txt += $"\n\tTexture Verticies : {ds_list_size(vt)}";
|
||||
//txt += $"\n\tNormal Verticies : {ds_list_size(vn)}";
|
||||
//txt += $"\n\tVertex groups : {array_length(_VB)}";
|
||||
//txt += $"\n\tTriangles : {tris}";
|
||||
//print(txt);
|
||||
|
||||
#region centralize vertex
|
||||
var _bmin = v[| 0];
|
||||
|
@ -151,10 +152,8 @@ function readObj(path, flipUV = false) {
|
|||
|
||||
#region vertex buffer creation
|
||||
var _vblen = array_length(_VB);
|
||||
var VBS = array_create(_vblen);
|
||||
var Vpos = array_create(_vblen);
|
||||
var Vnor = array_create(_vblen);
|
||||
var Vtex = array_create(_vblen);
|
||||
var VBS = array_create(_vblen);
|
||||
var V = array_create(_vblen);
|
||||
|
||||
for(var i = 0; i < _vblen; i++) {
|
||||
var VB = vertex_create_buffer();
|
||||
|
@ -165,9 +164,7 @@ function readObj(path, flipUV = false) {
|
|||
var tri = tris[i];
|
||||
|
||||
var _flen = ds_list_size(face);
|
||||
var _vpos = array_create(tri * 3);
|
||||
var _vnor = array_create(tri * 3);
|
||||
var _vtex = array_create(tri * 3);
|
||||
var _v = array_create(tri * 3);
|
||||
var _vind = 0;
|
||||
|
||||
for(var j = 0; j < _flen; j++) {
|
||||
|
@ -189,10 +186,6 @@ function readObj(path, flipUV = false) {
|
|||
|
||||
var _vTindex = _ft[k] - 1;
|
||||
_pft[k] = vt[| _vTindex];
|
||||
|
||||
//print($"vPos {k}[{_vPindex}] = {_pf[k]}");
|
||||
//print($"vNor {k}[{_vNindex}] = {_pfn[k]}");
|
||||
//print($"vTex {k}[{_vTindex}] = {_pft[k]}");
|
||||
}
|
||||
|
||||
if(_vlen >= 3) {
|
||||
|
@ -200,28 +193,27 @@ function readObj(path, flipUV = false) {
|
|||
vertex_add_pntc(VB, _pf[1], _pfn[1], _pft[1]);
|
||||
vertex_add_pntc(VB, _pf[2], _pfn[2], _pft[2]);
|
||||
|
||||
_vpos[_vind] = _pf[0]; _vnor[_vind] = _pfn[0]; _vtex[_vind] = _pft[0]; _vind++;
|
||||
_vpos[_vind] = _pf[1]; _vnor[_vind] = _pfn[1]; _vtex[_vind] = _pft[1]; _vind++;
|
||||
_vpos[_vind] = _pf[2]; _vnor[_vind] = _pfn[2]; _vtex[_vind] = _pft[2]; _vind++;
|
||||
_v[_vind] = V3(_pf[0]).setNormal(_pfn[0]).setUV(_pft[0]); _vind++;
|
||||
_v[_vind] = V3(_pf[1]).setNormal(_pfn[1]).setUV(_pft[1]); _vind++;
|
||||
_v[_vind] = V3(_pf[2]).setNormal(_pfn[2]).setUV(_pft[2]); _vind++;
|
||||
}
|
||||
|
||||
|
||||
if(_vlen >= 4) {
|
||||
vertex_add_pntc(VB, _pf[0], _pfn[0], _pft[0]);
|
||||
vertex_add_pntc(VB, _pf[2], _pfn[2], _pft[2]);
|
||||
vertex_add_pntc(VB, _pf[3], _pfn[3], _pft[3]);
|
||||
|
||||
_vpos[_vind] = _pf[0]; _vnor[_vind] = _pfn[0]; _vtex[_vind] = _pft[0]; _vind++;
|
||||
_vpos[_vind] = _pf[2]; _vnor[_vind] = _pfn[2]; _vtex[_vind] = _pft[2]; _vind++;
|
||||
_vpos[_vind] = _pf[3]; _vnor[_vind] = _pfn[3]; _vtex[_vind] = _pft[3]; _vind++;
|
||||
_v[_vind] = V3(_pf[0]).setNormal(_pfn[0]).setUV(_pft[0]); _vind++;
|
||||
_v[_vind] = V3(_pf[2]).setNormal(_pfn[2]).setUV(_pft[2]); _vind++;
|
||||
_v[_vind] = V3(_pf[3]).setNormal(_pfn[3]).setUV(_pft[3]); _vind++;
|
||||
}
|
||||
}
|
||||
|
||||
vertex_end(VB);
|
||||
vertex_freeze(VB);
|
||||
|
||||
VBS[i] = VB;
|
||||
Vpos[i] = _vpos;
|
||||
Vnor[i] = _vnor;
|
||||
Vtex[i] = _vtex;
|
||||
V[i] = _v;
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
@ -236,10 +228,9 @@ function readObj(path, flipUV = false) {
|
|||
#endregion
|
||||
|
||||
return {
|
||||
vertex_groups: VBS,
|
||||
vertex_positions: Vpos,
|
||||
vertex_normals: Vnor,
|
||||
vertex_textures: Vtex,
|
||||
vertex: V,
|
||||
vertex_groups: VBS,
|
||||
object_counts: _vblen,
|
||||
|
||||
materials: mats,
|
||||
material_index: matIndex,
|
||||
|
|
Loading…
Reference in a new issue