diff options
Diffstat (limited to 'OpenSim/Framework/PrimitiveBaseShape.cs')
-rw-r--r-- | OpenSim/Framework/PrimitiveBaseShape.cs | 101 |
1 files changed, 101 insertions, 0 deletions
diff --git a/OpenSim/Framework/PrimitiveBaseShape.cs b/OpenSim/Framework/PrimitiveBaseShape.cs index 5e4d175..97231ff 100644 --- a/OpenSim/Framework/PrimitiveBaseShape.cs +++ b/OpenSim/Framework/PrimitiveBaseShape.cs | |||
@@ -1066,5 +1066,106 @@ 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 | |||
1093 | prim.Scale = this.Scale; | ||
1094 | prim.Position = position; | ||
1095 | prim.Rotation = rotation; | ||
1096 | |||
1097 | if (this.SculptEntry) | ||
1098 | { | ||
1099 | prim.Sculpt = new Primitive.SculptData(); | ||
1100 | prim.Sculpt.Type = (OpenMetaverse.SculptType)this.SculptType; | ||
1101 | prim.Sculpt.SculptTexture = this.SculptTexture; | ||
1102 | |||
1103 | return prim; | ||
1104 | } | ||
1105 | |||
1106 | prim.PrimData.PathShearX = this.PathShearX < 128 ? (float)this.PathShearX * 0.01f : (float)(this.PathShearX - 256) * 0.01f; | ||
1107 | prim.PrimData.PathShearY = this.PathShearY < 128 ? (float)this.PathShearY * 0.01f : (float)(this.PathShearY - 256) * 0.01f; | ||
1108 | prim.PrimData.PathBegin = (float)this.PathBegin * 2.0e-5f; | ||
1109 | prim.PrimData.PathEnd = 1.0f - (float)this.PathEnd * 2.0e-5f; | ||
1110 | |||
1111 | prim.PrimData.PathScaleX = (200 - this.PathScaleX) * 0.01f; | ||
1112 | prim.PrimData.PathScaleY = (200 - this.PathScaleY) * 0.01f; | ||
1113 | |||
1114 | prim.PrimData.PathTaperX = this.PathTaperX * 0.01f; | ||
1115 | prim.PrimData.PathTaperY = this.PathTaperY * 0.01f; | ||
1116 | |||
1117 | prim.PrimData.PathTwistBegin = this.PathTwistBegin * 0.01f; | ||
1118 | prim.PrimData.PathTwist = this.PathTwist * 0.01f; | ||
1119 | |||
1120 | prim.PrimData.ProfileBegin = (float)this.ProfileBegin * 2.0e-5f; | ||
1121 | prim.PrimData.ProfileEnd = 1.0f - (float)this.ProfileEnd * 2.0e-5f; | ||
1122 | prim.PrimData.ProfileHollow = (float)this.ProfileHollow * 2.0e-5f; | ||
1123 | |||
1124 | prim.PrimData.profileCurve = this.ProfileCurve; | ||
1125 | prim.PrimData.ProfileHole = (HoleType)this.HollowShape; | ||
1126 | |||
1127 | prim.PrimData.PathCurve = (PathCurve)this.PathCurve; | ||
1128 | prim.PrimData.PathRadiusOffset = 0.01f * this.PathRadiusOffset; | ||
1129 | prim.PrimData.PathRevolutions = 1.0f + 0.015f * this.PathRevolutions; | ||
1130 | prim.PrimData.PathSkew = 0.01f * this.PathSkew; | ||
1131 | |||
1132 | prim.PrimData.PCode = OpenMetaverse.PCode.Prim; | ||
1133 | prim.PrimData.State = 0; | ||
1134 | |||
1135 | if (this.FlexiEntry) | ||
1136 | { | ||
1137 | prim.Flexible = new Primitive.FlexibleData(); | ||
1138 | prim.Flexible.Drag = this.FlexiDrag; | ||
1139 | prim.Flexible.Force = new Vector3(this.FlexiForceX, this.FlexiForceY, this.FlexiForceZ); | ||
1140 | prim.Flexible.Gravity = this.FlexiGravity; | ||
1141 | prim.Flexible.Softness = this.FlexiSoftness; | ||
1142 | prim.Flexible.Tension = this.FlexiTension; | ||
1143 | prim.Flexible.Wind = this.FlexiWind; | ||
1144 | } | ||
1145 | |||
1146 | if (this.LightEntry) | ||
1147 | { | ||
1148 | prim.Light = new Primitive.LightData(); | ||
1149 | prim.Light.Color = new Color4(this.LightColorR, this.LightColorG, this.LightColorB, this.LightColorA); | ||
1150 | prim.Light.Cutoff = this.LightCutoff; | ||
1151 | prim.Light.Falloff = this.LightFalloff; | ||
1152 | prim.Light.Intensity = this.LightIntensity; | ||
1153 | prim.Light.Radius = this.LightRadius; | ||
1154 | } | ||
1155 | |||
1156 | prim.Textures = new Primitive.TextureEntry(this.TextureEntry, 0, this.TextureEntry.Length); | ||
1157 | |||
1158 | prim.Properties = new Primitive.ObjectProperties(); | ||
1159 | prim.Properties.Name = "Primitive"; | ||
1160 | prim.Properties.Description = ""; | ||
1161 | prim.Properties.CreatorID = UUID.Zero; | ||
1162 | prim.Properties.GroupID = UUID.Zero; | ||
1163 | prim.Properties.OwnerID = UUID.Zero; | ||
1164 | prim.Properties.Permissions = new Permissions(); | ||
1165 | prim.Properties.SalePrice = 10; | ||
1166 | prim.Properties.SaleType = new SaleType(); | ||
1167 | |||
1168 | return prim; | ||
1169 | } | ||
1069 | } | 1170 | } |
1070 | } | 1171 | } |