Skip to content

Commit

Permalink
Fix import and assets path's problem
Browse files Browse the repository at this point in the history
  • Loading branch information
Rick1080p committed Jul 26, 2023
1 parent 4de0458 commit 444403d
Show file tree
Hide file tree
Showing 11 changed files with 27 additions and 23 deletions.
2 changes: 1 addition & 1 deletion js/UI/LidarUI.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getLidarsTypes, units } from '/js/data.js'
import { getLidarsTypes, units } from '../data.js'

class LidarUI{
constructor(lidar, sceneManager)
Expand Down
4 changes: 2 additions & 2 deletions js/UI/NodeUI.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Vector3 } from 'three'

import { getCamerasTypes, units } from '/js/data.js'
import { Node } from '/js/scene/objects/sensors/Node.js'
import { getCamerasTypes, units } from '../data.js'
import { Node } from '../scene/objects/sensors/Node.js'

class NodeUI{
constructor(node, sceneManager)
Expand Down
4 changes: 2 additions & 2 deletions js/UI/UIManager.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { SceneManager } from '/js/scene/SceneManager.js';
import { Node } from '/js/scene/objects/sensors/Node.js';
import { SceneManager } from '../scene/SceneManager.js';
import { Node } from '../scene/objects/sensors/Node.js';
import { Wizard } from './Wizard.js';
import { Popup } from './Popup.js';

Expand Down
8 changes: 4 additions & 4 deletions js/UI/Wizard.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Vector2 } from 'three'
import { getCamerasTypes, getLidarsTypes, units } from '/js/data.js';
import { getCamerasTypes, getLidarsTypes, units } from '../data.js';

import { SceneManager } from '/js/scene/SceneManager.js'
import { Node } from '/js/scene/objects/sensors/Node.js';
import { Lidar } from '/js/scene/objects/sensors/Lidar.js'
import { SceneManager } from '../scene/SceneManager.js'
import { Node } from '../scene/objects/sensors/Node.js';
import { Lidar } from '../scene/objects/sensors/Lidar.js'

class Wizard{
constructor()
Expand Down
5 changes: 3 additions & 2 deletions js/data.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// set global variable
window.camerasTypes = null;
window.lidarsTypes = null;
const path = window?.designerPath || './';

function readJSONFile(file, callback) {
var rawFile = new XMLHttpRequest();
Expand All @@ -21,7 +22,7 @@ export function getCamerasTypes()
if(window.camerasTypes === null)
{
let result;
readJSONFile("/js/camera-data/camera-data.json", function(text){
readJSONFile(path + "js/camera-data/camera-data.json", function(text){
const sensorsData = JSON.parse(text);
result = sensorsData.sensors.cameras;

Expand All @@ -40,7 +41,7 @@ export function getLidarsTypes()
if(window.lidarsTypes === null)
{
let result;
readJSONFile("/js/camera-data/camera-data.json", function(text){
readJSONFile(path + "js/camera-data/camera-data.json", function(text){
const sensorsData = JSON.parse(text);
result = sensorsData.sensors.lidars;

Expand Down
3 changes: 3 additions & 0 deletions js/main.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { Engine } from './Engine.js';

//Modify this to set up your base url for assets
//window.designerPath = "./Camera-Simulation/"

const main = new Engine();

export{main}
14 changes: 7 additions & 7 deletions js/scene/SceneManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ import {
} from 'three';
import { DoubleSide } from 'three';
import { FontLoader } from 'three-loaders/FontLoader.js';
import { units } from '/js/data.js';
import { Checkerboard } from '/js/scene/Checkerboard.js';
import { SceneObjects } from '/js/scene/objects/SceneObjects.js';
import { Node } from '/js/scene/objects/sensors/Node.js';
import { Observable } from '/js/scene/Observable.js';
import { TransformControls } from '/js/lib/TransformControls.js';
import { ViewportManager } from '/js/ViewportManager.js';
import { units } from '../data.js';
import { Checkerboard } from './Checkerboard.js';
import { SceneObjects } from './objects/SceneObjects.js';
import { Node } from './objects/sensors/Node.js';
import { Observable } from './Observable.js';
import { TransformControls } from '../lib/TransformControls.js';
import { ViewportManager } from '../ViewportManager.js';

//DEBUG
import { SphereGeometry } from 'three';
Expand Down
2 changes: 1 addition & 1 deletion js/scene/objects/SceneObjects.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { Lidar } from './sensors/Lidar.js';
class SceneObjects{
static loadFont(isBuilder, callback)
{
const path = isBuilder ? './designer/' : './';
const path = './';
new FontLoader().load( path + 'fonts/helvetiker_regular.typeface.json', function ( response ) {
SceneObjects.font = response;
callback();
Expand Down
4 changes: 2 additions & 2 deletions js/scene/objects/props/Dummy.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,10 @@ function loadModel(isBuilder, genre)

};

const path = isBuilder ? './designer/' : './';
const path = './';

new MTLLoader()
.setPath( path + 'models/'+ genre +'02/' )
.setPath( 'models/'+ genre +'02/' )
.setRequestHeader({ "Content-Type" : "model/mtl"})
.load( genre +'02.mtl', function ( materials ) {

Expand Down
2 changes: 1 addition & 1 deletion js/scene/objects/sensors/Lidar.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
Group
} from 'three';

import { getLidarsTypes, units } from '/js/data.js'
import { getLidarsTypes, units } from '../../../data.js'


class Lidar{
Expand Down
2 changes: 1 addition & 1 deletion js/scene/objects/sensors/Node.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
} from 'three';
import { TextGeometry } from 'three-text-geometry';

import { getCamerasTypes } from '/js/data.js';
import { getCamerasTypes } from '../../../data.js';

import { SceneObjects } from '../SceneObjects.js';

Expand Down

0 comments on commit 444403d

Please sign in to comment.