ScummVM API documentation
xmaterial.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 /*
23  * This file is based on WME.
24  * http://dead-code.org/redir.php?target=wme
25  * Copyright (c) 2003-2013 Jan Nedoma and contributors
26  */
27 
28 #ifndef WINTERMUTE_XMATERIAL_H
29 #define WINTERMUTE_XMATERIAL_H
30 
31 #include "engines/wintermute/base/base_named_object.h"
32 
33 namespace Wintermute {
34 
35 class BaseSprite;
36 class BaseSurface;
37 class VideoTheoraPlayer;
38 class XFileData;
39 
40 struct ColorValue {
41  float &r() {
42  return data[0];
43  }
44 
45  float r() const {
46  return data[0];
47  }
48 
49  float &g() {
50  return data[1];
51  }
52 
53  float g() const {
54  return data[1];
55  }
56 
57  float &b() {
58  return data[2];
59  }
60 
61  float b() const {
62  return data[2];
63  }
64 
65  float &a() {
66  return data[3];
67  }
68 
69  float a() const {
70  return data[3];
71  }
72 
73  float data[4];
74 };
75 
76 class Material : public BaseNamedObject {
77 public:
78  Material(BaseGame *inGame);
79  virtual ~Material();
80 
81  ColorValue _diffuse;
82  ColorValue _ambient;
83  ColorValue _specular;
84  ColorValue _emissive;
85  float _shininess;
86 
87  bool setTexture(const Common::String &filename, bool adoptName = false);
88  bool setSprite(BaseSprite *sprite, bool adoptName = false);
89  bool setTheora(VideoTheoraPlayer *theora, bool adoptName = false);
90  BaseSurface *getSurface();
91 
92  bool loadFromX(XFileData *xobj, const Common::String &filename);
93 
94  bool invalidateDeviceObjects();
95  bool restoreDeviceObjects();
96 
97 private:
98  Common::String _textureFilename;
99  BaseSurface *_surface;
100  bool _ownedSurface;
101  BaseSprite *_sprite;
102  VideoTheoraPlayer *_theora;
103 };
104 
105 } // namespace Wintermute
106 
107 #endif
Definition: base_game.h:75
Definition: str.h:59
Definition: xmaterial.h:40
Definition: video_theora_player.h:41
Definition: base_surface.h:38
Definition: base_named_object.h:36
Definition: xmaterial.h:76
Definition: base_sprite.h:40
Definition: xfile_loader.h:452
Definition: achievements_tables.h:27