Skip to content

Commit

Permalink
Merge branch 'devel' into sphere-colors
Browse files Browse the repository at this point in the history
  • Loading branch information
Twinklebear committed May 13, 2018
2 parents b6b739e + 0cec8ba commit 32b15bd
Show file tree
Hide file tree
Showing 118 changed files with 4,409 additions and 1,700 deletions.
14 changes: 3 additions & 11 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,6 @@ build-arch-clang-warnings:
- scripts/build_gitlab/linux.sh -DOSPRAY_STRICT_BUILD=ON -DOSPRAY_WARN_AS_ERRORS=ON -DOSPRAY_MODULE_MPI=ON
allow_failure: true

build-ubuntu1704-gcc:
<<: *build_job_docker
image: ospray/docker-images:ubuntu17.04
artifacts:
paths:
- $CI_PROJECT_DIR
expire_in: 3 day

build-ubuntu1604-gcc:
<<: *build_job_docker
image: ospray/docker-images:ubuntu16.04
Expand Down Expand Up @@ -123,7 +115,7 @@ build-centos6-icc:
script:
- module load gcc/4.8.2
- module load intel
- module load embree
- module load embree/3.1.0
- module load tbb
- export CC=icc
- export CXX=icpc
Expand All @@ -137,7 +129,7 @@ build-centos6-icc15:
script:
- module load gcc/4.8.2
- module load intel/2015
- module load embree
- module load embree/3.1.0
- module load tbb
- export CC=icc
- export CXX=icpc
Expand Down Expand Up @@ -383,7 +375,7 @@ release-linux-icc:
- module load cmake
- module load gcc/4.8.2
- module load intel
- module load embree
- module load embree/3.1.0
- export CC=icc
- export CXX=icpc
- scripts/release/linux.sh
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ Version History
- Added ability to configure Embree scene flags via OSPModel parameters
- Fixed memory leak caused by incorrect parameter reference counts in ISPC
device
- Added new `ospShutdown` API function to aid in correctness and determinism
of OSPRay API cleanup
- `ospFreeFrameBuffer` has been deprecated in favor of using `ospRelease` to
free frame buffer handles

### Changes in v1.5.0:

Expand Down
1,288 changes: 1,061 additions & 227 deletions README.md

Large diffs are not rendered by default.

14 changes: 13 additions & 1 deletion apps/common/ospapp/OSPApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ usage --> "--generate:type[:parameter1=value,parameter2=value,...]"
types:
randomSpheres --> generate a block of random sphere centers of uniform radius
spheres --> generate a block of random sphere centers of uniform radius
parameters:
numSpheres=[int]
number of spheres to generate
Expand All @@ -138,6 +138,13 @@ usage --> "--generate:type[:parameter1=value,parameter2=value,...]"
[dimensions,dims]=[intxintxint]
number of spheres to generate in each 3D dimension
cylinders --> generate a block of cylinders in {X,Y} grid of length Z
parameters:
[dimensions,dims]=[intxintxint]
number of cylinders to generate in X,Y 2D dimensions, use Z for length
radius=[float]
radius of cylinders
basicVolume --> generate a volume with linearly increasing voxel values
parameters:
[dimensions,dims]=[intxintxint]
Expand All @@ -149,6 +156,8 @@ usage --> "--generate:type[:parameter1=value,parameter2=value,...]"
number of spheres to generate in each 3D dimension
[isovalues,isosurfaces]=[value1/value2/value3...]
use vtkMarchingCubes filter to generate isosurfaces instead of the volume
viewSlice
add a slice to the middle of the volume in the X/Y plane
)text"
<< std::endl;
}
Expand Down Expand Up @@ -209,6 +218,9 @@ usage --> "--generate:type[:parameter1=value,parameter2=value,...]"

render(rendererPtr);

rendererPtr.reset();
ospShutdown();

return 0;
}

Expand Down
13 changes: 11 additions & 2 deletions apps/common/sg/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ if(OSPRAY_SG_VTK)
set(SG_VTK_SRCS
importer/importUnstructuredVolume.cpp
importer/importVTKPolyData.cpp
importer/importVTI.cpp
generator/generateVTKWaveletVolume.cpp
)

