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