|
@@ -68,7 +68,6 @@ THREE.WebGLPrograms = function ( renderer, capabilities ) {
|
|
}
|
|
}
|
|
|
|
|
|
this.getParameters = function ( material, lights, fog, object ) {
|
|
this.getParameters = function ( material, lights, fog, object ) {
|
|
-
|
|
|
|
var shaderID = shaderIDs[ material.type ];
|
|
var shaderID = shaderIDs[ material.type ];
|
|
// heuristics to create shader parameters according to lights in the scene
|
|
// heuristics to create shader parameters according to lights in the scene
|
|
// (not to blow over maxLights budget)
|
|
// (not to blow over maxLights budget)
|
|
@@ -88,21 +87,13 @@ THREE.WebGLPrograms = function ( renderer, capabilities ) {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- var getTextureEncodingFromMap = function( map ) {
|
|
|
|
- if( ! map ) { // no texture
|
|
|
|
- return false;
|
|
|
|
- }
|
|
|
|
|
|
+ var getTextureEncodingFromMap = function( map, gammaOverrideLinear ) {
|
|
var encoding;
|
|
var encoding;
|
|
- if( map.encoding !== undefined ) { // standard texture
|
|
|
|
- encoding = map.encoding;
|
|
|
|
- }
|
|
|
|
- else if( map.texture !== undefined ) { // render target pretending to be a texture, get the texture inside it.
|
|
|
|
- encoding = map.texture.encoding;
|
|
|
|
|
|
+ if( ! map ) {
|
|
|
|
+ encoding = THREE.LinearEncoding;
|
|
}
|
|
}
|
|
- else {
|
|
|
|
- throw new Error( "can not determine texture encoding from map: " + map );
|
|
|
|
- }
|
|
|
|
- // add backwards compatibility for WebGLRenderer.gammaInput parameter, should probably be removed at some point.
|
|
|
|
|
|
+ else if( map instanceof THREE.Texture ) {
|
|
|
|
+ // add backwards compatibility for WebGLRenderer.gammaInput parameter, should probably be removed at some point.
|
|
if( encoding === THREE.LinearEncoding && renderer.gammaInput ) {
|
|
if( encoding === THREE.LinearEncoding && renderer.gammaInput ) {
|
|
encoding = THREE.GammaEncoding;
|
|
encoding = THREE.GammaEncoding;
|
|
}
|
|
}
|
|
@@ -115,16 +106,16 @@ THREE.WebGLPrograms = function ( renderer, capabilities ) {
|
|
|
|
|
|
precision: precision,
|
|
precision: precision,
|
|
supportsVertexTextures: capabilities.vertexTextures,
|
|
supportsVertexTextures: capabilities.vertexTextures,
|
|
-
|
|
|
|
|
|
+ outputEncoding: getTextureEncodingFromMap( renderer._currentRenderTarget, renderer.gammaOutput ),
|
|
map: !! material.map,
|
|
map: !! material.map,
|
|
- mapEncoding: getTextureEncodingFromMap( material.map ),
|
|
|
|
|
|
+ mapEncoding: getTextureEncodingFromMap( material.map, renderer.gammaInput ),
|
|
envMap: !! material.envMap,
|
|
envMap: !! material.envMap,
|
|
envMapMode: material.envMap && material.envMap.mapping,
|
|
envMapMode: material.envMap && material.envMap.mapping,
|
|
- envMapEncoding: getTextureEncodingFromMap( material.envMap ),
|
|
|
|
|
|
+ envMapEncoding: getTextureEncodingFromMap( material.envMap, renderer.gammaInput ),
|
|
lightMap: !! material.lightMap,
|
|
lightMap: !! material.lightMap,
|
|
aoMap: !! material.aoMap,
|
|
aoMap: !! material.aoMap,
|
|
emissiveMap: !! material.emissiveMap,
|
|
emissiveMap: !! material.emissiveMap,
|
|
- emissiveMapEncoding: getTextureEncodingFromMap( material.emissiveMap ),
|
|
|
|
|
|
+ emissiveMapEncoding: getTextureEncodingFromMap( material.emissiveMap, renderer.gammaInput ),
|
|
bumpMap: !! material.bumpMap,
|
|
bumpMap: !! material.bumpMap,
|
|
normalMap: !! material.normalMap,
|
|
normalMap: !! material.normalMap,
|
|
displacementMap: !! material.displacementMap,
|
|
displacementMap: !! material.displacementMap,
|