ScummVM API documentation
material.h
1/* ScummVM - Graphic Adventure Engine
2 *
3 * ScummVM is the legal property of its developers, whose names
4 * are too numerous to list here. Please refer to the COPYRIGHT
5 * file distributed with this source distribution.
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 *
20 */
21
22#ifndef GRIM_MATERIAL_H
23#define GRIM_MATERIAL_H
24
25#include "engines/grim/object.h"
26
27namespace Grim {
28
29class CMap;
30
31class Texture {
32public:
33 Texture() :
34 _width(0), _height(0), _bpp(0), _hasAlpha(false), _texture(nullptr), _data(nullptr), _isShared(false) {};
35 int _width;
36 int _height;
37 int _bpp;
38 bool _hasAlpha;
39 void *_texture;
40 uint8 *_data;
41 bool _isShared;
42};
43
45public:
46 MaterialData(const Common::String &filename, Common::SeekableReadStream *data, CMap *cmap);
48
49 static MaterialData *getMaterialData(const Common::String &filename, Common::SeekableReadStream *data, CMap *cmap);
50 static Common::List<MaterialData *> *_materials;
51
52 Common::String _fname;
53 const ObjectPtr<CMap> _cmap;
54 int _numImages;
55 Texture **_textures;
56 int _refCount;
57
58private:
59 void initGrim(Common::SeekableReadStream *data);
60 void initEMI(Common::SeekableReadStream *data);
61};
62
63class Material : public Object {
64public:
65 // Load a texture from the given data.
66 Material(const Common::String &filename, Common::SeekableReadStream *data, CMap *cmap, bool clamp);
67
68 void reload(CMap *cmap);
69 // Load this texture into the GL context
70 virtual void select() const;
71
72 // Set which image in an animated texture to use
73 void setActiveTexture(int n);
74
75 int getNumTextures() const;
76 int getActiveTexture() const;
77
78 const Common::String &getFilename() const;
79 MaterialData *getData() const;
80
81 virtual ~Material();
82
83protected:
84 Material();
85
86private:
87 MaterialData *_data;
88 int _currImage;
89 bool _clampTexture;
90};
91
92} // end of namespace Grim
93
94#endif
Definition: list.h:44
Definition: stream.h:745
Definition: str.h:59
Definition: colormap.h:35
Definition: material.h:44
Definition: material.h:63
Definition: object.h:32
Definition: object.h:69
Definition: material.h:31