Skip to content

Commit 9d843cd

Browse files
committed
resources: fixed material name collisions and broken tree material
1 parent 04021c0 commit 9d843cd

6 files changed

Lines changed: 306 additions & 181 deletions

File tree

data/shaders/common_terrain.hlsl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -942,8 +942,7 @@ float terrain_macro_variation(float3 position_world)
942942
return clamp(a * b * c * 8.0f, 0.4f, 1.6f);
943943
}
944944

945-
// resolve an already selected layer set, split out from terrain_shade so the g buffer can run its
946-
// parallax march against the dominant layer before the surface is sampled
945+
// resolve an already selected layer set
947946
TerrainSurface terrain_evaluate(
948947
MaterialParameters surface,
949948
TerrainLayerPick pick,

source/editor/widgets/TerrainEditor.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1011,7 +1011,6 @@ void TerrainEditor::DrawGroundLayer(Terrain* terrain, const uint32_t index)
10111011
};
10121012

10131013
flag_toggle("Biplanar", TerrainLayerFlags_Biplanar, "project on the two dominant axes, this is what stops cliff faces from smearing");
1014-
flag_toggle("Parallax", TerrainLayerFlags_Pom, "march the height map when this layer dominates up close");
10151014
flag_toggle("Snow", TerrainLayerFlags_Snow, "weight comes from the snow accumulation model instead of the slope and altitude bands");
10161015
flag_toggle("Below Sea", TerrainLayerFlags_BelowSea, "the altitude band is measured against sea level rather than absolute world y");
10171016

source/rendering/Material.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -641,11 +641,6 @@ namespace spartan
641641
// before this property existed loads without the attribute and keeps this value
642642
SetProperty(MaterialProperty::TerrainBlend, 1.0f);
643643
SetProperty(MaterialProperty::TerrainBlendSharpness, 0.5f);
644-
645-
const char* project_dir = ResourceCache::GetProjectDirectory();
646-
char file_path[512];
647-
snprintf(file_path, sizeof(file_path), "%smaterials\\empty.xml", project_dir);
648-
SetResourceFilePath(file_path);
649644
}
650645

651646
void Material::ApplyPaintPreset(MaterialPaintPreset preset, const Color& color, bool save)

source/resource/IResource.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,13 @@ namespace spartan
6666

6767
void SetResourceName(const std::string& name)
6868
{
69-
m_object_name = name;
70-
m_resource_file_path = FileSystem::GetDirectoryFromFilePath(m_resource_file_path) + name;
69+
m_object_name = name;
70+
std::string directory = FileSystem::GetDirectoryFromFilePath(m_resource_file_path);
71+
if (directory.empty())
72+
{
73+
directory = "project/materials/";
74+
}
75+
m_resource_file_path = directory + name;
7176
}
7277

7378
ResourceType GetResourceType() const { return m_resource_type; }

0 commit comments

Comments
 (0)