32 #if !defined(LoadPLY_INCLUDE_ONCE) 33 #define LoadPLY_INCLUDE_ONCE 121 PlyScalar(): mScalarType(PlyError) { mData.mDouble = 0; }
126 float getAsFloat()
const;
127 int getAsInt()
const;
151 const std::vector<PlyScalar>&
scalars()
const {
return mScalars; }
152 std::vector<PlyScalar>&
scalars() {
return mScalars; }
159 for(
unsigned i=0; i<scalars().size(); ++i)
161 scalars()[i].setScalarType(scalarType());
162 scalars()[i].read(file,le);
171 for(
unsigned i=0; i<scalars().size(); ++i)
173 scalars()[i].setScalarType(scalarType());
174 scalars()[i].read(text);
189 const std::vector< ref<PlyPropertyAbstract> >&
properties()
const {
return mProperties; }
190 std::vector< ref<PlyPropertyAbstract> >&
properties() {
return mProperties; }
195 for(
unsigned int i=0; i<mProperties.size(); ++i)
196 mProperties[i]->read(file, le);
200 for(
unsigned int i=0; i<mProperties.size(); ++i)
201 mProperties[i]->read(text);
206 if (mVertex[0]) v.
x() = mVertex[0]->getAsFloat();
207 if (mVertex[1]) v.
y() = mVertex[1]->getAsFloat();
208 if (mVertex[2]) v.
z() = mVertex[2]->getAsFloat();
214 if (mNormal[0]) v.
x() = mNormal[0]->getAsFloat();
215 if (mNormal[1]) v.
y() = mNormal[1]->getAsFloat();
216 if (mNormal[2]) v.
z() = mNormal[2]->getAsFloat();
222 if (mColor[0]) v.
r() = (
unsigned char)mColor[0]->getAsInt();
223 if (mColor[1]) v.
g() = (
unsigned char)mColor[1]->getAsInt();
224 if (mColor[2]) v.
b() = (
unsigned char)mColor[2]->getAsInt();
225 if (mColor[3]) v.
a() = (
unsigned char)mColor[3]->getAsInt();
242 const std::vector< ref<PlyElement> >&
elements()
const {
return mElements; }
243 std::vector< ref<PlyElement> >&
elements() {
return mElements; }
249 EType translateType(
const String& type);
250 void analyzeHeader();
std::vector< ref< PlyScalar > > mNormal
An abstract class representing a file.
void setScalarType(EType type)
std::vector< unsigned int > mIndices
The String class implements an advanced UTF16 (Unicode BMP) string manipulation engine.
const T_Scalar & z() const
void setName(const String &name)
const T_Scalar & r() const
virtual void read(VirtualFile *file, bool le)
const std::vector< PlyScalar > & scalars() const
ref< ArrayFloat3 > mNormals
The Vector4 class is a template class that implements a generic 4 components vector, see also vl::fvec4, vl::dvec4, vl::uvec4, vl::ivec4, vl::svec4, vl::usvec4, vl::bvec4, vl::ubvec4.
ref< ResourceDatabase > loadResource(const String &path) const
const String & name() const
#define VL_INSTRUMENT_CLASS(ClassName, BaseClass)
The LoadWriterPLY class is a ResourceLoadWriter capable of reading PLY files.
virtual void read(TextStream *text)
const std::vector< ref< PlyElement > > & elements() const
ref< ResourceDatabase > loadResource(VirtualFile *file) const
Visualization Library main namespace.
const String & name() const
void setScalarType(EType type)
The TextStream class can be used to conveniently read or parse utf8-encoded text files.
const T_Scalar & g() const
bool writeResource(const String &, ResourceDatabase *) const
Not supported yet.
std::vector< ref< PlyElement > > mElements
The base class for all the reference counted objects.
const T_Scalar & y() const
bool littleEndian() const
void setCountType(EType type)
std::vector< PlyScalar > & scalars()
bool writeResource(VirtualFile *, ResourceDatabase *) const
Not supported yet.
ref< ArrayUByte4 > mColors
const T_Scalar & b() const
#define VLGRAPHICS_EXPORT
std::vector< PlyScalar > mScalars
virtual void read(TextStream *text)
virtual void read(VirtualFile *file, bool le)
std::vector< ref< PlyScalar > > mVertex
std::vector< ref< PlyScalar > > mColor
const T_Scalar & x() const
VLGRAPHICS_EXPORT ref< ResourceDatabase > loadPLY(VirtualFile *file)
The ref<> class is used to reference-count an Object.
std::vector< ref< PlyPropertyAbstract > > mProperties
std::vector< ref< PlyElement > > & elements()
void setName(const String &name)
The ResourceLoadWriter class is an abstract class used to implement read/write support for one or mor...
void setElemCount(int count)
const std::vector< ref< PlyPropertyAbstract > > & properties() const
ref< ArrayFloat3 > mVerts
virtual void read(VirtualFile *file, bool le)
The ResourceDatabase class contains and manipulates a set of resources.
std::vector< ref< PlyPropertyAbstract > > & properties()
const T_Scalar & a() const