mirror of
https://github.com/tengge1/ShadowEditor.git
synced 2026-02-01 16:08:17 +00:00
Geometry序列化。
This commit is contained in:
parent
8d59217d01
commit
26d33bbed3
@ -24,17 +24,6 @@ import RectAreaLightSerializer from './light/RectAreaLightSerializer';
|
||||
*/
|
||||
function Converter() {
|
||||
BaseSerializer.call(this);
|
||||
|
||||
this.serializers = [
|
||||
new SceneSerializer(),
|
||||
|
||||
new PointLightSerializer(),
|
||||
new SpotLightSerializer(),
|
||||
new HemisphereLightSerializer(),
|
||||
new RectAreaLightSerializer(),
|
||||
|
||||
new MeshSerializer()
|
||||
];
|
||||
}
|
||||
|
||||
Converter.prototype = Object.create(BaseSerializer.prototype);
|
||||
@ -84,9 +73,9 @@ Converter.prototype.toJSON = function (app) {
|
||||
break;
|
||||
// case 'Group':
|
||||
// break;
|
||||
// case 'Mesh':
|
||||
// json = (new MeshSerializer()).toJSON(obj);
|
||||
// break;
|
||||
case 'Mesh':
|
||||
json = (new MeshSerializer()).toJSON(obj);
|
||||
break;
|
||||
// case 'Sprite':
|
||||
// break;
|
||||
// case 'PointLight':
|
||||
|
||||
@ -12,7 +12,9 @@ MeshSerializer.prototype = Object.create(BaseSerializer.prototype);
|
||||
MeshSerializer.prototype.constructor = MeshSerializer;
|
||||
|
||||
MeshSerializer.prototype.toJSON = function (obj) {
|
||||
var json = Object3DSerializer.prototype.toJSON(obj);
|
||||
var json = Object3DSerializer.prototype.toJSON.call(this, obj);
|
||||
|
||||
debugger
|
||||
|
||||
json.drawMode = obj.drawMode;
|
||||
json.geometry = obj.geometry.toJSON();
|
||||
|
||||
@ -11,17 +11,38 @@ GeometrySerializer.prototype = Object.create(BaseSerializer.prototype);
|
||||
GeometrySerializer.prototype.constructor = GeometrySerializer;
|
||||
|
||||
GeometrySerializer.prototype.toJSON = function (obj) {
|
||||
var json = BaseSerializer.prototype.toJSON(obj);
|
||||
var json = BaseSerializer.prototype.toJSON.call(this, obj);
|
||||
|
||||
json.boundingBox = obj.boundingBox;
|
||||
json.boundingSphere = obj.boundingSphere;
|
||||
json.colors = obj.colors;
|
||||
json.faces = obj.faces;
|
||||
json.faceVertexUvs = obj.faceVertexUvs;
|
||||
json.id = obj.id;
|
||||
json.isGeometry = obj.isGeometry;
|
||||
json.lineDistances = obj.lineDistances;
|
||||
json.morphTargets = obj.morphTargets;
|
||||
json.morphNormals = obj.morphNormals;
|
||||
json.name = geometry.name;
|
||||
json.skinWeights = obj.skinWeights;
|
||||
json.skinIndices = obj.skinIndices;
|
||||
json.uuid = obj.uuid;
|
||||
json.vertices = obj.vertices;
|
||||
json.verticesNeedUpdate = obj.verticesNeedUpdate;
|
||||
json.elementsNeedUpdate = obj.elementsNeedUpdate;
|
||||
json.uvsNeedUpdate = obj.uvsNeedUpdate;
|
||||
json.normalsNeedUpdate = obj.normalsNeedUpdate;
|
||||
json.colorsNeedUpdate = obj.colorsNeedUpdate;
|
||||
json.groupsNeedUpdate = obj.groupsNeedUpdate;
|
||||
json.lineDistancesNeedUpdate = obj.lineDistancesNeedUpdate;
|
||||
|
||||
json.type = geometry.type;
|
||||
json.userData = geometry.userData;
|
||||
json.uuid = geometry.uuid;
|
||||
|
||||
return json;
|
||||
};
|
||||
|
||||
GeometrySerializer.prototype.fromJSON = function (json) {
|
||||
GeometrySerializer.prototype.fromJSON = function (json, parent) {
|
||||
|
||||
};
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user