2 * Copyright (C) 2016 Simon Fels <morphis@gravedo.de>
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #ifndef ANBOX_GRAPHICS_EMUGL_RENDERABLE_H_
18 #define ANBOX_GRAPHICS_EMUGL_RENDERABLE_H_
20 #include "anbox/graphics/rect.h"
27 #include <glm/glm.hpp>
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));
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;
44 void set_screen_position(const anbox::graphics::Rect &screen_position);
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());
52 inline bool operator!=(const Renderable &rhs) const {
53 return !operator==(rhs);
58 std::uint32_t buffer_;
59 anbox::graphics::Rect screen_position_;
60 anbox::graphics::Rect crop_;
61 glm::mat4 transformation_;
65 std::ostream &operator<<(std::ostream &out, const Renderable &r);
67 typedef std::vector<Renderable> RenderableList;