mirror of
https://github.com/overte-org/overte.git
synced 2025-04-14 07:27:04 +02:00
use array of colors
This commit is contained in:
parent
6e28538063
commit
8a02a585f2
1 changed files with 18 additions and 5 deletions
|
@ -3,7 +3,14 @@ var GRID_CONTROLS_HTML_URL = Script.resolvePath('../html/gridControls.html');
|
||||||
Grid = function(opts) {
|
Grid = function(opts) {
|
||||||
var that = {};
|
var that = {};
|
||||||
|
|
||||||
var gridColor = { red: 255, green: 255, blue: 255 };
|
var colors = [
|
||||||
|
{ red: 0, green: 0, blue: 0 },
|
||||||
|
{ red: 255, green: 255, blue: 255 },
|
||||||
|
{ red: 255, green: 0, blue: 0 },
|
||||||
|
{ red: 0, green: 255, blue: 0 },
|
||||||
|
{ red: 0, green: 0, blue: 255 },
|
||||||
|
];
|
||||||
|
var colorIndex = 0;
|
||||||
var gridAlpha = 0.6;
|
var gridAlpha = 0.6;
|
||||||
var origin = { x: 0, y: +MyAvatar.getJointPosition('LeftToeBase').y.toFixed(1) + 0.1, z: 0 };
|
var origin = { x: 0, y: +MyAvatar.getJointPosition('LeftToeBase').y.toFixed(1) + 0.1, z: 0 };
|
||||||
var scale = 500;
|
var scale = 500;
|
||||||
|
@ -21,7 +28,7 @@ Grid = function(opts) {
|
||||||
position: origin,
|
position: origin,
|
||||||
visible: false,
|
visible: false,
|
||||||
drawInFront: false,
|
drawInFront: false,
|
||||||
color: gridColor,
|
color: colors[0],
|
||||||
alpha: gridAlpha,
|
alpha: gridAlpha,
|
||||||
minorGridEvery: minorGridEvery,
|
minorGridEvery: minorGridEvery,
|
||||||
majorGridEvery: majorGridEvery,
|
majorGridEvery: majorGridEvery,
|
||||||
|
@ -45,6 +52,12 @@ Grid = function(opts) {
|
||||||
updateGrid();
|
updateGrid();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
that.getColorIndex = function() { return colorIndex; };
|
||||||
|
that.setColorIndex = function(value) {
|
||||||
|
colorIndex = value;
|
||||||
|
updateGrid();
|
||||||
|
};
|
||||||
|
|
||||||
that.getSnapToGrid = function() { return snapToGrid; };
|
that.getSnapToGrid = function() { return snapToGrid; };
|
||||||
that.setSnapToGrid = function(value) {
|
that.setSnapToGrid = function(value) {
|
||||||
snapToGrid = value;
|
snapToGrid = value;
|
||||||
|
@ -162,8 +175,8 @@ Grid = function(opts) {
|
||||||
majorGridEvery = data.majorGridEvery;
|
majorGridEvery = data.majorGridEvery;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.gridColor !== undefined) {
|
if (data.colorIndex !== undefined) {
|
||||||
gridColor = data.gridColor;
|
colorIndex = data.colorIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.gridSize) {
|
if (data.gridSize) {
|
||||||
|
@ -183,7 +196,7 @@ Grid = function(opts) {
|
||||||
visible: that.visible && that.enabled,
|
visible: that.visible && that.enabled,
|
||||||
minorGridEvery: minorGridEvery,
|
minorGridEvery: minorGridEvery,
|
||||||
majorGridEvery: majorGridEvery,
|
majorGridEvery: majorGridEvery,
|
||||||
color: gridColor,
|
color: colors[colorIndex],
|
||||||
alpha: gridAlpha,
|
alpha: gridAlpha,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue