Render2D.h
1 /*
2 
3 Copyright (c) 2018, Johnathan Corkery. (jcorkery@umich.edu)
4 All rights reserved.
5 
6 This file is part of the Dynacoe project (https://github.com/jcorks/Dynacoe)
7 Dynacoe was released under the MIT License, as detailed below.
8 
9 
10 
11 Permission is hereby granted, free of charge, to any person obtaining a copy
12 of this software and associated documentation files (the "Software"), to deal
13 in the Software without restriction, including without limitation the rights
14 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 copies of the Software, and to permit persons to whom the Software is furnished
16 to do so, subject to the following conditions:
17 
18 The above copyright notice and this permission notice shall
19 be included in all copies or substantial portions of the Software.
20 
21 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
24 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
25 DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
26 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
27 DEALINGS IN THE SOFTWARE.
28 
29 */
30 
31 #ifndef H_DC_RENDER2D_INLCUDED
32 #define H_DC_RENDER2D_INLCUDED
33 
34 #include <Dynacoe/Backends/Renderer/Renderer.h>
35 #include <Dynacoe/Component.h>
36 #include <Dynacoe/Spatial.h>
37 namespace Dynacoe {
38 
39 
42 class Render2D : public Component, public Spatial {
43  public:
44 
47  enum class RenderMode {
48  Normal,
49  Translucent,
51  None,
54  };
55 
60 
61 
65  bool absolute;
66 
70  std::vector<Renderer::Vertex2D> GetVertices() const;
71 
72  uint32_t GetObjectID() const;
73 
74  const std::vector<uint32_t> & GetVertexIDs() const;
75 
79  Renderer::Polygon GetPolygon() const;
80  ~Render2D();
81 
82  protected:
83  Render2D(const std::string &);
84 
85  void SetVertices(const std::vector<Renderer::Vertex2D> &);
86  void SetPolygon(Renderer::Polygon);
87  void OnUpdateTransform();
88 
89  private:
90  std::vector<uint32_t> vertexSrc;
91  int objectID;
92 
93  Renderer::Polygon polygon;
94 };
95 
96 }
97 
98 #endif
RenderMode mode
The visual mode for rendered vertices.
Definition: Render2D.h:59
Base component to render a 2D object.
Definition: Render2D.h:42
Definition: AssetID.h:37
Renderer::Polygon GetPolygon() const
Returns the polygon to be used when drawing the vertices.
bool absolute
Sets whether drawing calculations from the node should be interpreted as absolute pixel values on the...
Definition: Render2D.h:65
RenderMode
A RenderMode specifies how the aspect should be expressed.
Definition: Render2D.h:47
If an aspect's render mode is None, it will not be drawn.
std::vector< Renderer::Vertex2D > GetVertices() const
Returns the raw vertices compiled for the renderable object.
Class that extends the functionality of an Entity, but as a removable and addable object...
Definition: Component.h:66