Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 3 additions & 13 deletions lib/webgl/components/canvas/index.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,13 @@
'use client'

import dynamic from 'next/dynamic'
import { type ReactNode, useState } from 'react'
import tunnel from 'tunnel-rat'
import { CanvasContext } from '@/webgl/hooks/use-canvas'

// R3F is client-only; ssr:false keeps it out of the server render.
const WebGLCanvas = dynamic(
() => import('./webgl').then((m) => m.WebGLCanvas),
{ ssr: false }
)

export function Canvas({ children }: { children?: ReactNode }) {
const [WebGLTunnel] = useState(() => tunnel())
const [DOMTunnel] = useState(() => tunnel())

return (
<CanvasContext.Provider value={{ WebGLTunnel, DOMTunnel }}>
{children}
<WebGLCanvas />
</CanvasContext.Provider>
)
export function Canvas() {
return <WebGLCanvas />
}
5 changes: 0 additions & 5 deletions lib/webgl/components/canvas/webgl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,12 @@
import { OrthographicCamera } from '@react-three/drei'
import { Canvas } from '@react-three/fiber'
import { Suspense } from 'react'
import { useCanvas } from '@/webgl/hooks/use-canvas'
import { Content } from '../content'
import { PostProcessing } from '../postprocessing'
import { RAF } from '../raf'
import s from './webgl.module.css'

export function WebGLCanvas() {
const { WebGLTunnel, DOMTunnel } = useCanvas()

return (
<div className={s.webgl} id="webgl">
<Canvas
Expand All @@ -38,11 +35,9 @@ export function WebGLCanvas() {
/>
<RAF />
<PostProcessing />
<WebGLTunnel.Out />
<Content />
</Suspense>
</Canvas>
<DOMTunnel.Out />
</div>
)
}
6 changes: 2 additions & 4 deletions lib/webgl/components/raf.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@ import { useThree } from '@react-three/fiber'
import { useFrame } from '@/hooks'

/** Drives the manual render loop: tempus tick → R3F advance (frameloop="never"). */
export function RAF({ render = true }: { render?: boolean }) {
export function RAF() {
const advance = useThree((state) => state.advance)

useFrame((time) => {
if (render) advance(time / 1000)
}, 1)
useFrame((time) => advance(time / 1000), 1)

return null
}
21 changes: 0 additions & 21 deletions lib/webgl/hooks/use-canvas.ts

This file was deleted.

11 changes: 0 additions & 11 deletions lib/webgl/utils/blend.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,4 @@
export const BLEND = {
SOFT_LIGHT: `float blendSoftLight(float base, float blend) {
return (blend<0.5)?(2.0*base*blend+base*base*(1.0-2.0*blend)):(sqrt(base)*(2.0*blend-1.0)+2.0*base*(1.0-blend));
}

vec3 blendSoftLight(vec3 base, vec3 blend) {
return vec3(blendSoftLight(base.r,blend.r),blendSoftLight(base.g,blend.g),blendSoftLight(base.b,blend.b));
}

vec3 blendSoftLight(vec3 base, vec3 blend, float opacity) {
return (blendSoftLight(base, blend) * opacity + base * (1.0 - opacity));
}`,
NORMAL: `vec3 blendNormal(vec3 base, vec3 blend) {
return blend;
}
Expand Down
5 changes: 0 additions & 5 deletions lib/webgl/utils/glsl.ts

This file was deleted.

153 changes: 0 additions & 153 deletions lib/webgl/utils/noise.ts

This file was deleted.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
"react-dom": "19.2.7",
"tempus": "1.0.0-dev.17",
"three": "0.184.0",
"tunnel-rat": "^0.1.2",
"zod": "^4.4.3",
"zustand": "^5.0.14"
},
Expand Down
Loading