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

Revision 10012, 2.4 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    typedefs.h
3    Copyright (c) 2007, Tobias Wolf <twolf@access.unizh.ch>
4    All rights reserved. 
5   
6    Type definitions for the mesh classes.
7*/
8
9/** note, derived from Equalizer LGPL source.*/
10
11
12#ifndef MESH_TYPEDEFS_H
13#define MESH_TYPEDEFS_H
14
15#   ifdef WIN32
16#      include <Winsock2.h>
17#      include <Windows.h>
18#   endif
19
20#   include <osg/Notify>
21#    include <cassert>
22#   define MESHASSERT  assert
23#   define MESHERROR   osg::notify(osg::WARN)
24#   define MESHWARN    osg::notify(osg::WARN)
25#   define MESHINFO    osg::notify(osg::INFO)
26
27#ifdef WIN32
28typedef int        socklen_t;
29
30typedef UINT64     uint64_t;
31typedef INT64      int64_t;
32typedef UINT32     uint32_t;
33typedef INT32      int32_t;
34typedef UINT16     uint16_t;
35typedef UINT8      uint8_t;
36#    ifndef HAVE_SSIZE_T
37typedef SSIZE_T    ssize_t;
38#    endif
39
40#endif // Win32
41
42#include <exception>
43#include <iostream>
44#include <string>
45
46namespace ply
47{
48   
49   
50
51    typedef size_t                      Index;
52//    typedef unsigned short            ShortIndex;
53   
54   
55    // mesh exception
56    struct MeshException : public std::exception
57    {
58        explicit MeshException( const std::string& msg ) : _message( msg ) {}
59        virtual ~MeshException() throw() {}
60        virtual const char* what() const throw() { return _message.c_str(); }
61    private:
62        std::string _message;
63    };
64   
65    // null output stream that discards everything written to it
66    struct NullOStream : std::ostream
67    {
68        struct NullStreamBuf : std::streambuf
69        {
70            int overflow( int c ) { return traits_type::not_eof( c ); }
71        } _nullBuf;
72       
73        NullOStream() : std::ios( &_nullBuf ), std::ostream( &_nullBuf ) {}
74    };
75   
76    // wrapper to enable array use where arrays would not be allowed otherwise
77    template< class T, size_t d >
78    struct ArrayWrapper
79    {
80        T& operator[]( const size_t i )
81        {
82            MESHASSERT( i < d );
83            return data[i];
84        }
85       
86        const T& operator[]( const size_t i ) const
87        {
88            MESHASSERT( i < d );
89            return data[i];
90        }
91       
92    private:
93        T data[d];
94    };
95   
96   
97    // binary mesh file version, increment if changing the file format
98    const unsigned short    FILE_VERSION ( 0x0114 );
99   
100   
101    // enumeration for the sort axis
102    enum Axis
103    {
104        AXIS_X,
105        AXIS_Y,
106        AXIS_Z
107    };
108
109}
110
111
112#endif // MESH_TYPEDEFS_H
Note: See TracBrowser for help on using the browser.