3#include "GraphicApi.hpp"
4#include <Covellite/Api/Vertex.hpp>
5#include <Covellite/Api/Defines.hpp>
6#include <Covellite/Api/Component.inl>
17GraphicApi::GraphicApi(
void) :
18 m_StartProgram{ std::chrono::system_clock::now() },
19 m_CurrentFrameTime{ 0.0f }
21 const auto CreatePresent = [
this](
const ComponentPtr_t & _pComponent)
23 const auto PresentRender = CreatePresentBuffer(_pComponent);
34 { uT(
"Test"), [](
const ComponentPtr_t &)
35 {
return [](void) {}; } },
36 { uT(
"Camera"), [
this](
const ComponentPtr_t & _pComponent)
37 {
return CreateCamera(_pComponent); } },
38 { uT(
"BkSurface"), [
this](
const ComponentPtr_t & _pComponent)
39 {
return CreateBkSurface(_pComponent); } },
40 { uT(
"State"), [
this](
const ComponentPtr_t & _pComponent)
41 {
return CreateState(_pComponent); } },
42 { uT(
"Texture"), [
this](
const ComponentPtr_t & _pComponent)
43 {
return CreateTexture(_pComponent); } },
44 { uT(
"TextureArray"), [
this](
const ComponentPtr_t & _pComponent)
45 {
return CreateTextureArray(_pComponent); } },
46 { uT(
"Shader"), [
this](
const ComponentPtr_t & _pComponent)
47 {
return CreateShader(_pComponent); } },
48 { uT(
"Buffer"), [
this](
const ComponentPtr_t & _pComponent)
49 {
return CreateBuffer(_pComponent); } },
50 { uT(
"Transform"), [
this](
const ComponentPtr_t & _pComponent)
51 {
return CreateTransform(_pComponent); } },
52 { uT(
"Present"), CreatePresent },
53 { uT(
"Updater"), [
this](
const ComponentPtr_t & _pComponent)
54 {
return CreateUpdater(_pComponent); } },
58void GraphicApi::PresentFrame(
void)
60 const ::std::chrono::duration<float> Time =
61 (std::chrono::system_clock::now() - m_StartProgram);
62 m_CurrentFrameTime = Time.count();
63 m_IsResizeWindow =
false;
64 m_DrawCallCount = m_DrawCallCounter;
65 m_DrawCallCounter = 0;
68auto GraphicApi::GetCreators(
void)
const noexcept ->
const Creators_t &
73size_t GraphicApi::GetDrawCallCount(
void)
const
75 return m_DrawCallCount;
78auto GraphicApi::CreateUpdater(
const ComponentPtr_t & _pComponent)
const -> Render_t
80 using ::covellite::api::Updater_t;
83 static const auto hFunctionName = Component::GetHash(uT(
"function"));
84 static const Updater_t Empty = [](
const float) {};
96 const Updater_t Updater = (*_pComponent)[hFunctionName].Default(Empty);
98 Updater(m_CurrentFrameTime);
Класс входит в проект Covellite.Api Класс компонента.
Определения Component.hpp:35