Skip to content

Commit

Permalink
Merge branch 'release/0.14.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
guillaumeblanc committed Sep 29, 2022
2 parents 7fd3642 + 0f91829 commit ed38a6a
Show file tree
Hide file tree
Showing 15 changed files with 88 additions and 43 deletions.
1 change: 1 addition & 0 deletions AUTHORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ The following authors have all licensed their contributions to ozz-animation und
- Kota Iguchi <[email protected]>
- Mikołaj Siedlarek <[email protected]>
- Paul Gruenbacher <[email protected]>
- Christophe Meyer <[email protected]>
14 changes: 14 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
Release version 0.14.1
----------------------

* Samples
- Allows reusing sample framework outside of sample directory.
- #154 Exposes swap interval

* Library
- #153 Fixes deprecated implicit copy warning.
- #141 Removes non-ASCII characters in source codes.

* Build pipeline
- Exposes ozz cmake configuration variables to PARENT_SCOPE, so it can be used/changed by an external project.

Release version 0.14.0
----------------------

Expand Down
15 changes: 13 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@ cmake_minimum_required (VERSION 3.3)
# Defines the project's name
project(ozz)

# Check if project is top level or a sub project
get_directory_property(is_sub_project PARENT_DIRECTORY)

# Current version
set(OZZ_VERSION_MAJOR 0)
set(OZZ_VERSION_MINOR 14)
set(OZZ_VERSION_PATCH 0)
set(OZZ_VERSION_PATCH 1)
set(OZZ_VERSION ${OZZ_VERSION_MAJOR}.${OZZ_VERSION_MINOR}.${OZZ_VERSION_PATCH})

# Add project build options
Expand All @@ -27,6 +30,9 @@ if(WIN32 AND BUILD_SHARED_LIBS AND NOT ozz_build_msvc_rt_dll)
message("Forcing ozz_build_msvc_rt_dll to ON as ozz is being built as dll (BUILD_SHARED_LIBS is ON).")
set(ozz_build_msvc_rt_dll ON)
endif()
if(is_sub_project)
set(ozz_build_msvc_rt_dll ${ozz_build_msvc_rt_dll} PARENT_SCOPE)
endif()

# Include ozz cmake parameters and scripts
include(CheckCXXCompilerFlag)
Expand Down Expand Up @@ -63,12 +69,18 @@ else()
# Disables fbx if tools are disabled
set(ozz_build_fbx OFF)
endif()
if(is_sub_project)
set(ozz_build_fbx ${ozz_build_fbx} PARENT_SCOPE)
endif()

# gltf
if(ozz_build_tools AND ozz_build_gltf)
else()
set(ozz_build_gltf OFF)
endif()
if(is_sub_project)
set(ozz_build_gltf ${ozz_build_gltf} PARENT_SCOPE)
endif()

# Enables unit tests.
if(ozz_build_tests)
Expand Down Expand Up @@ -115,7 +127,6 @@ if(ozz_build_tests AND NOT EMSCRIPTEN)
add_subdirectory(test)
endif()


