提交 a017ad9a 编写于 作者: A alteredq

Small optimization of color uniforms setting.

It should be safe just to set material color object references, no more updating of color string in every frame for every material color.
上级 80696063
因为 它太大了无法显示 source diff 。你可以改为 查看blob
此差异已折叠。
......@@ -2066,7 +2066,7 @@ THREE.WebGLRenderer = function ( parameters ) {
function refreshUniformsCommon( uniforms, material ) {
uniforms.diffuse.value.setRGB( material.color.r, material.color.g, material.color.b );
uniforms.diffuse.value = material.color;
uniforms.opacity.value = material.opacity;
uniforms.map.texture = material.map;
......@@ -2082,14 +2082,14 @@ THREE.WebGLRenderer = function ( parameters ) {
function refreshUniformsLine( uniforms, material ) {
uniforms.diffuse.value.setRGB( material.color.r, material.color.g, material.color.b );
uniforms.diffuse.value = material.color;
uniforms.opacity.value = material.opacity;
};
function refreshUniformsParticle( uniforms, material ) {
uniforms.psColor.value.setRGB( material.color.r, material.color.g, material.color.b );
uniforms.psColor.value = material.color;
uniforms.opacity.value = material.opacity;
uniforms.size.value = material.size;
uniforms.scale.value = _canvas.height / 2.0; // TODO: Cache this.
......@@ -2099,7 +2099,7 @@ THREE.WebGLRenderer = function ( parameters ) {
function refreshUniformsFog( uniforms, fog ) {
uniforms.fogColor.value.setHex( fog.color.hex );
uniforms.fogColor.value = fog.color;
if ( fog instanceof THREE.Fog ) {
......@@ -2116,10 +2116,8 @@ THREE.WebGLRenderer = function ( parameters ) {
function refreshUniformsPhong( uniforms, material ) {
//uniforms.ambient.value.setHex( material.ambient.hex );
//uniforms.specular.value.setHex( material.specular.hex );
uniforms.ambient.value.setRGB( material.ambient.r, material.ambient.g, material.ambient.b );
uniforms.specular.value.setRGB( material.specular.r, material.specular.g, material.specular.b );
uniforms.ambient.value = material.ambient;
uniforms.specular.value = material.specular;
uniforms.shininess.value = material.shininess;
};
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册