ScummVM API documentation
geometricobject.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 // Based on Phantasma code by Thomas Harte (2013),
23 // available at https://github.com/TomHarte/Phantasma/ (MIT)
24 
25 #ifndef FREESCAPE_GEOMETRICOBJECT_H
26 #define FREESCAPE_GEOMETRICOBJECT_H
27 
28 #include "freescape/language/instruction.h"
29 #include "freescape/objects/group.h"
30 #include "freescape/objects/object.h"
31 
32 namespace Freescape {
33 
34 class GeometricObject : public Object {
35 public:
36  static int numberOfColoursForObjectOfType(ObjectType type);
37  static int numberOfOrdinatesForType(ObjectType type);
38  static bool isPyramid(ObjectType type);
39  static bool isPolygon(ObjectType type);
40 
42  ObjectType type,
43  uint16 objectID,
44  uint16 flags,
45  const Math::Vector3d &origin,
46  const Math::Vector3d &size,
47  Common::Array<uint8> *colours,
48  Common::Array<uint8> *ecolours,
49  Common::Array<float> *ordinates,
50  FCLInstructionVector conditionInstructions,
51  Common::String conditionSource = "");
52  virtual ~GeometricObject();
53  void setOrigin(Math::Vector3d origin) override;
54  void offsetOrigin(Math::Vector3d origin_);
55  void restoreOrdinates();
56 
57  Object *duplicate() override;
58  void scale(int factor) override;
59  void computeBoundingBox();
60  bool collides(const Math::AABB &boundingBox);
61  void draw(Freescape::Renderer *gfx, float offset = 0.0) override;
62  bool isDrawable() override;
63  bool isPlanar() override;
64  bool _cyclingColors;
65 
66  bool isLineButNotStraight();
67 
68  Common::String _conditionSource;
69  FCLInstructionVector _condition;
70 
71 private:
72  Common::Array<uint8> *_colours;
73  Common::Array<uint8> *_ecolours;
74  Common::Array<float> *_ordinates;
75  Common::Array<float> *_initialOrdinates;
76 };
77 
78 } // End of namespace Freescape
79 
80 #endif // FREESCAPE_GEOMETRICOBJECT_H
Definition: geometricobject.h:34
Definition: str.h:59
Definition: area.h:36
Definition: gfx.h:60
Definition: object.h:56