static MyRigidBodyModule()
 {
     m_ActiveRigids = new HashSet<MyRigidBody>();
     //m_Rigids = new List<MyRigidBody>(MyPhysicsConfig.MaxCollidingElements);
     m_SolverPool = new MyObjectsPool<MyRBIslandNSolver>(2 * MyPhysicsConfig.MaxCollidingElements);
     m_SolverList = new List<MyRBIslandNSolver>(2 * MyPhysicsConfig.MaxCollidingElements);
 }
 public MyRigidBodyIslandGeneration()
 {
     m_islands       = new List <MyRigidBodyIsland>(128);
     m_islandsPool   = new MyObjectsPool <MyRigidBodyIsland>(256);
     m_proccesedList = new HashSet <MyRigidBody>();
     m_activeRigids  = new List <MyRigidBody>(128);
 }
        static void PreallocateObjects()
        {
            if (m_objectPool == null)
            {
                m_objectPool = new MyObjectsPool <MyExplosionDebrisModel>(MyExplosionsConstants.MAX_EXPLOSION_DEBRIS_OBJECTS);
            }
            m_objectPool.DeallocateAll();

            List <MyRBElementDesc> collisionPrimitives = new List <MyRBElementDesc>();

            MyPhysicsObjects      physobj    = MyPhysics.physicsSystem.GetPhysicsObjects();
            MyRBSphereElementDesc sphereDesc = physobj.GetRBSphereElementDesc();

            sphereDesc.SetToDefault();
            sphereDesc.m_RBMaterial = MyMaterialsConstants.GetMaterialProperties(MODEL_DEBRIS_MATERIAL_TYPE).PhysicsMaterial;

            collisionPrimitives.Add(sphereDesc);

            int counter = 0;

            foreach (var item in m_objectPool.GetPreallocatedItemsArray())
            {
                MyModelsEnum   modelEnum      = (MyModelsEnum)((int)MyModelsEnum.Debris1 + counter % 31);
                MyModel        model          = MyModels.GetModelOnlyData(modelEnum);
                BoundingSphere boundingSphere = model.BoundingSphere;

                sphereDesc.m_Radius             = boundingSphere.Radius;
                sphereDesc.m_Matrix.Translation = boundingSphere.Center;

                item.Value.Init(collisionPrimitives, modelEnum);
                counter++;
            }
        }
示例#4
0
 static MyRigidBodyModule()
 {
     m_ActiveRigids = new HashSet <MyRigidBody>();
     //m_Rigids = new List<MyRigidBody>(MyPhysicsConfig.MaxCollidingElements);
     m_SolverPool = new MyObjectsPool <MyRBIslandNSolver>(2 * MyPhysicsConfig.MaxCollidingElements);
     m_SolverList = new List <MyRBIslandNSolver>(2 * MyPhysicsConfig.MaxCollidingElements);
 }
 public override void LoadData()
 {
     if (m_pool == null)
     {
         m_pool = new MyObjectsPool<CellData>(MyVoxelConstants.GEOMETRY_CELL_CACHE_SIZE);
     }
 }
 public MyRigidBodyIslandGeneration()
 {
     m_islands = new List<MyRigidBodyIsland>(128);
     m_islandsPool = new MyObjectsPool<MyRigidBodyIsland>(256);
     m_proccesedList = new HashSet<MyRigidBody>();
     m_activeRigids = new List<MyRigidBody>(128);
 }
示例#7
0
        public static T Allocate1 <T>(this MyObjectsPool <T> pool) where T : class, new()
        {
            T result;

            pool.AllocateOrCreate(out result);
            return(result);
        }
        static void PreallocateObjects()
        {
            if (m_objectPool == null)
            {
                m_objectPool = new MyObjectsPool <MyExplosionDebrisVoxel>(MyExplosionsConstants.MAX_EXPLOSION_DEBRIS_OBJECTS);
            }
            m_objectPool.DeallocateAll();

            //  This collision primitive is used by every instance of this class
            MyModel                model               = MyModels.GetModelOnlyData(VOXEL_DEBRIS_MODEL_ENUM);
            BoundingSphere         boundingSphere      = model.BoundingSphere;
            List <MyRBElementDesc> collisionPrimitives = new List <MyRBElementDesc>();

            MyPhysicsObjects      physobj      = MyPhysics.physicsSystem.GetPhysicsObjects();
            MyRBSphereElementDesc sphereDesc   = physobj.GetRBSphereElementDesc();
            MyMaterialType        materialType = MyMaterialType.ROCK;

            sphereDesc.SetToDefault();
            sphereDesc.m_RBMaterial         = MyMaterialsConstants.GetMaterialProperties(materialType).PhysicsMaterial;
            sphereDesc.m_Radius             = boundingSphere.Radius;
            sphereDesc.m_Matrix.Translation = model.BoundingSphere.Center;

            collisionPrimitives.Add(sphereDesc);


            int counter = 0;

            foreach (LinkedListNode <MyExplosionDebrisVoxel> item in m_objectPool.GetPreallocatedItemsArray())
            {
                item.Value.Init(collisionPrimitives);
                counter++;
            }
        }
