From 5132406d3774d565848a35b8711fa44da90faf6b Mon Sep 17 00:00:00 2001 From: ericrius1 Date: Thu, 21 Jan 2016 10:51:15 -0800 Subject: [PATCH] Test script for lod testing --- examples/tests/sphereLODTest.js | 66 +++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 examples/tests/sphereLODTest.js diff --git a/examples/tests/sphereLODTest.js b/examples/tests/sphereLODTest.js new file mode 100644 index 0000000000..dc19094664 --- /dev/null +++ b/examples/tests/sphereLODTest.js @@ -0,0 +1,66 @@ +// +// sphereLodTest.js +// examples/tests +// +// Created by Eric Levin on 1/21/16. +// Copyright 2016 High Fidelity, Inc. + +// A test script for testing LODing of sphere entities and sphere overlays +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// + +MyAvatar.orientation = Quat.fromPitchYawRollDegrees(0, 0, 0); +orientation = Quat.safeEulerAngles(MyAvatar.orientation); +orientation.x = 0; +orientation = Quat.fromVec3Degrees(orientation); +var tablePosition = Vec3.sum(MyAvatar.position, Quat.getFront(orientation)); +tablePosition.y += 0.5; + + +var tableDimensions = { + x: 1, + y: 0.2, + z: 1 +}; +var table = Entities.addEntity({ + type: "Box", + position: tablePosition, + dimensions: tableDimensions, + color: { + red: 70, + green: 21, + blue: 21 + } +}); + + +var sphereDimensions = {x: 0.01, y: 0.01, z: 0.01}; +var entitySpherePosition = Vec3.sum(tablePosition, {x: 0, y: tableDimensions.y/2 + sphereDimensions.y/2, z: 0}); +var entitySphere = Entities.addEntity({ + type: "Sphere", + position: entitySpherePosition, + color: {red: 200, green: 20, blue: 200}, + dimensions: sphereDimensions +}); + +var overlaySpherePosition = Vec3.sum(tablePosition, {x: sphereDimensions.x, y: tableDimensions.y/2 + sphereDimensions.y/2, z: 0}); +var overlaySphere = Overlays.addOverlay("sphere", { + position: overlaySpherePosition, + size: 0.01, + color: { red: 20, green: 200, blue: 0}, + alpha: 1.0, + solid: true, +}); + + + +function cleanup() { + Entities.deleteEntity(table); + Entities.deleteEntity(entitySphere); + Overlays.deleteOverlay(overlaySphere); + + +} +Script.scriptEnding.connect(cleanup); \ No newline at end of file