Skip to content

Commit

Permalink
v1.4.2 Introduced transparent background
Browse files Browse the repository at this point in the history
  • Loading branch information
adizanni committed Apr 30, 2022
1 parent 96f8acd commit eab3285
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 10 deletions.
2 changes: 1 addition & 1 deletion dist/floor3d-card.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "floor3d-card",
"version": "1.4.1-hf2",
"version": "1.4.2",
"description": "Lovelace floor3d-card",
"keywords": [
"home-assistant",
Expand Down
2 changes: 1 addition & 1 deletion src/const.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const CARD_VERSION = '1.4.1-hf2';
export const CARD_VERSION = '1.4.2';
21 changes: 14 additions & 7 deletions src/floor3d-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1150,16 +1150,12 @@ export class Floor3dCard extends LitElement {
//create and initialize scene and camera

this._scene = new THREE.Scene();
if (this._config.backgroundColor && this._config.backgroundColor != '#000000') {
this._scene.background = new THREE.Color(this._config.backgroundColor);
} else {
this._scene.background = new THREE.Color('#aaaaaa');
}

this._camera = new THREE.PerspectiveCamera(45, 1, 0.1, 10000);

// create and initialize renderer

this._renderer = new THREE.WebGLRenderer({ antialias: true, logarithmicDepthBuffer: true });
this._renderer = new THREE.WebGLRenderer({ antialias: true, logarithmicDepthBuffer: true, alpha: true });
this._maxtextureimage = this._renderer.capabilities.maxTextures;
console.log('Max Texture Image Units: ' + this._maxtextureimage);
console.log('Max Texture Image Units: number of lights casting shadow should be less than the above number');
Expand All @@ -1170,6 +1166,17 @@ export class Floor3dCard extends LitElement {
this._renderer.domElement.style.height = '100%';
this._renderer.domElement.style.display = 'block';

if (this._config.backgroundColor) {
if (this._config.backgroundColor == 'transparent') {
this._renderer.setClearColor(0x000000, 0);
} else {
this._scene.background = new THREE.Color(this._config.backgroundColor);
}
} else {
this._scene.background = new THREE.Color('#aaaaaa');
}


//this._renderer.physicallyCorrectLights = true;
if (this._config.sky && this._config.sky == 'yes') {
this._renderer.outputEncoding = THREE.sRGBEncoding;
Expand All @@ -1183,7 +1190,7 @@ export class Floor3dCard extends LitElement {

if (this._config.path && this._config.path != '') {
let path = this._config.path;
const lastChar = path.substr(-1);
const lastChar = path.charAt(path.length - 1);
if (lastChar == '.') {
path = '';
} else if (lastChar != '/') {
Expand Down

0 comments on commit eab3285

Please sign in to comment.