mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-26 05:51:20 +00:00
- fix normal vectors on models
This commit is contained in:
parent
ff6b67d8a1
commit
d63513ec14
3 changed files with 8 additions and 6 deletions
|
@ -71,11 +71,13 @@ int VkRenderPassManager::GetVertexFormat(int numBindingPoints, int numAttributes
|
||||||
VkVertexFormat fmt;
|
VkVertexFormat fmt;
|
||||||
fmt.NumBindingPoints = numBindingPoints;
|
fmt.NumBindingPoints = numBindingPoints;
|
||||||
fmt.Stride = stride;
|
fmt.Stride = stride;
|
||||||
fmt.UseVertexData = false;
|
fmt.UseVertexData = 0;
|
||||||
for (int j = 0; j < numAttributes; j++)
|
for (int j = 0; j < numAttributes; j++)
|
||||||
{
|
{
|
||||||
if (attrs[j].location == VATTR_COLOR)
|
if (attrs[j].location == VATTR_COLOR)
|
||||||
fmt.UseVertexData = true;
|
fmt.UseVertexData |= 1;
|
||||||
|
else if (attrs[j].location == VATTR_NORMAL)
|
||||||
|
fmt.UseVertexData |= 2;
|
||||||
fmt.Attrs.push_back(attrs[j]);
|
fmt.Attrs.push_back(attrs[j]);
|
||||||
}
|
}
|
||||||
VertexFormats.push_back(fmt);
|
VertexFormats.push_back(fmt);
|
||||||
|
@ -264,7 +266,7 @@ void VkRenderPassSetup::CreatePipeline(const VkRenderPassKey &key)
|
||||||
VK_FORMAT_R32G32_SFLOAT,
|
VK_FORMAT_R32G32_SFLOAT,
|
||||||
VK_FORMAT_R32_SFLOAT,
|
VK_FORMAT_R32_SFLOAT,
|
||||||
VK_FORMAT_R8G8B8A8_UNORM,
|
VK_FORMAT_R8G8B8A8_UNORM,
|
||||||
VK_FORMAT_A2R10G10B10_SNORM_PACK32
|
VK_FORMAT_A2B10G10R10_SNORM_PACK32
|
||||||
};
|
};
|
||||||
|
|
||||||
bool inputLocations[6] = { false, false, false, false, false, false };
|
bool inputLocations[6] = { false, false, false, false, false, false };
|
||||||
|
|
|
@ -60,7 +60,7 @@ public:
|
||||||
int NumBindingPoints;
|
int NumBindingPoints;
|
||||||
size_t Stride;
|
size_t Stride;
|
||||||
std::vector<FVertexBufferAttribute> Attrs;
|
std::vector<FVertexBufferAttribute> Attrs;
|
||||||
bool UseVertexData;
|
int UseVertexData;
|
||||||
};
|
};
|
||||||
|
|
||||||
class VkRenderPassManager
|
class VkRenderPassManager
|
||||||
|
|
|
@ -42,7 +42,7 @@ void main()
|
||||||
vec4 eyeCoordPos = ViewMatrix * worldcoord;
|
vec4 eyeCoordPos = ViewMatrix * worldcoord;
|
||||||
|
|
||||||
#ifdef HAS_UNIFORM_VERTEX_DATA
|
#ifdef HAS_UNIFORM_VERTEX_DATA
|
||||||
if (useVertexData == 0)
|
if ((useVertexData & 1) == 0)
|
||||||
vColor = uVertexColor;
|
vColor = uVertexColor;
|
||||||
else
|
else
|
||||||
vColor = aColor;
|
vColor = aColor;
|
||||||
|
@ -79,7 +79,7 @@ void main()
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAS_UNIFORM_VERTEX_DATA
|
#ifdef HAS_UNIFORM_VERTEX_DATA
|
||||||
if (useVertexData == 0)
|
if ((useVertexData & 2) == 0)
|
||||||
vWorldNormal = NormalModelMatrix * vec4(uVertexNormal.xyz, 1.0);
|
vWorldNormal = NormalModelMatrix * vec4(uVertexNormal.xyz, 1.0);
|
||||||
else
|
else
|
||||||
vWorldNormal = NormalModelMatrix * vec4(normalize(mix(aNormal.xyz, aNormal2.xyz, uInterpolationFactor)), 1.0);
|
vWorldNormal = NormalModelMatrix * vec4(normalize(mix(aNormal.xyz, aNormal2.xyz, uInterpolationFactor)), 1.0);
|
||||||
|
|
Loading…
Reference in a new issue