root/OpenSceneGraph/trunk/src/osgPlugins/ply/vertexData.h @ 10012

Revision 10012, 2.1 kB (checked in by robert, 6 years ago)

From Santosh Gaikwad, ply plugin, based on Equalizer and other LGPL compatible sources.

"Attached is the osg-plugin for reading ply ( Stanford Triangle Format ) file. I have written the plugin according to OSG standard and have also added cmake build system. The plugin is working fine on both Linux and Windows and should behave similarly on other OS as well."

"I developed this plugin while working on a project based on Equalizer. So VertexData? which I am using is taken from equalizer and modified to make them work as separate OSG plugin.
Before contributing this plugin to OSG community, I asked project manager of Equalizer project Stefen regarding potential licensing issues and this is what he has said

"The kd-Tree (VertexBuffer?*) is LGPL-licensed, and the base ply loader (ply*) is BSD. As long as you leave the copyright notices intact, there is no issue."

so I think using these files in OSG should not be a problem.

As far as author of ReaderWriterPLY.cpp is concerned I am the author. I am working for Darshan3d which is a subsidiary of VizExperts? thats why I have put VizExperts? copyright."

RevLine 
[10012]1/* 
2    vertexData.h
3    Copyright (c) 2007, Tobias Wolf <twolf@access.unizh.ch>
4    All rights reserved. 
5   
6    Header file of the VertexData class.
7*/
8
9/** note, derived from Equalizer LGPL source.*/
10
11
12#ifndef MESH_VERTEXDATA_H
13#define MESH_VERTEXDATA_H
14
15
16#include <osg/Node>
17#include <osg/PrimitiveSet>
18
19#include <vector>
20
21///////////////////////////////////////////////////////////////////////////////
22//!
23//! \class VertexData
24//! \brief helps to read ply file and converts in to osg::Node format
25//!
26///////////////////////////////////////////////////////////////////////////////
27
28// defined elsewhere
29class PlyFile;
30
31namespace ply
32{
33    /*  Holds the flat data and offers routines to read, scale and sort it.  */
34    class VertexData
35    {
36    public:
37        // Default constructor
38        VertexData();
39       
40        // Reads ply file and convert in to osg::Node and returns the same
41        osg::Node* readPlyFile( const char* file, const bool ignoreColors = false );
42       
43        // to set the flag for using inverted face
44        void useInvertedFaces() { _invertFaces = true; }
45       
46    private:
47        // Function which reads all the vertices and colors if color info is
48        // given and also if the user wants that information
49        void readVertices( PlyFile* file, const int nVertices,
50                           const bool readColors );
51
52        // Reads the triangle indices from the ply file
53        void readTriangles( PlyFile* file, const int nFaces );
54
55        // Calculates the normals according to passed flag
56        // if vertexNormals is true then computes normal per vertices
57        // otherwise per triangle means per face
58        void _calculateNormals( const bool vertexNormals = true );
59       
60        bool        _invertFaces;
61
62        // Vertex array in osg format
63        osg::ref_ptr<osg::Vec3Array>   _vertices;
64        // Color array in osg format
65        osg::ref_ptr<osg::Vec4Array>   _colors;
66        // Normals in osg format
67        osg::ref_ptr<osg::Vec3Array> _normals;
68        // The indices of the faces in premitive set
69        osg::ref_ptr<osg::DrawElementsUInt> _triangles;
70    };
71}
72
73
74#endif // MESH_VERTEXDATA_H
Note: See TracBrowser for help on using the browser.