ALL: missed mesh

master
Martin Gerhardy 2018-10-02 20:41:58 +02:00
parent bc292587e0
commit 1d5c413dd2
10 changed files with 26 additions and 9 deletions

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 162 B

View File

@ -33,6 +33,9 @@ set(FILES
client/ui/window/client-lostpassword.tb.txt
client/ui/window/client-signup.tb.txt
testmesh/chr_skelett.fbx
testmesh/chr_skelett2.png
shared/font.ttf
shared/worldparams.lua
)

View File

@ -336,7 +336,7 @@ void Client::entityUpdate(frontend::ClientEntityId id, const glm::vec3& pos, flo
void Client::entitySpawn(frontend::ClientEntityId id, network::EntityType type, float orientation, const glm::vec3& pos) {
Log::info("Entity %li spawned at pos %f:%f:%f (type %i)", id, pos.x, pos.y, pos.z, (int)type);
const std::string_view& meshName = "chr_skelett2_bake"; // core::string::toLower(network::EnumNameEntityType(type));
const std::string_view& meshName = "chr_skelett"; // TODO: core::string::toLower(network::EnumNameEntityType(type));
const video::MeshPtr& mesh = _meshPool->getMesh(meshName);
_worldRenderer.addEntity(std::make_shared<frontend::ClientEntity>(id, type, pos, orientation, mesh));
}

View File

@ -36,7 +36,7 @@ core::AppState TestMeshApp::onConstruct() {
}
}).setHelp("Load a mesh from the pool. The name is without extension and the file must be in the mesh/ dir.");
_meshName = core::Var::get("mesh", "chr_skelett2_bake");
_meshName = core::Var::get("mesh", "chr_skelett");
_animationIndex = core::Var::get("animation", "0");
_shadowMap = core::Var::getSafe(cfg::ClientShadowMap);
_shadowMapShow = core::Var::get(cfg::ClientShadowMapShow, "false");

View File

@ -8,6 +8,7 @@
#include "core/Log.h"
#include <assimp/scene.h>
#include <assimp/importerdesc.h>
#include <array>
namespace video {
@ -39,10 +40,13 @@ void MeshPool::shutdown() {
std::string MeshPool::getName(std::string_view id) const {
const io::FilesystemPtr& filesystem = core::App::getInstance()->filesystem();
for (const char **format = supportedFormats; *format != nullptr; format++) {
const std::string& name = core::string::format("mesh/%s.%s", id.data(), *format);
if (filesystem->exists(name)) {
return name;
const std::array<std::string, 2> directories {".", "mesh"};
for (const auto& dir : directories) {
for (const char **format = supportedFormats; *format != nullptr; format++) {
const std::string& name = core::string::format("%s/%s.%s", dir.c_str(), id.data(), *format);
if (filesystem->exists(name)) {
return name;
}
}
}

View File

@ -2,5 +2,9 @@ project(testdepthbuffer)
set(SRCS
TestDepthBuffer.h TestDepthBuffer.cpp
)
engine_add_executable(TARGET ${PROJECT_NAME} SRCS ${SRCS} WINDOWED NOINSTALL)
set(FILES
testmesh/chr_skelett.fbx
testmesh/chr_skelett2.png
)
engine_add_executable(TARGET ${PROJECT_NAME} FILES ${FILES} SRCS ${SRCS} WINDOWED NOINSTALL)
engine_target_link_libraries(TARGET ${PROJECT_NAME} DEPENDENCIES testcore)

View File

@ -2,5 +2,9 @@ project(testmesh)
set(SRCS
TestMesh.cpp
)
engine_add_executable(TARGET ${PROJECT_NAME} SRCS ${SRCS} WINDOWED NOINSTALL)
set(FILES
testmesh/chr_skelett.fbx
testmesh/chr_skelett2.png
)
engine_add_executable(TARGET ${PROJECT_NAME} FILES ${FILES} SRCS ${SRCS} WINDOWED NOINSTALL)
engine_target_link_libraries(TARGET ${PROJECT_NAME} DEPENDENCIES testcore)

View File

@ -4,6 +4,8 @@ set(SRCS
)
set(FILES
shared/worldparams.lua
testmesh/chr_skelett.fbx
testmesh/chr_skelett2.png
)
engine_add_executable(TARGET ${PROJECT_NAME} SRCS ${SRCS} FILES ${FILES} WINDOWED)
engine_target_link_libraries(TARGET ${PROJECT_NAME} DEPENDENCIES imgui voxelrender)

View File

@ -91,7 +91,7 @@ core::AppState MapEdit::onInit() {
_meshPool->init();
const char *meshName = "chr_skelett2_bake";
const char *meshName = "chr_skelett";
const video::MeshPtr& mesh = _meshPool->getMesh(meshName);
if (!mesh) {
Log::error("Failed to load the mesh '%s'", meshName);