/* 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 _ddgCulling_Class_ #define _ddgCulling_Class_ // THIS CLASS IS NOT UPTODATE #include "util/ddgutil.h" // // Fast display techniques by Alex Pfaffe // Front to back rendering. // View frustrum culling. // - Use accurate bounding boxes TODO. // Occlusion culling. // Triangle strip generation. // Automatic LOD generation. // Use threads. // Map floats to integer space. // User glPixelZoom to render moving images. class ddgCulling { double _minx, _maxx, _miny, _maxy; int _tw; int _th; int HOMWidth; int HOMHeight; bool _HOMtest( float sx, float sy, float dx, float dy,int level,int px,int py); void *_mapBuffer; public: int polcount; int scale; int viewCulling; int buildHOM; int occlusionCulling; int HOMLimit; float HOMDepth;// The furthest Z limit of a bbox used for HOM occlusion. int minX() { return (int) _minx; } int maxX() { return (int) _maxx; } int minY() { return (int) _miny; } int maxY() { return (int) _maxy; } void boxInit() { _minx = _miny = MAXFLOAT; _maxx = _maxy = -MAXFLOAT;} void limitBoxMinX(double d) { if (d < _minx) _minx = d; } void limitBoxMaxX(double d) { if (d > _maxx) _maxx = d; } void limitBoxMinY(double d) { if (d < _miny) _miny = d; } void limitBoxMaxY(double d) { if (d > _maxy) _maxy = d; } void limitBox( float x1,float y1, float x2, float y2 ) { if ( _minx < x1 ) _minx = x1; if ( _maxx < x1 ) _maxx = x1; if ( _miny < y1 ) _miny = y1; if ( _maxy < y1 ) _maxy = y1; if ( _minx > x2 ) _minx = x2; if ( _maxx > x2 ) _maxx = x2; if ( _miny > y2 ) _miny = y2; if ( _maxy > y2 ) _maxy = y2; } void scaleBox(double w, double h); void buildHOMMap(void); bool HOMvisible(void); ddgCulling(int w = 512, int h = 512); ~ddgCulling(); void copybufToTexture(int sx, int sy, int dx, int dy ); void setupTexture(int dx, int dy); void finishTexture(void); }; extern ddgCulling cullingInfo; // Global instance. #endif