Quellcode durchsuchen

Minor optimization for indirect instancing

TothBenoit vor 1 Monat
Ursprung
Commit
ea61a5dabd
1 geänderte Dateien mit 2 neuen und 2 gelöschten Zeilen
  1. 2 2
      h3d/shader/InstanceIndirect.hx

+ 2 - 2
h3d/shader/InstanceIndirect.hx

@@ -117,7 +117,7 @@ class SubPartInstanceIndirect extends InstanceIndirectBase {
 
 		function main() {
 			if ( invocID < instanceCount ) {
-				var pos = vec3(0) * modelView.mat3x4();
+				var pos = vec3(modelView[0].w, modelView[1].w, modelView[2].w);
 				var vScale = abs(vec3(1) * modelView.mat3x4() - pos);
 				var scaledRadius = max(max(vScale.x, vScale.y), vScale.z);
 				var toCam = camera.position - pos.xyz;
@@ -173,7 +173,7 @@ class InstanceIndirect extends InstanceIndirectBase {
 
 		function main() {
 			if ( invocID < instanceCount ) {
-				var pos = vec3(0) * modelView.mat3x4();
+				var pos = vec3(modelView[0].w, modelView[1].w, modelView[2].w);
 				var vScale = abs(vec3(1) * modelView.mat3x4() - pos);
 				var scaledRadius = max(max(vScale.x, vScale.y), vScale.z);
 				var toCam = camera.position - pos.xyz;