Inital Commit of C# Code

This commit is contained in:
Mario Steele 2025-09-23 15:11:34 -05:00
commit c5058f8b84
104 changed files with 2588 additions and 0 deletions

3
.gitignore vendored Normal file
View file

@ -0,0 +1,3 @@
.godot
.idea

7
GDE_Gozen_CSharp.csproj Normal file
View file

@ -0,0 +1,7 @@
<Project Sdk="Godot.NET.Sdk/4.5.0">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework Condition=" '$(GodotTargetPlatform)' == 'android' ">net9.0</TargetFramework>
<EnableDynamicLoading>true</EnableDynamicLoading>
</PropertyGroup>
</Project>

19
GDE_Gozen_CSharp.sln Normal file
View file

@ -0,0 +1,19 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GDE_Gozen_CSharp", "GDE_Gozen_CSharp.csproj", "{FD7EE050-DFBD-4F20-BB3E-78EBA85F3AD2}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
ExportDebug|Any CPU = ExportDebug|Any CPU
ExportRelease|Any CPU = ExportRelease|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{FD7EE050-DFBD-4F20-BB3E-78EBA85F3AD2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FD7EE050-DFBD-4F20-BB3E-78EBA85F3AD2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FD7EE050-DFBD-4F20-BB3E-78EBA85F3AD2}.ExportDebug|Any CPU.ActiveCfg = ExportDebug|Any CPU
{FD7EE050-DFBD-4F20-BB3E-78EBA85F3AD2}.ExportDebug|Any CPU.Build.0 = ExportDebug|Any CPU
{FD7EE050-DFBD-4F20-BB3E-78EBA85F3AD2}.ExportRelease|Any CPU.ActiveCfg = ExportRelease|Any CPU
{FD7EE050-DFBD-4F20-BB3E-78EBA85F3AD2}.ExportRelease|Any CPU.Build.0 = ExportRelease|Any CPU
EndGlobalSection
EndGlobal

View file

@ -0,0 +1,53 @@
using Godot;
using System;
using Godot.Collections;
public partial class GoZenVideo : Resource
{
private Variant _gdHndl;
public GoZenVideo(Resource hndl)
{
_gdHndl = hndl;
}
public GoZenVideo()
{
_gdHndl = ClassDB.Instantiate("GoZenVideo");
}
public static Dictionary GetFileMeta(string file_path) =>
ClassDB.ClassCallStatic("GoZenVideo", "get_file_meta", Variant.CreateFrom(file_path)).AsGodotDictionary();
public int Open(string video_path) => _gdHndl.AsGodotObject().Call("open", Variant.CreateFrom(video_path)).AsInt32();
public void Close() => _gdHndl.AsGodotObject().Call("close");
public bool IsOpen() => _gdHndl.AsGodotObject().Call("is_open").AsBool();
public int SeekFrame(int frame_nr) => _gdHndl.AsGodotObject().Call("seek_frame", Variant.CreateFrom(frame_nr)).AsInt32();
public bool NextFrame() => _gdHndl.AsGodotObject().Call("next_frame").AsBool();
public string GetPath() => _gdHndl.AsGodotObject().Call("get_path").AsString();
public float GetFramerate() => _gdHndl.AsGodotObject().Call("get_framerate").AsSingle();
public int GetFrameCount() => _gdHndl.AsGodotObject().Call("get_frame_count").AsInt32();
public Vector2I GetResolution() => _gdHndl.AsGodotObject().Call("get_resolution").AsVector2I();
public Vector2I GetActualResolution() => _gdHndl.AsGodotObject().Call("get_actual_resolution").AsVector2I();
public int GetWidth() => _gdHndl.AsGodotObject().Call("get_width").AsInt32();
public int GetHeight() => _gdHndl.AsGodotObject().Call("get_height").AsInt32();
public int GetPadding() => _gdHndl.AsGodotObject().Call("get_padding").AsInt32();
public int GetRotation() => _gdHndl.AsGodotObject().Call("get_rotation").AsInt32();
public int GetInterlaced() => _gdHndl.AsGodotObject().Call("get_interlaced").AsInt32();
public float GetSar() => _gdHndl.AsGodotObject().Call("get_sar").AsSingle();
public void EnableDebug() => _gdHndl.AsGodotObject().Call("enable_debug");
public void DisableDebug() => _gdHndl.AsGodotObject().Call("disable_debug");
public bool GetDebugEnabled() => _gdHndl.AsGodotObject().Call("get_debug_enabled").AsBool();
public string GetPixelFormat() => _gdHndl.AsGodotObject().Call("get_pixel_format").AsString();
public string GetColorProfile() => _gdHndl.AsGodotObject().Call("get_color_profile").AsString();
public bool IsFullColorRange() => _gdHndl.AsGodotObject().Call("is_full_color_range").AsBool();
public bool IsUsingSws() => _gdHndl.AsGodotObject().Call("is_using_sws").AsBool();
public Image GetYData() => _gdHndl.AsGodotObject().Call("get_y_data").As<Image>();
public Image GetUData() => _gdHndl.AsGodotObject().Call("get_u_data").As<Image>();
public Image GetVData() => _gdHndl.AsGodotObject().Call("get_v_data").As<Image>();
}

View file

@ -0,0 +1 @@
uid://ckbx1kkujbgjk

504
addons/gde_gozen/LICENSE Normal file
View file

