GearEngine  0.0.1
Gear::Renderer2D 클래스 참조

#include <Renderer2D.h>

Gear::Renderer2D에 대한 협력 다이어그램:
Collaboration graph

정적 Public 멤버 함수

static void Init ()
 
static void Shutdown ()
 
static void BeginScene (const OrthographicCamera &camera)
 
static void EndScene ()
 
static void DrawQuad (const glm::vec2 &position, const glm::vec2 &size, const glm::vec4 &color)
 
static void DrawQuad (const glm::vec3 &position, const glm::vec2 &size, const glm::vec4 &color)
 
static void DrawQuad (const glm::vec2 &position, const glm::vec2 &size, const Ref< Texture > &texture, float tilingFactor=1.0f, const glm::vec4 &tintColor=glm::vec4(1.0f))
 
static void DrawQuad (const glm::vec3 &position, const glm::vec2 &size, const Ref< Texture > &texture, float tilingFactor=1.0f, const glm::vec4 &tintColor=glm::vec4(1.0f))
 
static void DrawRotatedQuad (const glm::vec2 &position, const glm::vec2 &size, float rotation, const glm::vec4 &color)
 
static void DrawRotatedQuad (const glm::vec3 &position, const glm::vec2 &size, float rotation, const glm::vec4 &color)
 
static void DrawRotatedQuad (const glm::vec2 &position, const glm::vec2 &size, float rotation, const Ref< Texture > &texture, float tilingFactor=1.0f, const glm::vec4 &tintColor=glm::vec4(1.0f))
 
static void DrawRotatedQuad (const glm::vec3 &position, const glm::vec2 &size, float rotation, const Ref< Texture > &texture, float tilingFactor=1.0f, const glm::vec4 &tintColor=glm::vec4(1.0f))
 

상세한 설명

Renderer2D.h 파일의 8 번째 라인에서 정의되었습니다.

멤버 함수 문서화

◆ BeginScene()

void Gear::Renderer2D::BeginScene ( const OrthographicCamera camera)
static

Renderer2D.cpp 파일의 71 번째 라인에서 정의되었습니다.

72  {
74 
75  s_Data->TextureShader->Bind();
76  s_Data->TextureShader->SetMat4("u_ViewProjection", camera.GetViewProjectionMatrix());
77  }
이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:

◆ DrawQuad() [1/4]

void Gear::Renderer2D::DrawQuad ( const glm::vec2 &  position,
const glm::vec2 &  size,
const glm::vec4 &  color 
)
static

Renderer2D.cpp 파일의 85 번째 라인에서 정의되었습니다.

86  {
87  DrawQuad({ position.x, position.y, 0.0f}, size, color);
88  }
이 함수를 호출하는 함수들에 대한 그래프입니다.:

◆ DrawQuad() [2/4]

void Gear::Renderer2D::DrawQuad ( const glm::vec2 &  position,
const glm::vec2 &  size,
const Ref< Texture > &  texture,
float  tilingFactor = 1.0f,
const glm::vec4 &  tintColor = glm::vec4(1.0f) 
)
static

Renderer2D.cpp 파일의 106 번째 라인에서 정의되었습니다.

107  {
108  DrawQuad({ position.x, position.y, 0.0f }, size, texture, tilingFactor, tintColor);
109  }
이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:

◆ DrawQuad() [3/4]

void Gear::Renderer2D::DrawQuad ( const glm::vec3 &  position,
const glm::vec2 &  size,
const glm::vec4 &  color 
)
static

Renderer2D.cpp 파일의 90 번째 라인에서 정의되었습니다.

91  {
93 
94  s_Data->TextureShader->SetFloat4("u_Color", color);
95  s_Data->TextureShader->SetFloat("u_TilingFactor", 1.0f);
96  s_Data->WhiteTexture->Bind();
97 
98  glm::mat4 translate = glm::translate(glm::mat4(1.0f), position)
99  * glm::scale(glm::mat4(1.0f), { size.x, size.y, 1.0f });
100  s_Data->TextureShader->SetMat4("u_Transform", translate);
101 
102  s_Data->QuardVertexArray->Bind();
104  }
이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:

◆ DrawQuad() [4/4]

