Skip to content
Snippets Groups Projects
Commit b0ab77ee authored by Alexander Rose's avatar Alexander Rose
Browse files

fix, render variant change needs to trigger and material change

parent cb1ab8b6
No related branches found
No related tags found
No related merge requests found
......@@ -137,6 +137,7 @@ export interface WebGLContext {
currentProgramId: number
currentMaterialId: number
currentRenderVariant: string
bufferCount: number
framebufferCount: number
......@@ -265,6 +266,7 @@ export function createContext(gl: GLRenderingContext): WebGLContext {
currentProgramId: -1,
currentMaterialId: -1,
currentRenderVariant: '',
bufferCount: 0,
framebufferCount: 0,
......
......@@ -140,6 +140,10 @@ export function createRenderItem(ctx: WebGLContext, drawMode: DrawMode, shaderCo
const program = programs[variant].value
const vertexArray = vertexArrays[variant]
program.setUniforms(uniformValueEntries)
if (ctx.currentRenderVariant !== variant) {
ctx.currentMaterialId = -1
ctx.currentRenderVariant = variant
}
if (materialId === -1 || materialId !== ctx.currentMaterialId) {
// console.log('materialId changed or -1', materialId)
program.setUniforms(materialUniformValueEntries)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment