Skip to content

Commit 1eb0a1e

Browse files
committed
Compile fixes for Linux with GCC
1 parent b57fbaf commit 1eb0a1e

10 files changed

+29
-19
lines changed

Array.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
*/
2727

2828
#pragma once
29+
#include <cmath>
2930
#include "linear_math.h"
3031
#include <string.h>
3132
#include "Util.h"
@@ -161,7 +162,7 @@ template <class T> void Array<T>::removeSwap(int start, int end)
161162
int oldSize = m_size;
162163
m_size += start - end;
163164

164-
int copyStart = max(m_size, end);
165+
int copyStart = std::max(m_size, end);
165166
copy(m_ptr + start, m_ptr + copyStart, oldSize - copyStart);
166167
}
167168

BVH.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2626
*/
2727

28+
#include <cstdio>
29+
2830
#include "BVH.h"
2931
#include "SplitBVHBuilder.h"
3032

@@ -59,4 +61,4 @@ BVH::BVH(Scene* scene, const Platform& platform, const BuildParams& params)
5961
params.stats->numTris = m_root->getSubtreeSize(BVH_STAT_TRIANGLE_COUNT);
6062
params.stats->numChildNodes = m_root->getSubtreeSize(BVH_STAT_CHILDNODE_COUNT);
6163
}
62-
}
64+
}

BVH.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#pragma once
2929
#include "Scene.h"
3030
#include "BVHNode.h"
31+
#include <cstdio>
3132
#include <string>
3233

3334
typedef float F32;

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ set(HEADERS
2121
CudaBVH.h
2222
CudaRenderKernel.h
2323
Geometry.h
24-
HDRLoader.h
24+
HDRloader.h
2525
MouseKeyboardInput.h
2626
Scene.h
2727
SceneLoader.h
@@ -37,7 +37,7 @@ set(SOURCES
3737
BVHNode.cpp
3838
Camera.cpp
3939
CudaBVH.cpp
40-
HDRLoader.cpp
40+
HDRloader.cpp
4141
main.cpp
4242
renderkernel.cu
4343
SceneLoader.cpp

Camera.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
#pragma once
44

5-
#include "geometry.h"
5+
#include "Geometry.h"
66
#include "linear_math.h"
77

88
#define M_PI 3.14156265

CudaBVH.cpp

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -102,15 +102,21 @@ CudaBVH& CudaBVH::operator=(CudaBVH& other)
102102
}
103103
return *this;
104104
}
105-
void CudaBVH::createCompact(const BVH& bvh, int nodeOffsetSizeDiv)
105+
106+
namespace detail
106107
{
107-
struct StackEntry
108-
{
109-
const BVHNode* node;
110-
S32 idx;
108+
struct StackEntry
109+
{
110+
const BVHNode* node;
111+
S32 idx;
111112

112-
StackEntry(const BVHNode* n = NULL, int i = 0) : node(n), idx(i) {}
113-
};
113+
StackEntry(const BVHNode* n = NULL, int i = 0) : node(n), idx(i) {}
114+
};
115+
}
116+
117+
void CudaBVH::createCompact(const BVH& bvh, int nodeOffsetSizeDiv)
118+
{
119+
using namespace detail; // for StackEntry
114120

115121
int leafcount = 0; // counts leafnodes
116122

CudaRenderKernel.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
#include "linear_math.h"
3030
#include <cuda.h>
3131
#include "stdio.h"
32-
#include "camera.h"
32+
#include "Camera.h"
3333

3434
#define scrwidth 1280
3535
#define scrheight 720

HDRloader.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Info: Load HDR image and convert to a set of float32 RGB triplet.
77
from http://www.flipcode.com/archives/HDR_Image_Reader.shtml
88
************************************************************************************/
99

10-
#include "hdrloader.h"
10+
#include "HDRloader.h"
1111

1212
#include <math.h>
1313
#include <memory.h>
@@ -188,4 +188,4 @@ bool oldDecrunch(RGBE *scanline, int len, FILE *file)
188188
}
189189
}
190190
return true;
191-
}
191+
}

MouseKeyboardInput.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// code for depth-of-field, mouse + keyboard user interaction based on https://github.com/peterkutz/GPUPathTracer
22

33
#pragma once
4-
#include "camera.h"
4+
#include "Camera.h"
55

66
InteractiveCamera* interactiveCamera = NULL;
77

@@ -91,4 +91,4 @@ void mouse(int button, int state, int x, int y)
9191
lastX = x;
9292
lastY = y;
9393
motion(x, y);
94-
}
94+
}

SceneLoader.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#ifndef __LOADER_H_
22
#define __LOADER_H_
33

4-
#include "geometry.h"
4+
#include "Geometry.h"
55

66
extern unsigned verticesNo;
77
extern Vertex* vertices;
@@ -12,4 +12,4 @@ void panic(const char *fmt, ...);
1212
void load_object(const char *filename);
1313
float processgeo();
1414

15-
#endif
15+
#endif

0 commit comments

Comments
 (0)