Skip to content

Commit

Permalink
adding Gaea landscape
Browse files Browse the repository at this point in the history
  • Loading branch information
beaumanvienna committed Jan 20, 2025
1 parent 0767316 commit 3f7cde2
Show file tree
Hide file tree
Showing 9 changed files with 215 additions and 28 deletions.
2 changes: 1 addition & 1 deletion application/lucre/particleSystem/candles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ namespace GfxRenderEngine
{(vertex1.x + volumeSize.x) + (volumeSize.x * EngineCore::RandomPlusMinusOne()),
(vertex1.y + volumeSize.y) + (volumeSize.y * EngineCore::RandomPlusMinusOne()),
(vertex1.z + volumeSize.z) + (volumeSize.z * EngineCore::RandomPlusMinusOne())});
transform.SetScale(1.0f);
transform.SetScale(0.2f);
++index;
}
}
Expand Down
179 changes: 172 additions & 7 deletions application/lucre/sceneDescriptions/reserved0.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,38 @@
{
"scale":
[
1.33093, 1.5, 1.54767
1, 1, 1
],
"rotation":
[
0, -0, 0
],
"translation":
[
-10.9892, -4.4496, 1.19157
-6.20567, -0.805738, -3.96664
]
}
}
]
},
{
"filename": "application/lucre/terrainDescriptions/terrainGaea.json",
"instances":
[
{
"transform":
{
"scale":
[
4.85555, 4.85555, 4.85555
],
"rotation":
[
0, -0, 0
],
"translation":
[
-43.3376, -28.5, 302.92
]
}
}
Expand All @@ -56,6 +79,148 @@
],
"fastgltf files":
[
{
"filename": "application/lucre/models/terrain/tree silhouette.glb",
"instances":
[
{
"transform":
{
"scale":
[
0.68, 0.68, 0.68
],
"rotation":
[
-3.50037e-07, 1.05094, 1.47608e-07
],
"translation":
[
11.8968, 2.17163, 152.645
]
}
},
{
"transform":
{
"scale":
[
0.68, 0.68, 0.68
],
"rotation":
[
-3.50037e-07, 1.05094, 1.47608e-07
],
"translation":
[
32.7862, 1.78162, 164.602
]
}
},
{
"transform":
{
"scale":
[
0.68, 0.68, 0.68
],
"rotation":
[
-3.50037e-07, 1.05094, 1.47608e-07
],
"translation":
[
54.8968, 0.585905, 177.257
]
}
},
{
"transform":
{
"scale":
[
0.68, 0.68, 0.68
],
"rotation":
[
-3.50037e-07, 1.05094, 1.47608e-07
],
"translation":
[
21.2016, 0.613483, 204.265
]
}
},
{
"transform":
{
"scale":
[
0.68, 0.68, 0.68
],
"rotation":
[
-3.50036e-07, 1.05094, 1.47608e-07
],
"translation":
[
37.0184, 0.201801, 206.555
]
}
},
{
"transform":
{
"scale":
[
0.68, 0.68, 0.68
],
"rotation":
[
-3.50036e-07, 1.05094, 1.47608e-07
],
"translation":
[
0.219823, 0.63647, 196.683
]
}
},
{
"transform":
{
"scale":
[
0.6555, 0.6555, 0.6555
],
"rotation":
[
-3.50043e-07, 1.05094, 1.47608e-07
],
"translation":
[
5.43998, 0.660851, 227.301
]
}
},
{
"transform":
{
"scale":
[
0.65, 0.65, 0.65
],
"rotation":
[
-3.5004e-07, 1.05094, 1.47609e-07
],
"translation":
[
25.8626, 0.84644, 238.712
]
}
}
]
},
{
"filename": "application/lucre/models/external_3D_files/measured/2m.gltf",
"instances":
Expand All @@ -73,7 +238,7 @@
],
"translation":
[
0.323799, -2.10549, 0
1.35825, 0.760451, -6.16079
]
}
}
Expand Down Expand Up @@ -165,7 +330,7 @@
],
"translation":
[
-2.85519, -2, -5.15315
-2.35076, 0.782395, -5.66803
]
}
},
Expand All @@ -182,7 +347,7 @@
],
"translation":
[
-3.38277, -2, -4.05522
-1.42034, 0.782, -3.0904
]
}
},
Expand All @@ -199,7 +364,7 @@
],
"translation":
[
-1.48155, -2, -4.65439
-2.597, 0.782, -5.12495
]
}
},
Expand All @@ -216,7 +381,7 @@
],
"translation":
[
-2.46564, -2, -6.26672
-1.98596, 0.782, -3.50736
]
}
}
Expand Down
10 changes: 10 additions & 0 deletions application/lucre/scenes/reserved0Scene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ namespace LucreApp