示例#9
0
 public override void LoadData()
 {
     if (m_pool == null)
     {
         m_pool = new MyObjectsPool <CellData>(MyVoxelConstants.GEOMETRY_CELL_CACHE_SIZE);
     }
 }
示例#10
0
 protected override void UnloadData()
 {
     if (m_projectiles != null)
     {
         m_projectiles.DeallocateAll();
     }
     m_projectiles = null;
 }
示例#11
0
 protected override void UnloadData()
 {
     if (m_projectiles != null)
     {
         m_projectiles.DeallocateAll();
     }
     m_projectiles = null;
 }
示例#12
0
        public MyHudNotifications()
        {
            Position = MyNotificationConstants.DEFAULT_NOTIFICATION_MESSAGE_NORMALIZED_POSITION;
            m_disappearedPredicate    = x => !x.Alive;
            m_notificationsByPriority = new Dictionary <int, List <MyHudNotificationBase> >();
            m_texts     = new List <StringBuilder>(MyNotificationConstants.MAX_DISPLAYED_NOTIFICATIONS_COUNT);
            m_textSizes = new List <Vector2>(MyNotificationConstants.MAX_DISPLAYED_NOTIFICATIONS_COUNT);
            m_textsPool = new MyObjectsPool <StringBuilder>(MyNotificationConstants.MAX_DISPLAYED_NOTIFICATIONS_COUNT);

            m_singletons = new MyHudNotificationBase[Enum.GetValues(typeof(MyNotificationSingletons)).Length];

            Register(MyNotificationSingletons.GameOverload, new MyHudNotification(font: MyFontEnum.Red, priority: 2, text: MySpaceTexts.NotificationMemoryOverload));
            Register(MyNotificationSingletons.SuitEnergyLow, new MyHudNotification(font: MyFontEnum.Red, priority: 2, text: MySpaceTexts.NotificationSuitEnergyLow));
            Register(MyNotificationSingletons.SuitEnergyCritical, new MyHudNotification(font: MyFontEnum.Red, priority: 2, text: MySpaceTexts.NotificationSuitEnergyCritical));
            Register(MyNotificationSingletons.InventoryFull, new MyHudNotification(font: MyFontEnum.Red, priority: 2, text: MySpaceTexts.NotificationInventoryFull));
            Register(MyNotificationSingletons.IncompleteGrid, new MyHudNotification(font: MyFontEnum.Red, priority: 2, text: MySpaceTexts.NotificationIncompleteGrid));

            Register(MyNotificationSingletons.DisabledWeaponsAndTools, new MyHudNotification(font: MyFontEnum.Red, text: MySpaceTexts.NotificationToolDisabled, disappearTimeMs: 0));
            Register(MyNotificationSingletons.WeaponDisabledInWorldSettings, new MyHudNotification(font: MyFontEnum.Red, text: MySpaceTexts.NotificationWeaponDisabledInSettings));
            Register(MyNotificationSingletons.MultiplayerDisabled, new MyHudNotification(font: MyFontEnum.Red, text: MySpaceTexts.NotificationMultiplayerDisabled, priority: MAX_PRIORITY));
            Register(MyNotificationSingletons.MissingComponent, new MyHudMissingComponentNotification(MySpaceTexts.NotificationMissingComponentToPlaceBlockFormat, priority: 1));
            Register(MyNotificationSingletons.WorldLoaded, new MyHudNotification(text: MySpaceTexts.WorldLoaded));
            Register(MyNotificationSingletons.ObstructingBlockDuringMerge, new MyHudNotification(font: MyFontEnum.Red, text: MySpaceTexts.NotificationObstructingBlockDuringMerge));

            Register(MyNotificationSingletons.HideHints, new MyHudNotification(disappearTimeMs: 0, level: MyNotificationLevel.Control, text: MySpaceTexts.NotificationHideHintsInGameOptions, priority: 2));
            Register(MyNotificationSingletons.HelpHint, new MyHudNotification(disappearTimeMs: 0, level: MyNotificationLevel.Control, text: MySpaceTexts.NotificationNeedShowHelpScreen, priority: 1));
            Register(MyNotificationSingletons.ScreenHint, new MyHudNotification(disappearTimeMs: 0, level: MyNotificationLevel.Control, text: MySpaceTexts.NotificationScreenFormat));
            Register(MyNotificationSingletons.SlotEquipHint, new MyHudNotification(disappearTimeMs: 0, level: MyNotificationLevel.Control, text: MySpaceTexts.NotificationSlotEquipFormat));
            Register(MyNotificationSingletons.HudHideHint, new MyHudNotification(disappearTimeMs: 0, level: MyNotificationLevel.Control, text: MySpaceTexts.NotificationHudHideFormat));

            Register(MyNotificationSingletons.RespawnShipWarning, new MyHudNotification(disappearTimeMs: 10000, level: MyNotificationLevel.Important, text: MySpaceTexts.NotificationRespawnShipDelete, font: MyFontEnum.Red));

            Register(MyNotificationSingletons.ClientCannotSave, new MyHudNotification(font: MyFontEnum.Red, text: MySpaceTexts.NotificationClientCannotSave));
            Register(MyNotificationSingletons.WheelNotPlaced, new MyHudNotification(font: MyFontEnum.Red, text: MySpaceTexts.NotificationWheelNotPlaced));
            Register(MyNotificationSingletons.CopyPasteBlockNotAvailable, new MyHudNotification(font: MyFontEnum.Red, text: MySpaceTexts.NotificationCopyPasteBlockNotAvailable));
            Register(MyNotificationSingletons.CopyPasteFloatingObjectNotAvailable, new MyHudNotification(font: MyFontEnum.Red, text: MySpaceTexts.NotificationCopyPasteFloatingObjectNotAvailable));

            Register(MyNotificationSingletons.CopyPasteAsteoridObstructed, new MyHudNotification(font: MyFontEnum.Red, text: MySpaceTexts.NotificationCopyPasteAsteroidObstructed));

            Register(MyNotificationSingletons.TextPanelReadOnly, new MyHudNotification(font: MyFontEnum.Red, text: MySpaceTexts.NotificationTextPanelReadOnly));

            Register(MyNotificationSingletons.AccessDenied, new MyHudNotification(MySpaceTexts.AccessDenied, 2500, Sandbox.Common.MyFontEnum.Red));

            if (MyPerGameSettings.Game == GameEnum.ME_GAME)
            {
                Register(MyNotificationSingletons.GameplayOptions, new MyHudNotification(MySpaceTexts.Notification_GameplayOptions, 0, level: MyNotificationLevel.Control));
                Add(MyNotificationSingletons.GameplayOptions);
            }

            Add(MyNotificationSingletons.HelpHint);
            Add(MyNotificationSingletons.HideHints);
            Add(MyNotificationSingletons.ScreenHint);
            Add(MyNotificationSingletons.SlotEquipHint);
            Add(MyNotificationSingletons.HudHideHint);

            FormatNotifications(MyInput.Static.IsJoystickConnected() && MyFakes.ENABLE_CONTROLLER_HINTS);
            MyInput.Static.JoystickConnected += Static_JoystickConnected;
        }
