Skip to content
This repository has been archived by the owner on Apr 12, 2023. It is now read-only.

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
avirankatzsofi committed Oct 4, 2020
2 parents 0bfe696 + db861ed commit f340709
Show file tree
Hide file tree
Showing 25 changed files with 736 additions and 696 deletions.
10 changes: 10 additions & 0 deletions css/dpt3d.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion css/dpt3d.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions css/dpt_bright.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions css/dpt_classic.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions css/dpt_dark.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions css/dpt_linden.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions css/dpt_love.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions css/dpt_mc.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions css/guided-tour.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion css/guided-tour.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

47 changes: 1 addition & 46 deletions html/babylon-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ function getCollisionBox() {
var mat = new BABYLON.StandardMaterial("mat", currentScene);
mat.diffuseColor = new BABYLON.Color3(10 / 255, 80 / 255, 119 / 255);
mat.specularColor = new BABYLON.Color3(10 / 255, 80 / 255, 119 / 255);
//mat.Color = new BABYLON.Color3(10 / 255, 80 / 255, 119 / 255);
mat.emissiveColor = new BABYLON.Color3(10 / 255, 80 / 255, 119 / 255);
mat.alpha = 0.45;

Expand All @@ -89,7 +88,7 @@ function getCollisionBox() {
return(box);
}

function getCamera(rotate) {
function getCamera() {

var camera = new BABYLON.ArcRotateCamera(
"Camera",
Expand Down Expand Up @@ -328,55 +327,11 @@ var createGenericScene = function(dptMode) {
powerSave = false;
switch (kbInfo.type) {
case BABYLON.KeyboardEventTypes.KEYDOWN:
/*
console.log("KEY DOWN: ", kbInfo.event.key);
var speed = camera._computeLocalCameraSpeed() * 20;
if(kbInfo.event.key == 'PageUp') {
camera._localDirection.copyFromFloats(0, 0, speed);
camera.position.z += speed;
console.log('fuck: '+speed);
}
*/
break;
case BABYLON.KeyboardEventTypes.KEYUP:
//console.log("KEY UP: ", kbInfo.event.keyCode);
/*
switch(kbInfo.event.code) {
case "KeyF":
requestSearch();
break;
case "KeyH":
switchToTopics();
break;
case "KeyL":
toggleDialogList();
break;
case "KeyO":
if(currentScene.name == "opinionScene") {
jQuery('#form').remove();
dpt.opinionPostAllowed(currentTopic);
}
break;
case "KeyT":
if(currentScene.name == "topicScene") {
jQuery('#form').remove();
topicForm();
}
break;
}
*/
}
});


//var gl = new BABYLON.GlowLayer("glow", currentScene);

//currentScene.autoClear = false; // Color buffer
//currentScene.autoClearDepthAndStencil = false; // Depth and stencil, obviously
//currentScene.getAnimationRatio();
//currentScene.clearCachedVertexData();
//currentScene.cleanCachedTextureBuffer();

return currentScene;
}

Expand Down
101 changes: 23 additions & 78 deletions html/babylon-misc.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,67 +21,6 @@ function circleText(ctx, text, x, y, radius, angle) {
ctx.restore();
}

function circleTextPlane(x, y, z, name, text) {
//Set width an height for plane
var planeWidth = 12;
var planeHeight = 12; //10;

//Create plane
var plane = BABYLON.MeshBuilder.CreatePlane(
name, {
width: planeWidth,
height: planeHeight
}, currentScene);
plane.dpt = JSON.parse('{"context": "topicCircle"}');

//Set width and height for dynamic texture using same multiplier
var DTWidth = planeWidth * 100; //64;
var DTHeight = planeHeight * 100; //64

var dynamicTexture = new BABYLON.DynamicTexture(
"DynamicTexture",
{
width: DTWidth,
height: DTHeight
}, currentScene);

//Check width of text for given font type at any size of font
var ctx = dynamicTexture.getContext();

dynamicTexture.hasAlpha = true;
ctx.fillStyle = 'transparent';

textureContext = dynamicTexture.getContext();
textureContext.font = "28px DPTFont";
textureContext.save();
textureContext.fillStyle = "#00ccff";

circleText(textureContext, text, 600, 600, 550, -Math.PI / 3)
// textureContext.scale(3, 3);
textureContext.restore();

dynamicTexture.update();

//create material
var mat = new BABYLON.StandardMaterial("mat", currentScene);
mat.diffuseTexture = dynamicTexture;
mat.emissiveColor = new BABYLON.Color3(1, 1, 1);

//apply material
plane.material = mat;
//mat.freeze();

// set the position
plane.position.x = x + 2;
plane.position.y = y;
plane.position.z = z;

plane.scaling.x *= 1.5;
plane.scaling.y *= 1.5;
//plane.doNotSyncBoundingInfo = true
//plane.freezeWorldMatrix();
return (plane);
}

function circlePoints(points, radius, center) {
var slice = 2 * Math.PI / points;
Expand All @@ -95,23 +34,6 @@ function circlePoints(points, radius, center) {
var newX = center.X + radius * Math.cos(angle);
var newY = center.Y + radius * Math.sin(angle);
nodes.push({ x: newX, y: newY });
/*
var box = new BABYLON.MeshBuilder.CreateBox("box", {
width: 0.1,
height: 0.1,
depth: 0.1,
sideOrientation: 1
}, currentScene);
box.position = new BABYLON.Vector3(newX, newY, -1);
//create material
var mat = new BABYLON.StandardMaterial("mat", currentScene);
mat.diffuseColor = new BABYLON.Color3(1,.5,0);
mat.emissiveColor = new BABYLON.Color3(1,.5,0);
//apply material
box.material = mat;
mat.freeze();
*/
}
return (nodes);
}
Expand Down Expand Up @@ -266,6 +188,26 @@ function textBlock(x, y, z, name, text, options) {
}, currentScene);
plane.dpt = dpt;

//plane actionManager to handle hover effect
plane.actionManager = new BABYLON.ActionManager(currentScene);

// bold ON MOUSE ENTER
plane.actionManager.registerAction(
new BABYLON.ExecuteCodeAction(BABYLON.ActionManager.OnPointerOverTrigger,
function(ev) {
// var driver = new Driver()
// driver.highlight(".btn-bar-icon")
var meshLocal = ev.meshUnderPointer;
canvas.style.cursor = "move";
}, false));

// normal ON MOUSE EXIT
plane.actionManager.registerAction(
new BABYLON.ExecuteCodeAction(BABYLON.ActionManager.OnPointerOutTrigger,
function(ev) {
var meshLocal = ev.meshUnderPointer;
canvas.style.cursor = "default";
}, false));
// var pngBase64 = textureContext.canvas.toDataURL("image/png", 0.99);

plane.bjs = {
Expand Down Expand Up @@ -297,6 +239,9 @@ function textBlock(x, y, z, name, text, options) {
//plane.bakeCurrentTransformIntoVertices();

plane.doNotSyncBoundingInfo = false;



//plane.freezeWorldMatrix();
return (plane);
}
Loading

0 comments on commit f340709

Please sign in to comment.