Beispiel #1
0
        public Deferred(IContentLoader contentLoader, Dictionary <Enums.EntityType, DefaultMesh> meshes)
        {
            _deferredProgram = contentLoader.Load <IShaderProgram>("deferred.*");

            foreach (var meshContainer in meshes)
            {
                VAO geometry = VAOLoader.FromMesh(meshContainer.Value, _deferredProgram);

                if (meshContainer.Value is TBNMesh mesh)
                {
                    var loc = _deferredProgram.GetResourceLocation(ShaderResourceType.Attribute, TBNMesh.TangentName);
                    geometry.SetAttribute(loc, mesh.Tangent.ToArray(), VertexAttribPointerType.Float, 3);

                    loc = _deferredProgram.GetResourceLocation(ShaderResourceType.Attribute, TBNMesh.BitangentName);
                    geometry.SetAttribute(loc, mesh.Bitangent.ToArray(), VertexAttribPointerType.Float, 3);
                }

                _geometries.Add(meshContainer.Key, geometry);
            }

            _defaultMap = contentLoader.Load <ITexture2D>("Nvidia.png");

            _projectilesGenerationNvidia = new ProjectileGeneration(contentLoader, meshes[Enums.EntityType.NvidiaParticle], Enums.EntityType.NvidiaParticle);
            _projectilesGenerationRadeon = new ProjectileGeneration(contentLoader, meshes[Enums.EntityType.RadeonParticle], Enums.EntityType.RadeonParticle);
            _addProjectilesNvidia        = new AddWithDepthTest(contentLoader);
            _addProjectilesRadeon        = new AddWithDepthTest(contentLoader);

            _tesselation    = new Tesselation(contentLoader);
            _addTesselation = new AddWithDepthTest(contentLoader);
        }
        public ProjectileGeneration(IContentLoader contentLoader, DefaultMesh triangleMesh, Enums.EntityType triangleType)
        {
            _projectileGenerationProgram = contentLoader.Load <IShaderProgram>(new[] { "ProjectileGeneration.vert", "deferred.frag" });
            _trianglesGeometry           = VAOLoader.FromMesh(triangleMesh, _projectileGenerationProgram);
            _triangleType = triangleType;

            _add = new AddWithDepthTest(contentLoader);
        }