forked from townforge/townforge
game: add neutral terrain material - helps see flag markers
This commit is contained in:
parent
79600d23e9
commit
3d779348c5
5
GameData/Materials/TownforgeTerrainNeutral.xml
Normal file
5
GameData/Materials/TownforgeTerrainNeutral.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<material>
|
||||
<technique name="Techniques/NoTexture.xml" />
|
||||
<parameter name="MatDiffColor" value="0.2 0.2 0.2 1" />
|
||||
<parameter name="MatSpecColor" value="0.5 0.5 0.5 16" />
|
||||
</material>
|
@ -166,6 +166,7 @@ TBLayout: axis: y, distribution-position: "left top", distribution: "available"
|
||||
item: id: "stone-type", text: "Stone type"
|
||||
item: id: "stone-quantity", text: "Stone quantity"
|
||||
item: id: "gemstone", text: "Gemstone"
|
||||
item: id: "neutral", text: "Neutral"
|
||||
|
||||
TBSection: value: 0, text: "Flag"
|
||||
TBLayout: axis: y, spacing: 0, size: available
|
||||
|
@ -500,7 +500,7 @@ void CityMeshSection::setGroundMode(const GroundMode mode[3])
|
||||
uint32_t splat_map_width_mask = 0, splat_map_height_mask = 0;
|
||||
const uint16_t *height_data = NULL;
|
||||
uint32_t height_data_available = 0;
|
||||
if (mode[0] == GroundNatural)
|
||||
if (mode[0] == GroundNatural || mode[0] == GroundNeutral)
|
||||
{
|
||||
SharedPtr<Texture2D> splat_texture(cache->GetResource<Texture2D>("Textures/TerrainWeights_tiled.dds"));
|
||||
splat_map = splat_texture->GetImage();
|
||||
@ -515,11 +515,11 @@ void CityMeshSection::setGroundMode(const GroundMode mode[3])
|
||||
|
||||
PERF_TIMER_START(get_data);
|
||||
const cc::cc_potential_state_t *state = cc::get_cc_potential_state(city->id, city->seed);
|
||||
const int n_passes = mode[0] == GroundNatural ? 1 : 3;
|
||||
const int n_passes = mode[0] == GroundNatural || mode[0] == GroundNeutral ? 1 : 3;
|
||||
for (uint32_t y = 0; y < SECTION_SIZE; ++y)
|
||||
{
|
||||
const uint32_t y_offset = vy0 + y;
|
||||
const unsigned char *splat_map_row = mode[0] == GroundNatural ? (splat_map_data + NUM_SPLAT_MAP_COMPONENTS * (y_offset & splat_map_height_mask) * splat_map->GetWidth()) : NULL;
|
||||
const unsigned char *splat_map_row = mode[0] == GroundNatural || mode[0] == GroundNeutral ? (splat_map_data + NUM_SPLAT_MAP_COMPONENTS * (y_offset & splat_map_height_mask) * splat_map->GetWidth()) : NULL;
|
||||
if (mode[0] == GroundNatural)
|
||||
height_data_available = cc::get_cc_height_row(state, vx0, y_offset, &height_data);
|
||||
for (uint32_t x = 0; x < SECTION_SIZE; ++x)
|
||||
@ -542,6 +542,7 @@ void CityMeshSection::setGroundMode(const GroundMode mode[3])
|
||||
case GroundWoodQuantity: c = cc::get_cc_wood_quantity_potential(state, x_offset, y_offset); break;
|
||||
case GroundStoneType: c = cc::get_cc_stone_type_potential(state, x_offset, y_offset); break;
|
||||
case GroundStoneQuantity: c = cc::get_cc_stone_quantity_potential(state, x_offset, y_offset); break;
|
||||
case GroundNeutral: break;
|
||||
case GroundNatural:
|
||||
if (height_data_available == 0)
|
||||
height_data_available = cc::get_cc_height_row(state, x_offset, y_offset, &height_data);
|
||||
@ -598,6 +599,8 @@ void CityMeshSection::setGroundMode(const GroundMode mode[3])
|
||||
|
||||
if (mode[0] == GroundNatural)
|
||||
groundMaterial = cache->GetResource<Material>("Materials/TownforgeTerrain.xml")->Clone();
|
||||
else if (mode[0] == GroundNeutral)
|
||||
groundMaterial = cache->GetResource<Material>("Materials/TownforgeTerrainNeutral.xml")->Clone();
|
||||
else
|
||||
groundMaterial = cache->GetResource<Material>("Materials/Potential.xml")->Clone();
|
||||
groundMaterial->SetTexture(TU_DIFFUSE, texture.Get());
|
||||
|
@ -41,6 +41,7 @@ enum GroundMode
|
||||
GroundWoodQuantity,
|
||||
GroundStoneType,
|
||||
GroundStoneQuantity,
|
||||
GroundNeutral,
|
||||
NumGroundModes
|
||||
};
|
||||
|
||||
|
@ -7415,6 +7415,8 @@ void CryptoCityUrho3D::HandleGroundType(StringHash eventType, VariantMap& eventD
|
||||
mode = GroundStoneType;
|
||||
else if (type == TBIDC("stone-quantity"))
|
||||
mode = GroundStoneQuantity;
|
||||
if (type == TBIDC("neutral"))
|
||||
mode = GroundNeutral;
|
||||
else
|
||||
printf("Invalid ground type\n");
|
||||
const bool add = eventData[GroundType::P_ADD].GetBool();
|
||||
|
Loading…
Reference in New Issue
Block a user