96c7f056e2995c0e92aa41dc469d258269a77091
[iec.git] / src / type3_AndroidCloud / anbox-master / src / anbox / graphics / emugl / Renderable.h
1 /*
2 * Copyright (C) 2016 Simon Fels <morphis@gravedo.de>
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 #ifndef ANBOX_GRAPHICS_EMUGL_RENDERABLE_H_
18 #define ANBOX_GRAPHICS_EMUGL_RENDERABLE_H_
19
20 #include "anbox/graphics/rect.h"
21
22 #include <string>
23 #include <vector>
24
25 #include <cstdint>
26
27 #include <glm/glm.hpp>
28
29 class Renderable {
30  public:
31   Renderable(const std::string &name, const std::uint32_t &buffer, float alpha,
32              const anbox::graphics::Rect &screen_position,
33              const anbox::graphics::Rect &crop = {},
34              const glm::mat4 &transformation = glm::mat4(1.0f));
35   ~Renderable();
36
37   std::string name() const;
38   std::uint32_t buffer() const;
39   anbox::graphics::Rect screen_position() const;
40   anbox::graphics::Rect crop() const;
41   glm::mat4 transformation() const;
42   float alpha() const;
43
44   void set_screen_position(const anbox::graphics::Rect &screen_position);
45
46   inline bool operator==(const Renderable &rhs) const {
47     return (name_ == rhs.name() && buffer_ == rhs.buffer() &&
48             screen_position_ == rhs.screen_position() && crop_ == rhs.crop() &&
49             transformation_ == rhs.transformation() && alpha_ == rhs.alpha());
50   }
51
52   inline bool operator!=(const Renderable &rhs) const {
53     return !operator==(rhs);
54   }
55
56  private:
57   std::string name_;
58   std::uint32_t buffer_;
59   anbox::graphics::Rect screen_position_;
60   anbox::graphics::Rect crop_;
61   glm::mat4 transformation_;
62   float alpha_;
63 };
64
65 std::ostream &operator<<(std::ostream &out, const Renderable &r);
66
67 typedef std::vector<Renderable> RenderableList;
68
69 #endif