Google

Main Page   Class Hierarchy   Compound List   File List   Compound Members  

polytmap.h

00001 /*
00002     Copyright (C) 1999-2001 by Jorrit Tyberghein
00003 
00004     This library is free software; you can redistribute it and/or
00005     modify it under the terms of the GNU Library General Public
00006     License as published by the Free Software Foundation; either
00007     version 2 of the License, or (at your option) any later version.
00008 
00009     This library is distributed in the hope that it will be useful,
00010     but WITHOUT ANY WARRANTY; without even the implied warranty of
00011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012     Library General Public License for more details.
00013 
00014     You should have received a copy of the GNU Library General Public
00015     License along with this library; if not, write to the Free
00016     Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00017 */
00018 
00019 #ifndef __CS_POLYTMAP_H__
00020 #define __CS_POLYTMAP_H__
00021 
00022 #include "csgeom/transfrm.h"
00023 #include "csutil/csobject.h"
00024 #include "imesh/thing/polytmap.h"
00025 
00026 
00027 SCF_VERSION (csPolyTxtPlane, 0, 0, 1);
00028 
00034 class csPolyTxtPlane : public csObject
00035 {
00037   friend class csPolygon2D;
00039   friend class csPolyTexture;
00040 
00041 private:
00043   csMatrix3 m_obj2tex;
00045   csVector3 v_obj2tex;
00046 
00048   csMatrix3 m_world2tex;
00050   csVector3 v_world2tex;
00051 
00053   virtual ~csPolyTxtPlane ();
00054 
00055 public:
00057   csPolyTxtPlane ();
00058 
00063   void ObjectToWorld (const csReversibleTransform& obj);
00064 
00068   void HardTransform (const csReversibleTransform& obj);
00069 
00075   void WorldToCamera (const csReversibleTransform& t,
00076         csMatrix3& m_cam2tex, csVector3& v_cam2tex);
00077 
00081   void GetObjectToTexture (csMatrix3*& m_obj2tex, csVector3*& v_obj2tex)
00082   {
00083     m_obj2tex = &this->m_obj2tex;
00084     v_obj2tex = &this->v_obj2tex;
00085   }
00086 
00090   void GetWorldToTexture (csMatrix3*& m_wor2tex, csVector3*& v_wor2tex)
00091   {
00092     m_wor2tex = &this->m_world2tex;
00093     v_wor2tex = &this->v_world2tex;
00094   }
00095 
00097   void SetTextureSpace (const csVector3& v_orig,
00098                         const csVector3& v1, float len1,
00099                         const csVector3& v2, float len2);
00101   void SetTextureSpace (const csPlane3& plane_wor,
00102                         float xo, float yo, float zo,
00103                         float x1, float y1, float z1,
00104                         float len);
00106   void SetTextureSpace (const csPlane3& plane_wor,
00107                         const csVector3& v_orig,
00108                         const csVector3& v1, float len);
00110   void SetTextureSpace (const csVector3& v_orig,
00111                         const csVector3& v_u,
00112                         const csVector3& v_v);
00114   void SetTextureSpace (float xo, float yo, float zo,
00115                         float xu, float yu, float zu,
00116                         float xv, float yv, float zv);
00118   void SetTextureSpace (float xo, float yo, float zo,
00119                         float xu, float yu, float zu,
00120                         float xv, float yv, float zv,
00121                         float xw, float yw, float zw);
00123   void SetTextureSpace (const csMatrix3& tx_matrix,
00124                         const csVector3& tx_vector);
00125 
00127   void GetTextureSpace (csMatrix3& tx_matrix, csVector3& tx_vector);
00128 
00129   SCF_DECLARE_IBASE_EXT (csObject);
00130 
00131   //----------------- iPolyTxtPlane interface implementation -----------------
00132   struct PolyTxtPlane : public iPolyTxtPlane
00133   {
00134     SCF_DECLARE_EMBEDDED_IBASE (csPolyTxtPlane);
00135 
00136     virtual iObject *QueryObject()
00137     {
00138       return scfParent;
00139     }
00140     virtual csPolyTxtPlane* GetPrivateObject ()
00141     {
00142       return (csPolyTxtPlane*)scfParent;
00143     }
00144     virtual void SetTextureSpace (const csVector3& v_orig,
00145                         const csVector3& v1, float len1,
00146                         const csVector3& v2, float len2)
00147     {
00148       scfParent->SetTextureSpace (v_orig, v1, len1, v2, len2);
00149     }
00150     virtual void SetTextureSpace (const csMatrix3& tx_matrix,
00151                         const csVector3& tx_vector)
00152     {
00153       scfParent->SetTextureSpace (tx_matrix, tx_vector);
00154     }
00155     virtual void GetTextureSpace (csMatrix3& tx_matrix, csVector3& tx_vector)
00156     {
00157       scfParent->GetTextureSpace (tx_matrix, tx_vector);
00158     }
00159   } scfiPolyTxtPlane;
00160   friend struct PolyTxtPlane;
00161 };
00162 
00163 #endif // __CS_POLYTMAP_H__

Generated for Crystal Space by doxygen 1.2.5 written by Dimitri van Heesch, ©1997-2000