Example #1
0
        /// <summary>
        /// On any camera being rendered to, add the camera to the list of cameras to which transfer data by way of a helper class.
        /// </summary>
        void OnRenderObject()
        {
            Camera currentCamera = Camera.current;

            if (_helperULRCameras == null)
            {
                _helperULRCameras = new List <Camera>();
            }
            if (!_helperULRCameras.Contains(currentCamera))
            {
                if (PMGlobalMeshEF.globalMesh != null)
                {
                    Helper_ULRCamera helperULRCamera = GeneralToolkit.GetOrAddComponent <Helper_ULRCamera>(currentCamera.gameObject);
                    int totalVertexCount             = PMGlobalMeshEF.globalMesh.vertexCount;
                    helperULRCamera.AddRenderedObject(this, totalVertexCount);
                    _helperULRCameras.Add(currentCamera);
                }
            }
            if (initialized)
            {
                // Update the buffers with the parameters of the source cameras.
                FillULRArrays();
                UpdateULRBuffers();
                // Update the blending material with the buffers.
                UpdateBlendingMaterialParameters(ref currentBlendingMaterial);
#if UNITY_EDITOR
                cameraSetup.SetColorIsIndices(ref currentBlendingMaterial);
#endif //UNITY_EDITOR
            }
        }
Example #2
0
 /// <inheritdoc/>
 public override void Reset()
 {
     base.Reset();
     // Initialize the helper methods.
     _helperFocalSurfaces = GeneralToolkit.GetOrAddComponent <Helper_FocalSurfaces>(gameObject);
     _helperFocalSurfaces.Reset();
 }
        /// <summary>
        /// Resets the object's properties.
        /// </summary>
        void Reset()
        {
            // Set the default values.
            UpdateRenderingObjectsList();
            launchOrderIndex      = renderingObjectCount;
            readyToBeLaunched     = false;
            _launchOnAwake        = true;
            _launched             = false;
            _previewRenderTexture = null;
            _previewEvalTexture   = null;
            // Get the processing component. If this was not called on AddComponent, reset it as well.
            _processing = GeneralToolkit.GetOrAddComponent <Processing.Processing>(gameObject);
            if (_processing.renderingCaller != null)
            {
                _processing.Reset();
            }
            else
            {
                _processing.renderingCaller = this;
            }
            // Initialize the rendering methods and helpers. This has to be done after the processing component has been reset.
            _renderingMethods = RenderingMethod.CreateOrResetRenderingMethods(transform);
            Method[] methods = GetComponentsInChildren <Method>();
            for (int iter = 0; iter < methods.Length; iter++)
            {
                methods[iter].InitializeLinks();
            }
            // Initialize the evaluation methods.
            _evaluationMethods = EvaluationMethod.GetOrCreateEvaluationMethods(transform);
#if UNITY_EDITOR
            UnityEditorInternal.InternalEditorUtility.SetIsInspectorExpanded(processing, false);
#endif //UNITY_EDITOR
        }
 /// <inheritdoc/>
 public override void Reset()
 {
     base.Reset();
     // Initialize the helper methods.
     _helperULR = GeneralToolkit.GetOrAddComponent <Helper_ULR>(gameObject);
     _helperULR.Reset();
 }
 /// <inheritdoc/>
 public override void Reset()
 {
     base.Reset();
     _useDebugColor = false;
     _mipMapLevel   = 2;
     // Initialize the helper methods.
     _helperDisocclusionTriangles = GeneralToolkit.GetOrAddComponent <Helper_DisocclusionTriangles>(gameObject);
     _helperDisocclusionTriangles.Reset();
 }
 /// <inheritdoc/>
 public override void Reset()
 {
     base.Reset();
     // Initialize the helper methods.
     _helperCommandBuffer = GeneralToolkit.GetOrAddComponent <Helper_CommandBuffer>(gameObject);
     _helperCommandBuffer.Reset();
     _helperDiskBlending = GeneralToolkit.GetOrAddComponent <Helper_DiskBlending>(gameObject);
     _helperDiskBlending.Reset();
 }
