Hi @brianzinn
i use your rbabylonjs-hook.
It works. But I want to upload the texture:
const baseUrl = 'http://localhost:3000';
const textureAssetTasks: Task[] = [
{ name: 'preview2', taskType: TaskType.Texture, url: baseUrl+ "/textures/lightmaps/preview2.jpg", noMipmap: true, invertY: false, samplingMode: 1 }
];
const loadedAssets = useAssetManager(textureAssetTasks);
const assetsManagerTask = loadedAssets.taskNameMap['preview2'] as TextureAssetTask;
assetsManagerTask.onSuccess = function(task) {
console.log("task.texture is ok");
const currentLightmap = task.texture;
if(scene) {
const mesh = scene.getMeshByName("Floor");
if(mesh && mesh.material) {
let pbrMaterial = mesh.material as PBRMaterial;
pbrMaterial.lightmapTexture = currentLightmap;
pbrMaterial.lightmapTexture.coordinatesIndex = 1;
pbrMaterial.useLightmapAsShadowmap = true;
}
}
};
assetsManagerTask.onError = function (task, message, exception) {
console.log("task.texture is error");
console.log(message, exception);
};
And there it did not work.
Am I doing something wrong?