Ejemplo n.º 1
0
        public void SegmentCollectionGetSegmentsTest()
        {
            Segment[] segments = _collection.GetSegments().ToArray();

            Assert.AreEqual(_collection.Count, segments.Length);

            foreach (Segment segment in segments)
            {
                Assert.IsTrue(_collection.Contains(segment));
            }
        }
Ejemplo n.º 2
0
        public List <ShaderConstant> GetSpecializationConstants()
        {
            List <ShaderConstant> specializationConstants = new List <ShaderConstant>();

            IEnumerable <SpecializationConstantSegment> specializationConstantSegments = _segmentCollection.GetSegments <SpecializationConstantSegment>();

            uint offset = 0;

            for (int i = 0; i < specializationConstantSegments.Count(); i++)
            {
                SpecializationConstantSegment specializationConstantSegment = specializationConstantSegments.ElementAt(i);

                Type           type           = Constants.GlslToNetType[specializationConstantSegment.GlslType];
                uint           size           = Constants.TypeToSize[type];
                ShaderConstant shaderConstant = new ShaderConstant(specializationConstantSegment.ConstantId, specializationConstantSegment.Name, type, size, offset);
                specializationConstants.Add(shaderConstant);

                offset += size;
            }

            return(specializationConstants);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Prepares the result of the operation.
        /// </summary>
        /// <returns>The resulting object.</returns>
        protected override ISpectralGeometry PrepareResult()
        {
            _segmentNumbers = new Dictionary <Segment, UInt32>();

            UInt32 number = 0;

            foreach (Segment segment in _segmentCollection.GetSegments())
            {
                _segmentNumbers.Add(segment, number);
                number++;
            }

            Int32 radiometricResolution = _segmentCollection.Count > Int16.MaxValue ? 32 : (_segmentCollection.Count > Byte.MaxValue ? 16 : 8);

            SetResultProperties(RasterFormat.Integer, 1, radiometricResolution, RasterPresentation.CreateGrayscalePresentation());

            return(base.PrepareResult());
        }