Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various fixes #860

Merged
merged 4 commits into from
Dec 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ common_find_package(FreeImage)

# Compiler options
if (CMAKE_COMPILER_IS_GNUCC AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 8.0)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-class-memaccess")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-class-memaccess -Wno-deprecated-copy -Wno-ignored-qualifiers")
endif()

# Archive loading
Expand Down
5 changes: 1 addition & 4 deletions engines/ospray/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,7 @@ ospcommon::affine3f transformationToAffine3f(
float(translation.z + rotationCenter.z)}) *
rot *
ospcommon::affine3f::scale(
{float(scale.x), float(scale.y), float(scale.z)}) *
ospcommon::affine3f::translate({float(-rotationCenter.x),
float(-rotationCenter.y),
float(-rotationCenter.z)});
{float(scale.x), float(scale.y), float(scale.z)});
}

void addInstance(OSPModel rootModel, OSPModel modelToAdd,
Expand Down
6 changes: 3 additions & 3 deletions plugins/CircuitExplorer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,12 @@ set(BRAYNSCIRCUITEXPLORER_ISPC_SOURCES
module/ispc/render/CellGrowthRenderer.ispc
module/ispc/render/utils/CircuitExplorerSimulationRenderer.ispc
module/ispc/render/utils/CircuitExplorerRandomGenerator.ispc
module/ispc/render/utils/CircuitExplorerSkyBox.ispc
)

# Compile ispc code
list(APPEND ALL_ISPC_INCLUDES ${OSPRAY_INCLUDE_DIRS})
include_directories_ispc(${ALL_ISPC_INCLUDES})
set(BRAYNS_SOURCE_DIR ${PROJECT_SOURCE_DIR}/../..)
list(APPEND ALL_ISPC_INCLUDES ${OSPRAY_INCLUDE_DIRS} ${BRAYNS_SOURCE_DIR})
include_directories_ispc(${ALL_ISPC_INCLUDES} )
ospray_ispc_compile(${BRAYNSCIRCUITEXPLORER_ISPC_SOURCES})
list(APPEND BRAYNSCIRCUITEXPLORER_SOURCES ${ISPC_OBJECTS})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ inline vec3f CellGrowthRenderer_shadeRay(
// No intersection
vec4f colorContribution =
skyboxMapping((Renderer*)self, ray,
self->super.super.bgMaterial);
(DefaultMaterial*)self->super.super.bgMaterial);
colorContribution.w = 1.f;
pathColor = make_vec3f(colorContribution);
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,9 @@ inline bool launchRandomRay(
if (randomRay.geomID < 0)
{
// No intersection
backgroundColor =
make_vec3f(skyboxMapping((Renderer*)self, randomRay,
self->super.super.bgMaterial));
backgroundColor = make_vec3f(
skyboxMapping((Renderer*)self, randomRay,
(DefaultMaterial*)self->super.super.bgMaterial));
return false;
}

Expand Down Expand Up @@ -650,10 +650,10 @@ inline void setGeometryShadingAttributes(
attributes.diffuseColor = mat->Kd * make_vec3f(dg.color);
if (valid(mat->map_Kd))
{
const vec4f diffuseColorFromMap = get4f(mat->map_Kd, dg);
const vec3f diffuseColorFromMap = get3f(mat->map_Kd, dg);
attributes.diffuseColor =
attributes.diffuseColor * make_vec3f(diffuseColorFromMap);
attributes.opacity *= diffuseColorFromMap.w;
// attributes.opacity *= diffuseColorFromMap.w;
}

// Specular color
Expand Down Expand Up @@ -783,8 +783,9 @@ inline void processBackgroundColor(varying ScreenSample& sample,
ShadingAttributes& attributes)
{
// No intersection. Return volume contribution + skybox color
attributes.bgColor = skyboxMapping((Renderer*)attributes.self, ray,
attributes.self->super.super.bgMaterial);
attributes.bgColor = skyboxMapping(
(Renderer*)attributes.self, ray,
(DefaultMaterial*)attributes.self->super.super.bgMaterial);
attributes.shadingContribution = make_vec3f(attributes.bgColor);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@ inline vec3f CircuitExplorerBasicRenderer_shadeRay(
if (ray.geomID < 0)
{
// No intersection
colorContribution = skyboxMapping((Renderer*)self, ray,
self->super.super.bgMaterial);
colorContribution =
skyboxMapping((Renderer*)self, ray,
(DefaultMaterial*)self->super.super.bgMaterial);
colorContribution.w = 1.f;
composite(colorContribution, pathColor, self->alphaCorrection);
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,7 @@ void CircuitExplorerMaterial::commit()
glossiness = getParam1f("glossiness", 1.f);

// Cast simulation data
castSimulationData =
getParam1i(MATERIAL_PROPERTY_CAST_USER_DATA.c_str(), 0);
castSimulationData = getParam(MATERIAL_PROPERTY_CAST_USER_DATA.c_str(), 0);

// Shading mode
shadingMode = static_cast<MaterialShadingMode>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ inline vec3f ProximityDetectionRenderer_shadeRay(
if (ray.geomID < 0)
{
vec4f bgColor =
skyboxMapping((Renderer*)self, ray, self->super.bgMaterial);
skyboxMapping((Renderer*)self, ray,
(DefaultMaterial*)self->super.bgMaterial);
bgColor.w = 1.f;
composite(bgColor, color, self->alphaCorrection);
return make_vec3f(color) * self->super.exposure;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ inline vec3f VoxelizedSimulationRenderer_shadeRay(
// No intersection
vec4f colorContribution =
skyboxMapping((Renderer*)self, ray,
self->super.super.bgMaterial);
(DefaultMaterial*)self->super.super.bgMaterial);
colorContribution.w = 1.f;
composite(colorContribution, pathColor, self->alphaCorrection);
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@

// Brayns
#include "CircuitExplorerRandomGenerator.ih"
#include "CircuitExplorerSkyBox.ih"

#include "../../../../../../engines/ospray/ispc/render/utils/Consts.ih"
#include <engines/ospray/ispc/render/utils/Consts.ih>
#include <engines/ospray/ispc/render/utils/SkyBox.ih>

struct CircuitExplorerAbstractRenderer
{
Expand Down

This file was deleted.

This file was deleted.

14 changes: 7 additions & 7 deletions plugins/CircuitExplorer/plugin/CircuitExplorerPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ void CircuitExplorerPlugin::_setMaterialExtraAttributes(
for (auto& material : materials)
{
brayns::PropertyMap props;
props.setProperty({MATERIAL_PROPERTY_CAST_USER_DATA, 0});
props.setProperty({MATERIAL_PROPERTY_CAST_USER_DATA, false});
props.setProperty(
{MATERIAL_PROPERTY_SHADING_MODE,
static_cast<int>(MaterialShadingMode::diffuse)});
Expand Down Expand Up @@ -577,7 +577,7 @@ void CircuitExplorerPlugin::_setMaterial(const MaterialDescriptor& md)
material->setEmission(md.emission);
material->setGlossiness(md.glossiness);
material->updateProperty(MATERIAL_PROPERTY_CAST_USER_DATA,
md.simulationDataCast ? 1 : 0);
md.simulationDataCast);
material->updateProperty(MATERIAL_PROPERTY_SHADING_MODE,
md.shadingMode);
material->updateProperty(MATERIAL_PROPERTY_CLIPPING_MODE,
Expand Down Expand Up @@ -651,7 +651,7 @@ void CircuitExplorerPlugin::_setMaterials(const MaterialsDescriptor& md)
if (!md.simulationDataCasts.empty())
material->updateProperty(
MATERIAL_PROPERTY_CAST_USER_DATA,
md.simulationDataCasts[id] ? 1 : 0);
md.simulationDataCasts[id]);
if (!md.shadingModes.empty())
material->updateProperty(
MATERIAL_PROPERTY_SHADING_MODE,
Expand Down Expand Up @@ -1443,7 +1443,7 @@ void CircuitExplorerPlugin::_createShapeMaterial(brayns::ModelPtr& model,
mptr->setSpecularExponent(0.0);

brayns::PropertyMap props;
props.setProperty({MATERIAL_PROPERTY_CAST_USER_DATA, 0});
props.setProperty({MATERIAL_PROPERTY_CAST_USER_DATA, false});
props.setProperty(
{MATERIAL_PROPERTY_SHADING_MODE,
static_cast<int>(MaterialShadingMode::diffuse_transparency)});
Expand Down Expand Up @@ -1738,7 +1738,7 @@ void CircuitExplorerPlugin::_addGrid(const AddGrid& payload)
const brayns::Vector3f grey = {0.5, 0.5, 0.5};

brayns::PropertyMap props;
props.setProperty({MATERIAL_PROPERTY_CAST_USER_DATA, 0});
props.setProperty({MATERIAL_PROPERTY_CAST_USER_DATA, false});
props.setProperty({MATERIAL_PROPERTY_SHADING_MODE,
static_cast<int>(MaterialShadingMode::none)});
props.setProperty({MATERIAL_PROPERTY_CLIPPING_MODE,
Expand Down Expand Up @@ -1806,7 +1806,7 @@ void CircuitExplorerPlugin::_addGrid(const AddGrid& payload)
const float l2 = l * 0.90;

brayns::PropertyMap diffuseProps;
diffuseProps.setProperty({MATERIAL_PROPERTY_CAST_USER_DATA, 0});
diffuseProps.setProperty({MATERIAL_PROPERTY_CAST_USER_DATA, false});
diffuseProps.setProperty(
{MATERIAL_PROPERTY_SHADING_MODE,
static_cast<int>(MaterialShadingMode::diffuse)});
Expand Down Expand Up @@ -1857,7 +1857,7 @@ void CircuitExplorerPlugin::_addColumn(const AddColumn& payload)
const brayns::Vector3f white = {1.f, 1.f, 1.F};

brayns::PropertyMap props;
props.setProperty({MATERIAL_PROPERTY_CAST_USER_DATA, 0});
props.setProperty({MATERIAL_PROPERTY_CAST_USER_DATA, false});
props.setProperty({MATERIAL_PROPERTY_SHADING_MODE,
static_cast<int>(MaterialShadingMode::diffuse)});
props.setProperty({MATERIAL_PROPERTY_CLIPPING_MODE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,7 @@ void AbstractCircuitLoader::_importMeshes(
for (auto &material : model.getMaterials())
{
brayns::PropertyMap props;
props.setProperty({MATERIAL_PROPERTY_CAST_USER_DATA, 1});
props.setProperty({MATERIAL_PROPERTY_CAST_USER_DATA, true});
props.setProperty({MATERIAL_PROPERTY_SHADING_MODE,
static_cast<int>(MaterialShadingMode::diffuse)});
props.setProperty(
Expand Down
2 changes: 1 addition & 1 deletion plugins/CircuitExplorer/plugin/io/AstrocyteLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ void AstrocyteLoader::_importMorphologiesFromURIs(
(float)i / (float)uris.size());
}
brayns::PropertyMap materialProps;
materialProps.setProperty({MATERIAL_PROPERTY_CAST_USER_DATA, 0});
materialProps.setProperty({MATERIAL_PROPERTY_CAST_USER_DATA, false});
materialProps.setProperty({MATERIAL_PROPERTY_SHADING_MODE,
static_cast<int>(MaterialShadingMode::diffuse)});
materialProps.setProperty(
Expand Down
5 changes: 2 additions & 3 deletions plugins/CircuitExplorer/plugin/io/BrickLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,7 @@ brayns::ModelDescriptorPtr BrickLoader::importFromFile(

brayns::PropertyMap materialProps;
auto name = _readString(file);
materialProps.setProperty(
{MATERIAL_PROPERTY_CAST_USER_DATA, int32_t(0)});
materialProps.setProperty({MATERIAL_PROPERTY_CAST_USER_DATA, false});
materialProps.setProperty(
{MATERIAL_PROPERTY_SHADING_MODE,
static_cast<int32_t>(MaterialShadingMode::diffuse)});
Expand Down Expand Up @@ -207,7 +206,7 @@ brayns::ModelDescriptorPtr BrickLoader::importFromFile(
int32_t userData;
file.read((char*)&userData, sizeof(int32_t));
material->updateProperty(MATERIAL_PROPERTY_CAST_USER_DATA,
userData);
static_cast<bool>(userData));

int32_t shadingMode;
file.read((char*)&shadingMode, sizeof(int32_t));
Expand Down