Commit 69254e50 authored by wjf's avatar wjf

l

parent 1d455127
......@@ -1643,6 +1643,7 @@ var Stage = (function (_super) {
this.renderObj.render(this);
};
Stage.prototype.onMouseEvent = function (e) {
if (!my)
e.preventDefault();
var s = this;
if (EventDispatcher_1.EventDispatcher._totalMEC > 0) {
......@@ -20177,6 +20178,7 @@ var FRAG = [
" vec4 color = mapColor *vec4(vColor,1.0);",
" vec4 matColor = vec4( uMatColor, uMatAlpha );",
" color *=matColor;",
" gl_FragColor = color;",
' #ifdef USE_LIGHT',
" vec3 totalDiffuseLight = vec3( 0.0 );",
" vec3 totalSpecularLight = vec3( 0.0 );",
......@@ -20204,9 +20206,8 @@ var FRAG = [
" totalDiffuseLight += directionalLights[ i ].color * dirDiffuseWeightFull;",
" }",
" #endif",
" color = vec4((totalDiffuseLight + uAmbientLightColor + totalSpecularLight) * color.rgb, color.a);",
" gl_FragColor.rgb = (totalDiffuseLight + uAmbientLightColor + totalSpecularLight) * color.rgb;",
' #endif',
" gl_FragColor = color;",
"}"
].join("\n");
......
This diff is collapsed.
......@@ -198,6 +198,8 @@ export class D3Renderer extends ObjectRenderer {
//不修改,估计都不要变,需要修改时候
// glVaoBuffer.attrBuffer.upload(glVaoBuffer._attrBuffer.vertices, 0, true)
// glVaoBuffer.indexBuffer.upload(glVaoBuffer._indexBuffer, 0, true)
//变形的数据可能传入的会改变,所以需要upload
}
//根据材质切换渲染面
if (mat.side == RenderSideType.DoubleSide) {
......
......@@ -45,16 +45,24 @@ export class Geometry extends HashObject {
_glVaoBuffer: { [key: number]: VaoBufferInt }
/**
* 记录顶点数据用
* 记录顶点数据用,包括坐标,颜色,uv,法线
*/
_attrBuffer: BatchBuffer;
/**
* 顶点变形数据数组
*/
/**
* 索引数据
* 法线顶点数据数组
*
*/
/**
*
* @param vertices
* @param indices
* @param normals
* @param colors
* @param uvs
*/
......
......@@ -156,7 +156,7 @@ export class Object3D extends EventDispatcher {
};
copy(source: Object3D, recursive: boolean = true) {
this.name = source.name;
this.visible = this.visible;
this.visible = source.visible;
this.up.copy(source.up);
this.position.copy(source.position);
......
......@@ -72,13 +72,15 @@ class CusShader extends GLShader {
gl: WebGLRenderingContext,
parameters: ShaderParametersInt
) {
//预处理参数
var frontVert = [
parameters.lightAffect ? '#define USE_LIGHT' : '',
parameters.morphTargets ? '#define USE_MORPHTARGETS' : '',
parameters.morphNormals ? '#define USE_MORPHNORMALS' : '',
].filter(e => e !== '').join('\n');
//不为空加个换行
if (frontVert) frontVert += "\n";
var frontFrag = [
parameters.lightAffect ? '#define USE_LIGHT' : '',
].filter(e => e !== '').join('\n');
......@@ -147,14 +149,6 @@ const parameterNames = [
"lightAffect",
]
/**
* 着色器替换的一些文案
*/
enum shaderReplaceStr {
POINT_LIGHTS_NUM = "POINT_LIGHTS_NUM",
DIR_LIGHTS_NUM = "DIR_LIGHTS_NUM",
}
/**
* 着色器编译参数接口
*/
......@@ -166,6 +160,13 @@ interface ShaderParametersInt {
lightAffect: boolean
}
/**
* 着色器替换的一些文案
*/
enum shaderReplaceStr {
POINT_LIGHTS_NUM = "POINT_LIGHTS_NUM",
DIR_LIGHTS_NUM = "DIR_LIGHTS_NUM",
}
const VERT = [
......@@ -311,7 +312,8 @@ const FRAG = [
" vec4 matColor = vec4( uMatColor, uMatAlpha );",
//总颜色
" color *=matColor;",
//先把颜色算了
" gl_FragColor = color;",
//光照颜色计算
' #ifdef USE_LIGHT',
" vec3 totalDiffuseLight = vec3( 0.0 );",
......@@ -355,9 +357,8 @@ const FRAG = [
" #endif",
//计算环境光颜色,是否要乘材质本身颜色,待定,效果待调整,镜面反射是否要乘color.rgb,
" color = vec4((totalDiffuseLight + uAmbientLightColor + totalSpecularLight) * color.rgb, color.a);",
" gl_FragColor.rgb = (totalDiffuseLight + uAmbientLightColor + totalSpecularLight) * color.rgb;",
' #endif',
" gl_FragColor = color;",
"}"
].join("\n")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment