Add --list option, macOS no-Homebrew build docs, case-insensitive texture test
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
1 parent
d4c34f8908
commit
19a400b17c
3 files changed
+40
-3
No files matched your search
@@ -41,6 +41,35 @@ cmake --build build
|
||||
./build/model_renderer path/to/model.pmx
|
||||
```
|
||||
|
||||
#### macOS without Homebrew (e.g. macOS 12 and older)
|
||||
|
||||
Homebrew no longer supports older macOS releases. Everything can be built in a user directory without admin rights:
|
||||
|
||||
```sh
|
||||
xcode-select --install
|
||||
mkdir -p ~/Dev/mr-deps && cd ~/Dev/mr-deps
|
||||
curl -fLO https://github.com/Kitware/CMake/releases/download/v3.31.6/cmake-3.31.6-macos-universal.tar.gz
|
||||
tar xzf cmake-3.31.6-macos-universal.tar.gz
|
||||
curl -fLO https://github.com/ninja-build/ninja/releases/download/v1.12.1/ninja-mac.zip
|
||||
unzip ninja-mac.zip -d bin
|
||||
export PATH=$PWD/cmake-3.31.6-macos-universal/CMake.app/Contents/bin:$PWD/bin:$PATH
|
||||
|
||||
curl -fL -o osg.tar.gz https://github.com/openscenegraph/OpenSceneGraph/archive/refs/tags/OpenSceneGraph-3.6.5.tar.gz
|
||||
tar xzf osg.tar.gz
|
||||
cmake -S OpenSceneGraph-OpenSceneGraph-3.6.5 -B osg-build -G Ninja -DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_INSTALL_PREFIX=$PWD/osg-install -DCMAKE_INSTALL_NAME_DIR=$PWD/osg-install/lib \
|
||||
-DBUILD_OSG_APPLICATIONS=OFF -DBUILD_OSG_EXAMPLES=OFF -DCMAKE_POLICY_VERSION_MINIMUM=3.5
|
||||
cmake --build osg-build && cmake --install osg-build
|
||||
|
||||
cd path/to/3d-model-renderer
|
||||
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_PREFIX_PATH=$HOME/Dev/mr-deps/osg-install -DMR_FETCH_ASSIMP=ON
|
||||
cmake --build build
|
||||
```
|
||||
|
||||
`CMAKE_INSTALL_NAME_DIR` matters: without it the OSG libraries are installed with bare names and the renderer fails at
|
||||
startup with `Library not loaded: libosgDB.161.dylib`.
|
||||
|
||||
### Linux (Debian / Ubuntu)
|
||||
|
||||
```sh
|
||||
|
||||
+9
-2
@@ -32,7 +32,8 @@ void printUsage() {
|
||||
" --hide-ui hide the ImGui overlay\n"
|
||||
" --ui-scale S scale the UI (e.g. 2 on high-DPI screens)\n"
|
||||
" --screenshot FILE render, save a PNG and exit\n"
|
||||
" --frames N frames to render before the screenshot (default 5)\n";
|
||||
" --frames N frames to render before the screenshot (default 5)\n"
|
||||
" --list print bone and morph names after loading\n";
|
||||
}
|
||||
|
||||
std::vector<float> parseFloats(const std::string& s) {
|
||||
@@ -50,7 +51,7 @@ int main(int argc, char** argv) {
|
||||
std::vector<std::pair<std::string, std::string>> morphArgs, boneArgs;
|
||||
int width = 1280, height = 800, frames = 5;
|
||||
float azimuth = 0.f, elevation = 0.f, uiScale = 1.f;
|
||||
bool skeleton = false, hideUi = false;
|
||||
bool skeleton = false, hideUi = false, listNames = false;
|
||||
|
||||
for (int i = 1; i < argc; ++i) {
|
||||
std::string a = argv[i];
|
||||
@@ -87,6 +88,8 @@ int main(int argc, char** argv) {
|
||||
uiScale = std::strtof(next().c_str(), nullptr);
|
||||
} else if (a == "--screenshot") {
|
||||
screenshot = next();
|
||||
} else if (a == "--list") {
|
||||
listNames = true;
|
||||
} else if (a == "--frames") {
|
||||
frames = std::max(1, std::atoi(next().c_str()));
|
||||
} else if (!a.empty() && a[0] != '-') {
|
||||
@@ -118,6 +121,10 @@ int main(int argc, char** argv) {
|
||||
<< model.indices.size() / 3 << " triangles, " << model.materials.size() << " materials, "
|
||||
<< model.bones.size() << " bones, " << model.morphs.size() << " morphs\n";
|
||||
for (const auto& w : model.warnings) std::cout << " warning: " << w << "\n";
|
||||
if (listNames) {
|
||||
for (const auto& b : model.bones) std::cout << " bone: " << b.name << "\n";
|
||||
for (const auto& m : model.morphs) std::cout << " morph: '" << m.name << "'\n";
|
||||
}
|
||||
for (const auto& [name, value] : morphArgs) {
|
||||
int idx = model.findMorph(name);
|
||||
if (idx < 0) std::cerr << "No morph named " << name << "\n";
|
||||
|
||||
+2
-1
@@ -1,5 +1,6 @@
|
||||
// Loader and posing tests. Test models are generated by tools/make_test_models.py.
|
||||
#include "model/ModelLoader.h"
|
||||
#include "model/PathUtil.h"
|
||||
#include "model/Poser.h"
|
||||
|
||||
#include <cmath>
|
||||
@@ -42,7 +43,7 @@ void testPmx() {
|
||||
CHECK(near(model->vertices[16].position, osg::Vec3f(1, 10, 1)));
|
||||
CHECK(near(model->vertices[0].uv.y(), 1.0f)); // v flipped to OpenGL convention
|
||||
CHECK(model->indices[0] == 0 && model->indices[1] == 4 && model->indices[2] == 1);
|
||||
CHECK(model->textures.size() == 1 && model->textures[0].path.find("checker.png") != std::string::npos);
|
||||
CHECK(model->textures.size() == 1 && mr::toLowerAscii(model->textures[0].path).find("checker.png") != std::string::npos);
|
||||
CHECK(model->warnings.empty());
|
||||
CHECK(model->materials.size() == 1 && model->materials[0].sharedToon == 0 && model->materials[0].drawEdge);
|
||||
CHECK(model->bones.size() == 4);
|
||||
|
||||
Reference in new issue
Block a user