Skip to content

Commit

Permalink
Improved large jungle and acacia tree generation (cuberite#4413)
Browse files Browse the repository at this point in the history
  • Loading branch information
NiLSPACE authored and madmaxoft committed Dec 22, 2019
1 parent e3b6f2d commit dc787e1
Show file tree
Hide file tree
Showing 8 changed files with 410 additions and 295 deletions.
22 changes: 22 additions & 0 deletions Tools/GrownBiomeGenVisualiser/Globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,14 @@



#ifndef TOLUA_TEMPLATE_BIND
#define TOLUA_TEMPLATE_BIND(x)
#endif





// Integral types with predefined sizes:
typedef long long Int64;
typedef int Int32;
Expand Down Expand Up @@ -226,6 +234,20 @@ template <typename Type> class cItemCallback
} ;





/** Clamp X to the specified range. */
template <typename T>
T Clamp(T a_Value, T a_Min, T a_Max)
{
return (a_Value < a_Min) ? a_Min : ((a_Value > a_Max) ? a_Max : a_Value);
}





#include "BiomeDef.h"


15 changes: 15 additions & 0 deletions Tools/NoiseSpeedTest/Globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,14 @@



#ifndef TOLUA_TEMPLATE_BIND
#define TOLUA_TEMPLATE_BIND(x)
#endif





// Integral types with predefined sizes:
typedef long long Int64;
typedef int Int32;
Expand Down Expand Up @@ -225,3 +233,10 @@ template <typename Type> class cItemCallback




/** Clamps the value into the specified range. */
template <typename T>
T Clamp(T a_Value, T a_Min, T a_Max)
{
return (a_Value < a_Min) ? a_Min : ((a_Value > a_Max) ? a_Max : a_Value);
}
5 changes: 5 additions & 0 deletions src/ChunkDef.h
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,11 @@ struct sSetBlock
cChunkDef::AbsoluteToRelative(m_RelX, m_RelY, m_RelZ, m_ChunkX, m_ChunkZ);
}

sSetBlock(Vector3i a_BlockPos, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) :
sSetBlock(a_BlockPos.x, a_BlockPos.y, a_BlockPos.z, a_BlockType, a_BlockMeta)
{
}

sSetBlock(int a_ChunkX, int a_ChunkZ, int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) :
m_RelX(a_RelX), m_RelY(a_RelY), m_RelZ(a_RelZ),
m_ChunkX(a_ChunkX), m_ChunkZ(a_ChunkZ),
Expand Down
5 changes: 3 additions & 2 deletions src/Generating/StructGen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ void cStructGenTrees::GenerateSingleTree(

sSetBlockVector TreeLogs, TreeOther;
GetTreeImageByBiome(
a_ChunkX * cChunkDef::Width + x, Height + 1, a_ChunkZ * cChunkDef::Width + z,
{ a_ChunkX * cChunkDef::Width + x, Height + 1, a_ChunkZ * cChunkDef::Width + z },
m_Noise, a_Seq,
a_ChunkDesc.GetBiome(x, z),
TreeLogs, TreeOther
Expand Down Expand Up @@ -157,9 +157,10 @@ void cStructGenTrees::ApplyTreeImage(
// Inside this chunk, integrate into a_ChunkDesc:
switch (a_ChunkDesc.GetBlockType(itr->m_RelX, itr->m_RelY, itr->m_RelZ))
{
case E_BLOCK_NEW_LEAVES:
case E_BLOCK_LEAVES:
{
if (itr->m_BlockType != E_BLOCK_LOG)
if ((itr->m_BlockType != E_BLOCK_LOG) && (itr->m_BlockType != E_BLOCK_NEW_LOG))
{
break;
}
Expand Down
Loading

0 comments on commit dc787e1

Please sign in to comment.