Example #7
0
 /// <inheritdoc/>
 public override void Reset()
 {
     base.Reset();
     _meshProjectionType        = 0;
     _triangleErrorThreshold    = 0.1f;
     _removeBackground          = false;
     _disocclusionHandlingIndex = 1;
     // Initialize the helper methods.
     _helperDisocclusionTriangles = GeneralToolkit.GetOrAddComponent <Helper_DisocclusionTriangles>(gameObject);
     _helperDisocclusionTriangles.Reset();
 }
Example #8
0
        /// <summary>
        /// Resets the camera parameters.
        /// </summary>
        public void Reset()
        {
            isOmnidirectional = false;
            focalDistance     = 1f;
            gizmoColor        = baseColor;
            _omnidirectionalPixelResolution = new Vector2Int(512, 256);
            _perspectivePixelResolution     = new Vector2Int(128, 128);
            _perspectiveFOV = new Vector2(60f, 60f);
            distanceRange   = new Vector2(0.3f, 1000f);
            SetCameraReferenceIndexAndImageName(1, string.Empty);
            meshRenderer = GeneralToolkit.GetOrAddComponent <MeshRenderer>(gameObject);
#if UNITY_EDITOR
            UnityEditorInternal.InternalEditorUtility.SetIsInspectorExpanded(meshRenderer, false);
#endif //UNITY_EDITOR
        }
Example #9
0
        /// <summary>
        /// Assigns the blending material to the instantiated global geometry.
        /// </summary>
        /// <param name="blendingMaterial"></param> The blending material to assign.
        public void AssignMaterialToGeometricProxy(ref Material blendingMaterial)
        {
            MeshRenderer renderer = GeneralToolkit.GetOrAddComponent <MeshRenderer>(PMGlobalMeshEF.globalMeshTransform.gameObject);

            Material[] materials = new Material[PMGlobalMeshEF.globalMesh.subMeshCount];
            for (int i = 0; i < materials.Length; i++)
            {
                materials[i] = blendingMaterial;
            }
            renderer.materials = materials;
            MaterialPropertyBlock propertyBlock = new MaterialPropertyBlock();

            for (int i = 0; i < materials.Length; i++)
            {
                propertyBlock.SetTexture(GlobalTextureMap.shaderNameGlobalTextureMap, PMGlobalTextureMap.textureMaps[i]);
                renderer.SetPropertyBlock(propertyBlock, i);
            }
        }
Example #10
0
 /// <summary>
 /// Creates the preview camera given a camera model.
 /// </summary>
 /// <param name="callerGO"></param> The caller gameobject.
 /// <param name="previewCameraTransform"></param> The transform on which to create a preview camera.
 /// <param name="sourceCameraModel"></param> The camera model with which to update the preview camera.
 public void CreatePreviewCamera(GameObject callerGO, Transform previewCameraTransform, CameraModel sourceCameraModel)
 {
     // The preview camera is only created if it is not already so.
     if (previewCamera == null)
     {
         // Set the camera's hide flags.
         previewCameraTransform.gameObject.hideFlags = HideFlags.HideAndDontSave;
         // Indicate that the camera object's parent is the caller object.
         previewCameraTransform.parent = callerGO.transform;
         // Set up the camera component on the given transform object.
         previewCamera           = GeneralToolkit.GetOrAddComponent <Camera>(previewCameraTransform.gameObject);
         previewCamera.hideFlags = previewCameraTransform.gameObject.hideFlags;
         // Indicate that this camera is monoscopic, even in VR mode.
         previewCamera.stereoTargetEye = StereoTargetEyeMask.None;
         // Disable the camera component so that it only renders when necessary.
         previewCamera.enabled = false;
         // Update the camera object from the parameters of the camera model.
         UpdateCameraModel(sourceCameraModel, false);
     }
 }