Ejemplo n.º 1
0
        public BeamStarRenderer(ITagContainer diContainer, DeviceBufferRange locationRange, BeamStar data)
        {
            this.data = data;
            var textureLoader = diContainer.GetTag <IAssetLoader <Texture> >();
            var camera        = diContainer.GetTag <Camera>();

            quadMeshBuffer = diContainer.GetTag <IQuadMeshBuffer <EffectVertex> >();
            material       = EffectMaterial.CreateFor(data.renderMode, diContainer);
            material.LinkTransformsTo(camera);
            material.World.BufferRange        = locationRange;
            material.Uniforms.Value           = EffectMaterialUniforms.Default;
            material.Uniforms.Ref.isBillboard = false;
            material.MainTexture.Texture      = textureLoader.LoadTexture(
                IEffectPartRenderer.TexturePath, data.texName);
            material.Sampler.Value = IEffectPartRenderer.SamplerDescription;
            AddDisposable(material);

            quadRange = quadMeshBuffer.Reserve(data.complexity.GetPlaneCount() * 2);

            Reset();
        }
Ejemplo n.º 2
0
        public MovingPlanesRenderer(ITagContainer diContainer, DeviceBufferRange locationRange, MovingPlanes data)
        {
            this.data = data;
            var textureLoader = diContainer.GetTag <IAssetLoader <Texture> >();
            var camera        = diContainer.GetTag <Camera>();

            quadMeshBuffer = diContainer.GetTag <IQuadMeshBuffer <EffectVertex> >();
            material       = EffectMaterial.CreateFor(data.renderMode, diContainer);
            material.LinkTransformsTo(camera);
            material.World.BufferRange        = locationRange;
            material.Uniforms.Value           = EffectMaterialUniforms.Default;
            material.Uniforms.Ref.isBillboard = !data.circlesAround && !data.useDirection;
            material.MainTexture.Texture      = textureLoader.LoadTexture(
                IEffectPartRenderer.TexturePath, data.texName);
            material.Sampler.Value = IEffectPartRenderer.SamplerDescription;
            AddDisposable(material);

            quadRange = quadMeshBuffer.Reserve(data.disableSecondPlane ? 1 : 2);
            texCoords = EffectPartUtility.GetTileUV(data.tileW, data.tileH, data.tileId);

            Reset();
        }
Ejemplo n.º 3
0
        public RandomPlanesRenderer(ITagContainer diContainer, DeviceBufferRange locationRange, RandomPlanes data)
        {
            this.data = data;
            var textureLoader = diContainer.GetTag <IAssetLoader <Texture> >();
            var camera        = diContainer.GetTag <Camera>();

            quadMeshBuffer = diContainer.GetTag <IQuadMeshBuffer <EffectVertex> >();
            material       = EffectMaterial.CreateFor(data.renderMode, diContainer);
            material.LinkTransformsTo(camera);
            material.World.BufferRange                 = locationRange;
            material.Uniforms.Value                    = EffectMaterialUniforms.Default;
            material.Uniforms.Ref.isBillboard          = !data.circlesAround;
            AddDisposable(material.MainTexture.Texture = textureLoader.LoadTexture(
                              IEffectPartRenderer.TexturePath, data.texName));
            material.Sampler.Value = SamplerAddressMode.Clamp.AsDescription(SamplerFilter.MinLinear_MagLinear_MipLinear);
            AddDisposable(material);

            planes        = new RandomPlane[(int)(data.planeLife * data.spawnRate / 1000)];
            quadRange     = quadMeshBuffer.Reserve(planes.Length);
            tileTexCoords = EffectPartUtility.GetTileUV(data.tileW, data.tileH, data.tileId, data.tileCount);

            Reset();
        }