Skip to content

Commit

Permalink
Fix background base color (#3318)
Browse files Browse the repository at this point in the history
  • Loading branch information
pmconne authored Mar 8, 2022
1 parent 01a67ef commit b2aa5c8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@itwin/core-frontend",
"comment": "Fix regression that caused solid color background map base to fail to display.",
"type": "none"
}
],
"packageName": "@itwin/core-frontend"
}
2 changes: 2 additions & 0 deletions core/frontend/src/render/webgl/RealityMesh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ export class RealityMeshGeometryParams extends IndexedGeometryParams {

/** @internal */
export class RealityMeshGeometry extends IndexedGeometry implements IDisposable, RenderMemory.Consumer {
public readonly hasTextures: boolean;
public override get asRealityMesh(): RealityMeshGeometry | undefined { return this; }
public override get isDisposed(): boolean { return this._realityMeshParams.isDisposed; }
public get uvQParams() { return this._realityMeshParams.uvParams.params; }
Expand All @@ -228,6 +229,7 @@ export class RealityMeshGeometry extends IndexedGeometry implements IDisposable,

private constructor(private _realityMeshParams: RealityMeshGeometryParams, public textureParams: RealityTextureParams | undefined, private readonly _transform: Transform | undefined, public readonly baseColor: ColorDef | undefined, private _baseIsTransparent: boolean, private _isTerrain: boolean) {
super(_realityMeshParams);
this.hasTextures = undefined !== textureParams && textureParams.params.some((x) => undefined !== x.texture);
}

public override dispose() {
Expand Down
3 changes: 1 addition & 2 deletions core/frontend/src/render/webgl/glsl/RealityMesh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,7 @@ function addTextures(builder: ProgramBuilder, maxTexturesPerMesh: number) {

builder.frag.addUniform("u_texturesPresent", VariableType.Boolean, (program) => {
program.addGraphicUniform("u_texturesPresent", (uniform, params) => {
const textureCount = params.geometry.asRealityMesh!.textureParams?.params.length;
uniform.setUniform1i(textureCount ? 1 : 0);
uniform.setUniform1i(params.geometry.asRealityMesh!.hasTextures ? 1 : 0);
});
});

Expand Down

0 comments on commit b2aa5c8

Please sign in to comment.