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
69254e50
Commit
69254e50
authored
Sep 17, 2020
by
wjf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
l
parent
1d455127
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
31 additions
and
19 deletions
+31
-19
fyge.min.js
build/fyge.min.js
+4
-3
fyge.min.js.map
build/fyge.min.js.map
+1
-1
D3Renderer.ts
src/3D/D3Renderer.ts
+2
-0
Geometry.ts
src/3D/Geometry.ts
+10
-2
Object3D.ts
src/3D/Object3D.ts
+1
-1
getCusShader.ts
src/3D/shaders/getCusShader.ts
+13
-12
No files found.
build/fyge.min.js
View file @
69254e50
...
@@ -1643,7 +1643,8 @@ var Stage = (function (_super) {
...
@@ -1643,7 +1643,8 @@ var Stage = (function (_super) {
this.renderObj.render(this);
this.renderObj.render(this);
};
};
Stage.prototype.onMouseEvent = function (e) {
Stage.prototype.onMouseEvent = function (e) {
e
.
preventDefault
();
if (!my)
e.preventDefault();
var s = this;
var s = this;
if (EventDispatcher_1.EventDispatcher._totalMEC > 0) {
if (EventDispatcher_1.EventDispatcher._totalMEC > 0) {
var points = void 0;
var points = void 0;
...
@@ -20177,6 +20178,7 @@ var FRAG = [
...
@@ -20177,6 +20178,7 @@ var FRAG = [
" vec4 color = mapColor *vec4(vColor,1.0);",
" vec4 color = mapColor *vec4(vColor,1.0);",
" vec4 matColor = vec4( uMatColor, uMatAlpha );",
" vec4 matColor = vec4( uMatColor, uMatAlpha );",
" color *=matColor;",
" color *=matColor;",
" gl_FragColor = color;",
' #ifdef USE_LIGHT',
' #ifdef USE_LIGHT',
" vec3 totalDiffuseLight = vec3( 0.0 );",
" vec3 totalDiffuseLight = vec3( 0.0 );",
" vec3 totalSpecularLight = vec3( 0.0 );",
" vec3 totalSpecularLight = vec3( 0.0 );",
...
@@ -20204,9 +20206,8 @@ var FRAG = [
...
@@ -20204,9 +20206,8 @@ var FRAG = [
" totalDiffuseLight += directionalLights[ i ].color * dirDiffuseWeightFull;",
" totalDiffuseLight += directionalLights[ i ].color * dirDiffuseWeightFull;",
" }",
" }",
" #endif",
" #endif",
"
color = vec4((totalDiffuseLight + uAmbientLightColor + totalSpecularLight) * color.rgb, color.a)
;"
,
"
gl_FragColor.rgb = (totalDiffuseLight + uAmbientLightColor + totalSpecularLight) * color.rgb
;",
' #endif',
' #endif',
" gl_FragColor = color;"
,
"}"
"}"
].join("\n");
].join("\n");
...
...
build/fyge.min.js.map
View file @
69254e50
This diff is collapsed.
Click to expand it.
src/3D/D3Renderer.ts
View file @
69254e50
...
@@ -198,6 +198,8 @@ export class D3Renderer extends ObjectRenderer {
...
@@ -198,6 +198,8 @@ export class D3Renderer extends ObjectRenderer {
//不修改,估计都不要变,需要修改时候
//不修改,估计都不要变,需要修改时候
// glVaoBuffer.attrBuffer.upload(glVaoBuffer._attrBuffer.vertices, 0, true)
// glVaoBuffer.attrBuffer.upload(glVaoBuffer._attrBuffer.vertices, 0, true)
// glVaoBuffer.indexBuffer.upload(glVaoBuffer._indexBuffer, 0, true)
// glVaoBuffer.indexBuffer.upload(glVaoBuffer._indexBuffer, 0, true)
//变形的数据可能传入的会改变,所以需要upload
}
}
//根据材质切换渲染面
//根据材质切换渲染面
if
(
mat
.
side
==
RenderSideType
.
DoubleSide
)
{
if
(
mat
.
side
==
RenderSideType
.
DoubleSide
)
{
...
...
src/3D/Geometry.ts
View file @
69254e50
...
@@ -45,16 +45,24 @@ export class Geometry extends HashObject {
...
@@ -45,16 +45,24 @@ export class Geometry extends HashObject {
_glVaoBuffer
:
{
[
key
:
number
]:
VaoBufferInt
}
_glVaoBuffer
:
{
[
key
:
number
]:
VaoBufferInt
}
/**
/**
* 记录顶点数据用
* 记录顶点数据用
,包括坐标,颜色,uv,法线
*/
*/
_attrBuffer
:
BatchBuffer
;
_attrBuffer
:
BatchBuffer
;
/**
* 顶点变形数据数组
*/
/**
/**
* 索引数据
* 法线顶点数据数组
*
*/
*/
/**
/**
*
*
* @param vertices
* @param vertices
* @param indices
* @param indices
* @param normals
* @param colors
* @param colors
* @param uvs
* @param uvs
*/
*/
...
...
src/3D/Object3D.ts
View file @
69254e50
...
@@ -156,7 +156,7 @@ export class Object3D extends EventDispatcher {
...
@@ -156,7 +156,7 @@ export class Object3D extends EventDispatcher {
};
};
copy
(
source
:
Object3D
,
recursive
:
boolean
=
true
)
{
copy
(
source
:
Object3D
,
recursive
:
boolean
=
true
)
{
this
.
name
=
source
.
name
;
this
.
name
=
source
.
name
;
this
.
visible
=
this
.
visible
;
this
.
visible
=
source
.
visible
;
this
.
up
.
copy
(
source
.
up
);
this
.
up
.
copy
(
source
.
up
);
this
.
position
.
copy
(
source
.
position
);
this
.
position
.
copy
(
source
.
position
);
...
...
src/3D/shaders/getCusShader.ts
View file @
69254e50
...
@@ -72,13 +72,15 @@ class CusShader extends GLShader {
...
@@ -72,13 +72,15 @@ class CusShader extends GLShader {
gl
:
WebGLRenderingContext
,
gl
:
WebGLRenderingContext
,
parameters
:
ShaderParametersInt
parameters
:
ShaderParametersInt
)
{
)
{
//预处理参数
var
frontVert
=
[
var
frontVert
=
[
parameters
.
lightAffect
?
'#define USE_LIGHT'
:
''
,
parameters
.
lightAffect
?
'#define USE_LIGHT'
:
''
,
parameters
.
morphTargets
?
'#define USE_MORPHTARGETS'
:
''
,
parameters
.
morphTargets
?
'#define USE_MORPHTARGETS'
:
''
,
parameters
.
morphNormals
?
'#define USE_MORPHNORMALS'
:
''
,
parameters
.
morphNormals
?
'#define USE_MORPHNORMALS'
:
''
,
].
filter
(
e
=>
e
!==
''
).
join
(
'
\
n'
);
].
filter
(
e
=>
e
!==
''
).
join
(
'
\
n'
);
//不为空加个换行
if
(
frontVert
)
frontVert
+=
"
\n
"
;
if
(
frontVert
)
frontVert
+=
"
\n
"
;
var
frontFrag
=
[
var
frontFrag
=
[
parameters
.
lightAffect
?
'#define USE_LIGHT'
:
''
,
parameters
.
lightAffect
?
'#define USE_LIGHT'
:
''
,
].
filter
(
e
=>
e
!==
''
).
join
(
'
\
n'
);
].
filter
(
e
=>
e
!==
''
).
join
(
'
\
n'
);
...
@@ -147,14 +149,6 @@ const parameterNames = [
...
@@ -147,14 +149,6 @@ const parameterNames = [
"lightAffect"
,
"lightAffect"
,
]
]
/**
* 着色器替换的一些文案
*/
enum
shaderReplaceStr
{
POINT_LIGHTS_NUM
=
"POINT_LIGHTS_NUM"
,
DIR_LIGHTS_NUM
=
"DIR_LIGHTS_NUM"
,
}
/**
/**
* 着色器编译参数接口
* 着色器编译参数接口
*/
*/
...
@@ -166,6 +160,13 @@ interface ShaderParametersInt {
...
@@ -166,6 +160,13 @@ interface ShaderParametersInt {
lightAffect
:
boolean
lightAffect
:
boolean
}
}
/**
* 着色器替换的一些文案
*/
enum
shaderReplaceStr
{
POINT_LIGHTS_NUM
=
"POINT_LIGHTS_NUM"
,
DIR_LIGHTS_NUM
=
"DIR_LIGHTS_NUM"
,
}
const
VERT
=
[
const
VERT
=
[
...
@@ -311,7 +312,8 @@ const FRAG = [
...
@@ -311,7 +312,8 @@ const FRAG = [
" vec4 matColor = vec4( uMatColor, uMatAlpha );"
,
" vec4 matColor = vec4( uMatColor, uMatAlpha );"
,
//总颜色
//总颜色
" color *=matColor;"
,
" color *=matColor;"
,
//先把颜色算了
" gl_FragColor = color;"
,
//光照颜色计算
//光照颜色计算
' #ifdef USE_LIGHT'
,
' #ifdef USE_LIGHT'
,
" vec3 totalDiffuseLight = vec3( 0.0 );"
,
" vec3 totalDiffuseLight = vec3( 0.0 );"
,
...
@@ -355,9 +357,8 @@ const FRAG = [
...
@@ -355,9 +357,8 @@ const FRAG = [
" #endif"
,
" #endif"
,
//计算环境光颜色,是否要乘材质本身颜色,待定,效果待调整,镜面反射是否要乘color.rgb,
//计算环境光颜色,是否要乘材质本身颜色,待定,效果待调整,镜面反射是否要乘color.rgb,
"
color = vec4((totalDiffuseLight + uAmbientLightColor + totalSpecularLight) * color.rgb, color.a)
;"
,
"
gl_FragColor.rgb = (totalDiffuseLight + uAmbientLightColor + totalSpecularLight) * color.rgb
;"
,
' #endif'
,
' #endif'
,
" gl_FragColor = color;"
,
"}"
"}"
].
join
(
"
\n
"
)
].
join
(
"
\n
"
)
...
...
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