## Public API Reference

- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- File List
- File Members

# imesh/instmesh.h

Go to the documentation of this file.

    00001 /*
    00002     Copyright (C) 2005 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_IMESH_INSTMESH_H__
    00020 #define __CS_IMESH_INSTMESH_H__
    00021
    00026 #include "csutil/scf.h"
    00027
    00028 struct iDocumentNode;
    00029 struct iMaterialWrapper;
    00030 struct iRenderBuffer;
    00031 struct iMeshObject;
    00032
    00036 class csBox3;
    00037 class csColor;
    00038 class csColor4;
    00039 struct csTriangle;
    00040 class csVector2;
    00041 class csVector3;
    00042
    00043 SCF_VERSION (iInstancingMeshCommonState, 0, 0, 3);
    00044
    00050 struct iInstancingMeshCommonState : public iBase
    00051 {
    00053   virtual void SetMaterialWrapper (iMaterialWrapper* material) = 0;
    00055   virtual iMaterialWrapper* GetMaterialWrapper () const = 0;
    00057   virtual void SetMixMode (uint mode) = 0;
    00059   virtual uint GetMixMode () const = 0;
    00060
    00062   virtual void SetLighting (bool l) = 0;
    00064   virtual bool IsLighting () const = 0;
    00066   virtual void SetColor (const csColor& col) = 0;
    00068   virtual const csColor& GetColor () const = 0;
    00074   virtual void SetManualColors (bool m) = 0;
    00076   virtual bool IsManualColors () const = 0;
    00081   virtual void SetShadowCasting (bool m) = 0;
    00083   virtual bool IsShadowCasting () const = 0;
    00092   virtual void SetShadowReceiving (bool m) = 0;
    00094   virtual bool IsShadowReceiving () const = 0;
    00095 };
    00096
    00097 SCF_VERSION (iInstancingMeshState, 0, 1, 0);
    00098
    00113 struct iInstancingMeshState : public iInstancingMeshCommonState
    00114 {
    00118   virtual size_t AddInstance (const csReversibleTransform& trans) = 0;
    00119
    00123   virtual void RemoveInstance (size_t id) = 0;
    00124
    00128   virtual void RemoveAllInstances () = 0;
    00129
    00133   virtual void MoveInstance (size_t id,
    00134       const csReversibleTransform& trans) = 0;
    00135
    00139   virtual const csReversibleTransform& GetInstanceTransform (size_t id) = 0;
    00140 };
    00141
    00142 SCF_VERSION (iInstancingFactoryState, 0, 3, 0);
    00143
    00144 class csSphere;
    00145
    00168 struct iInstancingFactoryState : public iInstancingMeshCommonState
    00169 {
    00173   virtual void AddVertex (const csVector3& v,
    00174       const csVector2& uv, const csVector3& normal,
    00175       const csColor4& color) = 0;
    00176
    00178   virtual size_t GetVertexCount () const = 0;
    00182   virtual const csVector3* GetVertices () = 0;
    00186   virtual const csVector2* GetTexels () = 0;
    00190   virtual const csVector3* GetNormals () = 0;
    00194   virtual const csColor4* GetColors () = 0;
    00195
    00199   virtual void AddTriangle (const csTriangle& tri) = 0;
    00200
    00202   virtual size_t GetTriangleCount () const = 0;
    00206   virtual const csTriangle* GetTriangles () = 0;
    00207
    00213   virtual void CalculateNormals (bool compress = true) = 0;
    00214
    00219   virtual void Compress () = 0;
    00220
    00226   virtual void GenerateBox (const csBox3& box) = 0;
    00227
    00239   virtual void GenerateSphere (const csEllipsoid& sphere, int rim_vertices,
    00240       bool cyl_mapping = false,
    00241       bool toponly = false,
    00242       bool reversed = false) = 0;
    00243
    00247   virtual bool IsAutoNormals () const = 0;
    00248 };
    00249
    00252 #endif // __CS_IMESH_INSTMESH_H__
    00253