コード例 #1
0
ファイル: DeviceContextMG.cs プロジェクト: Kwyrky/Aether
 public void SetVertices <T>(IPhoton photon, T[] vertexData, int vertexOffset, int numVertices, short[] indexData, int indexOffset, int primitiveCount, VertexDeclaration vertexDeclaration) where T : struct
 {
     GraphicsDevice.DrawUserIndexedPrimitives <T>(this.PrimitiveType,
                                                  vertexData, vertexOffset, numVertices,
                                                  indexData, indexOffset, primitiveCount,
                                                  vertexDeclaration);
 }
コード例 #2
0
    private IEnumerator ThrowRoutine()
    {
        for (int i = 0; i < photonsCount; i++)
        {
            var pooledPhotonObject = offsetObjectPooler.Pull();
            pooledPhotonObject.GameObject.SetActive(true);
            IPhoton photon = pooledPhotonObject.GameObject.GetComponent <IPhoton>();
            photon.Throw(pooledPhotonObject.GameObject.transform.position, transform.forward, startEnergy);

            yield return(new WaitForEndOfFrame());
        }
    }
コード例 #3
0
        private void Render(GameTime gameTime, IAether particle)
        {
            Matrix worldTransform;

            LeptonsManager.GetWorldTransform(particle, out worldTransform);

            IPhoton   photon   = particle as IPhoton;
            IMaterial material = (photon != null) ? photon.Material : null;

            if (photon != null && material != null)
            {
                ((IShaderMatrices)material).World      = worldTransform;
                ((IShaderMatrices)material).View       = this.View;
                ((IShaderMatrices)material).Projection = this.Projection;
                material.Apply();
                material.ApplyTextures(photon.Textures);
                photon.Accept(material);
                return;
            }

            return;
        }
コード例 #4
0
        public IPhoton GeneratePhoton()
        {
            IPhoton photon = null;

            if (RadiosityHelper.ImportanceMap == null)
            {
                photon = new Photon(new Vector3(originX + ((x + 1) * distanceX), originY + ((y + 1) * distanceY), originZ - 1f), Direction, color);

                x++;
                if (x >= countX)
                {
                    y++;
                    x = 0;
                }
            }
            else
            {
                int tempX = x, tempY = y;
                int height = RadiosityHelper.ImportanceMap.GetLength(1);
                int width  = RadiosityHelper.ImportanceMap.GetLength(0);
                if (pixelsLeft == 0)
                {
                    // scan for an "on" pixel
                    while (y < height)
                    {
                        while (x < width)
                        {
                            if (RadiosityHelper.ImportanceMap[x, y])
                            {
                                break;
                            }
                            x++;
                        }
                        x = 0;
                        y++;
                    }
                    if (y >= height)
                    { // none found
                        x = tempX; y = tempY;
                    }
                    curPixels    = pixelsLeft = perMapPixel + (int)Math.Floor(accumulator);
                    accumulator += remainderPerPixel;
                }
                if (pixelsLeft != 0)
                {
                    if (pixelsLeft == 1)
                    {
                        photon = new Photon(new Vector3(bounds.X.Lower + (x * distanceX), bounds.Y.Lower + (y * distanceY), bounds.Z.Upper), Direction, color);
                    }
                    else
                    {
                        // TODO: do this correctly by evenly distributing within this pixel.
                        // When doing this, be sure to do pixelWidth / (pixelsAcross + 1) etc so you don't spawn two photons in the same place.
                        photon = new Photon(new Vector3(bounds.X.Lower + (x * distanceX), bounds.Y.Lower + (y * distanceY), bounds.Z.Upper), Direction, color);
                        //System.Diagnostics.Debugger.Break();
                    }

                    pixelsLeft--;
                }
            }
            return(photon);
        }
コード例 #5
0
ファイル: PhotonPlasma.cs プロジェクト: Kwyrky/Aether
 public bool IsEnabled(IPhoton item)
 {
     return(_visibleParticles.Contains(item));
 }
コード例 #6
0
ファイル: PhotonPlasma.cs プロジェクト: Kwyrky/Aether
 public virtual void Disable(IPhoton item)
 {
     _visibleParticles.Remove(item);
 }
コード例 #7
0
ファイル: PhotonPlasma.cs プロジェクト: Kwyrky/Aether
 public virtual void Enable(IPhoton item)
 {
     _visibleParticles.Add(item);
 }
コード例 #8
0
ファイル: MaterialBase.cs プロジェクト: Kwyrky/Aether
 public void SetVertices(IPhoton photon, VertexBuffer vertexBuffer, int baseVertex, int minVertexIndex, int numVertices, IndexBuffer indexBuffer, int startIndex, int primitiveCount)
 {
     DeviceContext.PrimitiveType = this.PrimitiveType;
     DeviceContext.SetVertices(photon, vertexBuffer, baseVertex, minVertexIndex, numVertices, indexBuffer, startIndex, primitiveCount);
 }
コード例 #9
0
ファイル: MaterialBase.cs プロジェクト: Kwyrky/Aether
 public void SetVertices <T>(IPhoton photon, T[] vertexData, int vertexOffset, int numVertices, short[] indexData, int indexOffset, int primitiveCount, VertexDeclaration vertexDeclaration) where T : struct
 {
     DeviceContext.PrimitiveType = this.PrimitiveType;
     DeviceContext.SetVertices(photon, vertexData, vertexOffset, numVertices, indexData, indexOffset, primitiveCount, vertexDeclaration);
 }
コード例 #10
0
ファイル: MaterialBase.cs プロジェクト: Kwyrky/Aether
 public void SetVertices <T>(IPhoton photon, int offsetInBytes, T[] data, int startIndex, int elementCount, int vertexStride) where T : struct
 {
     DeviceContext.PrimitiveType = this.PrimitiveType;
     DeviceContext.SetVertices(photon, offsetInBytes, data, startIndex, elementCount, vertexStride);
 }
コード例 #11
0
ファイル: MaterialBase.cs プロジェクト: Kwyrky/Aether
 public void SetVertices <T>(IPhoton photon, T[] data) where T : struct
 {
     ((DeviceContextMG)DeviceContext).PrimitiveType = this.PrimitiveType;
     DeviceContext.SetVertices(photon, data);
 }
コード例 #12
0
ファイル: DeviceContextMG.cs プロジェクト: Kwyrky/Aether
 public void SetVertices(IPhoton photon, VertexBuffer vertexBuffer, int baseVertex, int minVertexIndex, int numVertices, IndexBuffer indexBuffer, int startIndex, int primitiveCount)
 {
     GraphicsDevice.SetVertexBuffer(vertexBuffer);
     GraphicsDevice.Indices = indexBuffer;
     GraphicsDevice.DrawIndexedPrimitives(this.PrimitiveType, baseVertex, 0, numVertices, startIndex, primitiveCount);
 }
コード例 #13
0
ファイル: DeviceContextMG.cs プロジェクト: Kwyrky/Aether
 public void SetVertices <T>(IPhoton photon, int offsetInBytes, T[] data, int startIndex, int elementCount, int vertexStride) where T : struct
 {
     throw new NotImplementedException();
 }
コード例 #14
0
ファイル: DeviceContextMG.cs プロジェクト: Kwyrky/Aether
 public void SetVertices <T>(IPhoton photon, T[] vertexData) where T : struct
 {
     throw new NotImplementedException();
 }