Commit 73e36e17 authored by wuhao's avatar wuhao 🎯

asder

parent b567a849
Pipeline #6264 passed with stages
in 8 minutes and 21 seconds
No preview for this file type
This diff is collapsed.
File added
...@@ -8,26 +8,86 @@ ...@@ -8,26 +8,86 @@
* *
* Copyright (c) 2023 by ${git_name_email}, All Rights Reserved. * Copyright (c) 2023 by ${git_name_email}, All Rights Reserved.
*/ */
import { Gltf, OrbitControls } from "@react-three/drei"; import { Gltf, OrbitControls, Stage } from "@react-three/drei";
import { Canvas } from "@react-three/fiber"; import { Canvas } from "@react-three/fiber";
import "./index.less"; import "./index.less";
function PointViewer({ url }) { function Sphere({ position, CoordinatePoint, CurGongjianPoint }) {
console.log({ position, CoordinatePoint, CurGongjianPoint });
return (
<mesh
scale={100}
position={
position
? Object.values(position)?.map((it, i) => {
const offset = Object.values(CoordinatePoint);
const offset1 = Object.values(CurGongjianPoint);
const res =
parseFloat(it / 1000) +
parseFloat(offset[i]) -
parseFloat(offset1[i]);
console.log(res);
const diyoffset = i === 0 ? 0 : i === 1 ? 0.012 : 0.03;
return (res + diyoffset) * 100;
})
: []
}
>
<sphereGeometry attach="geometry" args={[0.002, 32, 32]} />
<meshPhysicalMaterial attach="material" color="red" />
</mesh>
);
}
function PointViewer({ position, CoordinatePoint, CurGongjianPoint }) {
return ( return (
<div className="bar-block-component"> <div className="bar-block-component">
<Canvas style={{ height: "600px", width: "100%" }} id={"sada"}> {CurGongjianPoint && (
<color attach="background" args={["#333"]} /> <Canvas
<ambientLight intensity={1} /> shadows
<OrbitControls></OrbitControls> dpr={[1, 1.5]}
<pointLight position={[10, 10, 10]} intensity={1} /> gl={{ antialias: false }}
<Gltf camera={{ position: [8, 8, 16], fov: 75 }}
src={"./model.glb"} style={{ height: "100%", width: "100%" }}
receiveShadow id={"sada"}
castShadow >
position={[0, 0, 0]} <color attach="background" args={["white"]} />
/> <Stage
</Canvas> intensity={0.5}
preset="rembrandt"
shadows={"contact"}
adjustCamera={1}
environment={{
path: "/",
files: "env.hdr",
}}
>
<axesHelper args={[20]}></axesHelper>
<Gltf
src={"./model.glb"}
receiveShadow
castShadow
position={[0, 0, 0]}
scale={250}
inject={
<meshPhysicalMaterial
color="white"
metalness={1} // 控制金属感,1 表示完全金属
roughness={0} // 控制光滑度,0 表示非常光滑
/>
}
/>
<Sphere
position={position}
CoordinatePoint={CoordinatePoint}
CurGongjianPoint={CurGongjianPoint}
></Sphere>
</Stage>
<OrbitControls></OrbitControls>
</Canvas>
)}
</div> </div>
); );
} }
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
position: relative; position: relative;
background-color: #f0f0f0; background-color: #f0f0f0;
box-shadow: 0 5px 20px rgba(192,57,43,.1); box-shadow: 0 5px 20px rgba(192,57,43,.1);
height: calc(100% - 24px) !important;
} }
.bar-block-component, .foo-block-element { .bar-block-component, .foo-block-element {
margin: 10px; margin: 10px;
......
...@@ -466,9 +466,18 @@ function Checkhomework() { ...@@ -466,9 +466,18 @@ function Checkhomework() {
<Divider></Divider> <Divider></Divider>
<div style={{ position: "relative" }}> <div style={{ position: "relative", minHeight: 360 }}>
<Drawer {...drawer} getContainer={false} title={false} closable={false}> <Drawer
<PointViewer></PointViewer> {...drawer}
getContainer={false}
title={false}
closable={false}
>
<PointViewer
position={drawer?.position}
CoordinatePoint={dialogprops?.tabdata?.CoordinatePoint}
CurGongjianPoint={dialogprops?.tabdata?.CurGongjianPoint}
></PointViewer>
</Drawer> </Drawer>
<b style={{ fontSize: 14, paddingBottom: 10, display: "block" }}> <b style={{ fontSize: 14, paddingBottom: 10, display: "block" }}>
实验报告 实验报告
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment