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

sglTranslate.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: sglTranslate.hpp
00021  *  Created: 14 November 1998
00022  *  Summary: (only) translate the model view matrix before traversing children
00023  *****************************************************************************/
00024 
00025 #ifndef __SGL_TRANSLATE_HPP
00026 #define __SGL_TRANSLATE_HPP
00027 
00028 #include <sgl.h>
00029 #include <sglMatrix.hpp>
00030 #include <sglGroup.hpp>
00031 
00032 //----------------------------------------------------------------------------
00033 
00052 template <class T>
00053 class SGL_DLL_API sglTranslate : public sglGroup
00054 {
00055 public:
00057    sglTranslate()
00058          : sglGroup(), m_no_translation_flag(true), m_translation(0.,0.,0.) {}
00059 
00061    virtual ~sglTranslate() {}
00062 
00063 
00070    void setTranslation(T x, T y, T z);
00071 
00077    void getTranslation(T &x, T &y, T &z) const;
00078 
00079    // See sglNode::intersect(f) for details.
00080    virtual sglBound::IntersectResultEnum intersect(
00081       sglIntersectf &isector) const;
00082 
00083    // See sglNode::intersect(d) for details.
00084    virtual sglBound::IntersectResultEnum intersect(
00085       sglIntersectd &isector) const;
00086 
00087    // See sglNode::pick(f) for details.
00088    virtual void pick(sglPickf &pick_state, unsigned int cull_flags) const;
00089 
00090    // See sglNode::pick(d) for details.
00091    virtual void pick(sglPickd &pick_state, unsigned int cull_flags) const;
00092 
00093    // See sglNode::computeTxToParent(f) for details.
00094    virtual void computeTxToParent(sglMat4f &curr_mat) const;
00095 
00096    // See sglNode::computeTxToParent(d) for details.
00097    virtual void computeTxToParent(sglMat4d &curr_mat) const;
00098 
00099    // See sglNode::clone() for details.
00100    virtual sglNode *clone(unsigned int mode) const;
00101 
00102    // See sglObject::printInfo() for details.
00103    virtual void printInfo(ostream &ostrm, const char *indent_string) const;
00104 
00105 protected:
00106    // compute the bounding sphere
00107    virtual void computeBound();
00108 
00109    // See sglNode::cull(f) for details
00110    virtual void cull(sglCull<float> &trav_state,
00111                      unsigned int cull_flags) const;
00112 
00113    // See sglNode::cull(d) for details
00114    virtual void cull(sglCull<double> &trav_state,
00115                      unsigned int cull_flags) const;
00116 
00117    void copyTo(sglTranslate *dst, unsigned int mode) const;
00118 
00119 private:   // not implemented
00120    sglTranslate(const sglTranslate &);
00121    sglTranslate& operator=(const sglTranslate &);
00122 
00123 protected:
00124    bool       m_no_translation_flag;
00125    sglVec3<T> m_translation;
00126 };
00127 
00128 //----------------------------------------------------------------------------
00129 // convenience types:
00130 //    template class 'should' only be float or double
00131 
00132 template <class T> class sglTranslate;
00133 
00135 typedef sglTranslate<float>  sglTranslatef;
00137 typedef sglTranslate<double> sglTranslated;
00138 
00139 #endif

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