Reuse the position/rotation vectors when they occur multiple times
This change has the potential of saving memory when there are multiple poses with the same position or rotation. Based on a suggestion by @ohhmye (thanks).
This commit is contained in:
parent
56fd9672a3
commit
1e40fe9c32
1 changed files with 13 additions and 2 deletions
|
@ -574,8 +574,19 @@ default
|
||||||
{
|
{
|
||||||
if (index != -1)
|
if (index != -1)
|
||||||
{
|
{
|
||||||
POS_ROT_LIST = llListReplaceList(POS_ROT_LIST, [(vector)llList2String(data, 1), (vector)llList2String(data, 2)], index * 2, index * 2 + 1);
|
one = llGetListLength(data);
|
||||||
if (llGetListLength(data) != 3)
|
data = [(vector)llList2String(data, 1), (vector)llList2String(data, 2)];
|
||||||
|
|
||||||
|
// LSL::
|
||||||
|
// Reuse the preexisting vectors when possible, to save memory
|
||||||
|
if ((two = llListFindList(POS_ROT_LIST, llList2List(data, 0, 0))) != -1)
|
||||||
|
data = llList2List(POS_ROT_LIST, two, two) + llList2List(data, 1, 1);
|
||||||
|
if ((two = llListFindList(POS_ROT_LIST, llList2List(data, 1, 1))) != -1)
|
||||||
|
data = llList2List(data, 0, 0) + llList2List(POS_ROT_LIST, two, two);
|
||||||
|
// ::LSL
|
||||||
|
|
||||||
|
POS_ROT_LIST = llListReplaceList(POS_ROT_LIST, data, index * 2, index * 2 + 1);
|
||||||
|
if (one != 3)
|
||||||
{
|
{
|
||||||
send_anim_info(FALSE);
|
send_anim_info(FALSE);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue