Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
fyge_for_tb
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
王剑峰
fyge_for_tb
Commits
5a1aa8a3
Commit
5a1aa8a3
authored
Sep 10, 2021
by
wjf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
2.0.37
parent
0e283801
Changes
11
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
95 additions
and
28 deletions
+95
-28
FYGE.d.ts
build/FYGE.d.ts
+1
-1
fyge.min.js
build/fyge.min.js
+1
-1
fyge.min.js.map
build/fyge.min.js.map
+1
-1
types.d.ts
build/types.d.ts
+1
-1
package.json
package.json
+1
-1
record.txt
record.txt
+10
-2
const.ts
src/2d/const.ts
+1
-1
Graphics.ts
src/2d/graphics/Graphics.ts
+17
-12
Lottie.ts
src/2d/ui/Lottie.ts
+2
-1
tbminiAdapte.ts
src/2d/utils/tbminiAdapte.ts
+14
-2
SkyboxMaterial.ts
src/3d/materials/SkyboxMaterial.ts
+46
-5
No files found.
build/FYGE.d.ts
View file @
5a1aa8a3
declare
namespace
FYGE
{
export
const
VERSION
=
"2.0.3
6
"
;
declare
namespace
FYGE
{
export
const
VERSION
=
"2.0.3
7
"
;
export
const
osType
:
"ios"
|
"android"
|
"pc"
;
export
const
osType
:
"ios"
|
"android"
|
"pc"
;
...
...
build/fyge.min.js
View file @
5a1aa8a3
This diff is collapsed.
Click to expand it.
build/fyge.min.js.map
View file @
5a1aa8a3
This diff is collapsed.
Click to expand it.
build/types.d.ts
View file @
5a1aa8a3
export
const
VERSION
=
"2.0.3
6
"
;
export
const
VERSION
=
"2.0.3
7
"
;
export
const
osType
:
"ios"
|
"android"
|
"pc"
;
export
const
osType
:
"ios"
|
"android"
|
"pc"
;
...
...
package.json
View file @
5a1aa8a3
{
{
"name"
:
"fyge"
,
"name"
:
"fyge"
,
"version"
:
"2.0.3
6
"
,
"version"
:
"2.0.3
7
"
,
"description"
:
"canvas渲染引擎"
,
"description"
:
"canvas渲染引擎"
,
"main"
:
"./build/fyge.min.js"
,
"main"
:
"./build/fyge.min.js"
,
"types"
:
"./build/types.d.ts"
,
"types"
:
"./build/types.d.ts"
,
...
...
record.txt
View file @
5a1aa8a3
...
@@ -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要改成返回数据(方便创建多个实例)
...
...
src/2d/const.ts
View file @
5a1aa8a3
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
* @name VERSION
* @name VERSION
* @type {string}
* @type {string}
*/
*/
export
const
VERSION
=
"2.0.3
6
"
;
export
const
VERSION
=
"2.0.3
7
"
;
/**
/**
...
...
src/2d/graphics/Graphics.ts
View file @
5a1aa8a3
...
@@ -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
;
}
}
...
...
src/2d/ui/Lottie.ts
View file @
5a1aa8a3
...
@@ -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
);
...
...
src/2d/utils/tbminiAdapte.ts
View file @
5a1aa8a3
...
@@ -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
*/
*/
...
...
src/3d/materials/SkyboxMaterial.ts
View file @
5a1aa8a3
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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment