Skip to content

Commit

Permalink
Minor cosmetics
Browse files Browse the repository at this point in the history
  • Loading branch information
favreau committed Mar 29, 2024
1 parent 0661aef commit 370a79a
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 21 deletions.
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,10 @@ RUN cd ${BIOEXPLORER_SRC} \
CMAKE_PREFIX_PATH=${DIST_PATH} \
LDFLAGS="-lCGAL" \
cmake .. -GNinja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DCMAKE_INSTALL_PREFIX=${DIST_PATH} \
-DCGAL_DO_NOT_WARN_ABOUT_CMAKE_BUILD_TYPE=ON \
-DPLATFORM_UNIT_TESTING_ENABLED=OFF \
-DPLATFORM_USE_CGAL=ON \
-DPLATFORM_OPTIX6_ENABLED=OFF \
-DPLATFORM_NETWORKING_ENABLED=ON \
Expand Down
6 changes: 4 additions & 2 deletions platform/engines/ospray/OSPRayModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,8 @@ void OSPRayModel::_commitCylinders(const size_t materialId)
void OSPRayModel::_commitCones(const size_t materialId)
{
auto& geometry = _createGeometry(_ospCones, materialId, OSPRAY_GEOMETRY_PROPERTY_CONES);
auto data = allocateVectorData(_geometries->_cones.at(materialId), OSP_FLOAT, _memoryManagementFlags);

auto data = allocateVectorData(_geometries->_cones.at(materialId), OSP_FLOAT, _memoryManagementFlags);
ospSetObject(geometry, OSPRAY_GEOMETRY_PROPERTY_CONES, data);
ospRelease(data);

Expand Down Expand Up @@ -417,10 +417,12 @@ void OSPRayModel::_commitFields(const size_t materialId)
return;
}

CORE_DEBUG("Fields: Committing " << field->getOctreeIndices().size() << " indices");
auto indicesBuffer = allocateVectorData(field->getOctreeIndices(), OSP_UINT, _memoryManagementFlags);
ospSetObject(geometry, OSPRAY_GEOMETRY_PROPERTY_FIELD_INDICES, indicesBuffer);
ospRelease(indicesBuffer);

CORE_DEBUG("Fields: Committing " << field->getOctreeValues().size() << " values");
auto valuesBuffer = allocateVectorData(field->getOctreeValues(), OSP_FLOAT, _memoryManagementFlags);
ospSetObject(geometry, OSPRAY_GEOMETRY_PROPERTY_FIELD_VALUES, valuesBuffer);
ospRelease(valuesBuffer);
Expand All @@ -432,7 +434,7 @@ void OSPRayModel::_commitFields(const size_t materialId)
ospSetObject(geometry, DEFAULT_COMMON_TRANSFER_FUNCTION, _ospTransferFunction);

ospCommit(geometry);
_addGeometryToModel(geometry, materialId);
ospAddGeometry(_primaryModel, geometry);

