content/hifi-content/sabrina/res4kArt3mis.js
2022-02-14 02:04:11 +01:00

36 lines
1.5 KiB
JavaScript

// Adapted from Andrew's res1kboxes script
var LIFETIME = 60; // 1 min
var properties = {
type: "Model",
name: "Art3mis",
modelURL: "https://raw.githubusercontent.com/highfidelity/hifi_tests/master/assets/models/geometry/avatars/art3mis/art3mis.fst",
position: { x: 0, y: 0, z: 0 },
dimensions: { x: 0.5, y: 0.5, z: 0.5 },
lifetime: LIFETIME,
color: { red: 255, green: 255, blue: 255 }
};
var numClones = 20;
var stride = 5.0;
var positionOffsetLength = -0.5 * ((numClones + 1) * stride);
var positionOffset = Vec3.sum(MyAvatar.position, { x: positionOffsetLength, y: positionOffsetLength, z: positionOffsetLength });
var white = { red: 255, green: 255, blue: 255 };
for (var i = 0; i < numClones; ++i) {
var red = 255 * i / numClones;
for (var j = 0; j < numClones; ++j) {
var green = 255 * j / numClones;
for (var k = 0; k < numClones; ++k) {
var blue = 255 * k / numClones;
var color = { red: red, green: green, blue: blue };
if (i == 0 || j == 0 || k == 0 || i == numClones-1 || j == numClones-1 || k == numClones-1) {
color = white;
}
properties.position = { x: positionOffset.x + i * stride, y: positionOffset.y + j * stride, z: positionOffset.z + k * stride };
properties.color = color;
properties.name = "Art3mis<" + i + "," + j + "," + k + ">";
Entities.addEntity(properties);
}
}
}