mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2025-01-12 07:16:49 +01:00
[3D renderer] Fix normal not transformed by with material shift and scale properties.
This commit is contained in:
parent
db9a16ddb4
commit
8879bfb770
5 changed files with 20 additions and 10 deletions
|
@ -18,7 +18,7 @@ if !ready exit;
|
|||
|
||||
if(search_string == "") {
|
||||
catagory_pane.setFocusHover(sFOCUS, sHOVER);
|
||||
catagory_pane.draw(dialog_x + ui(8), sy);
|
||||
catagory_pane.draw(dialog_x + ui(12), sy);
|
||||
|
||||
var _x = dialog_x + category_width + ui(16);
|
||||
draw_sprite_stretched(THEME.ui_panel_bg, 1, _x, sy, dialog_w - category_width - ui(30), dialog_h - ui(66));
|
||||
|
|
|
@ -21,8 +21,11 @@ function __d3dMaterial(surface = noone) constructor {
|
|||
|
||||
static submitGeometry = function() {
|
||||
shader_set_i("use_normal", is_surface(normal));
|
||||
shader_set_surface("normal_map", normal);
|
||||
shader_set_f("normal_strength", normalStr);
|
||||
|
||||
shader_set_surface("normal_map", normal );
|
||||
shader_set_f("normal_strength", normalStr );
|
||||
shader_set_f("mat_texScale", texScale );
|
||||
shader_set_f("mat_texShift", texShift );
|
||||
}
|
||||
|
||||
static submitShader = function() {
|
||||
|
|
|
@ -205,7 +205,10 @@ function __3dObject() constructor {
|
|||
|
||||
} else if(_shader == sh_d3d_geometry) {
|
||||
if(_useMat) _mat.submitGeometry();
|
||||
else shader_set_i("use_normal", 0);
|
||||
else {
|
||||
shader_set_i("use_normal", 0);
|
||||
shader_set_f("mat_texScale", [ 1, 1 ] );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -823,7 +823,7 @@ function __initNodes() {
|
|||
addNodeObject(generator, "Repeat", s_node_repeat, "Node_Repeat", [0, Node_create_Repeat], global.node_repeat_keys, "Repeat image multiple times linearly, or in grid pattern.").setVersion(1100);
|
||||
addNodeObject(generator, "Scatter", s_node_scatter, "Node_Scatter", [1, Node_Scatter],, "Scatter image randomly multiple times.");
|
||||
addNodeObject(generator, "Repeat Texture", s_node_repeat_texture, "Node_Repeat_Texture", [1, Node_Repeat_Texture],, "Repeat texture over larger surface without repeating patterns.");
|
||||
|
||||
|
||||
ds_list_add(generator, "Simulation");
|
||||
addNodeObject(generator, "Particle", s_node_particle, "Node_Particle", [1, Node_Particle],, "Generate particle effect.");
|
||||
addNodeObject(generator, "VFX", s_node_vfx, "Node_VFX_Group_Inline", [1, Node_VFX_Group_Inline],, "Create VFX group, which generate particles that can be manipulated using different force nodes.");
|
||||
|
|
|
@ -3,15 +3,19 @@ varying vec4 v_worldPosition;
|
|||
varying vec3 v_viewPosition;
|
||||
varying vec3 v_vNormal;
|
||||
|
||||
uniform int mat_flip;
|
||||
uniform int use_normal;
|
||||
uniform int use_8bit;
|
||||
uniform float normal_strength;
|
||||
uniform sampler2D normal_map;
|
||||
uniform int mat_flip;
|
||||
uniform int use_normal;
|
||||
uniform int use_8bit;
|
||||
uniform float normal_strength;
|
||||
uniform sampler2D normal_map;
|
||||
uniform vec2 mat_texScale;
|
||||
uniform vec2 mat_texShift;
|
||||
|
||||
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);
|
||||
|
||||
vec4 mat_baseColor = texture2D( gm_BaseTexture, uv_coord );
|
||||
if(mat_baseColor.a < 0.1) discard;
|
||||
|
||||
|
|
Loading…
Reference in a new issue