fix previous unfinished merge conflicts
This commit is contained in:
@@ -32,25 +32,26 @@ namespace math
|
||||
{
|
||||
assert(false);
|
||||
}
|
||||
// pre compute inverted direction
|
||||
_inverted_direction.x = (_direction.x != 0.0f) ? 1.0f / _direction.x : std::numeric_limits<float>::max();
|
||||
_inverted_direction.y = (_direction.y != 0.0f) ? 1.0f / _direction.y : std::numeric_limits<float>::max();
|
||||
_inverted_direction.z = (_direction.z != 0.0f) ? 1.0f / _direction.z : std::numeric_limits<float>::max();
|
||||
|
||||
}
|
||||
|
||||
std::optional<float> ray::intersect_bounds
|
||||
(glm::vec3 const& min, glm::vec3 const& max) const noexcept
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
|
||||
float tmin (std::numeric_limits<float>::lowest());
|
||||
float tmax (std::numeric_limits<float>::max());
|
||||
|
||||
if (_direction.x != 0.0f)
|
||||
{
|
||||
float tx1 = (min.x - _origin.x) * _inverted_direction.x;
|
||||
float tx2 = (max.x - _origin.x) * _inverted_direction.x;
|
||||
const float tx1 = (min.x - _origin.x) * _inverted_direction.x;
|
||||
const float tx2 = (max.x - _origin.x) * _inverted_direction.x;
|
||||
// float const tx1((min.x - _origin.x) / _direction.x);
|
||||
// float const tx2((max.x - _origin.x) / _direction.x);
|
||||
=======
|
||||
float tmin(std::numeric_limits<float>::lowest());
|
||||
float tmax(std::numeric_limits<float>::max());
|
||||
>>>>>>> origin/ground_effects_editor
|
||||
|
||||
tmin = std::max(tmin, std::min(tx1, tx2));
|
||||
tmax = std::min(tmax, std::max(tx1, tx2));
|
||||
|
||||
@@ -40,8 +40,14 @@ namespace math
|
||||
return _origin + _direction * distance;
|
||||
}
|
||||
|
||||
glm::vec3 const origin() const
|
||||
{
|
||||
return _origin;
|
||||
}
|
||||
|
||||
private:
|
||||
glm::vec3 _origin;
|
||||
glm::vec3 _direction;
|
||||
glm::vec3 const _origin;
|
||||
glm::vec3 const _direction;
|
||||
glm::vec3 _inverted_direction;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <noggit/AsyncObject.h>
|
||||
#include <noggit/errorHandling.h>
|
||||
#include <noggit/Log.h>
|
||||
#include <util/exception_to_string.hpp>
|
||||
|
||||
#include <QtCore/QSettings>
|
||||
|
||||
|
||||
@@ -1614,27 +1614,27 @@ void MapTile::setVertexColorImage(QImage const& baseimage, int mode, bool tiledE
|
||||
case 1: // Add
|
||||
{
|
||||
auto color = image.pixelColor((k * 16) + x, (l * 16) + y);
|
||||
colors[idx].x = std::min(2.0f, std::max(0.0f, colors[idx].x + color.redF() * 2.f));
|
||||
colors[idx].y = std::min(2.0f, std::max(0.0f, colors[idx].y + color.greenF() * 2.f));
|
||||
colors[idx].z = std::min(2.0f, std::max(0.0f, colors[idx].z + color.blueF() * 2.f));
|
||||
colors[idx].x = std::min(2.0f, std::max(0.0f, colors[idx].x + static_cast<float>(color.redF() * 2.f)));
|
||||
colors[idx].y = std::min(2.0f, std::max(0.0f, colors[idx].y + static_cast<float>(color.greenF() * 2.f)));
|
||||
colors[idx].z = std::min(2.0f, std::max(0.0f, colors[idx].z + static_cast<float>(color.blueF() * 2.f)));
|
||||
break;
|
||||
}
|
||||
|
||||
case 2: // Subtract
|
||||
{
|
||||
auto color = image.pixelColor((k * 16) + x, (l * 16) + y);
|
||||
colors[idx].x = std::min(2.0f, std::max(0.0f, colors[idx].x - color.redF() * 2.f));
|
||||
colors[idx].y = std::min(2.0f, std::max(0.0f, colors[idx].y - color.greenF() * 2.f));
|
||||
colors[idx].z = std::min(2.0f, std::max(0.0f, colors[idx].z - color.blueF() * 2.f));
|
||||
colors[idx].x = std::min(2.0f, std::max(0.0f, colors[idx].x - static_cast<float>(color.redF() * 2.f)));
|
||||
colors[idx].y = std::min(2.0f, std::max(0.0f, colors[idx].y - static_cast<float>(color.greenF() * 2.f)));
|
||||
colors[idx].z = std::min(2.0f, std::max(0.0f, colors[idx].z - static_cast<float>(color.blueF() * 2.f)));
|
||||
break;
|
||||
}
|
||||
|
||||
case 3: // Multiply
|
||||
{
|
||||
auto color = image.pixelColor((k * 16) + x, (l * 16) + y);
|
||||
colors[idx].x = std::min(2.0f, std::max(0.0f, colors[idx].x * color.redF() * 2.f));
|
||||
colors[idx].y = std::min(2.0f, std::max(0.0f, colors[idx].y * color.greenF() * 2.f));
|
||||
colors[idx].z = std::min(2.0f, std::max(0.0f, colors[idx].z * color.blueF() * 2.f));
|
||||
colors[idx].x = std::min(2.0f, std::max(0.0f, colors[idx].x * static_cast<float>(color.redF() * 2.f)));
|
||||
colors[idx].y = std::min(2.0f, std::max(0.0f, colors[idx].y * static_cast<float>(color.greenF() * 2.f)));
|
||||
colors[idx].z = std::min(2.0f, std::max(0.0f, colors[idx].z * static_cast<float>(color.blueF() * 2.f)));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,7 +76,11 @@ WMOInstance::WMOInstance(WMOInstance&& other) noexcept
|
||||
, _doodadset(other._doodadset)
|
||||
, _doodads_per_group(other._doodads_per_group)
|
||||
, _need_doodadset_update(other._need_doodadset_update)
|
||||
, _need_recalc_extents(other._need_recalc_extents)
|
||||
, _update_group_extents(other._update_group_extents)
|
||||
// , hasLowResModel(other.hasLowResModel)
|
||||
, render_low_res(other.render_low_res)
|
||||
, lowResInstance(other.lowResInstance)
|
||||
, lowResWmo(other.lowResWmo)
|
||||
{
|
||||
std::swap(extents, other.extents);
|
||||
pos = other.pos;
|
||||
@@ -107,6 +111,11 @@ WMOInstance& WMOInstance::operator= (WMOInstance&& other) noexcept
|
||||
std::swap(_transform_mat_inverted, other._transform_mat_inverted);
|
||||
std::swap(_context, other._context);
|
||||
std::swap(_need_recalc_extents, other._need_recalc_extents);
|
||||
std::swap(_update_group_extents, other._update_group_extents);
|
||||
// std::swap(hasLowResModel, other.hasLowResModel);
|
||||
std::swap(render_low_res, other.render_low_res);
|
||||
std::swap(lowResInstance, other.lowResInstance);
|
||||
std::swap(lowResWmo, other.lowResWmo);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
@@ -28,12 +28,11 @@ public:
|
||||
bool render_low_res = false;
|
||||
|
||||
|
||||
uint16_t doodadset() const { return _doodadset; };
|
||||
uint16_t doodadset() const;
|
||||
void change_doodadset(uint16_t doodad_set);
|
||||
|
||||
[[nodiscard]]
|
||||
std::map<int, std::pair<glm::vec3, glm::vec3>> const& getGroupExtents();
|
||||
std::map<int, std::pair<glm::vec3, glm::vec3>> const& getGroupExtents() { _update_group_extents = true; ensureExtents(); return group_extents; }
|
||||
|
||||
private:
|
||||
void update_doodads();
|
||||
@@ -53,63 +52,12 @@ public:
|
||||
WMOInstance(WMOInstance const& other) = default;
|
||||
WMOInstance& operator=(WMOInstance const& other) = default;
|
||||
|
||||
WMOInstance (WMOInstance&& other)
|
||||
: SceneObject(other._type, other._context)
|
||||
, wmo (std::move (other.wmo))
|
||||
, group_extents(other.group_extents)
|
||||
, mFlags (other.mFlags)
|
||||
, mNameset (other.mNameset)
|
||||
, _doodadset (other._doodadset)
|
||||
, _doodads_per_group(other._doodads_per_group)
|
||||
, _need_doodadset_update(other._need_doodadset_update)
|
||||
WMOInstance(WMOInstance&& other) noexcept;
|
||||
, _update_group_extents(other._update_group_extents)
|
||||
// , hasLowResModel(other.hasLowResModel)
|
||||
, render_low_res(other.render_low_res)
|
||||
, lowResInstance(other.lowResInstance)
|
||||
, lowResWmo(other.lowResWmo)
|
||||
{
|
||||
std::swap (extents, other.extents);
|
||||
pos = other.pos;
|
||||
scale = other.scale;
|
||||
dir = other.dir;
|
||||
_context = other._context;
|
||||
uid = other.uid;
|
||||
|
||||
_transform_mat = other._transform_mat;
|
||||
_transform_mat_inverted = other._transform_mat_inverted;
|
||||
}
|
||||
|
||||
WMOInstance& operator= (WMOInstance&& other) noexcept;
|
||||
WMOInstance& operator= (WMOInstance&& other)
|
||||
{
|
||||
std::swap(wmo, other.wmo);
|
||||
std::swap(pos, other.pos);
|
||||
std::swap(extents, other.extents);
|
||||
std::swap(group_extents, other.group_extents);
|
||||
std::swap(dir, other.dir);
|
||||
std::swap(uid, other.uid);
|
||||
std::swap(scale, other.scale);
|
||||
std::swap(mFlags, other.mFlags);
|
||||
std::swap(mNameset, other.mNameset);
|
||||
std::swap(_doodadset, other._doodadset);
|
||||
std::swap(_doodads_per_group, other._doodads_per_group);
|
||||
std::swap(_need_doodadset_update, other._need_doodadset_update);
|
||||
std::swap(_transform_mat, other._transform_mat);
|
||||
std::swap(_transform_mat_inverted, other._transform_mat_inverted);
|
||||
std::swap(_context, other._context);
|
||||
std::swap(_need_recalc_extents, other._need_recalc_extents);
|
||||
std::swap(_update_group_extents, other._update_group_extents);
|
||||
// std::swap(hasLowResModel, other.hasLowResModel);
|
||||
std::swap(render_low_res, other.render_low_res);
|
||||
std::swap(lowResInstance, other.lowResInstance);
|
||||
std::swap(lowResWmo, other.lowResWmo);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
void draw ( OpenGL::Scoped::use_program& wmo_shader
|
||||
, glm::mat4x4 const& model_view
|
||||
, glm::mat4x4 const& projection
|
||||
, const glm::mat4x4 const& model_view
|
||||
, const glm::mat4x4 const& projection
|
||||
, math::frustum const& frustum
|
||||
@@ -134,16 +82,15 @@ public:
|
||||
std::array<glm::vec3, 2> const& getExtents() override; // axis aligned
|
||||
std::array<glm::vec3, 2> const& getLocalExtents() const;
|
||||
std::array<glm::vec3, 8> getBoundingBox() override; // not axis aligned
|
||||
inline bool extentsDirty() const { return _need_recalc_extents || !wmo->finishedLoading(); };
|
||||
bool extentsDirty() const;;
|
||||
void recalcExtents() override;
|
||||
void change_nameset(uint16_t name_set);
|
||||
void ensureExtents() override;
|
||||
bool finishedLoading() override { return wmo->finishedLoading(); };
|
||||
bool finishedLoading() override;;
|
||||
virtual void updateDetails(Noggit::Ui::detail_infos* detail_widget) override;
|
||||
|
||||
[[nodiscard]]
|
||||
AsyncObject* instance_model() const override;;
|
||||
AsyncObject* instance_model() const override { return wmo.get(); };
|
||||
|
||||
std::vector<wmo_doodad_instance*> get_visible_doodads( math::frustum const& frustum
|
||||
, float const& cull_distance
|
||||
|
||||
@@ -1336,7 +1336,7 @@ void WorldRender::draw (glm::mat4x4 const& model_view
|
||||
}
|
||||
|
||||
// Draw Sky/Light spheres
|
||||
gl.cullFace(GL_FRONT);
|
||||
glCullFace(GL_FRONT);
|
||||
if (!render_settings.draw_only_inside_light_sphere)
|
||||
{
|
||||
for (Sky const& sky : skies()->skies)
|
||||
@@ -1375,7 +1375,7 @@ void WorldRender::draw (glm::mat4x4 const& model_view
|
||||
}
|
||||
|
||||
// now draw the current light (light that we're inside of)
|
||||
gl.cullFace(GL_BACK);
|
||||
glCullFace(GL_BACK);
|
||||
for (Sky const& sky : skies()->skies)
|
||||
{
|
||||
if (sky.global)
|
||||
@@ -2114,7 +2114,7 @@ bool WorldRender::saveMinimap(TileIndex const& tile_idx, MinimapRenderSettings*
|
||||
, 0.f, 0.f, 0.f, 1.f
|
||||
));
|
||||
|
||||
gl.finish();
|
||||
glFinish();
|
||||
|
||||
drawMinimap(mTile
|
||||
, look_at
|
||||
|
||||
Reference in New Issue
Block a user