Moved the template function into the global namespace.
This commit is contained in:
parent
9a93d7ae06
commit
049d2055a5
@ -12,22 +12,9 @@
|
||||
#include <stdio.h>
|
||||
|
||||
using namespace osg;
|
||||
|
||||
class ReaderWriterPNM : public osgDB::ReaderWriter
|
||||
template <class T>
|
||||
unsigned char* read_bitmap_ascii(FILE* fp, int width, int height)
|
||||
{
|
||||
public:
|
||||
virtual const char* className() const { return "PNM Image Reader/Writer"; }
|
||||
virtual bool acceptsExtension(const std::string& extension) const
|
||||
{
|
||||
return osgDB::equalCaseInsensitive(extension, "pnm") ||
|
||||
osgDB::equalCaseInsensitive(extension, "ppm") ||
|
||||
osgDB::equalCaseInsensitive(extension, "pgm") ||
|
||||
osgDB::equalCaseInsensitive(extension, "pbm");
|
||||
}
|
||||
|
||||
template <class T>
|
||||
unsigned char* read_bitmap_ascii(FILE* fp, int width, int height) const
|
||||
{
|
||||
T* data = new T[width*height];
|
||||
|
||||
T* dst = data;
|
||||
@ -67,11 +54,11 @@ class ReaderWriterPNM : public osgDB::ReaderWriter
|
||||
}
|
||||
|
||||
return reinterpret_cast<unsigned char*>(data);
|
||||
}
|
||||
}
|
||||
|
||||
template <class T>
|
||||
unsigned char* read_grayscale_ascii(FILE* fp, int width, int height) const
|
||||
{
|
||||
template <class T>
|
||||
unsigned char* read_grayscale_ascii(FILE* fp, int width, int height)
|
||||
{
|
||||
T* data = new T[width*height];
|
||||
|
||||
T* dst = data;
|
||||
@ -116,11 +103,11 @@ class ReaderWriterPNM : public osgDB::ReaderWriter
|
||||
}
|
||||
|
||||
return reinterpret_cast<unsigned char*>(data);
|
||||
}
|
||||
}
|
||||
|
||||
template <class T>
|
||||
unsigned char* read_color_ascii(FILE* fp, int width, int height) const
|
||||
{
|
||||
template <class T>
|
||||
unsigned char* read_color_ascii(FILE* fp, int width, int height)
|
||||
{
|
||||
T* data = new T[3*width*height];
|
||||
|
||||
T* dst = data;
|
||||
@ -165,11 +152,11 @@ class ReaderWriterPNM : public osgDB::ReaderWriter
|
||||
}
|
||||
|
||||
return reinterpret_cast<unsigned char*>(data);
|
||||
}
|
||||
}
|
||||
|
||||
template <class T>
|
||||
unsigned char* read_bitmap_binary(FILE* fp, int width, int height) const
|
||||
{
|
||||
template <class T>
|
||||
unsigned char* read_bitmap_binary(FILE* fp, int width, int height)
|
||||
{
|
||||
T* data = new T[width*height];
|
||||
|
||||
for(int y = 0; y < height; y++)
|
||||
@ -197,11 +184,11 @@ class ReaderWriterPNM : public osgDB::ReaderWriter
|
||||
}
|
||||
|
||||
return reinterpret_cast<unsigned char*>(data);
|
||||
}
|
||||
}
|
||||
|
||||
template <class T>
|
||||
unsigned char* read_grayscale_binary(FILE* fp, int width, int height) const
|
||||
{
|
||||
template <class T>
|
||||
unsigned char* read_grayscale_binary(FILE* fp, int width, int height)
|
||||
{
|
||||
T* data = new T[width*height];
|
||||
|
||||
if (fread(data, sizeof(T)*width*height, 1, fp) != 1)
|
||||
@ -222,11 +209,11 @@ class ReaderWriterPNM : public osgDB::ReaderWriter
|
||||
}
|
||||
|
||||
return reinterpret_cast<unsigned char*>(data);
|
||||
}
|
||||
}
|
||||
|
||||
template <class T>
|
||||
unsigned char* read_color_binary(FILE* fp, int width, int height) const
|
||||
{
|
||||
template <class T>
|
||||
unsigned char* read_color_binary(FILE* fp, int width, int height)
|
||||
{
|
||||
T* data = new T[3*width*height];
|
||||
|
||||
if (fread(data, 3*sizeof(T)*width*height, 1, fp) != 1)
|
||||
@ -247,8 +234,21 @@ class ReaderWriterPNM : public osgDB::ReaderWriter
|
||||
}
|
||||
|
||||
return reinterpret_cast<unsigned char*>(data);
|
||||
}
|
||||
|
||||
class ReaderWriterPNM : public osgDB::ReaderWriter
|
||||
{
|
||||
public:
|
||||
virtual const char* className() const { return "PNM Image Reader/Writer"; }
|
||||
virtual bool acceptsExtension(const std::string& extension) const
|
||||
{
|
||||
return osgDB::equalCaseInsensitive(extension, "pnm") ||
|
||||
osgDB::equalCaseInsensitive(extension, "ppm") ||
|
||||
osgDB::equalCaseInsensitive(extension, "pgm") ||
|
||||
osgDB::equalCaseInsensitive(extension, "pbm");
|
||||
}
|
||||
|
||||
|
||||
virtual ReadResult readImage(const std::string& file, const osgDB::ReaderWriter::Options* options) const
|
||||
{
|
||||
std::string ext = osgDB::getLowerCaseFileExtension(file);
|
||||
|
Loading…
Reference in New Issue
Block a user