History

working on text3d overlays and entities

SamGondelman committed 9 years ago

Commit 1b85a451 parent d8bb3c718 files · +131 −89Browse files

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

Unified · Split

libraries/render-utils/src/GeometryCache.cpp+14−12
@@ -561,7 +561,7 @@ void GeometryCache::initializeShapePipelines() { · 560 unmodified lines
561561 render::ShapePipelinePointer GeometryCache::getShapePipeline(bool textured, bool transparent, bool culled,
562562 bool unlit, bool depthBias) {
563563
564− return std::make_shared<render::ShapePipeline>(getSimplePipeline(textured, transparent, culled, unlit, depthBias, false), nullptr,
564+ return std::make_shared<render::ShapePipeline>(getSimplePipeline(textured, transparent, culled, unlit, depthBias, false, true), nullptr,
565565 [](const render::ShapePipeline& , gpu::Batch& batch, render::Args*) {
566566 batch.setResourceTexture(render::ShapePipeline::Slot::MAP::ALBEDO, DependencyManager::get<TextureCache>()->getWhiteTexture());
567567 }
@@ -1877,6 +1877,7 @@ public: · 1309 unmodified lines
18771877 IS_UNLIT_FLAG,
18781878 HAS_DEPTH_BIAS_FLAG,
18791879 IS_FADING_FLAG,
1880+ IS_AA_FLAG,
18801881
18811882 NUM_FLAGS,
18821883 };
@@ -1888,6 +1889,7 @@ public: · 5 unmodified lines
18881889 IS_UNLIT = (1 << IS_UNLIT_FLAG),
18891890 HAS_DEPTH_BIAS = (1 << HAS_DEPTH_BIAS_FLAG),
18901891 IS_FADING = (1 << IS_FADING_FLAG),
1892+ IS_AA = (1 << IS_AA_FLAG),
18911893 };
18921894 typedef unsigned short Flags;
18931895
@@ -1899,6 +1901,7 @@ public: · 5 unmodified lines
18991901 bool isUnlit() const { return isFlag(IS_UNLIT); }
19001902 bool hasDepthBias() const { return isFlag(HAS_DEPTH_BIAS); }
19011903 bool isFading() const { return isFlag(IS_FADING); }
1904+ bool isAA() const { return isFlag(IS_AA); }
19021905
19031906 Flags _flags = 0;
19041907 short _spare = 0;
@@ -1907,9 +1910,9 @@ public: · 2 unmodified lines
19071910
19081911
19091912 SimpleProgramKey(bool textured = false, bool transparent = false, bool culled = true,
1910− bool unlit = false, bool depthBias = false, bool fading = false) {
1913+ bool unlit = false, bool depthBias = false, bool fading = false, bool isAA = true) {
19111914 _flags = (textured ? IS_TEXTURED : 0) | (transparent ? IS_TRANSPARENT : 0) | (culled ? IS_CULLED : 0) |
1912− (unlit ? IS_UNLIT : 0) | (depthBias ? HAS_DEPTH_BIAS : 0) | (fading ? IS_FADING : 0);
1915+ (unlit ? IS_UNLIT : 0) | (depthBias ? HAS_DEPTH_BIAS : 0) | (fading ? IS_FADING : 0) | (isAA ? IS_AA : 0);
19131916 }
19141917
19151918 SimpleProgramKey(int bitmask) : _flags(bitmask) {}
@@ -1958,8 +1961,8 @@ gpu::PipelinePointer GeometryCache::getWebBrowserProgram(bool transparent) { · 42 unmodified lines
19581961 return transparent ? _simpleTransparentWebBrowserPipelineNoAA : _simpleOpaqueWebBrowserPipelineNoAA;
19591962 }
19601963
1961−void GeometryCache::bindSimpleProgram(gpu::Batch& batch, bool textured, bool transparent, bool culled, bool unlit, bool depthBiased) {
1962− batch.setPipeline(getSimplePipeline(textured, transparent, culled, unlit, depthBiased));
1964+void GeometryCache::bindSimpleProgram(gpu::Batch& batch, bool textured, bool transparent, bool culled, bool unlit, bool depthBiased, bool isAA) {
1965+ batch.setPipeline(getSimplePipeline(textured, transparent, culled, unlit, depthBiased, false, isAA));
19631966
19641967 // If not textured, set a default albedo map
19651968 if (!textured) {
@@ -1968,8 +1971,8 @@ void GeometryCache::bindSimpleProgram(gpu::Batch& batch, bool textured, bool tra · 2 unmodified lines
19681971 }
19691972 }
19701973
1971−gpu::PipelinePointer GeometryCache::getSimplePipeline(bool textured, bool transparent, bool culled, bool unlit, bool depthBiased, bool fading) {
1972− SimpleProgramKey config { textured, transparent, culled, unlit, depthBiased, fading };
1974+gpu::PipelinePointer GeometryCache::getSimplePipeline(bool textured, bool transparent, bool culled, bool unlit, bool depthBiased, bool fading, bool isAA) {
1975+ SimpleProgramKey config { textured, transparent, culled, unlit, depthBiased, fading, isAA };
19731976
19741977 // If the pipeline already exists, return it
19751978 auto it = _simplePrograms.find(config);
@@ -2027,11 +2030,10 @@ gpu::PipelinePointer GeometryCache::getSimplePipeline(bool textured, bool transp · 51 unmodified lines
20272030 gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA,
20282031 gpu::State::FACTOR_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::ONE);
20292032
2030− if (config.isTransparent()) {
2031− PrepareStencil::testMask(*state);
2032− }
2033− else {
2034− PrepareStencil::testMaskDrawShape(*state);
2033+ if (config.isAA()) {
2034+ config.isTransparent() ? PrepareStencil::testMask(*state) : PrepareStencil::testMaskDrawShape(*state);
2035+ } else {
2036+ PrepareStencil::testMaskDrawShapeNoAA(*state);
20352037 }
20362038
20372039 gpu::ShaderPointer program = (config.isUnlit()) ? (config.isFading() ? _unlitFadeShader : _unlitShader) : (config.isFading() ? _simpleFadeShader : _simpleShader);