install(FILES
${PROJECT_SOURCE_DIR}/CHANGES.md
${PROJECT_SOURCE_DIR}/LICENSE.md
Expand Down
2 changes: 1 addition & 1 deletion extern/gtest/fused-src/gtest/gtest.h
Original file line number Diff line number Diff line change
Expand Up @@ -7917,7 +7917,7 @@ namespace edit_distance {
// Returns the optimal edits to go from 'left' to 'right'.
// All edits cost the same, with replace having lower priority than
// add/remove.
// Simple implementation of the WagnerFischer algorithm.
// Simple implementation of the Wagner-Fischer algorithm.
// See http://en.wikipedia.org/wiki/Wagner-Fischer_algorithm
enum EditType { kMatch, kAdd, kRemove, kReplace };
GTEST_API_ std::vector<EditType> CalculateOptimalEdits(
Expand Down
3 changes: 3 additions & 0 deletions include/ozz/base/span.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ struct span {
// elements.
span(_Ty* _begin, size_t _size) : data_(_begin), size_(_size) {}

// Copy constructor.
span(const span& _other) = default;

// Copy operator.
void operator=(const span& _other) {
data_ = _other.data_;
Expand Down
Binary file removed samples/demo.zip
Binary file not shown.
4 changes: 4 additions & 0 deletions samples/framework/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ target_link_libraries(sample_framework
ozz_geometry
ozz_animation_offline
ozz_options)

target_include_directories(sample_framework PUBLIC
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/samples>
$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/samples>)

if(TARGET BUILD_DATA_SAMPLE)
add_dependencies(sample_framework BUILD_DATA_SAMPLE)
Expand Down
16 changes: 11 additions & 5 deletions samples/framework/application.cc
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ Application::Application()
time_(0.f),
last_idle_time_(0.),
show_help_(false),
vertical_sync_(true),
swap_interval_(1),
show_grid_(true),
show_axes_(true),
capture_video_(false),
Expand Down Expand Up @@ -209,7 +211,7 @@ int Application::Run(int _argc, const char** _argv, const char* _version,
#endif // EMSCRIPTEN

// Setup the window and installs callbacks.
glfwSwapInterval(1); // Enables vertical sync by default.
glfwSwapInterval(vertical_sync_ ? swap_interval_ : 0);
glfwSetWindowSizeCallback(&ResizeCbk);
glfwSetWindowCloseCallback(&CloseCbk);

Expand Down Expand Up @@ -611,10 +613,14 @@ bool Application::FrameworkGui() {
GL(Disable(GL_MULTISAMPLE));
}
}
// Vertical sync
static bool vertical_sync_ = true; // On by default.
if (im_gui->DoCheckBox("Vertical sync", &vertical_sync_, true)) {
glfwSwapInterval(vertical_sync_ ? 1 : 0);
// Vertical sync & swap interval
bool changed = im_gui->DoCheckBox("Vertical sync", &vertical_sync_);
char szLabel[64];
std::sprintf(szLabel, "Swap interval: %d", swap_interval_);
changed |=
im_gui->DoSlider(szLabel, 1, 4, &swap_interval_, 1.f, vertical_sync_);
if (changed) {
glfwSwapInterval(vertical_sync_ ? swap_interval_ : 0);
}

im_gui->DoCheckBox("Show grid", &show_grid_, true);
Expand Down
3 changes: 3 additions & 0 deletions samples/framework/application.h
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,9 @@ class Application {
// Set to true to display help.
bool show_help_;

bool vertical_sync_; // On by default.
int swap_interval_;

// Grid display settings.
bool show_grid_;
bool show_axes_;
Expand Down
27 changes: 26 additions & 1 deletion samples/framework/utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

#include "framework/imgui.h"
#include "framework/mesh.h"
#include "ozz/animation/offline/raw_animation.h"
#include "ozz/animation/offline/raw_skeleton.h"
#include "ozz/animation/runtime/animation.h"
#include "ozz/animation/runtime/local_to_model_job.h"
Expand Down Expand Up @@ -326,6 +327,30 @@ bool LoadAnimation(const char* _filename,
return true;
}

bool LoadRawAnimation(const char* _filename,
ozz::animation::offline::RawAnimation* _animation) {
assert(_filename && _animation);
ozz::log::Out() << "Loading raw animation archive: " << _filename << "."
<< std::endl;
ozz::io::File file(_filename, "rb");
if (!file.opened()) {
ozz::log::Err() << "Failed to open raw animation file " << _filename << "."
<< std::endl;
return false;
}
ozz::io::IArchive archive(&file);
if (!archive.TestTag<ozz::animation::offline::RawAnimation>()) {
ozz::log::Err() << "Failed to load raw animation instance from file "
<< _filename << "." << std::endl;
return false;
}

// Once the tag is validated, reading cannot fail.
archive >> *_animation;

return true;
}

namespace {
template <typename _Track>
bool LoadTrackImpl(const char* _filename, _Track* _track) {
Expand Down Expand Up @@ -411,7 +436,7 @@ bool LoadMeshes(const char* _filename,
}

namespace {
// MollerTrumbore intersection algorithm
// Moller-Trumbore intersection algorithm
// https://en.wikipedia.org/wiki/M%C3%B6ller%E2%80%93Trumbore_intersection_algorithm
bool RayIntersectsTriangle(const ozz::math::Float3& _ray_origin,
const ozz::math::Float3& _ray_direction,
Expand Down
8 changes: 8 additions & 0 deletions samples/framework/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,14 @@ bool LoadSkeleton(const char* _filename, ozz::animation::Skeleton* _skeleton);
bool LoadAnimation(const char* _filename,
ozz::animation::Animation* _animation);

// Loads a raw animation from an ozz archive file named _filename.
// This function will fail and return false if the file cannot be opened or if
// it is not a valid ozz animation archive. A valid animation archive can be
// produced with ozz tools (fbx2ozz) or using ozz animation serialization API.
// _filename and _animation must be non-nullptr.
bool LoadRawAnimation(const char* _filename,
ozz::animation::offline::RawAnimation* _animation);

// Loads a float track from an ozz archive file named _filename.
// This function will fail and return false if the file cannot be opened or if
// it is not a valid ozz float track archive. A valid float track archive can be
Expand Down
31 changes: 1 addition & 30 deletions samples/optimize/sample_optimize.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,35 +57,6 @@ OZZ_OPTIONS_DECLARE_STRING(skeleton, "Path to the runtime skeleton file.",
OZZ_OPTIONS_DECLARE_STRING(animation, "Path to the raw animation file.",
"media/animation_raw.ozz", false)

namespace {

// Loads a raw animation from a file.
bool LoadAnimation(const char* _filename,
ozz::animation::offline::RawAnimation* _animation) {
assert(_filename && _animation);
ozz::log::Out() << "Loading raw animation archive: " << _filename << "."
<< std::endl;
ozz::io::File file(_filename, "rb");
if (!file.opened()) {
ozz::log::Err() << "Failed to open animation file " << _filename << "."
<< std::endl;
return false;
}
ozz::io::IArchive archive(&file);
if (!archive.TestTag<ozz::animation::offline::RawAnimation>()) {
ozz::log::Err() << "Failed to load raw animation instance from file "
<< _filename << "." << std::endl;
return false;
}

// Once the tag is validated, reading cannot fail.
archive >> *_animation;

// Ensure animation is valid.
return _animation->Validate();
}
} // namespace

class OptimizeSampleApplication : public ozz::sample::Application {
public:
OptimizeSampleApplication()
Expand Down Expand Up @@ -285,7 +256,7 @@ class OptimizeSampleApplication : public ozz::sample::Application {

// Imports offline animation from a binary file.
// Invalid animations are rejected by the load function.
if (!LoadAnimation(OPTIONS_animation, &raw_animation_)) {
if (!ozz::sample::LoadRawAnimation(OPTIONS_animation, &raw_animation_)) {
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion src/animation/offline/decimate.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ namespace ozz {
namespace animation {
namespace offline {

// Decimation algorithm based on RamerDouglasPeucker.
// Decimation algorithm based on Ramer-Douglas-Peucker.
// https://en.wikipedia.org/wiki/Ramer%E2%80%93Douglas%E2%80%93Peucker_algorithm
// _Track must have std::vector interface.
// Adapter must have the following interface:
Expand Down
2 changes: 1 addition & 1 deletion src/animation/runtime/ik_two_bone_job.cc
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ bool SoftenTarget(const IKTwoBoneJob& _job, const IKConstantSetup& _setup,

// The maximum distance we can reach is the soften bone chain length: da
// (stored in !x). The minimum distance we can reach is the absolute value of
// the difference of the 2 bone lengths, |d1d2| (stored in z). x is 0 and z
// the difference of the 2 bone lengths, |d1-d2| (stored in z). x is 0 and z
// is 1, yw are untested.
return (comp_mask & 0x5) == 0x4;
}
Expand Down
3 changes: 1 addition & 2 deletions test/base/containers/intrusive_list_tests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -645,10 +645,9 @@ class is_to_be_removed {
public:
explicit is_to_be_removed(int _which) : which_(_which) {}
bool operator()(typename _List::const_reference) { return which_-- == 0; }
void operator=(const is_to_be_removed&) = delete;

private:
void operator=(const is_to_be_removed&);

int which_;
};

Expand Down

0 comments on commit ed38a6a

Please sign in to comment.