Beispiel #1
0
 /// <summary>
 /// Return the HashCode of this object.
 /// </summary>
 /// <returns>The HashCode of this object.</returns>
 public override Int32 GetHashCode()
 {
     unchecked
     {
         return(PoolId.GetHashCode());
     }
 }
Beispiel #2
0
        /// <summary>
        /// </summary>
        /// <param name="poolId"> </param>
        /// <param name="renderSystem"> </param>
        /// <param name="creatorContext"> </param>
        /// <param name="depth"> </param>
        /// <param name="stencil"> </param>
        /// <param name="width"> </param>
        /// <param name="height"> </param>
        /// <param name="fsaa"> </param>
        /// <param name="multiSampleQuality"> </param>
        /// <param name="isManual"> </param>
        public GLES2DepthBuffer(PoolId poolId, GLES2RenderSystem renderSystem, GLES2Context creatorContext, GLES2RenderBuffer depth, GLES2RenderBuffer stencil, int width, int height, int fsaa, int multiSampleQuality, bool isManual)
            : base(poolId, 0, width, height, fsaa, "", isManual)
        {
            this._creatorContext     = creatorContext;
            this._multiSampleQuality = multiSampleQuality;
            this._depthBuffer        = depth;
            this._stencilBuffer      = stencil;
            this._renderSystem       = renderSystem;

            if (this._depthBuffer != null)
            {
                switch (this._depthBuffer.GLFormat)
                {
                case OpenTK.Graphics.ES20.All.DepthComponent16:
                    bitDepth = 16;
                    break;

                case GLenum.DepthComponent24Oes:
                case GLenum.DepthComponent32Oes:
                case GLenum.Depth24Stencil8Oes:                         //Packed depth / stencil
                    bitDepth = 32;
                    break;
                }
            }
        }
Beispiel #3
0
 public GLDepthBuffer( PoolId poolId, GLRenderSystem renderSystem, GLContext creatorContext,
     GLRenderBuffer depth, GLRenderBuffer stencil, 
     int width, int height, int fsaa, int multiSampleQuality,
     bool manual)
     : base( poolId, 0, width, height, fsaa, "", manual )
 {
 }
Beispiel #4
0
        public D3D9DepthBuffer( PoolId poolId, D3DRenderSystem renderSystem,
            Device creator, Surface depthBufferSurf,
            Format fmt, int width, int height,
            MultisampleType fsaa, int multiSampleQuality,
            bool isManual) :
            base(poolId, 0, width, height, (int)fsaa, "", isManual)
        {
            depthBuffer = depthBufferSurf;
            this.creator = creator;
            this.multiSampleQuality = multiSampleQuality;
            d3dFormat = fmt;
            this.renderSystem = renderSystem;

            switch (fmt)
            {
                case Format.D16Lockable:
                case Format.D15S1:
                case Format.D16:
                    bitDepth = 16;
                    break;
                case Format.D32:
                case Format.D24S8:
                case Format.D24X8:
                case Format.D24X4S4:
                case Format.D32Lockable:
                case Format.D24SingleS8:
                    bitDepth = 32;
                    break;
            }
        }
Beispiel #5
0
        public int sceKernelAllocateFplCB(PoolId PoolId, PspPointer* DataPointer, uint* Timeout)
        {
            var FixedPool = FixedPoolList.Get(PoolId);
            FixedPool.Allocate(DataPointer, Timeout, HandleCallbacks: true);

            //Console.WriteLine("Allocated: Address: 0x{0:X}", DataPointer->Address);
            return 0;
        }
 public int sceKernelAllocateFpl(PoolId PoolId, uint DataPointerPointer, uint* Timeout)
 {
     throw(new NotImplementedException());
     /*
     logWarning("sceKernelAllocateFpl(%d, %08X, %08X) @TODO Not waiting", uid, dataPtr, cast(uint)timeout);
     return sceKernelTryAllocateFpl(uid, dataPtr);
     */
 }
