Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
webprofusion-chrisc committed Oct 30, 2020
1 parent 581b623 commit 12e4fdf
Show file tree
Hide file tree
Showing 11 changed files with 198 additions and 79 deletions.
2 changes: 1 addition & 1 deletion lib/dojo3d/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ Compile:

delete build folder

`npx rollup -c rollup.config.js`
`npx rollup -w -c rollup.config.js`

build/index.js
22 changes: 22 additions & 0 deletions lib/dojo3d/package-lock.json

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

1 change: 1 addition & 0 deletions lib/dojo3d/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
"prettier": "^2.1.1",
"rollup": "^2.32.1",
"rollup-plugin-delete": "^2.0.0",
"rollup-plugin-sourcemaps": "^0.6.3",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-uglify": "^6.0.4",
"standard-version": "^9.0.0",
Expand Down
5 changes: 3 additions & 2 deletions lib/dojo3d/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import typescript from '@rollup/plugin-typescript';
import { nodeResolve } from '@rollup/plugin-node-resolve';
import { terser } from 'rollup-plugin-terser';
import del from 'rollup-plugin-delete'

import sourcemaps from 'rollup-plugin-sourcemaps';
// build project from typescript, bundle minified as single global export
export default {
input: 'src/index.ts',
Expand All @@ -20,6 +20,7 @@ export default {
plugins: [
del({ targets: './build/*' }),
typescript(),
nodeResolve()
nodeResolve(),
sourcemaps()
]
};
10 changes: 5 additions & 5 deletions lib/dojo3d/src/examples/01-world.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
//import { World } from "../lib/world";

import { World } from "../lib/dojo3d";
import { World } from "../lib/World";


var world = new World();

world.Create();
world.create();

world.SetupLights();
world.setupLights();

world.AddGround();
world.addGround();

//var cube1 = world.AddCube();
world.AddCube(0.1, 0.1, 0.1, 3, 3, 3);
world.addCube(0.1, 0.1, 0.1, 3, 3, 3);

// world.LoadModel("assets/models / characters / phoenix_bird / scene.gltf", 0.005);
//https://5h3o2.csb.app/
Expand Down
38 changes: 32 additions & 6 deletions lib/dojo3d/src/examples/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<head>
<meta charset="utf-8">
<title>Dojo Example</title>
<title>Dojo 3D</title>
<style>
body {
margin: 0;
Expand All @@ -19,13 +19,39 @@

<body>
<script>


var world = new dojo3d.World();
world.Create();
world.SetupLights();
world.AddGround();

world.AddCube(0.1, 0.1, 0.1, 3, 3, 3);
world.LoadModel("https://dojo3d.s3.us-east-1.amazonaws.com/models/characters/phoenix_bird/scene.gltf", 0.005);
world.fetchPrefabModels().then(async () => {

//world.create();
world.setupLights();
//world.addGround();


// prefab models:
// "Box Man", "Phoenix Bird", "Hover Bike (The Rocket)","Wipeout 4K"

//var model = world.getPrefabModelByName("Hover Bike (The Rocket)");
//var obj = await world.addSceneObject(model, 0.05);
//obj.setScale(0.001);

var boxMan = world.getPrefabModelByName("Box Man");
await world.addSceneObject(boxMan, 0.1);

//var bookScene = world.getPrefabModelByName("Medieval Fantasy Book");
//obj = await world.addSceneObject(bookScene, 0.1);

var scene = world.getPrefabModelByName("Happy Halloween");
obj = await world.addSceneObject(scene, 0.1);

});


//world.LoadModel("https://dojo3d.s3.us-east-1.amazonaws.com/models/characters/phoenix_bird/scene.gltf", 0.005);


</script>

</body>
Expand Down
4 changes: 3 additions & 1 deletion lib/dojo3d/src/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
export * from './lib/dojo3d';
import { World } from "./lib/World";

export { World }
12 changes: 12 additions & 0 deletions lib/dojo3d/src/lib/Model.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export interface Model {
id: string;
name: string;
attribution: string;
path: string;
category: string;
}

export interface ModelCatalog {
categories: string[];
models: Model[];
}
25 changes: 25 additions & 0 deletions lib/dojo3d/src/lib/SceneObject.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { Model } from "./Model";
import { Object3D } from "three";

export class SceneObject {

public update: () => void;

constructor(public model: Model, public obj: Object3D) {

}

setPosition(x: number, y: number, z: number) {
this.obj.position.set(x, y, z);
}

setScale(scale: number) {
this.obj.scale.set(scale, scale, scale);
}

setRotation(x: number, y: number, z: number) {
this.obj.rotateX(x);
this.obj.rotateY(y);
this.obj.rotateZ(z);
}
}
3 changes: 0 additions & 3 deletions lib/dojo3d/src/lib/dojo3d.ts

This file was deleted.

Loading

0 comments on commit 12e4fdf

Please sign in to comment.