Skip to content

Commit d0e3305

Browse files
committed
Merge branch 'master' of github.com:openframeworks/openFrameworks
2 parents 3384944 + 10a6ac1 commit d0e3305

File tree

135 files changed

+10601
-218
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

135 files changed

+10601
-218
lines changed

.github/workflows/build-macos.yml

Lines changed: 51 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -30,59 +30,58 @@ jobs:
3030
OPT: ${{matrix.cfg.opt}}
3131
steps:
3232
- uses: actions/checkout@v4
33-
- name: Cache compile
34-
id: cache-compile
35-
uses: actions/cache@v3
36-
env:
37-
cache-name: cache-keep-compile
38-
with:
39-
path: |
40-
libs/openFrameworksCompiled/lib/osx/**/
41-
addons/obj/osx/**/
42-
43-
# key: ${{ runner.os }}-${{matrix.cfg.opt}}-${{ env.cache-name }}-${{ hashFiles('**/*.cpp') }}
44-
key: ${{ runner.os }}-${{matrix.cfg.opt}}-${{ env.cache-name }}-
45-
restore-keys: |
46-
${{ runner.os }}-${{matrix.cfg.opt}}-${{ env.cache-name }}-
47-
33+
# - name: Cache compile
34+
# id: cache-compile
35+
# uses: actions/cache@v3
36+
# env:
37+
# cache-name: cache-keep-compile
38+
# with:
39+
# path: |
40+
# libs/openFrameworksCompiled/lib/osx/**/
41+
# addons/obj/osx/**/
42+
#
43+
# # key: ${{ runner.os }}-${{matrix.cfg.opt}}-${{ env.cache-name }}-${{ hashFiles('**/*.cpp') }}
44+
# key: ${{ runner.os }}-${{matrix.cfg.opt}}-${{ env.cache-name }}-
45+
# restore-keys: |
46+
# ${{ runner.os }}-${{matrix.cfg.opt}}-${{ env.cache-name }}-
4847

49-
- name: Cache libs
50-
id: cache-libs
51-
uses: actions/cache@v3
52-
env:
53-
cache-name: cache-install-libs
54-
with:
55-
path: |
56-
libs/boost/**
57-
libs/cairo/**
58-
libs/curl/**
59-
libs/fmod/**
60-
libs/FreeImage/**
61-
libs/freetype/**
62-
libs/glew/**
63-
libs/glfw/**
64-
libs/glm/**
65-
libs/json/**
66-
libs/pugixml/**
67-
libs/rtAudio/**
68-
libs/tess2/**
69-
libs/uriparser/**
70-
libs/utf8/**
71-
addons/ofxAssimpModelLoader/libs/**/
72-
addons/ofxKinect/libs/**/
73-
addons/ofxOpenCv/libs/**/
74-
addons/ofxSvg/libs/**/
75-
addons/ofxPoco/libs/**/
76-
77-
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('scripts/apothecary/apothecary/formulas/**/*.sh') }}
78-
restore-keys: |
79-
${{ runner.os }}-build-${{ env.cache-name }}-
80-
- if: ${{ steps.cache-libs.outputs.cache-hit != 'true' }}
81-
# name: Download libs
48+
# - name: Cache libs
49+
# id: cache-libs
50+
# uses: actions/cache@v3
51+
# env:
52+
# cache-name: cache-install-libs
53+
# with:
54+
# path: |
55+
# libs/boost/**
56+
# libs/cairo/**
57+
# libs/curl/**
58+
# libs/fmod/**
59+
# libs/FreeImage/**
60+
# libs/freetype/**
61+
# libs/glew/**
62+
# libs/glfw/**
63+
# libs/glm/**
64+
# libs/json/**
65+
# libs/pugixml/**
66+
# libs/rtAudio/**
67+
# libs/tess2/**
68+
# libs/uriparser/**
69+
# libs/utf8/**
70+
# addons/ofxAssimpModelLoader/libs/**/
71+
# addons/ofxKinect/libs/**/
72+
# addons/ofxOpenCv/libs/**/
73+
# addons/ofxSvg/libs/**/
74+
# addons/ofxPoco/libs/**/
75+
#
76+
# key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('scripts/apothecary/apothecary/formulas/**/*.sh') }}
77+
# restore-keys: |
78+
# ${{ runner.os }}-build-${{ env.cache-name }}-
79+
# - if: ${{ steps.cache-libs.outputs.cache-hit != 'true' }}
80+
- name: Download libs
8281
# continue-on-error: true
8382
run: ./scripts/$TARGET/download_libs.sh
84-
- name: rm-dev
85-
run: sudo rm -rf /Library/Developer
83+
# - name: rm-dev
84+
# run: sudo rm -rf /Library/Developer
8685