示例#13
0
 public override void LoadData()
 {
     VRageRender.MyRenderProxy.GetRenderProfiler().StartProfilingBlock("MyProjectiles.LoadData");
     if (m_projectiles == null)
     {
         m_projectiles = new MyObjectsPool <MyProjectile>(MyProjectilesConstants.MAX_PROJECTILES_COUNT);
     }
     VRageRender.MyRenderProxy.GetRenderProfiler().EndProfilingBlock();
 }
示例#14
0
 public override void LoadData()
 {
     VRageRender.MyRenderProxy.GetRenderProfiler().StartProfilingBlock("MyProjectiles.LoadData");
     if (m_projectiles == null)
     {
         m_projectiles = new MyObjectsPool<MyProjectile>(MyProjectilesConstants.MAX_PROJECTILES_COUNT);
     }
     VRageRender.MyRenderProxy.GetRenderProfiler().EndProfilingBlock();
 }
        //  Index of next content from buffer we will give when asked
        //static int m_nextForAllocation;


        public static void LoadData()
        {
            MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartProfilingBlock("MyVoxelContentCellContents.LoadData");
            if (m_preallocatedContents == null) // Never reallocate
            {
                m_preallocatedContents = new MyObjectsPool<MyVoxelContentCellContent>(MyVoxelConstants.PREALLOCATED_CELL_CONTENTS_COUNT);
            }
            MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().EndProfilingBlock();
        }
示例#16
0
 public static void LoadData()
 {
     MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartProfilingBlock("MyProjectiles.LoadData");
     if (m_projectiles == null)
     {
         m_projectiles = new MyObjectsPool<MyProjectile>(MyProjectilesConstants.MAX_PROJECTILES_COUNT);
     }
     MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().EndProfilingBlock();
 }
示例#17
0
        //  Index of next content from buffer we will give when asked
        //static int m_nextForAllocation;


        public static void LoadData()
        {
            MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartProfilingBlock("MyVoxelContentCellContents.LoadData");
            if (m_preallocatedContents == null) // Never reallocate
            {
                m_preallocatedContents = new MyObjectsPool <MyVoxelContentCellContent>(MyVoxelConstants.PREALLOCATED_CELL_CONTENTS_COUNT);
            }
            MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().EndProfilingBlock();
        }
示例#18
0
 public static void LoadData()
 {
     MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartProfilingBlock("MyProjectiles.LoadData");
     if (m_projectiles == null)
     {
         m_projectiles = new MyObjectsPool <MyProjectile>(MyProjectilesConstants.MAX_PROJECTILES_COUNT);
     }
     MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().EndProfilingBlock();
 }
 public void Load()
 {
     Profiler.Begin("MyVoxelContentCellContents.LoadData");
     if (m_pool == null) // Never reallocate
     {
         m_pool = new MyObjectsPool <MyVoxelContentCellContent>(MyVoxelConstants.PREALLOCATED_CELL_CONTENTS_COUNT);
     }
     Debug.Assert(m_pool.ActiveCount == 0);
     Profiler.End();
 }
