Exemplo n.º 1
0
        public void SerializeBoundingBoxValue_ValidObjectsGiven_ShouldPass(string crsUri, int dimensionCount, double[] lCornerPoints, double[] rCornerPoints)
        {
            Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("de-DE");

            var expectedXml = $@"<?xml version=""1.0"" encoding=""utf-8""?>
<BoundingBox p1:crs=""crs-uri"" p1:dimensions=""3"" xmlns:p1=""http://www.opengis.net/ows/2.0"" xmlns=""http://www.opengis.net/ows/2.0"">
    <ows:LowerCorner xmlns:ows=""http://www.opengis.net/ows/2.0"">{string.Join(" ", lCornerPoints)}</ows:LowerCorner>
    <ows:UpperCorner xmlns:ows=""http://www.opengis.net/ows/2.0"">{string.Join(" ", rCornerPoints)}</ows:UpperCorner>
</BoundingBox>";

            // Remove white spaces and new line characters for XML comparison.
            var trimmedExpectedXml = Regex.Replace(expectedXml, @"\s+", string.Empty);

            var boundingBoxData = new BoundingBoxValue
            {
                CrsUri            = crsUri,
                DimensionCount    = dimensionCount,
                LowerCornerPoints = lCornerPoints,
                UpperCornerPoints = rCornerPoints,
            };

            var resultXml     = _serializer.Serialize(boundingBoxData);
            var trimmedResult = Regex.Replace(resultXml, @"\s+", string.Empty);

            trimmedResult.Should().Be(trimmedExpectedXml);
        }
Exemplo n.º 2
0
 public ParticleParams(int apiVersion, EventHandler handler, bool hasTorus)
     : base(apiVersion, handler)
 {
     bHasTorus         = hasTorus;
     mParticleLifetime = new Vector2ValueLE(apiVersion, handler, 10f, 10f);
     //mPrerollTime
     mEmitDelay      = new Vector2ValueLE(apiVersion, handler, -1f, -1f);
     mEmitRetrigger  = new Vector2ValueLE(apiVersion, handler, -1f, -1f);
     mEmitDirection  = new BoundingBoxValue(apiVersion, handler);
     mEmitSpeed      = new Vector2ValueLE(apiVersion, handler);
     mEmitVolume     = new BoundingBoxValue(apiVersion, handler);
     mEmitTorusWidth = -1f;
 }
Exemplo n.º 3
0
 public ParticleParams(int apiVersion, EventHandler handler, bool hasTorus, ParticleParams basis)
     : base(apiVersion, handler)
 {
     bHasTorus         = hasTorus;
     mParticleLifetime = new Vector2ValueLE(apiVersion, handler, basis.mParticleLifetime);
     mPrerollTime      = basis.mPrerollTime;
     mEmitDelay        = new Vector2ValueLE(apiVersion, handler, basis.mEmitDelay);
     mEmitRetrigger    = new Vector2ValueLE(apiVersion, handler, basis.mEmitRetrigger);
     mEmitDirection    = new BoundingBoxValue(apiVersion, handler, basis.mEmitDirection);
     mEmitSpeed        = new Vector2ValueLE(apiVersion, handler, basis.mEmitSpeed);
     mEmitVolume       = new BoundingBoxValue(apiVersion, handler, basis.mEmitVolume);
     mEmitTorusWidth   = basis.mEmitTorusWidth;
 }
        void OnRenderedObjectInfosCalculated(int frameCount, NativeArray <RenderedObjectInfo> renderedObjectInfos)
        {
            if (!m_AsyncAnnotations.TryGetValue(frameCount, out var asyncAnnotation))
            {
                return;
            }

            m_AsyncAnnotations.Remove(frameCount);

            using (s_BoundingBoxCallback.Auto())
            {
                if (m_BoundingBoxValues == null || m_BoundingBoxValues.Length != renderedObjectInfos.Length)
                {
                    m_BoundingBoxValues = new BoundingBoxValue[renderedObjectInfos.Length];
                }

                for (var i = 0; i < renderedObjectInfos.Length; i++)
                {
                    var objectInfo = renderedObjectInfos[i];
                    if (!idLabelConfig.TryGetLabelEntryFromInstanceId(objectInfo.instanceId, out var labelEntry))
                    {
                        continue;
                    }

                    m_BoundingBoxValues[i] = new BoundingBoxValue
                    {
                        label_id    = labelEntry.id,
                        label_name  = labelEntry.label,
                        instance_id = objectInfo.instanceId,
                        x           = objectInfo.boundingBox.x,
                        y           = objectInfo.boundingBox.y,
                        width       = objectInfo.boundingBox.width,
                        height      = objectInfo.boundingBox.height,
                    };
                }

                if (!CaptureOptions.useAsyncReadbackIfSupported && frameCount != Time.frameCount)
                {
                    Debug.LogWarning("Not on current frame: " + frameCount + "(" + Time.frameCount + ")");
                }

                if (visualizationEnabled)
                {
                    Visualize();
                }

                asyncAnnotation.ReportValues(m_BoundingBoxValues);
            }
        }
Exemplo n.º 5
0
            protected override void Parse(Stream stream)
            {
                var s = new BinaryStreamWrapper(stream, ByteOrder.BigEndian);

                mParticleLifetime = new Vector2ValueLE(requestedApiVersion, handler, stream);
                s.Read(out mPrerollTime);
                mEmitDelay     = new Vector2ValueLE(requestedApiVersion, handler, stream);
                mEmitRetrigger = new Vector2ValueLE(requestedApiVersion, handler, stream);
                mEmitDirection = new BoundingBoxValue(requestedApiVersion, handler, stream);
                mEmitSpeed     = new Vector2ValueLE(requestedApiVersion, handler, stream);
                mEmitVolume    = new BoundingBoxValue(requestedApiVersion, handler, stream);
                if (bHasTorus)
                {
                    s.Read(out mEmitTorusWidth);
                }
            }
        void OnRenderedObjectInfosCalculated(int frameCount, NativeArray <RenderedObjectInfo> renderedObjectInfos)
        {
            if (!m_AsyncAnnotations.TryGetValue(frameCount, out var asyncAnnotation))
            {
                return;
            }

            m_AsyncAnnotations.Remove(frameCount);

            using (s_BoundingBoxCallback.Auto())
            {
                if (m_BoundingBoxValues == null || m_BoundingBoxValues.Length != renderedObjectInfos.Length)
                {
                    m_BoundingBoxValues = new BoundingBoxValue[renderedObjectInfos.Length];
                }

                for (var i = 0; i < renderedObjectInfos.Length; i++)
                {
                    var objectInfo = renderedObjectInfos[i];
                    if (!idLabelConfig.TryGetLabelEntryFromInstanceId(objectInfo.instanceId, out var labelEntry))
                    {
                        continue;
                    }

                    m_BoundingBoxValues[i] = new BoundingBoxValue
                    {
                        label_id    = labelEntry.id,
                        label_name  = labelEntry.label,
                        instance_id = objectInfo.instanceId,
                        x           = objectInfo.boundingBox.x,
                        y           = objectInfo.boundingBox.y,
                        width       = objectInfo.boundingBox.width,
                        height      = objectInfo.boundingBox.height,
                    };
                }

                asyncAnnotation.ReportValues(m_BoundingBoxValues);
            }
        }