Commit 275ce6c5 authored by wangjianfeng.yz's avatar wangjianfeng.yz

2.0.58

parent 12622652
declare namespace FYGE{export const VERSION = "2.0.57";
declare namespace FYGE{export const VERSION = "2.0.58";
export function cos(angle: number): number;
......@@ -1048,12 +1048,8 @@ export function createCanvas(): HTMLCanvasElement;
export function initedByTbCanvas(canvas: any): void;
export function initedByCanvas(canvas: any): void;
export function destroyTbCanvas(): void;
export function destroyCanvasContent(): void;
export function createImage(): HTMLImageElement;
export function requestAnimationFrame(callback: any): any;
......@@ -10674,7 +10670,7 @@ export class GLTFParser {
/**
* Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#scenes
* @param {number} sceneIndex
* @return {Promise<THREE.Scene>}
* @return {Promise<Scene3D>}
*/
loadScene: (sceneIndex: any) => any;
}
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
export const VERSION = "2.0.57";
export const VERSION = "2.0.58";
export function cos(angle: number): number;
......@@ -1048,12 +1048,8 @@ export function createCanvas(): HTMLCanvasElement;
export function initedByTbCanvas(canvas: any): void;
export function initedByCanvas(canvas: any): void;
export function destroyTbCanvas(): void;
export function destroyCanvasContent(): void;
export function createImage(): HTMLImageElement;
export function requestAnimationFrame(callback: any): any;
......@@ -10674,7 +10670,7 @@ export class GLTFParser {
/**
* Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#scenes
* @param {number} sceneIndex
* @return {Promise<THREE.Scene>}
* @return {Promise<Scene3D>}
*/
loadScene: (sceneIndex: any) => any;
}
......
{
"name": "fyge",
"version": "2.0.57",
"version": "2.0.58",
"description": "canvas渲染引擎",
"main": "./build/fyge.min.js",
"module": "./build/fyge.esm.js",
......
......@@ -555,10 +555,17 @@
Event删除静态属性CALL_FRAME
其他的都是注释的修改
2.0.58 InputText的initInfo方法font默认从微软雅黑改成Arial
tbminAdpate废弃方法initedByCanvas和destroyCanvasContent
loadSpine废弃原先为了兼容老版本格式的字段spine和skeletonData
其他的都是注释和部分提示信息的修改
D3Renderer文件里的influencesList和attrChannelHash是按照geometry的id缓存的,这样多stage用了一个geometry会有问题
需要一个矢量单独的2d绘制着色器了(顶点,颜色,纹理,),还是直接用统一的,到底哪种性能好,
Graphics,解决几何纹理的问题(图集,重复,变换,canvas绘制等)
......@@ -566,7 +573,7 @@ Graphics,解决几何纹理的问题(图集,重复,变换,canvas绘制
texture的rotate属性设置修改纹理旋转会有大问题。尤其是45度角(groupD8里系数偏大)等,自身包围盒会有问题,且webgl模式下顶点计算有问题导致显示不全和纹理拉伸
在未解决前注释rotate的set方法
Sprite添加像素检测还需从长计议,涉及图集的trim和rotate,还有数据格式的图片不用绘制的方式
//Sprite添加像素检测还需从长计议,涉及图集的trim和rotate,还有数据格式的图片不用绘制的方式
使用多纹理通道时需要着色器做if判断,所以性能会变差,但是使用单通道在有多纹理时需要断批一样影响性能,具体权衡暂时不改
......
......@@ -7,7 +7,7 @@
* @name VERSION
* @type {string}
*/
export const VERSION = "2.0.57";
export const VERSION = "2.0.58";
/**
......
......@@ -613,7 +613,7 @@ export default class Sprite extends Container {
const texture = TextureCache[frameId];
if (!texture) {
// throw new Error(`The frameId "${frameId}" does not exist in the texture cache`);
console.warn("TextureCache中不存在纹理frameId")
console.warn(`TextureCache hasn‘t texture ${frameId}`)
}
return new Sprite(texture);
}
......
......@@ -207,7 +207,7 @@ export class Stage extends Container {
if (!resolution) {//为了兼容以前的活动,以后删了
//以前的活动外部设置了canvas的实际尺寸和显示尺寸
console.warn("尝试设置分辨率,内部会根据分辨率设置画布的实际尺寸");
console.warn("try to send param resolution, canvas‘s width and height will be setted up based on resolution");
//这里设置_dpi
s._dpi = canvas.width / divWidth;
} else {
......@@ -226,13 +226,13 @@ export class Stage extends Container {
// console.log("%c ", "background: url(http://5b0988e595225.cdn.sohucs.com/images/20180315/d41842ad9b5443d3854a480ea49f3b09.gif) no-repeat center;padding-left:80px;padding-bottom: 80px;border-radius:50%;")
//打印个版本号
console.log(
"%cfyge版本:" + VERSION,
"%cfyge version:" + VERSION,
"text-shadow: 0 1px 0 #ccc,0 2px 0 #c9c9c9,0 3px 0 #bbb,0 4px 0 #b9b9b9,0 5px 0 #aaa,0 6px 1px rgba(0,0,0,.1),0 0 5px rgba(0,0,0,.1),0 1px 3px rgba(0,0,0,.3),0 3px 5px rgba(0,0,0,.2),0 5px 10px rgba(0,0,0,.25),0 10px 10px rgba(0,0,0,.2),0 20px 20px rgba(0,0,0,.15);font-size:3em"
)
//webgl不支持时的兼容,回退canvas
if (renderType == RENDERER_TYPE.WEBGL && !isWebGLSupported()) {
renderType = RENDERER_TYPE.CANVAS;
console.warn("不支持webgl")
console.warn("your device doesn‘t support webgl,will use canvas2d instead")
}
if (renderType == RENDERER_TYPE.CANVAS) {
let context = canvas.getContext("2d");
......@@ -370,7 +370,7 @@ export class Stage extends Container {
divHeight = divHeight || document.body.clientHeight;
}
if (!divWidth || !divWidth) {
console.error("传入的显示尺寸不能为空")
console.error("parm divWidth or divHeight cannot be empty")
return
}
let s = this, d = s._dpi, c = s.canvas;
......
......@@ -75,10 +75,10 @@ export class EventDispatcher extends HashObject {
*/
public addEventListener(type: string, listener: Function, context?: any, useCapture: boolean = true): this {
if (!type) {
throw new Error("添加侦听的type值为undefined");
throw new Error("type should not be empty");
}
if (!listener) {
throw new Error("侦听回调函数不能为null");
throw new Error("listener should not be empty");
}
let s = this;
let eventTypes = s.eventTypes;
......@@ -98,7 +98,7 @@ export class EventDispatcher extends HashObject {
for (var i = 0, len = eventTypes[type].length; i < len; i++) {
let ee: EE = eventTypes[type][i]
if (ee.fn === listener && ee.context === context) {
console.log("已添加过该事件")
console.warn("Same listener and context has been added before")
return s
}
}
......@@ -118,10 +118,10 @@ export class EventDispatcher extends HashObject {
*/
public once(type: string, listener: Function, context?: any, useCapture: boolean = true): this {
if (!type) {
throw new Error("添加侦听的type值为undefined");
throw new Error("type should not be empty");
}
if (!listener) {
throw new Error("侦听回调函数不能为null");
throw new Error("listener should not be empty");
}
let s = this;
let eventTypes = s.eventTypes;
......
......@@ -262,7 +262,7 @@ export class Loader extends EventDispatcher {
private cache(name: string, data: any) {
if (this.caches[name]) {
console.log("覆盖原先数据:" + name);
console.log("rewrite orign data:" + name);
}
this.caches[name] = data
}
......
......@@ -10,7 +10,7 @@ import { getOsType } from "../utils";
export class EditableText extends TextField {
htmlElement: HTMLInputElement;
private _prompt: string = "请输入";
private _prompt: string = "Please input";
/**
* 未输入文本时显示的文字
*/
......
......@@ -121,7 +121,7 @@ export class InputText extends FloatDisplay {
let s: InputText = this;
s.htmlElement.placeholder = text;
//font包括字体和大小
s.htmlElement.style.font = size + "px " + (font || "微软雅黑");
s.htmlElement.style.font = size + "px " + (font || "Arial");
s.htmlElement.style.color = color;
s.htmlElement.style.textAlign = align;
/////////////////////设置边框//////////////
......
......@@ -301,7 +301,7 @@ export default class BaseTexture extends EventDispatcher {
if (BaseTextureCache[id]) {
//覆盖
console.warn(`id为${id}的基础纹理已存在,即将覆盖`);
console.warn(`rewrite cached baseTexture: ${id}`);
}
BaseTextureCache[id] = baseTexture;
}
......
......@@ -437,7 +437,7 @@ export default class Texture extends EventDispatcher {
}
if (TextureCache[id]) {
//覆盖
console.warn(`id为${id}的纹理已存在,即将覆盖`);
console.warn(`rewrite cached texture: ${id}`);
}
TextureCache[id] = texture;
}
......
......@@ -147,7 +147,7 @@ export class MovieClip extends Container {
//初始化
if (mv) s.init(mv);
console.warn("MovieClip类即将废弃,建议使用SvgaAni显示类")
console.warn("class MovieClip will be deleted soon,use class SvgaAni instead")
}
/**
......
......@@ -145,7 +145,7 @@ export class SvgaAni extends AnimationNode {
}
}
if (!oriFrames) {
console.warn("未找到" + imageKey + "对应的数据")
console.warn( `no matched data for ${imageKey}`)
return;
}
var frames = SvgaAni.deepCopyFrames(oriFrames, x, y, scaleX, scaleY, rotation, anchorX, anchorY);
......
......@@ -75,11 +75,11 @@ export function initedByTbCanvas(canvas) {
tbCanvas = canvas;
setEnv(EnvType.tb);
}
//兼容老版本,TODO废弃
export function initedByCanvas(canvas) {
console.warn("方法initedByCanvas即将废弃,请使用方法initedByTbCanvas代替")
initedByTbCanvas(canvas)
}
// //兼容老版本,TODO废弃
// export function initedByCanvas(canvas) {
// console.warn("Function initedByCanvas will be abandoned soon,use function initedByTbCanvas instead")
// initedByTbCanvas(canvas)
// }
/**
* 销毁记录的tbCanvas,一般也没必要执行,
* 尤其多页面的淘宝小程序,销毁的话,createImage会有问题
......@@ -87,11 +87,11 @@ export function initedByCanvas(canvas) {
export function destroyTbCanvas() {
tbCanvas = null;
}
//兼容老版本,TODO废弃
export function destroyCanvasContent() {
console.warn("方法destroyCanvasContent即将废弃,请使用方法destroyTbCanvas代替")
destroyTbCanvas();
}
// //兼容老版本,TODO废弃
// export function destroyCanvasContent() {
// console.warn("Function destroyCanvasContent will be abandoned soon,use function destroyTbCanvas instead")
// destroyTbCanvas();
// }
/**
* 返回图片
......@@ -100,7 +100,7 @@ export function destroyCanvasContent() {
export function createImage(): HTMLImageElement {
if (getEnv() == "tb") {
if (tbCanvas) return tbCanvas.createImage();
console.warn("淘宝小程序初始化canvas不存在");
console.warn("TbMini inited canvas does not exist");
}
//当作兼容过Image的
else {
......@@ -116,7 +116,7 @@ export function requestAnimationFrame(callback) {
//淘宝小程序环境
if (getEnv() == "tb") {
if (tbCanvas) return tbCanvas.requestAnimationFrame(callback);
console.warn("淘宝小程序初始化canvas不存在");
console.warn("TbMini inited canvas does not exist");
}
//其他环境,当作兼容过的
else {
......@@ -130,7 +130,7 @@ export function cancelAnimationFrame(id: number) {
tbCanvas.cancelAnimationFrame(id);
return;
}
console.warn("淘宝小程序初始化canvas不存在");
console.warn("TbMini inited canvas does not exist");
}
//其他环境,当作兼容过的
else {
......
......@@ -21,7 +21,7 @@ class BufferAttribute {
public normalized: boolean = false
) {
if (Array.isArray(array)) {
throw new TypeError('array必须士类型化数组');
throw new TypeError('Array should be a Typed Array');
}
this.count = array !== undefined ? array.length / itemSize : 0;
}
......@@ -41,7 +41,7 @@ class BufferAttribute {
*/
setArray(array) {
if (Array.isArray(array)) {
throw new TypeError('array必须是类型化数组');
throw new TypeError('Array should be a Typed Array');
}
this.count = array !== undefined ? array.length / this.itemSize : 0;
this.array = array;
......
......@@ -382,7 +382,7 @@ export class D3Renderer extends ObjectRenderer {
e.buffer.upload(e.data, 0, false/*true*/);//貌似里面有修改的Attribute队列,所以还是绑定下buffer
})
}
//根据材质切换渲染面
//根据材质切换渲染面,TODO,还有着色器也需要处理,法线以及光照正反面
if (mat.side == RenderSideType.DoubleSide) {
this.renderer.state.setCullFace(0)//不开启剔除
} else {
......
......@@ -116,7 +116,7 @@ export class Geometry extends HashObject {
this.boundingBox.makeEmpty();
}
if (isNaN(this.boundingBox.min.x) || isNaN(this.boundingBox.min.y) || isNaN(this.boundingBox.min.z)) console.error("顶点数据有误")
if (isNaN(this.boundingBox.min.x) || isNaN(this.boundingBox.min.y) || isNaN(this.boundingBox.min.z)) console.error("error vertices data")
};
computeBoundingSphere() {
......@@ -142,7 +142,7 @@ export class Geometry extends HashObject {
maxRadiusSq = Math.max(maxRadiusSq, center.distanceToSquared(vector));
}
this.boundingSphere.radius = Math.sqrt(maxRadiusSq);
if (isNaN(this.boundingSphere.radius)) console.error("顶点数据有误")
if (isNaN(this.boundingSphere.radius)) console.error("error vertices data")
}
};
......
......@@ -30,7 +30,7 @@ export class Skeleton3D extends HashObject {
} else {
console.warn('boneInverses长度有误');
console.warn('boneInverses length error');
this.boneInverses = [];
......
......@@ -215,7 +215,7 @@ export function loadGltf(
var json = JSON.parse(content);
// console.log(json)
if (json.asset === undefined || json.asset.version[0] < 2) {
onError && onError("版本格式有问题")
onError && onError("version error")
return;
}
......@@ -354,9 +354,9 @@ function createDefaultMaterial() {
/**
* Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#morph-targets
*
* @param {THREE.BufferGeometry} geometry
* @param {Geometry} geometry
* @param {Array<GLTF.Target>} targets
* @param {Array<THREE.BufferAttribute>} accessors
* @param {Array<BufferAttribute>} accessors
*/
function addMorphTargets(geometry: Geometry, targets, accessors) {
......@@ -501,7 +501,7 @@ function cloneBufferAttribute(attribute) {
}
/**
* @param {THREE.Mesh} mesh
* @param {Mesh3D} mesh
* @param {GLTF.Mesh} meshDef
*/
function updateMorphTargets(mesh, meshDef) {
......@@ -535,7 +535,7 @@ function updateMorphTargets(mesh, meshDef) {
} else {
console.warn('THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.');
console.warn('GLTFLoader: Invalid extras.targetNames length. Ignoring names.');
}
......@@ -918,7 +918,7 @@ class GLTFParser {
if (bufferDef.type && bufferDef.type !== 'arraybuffer') {
throw new Error('THREE.GLTFLoader: ' + bufferDef.type + ' buffer type is not supported.');
throw new Error('GLTFLoader: ' + bufferDef.type + ' buffer type is not supported.');
}
......@@ -951,7 +951,7 @@ class GLTFParser {
return
}
// };
reject("阿三的")
reject()
// loader.load(resolveURL(bufferDef.uri, options.path), resolve, undefined, function () {
// reject(new Error('THREE.GLTFLoader: Failed to load buffer "' + bufferDef.uri + '".'));
......@@ -1098,7 +1098,7 @@ class GLTFParser {
if (itemSize >= 2) bufferAttribute.setY(index, sparseValues[i * itemSize + 1]);
if (itemSize >= 3) bufferAttribute.setZ(index, sparseValues[i * itemSize + 2]);
if (itemSize >= 4) bufferAttribute.setW(index, sparseValues[i * itemSize + 3]);
if (itemSize >= 5) throw new Error('THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.');
if (itemSize >= 5) throw new Error('GLTFLoader: Unsupported itemSize in sparse BufferAttribute.');
}
......@@ -1695,7 +1695,7 @@ class GLTFParser {
// }
else {
throw new Error('THREE.GLTFLoader: Primitive mode unsupported: ' + primitive.mode);
throw new Error('GLTFLoader: Primitive mode unsupported: ' + primitive.mode);
}
......@@ -1898,7 +1898,7 @@ class GLTFParser {
var params = cameraDef[cameraDef.type];
if (!params) {
console.warn('模型相机参数异常');
console.warn('model camera params error');
return;
}
if (cameraDef.type === 'perspective') {
......@@ -2228,7 +2228,7 @@ class GLTFParser {
/**
* Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#scenes
* @param {number} sceneIndex
* @return {Promise<THREE.Scene>}
* @return {Promise<Scene3D>}
*/
loadScene = function () {
......@@ -2348,7 +2348,7 @@ class GLTFParser {
/**
*
* @param {GLTF.Primitive} primitiveDef
* @param {Array<THREE.BufferAttribute>} accessors
* @param {Array<BufferAttribute>} accessors
*/
function addPrimitiveAttributes(primitiveDef, accessors) {
......@@ -2446,11 +2446,11 @@ function GLTFBinaryExtension(data) {
if (this.header.magic !== BINARY_EXTENSION_HEADER_MAGIC) {
throw new Error('THREE.GLTFLoader: Unsupported glTF-Binary header.');
throw new Error('GLTFLoader: Unsupported glTF-Binary header.');
} else if (this.header.version < 2.0) {
throw new Error('THREE.GLTFLoader: Legacy binary file detected. Use LegacyGLTFLoader instead.');
throw new Error('GLTFLoader: Legacy binary file detected. Use LegacyGLTFLoader instead.');
}
......@@ -2484,7 +2484,7 @@ function GLTFBinaryExtension(data) {
}
if (this.content === null) {
throw new Error('THREE.GLTFLoader: JSON content not found.');
throw new Error('GLTFLoader: JSON content not found.');
}
}
......@@ -2583,7 +2583,7 @@ class BufferAttribute {
public normalized: boolean = false
) {
if (Array.isArray(array)) {
throw new TypeError('array必须士类型化数组');
throw new TypeError('Array should be a Typed Array');
}
this.count = array !== undefined ? array.length / itemSize : 0;
}
......@@ -2602,7 +2602,7 @@ class BufferAttribute {
*/
setArray(array) {
if (Array.isArray(array)) {
throw new TypeError('array必须士类型化数组');
throw new TypeError('Array should be a Typed Array');
}
this.count = array !== undefined ? array.length / this.itemSize : 0;
this.array = array;
......@@ -2700,7 +2700,7 @@ class InterleavedBuffer {
if (Array.isArray(array)) {
throw new TypeError('THREE.BufferAttribute: array should be a Typed Array.');
throw new TypeError('Array should be a Typed Array.');
}
......
......@@ -36,7 +36,7 @@ export function loadAtlas(
var textures = createTexturesByAtlas(results[1], results[0])
onLoad && onLoad(textures)
} else {
onError && onError("atlas图集:" + url + "加载失败")
onError && onError("load failed for atlas:" + url)
}
})
......
......@@ -50,21 +50,21 @@ export function parseSpineData(
GlobalLoader.loadImage((s, image) => {
//纹理加上
json.textures = createTexturesByAtlas(BaseTexture.fromImage(image), atlas);
//后续删除
Object.defineProperty(json, 'spine', {
get: function () {
console.warn("loadSpine方法不再返回spine对象,请使用new Spine(spineData)生成实例");
return new Spine(json)
}
})
//后续删除
Object.defineProperty(json, 'skeletonData', {
get: function () {
console.warn("loadSpine方法返回的是整个skeletonData了,不再是json.skeletonData");
console.warn("Spine构造函数直接传loadSpine加载成功的数据就行,不再分开传skeletonData和textures");
return json
}
})
// //后续删除
// Object.defineProperty(json, 'spine', {
// get: function () {
// console.warn("loadSpine方法不再返回spine对象,请使用new Spine(spineData)生成实例");
// return new Spine(json)
// }
// })
// //后续删除
// Object.defineProperty(json, 'skeletonData', {
// get: function () {
// console.warn("loadSpine方法返回的是整个skeletonData了,不再是json.skeletonData");
// console.warn("Spine构造函数直接传loadSpine加载成功的数据就行,不再分开传skeletonData和textures");
// return json
// }
// })
//成功回调
onComplete && onComplete(json);
}, base64String)
......
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