void Reserved0Scene::Start()
{
LOG_APP_CRITICAL("void Reserved0Scene::Start()");
m_IsRunning = true;

m_Renderer = Engine::m_Engine->GetRenderer();
Expand Down Expand Up @@ -122,6 +123,15 @@ namespace LucreApp
PbrMultiMaterialTag pbrMultiMaterialTag{};
m_Registry.emplace<PbrMultiMaterialTag>(terrain, pbrMultiMaterialTag);
}

auto gaea =
m_Dictionary.Retrieve("TLMM::application/lucre/models/terrain/terrainGaea.glb::0::Scene::TerrainGaea");
if (gaea != entt::null)
{
m_Registry.remove<PbrMaterialTag>(gaea);
PbrMultiMaterialTag pbrMultiMaterialTag{};
m_Registry.emplace<PbrMultiMaterialTag>(gaea, pbrMultiMaterialTag);
}
}
}

Expand Down
6 changes: 6 additions & 0 deletions application/lucre/terrainDescriptions/terrainGaea.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"file format identifier": 1.2,
"description": "terrain Gaea",
"author": "Copyright (c) 2024 Engine Development Team",
"mesh": "application/lucre/models/terrain/terrainGaea.glb"
}
16 changes: 9 additions & 7 deletions engine/platform/Vulkan/shaders/pbrMultiMaterial.frag
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,15 @@ void main()
vec4 material[GLSL_NUM_MULTI_MATERIAL];
vec4 emissive[GLSL_NUM_MULTI_MATERIAL];

float uvScale[GLSL_NUM_MULTI_MATERIAL] = {4.0, 1.0, 1.0, 4.0};

for (int i = 0; i < GLSL_NUM_MULTI_MATERIAL; ++i)
{
vec2 uv = uvScale[i] * fragUV;
// color
if (bool(push.m_PbrMaterial[i].m_Features & GLSL_HAS_DIFFUSE_MAP))
{
col[i] = texture(diffuseMap[i], fragUV) * push.m_PbrMaterial[i].m_DiffuseColor;
col[i] = texture(diffuseMap[i], uv) * push.m_PbrMaterial[i].m_DiffuseColor;
}
else
{
Expand All @@ -132,7 +134,7 @@ void main()
float normalMapIntensity = push.m_PbrMaterial[i].m_NormalMapIntensity;
if (bool(push.m_PbrMaterial[i].m_Features & GLSL_HAS_NORMAL_MAP))
{
vec3 normalTangentSpace = texture(normalMap[i],fragUV).xyz * 2 - vec3(1.0, 1.0, 1.0);
vec3 normalTangentSpace = texture(normalMap[i],uv).xyz * 2 - vec3(1.0, 1.0, 1.0);
normalTangentSpace = mix(vec3(0.0, 0.0, 1.0), normalTangentSpace, normalMapIntensity);
normal[i] = vec4(normalize(TBN * normalTangentSpace), 1.0);
}
Expand All @@ -147,22 +149,22 @@ void main()

if (bool(push.m_PbrMaterial[i].m_Features & GLSL_HAS_ROUGHNESS_METALLIC_MAP))
{
roughness = texture(roughnessMetallicMap[i], fragUV).g;
metallic = texture(roughnessMetallicMap[i], fragUV).b;
roughness = texture(roughnessMetallicMap[i], uv).g;
metallic = texture(roughnessMetallicMap[i], uv).b;
}
else
{
if (bool(push.m_PbrMaterial[i].m_Features & GLSL_HAS_ROUGHNESS_MAP))
{
roughness = texture(roughnessMap[i], fragUV).r; // gray scale
roughness = texture(roughnessMap[i], uv).r; // gray scale
}
else
{
roughness = push.m_PbrMaterial[i].m_Roughness;
}
if (bool(push.m_PbrMaterial[i].m_Features & GLSL_HAS_METALLIC_MAP))
{
metallic = texture(metallicMap[i], fragUV).r; // gray scale
metallic = texture(metallicMap[i], uv).r; // gray scale
}
else
{
Expand All @@ -175,7 +177,7 @@ void main()
vec4 emissiveColor = vec4(push.m_PbrMaterial[i].m_EmissiveColor.r, push.m_PbrMaterial[i].m_EmissiveColor.g, push.m_PbrMaterial[i].m_EmissiveColor.b, 1.0);
if (bool(push.m_PbrMaterial[i].m_Features & GLSL_HAS_EMISSIVE_MAP))
{
vec4 fragEmissiveColor = texture(emissiveMap[i], fragUV);
vec4 fragEmissiveColor = texture(emissiveMap[i], uv);
emissive[i] = fragEmissiveColor * emissiveColor * push.m_PbrMaterial[i].m_EmissiveStrength;
}
else
Expand Down
Loading

0 comments on commit 3f7cde2

Please sign in to comment.