Commit ca7c16fc authored by Carson Brownlee's avatar Carson Brownlee Committed by Carson Brownlee
Browse files

changing ospray version number to 2.1

parent 8ab98258
......@@ -56,7 +56,7 @@ vtk_module_install_headers(
if (VTK_ENABLE_OSPRAY)
vtk_module_find_package(
PACKAGE ospray
VERSION 2.0)
VERSION 2.1)
vtk_module_link(VTK::RenderingRayTracing
PUBLIC
......
......@@ -287,12 +287,13 @@ OSPGeometricModel RenderAsSpheres(osp::vec3f* vertices, std::vector<unsigned int
}
//----------------------------------------------------------------------------
OSPGeometricModel RenderAsCylinders(osp::vec3f* vertices, std::vector<unsigned int>& indexArray,
std::vector<unsigned int>& rIndexArray, double lineWidth, vtkDataArray* scaleArray,
vtkPiecewiseFunction* scaleFunction, bool useCustomMaterial, OSPMaterial actorMaterial,
vtkImageData* vColorTextureMap, int numTextureCoordinates, float* textureCoordinates,
int numCellMaterials, OSPData CellMaterials, int numPointColors, osp::vec4f* PointColors,
int numPointValueTextureCoords, float* pointValueTextureCoords, RTW::Backend* backend)
OSPGeometricModel RenderAsCylinders(std::vector<osp::vec3f>& vertices,
std::vector<unsigned int>& indexArray, std::vector<unsigned int>& rIndexArray, double lineWidth,
vtkDataArray* scaleArray, vtkPiecewiseFunction* scaleFunction, bool useCustomMaterial,
OSPMaterial actorMaterial, vtkImageData* vColorTextureMap, int numTextureCoordinates,
float* textureCoordinates, int numCellMaterials, OSPData CellMaterials, int numPointColors,
osp::vec4f* PointColors, int numPointValueTextureCoords, float* pointValueTextureCoords,
RTW::Backend* backend)
{
if (backend == nullptr)
return OSPGeometry();
......@@ -306,50 +307,78 @@ OSPGeometricModel RenderAsCylinders(osp::vec3f* vertices, std::vector<unsigned i
width = 4;
scaleOffset = 3 * sizeof(float);
}
std::vector<float> mdata(indexArray.size() * width);
std::vector<unsigned int> idata(indexArray.size());
for (size_t i = 0; i < indexArray.size(); i++)
if (width > 3)
{
mdata[i * width + 0] = static_cast<float>(vertices[indexArray[i]].x);
mdata[i * width + 1] = static_cast<float>(vertices[indexArray[i]].y);
mdata[i * width + 2] = static_cast<float>(vertices[indexArray[i]].z);
idata[i] = i;
int mat = 0;
if (numCellMaterials)
std::cout << "vtkPDMN: renderascylinders width 4\n";
std::vector<float> mdata(indexArray.size() * width);
std::vector<unsigned int> idata(indexArray.size());
for (size_t i = 0; i < indexArray.size(); i++)
{
mat = rIndexArray[i * 2];
}
else if (numPointColors)
{
// mat = indexArray[i * 2];
mdata[i * width + 0] = static_cast<float>(vertices[indexArray[i]].x);
mdata[i * width + 1] = static_cast<float>(vertices[indexArray[i]].y);
mdata[i * width + 2] = static_cast<float>(vertices[indexArray[i]].z);
// mdata[i * width + 0] = static_cast<float>(vertices[i].x);
// mdata[i * width + 1] = static_cast<float>(vertices[i].y);
// mdata[i * width + 2] = static_cast<float>(vertices[i].z);
idata[i] = i;
int mat = 0;
if (numCellMaterials)
{
// TODO: handle rIndexArray
}
else if (numPointColors)
{
// TODO: handle point color array
}
if (scaleArray != nullptr)
{
double avg =
(*scaleArray->GetTuple(indexArray[i]) + *scaleArray->GetTuple(indexArray[i])) * 0.5;
mdata[i * width + 3] = MapThroughPWF(avg, scaleFunction);
}
}
if (scaleArray != nullptr)
OSPData _mdata = ospNewCopyData1D(indexArray.size(), OSP_VEC4F, indexArray.data());
ospCommit(_mdata);
ospSetObject(ospMesh, "vertex.position_radius", _mdata);
ospRelease(_mdata);
OSPData _idata = ospNewCopyData1D(idata.size(), OSP_UINT, idata.data());
ospCommit(_idata);
ospSetObject(ospMesh, "index", _idata);
ospRelease(_idata);
}
else
{
std::cout << "vtkPDMN: renderascylinders width 3\n";
std::cout << "vertices: ";
for (auto v : vertices)
std::cout << v.x << " " << v.y << " " << v.z << std::endl;
std::cout << endl;
OSPData _mdata = ospNewCopyData1D(vertices.size(), OSP_VEC3F, vertices.data());
ospCommit(_mdata);
ospSetObject(ospMesh, "vertex.position", _mdata);
ospRelease(_mdata);
std::vector<unsigned int> itest;
for (int i = 0; i < indexArray.size(); i += 2)
{
double avg =
(*scaleArray->GetTuple(indexArray[i]) + *scaleArray->GetTuple(indexArray[i])) * 0.5;
mdata[i * width + 3] = MapThroughPWF(avg, scaleFunction);
itest.push_back(indexArray[i]);
}
std::cout << "indices: ";
for (auto i : itest)
std::cout << i << " ";
std::cout << endl;
OSPData _idata = ospNewCopyData1D(itest.size(), OSP_UINT, itest.data());
// OSPData _idata = ospNewCopyData1D(indexArray.size(), OSP_UINT, indexArray.data());
ospCommit(_idata);
ospSetObject(ospMesh, "index", _idata);
ospRelease(_idata);
}
OSPData _PointColors = nullptr;
if (numPointColors)
{
_PointColors = ospNewCopyData1D(numPointColors, OSP_VEC4F, &PointColors[0]);
}
if (width == 3)
{
OSPData _mdata = ospNewCopyData1D(indexArray.size(), OSP_VEC3F, mdata.data());
ospCommit(_mdata);
ospSetObject(ospMesh, "vertex.position", _mdata);
}
else
{
OSPData _mdata = ospNewCopyData1D(indexArray.size(), OSP_VEC4F, mdata.data());
ospCommit(_mdata);
ospSetObject(ospMesh, "vertex.position_radius", _mdata);
}
ospSetInt(ospMesh, "radius", lineWidth);
OSPData _idata = ospNewCopyData1D(indexArray.size(), OSP_UINT, idata.data());
ospSetObject(ospMesh, "index", _idata);
ospSetInt(ospMesh, "type", OSP_ROUND);
ospSetInt(ospMesh, "basis", OSP_LINEAR);
......@@ -1004,7 +1033,7 @@ void vtkOSPRayPolyDataMapperNode::ORenderPoly(void* renderer, vtkOSPRayActorNode
}
else
{
this->GeometricModels.emplace_back(vtkosp::RenderAsCylinders(vertices.data(), conn.line_index,
this->GeometricModels.emplace_back(vtkosp::RenderAsCylinders(vertices, conn.line_index,
conn.line_reverse, lineWidth, scaleArray, scaleFunction, useCustomMaterial, oMaterial,
vColorTextureMap, numTextureCoordinates, (float*)textureCoordinates.data(),
numCellMaterials, cellMaterials, numPointColors, pointColors.data(),
......@@ -1030,12 +1059,11 @@ void vtkOSPRayPolyDataMapperNode::ORenderPoly(void* renderer, vtkOSPRayActorNode
}
case VTK_WIREFRAME:
{
this->GeometricModels.emplace_back(
vtkosp::RenderAsCylinders(vertices.data(), conn.triangle_index, conn.triangle_reverse,
lineWidth, scaleArray, scaleFunction, useCustomMaterial, oMaterial, vColorTextureMap,
numTextureCoordinates, (float*)textureCoordinates.data(), numCellMaterials,
cellMaterials, numPointColors, pointColors.data(), numPointValueTextureCoords,
(float*)pointValueTextureCoords.data(), backend));
this->GeometricModels.emplace_back(vtkosp::RenderAsCylinders(vertices, conn.triangle_index,
conn.triangle_reverse, lineWidth, scaleArray, scaleFunction, useCustomMaterial, oMaterial,
vColorTextureMap, numTextureCoordinates, (float*)textureCoordinates.data(),
numCellMaterials, cellMaterials, numPointColors, pointColors.data(),
numPointValueTextureCoords, (float*)pointValueTextureCoords.data(), backend));
break;
}
default:
......@@ -1053,7 +1081,7 @@ void vtkOSPRayPolyDataMapperNode::ORenderPoly(void* renderer, vtkOSPRayActorNode
ospCommit(oMaterial2);
this->GeometricModels.emplace_back(
vtkosp::RenderAsCylinders(vertices.data(), conn2.triangle_index, conn2.triangle_reverse,
vtkosp::RenderAsCylinders(vertices, conn2.triangle_index, conn2.triangle_reverse,
lineWidth, scaleArray, scaleFunction, false, oMaterial2, vColorTextureMap, 0,
(float*)textureCoordinates.data(), numCellMaterials, cellMaterials, numPointColors,
pointColors.data(), 0, (float*)pointValueTextureCoords.data(), backend));
......@@ -1126,12 +1154,11 @@ void vtkOSPRayPolyDataMapperNode::ORenderPoly(void* renderer, vtkOSPRayActorNode
}
case VTK_WIREFRAME:
{
this->GeometricModels.emplace_back(
vtkosp::RenderAsCylinders(vertices.data(), conn.strip_index, conn.strip_reverse,
lineWidth, scaleArray, scaleFunction, useCustomMaterial, oMaterial, vColorTextureMap,
numTextureCoordinates, (float*)textureCoordinates.data(), numCellMaterials,
cellMaterials, numPointColors, pointColors.data(), numPointValueTextureCoords,
(float*)pointValueTextureCoords.data(), backend));
this->GeometricModels.emplace_back(vtkosp::RenderAsCylinders(vertices, conn.strip_index,
conn.strip_reverse, lineWidth, scaleArray, scaleFunction, useCustomMaterial, oMaterial,
vColorTextureMap, numTextureCoordinates, (float*)textureCoordinates.data(),
numCellMaterials, cellMaterials, numPointColors, pointColors.data(),
numPointValueTextureCoords, (float*)pointValueTextureCoords.data(), backend));
break;
}
default:
......@@ -1149,8 +1176,8 @@ void vtkOSPRayPolyDataMapperNode::ORenderPoly(void* renderer, vtkOSPRayActorNode
ospCommit(oMaterial2);
this->GeometricModels.emplace_back(
vtkosp::RenderAsCylinders(vertices.data(), conn2.strip_index, conn2.strip_reverse,
lineWidth, scaleArray, scaleFunction, false, oMaterial2, vColorTextureMap, 0,
vtkosp::RenderAsCylinders(vertices, conn2.strip_index, conn2.strip_reverse, lineWidth,
scaleArray, scaleFunction, false, oMaterial2, vColorTextureMap, 0,
(float*)textureCoordinates.data(), numCellMaterials, cellMaterials, numPointColors,
pointColors.data(), 0, (float*)pointValueTextureCoords.data(), backend));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment