Skip to content
This repository has been archived by the owner on Dec 29, 2022. It is now read-only.

Commit

Permalink
Merge internal branch into master
Browse files Browse the repository at this point in the history
  • Loading branch information
jsanmiya committed Feb 24, 2017
2 parents 2a5ffa1 + e312290 commit 43ebe3c
Show file tree
Hide file tree
Showing 94 changed files with 8,247 additions and 1,774 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
libs/
obj/
bin/flatc
bin/Release/flatc
bin/flathash
bin/benchmarker
bin/*_test
Expand Down Expand Up @@ -46,8 +47,10 @@ Win32/
pingme.txt

# XCode files
motive.build/
motive.xcodeproj/
tests/googletest/
src/tests/googletest/
src/tests/motive.build/
src/*/*.xcodeproj

# qt creator
Expand Down
75 changes: 21 additions & 54 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,42 +31,15 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${MOTIVE_BINARY_DIR})
# Temporary files (like object files) created while compiling projects.
set(tmp_dir ${CMAKE_CURRENT_BINARY_DIR}/obj)

# Directory which contains the source for 3rd party libraries.
if(NOT DEFINED third_party_root)
get_filename_component(
third_party_root "${CMAKE_CURRENT_SOURCE_DIR}/../../../../external"
ABSOLUTE)
endif()

# Directory which contains source for FPL libraries.
if(NOT DEFINED fpl_root)
get_filename_component(
fpl_root "${CMAKE_CURRENT_SOURCE_DIR}/../../libs" ABSOLUTE)
endif()

# If the dependencies directory exists, assume this is the root directory for
# all libraries required by this project.
if(NOT DEFINED dependencies_root)
set(dependencies_root "${CMAKE_CURRENT_SOURCE_DIR}/dependencies")
if(EXISTS "${dependencies_root}")
set(third_party_root "${dependencies_root}")
set(fpl_root "${dependencies_root}")
endif()
endif()

# Configurable locations of dependencies of this project.
set(dependencies_gtest_dir "${fpl_root}/googletest"
CACHE PATH "Directory containing the GoogleTest library.")
set(dependencies_flatbuffers_dir "${fpl_root}/flatbuffers"
CACHE PATH "Directory containing the Flatbuffers library.")
set(dependencies_fplutil_dir "${fpl_root}/fplutil"
CACHE PATH "Directory containing the fplutil library.")
set(dependencies_mathfu_dir "${fpl_root}/mathfu"
CACHE PATH "Directory containing the MathFu library.")
# Call fplutil to get locations of dependencies and set common build settings.
include("cmake/find_fplutil.cmake")
include("${fplutil_dir}/buildutil/cmake_common.txt")
set_common_build_variables()

# Option to enable / disable the test build.
option(motive_build_tests "Build tests for this project." ON)
option(motive_build_samples "Build samples for this project." ON)
option(motive_build_viewer "Build fplmesh and motiveanim file viewer." ON)

