a few more changes to pbs

0.9.1.0-post-fixes
UbitUmarov 2018-11-17 20:22:15 +00:00
parent 87a723cbc8
commit f6d4fadb0a
1 changed files with 30 additions and 67 deletions

View File

@ -1082,8 +1082,9 @@ namespace OpenSim.Framework
returnBytes[i++] |= (byte)((byte)(_flexiDrag * 10.01f) & 0x7F); returnBytes[i++] |= (byte)((byte)(_flexiDrag * 10.01f) & 0x7F);
returnBytes[i++] = (byte)((_flexiGravity + 10.0f) * 10.01f); returnBytes[i++] = (byte)((_flexiGravity + 10.0f) * 10.01f);
returnBytes[i++] = (byte)(_flexiWind * 10.01f); returnBytes[i++] = (byte)(_flexiWind * 10.01f);
Vector3 lForce = new Vector3(_flexiForceX, _flexiForceY, _flexiForceZ); Utils.FloatToBytes(_flexiForceX, returnBytes, i);
lForce.GetBytes().CopyTo(returnBytes, i); Utils.FloatToBytes(_flexiForceY, returnBytes, i + 4);
Utils.FloatToBytes(_flexiForceZ, returnBytes, i + 8);
i += 12; i += 12;
} }
@ -1097,9 +1098,9 @@ namespace OpenSim.Framework
// Alpha channel in color is intensity // Alpha channel in color is intensity
Color4 tmpColor = new Color4(_lightColorR, _lightColorG, _lightColorB, _lightIntensity); Color4 tmpColor = new Color4(_lightColorR, _lightColorG, _lightColorB, _lightIntensity);
tmpColor.GetBytes().CopyTo(returnBytes, i); tmpColor.GetBytes().CopyTo(returnBytes, i);
Utils.FloatToBytes(_lightRadius).CopyTo(returnBytes, i + 4); Utils.FloatToBytes(_lightRadius, returnBytes, i + 4);
Utils.FloatToBytes(_lightCutoff).CopyTo(returnBytes, i + 8); Utils.FloatToBytes(_lightCutoff, returnBytes, i + 8);
Utils.FloatToBytes(_lightFalloff).CopyTo(returnBytes, i + 12); Utils.FloatToBytes(_lightFalloff, returnBytes, i + 12);
i += 16; i += 16;
} }
@ -1179,100 +1180,67 @@ namespace OpenSim.Framework
public void ReadInExtraParamsBytes(byte[] data) public void ReadInExtraParamsBytes(byte[] data)
{ {
if (data == null || data.Length == 1) if (data == null)
return; return;
const ushort FlexiEP = 0x10; _flexiEntry = false;
const ushort LightEP = 0x20; _lightEntry = false;
const ushort SculptEP = 0x30; _sculptEntry = false;
const ushort ProjectionEP = 0x40; _projectionEntry = false;
bool lGotFlexi = false; if (data.Length == 1)
bool lGotLight = false; return;
bool lGotSculpt = false;
bool lGotFilter = false;
int i = 0; const byte FlexiEP = 0x10;
byte extraParamCount = 0; const byte LightEP = 0x20;
if (data.Length > 0) const byte SculptEP = 0x30;
{ const byte ProjectionEP = 0x40;
extraParamCount = data[i++];
}
byte extraParamCount = data[0];
int i = 1;
for (int k = 0; k < extraParamCount; k++) for (int k = 0; k < extraParamCount; k++)
{ {
ushort epType = Utils.BytesToUInt16(data, i); byte epType = data[i];
i += 6;
i += 2;
// uint paramLength = Helpers.BytesToUIntBig(data, i);
i += 4;
switch (epType) switch (epType)
{ {
case FlexiEP: case FlexiEP:
ReadFlexiData(data, i); ReadFlexiData(data, i);
i += 16; i += 16;
lGotFlexi = true;
break; break;
case LightEP: case LightEP:
ReadLightData(data, i); ReadLightData(data, i);
i += 16; i += 16;
lGotLight = true;
break; break;
case SculptEP: case SculptEP:
ReadSculptData(data, i); ReadSculptData(data, i);
i += 17; i += 17;
lGotSculpt = true;
break; break;
case ProjectionEP: case ProjectionEP:
ReadProjectionData(data, i); ReadProjectionData(data, i);
i += 28; i += 28;
lGotFilter = true;
break; break;
} }
} }
if (!lGotFlexi)
_flexiEntry = false;
if (!lGotLight)
_lightEntry = false;
if (!lGotSculpt)
_sculptEntry = false;
if (!lGotFilter)
_projectionEntry = false;
} }
public void ReadSculptData(byte[] data, int pos) public void ReadSculptData(byte[] data, int pos)
{ {
UUID SculptUUID;
byte SculptTypel;
if (data.Length-pos >= 17) if (data.Length-pos >= 17)
{ {
_sculptEntry = true; _sculptTexture = new UUID(data, pos);
byte[] SculptTextureUUID = new byte[16]; _sculptType = data[pos + 16];
SculptTypel = data[16 + pos]; _sculptEntry = (_sculptType != 0);
Array.Copy(data, pos, SculptTextureUUID,0, 16);
SculptUUID = new UUID(SculptTextureUUID, 0);
} }
else else
{ {
_sculptEntry = false; _sculptEntry = false;
SculptUUID = UUID.Zero; _sculptTexture = UUID.Zero;
SculptTypel = 0x00; _sculptType = 0x00;
} }
if (_sculptEntry)
{
if (_sculptType != (byte)1 && _sculptType != (byte)2 && _sculptType != (byte)3 && _sculptType != (byte)4)
_sculptType = 4;
}
_sculptTexture = SculptUUID;
_sculptType = SculptTypel;
//m_log.Info("[SCULPT]:" + SculptUUID.ToString());
} }
public void ReadFlexiData(byte[] data, int pos) public void ReadFlexiData(byte[] data, int pos)
@ -1286,10 +1254,9 @@ namespace OpenSim.Framework
_flexiDrag = (float)(data[pos++] & 0x7F) / 10.0f; _flexiDrag = (float)(data[pos++] & 0x7F) / 10.0f;
_flexiGravity = (float)(data[pos++] / 10.0f) - 10.0f; _flexiGravity = (float)(data[pos++] / 10.0f) - 10.0f;
_flexiWind = (float)data[pos++] / 10.0f; _flexiWind = (float)data[pos++] / 10.0f;
Vector3 lForce = new Vector3(data, pos); _flexiForceX = Utils.BytesToFloat(data, pos);
_flexiForceX = lForce.X; _flexiForceY = Utils.BytesToFloat(data, pos + 4);
_flexiForceY = lForce.Y; _flexiForceZ = Utils.BytesToFloat(data, pos + 8);
_flexiForceZ = lForce.Z;
} }
else else
{ {
@ -1338,14 +1305,10 @@ namespace OpenSim.Framework
public void ReadProjectionData(byte[] data, int pos) public void ReadProjectionData(byte[] data, int pos)
{ {
byte[] ProjectionTextureUUID = new byte[16];
if (data.Length - pos >= 28) if (data.Length - pos >= 28)
{ {
_projectionEntry = true; _projectionEntry = true;
Array.Copy(data, pos, ProjectionTextureUUID,0, 16); _projectionTextureID = new UUID(data, pos);
_projectionTextureID = new UUID(ProjectionTextureUUID, 0);
_projectionFOV = Utils.BytesToFloat(data, pos + 16); _projectionFOV = Utils.BytesToFloat(data, pos + 16);
_projectionFocus = Utils.BytesToFloat(data, pos + 20); _projectionFocus = Utils.BytesToFloat(data, pos + 20);
_projectionAmb = Utils.BytesToFloat(data, pos + 24); _projectionAmb = Utils.BytesToFloat(data, pos + 24);