Commit d7d47adf authored by Ben Boeckel's avatar Ben Boeckel Committed by Kitware Robot
Browse files

Merge topic 'ospray-windows-fixes'

ff234c1f vtkOSPRayVolumeMapperNode: remove needless parameter
cb2f36f1 vtkOSPRayRendererNode: fix brace initializers
ffd11114 vtkOSPRayRendererNode: include <algorithm> for std::min/max
5a96871a vtkOSPRayRendererNode: make M_PI available on Windows
e8d03b9c vtkOSPRayPass: avoid needless memory gymnastics
322f967c vtkOSPRayPass: avoid variable length stack arrays
f9bf9de4

 vtkOSPRayPass: just use const char* up front
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Merge-request: !1969
parents 61b169a6 ff234c1f
Pipeline #26959 canceled with stage
in 0 seconds
...@@ -79,22 +79,21 @@ vtkOSPRayPass::vtkOSPRayPass() ...@@ -79,22 +79,21 @@ vtkOSPRayPass::vtkOSPRayPass()
args.push_back(arg); args.push_back(arg);
} }
int ac =args.size()+1; int ac =args.size()+1;
char* av[ac]; const char** av = new const char*[ac];
av[0] = new char[512]; av[0] = "pvOSPRay";
strcpy(av[0],"pvOSPRay\0");
for(int i=1;i < ac; i++) for(int i=1;i < ac; i++)
{ {
av[i] = new char[args[i-1].size()+1]; av[i] = args[i - 1].c_str();
strcpy(av[i], args[i-1].c_str());
} }
try try
{ {
ospInit(&ac, (const char**)av); ospInit(&ac, av);
} }
catch (std::runtime_error &vtkNotUsed(e)) catch (std::runtime_error &vtkNotUsed(e))
{ {
//todo: request addition of ospFinalize() to ospray //todo: request addition of ospFinalize() to ospray
} }
delete [] av;
} }
else else
{ {
......
...@@ -12,6 +12,11 @@ ...@@ -12,6 +12,11 @@
PURPOSE. See the above copyright notice for more information. PURPOSE. See the above copyright notice for more information.
=========================================================================*/ =========================================================================*/
#ifdef _WIN32
#define _USE_MATH_DEFINES
#endif
#include "vtkOSPRayRendererNode.h" #include "vtkOSPRayRendererNode.h"
#include "vtkCamera.h" #include "vtkCamera.h"
...@@ -31,6 +36,7 @@ ...@@ -31,6 +36,7 @@
#include "ospray/ospray.h" #include "ospray/ospray.h"
#include "ospray/version.h" #include "ospray/version.h"
#include <algorithm>
#include <cmath> #include <cmath>
namespace ospray { namespace ospray {
...@@ -41,35 +47,35 @@ namespace ospray { ...@@ -41,35 +47,35 @@ namespace ospray {
//todo: use ospray's copy instead of this //todo: use ospray's copy instead of this
inline osp::vec3f operator*(const osp::vec3f &a, const osp::vec3f &b) inline osp::vec3f operator*(const osp::vec3f &a, const osp::vec3f &b)
{ {
return (osp::vec3f){a.x*b.x, a.y*b.y, a.z*b.z}; return osp::vec3f{a.x*b.x, a.y*b.y, a.z*b.z};
} }
inline osp::vec3f operator*(const osp::vec3f &a, float b) inline osp::vec3f operator*(const osp::vec3f &a, float b)
{ {
return (osp::vec3f){a.x*b, a.y*b, a.z*b}; return osp::vec3f{a.x*b, a.y*b, a.z*b};
} }
inline osp::vec3f operator/(const osp::vec3f &a, float b) inline osp::vec3f operator/(const osp::vec3f &a, float b)
{ {
return (osp::vec3f){a.x/b, a.y/b, a.z/b}; return osp::vec3f{a.x/b, a.y/b, a.z/b};
} }
inline osp::vec3f operator*(float b, const osp::vec3f &a) inline osp::vec3f operator*(float b, const osp::vec3f &a)
{ {
return (osp::vec3f){a.x*b, a.y*b, a.z*b}; return osp::vec3f{a.x*b, a.y*b, a.z*b};
} }
inline osp::vec3f operator*=(osp::vec3f a, float b) inline osp::vec3f operator*=(osp::vec3f a, float b)
{ {
return a = (osp::vec3f){a.x*b, a.y*b, a.z*b}; return osp::vec3f{a.x*b, a.y*b, a.z*b};
} }
inline osp::vec3f operator-(const osp::vec3f& a, const osp::vec3f& b) inline osp::vec3f operator-(const osp::vec3f& a, const osp::vec3f& b)
{ {
return (osp::vec3f){a.x-b.x, a.y-b.y, a.z-b.z}; return osp::vec3f{a.x-b.x, a.y-b.y, a.z-b.z};
} }
inline osp::vec3f operator+(const osp::vec3f& a, const osp::vec3f& b) inline osp::vec3f operator+(const osp::vec3f& a, const osp::vec3f& b)
{ {
return (osp::vec3f){a.x+b.x, a.y+b.y, a.z+b.z}; return osp::vec3f{a.x+b.x, a.y+b.y, a.z+b.z};
} }
inline osp::vec3f cross(const osp::vec3f &a, const osp::vec3f &b) inline osp::vec3f cross(const osp::vec3f &a, const osp::vec3f &b)
{ {
return (osp::vec3f){a.y*b.z-a.z*b.y, return osp::vec3f{a.y*b.z-a.z*b.y,
a.z*b.x-a.x*b.z, a.z*b.x-a.x*b.z,
a.x*b.y-a.y*b.x}; a.x*b.y-a.y*b.x};
} }
......
...@@ -27,6 +27,8 @@ ...@@ -27,6 +27,8 @@
#include "vtkVolumeNode.h" #include "vtkVolumeNode.h"
#include "vtkVolumeProperty.h" #include "vtkVolumeProperty.h"
#include <algorithm>
#include "ospray/ospray.h" #include "ospray/ospray.h"
//============================================================================ //============================================================================
......
...@@ -45,7 +45,7 @@ public: ...@@ -45,7 +45,7 @@ public:
//should be controlled by VTK SampleDistance, otherwise //should be controlled by VTK SampleDistance, otherwise
//should use macros and modify self. //should use macros and modify self.
void SetSamplingRate(double rate) { this->SamplingRate = rate; } void SetSamplingRate(double rate) { this->SamplingRate = rate; }
double GetSamplingRate(double rate) { return this->SamplingRate; } double GetSamplingRate() { return this->SamplingRate; }
protected: protected:
vtkOSPRayVolumeMapperNode(); vtkOSPRayVolumeMapperNode();
......
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