fudyou 发表于 2022-6-29 16:43:33

saba,专门用于操控MMD的文件,包括模型、动作数据等

Saba· MMD (PMD/PMX/VMD) play and load library· Viewer (MMD/OBJ) o saba_viewer· Example o simple_mmd_viewer_glfw (OpenGL 4.1)o simple_mmd_viewer_dx11 (DirectX 11)o simple_mmd_viewer_vulkan (Vulkan 1.0.65)o Transparent Window (GLFW 3.3.2 or higher, Windows)
Important Changescommit 7ba7020UV was flipped with this commit.Environment· Windows o Visual Studio 2019o Visual Studio 2017o Visual Studio 2015 Update 3· Linux· MacFile types· OBJ· PMD· PMX· VMD· VPD· x file (mmd extension)How to buildPlease install CMake before the build.Required librariesPlease prepare the following libraries.· OpenGL· Bullet Physics· GLFWmingwDo not use the msys/cmake. Pelase use the mingw64/mingw-w64-x86_64-cmake.https://gitlab.kitware.com/cmake/cmake/-/issues/21649Prepare the mingw64 environment as follows.pacman -S base-devel mingw-w64-x86_64-toolchainpacman -S mingw-w64-x86_64-cmakepacman -S mingw-w64-x86_64-ninjapacman -S mingw-w64-x86_64-mesa1. Setup Bullet PhysicsSetup Bullet Physics (on Windows)Build Bullet Physics as follows.cmake -G "Visual Studio 14 2015 Win64" ^    -D CMAKE_INSTALL_PREFIX=<Your Bullet Physics install directory> ^    -D INSTALL_LIBS=ON ^    -D USE_MSVC_RUNTIME_LIBRARY_DLL=On ^    -D BUILD_CPU_DEMOS=Off ^    -D BUILD_OPENGL3_DEMOS=Off ^    -D BUILD_BULLET2_DEMOS=Off ^    -D BUILD_UNIT_TESTS=Off ^    .. cmake --build . --config Debug --target ALL_BUILDcmake --build . --config Debug --target INSTALLcmake --build . --config Release --target ALL_BUILDcmake --build . --config Release --target INSTALLPlease change -G "Visual Studio 14 2015 Win64" according to your environment.Setup Bullet Physics (on Mac)brew install bulletSetup Bullet Physics (on Linux)Ubuntu:apt-get install libbullet-devArch linux:pacman -S bulletSetup Bullet Physics (on mingw)pacman -S mingw-w64-x86_64-bullet2. Setup GLFWSetup GLFW (on Windows)DownloadSetup GLFW (on Mac)brew install glfwSetup GLFW (on Linux)Ubuntu:apt-get install libglfw3-devArch linux:pacman -S glfwSetup GLFW (on mingw)pacman -S mingw-w64-x86_64-glfw3. Clone Sabagit clone https://github.com/benikabocha/saba.gitcd saba4. Run CMake and buildRun CMake and build (on Windows)mkdir buildcd buildcmake -G "Visual Studio 14 2015 Win64" ^    -D SABA_BULLET_ROOT=<Your Bullet Physics install directory> ^    -D SABA_GLFW_ROOT=<your GLFW install directory> ^    ..Open the created sln file in Visual Studio and build it."saba_viewer" project is the viewer application.Run CMake and build (on Mac/Linux)mkdir buildcd buildcmake ..make -j4./saba_viewerIf the operation is heavy, please try the following.cmake -DCMAKE_BUILD_TYPE=RELEASE ..make -j4Run CMake and build (on mingw)mkdir buildcd buildcmake ..ninja./saba_viewerInitial settingInitialize with the "init.json" or "init.lua" file placed in the current directory.Write "init.json" or "init.lua" file in UTF-8.1. Example "init.json"{    "MSAAEnable":        true,    "MSAACount":        8,    "Commands":[      {            "Cmd":"open",            "Args":["test.pmx"]      },      {            "Cmd":"open",            "Args":["test.vmd"]      }    ]}MSAAEnableEnable MSAA.MSAACountSet the number of MSAA samples.CommandsSet the commands to be executed at startup.2. Example "init.lua"MSAA = {    Enable= true,    Count    = 8} InitCamera = {    Center = {x = 0, y = 10, z = 0},    Eye = {x = 0, y = 10, z = 50},    NearClip = 1.0,    FarClip = 2000.0,    Radius = 100} InitScene = {    UnitScale = 10} Commands = {    {      Cmd   = "open",      Args    = {"test.pmx"},    },    {      Cmd   = "open",      Args    = {"test.vmd"},    },    {      Cmd   = "play"    },}MSAA.EnableEnable MSAA.MSAA.CountSet the number of MSAA samples.InitCamera.CenterSet camera center position at scene initialization.InitCamera.EyeSet camera eye position at scene initialization.InitCamera.NearClipSet camera near clip at scene initialization.InitCamera.FarClipSet camera far clip at scene initialization.InitCamera.RadiusSet camera zoom radius at scene initialization.InitScene.UnitScaleSet grid size at scene initialization.CommandsSet the commands to be executed at startup.Run ScriptYou can run the script.The command line argument is the "Args" variable.ModelIndex = 1print(Args[1]) Commands = {    {      Cmd   = "open",      Args    = {Models},    },    {      Cmd   = "open",      Args    = {"test.vmd"},    },    {      Cmd   = "play"    },}How to useDrag and drop files, or use the "open" command.file:///C:\Users\admin\AppData\Local\Temp\ksohtml9524\wps3.pngMMD1. Drag and drop model(PMD/PMX) file.2. Drag and drop motion(VMD) file.CameraDrag the mouse to move the camera.· Left Button (z + Left Button) : Rotate· Right Button (c + Left Button) : Zoom· Middle Button (x + Left Button) : TranslateCommandsopenopen <file path>Open the file.Supported file types.· OBJ· PMD· PMX· VMDThe model file will be selected when opened. The model name will be model_xxx(nnn is ID).selectselect <model name>Select a model.clearclear [-all]Clear a model.If invoked with no arguments, it clears the selected model.If -all is specified, all models will be cleared.playplayPlay the animation.stopstopStop the animation.translatetranslate x y zTranslate the selected model.rotaterotate x y zRotate the selected model.scalescale x y zScale the selected model.refreshCustomCommandrefreshCustomCommandRefresh the custom command.enableUIenableUI Switch the display of the UI.F1 key works the same way.clearAnimationclearAnimation [-all]Clear animation of selected model.clearSceneAnimationclearSceneAnimationClear animation of scene(eg camera).Custom commandYou can create custom commands using Lua.When "command.lua" is placed in the current directory and started up, the custom command written in Lua is loaded.Write "command.lua" with UTF - 8.For example, you can register a model or animation load as a macro.function OpenModel(files)    return function ()      ExecuteCommand("clear", "-all")      for i, filename in ipairs(files) do            ExecuteCommand("open", filename)      end    endendfunction OpenAnim(files, isPlay)    return function ()      ExecuteCommand("clearAnimation", "-all")      ExecuteCommand("clearSceneAnimation")      for i, filename in ipairs(files) do            ExecuteCommand("open", filename)      end      if isPlay then            ExecuteCommand("play")      end    endend-- Register Model Load CommandRegisterCommand("", OpenModel({"Model1_Path"}), "01_Model/Menu1")RegisterCommand("", OpenModel({"Model2_Path"}), "01_Model/Menu2")-- Register Animation Load Commandanims = {    "ModelAnim_Path",    "CameraAnim_Path",}RegisterCommand("", OpenAnim(anims, true), "02_Anim/Anim1")Here are functions that can be used in "command.lua".RegisterCommandRegisterCommand(commandName, commandFunc, menuName)-- Register command.-- commandName : Command name-- If it is empty, the command name is set automatically.銆?/span>-- commandFunc : Command function-- menuName : Menu name-- This is the name when registering a custom command in the menu.銆?/span>-- If it is empty it will not be added to the menu.-- '/' Separate the menu hierarchy.ExecuteCommandExecuteCommand(command, args)-- Execute the command.-- command : Execute the command.--- args : Arguments to pass to the command.--- It is a string or table.
项目官方网站:https://github.com/benikabocha/saba

页: [1]
查看完整版本: saba,专门用于操控MMD的文件,包括模型、动作数据等