mirror of
https://github.com/overte-org/overte.git
synced 2025-04-11 16:03:24 +02:00
Merge pull request #6883 from ericrius1/sphereLOD
Test script for lod testing of sphere entities and sphere overlays
This commit is contained in:
commit
398296c874
1 changed files with 66 additions and 0 deletions
66
examples/tests/sphereLODTest.js
Normal file
66
examples/tests/sphereLODTest.js
Normal file
|
@ -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);
|
Loading…
Reference in a new issue