[svn] / trunk / src / examples / eqPly / plyFileIO.h Repository:
ViewVC logotype

View of /trunk/src/examples/eqPly/plyFileIO.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 743 - (download) (as text) (annotate)
Wed Jan 24 14:53:22 2007 UTC (5 months, 2 weeks ago) by eile
File size: 4773 byte(s)
First step towards Win32 support: Windows VS2005 project files, Windows XP porting w/ event handling, running eqPly with exit crashes, virtually no testing.
/* Copyright (c) 2006, Stefan Eilemann <[email protected]> 
   All rights reserved.
   Adapted code for Equalizer usage.
 */
/******************************************************************************
 *                                                                            *
 * Copyright (c) 2002 Silicon Graphics, Inc.  All Rights Reserved.            *
 *                                                                            *
 * The recipient ("Recipient") of this software, including as modified        *
 * ("Software") may reproduce, redistribute, use, and derive works from the   *
 * Software without restriction, subject to the following conditions:         *
 *                                                                            *
 * - Redistribution of the Software in any form must reproduce this entire    *
 *   notice, including as modified in accordance with these provisions        *
 *   ("Notice");                                                              *
 * - Any Recipient who modifies and subsequently redistributes the Software   *
 *   shall add information to this Notice to sufficiently identify the        *
 *   Recipient's modifications;                                               *
 * - Recipient may not use the name(s) of any previous Recipient to endorse   *
 *   or promote any products derived from the Software without prior express  *
 *   written permission from such previous Recipient.                         *
 *                                                                            *
 * THE SOFTWARE IS PROVIDED "AS IS," WITHOUT ANY EXPRESS OR IMPLIED WARRANTY  *
 * OR CONDITION, INCLUDING WITHOUT LIMITATION ANY WARRANTIES OR CONDITIONS OF *
 * MERCHANTABILITY, SECURITY, SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR  *
 * PURPOSE, AND NONINFRINGEMENT.  PATENT LICENSES, IF ANY, PROVIDED HEREIN   *
 * DO NOT APPLY TO COMBINATIONS OF THIS PROGRAM WITH OTHER SOFTWARE, OR ANY   *
 * OTHER PRODUCT WHATSOEVER.  IN NO EVENT WILL THE ORIGINATOR OR SUBSEQUENT   *
 * RECIPIENT OF THE SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,  *
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ARISING IN RELATION TO THE    *
 * SOFTWARE, ITS USE, OR THESE PROVISIONS, HOWEVER CAUSED AND ON ANY THEORY   *
 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR NEGLIGENCE OR      *
 * OTHER TORT, EVEN IF PRE-ADVISED OF THE PROSPECT OF SUCH DAMAGES.           *
 *                                                                            *
 * This Software was developed at private expense; if acquired under an       *
 * agreement with the USA government or any contractor thereto, it is         *
 * acquired as "commercial computer software" subject to the provisions of    *
 * this license agreement, as specified in (a) 48 CFR 12.212 of the FAR; or,  *
 * if acquired for Department of Defense units, (b) 48 CFR 227-7202 of the    *
 * DoD FAR Supplement; or sections succeeding thereto.                        *
 *                                                                            *
 *                                                                            *
 * Originator:  Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,               *
 * Mountain View, CA  94043.  http://www.sgi.com                              *
 *                                                                            *
 ******************************************************************************/
#ifndef __PLYFILEIO_H
#define __PLYFILEIO_H
// reads a .ply file using libply into a PlyModel
// writes binary file as cache for future loads

#include "normalFace.h"
#include "ply.h" 
#include <fstream>
#include <vector>
template<class FaceType>   class  PlyModel;
template<class VertexType> struct NormalFace;
struct ColorVertex;
class PlyFileIO
{
public:
    // methods
    static PlyModel< NormalFace<ColorVertex> > *read( const char *filename );
private:
    PlyFileIO( void ){}
    ~PlyFileIO(){}
    static PlyModel< NormalFace<ColorVertex> > *readPly( const char *filename );
    static PlyModel< NormalFace<ColorVertex> > *readBin( const char *filename );
    static void writeBin( PlyModel< NormalFace<ColorVertex> > *model, 
        const char *filename );
    static bool readPlyFile( const char *filename,
        NormalFace<ColorVertex> **faces, size_t *nFaces );
    static void readVertices( PlyFile *file, int num, bool color,
        ColorVertex *vertices );
    static void readFaces( PlyFile *file, 
                           ColorVertex *vertices, const int nVertices, 
                           NormalFace<ColorVertex> *faces, const int nFaces );
    static bool calculateNormal( NormalFace<ColorVertex> &face );
};
#endif // __PLYFILEIO_H

Back to Equalizer website
ViewVC Help
Powered by ViewVC 1.0.3