示例#20
0
 protected override void UnloadData()
 {
     if (m_preallocatedLights != null)
     {
         // all lights should be deallocated at this point
         MyDebug.AssertDebug(m_preallocatedLights.ActiveCount == 0, "MyLights.UnloadData: preallocated lights not emptied!");
         m_preallocatedLights.DeallocateAll();
         m_preallocatedLights = null;
     }
 }
 public void Load()
 {
     Profiler.Begin("MyVoxelContentCellContents.LoadData");
     if (m_pool == null) // Never reallocate
     {
         m_pool = new MyObjectsPool<MyVoxelContentCellContent>(MyVoxelConstants.PREALLOCATED_CELL_CONTENTS_COUNT);
     }
     Debug.Assert(m_pool.ActiveCount == 0);
     Profiler.End();
 }
示例#22
0
 protected override void UnloadData()
 {
     if (m_preallocatedLights != null)
     {
         // all lights should be deallocated at this point
         MyDebug.AssertDebug(m_preallocatedLights.ActiveCount == 0, "MyLights.UnloadData: preallocated lights not emptied!");
         m_preallocatedLights.DeallocateAll();
         m_preallocatedLights = null;
     }
 }
示例#23
0
        public MyCuePool(AudioEngine engine, int capacity = 500)
        {
            m_audioEngine   = engine;
            m_pool          = new MyObjectsPool <MyCueProxy.Private>(capacity);
            m_activeCues    = new Dictionary <long, MyCueProxy.Private>(capacity);
            m_cuesToDestroy = new List <IntPtr>(capacity);

            m_notificationCallback = new RawNotificationCallback(OnNotify);
            m_audioEngine.RegisterNotificationRaw(ref m_notificationStopDesc, m_notificationCallback);
            //m_audioEngine.RegisterNotificationRaw(ref m_notificationDestroyDesc, m_notificationCallback);
        }
示例#24
0
        public void Dispose()
        {
            m_audioEngine.UnregisterNotificationRaw(ref m_notificationStopDesc);
            //m_audioEngine.UnregisterNotificationRaw(ref m_notificationDestroyDesc);

            foreach (var cue in m_activeCues)
            {
                cue.Value.Destroy();
                cue.Value.OnRelease();
            }
            m_pool        = null;
            m_activeCues  = null;
            m_audioEngine = null;
        }
示例#25
0
        public static void LoadData()
        {
            MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartProfilingBlock("MyExplosions.LoadData");
            MyMwcLog.WriteLine("MyExplosions.LoadData() - START");
            MyMwcLog.IncreaseIndent();

            if (m_explosions == null)
            {
                m_explosions = new MyObjectsPool<MyExplosion>(MyExplosionsConstants.MAX_EXPLOSIONS_COUNT);
            }

            MyMwcLog.DecreaseIndent();
            MyMwcLog.WriteLine("MyExplosions.LoadData() - END");
            MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().EndProfilingBlock();
        }
        public override void LoadData()
        {
            VRageRender.MyRenderProxy.GetRenderProfiler().StartProfilingBlock("MyExplosions.LoadData");
            MySandboxGame.Log.WriteLine("MyExplosions.LoadData() - START");
            MySandboxGame.Log.IncreaseIndent();

            if (m_explosions == null)
            {
                m_explosions = new MyObjectsPool<MyExplosion>(MyExplosionsConstants.MAX_EXPLOSIONS_COUNT);
            }

            MySandboxGame.Log.DecreaseIndent();
            MySandboxGame.Log.WriteLine("MyExplosions.LoadData() - END");
            VRageRender.MyRenderProxy.GetRenderProfiler().EndProfilingBlock();
        }
示例#27
0
        void AllocateInternal()
        {
            m_gbufferPass     = new MyGBufferPass();
            m_depthPassesPool = new MyObjectsPool <MyDepthPass>(1);

            m_tmpCullingWork  = new List <MyCpuFrustumCullingWork>();
            m_tmpCullPasses   = new MyCpuFrustumCullPasses();
            m_tmpRenderPasses = new List <MyRenderPass>();

            m_tmpVisibleInstances = new List <MyInstanceComponent> [MyPassIdResolver.AllPassesCount];
            for (int i = 0; i < m_tmpVisibleInstances.Length; i++)
            {
                m_tmpVisibleInstances[i] = new List <MyInstanceComponent>();
            }
        }
示例#28
0
        public static void LoadData()
        {
            MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartProfilingBlock("MyExplosions.LoadData");
            MyMwcLog.WriteLine("MyExplosions.LoadData() - START");
            MyMwcLog.IncreaseIndent();

            if (m_explosions == null)
            {
                m_explosions = new MyObjectsPool <MyExplosion>(MyExplosionsConstants.MAX_EXPLOSIONS_COUNT);
            }

            MyMwcLog.DecreaseIndent();
            MyMwcLog.WriteLine("MyExplosions.LoadData() - END");
            MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().EndProfilingBlock();
        }
