import missing updates from noggit3 repo
water flags scripting api object details info server corods chunk details info water credit : noggit3
This commit is contained in:
@@ -70,7 +70,7 @@ public:
|
|||||||
|
|
||||||
MapChunk* getChunk() { return _chunk; };
|
MapChunk* getChunk() { return _chunk; };
|
||||||
TileWater* getWaterTile() { return _water_tile; };
|
TileWater* getWaterTile() { return _water_tile; };
|
||||||
|
std::optional<MH2O_Render> Render;
|
||||||
float xbase, zbase;
|
float xbase, zbase;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -84,9 +84,11 @@ private:
|
|||||||
void copy_height_to_layer(liquid_layer& target, glm::vec3 const& pos, float radius);
|
void copy_height_to_layer(liquid_layer& target, glm::vec3 const& pos, float radius);
|
||||||
|
|
||||||
|
|
||||||
std::optional<MH2O_Render> Render;
|
|
||||||
|
|
||||||
std::vector<liquid_layer> _layers;
|
std::vector<liquid_layer> _layers;
|
||||||
MapChunk* _chunk;
|
MapChunk* _chunk;
|
||||||
TileWater* _water_tile;
|
TileWater* _water_tile;
|
||||||
|
|
||||||
|
friend class MapView;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
#include <glm/gtx/quaternion.hpp>
|
#include <glm/gtx/quaternion.hpp>
|
||||||
#include <math/bounding_box.hpp>
|
#include <math/bounding_box.hpp>
|
||||||
#include <math/frustum.hpp>
|
#include <math/frustum.hpp>
|
||||||
|
#include <glm/glm.hpp>
|
||||||
#include <noggit/Log.h>
|
#include <noggit/Log.h>
|
||||||
#include <noggit/Misc.h> // checkinside
|
#include <noggit/Misc.h> // checkinside
|
||||||
#include <noggit/Model.h> // Model, etc.
|
#include <noggit/Model.h> // Model, etc.
|
||||||
@@ -237,6 +238,10 @@ void ModelInstance::updateDetails(Noggit::Ui::detail_infos* detail_widget)
|
|||||||
<< "<br><b>position X/Y/Z:</b> {" << pos.x << " , " << pos.y << " , " << pos.z << "}"
|
<< "<br><b>position X/Y/Z:</b> {" << pos.x << " , " << pos.y << " , " << pos.z << "}"
|
||||||
<< "<br><b>rotation X/Y/Z:</b> {" << dir.x << " , " << dir.y << " , " << dir.z << "}"
|
<< "<br><b>rotation X/Y/Z:</b> {" << dir.x << " , " << dir.y << " , " << dir.z << "}"
|
||||||
<< "<br><b>scale:</b> " << scale
|
<< "<br><b>scale:</b> " << scale
|
||||||
|
|
||||||
|
<< "<br><b>server position X/Y/Z: </b>{" << (ZEROPOINT - pos.z) << ", " << (ZEROPOINT - pos.x) << ", " << pos.y << "}"
|
||||||
|
<< "<br><b>server orientation: </b>" << fabs(2 * glm::pi<float>() - glm::pi<float>() / 180.0 * (float(dir.y) < 0 ? fabs(float(dir.y)) + 180.0 : fabs(float(dir.y) - 180.0)))
|
||||||
|
|
||||||
<< "<br><b>textures Used:</b> " << model->header.nTextures
|
<< "<br><b>textures Used:</b> " << model->header.nTextures
|
||||||
<< "<br><b>size category:</b><span> " << size_cat;
|
<< "<br><b>size category:</b><span> " << size_cat;
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,31 @@ void selected_chunk_type::updateDetails(Noggit::Ui::detail_infos* detail_widget)
|
|||||||
<< "<br><b>textures used:</b> " << chunk->texture_set->num()
|
<< "<br><b>textures used:</b> " << chunk->texture_set->num()
|
||||||
<< "<br><b>textures:</b><span>";
|
<< "<br><b>textures:</b><span>";
|
||||||
|
|
||||||
|
// liquid details if the chunk has liquid data
|
||||||
|
if (chunk->mt->Water.hasData(0))
|
||||||
|
{
|
||||||
|
ChunkWater* waterchunk = chunk->liquid_chunk();
|
||||||
|
|
||||||
|
MH2O_Render liquid_render = waterchunk->Render.value_or(MH2O_Render{ 0xffffffffffffffff,0xffffffffffffffff });
|
||||||
|
|
||||||
|
if (waterchunk->hasData(0))
|
||||||
|
{
|
||||||
|
|
||||||
|
liquid_layer liquid = waterchunk->getLayers()->at(0); // only getting data from layer 0, maybe loop them ?
|
||||||
|
int liquid_flags = liquid.getSubchunks();
|
||||||
|
|
||||||
|
select_info << "\nliquid type: " << liquid.liquidID() << " (\"" << gLiquidTypeDB.getLiquidName(liquid.liquidID()) << "\")"
|
||||||
|
<< "\nliquid flags: "
|
||||||
|
// getting flags from the center tile
|
||||||
|
<< ((liquid_render.fishable >> (4 * 8 + 4)) & 1 ? "fishable " : "")
|
||||||
|
<< ((liquid_render.fatigue >> (4 * 8 + 4)) & 1 ? "fatigue" : "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
select_info << "\nno liquid data";
|
||||||
|
}
|
||||||
|
|
||||||
unsigned counter = 0;
|
unsigned counter = 0;
|
||||||
for (auto& tex : *(chunk->texture_set->getTextures()))
|
for (auto& tex : *(chunk->texture_set->getTextures()))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -173,6 +173,10 @@ void WMOInstance::updateDetails(Noggit::Ui::detail_infos* detail_widget)
|
|||||||
<< "<br><b>WMO Id: </b>" << wmo->WmoId
|
<< "<br><b>WMO Id: </b>" << wmo->WmoId
|
||||||
<< "<br><b>doodad set: </b>" << doodadset()
|
<< "<br><b>doodad set: </b>" << doodadset()
|
||||||
<< "<br><b>name set: </b>" << mNameset
|
<< "<br><b>name set: </b>" << mNameset
|
||||||
|
|
||||||
|
<< "<br><b>server position X/Y/Z: </b>{" << (ZEROPOINT - pos.z) << ", " << (ZEROPOINT - pos.x) << ", " << pos.y << "}"
|
||||||
|
<< "<br><b>server orientation: </b>" << fabs(2 * glm::pi<float>() - glm::pi<float>() / 180.0 * (float(dir.y) < 0 ? fabs(float(dir.y)) + 180.0 : fabs(float(dir.y) - 180.0)))
|
||||||
|
|
||||||
<< "<br><b>textures used: </b>" << wmo->textures.size()
|
<< "<br><b>textures used: </b>" << wmo->textures.size()
|
||||||
<< "<span>";
|
<< "<span>";
|
||||||
|
|
||||||
|
|||||||
@@ -376,10 +376,11 @@ void World::rotate_selected_models_to_ground_normal(bool smoothNormals)
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// We shouldn't end up with empty ever.
|
// !\ todo We shouldn't end up with empty ever (but we do, on completely flat ground)
|
||||||
if (results.empty())
|
if (results.empty())
|
||||||
{
|
{
|
||||||
LogError << "rotate_selected_models_to_ground_normal ray intersection failed" << std::endl;
|
// just to avoid models disappearing when this happens
|
||||||
|
updateTilesEntry(entry, model_update::add);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -104,4 +104,6 @@ private:
|
|||||||
private:
|
private:
|
||||||
glm::vec3 pos;
|
glm::vec3 pos;
|
||||||
ChunkWater* _chunk;
|
ChunkWater* _chunk;
|
||||||
|
|
||||||
|
friend class MapView;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
#include <noggit/MapHeaders.h>
|
#include <noggit/MapHeaders.h>
|
||||||
#include <noggit/MapView.h>
|
#include <noggit/MapView.h>
|
||||||
#include <noggit/World.h>
|
#include <noggit/World.h>
|
||||||
|
#include <noggit/ChunkWater.hpp>
|
||||||
#include <noggit/ContextObject.hpp>
|
#include <noggit/ContextObject.hpp>
|
||||||
|
|
||||||
namespace Noggit
|
namespace Noggit
|
||||||
@@ -150,6 +151,73 @@ namespace Noggit
|
|||||||
return vert(state(), _chunk, index);
|
return vert(state(), _chunk, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool chunk::has_render_flags()
|
||||||
|
{
|
||||||
|
return _chunk->liquid_chunk()->Render.has_value();
|
||||||
|
}
|
||||||
|
|
||||||
|
MH2O_Render chunk::getRenderOrDefault()
|
||||||
|
{
|
||||||
|
std::optional<MH2O_Render> render = _chunk->liquid_chunk()->Render;
|
||||||
|
if (render.has_value())
|
||||||
|
{
|
||||||
|
return render.value();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return { 0xFFFFFFFFFFFFFFFF,1 };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MH2O_Render& chunk::getOrCreateRender()
|
||||||
|
{
|
||||||
|
std::optional<MH2O_Render>& render = _chunk->liquid_chunk()->Render;
|
||||||
|
if (!render.has_value())
|
||||||
|
{
|
||||||
|
render.emplace();
|
||||||
|
}
|
||||||
|
return render.value();
|
||||||
|
}
|
||||||
|
|
||||||
|
void chunk::set_deep_flag(std::uint32_t low, std::uint32_t high)
|
||||||
|
{
|
||||||
|
getOrCreateRender().fatigue = std::uint64_t(low) | (std::uint64_t(high) << 32);
|
||||||
|
}
|
||||||
|
|
||||||
|
void chunk::set_deep_flag_1(std::uint32_t low)
|
||||||
|
{
|
||||||
|
set_deep_flag(low, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::uint32_t chunk::get_deep_flag()
|
||||||
|
{
|
||||||
|
return static_cast<std::uint32_t>(getRenderOrDefault().fatigue);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::uint32_t chunk::get_deep_flag_high()
|
||||||
|
{
|
||||||
|
return static_cast<std::uint32_t>(getRenderOrDefault().fatigue >> 32);
|
||||||
|
}
|
||||||
|
|
||||||
|
void chunk::set_fishable_flag(std::uint32_t low, std::uint32_t high)
|
||||||
|
{
|
||||||
|
getOrCreateRender().fishable = std::uint64_t(low) | (std::uint64_t(high) << 32);
|
||||||
|
}
|
||||||
|
|
||||||
|
void chunk::set_fishable_flag_1(std::uint32_t low)
|
||||||
|
{
|
||||||
|
set_fishable_flag(low, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::uint32_t chunk::get_fishable_flag()
|
||||||
|
{
|
||||||
|
return static_cast<std::uint32_t>(getRenderOrDefault().fishable);
|
||||||
|
}
|
||||||
|
std::uint32_t chunk::get_fishable_flag_high()
|
||||||
|
{
|
||||||
|
return static_cast<std::uint32_t>(getRenderOrDefault().fishable >> 32);
|
||||||
|
}
|
||||||
|
|
||||||
std::shared_ptr<selection> chunk::to_selection()
|
std::shared_ptr<selection> chunk::to_selection()
|
||||||
{
|
{
|
||||||
return std::make_shared<selection>(state(), "chunk#to_selection", _chunk->vmin,_chunk->vmax);
|
return std::make_shared<selection>(state(), "chunk#to_selection", _chunk->vmin,_chunk->vmax);
|
||||||
@@ -185,6 +253,18 @@ namespace Noggit
|
|||||||
, "to_selection", &chunk::to_selection
|
, "to_selection", &chunk::to_selection
|
||||||
, "get_tex", &chunk::get_tex
|
, "get_tex", &chunk::get_tex
|
||||||
, "get_vert", &chunk::get_vert
|
, "get_vert", &chunk::get_vert
|
||||||
|
, "set_deep_flag", sol::overload(
|
||||||
|
&chunk::set_deep_flag
|
||||||
|
, &chunk::set_deep_flag_1
|
||||||
|
)
|
||||||
|
, "get_deep_flag", &chunk::get_deep_flag
|
||||||
|
, "get_deep_flag_high", &chunk::get_deep_flag_high
|
||||||
|
, "set_fishable_flag", sol::overload(
|
||||||
|
&chunk::set_fishable_flag
|
||||||
|
, &chunk::set_fishable_flag_1
|
||||||
|
)
|
||||||
|
, "get_fishable_flag", &chunk::get_fishable_flag
|
||||||
|
, "get_fishable_flag_high", &chunk::get_fishable_flag_high
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} // namespace Scripting
|
} // namespace Scripting
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
#include <noggit/scripting/script_vert.hpp>
|
#include <noggit/scripting/script_vert.hpp>
|
||||||
#include <noggit/scripting/script_object.hpp>
|
#include <noggit/scripting/script_object.hpp>
|
||||||
#include <noggit/MapChunk.h>
|
#include <noggit/MapChunk.h>
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
namespace Noggit
|
namespace Noggit
|
||||||
{
|
{
|
||||||
@@ -32,6 +33,18 @@ namespace Noggit
|
|||||||
void apply_heightmap();
|
void apply_heightmap();
|
||||||
void apply_vertex_color();
|
void apply_vertex_color();
|
||||||
void apply_all();
|
void apply_all();
|
||||||
|
|
||||||
|
void set_deep_flag(std::uint32_t low, std::uint32_t high);
|
||||||
|
void set_deep_flag_1(std::uint32_t low);
|
||||||
|
std::uint32_t get_deep_flag();
|
||||||
|
std::uint32_t get_deep_flag_high();
|
||||||
|
|
||||||
|
void set_fishable_flag(std::uint32_t low, std::uint32_t high);
|
||||||
|
void set_fishable_flag_1(std::uint32_t low);
|
||||||
|
std::uint32_t get_fishable_flag();
|
||||||
|
std::uint32_t get_fishable_flag_high();
|
||||||
|
bool has_render_flags();
|
||||||
|
|
||||||
void set_impassable(bool add);
|
void set_impassable(bool add);
|
||||||
int get_area_id();
|
int get_area_id();
|
||||||
void set_area_id(int value);
|
void set_area_id(int value);
|
||||||
@@ -39,6 +52,8 @@ namespace Noggit
|
|||||||
vert get_vert(int index);
|
vert get_vert(int index);
|
||||||
std::shared_ptr<selection> to_selection();
|
std::shared_ptr<selection> to_selection();
|
||||||
private:
|
private:
|
||||||
|
MH2O_Render getRenderOrDefault();
|
||||||
|
MH2O_Render& getOrCreateRender();
|
||||||
MapChunk* _chunk;
|
MapChunk* _chunk;
|
||||||
friend class selection;
|
friend class selection;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user