mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-05 15:30:00 +01:00
New Shader Source
Implementation of Shader GLSL code source; basically a source with an ImageFilter that contains GLSL code. Connected so Shader Editor (like clone sources).
This commit is contained in:
@@ -586,7 +586,7 @@ set(VMIX_RSC_FILES
|
||||
./rsc/mesh/icon_image.ply
|
||||
./rsc/mesh/icon_render.ply
|
||||
./rsc/mesh/icon_pattern.ply
|
||||
./rsc/mesh/icon_gear.ply
|
||||
./rsc/mesh/icon_code.ply
|
||||
./rsc/mesh/icon_camera.ply
|
||||
./rsc/mesh/icon_share.ply
|
||||
./rsc/mesh/icon_clone.ply
|
||||
@@ -668,6 +668,11 @@ set(VMIX_RSC_FILES
|
||||
./rsc/shaders/filters/earlybird.glsl
|
||||
./rsc/shaders/filters/logo.glsl
|
||||
./rsc/shaders/filters/whitebalance.glsl
|
||||
./rsc/shaders/filters/color.glsl
|
||||
./rsc/shaders/filters/HSV.glsl
|
||||
./rsc/shaders/filters/RGBnoise.glsl
|
||||
./rsc/shaders/filters/3DPerlinNoise.glsl
|
||||
./rsc/shaders/filters/3DSimplexNoise.glsl
|
||||
./rsc/images/logo.vmx
|
||||
)
|
||||
|
||||
|
||||
Binary file not shown.
619
rsc/mesh/icon_code.ply
Normal file
619
rsc/mesh/icon_code.ply
Normal file
@@ -0,0 +1,619 @@
|
||||
ply
|
||||
format ascii 1.0
|
||||
comment Created in Blender version 4.3.2
|
||||
element vertex 305
|
||||
property float x
|
||||
property float y
|
||||
property float z
|
||||
property float nx
|
||||
property float ny
|
||||
property float nz
|
||||
property float s
|
||||
property float t
|
||||
element face 299
|
||||
property list uchar uint vertex_indices
|
||||
end_header
|
||||
0.013836188 0.09580361 0 0 0 1 0.1118421 0
|
||||
0.015022659 0.09578898 0 0 0 1 0.118421055 0
|
||||
0.014425008 0.09583499 0 0 0 1 0.11513158 0
|
||||
0.0132629555 0.09569821 0 0 0 1 0.108552635 0
|
||||
0.015622389 0.09566219 0 0 0 1 0.121710524 0
|
||||
0.012712063 0.09552216 0 0 0 1 0.10526316 0
|
||||
0.016071362 0.09553194 0 0 0 1 0.125 0
|
||||
0.017312646 0.09517184 0 0 0 1 0.12828948 0
|
||||
0.012190266 0.095278844 0 0 0 1 0.10197368 0
|
||||
0.011704316 0.09497164 0 0 0 1 0.098684214 0
|
||||
0.019187775 0.09462786 0 0 0 1 0.13157895 0
|
||||
0.0112609705 0.094603926 0 0 0 1 0.09539474 0
|
||||
0.021538287 0.093945965 0 0 0 1 0.13486843 0
|
||||
0.010866981 0.09417907 0 0 0 1 0.09210526 0
|
||||
0.010529103 0.09370045 0 0 0 1 0.088815786 0
|
||||
0.024205724 0.09317213 0 0 0 1 0.13815789 0
|
||||
0.01025409 0.093171455 0 0 0 1 0.08552632 0
|
||||
0.027031623 0.09235233 0 0 0 1 0.14144737 0
|
||||
0.010048696 0.09259544 0 0 0 1 0.08223684 0
|
||||
0.009044023 0.08913536 0 0 0 1 0.078947365 0
|
||||
0.029857522 0.09153253 0 0 0 1 0.14473684 0
|
||||
0.03252496 0.090758696 0 0 0 1 0.14802632 0
|
||||
0.03487547 0.090076804 0 0 0 1 0.1513158 0
|
||||
0.0367506 0.08953282 0 0 0 1 0.15460527 0
|
||||
0.03799188 0.08917272 0 0 0 1 0.15789473 0
|
||||
0.03844086 0.08904249 0 0 0 1 0.1611842 0
|
||||
0.006266399 0.07956934 0 0 0 1 0.0756579 0
|
||||
0.039016996 0.08883714 0 0 0 1 0.16447368 0
|
||||
0.03954611 0.08856218 0 0 0 1 0.16776316 0
|
||||
0.04002483 0.088224374 0 0 0 1 0.17105263 0
|
||||
0.040449772 0.08783047 0 0 0 1 0.17434211 0
|
||||
0.040817566 0.08738722 0 0 0 1 0.17763157 0
|
||||
0.041124836 0.086901374 0 0 0 1 0.18092105 0
|
||||
0.0413682 0.086379685 0 0 0 1 0.18421052 0
|
||||
0.041544285 0.08582891 0 0 0 1 0.1875 0
|
||||
0.04164971 0.085255794 0 0 0 1 0.19078948 0
|
||||
0.0416811 0.084667094 0 0 0 1 0.19407895 0
|
||||
0.041635077 0.084069565 0 0 0 1 0.19736843 0
|
||||
0.04150826 0.083469965 0 0 0 1 0.20065789 0
|
||||
0.040503588 0.080009915 0 0 0 1 0.20394737 0
|
||||
0.037725963 0.07044388 0 0 0 1 0.20723684 0
|
||||
0.002070413 0.06511853 0 0 0 1 0.07236842 0
|
||||
0.03352998 0.055993073 0 0 0 1 0.21052632 0
|
||||
-0.003189344 0.047004133 0 0 0 1 0.069078945 0
|
||||
0.028270222 0.037878677 0 0 0 1 0.2138158 0
|
||||
0.06084521 0.055082653 0 0 0 1 0.74671054 0
|
||||
0.061992973 0.055115335 0 0 0 1 0.74013156 0
|
||||
0.061418314 0.055135224 0 0 0 1 0.7434211 0
|
||||
0.06256166 0.055022854 0 0 0 1 0.7368421 0
|
||||
-0.061469752 0.05509384 0 0 0 1 0.46710527 0
|
||||
-0.060321987 0.055056613 0 0 0 1 0.46052632 0
|
||||
-0.06089431 0.055111848 0 0 0 1 0.46381578 0
|
||||
-0.062040776 0.055002075 0 0 0 1 0.47039473 0
|
||||
0.060281202 0.05495775 0 0 0 1 0.75 0
|
||||
-0.059760313 0.05492866 0 0 0 1 0.45723686 0
|
||||
0.06311684 0.054857653 0 0 0 1 0.73355263 0
|
||||
-0.06259985 0.054836027 0 0 0 1 0.47368422 0
|
||||
0.059733815 0.054760646 0 0 0 1 0.75328946 0
|
||||
-0.059216823 0.054728504 0 0 0 1 0.45394737 0
|
||||
0.06365098 0.0546196 0 0 0 1 0.7302632 0
|
||||
-0.063139446 0.054595184 0 0 0 1 0.47697368 0
|
||||
0.05921059 0.05449147 0 0 0 1 0.7565789 0
|
||||
-0.058699053 0.054456666 0 0 0 1 0.4506579 0
|
||||
0.06415654 0.054308563 0 0 0 1 0.7269737 0
|
||||
-0.06365202 0.054279022 0 0 0 1 0.48026314 0
|
||||
0.058719058 0.054150354 0 0 0 1 0.75986844 0
|
||||
-0.058214534 0.054113667 0 0 0 1 0.4473684 0
|
||||
0.06462599 0.05392442 0 0 0 1 0.7236842 0
|
||||
-0.064130045 0.053887025 0 0 0 1 0.48355263 0
|
||||
0.058266748 0.053737424 0 0 0 1 0.7631579 0
|
||||
-0.057770796 0.053700026 0 0 0 1 0.44407895 0
|
||||
0.065686606 0.05292953 0 0 0 1 0.72039473 0
|
||||
-0.06519066 0.0528936 0 0 0 1 0.4868421 0
|
||||
0.057946578 0.053395983 0 0 0 1 0.76644737 0
|
||||
-0.057450626 0.053358573 0 0 0 1 0.44078946 0
|
||||
0.0570614 0.052451994 0 0 0 1 0.7697368 0
|
||||
-0.05656545 0.05241458 0 0 0 1 0.4375 0
|
||||
0.06861888 0.05017894 0 0 0 1 0.71710527 0
|
||||
-0.06812293 0.05014708 0 0 0 1 0.4901316 0
|
||||
0.05572422 0.051025968 0 0 0 1 0.7730263 0
|
||||
-0.055228267 0.050988555 0 0 0 1 0.43421054 0
|
||||
0.05404803 0.049238414 0 0 0 1 0.7763158 0
|
||||
-0.05355208 0.049201 0 0 0 1 0.43092105 0
|
||||
0.07304849 0.046023794 0 0 0 1 0.7138158 0
|
||||
-0.07255254 0.045998078 0 0 0 1 0.49342105 0
|
||||
0.052145842 0.04720984 0 0 0 1 0.77960527 0
|
||||
-0.05164989 0.047172427 0 0 0 1 0.4276316 0
|
||||
0.05013065 0.045060758 0 0 0 1 0.78289473 0
|
||||
-0.049634703 0.045023344 0 0 0 1 0.4243421 0
|
||||
-0.009158282 0.026447348 0 0 0 1 0.065789476 0
|
||||
0.07860109 0.04081523 0 0 0 1 0.7105263 0
|
||||
-0.078105144 0.04079722 0 0 0 1 0.49671054 0
|
||||
0.048115462 0.042911675 0 0 0 1 0.7861842 0
|
||||
-0.047619514 0.04287426 0 0 0 1 0.42105263 0
|
||||
0.046213273 0.0408831 0 0 0 1 0.7894737 0
|
||||
-0.045717325 0.04084569 0 0 0 1 0.41776314 0
|
||||
0.044537086 0.039095547 0 0 0 1 0.7927632 0
|
||||
-0.04404114 0.039058134 0 0 0 1 0.41447368 0
|
||||
0.08490236 0.034904387 0 0 0 1 0.7072368 0
|
||||
-0.08440642 0.034895122 0 0 0 1 0.5 0
|
||||
0.043199904 0.03766952 0 0 0 1 0.79605263 0
|
||||
-0.042703956 0.037632108 0 0 0 1 0.41118422 0
|
||||
0.022301285 0.017321892 0 0 0 1 0.21710527 0
|
||||
0.042314727 0.036725532 0 0 0 1 0.7993421 0
|
||||
-0.04181878 0.03668812 0 0 0 1 0.40789473 0
|
||||
0.041994557 0.036384083 0 0 0 1 0.80263156 0
|
||||
-0.04149861 0.036346678 0 0 0 1 0.40460527 0
|
||||
0.041602537 0.035904687 0 0 0 1 0.8059211 0
|
||||
-0.041098736 0.03586728 0 0 0 1 0.40131578 0
|
||||
0.041286763 0.035388153 0 0 0 1 0.80921054 0
|
||||
-0.04077783 0.035350747 0 0 0 1 0.39802632 0
|
||||
0.0410471 0.03484253 0 0 0 1 0.8125 0
|
||||
-0.04053537 0.034805123 0 0 0 1 0.39473686 0
|
||||
0.09157797 0.028642405 0 0 0 1 0.70394737 0
|
||||
-0.09108203 0.028642405 0 0 0 1 0.50328946 0
|
||||
0.040883422 0.034275867 0 0 0 1 0.81578946 0
|
||||
-0.040370848 0.03423846 0 0 0 1 0.39144737 0
|
||||
0.0407956 0.03369622 0 0 0 1 0.8190789 0
|
||||
-0.040283736 0.033658814 0 0 0 1 0.3881579 0
|
||||
0.0407835 0.033111636 0 0 0 1 0.82236844 0
|
||||
-0.040273517 0.03307423 0 0 0 1 0.3848684 0
|
||||
0.040846992 0.03253017 0 0 0 1 0.8256579 0
|
||||
-0.04033967 0.032492764 0 0 0 1 0.38157895 0
|
||||
0.04098595 0.031959873 0 0 0 1 0.82894737 0
|
||||
-0.04048168 0.031922467 0 0 0 1 0.37828946 0
|
||||
0.04120024 0.031408794 0 0 0 1 0.8322368 0
|
||||
-0.040699024 0.03137139 0 0 0 1 0.375 0
|
||||
0.041489735 0.030884985 0 0 0 1 0.8355263 0
|
||||
-0.040991183 0.030847581 0 0 0 1 0.37171054 0
|
||||
0.041854307 0.030396499 0 0 0 1 0.8388158 0
|
||||
-0.041357636 0.030359093 0 0 0 1 0.36842105 0
|
||||
0.042293817 0.029951386 0 0 0 1 0.84210527 0
|
||||
-0.041797865 0.029913979 0 0 0 1 0.3651316 0
|
||||
0.042960655 0.029364163 0 0 0 1 0.84539473 0
|
||||
-0.075688906 0.000106635685 0 0 0 1 0.3618421 0
|
||||
0.044804264 0.027740665 0 0 0 1 0.8486842 0
|
||||
-0.09775764 0.022389688 0 0 0 1 0.5065789 0
|
||||
0.09825358 0.022380423 0 0 0 1 0.7006579 0
|
||||
0.04758929 0.025288146 0 0 0 1 0.8519737 0
|
||||
-0.015481809 0.0046693683 0 0 0 1 0.0625 0
|
||||
0.051080383 0.022213861 0 0 0 1 0.8552632 0
|
||||
-0.104058914 0.01648759 0 0 0 1 0.50986844 0
|
||||
0.104554854 0.01646958 0 0 0 1 0.69736844 0
|
||||
0.055042185 0.018725066 0 0 0 1 0.85855263 0
|
||||
0.05923934 0.015029015 0 0 0 1 0.8618421 0
|
||||
0.015977757 -0.004456088 0 0 0 1 0.22039473 0
|
||||
-0.109611526 0.01128673 0 0 0 1 0.5131579 0
|
||||
0.11010746 0.011261014 0 0 0 1 0.6940789 0
|
||||
0.06343649 0.0113329645 0 0 0 1 0.86513156 0
|
||||
0.067398295 0.00784417 0 0 0 1 0.8684211 0
|
||||
-0.114041135 0.00713773 0 0 0 1 0.51644737 0
|
||||
0.11453707 0.007105867 0 0 0 1 0.69078946 0
|
||||
0.07088938 0.004769885 0 0 0 1 0.87171054 0
|
||||
-0.116973415 0.0043912083 0 0 0 1 0.5197368 0
|
||||
0.11746934 0.004355277 0 0 0 1 0.6875 0
|
||||
0.07367441 0.0023173664 0 0 0 1 0.875 0
|
||||
-0.021805337 -0.017108612 0 0 0 1 0.059210528 0
|
||||
-0.11803401 0.0033977898 0 0 0 1 0.5230263 0
|
||||
0.11852995 0.0033603825 0 0 0 1 0.68421054 0
|
||||
-0.11847121 0.0029333255 0 0 0 1 0.5263158 0
|
||||
0.11896715 0.0028959208 0 0 0 1 0.6809211 0
|
||||
-0.11882892 0.0024247095 0 0 0 1 0.52960527 0
|
||||
0.11932486 0.0023873067 0 0 0 1 0.67763156 0
|
||||
-0.11910714 0.001880772 0 0 0 1 0.53289473 0
|
||||
0.11960308 0.0018433707 0 0 0 1 0.6743421 0
|
||||
0.07551802 0.00069386885 0 0 0 1 0.87828946 0
|
||||
-0.11930587 0.0013103433 0 0 0 1 0.5361842 0
|
||||
0.11980181 0.0012729436 0 0 0 1 0.67105263 0
|
||||
-0.11942511 0.00072225387 0 0 0 1 0.5394737 0
|
||||
0.11992105 0.00068485556 0 0 0 1 0.6677632 0
|
||||
-0.11946486 0.00012533413 0 0 0 1 0.5427632 0
|
||||
0.07618486 0.000106635685 0 0 0 1 0.8815789 0
|
||||
0.1199608 8.793711e-05 0 0 0 1 0.6644737 0
|
||||
-0.11942511 -0.0004715856 0 0 0 1 0.54605263 0
|
||||
-0.07502206 -0.00047985278 0 0 0 1 0.35855263 0
|
||||
0.042293817 -0.029700719 0 0 0 1 0.88486844 0
|
||||
0.11992105 -0.00050898135 0 0 0 1 0.6611842 0
|
||||
-0.11930587 -0.0010596749 0 0 0 1 0.5493421 0
|
||||
-0.07317845 -0.0021013177 0 0 0 1 0.35526314 0
|
||||
0.11980181 -0.0010970694 0 0 0 1 0.65789473 0
|
||||
-0.11910714 -0.0016301034 0 0 0 1 0.55263156 0
|
||||
0.11960308 -0.0016674964 0 0 0 1 0.65460527 0
|
||||
-0.11882892 -0.002174041 0 0 0 1 0.5559211 0
|
||||
0.11932486 -0.0022114322 0 0 0 1 0.6513158 0
|
||||
-0.07039342 -0.004550765 0 0 0 1 0.35197368 0
|
||||
-0.11847121 -0.002682657 0 0 0 1 0.55921054 0
|
||||
0.11896715 -0.0027200463 0 0 0 1 0.6480263 0
|
||||
-0.11803401 -0.0031471206 0 0 0 1 0.5625 0
|
||||
0.11852995 -0.0031845083 0 0 0 1 0.6447368 0
|
||||
-0.1169734 -0.0041412786 0 0 0 1 0.56578946 0
|
||||
0.06462599 -0.05371115 0 0 0 1 0.64144737 0
|
||||
-0.11404113 -0.0068898336 0 0 0 1 0.5690789 0
|
||||
0.0096542295 -0.026234068 0 0 0 1 0.2236842 0
|
||||
-0.06690233 -0.0076211984 0 0 0 1 0.34868422 0
|
||||
-0.10961152 -0.011041906 0 0 0 1 0.57236844 0
|
||||
-0.06294053 -0.011105623 0 0 0 1 0.34539473 0
|
||||
-0.104058914 -0.016246617 0 0 0 1 0.5756579 0
|
||||
-0.05874338 -0.014797043 0 0 0 1 0.34210527 0
|
||||
-0.054546226 -0.018488463 0 0 0 1 0.33881578 0
|
||||
-0.09775764 -0.022153087 0 0 0 1 0.57894737 0
|
||||
-0.027774274 -0.037665397 0 0 0 1 0.05592105 0
|
||||
-0.050584428 -0.021972887 0 0 0 1 0.33552632 0
|
||||
-0.04709334 -0.02504332 0 0 0 1 0.33223686 0
|
||||
-0.09108203 -0.028410437 0 0 0 1 0.5822368 0
|
||||
-0.044308312 -0.027492767 0 0 0 1 0.32894737 0
|
||||
0.0036852919 -0.046790853 0 0 0 1 0.22697368 0
|
||||
-0.042464703 -0.029114231 0 0 0 1 0.3256579 0
|
||||
-0.08440642 -0.034667786 0 0 0 1 0.5855263 0
|
||||
-0.041797865 -0.029700719 0 0 0 1 0.3223684 0
|
||||
-0.041358355 -0.030145833 0 0 0 1 0.31907895 0
|
||||
0.041853588 -0.030145833 0 0 0 1 0.8881579 0
|
||||
-0.040993787 -0.03063432 0 0 0 1 0.31578946 0
|
||||
0.041487135 -0.03063432 0 0 0 1 0.89144737 0
|
||||
-0.04070429 -0.031158127 0 0 0 1 0.3125 0
|
||||
0.041194975 -0.031158127 0 0 0 1 0.8947368 0
|
||||
-0.04049 -0.031709205 0 0 0 1 0.30921054 0
|
||||
0.04097763 -0.031709205 0 0 0 1 0.8980263 0
|
||||
-0.040351044 -0.032279503 0 0 0 1 0.30592105 0
|
||||
0.040835623 -0.032279503 0 0 0 1 0.9013158 0
|
||||
-0.04028755 -0.03286097 0 0 0 1 0.3026316 0
|
||||
0.040769465 -0.03286097 0 0 0 1 0.90460527 0
|
||||
-0.04029965 -0.03344555 0 0 0 1 0.2993421 0
|
||||
0.040779684 -0.03344555 0 0 0 1 0.90789473 0
|
||||
-0.040387474 -0.034025196 0 0 0 1 0.29605263 0
|
||||
0.040866796 -0.034025196 0 0 0 1 0.9111842 0
|
||||
-0.040551152 -0.034591857 0 0 0 1 0.29276314 0
|
||||
0.04103132 -0.034591857 0 0 0 1 0.9144737 0
|
||||
-0.040790815 -0.035137482 0 0 0 1 0.28947368 0
|
||||
0.041273773 -0.035137482 0 0 0 1 0.9177632 0
|
||||
-0.078105144 -0.040574256 0 0 0 1 0.5888158 0
|
||||
-0.04110659 -0.03565402 0 0 0 1 0.28618422 0
|
||||
0.04159468 -0.03565402 0 0 0 1 0.92105263 0
|
||||
-0.04149861 -0.036133416 0 0 0 1 0.28289473 0
|
||||
0.041994557 -0.036133416 0 0 0 1 0.9243421 0
|
||||
-0.057770796 -0.053486746 0 0 0 1 0.27960527 0
|
||||
0.042314727 -0.036474857 0 0 0 1 0.92763156 0
|
||||
0.043199904 -0.037418846 0 0 0 1 0.9309211 0
|
||||
0.044537086 -0.038844872 0 0 0 1 0.93421054 0
|
||||
-0.03303403 -0.055779792 0 0 0 1 0.05263158 0
|
||||
0.046213273 -0.040632427 0 0 0 1 0.9375 0
|
||||
-0.07255253 -0.045778967 0 0 0 1 0.59210527 0
|
||||
0.048115462 -0.042661 0 0 0 1 0.94078946 0
|
||||
0.05013065 -0.044810083 0 0 0 1 0.9440789 0
|
||||
0.05214584 -0.046959165 0 0 0 1 0.94736844 0
|
||||
-0.06812292 -0.049931042 0 0 0 1 0.59539473 0
|
||||
-0.0015744651 -0.06490525 0 0 0 1 0.23026316 0
|
||||
0.054048028 -0.04898774 0 0 0 1 0.9506579 0
|
||||
0.055724215 -0.050775293 0 0 0 1 0.95394737 0
|
||||
-0.06519064 -0.0526796 0 0 0 1 0.5986842 0
|
||||
0.057061397 -0.05220132 0 0 0 1 0.9572368 0
|
||||
0.057946574 -0.053145308 0 0 0 1 0.9605263 0
|
||||
-0.064130045 -0.053673744 0 0 0 1 0.6019737 0
|
||||
0.058266748 -0.053486746 0 0 0 1 0.9638158 0
|
||||
-0.058214527 -0.053908244 0 0 0 1 0.6381579 0
|
||||
0.058710482 -0.05390827 0 0 0 1 0.96710527 0
|
||||
-0.063652016 -0.05406646 0 0 0 1 0.6052632 0
|
||||
0.06414797 -0.054095272 0 0 0 1 1 0
|
||||
-0.058699045 -0.054256376 0 0 0 1 0.63486844 0
|
||||
0.059195 -0.054256555 0 0 0 1 0.97039473 0
|
||||
-0.06313944 -0.054384507 0 0 0 1 0.60855263 0
|
||||
0.063635394 -0.054406155 0 0 0 1 0.99671054 0
|
||||
-0.059216816 -0.054531008 0 0 0 1 0.6315789 0
|
||||
0.05971277 -0.054531597 0 0 0 1 0.9736842 0
|
||||
-0.062599845 -0.054628015 0 0 0 1 0.6118421 0
|
||||
0.0630958 -0.0546438 0 0 0 1 0.9934211 0
|
||||
-0.059760306 -0.05473201 0 0 0 1 0.62828946 0
|
||||
0.06025626 -0.0547334 0 0 0 1 0.9769737 0
|
||||
-0.06204077 -0.054797113 0 0 0 1 0.61513156 0
|
||||
0.062536724 -0.0548082 0 0 0 1 0.99013156 0
|
||||
-0.06032198 -0.05485925 0 0 0 1 0.625 0
|
||||
0.060817935 -0.05486196 0 0 0 1 0.9802632 0
|
||||
-0.061469745 -0.054891933 0 0 0 1 0.6184211 0
|
||||
0.0619657 -0.05489936 0 0 0 1 0.9868421 0
|
||||
-0.060894303 -0.0549126 0 0 0 1 0.62171054 0
|
||||
0.06139026 -0.05491728 0 0 0 1 0.98355263 0
|
||||
-0.037230015 -0.0702306 0 0 0 1 0.049342107 0
|
||||
-0.005770451 -0.07935606 0 0 0 1 0.23355263 0
|
||||
-0.04000764 -0.079796635 0 0 0 1 0.04605263 0
|
||||
-0.008548075 -0.08892208 0 0 0 1 0.23684211 0
|
||||
-0.041012313 -0.083256684 0 0 0 1 0.04276316 0
|
||||
-0.04113913 -0.083856285 0 0 0 1 0.039473683 0
|
||||
-0.04118515 -0.084453814 0 0 0 1 0.03618421 0
|
||||
-0.041153762 -0.085042514 0 0 0 1 0.032894738 0
|
||||
-0.041048337 -0.08561563 0 0 0 1 0.029605264 0
|
||||
-0.040872253 -0.086166404 0 0 0 1 0.02631579 0
|
||||
-0.040628888 -0.086688094 0 0 0 1 0.023026315 0
|
||||
-0.04032162 -0.08717394 0 0 0 1 0.019736841 0
|
||||
-0.039953824 -0.08761719 0 0 0 1 0.016447369 0
|
||||
-0.03952888 -0.08801109 0 0 0 1 0.013157895 0
|
||||
-0.03905016 -0.0883489 0 0 0 1 0.009868421 0
|
||||
-0.038521048 -0.08862386 0 0 0 1 0.0065789474 0
|
||||
-0.037944913 -0.08882921 0 0 0 1 0.0032894737 0
|
||||
-0.015126439 -0.09544891 0 0 0 1 0 0
|
||||
-0.009552747 -0.09238216 0 0 0 1 0.24013157 0
|
||||
-0.009765998 -0.09295889 0 0 0 1 0.24342105 0
|
||||
-0.010046142 -0.09348977 0 0 0 1 0.24671052 0
|
||||
-0.0103868125 -0.09397105 0 0 0 1 0.25 0
|
||||
-0.010781646 -0.09439896 0 0 0 1 0.25328946 0
|
||||
-0.011224277 -0.09476973 0 0 0 1 0.25657895 0
|
||||
-0.0117083425 -0.0950796 0 0 0 1 0.2598684 0
|
||||
-0.0122274775 -0.0953248 0 0 0 1 0.2631579 0
|
||||
-0.012775318 -0.09550156 0 0 0 1 0.26644737 0
|
||||
-0.014527423 -0.095583566 0 0 0 1 0.27631578 0
|
||||
-0.013345499 -0.09560612 0 0 0 1 0.26973686 0
|
||||
-0.013931655 -0.09563471 0 0 0 1 0.27302632 0
|
||||
3 0 1 2
|
||||
3 3 1 0
|
||||
3 3 4 1
|
||||
3 5 4 3
|
||||
3 5 6 4
|
||||
3 5 7 6
|
||||
3 8 7 5
|
||||
3 9 7 8
|
||||
3 9 10 7
|
||||
3 11 10 9
|
||||
3 11 12 10
|
||||
3 13 12 11
|
||||
3 14 12 13
|
||||
3 14 15 12
|
||||
3 16 15 14
|
||||
3 16 17 15
|
||||
3 18 17 16
|
||||
3 19 17 18
|
||||
3 19 20 17
|
||||
3 19 21 20
|
||||
3 19 22 21
|
||||
3 19 23 22
|
||||
3 19 24 23
|
||||
3 19 25 24
|
||||
3 26 25 19
|
||||
3 26 27 25
|
||||
3 26 28 27
|
||||
3 26 29 28
|
||||
3 26 30 29
|
||||
3 26 31 30
|
||||
3 26 32 31
|
||||
3 26 33 32
|
||||
3 26 34 33
|
||||
3 26 35 34
|
||||
3 26 36 35
|
||||
3 26 37 36
|
||||
3 26 38 37
|
||||
3 26 39 38
|
||||
3 26 40 39
|
||||
3 41 40 26
|
||||
3 41 42 40
|
||||
3 43 42 41
|
||||
3 43 44 42
|
||||
3 45 46 47
|
||||
3 45 48 46
|
||||
3 49 50 51
|
||||
3 52 50 49
|
||||
3 53 48 45
|
||||
3 52 54 50
|
||||
3 53 55 48
|
||||
3 56 54 52
|
||||
3 57 55 53
|
||||
3 56 58 54
|
||||
3 57 59 55
|
||||
3 60 58 56
|
||||
3 61 59 57
|
||||
3 60 62 58
|
||||
3 61 63 59
|
||||
3 64 62 60
|
||||
3 65 63 61
|
||||
3 64 66 62
|
||||
3 65 67 63
|
||||
3 68 66 64
|
||||
3 69 67 65
|
||||
3 68 70 66
|
||||
3 69 71 67
|
||||
3 72 70 68
|
||||
3 73 71 69
|
||||
3 72 74 70
|
||||
3 75 71 73
|
||||
3 72 76 74
|
||||
3 75 77 71
|
||||
3 78 76 72
|
||||
3 79 77 75
|
||||
3 78 80 76
|
||||
3 81 77 79
|
||||
3 78 82 80
|
||||
3 81 83 77
|
||||
3 84 82 78
|
||||
3 85 83 81
|
||||
3 84 86 82
|
||||
3 87 83 85
|
||||
3 84 88 86
|
||||
3 89 44 43
|
||||
3 87 90 83
|
||||
3 91 88 84
|
||||
3 92 90 87
|
||||
3 91 93 88
|
||||
3 94 90 92
|
||||
3 91 95 93
|
||||
3 96 90 94
|
||||
3 91 97 95
|
||||
3 96 98 90
|
||||
3 99 97 91
|
||||
3 100 98 96
|
||||
3 99 101 97
|
||||
3 89 102 44
|
||||
3 103 98 100
|
||||
3 99 104 101
|
||||
3 105 98 103
|
||||
3 99 106 104
|
||||
3 107 98 105
|
||||
3 99 108 106
|
||||
3 109 98 107
|
||||
3 99 110 108
|
||||
3 111 98 109
|
||||
3 99 112 110
|
||||
3 111 113 98
|
||||
3 114 112 99
|
||||
3 115 113 111
|
||||
3 114 116 112
|
||||
3 117 113 115
|
||||
3 114 118 116
|
||||
3 119 113 117
|
||||
3 114 120 118
|
||||
3 121 113 119
|
||||
3 114 122 120
|
||||
3 123 113 121
|
||||
3 114 124 122
|
||||
3 125 113 123
|
||||
3 114 126 124
|
||||
3 127 113 125
|
||||
3 114 128 126
|
||||
3 129 113 127
|
||||
3 114 130 128
|
||||
3 131 113 129
|
||||
3 114 132 130
|
||||
3 133 113 131
|
||||
3 114 134 132
|
||||
3 135 113 133
|
||||
3 136 134 114
|
||||
3 135 137 113
|
||||
3 138 137 135
|
||||
3 139 102 89
|
||||
3 140 137 138
|
||||
3 141 134 136
|
||||
3 140 142 137
|
||||
3 143 142 140
|
||||
3 144 142 143
|
||||
3 139 145 102
|
||||
3 146 134 141
|
||||
3 144 147 142
|
||||
3 148 147 144
|
||||
3 149 147 148
|
||||
3 150 134 146
|
||||
3 149 151 147
|
||||
3 152 151 149
|
||||
3 153 134 150
|
||||
3 152 154 151
|
||||
3 155 154 152
|
||||
3 156 145 139
|
||||
3 157 134 153
|
||||
3 155 158 154
|
||||
3 159 134 157
|
||||
3 155 160 158
|
||||
3 161 134 159
|
||||
3 155 162 160
|
||||
3 163 134 161
|
||||
3 155 164 162
|
||||
3 165 164 155
|
||||
3 166 134 163
|
||||
3 165 167 164
|
||||
3 168 134 166
|
||||
3 165 169 167
|
||||
3 170 134 168
|
||||
3 171 169 165
|
||||
3 171 172 169
|
||||
3 173 134 170
|
||||
3 173 174 134
|
||||
3 175 172 171
|
||||
3 175 176 172
|
||||
3 177 174 173
|
||||
3 177 178 174
|
||||
3 175 179 176
|
||||
3 180 178 177
|
||||
3 175 181 179
|
||||
3 182 178 180
|
||||
3 175 183 181
|
||||
3 182 184 178
|
||||
3 185 184 182
|
||||
3 175 186 183
|
||||
3 187 184 185
|
||||
3 175 188 186
|
||||
3 189 184 187
|
||||
3 175 190 188
|
||||
3 191 184 189
|
||||
3 156 192 145
|
||||
3 191 193 184
|
||||
3 194 193 191
|
||||
3 194 195 193
|
||||
3 196 195 194
|
||||
3 196 197 195
|
||||
3 196 198 197
|
||||
3 199 198 196
|
||||
3 200 192 156
|
||||
3 199 201 198
|
||||
3 199 202 201
|
||||
3 203 202 199
|
||||
3 203 204 202
|
||||
3 200 205 192
|
||||
3 203 206 204
|
||||
3 207 206 203
|
||||
3 207 208 206
|
||||
3 207 209 208
|
||||
3 210 190 175
|
||||
3 207 211 209
|
||||
3 212 190 210
|
||||
3 207 213 211
|
||||
3 214 190 212
|
||||
3 207 215 213
|
||||
3 216 190 214
|
||||
3 207 217 215
|
||||
3 218 190 216
|
||||
3 207 219 217
|
||||
3 220 190 218
|
||||
3 207 221 219
|
||||
3 222 190 220
|
||||
3 207 223 221
|
||||
3 224 190 222
|
||||
3 207 225 223
|
||||
3 226 190 224
|
||||
3 207 227 225
|
||||
3 228 190 226
|
||||
3 229 227 207
|
||||
3 229 230 227
|
||||
3 231 190 228
|
||||
3 229 232 230
|
||||
3 233 190 231
|
||||
3 229 234 232
|
||||
3 235 190 233
|
||||
3 236 190 235
|
||||
3 237 190 236
|
||||
3 238 205 200
|
||||
3 239 190 237
|
||||
3 240 234 229
|
||||
3 241 190 239
|
||||
3 242 190 241
|
||||
3 243 190 242
|
||||
3 244 234 240
|
||||
3 238 245 205
|
||||
3 246 190 243
|
||||
3 247 190 246
|
||||
3 248 234 244
|
||||
3 249 190 247
|
||||
3 250 190 249
|
||||
3 251 234 248
|
||||
3 252 190 250
|
||||
3 251 253 234
|
||||
3 254 190 252
|
||||
3 255 253 251
|
||||
3 254 256 190
|
||||
3 255 257 253
|
||||
3 258 256 254
|
||||
3 259 257 255
|
||||
3 258 260 256
|
||||
3 259 261 257
|
||||
3 262 260 258
|
||||
3 263 261 259
|
||||
3 262 264 260
|
||||
3 263 265 261
|
||||
3 266 264 262
|
||||
3 267 265 263
|
||||
3 266 268 264
|
||||
3 267 269 265
|
||||
3 270 268 266
|
||||
3 271 269 267
|
||||
3 270 272 268
|
||||
3 271 273 269
|
||||
3 274 272 270
|
||||
3 275 245 238
|
||||
3 275 276 245
|
||||
3 277 276 275
|
||||
3 277 278 276
|
||||
3 279 278 277
|
||||
3 280 278 279
|
||||
3 281 278 280
|
||||
3 282 278 281
|
||||
3 283 278 282
|
||||
3 284 278 283
|
||||
3 285 278 284
|
||||
3 286 278 285
|
||||
3 287 278 286
|
||||
3 288 278 287
|
||||
3 289 278 288
|
||||
3 290 278 289
|
||||
3 291 278 290
|
||||
3 292 278 291
|
||||
3 292 293 278
|
||||
3 292 294 293
|
||||
3 292 295 294
|
||||
3 292 296 295
|
||||
3 292 297 296
|
||||
3 292 298 297
|
||||
3 292 299 298
|
||||
3 292 300 299
|
||||
3 292 301 300
|
||||
3 302 301 292
|
||||
3 302 303 301
|
||||
3 304 303 302
|
||||
File diff suppressed because it is too large
Load Diff
144
rsc/shaders/filters/3DPerlinNoise.glsl
Normal file
144
rsc/shaders/filters/3DPerlinNoise.glsl
Normal file
@@ -0,0 +1,144 @@
|
||||
// Original by TheTurk on https://www.shadertoy.com/view/slB3z3
|
||||
|
||||
// implementation of MurmurHash (https://sites.google.com/site/murmurhash/) for a
|
||||
// single unsigned integer.
|
||||
uint hash(uint x, uint seed) {
|
||||
const uint m = 0x5bd1e995U;
|
||||
uint hash = seed;
|
||||
// process input
|
||||
uint k = x;
|
||||
k *= m;
|
||||
k ^= k >> 24;
|
||||
k *= m;
|
||||
hash *= m;
|
||||
hash ^= k;
|
||||
// some final mixing
|
||||
hash ^= hash >> 13;
|
||||
hash *= m;
|
||||
hash ^= hash >> 15;
|
||||
return hash;
|
||||
}
|
||||
|
||||
// implementation of MurmurHash (https://sites.google.com/site/murmurhash/) for a
|
||||
// 3-dimensional unsigned integer input vector.
|
||||
uint hash(uvec3 x, uint seed){
|
||||
const uint m = 0x5bd1e995U;
|
||||
uint hash = seed;
|
||||
// process first vector element
|
||||
uint k = x.x;
|
||||
k *= m;
|
||||
k ^= k >> 24;
|
||||
k *= m;
|
||||
hash *= m;
|
||||
hash ^= k;
|
||||
// process second vector element
|
||||
k = x.y;
|
||||
k *= m;
|
||||
k ^= k >> 24;
|
||||
k *= m;
|
||||
hash *= m;
|
||||
hash ^= k;
|
||||
// process third vector element
|
||||
k = x.z;
|
||||
k *= m;
|
||||
k ^= k >> 24;
|
||||
k *= m;
|
||||
hash *= m;
|
||||
hash ^= k;
|
||||
// some final mixing
|
||||
hash ^= hash >> 13;
|
||||
hash *= m;
|
||||
hash ^= hash >> 15;
|
||||
return hash;
|
||||
}
|
||||
|
||||
|
||||
vec3 gradientDirection(uint hash) {
|
||||
switch (int(hash) & 15) { // look at the last four bits to pick a gradient direction
|
||||
case 0:
|
||||
return vec3(1, 1, 0);
|
||||
case 1:
|
||||
return vec3(-1, 1, 0);
|
||||
case 2:
|
||||
return vec3(1, -1, 0);
|
||||
case 3:
|
||||
return vec3(-1, -1, 0);
|
||||
case 4:
|
||||
return vec3(1, 0, 1);
|
||||
case 5:
|
||||
return vec3(-1, 0, 1);
|
||||
case 6:
|
||||
return vec3(1, 0, -1);
|
||||
case 7:
|
||||
return vec3(-1, 0, -1);
|
||||
case 8:
|
||||
return vec3(0, 1, 1);
|
||||
case 9:
|
||||
return vec3(0, -1, 1);
|
||||
case 10:
|
||||
return vec3(0, 1, -1);
|
||||
case 11:
|
||||
return vec3(0, -1, -1);
|
||||
case 12:
|
||||
return vec3(1, 1, 0);
|
||||
case 13:
|
||||
return vec3(-1, 1, 0);
|
||||
case 14:
|
||||
return vec3(0, -1, 1);
|
||||
case 15:
|
||||
return vec3(0, -1, -1);
|
||||
}
|
||||
}
|
||||
|
||||
float interpolate(float value1, float value2, float value3, float value4, float value5, float value6, float value7, float value8, vec3 t) {
|
||||
return mix(
|
||||
mix(mix(value1, value2, t.x), mix(value3, value4, t.x), t.y),
|
||||
mix(mix(value5, value6, t.x), mix(value7, value8, t.x), t.y),
|
||||
t.z
|
||||
);
|
||||
}
|
||||
|
||||
vec3 fade(vec3 t) {
|
||||
// 6t^5 - 15t^4 + 10t^3
|
||||
return t * t * t * (t * (t * 6.0 - 15.0) + 10.0);
|
||||
}
|
||||
|
||||
float perlinNoise(vec3 position, uint seed) {
|
||||
vec3 floorPosition = floor(position);
|
||||
vec3 fractPosition = position - floorPosition;
|
||||
uvec3 cellCoordinates = uvec3(floorPosition);
|
||||
float value1 = dot(gradientDirection(hash(cellCoordinates, seed)), fractPosition);
|
||||
float value2 = dot(gradientDirection(hash((cellCoordinates + uvec3(1, 0, 0)), seed)), fractPosition - vec3(1, 0, 0));
|
||||
float value3 = dot(gradientDirection(hash((cellCoordinates + uvec3(0, 1, 0)), seed)), fractPosition - vec3(0, 1, 0));
|
||||
float value4 = dot(gradientDirection(hash((cellCoordinates + uvec3(1, 1, 0)), seed)), fractPosition - vec3(1, 1, 0));
|
||||
float value5 = dot(gradientDirection(hash((cellCoordinates + uvec3(0, 0, 1)), seed)), fractPosition - vec3(0, 0, 1));
|
||||
float value6 = dot(gradientDirection(hash((cellCoordinates + uvec3(1, 0, 1)), seed)), fractPosition - vec3(1, 0, 1));
|
||||
float value7 = dot(gradientDirection(hash((cellCoordinates + uvec3(0, 1, 1)), seed)), fractPosition - vec3(0, 1, 1));
|
||||
float value8 = dot(gradientDirection(hash((cellCoordinates + uvec3(1, 1, 1)), seed)), fractPosition - vec3(1, 1, 1));
|
||||
return interpolate(value1, value2, value3, value4, value5, value6, value7, value8, fade(fractPosition));
|
||||
}
|
||||
|
||||
float perlinNoise(vec3 position, int frequency, int octaveCount, float persistence, float lacunarity, uint seed) {
|
||||
float value = 0.0;
|
||||
float amplitude = 1.0;
|
||||
float currentFrequency = float(frequency);
|
||||
uint currentSeed = seed;
|
||||
for (int i = 0; i < octaveCount; i++) {
|
||||
currentSeed = hash(currentSeed, 0x0U); // create a new seed for each octave
|
||||
value += perlinNoise(position * currentFrequency, currentSeed) * amplitude;
|
||||
amplitude *= persistence;
|
||||
currentFrequency *= lacunarity;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
|
||||
vec2 position = fragCoord / iResolution.xy;
|
||||
position.x *= iResolution.x / iResolution.y;
|
||||
uint seed = 0x578437adU; // can be set to something else if you want a different set of random values
|
||||
// float frequency = 16.0;
|
||||
// float value = perlinNoise(vec3(position, iTime * 0.25) * frequency, seed); // single octave perlin noise
|
||||
float value = perlinNoise(vec3(position, iTime * 0.25), 3, 6, 0.5, 2.0, seed); // multiple octaves
|
||||
value = (value + 1.0) * 0.5; // convert from range [-1, 1] to range [0, 1]
|
||||
fragColor = vec4(vec3(value), 1.0);
|
||||
}
|
||||
120
rsc/shaders/filters/3DSimplexNoise.glsl
Normal file
120
rsc/shaders/filters/3DSimplexNoise.glsl
Normal file
@@ -0,0 +1,120 @@
|
||||
/* https://www.shadertoy.com/view/XsX3zB
|
||||
*
|
||||
* The MIT License
|
||||
* Copyright © 2013 Nikita Miropolskiy
|
||||
*
|
||||
* ( license has been changed from CCA-NC-SA 3.0 to MIT
|
||||
*
|
||||
* but thanks for attributing your source code when deriving from this sample
|
||||
* with a following link: https://www.shadertoy.com/view/XsX3zB )
|
||||
*
|
||||
* ~
|
||||
* ~ if you're looking for procedural noise implementation examples you might
|
||||
* ~ also want to look at the following shaders:
|
||||
* ~
|
||||
* ~ Noise Lab shader by candycat: https://www.shadertoy.com/view/4sc3z2
|
||||
* ~
|
||||
* ~ Noise shaders by iq:
|
||||
* ~ Value Noise 2D, Derivatives: https://www.shadertoy.com/view/4dXBRH
|
||||
* ~ Gradient Noise 2D, Derivatives: https://www.shadertoy.com/view/XdXBRH
|
||||
* ~ Value Noise 3D, Derivatives: https://www.shadertoy.com/view/XsXfRH
|
||||
* ~ Gradient Noise 3D, Derivatives: https://www.shadertoy.com/view/4dffRH
|
||||
* ~ Value Noise 2D : https://www.shadertoy.com/view/lsf3WH
|
||||
* ~ Value Noise 3D : https://www.shadertoy.com/view/4sfGzS
|
||||
* ~ Gradient Noise 2D : https://www.shadertoy.com/view/XdXGW8
|
||||
* ~ Gradient Noise 3D : https://www.shadertoy.com/view/Xsl3Dl
|
||||
* ~ Simplex Noise 2D : https://www.shadertoy.com/view/Msf3WH
|
||||
* ~ Voronoise: https://www.shadertoy.com/view/Xd23Dh
|
||||
* ~
|
||||
*
|
||||
*/
|
||||
|
||||
/* discontinuous pseudorandom uniformly distributed in [-0.5, +0.5]^3 */
|
||||
vec3 random3(vec3 c) {
|
||||
float j = 4096.0*sin(dot(c,vec3(17.0, 59.4, 15.0)));
|
||||
vec3 r;
|
||||
r.z = fract(512.0*j);
|
||||
j *= .125;
|
||||
r.x = fract(512.0*j);
|
||||
j *= .125;
|
||||
r.y = fract(512.0*j);
|
||||
return r-0.5;
|
||||
}
|
||||
|
||||
/* skew constants for 3d simplex functions */
|
||||
const float F3 = 0.3333333;
|
||||
const float G3 = 0.1666667;
|
||||
|
||||
/* 3d simplex noise */
|
||||
float simplex3d(vec3 p) {
|
||||
/* 1. find current tetrahedron T and it's four vertices */
|
||||
/* s, s+i1, s+i2, s+1.0 - absolute skewed (integer) coordinates of T vertices */
|
||||
/* x, x1, x2, x3 - unskewed coordinates of p relative to each of T vertices*/
|
||||
|
||||
/* calculate s and x */
|
||||
vec3 s = floor(p + dot(p, vec3(F3)));
|
||||
vec3 x = p - s + dot(s, vec3(G3));
|
||||
|
||||
/* calculate i1 and i2 */
|
||||
vec3 e = step(vec3(0.0), x - x.yzx);
|
||||
vec3 i1 = e*(1.0 - e.zxy);
|
||||
vec3 i2 = 1.0 - e.zxy*(1.0 - e);
|
||||
|
||||
/* x1, x2, x3 */
|
||||
vec3 x1 = x - i1 + G3;
|
||||
vec3 x2 = x - i2 + 2.0*G3;
|
||||
vec3 x3 = x - 1.0 + 3.0*G3;
|
||||
|
||||
/* 2. find four surflets and store them in d */
|
||||
vec4 w, d;
|
||||
|
||||
/* calculate surflet weights */
|
||||
w.x = dot(x, x);
|
||||
w.y = dot(x1, x1);
|
||||
w.z = dot(x2, x2);
|
||||
w.w = dot(x3, x3);
|
||||
|
||||
/* w fades from 0.6 at the center of the surflet to 0.0 at the margin */
|
||||
w = max(0.6 - w, 0.0);
|
||||
|
||||
/* calculate surflet components */
|
||||
d.x = dot(random3(s), x);
|
||||
d.y = dot(random3(s + i1), x1);
|
||||
d.z = dot(random3(s + i2), x2);
|
||||
d.w = dot(random3(s + 1.0), x3);
|
||||
|
||||
/* multiply d by w^4 */
|
||||
w *= w;
|
||||
w *= w;
|
||||
d *= w;
|
||||
|
||||
/* 3. return the sum of the four surflets */
|
||||
return dot(d, vec4(52.0));
|
||||
}
|
||||
|
||||
/* const matrices for 3d rotation */
|
||||
const mat3 rot1 = mat3(-0.37, 0.36, 0.85,-0.14,-0.93, 0.34,0.92, 0.01,0.4);
|
||||
const mat3 rot2 = mat3(-0.55,-0.39, 0.74, 0.33,-0.91,-0.24,0.77, 0.12,0.63);
|
||||
const mat3 rot3 = mat3(-0.71, 0.52,-0.47,-0.08,-0.72,-0.68,-0.7,-0.45,0.56);
|
||||
|
||||
/* directional artifacts can be reduced by rotating each octave */
|
||||
float simplex3d_fractal(vec3 m) {
|
||||
return 0.5333333*simplex3d(m*rot1)
|
||||
+0.2666667*simplex3d(2.0*m*rot2)
|
||||
+0.1333333*simplex3d(4.0*m*rot3)
|
||||
+0.0666667*simplex3d(8.0*m);
|
||||
}
|
||||
|
||||
void mainImage( out vec4 fragColor, in vec2 fragCoord )
|
||||
{
|
||||
vec2 p = fragCoord.xy/iResolution.x;
|
||||
vec3 p3 = vec3(p, iTime*0.025);
|
||||
|
||||
float value = simplex3d_fractal(p3*8.0+8.0);
|
||||
value = 0.5 + 0.5*value;
|
||||
|
||||
fragColor = vec4(
|
||||
vec3(value),
|
||||
1.0);
|
||||
return;
|
||||
}
|
||||
26
rsc/shaders/filters/HSV.glsl
Normal file
26
rsc/shaders/filters/HSV.glsl
Normal file
@@ -0,0 +1,26 @@
|
||||
// The MIT License
|
||||
// Copyright © 2014 Inigo Quilez
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
// https://www.youtube.com/c/InigoQuilez
|
||||
// https://iquilezles.org
|
||||
|
||||
// Smooth HSV to RGB conversion
|
||||
vec3 hsv2rgb_smooth( in vec3 c )
|
||||
{
|
||||
vec3 rgb = clamp( abs(mod(c.x*6.0+vec3(0.0,4.0,2.0),6.0)-3.0)-1.0, 0.0, 1.0 );
|
||||
|
||||
rgb = rgb*rgb*(3.0-2.0*rgb); // cubic smoothing
|
||||
|
||||
return c.z * mix( vec3(1.0), rgb, c.y);
|
||||
}
|
||||
|
||||
void mainImage( out vec4 fragColor, in vec2 fragCoord )
|
||||
{
|
||||
vec2 uv = fragCoord.xy / iResolution.xy;
|
||||
|
||||
vec3 hsl = vec3( uv.x, 1.0, uv.y );
|
||||
|
||||
vec3 rgb_s = hsv2rgb_smooth( hsl );
|
||||
|
||||
fragColor = vec4( rgb_s, 1.0 );
|
||||
}
|
||||
32
rsc/shaders/filters/RGBnoise.glsl
Normal file
32
rsc/shaders/filters/RGBnoise.glsl
Normal file
@@ -0,0 +1,32 @@
|
||||
// The MIT License
|
||||
// Copyright © 2017 Inigo Quilez
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
// Based on https://www.shadertoy.com/view/4tfyW4, but simpler and faster
|
||||
//
|
||||
// See these too:
|
||||
// - https://www.shadertoy.com/view/llGSzw
|
||||
// - https://www.shadertoy.com/view/XlXcW4
|
||||
// - https://www.shadertoy.com/view/4tXyWN
|
||||
//
|
||||
// Not tested for uniformity, stratification, periodicity or whatever. Use (or not!) at your own risk
|
||||
|
||||
const uint k = 1103515245U; // GLIB C
|
||||
//const uint k = 134775813U; // Delphi and Turbo Pascal
|
||||
//const uint k = 1664525U; // Numerical Recipes
|
||||
|
||||
vec3 hash33( uvec3 x )
|
||||
{
|
||||
x = ((x>>8U)^x.yzx)*k;
|
||||
x = ((x>>8U)^x.yzx)*k;
|
||||
x = ((x>>8U)^x.yzx)*k;
|
||||
|
||||
return vec3(x)*(1.0/float(0xffffffffU));
|
||||
}
|
||||
|
||||
void mainImage( out vec4 fragColor, in vec2 fragCoord )
|
||||
{
|
||||
uvec3 p = uvec3(fragCoord, iFrame);
|
||||
fragColor = vec4( hash33(p), 1.0 );
|
||||
}
|
||||
|
||||
|
||||
11
rsc/shaders/filters/color.glsl
Normal file
11
rsc/shaders/filters/color.glsl
Normal file
@@ -0,0 +1,11 @@
|
||||
void mainImage( out vec4 fragColor, in vec2 fragCoord )
|
||||
{
|
||||
// Normalized pixel coordinates (from 0 to 1)
|
||||
vec2 uv = fragCoord/iResolution.xy;
|
||||
|
||||
// Time varying pixel color
|
||||
vec3 col = 0.5 + 0.5*cos(iTime+uv.xyx+vec3(0,2,4));
|
||||
|
||||
// Output to screen
|
||||
fragColor = vec4(col,1.0);
|
||||
}
|
||||
@@ -102,6 +102,7 @@ set(VMIX_SRCS
|
||||
Playlist.cpp
|
||||
Audio.cpp
|
||||
TextSource.cpp
|
||||
ShaderSource.cpp
|
||||
)
|
||||
|
||||
#####
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
#ifndef CLONESOURCE_H
|
||||
#define CLONESOURCE_H
|
||||
|
||||
#include <queue>
|
||||
|
||||
#include "Source.h"
|
||||
#include "FrameBufferFilter.h"
|
||||
|
||||
|
||||
@@ -531,8 +531,8 @@ Symbol::Symbol(Type t, glm::vec3 pos) : Node(), type_(t)
|
||||
shadows[GROUP] = shadow;
|
||||
icons[PATTERN] = new Mesh("mesh/icon_pattern.ply");
|
||||
shadows[PATTERN]= shadow;
|
||||
icons[GEAR] = new Mesh("mesh/icon_gear.ply");
|
||||
shadows[GEAR] = shadow;
|
||||
icons[CODE] = new Mesh("mesh/icon_code.ply");
|
||||
shadows[CODE] = shadow;
|
||||
icons[CAMERA] = new Mesh("mesh/icon_camera.ply");
|
||||
shadows[CAMERA] = shadow;
|
||||
icons[SCREEN] = new Mesh("mesh/icon_cube.ply");
|
||||
|
||||
@@ -90,7 +90,7 @@ public:
|
||||
RENDER,
|
||||
GROUP,
|
||||
PATTERN,
|
||||
GEAR,
|
||||
CODE,
|
||||
CAMERA,
|
||||
SCREEN,
|
||||
SHARE,
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
#include "DeviceSource.h"
|
||||
|
||||
#ifndef NDEBUG
|
||||
//#define DEVICE_DEBUG
|
||||
#define DEVICE_DEBUG
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -52,6 +52,7 @@
|
||||
#include "SrtReceiverSource.h"
|
||||
#include "MultiFileSource.h"
|
||||
#include "TextSource.h"
|
||||
#include "ShaderSource.h"
|
||||
#include "SessionCreator.h"
|
||||
#include "SessionVisitor.h"
|
||||
#include "Settings.h"
|
||||
@@ -1298,13 +1299,7 @@ void ImGuiVisitor::visit (ImageFilter& f)
|
||||
if ( ImGui::Button( ICON_FA_CODE " Open editor", ImVec2(IMGUI_RIGHT_ALIGN, 0)) )
|
||||
UserInterface::manager().shadercontrol.setVisible(true);
|
||||
ImGui::SameLine(0, IMGUI_SAME_LINE);
|
||||
if (ImGuiToolkit::TextButton("Code")) {
|
||||
FilteringProgram target;
|
||||
f.setProgram( target );
|
||||
UserInterface::manager().shadercontrol.Refresh();
|
||||
oss << "Shader code reset";
|
||||
Action::manager().store(oss.str());
|
||||
}
|
||||
ImGui::Text("Code");
|
||||
|
||||
// List of parameters
|
||||
oss << "Custom ";
|
||||
@@ -1399,6 +1394,42 @@ void ImGuiVisitor::visit (CloneSource& s)
|
||||
}
|
||||
}
|
||||
|
||||
void ImGuiVisitor::visit (ShaderSource& s)
|
||||
{
|
||||
ImVec2 top = ImGui::GetCursorPos();
|
||||
top.x = 0.5f * ImGui::GetFrameHeight() + ImGui::GetContentRegionAvail().x IMGUI_RIGHT_ALIGN;
|
||||
|
||||
// stream info
|
||||
ImGui::PushTextWrapPos(ImGui::GetCursorPos().x + ImGui::GetContentRegionAvail().x IMGUI_RIGHT_ALIGN);
|
||||
s.accept(info);
|
||||
ImGui::Text("%s", info.str().c_str());
|
||||
ImGui::PopTextWrapPos();
|
||||
ImGui::Spacing();
|
||||
|
||||
// filter options : open editor
|
||||
s.filter()->accept(*this);
|
||||
|
||||
ImVec2 botom = ImGui::GetCursorPos();
|
||||
|
||||
if ( !s.failed() ) {
|
||||
// icon (>) to open player
|
||||
if ( s.playable() ) {
|
||||
ImGui::SetCursorPos(top);
|
||||
std::string msg = s.playing() ? "Open Player\n(source is playing)" : "Open Player\n(source is paused)";
|
||||
if (ImGuiToolkit::IconButton( s.playing() ? ICON_FA_PLAY_CIRCLE : ICON_FA_PAUSE_CIRCLE, msg.c_str()))
|
||||
UserInterface::manager().showSourceEditor(&s);
|
||||
top.x += ImGui::GetFrameHeight();
|
||||
}
|
||||
ImGui::SetCursorPos(top);
|
||||
if (ImGuiToolkit::IconButton(ICON_FA_COPY, "Copy shader code"))
|
||||
ImGui::SetClipboardText( s.filter()->program().code().first.c_str() );
|
||||
}
|
||||
else
|
||||
info.reset();
|
||||
|
||||
ImGui::SetCursorPos(botom);
|
||||
}
|
||||
|
||||
void ImGuiVisitor::visit (PatternSource& s)
|
||||
{
|
||||
ImVec2 top = ImGui::GetCursorPos();
|
||||
|
||||
@@ -39,6 +39,7 @@ public:
|
||||
void visit (GenericStreamSource& s) override;
|
||||
void visit (SrtReceiverSource& s) override;
|
||||
void visit (TextSource& s) override;
|
||||
void visit (ShaderSource& s) override;
|
||||
|
||||
void visit (CloneSource& s) override;
|
||||
void visit (FrameBufferFilter&) override;
|
||||
|
||||
@@ -63,7 +63,7 @@ std::string fragmentFooter = "void main() {\n"
|
||||
" mainImage( FragColor, texcoord.xy * iResolution.xy );\n"
|
||||
"}\n";
|
||||
|
||||
std::list< FilteringProgram > FilteringProgram::presets = {
|
||||
std::list< FilteringProgram > FilteringProgram::example_filters = {
|
||||
FilteringProgram(),
|
||||
FilteringProgram("Blend", "shaders/filters/blend.glsl", "", { }),
|
||||
FilteringProgram("Bilateral","shaders/filters/focus.glsl", "", { }),
|
||||
@@ -74,8 +74,16 @@ std::list< FilteringProgram > FilteringProgram::presets = {
|
||||
FilteringProgram("Talk", "shaders/filters/talk.glsl", "", { }),
|
||||
FilteringProgram("Stippling","shaders/filters/stippling.glsl", "", { }),
|
||||
FilteringProgram("Dithering","shaders/filters/dithering.glsl", "", { }),
|
||||
FilteringProgram("Fisheye", "shaders/filters/fisheye.glsl", "", { }),
|
||||
FilteringProgram("Logo", "shaders/filters/logo.glsl", "", { })
|
||||
FilteringProgram("Fisheye", "shaders/filters/fisheye.glsl", "", { })
|
||||
};
|
||||
|
||||
std::list< FilteringProgram > FilteringProgram::example_patterns = {
|
||||
FilteringProgram("Color", "shaders/filters/color.glsl", "", { }),
|
||||
FilteringProgram("Color noise", "shaders/filters/RGBnoise.glsl", "", { }),
|
||||
FilteringProgram("Simplex Noise", "shaders/filters/3DSimplexNoise.glsl", "", { }),
|
||||
FilteringProgram("Perlin Noise", "shaders/filters/3DPerlinNoise.glsl", "", { }),
|
||||
FilteringProgram("HSV map", "shaders/filters/HSV.glsl", "", { }),
|
||||
FilteringProgram("Vimix logo", "shaders/filters/logo.glsl", "", { })
|
||||
};
|
||||
|
||||
std::string FilteringProgram::getFilterCodeInputs()
|
||||
|
||||
@@ -70,7 +70,8 @@ public:
|
||||
// globals
|
||||
static std::string getFilterCodeInputs();
|
||||
static std::string getFilterCodeDefault();
|
||||
static std::list< FilteringProgram > presets;
|
||||
static std::list< FilteringProgram > example_filters;
|
||||
static std::list< FilteringProgram > example_patterns;
|
||||
static glm::vec4 iMouse;
|
||||
};
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
#include "SrtReceiverSource.h"
|
||||
#include "MultiFileSource.h"
|
||||
#include "TextSource.h"
|
||||
#include "ShaderSource.h"
|
||||
#include "Session.h"
|
||||
#include "BaseToolkit.h"
|
||||
#include "SystemToolkit.h"
|
||||
@@ -524,3 +525,28 @@ void InfoVisitor::visit (TextSource& s)
|
||||
information_ = oss.str();
|
||||
current_id_ = s.id();
|
||||
}
|
||||
|
||||
void InfoVisitor::visit (ShaderSource& s)
|
||||
{
|
||||
if (current_id_ == s.id())
|
||||
return;
|
||||
|
||||
std::ostringstream oss;
|
||||
|
||||
ImageFilter *ft = s.filter();
|
||||
if (ft) {
|
||||
if (brief_) {
|
||||
oss << "RGB, " << (int) ft->resolution().x << " x " << (int) ft->resolution().y;
|
||||
}
|
||||
else {
|
||||
oss << "Shader code" << std::endl;
|
||||
oss << "RGB" << std::endl;
|
||||
oss << (int) ft->resolution().x << " x " << (int) ft->resolution().y;
|
||||
}
|
||||
}
|
||||
else
|
||||
oss << "Undefined";
|
||||
|
||||
information_ = oss.str();
|
||||
current_id_ = s.id();
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@ public:
|
||||
void visit (GenericStreamSource& s) override;
|
||||
void visit (SrtReceiverSource& s) override;
|
||||
void visit (TextSource& s) override;
|
||||
void visit (ShaderSource& s) override;
|
||||
};
|
||||
|
||||
#endif // INFOVISITOR_H
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
#include "MultiFileSource.h"
|
||||
#include "StreamSource.h"
|
||||
#include "NetworkSource.h"
|
||||
#include "ShaderSource.h"
|
||||
#include "SrtReceiverSource.h"
|
||||
#include "SourceCallback.h"
|
||||
|
||||
@@ -454,6 +455,18 @@ Source *Mixer::createSourceText(const std::string &contents, glm::ivec2 res)
|
||||
return s;
|
||||
}
|
||||
|
||||
Source *Mixer::createSourceShader(glm::ivec2 res)
|
||||
{
|
||||
ShaderSource *s = new ShaderSource;
|
||||
|
||||
s->setResolution(glm::vec3(res.x, res.y, 0.f));
|
||||
|
||||
// propose a new name
|
||||
s->setName("Shader");
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
Source * Mixer::createSourceGroup()
|
||||
{
|
||||
SessionGroupSource *s = new SessionGroupSource;
|
||||
|
||||
@@ -59,6 +59,7 @@ public:
|
||||
Source * createSourceNetwork(const std::string &nameconnection);
|
||||
Source * createSourceSrt (const std::string &ip, const std::string &port);
|
||||
Source * createSourceText (const std::string &contents, glm::ivec2 res);
|
||||
Source * createSourceShader (glm::ivec2 res);
|
||||
Source * createSourceGroup ();
|
||||
|
||||
// operations on sources
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
#include "MediaPlayer.h"
|
||||
#include "SystemToolkit.h"
|
||||
#include "SessionVisitor.h"
|
||||
#include "ShaderSource.h"
|
||||
|
||||
#include "tinyxml2Toolkit.h"
|
||||
using namespace tinyxml2;
|
||||
@@ -455,6 +456,9 @@ void SessionLoader::load(XMLElement *sessionNode)
|
||||
else if ( std::string(pType) == "TextSource") {
|
||||
load_source = new TextSource(id_xml_);
|
||||
}
|
||||
else if ( std::string(pType) == "ShaderSource") {
|
||||
load_source = new ShaderSource(id_xml_);
|
||||
}
|
||||
else if ( std::string(pType) == "CloneSource") {
|
||||
cloneNodesToAdd.push_front(xmlCurrent_);
|
||||
}
|
||||
@@ -644,6 +648,9 @@ Source *SessionLoader::createSource(tinyxml2::XMLElement *sourceNode, Mode mode)
|
||||
else if ( std::string(pType) == "TextSource") {
|
||||
load_source = new TextSource(id__);
|
||||
}
|
||||
else if ( std::string(pType) == "ShaderSource") {
|
||||
load_source = new ShaderSource(id__);
|
||||
}
|
||||
else if ( std::string(pType) == "CloneSource") {
|
||||
// clone from given origin
|
||||
XMLElement* originNode = xmlCurrent_->FirstChildElement("origin");
|
||||
@@ -1571,6 +1578,24 @@ void SessionLoader::visit (ImageFilter& f)
|
||||
|
||||
}
|
||||
|
||||
void SessionLoader::visit(ShaderSource &s)
|
||||
{
|
||||
XMLElement *res = xmlCurrent_->FirstChildElement("resolution");
|
||||
if (res) {
|
||||
glm::vec3 resolution(64.f, 64.f, 0.f);
|
||||
tinyxml2::XMLElementToGLM(res->FirstChildElement("vec3"), resolution);
|
||||
s.setResolution(resolution);
|
||||
}
|
||||
|
||||
// shader code
|
||||
xmlCurrent_ = xmlCurrent_->FirstChildElement("Filter");
|
||||
if (xmlCurrent_) {
|
||||
// set config filter
|
||||
s.filter()->accept(*this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void SessionLoader::visit (CloneSource& s)
|
||||
{
|
||||
// configuration of filter in clone
|
||||
|
||||
@@ -66,6 +66,7 @@ public:
|
||||
void visit (GenericStreamSource& s) override;
|
||||
void visit (SrtReceiverSource& s) override;
|
||||
void visit (TextSource& s) override;
|
||||
void visit (ShaderSource& s) override;
|
||||
|
||||
void visit (CloneSource& s) override;
|
||||
void visit (FrameBufferFilter&) override;
|
||||
|
||||
@@ -48,6 +48,7 @@ using namespace tinyxml2;
|
||||
#include "MediaPlayer.h"
|
||||
#include "MixingGroup.h"
|
||||
#include "SystemToolkit.h"
|
||||
#include "ShaderSource.h"
|
||||
|
||||
#include "SessionVisitor.h"
|
||||
|
||||
@@ -903,6 +904,23 @@ void SessionVisitor::visit (TextSource& s)
|
||||
xmlCurrent_->InsertEndChild(resolution);
|
||||
}
|
||||
|
||||
void SessionVisitor::visit (ShaderSource& s)
|
||||
{
|
||||
XMLElement *_node = xmlCurrent_;
|
||||
_node->SetAttribute("type", "ShaderSource");
|
||||
|
||||
XMLElement *resolution = xmlDoc_->NewElement("resolution");
|
||||
resolution->InsertEndChild( XMLElementFromGLM(xmlDoc_, s.filter()->resolution()) );
|
||||
_node->InsertEndChild(resolution);
|
||||
|
||||
// Filter
|
||||
xmlCurrent_ = xmlDoc_->NewElement("Filter");
|
||||
s.filter()->accept(*this);
|
||||
_node->InsertEndChild(xmlCurrent_);
|
||||
|
||||
xmlCurrent_ = _node; // parent for next visits
|
||||
}
|
||||
|
||||
void SessionVisitor::visit (DeviceSource& s)
|
||||
{
|
||||
xmlCurrent_->SetAttribute("type", "DeviceSource");
|
||||
|
||||
@@ -72,6 +72,7 @@ public:
|
||||
void visit (GenericStreamSource& s) override;
|
||||
void visit (SrtReceiverSource& s) override;
|
||||
void visit (TextSource& s) override;
|
||||
void visit (ShaderSource& s) override;
|
||||
|
||||
void visit (CloneSource& s) override;
|
||||
void visit (FrameBufferFilter&) override;
|
||||
|
||||
@@ -17,6 +17,7 @@ TextEditor _editor;
|
||||
#include "Mixer.h"
|
||||
#include "SystemToolkit.h"
|
||||
#include "CloneSource.h"
|
||||
#include "ShaderSource.h"
|
||||
#include "DialogToolkit.h"
|
||||
#include "UserInterfaceManager.h"
|
||||
|
||||
@@ -39,6 +40,14 @@ ImageFilter *getImageFilter(Source *s)
|
||||
i = dynamic_cast<ImageFilter *>(f);
|
||||
}
|
||||
}
|
||||
else {
|
||||
ShaderSource *sc = dynamic_cast<ShaderSource *>(s);
|
||||
// if s is a shader source
|
||||
if (sc != nullptr) {
|
||||
// it has an Image filter
|
||||
i = sc->filter();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return i;
|
||||
@@ -60,7 +69,7 @@ void saveEditorText(const std::string &filename)
|
||||
/// SHADER EDITOR
|
||||
///
|
||||
///
|
||||
ShaderEditWindow::ShaderEditWindow() : WorkspaceWindow("Shader"), current_(nullptr), show_shader_inputs_(false)
|
||||
ShaderEditWindow::ShaderEditWindow() : WorkspaceWindow("Shader"), _cs_id(0), current_(nullptr), show_shader_inputs_(false)
|
||||
{
|
||||
auto lang = TextEditor::LanguageDefinition::GLSL();
|
||||
|
||||
@@ -299,16 +308,31 @@ void ShaderEditWindow::Render()
|
||||
|
||||
// Menu section for presets and examples
|
||||
if (ImGui::BeginMenu(ICON_FA_SCROLL " Examples", current_ != nullptr)) {
|
||||
for (auto p = FilteringProgram::presets.begin();
|
||||
p != FilteringProgram::presets.end();
|
||||
++p) {
|
||||
if (ImGui::MenuItem(p->name().c_str())) {
|
||||
// copy text code into editor
|
||||
_editor.SetText( p->code().first );
|
||||
|
||||
if (ImGui::BeginMenu("Filters", current_ != nullptr)) {
|
||||
for (auto p = FilteringProgram::example_filters.begin();
|
||||
p != FilteringProgram::example_filters.end();
|
||||
++p) {
|
||||
if (ImGui::MenuItem(p->name().c_str())) {
|
||||
// copy text code into editor
|
||||
_editor.SetText( p->code().first );
|
||||
}
|
||||
}
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
|
||||
if (ImGui::BeginMenu("Patterns", current_ != nullptr)) {
|
||||
for (auto p = FilteringProgram::example_patterns.begin();
|
||||
p != FilteringProgram::example_patterns.end();
|
||||
++p) {
|
||||
if (ImGui::MenuItem(p->name().c_str())) {
|
||||
// copy text code into editor
|
||||
_editor.SetText( p->code().first );
|
||||
}
|
||||
}
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
|
||||
ImGui::Separator();
|
||||
// Open browser to vimix wiki doc
|
||||
if (ImGui::MenuItem( ICON_FA_EXTERNAL_LINK_ALT " Documentation") )
|
||||
SystemToolkit::open(
|
||||
@@ -423,64 +447,77 @@ void ShaderEditWindow::Render()
|
||||
// not compiling
|
||||
else {
|
||||
|
||||
ImageFilter *i = nullptr;
|
||||
// if there is a current source
|
||||
if (cs != nullptr) {
|
||||
i = getImageFilter(cs);
|
||||
// if we can access the code of the filter
|
||||
if (i != nullptr) {
|
||||
// if the current clone was not already registered
|
||||
if ( filters_.find(i) == filters_.end() ) {
|
||||
// remember program for this image filter
|
||||
filters_[i] = i->program();
|
||||
// set a name to the filter
|
||||
filters_[i].setName(cs->name());
|
||||
// if current source is different from previous one
|
||||
if (cs->id() != _cs_id) {
|
||||
// if we can access the shader of that source
|
||||
ImageFilter *i = getImageFilter(cs);
|
||||
if (i != nullptr) {
|
||||
|
||||
// if the current clone was not already registered
|
||||
if (filters_.find(i) == filters_.end()) {
|
||||
// remember program for this image filter
|
||||
filters_[i] = i->program();
|
||||
// set a name to the filter
|
||||
filters_[i].setName(cs->name());
|
||||
}
|
||||
|
||||
// keep unsaved code of current editor
|
||||
if (current_ != nullptr) {
|
||||
// get the editor text and remove trailing '\n'
|
||||
std::string code = _editor.GetText();
|
||||
code = code.substr(0, code.size() -1);
|
||||
// remember this code as buffered for this filter
|
||||
filters_[current_].setCode( { code, "" } );
|
||||
}
|
||||
|
||||
// set current shader code menu (can be empty for embedded)
|
||||
Settings::application.recentShaderCode.push(filters_[i].filename());
|
||||
Settings::application.recentShaderCode.assign(filters_[i].filename());
|
||||
|
||||
// change editor
|
||||
_editor.SetText( filters_[i].code().first );
|
||||
_editor.SetReadOnly(false);
|
||||
_editor.SetColorizerEnable(true);
|
||||
status_ = "Ready";
|
||||
|
||||
// change current
|
||||
current_ = i;
|
||||
}
|
||||
}
|
||||
// there is a current source, and it is not a filter
|
||||
if (i == nullptr) {
|
||||
status_ = "-";
|
||||
_editor.SetText("");
|
||||
_editor.SetReadOnly(true);
|
||||
current_ = nullptr;
|
||||
Settings::application.recentShaderCode.assign("");
|
||||
// there is a current source, and it is not a shader
|
||||
else {
|
||||
_editor.SetText("");
|
||||
_editor.SetReadOnly(true);
|
||||
Settings::application.recentShaderCode.assign("");
|
||||
status_ = "-";
|
||||
// reset current
|
||||
current_ = nullptr;
|
||||
}
|
||||
|
||||
// keep track of source currently shown to do that only on change
|
||||
_cs_id = cs->id();
|
||||
}
|
||||
}
|
||||
else
|
||||
status_ = "-";
|
||||
|
||||
// change editor text only if current changed
|
||||
if ( current_ != i )
|
||||
{
|
||||
// get the editor text and remove trailing '\n'
|
||||
std::string code = _editor.GetText();
|
||||
code = code.substr(0, code.size() -1);
|
||||
|
||||
// remember this code as buffered for the filter of this source
|
||||
filters_[current_].setCode( { code, "" } );
|
||||
|
||||
// if switch to another shader code
|
||||
if ( i != nullptr ) {
|
||||
// set current shader code menu (can be empty for embedded)
|
||||
Settings::application.recentShaderCode.push(filters_[i].filename());
|
||||
Settings::application.recentShaderCode.assign(filters_[i].filename());
|
||||
|
||||
// change editor
|
||||
_editor.SetText( filters_[i].code().first );
|
||||
_editor.SetReadOnly(false);
|
||||
_editor.SetColorizerEnable(true);
|
||||
status_ = "Ready";
|
||||
// no current source
|
||||
else if (_cs_id > 0) {
|
||||
// if previous was probably removed
|
||||
if (current_ != nullptr && !Mixer::manager().findSource(_cs_id)) {
|
||||
_editor.SetText("");
|
||||
_editor.SetReadOnly(true);
|
||||
Settings::application.recentShaderCode.assign("");
|
||||
// reset current
|
||||
current_ = nullptr;
|
||||
}
|
||||
// cancel edit clone
|
||||
else {
|
||||
// possibility that source was removed
|
||||
// disable editor
|
||||
// disable but keep code in editor
|
||||
_editor.SetReadOnly(true);
|
||||
_editor.SetColorizerEnable(false);
|
||||
status_ = "-";
|
||||
}
|
||||
// current changed
|
||||
current_ = i;
|
||||
|
||||
// keep track that no source currently shown to do this once only
|
||||
_cs_id = 0;
|
||||
status_ = "-";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -605,4 +642,5 @@ void ShaderEditWindow::Refresh()
|
||||
if ( current_ != nullptr )
|
||||
filters_.erase(current_);
|
||||
current_ = nullptr;
|
||||
_cs_id = 0;
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
class ShaderEditWindow : public WorkspaceWindow
|
||||
{
|
||||
uint64_t _cs_id;
|
||||
ImageFilter *current_;
|
||||
std::map<ImageFilter *, FilteringProgram> filters_;
|
||||
std::promise<std::string> *compilation_;
|
||||
|
||||
200
src/ShaderSource.cpp
Normal file
200
src/ShaderSource.cpp
Normal file
@@ -0,0 +1,200 @@
|
||||
/*
|
||||
* This file is part of vimix - video live mixer
|
||||
*
|
||||
* **Copyright** (C) 2019-2023 Bruno Herbelin <bruno.herbelin@gmail.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
**/
|
||||
|
||||
#include <gst/gst.h>
|
||||
|
||||
#include <glm/gtc/matrix_access.hpp>
|
||||
#include <glm/gtc/matrix_transform.hpp>
|
||||
|
||||
#include "Log.h"
|
||||
#include "Decorations.h"
|
||||
#include "Visitor.h"
|
||||
#include "FrameBuffer.h"
|
||||
#include "FrameBufferFilter.h"
|
||||
#include "DelayFilter.h"
|
||||
#include "ImageFilter.h"
|
||||
|
||||
#include "ShaderSource.h"
|
||||
|
||||
ShaderSource::ShaderSource(uint64_t id) : Source(id), paused_(false), filter_(nullptr)
|
||||
{
|
||||
// set symbol
|
||||
symbol_ = new Symbol(Symbol::CODE, glm::vec3(0.75f, 0.75f, 0.01f));
|
||||
symbol_->scale_.y = 1.5f;
|
||||
|
||||
// default
|
||||
filter_ = new ImageFilter;
|
||||
filter_->setProgram(FilteringProgram::example_patterns.front());
|
||||
background_ = new FrameBuffer(64, 64);
|
||||
}
|
||||
|
||||
ShaderSource::~ShaderSource()
|
||||
{
|
||||
delete filter_;
|
||||
delete background_;
|
||||
}
|
||||
|
||||
|
||||
void ShaderSource::setResolution(glm::vec3 resolution)
|
||||
{
|
||||
if (background_)
|
||||
delete background_;
|
||||
|
||||
background_ = new FrameBuffer(resolution);
|
||||
}
|
||||
|
||||
void ShaderSource::setProgram(const FilteringProgram &f)
|
||||
{
|
||||
filter_->setProgram(f);
|
||||
}
|
||||
|
||||
void ShaderSource::init()
|
||||
{
|
||||
if (background_) {
|
||||
|
||||
// create render Frame buffer matching size of images
|
||||
FrameBuffer *renderbuffer = new FrameBuffer( background_->resolution() );
|
||||
|
||||
// set the renderbuffer of the source and attach rendering nodes
|
||||
attach(renderbuffer);
|
||||
|
||||
// force update of activation mode
|
||||
active_ = true;
|
||||
|
||||
// deep update to reorder
|
||||
++View::need_deep_update_;
|
||||
|
||||
// done init
|
||||
Log::Info("Source '%s' shader.", name().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void ShaderSource::render()
|
||||
{
|
||||
if ( renderbuffer_ == nullptr )
|
||||
init();
|
||||
else {
|
||||
// render filter image
|
||||
filter_->draw( background_ );
|
||||
|
||||
// ensure correct output texture is displayed (could have changed if filter changed)
|
||||
texturesurface_->setTextureIndex( filter_->texture() );
|
||||
|
||||
// detect resampling (change of resolution in filter)
|
||||
if ( renderbuffer_->resolution() != filter_->resolution() ) {
|
||||
renderbuffer_->resize( filter_->resolution() );
|
||||
}
|
||||
|
||||
// render textured surface into frame buffer
|
||||
// NB: this also applies the color correction shader
|
||||
renderbuffer_->begin();
|
||||
texturesurface_->draw(glm::identity<glm::mat4>(), renderbuffer_->projection());
|
||||
renderbuffer_->end();
|
||||
ready_ = true;
|
||||
}
|
||||
}
|
||||
|
||||
void ShaderSource::setActive (bool on)
|
||||
{
|
||||
bool was_active = active_;
|
||||
|
||||
// try to activate (may fail if source is cloned)
|
||||
Source::setActive(on);
|
||||
|
||||
// enable / disable filtering
|
||||
if ( active_ != was_active )
|
||||
filter_->setEnabled( active_ );
|
||||
|
||||
}
|
||||
|
||||
void ShaderSource::update(float dt)
|
||||
{
|
||||
Source::update(dt);
|
||||
|
||||
if (!paused_ && active_)
|
||||
filter_->update(dt);
|
||||
|
||||
}
|
||||
|
||||
void ShaderSource::play (bool on)
|
||||
{
|
||||
// if a different state is asked
|
||||
if (paused_ == on) {
|
||||
|
||||
// play / pause filter to suspend clone
|
||||
filter_->setEnabled( on );
|
||||
|
||||
// restart delay if was paused
|
||||
if (paused_)
|
||||
replay();
|
||||
|
||||
// toggle state
|
||||
paused_ = !on;
|
||||
}
|
||||
}
|
||||
|
||||
bool ShaderSource::playable () const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void ShaderSource::replay()
|
||||
{
|
||||
// reset Filter
|
||||
filter_->reset();
|
||||
}
|
||||
|
||||
void ShaderSource::reload()
|
||||
{
|
||||
replay();
|
||||
}
|
||||
|
||||
guint64 ShaderSource::playtime () const
|
||||
{
|
||||
if (filter_)
|
||||
return guint64( filter_->updateTime() * GST_SECOND ) ;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint ShaderSource::texture() const
|
||||
{
|
||||
return filter_->texture();
|
||||
}
|
||||
|
||||
Source::Failure ShaderSource::failed() const
|
||||
{
|
||||
return FAIL_NONE;
|
||||
}
|
||||
|
||||
void ShaderSource::accept(Visitor& v)
|
||||
{
|
||||
Source::accept(v);
|
||||
v.visit(*this);
|
||||
}
|
||||
|
||||
glm::ivec2 ShaderSource::icon() const
|
||||
{
|
||||
return glm::ivec2(ICON_SOURCE_SHADER);
|
||||
}
|
||||
|
||||
std::string ShaderSource::info() const
|
||||
{
|
||||
return "Shader";
|
||||
}
|
||||
53
src/ShaderSource.h
Normal file
53
src/ShaderSource.h
Normal file
@@ -0,0 +1,53 @@
|
||||
#ifndef SHADERSOURCE_H
|
||||
#define SHADERSOURCE_H
|
||||
|
||||
#include "Source.h"
|
||||
#include "ImageFilter.h"
|
||||
|
||||
class ShaderSource : public Source
|
||||
{
|
||||
friend class Source;
|
||||
|
||||
public:
|
||||
// only Source class can create new ShaderSource via clone();
|
||||
ShaderSource(uint64_t id = 0);
|
||||
~ShaderSource();
|
||||
|
||||
// implementation of source API
|
||||
void update (float dt) override;
|
||||
void setActive (bool on) override;
|
||||
bool playing () const override { return !paused_; }
|
||||
void play (bool on) override;
|
||||
bool playable () const override;
|
||||
void replay () override;
|
||||
void reload() override;
|
||||
guint64 playtime () const override;
|
||||
uint texture() const override;
|
||||
Failure failed() const override;
|
||||
void accept (Visitor& v) override;
|
||||
void render() override;
|
||||
glm::ivec2 icon() const override;
|
||||
std::string info() const override;
|
||||
bool texturePostProcessed() const override { return true; }
|
||||
|
||||
// setup shader
|
||||
void setResolution(glm::vec3 resolution);
|
||||
void setProgram(const FilteringProgram &f);
|
||||
|
||||
// access shader
|
||||
inline ImageFilter *filter() { return filter_; }
|
||||
|
||||
protected:
|
||||
|
||||
void init() override;
|
||||
|
||||
// control
|
||||
bool paused_;
|
||||
|
||||
// Filter
|
||||
ImageFilter *filter_;
|
||||
FrameBuffer *background_;
|
||||
};
|
||||
|
||||
|
||||
#endif // CLONESOURCE_H
|
||||
@@ -27,6 +27,7 @@
|
||||
#define ICON_SOURCE_GSTREAMER 16, 16
|
||||
#define ICON_SOURCE_SRT 14, 5
|
||||
#define ICON_SOURCE_TEXT 0, 13
|
||||
#define ICON_SOURCE_SHADER 16, 14
|
||||
#define ICON_SOURCE 13, 11
|
||||
#define ICON_WORKSPACE_BACKGROUND 10, 16
|
||||
#define ICON_WORKSPACE_CENTRAL 11, 16
|
||||
|
||||
@@ -83,7 +83,7 @@ glm::ivec2 GenericStreamSource::icon() const
|
||||
|
||||
std::string GenericStreamSource::info() const
|
||||
{
|
||||
return "Custom gstreamer";
|
||||
return "Gstreamer";
|
||||
}
|
||||
|
||||
StreamSource::StreamSource(uint64_t id) : Source(id), stream_(nullptr)
|
||||
|
||||
@@ -4136,18 +4136,6 @@ void Navigator::RenderNewPannel(const ImVec2 &iconsize)
|
||||
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
|
||||
if (ImGui::BeginCombo("##Pattern", "Select", ImGuiComboFlags_HeightLarge))
|
||||
{
|
||||
if ( ImGuiToolkit::SelectableIcon(16, 16, "Custom gstreamer", false) )
|
||||
{
|
||||
update_new_source = true;
|
||||
generated_type = 0;
|
||||
pattern_type = -1;
|
||||
}
|
||||
if ( ImGuiToolkit::SelectableIcon(0, 13, "Text", false) )
|
||||
{
|
||||
update_new_source = true;
|
||||
generated_type = 1;
|
||||
pattern_type = -1;
|
||||
}
|
||||
if ( ImGuiToolkit::BeginMenuIcon(ICON_SOURCE_PATTERN, "Static patterns"))
|
||||
{
|
||||
for (int p = 0; p < (int) Pattern::count(); ++p) {
|
||||
@@ -4176,6 +4164,24 @@ void Navigator::RenderNewPannel(const ImVec2 &iconsize)
|
||||
}
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
if ( ImGuiToolkit::SelectableIcon(ICON_SOURCE_TEXT, "Text", false) )
|
||||
{
|
||||
update_new_source = true;
|
||||
generated_type = 1;
|
||||
pattern_type = -1;
|
||||
}
|
||||
if ( ImGuiToolkit::SelectableIcon(ICON_SOURCE_SHADER, "Custom shader", false) )
|
||||
{
|
||||
update_new_source = true;
|
||||
generated_type = 3;
|
||||
pattern_type = -1;
|
||||
}
|
||||
if ( ImGuiToolkit::SelectableIcon(ICON_SOURCE_GSTREAMER, "Custom gstreamer", false) )
|
||||
{
|
||||
update_new_source = true;
|
||||
generated_type = 0;
|
||||
pattern_type = -1;
|
||||
}
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
|
||||
@@ -4226,7 +4232,7 @@ void Navigator::RenderNewPannel(const ImVec2 &iconsize)
|
||||
ImGui::SetCursorPos(pos_bot);
|
||||
// take action
|
||||
if (update_new_source)
|
||||
new_source_preview_.setSource( Mixer::manager().createSourceStream(_description), "Custom");
|
||||
new_source_preview_.setSource( Mixer::manager().createSourceStream(_description), "Gstreamer source");
|
||||
|
||||
}
|
||||
// if text source selected
|
||||
@@ -4312,10 +4318,28 @@ void Navigator::RenderNewPannel(const ImVec2 &iconsize)
|
||||
// take action
|
||||
if (update_new_source) {
|
||||
glm::ivec2 res = GlmToolkit::resolutionFromDescription(Settings::application.source.ratio, Settings::application.source.res);
|
||||
new_source_preview_.setSource(Mixer::manager().createSourceText(_contents, res), "Text");
|
||||
new_source_preview_.setSource(Mixer::manager().createSourceText(_contents, res), "Text source");
|
||||
}
|
||||
}
|
||||
// if shader source selected
|
||||
else if (generated_type == 3 ) {
|
||||
|
||||
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
|
||||
if (ImGui::Combo("Ratio", &Settings::application.source.ratio,
|
||||
GlmToolkit::aspect_ratio_names, IM_ARRAYSIZE(GlmToolkit::aspect_ratio_names) ) )
|
||||
update_new_source = true;
|
||||
|
||||
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
|
||||
if (ImGui::Combo("Height", &Settings::application.source.res,
|
||||
GlmToolkit::height_names, IM_ARRAYSIZE(GlmToolkit::height_names) ) )
|
||||
update_new_source = true;
|
||||
|
||||
// create preview
|
||||
if (update_new_source) {
|
||||
glm::ivec2 res = GlmToolkit::resolutionFromDescription(Settings::application.source.ratio, Settings::application.source.res);
|
||||
new_source_preview_.setSource( Mixer::manager().createSourceShader(res), "Shader source");
|
||||
}
|
||||
}
|
||||
// if pattern selected
|
||||
else {
|
||||
// resolution
|
||||
if (pattern_type >= 0) {
|
||||
|
||||
@@ -50,6 +50,7 @@ public:
|
||||
virtual void visit (class CloneSource&) {}
|
||||
virtual void visit (class MultiFileSource&) {}
|
||||
virtual void visit (class TextSource&) {}
|
||||
virtual void visit (class ShaderSource&) {}
|
||||
|
||||
virtual void visit (class FrameBufferFilter&) {}
|
||||
virtual void visit (class PassthroughFilter&) {}
|
||||
|
||||
Reference in New Issue
Block a user