{"record":{"id":"cfecd3cbbb3d4d89","repo":"BabylonJS/Babylon.js","slug":"can-not-floor-a-color","errorCode":null,"errorMessage":"Can not floor a color","messagePattern":"Can not floor a color","errorType":"exception","errorClass":"ReferenceError","httpStatus":null,"severity":"error","filePath":"packages/dev/core/src/Maths/math.color.pure.ts","lineNumber":275,"sourceCode":"     * Updates the current Color3 with the maximal coordinate values between its and the given coordinates.\r\n     * @param r defines the r coordinate of the operand\r\n     * @param g defines the g coordinate of the operand\r\n     * @param b defines the b coordinate of the operand\r\n     * @returns the current updated Color3\r\n     */\r\n    public maximizeInPlaceFromFloats(r: number, g: number, b: number): this {\r\n        this.r = Math.max(r, this.r);\r\n        this.g = Math.max(g, this.g);\r\n        this.b = Math.max(b, this.b);\r\n        return this;\r\n    }\r\n\r\n    /**\r\n     * @internal\r\n     * Do not use\r\n     */\r\n    public floorToRef(_result: IColor3Like): never {\r\n        throw new ReferenceError(\"Can not floor a color\");\r\n    }\r\n\r\n    /**\r\n     * @internal\r\n     * Do not use\r\n     */\r\n    public floor(): never {\r\n        throw new ReferenceError(\"Can not floor a color\");\r\n    }\r\n\r\n    /**\r\n     * @internal\r\n     * Do not use\r\n     */\r\n    public fractToRef(_result: IColor3Like): never {\r\n        throw new ReferenceError(\"Can not fract a color\");\r\n    }\r\n\r","sourceCodeStart":257,"sourceCodeEnd":293,"githubUrl":"https://github.com/BabylonJS/Babylon.js/blob/0592b347b8a4ee0236089ea86a749cacfdb266d8/packages/dev/core/src/Maths/math.color.pure.ts#L257-L293","documentation":"Color3.floorToRef is a deliberate stub that throws ReferenceError(\"Can not floor a color\"). Component-wise flooring is not supported for Color3 in this API because it has no defined color-space meaning. Any call throws unconditionally.","triggerScenarios":"Calling color3.floorToRef(result) directly, or generic quantization code that applies floorToRef to an IColor3Like object.","commonSituations":"Quantizing/clamping color channel values with vector-style helpers; bulk processing of arrays of colors with a shared math routine; porting numeric pipelines to colors.","solutions":["Floor components manually: result.r = Math.floor(c.r); result.g = Math.floor(c.g); result.b = Math.floor(c.b).","Clamp channels to [0,1] with Math.min/Math.max if the goal is range limiting, not flooring.","Use a Vector3 if you need the full vector operation set.","Route color inputs away from generic floor/quantization helpers."],"exampleFix":"// before\nconst out = {};\ncolor.floorToRef(out);\n// after\nconst out = {\n  r: Math.floor(color.r),\n  g: Math.floor(color.g),\n  b: Math.floor(color.b)\n};","handlingStrategy":"fallback","validationCode":"if (color instanceof Color3) {\n  result.r = Math.floor(color.r);\n  result.g = Math.floor(color.g);\n  result.b = Math.floor(color.b);\n} else {\n  color.floorToRef(result);\n}","typeGuard":"function isColor3Like(c: unknown): c is IColor3Like {\n  return !!c && typeof c === 'object' && 'r' in c && 'g' in c && 'b' in c && !('a' in c);\n}","tryCatchPattern":"try {\n  color.floorToRef(result);\n} catch (e) {\n  if (e instanceof ReferenceError && e.message === 'Can not floor a color') {\n    result.r = Math.floor(color.r);\n    result.g = Math.floor(color.g);\n    result.b = Math.floor(color.b);\n  } else {\n    throw e;\n  }\n}","preventionTips":["Floor color channels with Math.floor per component instead of floorToRef.","Use clamp helpers when the goal is limiting channels to [0,1].","Route shared quantization code around color operands.","Remember Color3 intentionally omits floor/fract/negate/divide."],"tags":["color3","unsupported-operation","math","reference-error"],"backgroundTag":"unsupported-color-operation","analyzedSha":"0592b347b8a4ee0236089ea86a749cacfdb266d8","analyzedAt":"2026-08-30T15:11:20.442Z","schemaVersion":2},"datasetVersion":"2026-08-30T18:17:15.746Z"}