Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
renderingEngine
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
王剑峰
renderingEngine
Commits
600d7f46
Commit
600d7f46
authored
Nov 07, 2019
by
wjf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
l
parent
b96bf6ce
Changes
17
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
77 additions
and
60 deletions
+77
-60
render.min.js
build/render.min.js
+1
-1
render.min.js.map
build/render.min.js.map
+1
-1
Container.ts
src/2d/display/Container.ts
+9
-9
DisplayObject.ts
src/2d/display/DisplayObject.ts
+8
-8
Stage.ts
src/2d/display/Stage.ts
+16
-13
Loader.ts
src/2d/loader/Loader.ts
+4
-1
CanvasRenderer.ts
src/2d/renderers/CanvasRenderer.ts
+2
-1
WebglRenderer.ts
src/2d/renderers/WebglRenderer.ts
+7
-6
MovieClip.ts
src/2d/svga/MovieClip.ts
+10
-10
index.ts
src/2d/utils/index.ts
+8
-5
Container.d.ts
types/2d/display/Container.d.ts
+1
-1
DisplayObject.d.ts
types/2d/display/DisplayObject.d.ts
+1
-1
Loader.d.ts
types/2d/loader/Loader.d.ts
+4
-1
MovieClip.d.ts
types/2d/svga/MovieClip.d.ts
+1
-1
TextField.d.ts
types/2d/text/TextField.d.ts
+1
-1
index.d.ts
types/2d/utils/index.d.ts
+1
-0
RES.d.ts
types/zeroing/RES.d.ts
+2
-0
No files found.
build/render.min.js
View file @
600d7f46
This diff is collapsed.
Click to expand it.
build/render.min.js.map
View file @
600d7f46
This diff is collapsed.
Click to expand it.
src/2d/display/Container.ts
View file @
600d7f46
import
{
DisplayObject
}
from
'./DisplayObject'
;
import
{
Rectangle
}
from
"../math/Rectangle"
;
import
{
Point
}
from
'../math'
;
import
{
DisplayObject
}
from
'./DisplayObject'
;
import
{
Rectangle
}
from
"../math/Rectangle"
;
import
{
Point
}
from
'../math'
;
import
CanvasRenderer
from
'../renderers/CanvasRenderer'
;
import
{
Event
}
from
"../events/Event"
import
{
WebglRenderer
}
from
'../renderers/WebglRenderer'
;
import
{
applyAutoAdjust
}
from
"../../zeroing/auto-adjust"
;
import
{
Event
}
from
"../events/Event"
import
{
WebglRenderer
}
from
'../renderers/WebglRenderer'
;
import
{
applyAutoAdjust
}
from
"../../zeroing/auto-adjust"
;
/**
* 容器类
...
...
@@ -490,15 +490,15 @@ export default class Container extends DisplayObject {
/**
* 更新方法
*/
update
()
{
update
(
deltaTime
:
number
)
{
if
(
!
this
.
visible
)
return
;
//更新自己的
super
.
update
()
super
.
update
(
deltaTime
)
//更新儿子们的
let
len
=
this
.
children
.
length
;
for
(
let
i
=
len
-
1
;
i
>=
0
;
i
--
)
{
const
child
=
this
.
children
[
i
];
if
(
child
.
visible
)
child
.
update
();
if
(
child
.
visible
)
child
.
update
(
deltaTime
);
}
}
...
...
src/2d/display/DisplayObject.ts
View file @
600d7f46
import
{
EventDispatcher
}
from
'../events/EventDispatcher'
;
import
{
EventDispatcher
}
from
'../events/EventDispatcher'
;
import
Transform
from
'../math/Transform'
;
import
{
Rectangle
}
from
'../math/Rectangle'
;
import
{
Point
}
from
"../math/Point"
;
import
{
Event
}
from
"../events/Event"
;
import
{
Component
}
from
'../component/Component'
;
import
{
Rectangle
}
from
'../math/Rectangle'
;
import
{
Point
}
from
"../math/Point"
;
import
{
Event
}
from
"../events/Event"
;
import
{
Component
}
from
'../component/Component'
;
import
Graphics
from
'../graphics/Graphics'
;
import
{
DEG_TO_RAD
,
RAD_TO_DEG
}
from
'../const'
;
import
{
DEG_TO_RAD
,
RAD_TO_DEG
}
from
'../const'
;
/**
* 基础显示对象抽象类
...
...
@@ -611,7 +611,7 @@ export class DisplayObject extends EventDispatcher {
/**
* 更新方法,帧循环的监听事件放在这
*/
public
update
()
{
public
update
(
deltaTime
:
number
)
{
//更新组件方法
for
(
var
i
=
0
;
i
<
this
.
_components
.
length
;
i
++
)
{
if
(
this
.
_components
[
i
].
enabled
)
{
...
...
@@ -620,7 +620,7 @@ export class DisplayObject extends EventDispatcher {
}
//监听的
if
(
this
.
hasEventListener
(
Event
.
ENTER_FRAME
))
{
this
.
dispatchEvent
(
Event
.
ENTER_FRAME
);
this
.
dispatchEvent
(
Event
.
ENTER_FRAME
,
deltaTime
);
}
}
//组件相关方法,添加移除等
...
...
src/2d/display/Stage.ts
View file @
600d7f46
import
Container
from
"./Container"
;
import
{
devicePixelRatio
,
osType
,
RENDERER_TYPE
,
StageScaleMode
}
from
"../const"
import
{
devicePixelRatio
,
osType
,
RENDERER_TYPE
,
StageScaleMode
}
from
"../const"
import
SystemRenderer
from
"../renderers/SystemRenderer"
;
import
{
Point
,
Rectangle
}
from
"../math"
;
import
{
EventDispatcher
}
from
"../events/EventDispatcher"
;
import
{
Event
}
from
"../events/Event"
;
import
{
FloatDisplay
}
from
"./FloatDisplay"
;
import
{
DisplayObject
}
from
"./DisplayObject"
;
import
{
MouseEvent
}
from
"../events/MouseEvent"
;
import
{
WebglRenderer
}
from
"../renderers/WebglRenderer"
;
import
{
GDispatcher
}
from
"../events/GDispatcher"
;
import
{
Point
,
Rectangle
}
from
"../math"
;
import
{
EventDispatcher
}
from
"../events/EventDispatcher"
;
import
{
Event
}
from
"../events/Event"
;
import
{
FloatDisplay
}
from
"./FloatDisplay"
;
import
{
DisplayObject
}
from
"./DisplayObject"
;
import
{
MouseEvent
}
from
"../events/MouseEvent"
;
import
{
WebglRenderer
}
from
"../renderers/WebglRenderer"
;
import
{
GDispatcher
}
from
"../events/GDispatcher"
;
import
CanvasRenderer
from
"../renderers/CanvasRenderer"
;
import
{
GlobalPro
,
isWebGLSupported
}
from
"../utils"
;
import
{
GlobalPro
,
isWebGLSupported
}
from
"../utils"
;
//如果以后还出现帧率问题,使用ticker;
//兼容requestAnimationFrame
...
...
@@ -131,7 +131,7 @@ export class Stage extends Container {
this
.
_pause
=
value
;
if
(
value
!=
this
.
_pause
)
{
//触发事件
GDispatcher
.
dispatchEvent
(
"onStagePause"
,
{
pause
:
value
});
GDispatcher
.
dispatchEvent
(
"onStagePause"
,
{
pause
:
value
});
}
}
...
...
@@ -574,7 +574,7 @@ export class Stage extends Container {
vH
*=
ih
/
100
;
}
}
return
{
w
:
vW
,
h
:
vH
};
return
{
w
:
vW
,
h
:
vH
};
}
/**
...
...
@@ -946,6 +946,9 @@ export class Stage extends Container {
* @method flushAll
*/
static
flushAll
():
void
{
//记录起始时间
if
(
!
GlobalPro
.
startTime
)
GlobalPro
.
startTime
=
Date
.
now
();
if
(
!
Stage
.
_pause
)
{
let
len
=
Stage
.
allUpdateObjList
.
length
;
for
(
let
i
=
0
;
i
<
len
;
i
++
)
{
...
...
src/2d/loader/Loader.ts
View file @
600d7f46
...
...
@@ -99,6 +99,7 @@ export class Loader extends EventDispatcher {
callback
(
false
,
e
);
};
img
.
src
=
url
;
return
img
}
loadSvga
(
callback
:
(
suc
:
boolean
,
data
:
VideoEntity
)
=>
void
,
url
:
string
)
{
...
...
@@ -134,3 +135,5 @@ async function fetchAsync(url: string) {
// fetchAsync("")
// .then(data => console.log(data))
// .catch(reason => console.log(reason.message))
export
const
globalLoader
=
new
Loader
();
\ No newline at end of file
src/2d/renderers/CanvasRenderer.ts
View file @
600d7f46
...
...
@@ -8,6 +8,7 @@ import {Matrix} from '../math';
import
{
DisplayObject
}
from
'../display/DisplayObject'
;
import
CanvasSpriteRenderer
from
'./plugins/CanvasSpriteRenderer'
;
import
{
CanvasGraphicsRenderer
}
from
'./plugins/CanvasGraphicsRenderer'
;
import
{
GlobalPro
}
from
'../utils'
;
/**
...
...
@@ -113,7 +114,7 @@ export default class CanvasRenderer extends SystemRenderer {
}
//update更新属性
displayObject
.
update
()
displayObject
.
update
(
Date
.
now
()
-
GlobalPro
.
startTime
)
//存下真实的父级对象
const
cacheParent
=
displayObject
.
parent
;
...
...
src/2d/renderers/WebglRenderer.ts
View file @
600d7f46
import
BatchRenderer
from
"./plugins/BatchRenderer"
;
import
SystemRenderer
from
"./SystemRenderer"
;
import
{
RendererOptions
}
from
"./RendererOptions"
;
import
{
devicePixelRatio
,
RENDERER_TYPE
,
SCALE_MODES
}
from
"../const"
;
import
{
createContext
,
GLShader
,
VertexArrayObject
}
from
"../../glCore"
;
import
{
RendererOptions
}
from
"./RendererOptions"
;
import
{
devicePixelRatio
,
RENDERER_TYPE
,
SCALE_MODES
}
from
"../const"
;
import
{
createContext
,
GLShader
,
VertexArrayObject
}
from
"../../glCore"
;
import
RenderTarget
from
"./renderTarget/RenderTarget"
;
import
TextureManager
from
"./managers/TextureManager"
;
import
TextureGarbageCollector
from
"./managers/TextureGarbageCollector"
;
import
RenderTexture
from
"../texture/RenderTexture"
;
import
{
Matrix
}
from
"../math"
;
import
{
Matrix
}
from
"../math"
;
import
WebGLState
from
"./webgl/WebGLState"
;
import
BatchManager
from
"./managers/BatchManager"
;
import
MaskManager
from
"./managers/MaskManager"
;
import
StencilManager
from
"./managers/StencilManager"
;
import
{
DisplayObject
}
from
"../display/DisplayObject"
;
import
{
DisplayObject
}
from
"../display/DisplayObject"
;
import
{
GlobalPro
}
from
"../utils"
;
let
CONTEXT_UID
=
0
;
...
...
@@ -170,7 +171,7 @@ export class WebglRenderer extends SystemRenderer {
}
//update更新属性
displayObject
.
update
()
displayObject
.
update
(
Date
.
now
()
-
GlobalPro
.
startTime
)
//更新矩阵
const
cacheParent
=
displayObject
.
parent
;
...
...
src/2d/svga/MovieClip.ts
View file @
600d7f46
import
Container
from
"../display/Container"
;
import
{
VideoEntity
}
from
"./VideoEntity"
;
import
{
VideoEntity
}
from
"./VideoEntity"
;
import
Texture
from
"../texture/Texture"
;
import
Sprite
from
"../display/Sprite"
;
import
{
Event
}
from
"../events/Event"
;
import
{
GlobalPro
,
TextureCache
}
from
"../utils"
;
import
{
RAD_TO_DEG
,
RENDERER_TYPE
}
from
"../const"
;
import
{
DrawAllToCanvas
}
from
"../utils/DrawAllToCanvas"
;
import
{
Button
}
from
"../ui/Button"
;
import
{
TextField
}
from
"../text/TextField"
;
import
{
Matrix
}
from
"../math"
;
import
{
Event
}
from
"../events/Event"
;
import
{
GlobalPro
,
TextureCache
}
from
"../utils"
;
import
{
RAD_TO_DEG
,
RENDERER_TYPE
}
from
"../const"
;
import
{
DrawAllToCanvas
}
from
"../utils/DrawAllToCanvas"
;
import
{
Button
}
from
"../ui/Button"
;
import
{
TextField
}
from
"../text/TextField"
;
import
{
Matrix
}
from
"../math"
;
/**
* 用于播放动画
...
...
@@ -721,11 +721,11 @@ export class MovieClip extends Container {
* @public
* @since 1.0.0
*/
public
update
():
void
{
public
update
(
deltaTime
:
number
):
void
{
let
s
:
any
=
this
;
//更新帧数据
this
.
updateFrame
();
super
.
update
();
super
.
update
(
deltaTime
);
}
...
...
src/2d/utils/index.ts
View file @
600d7f46
...
...
@@ -2,12 +2,12 @@
* 记录的一些方法和设置
*/
import
{
BLEND_MODES
,
DATA_URI
,
RENDERER_TYPE
,
URL_FILE_EXTENSION
}
from
"../const"
import
{
BLEND_MODES
,
DATA_URI
,
RENDERER_TYPE
,
URL_FILE_EXTENSION
}
from
"../const"
export
*
from
'./twiddle'
;
export
{
default
as
toDisplayDataURL
}
from
"./toDisplayDataURL"
;
export
{
default
as
determineCrossOrigin
}
from
'./determineCrossOrigin'
;
export
{
default
as
toDisplayDataURL
}
from
"./toDisplayDataURL"
;
export
{
default
as
determineCrossOrigin
}
from
'./determineCrossOrigin'
;
let
nextUid
=
0
;
...
...
@@ -309,7 +309,10 @@ export const GlobalPro = {
* 图集间隙
*/
padding
:
2
,
/**
* 时钟起始时间
*/
startTime
:
0
}
...
...
@@ -319,7 +322,7 @@ export const GlobalPro = {
* @return {boolean} is webgl supported
*/
export
function
isWebGLSupported
():
boolean
{
const
contextOptions
=
{
stencil
:
true
,
failIfMajorPerformanceCaveat
:
true
};
const
contextOptions
=
{
stencil
:
true
,
failIfMajorPerformanceCaveat
:
true
};
try
{
if
(
!
window
[
"WebGLRenderingContext"
])
{
return
false
;
...
...
types/2d/display/Container.d.ts
View file @
600d7f46
...
...
@@ -28,7 +28,7 @@ export default class Container extends DisplayObject {
protected
_renderWebGL
(
renderer
:
WebglRenderer
):
void
;
renderCanvas
(
renderer
:
CanvasRenderer
):
void
;
protected
_renderCanvas
(
renderer
:
CanvasRenderer
):
void
;
update
():
void
;
update
(
deltaTime
:
number
):
void
;
_onDispatchBubbledEvent
(
type
:
string
):
void
;
destroy
():
void
;
width
:
number
;
...
...
types/2d/display/DisplayObject.d.ts
View file @
600d7f46
...
...
@@ -66,7 +66,7 @@ export declare class DisplayObject extends EventDispatcher {
width
:
number
;
height
:
number
;
private
_components
;
update
():
void
;
update
(
deltaTime
:
number
):
void
;
addComponent
(
component
:
Component
):
void
;
addComponentAt
(
component
:
Component
,
index
:
number
):
void
;
removeComponent
(
component
:
Component
):
void
;
...
...
types/2d/loader/Loader.d.ts
View file @
600d7f46
...
...
@@ -7,7 +7,10 @@ export declare class Loader extends EventDispatcher {
_req
:
XMLHttpRequest
;
constructor
();
loadSheet
(
callback
:
Function
,
url
:
string
):
void
;
loadImage
(
callback
:
Function
,
url
:
string
,
crossOrigin
?:
boolean
):
void
;
loadJson
(
callback
:
Function
,
url
:
string
):
void
;
loadTexture
(
url
:
string
,
uuid
?:
any
):
void
;
loadImage
(
callback
:
Function
,
url
:
string
,
crossOrigin
?:
boolean
):
HTMLImageElement
;
loadSvga
(
callback
:
(
suc
:
boolean
,
data
:
VideoEntity
)
=>
void
,
url
:
string
):
void
;
cache
(
name
:
string
,
data
:
any
):
void
;
}
export
declare
const
globalLoader
:
Loader
;
types/2d/svga/MovieClip.d.ts
View file @
600d7f46
...
...
@@ -36,6 +36,6 @@ export declare class MovieClip extends Container {
commonDeltaTime
:
number
;
updateFrame
():
void
;
private
getCurFrameWhenLockStep
;
update
():
void
;
update
(
deltaTime
:
number
):
void
;
destroy
():
void
;
}
types/2d/text/TextField.d.ts
View file @
600d7f46
...
...
@@ -25,7 +25,7 @@ export declare class TextField extends Sprite {
private
_font
;
size
:
number
;
private
_size
;
fillColor
:
string
;
fillColor
:
any
;
private
_fillColor
;
strokeColor
:
string
;
private
_strokeColor
;
...
...
types/2d/utils/index.d.ts
View file @
600d7f46
...
...
@@ -31,6 +31,7 @@ export declare const GlobalPro: {
stageRenderType
:
RENDERER_TYPE
;
dpi
:
number
;
padding
:
number
;
startTime
:
number
;
};
export
declare
function
isWebGLSupported
():
boolean
;
export
declare
function
removeItems
(
arr
:
Array
<
any
>
,
startIdx
:
number
,
removeCount
:
number
):
void
;
...
...
types/zeroing/RES.d.ts
0 → 100644
View file @
600d7f46
export
declare
function
loadTexture
(
url
:
string
):
void
;
export
declare
function
getRes
():
void
;
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