示例#29
0
        public override void LoadData()
        {
            VRageRender.MyRenderProxy.GetRenderProfiler().StartProfilingBlock("MyExplosions.LoadData");
            MySandboxGame.Log.WriteLine("MyExplosions.LoadData() - START");
            MySandboxGame.Log.IncreaseIndent();

            if (m_explosions == null)
            {
                m_explosions = new MyObjectsPool <MyExplosion>(MyExplosionsConstants.MAX_EXPLOSIONS_COUNT);
            }

            MySandboxGame.Log.DecreaseIndent();
            MySandboxGame.Log.WriteLine("MyExplosions.LoadData() - END");
            VRageRender.MyRenderProxy.GetRenderProfiler().EndProfilingBlock();
        }
示例#30
0
        public override void LoadData()
        {
            VRageRender.MyRenderProxy.GetRenderProfiler().StartProfilingBlock("MyLights.LoadData");
            MySandboxGame.Log.WriteLine("MyLights.LoadData() - START");
            MySandboxGame.Log.IncreaseIndent();

            if (m_preallocatedLights == null)
            {
                m_preallocatedLights = new MyObjectsPool <MyLight>(MyLightsConstants.MAX_LIGHTS_COUNT);
            }

            MySandboxGame.Log.DecreaseIndent();
            MySandboxGame.Log.WriteLine("MyLights.LoadData() - END");
            VRageRender.MyRenderProxy.GetRenderProfiler().EndProfilingBlock();
        }
示例#31
0
        public override void LoadData()
        {
            VRageRender.MyRenderProxy.GetRenderProfiler().StartProfilingBlock("MyLights.LoadData");
            MySandboxGame.Log.WriteLine("MyLights.LoadData() - START");
            MySandboxGame.Log.IncreaseIndent();

            if (m_preallocatedLights == null)
            {
                m_preallocatedLights = new MyObjectsPool<MyLight>(MyLightsConstants.MAX_LIGHTS_COUNT);
            }

            MySandboxGame.Log.DecreaseIndent();
            MySandboxGame.Log.WriteLine("MyLights.LoadData() - END");
            VRageRender.MyRenderProxy.GetRenderProfiler().EndProfilingBlock();
        }
示例#32
0
        public static void LoadData()
        {
            MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartProfilingBlock("MyLights.LoadData");
            MyMwcLog.WriteLine("MyLights.LoadData() - START");
            MyMwcLog.IncreaseIndent();

            if (m_preallocatedLights == null)
            {
                m_preallocatedLights = new MyObjectsPool <MyLight>(MyLightsConstants.MAX_LIGHTS_COUNT);
            }
            m_sortedLights = new List <MyLight>(MyLightsConstants.MAX_LIGHTS_COUNT_WHEN_DRAWING);

            MyMwcLog.DecreaseIndent();
            MyMwcLog.WriteLine("MyLights.LoadData() - END");
            MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().EndProfilingBlock();
        }
        public MyCockpitGlassDecalsBuffer(int capacity, int maxNeighbourTriangles, int fadeInPhaseInMiliseconds, int fadeOutStartInMiliseconds, int fadeOutLengthInMiliseconds)
        {
            //  Fade in (initial phase) can't interfere with fadeout phase
            MyCommonDebugUtils.AssertRelease(fadeInPhaseInMiliseconds < fadeOutStartInMiliseconds);

            //  Buffer can't store more decal triangles than vertex buffer used for drawing them!
            MyCommonDebugUtils.AssertRelease(capacity <= MyCockpitGlassDecalsConstants.MAX_DECAL_TRIANGLES_IN_BUFFER);

            MyCommonDebugUtils.AssertRelease(maxNeighbourTriangles <= MyCockpitGlassDecalsConstants.MAX_NEIGHBOUR_TRIANGLES);

            //  If there will be more neighbour triangles, we won't be able to add them into buffer in one call!
            MyCommonDebugUtils.AssertRelease(maxNeighbourTriangles < capacity);

            m_triangles = new MyObjectsPool<MyCockpitGlassDecalTriangle>(capacity);
            MaxNeighbourTriangles = maxNeighbourTriangles;
            m_fadeInPhaseInMiliseconds = fadeInPhaseInMiliseconds;
            m_fadeOutStartInMiliseconds = fadeOutStartInMiliseconds;
            m_fadeOutLengthInMiliseconds = fadeOutLengthInMiliseconds;
        }
