|
@@ -1,6 +1,6 @@
|
|
|
import { Nullable } from "../types";
|
|
|
import { Scene } from "../scene";
|
|
|
-import { Color3 } from "../Maths/math";
|
|
|
+import { Color3, Color4 } from "../Maths/math";
|
|
|
import { Node } from "../node";
|
|
|
import { VertexBuffer } from "../Meshes/buffer";
|
|
|
import { SubMesh } from "../Meshes/subMesh";
|
|
@@ -9,10 +9,10 @@ import { InstancedMesh } from "../Meshes/instancedMesh";
|
|
|
import { Effect } from "../Materials/effect";
|
|
|
import { Material } from "../Materials/material";
|
|
|
import { ShaderMaterial } from "../Materials/shaderMaterial";
|
|
|
+import { MaterialHelper } from '../Materials/materialHelper';
|
|
|
|
|
|
import "../Shaders/color.fragment";
|
|
|
import "../Shaders/color.vertex";
|
|
|
-import { MaterialHelper } from '../Materials/materialHelper';
|
|
|
|
|
|
/**
|
|
|
* Line mesh
|
|
@@ -37,6 +37,8 @@ export class LinesMesh extends Mesh {
|
|
|
|
|
|
private _colorShader: ShaderMaterial;
|
|
|
|
|
|
+ private color4 : Color4;
|
|
|
+
|
|
|
/**
|
|
|
* Creates a new LinesMesh
|
|
|
* @param name defines the name
|
|
@@ -58,11 +60,11 @@ export class LinesMesh extends Mesh {
|
|
|
/**
|
|
|
* If vertex color should be applied to the mesh
|
|
|
*/
|
|
|
- public useVertexColor?: boolean,
|
|
|
+ public readonly useVertexColor?: boolean,
|
|
|
/**
|
|
|
* If vertex alpha should be applied to the mesh
|
|
|
*/
|
|
|
- public useVertexAlpha?: boolean
|
|
|
+ public readonly useVertexAlpha?: boolean
|
|
|
) {
|
|
|
super(name, scene, parent, source, doNotCloneChildren);
|
|
|
|
|
@@ -89,6 +91,7 @@ export class LinesMesh extends Mesh {
|
|
|
|
|
|
if (!useVertexColor) {
|
|
|
options.uniforms.push("color");
|
|
|
+ this.color4 = new Color4();
|
|
|
}
|
|
|
else {
|
|
|
options.defines.push("#define VERTEXCOLOR");
|
|
@@ -177,7 +180,9 @@ export class LinesMesh extends Mesh {
|
|
|
|
|
|
// Color
|
|
|
if (!this.useVertexColor) {
|
|
|
- this._colorShader.setColor4("color", this.color.toColor4(this.alpha));
|
|
|
+ const { r, g, b } = this.color;
|
|
|
+ this.color4.set(r, g, b, this.alpha);
|
|
|
+ this._colorShader.setColor4("color", this.color4);
|
|
|
}
|
|
|
|
|
|
// Clip planes
|