Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Water2: Fix encoding issue. #18894

Merged
merged 1 commit into from
Mar 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions examples/js/objects/Water2.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions examples/jsm/objects/Water2.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
Geometry,
Mesh,
Texture,
TextureEncoding,
Vector2
} from '../../../src/Three';

Expand All @@ -20,6 +21,7 @@ export interface WaterOptions {
flowMap?: Texture;
normalMap0?: Texture;
normalMap1?: Texture;
encoding?: TextureEncoding;
}

export class Water extends Mesh {
Expand Down
8 changes: 6 additions & 2 deletions examples/jsm/objects/Water2.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import {
Clock,
Color,
LinearEncoding,
Matrix4,
Mesh,
RepeatWrapping,
Expand Down Expand Up @@ -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();

Expand Down Expand Up @@ -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;
Expand Down