mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2024-12-24 22:16:17 +01:00
[Surface Extrude] Add height level
This commit is contained in:
parent
9421160f5f
commit
be99110708
2 changed files with 34 additions and 10 deletions
|
@ -13,6 +13,9 @@ function __3dSurfaceExtrude(surface = noone, height = noone, smooth = false) : _
|
|||
normal_draw_size = 0.05;
|
||||
vertex_array = [];
|
||||
|
||||
flevel_min = 0; flevel_max = 1;
|
||||
blevel_min = 0; blevel_max = 1;
|
||||
|
||||
static initModel = function() {
|
||||
if(!is_surface(surface)) return;
|
||||
|
||||
|
@ -32,6 +35,9 @@ function __3dSurfaceExtrude(surface = noone, height = noone, smooth = false) : _
|
|||
var hb_buff = 0;
|
||||
var cb_buff = 0;
|
||||
|
||||
var flevel_rg = flevel_max - flevel_min;
|
||||
var blevel_rg = blevel_max - blevel_min;
|
||||
|
||||
/////////////////////////////////////////////////////////////// Buffer
|
||||
|
||||
if(useH) {
|
||||
|
@ -47,8 +53,10 @@ function __3dSurfaceExtrude(surface = noone, height = noone, smooth = false) : _
|
|||
|
||||
repeat(hg_hh * hg_ww) {
|
||||
var cc = buffer_read(height_buffer, buffer_u32);
|
||||
var _b = round(colorBrightness(cc & ~0b11111111) * 65536);
|
||||
buffer_write(h_buff, buffer_u16, _b);
|
||||
var _b = colorBrightness(cc & ~0b11111111);
|
||||
_b = flevel_min + flevel_rg * _b;
|
||||
|
||||
buffer_write(h_buff, buffer_u16, round(_b * 65536));
|
||||
}
|
||||
|
||||
buffer_delete(height_buffer);
|
||||
|
@ -96,8 +104,10 @@ function __3dSurfaceExtrude(surface = noone, height = noone, smooth = false) : _
|
|||
|
||||
repeat(hg_hh * hg_ww) {
|
||||
var cc = buffer_read(height_buffer, buffer_u32);
|
||||
var _b = round(colorBrightness(cc & ~0b11111111) * 65536);
|
||||
buffer_write(hb_buff, buffer_u16, _b);
|
||||
var _b = colorBrightness(cc & ~0b11111111);
|
||||
_b = blevel_min + blevel_rg * _b;
|
||||
|
||||
buffer_write(hb_buff, buffer_u16, round(_b * 65536));
|
||||
}
|
||||
|
||||
buffer_delete(height_buffer);
|
||||
|
|
|
@ -3,10 +3,10 @@ function Node_3D_Mesh_Extrude(_x, _y, _group = noone) : Node_3D_Mesh(_x, _y, _gr
|
|||
|
||||
object_class = __3dSurfaceExtrude;
|
||||
|
||||
inputs[| in_mesh + 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.d3Material, new __d3dMaterial())
|
||||
inputs[| in_mesh + 0] = nodeValue("Front Surface", self, JUNCTION_CONNECT.input, VALUE_TYPE.d3Material, new __d3dMaterial())
|
||||
.setVisible(true, true);
|
||||
|
||||
inputs[| in_mesh + 1] = nodeValue("Height map", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone);
|
||||
inputs[| in_mesh + 1] = nodeValue("Front Height", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone);
|
||||
|
||||
inputs[| in_mesh + 2] = nodeValue("Smooth", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false)
|
||||
|
||||
|
@ -19,11 +19,17 @@ function Node_3D_Mesh_Extrude(_x, _y, _group = noone) : Node_3D_Mesh(_x, _y, _gr
|
|||
|
||||
inputs[| in_mesh + 6] = nodeValue("Back Height", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone);
|
||||
|
||||
input_display_list = [
|
||||
inputs[| in_mesh + 7] = nodeValue("Front Height Level", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 1 ])
|
||||
.setDisplay(VALUE_DISPLAY.slider_range);
|
||||
|
||||
inputs[| in_mesh + 8] = nodeValue("Back Height Level", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 1 ])
|
||||
.setDisplay(VALUE_DISPLAY.slider_range);
|
||||
|
||||
input_display_list = [ in_mesh + 3,
|
||||
__d3d_input_list_mesh,
|
||||
__d3d_input_list_transform,
|
||||
["Extrude", false], in_mesh + 0, in_mesh + 1, in_mesh + 3,
|
||||
["Textures", false], in_mesh + 4, in_mesh + 5, in_mesh + 6,
|
||||
["Extrude", false], in_mesh + 0, in_mesh + 1, in_mesh + 7,
|
||||
["Backside", false], in_mesh + 4, in_mesh + 5, in_mesh + 6, in_mesh + 8,
|
||||
]
|
||||
|
||||
temp_surface = [ noone, noone ];
|
||||
|
@ -45,6 +51,9 @@ function Node_3D_Mesh_Extrude(_x, _y, _group = noone) : Node_3D_Mesh(_x, _y, _gr
|
|||
var _bmat = _data[in_mesh + 5];
|
||||
var _bhgt = _data[in_mesh + 6];
|
||||
|
||||
var _flv = _data[in_mesh + 7];
|
||||
var _blv = _data[in_mesh + 8];
|
||||
|
||||
var _surf = is_instanceof(_mat, __d3dMaterial)? _mat.surface : noone;
|
||||
var _bsurf = is_instanceof(_bmat, __d3dMaterial)? _bmat.surface : noone;
|
||||
|
||||
|
@ -53,6 +62,8 @@ function Node_3D_Mesh_Extrude(_x, _y, _group = noone) : Node_3D_Mesh(_x, _y, _gr
|
|||
var _matN = _mat.clone();
|
||||
var object = getObject(_array_index);
|
||||
object.checkParameter( {
|
||||
smooth : _smt,
|
||||
|
||||
surface : _surf,
|
||||
height : _hght,
|
||||
|
||||
|
@ -60,7 +71,10 @@ function Node_3D_Mesh_Extrude(_x, _y, _group = noone) : Node_3D_Mesh(_x, _y, _gr
|
|||
bsurface : _bsurf,
|
||||
bheight : _bhgt,
|
||||
|
||||
smooth : _smt,
|
||||
flevel_min : _flv[0],
|
||||
flevel_max : _flv[1],
|
||||
blevel_min : _blv[0],
|
||||
blevel_max : _blv[1],
|
||||
}, _updt);
|
||||
|
||||
var _dim = surface_get_dimension(_surf);
|
||||
|
|
Loading…
Reference in a new issue