示例#34
0
        public MyCockpitGlassDecalsBuffer(int capacity, int maxNeighbourTriangles, int fadeInPhaseInMiliseconds, int fadeOutStartInMiliseconds, int fadeOutLengthInMiliseconds)
        {
            //  Fade in (initial phase) can't interfere with fadeout phase
            MyCommonDebugUtils.AssertRelease(fadeInPhaseInMiliseconds < fadeOutStartInMiliseconds);

            //  Buffer can't store more decal triangles than vertex buffer used for drawing them!
            MyCommonDebugUtils.AssertRelease(capacity <= MyCockpitGlassDecalsConstants.MAX_DECAL_TRIANGLES_IN_BUFFER);

            MyCommonDebugUtils.AssertRelease(maxNeighbourTriangles <= MyCockpitGlassDecalsConstants.MAX_NEIGHBOUR_TRIANGLES);

            //  If there will be more neighbour triangles, we won't be able to add them into buffer in one call!
            MyCommonDebugUtils.AssertRelease(maxNeighbourTriangles < capacity);

            m_triangles                  = new MyObjectsPool <MyCockpitGlassDecalTriangle>(capacity);
            MaxNeighbourTriangles        = maxNeighbourTriangles;
            m_fadeInPhaseInMiliseconds   = fadeInPhaseInMiliseconds;
            m_fadeOutStartInMiliseconds  = fadeOutStartInMiliseconds;
            m_fadeOutLengthInMiliseconds = fadeOutLengthInMiliseconds;
        }
示例#35
0
        public static void LoadData()
        {
            MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartProfilingBlock("MyCannonShots.LoadData");

            MyMwcLog.WriteLine("MyMissiles.LoadContent() - START");
            MyMwcLog.IncreaseIndent();

            if (m_missiles == null)
                m_missiles = new MyObjectsPool<MyCannonShot>(MyMissileConstants.MAX_MISSILES_COUNT);
            m_missiles.DeallocateAll();

            foreach (LinkedListNode<MyCannonShot> item in m_missiles.GetPreallocatedItemsArray())
            {
                item.Value.Init();
            }

            MyMwcLog.DecreaseIndent();
            MyMwcLog.WriteLine("MyMissiles.LoadContent() - END");
            MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().EndProfilingBlock();
        }
示例#36
0
        public MyPhysicsObjects()
        {
            m_RigidBodyDesc = new MyRigidBodyDesc();
            m_SensorDesc = new MySensorDesc();
            m_RBSphereElementDesc = new MyRBSphereElementDesc();
            m_RBBoxElementDesc = new MyRBBoxElementDesc();
            m_RBCapsuleElementDesc = new MyRBCapsuleElementDesc();
            m_RBTriangleMeshDesc = new MyRBTriangleMeshElementDesc();
            m_RBVoxelElementDesc = new MyRBVoxelElementDesc();

            m_SensorsPool = new MyObjectsPool<MySensor>(128);
            m_SphereSensorElementPool = new MyObjectsPool<MySphereSensorElement>(128);

            m_RigidsPool = new MyObjectsPool<MyRigidBody>(24576);
            m_RBSphereElementPool = new MyObjectsPool<MyRBSphereElement>(16384);
            m_RBBoxElementPool = new MyObjectsPool<MyRBBoxElement>(16384);
            m_RBCapsuleElementPool = new MyObjectsPool<MyRBCapsuleElement>(16);
            m_RBTriangleMeshElementPool = new MyObjectsPool<MyRBTriangleMeshElement>(16384);//value from Ales - 64
            m_RBVoxelElementPool = new MyObjectsPool<MyRBVoxelElement>(512);
        }
示例#37
0
        public MyPhysicsObjects()
        {
            m_RigidBodyDesc        = new MyRigidBodyDesc();
            m_SensorDesc           = new MySensorDesc();
            m_RBSphereElementDesc  = new MyRBSphereElementDesc();
            m_RBBoxElementDesc     = new MyRBBoxElementDesc();
            m_RBCapsuleElementDesc = new MyRBCapsuleElementDesc();
            m_RBTriangleMeshDesc   = new MyRBTriangleMeshElementDesc();
            m_RBVoxelElementDesc   = new MyRBVoxelElementDesc();

            m_SensorsPool             = new MyObjectsPool <MySensor>(128);
            m_SphereSensorElementPool = new MyObjectsPool <MySphereSensorElement>(128);

            m_RigidsPool                = new MyObjectsPool <MyRigidBody>(24576);
            m_RBSphereElementPool       = new MyObjectsPool <MyRBSphereElement>(16384);
            m_RBBoxElementPool          = new MyObjectsPool <MyRBBoxElement>(16384);
            m_RBCapsuleElementPool      = new MyObjectsPool <MyRBCapsuleElement>(16);
            m_RBTriangleMeshElementPool = new MyObjectsPool <MyRBTriangleMeshElement>(16384);//value from Ales - 64
            m_RBVoxelElementPool        = new MyObjectsPool <MyRBVoxelElement>(512);
        }
示例#38
0
        public static void LoadData()
        {
            MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartProfilingBlock("MyHologramShips.LoadData");

            MyMwcLog.WriteLine("MyHologramShips.LoadContent() - START");
            MyMwcLog.IncreaseIndent();

            if (m_hologramShips == null)
                m_hologramShips = new MyObjectsPool<MySmallShip>(MyUniversalLauncherConstants.MAX_HOLOGRAMS_COUNT * MyMultiplayerGameplay.MaxPlayers);
            m_hologramShips.DeallocateAll();

            foreach (var item in m_hologramShips.GetPreallocatedItemsArray())
            {
                // TODO simon - do we need something here?
                //item.Value.Init();
            }

            MyMwcLog.DecreaseIndent();
            MyMwcLog.WriteLine("MyHologramShips.LoadContent() - END");
            MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().EndProfilingBlock();
        }
