Add ITerrainSceneNode::setFixedBorderLOD to handle connecting terrain nodes without gaps. Thanks @diho for the bugreport, testcase and a patch proposal.

Forum: http://irrlicht.sourceforge.net/forum/viewtopic.php?f=9&t=51220


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5610 dfc29bdd-3216-0410-991c-e03cc46cb475
master
cutealien 2018-05-14 21:03:11 +00:00
parent 1d99bd8ff2
commit a8b9071f96
4 changed files with 31 additions and 3 deletions

View File

@ -1,7 +1,8 @@
--------------------------
Changes in 1.9 (not yet released)
- PLY loader now works with files which use "st" instead of "uv" for texture coordinates (like generated from Blender or Assimp). Thanks @JLouisB for patch (http://irrlicht.sourceforge.net/forum/viewtopic.php?f=9&t=52261)
- STL writer does now also write binary files when EMWF_WRITE_BINARY flag is used. Based on patch from JLouisB. (Forum: http://irrlicht.sourceforge.net/forum/viewtopic.php?f=9&t=52261)
- Add ITerrainSceneNode::setFixedBorderLOD to handle connecting terrain nodes without gaps. Thanks @diho for the bugreport, testcase and a patch proposal (http://irrlicht.sourceforge.net/forum/viewtopic.php?f=9&t=51220).
- PLY loader now works with files which use "st" instead of "uv" for texture coordinates (like generated from Blender or Assimp). Thanks @JLouisB for patch (http://irrlicht.sourceforge.net/forum/viewtopic.php?f=9&t=52261).
- STL writer does now also write binary files when EMWF_WRITE_BINARY flag is used. Based on patch from JLouisB (http://irrlicht.sourceforge.net/forum/viewtopic.php?f=9&t=52261).
(EMWF_WRITE_COMPRESSED also still works for downward compatibility)
- Improved PLY exporter. Thanks for Patch from JLouisB. (Forum: http://irrlicht.sourceforge.net/forum/viewtopic.php?f=9&t=52261):
- Support for UV and vertex colors.

View File

@ -100,7 +100,9 @@ namespace scene
virtual s32 getCurrentLODOfPatches(core::array<s32>& LODs) const =0;
//! Manually sets the LOD of a patch
/** \param patchX Patch x coordinate.
/** NOTE: Any values set here are overwritten again in the automatic
recalculations when the camera changes.
\param patchX Patch x coordinate.
\param patchZ Patch z coordinate.
\param LOD The level of detail to set the patch to. */
virtual void setLODOfPatch(s32 patchX, s32 patchZ, s32 LOD=0) =0;
@ -172,6 +174,12 @@ namespace scene
video::SColor vertexColor=video::SColor(255,255,255,255),
s32 smoothFactor=0) =0;
//! Force node to use a fixed LOD level at the borders of the terrain.
/** This can be useful when several TerrainSceneNodes are connected.
\param borderLOD When >= 0 all patches at the 4 borders will use the
given LOD. When < 0 borders are just regular patches (that's default). */
virtual void setFixedBorderLOD(irr::s32 borderLOD=0) = 0;
};
} // end namespace scene

View File

@ -38,6 +38,7 @@ namespace scene
TerrainData(patchSize, maxLOD, position, rotation, scale), RenderBuffer(0),
VerticesToRender(0), IndicesToRender(0), DynamicSelectorUpdate(false),
OverrideDistanceThreshold(false), UseDefaultRotationPivot(true), ForceRecalculation(true),
FixedBorderLOD(-1),
CameraMovementDelta(10.0f), CameraRotationDelta(1.0f),CameraFOVDelta(0.1f),
TCoordScale1(1.0f), TCoordScale2(1.0f), SmoothFactor(0), FileSystem(fs)
{
@ -640,7 +641,18 @@ namespace scene
{
const f32 distance = cameraPosition.getDistanceFromSQ(TerrainData.Patches[j].Center);
if ( FixedBorderLOD >= 0 )
{
TerrainData.Patches[j].CurrentLOD = FixedBorderLOD;
if (j < TerrainData.PatchCount
|| j >= (count - TerrainData.PatchCount)
|| (j % TerrainData.PatchCount) == 0
|| (j % TerrainData.PatchCount) == TerrainData.PatchCount-1)
continue;
}
TerrainData.Patches[j].CurrentLOD = 0;
for (s32 i = TerrainData.MaxLOD - 1; i>0; --i)
{
if (distance >= TerrainData.LODDistanceThreshold[i])

View File

@ -202,6 +202,12 @@ namespace scene
//! Scales the two textures
virtual void scaleTexture(f32 scale = 1.0f, f32 scale2 = 0.0f) _IRR_OVERRIDE_;
//! Force node to use a fixed LOD level at the borders of the terrain.
virtual void setFixedBorderLOD(irr::s32 borderLOD) _IRR_OVERRIDE_
{
FixedBorderLOD = borderLOD;
}
//! Returns type of the scene node
virtual ESCENE_NODE_TYPE getType() const _IRR_OVERRIDE_ {return ESNT_TERRAIN;}
@ -303,6 +309,7 @@ namespace scene
bool OverrideDistanceThreshold;
bool UseDefaultRotationPivot;
bool ForceRecalculation;
s32 FixedBorderLOD;
core::vector3df OldCameraPosition;
core::vector3df OldCameraRotation;