@itwin/core-frontend
Version:
iTwin.js frontend components
61 lines • 2.75 kB
JavaScript
"use strict";
/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
/** @packageDocumentation
* @module WebGL
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.MeshGeometry = void 0;
const core_common_1 = require("@itwin/core-common");
const CachedGeometry_1 = require("./CachedGeometry");
/** Defines one aspect of the geometry of a mesh (surface or edges)
* @internal
*/
class MeshGeometry extends CachedGeometry_1.LUTGeometry {
mesh;
_numIndices;
get asMesh() { return this; }
_getLineWeight(params) { return this.computeEdgeWeight(params); }
// Convenience accessors...
get edgeWidth() { return this.mesh.edgeWidth; }
get edgeLineCode() { return this.mesh.edgeLineCode; }
get hasFeatures() { return this.mesh.hasFeatures; }
get surfaceType() { return this.mesh.type; }
get fillFlags() { return this.mesh.fillFlags; }
get isPlanar() { return this.mesh.isPlanar; }
get colorInfo() { return this.mesh.lut.colorInfo; }
get uniformColor() { return this.colorInfo.isUniform ? this.colorInfo.uniform : undefined; }
get texture() { return this.mesh.texture; }
get normalMap() { return this.mesh.normalMap; }
get hasBakedLighting() { return this.mesh.hasBakedLighting; }
get lut() { return this.mesh.lut; }
get hasScalarAnimation() { return this.mesh.lut.hasScalarAnimation; }
constructor(mesh, numIndices) {
super(mesh.viewIndependentOrigin);
this._numIndices = numIndices;
this.mesh = mesh;
}
computeEdgeWeight(params) {
return params.target.computeEdgeWeight(params.renderPass, this.edgeWidth);
}
computeEdgeLineCode(params) {
return params.target.computeEdgeLineCode(params.renderPass, this.edgeLineCode);
}
computeEdgeColor(target) {
return target.computeEdgeColor(this.colorInfo);
}
computeEdgePass(target) {
if (target.isDrawingShadowMap)
return "none";
const vf = target.currentViewFlags;
if (core_common_1.RenderMode.SmoothShade === vf.renderMode && !vf.visibleEdges)
return "none";
// Only want translucent edges in wireframe mode.
const isTranslucent = core_common_1.RenderMode.Wireframe === vf.renderMode && vf.transparency && this.colorInfo.hasTranslucency;
return isTranslucent ? "translucent" : "opaque-linear";
}
}
exports.MeshGeometry = MeshGeometry;
//# sourceMappingURL=MeshGeometry.js.map