aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Framework/PrimitiveBaseShape.cs81
1 files changed, 81 insertions, 0 deletions
diff --git a/OpenSim/Framework/PrimitiveBaseShape.cs b/OpenSim/Framework/PrimitiveBaseShape.cs
index 5e4d175..f8dac06 100644
--- a/OpenSim/Framework/PrimitiveBaseShape.cs
+++ b/OpenSim/Framework/PrimitiveBaseShape.cs
@@ -1066,5 +1066,86 @@ namespace OpenSim.Framework
1066 1066
1067 return data; 1067 return data;
1068 } 1068 }
1069
1070
1071 /// <summary>
1072 /// Creates a OpenMetaverse.Primitive and populates it with converted PrimitiveBaseShape values
1073 /// </summary>
1074 /// <returns></returns>
1075 public Primitive ToOmvPrimitive()
1076 {
1077 // position and rotation defaults here since they are not available in PrimitiveBaseShape
1078 return ToOmvPrimitive(new Vector3(0.0f, 0.0f, 0.0f),
1079 new Quaternion(0.0f, 0.0f, 0.0f, 1.0f));
1080 }
1081
1082
1083 /// <summary>
1084 /// Creates a OpenMetaverse.Primitive and populates it with converted PrimitiveBaseShape values
1085 /// </summary>
1086 /// <param name="position"></param>
1087 /// <param name="rotation"></param>
1088 /// <returns></returns>
1089 public Primitive ToOmvPrimitive(Vector3 position, Quaternion rotation)
1090 {
1091 OpenMetaverse.Primitive prim = new OpenMetaverse.Primitive();
1092 prim.Scale = this.Scale;
1093 prim.Position = position;
1094 prim.Rotation = rotation;
1095
1096 if (this.SculptEntry)
1097 {
1098 prim.Sculpt = new Primitive.SculptData();
1099 prim.Sculpt.Type = (OpenMetaverse.SculptType)this.SculptType;
1100 prim.Sculpt.SculptTexture = this.SculptTexture;
1101
1102 return prim;
1103 }
1104
1105 prim.PrimData.PathShearX = this.PathShearX < 128 ? (float)this.PathShearX * 0.01f : (float)(this.PathShearX - 256) * 0.01f;
1106 prim.PrimData.PathShearY = this.PathShearY < 128 ? (float)this.PathShearY * 0.01f : (float)(this.PathShearY - 256) * 0.01f;
1107 prim.PrimData.PathBegin = (float)this.PathBegin * 2.0e-5f;
1108 prim.PrimData.PathEnd = 1.0f - (float)this.PathEnd * 2.0e-5f;
1109 prim.PrimData.PathScaleX = (float)(this.PathScaleX - 100) * 0.01f;
1110 prim.PrimData.PathScaleY = (float)(this.PathScaleY - 100) * 0.01f;
1111
1112 prim.PrimData.ProfileBegin = (float)this.ProfileBegin * 2.0e-5f;
1113 prim.PrimData.ProfileEnd = 1.0f - (float)this.ProfileEnd * 2.0e-5f;
1114 prim.PrimData.ProfileHollow = (float)this.ProfileHollow * 2.0e-5f;
1115
1116 prim.PrimData.profileCurve = this.ProfileCurve;
1117 prim.PrimData.ProfileHole = (HoleType)this.HollowShape;
1118
1119 prim.PrimData.PathTwistBegin = this.PathTwistBegin * 18 / 10;
1120 prim.PrimData.PathTwist = this.PathTwist * 18 / 10;
1121
1122 prim.PrimData.PathTaperX = this.PathTaperX * 0.01f;
1123 prim.PrimData.PathTaperY = this.PathTaperY * 0.01f;
1124
1125 if (this.FlexiEntry)
1126 {
1127 prim.Flexible = new Primitive.FlexibleData();
1128 prim.Flexible.Drag = this.FlexiDrag;
1129 prim.Flexible.Force = new Vector3(this.FlexiForceX, this.FlexiForceY, this.FlexiForceZ);
1130 prim.Flexible.Gravity = this.FlexiGravity;
1131 prim.Flexible.Softness = this.FlexiSoftness;
1132 prim.Flexible.Tension = this.FlexiTension;
1133 prim.Flexible.Wind = this.FlexiWind;
1134 }
1135
1136 if (this.LightEntry)
1137 {
1138 prim.Light = new Primitive.LightData();
1139 prim.Light.Color = new Color4(this.LightColorR, this.LightColorG, this.LightColorB, this.LightColorA);
1140 prim.Light.Cutoff = this.LightCutoff;
1141 prim.Light.Falloff = this.LightFalloff;
1142 prim.Light.Intensity = this.LightIntensity;
1143 prim.Light.Radius = this.LightRadius;
1144 }
1145
1146 prim.Textures = new Primitive.TextureEntry(this.TextureEntry, 0, this.TextureEntry.Length);
1147
1148 return prim;
1149 }
1069 } 1150 }
1070} 1151}