mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2025-01-26 12:58:49 +01:00
- [3D Camera] Fix render result error when previewing.
This commit is contained in:
parent
47615ff56a
commit
1907b33d80
18 changed files with 564 additions and 62 deletions
|
@ -5,6 +5,7 @@
|
||||||
{"name":"_extensions","order":16,"path":"folders/_extensions.yy",},
|
{"name":"_extensions","order":16,"path":"folders/_extensions.yy",},
|
||||||
{"name":"BBMOD","order":8,"path":"folders/_extensions/BBMOD.yy",},
|
{"name":"BBMOD","order":8,"path":"folders/_extensions/BBMOD.yy",},
|
||||||
{"name":"Math","order":1,"path":"folders/_extensions/BBMOD/Math.yy",},
|
{"name":"Math","order":1,"path":"folders/_extensions/BBMOD/Math.yy",},
|
||||||
|
{"name":"GMD3D11","order":11,"path":"folders/_extensions/GMD3D11.yy",},
|
||||||
{"name":"MAC","order":6,"path":"folders/_extensions/MAC.yy",},
|
{"name":"MAC","order":6,"path":"folders/_extensions/MAC.yy",},
|
||||||
{"name":"addons","order":10,"path":"folders/addons.yy",},
|
{"name":"addons","order":10,"path":"folders/addons.yy",},
|
||||||
{"name":"custom","order":4,"path":"folders/addons/custom.yy",},
|
{"name":"custom","order":4,"path":"folders/addons/custom.yy",},
|
||||||
|
@ -1315,6 +1316,7 @@
|
||||||
{"name":"vectorBox","order":18,"path":"scripts/vectorBox/vectorBox.yy",},
|
{"name":"vectorBox","order":18,"path":"scripts/vectorBox/vectorBox.yy",},
|
||||||
{"name":"sh_3d_extrude_corner","order":7,"path":"shaders/sh_3d_extrude_corner/sh_3d_extrude_corner.yy",},
|
{"name":"sh_3d_extrude_corner","order":7,"path":"shaders/sh_3d_extrude_corner/sh_3d_extrude_corner.yy",},
|
||||||
{"name":"sh_blend_normal_dim","order":10,"path":"shaders/sh_blend_normal_dim/sh_blend_normal_dim.yy",},
|
{"name":"sh_blend_normal_dim","order":10,"path":"shaders/sh_blend_normal_dim/sh_blend_normal_dim.yy",},
|
||||||
|
{"name":"__d3d11_cbuffer","order":1,"path":"scripts/__d3d11_cbuffer/__d3d11_cbuffer.yy",},
|
||||||
{"name":"node_skew","order":11,"path":"scripts/node_skew/node_skew.yy",},
|
{"name":"node_skew","order":11,"path":"scripts/node_skew/node_skew.yy",},
|
||||||
{"name":"s_node_dot_product","order":13,"path":"sprites/s_node_dot_product/s_node_dot_product.yy",},
|
{"name":"s_node_dot_product","order":13,"path":"sprites/s_node_dot_product/s_node_dot_product.yy",},
|
||||||
{"name":"sh_downsample","order":1,"path":"shaders/sh_downsample/sh_downsample.yy",},
|
{"name":"sh_downsample","order":1,"path":"shaders/sh_downsample/sh_downsample.yy",},
|
||||||
|
@ -1353,6 +1355,7 @@
|
||||||
{"name":"node_grey_to_alpha","order":4,"path":"scripts/node_grey_to_alpha/node_grey_to_alpha.yy",},
|
{"name":"node_grey_to_alpha","order":4,"path":"scripts/node_grey_to_alpha/node_grey_to_alpha.yy",},
|
||||||
{"name":"sh_blend_add","order":7,"path":"shaders/sh_blend_add/sh_blend_add.yy",},
|
{"name":"sh_blend_add","order":7,"path":"shaders/sh_blend_add/sh_blend_add.yy",},
|
||||||
{"name":"s_node_FFT","order":15,"path":"sprites/s_node_FFT/s_node_FFT.yy",},
|
{"name":"s_node_FFT","order":15,"path":"sprites/s_node_FFT/s_node_FFT.yy",},
|
||||||
|
{"name":"__d3d11_shader","order":2,"path":"scripts/__d3d11_shader/__d3d11_shader.yy",},
|
||||||
{"name":"node_de_stray","order":1,"path":"scripts/node_de_stray/node_de_stray.yy",},
|
{"name":"node_de_stray","order":1,"path":"scripts/node_de_stray/node_de_stray.yy",},
|
||||||
{"name":"d3d_transformation","order":12,"path":"scripts/d3d_transformation/d3d_transformation.yy",},
|
{"name":"d3d_transformation","order":12,"path":"scripts/d3d_transformation/d3d_transformation.yy",},
|
||||||
{"name":"sh_channel_G","order":2,"path":"shaders/sh_channel_G/sh_channel_G.yy",},
|
{"name":"sh_channel_G","order":2,"path":"shaders/sh_channel_G/sh_channel_G.yy",},
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"BBMOD","folderPath":"folders/_extensions/BBMOD.yy",},
|
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"BBMOD","folderPath":"folders/_extensions/BBMOD.yy",},
|
||||||
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"Math","folderPath":"folders/_extensions/BBMOD/Math.yy",},
|
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"Math","folderPath":"folders/_extensions/BBMOD/Math.yy",},
|
||||||
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"Gameframe","folderPath":"folders/_extensions/Gameframe.yy",},
|
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"Gameframe","folderPath":"folders/_extensions/Gameframe.yy",},
|
||||||
|
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"GMD3D11","folderPath":"folders/_extensions/GMD3D11.yy",},
|
||||||
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"MAC","folderPath":"folders/_extensions/MAC.yy",},
|
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"MAC","folderPath":"folders/_extensions/MAC.yy",},
|
||||||
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"addons","folderPath":"folders/addons.yy",},
|
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"addons","folderPath":"folders/addons.yy",},
|
||||||
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"custom","folderPath":"folders/addons/custom.yy",},
|
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"custom","folderPath":"folders/addons/custom.yy",},
|
||||||
|
@ -667,6 +668,7 @@
|
||||||
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"gifski.dll","CopyToMask":-1,"filePath":"datafiles/gifski/win/developer",},
|
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"gifski.dll","CopyToMask":-1,"filePath":"datafiles/gifski/win/developer",},
|
||||||
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"gifski.h","CopyToMask":-1,"filePath":"datafiles/gifski/win/developer",},
|
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"gifski.h","CopyToMask":-1,"filePath":"datafiles/gifski/win/developer",},
|
||||||
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"gifski.exe","CopyToMask":-1,"filePath":"datafiles/gifski/win",},
|
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"gifski.exe","CopyToMask":-1,"filePath":"datafiles/gifski/win",},
|
||||||
|
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"GMD3D11.dll","CopyToMask":-1,"filePath":"datafiles",},
|
||||||
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"convert.exe","CopyToMask":-1,"filePath":"datafiles/ImageMagick",},
|
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"convert.exe","CopyToMask":-1,"filePath":"datafiles/ImageMagick",},
|
||||||
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"LICENSE.txt","CopyToMask":-1,"filePath":"datafiles/ImageMagick",},
|
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"LICENSE.txt","CopyToMask":-1,"filePath":"datafiles/ImageMagick",},
|
||||||
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"magick.exe","CopyToMask":-1,"filePath":"datafiles/ImageMagick",},
|
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"magick.exe","CopyToMask":-1,"filePath":"datafiles/ImageMagick",},
|
||||||
|
@ -1992,6 +1994,7 @@
|
||||||
{"id":{"name":"vectorBox","path":"scripts/vectorBox/vectorBox.yy",},},
|
{"id":{"name":"vectorBox","path":"scripts/vectorBox/vectorBox.yy",},},
|
||||||
{"id":{"name":"sh_3d_extrude_corner","path":"shaders/sh_3d_extrude_corner/sh_3d_extrude_corner.yy",},},
|
{"id":{"name":"sh_3d_extrude_corner","path":"shaders/sh_3d_extrude_corner/sh_3d_extrude_corner.yy",},},
|
||||||
{"id":{"name":"sh_blend_normal_dim","path":"shaders/sh_blend_normal_dim/sh_blend_normal_dim.yy",},},
|
{"id":{"name":"sh_blend_normal_dim","path":"shaders/sh_blend_normal_dim/sh_blend_normal_dim.yy",},},
|
||||||
|
{"id":{"name":"__d3d11_cbuffer","path":"scripts/__d3d11_cbuffer/__d3d11_cbuffer.yy",},},
|
||||||
{"id":{"name":"node_skew","path":"scripts/node_skew/node_skew.yy",},},
|
{"id":{"name":"node_skew","path":"scripts/node_skew/node_skew.yy",},},
|
||||||
{"id":{"name":"s_node_dot_product","path":"sprites/s_node_dot_product/s_node_dot_product.yy",},},
|
{"id":{"name":"s_node_dot_product","path":"sprites/s_node_dot_product/s_node_dot_product.yy",},},
|
||||||
{"id":{"name":"s_node_canvas","path":"sprites/s_node_canvas/s_node_canvas.yy",},},
|
{"id":{"name":"s_node_canvas","path":"sprites/s_node_canvas/s_node_canvas.yy",},},
|
||||||
|
@ -2037,6 +2040,7 @@
|
||||||
{"id":{"name":"node_grey_to_alpha","path":"scripts/node_grey_to_alpha/node_grey_to_alpha.yy",},},
|
{"id":{"name":"node_grey_to_alpha","path":"scripts/node_grey_to_alpha/node_grey_to_alpha.yy",},},
|
||||||
{"id":{"name":"sh_blend_add","path":"shaders/sh_blend_add/sh_blend_add.yy",},},
|
{"id":{"name":"sh_blend_add","path":"shaders/sh_blend_add/sh_blend_add.yy",},},
|
||||||
{"id":{"name":"s_node_FFT","path":"sprites/s_node_FFT/s_node_FFT.yy",},},
|
{"id":{"name":"s_node_FFT","path":"sprites/s_node_FFT/s_node_FFT.yy",},},
|
||||||
|
{"id":{"name":"__d3d11_shader","path":"scripts/__d3d11_shader/__d3d11_shader.yy",},},
|
||||||
{"id":{"name":"node_de_stray","path":"scripts/node_de_stray/node_de_stray.yy",},},
|
{"id":{"name":"node_de_stray","path":"scripts/node_de_stray/node_de_stray.yy",},},
|
||||||
{"id":{"name":"d3d_transformation","path":"scripts/d3d_transformation/d3d_transformation.yy",},},
|
{"id":{"name":"d3d_transformation","path":"scripts/d3d_transformation/d3d_transformation.yy",},},
|
||||||
{"id":{"name":"sh_channel_G","path":"shaders/sh_channel_G/sh_channel_G.yy",},},
|
{"id":{"name":"sh_channel_G","path":"shaders/sh_channel_G/sh_channel_G.yy",},},
|
||||||
|
@ -2092,6 +2096,7 @@
|
||||||
{"id":{"name":"node_action_object","path":"scripts/node_action_object/node_action_object.yy",},},
|
{"id":{"name":"node_action_object","path":"scripts/node_action_object/node_action_object.yy",},},
|
||||||
{"id":{"name":"s_node_pb_box_divide","path":"sprites/s_node_pb_box_divide/s_node_pb_box_divide.yy",},},
|
{"id":{"name":"s_node_pb_box_divide","path":"sprites/s_node_pb_box_divide/s_node_pb_box_divide.yy",},},
|
||||||
{"id":{"name":"bin_function","path":"scripts/bin_function/bin_function.yy",},},
|
{"id":{"name":"bin_function","path":"scripts/bin_function/bin_function.yy",},},
|
||||||
|
{"id":{"name":"__d3d11","path":"scripts/__d3d11/__d3d11.yy",},},
|
||||||
{"id":{"name":"s_node_feedback_output","path":"sprites/s_node_feedback_output/s_node_feedback_output.yy",},},
|
{"id":{"name":"s_node_feedback_output","path":"sprites/s_node_feedback_output/s_node_feedback_output.yy",},},
|
||||||
{"id":{"name":"sh_fd_repulse","path":"shaders/sh_fd_repulse/sh_fd_repulse.yy",},},
|
{"id":{"name":"sh_fd_repulse","path":"shaders/sh_fd_repulse/sh_fd_repulse.yy",},},
|
||||||
{"id":{"name":"sh_surface_replace_fast_find","path":"shaders/sh_surface_replace_fast_find/sh_surface_replace_fast_find.yy",},},
|
{"id":{"name":"sh_surface_replace_fast_find","path":"shaders/sh_surface_replace_fast_find/sh_surface_replace_fast_find.yy",},},
|
||||||
|
|
BIN
datafiles/GMD3D11.dll
Normal file
BIN
datafiles/GMD3D11.dll
Normal file
Binary file not shown.
124
scripts/__d3d11/__d3d11.gml
Normal file
124
scripts/__d3d11/__d3d11.gml
Normal file
|
@ -0,0 +1,124 @@
|
||||||
|
/// @macro {String} Path to the GMD3D11 dynamic library.
|
||||||
|
/// Default value is "GMD3D11.dll".
|
||||||
|
#macro GMD3D11_PATH "GMD3D11.dll"
|
||||||
|
|
||||||
|
/// @macro {Bool} Expands to `true` if GMD3D11 is supported on the current
|
||||||
|
/// platform.
|
||||||
|
#macro GMD3D11_IS_SUPPORTED (os_type == os_windows)
|
||||||
|
|
||||||
|
/// @func d3d11_get_error_string()
|
||||||
|
///
|
||||||
|
/// @desc Retrieves the last error message.
|
||||||
|
///
|
||||||
|
/// @return {String} The last error message.
|
||||||
|
function d3d11_get_error_string()
|
||||||
|
{
|
||||||
|
gml_pragma("forceinline");
|
||||||
|
static _fn = external_define(
|
||||||
|
GMD3D11_PATH, "d3d11_get_error_string", dll_cdecl, ty_string,
|
||||||
|
0);
|
||||||
|
return external_call(_fn);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @func d3d11_texture_set_stage_vs(_slot, _texture)
|
||||||
|
///
|
||||||
|
/// @desc Passes a texture to a vertex shader.
|
||||||
|
///
|
||||||
|
/// @param {Real} _slot The vertex texture slot index. Must be in range
|
||||||
|
/// 0..{@link D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT}-1.
|
||||||
|
/// @param {Pointer.Texture} _texture The texture to pass.
|
||||||
|
///
|
||||||
|
/// @return {Real} Returns 1 on success or 0 on fail.
|
||||||
|
function d3d11_texture_set_stage_vs(_slot, _texture)
|
||||||
|
{
|
||||||
|
gml_pragma("forceinline");
|
||||||
|
static _fn = external_define(
|
||||||
|
GMD3D11_PATH, "d3d11_texture_set_stage_vs", dll_cdecl, ty_real,
|
||||||
|
1, ty_real);
|
||||||
|
texture_set_stage(0, _texture);
|
||||||
|
return external_call(_fn, _slot);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @func texture_set_stage_vs(_slot, _texture)
|
||||||
|
///
|
||||||
|
/// @desc If GMD3D11 is supported, then uses {@link d3d11_texture_set_stage_vs}
|
||||||
|
/// to pass a texture to a vertex shader, otherwise uses `texture_set_stage`
|
||||||
|
/// (which should work on OpenGL platforms).
|
||||||
|
///
|
||||||
|
/// @param {Real} _slot The vertex texture slot index. Must be in range 0..7.
|
||||||
|
/// @param {Pointer.Texture} _texture The texture to pass.
|
||||||
|
///
|
||||||
|
/// @see GMD3D11_IS_SUPPORTED
|
||||||
|
function texture_set_stage_vs(_slot, _texture)
|
||||||
|
{
|
||||||
|
gml_pragma("forceinline");
|
||||||
|
if (GMD3D11_IS_SUPPORTED)
|
||||||
|
{
|
||||||
|
d3d11_texture_set_stage_vs(_slot, _texture);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
texture_set_stage(_slot, _texture);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @func d3d11_texture_set_stage_ps(_slot, _texture)
|
||||||
|
///
|
||||||
|
/// @desc Passes a texture to a pixel shader.
|
||||||
|
///
|
||||||
|
/// @param {Real} _slot The pixel texture slot index. Must be in range
|
||||||
|
/// 0..{@link D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT}-1.
|
||||||
|
/// @param {Pointer.Texture} _texture The texture to pass.
|
||||||
|
///
|
||||||
|
/// @return {Real} Returns 1 on success or 0 on fail.
|
||||||
|
function d3d11_texture_set_stage_ps(_slot, _texture)
|
||||||
|
{
|
||||||
|
gml_pragma("forceinline");
|
||||||
|
static _fn = external_define(
|
||||||
|
GMD3D11_PATH, "d3d11_texture_set_stage_ps", dll_cdecl, ty_real,
|
||||||
|
1, ty_real);
|
||||||
|
texture_set_stage(0, _texture);
|
||||||
|
return external_call(_fn, _slot);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @func d3d11_draw_instanced(_count)
|
||||||
|
///
|
||||||
|
/// @desc Configures the number of instances to draw the next time a vertex buffer
|
||||||
|
/// is submitted. After that the number is reset back to 0!
|
||||||
|
///
|
||||||
|
/// @param {Real} _count Number of instances to draw. Use 0 to disable instanced rendering.
|
||||||
|
function d3d11_draw_instanced(_count)
|
||||||
|
{
|
||||||
|
gml_pragma("forceinline");
|
||||||
|
static _fn = external_define(
|
||||||
|
GMD3D11_PATH, "d3d11_draw_instanced", dll_cdecl, ty_real,
|
||||||
|
1, ty_real);
|
||||||
|
return external_call(_fn, _count);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @func vertex_submit_instanced(_vbuff, _prim, _texture, _count)
|
||||||
|
///
|
||||||
|
/// @desc Draws multiple instances of a vertex buffer.
|
||||||
|
///
|
||||||
|
/// @param {Id.VertexBuffer} _vbuff The vertex buffer to submit.
|
||||||
|
/// @param {Constant.PrimitiveType} _prim The primitive type.
|
||||||
|
/// @param {Pointer.Texture} _texture The texture to use.
|
||||||
|
/// @param {Real} _count The number of instances to draw.
|
||||||
|
function vertex_submit_instanced(_vbuff, _prim, _texture, _count)
|
||||||
|
{
|
||||||
|
gml_pragma("forceinline");
|
||||||
|
if (!d3d11_draw_instanced(_count))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
vertex_submit(_vbuff, _prim, _texture);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GMD3D11_IS_SUPPORTED)
|
||||||
|
{
|
||||||
|
var _init = external_define(
|
||||||
|
GMD3D11_PATH, "d3d11_init", dll_cdecl, ty_real, 2, ty_string, ty_string);
|
||||||
|
var _osInfo = os_get_info();
|
||||||
|
var _device = _osInfo[? "video_d3d11_device"];
|
||||||
|
var _context = _osInfo[? "video_d3d11_context"];
|
||||||
|
external_call(_init, _device, _context);
|
||||||
|
}
|
11
scripts/__d3d11/__d3d11.yy
Normal file
11
scripts/__d3d11/__d3d11.yy
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"resourceType": "GMScript",
|
||||||
|
"resourceVersion": "1.0",
|
||||||
|
"name": "__d3d11",
|
||||||
|
"isCompatibility": false,
|
||||||
|
"isDnD": false,
|
||||||
|
"parent": {
|
||||||
|
"name": "GMD3D11",
|
||||||
|
"path": "folders/_extensions/GMD3D11.yy",
|
||||||
|
},
|
||||||
|
}
|
183
scripts/__d3d11_cbuffer/__d3d11_cbuffer.gml
Normal file
183
scripts/__d3d11_cbuffer/__d3d11_cbuffer.gml
Normal file
|
@ -0,0 +1,183 @@
|
||||||
|
/// @func d3d11_cbuffer_begin()
|
||||||
|
///
|
||||||
|
/// @desc Starts building a constant buffer.
|
||||||
|
///
|
||||||
|
/// @see d3d11_cbuffer_end
|
||||||
|
function d3d11_cbuffer_begin()
|
||||||
|
{
|
||||||
|
gml_pragma("forceinline");
|
||||||
|
static _fn = external_define(
|
||||||
|
GMD3D11_PATH, "d3d11_cbuffer_begin", dll_cdecl, ty_real,
|
||||||
|
0);
|
||||||
|
return external_call(_fn);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @func d3d11_cbuffer_end()
|
||||||
|
///
|
||||||
|
/// @desc Finishes building a constant buffer.
|
||||||
|
///
|
||||||
|
/// @return {Real} The ID of the created constant buffer or -1 on fail.
|
||||||
|
///
|
||||||
|
/// @see d3d11_cbuffer_exists
|
||||||
|
/// @see d3d11_cbuffer_update
|
||||||
|
function d3d11_cbuffer_end()
|
||||||
|
{
|
||||||
|
gml_pragma("forceinline");
|
||||||
|
static _fn = external_define(
|
||||||
|
GMD3D11_PATH, "d3d11_cbuffer_end", dll_cdecl, ty_real,
|
||||||
|
0);
|
||||||
|
return external_call(_fn);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @func d3d11_cbuffer_add_bool(_count)
|
||||||
|
///
|
||||||
|
/// @desc Adds a bool into a constant buffer that is currently being built.
|
||||||
|
///
|
||||||
|
/// @param {Real} _count Number of bools to add into the constant buffer.
|
||||||
|
///
|
||||||
|
/// @see d3d11_cbuffer_begin
|
||||||
|
function d3d11_cbuffer_add_bool(_count)
|
||||||
|
{
|
||||||
|
gml_pragma("forceinline");
|
||||||
|
static _fn = external_define(
|
||||||
|
GMD3D11_PATH, "d3d11_cbuffer_add_bool", dll_cdecl, ty_real,
|
||||||
|
1, ty_real);
|
||||||
|
return external_call(_fn, _count);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @func d3d11_cbuffer_add_int(_count)
|
||||||
|
///
|
||||||
|
/// @desc Adds an int into a constant buffer that is currently being built.
|
||||||
|
///
|
||||||
|
/// @param {Real} _count Number of ints to add into the constant buffer.
|
||||||
|
///
|
||||||
|
/// @see d3d11_cbuffer_begin
|
||||||
|
function d3d11_cbuffer_add_int(_count)
|
||||||
|
{
|
||||||
|
gml_pragma("forceinline");
|
||||||
|
static _fn = external_define(
|
||||||
|
GMD3D11_PATH, "d3d11_cbuffer_add_int", dll_cdecl, ty_real,
|
||||||
|
1, ty_real);
|
||||||
|
return external_call(_fn, _count);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @func d3d11_cbuffer_add_uint(_count)
|
||||||
|
///
|
||||||
|
/// @desc Adds an uint into a constant buffer that is currently being built.
|
||||||
|
///
|
||||||
|
/// @param {Real} _count Number of uints to add into the constant buffer.
|
||||||
|
///
|
||||||
|
/// @see d3d11_cbuffer_begin
|
||||||
|
function d3d11_cbuffer_add_uint(_count)
|
||||||
|
{
|
||||||
|
gml_pragma("forceinline");
|
||||||
|
static _fn = external_define(
|
||||||
|
GMD3D11_PATH, "d3d11_cbuffer_add_uint", dll_cdecl, ty_real,
|
||||||
|
1, ty_real);
|
||||||
|
return external_call(_fn, _count);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @func d3d11_cbuffer_add_float(_count)
|
||||||
|
///
|
||||||
|
/// @desc Adds a float into a constant buffer that is currently being built.
|
||||||
|
///
|
||||||
|
/// @param {Real} _count Number of floats to add into the constant buffer.
|
||||||
|
///
|
||||||
|
/// @see d3d11_cbuffer_begin
|
||||||
|
function d3d11_cbuffer_add_float(_count)
|
||||||
|
{
|
||||||
|
gml_pragma("forceinline");
|
||||||
|
static _fn = external_define(
|
||||||
|
GMD3D11_PATH, "d3d11_cbuffer_add_float", dll_cdecl, ty_real,
|
||||||
|
1, ty_real);
|
||||||
|
return external_call(_fn, _count);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @func d3d11_cbuffer_get_size(_cbuffer)
|
||||||
|
///
|
||||||
|
/// @desc Retrieves size of a constant buffer in bytes.
|
||||||
|
///
|
||||||
|
/// @param {Real} The size of the constant buffer in bytes.
|
||||||
|
function d3d11_cbuffer_get_size(_cbuffer)
|
||||||
|
{
|
||||||
|
gml_pragma("forceinline");
|
||||||
|
static _fn = external_define(
|
||||||
|
GMD3D11_PATH, "d3d11_cbuffer_get_size", dll_cdecl, ty_real,
|
||||||
|
1, ty_real);
|
||||||
|
return external_call(_fn, _cbuffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @func d3d11_cbuffer_update(_cbuffer, _buffer)
|
||||||
|
///
|
||||||
|
/// @desc Updates data of a constant buffer.
|
||||||
|
///
|
||||||
|
/// @param {Real} _cbuffer The ID of the constant buffer.
|
||||||
|
/// @param {Id.Buffer} _buffer A buffer with new data.
|
||||||
|
function d3d11_cbuffer_update(_cbuffer, _buffer)
|
||||||
|
{
|
||||||
|
gml_pragma("forceinline");
|
||||||
|
static _fn = external_define(
|
||||||
|
GMD3D11_PATH, "d3d11_cbuffer_update", dll_cdecl, ty_real,
|
||||||
|
2, ty_real, ty_string);
|
||||||
|
return external_call(_fn, _cbuffer, buffer_get_address(_buffer));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @func d3d11_shader_set_cbuffer_ps(_slot, _cbuffer)
|
||||||
|
///
|
||||||
|
/// @desc Binds a constant buffer to a pixel shader.
|
||||||
|
///
|
||||||
|
/// @param {Real} _slot The slot to bind the constant buffer to.
|
||||||
|
/// @param {Real} _cbuffer The ID of the constant buffer or -1 to ubind the slot.
|
||||||
|
function d3d11_shader_set_cbuffer_ps(_slot, _cbuffer)
|
||||||
|
{
|
||||||
|
gml_pragma("forceinline");
|
||||||
|
static _fn = external_define(
|
||||||
|
GMD3D11_PATH, "d3d11_shader_set_cbuffer_ps", dll_cdecl, ty_real,
|
||||||
|
2, ty_real, ty_real);
|
||||||
|
return external_call(_fn, _slot, _cbuffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @func d3d11_shader_set_cbuffer_vs(_slot, _cbuffer)
|
||||||
|
///
|
||||||
|
/// @desc Binds a constant buffer to a vertex shader.
|
||||||
|
///
|
||||||
|
/// @param {Real} _slot The slot to bind the constant buffer to.
|
||||||
|
/// @param {Real} _cbuffer The ID of the constant buffer or -1 to ubind the slot.
|
||||||
|
function d3d11_shader_set_cbuffer_vs(_slot, _cbuffer)
|
||||||
|
{
|
||||||
|
gml_pragma("forceinline");
|
||||||
|
static _fn = external_define(
|
||||||
|
GMD3D11_PATH, "d3d11_shader_set_cbuffer_vs", dll_cdecl, ty_real,
|
||||||
|
2, ty_real, ty_real);
|
||||||
|
return external_call(_fn, _slot, _cbuffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @func d3d11_cbuffer_exists(_cbuffer)
|
||||||
|
///
|
||||||
|
/// @desc Checks whether a constant buffer exists.
|
||||||
|
///
|
||||||
|
/// @param {Real} _cbuffer The ID of the comand buffer.
|
||||||
|
///
|
||||||
|
/// @return {Bool} Returns true if the constant buffer exists.
|
||||||
|
function d3d11_cbuffer_exists(_cbuffer)
|
||||||
|
{
|
||||||
|
gml_pragma("forceinline");
|
||||||
|
static _fn = external_define(
|
||||||
|
GMD3D11_PATH, "d3d11_cbuffer_exists", dll_cdecl, ty_real,
|
||||||
|
1, ty_real);
|
||||||
|
return external_call(_fn, _cbuffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @func d3d11_cbuffer_destroy(_cbuffer)
|
||||||
|
///
|
||||||
|
/// @desc Destroys a constant buffer.
|
||||||
|
///
|
||||||
|
/// @param {Real} _cbuffer The ID of the constant buffer to destroy.
|
||||||
|
function d3d11_cbuffer_destroy(_cbuffer)
|
||||||
|
{
|
||||||
|
gml_pragma("forceinline");
|
||||||
|
static _fn = external_define(
|
||||||
|
GMD3D11_PATH, "d3d11_cbuffer_destroy", dll_cdecl, ty_real,
|
||||||
|
1, ty_real);
|
||||||
|
return external_call(_fn, _cbuffer);
|
||||||
|
}
|
11
scripts/__d3d11_cbuffer/__d3d11_cbuffer.yy
Normal file
11
scripts/__d3d11_cbuffer/__d3d11_cbuffer.yy
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"resourceType": "GMScript",
|
||||||
|
"resourceVersion": "1.0",
|
||||||
|
"name": "__d3d11_cbuffer",
|
||||||
|
"isCompatibility": false,
|
||||||
|
"isDnD": false,
|
||||||
|
"parent": {
|
||||||
|
"name": "GMD3D11",
|
||||||
|
"path": "folders/_extensions/GMD3D11.yy",
|
||||||
|
},
|
||||||
|
}
|
104
scripts/__d3d11_shader/__d3d11_shader.gml
Normal file
104
scripts/__d3d11_shader/__d3d11_shader.gml
Normal file
|
@ -0,0 +1,104 @@
|
||||||
|
/// @macro {Real} Maximum number of slots for shader resources.
|
||||||
|
#macro D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT 128
|
||||||
|
|
||||||
|
/// @func d3d11_shader_compile_ps(_file, _entryPoint, _profile)
|
||||||
|
///
|
||||||
|
/// @desc Compiles a pixel shader from file.
|
||||||
|
///
|
||||||
|
/// @param {String} _file The path to file to compile.
|
||||||
|
/// @param {String} _entryPoint The name of the entry point function, e.g. "main".
|
||||||
|
/// @param {String} _profile The pixel shader profile, e.g. "ps_4_0".
|
||||||
|
///
|
||||||
|
/// @return {Real} The ID of the pixel shader or -1 on fail.
|
||||||
|
///
|
||||||
|
/// @see d3d11_get_error_string
|
||||||
|
function d3d11_shader_compile_ps(_file, _entryPoint, _profile)
|
||||||
|
{
|
||||||
|
gml_pragma("forceinline");
|
||||||
|
static _fn = external_define(
|
||||||
|
GMD3D11_PATH, "d3d11_shader_compile_ps", dll_cdecl, ty_real,
|
||||||
|
3, ty_string, ty_string, ty_string);
|
||||||
|
return external_call(_fn, _file, _entryPoint, _profile);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @func d3d11_shader_compile_vs(_file, _entryPoint, _profile)
|
||||||
|
///
|
||||||
|
/// @desc Compiles a vertex shader from file.
|
||||||
|
///
|
||||||
|
/// @param {String} _file The path to file to compile.
|
||||||
|
/// @param {String} _entryPoint The name of the entry point function, e.g. "main".
|
||||||
|
/// @param {String} _profile The vertex shader profile, e.g. "vs_4_0".
|
||||||
|
///
|
||||||
|
/// @return {Real} The ID of the vertex shader or -1 on fail.
|
||||||
|
///
|
||||||
|
/// @see d3d11_get_error_string
|
||||||
|
function d3d11_shader_compile_vs(_file, _entryPoint, _profile)
|
||||||
|
{
|
||||||
|
gml_pragma("forceinline");
|
||||||
|
static _fn = external_define(
|
||||||
|
GMD3D11_PATH, "d3d11_shader_compile_vs", dll_cdecl, ty_real,
|
||||||
|
3, ty_string, ty_string, ty_string);
|
||||||
|
return external_call(_fn, _file, _entryPoint, _profile);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @func d3d11_shader_override_ps(_ps)
|
||||||
|
///
|
||||||
|
/// @desc Hooks into `ID3D11DeviceContext::Draw` and replaces the current pixel
|
||||||
|
/// shader with a custom one.
|
||||||
|
///
|
||||||
|
/// @param {Real} _ps The ID of the shader or -1 to disable the override.
|
||||||
|
function d3d11_shader_override_ps(_ps)
|
||||||
|
{
|
||||||
|
gml_pragma("forceinline");
|
||||||
|
static _fn = external_define(
|
||||||
|
GMD3D11_PATH, "d3d11_shader_override_ps", dll_cdecl, ty_real,
|
||||||
|
1, ty_real);
|
||||||
|
return external_call(_fn, _ps);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @func d3d11_shader_override_vs(_vs)
|
||||||
|
///
|
||||||
|
/// @desc Hooks into `ID3D11DeviceContext::Draw` and replaces the current vertex
|
||||||
|
/// shader with a custom one.
|
||||||
|
///
|
||||||
|
/// @param {Real} _vs The ID of the shader or -1 to disable the override. The
|
||||||
|
/// vertex format expected by the shader must be compatible with the overriden
|
||||||
|
/// shader!
|
||||||
|
function d3d11_shader_override_vs(_vs)
|
||||||
|
{
|
||||||
|
gml_pragma("forceinline");
|
||||||
|
static _fn = external_define(
|
||||||
|
GMD3D11_PATH, "d3d11_shader_override_vs", dll_cdecl, ty_real,
|
||||||
|
1, ty_real);
|
||||||
|
return external_call(_fn, _vs);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @func d3d11_shader_exists(_shader)
|
||||||
|
///
|
||||||
|
/// @desc Checks whether a shader exists.
|
||||||
|
///
|
||||||
|
/// @param {Real} _ps The ID of the shader.
|
||||||
|
///
|
||||||
|
/// @return {Bool} Returns true if the shader exists.
|
||||||
|
function d3d11_shader_exists(_shader)
|
||||||
|
{
|
||||||
|
gml_pragma("forceinline");
|
||||||
|
static _fn = external_define(
|
||||||
|
GMD3D11_PATH, "d3d11_shader_exists", dll_cdecl, ty_real,
|
||||||
|
1, ty_real);
|
||||||
|
return external_call(_fn, _shader);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @func d3d11_shader_destroy(_shader)
|
||||||
|
///
|
||||||
|
/// @desc Destroys a shader.
|
||||||
|
///
|
||||||
|
/// @param {Real} _shader The ID of the shader to destroy.
|
||||||
|
function d3d11_shader_destroy(_shader)
|
||||||
|
{
|
||||||
|
gml_pragma("forceinline");
|
||||||
|
static _fn = external_define(
|
||||||
|
GMD3D11_PATH, "d3d11_shader_destroy", dll_cdecl, ty_real,
|
||||||
|
1, ty_real);
|
||||||
|
return external_call(_fn, _shader);
|
||||||
|
}
|
11
scripts/__d3d11_shader/__d3d11_shader.yy
Normal file
11
scripts/__d3d11_shader/__d3d11_shader.yy
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"resourceType": "GMScript",
|
||||||
|
"resourceVersion": "1.0",
|
||||||
|
"name": "__d3d11_shader",
|
||||||
|
"isCompatibility": false,
|
||||||
|
"isDnD": false,
|
||||||
|
"parent": {
|
||||||
|
"name": "GMD3D11",
|
||||||
|
"path": "folders/_extensions/GMD3D11.yy",
|
||||||
|
},
|
||||||
|
}
|
|
@ -46,7 +46,7 @@ function Node_3D(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constr
|
||||||
gpu_set_ztestenable(true);
|
gpu_set_ztestenable(true);
|
||||||
gpu_set_cullmode(cull_noculling);
|
gpu_set_cullmode(cull_noculling);
|
||||||
|
|
||||||
D3D_GLOBAL_PREVIEW.applyCamera();
|
D3D_GLOBAL_PREVIEW.camera.applyCamera();
|
||||||
D3D_GLOBAL_PREVIEW.apply();
|
D3D_GLOBAL_PREVIEW.apply();
|
||||||
|
|
||||||
for( var i = 0, n = array_length(_prev_obj); i < n; i++ ) {
|
for( var i = 0, n = array_length(_prev_obj); i < n; i++ ) {
|
||||||
|
@ -66,7 +66,7 @@ function Node_3D(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constr
|
||||||
}
|
}
|
||||||
surface_reset_target();
|
surface_reset_target();
|
||||||
|
|
||||||
D3D_GLOBAL_PREVIEW.resetCamera();
|
D3D_GLOBAL_PREVIEW.camera.resetCamera();
|
||||||
} #endregion
|
} #endregion
|
||||||
|
|
||||||
static postUpdate = function() { refreshPreview(); }
|
static postUpdate = function() { refreshPreview(); }
|
||||||
|
|
|
@ -23,6 +23,23 @@ function Panel_Linear_Setting() : PanelContent() constructor {
|
||||||
var _prop = properties[i];
|
var _prop = properties[i];
|
||||||
|
|
||||||
var _widg = _prop[0];
|
var _widg = _prop[0];
|
||||||
|
|
||||||
|
if(is_string(_widg)) {
|
||||||
|
var _text = _prop[0];
|
||||||
|
var _spr = _prop[1];
|
||||||
|
var _ind = _prop[2];
|
||||||
|
var _colr = _prop[3];
|
||||||
|
|
||||||
|
draw_sprite_stretched_ext(THEME.group_label, 0, ui(4), yy - th / 2 + ui(2), w - ui(8), th - ui(4), _colr, 1);
|
||||||
|
draw_sprite_ui(_spr, _ind, ui(4) + th / 2, yy);
|
||||||
|
|
||||||
|
draw_set_text(f_p1, fa_left, fa_center, COLORS._main_text);
|
||||||
|
draw_text_add(ui(4) + th, yy, _text);
|
||||||
|
|
||||||
|
yy += th;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
var _text = _prop[1];
|
var _text = _prop[1];
|
||||||
var _data = _prop[2]();
|
var _data = _prop[2]();
|
||||||
|
|
||||||
|
|
|
@ -37,9 +37,9 @@ function __3dScene(camera) constructor {
|
||||||
|
|
||||||
lightAmbient = c_black;
|
lightAmbient = c_black;
|
||||||
lightDir_max = 16;
|
lightDir_max = 16;
|
||||||
lightDir_shadow_max = 2;
|
lightDir_shadow_max = 4;
|
||||||
lightPnt_max = 16;
|
lightPnt_max = 16;
|
||||||
lightPnt_shadow_max = 2;
|
lightPnt_shadow_max = 4;
|
||||||
|
|
||||||
cull_mode = cull_noculling;
|
cull_mode = cull_noculling;
|
||||||
enviroment_map = noone;
|
enviroment_map = noone;
|
||||||
|
@ -52,10 +52,7 @@ function __3dScene(camera) constructor {
|
||||||
|
|
||||||
show_normal = false;
|
show_normal = false;
|
||||||
|
|
||||||
geometry_data = [ noone, noone, noone ];
|
|
||||||
|
|
||||||
ssao_enabled = false;
|
ssao_enabled = false;
|
||||||
ssao = noone;
|
|
||||||
ssao_sample = 32;
|
ssao_sample = 32;
|
||||||
ssao_radius = 0.1;
|
ssao_radius = 0.1;
|
||||||
ssao_bias = 0.1;
|
ssao_bias = 0.1;
|
||||||
|
@ -88,9 +85,6 @@ function __3dScene(camera) constructor {
|
||||||
lightPnt_shadowBias = [];
|
lightPnt_shadowBias = [];
|
||||||
} reset(); #endregion
|
} reset(); #endregion
|
||||||
|
|
||||||
static applyCamera = function() { camera.applyCamera(); }
|
|
||||||
static resetCamera = function() { camera.resetCamera(); }
|
|
||||||
|
|
||||||
static _submit = function(callback, object, shader = noone) {
|
static _submit = function(callback, object, shader = noone) {
|
||||||
matrix_stack_clear();
|
matrix_stack_clear();
|
||||||
if(apply_transform) custom_transform.submitMatrix();
|
if(apply_transform) custom_transform.submitMatrix();
|
||||||
|
@ -104,8 +98,10 @@ function __3dScene(camera) constructor {
|
||||||
static submitShader = function(object, shader = noone) { _submit(function(object, shader) { object.submitShader (self, shader); }, object, shader) }
|
static submitShader = function(object, shader = noone) { _submit(function(object, shader) { object.submitShader (self, shader); }, object, shader) }
|
||||||
|
|
||||||
static deferPass = function(object, w, h) { #region
|
static deferPass = function(object, w, h) { #region
|
||||||
geometryPass(object, w, h);
|
var geometry_data = geometryPass(object, w, h);
|
||||||
ssaoPass();
|
var ssao = ssaoPass(geometry_data);
|
||||||
|
|
||||||
|
return { geometry_data, ssao };
|
||||||
} #endregion
|
} #endregion
|
||||||
|
|
||||||
static renderBackground = function(w, h) { #region
|
static renderBackground = function(w, h) { #region
|
||||||
|
@ -132,6 +128,7 @@ function __3dScene(camera) constructor {
|
||||||
} #endregion
|
} #endregion
|
||||||
|
|
||||||
static geometryPass = function(object, w = 512, h = 512) { #region
|
static geometryPass = function(object, w = 512, h = 512) { #region
|
||||||
|
var geometry_data = [ noone, noone, noone ];
|
||||||
geometry_data[0] = surface_verify(geometry_data[0], w, h, surface_rgba32float);
|
geometry_data[0] = surface_verify(geometry_data[0], w, h, surface_rgba32float);
|
||||||
geometry_data[1] = surface_verify(geometry_data[1], w, h, surface_rgba32float);
|
geometry_data[1] = surface_verify(geometry_data[1], w, h, surface_rgba32float);
|
||||||
geometry_data[2] = surface_verify(geometry_data[2], w, h, surface_rgba32float);
|
geometry_data[2] = surface_verify(geometry_data[2], w, h, surface_rgba32float);
|
||||||
|
@ -144,7 +141,7 @@ function __3dScene(camera) constructor {
|
||||||
|
|
||||||
DRAW_CLEAR
|
DRAW_CLEAR
|
||||||
camera.setMatrix();
|
camera.setMatrix();
|
||||||
applyCamera();
|
camera.applyCamera();
|
||||||
|
|
||||||
gpu_set_cullmode(cull_mode);
|
gpu_set_cullmode(cull_mode);
|
||||||
|
|
||||||
|
@ -169,10 +166,11 @@ function __3dScene(camera) constructor {
|
||||||
surface_free(geometry_data[2]);
|
surface_free(geometry_data[2]);
|
||||||
geometry_data[2] = _normal_blurred;
|
geometry_data[2] = _normal_blurred;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return geometry_data;
|
||||||
} #endregion
|
} #endregion
|
||||||
|
|
||||||
static ssaoPass = function() { #region
|
static ssaoPass = function(geometry_data) { #region
|
||||||
surface_free_safe(ssao);
|
|
||||||
if(!ssao_enabled) return;
|
if(!ssao_enabled) return;
|
||||||
|
|
||||||
var _sw = surface_get_width(geometry_data[0]);
|
var _sw = surface_get_width(geometry_data[0]);
|
||||||
|
@ -201,17 +199,17 @@ function __3dScene(camera) constructor {
|
||||||
|
|
||||||
surface_free(_ssao_surf);
|
surface_free(_ssao_surf);
|
||||||
|
|
||||||
ssao = _ssao_blur;
|
return _ssao_blur;
|
||||||
} #endregion
|
} #endregion
|
||||||
|
|
||||||
static apply = function() { #region
|
static apply = function(deferData = noone) { #region
|
||||||
shader_set(sh_d3d_default);
|
shader_set(sh_d3d_default);
|
||||||
#region ---- background ----
|
#region ---- background ----
|
||||||
shader_set_f("light_ambient", colToVec4(lightAmbient));
|
shader_set_f("light_ambient", colToVec4(lightAmbient));
|
||||||
shader_set_i("env_use_mapping", is_surface(enviroment_map) );
|
shader_set_i("env_use_mapping", is_surface(enviroment_map) );
|
||||||
shader_set_surface("env_map", enviroment_map, false, true );
|
shader_set_surface("env_map", enviroment_map, false, true );
|
||||||
shader_set_dim("env_map_dimension", enviroment_map );
|
shader_set_dim("env_map_dimension", enviroment_map );
|
||||||
shader_set_surface("ao_map", ssao );
|
if(deferData != noone) shader_set_surface("ao_map", deferData.ssao );
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
shader_set_i("light_dir_count", lightDir_count); #region
|
shader_set_i("light_dir_count", lightDir_count); #region
|
||||||
|
@ -241,9 +239,9 @@ function __3dScene(camera) constructor {
|
||||||
shader_set_f("light_pnt_shadow_bias", lightPnt_shadowBias);
|
shader_set_f("light_pnt_shadow_bias", lightPnt_shadowBias);
|
||||||
} #endregion
|
} #endregion
|
||||||
|
|
||||||
if(defer_normal && array_length(geometry_data) > 2) {
|
if(defer_normal && deferData != noone && array_length(deferData.geometry_data) > 2) {
|
||||||
shader_set_i("mat_defer_normal", 1);
|
shader_set_i("mat_defer_normal", 1);
|
||||||
shader_set_surface("mat_normal_map", geometry_data[2]);
|
shader_set_surface("mat_normal_map", deferData.geometry_data[2]);
|
||||||
} else
|
} else
|
||||||
shader_set_i("mat_defer_normal", 0);
|
shader_set_i("mat_defer_normal", 0);
|
||||||
|
|
||||||
|
@ -255,6 +253,8 @@ function __3dScene(camera) constructor {
|
||||||
|
|
||||||
shader_set_f("viewProjMat", camera.getCombinedMatrix() );
|
shader_set_f("viewProjMat", camera.getCombinedMatrix() );
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
//print($"Submitting scene with {lightDir_count} dir, {lightPnt_count} pnt lights.");
|
||||||
shader_reset();
|
shader_reset();
|
||||||
} #endregion
|
} #endregion
|
||||||
|
|
||||||
|
|
|
@ -101,10 +101,10 @@
|
||||||
|
|
||||||
globalvar VERSION, SAVE_VERSION, VERSION_STRING, BUILD_NUMBER;
|
globalvar VERSION, SAVE_VERSION, VERSION_STRING, BUILD_NUMBER;
|
||||||
|
|
||||||
VERSION = 11510;
|
VERSION = 11520;
|
||||||
SAVE_VERSION = 11500;
|
SAVE_VERSION = 11500;
|
||||||
VERSION_STRING = "1.15.1.0";
|
VERSION_STRING = "1.15.2.0";
|
||||||
BUILD_NUMBER = 11510;
|
BUILD_NUMBER = 11520;
|
||||||
|
|
||||||
globalvar APPEND_MAP;
|
globalvar APPEND_MAP;
|
||||||
APPEND_MAP = ds_map_create();
|
APPEND_MAP = ds_map_create();
|
||||||
|
|
|
@ -126,9 +126,9 @@ function Node_3D_Camera(_x, _y, _group = noone) : Node_3D_Object(_x, _y, _group)
|
||||||
}
|
}
|
||||||
} #endregion
|
} #endregion
|
||||||
|
|
||||||
static onValueUpdate = function(index) {
|
static onValueUpdate = function(index) { #region
|
||||||
if(index == in_d3d + 9) PANEL_PREVIEW.tool_current = noone;
|
if(index == in_d3d + 9) PANEL_PREVIEW.tool_current = noone;
|
||||||
}
|
} #endregion
|
||||||
|
|
||||||
static step = function() { #region
|
static step = function() { #region
|
||||||
var _proj = inputs[| in_d3d + 3].getValue();
|
var _proj = inputs[| in_d3d + 3].getValue();
|
||||||
|
@ -261,11 +261,10 @@ function Node_3D_Camera(_x, _y, _group = noone) : Node_3D_Object(_x, _y, _group)
|
||||||
scene.ssao_bias = _aoBi;
|
scene.ssao_bias = _aoBi;
|
||||||
scene.ssao_strength = _aoSr;
|
scene.ssao_strength = _aoSr;
|
||||||
scene.defer_normal_radius = _nrmSmt;
|
scene.defer_normal_radius = _nrmSmt;
|
||||||
|
|
||||||
scene.draw_background = _dbg;
|
scene.draw_background = _dbg;
|
||||||
|
|
||||||
var _bgSurf = _dbg? scene.renderBackground(_dim[0], _dim[1]) : noone;
|
var _bgSurf = _dbg? scene.renderBackground(_dim[0], _dim[1]) : noone;
|
||||||
scene.deferPass(_scne, _dim[0], _dim[1]);
|
var _defer = scene.deferPass(_scne, _dim[0], _dim[1]);
|
||||||
|
|
||||||
var _render = outputs[| 0].getValue();
|
var _render = outputs[| 0].getValue();
|
||||||
var _normal = outputs[| 1].getValue();
|
var _normal = outputs[| 1].getValue();
|
||||||
|
@ -289,7 +288,7 @@ function Node_3D_Camera(_x, _y, _group = noone) : Node_3D_Object(_x, _y, _group)
|
||||||
|
|
||||||
scene.reset();
|
scene.reset();
|
||||||
scene.submitShader(_scne);
|
scene.submitShader(_scne);
|
||||||
scene.apply();
|
scene.apply(_defer);
|
||||||
scene.submit(_scne);
|
scene.submit(_scne);
|
||||||
|
|
||||||
surface_reset_target();
|
surface_reset_target();
|
||||||
|
@ -308,7 +307,7 @@ function Node_3D_Camera(_x, _y, _group = noone) : Node_3D_Object(_x, _y, _group)
|
||||||
draw_surface(_render, 0, 0);
|
draw_surface(_render, 0, 0);
|
||||||
|
|
||||||
BLEND_MULTIPLY
|
BLEND_MULTIPLY
|
||||||
draw_surface_safe(scene.ssao);
|
draw_surface_safe(_defer.ssao);
|
||||||
BLEND_NORMAL
|
BLEND_NORMAL
|
||||||
surface_reset_target();
|
surface_reset_target();
|
||||||
surface_free(_render);
|
surface_free(_render);
|
||||||
|
|
|
@ -756,6 +756,8 @@ function Panel_Preview() : PanelContent() constructor {
|
||||||
function draw3D() { #region
|
function draw3D() { #region
|
||||||
var _prev_node = getNodePreview();
|
var _prev_node = getNodePreview();
|
||||||
if(_prev_node == noone) return;
|
if(_prev_node == noone) return;
|
||||||
|
if(!_prev_node.is_3D) return;
|
||||||
|
|
||||||
_prev_node.previewing = 1;
|
_prev_node.previewing = 1;
|
||||||
|
|
||||||
d3_scene_preview = struct_has(_prev_node, "scene")? _prev_node.scene : d3_scene;
|
d3_scene_preview = struct_has(_prev_node, "scene")? _prev_node.scene : d3_scene;
|
||||||
|
@ -802,12 +804,12 @@ function Panel_Preview() : PanelContent() constructor {
|
||||||
#region background
|
#region background
|
||||||
surface_free_safe(d3_surface_bg);
|
surface_free_safe(d3_surface_bg);
|
||||||
|
|
||||||
if(_prev_node.is_3D && d3_scene_preview != d3_scene)
|
if(d3_scene_preview != d3_scene)
|
||||||
d3_surface_bg = d3_scene_preview.renderBackground(w, h);
|
d3_surface_bg = d3_scene_preview.renderBackground(w, h);
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region shadow
|
#region shadow
|
||||||
if(_prev_node.is_3D && d3_scene_preview == d3_scene) {
|
if(d3_scene_preview == d3_scene) {
|
||||||
d3_scene_light0.shadow_map_scale = d3_view_camera.focus_dist * 2;
|
d3_scene_light0.shadow_map_scale = d3_view_camera.focus_dist * 2;
|
||||||
|
|
||||||
var _prev_obj = _prev_node.getPreviewObjects();
|
var _prev_obj = _prev_node.getPreviewObjects();
|
||||||
|
@ -834,10 +836,8 @@ function Panel_Preview() : PanelContent() constructor {
|
||||||
d3_surface_outline = surface_verify(d3_surface_outline, w, h);
|
d3_surface_outline = surface_verify(d3_surface_outline, w, h);
|
||||||
|
|
||||||
#region defer
|
#region defer
|
||||||
if(_prev_node.is_3D) {
|
|
||||||
var _prev_obj = _prev_node.getPreviewObject();
|
var _prev_obj = _prev_node.getPreviewObject();
|
||||||
d3_scene_preview.deferPass(_prev_obj, w, h);
|
var _defer = d3_scene_preview.deferPass(_prev_obj, w, h);
|
||||||
}
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region grid
|
#region grid
|
||||||
|
@ -868,19 +868,18 @@ function Panel_Preview() : PanelContent() constructor {
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region draw
|
#region draw
|
||||||
if(d3_scene_preview == d3_scene)
|
|
||||||
d3_scene_preview.reset();
|
d3_scene_preview.reset();
|
||||||
gpu_set_cullmode(cull_counterclockwise);
|
gpu_set_cullmode(cull_counterclockwise);
|
||||||
|
|
||||||
if(_prev_node.is_3D) {
|
|
||||||
var _prev_obj = _prev_node.getPreviewObjects();
|
var _prev_obj = _prev_node.getPreviewObjects();
|
||||||
|
|
||||||
if(d3_scene_light_enabled && d3_scene_preview == d3_scene) {
|
if(d3_scene_preview == d3_scene) {
|
||||||
d3_scene.addLightDirectional(d3_scene_light0);
|
if(d3_scene_light_enabled) {
|
||||||
d3_scene.addLightDirectional(d3_scene_light1);
|
d3_scene_preview.addLightDirectional(d3_scene_light0);
|
||||||
|
d3_scene_preview.addLightDirectional(d3_scene_light1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(d3_scene_preview == d3_scene)
|
|
||||||
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;
|
||||||
|
@ -888,14 +887,13 @@ function Panel_Preview() : PanelContent() constructor {
|
||||||
_prev.submitShader(d3_scene_preview);
|
_prev.submitShader(d3_scene_preview);
|
||||||
}
|
}
|
||||||
|
|
||||||
d3_scene_preview.apply();
|
d3_scene_preview.apply(_defer);
|
||||||
|
|
||||||
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 ////////////////
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
gpu_set_cullmode(cull_noculling);
|
gpu_set_cullmode(cull_noculling);
|
||||||
surface_reset_target();
|
surface_reset_target();
|
||||||
|
@ -909,7 +907,7 @@ function Panel_Preview() : PanelContent() constructor {
|
||||||
draw_surface_safe(d3_surface);
|
draw_surface_safe(d3_surface);
|
||||||
|
|
||||||
BLEND_MULTIPLY
|
BLEND_MULTIPLY
|
||||||
draw_surface_safe(d3_scene_preview.ssao);
|
draw_surface_safe(_defer.ssao);
|
||||||
BLEND_NORMAL
|
BLEND_NORMAL
|
||||||
|
|
||||||
//draw_clear(c_white);
|
//draw_clear(c_white);
|
||||||
|
@ -919,7 +917,7 @@ function Panel_Preview() : PanelContent() constructor {
|
||||||
case 2 : draw_surface_safe(d3_surface_depth); break;
|
case 2 : draw_surface_safe(d3_surface_depth); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//draw_surface_stretched_safe(d3_scene_light0.shadow_map, 64, 64, 128, 128);
|
draw_surface_stretched_safe(d3_scene_light0.shadow_map, 64, 64, 128, 128);
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region outline
|
#region outline
|
||||||
|
@ -931,7 +929,7 @@ function Panel_Preview() : PanelContent() constructor {
|
||||||
surface_set_target(d3_surface_outline);
|
surface_set_target(d3_surface_outline);
|
||||||
draw_clear(c_black);
|
draw_clear(c_black);
|
||||||
|
|
||||||
d3_view_camera.applyCamera();
|
d3_scene_preview.camera.applyCamera();
|
||||||
|
|
||||||
gpu_set_ztestenable(false);
|
gpu_set_ztestenable(false);
|
||||||
for( var i = 0, n = array_length(_inspect_obj); i < n; i++ ) {
|
for( var i = 0, n = array_length(_inspect_obj); i < n; i++ ) {
|
||||||
|
@ -948,7 +946,7 @@ function Panel_Preview() : PanelContent() constructor {
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
d3_scene_preview.resetCamera();
|
d3_scene_preview.camera.resetCamera();
|
||||||
} #endregion
|
} #endregion
|
||||||
|
|
||||||
function drawPreviewOverlay() { #region
|
function drawPreviewOverlay() { #region
|
||||||
|
|
|
@ -5,7 +5,7 @@ function Panel_Preview_3D_Setting(panel) : Panel_Linear_Setting() constructor {
|
||||||
preview_panel = panel;
|
preview_panel = panel;
|
||||||
|
|
||||||
#region data
|
#region data
|
||||||
properties = [
|
properties_default = [
|
||||||
[
|
[
|
||||||
new checkBox(function() { preview_panel.d3_scene_light_enabled = !preview_panel.d3_scene_light_enabled; }),
|
new checkBox(function() { preview_panel.d3_scene_light_enabled = !preview_panel.d3_scene_light_enabled; }),
|
||||||
__txt("Preview Light"),
|
__txt("Preview Light"),
|
||||||
|
@ -53,6 +53,17 @@ function Panel_Preview_3D_Setting(panel) : Panel_Linear_Setting() constructor {
|
||||||
],
|
],
|
||||||
]
|
]
|
||||||
|
|
||||||
|
var scene_camera = [
|
||||||
|
[ "Currently using camera node settings", THEME.noti_icon_warning, 1, COLORS._main_accent ],
|
||||||
|
];
|
||||||
|
|
||||||
|
properties_camera = array_append(scene_camera, properties_default);
|
||||||
|
properties = preview_panel.d3_scene_preview == preview_panel.d3_scene? properties_default : properties_camera;
|
||||||
|
|
||||||
setHeight();
|
setHeight();
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
function drawContent(panel) {
|
||||||
|
drawSettings(panel);
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -56,11 +56,28 @@ function shader_set_surface(sampler, surface, linear = false, _repeat = false) {
|
||||||
if(!is_surface(surface)) return;
|
if(!is_surface(surface)) return;
|
||||||
|
|
||||||
var t = shader_get_sampler_index(shader, sampler);
|
var t = shader_get_sampler_index(shader, sampler);
|
||||||
|
|
||||||
texture_set_stage(t, surface_get_texture(surface));
|
texture_set_stage(t, surface_get_texture(surface));
|
||||||
gpu_set_tex_filter_ext(t, linear);
|
gpu_set_tex_filter_ext(t, linear);
|
||||||
gpu_set_tex_repeat_ext(t, _repeat);
|
gpu_set_tex_repeat_ext(t, _repeat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//function shader_set_surface_ext(sampler, surface, linear = false, _repeat = false) {
|
||||||
|
// var shader = shader_current();
|
||||||
|
// if(!is_surface(surface)) return;
|
||||||
|
|
||||||
|
// if (!GMD3D11_IS_SUPPORTED) {
|
||||||
|
// shader_set_surface(sampler, surface, linear, _repeat);
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// var t = shader_get_sampler_index(shader, sampler);
|
||||||
|
// gpu_set_tex_filter_ext(t, linear);
|
||||||
|
// gpu_set_tex_repeat_ext(t, _repeat);
|
||||||
|
|
||||||
|
// d3d11_texture_set_stage_ps(t, surface_get_texture(surface));
|
||||||
|
//}
|
||||||
|
|
||||||
function shader_set_surface_dimension(uniform, surface) {
|
function shader_set_surface_dimension(uniform, surface) {
|
||||||
var shader = shader_current();
|
var shader = shader_current();
|
||||||
if(!is_surface(surface)) return;
|
if(!is_surface(surface)) return;
|
||||||
|
|
|
@ -27,6 +27,8 @@ varying float v_cameraDistance;
|
||||||
uniform float light_dir_shadow_bias[LIGHT_DIR_LIMIT];
|
uniform float light_dir_shadow_bias[LIGHT_DIR_LIMIT];
|
||||||
uniform sampler2D light_dir_shadowmap_0;
|
uniform sampler2D light_dir_shadowmap_0;
|
||||||
uniform sampler2D light_dir_shadowmap_1;
|
uniform sampler2D light_dir_shadowmap_1;
|
||||||
|
//uniform sampler2D light_dir_shadowmap_2;
|
||||||
|
//uniform sampler2D light_dir_shadowmap_3;
|
||||||
|
|
||||||
#define LIGHT_PNT_LIMIT 16
|
#define LIGHT_PNT_LIMIT 16
|
||||||
uniform int light_pnt_count;
|
uniform int light_pnt_count;
|
||||||
|
@ -41,6 +43,8 @@ varying float v_cameraDistance;
|
||||||
uniform float light_pnt_shadow_bias[LIGHT_DIR_LIMIT];
|
uniform float light_pnt_shadow_bias[LIGHT_DIR_LIMIT];
|
||||||
uniform sampler2D light_pnt_shadowmap_0;
|
uniform sampler2D light_pnt_shadowmap_0;
|
||||||
uniform sampler2D light_pnt_shadowmap_1;
|
uniform sampler2D light_pnt_shadowmap_1;
|
||||||
|
//uniform sampler2D light_pnt_shadowmap_2;
|
||||||
|
//uniform sampler2D light_pnt_shadowmap_3;
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region ---- material ----
|
#region ---- material ----
|
||||||
|
@ -93,6 +97,8 @@ varying float v_cameraDistance;
|
||||||
float sampleDirShadowMap(int index, vec2 position) {
|
float sampleDirShadowMap(int index, vec2 position) {
|
||||||
if(index == 0) return texture2D(light_dir_shadowmap_0, position).r;
|
if(index == 0) return texture2D(light_dir_shadowmap_0, position).r;
|
||||||
if(index == 1) return texture2D(light_dir_shadowmap_1, position).r;
|
if(index == 1) return texture2D(light_dir_shadowmap_1, position).r;
|
||||||
|
//if(index == 2) return texture2D(light_dir_shadowmap_2, position).r;
|
||||||
|
//if(index == 3) return texture2D(light_dir_shadowmap_3, position).r;
|
||||||
return 0.;
|
return 0.;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,6 +111,8 @@ varying float v_cameraDistance;
|
||||||
|
|
||||||
if(index == 0) return texture2D(light_pnt_shadowmap_0, position)[side];
|
if(index == 0) return texture2D(light_pnt_shadowmap_0, position)[side];
|
||||||
if(index == 1) return texture2D(light_pnt_shadowmap_1, position)[side];
|
if(index == 1) return texture2D(light_pnt_shadowmap_1, position)[side];
|
||||||
|
//if(index == 2) return texture2D(light_pnt_shadowmap_2, position)[side];
|
||||||
|
//if(index == 3) return texture2D(light_pnt_shadowmap_3, position)[side];
|
||||||
return 0.;
|
return 0.;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
Loading…
Reference in a new issue