mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-24 20:19:49 +02:00
feat: more muted colors
This commit is contained in:
1 parent
9efe9860ae
commit
90bff59af3
1 file changed
+14
-4
@@ -1,5 +1,7 @@
|
|||||||
import { useLoader } from '@react-three/fiber';
|
import { useFrame, useLoader } from '@react-three/fiber';
|
||||||
import { TextureLoader } from 'three';
|
import { clamp } from 'lodash';
|
||||||
|
import { useRef } from 'react';
|
||||||
|
import { MeshStandardMaterial, TextureLoader } from 'three';
|
||||||
import { useTankopediaPersistent } from '../../../../../stores/tankopedia';
|
import { useTankopediaPersistent } from '../../../../../stores/tankopedia';
|
||||||
|
|
||||||
export function SceneProps() {
|
export function SceneProps() {
|
||||||
@@ -7,14 +9,22 @@ export function SceneProps() {
|
|||||||
(state) =>
|
(state) =>
|
||||||
state.model.visual.showGrid && !state.model.visual.showEnvironment,
|
state.model.visual.showGrid && !state.model.visual.showEnvironment,
|
||||||
);
|
);
|
||||||
const texture = useLoader(TextureLoader, 'https://i.imgur.com/6QjSn1e.png');
|
const texture = useLoader(TextureLoader, 'https://i.imgur.com/C28Z8nU.png');
|
||||||
|
const material = useRef<MeshStandardMaterial>(null);
|
||||||
|
|
||||||
|
useFrame(({ camera }) => {
|
||||||
|
if (!material.current) return;
|
||||||
|
material.current.opacity = clamp(0.1 * camera.position.y, 0, 1);
|
||||||
|
});
|
||||||
|
|
||||||
|
texture.anisotropy = 2;
|
||||||
|
|
||||||
if (!show) return null;
|
if (!show) return null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<mesh rotation={[-Math.PI / 2, 0, 0]}>
|
<mesh rotation={[-Math.PI / 2, 0, 0]}>
|
||||||
<planeGeometry args={[10, 10]} />
|
<planeGeometry args={[10, 10]} />
|
||||||
<meshBasicMaterial map={texture} transparent />
|
<meshStandardMaterial ref={material} map={texture} transparent />
|
||||||
</mesh>
|
</mesh>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user