Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   Related Pages  

sglScale.hpp

00001 /*****************************************************************************
00002  * SGL: A Scene Graph Library
00003  *
00004  * Copyright (C) 1997-2001  Scott McMillan   All Rights Reserved.
00005  *
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Library General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2 of the License, or (at your option) any later version.
00010  *
00011  * This library is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Library General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Library General Public
00017  * License along with this library; if not, write to the Free
00018  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00019  *****************************************************************************
00020  *     File: sglScale.hpp
00021  *  Created: 7 August 1999
00022  *  Summary: Uniform scale of the model view matrix
00023  *****************************************************************************/
00024 
00025 #ifndef __SGL_SCALE_HPP
00026 #define __SGL_SCALE_HPP
00027 
00028 #include <sgl.h>
00029 #include <sglMatrix.hpp>
00030 #include <sglGroup.hpp>
00031 
00032 //----------------------------------------------------------------------------
00033 
00051 template <class T>
00052 class SGL_DLL_API sglScale : public sglGroup
00053 {
00054 public:
00056    sglScale() : sglGroup(), m_scale(1.), m_inv_scale(1.) {}
00058    virtual ~sglScale() {}
00059 
00063    void setScale(T scale);
00064 
00068    T getScale() const { return m_scale; }
00069 
00070    // See sglNode::intersect(f) for details.
00071    virtual sglBound::IntersectResultEnum intersect(
00072       sglIntersectf &isector) const;
00073 
00074    // See sglNode::intersect(d) for details.
00075    virtual sglBound::IntersectResultEnum intersect(
00076       sglIntersectd &isector) const;
00077 
00078    // See sglNode::pick(f) for details.
00079    virtual void pick(sglPickf &pick_state, unsigned int cull_flags) const;
00080 
00081    // See sglNode::pick(d) for details.
00082    virtual void pick(sglPickd &pick_state, unsigned int cull_flags) const;
00083 
00084    // See sglNode::computeTxToParent(f) for details.
00085    virtual void computeTxToParent(sglMat4f &curr_mat) const;
00086 
00087    // See sglNode::computeTxToParent(d) for details.
00088    virtual void computeTxToParent(sglMat4d &curr_mat) const;
00089 
00090    // See sglNode::clone() for details.
00091    virtual sglNode *clone(unsigned int mode) const;
00092 
00093    // See sglObject::printInfo() for details.
00094    virtual void printInfo(ostream &ostrm, const char *indent_string) const;
00095 
00096 protected:
00097    // compute the bounding sphere
00098    virtual void computeBound();
00099 
00100    // See sglNode::cull(f) for details
00101    virtual void cull(sglCull<float> &trav_state,
00102                      unsigned int cull_flags) const;
00103 
00104    // See sglNode::cull(d) for details
00105    virtual void cull(sglCull<double> &trav_state,
00106                      unsigned int cull_flags) const;
00107 
00108    void copyTo(sglScale *dst, unsigned int mode) const;
00109 
00110 private:   // not implemented
00111    sglScale(const sglScale &);
00112    sglScale &operator=(const sglScale &);
00113 
00114 protected:
00115    T m_scale;
00116    T m_inv_scale;
00117 };
00118 
00119 //----------------------------------------------------------------------------
00120 // convenience types:
00121 //    template class 'should' only be float or double
00122 
00123 template <class T> class sglScale;
00124 
00126 typedef sglScale<float>  sglScalef;
00128 typedef sglScale<double> sglScaled;
00129 
00130 #endif

Generated at Mon Jul 1 18:00:05 2002 for SGL by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001