Показать сообщение отдельно
Старый 26.05.2007, 22:02   #24
HolyDel
 
Регистрация: 26.09.2006
Сообщений: 6,035
Написано 1,474 полезных сообщений
(для 2,707 пользователей)
Re: Как узнать размер меша?

stack overflow?
вот алгоритм находи ВСЕ чилды нужног нам аниментити.
переираем все его чилды и находим левую и правую границу.
Вот, я написал кртину чтоб было понятнее.
http://likosoft.ucoz.ru/ameshsize.PNG

вот код, только идея, на работоспособность не проверял.
ПС. етот ентити должен быть неотскален.
Type childent
	Field ent
End Type

Function AnimMeshWidth(ent)
	GetAllChilds(ent)
	For ce.childent=Each childent
		If ce=First childent
			
			minx=EntityX(ce\ent)-MeshWidth(ce\ent)
			maxx=EntityX(ce\ent)+MeshWidth(ce\ent)
			Else
			
			If minx>EntityX(ce\ent)-MeshWidth(ce\ent) Then minx=EntityX(ce\ent)-MeshWidth(ce\ent)
			If maxx<EntityX(ce\ent)+MeshWidth(ce\ent) Then maxx=EntityX(ce\ent)+MeshWidth(ce\ent)			
		EndIf
	Next
	Delete Each childent
	Return maxx-minx
End Function

Function GetAllChilds(ent)
		For i=1 To CountChildren(ent)
			If CountChildren(ent)>0
				GetAllChilds(ent)
			Else
				ce.childent=New childent
				ce\ent=ent
			EndIf
		Next
End Function
(Offline)
 
Ответить с цитированием