Skip to content

Commit

Permalink
refactor(examples): update LOGGER handling
Browse files Browse the repository at this point in the history
  • Loading branch information
postspectacular committed Feb 16, 2024
1 parent 744ebed commit 3bd0d3b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 16 deletions.
6 changes: 3 additions & 3 deletions examples/shader-ast-evo/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AST, type ASTNode, type ASTOpts } from "@thi.ng/gp";
import { ConsoleLogger } from "@thi.ng/logger";
import { ConsoleLogger, ROOT } from "@thi.ng/logger";
import { SYSTEM, type IRandom } from "@thi.ng/random";
import {
$,
Expand Down Expand Up @@ -41,15 +41,15 @@ import {
snoise3,
snoiseVec3,
} from "@thi.ng/shader-ast-stdlib";
import { glCanvas, setLogger } from "@thi.ng/webgl";
import { glCanvas } from "@thi.ng/webgl";
import {
shaderToy,
type MainImageFn,
type ShaderToyUniforms,
} from "@thi.ng/webgl-shadertoy";

// enable logging to show generated shader code
setLogger(new ConsoleLogger("webgl"));
ROOT.set(new ConsoleLogger());

const MAX_DEPTH = 11;
const NORM_SCALE = 1;
Expand Down
6 changes: 2 additions & 4 deletions examples/webgl-float-fbo/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { red } from "@thi.ng/colored-noise";
import { ConsoleLogger } from "@thi.ng/logger";
import { ConsoleLogger, ROOT } from "@thi.ng/logger";
import { V2, V4 } from "@thi.ng/shader-ast";
import { mapcat, normRange, repeatedly } from "@thi.ng/transducers";
import { Vec2 } from "@thi.ng/vectors";
Expand All @@ -10,11 +10,10 @@ import {
clearCanvas,
defMultiPass,
glCanvas,
setLogger,
} from "@thi.ng/webgl";

// configure logger to view generated shaders in console
setLogger(new ConsoleLogger("webgl"));
ROOT.set(new ConsoleLogger());

// config
const NUM_POINTS = 16;
Expand Down Expand Up @@ -43,7 +42,6 @@ const VELOCITIES = [
const { gl } = glCanvas({
width: 512,
height: 512,
autoScale: false,
parent: document.body,
version: 2,
});
Expand Down
12 changes: 3 additions & 9 deletions examples/webgl-game-of-life/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
import { ConsoleLogger } from "@thi.ng/logger";
import { ConsoleLogger, ROOT } from "@thi.ng/logger";
import { SYSTEM } from "@thi.ng/random";
import { V3 } from "@thi.ng/shader-ast";
import { repeatedly } from "@thi.ng/transducers";
import {
TextureFormat,
defMultiPass,
glCanvas,
passCopy,
setLogger,
} from "@thi.ng/webgl";
import { TextureFormat, defMultiPass, glCanvas, passCopy } from "@thi.ng/webgl";

// configure a logger to display generated shaders in console
setLogger(new ConsoleLogger("webgl"));
ROOT.set(new ConsoleLogger());

// simulation size
const W = 512;
Expand Down

0 comments on commit 3bd0d3b

Please sign in to comment.