Browse Source

naming and doc tweaks

Alexander Rose 4 years ago
parent
commit
1acfed3233

+ 3 - 3
src/mol-canvas3d/passes/draw.ts

@@ -67,7 +67,7 @@ export class DrawPass {
     private wboit: WboitPass | undefined
 
     get wboitEnabled() {
-        return !!this.wboit?.enabled;
+        return !!this.wboit?.supported;
     }
 
     constructor(private webgl: WebGLContext, width: number, height: number, enableWboit: boolean) {
@@ -117,7 +117,7 @@ export class DrawPass {
 
             ValueCell.update(this.depthMerge.values.uTexSize, Vec2.set(this.depthMerge.values.uTexSize.ref.value, width, height));
 
-            if (this.wboit?.enabled) {
+            if (this.wboit?.supported) {
                 this.wboit.setSize(width, height);
             }
         }
@@ -138,7 +138,7 @@ export class DrawPass {
     }
 
     private _renderWboit(renderer: Renderer, camera: ICamera, scene: Scene, toDrawingBuffer: boolean) {
-        if (!this.wboit?.enabled) throw new Error('expected wboit to be enabled');
+        if (!this.wboit?.supported) throw new Error('expected wboit to be enabled');
 
         const renderTarget = toDrawingBuffer ? this.drawTarget : this.colorTarget;
         renderTarget.bind();

+ 12 - 5
src/mol-canvas3d/passes/wboit.ts

@@ -51,9 +51,9 @@ export class WboitPass {
     private readonly textureA: Texture
     private readonly textureB: Texture
 
-    private _enabled = false;
-    get enabled() {
-        return this._enabled;
+    private _supported = false;
+    get supported() {
+        return this._supported;
     }
 
     bind() {
@@ -93,7 +93,14 @@ export class WboitPass {
         const { resources, extensions } = webgl;
         const { drawBuffers, textureFloat, colorBufferFloat, depthTexture } = extensions;
         if (!textureFloat || !colorBufferFloat || !depthTexture || !drawBuffers) {
-            if (isDebugMode) console.log('Missing extensions required for "wboit"');
+            if (isDebugMode) {
+                const missing: string[] = [];
+                if (!textureFloat) missing.push('textureFloat');
+                if (!colorBufferFloat) missing.push('colorBufferFloat');
+                if (!depthTexture) missing.push('depthTexture');
+                if (!drawBuffers) missing.push('drawBuffers');
+                console.log(`Missing "${missing.join('", "')}" extensions required for "wboit"`);
+            }
             return;
         }
 
@@ -115,6 +122,6 @@ export class WboitPass {
         this.textureA.attachFramebuffer(this.framebuffer, 'color0');
         this.textureB.attachFramebuffer(this.framebuffer, 'color1');
 
-        this._enabled = true;
+        this._supported = true;
     }
 }

+ 1 - 1
src/mol-gl/webgl/render-target.ts

@@ -19,7 +19,7 @@ export interface RenderTarget {
 
     getWidth: () => number
     getHeight: () => number
-    /** binds framebuffer and sets viewport to rendertarget's width and height */
+    /** binds framebuffer */
     bind: () => void
     setSize: (width: number, height: number) => void
     reset: () => void

+ 1 - 1
src/mol-repr/structure/representation/ball-and-stick.ts

@@ -17,7 +17,7 @@ import { Structure } from '../../../mol-model/structure';
 import { getUnitKindsParam } from '../params';
 
 const BallAndStickVisuals = {
-    'element-sphere': (ctx: RepresentationContext, getParams: RepresentationParamsGetter<Structure, ElementSphereParams>) => UnitsRepresentation('Element sphere mesh', ctx, getParams, getElementSphereVisual(ctx.webgl)),
+    'element-sphere': (ctx: RepresentationContext, getParams: RepresentationParamsGetter<Structure, ElementSphereParams>) => UnitsRepresentation('Element sphere', ctx, getParams, getElementSphereVisual(ctx.webgl)),
     'intra-bond': (ctx: RepresentationContext, getParams: RepresentationParamsGetter<Structure, IntraUnitBondCylinderParams>) => UnitsRepresentation('Intra-unit bond cylinder', ctx, getParams, getIntraUnitBondCylinderVisual(ctx.webgl)),
     'inter-bond': (ctx: RepresentationContext, getParams: RepresentationParamsGetter<Structure, InterUnitBondCylinderParams>) => ComplexRepresentation('Inter-unit bond cylinder', ctx, getParams, getInterUnitBondCylinderVisual(ctx.webgl)),
 };

+ 1 - 1
src/mol-repr/structure/representation/spacefill.ts

@@ -13,7 +13,7 @@ import { ThemeRegistryContext } from '../../../mol-theme/theme';
 import { Structure } from '../../../mol-model/structure';
 
 const SpacefillVisuals = {
-    'element-sphere': (ctx: RepresentationContext, getParams: RepresentationParamsGetter<Structure, ElementSphereParams>) => UnitsRepresentation('Sphere mesh', ctx, getParams, getElementSphereVisual(ctx.webgl)),
+    'element-sphere': (ctx: RepresentationContext, getParams: RepresentationParamsGetter<Structure, ElementSphereParams>) => UnitsRepresentation('Element sphere', ctx, getParams, getElementSphereVisual(ctx.webgl)),
 };
 
 export const SpacefillParams = {