Skip to content

Commit c7470b7

Browse files
committed
readme
1 parent f5684ff commit c7470b7

3 files changed

Lines changed: 44 additions & 7 deletions

File tree

README.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,43 @@ PlanetTech is an open-source JavaScript library built using vanilla THREE.js, ac
1919

2020
What sets this library apart is its utilization of the GPU for all tasks. This includes generating textures for each facet, performing displacement, and shaping PlaneGeometries into spherical forms; the entire process occurs on the GPU. Consequently, there is no need for WebWorkers at this stage.
2121

22+
23+
```javascript
24+
25+
let cubeUrls = [
26+
new URL('./textuers/color/right_color_image.png',window.location.origin).href,
27+
new URL('./textuers/color/left_color_image.png',window.location.origin).href,
28+
new URL('./textuers/color/top_color_image.png',window.location.origin).href,
29+
new URL('./textuers/color/bottom_color_image.png',window.location.origin).href,
30+
new URL('./textuers/color/front_color_image.png', window.location.origin).href,
31+
new URL('./textuers/color/back_color_image.png' ,window.location.origin).href, ]
32+
const texture = new THREE.CubeTextureLoader() .load( cubeUrls )
33+
const cubetexture = cubeTexture(texture,THREE.positionLocal)
34+
35+
let planet = new Planet()
36+
planet.initSphere({
37+
offset:1/1.5 ,
38+
levels:6,
39+
size:15,
40+
radius:15,
41+
resolution:10,
42+
dimension:5
43+
})
44+
planet.primitive.infrastructure.config.material.colorNode = cubetexture
45+
46+
planet.setEvents ('afterMeshCreation',[(node)=>{ }])
47+
planet.setEvents ('loadTexture',[()=>{}])
48+
planet.setEvents ('afterSpatialNodeCreation',[(node)=>{ node.add(box3Mesh(node.boundingInfo.boundingBox,new THREE.Color( Math.random() * 0xffffff ))) }])
49+
50+
planet.create()
51+
scene.add(planet)
52+
53+
animate=()=>{
54+
planet.primitive.update(camera)
55+
renderer.render(scene,camera)
56+
}
57+
```
58+
2259
## Getting Started
2360
To run the basic example:
2461
```

src/components/bodies/celestialBody.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11

22
import * as THREE from 'three'
3-
import { Physics, PrimitiveMechanics } from '../../core/physics/engine.js'
3+
//import { Physics, PrimitiveMechanics } from '../../core/physics/engine.js'
44

55

6-
const setRigidBodyCallBack = ( node, primitive, planetaryPhysics )=>{
6+
/*const setRigidBodyCallBack = ( node, primitive, planetaryPhysics )=>{
77
88
const currentDepth = node.params.depth
99
1010
const maxDepth = primitive.infrastructure.config.levels.levelsArray.length-1
1111
1212
if( currentDepth === maxDepth ) planetaryPhysics.setPrimitiveRigidBody(node)
1313
14-
}
14+
}*/
1515

1616

1717
export class CelestialBody extends THREE.Object3D{
@@ -25,13 +25,13 @@ export class CelestialBody extends THREE.Object3D{
2525

2626
enablePhysics( gravity ){
2727

28-
this.physicsEngine = new PrimitiveMechanics(new Physics( gravity ))
28+
/*this.physicsEngine = new PrimitiveMechanics(new Physics( gravity ))
2929
3030
this.primitive.infrastructure.on('afterMeshCreation', ( node, _ ) => {
3131
3232
setRigidBodyCallBack ( node, this.primitive, this.physicsEngine )
3333
34-
} )
34+
} )*/
3535

3636
}
3737

src/core/physics/engine.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
1+
/*
22
import RAPIER from 'https://cdn.skypack.dev/@dimforge/rapier3d-compat';
33
//https://sbedit.net/f06b5aef06fb48c2777501f643dfa21f765c9485#L273-L281
44
@@ -51,4 +51,4 @@ export class PrimitiveMechanics{
5151
}
5252
5353
54-
}
54+
}*/

0 commit comments

Comments
 (0)