# Option to only build flatc
option(motive_only_flatc "Only build FlatBuffers compiler." OFF)
Expand All @@ -91,7 +64,7 @@ endif()
# Generate source files for all FlatBuffers schema files under the src
# directory.
set(MOTIVE_FLATBUFFERS_GENERATED_INCLUDES_DIR
${CMAKE_CURRENT_SOURCE_DIR}${CMAKE_FILES_DIRECTORY}/include)
${CMAKE_CURRENT_BINARY_DIR}/include)
file(GLOB_RECURSE FLATBUFFERS_SCHEMAS ${CMAKE_CURRENT_SOURCE_DIR}/schemas/*.fbs)

# Generate rules to build the set of output files from the set of input
Expand All @@ -115,9 +88,12 @@ set(motive_SRCS
include/motive/math/bulk_spline_evaluator.h
include/motive/math/compact_spline.h
include/motive/math/curve.h
include/motive/math/curve_util.h
include/motive/math/dual_cubic.h
include/motive/math/float.h
include/motive/math/range.h
include/motive/processor.h
include/motive/simple_processor_template.h
include/motive/target.h
include/motive/util.h
include/motive/version.h
Expand All @@ -127,15 +103,21 @@ set(motive_SRCS
src/motive/motivator.cpp
src/motive/init.cpp
src/motive/io/flatbuffers.cpp
src/motive/math/angle.cpp
src/motive/math/bulk_spline_evaluator.cpp
src/motive/math/compact_spline.cpp
src/motive/math/curve.cpp
src/motive/math/curve_util.cpp
src/motive/math/float.cpp
src/motive/math/dual_cubic.cpp
src/motive/processor.cpp
src/motive/processor/const_processor.cpp
src/motive/processor/ease_in_ease_out_processor.cpp
src/motive/processor/matrix_processor.cpp
src/motive/processor/overshoot_processor.cpp
src/motive/processor/rig_processor.cpp
src/motive/processor/spline_processor.cpp
src/motive/processor/spring_processor.cpp
src/motive/util/benchmark.cpp
src/motive/util/optimizations.cpp
src/motive/version.cpp)
Expand All @@ -150,27 +132,6 @@ include_directories(${dependencies_fplutil_dir}/libfplutil/include)
include_directories(${dependencies_mathfu_dir}/benchmarks)
include_directories(${dependencies_mathfu_dir}/include)

# Detect clang
if(CMAKE_CXX_COMPILER_ID MATCHES ".*Clang" OR
CMAKE_CXX_COMPILER_ID MATCHES ".*clang")
set(CMAKE_COMPILER_IS_CLANGXX 1)
endif()

# Compiler flags.
set(C_FLAGS_WARNINGS "")
if(MSVC)
set(C_FLAGS_WARNINGS "/W4 /WX /wd4065 /wd4355")
add_definitions(-DNOMINMAX)
elseif(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR
CMAKE_COMPILER_IS_CLANGXX)
add_definitions(-g)
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} -std=c++0x -Wall -pedantic -Werror -Wextra -Wno-unused-function")
# -Wno-unused-function is because of webp encode.h
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${C_FLAGS_WARNINGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${C_FLAGS_WARNINGS}")

if(motive_DEBUG)
# if we want to define this, it needs to be only in debug builds
add_definitions(-D_DEBUG)
Expand Down Expand Up @@ -211,3 +172,9 @@ endif()
if(motive_build_samples)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/src/samples)
endif()

# Viewer.
if(motive_build_viewer)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/src/viewer)
endif()

Binary file modified bin/Darwin/anim_pipeline
Binary file not shown.
Binary file added bin/Darwin/fplviewer
Binary file not shown.
Binary file modified bin/Linux/anim_pipeline
Binary file not shown.
Binary file added bin/Linux/fplviewer
Binary file not shown.
Binary file modified bin/Windows/Release/anim_pipeline.exe
100755 → 100644
Binary file not shown.
Binary file added bin/Windows/Release/fplviewer.exe
Binary file not shown.
41 changes: 41 additions & 0 deletions cmake/find_fplutil.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Find the fplutil directory and set it in `fplutil_dir`.
#
# We search some standard locations, such as
# (1) the cached variable ${dependencies_fplutil_dir}, which can be specified
# on the command line,
# cmake -Ddependencies_fplutil_dir=your_fplutil_directory
# (2) under ${fpl_root}, which is another cached variable that can be
# specified on the command line,
# cmake -Dfpl_root=your_fpl_root_directory
# (3) the "dependencies" directory that gets created when cloning from GitHub,
# (4) several levels up in the directory tree.
#
# Notes
# -----
# - fplutil is the project where we keep all our shared code, so the code in
# this file (which locates fplutil) can unfortunately not be shared.
# - Since this file is duplicated in all FPL projects (except fplutil itself),
# please copy new versions to all FPL projects whenever you make a change.

set(fplutil_dir_possibilities
"${dependencies_fplutil_dir}"
"${fpl_root}/fplutil"
"${CMAKE_CURRENT_SOURCE_DIR}/dependencies/fplutil"
"${CMAKE_CURRENT_LIST_DIR}/../../fplutil"
"${CMAKE_CURRENT_LIST_DIR}/../../../fplutil"
"${CMAKE_CURRENT_LIST_DIR}/../../../../fplutil"
"${CMAKE_CURRENT_LIST_DIR}/../../../../../fplutil")

foreach(dir ${fplutil_dir_possibilities})
if(EXISTS ${dir})
set(fplutil_dir ${dir})
return()
endif()
endforeach(dir)

# Define this cached variable so that cmake GUIs can expose it to the user.
set(dependencies_fplutil_dir ""
CACHE PATH "Directory containing the fplutil library.")

MESSAGE(ERROR
"Can't find fplutil directory. Try cmake -Ddependencies_fplutil_dir=your_location.")
14 changes: 8 additions & 6 deletions disttools/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,22 @@
},
"dependencies": [
{
"name": "fplutil",
"url": "http://github.com/google/fplutil.git",
"name": "fplbase",
"url": "http://github.com/google/fplbase.git",
"branch": "develop",
"is_library": 1,
"third_party": 0,
"push": 0
"push": 0,
"fetch_dependencies": 1
},
{
"name": "googletest",
"name": "fplutil",
"url": "http://github.com/google/fplutil.git",
"branch": "googletest",
"branch": "develop",
"is_library": 1,
"third_party": 0,
"push": 0
"push": 0,
"fetch_dependencies": 1
},
{
"name": "flatbuffers",
Expand Down
4 changes: 2 additions & 2 deletions docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,11 @@ appreciate if you would leave it in.
[FplUtil]: https://github.com/google/fplutil
[Linux]: http://en.m.wikipedia.org/wiki/Linux
[MathFu]: https://github.com/google/mathfu
[Motive Google Group]: http://group.google.com/group/motive-anim
[Motive Google Group]: http://groups.google.com/group/motive-anim
[Motive Issues Tracker]: http://github.com/google/motive/issues
[Motive]: @ref motive_overview
[OS X]: http://www.apple.com/osx/
[SIMD]: http://en.wikipedia.org/wiki/SIMD
[Windows]: http://windows.microsoft.com/
[stackoverflow.com]: http://www.stackoverflow.com
[stackoverflow.com]: http://stackoverflow.com/search?q=motive+animation
[vector]: http://en.wikipedia.org/wiki/Euclidean_vector
32 changes: 29 additions & 3 deletions include/motive/anim.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@ namespace motive {
class MatrixAnim {
public:
struct Spline {
motive::CompactSpline spline;
Spline() : spline(nullptr) {}
~Spline() {
CompactSpline::Destroy(spline);
spline = nullptr;
}
CompactSpline* spline;
SplineInit init;
};

Expand All @@ -43,7 +48,7 @@ class MatrixAnim {
// TODO: Revisit this layout to eliminate the internal pointers, making it
// more robust.
splines_.resize(num_splines);
return &splines_[0];
return splines_.data();
}

/// Return the op array. Non-const version is for construction.
Expand Down Expand Up @@ -101,6 +106,27 @@ class RigAnim {
/// Total number of matrix operations across all MatrixAnims in this RigAnim.
int NumOps() const;

/// Gets the splines and constants that drive the operations in `ops`,
/// for the specified bone. If an operation is not driven by the bone,
/// return the default value for that op in `constants`.
///
/// If the bone has multiple operations that match `ops[i]`, return the
/// first one.
///
/// @param bone The bone whose operations you want to pull data for.
/// @param ops And array of length `num_ops` with the operations you're
/// interested in.
/// @params num_ops Length of the `ops` array.
/// @params splines Output array, length `num_ops`. For each element of
/// `ops`, receives the driving spline, or nullptr if that
/// operation is not driven by a spline.
/// @params constants Output array, length `num_ops`. For each element of
/// `ops`, receives the constant value of that operation,
/// if no spline drives that operation.
void GetSplinesAndConstants(BoneIndex bone, const MatrixOperationType* ops,
int num_ops, const CompactSpline** splines,
float* constants) const;

/// For debugging. The number of lines in the header. You call them separately
/// in case you want to prefix or append extra columns.
int NumCsvHeaderLines() const { return 2; }
Expand All @@ -122,7 +148,7 @@ class RigAnim {
/// `bone_parents()[i]` is the bone index of the ith bone's parent.
/// `bone_parents()[i]` < `bone_parents()[j]` for all i < j.
/// For bones at the root (i.e. no parent) value is kInvalidBoneIdx.
const BoneIndex* bone_parents() const { return &bone_parents_[0]; }
const BoneIndex* bone_parents() const { return bone_parents_.data(); }

/// Animation is repeatable. That is, when the end of the animation is
/// reached, it can be started at the beginning again without glitching.
Expand Down
Loading

0 comments on commit 43ebe3c

Please sign in to comment.