1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
|
#include "vtkUniforms.h"
#include "vtkObjectFactory.h"
//------------------------------------------------------------------------------
// Return nullptr if no override is supplied.
VTK_ABI_NAMESPACE_BEGIN
vtkAbstractObjectFactoryNewMacro(vtkUniforms);
//------------------------------------------------------------------------------
void vtkUniforms::PrintSelf(ostream& os, vtkIndent indent)
{
this->Superclass::PrintSelf(os, indent);
}
std::string vtkUniforms::TupleTypeToString(TupleType tt)
{
std::string str;
switch (tt)
{
case vtkUniforms::TupleTypeScalar:
str = "TupleTypeScalar";
break;
case vtkUniforms::TupleTypeVector:
str = "TupleTypeVector";
break;
case vtkUniforms::TupleTypeMatrix:
str = "TupleTypeMatrix";
break;
default:
str = "TupleTypeInvalid";
break;
}
return str;
}
vtkUniforms::TupleType vtkUniforms::StringToTupleType(const std::string& s)
{
if (s == "TupleTypeScalar")
{
return vtkUniforms::TupleTypeScalar;
}
else if (s == "TupleTypeVector")
{
return vtkUniforms::TupleTypeVector;
}
else if (s == "TupleTypeMatrix")
{
return vtkUniforms::TupleTypeMatrix;
}
return vtkUniforms::TupleTypeInvalid;
}
/* We only support int and float as internal data types for uniform variables */
std::string vtkUniforms::ScalarTypeToString(int scalarType)
{
if (scalarType == VTK_INT)
{
return "int";
}
else if (scalarType == VTK_FLOAT)
{
return "float";
}
return "invalid";
}
int vtkUniforms::StringToScalarType(const std::string& s)
{
if (s == "int")
{
return VTK_INT;
}
else if (s == "float")
{
return VTK_FLOAT;
}
else
{
return VTK_VOID;
}
}
VTK_ABI_NAMESPACE_END
|