|
@@ -141,11 +141,13 @@
|
|
|
/**
|
|
|
* Specifies whether or not the inner glow is ACTIVE in the layer.
|
|
|
*/
|
|
|
+ @serialize()
|
|
|
public innerGlow: boolean = true;
|
|
|
|
|
|
/**
|
|
|
* Specifies whether or not the outer glow is ACTIVE in the layer.
|
|
|
*/
|
|
|
+ @serialize()
|
|
|
public outerGlow: boolean = true;
|
|
|
|
|
|
/**
|
|
@@ -165,6 +167,7 @@
|
|
|
/**
|
|
|
* Gets the horizontal size of the blur.
|
|
|
*/
|
|
|
+ @serialize()
|
|
|
public get blurHorizontalSize(): number {
|
|
|
return this._horizontalBlurPostprocess.kernel
|
|
|
}
|
|
@@ -172,6 +175,7 @@
|
|
|
/**
|
|
|
* Gets the vertical size of the blur.
|
|
|
*/
|
|
|
+ @serialize()
|
|
|
public get blurVerticalSize(): number {
|
|
|
return this._verticalBlurPostprocess.kernel;
|
|
|
}
|
|
@@ -188,6 +192,7 @@
|
|
|
|
|
|
private _instanceGlowingMeshStencilReference = HighlightLayer.GlowingMeshStencilReference++;
|
|
|
|
|
|
+ @serialize("options")
|
|
|
private _options: IHighlightLayerOptions;
|
|
|
private _downSamplePostprocess: PassPostProcess;
|
|
|
private _horizontalBlurPostprocess: GlowBlurPostProcess;
|
|
@@ -668,5 +673,86 @@
|
|
|
|
|
|
super.dispose();
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Gets the class name of the effect layer
|
|
|
+ * @returns the string with the class name of the effect layer
|
|
|
+ */
|
|
|
+ public getClassName(): string {
|
|
|
+ return "HighlightLayer";
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Serializes this highlight layer
|
|
|
+ * @returns a serialized highlight layer object
|
|
|
+ */
|
|
|
+ public serialize(): any {
|
|
|
+ var serializationObject = SerializationHelper.Serialize(this);
|
|
|
+ serializationObject.customType = "BABYLON.HighlightLayer";
|
|
|
+
|
|
|
+ // Highlighted meshes
|
|
|
+ serializationObject.meshes = [];
|
|
|
+
|
|
|
+ if (this._meshes) {
|
|
|
+ for (var m in this._meshes) {
|
|
|
+ var mesh = this._meshes[m];
|
|
|
+
|
|
|
+ if (mesh) {
|
|
|
+ serializationObject.meshes.push({
|
|
|
+ glowEmissiveOnly: mesh.glowEmissiveOnly,
|
|
|
+ color: mesh.color.asArray(),
|
|
|
+ meshId: mesh.mesh.id
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // Excluded meshes
|
|
|
+ serializationObject.excludedMeshes = [];
|
|
|
+
|
|
|
+ if (this._excludedMeshes) {
|
|
|
+ for (var e in this._excludedMeshes) {
|
|
|
+ var excludedMesh = this._excludedMeshes[e];
|
|
|
+
|
|
|
+ if (excludedMesh) {
|
|
|
+ serializationObject.excludedMeshes.push(excludedMesh.mesh.id);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return serializationObject;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Creates a HighLight layer from parsed hightlight layer data
|
|
|
+ * @param parsedHightlightLayer defines the hightlight layer data
|
|
|
+ * @param scene defines the current scene
|
|
|
+ * @param rootUrl defines the root URL containing the hightlight layer information
|
|
|
+ * @returns a parsed hightlight layer
|
|
|
+ */
|
|
|
+ public static Parse(parsedHightlightLayer: any, scene: Scene, rootUrl: string): HighlightLayer {
|
|
|
+ var hl = SerializationHelper.Parse(() => new HighlightLayer(parsedHightlightLayer.name, scene, parsedHightlightLayer.options), parsedHightlightLayer, scene, rootUrl);
|
|
|
+ var index;
|
|
|
+
|
|
|
+ // Excluded meshes
|
|
|
+ for (index = 0; index < parsedHightlightLayer.excludedMeshes.length; index++) {
|
|
|
+ var mesh = scene.getMeshByID(parsedHightlightLayer.excludedMeshes[index]);
|
|
|
+ if (mesh) {
|
|
|
+ hl.addExcludedMesh(<Mesh> mesh);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // Included meshes
|
|
|
+ for (index = 0; index < parsedHightlightLayer.meshes.length; index++) {
|
|
|
+ var highlightedMesh = parsedHightlightLayer.meshes[index];
|
|
|
+ var mesh = scene.getMeshByID(highlightedMesh.meshId);
|
|
|
+
|
|
|
+ if (mesh) {
|
|
|
+ hl.addMesh(<Mesh> mesh, Color3.FromArray(highlightedMesh.color), highlightedMesh.glowEmissiveOnly);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return hl;
|
|
|
+ }
|
|
|
}
|
|
|
}
|