Expand Down Expand Up @@ -72,9 +73,11 @@ ospray_create_library(ospray_sg SHARED
SceneGraph.cpp
Renderer.cpp

geometry/Cylinders.cpp
geometry/Geometry.cpp
geometry/QuadMesh.cpp
geometry/Slices.cpp
geometry/Spheres.cpp
geometry/Cylinders.cpp
geometry/StreamLines.cpp
geometry/TriangleMesh.cpp

Expand Down Expand Up @@ -114,10 +117,15 @@ ospray_create_library(ospray_sg SHARED
3rdParty/ply.cpp

# scene graph generators
generator/Generator.cpp
generator/generateBasicVolume.cpp
generator/generateCube.cpp
generator/generateCurves.cpp
generator/generateCylinders.cpp
generator/generateGridOfSpheres.cpp
generator/generateRandomQuads.cpp
generator/generateRandomSpheres.cpp
generator/Generator.cpp
generator/generateUnstructuredVolume.cpp

# scene graph importers
importer/Importer.cpp
Expand Down Expand Up @@ -199,6 +207,7 @@ ospray_install_sdk_headers(
ospray_install_sdk_headers(
geometry/Cylinders.h
geometry/Geometry.h
geometry/QuadMesh.h
geometry/Spheres.h
geometry/StreamLines.h
geometry/TriangleMesh.h
Expand Down
4 changes: 3 additions & 1 deletion apps/common/sg/Renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
#include "visitor/MarkAllAsModified.h"
#include "visitor/VerifyNodes.h"

#include "ospcommon/memory/malloc.h"

namespace ospray {
namespace sg {

Expand Down Expand Up @@ -140,7 +142,7 @@ namespace ospray {
backplate->preferLinear = true;
backplate->depth = 4;
const size_t stride = backplate->size.x * backplate->channels * backplate->depth;
backplate->data = malloc(sizeof(unsigned char) * backplate->size.y * stride);
backplate->data = memory::alignedMalloc(sizeof(unsigned char) * backplate->size.y * stride);
vec3f bgColor = child("bgColor").valueAs<vec3f>();
memcpy(backplate->data, &bgColor.x, backplate->channels*backplate->depth);
createChild("useBackplate", "bool", true, NodeFlags::none, "use\
Expand Down
1 change: 0 additions & 1 deletion apps/common/sg/camera/Camera.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ namespace ospray {

/*! camera type, i.e., 'ao', 'obj', 'pathtracer', ... */
const std::string type;
OSPCamera ospCamera {nullptr};
};

// Inlined Camera definitions /////////////////////////////////////////////
Expand Down
3 changes: 2 additions & 1 deletion apps/common/sg/common/Renderable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ namespace ospray {
}

void Renderable::preTraverse(RenderContext &ctx,
const std::string& operation, bool& traverseChildren)
const std::string& operation,
bool& traverseChildren)
{
Node::preTraverse(ctx,operation, traverseChildren);
if (operation == "render")
Expand Down
3 changes: 2 additions & 1 deletion apps/common/sg/common/Renderable.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ namespace ospray {
virtual box3f computeBounds() const;

virtual void preTraverse(RenderContext &ctx,
const std::string& operation, bool& traverseChildren) override;
const std::string& operation,
bool& traverseChildren) override;
virtual void postTraverse(RenderContext &ctx,
const std::string& operation) override;
virtual void postCommit(RenderContext &ctx) override;
Expand Down
4 changes: 2 additions & 2 deletions apps/common/sg/common/Texture2D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ namespace ospray {
}
std::swap(texels[a], texels[b]);
}
} catch(std::runtime_error e) {
} catch(const std::runtime_error &e) {
std::cerr << e.what() << std::endl;
}
} else if (ext == "pfm") {
Expand Down Expand Up @@ -286,7 +286,7 @@ namespace ospray {
std::swap(texels[y * width * numChannels + x], texels[(height - 1 - y) * width * numChannels + x]);
}
}
} catch(std::runtime_error e) {
} catch(const std::runtime_error &e) {
std::cerr << e.what() << std::endl;
}
}
Expand Down
2 changes: 2 additions & 0 deletions apps/common/sg/generator/Generator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ namespace ospray {
auto splitParam = utility::split(value, '=');
if (splitParam.size() == 2)
parameters.emplace_back(splitParam[0], splitParam[1]);
else if (splitParam.size() == 1)
parameters.emplace_back(splitParam[0], "");
}

fcn(world, parameters);
Expand Down
118 changes: 118 additions & 0 deletions apps/common/sg/generator/generateCube.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
// ======================================================================== //
// Copyright 2009-2018 Intel Corporation //
// //
// Licensed under the Apache License, Version 2.0 (the "License"); //
// you may not use this file except in compliance with the License. //
// You may obtain a copy of the License at //
// //
// http://www.apache.org/licenses/LICENSE-2.0 //
// //
// Unless required by applicable law or agreed to in writing, software //
// distributed under the License is distributed on an "AS IS" BASIS, //
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
// See the License for the specific language governing permissions and //
// limitations under the License. //
// ======================================================================== //

// ospcommon
#include "ospcommon/utility/StringManip.h"
// sg
#include "../common/Data.h"
#include "Generator.h"

namespace ospray {
namespace sg {

void generateCube(const std::shared_ptr<Node> &world,
const std::vector<string_pair> &/*params*/)
{
auto quads_node = createNode("cube", "QuadMesh");

// generate cube using quads

auto quad_vertices = std::make_shared<DataVector3f>();
quad_vertices->setName("vertex");

quad_vertices->v = std::vector<vec3f>{
vec3f( 1, 1, 1), // 0
vec3f(-1, 1, 1), // 1
vec3f(-1, -1, 1), // 2
vec3f( 1, -1, 1), // 3
vec3f( 1, -1, -1), // 4
vec3f( 1, 1, -1), // 5
vec3f(-1, 1, -1), // 6
vec3f(-1, -1, -1) // 7
};

quads_node->add(quad_vertices);

auto quad_indices = std::make_shared<DataVector4i>();
quad_indices->setName("index");

quad_indices->v = std::vector<vec4i>{
vec4i(0,3,2,1), // +Z
vec4i(0,1,6,5), // +Y
vec4i(0,5,4,3), // +X
vec4i(4,5,6,7), // -Z
vec4i(2,3,4,7), // -Y
vec4i(1,2,7,6), // -X
};

quads_node->add(quad_indices);

auto quad_colors = std::make_shared<DataVector3fa>();
quad_colors->setName("color");

static const vec3fa r(1,0,0);
static const vec3fa g(0,1,0);
static const vec3fa b(0,0,1);

quad_colors->v = std::vector<vec3fa>{
0+0+0, // 0
r+0+0, // 1
0+g+0, // 2
0+0+b, // 3
r+g+0, // 4
r+0+b, // 5
0+g+b, // 6
r+g+b, // 7
};

quads_node->add(quad_colors);

// finally add to world

#if 1 // QuadMesh or TriangleMesh?
world->add(quads_node);

#else
auto tris_node = createNode("cube", "TriangleMesh");
auto tri_indices = std::make_shared<DataVector3i>();
tri_indices->setName("index");
tri_indices->v = std::vector<vec3i>{
vec3i(0,3,2), // +Z
vec3i(2,1,0), // +Z
vec3i(0,1,6), // +Y
vec3i(6,5,0), // +Y
vec3i(0,5,4), // +X
vec3i(4,3,0), // +X
vec3i(4,5,6), // -Z
vec3i(6,7,4), // -Z
vec3i(2,3,4), // -Y
vec3i(4,7,2), // -Y
vec3i(1,2,7), // -X
vec3i(7,6,1), // -X
};
tris_node->add(quad_vertices);
tris_node->add(tri_indices);
tris_node->add(quad_colors);
world->add(tris_node);
#endif
}

OSPSG_REGISTER_GENERATE_FUNCTION(generateCube, cube);

} // ::ospray::sg
} // ::ospray
Loading

0 comments on commit 32b15bd

Please sign in to comment.