112 Log::error(
"PlyLoader: getAsFloat() error.\n");
129 Log::error(
"PlyLoader: getAsFloat() error.\n");
138 if (
name() ==
"vertex")
140 for(
unsigned int j=0; j<properties().size(); ++j)
145 if (scalar->
name() ==
"x")
148 if (scalar->
name() ==
"y")
151 if (scalar->
name() ==
"z")
154 if (scalar->
name() ==
"nx")
157 if (scalar->
name() ==
"ny")
160 if (scalar->
name() ==
"nz")
163 if (scalar->
name() ==
"red")
166 if (scalar->
name() ==
"green")
169 if (scalar->
name() ==
"blue")
172 if (scalar->
name() ==
"alpha")
186 if (ch ==
'\n' && str ==
"end_header")
196 for(
unsigned i=0; i<
mElements.size(); ++i)
197 for(
int j=0; j<
mElements[i]->elemCount(); ++j)
205 for(
unsigned i=0; i<
mElements.size(); ++i)
206 for(
int j=0; j<
mElements[i]->elemCount(); ++j)
214 if (el->
name() ==
"vertex")
216 for(
unsigned int j=0; j<el->
properties().size(); ++j)
229 if (el->
name() ==
"face")
231 for(
unsigned int j=0; j<el->
properties().size(); ++j)
234 if (list && list->
name() ==
"vertex_indices")
236 for(
int i=1; i<(int)list->
scalars().size()-1; ++i)
250 if (type ==
"int8")
return PlyChar;
else 251 if (type ==
"char")
return PlyChar;
else 252 if (type ==
"uint8")
return PlyChar;
else 253 if (type ==
"uchar")
return PlyUChar;
else 254 if (type ==
"ushort")
return PlyUShort;
else 255 if (type ==
"uint16")
return PlyUShort;
else 256 if (type ==
"short")
return PlyShort;
else 257 if (type ==
"int16")
return PlyShort;
else 258 if (type ==
"int")
return PlyInt;
else 259 if (type ==
"int32")
return PlyInt;
else 260 if (type ==
"uint")
return PlyUInt;
else 261 if (type ==
"uint32")
return PlyUInt;
else 262 if (type ==
"float")
return PlyFloat;
else 263 if (type ==
"float32")
return PlyFloat;
else 264 if (type ==
"float64")
return PlyDouble;
else 275 for(
unsigned int i=0; i<
elements().size(); ++i)
277 if (
elements()[i]->name() ==
"vertex")
279 for(
unsigned int j=0; j<
elements()[i]->properties().size(); ++j)
281 if (
elements()[i]->properties()[j]->name() ==
"x")
303 Log::error(
"PlyLoader: no vertices found.\n");
317 if (str.
trim() !=
"ply")
321 if (str.
trim() ==
"format ascii 1.0")
326 if (str.
trim() ==
"format binary_little_endian 1.0")
332 if (str.
trim() ==
"format binary_big_endian 1.0")
340 while ( (line_reader->
readLineLF(str)) && str.
trim() !=
"end_header")
357 if (prop_type ==
"list")
369 elements().back()->properties().push_back(scalar_list);
373 scalar_list->setName(name);
378 elements().back()->properties().push_back(prop);
379 prop->setName( str.
field(
' ',2) );
431 effect->shader()->gocMaterial()->setColorMaterialEnabled(
true);
Associates a Renderable object to an Effect and Transform.
VLCORE_EXPORT FileSystem * defFileSystem()
Returns the default FileSystem used by VisualizationLibrary.
An abstract class representing a file.
If enabled, do depth comparisons and update the depth buffer; Note that even if the depth buffer exis...
A simple String formatting class.
std::vector< unsigned int > mIndices
The String class implements an advanced UTF16 (Unicode BMP) string manipulation engine.
If enabled, use the current lighting parameters to compute the vertex color; Otherwise, simply associate the current color with each vertex, see also Material, LightModel, and Light.
virtual void read(VirtualFile *file, bool le)
int readSInt32(bool little_endian_data=true)
Reads single entry.
const std::vector< PlyScalar > & scalars() const
ref< ArrayFloat3 > mNormals
static void error(const String &message)
Use this function to provide information about run-time errors: file not found, out of memory...
void setVertexArray(ArrayAbstract *data)
Conventional vertex array.
virtual ref< VirtualFile > locateFile(const String &full_path, const String &alternate_path=String()) const
Looks for a VirtualFile on the disk and in the currently active FileSystem.
short readSInt16(bool little_endian_data=true)
Reads single entry.
void setNormalArray(ArrayAbstract *data)
Conventional normal array.
void setColorArray(const fvec4 &color)
Fills the color array with the given color.
const String & name() const
int toInt(bool hex=false) const
Returns the int number represented by the string. The conversion is done using the standard atoi() fu...
String & trim(wchar_t ch)
Removes the specified character ch from the beginning and the end of the String.
float readFloat(bool little_endian_data=true)
Reads single entry.
void setInputFile(VirtualFile *file)
virtual void close()=0
Closes the file.
EType translateType(const String &type)
The Geometry class is a Renderable that implements a polygonal mesh made of polygons, lines and points.
const std::vector< ref< PlyElement > > & elements() const
Visualization Library main namespace.
const String & name() const
const unsigned char * ptr() const
Returns the pointer to the first element of the local buffer. Equivalent to bufferObject()->ptr() ...
void newElement(PlyElement *el)
The TextStream class can be used to conveniently read or parse utf8-encoded text files.
bool readHeader(TextStream *line_reader)
const std::vector< ref< Object > > & resources() const
bool readDouble(double &d)
std::vector< ref< PlyElement > > mElements
union vl::PlyLoader::PlyScalar::@12 mData
unsigned char readUInt8()
Reads single entry.
ref< ResourceDatabase > loadPly(VirtualFile *file)
Loads a PLY file.
bool empty() const
Returns true if length() == 0.
bool littleEndian() const
bool startsWith(const String &str) const
Returns true if a String starts with the specified String str.
ref< ArrayUByte4 > mColors
arr_type * indexBuffer()
The BufferObject containing the indices used to render.
Shader * shader(int lodi=0, int pass=0)
Utility function, same as 'lod(lodi)->at(pass);'.
bool seekSet(long long offset)
Changes the current read/write position of a file.
Defines the sequence of Shader objects used to render an Actor.
void readElements(VirtualFile *file)
unsigned short readUInt16(bool little_endian_data=true)
Reads single entry.
char readSInt8()
Reads single entry.
unsigned int readUInt32(bool little_endian_data=true)
Reads single entry.
VLGRAPHICS_EXPORT ref< ResourceDatabase > loadPLY(VirtualFile *file)
The ref<> class is used to reference-count an Object.
void enable(EEnable capability)
const std::vector< ref< PlyPropertyAbstract > > & properties() const
ref< ArrayFloat3 > mVerts
String field(wchar_t separator, int field_index) const
Splits a String into a set of fields based on the specified separator and returns the filed at positi...
bool readLineLF(String &line)
Reads a LF terminated line.
The ResourceDatabase class contains and manipulates a set of resources.
double readDouble(bool little_endian_data=true)
Reads single entry.
Collection< DrawCall > & drawCalls()
Returns the list of DrawCall objects bound to a Geometry.
bool readInt(int &i, bool hex=false)