Skip to content

Commit e94bddb

Browse files
authored
Reducing .h includes in .h files (#8176)
1 parent d5c4481 commit e94bddb

18 files changed

Lines changed: 73 additions & 33 deletions

libs/openFrameworks/3d/of3dUtils.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
#include "ofAppRunner.h"
33
#include "ofGraphicsBaseTypes.h"
44

5+
#define GLM_FORCE_CTOR_INIT
6+
#define GLM_ENABLE_EXPERIMENTAL
7+
#include <glm/vec3.hpp>
8+
59
//--------------------------------------------------------------
610
void ofDrawAxis(float size) {
711
ofGetCurrentRenderer()->drawAxis(size);

libs/openFrameworks/3d/of3dUtils.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
#pragma once
22

3-
#define GLM_FORCE_CTOR_INIT
4-
#define GLM_ENABLE_EXPERIMENTAL
5-
#include <glm/vec3.hpp>
3+
#include <glm/detail/qualifier.hpp>
4+
namespace glm {
5+
typedef vec<3, float, defaultp> vec3;
6+
}
67

78
/// \brief Draws x,y,z axes representing the current reference frame.
89
///

libs/openFrameworks/3d/ofMesh.inl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1657,7 +1657,7 @@ const std::vector<ofMeshFace_<V,N,C,T>> & ofMesh_<V,N,C,T>::getUniqueFaces() con
16571657
bool bHasTexcoords = hasTexCoords();
16581658

16591659
if( getMode() == OF_PRIMITIVE_TRIANGLES) {
1660-
for(std::size_t j = 0; j < indices.size(); j += 3) {
1660+
for(ofIndexType j = 0; j < indices.size(); j += 3) {
16611661
ofMeshFace_<V,N,C,T> & tri = faces[triindex];
16621662
for(std::size_t k = 0; k < 3; k++) {
16631663
index = indices[j+k];

libs/openFrameworks/3d/ofNode.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
#include "ofNode.h"
33
#include "of3dGraphics.h"
44

5+
#define GLM_FORCE_CTOR_INIT
6+
#define GLM_ENABLE_EXPERIMENTAL
7+
#include <glm/mat4x4.hpp>
8+
59
//----------------------------------------
610
ofNode::ofNode()
711
:parent(nullptr)

libs/openFrameworks/3d/ofNode.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
#define GLM_FORCE_CTOR_INIT
77
#define GLM_ENABLE_EXPERIMENTAL
8-
#include <glm/mat4x4.hpp>
98
#include <glm/gtc/quaternion.hpp>
109

1110
#include <array>

libs/openFrameworks/app/ofAppEGLWindow.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#include "ofFileUtils.h"
77
#include "ofGLProgrammableRenderer.h"
88
#include "ofGLRenderer.h"
9-
#include "ofVectorMath.h"
9+
// #include "ofVectorMath.h"
1010
#include <assert.h>
1111
// x11
1212
#include <X11/Xutil.h>

libs/openFrameworks/gl/ofShader.h

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,16 @@
1010
// MARK: ofConstants Targets
1111
#include "ofConstants.h"
1212

13-
#define GLM_FORCE_CTOR_INIT
14-
#define GLM_ENABLE_EXPERIMENTAL
15-
#include <glm/fwd.hpp>
13+
#include <glm/detail/qualifier.hpp>
14+
namespace glm {
15+
typedef vec<2, float, defaultp> vec2;
16+
typedef vec<3, float, defaultp> vec3;
17+
typedef vec<4, float, defaultp> vec4;
18+
19+
typedef float f32;
20+
typedef mat<3, 3, f32, defaultp> mat3;
21+
typedef mat<4, 4, f32, defaultp> mat4;
22+
}
1623

1724
#include <unordered_map>
1825

libs/openFrameworks/graphics/ofGraphics.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33
#include "ofConstants.h"
44
#include "ofGraphicsBaseTypes.h"
55

6-
#define GLM_FORCE_CTOR_INIT
7-
#define GLM_ENABLE_EXPERIMENTAL
8-
#include <glm/fwd.hpp>
6+
#include <glm/detail/qualifier.hpp>
7+
namespace glm {
8+
typedef vec<2, float, defaultp> vec2;
9+
typedef vec<3, float, defaultp> vec3;
10+
}
911

1012
class ofVec3f;
1113
class ofVec2f;

libs/openFrameworks/graphics/ofGraphicsBaseTypes.h

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,14 @@ enum ofLoopType : short;
4545
enum ofOrientation : short;
4646

4747
struct ofBoundingBox{
48-
glm::vec3 min = glm::vec3(0,0,0);
49-
glm::vec3 max = glm::vec3(0,0,0);
48+
glm::vec3 min { 0, 0, 0 };
49+
glm::vec3 max { 0, 0, 0 };
5050
};
5151

52+
#define GLM_FORCE_CTOR_INIT
53+
#define GLM_ENABLE_EXPERIMENTAL
54+
#include <glm/mat4x4.hpp>
55+
5256
/// \brief Contains general information about the style of ofGraphics
5357
/// elements such as color, line width and others.
5458
class ofStyle {
@@ -198,6 +202,11 @@ class ofBaseDraws {
198202
///
199203
/// \return the width.
200204
virtual float getWidth() const = 0;
205+
206+
// TODO: Implement correctly for texture, videos, etc.
207+
virtual glm::vec2 getSize() {
208+
return { getWidth(), getHeight() };
209+
}
201210

202211
/// \brief Set the anchor point the item is drawn around as a percentage.
203212
///

0 commit comments

Comments
 (0)