_ospFields[materialId] = geometry;
}
Expand Down
36 changes: 18 additions & 18 deletions platform/engines/ospray/ispc/geometry/Fields.ispc
Original file line number Diff line number Diff line change
Expand Up @@ -36,24 +36,24 @@ unmasked float treeWalker(const uniform Fields* uniform self, const varying int3

const uint32 begin = self->indices[index * 2];
const uint32 end = self->indices[index * 2 + 1];
const uint32 idxData = index * FIELD_POINT_DATA_SIZE;
const uint32 idx1 = index * FIELD_POINT_DATA_SIZE;

if (begin == 0 && end == 0)
return self->values[idxData + FIELD_POINT_OFFSET_VALUE] / (distance * distance);
return self->values[idx1 + FIELD_POINT_OFFSET_VALUE] / (distance * distance);

float voxelValue = 0.f;
for (uint32 childIndex = begin; childIndex <= end; ++childIndex)
{
const uint32 childIdxData = childIndex * FIELD_POINT_DATA_SIZE;
const vec3f childPosition = make_vec3f(self->values[childIdxData + FIELD_POINT_OFFSET_POSITION_X],
self->values[childIdxData + FIELD_POINT_OFFSET_POSITION_Y],
self->values[childIdxData + FIELD_POINT_OFFSET_POSITION_Z]);
const uint32 idx2 = childIndex * FIELD_POINT_DATA_SIZE;
const vec3f childPosition = make_vec3f(self->values[idx2 + FIELD_POINT_OFFSET_POSITION_X],
self->values[idx2 + FIELD_POINT_OFFSET_POSITION_Y],
self->values[idx2 + FIELD_POINT_OFFSET_POSITION_Z]);
const float d = length(point - childPosition);
if (d >= cutoff)
{
// Child is further than the cutoff distance, no need to evaluate events in the child node, we take the
// precomputed value of node instead
voxelValue += self->values[childIdxData + FIELD_POINT_OFFSET_VALUE] / (d * d);
voxelValue += self->values[idx2 + FIELD_POINT_OFFSET_VALUE] / (d * d);
}
else
// Dive into the child node and compute its contents
Expand All @@ -70,29 +70,29 @@ unmasked vec3f treeWalker3(const uniform Fields* uniform self, const varying int

const uint32 begin = self->indices[index * 2];
const uint32 end = self->indices[index * 2 + 1];
const uint32 idx = index * FIELD_VECTOR_DATA_SIZE;
const uint32 idx1 = index * FIELD_VECTOR_DATA_SIZE;

if (begin == 0 && end == 0)
return make_vec3f(self->values[idx + FIELD_VECTOR_OFFSET_DIRECTION_X],
self->values[idx + FIELD_VECTOR_OFFSET_DIRECTION_Y],
self->values[idx + FIELD_VECTOR_OFFSET_DIRECTION_Z]) /
return make_vec3f(self->values[idx1 + FIELD_VECTOR_OFFSET_DIRECTION_X],
self->values[idx1 + FIELD_VECTOR_OFFSET_DIRECTION_Y],
self->values[idx1 + FIELD_VECTOR_OFFSET_DIRECTION_Z]) /
(distance * distance);

vec3f voxelValue = make_vec3f(0.f);
for (uint32 childIndex = begin; childIndex <= end; ++childIndex)
{
uint32 idx = childIndex * FIELD_VECTOR_DATA_SIZE;
const vec3f childPosition = make_vec3f(self->values[idx + FIELD_VECTOR_OFFSET_POSITION_X],
self->values[idx + FIELD_VECTOR_OFFSET_POSITION_Y],
self->values[idx + FIELD_VECTOR_OFFSET_POSITION_Z]);
const uint32 idx2 = childIndex * FIELD_VECTOR_DATA_SIZE;
const vec3f childPosition = make_vec3f(self->values[idx2 + FIELD_VECTOR_OFFSET_POSITION_X],
self->values[idx2 + FIELD_VECTOR_OFFSET_POSITION_Y],
self->values[idx2 + FIELD_VECTOR_OFFSET_POSITION_Z]);
const float d = length(point - childPosition);
if (d >= cutoff)
{
// Child is further than the cutoff distance, no need to evaluate events in the child node, we take the
// precomputed value of node instead
const vec3f vectorDirection = make_vec3f(self->values[idx + FIELD_VECTOR_OFFSET_DIRECTION_X],
self->values[idx + FIELD_VECTOR_OFFSET_DIRECTION_Y],
self->values[idx + FIELD_VECTOR_OFFSET_DIRECTION_Z]);
const vec3f vectorDirection = make_vec3f(self->values[idx2 + FIELD_VECTOR_OFFSET_DIRECTION_X],
self->values[idx2 + FIELD_VECTOR_OFFSET_DIRECTION_Y],
self->values[idx2 + FIELD_VECTOR_OFFSET_DIRECTION_Z]);
voxelValue = voxelValue + vectorDirection / (d * d);
}
else
Expand Down

0 comments on commit 370a79a

Please sign in to comment.