From 743c5ef68059e132770c61d465ae035341f30c48 Mon Sep 17 00:00:00 2001 From: Erik Onarheim Date: Wed, 31 Jul 2024 23:11:37 -0500 Subject: [PATCH] docs: Add missing u_color documentation --- site/docs/04-graphics/4.2-material.mdx | 2 ++ src/engine/Graphics/Context/material.ts | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/site/docs/04-graphics/4.2-material.mdx b/site/docs/04-graphics/4.2-material.mdx index 67bcb091a..85db06f51 100644 --- a/site/docs/04-graphics/4.2-material.mdx +++ b/site/docs/04-graphics/4.2-material.mdx @@ -139,6 +139,8 @@ var waterMaterial = game.graphicsContext.createMaterial({ Materials come with a lot of built in uniforms you can use! +* `vec4 u_color` - This is the current color of the material + * `float u_time_ms` - This is `performance.now()` a ms timestamp that starts from initial navigation to the page * `float u_opacity` - Current opacity of your graphic, [[Graphic.opacity]] diff --git a/src/engine/Graphics/Context/material.ts b/src/engine/Graphics/Context/material.ts index ea2547060..45c679d39 100644 --- a/src/engine/Graphics/Context/material.ts +++ b/src/engine/Graphics/Context/material.ts @@ -155,6 +155,14 @@ export class Material { this._initialized = true; } + get color(): Color { + return this._color; + } + + set color(c: Color) { + this._color = c; + } + get name() { return this._name ?? 'anonymous material'; }