/* 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 _ddgTexture_Class_ #define _ddgTexture_Class_ #include "math/ddgvec.h" #include "struct/ddgimage.h" #include "struct/ddgcolor.h" class WEXP ddgTexture { public: enum Mode{ DECAL = 0, MODULATE, BLEND }; private: ddgImage *_image; float _scalewidth; float _scaleheight; bool _linear:1; bool _repeat:1; Mode _mode; ddgVector4 _color; unsigned int _textureID; public: ddgTexture( ddgImage *i = 0, bool l = false, bool r = true, Mode m = DECAL) : _mode(m), _linear(l), _repeat(r), _image(i), _color(1,1,1,1), _scalewidth(i->cols()), _scaleheight(i->rows()) { } bool init(void); void linear( bool l ) { _linear = l; } void repeat( bool r ) { _repeat = r; } bool activate(void); bool deactivate(void); void scale( float w, float h) { _scalewidth = w; _scaleheight = h; } void mode( Mode m, ddgColor4 *c = NULL) { _mode = m; if (c) { _color.v[0] = c->v[0]/255.0; _color.v[1] = c->v[1]/255.0; _color.v[2] = c->v[2]/255.0; _color.v[3] = c->v[3]/255.0; } } ddgImage *image(void) { return _image; } ddgVector4 *color(void) { return &_color; } }; #endif