Added texture, assets, tools and texture loading.

This commit is contained in:
2022-10-20 21:50:52 -07:00
parent 80d6cba854
commit 043873cc2d
38 changed files with 1626 additions and 15 deletions

View File

@ -7,4 +7,8 @@
target_sources(${DAWN_TARGET_NAME}
PRIVATE
DawnPokerGame.cpp
)
)
tool_texture(texture_test texture_test.png texture_test)
add_dependencies(${DAWN_TARGET_NAME} texture_test)

View File

@ -4,7 +4,6 @@
// https://opensource.org/licenses/MIT
#include "DawnPokerGame.hpp"
#include "event/Event.hpp"
using namespace Dawn;
@ -15,6 +14,7 @@ DawnGame::DawnGame(DawnHost &host) :
}
int32_t DawnGame::init() {
this->assetManager.init();
this->renderManager.init();
this->scene = std::make_shared<Scene>(*this);
@ -35,21 +35,19 @@ int32_t DawnGame::init() {
0, 0, 0
);
auto testTexture = std::make_shared<Texture>();
testTexture->setSize(2, 2);
struct Color colors[4] = {
COLOR_RED, COLOR_GREEN, COLOR_BLUE, COLOR_WHITE
};
testTexture->buffer(colors);
cubeMaterial->textureValues[cubeMaterial->getShader()->getParameterByName("u_Text")] = testTexture;
auto textureAsset = this->assetManager.load<TextureAsset>("texture_test");
cubeMaterial->textureValues[cubeMaterial->getShader()->getParameterByName("u_Text")] = std::shared_ptr<Texture>(textureAsset->texture);
return DAWN_GAME_INIT_RESULT_SUCCESS;
}
int32_t DawnGame::update(float_t delta) {
this->assetManager.update();
if(this->scene != nullptr) this->scene->update();
this->renderManager.update();
return DAWN_GAME_UPDATE_RESULT_SUCCESS;
}

View File

@ -7,4 +7,5 @@
#include "game/DawnGame.hpp"
#include "scene/components/Components.hpp"
#include "display/mesh/QuadMesh.hpp"
#include "display/mesh/TriangleMesh.hpp"
#include "display/mesh/TriangleMesh.hpp"
#include "asset/assets/TextureAsset.hpp"