source: NonGTP/FCollada/FCDocument/FCDGeometryInstance.h @ 964

Revision 964, 2.5 KB checked in by igarcia, 18 years ago (diff)
Line 
1/*
2        Copyright (C) 2005-2006 Feeling Software Inc.
3        MIT License: http://www.opensource.org/licenses/mit-license.php
4*/
5/*
6        Based on the FS Import classes:
7        Copyright (C) 2005-2006 Feeling Software Inc
8        Copyright (C) 2005-2006 Autodesk Media Entertainment
9        MIT License: http://www.opensource.org/licenses/mit-license.php
10*/
11
12/**
13        @file FCDGeometryInstance.h
14        This file contains the FCDGeometryInstance class.
15*/
16#ifndef _FCD_GEOMETRY_ENTITY_H_
17#define _FCD_GEOMETRY_ENTITY_H_
18
19#include "FCDocument/FCDEntityInstance.h"
20
21class FCDocument;
22class FCDMaterialInstance;
23class FCDGeometryPolygons;
24
25typedef vector<FCDMaterialInstance*> FCDMaterialInstanceList; /**< A dynamically-sized array of material instances. */
26
27/**
28        A COLLADA geometry instance.
29        It is during the instantiation of geometries that the mesh polygons
30        are attached to actual materials.
31*/
32class FCOLLADA_EXPORT FCDGeometryInstance : public FCDEntityInstance
33{
34private:
35        DeclareObjectType;
36        FCDMaterialInstanceList materials;
37
38public:
39        FCDGeometryInstance(FCDocument* document, FCDEntity* entity);
40        virtual ~FCDGeometryInstance();
41
42        // FCDEntity override for RTTI-like
43        virtual Type GetType() const { return GEOMETRY; }
44
45        // Access Bound Materials
46        FCDMaterialInstance* FindMaterialInstance(const fchar* semantic);
47        inline FCDMaterialInstance* FindMaterialInstance(const fstring& semantic) { return FindMaterialInstance(semantic.c_str()); }
48        const FCDMaterialInstance* FindMaterialInstance(const fchar* semantic) const;
49        inline const FCDMaterialInstance* FindMaterialInstance(const fstring& semantic) const { return FindMaterialInstance(semantic.c_str()); }
50        inline FCDMaterialInstanceList& GetMaterialInstanceList() { return materials; }
51        inline const FCDMaterialInstanceList& GetMaterialInstanceList() const { return materials; }
52        FCDMaterialInstance* AddMaterialInstance();
53        FCDMaterialInstance* AddMaterialInstance(FCDMaterial* material, FCDGeometryPolygons* polygons);
54        FCDMaterialInstance* AddMaterialInstance(FCDMaterial* material, const fchar* semantic);
55        inline FCDMaterialInstance* AddMaterialInstance(FCDMaterial* material, const fstring& semantic) { return AddMaterialInstance(material, semantic.c_str()); }
56        void ReleaseMaterialInstance(FCDMaterialInstance* instance);
57
58        // Load the geometry instance from the COLLADA document
59        virtual FUStatus LoadFromXML(xmlNode* instanceNode);
60
61        // Write out the instantiation information to the xml node tree
62        virtual xmlNode* WriteToXML(xmlNode* parentNode) const;
63};
64
65#endif // _FCD_GEOMETRY_ENTITY_H_
Note: See TracBrowser for help on using the repository browser.