- [3D scene] Fix nested scene not rendering.

This commit is contained in:
Tanasart 2023-12-20 09:54:26 +07:00
parent 0a00b01bf5
commit bfa9f7f6a5
14 changed files with 64 additions and 16 deletions

View file

@ -827,6 +827,7 @@
{"name":"s_node_pb_fx_radial","order":4,"path":"sprites/s_node_pb_fx_radial/s_node_pb_fx_radial.yy",}, {"name":"s_node_pb_fx_radial","order":4,"path":"sprites/s_node_pb_fx_radial/s_node_pb_fx_radial.yy",},
{"name":"__background_get_internal","order":2,"path":"scripts/__background_get_internal/__background_get_internal.yy",}, {"name":"__background_get_internal","order":2,"path":"scripts/__background_get_internal/__background_get_internal.yy",},
{"name":"s_node_array_sample","order":18,"path":"sprites/s_node_array_sample/s_node_array_sample.yy",}, {"name":"s_node_array_sample","order":18,"path":"sprites/s_node_array_sample/s_node_array_sample.yy",},
{"name":"o_pie_menu","order":14,"path":"objects/o_pie_menu/o_pie_menu.yy",},
{"name":"s_biterator_b_labels","order":9,"path":"sprites/s_biterator_b_labels/s_biterator_b_labels.yy",}, {"name":"s_biterator_b_labels","order":9,"path":"sprites/s_biterator_b_labels/s_biterator_b_labels.yy",},
{"name":"FirebaseREST_Firestore_collection_decode","order":6,"path":"scripts/FirebaseREST_Firestore_collection_decode/FirebaseREST_Firestore_collection_decode.yy",}, {"name":"FirebaseREST_Firestore_collection_decode","order":6,"path":"scripts/FirebaseREST_Firestore_collection_decode/FirebaseREST_Firestore_collection_decode.yy",},
{"name":"s_node_mk_flip_grid","order":2,"path":"sprites/s_node_mk_flip_grid/s_node_mk_flip_grid.yy",}, {"name":"s_node_mk_flip_grid","order":2,"path":"sprites/s_node_mk_flip_grid/s_node_mk_flip_grid.yy",},

View file

@ -1100,6 +1100,7 @@
{"id":{"name":"s_node_pb_fx_radial","path":"sprites/s_node_pb_fx_radial/s_node_pb_fx_radial.yy",},}, {"id":{"name":"s_node_pb_fx_radial","path":"sprites/s_node_pb_fx_radial/s_node_pb_fx_radial.yy",},},
{"id":{"name":"__background_get_internal","path":"scripts/__background_get_internal/__background_get_internal.yy",},}, {"id":{"name":"__background_get_internal","path":"scripts/__background_get_internal/__background_get_internal.yy",},},
{"id":{"name":"s_node_array_sample","path":"sprites/s_node_array_sample/s_node_array_sample.yy",},}, {"id":{"name":"s_node_array_sample","path":"sprites/s_node_array_sample/s_node_array_sample.yy",},},
{"id":{"name":"o_pie_menu","path":"objects/o_pie_menu/o_pie_menu.yy",},},
{"id":{"name":"s_biterator_b_labels","path":"sprites/s_biterator_b_labels/s_biterator_b_labels.yy",},}, {"id":{"name":"s_biterator_b_labels","path":"sprites/s_biterator_b_labels/s_biterator_b_labels.yy",},},
{"id":{"name":"FirebaseREST_Firestore_collection_decode","path":"scripts/FirebaseREST_Firestore_collection_decode/FirebaseREST_Firestore_collection_decode.yy",},}, {"id":{"name":"FirebaseREST_Firestore_collection_decode","path":"scripts/FirebaseREST_Firestore_collection_decode/FirebaseREST_Firestore_collection_decode.yy",},},
{"id":{"name":"s_node_mk_flip_grid","path":"sprites/s_node_mk_flip_grid/s_node_mk_flip_grid.yy",},}, {"id":{"name":"s_node_mk_flip_grid","path":"sprites/s_node_mk_flip_grid/s_node_mk_flip_grid.yy",},},

