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

Revision 964, 4.7 KB checked in by igarcia, 19 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 FCDImage.h
14        This file contains the FCDImage class.
15*/
16
17#ifndef _FCD_IMAGE_H_
18#define _FCD_IMAGE_H_
19
20#include "FCDocument/FCDEntity.h"
21
22class FCDocument;
23
24/**
25        A COLLADA image.
26
27        A COLLADA image encapsulates an image file and are contained
28        within the image library. FCollada doesn't support inlined image bits.
29
30        An image is solely defined by its filename. For some
31        image types and optionally, the width, height and depth of
32        the image may be required and valid.
33
34        @ingroup FCDEffect
35*/
36class FCOLLADA_EXPORT FCDImage : public FCDEntity
37{
38private:
39        DeclareObjectType;
40
41        fstring filename;
42        uint32 width;
43        uint32 height;
44        uint32 depth;
45
46public:
47        /** Constructor: do not use directly.
48                Instead, use the FCDLibrary::AddEntity function.
49                @param document The COLLADA document that owns the image. */
50        FCDImage(FCDocument* document);
51
52        /** Destructor: do not use directly.
53                Instead, use the FCDLibrary::ReleaseEntity function. */
54        virtual ~FCDImage();
55
56        /** Retrieves the entity type for this class. This function is part
57                of the FCDEntity class interface.
58                @return The entity type: IMAGE. */
59        virtual Type GetType() const { return IMAGE; }
60
61        /** Retrieves the filename of the image file.
62                This is the image file that you should load when attempting
63                to use the image bits. FCollada will deal with the filename
64                internally and provide an absolute filename.
65                @return The filename of the image file. */
66        const fstring& GetFilename() const { return filename; }
67
68        /** Sets the filename of the image file.
69                This is the image file that you should load when attempting
70                to use the image bits. FCollada will deal with the filename
71                internally and export a relative filename.
72                @param _filename The filename of the image file. */
73        void SetFilename(const fstring& _filename) { filename = _filename; }
74
75        /** Retrieves the width of the image.
76                This parameter is useful for off-screen render targets and is
77                optional for texture image files.
78                @return The width of the image. This value will be zero to indicate
79                        that you should retrieve the width of the image from the image file. */
80        const uint32& GetWidth() const { return width; }
81
82        /** Sets the width of the image.
83                This parameter is useful for off-screen render targets and is
84                optional for texture image files.
85                @param _width The width of the image. This value can be zero to indicate
86                        that you should retrieve the width of the image from the image file. */
87        void SetWidth(uint32 _width) { width = _width; }
88
89        /** Retrieves the height of the image.
90                This parameter is useful for off-screen render targets and is
91                optional for texture image files.
92                @return The height of the image. This value will be zero to indicate
93                        that you should retrieve the height of the image from the image file. */
94        const uint32& GetHeight() const { return height; }
95
96        /** Sets the height of the image.
97                This parameter is useful for off-screen render targets and is
98                optional for texture image files.
99                @param _height The height of the image. This value can be zero to indicate
100                        that you should retrieve the width of the image from the image file. */
101        void SetHeight(uint32 _height) { height = _height; }
102
103        /** Retrieves the depth of the 3D image.
104                This parameter is optional for texture image files.
105                @return The depth of the image. This value will be zero to indicate
106                        that you should retrieve the depth of the image from the image file. */
107        const uint32& GetDepth() const { return depth; }
108
109        /** Sets the depth of the 3D image.
110                This parameter is optional for texture image files.
111                @param _depth The depth of the image. This value can be zero to indicate
112                        that you should retrieve the depth of the image from the image file. */
113        void SetDepth(uint32 _depth) { depth = _depth; }
114
115        /** [INTERNAL] Reads in the \<image\> element from a given COLLADA XML tree node.
116                @param imageNode The COLLADA XML tree node.
117                @return The status of the import. If the status is not successful,
118                        it may be dangerous to extract information from the image.*/
119        virtual FUStatus LoadFromXML(xmlNode* imageNode);
120
121        /** [INTERNAL] Writes out the \<image\> element to the given COLLADA XML tree node.
122                @param parentNode The COLLADA XML parent node in which to insert the image.
123                @return The created element XML tree node. */
124        virtual xmlNode* WriteToXML(xmlNode* parentNode) const;
125};
126
127#endif // _FCD_IMAGE_H_
Note: See TracBrowser for help on using the repository browser.