Преглед изворни кода

Update Collada Exporter to export lightmap uvs

rogangriffin пре 5 година
родитељ
комит
b886901e6c
1 измењених фајлова са 8 додато и 1 уклоњено
  1. 8 1
      examples/jsm/exporters/ColladaExporter.js

+ 8 - 1
examples/jsm/exporters/ColladaExporter.js

@@ -264,6 +264,13 @@ ColladaExporter.prototype = {
 					triangleInputs += `<input semantic="TEXCOORD" source="#${ uvName }" offset="0" set="0" />`;
 					triangleInputs += `<input semantic="TEXCOORD" source="#${ uvName }" offset="0" set="0" />`;
 
 
 				}
 				}
+				
+				// serialize lightmap uvs
+				if ( 'uv2' in bufferGeometry.attributes ) {
+					var uvName = `${ meshid }-texcoord2`;
+					gnode += getAttribute( bufferGeometry.attributes.uv2, uvName, [ 'S', 'T' ], 'float' );
+					triangleInputs += `<input semantic="TEXCOORD" source="#${ uvName }" offset="0" set="1" />`;
+				}
 
 
 				// serialize colors
 				// serialize colors
 				if ( 'color' in bufferGeometry.attributes ) {
 				if ( 'color' in bufferGeometry.attributes ) {
@@ -273,7 +280,7 @@ ColladaExporter.prototype = {
 					triangleInputs += `<input semantic="COLOR" source="#${ colName }" offset="0" />`;
 					triangleInputs += `<input semantic="COLOR" source="#${ colName }" offset="0" />`;
 
 
 				}
 				}
-
+				
 				var indexArray = null;
 				var indexArray = null;
 				if ( bufferGeometry.index ) {
 				if ( bufferGeometry.index ) {