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
32namespace Freescape {
33
34class GeometricObject : public Object {
35public:
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 void setColor(uint idx, int color);
63 bool isFullyTransparent() const;
64 bool isDrawable() override;
65 bool isPlanar() override;
66 bool _cyclingColors;
67
68 bool isLineButNotStraight();
69
70 Common::String _conditionSource;
71 FCLInstructionVector _condition;
72
73private:
74 Common::Array<uint8> *_colours;
75 Common::Array<uint8> *_ecolours;
76 Common::Array<float> *_ordinates;
77 Common::Array<float> *_initialOrdinates;
78};
79
80} // End of namespace Freescape
81
82#endif // FREESCAPE_GEOMETRICOBJECT_H
Definition: str.h:59
Definition: geometricobject.h:34
Definition: object.h:56
Definition: gfx.h:63
Definition: area.h:36