@oasis-engine/ark
Advanced tools
Comparing version 0.8.0-beta.1 to 0.8.0-beta.2
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('oasis-engine')) : | ||
typeof define === 'function' && define.amd ? define(['exports', 'oasis-engine'], factory) : | ||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.oasisArk = {}, global.oasisEngine)); | ||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@oasisEngine/ark"] = {}, global.oasisEngine)); | ||
})(this, (function (exports, oasisEngine) { 'use strict'; | ||
@@ -138,4 +138,9 @@ | ||
var originalBackgroundMode = this.scene.background.mode; | ||
this.scene.background.mode = oasisEngine.BackgroundMode.SolidColor; | ||
this._uvCamera.render(); | ||
this.scene.background.mode = originalBackgroundMode; | ||
this._parent.removeChild(this.entity); | ||
@@ -161,10 +166,13 @@ } | ||
var BASEANIMATION = "Bip001|Take 001|BaseLayer"; | ||
var ArkComponent = /*#__PURE__*/function (_Component) { | ||
_inheritsLoose(ArkComponent, _Component); | ||
function ArkComponent(entity) { | ||
function ArkComponent() { | ||
var _this; | ||
_this = _Component.call(this, entity) || this; | ||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
_this = _Component.call.apply(_Component, [this].concat(args)) || this; | ||
_this.group = ""; | ||
@@ -185,6 +193,6 @@ _this.subGroup = ""; | ||
_this._eyebrowUrl = void 0; | ||
_this._extra = void 0; | ||
_this._beardUrl = void 0; | ||
_this._clothUrl = void 0; | ||
_this._blendShapes = void 0; | ||
_this._extra = void 0; | ||
_this._modelEntity = void 0; | ||
@@ -202,12 +210,10 @@ _this._hairEntity = void 0; | ||
_this._bsRenderers = void 0; | ||
var mapping = entity.createChild("uvMapping"); | ||
_this._uvMapping = mapping.addComponent(UVMapping); | ||
return _this; | ||
} // @todo temp solution | ||
} | ||
var _proto = ArkComponent.prototype; | ||
// @todo temp solution | ||
_proto.updateAnimation = function updateAnimation(speed, offset) { | ||
this.animator.play(BASEANIMATION, undefined, offset); | ||
this.animator.play(this._animationClips[0].name, undefined, offset); | ||
this.animator.speed = 1; | ||
@@ -285,2 +291,26 @@ this.engine.update(); | ||
/** | ||
* Get certain assets in project | ||
* @param avatar - arkComponent. | ||
* @param category - assets category. | ||
* @param type - assets type. | ||
* @returns assets list. | ||
*/ | ||
; | ||
_proto.getAssets = function getAssets(avatar, category, type) { | ||
var _this$_extra$type, _this$_extra$custom, _this$_extra$default; | ||
if (!this._extra) { | ||
return []; | ||
} | ||
var allList = type ? (_this$_extra$type = this._extra[type]) === null || _this$_extra$type === void 0 ? void 0 : _this$_extra$type[category] : (((_this$_extra$custom = this._extra.custom) === null || _this$_extra$custom === void 0 ? void 0 : _this$_extra$custom[category]) || []).concat(((_this$_extra$default = this._extra.default) === null || _this$_extra$default === void 0 ? void 0 : _this$_extra$default[category]) || []); | ||
var list = allList.filter(function (item) { | ||
return item.parent.find(function (ca) { | ||
return [avatar.asset, avatar.subGroup, avatar.group].includes(ca.name); | ||
}); | ||
}); | ||
return list; | ||
} | ||
/** | ||
* Replace 3D Model by glTF url. | ||
@@ -345,2 +375,3 @@ * @param url - The url of 3D glTF file. | ||
this._setBeardPromise = this._setModelPromise.then( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() { | ||
var mapping; | ||
return regeneratorRuntime.wrap(function _callee2$(_context2) { | ||
@@ -359,4 +390,9 @@ while (1) { | ||
case 3: | ||
if (!_this2._uvMapping) { | ||
mapping = _this2.entity.createChild("uvMapping"); | ||
_this2._uvMapping = mapping.addComponent(UVMapping); | ||
} | ||
_this2._uvMapping.originalTexture = _this2._originalFaceTexture; | ||
_context2.next = 6; | ||
_context2.next = 7; | ||
return _this2.engine.resourceManager.load({ | ||
@@ -367,7 +403,7 @@ type: oasisEngine.AssetType.Texture2D, | ||
case 6: | ||
case 7: | ||
_this2._uvMapping.coverTexture = _context2.sent; | ||
_this2._faceMaterial.baseTexture = _this2._uvMapping.colorTexture; | ||
case 8: | ||
case 9: | ||
case "end": | ||
@@ -736,3 +772,3 @@ return _context2.stop(); | ||
animator.speed = 1; | ||
animator.play(BASEANIMATION); | ||
animator.play(animations[0].name); | ||
@@ -926,11 +962,3 @@ case 15: | ||
key: "eyeUrl", | ||
get: // 一级类目 | ||
// 二级类目 | ||
// 具体资产 | ||
// schema | ||
// 项目素材存储 | ||
// replaced entity | ||
// replace texture | ||
// ark api for npm | ||
get: | ||
/** | ||
@@ -937,0 +965,0 @@ * ------------- begin: editor config ------------- |
@@ -1,2 +0,2 @@ | ||
import { Shader, Layer, Camera, PrimitiveMesh, MeshRenderer, BaseMaterial, Texture2D, RenderTarget, Component, Logger, AssetType, AnimatorController, AnimatorControllerLayer, AnimatorStateMachine, Animator, SkinnedMeshRenderer } from 'oasis-engine'; | ||
import { Shader, Layer, Camera, PrimitiveMesh, MeshRenderer, BaseMaterial, BackgroundMode, Texture2D, RenderTarget, Component, Logger, AssetType, AnimatorController, AnimatorControllerLayer, AnimatorStateMachine, Animator, SkinnedMeshRenderer } from 'oasis-engine'; | ||
@@ -134,4 +134,9 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { | ||
var originalBackgroundMode = this.scene.background.mode; | ||
this.scene.background.mode = BackgroundMode.SolidColor; | ||
this._uvCamera.render(); | ||
this.scene.background.mode = originalBackgroundMode; | ||
this._parent.removeChild(this.entity); | ||
@@ -157,10 +162,13 @@ } | ||
var BASEANIMATION = "Bip001|Take 001|BaseLayer"; | ||
var ArkComponent = /*#__PURE__*/function (_Component) { | ||
_inheritsLoose(ArkComponent, _Component); | ||
function ArkComponent(entity) { | ||
function ArkComponent() { | ||
var _this; | ||
_this = _Component.call(this, entity) || this; | ||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
_this = _Component.call.apply(_Component, [this].concat(args)) || this; | ||
_this.group = ""; | ||
@@ -181,6 +189,6 @@ _this.subGroup = ""; | ||
_this._eyebrowUrl = void 0; | ||
_this._extra = void 0; | ||
_this._beardUrl = void 0; | ||
_this._clothUrl = void 0; | ||
_this._blendShapes = void 0; | ||
_this._extra = void 0; | ||
_this._modelEntity = void 0; | ||
@@ -198,12 +206,10 @@ _this._hairEntity = void 0; | ||
_this._bsRenderers = void 0; | ||
var mapping = entity.createChild("uvMapping"); | ||
_this._uvMapping = mapping.addComponent(UVMapping); | ||
return _this; | ||
} // @todo temp solution | ||
} | ||
var _proto = ArkComponent.prototype; | ||
// @todo temp solution | ||
_proto.updateAnimation = function updateAnimation(speed, offset) { | ||
this.animator.play(BASEANIMATION, undefined, offset); | ||
this.animator.play(this._animationClips[0].name, undefined, offset); | ||
this.animator.speed = 1; | ||
@@ -281,2 +287,26 @@ this.engine.update(); | ||
/** | ||
* Get certain assets in project | ||
* @param avatar - arkComponent. | ||
* @param category - assets category. | ||
* @param type - assets type. | ||
* @returns assets list. | ||
*/ | ||
; | ||
_proto.getAssets = function getAssets(avatar, category, type) { | ||
var _this$_extra$type, _this$_extra$custom, _this$_extra$default; | ||
if (!this._extra) { | ||
return []; | ||
} | ||
var allList = type ? (_this$_extra$type = this._extra[type]) === null || _this$_extra$type === void 0 ? void 0 : _this$_extra$type[category] : (((_this$_extra$custom = this._extra.custom) === null || _this$_extra$custom === void 0 ? void 0 : _this$_extra$custom[category]) || []).concat(((_this$_extra$default = this._extra.default) === null || _this$_extra$default === void 0 ? void 0 : _this$_extra$default[category]) || []); | ||
var list = allList.filter(function (item) { | ||
return item.parent.find(function (ca) { | ||
return [avatar.asset, avatar.subGroup, avatar.group].includes(ca.name); | ||
}); | ||
}); | ||
return list; | ||
} | ||
/** | ||
* Replace 3D Model by glTF url. | ||
@@ -341,2 +371,3 @@ * @param url - The url of 3D glTF file. | ||
this._setBeardPromise = this._setModelPromise.then( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() { | ||
var mapping; | ||
return regeneratorRuntime.wrap(function _callee2$(_context2) { | ||
@@ -355,4 +386,9 @@ while (1) { | ||
case 3: | ||
if (!_this2._uvMapping) { | ||
mapping = _this2.entity.createChild("uvMapping"); | ||
_this2._uvMapping = mapping.addComponent(UVMapping); | ||
} | ||
_this2._uvMapping.originalTexture = _this2._originalFaceTexture; | ||
_context2.next = 6; | ||
_context2.next = 7; | ||
return _this2.engine.resourceManager.load({ | ||
@@ -363,7 +399,7 @@ type: AssetType.Texture2D, | ||
case 6: | ||
case 7: | ||
_this2._uvMapping.coverTexture = _context2.sent; | ||
_this2._faceMaterial.baseTexture = _this2._uvMapping.colorTexture; | ||
case 8: | ||
case 9: | ||
case "end": | ||
@@ -732,3 +768,3 @@ return _context2.stop(); | ||
animator.speed = 1; | ||
animator.play(BASEANIMATION); | ||
animator.play(animations[0].name); | ||
@@ -922,11 +958,3 @@ case 15: | ||
key: "eyeUrl", | ||
get: // 一级类目 | ||
// 二级类目 | ||
// 具体资产 | ||
// schema | ||
// 项目素材存储 | ||
// replaced entity | ||
// replace texture | ||
// ark api for npm | ||
get: | ||
/** | ||
@@ -933,0 +961,0 @@ * ------------- begin: editor config ------------- |
@@ -138,4 +138,9 @@ 'use strict'; | ||
var originalBackgroundMode = this.scene.background.mode; | ||
this.scene.background.mode = miniprogram.BackgroundMode.SolidColor; | ||
this._uvCamera.render(); | ||
this.scene.background.mode = originalBackgroundMode; | ||
this._parent.removeChild(this.entity); | ||
@@ -161,10 +166,13 @@ } | ||
var BASEANIMATION = "Bip001|Take 001|BaseLayer"; | ||
var ArkComponent = /*#__PURE__*/function (_Component) { | ||
_inheritsLoose(ArkComponent, _Component); | ||
function ArkComponent(entity) { | ||
function ArkComponent() { | ||
var _this; | ||
_this = _Component.call(this, entity) || this; | ||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
_this = _Component.call.apply(_Component, [this].concat(args)) || this; | ||
_this.group = ""; | ||
@@ -185,6 +193,6 @@ _this.subGroup = ""; | ||
_this._eyebrowUrl = void 0; | ||
_this._extra = void 0; | ||
_this._beardUrl = void 0; | ||
_this._clothUrl = void 0; | ||
_this._blendShapes = void 0; | ||
_this._extra = void 0; | ||
_this._modelEntity = void 0; | ||
@@ -202,12 +210,10 @@ _this._hairEntity = void 0; | ||
_this._bsRenderers = void 0; | ||
var mapping = entity.createChild("uvMapping"); | ||
_this._uvMapping = mapping.addComponent(UVMapping); | ||
return _this; | ||
} // @todo temp solution | ||
} | ||
var _proto = ArkComponent.prototype; | ||
// @todo temp solution | ||
_proto.updateAnimation = function updateAnimation(speed, offset) { | ||
this.animator.play(BASEANIMATION, undefined, offset); | ||
this.animator.play(this._animationClips[0].name, undefined, offset); | ||
this.animator.speed = 1; | ||
@@ -285,2 +291,26 @@ this.engine.update(); | ||
/** | ||
* Get certain assets in project | ||
* @param avatar - arkComponent. | ||
* @param category - assets category. | ||
* @param type - assets type. | ||
* @returns assets list. | ||
*/ | ||
; | ||
_proto.getAssets = function getAssets(avatar, category, type) { | ||
var _this$_extra$type, _this$_extra$custom, _this$_extra$default; | ||
if (!this._extra) { | ||
return []; | ||
} | ||
var allList = type ? (_this$_extra$type = this._extra[type]) === null || _this$_extra$type === void 0 ? void 0 : _this$_extra$type[category] : (((_this$_extra$custom = this._extra.custom) === null || _this$_extra$custom === void 0 ? void 0 : _this$_extra$custom[category]) || []).concat(((_this$_extra$default = this._extra.default) === null || _this$_extra$default === void 0 ? void 0 : _this$_extra$default[category]) || []); | ||
var list = allList.filter(function (item) { | ||
return item.parent.find(function (ca) { | ||
return [avatar.asset, avatar.subGroup, avatar.group].includes(ca.name); | ||
}); | ||
}); | ||
return list; | ||
} | ||
/** | ||
* Replace 3D Model by glTF url. | ||
@@ -345,2 +375,3 @@ * @param url - The url of 3D glTF file. | ||
this._setBeardPromise = this._setModelPromise.then( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() { | ||
var mapping; | ||
return regeneratorRuntime.wrap(function _callee2$(_context2) { | ||
@@ -359,4 +390,9 @@ while (1) { | ||
case 3: | ||
if (!_this2._uvMapping) { | ||
mapping = _this2.entity.createChild("uvMapping"); | ||
_this2._uvMapping = mapping.addComponent(UVMapping); | ||
} | ||
_this2._uvMapping.originalTexture = _this2._originalFaceTexture; | ||
_context2.next = 6; | ||
_context2.next = 7; | ||
return _this2.engine.resourceManager.load({ | ||
@@ -367,7 +403,7 @@ type: miniprogram.AssetType.Texture2D, | ||
case 6: | ||
case 7: | ||
_this2._uvMapping.coverTexture = _context2.sent; | ||
_this2._faceMaterial.baseTexture = _this2._uvMapping.colorTexture; | ||
case 8: | ||
case 9: | ||
case "end": | ||
@@ -736,3 +772,3 @@ return _context2.stop(); | ||
animator.speed = 1; | ||
animator.play(BASEANIMATION); | ||
animator.play(animations[0].name); | ||
@@ -926,11 +962,3 @@ case 15: | ||
key: "eyeUrl", | ||
get: // 一级类目 | ||
// 二级类目 | ||
// 具体资产 | ||
// schema | ||
// 项目素材存储 | ||
// replaced entity | ||
// replace texture | ||
// ark api for npm | ||
get: | ||
/** | ||
@@ -937,0 +965,0 @@ * ------------- begin: editor config ------------- |
{ | ||
"version": "0.8.0-beta.1", | ||
"version": "0.8.0-beta.2", | ||
"name": "@oasis-engine/ark", | ||
@@ -4,0 +4,0 @@ "browser": "dist/index.browser.js", |
@@ -1,2 +0,2 @@ | ||
import { Animator, Component, Entity } from "oasis-engine"; | ||
import { Animator, Component } from "oasis-engine"; | ||
export declare class ArkComponent extends Component { | ||
@@ -18,6 +18,6 @@ group: string; | ||
private _eyebrowUrl; | ||
private _extra; | ||
private _beardUrl; | ||
private _clothUrl; | ||
private _blendShapes; | ||
private _extra; | ||
private _modelEntity; | ||
@@ -79,3 +79,2 @@ private _hairEntity; | ||
get onReady(): Promise<void[]>; | ||
constructor(entity: Entity); | ||
updateAnimation(speed: number, offset: number): void; | ||
@@ -99,2 +98,13 @@ /** | ||
/** | ||
* Get certain assets in project | ||
* @param avatar - arkComponent. | ||
* @param category - assets category. | ||
* @param type - assets type. | ||
* @returns assets list. | ||
*/ | ||
getAssets(avatar: ArkComponent, category: string, type?: "custom" | "default"): Array<{ | ||
file: string; | ||
name: string; | ||
}>; | ||
/** | ||
* Replace 3D Model by glTF url. | ||
@@ -101,0 +111,0 @@ * @param url - The url of 3D glTF file. |
120399
3110