mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2025-01-11 23:06:51 +01:00
- [3D Object] Fix weird behaviour on other noeds when created.
This commit is contained in:
parent
1cabe20a00
commit
5e2eb0a352
5 changed files with 17 additions and 6 deletions
|
@ -1,7 +1,6 @@
|
|||
function Node_3D(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
|
||||
name = "3D";
|
||||
is_3D = NODE_3D.polygon;
|
||||
surface_depth_disable(false);
|
||||
|
||||
mesh_prev_surface = surface_create(64, 64);
|
||||
|
||||
|
@ -35,6 +34,7 @@ function Node_3D(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constr
|
|||
static refreshPreview = function() { #region
|
||||
var _prev_obj = getPreviewObjects();
|
||||
|
||||
surface_depth_disable(false);
|
||||
mesh_prev_surface = surface_verify(mesh_prev_surface, PREFERENCES.node_3d_preview_size, PREFERENCES.node_3d_preview_size);
|
||||
surface_set_target(mesh_prev_surface);
|
||||
DRAW_CLEAR
|
||||
|
@ -63,6 +63,7 @@ function Node_3D(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constr
|
|||
D3D_GLOBAL_PREVIEW.submitUI(_prev);
|
||||
}
|
||||
surface_reset_target();
|
||||
surface_depth_disable(true);
|
||||
|
||||
D3D_GLOBAL_PREVIEW.camera.resetCamera();
|
||||
} #endregion
|
||||
|
|
|
@ -242,6 +242,8 @@ function Node_3D_Camera(_x, _y, _group = noone) : Node_3D_Object(_x, _y, _group)
|
|||
var _qi3 = new BBMOD_Quaternion().FromAxisAngle(new BBMOD_Vec3(1, 0, 0), 90);
|
||||
#endregion
|
||||
|
||||
surface_depth_disable(false);
|
||||
|
||||
switch(_posm) { #region ++++ camera positioning ++++
|
||||
case 0 :
|
||||
camera.useFocus = false;
|
||||
|
@ -377,6 +379,8 @@ function Node_3D_Camera(_x, _y, _group = noone) : Node_3D_Object(_x, _y, _group)
|
|||
surface_free(_render);
|
||||
#endregion
|
||||
|
||||
surface_depth_disable(true);
|
||||
|
||||
return [ _finalRender, _normal, _depth ];
|
||||
} #endregion
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ function Node_3D_Mesh_Cube(_x, _y, _group = noone) : Node_3D_Mesh(_x, _y, _group
|
|||
inputs[| in_mesh + 6].setVisible(_mat_side, _mat_side);
|
||||
} #endregion
|
||||
|
||||
static processData = function(_output, _data, _output_index, _array_index = 0) { #region
|
||||
static processData = function(_output, _data, _output_index, _array_index = 0) {
|
||||
var _mat_side = _data[in_mesh + 0];
|
||||
var _mat_1 = _data[in_mesh + 1];
|
||||
var _mat_2 = _data[in_mesh + 2];
|
||||
|
@ -63,7 +63,7 @@ function Node_3D_Mesh_Cube(_x, _y, _group = noone) : Node_3D_Mesh(_x, _y, _group
|
|||
setTransform(object, _data);
|
||||
|
||||
return object;
|
||||
} #endregion
|
||||
}
|
||||
|
||||
static getPreviewValues = function() { return array_safe_get_fast(all_inputs, in_mesh + 1, noone); }
|
||||
}
|
|
@ -118,11 +118,13 @@ function Node_Posterize(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
|
|||
var _ssh = surface_get_height(_sMax);
|
||||
var _max = [ 0, 0, 0 ];
|
||||
var _min = [ 1, 1, 1 ];
|
||||
|
||||
var _bMax = buffer_from_surface(_sMax, false);
|
||||
var _bMin = buffer_from_surface(_sMin, false);
|
||||
|
||||
buffer_seek(_bMax, buffer_seek_start, 0);
|
||||
buffer_seek(_bMin, buffer_seek_start, 0);
|
||||
buffer_to_start(_bMax);
|
||||
buffer_to_start(_bMin);
|
||||
|
||||
repeat(_ssw * _ssh) {
|
||||
var _cc = buffer_read(_bMax, buffer_u32);
|
||||
_max[0] = max(_max[0], _color_get_red(_cc));
|
||||
|
@ -135,6 +137,7 @@ function Node_Posterize(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
|
|||
_min[2] = min(_min[2], _color_get_blue(_cc));
|
||||
|
||||
}
|
||||
|
||||
buffer_delete(_bMax);
|
||||
buffer_delete(_bMin);
|
||||
#endregion
|
||||
|
@ -148,6 +151,10 @@ function Node_Posterize(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
|
|||
|
||||
draw_surface_safe(_surf);
|
||||
surface_reset_shader();
|
||||
|
||||
// surface_set_shader(_outSurf);
|
||||
// draw_surface_safe(_sMax);
|
||||
// surface_reset_shader();
|
||||
}
|
||||
|
||||
return _outSurf;
|
||||
|
|
|
@ -1140,7 +1140,6 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
if(connect_type == JUNCTION_CONNECT.output)
|
||||
return val;
|
||||
|
||||
if(type == VALUE_TYPE.integer || type == VALUE_TYPE.float) print($"{typ == VALUE_TYPE.surface}");
|
||||
if(typ == VALUE_TYPE.surface && (type == VALUE_TYPE.integer || type == VALUE_TYPE.float)) { #region Dimension conversion
|
||||
if(is_array(val)) {
|
||||
var eqSize = true;
|
||||
|
|
Loading…
Reference in a new issue