Skip to content

Commit

Permalink
Rendering enhancements #594 #595 #596
Browse files Browse the repository at this point in the history
  • Loading branch information
xeolabs committed Mar 30, 2021
1 parent 0145d9a commit 5833b9e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
15 changes: 13 additions & 2 deletions src/viewer/scene/PerformanceModel/PerformanceModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -833,6 +833,9 @@ class PerformanceModel extends Component {
* @param {Boolean} [cfg.edges=false] Indicates if the PerformanceModel's edges are initially emphasized.
* @param {Number[]} [cfg.colorize=[1.0,1.0,1.0]] PerformanceModel's initial RGB colorize color, multiplies by the rendered fragment colors.
* @param {Number} [cfg.opacity=1.0] PerformanceModel's initial opacity factor, multiplies by the rendered fragment alpha.
* @param {Number} [cfg.backfaces=false] When we set this ````true````, then we force rendering of backfaces for this PerformanceModel. When
* we leave this ````false````, then we allow the Viewer to decide when to render backfaces. In that case, the
* Viewer will hide backfaces on watertight meshes, show backfaces on open meshes, and always show backfaces on meshes when we slice them open with {@link SectionPlane}s.
* @param {Boolean} [cfg.saoEnabled=true] Indicates if Scalable Ambient Obscurance (SAO) will apply to this PerformanceModel. SAO is configured by the Scene's {@link SAO} component.
* @param {Boolean} [cfg.pbrEnabled=false] Indicates if physically-based rendering (PBR) will apply to the PerformanceModel. Only works when {@link Scene#pbrEnabled} is also ````true````.
* @param {Number} [cfg.edgeThreshold=10] When xraying, highlighting, selecting or edging, this is the threshold angle between normals of adjacent triangles, below which their shared wireframe edge is not drawn.
Expand Down Expand Up @@ -951,6 +954,7 @@ class PerformanceModel extends Component {
this.edges = cfg.edges;
this.colorize = cfg.colorize;
this.opacity = cfg.opacity;
this.backfaces = cfg.backfaces;

// Build static matrix

Expand Down Expand Up @@ -1729,8 +1733,16 @@ class PerformanceModel extends Component {
*
* Default is ````false````.
*
* When we set this ````true````, then backfaces are always rendered for this PerformanceModel.
*
* When we set this ````false````, then we allow the Viewer to decide whether to render backfaces. In this case,
* the Viewer will:
*
* * hide backfaces on watertight meshes,
* * show backfaces on open meshes, and
* * always show backfaces on meshes when we slice them open with {@link SectionPlane}s.
*
* @type {Boolean}
* @deprecated
*/
set backfaces(backfaces) {
backfaces = !!backfaces;
Expand All @@ -1744,7 +1756,6 @@ class PerformanceModel extends Component {
* Default is ````false````.
*
* @type {Boolean}
* @deprecated
*/
get backfaces() {
return this._backfaces;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -783,7 +783,7 @@ class TrianglesBatchingLayer {
}

_updateBackfaceCull(renderFlags, frameCtx) {
const backfaces = (!this.solid) || renderFlags.sectioned;
const backfaces = this.model.backfaces || (!this.solid) || renderFlags.sectioned;
if (frameCtx.backfaces !== backfaces) {
const gl = frameCtx.gl;
if (backfaces) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,7 @@ class TrianglesInstancingLayer {
}

_updateBackfaceCull(renderFlags, frameCtx) {
const backfaces = (!this.solid) || renderFlags.sectioned;
const backfaces = this.model.backfaces || (!this.solid) || renderFlags.sectioned;
if (frameCtx.backfaces !== backfaces) {
const gl = frameCtx.gl;
if (backfaces) {
Expand Down

0 comments on commit 5833b9e

Please sign in to comment.