rm render

This commit is contained in:
Tanasart 2024-06-16 10:27:57 +07:00
parent 7a692822b3
commit a7d756d565
25 changed files with 549 additions and 167 deletions

View file

@ -1006,6 +1006,7 @@
{"name":"node_rim","order":22,"path":"scripts/node_rim/node_rim.yy",},
{"name":"node_rm_combine","order":3,"path":"scripts/node_rm_combine/node_rm_combine.yy",},
{"name":"node_rm_primitive","order":1,"path":"scripts/node_rm_primitive/node_rm_primitive.yy",},
{"name":"node_rm_render","order":6,"path":"scripts/node_rm_render/node_rm_render.yy",},
{"name":"node_rm_terrain","order":2,"path":"scripts/node_rm_terrain/node_rm_terrain.yy",},
{"name":"node_sampler","order":3,"path":"scripts/node_sampler/node_sampler.yy",},
{"name":"node_scale_algo","order":12,"path":"scripts/node_scale_algo/node_scale_algo.yy",},
@ -1975,8 +1976,9 @@
{"name":"s_node_rigidSim_renderer","order":1,"path":"sprites/s_node_rigidSim_renderer/s_node_rigidSim_renderer.yy",},
{"name":"s_node_rigidSim_wall","order":11,"path":"sprites/s_node_rigidSim_wall/s_node_rigidSim_wall.yy",},
{"name":"s_node_rm_combine","order":26,"path":"sprites/s_node_rm_combine/s_node_rm_combine.yy",},
{"name":"s_node_rm_primitive","order":51,"path":"sprites/s_node_rm_primitive/s_node_rm_primitive.yy",},
{"name":"s_node_rm_terrain","order":52,"path":"sprites/s_node_rm_terrain/s_node_rm_terrain.yy",},
{"name":"s_node_rm_primitive","order":27,"path":"sprites/s_node_rm_primitive/s_node_rm_primitive.yy",},
{"name":"s_node_rm_render","order":29,"path":"sprites/s_node_rm_render/s_node_rm_render.yy",},
{"name":"s_node_rm_terrain","order":28,"path":"sprites/s_node_rm_terrain/s_node_rm_terrain.yy",},
{"name":"s_node_sampler","order":19,"path":"sprites/s_node_sampler/s_node_sampler.yy",},
{"name":"s_node_scale_algo","order":7,"path":"sprites/s_node_scale_algo/s_node_scale_algo.yy",},
{"name":"s_node_scale","order":6,"path":"sprites/s_node_scale/s_node_scale.yy",},

View file

@ -1435,6 +1435,7 @@
{"id":{"name":"node_rim","path":"scripts/node_rim/node_rim.yy",},},
{"id":{"name":"node_rm_combine","path":"scripts/node_rm_combine/node_rm_combine.yy",},},
{"id":{"name":"node_rm_primitive","path":"scripts/node_rm_primitive/node_rm_primitive.yy",},},
{"id":{"name":"node_rm_render","path":"scripts/node_rm_render/node_rm_render.yy",},},
{"id":{"name":"node_rm_terrain","path":"scripts/node_rm_terrain/node_rm_terrain.yy",},},
{"id":{"name":"node_sampler","path":"scripts/node_sampler/node_sampler.yy",},},
{"id":{"name":"node_scale_algo","path":"scripts/node_scale_algo/node_scale_algo.yy",},},
@ -2542,6 +2543,7 @@
{"id":{"name":"s_node_rigidSim","path":"sprites/s_node_rigidSim/s_node_rigidSim.yy",},},
{"id":{"name":"s_node_rm_combine","path":"sprites/s_node_rm_combine/s_node_rm_combine.yy",},},
{"id":{"name":"s_node_rm_primitive","path":"sprites/s_node_rm_primitive/s_node_rm_primitive.yy",},},
{"id":{"name":"s_node_rm_render","path":"sprites/s_node_rm_render/s_node_rm_render.yy",},},
{"id":{"name":"s_node_rm_terrain","path":"sprites/s_node_rm_terrain/s_node_rm_terrain.yy",},},
{"id":{"name":"s_node_sampler","path":"sprites/s_node_sampler/s_node_sampler.yy",},},
{"id":{"name":"s_node_scale_algo","path":"sprites/s_node_scale_algo/s_node_scale_algo.yy",},},

View file

