Commit 8ffe35a0 authored by wjf's avatar wjf

2.0.39

parent ca623d15
declare namespace FYGE{export const VERSION = "2.0.38";
declare namespace FYGE{export const VERSION = "2.0.39";
export const osType: "ios" | "android" | "pc";
......@@ -4283,6 +4283,8 @@ export class CanvasRenderer extends SystemRenderer {
destroyPlugins(): void;
}
export function toDisplayDataURL(obj: DisplayObject, rect?: Rectangle, typeInfo?: any, bgColor?: number): string;
export function uid(): number;
export function getBackupCanvasCtx(): CanvasRenderingContext2D;
......@@ -4309,27 +4311,10 @@ export const TextureCache: any;
export const BaseTextureCache: any;
export const TextureSheetCache: any;
export function destroyTextureCache(): void;
export function clearTextureCache(): void;
export const GlobalPro: {
/**
* 舞台渲染类型,
*/
stageRenderType: typeof RENDERER_TYPE;
/**
* 实际渲染分辨率
*/
dpi: number;
/**
* 图集间隙
*/
padding: number;
}
export function isWebGLSupported(): boolean;
export function removeItems(arr: Array<any>, startIdx: number, removeCount: number): void;
......@@ -8901,6 +8886,12 @@ export const getBezierEasing: (a: any, b: any, c: any, d: any, nm?: any) => any
export function buildBezierProp(pt1: any, pt2: any, pt3: any, pt4: any, startIndex: any, endIndex: any, time: any, fnc: any): any[];
export class Lottie extends AnimationNode {
/**
* 是否使用Graphics矢量作为遮罩,默认false不使用,即使用Shape
* 使用Shape时在webgl模式下会新建一张离屏canvas,增加内存
* 有内存要求时可尝试设置为true,
*/
static useGraphicsMask: boolean;
/**
* 原始数据,尽量只获取,不修改
*/
......
This diff is collapsed.
This diff is collapsed.
export const VERSION = "2.0.38";
export const VERSION = "2.0.39";
export const osType: "ios" | "android" | "pc";
......@@ -4283,6 +4283,8 @@ export class CanvasRenderer extends SystemRenderer {
destroyPlugins(): void;
}
export function toDisplayDataURL(obj: DisplayObject, rect?: Rectangle, typeInfo?: any, bgColor?: number): string;
export function uid(): number;
export function getBackupCanvasCtx(): CanvasRenderingContext2D;
......@@ -4309,27 +4311,10 @@ export const TextureCache: any;
export const BaseTextureCache: any;
export const TextureSheetCache: any;
export function destroyTextureCache(): void;
export function clearTextureCache(): void;
export const GlobalPro: {
/**
* 舞台渲染类型,
*/
stageRenderType: typeof RENDERER_TYPE;
/**
* 实际渲染分辨率
*/
dpi: number;
/**
* 图集间隙
*/
padding: number;
}
export function isWebGLSupported(): boolean;
export function removeItems(arr: Array<any>, startIdx: number, removeCount: number): void;
......@@ -8901,6 +8886,12 @@ export const getBezierEasing: (a: any, b: any, c: any, d: any, nm?: any) => any
export function buildBezierProp(pt1: any, pt2: any, pt3: any, pt4: any, startIndex: any, endIndex: any, time: any, fnc: any): any[];
export class Lottie extends AnimationNode {
/**
* 是否使用Graphics矢量作为遮罩,默认false不使用,即使用Shape
* 使用Shape时在webgl模式下会新建一张离屏canvas,增加内存
* 有内存要求时可尝试设置为true,
*/
static useGraphicsMask: boolean;
/**
* 原始数据,尽量只获取,不修改
*/
......
{
"name": "fyge",
"version": "2.0.38",
"version": "2.0.39",
"description": "canvas渲染引擎",
"main": "./build/fyge.min.js",
"types": "./build/types.d.ts",
......
......@@ -441,6 +441,14 @@
TextField的updateText方法,把s._text += ""提到s._text判断前,为了赋值的0
3d的index添加导出OrthographicCamera
2.0.39 Lottie添加静态属性useGraphicsMask,为了createLottieMask函数可以判断用Graphics或Shape
utils里toDisplayDataURL修改导出方式,注释TextureSheetCache和GlobalPro
toDisplayDataURL文件修改toDisplayDataURL导出方式,不用default
D3Renderer的flush方法里mat.map和mat.envMap添加判断valid
getCusShader的useMap和useEnvMap添加判断valid
外层canvas标签的transform数据在获取鼠标坐标时并未考虑,比如旋转
......@@ -463,6 +471,8 @@
lottie的tm字段时啥
lottie的rx ry rz or
深度检测加透明度混合流程,
开启深度检测,gl.enable(gl.DEPTH_TEST)
绘制所有非透明对象,
......
......@@ -7,7 +7,7 @@
* @name VERSION
* @type {string}
*/
export const VERSION = "2.0.38";
export const VERSION = "2.0.39";
/**
......
......@@ -6,10 +6,16 @@ import { BaseTexture, Texture } from "../texture";
import { getBezierEasing } from "./forLottie/BezierEaser"
import { buildBezierProp } from "./forLottie/buildBezierProp";
import { createImage, TextureCache } from "../utils";
import { Shape } from "../graphics";
import { Shape, Graphics } from "../graphics";
import { AnimationNode } from "./AnimationNode";
export class Lottie extends AnimationNode {
/**
* 是否使用Graphics矢量作为遮罩,默认false不使用,即使用Shape
* 使用Shape时在webgl模式下会新建一张离屏canvas,增加内存
* 有内存要求时可尝试设置为true,
*/
static useGraphicsMask: boolean = false;
/**
* 原始数据,尽量只获取,不修改
*/
......@@ -711,8 +717,8 @@ function createLottieTracks(
* @param h
* @returns
*/
function createLottieMask(masksProperties: ILottieMaskData[], w: number, h: number): Shape {
var mask = new Shape();
function createLottieMask(masksProperties: ILottieMaskData[], w: number, h: number): Graphics | Shape {
var mask = Lottie.useGraphicsMask ? new Graphics() : new Shape();
mask.beginFill();
masksProperties.forEach((m) => {
if (m.mode !== 'n') {
......
......@@ -7,7 +7,7 @@ import { RENDERER_TYPE } from "../const";
import { createCanvas, getEnv } from "./tbminiAdapte";
export * from './twiddle';
export { default as toDisplayDataURL } from "./toDisplayDataURL";
export * from "./toDisplayDataURL";
// export * from "./getTintedTexture";//外部用不到
// export * from "./mapWebGLBlendModes";//只在webglState里使用一次,外部用不到
......@@ -206,7 +206,7 @@ export const BaseTextureCache = Object.create(null);
/**
* 记录TextureSheet,便于帧动画贴图数据查找,暂时不用
*/
export const TextureSheetCache = Object.create(null);
// export const TextureSheetCache = Object.create(null);
/**
* 销毁所有缓存的纹理和基础纹理
......@@ -242,20 +242,20 @@ export function clearTextureCache() {
* 用于记录引擎全局属性记录,暂时没用到,考虑废弃
* 除了引擎内部修改赋值,外部仅供读取
*/
export const GlobalPro = {
/**
* 舞台渲染类型,
*/
stageRenderType: RENDERER_TYPE,
/**
* 实际渲染分辨率
*/
dpi: 1,
/**
* 图集间隙
*/
padding: 2,
}
// export const GlobalPro = {
// /**
// * 舞台渲染类型,
// */
// stageRenderType: RENDERER_TYPE,
// /**
// * 实际渲染分辨率
// */
// dpi: 1,
// /**
// * 图集间隙
// */
// padding: 2,
// }
let webglSupported: boolean;
/**
......
......@@ -5,13 +5,13 @@ import { DisplayObject } from "../display/DisplayObject";
import { createCanvas } from "./tbminiAdapte";
// 作为将显示对象导出成图片的render渲染器
// 作为将显示对象导出成图片的render渲染器,所以无法截取3d场景,3d场景暂时自己处理显隐裁切,用toDataURL获取,以后考虑改成WebglRenderer
let _dRender: CanvasRenderer = null;
let _dCanvas
let tempMatrix = new Matrix()
/**
* 将显示对象转成base64的图片数据
* 小程序上有问题,尽量不用,矢量图的canvas绘制被删了
* 淘宝小程序上有问题,不用,canvas的toDataURL被删了
* @method toDisplayDataURL
* @static
* @param {DisplayObject} obj 显示对象
......@@ -26,13 +26,12 @@ let tempMatrix = new Matrix()
* width: 441,
* height: 694
* }, {
* type: "jpeg"//数据类型jpg/png
* type: "jpeg"//数据类型jpeg/png
* quality: 90//图片质量值1-100,png格式不需要设置quality
* }, '#CDDBEB');
* }, 0xffffff);
*
* Tip:在一些需要上传图片,编辑图片,需要提交图片数据,分享作品又或者长按保存作品的项目,运用toDisplayDataURL方法把显示对象base64就是最好不过的选择了。
*/
export default function toDisplayDataURL(
export function toDisplayDataURL(
obj: DisplayObject,
rect: Rectangle = null,
typeInfo/*: { type: "png" | "jpeg", quality?: number }*/ = null,
......
......@@ -213,7 +213,7 @@ export class D3Renderer extends ObjectRenderer {
}
}
//是否带贴图,贴图考虑下图集,也就是texture的uv是否是01
if (mat.map) {
if (mat.map && mat.map.valid) {
let map = mat.map;
//找纹理,绑定纹理,多个纹理也是一样的方法
uniforms["uMap"] = textureManager.bindTexture(map, undefined, false);
......@@ -225,7 +225,7 @@ export class D3Renderer extends ObjectRenderer {
uniforms["uUvTransform"] = map.transform.mapCoord.toArray(true);
}
//是否带环境贴图
if (mat.envMap) {//环境贴图先不考虑图集的情况,一般一张大jpg
if (mat.envMap && mat.envMap.valid) {//环境贴图先不考虑图集的情况,一般一张大jpg
//找纹理,绑定纹理,多个纹理也是一样的方法
uniforms["uEnvMap"] = textureManager.bindTexture(mat.envMap, undefined, false);;
//反射率
......
......@@ -37,8 +37,8 @@ export function getCusShader(
lightAffect: material._lightAffect,
useMap: !!material.map,
useEnvMap: !!material.envMap,
useMap: !!material.map && material.map.valid,
useEnvMap: !!material.envMap && material.envMap.valid,
combine: material.combine,
useVertexColor: !!material.useVertexColor,
......
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