Commit ac017249 authored by 任建锋's avatar 任建锋

rjf

parent e0e062d1
{
"name": "yt",
"version": "1.0.36",
"description": "基于Babylonjs的3D框架",
"main": "./dist/index.js",
"types": "./types/index.d.ts",
"scripts": {
},
"author": "",
"license": "ISC",
"dependencies": {
"duiba-tc": "git+ssh://git@gitlab2.dui88.com:clq/tc.git#1.0"
}
}
\ No newline at end of file
import { getImgURL } from 'duiba-tc';
export class YtAssetsManager {
private _resourceData;
private _resourceObject:object;
private static instance: YtAssetsManager;
public static get ins(): YtAssetsManager {
if (!this.instance) {
this.instance = new YtAssetsManager();
}
return this.instance;
}
constructor(){
//this._resourceData=ResourceCon.ins.resource;
this._resourceObject={
binarys:{},
images:{},
models:{},
textures:{},
cubeTextures:{}
}
}
public set resourceData(resource){
this._resourceData=resource;
}
public loadFile(sceneNames:Array<string>,scene,callback,progress){
let assetsManager = new BABYLON.AssetsManager(scene);
assetsManager.useDefaultLoadingScreen = false;
sceneNames.forEach(function(sceneName){
//加载模型
var _thisModel={}
this._resourceData[sceneName].models.forEach(function(model){
let meshTask = assetsManager.addMeshTask(
"skull task",
"",
model.filePath,
model.fileName
);
meshTask.onSuccess = function (task) {
console.log("meshTask")
console.log(task)
task.loadedMeshes.forEach(function(mesh){
mesh.isVisible=false;
mesh.name="noneisVisible_"+mesh;
})
let _thisMesh=task;
_thisModel[model.name]=_thisMesh
this._resourceObject.models[sceneName]=_thisModel;
}.bind(this)
}.bind(this))
//加载图片
var _thisImage={}
this._resourceData[sceneName].images.forEach(function(image){
// getImgURL(image.filePath+image.fileName,(url)=>{
let imageTask = assetsManager.addImageTask(
"image task",
image.filePath+image.fileName,
);
imageTask.onSuccess = function (task) {
_thisImage[image.name]=task.image
this._resourceObject.images[sceneName]=_thisImage;
}.bind(this)
// })
}.bind(this))
//加载贴图
var _thisTexture={}
this._resourceData[sceneName].textures.forEach(function(texture){
// getImgURL(texture.filePath+texture.fileName,(url)=>{
let textureTask = assetsManager.addTextureTask(
"texture task",
texture.filePath+texture.fileName,
);
textureTask.onSuccess = function (task) {
_thisTexture[texture.name]=task.texture
this._resourceObject.textures[sceneName]=_thisTexture;
}.bind(this)
// })
}.bind(this))
//加载二进制文件
var _thisBinary={}
this._resourceData[sceneName].binarys.forEach(function(binary){
let binaryTask = assetsManager.addBinaryFileTask(
"binary task",
binary.filePath+binary.fileName,
);
binaryTask.onSuccess = function (task) {
console.log(6666677)
console.log(task.data)
_thisBinary[binary.name]=task.data
_thisBinary[binary.name]["url"]=task.url
this._resourceObject.binarys[sceneName]=_thisBinary;
}.bind(this)
}.bind(this))
//加载天空盒子/环境贴图
var _thisCubeTexture={}
this._resourceData[sceneName].cubeTextures.forEach(function(cubeTexture){
let cubeTextureTask = assetsManager.addCubeTextureTask(
"cubeTexture task",
cubeTexture.filePath+cubeTexture.fileName,
);
cubeTextureTask.onSuccess = function (task) {
_thisCubeTexture[cubeTexture.name]=task.texture
this._resourceObject.cubeTextures[sceneName]=_thisCubeTexture;
}.bind(this)
}.bind(this))
}.bind(this))
assetsManager.load();
//加载成功一个子元素调用
assetsManager.onProgress=function(task) {
var _this={
totalTasksCount:assetsManager._totalTasksCount,
waitingTasksCount:assetsManager._waitingTasksCount,
loadCount:(assetsManager._totalTasksCount-assetsManager._waitingTasksCount)/assetsManager._totalTasksCount
}
progress(_this)
}.bind(this);
//全部加载成功调用
assetsManager.onFinish=function(task) {
callback()
}.bind(this);
}
public get resourceObject(){
return this._resourceObject;
}
}
\ No newline at end of file
"use strict"; "use strict";
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
var duiba_tc_1 = require("duiba-tc");
var YtAssetsManager = /** @class */ (function () { var YtAssetsManager = /** @class */ (function () {
function YtAssetsManager() { function YtAssetsManager() {
//this._resourceData=ResourceCon.ins.resource; //this._resourceData=ResourceCon.ins.resource;
...@@ -52,26 +51,24 @@ var YtAssetsManager = /** @class */ (function () { ...@@ -52,26 +51,24 @@ var YtAssetsManager = /** @class */ (function () {
//加载图片 //加载图片
var _thisImage = {}; var _thisImage = {};
this._resourceData[sceneName].images.forEach(function (image) { this._resourceData[sceneName].images.forEach(function (image) {
var _this = this; // getImgURL(image.filePath+image.fileName,(url)=>{
duiba_tc_1.getImgURL(image.filePath + image.fileName, function (url) { var imageTask = assetsManager.addImageTask("image task", image.filePath + image.fileName);
var imageTask = assetsManager.addImageTask("image task", url); imageTask.onSuccess = function (task) {
imageTask.onSuccess = function (task) { _thisImage[image.name] = task.image;
_thisImage[image.name] = task.image; this._resourceObject.images[sceneName] = _thisImage;
this._resourceObject.images[sceneName] = _thisImage; }.bind(this);
}.bind(_this); // })
});
}.bind(this)); }.bind(this));
//加载贴图 //加载贴图
var _thisTexture = {}; var _thisTexture = {};
this._resourceData[sceneName].textures.forEach(function (texture) { this._resourceData[sceneName].textures.forEach(function (texture) {
var _this = this; // getImgURL(texture.filePath+texture.fileName,(url)=>{
duiba_tc_1.getImgURL(texture.filePath + texture.fileName, function (url) { var textureTask = assetsManager.addTextureTask("texture task", texture.filePath + texture.fileName);
var textureTask = assetsManager.addTextureTask("texture task", url); textureTask.onSuccess = function (task) {
textureTask.onSuccess = function (task) { _thisTexture[texture.name] = task.texture;
_thisTexture[texture.name] = task.texture; this._resourceObject.textures[sceneName] = _thisTexture;
this._resourceObject.textures[sceneName] = _thisTexture; }.bind(this);
}.bind(_this); // })
});
}.bind(this)); }.bind(this));
//加载二进制文件 //加载二进制文件
var _thisBinary = {}; var _thisBinary = {};
......
{"version":3,"file":"YtAssetsManager.js","sourceRoot":"","sources":["../../src/manager/YtAssetsManager.ts"],"names":[],"mappings":";;AAAA,qCAAqC;AACrC;IAcI;QACI,8CAA8C;QAC9C,IAAI,CAAC,eAAe,GAAC;YACjB,OAAO,EAAC,EAAE;YACV,MAAM,EAAC,EAAE;YACT,MAAM,EAAC,EAAE;YACT,QAAQ,EAAC,EAAE;YACX,YAAY,EAAC,EAAE;SAClB,CAAA;IACL,CAAC;IAhBD,sBAAkB,sBAAG;aAArB;Y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C,SAAS,CAAC,GAAC,gBAAgB,CAAC;gBAClE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;YAChB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;QAEjB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;QAEb,aAAa,CAAC,IAAI,EAAE,CAAC;QAGrB,aAAa;QACb,aAAa,CAAC,UAAU,GAAC,UAAS,IAAI;YAClC,IAAI,KAAK,GAAC;gBACN,eAAe,EAAC,aAAa,CAAC,gBAAgB;gBAC9C,iBAAiB,EAAC,aAAa,CAAC,kBAAkB;gBAClD,SAAS,EAAC,CAAC,aAAa,CAAC,gBAAgB,GAAC,aAAa,CAAC,kBAAkB,CAAC,GAAC,aAAa,CAAC,gBAAgB;aAC7G,CAAA;YACD,QAAQ,CAAC,KAAK,CAAC,CAAA;QAEnB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAEb,UAAU;QACV,aAAa,CAAC,QAAQ,GAAC,UAAS,IAAI;YAChC,QAAQ,EAAE,CAAA;QACd,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAEjB,CAAC;IAED,sBAAW,2CAAc;aAAzB;YACI,OAAO,IAAI,CAAC,eAAe,CAAC;QAChC,CAAC;;;OAAA;IAEL,sBAAC;AAAD,CAAC,AAtJD,IAsJC;AAtJY,0CAAe"}
\ No newline at end of file \ No newline at end of file
{ {
"name": "yt", "name": "yt",
"version": "1.0.35", "version": "1.0.36",
"description": "基于Babylonjs的3D框架", "description": "基于Babylonjs的3D框架",
"main": "./dist/index.js", "main": "./dist/index.js",
"types": "./types/index.d.ts", "types": "./types/index.d.ts",
......
...@@ -61,16 +61,16 @@ export class YtAssetsManager { ...@@ -61,16 +61,16 @@ export class YtAssetsManager {
//加载图片 //加载图片
var _thisImage={} var _thisImage={}
this._resourceData[sceneName].images.forEach(function(image){ this._resourceData[sceneName].images.forEach(function(image){
getImgURL(image.filePath+image.fileName,(url)=>{ // getImgURL(image.filePath+image.fileName,(url)=>{
let imageTask = assetsManager.addImageTask( let imageTask = assetsManager.addImageTask(
"image task", "image task",
url, image.filePath+image.fileName,
); );
imageTask.onSuccess = function (task) { imageTask.onSuccess = function (task) {
_thisImage[image.name]=task.image _thisImage[image.name]=task.image
this._resourceObject.images[sceneName]=_thisImage; this._resourceObject.images[sceneName]=_thisImage;
}.bind(this) }.bind(this)
}) // })
}.bind(this)) }.bind(this))
...@@ -79,16 +79,16 @@ export class YtAssetsManager { ...@@ -79,16 +79,16 @@ export class YtAssetsManager {
//加载贴图 //加载贴图
var _thisTexture={} var _thisTexture={}
this._resourceData[sceneName].textures.forEach(function(texture){ this._resourceData[sceneName].textures.forEach(function(texture){
getImgURL(texture.filePath+texture.fileName,(url)=>{ // getImgURL(texture.filePath+texture.fileName,(url)=>{
let textureTask = assetsManager.addTextureTask( let textureTask = assetsManager.addTextureTask(
"texture task", "texture task",
url, texture.filePath+texture.fileName,
); );
textureTask.onSuccess = function (task) { textureTask.onSuccess = function (task) {
_thisTexture[texture.name]=task.texture _thisTexture[texture.name]=task.texture
this._resourceObject.textures[sceneName]=_thisTexture; this._resourceObject.textures[sceneName]=_thisTexture;
}.bind(this) }.bind(this)
}) // })
}.bind(this)) }.bind(this))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment