From 024bd4c47070bd1d1373a085954c74739b1be0c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9verin=20Lemaignan?= Date: Sat, 30 Mar 2013 21:39:51 +0100 Subject: [PATCH] [pyassimp] Handle diffuse/ambient values stored as vec3 instead of vec4 --- port/PyAssimp/scripts/3d_viewer.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/port/PyAssimp/scripts/3d_viewer.py b/port/PyAssimp/scripts/3d_viewer.py index 60170af4b..cd417bd15 100755 --- a/port/PyAssimp/scripts/3d_viewer.py +++ b/port/PyAssimp/scripts/3d_viewer.py @@ -291,8 +291,13 @@ class PyAssimp3DViewer: stride = 24 # 6 * 4 bytes - glUniform4f( shader.Material_diffuse, *mesh.material.properties["diffuse"] ) - glUniform4f( shader.Material_ambient, *mesh.material.properties["ambient"] ) + diffuse = mesh.material.properties["diffuse"] + if len(diffuse) == 3: diffuse.append(1.0) + ambient = mesh.material.properties["ambient"] + if len(ambient) == 3: ambient.append(1.0) + + glUniform4f( shader.Material_diffuse, *diffuse ) + glUniform4f( shader.Material_ambient, *ambient ) vbo = mesh.gl["vbo"] vbo.bind()