mirror of
https://github.com/lighttransport/tinyusdz.git
synced 2026-01-18 01:11:17 +01:00
Fix android build.
This commit is contained in:
@@ -5,9 +5,11 @@ option(TINYUSDZ_USE_USDOBJ "Build with built-in .obj support" On)
|
||||
set(TINYUSDZ_SOURCES
|
||||
${PROJECT_SOURCE_DIR}/../../../../../src/tinyusdz.cc
|
||||
${PROJECT_SOURCE_DIR}/../../../../../src/prim-types.cc
|
||||
${PROJECT_SOURCE_DIR}/../../../../../src/usda-parser.cc
|
||||
${PROJECT_SOURCE_DIR}/../../../../../src/usdc-parser.cc
|
||||
${PROJECT_SOURCE_DIR}/../../../../../src/ascii-parser.cc
|
||||
${PROJECT_SOURCE_DIR}/../../../../../src/usda-reader.cc
|
||||
${PROJECT_SOURCE_DIR}/../../../../../src/usdc-reader.cc
|
||||
${PROJECT_SOURCE_DIR}/../../../../../src/usdc-writer.cc
|
||||
${PROJECT_SOURCE_DIR}/../../../../../src/crate-reader.cc
|
||||
${PROJECT_SOURCE_DIR}/../../../../../src/crate-format.cc
|
||||
${PROJECT_SOURCE_DIR}/../../../../../src/crate-pprint.cc
|
||||
${PROJECT_SOURCE_DIR}/../../../../../src/io-util.cc
|
||||
@@ -54,6 +56,7 @@ target_include_directories(
|
||||
hello-tinyusdz
|
||||
PRIVATE ${PROJECT_SOURCE_DIR}/../../../../../src/
|
||||
${PROJECT_SOURCE_DIR}/../../../../../src/external/ryu
|
||||
${PROJECT_SOURCE_DIR}/../../../../../src/external/fast_float/include
|
||||
# nanort, nanosg, etc
|
||||
${PROJECT_SOURCE_DIR}/../../../../../examples/common/
|
||||
# sdlviewer example
|
||||
|
||||
@@ -123,7 +123,7 @@ Java_com_example_hellotinyusdz_MainActivity_touchMove(JNIEnv *env, jobject obj,
|
||||
tinyusdz::USDLoadOptions options;
|
||||
|
||||
// load from Android asset folder
|
||||
example::g_gui_ctx.scene = tinyusdz::Scene(); // reset
|
||||
example::g_gui_ctx.scene = tinyusdz::HighLevelScene(); // reset
|
||||
|
||||
std::string warn, err;
|
||||
bool ret = LoadUSDCFromFile(filename, &example::g_gui_ctx.scene, &warn, &err, options);
|
||||
@@ -139,7 +139,8 @@ Java_com_example_hellotinyusdz_MainActivity_touchMove(JNIEnv *env, jobject obj,
|
||||
}
|
||||
|
||||
if (ret) {
|
||||
__android_log_print(ANDROID_LOG_INFO, "tinyusdz", "USD loaded. #of geom_meshes: %d", int(example::g_gui_ctx.scene.geom_meshes.size()));
|
||||
// TODO
|
||||
//__android_log_print(ANDROID_LOG_INFO, "tinyusdz", "USD loaded. #of geom_meshes: %d", int(example::g_gui_ctx.scene.geom_meshes.size()));
|
||||
}
|
||||
|
||||
ret = example::SetupScene(example::g_gui_ctx);
|
||||
@@ -149,6 +150,8 @@ Java_com_example_hellotinyusdz_MainActivity_touchMove(JNIEnv *env, jobject obj,
|
||||
}
|
||||
|
||||
|
||||
return int(example::g_gui_ctx.scene.geom_meshes.size()); // OK
|
||||
// TODO
|
||||
//return int(example::g_gui_ctx.scene.geom_meshes.size()); // OK
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ inline uint8_t ftouc(float f) {
|
||||
bool SetupScene(GUIContext &ctx) {
|
||||
|
||||
__android_log_print(ANDROID_LOG_INFO, "tinyusdz", "SetupScene");
|
||||
if (ctx.scene.geom_meshes.empty()) {
|
||||
if (ctx.scene.root_nodes.empty()) {
|
||||
__android_log_print(ANDROID_LOG_ERROR, "tinyusdz", "No GeomMesh");
|
||||
// No GeomMesh in the scene
|
||||
return false;
|
||||
@@ -65,11 +65,13 @@ bool SetupScene(GUIContext &ctx) {
|
||||
|
||||
// Convert USD geom_mesh to renderable mesh.
|
||||
ctx.render_scene.draw_meshes.clear();
|
||||
#if 0 // TODO
|
||||
__android_log_print(ANDROID_LOG_INFO, "tinyusdz", "# of geom_meshes %d", (int)ctx.scene.geom_meshes.size());
|
||||
for (size_t i = 0; i < ctx.scene.geom_meshes.size(); i++) {
|
||||
example::DrawGeomMesh draw_mesh(&ctx.scene.geom_meshes[i]);
|
||||
ctx.render_scene.draw_meshes.push_back(draw_mesh);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Setup render mesh
|
||||
if (!ctx.render_scene.Setup()) {
|
||||
|
||||
@@ -55,7 +55,7 @@ struct GUIContext {
|
||||
int render_height = 512;
|
||||
|
||||
// scene reload
|
||||
tinyusdz::Scene scene;
|
||||
tinyusdz::HighLevelScene scene;
|
||||
std::atomic<bool> request_reload{false};
|
||||
std::string filename;
|
||||
|
||||
|
||||
@@ -100,7 +100,8 @@ bool ConvertToRenderMesh(const tinyusdz::GeomSphere& sphere,
|
||||
if (sphere.radius.IsTimeSampled()) {
|
||||
// TODO
|
||||
} else {
|
||||
radius = sphere.radius.Get();
|
||||
// TODO
|
||||
//radius = sphere.radius.Get();
|
||||
}
|
||||
|
||||
// scale by radius
|
||||
|
||||
@@ -927,7 +927,8 @@ template <typename T>
|
||||
struct Animatable {
|
||||
T value; // scalar
|
||||
|
||||
std::set<TypedTimeSamples<T>> ranges;
|
||||
// TODO: sort by timeframe
|
||||
std::vector<TypedTimeSamples<T>> ranges;
|
||||
|
||||
bool IsTimeSampled() const {
|
||||
if (ranges.size()) {
|
||||
|
||||
Reference in New Issue
Block a user