objects汉化。

This commit is contained in:
liteng 2019-01-28 19:39:59 +08:00
parent 7dd6e36435
commit d3dc060bba
39 changed files with 58 additions and 104 deletions

View File

@ -554,4 +554,13 @@ L_ANISOTROPY = '各向异性';
L_CATEGORY_EDIT = '类别编辑';
L_CATEGORY_LIST = '类别列表';
L_PLEASE_SELECT_CATEGORY = '请选择类别!';
L_DELETE_SUCCESS = '删除成功!';
L_DELETE_SUCCESS = '删除成功!';
// event
// loader
// object
L_HALO = '光晕';
L_FrontSide = '正面';
L_BackSide = '背面';

View File

@ -558,4 +558,9 @@ Object.assign(window, {
// event
// loader
// object
L_HALO: 'Halo',
L_FrontSide: 'FrontSide',
L_BackSide: 'BackSide',
});

View File

@ -28,7 +28,7 @@ AssimpLoader.prototype.load = function (url, options) {
animNames: 'Animation1',
scripts: [{
id: null,
name: `${options.Name}动画`,
name: `${options.Name}${L_ANIMATION}`,
type: 'javascript',
source: this.createScripts(options.Name),
uuid: THREE.Math.generateUUID()

View File

@ -35,7 +35,7 @@ BVHLoader.prototype.load = function (url, options) {
animNames: 'Animation1',
scripts: [{
id: null,
name: `${options.Name}动画`,
name: `${options.Name}${L_ANIMATION}`,
type: 'javascript',
source: this.createScripts(options.Name),
uuid: THREE.Math.generateUUID()

View File

@ -43,7 +43,7 @@ ColladaLoader.prototype.load = function (url, options) {
animNames: collada.animations.map(n => n.name),
scripts: [{
id: null,
name: `${options.Name}动画`,
name: `${options.Name}${L_ANIMATION}`,
type: 'javascript',
source: this.createScripts(options.Name),
uuid: THREE.Math.generateUUID()

View File

@ -27,7 +27,7 @@ FBXLoader.prototype.load = function (url, options) {
animNames: obj3d.animations.map(n => n.name),
scripts: [{
id: null,
name: `${options.Name}动画`,
name: `${options.Name}${L_ANIMATION}`,
type: 'javascript',
source: this.createScripts(options.Name),
uuid: THREE.Math.generateUUID()

View File

@ -35,7 +35,7 @@ GLTFLoader.prototype.load = function (url, options) {
animNames: result.animations.map(n => n.name),
scripts: [{
id: null,
name: `${options.Name}动画`,
name: `${options.Name}${L_ANIMATION}`,
type: 'javascript',
source: this.createScripts(options.Name),
uuid: THREE.Math.generateUUID()

View File

@ -29,7 +29,7 @@ JsLoader.prototype.load = function (url, options) {
root: mesh,
scripts: [{
id: null,
name: `${options.Name}动画`,
name: `${options.Name}${L_ANIMATION}`,
type: 'javascript',
source: this.createScripts(options.Name),
uuid: THREE.Math.generateUUID()

View File

@ -14,7 +14,7 @@ LOLLoader.prototype.constructor = LOLLoader;
LOLLoader.prototype.load = function (url, options) {
if (!Array.isArray(url) || url.length < 3) {
console.warn(`LOLLoader: url必须是数组,而且包含.lmesh、.lanim、.png三个文件地址。`);
console.warn(`LOLLoader: url must be an array, and contains .lmesh,.lanim and .png three urls.`);
return new Promise(resolve => {
resolve(null);
});
@ -25,21 +25,21 @@ LOLLoader.prototype.load = function (url, options) {
var png = url.filter(n => n.endsWith('.png'))[0];
if (lmesh === undefined) {
console.warn(`LOLLoader: url中不包含.lmesh文件地址。`);
console.warn(`LOLLoader: url doesn't contain .lmesh url.`);
return new Promise(resolve => {
resolve(null);
});
}
if (lanim === undefined) {
console.warn(`LOLLoader: url中不包含.lanim文件地址。`);
console.warn(`LOLLoader: url doesn't contain .lanim url.`);
return new Promise(resolve => {
resolve(null);
});
}
if (png === undefined) {
console.warn(`LOLLoader: url中不包含.png文件地址。`);
console.warn(`LOLLoader: url doesn't contain .png url.`);
return new Promise(resolve => {
resolve(null);
});
@ -71,7 +71,7 @@ LOLLoader.prototype.load = function (url, options) {
mesh.userData.model = model;
mesh.userData.scripts = [{
id: null,
name: `${options.Name}动画`,
name: `${options.Name}${L_ANIMATION}`,
type: 'javascript',
source: this.createScripts(options.Name, model),
uuid: THREE.Math.generateUUID()

View File

@ -85,7 +85,7 @@ ModelLoader.prototype.load = function (url, options, environment) {
var type = options.Type;
if (type === undefined) {
console.warn(`ModelLoader: 未传递type参数无法加载。`);
console.warn(`ModelLoader: no type parameters, and cannot load.`);
return new Promise(resolve => {
resolve(null);
});
@ -94,7 +94,7 @@ ModelLoader.prototype.load = function (url, options, environment) {
return new Promise(resolve => {
var loader = Loaders[type];
if (loader === undefined) {
console.warn(`ModelLoader: 不存在加载${type}后缀模型的加载器。`);
console.warn(`ModelLoader: no ${type} loader.`);
resolve(null);
return;
}

View File

@ -58,7 +58,7 @@ ObjectLoader.prototype.loadSkinnedMesh = function (scene, options) {
mesh.userData.scripts = [{
id: null,
name: `${options.Name}动画`,
name: `${options.Name}${L_ANIMATION}`,
type: 'javascript',
source: source,
uuid: THREE.Math.generateUUID()

View File

@ -32,7 +32,7 @@ SEA3DLoader.prototype.load = function (url, options) {
animNames: ['Animation1'],
scripts: [{
id: null,
name: `${options.Name}动画`,
name: `${options.Name}${L_ANIMATION}`,
type: 'javascript',
source: this.createScripts(options.Name),
uuid: THREE.Math.generateUUID()

File diff suppressed because one or more lines are too long

View File

@ -21,9 +21,9 @@ function Fire(camera, options = {}) {
this.add(fire.mesh);
fire.mesh.name = '火焰';
fire.mesh.name = L_FIRE;
this.name = '火焰';
this.name = L_FIRE;
this.position.y = 2;
Object.assign(this.userData, {

View File

@ -43,11 +43,11 @@ function ParticleEmitter(group, emitter) {
group.addEmitter(emitter);
group.mesh.name = '粒子';
group.mesh.name = L_PARTICLE;
this.add(group.mesh);
this.name = '粒子发射器';
this.name = L_PARTICLE_EMITTER;
Object.assign(this.userData, {
type: 'ParticleEmitter',

View File

@ -58,7 +58,7 @@ function Smoke(camera, renderer, options = {}) {
this.sortParticles = true;
this.name = '烟';
this.name = L_SMOKE;
Object.assign(this.userData, {
type: 'Smoke',

View File

@ -44,7 +44,7 @@ function Water(renderer) {
// 创建网格
THREE.Mesh.call(this, geometry, material);
this.name = '水';
this.name = L_WATER;
this.rotation.x = -Math.PI / 2;

View File

@ -6,7 +6,7 @@
function Box(geometry = new THREE.BoxBufferGeometry(1, 1, 1), material = new THREE.MeshStandardMaterial()) {
THREE.Mesh.call(this, geometry, material);
this.name = '正方体';
this.name = L_BOX;
this.castShadow = true;
this.receiveShadow = true;

View File

@ -6,7 +6,7 @@
function Circle(geometry = new THREE.CircleBufferGeometry(1, 32), material = new THREE.MeshStandardMaterial()) {
THREE.Mesh.call(this, geometry, material);
this.name = '圆';
this.name = L_CIRCLE;
this.castShadow = true;
this.receiveShadow = true;

View File

@ -6,7 +6,7 @@
function Cylinder(geometry = new THREE.CylinderBufferGeometry(1, 1, 2, 32, 1, false), material = new THREE.MeshStandardMaterial()) {
THREE.Mesh.call(this, geometry, material);
this.name = '圆柱体';
this.name = L_CYLINDER;
this.castShadow = true;
this.receiveShadow = true;

View File

@ -3,7 +3,7 @@
*/
function Group() {
THREE.Object3D.call(this);
this.name = '组';
this.name = L_GROUP;
}
Group.prototype = Object.create(THREE.Object3D.prototype);

View File

@ -6,7 +6,7 @@
function Icosahedron(geometry = new THREE.IcosahedronBufferGeometry(1, 2), material = new THREE.MeshStandardMaterial()) {
THREE.Mesh.call(this, geometry, material);
this.name = '二十面体';
this.name = L_ICOSAHEDRON;
this.castShadow = true;
this.receiveShadow = true;

View File

@ -20,7 +20,7 @@ var points = [
function Lathe(geometry = new THREE.LatheBufferGeometry(points, 20, 0, 2 * Math.PI), material = new THREE.MeshStandardMaterial({ side: THREE.DoubleSide })) {
THREE.Mesh.call(this, geometry, material);
this.name = '酒杯';
this.name = L_LATHE;
this.castShadow = true;
this.receiveShadow = true;

View File

@ -6,7 +6,7 @@
function Plane(geometry = new THREE.PlaneBufferGeometry(50, 50), material = new THREE.MeshStandardMaterial()) {
THREE.Mesh.call(this, geometry, material);
this.name = '平面';
this.name = L_PLANE;
this.rotation.x = -Math.PI / 2;
this.castShadow = true;
this.receiveShadow = true;

View File

@ -6,7 +6,7 @@
function Sphere(geometry = new THREE.SphereBufferGeometry(1, 32, 16, 0, Math.PI * 2, 0, Math.PI), material = new THREE.MeshStandardMaterial()) {
THREE.Mesh.call(this, geometry, material);
this.name = '球体';
this.name = L_SPHERE;
this.castShadow = true;
this.receiveShadow = true;

View File

@ -5,7 +5,7 @@
function Sprite(material = new THREE.SpriteMaterial()) {
THREE.Sprite.call(this, material);
this.name = '精灵';
this.name = L_SPRITE;
}
Sprite.prototype = Object.create(THREE.Sprite.prototype);

View File

@ -20,7 +20,7 @@ function Teapot(geometry = new THREE.TeapotBufferGeometry(3, 10, true, true, tru
blinn: true
};
this.name = '茶壶';
this.name = L_TEAPOT;
this.castShadow = true;
this.receiveShadow = true;

View File

@ -4,7 +4,7 @@ import StringUtils from '../../utils/StringUtils';
* 文本
* @param {*} text 文字
*/
function Text(text = '文字') {
function Text(text = L_TEXT) {
var canvas = document.createElement('canvas');
var fontSize = 64;

View File

@ -6,7 +6,7 @@
function Torus(geometry = new THREE.TorusBufferGeometry(2, 1, 32, 32, Math.PI * 2), material = new THREE.MeshStandardMaterial()) {
THREE.Mesh.call(this, geometry, material);
this.name = '轮胎';
this.name = L_TORUS;
this.castShadow = true;
this.receiveShadow = true;

View File

@ -6,7 +6,7 @@
function TorusKnot(geometry = new THREE.TorusKnotBufferGeometry(2, 0.8, 64, 12, 2, 3), material = new THREE.MeshStandardMaterial()) {
THREE.Mesh.call(this, geometry, material);
this.name = '纽结';
this.name = L_TORUS_KNOT;
this.castShadow = true;
this.receiveShadow = true;

View File

@ -26,7 +26,7 @@ function HemisphereLight(skyColor, groundColor, intensity) {
});
var sky = new THREE.Mesh(skyGeo, skyMat);
sky.name = '天空';
sky.name = L_SKY;
sky.userData.type = 'sky';
this.add(sky);

View File

@ -1,53 +0,0 @@
// ref for lumens: http://www.power-sure.com/lumens.htm
var bulbLuminousPowers = {
"110000 lm (1000W)": 110000,
"3500 lm (300W)": 3500,
"1700 lm (100W)": 1700,
"800 lm (60W)": 800,
"400 lm (40W)": 400,
"180 lm (25W)": 180,
"20 lm (4W)": 20,
"Off": 0
};
// ref for solar irradiances: https://en.wikipedia.org/wiki/Lux
var hemiLuminousIrradiances = {
"0.0001 lx (无月之夜)": 0.0001,
"0.002 lx (夜晚辉光)": 0.002,
"0.5 lx (满月)": 0.5,
"3.4 lx (城市暮光)": 3.4,
"50 lx (客厅)": 50,
"100 lx (很阴沉)": 100,
"350 lx (办公室)": 350,
"400 lx (日出日落)": 400,
"1000 lx (阴沉)": 1000,
"18000 lx (阳光)": 18000,
"50000 lx (太阳直射)": 50000
};
var params = {
shadows: true,
exposure: 0.68,
bulbPower: Object.keys(bulbLuminousPowers)[4],
hemiIrradiance: Object.keys(hemiLuminousIrradiances)[0]
};
/**
* 物理光源
*/
function PhysicalLight(color, intensity, distance, decay) {
THREE.PointLight.call(this, color, intensity, distance, decay);
var bulbGeometry = new THREE.SphereBufferGeometry(0.02, 16, 8);
var bulbMat = new THREE.MeshStandardMaterial({
emissive: 0xffffee,
emissiveIntensity: 1,
color: new THREE.Color(color)
});
this.add(new THREE.Mesh(bulbGeometry, bulbMat));
}
PhysicalLight.prototype = Object.create(THREE.PhysicalLight.prototype);
PhysicalLight.prototype.constructor = PhysicalLight;
export default PhysicalLight;

View File

@ -11,7 +11,7 @@ function PointLight(color, intensity, distance, decay) {
var mesh = new THREE.Mesh(geometry, material);
// 帮助器
mesh.name = '帮助器';
mesh.name = L_HELP;
mesh.userData.type = 'helper';
this.add(mesh);
@ -29,7 +29,7 @@ function PointLight(color, intensity, distance, decay) {
lensflare.addElement(new THREE.LensflareElement(textureFlare3, 60, 0.6));
lensflare.addElement(new THREE.LensflareElement(textureFlare3, 45, 0.8));
lensflare.name = '光晕';
lensflare.name = L_HALO;
lensflare.userData.type = 'lensflare';
this.add(lensflare);

View File

@ -9,7 +9,7 @@ function RectAreaLight(color, intensity, width, height) {
rectLightMesh.scale.x = width;
rectLightMesh.scale.y = height;
rectLightMesh.name = '正面';
rectLightMesh.name = L_FrontSide;
rectLightMesh.userData.type = 'frontSide';
this.add(rectLightMesh);
@ -19,7 +19,7 @@ function RectAreaLight(color, intensity, width, height) {
rectLightMeshBack.scale.y = height;
rectLightMeshBack.rotation.y = Math.PI;
rectLightMesh.name = '背面';
rectLightMesh.name = L_BackSide;
rectLightMesh.userData.type = 'backSide';
this.add(rectLightMeshBack);

View File

@ -14,7 +14,7 @@ function Spline() {
THREE.Line.call(this, geometry, material);
this.name = '曲线';
this.name = L_SPLINE;
this.castShadow = true;

View File

@ -29,7 +29,7 @@ function PerlinTerrain(width = 1000, depth = 1000, widthSegments = 256, depthSeg
// 创建网格
THREE.Mesh.call(this, geometry, new THREE.MeshLambertMaterial({ map: texture }));
this.name = '地形';
this.name = L_TERRAIN;
this.position.y = -50;

View File

@ -33,7 +33,7 @@ function PhysicsTerrain() {
// 创建网格
THREE.Mesh.call(this, geometry, material);
this.name = '地形';
this.name = L_TERRAIN;
this.castShadow = true;
this.receiveShadow = true;

View File

@ -121,7 +121,7 @@ function ShaderTerrain(renderer, options) {
THREE.Mesh.call(this, geometry, terrainMaterial);
this.name = '地形';
this.name = L_TERRAIN;
this.position.set(0, -30, 0);
this.rotation.x = -Math.PI / 2;
this.scale.set(0.1, 0.1, 0.1);