Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Valigursky committed Nov 21, 2024
1 parent 9f49aa7 commit 99ac308
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 14 deletions.
15 changes: 14 additions & 1 deletion eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ import playcanvasConfig from '@playcanvas/eslint-config';
import babelParser from '@babel/eslint-parser';
import globals from 'globals';

// Extract or preserve existing JSDoc tags
const jsdocRule = playcanvasConfig.find(
config => config.rules && config.rules['jsdoc/check-tag-names']
);
const existingTags = jsdocRule?.rules['jsdoc/check-tag-names'][1]?.definedTags || [];

export default [
...playcanvasConfig,
{
Expand All @@ -27,7 +33,14 @@ export default [
}
},
rules: {
'import/order': 'off'
'import/order': 'off',
'jsdoc/check-tag-names': [
'error',
{
// custom mjs script tags to not error on, add them to those from parent config
definedTags: [...new Set([...existingTags, 'range', 'step', 'precision'])]
}
]
}
},
{
Expand Down
17 changes: 8 additions & 9 deletions scripts/utils/camera-frame.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Script, Color } from 'playcanvas';
import { CameraFrame as EngineCameraFrame} from 'playcanvas';
import { CameraFrame as EngineCameraFrame, Script, Color } from 'playcanvas';

/** @enum {number} */
const ToneMapping = {
Expand Down Expand Up @@ -305,20 +304,20 @@ class CameraFrame extends Script {

postUpdate(dt) {

const cf = this.engineCameraFrame
const cf = this.engineCameraFrame;
const { rendering, bloom, grading, vignette, fringing, taa, ssao } = this;

const dstRendering = cf.rendering;
dstRendering.renderFormats.length = 0;
dstRendering.renderFormats.push(rendering.renderFormat);
dstRendering.renderFormats.push(rendering.renderFormatFallback0);
dstRendering.renderFormats.push(rendering.renderFormatFallback1);
dstRendering.stencil = rendering.stencil,
dstRendering.renderTargetScale = rendering.renderTargetScale,
dstRendering.samples = rendering.samples,
dstRendering.sceneColorMap = rendering.sceneColorMap,
dstRendering.sceneDepthMap = rendering.sceneDepthMap,
dstRendering.toneMapping = rendering.toneMapping,
dstRendering.stencil = rendering.stencil;
dstRendering.renderTargetScale = rendering.renderTargetScale;
dstRendering.samples = rendering.samples;
dstRendering.sceneColorMap = rendering.sceneColorMap;
dstRendering.sceneDepthMap = rendering.sceneDepthMap;
dstRendering.toneMapping = rendering.toneMapping;
dstRendering.sharpness = rendering.sharpness;

// ssao
Expand Down
8 changes: 4 additions & 4 deletions src/extras/render-passes/camera-frame.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { CameraFrameOptions, RenderPassCameraFrame } from './render-pass-camera-
/**
* @typedef {Object} Rendering
* @property {number[]} renderFormats - The render formats of the frame buffer, in order of
* preference. Defaults to [{@link PIXELFORMAT_111110F}, {@link PIXELFORMAT_RGBA16F},
* preference. Defaults to [{@link PIXELFORMAT_111110F}, {@link PIXELFORMAT_RGBA16F},
* {@link PIXELFORMAT_RGBA32F}].
* @property {boolean} stencil - Whether the render buffer has a stencil buffer. Defaults to false.
* @property {number} renderTargetScale - The scale of the frame buffer, 0.1-1 range. Defaults to 1.
Expand All @@ -39,7 +39,7 @@ import { CameraFrameOptions, RenderPassCameraFrame } from './render-pass-camera-
* - {@link SSAOTYPE_NONE}
* - {@link SSAOTYPE_LIGHTING}
* - {@link SSAOTYPE_COMBINE}
*
*
* @property {boolean} blurEnabled - Whether the SSAO effect is blurred. Defaults to true.
* @property {number} intensity - The intensity of the SSAO effect, 0-1 range. Defaults to 0.5.
* @property {number} radius - The radius of the SSAO effect, 0-100 range. Defaults to 30.
Expand Down Expand Up @@ -67,7 +67,7 @@ import { CameraFrameOptions, RenderPassCameraFrame } from './render-pass-camera-

/**
* @typedef {Object} Vignette
* @property {number} intensity - The intensity of the vignette effect, 0-1 range. Defaults to 0,
* @property {number} intensity - The intensity of the vignette effect, 0-1 range. Defaults to 0,
* making it disabled.
* @property {number} inner - The inner radius of the vignette effect, 0-3 range. Defaults to 0.5.
* @property {number} outer - The outer radius of the vignette effect, 0-3 range. Defaults to 1.
Expand Down Expand Up @@ -252,7 +252,7 @@ class CameraFrame {
get enabled() {
return this.renderPassCamera !== null;
}

updateOptions() {

const { options, rendering, bloom, taa, ssao } = this;
Expand Down

0 comments on commit 99ac308

Please sign in to comment.