8786
# this step is not needed here because the script is empty
8887
# - name: install
@@ -96,6 +95,5 @@ jobs:
9695
scripts/ci/$TARGET/run_tests.sh;
9796
fi
9897
env:
99-
DEVELOPER_DIR: "/Applications/Xcode_13.4.1.app/Contents/Developer"
100-
SDKROOT: "/Applications/Xcode_13.4.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk"
101-
98+
DEVELOPER_DIR: "/Applications/Xcode.app/Contents/Developer"
99+
SDKROOT: "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk"

addons/ofxAssimp/addon_config.mk

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
# All variables and this file are optional, if they are not present the PG and the
2+
# makefiles will try to parse the correct values from the file system.
3+
#
4+
# Variables that specify exclusions can use % as a wildcard to specify that anything in
5+
# that position will match. A partial path can also be specified to, for example, exclude
6+
# a whole folder from the parsed paths from the file system
7+
#
8+
# Variables can be specified using = or +=
9+
# = will clear the contents of that variable both specified from the file or the ones parsed
10+
# from the file system
11+
# += will add the values to the previous ones in the file or the ones parsed from the file
12+
# system
13+
#
14+
# The PG can be used to detect errors in this file, just create a new project with this addon
15+
# and the PG will write to the console the kind of error and in which line it is
16+
17+
meta:
18+
ADDON_NAME = ofxAssimp
19+
ADDON_DESCRIPTION = Addon for loading several 3d formats through the assimp library
20+
ADDON_AUTHOR = OF Team
21+
ADDON_TAGS = "3D" "assimp"
22+
ADDON_URL = http://github.com/openframeworks/openFrameworks
23+
24+
common:
25+
# dependencies with other addons, a list of them separated by spaces
26+
# or use += in several lines
27+
# ADDON_DEPENDENCIES =
28+
29+
# include search paths, this will be usually parsed from the file system
30+
# but if the addon or addon libraries need special search paths they can be
31+
# specified here separated by spaces or one per line using +=
32+
ADDON_INCLUDES+=../ofxAssimpModelLoader/libs/assimp/include/
33+
34+
# any special flag that should be passed to the compiler when using this
35+
# addon
36+
# ADDON_CFLAGS =
37+
38+
# any special flag that should be passed to the linker when using this
39+
# addon, also used for system libraries with -lname
40+
# ADDON_LDFLAGS =
41+
42+
# linux only, any library that should be included in the project using
43+
# pkg-config
44+
# ADDON_PKG_CONFIG_LIBRARIES =
45+
46+
# osx/iOS only, any framework that should be included in the project
47+
# ADDON_FRAMEWORKS =
48+
49+
# source files, these will be usually parsed from the file system looking
50+
# in the src folders in libs and the root of the addon. if your addon needs
51+
# to include files in different places or a different set of files per platform
52+
# they can be specified here
53+
# ADDON_SOURCES =
54+
55+
# some addons need resources to be copied to the bin/data folder of the project
56+
# specify here any files that need to be copied, you can use wildcards like * and ?
57+
# ADDON_DATA =
58+
59+
# when parsing the file system looking for libraries exclude this for all or
60+
# a specific platform
61+
# ADDON_LIBS_EXCLUDE =
62+
63+
linuxarmv6l:
64+
ADDON_PKG_CONFIG_LIBRARIES = assimp
65+
ADDON_LIBS_EXCLUDE = ../ofxAssimpModelLoader/libs/assimp
66+
ADDON_INCLUDES_EXCLUDE = ../ofxAssimpModelLoader/libs/assimp/%
67+
68+
linuxarmv7l:
69+
ADDON_PKG_CONFIG_LIBRARIES = assimp
70+
ADDON_LIBS_EXCLUDE = ../ofxAssimpModelLoader/libs/assimp
71+
ADDON_INCLUDES_EXCLUDE = ../ofxAssimpModelLoader/libs/assimp/%
72+
73+
linuxaarch64:
74+
ADDON_PKG_CONFIG_LIBRARIES = assimp
75+
ADDON_LIBS_EXCLUDE = ../ofxAssimpModelLoader/libs/assimp
76+
ADDON_INCLUDES_EXCLUDE = ../ofxAssimpModelLoader/libs/assimp/%
77+
78+
linux:
79+
ADDON_PKG_CONFIG_LIBRARIES = assimp
80+
ADDON_LIBS_EXCLUDE = ../ofxAssimpModelLoader/libs/assimp
81+
ADDON_INCLUDES_EXCLUDE = ../ofxAssimpModelLoader/libs/assimp/%
82+
83+
linux64:
84+
ADDON_PKG_CONFIG_LIBRARIES = assimp
85+
ADDON_LIBS_EXCLUDE = ../ofxAssimpModelLoader/libs/assimp
86+
ADDON_INCLUDES_EXCLUDE = ../ofxAssimpModelLoader/libs/assimp/%
87+
88+
msys2:
89+
ADDON_PKG_CONFIG_LIBRARIES = assimp
90+
ADDON_LIBS_EXCLUDE = ../ofxAssimpModelLoader/libs/assimp
91+
ADDON_INCLUDES_EXCLUDE = ../ofxAssimpModelLoader/libs/assimp/%
92+
93+
android/armeabi-v7a:
94+
ADDON_LIBS=
95+
ADDON_LIBS+=../ofxAssimpModelLoader/libs/assimp/lib/android/armeabi-v7a/libassimp.a
96+
ADDON_LIBS+=../ofxAssimpModelLoader/libs/assimp/lib/android/armeabi-v7a/libIrrXML.a
97+
98+
android/x86:
99+
ADDON_LIBS=
100+
ADDON_LIBS+=../ofxAssimpModelLoader/libs/assimp/lib/android/x86/libassimp.a
101+
ADDON_LIBS+=../ofxAssimpModelLoader/libs/assimp/lib/android/x86/libIrrXML.a
102+
103+
ios:
104+
ADDON_LIBS=
105+
ADDON_LIBS=../ofxAssimpModelLoader/libs/assimp/lib/ios/assimp.a
106+
107+
osx:
108+
ADDON_LIBS=
109+
ADDON_LIBS=../ofxAssimpModelLoader/libs/assimp/lib/osx/assimp.a
110+
111+
emscripten:
112+
ADDON_LIBS=
113+
ADDON_LIBS=../ofxAssimpModelLoader/libs/assimp/lib/emscripten/libassimp.a
Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
//
2+
// ofxAssimpSrcAnimKeyCollection.cpp
3+
// Created by Nick Hardeman on 11/1/23.
4+
//
5+
6+
#include "ofxAssimpSrcAnimKeyCollection.h"
7+
#include "ofxAssimpUtils.h"
8+
9+
using namespace ofx::assimp;
10+
11+
//--------------------------------------------------------------
12+
void SrcAnimKeyCollection::setup( aiNodeAnim* aNodeAnim, float aDurationInTicks ) {
13+
mNodeAnim = aNodeAnim;
14+
mDurationInTicks = aDurationInTicks;
15+
}
16+
17+
//--------------------------------------------------------------
18+
bool SrcAnimKeyCollection::hasKeys() {
19+
return mNodeAnim != nullptr;
20+
}
21+
22+
23+
//--------------------------------------------------------------
24+
glm::vec3 SrcAnimKeyCollection::getVec3ForTime( const float& atime, const std::vector<ofx::assimp::AnimVectorKey>& akeys ) {
25+
size_t numKeys = akeys.size();
26+
for( size_t i = 0; i < numKeys; i++ ) {
27+
if( akeys[i].time == atime ) {
28+
return akeys[i].value;
29+
} else if( akeys[i].time > atime ) {
30+
if( i > 0 ) {
31+
float keyDiff = akeys[i].time - akeys[i-1].time;
32+
return glm::mix( akeys[i-1].value, akeys[i].value, (atime-akeys[i-1].time) / keyDiff );
33+
} else {
34+
return akeys[i].value;
35+
}
36+
}
37+
}
38+
if( numKeys > 1 ) {
39+
return akeys.back().value;
40+
}
41+
return glm::vec3(0.f, 0.f, 0.f);
42+
}
43+
44+
//--------------------------------------------------------------
45+
glm::vec3 SrcAnimKeyCollection::getPosition( const float& atime ) {
46+
auto rpos = glm::vec3(0.f, 0.f, 0.f);
47+
if( positionKeys.size() < 1 ) {
48+
49+
} else if( positionKeys.size() == 1 ) {
50+
rpos = positionKeys[0].value;
51+
} else {
52+
rpos = getVec3ForTime( atime, positionKeys );
53+
}
54+
return rpos;
55+
}
56+
57+
//--------------------------------------------------------------
58+
glm::vec3 SrcAnimKeyCollection::getScale( const float& atime ) {
59+
auto rscale = glm::vec3(1.f, 1.f, 1.f);
60+
if( scaleKeys.size() < 1 ) {
61+
62+
} else if(scaleKeys.size() == 1 ) {
63+
rscale = scaleKeys[0].value;
64+
} else {
65+
rscale = getVec3ForTime( atime, scaleKeys );
66+
}
67+
return rscale;
68+
}
69+
70+
//--------------------------------------------------------------
71+
glm::quat SrcAnimKeyCollection::getRotation( const float& atime ) {
72+
size_t numKeys = rotationKeys.size();
73+
auto rq = glm::quat(1.f, 0.f, 0.f, 0.f);
74+
if(numKeys < 2) {
75+
if( numKeys == 1 ) {
76+
return rotationKeys[0].value;
77+
} else {
78+
return rq;
79+
}
80+
} else {
81+
for( size_t i = 0; i < numKeys; i++ ) {
82+
if( rotationKeys[i].time == atime ) {
83+
return rotationKeys[i].value;
84+
} else if( rotationKeys[i].time > atime ) {
85+
if( i > 0 ) {
86+
float keyDiff = rotationKeys[i].time - rotationKeys[i-1].time;
87+
return glm::slerp( rotationKeys[i-1].value, rotationKeys[i].value, ((atime-rotationKeys[i-1].time) / keyDiff) );
88+
} else {
89+
return rotationKeys[i].value;
90+
}
91+
}
92+
}
93+
}
94+
if( numKeys > 1 ) {
95+
return rotationKeys.back().value;
96+
}
97+
return rq;
98+
}
99+
100+
//--------------------------------------------------------------
101+
std::vector<AnimVectorKey> SrcAnimKeyCollection::getAnimVectorKeysForTime(const float& aStartTime, const float& aEndTime, unsigned int aNumKeys, aiVectorKey* aAiKeys) {
102+
103+
std::vector<AnimVectorKey> rkeys;
104+
if( aNumKeys < 1 ) {
105+
return rkeys;
106+
}
107+
108+
if(aNumKeys == 1) {
109+
AnimVectorKey vkey;
110+
vkey.time = aStartTime;
111+
vkey.value = aiVecToOfVec(aAiKeys[0].mValue);
112+
vkey.valueAi = aAiKeys[0].mValue;
113+
rkeys.push_back( vkey );
114+
return rkeys;
115+
}
116+
117+
double currTime = aStartTime;
118+
for( unsigned int i = 0; i < aNumKeys; i++ ) {
119+
auto& key1 = aAiKeys[i];
120+
auto v1 = aiVecToOfVec(key1.mValue);
121+
AnimVectorKey vkey;
122+
vkey.time = key1.mTime;
123+
vkey.value = v1;
124+
vkey.valueAi = key1.mValue;
125+
rkeys.push_back( vkey );
126+
}
127+
128+
return rkeys;
129+
}
130+
131+
//--------------------------------------------------------------
132+
std::vector<AnimRotationKey> SrcAnimKeyCollection::getAnimRotationKeysForTime(const float& aStartTime, const float& aEndTime, unsigned int aNumKeys, aiQuatKey* aAiKeys) {
133+
134+
std::vector<AnimRotationKey> rkeys;
135+
if( aNumKeys < 1 ) {
136+
return rkeys;
137+
}
138+
if(aNumKeys == 1) {
139+
AnimRotationKey vkey;
140+
vkey.time = aStartTime;
141+
vkey.value = aiQuatToOfQuat(aAiKeys[0].mValue);
142+
vkey.valueAi = aAiKeys[0].mValue;
143+
rkeys.push_back( vkey );
144+
return rkeys;
145+
}
146+
double currTime = aStartTime;
147+
for( unsigned int i = 0; i < aNumKeys; i++ ) {
148+
auto& key1 = aAiKeys[i];
149+
auto v1 = aiQuatToOfQuat(key1.mValue);
150+
AnimRotationKey vkey;
151+
vkey.time = key1.mTime;
152+
vkey.value = v1;
153+
vkey.valueAi = key1.mValue;
154+
rkeys.push_back( vkey );
155+
}
156+
157+
return rkeys;
158+
}

0 commit comments

Comments
 (0)