Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

split files & lid animation #3

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion .github/workflows/deploy-github-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ jobs:
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./dist
cname: 3d.sensebox.de
cname: 3d.sensebox.de
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ npm run dev

## License

This project is licensed under the [MIT License](./LICENSE.md).
This project is licensed under the [MIT License](./LICENSE.md).
24 changes: 12 additions & 12 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
import js from '@eslint/js'
import globals from 'globals'
import reactHooks from 'eslint-plugin-react-hooks'
import reactRefresh from 'eslint-plugin-react-refresh'
import tseslint from 'typescript-eslint'
import js from "@eslint/js";
import globals from "globals";
import reactHooks from "eslint-plugin-react-hooks";
import reactRefresh from "eslint-plugin-react-refresh";
import tseslint from "typescript-eslint";

export default tseslint.config(
{ ignores: ['dist'] },
{ ignores: ["dist"] },
{
extends: [js.configs.recommended, ...tseslint.configs.recommended],
files: ['**/*.{ts,tsx}'],
files: ["**/*.{ts,tsx}"],
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
},
plugins: {
'react-hooks': reactHooks,
'react-refresh': reactRefresh,
"react-hooks": reactHooks,
"react-refresh": reactRefresh,
},
rules: {
...reactHooks.configs.recommended.rules,
'react-refresh/only-export-components': [
'warn',
"react-refresh/only-export-components": [
"warn",
{ allowConstantExport: true },
],
},
},
)
);
45 changes: 45 additions & 0 deletions package-lock.json

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

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
"dependencies": {
"@react-three/drei": "^9.114.6",
"@react-three/fiber": "^8.17.10",
"@react-three/postprocessing": "^2.16.3",
"lamina": "^1.1.23",
"postprocessing": "^6.36.4",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-router-dom": "^6.28.0",
Expand Down
54,572 changes: 54,571 additions & 1 deletion public/gltf/bike/senseBox_bike.gltf

Large diffs are not rendered by default.

28 changes: 27 additions & 1 deletion src/index.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,32 @@
/* Allgemeine Stile für die Seite */
html,
body,
#root {
height: 100%;
margin: unset;
margin: 0;
background-color: #000; /* Schwarzer Hintergrund für besseren Kontrast */
overflow: hidden;
font-family: Arial, sans-serif; /* Schriftart auf die gesamte Seite anwenden */
}

/* Stile für die Annotationen */
.annotation {
transform: translate3d(calc(50%), calc(-50%), 0);
text-align: left;
background: #181c20;
color: #8c92a4;
padding: 10px 15px;
border-radius: 5px;
user-select: none;
font-family: var(--leva-fonts-mono);
}

.annotation::before {
content: "";
position: absolute;
top: 20px;
left: -30px;
height: 2px;
width: 30px;
background: #181c20;
}
26 changes: 14 additions & 12 deletions src/main.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { StrictMode } from 'react'
import { createRoot } from 'react-dom/client'
import './index.css'
import { createBrowserRouter, RouterProvider } from 'react-router-dom';
import BikeScene from './scenes/bike/bike-scene';
import { StrictMode } from "react";
import { createRoot } from "react-dom/client";
import "./index.css";
import { createBrowserRouter, RouterProvider } from "react-router-dom";
import BikeScene from "./scenes/bike";

const router = createBrowserRouter([
{
Expand All @@ -15,13 +15,15 @@ const router = createBrowserRouter([
},
{
path: "/",
element: <div>
<h1>senseBox 3D models</h1>
<a href="/bike">Bike</a>
</div>,
element: (
<div>
<h1>senseBox 3D models</h1>
<a href="/bike">Bike</a>
</div>
),
},
]);

createRoot(document.getElementById('root')!).render(
<RouterProvider router={router} />
)
createRoot(document.getElementById("root")!).render(
<RouterProvider router={router} />,
);
25 changes: 0 additions & 25 deletions src/scenes/bike/bike-scene.tsx

This file was deleted.

49 changes: 49 additions & 0 deletions src/scenes/bike/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import { OrbitControls, Stage } from "@react-three/drei";
import { Canvas } from "@react-three/fiber";
import { Suspense, useRef } from "react";
import { Model } from "./model";
import "../../index.css";

export default function BikeScene() {
const controlsRef = useRef(null);

const annotations = [
{
position: [0.1, 0.5, 0] as [number, number, number],
content: "HDC1080 Sensor",
},
{
position: [-0.3, 0.2, 0.1] as [number, number, number],
content: "ToF Sensor",
},
];

return (
<Canvas
shadows={false}
dpr={[1, 2]}
camera={{
fov: 50,
position: [1, 1.9, -2],
near: 200,
far: 2000,
focus: 500,
zoom: 0.5,
}}
>
<Suspense fallback={null}>
<Stage preset="portrait" intensity={0.5} environment="city">
<Model annotations={annotations} />
</Stage>
</Suspense>
<OrbitControls
ref={controlsRef}
autoRotate={false}
minDistance={0.1}
maxDistance={9}
enableDamping={true}
dampingFactor={0.1}
/>
</Canvas>
);
}
Loading