Binary file not shown.

Before

Width:  |  Height:  |  Size: 80 KiB

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 80 KiB

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 58 KiB

View file

@ -0,0 +1,4 @@
/// @description Insert description here
// You can write your code in this editor
depth = -9999;

View file

@ -0,0 +1,33 @@
{
"resourceType": "GMObject",
"resourceVersion": "1.0",
"name": "o_pie_menu",
"eventList": [
{"resourceType":"GMEvent","resourceVersion":"1.0","name":"","collisionObjectId":null,"eventNum":0,"eventType":0,"isDnD":false,},
],
"managed": true,
"overriddenProperties": [],
"parent": {
"name": "dialog",
"path": "folders/dialog.yy",
},
"parentObjectId": null,
"persistent": false,
"physicsAngularDamping": 0.1,
"physicsDensity": 0.5,
"physicsFriction": 0.2,
"physicsGroup": 1,
"physicsKinematic": false,
"physicsLinearDamping": 0.1,
"physicsObject": false,
"physicsRestitution": 0.1,
"physicsSensor": false,
"physicsShape": 1,
"physicsShapePoints": [],
"physicsStartAwake": true,
"properties": [],
"solid": false,
"spriteId": null,
"spriteMaskId": null,
"visible": true,
}

View file

@ -57,36 +57,38 @@ function __3dGroup() constructor {
array_push(objects, _obj); array_push(objects, _obj);
} #endregion } #endregion
static submit = function(scene = {}, shader = noone) { static submit = function(scene = {}, shader = noone) { #region
transform.submitMatrix(); transform.submitMatrix();
for( var i = 0, n = array_length(objects); i < n; i++ ) for( var i = 0, n = array_length(objects); i < n; i++ )
objects[i].submit(scene, shader); objects[i].submit(scene, shader);
transform.clearMatrix(); transform.clearMatrix();
} } #endregion
static submitUI = function(scene = {}, shader = noone) { static submitUI = function(scene = {}, shader = noone) { #region
transform.submitMatrix(); transform.submitMatrix();
for( var i = 0, n = array_length(objects); i < n; i++ ) for( var i = 0, n = array_length(objects); i < n; i++ )
objects[i].submitUI(scene, shader); objects[i].submitUI(scene, shader);
transform.clearMatrix(); transform.clearMatrix();
} } #endregion
static submitSel = function(scene = {}, shader = noone) {
static submitSel = function(scene = {}, shader = noone) { #region
transform.submitMatrix(); transform.submitMatrix();
for( var i = 0, n = array_length(objects); i < n; i++ ) for( var i = 0, n = array_length(objects); i < n; i++ )
objects[i].submitSel(scene, shader); objects[i].submitSel(scene, shader);
transform.clearMatrix(); transform.clearMatrix();
} } #endregion
static submitShader = function(scene = {}, shader = noone) {
static submitShader = function(scene = {}, shader = noone) { #region
transform.submitMatrix(); transform.submitMatrix();
for( var i = 0, n = array_length(objects); i < n; i++ ) for( var i = 0, n = array_length(objects); i < n; i++ )
objects[i].submitShader(scene, shader); objects[i].submitShader(scene, shader);
transform.clearMatrix(); transform.clearMatrix();
} } #endregion
static submitShadow = function(scene = {}, object = noone) { static submitShadow = function(scene = {}, object = noone) { #region
for( var i = 0, n = array_length(objects); i < n; i++ ) for( var i = 0, n = array_length(objects); i < n; i++ )
objects[i].submitShadow(scene, object); objects[i].submitShadow(scene, object);
} } #endregion
static map = function(callback, scene = {}) { #region static map = function(callback, scene = {}) { #region
for( var i = 0, n = array_length(objects); i < n; i++ ) for( var i = 0, n = array_length(objects); i < n; i++ )

View file

@ -170,6 +170,8 @@ function __3dObject() constructor {
vertex_submit(VB[i], render_type, _tex); vertex_submit(VB[i], render_type, _tex);
} else } else
vertex_submit(VB[i], render_type, _tex); vertex_submit(VB[i], render_type, _tex);
//print($"Submit vertex ({scene}) [{VB[i]}]");
} }
gpu_set_tex_repeat(false); gpu_set_tex_repeat(false);

