mirror of
https://github.com/overte-org/overte.git
synced 2025-08-05 22:40:12 +02:00
Web Entities now render correctly as well
This commit is contained in:
parent
be6e401e9a
commit
ea310bcc43
5 changed files with 18 additions and 18 deletions
|
@ -101,7 +101,7 @@ void Web3DOverlay::render(RenderArgs* args) {
|
||||||
|
|
||||||
batch.setModelTransform(transform);
|
batch.setModelTransform(transform);
|
||||||
auto geometryCache = DependencyManager::get<GeometryCache>();
|
auto geometryCache = DependencyManager::get<GeometryCache>();
|
||||||
geometryCache->bindSimpleSRGBTexturedUnlitNoDstAlphaProgram(batch);
|
geometryCache->bindSimpleSRGBTexturedUnlitNoTexAlphaProgram(batch);
|
||||||
geometryCache->renderQuad(batch, halfSize * -1.0f, halfSize, vec2(0), vec2(1), color);
|
geometryCache->renderQuad(batch, halfSize * -1.0f, halfSize, vec2(0), vec2(1), color);
|
||||||
batch.setResourceTexture(0, args->_whiteTexture); // restore default white color after me
|
batch.setResourceTexture(0, args->_whiteTexture); // restore default white color after me
|
||||||
}
|
}
|
||||||
|
|
|
@ -208,9 +208,9 @@ void RenderableWebEntityItem::render(RenderArgs* args) {
|
||||||
batch._glActiveBindTexture(GL_TEXTURE0, GL_TEXTURE_2D, _texture);
|
batch._glActiveBindTexture(GL_TEXTURE0, GL_TEXTURE_2D, _texture);
|
||||||
textured = emissive = true;
|
textured = emissive = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
DependencyManager::get<GeometryCache>()->bindSimpleProgram(batch, textured, culled, emissive);
|
DependencyManager::get<GeometryCache>()->bindSimpleSRGBTexturedUnlitNoTexAlphaProgram(batch);
|
||||||
DependencyManager::get<GeometryCache>()->renderQuad(batch, topLeft, bottomRight, texMin, texMax, glm::vec4(1.0f, 1.0f, 1.0f, 0.0f));
|
DependencyManager::get<GeometryCache>()->renderQuad(batch, topLeft, bottomRight, texMin, texMax, glm::vec4(1.0f, 1.0f, 1.0f, 1.0f));
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderableWebEntityItem::setSourceUrl(const QString& value) {
|
void RenderableWebEntityItem::setSourceUrl(const QString& value) {
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
#include "simple_vert.h"
|
#include "simple_vert.h"
|
||||||
#include "simple_textured_frag.h"
|
#include "simple_textured_frag.h"
|
||||||
#include "simple_textured_unlit_frag.h"
|
#include "simple_textured_unlit_frag.h"
|
||||||
#include "simple_srgb_textured_unlit_no_dst_alpha_frag.h"
|
#include "simple_srgb_textured_unlit_no_tex_alpha_frag.h"
|
||||||
#include "glowLine_vert.h"
|
#include "glowLine_vert.h"
|
||||||
#include "glowLine_geom.h"
|
#include "glowLine_geom.h"
|
||||||
#include "glowLine_frag.h"
|
#include "glowLine_frag.h"
|
||||||
|
@ -1749,25 +1749,25 @@ inline bool operator==(const SimpleProgramKey& a, const SimpleProgramKey& b) {
|
||||||
return a.getRaw() == b.getRaw();
|
return a.getRaw() == b.getRaw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeometryCache::bindSimpleSRGBTexturedUnlitNoDstAlphaProgram(gpu::Batch& batch) {
|
void GeometryCache::bindSimpleSRGBTexturedUnlitNoTexAlphaProgram(gpu::Batch& batch) {
|
||||||
batch.setPipeline(getSimpleSRGBTexturedUnlitNoDstAlphaPipeline());
|
batch.setPipeline(getSimpleSRGBTexturedUnlitNoTexAlphaPipeline());
|
||||||
// Set a default normal map
|
// Set a default normal map
|
||||||
batch.setResourceTexture(render::ShapePipeline::Slot::MAP::NORMAL_FITTING,
|
batch.setResourceTexture(render::ShapePipeline::Slot::MAP::NORMAL_FITTING,
|
||||||
DependencyManager::get<TextureCache>()->getNormalFittingTexture());
|
DependencyManager::get<TextureCache>()->getNormalFittingTexture());
|
||||||
}
|
}
|
||||||
|
|
||||||
gpu::PipelinePointer GeometryCache::getSimpleSRGBTexturedUnlitNoDstAlphaPipeline() {
|
gpu::PipelinePointer GeometryCache::getSimpleSRGBTexturedUnlitNoTexAlphaPipeline() {
|
||||||
// Compile the shaders, once
|
// Compile the shaders, once
|
||||||
static std::once_flag once;
|
static std::once_flag once;
|
||||||
std::call_once(once, [&]() {
|
std::call_once(once, [&]() {
|
||||||
auto VS = gpu::Shader::createVertex(std::string(simple_vert));
|
auto VS = gpu::Shader::createVertex(std::string(simple_vert));
|
||||||
auto PS = gpu::Shader::createPixel(std::string(simple_srgb_textured_unlit_no_dst_alpha_frag));
|
auto PS = gpu::Shader::createPixel(std::string(simple_srgb_textured_unlit_no_tex_alpha_frag));
|
||||||
|
|
||||||
_simpleSRGBTexturedUnlitNoDstAlphaShader = gpu::Shader::createProgram(VS, PS);
|
_simpleSRGBTexturedUnlitNoTexAlphaShader = gpu::Shader::createProgram(VS, PS);
|
||||||
|
|
||||||
gpu::Shader::BindingSet slotBindings;
|
gpu::Shader::BindingSet slotBindings;
|
||||||
slotBindings.insert(gpu::Shader::Binding(std::string("normalFittingMap"), render::ShapePipeline::Slot::MAP::NORMAL_FITTING));
|
slotBindings.insert(gpu::Shader::Binding(std::string("normalFittingMap"), render::ShapePipeline::Slot::MAP::NORMAL_FITTING));
|
||||||
gpu::Shader::makeProgram(*_simpleSRGBTexturedUnlitNoDstAlphaShader, slotBindings);
|
gpu::Shader::makeProgram(*_simpleSRGBTexturedUnlitNoTexAlphaShader, slotBindings);
|
||||||
auto state = std::make_shared<gpu::State>();
|
auto state = std::make_shared<gpu::State>();
|
||||||
state->setCullMode(gpu::State::CULL_NONE);
|
state->setCullMode(gpu::State::CULL_NONE);
|
||||||
state->setDepthTest(true, true, gpu::LESS_EQUAL);
|
state->setDepthTest(true, true, gpu::LESS_EQUAL);
|
||||||
|
@ -1775,10 +1775,10 @@ gpu::PipelinePointer GeometryCache::getSimpleSRGBTexturedUnlitNoDstAlphaPipeline
|
||||||
gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA,
|
gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA,
|
||||||
gpu::State::FACTOR_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::ONE);
|
gpu::State::FACTOR_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::ONE);
|
||||||
|
|
||||||
_simpleSRGBTexturedUnlitNoDstAlphaPipeline = gpu::Pipeline::create(_simpleSRGBTexturedUnlitNoDstAlphaShader, state);
|
_simpleSRGBTexturedUnlitNoTexAlphaPipeline = gpu::Pipeline::create(_simpleSRGBTexturedUnlitNoTexAlphaShader, state);
|
||||||
});
|
});
|
||||||
|
|
||||||
return _simpleSRGBTexturedUnlitNoDstAlphaPipeline;
|
return _simpleSRGBTexturedUnlitNoTexAlphaPipeline;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeometryCache::bindSimpleProgram(gpu::Batch& batch, bool textured, bool culled, bool unlit, bool depthBiased) {
|
void GeometryCache::bindSimpleProgram(gpu::Batch& batch, bool textured, bool culled, bool unlit, bool depthBiased) {
|
||||||
|
|
|
@ -158,8 +158,8 @@ public:
|
||||||
gpu::PipelinePointer getSimplePipeline(bool textured = false, bool culled = true,
|
gpu::PipelinePointer getSimplePipeline(bool textured = false, bool culled = true,
|
||||||
bool unlit = false, bool depthBias = false);
|
bool unlit = false, bool depthBias = false);
|
||||||
|
|
||||||
void bindSimpleSRGBTexturedUnlitNoDstAlphaProgram(gpu::Batch& batch);
|
void bindSimpleSRGBTexturedUnlitNoTexAlphaProgram(gpu::Batch& batch);
|
||||||
gpu::PipelinePointer getSimpleSRGBTexturedUnlitNoDstAlphaPipeline();
|
gpu::PipelinePointer getSimpleSRGBTexturedUnlitNoTexAlphaPipeline();
|
||||||
|
|
||||||
render::ShapePipelinePointer getShapePipeline() { return GeometryCache::_simplePipeline; }
|
render::ShapePipelinePointer getShapePipeline() { return GeometryCache::_simplePipeline; }
|
||||||
render::ShapePipelinePointer getWireShapePipeline() { return GeometryCache::_simpleWirePipeline; }
|
render::ShapePipelinePointer getWireShapePipeline() { return GeometryCache::_simpleWirePipeline; }
|
||||||
|
@ -421,8 +421,8 @@ private:
|
||||||
gpu::PipelinePointer _glowLinePipeline;
|
gpu::PipelinePointer _glowLinePipeline;
|
||||||
QHash<SimpleProgramKey, gpu::PipelinePointer> _simplePrograms;
|
QHash<SimpleProgramKey, gpu::PipelinePointer> _simplePrograms;
|
||||||
|
|
||||||
gpu::ShaderPointer _simpleSRGBTexturedUnlitNoDstAlphaShader;
|
gpu::ShaderPointer _simpleSRGBTexturedUnlitNoTexAlphaShader;
|
||||||
gpu::PipelinePointer _simpleSRGBTexturedUnlitNoDstAlphaPipeline;
|
gpu::PipelinePointer _simpleSRGBTexturedUnlitNoTexAlphaPipeline;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<$VERSION_HEADER$>
|
<$VERSION_HEADER$>
|
||||||
// Generated on <$_SCRIBE_DATE$>
|
// Generated on <$_SCRIBE_DATE$>
|
||||||
//
|
//
|
||||||
// simple.frag
|
// simple_srgb_texture_unlit_no_tex_alpha.frag
|
||||||
// fragment shader
|
// fragment shader
|
||||||
//
|
//
|
||||||
// Created by Anthony Thibault on 7/25/16.
|
// Created by Anthony Thibault on 7/25/16.
|
Loading…
Reference in a new issue