Skip to content
Snippets Groups Projects
Commit 7518c701 authored by Matthias Konitzny's avatar Matthias Konitzny :fire:
Browse files

Added default node texture (all nodes are now clickable again :) ).

parent 58fdf41a
No related branches found
No related tags found
No related merge requests found
datasets/images/default.jpg

10.9 KiB

......@@ -80,22 +80,33 @@ function drawNode(node) {
const cssobj = new THREE.CSS3DSprite(nodeDiv);
cssobj.scale.set(0.25, 0.25, 0.25);
cssobj.position.set(0, -6, 0);
group.add(cssobj)
// Draw node circle image
const textureLoader = new THREE.TextureLoader();
const imageAlpha = textureLoader.load(plugin_path + 'datasets/images/alpha.png');
let imageTexture = null;
if ('image' in node) {
imageTexture = textureLoader.load(plugin_path + 'datasets/images/' + node.image);
} else {
imageTexture = textureLoader.load(plugin_path + 'datasets/images/default.jpg');
}
const material = new THREE.SpriteMaterial({map: imageTexture, alphaMap: imageAlpha, transparent: true,
alphaTest: 0.2, depthWrite:false, depthTest: false});
const sprite = new THREE.Sprite(material);
sprite.renderOrder = 999; // This may not be optimal. But it allows us to render the sprite on top of everything else.
if ('image' in node) {
cssobj.position.set(0, -7, 0);
const textureLoader = new THREE.TextureLoader();
const imageTexture = textureLoader.load(plugin_path + 'datasets/images/' + node.image);
const imageAlpha = textureLoader.load(plugin_path + 'datasets/images/alpha.png');
const material = new THREE.SpriteMaterial({map: imageTexture, alphaMap: imageAlpha, transparent: true,
alphaTest: 0.2, depthWrite:false, depthTest: false});
const sprite = new THREE.Sprite(material);
sprite.renderOrder = 999; // This may not be optimal. But it allows us to render the sprite on top of everything else.
sprite.scale.set(20, 20);
group.add(sprite)
} else {
sprite.scale.set(5, 5);
}
group.add(cssobj)
group.add(sprite)
return group;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment