Skip to content

Commit

Permalink
[BREAKING] Remove StandardMaterial.emissiveTint and simply always app…
Browse files Browse the repository at this point in the history
…ly it (#6762)

* [BREAKING] Remove StandardMaterial.emissiveTint and simply always apply it

* docs

* added warnOnce

* Update src/scene/materials/standard-material.js

Co-authored-by: Will Eastcott <[email protected]>

---------

Co-authored-by: Martin Valigursky <[email protected]>
Co-authored-by: Will Eastcott <[email protected]>
  • Loading branch information
3 people authored Jul 9, 2024
1 parent 9304113 commit ac394e5
Show file tree
Hide file tree
Showing 22 changed files with 170 additions and 1,145 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ assetListLoader.load(() => {
const gameScreenMaterial = gameScreen.render.material;
gameScreenMaterial.diffuse = pc.Color.BLACK;
gameScreenMaterial.emissiveMap = outputTexture;
gameScreenMaterial.emissive = pc.Color.WHITE;
gameScreenMaterial.useLighting = false;
gameScreenMaterial.update();
app.root.addChild(gameScreen);
Expand Down
1 change: 1 addition & 0 deletions examples/src/examples/graphics/mesh-decals.example.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ assetListLoader.load(() => {
material.blendType = pc.BLEND_ADDITIVEALPHA; // additive alpha blend
material.depthWrite = false; // optimization - no need to write to depth buffer, as decals are part of the ground plane
material.emissiveMap = assets.heart.resource;
material.emissive = pc.Color.WHITE;
material.opacityMap = assets.heart.resource;
material.depthBias = -0.1; // depth biases to avoid z-fighting with ground plane
material.slopeDepthBias = -0.1;
Expand Down
5 changes: 3 additions & 2 deletions examples/src/examples/graphics/painter.example.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ app.on('destroy', () => {
*/
function createPrimitive(primitiveType, position, scale, layer, material) {
// create primitive
const primitive = new pc.Entity();
const primitive = new pc.Entity(`Brush-${primitiveType}`);
primitive.addComponent('render', {
type: primitiveType,
layers: layer,
Expand Down Expand Up @@ -91,7 +91,6 @@ app.scene.layers.insert(paintLayer, 0);

// create a material we use for the paint brush - it uses emissive color to control its color, which is assigned later
const brushMaterial = new pc.StandardMaterial();
brushMaterial.emissiveTint = true;
brushMaterial.useLighting = false;
brushMaterial.update();

Expand Down Expand Up @@ -141,7 +140,9 @@ app.root.addChild(camera);

// material used to add render target into the world
const material = new pc.StandardMaterial();
material.name = 'EmissiveMaterial';
material.emissiveMap = texture;
material.emissive = pc.Color.WHITE;
material.useLighting = false;
material.update();

Expand Down
1 change: 1 addition & 0 deletions examples/src/examples/graphics/reflection-box.example.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ assetListLoader.load(() => {
const screenMaterial = new pc.StandardMaterial();
screenMaterial.useLighting = false;
screenMaterial.emissiveMap = videoTexture;
screenMaterial.emissive = pc.Color.WHITE;
screenMaterial.update();

/**
Expand Down
2 changes: 2 additions & 0 deletions examples/src/examples/graphics/render-to-texture.example.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -247,9 +247,11 @@ assetListLoader.load(() => {
tv.setLocalEulerAngles(90, 0, 0);
tv.render.castShadows = false;
tv.render.receiveShadows = false;

/** @type {pc.StandardMaterial} */
const material = tv.render.material;
material.emissiveMap = texture; // assign the rendered texture as an emissive texture
material.emissive = pc.Color.WHITE;
material.update();

// setup skydome, use top mipmap level of cubemap (full resolution)
Expand Down
1 change: 0 additions & 1 deletion examples/src/examples/graphics/texture-basis.example.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ assetListLoader.load(() => {
// Construct material
const material = new pc.StandardMaterial();
material.useMetalness = true;
material.diffuse = new pc.Color(0.3, 0.3, 0.3);
material.gloss = 0.8;
material.metalness = 0.7;
material.diffuseMap = assets.color.resource;
Expand Down
1 change: 1 addition & 0 deletions examples/src/examples/graphics/video-texture.example.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ assetListLoader.load(() => {
const material = new pc.StandardMaterial();
material.useLighting = false;
material.emissiveMap = videoTexture;
material.emissive = pc.Color.WHITE;
material.update();

// set the material on the screen mesh
Expand Down
Loading

0 comments on commit ac394e5

Please sign in to comment.