Merge remote-tracking branch 'origin/master' into 1.7

# Conflicts:
#	Flax.flaxproj
This commit is contained in:
Wojtek Figat
2023-10-09 12:40:47 +02:00
86 changed files with 1406 additions and 686 deletions

View File

@@ -285,6 +285,7 @@ bool TerrainTools::GenerateTerrain(Terrain* terrain, const Int2& numberOfPatches
StringAnsi TerrainTools::SerializePatch(Terrain* terrain, const Int2& patchCoord)
{
CHECK_RETURN(terrain, StringAnsi::Empty);
auto patch = terrain->GetPatch(patchCoord);
CHECK_RETURN(patch, StringAnsi::Empty);
@@ -300,6 +301,7 @@ StringAnsi TerrainTools::SerializePatch(Terrain* terrain, const Int2& patchCoord
void TerrainTools::DeserializePatch(Terrain* terrain, const Int2& patchCoord, const StringAnsiView& value)
{
CHECK(terrain);
auto patch = terrain->GetPatch(patchCoord);
CHECK(patch);
@@ -317,27 +319,31 @@ void TerrainTools::DeserializePatch(Terrain* terrain, const Int2& patchCoord, co
bool TerrainTools::InitializePatch(Terrain* terrain, const Int2& patchCoord)
{
CHECK_RETURN(terrain, true);
auto patch = terrain->GetPatch(patchCoord);
CHECK_RETURN(patch, true);
return patch->InitializeHeightMap();
}
bool TerrainTools::ModifyHeightMap(Terrain* terrain, const Int2& patchCoord, float* samples, const Int2& offset, const Int2& size)
bool TerrainTools::ModifyHeightMap(Terrain* terrain, const Int2& patchCoord, const float* samples, const Int2& offset, const Int2& size)
{
CHECK_RETURN(terrain, true);
auto patch = terrain->GetPatch(patchCoord);
CHECK_RETURN(patch, true);
return patch->ModifyHeightMap(samples, offset, size);
}
bool TerrainTools::ModifyHolesMask(Terrain* terrain, const Int2& patchCoord, byte* samples, const Int2& offset, const Int2& size)
bool TerrainTools::ModifyHolesMask(Terrain* terrain, const Int2& patchCoord, const byte* samples, const Int2& offset, const Int2& size)
{
CHECK_RETURN(terrain, true);
auto patch = terrain->GetPatch(patchCoord);
CHECK_RETURN(patch, true);
return patch->ModifyHolesMask(samples, offset, size);
}
bool TerrainTools::ModifySplatMap(Terrain* terrain, const Int2& patchCoord, int32 index, Color32* samples, const Int2& offset, const Int2& size)
bool TerrainTools::ModifySplatMap(Terrain* terrain, const Int2& patchCoord, int32 index, const Color32* samples, const Int2& offset, const Int2& size)
{
CHECK_RETURN(terrain, true);
auto patch = terrain->GetPatch(patchCoord);
CHECK_RETURN(patch, true);
CHECK_RETURN(index >= 0 && index < TERRAIN_MAX_SPLATMAPS_COUNT, true);
@@ -346,6 +352,7 @@ bool TerrainTools::ModifySplatMap(Terrain* terrain, const Int2& patchCoord, int3
float* TerrainTools::GetHeightmapData(Terrain* terrain, const Int2& patchCoord)
{
CHECK_RETURN(terrain, nullptr);
auto patch = terrain->GetPatch(patchCoord);
CHECK_RETURN(patch, nullptr);
return patch->GetHeightmapData();
@@ -353,6 +360,7 @@ float* TerrainTools::GetHeightmapData(Terrain* terrain, const Int2& patchCoord)
byte* TerrainTools::GetHolesMaskData(Terrain* terrain, const Int2& patchCoord)
{
CHECK_RETURN(terrain, nullptr);
auto patch = terrain->GetPatch(patchCoord);
CHECK_RETURN(patch, nullptr);
return patch->GetHolesMaskData();
@@ -360,6 +368,7 @@ byte* TerrainTools::GetHolesMaskData(Terrain* terrain, const Int2& patchCoord)
Color32* TerrainTools::GetSplatMapData(Terrain* terrain, const Int2& patchCoord, int32 index)
{
CHECK_RETURN(terrain, nullptr);
auto patch = terrain->GetPatch(patchCoord);
CHECK_RETURN(patch, nullptr);
return patch->GetSplatMapData(index);

View File

@@ -68,7 +68,7 @@ DECLARE_SCRIPTING_TYPE_NO_SPAWN(TerrainTools);
/// <param name="offset">The offset from the first row and column of the heightmap data (offset destination x and z start position).</param>
/// <param name="size">The size of the heightmap to modify (x and z). Amount of samples in each direction.</param>
/// <returns>True if failed, otherwise false.</returns>
API_FUNCTION() static bool ModifyHeightMap(Terrain* terrain, API_PARAM(Ref) const Int2& patchCoord, float* samples, API_PARAM(Ref) const Int2& offset, API_PARAM(Ref) const Int2& size);
API_FUNCTION() static bool ModifyHeightMap(Terrain* terrain, API_PARAM(Ref) const Int2& patchCoord, const float* samples, API_PARAM(Ref) const Int2& offset, API_PARAM(Ref) const Int2& size);
/// <summary>
/// Modifies the terrain patch holes mask with the given samples.
@@ -79,7 +79,7 @@ DECLARE_SCRIPTING_TYPE_NO_SPAWN(TerrainTools);
/// <param name="offset">The offset from the first row and column of the mask data (offset destination x and z start position).</param>
/// <param name="size">The size of the mask to modify (x and z). Amount of samples in each direction.</param>
/// <returns>True if failed, otherwise false.</returns>
API_FUNCTION() static bool ModifyHolesMask(Terrain* terrain, API_PARAM(Ref) const Int2& patchCoord, byte* samples, API_PARAM(Ref) const Int2& offset, API_PARAM(Ref) const Int2& size);
API_FUNCTION() static bool ModifyHolesMask(Terrain* terrain, API_PARAM(Ref) const Int2& patchCoord, const byte* samples, API_PARAM(Ref) const Int2& offset, API_PARAM(Ref) const Int2& size);
/// <summary>
/// Modifies the terrain patch splat map (layers mask) with the given samples.
@@ -91,7 +91,7 @@ DECLARE_SCRIPTING_TYPE_NO_SPAWN(TerrainTools);
/// <param name="offset">The offset from the first row and column of the splatmap data (offset destination x and z start position).</param>
/// <param name="size">The size of the splatmap to modify (x and z). Amount of samples in each direction.</param>
/// <returns>True if failed, otherwise false.</returns>
API_FUNCTION() static bool ModifySplatMap(Terrain* terrain, API_PARAM(Ref) const Int2& patchCoord, int32 index, Color32* samples, API_PARAM(Ref) const Int2& offset, API_PARAM(Ref) const Int2& size);
API_FUNCTION() static bool ModifySplatMap(Terrain* terrain, API_PARAM(Ref) const Int2& patchCoord, int32 index, const Color32* samples, API_PARAM(Ref) const Int2& offset, API_PARAM(Ref) const Int2& size);
/// <summary>
/// Gets the raw pointer to the heightmap data (cached internally by the c++ core in editor).