Skip to content

Commit

Permalink
Merge pull request mrdoob#18709 from Mugen87/dev43
Browse files Browse the repository at this point in the history
Examples: Add possibility to set encoding for Reflector/Refractor.
  • Loading branch information
mrdoob authored Feb 25, 2020
2 parents 44361a9 + 40fed76 commit cf6f798
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 4 deletions.
4 changes: 3 additions & 1 deletion examples/js/objects/Reflector.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ THREE.Reflector = function ( geometry, options ) {
var clipBias = options.clipBias || 0;
var shader = options.shader || THREE.Reflector.ReflectorShader;
var recursion = options.recursion !== undefined ? options.recursion : 0;
var encoding = options.encoding !== undefined ? options.encoding : THREE.LinearEncoding;

//

Expand All @@ -40,7 +41,8 @@ THREE.Reflector = function ( geometry, options ) {
minFilter: THREE.LinearFilter,
magFilter: THREE.LinearFilter,
format: THREE.RGBFormat,
stencilBuffer: false
stencilBuffer: false,
encoding: encoding
};

var renderTarget = new THREE.WebGLRenderTarget( textureWidth, textureHeight, parameters );
Expand Down
4 changes: 3 additions & 1 deletion examples/js/objects/Refractor.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ THREE.Refractor = function ( geometry, options ) {
var textureHeight = options.textureHeight || 512;
var clipBias = options.clipBias || 0;
var shader = options.shader || THREE.Refractor.RefractorShader;
var encoding = options.encoding !== undefined ? options.encoding : THREE.LinearEncoding;

//

Expand All @@ -36,7 +37,8 @@ THREE.Refractor = function ( geometry, options ) {
minFilter: THREE.LinearFilter,
magFilter: THREE.LinearFilter,
format: THREE.RGBFormat,
stencilBuffer: false
stencilBuffer: false,
encoding: encoding
};

var renderTarget = new THREE.WebGLRenderTarget( textureWidth, textureHeight, parameters );
Expand Down
2 changes: 2 additions & 0 deletions examples/jsm/objects/Reflector.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {
Mesh,
BufferGeometry,
Color,
TextureEncoding,
WebGLRenderTarget
} from '../../../src/Three';

Expand All @@ -12,6 +13,7 @@ export interface ReflectorOptions {
clipBias?: number;
shader?: object;
recursion?: number;
encoding?: TextureEncoding;
}

export class Reflector extends Mesh {
Expand Down
5 changes: 4 additions & 1 deletion examples/jsm/objects/Reflector.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import {
Color,
LinearEncoding,
LinearFilter,
MathUtils,
Matrix4,
Expand Down Expand Up @@ -34,6 +35,7 @@ var Reflector = function ( geometry, options ) {
var clipBias = options.clipBias || 0;
var shader = options.shader || Reflector.ReflectorShader;
var recursion = options.recursion !== undefined ? options.recursion : 0;
var encoding = options.encoding !== undefined ? options.encoding : LinearEncoding;

//

Expand All @@ -56,7 +58,8 @@ var Reflector = function ( geometry, options ) {
minFilter: LinearFilter,
magFilter: LinearFilter,
format: RGBFormat,
stencilBuffer: false
stencilBuffer: false,
encoding: encoding
};

var renderTarget = new WebGLRenderTarget( textureWidth, textureHeight, parameters );
Expand Down
2 changes: 2 additions & 0 deletions examples/jsm/objects/Refractor.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {
Mesh,
BufferGeometry,
Color,
TextureEncoding,
WebGLRenderTarget
} from '../../../src/Three';

Expand All @@ -11,6 +12,7 @@ export interface RefractorOptions {
textureHeight?: number;
clipBias?: number;
shader?: object;
encoding?: TextureEncoding;
}

export class Refractor extends Mesh {
Expand Down
5 changes: 4 additions & 1 deletion examples/jsm/objects/Refractor.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import {
Color,
LinearEncoding,
LinearFilter,
MathUtils,
Matrix4,
Expand Down Expand Up @@ -35,6 +36,7 @@ var Refractor = function ( geometry, options ) {
var textureHeight = options.textureHeight || 512;
var clipBias = options.clipBias || 0;
var shader = options.shader || Refractor.RefractorShader;
var encoding = options.encoding !== undefined ? options.encoding : LinearEncoding;

//

Expand All @@ -53,7 +55,8 @@ var Refractor = function ( geometry, options ) {
minFilter: LinearFilter,
magFilter: LinearFilter,
format: RGBFormat,
stencilBuffer: false
stencilBuffer: false,
encoding: encoding
};

var renderTarget = new WebGLRenderTarget( textureWidth, textureHeight, parameters );
Expand Down

0 comments on commit cf6f798

Please sign in to comment.