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

Export gouraud lighting module #1018

Merged
merged 3 commits into from Mar 29, 2019
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions modules/core/src/index.js
Expand Up @@ -145,6 +145,7 @@ export {
dirlight,
picking,
diffuse,
gouraudlighting,
phonglighting,
// experimental
_transform,
Expand Down
2 changes: 1 addition & 1 deletion modules/shadertools/src/index.js
Expand Up @@ -31,7 +31,7 @@ export {default as lights} from './modules/lights/lights';
export {default as dirlight} from './modules/dirlight/dirlight';
export {default as picking} from './modules/picking/picking';
export {default as diffuse} from './modules/diffuse/diffuse';
export {default as phonglighting} from './modules/phong-lighting/phong-lighting';
export {gouraudlighting, phonglighting} from './modules/phong-lighting/phong-lighting';
export {default as pbr} from './modules/pbr/pbr';

// experimental
Expand Down
16 changes: 14 additions & 2 deletions modules/shadertools/src/modules/phong-lighting/phong-lighting.js
@@ -1,8 +1,8 @@
import lights from '../lights/lights';
import lightingShader from './phong-lighting.glsl';

export default {
name: 'phong-lighting',
const gouraudlighting = {
name: 'gouraud-lighting',
dependencies: [lights],
vs: lightingShader,
defines: {
Expand All @@ -11,6 +11,16 @@ export default {
getUniforms
};

const phonglighting = {
name: 'phong-lighting',
dependencies: [lights],
fs: lightingShader,
defines: {
LIGHTING_FRAGMENT: 1
},
getUniforms
};

const INITIAL_MODULE_OPTIONS = {};

function getMaterialUniforms(material) {
Expand All @@ -35,3 +45,5 @@ function getUniforms(opts = INITIAL_MODULE_OPTIONS) {

return Object.assign({}, getMaterialUniforms(material), {lighting_uEnabled: true});
}

export {gouraudlighting, phonglighting};
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -61,7 +61,7 @@
"eslint-plugin-tree-shaking": "^1.7.3",
"gl": "^4.1.1",
"mkdirp": "^0.5.1",
"ocular-dev-tools": "0.0.17",
"ocular-dev-tools": "0.0.18",
"pre-commit": "^1.2.2",
"pre-push": "^0.1.1",
"raw-loader": "^0.5.1",
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Expand Up @@ -5902,10 +5902,10 @@ obuf@^1.0.0, obuf@^1.1.2:
resolved "https://registry.yarnpkg.com/obuf/-/obuf-1.1.2.tgz#09bea3343d41859ebd446292d11c9d4db619084e"
integrity sha512-PX1wu0AmAdPqOL1mWhqmlOd8kOIZQwGZw6rh7uby9fTc5lhaOWFLX3I6R1hrF9k3zUY40e6igsLGkDXK92LJNg==

ocular-dev-tools@0.0.17:
version "0.0.17"
resolved "https://registry.yarnpkg.com/ocular-dev-tools/-/ocular-dev-tools-0.0.17.tgz#fdadd4b8ff0f92610f29cc668e3f7024f94ae62c"
integrity sha512-KHcgHAXxXY+tzacrznkbgjLBcgdR9/26UoNySy5MRXvJLT6s7ilDOQ6kIgZNnwrsLy7miLGraa/NTQ7E2GV3lQ==
ocular-dev-tools@0.0.18:
version "0.0.18"
resolved "https://registry.yarnpkg.com/ocular-dev-tools/-/ocular-dev-tools-0.0.18.tgz#cef24f308076fc765556a9bbdd79fde7a3f46d45"
integrity sha512-3kwimmRPbaacpXrggKPXakFOL0JjbK9py5/nsO87tQAqi0gkHAVgEr1YmYsnnwPLuhFWVKVYrI+YtAMXg4JUMA==
dependencies:
"@babel/cli" "^7.0.0"
"@babel/core" "^7.0.0"
Expand Down