ADD: Add Stone Resource

This commit is contained in:
sebastian 2026-02-08 15:01:14 +01:00
parent 5213987719
commit 8ab6073aa5
18 changed files with 72 additions and 6 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 358 KiB

Binary file not shown.

View File

@ -0,0 +1,36 @@
<?xml version="1.0"?>
<materialx version="1.39" fileprefix="./">
<open_pbr_surface xpos="6.159420" ypos="-1.879310" type="surfaceshader" name="Rocks011_1K_JPG_OpenPbrSurface">
<input nodename="Rocks011_1K_JPG_Color" type="color3" name="base_color" />
<input nodename="NormalMap" type="vector3" name="geometry_normal" />
<input nodename="Rocks011_1K_JPG_Roughness" type="float" name="specular_roughness" />
</open_pbr_surface>
<surfacematerial xpos="8.695652" ypos="0.000000" type="material" name="Rocks011_1K_JPG">
<input nodename="Rocks011_1K_JPG_OpenPbrSurface" type="surfaceshader" name="surfaceshader" />
<input nodename="displacement" type="displacementshader" name="displacementshader" />
</surfacematerial>
<tiledimage xpos="3.623188" ypos="-3.103448" type="color3" name="Rocks011_1K_JPG_Color">
<input colorspace="srgb_texture" type="filename" name="file" value="Rocks011_1K-JPG_Color.jpg" />
<input type="vector2" name="uvtiling" value="1.0, 1.0" />
</tiledimage>
<tiledimage xpos="3.623188" ypos="5.163793" type="float" name="Rocks011_1K_JPG_Displacement">
<input type="filename" name="file" value="Rocks011_1K-JPG_Displacement.jpg" />
<input type="vector2" name="uvtiling" value="1.0, 1.0" />
</tiledimage>
<displacement xpos="6.159420" ypos="1.879310" type="displacementshader" name="displacement">
<input nodename="Rocks011_1K_JPG_Displacement" type="float" name="displacement" />
<input type="float" name="scale" value="1.0" />
</displacement>
<tiledimage xpos="1.086957" ypos="0.879310" type="vector3" name="Rocks011_1K_JPG_NormalGL">
<input type="filename" name="file" value="Rocks011_1K-JPG_NormalGL.jpg" />
<input type="vector2" name="uvtiling" value="1.0, 1.0" />
</tiledimage>
<normalmap xpos="3.623188" ypos="3.586207" type="vector3" name="NormalMap">
<input nodename="Rocks011_1K_JPG_NormalGL" type="vector3" name="in" />
<input type="float" name="scale" value="1.0" />
</normalmap>
<tiledimage xpos="3.623188" ypos="-0.413793" type="float" name="Rocks011_1K_JPG_Roughness">
<input type="filename" name="file" value="Rocks011_1K-JPG_Roughness.jpg" />
<input type="vector2" name="uvtiling" value="1.0, 1.0" />
</tiledimage>
</materialx>

View File

@ -0,0 +1,19 @@
[gd_resource type="StandardMaterial3D" load_steps=6 format=3 uid="acg_jx28twvh"]
[ext_resource type="Texture2D" uid="uid://acg_mhzg860x" id="Color" path="./Rocks011_1K-JPG_Color.jpg"]
[ext_resource type="Texture2D" uid="uid://acg_i7ajteuy" id="AmbientOcclusion" path="./Rocks011_1K-JPG_AmbientOcclusion.jpg"]
[ext_resource type="Texture2D" uid="uid://acg_lk6wadmc" id="Displacement" path="./Rocks011_1K-JPG_Displacement.jpg"]
[ext_resource type="Texture2D" uid="uid://acg_j7o09i6h" id="Roughness" path="./Rocks011_1K-JPG_Roughness.jpg"]
[ext_resource type="Texture2D" uid="uid://acg_rxaf5z96" id="NormalGL" path="./Rocks011_1K-JPG_NormalGL.jpg"]
[resource]
albedo_texture = ExtResource("Color")
ao_enabled = true
ao_texture = ExtResource("AmbientOcclusion")
ao_texture_channel = 4
roughness_texture = ExtResource("Roughness")
roughness_texture_channel = 4
normal_texture = ExtResource("NormalGL")
normal_enabled = true
heightmap_texture = ExtResource("Displacement")
heightmap_scale = 1.0
heightmap_enabled = true

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 644 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 259 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 463 KiB

View File

