-
Notifications
You must be signed in to change notification settings - Fork 1
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
Pass lights into the shader in drawObject.ts
.
#11
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
4d4fb80
Pass lights into the shader in `drawObject.ts`.
armcburney fb4c21c
Don't use template string when there's no template variables.
armcburney 5255c53
Added ways to add and remove lights in `Renderer` class.
armcburney b13dbfc
Merge remote-tracking branch 'upstream/master' into lights_in_shader
armcburney 5abdc4f
Updated renderer add/remove to take in `Light`. Added test suite for …
armcburney 3209520
Fixed `src/examples/render.ts` by adding light to `this.lights`.
armcburney 024db77
Mark failing tests as pending.
armcburney 2981d7b
Updated example to include multiple light sources.
armcburney 11e9de5
Removed unused `maxLights` prop in `Renderer` class.
armcburney File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,6 +41,7 @@ | |
"gl-matrix": "^2.5.1", | ||
"lodash": "^4.17.10", | ||
"regl": "^1.3.1", | ||
"ts-sinon": "^1.0.12", | ||
"tslib": "~1.9.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import REGL = require('regl'); | ||
|
||
export interface Light { | ||
lightPosition: REGL.Vec3[]; | ||
lightColor: REGL.Vec3[]; | ||
lightIntensity: number; | ||
} | ||
|
||
export const blankLight: Light = { | ||
lightPosition: [0, 0, 0], | ||
lightColor: [0, 0, 0], | ||
lightIntensity: 0 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { Light } from '../../src/renderer/interfaces/Light'; | ||
import { Renderer } from '../../src/renderer/Renderer'; | ||
|
||
describe('Renderer', () => { | ||
const maxLights: number = 3; | ||
const light: Light = { | ||
lightPosition: [1, 1, 1], | ||
lightColor: [0, 0, 0], | ||
lightIntensity: 256 | ||
} | ||
|
||
xdescribe('addLight', () => { | ||
it('can append a new light to the `lights` array', () => { | ||
const renderer: Renderer = new Renderer(800, 600, maxLights); | ||
expect(renderer.getLights().length).toEqual(0); | ||
renderer.addLight(light); | ||
expect(renderer.getLights().length).toEqual(1); | ||
|
||
}); | ||
}); | ||
|
||
xdescribe('removeLight', () => { | ||
it('can remove an existing light from the `lights` array', () => { | ||
const renderer: Renderer = new Renderer(800, 600, maxLights); | ||
renderer.addLight(light); | ||
expect(renderer.getLights().length).toEqual(1); | ||
renderer.removeLight(light); | ||
expect(renderer.getLights().length).toEqual(0); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#20