mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 08:04:01 +02:00
PR feedback: structure alignement and size
This commit is contained in:
parent
9a28e04e37
commit
50f4932d9c
8 changed files with 15 additions and 15 deletions
|
@ -1609,7 +1609,7 @@ PolyVoxEntityRenderer::PolyVoxEntityRenderer(const EntityItemPointer& entity) :
|
|||
_vertexFormat->setAttribute(gpu::Stream::POSITION, 0, gpu::Element(gpu::VEC3, gpu::FLOAT, gpu::XYZ), 0);
|
||||
_vertexFormat->setAttribute(gpu::Stream::NORMAL, 0, gpu::Element(gpu::VEC3, gpu::FLOAT, gpu::XYZ), 12);
|
||||
});
|
||||
_params = std::make_shared<gpu::Buffer>(sizeof(glm::vec3), nullptr);
|
||||
_params = std::make_shared<gpu::Buffer>(sizeof(glm::vec4), nullptr);
|
||||
}
|
||||
|
||||
ShapeKey PolyVoxEntityRenderer::getShapeKey() {
|
||||
|
@ -1673,7 +1673,7 @@ void PolyVoxEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& s
|
|||
void PolyVoxEntityRenderer::doRenderUpdateAsynchronousTyped(const TypedEntityPointer& entity) {
|
||||
_lastVoxelToWorldMatrix = entity->voxelToWorldMatrix();
|
||||
_lastVoxelVolumeSize = entity->getVoxelVolumeSize();
|
||||
_params->setSubData(0, _lastVoxelVolumeSize);
|
||||
_params->setSubData(0, vec4(_lastVoxelVolumeSize, 0.0));
|
||||
graphics::MeshPointer newMesh;
|
||||
entity->withReadLock([&] {
|
||||
newMesh = entity->_mesh;
|
||||
|
|
|
@ -25,7 +25,7 @@ layout(binding=ENTITIES_TEXTURE_POLYVOX_YMAP) uniform sampler2D yMap;
|
|||
layout(binding=ENTITIES_TEXTURE_POLYVOX_ZMAP) uniform sampler2D zMap;
|
||||
|
||||
struct PolyvoxParams {
|
||||
vec3 voxelVolumeSize;
|
||||
vec4 voxelVolumeSize;
|
||||
};
|
||||
|
||||
layout(binding=0) uniform polyvoxParamsBuffer {
|
||||
|
|
|
@ -28,7 +28,7 @@ layout(binding=ENTITIES_TEXTURE_POLYVOX_YMAP) uniform sampler2D yMap;
|
|||
layout(binding=ENTITIES_TEXTURE_POLYVOX_ZMAP) uniform sampler2D zMap;
|
||||
|
||||
struct PolyvoxParams {
|
||||
vec3 voxelVolumeSize;
|
||||
vec4 voxelVolumeSize;
|
||||
};
|
||||
|
||||
layout(binding=0) uniform polyvoxParamsBuffer {
|
||||
|
|
|
@ -90,7 +90,7 @@ void Antialiasing::run(const render::RenderContextPointer& renderContext, const
|
|||
batch.setViewportTransform(args->_viewport);
|
||||
|
||||
if (!_paramsBuffer) {
|
||||
_paramsBuffer = std::make_shared<gpu::Buffer>(sizeof(glm::vec2), nullptr);
|
||||
_paramsBuffer = std::make_shared<gpu::Buffer>(sizeof(glm::vec4), nullptr);
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -109,7 +109,7 @@ void Antialiasing::run(const render::RenderContextPointer& renderContext, const
|
|||
_antialiasingBuffer->setRenderBuffer(0, _antialiasingTexture);
|
||||
glm::vec2 fbExtent { args->_viewport.z, args->_viewport.w };
|
||||
glm::vec2 inverseFbExtent = 1.0f / fbExtent;
|
||||
_paramsBuffer->setSubData(0, inverseFbExtent);
|
||||
_paramsBuffer->setSubData(0, glm::vec4(inverseFbExtent, 0.0, 0.0));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -280,7 +280,7 @@ void Antialiasing::run(const render::RenderContextPointer& renderContext, const
|
|||
batch.setResourceFramebufferSwapChainTexture(0, _antialiasingBuffers, 1);
|
||||
// Disable sharpen if FXAA
|
||||
if (!_blendParamsBuffer) {
|
||||
_blendParamsBuffer = std::make_shared<gpu::Buffer>(sizeof(float), nullptr);
|
||||
_blendParamsBuffer = std::make_shared<gpu::Buffer>(sizeof(glm::vec4), nullptr);
|
||||
}
|
||||
_blendParamsBuffer->setSubData(0, _sharpen * _params.get().regionInfo.z);
|
||||
batch.setUniformBuffer(0, _blendParamsBuffer);
|
||||
|
|
|
@ -20,7 +20,7 @@ layout(location=0) out vec4 outFragColor;
|
|||
layout(binding=0) uniform sampler2D colorTexture;
|
||||
|
||||
struct FxaaBlendParams {
|
||||
float sharpenIntensity;
|
||||
vec4 sharpenIntensity;
|
||||
};
|
||||
|
||||
layout(binding=0) uniform fxaaBlendParamsBuffer {
|
||||
|
@ -46,5 +46,5 @@ void main(void) {
|
|||
|
||||
vec4 minColor = max(vec4(0), pixels[4]-vec4(0.5));
|
||||
vec4 maxColor = pixels[4]+vec4(0.5);
|
||||
outFragColor = clamp(pixels[4] + sharpenedPixel * params.sharpenIntensity, minColor, maxColor);
|
||||
outFragColor = clamp(pixels[4] + sharpenedPixel * params.sharpenIntensity.x, minColor, maxColor);
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ layout(binding=0) uniform sampler2D Font;
|
|||
|
||||
struct TextParams {
|
||||
vec4 color;
|
||||
float outline;
|
||||
vec4 outline;
|
||||
};
|
||||
|
||||
layout(binding=0) uniform textParamsBuffer {
|
||||
|
@ -39,7 +39,7 @@ const float taaBias = pow(2.0, TAA_TEXTURE_LOD_BIAS);
|
|||
float evalSDF(vec2 texCoord) {
|
||||
// retrieve signed distance
|
||||
float sdf = textureLod(Font, texCoord, TAA_TEXTURE_LOD_BIAS).g;
|
||||
if (params.outline > 0.0) {
|
||||
if (params.outline.x > 0.0) {
|
||||
if (sdf > interiorCutoff) {
|
||||
sdf = 1.0 - sdf;
|
||||
} else {
|
||||
|
|
|
@ -17,7 +17,7 @@ layout(binding=0) uniform sampler2D Font;
|
|||
|
||||
struct TextParams {
|
||||
vec4 color;
|
||||
float outline;
|
||||
vec4 outline;
|
||||
};
|
||||
|
||||
layout(binding=0) uniform textParamsBuffer {
|
||||
|
@ -38,7 +38,7 @@ const float outlineExpansion = 0.2;
|
|||
void main() {
|
||||
// retrieve signed distance
|
||||
float sdf = texture(Font, _texCoord0).g;
|
||||
if (params.outline > 0.0) {
|
||||
if (params.outline.x > 0.0) {
|
||||
if (sdf > interiorCutoff) {
|
||||
sdf = 1.0 - sdf;
|
||||
} else {
|
||||
|
|
|
@ -356,7 +356,7 @@ void Font::drawString(gpu::Batch& batch, Font::DrawInfo& drawInfo, const QString
|
|||
|
||||
struct GpuDrawParams {
|
||||
glm::vec4 color;
|
||||
float outline;
|
||||
glm::vec4 outline;
|
||||
};
|
||||
|
||||
if (!drawInfo.paramsBuffer || drawInfo.params.color != color || drawInfo.params.effect != effectType) {
|
||||
|
@ -364,7 +364,7 @@ void Font::drawString(gpu::Batch& batch, Font::DrawInfo& drawInfo, const QString
|
|||
drawInfo.params.effect = effectType;
|
||||
GpuDrawParams gpuDrawParams;
|
||||
gpuDrawParams.color = ColorUtils::sRGBToLinearVec4(drawInfo.params.color);
|
||||
gpuDrawParams.outline = (drawInfo.params.effect == OUTLINE_EFFECT) ? 1 : 0;
|
||||
gpuDrawParams.outline.x = (drawInfo.params.effect == OUTLINE_EFFECT) ? 1 : 0;
|
||||
drawInfo.paramsBuffer = std::make_shared<gpu::Buffer>(sizeof(GpuDrawParams), nullptr);
|
||||
drawInfo.paramsBuffer->setSubData(0, sizeof(GpuDrawParams), (const gpu::Byte*)&gpuDrawParams);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue