Skip to content

feat: 添加视频纹理支持及相关功能#104

Draft
BAKAOLC wants to merge 2 commits intoLegacy-LuaSTG-Engine:masterfrom
BAKAOLC:feat/video-texture
Draft

feat: 添加视频纹理支持及相关功能#104
BAKAOLC wants to merge 2 commits intoLegacy-LuaSTG-Engine:masterfrom
BAKAOLC:feat/video-texture

Conversation

@BAKAOLC
Copy link

@BAKAOLC BAKAOLC commented Feb 20, 2026

This pull request introduces video texture support to the engine, enabling videos to be loaded and controlled as textures in the resource system. The changes span the engine’s graphics layer, Lua bindings, and resource management, providing both API and implementation for video playback and control. The most important changes are grouped below.

Video Texture and Decoder Implementation

  • Added VideoTexture and VideoDecoder classes to support loading, decoding, and rendering video files as textures. This includes new interfaces (IVideoDecoder) and their Direct3D 11 implementations, as well as integration with the graphics device and resource management systems. ([[1]](https://github.com/Legacy-LuaSTG-Engine/LuaSTG-Sub/pull/104/files#diff-16e343118b82053e7ced8e4ee410d9b73fbc276e4fb19d162ddeaf689584170eR1-R42), [[2]](https://github.com/Legacy-LuaSTG-Engine/LuaSTG-Sub/pull/104/files#diff-e1badc69b766d21befbe45c2b9020930736b0213ac2e4dd8fcf1dd6c51025cd7R1-R75), [[3]](https://github.com/Legacy-LuaSTG-Engine/LuaSTG-Sub/pull/104/files#diff-d9cb4ef54e53706cc0fa10be3b9279f44d37b5fa82f4e00038ecc8dcc8a39824R1-R102), [[4]](https://github.com/Legacy-LuaSTG-Engine/LuaSTG-Sub/pull/104/files#diff-1244eb074ed9326f973c9555f4dd9c470f709a557386231968c73aed3638cd8fR1-R56))
  • Extended the graphics device interface (IGraphicsDevice) and its D3D11 implementation to create video textures and decoders, and linked Media Foundation libraries for video support. ([[1]](https://github.com/Legacy-LuaSTG-Engine/LuaSTG-Sub/pull/104/files#diff-95da1186b7f1f24c4b653b0c15936c4491f593dab2f9470095c5378031698c6dR112-R113), [[2]](https://github.com/Legacy-LuaSTG-Engine/LuaSTG-Sub/pull/104/files#diff-86a2dc86d16732adeefd8229ae04a2dd4f3aac20f5b6c95d085e415c3b52a063R25-R26), [[3]](https://github.com/Legacy-LuaSTG-Engine/LuaSTG-Sub/pull/104/files#diff-07a3cc0cabe5eb7e863ab4e58fc19a458e4b875afa052a04e7fde71168fa86f0R49-R52))

Resource Manager and Lua Binding Enhancements

  • Added LoadVideo method to the resource manager, allowing videos to be loaded into the texture pool and accessed like regular textures. ([[1]](https://github.com/Legacy-LuaSTG-Engine/LuaSTG-Sub/pull/104/files#diff-429333fc431e6fd0e9050dfe8a1f3f75df14fd869231ae68225f0fe8797bc3b3R101-R102), [[2]](https://github.com/Legacy-LuaSTG-Engine/LuaSTG-Sub/pull/104/files#diff-8f06d0eb6927fae3276efe114b66ca7f914edf8bbb207ede287d3e877a57cd18R230-R267))
  • Introduced Lua bindings for video loading and control, including functions for seeking, looping, updating, and querying video info. These are exposed to Lua scripts for flexible playback control. ([[1]](https://github.com/Legacy-LuaSTG-Engine/LuaSTG-Sub/pull/104/files#diff-6373efbbaad11d3f3ac701989256f4c61f08c5a58b79f1353f8006ccea5d1edbR57-R68), [[2]](https://github.com/Legacy-LuaSTG-Engine/LuaSTG-Sub/pull/104/files#diff-6373efbbaad11d3f3ac701989256f4c61f08c5a58b79f1353f8006ccea5d1edbR688-R767), [[3]](https://github.com/Legacy-LuaSTG-Engine/LuaSTG-Sub/pull/104/files#diff-6373efbbaad11d3f3ac701989256f4c61f08c5a58b79f1353f8006ccea5d1edbR800-R806), [[4]](https://github.com/Legacy-LuaSTG-Engine/LuaSTG-Sub/pull/104/files#diff-6373efbbaad11d3f3ac701989256f4c61f08c5a58b79f1353f8006ccea5d1edbR4-R5))

Example and Documentation

  • Added a Lua example (video_example.lua) demonstrating video playback, manual update with a stopwatch, and available control functions. This serves as documentation for the new video API. ([data/example/video_example.luaR1-R26](https://github.com/Legacy-LuaSTG-Engine/LuaSTG-Sub/pull/104/files#diff-3fdbc5e25a135b6d925d2e1bc7119b948b7a5ab0f18bfa01aa969a125f587e07R1-R26))

These changes collectively enable video playback as textures, with full control and integration into the engine’s resource and scripting systems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments