/* 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 _ddgTransform_Class_ #define _ddgTransform_Class_ #include "math/ddgvec.h" #include "struct/ddggroup.h" class WEXP ddgTransform : public ddgGroup { typedef ddgGroup super; public: ddgVector3 _translate; ddgVector3 _scale; ddgVector3 _rotate; bool fTranslate:1; bool fScale:1; bool fRotate:1; bool fCylindricalBillBoard:1; bool fSphericalBillBoard:1; ddgTransform(void) { fTranslate = fScale = fRotate = fCylindricalBillBoard = fSphericalBillBoard = false; } ddgTransform(ddgVector3 *t, ddgVector3 *s = NULL, ddgVector3 *r = NULL, ddgNode *d = NULL) { fTranslate = fScale = fRotate = fCylindricalBillBoard = fSphericalBillBoard = false; if (t) translate(t); if (s) scale(s); if (r) rotate(r); if (d) add(d); } void translate( ddgVector3 *t ) { _translate.set(t); fTranslate = true; } void scale( ddgVector3 *s ) { _scale.set(s); fScale = true; } void rotate( ddgVector3 *r ) { _rotate.set(r); fRotate = true; } void cylindricalBillBoard( void ) { fCylindricalBillBoard = true; } void sphericalBillBoard( void ) { fSphericalBillBoard = true; } bool draw( ddgContext *c ); }; class WEXP ddgTranslate : public ddgTransform { public: ddgTranslate( ddgVector3 *t, ddgNode *d = NULL) : ddgTransform(t,0,0,d) {} }; class WEXP ddgScale: public ddgTransform { public: ddgScale( ddgVector3 *s, ddgNode *d = NULL) : ddgTransform(0,s,0,d) { } }; class WEXP ddgRotate : public ddgTransform { public: ddgRotate( ddgVector3 *r, ddgNode *d = NULL) : ddgTransform(0,0,r,d) { } }; #endif