Skip to content

Commit cb621b9

Browse files
authored
Merge pull request #8 from Macbull/development
ospExamples.exe working properly
2 parents 7845981 + 5b9258b commit cb621b9

Some content is hidden

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

44 files changed

+5207
-188
lines changed

RenderingToolkit/Tutorial/apps/common/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@
77
# return()
88
# endif()
99

10-
add_all_subdirectories_except("arcball_camera")
10+
add_all_subdirectories_except("")

RenderingToolkit/Tutorial/apps/common/arcball_camera/ArcballCamera.cpp

Lines changed: 0 additions & 110 deletions
This file was deleted.

RenderingToolkit/Tutorial/apps/common/arcball_camera/ArcballCamera.h

Lines changed: 0 additions & 40 deletions
This file was deleted.

RenderingToolkit/Tutorial/apps/common/arcball_camera/CMakeLists.txt

Lines changed: 0 additions & 6 deletions
This file was deleted.

RenderingToolkit/Tutorial/apps/common/ospray_testing/CMakeLists.txt

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,12 @@ include(GenerateExportHeader)
66
add_library(ospray_testing STATIC
77
${OSPRAY_RESOURCE}
88

9-
ospray_testing.cpp
9+
builders/ospray_testing.h
10+
11+
builders/ospray_testing.inl
12+
builders/builder.h
13+
builders/Noise.h
14+
builders/ospray_testing.cpp
1015

1116
builders/Boxes.cpp
1217
builders/Interpolation.cpp
@@ -35,25 +40,24 @@ add_library(ospray_testing STATIC
3540
builders/test_pt_metal_roughness.cpp
3641
builders/test_pt_metallic_flakes.cpp
3742
builders/test_pt_obj.cpp
43+
3844
)
3945

4046
generate_export_header(ospray_testing)
4147

4248
target_link_libraries(ospray_testing
4349
PUBLIC
50+
ospray
51+
PRIVATE
4452
raw_to_amr
4553
)
4654

4755
target_include_directories(ospray_testing
48-
PUBLIC
49-
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
50-
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}>
51-
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/ospray/ospray_testing>
56+
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}>/builders
5257
)
53-
5458
## Install library/headers ##
5559

56-
# ospray_install_library(ospray_testing apps)
60+
# ospray_install_library(ospray_testing "")
5761

