Main Page   Class Hierarchy   Compound List   Header Files   Compound Members  

ddgvarr.h

This is the verbatim text of the ddgvarr.h include file.
/*
    Copyright (C) 1997, 1998, 1999, 2000 by Alex Pfaffe
        (Digital Dawn Graphics Inc)
  
    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Library General Public
    License as published by the Free Software Foundation; either
    version 2 of the License, or (at your option) any later version.
  
    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Library General Public License for more details.
  
    You should have received a copy of the GNU Library General Public
    License along with this library; if not, write to the Free
    Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef _ddgVArray_Class_
#define _ddgVArray_Class_

#include "util/ddgerror.h"
#include "math/ddgvec.h"
#include "struct/ddgcolor.h"

typedef unsigned int ddgVBIndex;
typedef float   ddgTexCoord;
class ddgTexCoord2
{
public:
        ddgTexCoord     v[2];
};

class WEXP ddgVArray 
 {
public:
        enum ddgBufType{ dummy = 0, point = 1, line = 2, triangle = 3, quad = 4 };
private:
    unsigned int _num;
    unsigned int _inum;
        unsigned int _bufsize;
        unsigned int _ibufsize;
    bool    _fTexture:1;
    bool    _fTextureCoord:1;
    bool    _fNormal:1;
    bool    _fColor:1;
    ddgBufType    _type;
public:
        ddgVBIndex *ibuf;
        ddgVector3      *vbuf;
        ddgVector2 *tbuf;
        ddgTexCoord2    *tibuf;
        ddgColor4 *cbuf;
        ddgVector3 *nbuf;
        ddgVArray( ddgBufType type = triangle);
        ~ddgVArray( void );
        bool init(void );
    inline void reset(void) { _num = 0; _inum = 0; }
    inline void size(unsigned int datasize, unsigned int indexsize) { _bufsize = datasize; _ibufsize = indexsize; }
        inline unsigned int size(void) { return _inum; }
        inline unsigned int num(void) { return _num; }
        inline void renderMode( bool t = true, bool n = true, bool c = true)
    { _fTexture = t; _fNormal = n; _fColor = c; }
        inline void compactTextureCoords( bool c ) { _fTextureCoord = c; }
        inline bool colorOn(void) { return _fColor; }
        inline bool textureOn(void) { return _fTexture; }
        inline bool normalOn(void) { return _fNormal; }
        inline unsigned int inum(void) { return _inum; }
        inline ddgBufType type(void) { return _type; }
    ddgVBIndex pushVTNC(ddgVector3 *p, ddgVector2 *t, ddgVector3 *n, ddgColor4 *c);
    ddgVBIndex pushVTN(ddgVector3 *p, ddgVector2 *t, ddgVector3 *n); 
    ddgVBIndex pushVT(ddgVector3 *p, ddgVector2 *t);
    ddgVBIndex pushVT(ddgVector3 *p, ddgTexCoord2 *t);
    ddgVBIndex pushVC(ddgVector3 *p, ddgColor4 *c);
    ddgVBIndex pushV(ddgVector3 *p);
    void pushTriangle( ddgVBIndex i1, ddgVBIndex i2, ddgVBIndex i3 );
    void pushQuad( ddgVBIndex i1, ddgVBIndex i2, ddgVBIndex i3, ddgVBIndex i4 );
    void pushLine( ddgVBIndex i1, ddgVBIndex i2 );
    void pushPoint( ddgVBIndex i1 );
        void sort(void);
};

#endif


Generated at Sun Sep 17 19:27:58 2000 for Digital Dawn Graphics Toolkit by doxygen 0.49-991205 written by Dimitri van Heesch, © 1997-1999