-
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adeira-source-id: bae94bd7aa708a34cdd086ba0be68b39dcde7346
- Loading branch information
1 parent
0e4e65e
commit 85a626d
Showing
12 changed files
with
173 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
{ | ||
"overview": "Overview", | ||
"macos": "macOS", | ||
"windows": "Windows" | ||
"windows": "Windows", | ||
"manual-setup": "", | ||
"javascript-projects": "" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
Triplex works best with TypeScript as the rich type information is used to | ||
populate the editor controls, however if you're not yet using TypeScript you're | ||
still able to use Triplex. | ||
|
||
## Set up config file | ||
|
||
In your existing project add a | ||
[`.triplex/config.json`](/docs/api-reference/config) file: | ||
|
||
```json | ||
{ | ||
"components": ["../src/components/**/*.jsx"], | ||
"files": ["../src/**/*.jsx"] | ||
} | ||
``` | ||
|
||
Where `"components"` is a glob pointing to custom components that can be added | ||
to other components, and `"files"` is a glob pointing to any files you want to | ||
open with Triplex. | ||
|
||
## Add type packages | ||
|
||
Make sure to add types to your project (even if you're not using TypeScript!) — | ||
this will make your experience in Triplex that much better as all Three.js | ||
primitives will have types the editor can use: | ||
|
||
``` | ||
npm install @types/react @types/three | ||
``` | ||
|
||
## Open your project | ||
|
||
You're now able to open your project with Triplex! When you do Triplex will add | ||
a `.tsconfig.json` file to the root of your project. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"$schema": "https://triplex.dev/config.schema.json", | ||
"components": ["../src/geometry/**/*.jsx"], | ||
"files": ["../src/**/*.jsx"], | ||
"provider": "./provider.jsx" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
export default function Provider({ children, color = "" }) { | ||
return ( | ||
<> | ||
{color && <color args={[color]} attach="background" />} | ||
{children} | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"name": "@example/js", | ||
"version": "0.0.0", | ||
"private": true, | ||
"scripts": { | ||
"build": "echo \"Not implemented\"", | ||
"typedef": "echo \"Not implemented\"" | ||
}, | ||
"dependencies": { | ||
"@react-three/drei": "^9.56.27", | ||
"@react-three/fiber": "^8.14.5", | ||
"@types/react": "^18.0.0", | ||
"@types/three": "^0.157.0", | ||
"react": "^18.0.0", | ||
"react-dom": "^18.0.0", | ||
"three": "^0.157.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/** | ||
* Copyright (c) Michael Dougall. All rights reserved. | ||
* | ||
* This source code is licensed under the GPL-3.0 license found in the LICENSE | ||
* file in the root directory of this source tree. | ||
*/ | ||
function Box({ color, position, rotation, scale, size = 1 }) { | ||
return ( | ||
<group scale={scale}> | ||
<mesh position={position} rotation={rotation}> | ||
<boxGeometry args={[size, size, size]} /> | ||
<meshStandardMaterial color={color} key={color} /> | ||
</mesh> | ||
</group> | ||
); | ||
} | ||
|
||
export default Box; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/** | ||
* Copyright (c) Michael Dougall. All rights reserved. | ||
* | ||
* This source code is licensed under the GPL-3.0 license found in the LICENSE | ||
* file in the root directory of this source tree. | ||
*/ | ||
import React from "react"; | ||
|
||
const Cylinder = ({ position = [0, 0, 0] }) => { | ||
return ( | ||
<mesh position={position}> | ||
<cylinderGeometry /> | ||
<meshStandardMaterial color={"#4be9cb"} /> | ||
</mesh> | ||
); | ||
}; | ||
|
||
export default Cylinder; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/** | ||
* Copyright (c) Michael Dougall. All rights reserved. | ||
* | ||
* This source code is licensed under the GPL-3.0 license found in the LICENSE | ||
* file in the root directory of this source tree. | ||
*/ | ||
export default function Sphere({ position, rotation, scale }) { | ||
return ( | ||
<mesh | ||
castShadow={true} | ||
position={position} | ||
receiveShadow={true} | ||
rotation={rotation} | ||
scale={scale} | ||
> | ||
<sphereGeometry /> | ||
<meshStandardMaterial color={"#84f4ea"} /> | ||
</mesh> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/** | ||
* Copyright (c) Michael Dougall. All rights reserved. | ||
* | ||
* This source code is licensed under the GPL-3.0 license found in the LICENSE | ||
* file in the root directory of this source tree. | ||
*/ | ||
import Box from "./geometry/box"; | ||
import Cylinder from "./geometry/cylinder"; | ||
import Sphere from "./geometry/sphere"; | ||
|
||
export default function Scene() { | ||
return ( | ||
<> | ||
<Box color="red" /> | ||
<Cylinder position={[-1.86, 0, -1.84]} /> | ||
<Sphere position={[2.02, 0, -1.8]} /> | ||
<ambientLight intensity={0.4} /> | ||
<pointLight intensity={10.38} position={[-1.44, 2.54, 0]} /> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"compilerOptions": { | ||
"allowJs": true, | ||
"baseUrl": ".", | ||
"esModuleInterop": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"incremental": true, | ||
"isolatedModules": true, | ||
"jsx": "preserve", | ||
"lib": ["dom", "dom.iterable", "es2022"], | ||
"module": "esnext", | ||
"moduleResolution": "node", | ||
"noEmit": true, | ||
"resolveJsonModule": true, | ||
"skipLibCheck": true, | ||
"strict": true, | ||
"types": ["@react-three/fiber"] | ||
}, | ||
"exclude": ["node_modules"], | ||
"include": ["."] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters