mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
block materials loading
This commit is contained in:
parent
90f3373f46
commit
f4cc413f61
11 changed files with 144 additions and 40 deletions
|
|
@ -8,16 +8,17 @@
|
|||
#include "../voxels/Block.h"
|
||||
#include "../assets/Assets.h"
|
||||
#include "../graphics/Atlas.h"
|
||||
#include "../content/Content.h"
|
||||
|
||||
#include "../logic/LevelController.h"
|
||||
#include "../logic/PlayerController.h"
|
||||
|
||||
LevelFrontend::LevelFrontend(Level* level, Assets* assets)
|
||||
: level(level),
|
||||
assets(assets),
|
||||
contentCache(std::make_unique<ContentGfxCache>(level->content, assets)),
|
||||
blocksAtlas(BlocksPreview::build(contentCache.get(), assets, level->content)) {
|
||||
}
|
||||
: level(level),
|
||||
assets(assets),
|
||||
contentCache(std::make_unique<ContentGfxCache>(level->content, assets)),
|
||||
blocksAtlas(BlocksPreview::build(contentCache.get(), assets, level->content))
|
||||
{}
|
||||
|
||||
void LevelFrontend::observe(LevelController* controller) {
|
||||
controller->getPlayerController()->listenBlockInteraction(
|
||||
|
|
@ -25,9 +26,12 @@ void LevelFrontend::observe(LevelController* controller) {
|
|||
if (type != BlockInteraction::step) {
|
||||
return;
|
||||
}
|
||||
// (test code)
|
||||
// TODO: replace with BlockMaterial properties access
|
||||
auto sound = assets->getSound("steps/"+def->material.substr(def->material.find(':')+1));
|
||||
auto material = level->content->findBlockMaterial(def->material);
|
||||
if (material == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto sound = assets->getSound(material->stepsSound);
|
||||
audio::play(
|
||||
sound,
|
||||
glm::vec3(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue