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
f70709ec
Commit
f70709ec
authored
Dec 19, 2019
by
wjf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
l
parent
51a8cb4c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
6 deletions
+33
-6
Sprite.ts
src/2d/display/Sprite.ts
+33
-6
No files found.
src/2d/display/Sprite.ts
View file @
f70709ec
import
{
ObservablePoint
,
Point
,
Rectangle
}
from
'../math'
;
import
{
sign
,
TextureCache
}
from
'../utils'
;
import
{
ObservablePoint
,
Point
,
Rectangle
}
from
'../math'
;
import
{
sign
,
TextureCache
}
from
'../utils'
;
// import { BLEND_MODES } from '../const';
import
Texture
from
'../texture/Texture'
;
import
{
Event
}
from
'../events/Event'
;
import
{
Event
}
from
'../events/Event'
;
import
Container
from
'./Container'
;
import
{
DisplayObject
}
from
"./DisplayObject"
;
import
{
DisplayObject
}
from
"./DisplayObject"
;
import
CanvasRenderer
from
'../renderers/CanvasRenderer'
;
import
{
SCALE_MODES
}
from
'../const'
;
import
{
WebglRenderer
}
from
'../renderers/WebglRenderer'
;
import
{
SCALE_MODES
}
from
'../const'
;
import
{
WebglRenderer
}
from
'../renderers/WebglRenderer'
;
const
indices
=
new
Uint16Array
([
0
,
1
,
2
,
0
,
2
,
3
]);
/**
...
...
@@ -22,6 +22,18 @@ export default class Sprite extends Container {
*
*/
private
_anchorTexture
:
ObservablePoint
;
/**
* 色值调色
*/
private
_tint
:
number
;
/**
* RGB形式色值,webgl用
*/
_tintRGB
:
number
;
/**
* 和_tint比较用,用于canvas调色缓存
*/
_cachedTint
:
number
;
/**
* 使用的贴图
* @member {Texture}
...
...
@@ -86,6 +98,11 @@ export default class Sprite extends Container {
this
.
_height
=
0
;
this
.
_tint
=
null
;
this
.
_tintRGB
=
null
;
this
.
tint
=
0xFFFFFF
;
this
.
_cachedTint
=
0xFFFFFF
;
this
.
uvs
=
null
;
// 下面texture set时用到
...
...
@@ -121,6 +138,7 @@ export default class Sprite extends Container {
//保证顶点要更新
this
.
_textureID
=
-
1
;
this
.
_textureTrimmedID
=
-
1
;
this
.
_cachedTint
=
0xFFFFFF
;
//可用才赋值uv
if
(
this
.
_texture
.
valid
)
this
.
uvs
=
this
.
_texture
.
_uvs
.
uvsFloat32
;
//设置过宽高的话,就需要改变缩放值,废弃先
...
...
@@ -424,6 +442,7 @@ export default class Sprite extends Container {
this
.
_textureID
=
-
1
;
this
.
_textureTrimmedID
=
-
1
;
this
.
_cachedTint
=
0xFFFFFF
;
if
(
value
)
{
if
(
value
.
baseTexture
.
hasLoaded
)
{
...
...
@@ -434,6 +453,14 @@ export default class Sprite extends Container {
}
}
get
tint
()
{
return
this
.
_tint
;
}
set
tint
(
value
)
{
if
(
value
===
this
.
_tint
)
return
;
this
.
_tint
=
value
;
this
.
_tintRGB
=
(
value
>>
16
)
+
(
value
&
0xff00
)
+
((
value
&
0xff
)
<<
16
);
}
//一些静态类方法
/**
...
...
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