@ -28,8 +28,12 @@ function RM_Object() constructor {
rotation = [];
objectScale = [];
tileSize = [];
tileActive = [];
tileAmount = [];
tileSpace = [];
tilePos = [];
tileRot = [];
tileSca = [];
diffuseColor = [];
reflective = [];
@ -49,13 +53,15 @@ function RM_Object() constructor {
"waveAmp", "waveInt", "waveShift",
"twistAxis", "twistAmount",
"position", "rotation", "objectScale",
"tileSize", "tileAmount",
"tileActive", "tileAmount", "tileSpace", "tilePos", "tileRot", "tileSca",
"diffuseColor", "reflective",
"volumetric", "volumeDensity",
"texture", "useTexture", "textureScale", "triplanar"
];
textureAtl = noone;
static flatten = function() {}
static setTexture = function(textureAtlas) {
var tx = 1024;
@ -103,8 +109,12 @@ function RM_Object() constructor {
shader_set_f("rotation", rotation);
shader_set_f("objectScale", objectScale);
shader_set_f("tileSize", tileSize);
shader_set_i("tileActive", tileActive);
shader_set_f("tileAmount", tileAmount);
shader_set_f("tileSize", tileSpace);
shader_set_f("tileShiftPos", tilePos);
shader_set_f("tileShiftRot", tileRot);
shader_set_f("tileShiftSca", tileSca);
shader_set_f("diffuseColor", diffuseColor);
shader_set_f("reflective", reflective);
@ -155,7 +165,7 @@ function RM_Operation(type, left, right) : RM_Object() constructor {
array_append(_arr, __flatten(_l));
array_append(_arr, __flatten(_r));
array_push(_arr, _op);
array_push(_arr, [ _op, node ]);
return _arr;
}
@ -180,15 +190,15 @@ function RM_Operation(type, left, right) : RM_Object() constructor {
for (var i = 0, n = array_length(_arr); i < n; i++) {
var _a = _arr[i];
if(is_string(_a)) {
switch(_a) {
if(is_array(_a)) {
switch(_a[0]) {
case "combine" : array_push(opmap, 100); break;
case "union" : array_push(opmap, 101); break;
case "subtract" : array_push(opmap, 102); break;
case "intersect" : array_push(opmap, 103); break;
}
array_push(oparg, merge);
array_push(oparg, _a[1].merge);
} else if(is_struct(_a)) {
array_push(opmap, _a.flatten_index);
@ -234,8 +244,8 @@ function RM_Environment() constructor {
shader_set_f("viewRange", viewRange);
shader_set_f("depthInt", depthInt);
shader_set_i("drawBg", bgColor);
shader_set_color("background", bgDraw);
shader_set_i("drawBg", bgDraw);
shader_set_color("background", bgColor);
shader_set_f("ambientIntns", ambInten);
shader_set_f("lightPosition", light);

View file

@ -106,4 +106,6 @@ function buffer_compress_string(str) { #region
buffer_write(buffer, buffer_string, str);
return buffer_compress(buffer, 0, buffer_get_size(buffer));
} #endregion
} #endregion
function buffer_to_start(buff) { INLINE buffer_seek(buff, buffer_seek_start, 0); }

View file

@ -74,13 +74,24 @@ function __3dObject() constructor {
static buildVertex = function(_vertex) { #region
var _buffer = vertex_create_buffer();
vertex_begin(_buffer, VF);
for( var i = 0, n = array_length(_vertex); i < n; i++ ) {
var v = _vertex[i];
switch(VF) {
case global.VF_POS_COL : vertex_add_vc(_buffer, v); break;
case global.VF_POS_NORM_TEX_COL : vertex_add_vntc(_buffer, v); break;
}
switch(VF) {
case global.VF_POS_COL :
for( var i = 0, n = array_length(_vertex); i < n; i++ ) {
var v = _vertex[i];
vertex_position_3d(_buffer, v.x, v.y, v.z);
vertex_color(_buffer, v.color, v.alpha);
}
break;
case global.VF_POS_NORM_TEX_COL :
for( var i = 0, n = array_length(_vertex); i < n; i++ ) {
var v = _vertex[i];
vertex_position_3d(_buffer, v.x, v.y, v.z);
vertex_normal(_buffer, v.nx, v.ny, v.nz);
vertex_texcoord(_buffer, v.u, v.v);
vertex_color(_buffer, v.color, v.alpha);
}
break;
}
vertex_end(_buffer);
//vertex_freeze(_buffer);

View file

@ -9,19 +9,11 @@ function __3dSurfaceExtrude(surface = noone, height = noone, smooth = false) : _
surface_w = 1;
surface_h = 1;
normal_draw_size = 0.05;
height_w = 1;
height_h = 1;
static getHeight = function(h, gw, gh, i, j) {
INLINE
var _i = round(i * gw);
var _j = round(j * gh);
_i = clamp(_i, 0, array_length(h) - 1);
_j = clamp(_j, 0, array_length(h[_i]) - 1);
return h[_i][_j];
}
normal_draw_size = 0.05;
vertex_array = [];
static initModel = function() {
if(!is_surface(surface)) return;
@ -35,16 +27,17 @@ function __3dSurfaceExtrude(surface = noone, height = noone, smooth = false) : _
surface_w = ww;
surface_h = hh;
var ap = ww / hh;
var tw = ap / ww;
var th = 1 / hh;
var sw = -ap / 2;
var sh = 0.5;
var ap = ww / hh;
var tw = ap / ww;
var th = 1 / hh;
var sw = -ap / 2;
var sh = 0.5;
var fw = 1 / ww;
var fh = 1 / hh;
var useH = is_surface(_height);
var fw = 1 / ww;
var fh = 1 / hh;
var hei = 0;
#region ---- data prepare ----
#region ---- buffer prepare ----
if(smooth) {
var ts = surface_create(ww, hh);
surface_set_shader(ts, sh_3d_extrude_filler);
@ -64,22 +57,23 @@ function __3dSurfaceExtrude(surface = noone, height = noone, smooth = false) : _
}
if(useH) {
var hgw = surface_get_width_safe(_height);
var hgh = surface_get_height_safe(_height);
var hgtW = hgw / ww;
var hgtH = hgh / hh;
height_w = surface_get_width_safe(_height);
height_h = surface_get_height_safe(_height);
var height_buffer = buffer_create(hgw * hgh * 4, buffer_fixed, 2);
var hgtW = height_w / ww;
var hgtH = height_h / hh;
var height_buffer = buffer_create(height_w * height_h * 4, buffer_fixed, 2);
buffer_get_surface(height_buffer, _height, 0);
buffer_seek(height_buffer, buffer_seek_start, 0);
var hei = array_create(hgw, hgh);
var hei = buffer_create(height_h * height_w * 2, buffer_fixed, 2);
buffer_to_start(hei);
for( var j = 0; j < hgh; j++ )
for( var i = 0; i < hgw; i++ ) {
repeat(height_h * height_w) {
var cc = buffer_read(height_buffer, buffer_u32);
var _b = colorBrightness(cc & ~0b11111111);
hei[i][j] = _b;
var _b = round(colorBrightness(cc & ~0b11111111) * 65536);
buffer_write(hei, buffer_u16, _b);
}
buffer_delete(height_buffer);
@ -88,23 +82,35 @@ function __3dSurfaceExtrude(surface = noone, height = noone, smooth = false) : _
var surface_buffer = buffer_create(ww * hh * 4, buffer_fixed, 2);
buffer_get_surface(surface_buffer, _surface, 0);
buffer_seek(surface_buffer, buffer_seek_start, 0);
var v = ds_list_create();
var ap = array_create(ww, hh);
for( var j = 0; j < hh; j++ )
for( var i = 0; i < ww; i++ ) {
var ap = buffer_create(hh * ww, buffer_fast, 1);
buffer_to_start(ap);
repeat(hh * ww) {
var cc = buffer_read(surface_buffer, buffer_u32);
var _a = (cc & (0b11111111 << 24)) >> 24;
ap[i][j] = _a;
buffer_write(ap, buffer_u8, _a);
}
buffer_delete(surface_buffer);
if(smooth) {
surface_free(_surface);
if(useH) surface_free(_height);
}
#endregion
for( var i = 0; i < ww; i++ )
for( var j = 0; j < hh; j++ ) {
if(!smooth && ap[i][j] == 0) continue;
var _len = array_length(vertex_array);
for(var i = _len; i < ww * hh * 36; i++)
vertex_array[i] = new __vertex();
var v = array_create(ww * hh * 36);
var ind = 0;
var i = 0, j = 0, n = 0;
repeat(hh * ww) {
if(!smooth && buffer_read_at(ap, (j) * ww + (i), buffer_u8) == 0) continue;
var i0 = sw + i * tw;
var j0 = sh - j * th;
@ -114,74 +120,85 @@ function __3dSurfaceExtrude(surface = noone, height = noone, smooth = false) : _
var tx0 = fw * i, tx1 = tx0 + fw;
var ty0 = fh * j, ty1 = ty0 + fh;
var dep = (useH? getHeight(hei, hgtW, hgtH, i, j) : 1) * 0.5;
var dep = useH? buffer_read_at(hei, (round(i * hgtW) + round(j * hgtH) * height_w) * 2, buffer_u16) / 65536 * 0.5
: 0.5;
ds_list_add(v, new __vertex(i1, j0, -dep).setNormal(0, 0, -1).setUV(tx1, ty0));
ds_list_add(v, new __vertex(i0, j0, -dep).setNormal(0, 0, -1).setUV(tx0, ty0));
ds_list_add(v, new __vertex(i1, j1, -dep).setNormal(0, 0, -1).setUV(tx1, ty1));
v[ind] = vertex_array[ind].set(i1, j0, -dep, 0, 0, -1, tx1, ty0); ind++;
v[ind] = vertex_array[ind].set(i0, j0, -dep, 0, 0, -1, tx0, ty0); ind++;
v[ind] = vertex_array[ind].set(i1, j1, -dep, 0, 0, -1, tx1, ty1); ind++;
ds_list_add(v, new __vertex(i1, j1, -dep).setNormal(0, 0, -1).setUV(tx1, ty1));
ds_list_add(v, new __vertex(i0, j0, -dep).setNormal(0, 0, -1).setUV(tx0, ty0));
ds_list_add(v, new __vertex(i0, j1, -dep).setNormal(0, 0, -1).setUV(tx0, ty1));
v[ind] = vertex_array[ind].set(i1, j1, -dep, 0, 0, -1, tx1, ty1); ind++;
v[ind] = vertex_array[ind].set(i0, j0, -dep, 0, 0, -1, tx0, ty0); ind++;
v[ind] = vertex_array[ind].set(i0, j1, -dep, 0, 0, -1, tx0, ty1); ind++;
ds_list_add(v, new __vertex(i1, j0, dep).setNormal(0, 0, 1).setUV(tx1, ty0));
ds_list_add(v, new __vertex(i1, j1, dep).setNormal(0, 0, 1).setUV(tx1, ty1));
ds_list_add(v, new __vertex(i0, j0, dep).setNormal(0, 0, 1).setUV(tx0, ty0));
v[ind] = vertex_array[ind].set(i1, j0, dep, 0, 0, 1, tx1, ty0); ind++;
v[ind] = vertex_array[ind].set(i1, j1, dep, 0, 0, 1, tx1, ty1); ind++;
v[ind] = vertex_array[ind].set(i0, j0, dep, 0, 0, 1, tx0, ty0); ind++;
ds_list_add(v, new __vertex(i1, j1, dep).setNormal(0, 0, 1).setUV(tx1, ty1));
ds_list_add(v, new __vertex(i0, j1, dep).setNormal(0, 0, 1).setUV(tx0, ty1));
ds_list_add(v, new __vertex(i0, j0, dep).setNormal(0, 0, 1).setUV(tx0, ty0));
v[ind] = vertex_array[ind].set(i1, j1, dep, 0, 0, 1, tx1, ty1); ind++;
v[ind] = vertex_array[ind].set(i0, j1, dep, 0, 0, 1, tx0, ty1); ind++;
v[ind] = vertex_array[ind].set(i0, j0, dep, 0, 0, 1, tx0, ty0); ind++;
if((useH && dep * 2 > getHeight(hei, hgtW, hgtH, i, j - 1)) || (j == 0 || ap[i][j - 1] == 0)) { //y side
ds_list_add(v, new __vertex(i0, j0, dep).setNormal(0, 1, 0).setUV(tx1, ty0));
ds_list_add(v, new __vertex(i0, j0, -dep).setNormal(0, 1, 0).setUV(tx0, ty0));
ds_list_add(v, new __vertex(i1, j0, dep).setNormal(0, 1, 0).setUV(tx1, ty1));
if((useH && dep * 2 > buffer_read_at(hei, (round(i * hgtW) + max(0, round((j - 1) * hgtH)) * height_w) * 2, buffer_u16) / 65536)
|| (j == 0 || buffer_read_at(ap, (j - 1) * ww + (i), buffer_u8) == 0)) { //y side
v[ind] = vertex_array[ind].set(i0, j0, dep, 0, 1, 0, tx1, ty0); ind++;
v[ind] = vertex_array[ind].set(i0, j0, -dep, 0, 1, 0, tx0, ty0); ind++;
v[ind] = vertex_array[ind].set(i1, j0, dep, 0, 1, 0, tx1, ty1); ind++;
ds_list_add(v, new __vertex(i0, j0, -dep).setNormal(0, 1, 0).setUV(tx1, ty1));
ds_list_add(v, new __vertex(i1, j0, -dep).setNormal(0, 1, 0).setUV(tx0, ty0));
ds_list_add(v, new __vertex(i1, j0, dep).setNormal(0, 1, 0).setUV(tx0, ty1));
v[ind] = vertex_array[ind].set(i0, j0, -dep, 0, 1, 0, tx1, ty1); ind++;
v[ind] = vertex_array[ind].set(i1, j0, -dep, 0, 1, 0, tx0, ty0); ind++;
v[ind] = vertex_array[ind].set(i1, j0, dep, 0, 1, 0, tx0, ty1); ind++;
}
if((useH && dep * 2 > getHeight(hei, hgtW, hgtH, i, j + 1)) || (j == hh - 1 || ap[i][j + 1] == 0)) { //y side
ds_list_add(v, new __vertex(i0, j1, dep).setNormal(0, -1, 0).setUV(tx1, ty0));
ds_list_add(v, new __vertex(i1, j1, dep).setNormal(0, -1, 0).setUV(tx1, ty1));
ds_list_add(v, new __vertex(i0, j1, -dep).setNormal(0, -1, 0).setUV(tx0, ty0));
if((useH && dep * 2 > buffer_read_at(hei, (round(i * hgtW) + min(round((j + 1) * hgtH), height_h - 1) * height_w) * 2, buffer_u16) / 65536)
|| (j == hh - 1 || buffer_read_at(ap, (j + 1) * ww + (i), buffer_u8) == 0)) { //y side
v[ind] = vertex_array[ind].set(i0, j1, dep, 0, -1, 0, tx1, ty0); ind++;
v[ind] = vertex_array[ind].set(i1, j1, dep, 0, -1, 0, tx1, ty1); ind++;
v[ind] = vertex_array[ind].set(i0, j1, -dep, 0, -1, 0, tx0, ty0); ind++;
ds_list_add(v, new __vertex(i0, j1, -dep).setNormal(0, -1, 0).setUV(tx1, ty1));
ds_list_add(v, new __vertex(i1, j1, dep).setNormal(0, -1, 0).setUV(tx0, ty1));
ds_list_add(v, new __vertex(i1, j1, -dep).setNormal(0, -1, 0).setUV(tx0, ty0));
v[ind] = vertex_array[ind].set(i0, j1, -dep, 0, -1, 0, tx1, ty1); ind++;
v[ind] = vertex_array[ind].set(i1, j1, dep, 0, -1, 0, tx0, ty1); ind++;
v[ind] = vertex_array[ind].set(i1, j1, -dep, 0, -1, 0, tx0, ty0); ind++;
}
if((useH && dep * 2 > getHeight(hei, hgtW, hgtH, i - 1, j)) || (i == 0 || ap[i - 1][j] == 0)) { //x side
ds_list_add(v, new __vertex(i0, j0, dep).setNormal(-1, 0, 0).setUV(tx1, ty0));
ds_list_add(v, new __vertex(i0, j1, dep).setNormal(-1, 0, 0).setUV(tx1, ty1));
ds_list_add(v, new __vertex(i0, j0, -dep).setNormal(-1, 0, 0).setUV(tx0, ty0));
if((useH && dep * 2 > buffer_read_at(hei, (max(0, round((i - 1) * hgtW)) + round(j * hgtH) * height_w) * 2, buffer_u16) / 65536)
|| (i == 0 || buffer_read_at(ap, (j) * ww + (i - 1), buffer_u8) == 0)) { //x side
v[ind] = vertex_array[ind].set(i0, j0, dep, -1, 0, 0, tx1, ty0); ind++;
v[ind] = vertex_array[ind].set(i0, j1, dep, -1, 0, 0, tx1, ty1); ind++;
v[ind] = vertex_array[ind].set(i0, j0, -dep, -1, 0, 0, tx0, ty0); ind++;
ds_list_add(v, new __vertex(i0, j0, -dep).setNormal(-1, 0, 0).setUV(tx1, ty1));
ds_list_add(v, new __vertex(i0, j1, dep).setNormal(-1, 0, 0).setUV(tx0, ty1));
ds_list_add(v, new __vertex(i0, j1, -dep).setNormal(-1, 0, 0).setUV(tx0, ty0));
v[ind] = vertex_array[ind].set(i0, j0, -dep, -1, 0, 0, tx1, ty1); ind++;
v[ind] = vertex_array[ind].set(i0, j1, dep, -1, 0, 0, tx0, ty1); ind++;
v[ind] = vertex_array[ind].set(i0, j1, -dep, -1, 0, 0, tx0, ty0); ind++;
}
if((useH && dep * 2 > getHeight(hei, hgtW, hgtH, i + 1, j)) || (i == ww - 1 || ap[i + 1][j] == 0)) { //x side
ds_list_add(v, new __vertex(i1, j0, dep).setNormal(1, 0, 0).setUV(tx1, ty0));
ds_list_add(v, new __vertex(i1, j0, -dep).setNormal(1, 0, 0).setUV(tx0, ty0));
ds_list_add(v, new __vertex(i1, j1, dep).setNormal(1, 0, 0).setUV(tx1, ty1));
if((useH && dep * 2 > buffer_read_at(hei, (min(round((i + 1) * hgtW), height_w - 1 ) + round(j * hgtH) * height_w) * 2, buffer_u16) / 65536)
|| (i == ww - 1 || buffer_read_at(ap, (j) * ww + (i + 1), buffer_u8) == 0)) { //x side
v[ind] = vertex_array[ind].set(i1, j0, dep, 1, 0, 0, tx1, ty0); ind++;
v[ind] = vertex_array[ind].set(i1, j0, -dep, 1, 0, 0, tx0, ty0); ind++;
v[ind] = vertex_array[ind].set(i1, j1, dep, 1, 0, 0, tx1, ty1); ind++;
ds_list_add(v, new __vertex(i1, j0, -dep).setNormal(1, 0, 0).setUV(tx1, ty1));
ds_list_add(v, new __vertex(i1, j1, -dep).setNormal(1, 0, 0).setUV(tx0, ty0));
ds_list_add(v, new __vertex(i1, j1, dep).setNormal(1, 0, 0).setUV(tx0, ty1));
v[ind] = vertex_array[ind].set(i1, j0, -dep, 1, 0, 0, tx1, ty1); ind++;
v[ind] = vertex_array[ind].set(i1, j1, -dep, 1, 0, 0, tx0, ty0); ind++;
v[ind] = vertex_array[ind].set(i1, j1, dep, 1, 0, 0, tx0, ty1); ind++;
}
n++;
i = floor(n / ww);
j = n % ww;
}
if(smooth) {
surface_free(_surface);
if(useH) surface_free(_height);
}
array_resize(v, ind);
vertex = [ ds_list_to_array(v) ];
ds_list_destroy(v);
if(hei) buffer_delete(hei);
buffer_delete(ap);
VB = build();
vertex = [ v ];
VB = build();
} initModel();
static onParameterUpdate = initModel;

View file

@ -13,6 +13,23 @@ function __vertex(_x = 0, _y = _x, _z = _x, color = c_white, alpha = 1) construc
self.color = color;
self.alpha = alpha;
static set = function(_x, _y, _z, _nx, _ny, _nz, _u, _v) {
INLINE
x = _x;
y = _y;
z = _z;
nx = _nx;
ny = _ny;
nz = _nz;
u = _u;
v = _v;
return self;
}
static setNormal = function(_nx = 0, _ny = _nx, _nz = _nx) {
INLINE

View file

@ -38,7 +38,7 @@
LATEST_VERSION = 11700;
VERSION = 11740;
SAVE_VERSION = 11700;
VERSION_STRING = "1.17.4.004";
VERSION_STRING = "1.17.4.005";
BUILD_NUMBER = 11740;
globalvar HOTKEYS, HOTKEY_CONTEXT;

View file

@ -5,7 +5,7 @@ function Node_ASE_layer(_x, _y, _group = noone) : Node(_x, _y, _group) construct
.setVisible(false, true)
.rejectArray();
inputs[| 1] = nodeValue("Use cel dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false)
inputs[| 1] = nodeValue("Crop Output", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false)
.rejectArray();
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);

View file

@ -57,7 +57,7 @@ function Node_Equation(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
}
var amo = attributes.size;
if(buttonTextIconInstant(attributes.size > 0 && THEME.button_hide, _x + _w - bw, _y + ui(8), bw, bh, _m, _focus, _hover, "", THEME.minus, __txt("Remove"), COLORS._main_value_negative) == 2) {
if(buttonTextIconInstant(attributes.size > 0, THEME.button_hide, _x + _w - bw, _y + ui(8), bw, bh, _m, _focus, _hover, "", THEME.minus, __txt("Remove"), COLORS._main_value_negative) == 2) {
attributes.size--;
refreshDynamicInput();
update();

View file

@ -37,7 +37,7 @@ function Node_Path_Smooth(_x, _y, _group = noone) : Node(_x, _y, _group) constru
#endregion
#region ---- editor ----
line_hover = noone;
#endregion
static resetDisplayList = function() { #region
@ -273,9 +273,9 @@ function Node_Path_Smooth(_x, _y, _group = noone) : Node(_x, _y, _group) constru
];
} else {
for( var i = 0, n = amo; i < n; i++ ) {
var _a0 = array_safe_get_fast(anchors, (i - 1) % n, [ 0, 0 ]);
var _a1 = array_safe_get_fast(anchors, (i ) % n, [ 0, 0 ]);
var _a2 = array_safe_get_fast(anchors, (i + 1) % n, [ 0, 0 ]);
var _a0 = array_safe_get_fast(anchors, (i - 1 + amo) % n, [ 0, 0 ]);
var _a1 = array_safe_get_fast(anchors, (i + amo) % n, [ 0, 0 ]);
var _a2 = array_safe_get_fast(anchors, (i + 1 + amo) % n, [ 0, 0 ]);
var _dr = point_direction(_a0[0], _a0[1], _a2[0], _a2[1]);
var _ds0 = point_distance(_a1[0], _a1[1], _a0[0], _a0[1]) / smot;

View file

@ -688,6 +688,13 @@ function __initNodes() {
ds_list_add(d3d, "Points");
addNodeObject(d3d, "Point Affector", s_node_3d_point_affector, "Node_3D_Point_Affector", [1, Node_3D_Point_Affector],, "Generate array of 3D points interpolating between two values based on the distance.").setVersion(11570);
ds_list_add(d3d, "Ray Marching");
addNodeObject(d3d, "RM Primitive", s_node_rm_primitive, "Node_RM_Primitive", [1, Node_RM_Primitive], ["ray marching"]).setVersion(11720);
addNodeObject(d3d, "RM Terrain", s_node_rm_terrain, "Node_RM_Terrain", [1, Node_RM_Terrain], ["ray marching"]).setVersion(11720);
addNodeObject(d3d, "RM Combine", s_node_rm_combine, "Node_RM_Combine", [1, Node_RM_Combine], ["ray marching"]).setVersion(11740);
addNodeObject(d3d, "RM Render", s_node_rm_render, "Node_RM_Render", [1, Node_RM_Render], ["ray marching"]).setVersion(11740);
#endregion
var generator = ds_list_create(); #region //generator
@ -762,11 +769,6 @@ function __initNodes() {
addNodeObject(generator, "Region Fill", s_node_region_fill, "Node_Region_Fill", [1, Node_Region_Fill],, "Fill connected pixel with colors.").setVersion(1147);
addNodeObject(generator, "Flood Fill", s_node_flood_fill, "Node_Flood_Fill", [1, Node_Flood_Fill],, "Filled connected pixel given position and color.").setVersion(1133);
ds_list_add(generator, "Ray Marching");
addNodeObject(generator, "RM Primitive", s_node_rm_primitive, "Node_RM_Primitive", [1, Node_RM_Primitive], ["ray marching"]).setVersion(11720);
addNodeObject(generator, "RM Terrain", s_node_rm_terrain, "Node_RM_Terrain", [1, Node_RM_Terrain], ["ray marching"]).setVersion(11720);
addNodeObject(generator, "RM Combine", s_node_rm_combine, "Node_RM_Combine", [1, Node_RM_Combine], ["ray marching"]).setVersion(11740);
ds_list_add(generator, "MK Effects");
addNodeObject(generator, "MK Rain", s_node_mk_rain, "Node_MK_Rain", [1, Node_MK_Rain]).setVersion(11600);
addNodeObject(generator, "MK GridBalls", s_node_mk_ball_grid, "Node_MK_GridBalls", [1, Node_MK_GridBalls]).setVersion(11600);

View file

@ -55,6 +55,8 @@ function Node_RM_Combine(_x, _y, _group = noone) : Node_RM(_x, _y, _group) const
inputs[| 16] = nodeValue("Merge", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.1)
.setDisplay(VALUE_DISPLAY.slider);
inputs[| 17] = nodeValue("Render", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true);
outputs[| 0] = nodeValue("Surface Out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
outputs[| 1] = nodeValue("Shape Data", self, JUNCTION_CONNECT.output, VALUE_TYPE.sdf, noone);
@ -62,7 +64,7 @@ function Node_RM_Combine(_x, _y, _group = noone) : Node_RM(_x, _y, _group) const
input_display_list = [ 0,
["Combine", false], 15, 16, 13, 14,
["Camera", false], 11, 12, 1, 2, 3, 4, 5,
["Render", false], 6, 7, 8, 10, 9,
["Render", false, 17], 6, 7, 8, 10, 9,
]
temp_surface = [ 0, 0 ];
@ -73,8 +75,12 @@ function Node_RM_Combine(_x, _y, _group = noone) : Node_RM(_x, _y, _group) const
static step = function() {
var _type = getSingleValue(15);
var _ren = getSingleValue(17);
inputs[| 16].setVisible(_type > 0);
outputs[| 0].setVisible(_ren, _ren);
}
static processData = function(_outSurf, _data, _output_index, _array_index = 0) {
var _dim = _data[0];
@ -97,6 +103,7 @@ function Node_RM_Combine(_x, _y, _group = noone) : Node_RM(_x, _y, _group) const
var _sh1 = _data[14];
var _typ = _data[15];
var _mer = _data[16];
var _ren = _data[17];
if(!is_instanceof(_sh0, RM_Object)) return [ _outSurf, noone ];
if(!is_instanceof(_sh1, RM_Object)) return [ _outSurf, noone ];
@ -136,19 +143,21 @@ function Node_RM_Combine(_x, _y, _group = noone) : Node_RM(_x, _y, _group) const
environ.ambInten = _amb;
environ.light = _lig;
gpu_set_texfilter(true);
surface_set_shader(_outSurf, sh_rm_primitive);
shader_set_f("camRotation", _crt);
shader_set_f("camScale", _csa);
shader_set_f("camRatio", _dim[0] / _dim[1]);
environ.apply();
object.apply();
draw_sprite_stretched(s_fx_pixel, 0, 0, 0, _dim[0], _dim[1]);
surface_reset_shader();
gpu_set_texfilter(false);
if(_ren) {
gpu_set_texfilter(true);
surface_set_shader(_outSurf, sh_rm_primitive);
shader_set_f("camRotation", _crt);
shader_set_f("camScale", _csa);
shader_set_f("camRatio", _dim[0] / _dim[1]);
environ.apply();
object.apply();
draw_sprite_stretched(s_fx_pixel, 0, 0, 0, _dim[0], _dim[1]);
surface_reset_shader();
gpu_set_texfilter(false);
}
return [ _outSurf, object ];
}

View file

@ -9,7 +9,7 @@ function Node_RM_Primitive(_x, _y, _group = noone) : Node_RM(_x, _y, _group) con
-1,
"Sphere", "Ellipse", "Cut Sphere", "Cut Hollow Sphere", "Torus", "Capped Torus",
-1,
"Cylinder", "Prism", "Capsule", "Cone", "Capped Cone", "Round Cone", "3D Arc",
"Cylinder", "Prism", "Capsule", "Cone", "Capped Cone", "Round Cone", "3D Arc", "Pie",
-1,
"Octahedron", "Pyramid",
];
@ -79,7 +79,7 @@ function Node_RM_Primitive(_x, _y, _group = noone) : Node_RM(_x, _y, _group) con
inputs[| 19] = nodeValue("Twist Amount", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0)
.setDisplay(VALUE_DISPLAY.slider, { range: [ 0, 8, 0.1 ] });
inputs[| 20] = nodeValue("Tile", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0 ])
inputs[| 20] = nodeValue("Tile Distance", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0 ])
.setDisplay(VALUE_DISPLAY.vector);
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ -152,6 +152,22 @@ function Node_RM_Primitive(_x, _y, _group = noone) : Node_RM(_x, _y, _group) con
inputs[| 43] = nodeValue("Camera Scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1)
.setDisplay(VALUE_DISPLAY.slider, { range: [ 0, 4, 0.01 ] });
inputs[| 44] = nodeValue("Render", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true);
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
inputs[| 45] = nodeValue("Tile", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false);
inputs[| 46] = nodeValue("Tiled Shift", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0 ])
.setDisplay(VALUE_DISPLAY.vector);
inputs[| 47] = nodeValue("Tiled Rotation", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0 ])
.setDisplay(VALUE_DISPLAY.vector);
inputs[| 48] = nodeValue("Tiled Scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0);
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
outputs[| 0] = nodeValue("Surface Out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
outputs[| 1] = nodeValue("Shape Data", self, JUNCTION_CONNECT.output, VALUE_TYPE.sdf, noone);
@ -161,10 +177,11 @@ function Node_RM_Primitive(_x, _y, _group = noone) : Node_RM(_x, _y, _group) con
["Modify", false], 12, 11,
["Deform", true], 15, 16, 17, 18, 19,
["Transform", false], 2, 3, 4,
["Tile", false, 45], 20, 29, 46, 47, 48,
["Material", false], 9, 36, 35, 37, 38,
["Camera", false], 42, 43, 13, 14, 5, 6,
["Render", false], 31, 30, 34, 10, 7, 8,
["Tile", false], 20, 29,
["Render", false, 44], 31, 30, 34, 10, 7, 8,
["Volumetric", true, 32], 33,
];
@ -395,6 +412,7 @@ function Node_RM_Primitive(_x, _y, _group = noone) : Node_RM(_x, _y, _group) con
static step = function() {
var _shp = getSingleValue( 1);
var _ort = getSingleValue(13);
var _ren = getSingleValue(44);
inputs[| 21].setVisible(false);
inputs[| 22].setVisible(false);
@ -408,6 +426,8 @@ function Node_RM_Primitive(_x, _y, _group = noone) : Node_RM(_x, _y, _group) con
inputs[| 40].setVisible(false);
inputs[| 41].setVisible(false);
outputs[| 0].setVisible(_ren, _ren);
var _shape = shape_types[_shp];
switch(_shape) { // Size
case "Box" :
@ -426,6 +446,7 @@ function Node_RM_Primitive(_x, _y, _group = noone) : Node_RM(_x, _y, _group) con
case "Cylinder" :
case "Capsule" :
case "3D Arc" :
case "Pie" :
inputs[| 22].setVisible(true);
break;
}
@ -439,6 +460,7 @@ function Node_RM_Primitive(_x, _y, _group = noone) : Node_RM(_x, _y, _group) con
case "Terrain" :
case "Extrude" :
case "Prism" :
case "Pie" :
inputs[| 23].setVisible(true);
break;
}
@ -454,6 +476,7 @@ function Node_RM_Primitive(_x, _y, _group = noone) : Node_RM(_x, _y, _group) con
case "Capped Torus" :
case "Cone" :
case "3D Arc" :
case "Pie" :
inputs[| 25].setVisible(true);
break;
}
@ -532,7 +555,6 @@ function Node_RM_Primitive(_x, _y, _group = noone) : Node_RM(_x, _y, _group) con
var _wavS = _data[17];
var _twsX = _data[18];
var _twsA = _data[19];
var _tile = _data[20];
var _size = _data[21];
var _rad = _data[22];
@ -542,7 +564,6 @@ function Node_RM_Primitive(_x, _y, _group = noone) : Node_RM(_x, _y, _group) con
var _heig = _data[26];
var _radR = _data[27];
var _sizz = _data[28];
var _tilA = _data[29];
var _bgc = _data[30];
var _bgd = _data[31];
@ -560,6 +581,14 @@ function Node_RM_Primitive(_x, _y, _group = noone) : Node_RM(_x, _y, _group) con
var _crt = _data[42];
var _csa = _data[43];
var _ren = _data[44];
var _tileActive = _data[46];
var _tileAmount = _data[29];
var _tileSpace = _data[20];
var _tilePos = _data[47];
var _tileRot = _data[48];
var _tileSca = _data[49];
_outSurf = surface_verify(_outSurf, _dim[0], _dim[1]);
@ -594,6 +623,7 @@ function Node_RM_Primitive(_x, _y, _group = noone) : Node_RM(_x, _y, _group) con
case "Round Cone" : _shpI = 304; break;
case "3D Arc" : _shpI = 305; break;
case "Prism" : _shpI = 306; break;
case "Pie" : _shpI = 307; break;
case "Octahedron" : _shpI = 400; break;
case "Pyramid" : _shpI = 401; break;
@ -628,8 +658,12 @@ function Node_RM_Primitive(_x, _y, _group = noone) : Node_RM(_x, _y, _group) con
object.rotation = _rot;
object.objectScale = _sca;
object.tileSize = _tile;
object.tileAmount = _tilA;
object.tileActive = _tileActive;
object.tileAmount = _tileAmount;
object.tileSpace = _tileSpace;
object.tilePos = _tilePos;
object.tileRot = _tileRot;
object.tileSca = _tileSca;
object.diffuseColor = colorToArray(_amb, true);
object.reflective = _refl;
@ -658,19 +692,21 @@ function Node_RM_Primitive(_x, _y, _group = noone) : Node_RM(_x, _y, _group) con
environ.ambInten = _ambI;
environ.light = _lPos;
gpu_set_texfilter(true);
surface_set_shader(_outSurf, sh_rm_primitive);
shader_set_f("camRotation", _crt);
shader_set_f("camScale", _csa);
shader_set_f("camRatio", _dim[0] / _dim[1]);
environ.apply();
object.apply();
draw_sprite_stretched(s_fx_pixel, 0, 0, 0, _dim[0], _dim[1]);
surface_reset_shader();
gpu_set_texfilter(false);
if(_ren) {
gpu_set_texfilter(true);
surface_set_shader(_outSurf, sh_rm_primitive);
shader_set_f("camRotation", _crt);
shader_set_f("camScale", _csa);
shader_set_f("camRatio", _dim[0] / _dim[1]);
environ.apply();
object.apply();
draw_sprite_stretched(s_fx_pixel, 0, 0, 0, _dim[0], _dim[1]);
surface_reset_shader();
gpu_set_texfilter(false);
}
return [ _outSurf, object ];
}

View file

@ -0,0 +1,127 @@
function Node_RM_Render(_x, _y, _group = noone) : Node_RM(_x, _y, _group) constructor {
name = "RM Render";
inputs[| 0] = nodeValue("Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, DEF_SURF)
.setDisplay(VALUE_DISPLAY.vector);
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
inputs[| 1] = nodeValue("Projection", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
.setDisplay(VALUE_DISPLAY.enum_button, [ "Perspective", "Orthographic" ])
.setVisible(false, false);
inputs[| 2] = nodeValue("FOV", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 30)
.setDisplay(VALUE_DISPLAY.slider, { range: [ 0, 90, 1 ] });
inputs[| 3] = nodeValue("Ortho Scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 5.)
inputs[| 4] = nodeValue("View Range", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 3, 6 ])
.setDisplay(VALUE_DISPLAY.vector);
inputs[| 5] = nodeValue("Depth", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0)
.setDisplay(VALUE_DISPLAY.slider);
inputs[| 6] = nodeValue("Draw BG", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true);
inputs[| 7] = nodeValue("Background", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_black);
inputs[| 8] = nodeValue("Ambient Level", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.2)
.setDisplay(VALUE_DISPLAY.slider);
inputs[| 9] = nodeValue("Light Position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ -.5, -.5, 1 ])
.setDisplay(VALUE_DISPLAY.vector);
inputs[| 10] = nodeValue("Environment", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, false);
inputs[| 11] = nodeValue("Camera Rotation", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 30, 45, 0 ])
.setDisplay(VALUE_DISPLAY.vector);
inputs[| 12] = nodeValue("Camera Scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1)
.setDisplay(VALUE_DISPLAY.slider, { range: [ 0, 4, 0.01 ] });
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
inputs[| 13] = nodeValue("SDF Object", self, JUNCTION_CONNECT.input, VALUE_TYPE.sdf, {})
.setVisible(true, true);
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
outputs[| 0] = nodeValue("Surface Out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
input_display_list = [ 0, 13,
["Camera", false], 11, 12, 1, 2, 3, 4, 5,
["Render", false], 6, 7, 8, 10, 9,
]
temp_surface = [ 0, 0 ];
environ = new RM_Environment();
object = noone;
static drawOverlay3D = function(active, params, _mx, _my, _snx, _sny, _panel) {}
static processData = function(_outSurf, _data, _output_index, _array_index = 0) {
var _dim = _data[0];
var _pro = _data[1];
var _fov = _data[2];
var _ort = _data[3];
var _vrn = _data[4];
var _dep = _data[5];
var _bgd = _data[6];
var _enc = _data[7];
var _amb = _data[8];
var _lig = _data[9];
var _env = _data[10];
var _crt = _data[11];
var _csa = _data[12];
var _shp = _data[13];
if(!is_instanceof(_shp, RM_Object)) return _outSurf;
_outSurf = surface_verify(_outSurf, _dim[0], _dim[1]);
for (var i = 0, n = array_length(temp_surface); i < n; i++)
temp_surface[i] = surface_verify(temp_surface[i], 8192, 8192);
var tx = 1024;
surface_set_shader(temp_surface[0]);
draw_surface_stretched_safe(_env, tx * 0, tx * 0, tx, tx);
surface_reset_shader();
object = _shp;
object.flatten();
object.setTexture(temp_surface[1]);
environ.surface = temp_surface[0];
environ.bgEnv = _env;
environ.projection = _ort;
environ.fov = _fov;
environ.orthoScale = _ort;
environ.viewRange = _vrn;
environ.depthInt = _dep;
environ.bgColor = _enc;
environ.bgDraw = _bgd;
environ.ambInten = _amb;
environ.light = _lig;
gpu_set_texfilter(true);
surface_set_shader(_outSurf, sh_rm_primitive);
shader_set_f("camRotation", _crt);
shader_set_f("camScale", _csa);
shader_set_f("camRatio", _dim[0] / _dim[1]);
environ.apply();
object.apply();
draw_sprite_stretched(s_fx_pixel, 0, 0, 0, _dim[0], _dim[1]);
surface_reset_shader();
gpu_set_texfilter(false);
return _outSurf;
}
}

View file

@ -0,0 +1,13 @@
{
"$GMScript":"",
"%Name":"node_rm_render",
"isCompatibility":false,
"isDnD":false,
"name":"node_rm_render",
"parent":{
"name":"raymarching",
"path":"folders/nodes/data/3D/raymarching.yy",
},
"resourceType":"GMScript",
"resourceVersion":"2.0",
}

View file

@ -55,8 +55,12 @@ uniform vec3 position[MAX_SHAPES] ;
uniform vec3 rotation[MAX_SHAPES] ;
uniform float objectScale[MAX_SHAPES] ;
uniform int tileActive[MAX_SHAPES] ;
uniform vec3 tileSize[MAX_SHAPES] ;
uniform vec3 tileAmount[MAX_SHAPES] ;
uniform vec3 tileShiftPos[MAX_SHAPES] ;
uniform vec3 tileShiftRot[MAX_SHAPES] ;
uniform float tileShiftSca[MAX_SHAPES] ;
uniform vec4 diffuseColor[MAX_SHAPES] ;
uniform float reflective[MAX_SHAPES] ;
@ -139,6 +143,11 @@ float influences[MAX_SHAPES];
#region ////============= Util ==============
float random (in vec3 st) { return fract(sin(dot(st + vec3(1.0534, 0.453, 1.678), vec3(12.9898, 78.233, 63.1076))) * 43758.5453123); }
float round(float v) { return fract(v) >= 0.5? ceil(v) : floor(v); }
vec3 round(vec3 v) { return vec3(round(v.x), round(v.y), round(v.z)); }
float dot2( in vec2 v ) { return dot(v,v); }
float dot2( in vec3 v ) { return dot(v,v); }
float ndot( in vec2 a, in vec2 b ) { return a.x*b.x - a.y*b.y; }
@ -195,6 +204,15 @@ float influences[MAX_SHAPES];
p.y += clamp( -p.y, 0.0, r * acs.y);
return length(p) * sign(p.x);
}
float sdPie( in vec2 p, in float angle, in float r ) {
vec2 c = vec2(sin(angle), cos(angle));
p.x = abs(p.x);
float l = length(p) - r;
float m = length(p - c * clamp(dot(p, c), 0.0, r)); // c=sin/cos of aperture
return max(l, m * sign(c.y * p.x - c.x * p.y));
}
#endregion
@ -441,14 +459,17 @@ float influences[MAX_SHAPES];
#region ////=========== View Mod ============
float round(float v) { return fract(v) >= 0.5? ceil(v) : floor(v); }
vec3 round(vec3 v) { return vec3(round(v.x), round(v.y), round(v.z)); }
vec3 tilePosition(vec3 amount, vec3 size, vec3 p) {
if(amount == vec3(0.))
return p - size * round(p / size);
return p - size * clamp(round(p / size), -amount, amount);
}
vec3 tileIndex(vec3 amount, vec3 size, vec3 p) {
if(amount == vec3(0.))
return size * round(p / size);
return size * clamp(round(p / size), -amount, amount);
}
#endregion
@ -479,14 +500,32 @@ float sceneSDF(int index, vec3 p) {
mat3 rotMatrix = rx * ry * rz;
mat3 irotMatrix = inverse(rotMatrix);
p /= objectScale[index];
float sca = objectScale[index];
p /= sca;
p -= position[index];
p = irotMatrix * p;
p = wave(waveAmp[index], waveShift[index], waveInt[index], p);
if(tileSize[index] != vec3(0.))
if(tileActive[index] == 1) {
p = tilePosition(tileAmount[index], tileSize[index], p);
vec3 tindex = tileIndex(tileAmount[index], tileSize[index], p);
vec3 tpos = tileShiftPos[index] * random(tindex + vec3(1., 0., 0.));
vec3 trot = tileShiftRot[index] * random(tindex + vec3(0., 1., 0.));
float tsca = 1. + tileShiftSca[index] * (random(tindex + vec3(0., 0., 1.)) * 2. - 1.);
mat3 trx = rotateX(trot.x);
mat3 try = rotateY(trot.y);
mat3 trz = rotateZ(trot.z);
mat3 trotMatrix = rx * ry * rz;
mat3 tirotMatrix = inverse(rotMatrix);
sca *= tsca;
p /= tsca;
p -= tpos;
p = tirotMatrix * p;
}
p = twist(twistAmount[index], twistAxis[index], p);
@ -518,6 +557,7 @@ float sceneSDF(int index, vec3 p) {
else if(shp == 304) d = sdRoundCone( p, height[index], radRange[index].x, radRange[index].y);
else if(shp == 305) d = sdSolidAngle( p, angle[index], radius[index]);
else if(shp == 306) d = opExtrusion( p, thickness[index], sdRegularPolygon(p.xy, 0.5, sides[index]));
else if(shp == 307) d = opExtrusion( p, thickness[index], sdPie(p.xy, angle[index], radius[index]));
else if(shp == 400) d = sdOctahedron( p, sizeUni[index]);
else if(shp == 401) d = sdPyramid( p, sizeUni[index]);
@ -527,7 +567,7 @@ float sceneSDF(int index, vec3 p) {
}
d -= rounded[index];
d *= objectScale[index];
d *= sca;
return d;
}

View file

@ -25,8 +25,8 @@
"nineSlice":null,
"origin":4,
"parent":{
"name":"generator",
"path":"folders/nodes/icons/generator.yy",
"name":"3D",
"path":"folders/nodes/icons/3D.yy",
},
"preMultiplyAlpha":false,
"resourceType":"GMSprite",

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

View file

@ -0,0 +1,90 @@
{
"$GMSprite":"",
"%Name":"s_node_rm_render",
"bboxMode":0,
"bbox_bottom":61,
"bbox_left":2,
"bbox_right":61,
"bbox_top":3,
"collisionKind":1,
"collisionTolerance":0,
"DynamicTexturePage":false,
"edgeFiltering":false,
"For3D":false,
"frames":[
{"$GMSpriteFrame":"","%Name":"8e70ad5d-8086-4e16-9ce9-9fb639bf4d03","name":"8e70ad5d-8086-4e16-9ce9-9fb639bf4d03","resourceType":"GMSpriteFrame","resourceVersion":"2.0",},
],
"gridX":0,
"gridY":0,
"height":64,
"HTile":false,
"layers":[
{"$GMImageLayer":"","%Name":"78594f6d-4719-43bc-a592-784fd0a6648a","blendMode":0,"displayName":"default","isLocked":false,"name":"78594f6d-4719-43bc-a592-784fd0a6648a","opacity":100.0,"resourceType":"GMImageLayer","resourceVersion":"2.0","visible":true,},
],
"name":"s_node_rm_render",
"nineSlice":null,
"origin":4,
"parent":{
"name":"3D",
"path":"folders/nodes/icons/3D.yy",
},
"preMultiplyAlpha":false,
"resourceType":"GMSprite",
"resourceVersion":"2.0",
"sequence":{
"$GMSequence":"",
"%Name":"s_node_rm_render",
"autoRecord":true,
"backdropHeight":768,
"backdropImageOpacity":0.5,
"backdropImagePath":"",
"backdropWidth":1366,
"backdropXOffset":0.0,
"backdropYOffset":0.0,
"events":{
"$KeyframeStore<MessageEventKeyframe>":"",
"Keyframes":[],
"resourceType":"KeyframeStore<MessageEventKeyframe>",
"resourceVersion":"2.0",
},
"eventStubScript":null,
"eventToFunction":{},
"length":1.0,
"lockOrigin":false,
"moments":{
"$KeyframeStore<MomentsEventKeyframe>":"",
"Keyframes":[],
"resourceType":"KeyframeStore<MomentsEventKeyframe>",
"resourceVersion":"2.0",
},
"name":"s_node_rm_render",
"playback":1,
"playbackSpeed":30.0,
"playbackSpeedType":0,
"resourceType":"GMSequence",
"resourceVersion":"2.0",
"showBackdrop":true,
"showBackdropImage":false,
"timeUnits":1,
"tracks":[
{"$GMSpriteFramesTrack":"","builtinName":0,"events":[],"inheritsTrackColour":true,"interpolation":1,"isCreationTrack":false,"keyframes":{"$KeyframeStore<SpriteFrameKeyframe>":"","Keyframes":[
{"$Keyframe<SpriteFrameKeyframe>":"","Channels":{
"0":{"$SpriteFrameKeyframe":"","Id":{"name":"8e70ad5d-8086-4e16-9ce9-9fb639bf4d03","path":"sprites/s_node_rm_render/s_node_rm_render.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},
},"Disabled":false,"id":"7270a421-8102-416f-b4b5-ee8150b99f48","IsCreationKey":false,"Key":0.0,"Length":1.0,"resourceType":"Keyframe<SpriteFrameKeyframe>","resourceVersion":"2.0","Stretch":false,},
],"resourceType":"KeyframeStore<SpriteFrameKeyframe>","resourceVersion":"2.0",},"modifiers":[],"name":"frames","resourceType":"GMSpriteFramesTrack","resourceVersion":"2.0","spriteId":null,"trackColour":0,"tracks":[],"traits":0,},
],
"visibleRange":null,
"volume":1.0,
"xorigin":32,
"yorigin":32,
},
"swatchColours":null,
"swfPrecision":0.5,
"textureGroupId":{
"name":"Default",
"path":"texturegroups/Default",
},
"type":0,
"VTile":false,
"width":64,
}

View file

@ -25,8 +25,8 @@
"nineSlice":null,
"origin":4,
"parent":{
"name":"generator",
"path":"folders/nodes/icons/generator.yy",
"name":"3D",
"path":"folders/nodes/icons/3D.yy",
},
"preMultiplyAlpha":false,
"resourceType":"GMSprite",

Binary file not shown.

After

Width:  |  Height:  |  Size: 589 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 589 B

View file

@ -29,6 +29,7 @@
{"$GMSpriteFrame":"","%Name":"8f00908e-92e2-474b-9d0c-8b2fb8dba4ff","name":"8f00908e-92e2-474b-9d0c-8b2fb8dba4ff","resourceType":"GMSpriteFrame","resourceVersion":"2.0",},
{"$GMSpriteFrame":"","%Name":"16bfc80e-e29e-4d4e-85bc-db11d8be1e35","name":"16bfc80e-e29e-4d4e-85bc-db11d8be1e35","resourceType":"GMSpriteFrame","resourceVersion":"2.0",},
{"$GMSpriteFrame":"","%Name":"53ff437f-736a-41e3-b500-bc9e840439d0","name":"53ff437f-736a-41e3-b500-bc9e840439d0","resourceType":"GMSpriteFrame","resourceVersion":"2.0",},
{"$GMSpriteFrame":"","%Name":"b6d037cd-b094-444f-aeb3-fff264ec3ba7","name":"b6d037cd-b094-444f-aeb3-fff264ec3ba7","resourceType":"GMSpriteFrame","resourceVersion":"2.0",},
{"$GMSpriteFrame":"","%Name":"0da22937-fff4-452f-a8d6-3e8b57726d6e","name":"0da22937-fff4-452f-a8d6-3e8b57726d6e","resourceType":"GMSpriteFrame","resourceVersion":"2.0",},
{"$GMSpriteFrame":"","%Name":"1c600a42-babc-45aa-ba0b-00dad6ef1e04","name":"1c600a42-babc-45aa-ba0b-00dad6ef1e04","resourceType":"GMSpriteFrame","resourceVersion":"2.0",},
],
@ -67,7 +68,7 @@
},
"eventStubScript":null,
"eventToFunction":{},
"length":19.0,
"length":20.0,
"lockOrigin":false,
"moments":{
"$KeyframeStore<MomentsEventKeyframe>":"",
@ -137,12 +138,15 @@
{"$Keyframe<SpriteFrameKeyframe>":"","Channels":{
"0":{"$SpriteFrameKeyframe":"","Id":{"name":"53ff437f-736a-41e3-b500-bc9e840439d0","path":"sprites/s_node_shape_3d/s_node_shape_3d.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},
},"Disabled":false,"id":"36d7040b-a1cc-4ce4-935a-805894d9d303","IsCreationKey":false,"Key":16.0,"Length":1.0,"resourceType":"Keyframe<SpriteFrameKeyframe>","resourceVersion":"2.0","Stretch":false,},
{"$Keyframe<SpriteFrameKeyframe>":"","Channels":{
"0":{"$SpriteFrameKeyframe":"","Id":{"name":"b6d037cd-b094-444f-aeb3-fff264ec3ba7","path":"sprites/s_node_shape_3d/s_node_shape_3d.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},
},"Disabled":false,"id":"3edb5428-3145-4bb1-ad6b-8a2f74b1a331","IsCreationKey":false,"Key":17.0,"Length":1.0,"resourceType":"Keyframe<SpriteFrameKeyframe>","resourceVersion":"2.0","Stretch":false,},
{"$Keyframe<SpriteFrameKeyframe>":"","Channels":{
"0":{"$SpriteFrameKeyframe":"","Id":{"name":"0da22937-fff4-452f-a8d6-3e8b57726d6e","path":"sprites/s_node_shape_3d/s_node_shape_3d.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},
},"Disabled":false,"id":"b6642d24-2c86-4b2b-bceb-5d9f6a4c287c","IsCreationKey":false,"Key":17.0,"Length":1.0,"resourceType":"Keyframe<SpriteFrameKeyframe>","resourceVersion":"2.0","Stretch":false,},
},"Disabled":false,"id":"b6642d24-2c86-4b2b-bceb-5d9f6a4c287c","IsCreationKey":false,"Key":18.0,"Length":1.0,"resourceType":"Keyframe<SpriteFrameKeyframe>","resourceVersion":"2.0","Stretch":false,},
{"$Keyframe<SpriteFrameKeyframe>":"","Channels":{
"0":{"$SpriteFrameKeyframe":"","Id":{"name":"1c600a42-babc-45aa-ba0b-00dad6ef1e04","path":"sprites/s_node_shape_3d/s_node_shape_3d.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},
},"Disabled":false,"id":"14b14ac0-8cf2-4f3f-aa4f-441b9aec23d8","IsCreationKey":false,"Key":18.0,"Length":1.0,"resourceType":"Keyframe<SpriteFrameKeyframe>","resourceVersion":"2.0","Stretch":false,},
},"Disabled":false,"id":"14b14ac0-8cf2-4f3f-aa4f-441b9aec23d8","IsCreationKey":false,"Key":19.0,"Length":1.0,"resourceType":"Keyframe<SpriteFrameKeyframe>","resourceVersion":"2.0","Stretch":false,},
],"resourceType":"KeyframeStore<SpriteFrameKeyframe>","resourceVersion":"2.0",},"modifiers":[],"name":"frames","resourceType":"GMSpriteFramesTrack","resourceVersion":"2.0","spriteId":null,"trackColour":0,"tracks":[],"traits":0,},
],
"visibleRange":null,