diff --git a/PixelComposer.resource_order b/PixelComposer.resource_order index 22698d394..f4fe0418f 100644 --- a/PixelComposer.resource_order +++ b/PixelComposer.resource_order @@ -20,7 +20,6 @@ {"name":"camera","order":7,"path":"folders/functions/3d/camera.yy",}, {"name":"gizmo","order":8,"path":"folders/functions/3d/gizmo.yy",}, {"name":"light","order":9,"path":"folders/functions/3d/light.yy",}, - {"name":"mesh","order":10,"path":"folders/functions/3d/mesh.yy",}, {"name":"util","order":11,"path":"folders/functions/3d/util.yy",}, {"name":"dynaSurf","order":20,"path":"folders/functions/draw/dynaSurf.yy",}, {"name":"API","order":5,"path":"folders/functions/smokesim/API.yy",}, @@ -42,6 +41,7 @@ {"name":"d3d_compose","order":3,"path":"folders/nodes/data/3D/d3d_compose.yy",}, {"name":"d3d_light","order":4,"path":"folders/nodes/data/3D/d3d_light.yy",}, {"name":"d3d_mesh","order":5,"path":"folders/nodes/data/3D/d3d_mesh.yy",}, + {"name":"mesh","order":11,"path":"folders/nodes/data/3D/d3d_mesh/mesh.yy",}, {"name":"d3d_modifier","order":6,"path":"folders/nodes/data/3D/d3d_modifier.yy",}, {"name":"d3d_particle","order":7,"path":"folders/nodes/data/3D/d3d_particle.yy",}, {"name":"raymarching","order":13,"path":"folders/nodes/data/3D/raymarching.yy",}, @@ -502,6 +502,7 @@ {"name":"d3d_scene","order":2,"path":"scripts/d3d_scene/d3d_scene.yy",}, {"name":"d3d_surface_extrude","order":7,"path":"scripts/d3d_surface_extrude/d3d_surface_extrude.yy",}, {"name":"d3d_terrain","order":8,"path":"scripts/d3d_terrain/d3d_terrain.yy",}, + {"name":"d3d_torus","order":11,"path":"scripts/d3d_torus/d3d_torus.yy",}, {"name":"d3d_transformation","order":12,"path":"scripts/d3d_transformation/d3d_transformation.yy",}, {"name":"d3d_uvsphere","order":3,"path":"scripts/d3d_uvsphere/d3d_uvsphere.yy",}, {"name":"d3d_vertex","order":10,"path":"scripts/d3d_vertex/d3d_vertex.yy",}, @@ -698,6 +699,7 @@ {"name":"node_3d_mesh_sphere_uv","order":4,"path":"scripts/node_3d_mesh_sphere_uv/node_3d_mesh_sphere_uv.yy",}, {"name":"node_3d_mesh_stack_slice","order":7,"path":"scripts/node_3d_mesh_stack_slice/node_3d_mesh_stack_slice.yy",}, {"name":"node_3d_mesh_terrain","order":9,"path":"scripts/node_3d_mesh_terrain/node_3d_mesh_terrain.yy",}, + {"name":"node_3d_mesh_torus","order":12,"path":"scripts/node_3d_mesh_torus/node_3d_mesh_torus.yy",}, {"name":"node_3d_point_affector","order":11,"path":"scripts/node_3d_point_affector/node_3d_point_affector.yy",}, {"name":"node_3d_repeat","order":1,"path":"scripts/node_3d_repeat/node_3d_repeat.yy",}, {"name":"node_3d_round_vertex","order":1,"path":"scripts/node_3d_round_vertex/node_3d_round_vertex.yy",}, @@ -2033,6 +2035,7 @@ {"name":"s_node_3d_sphere_uv","order":16,"path":"sprites/s_node_3d_sphere_uv/s_node_3d_sphere_uv.yy",}, {"name":"s_node_3d_sphere","order":8,"path":"sprites/s_node_3d_sphere/s_node_3d_sphere.yy",}, {"name":"s_node_3d_stack_slice","order":32,"path":"sprites/s_node_3d_stack_slice/s_node_3d_stack_slice.yy",}, + {"name":"s_node_3d_torus","order":35,"path":"sprites/s_node_3d_torus/s_node_3d_torus.yy",}, {"name":"s_node_3d_transform_scene","order":22,"path":"sprites/s_node_3d_transform_scene/s_node_3d_transform_scene.yy",}, {"name":"s_node_3d_transform","order":4,"path":"sprites/s_node_3d_transform/s_node_3d_transform.yy",}, {"name":"s_node_ace","order":61,"path":"sprites/s_node_ace/s_node_ace.yy",}, diff --git a/PixelComposer.yyp b/PixelComposer.yyp index 376908389..e5987d2f5 100644 --- a/PixelComposer.yyp +++ b/PixelComposer.yyp @@ -56,7 +56,6 @@ {"$GMFolder":"","%Name":"camera","folderPath":"folders/functions/3d/camera.yy","name":"camera","resourceType":"GMFolder","resourceVersion":"2.0",}, {"$GMFolder":"","%Name":"gizmo","folderPath":"folders/functions/3d/gizmo.yy","name":"gizmo","resourceType":"GMFolder","resourceVersion":"2.0",}, {"$GMFolder":"","%Name":"light","folderPath":"folders/functions/3d/light.yy","name":"light","resourceType":"GMFolder","resourceVersion":"2.0",}, - {"$GMFolder":"","%Name":"mesh","folderPath":"folders/functions/3d/mesh.yy","name":"mesh","resourceType":"GMFolder","resourceVersion":"2.0",}, {"$GMFolder":"","%Name":"util","folderPath":"folders/functions/3d/util.yy","name":"util","resourceType":"GMFolder","resourceVersion":"2.0",}, {"$GMFolder":"","%Name":"action","folderPath":"folders/functions/action.yy","name":"action","resourceType":"GMFolder","resourceVersion":"2.0",}, {"$GMFolder":"","%Name":"animation","folderPath":"folders/functions/animation.yy","name":"animation","resourceType":"GMFolder","resourceVersion":"2.0",}, @@ -130,6 +129,7 @@ {"$GMFolder":"","%Name":"d3d_compose","folderPath":"folders/nodes/data/3D/d3d_compose.yy","name":"d3d_compose","resourceType":"GMFolder","resourceVersion":"2.0",}, {"$GMFolder":"","%Name":"d3d_light","folderPath":"folders/nodes/data/3D/d3d_light.yy","name":"d3d_light","resourceType":"GMFolder","resourceVersion":"2.0",}, {"$GMFolder":"","%Name":"d3d_mesh","folderPath":"folders/nodes/data/3D/d3d_mesh.yy","name":"d3d_mesh","resourceType":"GMFolder","resourceVersion":"2.0",}, + {"$GMFolder":"","%Name":"mesh","folderPath":"folders/nodes/data/3D/d3d_mesh/mesh.yy","name":"mesh","resourceType":"GMFolder","resourceVersion":"2.0",}, {"$GMFolder":"","%Name":"d3d_modifier","folderPath":"folders/nodes/data/3D/d3d_modifier.yy","name":"d3d_modifier","resourceType":"GMFolder","resourceVersion":"2.0",}, {"$GMFolder":"","%Name":"d3d_particle","folderPath":"folders/nodes/data/3D/d3d_particle.yy","name":"d3d_particle","resourceType":"GMFolder","resourceVersion":"2.0",}, {"$GMFolder":"","%Name":"raymarching","folderPath":"folders/nodes/data/3D/raymarching.yy","name":"raymarching","resourceType":"GMFolder","resourceVersion":"2.0",}, @@ -1013,6 +1013,7 @@ {"id":{"name":"d3d_scene","path":"scripts/d3d_scene/d3d_scene.yy",},}, {"id":{"name":"d3d_surface_extrude","path":"scripts/d3d_surface_extrude/d3d_surface_extrude.yy",},}, {"id":{"name":"d3d_terrain","path":"scripts/d3d_terrain/d3d_terrain.yy",},}, + {"id":{"name":"d3d_torus","path":"scripts/d3d_torus/d3d_torus.yy",},}, {"id":{"name":"d3d_transformation","path":"scripts/d3d_transformation/d3d_transformation.yy",},}, {"id":{"name":"d3d_uvsphere","path":"scripts/d3d_uvsphere/d3d_uvsphere.yy",},}, {"id":{"name":"d3d_vertex","path":"scripts/d3d_vertex/d3d_vertex.yy",},}, @@ -1240,6 +1241,7 @@ {"id":{"name":"node_3d_mesh_sphere_uv","path":"scripts/node_3d_mesh_sphere_uv/node_3d_mesh_sphere_uv.yy",},}, {"id":{"name":"node_3d_mesh_stack_slice","path":"scripts/node_3d_mesh_stack_slice/node_3d_mesh_stack_slice.yy",},}, {"id":{"name":"node_3d_mesh_terrain","path":"scripts/node_3d_mesh_terrain/node_3d_mesh_terrain.yy",},}, + {"id":{"name":"node_3d_mesh_torus","path":"scripts/node_3d_mesh_torus/node_3d_mesh_torus.yy",},}, {"id":{"name":"node_3d_particle","path":"scripts/node_3d_particle/node_3d_particle.yy",},}, {"id":{"name":"node_3d_point_affector","path":"scripts/node_3d_point_affector/node_3d_point_affector.yy",},}, {"id":{"name":"node_3d_repeat","path":"scripts/node_3d_repeat/node_3d_repeat.yy",},}, @@ -2748,6 +2750,7 @@ {"id":{"name":"s_node_3d_sphere_uv","path":"sprites/s_node_3d_sphere_uv/s_node_3d_sphere_uv.yy",},}, {"id":{"name":"s_node_3d_sphere","path":"sprites/s_node_3d_sphere/s_node_3d_sphere.yy",},}, {"id":{"name":"s_node_3d_stack_slice","path":"sprites/s_node_3d_stack_slice/s_node_3d_stack_slice.yy",},}, + {"id":{"name":"s_node_3d_torus","path":"sprites/s_node_3d_torus/s_node_3d_torus.yy",},}, {"id":{"name":"s_node_3d_transform_scene","path":"sprites/s_node_3d_transform_scene/s_node_3d_transform_scene.yy",},}, {"id":{"name":"s_node_3d_transform","path":"sprites/s_node_3d_transform/s_node_3d_transform.yy",},}, {"id":{"name":"s_node_9patch","path":"sprites/s_node_9patch/s_node_9patch.yy",},}, diff --git a/scripts/d3d_cone/d3d_cone.yy b/scripts/d3d_cone/d3d_cone.yy index 8f0bc2b0f..ca0c62360 100644 --- a/scripts/d3d_cone/d3d_cone.yy +++ b/scripts/d3d_cone/d3d_cone.yy @@ -6,7 +6,7 @@ "name":"d3d_cone", "parent":{ "name":"mesh", - "path":"folders/functions/3d/mesh.yy", + "path":"folders/nodes/data/3D/d3d_mesh/mesh.yy", }, "resourceType":"GMScript", "resourceVersion":"2.0", diff --git a/scripts/d3d_cube/d3d_cube.yy b/scripts/d3d_cube/d3d_cube.yy index 6d055d248..64b3211d4 100644 --- a/scripts/d3d_cube/d3d_cube.yy +++ b/scripts/d3d_cube/d3d_cube.yy @@ -6,7 +6,7 @@ "name":"d3d_cube", "parent":{ "name":"mesh", - "path":"folders/functions/3d/mesh.yy", + "path":"folders/nodes/data/3D/d3d_mesh/mesh.yy", }, "resourceType":"GMScript", "resourceVersion":"2.0", diff --git a/scripts/d3d_cube_faces/d3d_cube_faces.yy b/scripts/d3d_cube_faces/d3d_cube_faces.yy index 09fecd0e5..7b82d3fc5 100644 --- a/scripts/d3d_cube_faces/d3d_cube_faces.yy +++ b/scripts/d3d_cube_faces/d3d_cube_faces.yy @@ -6,7 +6,7 @@ "name":"d3d_cube_faces", "parent":{ "name":"mesh", - "path":"folders/functions/3d/mesh.yy", + "path":"folders/nodes/data/3D/d3d_mesh/mesh.yy", }, "resourceType":"GMScript", "resourceVersion":"2.0", diff --git a/scripts/d3d_cylinder/d3d_cylinder.yy b/scripts/d3d_cylinder/d3d_cylinder.yy index 0a7a57496..fb9a126c0 100644 --- a/scripts/d3d_cylinder/d3d_cylinder.yy +++ b/scripts/d3d_cylinder/d3d_cylinder.yy @@ -6,7 +6,7 @@ "name":"d3d_cylinder", "parent":{ "name":"mesh", - "path":"folders/functions/3d/mesh.yy", + "path":"folders/nodes/data/3D/d3d_mesh/mesh.yy", }, "resourceType":"GMScript", "resourceVersion":"2.0", diff --git a/scripts/d3d_cylinder_nocaps/d3d_cylinder_nocaps.yy b/scripts/d3d_cylinder_nocaps/d3d_cylinder_nocaps.yy index 1c896bdda..1cf74cce8 100644 --- a/scripts/d3d_cylinder_nocaps/d3d_cylinder_nocaps.yy +++ b/scripts/d3d_cylinder_nocaps/d3d_cylinder_nocaps.yy @@ -6,7 +6,7 @@ "name":"d3d_cylinder_nocaps", "parent":{ "name":"mesh", - "path":"folders/functions/3d/mesh.yy", + "path":"folders/nodes/data/3D/d3d_mesh/mesh.yy", }, "resourceType":"GMScript", "resourceVersion":"2.0", diff --git a/scripts/d3d_icosphere/d3d_icosphere.yy b/scripts/d3d_icosphere/d3d_icosphere.yy index 37dafb07a..814feabf6 100644 --- a/scripts/d3d_icosphere/d3d_icosphere.yy +++ b/scripts/d3d_icosphere/d3d_icosphere.yy @@ -6,7 +6,7 @@ "name":"d3d_icosphere", "parent":{ "name":"mesh", - "path":"folders/functions/3d/mesh.yy", + "path":"folders/nodes/data/3D/d3d_mesh/mesh.yy", }, "resourceType":"GMScript", "resourceVersion":"2.0", diff --git a/scripts/d3d_material/d3d_material.gml b/scripts/d3d_material/d3d_material.gml index a5e0f17e0..d3f9eae71 100644 --- a/scripts/d3d_material/d3d_material.gml +++ b/scripts/d3d_material/d3d_material.gml @@ -5,6 +5,8 @@ function __d3dMaterial(surface = noone) constructor { specular = 0; metalic = false; shine = 1; + texScale = [ 1, 1 ]; + texShift = [ 0, 0 ]; normal = noone; normalStr = 1; @@ -28,6 +30,8 @@ function __d3dMaterial(surface = noone) constructor { shader_set_f("mat_specular", specular ); shader_set_f("mat_shine", shine ); shader_set_i("mat_metalic", metalic ); + shader_set_f("mat_texScale", texScale ); + shader_set_f("mat_texShift", texShift ); shader_set_f("mat_reflective", reflective); gpu_set_tex_filter(texFilter); diff --git a/scripts/d3d_object/d3d_object.gml b/scripts/d3d_object/d3d_object.gml index 3737bcdca..c3c7a12f1 100644 --- a/scripts/d3d_object/d3d_object.gml +++ b/scripts/d3d_object/d3d_object.gml @@ -174,14 +174,13 @@ function __3dObject() constructor { shader_set_f("mat_shine", 1); shader_set_i("mat_metalic", 0); shader_set_f("mat_reflective", 0); + shader_set_f("mat_texScale", [ 1, 1 ] ); } vertex_submit(VB[i], render_type, _tex); } else if(_shader == sh_d3d_geometry) { - if(_useMat) - _mat.submitGeometry(); - else - shader_set_i("use_normal", 0); + if(_useMat) _mat.submitGeometry(); + else shader_set_i("use_normal", 0); vertex_submit(VB[i], render_type, _tex); } else diff --git a/scripts/d3d_path_extrude/d3d_path_extrude.yy b/scripts/d3d_path_extrude/d3d_path_extrude.yy index c2bb988d6..f3be293ac 100644 --- a/scripts/d3d_path_extrude/d3d_path_extrude.yy +++ b/scripts/d3d_path_extrude/d3d_path_extrude.yy @@ -6,7 +6,7 @@ "name":"d3d_path_extrude", "parent":{ "name":"mesh", - "path":"folders/functions/3d/mesh.yy", + "path":"folders/nodes/data/3D/d3d_mesh/mesh.yy", }, "resourceType":"GMScript", "resourceVersion":"2.0", diff --git a/scripts/d3d_plane_mesh/d3d_plane_mesh.yy b/scripts/d3d_plane_mesh/d3d_plane_mesh.yy index 7c44a5d57..b08b93afb 100644 --- a/scripts/d3d_plane_mesh/d3d_plane_mesh.yy +++ b/scripts/d3d_plane_mesh/d3d_plane_mesh.yy @@ -6,7 +6,7 @@ "name":"d3d_plane_mesh", "parent":{ "name":"mesh", - "path":"folders/functions/3d/mesh.yy", + "path":"folders/nodes/data/3D/d3d_mesh/mesh.yy", }, "resourceType":"GMScript", "resourceVersion":"2.0", diff --git a/scripts/d3d_surface_extrude/d3d_surface_extrude.yy b/scripts/d3d_surface_extrude/d3d_surface_extrude.yy index 880e15304..88d9d5465 100644 --- a/scripts/d3d_surface_extrude/d3d_surface_extrude.yy +++ b/scripts/d3d_surface_extrude/d3d_surface_extrude.yy @@ -6,7 +6,7 @@ "name":"d3d_surface_extrude", "parent":{ "name":"mesh", - "path":"folders/functions/3d/mesh.yy", + "path":"folders/nodes/data/3D/d3d_mesh/mesh.yy", }, "resourceType":"GMScript", "resourceVersion":"2.0", diff --git a/scripts/d3d_terrain/d3d_terrain.yy b/scripts/d3d_terrain/d3d_terrain.yy index a80d8af6b..f692d78a0 100644 --- a/scripts/d3d_terrain/d3d_terrain.yy +++ b/scripts/d3d_terrain/d3d_terrain.yy @@ -6,7 +6,7 @@ "name":"d3d_terrain", "parent":{ "name":"mesh", - "path":"folders/functions/3d/mesh.yy", + "path":"folders/nodes/data/3D/d3d_mesh/mesh.yy", }, "resourceType":"GMScript", "resourceVersion":"2.0", diff --git a/scripts/d3d_torus/d3d_torus.gml b/scripts/d3d_torus/d3d_torus.gml new file mode 100644 index 000000000..9f5151b1f --- /dev/null +++ b/scripts/d3d_torus/d3d_torus.gml @@ -0,0 +1,113 @@ +function __3dTorus(radT = 1, radP = .2, sideT = 16, sideP = 8, smooth = false) : __3dObject() constructor { + VF = global.VF_POS_NORM_TEX_COL; + render_type = pr_trianglelist; + object_counts = 1; + + self.radT = radT; + self.radP = radP; + self.sideT = sideT; + self.sideP = sideP; + self.smooth = smooth; + angT = 0; + angP = 0; + + static initModel = function() { + var vs = []//array_create(sideT * sideP * 2); + var ix = 0; + + for( var i = 0; i < sideT; i++ ) { + var aT0 = (i + 0) / sideT * 360 + angT; + var aT1 = (i + 1) / sideT * 360 + angT; + + var _lt0_x = lengthdir_x(1, aT0); + var _lt0_y = lengthdir_y(1, aT0); + var _lt1_x = lengthdir_x(1, aT1); + var _lt1_y = lengthdir_y(1, aT1); + + var xT0 = _lt0_x * radT; + var yT0 = _lt0_y * radT; + var xT1 = _lt1_x * radT; + var yT1 = _lt1_y * radT; + + for( var j = 0; j < sideP; j++ ) { + var aP0 = (j + 0) / sideP * 360 + angP; + var aP1 = (j + 1) / sideP * 360 + angP; + + var xP0 = lengthdir_x(radP, aP0); + var xP1 = lengthdir_x(radP, aP1); + + var x0 = _lt0_x * (radT + xP0); + var y0 = _lt0_y * (radT + xP0); + var z0 = lengthdir_y(radP, aP0); + + var x1 = _lt1_x * (radT + xP0); + var y1 = _lt1_y * (radT + xP0); + var z1 = z0; + + var x2 = _lt1_x * (radT + xP1); + var y2 = _lt1_y * (radT + xP1); + var z2 = lengthdir_y(radP, aP1); + + var x3 = _lt0_x * (radT + xP1); + var y3 = _lt0_y * (radT + xP1); + var z3 = z2; + + var ux0 = 1 - (i + 0) / sideT; + var ux1 = 1 - (i + 1) / sideT; + var uy0 = 1 - (j + 0) / sideP; + var uy1 = 1 - (j + 1) / sideP; + + if(smooth) { + var nx0 = x0 - xT0; + var ny0 = y0 - yT0; + var nz0 = z0; + + var nx1 = x1 - xT1; + var ny1 = y1 - yT1; + var nz1 = z1; + + var nx2 = x2 - xT1; + var ny2 = y2 - yT1; + var nz2 = z2; + + var nx3 = x3 - xT0; + var ny3 = y3 - yT0; + var nz3 = z3; + + } else { + var nx0 = (x0 + x1 + x2 + x3) / 4 - (xT0 + xT1) / 2; + var ny0 = (y0 + y1 + y2 + y3) / 4 - (yT0 + yT1) / 2; + var nz0 = (z0 + z1 + z2 + z3) / 4; + + var nx1 = nx0; + var ny1 = ny0; + var nz1 = nz0; + + var nx2 = nx0; + var ny2 = ny0; + var nz2 = nz0; + + var nx3 = nx0; + var ny3 = ny0; + var nz3 = nz0; + + } + + vs[ix++] = new __vertex(x0, y0, z0).setNormal(nx0, ny0, nz0).setUV(ux0, uy0); + vs[ix++] = new __vertex(x2, y2, z2).setNormal(nx2, ny2, nz2).setUV(ux1, uy1); + vs[ix++] = new __vertex(x1, y1, z1).setNormal(nx1, ny1, nz1).setUV(ux1, uy0); + + vs[ix++] = new __vertex(x0, y0, z0).setNormal(nx0, ny0, nz0).setUV(ux0, uy0); + vs[ix++] = new __vertex(x3, y3, z3).setNormal(nx3, ny3, nz3).setUV(ux0, uy1); + vs[ix++] = new __vertex(x2, y2, z2).setNormal(nx2, ny2, nz2).setUV(ux1, uy1); + } + } + + vertex = [ vs ]; + VB = build(); + } + + initModel(); + + static onParameterUpdate = initModel; +} \ No newline at end of file diff --git a/scripts/d3d_torus/d3d_torus.yy b/scripts/d3d_torus/d3d_torus.yy new file mode 100644 index 000000000..839077902 --- /dev/null +++ b/scripts/d3d_torus/d3d_torus.yy @@ -0,0 +1,13 @@ +{ + "$GMScript":"v1", + "%Name":"d3d_torus", + "isCompatibility":false, + "isDnD":false, + "name":"d3d_torus", + "parent":{ + "name":"mesh", + "path":"folders/nodes/data/3D/d3d_mesh/mesh.yy", + }, + "resourceType":"GMScript", + "resourceVersion":"2.0", +} \ No newline at end of file diff --git a/scripts/d3d_uvsphere/d3d_uvsphere.yy b/scripts/d3d_uvsphere/d3d_uvsphere.yy index 86da35f78..083a65522 100644 --- a/scripts/d3d_uvsphere/d3d_uvsphere.yy +++ b/scripts/d3d_uvsphere/d3d_uvsphere.yy @@ -6,7 +6,7 @@ "name":"d3d_uvsphere", "parent":{ "name":"mesh", - "path":"folders/functions/3d/mesh.yy", + "path":"folders/nodes/data/3D/d3d_mesh/mesh.yy", }, "resourceType":"GMScript", "resourceVersion":"2.0", diff --git a/scripts/globals/globals.gml b/scripts/globals/globals.gml index b1085b2b5..a35069f56 100644 --- a/scripts/globals/globals.gml +++ b/scripts/globals/globals.gml @@ -39,7 +39,7 @@ globalvar VERSION, SAVE_VERSION, VERSION_STRING, BUILD_NUMBER, LATEST_VERSION; globalvar HOTKEYS, HOTKEY_CONTEXT; - LATEST_VERSION = 1_18_00; + LATEST_VERSION = 1_18_00_0; VERSION = 1_18_01_0; SAVE_VERSION = 1_18_00_0; VERSION_STRING = MAC? "1.18.003m" : "1.18.1.004"; diff --git a/scripts/node_3d_material/node_3d_material.gml b/scripts/node_3d_material/node_3d_material.gml index 47178842a..8f194b5f0 100644 --- a/scripts/node_3d_material/node_3d_material.gml +++ b/scripts/node_3d_material/node_3d_material.gml @@ -25,11 +25,16 @@ function Node_3D_Material(_x, _y, _group = noone) : Node_3D(_x, _y, _group) cons newInput(8, nodeValue_Bool("Anti aliasing", self, false )); + newInput(9, nodeValue_Vec2("Scale", self, [ 1, 1 ] )); + + newInput(10, nodeValue_Vec2("Shift", self, [ 0, 0 ] )); + newOutput(0, nodeValue_Output("Material", self, VALUE_TYPE.d3Material, noone)); - input_display_list = [ 0, 8, + input_display_list = [ + ["Texture", false], 0, 8, 9, 10, ["Properties", false], 1, 2, 3, 4, 7, - ["Normal", false], 5, 6, + ["Normal", false], 5, 6, ]; static processData = function(_output, _data, _output_index, _array_index = 0) { @@ -42,6 +47,8 @@ function Node_3D_Material(_x, _y, _group = noone) : Node_3D(_x, _y, _group) cons var _norS = _data[6]; var _roug = _data[7]; var _aa = _data[8]; + var _scal = _data[9]; + var _shft = _data[10]; if(!is_surface(_surf)) { solid_surf = surface_verify(solid_surf, 1, 1); @@ -54,6 +61,8 @@ function Node_3D_Material(_x, _y, _group = noone) : Node_3D(_x, _y, _group) cons _mat.shine = _shin; _mat.metalic = _metl; _mat.texFilter = _aa; + _mat.texScale = _scal; + _mat.texShift = _shft; _mat.normal = _nor; _mat.normalStr = _norS; diff --git a/scripts/node_3d_mesh_cone/node_3d_mesh_cone.gml b/scripts/node_3d_mesh_cone/node_3d_mesh_cone.gml index 3b8528e13..d38975393 100644 --- a/scripts/node_3d_mesh_cone/node_3d_mesh_cone.gml +++ b/scripts/node_3d_mesh_cone/node_3d_mesh_cone.gml @@ -15,9 +15,9 @@ function Node_3D_Mesh_Cone(_x, _y, _group = noone) : Node_3D_Mesh(_x, _y, _group newInput(in_mesh + 3, nodeValue_Bool("Smooth Side", self, false )); input_display_list = [ - __d3d_input_list_mesh, in_mesh + 0, in_mesh + 3, + __d3d_input_list_mesh, in_mesh + 0, __d3d_input_list_transform, - ["Material", false], in_mesh + 1, in_mesh + 2, + ["Material", false], in_mesh + 3, in_mesh + 1, in_mesh + 2, ] static processData = function(_output, _data, _output_index, _array_index = 0) { #region diff --git a/scripts/node_3d_mesh_cylinder/node_3d_mesh_cylinder.gml b/scripts/node_3d_mesh_cylinder/node_3d_mesh_cylinder.gml index 1c1c589cc..2982a6c8e 100644 --- a/scripts/node_3d_mesh_cylinder/node_3d_mesh_cylinder.gml +++ b/scripts/node_3d_mesh_cylinder/node_3d_mesh_cylinder.gml @@ -20,9 +20,9 @@ function Node_3D_Mesh_Cylinder(_x, _y, _group = noone) : Node_3D_Mesh(_x, _y, _g newInput(in_mesh + 5, nodeValue_Bool("End caps", self, true )); input_display_list = [ - __d3d_input_list_mesh, in_mesh + 0, in_mesh + 4, in_mesh + 5, + __d3d_input_list_mesh, in_mesh + 0, in_mesh + 5, __d3d_input_list_transform, - ["Material", false], in_mesh + 1, in_mesh + 2, in_mesh + 3, + ["Material", false], in_mesh + 4, in_mesh + 1, in_mesh + 2, in_mesh + 3, ] static step = function() { #region diff --git a/scripts/node_3d_mesh_sphere_ico/node_3d_mesh_sphere_ico.gml b/scripts/node_3d_mesh_sphere_ico/node_3d_mesh_sphere_ico.gml index 0a302214f..efe5e68e7 100644 --- a/scripts/node_3d_mesh_sphere_ico/node_3d_mesh_sphere_ico.gml +++ b/scripts/node_3d_mesh_sphere_ico/node_3d_mesh_sphere_ico.gml @@ -12,9 +12,9 @@ function Node_3D_Mesh_Sphere_Ico(_x, _y, _group = noone) : Node_3D_Mesh(_x, _y, newInput(in_mesh + 2, nodeValue_Bool("Smooth Normal", self, false )); input_display_list = [ - __d3d_input_list_mesh, in_mesh + 0, in_mesh + 2, + __d3d_input_list_mesh, in_mesh + 0, __d3d_input_list_transform, - ["Material", false], in_mesh + 1, + ["Material", false], in_mesh + 2, in_mesh + 1, ] static processData = function(_output, _data, _output_index, _array_index = 0) { #region diff --git a/scripts/node_3d_mesh_sphere_uv/node_3d_mesh_sphere_uv.gml b/scripts/node_3d_mesh_sphere_uv/node_3d_mesh_sphere_uv.gml index 105afb456..c88dc524b 100644 --- a/scripts/node_3d_mesh_sphere_uv/node_3d_mesh_sphere_uv.gml +++ b/scripts/node_3d_mesh_sphere_uv/node_3d_mesh_sphere_uv.gml @@ -15,9 +15,9 @@ function Node_3D_Mesh_Sphere_UV(_x, _y, _group = noone) : Node_3D_Mesh(_x, _y, _ newInput(in_mesh + 3, nodeValue_Bool("Smooth Normal", self, false )); input_display_list = [ - __d3d_input_list_mesh, in_mesh + 0, in_mesh + 1, in_mesh + 3, + __d3d_input_list_mesh, in_mesh + 0, in_mesh + 1, __d3d_input_list_transform, - ["Material", false], in_mesh + 2, + ["Material", false], in_mesh + 3, in_mesh + 2, ] static processData = function(_output, _data, _output_index, _array_index = 0) { #region diff --git a/scripts/node_3d_mesh_torus/node_3d_mesh_torus.gml b/scripts/node_3d_mesh_torus/node_3d_mesh_torus.gml new file mode 100644 index 000000000..29bdc251b --- /dev/null +++ b/scripts/node_3d_mesh_torus/node_3d_mesh_torus.gml @@ -0,0 +1,61 @@ +function Node_3D_Mesh_Torus(_x, _y, _group = noone) : Node_3D_Mesh(_x, _y, _group) constructor { + name = "3D torus"; + + object_class = __3dTorus; + + newInput(in_mesh + 0, nodeValue_Int("Toroidal Slices", self, 16 )) + .setValidator(VV_min(3)); + + newInput(in_mesh + 1, nodeValue_Int("Poloidal Slices", self, 8 )) + .setValidator(VV_min(3)); + + newInput(in_mesh + 2, nodeValue_Float("Toroidal Radius", self, 1 )); + + newInput(in_mesh + 3, nodeValue_Float("Poloidal Radius", self, .2 )) + .setDisplay(VALUE_DISPLAY.slider); + + newInput(in_mesh + 4, nodeValue_D3Material("Material", self, new __d3dMaterial())) + .setVisible(true, true); + + newInput(in_mesh + 5, nodeValue_Bool("Smooth Normal", self, false )); + + newInput(in_mesh + 6, nodeValue_Rotation("Toroidal Angle", self, 0 )); + + newInput(in_mesh + 7, nodeValue_Rotation("Poloidal Angle", self, 0 )); + + input_display_list = [ + __d3d_input_list_mesh, in_mesh + 0, in_mesh + 1, in_mesh + 2, in_mesh + 3, in_mesh + 6, in_mesh + 7, + __d3d_input_list_transform, + ["Material", false], in_mesh + 5, in_mesh + 4, + ] + + static processData = function(_output, _data, _output_index, _array_index = 0) { + var _sideT = _data[in_mesh + 0]; + var _sideP = _data[in_mesh + 1]; + var _radT = _data[in_mesh + 2]; + var _radP = _data[in_mesh + 3]; + var _angT = _data[in_mesh + 6]; + var _angP = _data[in_mesh + 7]; + + var _smt = _data[in_mesh + 5]; + var _mat = _data[in_mesh + 4]; + + var object = getObject(_array_index); + object.checkParameter({ + sideT : _sideT, + sideP : _sideP, + radT : _radT, + radP : _radP, + angT : _angT, + angP : _angP, + smooth : _smt, + }); + object.materials = [ _mat ]; + + setTransform(object, _data); + + return object; + } + + static getPreviewValues = function() { return getSingleValue(in_mesh + 4); } +} \ No newline at end of file diff --git a/scripts/node_3d_mesh_torus/node_3d_mesh_torus.yy b/scripts/node_3d_mesh_torus/node_3d_mesh_torus.yy new file mode 100644 index 000000000..0ba36bceb --- /dev/null +++ b/scripts/node_3d_mesh_torus/node_3d_mesh_torus.yy @@ -0,0 +1,13 @@ +{ + "$GMScript":"v1", + "%Name":"node_3d_mesh_torus", + "isCompatibility":false, + "isDnD":false, + "name":"node_3d_mesh_torus", + "parent":{ + "name":"d3d_mesh", + "path":"folders/nodes/data/3D/d3d_mesh.yy", + }, + "resourceType":"GMScript", + "resourceVersion":"2.0", +} \ No newline at end of file diff --git a/scripts/node_3d_mesh_torus/node_counter.yy b/scripts/node_3d_mesh_torus/node_counter.yy new file mode 100644 index 000000000..10832a0b0 --- /dev/null +++ b/scripts/node_3d_mesh_torus/node_counter.yy @@ -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", +} \ No newline at end of file diff --git a/scripts/node_registry/node_registry.gml b/scripts/node_registry/node_registry.gml index 856d08790..60a4f2e26 100644 --- a/scripts/node_registry/node_registry.gml +++ b/scripts/node_registry/node_registry.gml @@ -703,6 +703,7 @@ function __initNodes() { addNodeObject(d3d, "3D UV Sphere", s_node_3d_sphere_uv, "Node_3D_Mesh_Sphere_UV", [1, Node_3D_Mesh_Sphere_UV]).setVersion(11510); addNodeObject(d3d, "3D Icosphere", s_node_3d_sphere_ico, "Node_3D_Mesh_Sphere_Ico", [1, Node_3D_Mesh_Sphere_Ico]).setVersion(11510); addNodeObject(d3d, "3D Cone", s_node_3d_cone, "Node_3D_Mesh_Cone", [1, Node_3D_Mesh_Cone]).setVersion(11510); + addNodeObject(d3d, "3D Torus", s_node_3d_torus, "Node_3D_Mesh_Torus", [1, Node_3D_Mesh_Torus]).setVersion(1_18_01_0); addNodeObject(d3d, "3D Terrain", s_node_3d_displace, "Node_3D_Mesh_Terrain", [1, Node_3D_Mesh_Terrain],, "Create 3D terrain from height map.").setVersion(11560); addNodeObject(d3d, "Surface Extrude", s_node_3d_extrude, "Node_3D_Mesh_Extrude", [1, Node_3D_Mesh_Extrude],, "Extrude 2D image into 3D object.").setVersion(11510); addNodeObject(d3d, "Path Extrude", s_node_3d_path_extrude, "Node_3D_Mesh_Path_Extrude",[1, Node_3D_Mesh_Path_Extrude],, "Extrude path into 3D object.").setVersion(11750); diff --git a/shaders/sh_d3d_default/sh_d3d_default.fsh b/shaders/sh_d3d_default/sh_d3d_default.fsh index a90d3596d..ea041555a 100644 --- a/shaders/sh_d3d_default/sh_d3d_default.fsh +++ b/shaders/sh_d3d_default/sh_d3d_default.fsh @@ -65,6 +65,8 @@ uniform int use_8bit; uniform float mat_shine; uniform int mat_metalic; uniform float mat_reflective; + uniform vec2 mat_texScale; + uniform vec2 mat_texShift; uniform int mat_defer_normal; uniform float mat_normal_strength; @@ -174,6 +176,7 @@ void main() { vec2 uv_coord = v_vTexcoord; if(mat_flip == 1) uv_coord.y = -uv_coord.y; + uv_coord = fract(uv_coord * mat_texScale + mat_texShift); mat_baseColor = texture2D( gm_BaseTexture, uv_coord ); mat_baseColor *= v_vColour; diff --git a/sprites/s_node_3d_torus/503138db-2536-496a-b5cc-51e32ad597e3.png b/sprites/s_node_3d_torus/503138db-2536-496a-b5cc-51e32ad597e3.png new file mode 100644 index 000000000..a5cd9c05c Binary files /dev/null and b/sprites/s_node_3d_torus/503138db-2536-496a-b5cc-51e32ad597e3.png differ diff --git a/sprites/s_node_3d_torus/layers/503138db-2536-496a-b5cc-51e32ad597e3/4e9d715f-43f0-4ffd-a842-0e4d79699ee0.png b/sprites/s_node_3d_torus/layers/503138db-2536-496a-b5cc-51e32ad597e3/4e9d715f-43f0-4ffd-a842-0e4d79699ee0.png new file mode 100644 index 000000000..a5cd9c05c Binary files /dev/null and b/sprites/s_node_3d_torus/layers/503138db-2536-496a-b5cc-51e32ad597e3/4e9d715f-43f0-4ffd-a842-0e4d79699ee0.png differ diff --git a/sprites/s_node_3d_torus/s_node_3d_torus.yy b/sprites/s_node_3d_torus/s_node_3d_torus.yy new file mode 100644 index 000000000..121ef1bdd --- /dev/null +++ b/sprites/s_node_3d_torus/s_node_3d_torus.yy @@ -0,0 +1,90 @@ +{ + "$GMSprite":"", + "%Name":"s_node_3d_torus", + "bboxMode":0, + "bbox_bottom":52, + "bbox_left":1, + "bbox_right":62, + "bbox_top":11, + "collisionKind":1, + "collisionTolerance":0, + "DynamicTexturePage":false, + "edgeFiltering":false, + "For3D":false, + "frames":[ + {"$GMSpriteFrame":"","%Name":"503138db-2536-496a-b5cc-51e32ad597e3","name":"503138db-2536-496a-b5cc-51e32ad597e3","resourceType":"GMSpriteFrame","resourceVersion":"2.0",}, + ], + "gridX":0, + "gridY":0, + "height":64, + "HTile":false, + "layers":[ + {"$GMImageLayer":"","%Name":"4e9d715f-43f0-4ffd-a842-0e4d79699ee0","blendMode":0,"displayName":"default","isLocked":false,"name":"4e9d715f-43f0-4ffd-a842-0e4d79699ee0","opacity":100.0,"resourceType":"GMImageLayer","resourceVersion":"2.0","visible":true,}, + ], + "name":"s_node_3d_torus", + "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_3d_torus", + "autoRecord":true, + "backdropHeight":768, + "backdropImageOpacity":0.5, + "backdropImagePath":"", + "backdropWidth":1366, + "backdropXOffset":0.0, + "backdropYOffset":0.0, + "events":{ + "$KeyframeStore":"", + "Keyframes":[], + "resourceType":"KeyframeStore", + "resourceVersion":"2.0", + }, + "eventStubScript":null, + "eventToFunction":{}, + "length":1.0, + "lockOrigin":false, + "moments":{ + "$KeyframeStore":"", + "Keyframes":[], + "resourceType":"KeyframeStore", + "resourceVersion":"2.0", + }, + "name":"s_node_3d_torus", + "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":"","Keyframes":[ + {"$Keyframe":"","Channels":{ + "0":{"$SpriteFrameKeyframe":"","Id":{"name":"503138db-2536-496a-b5cc-51e32ad597e3","path":"sprites/s_node_3d_torus/s_node_3d_torus.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",}, + },"Disabled":false,"id":"94d991bf-2ece-4ef4-af43-db030f5742a2","IsCreationKey":false,"Key":0.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, + ],"resourceType":"KeyframeStore","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, +} \ No newline at end of file