Main Page   Class Hierarchy   Compound List   Header Files   Compound Members  

ddgterrain.h

This is the verbatim text of the ddgterrain.h include file.
/*
    Copyright (C) 1997, 1998, 1999 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 _ddgTerrain_Class_
#define _ddgTerrain_Class_

#include "render/ddgnode.h"
#include "math/ddgvec.h"
#include "struct/ddghemap.h"
#include "struct/ddgimage.h"
#include "render/ddgparam.h"
// THIS CLASS IS NOT UPTODATE

#define ddgQSIZE 32
class ddgQTree;
class WEXP ddgTerrain : public ddgNode
{
    typedef ddgNode super;
        unsigned int _qsize;
        unsigned int _tsize;
        ddgStr _hfile;
        ddgStr _nfile;
        short   _maxLOD;
        short   *_LODs;
        ddgVector3  _offset;
        ddgVector3  _scale;
        ddgQTree*   _tree;                      

public:
        ddgHeightMap    *heights;
        ddgImage                *normals;       // NO LONGER POSSIBLE TO DO THIS!
        ddgParamSet     paramset;
        ddgParamB               culling;
        ddgParamB               smooth;
        ddgParamB               debug;
        ddgParamB               lod;
        ddgParam                lodFactor;
        ddgParamB               bbox;
        ddgContext              *context;
        ddgTerrain();
        ddgTerrain( unsigned int r, unsigned int c );
        ~ddgTerrain();
        void offset( float x, float y, float z )
        { _offset.set(x,y,z); }
        ddgVector3 *offset( void )
        { return &_offset; }
        void scale( float x, float y, float z )
        { _scale.set(x,y,z); }
        ddgVector3 scale( void ) { return _scale; }
        unsigned int rows( void )
        { return heights->rows(); }
        unsigned int cols( void )
        { return heights->cols(); }
        void qsize( unsigned int q )
        { _qsize = q; _tsize=(((cols()>rows()?cols():rows())-2)/_qsize)*_qsize; }
        unsigned int qsize(void)
        { return _qsize; }
        void tsize( unsigned int t )
        { _tsize = t; }
        unsigned int tsize(void) { return _tsize; }
        void hfile( char * f)
        { _hfile.assign(f);}
        char *hfile(void)
        { return _hfile; }
        void nfile( char *f )
        { _nfile.assign(f); }
        char *nfile(void)
        { return _nfile; }
        void setLOD( unsigned int r, unsigned int c, short t)
    { _LODs[r * _tsize/_qsize + c] = t; }
        short getLOD( unsigned int r, unsigned int c )
    { 
                if (r < 0 || c < 0 || r > 3 || c >> 3) return -1;
                return _LODs[r * _tsize/_qsize + c];
        }
        short maxLOD(void)
        { return _maxLOD;}
        bool init( ddgContext *ctx );
        bool draw( ddgContext *ctx );
        int tri;
        int bcount;
        ddgContext::Quality     quality;
};

ostream& operator << ( ostream&s, ddgTerrain t );
ostream& operator << ( ostream&s, ddgTerrain* t );

class ddgQTree 
{
public:
  static ddgTerrain * t;
  unsigned short _min;
  unsigned short _max;
  ddgQTree *_quads[4];
  bool init( unsigned int l, unsigned int r, unsigned int c );
  bool visible( unsigned int l, unsigned int r, unsigned int c );
  bool draw( unsigned int l, unsigned int r, unsigned int c );
  bool drop( ddgVector3*, ddgVector3*, ddgVector3*, ddgVector3* );
};
#endif

Generated at Thu Apr 6 00:42:30 2000 for Digital Dawn Graphics Toolkit by doxygen 0.49-991205 written by Dimitri van Heesch, © 1997-1999