Exemple #1
0
        /// <summary>
        /// Applies the texture data in the <c>XRTextureDescriptor</c> to the reflection probe settings.
        /// </summary>
        /// <param name="textureDescriptor">The environment texture data to apply to the reflection probe baked
        /// texture.</param>
        void UpdateEnvironmentTexture(XRTextureDescriptor textureDescriptor)
        {
            // If the current environment texture equals the given environment texture, the texture does not need to be
            // updated.
            if (m_CurrentTextureDescriptor.Equals(textureDescriptor))
            {
                return;
            }

            // Get the current baked texture as a cubemap, if any.
            Cubemap cubemapTexture = m_ReflectionProbe.customBakedTexture as Cubemap;

#if UNITY_2019_1_OR_NEWER
            const bool k_NoCubemapUpdate = false;
#else
            const bool k_NoCubemapUpdate = true;
#endif

            // If there is no current reflection probe texture or if the current environment texture data is not
            // identical to the given environment texture metadata, then we need to create a new environment texture
            // object.
            if (k_NoCubemapUpdate || (cubemapTexture == null) ||
                !m_CurrentTextureDescriptor.hasIdenticalTextureMetadata(textureDescriptor))
            {
                // Destroy any previous texture object.
                if (m_ReflectionProbe.customBakedTexture != null)
                {
                    Object.Destroy(m_ReflectionProbe.customBakedTexture);
                }

                // Create a new environment texture object.
                m_ReflectionProbe.customBakedTexture = CreateEnvironmentTexture(textureDescriptor);
            }
#if UNITY_2019_1_OR_NEWER
            else
            {
                // Else, we have a current texture object with identical metadata, we simply update the external
                // texture with the native texture.
                cubemapTexture.UpdateExternalTexture(textureDescriptor.nativeTexture);
            }
#endif

            // Update the current environment texture metadata.
            m_CurrentTextureDescriptor = textureDescriptor;
        }
 public bool Equals(CameraFrame o)
 {
     return(timestampNs.Equals(o.timestampNs) &&
            averageBrightness.Equals(o.averageBrightness) &&
            averageColorTemperature.Equals(o.averageColorTemperature) &&
            colorCorrection.Equals(o.colorCorrection) &&
            projectionMatrix.Equals(o.projectionMatrix) &&
            displayMatrix.Equals(o.displayMatrix) &&
            trackingState.Equals(o.trackingState) &&
            nativePtr.Equals(o.nativePtr) &&
            properties.Equals(o.properties) &&
            averageIntensityInLumens.Equals(o.averageIntensityInLumens) &&
            exposureDuration.Equals(o.exposureDuration) &&
            exposureOffset.Equals(o.exposureOffset) &&
            mainLightIntensityLumens.Equals(o.mainLightIntensityLumens) &&
            mainLightColor.Equals(o.mainLightColor) &&
            mainLightDirection.Equals(o.mainLightDirection) &&
            ambientSphericalHarmonics.Equals(o.ambientSphericalHarmonics) &&
            cameraGrain.Equals(o.cameraGrain) &&
            noiseIntensity.Equals(o.noiseIntensity));
 }
 public bool Equals(ARTextureInfo other)
 {
     return(m_Descriptor.Equals(other) && (m_Texture == other.m_Texture));
 }