Beispiel #7
0
        public void SetPoolId(PoolId id)
        {
            //Change the pool Id
            this.poolId = id;

            //Render Targets were attached to us, but they have a different pool Id,
            //so detach ourselves from them
            DetachFromAllRenderTargets();
        }
        public int sceKernelAllocateFpl(PoolId PoolId, uint DataPointerPointer, uint *Timeout)
        {
            throw(new NotImplementedException());

            /*
             * logWarning("sceKernelAllocateFpl(%d, %08X, %08X) @TODO Not waiting", uid, dataPtr, cast(uint)timeout);
             * return sceKernelTryAllocateFpl(uid, dataPtr);
             */
        }
    void SpawnUfoWithChance(PoolId ufoType, float chance)
    {
        float random = Random.Range(0.0f, 1.0f);

        if (random < chance)
        {
            var pos = GetRandomSpawnPosition();
            PoolManager.Instance.Allocate(ufoType, pos, Quaternion.identity);
        }
    }
Beispiel #10
0
 public DepthBuffer(PoolId poolId, ushort bitDepth, int width, int height, int fsaa, string fsaaHint, bool manual)
 {
     this.poolId   = poolId;
     this.bitDepth = bitDepth;
     this.width    = width;
     this.height   = height;
     this.fsaa     = fsaa;
     this.fsaaHint = fsaaHint;
     this.manual   = manual;
 }
        public int sceKernelFreeFpl(PoolId PoolId, uint DataPointer)
        {
            var FixedPool = FixedPoolList.Get(PoolId);

            if (!FixedPool.UsedBlocks.Contains(DataPointer))
            {
                throw (new SceKernelException(SceKernelErrors.ERROR_KERNEL_ILLEGAL_MEMBLOCK));
            }
            FixedPool.UsedBlocks.Remove(DataPointer);
            FixedPool.FreeBlocks.Add(DataPointer);
            return(0);
        }
    public int GetAllocatedCount(PoolId poolId)
    {
        ObjectPool pool;

        if (objectPoolInstances.TryGetValue(poolId, out pool))
        {
            return(pool.GetAllocatedCount());
        }
        else
        {
            Debug.LogError("Pool " + poolId.ToString() + " has not been configured or initialised");
            return(0);
        }
    }
        public int sceKernelTryAllocateFpl(PoolId PoolId, uint *DataPointerPointer)
        {
            var FixedPool = FixedPoolList.Get(PoolId);

            if (FixedPool.FreeBlocks.Count <= 0)
            {
                //throw (new SceKernelException(SceKernelErrors.ERROR_KERNEL_NO_MEMORY));
                throw (new SceKernelException(SceKernelErrors.ERROR_KERNEL_WAIT_CAN_NOT_WAIT));
            }

            var AllocatedBlock = FixedPool.FreeBlocks.First();

            FixedPool.FreeBlocks.Remove(AllocatedBlock);
            FixedPool.UsedBlocks.Add(AllocatedBlock);

            *DataPointerPointer = AllocatedBlock;
            return(0);
        }
Beispiel #14
0
        /// <summary>
        /// Return a JSON representation of this object.
        /// </summary>

        public JObject ToJSON()

        => JSONObject.Create(

            new JProperty("poolId", PoolId.ToString()),

            Address != null
                       ? new JProperty("address", Address.ToJSON())
                       : null,

            GeoCoordinates.HasValue
                       ? new JProperty("geoCoordinates", GeoCoordinates.Value.ToJSON())
                       : null,

            ChargingStations.SafeAny()
                       ? new JProperty("chargingStations", JSONArray.Create(ChargingStations.Select(chargingStation => chargingStation.ToJSON())))
                       : null

            );
    public GameObject Allocate(PoolId poolId, Vector3 position, Quaternion rotation)
    {
        ObjectPool pool;

        if (objectPoolInstances.TryGetValue(poolId, out pool))
        {
            var go = pool.Allocate(position, rotation);
            var poolTypeComponent = go.GetComponent <PoolAllocation>();
            if (!poolTypeComponent)
            {
                poolTypeComponent        = go.AddComponent <PoolAllocation>();
                poolTypeComponent.poolId = poolId;
            }
            return(go);
        }
        else
        {
            Debug.LogError("Pool " + poolId.ToString() + " has not been configured or initialised");
            return(null);
        }
    }
