Working on new locations
This commit is contained in:
1 parent
fb7b42ddf9
commit
7e94009217
57 files changed
+732417
-528
No files matched your search
+12
-7
@@ -49,10 +49,11 @@ namespace ZL
|
||||
|
||||
void Location::setup(const LocationSetup& params)
|
||||
{
|
||||
/*
|
||||
roomTexture = renderer.textureManager.LoadFromPng(params.roomTexturePath, CONST_ZIP_FILE);
|
||||
roomMesh.data = LoadFromTextFile02(params.roomMeshPath, CONST_ZIP_FILE);
|
||||
roomMesh.data.RotateByMatrix(Eigen::Quaternionf(Eigen::AngleAxisf(-M_PI * 0.5, Eigen::Vector3f::UnitY())).toRotationMatrix());
|
||||
roomMesh.RefreshVBO();
|
||||
roomMesh.RefreshVBO();*/
|
||||
|
||||
// Load static game objects
|
||||
gameObjects = GameObjectLoader::loadAndCreateGameObjects(params.gameObjectsJsonPath, renderer, CONST_ZIP_FILE);
|
||||
@@ -349,6 +350,10 @@ namespace ZL
|
||||
std::cout << "[RAYCAST_NPC] Starting raycast with " << npcs.size() << " npcs" << std::endl;
|
||||
|
||||
for (auto& npc : npcs) {
|
||||
if (npc->hp <= 0.f) {
|
||||
std::cout << "[RAYCAST_NPC] " << npc->npcId << " is dead, skipping" << std::endl;
|
||||
continue;
|
||||
}
|
||||
const float dx = rayOrigin.x() - npc->position.x();
|
||||
const float dz = rayOrigin.z() - npc->position.z();
|
||||
const float a = rayDir.x() * rayDir.x() + rayDir.z() * rayDir.z();
|
||||
@@ -425,8 +430,8 @@ namespace ZL
|
||||
const Eigen::Vector3f& camTarget = player ? player->position : Eigen::Vector3f::Zero();
|
||||
renderer.TranslateMatrix({ -camTarget.x(), -camTarget.y(), -camTarget.z() });
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, roomTexture->getTexID());
|
||||
renderer.DrawVertexRenderStruct(roomMesh);
|
||||
//glBindTexture(GL_TEXTURE_2D, roomTexture->getTexID());
|
||||
//renderer.DrawVertexRenderStruct(roomMesh);
|
||||
|
||||
for (auto& [name, gameObj] : gameObjects) {
|
||||
glBindTexture(GL_TEXTURE_2D, gameObj.texture->getTexID());
|
||||
@@ -517,7 +522,7 @@ namespace ZL
|
||||
renderer.PushSpecialMatrix(lightView);
|
||||
|
||||
// Draw static geometry
|
||||
renderer.DrawVertexRenderStruct(roomMesh);
|
||||
//renderer.DrawVertexRenderStruct(roomMesh);
|
||||
|
||||
for (auto& [name, gameObj] : gameObjects) {
|
||||
renderer.DrawVertexRenderStruct(gameObj.mesh);
|
||||
@@ -603,8 +608,8 @@ namespace ZL
|
||||
#endif
|
||||
|
||||
CheckGlError(__FILE__, __LINE__);
|
||||
glBindTexture(GL_TEXTURE_2D, roomTexture->getTexID());
|
||||
renderer.DrawVertexRenderStruct(roomMesh);
|
||||
//glBindTexture(GL_TEXTURE_2D, roomTexture->getTexID());
|
||||
//renderer.DrawVertexRenderStruct(roomMesh);
|
||||
|
||||
CheckGlError(__FILE__, __LINE__);
|
||||
for (auto& [name, gameObj] : gameObjects) {
|
||||
@@ -958,7 +963,7 @@ namespace ZL
|
||||
|
||||
// Check if we clicked on an NPC
|
||||
Character* clickedNpc = raycastNpcs(camPos, rayDir);
|
||||
if (clickedNpc && player && clickedNpc->hp > 0) {
|
||||
if (clickedNpc && player) {
|
||||
float distance = (player->position - clickedNpc->position).norm();
|
||||
int npcIndex = -1;
|
||||
for (size_t i = 0; i < npcs.size(); ++i) {
|
||||
|
||||
Reference in new issue
Block a user