private void HandleUpdateUserInfo(ViewerAgent agent, SceneInterface scene, Message m) { var req = (UpdateUserInfo)m; if (req.AgentID != req.CircuitAgentID || req.SessionID != req.CircuitSessionID) { return; } if (agent.ProfileService == null) { return; } var prefs = new ProfilePreferences { User = agent.Owner, IMviaEmail = req.IMViaEmail, Visible = req.DirectoryVisibility != "hidden" }; try { agent.ProfileService.Preferences[agent.Owner] = prefs; } catch { agent.SendAlertMessage("Error updating preferences", scene.ID); } }
// Actor Functions //------------------------------------------------------------------------- void AttachToActiveScene() { if (!SceneInterface.Self().hvrSceneInterface.ContainsActor(actorInterface)) { SceneInterface.Self().hvrSceneInterface.AttachActor(actorInterface); } }
private void PostCollisionEvent(CollisionEvent ev) { SceneInterface scene = RootAgentScene; if (scene != null) { foreach (DetectInfo di in ev.Detected) { if (di.CausingDamage > 0) { ParcelInfo pInfo; if (scene.Parcels.TryGetValue(GlobalPosition, out pInfo) && (pInfo.Flags & ParcelFlags.AllowDamage) != 0) { DecreaseHealth(di.CausingDamage); } } } } /* relay collision events to attachments */ foreach (ObjectGroup attached in Attachments.All) { ObjectPart part; if (attached.TryGetRootPart(out part)) { part.PostEvent(ev); } } }
private void HandlePickInfoUpdate(ViewerAgent agent, SceneInterface scene, Message m) { var req = (PickInfoUpdate)m; if (req.AgentID != req.CircuitAgentID || req.SessionID != req.CircuitSessionID) { return; } if (agent.ProfileService == null) { return; } try { var pick = agent.ProfileService.Picks[agent.Owner, req.PickID]; pick.TopPick = req.TopPick; pick.ParcelID = req.ParcelID; pick.Name = req.Name; pick.Description = req.Description; pick.SnapshotID = req.SnapshotID; pick.GlobalPosition = req.PosGlobal; pick.SortOrder = req.SortOrder; pick.Enabled = req.IsEnabled; agent.ProfileService.Picks.Update(pick); } catch { agent.SendAlertMessage("Error updating pick", scene.ID); } }
void DetachFromActiveScene() { if (SceneInterface.Self().hvrSceneInterface.ContainsActor(actorInterface)) { SceneInterface.Self().hvrSceneInterface.DetachActor(actorInterface); } }
public TerrainController(SceneInterface scene) { uint x; uint y; uint xPatches = scene.SizeX / LayerCompressor.LAYER_PATCH_NUM_XY_ENTRIES; uint yPatches = scene.SizeY / LayerCompressor.LAYER_PATCH_NUM_XY_ENTRIES; LowerLimit = (float)scene.RegionSettings.TerrainLowerLimit; RaiseLimit = (float)scene.RegionSettings.TerrainRaiseLimit; m_Scene = scene; m_TerrainPatches = new LayerPatch[yPatches, xPatches]; for (y = 0; y < yPatches; ++y) { for (x = 0; x < xPatches; ++x) { m_TerrainPatches[y, x] = new LayerPatch(22) { X = x, Y = y }; } } Patch = new PatchesAccessor(m_TerrainPatches, xPatches, yPatches); }
public override void OnInitializeSceneInterface(SceneInterface sceneInterface) { #if DEBUG SynapseGaming.SunBurn.Engine.Editor.SunBurnEditor editor = new SynapseGaming.SunBurn.Engine.Editor.SunBurnEditor(sceneInterface, true); sceneInterface.AddManager(editor); #endif }
public void HandleParcelVoiceInfoRequest(ViewerAgent agent, AgentCircuit circuit, HttpRequest req) { if (req.CallerIP != circuit.RemoteIP) { req.ErrorResponse(HttpStatusCode.Forbidden, "Forbidden"); return; } if (req.Method != "POST") { req.ErrorResponse(HttpStatusCode.MethodNotAllowed, "Method not allowed"); return; } SceneInterface scene = circuit.Scene; ParcelInfo pInfo; IValue res; if (!scene.Parcels.TryGetValue(agent.GlobalPosition, out pInfo)) { res = new Undef(); } else if (scene.EstateAllowsVoice && ((pInfo.Flags & ParcelFlags.AllowVoiceChat) != 0 || scene.HasGroupPower(agent.Owner, pInfo.Group, GroupPowers.AllowVoiceChat))) { VoiceChannelInfo channelInfo; try { if ((pInfo.Flags & ParcelFlags.UseEstateVoiceChan) != 0) { channelInfo = m_VoiceService.GetEstateChannel(scene.EstateService[scene.EstateService.RegionMap[scene.ID]]); } else { channelInfo = m_VoiceService.GetParcelChannel(scene, pInfo); } res = new Map { { "channel_uri", channelInfo.ChannelSipUri } }; } catch { res = new Map { { "channel_uri", string.Empty } }; } } else { res = new Map { { "channel_uri", string.Empty } }; } using (HttpResponse resp = req.BeginResponse("application/llsd+xml")) using (Stream s = resp.GetOutputStream()) { LlsdXml.Serialize(res, s); } }
private void ProcessDirFindQuery(ViewerAgent agent, AgentCircuit circuit, Message m) { var req = (DirFindQuery)m; SceneInterface scene = circuit.Scene; if (scene == null) { return; } if (req.CircuitSessionID != req.SessionID || req.CircuitAgentID != req.AgentID) { return; } if ((req.QueryFlags & SearchFlags.People) != 0) { ProcessDirFindQuery_People(agent, scene, req); } if ((req.QueryFlags & SearchFlags.Groups) != 0) { ProcessDirFindQuery_Groups(agent, scene, req); } if ((req.QueryFlags & SearchFlags.Events) != 0) { ProcessDirFindQuery_Events(agent, scene, req); } }
public void HandleViewerEffect(Message m) { var ve = (ViewerEffect)m; if (ve.AgentID != ve.CircuitAgentID || ve.SessionID != ve.CircuitSessionID) { return; } /* we only route valid messages here but keep SessionID from being broadcasted */ ve.SessionID = UUID.Zero; SceneInterface scene = Scene; ViewerAgent thisAgent = Agent; if (thisAgent == null || scene == null) { return; } UGUIWithName agentOwner = thisAgent.NamedOwner; foreach (var agent in scene.Agents) { if (agent.Owner.Equals(agentOwner)) { continue; } agent.SendMessageAlways(m, scene.ID); } }
public void RenderCamera(HvrRender hvrRender, HVRViewportInterface viewport, bool resizedViewport = false) { // If the Unity viewport has been resized and an OpenGL renderer // is in use then Unity will have recreated the main OpenGL // context so all framebuffer and vertex attribute objects that // are not shareable need to be destroyed and recreated. // // The extra call to `PlayerInterface.PreRender()` in this case is // to make sure that the vertex buffers are populated for the // render call below to avoid flickering. if (resizedViewport) { StaticInterface.Self().ResetFrameBuffersAndMeshes(); PlayerInterface.PreRender(SceneInterface.Self().hvrSceneInterface); PlayerInterface.PreRender(SceneInterface.Self().hvrSceneInterface); } Update(); LateUpdate(); if (!SceneInterface.Self().sceneHasPreRendered) { PlayerInterface.PreRender(SceneInterface.Self().hvrSceneInterface); SceneInterface.Self().sceneHasPreRendered = true; } PlayerInterface.Render(SceneInterface.Self().hvrSceneInterface, viewport); }
public void HandleParcelReclaim(AgentCircuit circuit, SceneInterface scene, Message m) { var req = (ParcelReclaim)m; if (req.AgentID != req.CircuitAgentID || req.SessionID != req.CircuitSessionID) { return; } IAgent agent = circuit.Agent; ParcelInfo pInfo; if (scene.Parcels.TryGetValue(req.LocalID, out pInfo) && scene.CanReclaimParcel(agent.Owner, pInfo)) { pInfo.Group = UGI.Unknown; pInfo.GroupOwned = false; pInfo.ClaimDate = Date.Now; pInfo.SalePrice = 0; pInfo.AuthBuyer = UGUI.Unknown; pInfo.Owner = scene.Owner; pInfo.Flags &= ~(ParcelFlags.ForSale | ParcelFlags.ForSaleObjects | ParcelFlags.SellParcelObjects | ParcelFlags.ShowDirectory); scene.TriggerParcelUpdate(pInfo); } }
public void SendAnimations() { ObjectGroup grp = m_Part.ObjectGroup; if (grp == null) { return; } SceneInterface scene = grp.Scene; if (scene == null) { return; } if ((m_Part.ExtendedMesh.Flags & ExtendedMeshParams.MeshFlags.AnimatedMeshEnabled) == 0) { return; } ObjectAnimation m = GetMessage(); foreach (IAgent agent in scene.Agents) { agent.SendMessageAlways(m, scene.ID); } m_Part.TriggerOnUpdate(UpdateChangedFlags.None); }
private void HandleClassifiedInfoUpdate(ViewerAgent agent, SceneInterface scene, Message m) { var req = (ClassifiedInfoUpdate)m; if (req.AgentID != req.CircuitAgentID || req.SessionID != req.CircuitSessionID) { return; } if (agent.ProfileService == null) { return; } try { var classified = agent.ProfileService.Classifieds[agent.Owner, req.ClassifiedID]; classified.ClassifiedID = req.ClassifiedID; classified.Category = req.Category; classified.Name = req.Name; classified.Description = req.Description; classified.ParcelID = req.ParcelID; classified.ParentEstate = req.ParentEstate; classified.SnapshotID = req.SnapshotID; classified.GlobalPos = req.PosGlobal; classified.Flags = req.ClassifiedFlags; classified.Price = req.PriceForListing; agent.ProfileService.Classifieds.Update(classified); } catch { agent.SendAlertMessage("Error updating classified", scene.ID); } }
private static byte[] WriteArchiveXml08(SceneInterface scene, bool assetsIncluded) { using (var ms = new MemoryStream()) { using (XmlTextWriter writer = ms.UTF8XmlTextWriter()) { writer.WriteStartElement("archive"); writer.WriteAttributeString("major_version", "0"); writer.WriteAttributeString("minor_version", "8"); { writer.WriteStartElement("creation_info"); { writer.WriteNamedValue("datetime", Date.GetUnixTime().ToString()); writer.WriteNamedValue("id", scene.ID); } writer.WriteEndElement(); writer.WriteNamedValue("assets_included", assetsIncluded); writer.WriteStartElement("region_info"); { writer.WriteNamedValue("is_megaregion", false); writer.WriteNamedValue("size_in_meters", string.Format("{0},{1}", scene.SizeX, scene.SizeY)); } writer.WriteEndElement(); } writer.WriteEndElement(); writer.Flush(); return(ms.ToArray()); } } }
private bool TeleportToLocal(SceneInterface sceneInterface, Vector3 position, Vector3 lookAt, TeleportFlags flags) { #if DEBUG m_Log.DebugFormat("Local Teleport Service for {0}", NamedOwner.FullName); #endif ParcelInfo oldParcel; ParcelInfo newParcel; sceneInterface.Parcels.TryGetValue(GlobalPosition, out oldParcel); sceneInterface.Parcels.TryGetValue(position, out newParcel); if (SittingOnObject != null) { UnSit(); } bool sameParcelOverride = oldParcel != null && newParcel != null && oldParcel.ID == newParcel.ID; sceneInterface.DetermineInitialAgentLocation(this, flags, position, lookAt, sameParcelOverride); SendMessageAlways(new TeleportStart(), sceneInterface.ID); SendMessageAlways(new TeleportLocal { AgentID = ID, Position = GlobalPosition, LookAt = LookAt, TeleportFlags = flags, LocationID = 2 }, sceneInterface.ID); return(true); }
public LandResources(ViewerAgent agent, SceneInterface scene, string serverURI, string remoteip) { m_Agent = agent; m_Scene = scene; m_RemoteIP = remoteip; m_ServerURI = serverURI; }
private void RezActualScript(AgentCircuit circuit, ObjectPart part, RezScript req, AssetData data) { if (!part.CheckPermissions(Owner, Group, InventoryPermissionsMask.Modify)) { var res = new AlertMessage { Message = "ALERT: NoPermModifyObject" }; circuit.SendMessage(res); return; } var item = new ObjectPartInventoryItem { Name = req.InventoryBlock.Name, AssetID = data.ID, Description = req.InventoryBlock.Description, AssetType = AssetType.LSLText, Creator = Owner, Owner = Owner, Flags = 0, Group = Group, IsGroupOwned = false, InventoryType = InventoryType.LSL, LastOwner = Owner, ParentFolderID = part.ID }; item.Permissions.Base = req.InventoryBlock.BaseMask; item.Permissions.Current = req.InventoryBlock.OwnerMask; item.Permissions.EveryOne = req.InventoryBlock.EveryoneMask; item.Permissions.Group = req.InventoryBlock.GroupMask; item.Permissions.NextOwner = req.InventoryBlock.NextOwnerMask; item.SaleInfo.Price = req.InventoryBlock.SalePrice; item.SaleInfo.Type = req.InventoryBlock.SaleType; part.Inventory.Add(item); part.SendObjectUpdate(); ScriptInstance instance; try { SceneInterface scene = part.ObjectGroup.Scene; instance = ScriptLoader.Load(part, item, item.Owner, data, CurrentCulture, openInclude: part.OpenScriptInclude); item.ScriptInstance = instance; item.ScriptInstance.IsRunningAllowed = scene.CanRunScript(item.Owner, part.ObjectGroup.GlobalPosition, item.AssetID); item.ScriptInstance.IsRunning = true; item.ScriptInstance.Reset(); part.ObjectGroup.Scene.SendObjectPropertiesToAgent(this, part); } catch { var res = new AlertMessage { Message = this.GetLanguageString(circuit.Agent.CurrentCulture, "CouldNotCompileScript", "Could not compile script") }; circuit.SendMessage(res); return; } }
private static void AddObjects( SceneInterface scene, List <ObjectGroup> sogs, LoadOptions options) { foreach (ObjectGroup sog in sogs) { sog.LastOwner = scene.AvatarNameService.ResolveName(sog.LastOwner); sog.Owner = scene.AvatarNameService.ResolveName(sog.Owner); foreach (ObjectPart part in sog.ValuesByKey1) { part.Creator = scene.AvatarNameService.ResolveName(part.Creator); foreach (ObjectPartInventoryItem item in part.Inventory.ValuesByKey1) { item.Owner = scene.AvatarNameService.ResolveName(item.Owner); item.Creator = scene.AvatarNameService.ResolveName(item.Creator); item.LastOwner = scene.AvatarNameService.ResolveName(item.LastOwner); } } scene.Add(sog); } foreach (ObjectGroup grp in sogs) { scene.RezScriptsForObject(grp); } sogs.Clear(); }
/// <summary> /// Constructs a new screen manager component. /// </summary> public ScreenManager(Game game) : base(game) { // we must set EnabledGestures before we can query for them, but // we don't assume the game wants to read them. TouchPanel.EnabledGestures = GestureType.None; // Create the lighting system. sunBurnCoreSystem = new SunBurnCoreSystem(game.Services, game.Content); sceneState = new SceneState(); // Create the scene interface. Acts as a service provider containing all scene managers // and returning them by type (including custom managers). Also acts as a component // container where calls to manager methods on the SceneInterface (such as BeginFrameRendering, // Unload, ...) are automatically called on all contained managers. // // This design allows managers to be plugged-in like modular components and for managers // to easily be added, removed, or replaced with custom implementations. // sceneInterface = new SceneInterface(); sceneInterface.CreateDefaultManagers(RenderingSystemType.Forward, CollisionSystemType.Physics, true); // Create the frame buffers used for rendering (sized to the backbuffer) and // assign them to the ResourceManager so we don't have to worry about cleanup. frameBuffers = new FrameBuffers(DetailPreference.High, DetailPreference.Medium); sceneInterface.ResourceManager.AssignOwnership(frameBuffers); }
public override bool IsInScene(SceneInterface scene) { lock (m_DataLock) { return(SceneID == scene.ID); } }
public Scene() { SceneInterface = null; _objs = new List <SceneEntity>(); _space = new Space(); _space.ForceUpdater.Gravity = MathConverter.Convert(new Vector3(0, -9.81f, 0)); }
public void HandleParcelGodForceOwner(AgentCircuit circuit, SceneInterface scene, Message m) { var req = (ParcelGodForceOwner)m; UGUIWithName agentID; ParcelInfo pInfo; IAgent godAgent = circuit.Agent; if (req.CircuitSessionID != req.SessionID || req.CircuitAgentID != req.AgentID || req.OwnerID != req.AgentID || !scene.Agents.TryGetValue(req.AgentID, out godAgent) || !scene.AvatarNameService.TryGetValue(req.OwnerID, out agentID) || !scene.Parcels.TryGetValue(req.LocalID, out pInfo) || !godAgent.IsActiveGod || !godAgent.IsInScene(scene)) { return; } m_Log.InfoFormat("Forced parcel {0} ({1}) to be owned by {2}", pInfo.Name, pInfo.ID, agentID.FullName); pInfo.Group = UGI.Unknown; pInfo.GroupOwned = false; pInfo.ClaimDate = Date.Now; pInfo.SalePrice = 0; pInfo.AuthBuyer = UGUI.Unknown; pInfo.Owner = agentID; pInfo.Flags &= ~(ParcelFlags.ForSale | ParcelFlags.ForSaleObjects | ParcelFlags.SellParcelObjects | ParcelFlags.ShowDirectory); scene.TriggerParcelUpdate(pInfo); }
private static void LoadRegionSettings(XmlTextReader reader, SceneInterface scene) { for (;;) { if (!reader.Read()) { throw new OARFormatException(); } switch (reader.NodeType) { case XmlNodeType.Element: if (reader.Name == "RegionSettings") { if (reader.IsEmptyElement) { throw new OARFormatException(); } LoadRegionSettingsInner(reader, scene); return; } else { throw new OARFormatException(); } default: break; } } }
private static void LoadRegionSettingsInner(XmlTextReader reader, SceneInterface scene) { /* reset telehub on load */ scene.RegionSettings.TelehubObject = UUID.Zero; scene.SpawnPoints.Clear(); for (;;) { if (!reader.Read()) { throw new OARFormatException(); } switch (reader.NodeType) { case XmlNodeType.Element: switch (reader.Name) { case "General": LoadRegionSettingsGeneral(reader, scene); break; case "GroundTextures": LoadRegionSettingsGroundTextures(reader, scene); break; case "Terrain": LoadRegionSettingsTerrain(reader, scene); break; case "Telehub": LoadRegionSettingsTelehub(reader, scene); break; case "WalkableCoefficients": scene.RegionSettings.WalkableCoefficientsSerialization = Convert.FromBase64String(reader.ReadElementValueAsString()); break; default: if (!reader.IsEmptyElement) { reader.Skip(); } break; } break; case XmlNodeType.EndElement: if (reader.Name != "RegionSettings") { throw new OARFormatException(); } return; default: break; } } }
private void HandleClassifiedInfoRequest(ViewerAgent agent, SceneInterface scene, Message m) { var req = (ClassifiedInfoRequest)m; if (req.AgentID != req.CircuitAgentID || req.SessionID != req.CircuitSessionID) { return; } KeyValuePair <UGUI, int> kvp; if (!m_ClassifiedQueryCache.TryGetValue(req.ClassifiedID, out kvp)) { return; } ProfileServiceData serviceData; UGUI uui; try { serviceData = LookupProfileService(scene, kvp.Key.ID, out uui); } catch { return; } try { ProfileClassified cls = serviceData.ProfileService.Classifieds[kvp.Key, req.ClassifiedID]; var reply = new ClassifiedInfoReply { AgentID = req.AgentID, ClassifiedID = cls.ClassifiedID, CreatorID = cls.Creator.ID, CreationDate = cls.CreationDate, ExpirationDate = cls.ExpirationDate, Category = cls.Category, Name = cls.Name, Description = cls.Description, ParcelID = cls.ParcelID, ParentEstate = cls.ParentEstate, SnapshotID = cls.SnapshotID, SimName = cls.SimName, PosGlobal = cls.GlobalPos, ParcelName = cls.ParcelName, ClassifiedFlags = cls.Flags, PriceForListing = cls.Price }; agent.SendMessageAlways(reply, scene.ID); } catch { /* do not expose exceptions to caller */ } }
public RestartObject(SceneList scenes, SceneInterface scene, SceneImplementationFactory sceneFactory, GridServiceInterface regionStorage) { m_Scenes = scenes; m_WeakScene = new WeakReference(scene); m_SceneFactory = sceneFactory; m_RegionStorage = regionStorage; RestartTimer.Elapsed += RestartTimerHandler; }
private void _view_CellValueChanged(object sender, DataGridViewCellEventArgs e) { InspectorField fieldChanged = _cellToComponentMap[e.RowIndex]; SceneInterface.ModifyGameObjectComponentField(_sceneManager, fieldChanged.GameObjectID, (int)fieldChanged.ComponentIndex, (int)fieldChanged.FieldIndex, _view[e.ColumnIndex, e.RowIndex].Value.ToString()); _scene.HasChanged = true; }
public void Load(ContentManager content, SpriteManager manager, SceneInterface scene) { geoTexture = content.Load<BaseRenderableEffect>("Materials/Dude"); // First create and submit the empty player container. geoSprites = manager.CreateSpriteContainer(); scene.ObjectManager.Submit(geoSprites); }
public static void LoadRegionSettings(Stream s, SceneInterface scene) { using (XmlTextReader reader = s.CreateXmlReader()) { LoadRegionSettings(reader, scene); scene.TriggerRegionSettingsChanged(); } }
protected RezRestoreObjectHandler(SceneInterface scene, UUID assetid, AssetServiceInterface source, UGUI rezzingagent, UGI rezzinggroup, InventoryItem sourceItem) : base(scene.AssetService, source, assetid, ReferenceSource.Destination) { m_Scene = scene; m_RezzingAgent = rezzingagent; m_RezzingGroup = rezzinggroup; m_SourceItem = sourceItem; }
private static void LoadRegionSettingsTelehub(XmlTextReader reader, SceneInterface scene) { if (reader.IsEmptyElement) { return; } for (;;) { if (!reader.Read()) { throw new OARFormatException(); } switch (reader.NodeType) { case XmlNodeType.Element: switch (reader.Name) { case "TelehubObject": scene.RegionSettings.TelehubObject = UUID.Parse(reader.ReadElementValueAsString()); break; case "SpawnPoint": string spawnpointstr = reader.ReadElementValueAsString(); string[] sp_parts = spawnpointstr.Split(','); double yaw = double.Parse(sp_parts[0], NumberStyles.Float, CultureInfo.InvariantCulture); double pitch = float.Parse(sp_parts[1], NumberStyles.Float, CultureInfo.InvariantCulture); double distance = float.Parse(sp_parts[2], NumberStyles.Float, CultureInfo.InvariantCulture); Quaternion y = Quaternion.CreateFromEulers(0, 0, yaw); Quaternion p = Quaternion.CreateFromEulers(0, pitch, 0); Vector3 dir = new Vector3(distance, 0, 0) * p * y; scene.SpawnPoints.Add(dir); break; default: if (!reader.IsEmptyElement) { reader.Skip(); } break; } break; case XmlNodeType.EndElement: if (reader.Name != "Telehub") { throw new OARFormatException(); } return; default: break; } } }
public Billboard(SceneInterface sceneinterface, BillboardResource resource, Effect effect, Vector3 position, Vector3 scale) { this._Position = position; this._Scale = scale; this._SceneObject = new SceneObject(effect, resource.BoundingSphere, Matrix.Identity, resource.IndexBuffer, resource.VertexBuffer, resource.VertexDeclaration, resource.IndexStart, resource.PrimitiveType, resource.PrimitiveCount, resource.VertexBase, resource.VertexRange, resource.VertexStreamOffset, resource.SizeInBytes) { ObjectType = ObjectType.Dynamic, Visibility = ObjectVisibility.RenderedAndCastShadows, World = Matrix.CreateScale(this._Scale) * Matrix.CreateTranslation(this._Position) }; sceneinterface.ObjectManager.Submit(this._SceneObject); }
public void FinishInit(ContentManager Content, GraphicsDevice device, SceneInterface sceneInterface) { BoundingSphere bounds = new BoundingSphere(Vector3.Zero, 1000.0f); // Build the instance source data. We can reuse this single source, since all voxels are the exact same, just with different effects. IInstanceSourceData source; source = new BoxInstanceSourceData(); foreach (List<Container> container_list in Containers.Values) { foreach (Container container in container_list) { LightingEffect effect = Content.Load<LightingEffect>(container.type); effect.Skinned = true; InstanceContainer Icontainer = new InstanceContainer(device, effect); for (int i = 0; i < VOXELS_PER_CONTAINER; i++) { Icontainer.AddInstance(source, i); } Icontainer.Build(); // Create a SceneObject to contain the custom geometry data. container.sceneObject = new SceneObject(Icontainer.Effect, bounds, Matrix.Identity, Icontainer.IndexBuffer, Icontainer.VertexBuffer, Icontainer.VertexDeclaration, 0, Icontainer.PrimitiveType, Icontainer.PrimitiveCount, 0, Icontainer.VertexRange, 0, Icontainer.VertexStride); container.sceneObject.ObjectType = ObjectType.Static; container.sceneObject.Visibility = ObjectVisibility.RenderedAndCastShadows; //Set Locations of voxels. Matrix[] boxobjecttransforms = new Matrix[VOXELS_PER_CONTAINER]; int j = 0; while (j < boxobjecttransforms.Length) { boxobjecttransforms[j++] = Matrix.CreateTranslation(j, 0, 0); } container.sceneObject.SkinBones = boxobjecttransforms; // Submit to the ObjectManager. sceneInterface.ObjectManager.Submit(container.sceneObject); } } Update(); }
public ScreenManager(Game game, GraphicsDeviceManager graphics) { this.content = new ContentManager(game.Services, "Content"); this.GraphicsDevice = graphics.GraphicsDevice; this.graphicsDeviceService = (IGraphicsDeviceService)game.Services.GetService(typeof(IGraphicsDeviceService)); if (this.graphicsDeviceService == null) { throw new InvalidOperationException("No graphics device service."); } this.lightingSystemManager = new LightingSystemManager(game.Services); this.sceneState = new SceneState(); this.inter = new SceneInterface(graphics); this.inter.CreateDefaultManagers(false, false, true); this.editor = new LightingSystemEditor(game.Services, graphics, game) { UserHandledView = true }; this.inter.AddManager(this.editor); }
public SimpleGameScreen() { sceneState = new SceneState(); // Create the scene interface. Acts as a service provider containing all scene managers // and returning them by type (including custom managers). Also acts as a component // container where calls to manager methods on the SceneInterface (such as BeginFrameRendering, // Unload, ...) are automatically called on all contained managers. // // This design allows managers to be plugged-in like modular components and for managers // to easily be added, removed, or replaced with custom implementations. // sceneInterface = new SceneInterface(); sceneInterface.CreateDefaultManagers(RenderingSystemType.Forward, CollisionSystemType.Physics, true); BaseGameProgram.Instance.OnInitializeSceneInterface(sceneInterface); // Create the frame buffers used for rendering (sized to the backbuffer) and // assign them to the ResourceManager so we don't have to worry about cleanup. frameBuffers = new FrameBuffers(DetailPreference.High, DetailPreference.High); sceneInterface.ResourceManager.AssignOwnership(frameBuffers); }
/// <summary> /// 更新 /// </summary> public void Update(GameTime gameTime) { maingametime = gameTime; scene = scene.Update(gameTime); }
/// <summary> /// ゲームメインの生成 /// </summary> /// <param name="content"></param> /// <param name="graphicsdevice"></param> /// <param name="game"></param> public GameMain(ContentManager content, GraphicsDevice graphicsDevice, Game game) { game.Components.Add(Input.Instance); scene = new Title(content, graphicsDevice); }
public Engine() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content-" + LightingSystemManager.Edition; // Minimum requirement. graphics.MinimumPixelShaderProfile = ShaderProfile.PS_3_0; graphics.MinimumVertexShaderProfile = ShaderProfile.VS_3_0; graphics.PreferredBackBufferWidth = 1920; graphics.PreferredBackBufferHeight = 1080; graphics.IsFullScreen = true; graphics.SynchronizeWithVerticalRetrace = true; graphics.PreparingDeviceSettings += PrepareDeviceSettings; // Used for advanced edge cleanup. graphics.PreferredDepthStencilFormat = DepthFormat.Depth24Stencil8; // Required for lighting system. splashScreenGameComponent = new SplashScreenGameComponent(this, graphics); Components.Add(splashScreenGameComponent); // Create the lighting system. lightingSystemManager = new LightingSystemManager(Services); sceneState = new SceneState(); // Create the scene interface. Acts as a service provider containing all scene managers // and returning them by type (including custom managers). Also acts as a component // container where calls to manager methods on the SceneInterface (such as BeginFrameRendering, // Unload, ...) are automatically called on all contained managers. // // This design allows managers to be plugged-in like modular components and for managers // to easily be added, removed, or replaced with custom implementations. // sceneInterface = new SceneInterface(graphics); sceneInterface.CreateDefaultManagers(false, false, false); // The skybox handles the back buffer clear. if (sceneInterface.RenderManager is BaseRenderManager) (sceneInterface.RenderManager as BaseRenderManager).ClearBackBufferEnabled = true; // Create a custom statistic, which is rendered to the screen with SunBurn's statistics. totalObjectCountStat = LightingSystemStatistics.GetStatistic("Instancing_TotalObjectCount", LightingSystemStatisticCategory.Rendering); // Load the user preferences (example - not required). preferences = new LightingSystemPreferences(); if (File.Exists(userPreferencesFile)) preferences.LoadFromFile(userPreferencesFile); else { preferences.EffectDetail = DetailPreference.High; preferences.MaxAnisotropy = 4; preferences.PostProcessingDetail = DetailPreference.High; preferences.ShadowDetail = DetailPreference.High; preferences.ShadowQuality = 1.0f; preferences.TextureQuality = DetailPreference.High; preferences.TextureSampling = SamplingPreference.Anisotropic; } view = GetViewMatrix(); }
public override void OnInitializeSceneInterface(SceneInterface sceneInterface) { }
/// <summary> /// Constructs a new screen manager component. /// </summary> public ScreenManager(Game game) : base(game) { // we must set EnabledGestures before we can query for them, but // we don't assume the game wants to read them. TouchPanel.EnabledGestures = GestureType.None; // Create the lighting system. sunBurnCoreSystem = new SunBurnCoreSystem(game.Services, game.Content); sceneState = new SceneState(); // Create the scene interface. Acts as a service provider containing all scene managers // and returning them by type (including custom managers). Also acts as a component // container where calls to manager methods on the SceneInterface (such as BeginFrameRendering, // Unload, ...) are automatically called on all contained managers. // // This design allows managers to be plugged-in like modular components and for managers // to easily be added, removed, or replaced with custom implementations. // sceneInterface = new SceneInterface(); sceneInterface.CreateDefaultManagers(RenderingSystemType.Forward, CollisionSystemType.Physics, true); // Create the frame buffers used for rendering (sized to the backbuffer) and // assign them to the ResourceManager so we don't have to worry about cleanup. frameBuffers = new FrameBuffers(DetailPreference.High, DetailPreference.Medium); sceneInterface.ResourceManager.AssignOwnership(frameBuffers); // Post console messages letting the user know how to open the SunBurn Editor. sceneInterface.ShowConsole = true; SystemConsole.AddMessage("Welcome to the SunBurn Engine.", 4); SystemConsole.AddMessage("Use an Xbox controller or the W, A, S, D keys to navigate the scene.", 8); SystemConsole.AddMessage("Press F11 to open the SunBurn Editor.", 12); }
/// <summary> /// /// </summary> protected Game_cl() : base() { mGraphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; // Required for lighting system. Components.Add(new SplashScreenGameComponent(this, mGraphics)); // Create the lighting system. mLightingSystemManager = new LightingSystemManager(Services, Content); mSceneState = new SceneState(); mEnvironment = new SceneEnvironment(); mSceneInterface = new SceneInterface(mGraphics); mSceneInterface.CreateDefaultManagers(false); mSceneInterface.AddManager(new ObjectManager_cl()); // Create the sprite manager used to create and organize sprite containers for 2D rendering. mSpriteManager = new SpriteManager(mGraphics); mSceneInterface.AddManager(mSpriteManager); mFrameBuffers = new FrameBuffers(mGraphics, DetailPreference.Low, DetailPreference.Low); mSceneInterface.ResourceManager.AssignOwnership(mFrameBuffers); mStaticSceneEffects = new List<SceneEffect>(); //mView = Matrix.CreateLookAt(Vector3.Zero, Vector3.Forward, Vector3.Up); //mProjection = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver2, GraphicsDevice.Viewport.AspectRatio, 0.1f, 1000f); mCameraEntity = new Entity_cl(); #if WORLD_EDITOR mWorldEditor = new WorldEditor_cl(); #endif mManagers = new List<BaseManager_cl>(); mRandom = new Random(); mTimer = new FNA.Core.Timer_cl(); mBaseInstance = this; mIsPlayingGame = true; }
public StarterGame() { // Default XNA setup. graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; // Required for lighting system. graphics.PreferredDepthStencilFormat = DepthFormat.Depth24Stencil8; // Required for lighting system. splashScreenGameComponent = new SplashScreenGameComponent(this); Components.Add(splashScreenGameComponent); // Create the lighting system. sunBurnCoreSystem = new SunBurnCoreSystem(Services, Content); sceneState = new SceneState(); // Create the scene interface. Acts as a service provider containing all scene managers // and returning them by type (including custom managers). Also acts as a component // container where calls to manager methods on the SceneInterface (such as BeginFrameRendering, // Unload, ...) are automatically called on all contained managers. // // This design allows managers to be plugged-in like modular components and for managers // to easily be added, removed, or replaced with custom implementations. // SceneInterface = new SceneInterface(); SceneInterface.CreateDefaultManagers(RenderingSystemType.Forward, CollisionSystemType.Physics, true); SpriteManager = new SpriteManager(SceneInterface); SceneInterface.AddManager(SpriteManager); // Create the frame buffers used for rendering (sized to the backbuffer) and // assign them to the ResourceManager so we don't have to worry about cleanup. frameBuffers = new FrameBuffers(DetailPreference.High, DetailPreference.Medium); SceneInterface.ResourceManager.AssignOwnership(frameBuffers); physicsManager.RegisterPhysicsBody(Character); collisionManager.RegisterCollisionBody(Character); // Post console messages letting the user know how to open the SunBurn Editor. SceneInterface.ShowConsole = true; SystemConsole.AddMessage("Welcome to the SunBurn Engine.", 4); SystemConsole.AddMessage("Use an Xbox controller or the W, A, S, D keys to navigate the scene.", 8); SystemConsole.AddMessage("Press F11 to open the SunBurn Editor.", 12); }
public abstract void OnInitializeSceneInterface(SceneInterface sceneInterface);