Skip to content

Commit 5eeb19f

Browse files
Moved out entity system to use EnTT instead of Wire (#37)
2 parents 269b6f8 + 9d6db14 commit 5eeb19f

File tree

348 files changed

+101229
-11034
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

348 files changed

+101229
-11034
lines changed

.gitattributes

-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
*.vtchr filter=lfs diff=lfs merge=lfs -text
1212
*.cached filter=lfs diff=lfs merge=lfs -text
1313
*.vtsk filter=lfs diff=lfs merge=lfs -text
14-
*.hlsl filter=lfs diff=lfs merge=lfs -text
15-
*.hlslh filter=lfs diff=lfs merge=lfs -text
1614
*.png filter=lfs diff=lfs merge=lfs -text
1715
*.ico filter=lfs diff=lfs merge=lfs -text
1816
*.dmp filter=lfs diff=lfs merge=lfs -text
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,47 @@
1-
version https://git-lfs.github.com/spec/v1
2-
oid sha256:1de5d2a8282c2825fbb510538a20fad1677e2baf5e7b614ef0ad5dd8747a95aa
3-
size 1201
1+
#include "Vertex.hlsli"
2+
#include "Buffers.hlsli"
3+
#include "Particle.hlsli"
4+
5+
struct Output
6+
{
7+
float4 position : SV_Position;
8+
float4 color : COLOR;
9+
float2 texCoords : UV;
10+
uint textureIndex : TEXTUREINDEX;
11+
uint id : ID;
12+
};
13+
14+
[maxvertexcount(4)]
15+
void main(point DefaultBillboardVertex input[1], inout TriangleStream<Output> output)
16+
{
17+
const float2 offsets[4] =
18+
{
19+
{ -100.f, 100.f },
20+
{ 100.f, 100.f },
21+
{ -100.f, -100.f },
22+
{ 100.f, -100.f }
23+
};
24+
25+
const float2 uvs[4] =
26+
{
27+
{ 0.f, 0.f },
28+
{ 1.f, 0.f },
29+
{ 0.f, 1.f },
30+
{ 1.f, 1.f }
31+
};
32+
33+
const DefaultBillboardVertex inputData = input[0];
34+
for (uint i = 0; i < 4; i++)
35+
{
36+
Output result;
37+
result.position = mul(u_cameraData.view, inputData.position);
38+
result.position.xy += offsets[i] * inputData.scale.xy;
39+
result.position = mul(u_cameraData.projection, result.position);
40+
result.color = inputData.color;
41+
result.texCoords = uvs[i];
42+
result.textureIndex = inputData.textureIndex;
43+
result.id = inputData.id;
44+
45+
output.Append(result);
46+
}
47+
}
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,36 @@
1-
version https://git-lfs.github.com/spec/v1
2-
oid sha256:db5e16072fabd691bd727664b50bd16666c48291f40c614247b2edcca8994b77
3-
size 734
1+
#include "SamplerStates.hlsli"
2+
#include "Bindless.hlsli"
3+
4+
struct Input
5+
{
6+
float4 position : SV_Position;
7+
float4 color : COLOR;
8+
float2 texCoords : UV;
9+
uint textureIndex : TEXTUREINDEX;
10+
uint id : ID;
11+
};
12+
13+
struct Output
14+
{
15+
float4 color : SV_Target0;
16+
uint id : SV_Target1;
17+
};
18+
19+
Output main(in Input input)
20+
{
21+
float4 result = 0.f;
22+
23+
if (input.textureIndex == 0)
24+
{
25+
result = input.color;
26+
}
27+
else
28+
{
29+
result = u_texture2DTable[NonUniformResourceIndex(input.textureIndex)].Sample(u_linearSampler, input.texCoords) * input.color;
30+
}
31+
32+
Output output = (Output) 0;
33+
output.color = result;
34+
output.id = input.id;
35+
return output;
36+
}
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1-
version https://git-lfs.github.com/spec/v1
2-
oid sha256:2fb06f3c3918caa917229312543f8a40126c9a421478381fc1c588fb6f463fad
3-
size 331
1+
#include "Vertex.hlsli"
2+
3+
DefaultBillboardVertex main(DefaultBillboardVertex input)
4+
{
5+
DefaultBillboardVertex output;
6+
output.position = input.position;
7+
output.color = input.color;
8+
output.scale = input.scale;
9+
output.textureIndex = input.textureIndex;
10+
output.id = input.id;
11+
12+
return output;
13+
}
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1-
version https://git-lfs.github.com/spec/v1
2-
oid sha256:e3dc2bfff0508ab894c4fbfd9c3f02c54a71b97e91c58934ba329967f6fc3b99
3-
size 153
1+
struct Input
2+
{
3+
float4 position : SV_POSITION;
4+
float4 color : COLOR;
5+
};
6+
7+
float4 main(Input input) : SV_TARGET
8+
{
9+
return input.color;
10+
}
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,23 @@
1-
version https://git-lfs.github.com/spec/v1
2-
oid sha256:d5854f5817831d8c5d0253741d77a1bc6acebdc1276219ad00a9bb9f68cedc01
3-
size 421
1+
#include <Common.hlsli>
2+
#include <Buffers.hlsli>
3+
4+
struct Input
5+
{
6+
float4 position : POSITION;
7+
float4 color : COLOR;
8+
};
9+
10+
struct Output
11+
{
12+
float4 position : SV_POSITION;
13+
float4 color : COLOR;
14+
};
15+
16+
Output main(Input input)
17+
{
18+
Output output;
19+
output.position = mul(u_cameraData.projection, mul(u_cameraData.view, input.position));
20+
output.color = input.color;
21+
22+
return output;
23+
}
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,57 @@
1-
version https://git-lfs.github.com/spec/v1
2-
oid sha256:86d2b5599dbe4b42e52c5821fa9a5460e4d54e71868863f089de9a0049e85e6c
3-
size 1677
1+
#include "Vertex.hlsli"
2+
#include "Buffers.hlsli"
3+
#include "Particle.hlsli"
4+
5+
struct PushConstants
6+
{
7+
uint particleOffset;
8+
};
9+
[[vk::push_constant]] PushConstants u_pushConstants;
10+
11+
[maxvertexcount(4)]
12+
void main(point DefaultParticleVertex input[1], inout TriangleStream<ParticleData> output)
13+
{
14+
15+
const float2 offsets[4] =
16+
{
17+
{ -100.f, 100.f },
18+
{ 100.f, 100.f },
19+
{ -100.f, -100.f },
20+
{ 100.f, -100.f }
21+
};
22+
23+
const float2 uvs[4] =
24+
{
25+
{ 0.f, 0.f },
26+
{ 1.f, 0.f },
27+
{ 0.f, 1.f },
28+
{ 1.f, 1.f }
29+
};
30+
31+
const ParticleRenderingInfo particleInfo = u_particleInfo[u_pushConstants.particleOffset + input[0].instanceId];
32+
float rand = particleInfo.randomValue;
33+
float scaleRand = float(1.6) - float(rand);
34+
35+
float2 newScale = particleInfo.scale.xy*scaleRand;
36+
37+
for (uint i = 0; i < 4; i++)
38+
{
39+
ParticleData result;
40+
result.position = mul(u_cameraData.view, float4(particleInfo.position, 1.f));
41+
result.position.xy += offsets[i] * newScale;
42+
result.position = mul(u_cameraData.projection, result.position);
43+
44+
result.worldPosition = particleInfo.position;
45+
result.color = particleInfo.color;
46+
result.texCoords = uvs[i];
47+
48+
result.albedoIndex = particleInfo.albedoIndex;
49+
result.materialIndex = particleInfo.materialIndex;
50+
result.normalIndex = particleInfo.normalIndex;
51+
52+
result.randomValue = particleInfo.randomValue;
53+
result.timeSinceSpawn = particleInfo.timeSinceSpawn;
54+
55+
output.Append(result);
56+
}
57+
}
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,41 @@
1-
version https://git-lfs.github.com/spec/v1
2-
oid sha256:32303ab3b032e31483ef0d9381fd777a48ea7f37654dd724275e258927a75d4b
3-
size 1220
1+
#include "SamplerStates.hlsli"
2+
#include "Particle.hlsli"
3+
4+
#include "PBR.hlsli"
5+
6+
float4 main(in ParticleData input) : SV_Target
7+
{
8+
//float4 albedo = input.SampleAlbedo(u_anisotropicSampler, input.texCoords) * input.color;
9+
//albedo.a = step(0.5f, albedo.a);
10+
11+
//if (albedo.a < 0.05f)
12+
//{
13+
// discard;
14+
//}
15+
16+
//const float3 normal = float3(0.f, 1.f, 0.f);
17+
//const float4 rotatedNormal = mul(u_cameraData.inverseView, float4(normal, 0.f));
18+
19+
//const float4 materialData = input.SampleMaterial(u_linearSampler, input.texCoords);
20+
21+
//PBRData pbrData;
22+
//pbrData.albedo = albedo;
23+
//pbrData.normal = rotatedNormal.xyz;
24+
//pbrData.metallic = materialData.r;
25+
//pbrData.roughness = materialData.g;
26+
//pbrData.emissive = 0.f;
27+
//pbrData.worldPosition = input.worldPosition;
28+
//pbrData.tileId = input.position.xy / 16;
29+
30+
//const float3 pbrLighting = CalculatePBR(pbrData);
31+
32+
//return float4(pbrLighting, albedo.a);
33+
34+
const float4 texColor = input.SampleAlbedo(u_anisotropicSampler, input.texCoords);
35+
if (texColor.a < 0.05f)
36+
{
37+
discard;
38+
}
39+
40+
return texColor * input.color;
41+
}
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1-
version https://git-lfs.github.com/spec/v1
2-
oid sha256:c839fe1b15634313dfe089f73ade6368abf833229e432f04890ecc70237a4df3
3-
size 237
1+
#include "Vertex.hlsli"
2+
3+
struct Input
4+
{
5+
uint instanceId : SV_InstanceID;
6+
};
7+
8+
DefaultParticleVertex main(Input input)
9+
{
10+
DefaultParticleVertex output;
11+
output.instanceId = input.instanceId;
12+
13+
return output;
14+
}
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,32 @@
1-
version https://git-lfs.github.com/spec/v1
2-
oid sha256:6ce1cc87788f8d34e7e9aa2225c32121303af4e2963eb4d6e62c83642fa21d4a
3-
size 725
1+
#include "Vertex.hlsli"
2+
#include "SamplerStates.hlsli"
3+
#include "Bindless.hlsli"
4+
#include "Material.hlsli"
5+
6+
struct Input
7+
{
8+
float4 position : SV_Position;
9+
STAGE_VARIABLE(float4, color, COLOR, 0);
10+
STAGE_VARIABLE(float2, texCoords, TEXCOORDS, 1);
11+
};
12+
13+
struct PushConstants
14+
{
15+
float4x4 viewProjectionTransform;
16+
float4 color;
17+
float2 vertexOffset;
18+
uint textureIndex;
19+
};
20+
21+
[[vk::push_constant]] PushConstants u_pushConstants;
22+
23+
float4 main(Input input) : SV_Target
24+
{
25+
const float4 texColor = SampleTexture(u_pushConstants.textureIndex, u_linearSamplerClamp, input.texCoords) * input.color;
26+
if (texColor.a < 0.05f)
27+
{
28+
discard;
29+
}
30+
31+
return texColor;
32+
}
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,30 @@
1-
version https://git-lfs.github.com/spec/v1
2-
oid sha256:c06b193f2a14499665d4901a18b7df8422aff71395d3b42084edf017b61b9afe
3-
size 719
1+
#include "Vertex.hlsli"
2+
3+
struct PushConstants
4+
{
5+
float4x4 viewProjectionTransform;
6+
float4 color;
7+
float2 vertexOffset;
8+
uint textureIndex;
9+
};
10+
[[vk::push_constant]] PushConstants u_pushConstants;
11+
12+
struct Output
13+
{
14+
float4 position : SV_Position;
15+
STAGE_VARIABLE(float4, color, COLOR, 0);
16+
STAGE_VARIABLE(float2, texCoords, TEXCOORDS, 1);
17+
};
18+
19+
Output main(DefaultQuadVertex input)
20+
{
21+
float4 tempPos = input.position;
22+
tempPos.xy += u_pushConstants.vertexOffset;
23+
24+
Output output;
25+
output.position = mul(u_pushConstants.viewProjectionTransform, tempPos);
26+
output.texCoords = input.texCoords;
27+
output.color = u_pushConstants.color;
28+
29+
return output;
30+
}

0 commit comments

Comments
 (0)