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

sglBillboard.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: sglBillboard.hpp
00021  *  Created: 2 December 1998
00022  *  Summary: transform the model view matrix to effect some sort of orientation
00023  *         : behaviour before traversing the children
00024  *****************************************************************************/
00025 
00026 #ifndef __SGL_BILLBOARD_HPP
00027 #define __SGL_BILLBOARD_HPP
00028 
00029 #include <sgl.h>
00030 #include <sglVector.hpp>
00031 #include <sglMatrix.hpp>
00032 #include <sglGroup.hpp>
00033 
00034 //----------------------------------------------------------------------------
00035 
00097 class SGL_DLL_API sglBillboard : public sglGroup
00098 {
00099 public:
00101    enum ModeEnum
00102    {
00103       ePOINT_ROT_EYE,
00104       ePOINT_ROT_WORLD,  // not yet implemented
00105       eAXIAL_ROT
00106    };
00107 
00108 public:
00110    sglBillboard();
00112    virtual ~sglBillboard();
00113 
00117    const sglVec3d &getPos() const { return m_pos; }
00118 
00124    void setPos(const sglVec3d &p);
00125 
00130    const sglVec3d &getAxis() const { return m_axis; }
00131 
00137    void setAxis(const sglVec3d &v);
00138 
00142    void setMode(ModeEnum mode);
00143 
00147    ModeEnum getMode() { return m_mode; }
00148 
00149    // see sglNode::intersect(f) for details.
00150    virtual sglBound::IntersectResultEnum intersect(
00151       sglIntersectf &isector) const;
00152 
00153    // see sglNode::intersect(d) for details.
00154    virtual sglBound::IntersectResultEnum intersect(
00155       sglIntersectd &isector) const;
00156 
00157    // see sglNode::pick(f) for details.
00158    virtual void pick(sglPickf &pick_state, unsigned int cull_flags) const;
00159 
00160    // see sglNode::pick(d) for details.
00161    virtual void pick(sglPickd &pick_state, unsigned int cull_flags) const;
00162 
00163    // see sglNode::clone() for details.
00164    virtual sglNode *clone(unsigned int mode) const;
00165 
00166    // see sglObject::printInfo() for details.
00167    virtual void printInfo(ostream &ostrm, const char *indent_string) const;
00168 
00169 protected:
00170    void computeOrientation(const sglMat4f &current_mat,
00171                            sglMat4f &new_mat) const;
00172    void computeOrientation(const sglMat4d &current_mat,
00173                            sglMat4d &new_mat) const;
00174 
00175    // compute the bounding sphere
00176    virtual void computeBound();
00177 
00178    // sglNode::cull(f) for details
00179    virtual void cull(sglCull<float> &trav_state,
00180                      unsigned int cull_flags) const;
00181 
00182    // sglNode::cull(d) for details
00183    virtual void cull(sglCull<double> &trav_state,
00184                      unsigned int cull_flags) const;
00185 
00186    void copyTo(sglBillboard *dst, unsigned int mode) const;
00187 
00188 private:  // not implemented
00189    sglBillboard(const sglBillboard &);
00190    sglBillboard &operator=(const sglBillboard &);
00191 
00192 protected:
00193    ModeEnum m_mode;
00194    sglVec3d m_pos;
00195    sglVec3d m_axis;
00196 };
00197 
00198 #endif

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