added : custom color bricks

This commit is contained in:
bhushan6
2023-03-05 18:11:16 +05:30
parent e5b464eae3
commit 3e99b31e7e
3 changed files with 7 additions and 3 deletions
+1 -1
View File
@@ -16,7 +16,7 @@ function App() {
toneMapping: LinearToneMapping,
}}
camera={{
position: [0, 0, 10],
position: [17.43, 657.76, 943.51],
near: 0.1,
far: 20000,
}}
+1
View File
@@ -1,3 +1,4 @@
import { useThree } from "@react-three/fiber";
import React, { forwardRef, useMemo } from "react";
import { Vector3 } from "three";
import { getMeasurementsFromDimensions, base } from "../utils";
+5 -2
View File
@@ -13,7 +13,7 @@ export const Scene = () => {
const brickCursorRef = useRef();
const { width, depth, rotate } = useControls({
const { width, depth, rotate, color } = useControls({
width: {
value: 1,
min: 1,
@@ -21,12 +21,13 @@ export const Scene = () => {
step: 1,
},
depth: {
value: 2,
value: 1,
min: 1,
max: 5,
step: 1,
},
rotate: false,
color: "#f00",
});
const addBrick = (e) => {
@@ -80,6 +81,7 @@ export const Scene = () => {
uID: uID(),
dimensions: { x: width, z: depth },
rotation: rotate ? Math.PI / 2 : 0,
color: color,
};
setBricks((prevState) => [...prevState, brickData]);
@@ -155,6 +157,7 @@ export const Scene = () => {
bricksBoundBox={bricksBoundBox}
uID={b.uID}
mouseMove={mouseMove}
color={b.color}
/>
);
})}