示例#39
0
        public static void LoadData()
        {
            MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartProfilingBlock("MyMissiles.LoadData");

            MyMwcLog.WriteLine("MyMissiles.LoadContent() - START");
            MyMwcLog.IncreaseIndent();

            if (m_missiles == null)
            {
                m_missiles = new MyObjectsPool <MyMissile>(MyMissileConstants.MAX_MISSILES_COUNT);
            }
            m_missiles.DeallocateAll();

            foreach (LinkedListNode <MyMissile> item in m_missiles.GetPreallocatedItemsArray())
            {
                item.Value.Init();
            }

            MyMwcLog.DecreaseIndent();
            MyMwcLog.WriteLine("MyMissiles.LoadContent() - END");
            MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().EndProfilingBlock();
        }
示例#40
0
        public static void LoadData()
        {
            MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartProfilingBlock("MyHologramShips.LoadData");

            MyMwcLog.WriteLine("MyHologramShips.LoadContent() - START");
            MyMwcLog.IncreaseIndent();

            if (m_hologramShips == null)
            {
                m_hologramShips = new MyObjectsPool <MySmallShip>(MyUniversalLauncherConstants.MAX_HOLOGRAMS_COUNT * MyMultiplayerGameplay.MaxPlayers);
            }
            m_hologramShips.DeallocateAll();

            foreach (var item in m_hologramShips.GetPreallocatedItemsArray())
            {
                // TODO simon - do we need something here?
                //item.Value.Init();
            }

            MyMwcLog.DecreaseIndent();
            MyMwcLog.WriteLine("MyHologramShips.LoadContent() - END");
            MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().EndProfilingBlock();
        }
