mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 07:17:43 +02:00
Fix the bad binding for polyline
This commit is contained in:
parent
dcda5d50a0
commit
3d0b557af6
2 changed files with 12 additions and 7 deletions
|
@ -46,7 +46,8 @@ _numVertices(0)
|
||||||
|
|
||||||
gpu::PipelinePointer RenderablePolyLineEntityItem::_pipeline;
|
gpu::PipelinePointer RenderablePolyLineEntityItem::_pipeline;
|
||||||
gpu::Stream::FormatPointer RenderablePolyLineEntityItem::_format;
|
gpu::Stream::FormatPointer RenderablePolyLineEntityItem::_format;
|
||||||
int32_t RenderablePolyLineEntityItem::PAINTSTROKE_GPU_SLOT;
|
const int32_t RenderablePolyLineEntityItem::PAINTSTROKE_TEXTURE_SLOT;
|
||||||
|
const int32_t RenderablePolyLineEntityItem::PAINTSTROKE_UNIFORM_SLOT;
|
||||||
|
|
||||||
void RenderablePolyLineEntityItem::createPipeline() {
|
void RenderablePolyLineEntityItem::createPipeline() {
|
||||||
static const int NORMAL_OFFSET = 12;
|
static const int NORMAL_OFFSET = 12;
|
||||||
|
@ -62,8 +63,8 @@ void RenderablePolyLineEntityItem::createPipeline() {
|
||||||
gpu::ShaderPointer program = gpu::Shader::createProgram(VS, PS);
|
gpu::ShaderPointer program = gpu::Shader::createProgram(VS, PS);
|
||||||
|
|
||||||
gpu::Shader::BindingSet slotBindings;
|
gpu::Shader::BindingSet slotBindings;
|
||||||
PAINTSTROKE_GPU_SLOT = 0;
|
slotBindings.insert(gpu::Shader::Binding(std::string("originalTexture"), PAINTSTROKE_TEXTURE_SLOT));
|
||||||
slotBindings.insert(gpu::Shader::Binding(std::string("paintStrokeTextureBinding"), PAINTSTROKE_GPU_SLOT));
|
slotBindings.insert(gpu::Shader::Binding(std::string("polyLineBuffer"), PAINTSTROKE_UNIFORM_SLOT));
|
||||||
gpu::Shader::makeProgram(*program, slotBindings);
|
gpu::Shader::makeProgram(*program, slotBindings);
|
||||||
|
|
||||||
gpu::StatePointer state = gpu::StatePointer(new gpu::State());
|
gpu::StatePointer state = gpu::StatePointer(new gpu::State());
|
||||||
|
@ -193,14 +194,14 @@ void RenderablePolyLineEntityItem::render(RenderArgs* args) {
|
||||||
Transform transform = Transform();
|
Transform transform = Transform();
|
||||||
transform.setTranslation(getPosition());
|
transform.setTranslation(getPosition());
|
||||||
transform.setRotation(getRotation());
|
transform.setRotation(getRotation());
|
||||||
batch.setUniformBuffer(0, _uniformBuffer);
|
batch.setUniformBuffer(PAINTSTROKE_UNIFORM_SLOT, _uniformBuffer);
|
||||||
batch.setModelTransform(transform);
|
batch.setModelTransform(transform);
|
||||||
|
|
||||||
batch.setPipeline(_pipeline);
|
batch.setPipeline(_pipeline);
|
||||||
if (_texture->isLoaded()) {
|
if (_texture->isLoaded()) {
|
||||||
batch.setResourceTexture(PAINTSTROKE_GPU_SLOT, _texture->getGPUTexture());
|
batch.setResourceTexture(PAINTSTROKE_TEXTURE_SLOT, _texture->getGPUTexture());
|
||||||
} else {
|
} else {
|
||||||
batch.setResourceTexture(PAINTSTROKE_GPU_SLOT, args->_whiteTexture);
|
batch.setResourceTexture(PAINTSTROKE_TEXTURE_SLOT, args->_whiteTexture);
|
||||||
}
|
}
|
||||||
|
|
||||||
batch.setInputFormat(_format);
|
batch.setInputFormat(_format);
|
||||||
|
@ -208,6 +209,8 @@ void RenderablePolyLineEntityItem::render(RenderArgs* args) {
|
||||||
|
|
||||||
if (_isFading) {
|
if (_isFading) {
|
||||||
batch._glColor4f(1.0f, 1.0f, 1.0f, Interpolate::calculateFadeRatio(_fadeStartTime));
|
batch._glColor4f(1.0f, 1.0f, 1.0f, Interpolate::calculateFadeRatio(_fadeStartTime));
|
||||||
|
} else {
|
||||||
|
batch._glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
batch.draw(gpu::TRIANGLE_STRIP, _numVertices, 0);
|
batch.draw(gpu::TRIANGLE_STRIP, _numVertices, 0);
|
||||||
|
|
|
@ -40,7 +40,9 @@ public:
|
||||||
|
|
||||||
static gpu::PipelinePointer _pipeline;
|
static gpu::PipelinePointer _pipeline;
|
||||||
static gpu::Stream::FormatPointer _format;
|
static gpu::Stream::FormatPointer _format;
|
||||||
static int32_t PAINTSTROKE_GPU_SLOT;
|
|
||||||
|
static const int32_t PAINTSTROKE_TEXTURE_SLOT { 0 };
|
||||||
|
static const int32_t PAINTSTROKE_UNIFORM_SLOT { 0 };
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void updateGeometry();
|
void updateGeometry();
|
||||||
|
|
Loading…
Reference in a new issue