ScummVM API documentation
actor.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 STARK_VISUAL_ACTOR_H
23 #define STARK_VISUAL_ACTOR_H
24 
25 #include "engines/stark/visual/visual.h"
26 
27 #include "common/array.h"
28 #include "common/rect.h"
29 
30 #include "math/matrix4.h"
31 #include "math/ray.h"
32 #include "math/vector3d.h"
33 
34 
35 namespace Stark {
36 
37 namespace Gfx {
38 class Texture;
39 class TextureSet;
40 struct LightEntry;
41 }
42 
43 class Model;
44 struct Face;
45 struct Material;
46 class SkeletonAnim;
47 class AnimHandler;
48 
49 
50 class VisualActor : public Visual {
51 public:
52  static const VisualType TYPE = Visual::kActor;
53 
54  VisualActor();
55  ~VisualActor() override;
56 
57  void setModel(Model *model);
58  void setTexture(Gfx::TextureSet *texture);
59  void setTextureFacial(Gfx::TextureSet *textureFacial);
60  void setNewFace(char shape);
61 
62  void setAnimHandler(AnimHandler *animHandler);
63  void setTime(uint32 time);
64 
65  void setCastShadow(bool cast) { _castsShadow = cast; }
66 
67  bool intersectRay(const Math::Ray &ray, const Math::Vector3d &position, float direction);
68  Common::Rect getBoundingRect(const Math::Vector3d &position3d, float direction) const;
69 
70  virtual void render(const Math::Vector3d &position, float direction, const Common::Array<Gfx::LightEntry *> &lights) = 0;
71 
72 protected:
73  AnimHandler *_animHandler;
74  Model *_model;
75  Gfx::TextureSet *_textureSet;
76  Gfx::TextureSet *_textureSetFacial;
77  char _faceTextureName;
78  uint32 _time;
79  bool _modelIsDirty;
80  bool _castsShadow;
81 
82  Math::Matrix4 getModelMatrix(const Math::Vector3d &position, float direction) const;
83  const Gfx::Texture *resolveTexture(const Material *material) const;
84 };
85 
86 } // End of namespace Stark
87 
88 #endif // STARK_VISUAL_ACTOR_H
Definition: visual.h:29
Definition: model.h:91
Definition: animhandler.h:36
Definition: array.h:52
Definition: rect.h:144
Definition: texture.h:37
Definition: actor.h:50
Definition: console.h:27
Definition: texture.h:61
Definition: model.h:55