Skip to content

Commit 78cf501

Browse files
committed
Update gradient exponent
1 parent 2a7afd2 commit 78cf501

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

README.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -506,22 +506,28 @@ Disposes of the temporary files and textures for generation.
506506

507507
## GradientEquirectMap
508508

509+
### .exponent
510+
511+
```js
512+
exponent = 2 : Number
513+
```
514+
509515
### .topColor
510516

511517
```js
512-
topColor : Color
518+
topColor = 0xffffff : Color
513519
```
514520

515521
### .bottomColor
516522

517523
```js
518-
bottomColor : Color
524+
bottomColor = 0x000000 : Color
519525
```
520526

521527
### constructor
522528

523529
```js
524-
constructor( topColor = 0xffffff, bottomColor = 0x000000, resolution = 512 )
530+
constructor( resolution = 512 : Number )
525531
```
526532

527533
### .update
@@ -645,7 +651,7 @@ setTextures(
645651
) : void
646652
```
647653

648-
Takes the rendering context to updateh the target for, the target dimensions of the texture array, and the array of textures to render into the 2D texture array. Every texture is stretched to the dimensions of the texture array at the same index they are provided in.
654+
Takes the rendering context to update the target for, the target dimensions of the texture array, and the array of textures to render into the 2D texture array. Every texture is stretched to the dimensions of the texture array at the same index they are provided in.
649655

650656
## PhysicalCameraUniform
651657

src/textures/GradientEquirectTexture.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,19 @@ import { ProceduralEquirectTexture } from './ProceduralEquirectTexture.js';
44
const _direction = new Vector3();
55
export class GradientEquirectTexture extends ProceduralEquirectTexture {
66

7-
constructor( topColor = 0xffffff, bottomColor = 0, resolution = 512 ) {
7+
constructor( resolution = 512 ) {
88

99
super( resolution, resolution );
1010

11-
this.topColor = new Color().set( topColor );
12-
this.bottomColor = new Color().set( bottomColor );
11+
this.topColor = new Color().set( 0xffffff );
12+
this.bottomColor = new Color().set( 0x000000 );
13+
this.exponent = 2;
1314
this.generationCallback = ( polar, uv, coord, color ) => {
1415

1516
_direction.setFromSpherical( polar );
1617

1718
const t = _direction.y * 0.5 + 0.5;
18-
color.lerpColors( this.bottomColor, this.topColor, t );
19+
color.lerpColors( this.bottomColor, this.topColor, t ** this.exponent );
1920

2021
};
2122

0 commit comments

Comments
 (0)