示例#41
0
        public MyHudNotifications()
        {
            Position                  = MyNotificationConstants.DEFAULT_NOTIFICATION_MESSAGE_NORMALIZED_POSITION;
            m_disappearedPredicate    = x => !x.Alive;
            m_notificationsByPriority = new Dictionary<int, List<MyHudNotificationBase>>();
            m_texts                   = new List<StringBuilder>(MyNotificationConstants.MAX_DISPLAYED_NOTIFICATIONS_COUNT);
            m_textSizes               = new List<Vector2>(MyNotificationConstants.MAX_DISPLAYED_NOTIFICATIONS_COUNT);
            m_textsPool               = new MyObjectsPool<StringBuilder>(MyNotificationConstants.MAX_DISPLAYED_NOTIFICATIONS_COUNT);

            m_singletons = new MyHudNotificationBase[Enum.GetValues(typeof(MyNotificationSingletons)).Length];

            Register(MyNotificationSingletons.GameOverload,                  new MyHudNotification(font: MyFontEnum.Red, priority: 2, text: MySpaceTexts.NotificationMemoryOverload));
            Register(MyNotificationSingletons.SuitEnergyLow,                 new MyHudNotification(font: MyFontEnum.Red, priority: 2, text: MySpaceTexts.NotificationSuitEnergyLow));
            Register(MyNotificationSingletons.SuitEnergyCritical,            new MyHudNotification(font: MyFontEnum.Red, priority: 2, text: MySpaceTexts.NotificationSuitEnergyCritical));
            Register(MyNotificationSingletons.InventoryFull,                 new MyHudNotification(font: MyFontEnum.Red, priority: 2, text: MySpaceTexts.NotificationInventoryFull));

            Register(MyNotificationSingletons.DisabledWeaponsAndTools,       new MyHudNotification(font: MyFontEnum.Red, text: MySpaceTexts.NotificationToolDisabled, disappearTimeMs: 0));
            Register(MyNotificationSingletons.WeaponDisabledInWorldSettings, new MyHudNotification(font: MyFontEnum.Red, text: MySpaceTexts.NotificationWeaponDisabledInSettings));
            Register(MyNotificationSingletons.MultiplayerDisabled,           new MyHudNotification(font: MyFontEnum.Red, text: MySpaceTexts.NotificationMultiplayerDisabled, priority: MAX_PRIORITY));
            Register(MyNotificationSingletons.MissingComponent,              new MyHudMissingComponentNotification(MySpaceTexts.NotificationMissingComponentToPlaceBlockFormat, priority: 1));
            Register(MyNotificationSingletons.WorldLoaded,                   new MyHudNotification(text: MySpaceTexts.WorldLoaded));
            Register(MyNotificationSingletons.ObstructingBlockDuringMerge,   new MyHudNotification(font: MyFontEnum.Red, text: MySpaceTexts.NotificationObstructingBlockDuringMerge));

            Register(MyNotificationSingletons.HideHints,                new MyHudNotification(disappearTimeMs: 0, level: MyNotificationLevel.Control, text: MySpaceTexts.NotificationHideHintsInGameOptions, priority: 2));
            Register(MyNotificationSingletons.HelpHint,                 new MyHudNotification(disappearTimeMs: 0, level: MyNotificationLevel.Control, text: MySpaceTexts.NotificationNeedShowHelpScreen, priority: 1));
            Register(MyNotificationSingletons.ScreenHint,               new MyHudNotification(disappearTimeMs: 0, level: MyNotificationLevel.Control, text: MySpaceTexts.NotificationScreenFormat));
            Register(MyNotificationSingletons.SlotEquipHint,            new MyHudNotification(disappearTimeMs: 0, level: MyNotificationLevel.Control, text: MySpaceTexts.NotificationSlotEquipFormat));
            Register(MyNotificationSingletons.HudHideHint,              new MyHudNotification(disappearTimeMs: 0, level: MyNotificationLevel.Control, text: MySpaceTexts.NotificationHudHideFormat));

            Register(MyNotificationSingletons.RespawnShipWarning,       new MyHudNotification(disappearTimeMs: 10000, level: MyNotificationLevel.Important, text: MySpaceTexts.NotificationRespawnShipDelete, font: MyFontEnum.Red));

            Register(MyNotificationSingletons.ClientCannotSave, new MyHudNotification(font: MyFontEnum.Red, text: MySpaceTexts.NotificationClientCannotSave));
            Register(MyNotificationSingletons.WheelNotPlaced, new MyHudNotification(font: MyFontEnum.Red, text: MySpaceTexts.NotificationWheelNotPlaced));
            Register(MyNotificationSingletons.CopyPasteBlockNotAvailable, new MyHudNotification(font: MyFontEnum.Red, text: MySpaceTexts.NotificationCopyPasteBlockNotAvailable));
            Register(MyNotificationSingletons.CopyPasteFloatingObjectNotAvailable, new MyHudNotification(font: MyFontEnum.Red, text: MySpaceTexts.NotificationCopyPasteFloatingObjectNotAvailable));

            Register(MyNotificationSingletons.CopyPasteAsteoridObstructed, new MyHudNotification(font: MyFontEnum.Red, text: MySpaceTexts.NotificationCopyPasteAsteroidObstructed));

            Register(MyNotificationSingletons.TextPanelReadOnly, new MyHudNotification(font: MyFontEnum.Red, text: MySpaceTexts.NotificationTextPanelReadOnly));

            Register(MyNotificationSingletons.AccessDenied, new MyHudNotification(MySpaceTexts.AccessDenied, 2500, Sandbox.Common.MyFontEnum.Red));

            if (MyPerGameSettings.Game == GameEnum.ME_GAME)
            {
                Register(MyNotificationSingletons.GameplayOptions, new MyHudNotification(MySpaceTexts.Notification_GameplayOptions, 0, level: MyNotificationLevel.Control));
                Add(MyNotificationSingletons.GameplayOptions);
            }

            Add(MyNotificationSingletons.HelpHint);
            Add(MyNotificationSingletons.HideHints);
            Add(MyNotificationSingletons.ScreenHint);
            Add(MyNotificationSingletons.SlotEquipHint);
            Add(MyNotificationSingletons.HudHideHint);

            FormatNotifications(MyInput.Static.IsJoystickConnected() && MyFakes.ENABLE_CONTROLLER_HINTS);
            MyInput.Static.JoystickConnected += Static_JoystickConnected;
        }
        static void PreallocateObjects()
        {
            if (m_objectPool == null)
                m_objectPool = new MyObjectsPool<MyExplosionDebrisVoxel>(MyExplosionsConstants.MAX_EXPLOSION_DEBRIS_OBJECTS);
            m_objectPool.DeallocateAll();

            //  This collision primitive is used by every instance of this class
            MyModel model = MyModels.GetModelOnlyData(VOXEL_DEBRIS_MODEL_ENUM);
            BoundingSphere boundingSphere = model.BoundingSphere;
            List<MyRBElementDesc> collisionPrimitives = new List<MyRBElementDesc>();

            MyPhysicsObjects physobj = MyPhysics.physicsSystem.GetPhysicsObjects();
            MyRBSphereElementDesc sphereDesc = physobj.GetRBSphereElementDesc();
            MyMaterialType materialType = MyMaterialType.ROCK;
            sphereDesc.SetToDefault();
            sphereDesc.m_RBMaterial = MyMaterialsConstants.GetMaterialProperties(materialType).PhysicsMaterial;
            sphereDesc.m_Radius = boundingSphere.Radius;
            sphereDesc.m_Matrix.Translation = model.BoundingSphere.Center;

            collisionPrimitives.Add(sphereDesc);


            int counter = 0;
            foreach (LinkedListNode<MyExplosionDebrisVoxel> item in m_objectPool.GetPreallocatedItemsArray())
            {
                item.Value.Init(collisionPrimitives);
                counter++;
            }
        }
示例#43
0
 public MyPersistentResourceManager()
 {
     m_objectsPool = new MyObjectsPool <TResource>(GetAllocResourceCount());
 }
 public MyOxygenRoomLinkPool(int capacity)
 {
     pool=new MyObjectsPool<MyOxygenRoomLink>(capacity);
 }