View file

@ -10,7 +10,7 @@
d3_view_camera.projection = CAMERA_PROJECTION.orthograph; d3_view_camera.projection = CAMERA_PROJECTION.orthograph;
d3_view_camera.setMatrix(); d3_view_camera.setMatrix();
D3D_GLOBAL_PREVIEW = new __3dScene(d3_view_camera); D3D_GLOBAL_PREVIEW = new __3dScene(d3_view_camera, "Global node preview");
D3D_GLOBAL_PREVIEW.apply_transform = true; D3D_GLOBAL_PREVIEW.apply_transform = true;
D3D_GLOBAL_PREVIEW.defer_normal = false; D3D_GLOBAL_PREVIEW.defer_normal = false;
@ -323,4 +323,8 @@ function __3dScene(camera, name = "New scene") constructor {
return self; return self;
} #endregion } #endregion
static toString = function() { #region
return $"[3D Scene] {name}";
} #endregion
} }

View file

@ -5,7 +5,7 @@ function dynaSurf_3d() : dynaSurf() constructor {
camTarget = new __vec3(); camTarget = new __vec3();
camera_ay = 45; camera_ay = 45;
scene = new __3dScene(camera); scene = new __3dScene(camera, "Dynamic surf scene");
w = 1; w = 1;
h = 1; h = 1;

View file

@ -44,9 +44,8 @@ function Node_3D_Scene(_x, _y, _group = noone) : Node_3D(_x, _y, _group) constru
for( var i = input_fix_len, n = ds_list_size(inputs); i < n; i += data_length ) { for( var i = input_fix_len, n = ds_list_size(inputs); i < n; i += data_length ) {
var _obj = _data[i]; var _obj = _data[i];
if(!is_instanceof(_obj, __3dObject)) continue; if(is_instanceof(_obj, __3dObject) || is_instanceof(_obj, __3dGroup))
_scene.addObject(_obj);
_scene.addObject(_obj);
} }
return _scene; return _scene;

View file

@ -132,7 +132,7 @@ function Panel_Preview() : PanelContent() constructor {
#endregion #endregion
#region scene #region scene
d3_scene = new __3dScene(d3_view_camera, "Preview"); d3_scene = new __3dScene(d3_view_camera, "Preview panel");
d3_scene.lightAmbient = $404040; d3_scene.lightAmbient = $404040;
d3_scene.cull_mode = cull_counterclockwise; d3_scene.cull_mode = cull_counterclockwise;
d3_scene_preview = d3_scene; d3_scene_preview = d3_scene;
@ -881,11 +881,13 @@ function Panel_Preview() : PanelContent() constructor {
d3_scene_preview.apply(d3_deferData); d3_scene_preview.apply(d3_deferData);
//print("========= Submit begin =========");
for( var i = 0, n = array_length(_prev_obj); i < n; i++ ) { for( var i = 0, n = array_length(_prev_obj); i < n; i++ ) {
var _prev = _prev_obj[i]; var _prev = _prev_obj[i];
if(_prev == noone) continue; if(_prev == noone) continue;
_prev.submitUI(d3_scene_preview); //////////////// SUBMIT //////////////// _prev.submitUI(d3_scene_preview); //////////////// SUBMIT ////////////////
} }
//print("========= Submit end =========");
gpu_set_cullmode(cull_noculling); gpu_set_cullmode(cull_noculling);
surface_reset_target(); surface_reset_target();