Skip to content

Commit

Permalink
Merge pull request #12635 from Mugen87/dev9
Browse files Browse the repository at this point in the history
Examples: Clean up Refractor and Water (see #12631)
  • Loading branch information
mrdoob authored Nov 15, 2017
2 parents c359414 + f918df2 commit 3f57465
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 11 deletions.
4 changes: 2 additions & 2 deletions examples/js/objects/Water.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
* @author Jonas Wagner / http://29a.ch/ && http://29a.ch/slides/2012/webglwater/ : Water shader explanations in WebGL
*/

THREE.Water = function ( width, height, options ) {
THREE.Water = function ( geometry, options ) {

THREE.Mesh.call( this, new THREE.PlaneBufferGeometry( width, height ) );
THREE.Mesh.call( this, geometry );

var scope = this;

Expand Down
8 changes: 4 additions & 4 deletions examples/js/objects/Water2.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
*
*/

THREE.Water = function ( width, height, options ) {
THREE.Water = function ( geometry, options ) {

THREE.Mesh.call( this, new THREE.PlaneBufferGeometry( width, height ) );
THREE.Mesh.call( this, geometry );

this.type = 'Water';

Expand Down Expand Up @@ -54,13 +54,13 @@ THREE.Water = function ( width, height, options ) {

}

var reflector = new THREE.Reflector( width, height, {
var reflector = new THREE.Reflector( geometry, {
textureWidth: textureWidth,
textureHeight: textureHeight,
clipBias: clipBias
} );

var refractor = new THREE.Refractor( width, height, {
var refractor = new THREE.Refractor( geometry, {
textureWidth: textureWidth,
textureHeight: textureHeight,
clipBias: clipBias
Expand Down
4 changes: 3 additions & 1 deletion examples/webgl_refraction.html
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@

// refractor

refractor = new THREE.Refractor( 10, 10, {
var refractorGeometry = new THREE.PlaneBufferGeometry( 10, 10 );

refractor = new THREE.Refractor( refractorGeometry, {
color: 0x999999,
textureWidth: 1024,
textureHeight: 1024,
Expand Down
5 changes: 3 additions & 2 deletions examples/webgl_shaders_ocean.html
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,10 @@

function setWater() {

var waterGeometry = new THREE.PlaneBufferGeometry( parameters.oceanSide * 5, parameters.oceanSide * 5 );

water = new THREE.Water(
parameters.oceanSide * 5,
parameters.oceanSide * 5,
waterGeometry,
{
textureWidth: 512,
textureHeight: 512,
Expand Down
4 changes: 3 additions & 1 deletion examples/webgl_water.html
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,9 @@

// water

water = new THREE.Water( 20, 20, {
var waterGeometry = new THREE.PlaneBufferGeometry( 20, 20 );

water = new THREE.Water( waterGeometry, {
color: params.color,
scale: params.scale,
flowDirection: new THREE.Vector2( params.flowX, params.flowY ),
Expand Down
3 changes: 2 additions & 1 deletion examples/webgl_water_flowmap.html
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,10 @@

// water

var waterGeometry = new THREE.PlaneBufferGeometry( 20, 20 );
var flowMap = textureLoader.load( 'textures/water/Water_1_M_Flow.jpg' );

water = new THREE.Water( 20, 20, {
water = new THREE.Water( waterGeometry, {
scale: 2,
textureWidth: 1024,
textureHeight: 1024,
Expand Down

0 comments on commit 3f57465

Please sign in to comment.