Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
a6b2e376
T
three.js
项目概览
车家大少爷
/
three.js
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
three.js
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
a6b2e376
编写于
10月 21, 2019
作者:
M
Mr.doob
提交者:
GitHub
10月 21, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #17748 from higharc/rename-program-code
Rename WebGLProgram "code" to "cacheKey"
上级
3eb84a5e
91d02e72
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
20 addition
and
20 deletion
+20
-20
src/renderers/WebGLRenderer.js
src/renderers/WebGLRenderer.js
+5
-5
src/renderers/webgl/WebGLProgram.d.ts
src/renderers/webgl/WebGLProgram.d.ts
+2
-2
src/renderers/webgl/WebGLProgram.js
src/renderers/webgl/WebGLProgram.js
+2
-2
src/renderers/webgl/WebGLPrograms.d.ts
src/renderers/webgl/WebGLPrograms.d.ts
+5
-5
src/renderers/webgl/WebGLPrograms.js
src/renderers/webgl/WebGLPrograms.js
+6
-6
未找到文件。
src/renderers/WebGLRenderer.js
浏览文件 @
a6b2e376
...
@@ -1497,7 +1497,7 @@ function WebGLRenderer( parameters ) {
...
@@ -1497,7 +1497,7 @@ function WebGLRenderer( parameters ) {
var
parameters
=
programCache
.
getParameters
(
var
parameters
=
programCache
.
getParameters
(
material
,
lights
.
state
,
shadowsArray
,
fog
,
_clipping
.
numPlanes
,
_clipping
.
numIntersection
,
object
);
material
,
lights
.
state
,
shadowsArray
,
fog
,
_clipping
.
numPlanes
,
_clipping
.
numIntersection
,
object
);
var
code
=
programCache
.
getProgramCode
(
material
,
parameters
);
var
programCacheKey
=
programCache
.
getProgramCacheKey
(
material
,
parameters
);
var
program
=
materialProperties
.
program
;
var
program
=
materialProperties
.
program
;
var
programChange
=
true
;
var
programChange
=
true
;
...
@@ -1507,7 +1507,7 @@ function WebGLRenderer( parameters ) {
...
@@ -1507,7 +1507,7 @@ function WebGLRenderer( parameters ) {
// new material
// new material
material
.
addEventListener
(
'
dispose
'
,
onMaterialDispose
);
material
.
addEventListener
(
'
dispose
'
,
onMaterialDispose
);
}
else
if
(
program
.
c
ode
!==
code
)
{
}
else
if
(
program
.
c
acheKey
!==
programCacheKey
)
{
// changed glsl or parameters
// changed glsl or parameters
releaseMaterialProgramReference
(
material
);
releaseMaterialProgramReference
(
material
);
...
@@ -1556,10 +1556,10 @@ function WebGLRenderer( parameters ) {
...
@@ -1556,10 +1556,10 @@ function WebGLRenderer( parameters ) {
material
.
onBeforeCompile
(
materialProperties
.
shader
,
_this
);
material
.
onBeforeCompile
(
materialProperties
.
shader
,
_this
);
// Computing c
ode
again as onBeforeCompile may have changed the shaders
// Computing c
ache key
again as onBeforeCompile may have changed the shaders
code
=
programCache
.
getProgramCode
(
material
,
parameters
);
programCacheKey
=
programCache
.
getProgramCacheKey
(
material
,
parameters
);
program
=
programCache
.
acquireProgram
(
material
,
materialProperties
.
shader
,
parameters
,
code
);
program
=
programCache
.
acquireProgram
(
material
,
materialProperties
.
shader
,
parameters
,
programCacheKey
);
materialProperties
.
program
=
program
;
materialProperties
.
program
=
program
;
material
.
program
=
program
;
material
.
program
=
program
;
...
...
src/renderers/webgl/WebGLProgram.d.ts
浏览文件 @
a6b2e376
...
@@ -9,14 +9,14 @@ export class WebGLProgram {
...
@@ -9,14 +9,14 @@ export class WebGLProgram {
constructor
(
constructor
(
renderer
:
WebGLRenderer
,
renderer
:
WebGLRenderer
,
extensions
:
WebGLExtensions
,
extensions
:
WebGLExtensions
,
c
ode
:
string
,
c
acheKey
:
string
,
material
:
ShaderMaterial
,
material
:
ShaderMaterial
,
shader
:
WebGLShader
,
shader
:
WebGLShader
,
parameters
:
WebGLRendererParameters
parameters
:
WebGLRendererParameters
);
);
id
:
number
;
id
:
number
;
c
ode
:
string
;
c
acheKey
:
string
;
// unique identifier for this program, used for looking up compiled programs from cache.
usedTimes
:
number
;
usedTimes
:
number
;
program
:
any
;
program
:
any
;
vertexShader
:
WebGLShader
;
vertexShader
:
WebGLShader
;
...
...
src/renderers/webgl/WebGLProgram.js
浏览文件 @
a6b2e376
...
@@ -377,7 +377,7 @@ function generateEnvMapBlendingDefine( parameters ) {
...
@@ -377,7 +377,7 @@ function generateEnvMapBlendingDefine( parameters ) {
}
}
function
WebGLProgram
(
renderer
,
extensions
,
c
ode
,
material
,
shader
,
parameters
)
{
function
WebGLProgram
(
renderer
,
extensions
,
c
acheKey
,
material
,
shader
,
parameters
)
{
var
gl
=
renderer
.
getContext
();
var
gl
=
renderer
.
getContext
();
...
@@ -884,7 +884,7 @@ function WebGLProgram( renderer, extensions, code, material, shader, parameters
...
@@ -884,7 +884,7 @@ function WebGLProgram( renderer, extensions, code, material, shader, parameters
this
.
name
=
shader
.
name
;
this
.
name
=
shader
.
name
;
this
.
id
=
programIdCount
++
;
this
.
id
=
programIdCount
++
;
this
.
c
ode
=
code
;
this
.
c
acheKey
=
cacheKey
;
this
.
usedTimes
=
1
;
this
.
usedTimes
=
1
;
this
.
program
=
program
;
this
.
program
=
program
;
this
.
vertexShader
=
glVertexShader
;
this
.
vertexShader
=
glVertexShader
;
...
...
src/renderers/webgl/WebGLPrograms.d.ts
浏览文件 @
a6b2e376
...
@@ -2,7 +2,7 @@ import { WebGLRenderer } from './../WebGLRenderer';
...
@@ -2,7 +2,7 @@ import { WebGLRenderer } from './../WebGLRenderer';
import
{
WebGLProgram
}
from
'
./WebGLProgram
'
;
import
{
WebGLProgram
}
from
'
./WebGLProgram
'
;
import
{
WebGLCapabilities
}
from
'
./WebGLCapabilities
'
;
import
{
WebGLCapabilities
}
from
'
./WebGLCapabilities
'
;
import
{
WebGLExtensions
}
from
'
./WebGLExtensions
'
;
import
{
WebGLExtensions
}
from
'
./WebGLExtensions
'
;
import
{
ShaderMaterial
}
from
'
./../../materials/Shader
Material
'
;
import
{
Material
}
from
'
./../../materials/
Material
'
;
export
class
WebGLPrograms
{
export
class
WebGLPrograms
{
...
@@ -11,17 +11,17 @@ export class WebGLPrograms {
...
@@ -11,17 +11,17 @@ export class WebGLPrograms {
programs
:
WebGLProgram
[];
programs
:
WebGLProgram
[];
getParameters
(
getParameters
(
material
:
Shader
Material
,
material
:
Material
,
lights
:
any
,
lights
:
any
,
fog
:
any
,
fog
:
any
,
nClipPlanes
:
number
,
nClipPlanes
:
number
,
object
:
any
object
:
any
):
any
;
):
any
;
getProgramC
ode
(
material
:
Shader
Material
,
parameters
:
any
):
string
;
getProgramC
acheKey
(
material
:
Material
,
parameters
:
any
):
string
;
acquireProgram
(
acquireProgram
(
material
:
Shader
Material
,
material
:
Material
,
parameters
:
any
,
parameters
:
any
,
c
ode
:
string
c
acheKey
:
string
):
WebGLProgram
;
):
WebGLProgram
;
releaseProgram
(
program
:
WebGLProgram
):
void
;
releaseProgram
(
program
:
WebGLProgram
):
void
;
...
...
src/renderers/webgl/WebGLPrograms.js
浏览文件 @
a6b2e376
...
@@ -240,7 +240,7 @@ function WebGLPrograms( renderer, extensions, capabilities ) {
...
@@ -240,7 +240,7 @@ function WebGLPrograms( renderer, extensions, capabilities ) {
};
};
this
.
getProgramC
ode
=
function
(
material
,
parameters
)
{
this
.
getProgramC
acheKey
=
function
(
material
,
parameters
)
{
var
array
=
[];
var
array
=
[];
...
@@ -282,18 +282,18 @@ function WebGLPrograms( renderer, extensions, capabilities ) {
...
@@ -282,18 +282,18 @@ function WebGLPrograms( renderer, extensions, capabilities ) {
};
};
this
.
acquireProgram
=
function
(
material
,
shader
,
parameters
,
c
ode
)
{
this
.
acquireProgram
=
function
(
material
,
shader
,
parameters
,
c
acheKey
)
{
var
program
;
var
program
;
// Check if code has been already compiled
// Check if code has been already compiled
for
(
var
p
=
0
,
pl
=
programs
.
length
;
p
<
pl
;
p
++
)
{
for
(
var
p
=
0
,
pl
=
programs
.
length
;
p
<
pl
;
p
++
)
{
var
pr
ogramInfo
=
programs
[
p
];
var
pr
eexistingProgram
=
programs
[
p
];
if
(
pr
ogramInfo
.
code
===
code
)
{
if
(
pr
eexistingProgram
.
cacheKey
===
cacheKey
)
{
program
=
pr
ogramInfo
;
program
=
pr
eexistingProgram
;
++
program
.
usedTimes
;
++
program
.
usedTimes
;
break
;
break
;
...
@@ -304,7 +304,7 @@ function WebGLPrograms( renderer, extensions, capabilities ) {
...
@@ -304,7 +304,7 @@ function WebGLPrograms( renderer, extensions, capabilities ) {
if
(
program
===
undefined
)
{
if
(
program
===
undefined
)
{
program
=
new
WebGLProgram
(
renderer
,
extensions
,
c
ode
,
material
,
shader
,
parameters
);
program
=
new
WebGLProgram
(
renderer
,
extensions
,
c
acheKey
,
material
,
shader
,
parameters
);
programs
.
push
(
program
);
programs
.
push
(
program
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录