History

enable fading on most entities

HifiExperiments committed 1 year ago

Commit 065aa4c1 parent e9d4e2728 files · +251 −117Browse files

Showing the changes to libraries/render-utils/src/GeometryCache.cpp (1 of 28 files). Show all

Unified · Split

libraries/render-utils/src/GeometryCache.cpp+0−31
@@ -110,7 +110,6 @@ static const uint SHAPE_NORMALS_OFFSET = offsetof(GeometryCache::ShapeVertex, no · 109 unmodified lines
110static const uint SHAPE_TEXCOORD0_OFFSET = offsetof(GeometryCache::ShapeVertex, uv);110static const uint SHAPE_TEXCOORD0_OFFSET = offsetof(GeometryCache::ShapeVertex, uv);
111static const uint SHAPE_TANGENT_OFFSET = offsetof(GeometryCache::ShapeVertex, tangent);111static const uint SHAPE_TANGENT_OFFSET = offsetof(GeometryCache::ShapeVertex, tangent);
112 112
113std::map<std::pair<bool, bool>, gpu::PipelinePointer> GeometryCache::_webPipelines;
114std::map<std::pair<bool, bool>, gpu::PipelinePointer> GeometryCache::_gridPipelines;113std::map<std::pair<bool, bool>, gpu::PipelinePointer> GeometryCache::_gridPipelines;
115 114
116void GeometryCache::computeSimpleHullPointListForShape(const int entityShape, const glm::vec3 &entityExtents, QVector<glm::vec3> &outPointList) {115void GeometryCache::computeSimpleHullPointListForShape(const int entityShape, const glm::vec3 &entityExtents, QVector<glm::vec3> &outPointList) {
@@ -1915,36 +1914,6 @@ inline bool operator==(const SimpleProgramKey& a, const SimpleProgramKey& b) { · 1798 unmodified lines
1915 return a.getRaw() == b.getRaw();1914 return a.getRaw() == b.getRaw();
1916}1915}
1917 1916
1918void GeometryCache::bindWebBrowserProgram(gpu::Batch& batch, bool transparent, bool forward) {
1919 batch.setPipeline(getWebBrowserProgram(transparent, forward));
1920}
1921
1922gpu::PipelinePointer GeometryCache::getWebBrowserProgram(bool transparent, bool forward) {
1923 if (_webPipelines.empty()) {
1924 using namespace shader::render_utils::program;
1925 const int NUM_WEB_PIPELINES = 4;
1926 for (int i = 0; i < NUM_WEB_PIPELINES; ++i) {
1927 bool transparent = i & 1;
1928 bool forward = i & 2;
1929
1930 // For any non-opaque or non-deferred pipeline, we use web_browser_forward
1931 auto pipeline = (transparent || forward) ? web_browser_forward : web_browser;
1932
1933 gpu::StatePointer state = std::make_shared<gpu::State>();
1934 state->setDepthTest(true, !transparent, gpu::LESS_EQUAL);
1935 PrepareStencil::testMaskDrawShapeNoAA(*state);
1936 state->setBlendFunction(transparent,
1937 gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA,
1938 gpu::State::FACTOR_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::ONE);
1939 state->setCullMode(gpu::State::CULL_NONE);
1940
1941 _webPipelines[{ transparent, forward }] = gpu::Pipeline::create(gpu::Shader::createProgram(pipeline), state);
1942 }
1943 }
1944
1945 return _webPipelines[{ transparent, forward }];
1946}
1947
1948void GeometryCache::bindSimpleProgram(gpu::Batch& batch, bool textured, bool transparent, bool unlit, bool depthBiased, bool isAntiAliased,1917void GeometryCache::bindSimpleProgram(gpu::Batch& batch, bool textured, bool transparent, bool unlit, bool depthBiased, bool isAntiAliased,
1949 bool forward, graphics::MaterialKey::CullFaceMode cullFaceMode) {1918 bool forward, graphics::MaterialKey::CullFaceMode cullFaceMode) {
1950 batch.setPipeline(getSimplePipeline(textured, transparent, unlit, depthBiased, false, isAntiAliased, forward, cullFaceMode));1919 batch.setPipeline(getSimplePipeline(textured, transparent, unlit, depthBiased, false, isAntiAliased, forward, cullFaceMode));