Commit 5a1aa8a3 authored by wjf's avatar wjf

2.0.37

parent 0e283801
declare namespace FYGE{export const VERSION = "2.0.36"; declare namespace FYGE{export const VERSION = "2.0.37";
export const osType: "ios" | "android" | "pc"; export const osType: "ios" | "android" | "pc";
......
This diff is collapsed.
This diff is collapsed.
export const VERSION = "2.0.36"; export const VERSION = "2.0.37";
export const osType: "ios" | "android" | "pc"; export const osType: "ios" | "android" | "pc";
......
{ {
"name": "fyge", "name": "fyge",
"version": "2.0.36", "version": "2.0.37",
"description": "canvas渲染引擎", "description": "canvas渲染引擎",
"main": "./build/fyge.min.js", "main": "./build/fyge.min.js",
"types": "./build/types.d.ts", "types": "./build/types.d.ts",
......
...@@ -433,10 +433,18 @@ ...@@ -433,10 +433,18 @@
Texture.WHITE修改为get方法 Texture.WHITE修改为get方法
GLTFLoader里atob方法兼容atob_base64Decode,同时增加base64的方法 GLTFLoader里atob方法兼容atob_base64Decode,同时增加base64的方法
2.0.37 Graphics的hitTestPointAccuratly方法对于洞的处理进行了修改,且对判断逻辑重新梳理
Lottie文件里的LottieVisibleTrack的setValue方法里的判断改成了前闭后开(否则对于一些序列帧动画会闪,主要后时间判断不能加等号)
tbminiAdapte的createCanvas修改为根据getEnv()判断(因为Texture.WHITE上一版本修改为get方法了),且加了个独立的createTbOffscreenCanvas方法
外层canvas标签的transform数据在获取鼠标坐标时并未考虑,比如旋转
大尺寸纹理首次传gpu使用时会掉帧,越大耗时越多。考虑如何处理(图片解析还是啥)
大尺寸纹理首次传gpu使用时会掉帧,越大耗时越多。考虑如何处理
现在不改,索引数据过大时得用Uint32Array,同时开扩展gl.getExtension( "OES_element_index_uint" )和drawElements改参数类型为gl.UNSIGNED_INT 现在不改,索引数据过大时得用Uint32Array,同时开扩展gl.getExtension( "OES_element_index_uint" )和drawElements改参数类型为gl.UNSIGNED_INT
//现在不改,DisplayObject的getLocalBounds最后是否考虑计算一次updateTransform(不用计算自己的,为了计算子级的) //现在不改,DisplayObject的getLocalBounds最后是否考虑计算一次updateTransform(不用计算自己的,为了计算子级的)
现在不改,D3Renderer里的aSkinIndex传值用了Uint8Array,类型是gl.UNSIGNED_BYTE,估计那个外星头是因为这个 现在不改,D3Renderer里的aSkinIndex传值用了Uint8Array,类型是gl.UNSIGNED_BYTE,估计那个外星头是因为这个
//现在不改,到时loadSpine要改成返回数据(方便创建多个实例) //现在不改,到时loadSpine要改成返回数据(方便创建多个实例)
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* @name VERSION * @name VERSION
* @type {string} * @type {string}
*/ */
export const VERSION = "2.0.36"; export const VERSION = "2.0.37";
/** /**
......
...@@ -1184,21 +1184,26 @@ export default class Graphics extends Container { ...@@ -1184,21 +1184,26 @@ export default class Graphics extends Container {
const graphicsData = this.graphicsData; const graphicsData = this.graphicsData;
for (let i = 0; i < graphicsData.length; ++i) { for (let i = 0; i < graphicsData.length; ++i) {
const data = graphicsData[i]; const data = graphicsData[i];
//只管填充的,不可见就跳过
if (!data.fillStyle.visible && !data.fillStyle.alphaBlock) continue; if (!data.fillStyle.visible && !data.fillStyle.alphaBlock) continue;
// only deal with fills.. //没有shape的跳过
if (data.shape) { if (!data.shape) continue;
if (data.shape.isPointIn(tempPoint)) { //没在shape内的跳过
if (data.holes) { if (!data.shape.isPointIn(tempPoint)) continue;
for (let i = 0; i < data.holes.length; i++) { //没有洞直接返回自身
const hole = data.holes[i].shape; if (!data.holes || !data.holes.length) return s;
if (hole.isPointIn(tempPoint)) { //判断洞
return null; let inHole = false;
} for (let i = 0; i < data.holes.length; i++) {
} const hole = data.holes[i].shape;
} //在任何一个洞内,就跳出循环
return s; if (hole.isPointIn(tempPoint)) {
inHole = true;
break;
} }
} }
//不在洞里可以直接返回自身了
if (!inHole) return s;
} }
return null; return null;
} }
......
...@@ -365,7 +365,8 @@ class LottieVisibleTrack extends HashObject implements IAnimationTrack { ...@@ -365,7 +365,8 @@ class LottieVisibleTrack extends HashObject implements IAnimationTrack {
*/ */
setValue(time: number) { setValue(time: number) {
time -= this.ip; time -= this.ip;
this.obj.visible = this.inTime <= time && this.outTime >= time // this.obj.visible = this.inTime <= time && this.outTime >= time
this.obj.visible = this.inTime <= time && this.outTime > time;//out不能等,否则重合
} }
resetValue() { resetValue() {
this.setValue(0); this.setValue(0);
......
...@@ -72,14 +72,26 @@ export function setEnv(e: "tb" | "web") { ...@@ -72,14 +72,26 @@ export function setEnv(e: "tb" | "web") {
*/ */
export function createCanvas(): HTMLCanvasElement { export function createCanvas(): HTMLCanvasElement {
//@ts-ignore 先这么改把,以后再改TODO,Texture.WHITE有个自执行,所以在setEnv前就会执行web的链路,以后考虑兼容document //@ts-ignore 先这么改把,以后再改TODO,Texture.WHITE有个自执行,所以在setEnv前就会执行web的链路,以后考虑兼容document
return document && document.createElement("canvas") || my._createOffscreenCanvas(); // return document && document.createElement("canvas") || createTbOffscreenCanvas()//my._createOffscreenCanvas();
//web环境 //web环境
if (getEnv() == "web") return document.createElement("canvas"); if (getEnv() == "web") return document.createElement("canvas");
//@ts-ignore //@ts-ignore
if (getEnv() == "tb") return my._createOffscreenCanvas(); if (getEnv() == "tb") return createTbOffscreenCanvas()//my._createOffscreenCanvas();
//提示下 //提示下
console.warn("未知环境,创建canvas失败") console.warn("未知环境,创建canvas失败")
} }
function createTbOffscreenCanvas() {
//@ts-ignore
var tbMy = my;
if (!tbMy) return null;
//不带_的先试试
if (tbMy.createOffscreenCanvas) {
//先试试不加参数是否有返回,再用加参数的,淘宝小部件2.0的好像必须加参数,否则返回空的
return tbMy.createOffscreenCanvas() || tbMy.createOffscreenCanvas(3, 3);
}
//再用带_的
return tbMy._createOffscreenCanvas() || tbMy._createOffscreenCanvas(3, 3);
}
/** /**
* 临时记录的淘宝小程序的主canvas * 临时记录的淘宝小程序的主canvas
*/ */
......
import { BaseMaterial, RenderSideType } from "./BaseMaterial";
import { Texture } from "../../2d/texture";
import { RenderSideType } from "./BaseMaterial";
import { ShaderMaterial, UniformType } from "./ShaderMaterial";
const skyboxVertexShader =
`precision mediump float;
attribute vec3 aPosition;
uniform mat4 uViewMatrix;
uniform mat4 uProjectionMatrix;
uniform mat4 uModelMatrix;
varying vec3 vWorldPosition;
void main() {
vWorldPosition = normalize( ( uModelMatrix * vec4( aPosition, 0.0 ) ).xyz );
gl_Position = uProjectionMatrix* uViewMatrix * uModelMatrix * vec4( vec3( aPosition ), 1.0 );
gl_Position.z = gl_Position.w;
}`;
const skyboxFragmentShader =
`precision mediump float;
varying vec3 vWorldPosition;
uniform sampler2D map;
void main() {
vec2 uv;
//1/PI
uv.y = 0.5 - asin( clamp( vWorldPosition.y, - 1.0, 1.0 ) ) * 0.31830988618;
//1/PI/2
uv.x = atan( vWorldPosition.z, vWorldPosition.x ) * 0.15915494 + 0.5;
gl_FragColor = texture2D( map, uv);
}`;
/** /**
* 天空盒材质,由于暂时用球做天空盒,所以side设置背面,对应的着色器有修改,深度值最大,且相机距离不影响天空盒 * 天空盒材质,由于暂时用球做天空盒,所以side设置背面,对应的着色器有修改,深度值最大,且相机距离不影响天空盒
* 还有问题,再说 * 还有问题,再说
*/ */
export class SkyboxMaterial extends BaseMaterial { export class SkyboxMaterial extends ShaderMaterial {
constructor(parameters?) { constructor() {
super(parameters); super(skyboxVertexShader, skyboxFragmentShader, {
map: { type: UniformType.texture, value: Texture.WHITE },
});
this._instanceType = "SkyboxMaterial"; this._instanceType = "SkyboxMaterial";
this.side = RenderSideType.BackSide; this.side =RenderSideType.BackSide
}
get map() {
return this.uniforms.map.value;
}
set map(v: Texture) {
this.uniforms.map.value = v;
} }
} }
\ No newline at end of file
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