### GLShaderKit Installation and Configuration Source: https://github.com/karoterra/aviutl-glshaderkit/blob/main/README.md Provides instructions for installing GLShaderKit, including prerequisites like the Microsoft Visual C++ Redistributable package and placement of DLL and INI files. It also details the configuration options available in GLShaderKit.ini, such as shader cache capacity. ```ini [Settings] shaderCacheCapacity = 1024 ``` -------------------------------- ### Shader Examples for GLShaderKit_draw Source: https://github.com/karoterra/aviutl-glshaderkit/blob/main/example/draw/README.md This section provides examples of shader pairs that can be used with GLShaderKit_draw. It includes links to the vertex and fragment shader files for GLShaderKit_draw_01, GLShaderKit_draw_02, GLShaderKit_draw_03, and GLShaderKit_draw_04, along with example output images. ```obj Shader Examples: GLShaderKit_draw_01: - Vertex Shader: GLShaderKit_draw_01.vert - Fragment Shader: GLShaderKit_draw_01.frag - Example Output: /assets/GLShaderKit_draw_01.webp GLShaderKit_draw_02: - Vertex Shader: GLShaderKit_draw_02.vert - Fragment Shader: GLShaderKit_draw_02.frag - Example Output: /assets/GLShaderKit_draw_02.webp GLShaderKit_draw_03: - Vertex Shader: GLShaderKit_draw_03.vert - Fragment Shader: GLShaderKit_draw_03.frag - Example Output: /assets/GLShaderKit_draw_03.webp GLShaderKit_draw_04: - Vertex Shader: GLShaderKit_draw_04.vert - Fragment Shader: GLShaderKit_draw_04.frag - Example Output: /assets/GLShaderKit_draw_04.webp ``` -------------------------------- ### GLShaderKit_effect_01 Shader Details Source: https://github.com/karoterra/aviutl-glshaderkit/blob/main/example/effect/README.md Details for GLShaderKit_effect_01, including links to its vertex and fragment shaders, and example images before and after applying the effect. ```anm GLShaderKit_effect_01: vertex_shader: GLShaderKit_effect_01.vert fragment_shader: GLShaderKit_effect_01.frag ``` -------------------------------- ### Gaussian Blur with GLShaderKit Source: https://github.com/karoterra/aviutl-glshaderkit/blob/main/example/gaussianBlur/README.md This script applies a Gaussian blur effect to an image by repeatedly drawing with a single shader. It leverages the default vertex shader provided by GLShaderKit, eliminating the need for a separate vertex shader file. Ensure you have GLShaderKit version 0.5.0 or later installed. ```AviUtl Script # GLShaderKit_gaussianBlur.anm # This is a sample script for drawing multiple times with a single shader. # It applies a blur effect to the image. # GLShaderKit's default vertex shader is used, so no vertex shader file is required. # Requires GLShaderKit v0.5.0 or later. # Example usage (assuming you have GLShaderKit installed and configured): # Load this script in AviUtl and apply it to your video layer. # Adjust parameters as needed for desired blur intensity. ``` -------------------------------- ### GLShaderKit_effectInstanced_01 Shader References Source: https://github.com/karoterra/aviutl-glshaderkit/blob/main/example/effectInstanced/README.md This snippet provides links to the vertex shader, fragment shader, and an example image used with the GLShaderKit_effectInstanced_01 effect. ```anm - Vertex Shader: GLShaderKit_effectInstanced_01.vert - Fragment Shader: GLShaderKit_effectInstanced_01.frag - Example Image: https://pixabay.com/photos/buttons-colored-buttons-1821331/ ``` -------------------------------- ### Deploy to AviUtl for Debugging Source: https://github.com/karoterra/aviutl-glshaderkit/blob/main/CMakeLists.txt A custom target 'debug_deploy' that copies the built GLShaderKit library and associated example files to the AviUtl script directory for debugging purposes. It creates the necessary directory structure if it doesn't exist. ```cmake # 検証用の AviUtl に配置 add_custom_target(debug_deploy ALL ${CMAKE_COMMAND} -E make_directory ${AVIUTL_DIR}/script/GLShaderKit COMMAND ${CMAKE_COMMAND} -E copy $ ${PROJECT_SOURCE_DIR}/src/GLShaderKit.ini ${PROJECT_SOURCE_DIR}/example/info/GLShaderKit_info.obj ${PROJECT_SOURCE_DIR}/example/draw/GLShaderKit_draw.obj ${PROJECT_SOURCE_DIR}/example/drawPoints/GLShaderKit_drawPoints.obj ${PROJECT_SOURCE_DIR}/example/effect/GLShaderKit_effect.anm ${PROJECT_SOURCE_DIR}/example/effectInstanced/GLShaderKit_effectInstanced.anm ${PROJECT_SOURCE_DIR}/example/multiShader/GLShaderKit_multiShader.obj ${PROJECT_SOURCE_DIR}/example/multiShader/GLShaderKit_multiShader_1.frag ${PROJECT_SOURCE_DIR}/example/multiShader/GLShaderKit_multiShader_2.frag ${PROJECT_SOURCE_DIR}/example/multiTexture/GLShaderKit_multiTexture.obj ${PROJECT_SOURCE_DIR}/example/multiTexture/GLShaderKit_multiTexture.frag ${PROJECT_SOURCE_DIR}/example/multiTexture/GLShaderKit_multiTexture.vert ${PROJECT_SOURCE_DIR}/example/multiTexture/GLShaderKit_multiTexture_img0.png ${PROJECT_SOURCE_DIR}/example/multiTexture/GLShaderKit_multiTexture_img1.png ${PROJECT_SOURCE_DIR}/example/multiTexture/GLShaderKit_multiTexture_img2.png ${PROJECT_SOURCE_DIR}/example/uniform/GLShaderKit_uniform.obj ${PROJECT_SOURCE_DIR}/example/uniform/GLShaderKit_uniform.frag ${PROJECT_SOURCE_DIR}/example/uniform/GLShaderKit_uniform.vert ${PROJECT_SOURCE_DIR}/example/gaussianBlur/GLShaderKit_gaussianBlur.anm ${PROJECT_SOURCE_DIR}/example/gaussianBlur/GLShaderKit_gaussianBlur.frag ${AVIUTL_DIR}/script/GLShaderKit WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} DEPENDS GLShaderKit COMMENT "debug_deploy -> ${AVIUTL_DIR}" ) ``` -------------------------------- ### GLShaderKit Uniform Variable Types Source: https://github.com/karoterra/aviutl-glshaderkit/blob/main/example/uniform/README.md This sample demonstrates the usage of various uniform variable types available in GLShaderKit. It covers a comprehensive set of types to ensure proper functionality and integration. ```obj # GLShaderKit_uniform.obj ユニフォーム変数の使える型を一通り試すサンプルです。 ``` -------------------------------- ### GLShaderKit_drawPoints_01 Shader Configuration Source: https://github.com/karoterra/aviutl-glshaderkit/blob/main/example/drawPoints/README.md Configuration for GLShaderKit_drawPoints_01, including links to vertex and fragment shaders. This setup is used for drawing point clouds with specific visual properties. ```APIDOC GLShaderKit_drawPoints_01: Vertex Shader: GLShaderKit_drawPoints_01.vert Fragment Shader: GLShaderKit_drawPoints_01.frag ``` -------------------------------- ### GLShaderKit_drawPoints_03 Shader Configuration Source: https://github.com/karoterra/aviutl-glshaderkit/blob/main/example/drawPoints/README.md Configuration for GLShaderKit_drawPoints_03, including links to vertex and fragment shaders. This setup is used for drawing point clouds with specific visual properties. ```APIDOC GLShaderKit_drawPoints_03: Vertex Shader: GLShaderKit_drawPoints_03.vert Fragment Shader: GLShaderKit_drawPoints_03.frag ``` -------------------------------- ### GLShaderKit_drawPoints_02 Shader Configuration Source: https://github.com/karoterra/aviutl-glshaderkit/blob/main/example/drawPoints/README.md Configuration for GLShaderKit_drawPoints_02, including links to vertex and fragment shaders. This setup is used for drawing point clouds with specific visual properties. ```APIDOC GLShaderKit_drawPoints_02: Vertex Shader: GLShaderKit_drawPoints_02.vert Fragment Shader: GLShaderKit_drawPoints_02.frag ``` -------------------------------- ### Get GLShaderKit Version Source: https://github.com/karoterra/aviutl-glshaderkit/blob/main/docs/api/GLShaderKit.md Retrieves the version of the GLShaderKit DLL. This function returns a string representing the current version. ```lua version() ``` -------------------------------- ### Get OpenGL Renderer Information Source: https://github.com/karoterra/aviutl-glshaderkit/blob/main/docs/api/GLShaderKit.md Retrieves the renderer string for the OpenGL implementation. This is equivalent to calling glGetString(GL_RENDERER). ```lua glRenderer() ``` -------------------------------- ### Get OpenGL Version Information Source: https://github.com/karoterra/aviutl-glshaderkit/blob/main/docs/api/GLShaderKit.md Retrieves the version string for the OpenGL implementation. This is equivalent to calling glGetString(GL_VERSION). ```lua glVersion() ``` -------------------------------- ### Get OpenGL Vendor Information Source: https://github.com/karoterra/aviutl-glshaderkit/blob/main/docs/api/GLShaderKit.md Retrieves the vendor string for the OpenGL implementation. This is equivalent to calling glGetString(GL_VENDOR). ```lua glVendor() ``` -------------------------------- ### Get GLSL Version Information Source: https://github.com/karoterra/aviutl-glshaderkit/blob/main/docs/api/GLShaderKit.md Retrieves the shading language version string. This is equivalent to calling glGetString(GL_SHADING_LANGUAGE_VERSION). ```lua glslVersion() ``` -------------------------------- ### GLShaderKit Drawing with Shaders Source: https://github.com/karoterra/aviutl-glshaderkit/blob/main/example/README.md Demonstrates drawing using shaders with GLShaderKit. ```draw This section contains custom objects for drawing using shaders with GLShaderKit. ``` -------------------------------- ### GLShaderKit.Program Class API Documentation Source: https://github.com/karoterra/aviutl-glshaderkit/blob/main/docs/api/GLShaderKit.Program.md API documentation for the GLShaderKit.Program class, detailing its methods for shader program management. ```APIDOC GLShaderKit.Program: new(shaderPath, forceReload) Creates a program object by compiling and linking the specified shader source file. Supports various shader file extensions (.vert, .frag, .tesc, .tese, .geom). Uses a default vertex shader if none is found. Parameters: shaderPath (string): The absolute path to the shader source file. forceReload (boolean, optional): If true, recompiles the shader program even if cached. Defaults to false. Returns: Program: An instance of the program. use() Activates the program for use. No return value. setFloat(name, x) Sets a float uniform variable. Must be called after 'use()'. Parameters: name (string): The name of the uniform variable. x (number): The value. No return value. setFloat(name, x, y) Sets a vec2 uniform variable. Must be called after 'use()'. Parameters: name (string): The name of the uniform variable. x (number): The x component. y (number): The y component. No return value. setFloat(name, x, y, z) Sets a vec3 uniform variable. Must be called after 'use()'. Parameters: name (string): The name of the uniform variable. x (number): The x component. y (number): The y component. z (number): The z component. No return value. setFloat(name, x, y, z, w) Sets a vec4 uniform variable. Must be called after 'use()'. Parameters: name (string): The name of the uniform variable. x (number): The x component. y (number): The y component. z (number): The z component. w (number): The w component. No return value. setInt(name, x) Sets an int uniform variable. Must be called after 'use()'. Parameters: name (string): The name of the uniform variable. x (integer): The value. No return value. setInt(name, x, y) Sets an ivec2 uniform variable. Must be called after 'use()'. Parameters: name (string): The name of the uniform variable. x (integer): The x component. y (integer): The y component. No return value. setInt(name, x, y, z) Sets an ivec3 uniform variable. Must be called after 'use()'. Parameters: name (string): The name of the uniform variable. x (integer): The x component. y (integer): The y component. z (integer): The z component. No return value. setInt(name, x, y, z, w) Sets an ivec4 uniform variable. Must be called after 'use()'. Parameters: name (string): The name of the uniform variable. x (integer): The x component. y (integer): The y component. z (integer): The z component. w (integer): The w component. No return value. setUInt(name, x) Sets a uint uniform variable. Must be called after 'use()'. Parameters: name (string): The name of the uniform variable. x (integer): The value. No return value. setUInt(name, x, y) Sets a uvec2 uniform variable. Must be called after 'use()'. Parameters: name (string): The name of the uniform variable. x (integer): The x component. y (integer): The y component. No return value. setUInt(name, x, y, z) Sets a uvec3 uniform variable. Must be called after 'use()'. Parameters: name (string): The name of the uniform variable. x (integer): The x component. y (integer): The y component. z (integer): The z component. No return value. setUInt(name, x, y, z, w) Sets a uvec4 uniform variable. Must be called after 'use()'. Parameters: name (string): The name of the uniform variable. x (integer): The x component. y (integer): The y component. z (integer): The z component. w (integer): The w component. No return value. setMatrix(name, matrixType, transpose, value) Sets a matrix uniform variable. Must be called after 'use()'. Parameters: name (string): The name of the uniform variable. matrixType (string): The shape of the matrix (e.g., '2x2', '3x3', '4x4', '2x3', '3x2', '2x4', '4x2', '3x4', '4x3'). transpose (boolean): True to transpose the matrix. value (number[]): An array of matrix element values. The number of elements must match the matrix dimensions. No return value. ``` -------------------------------- ### GLShaderKit Build Instructions Source: https://github.com/karoterra/aviutl-glshaderkit/blob/main/README.md Details the process of building GLShaderKit from source code. It requires MSVC (VS2022) and CMake, along with copying Lua 5.1.4 files into the vendor directory. The build process involves CMake commands for configuration and building the release version. ```cmd cmake --preset default cmake --build .\build --preset release ``` -------------------------------- ### GLShaderKit Info Custom Object Source: https://github.com/karoterra/aviutl-glshaderkit/blob/main/example/README.md Displays various information, such as version information, using GLShaderKit. ```info This section contains custom objects for displaying version information and other details using GLShaderKit. ``` -------------------------------- ### GLShaderKit Point Cloud Drawing with Shaders Source: https://github.com/karoterra/aviutl-glshaderkit/blob/main/example/README.md Demonstrates drawing point clouds using shaders with GLShaderKit. ```drawPoints This section contains custom objects for drawing point clouds using shaders with GLShaderKit. ``` -------------------------------- ### Build GLShaderKit Library Source: https://github.com/karoterra/aviutl-glshaderkit/blob/main/CMakeLists.txt Configures the main GLShaderKit shared library. It specifies C++ standard, includes dependencies like Lua and glad, links against Lua and OpenGL, and sets compile definitions and options. ```cmake cmake_minimum_required(VERSION 3.24) project(aviutl_GLShaderKit LANGUAGES CXX C VERSION 0.5.0 ) enable_testing() # C++ の設定 set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) # GoogleTest find_package(GTest CONFIG REQUIRED) # Lua 5.1.4 set(LUA_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/vendor/lua/include) set(LUA_LIBRARY_DIR ${PROJECT_SOURCE_DIR}/vendor/lua) # glad set(GLAD_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/vendor/glad/include) set(GLAD_SOURCE_DIR ${PROJECT_SOURCE_DIR}/vendor/glad/src) # デバッグに使用するAviUtlがあるディレクトリ set(AVIUTL_DIR ${PROJECT_SOURCE_DIR}/bin/aviutl) # GLShaderKit.dll add_library(GLShaderKit SHARED src/main.cpp src/release.cpp src/lua_helper.cpp src/gl_context.cpp src/gl_shader.cpp src/gl_shader_manager.cpp src/gl_framebuffer.cpp src/gl_vertex.cpp src/gl_texture.cpp src/gl_uniform.cpp ${GLAD_SOURCE_DIR}/gl.c ${GLAD_SOURCE_DIR}/wgl.c ) target_include_directories(GLShaderKit PRIVATE src ${LUA_INCLUDE_DIR} ${GLAD_INCLUDE_DIR} ) target_link_directories(GLShaderKit PRIVATE ${LUA_LIBRARY_DIR}) target_link_libraries(GLShaderKit PRIVATE lua51 opengl32 ) target_compile_options(GLShaderKit PRIVATE "<$:/source-charset:utf-8>" "<$:/execution-charset:shift_jis>" ) target_compile_definitions(GLShaderKit PRIVATE GL_SHADER_KIT_VERSION="${PROJECT_VERSION}" NOMINMAX ) ``` -------------------------------- ### Build GLShaderKit Test Executable Source: https://github.com/karoterra/aviutl-glshaderkit/blob/main/CMakeLists.txt Configures the test executable for GLShaderKit. It includes test-specific source files, links against GTest, and sets compile definitions and options similar to the main library. ```cmake # テスト用実行ファイル add_executable(GLShaderKit_test tests/test_config.cpp tests/test_release.cpp src/release.cpp tests/test_cache.cpp ) target_include_directories(GLShaderKit_test PUBLIC src tests) target_link_libraries(GLShaderKit_test PRIVATE GTest::gmock_main ) target_compile_options(GLShaderKit_test PRIVATE "<$:/source-charset:utf-8>" "<$:/execution-charset:shift_jis>" ) target_compile_definitions(GLShaderKit_test PRIVATE GL_SHADER_KIT_VERSION="${PROJECT_VERSION}" NOMINMAX ) ``` -------------------------------- ### GLShaderKit Texture API Documentation Source: https://github.com/karoterra/aviutl-glshaderkit/blob/main/docs/api/GLShaderKit.Texture.md Provides documentation for the static and instance methods of the GLShaderKit Texture class. This includes creating textures from data, binding them to texture units, unbinding, and releasing resources. ```APIDOC GLShaderKit.Texture: new(data, width, height) Creates a new texture. Parameters: data (lightuserdata): Pointer to the texture's BGRA array. width (integer): The width of the texture. height (integer): The height of the texture. Returns: Texture: A new Texture instance. unbind() Unbinds the texture. Returns: None. bind(unit) Binds the texture to a texture unit. Parameters: unit (integer): The texture unit number. Returns: None. unbind() Unbinds the texture. Returns: None. release() Releases the texture's resources. Returns: None. ``` -------------------------------- ### Check GLShaderKit Initialization Status Source: https://github.com/karoterra/aviutl-glshaderkit/blob/main/docs/api/GLShaderKit.md Checks if the GLShaderKit DLL has been successfully initialized. Returns true if the DLL is ready for use, false otherwise. ```lua isInitialized() ``` -------------------------------- ### GLShaderKit_draw.obj Parameters Source: https://github.com/karoterra/aviutl-glshaderkit/blob/main/example/draw/README.md This section details the parameters available for the GLShaderKit_draw.obj custom object. These include trackbar controls for width and height, and a file input for specifying the shader to be used. A checkbox for 're-read' recompiles the shader each time. ```obj GLShaderKit_draw.obj: Parameters: - Type: Trackbar, Name: Width, Description: Width of the custom object (pixels) - Type: Trackbar, Name: Height, Description: Height of the custom object (pixels) - Type: Trackbar, Name: track2, Description: Unused - Type: Trackbar, Name: track3, Description: Unused - Type: File, Name: Reference, Description: Shader to use - Type: Checkbox, Name: Re-read, Description: If ON, recompile the shader every time ``` -------------------------------- ### khrplatform.h License Source: https://github.com/karoterra/aviutl-glshaderkit/blob/main/README.md The license information for khrplatform.h, a header file used in GLShaderKit, which is provided under a permissive license allowing use, modification, and distribution. ```text Copyright (c) 2008-2018 The Khronos Group Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and/or associated documentation files (the "Materials"), to deal in the Materials without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Materials, and to permit persons to whom the Materials are 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 Materials. THE MATERIALS ARE 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 MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. ``` -------------------------------- ### GLShaderKit API Reference Source: https://github.com/karoterra/aviutl-glshaderkit/blob/main/README.md Provides access to the API reference for GLShaderKit, intended for script developers. This includes definitions and usage guidelines for interacting with the library's functionalities. ```APIDOC GLShaderKit API Reference: Refer to /docs/api/README.md for detailed API documentation for script developers. GLShaderKit_def.lua: Definition file for Lua Language Server (luals) to aid in VSCode script development. ``` -------------------------------- ### GLShaderKit_effectInstanced.anm Parameters Source: https://github.com/karoterra/aviutl-glshaderkit/blob/main/example/effectInstanced/README.md This section describes the parameters for the GLShaderKit_effectInstanced.anm animation effect. It includes trackbars for instance count and unused tracks, a file reference for the shader, and a checkbox for shader recompilation. ```anm Type: Trackbar Name: 個数 Description: Instance count Type: Trackbar Name: track1 Description: Unused Type: Trackbar Name: track2 Description: Unused Type: Trackbar Name: track3 Description: Unused Type: File Name: 参照 Description: Shader to use Type: Checkbox Name: 再読込 Description: If ON, recompile shader every time ``` -------------------------------- ### Package Release Artifacts Source: https://github.com/karoterra/aviutl-glshaderkit/blob/main/CMakeLists.txt A custom target 'package' that creates a zip archive containing the built GLShaderKit library, its configuration file, documentation, README, and LICENSE. This is used for creating distributable release packages. ```cmake # リリース用 add_custom_target(package COMMAND 7z a publish/${PROJECT_NAME}_v${PROJECT_VERSION}.zip $ ${PROJECT_SOURCE_DIR}/src/GLShaderKit.ini ${PROJECT_SOURCE_DIR}/docs/def/GLShaderKit_def.lua README.md LICENSE WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} DEPENDS GLShaderKit COMMENT "package -> publish/${PROJECT_NAME}_v${PROJECT_VERSION}.zip" ) ``` -------------------------------- ### CTest Integration and Test Discovery Source: https://github.com/karoterra/aviutl-glshaderkit/blob/main/CMakeLists.txt Includes CTest support and GoogleTest integration to enable running tests through CMake. `gtest_discover_tests` automatically finds and configures tests defined in the test executable. ```cmake # CTest include(CTest) include(GoogleTest) gtest_discover_tests(GLShaderKit_test) ``` -------------------------------- ### GLShaderKit Uniform Variable Type Testing Source: https://github.com/karoterra/aviutl-glshaderkit/blob/main/example/README.md Tests all available types of uniform variables with GLShaderKit. ```uniform This section contains custom objects for testing all available types of uniform variables with GLShaderKit. ``` -------------------------------- ### FrameBuffer Instance Methods Source: https://github.com/karoterra/aviutl-glshaderkit/blob/main/docs/api/GLShaderKit.FrameBuffer.md Details the instance methods for interacting with a FrameBuffer object, including binding, unbinding, binding textures, reading pixel data, and releasing resources. ```APIDOC FrameBuffer: bind() Binds the framebuffer. unbind() Unbinds the framebuffer. bindTexture(unit: integer) Binds the color buffer of the framebuffer as a texture to the specified texture unit. readPixels(data: lightuserdata) Retrieves the image data from the color buffer of the framebuffer into the provided BGRA array pointer. release() Releases the resources associated with the framebuffer. ``` -------------------------------- ### GLShaderKit Effect Animation with Shaders Source: https://github.com/karoterra/aviutl-glshaderkit/blob/main/example/README.md Applies effects using shaders for animation with GLShaderKit. ```effect This section contains custom objects for applying effects using shaders for animation with GLShaderKit. ``` -------------------------------- ### Activate Rendering Context Source: https://github.com/karoterra/aviutl-glshaderkit/blob/main/docs/api/GLShaderKit.md Activates the rendering context for the DLL. This function must be called once before using any other DLL functions. Returns true on success, false on failure. ```lua activate() ``` -------------------------------- ### GLShaderKit Instanced Effect Animation Source: https://github.com/karoterra/aviutl-glshaderkit/blob/main/example/README.md Draws multiple instances at once using shaders for animation effects with GLShaderKit. ```effectInstanced This section contains custom objects for drawing multiple instances at once using shaders for animation effects with GLShaderKit. ``` -------------------------------- ### GLShaderKit.Vertex Instance Methods Source: https://github.com/karoterra/aviutl-glshaderkit/blob/main/docs/api/GLShaderKit.Vertex.md Details the instance methods for interacting with a Vertex object. `bind` binds the vertex array, `unbind` unbinds the frame buffer, `draw` executes rendering operations with specified modes and frame buffers, and `release` frees associated resources. ```lua vertex:bind() -- Binds the vertex array. -- Returns: void vertex:unbind() -- Unbinds the frame buffer. -- Returns: void vertex:draw(mode, fbo, instanceCount) -- Executes drawing. -- Arguments: -- mode: string - The primitive mode to draw (e.g., POINTS, TRIANGLES) -- fbo: FrameBuffer - The target FrameBuffer instance for drawing -- instanceCount: integer - The number of instances to draw (defaults to 1) -- Returns: void vertex:release() -- Releases the resources associated with the vertex array. -- Returns: void ``` -------------------------------- ### LuaBinaries 5.1.4 License Source: https://github.com/karoterra/aviutl-glshaderkit/blob/main/README.md The license for LuaBinaries 5.1.4, a dependency for GLShaderKit. This license is also permissive, allowing for broad use and distribution of the software. ```text Copyright © 2005-2021 Tecgraf/PUC-Rio and the Kepler Project. 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. ``` -------------------------------- ### Copy Test Data Source: https://github.com/karoterra/aviutl-glshaderkit/blob/main/CMakeLists.txt A custom command to copy test data from the source directory to the build directory before tests are run. This ensures tests have access to necessary data files. ```cmake # テストデータ add_custom_command(TARGET GLShaderKit_test PRE_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/tests/data ${CMAKE_BINARY_DIR}/data ) ``` -------------------------------- ### GLShaderKit v0.5.0 Update Source: https://github.com/karoterra/aviutl-glshaderkit/blob/main/README.md Details the changes in version 0.5.0 of GLShaderKit, including the introduction of user data types (Texture, FrameBuffer, Vertex, Program) and updates to documentation and LuaLS definition files. ```markdown - Introduced user data (Texture, FrameBuffer, Vertex, Program) ([#15](https://github.com/karoterra/aviutl-GLShaderKit/pull/15), [#16](https://github.com/karoterra/aviutl-GLShaderKit/pull/16)) - Updated reference documentation and added LuaLS definition file ([#17](https://github.com/karoterra/aviutl-GLShaderKit/pull/17)) ``` -------------------------------- ### GLShaderKit Multi-Texture Custom Object Source: https://github.com/karoterra/aviutl-glshaderkit/blob/main/example/README.md Uses multiple textures within a single script with GLShaderKit. ```multiTexture This section contains custom objects for using multiple textures within a single script with GLShaderKit. ``` -------------------------------- ### GLShaderKit Multi-Shader Custom Object Source: https://github.com/karoterra/aviutl-glshaderkit/blob/main/example/README.md Uses multiple shaders within a single script with GLShaderKit. ```multiShader This section contains custom objects for using multiple shaders within a single script with GLShaderKit. ``` -------------------------------- ### GLShaderKit.Vertex Static Methods Source: https://github.com/karoterra/aviutl-glshaderkit/blob/main/docs/api/GLShaderKit.Vertex.md Provides static methods for creating and managing Vertex arrays. The `new` method creates vertex arrays for primitives like PLANE (for planar polygons) and POINTS (for point clouds). The `unbind` method unbinds the vertex array. ```lua Vertex.new(primitive, n) -- Creates a vertex array. -- If primitive is PLANE, creates a vertex array for a planar polygon divided into n x n segments. -- $(n + 1)^2$ vertices are created. -- Vertex attributes: -- location 0: vec3 (vertex coordinates [-1, 1]) -- location 1: vec2 (texture coordinates [0, 1]) -- If primitive is POINTS, creates a vertex array for n points. -- Vertex attribute: -- location 0: float (vertex number (0, 1, ..., n-1)) -- Arguments: -- primitive: string - The primitive type (PLANE or POINTS) -- n: integer - Subdivision count for PLANE or number of points for POINTS -- Returns: Vertex - A new Vertex instance Vertex.unbind() -- Unbinds the vertex array. -- Returns: void ``` -------------------------------- ### GLShaderKit Gaussian Blur with Single Shader Source: https://github.com/karoterra/aviutl-glshaderkit/blob/main/example/README.md Applies Gaussian blur by drawing multiple times with a single shader using GLShaderKit. ```gaussianBlur This section contains custom objects for applying Gaussian blur by drawing multiple times with a single shader using GLShaderKit. ``` -------------------------------- ### Load and Compile Shader Program Source: https://github.com/karoterra/aviutl-glshaderkit/blob/main/docs/api/GLShaderKit.md Compiles and links a shader program from the specified source file. If a shader program with the same name is cached, it will be recompiled if `forceReload` is true. Supports various shader types (.vert, .frag, .tesc, .tese, .geom). A default vertex shader is used if none is found. Errors are logged to the console. ```lua setShader(shaderPath, forceReload) ``` -------------------------------- ### FrameBuffer Static Methods Source: https://github.com/karoterra/aviutl-glshaderkit/blob/main/docs/api/GLShaderKit.FrameBuffer.md Provides static methods for creating and unbinding FrameBuffer instances. The `new` method creates a framebuffer with specified dimensions, and `unbind` detaches the current framebuffer. ```APIDOC FrameBuffer: new(width: integer, height: integer) -> FrameBuffer Creates a new framebuffer with the specified width and height. unbind() Unbinds the current framebuffer. ``` -------------------------------- ### Multi-Texture Blending Shader Source: https://github.com/karoterra/aviutl-glshaderkit/blob/main/example/multiTexture/README.md This shader demonstrates how to use multiple textures within GLShaderKit. It performs an additive blend operation on three input textures to produce a final output. The shader is designed for use with AviUtl. ```glsl #pragma optionNVSE // GLShaderKit_multiTexture.obj // シェーダーで複数のテクスチャを使用するサンプルです。 // 3枚の画像を加算合成します。 // Input textures uniform sampler2D Texture0; uniform sampler2D Texture1; uniform sampler2D Texture2; // Output color vec4 frag() { vec4 color0 = texture2D(Texture0, ex.tex.st); vec4 color1 = texture2D(Texture1, ex.tex.st); vec4 color2 = texture2D(Texture2, ex.tex.st); // Additive blending vec4 finalColor = color0 + color1 + color2; // Clamp the color to avoid exceeding 1.0, which might result in white or unexpected colors finalColor = clamp(finalColor, 0.0, 1.0); return finalColor; } ``` -------------------------------- ### Set UInt Uniform Variable (Single Value) Source: https://github.com/karoterra/aviutl-glshaderkit/blob/main/docs/api/GLShaderKit.md Sets a uniform variable of type `uint`. This function should be called after `setShader`. ```APIDOC setUInt(name, x) Sets a uniform variable of type `uint`. Parameters: name (string): The name of the uniform variable. x (integer): The value to set. ``` -------------------------------- ### Set Point Cloud Vertex Data Source: https://github.com/karoterra/aviutl-glshaderkit/blob/main/docs/api/GLShaderKit.md Makes a vertex array object representing a point cloud of n points available. Each point has a vertex attribute of type float (vertex number) at location 0. ```lua setPointVertex(n) ``` -------------------------------- ### GLShaderKit_effect_02 Shader Details Source: https://github.com/karoterra/aviutl-glshaderkit/blob/main/example/effect/README.md Details for GLShaderKit_effect_02, which adjusts RGB values based on trackbar inputs. It uses the default vertex shader provided by GLShaderKit. ```anm GLShaderKit_effect_02: fragment_shader: GLShaderKit_effect_02.frag description: Adjusts image RGB based on trackbar inputs (track0, track1, track2). uses_default_vertex_shader: true ``` -------------------------------- ### Set Matrix Uniform Variable Source: https://github.com/karoterra/aviutl-glshaderkit/blob/main/docs/api/GLShaderKit.md Sets a matrix uniform variable. This function should be called after `setShader`. ```APIDOC setMatrix(name, matrixType, transpose, value) Sets a matrix uniform variable. Parameters: name (string): The name of the uniform variable. matrixType (string): The shape of the matrix (e.g., "2x2", "3x3", "4x4", "2x3", "3x2", "2x4", "4x2", "3x4", "4x3"). transpose (boolean): If true, the matrix is transposed. value (number[]): An array of matrix element values. The number of elements must match the matrix dimensions. ``` -------------------------------- ### Default Vertex Shader Source: https://github.com/karoterra/aviutl-glshaderkit/blob/main/docs/api/GLShaderKit.Program.md The default vertex shader used by GLShaderKit.Program when no vertex shader file is found. It processes input vertex positions and texture coordinates. ```glsl #version 460 core layout(location = 0) in vec3 iPos; layout(location = 1) in vec2 iTexCoord; out vec2 TexCoord; void main() { gl_Position = vec4(iPos, 1.0); TexCoord = iTexCoord; } ``` -------------------------------- ### Bind Texture 2D Source: https://github.com/karoterra/aviutl-glshaderkit/blob/main/docs/api/GLShaderKit.md Binds a texture to a texture unit. ```APIDOC setTexture2D(unit, data, width, height) Binds a texture. Parameters: unit (integer): The texture unit number. data (lightuserdata): Pointer to the texture's BGRA array. width (integer): The width of the texture. height (integer): The height of the texture. ``` -------------------------------- ### Set Integer Uniform Variable Source: https://github.com/karoterra/aviutl-glshaderkit/blob/main/docs/api/GLShaderKit.md Sets a uniform variable of type integer. This function should be called after `setShader`. It supports setting single integer values (int), ivec2, ivec3, and ivec4. ```lua setInt(name, x) ``` ```lua setInt(name, x, y) ``` ```lua setInt(name, x, y, z) ``` ```lua setInt(name, x, y, z, w) ``` -------------------------------- ### GLShaderKit_effect_03 Shader Details Source: https://github.com/karoterra/aviutl-glshaderkit/blob/main/example/effect/README.md Details for GLShaderKit_effect_03, which applies a glitch effect to images based on trackbar inputs. It utilizes the default vertex shader from GLShaderKit. ```anm GLShaderKit_effect_03: fragment_shader: GLShaderKit_effect_03.frag description: Applies a glitch effect to images based on trackbar inputs (track0, track1, track2). uses_default_vertex_shader: true ```