ray march primitive

This commit is contained in:
Tanasart 2024-05-28 16:03:33 +07:00
parent 0b5fb449df
commit 542e9da47d
8 changed files with 111 additions and 11 deletions

View file

@ -1896,6 +1896,7 @@
{"name":"s_node_rigidSim_render_output","order":10,"path":"sprites/s_node_rigidSim_render_output/s_node_rigidSim_render_output.yy",},
{"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_primitive","order":51,"path":"sprites/s_node_rm_primitive/s_node_rm_primitive.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

@ -2470,6 +2470,7 @@
{"id":{"name":"s_node_rigidSim_renderer","path":"sprites/s_node_rigidSim_renderer/s_node_rigidSim_renderer.yy",},},
{"id":{"name":"s_node_rigidSim_wall","path":"sprites/s_node_rigidSim_wall/s_node_rigidSim_wall.yy",},},
{"id":{"name":"s_node_rigidSim","path":"sprites/s_node_rigidSim/s_node_rigidSim.yy",},},
{"id":{"name":"s_node_rm_primitive","path":"sprites/s_node_rm_primitive/s_node_rm_primitive.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",},},
{"id":{"name":"s_node_scale","path":"sprites/s_node_scale/s_node_scale.yy",},},

View file

@ -752,7 +752,7 @@ function __initNodes() {
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 March");
/**/addNodeObject(generator, "RM Primitive", s_node_mk_rain, "Node_RM_Primitive", [1, Node_RM_Primitive]).setVersion(11720);
addNodeObject(generator, "RM Primitive", s_node_rm_primitive, "Node_RM_Primitive", [1, Node_RM_Primitive]).setVersion(11720);
ds_list_add(generator, "MK Effects");
addNodeObject(generator, "MK Rain", s_node_mk_rain, "Node_MK_Rain", [1, Node_MK_Rain]).setVersion(11600);

View file

@ -110,6 +110,9 @@ function Node_RM_Primitive(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
inputs[| 29] = nodeValue("Tile Amount", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0 ])
.setDisplay(VALUE_DISPLAY.vector);
outputs[| 0] = nodeValue("Surface Out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
input_display_list = [ 0,
@ -118,7 +121,8 @@ function Node_RM_Primitive(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro
["Deform", true], 15, 16, 17, 18, 19,
["Transform", false], 3, 4,
["Camera", false], 13, 14, 5, 6,
["Render", false], 7, 9, 10, 8, 20,
["Render", false], 7, 9, 10, 8, 20, 29,
["Tile", false], 20, 29,
];
static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) {}
@ -246,6 +250,7 @@ function Node_RM_Primitive(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro
var _heig = _data[26];
var _radR = _data[27];
var _sizz = _data[28];
var _tilA = _data[29];
_outSurf = surface_verify(_outSurf, _dim[0], _dim[1]);
@ -273,12 +278,13 @@ function Node_RM_Primitive(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro
shader_set_f("rotation", _rot);
shader_set_f("objectScale", _sca);
shader_set_i("ortho", _ort);
shader_set_f("fov", _fov);
shader_set_f("orthoScale",_ortS);
shader_set_f("viewRange", _rng);
shader_set_f("depthInt", _dpi);
shader_set_f("tileSize", _tile);
shader_set_i("ortho", _ort);
shader_set_f("fov", _fov);
shader_set_f("orthoScale", _ortS);
shader_set_f("viewRange", _rng);
shader_set_f("depthInt", _dpi);
shader_set_f("tileSize", _tile);
shader_set_f("tileAmount", _tilA);
shader_set_color("ambient", _amb);
shader_set_f("ambientIntns", _ambI);
@ -289,4 +295,4 @@ function Node_RM_Primitive(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro
return _outSurf;
}
}
}

View file

@ -36,6 +36,7 @@ uniform float orthoScale;
uniform vec2 viewRange;
uniform float depthInt;
uniform vec3 tileSize;
uniform vec3 tileAmount;
uniform vec4 ambient;
uniform float ambientIntns;
@ -313,8 +314,9 @@ uniform vec3 lightPosition;
vec3 round(vec3 v) { return vec3(round(v.x), round(v.y), round(v.z)); }
vec3 tilePosition(vec3 p) {
vec3 q = p - tileSize * round(p / tileSize);
return q;
if(tileAmount == vec3(0.))
return p - tileSize * round(p / tileSize);
return p - tileSize * clamp(round(p / tileSize), -tileAmount, tileAmount);
}
#endregion

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

View file

@ -0,0 +1,90 @@
{
"$GMSprite":"",
"%Name":"s_node_rm_primitive",
"bboxMode":0,
"bbox_bottom":61,
"bbox_left":3,
"bbox_right":61,
"bbox_top":3,
"collisionKind":1,
"collisionTolerance":0,
"DynamicTexturePage":false,
"edgeFiltering":false,
"For3D":false,
"frames":[
{"$GMSpriteFrame":"","%Name":"ce9d62bd-3878-41e3-b28e-0325c98d8a73","name":"ce9d62bd-3878-41e3-b28e-0325c98d8a73","resourceType":"GMSpriteFrame","resourceVersion":"2.0",},
],
"gridX":0,
"gridY":0,
"height":64,
"HTile":false,
"layers":[
{"$GMImageLayer":"","%Name":"e4b2e1fb-aa71-423e-b4ac-9a9e83f702fa","blendMode":0,"displayName":"default","isLocked":false,"name":"e4b2e1fb-aa71-423e-b4ac-9a9e83f702fa","opacity":100.0,"resourceType":"GMImageLayer","resourceVersion":"2.0","visible":true,},
],
"name":"s_node_rm_primitive",
"nineSlice":null,
"origin":4,
"parent":{
"name":"generator",
"path":"folders/nodes/icons/generator.yy",
},
"preMultiplyAlpha":false,
"resourceType":"GMSprite",
"resourceVersion":"2.0",
"sequence":{
"$GMSequence":"",
"%Name":"s_node_rm_primitive",
"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_primitive",
"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":"ce9d62bd-3878-41e3-b28e-0325c98d8a73","path":"sprites/s_node_rm_primitive/s_node_rm_primitive.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},
},"Disabled":false,"id":"df2b1365-2924-4580-83f6-e78b42c66e83","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,
}