diff --git a/sandbox/embed_selfhost_calculate.html b/sandbox/embed_selfhost_calculate.html
index cfe410f..b302f00 100644
--- a/sandbox/embed_selfhost_calculate.html
+++ b/sandbox/embed_selfhost_calculate.html
@@ -34,11 +34,11 @@
// initialize the viewer with the parent element and some parameters
let viewer = new OV.EmbeddedViewer (parentDiv, {
- backgroundColor : new OV.Color (255, 255, 255),
- defaultColor : new OV.Color (200, 200, 200),
+ backgroundColor : new OV.RGBColor (255, 255, 255),
+ defaultColor : new OV.RGBColor (200, 200, 200),
edgeSettings : {
showEdges : false,
- edgeColor : new OV.Color (0, 0, 0),
+ edgeColor : new OV.RGBColor (0, 0, 0),
edgeThreshold : 1
},
environmentSettings : {
diff --git a/sandbox/embed_selfhost_code_file.html b/sandbox/embed_selfhost_code_file.html
index dd0dab7..3cf31ea 100644
--- a/sandbox/embed_selfhost_code_file.html
+++ b/sandbox/embed_selfhost_code_file.html
@@ -26,11 +26,11 @@
// initialize the viewer with the parent element and some parameters
let viewer = new OV.EmbeddedViewer (parentDiv, {
- backgroundColor : new OV.Color (255, 255, 255),
- defaultColor : new OV.Color (200, 200, 200),
+ backgroundColor : new OV.RGBColor (255, 255, 255),
+ defaultColor : new OV.RGBColor (200, 200, 200),
edgeSettings : {
showEdges : false,
- edgeColor : new OV.Color (0, 0, 0),
+ edgeColor : new OV.RGBColor (0, 0, 0),
edgeThreshold : 1
},
environmentSettings : {
diff --git a/sandbox/embed_selfhost_code_url.html b/sandbox/embed_selfhost_code_url.html
index 00c019b..c329fe4 100644
--- a/sandbox/embed_selfhost_code_url.html
+++ b/sandbox/embed_selfhost_code_url.html
@@ -31,11 +31,11 @@
new OV.Coord3D (0.0, 0.0, 0.0),
new OV.Coord3D (0.0, 1.0, 0.0)
),
- backgroundColor : new OV.Color (255, 255, 255),
- defaultColor : new OV.Color (200, 200, 200),
+ backgroundColor : new OV.RGBColor (255, 255, 255),
+ defaultColor : new OV.RGBColor (200, 200, 200),
edgeSettings : {
showEdges : false,
- edgeColor : new OV.Color (0, 0, 0),
+ edgeColor : new OV.RGBColor (0, 0, 0),
edgeThreshold : 1
},
environmentSettings : {
diff --git a/sandbox/embed_selfhost_multiple.html b/sandbox/embed_selfhost_multiple.html
index c7b4b18..510a125 100644
--- a/sandbox/embed_selfhost_multiple.html
+++ b/sandbox/embed_selfhost_multiple.html
@@ -12,7 +12,7 @@
diff --git a/source/engine/export/exportergltf.js b/source/engine/export/exportergltf.js
index 2737fda..bbe8f43 100644
--- a/source/engine/export/exportergltf.js
+++ b/source/engine/export/exportergltf.js
@@ -1,7 +1,7 @@
import { BinaryWriter } from '../io/binarywriter.js';
import { Utf8StringToArrayBuffer } from '../io/bufferutils.js';
import { FileFormat, GetFileExtension, GetFileName } from '../io/fileutils.js';
-import { Color, SRGBToLinear } from '../model/color.js';
+import { RGBColor, SRGBToLinear } from '../model/color.js';
import { MaterialType } from '../model/material.js';
import { ConvertMeshToMeshBuffer } from '../model/meshbuffer.js';
import { ExportedFile, ExporterBase } from './exporterbase.js';
@@ -453,7 +453,7 @@ export class ExporterGltf extends ExporterBase
let baseColorTexture = GetTextureParams (mainJson, material.diffuseMap, addTexture);
if (baseColorTexture !== null) {
if (!material.multiplyDiffuseMap) {
- jsonMaterial.pbrMetallicRoughness.baseColorFactor = ColorToRGBA (new Color (255, 255, 255), material.opacity);
+ jsonMaterial.pbrMetallicRoughness.baseColorFactor = ColorToRGBA (new RGBColor (255, 255, 255), material.opacity);
}
jsonMaterial.pbrMetallicRoughness.baseColorTexture = baseColorTexture;
}
diff --git a/source/engine/import/importer.js b/source/engine/import/importer.js
index b88de8b..37abeaf 100644
--- a/source/engine/import/importer.js
+++ b/source/engine/import/importer.js
@@ -1,6 +1,6 @@
import { RunTaskAsync } from '../core/taskrunner.js';
import { FileSource, GetFileName } from '../io/fileutils.js';
-import { Color } from '../model/color.js';
+import { RGBColor } from '../model/color.js';
import { ImporterFile, ImporterFileList } from './importerfiles.js';
import { Importer3dm } from './importer3dm.js';
import { Importer3ds } from './importer3ds.js';
@@ -21,7 +21,7 @@ export class ImportSettings
{
constructor ()
{
- this.defaultColor = new Color (200, 200, 200);
+ this.defaultColor = new RGBColor (200, 200, 200);
}
}
diff --git a/source/engine/import/importer3ds.js b/source/engine/import/importer3ds.js
index d1559c3..4720f5f 100644
--- a/source/engine/import/importer3ds.js
+++ b/source/engine/import/importer3ds.js
@@ -5,7 +5,7 @@ import { Matrix } from '../geometry/matrix.js';
import { ArrayToQuaternion } from '../geometry/quaternion.js';
import { Transformation } from '../geometry/transformation.js';
import { BinaryReader } from '../io/binaryreader.js';
-import { Color, ColorComponentFromFloat } from '../model/color.js';
+import { RGBColor, ColorComponentFromFloat } from '../model/color.js';
import { PhongMaterial, TextureMap } from '../model/material.js';
import { Mesh } from '../model/mesh.js';
import { FlipMeshTrianglesOrientation, TransformMesh } from '../model/meshutils.js';
@@ -246,7 +246,7 @@ export class Importer3ds extends ImporterBase
ReadColorChunk (reader, length)
{
- let color = new Color (0, 0, 0);
+ let color = new RGBColor (0, 0, 0);
let endByte = this.GetChunkEnd (reader, length);
let hasLinColor = false;
this.ReadChunks (reader, endByte, (chunkId, chunkLength) => {
diff --git a/source/engine/import/importergltf.js b/source/engine/import/importergltf.js
index be6b42b..b5cfc74 100644
--- a/source/engine/import/importergltf.js
+++ b/source/engine/import/importergltf.js
@@ -8,7 +8,7 @@ import { Transformation } from '../geometry/transformation.js';
import { BinaryReader } from '../io/binaryreader.js';
import { ArrayBufferToUtf8String, Base64DataURIToArrayBuffer, GetFileExtensionFromMimeType } from '../io/bufferutils.js';
import { LoadExternalLibrary } from '../io/externallibs.js';
-import { Color, ColorComponentFromFloat, ColorFromFloatComponents, LinearToSRGB } from '../model/color.js';
+import { RGBColor, ColorComponentFromFloat, RGBColorFromFloatComponents, LinearToSRGB } from '../model/color.js';
import { PhongMaterial, PhysicalMaterial, TextureMap } from '../model/material.js';
import { Mesh } from '../model/mesh.js';
import { Node, NodeType } from '../model/node.js';
@@ -57,7 +57,7 @@ const GltfConstants =
function GetGltfColor (color)
{
- return ColorFromFloatComponents (
+ return RGBColorFromFloatComponents (
LinearToSRGB (color[0]),
LinearToSRGB (color[1]),
LinearToSRGB (color[2])
@@ -77,7 +77,7 @@ function GetGltfVertexColor (color, componentType)
return ColorComponentFromFloat (LinearToSRGB (normalized));
}
- return new Color (
+ return new RGBColor (
GetColorComponent (color[0], componentType),
GetColorComponent (color[1], componentType),
GetColorComponent (color[2], componentType)
diff --git a/source/engine/import/importerifc.js b/source/engine/import/importerifc.js
index 4029ba2..04d482e 100644
--- a/source/engine/import/importerifc.js
+++ b/source/engine/import/importerifc.js
@@ -3,7 +3,7 @@ import { Direction } from '../geometry/geometry.js';
import { Matrix } from '../geometry/matrix.js';
import { Transformation } from '../geometry/transformation.js';
import { LoadExternalLibrary } from '../io/externallibs.js';
-import { ColorFromFloatComponents } from '../model/color.js';
+import { RGBColorFromFloatComponents } from '../model/color.js';
import { Mesh } from '../model/mesh.js';
import { Property, PropertyGroup, PropertyType } from '../model/property.js';
import { Triangle } from '../model/triangle.js';
@@ -207,7 +207,7 @@ export class ImporterIfc extends ImporterBase
GetMaterialIndexByColor (ifcColor)
{
- const color = ColorFromFloatComponents (ifcColor.x, ifcColor.y, ifcColor.z);
+ const color = RGBColorFromFloatComponents (ifcColor.x, ifcColor.y, ifcColor.z);
const alpha = parseInt (ifcColor.w * 255.0, 10);
return this.colorToMaterial.GetMaterialIndex (color.r, color.g, color.b, alpha);
}
diff --git a/source/engine/import/importero3dv.js b/source/engine/import/importero3dv.js
index bd15d86..032c83b 100644
--- a/source/engine/import/importero3dv.js
+++ b/source/engine/import/importero3dv.js
@@ -5,7 +5,7 @@ import { Matrix } from '../geometry/matrix.js';
import { ArrayToQuaternion, Quaternion } from '../geometry/quaternion.js';
import { Transformation } from '../geometry/transformation.js';
import { ArrayBufferToUtf8String } from '../io/bufferutils.js';
-import { ArrayToColor } from '../model/color.js';
+import { ArrayToRGBColor } from '../model/color.js';
import { GenerateCone, GenerateCuboid, GenerateCylinder, GeneratePlatonicSolid, GenerateSphere, GeneratorParams } from '../model/generator.js';
import { PhysicalMaterial } from '../model/material.js';
import { Node, NodeType } from '../model/node.js';
@@ -76,7 +76,7 @@ export class ImporterO3dv extends ImporterBase
material.name = materialContent.name;
}
if (materialContent.color !== undefined) {
- material.color = ArrayToColor (materialContent.color);
+ material.color = ArrayToRGBColor (materialContent.color);
}
material.metalness = ValueOrDefault (materialContent.metalness, 0.0);
material.roughness = ValueOrDefault (materialContent.roughness, 1.0);
diff --git a/source/engine/import/importerobj.js b/source/engine/import/importerobj.js
index 2356bf8..c688bcd 100644
--- a/source/engine/import/importerobj.js
+++ b/source/engine/import/importerobj.js
@@ -2,7 +2,7 @@ import { Coord2D } from '../geometry/coord2d.js';
import { Coord3D } from '../geometry/coord3d.js';
import { Direction } from '../geometry/geometry.js';
import { ArrayBufferToUtf8String } from '../io/bufferutils.js';
-import { Color, ColorFromFloatComponents } from '../model/color.js';
+import { RGBColor, RGBColorFromFloatComponents } from '../model/color.js';
import { PhongMaterial, TextureMap } from '../model/material.js';
import { Mesh } from '../model/mesh.js';
import { Triangle } from '../model/triangle.js';
@@ -30,7 +30,7 @@ class ObjMeshConverter
AddVertexColor (globalIndex, globalVertexColors)
{
return this.GetLocalIndex (globalIndex, globalVertexColors, this.globalToMeshVertexColors, (val) => {
- return this.mesh.AddVertexColor (new Color (val.r, val.g, val.b));
+ return this.mesh.AddVertexColor (new RGBColor (val.r, val.g, val.b));
});
}
@@ -71,7 +71,7 @@ class ObjMeshConverter
function CreateColor (r, g, b)
{
- return ColorFromFloatComponents (
+ return RGBColorFromFloatComponents (
parseFloat (r),
parseFloat (g),
parseFloat (b)
diff --git a/source/engine/import/importeroff.js b/source/engine/import/importeroff.js
index e92a88d..371ac99 100644
--- a/source/engine/import/importeroff.js
+++ b/source/engine/import/importeroff.js
@@ -1,7 +1,7 @@
import { Coord3D } from '../geometry/coord3d.js';
import { Direction } from '../geometry/geometry.js';
import { ArrayBufferToUtf8String } from '../io/bufferutils.js';
-import { Color, ColorComponentFromFloat } from '../model/color.js';
+import { RGBColor, ColorComponentFromFloat } from '../model/color.js';
import { Mesh } from '../model/mesh.js';
import { Triangle } from '../model/triangle.js';
import { ImporterBase } from './importerbase.js';
@@ -97,7 +97,7 @@ export class ImporterOff extends ImporterBase
this.status.foundVertex += 1;
}
if (parameters.length >= 6) {
- this.mesh.AddVertexColor (new Color (
+ this.mesh.AddVertexColor (new RGBColor (
CreateColorComponent (parameters[3]),
CreateColorComponent (parameters[4]),
CreateColorComponent (parameters[5])
@@ -115,7 +115,7 @@ export class ImporterOff extends ImporterBase
}
let materialIndex = null;
if (!hasVertexColors && parameters.length >= vertexCount + 4) {
- let color = new Color (
+ let color = new RGBColor (
CreateColorComponent (parameters[vertexCount + 1]),
CreateColorComponent (parameters[vertexCount + 2]),
CreateColorComponent (parameters[vertexCount + 3])
diff --git a/source/engine/import/importerply.js b/source/engine/import/importerply.js
index 5a27123..72fe013 100644
--- a/source/engine/import/importerply.js
+++ b/source/engine/import/importerply.js
@@ -2,7 +2,7 @@ import { Coord3D } from '../geometry/coord3d.js';
import { Direction } from '../geometry/geometry.js';
import { BinaryReader } from '../io/binaryreader.js';
import { ArrayBufferToUtf8String } from '../io/bufferutils.js';
-import { Color, IntegerToHexString } from '../model/color.js';
+import { RGBColor, IntegerToHexString } from '../model/color.js';
import { PhongMaterial } from '../model/material.js';
import { Mesh } from '../model/mesh.js';
import { Triangle } from '../model/triangle.js';
@@ -124,7 +124,7 @@ class PlyMaterialHandler
} else {
let material = new PhongMaterial ();
material.name = materialName;
- material.color = new Color (color[0], color[1], color[2]);
+ material.color = new RGBColor (color[0], color[1], color[2]);
material.opacity = color[3] / 255.0;
UpdateMaterialTransparency (material);
let materialIndex = this.model.AddMaterial (material);
@@ -379,7 +379,7 @@ export class ImporterPly extends ImporterBase
let z = ReadByFormat (reader, element.format[2]);
let color = SkipAndGetColor (reader, element.format, 3);
if (color !== null) {
- this.mesh.AddVertexColor (new Color (color[0], color[1], color[2]));
+ this.mesh.AddVertexColor (new RGBColor (color[0], color[1], color[2]));
}
this.mesh.AddVertex (new Coord3D (x, y, z));
}
diff --git a/source/engine/import/importerstp.js b/source/engine/import/importerstp.js
index e8f55fb..930aa5f 100644
--- a/source/engine/import/importerstp.js
+++ b/source/engine/import/importerstp.js
@@ -1,7 +1,7 @@
import { Direction } from '../geometry/geometry.js';
import { GetExternalLibPath } from '../io/externallibs.js';
import { Node } from '../model/node.js';
-import { ColorFromFloatComponents } from '../model/color.js';
+import { RGBColorFromFloatComponents } from '../model/color.js';
import { ConvertThreeGeometryToMesh } from '../threejs/threeutils.js';
import { ImporterBase } from './importerbase.js';
import { ColorToMaterialConverter } from './importerutils.js';
@@ -88,7 +88,7 @@ export class ImporterStp extends ImporterBase
{
let materialIndex = null;
if (occtMesh.color) {
- let color = ColorFromFloatComponents (occtMesh.color[0], occtMesh.color[1], occtMesh.color[2]);
+ let color = RGBColorFromFloatComponents (occtMesh.color[0], occtMesh.color[1], occtMesh.color[2]);
materialIndex = colorToMaterial.GetMaterialIndex (color.r, color.g, color.b, null);
}
let mesh = ConvertThreeGeometryToMesh (occtMesh, materialIndex);
@@ -97,7 +97,7 @@ export class ImporterStp extends ImporterBase
}
if (occtMesh.face_colors) {
for (let faceColorGroup of occtMesh.face_colors) {
- let faceColor = ColorFromFloatComponents (faceColorGroup.color[0], faceColorGroup.color[1], faceColorGroup.color[2]);
+ let faceColor = RGBColorFromFloatComponents (faceColorGroup.color[0], faceColorGroup.color[1], faceColorGroup.color[2]);
let faceMaterialIndex = colorToMaterial.GetMaterialIndex (faceColor.r, faceColor.g, faceColor.b, null);
for (let i = faceColorGroup.first; i <= faceColorGroup.last; i++) {
let triangle = mesh.GetTriangle (i);
diff --git a/source/engine/import/importerutils.js b/source/engine/import/importerutils.js
index 3ce56df..9956fe2 100644
--- a/source/engine/import/importerutils.js
+++ b/source/engine/import/importerutils.js
@@ -1,6 +1,6 @@
import { IsLower } from '../geometry/geometry.js';
import { PhongMaterial } from '../model/material.js';
-import { Color, IntegerToHexString } from '../model/color.js';
+import { RGBColor, IntegerToHexString } from '../model/color.js';
export function NameFromLine (line, startIndex, commentChar)
{
@@ -89,7 +89,7 @@ export class ColorToMaterialConverter
} else {
let material = new PhongMaterial ();
material.name = colorKey.toUpperCase ();
- material.color = new Color (r, g, b);
+ material.color = new RGBColor (r, g, b);
if (hasAlpha && a < 255) {
material.opacity = a / 255.0;
UpdateMaterialTransparency (material);
diff --git a/source/engine/main.js b/source/engine/main.js
index 4b15948..56bf70c 100644
--- a/source/engine/main.js
+++ b/source/engine/main.js
@@ -43,7 +43,7 @@ import { ArrayBufferToUtf8String, ArrayBufferToAsciiString, AsciiStringToArrayBu
import { SetExternalLibLocation, GetExternalLibPath, LoadExternalLibrary } from './io/externallibs.js';
import { GetFileName, GetFileExtension, RequestUrl, ReadFile, TransformFileHostUrls, IsUrl, FileSource, FileFormat } from './io/fileutils.js';
import { TextWriter } from './io/textwriter.js';
-import { Color, ColorComponentFromFloat, ColorFromFloatComponents, SRGBToLinear, LinearToSRGB, IntegerToHexString, ColorToHexString, HexStringToColor, ArrayToColor, ColorIsEqual } from './model/color.js';
+import { RGBColor, ColorComponentFromFloat, RGBColorFromFloatComponents, SRGBToLinear, LinearToSRGB, IntegerToHexString, RGBColorToHexString, HexStringToRGBColor, ArrayToRGBColor, RGBColorIsEqual } from './model/color.js';
import { GeneratorParams, Generator, GeneratorHelper, GenerateCuboid, GenerateCone, GenerateCylinder, GenerateSphere, GeneratePlatonicSolid } from './model/generator.js';
import { TextureMap, MaterialBase, FaceMaterial, PhongMaterial, PhysicalMaterial, TextureMapIsEqual, TextureIsEqual, MaterialType } from './model/material.js';
import { Mesh } from './model/mesh.js';
@@ -199,16 +199,16 @@ export {
FileSource,
FileFormat,
TextWriter,
- Color,
+ RGBColor,
ColorComponentFromFloat,
- ColorFromFloatComponents,
+ RGBColorFromFloatComponents,
SRGBToLinear,
LinearToSRGB,
IntegerToHexString,
- ColorToHexString,
- HexStringToColor,
- ArrayToColor,
- ColorIsEqual,
+ RGBColorToHexString,
+ HexStringToRGBColor,
+ ArrayToRGBColor,
+ RGBColorIsEqual,
GeneratorParams,
Generator,
GeneratorHelper,
diff --git a/source/engine/model/color.js b/source/engine/model/color.js
index 153c4b8..7cbbe4b 100644
--- a/source/engine/model/color.js
+++ b/source/engine/model/color.js
@@ -1,4 +1,4 @@
-export class Color
+export class RGBColor
{
constructor (r, g, b)
{
@@ -16,7 +16,7 @@ export class Color
Clone ()
{
- return new Color (this.r, this.g, this.b);
+ return new RGBColor (this.r, this.g, this.b);
}
}
@@ -25,9 +25,9 @@ export function ColorComponentFromFloat (component)
return parseInt (Math.round (component * 255.0), 10);
}
-export function ColorFromFloatComponents (r, g, b)
+export function RGBColorFromFloatComponents (r, g, b)
{
- return new Color (
+ return new RGBColor (
ColorComponentFromFloat (r),
ColorComponentFromFloat (g),
ColorComponentFromFloat (b)
@@ -61,7 +61,7 @@ export function IntegerToHexString (intVal)
return result;
}
-export function ColorToHexString (color)
+export function RGBColorToHexString (color)
{
let r = IntegerToHexString (color.r);
let g = IntegerToHexString (color.g);
@@ -69,7 +69,7 @@ export function ColorToHexString (color)
return r + g + b;
}
-export function HexStringToColor (hexString)
+export function HexStringToRGBColor (hexString)
{
if (hexString.length !== 6) {
return null;
@@ -78,15 +78,15 @@ export function HexStringToColor (hexString)
let r = parseInt (hexString.substring (0, 2), 16);
let g = parseInt (hexString.substring (2, 4), 16);
let b = parseInt (hexString.substring (4, 6), 16);
- return new Color (r, g, b);
+ return new RGBColor (r, g, b);
}
-export function ArrayToColor (arr)
+export function ArrayToRGBColor (arr)
{
- return new Color (arr[0], arr[1], arr[2]);
+ return new RGBColor (arr[0], arr[1], arr[2]);
}
-export function ColorIsEqual (a, b)
+export function RGBColorIsEqual (a, b)
{
return a.r === b.r && a.g === b.g && a.b === b.b;
}
diff --git a/source/engine/model/material.js b/source/engine/model/material.js
index 9f1341d..a77a19c 100644
--- a/source/engine/model/material.js
+++ b/source/engine/model/material.js
@@ -1,6 +1,6 @@
import { Coord2D, CoordIsEqual2D } from '../geometry/coord2d.js';
import { IsEqual } from '../geometry/geometry.js';
-import { Color, ColorIsEqual } from './color.js';
+import { RGBColor, RGBColorIsEqual } from './color.js';
export class TextureMap
{
@@ -78,7 +78,7 @@ export class MaterialBase
this.isDefault = false;
this.name = '';
- this.color = new Color (0, 0, 0);
+ this.color = new RGBColor (0, 0, 0);
this.vertexColors = false;
}
@@ -94,7 +94,7 @@ export class MaterialBase
if (this.name !== rhs.name) {
return false;
}
- if (!ColorIsEqual (this.color, rhs.color)) {
+ if (!RGBColorIsEqual (this.color, rhs.color)) {
return false;
}
if (this.vertexColors !== rhs.vertexColors) {
@@ -110,7 +110,7 @@ export class FaceMaterial extends MaterialBase
{
super (type);
- this.emissive = new Color (0, 0, 0);
+ this.emissive = new RGBColor (0, 0, 0);
this.opacity = 1.0; // 0.0 .. 1.0
this.transparent = false;
@@ -129,7 +129,7 @@ export class FaceMaterial extends MaterialBase
if (!super.IsEqual (rhs)) {
return false;
}
- if (!ColorIsEqual (this.emissive, rhs.emissive)) {
+ if (!RGBColorIsEqual (this.emissive, rhs.emissive)) {
return false;
}
if (!IsEqual (this.opacity, rhs.opacity)) {
@@ -166,8 +166,8 @@ export class PhongMaterial extends FaceMaterial
{
super (MaterialType.Phong);
- this.ambient = new Color (0, 0, 0);
- this.specular = new Color (0, 0, 0);
+ this.ambient = new RGBColor (0, 0, 0);
+ this.specular = new RGBColor (0, 0, 0);
this.shininess = 0.0; // 0.0 .. 1.0
this.specularMap = null;
}
@@ -177,10 +177,10 @@ export class PhongMaterial extends FaceMaterial
if (!super.IsEqual (rhs)) {
return false;
}
- if (!ColorIsEqual (this.ambient, rhs.ambient)) {
+ if (!RGBColorIsEqual (this.ambient, rhs.ambient)) {
return false;
}
- if (!ColorIsEqual (this.specular, rhs.specular)) {
+ if (!RGBColorIsEqual (this.specular, rhs.specular)) {
return false;
}
if (!IsEqual (this.shininess, rhs.shininess)) {
diff --git a/source/engine/model/meshbuffer.js b/source/engine/model/meshbuffer.js
index e121839..17c181b 100644
--- a/source/engine/model/meshbuffer.js
+++ b/source/engine/model/meshbuffer.js
@@ -1,6 +1,6 @@
import { Coord2D, CoordIsEqual2D } from '../geometry/coord2d.js';
import { CoordIsEqual3D } from '../geometry/coord3d.js';
-import { Color, ColorIsEqual } from './color.js';
+import { RGBColor, RGBColorIsEqual } from './color.js';
export class MeshPrimitiveBuffer
{
@@ -75,7 +75,7 @@ export function ConvertMeshToMeshBuffer (mesh)
if (colorIndex !== null) {
return mesh.GetVertexColor (colorIndex);
} else if (forceColors) {
- return new Color (0, 0, 0);
+ return new RGBColor (0, 0, 0);
} else {
return null;
}
@@ -132,7 +132,7 @@ export function ConvertMeshToMeshBuffer (mesh)
return true;
}
let color = GetColorOrDefault (mesh, colorIndex, true);
- return ColorIsEqual (existingColor, color);
+ return RGBColorIsEqual (existingColor, color);
}
function IsEqualNormal (mesh, normalIndex, existingNormal)
diff --git a/source/engine/model/modelfinalization.js b/source/engine/model/modelfinalization.js
index 6e8af1a..2408e4e 100644
--- a/source/engine/model/modelfinalization.js
+++ b/source/engine/model/modelfinalization.js
@@ -1,6 +1,6 @@
import { CopyObjectAttributes } from '../core/core.js';
import { AddCoord3D, Coord3D, CoordIsEqual3D } from '../geometry/coord3d.js';
-import { Color } from './color.js';
+import { RGBColor } from './color.js';
import { PhongMaterial } from './material.js';
import { CalculateTriangleNormal, GetMeshType, MeshType } from './meshutils.js';
@@ -10,7 +10,7 @@ class ModelFinalizer
{
this.params = {
getDefaultMaterialColor : () => {
- return new Color (0, 0, 0);
+ return new RGBColor (0, 0, 0);
}
};
CopyObjectAttributes (params, this.params);
diff --git a/source/engine/model/property.js b/source/engine/model/property.js
index 8643230..1cf8592 100644
--- a/source/engine/model/property.js
+++ b/source/engine/model/property.js
@@ -1,5 +1,5 @@
import { EscapeHtmlChars } from '../core/core.js';
-import { ColorToHexString } from './color.js';
+import { RGBColorToHexString } from './color.js';
export const PropertyType =
{
@@ -80,7 +80,7 @@ export function PropertyToString (property)
} else if (property.type === PropertyType.Percent) {
return parseInt (property.value * 100, 10).toString () + '%';
} else if (property.type === PropertyType.Color) {
- return '#' + ColorToHexString (property.value);
+ return '#' + RGBColorToHexString (property.value);
}
return null;
}
diff --git a/source/engine/parameters/parameterlist.js b/source/engine/parameters/parameterlist.js
index 056a8a1..39ba3e5 100644
--- a/source/engine/parameters/parameterlist.js
+++ b/source/engine/parameters/parameterlist.js
@@ -1,5 +1,5 @@
import { Coord3D } from '../geometry/coord3d.js';
-import { Color } from '../model/color.js';
+import { RGBColor } from '../model/color.js';
import { Camera } from '../viewer/camera.js';
export let ParameterConverter =
@@ -93,7 +93,7 @@ export let ParameterConverter =
if (paramParts.length !== 3) {
return null;
}
- let color = new Color (
+ let color = new RGBColor (
this.StringToInteger (paramParts[0]),
this.StringToInteger (paramParts[1]),
this.StringToInteger (paramParts[2])
@@ -153,7 +153,7 @@ export let ParameterConverter =
}
let edgeSettings = {
showEdges : paramParts[0] === 'on' ? true : false,
- edgeColor : new Color (
+ edgeColor : new RGBColor (
this.StringToInteger (paramParts[1]),
this.StringToInteger (paramParts[2]),
this.StringToInteger (paramParts[3])
diff --git a/source/engine/threejs/threeutils.js b/source/engine/threejs/threeutils.js
index 5aa4a1e..ec91713 100644
--- a/source/engine/threejs/threeutils.js
+++ b/source/engine/threejs/threeutils.js
@@ -1,6 +1,6 @@
import { Coord2D } from '../geometry/coord2d.js';
import { Coord3D } from '../geometry/coord3d.js';
-import { ColorFromFloatComponents } from '../model/color.js';
+import { RGBColorFromFloatComponents } from '../model/color.js';
import { MaterialType } from '../model/material.js';
import { Mesh } from '../model/mesh.js';
import { Triangle } from '../model/triangle.js';
@@ -91,7 +91,7 @@ export function GetShadingType (model)
export function ConvertThreeColorToColor (threeColor)
{
- return ColorFromFloatComponents (threeColor.r, threeColor.g, threeColor.b);
+ return RGBColorFromFloatComponents (threeColor.r, threeColor.g, threeColor.b);
}
export function ConvertColorToThreeColor (color)
diff --git a/source/engine/viewer/viewer.js b/source/engine/viewer/viewer.js
index 1b19dd7..f1bdbb2 100644
--- a/source/engine/viewer/viewer.js
+++ b/source/engine/viewer/viewer.js
@@ -1,6 +1,6 @@
import { Coord3D, CoordDistance3D, SubCoord3D } from '../geometry/coord3d.js';
import { Direction } from '../geometry/geometry.js';
-import { ColorToHexString } from '../model/color.js';
+import { RGBColorToHexString } from '../model/color.js';
import { ShadingType } from '../threejs/threeutils.js';
import { Camera } from './camera.js';
import { GetDomElementInnerDimensions } from './domutils.js';
@@ -266,7 +266,7 @@ export class Viewer
SetBackgroundColor (color)
{
- let hexColor = '#' + ColorToHexString (color);
+ let hexColor = '#' + RGBColorToHexString (color);
this.renderer.setClearColor (hexColor, 1.0);
this.Render ();
}
diff --git a/source/engine/viewer/viewergeometry.js b/source/engine/viewer/viewergeometry.js
index 6c281c5..c04d0f6 100644
--- a/source/engine/viewer/viewergeometry.js
+++ b/source/engine/viewer/viewergeometry.js
@@ -1,4 +1,4 @@
-import { Color } from '../model/color.js';
+import { RGBColor } from '../model/color.js';
import { ConvertColorToThreeColor } from '../threejs/threeutils.js';
import * as THREE from 'three';
@@ -31,7 +31,7 @@ export class ViewerGeometry
this.edgeSettings = {
showEdges : false,
- edgeColor : new Color (0, 0, 0),
+ edgeColor : new RGBColor (0, 0, 0),
edgeThreshold : 1
};
}
diff --git a/source/website/settings.js b/source/website/settings.js
index 1a37802..cba85b4 100644
--- a/source/website/settings.js
+++ b/source/website/settings.js
@@ -1,4 +1,4 @@
-import { Color } from '../engine/model/color.js';
+import { RGBColor } from '../engine/model/color.js';
import { CookieGetBoolVal, CookieGetColorVal, CookieGetIntVal, CookieGetStringVal, CookieSetBoolVal, CookieSetColorVal, CookieSetIntVal, CookieSetStringVal } from './cookiehandler.js';
export const Theme =
@@ -13,10 +13,10 @@ export class Settings
{
this.environmentMapName = 'fishermans_bastion';
this.backgroundIsEnvMap = false;
- this.backgroundColor = new Color (255, 255, 255);
- this.defaultColor = new Color (200, 200, 200);
+ this.backgroundColor = new RGBColor (255, 255, 255);
+ this.defaultColor = new RGBColor (200, 200, 200);
this.showEdges = false;
- this.edgeColor = new Color (0, 0, 0);
+ this.edgeColor = new RGBColor (0, 0, 0);
this.edgeThreshold = 1;
this.themeId = Theme.Light;
}
@@ -25,10 +25,10 @@ export class Settings
{
this.environmentMapName = CookieGetStringVal ('ov_environment_map', 'fishermans_bastion');
this.backgroundIsEnvMap = CookieGetBoolVal ('ov_background_is_envmap', false);
- this.backgroundColor = CookieGetColorVal ('ov_background_color', new Color (255, 255, 255));
- this.defaultColor = CookieGetColorVal ('ov_default_color', new Color (200, 200, 200));
+ this.backgroundColor = CookieGetColorVal ('ov_background_color', new RGBColor (255, 255, 255));
+ this.defaultColor = CookieGetColorVal ('ov_default_color', new RGBColor (200, 200, 200));
this.showEdges = CookieGetBoolVal ('ov_show_edges', false);
- this.edgeColor = CookieGetColorVal ('ov_edge_color', new Color (0, 0, 0));
+ this.edgeColor = CookieGetColorVal ('ov_edge_color', new RGBColor (0, 0, 0));
this.edgeThreshold = CookieGetIntVal ('ov_edge_threshold', 1);
this.themeId = CookieGetIntVal ('ov_theme_id', Theme.Light);
}
diff --git a/source/website/sidebardetailspanel.js b/source/website/sidebardetailspanel.js
index 4002486..af4b767 100644
--- a/source/website/sidebardetailspanel.js
+++ b/source/website/sidebardetailspanel.js
@@ -8,7 +8,7 @@ import { SidebarPanel } from './sidebarpanel.js';
import { CreateInlineColorCircle } from './utils.js';
import { GetFileName, IsUrl } from '../engine/io/fileutils.js';
import { MaterialType } from '../engine/model/material.js';
-import { ColorToHexString } from '../engine/model/color.js';
+import { RGBColorToHexString } from '../engine/model/color.js';
export class SidebarDetailsPanel extends SidebarPanel
{
@@ -167,7 +167,7 @@ export class SidebarDetailsPanel extends SidebarPanel
valueHtml = PropertyToString (property);
}
} else if (property.type === PropertyType.Color) {
- let hexString = '#' + ColorToHexString (property.value);
+ let hexString = '#' + RGBColorToHexString (property.value);
let colorCircle = CreateInlineColorCircle (property.value);
targetDiv.appendChild (colorCircle);
AddDomElement (targetDiv, 'span', null, hexString);
diff --git a/source/website/sidebarsettingspanel.js b/source/website/sidebarsettingspanel.js
index 4bdc187..84e1aeb 100644
--- a/source/website/sidebarsettingspanel.js
+++ b/source/website/sidebarsettingspanel.js
@@ -1,4 +1,4 @@
-import { Color, ColorToHexString } from '../engine/model/color.js';
+import { RGBColor, RGBColorToHexString } from '../engine/model/color.js';
import { AddDiv, AddDomElement, ShowDomElement, SetDomElementOuterHeight } from '../engine/viewer/domutils.js';
import { AddRangeSlider, AddToggle, AddCheckbox } from '../website/utils.js';
import { CalculatePopupPositionToElementTopLeft } from './dialogs.js';
@@ -15,7 +15,7 @@ function AddColorPicker (parentDiv, defaultColor, predefinedColors, onChange)
position : 'left-start',
swatches : predefinedColors,
comparison : false,
- default : '#' + ColorToHexString (defaultColor),
+ default : '#' + RGBColorToHexString (defaultColor),
components : {
preview : false,
opacity : false,
@@ -34,7 +34,7 @@ function AddColorPicker (parentDiv, defaultColor, predefinedColors, onChange)
});
pickr.on ('change', (color, source, instance) => {
let rgbaColor = color.toRGBA ();
- let ovColor = new Color (
+ let ovColor = new RGBColor (
parseInt (rgbaColor[0], 10),
parseInt (rgbaColor[1], 10),
parseInt (rgbaColor[2], 10)
@@ -305,7 +305,7 @@ class SettingsModelDisplaySection extends SettingsSection
Update (settings)
{
if (this.backgroundColorPicker !== null) {
- this.backgroundColorPicker.setColor ('#' + ColorToHexString (settings.backgroundColor));
+ this.backgroundColorPicker.setColor ('#' + RGBColorToHexString (settings.backgroundColor));
}
if (this.environmentMapPbrInput !== null || this.environmentMapPhongDiv !== null) {
@@ -316,7 +316,7 @@ class SettingsModelDisplaySection extends SettingsSection
this.edgeDisplayToggle.SetStatus (settings.showEdges);
ShowDomElement (this.edgeSettingsDiv, settings.showEdges);
- this.edgeColorPicker.setColor ('#' + ColorToHexString (settings.edgeColor));
+ this.edgeColorPicker.setColor ('#' + RGBColorToHexString (settings.edgeColor));
this.thresholdSlider.value = settings.edgeThreshold;
this.thresholdSliderValue.innerHTML = settings.edgeThreshold;
}
@@ -362,7 +362,7 @@ class SettingsImportParametersSection extends SettingsSection
Update (settings)
{
if (this.defaultColorPicker !== null) {
- this.defaultColorPicker.setColor ('#' + ColorToHexString (settings.defaultColor));
+ this.defaultColorPicker.setColor ('#' + RGBColorToHexString (settings.defaultColor));
}
}
@@ -481,11 +481,11 @@ export class SidebarSettingsPanel extends SidebarPanel
this.appearanceSection.Init (this.settings, {
onThemeChange : () => {
if (this.settings.themeId === Theme.Light) {
- this.settings.backgroundColor = new Color (255, 255, 255);
- this.settings.defaultColor = new Color (200, 200, 200);
+ this.settings.backgroundColor = new RGBColor (255, 255, 255);
+ this.settings.defaultColor = new RGBColor (200, 200, 200);
} else if (this.settings.themeId === Theme.Dark) {
- this.settings.backgroundColor = new Color (42, 43, 46);
- this.settings.defaultColor = new Color (200, 200, 200);
+ this.settings.backgroundColor = new RGBColor (42, 43, 46);
+ this.settings.defaultColor = new RGBColor (200, 200, 200);
}
this.modelDisplaySection.Update (this.settings);
this.importParametersSection.Update (this.settings);
diff --git a/source/website/utils.js b/source/website/utils.js
index 63f3eff..c30675d 100644
--- a/source/website/utils.js
+++ b/source/website/utils.js
@@ -1,4 +1,4 @@
-import { Color, ColorToHexString } from '../engine/model/color.js';
+import { RGBColor, RGBColorToHexString } from '../engine/model/color.js';
import { CreateObjectUrl } from '../engine/io/bufferutils.js';
import { AddDiv, CreateDiv, AddDomElement, GetDomElementOuterWidth, SetDomElementOuterWidth } from '../engine/viewer/domutils.js';
import { CreateVerticalSplitter } from './splitter.js';
@@ -143,13 +143,13 @@ export function SetSvgIconImageElement (iconElement, iconName)
export function CreateInlineColorCircle (color)
{
- let hexString = '#' + ColorToHexString (color);
- let darkerColor = new Color (
+ let hexString = '#' + RGBColorToHexString (color);
+ let darkerColor = new RGBColor (
Math.max (0, color.r - 50),
Math.max (0, color.g - 50),
Math.max (0, color.b - 50)
);
- let darkerColorHexString = '#' + ColorToHexString (darkerColor);
+ let darkerColorHexString = '#' + RGBColorToHexString (darkerColor);
let circleDiv = CreateDiv ('ov_color_circle');
circleDiv.style.background = hexString;
circleDiv.style.border = '1px solid ' + darkerColorHexString;
diff --git a/test/tests/exporter_test.js b/test/tests/exporter_test.js
index a96c471..727a744 100644
--- a/test/tests/exporter_test.js
+++ b/test/tests/exporter_test.js
@@ -10,9 +10,9 @@ function CreateTestModel ()
let material1 = new OV.PhongMaterial ();
material1.name = 'TestMaterial1';
- material1.ambient = new OV.Color (0, 0, 0);
- material1.color = new OV.Color (255, 0, 0);
- material1.specular = new OV.Color (51, 51, 51);
+ material1.ambient = new OV.RGBColor (0, 0, 0);
+ material1.color = new OV.RGBColor (255, 0, 0);
+ material1.specular = new OV.RGBColor (51, 51, 51);
material1.diffuseMap = new OV.TextureMap ();
material1.diffuseMap.name = 'textures/texture1.png';
material1.diffuseMap.buffer = new ArrayBuffer (1);
@@ -26,9 +26,9 @@ function CreateTestModel ()
let material2 = new OV.PhongMaterial ();
material2.name = 'TestMaterial2';
- material2.ambient = new OV.Color (0, 0, 0);
- material2.color = new OV.Color (0, 255, 0);
- material2.specular = new OV.Color (51, 51, 51);
+ material2.ambient = new OV.RGBColor (0, 0, 0);
+ material2.color = new OV.RGBColor (0, 255, 0);
+ material2.specular = new OV.RGBColor (51, 51, 51);
model.AddMaterial (material2);
let mesh1 = new OV.Mesh ();
@@ -217,7 +217,7 @@ describe ('Exporter', function () {
let importer = new OV.ImporterStl ();
importer.Import (stlFile.GetName (), 'stl', contentBuffer, {
getDefaultMaterialColor () {
- return new OV.Color (0, 0, 0);
+ return new OV.RGBColor (0, 0, 0);
},
onSuccess () {
let importedModel = importer.GetModel ();
@@ -311,7 +311,7 @@ describe ('Exporter', function () {
let importer = new OV.ImporterPly ();
importer.Import (plyFile.GetName (), 'ply', contentBuffer, {
getDefaultMaterialColor () {
- return new OV.Color (0, 0, 0);
+ return new OV.RGBColor (0, 0, 0);
},
onSuccess () {
let importedModel = importer.GetModel ();
@@ -341,7 +341,7 @@ describe ('Exporter', function () {
let importer = new OV.ImporterGltf ();
importer.Import (gltfFile.GetName (), 'gltf', contentBuffer, {
getDefaultMaterialColor () {
- return new OV.Color (0, 0, 0);
+ return new OV.RGBColor (0, 0, 0);
},
getFileBuffer (filePath) {
if (filePath == 'model.bin') {
@@ -376,7 +376,7 @@ describe ('Exporter', function () {
let importer = new OV.ImporterGltf ();
importer.Import (glbFile.GetName (), 'glb', contentBuffer, {
getDefaultMaterialColor () {
- return new OV.Color (0, 0, 0);
+ return new OV.RGBColor (0, 0, 0);
},
getFileBuffer (filePath) {
return null;
diff --git a/test/tests/exportimport_test.js b/test/tests/exportimport_test.js
index 2623982..486cd1e 100644
--- a/test/tests/exportimport_test.js
+++ b/test/tests/exportimport_test.js
@@ -18,19 +18,19 @@ function CreateTestModel ()
let phongMaterial = new OV.PhongMaterial ();
phongMaterial.name = 'Phong Material';
- phongMaterial.emissive = new OV.Color (1, 1, 1);
+ phongMaterial.emissive = new OV.RGBColor (1, 1, 1);
phongMaterial.opacity = 0.1;
phongMaterial.transparent = true;
phongMaterial.alphaTest = 0.2;
phongMaterial.multiplyDiffuseMap = false;
- phongMaterial.ambient = new OV.Color (2, 2, 2);
- phongMaterial.specular = new OV.Color (3, 3, 3);
+ phongMaterial.ambient = new OV.RGBColor (2, 2, 2);
+ phongMaterial.specular = new OV.RGBColor (3, 3, 3);
phongMaterial.shininess = 0.3;
model.AddMaterial (phongMaterial);
let phongMaterialTexture = new OV.PhongMaterial ();
phongMaterialTexture.name = 'Phong Material With Texture';
- phongMaterialTexture.emissive = new OV.Color (1, 1, 1);
+ phongMaterialTexture.emissive = new OV.RGBColor (1, 1, 1);
phongMaterialTexture.opacity = 0.1;
phongMaterialTexture.transparent = true;
phongMaterialTexture.alphaTest = 0.2;
@@ -39,15 +39,15 @@ function CreateTestModel ()
phongMaterialTexture.bumpMap = CreateTexture ('bump.png', 'bump_url.png');
phongMaterialTexture.normalMap = CreateTexture ('normal.png', 'normal_url.png');
phongMaterialTexture.emissiveMap = CreateTexture ('emissive.png', 'emissive_url.png');
- phongMaterialTexture.ambient = new OV.Color (2, 2, 2);
- phongMaterialTexture.specular = new OV.Color (3, 3, 3);
+ phongMaterialTexture.ambient = new OV.RGBColor (2, 2, 2);
+ phongMaterialTexture.specular = new OV.RGBColor (3, 3, 3);
phongMaterialTexture.shininess = 0.3;
phongMaterialTexture.specularMap = CreateTexture ('specular.png', 'specular_url.png');
model.AddMaterial (phongMaterialTexture);
let physicalMaterialTexture = new OV.PhysicalMaterial ();
physicalMaterialTexture.name = 'Phong Material With Texture';
- physicalMaterialTexture.emissive = new OV.Color (1, 1, 1);
+ physicalMaterialTexture.emissive = new OV.RGBColor (1, 1, 1);
physicalMaterialTexture.opacity = 0.1;
physicalMaterialTexture.transparent = true;
physicalMaterialTexture.alphaTest = 0.2;
@@ -240,7 +240,7 @@ describe ('Export-Import Vertex Colors Test', function () {
mesh.AddVertex (new OV.Coord3D (0.0, 0.0, 0.0));
mesh.AddVertex (new OV.Coord3D (1.0, 0.0, 0.0));
mesh.AddVertex (new OV.Coord3D (1.0, 1.0, 0.0));
- mesh.AddVertexColor (new OV.Color (1.0, 0.0, 0.0));
+ mesh.AddVertexColor (new OV.RGBColor (1.0, 0.0, 0.0));
mesh.AddTriangle (new OV.Triangle (0, 1, 2).SetVertexColors (0, 0, 0));
model.AddMeshToRootNode (mesh);
OV.FinalizeModel (model);
diff --git a/test/tests/importer_test.js b/test/tests/importer_test.js
index 9d04c2c..4a611fc 100644
--- a/test/tests/importer_test.js
+++ b/test/tests/importer_test.js
@@ -259,7 +259,7 @@ describe ('Importer Test', function () {
];
let theImporter = new OV.Importer ();
let settings = new OV.ImportSettings ();
- settings.defaultColor = new OV.Color (200, 0, 0);
+ settings.defaultColor = new OV.RGBColor (200, 0, 0);
let inputFiles = OV.InputFilesFromFileObjects (files);
theImporter.ImportFiles (inputFiles, settings, {
onFilesLoaded : function () {
@@ -270,7 +270,7 @@ describe ('Importer Test', function () {
assert.deepStrictEqual (importResult.usedFiles, ['single_triangle.stl']);
assert.deepStrictEqual (importResult.missingFiles, []);
let material = importResult.model.GetMaterial (0);
- assert.deepStrictEqual (material.color, new OV.Color (200, 0, 0));
+ assert.deepStrictEqual (material.color, new OV.RGBColor (200, 0, 0));
done ();
},
onImportError : function (importError) {
diff --git a/test/tests/importeroff_test.js b/test/tests/importeroff_test.js
index a8beddc..093330f 100644
--- a/test/tests/importeroff_test.js
+++ b/test/tests/importeroff_test.js
@@ -219,7 +219,7 @@ describe ('Off Importer', function () {
it ('rectangle_face_colors_int.off', function (done) {
ImportOffFile ('rectangle_face_colors_int.off', function (model) {
assert.ok (OV.CheckModel (model));
- assert.ok (OV.ColorIsEqual (model.GetMaterial (0).color, new OV.Color (255, 0, 0)));
+ assert.ok (OV.RGBColorIsEqual (model.GetMaterial (0).color, new OV.RGBColor (255, 0, 0)));
assert.strictEqual (model.GetMaterial (0).vertexColors, false);
assert.deepStrictEqual (ModelToObject (model), {
name : '',
@@ -253,7 +253,7 @@ describe ('Off Importer', function () {
it ('rectangle_face_colors_int.off', function (done) {
ImportOffFile ('rectangle_face_colors_float.off', function (model) {
assert.ok (OV.CheckModel (model));
- assert.ok (OV.ColorIsEqual (model.GetMaterial (0).color, new OV.Color (255, 0, 0)));
+ assert.ok (OV.RGBColorIsEqual (model.GetMaterial (0).color, new OV.RGBColor (255, 0, 0)));
assert.strictEqual (model.GetMaterial (0).vertexColors, false);
assert.deepStrictEqual (ModelToObject (model), {
name : '',
diff --git a/test/tests/meshbuffer_test.js b/test/tests/meshbuffer_test.js
index 10ffd8e..13640d5 100644
--- a/test/tests/meshbuffer_test.js
+++ b/test/tests/meshbuffer_test.js
@@ -40,8 +40,8 @@ describe ('Mesh Buffer', function () {
mesh.AddVertex (new OV.Coord3D (1.0, 1.0, 0.0));
mesh.AddVertex (new OV.Coord3D (0.0, 1.0, 0.0));
- mesh.AddVertexColor (new OV.Color (0.1, 0.0, 0.0));
- mesh.AddVertexColor (new OV.Color (0.2, 0.0, 0.0));
+ mesh.AddVertexColor (new OV.RGBColor (0.1, 0.0, 0.0));
+ mesh.AddVertexColor (new OV.RGBColor (0.2, 0.0, 0.0));
mesh.AddNormal (new OV.Coord3D (0.0, 0.0, 1.0));
mesh.AddTriangle (new OV.Triangle (0, 1, 2).SetVertexColors (0, 0, 0).SetNormals (0, 0, 0).SetMaterial (0));
diff --git a/test/tests/model_test.js b/test/tests/model_test.js
index b957b02..00175da 100644
--- a/test/tests/model_test.js
+++ b/test/tests/model_test.js
@@ -223,17 +223,17 @@ describe ('Model Finalization', function () {
describe ('Color Conversion', function () {
it ('Color equality check', function () {
- assert.ok (OV.ColorIsEqual (new OV.Color (10, 20, 30), new OV.Color (10, 20, 30)));
- assert.ok (!OV.ColorIsEqual (new OV.Color (10, 20, 30), new OV.Color (11, 20, 30)));
- assert.ok (!OV.ColorIsEqual (new OV.Color (10, 20, 30), new OV.Color (10, 21, 30)));
- assert.ok (!OV.ColorIsEqual (new OV.Color (10, 20, 30), new OV.Color (10, 20, 31)));
+ assert.ok (OV.RGBColorIsEqual (new OV.RGBColor (10, 20, 30), new OV.RGBColor (10, 20, 30)));
+ assert.ok (!OV.RGBColorIsEqual (new OV.RGBColor (10, 20, 30), new OV.RGBColor (11, 20, 30)));
+ assert.ok (!OV.RGBColorIsEqual (new OV.RGBColor (10, 20, 30), new OV.RGBColor (10, 21, 30)));
+ assert.ok (!OV.RGBColorIsEqual (new OV.RGBColor (10, 20, 30), new OV.RGBColor (10, 20, 31)));
});
it ('Color hex string conversion', function () {
- let color = new OV.Color (10, 20, 30);
+ let color = new OV.RGBColor (10, 20, 30);
let hexString = '0a141e';
- assert.strictEqual (OV.ColorToHexString (color), hexString);
- assert.deepStrictEqual (OV.HexStringToColor (hexString), color);
+ assert.strictEqual (OV.RGBColorToHexString (color), hexString);
+ assert.deepStrictEqual (OV.HexStringToRGBColor (hexString), color);
});
});
diff --git a/test/tests/parameterlist_test.js b/test/tests/parameterlist_test.js
index 01d4603..94ff0d9 100644
--- a/test/tests/parameterlist_test.js
+++ b/test/tests/parameterlist_test.js
@@ -12,8 +12,8 @@ describe ('Parameter List', function () {
new OV.Coord3D (0.0, 0.0, 0.0),
new OV.Coord3D (0.0, 0.0, 1.0)
);
- let background = new OV.Color (4, 5, 6);
- let color = new OV.Color (1, 2, 3);
+ let background = new OV.RGBColor (4, 5, 6);
+ let color = new OV.RGBColor (1, 2, 3);
let urlParams1 = OV.CreateUrlBuilder ().AddModelUrls (modelUrls).GetParameterList ();
let urlParams2 = OV.CreateUrlBuilder ().AddCamera (camera).GetParameterList ();
let urlParams3 = OV.CreateUrlBuilder ().AddModelUrls (modelUrls).AddCamera (camera).GetParameterList ();
@@ -21,7 +21,7 @@ describe ('Parameter List', function () {
let urlParams5 = OV.CreateUrlBuilder ().AddModelUrls (modelUrls).AddCamera (camera).AddBackgroundColor (background).AddDefaultColor (color).GetParameterList ();
let urlParams6 = OV.CreateUrlBuilder ().AddEdgeSettings ({
showEdges : true,
- edgeColor : new OV.Color (1, 2, 3),
+ edgeColor : new OV.RGBColor (1, 2, 3),
edgeThreshold : 15
}).GetParameterList ();
assert.strictEqual (urlParams1, 'model=a.txt,b.txt');
@@ -39,8 +39,8 @@ describe ('Parameter List', function () {
new OV.Coord3D (0.0, 0.0, 0.0),
new OV.Coord3D (0.0, 0.0, 1.0)
);
- let background = new OV.Color (4, 5, 6);
- let color = new OV.Color (1, 2, 3);
+ let background = new OV.RGBColor (4, 5, 6);
+ let color = new OV.RGBColor (1, 2, 3);
let urlParamsLegacy = 'a.txt,b.txt';
let urlParams1 = 'model=a.txt,b.txt';
let urlParams2 = 'camera=1.0000,1.0000,1.0000,0.0000,0.0000,0.0000,0.0000,0.0000,1.0000';
@@ -75,7 +75,7 @@ describe ('Parameter List', function () {
let parser6 = OV.CreateUrlParser (urlParams6);
assert.deepStrictEqual (parser6.GetEdgeSettings (), {
showEdges : true,
- edgeColor : new OV.Color (1, 2, 3),
+ edgeColor : new OV.RGBColor (1, 2, 3),
edgeThreshold : 15
});
});
diff --git a/test/tests/property_test.js b/test/tests/property_test.js
index bda5c2f..3e31195 100644
--- a/test/tests/property_test.js
+++ b/test/tests/property_test.js
@@ -73,7 +73,7 @@ describe ('Property Test', function () {
group1.AddProperty (new OV.Property (OV.PropertyType.Text, 'name 01', 'value 01'));
group2.AddProperty (new OV.Property (OV.PropertyType.Integer, 'name 02', 2));
group3.AddProperty (new OV.Property (OV.PropertyType.Number, 'name 03', 3.5));
- group3.AddProperty (new OV.Property (OV.PropertyType.Color, 'name 04', new OV.Color (10, 20, 30)));
+ group3.AddProperty (new OV.Property (OV.PropertyType.Color, 'name 04', new OV.RGBColor (10, 20, 30)));
mesh.AddPropertyGroup (group1);
mesh.AddPropertyGroup (group2);
mesh.AddPropertyGroup (group3);
@@ -90,8 +90,8 @@ describe ('Property Test', function () {
assert.strictEqual (cloned.GetPropertyGroup (2).GetProperty (0).value, 3.5);
assert.strictEqual (cloned.GetPropertyGroup (2).GetProperty (1).name, 'name 04');
assert.strictEqual (
- OV.ColorToHexString (cloned.GetPropertyGroup (2).GetProperty (1).value),
- OV.ColorToHexString (new OV.Color (10, 20, 30))
+ OV.RGBColorToHexString (cloned.GetPropertyGroup (2).GetProperty (1).value),
+ OV.RGBColorToHexString (new OV.RGBColor (10, 20, 30))
);
});
@@ -102,7 +102,7 @@ describe ('Property Test', function () {
assert.strictEqual (OV.PropertyToString (new OV.Property (OV.PropertyType.Boolean, 'name', true)), 'True');
assert.strictEqual (OV.PropertyToString (new OV.Property (OV.PropertyType.Boolean, 'name', false)), 'False');
assert.strictEqual (OV.PropertyToString (new OV.Property (OV.PropertyType.Percent, 'name', 0.2)), '20%');
- assert.strictEqual (OV.PropertyToString (new OV.Property (OV.PropertyType.Color, 'color', new OV.Color (10, 20, 20))), '#0a1414');
+ assert.strictEqual (OV.PropertyToString (new OV.Property (OV.PropertyType.Color, 'color', new OV.RGBColor (10, 20, 20))), '#0a1414');
});
});
diff --git a/test/utils/testfiles.js b/test/utils/testfiles.js
index 4d70d93..b469e99 100644
--- a/test/utils/testfiles.js
+++ b/test/utils/testfiles.js
@@ -12,7 +12,7 @@ export function ImportFile (importer, folder, fileName, onReady)
});
importer.Import (fileName, extension, content, {
getDefaultMaterialColor () {
- return new OV.Color (0, 0, 0);
+ return new OV.RGBColor (0, 0, 0);
},
getFileBuffer : function (filePath) {
return fileAccessor.GetFileBuffer (filePath);