Main Page   Class Hierarchy   Compound List   File List   Compound Members  

thing.h

00001 /*
00002     Copyright (C) 1998-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_THING_H__
00020 #define __CS_THING_H__
00021 
00022 #include "csgeom/transfrm.h"
00023 #include "csutil/csobject.h"
00024 #include "csutil/nobjvec.h"
00025 #include "csengine/bsp.h"
00026 #include "csutil/flags.h"
00027 #include "csutil/cscolor.h"
00028 #include "csutil/csvector.h"
00029 #include "csutil/garray.h"
00030 #include "ivaria/polymesh.h"
00031 #include "iengine/viscull.h"
00032 #include "iengine/mesh.h"
00033 #include "iengine/rview.h"
00034 #include "imesh/thing/thing.h"
00035 #include "imesh/object.h"
00036 #include "imesh/lighting.h"
00037 #include "iutil/eventh.h"
00038 #include "iutil/comp.h"
00039 
00040 class csSector;
00041 class csEngine;
00042 class csStatLight;
00043 class csMaterialWrapper;
00044 class csMaterialList;
00045 class csThing;
00046 class csPolygon3D;
00047 class csPolygonInt;
00048 class csPolygonTree;
00049 class csPolygon2D;
00050 class csPolygon2DQueue;
00051 class csFrustumList;
00052 struct iShadowBlockList;
00053 struct csVisObjInfo;
00054 struct iGraphics3D;
00055 struct iRenderView;
00056 struct iMovable;
00057 struct iFrustumView;
00058 struct iMaterialWrapper;
00059 struct iPolygonBuffer;
00060 
00077 struct csThingBBox
00078 {
00079   int i1, i2, i3, i4, i5, i6, i7, i8;
00080 };
00081 
00087 struct csThingEdge
00088 {
00089   int num_polygons;
00090   int* polygon_indices;
00091 };
00092 
00114 class csThing : public csObject
00115 {
00116 private:
00118   unsigned int thing_id;
00120   static int last_thing_id;
00122   unsigned long last_polygon_id;
00123 
00125   int num_vertices;
00127   int max_vertices;
00128 
00130   csVector3* obj_verts;
00136   csVector3* wor_verts;
00138   csVector3* cam_verts;
00140   int num_cam_verts;
00142   long cameranr;
00143 
00149   long movablenr;
00153   iMovable* cached_movable;
00158   int cfg_moving;
00159 
00161   csPolygonArray polygons;
00167   csVector portal_polygons;
00168 
00173   iPolygonBuffer* polybuf;
00177   iMaterialWrapper** polybuf_materials;
00178   int polybuf_material_count;
00179 
00181   CS_DECLARE_GROWING_ARRAY (thing_edges, csThingEdge);
00183   bool thing_edges_valid;
00184 
00186   csCurvesArray curves;
00191   bool curves_transf_ok;
00192 
00194   csThingBBox* bbox;
00195 
00197   csBox3 obj_bbox;
00203   csBox3 wor_bbox;
00205   long wor_bbox_movablenr;
00206 
00208   bool obj_bbox_valid;
00209 
00211   csVector3 obj_radius;
00213   float max_obj_radius;
00214 
00219   long light_frame_number;
00220 
00222   csFog fog;
00223 
00228   csVector visobjects;
00229 
00234   csPolygonTree* static_tree;
00235 
00237   int center_idx;
00238 
00240   csThing* ParentTemplate;
00241 
00243   bool prepared;
00244 
00249   csVector3 curves_center;
00254   float curves_scale;  
00255 
00257   csVector3* curve_vertices;
00259   csVector2* curve_texels;
00260 
00262   int num_curve_vertices;
00264   int max_curve_vertices;
00265 
00266   float current_lod;
00267   uint32 current_features;
00268 
00269 public:
00271   csFlags flags;
00272 
00279   static long current_light_frame_number;
00280 
00287   int draw_busy;
00288 
00289 private:
00295   void PreparePolygonBuffer ();
00296 
00303   void DrawPolygonArrayDPM (csPolygonInt** polygon, int num,
00304         iRenderView* rview, iMovable* movable, csZBufMode zMode);
00305 
00309   static void DrawPolygonArray (csPolygonInt** polygon, int num,
00310         iRenderView* rview, csZBufMode zMode);
00311 
00317   static void* TestQueuePolygonArray (csPolygonInt** polygon, int num,
00318         iRenderView* d, csPolygon2DQueue* poly_queue, bool pvs);
00319 
00324   static void DrawOnePolygon (csPolygon3D* p, csPolygon2D* poly,
00325         iRenderView* d, csZBufMode zMode);
00326 
00331   static void* TestQueuePolygons (csThing*, csPolygonInt** polygon,
00332         int num, bool same_plane, void* data);
00333 
00338   void DrawPolygonsFromQueue (csPolygon2DQueue* queue, iRenderView* rview);
00339 
00344   static void* DrawPolygons (csThing*, csPolygonInt** polygon,
00345         int num, bool same_plane, void* data);
00346 
00351   void CheckVisUpdate (csVisObjInfo* vinf);
00352 
00357   void UpdateCurveTransform (const csReversibleTransform& movtrans);
00358 
00364   void UpdateCurveTransform ();
00365 
00367   void CleanupThingEdgeTable ();
00368 
00370   void ComputeThingEdgeTable ();
00371 
00372 public:
00376   csThing (iBase* parent);
00377 
00379   virtual ~csThing ();
00380 
00381   //----------------------------------------------------------------------
00382   // Vertex handling functions
00383   //----------------------------------------------------------------------
00384 
00386   int AddVertex (const csVector3& v) { return AddVertex (v.x, v.y, v.z); }
00387 
00389   int AddVertex (float x, float y, float z);
00390 
00399   int AddVertexSmart (const csVector3& v)
00400   {
00401     return AddVertexSmart (v.x, v.y, v.z);
00402   }
00403 
00412   int AddVertexSmart (float x, float y, float z);
00413 
00424   void CompressVertices ();
00425 
00431   void RemoveUnusedVertices ();
00432 
00434   const csVector3& Vobj (int idx) const { return obj_verts[idx]; }
00435 
00441   const csVector3& Vwor (int idx) const { return wor_verts[idx]; }
00442 
00448   const csVector3& Vcam (int idx) const { return cam_verts[idx]; }
00449 
00451   int GetVertexCount () { return num_vertices; }
00452 
00453   //----------------------------------------------------------------------
00454   // Polygon handling functions
00455   //----------------------------------------------------------------------
00456 
00458   void AddPolygon (csPolygonInt* spoly);
00459 
00461   csPolygon3D* NewPolygon (csMaterialWrapper* material);
00462 
00464   int GetPolygonCount ()
00465   { return polygons.Length (); }
00466 
00468   csPolygonInt* GetPolygonInt (int idx);
00469 
00471   csPolygon3D *GetPolygon3D (int idx)
00472   { return polygons.Get (idx); }
00473 
00475   csPolygon3D *GetPolygon3D (const char* name);
00476 
00478   csPolygonArray& GetPolygonArray () { return polygons; }
00479 
00483   unsigned long GetNewPolygonID ()
00484   {
00485     last_polygon_id++;
00486     return last_polygon_id;
00487   }
00488 
00489   //----------------------------------------------------------------------
00490   // Curve handling functions
00491   //----------------------------------------------------------------------
00492 
00494   void AddCurve (csCurve* curve);
00495 
00497   int GetCurveCount ()
00498   { return curves.Length (); }
00499 
00501   csCurve* GetCurve (int idx)
00502   { return curves.Get (idx); }
00503 
00505   iCurve* CreateCurve (iCurveTemplate* tmpl);
00506 
00508   csCurve* GetCurve (char* name);
00509 
00511   int GetCurveVertexCount () { return num_curve_vertices; }
00512 
00514   csVector3& CurveVertex (int i) { return curve_vertices[i]; }
00515 
00517   csVector3* GetCurveVertices () { return curve_vertices; }
00518 
00520   csVector2& CurveTexel (int i) { return curve_texels[i]; }
00521 
00523   int AddCurveVertex (const csVector3& v, const csVector2& t);
00524 
00526   float GetCurvesScale () { return curves_scale; }
00527 
00529   void SetCurvesScale (float f) { curves_scale = f; }
00530 
00532   const csVector3& GetCurvesCenter () { return curves_center; }
00533 
00535   void SetCurvesCenter (csVector3& v) { curves_center = v; }
00536 
00537   //----------------------------------------------------------------------
00538   // Setup
00539   //----------------------------------------------------------------------
00540 
00548   void Prepare ();
00549 
00556   void Merge (csThing* other);
00557 
00561   void MergeTemplate (iThingState* tpl,
00562         iMaterialWrapper* default_material = NULL,
00563         csVector3* shift = NULL, csMatrix3* transform = NULL);
00564 
00572   void ReplaceMaterials (iMaterialList* matList, const char* prefix);
00573 
00575   void SetTemplate (csThing *t)
00576   { ParentTemplate = t; }
00577 
00579   csThing *GetTemplate () const
00580   { return ParentTemplate; }
00581 
00582   //----------------------------------------------------------------------
00583   // Bounding information
00584   //----------------------------------------------------------------------
00585 
00595   void CreateBoundingBox ();
00596 
00598   csThingBBox* GetBoundingBox ()
00599   {
00600     if (!bbox) CreateBoundingBox ();
00601     return bbox;
00602   }
00603 
00607   void GetTransformedBoundingBox (
00608         const csReversibleTransform& trans, csBox3& cbox);
00609 
00613   float GetScreenBoundingBox (
00614         float fov, float sx, float sy,
00615         const csReversibleTransform& trans, csBox2& sbox, csBox3& cbox);
00616 
00621   void GetBoundingBox (csBox3& box);
00622 
00626   void GetBoundingBox (iMovable* movable, csBox3& box);
00627 
00631   void GetRadius (csVector3& rad, csVector3& cent);
00632 
00638   void AddPortalPolygon (csPolygon3D* poly);
00639 
00643   void RemovePortalPolygon (csPolygon3D* poly);
00644 
00645   //----------------------------------------------------------------------
00646   // Visibility culler
00647   //----------------------------------------------------------------------
00648 
00652   csPolygonTree* GetStaticTree () { return static_tree; }
00653 
00660   void BuildStaticTree (const char* name, int mode = BSP_MINIMIZE_SPLITS);
00661 
00663   void RegisterVisObject (iVisibilityObject* visobj);
00665   void UnregisterVisObject (iVisibilityObject* visobj);
00666 
00672   bool VisTest (iRenderView* irview);
00673 
00674   //----------------------------------------------------------------------
00675   // Shadow System
00676   //----------------------------------------------------------------------
00677 
00679   void RegisterShadowReceiver (iShadowReceiver* receiver);
00681   void UnregisterShadowReceiver (iShadowReceiver* receiver);
00682 
00686   void CastShadows (iFrustumView* fview);
00687 
00688   //----------------------------------------------------------------------
00689   // Drawing
00690   //----------------------------------------------------------------------
00691   
00695   bool DrawTest (iRenderView* rview, iMovable* movable);
00696 
00700   bool Draw (iRenderView* rview, iMovable* movable, csZBufMode zMode);
00701 
00705   bool DrawCurves (iRenderView* rview, iMovable* movable, csZBufMode zMode);
00706 
00711   bool DrawFoggy (iRenderView* rview, iMovable* movable);
00712 
00713   //----------------------------------------------------------------------
00714   // Lighting
00715   //----------------------------------------------------------------------
00716   
00720   void InitializeDefault ();
00721 
00725   bool ReadFromCache (int id);
00726 
00730   bool WriteToCache (int id);
00731 
00736   void PrepareLighting ();
00737 
00738   //----------------------------------------------------------------------
00739   // Utility functions
00740   //----------------------------------------------------------------------
00741 
00750   csPolygon3D* IntersectSphere (csVector3& center, float radius,
00751         float* pr = NULL);
00752 
00764   csPolygon3D* IntersectSegment (const csVector3& start, 
00765         const csVector3& end, csVector3& isect,
00766         float* pr = NULL, bool only_portals = false);
00767 
00782   csPolygon3D* IntersectSegmentFull (const csVector3& start, 
00783         const csVector3& end, csVector3& isect,
00784         float* pr = NULL, csMeshWrapper** p_mesh = NULL);
00785 
00789   void RealCheckFrustum (iFrustumView* lview, iMovable* movable);
00790 
00795   void CheckFrustum (iFrustumView* lview, iMovable* movable);
00796 
00804   void AppendShadows (iMovable* movable, iShadowBlockList* shadows,
00805         csVector3& origin);
00806 
00807   //----------------------------------------------------------------------
00808   // Transformation
00809   //----------------------------------------------------------------------
00810 
00815   void UpdateTransformation (const csTransform& c, long cam_cameranr);
00816 
00818   void WorUpdate ();
00819 
00827   void HardTransform (const csReversibleTransform& t);
00828 
00830   csVector3* GetCameraVertices (const csTransform& c, long cam_cameranr)
00831   {
00832     UpdateTransformation (c, cam_cameranr);
00833     return cam_verts;
00834   }
00835 
00836   //----------------------------------------------------------------------
00837   // Various
00838   //----------------------------------------------------------------------
00839 
00843   void SetMovingOption (int opt);
00844 
00848   int GetMovingOption () { return cfg_moving; }
00849 
00855   void SetConvex (bool c);
00856 
00862   int GetCenter () { return center_idx; }
00863 
00865   bool HasFog () { return fog.enabled; }
00866 
00868   csFog& GetFog () { return fog; }
00869 
00871   void SetFog (float density, const csColor& color)
00872   {
00873     fog.enabled = true;
00874     fog.density = density;
00875     fog.red = color.red;
00876     fog.green = color.green;
00877     fog.blue = color.blue;
00878   }
00879 
00881   void DisableFog () { fog.enabled = false; }
00882 
00883   SCF_DECLARE_IBASE_EXT (csObject);
00884 
00885   //------------------------- iThingState interface -------------------------
00886   struct ThingState : public iThingState
00887   {
00888     SCF_DECLARE_EMBEDDED_IBASE (csThing);
00889     virtual void* GetPrivateObject () { return (void*)scfParent; }
00890     virtual iObject* QueryObject () { return scfParent; }
00891     virtual void CompressVertices () { scfParent->CompressVertices(); }
00892     virtual int GetPolygonCount () { return scfParent->polygons.Length (); }
00893     virtual iPolygon3D *GetPolygon (int idx);
00894     virtual iPolygon3D *GetPolygon (const char* name);
00895     virtual iPolygon3D *CreatePolygon (const char *iName);
00896     virtual int GetPortalCount ();
00897     virtual iPortal* GetPortal (int idx);
00898     virtual iPolygon3D* GetPortalPolygon (int idx);
00899     virtual int GetVertexCount () { return scfParent->num_vertices; }
00900     virtual const csVector3 &GetVertex (int i) const
00901     { return scfParent->obj_verts[i]; }
00902     virtual const csVector3* GetVertices () const
00903     { return scfParent->obj_verts; }
00904     virtual const csVector3 &GetVertexW (int i) const
00905     { return scfParent->wor_verts[i]; }
00906     virtual const csVector3* GetVerticesW () const
00907     { return scfParent->wor_verts; }
00908     virtual const csVector3 &GetVertexC (int i) const
00909     { return scfParent->cam_verts[i]; }
00910     virtual const csVector3* GetVerticesC () const
00911     { return scfParent->cam_verts; }
00912     virtual int CreateVertex (const csVector3 &iVertex)
00913     { return scfParent->AddVertex (iVertex.x, iVertex.y, iVertex.z); }
00914     virtual void CheckFrustum (iFrustumView* fview, iMovable* movable)
00915     { scfParent->CheckFrustum (fview, movable); }
00916     virtual csFlags& GetFlags () { return scfParent->flags; }
00917     virtual int GetMovingOption ()
00918     { return scfParent->GetMovingOption (); }
00919     virtual void SetMovingOption (int opt)
00920     { scfParent->SetMovingOption (opt); }
00921     virtual const csVector3& GetCurvesCenter () const
00922     { return scfParent->curves_center; }
00923     virtual void SetCurvesCenter (const csVector3& cen)
00924     { scfParent->curves_center = cen; }
00925     virtual float GetCurvesScale ()
00926     { return scfParent->curves_scale; }
00927     virtual void SetCurvesScale (float scale)
00928     { scfParent->curves_scale = scale; }
00929     virtual int GetCurveCount ()
00930     { return scfParent->GetCurveCount (); }
00931     virtual int GetCurveVertexCount ()
00932     { return scfParent->GetCurveVertexCount (); }
00933     virtual csVector3& CurveVertex (int i)
00934     { return scfParent->CurveVertex (i); }
00935     virtual csVector3* GetCurveVertices ()
00936     { return scfParent->GetCurveVertices (); }
00937     virtual csVector2& CurveTexel (int i)
00938     { return scfParent->CurveTexel (i); }
00939     virtual iCurve* GetCurve (int idx);
00940     virtual iCurve* CreateCurve (iCurveTemplate* tmpl)
00941     {
00942       return scfParent->CreateCurve (tmpl);
00943     }
00944     virtual void MergeTemplate (iThingState* tpl,
00945         iMaterialWrapper* default_material = NULL,
00946         csVector3* shift = NULL, csMatrix3* transform = NULL)
00947     {
00948       scfParent->MergeTemplate (tpl, default_material, shift, transform);
00949     }
00950     virtual void ReplaceMaterials (iMaterialList* materials,
00951         const char* prefix)
00952     {
00953       scfParent->ReplaceMaterials (materials, prefix);
00954     }
00955     virtual void AddCurveVertex (const csVector3& v, const csVector2& uv)
00956     {
00957       scfParent->AddCurveVertex (v, uv);
00958     }
00959     virtual bool HasFog () const
00960     { return scfParent->HasFog (); }
00961     virtual csFog *GetFog () const
00962     { return &scfParent->GetFog (); }
00963   } scfiThingState;
00964   friend struct ThingState;
00965  
00966   //------------------------- iLightingInfo interface -------------------------
00967   struct LightingInfo : public iLightingInfo
00968   {
00969     SCF_DECLARE_EMBEDDED_IBASE (csThing);
00970     virtual void InitializeDefault ()
00971     {
00972       scfParent->InitializeDefault ();
00973     }
00974     virtual bool ReadFromCache (int id)
00975     {
00976       return scfParent->ReadFromCache (id);
00977     }
00978     virtual bool WriteToCache (int id)
00979     {
00980       return scfParent->WriteToCache (id);
00981     }
00982     virtual void PrepareLighting ()
00983     {
00984       scfParent->PrepareLighting ();
00985     }
00986   } scfiLightingInfo;
00987   friend struct LightingInfo;
00988 
00989   //-------------------- iPolygonMesh interface implementation ---------------
00990   struct PolyMesh : public iPolygonMesh
00991   {
00992     PolyMesh () : polygons (NULL), vertices (NULL), alloc_vertices (NULL) { }
00993     virtual ~PolyMesh () { Cleanup (); }
00994     void Setup ();
00995 
00996     SCF_DECLARE_EMBEDDED_IBASE (csThing);
00997 
00998     virtual int GetVertexCount ()
00999     {
01000       Setup ();
01001       return num_verts;
01002     }
01003     virtual csVector3* GetVertices ()
01004     {
01005       Setup ();
01006       return vertices;
01007     }
01008     virtual int GetPolygonCount ()
01009     {
01010       Setup ();
01011       return num_poly;
01012     }
01013     virtual csMeshedPolygon* GetPolygons ()
01014     {
01015       Setup ();
01016       return polygons;
01017     }
01018     virtual void Cleanup ();
01019 
01020     csMeshedPolygon* polygons;  // Array of polygons.
01021     csVector3* vertices;        // Array of vertices (points to alloc_vertices
01022                                 // or else obj_verts of scfParent).
01023     csVector3* alloc_vertices;  // Optional copy of vertices from parent.
01024                                 // This copy is used if there are curve
01025                                 // vertices.
01026     int num_poly;               // Total number of polygons.
01027     int curve_poly_start;       // Index of first polygon from curves.
01028                                 // Polygons after this index need to be
01029                                 // deleted individually.
01030     int num_verts;              // Total number of vertices.
01031   } scfiPolygonMesh;
01032   friend struct PolyMesh;
01033  
01034   //-------------------- iVisibilityCuller interface implementation ----------
01035   struct VisCull : public iVisibilityCuller
01036   {
01037     SCF_DECLARE_EMBEDDED_IBASE (csThing);
01038     virtual void Setup (const char* name)
01039     {
01040       scfParent->BuildStaticTree (name, BSP_MINIMIZE_SPLITS);
01041     }
01042     virtual void RegisterVisObject (iVisibilityObject* visobj)
01043     {
01044       scfParent->RegisterVisObject (visobj);
01045     }
01046     virtual void UnregisterVisObject (iVisibilityObject* visobj)
01047     {
01048       scfParent->UnregisterVisObject (visobj);
01049     }
01050     virtual bool VisTest (iRenderView* irview)
01051     {
01052       return scfParent->VisTest (irview);
01053     }
01054     virtual iPolygon3D* IntersectSegment (const csVector3& start,
01055       const csVector3& end, csVector3& isect, float* pr = NULL,
01056       iMeshWrapper** p_mesh = NULL);
01057     virtual bool SupportsShadowCasting ()
01058     {
01059       return true;
01060     }
01061     virtual void RegisterShadowReceiver (iShadowReceiver* receiver)
01062     {
01063       scfParent->RegisterShadowReceiver (receiver);
01064     }
01065     virtual void UnregisterShadowReceiver (iShadowReceiver* receiver)
01066     {
01067       scfParent->UnregisterShadowReceiver (receiver);
01068     }
01069     virtual void CastShadows (iFrustumView* fview)
01070     {
01071       scfParent->CastShadows (fview);
01072     }
01073   } scfiVisibilityCuller;
01074   friend struct VisCull;
01075 
01076   //-------------------- iMeshObject interface implementation ----------
01077   struct MeshObject : public iMeshObject
01078   {
01079     SCF_DECLARE_EMBEDDED_IBASE (csThing);
01080     virtual iMeshObjectFactory* GetFactory () const;
01081     virtual bool DrawTest (iRenderView* rview, iMovable* movable)
01082     {
01083       return scfParent->DrawTest (rview, movable);
01084     }
01085     virtual void UpdateLighting (iLight** /*lights*/, int /*num_lights*/,
01086         iMovable* /*movable*/) { }
01087     virtual bool Draw (iRenderView* rview, iMovable* movable,
01088         csZBufMode zMode)
01089     {
01090       return scfParent->Draw (rview, movable, zMode);
01091     }
01092     virtual void SetVisibleCallback (iMeshObjectDrawCallback* /*cb*/) { }
01093     virtual iMeshObjectDrawCallback* GetVisibleCallback () const
01094     { return NULL; }
01095     virtual void GetObjectBoundingBox (csBox3& bbox,
01096         int /*type = CS_BBOX_NORMAL*/)
01097     {
01098       scfParent->GetBoundingBox (bbox);
01099     }
01100     virtual void GetRadius ( csVector3& rad, csVector3& cent) 
01101           { scfParent->GetRadius (rad,cent); }
01102     virtual void NextFrame (csTicks /*current_time*/) { }
01103     virtual bool WantToDie () const { return false; }
01104     virtual void HardTransform (const csReversibleTransform& t)
01105     {
01106       scfParent->HardTransform (t);
01107     }
01108     virtual bool SupportsHardTransform () const { return true; }
01109     virtual bool HitBeamOutline (const csVector3&, const csVector3&,
01110       csVector3&, float*)
01111     { return false; }
01112     virtual bool HitBeamObject (const csVector3& /*start*/,
01113         const csVector3& /*end*/,
01114         csVector3& /*isect*/, float* /*pr*/) { return false; }
01115     virtual long GetShapeNumber () const { return 0; /*@@@*/ }
01116   } scfiMeshObject;
01117   friend struct MeshObject;
01118 
01119   //-------------------- iMeshObjectFactory interface implementation ---------
01120   struct MeshObjectFactory : public iMeshObjectFactory
01121   {
01122     SCF_DECLARE_EMBEDDED_IBASE (csThing);
01123     virtual iMeshObject* NewInstance ();
01124     virtual void HardTransform (const csReversibleTransform& t)
01125     {
01126       scfParent->HardTransform (t);
01127     }
01128     virtual bool SupportsHardTransform () const { return true; }
01129   } scfiMeshObjectFactory;
01130   friend struct MeshObjectFactory;
01131 };
01132 
01137 class csThingObjectType : public iMeshObjectType
01138 {
01139 private:
01140   iObjectRegistry* object_reg;
01141 
01148   csNamedObjVector planes;
01149 
01154   csNamedObjVector curve_templates;
01155 
01156 public:
01157   SCF_DECLARE_IBASE;
01158 
01160   csThingObjectType (iBase*);
01161 
01163   virtual ~csThingObjectType ();
01164 
01166   virtual bool Initialize (iObjectRegistry *object_reg);
01167 
01169   virtual iMeshObjectFactory* NewFactory ();
01170 
01171   iPolyTxtPlane* CreatePolyTxtPlane (const char* name = NULL);
01172   iPolyTxtPlane* FindPolyTxtPlane (const char* name);
01173   iCurveTemplate* CreateBezierTemplate (const char* name = NULL);
01174   iCurveTemplate* FindCurveTemplate (const char *iName);
01175 
01176   struct eiThingEnvironment : public iThingEnvironment
01177   {
01178     SCF_DECLARE_EMBEDDED_IBASE(csThingObjectType);
01179     virtual iPolyTxtPlane* CreatePolyTxtPlane (const char* name = NULL)
01180     {
01181       return scfParent->CreatePolyTxtPlane (name);
01182     }
01183     virtual iPolyTxtPlane* FindPolyTxtPlane (const char* name)
01184     {
01185       return scfParent->FindPolyTxtPlane (name);
01186     }
01187     virtual iCurveTemplate* CreateBezierTemplate (const char* name = NULL)
01188     {
01189       return scfParent->CreateBezierTemplate (name);
01190     }
01191     virtual iCurveTemplate* FindCurveTemplate (const char* name)
01192     {
01193       return scfParent->FindCurveTemplate (name);
01194     }
01195   } scfiThingEnvironment;
01196 
01197   struct eiComponent : public iComponent
01198   {
01199     SCF_DECLARE_EMBEDDED_IBASE(csThingObjectType);
01200     virtual bool Initialize (iObjectRegistry* p)
01201     { return scfParent->Initialize(p); }
01202   } scfiComponent;
01203 };
01204 
01205 #endif // __CS_THING_H__

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