Beispiel #16
0
		/// <summary>
		/// </summary>
		/// <param name="poolId"> </param>
		/// <param name="renderSystem"> </param>
		/// <param name="creatorContext"> </param>
		/// <param name="depth"> </param>
		/// <param name="stencil"> </param>
		/// <param name="width"> </param>
		/// <param name="height"> </param>
		/// <param name="fsaa"> </param>
		/// <param name="multiSampleQuality"> </param>
		/// <param name="isManual"> </param>
		public GLES2DepthBuffer( PoolId poolId, GLES2RenderSystem renderSystem, GLES2Context creatorContext, GLES2RenderBuffer depth, GLES2RenderBuffer stencil, int width, int height, int fsaa, int multiSampleQuality, bool isManual )
			: base( poolId, 0, width, height, fsaa, "", isManual )
		{
			this._creatorContext = creatorContext;
			this._multiSampleQuality = multiSampleQuality;
			this._depthBuffer = depth;
			this._stencilBuffer = stencil;
			this._renderSystem = renderSystem;

			if ( this._depthBuffer != null )
			{
				switch ( this._depthBuffer.GLFormat )
				{
					case OpenTK.Graphics.ES20.All.DepthComponent16:
						bitDepth = 16;
						break;
					case GLenum.DepthComponent24Oes:
					case GLenum.DepthComponent32Oes:
					case GLenum.Depth24Stencil8Oes: //Packed depth / stencil
						bitDepth = 32;
						break;
				}
			}
		}
 public int sceKernelDeleteFpl(PoolId PoolId)
 {
     FixedPoolList.Remove(PoolId);
     return(0);
 }
Beispiel #18
0
 protected RenderTarget(string name)
 {
     this.name = name;
     priority = RenderTargetPriority.Default;
     depthBufferPoolId = PoolId.Default;
     active = true;
     autoUpdate = true;
     ResetStatistics();
 }
Beispiel #19
0
 public int sceKernelFreeFpl(PoolId PoolId, PspPointer DataPointer)
 {
     var FixedPool = FixedPoolList.Get(PoolId);
     FixedPool.Free(DataPointer);
     return 0;
 }
Beispiel #20
0
        public int sceKernelTryAllocateFpl(PoolId PoolId, PspPointer* DataPointer)
        {
            var FixedPool = FixedPoolList.Get(PoolId);
            if (!FixedPool.TryAllocate(DataPointer))
            {
                throw (new SceKernelException(SceKernelErrors.ERROR_KERNEL_NO_MEMORY));
            }

            return 0;
        }
Beispiel #21
0
 public int sceKernelDeleteFpl(PoolId PoolId)
 {
     FixedPoolList.Remove(PoolId);
     return 0;
 }
Beispiel #22
0
 public GLDepthBuffer(PoolId poolId, GLRenderSystem renderSystem, GLContext creatorContext, GLRenderBuffer depth,
                      GLRenderBuffer stencil, int width, int height, int fsaa, int multiSampleQuality, bool manual)
     : base(poolId, 0, width, height, fsaa, "", manual)
 {
 }
 public int sceKernelFreeFpl(PoolId PoolId, uint DataPointer)
 {
     var FixedPool = FixedPoolList.Get(PoolId);
     if (!FixedPool.UsedBlocks.Contains(DataPointer))
     {
         throw (new SceKernelException(SceKernelErrors.ERROR_KERNEL_ILLEGAL_MEMBLOCK));
     }
     FixedPool.UsedBlocks.Remove(DataPointer);
     FixedPool.FreeBlocks.Add(DataPointer);
     return 0;
 }
        public int sceKernelTryAllocateFpl(PoolId PoolId, uint* DataPointerPointer)
        {
            var FixedPool = FixedPoolList.Get(PoolId);

            if (FixedPool.FreeBlocks.Count <= 0)
            {
                //throw (new SceKernelException(SceKernelErrors.ERROR_KERNEL_NO_MEMORY));
                throw (new SceKernelException(SceKernelErrors.ERROR_KERNEL_WAIT_CAN_NOT_WAIT));
            }

            var AllocatedBlock = FixedPool.FreeBlocks.First();
            FixedPool.FreeBlocks.Remove(AllocatedBlock);
            FixedPool.UsedBlocks.Add(AllocatedBlock);

            *DataPointerPointer = AllocatedBlock;
            return 0;
        }
Beispiel #25
0
 public static string GetPoolKey(PoolId id)
 {
     return(((int)id).ToString());
     // return PoolKey[(int) id];
 }