public void Start(IScene scene) { m_scene = scene; m_dataStore = m_scene.Simian.GetAppModule<IDataStore>(); if (m_dataStore == null) { m_log.Error("LLPrimitiveLoader requires an IDataStore"); return; } m_primMesher = m_scene.GetSceneModule<IPrimMesher>(); if (m_primMesher == null) { m_log.Error("LLPrimitiveLoader requires an IPrimMesher"); return; } m_writeQueue = new ThrottledQueue<UUID, PrimSerialization>(5, 1000 * 30, true, SerializationHandler); m_writeQueue.Start(); m_scene.OnEntityAddOrUpdate += EntityAddOrUpdateHandler; m_scene.OnEntityRemove += EntityRemoveHandler; Deserialize(); }
public void Start(IScene scene) { m_scene = scene; m_assetClient = m_scene.Simian.GetAppModule<IAssetClient>(); if (m_assetClient == null) { m_log.Warn("Upload requires an IAssetClient"); return; } m_httpServer = m_scene.Simian.GetAppModule<IHttpServer>(); if (m_httpServer == null) { m_log.Warn("Upload requires an IHttpServer"); return; } m_primMesher = m_scene.GetSceneModule<IPrimMesher>(); m_permissions = m_scene.GetSceneModule<LLPermissions>(); m_scene.Capabilities.AddProtectedResource(m_scene.ID, "UploadBakedTexture", UploadBakedTextureHandler); m_scene.Capabilities.AddProtectedResource(m_scene.ID, "UploadBakedTextureData", UploadBakedTextureDataHandler); m_scene.Capabilities.AddProtectedResource(m_scene.ID, "UploadObjectAsset", UploadObjectAssetHandler); }
public void Start(IScene scene) { m_scene = scene; m_scheduler = m_scene.Simian.GetAppModule <IScheduler>(); if (m_scheduler == null) { m_log.Error("OARLoader requires an IScheduler"); return; } m_assetClient = m_scene.Simian.GetAppModule <IAssetClient>(); if (m_assetClient == null) { m_log.Error("OARLoader requires an IAssetClient"); return; } m_primMesher = m_scene.GetSceneModule <IPrimMesher>(); m_terrain = m_scene.GetSceneModule <ITerrain>(); m_regionInfo = m_scene.GetSceneModule <RegionInfo>(); m_udp = m_scene.GetSceneModule <LLUDP>(); m_permissions = m_scene.GetSceneModule <LLPermissions>(); m_scene.AddCommandHandler("loadoar", LoadOARHandler); }
public void Start(IScene scene) { m_scene = scene; m_assetClient = m_scene.Simian.GetAppModule <IAssetClient>(); if (m_assetClient == null) { m_log.Warn("Upload requires an IAssetClient"); return; } m_httpServer = m_scene.Simian.GetAppModule <IHttpServer>(); if (m_httpServer == null) { m_log.Warn("Upload requires an IHttpServer"); return; } m_primMesher = m_scene.GetSceneModule <IPrimMesher>(); m_permissions = m_scene.GetSceneModule <LLPermissions>(); m_scene.Capabilities.AddProtectedResource(m_scene.ID, "UploadBakedTexture", UploadBakedTextureHandler); m_scene.Capabilities.AddProtectedResource(m_scene.ID, "UploadBakedTextureData", UploadBakedTextureDataHandler); m_scene.Capabilities.AddProtectedResource(m_scene.ID, "UploadObjectAsset", UploadObjectAssetHandler); }
public void Start(IScene scene) { m_scene = scene; m_dataStore = m_scene.Simian.GetAppModule <IDataStore>(); if (m_dataStore == null) { m_log.Error("LLPrimitiveLoader requires an IDataStore"); return; } m_primMesher = m_scene.GetSceneModule <IPrimMesher>(); if (m_primMesher == null) { m_log.Error("LLPrimitiveLoader requires an IPrimMesher"); return; } m_scriptEngine = m_scene.GetSceneModule <ILSLScriptEngine>(); m_writeQueue = new ThrottledQueue <UUID, PrimSerialization>(5, 1000 * 30, true, SerializationHandler); m_writeQueue.Start(); m_scene.OnEntityAddOrUpdate += EntityAddOrUpdateHandler; m_scene.OnEntityRemove += EntityRemoveHandler; Deserialize(); }
public void Start(IScene scene) { m_assetClient = scene.Simian.GetAppModule<IAssetClient>(); m_terrain = scene.GetSceneModule<ITerrain>(); m_primMesher = scene.GetSceneModule<IPrimMesher>(); m_lslScriptEngine = scene.GetSceneModule<ILSLScriptEngine>(); int implemented = CountMethods(); m_log.Debug("Initializing LSL API with " + implemented + "/" + m_methods.Count + " implemented methods"); }
public void Start(IScene scene) { m_httpServer = scene.Simian.GetAppModule <IHttpServer>(); m_assetClient = scene.Simian.GetAppModule <IAssetClient>(); m_terrain = scene.GetSceneModule <ITerrain>(); m_primMesher = scene.GetSceneModule <IPrimMesher>(); m_lslScriptEngine = scene.GetSceneModule <ILSLScriptEngine>(); m_messaging = scene.GetSceneModule <Messaging>(); m_sounds = scene.GetSceneModule <Sounds>(); }
public void Start(IScene scene) { m_httpServer = scene.Simian.GetAppModule<IHttpServer>(); m_assetClient = scene.Simian.GetAppModule<IAssetClient>(); m_terrain = scene.GetSceneModule<ITerrain>(); m_primMesher = scene.GetSceneModule<IPrimMesher>(); m_lslScriptEngine = scene.GetSceneModule<ILSLScriptEngine>(); m_messaging = scene.GetSceneModule<Messaging>(); m_sounds = scene.GetSceneModule<Sounds>(); }
private void CreateAllPrims(IScene scene, WarpRenderer renderer, IPrimMesher primMesher) { if (primMesher == null) { return; } scene.ForEachEntity( delegate(ISceneEntity entity) { if (entity is LLPrimitive) { CreatePrim(renderer, (LLPrimitive)entity, primMesher); } } ); }
/// <summary> /// Constructor /// </summary> public LLPrimitive(Primitive prim, IScene scene, IPrimMesher mesher) { Prim = prim; m_scene = scene; m_mesher = mesher; Inventory = new PrimInventory(this); if (prim.ID == UUID.Zero) prim.ID = UUID.Random(); if (prim.LocalID == 0) prim.LocalID = m_scene.CreateLocalID(); if (prim.ParentID != 0) { ISceneEntity parent; if (scene.TryGetEntity(prim.ParentID, out parent) && parent is ILinkable) SetParent((ILinkable)parent, false, false); } m_lastUpdated = DateTime.UtcNow; }
public static LLPrimitive PrimObjectToLLPrim(PrimObject obj, IScene scene, IPrimMesher mesher) { Primitive prim = new Primitive(); prim.Properties = new Primitive.ObjectProperties(); LLPrimitive llprim = new LLPrimitive(prim, scene, mesher); prim.Acceleration = obj.Acceleration; if (obj.AllowedDrop) { prim.Flags |= PrimFlags.AllowInventoryDrop; } prim.AngularVelocity = obj.AngularVelocity; llprim.AttachmentPosition = obj.AttachmentPosition; llprim.AttachmentRotation = obj.AttachmentRotation; llprim.BeforeAttachmentRotation = obj.BeforeAttachmentRotation; //obj.CameraAtOffset; //obj.CameraEyeOffset; prim.ClickAction = (ClickAction)obj.ClickAction; //obj.CollisionSound; //obj.CollisionSoundVolume; prim.Properties.CreationDate = obj.CreationDate; prim.Properties.CreatorID = obj.CreatorID; prim.Properties.Description = obj.Description; if (obj.DieAtEdge) { prim.Flags |= PrimFlags.DieAtEdge; } prim.Flexible = FromPrimObjectFlexible(obj.Flexible); prim.Properties.FolderID = obj.FolderID; prim.Properties.GroupID = obj.GroupID; prim.ID = obj.ID; llprim.Inventory = FromPrimObjectInventory(llprim, obj.Inventory); llprim.LastAttachmentPoint = (AttachmentPoint)obj.LastAttachmentPoint; prim.Properties.LastOwnerID = obj.LastOwnerID; prim.Light = FromPrimObjectLight(obj.Light); //obj.LinkNumber; prim.LocalID = obj.LocalID; prim.Properties.Name = obj.Name; prim.OwnerID = obj.OwnerID; //obj.ParentID; prim.ParticleSys = FromPrimObjectParticles(obj.Particles); prim.Properties.Permissions = new Permissions(obj.PermsBase, obj.PermsEveryone, obj.PermsGroup, obj.PermsNextOwner, obj.PermsOwner); if (obj.Phantom) { prim.Flags |= PrimFlags.Phantom; } prim.Position = obj.Position; prim.RegionHandle = Util.PositionToRegionHandle(scene.MinPosition); llprim.RemoteScriptAccessPIN = obj.RemoteScriptAccessPIN; if (obj.ReturnAtEdge) { prim.Flags |= PrimFlags.ReturnAtEdge; } //obj.RezDate; prim.Rotation = obj.Rotation; prim.Properties.SalePrice = obj.SalePrice; prim.Properties.SalePrice = obj.SaleType; if (obj.Sandbox) { prim.Flags |= PrimFlags.Sandbox; } prim.Scale = obj.Scale; //obj.ScriptState; prim.Sculpt = FromPrimObjectSculpt(obj.Sculpt); //obj.Selected; //obj.SelectorID; prim.PrimData = FromPrimObjectShape(obj.Shape, obj.PCode, obj.Material); prim.Properties.SitName = obj.SitName; llprim.SitPosition = obj.SitOffset; llprim.SitRotation = obj.SitRotation; prim.SoundFlags = (SoundFlags)obj.SoundFlags; prim.SoundGain = obj.SoundGain; prim.Sound = obj.SoundID; prim.SoundRadius = obj.SoundRadius; //obj.State; if (obj.Temporary) { prim.Flags |= PrimFlags.Temporary; } prim.Text = obj.Text; prim.TextColor = obj.TextColor; prim.Textures = obj.Textures; prim.Properties.TouchName = obj.TouchName; if (obj.UsePhysics) { prim.Flags |= PrimFlags.Physics; } prim.Velocity = obj.Velocity; //obj.VolumeDetect return(llprim); }
private void CreatePrim(WarpRenderer renderer, LLPrimitive prim, IPrimMesher primMesher) { const float MIN_SIZE = 2f; if (prim.Prim.PrimData.PCode != PCode.Prim) return; if (prim.Scale.LengthSquared() < MIN_SIZE * MIN_SIZE) return; RenderingMesh renderMesh; DetailLevel lod = DetailLevel.Medium; renderMesh = primMesher.GetRenderingMesh(prim, lod); if (renderMesh == null) return; warp_Vector primPos = ConvertVector(prim.ScenePosition); warp_Quaternion primRot = ConvertQuaternion(prim.RelativeRotation); warp_Matrix m = warp_Matrix.quaternionMatrix(primRot); if (prim.Parent != null) m.transform(warp_Matrix.quaternionMatrix(ConvertQuaternion(prim.Parent.RelativeRotation))); warp_Vector primScale = ConvertVector(prim.Scale); string primID = prim.ID.ToString(); // Create the prim faces for (int i = 0; i < renderMesh.Faces.Length; i++) { RenderingMesh.Face face = renderMesh.Faces[i]; string meshName = primID + "-Face-" + i.ToString(); warp_Object faceObj = new warp_Object(face.Vertices.Length, face.Indices.Length / 3); for (int j = 0; j < face.Vertices.Length; j++) { Vertex v = face.Vertices[j]; warp_Vector pos = ConvertVector(v.Position); warp_Vector norm = ConvertVector(v.Normal); if (prim.Prim.Sculpt == null || prim.Prim.Sculpt.SculptTexture == UUID.Zero) norm = norm.reverse(); warp_Vertex vert = new warp_Vertex(pos, norm, v.TexCoord.X, v.TexCoord.Y); faceObj.addVertex(vert); } for (int j = 0; j < face.Indices.Length; j += 3) { faceObj.addTriangle( face.Indices[j + 0], face.Indices[j + 1], face.Indices[j + 2]); } Primitive.TextureEntryFace teFace = prim.Prim.Textures.GetFace((uint)i); Color4 faceColor = GetFaceColor(teFace); string materialName = GetOrCreateMaterial(renderer, faceColor); faceObj.transform(m); faceObj.setPos(primPos); faceObj.scaleSelf(primScale.x, primScale.y, primScale.z); renderer.Scene.addObject(meshName, faceObj); renderer.SetObjectMaterial(meshName, materialName); } }
private void CreateAllPrims(IScene scene, WarpRenderer renderer, IPrimMesher primMesher) { if (primMesher == null) return; scene.ForEachEntity( delegate(ISceneEntity entity) { if (entity is LLPrimitive) CreatePrim(renderer, (LLPrimitive)entity, primMesher); } ); }
public Image Render(IScene scene, Viewport viewport) { IPrimMesher primMesher = scene.GetSceneModule <IPrimMesher>(); m_colors.Clear(); int width = viewport.Width; int height = viewport.Height; if (m_useAntiAliasing) { width *= 2; height *= 2; } WarpRenderer renderer = new WarpRenderer(); renderer.CreateScene(width, height); renderer.Scene.autoCalcNormals = false; #region Camera warp_Vector pos = ConvertVector(viewport.Position); pos.z -= 0.001f; // Works around an issue with the Warp3D camera warp_Vector lookat = warp_Vector.add(ConvertVector(viewport.Position), ConvertVector(viewport.LookDirection)); renderer.Scene.defaultCamera.setPos(pos); renderer.Scene.defaultCamera.lookAt(lookat); if (viewport.Orthographic) { renderer.Scene.defaultCamera.isOrthographic = true; renderer.Scene.defaultCamera.orthoViewWidth = viewport.OrthoWindowWidth; renderer.Scene.defaultCamera.orthoViewHeight = viewport.OrthoWindowHeight; } else { float fov = viewport.FieldOfView; fov *= 1.75f; // FIXME: ??? renderer.Scene.defaultCamera.setFov(fov); } #endregion Camera renderer.Scene.addLight("Light1", new warp_Light(new warp_Vector(0.2f, 0.2f, 1f), 0xffffff, 320, 80)); renderer.Scene.addLight("Light2", new warp_Light(new warp_Vector(-1f, -1f, 1f), 0xffffff, 100, 40)); ITerrain terrain = scene.GetSceneModule <ITerrain>(); RegionInfo regionInfo = scene.GetSceneModule <RegionInfo>(); CreateWater(scene, renderer, terrain); CreateTerrain(scene, renderer, terrain, regionInfo); if (primMesher != null) { CreateAllPrims(scene, renderer, primMesher); } renderer.Render(); Bitmap bitmap = renderer.Scene.getImage(); if (m_useAntiAliasing) { bitmap = Util.ResizeImage(bitmap, viewport.Width, viewport.Height); } return(bitmap); }
private void CreatePrim(WarpRenderer renderer, LLPrimitive prim, IPrimMesher primMesher) { const float MIN_SIZE = 2f; if (prim.Prim.PrimData.PCode != PCode.Prim) { return; } if (prim.Scale.LengthSquared() < MIN_SIZE * MIN_SIZE) { return; } RenderingMesh renderMesh; DetailLevel lod = DetailLevel.Medium; renderMesh = primMesher.GetRenderingMesh(prim, lod); if (renderMesh == null) { return; } warp_Vector primPos = ConvertVector(prim.ScenePosition); warp_Quaternion primRot = ConvertQuaternion(prim.RelativeRotation); warp_Matrix m = warp_Matrix.quaternionMatrix(primRot); if (prim.Parent != null) { m.transform(warp_Matrix.quaternionMatrix(ConvertQuaternion(prim.Parent.RelativeRotation))); } warp_Vector primScale = ConvertVector(prim.Scale); string primID = prim.ID.ToString(); // Create the prim faces for (int i = 0; i < renderMesh.Faces.Length; i++) { RenderingMesh.Face face = renderMesh.Faces[i]; string meshName = primID + "-Face-" + i.ToString(); warp_Object faceObj = new warp_Object(face.Vertices.Length, face.Indices.Length / 3); for (int j = 0; j < face.Vertices.Length; j++) { Vertex v = face.Vertices[j]; warp_Vector pos = ConvertVector(v.Position); warp_Vector norm = ConvertVector(v.Normal); if (prim.Prim.Sculpt == null || prim.Prim.Sculpt.SculptTexture == UUID.Zero) { norm = norm.reverse(); } warp_Vertex vert = new warp_Vertex(pos, norm, v.TexCoord.X, v.TexCoord.Y); faceObj.addVertex(vert); } for (int j = 0; j < face.Indices.Length; j += 3) { faceObj.addTriangle( face.Indices[j + 0], face.Indices[j + 1], face.Indices[j + 2]); } Primitive.TextureEntryFace teFace = prim.Prim.Textures.GetFace((uint)i); Color4 faceColor = GetFaceColor(teFace); string materialName = GetOrCreateMaterial(renderer, faceColor); faceObj.transform(m); faceObj.setPos(primPos); faceObj.scaleSelf(primScale.x, primScale.y, primScale.z); renderer.Scene.addObject(meshName, faceObj); renderer.SetObjectMaterial(meshName, materialName); } }
public static IList<LLPrimitive> DeserializeLinkset(OSDMap linksetMap, IScene destinationScene, IPrimMesher mesher, bool forceNewIDs) { Dictionary<uint, LLPrimitive> prims = new Dictionary<uint, LLPrimitive>(); Dictionary<uint, uint> oldToNewIDs = new Dictionary<uint, uint>(); // Deserialize all of the prims and assign new IDs foreach (KeyValuePair<string, OSD> kvp in linksetMap) { uint localID; if (UInt32.TryParse(kvp.Key, out localID) && kvp.Value is OSDMap) { OSDMap primMap = (OSDMap)kvp.Value; LLPrimitive prim; try { prim = LLPrimitive.FromOSD(primMap, destinationScene, mesher); if (forceNewIDs || prim.Prim.ID == UUID.Zero || prim.Prim.LocalID == 0) { prim.Prim.ID = UUID.Random(); prim.Prim.LocalID = destinationScene.CreateLocalID(); } // Clear any attachment point state data prim.Prim.PrimData.AttachmentPoint = AttachmentPoint.Default; prims[prim.LocalID] = prim; oldToNewIDs[localID] = prim.Prim.LocalID; } catch (Exception ex) { m_log.WarnFormat("Invalid prim data in serialized linkset: {0}: {1}", ex.Message, primMap); } } else { m_log.WarnFormat("Invalid key/value pair in serialized linkset: \"{0}\":\"{1}\"", kvp.Key, kvp.Value); } } // Link all of the prims together and update the ParentIDs foreach (LLPrimitive prim in prims.Values) { if (prim.Prim.ParentID != 0) { uint newLocalID; if (oldToNewIDs.TryGetValue(prim.Prim.ParentID, out newLocalID)) { prim.Prim.ParentID = newLocalID; LLPrimitive parent = prims[newLocalID]; prim.SetParent(parent, false, false); } else { m_log.WarnFormat("Failed to locate parent prim {0} for child prim {1}, delinking child", prim.Prim.ParentID, prim.LocalID); prim.Prim.ParentID = 0; } } } return new List<LLPrimitive>(prims.Values); }
public static LLPrimitive FromOSD(OSDMap map, IScene scene, IPrimMesher mesher) { if (map == null) return null; OSDMap primMap = map["prim"] as OSDMap; Primitive prim = new Primitive(); prim.Acceleration = primMap["acceleration"].AsVector3(); prim.AngularVelocity = primMap["ang_velocity"].AsVector3(); prim.ClickAction = (ClickAction)primMap["click_action"].AsInteger(); prim.Flags = (PrimFlags)primMap["flags"].AsUInteger(); prim.GroupID = primMap["group_id"].AsUUID(); prim.ID = primMap["id"].AsUUID(); prim.LocalID = primMap["local_id"].AsUInteger(); prim.MediaURL = primMap["media_url"].AsString(); prim.OwnerID = primMap["owner_id"].AsUUID(); prim.ParentID = primMap["parent_id"].AsUInteger(); prim.ParticleSys = Primitive.ParticleSystem.FromOSD(primMap["particles"]); prim.Position = primMap["position"].AsVector3(); prim.Rotation = primMap["rotation"].AsQuaternion(); prim.Scale = primMap["scale"].AsVector3(); prim.ScratchPad = primMap["scratch_pad"].AsBinary(); prim.Sound = primMap["sound"].AsUUID(); prim.SoundFlags = (SoundFlags)primMap["sound_flags"].AsInteger(); prim.SoundGain = (float)primMap["sound_gain"].AsReal(); prim.SoundRadius = (float)primMap["sound_radius"].AsReal(); prim.Text = primMap["text"].AsString(); prim.TextColor = primMap["text_color"].AsColor4(); prim.TextureAnim = Primitive.TextureAnimation.FromOSD(primMap["texture_anim"]); prim.TreeSpecies = (Tree)primMap["tree_species"].AsInteger(); prim.Velocity = primMap["velocity"].AsVector3(); prim.PrimData.Material = (Material)primMap["material"].AsInteger(); prim.PrimData.State = (byte)primMap["state"].AsInteger(); prim.PrimData.PCode = (PCode)primMap["pcode"].AsInteger(); if (prim.PrimData.PCode == PCode.None) prim.PrimData.PCode = PCode.Prim; if (primMap.ContainsKey("name_values")) { string nameValue = primMap["name_values"].AsString(); if (!String.IsNullOrEmpty(nameValue)) { string[] lines = nameValue.Split('\n'); prim.NameValues = new NameValue[lines.Length]; for (int i = 0; i < lines.Length; i++) { string line = lines[i]; if (!String.IsNullOrEmpty(line)) prim.NameValues[i] = new NameValue(line); } } } if (primMap.ContainsKey("textures")) prim.Textures = Primitive.TextureEntry.FromOSD(primMap["textures"]); if (primMap.ContainsKey("light")) prim.Light = Primitive.LightData.FromOSD(primMap["light"]); if (primMap.ContainsKey("flex")) prim.Flexible = Primitive.FlexibleData.FromOSD(primMap["flex"]); if (primMap.ContainsKey("sculpt")) prim.Sculpt = Primitive.SculptData.FromOSD(primMap["sculpt"]); OSDMap pathMap = (OSDMap)primMap["path"]; prim.PrimData.PathBegin = (float)pathMap["begin"].AsReal(); prim.PrimData.PathCurve = (PathCurve)pathMap["curve"].AsInteger(); prim.PrimData.PathEnd = (float)pathMap["end"].AsReal(); prim.PrimData.PathRadiusOffset = (float)pathMap["radius_offset"].AsReal(); prim.PrimData.PathRevolutions = (float)pathMap["revolutions"].AsReal(); prim.PrimData.PathScaleX = (float)pathMap["scale_x"].AsReal(); prim.PrimData.PathScaleY = (float)pathMap["scale_y"].AsReal(); prim.PrimData.PathShearX = (float)pathMap["shear_x"].AsReal(); prim.PrimData.PathShearY = (float)pathMap["shear_y"].AsReal(); prim.PrimData.PathSkew = (float)pathMap["skew"].AsReal(); prim.PrimData.PathTaperX = (float)pathMap["taper_x"].AsReal(); prim.PrimData.PathTaperY = (float)pathMap["taper_y"].AsReal(); prim.PrimData.PathTwist = (float)pathMap["twist"].AsReal(); prim.PrimData.PathTwistBegin = (float)pathMap["twist_begin"].AsReal(); OSDMap profileMap = (OSDMap)primMap["profile"]; prim.PrimData.ProfileBegin = (float)profileMap["begin"].AsReal(); prim.PrimData.ProfileCurve = (ProfileCurve)profileMap["curve"].AsInteger(); prim.PrimData.ProfileHole = (HoleType)profileMap["hole"].AsInteger(); prim.PrimData.ProfileEnd = (float)profileMap["end"].AsReal(); prim.PrimData.ProfileHollow = (float)profileMap["hollow"].AsReal(); OSDMap propertiesMap = (OSDMap)primMap["properties"]; prim.Properties = new Primitive.ObjectProperties(); prim.Properties.AggregatePerms = (byte)propertiesMap["aggregate_perms"].AsInteger(); prim.Properties.AggregatePermTextures = (byte)propertiesMap["aggregate_perms_textures"].AsInteger(); prim.Properties.AggregatePermTexturesOwner = (byte)propertiesMap["aggregate_perms_textures_owner"].AsInteger(); prim.Properties.Category = (ObjectCategory)propertiesMap["category"].AsInteger(); prim.Properties.CreationDate = propertiesMap["creation_date"].AsDate(); prim.Properties.CreatorID = propertiesMap["creator_id"].AsUUID(); prim.Properties.Description = propertiesMap["description"].AsString(); prim.Properties.FolderID = propertiesMap["folder_id"].AsUUID(); prim.Properties.FromTaskID = propertiesMap["from_task_id"].AsUUID(); prim.Properties.GroupID = prim.GroupID; prim.Properties.InventorySerial = (short)propertiesMap["inventory_serial"].AsInteger(); prim.Properties.ItemID = propertiesMap["item_id"].AsUUID(); prim.Properties.LastOwnerID = propertiesMap["last_owner_id"].AsUUID(); prim.Properties.Name = propertiesMap["name"].AsString(); prim.Properties.ObjectID = prim.ID; prim.Properties.OwnerID = prim.OwnerID; prim.Properties.OwnershipCost = propertiesMap["ownership_cost"].AsInteger(); prim.Properties.Permissions = Permissions.FromOSD(propertiesMap["permissions"]); prim.Properties.SalePrice = propertiesMap["sale_price"].AsInteger(); prim.Properties.SaleType = (SaleType)propertiesMap["sale_type"].AsInteger(); prim.Properties.SitName = propertiesMap["sit_name"].AsString(); prim.Properties.TouchName = propertiesMap["touch_name"].AsString(); LLPrimitive obj = new LLPrimitive(prim, scene, mesher); obj.SitPosition = map["sit_position"].AsVector3(); obj.SitRotation = map["sit_rotations"].AsQuaternion(); obj.AttachmentPosition = map["attachment_position"].AsVector3(); obj.AttachmentRotation = map["attachment_rotations"].AsQuaternion(); obj.LastAttachmentPoint = (AttachmentPoint)map["last_attachment_point"].AsInteger(); obj.BeforeAttachmentRotation = map["before_attachment_rotation"].AsQuaternion(); obj.RotationAxis = map["rotation_axis"].AsVector3(); obj.LinkNumber = map["link_number"].AsInteger(); obj.RemoteScriptAccessPIN = map["remote_script_access_pin"].AsInteger(); obj.Inventory.FromTaskInventoryAsset(map["inventory"].AsString()); OSDArray buttons = map["pay_price_buttons"] as OSDArray; if (buttons != null) { obj.PayPriceButtons[0] = buttons[0].AsInteger(); obj.PayPriceButtons[1] = buttons[1].AsInteger(); obj.PayPriceButtons[2] = buttons[2].AsInteger(); obj.PayPriceButtons[3] = buttons[3].AsInteger(); } obj.PayPrice = map["pay_price"].AsInteger(); OSDArray faceMedia = map["face_media"] as OSDArray; if (faceMedia != null) { obj.Prim.FaceMedia = new MediaEntry[faceMedia.Count]; for (int i = 0; i < faceMedia.Count; i++) { OSDMap entryMap = faceMedia[i] as OSDMap; if (entryMap != null) obj.Prim.FaceMedia[i] = MediaEntry.FromOSD(entryMap); } } obj.Prim.MediaVersion = map["media_version"].AsString(); obj.m_lastUpdated = map["last_updated"].AsDate(); if (obj.m_lastUpdated <= Utils.Epoch) obj.m_lastUpdated = DateTime.UtcNow; return obj; }
public void Start(IScene scene) { m_scene = scene; m_scheduler = m_scene.Simian.GetAppModule<IScheduler>(); if (m_scheduler == null) { m_log.Error("Inventory requires an IScheduler"); return; } m_inventoryClient = m_scene.Simian.GetAppModule<IInventoryClient>(); if (m_inventoryClient == null) { m_log.Error("Inventory requires an IInventoryClient"); return; } m_assetClient = m_scene.Simian.GetAppModule<IAssetClient>(); if (m_assetClient == null) { m_log.Error("Inventory requires an IAssetClient"); return; } m_primMesher = m_scene.GetSceneModule<IPrimMesher>(); if (m_primMesher == null) { m_log.Error("Inventory requires an IPrimMesher"); return; } m_physics = m_scene.GetSceneModule<IPhysicsEngine>(); m_permissions = m_scene.GetSceneModule<LLPermissions>(); m_udp = m_scene.GetSceneModule<LLUDP>(); if (m_udp != null) { m_udp.AddPacketHandler(PacketType.CreateInventoryItem, CreateInventoryItemHandler); m_udp.AddPacketHandler(PacketType.CreateInventoryFolder, CreateInventoryFolderHandler); m_udp.AddPacketHandler(PacketType.UpdateInventoryItem, UpdateInventoryItemHandler); m_udp.AddPacketHandler(PacketType.UpdateInventoryFolder, UpdateInventoryFolderHandler); m_udp.AddPacketHandler(PacketType.FetchInventoryDescendents, FetchInventoryDescendentsHandler); m_udp.AddPacketHandler(PacketType.FetchInventory, FetchInventoryHandler); m_udp.AddPacketHandler(PacketType.CopyInventoryItem, CopyInventoryItemHandler); m_udp.AddPacketHandler(PacketType.MoveInventoryItem, MoveInventoryItemHandler); m_udp.AddPacketHandler(PacketType.MoveInventoryFolder, MoveInventoryFolderHandler); m_udp.AddPacketHandler(PacketType.RemoveInventoryItem, RemoveInventoryItemHandler); m_udp.AddPacketHandler(PacketType.RemoveInventoryFolder, RemoveInventoryFolderHandler); m_udp.AddPacketHandler(PacketType.PurgeInventoryDescendents, PurgeInventoryDescendentsHandler); m_udp.AddPacketHandler(PacketType.DeRezObject, DeRezObjectHandler); m_udp.AddPacketHandler(PacketType.RezObject, RezObjectHandler); m_udp.AddPacketHandler(PacketType.LinkInventoryItem, LinkInventoryItemHandler); } }
public void Start(IScene scene) { m_scene = scene; m_primMesher = m_scene.GetSceneModule<IPrimMesher>(); if (m_primMesher == null) { m_log.Error("Objects requires an IPrimMesher"); return; } m_permissions = m_scene.GetSceneModule<LLPermissions>(); if (m_permissions == null) { m_log.Error("Objects requires LLPermissions"); return; } // Optional modules m_physics = m_scene.GetSceneModule<IPhysicsEngine>(); m_lslScriptEngine = m_scene.GetSceneModule<ILSLScriptEngine>(); m_inventory = m_scene.GetSceneModule<Inventory>(); // Collision handler if (m_physics != null && m_lslScriptEngine != null) { m_physics.OnEntityCollision += EntityCollisionHandler; } m_udp = m_scene.GetSceneModule<LLUDP>(); if (m_udp != null) { m_udp.AddPacketHandler(PacketType.ObjectAdd, ObjectAddHandler); m_udp.AddPacketHandler(PacketType.ObjectAttach, ObjectAttachHandler); m_udp.AddPacketHandler(PacketType.ObjectDrop, ObjectDropHandler); m_udp.AddPacketHandler(PacketType.ObjectDuplicate, ObjectDuplicateHandler); m_udp.AddPacketHandler(PacketType.ObjectName, ObjectNameHandler); m_udp.AddPacketHandler(PacketType.ObjectSelect, ObjectSelectHandler); m_udp.AddPacketHandler(PacketType.ObjectDeselect, ObjectDeselectHandler); m_udp.AddPacketHandler(PacketType.ObjectGrab, ObjectGrabHandler); m_udp.AddPacketHandler(PacketType.ObjectGrabUpdate, ObjectGrabUpdateHandler); m_udp.AddPacketHandler(PacketType.ObjectDeGrab, ObjectDeGrabHandler); m_udp.AddPacketHandler(PacketType.ObjectLink, ObjectLinkHandler); m_udp.AddPacketHandler(PacketType.ObjectDelink, ObjectDelinkHandler); m_udp.AddPacketHandler(PacketType.ObjectShape, ObjectShapeHandler); m_udp.AddPacketHandler(PacketType.ObjectFlagUpdate, ObjectFlagUpdateHandler); m_udp.AddPacketHandler(PacketType.ObjectExtraParams, ObjectExtraParamsHandler); m_udp.AddPacketHandler(PacketType.ObjectImage, ObjectImageHandler); m_udp.AddPacketHandler(PacketType.ObjectPermissions, ObjectPermissionsHandler); m_udp.AddPacketHandler(PacketType.Undo, UndoHandler); m_udp.AddPacketHandler(PacketType.Redo, RedoHandler); m_udp.AddPacketHandler(PacketType.MultipleObjectUpdate, MultipleObjectUpdateHandler); m_udp.AddPacketHandler(PacketType.RequestObjectPropertiesFamily, RequestObjectPropertiesFamilyHandler); m_scene.AddInterestListHandler(OBJECT_UPDATE, new InterestListEventHandler { CombineCallback = ObjectUpdateCombiner, SendCallback = SendEntityPackets }); m_scene.AddInterestListHandler(OBJECT_REMOVE, new InterestListEventHandler { CombineCallback = ObjectUpdateCombiner, SendCallback = SendKillPacket }); m_scene.OnEntityAddOrUpdate += EntityAddOrUpdateHandler; m_scene.OnEntityRemove += EntityRemoveHandler; m_scene.OnPresenceAdd += PresenceAddHandler; } m_proxyPrim = new Primitive(); m_proxyPrim.PrimData = ObjectManager.BuildBasicShape(PrimType.Box); }