forked from townforge/townforge
game: do not use surface net rendering if a flag has default smoothness
This commit is contained in:
parent
1fca55e873
commit
5d206fed00
@ -1748,6 +1748,14 @@ void CityMeshSection::GenerateSurfaceNets(const std::shared_ptr<Flag> &flag, Sha
|
||||
customModel->SetCastShadows(true);
|
||||
}
|
||||
|
||||
RenderMode CityMeshSection::SelectRenderMode(const std::shared_ptr<Flag> &flag) const
|
||||
{
|
||||
const bool maybe_has_smoothness = flag->has_smoothness() || flag->unpackers > 0;
|
||||
if (renderMode == RenderSurfaceNets && !maybe_has_smoothness)
|
||||
return RenderSpanningRectangles;
|
||||
return renderMode;
|
||||
}
|
||||
|
||||
template<typename C>
|
||||
void CityMeshSection::RebuildFlags(const C &flags, const Selection &selection, bool highlight_new)
|
||||
{
|
||||
@ -1817,7 +1825,7 @@ void CityMeshSection::RebuildFlags(const C &flags, const Selection &selection, b
|
||||
parent = it->second;
|
||||
}
|
||||
|
||||
const RenderMode flagRenderMode = renderMode;
|
||||
const RenderMode flagRenderMode = SelectRenderMode(flag);
|
||||
SharedPtr<Node> blockNode;
|
||||
if (flagRenderMode == RenderMergedCubes || flagRenderMode == RenderOptimizedCubes || flagRenderMode == RenderSingleQuads || flagRenderMode == RenderSpanningColumns || flagRenderMode == RenderSpanningRectangles || flagRenderMode == RenderSurfaceNets)
|
||||
{
|
||||
|
@ -209,6 +209,7 @@ private:
|
||||
std::vector<::Tile> MakeFlagLOD(const std::shared_ptr<Flag> &flag, unsigned shift) const;
|
||||
void ConfigureGroundShader();
|
||||
void GenerateSurfaceNets(const std::shared_ptr<Flag> &flag, Urho3D::SharedPtr<Urho3D::Node> &blockNode, uint32_t shift, const std::vector<uint16_t> &sndata, int32_t x_len, int32_t y_len, int32_t z_len, float dx, float dy, float h, float lod_scale, uint32_t ox, uint32_t oy, int32_t maxval, int32_t minval);
|
||||
RenderMode SelectRenderMode(const std::shared_ptr<Flag> &flag) const;
|
||||
|
||||
private:
|
||||
const GameState *game;
|
||||
|
@ -296,6 +296,11 @@ bool Flag::has_model() const
|
||||
return !packed_tiles.empty();
|
||||
}
|
||||
|
||||
bool Flag::has_smoothness() const
|
||||
{
|
||||
return !packed_smoothness.empty();
|
||||
}
|
||||
|
||||
bool Flag::pack()
|
||||
{
|
||||
if (unpackers == 0)
|
||||
|
@ -137,6 +137,7 @@ public:
|
||||
const std::vector<uint8_t> &get_packed_smoothness() const { return packed_smoothness; }
|
||||
void set_dirty();
|
||||
bool has_model() const;
|
||||
bool has_smoothness() const;
|
||||
void change_lightsource(uint8_t x, uint8_t y, uint16_t h, bool toggle_enabled, int32_t powder_delta);
|
||||
|
||||
bool push_tiles(uint32_t px0, uint32_t py0, uint32_t px1, uint32_t py1, uint16_t build_height, const uint8_t *type_ptr, uint16_t type_len);
|
||||
|
Loading…
Reference in New Issue
Block a user