mirror of
https://github.com/tengge1/ShadowEditor.git
synced 2026-01-25 15:08:11 +00:00
各种光源序列化。
This commit is contained in:
parent
b22cc62119
commit
97c12b9b2e
@ -14,9 +14,11 @@ import OrthographicCameraSerializer from './camera/OrthographicCameraSerializer'
|
||||
import PerspectiveCameraSerializer from './camera/PerspectiveCameraSerializer';
|
||||
|
||||
// light
|
||||
import AmbientLightSerializer from './light/AmbientLightSerializer';
|
||||
import DirectionalLightSerializer from './light/DirectionalLightSerializer';
|
||||
import HemisphereLightSerializer from './light/HemisphereLightSerializer';
|
||||
import PointLightSerializer from './light/PointLightSerializer';
|
||||
import SpotLightSerializer from './light/SpotLightSerializer';
|
||||
import HemisphereLightSerializer from './light/HemisphereLightSerializer';
|
||||
import RectAreaLightSerializer from './light/RectAreaLightSerializer';
|
||||
|
||||
/**
|
||||
@ -78,19 +80,24 @@ Converter.prototype.toJSON = function (app) {
|
||||
break;
|
||||
// case 'Sprite':
|
||||
// break;
|
||||
// case 'PointLight':
|
||||
// json = (new PointLightSerializer()).toJSON(obj);
|
||||
// break;
|
||||
// case 'SpotLight':
|
||||
// json = (new SpotLightSerializer()).toJSON(obj);
|
||||
// break;
|
||||
// case 'DirectionalLight':
|
||||
// break;
|
||||
// case 'HemisphereLight':
|
||||
// json = (new HemisphereLightSerializer()).toJSON(obj);
|
||||
// break;
|
||||
// case 'AmbientLight':
|
||||
// break;
|
||||
case 'AmbientLight':
|
||||
json = (new AmbientLightSerializer()).toJSON(obj);
|
||||
break;
|
||||
case 'DirectionalLight':
|
||||
json = (new DirectionalLightSerializer()).toJSON(obj);
|
||||
break;
|
||||
case 'HemisphereLight':
|
||||
json = (new HemisphereLightSerializer()).toJSON(obj);
|
||||
break;
|
||||
case 'PointLight':
|
||||
json = (new PointLightSerializer()).toJSON(obj);
|
||||
break;
|
||||
case 'RectAreaLight':
|
||||
json = (new RectAreaLightSerializer()).toJSON(obj);
|
||||
break;
|
||||
case 'SpotLight':
|
||||
json = (new SpotLightSerializer()).toJSON(obj);
|
||||
break;
|
||||
}
|
||||
if (json) {
|
||||
list.push(json);
|
||||
|
||||
@ -0,0 +1,27 @@
|
||||
import BaseSerializer from '../BaseSerializer';
|
||||
import LightSerializer from './LightSerializer';
|
||||
|
||||
/**
|
||||
* AmbientLightSerializer
|
||||
*/
|
||||
function AmbientLightSerializer() {
|
||||
BaseSerializer.call(this);
|
||||
}
|
||||
|
||||
AmbientLightSerializer.prototype = Object.create(BaseSerializer.prototype);
|
||||
AmbientLightSerializer.prototype.constructor = AmbientLightSerializer;
|
||||
|
||||
AmbientLightSerializer.prototype.toJSON = function (obj) {
|
||||
var json = LightSerializer.prototype.toJSON.call(this, obj);
|
||||
|
||||
json.color = obj.color;
|
||||
json.intensity = obj.intensity;
|
||||
|
||||
return json;
|
||||
};
|
||||
|
||||
AmbientLightSerializer.prototype.fromJSON = function (json) {
|
||||
|
||||
};
|
||||
|
||||
export default AmbientLightSerializer;
|
||||
@ -0,0 +1,27 @@
|
||||
import BaseSerializer from '../BaseSerializer';
|
||||
import LightSerializer from './LightSerializer';
|
||||
|
||||
/**
|
||||
* DirectionalLightSerializer
|
||||
*/
|
||||
function DirectionalLightSerializer() {
|
||||
BaseSerializer.call(this);
|
||||
}
|
||||
|
||||
DirectionalLightSerializer.prototype = Object.create(BaseSerializer.prototype);
|
||||
DirectionalLightSerializer.prototype.constructor = DirectionalLightSerializer;
|
||||
|
||||
DirectionalLightSerializer.prototype.toJSON = function (obj) {
|
||||
var json = LightSerializer.prototype.toJSON.call(this, obj);
|
||||
|
||||
json.color = obj.color;
|
||||
json.intensity = obj.intensity;
|
||||
|
||||
return json;
|
||||
};
|
||||
|
||||
DirectionalLightSerializer.prototype.fromJSON = function (json) {
|
||||
|
||||
};
|
||||
|
||||
export default DirectionalLightSerializer;
|
||||
@ -14,8 +14,8 @@ HemisphereLightSerializer.prototype.constructor = HemisphereLightSerializer;
|
||||
HemisphereLightSerializer.prototype.toJSON = function (obj) {
|
||||
var json = LightSerializer.prototype.toJSON.call(this, obj);
|
||||
|
||||
json.skyColor = item.skyColor;
|
||||
json.groundColor = item.groundColor;
|
||||
json.skyColor = obj.skyColor;
|
||||
json.groundColor = obj.groundColor;
|
||||
|
||||
return json;
|
||||
};
|
||||
|
||||
@ -14,8 +14,8 @@ LightSerializer.prototype.constructor = LightSerializer;
|
||||
LightSerializer.prototype.toJSON = function (obj) {
|
||||
var json = Object3DSerializer.prototype.toJSON.call(this, obj);
|
||||
|
||||
json.color = item.color;
|
||||
json.intensity = item.intensity;
|
||||
json.color = obj.color;
|
||||
json.intensity = obj.intensity;
|
||||
|
||||
return json;
|
||||
};
|
||||
|
||||
@ -14,8 +14,8 @@ PointLightSerializer.prototype.constructor = PointLightSerializer;
|
||||
PointLightSerializer.prototype.toJSON = function (obj) {
|
||||
var json = LightSerializer.prototype.toJSON.call(this, obj);
|
||||
|
||||
json.distance = item.distance;
|
||||
json.decay = item.decay;
|
||||
json.distance = obj.distance;
|
||||
json.decay = obj.decay;
|
||||
|
||||
return json;
|
||||
};
|
||||
|
||||
@ -14,8 +14,8 @@ RectAreaLightSerializer.prototype.constructor = RectAreaLightSerializer;
|
||||
RectAreaLightSerializer.prototype.toJSON = function (obj) {
|
||||
var json = LightSerializer.prototype.toJSON.call(this, obj);
|
||||
|
||||
json.width = item.width;
|
||||
json.height = item.height;
|
||||
json.width = obj.width;
|
||||
json.height = obj.height;
|
||||
|
||||
return json;
|
||||
};
|
||||
|
||||
@ -14,10 +14,10 @@ SpotLightSerializer.prototype.constructor = SpotLightSerializer;
|
||||
SpotLightSerializer.prototype.toJSON = function (obj) {
|
||||
var json = LightSerializer.prototype.toJSON.call(this, obj);
|
||||
|
||||
json.distance = item.distance;
|
||||
json.angle = item.angle;
|
||||
json.penumbra = item.penumbra;
|
||||
json.decay = item.decay;
|
||||
json.distance = obj.distance;
|
||||
json.angle = obj.angle;
|
||||
json.penumbra = obj.penumbra;
|
||||
json.decay = obj.decay;
|
||||
|
||||
return json;
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user