5862
install(DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
5963
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/ospray

RenderingToolkit/Tutorial/apps/common/ospray_testing/builders/Builder.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#include <functional>
1414
#include <map>
1515

16-
#include "ospray_testing_export.h"
16+
#include "ospray_testing.h"
1717

1818
namespace ospray {
1919
namespace testing {

RenderingToolkit/Tutorial/apps/common/ospray_testing/ospray_testing.h renamed to RenderingToolkit/Tutorial/apps/common/ospray_testing/builders/ospray_testing.h

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
#include "ospray/ospray_cpp.h"
77
#include "ospray/ospray_cpp/ext/rkcommon.h"
88

9-
#include "ospray_testing_export.h"
10-
119
namespace ospray {
1210
namespace testing {
1311

@@ -16,25 +14,25 @@ using namespace rkcommon::math;
1614

1715
using SceneBuilderHandle = void *;
1816

19-
OSPRAY_TESTING_EXPORT
17+
// OSPRAY_TESTING_EXPORT
2018
SceneBuilderHandle newBuilder(const std::string &type);
2119

2220
template <typename T>
2321
void setParam(SceneBuilderHandle b, const std::string &type, const T &val);
2422

25-
OSPRAY_TESTING_EXPORT
23+
// OSPRAY_TESTING_EXPORT
2624
cpp::Group buildGroup(SceneBuilderHandle b);
2725

28-
OSPRAY_TESTING_EXPORT
26+
// OSPRAY_TESTING_EXPORT
2927
cpp::World buildWorld(SceneBuilderHandle b);
3028

31-
OSPRAY_TESTING_EXPORT
29+
// OSPRAY_TESTING_EXPORT
3230
void commit(SceneBuilderHandle b);
3331

34-
OSPRAY_TESTING_EXPORT
32+
// OSPRAY_TESTING_EXPORT
3533
void release(SceneBuilderHandle b);
3634

3735
} // namespace testing
3836
} // namespace ospray
3937

40-
#include "detail/ospray_testing.inl"
38+
#include "ospray_testing.inl"

RenderingToolkit/Tutorial/apps/common/ospray_testing/detail/ospray_testing.inl renamed to RenderingToolkit/Tutorial/apps/common/ospray_testing/builders/ospray_testing.inl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright 2009 Intel Corporation
22
// SPDX-License-Identifier: Apache-2.0
33

4-
#include "../builders/Builder.h"
4+
#include "Builder.h"
55

66
namespace ospray {
77
namespace testing {
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
// Copyright 2009 Intel Corporation
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
#include "Builder.h"
5+
#include "ospray_testing.h"
6+
#include "rkcommon/utility/multidim_index_sequence.h"
7+
8+
using namespace rkcommon::math;
9+
10+
namespace ospray {
11+
namespace testing {
12+
13+
struct Boxes : public detail::Builder
14+
{
15+
Boxes(bool lights = false) : useLights(lights) {}
16+
~Boxes() override = default;
17+
18+
void commit() override;
19+
20+
cpp::Group buildGroup() const override;
21+
cpp::World buildWorld() const override;
22+
23+
24+
private:
25+
vec3i dimensions{4};
26+
bool useLights{false};
27+
};
28+
29+
// Inlined definitions ////////////////////////////////////////////////////
30+
31+
void Boxes::commit()
32+
{
33+
Builder::commit();
34+
35+
dimensions = getParam<vec3i>("dimensions", vec3i(4));
36+
37+
addPlane = false;
38+
}
39+
40+
cpp::Group Boxes::buildGroup() const
41+
{
42+
cpp::Geometry boxGeometry("box");
43+
44+
index_sequence_3D numBoxes(dimensions);
45+
46+
std::vector<box3f> boxes;
47+
std::vector<vec4f> color;
48+
49+
auto dim = reduce_max(dimensions);
50+
51+
for (auto i : numBoxes) {
52+
auto i_f = static_cast<vec3f>(i);
53+
54+
auto lower = i_f * 5.f;
55+
auto upper = lower + (0.75f * 5.f);
56+
boxes.emplace_back(lower, upper);
57+
58+
auto box_color = (0.8f * i_f / dim) + 0.2f;
59+
color.emplace_back(box_color.x, box_color.y, box_color.z, 1.f);
60+
}
61+
62+
boxGeometry.setParam("box", cpp::CopiedData(boxes));
63+
boxGeometry.commit();
64+
65+
cpp::GeometricModel model(boxGeometry);
66+
67+
model.setParam("color", cpp::CopiedData(color));
68+
69+
if (rendererType == "pathtracer" || rendererType == "scivis"
70+
|| rendererType == "ao") {
71+
cpp::Material material(rendererType, "obj");
72+
if (rendererType == "pathtracer" || rendererType == "scivis") {
73+
material.setParam("ks", vec3f(0.3f));
74+
material.setParam("ns", 10.f);
75+
}
76+
material.commit();
77+
model.setParam("material", material);
78+
}
79+
80+
model.commit();
81+
82+
cpp::Group group;
83+
84+
group.setParam("geometry", cpp::CopiedData(model));
85+
group.commit();
86+
87+
return group;
88+
}
89+
90+
cpp::World Boxes::buildWorld() const
91+
{
92+
auto world = Builder::buildWorld();
93+
if (!useLights)
94+
return world;
95+
cpp::Light light("distant");
96+
light.setParam("color", vec3f(0.78f, 0.551f, 0.483f));
97+
light.setParam("intensity", 3.14f);
98+
light.setParam("direction", vec3f(-0.8f, -0.6f, 0.3f));
99+
light.commit();
100+
cpp::Light ambient("ambient");
101+
ambient.setParam("intensity", 0.35f);
102+
ambient.setParam("visible", false);
103+
ambient.commit();
104+
std::vector<cpp::Light> lights{light, ambient};
105+
world.setParam("light", cpp::CopiedData(lights));
106+
return world;
107+
}
108+
109+
OSP_REGISTER_TESTING_BUILDER(Boxes, boxes);
110+
OSP_REGISTER_TESTING_BUILDER(Boxes(true), boxes_lit);
111+
112+
} // namespace testing
113+
} // namespace ospray

0 commit comments

Comments
 (0)