void Gear::Renderer2D::DrawQuad ( const glm::vec3 &  position,
const glm::vec2 &  size,
const Ref< Texture > &  texture,
float  tilingFactor = 1.0f,
const glm::vec4 &  tintColor = glm::vec4(1.0f) 
)
static

Renderer2D.cpp 파일의 111 번째 라인에서 정의되었습니다.

112  {
114 
115  s_Data->TextureShader->SetFloat4("u_Color", tintColor);
116  s_Data->TextureShader->SetFloat("u_TilingFactor", tilingFactor);
117  texture->Bind();
118 
119  glm::mat4 translate = glm::translate(glm::mat4(1.0f), position)
120  * glm::scale(glm::mat4(1.0f), { size.x, size.y, 1.0f });
121  s_Data->TextureShader->SetMat4("u_Transform", translate);
122 
123  s_Data->QuardVertexArray->Bind();
125  }
이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:

◆ DrawRotatedQuad() [1/4]

void Gear::Renderer2D::DrawRotatedQuad ( const glm::vec2 &  position,
const glm::vec2 &  size,
float  rotation,
const glm::vec4 &  color 
)
static

Renderer2D.cpp 파일의 127 번째 라인에서 정의되었습니다.

128  {
129  DrawRotatedQuad({ position.x, position.y, 0.0f }, size, rotation, color);
130  }
이 함수를 호출하는 함수들에 대한 그래프입니다.:

◆ DrawRotatedQuad() [2/4]

void Gear::Renderer2D::DrawRotatedQuad ( const glm::vec2 &  position,
const glm::vec2 &  size,
float  rotation,
const Ref< Texture > &  texture,
float  tilingFactor = 1.0f,
const glm::vec4 &  tintColor = glm::vec4(1.0f) 
)
static

Renderer2D.cpp 파일의 149 번째 라인에서 정의되었습니다.

150  {
151  DrawRotatedQuad({ position.x, position.y, 0.0f }, size, rotation, texture, tilingFactor, tintColor);
152  }
이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:

◆ DrawRotatedQuad() [3/4]

void Gear::Renderer2D::DrawRotatedQuad ( const glm::vec3 &  position,
const glm::vec2 &  size,
float  rotation,
const glm::vec4 &  color 
)
static

Renderer2D.cpp 파일의 132 번째 라인에서 정의되었습니다.

133  {
135 
136  s_Data->TextureShader->SetFloat4("u_Color", color);
137  s_Data->TextureShader->SetFloat("u_TilingFactor", 1.0f);
138  s_Data->WhiteTexture->Bind();
139 
140  glm::mat4 translate = glm::translate(glm::mat4(1.0f), position)
141  * glm::rotate(glm::mat4(1.0f), rotation, {0.0f, 0.0f, 1.0f, })
142  * glm::scale(glm::mat4(1.0f), { size.x, size.y, 1.0f });
143  s_Data->TextureShader->SetMat4("u_Transform", translate);
144 
145  s_Data->QuardVertexArray->Bind();
147  }
이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:

◆ DrawRotatedQuad() [4/4]

void Gear::Renderer2D::DrawRotatedQuad ( const glm::vec3 &  position,
const glm::vec2 &  size,
float  rotation,
const Ref< Texture > &  texture,
float  tilingFactor = 1.0f,
const glm::vec4 &  tintColor = glm::vec4(1.0f) 
)
static

Renderer2D.cpp 파일의 154 번째 라인에서 정의되었습니다.

155  {
157 
158  s_Data->TextureShader->SetFloat4("u_Color", tintColor);
159  s_Data->TextureShader->SetFloat("u_TilingFactor", tilingFactor);
160  texture->Bind();
161 
162  glm::mat4 translate = glm::translate(glm::mat4(1.0f), position)
163  * glm::rotate(glm::mat4(1.0f), rotation, { 0.0f, 0.0f, 1.0f, })
164  * glm::scale(glm::mat4(1.0f), { size.x, size.y, 1.0f });
165  s_Data->TextureShader->SetMat4("u_Transform", translate);
166 
167  s_Data->QuardVertexArray->Bind();
169  }
이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:

◆ EndScene()

void Gear::Renderer2D::EndScene ( )
static

Renderer2D.cpp 파일의 79 번째 라인에서 정의되었습니다.

80  {
82 
83  }

◆ Init()

void Gear::Renderer2D::Init ( )
static

Renderer2D.cpp 파일의 21 번째 라인에서 정의되었습니다.

