Skip to content

Commit

Permalink
Fix patch color material (#12)
Browse files Browse the repository at this point in the history
* Fix patch material that doesn't use color
  • Loading branch information
agargaro authored Oct 15, 2024
1 parent 310758f commit 6631530
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@three.ez/instanced-mesh",
"version": "0.2.3",
"version": "0.2.4",
"description": "Simplified and enhanced InstancedMesh with frustum culling, fast raycasting (using BVH), sorting, visibility management and more.",
"author": "Andrea Gargaro <devgargaro@gmail.com>",
"license": "MIT",
Expand Down
3 changes: 3 additions & 0 deletions src/objects/InstancedMesh2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,12 @@ export class InstancedMesh2<
shader.defines["USE_INSTANCING_INDIRECT"] = "";

if (this.colorsTexture !== null) {
if (!shader.fragmentShader.includes("#include <color_pars_fragment>")) return;

shader.uniforms.colorsTexture = { value: this.colorsTexture };
shader.defines["USE_INSTANCING_COLOR_INDIRECT"] = "";
shader.fragmentShader = shader.fragmentShader.replace("#include <common>", "#define USE_COLOR\n#include <common>");
// NOTE that '#defined USE_COLOR' is defined only in fragment shader to make it work.
}
}

Expand Down

0 comments on commit 6631530

Please sign in to comment.