@ -30,6 +30,7 @@ void GameLayer::onAttach()
//Map Generation
hexModelDefault = std::make_shared<TexturedModel>(HexModelFactory::createTexturedHexModel(loader, 10.0f, RessourceType::NONE));
hexModelWood = std::make_shared<TexturedModel>(HexModelFactory::createTexturedHexModel(loader, 10.0f, RessourceType::WOOD));
hexModelStone = std::make_shared<TexturedModel>(HexModelFactory::createTexturedHexModel(loader, 10.0f, RessourceType::STONE));
map = std::make_unique<Map>();
AssetManager::loadModel("lowPolyTree", "assets/trees/lowPolyTree.obj", "assets/trees/lowPolyTree.png", loader);
@ -72,7 +73,7 @@ void GameLayer::onUpdate()
tile.isHighlighted = highlight;
}
std::vector<HexRenderData> terrainRenderData = map->getTerrainRenderData(hexModelDefault, hexModelWood);
std::vector<HexRenderData> terrainRenderData = map->getTerrainRenderData(hexModelDefault, hexModelWood, hexModelStone);
for (auto& renderData : terrainRenderData) {

View File

@ -34,6 +34,7 @@ private:
std::shared_ptr<TexturedModel> hexModelDefault;
std::shared_ptr<TexturedModel> hexModelWood;
std::shared_ptr<TexturedModel> hexModelStone;
std::vector<std::shared_ptr<Entity>> tileEntities;

View File

@ -54,8 +54,10 @@ TexturedModel HexModelFactory::createTexturedHexModel(Loader &loader, float radi
std::shared_ptr<ModelTexture> modelTexture;
if (ressourceType == RessourceType::NONE) {
modelTexture = std::make_shared<ModelTexture>(loader.loadTextureFromFile("assets/hex/white.png"));
} else {
} else if (ressourceType == RessourceType::WOOD){
modelTexture = std::make_shared<ModelTexture>(loader.loadTextureFromFile("assets/hex/wood/Ground053_1K-JPG_Color.jpg"));
} else if (ressourceType == RessourceType::STONE) {
modelTexture = std::make_shared<ModelTexture>(loader.loadTextureFromFile("assets/hex/rock/Rocks011_1K-JPG_Color.jpg"));
}
return {std::make_shared<RawModel>(rawModel), std::move(modelTexture)};

View File

@ -14,7 +14,8 @@
enum class RessourceType {
NONE,
WOOD
WOOD,
STONE
};
struct HexTile {

View File

@ -4,15 +4,18 @@
#include "Map.h"
std::vector<HexRenderData> Map::getTerrainRenderData(const std::shared_ptr<TexturedModel>& hexModel, const std::shared_ptr<TexturedModel>& woodModel) {
std::vector<HexRenderData> Map::getTerrainRenderData(const std::shared_ptr<TexturedModel>& hexModel,
const std::shared_ptr<TexturedModel>& woodModel, const std::shared_ptr<TexturedModel>& stoneModel) {
std::vector<HexRenderData> renderData;
renderData.reserve(tiles.size());
for (auto& tile : tiles) {
HexRenderData data;
if (tile.resourceType == RessourceType::WOOD) {
data = HexRenderData(woodModel, tile.worldPos, tile.isHighlighted);
} else {
} else if (tile.resourceType == RessourceType::NONE) {
data = HexRenderData(hexModel, tile.worldPos, tile.isHighlighted);
} else if (tile.resourceType == RessourceType::STONE) {
data =HexRenderData(stoneModel, tile.worldPos, tile.isHighlighted);
}
renderData.push_back(data);
}

View File

@ -16,7 +16,8 @@ public:
std::vector<Area> areas;
std::vector<HexTile> tiles;
std::vector<HexRenderData> getTerrainRenderData(const std::shared_ptr<TexturedModel> &hexModel, const std::shared_ptr<TexturedModel> &woodModel);
std::vector<HexRenderData> getTerrainRenderData(const std::shared_ptr<TexturedModel> &hexModel, const std::shared_ptr<TexturedModel> &woodModel, const std::shared_ptr<
TexturedModel> &stoneModel);
};

View File

@ -42,6 +42,8 @@ public:
ForestTileGenerator forestTileGenerator;
const std::vector<std::shared_ptr<Entity>> forestEntities = forestTileGenerator.generateHexTile(random, tile.worldPos, mapEntities);
tile.entitiesOnTile = forestEntities;
} else if (randomValue < 0.75f) {
tile.resourceType = RessourceType::STONE;
}
map.tiles.push_back(tile);
}