Commit ab07fc0a authored by David E. DeMarle's avatar David E. DeMarle
Browse files

fixup compilation warnings

parent 15d7fd38
......@@ -44,7 +44,6 @@ namespace RTW
virtual void SetObject(RTWObject, const char *id, RTWObject other) = 0;
virtual void SetObjectAsData(RTWObject target, const char *id, RTWDataType type, RTWObject obj) = 0;
virtual void SetParam(RTWObject, const char *id, RTWDataType type, const void* mem) =0;
virtual void SetMaterial(RTWGeometry, RTWMaterial) = 0;
virtual void SetBool(RTWObject, const char *id, bool x) = 0;
virtual void SetInt(RTWObject, const char *id, int32_t x) = 0;
virtual void SetVec2i(RTWObject, const char *id, int32_t x, int32_t y) = 0;
......@@ -56,8 +55,6 @@ namespace RTW
virtual void RemoveParam(RTWObject, const char *id) = 0;
virtual RTWError SetRegion(RTWVolume, void *source, const rtw::vec3i &regionCoords, const rtw::vec3i &regionSize) = 0;
virtual void Commit(RTWObject) = 0;
virtual float RenderFrame(RTWFrameBuffer, RTWRenderer, RTWCamera, RTWWorld) = 0;
......
......@@ -253,10 +253,6 @@ namespace RTW
mem);
}
void SetMaterial(RTWGeometry geometry, RTWMaterial material) override
{
}
void SetInt(RTWObject object, const char *id, int32_t x) override
{
ospSetInt(reinterpret_cast<OSPObject>(object), id, x);
......@@ -302,11 +298,6 @@ namespace RTW
ospRemoveParam(reinterpret_cast<OSPObject>(object), id);
}
RTWError SetRegion(RTWVolume volume, void *source, const rtw::vec3i &regionCoords, const rtw::vec3i &regionSize) override
{
return static_cast<RTWError>(0);
}
void Commit(RTWObject object) override
{
ospCommit(reinterpret_cast<OSPObject>(object));
......
......@@ -135,8 +135,6 @@ std::set<RTWBackendType> rtwGetAvailableBackends();
#define ospSetParam backend->SetParam
#define ospSetObject backend->SetObject
#define ospSetObjectAsData backend->SetObjectAsData
#define ospSetMaterial backend->SetMaterial
#define ospSetRegion backend->SetRegion
#define ospRemoveParam backend->RemoveParam
......
......@@ -398,8 +398,8 @@ int TestPathTracerMaterials(int argc, char* argv[])
};
ml->AddShaderVariable("Metal 3", "ior", 58 * 3, spectrum);
// approximate
double cuEta[3] = { 0.1, 0.8, 1.1 };
double cuK[3] = { 3.5, 2.5, 2.4 };
// double cuEta[3] = { 0.1, 0.8, 1.1 };
// double cuK[3] = { 3.5, 2.5, 2.4 };
// ml->AddShaderVariable("Metal 3", "eta", 3, cuEta);
// ml->AddShaderVariable("Metal 3", "k", 3, cuK);
......
......@@ -203,9 +203,8 @@ void vtkOSPRayAMRVolumeMapperNode::Render(bool prepass)
amr->GetAMRInfo()->GetSpacing(0, spacing);
ospSetVec3f(this->OSPRayVolume, "gridSpacing", spacing[0], spacing[1], spacing[2]);
for (int i = 0; i < amrInfo->GetNumberOfLevels(); ++i)
for (unsigned int i = 0; i < amrInfo->GetNumberOfLevels(); ++i)
{
double spacing[3];
amrInfo->GetSpacing(i, spacing);
cellWidthArray.push_back(spacing[0]); // TODO - must OSP cells be cubes?
}
......
......@@ -66,8 +66,6 @@ void vtkOSPRayCompositePolyDataMapper2Node::Render(bool prepass)
vtkOSPRayRendererNode* orn =
static_cast<vtkOSPRayRendererNode*>(this->GetFirstAncestorOfType("vtkOSPRayRendererNode"));
double tstep = vtkOSPRayRendererNode::GetViewTime(orn->GetRenderer());
vtkRenderer* ren = vtkRenderer::SafeDownCast(orn->GetRenderable());
// if there are no changes, just reuse last result
vtkMTimeType inTime = aNode->GetMTime();
......
......@@ -26,26 +26,33 @@
//------------------------------------------------------------------------------
OSPTexture vtkOSPRayMaterialHelpers::NewTexture2D(RTW::Backend* backend, const osp::vec2i& size,
const OSPTextureFormat type, void* data, const uint32_t _flags, size_t sizeOf)
const OSPTextureFormat type, void* data, const uint32_t _flags)
{
auto texture = ospNewTexture("texture2d");
if (texture == nullptr)
{
return nullptr;
}
auto flags = _flags; // because the input value is declared const, use a copy
const auto texelBytes = sizeOf;
const auto totalTexels = size.x * size.y;
const auto totalBytes = totalTexels * texelBytes;
OSPDataType dataType = OSP_UNKNOWN;
if (type == OSP_TEXTURE_R32F)
{
dataType = OSP_FLOAT;
}
else if (type == OSP_TEXTURE_RGB32F)
{
dataType = OSP_VEC3F;
}
else if (type == OSP_TEXTURE_RGBA32F)
{
dataType = OSP_VEC4F;
}
else if (type == OSP_TEXTURE_R8)
{
dataType = OSP_UCHAR;
}
else if (type == OSP_TEXTURE_RGB8)
{
dataType = OSP_VEC3UC;
......@@ -55,12 +62,18 @@ OSPTexture vtkOSPRayMaterialHelpers::NewTexture2D(RTW::Backend* backend, const o
dataType = OSP_VEC4UC;
}
else
{
throw std::runtime_error("vtkOSPRayMaterialHelpers::NewTexture2D: Unknown texture format");
}
#if defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wextra"
#endif
auto data_handle = ospNewCopyData2D(data, dataType, size.x, size.y);
#if defined(__GNUC__)
#pragma GCC diagnostic pop
#endif
ospCommit(data_handle);
ospSetObject(texture, "data", data_handle);
......@@ -68,7 +81,9 @@ OSPTexture vtkOSPRayMaterialHelpers::NewTexture2D(RTW::Backend* backend, const o
ospSetInt(texture, "format", static_cast<int>(type));
if (flags & OSP_TEXTURE_FILTER_NEAREST)
{
ospSetInt(texture, "filter", OSP_TEXTURE_FILTER_NEAREST);
}
ospCommit(texture);
return texture;
......@@ -120,7 +135,7 @@ OSPTexture vtkOSPRayMaterialHelpers::VTKToOSPTexture(
t2d = vtkOSPRayMaterialHelpers::NewTexture2D(backend, osp::vec2i{ xsize + 1, ysize + 1 },
format[comps - 1], chars.empty() ? vColorTextureMap->GetScalarPointer() : chars.data(),
OSP_TEXTURE_FILTER_NEAREST, sizeof(char) * comps);
OSP_TEXTURE_FILTER_NEAREST);
}
else if (scalartype == VTK_FLOAT)
{
......@@ -147,7 +162,7 @@ OSPTexture vtkOSPRayMaterialHelpers::VTKToOSPTexture(
}
t2d = vtkOSPRayMaterialHelpers::NewTexture2D(backend, osp::vec2i{ xsize + 1, ysize + 1 },
format[comps - 1], floats.empty() ? vColorTextureMap->GetScalarPointer() : floats.data(),
OSP_TEXTURE_FILTER_NEAREST, sizeof(float) * comps);
OSP_TEXTURE_FILTER_NEAREST);
}
else
{
......@@ -193,7 +208,7 @@ OSPTexture vtkOSPRayMaterialHelpers::VTKToOSPTexture(
}
}
t2d = vtkOSPRayMaterialHelpers::NewTexture2D(backend, osp::vec2i{ xsize + 1, ysize + 1 },
format[newComps - 1], floats.data(), OSP_TEXTURE_FILTER_NEAREST, sizeof(float) * newComps);
format[newComps - 1], floats.data(), OSP_TEXTURE_FILTER_NEAREST);
}
if (t2d != nullptr)
......
......@@ -47,7 +47,7 @@ namespace vtkOSPRayMaterialHelpers
* Was promoted from OSPRay because of deprecation there.
*/
OSPTexture NewTexture2D(RTW::Backend* backend, const osp::vec2i& size, const OSPTextureFormat type,
void* data, const uint32_t _flags, size_t sizeOf);
void* data, const uint32_t _flags);
/**
* Manufacture an ospray texture from a 2d vtkImageData
......
......@@ -71,7 +71,6 @@ void vtkOSPRayMoleculeMapperNode::Render(bool prepass)
return;
}
auto oModel = orn->GetOWorld();
vtkProperty* property = act->GetProperty();
vtkMoleculeMapper* mapper = vtkMoleculeMapper::SafeDownCast(this->GetRenderable());
vtkMolecule* molecule = mapper->GetInput();
......@@ -179,7 +178,6 @@ void vtkOSPRayMoleculeMapperNode::Render(bool prepass)
vtkVector3f bondCenter;
const vtkIdType numBonds = molecule->GetNumberOfBonds();
int width = 3 + 3 + 1 + 1; // x0y0x0 x1y1z1 radius coloridx
std::vector<osp::vec4f> vertsAndRadii;
std::vector<OSPMaterial> materials;
std::vector<unsigned int> indices;
......
......@@ -257,12 +257,13 @@ OSPGeometricModel RenderAsSpheres(osp::vec3f* vertices, std::vector<unsigned int
else if (numPointColors)
{
// per point color
std::vector<osp::vec4f> perPointColor;
perPointColor = true;
std::vector<osp::vec4f> perPointColors;
for (size_t i = 0; i < numSpheres; i++)
{
perPointColor.push_back(PointColors[indexArray[i]]);
perPointColors.push_back(PointColors[indexArray[i]]);
}
_PointColors = ospNewCopyData1D(&perPointColor[0], OSP_VEC4F, numSpheres);
_PointColors = ospNewCopyData1D(&perPointColors[0], OSP_VEC4F, numSpheres);
ospCommit(_PointColors);
ospSetObject(ospGeoModel, "color", _PointColors);
ospRelease(_PointColors);
......@@ -338,7 +339,7 @@ OSPGeometricModel RenderAsCylinders(std::vector<osp::vec3f>& vertices,
std::vector<unsigned int> indices;
indices.reserve(indexArray.size() / 2);
for (int i = 0; i < indexArray.size(); i += 2)
for (unsigned int i = 0; i < indexArray.size(); i += 2)
{
indices.push_back((scaleArray != nullptr ? i * 2 : i));
}
......@@ -1267,7 +1268,6 @@ void vtkOSPRayPolyDataMapperNode::Render(bool prepass)
vtkOSPRayRendererNode* orn =
static_cast<vtkOSPRayRendererNode*>(this->GetFirstAncestorOfType("vtkOSPRayRendererNode"));
vtkRenderer* ren = vtkRenderer::SafeDownCast(orn->GetRenderable());
// if there are no changes, just reuse last result
vtkMTimeType inTime = aNode->GetMTime();
......@@ -1304,8 +1304,6 @@ void vtkOSPRayPolyDataMapperNode::RenderGeometricModels()
{
vtkOSPRayRendererNode* orn =
static_cast<vtkOSPRayRendererNode*>(this->GetFirstAncestorOfType("vtkOSPRayRendererNode"));
double tstep = vtkOSPRayRendererNode::GetViewTime(orn->GetRenderer());
auto oWorld = orn->GetOWorld();
for (auto instance : this->Instances)
{
......
......@@ -167,8 +167,8 @@ OSPTexture getOSPDepthTextureFromOpenGLPerspective(const double& fovy, const dou
// values...
osp::vec2i texSize = { static_cast<int>(glDepthBufferWidth),
static_cast<int>(glDepthBufferHeight) };
OSPTexture depthTexture = vtkOSPRayMaterialHelpers::NewTexture2D(backend, (osp::vec2i&)texSize,
OSP_TEXTURE_R32F, ospDepthBuffer, OSP_TEXTURE_FILTER_NEAREST, sizeof(float));
OSPTexture depthTexture = vtkOSPRayMaterialHelpers::NewTexture2D(
backend, (osp::vec2i&)texSize, OSP_TEXTURE_R32F, ospDepthBuffer, OSP_TEXTURE_FILTER_NEAREST);
return depthTexture;
}
......@@ -281,7 +281,7 @@ public:
return retval;
}
bool SetupPathTraceBackground(bool forbackplate, RTW::Backend* backend, OSPRenderer renderer)
bool SetupPathTraceBackground(bool forbackplate, RTW::Backend* backend)
{
vtkRenderer* ren = vtkRenderer::SafeDownCast(this->Owner->GetRenderable());
if (std::string(this->Owner->GetRendererType(ren)).find(std::string("pathtracer")) ==
......@@ -342,8 +342,8 @@ public:
ochars[2] = bg1[2] * 255;
}
t2d = vtkOSPRayMaterialHelpers::NewTexture2D(backend, osp::vec2i{ jsize, isize },
OSP_TEXTURE_RGB8, ochars.data(), 0, 3 * sizeof(char));
t2d = vtkOSPRayMaterialHelpers::NewTexture2D(
backend, osp::vec2i{ jsize, isize }, OSP_TEXTURE_RGB8, ochars.data(), 0);
}
// now apply the texture we chose above to the right place
......@@ -1006,8 +1006,6 @@ void vtkOSPRayRendererNode::Traverse(int operation)
this->Apply(operation, true);
OSPRenderer oRenderer = this->ORenderer;
// camera
// TODO: this repeated traversal to find things of particular types
// is bad, find something smarter
......@@ -1057,8 +1055,8 @@ void vtkOSPRayRendererNode::Traverse(int operation)
this->Lights.push_back(ospAmbient);
}
bool bpreused = this->Internal->SetupPathTraceBackground(true, backend, oRenderer);
bool envreused = this->Internal->SetupPathTraceBackground(false, backend, oRenderer);
bool bpreused = this->Internal->SetupPathTraceBackground(true, backend);
bool envreused = this->Internal->SetupPathTraceBackground(false, backend);
this->Internal->lBackgroundMode = vtkOSPRayRendererNode::GetBackgroundMode(
static_cast<vtkRenderer*>(this->Renderable)); // save it only once both of the above check
bool bgreused = envreused && bpreused;
......@@ -1248,13 +1246,14 @@ void vtkOSPRayRendererNode::Render(bool prepass)
{
if (this->Lights.size())
{
auto data = ospNewSharedData1D(this->Lights.data(), OSP_LIGHT, this->Lights.size());
auto data = ospNewSharedData1D(
this->Lights.data(), OSP_LIGHT, static_cast<uint32_t>(this->Lights.size()));
ospCommit(data);
ospSetObject(this->OWorld, "light", data);
ospRelease(data);
}
auto instanceData =
ospNewSharedData1D(this->Instances.data(), OSP_INSTANCE, this->Instances.size());
auto instanceData = ospNewSharedData1D(
this->Instances.data(), OSP_INSTANCE, static_cast<uint32_t>(this->Instances.size()));
ospCommit(instanceData);
ospSetObject(this->OWorld, "instance", instanceData);
ospRelease(instanceData);
......@@ -1283,8 +1282,10 @@ void vtkOSPRayRendererNode::Render(bool prepass)
this->ImageY = this->Size[1];
const size_t size = this->ImageX * this->ImageY;
ospRelease(this->OFrameBuffer);
#if defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wextra"
#endif
this->OFrameBuffer = ospNewFrameBuffer(isize,
#ifdef VTKOSPRAY_ENABLE_DENOISER
OSP_FB_RGBA32F,
......@@ -1305,7 +1306,9 @@ void vtkOSPRayRendererNode::Render(bool prepass)
ospSetFloat(this->OFrameBuffer, "gamma", 1.0f);
ospCommit(this->OFrameBuffer);
ospFrameBufferClear(this->OFrameBuffer);
#if defined(__GNUC__)
#pragma GCC diagnostic pop
#endif
this->Buffer.resize(this->Size[0] * this->Size[1] * 4);
this->ZBuffer.resize(this->Size[0] * this->Size[1]);
if (this->CompositeOnGL)
......@@ -1449,19 +1452,27 @@ void vtkOSPRayRendererNode::Render(bool prepass)
}
if (!canReuse)
{
#if defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wextra"
#endif
ospFrameBufferClear(this->OFrameBuffer);
#if defined(__GNUC__)
#pragma GCC diagnostic pop
#endif
this->AccumulateCount = 0;
}
}
else if (!this->Accumulate)
{
#if defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wextra"
#endif
ospFrameBufferClear(this->OFrameBuffer);
#if defined(__GNUC__)
#pragma GCC diagnostic pop
#endif
}
vtkCamera* cam = vtkRenderer::SafeDownCast(this->Renderable)->GetActiveCamera();
......@@ -1523,10 +1534,14 @@ void vtkOSPRayRendererNode::Render(bool prepass)
backend->SetDepthNormalizationGL(this->OFrameBuffer, clipMin, clipMax);
}
#if defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wextra"
#endif
ospRenderFrame(this->OFrameBuffer, oRenderer, this->OCamera, this->OWorld);
#if defined(__GNUC__)
#pragma GCC diagnostic pop
#endif
// release data used to store instances and clear world
ospRelease(this->OInstanceData);
......
......@@ -355,7 +355,6 @@ void vtkOSPRayVolumeMapperNode::UpdateTransferFunction(
vtkVolumeProperty* volProperty = vol->GetProperty();
vtkColorTransferFunction* colorTF = volProperty->GetRGBTransferFunction(0);
vtkPiecewiseFunction* scalarTF = volProperty->GetScalarOpacity(0);
vtkVolumeMapper* mapper = vtkVolumeMapper::SafeDownCast(this->GetRenderable());
this->TFVals.resize(this->NumColors * 3);
this->TFOVals.resize(this->NumColors);
......
Supports Markdown
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