@ -0,0 +1,504 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the Lesser GPL. It also counts
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.]
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Lesser General Public License, applies to some
specially designated software packages--typically libraries--of the
Free Software Foundation and other authors who decide to use it. You
can use it too, but we suggest you first think carefully about whether
this license or the ordinary General Public License is the better
strategy to use in any particular case, based on the explanations below.
When we speak of free software, we are referring to freedom of use,
not price. Our General Public Licenses are designed to make sure that
you have the freedom to distribute copies of free software (and charge
for this service if you wish); that you receive source code or can get
it if you want it; that you can change the software and use pieces of
it in new free programs; and that you are informed that you can do
these things.
To protect your rights, we need to make restrictions that forbid
distributors to deny you these rights or to ask you to surrender these
rights. These restrictions translate to certain responsibilities for
you if you distribute copies of the library or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link other code with the library, you must provide
complete object files to the recipients, so that they can relink them
with the library after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
We protect your rights with a two-step method: (1) we copyright the
library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.
To protect each distributor, we want to make it very clear that
there is no warranty for the free library. Also, if the library is
modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
restrictive license from a patent holder. Therefore, we insist that
any patent license obtained for a version of the library must be
consistent with the full freedom of use specified in this license.
Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License. This license, the GNU Lesser
General Public License, applies to certain designated libraries, and
is quite different from the ordinary General Public License. We use
this license for certain libraries in order to permit linking those
libraries into non-free programs.
When a program is linked with a library, whether statically or using
a shared library, the combination of the two is legally speaking a
combined work, a derivative of the original library. The ordinary
General Public License therefore permits such linking only if the
entire combination fits its criteria of freedom. The Lesser General
Public License permits more lax criteria for linking other code with
the library.
We call this license the "Lesser" General Public License because it
does Less to protect the user's freedom than the ordinary General
Public License. It also provides other free software developers Less
of an advantage over competing non-free programs. These disadvantages
are the reason we use the ordinary General Public License for many
libraries. However, the Lesser license provides advantages in certain
special circumstances.
For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it becomes
a de-facto standard. To achieve this, non-free programs must be
allowed to use the library. A more frequent case is that a free
library does the same job as widely used non-free libraries. In this
case, there is little to gain by limiting the free library to free
software only, so we use the Lesser General Public License.
In other cases, permission to use a particular library in non-free
programs enables a greater number of people to use a large body of
free software. For example, permission to use the GNU C Library in
non-free programs enables many more people to use the whole GNU
operating system, as well as its variant, the GNU/Linux operating
system.
Although the Lesser General Public License is Less protective of the
users' freedom, it does ensure that the user of a program that is
linked with the Library has the freedom and the wherewithal to run
that program using a modified version of the Library.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library or other
program which contains a notice placed by the copyright holder or
other authorized party saying it may be distributed under the terms of
this Lesser General Public License (also called "this License").
Each licensee is addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (1) uses at run time a
copy of the library already present on the user's computer system,
rather than copying library functions into the executable, and (2)
will operate properly with a modified version of the library, if
the user installs one, as long as the modified version is
interface-compatible with the version that the work was made with.
c) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
d) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
e) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the materials to be distributed need not include anything that is
normally distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties with
this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
versions of the Lesser General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).
To apply these terms, attach the following notices to the library. It is
safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
<one line to give the library's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
USA
Also add information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the library, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
library `Frob' (a library for tweaking knobs) written by James Random
Hacker.
<signature of Ty Coon>, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!

View file

@ -0,0 +1,15 @@
# GDE GoZen
## Adding the addon to your project
The GDE GoZen addon is very straightforward, put this folder `gde_gozen` inside of a folder called addons inside of your Godot project. You may need to restart you project as the GDExtension which interacts with FFmpeg will probably complain about something not being fully loaded. After reloading you will have access to a new node called `VideoPlayback`. This node has a lot of documentation comments so if you press F1 inside of Godot and search for the node `VideoPlayback`, you'll find it's documentation and more notes on how to use it.
Since version 8.0 it's possible to add and play videos from your project directly. What you would need to adjust however is to add `mp4` and any other video extensions you might use to your Editor settings in `docks/filesystem/other_file_extensions` so they show up in your file explorer.
## Exporting your project
When exporting your projects, take in mind to bundle your executables with the FFmpeg library files which should be present in your exported projects folder.
## Help needed?
You can go to the [GitHub repo](https://github.com/VoylinsGamedevJourney/gde_gozen/issues) to report problems, or visit out [Discord server](discord.gg/BdbUf7VKYC) for help/advice.
> This software uses libraries from the FFmpeg project under the LGPLv2.1
[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/R6R4M1UM6)

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,194 @@
[configuration]
entry_symbol = "gozen_library_init"
compatibility_minimum = "4.3"
[libraries]
linux.debug.x86_64 = "res://addons/gde_gozen/bin/linux_x86_64/libgozen.linux.template_debug.x86_64.so"
linux.release.x86_64 = "res://addons/gde_gozen/bin/linux_x86_64/libgozen.linux.template_release.x86_64.so"
linux.debug.arm64 = "res://addons/gde_gozen/bin/linux_arm64/libgozen.linux.template_debug.arm64.so"
linux.release.arm64 = "res://addons/gde_gozen/bin/linux_arm64/libgozen.linux.template_release.arm64.so"
windows.debug.x86_64 = "res://addons/gde_gozen/bin/windows_x86_64/libgozen.windows.template_debug.x86_64.dll"
windows.release.x86_64 = "res://addons/gde_gozen/bin/windows_x86_64/libgozen.windows.template_release.x86_64.dll"
windows.debug.arm64 = "res://addons/gde_gozen/bin/windows_arm64/libgozen.windows.template_debug.arm64.dll"
windows.release.arm64 = "res://addons/gde_gozen/bin/windows_arm64/libgozen.windows.template_release.arm64.dll"
macos.debug.arm64 = "res://addons/gde_gozen/bin/macos/debug/libgozen.macos.template_debug.arm64.dylib"
macos.release.arm64 = "res://addons/gde_gozen/bin/macos/release/libgozen.macos.template_release.arm64.dylib"
web.debug.wasm32 = "res://addons/gde_gozen/bin/web/libgozen.web.template_debug.wasm32.wasm"
web.release.wasm32 = "res://addons/gde_gozen/bin/web/libgozen.web.template_release.wasm32.wasm"
android.debug.arm64 = "res://addons/gde_gozen/bin/android_arm64/libgozen.android.template_debug.arm64.so"
android.release.arm64 = "res://addons/gde_gozen/bin/android_arm64/libgozen.android.template_release.arm64.so"
android.debug.arm32 = "res://addons/gde_gozen/bin/android_arm32/libgozen.android.template_debug.arm32.so"
android.release.arm32 = "res://addons/gde_gozen/bin/android_arm32/libgozen.android.template_release.arm32.so"
[dependencies]
linux.debug.x86_64 = {
"bin/linux_x86_64/libavcodec.so.60": "",
"bin/linux_x86_64/libavformat.so.60": "",
"bin/linux_x86_64/libavutil.so.58": "",
"bin/linux_x86_64/libswresample.so.4": "",
"bin/linux_x86_64/libswscale.so.7": "",
"bin/linux_x86_64/libaom.so.3": "",
}
linux.release.x86_64 = {
"bin/linux_x86_64/libavcodec.so.60": "",
"bin/linux_x86_64/libavformat.so.60": "",
"bin/linux_x86_64/libavutil.so.58": "",
"bin/linux_x86_64/libswresample.so.4": "",
"bin/linux_x86_64/libswscale.so.7": "",
"bin/linux_x86_64/libaom.so.3": "",
}
linux.debug.arm64 = {
"bin/linux_arm64/libavcodec.so.60": "",
"bin/linux_arm64/libavformat.so.60": "",
"bin/linux_arm64/libavutil.so.58": "",
"bin/linux_arm64/libswresample.so.4": "",
"bin/linux_arm64/libswscale.so.7": "",
"bin/linux_x86_64/libaom.so.3": "",
}
linux.release.arm64 = {
"bin/linux_arm64/libavcodec.so.60": "",
"bin/linux_arm64/libavformat.so.60": "",
"bin/linux_arm64/libavutil.so.58": "",
"bin/linux_arm64/libswresample.so.4": "",
"bin/linux_arm64/libswscale.so.7": "",
"bin/linux_x86_64/libaom.so.3": "",
}
windows.debug.x86_64 = {
"bin/windows_x86_64/avcodec-60.dll": "",
"bin/windows_x86_64/avformat-60.dll": "",
"bin/windows_x86_64/avutil-58.dll": "",
"bin/windows_x86_64/swresample-4.dll": "",
"bin/windows_x86_64/swscale-7.dll": "",
"bin/windows_x86_64/libwinpthread-1.dll": "",
"bin/windows_x86_64/libaom.dll": "",
}
windows.release.x86_64 = {
"bin/windows_x86_64/avcodec-60.dll": "",
"bin/windows_x86_64/avformat-60.dll": "",
"bin/windows_x86_64/avutil-58.dll": "",
"bin/windows_x86_64/swresample-4.dll": "",
"bin/windows_x86_64/swscale-7.dll": "",
"bin/windows_x86_64/libwinpthread-1.dll": "",
"bin/windows_x86_64/libaom.dll": "",
}
windows.debug.arm64 = {
"bin/windows_arm64/avcodec-60.dll": "",
"bin/windows_arm64/avformat-60.dll": "",
"bin/windows_arm64/avutil-58.dll": "",
"bin/windows_arm64/swresample-4.dll": "",
"bin/windows_arm64/swscale-7.dll": "",
"bin/windows_arm64/libwinpthread-1.dll": "",
"bin/windows_arm64/libaom.dll": "",
}
windows.release.arm64 = {
"bin/windows_arm64/avcodec-60.dll": "",
"bin/windows_arm64/avformat-60.dll": "",
"bin/windows_arm64/avutil-58.dll": "",
"bin/windows_arm64/swresample-4.dll": "",
"bin/windows_arm64/swscale-7.dll": "",
"bin/windows_arm64/libwinpthread-1.dll": "",
"bin/windows_arm64/libaom.dll": "",
}
macos.debug.arm64 = {
"bin/macos/debug/libavcodec.dylib": "Contents/Frameworks",
"bin/macos/debug/libavcodec.60.dylib": "Contents/Frameworks",
"bin/macos/debug/libavcodec.60.31.102.dylib": "Contents/Frameworks",
"bin/macos/debug/libavformat.dylib": "Contents/Frameworks",
"bin/macos/debug/libavformat.60.dylib": "Contents/Frameworks",
"bin/macos/debug/libavformat.60.16.100.dylib": "Contents/Frameworks",
"bin/macos/debug/libavutil.dylib": "Contents/Frameworks",
"bin/macos/debug/libavutil.58.dylib": "Contents/Frameworks",
"bin/macos/debug/libavutil.58.29.100.dylib": "Contents/Frameworks",
"bin/macos/debug/libswresample.dylib": "Contents/Frameworks",
"bin/macos/debug/libswresample.4.dylib": "Contents/Frameworks",
"bin/macos/debug/libswresample.4.12.100.dylib": "Contents/Frameworks",
"bin/macos/debug/libswscale.dylib": "Contents/Frameworks",
"bin/macos/debug/libswscale.7.dylib": "Contents/Frameworks",
"bin/macos/debug/libswscale.7.5.100.dylib": "Contents/Frameworks"
}
macos.release.arm64 = {
"bin/macos/release/libavcodec.dylib": "Contents/Frameworks",
"bin/macos/release/libavcodec.60.dylib": "Contents/Frameworks",
"bin/macos/release/libavcodec.60.31.102.dylib": "Contents/Frameworks",
"bin/macos/release/libavformat.dylib": "Contents/Frameworks",
"bin/macos/release/libavformat.60.dylib": "Contents/Frameworks",
"bin/macos/release/libavformat.60.16.100.dylib": "Contents/Frameworks",
"bin/macos/release/libavutil.dylib": "Contents/Frameworks",
"bin/macos/release/libavutil.58.dylib": "Contents/Frameworks",
"bin/macos/release/libavutil.58.29.100.dylib": "Contents/Frameworks",
"bin/macos/release/libswresample.dylib": "Contents/Frameworks",
"bin/macos/release/libswresample.4.dylib": "Contents/Frameworks",
"bin/macos/release/libswresample.4.12.100.dylib": "Contents/Frameworks",
"bin/macos/release/libswscale.dylib": "Contents/Frameworks",
"bin/macos/release/libswscale.7.dylib": "Contents/Frameworks",
"bin/macos/release/libswscale.7.5.100.dylib": "Contents/Frameworks"
}
web.debug.wasm32 = {
}
web.release.wasm32 = {
}
android.debug.arm64 = {
"bin/android_arm64/libavcodec.so": "",
"bin/android_arm64/libavformat.so": "",
"bin/android_arm64/libavutil.so": "",
"bin/android_arm64/libswresample.so": "",
"bin/android_arm64/libswscale.so": "",
}
android.release.arm64 = {
"bin/android_arm64/libavcodec.so": "",
"bin/android_arm64/libavformat.so": "",
"bin/android_arm64/libavutil.so": "",
"bin/android_arm64/libswresample.so": "",
"bin/android_arm64/libswscale.so": "",
}
android.debug.arm32 = {
"bin/android_arm32/libavcodec.so": "",
"bin/android_arm32/libavformat.so": "",
"bin/android_arm32/libavutil.so": "",
"bin/android_arm32/libswresample.so": "",
"bin/android_arm32/libswscale.so": "",
}
android.release.arm32 = {
"bin/android_arm32/libavcodec.so": "",
"bin/android_arm32/libavformat.so": "",
"bin/android_arm32/libavutil.so": "",
"bin/android_arm32/libswresample.so": "",
"bin/android_arm32/libswscale.so": "",
}

View file

@ -0,0 +1 @@
uid://bbi0kdfadrphl

252
addons/gde_gozen/icon.svg Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 94 KiB

View file

@ -0,0 +1,43 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://o0sd31kifqka"
path="res://.godot/imported/icon.svg-ac53c9c419a88eda808214a4d44243c3.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://addons/gde_gozen/icon.svg"
dest_files=["res://.godot/imported/icon.svg-ac53c9c419a88eda808214a4d44243c3.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
svg/scale=1.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false

BIN
addons/gde_gozen/icon.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View file

@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cdgqjpsdllq4f"
path="res://.godot/imported/icon.webp-a5a23a9a73b8ba8140cf260e6bfffac7.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://addons/gde_gozen/icon.webp"
dest_files=["res://.godot/imported/icon.webp-a5a23a9a73b8ba8140cf260e6bfffac7.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View file

@ -0,0 +1,7 @@
[plugin]
name="gde_gozen"
description="Providing performant video playback."
author="Voylin's Gamedev Journey"
version="8.3"
script="plugin.gd"

View file

@ -0,0 +1,17 @@
@tool
class_name GoZenServer
extends EditorPlugin
## GoZenServer is only used for adding the node to the node list.
func _enter_tree() -> void:
add_custom_type(
"VideoPlayback", "Control",
load("res://addons/gde_gozen/video_playback.gd"),
load("res://addons/gde_gozen/icon.webp"))
func _exit_tree() -> void:
remove_custom_type("VideoPlayback")

View file

@ -0,0 +1 @@
uid://1vr5dotnqnh5

View file

@ -0,0 +1,61 @@
shader_type canvas_item;
uniform sampler2D y_data;
uniform sampler2D u_data;
uniform sampler2D v_data;
uniform vec2 resolution;
uniform vec4 color_profile;
uniform float rotation;
uniform float interlaced = 1.0; // 0 = no, 1 = top first, 2 = bottom first
void fragment() {
vec2 uv = UV;
vec2 centered_uv = uv - vec2(0.5);
float cos_angle = cos(rotation);
float sin_angle = sin(rotation);
vec2 rotated_uv = vec2(
centered_uv.x * cos_angle - centered_uv.y * sin_angle,
centered_uv.x * sin_angle + centered_uv.y * cos_angle
);
uv = rotated_uv + vec2(0.5);
vec2 y_uv = uv * resolution / vec2(textureSize(y_data, 0));
y_uv = clamp(y_uv, vec2(0.0), vec2(1.0));
vec2 u_uv = uv * ((resolution / 2.0) / vec2(textureSize(u_data, 0)));
vec2 v_uv = uv * ((resolution / 2.0) / vec2(textureSize(v_data, 0)));
u_uv = clamp(u_uv, vec2(0.0), vec2(1.0));
v_uv = clamp(v_uv, vec2(0.0), vec2(1.0));
// Line blending deinterlacing.
float Y;
vec2 offset = vec2(0.0, 1.0 / resolution.y);
vec2 y_uv_top = clamp(y_uv - offset, vec2(0.0), vec2(1.0));
vec2 y_uv_bottom = clamp(y_uv + offset, vec2(0.0), vec2(1.0));
float Y_center = texture(y_data, y_uv).r;
float Y_top = texture(y_data, y_uv_top).r;
float Y_bottom = texture(y_data, y_uv_bottom).r;
if (interlaced == 1.0)
Y = mix(Y_top, Y_center, 0.5);
else
Y = mix(Y_center, Y_bottom, 0.5);
float U = float(texture(u_data, u_uv).r - 0.5);
float V = float(texture(v_data, v_uv).r - 0.5);
float R = Y + color_profile.x * V;
float G = Y - color_profile.y * U - color_profile.z * V;
float B = Y + color_profile.w * U;
COLOR = vec4(R, G, B, 1.0);
}

View file

@ -0,0 +1 @@
uid://unmynfq8obqk

View file

@ -0,0 +1,65 @@
shader_type canvas_item;
uniform sampler2D y_data;
uniform sampler2D u_data;
uniform sampler2D v_data;
uniform vec2 resolution;
uniform vec4 color_profile;
uniform float rotation;
uniform float interlaced = 1.0; // 0 = no, 1 = top first, 2 = bottom first
void fragment() {
vec2 uv = UV;
vec2 centered_uv = uv - vec2(0.5);
float cos_angle = cos(rotation);
float sin_angle = sin(rotation);
vec2 rotated_uv = vec2(
centered_uv.x * cos_angle - centered_uv.y * sin_angle,
centered_uv.x * sin_angle + centered_uv.y * cos_angle
);
uv = rotated_uv + vec2(0.5);
vec2 y_uv = uv * resolution / vec2(textureSize(y_data, 0));
y_uv = clamp(y_uv, vec2(0.0), vec2(1.0));
vec2 u_uv = uv * ((resolution / 2.0) / vec2(textureSize(u_data, 0)));
vec2 v_uv = uv * ((resolution / 2.0) / vec2(textureSize(v_data, 0)));
u_uv = clamp(u_uv, vec2(0.0), vec2(1.0));
v_uv = clamp(v_uv, vec2(0.0), vec2(1.0));
// Line blending deinterlacing.
float Y;
vec2 offset = vec2(0.0, 1.0 / resolution.y);
vec2 y_uv_top = clamp(y_uv - offset, vec2(0.0), vec2(1.0));
vec2 y_uv_bottom = clamp(y_uv + offset, vec2(0.0), vec2(1.0));
float Y_center = texture(y_data, y_uv).r;
float Y_top = texture(y_data, y_uv_top).r;
float Y_bottom = texture(y_data, y_uv_bottom).r;
if (interlaced == 1.0)
Y = mix(Y_top, Y_center, 0.5);
else
Y = mix(Y_center, Y_bottom, 0.5);
float U = float(texture(u_data, u_uv).r);
float V = float(texture(v_data, v_uv).r);
Y = (Y * 255. - 16.) / 219.;
U = (U * 255. - 128.) / 224.;
V = (V * 255. - 128.) / 224.;
float R = Y + color_profile.x * V;
float G = Y - color_profile.y * U - color_profile.z * V;
float B = Y + color_profile.w * U;
COLOR = vec4(R, G, B, 1.0);
}

View file

@ -0,0 +1 @@
uid://dbl52cuidqjnk

View file

@ -0,0 +1,45 @@
shader_type canvas_item;
uniform sampler2D y_data;
uniform sampler2D u_data;
uniform sampler2D v_data;
uniform vec2 resolution;
uniform vec4 color_profile;
uniform float rotation;
void fragment() {
vec2 uv = UV;
vec2 centered_uv = uv - vec2(0.5);
float cos_angle = cos(rotation);
float sin_angle = sin(rotation);
vec2 rotated_uv = vec2(
centered_uv.x * cos_angle - centered_uv.y * sin_angle,
centered_uv.x * sin_angle + centered_uv.y * cos_angle
);
uv = rotated_uv + vec2(0.5);
vec2 y_uv = uv * resolution / vec2(textureSize(y_data, 0));
y_uv = clamp(y_uv, vec2(0.0), vec2(1.0));
vec2 u_uv = uv * ((resolution / 2.0) / vec2(textureSize(u_data, 0)));
vec2 v_uv = uv * ((resolution / 2.0) / vec2(textureSize(v_data, 0)));
u_uv = clamp(u_uv, vec2(0.0), vec2(1.0));
v_uv = clamp(v_uv, vec2(0.0), vec2(1.0));
float Y = float(texture(y_data, y_uv).r);
float U = float(texture(u_data, u_uv).r - 0.5);
float V = float(texture(v_data, v_uv).r - 0.5);
float R = Y + color_profile.x * V;
float G = Y - color_profile.y * U - color_profile.z * V;
float B = Y + color_profile.w * U;
COLOR = vec4(R, G, B, 1.0);
}

View file

@ -0,0 +1 @@
uid://cgtyfukivit7e

View file

@ -0,0 +1,49 @@
shader_type canvas_item;
uniform sampler2D y_data;
uniform sampler2D u_data;
uniform sampler2D v_data;
uniform vec2 resolution;
uniform vec4 color_profile;
uniform float rotation;
void fragment() {
vec2 uv = UV;
vec2 centered_uv = uv - vec2(0.5);
float cos_angle = cos(rotation);
float sin_angle = sin(rotation);
vec2 rotated_uv = vec2(
centered_uv.x * cos_angle - centered_uv.y * sin_angle,
centered_uv.x * sin_angle + centered_uv.y * cos_angle
);
uv = rotated_uv + vec2(0.5);
vec2 y_uv = uv * resolution / vec2(textureSize(y_data, 0));
y_uv = clamp(y_uv, vec2(0.0), vec2(1.0));
vec2 u_uv = uv * ((resolution / 2.0) / vec2(textureSize(u_data, 0)));
vec2 v_uv = uv * ((resolution / 2.0) / vec2(textureSize(v_data, 0)));
u_uv = clamp(u_uv, vec2(0.0), vec2(1.0));
v_uv = clamp(v_uv, vec2(0.0), vec2(1.0));
float Y = float(texture(y_data, y_uv).r);
float U = float(texture(u_data, u_uv).r);
float V = float(texture(v_data, v_uv).r);
Y = (Y * 255. - 16.) / 219.;
U = (U * 255. - 128.) / 224.;
V = (V * 255. - 128.) / 224.;
float R = Y + color_profile.x * V;
float G = Y - color_profile.y * U - color_profile.z * V;
float B = Y + color_profile.w * U;
COLOR = vec4(R, G, B, 1.0);
}

View file

@ -0,0 +1 @@
uid://cy1uf7t5enh52

View file

@ -0,0 +1,702 @@
[gd_resource type="VisualShader" load_steps=68 format=3 uid="uid://bbm1mcx0yed5n"]
[sub_resource type="VisualShaderNodeFloatOp" id="VisualShaderNodeFloatOp_gjxn1"]
default_input_values = [0, 0.0, 1, 255.0]
linked_parent_graph_frame = 13
operator = 2
[sub_resource type="VisualShaderNodeFrame" id="VisualShaderNodeFrame_klf5v"]
size = Vector2(1904, 482)
title = "Y"
attached_nodes = PackedInt32Array(12, 14, 15, 54)
[sub_resource type="VisualShaderNodeFloatOp" id="VisualShaderNodeFloatOp_dynwm"]
default_input_values = [0, 0.0, 1, 16.0]
linked_parent_graph_frame = 13
operator = 1
[sub_resource type="VisualShaderNodeFloatOp" id="VisualShaderNodeFloatOp_e18cs"]
default_input_values = [0, 0.0, 1, 219.0]
linked_parent_graph_frame = 13
operator = 3
[sub_resource type="VisualShaderNodeFrame" id="VisualShaderNodeFrame_xwkgv"]
size = Vector2(1904, 482)
title = "U"
attached_nodes = PackedInt32Array(19, 18, 17, 55)
[sub_resource type="VisualShaderNodeFloatOp" id="VisualShaderNodeFloatOp_xi8bo"]
default_input_values = [0, 0.0, 1, 255.0]
linked_parent_graph_frame = 16
operator = 2
[sub_resource type="VisualShaderNodeFloatOp" id="VisualShaderNodeFloatOp_m4cy3"]
default_input_values = [0, 0.0, 1, 128.0]
linked_parent_graph_frame = 16
operator = 1
[sub_resource type="VisualShaderNodeFloatOp" id="VisualShaderNodeFloatOp_c88af"]
default_input_values = [0, 0.0, 1, 224.0]
linked_parent_graph_frame = 16
operator = 3
[sub_resource type="VisualShaderNodeFloatOp" id="VisualShaderNodeFloatOp_irm8c"]
default_input_values = [0, 0.0, 1, 224.0]
linked_parent_graph_frame = 23
operator = 3
[sub_resource type="VisualShaderNodeFloatOp" id="VisualShaderNodeFloatOp_3yd7p"]
default_input_values = [0, 0.0, 1, 128.0]
linked_parent_graph_frame = 23
operator = 1
[sub_resource type="VisualShaderNodeFloatOp" id="VisualShaderNodeFloatOp_2f3o8"]
default_input_values = [0, 0.0, 1, 255.0]
linked_parent_graph_frame = 23
operator = 2
[sub_resource type="VisualShaderNodeFrame" id="VisualShaderNodeFrame_4mxkt"]
size = Vector2(1884, 482)
title = "V"
attached_nodes = PackedInt32Array(21, 22, 20, 53)
[sub_resource type="VisualShaderNodeFloatOp" id="VisualShaderNodeFloatOp_i83mv"]
linked_parent_graph_frame = 26
operator = 2
[sub_resource type="VisualShaderNodeFloatOp" id="VisualShaderNodeFloatOp_3704p"]
linked_parent_graph_frame = 26
[sub_resource type="VisualShaderNodeFrame" id="VisualShaderNodeFrame_78tac"]
size = Vector2(444, 473)
title = "R"
attached_nodes = PackedInt32Array(24, 25, 79)
[sub_resource type="VisualShaderNodeFloatOp" id="VisualShaderNodeFloatOp_eb1ae"]
linked_parent_graph_frame = 32
operator = 2
[sub_resource type="VisualShaderNodeFloatOp" id="VisualShaderNodeFloatOp_q3gtp"]
linked_parent_graph_frame = 32
operator = 2
[sub_resource type="VisualShaderNodeInput" id="VisualShaderNodeInput_gjxn1"]
linked_parent_graph_frame = 39
input_name = "uv"
[sub_resource type="VisualShaderNodeFloatOp" id="VisualShaderNodeFloatOp_i0sxv"]
linked_parent_graph_frame = 32
operator = 1
[sub_resource type="VisualShaderNodeFloatOp" id="VisualShaderNodeFloatOp_2cmh5"]
linked_parent_graph_frame = 32
operator = 1
[sub_resource type="VisualShaderNodeFrame" id="VisualShaderNodeFrame_2qxuc"]
size = Vector2(684, 305)
title = "G"
attached_nodes = PackedInt32Array(29, 31, 30, 28)
[sub_resource type="VisualShaderNodeFrame" id="VisualShaderNodeFrame_x7ioe"]
size = Vector2(464, 285)
title = "B"
attached_nodes = PackedInt32Array(34, 35)
[sub_resource type="VisualShaderNodeFloatOp" id="VisualShaderNodeFloatOp_es6lc"]
linked_parent_graph_frame = 33
operator = 2
[sub_resource type="VisualShaderNodeFloatOp" id="VisualShaderNodeFloatOp_wiep3"]
linked_parent_graph_frame = 33
[sub_resource type="VisualShaderNodeVectorCompose" id="VisualShaderNodeVectorCompose_3ejn6"]
[sub_resource type="VisualShaderNodeFrame" id="VisualShaderNodeFrame_gjxn1"]
size = Vector2(1604, 665)
title = "uv"
attached_nodes = PackedInt32Array(40, 52, 3, 9, 42, 43, 44, 45, 46, 47, 48, 51, 50)
[sub_resource type="VisualShaderNodeTexture2DParameter" id="VisualShaderNodeTexture2DParameter_gjxn1"]
parameter_name = "y_data"
[sub_resource type="VisualShaderNodeVectorOp" id="VisualShaderNodeVectorOp_klf5v"]
default_input_values = [0, Vector2(0, 0), 1, Vector2(0.5, 0.5)]
expanded_output_ports = [0]
linked_parent_graph_frame = 39
op_type = 0
operator = 1
[sub_resource type="VisualShaderNodeFloatFunc" id="VisualShaderNodeFloatFunc_e18cs"]
linked_parent_graph_frame = 39
function = 1
[sub_resource type="VisualShaderNodeFloatFunc" id="VisualShaderNodeFloatFunc_xwkgv"]
linked_parent_graph_frame = 39
function = 0
[sub_resource type="VisualShaderNodeVectorCompose" id="VisualShaderNodeVectorCompose_xi8bo"]
linked_parent_graph_frame = 39
op_type = 0
[sub_resource type="VisualShaderNodeFloatOp" id="VisualShaderNodeFloatOp_4mxkt"]
linked_parent_graph_frame = 39
operator = 2
[sub_resource type="VisualShaderNodeFloatOp" id="VisualShaderNodeFloatOp_78tac"]
linked_parent_graph_frame = 39
operator = 2
[sub_resource type="VisualShaderNodeFloatOp" id="VisualShaderNodeFloatOp_uw8gt"]
linked_parent_graph_frame = 39
operator = 2
[sub_resource type="VisualShaderNodeFloatOp" id="VisualShaderNodeFloatOp_2qxuc"]
linked_parent_graph_frame = 39
operator = 2
[sub_resource type="VisualShaderNodeTexture2DParameter" id="VisualShaderNodeTexture2DParameter_klf5v"]
parameter_name = "u_data"
[sub_resource type="VisualShaderNodeFloatOp" id="VisualShaderNodeFloatOp_3ejn6"]
linked_parent_graph_frame = 39
operator = 1
[sub_resource type="VisualShaderNodeFloatOp" id="VisualShaderNodeFloatOp_hb5b7"]
linked_parent_graph_frame = 39
[sub_resource type="VisualShaderNodeVectorOp" id="VisualShaderNodeVectorOp_gjxn1"]
default_input_values = [0, Vector2(0, 0), 1, Vector2(0.5, 0.5)]
linked_parent_graph_frame = 39
op_type = 0
[sub_resource type="VisualShaderNodeFrame" id="VisualShaderNodeFrame_dynwm"]
linked_parent_graph_frame = 23
size = Vector2(1204, 401)
title = "v_uv"
attached_nodes = PackedInt32Array(61, 68, 64, 85, 73, 86)
[sub_resource type="VisualShaderNodeFrame" id="VisualShaderNodeFrame_e18cs"]
linked_parent_graph_frame = 13
size = Vector2(1224, 401)
title = "y_uv"
attached_nodes = PackedInt32Array(56, 57, 58, 81, 71, 82)
[sub_resource type="VisualShaderNodeFrame" id="VisualShaderNodeFrame_xi8bo"]
linked_parent_graph_frame = 16
size = Vector2(1224, 401)
title = "u_uv"
attached_nodes = PackedInt32Array(60, 69, 65, 83, 72, 84)
[sub_resource type="VisualShaderNodeVectorOp" id="VisualShaderNodeVectorOp_dynwm"]
default_input_values = [0, Vector2(0, 0), 1, Vector2(0, 0)]
linked_parent_graph_frame = 54
op_type = 0
operator = 2
[sub_resource type="VisualShaderNodeExpression" id="VisualShaderNodeExpression_e18cs"]
linked_parent_graph_frame = 54
size = Vector2(496, 160)
expression = "y_uv = vec2(textureSize(y_data, 0));"
[sub_resource type="VisualShaderNodeVectorOp" id="VisualShaderNodeVectorOp_xwkgv"]
default_input_values = [0, Vector2(0, 0), 1, Vector2(0, 0)]
linked_parent_graph_frame = 54
op_type = 0
operator = 3
[sub_resource type="VisualShaderNodeTexture2DParameter" id="VisualShaderNodeTexture2DParameter_dynwm"]
parameter_name = "v_data"
[sub_resource type="VisualShaderNodeExpression" id="VisualShaderNodeExpression_klf5v"]
linked_parent_graph_frame = 55
size = Vector2(496, 160)
expression = "u_uv = vec2(textureSize(u_data, 0));"
[sub_resource type="VisualShaderNodeExpression" id="VisualShaderNodeExpression_dynwm"]
linked_parent_graph_frame = 53
size = Vector2(496, 160)
expression = "v_uv = vec2(textureSize(v_data, 0));"
[sub_resource type="VisualShaderNodeVectorOp" id="VisualShaderNodeVectorOp_xi8bo"]
operator = 3
[sub_resource type="VisualShaderNodeVectorOp" id="VisualShaderNodeVectorOp_m4cy3"]
default_input_values = [0, Vector2(0, 0), 1, Vector2(0, 0)]
linked_parent_graph_frame = 53
op_type = 0
operator = 3
[sub_resource type="VisualShaderNodeVectorOp" id="VisualShaderNodeVectorOp_c88af"]
default_input_values = [0, Vector2(0, 0), 1, Vector2(0, 0)]
linked_parent_graph_frame = 55
op_type = 0
operator = 3
[sub_resource type="VisualShaderNodeVectorOp" id="VisualShaderNodeVectorOp_irm8c"]
linked_parent_graph_frame = 53
operator = 2
[sub_resource type="VisualShaderNodeVectorOp" id="VisualShaderNodeVectorOp_3yd7p"]
linked_parent_graph_frame = 55
operator = 2
[sub_resource type="VisualShaderNodeVec2Parameter" id="VisualShaderNodeVec2Parameter_e18cs"]
parameter_name = "resolution"
[sub_resource type="VisualShaderNodeFloatConstant" id="VisualShaderNodeFloatConstant_2f3o8"]
constant = 2.0
[sub_resource type="VisualShaderNodeTexture" id="VisualShaderNodeTexture_4mxkt"]
expanded_output_ports = [0]
linked_parent_graph_frame = 54
source = 5
[sub_resource type="VisualShaderNodeTexture" id="VisualShaderNodeTexture_i83mv"]
expanded_output_ports = [0]
linked_parent_graph_frame = 55
source = 5
[sub_resource type="VisualShaderNodeTexture" id="VisualShaderNodeTexture_3704p"]
expanded_output_ports = [0]
linked_parent_graph_frame = 53
source = 5
[sub_resource type="VisualShaderNodeReroute" id="VisualShaderNodeReroute_gjxn1"]
linked_parent_graph_frame = 26
[sub_resource type="VisualShaderNodeVec4Parameter" id="VisualShaderNodeVec4Parameter_xwkgv"]
expanded_output_ports = [0]
parameter_name = "color_profile"
[sub_resource type="VisualShaderNodeParameterRef" id="VisualShaderNodeParameterRef_klf5v"]
linked_parent_graph_frame = 54
parameter_name = "y_data"
param_type = 9
[sub_resource type="VisualShaderNodeParameterRef" id="VisualShaderNodeParameterRef_dynwm"]
linked_parent_graph_frame = 54
parameter_name = "y_data"
param_type = 9
[sub_resource type="VisualShaderNodeParameterRef" id="VisualShaderNodeParameterRef_e18cs"]
linked_parent_graph_frame = 55
parameter_name = "u_data"
param_type = 9
[sub_resource type="VisualShaderNodeParameterRef" id="VisualShaderNodeParameterRef_xwkgv"]
linked_parent_graph_frame = 55
parameter_name = "u_data"
param_type = 9
[sub_resource type="VisualShaderNodeParameterRef" id="VisualShaderNodeParameterRef_xi8bo"]
linked_parent_graph_frame = 53
parameter_name = "v_data"
param_type = 9
[sub_resource type="VisualShaderNodeParameterRef" id="VisualShaderNodeParameterRef_m4cy3"]
linked_parent_graph_frame = 53
parameter_name = "v_data"
param_type = 9
[sub_resource type="VisualShaderNodeFloatParameter" id="VisualShaderNodeFloatParameter_xi8bo"]
linked_parent_graph_frame = 39
parameter_name = "rotation"
[resource]
code = "shader_type canvas_item;
render_mode blend_disabled;
uniform sampler2D y_data;
uniform sampler2D u_data;
uniform sampler2D v_data;
uniform vec4 color_profile;
uniform vec2 resolution;
uniform float rotation;
void fragment() {
// Vector4Parameter:8
vec4 n_out8p0 = color_profile;
float n_out8p1 = n_out8p0.r;
float n_out8p2 = n_out8p0.g;
float n_out8p3 = n_out8p0.b;
float n_out8p4 = n_out8p0.a;
// Vector2Parameter:7
vec2 n_out7p0 = resolution;
// FloatConstant:70
float n_out70p0 = 2.000000;
// VectorOp:63
vec3 n_out63p0 = vec3(n_out7p0, 0.0) / vec3(n_out70p0);
// Input:3
vec2 n_out3p0 = UV;
// VectorOp:40
vec2 n_in40p1 = vec2(0.50000, 0.50000);
vec2 n_out40p0 = n_out3p0 - n_in40p1;
float n_out40p1 = n_out40p0.r;
float n_out40p2 = n_out40p0.g;
// FloatParameter:9
float n_out9p0 = rotation;
// FloatFunc:42
float n_out42p0 = cos(n_out9p0);
// FloatOp:45
float n_out45p0 = n_out40p1 * n_out42p0;
// FloatFunc:43
float n_out43p0 = sin(n_out9p0);
// FloatOp:48
float n_out48p0 = n_out40p2 * n_out43p0;
// FloatOp:50
float n_out50p0 = n_out45p0 - n_out48p0;
// FloatOp:46
float n_out46p0 = n_out40p1 * n_out43p0;
// FloatOp:47
float n_out47p0 = n_out40p2 * n_out42p0;
// FloatOp:51
float n_out51p0 = n_out46p0 + n_out47p0;
// VectorCompose:44
vec2 n_out44p0 = vec2(n_out50p0, n_out51p0);
// VectorOp:52
vec2 n_in52p1 = vec2(0.50000, 0.50000);
vec2 n_out52p0 = n_out44p0 + n_in52p1;
// VectorOp:68
vec3 n_out68p0 = n_out63p0 * vec3(n_out52p0, 0.0);
vec2 n_out61p0;
// Expression:61
n_out61p0 = vec2(0.0, 0.0);
{
n_out61p0 = vec2(textureSize(v_data, 0));
}
// VectorOp:64
vec2 n_out64p0 = vec2(n_out68p0.xy) / n_out61p0;
vec4 n_out73p0;
// Texture2D:73
n_out73p0 = texture(v_data, n_out64p0);
float n_out73p1 = n_out73p0.r;
// FloatOp:22
float n_in22p1 = 255.00000;
float n_out22p0 = n_out73p1 * n_in22p1;
// FloatOp:21
float n_in21p1 = 128.00000;
float n_out21p0 = n_out22p0 - n_in21p1;
// FloatOp:20
float n_in20p1 = 224.00000;
float n_out20p0 = n_out21p0 / n_in20p1;
// FloatOp:24
float n_out24p0 = n_out8p1 * n_out20p0;
// VectorOp:56
vec2 n_out56p0 = n_out7p0 * n_out52p0;
vec2 n_out57p0;
// Expression:57
n_out57p0 = vec2(0.0, 0.0);
{
n_out57p0 = vec2(textureSize(y_data, 0));
}
// VectorOp:58
vec2 n_out58p0 = n_out56p0 / n_out57p0;
vec4 n_out71p0;
// Texture2D:71
n_out71p0 = texture(y_data, n_out58p0);
float n_out71p1 = n_out71p0.r;
// FloatOp:12
float n_in12p1 = 255.00000;
float n_out12p0 = n_out71p1 * n_in12p1;
// FloatOp:14
float n_in14p1 = 16.00000;
float n_out14p0 = n_out12p0 - n_in14p1;
// FloatOp:15
float n_in15p1 = 219.00000;
float n_out15p0 = n_out14p0 / n_in15p1;
// FloatOp:25
float n_out25p0 = n_out24p0 + n_out15p0;
// Reroute:79
float n_out79p0 = n_out15p0;
// VectorOp:69
vec3 n_out69p0 = n_out63p0 * vec3(n_out52p0, 0.0);
vec2 n_out60p0;
// Expression:60
n_out60p0 = vec2(0.0, 0.0);
{
n_out60p0 = vec2(textureSize(u_data, 0));
}
// VectorOp:65
vec2 n_out65p0 = vec2(n_out69p0.xy) / n_out60p0;
vec4 n_out72p0;
// Texture2D:72
n_out72p0 = texture(u_data, n_out65p0);
float n_out72p1 = n_out72p0.r;
// FloatOp:17
float n_in17p1 = 255.00000;
float n_out17p0 = n_out72p1 * n_in17p1;
// FloatOp:18
float n_in18p1 = 128.00000;
float n_out18p0 = n_out17p0 - n_in18p1;
// FloatOp:19
float n_in19p1 = 224.00000;
float n_out19p0 = n_out18p0 / n_in19p1;
// FloatOp:29
float n_out29p0 = n_out8p2 * n_out19p0;
// FloatOp:30
float n_out30p0 = n_out79p0 - n_out29p0;
// FloatOp:28
float n_out28p0 = n_out20p0 * n_out8p3;
// FloatOp:31
float n_out31p0 = n_out30p0 - n_out28p0;
// FloatOp:34
float n_out34p0 = n_out8p4 * n_out19p0;
// FloatOp:35
float n_out35p0 = n_out15p0 + n_out34p0;
// VectorCompose:36
vec3 n_out36p0 = vec3(n_out25p0, n_out31p0, n_out35p0);
// Output:0
COLOR.rgb = n_out36p0;
}
"
mode = 1
modes/blend = 5
flags/light_only = false
nodes/fragment/0/position = Vector2(2840, -1540)
nodes/fragment/3/node = SubResource("VisualShaderNodeInput_gjxn1")
nodes/fragment/3/position = Vector2(-1860, -1240)
nodes/fragment/4/node = SubResource("VisualShaderNodeTexture2DParameter_gjxn1")
nodes/fragment/4/position = Vector2(-200, -2340)
nodes/fragment/5/node = SubResource("VisualShaderNodeTexture2DParameter_klf5v")
nodes/fragment/5/position = Vector2(140, -2340)
nodes/fragment/6/node = SubResource("VisualShaderNodeTexture2DParameter_dynwm")
nodes/fragment/6/position = Vector2(480, -2340)
nodes/fragment/7/node = SubResource("VisualShaderNodeVec2Parameter_e18cs")
nodes/fragment/7/position = Vector2(-760, -1900)
nodes/fragment/8/node = SubResource("VisualShaderNodeVec4Parameter_xwkgv")
nodes/fragment/8/position = Vector2(1440, -2340)
nodes/fragment/9/node = SubResource("VisualShaderNodeFloatParameter_xi8bo")
nodes/fragment/9/position = Vector2(-1820, -1020)
nodes/fragment/12/node = SubResource("VisualShaderNodeFloatOp_gjxn1")
nodes/fragment/12/position = Vector2(1140, -1800)
nodes/fragment/13/node = SubResource("VisualShaderNodeFrame_klf5v")
nodes/fragment/13/position = Vector2(-200, -1960)
nodes/fragment/14/node = SubResource("VisualShaderNodeFloatOp_dynwm")
nodes/fragment/14/position = Vector2(1320, -1800)
nodes/fragment/15/node = SubResource("VisualShaderNodeFloatOp_e18cs")
nodes/fragment/15/position = Vector2(1500, -1800)
nodes/fragment/16/node = SubResource("VisualShaderNodeFrame_xwkgv")
nodes/fragment/16/position = Vector2(-200, -1462)
nodes/fragment/17/node = SubResource("VisualShaderNodeFloatOp_xi8bo")
nodes/fragment/17/position = Vector2(1140, -1300)
nodes/fragment/18/node = SubResource("VisualShaderNodeFloatOp_m4cy3")
nodes/fragment/18/position = Vector2(1320, -1300)
nodes/fragment/19/node = SubResource("VisualShaderNodeFloatOp_c88af")
nodes/fragment/19/position = Vector2(1500, -1300)
nodes/fragment/20/node = SubResource("VisualShaderNodeFloatOp_irm8c")
nodes/fragment/20/position = Vector2(1480, -800)
nodes/fragment/21/node = SubResource("VisualShaderNodeFloatOp_3yd7p")
nodes/fragment/21/position = Vector2(1300, -800)
nodes/fragment/22/node = SubResource("VisualShaderNodeFloatOp_2f3o8")
nodes/fragment/22/position = Vector2(1120, -800)
nodes/fragment/23/node = SubResource("VisualShaderNodeFrame_4mxkt")
nodes/fragment/23/position = Vector2(-200, -980)
nodes/fragment/24/node = SubResource("VisualShaderNodeFloatOp_i83mv")
nodes/fragment/24/position = Vector2(1940, -2160)
nodes/fragment/25/node = SubResource("VisualShaderNodeFloatOp_3704p")
nodes/fragment/25/position = Vector2(2140, -1980)
nodes/fragment/26/node = SubResource("VisualShaderNodeFrame_78tac")
nodes/fragment/26/position = Vector2(1900, -2200)
nodes/fragment/28/node = SubResource("VisualShaderNodeFloatOp_eb1ae")
nodes/fragment/28/position = Vector2(1940, -1460)
nodes/fragment/29/node = SubResource("VisualShaderNodeFloatOp_q3gtp")
nodes/fragment/29/position = Vector2(1940, -1640)
nodes/fragment/30/node = SubResource("VisualShaderNodeFloatOp_i0sxv")
nodes/fragment/30/position = Vector2(2160, -1640)
nodes/fragment/31/node = SubResource("VisualShaderNodeFloatOp_2cmh5")
nodes/fragment/31/position = Vector2(2380, -1500)
nodes/fragment/32/node = SubResource("VisualShaderNodeFrame_2qxuc")
nodes/fragment/32/position = Vector2(1900, -1680)
nodes/fragment/33/node = SubResource("VisualShaderNodeFrame_x7ioe")
nodes/fragment/33/position = Vector2(1900, -1240)
nodes/fragment/34/node = SubResource("VisualShaderNodeFloatOp_es6lc")
nodes/fragment/34/position = Vector2(1940, -1040)
nodes/fragment/35/node = SubResource("VisualShaderNodeFloatOp_wiep3")
nodes/fragment/35/position = Vector2(2160, -1200)
nodes/fragment/36/node = SubResource("VisualShaderNodeVectorCompose_3ejn6")
nodes/fragment/36/position = Vector2(2640, -1540)
nodes/fragment/39/node = SubResource("VisualShaderNodeFrame_gjxn1")
nodes/fragment/39/position = Vector2(-1900, -1440)
nodes/fragment/40/node = SubResource("VisualShaderNodeVectorOp_klf5v")
nodes/fragment/40/position = Vector2(-1500, -1300)
nodes/fragment/42/node = SubResource("VisualShaderNodeFloatFunc_e18cs")
nodes/fragment/42/position = Vector2(-1480, -1020)
nodes/fragment/43/node = SubResource("VisualShaderNodeFloatFunc_xwkgv")
nodes/fragment/43/position = Vector2(-1480, -920)
nodes/fragment/44/node = SubResource("VisualShaderNodeVectorCompose_xi8bo")
nodes/fragment/44/position = Vector2(-720, -1180)
nodes/fragment/45/node = SubResource("VisualShaderNodeFloatOp_4mxkt")
nodes/fragment/45/position = Vector2(-1160, -1400)
nodes/fragment/46/node = SubResource("VisualShaderNodeFloatOp_78tac")
nodes/fragment/46/position = Vector2(-1160, -1040)
nodes/fragment/47/node = SubResource("VisualShaderNodeFloatOp_uw8gt")
nodes/fragment/47/position = Vector2(-1160, -860)
nodes/fragment/48/node = SubResource("VisualShaderNodeFloatOp_2qxuc")
nodes/fragment/48/position = Vector2(-1160, -1220)
nodes/fragment/50/node = SubResource("VisualShaderNodeFloatOp_3ejn6")
nodes/fragment/50/position = Vector2(-940, -1340)
nodes/fragment/51/node = SubResource("VisualShaderNodeFloatOp_hb5b7")
nodes/fragment/51/position = Vector2(-940, -980)
nodes/fragment/52/node = SubResource("VisualShaderNodeVectorOp_gjxn1")
nodes/fragment/52/position = Vector2(-500, -1180)
nodes/fragment/53/node = SubResource("VisualShaderNodeFrame_dynwm")
nodes/fragment/53/position = Vector2(-160, -920)
nodes/fragment/54/node = SubResource("VisualShaderNodeFrame_e18cs")
nodes/fragment/54/position = Vector2(-160, -1920)
nodes/fragment/55/node = SubResource("VisualShaderNodeFrame_xi8bo")
nodes/fragment/55/position = Vector2(-160, -1421)
nodes/fragment/56/node = SubResource("VisualShaderNodeVectorOp_dynwm")
nodes/fragment/56/position = Vector2(-120, -1880)
nodes/fragment/57/node = SubResource("VisualShaderNodeExpression_e18cs")
nodes/fragment/57/position = Vector2(80, -1720)
nodes/fragment/57/size = Vector2(496, 160)
nodes/fragment/57/input_ports = "0,8,y_data;"
nodes/fragment/57/output_ports = "0,3,y_uv;"
nodes/fragment/57/expression = "y_uv = vec2(textureSize(y_data, 0));"
nodes/fragment/58/node = SubResource("VisualShaderNodeVectorOp_xwkgv")
nodes/fragment/58/position = Vector2(640, -1880)
nodes/fragment/60/node = SubResource("VisualShaderNodeExpression_klf5v")
nodes/fragment/60/position = Vector2(80, -1220)
nodes/fragment/60/size = Vector2(496, 160)
nodes/fragment/60/input_ports = "0,8,u_data;"
nodes/fragment/60/output_ports = "0,3,u_uv;"
nodes/fragment/60/expression = "u_uv = vec2(textureSize(u_data, 0));"
nodes/fragment/61/node = SubResource("VisualShaderNodeExpression_dynwm")
nodes/fragment/61/position = Vector2(80, -720)
nodes/fragment/61/size = Vector2(496, 160)
nodes/fragment/61/input_ports = "0,8,v_data;"
nodes/fragment/61/output_ports = "0,3,v_uv;"
nodes/fragment/61/expression = "v_uv = vec2(textureSize(v_data, 0));"
nodes/fragment/63/node = SubResource("VisualShaderNodeVectorOp_xi8bo")
nodes/fragment/63/position = Vector2(-460, -1700)
nodes/fragment/64/node = SubResource("VisualShaderNodeVectorOp_m4cy3")
nodes/fragment/64/position = Vector2(620, -880)
nodes/fragment/65/node = SubResource("VisualShaderNodeVectorOp_c88af")
nodes/fragment/65/position = Vector2(640, -1380)
nodes/fragment/68/node = SubResource("VisualShaderNodeVectorOp_irm8c")
nodes/fragment/68/position = Vector2(-120, -880)
nodes/fragment/69/node = SubResource("VisualShaderNodeVectorOp_3yd7p")
nodes/fragment/69/position = Vector2(-120, -1380)
nodes/fragment/70/node = SubResource("VisualShaderNodeFloatConstant_2f3o8")
nodes/fragment/70/position = Vector2(-660, -1660)
nodes/fragment/71/node = SubResource("VisualShaderNodeTexture_4mxkt")
nodes/fragment/71/position = Vector2(860, -1840)
nodes/fragment/72/node = SubResource("VisualShaderNodeTexture_i83mv")
nodes/fragment/72/position = Vector2(860, -1340)
nodes/fragment/73/node = SubResource("VisualShaderNodeTexture_3704p")
nodes/fragment/73/position = Vector2(840, -840)
nodes/fragment/79/node = SubResource("VisualShaderNodeReroute_gjxn1")
nodes/fragment/79/position = Vector2(1960, -1800)
nodes/fragment/81/node = SubResource("VisualShaderNodeParameterRef_klf5v")
nodes/fragment/81/position = Vector2(-120, -1660)
nodes/fragment/82/node = SubResource("VisualShaderNodeParameterRef_dynwm")
nodes/fragment/82/position = Vector2(640, -1660)
nodes/fragment/83/node = SubResource("VisualShaderNodeParameterRef_e18cs")
nodes/fragment/83/position = Vector2(-120, -1160)
nodes/fragment/84/node = SubResource("VisualShaderNodeParameterRef_xwkgv")
nodes/fragment/84/position = Vector2(640, -1160)
nodes/fragment/85/node = SubResource("VisualShaderNodeParameterRef_xi8bo")
nodes/fragment/85/position = Vector2(-120, -660)
nodes/fragment/86/node = SubResource("VisualShaderNodeParameterRef_m4cy3")
nodes/fragment/86/position = Vector2(620, -660)
nodes/fragment/connections = PackedInt32Array(12, 0, 14, 0, 14, 0, 15, 0, 17, 0, 18, 0, 18, 0, 19, 0, 22, 0, 21, 0, 21, 0, 20, 0, 24, 0, 25, 0, 36, 0, 0, 0, 34, 0, 35, 1, 28, 0, 31, 1, 30, 0, 31, 0, 29, 0, 30, 1, 3, 0, 40, 0, 9, 0, 42, 0, 9, 0, 43, 0, 43, 0, 48, 1, 42, 0, 45, 1, 50, 0, 44, 0, 51, 0, 44, 1, 45, 0, 50, 0, 46, 0, 51, 0, 42, 0, 47, 1, 43, 0, 46, 1, 48, 0, 50, 1, 47, 0, 51, 1, 44, 0, 52, 0, 7, 0, 63, 0, 70, 0, 63, 1, 73, 1, 22, 0, 72, 1, 17, 0, 71, 1, 12, 0, 8, 3, 28, 1, 40, 1, 45, 0, 40, 1, 46, 0, 40, 2, 48, 0, 40, 2, 47, 0, 25, 0, 36, 0, 35, 0, 36, 2, 31, 0, 36, 1, 56, 0, 58, 0, 57, 0, 58, 1, 60, 0, 65, 1, 69, 0, 65, 0, 61, 0, 64, 1, 68, 0, 64, 0, 15, 0, 25, 1, 15, 0, 35, 0, 15, 0, 79, 0, 79, 0, 30, 0, 20, 0, 24, 1, 8, 1, 24, 0, 20, 0, 28, 0, 8, 2, 29, 0, 19, 0, 29, 1, 19, 0, 34, 1, 8, 4, 34, 0, 81, 0, 57, 0, 82, 0, 71, 2, 84, 0, 72, 2, 83, 0, 60, 0, 85, 0, 61, 0, 86, 0, 73, 2, 65, 0, 72, 0, 64, 0, 73, 0, 58, 0, 71, 0, 63, 0, 69, 0, 52, 0, 69, 1, 52, 0, 56, 1, 7, 0, 56, 0, 63, 0, 68, 0, 52, 0, 68, 1)

View file

@ -0,0 +1,439 @@
class_name VideoPlayback
extends Control
## Video playback and seeking inside of Godot.
##
## To use this node, just add it anywhere and resize it to the desired size. Use the function [code]set_video_path(new_path)[/code] and the video will load. Take in mind that long video's can take a second or longer to load. If this is an issue you can preload the Video on startup of your project and set the video variable yourself, just remember to use the function [code]update_video()[/code] before the moment that you'd like to use it.
enum COLOR_PROFILE { AUTO, BT470, BT601, BT709, BT2020, BT2100 }
signal frame_changed(frame_nr: int) ## Emitted when the current frame has changed, for showing and skipped frames.
signal next_frame_called(frame_nr: int) ## Emitted when a new frame is showing.
signal video_loaded ## Emitted when the video is ready for playback.
signal video_ended ## Emitted when the last frame has been shown.
signal playback_started ## Emitted when playback started/resumed.
signal playback_paused ## Emitted when playback is paused.
signal playback_ready ## Emitted when the node if fully setup and ready for playback.
const PLAYBACK_SPEED_MIN: float = 0.25
const PLAYBACK_SPEED_MAX: float = 4
@export_file var path: String = "": set = set_video_path ## Full path to video file.
@export var enable_audio: bool = true ## Enable/Disable audio playback. When setting this on false before loading the audio, the audio playback won't be loaded meaning that the video will load faster. If you want audio but only disable it at certain moments, switch this value to false *after* the video is loaded.
@export var enable_auto_play: bool = false ## Enable/disable auto video playback.
@export_range(PLAYBACK_SPEED_MIN, PLAYBACK_SPEED_MAX, 0.05)
var playback_speed: float = 1.0: set = set_playback_speed ## Adjust the video playback speed, 0.5 = half the speed and 2 = double the speed.
@export var pitch_adjust: bool = true: set = set_pitch_adjust ## When changing playback speed, do you want the pitch to change or stay the same?
@export var loop: bool = false ## Enable/disable looping on video_ended.
@export_group("Extra's")
@export var color_profile: COLOR_PROFILE = COLOR_PROFILE.AUTO: set = _set_color_profile ## Force a specific color profile if needed.
@export var debug: bool = false ## Enable/disable the printing of debug info.
var video: GoZenVideo = null ## Video class object of GDE GoZen which interacts with video files through FFmpeg.
var video_texture: TextureRect = TextureRect.new() ## The texture rect is the view of the video, you can adjust the scaling options as you like, it is set to always center and scale the image to fit within the main VideoPlayback node size.
var audio_player: AudioStreamPlayer = AudioStreamPlayer.new() ## Audio player is the AudioStreamPlayer which handles the audio playback for the video, only mess with the settings if you know what you are doing and know what you'd like to achieve.
var is_playing: bool = false ## Bool to check if the video is currently playing or not.
var current_frame: int = 0: set = _set_current_frame ## Current frame number which the video playback is at.
var _time_elapsed: float = 0.
var _frame_time: float = 0
var _skips: int = 0
var _rotation: int = 0
var _padding: int = 0
var _frame_rate: float = 0.
var _frame_count: int = 0
var _resolution: Vector2i = Vector2i.ZERO
var _shader_material: ShaderMaterial = null
var _threads: PackedInt64Array = []
var _audio_pitch_effect: AudioEffectPitchShift = AudioEffectPitchShift.new()
var y_texture: ImageTexture;
var u_texture: ImageTexture;
var v_texture: ImageTexture;
#------------------------------------------------ TREE FUNCTIONS
func _enter_tree() -> void:
_shader_material = ShaderMaterial.new()
video_texture.material = _shader_material
video_texture.texture = ImageTexture.new()
video_texture.anchor_right = TextureRect.ANCHOR_END
video_texture.anchor_bottom = TextureRect.ANCHOR_END
video_texture.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_CENTERED
video_texture.expand_mode = TextureRect.EXPAND_IGNORE_SIZE
add_child(video_texture)
add_child(audio_player)
AudioServer.add_bus()
audio_player.bus = AudioServer.get_bus_name(AudioServer.bus_count - 1)
AudioServer.add_bus_effect(AudioServer.bus_count - 1, _audio_pitch_effect)
if debug and OS.get_name().to_lower() != "web":
_print_system_debug()
func _exit_tree() -> void:
if video != null:
close()
AudioServer.remove_bus(AudioServer.get_bus_index(audio_player.bus))
func _ready() -> void:
playback_ready.emit()
#------------------------------------------------ VIDEO DATA HANDLING
## This is the starting point for video playback, provide a path of where
## the video file can be found and it will load a Video object. After which
## [code]_update_video()[/code] get's run and set's the first frame image.
func set_video_path(new_path: String) -> void:
if video != null:
close()
if !is_node_ready():
await ready
if !get_tree().root.is_node_ready():
await get_tree().root.ready
var stream: AudioStreamWAV = AudioStreamWAV.new()
stream.mix_rate = 44100
stream.stereo = true
stream.format = AudioStreamWAV.FORMAT_16_BITS
audio_player.stream = stream
if new_path == "" or new_path.ends_with(".tscn"):
return
elif new_path.split(":")[0] == "uid":
new_path = ResourceUID.get_id_path(ResourceUID.text_to_id(new_path))
path = new_path
video = GoZenVideo.new()
if debug:
video.enable_debug()
else:
video.disable_debug()
_threads.append(WorkerThreadPool.add_task(_open_video))
if enable_audio:
_threads.append(WorkerThreadPool.add_task(_open_audio))
func update_video(video_instance: GoZenVideo, audio_stream: AudioStreamWAV = null) -> void:
if video != null:
close()
audio_player.stream = audio_stream
_update_video(video_instance)
## Only run this function after manually having added a Video object to the `video` variable. A good reason for doing this is to load your video's at startup time to prevent your program for freezing for a second when loading in big video files. Some video formats load faster then others so if you are experiencing issues with long loading times, try to use this function and create the video object on startup, or try switching the video format which you are using.
func _update_video(new_video: GoZenVideo) -> void:
video = new_video
if !is_open():
printerr("Video isn't open!")
return
var image: Image
var rotation_radians: float = deg_to_rad(float(video.get_rotation()))
_padding = video.get_padding()
_rotation = video.get_rotation()
_frame_rate = video.get_framerate()
_resolution = video.get_resolution()
_frame_count = video.get_frame_count()
if abs(_rotation) == 90:
image = Image.create_empty(_resolution.y, _resolution.x, false, Image.FORMAT_R8)
else:
image = Image.create_empty(_resolution.x, _resolution.y, false, Image.FORMAT_R8)
image.fill(Color.BLACK)
if debug:
_print_video_debug()
video_texture.texture.set_image(image)
if video.is_full_color_range():
if video.get_interlaced() == 0:
_shader_material.shader = preload("res://addons/gde_gozen/shaders/yuv420p_full.gdshader")
else:
_shader_material.shader = preload("res://addons/gde_gozen/shaders/deinterlace_yuv420p_full.gdshader")
elif video.get_interlaced() == 0:
_shader_material.shader = preload("res://addons/gde_gozen/shaders/yuv420p_standard.gdshader")
_shader_material.shader = preload("res://addons/gde_gozen/shaders/yuv420p_standard.tres")
_shader_material.set_shader_parameter("interlaced", video.get_interlaced())
else:
_shader_material.shader = preload("res://addons/gde_gozen/shaders/deinterlace_yuv420p_standard.gdshader")
_shader_material.set_shader_parameter("interlaced", video.get_interlaced())
_set_color_profile()
# Applying shader params.
_shader_material.set_shader_parameter("resolution", video.get_actual_resolution())
_shader_material.set_shader_parameter("rotation", rotation_radians)
is_playing = false
set_playback_speed(playback_speed)
current_frame = 0
if(!y_texture):
y_texture = ImageTexture.create_from_image(video.get_y_data())
u_texture = ImageTexture.create_from_image(video.get_u_data())
v_texture = ImageTexture.create_from_image(video.get_v_data())
_shader_material.set_shader_parameter("y_data", y_texture)
_shader_material.set_shader_parameter("u_data", u_texture)
_shader_material.set_shader_parameter("v_data", v_texture)
seek_frame(current_frame)
video_loaded.emit()
## Sometimes color profiles are unknown from video files and in case that happens, the colors might be slightly off. Changing the export variable `color_profile` might help fixing the colors.
func _set_color_profile(new_profile: COLOR_PROFILE = color_profile) -> void:
var profile: String = ""
color_profile = new_profile
match color_profile:
COLOR_PROFILE.AUTO: profile = video.get_color_profile()
COLOR_PROFILE.BT470: profile = "bt470"
COLOR_PROFILE.BT601: profile = "bt601"
COLOR_PROFILE.BT709: profile = "bt709"
COLOR_PROFILE.BT2020: profile = "bt2020"
COLOR_PROFILE.BT2100: profile = "bt2100"
match profile:
"bt601", "bt470": _shader_material.set_shader_parameter("color_profile", Vector4(1.402, 0.344136, 0.714136, 1.772))
"bt2020", "bt2100": _shader_material.set_shader_parameter("color_profile", Vector4(1.4746, 0.16455, 0.57135, 1.8814))
_: # bt709 and unknown
_shader_material.set_shader_parameter("color_profile", Vector4(1.5748, 0.1873, 0.4681, 1.8556))
## Seek frame can be used to switch to a frame number you want. Remember that some video codecs report incorrect video end frames or can't seek to the last couple of frames in a video file which may result in an error. Only use this when going to far distances in the video file, else you can use [code]next_frame()[/code].
func seek_frame(new_frame_nr: int) -> void:
if !is_open() and new_frame_nr == current_frame:
return
current_frame = clamp(new_frame_nr, 0, _frame_count)
if video.seek_frame(new_frame_nr):
printerr("Couldn't seek frame!")
else:
_set_frame_image()
if enable_audio:
audio_player.set_stream_paused(false)
audio_player.play(current_frame / _frame_rate)
audio_player.set_stream_paused(!is_playing)
## Seeking frames can be slow, so when you just need to go a couple of frames ahead, you can use next_frame and set skip to false for the last frame.
func next_frame(skip: bool = false) -> void:
if video.next_frame(skip) and !skip:
_set_frame_image()
next_frame_called.emit(current_frame)
elif !skip:
print("Something went wrong getting next frame!")
func close() -> void:
if video != null:
if is_playing:
pause()
video = null
y_texture = null
u_texture = null
v_texture = null
#------------------------------------------------ PLAYBACK HANDLING
func _process(delta: float) -> void:
if is_playing:
_time_elapsed += delta
if _time_elapsed < _frame_time:
return
_skips = 0
while _time_elapsed >= _frame_time:
_time_elapsed -= _frame_time
current_frame += 1
_skips += 1
if current_frame >= _frame_count:
is_playing = !is_playing
if enable_audio:
audio_player.set_stream_paused(true)
video_ended.emit()
if loop:
seek_frame(0)
play()
else:
while _skips != 1:
next_frame(true)
_skips -= 1
next_frame()
elif !_threads.is_empty():
for i: int in _threads:
if WorkerThreadPool.is_task_completed(i):
WorkerThreadPool.wait_for_task_completion(i)
_threads.remove_at(_threads.find(i))
if _threads.is_empty():
_update_video(video)
if enable_auto_play:
play()
## Start the video playback. This will play until reaching the end of the video and then pause and go back to the start.
func play() -> void:
if video != null and !is_open() and is_playing:
return
is_playing = true
if enable_audio:
audio_player.set_stream_paused(false)
audio_player.play((current_frame + 1) / _frame_rate)
audio_player.set_stream_paused(!is_playing)
playback_started.emit()
## Pausing the video.
func pause() -> void:
if video != null and !is_open():
return
is_playing = false
if enable_audio:
audio_player.set_stream_paused(true)
playback_paused.emit()
#------------------------------------------------ GETTERS
## Getting the total amount of frames found in the video file.
func get_video_frame_count() -> int:
return _frame_count
## Getting the framerate of the video
func get_video_framerate() -> float:
return _frame_rate
## Getting the rotation in degrees of the video
func get_video_rotation() -> int:
return _rotation
## Checking to see if the video is open or not, trying to run functions without checking if open can crash your project.
func is_open() -> bool:
return video != null and video.is_open()
func _get_img_tex(image_data: PackedByteArray, width: int, height: int, r8: bool = true) -> ImageTexture:
var format: Image.Format = Image.FORMAT_R8 if r8 else Image.FORMAT_RG8
var image: Image = Image.create_from_data(width, height, false, format, image_data)
return ImageTexture.create_from_image(image)
#------------------------------------------------ SETTERS
func _set_current_frame(new_current_frame: int) -> void:
current_frame = new_current_frame
frame_changed.emit(current_frame)
func _set_frame_image() -> void:
y_texture.update(video.get_y_data())
u_texture.update(video.get_u_data())
v_texture.update(video.get_v_data())
func set_playback_speed(new_playback_value: float) -> void:
playback_speed = clampf(new_playback_value, 0.5, 2)
_frame_time = (1.0 / _frame_rate) / playback_speed
if enable_audio and audio_player.stream != null:
audio_player.pitch_scale = playback_speed
_set_pitch_adjust()
if is_playing:
audio_player.play(current_frame * (1.0 / _frame_rate))
func set_pitch_adjust(new_pitch_value: bool) -> void:
pitch_adjust = new_pitch_value
_set_pitch_adjust()
func _set_pitch_adjust() -> void:
if pitch_adjust:
_audio_pitch_effect.pitch_scale = clamp(1.0 / playback_speed, 0.5, 2.0)
elif _audio_pitch_effect.pitch_scale != 1.0:
_audio_pitch_effect.pitch_scale = 1.0
#------------------------------------------------ MISC
func _open_video() -> void:
if video.open(path):
printerr("Error opening video!")
func _open_audio() -> void:
var data: PackedByteArray = GoZenAudio.get_audio_data(path)
if data.size() != 0:
audio_player.stream.data = data
else:
printerr("Audio data for video '%s' was 0!" % path)
enable_audio = false
func _print_system_debug() -> void:
print_rich("[b]System info")
print("OS name: ", OS.get_name())
print("Distro name: ", OS.get_distribution_name())
print("OS version: ", OS.get_version())
print_rich("Memory info:\n\t", OS.get_memory_info())
print("CPU name: ", OS.get_processor_name())
print("Threads count: ", OS.get_processor_count())
func _print_video_debug() -> void:
print_rich("[b]Video debug info")
print("Extension: ", path.get_extension())
print("Resolution: ", _resolution)
print("Actual resolution: ", video.get_actual_resolution())
print("Pixel format: ", video.get_pixel_format())
print("Color profile: ", video.get_color_profile())
print("Framerate: ", _frame_rate)
print("Duration (in frames): ", _frame_count)
print("Padding: ", _padding)
print("Rotation: ", _rotation)
print("Full color range: ", video.is_full_color_range())
print("Interlaced flag: ", video.get_interlaced())
print("Using sws: ", video.is_using_sws())
print("Sar: ", video.get_sar())

View file

@ -0,0 +1 @@
uid://ivx7m2bfysip

Some files were not shown because too many files have changed in this diff Show more