content/hifi-content/thoys/dev/2017/voxelPaintImprovements/voxel-paint-shared.js
2022-02-14 02:04:11 +01:00

317 lines
10 KiB
JavaScript

//
// Created by Thijs Wenker on 4/3/2017
// Copyright 2017 High Fidelity, Inc.
//
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
/* global module */
var DEFAULT_COLOR_DIMENSIONS = {
x: 0.083504512906074524,
y: 0.024401858448982239,
z: 0.096756651997566223
};
var BRUSHES_ROTATION_LEFT = Quat.fromPitchYawRollDegrees(78.135, 180.0, -90.0);
var BRUSHES_ROTATION_RIGHT = Quat.fromPitchYawRollDegrees(78.135, 180.0, 90.0);
var TEXTURE_PATH = Script.resolvePath('textures') + '/';
var MODELS_PATH = Script.resolvePath('models') + '/';
module.exports = {
DEBUG: Settings.getValue('io.highfidelity.VoxelPaint.DEBUG', false),
TEXTURE_PATH: TEXTURE_PATH,
MODELS_PATH: MODELS_PATH,
PALETTE_COLORS: [
{
name: 'black',
color: {red: 0, green: 0, blue: 0},
dimensions: DEFAULT_COLOR_DIMENSIONS,
textures: TEXTURE_PATH + 'color-0-0-0.png',
position: {
x: -0.061158061027526855,
y: 0.00213623046875,
z: 0.056712150573730469
}
},
{
name: 'blue',
color: {red: 0, green: 0, blue: 255},
dimensions: DEFAULT_COLOR_DIMENSIONS,
textures: TEXTURE_PATH + 'color-0-0-ff.png',
position: {
x: -0.064543604850769043,
y: 0.00213623046875,
z: -0.075875282287597656
}
},
{
name: 'green',
color: {red: 0, green: 255, blue: 0},
dimensions: DEFAULT_COLOR_DIMENSIONS,
textures: TEXTURE_PATH + 'color-0-ff-0.png',
position: {
x: -0.22693264484405518,
y: 0.00213623046875,
z: -0.063619613647460938
}
},
{
name: 'cyan',
color: {red: 0, green: 255, blue: 255},
dimensions: DEFAULT_COLOR_DIMENSIONS,
textures: TEXTURE_PATH + 'color-0-ff-ff.png',
position: {
x: 0.023909330368041992,
y: 0.00213623046875,
z: -0.10207223892211914
}
},
{
name: 'red',
color: {red: 255, green: 0, blue: 0},
dimensions: DEFAULT_COLOR_DIMENSIONS,
textures: TEXTURE_PATH + 'color-ff-0-0.png',
position: {
x: 0.030942916870117188,
y: 0.00213623046875,
z: -0.20352029800415039
}
},
{
name: 'magenta',
color: {red: 255, green: 0, blue: 255},
dimensions: DEFAULT_COLOR_DIMENSIONS,
textures: TEXTURE_PATH + 'color-ff-0-ff.png',
position: {
x: -0.1491849422454834,
y: 0.00213623046875,
z: 0.00017118453979492188
}
},
{
name: 'yellow',
color: {red: 255, green: 255, blue: 0},
dimensions: DEFAULT_COLOR_DIMENSIONS,
textures: TEXTURE_PATH + 'color-ff-ff-0.png',
position: {
x: -0.15239584445953369,
y: 0.00213623046875,
z: -0.14830589294433594
}
},
{
name: 'white',
color: {red: 255, green: 255, blue: 255},
dimensions: DEFAULT_COLOR_DIMENSIONS,
textures: TEXTURE_PATH + 'color-ff-ff-ff.png',
position: {
x: 0.027637481689453125,
y: 0.00213623046875,
z: -0.0022187232971191406
}
},
{
name: 'orange',
color: {red: 255, green: 165, blue: 0},
dimensions: DEFAULT_COLOR_DIMENSIONS,
textures: TEXTURE_PATH + 'color-ff-a5-0.png',
position: {
x: -0.064569234848022461,
y: 0.00213623046875,
z: -0.19738531112670898
}
},
{
name: 'purple',
color: {red: 136, green: 0, blue: 255},
dimensions: DEFAULT_COLOR_DIMENSIONS,
textures: TEXTURE_PATH + 'color-88-0-ff.png',
position: {
x: -0.25371217727661133,
y: 0.00213623046875,
z: 0.03507232666015625
}
},
{
name: 'wood',
color: {red: 153, green: 76, blue: 0},
dimensions: DEFAULT_COLOR_DIMENSIONS,
textures: TEXTURE_PATH + 'wood.png',
position: {
x: -0.17113709449768066,
y: 0.00213623046875,
z: 0.10360097885131836
}
},
{
name: 'grass and dirt',
color: {red: 0, green: 76, blue: 0},
dimensions: DEFAULT_COLOR_DIMENSIONS,
textures: [
TEXTURE_PATH + 'dirt.png',
TEXTURE_PATH + 'grass.png',
TEXTURE_PATH + 'dirt.png'
],
position: {
x: -0.08389727026224136,
y: 0.00213623046875,
z: 0.17382922768592834
}
}
],
VOXEL_TOOLS: [
{
name: 'smallBrush',
type: 'brush',
toolRadius: 0.025,
toolLength: 0.275,
properties: {
dimensions: {
x: 0.012468120083212852,
y: 0.60412204265594482,
z: 0.012788690626621246
},
modelURL: MODELS_PATH + 'smallBrush.fbx'
},
paletteProperties: {
position: {
x: 0.11309480667114258,
y: 0.006240122485905886,
z: 0.11565382033586502
},
leftRotation: BRUSHES_ROTATION_LEFT,
rightRotation: BRUSHES_ROTATION_RIGHT,
dimensions: {
x: 0.0031751182395964861,
y: 0.15384508669376373,
z: 0.0032567542511969805
},
selectionDimensionScale: {
x: 10.0,
y: 1.0,
z: 10.0
}
}
},
{
name: 'medBrush',
type: 'brush',
toolRadius: 0.08,
toolLength: 0.3,
properties: {
dimensions: {
x: 0.057361073791980743,
y: 0.65550220012664795,
z: 0.054657310247421265
},
modelURL: MODELS_PATH + 'medBrush.fbx'
},
paletteProperties: {
position: {
x: 0.06563957035541534,
y: 0.002522605238482356,
z: 0.1251928210258484
},
leftRotation: BRUSHES_ROTATION_LEFT,
rightRotation: BRUSHES_ROTATION_RIGHT,
dimensions: {
x: 0.013362704776227474,
y: 0.15270429849624634,
z: 0.01273284200578928
},
selectionDimensionScale: {
x: 3.0,
y: 1.0,
z: 3.0
}
}
},
{
name: 'largeBrush',
type: 'brush',
toolRadius: 0.16,
toolLength: 0.225,
properties: {
dimensions: {
x: 0.021168617531657219,
y: 0.37896084785461426,
z: 0.17102941870689392
},
modelURL: MODELS_PATH + 'largeBrush.fbx'
},
paletteProperties: {
position: {
x: 0.008631744422018528,
y: 0.007369604427367449,
z: 0.16236545145511627
},
leftRotation: BRUSHES_ROTATION_LEFT,
rightRotation: BRUSHES_ROTATION_RIGHT,
dimensions: {
x: 0.0074541284702718258,
y: 0.13344390690326691,
z: 0.060224775224924088
},
selectionDimensionScale: {
x: 3.0,
y: 1.0,
z: 3.0
}
}
},
{
name: 'eraser',
type: 'eraser',
toolRadius: 0.08,
toolLength: 0.05,
properties: {
dimensions: {
x: 0.0858,
y: 0.0393,
z: 0.2083
},
modelURL: MODELS_PATH + 'eraser-2.fbx'
},
paletteProperties: {
position: {
x: 0.25367879867553711,
y: 0.00518798828125,
z: -0.046645164489746094
},
leftRotation: {
x: 0.0653543695807457,
y: 0.043366167694330215,
z: -0.002849785378202796,
w: -0.9969152808189392
},
rightRotation: {
w: -1.52587890625e-05,
x: -0.11326771974563599,
y: -4.57763671875e-05,
z: 0.99356067180633545
},
dimensions: {
x: 0.0858,
y: 0.0393,
z: 0.2083
},
selectionDimensionScale: {
x: 1.0,
y: 1.0,
z: 1.0
}
}
}
],
PALETTE_LIFETIME: 20,
VOXEL_MANIPULATOR_LIFETIME: 20,
LIFETIME_REFRESH_RATE: 5000, // ms
PALETTE_MODEL_LEFT_HAND: MODELS_PATH + 'painter_Palette2.fbx',
PALETTE_MODEL_RIGHT_HAND: MODELS_PATH + 'painter_Palette.fbx',
PALETTE_ENTITY_SCRIPT: Script.resolvePath('voxel-paint-palette.js'),
TOOL_ENTITY_SCRIPT: Script.resolvePath('voxel-paint-tool.js')
};