22  {
24 
25  s_Data = new Renderer2DStorage();
26 
27  //1. Create VertexArray
29  //2. define vertices, Indices
30  float squareVertices[5 * 4] = {
31  -0.5f, -0.5f, 0.0f, 0.0f, 0.0f,
32  0.5f, -0.5f, 0.0f, 1.0f, 0.0f,
33  0.5f, 0.5f, 0.0f, 1.0f, 1.0f,
34  -0.5f, 0.5f, 0.0f, 0.0f, 1.0f
35  };
36  uint32_t squreIndices[6] = {
37  0, 1, 2, 2, 3, 0
38  };
39 
40  //3. Create VertexBuffer
41  Ref<VertexBuffer> squareVB;
42  squareVB.reset(VertexBuffer::Create(squareVertices, sizeof(squareVertices)));
43  squareVB->SetLayout({
44  {ShaderDataType::Float3, "a_Position"},
45  {ShaderDataType::Float2, "a_TexCoord"}
46  });
47  s_Data->QuardVertexArray->AddVertexBuffer(squareVB);
48 
49  //4. Create IndexBuffer
50  Ref<IndexBuffer> squreIB;
51  squreIB.reset(IndexBuffer::Create(squreIndices, sizeof(squreIndices) / sizeof(uint32_t)));
52  s_Data->QuardVertexArray->SetIndexBuffer(squreIB);
53 
54  //5. Shader setup
56  uint32_t whiteTextureData = 0xffffffff;
57  s_Data->WhiteTexture->SetData(&whiteTextureData, sizeof(uint32_t));
58 
59  s_Data->TextureShader = Shader::Create("assets/shaders/Texture.glsl");
60  s_Data->TextureShader->Bind();
61  s_Data->TextureShader->SetInt("u_Texture", 0);
62  }
이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:
이 함수를 호출하는 함수들에 대한 그래프입니다.:

◆ Shutdown()

void Gear::Renderer2D::Shutdown ( )
static

Renderer2D.cpp 파일의 64 번째 라인에서 정의되었습니다.

65  {
67 
68  delete s_Data;
69  }
이 함수를 호출하는 함수들에 대한 그래프입니다.:

이 클래스에 대한 문서화 페이지는 다음의 파일들로부터 생성되었습니다.:
Gear::Renderer2DStorage::QuardVertexArray
Ref< VertexArray > QuardVertexArray
Definition: Renderer2D.cpp:14
Gear::Renderer2DStorage::TextureShader
Ref< Shader > TextureShader
Definition: Renderer2D.cpp:15
Gear::Renderer2D::DrawQuad
static void DrawQuad(const glm::vec2 &position, const glm::vec2 &size, const glm::vec4 &color)
Definition: Renderer2D.cpp:85
Gear::IndexBuffer::Create
static IndexBuffer * Create(uint32_t *indices, uint32_t count)
Definition: Buffer.cpp:26
Gear::Renderer2D::DrawRotatedQuad
static void DrawRotatedQuad(const glm::vec2 &position, const glm::vec2 &size, float rotation, const glm::vec4 &color)
Definition: Renderer2D.cpp:127
Gear::ShaderDataType::Float2
@ Float2
GR_PROFILE_FUNCTION
#define GR_PROFILE_FUNCTION()
Definition: Instrumentor.h:131
Gear::Renderer2DStorage::WhiteTexture
Ref< Texture2D > WhiteTexture
Definition: Renderer2D.cpp:16
Gear::RenderCommand::DrawIndexed
static void DrawIndexed(const Ref< VertexArray > &vertexArray)
Definition: RenderCommand.h:25
Gear::Texture2D::Create
static Ref< Texture2D > Create(uint32_t width, uint32_t height)
Definition: Texture.cpp:9
Gear::s_Data
static Renderer2DStorage * s_Data
Definition: Renderer2D.cpp:19
Gear::VertexArray::Create
static Ref< VertexArray > Create()
Definition: VertexArray.cpp:8
Gear::VertexBuffer::Create
static VertexBuffer * Create(float *vertices, uint32_t size)
Definition: Buffer.cpp:11
Gear::Shader::Create
static Ref< Shader > Create(const std::string &filepath)
Definition: Shader.cpp:9
Gear::ShaderDataType::Float3
@ Float3