Browse Source

Water2: Fix encoding issue.

Mugen87 5 years ago
parent
commit
66cb65a72e

+ 5 - 2
examples/js/objects/Water2.js

@@ -26,6 +26,7 @@ THREE.Water = function ( geometry, options ) {
 	var reflectivity = options.reflectivity || 0.02;
 	var scale = options.scale || 1;
 	var shader = options.shader || THREE.Water.WaterShader;
+	var encoding = options.encoding !== undefined ? options.encoding : THREE.LinearEncoding;
 
 	var textureLoader = new THREE.TextureLoader();
 
@@ -57,13 +58,15 @@ THREE.Water = function ( geometry, options ) {
 	var reflector = new THREE.Reflector( geometry, {
 		textureWidth: textureWidth,
 		textureHeight: textureHeight,
-		clipBias: clipBias
+		clipBias: clipBias,
+		encoding: encoding
 	} );
 
 	var refractor = new THREE.Refractor( geometry, {
 		textureWidth: textureWidth,
 		textureHeight: textureHeight,
-		clipBias: clipBias
+		clipBias: clipBias,
+		encoding: encoding
 	} );
 
 	reflector.matrixAutoUpdate = false;

+ 2 - 0
examples/jsm/objects/Water2.d.ts

@@ -4,6 +4,7 @@ import {
 	Geometry,
 	Mesh,
 	Texture,
+	TextureEncoding,
 	Vector2
 } from '../../../src/Three';
 
@@ -20,6 +21,7 @@ export interface WaterOptions {
 	flowMap?: Texture;
 	normalMap0?: Texture;
 	normalMap1?: Texture;
+	encoding?: TextureEncoding;
 }
 
 export class Water extends Mesh {

+ 6 - 2
examples/jsm/objects/Water2.js

@@ -10,6 +10,7 @@
 import {
 	Clock,
 	Color,
+	LinearEncoding,
 	Matrix4,
 	Mesh,
 	RepeatWrapping,
@@ -42,6 +43,7 @@ var Water = function ( geometry, options ) {
 	var reflectivity = options.reflectivity || 0.02;
 	var scale = options.scale || 1;
 	var shader = options.shader || Water.WaterShader;
+	var encoding = options.encoding !== undefined ? options.encoding : LinearEncoding;
 
 	var textureLoader = new TextureLoader();
 
@@ -73,13 +75,15 @@ var Water = function ( geometry, options ) {
 	var reflector = new Reflector( geometry, {
 		textureWidth: textureWidth,
 		textureHeight: textureHeight,
-		clipBias: clipBias
+		clipBias: clipBias,
+		encoding: encoding
 	} );
 
 	var refractor = new Refractor( geometry, {
 		textureWidth: textureWidth,
 		textureHeight: textureHeight,
-		clipBias: clipBias
+		clipBias: clipBias,
+		encoding: encoding
 	} );
 
 	reflector.matrixAutoUpdate = false;