mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-29 19:02:55 +02:00
Merge pull request #13795 from SamGondelman/paint
Remove unused uniform buffer from polylines
This commit is contained in:
commit
c404f94220
4 changed files with 1 additions and 27 deletions
|
@ -29,18 +29,12 @@ using namespace render::entities;
|
||||||
|
|
||||||
static uint8_t CUSTOM_PIPELINE_NUMBER { 0 };
|
static uint8_t CUSTOM_PIPELINE_NUMBER { 0 };
|
||||||
static const int32_t PAINTSTROKE_TEXTURE_SLOT { 0 };
|
static const int32_t PAINTSTROKE_TEXTURE_SLOT { 0 };
|
||||||
// FIXME: This is interfering with the uniform buffers in DeferredLightingEffect.cpp, so use 12 to avoid collisions
|
|
||||||
static const int32_t PAINTSTROKE_UNIFORM_SLOT { 12 };
|
|
||||||
static gpu::Stream::FormatPointer polylineFormat;
|
static gpu::Stream::FormatPointer polylineFormat;
|
||||||
static gpu::PipelinePointer polylinePipeline;
|
static gpu::PipelinePointer polylinePipeline;
|
||||||
#ifdef POLYLINE_ENTITY_USE_FADE_EFFECT
|
#ifdef POLYLINE_ENTITY_USE_FADE_EFFECT
|
||||||
static gpu::PipelinePointer polylineFadePipeline;
|
static gpu::PipelinePointer polylineFadePipeline;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct PolyLineUniforms {
|
|
||||||
glm::vec3 color;
|
|
||||||
};
|
|
||||||
|
|
||||||
static render::ShapePipelinePointer shapePipelineFactory(const render::ShapePlumber& plumber, const render::ShapeKey& key, gpu::Batch& batch) {
|
static render::ShapePipelinePointer shapePipelineFactory(const render::ShapePlumber& plumber, const render::ShapeKey& key, gpu::Batch& batch) {
|
||||||
if (!polylinePipeline) {
|
if (!polylinePipeline) {
|
||||||
gpu::ShaderPointer program = gpu::Shader::createProgram(shader::entities_renderer::program::paintStroke);
|
gpu::ShaderPointer program = gpu::Shader::createProgram(shader::entities_renderer::program::paintStroke);
|
||||||
|
@ -84,8 +78,6 @@ PolyLineEntityRenderer::PolyLineEntityRenderer(const EntityItemPointer& entity)
|
||||||
polylineFormat->setAttribute(gpu::Stream::COLOR, 0, gpu::Element(gpu::VEC3, gpu::FLOAT, gpu::RGB), offsetof(Vertex, color));
|
polylineFormat->setAttribute(gpu::Stream::COLOR, 0, gpu::Element(gpu::VEC3, gpu::FLOAT, gpu::RGB), offsetof(Vertex, color));
|
||||||
});
|
});
|
||||||
|
|
||||||
PolyLineUniforms uniforms;
|
|
||||||
_uniformBuffer = std::make_shared<gpu::Buffer>(sizeof(PolyLineUniforms), (const gpu::Byte*) &uniforms);
|
|
||||||
_verticesBuffer = std::make_shared<gpu::Buffer>();
|
_verticesBuffer = std::make_shared<gpu::Buffer>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,9 +118,6 @@ void PolyLineEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer&
|
||||||
}
|
}
|
||||||
|
|
||||||
void PolyLineEntityRenderer::doRenderUpdateAsynchronousTyped(const TypedEntityPointer& entity) {
|
void PolyLineEntityRenderer::doRenderUpdateAsynchronousTyped(const TypedEntityPointer& entity) {
|
||||||
PolyLineUniforms uniforms;
|
|
||||||
uniforms.color = toGlm(entity->getXColor());
|
|
||||||
memcpy(&_uniformBuffer.edit<PolyLineUniforms>(), &uniforms, sizeof(PolyLineUniforms));
|
|
||||||
auto pointsChanged = entity->pointsChanged();
|
auto pointsChanged = entity->pointsChanged();
|
||||||
auto strokeWidthsChanged = entity->strokeWidthsChanged();
|
auto strokeWidthsChanged = entity->strokeWidthsChanged();
|
||||||
auto normalsChanged = entity->normalsChanged();
|
auto normalsChanged = entity->normalsChanged();
|
||||||
|
@ -274,7 +263,6 @@ void PolyLineEntityRenderer::doRender(RenderArgs* args) {
|
||||||
|
|
||||||
gpu::Batch& batch = *args->_batch;
|
gpu::Batch& batch = *args->_batch;
|
||||||
batch.setModelTransform(_polylineTransform);
|
batch.setModelTransform(_polylineTransform);
|
||||||
batch.setUniformBuffer(PAINTSTROKE_UNIFORM_SLOT, _uniformBuffer);
|
|
||||||
|
|
||||||
if (_texture && _texture->isLoaded()) {
|
if (_texture && _texture->isLoaded()) {
|
||||||
batch.setResourceTexture(PAINTSTROKE_TEXTURE_SLOT, _texture->getGPUTexture());
|
batch.setResourceTexture(PAINTSTROKE_TEXTURE_SLOT, _texture->getGPUTexture());
|
||||||
|
|
|
@ -65,7 +65,6 @@ protected:
|
||||||
QVector<glm::vec3> _lastStrokeColors;
|
QVector<glm::vec3> _lastStrokeColors;
|
||||||
QVector<float> _lastStrokeWidths;
|
QVector<float> _lastStrokeWidths;
|
||||||
gpu::BufferPointer _verticesBuffer;
|
gpu::BufferPointer _verticesBuffer;
|
||||||
gpu::BufferView _uniformBuffer;
|
|
||||||
|
|
||||||
uint32_t _numVertices { 0 };
|
uint32_t _numVertices { 0 };
|
||||||
bool _empty{ true };
|
bool _empty{ true };
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
|
|
||||||
<@include DeferredBufferWrite.slh@>
|
<@include DeferredBufferWrite.slh@>
|
||||||
|
|
||||||
|
|
||||||
// the albedo texture
|
// the albedo texture
|
||||||
layout(binding=0) uniform sampler2D originalTexture;
|
layout(binding=0) uniform sampler2D originalTexture;
|
||||||
|
|
||||||
|
@ -23,17 +22,7 @@ layout(location=0) in vec3 interpolatedNormal;
|
||||||
layout(location=1) in vec2 varTexcoord;
|
layout(location=1) in vec2 varTexcoord;
|
||||||
layout(location=2) in vec4 varColor;
|
layout(location=2) in vec4 varColor;
|
||||||
|
|
||||||
struct PolyLineUniforms {
|
|
||||||
vec3 color;
|
|
||||||
};
|
|
||||||
|
|
||||||
layout(binding=0) uniform polyLineBuffer {
|
|
||||||
PolyLineUniforms polyline;
|
|
||||||
};
|
|
||||||
|
|
||||||
void main(void) {
|
void main(void) {
|
||||||
|
|
||||||
|
|
||||||
vec4 texel = texture(originalTexture, varTexcoord);
|
vec4 texel = texture(originalTexture, varTexcoord);
|
||||||
int frontCondition = 1 -int(gl_FrontFacing) * 2;
|
int frontCondition = 1 -int(gl_FrontFacing) * 2;
|
||||||
vec3 color = varColor.rgb;
|
vec3 color = varColor.rgb;
|
||||||
|
|
|
@ -26,13 +26,11 @@ layout(location=1) out vec2 varTexcoord;
|
||||||
layout(location=2) out vec4 varColor;
|
layout(location=2) out vec4 varColor;
|
||||||
|
|
||||||
void main(void) {
|
void main(void) {
|
||||||
|
|
||||||
varTexcoord = inTexCoord0.st;
|
varTexcoord = inTexCoord0.st;
|
||||||
|
|
||||||
// pass along the diffuse color
|
// pass along the diffuse color
|
||||||
varColor = color_sRGBAToLinear(inColor);
|
varColor = color_sRGBAToLinear(inColor);
|
||||||
|
|
||||||
|
|
||||||
// standard transform
|
// standard transform
|
||||||
TransformCamera cam = getTransformCamera();
|
TransformCamera cam = getTransformCamera();
|
||||||
TransformObject obj = getTransformObject();
|
TransformObject obj = getTransformObject();
|
||||||
|
|
Loading…
Reference in a new issue