Skip to content

Commit

Permalink
Merge branch 'master' into obj-c-arc
Browse files Browse the repository at this point in the history
  • Loading branch information
2bbb authored Mar 11, 2022
2 parents 0908c4b + fab4482 commit cbef3f2
Show file tree
Hide file tree
Showing 55 changed files with 231 additions and 145 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-msys2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: windows-latest
strategy:
matrix:
mingw: [MINGW64,MINGW32]
mingw: [MINGW64, MINGW32]
defaults:
run:
shell: msys2 {0}
Expand Down
2 changes: 1 addition & 1 deletion INSTALL_FROM_GITHUB.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ If you are a developer, or if you want to submit a pull request, [read this firs
Let's start by cloning the last `master` branch of openFrameworks and its submodules.

```bash
git clone --recursive git@github.com:openframeworks/openFrameworks.git
git clone --recursive git@github.com:openframeworks/openFrameworks.git --depth 1
```

_Before continuing make sure your new openFrameworks path **has no spaces**. Many of the shell scripts below will fail on paths that include spaces._
Expand Down
4 changes: 3 additions & 1 deletion addons/ofxOsc/addon_config.mk
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ common:
# when parsing the file system looking for sources exclude this for all or
# a specific platform
ADDON_SOURCES_EXCLUDE = libs/oscpack/src/ip/win32/%

ADDON_INCLUDES_EXCLUDE = libs/oscpack/src/ip/win32
# when parsing the file system looking for include paths exclude this for all or
# a specific platform
# ADDON_INCLUDES_EXCLUDE =
Expand All @@ -78,3 +78,5 @@ vs:
# a specific platform
ADDON_SOURCES_EXCLUDE = libs/oscpack/src/ip/posix/%
ADDON_DEFINES = OSC_HOST_LITTLE_ENDIAN


4 changes: 4 additions & 0 deletions addons/ofxPoco/src/ofxXmlPoco.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

#include <numeric>

#define byte _priv_byte

#include <Poco/DOM/Document.h>
#include <Poco/DOM/DocumentFragment.h>
#include <Poco/DOM/Element.h>
Expand All @@ -26,6 +28,8 @@
#include <Poco/DOM/NamedNodeMap.h>
#include <Poco/DOM/ChildNodesList.h>

#undef byte

class ofxXmlPoco{

public:
Expand Down
13 changes: 11 additions & 2 deletions addons/ofxiOS/src/sound/AVSoundPlayer.m
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,26 @@ - (void) setupSharedSession {
return;
}
NSString * playbackCategory = AVAudioSessionCategoryPlayAndRecord;
#ifdef TARGET_OF_TVOS
#ifdef TARGET_OS_TV
playbackCategory = AVAudioSessionCategoryPlayback;
#endif
[[AVAudioSession sharedInstance] setCategory:playbackCategory error: nil];
AVAudioSession * audioSession = [AVAudioSession sharedInstance];
NSError * err = nil;
// need to configure set the audio category, and override to it route the audio to the speaker
if([audioSession respondsToSelector:@selector(setCategory:withOptions:error:)]) {
#if defined (TARGET_OS_TV) || defined (TARGET_OS_WATCH)
if(![audioSession setCategory:playbackCategory
withOptions:AVAudioSessionCategoryOptionMixWithOthers
withOptions:(AVAudioSessionCategoryOptionMixWithOthers)
error:&err]) { err = nil; }
#else
if(![audioSession setCategory:playbackCategory
withOptions:(AVAudioSessionCategoryOptionMixWithOthers |
AVAudioSessionCategoryOptionAllowAirPlay |
AVAudioSessionCategoryOptionAllowBluetooth |
AVAudioSessionCategoryOptionAllowBluetoothA2DP)
error:&err]) { err = nil; }
#endif
}
[[AVAudioSession sharedInstance] setActive: YES error: nil];
audioSessionSetup = YES;
Expand Down
35 changes: 29 additions & 6 deletions addons/ofxiOS/src/sound/ofxiOSSoundStream.mm
Original file line number Diff line number Diff line change
Expand Up @@ -160,21 +160,44 @@
#ifdef __IPHONE_6_0
if(bMix) {
if([audioSession respondsToSelector:@selector(setCategory:withOptions:error:)]) {
#if defined (TARGET_OF_TVOS) || defined (TARGET_OF_WATCHOS)
if([audioSession setCategory:AVAudioSessionCategoryPlayAndRecord
withOptions:AVAudioSessionCategoryOptionMixWithOthers
error:nil]) {
withOptions:(AVAudioSessionCategoryOptionMixWithOthers)
error:nil]) {
success = true;
}
#else
if([audioSession setCategory:AVAudioSessionCategoryPlayAndRecord
withOptions:(AVAudioSessionCategoryOptionMixWithOthers |
AVAudioSessionCategoryOptionAllowAirPlay |
AVAudioSessionCategoryOptionAllowBluetooth |
AVAudioSessionCategoryOptionAllowBluetoothA2DP)
error:nil]) {
success = true;
}
#endif
}
} else {
#endif

// this is the default category + options setup
// Note: using a sound input stream will set the category to PlayAndRecord
if([audioSession setCategory:AVAudioSessionCategorySoloAmbient error:nil]) {
success = true;
}

#if defined (TARGET_OF_TVOS) || defined (TARGET_OF_WATCHOS)
if([audioSession setCategory:AVAudioSessionCategorySoloAmbient
error:nil]) {
success = true;
}
#else
if([audioSession setCategory:AVAudioSessionCategorySoloAmbient
withOptions:(
AVAudioSessionCategoryOptionAllowAirPlay |
AVAudioSessionCategoryOptionAllowBluetooth |
AVAudioSessionCategoryOptionAllowBluetoothA2DP)
error:nil]) {
success = true;
}
#endif

#ifdef __IPHONE_6_0
}
#endif
Expand Down
12 changes: 6 additions & 6 deletions examples/3d/3DModelLoaderExample/src/ofApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ void ofApp::setup(){
ofSetVerticalSync(true);

// load the first model
model.loadModel("penguin.dae", 20);
model.load("penguin.dae", 20);
// model info
curFileInfo = ".dae";

Expand Down Expand Up @@ -85,39 +85,39 @@ void ofApp::keyPressed(int key){
switch (key){
case '1':
bUsingMesh = false;
model.loadModel("penguin.dae");
model.load("penguin.dae");
model.setRotation(0, 180, 1, 0, 0);
model.setScale(0.9, 0.9, 0.9);
cam.setDistance(700);
curFileInfo = ".dae";
break;
case '2':
bUsingMesh = false;
model.loadModel("penguin.3ds");
model.load("penguin.3ds");
model.setRotation(0, 180, 1, 0, 0);
model.setScale(0.9, 0.9, 0.9);
cam.setDistance(700);
curFileInfo = ".3ds";
break;
case '3':
bUsingMesh = false;
model.loadModel("penguin.ply");
model.load("penguin.ply");
model.setRotation(0, 90, 1, 0, 0);
model.setScale(0.9, 0.9, 0.9);
cam.setDistance(700);
curFileInfo = ".ply";
break;
case '4':
bUsingMesh = false;
model.loadModel("penguin.obj");
model.load("penguin.obj");
model.setRotation(0, 90, 1, 0, 0);
model.setScale(0.9, 0.9, 0.9);
cam.setDistance(700);
curFileInfo = ".obj";
break;
case '5':
bUsingMesh = false;
model.loadModel("penguin.stl");
model.load("penguin.stl");
model.setRotation(0, 90, 1, 0, 0);
model.setScale(0.9, 0.9, 0.9);
cam.setDistance(700);
Expand Down
12 changes: 6 additions & 6 deletions examples/3d/assimpExample/src/ofApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ void ofApp::setup(){
bAnimateMouse = false;
animationPosition = 0;

model.loadModel("astroBoy_walk.dae", false);
model.load("astroBoy_walk.dae", false);
model.setPosition(ofGetWidth() * 0.5, (float)ofGetHeight() * 0.75 , 0);
model.setLoopStateForAllAnimations(OF_LOOP_NORMAL);
model.playAllAnimations();
Expand Down Expand Up @@ -102,28 +102,28 @@ void ofApp::keyPressed(int key){
glm::vec3 modelPosition(ofGetWidth() * 0.5, (float)ofGetHeight() * 0.75, 0);
switch (key) {
case '1':
model.loadModel("astroBoy_walk.dae");
model.load("astroBoy_walk.dae");
model.setPosition(modelPosition.x, modelPosition.y, modelPosition.z);
ofEnableSeparateSpecularLight();
break;
case '2':
model.loadModel("TurbochiFromXSI.dae");
model.load("TurbochiFromXSI.dae");
model.setPosition(modelPosition.x, modelPosition.y, modelPosition.z);
ofEnableSeparateSpecularLight();
break;
case '3':
model.loadModel("dwarf.x");
model.load("dwarf.x");
model.setPosition(modelPosition.x, modelPosition.y, modelPosition.z);
ofDisableSeparateSpecularLight();
break;
case '4':
model.loadModel("monster-animated-character-X.X");
model.load("monster-animated-character-X.X");
model.setPosition(modelPosition.x, modelPosition.y, modelPosition.z);
model.setRotation(0, -90, 0, 0, 1);
ofDisableSeparateSpecularLight();
break;
case '5':
model.loadModel("squirrel/NewSquirrel.3ds");
model.load("squirrel/NewSquirrel.3ds");
model.setPosition(modelPosition.x, modelPosition.y, modelPosition.z);
ofDisableSeparateSpecularLight();
break;
Expand Down
9 changes: 5 additions & 4 deletions libs/openFrameworks/3d/of3dUtils.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once

#include "ofConstants.h"
#include "ofFileUtils.h"
#include "glm/fwd.hpp"

/// \brief Draws x,y,z axes representing the current reference frame.
Expand Down Expand Up @@ -54,13 +55,13 @@ void ofDrawGridPlane(float stepSize = 1.25f, size_t numberOfSteps = 8, bool labe
///
/// ~~~~{.cpp}
/// ofSetColor(0,0,0);
/// ofVec3f arrowTailPoint (0,0,0);
/// ofVec3f arrowHeadPoint (100, 150,0);
/// glm::vec3 arrowTailPoint (0,0,0);
/// glm::vec3 arrowHeadPoint (100, 150,0);
/// ofDrawArrow(arrowTailPoint, arrowHeadPoint, 20.0);
/// ~~~~
///
/// \param start The start point (tail) of the arrow, expressed as an ofVec3f.
/// \param end The end point (head) of the arrow, expressed as an ofVec3f.
/// \param start The start point (tail) of the arrow, expressed as an glm::vec3.
/// \param end The end point (head) of the arrow, expressed as an glm::vec3.
/// \param headSize The size of the arrowhead.
void ofDrawArrow(const glm::vec3& start, const glm::vec3& end, float headSize = 0.05f);

Expand Down
20 changes: 10 additions & 10 deletions libs/openFrameworks/3d/ofCamera.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ class ofCamera : public ofNode {
/// offset from the center of its frustum. This is called an "assymetric
/// frustum" and is used (for example) in stereo views. It is acheived by
/// applying an offset to the center of projection. This function sets this
/// offset from an ofVec2f argument. For more information see
/// offset from an glm::vec2 argument. For more information see
/// <http://www.orthostereo.com/geometryopengl.html>.
///
/// \param lensOffset The "lens offset" to apply to this camera, encoded in
/// an ofVec2f.
/// an glm::vec2.
void setLensOffset(const glm::vec2 & lensOffset);

/// \brief Set the recommended aspect ratio for a perspective camera.
Expand Down Expand Up @@ -86,17 +86,17 @@ class ofCamera : public ofNode {

float getFarClip() const { return farClip; };

/// \brief Get the "lens offset" applied to this camera, encoded as an ofVec2f.
/// \brief Get the "lens offset" applied to this camera, encoded as an glm::vec2.
///
/// Ordinarily, the camera is pointed straight down the center of its view
/// frustum. However, it is possible to orient the camera towards a
/// location offset from the center of its frustum. This is called an
/// "asymetric frustum" and is used (for example) in stereo views. It is
/// acheived by applying an offset to the center of projection. This
/// function returns the offset that has been applied, as an ofVec2f. For
/// function returns the offset that has been applied, as an glm::vec2. For
/// more information see http://www.orthostereo.com/geometryopengl.html.
///
/// \returns The "lens offset" applied to this camera, encoded in an ofVec2f.
/// \returns The "lens offset" applied to this camera, encoded in an glm::vec2.
glm::vec2 getLensOffset() const { return lensOffset; };

/// \brief Get the boolean state which indicates whether the aspect ratio of this camera is forced to a non-default setting.
Expand Down Expand Up @@ -187,23 +187,23 @@ class ofCamera : public ofNode {

/// \brief Obtain the screen coordinates of a point in the 3D world.
///
/// Takes an (X,Y,Z) point in your 3D world, encoded as an ofVec3f,
/// and returns the location (also as an ofVec3f) where this point would
/// Takes an (X,Y,Z) point in your 3D world, encoded as an glm::vec3,
/// and returns the location (also as an glm::vec3) where this point would
/// appear on your (two-dimensional) display. The screen position's "Z
/// coordinate" is set to be the same as your camera's.
///
/// \param WorldXYZ A 3D point in the world, whose screen coordinates you wish to know.
/// \param viewport (Optional) A viewport. The default is ofGetCurrentViewport().
/// \returns An ofVec3f containing the screen coordinates of your 3D point of interest.
/// \returns An glm::vec3 containing the screen coordinates of your 3D point of interest.
glm::vec3 worldToScreen(glm::vec3 WorldXYZ, const ofRectangle & viewport) const;
glm::vec3 worldToScreen(glm::vec3 WorldXYZ) const{
return worldToScreen(WorldXYZ, getViewport());
}

/// \brief Obtain the coordinates, in the 3D world, of a 2D point presumed to be on your screen.
///
/// Takes a pixel location on your screen, encoded in an ofVec3f,
/// and returns (also as an ofVec3f) the 3D world coordinates of that point.
/// Takes a pixel location on your screen, encoded in an glm::vec3,
/// and returns (also as an glm::vec3) the 3D world coordinates of that point.
/// You'll also need to specify a Z value when providing your screen point.
/// This Z value is interpreted as a distance into or away from the screen.
///
Expand Down
9 changes: 6 additions & 3 deletions libs/openFrameworks/3d/ofMesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,10 @@ class ofMeshFace_;
template<class V, class N, class C, class T>
class ofMesh_{
public:

using VertexType = V;
using NormalType = N;
using ColorType = C;
using TexCoordType = T;
/// \name Construction
/// \{

Expand Down Expand Up @@ -231,7 +234,7 @@ class ofMesh_{

void mergeDuplicateVertices();

/// \returns a ofVec3f defining the centroid of all the vetices in the mesh.
/// \returns a glm::vec3 defining the centroid of all the vetices in the mesh.
V getCentroid() const;


Expand Down Expand Up @@ -432,7 +435,7 @@ class ofMesh_{
/// \returns a pointer to the texture coords that the mesh contains.
T* getTexCoordsPointer();

/// \brief Get a pointer to the ofVec2f texture coordinates that the mesh contains.
/// \brief Get a pointer to the glm::vec2 texture coordinates that the mesh contains.
const T* getTexCoordsPointer() const;

/// \brief Get a vector representing the texture coordinates of the mesh
Expand Down
4 changes: 2 additions & 2 deletions libs/openFrameworks/3d/ofNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -396,8 +396,8 @@ void ofNode::rotateRad(float radians, float vx, float vy, float vz) {

//----------------------------------------
void ofNode::rotateAround(const glm::quat& q, const glm::vec3& point) {
// ofLogVerbose("ofNode") << "rotateAround(const glm::quat& q, const ofVec3f& point) not implemented yet";
// ofMatrix4x4 m = getLocalTransformMatrix();
// ofLogVerbose("ofNode") << "rotateAround(const glm::quat& q, const glm::vec3& point) not implemented yet";
// glm::mat4 m = getLocalTransformMatrix();
// m.setTranslation(point);
// m.rotate(q);

Expand Down
4 changes: 2 additions & 2 deletions libs/openFrameworks/app/ofAppGLFWWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -857,7 +857,7 @@ void ofAppGLFWWindow::setFullscreen(bool fullscreen){
GLFWmonitor** monitors = glfwGetMonitors(&monitorCount);

int currentMonitor = getCurrentMonitor();
ofVec3f screenSize = getScreenSize();
auto screenSize = getScreenSize();

if( orientation == OF_ORIENTATION_90_LEFT || orientation == OF_ORIENTATION_90_RIGHT ){
std::swap(screenSize.x, screenSize.y);
Expand Down Expand Up @@ -913,7 +913,7 @@ void ofAppGLFWWindow::setFullscreen(bool fullscreen){

// make sure to save current pos if not specified in settings
if( settings.isPositionSet() ) {
ofVec3f pos = getWindowPosition();
auto pos = getWindowPosition();
settings.setPosition(ofVec2f(pos.x, pos.y));
}

Expand Down
2 changes: 1 addition & 1 deletion libs/openFrameworks/app/ofAppRunner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ void ofSetMainLoop(shared_ptr<ofMainLoop> newMainLoop) {

//--------------------------------------
int ofRunApp(ofBaseApp * OFSA){
mainLoop()->run(std::move(shared_ptr<ofBaseApp>(OFSA)));
mainLoop()->run(shared_ptr<ofBaseApp>(OFSA));
auto ret = ofRunMainLoop();
#if !defined(TARGET_ANDROID) && !defined(TARGET_OF_IOS)
ofExitCallback();
Expand Down
Loading

0 comments on commit cbef3f2

Please sign in to comment.