Render.ru

Мульти текстура

ENGine

Пользователь сайта
Рейтинг
2
#1
Всем привет. Есть скрипт экспортирующий модель из макса в *.mesh файл. Проблема в том, что модель имеет мультитекстуру. В данном случаи модель комнаты, ну и соответствующая мультитекстура (текстура пола, потолка и стен). Экспортирую я следующие данные:
Код:
format "<faces count=\"%\">\n" smoothingGroups[smoothingGroupIndex].faceCount to:out_file 
for faceIndex = 1 to smoothingGroups[smoothingGroupIndex].faceCount do 
( 
format "<face " to:out_file 
format "v1=\"%\" " (smoothingGroups[smoothingGroupIndex].faces[faceIndex].vertexIndices[1] - 1) to:out_file 
format "v2=\"%\" " (smoothingGroups[smoothingGroupIndex].faces[faceIndex].vertexIndices[2] - 1) to:out_file 
format "v3=\"%\" />\n" (smoothingGroups[smoothingGroupIndex].faces[faceIndex].vertexIndices[3] - 1) to:out_file
) 
format "</faces>\n" to:out_file 
			
format "<geometry vertexcount=\"%\">\n" smoothingGroups[smoothingGroupIndex].vertexCount to:out_file 
format "<vertexbuffer positions=\"true\" " to:out_file 
format "normals=\"true\" " to:out_file 
format "colours_diffuse=\"false\" " to:out_file 
format "texture_coords=\"1\" " to:out_file 
format "texture_coord_dimensions_0=\"2\" >\n" to:out_file 
for vertexIndex = 1 to smoothingGroups[smoothingGroupIndex].vertexCount do 
(  
format "<vertex>\n" to:out_file 
                
format "<position x=\"%\" " smoothingGroups[smoothingGroupIndex].vertexes[vertexIndex].position[1] to:out_file 
format "y=\"%\" " smoothingGroups[smoothingGroupIndex].vertexes[vertexIndex].position[2] to:out_file 
format "z=\"%\" />\n" smoothingGroups[smoothingGroupIndex].vertexes[vertexIndex].position[3] to:out_file 
            
format "<normal x=\"%\" " smoothingGroups[smoothingGroupIndex].vertexes[vertexIndex].normal[1] to:out_file 
format "y=\"%\" " smoothingGroups[smoothingGroupIndex].vertexes[vertexIndex].normal[2] to:out_file 
format "z=\"%\" />\n" smoothingGroups[smoothingGroupIndex].vertexes[vertexIndex].normal[3] to:out_file 
        
format "<texcoord u=\"%\" " smoothingGroups[smoothingGroupIndex].vertexes[vertexIndex].uv[1] to:out_file 
format "v=\"%\" />\n" (1 - smoothingGroups[smoothingGroupIndex].vertexes[vertexIndex].uv[2]) to:out_file 
        
format "</vertex>\n" to:out_file 
)
Мне еще нужно экспортировать submesh material, если я правильно понимаю, то следующим образом obj.material.materiallist[iArr].name. Так вот проблема в том, что описываю я к примеру потолок, а материал ему прописываю стены, то есть я не могу правильно найти iArr. Необходимо, чтобы я описывал потолок и текстуру прописал соответствующую. А вот с реализацией проблемы =( Хелп ? )
 

Savin Denis

Модератор форума
Команда форума
Рейтинг
138
#2
Твой iArr это material ID который есть у каждого face, например для мешки можно получить getFaceMatID
 
Сверху