Merge remote-tracking branch 'origin/simulation-armbot-v2' into v2

This commit is contained in:
2025-05-03 10:10:11 +05:30
15 changed files with 752 additions and 258 deletions

View File

@@ -71,7 +71,7 @@ async function loadInitialFloorItems(
// Check Three.js Cache
const cachedModel = THREE.Cache.get(item.modelfileID!);
if (cachedModel) {
// console.log(`[Cache] Fetching ${item.modelName}`);
//
processLoadedModel(cachedModel.scene.clone(), item, itemsGroup, setFloorItems, addEvent);
modelsLoaded++;
checkLoadingCompletion(modelsLoaded, modelsToLoad, dracoLoader, resolve);
@@ -81,7 +81,7 @@ async function loadInitialFloorItems(
// Check IndexedDB
const indexedDBModel = await retrieveGLTF(item.modelfileID!);
if (indexedDBModel) {
// console.log(`[IndexedDB] Fetching ${item.modelName}`);
//
const blobUrl = URL.createObjectURL(indexedDBModel);
loader.load(blobUrl, (gltf) => {
URL.revokeObjectURL(blobUrl);
@@ -102,7 +102,7 @@ async function loadInitialFloorItems(
}
// Fetch from Backend
// console.log(`[Backend] Fetching ${item.modelName}`);
//
const modelUrl = `${url_Backend_dwinzo}/api/v2/AssetFile/${item.modelfileID!}`;
loader.load(modelUrl, async (gltf) => {
const modelBlob = await fetch(modelUrl).then((res) => res.blob());
@@ -120,7 +120,7 @@ async function loadInitialFloorItems(
);
});
} else {
// console.log(`Item ${item.modelName} is not near`);
//
setFloorItems((prevItems) => [
...(prevItems || []),
{
@@ -281,8 +281,8 @@ function processLoadedModel(
actionName: "Action 1",
actionType: "pickAndPlace",
process: {
startPoint: [0, 0, 0],
endPoint: [0, 0, 0]
startPoint: null,
endPoint: null
},
triggers: []
}

View File

@@ -18,7 +18,7 @@ export default async function assetManager(
const taskId = ++currentTaskId; // Increment taskId for each call
activePromises.set(taskId, true); // Mark task as active
// console.log("Received message from worker:", data);
//
if (data.toRemove.length > 0) {
data.toRemove.forEach((uuid: string) => {
@@ -58,7 +58,7 @@ export default async function assetManager(
// Check Three.js Cache
const cachedModel = THREE.Cache.get(item.modelfileID!);
if (cachedModel) {
// console.log(`[Cache] Fetching ${item.modelName}`);
//
processLoadedModel(cachedModel.scene.clone(), item, itemsGroup, resolve);
return;
}
@@ -66,7 +66,7 @@ export default async function assetManager(
// Check IndexedDB
const indexedDBModel = await retrieveGLTF(item.modelfileID!);
if (indexedDBModel) {
// console.log(`[IndexedDB] Fetching ${item.modelName}`);
//
const blobUrl = URL.createObjectURL(indexedDBModel);
loader.load(
blobUrl,
@@ -86,7 +86,7 @@ export default async function assetManager(
}
// Fetch from Backend
// console.log(`[Backend] Fetching ${item.modelName}`);
//
loader.load(
modelUrl,
async (gltf) => {
@@ -114,14 +114,14 @@ export default async function assetManager(
const existingModel = itemsGroup?.current?.getObjectByProperty("uuid", item.modelUuid);
if (existingModel) {
// console.log(`Model ${item.modelName} already exists in the scene.`);
//
resolve();
return;
}
const model = gltf;
model.uuid = item.modelUuid;
model.userData = { name: item.modelName, modelId: item.modelfileID, modelUuid: item.modelUuid };
model.userData = { name: item.modelName, modelId: item.modelfileID, modelUuid: item.modelUuid, eventData: item.eventData };
model.scale.set(...CONSTANTS.assetConfig.defaultScaleBeforeGsap);
model.position.set(...item.position);
model.rotation.set(item.rotation.x, item.rotation.y, item.rotation.z);